conformtools 0.6.5 → 0.6.6
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 +3 -3
- package/dist/account-HDXVTS5T.js +3 -0
- package/dist/arriraw-YIJ3BYNN.js +525 -0
- package/dist/avid-panel/MANIFEST.json +11 -0
- package/dist/avid-panel/avid-manifest.json +46 -0
- package/dist/avid-panel/icon.svg +4 -0
- package/dist/avid-panel/icons/conformtools.svg +4 -0
- package/dist/avid-panel/index.html +26 -0
- package/dist/avid-panel/panel.css +12 -0
- package/dist/avid-panel/panel.js +7 -0
- package/dist/bridge-D5KPIUSY.js +3 -0
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/chunk-3OCQA33E.js +3 -0
- package/dist/chunk-3XD6NC4G.js +10 -0
- package/dist/chunk-5JBUCVRI.js +20 -0
- package/dist/chunk-5RSNFPED.js +8 -0
- package/dist/chunk-5SUGU2YR.js +3 -0
- package/dist/chunk-6ML26TIK.js +3 -0
- package/dist/chunk-7D7H6VFW.js +3 -0
- package/dist/chunk-7MC7M2Y5.js +3 -0
- package/dist/chunk-AACY2V3L.js +3 -0
- package/dist/chunk-AS7IXHYM.js +19 -0
- package/dist/chunk-BL6L5ZBP.js +39 -0
- package/dist/chunk-C2ESM27Z.js +3 -0
- package/dist/chunk-C5IX63YF.js +3 -0
- package/dist/chunk-D6YDLKSA.js +3 -0
- package/dist/chunk-DKGGJM6Z.js +3 -0
- package/dist/chunk-EJGVNQ3E.js +8 -0
- package/dist/chunk-HGDO3OED.js +3 -0
- package/dist/chunk-JV7TZDKJ.js +3 -0
- package/dist/chunk-LFJLRLEP.js +3 -0
- package/dist/chunk-NFJHWZJX.js +3 -0
- package/dist/chunk-NQHQKEP5.js +3 -0
- package/dist/chunk-NU3X7P4N.js +3 -0
- package/dist/chunk-OJWIBQK4.js +376 -0
- package/dist/chunk-OVUCL3YY.js +5 -0
- package/dist/chunk-P7OVDUA5.js +3 -0
- package/dist/chunk-PFISREY4.js +3 -0
- package/dist/chunk-PFZVET7S.js +3 -0
- package/dist/chunk-PLRB2YXJ.js +3 -0
- package/dist/chunk-PSANHDZM.js +3 -0
- package/dist/chunk-RFIPLBQ4.js +5 -0
- package/dist/chunk-SZD4C5MB.js +6 -0
- package/dist/chunk-TK55FA56.js +3 -0
- package/dist/chunk-TXQR2HI2.js +4 -0
- package/dist/chunk-UCMNH6Q6.js +3 -0
- package/dist/chunk-UKKRZ574.js +7 -0
- package/dist/chunk-VS3MKKJ5.js +3 -0
- package/dist/chunk-X53BNWNV.js +3 -0
- package/dist/chunk-XNR7M4VX.js +3 -0
- package/dist/claude-setup-IIWUB4CE.js +5 -0
- package/dist/cli.js +17 -0
- package/dist/clip-state-B6JOX3JE.js +3 -0
- package/dist/conformtools-analyze +0 -0
- package/dist/conformtools-decode +0 -0
- package/dist/cr3-wasm-L2LFY3LM.js +3 -0
- package/dist/dng-wasm-U6NC3MDK.js +3 -0
- package/dist/dpx-wasm-RMKEUKED.js +3 -0
- package/dist/engine-P6H5P6HP.js +5 -0
- package/dist/esm-SFFBP7PS.js +3 -0
- package/dist/exr-wasm-LBAOMOZD.js +3 -0
- package/dist/flame/hook/conformtools_flame/__init__.py +10 -0
- package/dist/flame/hook/conformtools_flame/building.py +191 -0
- package/dist/flame/hook/conformtools_flame/hook.py +177 -0
- package/dist/flame/hook/conformtools_flame/render.py +622 -0
- package/dist/flame/hook/conformtools_flame/util.py +33 -0
- package/dist/flame/hook/conformtools_flame/verbs.py +1037 -0
- package/dist/flame/hook/conformtools_flame_hook.py +42 -0
- package/dist/fonts/gfx/BarlowCondensed-Bold.ttf +0 -0
- package/dist/fonts/gfx/BarlowCondensed-Regular.ttf +0 -0
- package/dist/fonts/gfx/InstrumentSerif-Regular.ttf +0 -0
- package/dist/fonts/gfx/Inter-Bold.ttf +0 -0
- package/dist/fonts/gfx/Inter-Regular.ttf +0 -0
- package/dist/fonts/gfx/JetBrainsMono-Bold.ttf +0 -0
- package/dist/fonts/gfx/JetBrainsMono-Regular.ttf +0 -0
- package/dist/fonts/gfx/OFL.txt +100 -0
- package/dist/framing-SRCJKAYO.js +3 -0
- package/dist/gfx-worker.js +3 -0
- package/dist/h264-3ESGVT6G.js +3 -0
- package/dist/h264-mxf-NPFS7NGH.js +3 -0
- package/dist/host-relink-D6CB2VOQ.js +10 -0
- package/dist/hosts-W4AD2MYH.js +3 -0
- package/dist/http.js +5 -0
- package/dist/i2o-transfer +0 -0
- package/dist/inspect-7ASUPU73.js +68 -0
- package/dist/isobmff-SIOE67WL.js +3 -0
- package/dist/mcp.js +13 -0
- package/dist/media-7AUNRKHF.js +3 -0
- package/dist/media_core-Q2PIEV7D.js +9 -0
- package/dist/media_core_bg-FDL7GJZP.js +3 -0
- package/dist/media_core_bg-XRBVKQZH.js +3 -0
- package/dist/mxf-74TTDICM.js +3 -0
- package/dist/nuke/panel/python/Startup/conformtools_nuke_startup.py +44 -0
- package/dist/nuke/panel/python/conformtools_nuke/__init__.py +10 -0
- package/dist/nuke/panel/python/conformtools_nuke/panel.py +217 -0
- package/dist/nuke/panel/python/conformtools_nuke/verbs.py +837 -0
- package/dist/ops-FSOOBXMV.js +3 -0
- package/dist/peer-kit/ctpeer/__init__.py +21 -0
- package/dist/peer-kit/ctpeer/client.py +247 -0
- package/dist/peer-kit/ctpeer/neutral.py +178 -0
- package/dist/peer-kit/ctpeer/pairing.py +139 -0
- package/dist/peer-kit/ctpeer/protocol.py +209 -0
- package/dist/peer-kit/ctpeer/websocket.py +289 -0
- package/dist/premiere-uxp/icons/panel.png +0 -0
- package/dist/premiere-uxp/icons/panel@2x.png +0 -0
- package/dist/premiere-uxp/icons/plugin.png +0 -0
- package/dist/premiere-uxp/icons/plugin@2x.png +0 -0
- package/dist/premiere-uxp/index.html +38 -0
- package/dist/premiere-uxp/index.js +93 -0
- package/dist/premiere-uxp/lib/clipmeta.js +170 -0
- package/dist/premiere-uxp/lib/ctx.js +68 -0
- package/dist/premiere-uxp/lib/edit.js +516 -0
- package/dist/premiere-uxp/lib/handles.js +57 -0
- package/dist/premiere-uxp/lib/markers.js +198 -0
- package/dist/premiere-uxp/lib/pairing.js +67 -0
- package/dist/premiere-uxp/lib/premiere.js +91 -0
- package/dist/premiere-uxp/lib/probe.js +241 -0
- package/dist/premiere-uxp/lib/protocol.js +165 -0
- package/dist/premiere-uxp/lib/render.js +45 -0
- package/dist/premiere-uxp/lib/session.js +85 -0
- package/dist/premiere-uxp/lib/sizing.js +325 -0
- package/dist/premiere-uxp/lib/time.js +88 -0
- package/dist/premiere-uxp/lib/timeline.js +336 -0
- package/dist/premiere-uxp/lib/verbs.js +21 -0
- package/dist/premiere-uxp/lib/write.js +97 -0
- package/dist/premiere-uxp/manifest.json +102 -0
- package/dist/probe-F7WQHMIA.js +3 -0
- package/dist/prores-RIG37OIH.js +526 -0
- package/dist/r3d-YTLOMC7C.js +3 -0
- package/dist/r3d-ZDJ3WURS.js +1025 -0
- package/dist/resolve-bridge.py +2286 -0
- package/dist/resolve-presets/conform.tools.xml +127 -0
- package/dist/source-BDJAUQVR.js +3 -0
- package/dist/statusline-GMMCFMOA.js +4 -0
- package/dist/statusline.js +3 -0
- package/dist/still-ZG2RUQAL.js +3 -0
- package/dist/store-ZHXLQCGN.js +3 -0
- package/dist/tiff-wasm-D2FJ3L56.js +3 -0
- package/dist/timeline-6DYFDVEH.js +3 -0
- package/dist/timeline_core-IOENXK4Z.js +3 -0
- package/dist/timeline_core_bg-JW42YM3G.js +3 -0
- package/dist/udf_bg-B37GKRIH.js +3 -0
- package/dist/wasm/media_core_bg.wasm +0 -0
- package/dist/wasm/udf_bg.wasm +0 -0
- package/dist/wasm-threads/media_core_bg.wasm +0 -0
- package/dist/wav-OWMUGQMM.js +3 -0
- package/package.json +6 -4
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{a as ma,b as ww,c as kw,d as $w,e as xw,f as jm,j as N0,l as F0,m as L0,n as Ol,p as z0,q as U0}from"./chunk-OVUCL3YY.js";import{a as H0,b as W0,c as ga,d as q0,e as X0,j as wt}from"./chunk-UKKRZ574.js";import{a as tk}from"./chunk-RFIPLBQ4.js";import{d as Y0,e as Q0,f as ek}from"./chunk-SZD4C5MB.js";import{$ as C0,G as v0,H as w0,I as k0,J as Al,K as $0,L as x0,M as S0,O as Oo,P as Un,Q as R0,R as I0,T as T0,U as P0,V as El,W as A0,X as E0,Y as Dm,Z as O0,_ as M0,a as bw,aa as D0,b as Pm,ba as j0,c as Ze,d as _w,e as vw,f as Rw,g as Iw,h as Tw,i as Yt,j as d0,k as m0,l as f0,m as p0,n as h0,o as g0,p as ha,q as Cm,r as Pl,s as b0,t as y0}from"./chunk-BL6L5ZBP.js";import{a as Nn,c as qv,e as Xv}from"./chunk-5JBUCVRI.js";import{f as _0}from"./chunk-PFISREY4.js";import{a as Ml,b as J0,c as K0}from"./chunk-TXQR2HI2.js";import{c as Sw}from"./chunk-JV7TZDKJ.js";import{a as Fr,b as Lr,c as fa,d as Mm,f as Sl,g as pa,i as Rl,k as Pe,l as a0,m as s0,p as Il,s as l0,t as Tl,u as c0,v as u0}from"./chunk-3XD6NC4G.js";import{a as lr,b as ln,c as i0}from"./chunk-PFZVET7S.js";import{b as r0,e as o0,f as xl}from"./chunk-P7OVDUA5.js";import{b as Qw,c as e0}from"./chunk-UCMNH6Q6.js";import{a as qw,b as Xw,d as Yw,e as $l}from"./chunk-7MC7M2Y5.js";import{d as t0,e as n0,f as jr,i as Nr}from"./chunk-XNR7M4VX.js";import{a as B0,b as V0,c as Z0,d as G0,g as nk,h as Nm,i as Fm,j as Lm,k as rk,l as ok,m as ik,o as ak,q as sk,r as lk}from"./chunk-AS7IXHYM.js";import{a as _l,b as ce,d as qe,e as yw,f as $n}from"./chunk-NU3X7P4N.js";import{Ca as Ww,D as Nw,Da as Jw,E as Fw,F as Em,Fa as Kw,Ga as sr,K as Lw,M as zw,O as Uw,P as Bw,R as Vw,S as Zw,U as Om,c as wl,d as Aw,f as Ew,h as Ow,i as kl,k as Mw,l as Cw,la as Gw,u as Am,y as Dw,ya as Hw,z as jw}from"./chunk-C5IX63YF.js";import{A as Xt,B as Fe,C as ht,D as hw,E as yl,F as gw,a as ua,b as nw,c as rw,d as ow,e as xm,f as Fn,g as iw,h as Ln,i as aw,j as sw,k as lw,l as Sm,m as cw,n as Rm,o as uw,p as rt,q as da,r as Im,s as dw,t as mw,u as Tm,v as fw,w as zn,x as pw}from"./chunk-EJGVNQ3E.js";import{a as gl,b as pt,c as Yv,d as qt,g as Dr,h as bl,i as $m,m as Qv,o as ew,p as tw}from"./chunk-5RSNFPED.js";import{a as P,b as z,c as Ae,d as D}from"./chunk-3OCQA33E.js";import{B as pl,C as Gv,D as et,F as hl,H as nt,I as je,J as wm,L as wn,M as Hv,N as kn,O as Wv,T as km,U as Jv,V as B,W as ft,X as Kt,Y as M,Z as Kv,b as Ke,c as _m,g as vt,i as vm,j as Vv,k as he,l as ir,m as Eo,o as Zv,p as jn,q as ct,r as Ge,s as Zt,t as ar,u as ut,v as _e,w as Nt,x as ge,y as be,z as sn}from"./chunk-PLRB2YXJ.js";import{M as Pw,S as vl}from"./chunk-C2ESM27Z.js";import{d as Dn}from"./chunk-PSANHDZM.js";var h={};Dn(h,{$brand:()=>Qm,$input:()=>Sh,$output:()=>xh,INVALID:()=>Et,NEVER:()=>Ym,TimePrecision:()=>jh,ZodAny:()=>$b,ZodArray:()=>Ib,ZodBase64:()=>Au,ZodBase64URL:()=>Eu,ZodBigInt:()=>hi,ZodBigIntFormat:()=>Cu,ZodBoolean:()=>pi,ZodCIDRv4:()=>Tu,ZodCIDRv6:()=>Pu,ZodCUID:()=>wu,ZodCUID2:()=>ku,ZodCatch:()=>Jb,ZodCodec:()=>us,ZodCompileAsyncError:()=>un,ZodCompileUnsupportedError:()=>Se,ZodCreditCard:()=>hb,ZodCustom:()=>ds,ZodCustomStringFormat:()=>ro,ZodDate:()=>os,ZodDefault:()=>Bb,ZodDiscriminatedUnion:()=>Pb,ZodE164:()=>Ou,ZodEmail:()=>bu,ZodEmoji:()=>_u,ZodEnum:()=>di,ZodError:()=>a2,ZodExactOptional:()=>Fu,ZodFile:()=>Fb,ZodFirstPartyTypeKind:()=>ly,ZodFunction:()=>oy,ZodGUID:()=>yu,ZodIBAN:()=>gb,ZodIPv4:()=>Ru,ZodIPv6:()=>Iu,ZodISODate:()=>yr,ZodISODateTime:()=>br,ZodISODuration:()=>vr,ZodISOTime:()=>_r,ZodInstanceOf:()=>sy,ZodIntersection:()=>Ab,ZodIssueCode:()=>c2,ZodJWT:()=>Mu,ZodKSUID:()=>Su,ZodLazy:()=>ty,ZodLiteral:()=>Nb,ZodMAC:()=>pb,ZodMap:()=>Db,ZodNaN:()=>qb,ZodNanoID:()=>vu,ZodNever:()=>Sb,ZodNonOptional:()=>Lu,ZodNull:()=>wb,ZodNullable:()=>Ub,ZodNumber:()=>fi,ZodNumberFormat:()=>oo,ZodObject:()=>as,ZodOptional:()=>ls,ZodPipe:()=>cs,ZodPrefault:()=>Zb,ZodPreprocess:()=>Xb,ZodPromise:()=>ry,ZodReadonly:()=>Yb,ZodRealError:()=>Bt,ZodRecord:()=>ui,ZodSet:()=>jb,ZodString:()=>mi,ZodStringFormat:()=>Ne,ZodSuccess:()=>Wb,ZodSymbol:()=>_b,ZodTemplateLiteral:()=>ey,ZodTransform:()=>Lb,ZodTuple:()=>Ob,ZodType:()=>ve,ZodULID:()=>$u,ZodURL:()=>rs,ZodUUID:()=>In,ZodUndefined:()=>vb,ZodUnion:()=>ss,ZodUnknown:()=>xb,ZodVoid:()=>Rb,ZodXID:()=>xu,ZodXor:()=>Tb,_ZodString:()=>gu,_default:()=>Vb,_function:()=>BS,any:()=>_S,array:()=>is,base64:()=>Qx,base64url:()=>eS,bigint:()=>pS,boolean:()=>yb,catch:()=>Kb,check:()=>VS,cidrv4:()=>Xx,cidrv6:()=>Yx,clone:()=>Oe,codec:()=>FS,coerce:()=>uy,compile:()=>Ph,config:()=>Xe,core:()=>Hn,creditCard:()=>nS,cuid:()=>Vx,cuid2:()=>Zx,currencyCode:()=>lS,custom:()=>ZS,date:()=>wS,decode:()=>sb,decodeAsync:()=>cb,deepPartial:()=>r1,describe:()=>GS,discriminatedUnion:()=>IS,e164:()=>tS,email:()=>Mx,emoji:()=>Ux,encode:()=>ab,encodeAsync:()=>lb,endsWith:()=>Qo,enum:()=>ju,exactOptional:()=>zb,file:()=>CS,flattenError:()=>Ra,float32:()=>uS,float64:()=>dS,formatError:()=>Ia,fromJSONSchema:()=>t1,function:()=>BS,getDiscriminatedOption:()=>Yp,getErrorMap:()=>d2,globalRegistry:()=>bt,gt:()=>Sn,gte:()=>Ht,guid:()=>Cx,hash:()=>cS,hex:()=>sS,hostname:()=>aS,httpUrl:()=>zx,iban:()=>rS,includes:()=>Xo,input:()=>i1,instanceof:()=>WS,int:()=>pu,int32:()=>mS,int64:()=>hS,intersection:()=>Eb,invertCodec:()=>LS,ipv4:()=>Jx,ipv6:()=>qx,iso:()=>ms,json:()=>KS,jwt:()=>oS,keyof:()=>kS,ksuid:()=>Wx,lazy:()=>ny,length:()=>Yr,literal:()=>MS,locales:()=>Wa,looseObject:()=>SS,looseRecord:()=>PS,lowercase:()=>Ko,lt:()=>xn,lte:()=>Gt,mac:()=>Kx,map:()=>AS,maxLength:()=>Xr,maxSize:()=>fr,memoizer:()=>Ga,meta:()=>HS,mime:()=>ti,minLength:()=>Gn,minSize:()=>Rn,multipleOf:()=>mr,nan:()=>NS,nanoid:()=>Bx,nativeEnum:()=>OS,negative:()=>ru,never:()=>Du,nonnegative:()=>iu,nonoptional:()=>Hb,nonpositive:()=>ou,normalize:()=>ni,null:()=>kb,nullable:()=>ns,nullish:()=>DS,number:()=>bb,object:()=>$S,optional:()=>to,output:()=>a1,overwrite:()=>dn,parse:()=>nb,parseAsync:()=>rb,partialRecord:()=>TS,pipe:()=>hu,positive:()=>nu,prefault:()=>Gb,preprocess:()=>qS,prettifyError:()=>of,promise:()=>US,properties:()=>ei,property:()=>au,readonly:()=>Qb,record:()=>Cb,refine:()=>iy,regex:()=>Jo,regexes:()=>tn,registry:()=>Ec,safeDecode:()=>db,safeDecodeAsync:()=>fb,safeEncode:()=>ub,safeEncodeAsync:()=>mb,safeParse:()=>ob,safeParseAsync:()=>ib,set:()=>ES,setErrorMap:()=>u2,size:()=>qr,slugify:()=>ai,startsWith:()=>Yo,strictObject:()=>xS,string:()=>ts,stringFormat:()=>iS,stringbool:()=>JS,success:()=>jS,superRefine:()=>ay,symbol:()=>bS,templateLiteral:()=>zS,toJSONSchema:()=>uu,toLowerCase:()=>oi,toUpperCase:()=>ii,toZod:()=>ba,transform:()=>Nu,treeifyError:()=>rf,trim:()=>ri,tuple:()=>Mb,uint32:()=>fS,uint64:()=>gS,ulid:()=>Gx,undefined:()=>yS,union:()=>gi,unknown:()=>eo,uppercase:()=>qo,url:()=>Lx,util:()=>N,uuid:()=>Dx,uuidv4:()=>jx,uuidv6:()=>Nx,uuidv7:()=>Fx,validate:()=>Ta,validateAsync:()=>Pa,void:()=>vS,withParser:()=>Oc,xid:()=>Hx,xor:()=>RS});var Hn={};Dn(Hn,{$ZodAny:()=>Zp,$ZodArray:()=>Kp,$ZodAsyncError:()=>zt,$ZodBase64:()=>Op,$ZodBase64URL:()=>Mp,$ZodBigInt:()=>bc,$ZodBigIntFormat:()=>zp,$ZodBoolean:()=>La,$ZodCIDRv4:()=>Ap,$ZodCIDRv6:()=>Ep,$ZodCUID:()=>yp,$ZodCUID2:()=>_p,$ZodCatch:()=>ph,$ZodCheck:()=>Le,$ZodCheckBigIntFormat:()=>Gf,$ZodCheckEndsWith:()=>rp,$ZodCheckGreaterThan:()=>tc,$ZodCheckIncludes:()=>tp,$ZodCheckLengthEquals:()=>Xf,$ZodCheckLessThan:()=>ec,$ZodCheckLowerCase:()=>Qf,$ZodCheckMaxLength:()=>Kf,$ZodCheckMaxSize:()=>Hf,$ZodCheckMimeType:()=>ap,$ZodCheckMinLength:()=>qf,$ZodCheckMinSize:()=>Wf,$ZodCheckMultipleOf:()=>Vf,$ZodCheckNumberFormat:()=>Zf,$ZodCheckOverwrite:()=>sp,$ZodCheckProperties:()=>ip,$ZodCheckProperty:()=>op,$ZodCheckRegex:()=>Yf,$ZodCheckSizeEquals:()=>Jf,$ZodCheckStartsWith:()=>np,$ZodCheckStringFormat:()=>Vo,$ZodCheckUpperCase:()=>ep,$ZodCodec:()=>Ua,$ZodCreditCard:()=>Dp,$ZodCustom:()=>wh,$ZodCustomStringFormat:()=>Fp,$ZodCyclicError:()=>xc,$ZodDate:()=>Jp,$ZodDefault:()=>uh,$ZodDiscriminatedUnion:()=>Qp,$ZodE164:()=>Cp,$ZodEmail:()=>mp,$ZodEmoji:()=>gp,$ZodEncodeError:()=>dr,$ZodEnum:()=>oh,$ZodError:()=>nf,$ZodExactOptional:()=>lh,$ZodFile:()=>ah,$ZodFunction:()=>_h,$ZodGUID:()=>up,$ZodIBAN:()=>jp,$ZodIPv4:()=>Ip,$ZodIPv6:()=>Tp,$ZodISODate:()=>xp,$ZodISODateTime:()=>$p,$ZodISODuration:()=>Rp,$ZodISOTime:()=>Sp,$ZodIntersection:()=>eh,$ZodJWT:()=>Np,$ZodKSUID:()=>kp,$ZodLazy:()=>Ba,$ZodLiteral:()=>ih,$ZodMAC:()=>Pp,$ZodMap:()=>nh,$ZodNaN:()=>hh,$ZodNanoID:()=>bp,$ZodNever:()=>Hp,$ZodNonOptional:()=>mh,$ZodNull:()=>Vp,$ZodNullable:()=>ch,$ZodNumber:()=>gc,$ZodNumberFormat:()=>Lp,$ZodObject:()=>Vk,$ZodObjectJIT:()=>qp,$ZodOptional:()=>_c,$ZodPipe:()=>vc,$ZodPrefault:()=>dh,$ZodPreprocess:()=>gh,$ZodPromise:()=>vh,$ZodReadonly:()=>bh,$ZodRealError:()=>Ut,$ZodRecord:()=>th,$ZodRegistry:()=>Ac,$ZodSet:()=>rh,$ZodString:()=>Gr,$ZodStringFormat:()=>Me,$ZodSuccess:()=>fh,$ZodSymbol:()=>Up,$ZodTemplateLiteral:()=>yh,$ZodTransform:()=>sh,$ZodTuple:()=>yc,$ZodType:()=>pe,$ZodULID:()=>vp,$ZodURL:()=>hp,$ZodUUID:()=>dp,$ZodUndefined:()=>Bp,$ZodUnion:()=>za,$ZodUnknown:()=>Gp,$ZodVoid:()=>Wp,$ZodXID:()=>wp,$ZodXor:()=>Xp,$brand:()=>Qm,$constructor:()=>T,$input:()=>Sh,$output:()=>xh,Doc:()=>Zr,INVALID:()=>Et,JSONSchema:()=>Ax,JSONSchemaGenerator:()=>du,NEVER:()=>Ym,TimePrecision:()=>jh,URL_BAD_FORMAT:()=>fp,URL_UNPARSEABLE:()=>Ca,ZodCompileAsyncError:()=>un,ZodCompileUnsupportedError:()=>Se,_any:()=>Qh,_array:()=>ag,_base64:()=>Yc,_base64url:()=>Qc,_bigint:()=>Hh,_boolean:()=>Zh,_catch:()=>JD,_check:()=>px,_cidrv4:()=>qc,_cidrv6:()=>Xc,_coercedBigint:()=>Wh,_coercedBoolean:()=>Gh,_coercedDate:()=>og,_coercedNumber:()=>Fh,_coercedString:()=>Oh,_creditCard:()=>Ch,_cuid:()=>Vc,_cuid2:()=>Zc,_custom:()=>lg,_date:()=>rg,_decode:()=>Vl,_decodeAsync:()=>Gl,_default:()=>GD,_discriminatedUnion:()=>MD,_e164:()=>eu,_email:()=>Dc,_emoji:()=>Uc,_encode:()=>Bl,_encodeAsync:()=>Zl,_endsWith:()=>Qo,_enum:()=>LD,_file:()=>sg,_float32:()=>zh,_float64:()=>Uh,_gt:()=>Sn,_gte:()=>Ht,_guid:()=>jc,_iban:()=>Dh,_includes:()=>Xo,_int:()=>Lh,_int32:()=>Bh,_int64:()=>Jh,_intersection:()=>CD,_ipv4:()=>Jc,_ipv6:()=>Kc,_isoDate:()=>qa,_isoDateTime:()=>Ka,_isoDuration:()=>Ya,_isoTime:()=>Xa,_jwt:()=>tu,_ksuid:()=>Wc,_lazy:()=>YD,_length:()=>Yr,_literal:()=>UD,_lowercase:()=>Ko,_lt:()=>xn,_lte:()=>Gt,_mac:()=>Mh,_map:()=>ND,_max:()=>Gt,_maxLength:()=>Xr,_maxSize:()=>fr,_mime:()=>ti,_min:()=>Ht,_minLength:()=>Gn,_minSize:()=>Rn,_multipleOf:()=>mr,_nan:()=>ig,_nanoid:()=>Bc,_nativeEnum:()=>zD,_negative:()=>ru,_never:()=>tg,_nonnegative:()=>iu,_nonoptional:()=>HD,_nonpositive:()=>ou,_normalize:()=>ni,_null:()=>Yh,_nullable:()=>ZD,_number:()=>Nh,_optional:()=>VD,_overwrite:()=>dn,_parse:()=>Lo,_parseAsync:()=>zo,_pipe:()=>KD,_positive:()=>nu,_promise:()=>QD,_properties:()=>ei,_property:()=>au,_readonly:()=>qD,_record:()=>jD,_refine:()=>cg,_regex:()=>Jo,_safeDecode:()=>Wl,_safeDecodeAsync:()=>Kl,_safeEncode:()=>Hl,_safeEncodeAsync:()=>Jl,_safeParse:()=>Uo,_safeParseAsync:()=>Bo,_set:()=>FD,_size:()=>qr,_slugify:()=>ai,_startsWith:()=>Yo,_string:()=>Eh,_stringFormat:()=>Qr,_stringbool:()=>fg,_success:()=>WD,_superRefine:()=>ug,_symbol:()=>qh,_templateLiteral:()=>XD,_toLowerCase:()=>oi,_toUpperCase:()=>ii,_transform:()=>BD,_trim:()=>ri,_tuple:()=>DD,_uint32:()=>Vh,_uint64:()=>Kh,_ulid:()=>Gc,_undefined:()=>Xh,_union:()=>ED,_unknown:()=>eg,_uppercase:()=>qo,_url:()=>Ja,_uuid:()=>Nc,_uuidv4:()=>Fc,_uuidv6:()=>Lc,_uuidv7:()=>zc,_void:()=>ng,_xid:()=>Hc,_xor:()=>OD,base64Charset:()=>dc,base64urlCharset:()=>Fa,canParseURL:()=>pp,clone:()=>Oe,compile:()=>Ph,compileFn:()=>Mc,config:()=>Xe,createStandardJSONSchemaMethod:()=>si,createToJSONSchemaMethod:()=>hg,decode:()=>DM,decodeAsync:()=>NM,describe:()=>dg,encode:()=>CM,encodeAsync:()=>jM,extractDefs:()=>hr,finalize:()=>gr,flattenError:()=>Ra,formatError:()=>Ia,getDiscriminatedOption:()=>Yp,globalConfig:()=>dt,globalRegistry:()=>bt,handleUnrepresentable:()=>ot,initializeContext:()=>pr,isBackEdge:()=>Rc,isRecursiveSchema:()=>Sc,isValidBase64:()=>Na,isValidBase64URL:()=>mc,isValidCIDRv6:()=>uc,isValidCreditCard:()=>fc,isValidIBAN:()=>pc,isValidIPv6:()=>ja,isValidJWT:()=>hc,locales:()=>Wa,memoizer:()=>Ga,mergeValues:()=>Zo,meta:()=>mg,parse:()=>zl,parseAsync:()=>Ul,parseURLObject:()=>zk,prettifyError:()=>of,process:()=>Ce,processSchema:()=>Ce,regexes:()=>tn,registry:()=>Ec,safeDecode:()=>LM,safeDecodeAsync:()=>UM,safeEncode:()=>FM,safeEncodeAsync:()=>zM,safeParse:()=>PM,safeParseAsync:()=>AM,standardProps:()=>ac,stripTabAndNewline:()=>Da,toDotPath:()=>_k,toJSONSchema:()=>uu,toZod:()=>ba,treeifyError:()=>rf,urlHostnameOk:()=>lc,urlProtocolOk:()=>cc,util:()=>N,validate:()=>Ta,validateAsync:()=>Pa,validateURL:()=>sc,version:()=>lp,withParser:()=>Oc});var N={};Dn(N,{BIGINT_FORMAT_RANGES:()=>ka,CONSTANT_CATCH:()=>Fl,Class:()=>Bm,NUMBER_FORMAT_RANGES:()=>wa,aborted:()=>At,allowsEval:()=>Gm,assert:()=>KO,assertEqual:()=>GO,assertIs:()=>WO,assertNever:()=>JO,assertNotEqual:()=>HO,assignProp:()=>gt,attachSchema:()=>Nl,base64ToUint8Array:()=>fk,base64urlToUint8Array:()=>pM,cached:()=>jo,captureStackTrace:()=>Dl,cleanEnum:()=>fM,cleanRegex:()=>Vn,clone:()=>Oe,cloneDef:()=>YO,codePointLength:()=>Br,constantCatch:()=>qm,createTransparentProxy:()=>oM,defineLazy:()=>Vm,defineLazyInternal:()=>ke,derived:()=>yM,esc:()=>Pt,escapeRegex:()=>en,explicitlyAborted:()=>Jm,extend:()=>sM,finalizeIssue:()=>Lt,floatSafeRemainder:()=>ya,getElementAtPath:()=>QO,getEnumValues:()=>Co,getLengthableOrigin:()=>xa,getParsedType:()=>rM,getSizableOrigin:()=>$a,hexToUint8Array:()=>gM,hide:()=>Sa,installLazyProp:()=>kM,isObject:()=>Ur,isPlainObject:()=>Qt,issue:()=>Fo,joinValues:()=>A,jsonStringifyReplacer:()=>Do,members:()=>Km,merge:()=>cM,mergeDefs:()=>cn,normalizeParams:()=>J,nullish:()=>Cl,numKeys:()=>nM,objectClone:()=>qO,omit:()=>aM,optionalKeys:()=>Wm,own:()=>ur,parsedType:()=>U,partial:()=>uM,pick:()=>iM,prefixIssues:()=>Ft,primitiveTypes:()=>Hm,promiseAllObject:()=>eM,propertyKeyTypes:()=>va,randomString:()=>tM,rawShape:()=>No,required:()=>dM,safeExtend:()=>lM,shallowClone:()=>_a,slugify:()=>Zm,stringifyPrimitive:()=>F,toZod:()=>ba,uint8ArrayToBase64:()=>pk,uint8ArrayToBase64url:()=>hM,uint8ArrayToHex:()=>bM,unwrapMessage:()=>Mo});function GO(e){return e}function HO(e){return e}function ba(){return e=>e}function WO(e){}function JO(e){throw new Error("Unexpected value in exhaustive check")}function KO(e){}function Co(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function A(e,t="|"){return e.map(r=>F(r)).join(t)}function Do(e,t){return typeof t=="bigint"?t.toString():t}var Um=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function jo(e){return new Um(e)}function Cl(e){return e==null}function Vn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ya(e,t){let r=e/t,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var ck=Symbol("evaluating");function Vm(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==ck)return o===void 0&&(o=ck,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function qO(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function gt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function No(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Bn(e){return No(e._zod.def)??e._zod.def.shape}function uk(e,t,r){Object.defineProperty(e,t,{get(){let o=r();return gt(this,t,o),o},enumerable:!0,configurable:!0})}function dk(e,t,r){t in e?gt(e,t,r):e[t]=r}function zr(e,t,r,o){let n=Bn(t);for(let i of r){let a=Object.getOwnPropertyDescriptor(n,i);a.enumerable&&(a.get?uk(e,i,()=>{let s=t._zod.def.shape[i];return o?o(s,i):s}):dk(e,i,o?o(a.value,i):a.value))}}function XO(e,t){for(let r of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,r);o.enumerable&&(o.get?uk(e,r,()=>t[r]):dk(e,r,o.value))}}function cn(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function YO(e){return cn(e._zod.def)}function QO(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function eM(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}function tM(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function Pt(e){return JSON.stringify(e)}function Zm(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Dl="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Gm=jo(()=>{if(dt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Qt(e){if(Ur(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Ur(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function _a(e){return Qt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function nM(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var rM=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},va=new Set(["string","number","symbol"]),Hm=new Set(["string","number","bigint","boolean","symbol","undefined"]);function en(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Oe(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function J(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function oM(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function F(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Wm(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var wa={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ka={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function iM(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return zr(i,e,jl(e,t)),Oe(e,cn(r,{shape:i,checks:[]}))}function jl(e,t){let r=Bn(e),o=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw new Error(`Unrecognized key: "${String(n)}"`);t[n]&&o.push(n)}return o}function aM(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(jl(e,t)),a={};return zr(a,e,Reflect.ownKeys(Bn(e)).filter(s=>!i.has(s))),Oe(e,cn(r,{shape:a,checks:[]}))}function sM(e,t){if(!Qt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=Bn(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Oe(e,cn(e._zod.def,{shape:mk(e,t)}))}function mk(e,t){let r={};return zr(r,e,Reflect.ownKeys(Bn(e))),XO(r,t),r}function lM(e,t){if(!Qt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Oe(e,cn(e._zod.def,{shape:mk(e,t)}))}function cM(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};zr(r,e,Reflect.ownKeys(Bn(e))),zr(r,t,Reflect.ownKeys(Bn(t)));let o=cn(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Oe(e,o)}function uM(e,t,r,o="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let s=r?new Set(jl(t,r)):void 0,l={};return zr(l,t,Reflect.ownKeys(Bn(t)),e&&((c,u)=>s&&!s.has(u)?c:new e({type:"optional",innerType:c}))),Oe(t,cn(t._zod.def,{shape:l,checks:[]}))}function dM(e,t,r){let o=r?new Set(jl(t,r)):void 0,n={};return zr(n,t,Reflect.ownKeys(Bn(t)),(i,a)=>o&&!o.has(a)?i:new e({type:"nonoptional",innerType:i})),Oe(t,cn(t._zod.def,{shape:n}))}function At(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Jm(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Ft(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Mo(e){return typeof e=="string"?e:e?.message}function Nl(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function Lt(e,t,r){var o;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(o=e).schema??(o.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:Mo(e.inst?._zod.def?.error?.(e))??Mo(i?.(e))??Mo(t?.error?.(e))??Mo(r.customError?.(e))??Mo(r.localeError?.(e))??"Invalid input",s={};for(let l of Object.keys(e))l==="inst"||l==="schema"||l==="continue"||l==="input"||l==="__proto__"||(s[l]=e[l]);return s.path??(s.path=[]),s.message=a,t?.reportInput&&(s.input=e.input),s}function $a(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var mM=/[\uD800-\uDBFF]/;function Br(e){let t=e.length;if(!mM.test(e))return t;let r=t;for(let o=0;o<t-1;o++)(e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320&&(r--,o++);return r}function xa(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function U(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Fo(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function fM(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function fk(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function pk(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function pM(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return fk(t+r)}function hM(e){return pk(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function gM(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function bM(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Bm=class{constructor(...t){}};function Km(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);o.get?Object.defineProperty(e,r,{...o,enumerable:!1}):_M(e,r,o.value)}}function ur(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function Sa(e,t,r){return ur(e,t,r,!1)}function yM(e,t){for(let r in e){let o=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return ur(this,r,o(this))},set(n){ur(this,r,n)}})}return t}function _M(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:ur(this,t,r.bind(this))},set(o){ur(this,t,o)}})}function vM(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var zm,cr=!1,wM={configurable:!0,get(){cr=!0}};function ke(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&zm!==e._zod){zm=void 0;return}zm=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,wM);let n=cr;cr=!1;try{let i=r(this);return cr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),cr=cr||n,i}catch(i){throw delete this[t],cr=cr||n,i}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function kM(e,t,r,o){let n=vM(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:i})}})}var Fl="~constantCatch";function qm(e){let t=()=>e;return t[Fl]=!0,t}var hk,Ym=Object.freeze({status:"aborted"}),Xm={value:void 0,enumerable:!1},gk="captureStackTrace"in Error?Error:null;function $M(e){let t=gk;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return gk=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function T(e,t,r,o){let n={};function i(f){this.def=f,this.constr=d,this.traits=new Set}i.prototype=n;let a=r,s=a&&new WeakSet;function l(f,m){if(f._zod){if(f._zod.traits.has(e))return}else{Xm.value=new i(m);try{Object.defineProperty(f,"_zod",Xm)}finally{Xm.value=void 0}}if(f._zod.traits.add(e),t(f,m),s){let g=Object.getPrototypeOf(f),_=f._zod.constr.prototype,v=g;for(;v&&v!==_;)v=Object.getPrototypeOf(v);let y=v??g;s.has(y)||(s.add(y),Km(y,a))}let p=d.prototype;for(let g in p)Object.prototype.hasOwnProperty.call(p,g)&&(g in f||(f[g]=p[g].bind(f)))}let c=o?.Parent??Object;class u extends c{}Object.defineProperty(u,"name",{value:e});function d(f){let m=o?.Parent?$M(u):this;l(m,f);let p=m._zod.deferred;if(p){for(let _ of p)_();m._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;return g&&g(m),m}return Object.defineProperty(d,"init",{value:l}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>o?.Parent&&f instanceof o.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Qm=Symbol("zod_brand"),zt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},dr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(hk=globalThis).__zod_globalConfig??(hk.__zod_globalConfig={});var dt=globalThis.__zod_globalConfig;function Xe(e){return e&&Object.assign(dt,e),dt}function xM(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Do,2)),e.message}function SM(e){this._zod.message=e}var RM={get:xM,set:SM,enumerable:!0,configurable:!0},tf={value:void 0,enumerable:!1},bk=new WeakSet([Object.prototype,Error.prototype]),yk=(e,t)=>{e.name="$ZodError",tf.value=t,Object.defineProperty(e,"issues",tf),tf.value=void 0,Object.defineProperty(e,"message",RM);let r=Object.getPrototypeOf(e);bk.has(r)||(bk.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},nf=T("$ZodError",yk),Ut=T("$ZodError",yk,void 0,{Parent:Error});function IM(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function Ra(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?IM(r,n.path[0],()=>[]).push(t(n)):o.push(t(n));return{formErrors:o,fieldErrors:r}}function Ia(e,t=r=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>o({issues:s},[...i,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...i,...a.path]);else{let s=[...i,...a.path];if(s.length===0)r._errors.push(t(a));else{let l=r,c=0;for(;c<s.length;){let u=s[c],d=c===s.length-1;if(u==="_errors"){d&&l._errors.push(t(a)),c++;continue}Object.prototype.hasOwnProperty.call(l,u)||Object.defineProperty(l,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=l[u];d&&f._errors.push(t(a)),l=f,c++}}}};return o(e),r}function rf(e,t=r=>r.message){let r={errors:[]},o=(n,i=[])=>{var a;for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(l=>o({issues:l},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let l=[...i,...s.path];if(l.length===0){r.errors.push(t(s));continue}let c=r,u=0;for(;u<l.length;){let d=l[u],f=u===l.length-1;typeof d=="string"?(c.properties??(c.properties={}),Object.prototype.hasOwnProperty.call(c.properties,d)||Object.defineProperty(c.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),c=c.properties[d]):(c.items??(c.items=[]),(a=c.items)[d]??(a[d]={errors:[]}),c=c.items[d]),f&&c.errors.push(t(s)),u++}}};return o(e),r}function _k(e){let t=[],r=e.map(o=>typeof o=="object"?o.key:o);for(let o of r)typeof o=="number"?t.push(`[${o}]`):typeof o=="symbol"?t.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?t.push(`[${JSON.stringify(o)}]`):(t.length&&t.push("."),t.push(o));return t.join("")}function of(e){let t=[],r=[...e.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)t.push(`\u2716 ${o.message}`),o.path?.length&&t.push(` \u2192 at ${_k(o.path)}`);return t.join(`
|
|
4
|
+
`)}function Ll(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Lo=e=>{let t=(r,o,n,i)=>{let a=n?{...n,async:!1}:{async:!1},s=r._zod.run({value:o,issues:[]},a);if(s instanceof Promise)throw new zt;if(s.issues.length){let l=new(i?.Err??e)(s.issues.map(c=>Lt(c,a,Xe())));throw Dl(l,i?.callee??t),l}return s.value};return t},zl=Lo(Ut),zo=e=>{let t=async(r,o,n,i)=>{let a=n?{...n,async:!0}:{async:!0},s=r._zod.run({value:o,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let l=new(i?.Err??e)(s.issues.map(c=>Lt(c,a,Xe())));throw Dl(l,i?.callee??t),l}return s.value};return t},Ul=zo(Ut),Uo=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new zt;return i.issues.length?vk(e,i.issues,n):{success:!0,data:i.value}},PM=Uo(Ut);function vk(e,t,r){let o;return{success:!1,get error(){return o||(o=new e(t.map(n=>Lt(n,r,Xe()))),t=void 0,r=void 0),o},set error(n){o=n,t=void 0,r=void 0}}}var Bo=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),i.issues.length?vk(e,i.issues,n):{success:!0,data:i.value}},AM=Bo(Ut),EM=Symbol.for("zod.compile.invalid"),OM=Symbol.for("zod.compile.fallback"),Ta=((e,t,r)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==EM)return!0;if(o.definite===!0&&r===void 0)return!1}return MM(e,t,r)});function MM(e,t,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,i;if(n?(o[OM]=!0,i=n({value:t,issues:[]},o)):i=e._zod.run({value:t,issues:[]},o),i instanceof Promise)throw new zt;return i.issues.length===0}var Pa=async(e,t,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},o);return n instanceof Promise&&(n=await n),n.issues.length===0},Bl=e=>{let t=Lo(e),r=(o,n,i,a)=>{let s=i?{...i,direction:"backward"}:{direction:"backward"};return t(o,n,s,Ll(r,a))};return r},CM=Bl(Ut),Vl=e=>{let t=Lo(e),r=(o,n,i,a)=>t(o,n,i,Ll(r,a));return r},DM=Vl(Ut),Zl=e=>{let t=zo(e),r=async(o,n,i,a)=>{let s=i?{...i,direction:"backward"}:{direction:"backward"};return await t(o,n,s,Ll(r,a))};return r},jM=Zl(Ut),Gl=e=>{let t=zo(e),r=async(o,n,i,a)=>await t(o,n,i,Ll(r,a));return r},NM=Gl(Ut),Hl=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Uo(e)(t,r,n)},FM=Hl(Ut),Wl=e=>(t,r,o)=>Uo(e)(t,r,o),LM=Wl(Ut),Jl=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Bo(e)(t,r,n)},zM=Jl(Ut),Kl=e=>async(t,r,o)=>Bo(e)(t,r,o),UM=Kl(Ut);var tn={};Dn(tn,{anyString:()=>Of,base64:()=>$f,base64url:()=>xf,bigint:()=>Cf,boolean:()=>Df,browserEmail:()=>KM,cidrv4:()=>wf,cidrv6:()=>kf,creditCard:()=>ql,cuid:()=>sf,cuid2:()=>lf,currencyCode:()=>Tf,date:()=>Pf,datetime:()=>Ef,domain:()=>Rf,duration:()=>pf,e164:()=>If,email:()=>gf,emoji:()=>bf,extendedDuration:()=>BM,guid:()=>hf,hex:()=>zf,hostname:()=>Sf,html5Email:()=>HM,httpProtocol:()=>Aa,iban:()=>Xl,idnEmail:()=>JM,integer:()=>Ea,ipv4:()=>yf,ipv6:()=>_f,ksuid:()=>df,lowercase:()=>Ff,mac:()=>vf,md5_base64:()=>QM,md5_base64url:()=>eC,md5_hex:()=>YM,nanoid:()=>mf,nanoidOfLength:()=>ff,null:()=>jf,number:()=>Zn,rfc5322Email:()=>WM,sha1_base64:()=>nC,sha1_base64url:()=>rC,sha1_hex:()=>tC,sha256_base64:()=>iC,sha256_base64url:()=>aC,sha256_hex:()=>oC,sha384_base64:()=>lC,sha384_base64url:()=>cC,sha384_hex:()=>sC,sha512_base64:()=>dC,sha512_base64url:()=>mC,sha512_hex:()=>uC,string:()=>Mf,time:()=>Af,ulid:()=>cf,undefined:()=>Nf,unicodeEmail:()=>wk,uppercase:()=>Lf,uuid:()=>Vr,uuid4:()=>VM,uuid6:()=>ZM,uuid7:()=>GM,xid:()=>uf});var sf=/^[cC][0-9a-z]{6,}$/,lf=/^[0-9a-z]+$/,cf=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,uf=/^[0-9a-vA-V]{20}$/,df=/^[A-Za-z0-9]{27}$/,mf=/^[a-zA-Z0-9_-]{21}$/;function ff(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var pf=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,BM=/^[-+]?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)?)??$/,hf=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Vr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,VM=Vr(4),ZM=Vr(6),GM=Vr(7),gf=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,HM=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,WM=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,wk=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,JM=wk,KM=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,qM="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function bf(){return new RegExp(qM,"u")}var yf=/^(?:(?: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])$/,_f=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,vf=e=>{let t=en(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},wf=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,kf=/^(([0-9a-fA-F]{1,4}:){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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$f=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,xf=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Sf=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Rf=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Aa=/^https?$/,If=/^\+[1-9]\d{6,14}$/,ql=/^\d(?:[ -]?\d){11,18}$/,Tf=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Xl=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,kk="(?:(?:\\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])))";function XM(e){return new RegExp(`^${e}$`)}var Pf=XM(kk);function af(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Af(e){return new RegExp(`^${af(e)}$`)}function Ef(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${af({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${af({precision:e.precision})}`:r;return new RegExp(`^${kk}T(?:${o})$`)}var Of=/^[\s\S]{0,}$/,Mf=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Cf=/^-?\d+n?$/,Ea=/^-?\d+$/,Zn=/^-?\d+(?:\.\d+)?$/,Df=/^(?:true|false)$/i,jf=/^null$/i;var Nf=/^undefined$/i;var Ff=/^[^A-Z]*$/,Lf=/^[^a-z]*$/,zf=/^[0-9a-fA-F]*$/;function Oa(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Ma(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var YM=/^[0-9a-fA-F]{32}$/,QM=Oa(22,"=="),eC=Ma(22),tC=/^[0-9a-fA-F]{40}$/,nC=Oa(27,"="),rC=Ma(27),oC=/^[0-9a-fA-F]{64}$/,iC=Oa(43,"="),aC=Ma(43),sC=/^[0-9a-fA-F]{96}$/,lC=Oa(64,""),cC=Ma(64),uC=/^[0-9a-fA-F]{128}$/,dC=Oa(86,"=="),mC=Ma(86);var Le=T("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Uf=e=>{let t=e.value;return!Cl(t)&&t.size!==void 0},Bf=e=>{let t=e.value;return!Cl(t)&&t.length!==void 0},Yl={number:"number",bigint:"bigint",object:"date"},ec=T("$ZodCheckLessThan",(e,t)=>{Le.init(e,t);let r=Yl[typeof t.value];e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:Yl[typeof o.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tc=T("$ZodCheckGreaterThan",(e,t)=>{Le.init(e,t);let r=Yl[typeof t.value];e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:Yl[typeof o.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Vf=T("$ZodCheckMultipleOf",(e,t)=>{Le.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):ya(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Zf=T("$ZodCheckNumberFormat",(e,t)=>{Le.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=wa[t.format];e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}s<n&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Gf=T("$ZodCheckBigIntFormat",(e,t)=>{Le.init(e,t);let[r,o]=ka[t.format];e._zod.check=n=>{let i=n.value;i<r&&n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>o&&n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Hf=T("$ZodCheckMaxSize",(e,t)=>{var r;Le.init(e,t),(r=e._zod.def).when??(r.when=Uf),e._zod.check=o=>{let n=o.value;n.size<=t.maximum||o.issues.push({origin:$a(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Wf=T("$ZodCheckMinSize",(e,t)=>{var r;Le.init(e,t),(r=e._zod.def).when??(r.when=Uf),e._zod.check=o=>{let n=o.value;n.size>=t.minimum||o.issues.push({origin:$a(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Jf=T("$ZodCheckSizeEquals",(e,t)=>{var r;Le.init(e,t),(r=e._zod.def).when??(r.when=Uf),e._zod.check=o=>{let n=o.value,i=n.size;if(i===t.size)return;let a=i>t.size;o.issues.push({origin:$a(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Kf=T("$ZodCheckMaxLength",(e,t)=>{var r;Le.init(e,t),(r=e._zod.def).when??(r.when=Bf),e._zod.check=o=>{let n=o.value,i=n.length;if((typeof n=="string"&&i>t.maximum?Br(n):i)<=t.maximum)return;let s=xa(n);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),qf=T("$ZodCheckMinLength",(e,t)=>{var r;Le.init(e,t),(r=e._zod.def).when??(r.when=Bf),e._zod.check=o=>{let n=o.value,i=n.length;if((typeof n=="string"&&i>=t.minimum&&i<t.minimum*2?Br(n):i)>=t.minimum)return;let s=xa(n);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Xf=T("$ZodCheckLengthEquals",(e,t)=>{var r;Le.init(e,t),(r=e._zod.def).when??(r.when=Bf),e._zod.check=o=>{let n=o.value,i=n.length,a=typeof n=="string"&&i>=t.length&&i<=t.length*2?Br(n):i;if(a===t.length)return;let s=xa(n),l=a>t.length;o.issues.push({origin:s,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Vo=T("$ZodCheckStringFormat",(e,t)=>{var r,o;Le.init(e,t),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Yf=T("$ZodCheckRegex",(e,t)=>{Vo.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Qf=T("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ff),Vo.init(e,t)}),ep=T("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Lf),Vo.init(e,t)}),tp=T("$ZodCheckIncludes",(e,t)=>{Le.init(e,t);let r=en(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),np=T("$ZodCheckStartsWith",(e,t)=>{Le.init(e,t);let r=new RegExp(`^${en(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),rp=T("$ZodCheckEndsWith",(e,t)=>{Le.init(e,t);let r=new RegExp(`.*${en(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function Ql(e,t,r){e.issues.length&&t.issues.push(...Ft(r,e.issues))}var op=T("$ZodCheckProperty",(e,t)=>{Le.init(e,t),e._zod.check=r=>{let o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then(n=>Ql(n,r,t.property));Ql(o,r,t.property)}}),ip=T("$ZodCheckProperties",(e,t)=>{Le.init(e,t),Sa(e,Symbol.iterator,function*(){yield e});let r;e._zod.check=o=>{if(o.value==null){o.issues.push({expected:"object",code:"invalid_type",input:o.value,inst:e});return}r??(r=Reflect.ownKeys(t.shape).map(a=>[a,t.shape[a]]));let n=o.value,i;for(let[a,s]of r){let l=s._zod.run({value:n[a],issues:[]},{});l instanceof Promise?(i??(i=[]),i.push(l.then(c=>Ql(c,o,a)))):Ql(l,o,a)}if(i)return Promise.all(i).then(()=>{})}}),ap=T("$ZodCheckMimeType",(e,t)=>{Le.init(e,t);let r=new Set(t.mime);e._zod.check=o=>{r.has(o.value.type)||o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),sp=T("$ZodCheckOverwrite",(e,t)=>{Le.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Zr=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
|
|
5
|
+
`).filter(a=>a),n=Math.min(...o.map(a=>a.length-a.trimStart().length)),i=o.map(a=>a.slice(n)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
6
|
+
${r.join(`
|
|
7
|
+
`)}
|
|
8
|
+
};`)(...Object.values(this.closed))}};var lp={major:4,minor:6,patch:5};var pe=T("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=lp;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let i of n)for(let a of i._zod.onattach)a(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(s,l,c)=>{if(s.memo)return s;let u=At(s),d;for(let f of l){if(f._zod.def.when){if(Jm(s)||!f._zod.def.when(s))continue}else if(u)continue;let m=s.issues.length,p=f._zod.check(s);if(p instanceof Promise&&c?.async===!1)throw new zt;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,s.issues.length!==m&&(Nl(s.issues,m,e),u||(u=At(s,m)))});else{if(s.issues.length===m)continue;Nl(s.issues,m,e),u||(u=At(s,m))}}return d?d.then(()=>s):s},a=(s,l,c)=>{if(At(s))return s.aborted=!0,s;let u=i(l,n,c);if(u instanceof Promise){if(c.async===!1)throw new zt;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(s,l)=>{if(l.skipChecks)return e._zod.parse(s,l);if(l.direction==="backward"){let u=e._zod.parse({value:s.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(d=>a(d,s,l)):a(u,s,l)}let c=e._zod.parse(s,l);if(c instanceof Promise){if(l.async===!1)throw new zt;return c.then(u=>i(u,n,l))}return i(c,n,l)}}},{get"~standard"(){return Sa(this,"~standard",ac(this))},set"~standard"(e){ur(this,"~standard",e)}}),Lk=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Lt(r,t,Xe()))}:{value:e.value};async function fC(e,t){let r={async:!0};return Lk(await e._zod.run({value:t,issues:[]},r),r)}function ac(e){return{validate:t=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return Lk(o,r)}catch{}return fC(e,t)},vendor:"zod",version:1}}var Gr=T("$ZodString",(e,t)=>{pe.init(e,t),e._zod.pattern=t.pattern??Of,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Me=T("$ZodStringFormat",(e,t)=>{Vo.init(e,t),Gr.init(e,t)}),up=T("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=hf),Me.init(e,t)}),dp=T("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Vr(o))}else t.pattern??(t.pattern=Vr());Me.init(e,t)}),mp=T("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=gf),Me.init(e,t)}),fp=1,Ca=2;function pp(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function sc(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?pp(e)||Ca:zk(e,t)}function zk(e,t){if(!t.normalize&&t.protocol?.source===Aa.source&&!/^https?:\/\//i.test(e))return fp;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??Ca}return new URL(e)}catch{return Ca}}var pC=/[\t\n\r]/g;function Da(e){return e.replace(pC,"")}function lc(e,t){return t.lastIndex=0,t.test(e.hostname)}function cc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var hp=T("$ZodURL",(e,t)=>{Me.init(e,t),e._zod.check=r=>{try{let o=r.value.trim(),n=sc(o,t);if(n===fp){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===Ca){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=Da(o);return}t.hostname&&!lc(n,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!cc(n,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?n.href:Da(o);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),gp=T("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=bf()),Me.init(e,t)}),bp=T("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?mf:ff(t.length)),Me.init(e,t)}),yp=T("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=sf),Me.init(e,t)}),_p=T("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=lf),Me.init(e,t)}),vp=T("$ZodULID",(e,t)=>{t.pattern??(t.pattern=cf),Me.init(e,t)}),wp=T("$ZodXID",(e,t)=>{t.pattern??(t.pattern=uf),Me.init(e,t)}),kp=T("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=df),Me.init(e,t)}),$p=T("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ef(t)),Me.init(e,t)}),xp=T("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Pf),Me.init(e,t)}),Sp=T("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Af(t)),Me.init(e,t)}),Rp=T("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=pf),Me.init(e,t)}),Ip=T("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=yf),Me.init(e,t)}),hC=/^[0-9a-fA-F:.]+$/;function ja(e){return hC.test(e)?pp(`http://[${e}]`):!1}var Tp=T("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=_f),Me.init(e,t),e._zod.check=r=>{ja(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),Pp=T("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=vf(t.delimiter)),Me.init(e,t)}),Ap=T("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=wf),Me.init(e,t)});function uc(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);return`${n}`!==o||n<0||n>128?!1:ja(r)}var Ep=T("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=kf),Me.init(e,t),e._zod.check=r=>{uc(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Na(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var dc=/^[0-9a-zA-Z+/]*={0,2}$/,Op=T("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=dc),Me.init(e,t),e._zod.check=r=>{Na(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Fa=/^[A-Za-z0-9_-]*$/;function mc(e){if(!Fa.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Na(r)}var Mp=T("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fa),Me.init(e,t),e._zod.check=r=>{mc(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Cp=T("$ZodE164",(e,t)=>{t.pattern??(t.pattern=If),Me.init(e,t)}),gC=/[- ]/g;function bC(e){let t=e.length,r=1,o=0;for(;t;){let n=e.charCodeAt(--t)-48;r^=1,o+=r?[0,2,4,6,8,1,3,5,7,9][n]:n}return o%10===0}function fc(e){return ql.test(e)?bC(e.replace(gC,"")):!1}var Dp=T("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=ql),Me.init(e,t),e._zod.check=r=>{fc(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});function yC(e){let t=0,r=e.length;for(let o=4;o<r;o++){let n=e.charCodeAt(o);t=(n>=65?t*100+(n-55):t*10+(n-48))%97}for(let o=0;o<4;o++){let n=e.charCodeAt(o);t=(n>=65?t*100+(n-55):t*10+(n-48))%97}return t===1}function pc(e){return Xl.test(e)?yC(e):!1}var jp=T("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Xl),Me.init(e,t),e._zod.check=r=>{pc(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});function hc(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Np=T("$ZodJWT",(e,t)=>{Me.init(e,t),e._zod.check=r=>{hc(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Fp=T("$ZodCustomStringFormat",(e,t)=>{Me.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),gc=T("$ZodNumber",(e,t)=>{pe.init(e,t),e._zod.pattern=Zn,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),Lp=T("$ZodNumberFormat",(e,t)=>{Zf.init(e,t),gc.init(e,t)}),La=T("$ZodBoolean",(e,t)=>{pe.init(e,t),e._zod.pattern=Df,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),bc=T("$ZodBigInt",(e,t)=>{pe.init(e,t),e._zod.pattern=Cf,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),zp=T("$ZodBigIntFormat",(e,t)=>{Gf.init(e,t),bc.init(e,t)}),Up=T("$ZodSymbol",(e,t)=>{pe.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),Bp=T("$ZodUndefined",(e,t)=>{pe.init(e,t),e._zod.pattern=Nf,e._zod.values=new Set([void 0]),e._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),Vp=T("$ZodNull",(e,t)=>{pe.init(e,t),e._zod.pattern=jf,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Zp=T("$ZodAny",(e,t)=>{pe.init(e,t),e._zod.parse=r=>r}),Gp=T("$ZodUnknown",(e,t)=>{pe.init(e,t),e._zod.parse=r=>r}),Hp=T("$ZodNever",(e,t)=>{pe.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Wp=T("$ZodVoid",(e,t)=>{pe.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),Jp=T("$ZodDate",(e,t)=>{pe.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,i=n instanceof Date;return i&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});function xk(e,t,r){e.issues.length&&t.issues.push(...Ft(r,e.issues)),t.value[r]=e.value}var Kp=T("$ZodArray",(e,t)=>{pe.init(e,t);let r=dt.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),o;o.value=r?r.alloc(e,o,Array(i.length),n):Array(i.length);let a=[],s=n?.abortEarly;for(let l=0;l<i.length;l++){let c=i[l],u=t.element._zod.run({value:c,issues:[]},n);if(u instanceof Promise)a.push(u.then(d=>xk(d,o,l)));else if(xk(u,o,l),s&&u.issues.length!==0&&At(u))break}return a.length?Promise.all(a).then(()=>o):o}});function ic(e,t,r,o,n,i){let a=r in o,s=i==="optional";if(!(!a&&s&&n==="optional")){if(e.issues.length){if(n!==void 0&&s&&!a)return;t.issues.push(...Ft(r,e.issues))}if(!a&&n===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(a||n==="defaulted"&&!s)&&(t.value[r]=void 0):t.value[r]=e.value}}var _C=[];function Uk(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:_C,n=o.length?[...t,...o]:t;for(let a of n)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(a)}": expected a Zod schema`);let i=Wm(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Bk(e,t,r,o,n,i,a){let s=[],l=n.keySet,c=n.catchall._zod,u=c.def.type,d=c.optin,f=c.optout,m=0;for(let p in t){if(a&&r.issues.length!==m){if(At(r,m))break;m=r.issues.length}if(l.has(p))continue;if(p==="__proto__"){u==="never"&&s.push(p);continue}if(u==="never"){s.push(p);continue}let g=c.run({value:t[p],issues:[]},o);g instanceof Promise?e.push(g.then(_=>ic(_,r,p,t,d,f))):ic(g,r,p,t,d,f)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var Vk=T("$ZodObject",(e,t)=>{pe.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let c=()=>{let u={...o};return Object.defineProperty(t,"shape",{value:u}),c.raw=u,u};c.raw=o,Object.defineProperty(t,"shape",{get:c})}let n=jo(()=>Uk(t));ke(e,"propValues",c=>{let u=c.def.shape,d={};for(let f in u){let m=u[f]._zod;if(m.values){Object.prototype.hasOwnProperty.call(d,f)||gt(d,f,new Set);for(let p of m.values)d[f].add(p);m.optin!==void 0&&d[f].add(void 0)}}return d});let i=Ur,a=t.catchall,s,l=dt.memoizer;l?.attach(e),e._zod.parse=(c,u)=>{s??(s=n.value);let d=c.value;if(!i(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value=l?l.alloc(e,c,{},u):{};let f=[],m=s.shape,p=u?.abortEarly,g=c.issues.length;for(let _ of s.allKeys){if(p&&c.issues.length!==g){if(At(c,g))break;g=c.issues.length}if(_==="__proto__")continue;let v=m[_],y=v._zod.optin,b=v._zod.optout,w=v._zod.run({value:d[_],issues:[]},u);w instanceof Promise?f.push(w.then(k=>ic(k,c,_,d,y,b))):ic(w,c,_,d,y,b)}return a?Bk(f,d,c,u,n.value,e,p===!0):f.length?Promise.all(f).then(()=>c):c}}),qp=T("$ZodObjectJIT",(e,t)=>{Vk.init(e,t);let r=e._zod.parse,o=jo(()=>Uk(t)),n=dt.memoizer,i=m=>{let p=o.value,g=p.symbolKeys,_=new Zr(["payload","ctx"],{shape:m,inst:e,memo:n,syms:g}),v=k=>`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`,y=(k,I)=>`
|
|
9
|
+
let ${k}_ab = false;
|
|
10
|
+
for (let i = 0; i < ${k}.issues.length; i++) {
|
|
11
|
+
const iss = ${k}.issues[i];
|
|
12
|
+
iss.path = iss.path ? [${I}, ...iss.path] : [${I}];
|
|
13
|
+
payload.issues.push(iss);
|
|
14
|
+
if (iss.continue !== true) ${k}_ab = true;
|
|
15
|
+
}
|
|
16
|
+
if (${k}_ab && ctx && ctx.abortEarly) {
|
|
17
|
+
payload.value = newResult;
|
|
18
|
+
return payload;
|
|
19
|
+
}`;_.write("const input = payload.value;");let b=Object.create(null),w=0;for(let k of p.allKeys)b[k]=`key_${w++}`;_.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let k of p.allKeys){if(k==="__proto__")continue;let I=b[k],x=typeof k=="symbol"?`syms[${g.indexOf(k)}]`:Pt(k),S=`${x} in input`,R=m[k],$=R?._zod?.optin,C=$!==void 0,E=R?._zod?.optout==="optional";if(_.write(`const ${I} = ${v(x)};`),C&&E){let L=$==="optional"?`${I}_present`:`${I}.value !== undefined || ${I}_present`;_.write(`
|
|
20
|
+
const ${I}_present = ${S};
|
|
21
|
+
if (!${I}.issues.length || ${I}_present) {
|
|
22
|
+
if (${I}.issues.length) {${y(I,x)}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (${L}) {
|
|
26
|
+
newResult[${x}] = ${I}.value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
`)}else C?(_.write(`
|
|
31
|
+
if (${I}.issues.length) {${y(I,x)}
|
|
32
|
+
}
|
|
33
|
+
`),$==="defaulted"?_.write(`newResult[${x}] = ${I}.value;`):_.write(`
|
|
34
|
+
if (${I}.value !== undefined || ${S}) {
|
|
35
|
+
newResult[${x}] = ${I}.value;
|
|
36
|
+
}
|
|
37
|
+
`)):_.write(`
|
|
38
|
+
const ${I}_present = ${S};
|
|
39
|
+
if (${I}.issues.length) {${y(I,x)}
|
|
40
|
+
}
|
|
41
|
+
if (!${I}_present && !${I}.issues.length) {
|
|
42
|
+
payload.issues.push({
|
|
43
|
+
code: "invalid_type",
|
|
44
|
+
expected: "nonoptional",
|
|
45
|
+
input: undefined,
|
|
46
|
+
path: [${x}]
|
|
47
|
+
});
|
|
48
|
+
if (ctx && ctx.abortEarly) {
|
|
49
|
+
payload.value = newResult;
|
|
50
|
+
return payload;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (${I}_present) {
|
|
55
|
+
newResult[${x}] = ${I}.value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
`)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()},a,s=Ur,l=!dt.jitless,u=l&&Gm.value,d=t.catchall,f;e._zod.parse=(m,p)=>{f??(f=o.value);let g=m.value;return s(g)?l&&u&&p?.async===!1&&p.jitless!==!0?(a||(a=i(t.shape)),m=a(m,p),d?Bk([],g,m,p,f,e,p?.abortEarly===!0):m):r(m,p):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function Sk(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter(i=>!At(i));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>Lt(a,o,Xe())))}),t)}var za=T("$ZodUnion",(e,t)=>{pe.init(e,t),ke(e,"optin",o=>o.def.options.some(n=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some(n=>n._zod.optin!==void 0)?"optional":void 0),ke(e,"optout",o=>o.def.options.some(n=>n._zod.optout==="optional")?"optional":void 0),ke(e,"values",o=>{if(o.def.options.every(n=>n._zod.values))return new Set(o.def.options.flatMap(n=>Array.from(n._zod.values)))}),ke(e,"pattern",o=>{if(o.def.options.every(n=>n._zod.pattern)){let n=o.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>Vn(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,a=[];for(let s of t.options){let l=s._zod.run({value:o.value,issues:[]},n);if(l instanceof Promise)a.push(l),i=!0;else{if(l.issues.length===0)return l;a.push(l)}}return i?Promise.all(a).then(s=>Sk(s,o,e,n)):Sk(a,o,e,n)}});function Rk(e,t,r,o){let n=[];for(let i=0;i<e.length;i++)e[i].issues.length===0&&n.push(i);return n.length===1?(t.value=e[n[0]].value,t):(n.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>Lt(a,o,Xe())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:n}),t)}var Xp=T("$ZodXor",(e,t)=>{za.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,a=[];for(let s of t.options){let l=s._zod.run({value:o.value,issues:[]},n);l instanceof Promise?(a.push(l),i=!0):a.push(l)}return i?Promise.all(a).then(s=>Rk(s,o,e,n)):Rk(a,o,e,n)}});function Yp(e,t){let r=e._zod,o=r.bag.optionsMap;o||(o=Zk(r.def),r.bag.optionsMap=o);let n=o.get(t);if(n===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return n}function Zk(e){let t=new Map;for(let r of e.options){let o=r._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let n of o)if(t.has(n)){if(n!==void 0)throw new Error(`Duplicate discriminator value "${String(n)}"`);t.set(n,null)}else t.set(n,r)}return t}var Qp=T("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,za.init(e,t);let r=e._zod.parse;ke(e,"propValues",n=>{let i={},a=0;for(let s of n.def.options){let l=s._zod.propValues;if(!l||Object.keys(l).length===0)throw new Error(`Invalid discriminated union option at index "${n.def.options.indexOf(s)}"`);l[n.def.discriminator]?.has(void 0)&&a++;for(let[c,u]of Object.entries(l)){Object.prototype.hasOwnProperty.call(i,c)||gt(i,c,new Set);for(let d of u)i[c].add(d)}}return!n.def.unionFallback&&a>1&&i[n.def.discriminator]?.delete(void 0),i}),t.options.forEach((n,i)=>{let a=No(n._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let o=jo(()=>Zk(t));e._zod.parse=(n,i)=>{let a=n.value;if(!Ur(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;let s=a?.[t.discriminator],l=o.value.get(s);return l&&(s!==void 0||i.direction!=="backward")?l._zod.run(n,i):t.unionFallback||i.direction==="backward"?r(n,i):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()).filter(c=>o.value.get(c)!==null),input:a,path:[t.discriminator],inst:e}),n)}}),eh=T("$ZodIntersection",(e,t)=>{pe.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),a=t.right._zod.run({value:n,issues:[]},o);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([l,c])=>Ik(r,l,c)):Ik(r,i,a)}});function Zo(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Qt(e)&&Qt(t)){let r=Object.keys(t),o=Object.keys(e).filter(i=>r.indexOf(i)!==-1),n={...e,...t};Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__;for(let i of o){if(i==="__proto__")continue;let a=Zo(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n[i]=a.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],a=Zo(n,i);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Ik(e,t,r){let o=new Map,n,i=new Map,a=(c,u)=>{let d;if(c.code==="unrecognized_keys"&&!c.path?.length)n??(n=c),d=c.keys;else if(c.code==="invalid_key"&&c.origin==="record"&&c.path?.length===1){let f=String(c.path[0]);i.has(f)||i.set(f,c),d=[f]}else return!1;for(let f of d)o.has(f)||o.set(f,{}),o.get(f)[u]=!0;return!0};for(let c of t.issues)a(c,"l")||e.issues.push(c);for(let c of r.issues)a(c,"r")||e.issues.push(c);let s=[...o].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(s.length){let c=n?s.filter(u=>n.keys.includes(u)):[];c.length&&e.issues.push({...n,keys:c});for(let u of s)!c.includes(u)&&i.has(u)&&e.issues.push(i.get(u))}let l=Zo(t.value,r.value);if(!l.valid){if(At(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(l.mergeErrorPath)}`)}return e.value=l.data,e}var yc=T("$ZodTuple",(e,t)=>{pe.init(e,t);let r=t.items,o=dt.memoizer;o?.attach(e),e._zod.parse=(n,i)=>{let a=n.value;if(!Array.isArray(a))return n.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=o?o.alloc(e,n,[],i):[];let s=[],l=Tk(r,"optin"),c=Tk(r,"optout");if(!t.rest){if(a.length<l)return n.issues.push({code:"too_small",minimum:l,inclusive:!0,input:a,inst:e,origin:"array"}),n;a.length>r.length&&n.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:a,inst:e,origin:"array"})}let u=new Array(r.length),d=t.rest?i?.abortEarly:void 0,f=!1;for(let m=0;m<r.length;m++){let p=r[m]._zod.run({value:a[m],issues:[]},i);p instanceof Promise?s.push(p.then(g=>{u[m]=g})):(u[m]=p,d&&!f&&p.issues.length&&(f=At(p)))}if(t.rest&&!f){let m=r.length-1,p=a.slice(r.length),g=n.issues.length;for(let _ of p){if(d&&n.issues.length!==g){if(At(n,g))break;g=n.issues.length}m++;let v=t.rest._zod.run({value:_,issues:[]},i);v instanceof Promise?s.push(v.then(y=>Pk(y,n,m))):Pk(v,n,m)}}return s.length?Promise.all(s).then(()=>Ak(u,n,r,a,c)):Ak(u,n,r,a,c)}});function Tk(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function Pk(e,t,r){e.issues.length&&t.issues.push(...Ft(r,e.issues)),t.value[r]=e.value}function Ak(e,t,r,o,n){for(let i=0;i<r.length;i++){let a=e[i],s=i<o.length;if(!s&&i>=n&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(a.issues.length){if(!s&&i>=n){t.value.length=i;break}t.issues.push(...Ft(i,a.issues))}t.value[i]=a.value}for(let i=t.value.length-1;i>=o.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var th=T("$ZodRecord",(e,t)=>{pe.init(e,t);let r=dt.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let i=o.value;if(!Qt(i))return o.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),o;let a=[],s=t.keyType._zod.values;if(s&&!t.partial){o.value=r?r.alloc(e,o,{},n):{};let l=new Set;for(let u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){if(l.add(typeof u=="number"?u.toString():u),u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(p=>Lt(p,n,Xe())),input:u,path:[u],inst:e});continue}let f=d.value;if(f==="__proto__")continue;let m=t.valueType._zod.run({value:i[u],issues:[]},n);m instanceof Promise?a.push(m.then(p=>{p.issues.length&&o.issues.push(...Ft(u,p.issues)),o.value[f]=p.value})):(m.issues.length&&o.issues.push(...Ft(u,m.issues)),o.value[f]=m.value)}let c;for(let u in i)if(!l.has(u))if(t.mode==="loose"){if(u==="__proto__")continue;o.value[u]=i[u]}else c=c??[],c.push(u);c&&c.length>0&&o.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}else{o.value=r?r.alloc(e,o,{},n):{};let l;for(let c of Reflect.ownKeys(i)){if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,c))continue;let u=t.keyType._zod.run({value:c,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&Zn.test(c)&&u.issues.length){let p=t.keyType._zod.run({value:Number(c),issues:[]},n);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(u=p)}if(u.issues.length){t.mode==="loose"?o.value[c]=i[c]:s?(l=l??[],l.push(c)):o.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(p=>Lt(p,n,Xe())),input:c,path:[c],inst:e});continue}let f=u.value;if(f==="__proto__")continue;let m=t.valueType._zod.run({value:i[c],issues:[]},n);m instanceof Promise?a.push(m.then(p=>{p.issues.length&&o.issues.push(...Ft(c,p.issues)),o.value[f]=p.value})):(m.issues.length&&o.issues.push(...Ft(c,m.issues)),o.value[f]=m.value)}l&&l.length>0&&o.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}return a.length?Promise.all(a).then(()=>o):o}}),nh=T("$ZodMap",(e,t)=>{pe.init(e,t);let r=dt.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let i=o.value;if(!(i instanceof Map))return o.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),o;let a=[];o.value=r?r.alloc(e,o,new Map,n):new Map;let s=n?.abortEarly,l=o.issues.length;for(let[c,u]of i){if(s&&o.issues.length!==l){if(At(o,l))break;l=o.issues.length}let d=t.keyType._zod.run({value:c,issues:[]},n),f=t.valueType._zod.run({value:u,issues:[]},n);d instanceof Promise||f instanceof Promise?a.push(Promise.all([d,f]).then(([m,p])=>{Ek(m,p,o,c,i,e,n)})):Ek(d,f,o,c,i,e,n)}return a.length?Promise.all(a).then(()=>o):o}});function Ek(e,t,r,o,n,i,a){e.issues.length&&(va.has(typeof o)?r.issues.push(...Ft(o,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:e.issues.map(s=>Lt(s,a,Xe()))})),t.issues.length&&(va.has(typeof o)?r.issues.push(...Ft(o,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map(s=>Lt(s,a,Xe()))})),r.value.set(e.value,t.value)}var rh=T("$ZodSet",(e,t)=>{pe.init(e,t);let r=dt.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let i=o.value;if(!(i instanceof Set))return o.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),o;let a=[];o.value=r?r.alloc(e,o,new Set,n):new Set;let s=n?.abortEarly,l=o.issues.length;for(let c of i){if(s&&o.issues.length!==l){if(At(o,l))break;l=o.issues.length}let u=t.valueType._zod.run({value:c,issues:[]},n);u instanceof Promise?a.push(u.then(d=>Ok(d,o))):Ok(u,o)}return a.length?Promise.all(a).then(()=>o):o}});function Ok(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var oh=T("$ZodEnum",(e,t)=>{pe.init(e,t);let r=Co(t.entries),o=new Set(r);e._zod.values=o,ke(e,"pattern",n=>{let i=Co(n.def.entries).filter(a=>va.has(typeof a));return new RegExp(i.length?`^(${i.map(a=>en(a.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,i)=>{let a=n.value;return o.has(a)||n.issues.push({code:"invalid_value",values:r,input:a,inst:e}),n}}),ih=T("$ZodLiteral",(e,t)=>{pe.init(e,t);let r=new Set(t.values);e._zod.values=r,ke(e,"pattern",o=>{let n=o.def.values;return new RegExp(n.length?`^(${n.map(i=>typeof i=="string"?en(i):i?en(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,n)=>{let i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),ah=T("$ZodFile",(e,t)=>{pe.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),sh=T("$ZodTransform",(e,t)=>{pe.init(e,t),e._zod.optin="optional",dt.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new dr(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(a=>(r.value=a,r));if(n instanceof Promise)throw new zt;return r.value=n,r}});function Mk(e,t){return e.value=t.issues.length?void 0:t.value,e}var _c=T("$ZodOptional",(e,t)=>{pe.init(e,t),ke(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",ke(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),ke(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Vn(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(i=>Mk(r,i)):Mk(r,n)}return t.innerType._zod.run(r,o)}}),lh=T("$ZodExactOptional",(e,t)=>{_c.init(e,t),ke(e,"values",r=>r.def.innerType._zod.values),ke(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),ch=T("$ZodNullable",(e,t)=>{pe.init(e,t),ke(e,"optin",r=>r.def.innerType._zod.optin),ke(e,"optout",r=>r.def.innerType._zod.optout),ke(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Vn(o.source)}|null)$`):void 0}),ke(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),uh=T("$ZodDefault",(e,t)=>{pe.init(e,t),e._zod.optin="defaulted",ke(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Ck(i,t)):Ck(n,t)}});function Ck(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var dh=T("$ZodPrefault",(e,t)=>{pe.init(e,t),e._zod.optin="defaulted",ke(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),mh=T("$ZodNonOptional",(e,t)=>{pe.init(e,t),ke(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Dk(i,e)):Dk(n,e)}});function Dk(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var fh=T("$ZodSuccess",(e,t)=>{pe.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new dr("ZodSuccess");let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.issues.length===0,r)):(r.value=n.issues.length===0,r)}});function jk(e,t,r,o){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(n=>Lt(n,o,Xe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var ph=T("$ZodCatch",(e,t)=>{pe.init(e,t),ke(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ke(e,"optout",r=>r.def.innerType._zod.optout),ke(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(i=>jk(r,i,t,o)):jk(r,n,t,o)}}),hh=T("$ZodNaN",(e,t)=>{pe.init(e,t),e._zod.parse=(r,o)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),vc=T("$ZodPipe",(e,t)=>{pe.init(e,t),ke(e,"values",r=>r.def.in._zod.values),ke(e,"optin",r=>r.def.in._zod.optin),ke(e,"optout",r=>r.def.out._zod.optout),ke(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);return i instanceof Promise?i.then(a=>nc(a,t.in,o)):nc(i,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(i=>nc(i,t.out,o)):nc(n,t.out,o)}});function nc(e,t,r){return e.issues.some(o=>o.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var Ua=T("$ZodCodec",(e,t)=>{pe.init(e,t),ke(e,"values",r=>r.def.in._zod.values),ke(e,"optin",r=>r.def.in._zod.optin),ke(e,"optout",r=>r.def.out._zod.optout),ke(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(r,o);return i instanceof Promise?i.then(a=>rc(a,t,o)):rc(i,t,o)}else{let i=t.out._zod.run(r,o);return i instanceof Promise?i.then(a=>rc(a,t,o)):rc(i,t,o)}}});function rc(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let n=t.transform(e.value,e);return n instanceof Promise?n.then(i=>oc(e,i,t.out,r)):oc(e,n,t.out,r)}else{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(i=>oc(e,i,t.in,r)):oc(e,n,t.in,r)}}function oc(e,t,r,o){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},o)}var gh=T("$ZodPreprocess",(e,t)=>{vc.init(e,t)}),bh=T("$ZodReadonly",(e,t)=>{pe.init(e,t),ke(e,"propValues",r=>r.def.innerType._zod.propValues),ke(e,"values",r=>r.def.innerType._zod.values),ke(e,"optin",r=>r.def.innerType?._zod?.optin),ke(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(Nk):Nk(n)}});function Nk(e){return e.memo||(e.value=Object.freeze(e.value)),e}function vC(e){let t=e._zod.def,r=t.pattern,o=!!t.format?.includes("int"),n,i;for(let s of t.checks??[]){let l=s._zod.def;l.pattern&&(r=l.pattern),o||(o=!!l.format?.includes("int"));let c=l.minimum??l.length,u=l.maximum??l.length;c!==void 0&&(n===void 0||c>n)&&(n=c),u!==void 0&&(i===void 0||u<i)&&(i=u)}if(r)return r.source;if(n!==void 0&&i!==void 0&&n>i)return"(?!)";if(n!==void 0||i!==void 0)return Mf({minimum:n,maximum:i}).source;let a=e._zod.pattern;return(o&&a===Zn?Ea:a)?.source}function cp(e){let t=e._zod.def,r=e._zod.pattern?.source,o=t.innerType??e._zod.innerType;if(o){let n=o._zod.pattern?.source,i=cp(o);return r&&n&&i&&i!==n?r.replace(Vn(n),()=>Vn(i)):r}if(t.options){let n=t.options.map(cp);if(n.every(Boolean))return`^(${n.map(i=>Vn(i)).join("|")})$`}return vC(e)}var yh=T("$ZodTemplateLiteral",(e,t)=>{pe.init(e,t);let r=[];for(let o of t.parts)if(typeof o=="object"&&o!==null){let n=cp(o);if(!n)throw new Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);r.push(Vn(n))}else if(o===null||Hm.has(typeof o))r.push(en(`${o}`));else throw new Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>typeof o.value!="string"?(o.issues.push({input:o.value,inst:e,expected:"string",code:"invalid_type"}),o):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(o.value)||o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o)}),_h=T("$ZodFunction",(e,t)=>(pe.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...o){let n=e._def.input?zl(e._def.input,o):o,i=Reflect.apply(r,this,n);return e._def.output?zl(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...o){let n=e._def.input?await Ul(e._def.input,o):o,i=await Reflect.apply(r,this,n);return e._def.output?await Ul(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,o)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let o=e.constructor;return Array.isArray(r[0])?new o({type:"function",input:new yc({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new o({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let o=e.constructor;return new o({type:"function",input:e._def.input,output:r})},e)),vh=T("$ZodPromise",(e,t)=>{pe.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then(n=>t.innerType._zod.run({value:n,issues:[]},o))}),Ba=T("$ZodLazy",(e,t)=>{pe.init(e,t),Vm(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),ke(e,"pattern",r=>r.innerType?._zod?.pattern),ke(e,"propValues",r=>r.innerType?._zod?.propValues),ke(e,"optin",r=>r.innerType?._zod?.optin??void 0),ke(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),wh=T("$ZodCustom",(e,t)=>{Le.init(e,t),pe.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(i=>Fk(i,r,o,e));Fk(n,r,o,e)}});function Fk(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Fo(n))}}var xc=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},$h="~memo",Hk=[];function Wk(e){return e!==null&&typeof e=="object"}function kh(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var Jk=new WeakMap,Go=0,$c=1,Va=2;function Za(e,t,r){let o=Jk.get(e);if(o!==void 0)return o?Va:Go;if(t.has(e))return Va;t.add(e);let n=Go,i=u=>{if(n!==Va&&u?._zod){let d=Za(u,t,r);d>n&&(n=d)}},a=(u,d)=>{let f=Go;for(let m of Reflect.ownKeys(u)){let p=Object.getOwnPropertyDescriptor(u,m);if(d&&!p.enumerable)continue;let g=p.get?$c:p.value?._zod?Za(p.value,t,r):Go;g>f&&(f=g)}return f},s=u=>{u>n&&(n=u)},l=e._zod.def,c=l.type;switch(c){case"object":{let u=No(l);s(u?a(u,!0):$c),i(l.catchall);break}case"array":i(l.element);break;case"tuple":for(let u of l.items)i(u);i(l.rest);break;case"record":case"map":i(l.keyType),i(l.valueType);break;case"set":i(l.valueType);break;case"union":for(let u of l.options)i(u);break;case"intersection":i(l.left),i(l.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(l.innerType);break;case"pipe":i(l.in),i(l.out);break;case"function":i(l.input),i(l.output);break;case"lazy":{let u=l._cachedInner??(r?e._zod.innerType:void 0);s(u?Za(u,t,!1):$c);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in l){let d=Object.getOwnPropertyDescriptor(l,u);if(!d||d.get)continue;let f=d.value;if(!(!f||typeof f!="object")){if(f._zod)i(f);else if(Array.isArray(f))for(let m of f)i(m)}}}return t.delete(e),wC(e,n)}function wC(e,t){return t!==$c&&Jk.set(e,t===Va),t}function Sc(e){return Za(e,new Set,!0)!==Go}function kC(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var wc,kc=[],$C={alloc(e,t,r){let o=wc;if(!o)return r;wc=void 0;let n={value:r,issues:null};return o.set(t.value,n),kc.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,i)=>{if(i.direction!=="backward"&&Rc(i,n.value))throw new xc;return r(n,i)};e._zod.parse=o,e._zod.run===r&&(e._zod.run=o)})},attach(e){var t;let r,o=!1,n,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let a=e._zod.parse,s=(l,c)=>{if(r===void 0){let v=Za(e,new Set,!1);if(v===Go)return e._zod.parse=a,e._zod.run===s&&(e._zod.run=a),a(l,c);v===Va||o?r=!0:o=!0}let u=l.value;if(!Wk(u))return a(l,c);let d=c[$h];d||(d={buckets:new WeakMap,backEdges:void 0},c[$h]=d);let f;n===c?f=i:(f=kC(d,e),n=c,i=f);let m=f.get(u);if(m)return l.value=m.value,m.issues?m.issues.length&&l.issues.push(...kh(m.issues)):(l.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(m.value)),l;wc=f;let p=kc.length,g=a(l,c);wc=void 0;let _=kc.length>p?kc.pop():void 0;return g instanceof Promise?g.then(v=>(_&&(_.issues=v.issues.length?kh(v.issues):Hk),v)):(_&&(_.issues=g.issues.length?kh(g.issues):Hk),g)};e._zod.parse=s,e._zod.run===a&&(e._zod.run=s)})}};function Ga(){return $C}function Rc(e,t){let r=e[$h]?.backEdges;return r!==void 0&&Wk(t)&&r.has(t)}var Wa={};Dn(Wa,{ar:()=>Kk,az:()=>qk,be:()=>Yk,bg:()=>Qk,bn:()=>e$,ca:()=>t$,ckb:()=>n$,cs:()=>r$,da:()=>o$,de:()=>i$,el:()=>a$,en:()=>Ic,eo:()=>s$,es:()=>l$,fa:()=>c$,fi:()=>u$,fr:()=>d$,frCA:()=>m$,gu:()=>f$,he:()=>p$,hi:()=>h$,hr:()=>g$,hu:()=>b$,hy:()=>_$,id:()=>v$,is:()=>w$,it:()=>k$,ja:()=>$$,ka:()=>x$,kh:()=>S$,km:()=>Tc,kn:()=>R$,ko:()=>I$,lt:()=>P$,mk:()=>A$,ms:()=>E$,ne:()=>O$,nl:()=>M$,nn:()=>C$,no:()=>D$,ota:()=>j$,pl:()=>F$,ps:()=>N$,pt:()=>L$,ptBR:()=>z$,ro:()=>U$,ru:()=>V$,sk:()=>Z$,sl:()=>G$,sv:()=>H$,ta:()=>W$,tg:()=>J$,th:()=>K$,tk:()=>q$,tr:()=>X$,ua:()=>Y$,uk:()=>Pc,ur:()=>Q$,uz:()=>ex,vi:()=>tx,yo:()=>ox,zhCN:()=>nx,zhTW:()=>rx});var xC=()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},map:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(n){return e[n]??null}let r={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",mac:"\u0639\u0646\u0648\u0627\u0646 MAC",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",credit_card:"\u0631\u0642\u0645 \u0628\u0637\u0627\u0642\u0629 \u0627\u0644\u0627\u0626\u062A\u0645\u0627\u0646",currency_code:"\u0631\u0645\u0632 \u0627\u0644\u0639\u0645\u0644\u0629",iban:"IBAN",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${n.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${s}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${i}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${s}`}case"invalid_value":return n.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${F(n.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${n.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${n.minimum.toString()} ${a.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${n.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${r[i.format]??n.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${n.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${n.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${n.keys.length>1?"\u0629":""}: ${A(n.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function Kk(){return{localeError:xC()}}var SC=()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"},map:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"kredit kart\u0131 n\xF6mr\u0259si",currency_code:"valyuta kodu",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${n.expected}, daxil olan ${s}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${i}, daxil olan ${s}`}case"invalid_value":return n.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${F(n.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()} ${a.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${r[i.format]??n.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${n.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${n.keys.length>1?"lar":""}: ${A(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${n.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function qk(){return{localeError:SC()}}function Xk(e,t,r,o){let n=Math.abs(e),i=n%10,a=n%100;return a>=11&&a<=19?o:i===1?t:i>=2&&i<=4?r:o}var RC=()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},map:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(n){return e[n]??null}let r={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",mac:"MAC \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",credit_card:"\u043D\u0443\u043C\u0430\u0440 \u043A\u0440\u044D\u0434\u044B\u0442\u043D\u0430\u0439 \u043A\u0430\u0440\u0442\u044B",currency_code:"\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",iban:"IBAN",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},o={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${n.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${s}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${i}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${s}`}case"invalid_value":return n.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${F(n.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a){let s=Number(n.maximum),l=Xk(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${i}${n.maximum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a){let s=Number(n.minimum),l=Xk(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${i}${n.minimum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${n.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${A(n.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${n.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function Yk(){return{localeError:RC()}}var IC=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},map:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",mac:"MAC \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",credit_card:"\u043D\u043E\u043C\u0435\u0440 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0430",currency_code:"\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${s}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${s}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${F(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${i}${n.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${i}${n.minimum.toString()} ${a.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${i.prefix}"`;if(i.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${i.suffix}"`;if(i.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${i.includes}"`;if(i.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${i.pattern}`;let a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return i.format==="emoji"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="datetime"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="date"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),i.format==="time"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="duration"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${a} ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${A(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function Qk(){return{localeError:IC()}}var TC=()=>{let e={string:{unit:"\u0985\u0995\u09CD\u09B7\u09B0",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"},file:{unit:"\u09AC\u09BE\u0987\u099F",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"},array:{unit:"\u0986\u0987\u099F\u09C7\u09AE",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"},set:{unit:"\u0986\u0987\u099F\u09C7\u09AE",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"},map:{unit:"\u098F\u09A8\u09CD\u099F\u09CD\u09B0\u09BF",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"}};function t(n){return e[n]??null}let r={regex:"\u0987\u09A8\u09AA\u09C1\u099F",email:"\u0987\u09AE\u09C7\u0987\u09B2 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE",url:"URL",emoji:"\u0987\u09AE\u09CB\u099C\u09BF",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u09A4\u09BE\u09B0\u09BF\u0996 \u0993 \u09B8\u09AE\u09AF\u09BC",date:"ISO \u09A4\u09BE\u09B0\u09BF\u0996",time:"ISO \u09B8\u09AE\u09AF\u09BC",duration:"ISO \u09B8\u09AE\u09AF\u09BC\u0995\u09BE\u09B2",ipv4:"IPv4 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE",ipv6:"IPv6 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE",mac:"MAC \u09A0\u09BF\u0995\u09BE\u09A8\u09BE",cidrv4:"IPv4 \u09B0\u09C7\u099E\u09CD\u099C",cidrv6:"IPv6 \u09B0\u09C7\u099E\u09CD\u099C",base64:"base64-\u098F\u09A8\u0995\u09CB\u09A1\u09C7\u09A1 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",base64url:"base64url-\u098F\u09A8\u0995\u09CB\u09A1\u09C7\u09A1 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",json_string:"JSON \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",e164:"E.164 \u09A8\u09AE\u09CD\u09AC\u09B0",credit_card:"\u0995\u09CD\u09B0\u09C7\u09A1\u09BF\u099F \u0995\u09BE\u09B0\u09CD\u09A1 \u09A8\u09AE\u09CD\u09AC\u09B0",currency_code:"\u09AE\u09C1\u09A6\u09CD\u09B0\u09BE \u0995\u09CB\u09A1",iban:"IBAN",jwt:"JWT",template_literal:"\u0987\u09A8\u09AA\u09C1\u099F"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return`\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F: \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${i}, \u09AA\u09CD\u09B0\u09BE\u09AA\u09CD\u09A4 ${s}`}case"invalid_value":return n.values.length===1?`\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F: \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${F(n.values[0])}`:`\u0985\u09AC\u09C8\u09A7 \u0985\u09AA\u09B6\u09A8: ${A(n.values," | ")} \u098F\u09B0 \u09AE\u09A7\u09CD\u09AF\u09C7 \u098F\u0995\u099F\u09BF \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0985\u09A8\u09C7\u0995 \u09AC\u09A1\u09BC: ${n.origin??"\u09AE\u09BE\u09A8"} ${i}${n.maximum.toString()} ${a.unit??"\u098F\u09B2\u09BF\u09AE\u09C7\u09A8\u09CD\u099F"} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`:`\u0985\u09A8\u09C7\u0995 \u09AC\u09A1\u09BC: ${n.origin??"\u09AE\u09BE\u09A8"} ${i}${n.maximum.toString()} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0985\u09A8\u09C7\u0995 \u099B\u09CB\u099F: ${n.origin} ${i}${n.minimum.toString()} ${a.unit} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`:`\u0985\u09A8\u09C7\u0995 \u099B\u09CB\u099F: ${n.origin} ${i}${n.minimum.toString()} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${i.prefix}" \u09A6\u09BF\u09AF\u09BC\u09C7 \u09B6\u09C1\u09B0\u09C1 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`:i.format==="ends_with"?`\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${i.suffix}" \u09A6\u09BF\u09AF\u09BC\u09C7 \u09B6\u09C7\u09B7 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`:i.format==="includes"?`\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${i.includes}" \u0985\u09A8\u09CD\u09A4\u09B0\u09CD\u09AD\u09C1\u0995\u09CD\u09A4 \u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7`:i.format==="regex"?`\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: ${i.pattern} \u09AA\u09CD\u09AF\u09BE\u099F\u09BE\u09B0\u09CD\u09A8 \u09AE\u09BF\u09B2\u09A4\u09C7 \u09B9\u09AC\u09C7`:`\u0985\u09AC\u09C8\u09A7 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0985\u09AC\u09C8\u09A7 \u09A8\u09AE\u09CD\u09AC\u09B0: ${n.divisor} \u098F\u09B0 \u0997\u09C1\u09A3\u09BF\u09A4\u0995 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`;case"unrecognized_keys":return`\u0985\u099A\u09C7\u09A8\u09BE \u0995\u09C0${n.keys.length>1?"\u0997\u09C1\u09B2\u09CB":""}: ${A(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u098F \u0985\u09AC\u09C8\u09A7 \u0995\u09C0`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0985\u09AC\u09C8\u09A7 \u09A1\u09BF\u09B8\u0995\u09CD\u09B0\u09BF\u09AE\u09BF\u09A8\u09C7\u099F\u09B0 \u09AE\u09BE\u09A8\u0964 \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${n.options.map(a=>`'${a}'`).join(" | ")}`:"\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F";case"invalid_element":return`${n.origin} \u098F \u0985\u09AC\u09C8\u09A7 \u09AE\u09BE\u09A8`;default:return"\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F"}}};function e$(){return{localeError:TC()}}var PC=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"},map:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}let r={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",mac:"adre\xE7a MAC",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",credit_card:"n\xFAmero de targeta de cr\xE8dit",currency_code:"codi de moneda",iban:"IBAN",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${s}`:`Tipus inv\xE0lid: s'esperava ${i}, s'ha rebut ${s}`}case"invalid_value":return n.values.length===1?`Valor inv\xE0lid: s'esperava ${F(n.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${A(n.values," o ")}`;case"too_big":{let i=n.inclusive?"com a m\xE0xim":"menys de",a=t(n.origin);return a?`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xE9s ${i} ${n.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"com a m\xEDnim":"m\xE9s de",a=t(n.origin);return a?`Massa petit: s'esperava que ${n.origin} contingu\xE9s ${i} ${n.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${r[i.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${A(n.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${n.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${n.origin}`;default:return"Entrada inv\xE0lida"}}};function t$(){return{localeError:PC()}}var AC=()=>{let e={string:{unit:"\u067E\u06CC\u062A",verb:"\u0628\u06CE\u062A"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u0628\u06CE\u062A"},array:{unit:"\u062F\u0627\u0646\u06D5",verb:"\u0628\u06CE\u062A"},set:{unit:"\u062F\u0627\u0646\u06D5",verb:"\u0628\u06CE\u062A"},map:{unit:"\u062F\u0627\u0646\u06D5",verb:"\u0628\u06CE\u062A"}};function t(n){return e[n]??null}let r={regex:"regex",email:"\u0626\u06CC\u0645\u06D5\u06CC\u06B5",url:"\u0628\u06D5\u0633\u062A\u06D5\u0631 (URL)",emoji:"\u0626\u06CC\u0645\u06C6\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0695\u06CE\u06A9\u06D5\u0648\u062A \u0648 \u06A9\u0627\u062A",date:"\u0695\u06CE\u06A9\u06D5\u0648\u062A",time:"\u06A9\u0627\u062A",duration:"\u0645\u0627\u0648\u06D5",ipv4:"\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC IPv4",ipv6:"\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC IPv6",mac:"\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC MAC",cidrv4:"\u0645\u06D5\u0648\u062F\u0627\u06CC IPv4",cidrv6:"\u0645\u06D5\u0648\u062F\u0627\u06CC IPv6",base64:"\u062F\u06D5\u0642\u06CC base64",base64url:"\u062F\u06D5\u0642\u06CC base64url",json_string:"\u062F\u06D5\u0642\u06CC JSON",e164:"\u0698\u0645\u0627\u0631\u06D5\u06CC E.164",credit_card:"\u0698\u0645\u0627\u0631\u06D5\u06CC \u06A9\u0627\u0631\u062A\u06CC \u06A9\u0631\u06CE\u062F\u06CC\u062A",currency_code:"\u06A9\u06C6\u062F\u06CC \u062F\u0631\u0627\u0648",iban:"IBAN",jwt:"JWT",template_literal:"\u062A\u06CE\u06A9\u0631\u062F\u06D5"},o={nan:"NaN",string:"\u0646\u0648\u0648\u0633\u06CC\u0646",number:"\u0698\u0645\u0627\u0631\u06D5",boolean:"boolean",array:"array",object:"object",date:"\u0695\u06CE\u06A9\u06D5\u0648\u062A",integer:"\u0698\u0645\u0627\u0631\u06D5",float:"\u0698\u0645\u0627\u0631\u06D5",null:"null",undefined:"undefined",function:"function",symbol:"symbol",unknown:"unknown",promise:"promise",void:"void",never:"never",map:"map",set:"set"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a,l=["\u0627","\u0648","\u06C6","\u0648\u0648","\u06D5","\u06CC","\u06CE"].some(u=>s.endsWith(u))?"\u06CC\u06D5":"\u06D5",c=/^[a-zA-Z]+$/.test(s);return a==="null"||a==="undefined"?"\u062F\u0627\u0648\u0627\u06A9\u0631\u0627\u0648\u06D5":`\u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 ${i} \u0628\u06CE\u062A\u060C \u0628\u06D5\u06B5\u0627\u0645 ${s}${c?"":l}`}case"invalid_value":return n.values.length===1?`\u0628\u06D5\u0647\u0627\u06A9\u06D5 \u0646\u0627\u062F\u0631\u0648\u0648\u0633\u062A\u06D5: \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 ${F(n.values[0])} \u0628\u06CE\u062A`:`\u0647\u06D5\u06B5\u0628\u0698\u0627\u0631\u062F\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 \u06CC\u06D5\u06A9\u06CE\u06A9 \u0628\u06CE\u062A \u0644\u06D5 ${A(n.values,"|")}`;case"too_big":{let i=t(n.origin);return i?`\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u0632\u06C6\u0631\u06D5\u0648\u06D5 ${n.maximum.toString()} ${i.unit} ${i.verb}`:`\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u0632\u06C6\u0631\u06D5\u0648\u06D5 ${n.maximum.toString()} \u0628\u06CE\u062A`}case"too_small":{let i=t(n.origin);return i?`\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u06A9\u06D5\u0645\u06D5\u0648\u06D5 ${n.minimum.toString()} ${i.unit} ${i.verb}`:`\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u06A9\u06D5\u0645\u06D5\u0648\u06D5 ${n.minimum.toString()} \u0628\u06CE\u062A`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u062F\u06D5\u0633\u062A\u067E\u06CE\u0628\u06A9\u0627\u062A \u0628\u06D5 "${i.prefix}"`:i.format==="ends_with"?`\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u06A9\u06C6\u062A\u0627\u06CC\u06CC\u0628\u06CE\u062A \u0628\u06D5 "${i.suffix}"`:i.format==="includes"?`\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 "${i.includes}" \u0644\u06D5\u062E\u06C6\u0628\u06AF\u0631\u06CE\u062A`:i.format==="regex"?`\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0644\u06D5\u06AF\u06D5\u06B5 \u067E\u0627\u062A\u06CE\u0631\u0646\u06CC ${i.pattern} \u0628\u06AF\u0648\u0646\u062C\u06CE\u062A`:`\u0628\u06D5\u0647\u0627\u06CC ${r[i.format]??n.format} \u0646\u0627\u062F\u0631\u0648\u0633\u062A\u06D5`}case"not_multiple_of":return`\u0698\u0645\u0627\u0631\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u062F\u06D5\u0628\u06CE\u062A \u0686\u06D5\u0646\u062F \u0647\u06CE\u0646\u062F\u06D5 \u0628\u06CE\u062A \u0628\u06C6 ${n.divisor}`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u0644\u06CC \u0646\u06D5\u0646\u0627\u0633\u0631\u0627\u0648: ${A(n.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u0644\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A \u0644\u06D5 ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0628\u06D5\u0647\u0627\u06CC \u0646\u06D5\u0646\u0627\u0633\u0631\u0627\u0648 \u0647\u06D5\u06CC\u06D5. \u0628\u06D5\u0647\u0627\u06CC \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648: ${n.options.map(a=>`'${a}'`).join(" | ")}`:"\u06CC\u06D5\u06A9\u06AF\u0631\u062A\u0646\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A";case"invalid_element":return`${n.origin} \u0628\u06D5\u0647\u0627\u06A9\u06D5 \u0646\u0627\u062F\u0631\u0648\u0633\u062A\u06D5`;default:return"\u062A\u06CE\u06A9\u0631\u062F\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A"}}};function n$(){return{localeError:AC()}}var EC=()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"},map:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(n){return e[n]??null}let r={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",credit_card:"\u010D\xEDslo kreditn\xED karty",currency_code:"k\xF3d m\u011Bny",iban:"IBAN",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${n.expected}, obdr\u017Eeno ${s}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${i}, obdr\u017Eeno ${s}`}case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${F(n.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.maximum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.minimum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${r[i.format]??n.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${n.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${A(n.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${n.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${n.origin}`;default:return"Neplatn\xFD vstup"}}};function r$(){return{localeError:EC()}}var OC=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"},map:{unit:"elementer",verb:"indeholdt"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kreditkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ugyldigt input: forventede instanceof ${n.expected}, fik ${s}`:`Ugyldigt input: forventede ${i}, fik ${s}`}case"invalid_value":return n.values.length===1?`Ugyldig v\xE6rdi: forventede ${F(n.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),s=o[n.origin]??n.origin;return a?`For stor: forventede ${s??"value"} ${a.verb} ${i} ${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor: forventede ${s??"value"} havde ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),s=o[n.origin]??n.origin;return a?`For lille: forventede ${s} ${a.verb} ${i} ${n.minimum.toString()} ${a.unit}`:`For lille: forventede ${s} havde ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ugyldig streng: skal starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: skal ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: skal indeholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${A(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${n.origin}`;default:return"Ugyldigt input"}}};function o$(){return{localeError:OC()}}var MC=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"},map:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}let r={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",mac:"MAC-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",credit_card:"Kreditkartennummer",currency_code:"W\xE4hrungscode",iban:"IBAN",jwt:"JWT",template_literal:"Eingabe"},o={nan:"NaN",number:"Zahl",array:"Array"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${s}`:`Ung\xFCltige Eingabe: erwartet ${i}, erhalten ${s}`}case"invalid_value":return n.values.length===1?`Ung\xFCltige Eingabe: erwartet ${F(n.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${r[i.format]??n.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${A(n.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${n.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${n.origin}`;default:return"Ung\xFCltige Eingabe"}}};function i$(){return{localeError:MC()}}var CC=()=>{let e={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function t(n){return e[n]??null}let r={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",credit_card:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 \u03C0\u03B9\u03C3\u03C4\u03C9\u03C4\u03B9\u03BA\u03AE\u03C2 \u03BA\u03AC\u03C1\u03C4\u03B1\u03C2",currency_code:"\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03BD\u03BF\u03BC\u03AF\u03C3\u03BC\u03B1\u03C4\u03BF\u03C2",iban:"IBAN",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return typeof n.expected=="string"&&/^[A-Z]/.test(n.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${n.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${s}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${s}`}case"invalid_value":return n.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${F(n.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${i}${n.maximum.toString()} ${a.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${i}${n.minimum.toString()} ${a.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${i.prefix}"`:i.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${i.suffix}"`:i.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${i.includes}"`:i.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${i.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${r[i.format]??n.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${n.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${n.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${n.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${A(n.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${n.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${n.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function a$(){return{localeError:CC()}}var DC=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(i,a){return i==="number"&&typeof a=="number"&&!Number.isFinite(a)?String(a):o[i]??i}return i=>{switch(i.code){case"invalid_type":{let a=n(i.expected),s=U(i.input),l=n(s,i.input);return`Invalid input: expected ${a}, received ${l}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${F(i.values[0])}`:`Invalid option: expected one of ${A(i.values,"|")}`;case"too_big":{let a=i.exact?"exactly ":i.inclusive?"<=":"<",s=t(i.origin);return s?`Too big: expected ${i.origin??"value"} to have ${a}${i.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${a}${i.maximum.toString()}`}case"too_small":{let a=i.exact?"exactly ":i.inclusive?">=":">",s=t(i.origin);return s?`Too small: expected ${i.origin} to have ${a}${i.minimum.toString()} ${s.unit}`:`Too small: expected ${i.origin} to be ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Invalid string: must start with "${a.prefix}"`:a.format==="ends_with"?`Invalid string: must end with "${a.suffix}"`:a.format==="includes"?`Invalid string: must include "${a.includes}"`:a.format==="regex"?`Invalid string: must match pattern ${a.pattern}`:`Invalid ${r[a.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${A(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(s=>`'${s}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Ic(){return{localeError:DC()}}var jC=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"},map:{unit:"elementojn",verb:"havi"}};function t(n){return e[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",mac:"MAC-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",credit_card:"kreditkarta numero",currency_code:"valuta kodo",iban:"IBAN",jwt:"JWT",template_literal:"enigo"},o={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${n.expected}, ricevi\u011Dis ${s}`:`Nevalida enigo: atendi\u011Dis ${i}, ricevi\u011Dis ${s}`}case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${F(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()} ${a.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${i}${n.minimum.toString()} ${a.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${i.prefix}"`:i.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${i.suffix}"`:i.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${i.includes}"`:i.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${i.pattern}`:`Nevalida ${r[i.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${A(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function s$(){return{localeError:jC()}}var NC=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(n){return e[n]??null}let r={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",mac:"direcci\xF3n MAC",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",credit_card:"n\xFAmero de tarjeta de cr\xE9dito",currency_code:"c\xF3digo de moneda",iban:"IBAN",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${n.expected}, recibido ${s}`:`Entrada inv\xE1lida: se esperaba ${i}, recibido ${s}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: se esperaba ${F(n.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),s=o[n.origin]??n.origin;return a?`Demasiado grande: se esperaba que ${s??"valor"} tuviera ${i}${n.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${s??"valor"} fuera ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),s=o[n.origin]??n.origin;return a?`Demasiado peque\xF1o: se esperaba que ${s} tuviera ${i}${n.minimum.toString()} ${a.unit}`:`Demasiado peque\xF1o: se esperaba que ${s} fuera ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${i.prefix}"`:i.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${i.suffix}"`:i.format==="includes"?`Cadena inv\xE1lida: debe incluir "${i.includes}"`:i.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${i.pattern}`:`Inv\xE1lido ${r[i.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${A(n.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${o[n.origin]??n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${o[n.origin]??n.origin}`;default:return"Entrada inv\xE1lida"}}};function l$(){return{localeError:NC()}}var FC=()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},map:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(n){return e[n]??null}let r={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",mac:"MAC \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",credit_card:"\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A \u0627\u0639\u062A\u0628\u0627\u0631\u06CC",currency_code:"\u06A9\u062F \u0627\u0631\u0632",iban:"IBAN",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${n.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${s} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${i} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${s} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return n.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${F(n.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${A(n.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${a.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${r[i.format]??n.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${n.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${n.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${A(n.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${n.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${n.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function c$(){return{localeError:FC()}}var LC=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},map:{unit:"alkiota",subject:"kuvauksen"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(n){return e[n]??null}let r={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",mac:"MAC-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",credit_card:"luottokortin numero",currency_code:"valuuttakoodi",iban:"IBAN",jwt:"JWT",template_literal:"templaattimerkkijono"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${s}`:`Virheellinen tyyppi: odotettiin ${i}, oli ${s}`}case"invalid_value":return n.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${F(n.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Liian suuri: ${a.subject} t\xE4ytyy olla ${i}${n.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Liian pieni: ${a.subject} t\xE4ytyy olla ${i}${n.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${r[i.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${A(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function u$(){return{localeError:LC()}}var zC=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(n){return e[n]??null}let r={regex:"expression r\xE9guli\xE8re",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",mac:"adresse MAC",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne de caract\xE8res encod\xE9e en base64",base64url:"cha\xEEne de caract\xE8res encod\xE9e en base64url",json_string:"cha\xEEne de caract\xE8res JSON",e164:"num\xE9ro au format E.164",credit_card:"num\xE9ro de carte de cr\xE9dit",currency_code:"code de devise",iban:"IBAN",jwt:"JWT",template_literal:"entr\xE9e"},o={string:"cha\xEEne de caract\xE8res",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"record",map:"map",set:"ensemble",file:"fichier",nonoptional:"non optionnel",nan:"NaN",function:"fonction"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : instance de ${n.expected} attendu, ${s} re\xE7u`:`Entr\xE9e invalide : ${i} attendu, ${s} re\xE7u`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : ${F(n.values[0])} attendu`:`Option invalide : une valeur parmi ${A(n.values,"|")} attendue`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Trop grand : ${o[n.origin]??"valeur"} doit ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o[n.origin]??"valeur"} doit \xEAtre ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Trop petit : ${o[n.origin]??"valeur"} doit ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Trop petit : ${o[n.origin]??"valeur"} doit \xEAtre ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cha\xEEne de caract\xE8res invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne de caract\xE8res invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne de caract\xE8res invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne de caract\xE8res invalide : doit correspondre au motif ${i.pattern}`:`${r[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${A(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};function d$(){return{localeError:zC()}}var UC=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"},map:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(n){return e[n]??null}let r={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",mac:"adresse MAC",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",credit_card:"num\xE9ro de carte de cr\xE9dit",currency_code:"code de devise",iban:"IBAN",jwt:"JWT",template_literal:"entr\xE9e"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : attendu instanceof ${n.expected}, re\xE7u ${s}`:`Entr\xE9e invalide : attendu ${i}, re\xE7u ${s}`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : attendu ${F(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u2264":"<",a=t(n.origin);return a?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u2265":">",a=t(n.origin);return a?`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${r[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${A(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};function m$(){return{localeError:UC()}}var BC=()=>{let e={string:{unit:"\u0A85\u0A95\u0ACD\u0AB7\u0AB0",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"},file:{unit:"\u0AAC\u0ABE\u0AAF\u0A9F",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"},array:{unit:"\u0A86\u0A87\u0A9F\u0AAE",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"},set:{unit:"\u0A86\u0A87\u0A9F\u0AAE",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"},map:{unit:"\u0A8F\u0AA8\u0ACD\u0A9F\u0ACD\u0AB0\u0AC0",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"}};function t(n){return e[n]??null}let r={regex:"\u0A87\u0AA8\u0AAA\u0AC1\u0A9F",email:"\u0A88\u0AAE\u0AC7\u0A87\u0AB2 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8",url:"URL",emoji:"\u0A87\u0AAE\u0ACB\u0A9C\u0AC0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0AA4\u0ABE\u0AB0\u0AC0\u0A96 \u0A85\u0AA8\u0AC7 \u0AB8\u0AAE\u0AAF",date:"ISO \u0AA4\u0ABE\u0AB0\u0AC0\u0A96",time:"ISO \u0AB8\u0AAE\u0AAF",duration:"ISO \u0A85\u0AB5\u0AA7\u0ABF",ipv4:"IPv4 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8",ipv6:"IPv6 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8",mac:"MAC \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8",cidrv4:"IPv4 \u0AB6\u0ACD\u0AB0\u0AC7\u0AA3\u0AC0",cidrv6:"IPv6 \u0AB6\u0ACD\u0AB0\u0AC7\u0AA3\u0AC0",base64:"base64-\u0A8F\u0AA8\u0ACD\u0A95\u0ACB\u0AA1\u0AC7\u0AA1 \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",base64url:"base64url-\u0A8F\u0AA8\u0ACD\u0A95\u0ACB\u0AA1\u0AC7\u0AA1 \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",json_string:"JSON \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",e164:"E.164 \u0AA8\u0A82\u0AAC\u0AB0",credit_card:"\u0A95\u0ACD\u0AB0\u0AC7\u0AA1\u0ABF\u0A9F \u0A95\u0ABE\u0AB0\u0ACD\u0AA1 \u0AA8\u0A82\u0AAC\u0AB0",currency_code:"\u0A9A\u0AB2\u0AA3 \u0A95\u0ACB\u0AA1",iban:"IBAN",jwt:"JWT",template_literal:"\u0A87\u0AA8\u0AAA\u0AC1\u0A9F"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F: \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${i}, \u0AAA\u0ACD\u0AB0\u0ABE\u0AAA\u0ACD\u0AA4 ${s}`}case"invalid_value":return n.values.length===1?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F: \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${F(n.values[0])}`:`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB5\u0ABF\u0A95\u0AB2\u0ACD\u0AAA: ${A(n.values," | ")} \u0AAE\u0ABE\u0AA7\u0ACD\u0AAF\u0AAE\u0AA5\u0AC0 \u0A8F\u0A95 \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0A96\u0AC2\u0AAC \u0AAE\u0ACB\u0A9F\u0AC1\u0A82: ${n.origin??"\u0AAE\u0AC2\u0AB2\u0ACD\u0AAF"} ${i}${n.maximum.toString()} ${a.unit??"\u0A8F\u0AB2\u0ABF\u0AAE\u0AC7\u0AA8\u0ACD\u0A9F"} \u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F`:`\u0A96\u0AC2\u0AAC \u0AAE\u0ACB\u0A9F\u0AC1\u0A82: ${n.origin??"\u0AAE\u0AC2\u0AB2\u0ACD\u0AAF"} ${i}${n.maximum.toString()} \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0A96\u0AC2\u0AAC \u0AA8\u0ABE\u0AA8\u0AC1\u0A82: ${n.origin} ${i}${n.minimum.toString()} ${a.unit} \u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F`:`\u0A96\u0AC2\u0AAC \u0AA8\u0ABE\u0AA8\u0AC1\u0A82: ${n.origin} ${i}${n.minimum.toString()} \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${i.prefix}" \u0AA5\u0AC0 \u0AB6\u0AB0\u0AC2 \u0AA5\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`:i.format==="ends_with"?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${i.suffix}" \u0AAA\u0AB0 \u0AB8\u0AAE\u0ABE\u0AAA\u0ACD\u0AA4 \u0AA5\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`:i.format==="includes"?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${i.includes}" \u0AB6\u0ABE\u0AAE\u0AC7\u0AB2 \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`:i.format==="regex"?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: \u0AAA\u0AC7\u0A9F\u0AB0\u0ACD\u0AA8 ${i.pattern} \u0AB8\u0ABE\u0AA5\u0AC7 \u0AAE\u0AC7\u0AB3 \u0A96\u0ABE\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`:`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AA8\u0A82\u0AAC\u0AB0: ${n.divisor} \u0AA8\u0ACB \u0A97\u0AC1\u0AA3\u0ABE\u0A82\u0A95 \u0AB9\u0ACB\u0AB5\u0ACB \u0A9C\u0ACB\u0A88\u0A8F`;case"unrecognized_keys":return`\u0A93\u0AB3\u0A96\u0AC0 \u0AB6\u0A95\u0ABE\u0AA4\u0ABE \u0AA8\u0AB9\u0AC0\u0A82 \u0AA4\u0AC7 \u0A95\u0AC0${n.keys.length>1?"\u0A93":""}: ${A(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u0AAE\u0ABE\u0A82 \u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A95\u0AC0`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AA1\u0ABF\u0AB8\u0ACD\u0A95\u0ACD\u0AB0\u0ABF\u0AAE\u0ABF\u0AA8\u0AC7\u0A9F\u0AB0 \u0AAE\u0AC2\u0AB2\u0ACD\u0AAF. \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${n.options.map(a=>`'${a}'`).join(" | ")}`:"\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F";case"invalid_element":return`${n.origin} \u0AAE\u0ABE\u0A82 \u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AAE\u0AC2\u0AB2\u0ACD\u0AAF`;default:return"\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F"}}};function f$(){return{localeError:BC()}}var VC=()=>{let e={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},t={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=c=>c?e[c]:void 0,o=c=>{let u=r(c);return u?u.label:c??e.unknown.label},n=c=>`\u05D4${o(c)}`,i=c=>(r(c)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",a=c=>c?t[c]??null:null,s={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},uuidv4:{label:"UUIDv4",gender:"m"},uuidv6:{label:"UUIDv6",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},mac:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA MAC",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},credit_card:{label:"\u05DE\u05E1\u05E4\u05E8 \u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9",gender:"m"},currency_code:{label:"\u05E7\u05D5\u05D3 \u05DE\u05D8\u05D1\u05E2",gender:"m"},iban:{label:"IBAN",gender:"m"},jwt:{label:"JWT",gender:"m"},template_literal:{label:"\u05E7\u05DC\u05D8",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},l={nan:"NaN"};return c=>{switch(c.code){case"invalid_type":{let u=c.expected,d=l[u??""]??o(u),f=U(c.input),m=l[f]??e[f]?.label??f;return/^[A-Z]/.test(c.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${c.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${m}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${m}`}case"invalid_value":{if(c.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${F(c.values[0])}`;let u=c.values.map(m=>F(m));if(c.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u[0]} \u05D0\u05D5 ${u[1]}`;let d=u[u.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let u=a(c.origin),d=n(c.origin??"value");if(c.origin==="string")return`${u?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${c.maximum.toString()} ${u?.unit??""} ${c.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(c.origin==="number"){let p=c.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${c.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${c.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${p}`}if(c.origin==="array"||c.origin==="set"){let p=c.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",g=c.inclusive?`${c.maximum} ${u?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${c.maximum} ${u?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${p} \u05DC\u05D4\u05DB\u05D9\u05DC ${g}`.trim()}let f=c.inclusive?"<=":"<",m=i(c.origin??"value");return u?.unit?`${u.longLabel} \u05DE\u05D3\u05D9: ${d} ${m} ${f}${c.maximum.toString()} ${u.unit}`:`${u?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${m} ${f}${c.maximum.toString()}`}case"too_small":{let u=a(c.origin),d=n(c.origin??"value");if(c.origin==="string")return`${u?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${c.minimum.toString()} ${u?.unit??""} ${c.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(c.origin==="number"){let p=c.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${c.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${c.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${p}`}if(c.origin==="array"||c.origin==="set"){let p=c.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(c.minimum===1&&c.inclusive){let _=(c.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${p} \u05DC\u05D4\u05DB\u05D9\u05DC ${_}`}let g=c.inclusive?`${c.minimum} ${u?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${c.minimum} ${u?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${p} \u05DC\u05D4\u05DB\u05D9\u05DC ${g}`.trim()}let f=c.inclusive?">=":">",m=i(c.origin??"value");return u?.unit?`${u.shortLabel} \u05DE\u05D3\u05D9: ${d} ${m} ${f}${c.minimum.toString()} ${u.unit}`:`${u?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${m} ${f}${c.minimum.toString()}`}case"invalid_format":{let u=c;if(u.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${u.prefix}"`;if(u.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${u.suffix}"`;if(u.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${u.includes}"`;if(u.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${u.pattern}`;let d=s[u.format],f=d?.label??u.format,p=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${f} \u05DC\u05D0 ${p}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${c.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${c.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${c.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${A(c.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${n(c.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function p$(){return{localeError:VC()}}var ZC=()=>{let e={string:{unit:"\u0905\u0915\u094D\u0937\u0930",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"},file:{unit:"\u092C\u093E\u0907\u091F\u094D\u0938",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"},array:{unit:"\u0924\u0924\u094D\u0935",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"},set:{unit:"\u0924\u0924\u094D\u0935",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"},map:{unit:"\u092A\u094D\u0930\u0935\u093F\u0937\u094D\u091F\u093F\u092F\u093E\u0901",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"}};function t(n){return e[n]??null}let r={regex:"\u0907\u0928\u092A\u0941\u091F",email:"\u0908\u092E\u0947\u0932 \u092A\u0924\u093E",url:"URL",emoji:"\u0907\u092E\u094B\u091C\u0940",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0924\u093F\u0925\u093F \u0914\u0930 \u0938\u092E\u092F",date:"ISO \u0924\u093F\u0925\u093F",time:"ISO \u0938\u092E\u092F",duration:"ISO \u0905\u0935\u0927\u093F",ipv4:"IPv4 \u092A\u0924\u093E",ipv6:"IPv6 \u092A\u0924\u093E",mac:"MAC \u092A\u0924\u093E",cidrv4:"IPv4 \u0936\u094D\u0930\u0947\u0923\u0940",cidrv6:"IPv6 \u0936\u094D\u0930\u0947\u0923\u0940",base64:"Base64-\u090F\u0928\u094D\u0915\u094B\u0921\u0947\u0921 \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",base64url:"Base64URL-\u090F\u0928\u094D\u0915\u094B\u0921\u0947\u0921 \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",json_string:"JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",e164:"E.164 \u0938\u0902\u0916\u094D\u092F\u093E",credit_card:"\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0938\u0902\u0916\u094D\u092F\u093E",currency_code:"\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",iban:"IBAN",jwt:"JWT",template_literal:"\u0907\u0928\u092A\u0941\u091F"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return`\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${i}, \u092A\u094D\u0930\u093E\u092A\u094D\u0924 ${s}`}case"invalid_value":return n.values.length===1?`\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${F(n.values[0])}`:`\u0905\u092E\u093E\u0928\u094D\u092F \u0935\u093F\u0915\u0932\u094D\u092A: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u092E\u093E\u0928\u094B\u0902 \u092E\u0947\u0902 \u0938\u0947 \u090F\u0915 ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u092C\u0939\u0941\u0924 \u092C\u0921\u093C\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${n.origin??"\u092E\u093E\u0928"} \u092E\u0947\u0902 ${i}${n.maximum} ${a.unit} \u0939\u094B\u0902`:`\u092C\u0939\u0941\u0924 \u092C\u0921\u093C\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${n.origin??"\u092E\u093E\u0928"} ${i}${n.maximum} \u0939\u094B`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u092C\u0939\u0941\u0924 \u091B\u094B\u091F\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${n.origin} \u092E\u0947\u0902 ${i}${n.minimum} ${a.unit} \u0939\u094B\u0902`:`\u092C\u0939\u0941\u0924 \u091B\u094B\u091F\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${n.origin} ${i}${n.minimum} \u0939\u094B`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: "${i.prefix}" \u0938\u0947 \u0936\u0941\u0930\u0942 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`:i.format==="ends_with"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: "${i.suffix}" \u092A\u0930 \u0938\u092E\u093E\u092A\u094D\u0924 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`:i.format==="includes"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: \u0907\u0938\u092E\u0947\u0902 "${i.includes}" \u0936\u093E\u092E\u093F\u0932 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`:i.format==="regex"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: \u092A\u0948\u091F\u0930\u094D\u0928 ${i.pattern} \u0938\u0947 \u092E\u0947\u0932 \u0916\u093E\u0928\u093E \u091A\u093E\u0939\u093F\u090F`:`\u0905\u092E\u093E\u0928\u094D\u092F ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u0902\u0916\u094D\u092F\u093E: \u092F\u0939 ${n.divisor} \u0915\u093E \u0917\u0941\u0923\u091C \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`;case"unrecognized_keys":return`\u0905\u092A\u0930\u093F\u091A\u093F\u0924 \u0915\u0941\u0902\u091C\u0940${n.keys.length>1?"\u092F\u093E\u0901":""}: ${A(n.keys,", ")}`;case"invalid_key":return`\u0905\u092E\u093E\u0928\u094D\u092F \u0915\u0941\u0902\u091C\u0940: ${n.origin} \u092E\u0947\u0902`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0905\u092E\u093E\u0928\u094D\u092F \u0921\u093F\u0938\u094D\u0915\u094D\u0930\u093F\u092E\u093F\u0928\u0947\u091F\u0930 \u092E\u093E\u0928: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${n.options.map(a=>`'${a}'`).join(" | ")}`:"\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F";case"invalid_element":return`\u0905\u092E\u093E\u0928\u094D\u092F \u092E\u093E\u0928: ${n.origin} \u092E\u0947\u0902`;default:return"\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F"}}};function h$(){return{localeError:ZC()}}var GC=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function t(n){return e[n]??null}let r={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",credit_card:"broj kreditne kartice",currency_code:"kod valute",iban:"IBAN",jwt:"JWT",template_literal:"unos"},o={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${n.expected}, a primljeno je ${s}`:`Neispravan unos: o\u010Dekuje se ${i}, a primljeno je ${s}`}case"invalid_value":return n.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${F(n.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),s=o[n.origin]??n.origin;return a?`Preveliko: o\u010Dekivano da ${s??"vrijednost"} ima ${i}${n.maximum.toString()} ${a.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${s??"vrijednost"} bude ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),s=o[n.origin]??n.origin;return a?`Premalo: o\u010Dekivano da ${s} ima ${i}${n.minimum.toString()} ${a.unit}`:`Premalo: o\u010Dekivano da ${s} bude ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${i.prefix}"`:i.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${i.suffix}"`:i.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${i.includes}"`:i.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${i.pattern}`:`Neispravna ${r[i.format]??n.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${n.divisor}`;case"unrecognized_keys":return`Neprepoznat${n.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${A(n.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${o[n.origin]??n.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${o[n.origin]??n.origin}`;default:return"Neispravan unos"}}};function g$(){return{localeError:GC()}}var HC=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"},map:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}let r={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",mac:"MAC c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",credit_card:"hitelk\xE1rtyasz\xE1m",currency_code:"p\xE9nznemk\xF3d",iban:"IBAN",jwt:"JWT",template_literal:"bemenet"},o={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${n.expected}, a kapott \xE9rt\xE9k ${s}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${i}, a kapott \xE9rt\xE9k ${s}`}case"invalid_value":return n.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${F(n.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`T\xFAl nagy: ${n.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${n.maximum.toString()} ${a.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${n.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} m\xE9rete t\xFAl kicsi ${i}${n.minimum.toString()} ${a.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} t\xFAl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${r[i.format]??n.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${n.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${A(n.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${n.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${n.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function b$(){return{localeError:HC()}}function y$(e,t,r){return Math.abs(e)===1?t:r}function Ho(e){if(!e)return"";let t=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],r=e[e.length-1];return e+(t.includes(r)?"\u0576":"\u0568")}var WC=()=>{let e={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},map:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function t(n){return e[n]??null}let r={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",mac:"MAC \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",credit_card:"\u056F\u0580\u0565\u0564\u056B\u057F \u0584\u0561\u0580\u057F\u056B \u0570\u0561\u0574\u0561\u0580",currency_code:"\u0561\u0580\u056A\u0578\u0582\u0575\u0569\u056B \u056F\u0578\u0564",iban:"IBAN",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},o={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${n.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${s}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${i}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${s}`}case"invalid_value":return n.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${F(n.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a){let s=Number(n.maximum),l=y$(s,a.unit.one,a.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Ho(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.maximum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Ho(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a){let s=Number(n.minimum),l=y$(s,a.unit.one,a.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Ho(n.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.minimum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Ho(n.origin)} \u056C\u056B\u0576\u056B ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${i.prefix}"-\u0578\u057E`:i.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${i.suffix}"-\u0578\u057E`:i.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${i.includes}"`:i.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${i.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${r[i.format]??n.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${n.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${n.keys.length>1?"\u0576\u0565\u0580":""}. ${A(n.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${Ho(n.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${Ho(n.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function _$(){return{localeError:WC()}}var JC=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"},map:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}let r={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",mac:"alamat MAC",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",credit_card:"nomor kartu kredit",currency_code:"kode mata uang",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${s}`:`Input tidak valid: diharapkan ${i}, diterima ${s}`}case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${F(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${r[i.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${A(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function v$(){return{localeError:JC()}}var KC=()=>{let e={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"},map:{unit:"hluti",verb:"a\xF0 hafa"}};function t(n){return e[n]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",credit_card:"kreditkortan\xFAmer",currency_code:"gjaldmi\xF0ilsk\xF3\xF0i",iban:"IBAN",jwt:"JWT",template_literal:"gildi"},o={nan:"NaN",number:"n\xFAmer",array:"fylki"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${s} \xFEar sem \xE1 a\xF0 vera instanceof ${n.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${s} \xFEar sem \xE1 a\xF0 vera ${i}`}case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${F(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${i}${n.maximum.toString()} ${a.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${i}${n.minimum.toString()} ${a.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${i.prefix}"`:i.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${i.suffix}"`:i.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${i.includes}"`:i.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${i.pattern}`:`Rangt ${r[i.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${A(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}};function w$(){return{localeError:KC()}}var qC=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"},map:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}let r={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",mac:"indirizzo MAC",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",credit_card:"numero di carta di credito",currency_code:"codice valuta",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"numero",array:"vettore"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Input non valido: atteso instanceof ${n.expected}, ricevuto ${s}`:`Input non valido: atteso ${i}, ricevuto ${s}`}case"invalid_value":return n.values.length===1?`Input non valido: atteso ${F(n.values[0])}`:`Opzione non valida: atteso uno tra ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Input non valido: ${r[i.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${A(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function k$(){return{localeError:qC()}}var XC=()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},map:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(n){return e[n]??null}let r={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",mac:"MAC\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",credit_card:"\u30AF\u30EC\u30B8\u30C3\u30C8\u30AB\u30FC\u30C9\u756A\u53F7",currency_code:"\u901A\u8CA8\u30B3\u30FC\u30C9",iban:"IBAN",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},o={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${n.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${s}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${i}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${s}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return n.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${F(n.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${A(n.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=n.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",a=t(n.origin);return a?`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${a.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=n.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",a=t(n.origin);return a?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${a.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${r[i.format]??n.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${n.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${n.keys.length>1?"\u7FA4":""}: ${A(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function $$(){return{localeError:XC()}}var YC=()=>{let e={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},map:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function t(n){return e[n]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",mac:"MAC \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",credit_card:"\u10E1\u10D0\u10D9\u10E0\u10D4\u10D3\u10D8\u10E2\u10DD \u10D1\u10D0\u10E0\u10D0\u10D7\u10D8\u10E1 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",currency_code:"\u10D5\u10D0\u10DA\u10E3\u10E2\u10D8\u10E1 \u10D9\u10DD\u10D3\u10D8",iban:"IBAN",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},o={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${s}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${s}`}case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${F(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${A(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${i.prefix}"-\u10D8\u10D7`:i.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${i.suffix}"-\u10D8\u10D7`:i.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${i.includes}"-\u10E1`:i.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${i.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${A(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function x$(){return{localeError:YC()}}var QC=()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},map:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(n){return e[n]??null}let r={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",mac:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 MAC",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",credit_card:"\u179B\u17C1\u1781\u1794\u17D0\u178E\u17D2\u178E\u17A5\u178E\u1791\u17B6\u1793",currency_code:"\u1780\u17BC\u178A\u179A\u17BC\u1794\u17B7\u1799\u1794\u17D0\u178E\u17D2\u178E",iban:"IBAN",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},o={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${n.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${s}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${s}`}case"invalid_value":return n.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${F(n.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()} ${a.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()} ${a.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${n.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${A(n.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function Tc(){return{localeError:QC()}}function S$(){return Tc()}var e4=()=>{let e={string:{unit:"\u0C85\u0C95\u0CCD\u0CB7\u0CB0\u0C97\u0CB3\u0CC1",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"},file:{unit:"\u0CAC\u0CC8\u0C9F\u0CCD\u200C\u0C97\u0CB3\u0CC1",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"},array:{unit:"\u0CB5\u0CB8\u0CCD\u0CA4\u0CC1\u0C97\u0CB3\u0CC1",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"},set:{unit:"\u0CB5\u0CB8\u0CCD\u0CA4\u0CC1\u0C97\u0CB3\u0CC1",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"},map:{unit:"entries",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"}};function t(n){return e[n]??null}let r={regex:"\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD",email:"email \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0CA6\u0CBF\u0CA8\u0CBE\u0C82\u0C95\u0CA6 \u0CB8\u0CAE\u0CAF",date:"ISO \u0CA6\u0CBF\u0CA8\u0CBE\u0C82\u0C95",time:"ISO \u0CB8\u0CAE\u0CAF",duration:"ISO \u0C85\u0CB5\u0CA7\u0CBF",ipv4:"IPv4 \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8",ipv6:"IPv6 \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8",mac:"MAC \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8",cidrv4:"IPv4 \u0CB5\u0CCD\u0CAF\u0CBE\u0CAA\u0CCD\u0CA4\u0CBF\u0CAF",cidrv6:"IPv6 \u0CB5\u0CCD\u0CAF\u0CBE\u0CAA\u0CCD\u0CA4\u0CBF\u0CAF",base64:"base64-encoded\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",base64url:"base64url-encoded\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",json_string:"JSON\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",e164:"E.164 \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",credit_card:"\u0C95\u0CCD\u0CB0\u0CC6\u0CA1\u0CBF\u0C9F\u0CCD \u0C95\u0CBE\u0CB0\u0CCD\u0CA1\u0CCD \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",currency_code:"\u0C95\u0CB0\u0CC6\u0CA8\u0CCD\u0CB8\u0CBF \u0C95\u0CCB\u0CA1\u0CCD",iban:"IBAN",jwt:"JWT",template_literal:"\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${i}, \u0CB8\u0CCD\u0CB5\u0CC0\u0C95\u0CB0\u0CBF\u0CB8\u0CBF\u0CA6\u0CA8\u0CC1 ${s}`}case"invalid_value":return n.values.length===1?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${F(n.values[0])}`:`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C86\u0CAF\u0CCD\u0C95\u0CC6: \u0C87\u0CB5\u0CC1\u0C97\u0CB3\u0CB2\u0CCD\u0CB2\u0CBF \u0C92\u0C82\u0CA6\u0CA8\u0CCD\u0CA8\u0CC1 \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0CA6\u0CCA\u0CA1\u0CCD\u0CA1\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.origin??"value"} \u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1 ${i}${n.maximum.toString()} ${a.unit??"\u0C85\u0C82\u0CB6\u0C97\u0CB3\u0CC1"}`:`\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0CA6\u0CCA\u0CA1\u0CCD\u0CA1\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.origin??"value"} \u0C8E\u0C82\u0CA6\u0CC1 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0C9A\u0CBF\u0C95\u0CCD\u0C95\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.origin} \u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1 ${i}${n.minimum.toString()} ${a.unit}`:`\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0C9A\u0CBF\u0C95\u0CCD\u0C95\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.origin} \u0C8E\u0C82\u0CA6\u0CC1 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C87\u0CA6\u0CB0\u0CCA\u0C82\u0CA6\u0CBF\u0C97\u0CC6 \u0CAA\u0CCD\u0CB0\u0CBE\u0CB0\u0C82\u0CAD\u0CBF\u0CB8\u0CAC\u0CC7\u0C95\u0CC1 "${i.prefix}"`:i.format==="ends_with"?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C87\u0CA6\u0CB0\u0CCA\u0C82\u0CA6\u0CBF\u0C97\u0CC6 \u0C95\u0CCA\u0CA8\u0CC6\u0C97\u0CCA\u0CB3\u0CCD\u0CB3\u0CAC\u0CC7\u0C95\u0CC1 "${i.suffix}"`:i.format==="includes"?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C92\u0CB3\u0C97\u0CCA\u0C82\u0CA1\u0CBF\u0CB0\u0CAC\u0CC7\u0C95\u0CC1 "${i.includes}"`:i.format==="regex"?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0CAE\u0CBE\u0CA6\u0CB0\u0CBF\u0C97\u0CC6 \u0CB9\u0CCA\u0C82\u0CA6\u0CBF\u0C95\u0CC6\u0CAF\u0CBE\u0C97\u0CAC\u0CC7\u0C95\u0CC1 ${i.pattern}`:`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6: \u0CAC\u0CB9\u0CC1\u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6\u0CAF\u0CBE\u0C97\u0CBF\u0CB0\u0CAC\u0CC7\u0C95\u0CC1 ${n.divisor}`;case"unrecognized_keys":return`\u0C97\u0CC1\u0CB0\u0CC1\u0CA4\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CA6 \u0C95\u0CC0 ${n.keys.length>1?"s":""}: ${A(n.keys,", ")}`;case"invalid_key":return`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0C95\u0CC0 \u0C87\u0CA8\u0CCD ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CA4\u0CBE\u0CB0\u0CA4\u0CAE\u0CCD\u0CAF \u0CAE\u0CCC\u0CB2\u0CCD\u0CAF. \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.options.map(a=>`'${a}'`).join(" | ")}`:"\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD";case"invalid_element":return`\u0CB0\u0CB2\u0CCD\u0CB2\u0CBF \u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CAE\u0CCC\u0CB2\u0CCD\u0CAF ${n.origin}`;default:return"\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD"}}};function R$(){return{localeError:e4()}}var t4=()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"},map:{unit:"\uAC1C",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",mac:"MAC \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",credit_card:"\uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638",currency_code:"\uD1B5\uD654 \uCF54\uB4DC",iban:"IBAN",jwt:"JWT",template_literal:"\uC785\uB825"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${n.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${s}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${i}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${s}\uC785\uB2C8\uB2E4`}case"invalid_value":return n.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${F(n.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${A(n.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=n.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",a=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(n.origin),l=s?.unit??"\uC694\uC18C";return s?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()}${l} ${i}${a}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()} ${i}${a}`}case"too_small":{let i=n.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",a=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(n.origin),l=s?.unit??"\uC694\uC18C";return s?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()}${l} ${i}${a}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()} ${i}${a}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${r[i.format]??n.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${n.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${A(n.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${n.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${n.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function I$(){return{localeError:t4()}}var Ha=e=>e.charAt(0).toUpperCase()+e.slice(1);function T$(e){let t=Math.abs(e),r=t%10,o=t%100;return o>=11&&o<=19||r===0?"many":r===1?"one":"few"}var n4=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function t(n,i,a,s){let l=e[n]??null;return l===null?l:{unit:l.unit[i],verb:l.verb[s][a?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",mac:"MAC adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",credit_card:"kredito kortel\u0117s numeris",currency_code:"valiutos kodas",iban:"IBAN",jwt:"JWT",template_literal:"\u012Fvestis"},o={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Gautas tipas ${s}, o tik\u0117tasi - instanceof ${n.expected}`:`Gautas tipas ${s}, o tik\u0117tasi - ${i}`}case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${F(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${A(n.values,"|")} pasirinkim\u0173`;case"too_big":{let i=o[n.origin]??n.origin,a=t(n.origin,T$(Number(n.maximum)),n.inclusive??!1,"smaller");if(a?.verb)return`${Ha(i??n.origin??"reik\u0161m\u0117")} ${a.verb} ${n.maximum.toString()} ${a.unit??"element\u0173"}`;let s=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${Ha(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.maximum.toString()} ${a?.unit}`}case"too_small":{let i=o[n.origin]??n.origin,a=t(n.origin,T$(Number(n.minimum)),n.inclusive??!1,"bigger");if(a?.verb)return`${Ha(i??n.origin??"reik\u0161m\u0117")} ${a.verb} ${n.minimum.toString()} ${a.unit??"element\u0173"}`;let s=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${Ha(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${n.minimum.toString()} ${a?.unit}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${i.prefix}"`:i.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${i.suffix}"`:i.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${i.includes}"`:i.format==="regex"?`Eilut\u0117 privalo atitikti ${i.pattern}`:`Neteisingas ${r[i.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${A(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let i=o[n.origin]??n.origin;return`${Ha(i??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function P$(){return{localeError:n4()}}var r4=()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},map:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(n){return e[n]??null}let r={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",mac:"MAC \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",credit_card:"\u0431\u0440\u043E\u0458 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0438\u0447\u043A\u0430",currency_code:"\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},o={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${n.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${s}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${s}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${F(n.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${n.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${n.minimum.toString()} ${a.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${A(n.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${n.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${n.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function A$(){return{localeError:r4()}}var o4=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"},map:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}let r={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",mac:"alamat MAC",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",credit_card:"nombor kad kredit",currency_code:"kod mata wang",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"nombor"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${s}`:`Input tidak sah: dijangka ${i}, diterima ${s}`}case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${F(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Terlalu besar: dijangka ${n.origin??"nilai"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Terlalu kecil: dijangka ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${r[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${A(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function E$(){return{localeError:o4()}}var i4=()=>{let e={string:{unit:"\u0905\u0915\u094D\u0937\u0930",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"},file:{unit:"\u092C\u093E\u0907\u091F",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"},array:{unit:"\u0924\u0924\u094D\u0935",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"},set:{unit:"\u0924\u0924\u094D\u0935",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"},map:{unit:"\u092A\u094D\u0930\u0935\u093F\u0937\u094D\u091F\u093F",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"}};function t(n){return e[n]??null}let r={regex:"\u0907\u0928\u092A\u0941\u091F",email:"\u0907\u092E\u0947\u0932 \u0920\u0947\u0917\u093E\u0928\u093E",url:"URL",emoji:"\u0907\u092E\u094B\u091C\u0940",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u092E\u093F\u0924\u093F \u0930 \u0938\u092E\u092F",date:"ISO \u092E\u093F\u0924\u093F",time:"ISO \u0938\u092E\u092F",duration:"ISO \u0905\u0935\u0927\u093F",ipv4:"IPv4 \u0920\u0947\u0917\u093E\u0928\u093E",ipv6:"IPv6 \u0920\u0947\u0917\u093E\u0928\u093E",mac:"MAC \u0920\u0947\u0917\u093E\u0928\u093E",cidrv4:"IPv4 \u0926\u093E\u092F\u0930\u093E",cidrv6:"IPv6 \u0926\u093E\u092F\u0930\u093E",base64:"base64-\u0907\u0928\u094D\u0915\u094B\u0921 \u0917\u0930\u093F\u090F\u0915\u094B \u0938\u094D\u091F\u094D\u0930\u093F\u0919",base64url:"base64url-\u0907\u0928\u094D\u0915\u094B\u0921 \u0917\u0930\u093F\u090F\u0915\u094B \u0938\u094D\u091F\u094D\u0930\u093F\u0919",json_string:"JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0919",e164:"E.164 \u0928\u092E\u094D\u092C\u0930",credit_card:"\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0928\u092E\u094D\u092C\u0930",currency_code:"\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",iban:"IBAN",jwt:"JWT",template_literal:"\u0907\u0928\u092A\u0941\u091F"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return`\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${i}, \u092A\u094D\u0930\u093E\u092A\u094D\u0924 ${s}`}case"invalid_value":return n.values.length===1?`\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${F(n.values[0])}`:`\u0905\u092E\u093E\u0928\u094D\u092F \u0935\u093F\u0915\u0932\u094D\u092A: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u092E\u093E\u0928\u0939\u0930\u0942 \u092E\u0927\u094D\u092F\u0947 \u090F\u0915 ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0927\u0947\u0930\u0948 \u0920\u0942\u0932\u094B: ${n.origin??"\u092E\u093E\u0928"} \u092E\u093E ${i}${n.maximum.toString()} ${a.unit} ${a.verb}`:`\u0927\u0947\u0930\u0948 \u0920\u0942\u0932\u094B: ${n.origin??"\u092E\u093E\u0928"} ${i}${n.maximum.toString()} \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0927\u0947\u0930\u0948 \u0938\u093E\u0928\u094B: ${n.origin} \u092E\u093E ${i}${n.minimum.toString()} ${a.unit} ${a.verb}`:`\u0927\u0947\u0930\u0948 \u0938\u093E\u0928\u094B: ${n.origin} ${i}${n.minimum.toString()} \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${i.prefix}" \u092C\u093E\u091F \u0938\u0941\u0930\u0941 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`:i.format==="ends_with"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${i.suffix}" \u092E\u093E \u0938\u092E\u093E\u092A\u094D\u0924 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`:i.format==="includes"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${i.includes}" \u0938\u092E\u093E\u0935\u0947\u0936 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`:i.format==="regex"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: \u0922\u093E\u0901\u091A\u093E ${i.pattern} \u0938\u0901\u0917 \u092E\u0947\u0932 \u0916\u093E\u0928\u0941\u092A\u0930\u094D\u091B`:`\u0905\u092E\u093E\u0928\u094D\u092F ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u0902\u0916\u094D\u092F\u093E: ${n.divisor} \u0915\u094B \u0917\u0941\u0923\u091C \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`;case"unrecognized_keys":return`\u0905\u092A\u0930\u093F\u091A\u093F\u0924 \u0915\u0941\u091E\u094D\u091C\u0940${n.keys.length>1?"\u0939\u0930\u0942":""}: ${A(n.keys,", ")}`;case"invalid_key":return`\u0905\u092E\u093E\u0928\u094D\u092F \u0915\u0941\u091E\u094D\u091C\u0940: ${n.origin} \u092E\u093E`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0905\u092E\u093E\u0928\u094D\u092F \u0921\u093F\u0938\u094D\u0915\u094D\u0930\u093F\u092E\u093F\u0928\u0947\u091F\u0930 \u092E\u093E\u0928: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${n.options.map(a=>`'${a}'`).join(" | ")}`:"\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F";case"invalid_element":return`\u0905\u092E\u093E\u0928\u094D\u092F \u092E\u093E\u0928: ${n.origin} \u092E\u093E`;default:return"\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F"}}};function O$(){return{localeError:i4()}}var a4=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"},map:{unit:"elementen",verb:"heeft"}};function t(n){return e[n]??null}let r={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",mac:"MAC-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",credit_card:"creditcardnummer",currency_code:"valutacode",iban:"IBAN",jwt:"JWT",template_literal:"invoer"},o={nan:"NaN",number:"getal"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${s}`:`Ongeldige invoer: verwacht ${i}, ontving ${s}`}case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${F(n.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),s=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";return a?`Te ${s}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} ${a.unit??"elementen"} ${a.verb}`:`Te ${s}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),s=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";return a?`Te ${s}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} ${a.unit} ${a.verb}`:`Te ${s}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${r[i.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${A(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function M$(){return{localeError:a4()}}var s4=()=>{let e={string:{unit:"teikn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"element",verb:"\xE5 innehalde"},set:{unit:"element",verb:"\xE5 innehalde"},map:{unit:"element",verb:"\xE5 innehalde"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varigheit",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkoda streng",base64url:"base64url-enkoda streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kredittkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tal",array:"liste"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventa instanceof ${n.expected}, fekk ${s}`:`Ugyldig input: forventa ${i}, fekk ${s}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventa ${F(n.values[0])}`:`Ugyldig val: forventa eitt av ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`For stor(t): forventa ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()} ${a.unit??"element"}`:`For stor(t): forventa ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`For lite(n): forventa ${n.origin} til \xE5 ha ${i}${n.minimum.toString()} ${a.unit}`:`For lite(n): forventa ${n.origin} til \xE5 ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 slutte med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 innehalde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldig tal: m\xE5 vere eit multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjende n\xF8klar":"Ukjend n\xF8kkel"}: ${A(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function C$(){return{localeError:s4()}}var l4=()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"},map:{unit:"elementer",verb:"\xE5 inneholde"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kredittkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tall",array:"liste"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventet instanceof ${n.expected}, fikk ${s}`:`Ugyldig input: forventet ${i}, fikk ${s}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${F(n.values[0])}`:`Ugyldig valg: forventet en av ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${A(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function D$(){return{localeError:l4()}}var c4=()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"},map:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(n){return e[n]??null}let r={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",mac:"MAC ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",credit_card:"i'tib\xE2r kart\u0131 numaras\u0131",currency_code:"para birimi kodu",iban:"IBAN",jwt:"JWT",template_literal:"giren"},o={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`F\xE2sit giren: umulan instanceof ${n.expected}, al\u0131nan ${s}`:`F\xE2sit giren: umulan ${i}, al\u0131nan ${s}`}case"invalid_value":return n.values.length===1?`F\xE2sit giren: umulan ${F(n.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${a.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} ${a.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=n;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${r[i.format]??n.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${n.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${n.keys.length>1?"s":""}: ${A(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${n.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function j$(){return{localeError:c4()}}var u4=()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},map:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(n){return e[n]??null}let r={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",mac:"\u062F MAC \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",credit_card:"\u062F \u06A9\u0631\u06CC\u0689\u06CC\u067C \u06A9\u0627\u0631\u062A \u0634\u0645\u06CC\u0631\u0647",currency_code:"\u062F \u0627\u0633\u0639\u0627\u0631\u0648 \u06A9\u0648\u0689",iban:"IBAN",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${n.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${s} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${i} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${s} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return n.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${F(n.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${A(n.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0648\u064A`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${a.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${r[i.format]??n.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${n.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${n.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${A(n.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${n.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${n.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function N$(){return{localeError:u4()}}var d4=()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"},map:{unit:"element\xF3w",verb:"mie\u0107"}};function t(n){return e[n]??null}let r={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",mac:"adres MAC",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",credit_card:"numer karty kredytowej",currency_code:"kod waluty",iban:"IBAN",jwt:"JWT",template_literal:"wej\u015Bcie"},o={nan:"NaN",number:"liczba",array:"tablica"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${n.expected}, otrzymano ${s}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${i}, otrzymano ${s}`}case"invalid_value":return n.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${F(n.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.maximum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.minimum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${r[i.format]??n.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${A(n.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${n.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${n.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function F$(){return{localeError:d4()}}var m4=()=>{let e={string:{unit:"caracteres"},file:{unit:"bytes"},array:{unit:"elementos"},set:{unit:"elementos"},map:{unit:"entradas"}};function t(a){return e[a]??null}let r={regex:"a entrada",email:"o endere\xE7o de e-mail",url:"o URL",emoji:"o emoji",uuid:"o UUID",uuidv4:"o UUIDv4",uuidv6:"o UUIDv6",nanoid:"o nanoid",guid:"o GUID",cuid:"o cuid",cuid2:"o cuid2",ulid:"o ULID",xid:"o XID",ksuid:"o KSUID",datetime:"a data e hora ISO",date:"a data ISO",time:"a hora ISO",duration:"a dura\xE7\xE3o ISO",ipv4:"o endere\xE7o IPv4",ipv6:"o endere\xE7o IPv6",mac:"o endere\xE7o MAC",cidrv4:"o intervalo de endere\xE7os IPv4",cidrv6:"o intervalo de endere\xE7os IPv6",base64:"o texto codificado em base64",base64url:"o texto codificado em base64url",json_string:"o texto JSON",e164:"o n\xFAmero E.164",credit_card:"o n\xFAmero de cart\xE3o de cr\xE9dito",currency_code:"o c\xF3digo de moeda",iban:"o IBAN",jwt:"o JWT",template_literal:"a entrada"},o={masculine:{definite:"o",indefinite:"um"},feminine:{definite:"a",indefinite:"uma"}},n={string:{name:"texto",articles:o.masculine},number:{name:"n\xFAmero",articles:o.masculine},int:{name:"n\xFAmero inteiro",articles:o.masculine},boolean:{name:"valor booleano",articles:o.masculine},bigint:{name:"n\xFAmero bigint",articles:o.masculine},symbol:{name:"s\xEDmbolo",articles:o.masculine},undefined:{name:'valor "undefined"',articles:o.masculine},null:{name:'valor "nulo"',articles:o.masculine},never:{name:'valor "never"',articles:o.masculine},void:{name:'valor "void"',articles:o.masculine},date:{name:"data",articles:o.feminine},array:{name:"vetor",articles:o.masculine},object:{name:"objeto",articles:o.masculine},tuple:{name:"tuplo",articles:o.masculine},record:{name:"registo",articles:o.masculine},map:{name:"mapa",articles:o.masculine},set:{name:"conjunto",articles:o.masculine},file:{name:"ficheiro",articles:o.masculine},nonoptional:{name:"valor n\xE3o opcional",articles:o.masculine},nan:{name:'valor "NaN"',articles:o.masculine},function:{name:"fun\xE7\xE3o",articles:o.feminine}};function i(a,s){let l=n[a]??{name:`valor "${a}"`,articles:o.masculine};return`${l.articles[s]} ${l.name}`}return a=>{switch(a.code){case"invalid_type":{let s=i(a.expected,"indefinite"),l=U(a.input),c=i(l,"indefinite");return`Entrada inv\xE1lida: esperava ${s}, recebeu ${c}`}case"invalid_value":return a.values.length===1?`Entrada inv\xE1lida: esperava ${F(a.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperava uma das seguintes op\xE7\xF5es: ${A(a.values,"|")}`;case"too_big":{let s=a.inclusive?"<=":"<",l=t(a.origin);return l?`Demasiado grande: esperava que ${i(a.origin,"definite")} tivesse ${s} ${a.maximum.toString()} ${l.unit??"elementos"}`:`Demasiado grande: esperava que ${i(a.origin,"definite")} fosse ${s} ${a.maximum.toString()}`}case"too_small":{let s=a.inclusive?">=":">",l=t(a.origin);return l?`Demasiado pequeno: esperava que ${i(a.origin,"definite")} tivesse ${s} ${a.minimum.toString()} ${l.unit??"elementos"}`:`Demasiado pequeno: esperava que ${i(a.origin,"definite")} fosse ${s} ${a.minimum.toString()}`}case"invalid_format":{let s=a;return s.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar por "${s.prefix}"`:s.format==="ends_with"?`Texto inv\xE1lido: deve terminar em "${s.suffix}"`:s.format==="includes"?`Texto inv\xE1lido: deve incluir "${s.includes}"`:s.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${s.pattern}`:`Formato d${r[s.format]??a.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${a.divisor}`;case"unrecognized_keys":{let s=a.keys.length>1?"s":"";return`Chave${s} inv\xE1lida${s}: ${A(a.keys,", ")}`}case"invalid_key":return`Entrada inv\xE1lida n${i(a.origin,"definite")}`;case"invalid_union":return a.options&&Array.isArray(a.options)&&a.options.length>0?`Valor de discrimina\xE7\xE3o inv\xE1lido. Esperava ${a.options.map(l=>`'${l}'`).join(" | ")}`:"Entrada inv\xE1lida";case"invalid_element":return`Entrada inv\xE1lida n${i(a.origin,"definite")}`;default:return"Entrada inv\xE1lida"}}};function L$(){return{localeError:m4()}}var f4=()=>{let e={string:{unit:"caracteres"},file:{unit:"bytes"},array:{unit:"elementos"},set:{unit:"elementos"},map:{unit:"entradas"}};function t(a){return e[a]??null}let r={regex:"a entrada",email:"o endere\xE7o de e-mail",url:"o URL",emoji:"o emoji",uuid:"o UUID",uuidv4:"o UUIDv4",uuidv6:"o UUIDv6",nanoid:"o nanoid",guid:"o GUID",cuid:"o cuid",cuid2:"o cuid2",ulid:"o ULID",xid:"o XID",ksuid:"o KSUID",datetime:"a data e hora ISO",date:"a data ISO",time:"a hora ISO",duration:"a dura\xE7\xE3o ISO",ipv4:"o endere\xE7o IPv4",ipv6:"o endere\xE7o IPv6",mac:"o endere\xE7o MAC",cidrv4:"a faixa de endere\xE7os IPv4",cidrv6:"a faixa de endere\xE7os IPv6",base64:"o texto codificado em base64",base64url:"o texto codificado em base64url",json_string:"o texto JSON",e164:"o n\xFAmero E.164",credit_card:"o n\xFAmero de cart\xE3o de cr\xE9dito",currency_code:"o c\xF3digo de moeda",iban:"o IBAN",jwt:"o JWT",template_literal:"a entrada"},o={masculine:{definite:"o",indefinite:"um"},feminine:{definite:"a",indefinite:"uma"}},n={string:{name:"texto",articles:o.masculine},number:{name:"n\xFAmero",articles:o.masculine},int:{name:"n\xFAmero inteiro",articles:o.masculine},boolean:{name:"valor booleano",articles:o.masculine},bigint:{name:"n\xFAmero bigint",articles:o.masculine},symbol:{name:"s\xEDmbolo",articles:o.masculine},undefined:{name:'valor "undefined"',articles:o.masculine},null:{name:'valor "nulo"',articles:o.masculine},never:{name:'valor "never"',articles:o.masculine},void:{name:'valor "void"',articles:o.masculine},date:{name:"data",articles:o.feminine},array:{name:"vetor",articles:o.masculine},object:{name:"objeto",articles:o.masculine},tuple:{name:"tupla",articles:o.feminine},record:{name:"registro",articles:o.masculine},map:{name:"mapa",articles:o.masculine},set:{name:"conjunto",articles:o.masculine},file:{name:"arquivo",articles:o.masculine},nonoptional:{name:"valor n\xE3o opcional",articles:o.masculine},nan:{name:'valor "NaN"',articles:o.masculine},function:{name:"fun\xE7\xE3o",articles:o.feminine}};function i(a,s){let l=n[a]??{name:`valor "${a}"`,articles:o.masculine};return`${l.articles[s]} ${l.name}`}return a=>{switch(a.code){case"invalid_type":{let s=i(a.expected,"indefinite"),l=U(a.input),c=i(l,"indefinite");return`Entrada inv\xE1lida: esperava ${s}, recebeu ${c}`}case"invalid_value":return a.values.length===1?`Entrada inv\xE1lida: esperava ${F(a.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperava uma das seguintes op\xE7\xF5es: ${A(a.values,"|")}`;case"too_big":{let s=a.inclusive?"<=":"<",l=t(a.origin);return l?`Grande demais: esperava que ${i(a.origin,"definite")} tivesse ${s} ${a.maximum.toString()} ${l.unit??"elementos"}`:`Grande demais: esperava que ${i(a.origin,"definite")} fosse ${s} ${a.maximum.toString()}`}case"too_small":{let s=a.inclusive?">=":">",l=t(a.origin);return l?`Pequeno demais: esperava que ${i(a.origin,"definite")} tivesse ${s} ${a.minimum.toString()} ${l.unit??"elementos"}`:`Pequeno demais: esperava que ${i(a.origin,"definite")} fosse ${s} ${a.minimum.toString()}`}case"invalid_format":{let s=a;return s.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${s.prefix}"`:s.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${s.suffix}"`:s.format==="includes"?`Texto inv\xE1lido: deve incluir "${s.includes}"`:s.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${s.pattern}`:`Formato d${r[s.format]??a.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${a.divisor}`;case"unrecognized_keys":{let s=a.keys.length>1?"s":"";return`Chave${s} inv\xE1lida${s}: ${A(a.keys,", ")}`}case"invalid_key":return`Entrada inv\xE1lida n${i(a.origin,"definite")}`;case"invalid_union":return a.options&&Array.isArray(a.options)&&a.options.length>0?`Valor de discrimina\xE7\xE3o inv\xE1lido. Esperava ${a.options.map(l=>`'${l}'`).join(" | ")}`:"Entrada inv\xE1lida";case"invalid_element":return`Entrada inv\xE1lida n${i(a.origin,"definite")}`;default:return"Entrada inv\xE1lida"}}};function z$(){return{localeError:f4()}}var p4=()=>{let e={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function t(n){return e[n]??null}let r={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",credit_card:"num\u0103r de card de credit",currency_code:"cod valutar",iban:"IBAN",jwt:"JWT",template_literal:"intrare"},o={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return`Intrare invalid\u0103: a\u0219teptat ${i}, primit ${s}`}case"invalid_value":return n.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${F(n.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} s\u0103 fie ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Prea mic: a\u0219teptat ca ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Prea mic: a\u0219teptat ca ${n.origin} s\u0103 fie ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${i.prefix}"`:i.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${i.suffix}"`:i.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${i.includes}"`:i.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${i.pattern}`:`Format invalid: ${r[i.format]??n.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${n.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${A(n.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${n.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${n.origin}`;default:return"Intrare invalid\u0103"}}};function U$(){return{localeError:p4()}}function B$(e,t,r,o){let n=Math.abs(e),i=n%10,a=n%100;return a>=11&&a<=19?o:i===1?t:i>=2&&i<=4?r:o}var h4=()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},map:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",mac:"MAC \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",credit_card:"\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u044B",currency_code:"\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${s}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${s}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${F(n.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a){let s=Number(n.maximum),l=B$(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${n.maximum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a){let s=Number(n.minimum),l=B$(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${n.minimum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${n.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0438":""}: ${A(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function V$(){return{localeError:h4()}}var g4=()=>{let e={string:{unit:"znakov",verb:"ma\u0165"},file:{unit:"bajtov",verb:"ma\u0165"},array:{unit:"prvkov",verb:"ma\u0165"},set:{unit:"prvkov",verb:"ma\u0165"},map:{unit:"polo\u017Eiek",verb:"ma\u0165"}};function t(n){return e[n]??null}let r={regex:"regul\xE1rny v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"d\xE1tum a \u010Das vo form\xE1te ISO",date:"d\xE1tum vo form\xE1te ISO",time:"\u010Das vo form\xE1te ISO",duration:"doba trvania ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"re\u0165azec zak\xF3dovan\xFD vo form\xE1te base64",base64url:"re\u0165azec zak\xF3dovan\xFD vo form\xE1te base64url",json_string:"re\u0165azec vo form\xE1te JSON",e164:"\u010D\xEDslo E.164",credit_card:"\u010D\xEDslo kreditnej karty",currency_code:"k\xF3d meny",iban:"IBAN",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"\u010D\xEDslo",string:"re\u0165azec",function:"funkcia",array:"pole"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 instanceof ${n.expected}, obdr\u017Ean\xE9 ${s}`:`Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 ${i}, obdr\u017Ean\xE9 ${s}`}case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 ${F(n.values[0])}`:`Neplatn\xFD vstup: o\u010Dak\xE1van\xE1 jedna z hodn\xF4t ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Hodnota je pr\xEDli\u0161 ve\u013Ek\xE1: ${n.origin??"hodnota"} mus\xED ma\u0165 ${i}${n.maximum.toString()} ${a.unit??"prvkov"}`:`Hodnota je pr\xEDli\u0161 ve\u013Ek\xE1: ${n.origin??"hodnota"} mus\xED by\u0165 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Hodnota je pr\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED ma\u0165 ${i}${n.minimum.toString()} ${a.unit??"prvkov"}`:`Hodnota je pr\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED by\u0165 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neplatn\xFD re\u0165azec: mus\xED za\u010D\xEDna\u0165 na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD re\u0165azec: mus\xED kon\u010Di\u0165 na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD re\u0165azec: mus\xED obsahova\u0165 "${i.includes}"`:i.format==="regex"?`Neplatn\xFD re\u0165azec: mus\xED zodpoveda\u0165 vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${r[i.format]??n.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED by\u0165 n\xE1sobkom ${n.divisor}`;case"unrecognized_keys":return`Nezn\xE1me kl\xFA\u010De: ${A(n.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xFA\u010D v ${n.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${n.origin}`;default:return"Neplatn\xFD vstup"}}};function Z$(){return{localeError:g4()}}var b4=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"},map:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}let r={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",mac:"MAC naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",credit_card:"\u0161tevilka kreditne kartice",currency_code:"koda valute",iban:"IBAN",jwt:"JWT",template_literal:"vnos"},o={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${n.expected}, prejeto ${s}`:`Neveljaven vnos: pri\u010Dakovano ${i}, prejeto ${s}`}case"invalid_value":return n.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${F(n.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Premajhno: pri\u010Dakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${a.unit}`:`Premajhno: pri\u010Dakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${r[i.format]??n.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${A(n.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function G$(){return{localeError:b4()}}var y4=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"},map:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(n){return e[n]??null}let r={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-adress",ipv6:"IPv6-adress",mac:"MAC-adress",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",credit_card:"kreditkortsnummer",currency_code:"valutakod",iban:"IBAN",jwt:"JWT",template_literal:"mall-literal"},o={nan:"NaN",number:"antal",array:"lista"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${n.expected}, fick ${s}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${i}, fick ${s}`}case"invalid_value":return n.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${F(n.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`F\xF6r stor(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()} ${a.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()} ${a.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${r[i.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${A(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${n.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function H$(){return{localeError:y4()}}var _4=()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},map:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(n){return e[n]??null}let r={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",mac:"MAC \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",credit_card:"\u0B95\u0B9F\u0BA9\u0BCD \u0B85\u0B9F\u0BCD\u0B9F\u0BC8 \u0B8E\u0BA3\u0BCD",currency_code:"\u0BA8\u0BBE\u0BA3\u0BAF\u0B95\u0BCD \u0B95\u0BC1\u0BB1\u0BBF\u0BAF\u0BC0\u0B9F\u0BC1",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${n.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}`}case"invalid_value":return n.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${F(n.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${A(n.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${n.maximum.toString()} ${a.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${n.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${i}${n.minimum.toString()} ${a.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${i}${n.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${n.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${n.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${A(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function W$(){return{localeError:_4()}}var v4=()=>{let e={string:{unit:"\u0430\u043B\u043E\u043C\u0430\u0442",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"},file:{unit:"\u0431\u0430\u0439\u0442",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"},array:{unit:"\u0443\u043D\u0441\u0443\u0440",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"},set:{unit:"\u0443\u043D\u0441\u0443\u0440",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"},map:{unit:"\u0441\u0430\u0431\u0442",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0443\u0440\u0443\u0434",email:"\u0441\u0443\u0440\u043E\u0493\u0430\u0438 email",url:"URL",emoji:"\u044D\u043C\u043E\u04B7\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0441\u0430\u043D\u0430\u0432\u0443 \u0432\u0430\u049B\u0442\u0438 ISO",date:"\u0441\u0430\u043D\u0430\u0438 ISO",time:"\u0432\u0430\u049B\u0442\u0438 ISO",duration:"\u0434\u0430\u0432\u043E\u043C\u043D\u043E\u043A\u0438\u0438 ISO",ipv4:"\u0441\u0443\u0440\u043E\u0493\u0430\u0438 IPv4",ipv6:"\u0441\u0443\u0440\u043E\u0493\u0430\u0438 IPv6",mac:"\u0441\u0443\u0440\u043E\u0493\u0430\u0438 MAC",cidrv4:"\u043C\u0430\u04B3\u0434\u0443\u0434\u0430\u0438 IPv4",cidrv6:"\u043C\u0430\u04B3\u0434\u0443\u0434\u0430\u0438 IPv6",base64:"\u0441\u0430\u0442\u0440\u0438 \u0434\u0430\u0440 \u0444\u043E\u0440\u043C\u0430\u0442\u0438 base64",base64url:"\u0441\u0430\u0442\u0440\u0438 \u0434\u0430\u0440 \u0444\u043E\u0440\u043C\u0430\u0442\u0438 base64url",json_string:"\u0441\u0430\u0442\u0440\u0438 JSON",e164:"\u0440\u0430\u049B\u0430\u043C\u0438 E.164",credit_card:"\u0440\u0430\u049B\u0430\u043C\u0438 \u043A\u043E\u0440\u0442\u0438 \u043A\u0440\u0435\u0434\u0438\u0442\u04E3",currency_code:"\u0440\u0430\u043C\u0437\u0438 \u0430\u0441\u044A\u043E\u0440",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u0443\u0440\u0443\u0434"},o={nan:"NaN",number:"\u0440\u0430\u049B\u0430\u043C",string:"\u0441\u0430\u0442\u0440",array:"\u043C\u0430\u0441\u0441\u0438\u0432",object:"\u043E\u0431\u044A\u0435\u043A\u0442",date:"\u0441\u0430\u043D\u0430"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return`\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: ${i} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442, ${s} \u0433\u0438\u0440\u0438\u0444\u0442\u0430 \u0448\u0443\u0434`}case"invalid_value":return n.values.length===1?`\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: ${F(n.values[0])} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`:`\u0418\u043D\u0442\u0438\u0445\u043E\u0431\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u044F\u043A\u0435 \u0430\u0437 ${A(n.values,"|")} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0425\u0435\u043B\u0435 \u043A\u0430\u043B\u043E\u043D: ${n.origin??"\u049B\u0438\u043C\u0430\u0442"} \u0431\u043E\u044F\u0434 ${i}${n.maximum.toString()} ${a.unit} ${a.verb}`:`\u0425\u0435\u043B\u0435 \u043A\u0430\u043B\u043E\u043D: ${n.origin??"\u049B\u0438\u043C\u0430\u0442"} \u0431\u043E\u044F\u0434 ${i}${n.maximum.toString()} \u0431\u043E\u0448\u0430\u0434`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0425\u0435\u043B\u0435 \u0445\u0443\u0440\u0434: ${n.origin} \u0431\u043E\u044F\u0434 ${i}${n.minimum.toString()} ${a.unit} ${a.verb}`:`\u0425\u0435\u043B\u0435 \u0445\u0443\u0440\u0434: ${n.origin} \u0431\u043E\u044F\u0434 ${i}${n.minimum.toString()} \u0431\u043E\u0448\u0430\u0434`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u043E "${i.prefix}" \u043E\u0493\u043E\u0437 \u0448\u0430\u0432\u0430\u0434`:i.format==="ends_with"?`\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u043E "${i.suffix}" \u0430\u043D\u04B7\u043E\u043C \u0451\u0431\u0430\u0434`:i.format==="includes"?`\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 "${i.includes}"-\u0440\u043E \u0434\u0430\u0440 \u0431\u0430\u0440 \u0433\u0438\u0440\u0430\u0434`:i.format==="regex"?`\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u0430 \u043D\u0430\u043C\u0443\u043D\u0430\u0438 ${i.pattern} \u043C\u0443\u0432\u043E\u0444\u0438\u049B\u0430\u0442 \u043A\u0443\u043D\u0430\u0434`:`${r[i.format]??n.format}-\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442`}case"not_multiple_of":return`\u0420\u0430\u049B\u0430\u043C\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u0430 ${n.divisor} \u0431\u0435 \u0431\u0430\u049B\u0438\u044F \u0442\u0430\u049B\u0441\u0438\u043C \u0448\u0430\u0432\u0430\u0434`;case"unrecognized_keys":return`\u041A\u0430\u043B\u0438\u0434${n.keys.length>1?"\u04B3\u043E\u0438":"\u0438"} \u043D\u043E\u043C\u0430\u044A\u043B\u0443\u043C: ${A(n.keys,", ")}`;case"invalid_key":return`\u041A\u0430\u043B\u0438\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442 \u0434\u0430\u0440 ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u049A\u0438\u043C\u0430\u0442\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442\u0438 \u0434\u0438\u0441\u043A\u0440\u0438\u043C\u0438\u043D\u0430\u0442\u043E\u0440: ${n.options.map(a=>`'${a}'`).join(" | ")} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`:"\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442";case"invalid_element":return`\u049A\u0438\u043C\u0430\u0442\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442 \u0434\u0430\u0440 ${n.origin}`;default:return"\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442"}}};function J$(){return{localeError:v4()}}var w4=()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},map:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(n){return e[n]??null}let r={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",mac:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 MAC",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",credit_card:"\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E40\u0E04\u0E23\u0E14\u0E34\u0E15",currency_code:"\u0E23\u0E2B\u0E31\u0E2A\u0E2A\u0E01\u0E38\u0E25\u0E40\u0E07\u0E34\u0E19",iban:"IBAN",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},o={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${n.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${s}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${i} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${s}`}case"invalid_value":return n.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${F(n.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",a=t(n.origin);return a?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()} ${a.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",a=t(n.origin);return a?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()} ${a.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${n.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${A(n.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function K$(){return{localeError:w4()}}var k4=()=>{let e={string:{unit:"simwol",verb:"bolmaly"},file:{unit:"ba\xFDt",verb:"bolmaly"},array:{unit:"elementler",verb:"bolmaly"},set:{unit:"elementler",verb:"bolmaly"},map:{unit:"elementler",verb:"bolmaly"}};function t(n){return e[n]??null}let r={regex:"giri\u015F",email:"e-po\xE7ta salgysy",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sene we wagt",date:"ISO sene",time:"ISO wagt",duration:"ISO wagt aralygy",ipv4:"IPv4 salgysy",ipv6:"IPv6 salgysy",mac:"MAC salgysy",cidrv4:"IPv4 aralygy",cidrv6:"IPv6 aralygy",base64:"base64 bilen \u015Fifrlenen setir",base64url:"base64url bilen \u015Fifrlenen setir",json_string:"JSON setiri",e164:"E.164 nomeri",credit_card:"kredit kartyny\u0148 nomeri",currency_code:"wal\xFDuta kody",iban:"IBAN",jwt:"JWT",template_literal:"\u015Fablon"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return`N\xE4dogry baha: gara\u015Fylan ${i} \xFDerine ${s} alyndy`}case"invalid_value":return n.values.length===1?`N\xE4dogry baha: ${F(n.values[0])} bolmaly`:`N\xE4dogry sa\xFDlaw: a\u015Fakdakylardan biri bolmaly: ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Has uly: gara\u015Fyl\xFDan ${n.origin??"baha"} ${i} ${n.maximum.toString()} ${a.unit??"element"}`:`Has uly: gara\u015Fyl\xFDan ${n.origin??"baha"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Has ki\xE7i: gara\u015Fyl\xFDan ${n.origin} ${i} ${n.minimum.toString()} ${a.unit}`:`Has ki\xE7i: gara\u015Fyl\xFDan ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`N\xE4dogry setir: "${i.prefix}" bilen ba\u015Flamaly`:i.format==="ends_with"?`N\xE4dogry setir: "${i.suffix}" bilen gutarmaly`:i.format==="includes"?`N\xE4dogry setir: "${i.includes}" saklamaly`:i.format==="regex"?`N\xE4dogry setir: ${i.pattern} nusga la\xFDyk bolmaly`:`N\xE4dogry ${r[i.format]??n.format}`}case"not_multiple_of":return`N\xE4dogry san: ${n.divisor} bilen galyndysyz b\xF6l\xFCnmeli`;case"unrecognized_keys":return`Tanalma\xFDan a\xE7ar${n.keys.length>1?"lar":""}: ${A(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde n\xE4dogry a\xE7ar`;case"invalid_union":return"N\xE4dogry baha";case"invalid_element":return`${n.origin} i\xE7inde n\xE4dogry baha`;default:return"N\xE4dogry baha"}}};function q$(){return{localeError:k4()}}var $4=()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},map:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(n){return e[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",mac:"MAC adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",credit_card:"kredi kart\u0131 numaras\u0131",currency_code:"para birimi kodu",iban:"IBAN",jwt:"JWT",template_literal:"\u015Eablon dizesi"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${n.expected}, al\u0131nan ${s}`:`Ge\xE7ersiz de\u011Fer: beklenen ${i}, al\u0131nan ${s}`}case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${F(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()} ${a.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ge\xE7ersiz metin: "${i.prefix}" ile ba\u015Flamal\u0131`:i.format==="ends_with"?`Ge\xE7ersiz metin: "${i.suffix}" ile bitmeli`:i.format==="includes"?`Ge\xE7ersiz metin: "${i.includes}" i\xE7ermeli`:i.format==="regex"?`Ge\xE7ersiz metin: ${i.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[i.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${A(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function X$(){return{localeError:$4()}}var x4=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},map:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",mac:"\u0430\u0434\u0440\u0435\u0441\u0430 MAC",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",credit_card:"\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0457 \u043A\u0430\u0440\u0442\u043A\u0438",currency_code:"\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u0438",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${n.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${s}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${i}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${s}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${F(n.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} \u0431\u0443\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0456":""}: ${A(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${n.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function Pc(){return{localeError:x4()}}function Y$(){return Pc()}var S4=()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},map:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(n){return e[n]??null}let r={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",mac:"\u0627\u06CC\u0645 \u0627\u06D2 \u0633\u06CC \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",credit_card:"\u06A9\u0631\u06CC\u0688\u0679 \u06A9\u0627\u0631\u0688 \u0646\u0645\u0628\u0631",currency_code:"\u06A9\u0631\u0646\u0633\u06CC \u06A9\u0648\u0688",iban:"IBAN",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},o={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${n.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${s} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${i} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${s} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return n.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${F(n.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${A(n.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${n.maximum.toString()} ${a.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${n.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u06D2 ${i}${n.minimum.toString()} ${a.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u0627 ${i}${n.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${n.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${n.keys.length>1?"\u0632":""}: ${A(n.keys,"\u060C ")}`;case"invalid_key":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function Q$(){return{localeError:S4()}}var R4=()=>{let e={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function t(n){return e[n]??null}let r={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",credit_card:"kredit karta raqami",currency_code:"valyuta kodi",iban:"IBAN",jwt:"JWT",template_literal:"kirish"},o={nan:"NaN",number:"raqam",array:"massiv"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${s}`:`Noto\u2018g\u2018ri kirish: kutilgan ${i}, qabul qilingan ${s}`}case"invalid_value":return n.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${F(n.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()} ${a.unit} ${a.verb}`:`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()} ${a.unit} ${a.verb}`:`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${i.prefix}" bilan boshlanishi kerak`:i.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${i.suffix}" bilan tugashi kerak`:i.format==="includes"?`Noto\u2018g\u2018ri satr: "${i.includes}" ni o\u2018z ichiga olishi kerak`:i.format==="regex"?`Noto\u2018g\u2018ri satr: ${i.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${r[i.format]??n.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${n.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${n.keys.length>1?"lar":""}: ${A(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${n.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function ex(){return{localeError:R4()}}var I4=()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},map:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(n){return e[n]??null}let r={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",mac:"\u0111\u1ECBa ch\u1EC9 MAC",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",credit_card:"s\u1ED1 th\u1EBB t\xEDn d\u1EE5ng",currency_code:"m\xE3 ti\u1EC1n t\u1EC7",iban:"IBAN",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},o={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${n.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${s}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${i}, nh\u1EADn \u0111\u01B0\u1EE3c ${s}`}case"invalid_value":return n.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${F(n.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${r[i.format]??n.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${n.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${A(n.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function tx(){return{localeError:I4()}}var T4=()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"},map:{unit:"\u9879",verb:"\u5305\u542B"}};function t(n){return e[n]??null}let r={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",mac:"MAC\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",credit_card:"\u4FE1\u7528\u5361\u53F7",currency_code:"\u8D27\u5E01\u4EE3\u7801",iban:"IBAN",jwt:"JWT",template_literal:"\u8F93\u5165"},o={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${n.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${s}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${i}\uFF0C\u5B9E\u9645\u63A5\u6536 ${s}`}case"invalid_value":return n.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${F(n.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()} ${a.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${r[i.format]??n.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${n.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${A(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${n.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function nx(){return{localeError:T4()}}var P4=()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},map:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(n){return e[n]??null}let r={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",mac:"MAC \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",credit_card:"\u4FE1\u7528\u5361\u865F",currency_code:"\u8CA8\u5E63\u4EE3\u78BC",iban:"IBAN",jwt:"JWT",template_literal:"\u8F38\u5165"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${n.expected}\uFF0C\u4F46\u6536\u5230 ${s}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${i}\uFF0C\u4F46\u6536\u5230 ${s}`}case"invalid_value":return n.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${F(n.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()} ${a.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()} ${a.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${n.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${n.keys.length>1?"\u5011":""}\uFF1A${A(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function rx(){return{localeError:P4()}}var A4=()=>{let e={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"},map:{unit:"nkan",verb:"n\xED"}};function t(n){return e[n]??null}let r={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",mac:"\xE0d\xEDr\u1EB9\u0301s\xEC MAC",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",credit_card:"n\u1ECDmba kaadi gbese",currency_code:"koodu ow\xF3",iban:"IBAN",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},o={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=U(n.input),s=o[a]??a;return/^[A-Z]/.test(n.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${n.expected}, \xE0m\u1ECD\u0300 a r\xED ${s}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${i}, \xE0m\u1ECD\u0300 a r\xED ${s}`}case"invalid_value":return n.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${F(n.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${A(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);return a?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin??"iye"} ${a.verb} ${i}${n.maximum} ${a.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.maximum}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);return a?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin} ${a.verb} ${i}${n.minimum} ${a.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.minimum}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`:i.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`:i.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`:i.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`:`A\u1E63\xEC\u1E63e: ${r[i.format]??n.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${n.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${A(n.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function ox(){return{localeError:A4()}}var ix,xh=Symbol("ZodOutput"),Sh=Symbol("ZodInput"),Ac=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Ec(){return new Ac}(ix=globalThis).__zod_globalRegistry??(ix.__zod_globalRegistry=Ec());var bt=globalThis.__zod_globalRegistry;var Et=Symbol.for("zod.compile.invalid"),ax=Symbol.for("zod.compile.fallback"),un=class extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},Se=class extends Error{constructor(t,r=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=r}};function O4(e,t){try{return Mc(e,{assertOnly:!0})}catch{return t}}function Ph(e,t){try{let r=Mc(e),o=Oc(e,r);return o._zod.bag.validator=O4(e,r),o}catch(r){if(t?.strict)throw r;return e}}function Oc(e,t){if(Sc(e))throw new Se("a schema whose subtree contains a reference cycle");let r=Oe(e),o=e._zod.run,n=o.__originalRun??o,i=(a,s)=>{if(s?.async||s?.direction==="backward"||s?.skipChecks||s?.[ax]||s&&Rc(s,a.value))return n(a,s);let l=t(a.value);return l!==Et?(a.value=l,a):(s&&(s[ax]=!0),n(a,s))};return i.__originalRun=n,r._zod.bag.fallbackRun=n,r._zod.bag.validator=t,r._zod.run=i,o.__originalRun||M4(r,e,t),r}function M4(e,t,r){let o=e,n=t;if(typeof n.safeParse=="function"){let i=n.safeParse;o.safeParse=(a,s)=>{let l=r(a);return l!==Et?{success:!0,data:l}:i(a,s)}}if(typeof n.parse=="function"){let i=n.parse;o.parse=(a,s)=>{let l=r(a);return l!==Et?l:i(a,s)}}}function Mc(e,t){let r=!0;try{r=Sc(e)}catch{}if(r)throw new Se("a schema whose subtree contains a reference cycle");let o={constants:new Map,constantCounter:0,varCounter:0,definite:!0},n=new Zr(["input"]),i=He(n,o,e,"input",!t?.assertOnly);n.write(i===null?"return true;":`return ${i};`);let a=["INVALID",...o.constants.keys()],s=[Et,...o.constants.values()],l=n.content.join(`
|
|
59
|
+
`),c=t?.debug?a.length>0?`// Constants: ${a.join(", ")}
|
|
60
|
+
${l}`:l:"",u=Function,d=`return (input) => {
|
|
61
|
+
${l}
|
|
62
|
+
}`,f;try{f=new u(...a,d)(...s)}catch(m){throw new Se(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(f.code=c),f.definite=o.definite,f}function ue(e,t){for(let[o,n]of e.constants)if(n===t)return o;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}function Jr(e,t){return e.definite=!1,ue(e,t)}function le(e){return`v${e.varCounter++}`}function C4(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return Et;let o=r;return o.issues.length===0?o.value:Et}function kt(e,t,r,o,n=!0){let i=e.content.length,a=t.constants.size,s=t.constantCounter,l=t.varCounter;try{return He(e,t,r,o,n)}catch(c){if(!(c instanceof Se)||!c.islandable)throw c;if(e.content.length=i,t.constants.size>a){let u=Array.from(t.constants.keys()).slice(a);for(let d of u)t.constants.delete(d)}return t.constantCounter=s,t.varCounter=l,D4(e,t,r,o)}}function D4(e,t,r,o){t.definite=!1;let n=ue(t,r),i=ue(t,C4),a=le(t);return e.write(`const ${a} = ${i}(${n}, ${o});`),e.write(`if (${a} === INVALID) return INVALID;`),a}var j4=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function N4(e,t,r,o){let n=r._zod.def.checks;if(!n||n.length===0)return o;let i=o;for(let a of n){let s=a._zod.def;if(s.when&&!j4.has(s.check))throw new Se('check with a custom "when" condition');switch(s.check){case"greater_than":F4(e,t,s,i);break;case"less_than":L4(e,t,s,i);break;case"multiple_of":z4(e,t,s,i);break;case"number_format":mx(e,s,i);break;case"min_length":{let l=Hr(s.minimum,"min_length"),c=Rh(e,t,i,`${i}.length >= ${l} && ${i}.length < ${s.minimum*2}`);e.write(`if (${c} < ${l}) return INVALID;`);break}case"max_length":{let l=Hr(s.maximum,"max_length"),c=Rh(e,t,i,`${i}.length > ${l}`);e.write(`if (${c} > ${l}) return INVALID;`);break}case"length_equals":{let l=Hr(s.length,"length_equals"),c=Rh(e,t,i,`${i}.length >= ${l} && ${i}.length <= ${s.length*2}`);e.write(`if (${c} !== ${l}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${Hr(s.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${Hr(s.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${Hr(s.size,"size_equals")}) return INVALID;`);break;case"string_format":i=fx(e,t,s,i);break;case"custom":i=H4(e,t,a,i);break;case"bigint_format":U4(e,s,i);break;case"mime_type":B4(e,t,s,i);break;case"property":Z4(e,t,s,i);break;case"properties":V4(e,t,s,i);break;case"overwrite":{let l=le(t);G4(e,t,a,i,l),i=l;break}default:throw new Se(`check type ${s.check}`)}}return i}function Rh(e,t,r,o){let n=ue(t,Br),i=le(t);return e.write(`const ${i} = typeof ${r} === "string" && ${o} ? ${n}(${r}) : ${r}.length;`),i}function Hr(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new Se(`${t} bound of type ${typeof e}`);return`${e}`}function dx(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new Se("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new Se("comparison check with Invalid Date bound");return ue(e,t)}throw new Se(`comparison check bound of type ${typeof t}`)}function F4(e,t,r,o){let n=r.inclusive?"<":"<=";e.write(`if (${o} ${n} ${dx(t,r.value)}) return INVALID;`)}function L4(e,t,r,o){let n=r.inclusive?">":">=";e.write(`if (${o} ${n} ${dx(t,r.value)}) return INVALID;`)}function z4(e,t,r,o){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new Se("multiple_of check with a zero divisor");e.write(`if (${o} % ${r.value}n !== 0n) return INVALID;`)}else{let n=ue(t,ya);e.write(`if (${n}(${o}, ${Hr(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function mx(e,t,r){let o=t.format;switch(o){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new Se(`number format ${o}`)}}function U4(e,t,r){let o=t.format;if(o)switch(o){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new Se(`bigint format ${o}`)}}function B4(e,t,r,o){let n=r.mime;if(n&&n.length>0){let i=ue(t,new Set(n));e.write(`if (!${i}.has(${o}.type)) return INVALID;`)}}function V4(e,t,r,o){if(r.when)throw new Se('check with a custom "when" condition');e.write(`if (${o} == null) return INVALID;`);let n=r.shape;for(let i of Reflect.ownKeys(n)){let a=typeof i=="symbol"?ue(t,i):Pt(i),s=le(t);e.write(`const ${s} = ${o}[${a}];`),kt(e,t,n[i],s,!1)}}function Z4(e,t,r,o){let n=`${o}[${JSON.stringify(r.property)}]`;He(e,t,r.schema,n)}function G4(e,t,r,o,n){let i=r._zod.def.tx;if(!i)throw new Se("overwrite check without a transform function");if(Kr(i))throw new un("z.compile: async overwrite transforms are not supported");let a=ue(t,i);e.write(`const ${n} = ${a}(${o});`)}function Ih(){throw new zt}function Ah(e){this.issues.push(e)}function H4(e,t,r,o){let n=r._zod.def;if(n.fn){if(Kr(n.fn))throw new un("z.compile: async .refine() predicates are not supported");let i=Jr(t,n.fn),a=ue(t,Ih),s=le(t);return e.write(`const ${s} = ${i}(${o});`),e.write(`if (${s} instanceof Promise) ${a}();`),e.write(`if (!${s}) return INVALID;`),o}if(r._zod.check){if(Kr(r._zod.check))throw new un("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,s=Jr(t,c=>{let u={value:c,issues:[],addIssue:Ah};return i(u)instanceof Promise&&Ih(),u.issues.length===0?u.value:Et}),l=le(t);return e.write(`const ${l} = ${s}(${o});`),e.write(`if (${l} === INVALID) return INVALID;`),l}throw new Se("custom check without a predicate or check function")}var W4=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function fx(e,t,r,o,n=!0){let i=r.format;if(i==="base64"){let c=ue(t,Na);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(i==="base64url"){let c=ue(t,mc);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(i==="jwt"){let c=ue(t,hc),u=ue(t,r.alg??null);return e.write(`if (!${c}(${o}, ${u})) return INVALID;`),o}if(i==="ipv6"){let c=ue(t,ja);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(i==="cidrv6"){let c=ue(t,uc);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(i==="credit_card"){let c=ue(t,fc);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(i==="iban"){let c=ue(t,pc);return e.write(`if (!${c}(${o})) return INVALID;`),o}let a=r;if(i==="url"||i==="httpurl"||a.normalize||a.hostname!==void 0||a.protocol!==void 0){let c=ue(t,sc),u=ue(t,r),d=le(t),f=le(t);if(e.write(`const ${d} = ${o}.trim();`),e.write(`const ${f} = ${c}(${d}, ${u});`),e.write(`if (typeof ${f} === "number") return INVALID;`),a.hostname!==void 0){let g=ue(t,lc);e.write(`if (!${g}(${f}, ${u}.hostname)) return INVALID;`)}if(a.protocol!==void 0){let g=ue(t,cc);e.write(`if (!${g}(${f}, ${u}.protocol)) return INVALID;`)}if(!n)return null;let m=le(t),p=a.normalize?`${f}.href`:`${ue(t,Da)}(${d})`;return e.write(`const ${m} = ${p};`),m}let s=r.fn;if(s){if(Kr(s))throw new Se(`async string format ${i}`);let c=ue(t,s);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(W4.has(i)&&r.pattern){let c=ue(t,r.pattern);return e.write(`${c}.lastIndex = 0;`),e.write(`if (!${c}.test(${o})) return INVALID;`),o}let l=r.format;switch(l){case"regex":throw new Se("regex format without a pattern");case"lowercase":e.write(`if (${o} !== ${o}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${o} !== ${o}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${o}.includes(${Pt(r.includes)})) return INVALID;`);break;case"starts_with":{let c=r.prefix;e.write(`if (${o}.slice(0, ${c.length}) !== ${Pt(c)}) return INVALID;`);break}case"ends_with":{let c=r.suffix;e.write(`if (${o}.slice(-${c.length}) !== ${Pt(c)}) return INVALID;`);break}default:throw new Se(`string format ${l}`)}return o}function He(e,t,r,o,n=!0){let i=r._zod.def,a=i.type;if(i.coerce)throw new Se(`coercion (z.coerce.${a}())`);let s=n||!!i.checks?.length,l;switch(a){case"string":l=J4(e,t,r,o,s);break;case"number":l=K4(e,r,o);break;case"boolean":l=q4(e,o);break;case"bigint":l=X4(e,r,o);break;case"symbol":l=Y4(e,o);break;case"undefined":l=Q4(e,o);break;case"null":l=eD(e,o);break;case"any":case"unknown":l=o;break;case"never":e.write("return INVALID;"),l=o;break;case"void":l=tD(e,o);break;case"nan":l=nD(e,o);break;case"date":l=rD(e,o);break;case"object":l=oD(e,t,r,o,s);break;case"optional":l=iD(e,t,r,o,s);break;case"nullable":l=lD(e,t,r,o,s);break;case"array":l=cD(e,t,r,o,s);break;case"literal":l=uD(e,t,r,o);break;case"enum":l=dD(e,t,r,o);break;case"readonly":{let c=lx(e,t,r,o),u=le(t);e.write(`const ${u} = Object.freeze(${c});`),l=u;break}case"success":lx(e,t,r,o),l="true";break;case"default":case"prefault":l=mD(e,t,r,o);break;case"nonoptional":l=fD(e,t,r,o);break;case"tuple":l=pD(e,t,r,o);break;case"union":l=hD(e,t,r,o);break;case"intersection":l=yD(e,t,r,o);break;case"record":l=_D(e,t,r,o);break;case"map":l=wD(e,t,r,o);break;case"set":l=kD(e,t,r,o);break;case"file":l=$D(e,o);break;case"template_literal":l=xD(e,t,r,o);break;case"lazy":l=SD(e,t,r,o);break;case"pipe":l=RD(e,t,r,o);break;case"custom":l=ID(e,t,r,o);break;case"transform":l=AD(e,t,r,o);break;case"catch":l=PD(e,t,r,o);break;default:throw new Se(`schema type ${a}`)}return l===null?null:N4(e,t,r,l)}function J4(e,t,r,o,n=!0){e.write(`if (typeof ${o} !== "string") return INVALID;`);let i=r._zod.def;return i.format===void 0?o:fx(e,t,i,o,n)}function K4(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let o=t._zod.def;return o.check==="number_format"&&o.format&&mx(e,{format:o.format},r),r}function q4(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function X4(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let o=t._zod.def;if(o.format)switch(o.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}function Y4(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function Q4(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function eD(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function tD(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function nD(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function rD(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function oD(e,t,r,o,n=!0){let i=r._zod.def;e.write(`if (typeof ${o} !== "object" || ${o} === null || Array.isArray(${o})) return INVALID;`);let a=i.shape,s=Object.keys(a),l=Object.getOwnPropertySymbols(a),c=l.length?[...s,...l]:s,u=y=>typeof y=="symbol"?ue(t,y):Pt(y),d=y=>typeof y=="symbol"?`[${u(y)}]`:Pt(y),f=a;if(s.includes("__proto__"))throw new Se('object shape key "__proto__"');let m=new Map;for(let y of c){let b=f[y],w=u(y),k=le(t);if(e.write(`const ${k} = ${o}[${w}];`),b._zod.optin!==void 0){let I=le(t);e.write(`let ${I} = (() => {`),e.indented(x=>{let S=kt(x,t,b,k);x.write(`return ${S};`)}),e.write("})();"),b._zod.optout==="optional"?(e.write(`if (${I} === INVALID) {`),e.indented(x=>{x.write(`if (${w} in ${o}) return INVALID;`),x.write(`${I} = undefined;`)}),e.write("}")):e.write(`if (${I} === INVALID) return INVALID;`),m.set(y,I)}else{sD(b)&&e.write(`if (!(${w} in ${o})) return INVALID;`);let I=kt(e,t,b,k,n);I!==null&&m.set(y,I)}}let p=i.catchall,g="none";if(p){let y=p._zod.def.type;if(y==="never"){let b=s.map(w=>`k !== ${Pt(w)}`).join(" && ")||"true";e.write(`for (const k in ${o}) {`),e.indented(w=>{w.write(`if (${b}) return INVALID;`)}),e.write("}")}else(y==="unknown"||y==="any")&&!p._zod.def.checks?.length?g="passthrough":g="schema"}let _=le(t),v=c.some(y=>sx(f[y])||Th(f[y]));if(!n){if(g==="schema"){let y=s.length>0?ue(t,new Set(s)):null;e.write(`for (const k in ${o}) {`),e.indented(b=>{b.write('if (k === "__proto__") continue;'),y&&b.write(`if (${y}.has(k)) continue;`);let w=le(t);b.write(`const ${w} = ${o}[k];`),kt(b,t,p,w,!1)}),e.write("}")}return null}if(v){e.write(`const ${_} = {};`);for(let y of c){let b=u(y),w=m.get(y);Th(f[y])?e.write(`if (${b} in ${o}) ${_}[${b}] = ${w};`):sx(f[y])?e.write(`if (${w} !== undefined || ${b} in ${o}) ${_}[${b}] = ${w};`):e.write(`${_}[${b}] = ${w};`)}}else{let y=c.map(b=>`${d(b)}: ${m.get(b)}`).join(", ");e.write(`const ${_} = { ${y} };`)}if(g!=="none"){let y=s.length>0?ue(t,new Set(s)):null;e.write(`for (const k in ${o}) {`),e.indented(b=>{if(b.write('if (k === "__proto__") continue;'),y&&b.write(`if (${y}.has(k)) continue;`),g==="passthrough")b.write(`${_}[k] = ${o}[k];`);else{let w=le(t);b.write(`const ${w} = ${o}[k];`);let k=kt(b,t,p,w);b.write(`${_}[k] = ${k};`)}}),e.write("}")}return _}function iD(e,t,r,o,n=!0){let i=r._zod.def;if(aD(r))return He(e,t,i.innerType,o,n);if(i.innerType._zod.optin==="defaulted"){let s=le(t),l=le(t);return e.write(`let ${s};`),e.write(`if (${o} === undefined) {`),e.indented(c=>{c.write(`const ${l} = (() => {`),c.indented(u=>{let d=He(u,t,i.innerType,o);u.write(`return ${d};`)}),c.write("})();"),c.write(`if (${l} !== INVALID) ${s} = ${l};`)}),e.write("} else {"),e.indented(c=>{let u=He(c,t,i.innerType,o);c.write(`${s} = ${u};`)}),e.write("}"),s}let a=n?le(t):null;return a&&e.write(`let ${a};`),e.write(`if (${o} !== undefined) {`),e.indented(s=>{let l=He(s,t,i.innerType,o,n);a&&l!==null&&s.write(`${a} = ${l};`)}),e.write("}"),a}function aD(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function sD(e){return e._zod.optin===void 0&&Wr(e)}function Wr(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?Wr(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?Wr(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Wr):!0;case"intersection":return!t.left||!t.right?!0:Wr(t.left)&&Wr(t.right);case"pipe":return t.in?Wr(t.in):!0;default:return!0}}function Th(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function sx(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Wo(e)}function Wo(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?Wo(t.innerType):!0;case"union":return t.options?t.options.some(Wo):!0;case"intersection":return!t.left||!t.right||Wo(t.left)||Wo(t.right);case"pipe":return t.out?Wo(t.out):!0;default:return!0}}function lD(e,t,r,o,n=!0){let i=r._zod.def,a=n?le(t):null;return a&&e.write(`let ${a} = null;`),e.write(`if (${o} !== null) {`),e.indented(s=>{let l=He(s,t,i.innerType,o,n);a&&l!==null&&s.write(`${a} = ${l};`)}),e.write("}"),a}function cD(e,t,r,o,n=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${o})) return INVALID;`);let a=n?le(t):null,s=le(t),l=le(t);return a&&e.write(`const ${a} = new Array(${o}.length);`),e.write(`for (let ${s} = 0; ${s} < ${o}.length; ${s}++) {`),e.indented(c=>{c.write(`const ${l} = ${o}[${s}];`);let u=kt(c,t,i.element,l,n);a&&u!==null&&c.write(`${a}[${s}] = ${u};`)}),e.write("}"),a}function uD(e,t,r,o){let i=r._zod.def.values;if(i.length!==1){let s=ue(t,new Set(i));return e.write(`if (!${s}.has(${o})) return INVALID;`),o}let a=i[0];if(typeof a=="number"&&Number.isNaN(a)){let s=ue(t,new Set(i));return e.write(`if (!${s}.has(${o})) return INVALID;`),o}if(typeof a=="string")e.write(`if (${o} !== ${Pt(a)}) return INVALID;`);else if(typeof a=="number"||typeof a=="boolean")e.write(`if (${o} !== ${a}) return INVALID;`);else if(a===null)e.write(`if (${o} !== null) return INVALID;`);else if(a===void 0)e.write(`if (${o} !== undefined) return INVALID;`);else if(typeof a=="bigint")e.write(`if (${o} !== ${a}n) return INVALID;`);else throw new Se(`literal type ${typeof a}`);return o}function dD(e,t,r,o){let n=r._zod.values;if(!n)throw new Se("enum schema without enumerated values");let i=ue(t,n);return e.write(`if (!${i}.has(${o})) return INVALID;`),o}function lx(e,t,r,o){let n=r._zod.def;return He(e,t,n.innerType,o)}function mD(e,t,r,o){let n=r._zod.def,a=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!a)return He(e,t,n.innerType,o);let l=ue(t,a),c=le(t);return e.write(`let ${c} = ${o};`),e.write(`if (${o} === undefined) ${c} = ${l}();`),He(e,t,n.innerType,c)}let s=le(t);if(a){let l=ue(t,a),c=ue(t,_a);e.write(`let ${s};`),e.write(`if (${o} === undefined) {`),e.indented(u=>{u.write(`${s} = ${c}(${l}());`)}),e.write("} else {"),e.indented(u=>{let d=He(u,t,n.innerType,o);u.write(`${s} = ${d} === undefined ? ${c}(${l}()) : ${d};`)}),e.write("}")}else e.write(`let ${s};`),e.write(`if (${o} !== undefined) {`),e.indented(l=>{let c=He(l,t,n.innerType,o);l.write(`${s} = ${c};`)}),e.write("}");return s}function fD(e,t,r,o){let n=r._zod.def,i=He(e,t,n.innerType,o),a=le(t);return e.write(`const ${a} = ${i};`),e.write(`if (${a} === undefined) return INVALID;`),a}function pD(e,t,r,o){let n=r._zod.def,i=n.items,a=n.rest;e.write(`if (!Array.isArray(${o})) return INVALID;`);let s=cx(i,"optin"),l=cx(i,"optout");a?e.write(`if (${o}.length < ${s}) return INVALID;`):e.write(`if (${o}.length < ${s} || ${o}.length > ${i.length}) return INVALID;`);let c=le(t);e.write(`const ${c} = [];`);for(let u=0;u<i.length;u++){let d=i[u];if(u>=l)e.write(`if (${c}.length === ${u}) {`),e.indented(f=>{f.write(`if (${u} < ${o}.length) {`),f.indented(m=>{let p=le(t);m.write(`const ${p} = ${o}[${u}];`);let g=kt(m,t,d,p);m.write(`${c}[${u}] = ${g};`)}),f.write("} else {"),f.indented(m=>{if(Th(d)){m.write(`${c}.length = ${u};`);return}let p=le(t),g=le(t);m.write(`const ${p} = undefined;`),m.write(`const ${g} = (() => {`),m.indented(_=>{let v=kt(_,t,d,p);_.write(`return ${v};`)}),m.write("})();"),m.write(`if (${g} === INVALID || ${g} === undefined) ${c}.length = ${u};`),m.write(`else ${c}[${u}] = ${g};`)}),f.write("}")}),e.write("}");else{let f=le(t);e.write(`const ${f} = ${o}[${u}];`);let m=kt(e,t,d,f);e.write(`${c}[${u}] = ${m};`)}}if(a){let u=le(t),d=le(t);e.write(`for (let ${u} = ${i.length}; ${u} < ${o}.length; ${u}++) {`),e.indented(f=>{f.write(`const ${d} = ${o}[${u}];`);let m=kt(f,t,a,d);f.write(`${c}[${u}] = ${m};`)}),e.write("}")}return c}function cx(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function hD(e,t,r,o){let n=r._zod.def,i=n.options;if(n.discriminator)return gD(e,t,n,o);if(n.inclusive===!1)throw new Se("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),o;if(i.length===1)return He(e,t,i[0],o);if(i.every(l=>l._zod.def.type==="literal"&&!l._zod.def.checks?.length)){let l=new Set(i.flatMap(u=>u._zod.def.values)),c=ue(t,l);return e.write(`if (!${c}.has(${o})) return INVALID;`),o}let s=le(t);e.write(`let ${s};`);for(let l=0;l<i.length;l++){let c=i[l];l===0?e.write(`${s} = (() => {`):e.write(`if (${s} === INVALID) ${s} = (() => {`),e.indented(u=>{let d=He(u,t,c,o);u.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${s} === INVALID) return INVALID;`),s}function gD(e,t,r,o){if(r.unionFallback)throw new Se("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),o;let n=le(t),i=le(t);e.write(`const ${n} = ${o}?.[${Pt(r.discriminator)}];`),e.write(`let ${i};`);let a=!0,s=new Set;for(let l of r.options){let c=l._zod.propValues?.[r.discriminator];if(!c||c.size===0)throw new Se("discriminated union option without static discriminator values");for(let f of c){if(s.has(f))throw new Se(`duplicate discriminator value ${String(f)}`);s.add(f)}let u=Array.from(c,f=>bD(t,n,f)),d=a?"if":"else if";e.write(`${d} (${u.join(" || ")}) {`),e.indented(f=>{let m=He(f,t,l,o);f.write(`${i} = ${m};`)}),e.write("}"),a=!1}return e.write("else { return INVALID; }"),i}function bD(e,t,r){if(typeof r=="string")return`${t} === ${Pt(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let o=ue(e,r);return`${t} === ${o}`}throw new Se(`literal discriminator value ${String(r)}`)}function yD(e,t,r,o){let n=r._zod.def;t.definite=!1;let i=kt(e,t,n.left,o),a=kt(e,t,n.right,o),s=ue(t,Zo),l=le(t);return e.write(`const ${l} = ${s}(${i}, ${a});`),e.write(`if (!${l}.valid) return INVALID;`),`${l}.data`}function _D(e,t,r,o){let n=r._zod.def,i=ue(t,Qt);e.write(`if (!${i}(${o})) return INVALID;`);let a=le(t),s=le(t),l=le(t);e.write(`const ${a} = {};`);let c=n,u=c.partial?void 0:n.keyType._zod.values;if(u){let m=[];for(let g of u){if(!(typeof g=="string"||typeof g=="number"||typeof g=="symbol"))throw new Se(`record key value ${String(g)}`);let _=typeof g=="number"?g.toString():g;if(_==="__proto__")throw new Se('record key "__proto__"');m.push(_);let v=ue(t,g),y=He(e,t,n.keyType,v),b=le(t);e.write(`const ${b} = ${o}[${vD(t,_)}];`);let w=kt(e,t,n.valueType,b);e.write(`${a}[${y}] = ${w};`)}let p=ue(t,new Set(m));return e.write(`for (const ${s} in ${o}) {`),e.indented(g=>{g.write(`if (${p}.has(${s})) continue;`),c.mode==="loose"?g.write(`if (${s} !== "__proto__") ${a}[${s}] = ${o}[${s}];`):g.write("return INVALID;")}),e.write("}"),a}let d=n.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let m=n.mode==="loose",p=Mc(n.keyType);p.definite===!1&&(t.definite=!1);let g=ue(t,p),_=ue(t,Zn),v=le(t);return ux(e,t,o,s,y=>{y.write(`let ${v} = ${g}(${s});`),y.write(`if (${v} === INVALID && typeof ${s} === "string" && ${_}.test(${s})) ${v} = ${g}(Number(${s}));`),m?y.write(`if (${v} === INVALID) { ${a}[${s}] = ${o}[${s}]; continue; }`):y.write(`if (${v} === INVALID) return INVALID;`),y.write(`if (${v} === "__proto__") continue;`);let b=le(t);y.write(`const ${b} = ${o}[${s}];`);let w=kt(y,t,n.valueType,b);y.write(`${a}[${v}] = ${w};`)}),a}return ux(e,t,o,s,m=>{m.write(`const ${l} = ${o}[${s}];`);let p=kt(m,t,n.valueType,l);m.write(`${a}[${s}] = ${p};`)},"return INVALID;"),a}function ux(e,t,r,o,n,i){let a=ue(t,Object.prototype.propertyIsEnumerable),s=le(t),l=le(t),c=le(t);e.write(`const ${s} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${l} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${c} = 0; ${c} < ${l}.length; ${c}++) {`),e.indented(u=>{u.write(`const ${o} = ${l}[${c}];`),u.write(`if (${o} === "__proto__" || !${a}.call(${r}, ${o})) continue;`),n(u)}),e.write("}"),e.write(`for (let ${c} = 0; ${c} < ${s}.length; ${c}++) {`),e.indented(u=>{u.write(`const ${o} = ${s}[${c}];`),u.write(`if (!${a}.call(${r}, ${o})) continue;`),i?u.write(i):n(u)}),e.write("}")}function vD(e,t){return typeof t=="string"?Pt(t):ue(e,t)}function wD(e,t,r,o){let n=r._zod.def;e.write(`if (!(${o} instanceof Map)) return INVALID;`);let i=le(t),a=le(t),s=le(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${a}, ${s}] of ${o}) {`),e.indented(l=>{let c=He(l,t,n.keyType,a),u=He(l,t,n.valueType,s);l.write(`${i}.set(${c}, ${u});`)}),e.write("}"),i}function kD(e,t,r,o){let n=r._zod.def;e.write(`if (!(${o} instanceof Set)) return INVALID;`);let i=le(t),a=le(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${a} of ${o}) {`),e.indented(s=>{let l=He(s,t,n.valueType,a);s.write(`${i}.add(${l});`)}),e.write("}"),i}function $D(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function xD(e,t,r,o){e.write(`if (typeof ${o} !== "string") return INVALID;`);let n=r._zod.pattern;if(n){let i=ue(t,n);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${o})) return INVALID;`)}return o}function SD(e,t,r,o){let n=r._zod.def,i=Jr(t,n.getter),a=ue(t,{parser:null});e.write(`if (!${a}.parser) {`),e.indented(l=>{l.write(`const inner = ${i}();`),l.write(`${a}.parser = function(input) {`),l.indented(c=>{c.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),c.write("return result.issues.length === 0 ? result.value : INVALID;")}),l.write("};")}),e.write("}");let s=le(t);return e.write(`const ${s} = ${a}.parser(${o});`),e.write(`if (${s} === INVALID) return INVALID;`),s}function RD(e,t,r,o){let n=r._zod.def,i=He(e,t,n.in,o);if(n.transform){if(Kr(n.transform))throw new un("z.compile: async transforms in pipes are not supported");let a=n.transform,l=Jr(t,u=>{let d={value:u,issues:[],addIssue:Ah},f=a(u,d);return f instanceof Promise?Et:d.issues.length===0?f:Et}),c=le(t);return e.write(`const ${c} = ${l}(${i});`),e.write(`if (${c} === INVALID) return INVALID;`),He(e,t,n.out,c)}else return He(e,t,n.out,i)}function Kr(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function ID(e,t,r,o){let n=r._zod.def;if(n.fn){if(Kr(n.fn))throw new un("z.compile: async custom predicates are not supported");let i=Jr(t,n.fn),a=ue(t,Ih),s=le(t);e.write(`const ${s} = ${i}(${o});`),e.write(`if (${s} instanceof Promise) ${a}();`),e.write(`if (!${s}) return INVALID;`)}else throw new Se("custom schema without a predicate function");return o}function TD(e,t,r){let o=e._zod.run({value:r,issues:[]},{});if(o&&typeof o.then=="function")return Et;let n=o;return n.issues.length===0?n.value:t()}function PD(e,t,r,o){let n=r._zod.def;if(!n.catchValue[Fl])throw new Se("catch with a callback (only a constant catch value compiles)",!1);let i=le(t);e.write(`let ${i} = (() => {`),e.indented(c=>{let u=kt(c,t,n.innerType,o);c.write(`return ${u};`)}),e.write("})();");let a=ue(t,n.innerType),s=Jr(t,n.catchValue),l=ue(t,TD);return e.write(`if (${i} === INVALID) {`),e.indented(c=>{c.write(`${i} = ${l}(${a}, ${s}, ${o});`),c.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function AD(e,t,r,o){let n=r._zod.def;if(n.transform){if(Kr(n.transform))throw new un("z.compile: async transforms are not supported");let i=n.transform,s=Jr(t,c=>{let u={value:c,issues:[],addIssue:Ah},d=i(c,u);return d instanceof Promise?Et:u.issues.length===0?d:Et}),l=le(t);return e.write(`const ${l} = ${s}(${o});`),e.write(`if (${l} === INVALID) return INVALID;`),l}return o}function Cc(e){return e.checks&&(e.checks=[...e.checks]),e}function Eh(e,t){return new e(Cc({type:"string",...J(t)}))}function Oh(e,t){return new e(Cc({type:"string",coerce:!0,...J(t)}))}function Dc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...J(t)})}function jc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...J(t)})}function Nc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...J(t)})}function Fc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...J(t)})}function Lc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...J(t)})}function zc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...J(t)})}function Ja(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...J(t)})}function Uc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...J(t)})}function Bc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...J(t)})}function Vc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...J(t)})}function Zc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...J(t)})}function Gc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...J(t)})}function Hc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...J(t)})}function Wc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...J(t)})}function Jc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...J(t)})}function Kc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...J(t)})}function Mh(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...J(t)})}function qc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...J(t)})}function Xc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...J(t)})}function Yc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...J(t)})}function Qc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...J(t)})}function eu(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...J(t)})}function Ch(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...J(t)})}function Dh(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...J(t)})}function tu(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...J(t)})}var jh={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Ka(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...J(t)})}function qa(e,t){return new e({type:"string",format:"date",check:"string_format",...J(t)})}function Xa(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...J(t)})}function Ya(e,t){return new e({type:"string",format:"duration",check:"string_format",...J(t)})}function Nh(e,t){return new e(Cc({type:"number",checks:[],...J(t)}))}function Fh(e,t){return new e(Cc({type:"number",coerce:!0,checks:[],...J(t)}))}function Lh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...J(t)})}function zh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...J(t)})}function Uh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...J(t)})}function Bh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...J(t)})}function Vh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...J(t)})}function Zh(e,t){return new e({type:"boolean",...J(t)})}function Gh(e,t){return new e({type:"boolean",coerce:!0,...J(t)})}function Hh(e,t){return new e({type:"bigint",...J(t)})}function Wh(e,t){return new e({type:"bigint",coerce:!0,...J(t)})}function Jh(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...J(t)})}function Kh(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...J(t)})}function qh(e,t){return new e({type:"symbol",...J(t)})}function Xh(e,t){return new e({type:"undefined",...J(t)})}function Yh(e,t){return new e({type:"null",...J(t)})}function Qh(e){return new e({type:"any"})}function eg(e){return new e({type:"unknown"})}function tg(e,t){return new e({type:"never",...J(t)})}function ng(e,t){return new e({type:"void",...J(t)})}function rg(e,t){return new e({type:"date",...J(t)})}function og(e,t){return new e({type:"date",coerce:!0,...J(t)})}function ig(e,t){return new e({type:"nan",...J(t)})}function xn(e,t){return new ec({check:"less_than",...J(t),value:e,inclusive:!1})}function Gt(e,t){return new ec({check:"less_than",...J(t),value:e,inclusive:!0})}function Sn(e,t){return new tc({check:"greater_than",...J(t),value:e,inclusive:!1})}function Ht(e,t){return new tc({check:"greater_than",...J(t),value:e,inclusive:!0})}function nu(e){return Sn(0,e)}function ru(e){return xn(0,e)}function ou(e){return Gt(0,e)}function iu(e){return Ht(0,e)}function mr(e,t){return new Vf({check:"multiple_of",...J(t),value:e})}function fr(e,t){return new Hf({check:"max_size",...J(t),maximum:e})}function Rn(e,t){return new Wf({check:"min_size",...J(t),minimum:e})}function qr(e,t){return new Jf({check:"size_equals",...J(t),size:e})}function Xr(e,t){return new Kf({check:"max_length",...J(t),maximum:e})}function Gn(e,t){return new qf({check:"min_length",...J(t),minimum:e})}function Yr(e,t){return new Xf({check:"length_equals",...J(t),length:e})}function Jo(e,t){return new Yf({check:"string_format",format:"regex",...J(t),pattern:e})}function Ko(e){return new Qf({check:"string_format",format:"lowercase",...J(e)})}function qo(e){return new ep({check:"string_format",format:"uppercase",...J(e)})}function Xo(e,t){return new tp({check:"string_format",format:"includes",...J(t),includes:e})}function Yo(e,t){return new np({check:"string_format",format:"starts_with",...J(t),prefix:e})}function Qo(e,t){return new rp({check:"string_format",format:"ends_with",...J(t),suffix:e})}function au(e,t,r){return new op({check:"property",property:e,schema:t,...J(r)})}function ei(e,t){return new ip({check:"properties",shape:e,...J(t)})}function ti(e,t){return new ap({check:"mime_type",mime:e,...J(t)})}function dn(e){return new sp({check:"overwrite",tx:e})}function ni(e){return dn(t=>t.normalize(e))}function ri(){return dn(e=>e.trim())}function oi(){return dn(e=>e.toLowerCase())}function ii(){return dn(e=>e.toUpperCase())}function ai(){return dn(e=>Zm(e))}function ag(e,t,r){return new e({type:"array",element:t,...J(r)})}function ED(e,t,r){return new e({type:"union",options:t,...J(r)})}function OD(e,t,r){return new e({type:"union",options:t,inclusive:!1,...J(r)})}function MD(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...J(o)})}function CD(e,t,r){return new e({type:"intersection",left:t,right:r})}function DD(e,t,r,o){let n=r instanceof pe,i=n?o:r,a=n?r:null;return new e({type:"tuple",items:t,rest:a,...J(i)})}function jD(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...J(o)})}function ND(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...J(o)})}function FD(e,t,r){return new e({type:"set",valueType:t,...J(r)})}function LD(e,t,r){let o=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:o,...J(r)})}function zD(e,t,r){return new e({type:"enum",entries:t,...J(r)})}function UD(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...J(r)})}function sg(e,t){return new e({type:"file",...J(t)})}function BD(e,t){return new e({type:"transform",transform:t})}function VD(e,t){return new e({type:"optional",innerType:t})}function ZD(e,t){return new e({type:"nullable",innerType:t})}function GD(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():_a(r)}})}function HD(e,t,r){return new e({type:"nonoptional",innerType:t,...J(r)})}function WD(e,t){return new e({type:"success",innerType:t})}function JD(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:qm(r)})}function KD(e,t,r){return new e({type:"pipe",in:t,out:r})}function qD(e,t){return new e({type:"readonly",innerType:t})}function XD(e,t,r){return new e({type:"template_literal",parts:t,...J(r)})}function YD(e,t){return new e({type:"lazy",getter:t})}function QD(e,t){return new e({type:"promise",innerType:t})}function lg(e,t,r){let o=J(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function cg(e,t,r){return new e({type:"custom",check:"custom",fn:t,...J(r)})}function ug(e,t){let r=px(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Fo(n,o.value,r._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(Fo(i))}},e(o.value,o)),t);return r}function px(e,t){let r=new Le({check:"custom",...J(t)});return r._zod.check=e,r}function dg(e){let t=new Le({check:"describe"});return t._zod.onattach=[r=>{let o=bt.get(r)??{};bt.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function mg(e){let t=new Le({check:"meta"});return t._zod.onattach=[r=>{let o=bt.get(r)??{};bt.add(r,{...o,...e})}],t._zod.check=()=>{},t}function fg(e,t){let r=J(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(o=o.map(m=>typeof m=="string"?m.toLowerCase():m),n=n.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(o),a=new Set(n),s=e.Codec??Ua,l=e.Boolean??La,c=e.String??Gr,u=new c({type:"string",error:r.error}),d=new l({type:"boolean",error:r.error}),f=new s({type:"pipe",in:u,out:d,transform:((m,p)=>{let g=m;return r.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:a.has(g)?!1:(p.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:p.value,inst:f,continue:!1}),{})}),reverseTransform:((m,p)=>m===!0?o[0]||"true":n[0]||"false"),error:r.error});return f._zod.bag.truthy=o,f._zod.bag.falsy=n,f._zod.bag.case=r.case??"insensitive",f}function Qr(e,t,r,o={}){let n=J(o),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...n};return r instanceof RegExp&&(i.pattern=r),new e(i)}function Qa(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,o)&>(e,o,r[o]);return e}function pr(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??bt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function ot(e,t,r,o,n){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(n);return Object.assign(r,i),!0}function Ce(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,u);else{let f=a.schema,m=t.processors[n.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,f,u)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),Ce(d,t,u),t.seen.get(d).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Qa(a.schema,l),t.io==="input"&&Ot(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((o=a.schema).default??(o.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function hx(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function hr(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let l=o.get(s);if(l&&l!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(s,a[0])}}let n=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,f=e.external.uri??(p=>p);if(d)return{ref:f(d)};let m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${f("__shared")}#/${s}/${hx(m)}`}}let l="#",c=`${l}/${s}/`;if(a[1]===r&&!a[1].schema.id)return{ref:l};let u=a[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:c+hx(u)}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:l,defId:c}=n(a);s.def={...s.schema},c&&(s.defId=c);let u=s.schema;for(let d in u)delete u[d];u.$ref=l};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
63
|
+
|
|
64
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let c=e.external.registry.get(a[0])?.id;if(t!==a[0]&&c){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}s.count>1&&e.reused==="ref"&&i(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}function yx(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!="object")return;yx(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let i=o.type;for(let a of Array.isArray(i)?i:[i]){if(typeof a!="string")return;r.includes(a)||r.push(a)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var _x=new Set(["type","properties","required","additionalProperties"]),gx=["oneOf","anyOf"];function bx(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function pg(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let a in i)if(!_x.has(a))return null;t.push(i)}let r={},o=new Set;for(let i of t){for(let a in i.properties){if(Object.prototype.hasOwnProperty.call(r,a))continue;let s=[];for(let c of t){let u=c.properties?.[a]??bx(c);u!=null&&(s.some(d=>JSON.stringify(d)===JSON.stringify(u))||s.push(u))}let l=s.length===1?s[0]:pg(s)??{allOf:s};gt(r,a,l)}for(let a of i.required??[])o.add(a)}let n={type:"object",properties:r};if(o.size&&(n.required=[...o]),t.every(i=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let a of t){let s=bx(a);s&&!i.some(l=>JSON.stringify(l)===JSON.stringify(s))&&i.push(s)}i.length===1?n.additionalProperties=i[0]:i.length>1&&(n.additionalProperties={allOf:i})}return n}function e2(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of _x)if(n in e)return;let r=t.filter(n=>gx.some(i=>Array.isArray(n[i]))),o=null;if(!r.length)o=pg(t);else{let n=r[0],i=gx.find(l=>Array.isArray(n[l]));if(Object.keys(n).length!==1)return;let a=t.filter(l=>l!==n),s=n[i].map(l=>pg([...a,l]));if(s.some(l=>!l))return;o={[i]:s}}o&&(delete e.allOf,Qa(e,o))}function gr(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=s=>{let l=e.seen.get(s);if(l.ref===null)return;let c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){o(d);let m=e.seen.get(d),p=m.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Qa(c,p),Qa(c,u),s._zod.parent===d)for(let _ in c)_==="$ref"||_==="allOf"||_ in u||delete c[_];if(p.$ref&&m.def)for(let _ in c)_==="$ref"||_==="allOf"||_ in m.def&&JSON.stringify(c[_])===JSON.stringify(m.def[_])&&delete c[_]}let f=s._zod.parent;if(f&&f!==d){o(f);let m=e.seen.get(f);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(let p in c)p==="$ref"||p==="allOf"||p in m.def&&JSON.stringify(c[p])===JSON.stringify(m.def[p])&&delete c[p]}e.override({zodSchema:s,jsonSchema:c,path:l.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())o(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())yx(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let l of e.seen.values())for(let c of[l.schema,l.def]){let u=c?.allOf;if(!Array.isArray(u))continue;let d=s.get(u);d?d.push(c):s.set(u,[c])}for(let l of e.intersections)for(let c of s.get(l)??[])e2(c)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}Qa(n,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&n.id===i&&delete n.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let l=s[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,gt(a,l.defId,l.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?n.$defs=a:n.definitions=a);try{let s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:si(t,"input",e.processors),output:si(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function Ot(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Ot(o.element,r);if(o.type==="set")return Ot(o.valueType,r);if(o.type==="lazy")return Ot(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return Ot(o.innerType,r);if(o.type==="intersection")return Ot(o.left,r)||Ot(o.right,r);if(o.type==="record"||o.type==="map")return Ot(o.keyType,r)||Ot(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ot(o.in,r)||Ot(o.out,r);if(o.type==="object"){for(let n in o.shape)if(Ot(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(Ot(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(Ot(n,r))return!0;return!!(o.rest&&Ot(o.rest,r))}return!1}var hg=(e,t={})=>r=>{let o=pr({...r,processors:t});return Ce(e,o),hr(o,e),gr(o,e)},si=(e,t,r={})=>o=>{let{libraryOptions:n,target:i}=o??{},a=pr({...n??{},target:i,io:t,processors:r});return Ce(e,a),hr(a,e),gr(a,e)};var li=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},ci=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},vx=(e,t)=>{li(e,"minimum",t),ci(e,"maximum",t)},xx=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Sx=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Rx=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},Ix=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},wx=(e,t)=>li(e,"minimum",t.minimum),kx=(e,t)=>ci(e,"maximum",t.maximum),$x=e=>(t,r)=>{Ix(t,r.format);let[o,n]=e[r.format];li(t,"minimum",o),ci(t,"maximum",n)},t2={greater_than:(e,t)=>li(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ci(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>xx(e,t.value),number_format:$x(wa),bigint_format:$x(ka),min_length:wx,max_length:kx,length_equals:(e,t)=>vx(e,t.length),min_size:wx,max_size:kx,size_equals:(e,t)=>vx(e,t.size),string_format:(e,t)=>{Ix(e,t.format),t.pattern&&Sx(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Rx(e,t.mime)};function it(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of o)t2[i._zod.def.check]?.(t,i._zod.def);let n=e._zod.bag;n.minimum!==void 0&&li(t,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&li(t,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&ci(t,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&ci(t,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&xx(t,n.multipleOf),n.format!==void 0&&(t.format??(t.format=n.format),n.format.includes("int")&&(t.isInt=!0)),n.mime&&Rx(t,n.mime);for(let i of n.patterns??[])Sx(t,i);return t}var n2={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},r2=new Map([[dc,$f],[Fa,xf]]),Tx=e=>r2.get(e)??e,yg=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:a,format:s,patterns:l,contentEncoding:c,laxFormat:u}=it(e);if(typeof i=="number"&&(n.minLength=i),typeof a=="number"&&(n.maxLength=a),s&&(n.format=n2[s]??s,n.format===""&&delete n.format,(s==="time"||u)&&delete n.format),c&&(n.contentEncoding=c),l&&l.size>0){let d=[...l].map(Tx);d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},_g=(e,t,r,o)=>{let n=r,{minimum:i,maximum:a,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=it(e);n.type=u?"integer":"number";let d=typeof c=="number"&&c>=(i??Number.NEGATIVE_INFINITY),f=typeof l=="number"&&l<=(a??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(d?m?(n.minimum=c,n.exclusiveMinimum=!0):n.exclusiveMinimum=c:typeof i=="number"&&(n.minimum=i),f?m?(n.maximum=l,n.exclusiveMaximum=!0):n.exclusiveMaximum=l:typeof a=="number"&&(n.maximum=a),s){let p=new Set;for(let v of s)Number.isFinite(v)&&v!==0?p.add(Math.abs(v)):ot(e,t,n,o,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[g,..._]=p;g!==void 0&&(n.multipleOf=g),_.length&&(n.allOf=[...n.allOf??[],..._.map(v=>({multipleOf:v}))])}},vg=(e,t,r,o)=>{r.type="boolean"},wg=(e,t,r,o)=>{ot(e,t,r,o,"BigInt cannot be represented in JSON Schema")},kg=(e,t,r,o)=>{ot(e,t,r,o,"Symbols cannot be represented in JSON Schema")},$g=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},xg=(e,t,r,o)=>{ot(e,t,r,o,"Undefined cannot be represented in JSON Schema")},Sg=(e,t,r,o)=>{ot(e,t,r,o,"Void cannot be represented in JSON Schema")},Rg=(e,t,r,o)=>{r.not={}},Ig=(e,t,r,o)=>{},Tg=(e,t,r,o)=>{},Pg=(e,t,r,o)=>{ot(e,t,r,o,"Date cannot be represented in JSON Schema")},Ag=(e,t,r,o)=>{let n=e._zod.def,i=Co(n.entries);if(i.length===0){r.not={};return}i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Eg=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let i=[];for(let a of n.values)if(a===void 0){if(ot(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(ot(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Og=(e,t,r,o)=>{ot(e,t,r,o,"NaN cannot be represented in JSON Schema")},Mg=(e,t,r,o)=>{let n=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},Cg=(e,t,r,o)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:i,maximum:a,mime:s}=it(e);i!==void 0&&(n.minLength=i),a!==void 0&&(n.maxLength=a),s&&(s.length===0?n.not={}:s.length===1?n.contentMediaType=s[0]:n.anyOf=s.map(l=>({contentMediaType:l})))},Dg=(e,t,r,o)=>{r.type="boolean"},jg=(e,t,r,o)=>{ot(e,t,r,o,"Custom types cannot be represented in JSON Schema")},Ng=(e,t,r,o)=>{ot(e,t,r,o,"Function types cannot be represented in JSON Schema")},Fg=(e,t,r,o)=>{ot(e,t,r,o,"Transforms cannot be represented in JSON Schema")},Lg=(e,t,r,o)=>{ot(e,t,r,o,"Map cannot be represented in JSON Schema")},zg=(e,t,r,o)=>{ot(e,t,r,o,"Set cannot be represented in JSON Schema")},Ug=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:a,maximum:s}=it(e);typeof a=="number"&&(n.minItems=a),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=Ce(i.element,t,{...o,path:[...o.path,"items"]})};function es(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?es(t.out):t.type==="catch"?es(t.innerType):e._zod.optin}var Bg=(e,t,r,o)=>{let n=r,i=e._zod.def,a=i.shape;if(Object.getOwnPropertySymbols(a).length&&ot(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let c in a)gt(n.properties,c,Ce(a[c],t,{...o,path:[...o.path,"properties",c]}));let l=[];for(let c of Object.keys(a)){let u=i.shape[c];(t.io==="input"?es(u)===void 0:u._zod.optout===void 0)&&l.push(c)}l.length>0&&(n.required=l),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=Ce(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},lu=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,a=n.options.map((s,l)=>Ce(s,t,{...o,path:[...o.path,i?"oneOf":"anyOf",l]}));i?r.oneOf=a:r.anyOf=a},Vg=(e,t,r,o)=>{let n=e._zod.def,i=Ce(n.left,t,{...o,path:[...o.path,"allOf",0]}),a=Ce(n.right,t,{...o,path:[...o.path,"allOf",1]}),s=c=>"allOf"in c&&Object.keys(c).length===1,l=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=l,t.intersections.push(l)},Zg=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((g,_)=>Ce(g,t,{...o,path:[...o.path,a,_]})),c=i.rest?Ce(i.rest,t,{...o,path:[...o.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,u=i.items.length;for(;u>0;){let g=i.items[u-1];if(!(t.io==="input"?es(g)!==void 0:g._zod.optout==="optional"))break;u--}let d=i.items.length,f=!i.rest;t.target==="draft-2020-12"?(n.prefixItems=l,f?n.items=!1:c&&(n.items=c),u>0&&(n.minItems=u),f&&(n.maxItems=d)):t.target==="openapi-3.0"?(n.items={anyOf:l},c&&n.items.anyOf.push(c),u>0&&(n.minItems=u),f&&(n.maxItems=d)):(n.items=l,f?n.additionalItems=!1:c&&(n.additionalItems=c),u>0&&(n.minItems=u),f&&(n.maxItems=d));let{minimum:m,maximum:p}=it(e);typeof m=="number"&&(n.minItems=m),typeof p=="number"&&(n.maxItems=p)};function gg(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let p=e.get(t)?.def;if(!p)return t;let g=gg(e,p,r);return g===p?t:g}for(let p of["anyOf","oneOf"]){let g=t[p];if(!Array.isArray(g))continue;let _=g.map(v=>gg(e,v,r));_.some((v,y)=>v!==g[y])&&(t={...t,[p]:_})}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some(p=>p==="number"||p==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!i?.some(p=>typeof p=="number"))return t;let{minimum:a,maximum:s,exclusiveMinimum:l,exclusiveMaximum:c,multipleOf:u,format:d,id:f,...m}=t;return m.enum?m.enum=m.enum.map(p=>typeof p=="number"?String(p):p):typeof m.const=="number"&&(m.const=String(m.const)),n&&(m.type="string",i||(m.pattern=(o.includes("number")?Zn:Ea).source)),m}var bg=new WeakMap;function o2(e){let t=new Map;for(let o of e.seen.values())o.def&&!t.has(o.schema)&&t.set(o.schema,o);let r=new Map;for(let o of bg.get(e)??[]){let n=e.seen.get(o),i=(n?.def??n?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let a=gg(t,i,new Set);a!==i&&r.set(i,a)}if(r.size)for(let o of e.seen.values())for(let n of[o.schema,o.def]){let i=n&&r.get(n.propertyNames);i&&(n.propertyNames=i)}}var Gg=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let a=i.keyType,s=it(a).patterns;if(i.mode==="loose"&&s&&s.size>0){let u=Ce(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of s)gt(n.patternProperties,Tx(d).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=Ce(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});let u=bg.get(t);u||(u=[],bg.set(t,u),t.deferred.push(()=>o2(t))),u.push(e)}n.additionalProperties=Ce(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let l=a._zod.values,c=t.io==="input"&&es(i.valueType)!==void 0;if(l&&!i.partial&&!c){let u=[...l].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(n.required=u.map(String))}},Hg=(e,t,r,o)=>{let n=e._zod.def,i=Ce(n.innerType,t,o),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Wg=(e,t,r,o)=>{let n=e._zod.def;Ce(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Jg=Symbol();function Px(e,t,r,o,n){let i=!1,a=JSON.stringify(e,(s,l)=>typeof l!="bigint"?l:(i=!0,null));return i?(ot(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),Jg):JSON.parse(a)}var Kg=(e,t,r,o)=>{let n=e._zod.def;Ce(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let a=Px(n.defaultValue,e,t,r,o);a!==Jg&&(r.default=a)},qg=(e,t,r,o)=>{let n=e._zod.def;Ce(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io!=="input")return;let a=Px(n.defaultValue,e,t,r,o);a!==Jg&&(r._prefault=a)},Xg=(e,t,r,o)=>{let n=e._zod.def;Ce(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{ot(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=a},Yg=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?n.out:n.in:n.out;Ce(a,t,o);let s=t.seen.get(e);s.ref=a},Qg=(e,t,r,o)=>{let n=e._zod.def;Ce(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},eb=(e,t,r,o)=>{let n=e._zod.def;Ce(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},cu=(e,t,r,o)=>{let n=e._zod.def;Ce(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},tb=(e,t,r,o)=>{let n=e._zod.innerType;Ce(n,t,o);let i=t.seen.get(e);i.ref=n},su={string:yg,number:_g,boolean:vg,bigint:wg,symbol:kg,null:$g,undefined:xg,void:Sg,never:Rg,any:Ig,unknown:Tg,date:Pg,enum:Ag,literal:Eg,nan:Og,template_literal:Mg,file:Cg,success:Dg,custom:jg,function:Ng,transform:Fg,map:Lg,set:zg,array:Ug,object:Bg,union:lu,intersection:Vg,tuple:Zg,record:Gg,nullable:Hg,nonoptional:Wg,default:Kg,prefault:qg,catch:Xg,pipe:Yg,readonly:Qg,promise:eb,optional:cu,lazy:tb};function uu(e,t){if("_idmap"in e){let o=e,n=pr({...t,processors:su}),i={};for(let l of o._idmap.entries()){let[c,u]=l;Ce(u,n)}let a={},s={registry:o,uri:t?.uri,defs:i};n.external=s;for(let l of o._idmap.entries()){let[c,u]=l;hr(n,u),gt(a,c,gr(n,u))}if(Object.keys(i).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:i}}return{schemas:a}}let r=pr({...t,processors:su});return Ce(e,r),hr(r,e),gr(r,e)}var du=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=pr({processors:su,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return Ce(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,hr(this.ctx,t);let o=gr(this.ctx,t),{"~standard":n,...i}=o;return i}};var Ax={};var bi={};Dn(bi,{ZodAny:()=>$b,ZodArray:()=>Ib,ZodBase64:()=>Au,ZodBase64URL:()=>Eu,ZodBigInt:()=>hi,ZodBigIntFormat:()=>Cu,ZodBoolean:()=>pi,ZodCIDRv4:()=>Tu,ZodCIDRv6:()=>Pu,ZodCUID:()=>wu,ZodCUID2:()=>ku,ZodCatch:()=>Jb,ZodCodec:()=>us,ZodCreditCard:()=>hb,ZodCustom:()=>ds,ZodCustomStringFormat:()=>ro,ZodDate:()=>os,ZodDefault:()=>Bb,ZodDiscriminatedUnion:()=>Pb,ZodE164:()=>Ou,ZodEmail:()=>bu,ZodEmoji:()=>_u,ZodEnum:()=>di,ZodExactOptional:()=>Fu,ZodFile:()=>Fb,ZodFunction:()=>oy,ZodGUID:()=>yu,ZodIBAN:()=>gb,ZodIPv4:()=>Ru,ZodIPv6:()=>Iu,ZodISODate:()=>yr,ZodISODateTime:()=>br,ZodISODuration:()=>vr,ZodISOTime:()=>_r,ZodInstanceOf:()=>sy,ZodIntersection:()=>Ab,ZodJWT:()=>Mu,ZodKSUID:()=>Su,ZodLazy:()=>ty,ZodLiteral:()=>Nb,ZodMAC:()=>pb,ZodMap:()=>Db,ZodNaN:()=>qb,ZodNanoID:()=>vu,ZodNever:()=>Sb,ZodNonOptional:()=>Lu,ZodNull:()=>wb,ZodNullable:()=>Ub,ZodNumber:()=>fi,ZodNumberFormat:()=>oo,ZodObject:()=>as,ZodOptional:()=>ls,ZodPipe:()=>cs,ZodPrefault:()=>Zb,ZodPreprocess:()=>Xb,ZodPromise:()=>ry,ZodReadonly:()=>Yb,ZodRecord:()=>ui,ZodSet:()=>jb,ZodString:()=>mi,ZodStringFormat:()=>Ne,ZodSuccess:()=>Wb,ZodSymbol:()=>_b,ZodTemplateLiteral:()=>ey,ZodTransform:()=>Lb,ZodTuple:()=>Ob,ZodType:()=>ve,ZodULID:()=>$u,ZodURL:()=>rs,ZodUUID:()=>In,ZodUndefined:()=>vb,ZodUnion:()=>ss,ZodUnknown:()=>xb,ZodVoid:()=>Rb,ZodXID:()=>xu,ZodXor:()=>Tb,_ZodString:()=>gu,_default:()=>Vb,_function:()=>BS,any:()=>_S,array:()=>is,base64:()=>Qx,base64url:()=>eS,bigint:()=>pS,boolean:()=>yb,catch:()=>Kb,check:()=>VS,cidrv4:()=>Xx,cidrv6:()=>Yx,codec:()=>FS,creditCard:()=>nS,cuid:()=>Vx,cuid2:()=>Zx,currencyCode:()=>lS,custom:()=>ZS,date:()=>wS,describe:()=>GS,discriminatedUnion:()=>IS,e164:()=>tS,email:()=>Mx,emoji:()=>Ux,enum:()=>ju,exactOptional:()=>zb,file:()=>CS,float32:()=>uS,float64:()=>dS,function:()=>BS,guid:()=>Cx,hash:()=>cS,hex:()=>sS,hostname:()=>aS,httpUrl:()=>zx,iban:()=>rS,instanceof:()=>WS,int:()=>pu,int32:()=>mS,int64:()=>hS,intersection:()=>Eb,invertCodec:()=>LS,ipv4:()=>Jx,ipv6:()=>qx,json:()=>KS,jwt:()=>oS,keyof:()=>kS,ksuid:()=>Wx,lazy:()=>ny,literal:()=>MS,looseObject:()=>SS,looseRecord:()=>PS,mac:()=>Kx,map:()=>AS,meta:()=>HS,nan:()=>NS,nanoid:()=>Bx,nativeEnum:()=>OS,never:()=>Du,nonoptional:()=>Hb,null:()=>kb,nullable:()=>ns,nullish:()=>DS,number:()=>bb,object:()=>$S,optional:()=>to,partialRecord:()=>TS,pipe:()=>hu,prefault:()=>Gb,preprocess:()=>qS,promise:()=>US,readonly:()=>Qb,record:()=>Cb,refine:()=>iy,set:()=>ES,strictObject:()=>xS,string:()=>ts,stringFormat:()=>iS,stringbool:()=>JS,success:()=>jS,superRefine:()=>ay,symbol:()=>bS,templateLiteral:()=>zS,transform:()=>Nu,tuple:()=>Mb,uint32:()=>fS,uint64:()=>gS,ulid:()=>Gx,undefined:()=>yS,union:()=>gi,unknown:()=>eo,url:()=>Lx,uuid:()=>Dx,uuidv4:()=>jx,uuidv6:()=>Nx,uuidv7:()=>Fx,void:()=>vS,xid:()=>Hx,xor:()=>RS});var mu={};Dn(mu,{endsWith:()=>Qo,gt:()=>Sn,gte:()=>Ht,includes:()=>Xo,length:()=>Yr,lowercase:()=>Ko,lt:()=>xn,lte:()=>Gt,maxLength:()=>Xr,maxSize:()=>fr,mime:()=>ti,minLength:()=>Gn,minSize:()=>Rn,multipleOf:()=>mr,negative:()=>ru,nonnegative:()=>iu,nonpositive:()=>ou,normalize:()=>ni,overwrite:()=>dn,positive:()=>nu,properties:()=>ei,property:()=>au,regex:()=>Jo,size:()=>qr,slugify:()=>ai,startsWith:()=>Yo,toLowerCase:()=>oi,toUpperCase:()=>ii,trim:()=>ri,uppercase:()=>qo});var Ex=new WeakSet([Object.prototype,Error.prototype]);function fu(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var Ox=(e,t)=>{nf.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Ex.has(r)||(Ex.add(r),fu(r,"format",o=>n=>Ia(o,n)),fu(r,"flatten",o=>n=>Ra(o,n)),fu(r,"addIssue",o=>n=>{o.issues.push(n),o.message=JSON.stringify(o.issues,Do,2)}),fu(r,"addIssues",o=>n=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,Do,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},a2=T("ZodError",Ox),Bt=T("ZodError",Ox,void 0,{Parent:Error});var nb=Lo(Bt),rb=zo(Bt),ob=Uo(Bt),ib=Bo(Bt),ab=Bl(Bt),sb=Vl(Bt),lb=Zl(Bt),cb=Gl(Bt),ub=Hl(Bt),db=Wl(Bt),mb=Jl(Bt),fb=Kl(Bt);function l2(){dt.localeError||Xe(Ic())}function no(){dt.memoizer||Xe({memoizer:Ga()})}var ve=T("ZodType",(e,t)=>(l2(),pe.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(N.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Oe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(iy(e,t))},superRefine(e,t){return this.check(ay(e,t))},overwrite(e){return this.check(dn(e))},optional(){return to(this)},exactOptional(){return zb(this)},nullable(){return ns(this)},nullish(){return to(ns(this))},nonoptional(e){return Hb(this,e)},array(){return is(this)},or(e){return gi([this,e])},and(e){return Eb(this,e)},transform(e){return hu(this,Nu(e))},default(e){return Vb(this,e)},prefault(e){return Gb(this,e)},catch(e){return Kb(this,e)},pipe(e){return hu(this,e)},readonly(){return Qb(this)},describe(e){let t=this.clone();return bt.add(t,{description:e}),t},meta(...e){if(e.length===0)return bt.get(this);let t=this.clone();return bt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return N.hide(this,"~standard",{...ac(this),jsonSchema:{input:si(this,"input"),output:si(this,"output")}})},set"~standard"(e){N.own(this,"~standard",e)},parse:function e(t,r){return nb(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await rb(this,t,r,{callee:e})},safeParse(e,t){return ob(this,e,t)},async safeParseAsync(e,t){return ib(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){N.own(this,"spa",e)},validate(e,t){return Ta(this,e,t)},validateAsync(e,t){return Pa(this,e,t)},encode:function e(t,r){return ab(this,t,r,{callee:e})},decode:function e(t,r){return sb(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await lb(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await cb(this,t,r,{callee:e})},safeEncode(e,t){return ub(this,e,t)},safeDecode(e,t){return db(this,e,t)},async safeEncodeAsync(e,t){return mb(this,e,t)},async safeDecodeAsync(e,t){return fb(this,e,t)},toJSONSchema(e){return hg(this,{})(e)},get description(){return bt.get(this)?.description},get _def(){return this._zod.def}}),gu=T("_ZodString",(e,t)=>{Gr.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yg(e,r,o,n)},N.derived({format:e=>it(e).format??null,minLength:e=>it(e).minimum??null,maxLength:e=>it(e).maximum??null},{regex(...e){return this.check(Jo(...e))},includes(...e){return this.check(Xo(...e))},startsWith(...e){return this.check(Yo(...e))},endsWith(...e){return this.check(Qo(...e))},min(...e){return this.check(Gn(...e))},max(...e){return this.check(Xr(...e))},length(...e){return this.check(Yr(...e))},nonempty(...e){return this.check(Gn(1,...e))},lowercase(e){return this.check(Ko(e))},uppercase(e){return this.check(qo(e))},trim(){return this.check(ri())},normalize(...e){return this.check(ni(...e))},toLowerCase(){return this.check(oi())},toUpperCase(){return this.check(ii())},slugify(){return this.check(ai())}})),mi=T("ZodString",(e,t)=>{Gr.init(e,t),gu.init(e,t)},{email(e){return this.check(Dc(bu,e))},url(e){return this.check(Ja(rs,e))},jwt(e){return this.check(tu(Mu,e))},emoji(e){return this.check(Uc(_u,e))},guid(e){return this.check(jc(yu,e))},uuid(e){return this.check(Nc(In,e))},uuidv4(e){return this.check(Fc(In,e))},uuidv6(e){return this.check(Lc(In,e))},uuidv7(e){return this.check(zc(In,e))},nanoid(e){return this.check(Bc(vu,e))},cuid(e){return this.check(Vc(wu,e))},cuid2(e){return this.check(Zc(ku,e))},ulid(e){return this.check(Gc($u,e))},base64(e){return this.check(Yc(Au,e))},base64url(e){return this.check(Qc(Eu,e))},xid(e){return this.check(Hc(xu,e))},ksuid(e){return this.check(Wc(Su,e))},ipv4(e){return this.check(Jc(Ru,e))},ipv6(e){return this.check(Kc(Iu,e))},cidrv4(e){return this.check(qc(Tu,e))},cidrv6(e){return this.check(Xc(Pu,e))},e164(e){return this.check(eu(Ou,e))},datetime(e){return this.check(Ka(br,e))},date(e){return this.check(qa(yr,e))},time(e){return this.check(Xa(_r,e))},duration(e){return this.check(Ya(vr,e))}});function ts(e){return Eh(mi,e)}var Ne=T("ZodStringFormat",(e,t)=>{Me.init(e,t),gu.init(e,t)}),br=T("ZodISODateTime",(e,t)=>{$p.init(e,t),Ne.init(e,t)}),yr=T("ZodISODate",(e,t)=>{xp.init(e,t),Ne.init(e,t)}),_r=T("ZodISOTime",(e,t)=>{Sp.init(e,t),Ne.init(e,t)}),vr=T("ZodISODuration",(e,t)=>{Rp.init(e,t),Ne.init(e,t)}),bu=T("ZodEmail",(e,t)=>{mp.init(e,t),Ne.init(e,t)});function Mx(e){return Dc(bu,e)}var yu=T("ZodGUID",(e,t)=>{up.init(e,t),Ne.init(e,t)});function Cx(e){return jc(yu,e)}var In=T("ZodUUID",(e,t)=>{dp.init(e,t),Ne.init(e,t)});function Dx(e){return Nc(In,e)}function jx(e){return Fc(In,e)}function Nx(e){return Lc(In,e)}function Fx(e){return zc(In,e)}var rs=T("ZodURL",(e,t)=>{hp.init(e,t),Ne.init(e,t)});function Lx(e){return Ja(rs,e)}function zx(e){return Ja(rs,{protocol:Aa,hostname:Rf,...N.normalizeParams(e)})}var _u=T("ZodEmoji",(e,t)=>{gp.init(e,t),Ne.init(e,t)});function Ux(e){return Uc(_u,e)}var vu=T("ZodNanoID",(e,t)=>{bp.init(e,t),Ne.init(e,t)});function Bx(e){return Bc(vu,e)}var wu=T("ZodCUID",(e,t)=>{yp.init(e,t),Ne.init(e,t)});function Vx(e){return Vc(wu,e)}var ku=T("ZodCUID2",(e,t)=>{_p.init(e,t),Ne.init(e,t)});function Zx(e){return Zc(ku,e)}var $u=T("ZodULID",(e,t)=>{vp.init(e,t),Ne.init(e,t)});function Gx(e){return Gc($u,e)}var xu=T("ZodXID",(e,t)=>{wp.init(e,t),Ne.init(e,t)});function Hx(e){return Hc(xu,e)}var Su=T("ZodKSUID",(e,t)=>{kp.init(e,t),Ne.init(e,t)});function Wx(e){return Wc(Su,e)}var Ru=T("ZodIPv4",(e,t)=>{Ip.init(e,t),Ne.init(e,t)});function Jx(e){return Jc(Ru,e)}var pb=T("ZodMAC",(e,t)=>{Pp.init(e,t),Ne.init(e,t)});function Kx(e){return Mh(pb,e)}var Iu=T("ZodIPv6",(e,t)=>{Tp.init(e,t),Ne.init(e,t)});function qx(e){return Kc(Iu,e)}var Tu=T("ZodCIDRv4",(e,t)=>{Ap.init(e,t),Ne.init(e,t)});function Xx(e){return qc(Tu,e)}var Pu=T("ZodCIDRv6",(e,t)=>{Ep.init(e,t),Ne.init(e,t)});function Yx(e){return Xc(Pu,e)}var Au=T("ZodBase64",(e,t)=>{Op.init(e,t),Ne.init(e,t)});function Qx(e){return Yc(Au,e)}var Eu=T("ZodBase64URL",(e,t)=>{Mp.init(e,t),Ne.init(e,t)});function eS(e){return Qc(Eu,e)}var Ou=T("ZodE164",(e,t)=>{Cp.init(e,t),Ne.init(e,t)});function tS(e){return eu(Ou,e)}var hb=T("ZodCreditCard",(e,t)=>{Dp.init(e,t),Ne.init(e,t)});function nS(e){return Ch(hb,e)}var gb=T("ZodIBAN",(e,t)=>{jp.init(e,t),Ne.init(e,t)});function rS(e){return Dh(gb,e)}var Mu=T("ZodJWT",(e,t)=>{Np.init(e,t),Ne.init(e,t)});function oS(e){return tu(Mu,e)}var ro=T("ZodCustomStringFormat",(e,t)=>{Fp.init(e,t),Ne.init(e,t)});function iS(e,t,r={}){return Qr(ro,e,t,r)}function aS(e){return Qr(ro,"hostname",Sf,e)}function sS(e){return Qr(ro,"hex",zf,e)}function lS(e){return Qr(ro,"currency_code",Tf,e)}function cS(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=tn[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return Qr(ro,o,n,t)}var fi=T("ZodNumber",(e,t)=>{gc.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_g(e,r,o,n),e.isFinite=!0},N.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=it(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=it(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=it(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>it(e).format??null},{gt(e,t){return this.check(Sn(e,t))},gte(e,t){return this.check(Ht(e,t))},min(e,t){return this.check(Ht(e,t))},lt(e,t){return this.check(xn(e,t))},lte(e,t){return this.check(Gt(e,t))},max(e,t){return this.check(Gt(e,t))},int(e){return this.check(pu(e))},safe(e){return this.check(pu(e))},positive(e){return this.check(Sn(0,e))},nonnegative(e){return this.check(Ht(0,e))},negative(e){return this.check(xn(0,e))},nonpositive(e){return this.check(Gt(0,e))},multipleOf(e,t){return this.check(mr(e,t))},step(e,t){return this.check(mr(e,t))},finite(){return this}}));function bb(e){return Nh(fi,e)}var oo=T("ZodNumberFormat",(e,t)=>{Lp.init(e,t),fi.init(e,t)});function pu(e){return Lh(oo,e)}function uS(e){return zh(oo,e)}function dS(e){return Uh(oo,e)}function mS(e){return Bh(oo,e)}function fS(e){return Vh(oo,e)}var pi=T("ZodBoolean",(e,t)=>{La.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vg(e,r,o,n)});function yb(e){return Zh(pi,e)}var hi=T("ZodBigInt",(e,t)=>{bc.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wg(e,r,o,n)},N.derived({minValue:e=>it(e).minimum??null,maxValue:e=>it(e).maximum??null,format:e=>it(e).format??null},{gte(e,t){return this.check(Ht(e,t))},min(e,t){return this.check(Ht(e,t))},gt(e,t){return this.check(Sn(e,t))},lt(e,t){return this.check(xn(e,t))},lte(e,t){return this.check(Gt(e,t))},max(e,t){return this.check(Gt(e,t))},positive(e){return this.check(Sn(BigInt(0),e))},negative(e){return this.check(xn(BigInt(0),e))},nonpositive(e){return this.check(Gt(BigInt(0),e))},nonnegative(e){return this.check(Ht(BigInt(0),e))},multipleOf(e,t){return this.check(mr(e,t))}}));function pS(e){return Hh(hi,e)}var Cu=T("ZodBigIntFormat",(e,t)=>{zp.init(e,t),hi.init(e,t)});function hS(e){return Jh(Cu,e)}function gS(e){return Kh(Cu,e)}var _b=T("ZodSymbol",(e,t)=>{Up.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kg(e,r,o,n)});function bS(e){return qh(_b,e)}var vb=T("ZodUndefined",(e,t)=>{Bp.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xg(e,r,o,n)});function yS(e){return Xh(vb,e)}var wb=T("ZodNull",(e,t)=>{Vp.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$g(e,r,o,n)});function kb(e){return Yh(wb,e)}var $b=T("ZodAny",(e,t)=>{Zp.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ig(e,r,o,n)});function _S(){return Qh($b)}var xb=T("ZodUnknown",(e,t)=>{Gp.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tg(e,r,o,n)});function eo(){return eg(xb)}var Sb=T("ZodNever",(e,t)=>{Hp.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rg(e,r,o,n)});function Du(e){return tg(Sb,e)}var Rb=T("ZodVoid",(e,t)=>{Wp.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Sg(e,r,o,n)});function vS(e){return ng(Rb,e)}var os=T("ZodDate",(e,t)=>{Jp.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pg(e,r,o,n),e.min=(r,o)=>e.check(Ht(r,o)),e.max=(r,o)=>e.check(Gt(r,o))},N.derived({minDate:e=>{let{minimum:t}=it(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=it(e);return t?new Date(t):null}},{}));function wS(e){return rg(os,e)}var Ib=T("ZodArray",(e,t)=>{no(),Kp.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ug(e,r,o,n),e.element=t.element},{min(e,t){return this.check(Gn(e,t))},nonempty(e){return this.check(Gn(1,e))},max(e,t){return this.check(Xr(e,t))},length(e,t){return this.check(Yr(e,t))},unwrap(){return this.element}});function is(e,t){return ag(Ib,e,t)}function kS(e){let t=e._zod.def.shape;return ju(Object.keys(t))}var as=T("ZodObject",(e,t)=>{no(),qp.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bg(e,r,o,n),N.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ju(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(N.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(N.mergeDefs(this._zod.def,{catchall:eo()}))},loose(){return this.clone(N.mergeDefs(this._zod.def,{catchall:eo()}))},strict(){return this.clone(N.mergeDefs(this._zod.def,{catchall:Du()}))},strip(){return this.clone(N.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return N.extend(this,e)},safeExtend(e){return N.safeExtend(this,e)},merge(e){return N.merge(this,e)},pick(e){return N.pick(this,e)},omit(e){return N.omit(this,e)},partial(...e){return N.partial(ls,this,e[0])},exactPartial(...e){return N.partial(Fu,this,e[0],"exactPartial")},required(...e){return N.required(Lu,this,e[0])}});function $S(e,t){let r={type:"object",shape:e??{},...N.normalizeParams(t)};return new as(r)}function xS(e,t){return new as({type:"object",shape:e,catchall:Du(),...N.normalizeParams(t)})}function SS(e,t){return new as({type:"object",shape:e,catchall:eo(),...N.normalizeParams(t)})}var ss=T("ZodUnion",(e,t)=>{za.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lu(e,r,o,n),e.options=t.options});function gi(e,t){return new ss({type:"union",options:e,...N.normalizeParams(t)})}var Tb=T("ZodXor",(e,t)=>{ss.init(e,t),Xp.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lu(e,r,o,n),e.options=t.options});function RS(e,t){return new Tb({type:"union",options:e,inclusive:!1,...N.normalizeParams(t)})}var Pb=T("ZodDiscriminatedUnion",(e,t)=>{ss.init(e,t),Qp.init(e,t)});function IS(e,t,r){return new Pb({type:"union",options:t,discriminator:e,...N.normalizeParams(r)})}var Ab=T("ZodIntersection",(e,t)=>{eh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vg(e,r,o,n)});function Eb(e,t){return new Ab({type:"intersection",left:e,right:t})}var Ob=T("ZodTuple",(e,t)=>{no(),yc.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zg(e,r,o,n)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new ls({type:"optional",innerType:t}))})}});function Mb(e,t,r){let o=t instanceof pe,n=o?r:t,i=o?t:null;return new Ob({type:"tuple",items:e,rest:i,...N.normalizeParams(n)})}var ui=T("ZodRecord",(e,t)=>{no(),th.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Gg(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function Cb(e,t,r){return!t||!t._zod?new ui({type:"record",keyType:ts(),valueType:e,...N.normalizeParams(t)}):new ui({type:"record",keyType:e,valueType:t,...N.normalizeParams(r)})}function TS(e,t,r){return new ui({type:"record",keyType:e,valueType:t,...N.normalizeParams(r),partial:!0})}function PS(e,t,r){return new ui({type:"record",keyType:e,valueType:t,mode:"loose",...N.normalizeParams(r)})}var Db=T("ZodMap",(e,t)=>{no(),nh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Lg(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Rn(...r)),e.nonempty=r=>e.check(Rn(1,r)),e.max=(...r)=>e.check(fr(...r)),e.size=(...r)=>e.check(qr(...r))});function AS(e,t,r){return new Db({type:"map",keyType:e,valueType:t,...N.normalizeParams(r)})}var jb=T("ZodSet",(e,t)=>{no(),rh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zg(e,r,o,n),e.min=(...r)=>e.check(Rn(...r)),e.nonempty=r=>e.check(Rn(1,r)),e.max=(...r)=>e.check(fr(...r)),e.size=(...r)=>e.check(qr(...r))});function ES(e,t){return new jb({type:"set",valueType:e,...N.normalizeParams(t)})}var di=T("ZodEnum",(e,t)=>{oh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Ag(e,o,n,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let a of o)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new di({...t,checks:[],...N.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let a of o)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new di({...t,checks:[],...N.normalizeParams(n),entries:i})}});function ju(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new di({type:"enum",entries:r,...N.normalizeParams(t)})}function OS(e,t){return new di({type:"enum",entries:e,...N.normalizeParams(t)})}var Nb=T("ZodLiteral",(e,t)=>{ih.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Eg(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function MS(e,t){return new Nb({type:"literal",values:Array.isArray(e)?e:[e],...N.normalizeParams(t)})}var Fb=T("ZodFile",(e,t)=>{ah.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cg(e,r,o,n),e.min=(r,o)=>e.check(Rn(r,o)),e.max=(r,o)=>e.check(fr(r,o)),e.mime=(r,o)=>e.check(ti(Array.isArray(r)?r:[r],o))});function CS(e){return sg(Fb,e)}var Lb=T("ZodTransform",(e,t)=>{no(),sh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Fg(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new dr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(N.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=r.value),a.inst??(a.inst=e),r.issues.push(N.issue(a))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r)):(r.value=n,r)}});function Nu(e){return new Lb({type:"transform",transform:e})}var ls=T("ZodOptional",(e,t)=>{_c.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>cu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function to(e){return new ls({type:"optional",innerType:e})}var Fu=T("ZodExactOptional",(e,t)=>{lh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>cu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function zb(e){return new Fu({type:"optional",innerType:e})}var Ub=T("ZodNullable",(e,t)=>{ch.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hg(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ns(e){return new Ub({type:"nullable",innerType:e})}function DS(e){return to(ns(e))}var Bb=T("ZodDefault",(e,t)=>{uh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kg(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Vb(e,t){return new Bb({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():N.shallowClone(t)}})}var Zb=T("ZodPrefault",(e,t)=>{dh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qg(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Gb(e,t){return new Zb({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():N.shallowClone(t)}})}var Lu=T("ZodNonOptional",(e,t)=>{mh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wg(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Hb(e,t){return new Lu({type:"nonoptional",innerType:e,...N.normalizeParams(t)})}var Wb=T("ZodSuccess",(e,t)=>{fh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Dg(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function jS(e){return new Wb({type:"success",innerType:e})}var Jb=T("ZodCatch",(e,t)=>{ph.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xg(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Kb(e,t){return new Jb({type:"catch",innerType:e,catchValue:typeof t=="function"?t:N.constantCatch(t)})}var qb=T("ZodNaN",(e,t)=>{hh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Og(e,r,o,n)});function NS(e){return ig(qb,e)}var cs=T("ZodPipe",(e,t)=>{vc.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yg(e,r,o,n),e.in=t.in,e.out=t.out});function hu(e,t){return new cs({type:"pipe",in:e,out:t})}var us=T("ZodCodec",(e,t)=>{cs.init(e,t),Ua.init(e,t)});function FS(e,t,r){return new us({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function LS(e){let t=e._zod.def;return new us({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Xb=T("ZodPreprocess",(e,t)=>{cs.init(e,t),gh.init(e,t)}),Yb=T("ZodReadonly",(e,t)=>{bh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qg(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Qb(e){return new Yb({type:"readonly",innerType:e})}var ey=T("ZodTemplateLiteral",(e,t)=>{yh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mg(e,r,o,n)});function zS(e,t){return new ey({type:"template_literal",parts:e,...N.normalizeParams(t)})}var ty=T("ZodLazy",(e,t)=>{Ba.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>tb(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function ny(e){return new ty({type:"lazy",getter:e})}var ry=T("ZodPromise",(e,t)=>{vh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>eb(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function US(e){return new ry({type:"promise",innerType:e})}var oy=T("ZodFunction",(e,t)=>{_h.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ng(e,r,o,n)});function BS(e){return new oy({type:"function",input:Array.isArray(e?.input)?Mb(e?.input):e?.input??is(eo()),output:e?.output??eo()})}var ds=T("ZodCustom",(e,t)=>{wh.init(e,t),ve.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jg(e,r,o,n)});function VS(e){let t=new Le({check:"custom"});return t._zod.check=e,t}function ZS(e,t){return lg(ds,e??(()=>!0),t)}function iy(e,t={}){return cg(ds,e,t)}function ay(e,t){return ug(e,t)}var GS=dg,HS=mg,sy=T("ZodInstanceOf",(e,t)=>{ds.init(e,t)},{properties(e,t){return this.check(ei(e,t))}});function WS(e,t={}){let r=new sy({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...N.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}var JS=(...e)=>fg({Codec:us,Boolean:pi,String:mi},...e);function KS(e){let t=ny(()=>gi([ts(e),bb(),yb(),kb(),is(t),Cb(ts(),t)]));return t}function qS(e,t){return new Xb({type:"pipe",in:Nu(e),out:t})}var c2={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function u2(e){Xe({customError:e})}function d2(){return Xe().customError}var ly;ly||(ly={});var ms={};Dn(ms,{ZodISODate:()=>yr,ZodISODateTime:()=>br,ZodISODuration:()=>vr,ZodISOTime:()=>_r,date:()=>f2,datetime:()=>m2,duration:()=>h2,time:()=>p2});function m2(e){return Ka(br,e)}function f2(e){return qa(yr,e)}function p2(e){return Xa(_r,e)}function h2(e){return Ya(vr,e)}var te={...bi,...mu,iso:ms},g2=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function b2(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function XS(e,t){return e.map((r,o)=>o<t?r:r.optional())}function y2(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function _2(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1]===void 0?void 0:y2(r[1]);if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function v2(e,t){return te.transform(o=>o).check(o=>{let n=o.value;if(typeof n!="object"||n===null||Array.isArray(n))return;let i=Object.getOwnPropertyNames(n);if(t.minProperties!==void 0&&i.length<t.minProperties&&o.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:n,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&o.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:n,inst:e,continue:!0}),t.keySchema)for(let a of i){let s=t.keySchema.safeParse(a);s.success||o.issues.push({code:"invalid_key",origin:"record",issues:s.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}function cy(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let o=String(e);return`${r[0]}${o.length}:${o}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let a of e){let s=cy(a,t);if(s===null)return null;i.push(s)}return`a${i.length}:[${i.join(",")}]`}let o=Object.keys(e).sort(),n=[];for(let i of o){let a=cy(e[i],t);if(a===null)return null;n.push(`${i.length}:${i}=${a}`)}return`o${n.length}:{${n.join(",")}}`}finally{t.delete(e)}}var w2=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),k2=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function fs(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(fs):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>w2.has(t)?fs(r):!k2.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(fs))}function YS(e){return e===1?"element":"elements"}function $2(e,t){return te.transform(o=>o).check(o=>{let n=o.value;if(Array.isArray(n)){if(t.uniqueItems===!0){let i=new Map;for(let a=0;a<n.length;a++){let s=cy(n[a],new Set);if(s===null)continue;let l=i.get(s);if(l===void 0){i.set(s,a);continue}o.issues.push({code:"custom",message:`Array items must be unique: element at index ${a} duplicates the one at index ${l}`,input:n,path:[a],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,a=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,s=0;for(let l of n)if(t.containsSchema.safeParse(l).success&&++s>=a)break;s<i&&o.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${YS(i)}; found ${s}`,input:n,continue:!0}),t.maxContains!==void 0&&s>t.maxContains&&o.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${YS(t.maxContains)}`,input:n,continue:!0})}}}).pipe(e)}function QS(e,t){if(e!==!1)return e===void 0||e===!0?te.any():Mt(e,t)}var x2=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function e1(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return te.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return te.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=_2(n,t),a=Mt(i,t);return t.refs.set(n,a),t.processing.delete(n),a}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return te.null();if(n.length===0)return te.never();if(n.length===1)return te.literal(n[0]);if(n.every(a=>typeof a=="string"))return te.enum(n);let i=n.map(a=>te.literal(a));return i.length<2?i[0]:te.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return te.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(i=>{let a={...e,type:i};return e1(a,t)});return n.length===0?te.never():n.length===1?n[0]:te.union(n)}if(!r)return te.any();let o;switch(r){case"string":{let n=te.string();if(e.format){let i=e.format;i==="email"?n=n.check(te.email()):i==="uri"||i==="uri-reference"?n=n.check(te.url()):i==="uuid"||i==="guid"?n=n.check(te.uuid()):i==="date-time"?n=n.check(te.iso.datetime({offset:!0})):i==="date"?n=n.check(te.iso.date()):i==="time"?n=n.check(te.regex(x2)):i==="duration"?n=n.check(te.iso.duration()):i==="hostname"?n=n.check(te.hostname()):i==="ipv4"?n=n.check(te.ipv4()):i==="ipv6"?n=n.check(te.ipv6()):i==="mac"?n=n.check(te.mac()):i==="cidr"?n=n.check(te.cidrv4()):i==="cidr-v6"?n=n.check(te.cidrv6()):i==="base64"?n=n.check(te.base64()):i==="base64url"?n=n.check(te.base64url()):i==="e164"?n=n.check(te.e164()):i==="credit_card"?n=n.check(te.creditCard()):i==="iban"?n=n.check(te.iban()):i==="jwt"?n=n.check(te.jwt()):i==="emoji"?n=n.check(te.emoji()):i==="nanoid"?n=n.check(te.nanoid()):i==="cuid"?n=n.check(te.cuid()):i==="cuid2"?n=n.check(te.cuid2()):i==="ulid"?n=n.check(te.ulid()):i==="xid"?n=n.check(te.xid()):i==="ksuid"&&(n=n.check(te.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),o=n;break}case"number":case"integer":{let n=r==="integer"?te.number().int():te.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),o=n;break}case"boolean":{o=te.boolean();break}case"null":{o=te.null();break}case"object":{let n={},i=e.properties||{},a=new Set(e.required||[]),s=typeof e.additionalProperties=="object"?Mt(e.additionalProperties,t):void 0;for(let[d,f]of Object.entries(i)){let m=Mt(f,t);gt(n,d,a.has(d)?m:m.optional())}if(e.patternProperties){let d=e.patternProperties,f=Object.keys(d),m=[];for(let g of f){let _=Mt(d[g],t),v=te.string().regex(new RegExp(g));m.push(te.looseRecord(v,_))}let p=[];if(Object.keys(n).length>0&&p.push(te.object(n).passthrough()),p.push(...m),p.length===0)o=te.object({}).passthrough();else if(p.length===1)o=p[0];else{let g=te.intersection(p[0],p[1]);for(let _=2;_<p.length;_++)g=te.intersection(g,p[_]);o=g}if(e.additionalProperties===!1){let g=Object.keys(n),_=f.map(y=>new RegExp(y)),v=o;o=o.check(y=>{if(!Qt(y.value))return;let b=[];for(let w of Object.keys(y.value))g.includes(w)||_.some(k=>k.test(w))||b.push(w);b.length&&y.issues.push({code:"unrecognized_keys",keys:b,input:y.value,inst:v})})}}else{let d=te.object(n);e.additionalProperties===!1?o=d.strict():s?o=d.catchall(s):o=d.passthrough()}let l=e.propertyNames!==void 0&&e.propertyNames!==!0,c=typeof e.minProperties=="number"?e.minProperties:void 0,u=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(l||c!==void 0||u!==void 0){let d;if(l){let f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=Mt(f,t)}o=v2(o,{keySchema:d,minProperties:c,maxProperties:u})}break}case"array":{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let a=typeof e.minItems=="number"?e.minItems:0,s=n.map(d=>Mt(d,t)),l=XS(s,a),c=Array.isArray(i)?void 0:QS(i,t),u=te.tuple(l);o=c?u.rest(c):u,typeof e.minItems=="number"&&(o=o.check(te.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(te.maxLength(e.maxItems)))}else if(Array.isArray(i)){let a=typeof e.minItems=="number"?e.minItems:0,s=i.map(d=>Mt(d,t)),l=XS(s,a),c=QS(e.additionalItems,t),u=te.tuple(l);o=c?u.rest(c):u,typeof e.minItems=="number"&&(o=o.check(te.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(te.maxLength(e.maxItems)))}else if(i!==void 0){let a=Mt(i,t),s=te.array(a);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),o=s}else o=te.array(te.any());(e.uniqueItems===!0||e.contains!==void 0)&&(o=$2(o,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?Mt(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return o}function Mt(e,t){if(typeof e=="boolean")return e?te.any():te.never();let r=e1(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(c=>Mt(c,t)),l=te.union(s);r=o?te.intersection(r,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(c=>Mt(c,t)),l=te.xor(s);r=o?te.intersection(r,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:te.any();else{let s=o?r:Mt(e.allOf[0],t),l=o?0:1;for(let c=l;c<e.allOf.length;c++)s=te.intersection(s,Mt(e.allOf[c],t));r=s}e.nullable===!0&&t.version==="openapi-3.0"&&(r=te.nullable(r)),e.readOnly===!0&&(r=te.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of i)s in e&&(n[s]=e[s]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let s of a)s in e&&(n[s]=e[s]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!fs(e.propertyNames)&&(n.propertyNames=e.propertyNames);for(let s of["minProperties","maxProperties"])e[s]!==void 0&&(n[s]=e[s])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!fs(e.contains)&&(n.contains=e.contains);for(let s of["uniqueItems","minContains","maxContains"])e[s]!==void 0&&(n[s]=e[s])}for(let s of Object.keys(e))g2.has(s)||gt(n,s,e[s]);return Object.keys(n).length>0&&t.registry.add(r,n),e.description&&(r=r.describe(e.description)),r}function t1(e,t){if(typeof e=="boolean")return e?te.any():te.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=b2(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??bt};return Mt(r,i)}var n1=Symbol("z.visit/resolving");function ps(e,t){let r=typeof t=="function"?t:(a,s)=>{let l=t[a._zod.def.type];return l?l(a,s):a},o=new Map;function n(a){let s=o.get(a);if(s===n1)return new Ba({type:"lazy",getter:()=>o.get(a)});if(s!==void 0)return s;o.set(a,n1);let l=i(a),c=r(l,l!==a);return o.set(a,c),c}function i(a){let s=a._zod.def,l=s.type;switch(l){case"object":{let c=s.shape,u=Object.keys(c),d=!1,f={};for(let p of u){let g=n(c[p]);g!==c[p]&&(d=!0),f[p]=g}let m=s.catchall;return s.catchall&&(m=n(s.catchall),m!==s.catchall&&(d=!0)),d?Oe(a,{...s,shape:f,catchall:m}):a}case"array":{let c=n(s.element);return c===s.element?a:Oe(a,{...s,element:c})}case"tuple":{let c=s.items,u=!1,d=[];for(let m of c){let p=n(m);p!==m&&(u=!0),d.push(p)}let f=s.rest;return s.rest&&(f=n(s.rest),f!==s.rest&&(u=!0)),u?Oe(a,{...s,items:d,rest:f}):a}case"record":case"map":{let c=n(s.keyType),u=n(s.valueType);return c===s.keyType&&u===s.valueType?a:Oe(a,{...s,keyType:c,valueType:u})}case"set":{let c=n(s.valueType);return c===s.valueType?a:Oe(a,{...s,valueType:c})}case"union":{let c=s.options,u=!1,d=[];for(let f of c){let m=n(f);m!==f&&(u=!0),d.push(m)}return u?Oe(a,{...s,options:d}):a}case"intersection":{let c=n(s.left),u=n(s.right);return c===s.left&&u===s.right?a:Oe(a,{...s,left:c,right:u})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=n(s.innerType);return c===s.innerType?a:Oe(a,{...s,innerType:c})}case"pipe":{let c=n(s.in),u=n(s.out);return c===s.in&&u===s.out?a:Oe(a,{...s,in:c,out:u})}case"function":{let c=n(s.input),u=n(s.output);return c===s.input&&u===s.output?a:Oe(a,{...s,input:c,output:u})}case"lazy":{let c=s.getter,{_cachedInner:u,...d}=s;return Oe(a,{...d,getter:()=>n(c())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return a;default:return a}}return n(e)}function r1(e){return ps(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:gi(r.options)}})}function S2(e,t){if(!t?.length)return e;let r=e._zod.def;return Oe(e,cn(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function o1(e){return S2(e.out,e.checks)}function R2(e){return e.in._zod.traits.has("$ZodTransform")?o1(e):e.in}function i1(e){return ps(e,{pipe:t=>R2(t._zod.def),default:(t,r)=>r?to(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function a1(e){return ps(e,{pipe:t=>o1(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}var uy={};Dn(uy,{bigint:()=>A2,boolean:()=>P2,date:()=>E2,number:()=>T2,string:()=>I2});function I2(e){return Oh(mi,e)}function T2(e){return Fh(fi,e)}function P2(e){return Gh(pi,e)}function A2(e){return Wh(hi,e)}function E2(e){return og(os,e)}var l1=Symbol("Let zodToJsonSchema decide on which parser to use");var s1={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},c1=e=>typeof e=="string"?{...s1,name:e}:{...s1,...e};var Re;(function(e){e.assertEqual=n=>{};function t(n){}e.assertIs=t;function r(n){throw new Error}e.assertNever=r,e.arrayToEnum=n=>{let i={};for(let a of n)i[a]=a;return i},e.getValidEnumValues=n=>{let i=e.objectKeys(n).filter(s=>typeof n[n[s]]!="number"),a={};for(let s of i)a[s]=n[s];return e.objectValues(a)},e.objectValues=n=>e.objectKeys(n).map(function(i){return n[i]}),e.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.push(a);return i},e.find=(n,i)=>{for(let a of n)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function o(n,i=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=o,e.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(Re||(Re={}));var u1;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(u1||(u1={}));var re=Re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Wn=e=>{switch(typeof e){case"undefined":return re.undefined;case"string":return re.string;case"number":return Number.isNaN(e)?re.nan:re.number;case"boolean":return re.boolean;case"function":return re.function;case"bigint":return re.bigint;case"symbol":return re.symbol;case"object":return Array.isArray(e)?re.array:e===null?re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?re.promise:typeof Map<"u"&&e instanceof Map?re.map:typeof Set<"u"&&e instanceof Set?re.set:typeof Date<"u"&&e instanceof Date?re.date:re.object;default:return re.unknown}};var W=Re.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 Wt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},o={_errors:[]},n=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)o._errors.push(r(a));else{let s=o,l=0;for(;l<a.path.length;){let c=a.path[l],u=l===a.path.length-1;if(c==="_errors"){u&&s._errors.push(r(a)),l++;continue}Object.prototype.hasOwnProperty.call(s,c)||(c==="__proto__"?Object.defineProperty(s,c,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):s[c]={_errors:[]}),s=s[c],u&&s._errors.push(r(a)),l++}}};return n(this),o}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),o=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];r[i]=r[i]||[],r[i].push(t(n))}else o.push(t(n));return{formErrors:o,fieldErrors:r}}get formErrors(){return this.flatten()}};Wt.create=e=>new Wt(e);var O2=(e,t)=>{let r;switch(e.code){case W.invalid_type:e.received===re.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Re.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:r=`Unrecognized key(s) in object: ${Re.joinValues(e.keys,", ")}`;break;case W.invalid_union:r="Invalid input";break;case W.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Re.joinValues(e.options)}`;break;case W.invalid_enum_value:r=`Invalid enum value. Expected ${Re.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:r="Invalid function arguments";break;case W.invalid_return_type:r="Invalid function return type";break;case W.invalid_date:r="Invalid date";break;case W.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Re.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case W.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case W.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case W.custom:r="Invalid input";break;case W.invalid_intersection_types:r="Intersection results could not be merged";break;case W.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:r="Number must be finite";break;default:r=t.defaultError,Re.assertNever(e)}return{message:r}},wr=O2;var M2=wr;function hs(){return M2}var zu=e=>{let{data:t,path:r,errorMaps:o,issueData:n}=e,i=[...r,...n.path||[]],a={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let s="",l=o.filter(c=>!!c).slice().reverse();for(let c of l)s=c(a,{data:t,defaultError:s}).message;return{...n,path:i,message:s}};function ee(e,t){let r=hs(),o=zu({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===wr?void 0:wr].filter(n=>!!n)});e.common.issues.push(o)}var $t=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let o=[];for(let n of r){if(n.status==="aborted")return de;n.status==="dirty"&&t.dirty(),o.push(n.value)}return{status:t.value,value:o}}static async mergeObjectAsync(t,r){let o=[];for(let n of r){let i=await n.key,a=await n.value;o.push({key:i,value:a})}return e.mergeObjectSync(t,o)}static mergeObjectSync(t,r){let o={};for(let n of r){let{key:i,value:a}=n;if(i.status==="aborted"||a.status==="aborted")return de;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||n.alwaysSet)&&(o[i.value]=a.value)}return{status:t.value,value:o}}},de=Object.freeze({status:"aborted"}),yi=e=>({status:"dirty",value:e}),Ct=e=>({status:"valid",value:e}),dy=e=>e.status==="aborted",my=e=>e.status==="dirty",io=e=>e.status==="valid",gs=e=>typeof Promise<"u"&&e instanceof Promise;var ie;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ie||(ie={}));var nn=class{constructor(t,r,o,n){this._cachedPath=[],this.parent=t,this.data=r,this._path=o,this._key=n}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}},d1=(e,t)=>{if(io(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Wt(e.common.issues);return this._error=r,this._error}}};function we(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:o,description:n}=e;if(t&&(r||o))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:n}:{errorMap:(a,s)=>{let{message:l}=e;return a.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??o??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:l??r??s.defaultError}},description:n}}var xe=class{get description(){return this._def.description}_getType(t){return Wn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Wn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new $t,ctx:{common:t.parent.common,data:t.data,parsedType:Wn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(gs(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let o=this.safeParse(t,r);if(o.success)return o.data;throw o.error}safeParse(t,r){let o={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Wn(t)},n=this._parseSync({data:t,path:o.path,parent:o});return d1(o,n)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Wn(t)};if(!this["~standard"].async)try{let o=this._parseSync({data:t,path:[],parent:r});return io(o)?{value:o.value}:{issues:r.common.issues}}catch(o){o?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(o=>io(o)?{value:o.value}:{issues:r.common.issues})}async parseAsync(t,r){let o=await this.safeParseAsync(t,r);if(o.success)return o.data;throw o.error}async safeParseAsync(t,r){let o={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Wn(t)},n=this._parse({data:t,path:o.path,parent:o}),i=await(gs(n)?n:Promise.resolve(n));return d1(o,i)}refine(t,r){let o=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,i)=>{let a=t(n),s=()=>i.addIssue({code:W.custom,...o(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((o,n)=>t(o)?!0:(n.addIssue(typeof r=="function"?r(o,n):r),!1))}_refinement(t){return new fn({schema:this,typeName:K.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:r=>this["~validate"](r)}}optional(){return mn.create(this,this._def)}nullable(){return qn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $r.create(this)}promise(){return ao.create(this,this._def)}or(t){return $i.create([this,t],this._def)}and(t){return xi.create(this,t,this._def)}transform(t){return new fn({...we(this._def),schema:this,typeName:K.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Pi({...we(this._def),innerType:this,defaultValue:r,typeName:K.ZodDefault})}brand(){return new Uu({typeName:K.ZodBranded,type:this,...we(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Ai({...we(this._def),innerType:this,catchValue:r,typeName:K.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Bu.create(this,t)}readonly(){return Ei.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},C2=/^c[^\s-]{8,}$/i,D2=/^[0-9a-z]+$/,j2=/^[0-9A-HJKMNP-TV-Z]{26}$/i,N2=/^[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,F2=/^[a-z0-9_-]{21}$/i,L2=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,z2=/^[-+]?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)?)??$/,U2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,B2="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",fy,V2=/^(?:(?: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])$/,Z2=/^(?:(?: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])$/,G2=/^(([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]))$/,H2=/^(([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])$/,W2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,J2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,m1="((\\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])))",K2=new RegExp(`^${m1}$`);function f1(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function q2(e){return new RegExp(`^${f1(e)}$`)}function X2(e){let t=`${m1}T${f1(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Y2(e,t){return!!((t==="v4"||!t)&&V2.test(e)||(t==="v6"||!t)&&G2.test(e))}function Q2(e,t){if(!L2.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let o=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(o));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||t&&n.alg!==t)}catch{return!1}}function ej(e,t){return!!((t==="v4"||!t)&&Z2.test(e)||(t==="v6"||!t)&&H2.test(e))}var vi=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==re.string){let i=this._getOrReturnCtx(t);return ee(i,{code:W.invalid_type,expected:re.string,received:i.parsedType}),de}let o=new $t,n;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(n=this._getOrReturnCtx(t,n),ee(n,{code:W.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),o.dirty());else if(i.kind==="max")t.data.length>i.value&&(n=this._getOrReturnCtx(t,n),ee(n,{code:W.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),o.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(n=this._getOrReturnCtx(t,n),a?ee(n,{code:W.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ee(n,{code:W.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),o.dirty())}else if(i.kind==="email")U2.test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"email",code:W.invalid_string,message:i.message}),o.dirty());else if(i.kind==="emoji")fy||(fy=new RegExp(B2,"u")),fy.test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"emoji",code:W.invalid_string,message:i.message}),o.dirty());else if(i.kind==="uuid")N2.test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"uuid",code:W.invalid_string,message:i.message}),o.dirty());else if(i.kind==="nanoid")F2.test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"nanoid",code:W.invalid_string,message:i.message}),o.dirty());else if(i.kind==="cuid")C2.test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"cuid",code:W.invalid_string,message:i.message}),o.dirty());else if(i.kind==="cuid2")D2.test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"cuid2",code:W.invalid_string,message:i.message}),o.dirty());else if(i.kind==="ulid")j2.test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"ulid",code:W.invalid_string,message:i.message}),o.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),ee(n,{validation:"url",code:W.invalid_string,message:i.message}),o.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"regex",code:W.invalid_string,message:i.message}),o.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(t,n),ee(n,{code:W.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),o.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(n=this._getOrReturnCtx(t,n),ee(n,{code:W.invalid_string,validation:{startsWith:i.value},message:i.message}),o.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(n=this._getOrReturnCtx(t,n),ee(n,{code:W.invalid_string,validation:{endsWith:i.value},message:i.message}),o.dirty()):i.kind==="datetime"?X2(i).test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:W.invalid_string,validation:"datetime",message:i.message}),o.dirty()):i.kind==="date"?K2.test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:W.invalid_string,validation:"date",message:i.message}),o.dirty()):i.kind==="time"?q2(i).test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:W.invalid_string,validation:"time",message:i.message}),o.dirty()):i.kind==="duration"?z2.test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"duration",code:W.invalid_string,message:i.message}),o.dirty()):i.kind==="ip"?Y2(t.data,i.version)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"ip",code:W.invalid_string,message:i.message}),o.dirty()):i.kind==="jwt"?Q2(t.data,i.alg)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"jwt",code:W.invalid_string,message:i.message}),o.dirty()):i.kind==="cidr"?ej(t.data,i.version)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"cidr",code:W.invalid_string,message:i.message}),o.dirty()):i.kind==="base64"?W2.test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"base64",code:W.invalid_string,message:i.message}),o.dirty()):i.kind==="base64url"?J2.test(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{validation:"base64url",code:W.invalid_string,message:i.message}),o.dirty()):Re.assertNever(i);return{status:o.value,value:t.data}}_regex(t,r,o){return this.refinement(n=>t.test(n),{validation:r,code:W.invalid_string,...ie.errToObj(o)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ie.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ie.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ie.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ie.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ie.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ie.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ie.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ie.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ie.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ie.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ie.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ie.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ie.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ie.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ie.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ie.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ie.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ie.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ie.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ie.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ie.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ie.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ie.errToObj(r)})}nonempty(t){return this.min(1,ie.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};vi.create=e=>new vi({checks:[],typeName:K.ZodString,coerce:e?.coerce??!1,...we(e)});function tj(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(e.toFixed(n).replace(".","")),a=Number.parseInt(t.toFixed(n).replace(".",""));return i%a/10**n}var bs=class e extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==re.number){let i=this._getOrReturnCtx(t);return ee(i,{code:W.invalid_type,expected:re.number,received:i.parsedType}),de}let o,n=new $t;for(let i of this._def.checks)i.kind==="int"?Re.isInteger(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:W.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(o=this._getOrReturnCtx(t,o),ee(o,{code:W.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(o=this._getOrReturnCtx(t,o),ee(o,{code:W.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?tj(t.data,i.value)!==0&&(o=this._getOrReturnCtx(t,o),ee(o,{code:W.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:W.not_finite,message:i.message}),n.dirty()):Re.assertNever(i);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ie.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ie.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ie.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ie.toString(r))}setLimit(t,r,o,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:o,message:ie.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ie.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ie.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ie.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ie.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ie.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Re.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(r===null||o.value>r)&&(r=o.value):o.kind==="max"&&(t===null||o.value<t)&&(t=o.value)}return Number.isFinite(r)&&Number.isFinite(t)}};bs.create=e=>new bs({checks:[],typeName:K.ZodNumber,coerce:e?.coerce||!1,...we(e)});var ys=class e extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==re.bigint)return this._getInvalidInput(t);let o,n=new $t;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(o=this._getOrReturnCtx(t,o),ee(o,{code:W.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(o=this._getOrReturnCtx(t,o),ee(o,{code:W.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(o=this._getOrReturnCtx(t,o),ee(o,{code:W.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):Re.assertNever(i);return{status:n.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return ee(r,{code:W.invalid_type,expected:re.bigint,received:r.parsedType}),de}gte(t,r){return this.setLimit("min",t,!0,ie.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ie.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ie.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ie.toString(r))}setLimit(t,r,o,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:o,message:ie.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ie.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};ys.create=e=>new ys({checks:[],typeName:K.ZodBigInt,coerce:e?.coerce??!1,...we(e)});var _s=class extends xe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==re.boolean){let o=this._getOrReturnCtx(t);return ee(o,{code:W.invalid_type,expected:re.boolean,received:o.parsedType}),de}return Ct(t.data)}};_s.create=e=>new _s({typeName:K.ZodBoolean,coerce:e?.coerce||!1,...we(e)});var vs=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==re.date){let i=this._getOrReturnCtx(t);return ee(i,{code:W.invalid_type,expected:re.date,received:i.parsedType}),de}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ee(i,{code:W.invalid_date}),de}let o=new $t,n;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(n=this._getOrReturnCtx(t,n),ee(n,{code:W.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),o.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(n=this._getOrReturnCtx(t,n),ee(n,{code:W.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),o.dirty()):Re.assertNever(i);return{status:o.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:ie.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ie.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};vs.create=e=>new vs({checks:[],coerce:e?.coerce||!1,typeName:K.ZodDate,...we(e)});var ws=class extends xe{_parse(t){if(this._getType(t)!==re.symbol){let o=this._getOrReturnCtx(t);return ee(o,{code:W.invalid_type,expected:re.symbol,received:o.parsedType}),de}return Ct(t.data)}};ws.create=e=>new ws({typeName:K.ZodSymbol,...we(e)});var wi=class extends xe{_parse(t){if(this._getType(t)!==re.undefined){let o=this._getOrReturnCtx(t);return ee(o,{code:W.invalid_type,expected:re.undefined,received:o.parsedType}),de}return Ct(t.data)}};wi.create=e=>new wi({typeName:K.ZodUndefined,...we(e)});var ki=class extends xe{_parse(t){if(this._getType(t)!==re.null){let o=this._getOrReturnCtx(t);return ee(o,{code:W.invalid_type,expected:re.null,received:o.parsedType}),de}return Ct(t.data)}};ki.create=e=>new ki({typeName:K.ZodNull,...we(e)});var ks=class extends xe{constructor(){super(...arguments),this._any=!0}_parse(t){return Ct(t.data)}};ks.create=e=>new ks({typeName:K.ZodAny,...we(e)});var kr=class extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ct(t.data)}};kr.create=e=>new kr({typeName:K.ZodUnknown,...we(e)});var Tn=class extends xe{_parse(t){let r=this._getOrReturnCtx(t);return ee(r,{code:W.invalid_type,expected:re.never,received:r.parsedType}),de}};Tn.create=e=>new Tn({typeName:K.ZodNever,...we(e)});var $s=class extends xe{_parse(t){if(this._getType(t)!==re.undefined){let o=this._getOrReturnCtx(t);return ee(o,{code:W.invalid_type,expected:re.void,received:o.parsedType}),de}return Ct(t.data)}};$s.create=e=>new $s({typeName:K.ZodVoid,...we(e)});var $r=class e extends xe{_parse(t){let{ctx:r,status:o}=this._processInputParams(t),n=this._def;if(r.parsedType!==re.array)return ee(r,{code:W.invalid_type,expected:re.array,received:r.parsedType}),de;if(n.exactLength!==null){let a=r.data.length>n.exactLength.value,s=r.data.length<n.exactLength.value;(a||s)&&(ee(r,{code:a?W.too_big:W.too_small,minimum:s?n.exactLength.value:void 0,maximum:a?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),o.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(ee(r,{code:W.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),o.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(ee(r,{code:W.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),o.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>n.type._parseAsync(new nn(r,a,r.path,s)))).then(a=>$t.mergeArray(o,a));let i=[...r.data].map((a,s)=>n.type._parseSync(new nn(r,a,r.path,s)));return $t.mergeArray(o,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ie.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ie.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ie.toString(r)}})}nonempty(t){return this.min(1,t)}};$r.create=(e,t)=>new $r({type:e,minLength:null,maxLength:null,exactLength:null,typeName:K.ZodArray,...we(t)});function _i(e){if(e instanceof Jt){let t={};for(let r in e.shape){let o=e.shape[r];t[r]=mn.create(_i(o))}return new Jt({...e._def,shape:()=>t})}else return e instanceof $r?new $r({...e._def,type:_i(e.element)}):e instanceof mn?mn.create(_i(e.unwrap())):e instanceof qn?qn.create(_i(e.unwrap())):e instanceof Kn?Kn.create(e.items.map(t=>_i(t))):e}var Jt=class e extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Re.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==re.object){let c=this._getOrReturnCtx(t);return ee(c,{code:W.invalid_type,expected:re.object,received:c.parsedType}),de}let{status:o,ctx:n}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Tn&&this._def.unknownKeys==="strip"))for(let c in n.data)a.includes(c)||s.push(c);let l=[];for(let c of a){let u=i[c],d=n.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new nn(n,d,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof Tn){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict")s.length>0&&(ee(n,{code:W.unrecognized_keys,keys:s}),o.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let d=n.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new nn(n,d,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>$t.mergeObjectSync(o,c)):$t.mergeObjectSync(o,l)}get shape(){return this._def.shape()}strict(t){return ie.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,o)=>{let n=this._def.errorMap?.(r,o).message??o.defaultError;return r.code==="unrecognized_keys"?{message:ie.errToObj(t).message??n}:{message:n}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:K.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let o of Re.objectKeys(t))t[o]&&this.shape[o]&&(r[o]=this.shape[o]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let o of Re.objectKeys(this.shape))t[o]||(r[o]=this.shape[o]);return new e({...this._def,shape:()=>r})}deepPartial(){return _i(this)}partial(t){let r={};for(let o of Re.objectKeys(this.shape)){let n=this.shape[o];t&&!t[o]?r[o]=n:r[o]=n.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let o of Re.objectKeys(this.shape))if(t&&!t[o])r[o]=this.shape[o];else{let i=this.shape[o];for(;i instanceof mn;)i=i._def.innerType;r[o]=i}return new e({...this._def,shape:()=>r})}keyof(){return p1(Re.objectKeys(this.shape))}};Jt.create=(e,t)=>new Jt({shape:()=>e,unknownKeys:"strip",catchall:Tn.create(),typeName:K.ZodObject,...we(t)});Jt.strictCreate=(e,t)=>new Jt({shape:()=>e,unknownKeys:"strict",catchall:Tn.create(),typeName:K.ZodObject,...we(t)});Jt.lazycreate=(e,t)=>new Jt({shape:e,unknownKeys:"strip",catchall:Tn.create(),typeName:K.ZodObject,...we(t)});var $i=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),o=this._def.options;function n(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Wt(s.ctx.common.issues));return ee(r,{code:W.invalid_union,unionErrors:a}),de}if(r.common.async)return Promise.all(o.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(n);{let i,a=[];for(let l of o){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(l=>new Wt(l));return ee(r,{code:W.invalid_union,unionErrors:s}),de}}get options(){return this._def.options}};$i.create=(e,t)=>new $i({options:e,typeName:K.ZodUnion,...we(t)});var Jn=e=>e instanceof Si?Jn(e.schema):e instanceof fn?Jn(e.innerType()):e instanceof Ri?[e.value]:e instanceof Ii?e.options:e instanceof Ti?Re.objectValues(e.enum):e instanceof Pi?Jn(e._def.innerType):e instanceof wi?[void 0]:e instanceof ki?[null]:e instanceof mn?[void 0,...Jn(e.unwrap())]:e instanceof qn?[null,...Jn(e.unwrap())]:e instanceof Uu||e instanceof Ei?Jn(e.unwrap()):e instanceof Ai?Jn(e._def.innerType):[],py=class e extends xe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.object)return ee(r,{code:W.invalid_type,expected:re.object,received:r.parsedType}),de;let o=this.discriminator,n=r.data[o],i=this.optionsMap.get(n);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ee(r,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),de)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,o){let n=new Map;for(let i of r){let a=Jn(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(n.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);n.set(s,i)}}return new e({typeName:K.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:n,...we(o)})}};function hy(e,t){let r=Wn(e),o=Wn(t);if(e===t)return{valid:!0,data:e};if(r===re.object&&o===re.object){let n=Re.objectKeys(t),i=Re.objectKeys(e).filter(s=>n.indexOf(s)!==-1),a={...e,...t};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let s of i){if(s==="__proto__")continue;let l=hy(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(r===re.array&&o===re.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],l=hy(a,s);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return r===re.date&&o===re.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var xi=class extends xe{_parse(t){let{status:r,ctx:o}=this._processInputParams(t),n=(i,a)=>{if(dy(i)||dy(a))return de;let s=hy(i.value,a.value);return s.valid?((my(i)||my(a))&&r.dirty(),{status:r.value,value:s.data}):(ee(o,{code:W.invalid_intersection_types}),de)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([i,a])=>n(i,a)):n(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}};xi.create=(e,t,r)=>new xi({left:e,right:t,typeName:K.ZodIntersection,...we(r)});var Kn=class e extends xe{_parse(t){let{status:r,ctx:o}=this._processInputParams(t);if(o.parsedType!==re.array)return ee(o,{code:W.invalid_type,expected:re.array,received:o.parsedType}),de;if(o.data.length<this._def.items.length)return ee(o,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),de;!this._def.rest&&o.data.length>this._def.items.length&&(ee(o,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...o.data].map((a,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new nn(o,a,o.path,s)):null}).filter(a=>!!a);return o.common.async?Promise.all(i).then(a=>$t.mergeArray(r,a)):$t.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Kn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Kn({items:e,typeName:K.ZodTuple,rest:null,...we(t)})};var gy=class e extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:o}=this._processInputParams(t);if(o.parsedType!==re.object)return ee(o,{code:W.invalid_type,expected:re.object,received:o.parsedType}),de;let n=[],i=this._def.keyType,a=this._def.valueType;for(let s in o.data)n.push({key:i._parse(new nn(o,s,o.path,s)),value:a._parse(new nn(o,o.data[s],o.path,s)),alwaysSet:s in o.data});return o.common.async?$t.mergeObjectAsync(r,n):$t.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(t,r,o){return r instanceof xe?new e({keyType:t,valueType:r,typeName:K.ZodRecord,...we(o)}):new e({keyType:vi.create(),valueType:t,typeName:K.ZodRecord,...we(r)})}},xs=class extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:o}=this._processInputParams(t);if(o.parsedType!==re.map)return ee(o,{code:W.invalid_type,expected:re.map,received:o.parsedType}),de;let n=this._def.keyType,i=this._def.valueType,a=[...o.data.entries()].map(([s,l],c)=>({key:n._parse(new nn(o,s,o.path,[c,"key"])),value:i._parse(new nn(o,l,o.path,[c,"value"]))}));if(o.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of a){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return de;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(c.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of a){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return de;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(c.value,u.value)}return{status:r.value,value:s}}}};xs.create=(e,t,r)=>new xs({valueType:t,keyType:e,typeName:K.ZodMap,...we(r)});var Ss=class e extends xe{_parse(t){let{status:r,ctx:o}=this._processInputParams(t);if(o.parsedType!==re.set)return ee(o,{code:W.invalid_type,expected:re.set,received:o.parsedType}),de;let n=this._def;n.minSize!==null&&o.data.size<n.minSize.value&&(ee(o,{code:W.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&o.data.size>n.maxSize.value&&(ee(o,{code:W.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function a(l){let c=new Set;for(let u of l){if(u.status==="aborted")return de;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let s=[...o.data.values()].map((l,c)=>i._parse(new nn(o,l,o.path,c)));return o.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:ie.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ie.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Ss.create=(e,t)=>new Ss({valueType:e,minSize:null,maxSize:null,typeName:K.ZodSet,...we(t)});var by=class e extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.function)return ee(r,{code:W.invalid_type,expected:re.function,received:r.parsedType}),de;function o(s,l){return zu({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hs(),wr].filter(c=>!!c),issueData:{code:W.invalid_arguments,argumentsError:l}})}function n(s,l){return zu({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hs(),wr].filter(c=>!!c),issueData:{code:W.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof ao){let s=this;return Ct(async function(...l){let c=new Wt([]),u=await s._def.args.parseAsync(l,i).catch(m=>{throw c.addIssue(o(l,m)),c}),d=await Reflect.apply(a,this,u);return await s._def.returns._def.type.parseAsync(d,i).catch(m=>{throw c.addIssue(n(d,m)),c})})}else{let s=this;return Ct(function(...l){let c=s._def.args.safeParse(l,i);if(!c.success)throw new Wt([o(l,c.error)]);let u=Reflect.apply(a,this,c.data),d=s._def.returns.safeParse(u,i);if(!d.success)throw new Wt([n(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Kn.create(t).rest(kr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,o){return new e({args:t||Kn.create([]).rest(kr.create()),returns:r||kr.create(),typeName:K.ZodFunction,...we(o)})}},Si=class extends xe{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Si.create=(e,t)=>new Si({getter:e,typeName:K.ZodLazy,...we(t)});var Ri=class extends xe{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ee(r,{received:r.data,code:W.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:t.data}}get value(){return this._def.value}};Ri.create=(e,t)=>new Ri({value:e,typeName:K.ZodLiteral,...we(t)});function p1(e,t){return new Ii({values:e,typeName:K.ZodEnum,...we(t)})}var Ii=class e extends xe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),o=this._def.values;return ee(r,{expected:Re.joinValues(o),received:r.parsedType,code:W.invalid_type}),de}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),o=this._def.values;return ee(r,{received:r.data,code:W.invalid_enum_value,options:o}),de}return Ct(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(o=>!t.includes(o)),{...this._def,...r})}};Ii.create=p1;var Ti=class extends xe{_parse(t){let r=Re.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(t);if(o.parsedType!==re.string&&o.parsedType!==re.number){let n=Re.objectValues(r);return ee(o,{expected:Re.joinValues(n),received:o.parsedType,code:W.invalid_type}),de}if(this._cache||(this._cache=new Set(Re.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let n=Re.objectValues(r);return ee(o,{received:o.data,code:W.invalid_enum_value,options:n}),de}return Ct(t.data)}get enum(){return this._def.values}};Ti.create=(e,t)=>new Ti({values:e,typeName:K.ZodNativeEnum,...we(t)});var ao=class extends xe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==re.promise&&r.common.async===!1)return ee(r,{code:W.invalid_type,expected:re.promise,received:r.parsedType}),de;let o=r.parsedType===re.promise?r.data:Promise.resolve(r.data);return Ct(o.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ao.create=(e,t)=>new ao({type:e,typeName:K.ZodPromise,...we(t)});var fn=class extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===K.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:o}=this._processInputParams(t),n=this._def.effect||null,i={addIssue:a=>{ee(o,a),a.fatal?r.abort():r.dirty()},get path(){return o.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let a=n.transform(o.data,i);if(o.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return de;let l=await this._def.schema._parseAsync({data:s,path:o.path,parent:o});return l.status==="aborted"?de:l.status==="dirty"?yi(l.value):r.value==="dirty"?yi(l.value):l});{if(r.value==="aborted")return de;let s=this._def.schema._parseSync({data:a,path:o.path,parent:o});return s.status==="aborted"?de:s.status==="dirty"?yi(s.value):r.value==="dirty"?yi(s.value):s}}if(n.type==="refinement"){let a=s=>{let l=n.refinement(s,i);if(o.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(o.common.async===!1){let s=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(s=>s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(n.type==="transform")if(o.common.async===!1){let a=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!io(a))return de;let s=n.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(a=>io(a)?Promise.resolve(n.transform(a.value,i)).then(s=>({status:r.value,value:s})):de);Re.assertNever(n)}};fn.create=(e,t,r)=>new fn({schema:e,typeName:K.ZodEffects,effect:t,...we(r)});fn.createWithPreprocess=(e,t,r)=>new fn({schema:t,effect:{type:"preprocess",transform:e},typeName:K.ZodEffects,...we(r)});var mn=class extends xe{_parse(t){return this._getType(t)===re.undefined?Ct(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};mn.create=(e,t)=>new mn({innerType:e,typeName:K.ZodOptional,...we(t)});var qn=class extends xe{_parse(t){return this._getType(t)===re.null?Ct(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};qn.create=(e,t)=>new qn({innerType:e,typeName:K.ZodNullable,...we(t)});var Pi=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),o=r.data;return r.parsedType===re.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Pi.create=(e,t)=>new Pi({innerType:e,typeName:K.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...we(t)});var Ai=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),o={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return gs(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Wt(o.common.issues)},input:o.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Wt(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}};Ai.create=(e,t)=>new Ai({innerType:e,typeName:K.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...we(t)});var Rs=class extends xe{_parse(t){if(this._getType(t)!==re.nan){let o=this._getOrReturnCtx(t);return ee(o,{code:W.invalid_type,expected:re.nan,received:o.parsedType}),de}return{status:"valid",value:t.data}}};Rs.create=e=>new Rs({typeName:K.ZodNaN,...we(e)});var T5=Symbol("zod_brand"),Uu=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),o=r.data;return this._def.type._parse({data:o,path:r.path,parent:r})}unwrap(){return this._def.type}},Bu=class e extends xe{_parse(t){let{status:r,ctx:o}=this._processInputParams(t);if(o.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return i.status==="aborted"?de:i.status==="dirty"?(r.dirty(),yi(i.value)):this._def.out._parseAsync({data:i.value,path:o.path,parent:o})})();{let n=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return n.status==="aborted"?de:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:o.path,parent:o})}}static create(t,r){return new e({in:t,out:r,typeName:K.ZodPipeline})}},Ei=class extends xe{_parse(t){let r=this._def.innerType._parse(t),o=n=>(io(n)&&(n.value=Object.freeze(n.value)),n);return gs(r)?r.then(n=>o(n)):o(r)}unwrap(){return this._def.innerType}};Ei.create=(e,t)=>new Ei({innerType:e,typeName:K.ZodReadonly,...we(t)});var P5={object:Jt.lazycreate},K;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(K||(K={}));var A5=vi.create,E5=bs.create,O5=Rs.create,M5=ys.create,C5=_s.create,D5=vs.create,j5=ws.create,N5=wi.create,F5=ki.create,L5=ks.create,z5=kr.create,U5=Tn.create,B5=$s.create,V5=$r.create,Z5=Jt.create,G5=Jt.strictCreate,H5=$i.create,W5=py.create,J5=xi.create,K5=Kn.create,q5=gy.create,X5=xs.create,Y5=Ss.create,Q5=by.create,eV=Si.create,tV=Ri.create,nV=Ii.create,rV=Ti.create,oV=ao.create,iV=fn.create,aV=mn.create,sV=qn.create,lV=fn.createWithPreprocess,cV=Bu.create;var Vu=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function We(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Vu(t,e.currentPath):t.join("/")}}function yy(e,t,r,o){o?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function Te(e,t,r,o,n){e[t]=r,yy(e,t,o,n)}function h1(e,t){let r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==K.ZodAny&&(r.items=me(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Te(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Te(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Te(r,"minItems",e.exactLength.value,e.exactLength.message,t),Te(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function g1(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let o of e.checks)switch(o.kind){case"min":t.target==="jsonSchema7"?o.inclusive?Te(r,"minimum",o.value,o.message,t):Te(r,"exclusiveMinimum",o.value,o.message,t):(o.inclusive||(r.exclusiveMinimum=!0),Te(r,"minimum",o.value,o.message,t));break;case"max":t.target==="jsonSchema7"?o.inclusive?Te(r,"maximum",o.value,o.message,t):Te(r,"exclusiveMaximum",o.value,o.message,t):(o.inclusive||(r.exclusiveMaximum=!0),Te(r,"maximum",o.value,o.message,t));break;case"multipleOf":Te(r,"multipleOf",o.value,o.message,t);break}return r}function b1(){return{type:"boolean"}}function Zu(e,t){return me(e.type._def,t)}var y1=(e,t)=>me(e.innerType._def,t);function _y(e,t,r){let o=r??t.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((n,i)=>_y(e,t,n))};switch(o){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return nj(e,t)}}var nj=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let o of e.checks)switch(o.kind){case"min":Te(r,"minimum",o.value,o.message,t);break;case"max":Te(r,"maximum",o.value,o.message,t);break}return r};function _1(e,t){return{...me(e.innerType._def,t),default:e.defaultValue()}}function v1(e,t){return t.effectStrategy==="input"?me(e.schema._def,t):We(t)}function w1(e){return{type:"string",enum:Array.from(e.values)}}var rj=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function k1(e,t){let r=[me(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),me(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),o=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach(i=>{if(rj(i))n.push(...i.allOf),i.unevaluatedProperties===void 0&&(o=void 0);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:s,...l}=i;a=l}else o=void 0;n.push(a)}}),n.length?{allOf:n,...o}:void 0}function $1(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}var vy,pn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(vy===void 0&&(vy=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),vy),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Gu(e,t){let r={type:"string"};if(e.checks)for(let o of e.checks)switch(o.kind){case"min":Te(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,t);break;case"max":Te(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"email":switch(t.emailStrategy){case"format:email":hn(r,"email",o.message,t);break;case"format:idn-email":hn(r,"idn-email",o.message,t);break;case"pattern:zod":Dt(r,pn.email,o.message,t);break}break;case"url":hn(r,"uri",o.message,t);break;case"uuid":hn(r,"uuid",o.message,t);break;case"regex":Dt(r,o.regex,o.message,t);break;case"cuid":Dt(r,pn.cuid,o.message,t);break;case"cuid2":Dt(r,pn.cuid2,o.message,t);break;case"startsWith":Dt(r,RegExp(`^${wy(o.value,t)}`),o.message,t);break;case"endsWith":Dt(r,RegExp(`${wy(o.value,t)}$`),o.message,t);break;case"datetime":hn(r,"date-time",o.message,t);break;case"date":hn(r,"date",o.message,t);break;case"time":hn(r,"time",o.message,t);break;case"duration":hn(r,"duration",o.message,t);break;case"length":Te(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,t),Te(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"includes":{Dt(r,RegExp(wy(o.value,t)),o.message,t);break}case"ip":{o.version!=="v6"&&hn(r,"ipv4",o.message,t),o.version!=="v4"&&hn(r,"ipv6",o.message,t);break}case"base64url":Dt(r,pn.base64url,o.message,t);break;case"jwt":Dt(r,pn.jwt,o.message,t);break;case"cidr":{o.version!=="v6"&&Dt(r,pn.ipv4Cidr,o.message,t),o.version!=="v4"&&Dt(r,pn.ipv6Cidr,o.message,t);break}case"emoji":Dt(r,pn.emoji(),o.message,t);break;case"ulid":{Dt(r,pn.ulid,o.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{hn(r,"binary",o.message,t);break}case"contentEncoding:base64":{Te(r,"contentEncoding","base64",o.message,t);break}case"pattern:zod":{Dt(r,pn.base64,o.message,t);break}}break}case"nanoid":Dt(r,pn.nanoid,o.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function wy(e,t){return t.patternStrategy==="escape"?ij(e):e}var oj=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ij(e){let t="";for(let r=0;r<e.length;r++)oj.has(e[r])||(t+="\\"),t+=e[r];return t}function hn(e,t,r,o){e.format||e.anyOf?.some(n=>n.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&o.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&o.errorMessages&&{errorMessage:{format:r}}})):Te(e,"format",t,r,o)}function Dt(e,t,r,o){e.pattern||e.allOf?.some(n=>n.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&o.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:x1(t,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})):Te(e,"pattern",x1(t,o),r,o)}function x1(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},o=r.i?e.source.toLowerCase():e.source,n="",i=!1,a=!1,s=!1;for(let l=0;l<o.length;l++){if(i){n+=o[l],i=!1;continue}if(r.i){if(a){if(o[l].match(/[a-z]/)){s?(n+=o[l],n+=`${o[l-2]}-${o[l]}`.toUpperCase(),s=!1):o[l+1]==="-"&&o[l+2]?.match(/[a-z]/)?(n+=o[l],s=!0):n+=`${o[l]}${o[l].toUpperCase()}`;continue}}else if(o[l].match(/[a-z]/)){n+=`[${o[l]}${o[l].toUpperCase()}]`;continue}}if(r.m){if(o[l]==="^"){n+=`(^|(?<=[\r
|
|
65
|
+
]))`;continue}else if(o[l]==="$"){n+=`($|(?=[\r
|
|
66
|
+
]))`;continue}}if(r.s&&o[l]==="."){n+=a?`${o[l]}\r
|
|
67
|
+
`:`[${o[l]}\r
|
|
68
|
+
]`;continue}n+=o[l],o[l]==="\\"?i=!0:a&&o[l]==="]"?a=!1:!a&&o[l]==="["&&(a=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return n}function Hu(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===K.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((o,n)=>({...o,[n]:me(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??We(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:me(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===K.ZodString&&e.keyType._def.checks?.length){let{type:o,...n}=Gu(e.keyType._def,t);return{...r,propertyNames:n}}else{if(e.keyType?._def.typeName===K.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===K.ZodBranded&&e.keyType._def.type._def.typeName===K.ZodString&&e.keyType._def.type._def.checks?.length){let{type:o,...n}=Zu(e.keyType._def,t);return{...r,propertyNames:n}}}return r}function S1(e,t){if(t.mapStrategy==="record")return Hu(e,t);let r=me(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||We(t),o=me(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||We(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,o],minItems:2,maxItems:2}}}function R1(e){let t=e.values,o=Object.keys(e.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[i]),n=Array.from(new Set(o.map(i=>typeof i)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:o}}function I1(e){return e.target==="openAi"?void 0:{not:We({...e,currentPath:[...e.currentPath,"not"]})}}function T1(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Is={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function A1(e,t){if(t.target==="openApi3")return P1(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(o=>o._def.typeName in Is&&(!o._def.checks||!o._def.checks.length))){let o=r.reduce((n,i)=>{let a=Is[i._def.typeName];return a&&!n.includes(a)?[...n,a]:n},[]);return{type:o.length>1?o:o[0]}}else if(r.every(o=>o._def.typeName==="ZodLiteral"&&!o.description)){let o=r.reduce((n,i)=>{let a=typeof i._def.value;switch(a){case"string":case"number":case"boolean":return[...n,a];case"bigint":return[...n,"integer"];case"object":if(i._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(o.length===r.length){let n=o.filter((i,a,s)=>s.indexOf(i)===a);return{type:n.length>1?n:n[0],enum:r.reduce((i,a)=>i.includes(a._def.value)?i:[...i,a._def.value],[])}}}else if(r.every(o=>o._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((o,n)=>[...o,...n._def.values.filter(i=>!o.includes(i))],[])};return P1(e,t)}var P1=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((o,n)=>me(o._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(o=>!!o&&(!t.strictUnions||typeof o=="object"&&Object.keys(o).length>0));return r.length?{anyOf:r}:void 0};function E1(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:Is[e.innerType._def.typeName],nullable:!0}:{type:[Is[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let o=me(e.innerType._def,{...t,currentPath:[...t.currentPath]});return o&&"$ref"in o?{allOf:[o],nullable:!0}:o&&{...o,nullable:!0}}let r=me(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function O1(e,t){let r={type:"number"};if(!e.checks)return r;for(let o of e.checks)switch(o.kind){case"int":r.type="integer",yy(r,"type",o.message,t);break;case"min":t.target==="jsonSchema7"?o.inclusive?Te(r,"minimum",o.value,o.message,t):Te(r,"exclusiveMinimum",o.value,o.message,t):(o.inclusive||(r.exclusiveMinimum=!0),Te(r,"minimum",o.value,o.message,t));break;case"max":t.target==="jsonSchema7"?o.inclusive?Te(r,"maximum",o.value,o.message,t):Te(r,"exclusiveMaximum",o.value,o.message,t):(o.inclusive||(r.exclusiveMaximum=!0),Te(r,"maximum",o.value,o.message,t));break;case"multipleOf":Te(r,"multipleOf",o.value,o.message,t);break}return r}function M1(e,t){let r=t.target==="openAi",o={type:"object",properties:{}},n=[],i=e.shape();for(let s in i){let l=i[s];if(l===void 0||l._def===void 0)continue;let c=sj(l);c&&r&&(l._def.typeName==="ZodOptional"&&(l=l._def.innerType),l.isNullable()||(l=l.nullable()),c=!1);let u=me(l._def,{...t,currentPath:[...t.currentPath,"properties",s],propertyPath:[...t.currentPath,"properties",s]});u!==void 0&&(o.properties[s]=u,c||n.push(s))}n.length&&(o.required=n);let a=aj(e,t);return a!==void 0&&(o.additionalProperties=a),o}function aj(e,t){if(e.catchall._def.typeName!=="ZodNever")return me(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function sj(e){try{return e.isOptional()}catch{return!0}}var C1=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return me(e.innerType._def,t);let r=me(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:We(t)},r]}:We(t)};var D1=(e,t)=>{if(t.pipeStrategy==="input")return me(e.in._def,t);if(t.pipeStrategy==="output")return me(e.out._def,t);let r=me(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),o=me(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,o].filter(n=>n!==void 0)}};function j1(e,t){return me(e.type._def,t)}function N1(e,t){let o={type:"array",uniqueItems:!0,items:me(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Te(o,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Te(o,"maxItems",e.maxSize.value,e.maxSize.message,t),o}function F1(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,o)=>me(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[]),additionalItems:me(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,o)=>me(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[])}}function L1(e){return{not:We(e)}}function z1(e){return We(e)}var U1=(e,t)=>me(e.innerType._def,t);var B1=(e,t,r)=>{switch(t){case K.ZodString:return Gu(e,r);case K.ZodNumber:return O1(e,r);case K.ZodObject:return M1(e,r);case K.ZodBigInt:return g1(e,r);case K.ZodBoolean:return b1();case K.ZodDate:return _y(e,r);case K.ZodUndefined:return L1(r);case K.ZodNull:return T1(r);case K.ZodArray:return h1(e,r);case K.ZodUnion:case K.ZodDiscriminatedUnion:return A1(e,r);case K.ZodIntersection:return k1(e,r);case K.ZodTuple:return F1(e,r);case K.ZodRecord:return Hu(e,r);case K.ZodLiteral:return $1(e,r);case K.ZodEnum:return w1(e);case K.ZodNativeEnum:return R1(e);case K.ZodNullable:return E1(e,r);case K.ZodOptional:return C1(e,r);case K.ZodMap:return S1(e,r);case K.ZodSet:return N1(e,r);case K.ZodLazy:return()=>e.getter()._def;case K.ZodPromise:return j1(e,r);case K.ZodNaN:case K.ZodNever:return I1(r);case K.ZodEffects:return v1(e,r);case K.ZodAny:return We(r);case K.ZodUnknown:return z1(r);case K.ZodDefault:return _1(e,r);case K.ZodBranded:return Zu(e,r);case K.ZodReadonly:return U1(e,r);case K.ZodCatch:return y1(e,r);case K.ZodPipeline:return D1(e,r);case K.ZodFunction:case K.ZodVoid:case K.ZodSymbol:return;default:return(o=>{})(t)}};function me(e,t,r=!1){let o=t.seen.get(e);if(t.override){let s=t.override?.(e,t,o,r);if(s!==l1)return s}if(o&&!r){let s=lj(o,t);if(s!==void 0)return s}let n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);let i=B1(e,e.typeName,t),a=typeof i=="function"?me(i(),t):i;if(a&&cj(e,t,a),t.postProcess){let s=t.postProcess(a,e,t);return n.jsonSchema=a,s}return n.jsonSchema=a,a}var lj=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Vu(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,o)=>t.currentPath[o]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),We(t)):t.$refStrategy==="seen"?We(t):void 0}},cj=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);var V1=e=>{let t=c1(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([o,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,o],jsonSchema:void 0}]))}};var Ts=(e,t)=>{let r=V1(t),o=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((l,[c,u])=>({...l,[c]:me(u._def,{...r,currentPath:[...r.basePath,r.definitionPath,c]},!0)??We(r)}),{}):void 0,n=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=me(e._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??We(r),a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;a!==void 0&&(i.title=a),r.flags.hasReferencedOpenAiAnyType&&(o||(o={}),o[r.openAiAnyTypeName]||(o[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let s=n===void 0?o?{...i,[r.definitionPath]:o}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...o,[n]:i}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s};function Z1(e,t){let r=[],o=[];for(let n of e){let i,a=0;for(let s of t){let l=Math.min(s.end,n.end)-Math.max(s.start,n.start);l>a&&(a=l,i=s)}i?r.push({dest:n,source:i,exact:i.start===n.start&&i.end===n.end}):o.push(n)}return{pairs:r,misses:o}}function G1(e,t){let r=e.time??e.timeline_range?.start;if(!r||!Number.isFinite(r.value))return null;let o=r.rate&&r.rate>0?r.rate:t;return Math.round(r.value*(t/o))}function H1(e,t){let r=e.duration??e.timeline_range?.duration;if(!r||!Number.isFinite(r.value))return 1;let o=r.rate&&r.rate>0?r.rate:t;return Math.max(1,Math.round(r.value*(t/o)))}function Oi(e){let t=(e.timelines??[]).filter(r=>r.kind==="primary");return t.length?t:e.timelines??[]}function Wu(e,t){if(t.media_reference_id)return(e.media_references??[]).find(r=>r.id===t.media_reference_id)}var uj={tc:35,reel:25,filename:20,camera_roll:10,duration:5,filepath:5},dj=[["Exact",95],["High",80],["Medium",60],["Low",40],["None",0]],mj=e=>dj.find(([,t])=>e>=t)?.[0]??"None";function ky(e){let t=(e??"").trim();for(let r of[".[","_["]){let o=t.lastIndexOf(r);o!==-1&&(t=t.slice(0,o))}return t}var Ju=e=>(e??"").trim().toLowerCase(),W1=(e,t=3)=>e?e.replace(/\\/g,"/").trim().replace(/\/+$/,"").split("/").filter(Boolean).slice(-t).join("/").toLowerCase():"",Mi=e=>typeof e=="number"&&Number.isFinite(e)?Math.trunc(e):null;function fj(e,t){let[r,o,n,i]=[Mi(e.src_start),Mi(e.src_end),Mi(t.src_start),Mi(t.src_end)];if(r===null||o===null||n===null||i===null||o<=r||i<=n)return 0;let a=Math.min(o,i)-Math.max(r,n);return a<=0?0:Math.min(1,a/Math.min(o-r,i-n))}var pj=e=>{let t=e*10,r=Math.round(t);return(t-Math.floor(t)===.5&&r%2?r-1:r)/10};function hj(e,t,r={}){let o={...uj,...r},n=m=>Math.max(0,Math.trunc(o[m])),i=Object.keys(o).reduce((m,p)=>m+n(p),0)||1,a=[],s={},l=0;if(n("tc")>0){let m=fj(e,t);l+=n("tc")*m,m>=.999?a.push("TC: full overlap"):m>0?a.push(`TC: ${Math.round(m*100)}% overlap`):s.tc={dest:[e.src_start,e.src_end],src:[t.src_start,t.src_end]}}let c=(m,p,g,_,v)=>{n(m)<=0||(p&&g&&p===g?(l+=n(m),a.push(_)):(p||g)&&(s[m]=v))};if(c("reel",Ju(e.reel_name),Ju(t.reel_name),`Reel: ${e.reel_name}`,{dest:e.reel_name,src:t.reel_name}),c("filename",ky(e.file_name).toLowerCase(),ky(t.file_name).toLowerCase(),`Filename: ${ky(e.file_name)}`,{dest:e.file_name,src:t.file_name}),c("camera_roll",Ju(e.camera_roll),Ju(t.camera_roll),`Camera Roll: ${e.camera_roll}`,{dest:e.camera_roll,src:t.camera_roll}),n("duration")>0){let m=Mi(e.src_dur),p=Mi(t.src_dur);m!==null&&p!==null&&Math.abs(m-p)<=1?(l+=n("duration"),a.push("Duration: match (\xB11f)")):m!==null&&p!==null&&(s.duration={dest:m,src:p,delta:p-m})}let u=W1(e.file_path),d=W1(t.file_path);c("filepath",u,d,"Path tail: match",{dest:u,src:d});let f=pj(l/i*100);return{score:f,band:mj(f),reasons:a,deltas:s}}function gj(e,t,r={}){return t.map(o=>({...o,match:hj(e,o,r.weights)})).filter(o=>o.match.score>=(r.minScore??0)).sort((o,n)=>n.match.score-o.match.score).slice(0,Math.max(1,Math.trunc(r.topN??5)))}function J1(e,t,r={}){return e.map(o=>{let n=gj(o,t,{weights:r.weights,topN:r.topN??3,minScore:r.minScore??40}),i=n[0]?.match;return{dest:o,matches:n,band:i?.band??"None",confident:!!i&&i.score>=(r.floor??95)}})}function bj(e){let t=e.replace(/\.[^.]*$/,""),r=/^([A-Z]\d{3})([A-Z]\d{3})/.exec(t)??/^([A-Za-z]?\d+[A-Za-z]?)[-_]([A-Za-z]?\d+)/.exec(t);if(r)return{scene:r[1],take:r[2]};let o=t.split("_");return o.length>=2?{scene:o[0],take:o[1]}:{scene:o[0].slice(0,4),take:""}}function K1(e,t){let r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=t?new RegExp(`^${r}[_-]?(\\d+)`,"i").exec(e):/(\d+)$/.exec(e);return o?Number(o[1]):void 0}function yj(e,t){let r=Math.max(1,t||10),o=new Set(e.filter(i=>!!i)),n=0;return e.map(i=>{if(i)return n=Math.max(n,i),i;let a=(Math.floor(n/r)+1)*r;for(;o.has(a);)a+=r;return o.add(a),n=a})}function _j(e,t,r,o){let n=Math.max(o?o[0]:-1/0,e-r),i=Math.min(o?o[1]:1/0,t+r);return[n,i>n?i:n+1]}function q1(e,t,r){let o=r.prefix??"VFX",n=Math.max(0,r.handles??6),i=r.startFrame??1001,a=r.digits??4,s=e.filter(m=>r.color==="All"||m.color===r.color).sort((m,p)=>m.frame-p.frame),l=yj(s.map(m=>K1(m.name,o)),r.increment??10),c=(m,p,g,_,v)=>{let[y,b]=_j(_[0],_[1],n,g.media_range),w=_[0]-y,k=bj(g.name??"");return{role:p,clip:g,scene:g.scene||k.scene,take:g.take||k.take,src_in:y,src_out:b,name:p==="HERO"?m:p==="REFERENCE"?`${m}_reference`:`${m}_${p}`,first:i,cut_in:i+w,cut_out:i+w+v-1,last:i+(b-y)-1}},u=s.map((m,p)=>{let g=`${o}_${String(l[p]).padStart(a,"0")}`,_=t.filter(x=>x.start<=m.frame&&m.frame<x.end&&x.media&&(!r.skipDisabled||x.enabled!==!1&&x.track_enabled!==!1)),v=r.referenceTrack?_.find(x=>x.track===r.referenceTrack):void 0,y=_.filter(x=>x!==v).sort((x,S)=>r.hero==="highest"?S.track-x.track:x.track-S.track),b=y.map((x,S)=>c(g,S===0?"HERO":`PLATE${String(S).padStart(2,"0")}`,x,[x.src_in,x.src_out],x.end-x.start)),w=y[0],k=v&&w?c(g,"REFERENCE",v,[v.src_in+(w.start-v.start),v.src_in+(w.end-v.start)],w.end-w.start):void 0,I=[`Shot: ${g}`];return b.length>1&&I.push(`Plates: ${b.map(x=>x.role).join(", ")}`),b[0]?.scene&&I.push(`Scene: ${b[0].scene}`),b[0]?.take&&I.push(`Take: ${b[0].take}`),{frame:m.frame,number:l[p],name:g,committed:!!K1(m.name,o),plates:b,reference:k,note:I.join(" | ")}}),d=[],f=0;for(let m of u){let p=[...m.plates,...m.reference?[m.reference]:[]];if(p.length){d.length&&(f+=Math.max(0,r.gap??0));for(let g of p){let _=g.src_out-g.src_in;d.push({shot:m.name,name:g.name,role:g.role,media:g.clip.media,track:1,src_in:g.src_in,src_out:g.src_out,rec_in:f,rec_out:f+_}),f+=_}}}return{shots:u,stringout:d}}var vj={"ACES 2065-1 (AP0)":"ap0",ADX:"adx","ARRI Wide Gamut":"arriwg","ARRI Wide Gamut 4":"arriwg4","BMD Film":"bmdfilm","BMD Film 4.6K":"bmdfilm46k","Canon DCI-P3+":"canonp3dci","Canon CineGamut":"canoncine",CFColor:"cfcolor","Cineon (printing density)":"cineonpd","DaVinci Wide Gamut":"dwg","DCI P3":"p3dci",DRAGONcolor:"dragonc",DRAGONcolor2:"dragonc2",REDWideGamutRGB:"rwg","Filmlight E-Gamut":"egamut","Panasonic V-Gamut":"vgamut","Rec. 709":"rec709","Rec. 2020":"rec2020","Sony S-Gamut":"sgamut","Sony S-Gamut3":"sgamut3","Sony S-Gamut3.Cine":"sgamut3-cine",sRGB:"srgb",XYZ:"xyz"},wj={"ACES 2065-1 (AP0)":"ap0",ACEScct:"acescct",ADX:"adx","ARRI LogC3":"logc3","ARRI LogC4":"logc4","BMD Log":"bmdlog","BMD Log 4.6K":"bmdlog46k","Canon Log2":"canonlog2","Canon Log3":"canonlog3",CFLog:"cflog","Cineon Log":"cineon","DaVinci Intermediate":"dint","DCI (2.6 Gamma)":"g26","Filmlight T-Log":"tlog",HLG:"hlg","ITU-R BT.1886 (2.4 Gamma)":"g24","Linear (1.0 Gamma)":"lin",LogCv3:"logc","Panasonic V-Log":"vlog","Rec. 709 (2.2 Gamma)":"g22",RedLog3G10:"log3g10",RedLogFilm:"redlogfilm","S-Log2":"slog2","S-Log3":"slog3","sRGB (2.2 Gamma)":"g22","ST-2084 (PQ)":"pq","SMPTE ST-2084 (PQ)":"pq"},kj={"Digital Cinema Distribution Master":"dcdm","Digital Cinema Distribution Master: Textless":"dcdm-txtls","Graded Archival Master":"gam","Non-Graded Archival Master":"nam","Non-Graded Archival Master: Textless":"nam-txtls","Video Display Master":"vdm"},$j={"8-bit":"8b","10-bit":"10b","12-bit":"12b","16-bit":"16b"},xj={"ProRes 422 Proxy":"prproxy","ProRes 422 LT":"prlt","ProRes 422":"pr422","ProRes 422 HQ":"prhq","ProRes 4444":"pr4444","ProRes 4444 XQ":"pr4444xq",DNxHD:"dnxhd","DNxHD HQ":"dnxhd-hq","DNxHD LB":"dnxhd-lb","DNxHR LB":"dnxhr-lb","DNxHR SQ":"dnxhr-sq","DNxHR HQ":"dnxhrhq","DNxHR HQX":"dnxhrhqx","DNxHR 444":"dnxhr444","H.264":"h264","H.265 / HEVC":"h265",AV1:"av1",VP9:"vp9","DPX 10-bit":"dpx10b","DPX 16-bit":"dpx16b","EXR 16-bit":"exr16b","EXR 32-bit":"exr32b","TIFF 8-bit":"tiff8b","TIFF 16-bit":"tiff16b",JPEG:"jpeg","JPEG 2000":"j2k",ARRIRAW:"arriraw","REDCODE RAW":"redraw","Cinema DNG":"cinemadng","XAVC-I":"xavc-i","XAVC-L":"xavc-l","XAVC HS":"xavc-hs","XDCAM HD":"xdcamhd","MXF OP1a":"mxf-op1a",CineForm:"cineform","Motion JPEG":"mjpeg"},Sj={"High Dynamic Range":"hdr","Standard Dynamic Range":"sdr"},Rj={"1.33 (4:3)":"133","1.78 (16:9)":"178","1.85 (Flat)":"185","2.00 (Univisium)":"200","2.35 (Scope)":"235","2.39 (Scope)":"239","2.40 (Scope)":"240"},Ij={"ACES 1.0":"aces100","ACES 1.03":"aces103","ACES 1.1":"aces110","ACES 1.2":"aces120","ACES 1.3":"aces130","ACES 2.0":"aces200"},Je=(e,t,r)=>({id:e,enabled:!0,value:t,order:r}),so=(e,t,r,o)=>({name:e,fields:[...t,...r.map(([n,i],a)=>Je(n,i,t.length+a))],caseTransform:"lowercase",separator:"_",folderStructure:o}),Ku=[Je("show","",0),Je("episode","s01e101",1)],$y=[["bitDepth","16-bit"],["colorspace","REDWideGamutRGB"],["gamma","RedLog3G10"],["date",""],["resolution","3840x2160"]],xy=[["bitDepth","16-bit"],["dynamicRange","Standard Dynamic Range"],["colorspace","XYZ"],["gamma","DCI (2.6 Gamma)"],["date",""],["aspectRatio","2.39 (Scope)"],["resolution","4096x1716"]],Di={conformtools:{name:"CONFORM.TOOLS",fields:[Je("marker","",0),Je("colorspace","Rec. 709",1),Je("gamma","ITU-R BT.1886 (2.4 Gamma)",2),Je("codec","ProRes 422 HQ",3),Je("date","",4),Je("time","",5),Je("artist","",6)],caseTransform:"uppercase",separator:"_",folderStructure:"{project}/{timeline}/{date}"},netflix_episodic_nam:so("Netflix: Episodic NAM",Ku,[["assetType","Non-Graded Archival Master"],...$y],"{show}_s{season}/{show}_{episode}_nam"),netflix_episodic_nam_textless:so("Netflix: Episodic NAM Textless",Ku,[["assetType","Non-Graded Archival Master: Textless"],...$y],"{show}_s{season}/{show}_{episode}_nam-txtls"),netflix_episodic_dcdm:so("Netflix: Episodic DCDM",Ku,[["assetType","Digital Cinema Distribution Master"],...xy],"{show}_s{season}/{show}_{episode}_dcdm"),netflix_film_nam:so("Netflix: Film NAM",[Je("film","",0),Je("reel","lp",1)],[["assetType","Non-Graded Archival Master"],...$y],"{film}_nam"),netflix_film_dcdm_sdr:so("Netflix: Film DCDM SDR",[Je("film","",0)],[["assetType","Digital Cinema Distribution Master"],...xy],"{film}_dcdm"),netflix_film_segmented:so("Netflix: Film Segmented/Reel",[Je("film","",0),Je("reel","r01",1)],[["assetType","Digital Cinema Distribution Master"],...xy],"{film}_dcdm/{reel}"),netflix_aces_episodic:so("Netflix: ACES Episodic",Ku,[["assetType","Non-Graded Archival Master"],["bitDepth","16-bit"],["acesVersion","ACES 1.03"],["colorspace","ACES 2065-1 (AP0)"],["gamma","Linear (1.0 Gamma)"],["date",""],["resolution","3840x2160"]],"{show}_s{season}/{show}_{episode}_nam_aces"),color_posting:{name:"Color Posting",fields:[Je("marker","",0),Je("colorspace","Rec. 709",1),Je("gamma","ITU-R BT.1886 (2.4 Gamma)",2),Je("date","",3)],caseTransform:"uppercase",separator:"_",folderStructure:"{project}/Deliveries/{date}"},tv_series:{name:"TV Series",fields:[Je("marker","",0),Je("show","",1),Je("episode","",2),Je("colorspace","Rec. 709",3),Je("version","v001",4)],caseTransform:"none",separator:"_",folderStructure:"{show}/Season_{season}/{episode}"}},qu=e=>String(e).padStart(2,"0"),Y1=(e=new Date)=>`${e.getFullYear()}${qu(e.getMonth()+1)}${qu(e.getDate())}`,Tj=(e=new Date)=>`${qu(e.getHours())}${qu(e.getMinutes())}`;function Q1(e,t){return t==="uppercase"?e.toUpperCase():t==="lowercase"?e.toLowerCase():e}var Sy={marker:"{MARKER}",timelineTC:"{TL_TC}",sourceTC:"{SRC_TC}"},Pj=new Set([...Object.keys(Sy),"date","time"]),Ci=(e,t)=>e.toLowerCase().replace(new RegExp(`[^${t}]`,"g"),""),Aj={colorspace:[vj,e=>Ci(e,"a-z0-9")],gamma:[wj,e=>Ci(e,"a-z0-9")],codec:[xj,e=>Ci(e,"a-z0-9")],assetType:[kj,e=>Ci(e,"a-z0-9-")],bitDepth:[$j,e=>Ci(e,"a-z0-9")],dynamicRange:[Sj,e=>e.toLowerCase()],aspectRatio:[Rj,e=>e.replace(/[^0-9]/g,"")],acesVersion:[Ij,e=>Ci(e,"a-z0-9")]};function Ej(e,t,r){if(Sy[e])return Sy[e];let o=r.customDropdownOptions?.[e]?.find(a=>a.label===t)?.abbr,n=Aj[e],i=o??(e==="date"?Y1(r.now):e==="time"?Tj(r.now):n?n[0][t]||n[1](t||""):t||"");return i&&!i.startsWith("{")?Q1(i,r.caseTransform):i}function Oj(e,t){let o=[...e].sort((n,i)=>n.order-i.order).filter(n=>n.enabled&&(n.value||Pj.has(n.id))).map(n=>({text:Ej(n.id,n.value,t),sep:n.separator})).filter(n=>n.text).reduce((n,i,a)=>a===0?i.text:n+(i.sep??t.separator)+i.text,"");if(t.markerName!==void 0){let n=Q1(t.markerName,t.caseTransform);o=o.includes("{MARKER}")?o.split("{MARKER}").join(n):o?`${n}_${o}`:n}return o}var Mj=["project","timeline","date","show","episode","season","film","reel","title"];function Cj(e,t){let r=e;for(let o of Mj)r=r.split(`{${o}}`).join(t[o]??"");return r.replace(/\/{2,}/g,"/").replace(/^\/+|\/+$/g,"")}var X1=e=>e?e.replace(/[:;]/g,"-"):"";function eR(e,t){let r=t.scope??"duration",o=Math.round(t.naming.handleFrames??0),n=e.filter(c=>c.color===t.color&&(r==="all"||(r==="frame"?c.duration<=1:c.duration>1))).sort((c,u)=>c.frame-u.frame),i={caseTransform:t.naming.caseTransform,customDropdownOptions:t.naming.customDropdownOptions,now:t.now,separator:t.naming.separator},a=n.map((c,u)=>{let d=Oj(t.naming.fields,{...i,markerName:c.name||`Marker_${u+1}`}).split("{TL_TC}").join(X1(c.tc)).split("{SRC_TC}").join(X1(c.srcTc)).replace(/[^\w-]+/g,t.naming.separator||"_"),f=t.startFrame+c.frame,m=f+Math.max(1,c.duration)-1,p=f-o,g=m+o;return p>g&&(p=g=Math.floor((f+m)/2)),{name:d,in:Math.max(t.startFrame,p),out:Math.min(t.lastFrame,g),marker:c,dupe:!1}}),s=new Set;for(let c of a)c.dupe=s.has(c.name),s.add(c.name);return{dir:Cj(t.naming.folderStructure,{date:Y1(t.now),...t.folder}),jobs:a}}function tR(e){return/[",\n\r]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function Dj(e){return e==null?"":String(e)}function Xu(e,t){let r=e.map(n=>tR(n.header)).join(","),o=t.map(n=>e.map(i=>tR(Dj(i.value(n)))).join(","));return[r,...o].join(`
|
|
69
|
+
`)}var Ry=["Blue","Cyan","Green","Yellow","Red","Pink","Purple","Fuchsia","Rose","Lavender","Sky","Mint","Lemon","Sand","Cocoa","Cream"];function nR(e,t){let r=Ze(e),o=_l(r,!!e.is_drop_frame),n=e.start_frame??0,i=new Map,a=(e.tracks??[]).filter(c=>c.kind==="Video")[0];for(let c of e.tracks??[])for(let u of c.items??[])i.set(u.id,{name:u.name??u.id});let s=c=>{for(let u of a?.items??[]){let d=u.timeline_range?.start?.value??0,f=u.timeline_range?.duration?.value??0;if(c>=d&&c<d+f)return u.name??u.id}return""},l=[];return(e.markers??[]).forEach((c,u)=>{let d=G1(c,r);if(d==null)return;let f=H1(c,r),m=c.id??`marker-${u}`,p=c.item_id&&i.get(c.item_id)?.name||s(d),g={id:m,marker:c,frame:d,tc:ce(n+d,r,o),duration:f,durationTc:f>1?ce(f,r,!1).replace(/^00:/,""):"",color:c.color??"",name:c.name??"",note:c.note??c.comment??"",clip:p,cells:{}};g.cells={tc:g.tc,frame:d,color:g.color,name:g.name,note:g.note,duration:g.durationTc,clip:p,item_id:c.item_id??"",frames:f},l.push(g)}),l.sort((c,u)=>c.frame-u.frame)}var rR={...Object.fromEntries(Ry.map(e=>[e.toLowerCase(),t=>t.color.toLowerCase()===e.toLowerCase()])),duration:e=>e.duration>1};function oR(e){return Xu([{header:"Record TC",value:r=>r.tc},{header:"Source TC",value:()=>""},{header:"Frame",value:r=>r.frame},{header:"Color",value:r=>r.color},{header:"Source",value:r=>r.marker.item_id?"clip":"timeline"},{header:"Clip Name",value:r=>r.clip},{header:"Name",value:r=>r.name},{header:"Note",value:r=>r.note},{header:"Duration",value:r=>r.duration},{header:"Keywords",value:()=>""},{header:"Custom Data",value:r=>r.marker.metadata?JSON.stringify(r.marker.metadata):""}],e)}var jj=["#","timeline","track","track_no","track_name","track_enabled","name","timeline_range.start","timeline_range.dur","rec_in_tc","rec_out_tc","source_range.start","source_range.dur","media_reference_id","enabled","reel_name","speed","binding_state","effect_names","speed_ramped","kind"],Nj=["tc","frame","color","name","note","duration","frames","clip","item_id"];function gn(e){let t=String(e.cells.track_no??e.cells.track??"").match(/^([VA])(\d+)$/),r=Number(e.cells["timeline_range.start"]);return!t||!Number.isFinite(r)?null:{kind:t[1]==="V"?"video":"audio",track:Number(t[2]),start:r}}var Yu=(e,t)=>e.media.find(r=>r.id===`mr:${t.cells.media_reference_id}`);function Ps(e,t){let r=gn(t);return r?e.items.find(o=>o.kind===r.kind&&o.track===r.track&&o.start===r.start)??null:null}var $7=[...Ry];async function iR(e,t,r="resolve"){let o=await e("host_export",{host:r,...t?{timeline:t}:{}});if(!o.ok||!o.session_id)throw new Error(o.text);return Iy(e,String(o.session_id),{host:r,project:String(o.project??""),timeline:String(o.timeline??"")})}async function Iy(e,t,r={}){let o=r.host,n={ok:!0,text:""},i=Promise.resolve(n),[a,s,l,c,u]=await Promise.all([o==="resolve"?e("host_items",{timeline:r.timeline}):o==="premiere"?e("host_items",{host:o,timeline:r.timeline}).then(d=>d.ok?d:n,()=>n):i,e("timeline_query",{session_id:t,table:"clips",limit:5e3,columns:jj}),e("timeline_query",{session_id:t,table:"markers",limit:5e3,columns:Nj}),o?e("host_project",{host:o,timeline:r.timeline}).catch(()=>({ok:!1,text:""})):i,e("timeline_query",{session_id:t,table:"media",limit:5e3,columns:["name","target_url","available_range.start","available_range.dur","source_fps"]})]);for(let d of[a,s,l])if(!d.ok)throw new Error(d.text);return{host:o,project:r.project??"",timeline:r.timeline??"",session_id:t,start_frame:Number(a.start_frame??0),fps:Number(s.fps??24),frames:Math.max(0,...(s.rows??[]).map(d=>Number(d.cells["timeline_range.start"]??0)+Number(d.cells["timeline_range.dur"]??0))),clips:s.rows??[],markers:l.rows??[],media:u.rows??[],items:a.items??[],color_groups:a.color_groups??[],layers:Number(a.layers??1),tracks:c.tracks??[]}}function Ty(e,t){let r=Number(t.cells.frame),o=String(t.cells.item_id??"");if(!o)return{frame:r};let n=e.clips.find(a=>a.id===o),i=n&&gn(n);return!n||!i?null:{item:{kind:i.kind??"video",track:i.track,start:i.start},frame:Number(n.cells["source_range.start"]??0)+r-i.start}}function Fj(e,t){let r=e.clips.map(o=>({c:o,ref:gn(o)})).filter(({ref:o,c:n})=>o&&o.kind==="video"&&t>=o.start&&t<o.start+Number(n.cells["timeline_range.dur"]??0)).sort((o,n)=>n.ref.track-o.ref.track)[0];return r&&{item:{kind:"video",track:r.ref.track,start:r.ref.start},frame:Number(r.c.cells["source_range.start"]??0)+t-r.ref.start}}function aR(e,t,r,o,n){let i=[];for(let a of t){let s=Ty(e,a);if(!s)continue;let l=String(a.cells.name??""),c=String(a.cells.note??""),u=Math.max(1,Number(a.cells.frames??1)),d={...s.item?{item:s.item}:{},frame:s.frame};if(r==="recolor")i.push({op:"marker_update",...d,color:o});else if(r==="swap"){let f=String(a.cells.color);(f===o||f===n)&&i.push({op:"marker_update",...d,color:f===o?n:o})}else if(r==="rename")i.push({op:"marker_update",...d,name:n});else if(r==="note")i.push({op:"marker_update",...d,note:n});else if(r==="prefix")i.push({op:"marker_update",...d,name:`${n}${l}`});else if(r==="suffix")i.push({op:"marker_update",...d,name:`${l}${n}`});else if(r==="delete")i.push({op:"marker_delete",...d});else{let f=r==="to_clip"?s.item?null:Fj(e,s.frame):s.item?{frame:Number(a.cells.frame)}:null;if(!f)continue;i.push({op:"marker_delete",...d}),i.push({op:"marker_add",...f,color:String(a.cells.color||"Blue"),name:l,note:c,duration:u})}}return i}var xt=e=>({track:e.track,start:e.start}),Ay=[["color","Clip colour"],["flag","Add flag"],["unflag","Clear flags"],["enable","Enable"],["disable","Disable"],["marker","Add marker"],["keywords","Keywords"],["version_add","New grade version"],["version_load","Load grade version"],["group","Colour group"],["ungroup","Leave colour group"],["prefix","Name prefix"],["suffix","Name suffix"],["cache_on","Colour cache on"],["cache_off","Colour cache off"]];function Ey(e,t){return e.clips.filter(r=>!t||t.has(r.id)).map(r=>{let o=Ps(e,r);return{id:r.id,cells:{...r.cells,name:o?.name??r.cells.name,color:o?.color??"",flags:o?.flags.join(", ")??"",on:o?o.enabled?"on":"off":"",version:o?.version??"",group:o?.group??"",nodes:o?.nodes||"",keywords:o?.keywords??"",effects:o?.effects?.length?o.effects.join(", "):String(r.cells.effect_names??""),stabilized:o?.stabilized||/stabiliz/i.test(String(r.cells.effect_names??""))?"yes":"",retimed:o?.remapped||r.cells.speed_ramped===!0||r.cells.speed!=null&&Math.abs(Number(r.cells.speed)-100)>1e-6?"yes":""}}})}function lR(e,t,r,o,n){let i=[];for(let a of t){let s=gn(a),l=Ps(e,a);if(!s||!l)continue;let c={kind:s.kind,track:s.track,start:s.start};switch(r){case"color":i.push({op:"clip_color",item:c,color:o});break;case"flag":i.push({op:"flags",item:c,add:[o]});break;case"unflag":i.push({op:"flags",item:c,clear:"All"});break;case"enable":case"disable":i.push({op:"enabled",item:c,on:r==="enable"});break;case"marker":i.push({op:"marker_add",frame:s.start,color:o,name:n||"conform.tools",note:l.name});break;case"keywords":i.push({op:"metadata",item:c,set:{Keywords:n}});break;case"version_add":i.push({op:"version",item:c,add:n});break;case"version_load":i.push({op:"version",item:c,load:n});break;case"group":i.push({op:"color_group",item:c,group:n});break;case"ungroup":i.push({op:"color_group",item:c,group:""});break;case"prefix":i.push({op:"name",item:c,name:`${n}${l.name}`});break;case"suffix":i.push({op:"name",item:c,name:`${l.name}${n}`});break;case"cache_on":case"cache_off":i.push({op:"cache",item:c,color:r==="cache_on"});break}}return r==="marker"?i.filter((a,s)=>i.findIndex(l=>l.frame===a.frame)===s):i}var td=e=>[...e.clip_list??[],...(e.folders??[]).flatMap(td)],Oy=e=>e.match(/^(\/Volumes\/[^/]+|[A-Za-z]:\\|\/mnt\/[^/]+|\/[^/]+)/)?.[1]??"(no file)",cR=(e,t="")=>td(e).filter(r=>(r.usage===""||r.usage==="0")&&(!t||r.folder!==t)).map(r=>({id:r.id,cells:{name:r.name,folder:r.folder||"Master",start_tc:r.start_tc||"",file:r.file||"",drive:Oy(r.file)}})),uR=(e,t,r)=>e.length?[t==="remove"?{op:"pool_delete",clips:e.map(o=>o.id)}:{op:"pool_move",clips:e.map(o=>o.id),folder:r||"UNUSED MEDIA",create:!0}]:[],nd=[["grade","Grade",[]],["sizing","Sizing",["ZoomGang","Pan","Tilt","ZoomX","ZoomY","RotationAngle","AnchorPointX","AnchorPointY","Pitch","Yaw","FlipX","FlipY"]],["crop","Crop",["CropLeft","CropRight","CropTop","CropBottom","CropSoftness","CropRetain"]],["composite","Composite + opacity",["CompositeMode","Opacity"]],["clip_color","Clip colour",[]],["flags","Flags",[]]];function Lj(e,t,r){let o=!!e.media_id&&e.media_id===t.media_id;return r?{certain:!0,same_media:o,why:"same edit position"}:o?e.src_in!=null&&t.src_in!=null&&Math.abs(t.src_in-e.src_in-(t.start-e.start))<=1?{certain:!0,same_media:o,why:"same media, same moment"}:{certain:!1,same_media:o,why:"same media but another part of the take"}:{certain:!1,same_media:o,why:"different media and not at the same edit position"}}var zj=1;function rd(e,t,r){let o=Lj(e,t,r);return e.version_type===zj&&o.same_media?{do:"remote",why:`remote grade '${e.version}' selected`}:o.certain?{do:"copy",why:o.why}:{do:"skip",why:`not sure this is the same shot (${o.why}): no grade copied`}}function dR(e,t,r){let o=e.items.filter(a=>a.kind==="video"),{pairs:n,misses:i}=Z1(o.filter(a=>a.track===r),o.filter(a=>a.track===t));return[...n.map(a=>({id:a.dest.id,dest:a.dest,source:a.source,exact:a.exact})),...i.map(a=>({id:a.id,dest:a,source:void 0,exact:!1}))].sort((a,s)=>a.dest.start-s.dest.start).map(a=>{let s=a.source?rd(a.source,a.dest,a.exact):void 0;return{id:a.id,dest:a.dest,source:a.source,exact:a.exact,cells:{clip:a.dest.name,record:a.dest.start,from:a.source?a.source.name:"no clip above",color:a.source?.color??"",fit:s?s.do==="remote"?"remote: select":s.do==="copy"?a.exact?"exact":"same moment":"not sure":"",nodes:a.source?.nodes??""}}})}function mR(e,t,r){let o=[],n=new Map,i=new Map,a=[];for(let l of e){let c=l.dest,u=l.source;if(!u){r&&o.push({op:"marker_add",frame:c.start,color:r,name:"Copy Grades: no source",note:c.name,data:"ConformTools:copy-grades"});continue}let d=`${u.track}:${u.start}`;if(n.set(d,{src:u,dests:[...n.get(d)?.dests??[],c]}),!t.has("grade"))continue;let f=rd(u,c,!!l.exact);f.do==="remote"?a.push({op:"version",item:xt(c),type:"remote",load:u.version}):f.do==="copy"?i.set(d,[...i.get(d)??[],c]):o.push({op:"marker_add",frame:c.start,color:r||"Yellow",name:"Copy Grades: not sure",note:`${c.name}: ${f.why}`,data:"ConformTools:copy-grades"})}let s=nd.filter(([l])=>t.has(l)).flatMap(([,,l])=>l);for(let[l,{src:c,dests:u}]of n){let d=i.get(l);d?.length&&a.push({op:"copy_grade",item:xt(c),to:d.map(xt)}),s.length&&a.push({op:"copy_properties",item:xt(c),to:u.map(xt),keys:s});for(let f of u)t.has("clip_color")&&f.color!==c.color&&a.push({op:"clip_color",item:xt(f),color:c.color}),t.has("flags")&&f.flags.join()!==c.flags.join()&&a.push({op:"flags",item:xt(f),clear:"All",add:c.flags})}return[...a,...o]}function My(e,t,r){let o={clips:t,media:r};return t.flatMap(n=>{let i=gn(n);if(!i||i.kind!=="video")return[];let a=Yu(o,n),s=a?String(a.cells.target_url??""):"",l=Number(a?.cells["available_range.start"]),c=Number(a?.cells["available_range.dur"]);return[{timeline:e,track:i.track,start:i.start,name:String(n.cells.name??""),file_name:s?s.split(/[\\/]/).pop():String(n.cells.name??""),file_path:s||null,reel_name:n.cells.reel_name??null,src_start:Number.isFinite(l)?l:null,src_end:Number.isFinite(l)&&Number.isFinite(c)?l+c:null}]})}function fR(e,t,r){return J1(e,t,r).map(o=>({id:`${o.dest.track}:${o.dest.start}`,trace:o,cells:{clip:o.dest.name,at:`V${o.dest.track} ${o.dest.start}`,match:`${o.band}${o.matches[0]?` ${o.matches[0].match.score}`:""}`,from:o.matches[0]?`${o.matches[0].timeline} \xB7 V${o.matches[0].track} \xB7 ${o.matches[0].name}`:"",why:o.matches[0]?.match.reasons.join(", ")??"",others:Math.max(0,o.matches.length-1),trusted:o.confident?"trusted":o.matches.length?"review":"unmatched"}}))}function pR(e,t){let r=[];for(let o of e){let n=o.trace,i=[xt(n.dest)];if(!n.matches.length||t.onlyTrusted&&!n.confident&&!t.variants){t.markColor&&!n.matches.length&&r.push({op:"marker_add",frame:n.dest.start,color:t.markColor,name:"Grade Tracer: no match",note:n.dest.name,data:"ConformTools:trace"});continue}(t.variants?n.matches:n.matches.slice(0,1)).forEach((a,s)=>{t.variants&&r.push({op:"version",item:i[0],add:`trace ${s+1} \xB7 ${a.match.score} \xB7 ${a.timeline}`}),r.push({op:"copy_grade",from_timeline:a.timeline,item:xt(a),to:i})})}return r}var rn=(e,t=3)=>Math.abs(e)<1e-9?"0":e.toFixed(t).replace(/\.?0+$/,"");function hR(e,t){return e.map(r=>{let o=r.properties,n=r.grade_sizing,i=r.grade_keys,a=r.edit_keys,s=r.verdict==="aligned"||r.verdict==="animated"&&!!(i?.length||a?.length);return{id:r.item_id,track:r.track,start:r.start,end:r.end,transform:r.transform,keys:r.keys?.map(l=>({record:l.record,transform:l.transform})),cells:{record_tc:r.record_tc,track:`V${r.track}`,name:r.name,verdict:r.verdict==="refused"?"not aligned":r.verdict.replace("_"," "),confidence:r.confidence==null?"":rn(r.confidence,2),sizing:i?.length?`Colour page ${t==="node"?"Node":"Input"} Sizing \xB7 ${i.length} keyframes${i.some(l=>l.ease_in)?" \xB7 eased":""} (${r.keys?.length??i.length} frames measured)`:a?.length?`Edit page \xB7 ${a.length} keyframes${a.some(l=>l.shape)?" \xB7 eased":""} on the timeline's ALIGNED copy (${r.keys?.length??a.length} frames measured)`:n?`Colour page \xB7 Zoom ${rn(n.zoom,4)}${n.height!==1?` \xB7 Height ${rn(n.height,4)}`:""} \xB7 Pan ${rn(n.pan,4)} \xB7 Tilt ${rn(n.tilt,4)} \xB7 Rotate ${rn(n.rotation,2)}\xB0${n.flip_x?" \xB7 Flip H":""}${n.flip_y?" \xB7 Flip V":""}`:o?`Zoom ${rn(o.ZoomX,4)}${o.ZoomY!==o.ZoomX?`\xD7${rn(o.ZoomY,4)}`:""} \xB7 Pan ${rn(o.Pan,1)} \xB7 Tilt ${rn(o.Tilt,1)} \xB7 Rot ${rn(o.RotationAngle,2)}\xB0${o.FlipX?" \xB7 FlipX":""}${o.FlipY?" \xB7 FlipY":""}`:"",why:r.verdict==="aligned"?"":r.reason??"",cant:s?"":"not aligned"}}})}function gR(e,t,r){let o=new Set(t.map(n=>`${n.track}:${n.start}`));return e.filter(n=>n.op==="properties"||n.op==="grade_sizing"||n.op==="edit_keys"?o.has(`${n.item.track}:${n.item.start}`):r)}var bR=e=>e.map((t,r)=>({id:`${t.item_id}@${t.record_start}#${r}`,finding:t,cells:{record_tc:t.record_tc,frames:t.frames,track:`V${t.track}`,name:t.name,edges:["top","bottom","left","right"].filter(o=>t.edges[o]>0).map(o=>`${o} ${t.edges[o]}`).join(" \xB7 "),fix:t.zoom_fix==null?"keyframed: marker only":`\xD7 ${rn(t.zoom_fix,4)}`}}));function yR(e,t,r,o){let n=t.map(s=>s.finding),i=new Set(n.map(s=>s.record_start)),a=new Set(n.flatMap(s=>r.items.filter(l=>l.kind==="video"&&l.track===s.track&&l.start<=s.record_start&&s.record_start<l.end).map(l=>`${l.track}:${l.start}`)));return e.filter(s=>s.op==="properties"?o&&a.has(`${s.item.track}:${s.item.start}`):s.op==="marker_add"?i.has(Number(s.frame)):!0)}var Py={only_in_a:["Removed in B","Red"],only_in_b:["New in B","Green"],different_file:["Other media","Yellow"],same_name_different_clip:["Same name, other clip","Purple"],source_tc:["Slipped","Cyan"]},Qu=e=>e?`${e.file} @ ${e.src_tc??"\u2013"} [${e.track}]`:"",_R=(e,t)=>e.map((r,o)=>({id:String(o),cells:{rec_in_tc:r.rec_in_tc,rec_out_tc:r.rec_out_tc,frames:r.frames,kind:Py[r.kind]?.[0]??r.kind,a:Qu(r.a),b:Qu(r.b),tc:r.rec_in_tc},op:{op:"marker_add",frame:r.rec_in-t,color:Py[r.kind]?.[1]??"Blue",name:`Reconform: ${Py[r.kind]?.[0]??r.kind}`,note:`${r.note??""}
|
|
70
|
+
A ${Qu(r.a)}
|
|
71
|
+
B ${Qu(r.b)}`.trim(),duration:Math.max(1,r.frames),data:"ConformTools:reconform"}}));function sR(e){return e.clips.flatMap(t=>{let r=gn(t),o=Ps(e,t);if(!r||r.kind!=="video"||!o)return[];let n=Yu(e,t),i=o.media_id||String(n?.cells.target_url??"")||`${t.cells.reel_name??""}|${t.cells.name??""}`,a=Number(t.cells["source_range.start"]??o.src_in),s=Number(t.cells["source_range.dur"]??o.end-o.start);return!Number.isFinite(a)||!Number.isFinite(s)?[]:[{it:o,key:i,s0:a,s1:a+Math.max(1,s),tc:String(t.cells.rec_in_tc??"")}]})}function vR(e,t){let r=sR(e),o=new Map;for(let n of r)o.set(n.key,[...o.get(n.key)??[],n]);return sR(t).sort((n,i)=>n.it.start-i.it.start||n.it.track-i.it.track).map(n=>{let i=(o.get(n.key)??[]).map(c=>({s:c,shared:Math.min(c.s1,n.s1)-Math.max(c.s0,n.s0)})).filter(c=>c.shared>0).sort((c,u)=>u.shared-c.shared||Math.abs(c.s.it.start-n.it.start)-Math.abs(u.s.it.start-n.it.start)),a=i[0],s=a?Math.round(100*a.shared/(n.s1-n.s0)):0,l=a?rd(a.s.it,n.it,!0):void 0;return{id:`${n.it.track}:${n.it.start}`,dest:n.it,source:a?.s.it,d_src:n.s0,a_src:a?.s.s0,cells:{clip:n.it.name,record:n.tc,from:a?`V${a.s.it.track} ${a.s.it.name} @ ${a.s.tc}`:"new in B",cover:a?`${s}%`:"",grade:l?l.do==="remote"?`remote '${a.s.it.version}'`:`${a.s.it.nodes} node${a.s.it.nodes===1?"":"s"}`:"",pieces:i.length>1?`A has ${i.length} pieces`:"",b_tl:t.timeline,b_at:n.it.start,...a?{a_tl:e.timeline,a_at:a.s.it.start+Math.max(0,n.s0-a.s.s0)}:{}}}})}var od=[["grade","Grade"],["sizing","Sizing"],["crop","Crop"],["composite","Composite + opacity"],["clip_color","Clip colour"],["markers","Clip markers"]];function wR(e,t,r,o){let n=[],i=nd.filter(([s])=>t.has(s)).flatMap(([,,s])=>s),a=r.timeline;for(let s of e){let l=s.dest,c=s.source;if(!c){o&&n.push({op:"marker_add",frame:l.start,color:o,name:"Reconform: new in B",note:l.name,data:"ConformTools:reconform"});continue}if(t.has("grade")&&(rd(c,l,!0).do==="remote"?n.push({op:"version",item:xt(l),type:"remote",load:c.version}):n.push({op:"copy_grade",from_timeline:a,item:xt(c),to:[xt(l)]})),i.length&&n.push({op:"copy_properties",from_timeline:a,item:xt(c),to:[xt(l)],keys:i}),t.has("clip_color")&&c.color!==l.color&&n.push({op:"clip_color",item:xt(l),color:c.color}),t.has("markers")){let u=Number(s.d_src),d=l.end-l.start;for(let f of r.markers){let m=Ty(r,f);!m?.item||m.item.track!==c.track||m.item.start!==c.start||m.frame<u||m.frame>=u+d||n.push({op:"marker_add",item:{kind:"video",...xt(l)},frame:m.frame,color:String(f.cells.color??"Blue"),name:String(f.cells.name??""),note:String(f.cells.note??""),duration:Math.max(1,Number(f.cells.frames??1))})}}}return n}var ed=(e,t)=>{let r=Math.round(t)||24,o=n=>String(Math.floor(n)).padStart(2,"0");return`${o(e/(r*3600))}:${o(e/(r*60)%60)}:${o(e/r%60)}:${o(e%r)}`},Uj=e=>["bt","bb","bl","br"].filter(t=>e[t]>0).map(t=>`${{bt:"top",bb:"bottom",bl:"left",br:"right"}[t]} ${e[t]} px`).join(", ");function kR(e){let t=[...e.blanking.map((n,i)=>({id:`b${i}`,start:n.start_frame,cells:{tc:ed(n.start_frame,e.fps),out:ed(n.end_frame,e.fps),kind:"Black edges",clip:n.clip.name,detail:Uj(n.measured)}})),...e.black.map((n,i)=>({id:`k${i}`,start:n.start_frame,cells:{tc:ed(n.start_frame,e.fps),out:ed(n.end_frame,e.fps),kind:"Black frames",clip:"",detail:`${n.frames} frame${n.frames===1?"":"s"}, darkest ${n.darkest}`}}))].sort((n,i)=>n.start-i.start),r=e.audio?.integrated_lufs,o=[`${e.frames} frames \xB7 ${e.blanking.length} black-edge range(s) \xB7 ${e.black.length} black-frame range(s)${r!=null?` \xB7 ${r<-70?"silent":`${r.toFixed(1)} LUFS`}`:""}${e.audio?.true_peak_dbtp!=null&&e.audio.true_peak_dbtp>-70?` \xB7 ${e.audio.true_peak_dbtp.toFixed(1)} dBTP`:""}`,e.checks.map(n=>`${n.label}: ${n.status}`).join(" \xB7 "),...e.notes].filter(Boolean).join(`
|
|
72
|
+
`);return{rows:t,text:o}}function $R(e,t){let r=e.clips.flatMap(i=>{let a=gn(i),s=Ps(e,i),l=Yu(e,i);if(!a||a.kind!=="video"||!s)return[];let c=Number(i.cells["source_range.start"]??0),u=Number(l?.cells["available_range.start"]),d=Number(l?.cells["available_range.dur"]);return[{...s,media:String(l?.cells.target_url??"")||void 0,src_in:c,src_out:c+(s.end-s.start),media_range:Number.isFinite(u)&&d>0?[u,u+d]:void 0,track_enabled:i.cells.track_enabled!==!1}]}),o=q1(e.markers.map(i=>({frame:Number(i.cells.frame),color:String(i.cells.color),name:String(i.cells.name??""),note:String(i.cells.note??"")})),r,t),n=o.shots.flatMap(i=>[...i.plates,...i.reference?[i.reference]:[]].map((a,s)=>({id:`${i.name}-${s}`,shot:i.name,pull:a.name,cells:{shot:i.name,role:a.role,name:a.name,clip:`${a.clip.name??""}${a.scene?` \xB7 sc ${a.scene}`:""}${a.take?` tk ${a.take}`:""}`,frames:`${a.first}\u2013${a.last}`,cut:`${a.cut_in}\u2013${a.cut_out}`}})));return{...o,rows:n}}var xR=(e,t)=>{let r=new Set(t.map(o=>o.shot));return e.shots.filter(o=>r.has(o.name)).map(o=>({op:"marker_update",frame:o.frame,name:o.name,note:o.note}))},Cy=(e,t)=>{let r=new Set(t.map(o=>o.pull));return e.stringout.filter(o=>r.has(o.name)&&o.media)};function SR(e,t,r,o,n="",i=""){let a=/\\/.test(o)?"\\":"/";return Cy(e,t).map(s=>({name:s.name,in:r+s.rec_in,out:r+s.rec_out-1,target_dir:`${o.replace(/[\\/]$/,"")}${a}${s.shot}`,...(s.role==="REFERENCE"?i:n)?{preset:s.role==="REFERENCE"?i:n}:{}}))}var id=Object.entries(Di).map(([e,t])=>[e,t.name]);function RR(e,t){let r=Di[t.naming]??Di.conformtools,o={...r,handleFrames:t.handles,fields:r.fields.map(l=>t.fields[l.id]?{...l,value:t.fields[l.id]}:l)},n=e.start_frame+Math.max(0,...e.items.map(l=>l.end))-1,i=eR(e.markers.map(l=>({frame:Number(l.cells.frame),duration:Number(l.cells.frames??1),color:String(l.cells.color),name:String(l.cells.name??""),tc:String(l.cells.tc??"")})),{color:t.color,scope:t.scope,naming:o,startFrame:e.start_frame,lastFrame:n,folder:{project:e.project,timeline:e.timeline,...Object.fromEntries(o.fields.map(l=>[l.id,l.value])),...t.fields}}),a=/\\/.test(t.root)?"\\":"/",s=t.root?`${t.root.replace(/[\\/]$/,"")}${i.dir?a+i.dir:""}`:"";return i.jobs.map((l,c)=>({id:String(c),job:{name:l.name,in:l.in,out:l.out,target_dir:s,...t.preset?{preset:t.preset}:{}},cells:{tc:l.marker.tc??"",marker:l.marker.name,frames:l.out-l.in+1,name:l.name,folder:s,dupe:l.dupe?"same name as another job":""}}))}var lo=[["rec709","Rec.709 (gamma 2.4)"],["srgb","sRGB"],["p3d65","P3-D65 (gamma 2.6)"]],ad=[["flat","Flat 1.85"],["scope","Scope 2.39"],["full","Full 1.90"]],sd=[["2k","2K"],["4k","4K"]],ld=[["feature","Feature"],["trailer","Trailer"],["teaser","Teaser"],["short","Short"],["advertisement","Ad"],["test","Test"]],co=e=>e.map(t=>t[0]);var IR=[{id:"resolve",label:"Resolve",reads:!0,edits:!0},{id:"premiere",label:"Premiere",reads:!0,edits:!0},{id:"avid",label:"Avid",reads:!0,edits:!1},{id:"flame",label:"Flame",reads:!0,edits:!1},{id:"nuke",label:"Nuke Studio",reads:!0,edits:!1},{id:"fcp",label:"Final Cut",reads:!1,edits:!1},{id:"baselight",label:"Baselight",reads:!0,edits:!1},{id:"protools",label:"Pro Tools",reads:!0,edits:!1}],Es=IR.filter(e=>e.edits).map(e=>[e.id,e.label]),at=IR.map(e=>e.id);var As=["marker_add","marker_update","marker_delete"],Vj={resolve:"all",premiere:["clip_color","enabled","metadata","name","playhead","properties","timeline_rename",...As],flame:["clip_color","enabled",...As],nuke:As,avid:As,protools:As,baselight:[]},TR=(e,t)=>{let r=Vj[e];return r==="all"||!!r?.includes(t)};var Os=e=>e.map(([t,r])=>[t,r]),Zj=e=>e[0].toUpperCase()+e.slice(1),PR=_w.map(e=>[e.id,e.short]),OR=e=>({host:e}),Ie=OR("resolve"),cd=OR("premiere"),Gj=B0.map(e=>[e.id,e.label]),yt={id:"source",label:"Timeline",type:"source",optional:!0,placeholder:"the timeline open in Resolve"},bn=(e="Read the timeline")=>({id:"pull",use:"host.read",args:{...Ie,from:"$in.source"},label:e}),AR=od,ji=(e,t)=>({id:"apply",use:"host.apply",args:{...Ie,ops:"$ops",timeline:"$pull.timeline",source:"$pull"},...e?{when:e}:{},...t?{label:t}:{}}),ER=Object.keys(ma).map(e=>[e,Zj(e)]),Hj=[["","Full frame"],...Object.keys(Ol).filter(e=>e!=="none").map(e=>[e,e])],MR=e=>Object.entries(Di).filter(([,t])=>t.folderStructure.includes(`{${e}}`)).map(([t])=>t),Dy=MR("show"),Wj=MR("film"),CR=[{id:"exchange",name:"Timeline Exchange",app:!0,playbook:"conform",aka:["convert","translate","turn over","turnover","send to another app","AAF / XML / EDL / DRT","open in another host"],group:"Exchange",about:"Read a timeline from any host (a file, the one open in Resolve or Premiere, or the timeline wired in) and write it for another. In the app it runs on this machine, offline, nothing uploaded.",inputs:[{...yt,placeholder:"the From below"},{id:"from",label:"From",type:"choice",choices:[["source","This job's timeline"],["file","A timeline file"],["resolve","Resolve's open timeline"],["premiere","Premiere's open sequence"]],default:"source"},{id:"path",label:"Timeline file",type:"file",optional:!0,placeholder:".drt .aaf .avb .prproj .fcpxml .xml .otio .edl, Flame archive",when:{input:"from",is:["file"]}},{id:"target",label:"For",type:"choice",choices:PR,default:"avid"},{id:"out",label:"Write to",type:"folder",optional:!0,placeholder:"a folder (default: next to the source)"},{id:"no_audio",label:"Picture only (no audio)",type:"bool",default:!1}],nodes:[{id:"read",use:"verb.timeline_read",args:{path:"$in.path"},when:"$in.from=file",label:"Read the timeline"},{id:"resolve",use:"verb.host_export",args:{host:"resolve"},when:"$in.from=resolve",label:"Read Resolve's open timeline"},{id:"premiere",use:"verb.host_export",args:{host:"premiere"},when:"$in.from=premiere",label:"Read Premiere's open sequence"},{id:"mute",use:"timeline.remove_audio",args:{session_id:"$read.session_id|$resolve.session_id|$premiere.session_id|$in.source.session_id"},when:"$in.no_audio=true",label:"Remove audio"},{id:"write",use:"verb.timeline_write",args:{session_id:"$read.session_id|$resolve.session_id|$premiere.session_id|$in.source.session_id",target:"$in.target",out_path:"$in.out"},label:"Write it"}]},{id:"join-timelines",name:"Join Timelines",part:!0,playbook:"conform",output:"timeline",aka:["join reels","combine reels","stitch acts","one long timeline","full film","LFOA","reel string-out","merge timelines"],group:"Exchange",about:"Several timelines (any hosts) end to end in one new timeline \u2014 a reel string-out, every act in one \u2014 written for any host. Tracks line up by number; a marker at each join names where it came from.",inputs:[{id:"paths",label:"Timelines, in order",type:"files",placeholder:"one timeline file per line"},{id:"name",label:"New timeline name",type:"text",optional:!0,placeholder:"default: the first one's name + _JOINED"},{id:"gap",label:"Black between (frames)",type:"number",default:0},{id:"no_audio",label:"Picture only (no audio)",type:"bool",default:!1},{id:"target",label:"For",type:"choice",choices:PR,default:"resolve"},{id:"out",label:"Write to",type:"folder",optional:!0,placeholder:"a folder (default: next to the first)"}],nodes:[{id:"read",use:"timeline.read_many",args:{paths:"$in.paths"}},{id:"join",use:"timeline.join",args:{session_id:"$read.session_id",sources:"$read.sources",name:"$in.name",gap_frames:"$in.gap"}},{id:"mute",use:"timeline.remove_audio",args:{session_id:"$read.session_id",timeline_id:"$join.timeline_id"},when:"$in.no_audio=true"},{id:"write",use:"verb.timeline_write",args:{session_id:"$read.session_id",timeline_id:"$join.timeline_id",target:"$in.target",out_path:"$in.out"}}]},{id:"clips",name:"Clips",part:!0,aka:["clip list","find clips","select clips by name","clip colour","flag clips","enable / disable clips","tag clips"],group:"Look",...Ie,about:"Every clip of the open timeline as a table \u2014 with every effect, Warp Stabilizer and retime on it. Narrow it with the query (is:stabilized, is:retimed, is:nested\u2026), untick what to leave out, change the rest in Resolve or Premiere in one undoable batch: clip colour (Premiere: the clip's label), enabled, markers, names, keywords; on Resolve also flags, grade versions, colour group, cache.",inputs:[yt,{id:"host",label:"In",type:"choice",choices:Es,default:"resolve"},{id:"query",label:"Only clips matching",type:"text",optional:!0,placeholder:"is:stabilized \xB7 is:retimed \xB7 is:offline \xB7 speed!=100 \xB7 track:V2 \xB7 name:/^A0\\d+/"},{id:"action",label:"Do",type:"choice",default:"color",choices:[["color","Clip colour"],["flag","Add flag"],["unflag","Clear flags"],["enable","Enable"],["disable","Disable"],["marker","Add marker"],["keywords","Keywords"],["version_add","New grade version"],["version_load","Load grade version"],["group","Colour group"],["ungroup","Leave colour group"],["prefix","Name prefix"],["suffix","Name suffix"],["cache_on","Colour cache on"],["cache_off","Colour cache off"]]},{id:"color",label:"Colour",type:"color",default:"Orange",when:{input:"action",is:["color"]}},{id:"marker_color",label:"Colour",type:"marker_color",default:"Blue",when:{input:"action",is:["flag","marker"]}},{id:"text",label:"Text",type:"text",optional:!0,when:{input:"action",is:["marker","keywords","version_add","version_load","group","prefix","suffix"]}}],nodes:[{id:"pull",use:"host.read",args:{host:"$in.host",from:"$in.source"},label:"Read the timeline"},{id:"clips",use:"plan.clips",args:{live:"$pull",query:"$in.query"}},{id:"review",use:"review",args:{rows:"$clips",columns:[["#","#"],["track","Track"],["name","Name"],["rec_in_tc","Rec In"],["rec_out_tc","Rec Out"],["reel_name","Reel"],["speed","Speed"],["retimed","Retimed"],["stabilized","Stabilized"],["effects","Effects"],["color","Colour"],["flags","Flags"],["on","On"],["version","Version"],["group","Group"],["keywords","Keywords"]]}},{id:"ops",use:"plan.index_ops",args:{live:"$pull",rows:"$review",action:"$in.action",color:"$in.color",marker_color:"$in.marker_color",text:"$in.text"}},{id:"apply",use:"host.apply",args:{host:"$in.host",ops:"$ops",timeline:"$pull.timeline",source:"$pull"}}]},{id:"markers",name:"Markers",part:!0,aka:["marker colours","recolour markers","delete markers","rename markers","locators","marker cleanup"],group:"Look",...Ie,about:"Timeline and clip markers of the open timeline in Resolve or Premiere: filter them, then recolour, rename, note, delete or move them between the timeline and the clip (Resolve), in one undoable batch.",inputs:[yt,{id:"host",label:"In",type:"choice",choices:Es,default:"resolve"},{id:"only",label:"Only colour",type:"marker_color",optional:!0},{id:"on",label:"On",type:"choice",choices:[["","Timeline and clips"],["timeline","Timeline"],["clip","Clips"]],default:""},{id:"find",label:"Find in name / note",type:"text",optional:!0},{id:"action",label:"Do",type:"choice",default:"recolor",choices:[["recolor","Colour"],["swap","Swap colours"],["rename","Name"],["note","Note"],["prefix","Name prefix"],["suffix","Name suffix"],["delete","Delete"],["to_clip","Move onto the clip"],["to_timeline","Move onto the timeline"]]},{id:"color",label:"Colour",type:"marker_color",default:"Green",when:{input:"action",is:["recolor","swap"]}},{id:"color2",label:"and",type:"marker_color",default:"Red",when:{input:"action",is:["swap"]}},{id:"text",label:"Text",type:"text",when:{input:"action",is:["rename","note","prefix","suffix"]}}],nodes:[{id:"pull",use:"host.read",args:{host:"$in.host",from:"$in.source"},label:"Read the timeline"},{id:"rows",use:"rows.filter",args:{rows:"$pull.markers",where:[["color","=","$in.only"],["on","=","$in.on"],["name","contains","$in.find"]]}},{id:"review",use:"review",args:{rows:"$rows",columns:[["tc","Record TC"],["color","Colour"],["name","Name"],["note","Note"],["on","On"],["clip","Clip"]]}},{id:"ops",use:"plan.marker_ops",args:{live:"$pull",rows:"$review",action:"$in.action",color:"$in.color",text:"$in.color2|$in.text"}},{id:"apply",use:"host.apply",args:{host:"$in.host",ops:"$ops",timeline:"$pull.timeline",source:"$pull"}}]},{id:"unused",name:"Unused Media",part:!0,aka:["unused media","clean the media pool","tidy the bin","purge","orphan clips","not in any timeline"],group:"Look",...Ie,about:"Media pool clips that no timeline in the project uses (Resolve's own usage count), by drive: move them into one bin, or take them out of the pool. Files on disk are never touched.",inputs:[{id:"drive",label:"Only on drive",type:"text",optional:!0,placeholder:"/Volumes/RAID (default: every drive)"},{id:"action",label:"Do",type:"choice",choices:[["move","Move into a bin"],["remove","Remove from the pool (cannot be undone)"]],default:"move"},{id:"bin",label:"Bin",type:"text",default:"UNUSED MEDIA",when:{input:"action",is:["move"]}}],nodes:[{id:"pool",use:"host.pool",args:{...Ie,unused:!0,skip_folder:"$in.bin"},label:"Find the unused clips"},{id:"rows",use:"rows.filter",args:{rows:"$pool",where:[["drive","starts","$in.drive"]]}},{id:"review",use:"review",args:{rows:"$rows",columns:[["name","Name"],["folder","Bin"],["start_tc","Start TC"],["file","File"]]}},{id:"ops",use:"plan.pool_ops",args:{rows:"$review",action:"$in.action",folder:"$in.bin"}},{id:"apply",use:"host.apply",args:{...Ie,ops:"$ops"}}]},{id:"rename",name:"Rename",part:!0,aka:["rename clips","batch rename","find and replace names","fix clip names"],group:"Prep",...Ie,preview:!0,about:"Timeline clips, media pool clips or timelines through an ordered list of rename steps, previewed row by row (DUPEs are never applied), renamed in Resolve in one undoable batch. Files on disk are never renamed.",inputs:[yt,{id:"target",label:"Rename",type:"choice",choices:[["clips","Timeline clips"],["pool","Media pool clips"],["timelines","Timelines"]],default:"clips"},{id:"folder",label:"Pool folder",type:"text",optional:!0,placeholder:"all folders",when:{input:"target",is:["pool"]}},{id:"steps",label:"Steps",type:"rename_steps",default:[{type:"find_replace",find:"",replace:""}]}],nodes:[bn(),{id:"subjects",use:"rename.subjects",args:{live:"$pull",target:"$in.target",folder:"$in.folder"}},{id:"plan",use:"plan.rename",args:{subjects:"$subjects",steps:"$in.steps"}},{id:"review",use:"review",args:{rows:"$plan",columns:[["where","Where"],["old","Now"],["new","New"],["dupe",""],["error",""]],skip:"dupe"}},{id:"ops",use:"ops.collect",args:{rows:"$review"}},ji()]},{id:"handles",name:"Add Handles",part:!0,playbook:"conform",output:"timeline",aka:["handles","pad clips","extend clips","add head and tail"],group:"Prep",...Ie,about:"A new timeline with every video clip of the open one strung out end to end, each with handles either side (clamped to the media; stills skipped), into Resolve (linked to the clips already in the pool) or Premiere (a new sequence). A negative number trims each end instead. The open timeline is never edited.",inputs:[yt,{id:"host",label:"In",type:"choice",choices:Es,default:"resolve"},{id:"handles",label:"Handles (frames each side)",type:"number",default:12}],nodes:[{id:"pull",use:"host.read",args:{host:"$in.host",from:"$in.source"},label:"Read the timeline"},{id:"build",use:"timeline.add_handles",args:{session_id:"$pull.session_id",handles:"$in.handles"},label:"Build the timeline"},{id:"open",use:"host.open",args:{host:"$in.host",session_id:"$build.session_id",timeline_ids:"$build.timeline_ids"},label:"Into the host"}]},{id:"all-clips",name:"All Clips Timeline",part:!0,playbook:"conform",output:"timeline",aka:["sources reel","select reel","string-out of every clip","all source media","used clips timeline","pull list"],group:"Prep",...Ie,about:"One timeline of every clip the chosen timelines use, overlapping uses of the same media merged into one piece, with handles. Duplicate footage (the same shot media-managed twice) is marked or reduced to the best copy. Lands in Resolve as a new timeline.",inputs:[{id:"timelines",label:"From timelines",type:"timelines",optional:!0,placeholder:"the open one"},{id:"handles",label:"Handles (frames)",type:"number",default:0},{id:"order",label:"Order",type:"choice",choices:[["timeline","Cut order"],["source_tc","Source TC order"]],default:"timeline"},{id:"mark_duplicates",label:"Mark duplicate footage",type:"bool",default:!0},{id:"reduce_duplicates",label:"Reduce to the best copy",type:"bool",default:!1},{id:"include_disabled",label:"Include disabled clips",type:"bool",default:!1},{id:"include_image_sequences",label:"Image sequences",type:"bool",default:!0},{id:"include_stills",label:"Stills",type:"bool",default:!1},{id:"include_offline",label:"Offline media",type:"bool",default:!0},{id:"include_references",label:"Reference clips",type:"bool",default:!1},{id:"reference_pattern",label:"Reference clips match",type:"text",default:"_REF|_REFERENCE| REF",when:{input:"include_references",is:["false"]}},{id:"per_resolution",label:"A timeline per resolution",type:"bool",default:!1},{id:"stack",label:"Stack takes in place",type:"bool",default:!1}],nodes:[{id:"read",use:"host.export_many",args:{...Ie,timelines:"$in.timelines"},label:"Read the timelines"},{id:"build",use:"timeline.all_clips",label:"Build the timeline",args:{session_id:"$read.session_id",sources:"$read.sources",handles:"$in.handles",order:"$in.order",mark_duplicates:"$in.mark_duplicates",reduce_duplicates:"$in.reduce_duplicates",include_disabled:"$in.include_disabled",include_image_sequences:"$in.include_image_sequences",include_stills:"$in.include_stills",include_offline:"$in.include_offline",include_references:"$in.include_references",reference_pattern:"$in.reference_pattern",per_resolution:"$in.per_resolution",stack:"$in.stack"}},{id:"open",use:"host.open",args:{...Ie,session_id:"$build.session_id",timeline_ids:"$build.timeline_ids"},label:"Into Resolve"}]},{id:"vfx",name:"VFX Pulls",part:!0,aka:["visual effects","VFX shots","plate pulls","pulls","shot list","turnover to VFX","EXR plates"],group:"Prep",...Ie,about:"Markers of one colour become numbered VFX shots with their plates (the clips under each marker) and reference. Name the markers, build the string-out as a new timeline, and render a file per pull into a folder per shot: each step switched on or off.",inputs:[yt,{id:"color",label:"Markers",type:"marker_color",default:"Blue"},{id:"prefix",label:"Prefix",type:"text",default:"VFX"},{id:"increment",label:"Step",type:"number",default:10},{id:"digits",label:"Digits",type:"number",default:4},{id:"handles",label:"Handles",type:"number",default:8},{id:"gap",label:"Gap between shots",type:"number",default:24},{id:"start_frame",label:"First frame",type:"number",default:1001},{id:"hero",label:"Hero is the",type:"choice",choices:[["lowest","lowest track"],["highest","highest track"]],default:"lowest"},{id:"reference_track",label:"Reference track",type:"track",optional:!0},{id:"skip_disabled",label:"Skip disabled clips",type:"bool",default:!0},{id:"name_markers",label:"Name the markers",type:"bool",default:!0},{id:"build",label:"Build the string-out",type:"bool",default:!0},{id:"root",label:"Render into",type:"folder",optional:!0,placeholder:"a folder (leave empty to skip rendering)"},{id:"plate_preset",label:"Plates render with",type:"render_preset",optional:!0,placeholder:"the current settings"},{id:"reference_preset",label:"Reference renders with",type:"render_preset",optional:!0,placeholder:"the current settings"}],nodes:[bn(),{id:"plan",use:"plan.vfx_pulls",args:{live:"$pull",color:"$in.color",prefix:"$in.prefix",increment:"$in.increment",digits:"$in.digits",handles:"$in.handles",gap:"$in.gap",start_frame:"$in.start_frame",hero:"$in.hero",reference_track:"$in.reference_track",skip_disabled:"$in.skip_disabled"}},{id:"review",use:"review",args:{rows:"$plan.rows",columns:[["shot","Shot"],["role","Pull"],["name","Name"],["clip","Clip"],["frames","Frames"],["cut","Cut"]]}},{id:"names",use:"plan.vfx_names",args:{plan:"$plan",rows:"$review"},when:"$in.name_markers=true"},{id:"name_apply",use:"host.apply",args:{...Ie,ops:"$names",timeline:"$pull.timeline"},when:"$in.name_markers=true",label:"Name the markers"},{id:"stringout",use:"vfx.stringout",args:{...Ie,live:"$pull",plan:"$plan",rows:"$review"},when:"$in.build=true"},{id:"jobs",use:"plan.vfx_renders",args:{plan:"$plan",rows:"$review",start_frame:"$stringout.start_frame",root:"$in.root",plate_preset:"$in.plate_preset",reference_preset:"$in.reference_preset"},when:"$in.root"},{id:"render",use:"host.render",args:{...Ie,timeline:"$stringout.timeline",jobs:"$jobs"},when:"$in.root",label:"Render the pulls"}]},{id:"align",name:"Align Clips",app:!0,aka:["match framing","match sizing","repo match","line up the online with the offline","reference track"],group:"Match",...Ie,about:"Fits every clip's framing (pan, tilt, zoom, rotation, flips) to the reference, measured on the media. A clip whose framing moves is measured on every frame and written as a few eased keyframes. Nothing changes until you apply.",inputs:[yt,{id:"scope",label:"Align",type:"choice",choices:[["all","Whole timeline"],["playhead","Clip at playhead"],["selected","Selected clips"]],default:"all"},{id:"at",label:"Playhead",type:"data",hidden:!0},{id:"picks",label:"Selected clips",type:"data",hidden:!0},{id:"reference",label:"Reference",type:"track",optional:!0,choices:[["offline","Offline ref"]]},{id:"tracks",label:"Track to align",type:"tracks",optional:!0,not:"reference"},{id:"samples",label:"Frames per clip",type:"choice",choices:[["1","Middle"],["ends","First & last frame"],["all","Every frame"]],default:"ends"},{id:"sizing_target",label:"Write sizing to",type:"choice",choices:[["input","Input Sizing"],["edit","Edit Sizing"],["node","Node Sizing"]],default:"edit"},{id:"node",label:"Sizing node",type:"node",optional:!0,placeholder:"node 1",when:{input:"sizing_target",is:["node"]}},{id:"markers",label:"Write markers",type:"bool",default:!0}],nodes:[bn(),{id:"measure",use:"verb.timeline_align",args:{session_id:"$pull.session_id",reference_track:"$in.reference",tracks:"$in.tracks",samples:"$in.samples",sizing_target:"$in.sizing_target",node:"$in.node",scope:"$in.scope",at:"$in.at",picks:"$in.picks"},label:"Measure"},{id:"rows",use:"plan.align_rows",args:{result:"$measure"}},{id:"review",use:"review",args:{rows:"$rows",columns:[["record_tc","Record"],["track","Track"],["name","Clip"],["verdict","Verdict"],["confidence","Confidence"],["sizing","Sizing"],["why","Why"]],skip:"cant"}},{id:"ops",use:"plan.align_ops",args:{result:"$measure",rows:"$review",markers:"$in.markers"}},ji()]},{id:"copy-grades",name:"Copy Grades",part:!0,aka:["copy grade","copy colour","copy sizing","copy repo","grade transfer","track to track"],group:"Match",...Ie,about:"Every clip on the destination track takes the grade \u2014 and the sizing, crop, composite, clip colour and flags you pick \u2014 from the source-track clip it overlaps most. Grades copy with Resolve's own CopyGrades, checked node for node; clips with no source get a marker.",inputs:[yt,{id:"from",label:"From track",type:"track",default:2},{id:"to",label:"To track",type:"track",default:1},{id:"grade",label:"Grade",type:"bool",default:!0},{id:"sizing",label:"Sizing",type:"bool",default:!0},{id:"crop",label:"Crop",type:"bool",default:!0},{id:"composite",label:"Composite + opacity",type:"bool",default:!0},{id:"clip_color",label:"Clip colour",type:"bool",default:!0},{id:"flags",label:"Flags",type:"bool",default:!0},{id:"miss_color",label:"Mark clips with no source",type:"marker_color",default:"Red",optional:!0}],nodes:[bn(),{id:"pairs",use:"plan.copy_pairs",args:{live:"$pull",from:"$in.from",to:"$in.to"}},{id:"review",use:"review",args:{rows:"$pairs",columns:[["clip","Clip"],["record","Record"],["color","Colour"],["from","Takes from"],["fit","Overlap"],["nodes","Nodes"]]}},{id:"ops",use:"plan.copy_ops",args:{rows:"$review",grade:"$in.grade",sizing:"$in.sizing",crop:"$in.crop",composite:"$in.composite",clip_color:"$in.clip_color",flags:"$in.flags",miss_color:"$in.miss_color"}},ji()]},{id:"trace",name:"Grade Tracer",part:!0,playbook:"patch",aka:["find old grades","where grades came from","previous versions","recover grades","grade history"],group:"Match",...Ie,about:"After a re-conform, find each clip's earlier grade in the project's other timelines (source timecode, reel, file name, path, duration) and copy it across with Resolve's CopyGrades, or bring the top matches in as local versions to choose between.",inputs:[yt,{id:"timelines",label:"Earlier timelines",type:"timelines"},{id:"min_score",label:"Least score",type:"number",default:60},{id:"floor",label:"Trust from",type:"number",default:85},{id:"top_n",label:"Variants",type:"number",default:3},{id:"only_trusted",label:"Only trusted matches",type:"bool",default:!0},{id:"variants",label:"As local versions",type:"bool",default:!1},{id:"mark_color",label:"Mark unmatched",type:"marker_color",optional:!0}],nodes:[bn(),{id:"trace",use:"plan.grade_trace",args:{...Ie,live:"$pull",timelines:"$in.timelines",top_n:"$in.top_n",min_score:"$in.min_score",floor:"$in.floor"}},{id:"review",use:"review",args:{rows:"$trace",columns:[["clip","Clip"],["at","At"],["match","Match"],["trusted",""],["from","Grade from"],["why","Why"],["others","Others"]]}},{id:"ops",use:"plan.grade_trace_ops",args:{rows:"$review",variants:"$in.variants",only_trusted:"$in.only_trusted",mark_color:"$in.mark_color"}},ji()]},{id:"reconform",name:"Reconform",part:!0,playbook:"patch",aka:["recut","new version of the edit","editorial changes","update to the new cut","change list","EDL changes","reconformer","carry the grade to the new cut","version parity"],group:"Match",...Ie,about:"The colour timeline (A) and the newer cut (B): build B with A's grade (a copy of B, every clip taking the grade, sizing, crop, clip colour and clip markers of the clip in A that holds the same source frames; B itself never edited), or compare where the picture comes from frame by frame and mark the changes on A.",inputs:[yt,{id:"do",label:"Do",type:"choice",choices:[["carry","Build B with A's grade"],["mark","Mark what changed on A"]],default:"carry"},{id:"a",label:"A (colour)",type:"timeline",optional:!0,placeholder:"the open one"},{id:"b",label:"B (new cut)",type:"timeline",optional:!0},{id:"b_file",label:"\u2026or B as a file",type:"file",optional:!0,placeholder:".aaf .xml .edl .drt .prproj",when:{input:"do",is:["mark"]}},...AR.map(([e,t])=>({id:e,label:t,type:"bool",default:!0,when:{input:"do",is:["carry"]}})),{id:"miss_color",label:"Mark new material",type:"marker_color",default:"Green",optional:!0,when:{input:"do",is:["carry"]}},{id:"name",label:"New timeline",type:"text",optional:!0,placeholder:"default: B's name + _RECONFORMED",when:{input:"do",is:["carry"]}},{id:"by_track",label:"Track by track",type:"bool",default:!1,when:{input:"do",is:["mark"]}},{id:"mark",label:"Mark the changes on A",type:"bool",default:!0,when:{input:"do",is:["mark"]}},{id:"inserts",label:"Open B's changed shots as an insert timeline",type:"bool",default:!1,when:{input:"do",is:["mark"]}}],nodes:[{id:"pull",use:"host.read",args:{...Ie,timeline:"$in.a",from:"$in.source"},label:"Read A"},{id:"b",use:"host.read",args:{...Ie,timeline:"$in.b"},when:"$in.b",label:"Read B"},{id:"pairs",use:"plan.carry_rows",args:{a:"$pull",b:"$b"},when:"$in.do=carry",label:"Pair B's clips with A's"},{id:"carried",use:"review",args:{rows:"$pairs",columns:[["record","Record"],["clip","Clip"],["from","Takes from A"],["cover","Same frames"],["grade","Grade"],["pieces",""]]},when:"$in.do=carry"},{id:"dup",use:"host.duplicate",args:{...Ie,timeline:"$b.timeline",name:"$in.name"},when:"$in.do=carry",label:"Copy B"},{id:"carry",use:"plan.carry_ops",args:{rows:"$carried",a:"$pull",...Object.fromEntries(AR.map(([e])=>[e,`$in.${e}`])),miss_color:"$in.miss_color"},when:"$in.do=carry"},{id:"build",use:"host.apply",args:{...Ie,ops:"$carry",timeline:"$dup.timeline",source:"$b"},when:"$in.do=carry",label:"Carry A onto the copy"},{id:"bf",use:"source.file",args:{path:"$in.b_file"},when:"$in.b_file",label:"Read B (file)"},{id:"diff",use:"verb.timeline_diff",args:{a_session_id:"$pull.session_id",b_session_id:"$b.session_id|$bf.session_id",by_track:"$in.by_track",limit:5e3,session:"$in.inserts"},when:"$in.do=mark",label:"Compare"},{id:"rows",use:"plan.reconform",args:{diff:"$diff",start_frame:"$pull.start_frame"},when:"$in.do=mark"},{id:"review",use:"review",args:{rows:"$rows",columns:[["rec_in_tc","Record In"],["rec_out_tc","Record Out"],["frames","Frames"],["kind","Change"],["a","A"],["b","B"]]},when:"$in.do=mark"},{id:"ops",use:"ops.collect",args:{rows:"$review"},when:"$in.do=mark"},ji("$in.do=mark & $in.mark=true","Mark the changes on A"),{id:"inserts",use:"host.open",args:{...Ie,session_id:"$diff.session_id"},when:"$in.do=mark & $in.inserts=true",label:"Open the insert timeline"}],view:{split:"row",panes:[{split:"col",size:.34,panes:[{pane:"knobs",size:.45},{pane:"rows"}]},{pane:"compare",show:["$pull|$source","$b|$bf"]}]}},{id:"graphics",name:"Graphics Toolkit",aka:["titles","lower thirds","burn-ins","slates","supers","captions","name supers","locators","legal line","end crawl","credits"],group:"Make",about:"Lower thirds, locators, legal lines and end crawls designed over the job's timeline: the designer beside the viewer, the graphic drawn on the picture; Run makes ProRes 4444 with alpha for every aspect and position, and can lay them on the Resolve timeline.",inputs:[yt,{id:"kind",label:"Kind",type:"choice",choices:V0.map(e=>[e.base,e.label]),default:"lower_third",hidden:!0},{id:"name",label:"Name",type:"text",optional:!0,hidden:!0},{id:"title",label:"Title",type:"text",optional:!0,hidden:!0},{id:"location",label:"Location",type:"text",optional:!0,hidden:!0},{id:"sub",label:"Second line",type:"text",optional:!0,hidden:!0},{id:"text",label:"Legal text",type:"text",optional:!0,hidden:!0},{id:"credits",label:"Credits",type:"text",optional:!0,hidden:!0,placeholder:"# Section \xB7 Role | Name"},{id:"items",label:"Graphics",type:"data",default:[]},{id:"look_preset",label:"Look",type:"choice",choices:Gj,optional:!0,hidden:!0},{id:"look",label:"Look (custom)",type:"data",optional:!0},{id:"formats",label:"Formats",type:"data",optional:!0},{id:"positions",label:"Positions",type:"data",optional:!0},{id:"duration",label:"Seconds",type:"number",optional:!0,hidden:!0},{id:"resolution",label:"Size",type:"choice",choices:G0.map(e=>[e.id,e.label]),default:"hd",hidden:!0},{id:"fps",label:"Rate",type:"number",default:23.976,hidden:!0},{id:"background",label:"Solid background",type:"text",optional:!0,hidden:!0,placeholder:"#000000 (none = alpha)"},{id:"lottie",label:"Lottie too",type:"bool",default:!1,hidden:!0},{id:"at",label:"Starts at frame",type:"number",default:0,hidden:!0},{id:"drafts",label:"Other kinds",type:"data",optional:!0},{id:"place",label:"Lay them on the Resolve timeline",type:"bool",default:!1},{id:"out",label:"Write to",type:"folder",optional:!0,placeholder:"engine home/gfx"}],nodes:[{...bn(),when:"$in.place"},{id:"gfx",use:"ui.graphics",args:{session_id:"$pull.session_id"},label:"Design"},{id:"render",use:"verb.gfx_make",label:"Render",args:{type:"$in.kind",name:"$in.name",title:"$in.title",location:"$in.location",sub:"$in.sub",text:"$in.text",credits:"$in.credits",items:"$in.items",look:"$in.look|$in.look_preset",formats:"$in.formats",positions:"$in.positions",duration:"$in.duration",resolution:"$in.resolution",fps:"$in.fps",background_color:"$in.background",lottie:"$in.lottie",out_dir:"$in.out"}},{id:"place",use:"gfx.place",when:"$in.place",label:"Onto the timeline",args:{package:"$render",from:"$pull",at:"$in.at",position:"$in.positions"}}]},{id:"archive",name:"Archive",part:!0,playbook:"deliver",aka:["archive","deliver","package","send media","hand off","media to the colourist / VFX / sound","folder / iso / bucket / peer to peer"],group:"Deliver",about:"The job's timeline with its media, trimmed with handles, as a package: a folder, an .iso, your bucket (recipients emailed), or served peer to peer from this machine (a ticket to hand over).",inputs:[yt,{id:"destination",label:"As",type:"choice",choices:[["folder","A folder"],["iso","An .iso"],["bucket","Your bucket"],["p2p","Peer to peer"]],default:"folder"},{id:"handles",label:"Handles (frames)",type:"number",default:24},{id:"out",label:"Write to",type:"folder",optional:!0,when:{input:"destination",is:["folder","iso"]}},{id:"recipients",label:"Email to",type:"text",optional:!0,placeholder:"name@facility.com",when:{input:"destination",is:["bucket"]}}],nodes:[bn(),{id:"send",use:"transfer.deliver",args:{session_id:"$pull.session_id",destination:"$in.destination",handles:"$in.handles",out_path:"$in.out",recipients:"$in.recipients"},label:"Deliver"}]},{id:"blanking",name:"Blanking",part:!0,aka:["black edges","black borders","bad repo","sizing check","edge check"],group:"Check",...Ie,about:"Clips whose sizing reveals black inside the delivered frame, from each clip's transform (instant) or measured on the decoded source frames, each with the least zoom that fills. Send the fixes and markers to Resolve. For black that only shows after the grade, use Finishing QC.",inputs:[yt,{id:"aspect",label:"Delivered as",type:"choice",choices:Hj,default:""},{id:"strictness",label:"Strictness",type:"choice",choices:ER,default:"strict"},{id:"pixels",label:"Measure pixels (slower)",type:"bool",default:!1},{id:"fixes",label:"Zoom fixes",type:"bool",default:!0}],nodes:[bn(),{id:"check",use:"verb.qc_blanking",args:{session_id:"$pull.session_id",aspect:"$in.aspect",strictness:"$in.strictness",pixels:"$in.pixels"},label:"Check"},{id:"rows",use:"plan.blanking_rows",args:{result:"$check"}},{id:"review",use:"review",args:{rows:"$rows",columns:[["record_tc","Record"],["frames","Frames"],["track","Track"],["name","Clip"],["edges","Black (px)"],["fix","Zoom to fill"]]}},{id:"ops",use:"plan.blanking_ops",args:{result:"$check",rows:"$review",live:"$pull",fixes:"$in.fixes"}},ji()]},{id:"finishing-qc",name:"Finishing QC",part:!0,playbook:"deliverables",aka:["quality control","final check","tech check","QC report","pre-delivery check"],group:"Check",...Ie,about:"Renders the timeline through the conform.tools render plugin, which measures every frame after the grade: black edges, black frames, clipping, freezes and flashes, dead pixels, slate/leader, loudness. Findings go on the timeline as markers; click one to go there.",inputs:[{id:"strictness",label:"Strictness",type:"choice",choices:ER,default:"strict"},{id:"aspect",label:"Delivered as",type:"choice",choices:[["","Full frame"],["1.85","1.85"],["2.00","2.00"],["2.20","2.20"],["2.35","2.35"],["2.39","2.39"],["1.3333","4:3"],["1","1:1"]],default:""},{id:"markers",label:"Markers",type:"bool",default:!0},{id:"audio",label:"Audio",type:"bool",default:!0}],nodes:[{id:"scan",use:"host.qc",args:{strictness:"$in.strictness",expected_aspect:"$in.aspect",markers:"$in.markers",audio:"$in.audio"},label:"Render through the plugin"},{id:"show",use:"table",args:{rows:"$scan.rows",text:"$scan.text",columns:[["tc","Record In"],["out","Record Out"],["kind","Finding"],["clip","Clip"],["detail","Measured"]]}}]},{id:"renders",name:"Marker Renders",part:!0,playbook:"deliverables",aka:["marker batch renderer","render markers","export marker ranges","stills at markers","frame grabs","review renders"],group:"Deliver",...Ie,about:"One render per marker of a colour, named by a delivery convention (Netflix NAM / DCDM, film reels, TV, conform.tools), with handles, into that convention's folders. Only these jobs are queued; your render queue and Deliver settings stay as they are. Names two jobs share are left out.",inputs:[yt,{id:"color",label:"Markers",type:"marker_color",default:"Blue"},{id:"scope",label:"Which",type:"choice",choices:[["all","Every marker"],["duration","Ranges only"],["frame","Single frames"]],default:"all"},{id:"handles",label:"Handles",type:"number",default:0},{id:"naming",label:"Naming",type:"choice",choices:id,default:"conformtools"},{id:"show",label:"Show",type:"text",optional:!0,when:{input:"naming",is:Dy}},{id:"season",label:"Season",type:"text",optional:!0,when:{input:"naming",is:Dy}},{id:"episode",label:"Episode",type:"text",optional:!0,when:{input:"naming",is:Dy}},{id:"film",label:"Film",type:"text",optional:!0,when:{input:"naming",is:Wj}},{id:"reel",label:"Reel",type:"text",optional:!0,when:{input:"naming",is:["netflix_film_nam","netflix_film_segmented"]}},{id:"version",label:"Version",type:"text",optional:!0,when:{input:"naming",is:["tv_series"]}},{id:"artist",label:"Artist",type:"text",optional:!0,when:{input:"naming",is:["conformtools"]}},{id:"root",label:"Render into",type:"folder"},{id:"preset",label:"Render with",type:"render_preset",optional:!0,placeholder:"the current Deliver settings"}],nodes:[bn(),{id:"plan",use:"plan.marker_renders",args:{live:"$pull",color:"$in.color",scope:"$in.scope",naming:"$in.naming",handles:"$in.handles",root:"$in.root",preset:"$in.preset",fields:{show:"$in.show",season:"$in.season",episode:"$in.episode",film:"$in.film",reel:"$in.reel",version:"$in.version",artist:"$in.artist"}}},{id:"review",use:"review",args:{rows:"$plan",columns:[["tc","Marker"],["marker","Marker name"],["frames","Frames"],["name","Renders as"],["dupe",""]],skip:"dupe"}},{id:"render",use:"host.render",args:{...Ie,timeline:"$pull.timeline",jobs:"$review"},label:"Render"}]},{id:"conform-reference",name:"Conform From a Reference",part:!0,playbook:"autoconform",output:"timeline",aka:["conform","rebuild the timeline","find the shots","match to the media","conform from a reference","online from a QuickTime","reverse conform"],group:"Match",about:"Rebuilds the edit from a reference render and the source media: every shot found in the camera originals (or proxies, colour returns), frame-accurate, with its sizing, as a timeline. The job's timeline as hints is faster and keeps the editor's takes.",inputs:[{id:"reference",label:"Reference render",type:"file",placeholder:"the cut as a movie: client master, offline export, graded render"},{id:"pool",label:"Source media",type:"files",placeholder:"folders and/or files to search"},{id:"hints",label:"Use the job's timeline as hints",type:"bool",default:!1},{id:"trust",label:"Keep its takes and in-points as written",type:"bool",default:!1,when:{input:"hints",is:["true"]}},{id:"sizing",label:"Measure sizing",type:"bool",default:!0},{id:"display_transform",label:"Log originals to Rec.709",type:"bool",default:!1},{id:"reference_audio",label:"Reference sound",type:"file",optional:!0,placeholder:"a .wav beside a picture-only render"},{id:"name",label:"Timeline name",type:"text",optional:!0},yt],nodes:[{...bn("Read the job's timeline"),when:"$in.hints"},{id:"conform",use:"verb.timeline_autoconform",label:"Conform",args:{reference:"$in.reference",pool:"$in.pool",hints_session_id:"$pull.session_id",trust:"$in.trust",sizing:"$in.sizing",display_transform:"$in.display_transform",reference_audio:"$in.reference_audio",name:"$in.name"}}],view:{split:"row",panes:[{pane:"knobs",size:.36},{pane:"viewer",show:"$conform"}]}},{id:"relink",name:"Relink",part:!0,playbook:"conform",aka:["link media","reconnect","find missing media","offline clips","point at the originals","relink to camera originals"],group:"Prep",...Ie,about:"Links the job's timeline to media in a folder: every clip matched by reel, timecode, name and duration (picture, sound or both). Dry run first to see what would change.",inputs:[yt,{id:"media_root",label:"Media folder",type:"folder",optional:!0,placeholder:"default: the places remembered"},{id:"lane",label:"Link",type:"choice",choices:[["both","Picture and sound"],["video","Picture"],["audio","Sound"]],default:"both"},{id:"reset",label:"Relink clips already linked",type:"bool",default:!1},{id:"dry_run",label:"Dry run (change nothing)",type:"bool",default:!1}],nodes:[bn(),{id:"relink",use:"verb.timeline_relink",label:"Relink",args:{session_id:"$pull.session_id",media_root:"$in.media_root",lane:"$in.lane",reset:"$in.reset",dry_run:"$in.dry_run"}}]},{id:"uprez",name:"Proxies to Online",part:!0,playbook:"conform",aka:["uprez","relink the proxies to the camera originals","replace proxies with hi-res","online the proxies","attach full res","swap proxies for OCF","link media in Premiere"],group:"Prep",...cd,about:"Premiere: every proxy in the open project matched to its camera original in a folder by our matcher (reel, timecode, loose proxy names, picture when asked) \u2014 not Premiere's Link Media \u2014 then repointed (every use follows, framing kept when the raster changes: an HD proxy on a UHD original is rescaled in every sequence) or attached as full-res behind the proxy. Dry run first to see what links to what.",inputs:[{id:"media_root",label:"Camera originals",type:"folder"},{id:"mode",label:"How",type:"choice",choices:[["replace","Replace the proxies"],["hires","Attach as full-res (keep the proxies)"],["proxy","Attach proxies to the online clips"]],default:"replace"},{id:"dry_run",label:"Dry run (change nothing)",type:"bool",default:!0}],nodes:[{id:"relink",use:"verb.host_relink",label:"Link in Premiere",args:{host:"premiere",media_root:"$in.media_root",mode:"$in.mode",dry_run:"$in.dry_run"}}]},{id:"cutin",name:"Cut In Returns",part:!0,playbook:"conform",aka:["cut in vfx","cut in the grade","vfx returns","colour returns","drop in the comps","version up the shots","returns onto the timeline"],group:"Prep",...cd,about:"Premiere: VFX or colour returns (trimmed with handles) matched to the clips they replace by reel, timecode and name, then cut in over them on the track above \u2014 video only, each clip's sizing carried, the original left underneath, frame-exact \u2014 or written as a new sequence version with every effect kept.",inputs:[{id:"media_root",label:"Returns folder",type:"folder"},{id:"mode",label:"Into",type:"choice",choices:[["cut_in","The open sequence, on the track above"],["new_version","A new sequence"]],default:"cut_in"},{id:"track",label:"Onto video track",type:"number",optional:!0,placeholder:"default: above the top track"},{id:"dry_run",label:"Dry run (change nothing)",type:"bool",default:!1}],nodes:[{id:"relink",use:"verb.host_relink",label:"Cut in",args:{host:"premiere",media_root:"$in.media_root",mode:"$in.mode",track:"$in.track",dry_run:"$in.dry_run",criteria:{file_name:!0,file_name_mode:"loose"}}}]},{id:"unnest",name:"Un-nest",part:!0,playbook:"conform",aka:["flatten nests","break apart nested sequences","unnest the sequence","flatten the multicam","un-merge","nest-free timeline for the turnover"],group:"Prep",...cd,about:"Premiere: the open sequence as a NEW sequence with every nest expanded into the cut \u2014 the nest's own scale, position, rotation, opacity and speed composed onto its clips, multicam clips as their active angle, adjustment layers kept. The open sequence is not touched.",inputs:[{id:"name",label:"New sequence name",type:"text",optional:!0,placeholder:"default: <sequence>_UNNEST"}],nodes:[{id:"edit",use:"verb.host_edit",label:"Un-nest",args:{host:"premiere",ops:[{kind:"unnest"}],name:"$in.name"}}]},{id:"resize",name:"Resize Sequence",part:!0,playbook:"conform",aka:["change the sequence resolution","HD to UHD","UHD to HD","reformat the sequence","change the raster without moving anything","make a 4K version"],group:"Prep",...cd,about:"Premiere: the open sequence at another raster as a NEW sequence where nothing moves \u2014 every clip keeps its framing (an HD clip filling HD fills UHD at 200%). A new aspect asks how: fit (bars), fill (crop) or stretch.",inputs:[{id:"width",label:"Width",type:"number",default:3840},{id:"height",label:"Height",type:"number",default:2160},{id:"fit",label:"If the aspect changes",type:"choice",choices:[["","Ask"],["fit","Fit (bars)"],["fill","Fill (crop)"],["stretch","Stretch"]],default:""},{id:"name",label:"New sequence name",type:"text",optional:!0,placeholder:"default: <sequence>_REFORMAT"}],nodes:[{id:"edit",use:"verb.host_edit",label:"Resize",args:{host:"premiere",ops:[{kind:"reformat",args:{resolution_w:"$in.width",resolution_h:"$in.height",fit:"$in.fit"}}],name:"$in.name"}}]},{id:"consolidate",name:"Consolidate",part:!0,playbook:"deliver",aka:["media manage","copy the used media","trim with handles","collect media","archive the job","project manager","trim the Premiere project","collect files and copy to a new location"],group:"Deliver",...Ie,about:"Copies only the media the timeline uses, trimmed with handles (byte-exact, no re-encode: ProRes, DNx, H.264/HEVC, MXF, BRAW, R3D\u2026), into a folder, and writes the timeline there as a new project for its host \u2014 Resolve a .drt, Premiere a .prproj \u2014 linked to the copies, every clip on its exact source frames.",inputs:[yt,{id:"host",label:"From",type:"choice",choices:Es,default:"resolve"},{id:"out",label:"Into",type:"folder"},{id:"handles",label:"Handles (frames)",type:"number",default:24},{id:"only_linked",label:"Linked clips only",type:"bool",default:!0}],nodes:[{id:"pull",use:"host.read",args:{host:"$in.host",from:"$in.source"},label:"Read the timeline"},{id:"consolidate",use:"verb.media_consolidate",label:"Consolidate",args:{session_id:"$pull.session_id",out_dir:"$in.out",handles:"$in.handles",only_linked:"$in.only_linked"}},{id:"prproj",use:"verb.timeline_write",when:"$in.host=premiere",label:"Write the Premiere project",args:{session_id:"$pull.session_id",target:"premiere-prproj",out_path:"$in.out"}},{id:"drt",use:"verb.timeline_write",when:"$in.host=resolve",label:"Write the Resolve timeline",args:{session_id:"$pull.session_id",target:"resolve-drt",out_path:"$in.out"}}]},{id:"compare",name:"Compare Cuts",part:!0,playbook:"deliver",aka:["what changed","diff two cuts","change list from files","old cut vs new cut","reconform EDL"],group:"Check",about:"Two versions of a cut as files: what changed between them, and the new one rebuilt from the old one's media and grade (an EDL / CSV of the changes, if asked).",inputs:[{id:"a",label:"Old version",type:"file",placeholder:"the cut whose media and grade exist"},{id:"b",label:"New version",type:"file"},{id:"edl_path",label:"Changes as an EDL",type:"file",optional:!0,placeholder:"write a CMX3600 EDL here"},{id:"csv_path",label:"Changes as a CSV",type:"file",optional:!0}],nodes:[{id:"compare",use:"verb.qc_compare",label:"Compare",args:{a:"$in.a",b:"$in.b",edl_path:"$in.edl_path",csv_path:"$in.csv_path"}}]},{id:"probe",name:"Probe",aka:["media info","what is this file","codec","frame rate of a file","timecode of a file","inspect media"],group:"Check",about:"What a media file is: codec, raster, rate, timecode, length, audio channels, colour tags.",inputs:[{id:"path",label:"File",type:"file"},{id:"fps",label:"Rate for audio-only files",type:"number",optional:!0}],nodes:[{id:"probe",use:"verb.media_probe",label:"Probe",args:{path:"$in.path",fps:"$in.fps"}}]},{id:"trim",name:"Trim Media",part:!0,playbook:"deliver",aka:["cut a clip","subclip","trim a file","pull a section","shorten a file"],group:"Prep",about:"A section of a media file as a new file, without re-encoding where the codec allows: from a frame or timecode to another, with handles.",inputs:[{id:"path",label:"File",type:"file"},{id:"in",label:"From",type:"text",placeholder:"frame or timecode 01:00:10:00"},{id:"out",label:"To (last frame)",type:"text",placeholder:"frame or timecode"},{id:"handles",label:"Handles (frames)",type:"number",optional:!0},{id:"out_path",label:"Write to",type:"file",optional:!0,placeholder:"default: beside the source"}],nodes:[{id:"trim",use:"verb.media_trim",label:"Trim",args:{path:"$in.path",in:"$in.in",out:"$in.out",handles:"$in.handles",out_path:"$in.out_path"}}]},{id:"sync",name:"Sync Dailies",part:!0,output:"timeline",aka:["sync sound","dailies","match sound to picture","audio sync","sync rushes"],group:"Prep",about:"Each picture file's sound found in the sound recorder's files (by timecode, then by the sound itself), as a dailies timeline.",inputs:[{id:"picture",label:"Picture",type:"files",placeholder:"camera files or folders"},{id:"sound",label:"Sound",type:"files",placeholder:"the recorder's WAVs or folders"},{id:"name",label:"Timeline name",type:"text",optional:!0}],nodes:[{id:"sync",use:"verb.media_sync",label:"Sync",args:{picture:"$in.picture",sound:"$in.sound",name:"$in.name"}}],view:{split:"row",panes:[{pane:"knobs",size:.36},{pane:"viewer",show:"$sync"}]}},{id:"patch",name:"Patch",playbook:"deliverables",aka:["patch a master","fix frames in the master","bypass re-encode","insert a fix","drop in a fix","replace frames by timecode"],group:"Deliver",about:"Cut a render of the fixed frames into a finished ProRes / DNx master by timecode, without re-encoding: the spec is checked first and every write verified (frames, timecode, audio), rolled back if it fails. A new file beside the master unless you choose to change the master itself.",inputs:[{id:"path",label:"Master",type:"file",placeholder:"the finished master .mov"},{id:"patch",label:"Fix",type:"file",optional:!0,placeholder:"the render of the fixed frames, with record TC",when:{input:"mode",is:["new","section","in_place","check"]}},{id:"mode",label:"Write",type:"choice",choices:[["new","A new patched master"],["section","Just the patched section"],["in_place","Into the master itself"],["check","Check only"],["undo","Undo the last in-place patch"]],default:"new"},{id:"in",label:"Starts at (cross-check)",type:"text",optional:!0,placeholder:"master frame or timecode; default: the fix's own TC",when:{input:"mode",is:["new","section","in_place","check"]}},{id:"out",label:"Ends at",type:"text",optional:!0,placeholder:"last master frame; default: the end of the fix",when:{input:"mode",is:["new","section","in_place","check"]}},{id:"out_path",label:"Write to",type:"folder",optional:!0,placeholder:"default: beside the master",when:{input:"mode",is:["new","section"]}}],nodes:[{id:"patch",use:"verb.media_patch",label:"Patch",args:{path:"$in.path",patch:"$in.patch",mode:"$in.mode",in:"$in.in",out:"$in.out",out_path:"$in.out_path"}}]},{id:"dcp",name:"Make DCP",part:!0,playbook:"deliverables",aka:["digital cinema package","cinema deliverable","DCP for a festival","theatrical package"],group:"Deliver",about:"A SMPTE DCP from the ProRes master and the mix: picture to JPEG 2000 in the DCI container, sound to the DCP's channels, CPL and PKL written and checked.",inputs:[{id:"path",label:"Master",type:"file",placeholder:"the ProRes master .mov"},{id:"wav",label:"Mix",type:"file",placeholder:"5.1 WAV (L R C LFE Ls Rs) or stereo"},{id:"title",label:"Title",type:"text",placeholder:"FILM_FTR-1_F_EN-XX_51_2K_20261009_TBD_SMPTE"},{id:"color",label:"Master is",type:"choice",choices:Os(lo),default:"rec709"},{id:"container",label:"Container",type:"choice",choices:[["","From the master"],...Os(ad)],default:""},{id:"resolution",label:"Size",type:"choice",choices:Os(sd),default:"2k"},{id:"kind",label:"Kind",type:"choice",choices:Os(ld),default:"feature"},{id:"out",label:"Write to",type:"folder",optional:!0,placeholder:"default: beside the master"}],nodes:[{id:"dcp",use:"verb.media_dcp",label:"Make the DCP",args:{path:"$in.path",wav:"$in.wav",title:"$in.title",color:"$in.color",container:"$in.container",resolution:"$in.resolution",kind:"$in.kind",out_dir:"$in.out"}}]},{id:"dcp-patch",name:"Patch DCP",part:!0,playbook:"finishing-fixes",aka:["fix a shot in the DCP","replace frames in a DCP","DCP patch","drop j2c into a DCP","version file","VF"],group:"Deliver",about:"A fix dropped into a finished DCP without rebuilding it: a ProRes render, .j2c frames, an MXF or a WAV over the frames it replaces. Only the touched reels are re-wrapped; the rest are carried, or referenced from the OV in a VF. Checked before writing, proven after.",inputs:[{id:"dcp",label:"DCP",type:"folder",placeholder:"the DCP folder (with ASSETMAP.xml)"},{id:"path",label:"Fix",type:"file",placeholder:"ProRes .mov, .j2c (or a folder of them), .mxf or .wav"},{id:"at",label:"From frame",type:"text",placeholder:"frame or HH:MM:SS:FF from the start"},{id:"reel",label:"In reel",type:"number",optional:!0,placeholder:"makes From relative to this reel"},{id:"color",label:"Render is",type:"choice",choices:Os(lo),default:"rec709"},{id:"mode",label:"Package",type:"choice",choices:[["ov","New OV (plays anywhere)"],["vf","VF (only what changed)"],["check","Check only"]],default:"ov"},{id:"title",label:"Title",type:"text",optional:!0,placeholder:"default: the DCP's name, OV/VF set"},{id:"out",label:"Write to",type:"folder",optional:!0,placeholder:"default: beside the DCP"}],nodes:[{id:"patch",use:"verb.media_dcp_patch",label:"Patch the DCP",args:{dcp:"$in.dcp",path:"$in.path",at:"$in.at",reel:"$in.reel",color:"$in.color",mode:"$in.mode",title:"$in.title",out_dir:"$in.out"}}]},{id:"signoff",name:"Deliverable QC",part:!0,playbook:"deliverables",aka:["check the render","sign off a deliverable","spec check","is the master right","check the export","loudness check"],group:"Check",about:"Signs off a rendered deliverable against its spec: start timecode and length, codec, raster, rate, bit depth, audio channels and loudness, the name against your naming, and the picture against the approved reference.",inputs:[{id:"path",label:"The render",type:"file"},{id:"ref",label:"Approved reference",type:"file",optional:!0},{id:"start_tc",label:"Starts at",type:"text",optional:!0,placeholder:"01:00:00:00 (default: your profile's)"},{id:"frames",label:"Frames",type:"number",optional:!0},{id:"codec",label:"Codec",type:"text",optional:!0,placeholder:"ProRes 4444, ProRes 422 HQ, H.264"},{id:"width",label:"Width",type:"number",optional:!0},{id:"height",label:"Height",type:"number",optional:!0},{id:"fps",label:"Rate",type:"number",optional:!0},{id:"channels",label:"Audio channels",type:"number",optional:!0},{id:"loudness_lufs",label:"Loudness (LUFS)",type:"number",optional:!0},{id:"true_peak",label:"True peak (dBTP)",type:"number",optional:!0},{id:"end_on_picture",label:"Ends on its end card",type:"bool",default:!1}],nodes:[{id:"signoff",use:"verb.qc_deliverable",label:"Check",args:{path:"$in.path",ref:"$in.ref",start_tc:"$in.start_tc",frames:"$in.frames",codec:"$in.codec",width:"$in.width",height:"$in.height",fps:"$in.fps",channels:"$in.channels",loudness_lufs:"$in.loudness_lufs",true_peak:"$in.true_peak",end_on_picture:"$in.end_on_picture"}}]}];function uo(e,t){let r=[{id:"mode",label:"Do",type:"choice",choices:t.map(([i,a])=>[i,a]),default:t[0][0]}],o=[],n=t.map(([i,,a])=>[i,CR.find(s=>s.id===a)]);for(let[i,a]of n){let s=l=>l==="source"?l:`${i}_${l}`;for(let l of a.inputs){if(l.id==="source"){r.some(c=>c.id==="source")||r.splice(0,0,l);continue}r.push({...l,id:s(l.id),...l.not?{not:s(l.not)}:{},when:l.when?{input:s(l.when.input),is:l.when.is}:{input:"mode",is:[i]}})}o.push({id:i,use:`tool.${a.id}`,args:Object.fromEntries(a.inputs.map(l=>[l.id,`$in.${s(l.id)}`])),when:`$in.mode=${i}`,label:a.name})}return{...e,aka:[...e.aka??[],...n.flatMap(([,i])=>[i.name,...i.aka??[]])],inputs:r,nodes:o,...n[0][1].view?{view:n[0][1].view}:{}}}var Ni=[...CR,uo({id:"index",name:"Edit Index+",group:"Look",...Ie,about:"The open timeline's clips and markers as tables to filter and change in one undoable batch; rename; unused media; relink; VFX pulls; and on Premiere: proxies to online, cut in returns, un-nest, resize the sequence."},[["clips","Clips","clips"],["markers","Markers","markers"],["rename","Rename","rename"],["unused","Unused media","unused"],["relink","Relink","relink"],["vfx","VFX pulls","vfx"],["uprez","Proxies to online (Premiere)","uprez"],["cutin","Cut in returns (Premiere)","cutin"],["unnest","Un-nest (Premiere)","unnest"],["resize","Resize sequence (Premiere)","resize"]]),uo({id:"grades",name:"Grades",playbook:"patch",group:"Match",...Ie,about:"Copy grades (and sizing, crop, composite, colour, flags) from one track to another, or find each clip's earlier grade in the project's other timelines after a re-conform and bring it across."},[["copy","Copy track to track","copy-grades"],["trace","Find earlier grades","trace"]]),uo({id:"allclips",name:"Build Timeline",playbook:"conform",output:"timeline",group:"Prep",...Ie,about:"A new timeline from the cut: every clip the timelines use (overlaps merged, duplicates marked), every clip strung out with handles, or several timelines end to end. The open timeline is never edited."},[["all","All clips","all-clips"],["handles","Every clip with handles","handles"],["join","Join timelines","join-timelines"]]),uo({id:"autoconform",name:"Auto Conform",playbook:"autoconform",output:"timeline",group:"Match",about:"Rebuild the edit from a reference render and the source media; or bring a colour timeline up to a new cut (reconform); or compare two cut files and rebuild the new one from the old one's media."},[["conform","From a reference movie","conform-reference"],["recut","To a new cut (reconform)","reconform"],["compare","Compare two cut files","compare"],["sync","Sync dailies","sync"]]),uo({id:"qc",name:"QC",playbook:"deliverables",group:"Check",...Ie,about:"Check the timeline after the grade through the render plugin (black edges and frames, clipping, freezes, flashes, dead pixels, loudness), find clips whose sizing shows black, or sign off a rendered deliverable against its spec."},[["finishing","Finishing QC","finishing-qc"],["blanking","Blanking","blanking"],["deliverable","Deliverable QC","signoff"]]),uo({id:"deliver",name:"Trim & Archive",playbook:"deliver",group:"Deliver",about:"The timeline's media trimmed with handles: a package (folder, .iso, bucket, peer to peer), a consolidated project for its host, or one file cut down."},[["archive","Archive","archive"],["consolidate","Consolidate","consolidate"],["trim","Trim a file","trim"]]),uo({id:"delivery",name:"Manage Delivery",playbook:"deliverables",group:"Deliver",about:"Deliverables out of the cut: a render per marker named by a delivery convention, a DCP from the master and the mix, or a fix dropped into a finished DCP."},[["renders","Marker renders","renders"],["dcp","Make a DCP","dcp"],["dcppatch","Patch a DCP","dcp-patch"]])],Jj=new Set(["account_login","account_status","account_logout","account_telemetry","conform_learn","report","job","tool","app","project","project_link","team","timeline_routes","timeline_sessions","artist_profile","naming"]),Kj=new Set(["path","reference","a","b","plate","render","master","patch","edl_path","csv_path","credits_path","look_path"]),qj=new Set(["out_dir","media_root","target_dir","images_dir","pool"]),Xj=new Set(["pool","paths","picture","sound","mix","media_dirs","fonts"]);function DR(e){let t=[];for(let r of e){if(Jj.has(r.name)||r.name.startsWith("host_"))continue;let o=Ts(h.object(r.inputSchema)),n=[],i=!0;for(let[a,s]of Object.entries(o.properties??{})){if(a==="background"||a.startsWith("__"))continue;let l=!!o.required?.includes(a)&&s.default===void 0,c=Array.isArray(s.type)?s.type[0]:s.type,u=s.enum?"choice":c==="boolean"?"bool":c==="number"||c==="integer"?"number":c==="string"?Kj.has(a)?"file":qj.has(a)?"folder":"text":c==="array"&&s.items?.type==="string"&&Xj.has(a)?"files":null;if(!u){if(l){i=!1;break}continue}n.push({id:a,label:a.replace(/_/g," "),type:u,optional:!l,...s.default!==void 0?{default:s.default}:{},...s.enum?{choices:s.enum.map(d=>[d,d])}:{},...s.description?{placeholder:s.description.slice(0,120)}:{}})}i&&t.push({id:`verb-${r.name.replace(/_/g,"-")}`,name:r.title??r.name,group:"API",about:String(r.description??"").split(/(?<=\.)\s/)[0],inputs:n,nodes:[{id:"run",use:`verb.${r.name}`,args:Object.fromEntries(n.map(a=>[a.id,`$in.${a.id}`]))}]})}return t}var Y7="io.modelcontextprotocol/skills",FR=3e5,Yj=512,Qj=16*1024*1024;async function eN(){let e=Ke("CONFORM_PLAYBOOKS_DIR");if(e)return await ar(e)?e:null;let t=jn(new URL("../../api/playbooks/",import.meta.url));return await ar(t)?t:null}var tN={md:"text/markdown",txt:"text/plain",json:"application/json",yaml:"application/yaml",yml:"application/yaml",py:"text/x-python",ts:"text/typescript",js:"text/javascript",sh:"text/x-shellscript",csv:"text/csv",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",svg:"image/svg+xml",pdf:"application/pdf"},nN=e=>tN[e.split(".").pop()?.toLowerCase()??""]??"application/octet-stream";async function rN(e){let t=new Uint8Array(await crypto.subtle.digest("SHA-256",e));return"sha256:"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function oN(e){let t=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(e);if(!t)return null;let r={};for(let o of t[1].split(/\r?\n/)){let n=/^([A-Za-z0-9_-]+):\s*(.*)$/.exec(o);if(!n)continue;let i=n[2].trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),r[n[1]]=i}return r}async function LR(e,t,r,o){let n=[];for await(let i of je(e))n.push(i);n.sort((i,a)=>i.name.localeCompare(a.name));for(let i of n){if(i.name.startsWith("."))continue;let a=t?`${t}/${i.name}`:i.name;i.isDirectory?(o.push(a),await LR(M(e,i.name),a,r,o)):i.isFile&&r.push({rel:a,abs:M(e,i.name)})}}async function iN(e){let t=[];for await(let o of je(e))o.isDirectory&&!o.name.startsWith(".")&&t.push(o.name);let r=[];for(let o of t.sort()){let n=[];await LR(M(e,o),"",n,[]),r.push({name:o,files:await Promise.all(n.filter(i=>i.rel.endsWith(".md")).map(async i=>({path:i.rel,bytes:await ut(i.abs)})))})}return r}var aN=()=>`${qt().supabaseUrl}/functions/v1/v1-me/v1/engine/playbooks`;async function sN(){let e=await Dr().catch(()=>null);if(!e)throw new Error("not signed in: call account_login, then try again");let t=await fetch(aN(),{headers:{authorization:`Bearer ${e}`,apikey:qt().anonKey},signal:AbortSignal.timeout(8e3)}),r=await t.json().catch(()=>null);if(!t.ok||!Array.isArray(r?.playbooks))throw new Error(r?.error?.message??`conform.tools answered ${t.status}`);let o=new TextEncoder;return{version:String(r.version??"unknown"),skills:r.playbooks.map(n=>({name:n.name,files:n.files.map(i=>({path:i.path,bytes:o.encode(i.text)}))}))}}async function jR(e){let t=[];for(let r of e){if(!r.files.some(s=>s.path==="SKILL.md"))continue;let o=`skill://${r.name}`,n=[],i=new Set([""]);for(let s of[...r.files].sort((l,c)=>l.path.localeCompare(c.path))){let l=s.path.split("/");for(let c=1;c<l.length;c++)i.add(l.slice(0,c).join("/"));n.push({uri:`${o}/${s.path}`,path:s.path,name:l[l.length-1],bytes:s.bytes,digest:await rN(s.bytes),mimeType:nN(s.path)})}let a=oN(new TextDecoder().decode(n.find(s=>s.path==="SKILL.md").bytes));!a||a.name!==r.name||typeof a.description!="string"||n.length>Yj||n.reduce((s,l)=>s+l.bytes.length,0)>Qj||t.push({name:r.name,uri:`${o}/SKILL.md`,root:o,frontmatter:a,files:n,dirs:i})}return t}var ud=null;function jy(){ud??=(async()=>{let t=await eN();if(t)return{skills:await jR(await iN(t)),source:"local",version:"local"};let r=await sN();return{skills:await jR(r.skills),source:"conform.tools",version:r.version}})();let e=ud;return e.catch(()=>{ud===e&&(ud=null)}),e}async function md(){try{return(await jy()).skills}catch{return[]}}function zR(e){return{uri:e.uri,frontmatter:e.frontmatter,resources:e.files.map(t=>({uri:t.uri,digest:t.digest,size:t.bytes.length}))}}var dd=class extends Error{constructor(r,o){super(o);this.code=r}},UR=-32602;async function Q7(){return{resultType:"complete",skills:(await md()).map(zR),ttlMs:FR,cacheScope:"public"}}async function eH(e){let t=(await md()).find(r=>r.uri===e);if(!t)throw new dd(UR,`No skill is served at ${String(e)}`);return{resultType:"complete",skill:zR(t),ttlMs:FR,cacheScope:"public"}}async function tH(e){let t=String(e??"").replace(/\/$/,"");for(let r of await md()){if(t!==r.root&&!t.startsWith(r.root+"/"))continue;let o=t===r.root?"":t.slice(r.root.length+1);if(!r.dirs.has(o))break;let n=o?o+"/":"",i=[];for(let a of[...r.dirs].sort())a&&a.startsWith(n)&&!a.slice(n.length).includes("/")&&i.push({uri:`${r.root}/${a}`,name:a.slice(n.length),mimeType:"inode/directory"});for(let a of r.files)a.path.startsWith(n)&&!a.path.slice(n.length).includes("/")&&i.push({uri:a.uri,name:a.name,mimeType:a.mimeType});return{resultType:"complete",resources:i}}throw new dd(UR,`No skill directory at ${t}`)}async function BR(){let e=await md();return e.length?["Skills: this server ships Agent Skills that say how a conform artist uses these tools. Load the one that fits the task:",...e.map(t=>`- ${t.uri} \u2014 ${t.frontmatter.description}`)].join(`
|
|
73
|
+
`):""}var Ny=["conform","autoconform","deliver","deliverables","troubleshoot","patch"],Fy=["avid","premiere","resolve","finalcut","flame","baselight","protools"],lN={conform:["conform-artist",["SKILL.md","references/turnover-checklist.md"]],autoconform:["auto-conform",["SKILL.md"]],deliver:["delivery-qc",["SKILL.md"]],deliverables:["deliverables",["SKILL.md"]],troubleshoot:["conform-artist",["references/troubleshooting.md"]],patch:["finishing-fixes",["SKILL.md"]]},NR={avid:"references/avid.md",premiere:"references/premiere.md",resolve:"references/resolve.md",finalcut:"references/other-hosts.md",flame:"references/other-hosts.md",baselight:"references/other-hosts.md",protools:"references/other-hosts.md"},cN=e=>e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").trimStart(),VR=new Set,ZR=()=>VR.size>0;async function GR(e,t=[]){let{skills:r,version:o}=await jy(),[n,i]=lN[e],a=r.find(f=>f.name===n);if(!a)throw new Error(`the ${n} playbook is not available (version ${o})`);let s=r.find(f=>f.name==="conform-artist"),l=i.map(f=>[a,f]);for(let f of t)l.some(([,m])=>m===NR[f])||l.push([s,NR[f]]);let c=[],u=[];for(let[f,m]of l){let p=f?.files.find(g=>g.path===m);p&&(u.push(p.uri),c.push(`<!-- ${p.uri} -->
|
|
74
|
+
${cN(new TextDecoder().decode(p.bytes)).trimEnd()}`))}VR.add(e);let d=`conform.tools playbook \u2014 ${e} (version ${o}). Follow it for this task; it says how a conform artist uses these tools and what to tell the user.`;return{task:e,version:o,files:u,text:[d,...c,uN(e)].filter(Boolean).join(`
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
`)}}function uN(e){let t=Ni.filter(r=>r.playbook===e);return t.length?`Tools for this (tool_run id=\u2026, the same ones on the conform.tools app's desktop; each runs on the settings the artist left for it in this job): ${t.map(r=>`${r.name} (${r.id})`).join(", ")}.`:""}async function Ms(e,t){let r;try{r=(await jy()).skills.find(a=>a.name===e)}catch{return""}let o=r?.files.find(a=>a.path==="SKILL.md");if(!o)return"";let n=new Set(["always",...t]),i=[];for(let a of new TextDecoder().decode(o.bytes).split(/^(?=#{1,3} )/m)){let s=a.match(/^### (.+?) \(when: ([a-z_, ]+)\)\s*\n/);s&&s[2].split(",").some(l=>n.has(l.trim()))&&i.push(`**${s[1]}.** ${a.slice(s[0].length).trim().replace(/\s*\n\s*/g," ")}`)}return i.join(`
|
|
79
|
+
`)}var dN=he(),mo=M(dN,"jobs"),Cs=new Map;function mN(){let e=new Uint8Array(4);return crypto.getRandomValues(e),"job-"+Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}async function fd(e){try{await be(mo),await ge(M(mo,`${e.id}.json`),JSON.stringify(e));let{result:t,...r}=e;await ge(M(mo,".current"),JSON.stringify(r))}catch{}}function Ds(e,t){let r=new AbortController,o=new Date().toISOString(),n={id:mN(),verb:e,status:"running",started_at:o,updated_at:o,phase:"starting",done:0,total:0},i=0,s=t((l,c,u)=>{n.done=l,n.total=c,n.phase=u,n.updated_at=new Date().toISOString();let d=Date.now();d-i>2e3&&(i=d,fd(n))},r.signal).then(l=>(n.status=l.isError?"failed":"done",n.result=l,n.error=l.isError?l.content[0]?.text:void 0,n.finished_at=new Date().toISOString(),fd(n),l),l=>{n.status=r.signal.aborted?"cancelled":"failed",n.error=l instanceof Error?l.message:String(l),n.finished_at=new Date().toISOString(),fd(n);let c={content:[{type:"text",text:`error: ${n.error}`}],isError:!0,structuredContent:{ok:!1,code:n.status==="cancelled"?"cancelled":"engine",message:n.error}};return n.result=c,c});return Cs.set(n.id,{rec:n,ctrl:r,promise:s}),fd(n),n}function Ly(e){return Cs.get(e)?.promise??null}async function HR(e){let t=Cs.get(e);if(t)return t.rec;try{return JSON.parse(await _e(M(mo,`${e}.json`)))}catch{return null}}function zy(e){let t=Cs.get(e);return!t||t.rec.status!=="running"?!1:(t.ctrl.abort(),!0)}async function WR(){let e=new Map;try{await be(mo);for await(let t of je(mo))if(t.name.endsWith(".json"))try{let r=JSON.parse(await _e(M(mo,t.name)));e.set(r.id,r)}catch{}}catch{}for(let t of Cs.values())e.set(t.rec.id,t.rec);return[...e.values()].sort((t,r)=>r.started_at.localeCompare(t.started_at)).slice(0,50)}function Uy(e){let t=e.total?` ${Math.round(100*e.done/e.total)}%`:"";return`${e.id} ${e.verb} ${e.status} \u2014 ${e.phase}${t} (started ${e.started_at}${e.finished_at?`, finished ${e.finished_at}`:""})${e.error?`
|
|
80
|
+
${e.error}`:""}`}var JR={facility:"",templates:{}},fN={TITLE:"[^_]+",NN:"\\d{2,3}",INITIALS:"[A-Z]{2,3}",COLORSPACE:"[A-Z0-9]+",GAMMA:"[A-Z0-9.]+",FORMAT:"\\d+x\\d+[pi]\\d+",YYYYMMDD:"\\d{8}",HHMM:"\\d{4}"},Vy=()=>M(he(),"profile.json");async function on(e){let t=JR;for(let r of[Vy(),M(he(),"naming.json")])try{t={...JR,...JSON.parse(await _e(r))};break}catch{}return e?Zy(t,e):t}async function po(e){return on(e??(await zn())?.name)}function Zy(e,t){let r=e.projects?.[t]??e.projects?.[t.toUpperCase()];return r?{...e,...r,templates:{...e.templates,...r.templates},values:{...e.values,...r.values},patterns:{...e.patterns,...r.patterns},codec_folders:{...e.codec_folders,...r.codec_folders},deliverables:r.deliverables??e.deliverables,conventions:{...e.conventions,...r.conventions}}:e}function qR(e,t,r){let o=/p(\d+)$/.exec(t.FORMAT??"")?.[1];if(!t.FORMAT||!o)throw new P("invalid_args","deliverables needs FORMAT at the program's OAR, e.g. 3840x2160p23976");let n=[];for(let i of e.deliverables??[]){if(i.optional&&!r.include_optional)continue;let a=i.raster==="OAR"?t.FORMAT.replace(/p\d+$/,""):i.raster;for(let s of i.texts.length?i.texts:[""]){if(pN.test(s)&&!r.textless)continue;let l=Fi(e,"deliverable",{...pd(),...t,TEXT:s,CODEC:i.CODEC,AUDIOCONFIG:i.AUDIOCONFIG,FORMAT:`${a}p${o}`,HHMM:t.HHMM??""})+`.${i.ext}`;n.push({label:i.label,text:s,name:l,codec:i.CODEC,audio:i.AUDIOCONFIG,raster:a,container:i.raster!=="OAR"&&a!==t.FORMAT.replace(/p\d+$/,"")})}}return n}var pN=/LESS|CLEAN|NOTEXT|NO-TEXT/i;async function Ns(e,t={}){if(!e||typeof e.templates!="object")throw new P("invalid_args","a profile needs templates: {kind: template}");for(let[r,o]of Object.entries(e.templates))if(!/\[[A-Z0-9]+\??\]/.test(o))throw new P("invalid_args",`template ${r} has no [TOKEN] elements: ${o}`);return await be(he()),await ge(Vy(),JSON.stringify(t.stamp===!1?e:{...e,updated_at:new Date().toISOString()},null,2)),Vy()}function fo(e,t){let r=e.templates[t];if(!r&&!Object.keys(e.templates).length)throw new P("invalid_args",`no artist profile yet, so no '${t}' naming: learn it from their delivered files (artist_profile action=learn path=<a delivery folder>) or ask the artist how they name a ${t}`);if(!r)throw new P("invalid_args",`no '${t}' template in the ${e.facility||"artist"} profile (has: ${Object.keys(e.templates).join(", ")}): ask the artist, then artist_profile action=set`);return r}var XR=e=>e.split(/(\[[A-Z0-9]+\??\])/).filter(Boolean).map(t=>t.startsWith("[")?{tok:t.slice(1,-1).replace("?",""),opt:t.endsWith("?]")}:{lit:t}),By=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Fi(e,t,r){let o=XR(fo(e,t)),n="";return o.forEach((i,a)=>{if("lit"in i){n+=i.lit;return}let s=r[i.tok];if(s==null||s===""){if(!i.opt)throw new P("invalid_args",`${t} name needs ${i.tok} (template ${fo(e,t)})`);let l=o[a-1];l&&"lit"in l&&n.endsWith(l.lit.slice(-1))&&(n=n.slice(0,-1));return}n+=s}),n}function Li(e,t,r){let o=XR(fo(e,t)),n=[],i="";o.forEach((l,c)=>{if("lit"in l){let f=o[c+1];i+=By(f&&"tok"in f&&f.opt?l.lit.slice(0,-1):l.lit);return}let u=e.values?.[l.tok],d=e.patterns?.[l.tok]??(u?u.map(By).join("|"):fN[l.tok]??".+?");n.push(l.tok),i+=l.opt?`(?:${By(o[c-1]?.lit?.slice(-1)??"")}(${d}))?`:`(${d})`});let a=new RegExp(`^${i}(?:\\.([A-Za-z0-9]{2,5}))?$`).exec(B(r));if(!a)return null;let s={};return n.forEach((l,c)=>{a[c+1]!=null&&(s[l]=a[c+1])}),{values:s,ext:a[n.length+1]??""}}var js=e=>String(e).padStart(2,"0"),pd=(e=new Date)=>({YYYYMMDD:`${e.getFullYear()}${js(e.getMonth()+1)}${js(e.getDate())}`,HHMM:`${js(e.getHours())}${js(e.getMinutes())}`});function hN(e){let t=Number(/^(\d+)x/.exec(e.FORMAT??"")?.[1]??0);return{JOBCODEC:/^PR/i.test(e.CODEC??"")?"pr":(e.CODEC??"").split("_")[0].toLowerCase(),JOBTEXT:e.TEXT==="TEXTLESS"?"txtls":"txtd",JOBRASTER:t>=3840?"uhd":t>=1920?"hd":"sd"}}function Gy(e,t,r){let o=e.conventions?.no_audio_tag;if(r.picture_only!==!1&&/\[AUDIOCONFIG/.test(fo(e,"patch"))&&!o)throw new P("invalid_args","how does this artist mark a picture-only file in AUDIOCONFIG (NOAUDIO, MOS\u2026)? ask, then artist_profile action=remember conventions={no_audio_tag: '\u2026'}");let n=Li(e,"deliverable",t);if(!n)throw new P("invalid_args",`'${B(t)}' does not follow the ${e.facility} deliverable template ${fo(e,"deliverable")}; name the patch from a real deliverable`);let i={...n.values,...pd(r.when),NN:js(r.nn),...r.text?{TEXT:r.text}:{},...r.picture_only!==!1&&o?{AUDIOCONFIG:o}:{},...Object.fromEntries((e.deprecated??[]).map(f=>[f,""]))},a=Fi(e,"patch",i)+(n.ext?`.${n.ext}`:""),s=[],l=e.templates.render_job?Fi(e,"render_job",{...i,...hN(i)}):"";l||s.push(`no 'render_job' template in the ${e.facility||"artist"} profile: name the render job yourself, or ask the artist and artist_profile action=set`);let c=Object.entries(e.codec_folders??{}).find(([f])=>(i.CODEC??"").toUpperCase().startsWith(f))?.[1]??"",u=e.templates.patches_folder?"patches_folder":e.templates.deliverables_folder?"deliverables_folder":"",d=u?Fi(e,u,{...i,CODECFOLDER:c}):"";return{file:a,job:l,folder:d,master_values:n.values,warnings:s}}var KR={ap4h:"PR4444",ap4x:"PR4444XQ",apch:"PRHQ",apcn:"PR422",apcs:"PRLT",apco:"PRPROXY"},gN={bt709:"REC709",bt2020:"REC2020",smpte432:"P3D65",smpte431:"P3DCI"},bN={smpte2084:"PQ","arib-std-b67":"HLG"},yN=e=>String(Math.round(e*1e3)/1e3).replace(".","");function Hy(e){let t=e.streams?.find(i=>i.kind==="video"),r=t?.codec_specific??{},o=e.source_fps??t?.rate??0,n=e.streams?.filter(i=>i.kind==="audio")??[];return{CODEC:r.fourcc&&KR[r.fourcc]?KR[r.fourcc]:/h264|avc/i.test(t?.codec??"")?"H264":null,FORMAT:t?.width&&t.height&&o?`${t.width}x${t.height}p${yN(o)}`:null,COLORSPACE:r.colr?gN[r.colr.primaries]??null:null,GAMMA:r.colr?bN[r.colr.transfer]??null:null,AUDIOCH:n.length?String(n.reduce((i,a)=>i+(a.channels??0),0)):"0"}}function zi(e,t,r={}){let o=r.kind??(/[_-]PATCH\d/i.test(t)&&e.templates.patch?"patch":"deliverable"),n=Li(e,o,t),i=[];if(!n){let s=/\]_\[/.test(fo(e,o))&&/[A-Z0-9]-[A-Z]/.test(t.replace(/\d-\d/g,""))?" ('-' used as a separator: this profile separates every element with '_')":"";return i.push({element:"template",level:"error",message:`does not follow the ${e.facility} ${o} template ${fo(e,o)}${s}`}),{kind:o,values:null,issues:i}}let a=n.values;for(let s of e.deprecated??[])a[s]&&i.push({element:s,level:"warn",message:`${s} ${a[s]}: in older names, left out of new ones (unless asked)`});if(r.probe){let s=Hy(r.probe);for(let u of["CODEC","FORMAT","COLORSPACE","GAMMA"]){if(a[u]==null)continue;if(s[u]==null){u==="GAMMA"&&/^(PQ|HLG)$/.test(a[u])&&i.push({element:u,level:"error",message:`name says ${a[u]}, the file's transfer tag is not ${a[u]}`});continue}(u==="CODEC"?a[u]===s[u]||s[u]==="H264"&&a[u].startsWith("H264"):a[u]===s[u])||i.push({element:u,level:"error",message:`name says ${a[u]}, the file is ${s[u]}`})}let l=/^H26[45]_(\d+)mbps$/i.exec(a.CODEC??"")?.[1],c=r.probe.available_range?r.probe.available_range.duration.value/(r.probe.available_range.duration.rate||1):0;if(l&&r.probe.size_bytes&&c>1){let u=r.probe.size_bytes*8/c/1e6;(u<Number(l)*.6||u>Number(l)*1.3)&&i.push({element:"CODEC",level:"error",message:`name says ${l} Mbps, the file averages ${u.toFixed(1)} Mbps`})}if(a.AUDIOCONFIG){let u=/^(\d+)CH/.exec(a.AUDIOCONFIG)?.[1],d=e.conventions?.no_audio_tag??"NOAUDIO";a.AUDIOCONFIG===d&&s.AUDIOCH!=="0"&&i.push({element:"AUDIOCONFIG",level:"error",message:`name says ${d}, the file has ${s.AUDIOCH} audio channels`}),u&&u!==s.AUDIOCH&&i.push({element:"AUDIOCONFIG",level:"error",message:`name says ${u}CH, the file has ${s.AUDIOCH} audio channels`})}}if(r.master){let s=Li(e,"deliverable",r.master)?.values;if(!s)i.push({element:"master",level:"error",message:`master '${B(r.master)}' does not follow the deliverable template`});else for(let[l,c]of Object.entries(s))/^(YYYYMMDD|HHMM|TEXT)$/.test(l)||l==="AUDIOCONFIG"&&a[l]===(e.conventions?.no_audio_tag??"NOAUDIO")||a[l]!==c&&i.push({element:l,level:"error",message:`${a[l]??"(missing)"} \u2260 the master's ${c}`})}return{kind:o,values:a,issues:i}}var _N=/\.(mov|mp4|mxf|m4v|wav|aif|aiff)$/i,vN=/^(REC709|REC2020|REC2100|P3D65|P3DCI|P3D60|DCIP3|ACES|ACESCG|SRGB|XYZ)$/i,wN=/^(G\d(\.\d)?|G\d\d|PQ|HLG|ST2084|LOGC\d?|SLOG3|LINEAR|SRGB)$/i,kN=/^(TEXTED|TEXTLESS|TXTD|TXTLS|TXTLESS|CLEAN|TEXT|NOTEXT|NO-TEXT|SUBBED|SUBTITLED)$/i,$N=/^(\d+CH|NOAUDIO|MOS|STEREO|5-1|51|LTRT|LORO)$/i,xN=e=>/^(19|20)\d\d(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/.test(e);function SN(e){let t=r=>e.split(r).length-1;return["_","-"," ","."].reduce((r,o)=>t(o)>t(r)?o:r,"_")}function RN(e,t,r={}){let o=e.split(t),n=[],i=(s,l)=>xN(s)?"YYYYMMDD":/^([01]\d|2[0-3])[0-5]\d$/.test(s)&&l?.tok==="YYYYMMDD"?"HHMM":/^PATCH\d{1,3}$/i.test(s)?"PATCH":/^v\d{1,3}$/i.test(s)?"VERSION":r.FORMAT&&s===r.FORMAT||/^\d{3,5}x\d{3,5}[pi]\d{2,5}$/.test(s)?"FORMAT":r.CODEC&&(s===r.CODEC||r.CODEC==="H264"&&/^(H\.?264|AVC)/i.test(s))||/^(PR(4444(XQ)?|HQ|422|LT|PROXY)|H\.?26[45]|HEVC|DNX\w+|XAVC\w*|J2K|JPEG2000)$/i.test(s)?"CODEC":vN.test(s)||r.COLORSPACE&&s===r.COLORSPACE?"COLORSPACE":wN.test(s)||r.GAMMA&&s===r.GAMMA?"GAMMA":kN.test(s)?"TEXT":$N.test(s)?"AUDIOCONFIG":null;for(let s=0;s<o.length;s++){let l=o[s],c=i(l,n[n.length-1]);if(c==="CODEC"&&/^\d+mbps$/i.test(o[s+1]??"")){n.push({tok:c,raw:l+t+o[++s]});continue}if(c==="AUDIOCONFIG"){let u=l;for(;s+1<o.length&&!["YYYYMMDD","FORMAT","CODEC","COLORSPACE","GAMMA","TEXT","VERSION","PATCH"].includes(i(o[s+1])??"")&&!/^\d+$/.test(o[s+1]);)u+=t+o[++s];n.push({tok:c,raw:u});continue}n.push({tok:c??"?",raw:l})}let a=0;for(;a<n.length&&n[a].tok==="?";)a++;return a&&n.splice(0,a,{tok:"TITLE",raw:n.slice(0,a).map(s=>s.raw).join(t)}),n}function IN(e,t){let r=[],o=0;for(let n of e){for(;o<t.length&&t[o]!==n.tok;)o++;if(o===t.length)return null;r.push(o++)}return r}function TN(e,t){let r=Array.from({length:e.length+1},()=>new Array(t.length+1).fill(0));for(let a=e.length-1;a>=0;a--)for(let s=t.length-1;s>=0;s--)r[a][s]=e[a]===t[s]?r[a+1][s+1]+1:Math.max(r[a+1][s],r[a][s+1]);let o=[],n=0,i=0;for(;n<e.length&&i<t.length;)e[n]===t[i]?(o.push(e[n]),n++,i++):r[n+1][i]>=r[n][i+1]?o.push(e[n++]):o.push(t[i++]);return[r[0][0],[...o,...e.slice(n),...t.slice(i)]]}function PN(e,t){if(!e.length)throw new P("invalid_args","no names to learn from");let r=new Map;for(let d of e)r.set(d.toks.map(f=>f.tok).join(" "),(r.get(d.toks.map(f=>f.tok).join(" "))??0)+1);let o=[];for(let[d]of[...r].sort((f,m)=>m[1]-f[1])){let f=d.split(" ");if(!o.length){o=f;continue}let[m,p]=TN(o,f);m*2>=f.length&&(o=p)}let n=o.map(()=>[]),i=[];for(let d of e){let f=IN(d.toks,o);if(!f){i.push(d.file);continue}f.forEach((m,p)=>n[m].push(d.toks[p].raw))}let a=e.length-i.length,s={},l={},c=0;return{template:o.map((d,f)=>{let m=[...new Set(n[f])],p=n[f].length<a?"?":"";if(d==="?"){if(m.length===1&&!p)return m[0];let g=`FIELD${++c}`;return l[g]=m,`[${g}${p}]`}return d==="PATCH"?"PATCH[NN]":(d==="TEXT"&&(l.TEXT=m),d==="TITLE"&&(t!=="_"||m.some(g=>g.includes(t)))&&(s.TITLE=".+?"),`[${d}${p}]`)}).join(t),patterns:s,values:l,fitted:a,misfits:i}}async function*YR(e,t=3){for await(let r of je(e)){if(r.name.startsWith("."))continue;let o=M(e,r.name);r.isDirectory&&t>0?yield*YR(o,t-1):r.isFile&&_N.test(r.name)&&(yield o)}}async function QR(e,t={}){let r=e.replace(/\/+$/,""),o=[];if(await ar(r))for await(let $ of YR(r))o.push($);else o.push(r);if(!o.length)throw new P("not_found",`no media files under ${B(r)}`);o.length>200&&(o.length=200);let n=await Promise.all(o.map(async $=>{let C=await Pe($).catch(()=>null);return{file:$,m:C,e:C?Hy(C):{}}})),i=$=>B($,Kt($)),a=SN(i(o[0])),s=n.map($=>({...$,toks:RN(i($.file),a,$.e)})),l=$=>$.toks.some(C=>C.tok==="PATCH"),c={templates:{},patterns:{},values:{}},u=[];for(let[$,C]of[["deliverable",s.filter(E=>!l(E))],["patch",s.filter(l)]]){if(!C.length)continue;let E=PN(C.map(L=>({file:B(L.file),toks:L.toks})),a);c.templates[$]=E.template,Object.assign(c.patterns,E.patterns);for(let[L,q]of Object.entries(E.values))c.values[L]=[...new Set([...c.values[L]??[],...q])];u.push(...E.misfits)}let d={facility:"",...c},f=s.filter($=>!l($)).map($=>({x:$,v:Li(d,"deliverable",$.file)?.values})).filter($=>$.v),m=$=>($.m?.size_bytes??0)/Math.max(1,$.m?.available_range?$.m.available_range.duration.value/($.m.available_range.duration.rate||1):1),p=$=>/^(\d+x\d+)/.exec($.FORMAT??"")?.[1]??"",g=[...f].sort(($,C)=>m(C.x)-m($.x))[0],_=g?p(g.v):"",v=new Map;for(let{x:$,v:C}of f){let E=p(C),L=Kt($.file).slice(1).toLowerCase(),q=[C.CODEC,C.AUDIOCONFIG,L,E===_?"OAR":E].join("|"),O=v.get(q)??{label:`${C.CODEC??L} ${E===_?"at the OAR":E}`,CODEC:C.CODEC??"",AUDIOCONFIG:C.AUDIOCONFIG??"",ext:L,raster:E===_||!E?"OAR":E,texts:[]};C.TEXT&&!O.texts.includes(C.TEXT)&&O.texts.push(C.TEXT),v.set(q,O)}for(let $ of v.values())$.texts.sort();if(v.size&&(c.deliverables=[...v.values()]),await ar(r)){let $=/(19|20)\d{6}/,C={},E=$.test(B(r))?r:null;for(let{x:L,v:q}of f){let O=Kv(r,ft(L.file)).split(/[\\/]/).filter(Boolean),G=O.findIndex(j=>$.test(j));G>=0&&!E&&(E=M(r,...O.slice(0,G+1)));let X=O[O.length-1],ae=q.CODEC?.split(a)[0]??"",Y=ae.replace(/\d+$/,"");X&&!$.test(X)&&ae&&(C[Y.length>=2?Y:ae]=X)}if(Object.keys(C).length&&(c.codec_folders=C),E){let L=B(E).replace($,"[YYYYMMDD]").replace(/(\[YYYYMMDD\]\D?)([01]\d|2[0-3])[0-5]\d/,"$1[HHMM]");c.templates.deliverables_folder=`${B(ft(E))}/${L}${Object.keys(C).length?"/[CODECFOLDER]":""}`}}let y=new Set(s.filter($=>l($)&&$.m&&!$.m.streams?.some(C=>C.kind==="audio")).map($=>Li({facility:"",...c},"patch",$.file)?.values.AUDIOCONFIG).filter(Boolean));y.size===1&&(c.conventions={no_audio_tag:[...y][0]});let b=t.today??new Date().toISOString().slice(0,10),w=`learned from ${o.length} file(s) in ${B(r)} (${b})`;c.provenance=Object.fromEntries([...Object.keys(c.templates).map($=>[`templates.${$}`,w]),...c.deliverables?[["deliverables",w]]:[],...c.codec_folders?[["codec_folders",w]]:[]]);let k=await on(),I=AN(k,c,t.project,t.facility),x=t.project?Zy(I,t.project):I,S=n.flatMap($=>{let E=zi(x,B($.file),{probe:$.m??void 0}).issues.filter(L=>L.level==="error").map(L=>`${L.element}: ${L.message}`);return E.length?[{file:B($.file),issues:E}]:[]}),R={profile:I,learned:c,files:o.length,misfits:u,name_issues:S,source:w};return t.save!==!1&&(R.saved=await ho(I)),R}function AN(e,t,r,o){let n=a=>({...a,templates:{...a.templates,...t.templates},patterns:{...a.patterns,...t.patterns},values:{...a.values,...t.values},codec_folders:{...a.codec_folders,...t.codec_folders},deliverables:t.deliverables??a.deliverables,...t.conventions?{conventions:{...a.conventions,...t.conventions}}:{}}),i={...e.provenance,...Object.fromEntries(Object.entries(t.provenance??{}).map(([a,s])=>[r?`projects.${r}.${a}`:a,s]))};return r?{...e,facility:o??e.facility,provenance:i,projects:{...e.projects,[r]:n(e.projects?.[r]??{})}}:{...n(e),facility:o??e.facility,provenance:i}}function eI(e,t){let r=t.at??new Date().toISOString().slice(0,10);return{...e,rules:[...(e.rules??[]).filter(o=>o.rule!==t.rule),{...t,at:r}]}}function tI(e,t){let r=e.rules??[],o=typeof t=="number"?t-1:r.findIndex(n=>n.rule.toLowerCase().includes(t.toLowerCase()));if(o<0||o>=r.length)throw new P("not_found",`no rule matching ${t}`);return{...e,rules:r.filter((n,i)=>i!==o)}}function nI(e,t,r){let o=new Date().toISOString().slice(0,10);return{...e,conventions:{...e.conventions,...t},provenance:{...e.provenance,...Object.fromEntries(Object.keys(t).map(n=>[`conventions.${n}`,`${r} (${o})`]))}}}var Jy=e=>!Object.keys(e.templates).length&&!e.rules?.length&&!Object.keys(e.conventions??{}).length&&!e.tools?.length;function Fs(e){if(Jy(e))return"No artist profile yet. Learn it: artist_profile action=learn path=<a folder of their delivered files>; ask what the files cannot show (usual deliverable set, program start TC, how they route audio).";let t=o=>e.provenance?.[o]??e.provenance?.["*"],r=[`Artist profile${e.facility?`: ${e.facility}`:""}`];for(let[o,n]of Object.entries(e.templates))r.push(` ${o}: ${n}${t(`templates.${o}`)?` [${t(`templates.${o}`)}]`:""}`);if(e.deliverables?.length){r.push(` usual deliverables${t("deliverables")?` [${t("deliverables")}]`:""}:`);for(let o of e.deliverables)r.push(` ${o.label}: ${o.CODEC} ${o.AUDIOCONFIG} .${o.ext} ${o.raster}${o.texts.length?` (${o.texts.join(", ")})`:""}${o.optional?" \u2014 on request":""}`)}for(let[o,n]of Object.entries(e.conventions??{}))r.push(` ${o}: ${n}${t(`conventions.${o}`)?` [${t(`conventions.${o}`)}]`:""}`);return(e.rules??[]).forEach((o,n)=>r.push(` rule ${n+1}${o.topic?` (${o.topic})`:""}: ${o.rule} [${o.source}, ${o.at}]`)),e.projects&&r.push(` projects: ${Object.keys(e.projects).join(", ")}`),r.join(`
|
|
81
|
+
`)}async function rI(){await CN();let e=await on().catch(()=>null);return!e||Jy(e)?"Artist profile: none yet. Conventions that are the artist's choice (naming, usual deliverables, start TC, bins, routing) are not assumed: learn them (artist_profile action=learn) or ask, and save the answer (artist_profile action=remember).":`Artist profile: ${e.facility||"this artist"} (${Object.keys(e.templates).length} naming templates, ${e.deliverables?.length??0} deliverable kinds, ${e.rules?.length??0} workflow rules). Read it (artist_profile) before naming, rendering or delivering, and follow it. When the artist corrects you, ask whether it is their preference (artist_profile action=remember) or a rule for everyone (report_issue).`}var EN=()=>`${qt().supabaseUrl}/functions/v1/v1-me/v1/engine/artist-profile`;async function Wy(e,t){let r=await Dr().catch(()=>null);if(!r)return null;let o=await fetch(EN(),{method:e,signal:AbortSignal.timeout(5e3),headers:{authorization:`Bearer ${r}`,apikey:qt().anonKey,...t?{"content-type":"application/json"}:{}},...t?{body:JSON.stringify(t)}:{}});return o.ok?await o.json():null}var hd=()=>M(he(),"tools"),oI=()=>M(he(),"tool-layout.json");async function iI(e){let t=[];try{for await(let o of je(hd()))if(o.name.endsWith(".json"))try{t.push(JSON.parse(await _e(M(hd(),o.name))))}catch{}}catch{}let r;try{r=JSON.parse(await _e(oI()))}catch{}return{...e,tools:t,...r?{tool_layout:r}:{}}}async function ON(e){let{tools:t,tool_layout:r,...o}=e;if(await Ns(o,{stamp:!1}),!!Array.isArray(t)){await be(hd());for(let n of t)typeof n?.id!="string"||!/^[a-z][a-z0-9_-]{0,63}$/.test(n.id)||await ge(M(hd(),`${n.id}.json`),JSON.stringify(n,null,2));r&&await ge(oI(),JSON.stringify(r,null,2))}}async function ho(e){let t=await Ns(e);return await Wy("PATCH",{profile:await iI(await on())}).catch(()=>null),t}var aI=async()=>{await ho(await on())};function MN(e,t){let r=e.updated_at??"",o=t?.updated_at??"";return t&&o>r?"pull":!Jy(e)&&r>o?"push":"same"}async function CN(){try{let e=await Wy("GET");if(!e)return"offline";let t=await iI(await on()),r=e.profile??null,o=MN(t,r);return o==="pull"&&await ON(r),o==="push"&&await Wy("PATCH",{profile:t}),o==="pull"?"pulled":o==="push"?"pushed":"same"}catch{return"offline"}}var cI="the conform.tools engine on this machine: timeline exchange between editing hosts (Avid, Premiere, Resolve, Final Cut, Flame), relinking, media probe/trim/consolidate, QC, graphics, delivery packages and auto conform",uI=["Before any conform, timeline conversion, relink, verification or delivery task, call conform_learn with the task (and the hosts involved) and follow the playbook it returns. It needs a signed-in account; if it cannot load (offline), carry on with the tools.","Work on a job happens in its project: when the user names the job (or you can tell which it is from project action=list), call project action=open first and follow the context it returns \u2014 the same notes the conform.tools app, its offline assistant and the user's teammates work from. Add what you learn about the job (spec, deliverables, naming, decisions) with project action=context text=\u2026 (the whole notes, edited).","The artist's tools are recipes (tool action=list: Auto Conform, Relink, Copy Grades, VFX Pulls, Graphics, Finishing QC\u2026, plus the artist's own) \u2014 the same tools the conform.tools app shows on its desktop and its offline model picks. When one fits the request, run it (tool_run id, inputs) rather than rebuilding it from verbs: it runs on the settings the artist left for it in this job, and a review it reaches waits for an OK (tool_run action=list / apply with keep or drop / undo) wherever it was started. When the artist describes a tool nothing does, build the recipe (tool action=blocks, then save).","When the conform.tools app is open on this machine you drive the artist's window, the way they would by hand (it is the same engine: tool, tool_run and app run in it). app action=state says which job and tabs are open, each tab's settings and timeline, and what waits for an OK; app action=open (tool, settings, source) brings that tool to the front with what they asked for filled in, ready to look at or Run; action=job switches job, home goes back to Home. When the artist will want to see or check the result, open the tool for them as well as running it: every tool_run you start shows live in that tool's tab, and a review they have open there is yours to read and apply.",'When the user says a result is wrong, complains about it, corrects an output, or a tool failed unexpectedly, call report kind=issue with a short summary, what happened and what they expected, plus the session_id / verb / job_id involved, and give them the report id. A lesson, workflow rule or suggestion (nothing broke: "the patch range runs whole clip before to whole clip after", "this facility files renders in 200 - FINISH") goes to report kind=note, not report kind=issue.'],sI=[`conformtools ${Nn} is ${cI}. account_status shows the running version and whether a newer one is on npm.`,'When you call one of these tools, say so in one short line first: "using conformtools: <tool>" (for example "using conformtools: timeline_read").','Whenever you do a post-production task (anything about timelines, edits, media files, codecs, timecode, relinking, conforming, delivery) with ANYTHING other than conformtools, such as ffmpeg, ffprobe, mediainfo, exiftool, a python or shell script, another MCP server, or manual steps you ask the user to do in a host app, or when conformtools cannot do the task at all, call report kind=gap once for that task, before or right after the workaround. Say what the user wanted (task), what you used instead (used_instead, e.g. "ffprobe -show_streams"), why not conformtools (missing_tool, missing_option, tool_failed, did_not_know), and what you needed from it (needed: the information or operation, and which of its output fields you used) so the team can build it into conformtools. Tell the user you sent it. Never put full file paths in it; file names at most.',"report never sends media, file contents or timeline files. Outcome telemetry is off unless the user turned it on (account_telemetry)."],lI=[`You are the assistant inside the conform.tools app (engine ${Nn}), ${cI}. You work for a post-production conform artist on one project at a time.`,"The app shows every tool call and its result to the person, so do not narrate which tool you are calling; say what you found and what you recommend, briefly. Lead with the answer.","Tools that change or overwrite things wait for the person to allow them; propose them plainly and do not ask for permission in text as well.","Paths are on this machine. When a result names a session_id, the app can show that timeline; refer to timelines by name, not by id.","The app's Home is a desktop of every tool; each opens in a tab of its own with its own screen (the recipe's view: knobs, viewer, rows, compare\u2026), all working on the project's timeline (Resolve or Premiere live, a project timeline, a file). app action=state says which tabs are open, the job's timeline and what is waiting for an OK; app action=open (tool, settings) opens a tool for the artist with what they asked for filled in. Prefer an existing tool, opened and filled in, over a new one. Every tool_run you start shows in that tool's tab, and a review the artist has open in a tab is yours to read and apply. When you build a recipe, its screen too when they say how they want to see it, open it for them.","Working in the open Resolve timeline: host_current via=export reads it exactly into a session; timeline_query finds clips/markers (rows carry track V1/A1 and timeline_range.start = the record frame from the timeline start); host_items adds what the file lacks (clip colour, flags, versions, groups). To change clips in place, host_apply with items addressed {kind, track, start} from those rows (its reply's undo_id puts the batch back: offer it). To build a timeline (handles, all clips, inserts), timeline_edit on the session, then host_open session_id + timeline_id with link_existing=true; the open timeline is never edited. Finishing QC on the timeline: host_render renderplugin=true."],dI=[sI[0],...uI,...sI.slice(1)].map((e,t)=>t?`${t}. ${e}`:e).join(`
|
|
82
|
+
`),DN=[lI[0],...uI,...lI.slice(1)].join(`
|
|
83
|
+
`);async function yH(e){let t=await Promise.all([rI().catch(()=>""),BR().catch(()=>"")]);return[e==="mcp"?dI:DN,...t].filter(Boolean).join(e==="mcp"?`
|
|
84
|
+
`:`
|
|
85
|
+
|
|
86
|
+
`)}var fI=()=>M(he(),"logs","engine.jsonl"),mI=new Set;function pI(e){if(!e||typeof e!="object")return{};let t={};for(let[r,o]of Object.entries(e))typeof o=="string"?t[r]=o.length>200?`${o.slice(0,200)}\u2026`:o:Array.isArray(o)?t[r]=o.length>20?`[${o.length} items]`:o:o&&typeof o=="object"?t[r]=JSON.stringify(o).length>400?"{\u2026}":o:t[r]=o;return t}async function hI(e){let t=JSON.stringify(e);console.error(`[conform] ${e.verb} ${e.ok?"ok":`FAIL ${e.code??""}`} ${e.ms} ms${e.job?` job ${e.job}`:""}`);try{let r=fI(),o=M(he(),"logs");mI.has(o)||(await be(o),mI.add(o)),await ge(r,t+`
|
|
87
|
+
`,{append:!0})}catch{}}async function gI(e,t={}){let r="";try{r=await _e(fI())}catch{return[]}let o=r.split(`
|
|
88
|
+
`).slice(-5e3),n=[];for(let i=o.length-1;i>=0&&n.length<e;i--){if(!o[i])continue;let a;try{a=JSON.parse(o[i])}catch{continue}let s=t.session_id,l=t.job_id;(s||l)&&!(s&&(a.session===s||a.args?.session_id===s||a.args?.hints_session_id===s)||l&&(a.job===l||a.args?.job_id===l))||n.push(a)}return n.reverse()}var bI=["issue","gap","note"],bd=["low","medium","high","blocker"],yd=["missing_tool","missing_option","tool_failed","did_not_know","other"];var Ky=String.raw`[^\s"'${"`"}<>|,;()[\]{}\\/]+(?: [^\s"'${"`"}<>|,;()[\]{}\\/:]+(?=$|[\s"'${"`"}<>|,;()[\]{}\\/]))*`,yI=String.raw`[^\s"'${"`"}<>|,;()[\]{}\\/]+`,jN=new RegExp(String.raw`(?<![A-Za-z0-9_.~:\\/-])(?:file://)?(?:~|[A-Za-z]:)?(?:[\\/]${Ky}){2,}[\\/]?|\\\\${Ky}(?:\\${Ky})+`+String.raw`|(?<![A-Za-z0-9_.~:\\/-])${yI}(?:[\\/]${yI}){2,}`,"g");function NN(e){let t=e.replace(/[\\/]+$/,""),r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return r>=0?t.slice(r+1):t}function _I(e){return e.replace(jN,t=>NN(t.replace(/^file:\/\//,"")))}function qy(e,t=300,r=0){if(typeof e=="string")return gd(_I(e),t);if(typeof e=="number"||typeof e=="boolean"||e===null)return e;if(r>4)return null;if(Array.isArray(e))return e.slice(0,20).map(o=>qy(o,t,r+1));if(e&&typeof e=="object"){let o={};for(let[n,i]of Object.entries(e).slice(0,40))o[gd(n,64)]=qy(i,t,r+1);return o}return null}var gd=(e,t)=>e.length>t?`${e.slice(0,t)}\u2026`:e;function xr(e,t){if(typeof e!="string")return null;let r=e.trim();return r?gd(_I(r),t):null}var FN=/^[A-Za-z0-9_.:-]{1,64}$/;function Pn(e){return typeof e=="string"&&FN.test(e)?e:null}var go=(e,t)=>typeof e=="string"&&t.includes(e)?e:null;function Xy(e){if(!e||typeof e!="object")return null;let t=e,r={};typeof t.ts=="string"&&(r.ts=gd(t.ts,40));let o=Pn(t.verb);o&&(r.verb=o),typeof t.ms=="number"&&Number.isFinite(t.ms)&&(r.ms=Math.round(t.ms)),typeof t.ok=="boolean"&&(r.ok=t.ok);for(let i of["code","job","session"]){let a=Pn(t[i]);a&&(r[i]=a)}let n=xr(t.msg,500);return n&&(r.msg=n),t.args&&typeof t.args=="object"&&(r.args=qy(t.args,160)),r.verb?r:null}var Ye={summary:300,task:500,used_instead:300,what_happened:4e3,expected:4e3};function vI(e){if(!e||typeof e!="object")return"body must be a JSON object";let t=e,r=go(t.kind??"issue",bI);if(!r)return`kind must be one of ${bI.join(", ")}`;let o=xr(t.task,Ye.task),n=xr(t.summary,Ye.summary)??(r==="gap"?o:null);if(!n)return r==="gap"?"task is required":"summary is required";let i=Array.isArray(t.log_lines)?t.log_lines.slice(-20).map(Xy).filter(a=>!!a):[];return{kind:r,summary:n,what_happened:xr(t.what_happened,Ye.what_happened),expected:xr(t.expected,Ye.expected),severity:r==="issue"?go(t.severity,bd)??"medium":null,session_id:Pn(t.session_id),verb:Pn(t.verb),job_id:Pn(t.job_id),task:r==="gap"?o:null,used_instead:r==="gap"?xr(t.used_instead,Ye.used_instead):null,why_not_conformtools:r==="gap"?go(t.why_not_conformtools,yd)??(t.why_not_conformtools?"other":null):null,conformtools_verb_tried:Pn(t.conformtools_verb_tried),version:Pn(t.version),engine:go(t.engine,["local","hosted"]),platform:xr(t.platform,80),runtime:xr(t.runtime,80),account_env:go(t.account_env,["production","staging"]),log_lines:i}}var LN=/^[a-z_]{1,32}$/,zN=/^[A-Za-z0-9_.]{1,64}$/;function UN(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t={};for(let[r,o]of Object.entries(e).slice(0,16))LN.test(r)&&typeof o=="number"&&Number.isFinite(o)&&o>=0&&(t[r]=Math.round(o));return Object.keys(t).length?t:null}function wI(e){if(!e||typeof e!="object")return null;let t=e,r=go(t.kind,["outcome","invalid_args"]),o=Pn(t.verb);if(!r||!o)return null;let n=r==="invalid_args"&&Array.isArray(t.fields)?t.fields.filter(i=>typeof i=="string"&&zN.test(i)).slice(0,16):null;return{kind:r,verb:o,ok:r==="outcome"&&typeof t.ok=="boolean"?t.ok:null,code:Pn(t.code),duration_ms:typeof t.duration_ms=="number"&&Number.isFinite(t.duration_ms)&&t.duration_ms>=0?Math.round(t.duration_ms):null,version:Pn(t.version),engine:go(t.engine,["local","hosted"]),counts:r==="outcome"?UN(t.counts):null,fields:n,run_at:typeof t.run_at=="string"&&!Number.isNaN(Date.parse(t.run_at))?new Date(t.run_at).toISOString():null}}var ZN="support@conform.tools",xI=15,kI=2e3,SI=()=>M(he(),"config.json");async function RI(){try{return JSON.parse(await _e(SI()))}catch{return{}}}async function GN(e){await be(he()),await ge(SI(),JSON.stringify(e,null,1))}async function Ui(){return Ke("CONFORM_TELEMETRY")==="off"||Ke("CONFORM_TELEMETRY")==="0"?!1:(await RI()).telemetry===!0}async function II(e){let t=await RI();t.telemetry=e,t.telemetry_changed_at=new Date().toISOString(),await GN(t),e||await sn(Us()).catch(()=>{})}var $I="per tool run: the tool name, ok or the error code, duration, package version, engine mode (local/hosted) and counts (clips, files, matched/unmatched\u2026, numbers only); per rejected call: the tool name and the names of the arguments that failed validation. Never paths, file or clip names, timeline contents or media.";async function TI(){let e=await Ui(),t=(await e_()).length;return e?`outcome telemetry: ON \u2014 records ${$I}
|
|
89
|
+
sent in batches at most every ${xI} min${t?`; ${t} event(s) waiting`:""}. Turn off: conformtools telemetry off`:`outcome telemetry: OFF (the default). Nothing is recorded. If turned on it records ${$I} Turn on: conformtools telemetry on`}var HN=e=>`${qt().supabaseUrl}/functions/v1/v1-me/v1/engine/${e}`;async function n_(e,t,r){return await fetch(HN(e),{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${r}`,apikey:qt().anonKey},body:JSON.stringify(t),signal:AbortSignal.timeout(1e4)})}async function Bs(e,t){let{platform:r,runtime:o}=Vv(),n=t,i=e==="issue"?(await gI(20,{session_id:n.session_id,job_id:n.job_id})).map(Xy).filter(s=>!!s):[],a=vI({...t,kind:e,version:Nn,engine:Al(),platform:r,runtime:o,account_env:qt().env,log_lines:i});if(typeof a=="string")throw new Error(a);return a}async function Vs(e){let t=M(he(),"reports");await be(t);let r=M(t,`${new Date().toISOString().replace(/[:.]/g,"-")}-${e.kind}.json`);await ge(r,JSON.stringify(e,null,1));let o=await Dr().catch(()=>null);if(!o)return{sent:!1,saved:r,reason:"not signed in (account_login)"};let n=(await bl().catch(()=>null))?.email??null;try{let i=await n_("report",e,o),a=await i.json().catch(()=>({}));return!i.ok||!a.id?{sent:!1,saved:r,email:n,status:i.status,reason:`conform.tools answered ${i.status}${a.error?.message?`: ${a.error.message}`:""}`}:(await ge(r,JSON.stringify({id:a.id,...e},null,1)),{sent:!0,id:a.id,saved:r,email:n,resent:await JN(o)})}catch(i){return{sent:!1,saved:r,email:n,reason:`conform.tools is unreachable (${i instanceof Error?i.message:String(i)})`}}}var WN=20,Yy=!1;async function JN(e){if(Yy)return 0;Yy=!0;let t=0,r=0;try{let o=M(he(),"reports"),n=[];for await(let i of je(o))i.isFile&&i.name.endsWith(".json")&&n.push(i.name);for(let i of n.sort()){if(r>=WN)break;let a=M(o,i),s;try{s=JSON.parse(await _e(a))}catch{continue}if(s.id||s.rejected)continue;r++;let l=await n_("report",s,e).catch(()=>null),c=await l?.json().catch(()=>({}));if(l?.status===400){await ge(a,JSON.stringify({rejected:c?.error?.message??"400",...s},null,1));continue}if(!l?.ok||!c?.id)break;await ge(a,JSON.stringify({id:c.id,...s},null,1)),t++}}catch{}finally{Yy=!1}return t}function KN(e){let t=e;return Object.entries(Ye).filter(([r,o])=>typeof t[r]=="string"&&t[r].trim().length>o).map(([r])=>r)}function Zs(e,t,r,o){let n=KN(o),i=z(qN(e,t,r,n),{sent:t.sent,report_id:t.id??null,saved:t.saved,reason:t.reason??null,status:t.status??null,resent:t.resent??0,clipped:n,...e==="issue"?{log_lines:r.log_lines.length}:{}});return t.sent||(i.structuredContent.ok=!1),i}function qN(e,t,r,o=[]){let n=e==="issue"?`issue report${r.log_lines.length?` with the last ${r.log_lines.length} log line(s)${r.session_id||r.job_id?" for that session/job":""}`:""}`:e==="gap"?"tool-gap report":"note",i=o.length?`
|
|
90
|
+
Cut to fit: ${o.map(a=>`${a} (max ${Ye[a]} chars)`).join(", ")}.`:"";return t.sent?`sent ${n} to conform.tools \u2014 report id ${t.id.slice(0,8)}${t.email?` (account ${t.email})`:""}.
|
|
91
|
+
No media, file contents or timeline files were sent; paths were cut to file names. Copy of what was sent: ${t.saved}`+(t.resent?`
|
|
92
|
+
Also sent ${t.resent} earlier report(s) that had been saved unsent.`:"")+i:`NOT SENT \u2014 ${t.reason}. The ${n} is saved to ${t.saved}; it is resent automatically after the next report that gets through, or send that file to ${ZN}.`+i}var zs=()=>M(he(),"telemetry"),Us=()=>M(zs(),"queue.jsonl"),Qy=()=>M(zs(),"state.json");async function e_(){try{return(await _e(Us())).split(`
|
|
93
|
+
`).filter(Boolean).flatMap(e=>{try{return[JSON.parse(e)]}catch{return[]}})}catch{return[]}}var XN=new Set(["account_login","account_status","account_logout","account_telemetry","report","job","report_issue","report_gap","report_note","job_status","job_cancel","job_list","timeline_routes","timeline_sessions"]),YN=[["clips",/\b(\d+) clips?\b/i],["files",/\b(\d+) (?:output )?files?(?:\(s\))?\b/i],["sources",/\b(\d+) sources?(?:\(s\))?\b/i],["skipped",/\bskipped (\d+)\b/i],["matched",/\b(?:(\d+) matched|matched[: =]+(\d+))\b/i],["unmatched",/\b(?:(\d+) unmatched|unmatched[: =]+(\d+))\b/i],["ambiguous",/\b(?:(\d+) ambiguous|ambiguous[: =]+(\d+))\b/i],["unresolved",/\b(?:(\d+) unresolved|unresolved[: =]+(\d+))\b/i],["linked",/\b(?:(\d+) linked|linked[: =]+(\d+))\b/i],["issues",/\bissues \((\d+)\)/i],["frames",/\((\d+) frames\)/i]];function QN(e){let t={},r=e.content.map(o=>o.text).join(`
|
|
94
|
+
`);for(let[o,n]of YN){let i=r.match(n),a=i?Number(i[1]??i[2]):NaN;Number.isFinite(a)&&(t[o]=a)}for(let[o,n]of Object.entries(e.structuredContent??{}))typeof n=="number"&&/^[a-z_]{1,32}$/.test(o)&&!(o in t)&&(t[o]=n);return t}async function PI(e){let t=wI(e);t&&(await be(zs()),await ge(Us(),JSON.stringify(t)+`
|
|
95
|
+
`,{append:!0}))}var t_=new Set;function AI(e){return t_.add(e),e.finally(()=>t_.delete(e)),e}async function AH(){await Promise.allSettled([...t_])}function r_(e,t,r){return AI(eF(e,t,r))}async function eF(e,t,r){try{if(XN.has(e)||!await Ui())return;await PI({kind:"outcome",verb:e,ok:!t.isError,code:t.isError?String(t.structuredContent?.code??"engine"):void 0,duration_ms:r,version:Nn,engine:Al(),counts:QN(t),run_at:new Date().toISOString()}),EI()}catch{}}function o_(e,t){return AI(tF(e,t))}async function tF(e,t){try{if(!await Ui())return;await PI({kind:"invalid_args",verb:e,fields:t,version:Nn,engine:Al(),run_at:new Date().toISOString()}),EI()}catch{}}function _d(e){return[...new Set(e.map(t=>t.path.map(String).join(".")||"(root)"))]}var Ls=null;function EI(e={}){return Ls||(Ls=(async()=>{try{if(!await Ui())return;let t={};try{t=JSON.parse(await _e(Qy()))}catch{}if(!e.force&&!t.last_flush){await be(zs()),await ge(Qy(),JSON.stringify({last_flush:Date.now()}));return}if(!e.force&&Date.now()-t.last_flush<xI*6e4)return;let r=await e_();if(!r.length)return;let o=await Dr().catch(()=>null);if(!o)return;await be(zs()),await ge(Qy(),JSON.stringify({last_flush:Date.now()}));let n=r.slice(0,500),i=await n_("telemetry",{events:n},o).catch(()=>null);if(i?.ok||i?.status===400){let a=await e_();await ge(Us(),a.slice(n.length).map(s=>JSON.stringify(s)+`
|
|
96
|
+
`).join(""))}else r.length>kI&&await ge(Us(),r.slice(-kI).map(a=>JSON.stringify(a)+`
|
|
97
|
+
`).join(""));await i?.body?.cancel().catch(()=>{})}catch{}finally{Ls=null}})(),Ls)}var nF=new Set(["timeline_read","timeline_write","timeline_relink","timeline_edit","timeline_author","timeline_generate","timeline_autoconform","timeline_inspect","timeline_diff","timeline_align","session_export","host_open","host_render","host_apply","media_probe","media_consolidate","media_deliver","media_trim","media_fix","media_dcp","media_dcp_patch","media_patch","media_sync","media_cuts","gfx_make","color_match","p2p_send","delivery_fetch","project_link","qc_compare","qc_media","qc_deliverable","qc_blanking","render_gate","naming"]),rF=300,OI=/^[A-Za-z0-9_-]{1,64}$/,MI=e=>M(he(),"projects",e,"activity.jsonl");function oF(e,t,r){if(!nF.has(e))return null;let o=t.ops;if(e==="host_apply"&&(!o?.length||o.every(u=>u.op==="playhead"))||e==="delivery_fetch"&&t.as==="list")return null;let n=r.content.map(u=>u.text).join(`
|
|
98
|
+
`),i=n.split(`
|
|
99
|
+
`).find(u=>u.trim()&&!/^\s*(session_id|source|job_id)\s*[:=]/.test(u))??"",a=["path","out_path","out_dir","from"].map(u=>t[u]).find(u=>typeof u=="string"&&u.includes("/")&&u.length<1024),s=a&&!i.includes(B(a))?` (${B(a)})`:"",l=i.replace(/^error\s*/i,"").trim();for(let u of["path","out_path","out_dir","media_root"].map(d=>t[d]))typeof u=="string"&&u.includes("/")&&(l=l.split(`${ft(u)}/`).join(""));l=l.split(`${ir()}/`).join("~/"),l=l.replace(/^\[\w+\]:\s*/,"").replace(/\s+as job-[0-9a-f]+/g,"").replace(/\s+—\s+(job_cancel|job_status|poll|mount it|use mount)\b.*$/,"");let c=r.structuredContent?.session_id??t.session_id??n.match(/session_id[:=]\s*([0-9a-f]{8})\b/)?.[1];return{at:new Date().toISOString(),verb:e,ok:!r.isError,line:`${l}${s}`.slice(0,rF),...typeof c=="string"?{session_id:c}:{}}}async function i_(e,t,r){try{let o=oF(e,t,r);if(!o)return;let n=(await zn())?.id??mw;if(!OI.test(n))return;await be(M(he(),"projects",n)),await ge(MI(n),`${JSON.stringify(o)}
|
|
100
|
+
`,{append:!0})}catch{}}async function DH(e,t){if(!OI.test(e))return[];let r="";try{r=await _e(MI(e))}catch{return[]}let o=[];for(let n of r.split(`
|
|
101
|
+
`))if(n)try{let i=JSON.parse(n);(!t||i.at>t)&&o.push(i)}catch{}return o}var Gs=new Set;function Xn(e){for(let t of Gs)try{t(e)}catch{Gs.delete(t)}}function iF(e){return Gs.add(e),()=>Gs.delete(e)}var CI=null,NH=e=>{CI={...e,at:new Date().toISOString()}},DI=()=>CI,Bi=()=>Gs.size;function FH(){let e=new TextEncoder,t,r;return new ReadableStream({start(o){o.enqueue(e.encode(`: hello
|
|
102
|
+
|
|
103
|
+
`)),t=iF(n=>o.enqueue(e.encode(`data: ${JSON.stringify(n)}
|
|
104
|
+
|
|
105
|
+
`))),r=setInterval(()=>{try{o.enqueue(e.encode(`: .
|
|
106
|
+
|
|
107
|
+
`))}catch{t?.(),clearInterval(r)}},2e4)},cancel(){t?.(),clearInterval(r)}})}var a_=["text","number","bool","choice","color","marker_color","file","files","folder","rename_steps","track","tracks","timeline","timelines","render_preset","node","source","data"];var Hs=e=>typeof e=="string"&&/^\$[A-Za-z_]/.test(e);var aF=h.object({id:h.string().regex(/^[a-z][a-z0-9_]*$/),label:h.string(),type:h.enum(a_),choices:h.array(h.tuple([h.string(),h.string()])).optional().describe("choice: [value, label] pairs"),default:h.unknown().optional(),not:h.string().optional(),optional:h.boolean().optional(),placeholder:h.string().optional(),when:h.object({input:h.string(),is:h.array(h.string())}).optional(),hidden:h.boolean().optional()}),sF=h.object({id:h.string().regex(/^[a-z][a-z0-9_]*$/),use:h.string().describe("a block: verb.<verb>, resolve.pull, resolve.apply, rows.filter, review, plan.*"),args:h.record(h.unknown()).default({}),when:h.string().optional(),label:h.string().optional(),at:h.tuple([h.number(),h.number()]).optional()}),lF=["knobs","viewer","rows","result","compare","graphics","running"],NI=h.lazy(()=>h.union([h.object({split:h.enum(["row","col"]),panes:h.array(NI).min(1),size:h.number().positive().max(1).optional()}),h.object({pane:h.enum(lF),show:h.union([h.string(),h.array(h.string())]).optional(),title:h.string().optional(),size:h.number().positive().max(1).optional()})])),Ws=h.object({id:h.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),name:h.string().min(1),group:h.string().default("Mine"),about:h.string().default(""),aka:h.array(h.string()).optional(),app:h.boolean().optional(),part:h.boolean().optional(),host:h.enum(at).optional(),pinned:h.boolean().optional(),output:h.enum(["timeline"]).optional(),playbook:h.string().optional(),preview:h.boolean().optional(),inputs:h.array(aF).default([]),nodes:h.array(sF).min(1),view:NI.optional()}),vd=()=>M(he(),"tools"),s_=e=>M(vd(),`${e}.json`);async function Js(){let e=new Map;try{for await(let n of je(vd()))if(n.name.endsWith(".json"))try{let i=Ws.parse(JSON.parse(await _e(M(vd(),n.name))));e.set(i.id,i)}catch{}}catch{}let t=[...Ni,...DR(Ks)],r=new Set(t.map(n=>n.id)),o=new Set((await Vi()).hidden);return[...t.map(n=>e.has(n.id)?{...e.get(n.id),template:!1,shipped:!0}:{...Ws.parse(n),template:!0,shipped:!0}),...[...e.values()].filter(n=>!r.has(n.id)).map(n=>({...n,template:!1,shipped:!1}))].map(n=>({...n,hidden:o.has(n.id)}))}var cF=new Set(["rename_steps","files","tracks","timelines"]),FI=e=>Object.fromEntries(e.inputs.map(t=>[t.id,t.default??(t.type==="bool"?!1:cF.has(t.type)?[]:"")]));async function Yn(e){let t=(await Js()).find(r=>r.id===e);if(!t)throw new P("not_found",`no tool '${e}' (tool action=list)`);return t}function uF(e){let t=[],r=new Set(e.inputs.map(i=>i.id)),o=(i,a,s)=>{if(Hs(i))for(let l of i.split("|").map(c=>c.trim())){if(/[[\]]/.test(l)){t.push(`${a}: '${l}' indexes a list; pass the whole list, or use a block that takes one (timeline.read_many)`);continue}let c=/^\$([a-z][a-z0-9_]*)(?:\.([A-Za-z0-9_.]+))?(?:=.*|!=.*)?$/.exec(l.replace(/(!=|=).*$/,""));if(!c){t.push(`${a}: '${l}' is not a reference ($in.x, $node, $node.field)`);continue}if(c[1]==="in"){let u=(c[2]??"").split(".")[0];r.has(u)||t.push(`${a}: no input '${u}'`)}else s.has(c[1])||t.push(`${a}: '$${c[1]}' is not an earlier node`)}else Array.isArray(i)?i.forEach(l=>o(l,a,s)):i&&typeof i=="object"&&Object.values(i).forEach(l=>o(l,a,s))},n=new Set;for(let i of e.nodes)o(i.args,i.id,n),i.when&&o(i.when,i.id,n),n.add(i.id);for(let i of e.inputs)i.when&&!r.has(i.when.input)&&t.push(`input ${i.id}: shown when '${i.when.input}', which is not an input`);return t}async function l_(e,t){let r=Ws.safeParse(e);if(!r.success)throw new P("invalid_args",`not a tool: ${r.error.issues.map(a=>`${a.path.join(".")}: ${a.message}`).join("; ")}`);let o=r.data,n=new Set;for(let a of o.nodes){if(n.has(a.id))throw new P("invalid_args",`two nodes are called '${a.id}'`);if(n.add(a.id),!t(a.use))throw new P("invalid_args",`node '${a.id}' uses '${a.use}', which is not a block (tool action=blocks)`)}let i=uF(o);if(i.length)throw new P("invalid_args",`the wiring is off: ${i.join("; ")}`);return await be(vd()),await ge(s_(o.id),JSON.stringify(o,null,2)),o}async function LI(e){if(!/^[a-z][a-z0-9_-]{0,63}$/.test(e))return!1;try{await _e(s_(e))}catch{return!1}return await sn(s_(e)),!0}var wd=h.object({hidden:h.array(h.string()).default([]),favourites:h.array(h.string()).nullable().default(null)}),zI=()=>M(he(),"tool-layout.json");async function Vi(){try{return wd.parse(JSON.parse(await _e(zI())))}catch{return wd.parse({})}}async function kd(e){let t=wd.partial().safeParse(e);if(!t.success)throw new P("invalid_args",`not a layout: ${t.error.issues.map(o=>`${o.path.join(".")}: ${o.message}`).join("; ")}`);let r=wd.parse({...await Vi(),...Object.fromEntries(Object.entries(t.data).filter(([,o])=>o!==void 0))});return await be(he()),await ge(zI(),JSON.stringify(r,null,2)),r}async function $d(e){let t=await Vi();!t.favourites||t.favourites.includes(e)||await kd({favourites:[...t.favourites,e]})}var jI=h.union([h.object({host:h.enum(at)}),h.object({session_id:h.string(),name:h.string().optional()}),h.object({path:h.string()})]),xd=h.object({open:h.array(h.string()).default([]),desktop:h.array(h.object({id:h.string(),at:h.tuple([h.number().min(0).max(1),h.number().min(0).max(1)])})).nullable().default(null),source:jI.nullable().default(null),sources:h.record(jI).default({}),docked:h.boolean().default(!1),settings:h.record(h.record(h.unknown())).default({})}),UI=e=>M(he(),"projects",e.replace(/[^\w-]/g,"_"),"workspace.json");async function Sd(e){try{return xd.parse(JSON.parse(await _e(UI(e))))}catch{return null}}async function Sr(e,t){let r=xd.safeParse(t);if(!r.success)throw new P("invalid_args",`not a workspace: ${r.error.issues.map(o=>`${o.path.join(".")}: ${o.message}`).join("; ")}`);return await be(M(he(),"projects",e.replace(/[^\w-]/g,"_"))),await ge(UI(e),JSON.stringify(r.data,null,2)),Xn({type:"workspace",project:e,workspace:r.data}),r.data}var BI=1;async function VI(e,t){if(!e.length)throw new P("invalid_args","export needs the tool ids");let r=await Js(),o=e.map(i=>{let a=r.find(d=>d.id===i);if(!a)throw new P("not_found",`no tool '${i}'`);let{template:s,shipped:l,hidden:c,...u}=a;return u}),n=/\.json$/i.test(t)?t:`${t}.json`;return await ge(n,JSON.stringify({conformtools_tools:BI,tools:o},null,2)),{path:n,tools:o.map(i=>i.id)}}async function ZI(e,t){let r;try{r=JSON.parse(await _e(e))}catch(a){throw new P("invalid_args",`not a recipe file: ${a.message}`)}let o=r,n=Array.isArray(o.tools)?o.tools:[r];if(typeof o.conformtools_tools=="number"&&o.conformtools_tools>BI)throw new P("invalid_args","this recipe file is from a newer conform.tools: update the app");let i=[];for(let a of n)i.push(await l_(a,t));return i}import{gunzipSync as dF}from"node:zlib";function HI(e,t){if(!t.tracks?.length)return;let r=e.timelines.find(o=>o.name===t.timeline)??e.timelines[0];if(r)for(let o of["video","audio"]){let n=r.tracks.filter(i=>(i.kind??"").toLowerCase()===o).sort((i,a)=>(i.track_index??0)-(a.track_index??0));for(let i of t.tracks.filter(a=>a.kind===o)){let a=n[i.index-1];a&&(a.enabled=i.enabled,i.name&&!/^(Video|Audio) \d+$/.test(i.name)&&(a.name=i.name))}}}async function mF(){return(await wn("ps",["-axo","pid=,args="])).stdout.split(`
|
|
108
|
+
`).map(t=>t.trim()).filter(Boolean).map(t=>{let r=t.indexOf(" ");return{pid:Number(t.slice(0,r)),args:t.slice(r+1)}})}async function fF(){let e=`ObjC.import("CoreGraphics");
|
|
109
|
+
const a = $.CGWindowListCopyWindowInfo($.kCGWindowListOptionAll, 0);
|
|
110
|
+
const arr = ObjC.deepUnwrap(ObjC.castRefToObject(a)) || [];
|
|
111
|
+
JSON.stringify(arr.filter(w => w.kCGWindowName).map(w => ({ pid: w.kCGWindowOwnerPID, owner: w.kCGWindowOwnerName, title: w.kCGWindowName })));`;if(vt()!=="darwin")return[];let t=await wn("osascript",["-l","JavaScript","-e",e]);try{return JSON.parse(t.stdout.trim())}catch{return[]}}async function Rd(e){return(await wn("lsof",["-p",String(e),"-Fn"])).stdout.split(`
|
|
112
|
+
`).filter(r=>r.startsWith("n/")).map(r=>r.slice(1))}var c_=e=>new Date(e).toISOString();async function pF(e,t){let r=e.find(n=>/DaVinci Resolve\.app\/Contents\/MacOS\/Resolve(\s|$)|\\Resolve\.exe\b/.test(n.args)),o={host:"resolve",running:!!r,pid:r?.pid,notes:[]};return r?await hF(o,t):o}async function hF(e,t){let r=M(t,`resolve_current_${Date.now()}.drt`),o=await ga("current",{},6e4),n;o.why!=="bridge"&&(n=o,o.ok&&o.timeline&&(n.exported=(await ga("export",{out_path:r},6e4)).ok));let i=n?.db,a=i?.DbType?`the ${i.DbType==="Disk"?"local":i.DbType} project library${i.DbName?` "${i.DbName}"`:""}${i.IpAddress?` on ${i.IpAddress}`:""}`:"its project library";if(!n)return e.notes.push(`Resolve holds ${a}, and its scripting door could not be reached (${o.detail??"no answer"}). Export the timeline as a .drt from Resolve (File > Export > Timeline) and read that file.`),e;if(!n.ok){let l=n.why==="no_project"?"no project is open (only the Project Manager)":n.why==="no_connection"?"Resolve refused the local scripting connection (Preferences > System > General > External scripting using: Local)":`the Resolve scripting module is not installed (${n.detail??""})`;return e.notes.push(`Resolve holds ${a}; ${l}. Or export the timeline as a .drt from Resolve (File > Export > Timeline) and read that file.`),e}if(e.project=n.project,e.timelines=n.timelines,!n.timeline)return e.notes.push("no timeline is open in the viewer"),e;if(e.timeline=n.timeline,o.ok&&(e.tracks=o.tracks),!n.exported||!await Ge(r))return e.notes.push(`Resolve holds ${a}; it named the open timeline but its .drt export failed. Export it from Resolve (File > Export > Timeline) and read that file.`),e;let s=M(t,`${GI(n.project??"resolve")}__${GI(n.timeline)}.drt`);return await Gv(r,s),e.read={path:s,format:"drt"},e.notes.push(`project in ${a}: the timeline was exported by Resolve itself (its own .drt of the current state, including unsaved edits)`),e}async function gF(e,t){let r=e.find(u=>/Adobe Premiere Pro( \d{4})?\.app\/Contents\/MacOS\/Adobe Premiere Pro|\\Adobe Premiere Pro\.exe\b/.test(u.args)),o={host:"premiere",running:!!r,pid:r?.pid,notes:[]};if(!r)return o;let i=t.find(u=>u.pid===r.pid&&/\.prproj/i.test(u.title))?.title?.replace(/\s*\*\s*$/,"").replace(/^.*?((?:\/|[A-Za-z]:[\\/]|\\\\).*\.prproj).*$/i,"$1");if(!i){if(t.some(u=>u.pid===r.pid&&u.title))return o.notes.push("Premiere is running with no project window (home screen)."),o;if(i=await bF(),!i)return o.notes.push("Premiere's window titles are hidden from this app (macOS: give it Screen Recording in System Settings \u203A Privacy & Security) and Premiere's recent-projects list names no project."),o;o.notes.push("window titles are hidden from this app (macOS Screen Recording permission), so the project is taken from Premiere's recent-projects list: the last one it opened, not confirmed open")}if(!await Ge(i))return o.notes.push(`window title names ${i} but it is not on disk`),o;o.project_path=i,o.project=B(i).replace(/\.prproj$/i,""),o.read={path:i,format:"prproj"},await Ge(i.replace(/\.prproj$/i,".prlock"))&&o.notes.push("lock file present beside the project (project locking is on)");let a=await ut(i),s=new TextDecoder().decode(a[0]===31&&a[1]===139?dF(a):a),l=[...s.matchAll(/<MZ\.PrefixKey\.OpenSequenceGuidList\.(\d+)>([0-9a-f-]{36})</g)].map(u=>({idx:Number(u[1]),uid:u[2]})).sort((u,d)=>u.idx-d.idx),c=u=>{let d=s.indexOf(`<Sequence ObjectUID="${u}"`);if(d<0)return null;let f=/<Name>([^<]*)<\/Name>/.exec(s.slice(d,d+2e4));return f?f[1]:null};return o.timelines=l.map(u=>c(u.uid)).filter(u=>!!u),o.timelines.length&&(o.timeline=o.timelines[0]),o.notes.push("last saved state of the project file (Premiere has no outside door to unsaved edits; the panel has)"),o.notes.push(o.timelines.length?"sequences open in the Timeline panel at the last save, in panel order; the first is taken as the active one":"the project file records no open sequences"),o}async function bF(){let e=M(ir(),"Documents","Adobe","Premiere Pro"),t;try{for await(let o of je(e))if(!(!o.isDirectory||!/^\d+\.\d+$/.test(o.name)))for await(let n of je(M(e,o.name))){if(!n.isDirectory||!n.name.startsWith("Profile-"))continue;let i=M(e,o.name,n.name,"Adobe Premiere Pro Prefs"),a=(await ct(i).catch(()=>null))?.mtimeMs??0;a&&(!t||a>t.at)&&(t={at:a,path:i})}}catch{return}return t?/<BE\.Prefs\.MRU\.Document\.0>([^<]+\.prproj)</i.exec(await _e(t.path).catch(()=>""))?.[1]:void 0}async function yF(e,t,r){let o=e.find(f=>/AvidMediaComposer\.app\/Contents\/MacOS\/AvidMediaComposer(\s|$)|\\AvidMediaComposer\.exe\b/.test(f.args)),n={host:"avid",running:!!o,pid:o?.pid,notes:[]};if(!o)return n;let i=t.find(f=>f.pid===o.pid&&/Media Composer/.test(f.title))?.title??"",a=/Media Composer[^-]*-\s*([^-]+?)\s*(?:-|$)/.exec(i)?.[1]?.trim(),s=(await Rd(o.pid)).find(f=>/\.avp$/i.test(f))??(vt()==="win32"&&a?await _F(a):void 0);if(!s)return n.notes.push(a?`project "${a}" per the window title, but ${vt()==="win32"?"its .avp is not in Media Composer's project folders":"no .avp is held open"}`:"no project open"),n.project=a,n;n.project_path=s,n.project=B(s).replace(/\.avp$/i,"");let l=ft(s),c=[];for await(let f of je(l))if(f.isFile&&/\.avb$/i.test(f.name)&&!f.name.startsWith("_")){let m=await ct(M(l,f.name));c.push({path:M(l,f.name),modified_at:c_(m.mtimeMs)})}c.sort((f,m)=>m.modified_at.localeCompare(f.modified_at)),n.bins=c;let u=c[0];if(r){for(let f of c.slice(0,12))if(await r(f.path,"avb")){u=f;break}}u&&(n.read={path:u.path,format:"avb"}),n.notes.push("Media Composer keeps the sequence loaded in the Timeline only in memory; bins are the saved state. The newest-modified bin holding a sequence is offered; pass another bin path to timeline_read to choose.");let d=M("/Users/Shared/AvidMediaComposer/Avid Attic",n.project,"Bins");if(await Ge(d)){let f=null;for await(let m of je(d)){if(!m.isDirectory)continue;let p=await ct(M(d,m.name));(!f||p.mtimeMs>f.m)&&(f={name:m.name,m:p.mtimeMs})}f&&n.notes.push(`Attic: last bin autosaved while open was "${f.name.replace(/\.[^.]*$/,"")}" at ${c_(f.m)}`)}return n}async function _F(e){let t=M(Ke("PUBLIC")??"C:\\Users\\Public","Documents","Avid Media Composer");for(let r of["Shared Avid Projects","Avid Projects"]){let o=M(t,r,e,`${e}.avp`);if(await Ge(o))return o}}async function vF(e){let t=e.find(l=>/\/flame\.app\/Contents\/MacOS\/flame(\s|$)/.test(l.args)||/\/flame_\d{4}\/bin\/flame(\s|$)/.test(l.args)),r={host:"flame",running:!!t,pid:t?.pid,notes:[]};if(!t)return r;let o=/\s-J\s+(\S+)/.exec(t.args)?.[1],n=/\s-W\s+(\S+)/.exec(t.args)?.[1]??"Workspace";if(!o)return r.notes.push("Flame is running but its command line names no project (-J)"),r;r.project=o;let i=["/opt/Autodesk/project","/private/var/opt/Autodesk/flame/projects","/var/opt/Autodesk/flame/projects"],a=null;for(let l of i){let c=M(l,o,"catalog",`${n}.wksp`);if(await Ge(c)){a=c;break}}if(!a)return r.notes.push(`no catalog folder for project ${o} / workspace ${n} under ${i.join(", ")}`),r;r.project_path=a;let s=null;for await(let l of je(a))if(l.isFile&&/^\.#workspace\.\d+\.wks$/.test(l.name)){let c=await ct(M(a,l.name));(!s||c.mtimeMs>s.m)&&(s={path:M(a,l.name),m:c.mtimeMs})}return s?(r.read={path:s.path,format:"flame"},r.notes.push(`live workspace file, written by Flame at ${c_(s.m)}; holds the desktop's reels and sequences. Which sequence sits in the Timeline is not yet decoded \u2014 every sequence on the desktop is returned.`),r):(r.notes.push("no workspace file in the catalog"),r)}var wF=/(?:[\/\\]Nuke\d+\.\d+(?:v\d+)?(?:\.exe)?(?:\s.*)?\s--(?:studio|hiero)\b|(?:NukeStudio|Hiero)[^/]*\.app\/Contents\/MacOS\/)/i;async function kF(e,t){let r=e.find(i=>wF.test(i.args)),o={host:"nuke",running:!!r,pid:r?.pid,notes:[]};if(!r)return o;let n=(await Rd(r.pid)).find(i=>/\.hrox$/i.test(i))??t.filter(i=>i.pid===r.pid).map(i=>/(\/\S.*?\.hrox)\b/i.exec(i.title)?.[1]).find(Boolean);return n&&(o.project_path=n,o.project=B(n).replace(/\.hrox$/i,"")),o.notes.push("Nuke Studio's timelines are read through the conform.tools panel: host_export host=nuke (host_setup host=nuke installs it)"),o}async function $F(e){let t=e.find(c=>/Final Cut Pro\.app\/Contents\/MacOS\/Final Cut Pro(\s|$)/.test(c.args)),r={host:"fcp",running:!!t,pid:t?.pid,notes:[]};if(!t)return r;let o=[...new Set((await Rd(t.pid)).map(c=>/^(.*?\.fcpbundle)(\/|$)/.exec(c)?.[1]).filter(c=>!!c))];if(!o.length)return r.notes.push("Final Cut is running with no library open"),r;r.timelines=[];let n=new Map;for(let c of o)for await(let u of je(c))if(!(!u.isDirectory||/\.(localized)$/.test(u.name)||u.name.startsWith("_")))for await(let d of je(M(c,u.name)))d.isDirectory&&!/^(Original Media|Render Files|Analysis Files|Transcoded Media|Shared Items)$/.test(d.name)&&await Ge(M(c,u.name,d.name,"CurrentVersion.fcpevent"))&&n.set(d.name,{library:c,event:u.name});let i=await wn("osascript",["-e",'tell application "System Events" to tell process "Final Cut Pro" to get value of every static text of group 1 of group 4 of splitter group 1 of group 1 of splitter group 1 of group 1 of splitter group 1 of window 2']),a=i.success?i.stdout.trim().split(", ").find(c=>n.has(c)):void 0;if(!a){let c=await wn("osascript",["-e",'tell application "System Events" to tell process "Final Cut Pro" to get entire contents of window 2']);for(let u of c.stdout.matchAll(/static text ([^,]+?) of group/g))if(n.has(u[1])){a=u[1];break}}let s=a?n.get(a):void 0;r.project=s?B(s.library).replace(/\.fcpbundle$/,""):o.length===1?B(o[0]).replace(/\.fcpbundle$/,""):void 0,r.project_path=s?.library??(o.length===1?o[0]:void 0),r.timeline=a,r.timelines=[...n.keys()],r.notes.push(`${o.length} librar${o.length===1?"y":"ies"} open: ${o.map(c=>B(c)).join(" | ")}`),a&&s?r.notes.push(`project "${a}" is in event "${s.event}" of ${B(s.library)}`):r.notes.push("could not read the Timeline title (no project loaded, or the accessibility layout differs)");let l=a&&s?M(s.library,s.event,a,"CurrentVersion.fcpevent"):void 0;return l&&await Ge(l)?(r.read={path:l,format:"fcpevent"},r.notes.push("read from the project's own store in the library (Final Cut saves it as you edit; read from a copy, the library is never written)")):a&&r.notes.push(`no project store found for "${a}"${l?` at ${l}`:""}`),r}function xF(e){let t=e.find(o=>/\/Baselight[^/]*\.app\/Contents\/MacOS\/|\/usr\/fl\/baselight[^ ]*\/bin\/baselight\b/i.test(o.args)),r={host:"baselight",running:!!t,pid:t?.pid,notes:[]};return t&&r.notes.push("the open scene is not read here (it lives in Baselight's scene database): host_export host=baselight reads it through FLAPI"),r}async function SF(e,t){let r=e.find(i=>/Pro Tools\.app\/Contents\/MacOS\/Pro Tools(\s|$)/.test(i.args)),o={host:"protools",running:!!r,pid:r?.pid,notes:[]};if(!r)return o;let n=(await Rd(r.pid)).find(i=>/\.ptx$/i.test(i));if(o.project=t.find(i=>i.pid===r.pid&&/^Edit: /.test(i.title))?.title.slice(6).trim()||void 0,!n){let i=await new X0().current();i&&(o.project=i.project,n=i.project_path||void 0)}return!n||!await Ge(n)?(o.notes.push(o.project?`session "${o.project}" has no saved .ptx found`:"no session open (or Pro Tools' scripting door did not answer)"),o):(o.project_path=n,o.project??=B(n).replace(/\.ptx$/i,""),o.timeline=o.project,o.timelines=[o.project],o.read={path:n,format:"ptx"},o.notes.push("the session file as last saved; edits since the last save are not in it"),o)}var GI=e=>e.replace(/[^\w.-]+/g,"_").slice(0,80);function RF(e=vt()){return e==="darwin"||e==="linux"||e==="win32"?null:`host_current is not available on ${e} yet: it reads the process table and open files (ps, lsof), which this OS does not have. Export the timeline from the host and use timeline_read.`}async function WI(e,t,r){let o=RF();if(o)throw new P("unsupported",o);let n=e?.length?e:[...at],i=t??await nt("conform-host-"),a=vt()==="win32"?await Hv():null,s=a??await mF(),l=a?a.filter(u=>u.title):n.some(u=>u==="premiere"||u==="avid"||u==="protools"||u==="nuke")?await fF():[],c=[];for(let u of n)try{u==="resolve"?c.push(await pF(s,i)):u==="premiere"?c.push(await gF(s,l)):u==="avid"?c.push(await yF(s,l,r)):u==="flame"?c.push(await vF(s)):u==="baselight"?c.push(xF(s)):u==="protools"?c.push(await SF(s,l)):u==="nuke"?c.push(await kF(s,l)):c.push(await $F(s))}catch(d){c.push({host:u,running:!0,notes:[`failed: ${d instanceof Error?d.message:String(d)}`]})}return c}function u_(e){return e.map(t=>`${t.kind[0].toUpperCase()}${t.index}${t.name&&!/^(Video|Audio|Subtitle) \d+$/.test(t.name)?` ${t.name}`:""}${t.enabled?"":" (off)"}${t.locked?" (locked)":""}`).join(" | ")}function JI(e){let t=[`${e.host}: ${e.running?`running (pid ${e.pid})`:"not running"}`];e.project&&t.push(` project: ${e.project}${e.project_path?` [${e.project_path}]`:""}`),e.timeline&&t.push(` open timeline: ${e.timeline}`),e.timelines?.length&&t.push(` timelines: ${e.timelines.join(" | ")}`),e.tracks?.length&&t.push(` tracks: ${u_(e.tracks)}`),e.bins?.length&&t.push(` bins (newest first): ${e.bins.slice(0,8).map(r=>B(r.path)).join(" | ")}${e.bins.length>8?` \u2026 +${e.bins.length-8}`:""}`),e.read&&t.push(` read as: ${e.read.format} ${e.read.path}`);for(let r of e.notes)t.push(` note: ${r}`);return t.join(`
|
|
113
|
+
`)}var XI={"YYYY-MM-DD":e=>`${e.Y}-${e.M}-${e.D}`,YYYYMMDD:e=>`${e.Y}${e.M}${e.D}`,YYMMDD:e=>`${e.y}${e.M}${e.D}`,"YYYY-MM-DD_HHMM":e=>`${e.Y}-${e.M}-${e.D}_${e.h}${e.m}`,YYYYMMDD_HHMMSS:e=>`${e.Y}${e.M}${e.D}_${e.h}${e.m}${e.s}`,HHMMSS:e=>`${e.h}${e.m}${e.s}`};function IF(e,t){let r=o=>String(o).padStart(2,"0");return XI[e]({Y:String(t.getFullYear()),y:r(t.getFullYear()%100),M:r(t.getMonth()+1),D:r(t.getDate()),h:r(t.getHours()),m:r(t.getMinutes()),s:r(t.getSeconds())})}var Td="[\\p{L}\\p{N}]",TF=`(?<!${Td})`,PF=`(?!${Td})`,KI=new RegExp(`${Td}+(?:'${Td}+)*`,"gu"),d_=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),AF=e=>Array.from(e,t=>t==="*"?".*":t==="?"?".":d_(t)).join(""),qI=e=>(...t)=>{let r=t.slice(0,t.findIndex(o=>typeof o=="number"));return e.replace(/[$\\](\d+)|\\\\/g,(o,n)=>n===void 0?"\\":String(r[Number(n)]??""))};function Id(e,t,r=!1){try{return new RegExp(e,(t?"g":"gi")+(r?"u":""))}catch(o){throw new Error(`Invalid regex: ${o.message}`)}}var Rr=e=>Array.from(e);function EF(e,t){switch(t){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();case"title":return e.replace(KI,r=>Rr(r)[0].toUpperCase()+Rr(r).slice(1).join("").toLowerCase());case"capitalize":return e.replace(KI,r=>Rr(r)[0].toUpperCase()+Rr(r).slice(1).join(""));case"sentence":{let r=e.length-e.trimStart().length,o=Rr(e.slice(r));return o.length?e.slice(0,r)+o[0].toUpperCase()+o.slice(1).join("").toLowerCase():e}}throw new Error(`Unknown case mode: ${t}`)}function OF(e,t,r,o=new Date){switch(t.type){case"find_replace":{if(!t.find)return e;let n=t.regex?t.find:t.wildcard?AF(t.find):d_(t.find),i=t.whole_word?Id(TF+n+PF,!!t.case_sensitive,!0):Id(n,!!t.case_sensitive),a=t.replace??"";return e.replace(i,t.regex?qI(a):()=>a)}case"regex_replace":return t.pattern?e.replace(Id(t.pattern,t.case_sensitive??!0),qI(t.replacement??"")):e;case"add_prefix":return(t.text??"")+e;case"add_suffix":return e+(t.text??"");case"insert":{if(!t.text)return e;let n=Rr(e),i=Math.max(0,Math.min(t.position??0,n.length)),a=t.from_end?n.length-i:i;return n.slice(0,a).join("")+t.text+n.slice(a).join("")}case"remove_text":return t.text?e.replace(Id(d_(t.text),!!t.case_sensitive),""):e;case"remove_chars":{let n=t.count??0;if(n<=0)return e;let i=Rr(e),a=i.length,s=t.mode??"from_end",l;if(s==="from_start")l=i.slice(n);else if(s==="from_end")l=i.slice(0,Math.max(0,a-n));else if(s==="from_position"){let c=t.position??0,u=Math.min(c>=0?c:Math.max(0,a+c),a);l=[...i.slice(0,u),...i.slice(u+n)]}else throw new Error(`Unknown remove mode: ${s}`);if(a&&!l.length)throw new Error(`Removing ${n} character(s) would leave an empty name`);return l.join("")}case"trim_whitespace":return e.replace(/\s+/gu," ").trim();case"change_case":return EF(e,t.mode);case"substring":{let n=Rr(e),i=t.start??0,a=t.length??0,s=i>=0?i:Math.max(0,n.length+i);return(a<=0?n.slice(s):n.slice(s,s+a)).join("")}case"sequential_numbering":{let n=String((t.start??1)+r*(t.increment||1)).padStart(Math.max(1,t.pad??3),"0"),i=t.separator??"_";return t.position==="prefix"?n+i+e:e+i+n}case"add_date":{let n=t.format??"YYYY-MM-DD";if(!(n in XI))throw new Error(`Unknown date format: ${n}`);let i=t.separator??"_",a=IF(n,o);return t.position==="prefix"?a+i+e:e+i+a}}throw new Error(`Unknown rule type: ${t.type}`)}var MF=/^(.*?)([._-]?)(\d+)(\.[^.]+)$/u;function YI(e,t,r={}){let o=t.filter(a=>a.enabled!==!1),n=e.map((a,s)=>{let l=r.sequence?MF.exec(a):null;if(r.sequence&&!l)return{old:a,new:a,dupe:!1};let c=l?l[1]:a;try{for(let u of o)c=OF(c,u,s,r.now)}catch(u){return{old:a,new:a,dupe:!1,error:u.message}}return a&&!c?{old:a,new:a,dupe:!1,error:"The steps leave an empty name"}:{old:a,new:l?c+l[2]+l[3]+l[4]:c,dupe:!1}}),i=new Map;for(let a of n)i.set(a.new,(i.get(a.new)??new Set).add(a.old));for(let a of n)a.new!==a.old&&i.get(a.new).size>1&&(a.dupe=!0);return n}async function CF(e){let t=await Promise.all(e.media.map(async r=>{if(Number(r.cells["available_range.dur"])>0||!r.cells.target_url)return r;let n=(await Ad("media_probe",{path:String(r.cells.target_url)}).catch(()=>null))?.structuredContent?.available_range;return n?{...r,cells:{...r.cells,"available_range.start":n.start.value,"available_range.dur":n.duration.value}}:r}));return{...e,media:t}}async function Ue(e,t,r={}){t=DF(e,t);let o=an(e),n=o?h.object(o.inputSchema).safeParse(t):null;n?.success&&(t=n.data);let i=await Ad(e,t,{signal:r.signal,progress:r.progress}),a=i.content.map(l=>l.text).join(`
|
|
114
|
+
`);if(i.isError)throw new P(i.structuredContent?.code??"engine",a.replace(/^error \[\w+\]: /,""));let s=i.structuredContent?.session_id??a.match(/session_id[:=]\s*([0-9a-f]{8})\b/)?.[1]??t.session_id;return{...i.structuredContent??{},...s?{session_id:s}:{},ok:!0,text:a}}function DF(e,t){let r=an(e)?.inputSchema??{},o=n=>n instanceof h.ZodOptional||n instanceof h.ZodDefault||n instanceof h.ZodNullable?o(n._def.innerType):n;return Object.fromEntries(Object.entries(t).flatMap(([n,i])=>{if(i===""||i===null||Array.isArray(i)&&!i.length)return[];let a=r[n]?o(r[n]):void 0;return typeof i=="string"&&a instanceof h.ZodNumber&&i.trim()!==""&&Number.isFinite(Number(i))?[[n,Number(i)]]:typeof i=="string"&&a instanceof h.ZodUnion&&a._def.options.some(s=>s instanceof h.ZodNumber)&&/^\d+(\.\d+)?$/.test(i)?[[n,Number(i)]]:[[n,i]]}))}var QI=(e,t)=>Ue(e,t).catch(r=>({ok:!1,text:r.message})),jF={items:"items",apply:"apply",pool:"project"};function En(e){return at.filter(t=>{let r=wt(t);if(r.wired===!1)return!1;if(e==="qc")return t==="resolve";if(t==="protools"&&(e==="open"||e==="render"))return!1;let o=jF[e];return!o||typeof r[o]=="function"})}var An={host:{type:"string",about:`the host: ${at.join(" | ")} (default resolve)`}},yn=e=>String(e.host||"resolve"),Zi=new Map,NF=4e3;function FF(e,t){let r=`${e}\0${t??""}`,o=Zi.get(r);if(o&&Date.now()-o.at<NF)return o.live;let n=iR(QI,t,e);return Zi.set(r,{at:Date.now(),live:n}),n.catch(()=>Zi.delete(r)),n}var eT={clip_color:"Clip colour",flags:"Flags",enabled:"Enable / disable",name:"Clip name",properties:"Properties (sizing, crop, opacity, retime)",metadata:"Media pool metadata",copy_grade:"Copy grade",copy_properties:"Copy properties",version:"Colour version",color_group:"Colour group",cache:"Render cache",fades:"Fades",output_blanking:"Output blanking",drx:"Apply a .drx still",lut:"LUT on a node",node_copy:"Copy a node",marker_add:"Add marker",marker_update:"Change marker",marker_delete:"Delete marker",playhead:"Move the playhead",timeline_duplicate:"Duplicate the timeline",goto:"Go to",pool_rename:"Rename pool clip",pool_move:"Move pool clips",pool_delete:"Delete pool clips",pool_import:"Import into the pool",track_delete:"Delete a track",timeline_rename:"Rename timeline"};function LF(e,t){let{rows:r,...o}=t;return Array.isArray(r)?e.startsWith("pool_")?r.length?[{op:e,clips:r.map(n=>n.id),...o}]:[]:r.flatMap(n=>{let i="cells"in n?gn(n):typeof n.track=="number"?{kind:n.kind??"video",track:n.track,start:Number(n.start)}:null;if(i)return[{op:e,item:i,...o}];let a="cells"in n?Number(n.cells.frame):NaN;return Number.isFinite(a)?[{op:e,frame:a,...o}]:[]}):[{op:e,...o}]}async function zF(e,t,r,o,n){return await Ue("host_render",{host:e,...t?{timeline:t}:{},...r},{signal:o.signal,progress:(a,s,l)=>o.progress?.(a,s,`${n} \xB7 ${l}`)}).catch(a=>({ok:!1,text:a.message}))}var qs={"source.file":{label:"Timeline file",group:"Sources",effect:!1,about:"Read a timeline file from any host (.drt .aaf .avb .prproj .fcpxml .xml .otio .edl, a Flame archive) into a session; `engine` local (this machine) or hosted.",params:{path:{type:"string",required:!0,about:"the timeline file"},engine:{type:"string"}},run:(e,t)=>Ue("timeline_read",e,t)},"source.session":{label:"Project timeline",group:"Sources",effect:!1,about:"A timeline already in the project (a session read earlier, from Exchange, the chat, a pull).",params:{session_id:{type:"string",required:!0}},run:async e=>{let t=await Fe(String(e.session_id));return{ok:!0,text:`${t.source_path.split(/[\\/]/).pop()} (${e.session_id})`,session_id:e.session_id,source_path:t.source_path}}},"transfer.inbox":{label:"Inbox",group:"Transfers",effect:!1,about:"What clients sent into the project through its links (bucket sends) and who is sharing live peer to peer: rows {from, label, sender, when, size, status}, for transfer.receive.",params:{project_id:{type:"string",required:!0}},run:async e=>{let t=await Ue("project",{action:"show",project_id:e.project_id}),r=o=>o>=1e9?`${(o/1e9).toFixed(1)} GB`:`${(o/1e6).toFixed(1)} MB`;return[...(t.links??[]).filter(o=>o.peer).map(o=>({id:`live:${o.id}`,from:o.peer.ticket,cells:{label:`${o.label??"A client"} (live)`,sender:"",when:"now",size:"",status:"sharing",from:"peer to peer"}})),...(t.sessions??[]).map(o=>({id:o.id,from:`bucket:${o.id}`,cells:{label:o.label||"Send",sender:o.sender_email??"",when:o.created_at.slice(0,16).replace("T"," "),size:r(o.total_bytes),status:o.status,from:`bucket:${o.id}`}}))]}},"transfer.receive":{label:"Receive",group:"Transfers",effect:!0,about:"Open deliveries \u2014 `from` (a peer-to-peer ticket, bucket:<id>, a .iso path) or inbox rows \u2014 as = list | mount (live, sparse) | trims (cut the media into out_path) | iso (fetch the .iso into out_path).",params:{from:{type:"string"},rows:{type:"array"},as:{type:"string"},out_path:{type:"string"}},run:async(e,t)=>{let r=e.rows?e.rows.map(i=>i.from).filter(Boolean):e.from?[String(e.from)]:[];if(!r.length)throw new P("invalid_args","nothing to receive: wire an inbox, or give from");let o=[],n={};for(let[i,a]of r.entries()){let s=String(e.as??"list"),l=s==="iso"&&e.out_path&&!/\.iso$/i.test(String(e.out_path))?`${String(e.out_path).replace(/[\\/]$/,"")}/${a.replace(/^bucket:/,"").replace(/[^\w.-]+/g,"_").slice(0,40)}.iso`:e.out_path;t.progress?.(i,r.length,`${i+1}/${r.length}`),n=await Ue("delivery_fetch",{from:a,as:s,...l?{out_path:l}:{}},t),o.push(String(n.text).split(`
|
|
115
|
+
`)[0])}return{...n,ok:!0,text:o.join(`
|
|
116
|
+
`)}}},"transfer.deliver":{label:"Deliver",group:"Transfers",effect:!0,about:"A timeline with its media, trimmed with handles, as a package: destination folder | iso | bucket (your bucket, recipients emailed) | p2p (served from this machine: a ticket to hand over).",params:{session_id:{type:"string",required:!0},destination:{type:"string",required:!0},handles:{type:"number"},out_path:{type:"string"},recipients:{type:"array"}},run:(e,t)=>Ue("media_deliver",e,t)},"transfer.share":{label:"Share peer to peer",group:"Transfers",effect:!0,about:"Serve a file or folder on this machine peer to peer (encrypted, nothing uploaded) until stopped: answers the ticket the recipient opens.",params:{path:{type:"string",required:!0}},run:(e,t)=>Ue("p2p_send",e,t)},"transfer.link":{label:"Client link",group:"Transfers",effect:!0,about:"A link a client sends into this project with (a small app named for you: their cut's media, trimmed, lands in the inbox).",params:{project_id:{type:"string",required:!0},label:{type:"string"},recipient_email:{type:"string"}},run:e=>Ue("project_link",{action:"create",...e})},"ui.graphics":{label:"Graphics",group:"Make",effect:!1,about:"Lower thirds, locators, legal lines and end crawls designed over the timeline wired in (the designer opens in the knobs, the graphic draws on the viewer); its Render makes ProRes 4444 with alpha for every aspect and position.",params:{session_id:{type:"string"}},run:async e=>({ok:!0,text:"graphics",...e.session_id?{session_id:e.session_id}:{}})},"gfx.place":{label:"Graphics onto the timeline",group:"Make",effect:!0,hosts:["resolve"],about:"Lay a graphics package (gfx_make's answer) on a new track of the timeline read: one graphic after another from frame `at`, each in the position given (default the package's first) and the format that fits the timeline.",params:{package:{type:"object",required:!0,about:"gfx_make's answer"},from:{type:"object",about:"the timeline read (host.read)"},at:{type:"number",about:"the frame the first graphic starts on (default 0)"},position:{type:"string",about:"an anchor (bottom-left\u2026) or a list (its first); default the package's first"}},run:async(e,t)=>{let r=e.from??{},o=r.session_id?(await Fe(String(r.session_id)).catch(()=>null))?.session.timelines.find(a=>a.kind!=="compound"):void 0,n=Array.isArray(e.position)?e.position[0]:e.position,i=GF(e.package,o?.resolution_w??void 0,o?.resolution_h??void 0,n,Number(e.at??0));if(!i.paths.length)throw new P("not_found","the package has no file for that position and format");return Ue("host_apply",{host:"resolve",...r.timeline?{timeline:r.timeline}:{},ops:[{op:"pool_import",paths:i.paths,folder:i.folder,at:i.at}]},t)}},"host.read":{label:"Host: the open timeline",group:"Hosts",effect:!1,hosts:En("read"),about:"Read the timeline open in the host (or `timeline`): clips, markers and media as rows, a session for the timeline blocks, and on Resolve the live items (clip colour, flags, versions, groups) and tracks. `from` = a timeline wired in instead (another read, a file, any node with a session): the same rows from it.",params:{...An,timeline:{type:"string",about:"a timeline by name; default the open one"},from:{type:"object",about:"a timeline wired in (a read, a file source, any node with a session_id)"}},run:async e=>{let t=e.from,r=t&&Array.isArray(t.clips)&&Array.isArray(t.items)?t:t?.session_id?await Iy(QI,String(t.session_id),{timeline:String(t.source_path??"").split(/[\\/]/).pop()}):await FF(yn(e),e.timeline);for(let o of r.markers)o.cells.on=o.cells.item_id?"clip":"timeline";return r}},"host.apply":{label:"Host: apply edits",group:"Hosts",effect:!0,hosts:En("apply"),about:"Carry out a batch of edits in the host, each read back; one undo for the batch.",params:{...An,ops:{type:"array",required:!0},timeline:{type:"string"},source:{type:"object",about:"the read the edits are for: one from a file cannot be applied (write it instead)"}},run:async e=>{let t=e.source;if(t&&t.clips&&!t.host)throw new P("refused","this timeline came from a file, not a running host: its edits cannot be applied live (write it for a host instead)");let r=(e.ops??[]).flat().filter(Boolean);if(!r.length)return{ok:!0,text:"nothing to change",applied:0};let o=await Ue("host_apply",{host:t?.host??yn(e),timeline:e.timeline,ops:r});return Zi.clear(),o}},"host.export_many":{label:"Host: read several timelines",group:"Hosts",effect:!1,hosts:En("read"),about:"Export timelines of the open project by name (none = the open one): the first as session_id, the rest as sources for timeline.all_clips / timeline.join.",params:{...An,timelines:{type:"array"}},run:async e=>{let t=(e.timelines??[]).map(String).filter(o=>o.trim()),r=[];for(let o of t.length?t:[void 0])r.push(String((await Ue("host_export",{host:yn(e),...o?{timeline:o}:{}})).session_id));return{ok:!0,text:`read ${r.length} timeline(s)`,session_id:r[0],sources:r.slice(1),sessions:r}}},"host.open":{label:"Host: open as a new timeline",group:"Hosts",effect:!0,hosts:En("open"),about:"Bring a session's timeline(s) into the host as NEW timelines linked to the clips already in the project (nothing open is edited). timeline_ids = several (all_clips per resolution).",params:{...An,session_id:{type:"string",required:!0},timeline_id:{type:"string"},timeline_ids:{type:"array"},name:{type:"string"}},run:async e=>{let t=e.timeline_ids?.length?e.timeline_ids:[e.timeline_id],r=[],o={};for(let n of t)o=await Ue("host_open",{host:yn(e),session_id:e.session_id,...n?{timeline_id:n}:{},...e.name?{name:e.name}:{},link_existing:!0}),r.push(String(o.text).split(`
|
|
117
|
+
`)[0]);return Zi.clear(),{...o,ok:!0,text:r.join(`
|
|
118
|
+
`)}}},"host.render":{label:"Host: render jobs",group:"Hosts",effect:!0,hosts:En("render"),about:"Render each job {name, in, out, target_dir, preset?} from `timeline` with the host's own renderer, one after another (only these jobs are queued; the artist's queue and Deliver settings stay). jobs may be review rows carrying `job`.",params:{...An,timeline:{type:"string"},jobs:{type:"array",required:!0}},run:async(e,t)=>{let r=(e.jobs??[]).map(n=>n.job??n),o=[];for(let[n,{name:i,in:a,out:s,...l}]of r.entries()){if(t.signal?.aborted){o.push("stopped");break}t.progress?.(n,r.length,`${n+1}/${r.length} ${i}`);let c=await zF(yn(e),e.timeline,{name:i,range:{in:a,out:s},...l},t,`${n+1}/${r.length} ${i}`);o.push(`${i}: ${c.ok?"rendered":String(c.text).split(`
|
|
119
|
+
`)[0]}`)}return{ok:o.every(n=>n.endsWith("rendered")),text:o.join(`
|
|
120
|
+
`)||"nothing to render",rendered:o.filter(n=>n.endsWith("rendered")).length}}},"host.pool":{label:"Host: media pool clips",group:"Hosts",effect:!1,hosts:En("pool"),about:"Every clip in the project's media pool with its file, bin, start TC and how many timelines use it; unused=true keeps the ones no timeline uses (outside `skip_folder`). Rows {name, folder, start_tc, file, drive}.",params:{...An,unused:{type:"boolean"},skip_folder:{type:"string"}},run:async e=>{let r=(await Ue("host_project",{host:yn(e),clips:!0})).pool;return e.unused?cR(r,String(e.skip_folder??"")):td(r).map(o=>({id:o.id,cells:{...o,drive:Oy(o.file)}}))}},"host.timelines":{label:"Host: the project's timelines",group:"Hosts",effect:!1,hosts:En("pool"),about:"Every timeline in the open project, by name (rows), for a review or a filter.",params:{...An},run:async e=>((await Ue("host_project",{host:yn(e)})).timelines??[]).map(t=>({id:t,cells:{name:t}}))},"host.qc":{label:"Render plugin: finishing QC",group:"Render plugin",effect:!0,hosts:En("qc"),about:"Render the timeline through the conform.tools render plugin, which measures EVERY frame after the grade: black edges per range with the clip and edge, black frames, clipping, freeze/flash, dead pixels, leader/slate, loudness. Findings go on the timeline as tagged markers (markers=true). Rows for a table, and the scan.",params:{timeline:{type:"string"},strictness:{type:"string"},expected_aspect:{type:"number"},markers:{type:"boolean"},audio:{type:"boolean"}},run:async(e,t)=>{let r=await Ue("host_render",{host:"resolve",renderplugin:!0,...e},t);return{...kR(r),scan:r,ok:!0}}},"rows.times":{label:"Times on the timeline",group:"Logic",effect:!1,fresh:!0,about:"Rows at regular times on a read timeline: one every `seconds` (or `frames`), from `from` to `to` seconds (default the whole timeline). Each row has frame (from the head) and tc; an edit block given these rows acts on the timeline at that frame (edit.marker_add: a marker every N seconds).",params:{live:{type:"object",required:!0},seconds:{type:"number"},frames:{type:"number"},from:{type:"number"},to:{type:"number"}},run:async e=>{let t=e.live,r=Number(t.fps??24),o=Math.round(Number(e.frames??0)||Number(e.seconds??1)*r);if(!(o>0))throw new P("invalid_args","times need seconds or frames above 0");let n=e.to!=null&&e.to!==""?Math.round(Number(e.to)*r):Number(t.frames??0),i=[];for(let a=Math.round(Number(e.from??0)*r);a<n&&i.length<1e4;a+=o)i.push({id:`t${a}`,cells:{frame:a,tc:ce(a+Number(t.start_frame??0),r,!1)}});return i}},"rows.filter":{label:"Filter rows",group:"Logic",effect:!1,about:'Keep the rows where every condition holds: [field, op, value], op = | != | contains | starts | in | empty | set | < | <= | > | >= (numbers: frames, speed %, duration). A track cell ("V2") matches a track number (2), so a track input filters directly. A condition whose value is unset is skipped (an optional filter left blank).',params:{rows:{type:"array",required:!0},where:{type:"array"}},run:async e=>{let t=(e.where??[]).filter(([,o,n])=>o==="empty"||o==="set"||n!=null&&n!==""),r=(o,n)=>o.cells[n];return(e.rows??[]).filter(o=>t.every(([n,i,a])=>{let s=r(o,String(n)),l=String(s??"").toLowerCase(),c=String(a??"").toLowerCase(),u=()=>l===c||/^[va]\d+$/.test(l)&&/^\d+$/.test(c)&&l.slice(1)===c,d=m=>typeof m=="number"?m:parseFloat(String(m??"").replace(/[^0-9.+-]/g,"")),f=()=>{let m=d(s),p=d(a);return Number.isFinite(m)&&Number.isFinite(p)?m-p:NaN};switch(i){case"=":return typeof a=="boolean"?!!s===a:u();case"!=":return!u();case"<":return f()<0;case"<=":return f()<=0;case">":return f()>0;case">=":return f()>=0;case"contains":return l.includes(c);case"starts":return l.startsWith(c);case"in":return Array.isArray(a)&&a.map(m=>String(m).toLowerCase()).includes(l);case"empty":return!l;case"set":return!!l;default:return!0}}))}},review:{label:"Review",group:"Logic",effect:!1,about:"Show the rows (with `columns`) and wait: the artist unticks what to leave out and applies. Its output is the rows kept.",params:{rows:{type:"array",required:!0},columns:{type:"array",about:"[cell key, label] pairs"},skip:{type:"string",about:"a cell that marks rows that cannot be applied (e.g. dupe)"}},run:async()=>{throw new P("internal","review is the runner's")}},"ops.collect":{label:"Collect edits",group:"Logic",effect:!1,about:"The edits a planner put on each row (`field`, default op) as one batch for host.apply.",params:{rows:{type:"array",required:!0},field:{type:"string"}},run:async e=>(e.rows??[]).map(t=>t[String(e.field??"op")]).filter(Boolean)},"plan.marker_ops":{label:"Plan marker edits",group:"Planners",effect:!1,about:"Existing marker rows \u2192 edits: action = recolor | swap (color \u2194 text) | rename | note | prefix | suffix | delete | to_clip (onto the clip under it) | to_timeline; color, text. It changes markers that are there; to ADD markers use edit.marker_add (one per row: clip rows mark each clip, rows.times rows mark those times).",params:{live:{type:"object",required:!0},rows:{type:"array",required:!0},action:{type:"recolor|swap|rename|note|prefix|suffix|delete|to_clip|to_timeline",required:!0},color:{type:"string"},text:{type:"string"}},run:async e=>{let t=e.live,r=e.action;return aR(t,r==="swap"?t.markers:e.rows,r,String(e.color??"Green"),String(e.text??(r==="swap"?"Red":"")))}},"rename.subjects":{label:"What to rename",group:"Planners",effect:!1,about:"The names to rename and how each is renamed in Resolve: target = clips (timeline video clips) | pool (media pool clips, `folder` to narrow) | timelines.",params:{live:{type:"object",required:!0},target:{type:"string",required:!0},folder:{type:"string"}},run:async e=>{let t=e.live;if(e.target==="clips")return t.items.filter(i=>i.kind==="video").sort((i,a)=>i.start-a.start||i.track-a.track).map(i=>({id:i.id,name:i.name,where:`V${i.track}`,op:{op:"name",item:{track:i.track,start:i.start}}}));let r=await Ue("host_project",{host:"resolve",clips:!0});if(e.target==="timelines")return(r.timelines??[]).map(i=>({id:i,name:i,where:"timeline",op:{op:"timeline_rename",timeline:i}}));let o=i=>[...i.clip_list??[],...(i.folders??[]).flatMap(o)],n=String(e.folder??"");return o(r.pool).filter(i=>!n||i.folder===n||i.folder.startsWith(`${n}/`)).map(i=>({id:i.id,name:i.name,where:i.folder||"Master",op:{op:"pool_rename",clip:i.id}}))}},"plan.rename":{label:"Plan renames",group:"Planners",effect:!1,about:"Run the rename steps over every subject's name; rows {id, where, old, new, dupe, error, op} for the ones that change.",params:{subjects:{type:"array",required:!0},steps:{type:"array",required:!0}},run:async e=>{let t=e.subjects??[],r=YI(t.map(o=>o.name),e.steps??[]);return t.map((o,n)=>({id:o.id,cells:{where:o.where,old:r[n].old,new:r[n].new,dupe:r[n].dupe?"DUPE":"",error:r[n].error??""},op:{...o.op,name:r[n].new}})).filter(o=>o.cells.new!==o.cells.old)}},table:{label:"Show a table",group:"Logic",effect:!1,about:"End a tool with a table of rows (with `columns`) and a summary `text`: findings to read, not to apply. A row's `tc` cell moves the host's playhead when clicked.",params:{rows:{type:"array",required:!0},columns:{type:"array"},text:{type:"string"}},run:async e=>({ok:!0,text:String(e.text??`${(e.rows??[]).length} row(s)`),table:{rows:e.rows??[],columns:e.columns??[]}})},"plan.clips":{label:"Clips as rows",group:"Planners",effect:!1,about:"The read timeline's clips as rows with what the host holds live on each (colour, flags, on, version, group, nodes, keywords); `query` narrows them with the Edit Index grammar (is:offline \xB7 speed!=100 \xB7 track:V2 \xB7 name:/^A0\\d+/).",params:{live:{type:"object",required:!0},query:{type:"string"}},run:async e=>{let t=e.live,r=String(e.query??"").trim();if(!r)return Ey(t);let o=await Ue("timeline_query",{session_id:t.session_id,table:"clips",query:r,limit:5e3,columns:["#"]});return Ey(t,new Set((o.rows??[]).map(n=>n.id)))}},"plan.index_ops":{label:"Plan clip edits",group:"Planners",effect:!1,about:`Clip rows \u2192 one edit each: action = ${Ay.map(([e])=>e).join(" | ")}; color (clip colour), marker_color (flags, markers), text.`,params:{live:{type:"object",required:!0},rows:{type:"array",required:!0},action:{type:Ay.map(([e])=>e).join("|"),required:!0},color:{type:"string"},marker_color:{type:"string"},text:{type:"string"}},run:async e=>{let t=String(e.action),r=String(t==="color"?e.color??"":e.marker_color??"Blue");return lR(e.live,e.rows??[],t,r,String(e.text??""))}},"plan.pool_ops":{label:"Plan pool moves",group:"Planners",effect:!1,about:"Pool clip rows \u2192 one batch: action = move (into `folder`, made if missing) | remove (out of the pool; files on disk stay; cannot be undone).",params:{rows:{type:"array",required:!0},action:{type:"move|remove"},folder:{type:"string"}},run:async e=>uR(e.rows??[],String(e.action??"move"),String(e.folder??""))},"plan.copy_pairs":{label:"Pair clips by overlap",group:"Planners",effect:!1,about:"Every clip on track `to` paired with the clip on track `from` it overlaps most (rows; a clip with nothing over it is a row too).",params:{live:{type:"object",required:!0},from:{type:"number",required:!0},to:{type:"number",required:!0}},run:async e=>dR(e.live,Number(e.from),Number(e.to))},"plan.copy_ops":{label:"Plan copies",group:"Planners",effect:!1,about:"Paired rows \u2192 copy_grade / copy_properties / clip colour / flags edits for what is switched on (grade, sizing, crop, composite, clip_color, flags); unpaired rows get a `miss_color` marker.",params:{rows:{type:"array",required:!0},grade:{type:"boolean"},sizing:{type:"boolean"},crop:{type:"boolean"},composite:{type:"boolean"},clip_color:{type:"boolean"},flags:{type:"boolean"},miss_color:{type:"string"}},run:async e=>mR(e.rows??[],new Set(nd.map(([t])=>t).filter(t=>e[t])),String(e.miss_color??""))},"plan.grade_trace":{label:"Trace earlier grades",group:"Planners",effect:!1,about:"Score every clip of the read timeline against the clips of earlier `timelines` (source TC overlap, reel, file name, path, duration): rows with the best match and up to top_n alternatives.",params:{...An,live:{type:"object",required:!0},timelines:{type:"array",required:!0},top_n:{type:"number"},min_score:{type:"number"},floor:{type:"number"}},run:async(e,t)=>{let r=e.live,o=[],n=(e.timelines??[]).filter(i=>i&&i!==r.timeline);if(!n.length)throw new P("invalid_args","choose the earlier timelines to trace from");for(let[i,a]of n.entries()){t.progress?.(i,n.length,`reading ${a}`);let s=await Ue("host_export",{host:yn(e),timeline:a}),[l,c]=await Promise.all([Ue("timeline_query",{session_id:s.session_id,table:"clips",limit:5e3,columns:["track","track_no","name","timeline_range.start","reel_name","media_reference_id"]}),Ue("timeline_query",{session_id:s.session_id,table:"media",limit:5e3,columns:["name","target_url","available_range.start","available_range.dur"]})]);o.push(...My(a,l.rows,c.rows))}return fR(My(r.timeline,r.clips,r.media),o,{topN:Number(e.top_n??3),minScore:Number(e.min_score??60),floor:Number(e.floor??85)})}},"plan.grade_trace_ops":{label:"Plan traced grades",group:"Planners",effect:!1,about:"Traced rows \u2192 copy_grade from the best match (only_trusted: trusted matches only), or with variants the top matches as named local versions; unmatched rows get a `mark_color` marker.",params:{rows:{type:"array",required:!0},variants:{type:"boolean"},only_trusted:{type:"boolean"},mark_color:{type:"string"}},run:async e=>pR(e.rows??[],{variants:!!e.variants,onlyTrusted:e.only_trusted!==!1,markColor:String(e.mark_color??"")})},"plan.align_rows":{label:"Align results as rows",group:"Planners",effect:!1,about:"timeline_align's answer as rows: record TC, track, clip, verdict, confidence, the host sizing (rows not aligned cannot be applied: cell `cant`).",params:{result:{type:"object",required:!0}},run:async e=>hR(e.result?.rows??[],e.result?.sizing_target)},"plan.align_ops":{label:"Plan sizing",group:"Planners",effect:!1,about:"The sizing edits of the kept aligned rows, and timeline_align's markers when `markers`.",params:{result:{type:"object",required:!0},rows:{type:"array",required:!0},markers:{type:"boolean"}},run:async e=>gR(e.result?.ops??[],e.rows??[],e.markers!==!1)},"plan.blanking_rows":{label:"Blanking findings as rows",group:"Planners",effect:!1,about:"qc_blanking's findings as rows: record TC, frames, track, clip, black per edge, the zoom that fills.",params:{result:{type:"object",required:!0}},run:async e=>bR(e.result?.findings??[])},"plan.blanking_ops":{label:"Plan blanking fixes",group:"Planners",effect:!1,about:"The kept findings' markers, and the zoom fix of each clip they sit on when `fixes`.",params:{result:{type:"object",required:!0},rows:{type:"array",required:!0},live:{type:"object",required:!0},fixes:{type:"boolean"}},run:async e=>yR(e.result?.ops??[],e.rows??[],e.live,e.fixes!==!1)},"plan.reconform":{label:"Cut changes as rows",group:"Planners",effect:!1,about:"timeline_diff's ranges as rows (record in/out, change, both sides), each carrying the marker for A at its first frame (start_frame = A's timeline start).",params:{diff:{type:"object",required:!0},start_frame:{type:"number"}},run:async e=>_R(e.diff?.ranges??[],Number(e.start_frame??0))},"plan.carry_rows":{label:"Pair the new cut with the colour cut",group:"Planners",effect:!1,about:"Every video clip of B (a read) paired with the clip of A (a read) holding the most of the same source frames of the same media: the clip whose grade it takes. New material is a row with no source.",params:{a:{type:"object",required:!0},b:{type:"object",required:!0}},run:async e=>{let t=e.a,r=e.b;if(!r?.items?.length)throw new P("invalid_args","B has to be a timeline in this project to build the reconform on (import the new cut into Resolve first)");return vR(t,r)}},"plan.carry_ops":{label:"Plan the carry",group:"Planners",effect:!1,about:"Kept carry rows \u2192 edits on B's copy, each source read in A: grade (a remote one selected, a local one copied onto a local version), sizing, crop, composite, clip colour, clip markers (what is switched on; flags are the media's, so B has A's); new material gets a `miss_color` marker.",params:{rows:{type:"array",required:!0},a:{type:"object",required:!0},grade:{type:"boolean"},sizing:{type:"boolean"},crop:{type:"boolean"},composite:{type:"boolean"},clip_color:{type:"boolean"},markers:{type:"boolean"},miss_color:{type:"string"}},run:async e=>wR(e.rows??[],new Set(od.map(([t])=>t).filter(t=>e[t])),e.a,String(e.miss_color??""))},"host.duplicate":{label:"Host: duplicate a timeline",group:"Hosts",effect:!0,hosts:["resolve"],about:"A copy of `timeline` under `name` (made unique: never over another timeline), opened. Answers `timeline`: its name, for the next host.apply.",params:{...An,timeline:{type:"string",required:!0},name:{type:"string"}},run:async e=>{let t=await Ue("host_apply",{host:yn(e),timeline:e.timeline,ops:[{op:"timeline_duplicate",name:e.name||`${e.timeline}_RECONFORMED`}]}),r=t.results?.[0]?.name;if(!r)throw new P("engine",`Resolve did not duplicate ${e.timeline}: ${String(t.text).split(`
|
|
121
|
+
`)[0]}`);return Zi.clear(),{ok:!0,text:`made ${r}`,timeline:r}}},"plan.vfx_pulls":{label:"Plan VFX pulls",group:"Planners",effect:!1,about:"Markers of `color` \u2192 numbered shots (prefix, increment, digits) with their plates (the clips under each marker; hero = lowest | highest track) and the reference_track clip; rows per pull, and the string-out with handles and a gap between shots.",params:{live:{type:"object",required:!0},color:{type:"string"},prefix:{type:"string"},increment:{type:"number"},digits:{type:"number"},handles:{type:"number"},gap:{type:"number"},start_frame:{type:"number"},hero:{type:"string"},reference_track:{type:"number"},skip_disabled:{type:"boolean"}},run:async e=>$R(await CF(e.live),{color:String(e.color??"Blue"),prefix:String(e.prefix??"VFX"),increment:Number(e.increment??10),digits:Number(e.digits??4),handles:Number(e.handles??8),gap:Number(e.gap??24),startFrame:Number(e.start_frame??1001),hero:e.hero==="highest"?"highest":"lowest",referenceTrack:Number(e.reference_track)||void 0,skipDisabled:e.skip_disabled!==!1})},"plan.vfx_names":{label:"Plan shot names",group:"Planners",effect:!1,about:"The shot names onto their markers, for the shots with a kept pull.",params:{plan:{type:"object",required:!0},rows:{type:"array",required:!0}},run:async e=>xR(e.plan,e.rows??[])},"vfx.stringout":{label:"Build the VFX string-out",group:"Planners",effect:!0,hosts:En("open"),about:"The kept pulls end to end (handles, a gap between shots) as a new timeline <name>_VFX_STRINGOUT in the host, linked to the clips already there; its name and start frame for host.render.",params:{...An,live:{type:"object",required:!0},plan:{type:"object",required:!0},rows:{type:"array",required:!0}},run:async e=>{let t=e.live,r=Cy(e.plan,e.rows??[]);if(!r.length)throw new P("invalid_args","no kept pull has linked media");let n=(await Fe(t.session_id)).session.timelines?.find(c=>c.kind!=="compound"),i=await Ue("timeline_author",{name:`${t.timeline}_VFX_STRINGOUT`,fps_num:n?.fps_num??24,fps_den:n?.fps_den??1,width:n?.resolution_w??1920,height:n?.resolution_h??1080,shots:r.map(c=>({path:c.media,source_in:c.src_in,duration:c.src_out-c.src_in,at:c.rec_in,track:1}))}),a=await Ue("host_open",{host:yn(e),session_id:i.session_id,link_existing:!0}),s=String(a.timeline),l=yn(e)==="resolve"?Number((await Ue("host_items",{timeline:s,kind:"video",track:1})).start_frame??0):0;return{ok:!0,text:String(a.text).split(`
|
|
122
|
+
`)[0],timeline:s,start_frame:l}}},"plan.vfx_renders":{label:"Plan pull renders",group:"Planners",effect:!1,about:"One render job per kept pull from the built string-out (its timeline start), into root/<shot>/, plates and reference each with their preset.",params:{plan:{type:"object",required:!0},rows:{type:"array",required:!0},start_frame:{type:"number"},root:{type:"string",required:!0},plate_preset:{type:"string"},reference_preset:{type:"string"}},run:async e=>{if(e.start_frame===void 0)throw new P("invalid_args","build the string-out first (switch on Build)");return SR(e.plan,e.rows??[],Number(e.start_frame),String(e.root),String(e.plate_preset??""),String(e.reference_preset??""))}},"plan.marker_renders":{label:"Plan marker renders",group:"Planners",effect:!1,about:`One render job per marker of \`color\` (scope all | duration | frame), named by a delivery convention (naming: ${id.map(([e])=>e).join(" | ")}; fields {show, season, episode, film, reel, version, artist \u2026}), with handles, into the convention's folder under root. Rows carry the job; a name two jobs share is marked dupe.`,params:{live:{type:"object",required:!0},color:{type:"string"},scope:{type:"string"},naming:{type:"string"},handles:{type:"number"},fields:{type:"object"},root:{type:"string",required:!0},preset:{type:"string"}},run:async e=>RR(e.live,{color:String(e.color??"Blue"),scope:["all","duration","frame"].includes(String(e.scope))?e.scope:"all",naming:String(e.naming??"conformtools"),handles:Number(e.handles??0),fields:Object.fromEntries(Object.entries(e.fields??{}).filter(([,t])=>t!==void 0&&t!=="").map(([t,r])=>[t,String(r)])),root:String(e.root??""),preset:e.preset?String(e.preset):void 0})}};for(let[e,t]of Object.entries(eT))qs[`edit.${e}`]={label:`Edit: ${t}`,group:"Host edits",effect:!1,hosts:En("apply").filter(r=>TR(r,e)),about:`One '${e}' edit per row (clip rows or live items), with the other args as its fields (host_apply's '${e}'); feed the result to host.apply.`,params:{rows:{type:"array",about:"the items to edit; leave out for a one-off edit"}},run:async r=>LF(e,r)};var UF={"resolve.pull":"host.read","resolve.apply":"host.apply",...Object.fromEntries(Object.keys(eT).map(e=>[`resolve.${e}`,`edit.${e}`]))},BF={join:"Join timelines end to end",remove_audio:"Remove audio",stringout:"String-out with handles",add_handles:"Add handles (new timeline)",all_clips:"All clips (new timeline)",reformat:"Change the raster",timeline_rate:"Change the frame rate",add_markers:"Add markers",add_track:"Add a track",delete_track:"Delete a track",add_clip:"Cut a media file in",transform:"Transform a clip",trim:"Trim a clip",slip:"Slip a clip",delete:"Delete a clip",move_clip:"Move a clip",new_timeline:"New empty timeline"};for(let[e,t]of Object.entries(BF))qs[`timeline.${e}`]={label:`Timeline: ${t}`,group:"Timeline",effect:!1,about:`timeline_edit '${e}' on the session (frame-accurate, on the IR, no host needed): its args as this block's; \`sources\` = other sessions whose timelines take part (join several reads).`,params:{session_id:{type:"string",required:!0},sources:{type:"array"}},run:async(r,o)=>{let{session_id:n,...i}=r,a=await Ue("timeline_edit",{session_id:n,kind:e,args:i},o),s=a.meta??{},l=typeof s.timeline_id=="string"?[s.timeline_id]:(s.timelines??[]).map(c=>c.id);return{...a,session_id:n,...l.length?{timeline_id:l[0],timeline_ids:l}:{}}}};qs["timeline.read_many"]={label:"Read timelines",group:"Timeline",effect:!1,about:"Read several timeline files (any host): the first as session_id, the rest as sources for timeline.join and the other timeline blocks.",params:{paths:{type:"array",required:!0},engine:{type:"string"}},run:async(e,t)=>{let r=(e.paths??[]).map(n=>String(n).trim()).filter(Boolean);if(!r.length)throw new P("invalid_args","no timeline files");let o=[];for(let n of r)o.push(String((await Ue("timeline_read",{path:n,...e.engine?{engine:e.engine}:{}},t)).session_id));return{ok:!0,text:`read ${o.length} timeline file(s)`,session_id:o[0],sources:o.slice(1),sessions:o}}};var VF=new Set(["timeline_align","timeline_diff"]);function tT(e){let t=e.startsWith("verb.")?an(e.slice(5)):void 0;if(!t)return null;let r=Ts(h.object(t.inputSchema));return{label:t.title??t.name,group:"conform.tools",about:String(t.description??"").split(". ")[0],effect:!Pd.has(t.name)&&!VF.has(t.name),params:Object.fromEntries(Object.entries(r.properties??{}).map(([o,n])=>[o,{type:n.enum?n.enum.join("|"):n.type,about:n.description,required:r.required?.includes(o)}])),run:(o,n)=>Ue(t.name,o,n)}}var m_=e=>qs[UF[e]??e]??tT(e),f_=e=>!!m_(e);function nT(){let e=Ks.filter(t=>!["tool","account_login","account_logout","report","job"].includes(t.name)).map(t=>({use:`verb.${t.name}`,...tT(`verb.${t.name}`)}));return[...Object.entries(qs).map(([t,r])=>({use:t,...r})),...e].map(({run:t,...r})=>r)}var ZF=e=>Z0[e]?.slug??e;function GF(e,t,r,o,n=0){let i=e.graphics.flatMap(m=>m.files),a=o?ZF(o):i[0]?.position,s=[...new Map(i.map(m=>[m.format,m.width/m.height])).entries()],l=t&&r?t/r:16/9,c=s.sort((m,p)=>Math.abs(Math.log(m[1]/l))-Math.abs(Math.log(p[1]/l)))[0]?.[0],u=e.graphics.map(m=>m.files.find(p=>p.position===a&&p.format===c)??m.files.find(p=>p.format===c)).filter(m=>!!m),d=n,f=u.map(m=>{let p=d;return d+=m.frames,p});return{paths:u.map(m=>m.path),at:f,folder:`Graphics/${e.out_dir.split(/[\\/]/).pop()}`}}var Gi=e=>Object.fromEntries(Object.entries(e.out).flatMap(([t,r])=>{let o=r?.session_id;return typeof o=="string"?[[t,o]]:[]})),Hi=new Map,HF=50,rT=(e,t)=>t.reduce((r,o)=>r?.[o],e);function Qn(e,t){if(Hs(e)){for(let r of e.split("|")){let[o,...n]=r.trim().slice(1).split("."),i=rT(o==="in"?t.in:t.out[o],n);if(i!=null&&i!=="")return i}return}return Array.isArray(e)?e.map(r=>Qn(r,t)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([r,o])=>[r,Qn(o,t)])):e}function iT(e,t){if(!e)return!0;if(e.includes(" & "))return e.split(" & ").every(n=>iT(n,t));let r=/^(.*?)(!=|=)(.*)$/.exec(e);if(!r){let n=Qn(e,t);return n!==void 0&&n!==!1}let o=String(Qn(r[1].trim(),t)??"");return r[2]==="="?o===r[3].trim():o!==r[3].trim()}function WF(e,t){let r=new Map(e.nodes.map(a=>[a.id,a])),o=new Set,n=(a,s)=>{if(Hs(a))for(let l of a.split("|")){let c=l.trim().slice(1).split(/[.=!]/)[0];c&&c!=="in"&&s.push(c)}else Array.isArray(a)?a.forEach(l=>n(l,s)):a&&typeof a=="object"&&Object.values(a).forEach(l=>n(l,s));return s},i=a=>{if(o.has(a)||!r.has(a))return;o.add(a);let s=r.get(a);for(let l of n(s.when,n(s.args,[])))i(l)};return i(t),o}async function bo(e,t,r={}){let o,n=0,i,a;if(r.resume){let m=Hi.get(r.resume.run_id);if(!m)throw new P("not_found","that run is no longer waiting (run the tool again)");Hi.delete(r.resume.run_id),{spec:e,ctx:o,at:n}=m,r.resume.inputs&&(o={...o,in:{...o.in,...r.resume.inputs}}),i=m.only?new Set(m.only):void 0;let p=e.nodes[n];if(m.inner){let g=await bo({},{},{...r,resume:r.resume&&{run_id:m.inner.run_id,keep:r.resume.keep,...r.resume.inputs?{inputs:Qn(p.args,o)}:{}},until:void 0});if(g.state==="review")return oT(g,{spec:e,ctx:o,at:n,only:m.only,inner:{run_id:g.run_id,node:p.id}});if(g.state==="ready")return{state:"ready",node:p.id,label:g.label};if(!g.ok)return g;a=o.out[p.id]=g.output}else{let g=Qn(p.args.rows,o)??[],_=new Set(r.resume.keep),v=p.args.skip;a=o.out[p.id]=g.filter(y=>_.has(y.id)&&!(v&&y.cells[v]))}n++}else{let m=Object.fromEntries(e.inputs.map(p=>[p.id,t[p.id]??p.default]));if(o={in:{...t,...m},out:{}},r.until){if(!e.nodes.some(p=>p.id===r.until))throw new P("not_found",`no node '${r.until}'`);i=WF(e,r.until)}}let s=[];for(;n<e.nodes.length;n++){let m=e.nodes[n];if(i&&!i.has(m.id)||!iT(m.when,o))continue;if(m.use.startsWith("tool.")){if(!r.tool)throw new P("invalid_args",`node '${m.id}': tools inside tools need the tool table`);let _=await r.tool(m.use.slice(5)),v=await bo(_,Qn(m.args,o),{...r,until:void 0,resume:void 0});if(v.state==="review")return oT(v,{spec:e,ctx:o,at:n,only:i&&[...i],inner:{run_id:v.run_id,node:m.id}});if(v.state==="ready")return{state:"ready",node:m.id,label:`${_.name}: ${v.label}`,sessions:{...Gi(o),...v.sessions}};if(!v.ok)return{...v,text:`${m.label??_.name}: ${v.text}`};a=o.out[m.id]=v.output??{ok:!0,text:v.text},s.push(v.text);continue}let p=m_(m.use);if(!p)throw new P("invalid_args",`node '${m.id}': no block '${m.use}'`);let g=m.label??p.label;if(m.use==="review"){let _=Qn(m.args.rows,o)??[],v=crypto.randomUUID();return aT(v,{spec:e,ctx:o,at:n,only:i&&[...i]}),{state:"review",run_id:v,node:m.id,label:g,rows:_,columns:m.args.columns??[],skip:m.args.skip,sessions:Gi(o)}}if(r.preview&&p.effect)return{state:"ready",node:m.id,label:g,sessions:Gi(o)};try{a=o.out[m.id]=await p.run(Qn(m.args,o),{signal:r.signal,progress:r.progress});let _=a?.text;p.effect&&typeof _=="string"&&s.push(_)}catch(_){return{state:"done",ok:!1,text:`${g}: ${_.message}`,node:m.id,sessions:Gi(o)}}}let l=a&&typeof a=="object"&&!Array.isArray(a)?a:{},c=typeof l.text=="string"?l.text:Array.isArray(a)?`${a.length} result(s)`:a===void 0?"done":JSON.stringify(a).slice(0,2e3),u=s.length>1?s.join(`
|
|
123
|
+
`):c,d=Object.values(o.out).map(m=>m?.undo_id).filter(m=>typeof m=="string").pop(),f=Object.values(o.out).find(m=>typeof m?.clips=="object");return{state:"done",ok:l.ok!==!1,text:u,...d?{undo_id:d}:{},...typeof f?.timeline=="string"?{timeline:f.timeline}:{},...l.table?{table:l.table}:{},output:a,sessions:Gi(o)}}function aT(e,t){for(Hi.set(e,{...t,at:t.at});Hi.size>HF;)Hi.delete(Hi.keys().next().value)}function oT(e,t){let r=crypto.randomUUID();return aT(r,t),{...e,run_id:r,sessions:{...Gi(t.ctx),...e.sessions}}}var yo=new Map,JF=100,p_=()=>new Date().toISOString();function Xs(e){for(e.updated=p_(),yo.set(e.id,e);yo.size>JF;)yo.delete(yo.keys().next().value);return Xn({type:"run",run:e}),e}function Ed(e,t){return e.state=t,e.status=t.state==="review"?"review":t.state==="ready"||t.ok?"done":"failed",Xs(e)}function Wi(e,t){return[...yo.values()].filter(r=>r.project===e&&(!t||r.tool===t)).reverse()}function h_(e){return yo.get(e)??[...yo.values()].find(t=>t.state?.state==="review"&&t.state.run_id===e)}async function sT(e,t,r,o={}){if(o?.until||o?.preview&&r.by==="app")return{state:await bo(e,t,o)};let n=Xs({id:crypto.randomUUID(),tool:e.id,name:e.name,project:r.project,by:r.by,inputs:t,status:"running",started:p_(),updated:p_()});try{let i=await bo(e,t,o);return{run:Ed(n,i),state:i}}catch(i){throw Ed(n,{state:"done",ok:!1,text:i.message}),i}}function KF(e,t,r,o){if(r)return r;let n=new Set(o?.map(i=>(typeof i=="number"||/^\d+$/.test(String(i)))&&!e.some(a=>a.id===String(i))?e[Number(i)-1]?.id:String(i)));return e.filter(i=>!(t&&i.cells[t])&&!n.has(i.id)).map(i=>i.id)}async function lT(e,t,r={}){let o=t.id?h_(t.id):Wi(e,t.tool).find(a=>a.status==="review");if(!o){if(t.id)return{state:await bo({},{},{...r,resume:{run_id:t.id,keep:t.keep??[],inputs:t.inputs}})};throw new P("not_found",t.tool?`nothing from ${t.tool} is waiting for an OK`:"nothing is waiting for an OK in this job")}if(o.state?.state!=="review")throw new P("invalid_args",`${o.name} is not waiting for an OK (it is ${o.status})`);let n=o.state,i=KF(n.rows,n.skip,t.keep,t.drop);o.status="running",Xs(o);try{let a=await bo({},{},{...r,resume:{run_id:n.run_id,keep:i,inputs:t.inputs}});return{run:Ed(o,a),state:a}}catch(a){throw Ed(o,{state:"done",ok:!1,text:a.message}),a}}function cT(e,t){let r=t.id?h_(t.id):Wi(e,t.tool).find(o=>o.status==="review");if(!r||r.status!=="review")throw new P("not_found","nothing is waiting for an OK");return r.status="dropped",Xs(r)}async function uT(e,t,r){let o=s=>s.status==="done"&&s.state?.state==="done"&&!!s.state.undo_id,n=t.id?h_(t.id):Wi(e,t.tool).find(o);if(!n||!o(n))throw new P("not_found",n?`${n.name}'s run left nothing to undo`:"nothing in this job to undo");let i=n.state,a=await r(i.undo_id,i.timeline);if(!a.ok)throw new P("engine",a.text);return n.status="undone",n.undone=a.text,Xs(n)}function g_(e,t=25){let r=e.state,o=`${e.name} (${e.tool}) \xB7 run ${e.id} \xB7 ${e.status} \xB7 by ${e.by}`;if(e.status==="review"&&r?.state==="review"){let n=r.columns.length?r.columns.map(([a])=>a):[...new Set(r.rows.slice(0,20).flatMap(a=>Object.keys(a.cells)))].slice(0,6),i=r.rows.slice(0,t).map((a,s)=>` ${s+1}. [${a.id}] ${n.map(l=>`${l}: ${String(a.cells[l]??"")}`).join(" \xB7 ")}${r.skip&&a.cells[r.skip]?" (skipped)":""}`);return[`${o} \u2014 ${r.label}: ${r.rows.length} row(s) waiting for an OK`,...i,...r.rows.length>t?[` \u2026 ${r.rows.length-t} more`]:[]].join(`
|
|
124
|
+
`)}return r?.state==="done"?`${o} \u2014 ${e.undone?`undone: ${e.undone}`:r.text.split(`
|
|
125
|
+
`)[0]}${r.undo_id&&e.status==="done"?" (can undo)":""}`:o}function qF(e){let t=e?.duration?.value,r=e?.duration?.rate;if(!t||!r)return"n/a";let o=n=>String(n).padStart(2,"0");if(r>=1e3){let n=t/r,i=Math.round((n-Math.floor(n))*1e3);return`${o(Math.floor(n/3600))}:${o(Math.floor(n/60)%60)}:${o(Math.floor(n)%60)}.${String(i).padStart(3,"0")}`}return ce(Math.max(0,t),r)}function dT(e){for(let t of e?.streams??[])if(t.kind==="video"&&t.bit_depth!=null)return t.bit_depth;return null}var b_=[{label:"Start TC",criterion:"timecode",standing:!0,get:e=>e?.source_timecode||"00:00:00:00",has:e=>!!e?.source_timecode},{label:"Reel",criterion:"reelName",get:e=>e?.reel_name||"n/a",has:e=>!!e?.reel_name},{label:"Duration",criterion:"totalDuration",get:e=>qF(e?.available_range?.duration?.value?e.available_range:e?.declared_duration?{duration:e.declared_duration}:null),has:e=>(e?.available_range?.duration?.value??0)>0||(e?.declared_duration?.value??0)>0},{label:"Resolution",criterion:"resolution",get:e=>e?.source_resolution_w&&e?.source_resolution_h?`${e.source_resolution_w}\xD7${e.source_resolution_h}`:"n/a",has:e=>!!(e?.source_resolution_w&&e?.source_resolution_h)},{label:"Bit depth",criterion:"bitDepth",get:e=>{let t=dT(e);return t!=null?`${t}-bit`:"n/a"},has:e=>dT(e)!=null},{label:"Frame rate",criterion:"frameRate",standing:!0,get:e=>e?.source_fps!=null?Pm(e.source_fps):"n/a",has:e=>e?.source_fps!=null},{label:"Format",criterion:"fileFormat",get:e=>e?.container||"n/a",has:e=>!!e?.container},{label:"Codec",criterion:"codec",get:e=>e?.codec||"n/a",has:e=>!!e?.codec}],mT=b_.map(e=>e.label);var fT=["#","name","track","timeline","kind","item_index","enabled","timeline_range.start","timeline_range.dur","source_range.start","source_range.dur","media_reference_id","source_element_id","reel_name","source_timecode","nested_timeline_id","is_nested","is_multicam","is_reinterpreted","speed","speed_ramped","speed_reverse","scale","scale_x","scale_y","position_x","position_y","rotation","anchor_x","anchor_y","crop_left","crop_right","crop_top","crop_bottom","opacity","blend_mode","keyframes","effects",...mT];function XF(e){if(!e||typeof e!="object")return!1;let t=e,r=t.start,o=t.duration;return!!r&&!!o&&typeof r.value=="number"&&typeof o.value=="number"}function hT(e,t,r){for(let[o,n]of Object.entries(t)){let i=e?`${e}.${o}`:o;if(n==null)r[i]=null;else if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")r[i]=n;else if(XF(n))r[`${i}.start`]=Math.round(n.start.value),r[`${i}.dur`]=Math.round(n.duration.value);else if(Array.isArray(n))r[i]=n.length?`[${n.length}]`:null;else if(typeof n=="object"){let a=JSON.stringify(n);r[i]=a==="{}"?null:a}}}function gT(e){let t=[],r=new Set,o=[],n=s=>{r.has(s)||(r.add(s),o.push(s))},i=0;for(let s of Oi(e))for(let l of s.tracks??[])for(let c of l.items??[]){if(c.kind==="gap")continue;let u={};u["#"]=++i,u.timeline=s.name,u.timeline_fps=Ze(s),u.track=Yt(l,s.tracks??[]),hT("",c,u);let d=(c.effects??[]).map(m=>m.name||m.plugin_name||m.kind||"").filter(Boolean);u.effect_names=d.length?d.join(", "):null,u.source_fps_n=Wu(e,c)?.source_fps??null;let f=Wu(e,c);for(let m of b_){let p=f?m.get(f):null;u[m.label]=p==="n/a"?null:p}u.binding_state=f?f.binding_state??"unbound":null;for(let m of Object.keys(u))n(m);t.push({id:c.id,item:c,cells:u})}return{columns:[...fT,...o.filter(s=>!fT.includes(s))],rows:t}}var pT=["name","binding_state","usage","origin","content_kind","kind","target_url","local_path","reel_name","reel_sources","source_timecode","available_range.start","available_range.dur","source_resolution_w","source_resolution_h","source_pixel_aspect","source_fps","container","codec","size_bytes","bitrate_bps","streams","display_name","file_modified_at","keykode","vendor_metadata","bundle","recipe","raw_extraction","metadata"];function bT(e){let t=[],r=new Set,o=[],n=a=>{r.has(a)||(r.add(a),o.push(a))};for(let a of e){let s={};s.name=a.name,s.origin=a.origin,a.ref&&hT("",a.ref,s),a.extra&&Object.assign(s,a.extra);for(let l of Object.keys(s))n(l);t.push({id:a.id,name:a.name,ref:a.ref,origin:a.origin,cells:s})}return{columns:[...pT,...o.filter(a=>!pT.includes(a))],rows:t}}var YF={name:"Name",origin:"Origin",usage:"Usage",id:"ID",binding_state:"State",content_kind:"Kind",target_url:"Path",reel_name:"Reel",source_timecode:"Start TC",source_resolution_w:"Source W",source_resolution_h:"Source H",source_pixel_aspect:"PAR",source_fps:"FPS",size_bytes:"Size",codec:"Codec",container:"Format",declared_duration:"Declared",available_range:"Range",source_facts_origin:"Facts",coverage_reason:"Coverage",display_name:"Display name"};function Od(e){let t=YF[e];return t||e.split(".").map(r=>r.replace(/_/g," ").replace(/^./,o=>o.toUpperCase())).join(" \xB7 ")}var QF=/^[-+]?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?$/,_o="[-+]?(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][-+]?\\d+)?";function vo(e){let t=e.trim();if(!QF.test(t))return null;let r=Number(t);return Number.isFinite(r)?r:null}function eL(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e!="string")return null;let t=vo(e);if(t!==null)return t;let r=e.trim().match(new RegExp(`^(${_o})\\s*[a-zA-Z%\xB0\xD7]*$`));if(!r)return null;let o=Number(r[1]);return Number.isFinite(o)?o:null}function yT(e){let t=e.trim(),r=t.indexOf(".");if(r===-1||/[eE]/.test(t))return 1e-4;let o=t.length-r-1;return Math.max(1e-4,.5*Math.pow(10,-(o+1)))}function Ji(e){let t=e.trim();if(!t||t.includes("...."))return null;let o=t.match(new RegExp(`^between\\s+(${_o})\\s+and\\s+(${_o})$`,"i"))??t.match(new RegExp(`^(${_o})\\s*(?:\\.\\.\\.?|,,|\\s+to\\s+|-)\\s*(${_o})$`,"i"));if(o){let s=vo(o[1]),l=vo(o[2]);return s===null||l===null?null:{op:"range",value:Math.min(s,l),high:Math.max(s,l)}}let n=t.match(new RegExp(`^(?:in\\s+)?(${_o}(?:\\s*[,|]\\s*${_o})+)$`,"i"));if(n){let s=n[1].split(/\s*[,|]\s*/).map(vo);if(s.some(c=>c===null))return null;let l=s;return{op:"in",value:l[0],values:l,tolerance:1e-4}}let i=t.match(/^(>=|<=|!=|==|=|>|<)\s*(.+)$/);if(i){let s=vo(i[2]);return s===null?null:{op:i[1]==="=="?"=":i[1],value:s,tolerance:yT(i[2])}}let a=vo(t);return a!==null?{op:"=",value:a,tolerance:yT(t)}:null}function tL(e){let t=e.trim();if(!t)return null;let r=Ji(t);if(r)return[r];let o=t.split(/(?:\s*(?:,|&|\band\b)\s*|\s+)(?=(?:>=|<=|!=|==|=|>|<))/i).map(i=>i.trim().replace(/(?:\s*(?:,|&|\band))+$/i,"").trim()).filter(Boolean);if(o.length<2)return null;let n=o.map(Ji);return n.some(i=>i===null)?null:n}function nL(e,t,r){if(!Number.isFinite(e))return!1;let o=r??t.tolerance??1e-6;switch(t.op){case"=":return Math.abs(e-t.value)<=o;case"!=":return Math.abs(e-t.value)>o;case">":return e>t.value;case"<":return e<t.value;case">=":return e>=t.value-o;case"<=":return e<=t.value+o;case"range":return e>=t.value-o&&e<=(t.high??t.value)+o;case"in":return(t.values??[t.value]).some(n=>Math.abs(e-n)<=o);default:return!1}}function y_(e,t=0){if(t>4||e===null||e===void 0)return[];let r=eL(e);return r!==null?[r]:Array.isArray(e)?e.flatMap(o=>y_(o,t+1)):typeof e=="object"?Object.values(e).flatMap(o=>y_(o,t+1)):[]}function Ki(e,t,r="="){let o=tL(t);if(!o)return!1;let n=y_(e);if(n.length===0)return!1;let i=vo(t)!==null,a=o.map(s=>i&&r!=="="?{...s,op:r}:s);return n.some(s=>a.every(l=>nL(s,l)))}var _T="Key > value \xB7 Key = value \xB7 Key ~ text \xB7 Key (exists)",vT=">1.2 \xB7 <0.5 \xB7 =62.5 \xB7 !=0 \xB7 1..2 \xB7 61-64 \xB7 >61 <64 \xB7 in 5,6,8";var rL=/^is:(.*)$/,oL=/^([A-Za-z_][\w. -]*?)\s*(>=|<=|!=|=|>|<|:)\s*(.*)$/s,iL=/^"([^"]+)"\s*(>=|<=|!=|=|>|<|:)\s*(.*)$/s,wT=/^\/(.*)\/([a-z]*)$/s,__=e=>e.toLowerCase().replace(/[^a-z0-9]/g,"");function Cd(e){return e.match(/[^\s"]*(?::|=)in\s+[^\s"]+|(?:[^\s"]+|"[^"]*")+/gi)??[]}function xT(e){return/^".*"$/s.test(e)?e.slice(1,-1):null}function kT(e,t){let r=__(t);if(!r)return[];let o=Object.keys(e.cells),n=o.filter(a=>__(a)===r);return(n.length?n:o.filter(a=>__(a).includes(r))).map(a=>e.cells[a])}var aL=e=>e==null?null:String(e);function Md(e,t,r){let o=aL(e),n=xT(r.trim());if(n!=null)return o==null?!1:t==="="?o.toLowerCase()===n.toLowerCase():t==="!="?o.toLowerCase()!==n.toLowerCase():o.toLowerCase().includes(n.toLowerCase());let i=r.trim(),a=/^in\s+(.+)$/is.exec(i);if(a&&(t===":"||t==="="))return a[1].split(/\s*[,|]\s*/).some(l=>l!==""&&Md(e,"=",l));if(!i)return o!=null&&o!==""&&o!=="n/a";if(i.includes("|")&&!wT.test(i))return i.split("|").some(l=>l.trim()&&Md(e,t,l));let s=wT.exec(i);if(s){if(o==null)return!1;try{return new RegExp(s[1],s[2]||"i").test(o)}catch{return!1}}if(t===":"){let l=Ji(i);return l&&!/^[-+]?[\d.]+$/.test(i)?Ki(e,i):l!=null&&Ki(e,i)||o!=null&&o.toLowerCase().includes(i.toLowerCase())}if(Ji(i)&&t!=="="&&t!=="!=")return Ki(e,t+i);if(t==="="||t==="!="){let l=Ji(i)?Ki(e,i):o!=null&&o.toLowerCase()===i.toLowerCase();return t==="="?l:!l}return Ki(e,t+i)}function v_(e,t,r){let o=iL.exec(t);if(o){let s=kT(e,o[1]);return s.length>0&&s.some(l=>Md(l,o[2],o[3]))}let n=xT(t);if(n!=null)return $T(e,n);let i=rL.exec(t);if(i){let s=r[i[1].toLowerCase()];return s?s(e):!1}let a=oL.exec(t.replace(/^"([^"]+)"(?=\s*(?:[<>!=:]))/,(s,l)=>l));if(a){let s=kT(e,a[1]);return s.length?s.some(l=>Md(l,a[2],a[3])):!1}return t.includes("|")?t.split("|").some(s=>s.trim()&&v_(e,s.trim(),r)):$T(e,t)}function $T(e,t){let r=t.toLowerCase();return Object.values(e.cells).some(o=>o!=null&&String(o).toLowerCase().includes(r))}function ST(e,t,r={}){let o=t.trim();if(!o)return!0;let n=Object.fromEntries(Object.entries(r).map(([i,a])=>[i.toLowerCase(),a]));return Cd(o).every(i=>{let a=i.startsWith("-")||i.startsWith("!"),s=a?i.slice(1):i;if(!s)return v_(e,i,n);let l=v_(e,s,n);return a?!l:l})}function RT(e){return Object.keys(e).sort()}var IT={offline:e=>e.cells.binding_state!=null&&e.cells.binding_state!=="linked",rate_mismatch:e=>{let t=Number(e.cells.source_fps_n),r=Number(e.cells.timeline_fps);return e.cells.source_fps_n!=null&&t>0&&r>0&&Math.abs(t-r)>.001},stabilized:e=>/stabiliz/i.test(String(e.cells.effect_names??"")),effects:e=>!!e.cells.effect_names,retimed:e=>e.cells.speed_ramped===!0||e.cells.speed_reverse===!0||e.cells.speed!=null&&Math.abs(Number(e.cells.speed)-100)>1e-6,nested:e=>e.cells.kind==="nested"||e.cells.is_nested===!0,multicam:e=>e.cells.is_multicam===!0},TT={unused:e=>Number(e.cells.usage??0)===0,offline:e=>e.cells.binding_state!=="linked",linked:e=>e.cells.binding_state==="linked"};function PT(e){let t=new Map;for(let r of e?.timelines??[])for(let o of r?.tracks??[])for(let n of o?.items??[]){let i=n?.media_reference_id;!i||n.kind==="gap"||t.set(i,(t.get(i)??0)+1)}return t}function sL(e){return(typeof e.display_name=="string"?e.display_name:"")||e.target_url&&e.target_url.split(/[\\/]/).pop()||e.id}function AT(e,t={}){let r=PT(e),o=t.idPrefix??"mr:";return(e?.media_references??[]).flatMap(n=>{let i=sL(n);return t.skip?.(i)?[]:[{id:`${o}${n.id}`,name:i,ref:n,origin:"from timeline",extra:{usage:r.get(n.id)??0}}]})}function ET(e,t){let r=e.map(o=>({header:Od(o),value:n=>{let i=n.cells[o];return i==null?"":typeof i=="boolean"?i?"true":"false":i}}));return Xu(r,[...t])}function OT(e,t,r=new Date){let o=r.toISOString().slice(0,16).replace(/[-:T]/g,""),n=i=>i.replace(/[^a-zA-Z0-9_-]/g,"_");return`${o}_${n(e)}_${n(t)}.csv`}var MT=["clips","media","markers"],lL={clips:["#","timeline","track","name","timeline_range.start","timeline_range.dur","rec_in_tc","rec_out_tc","source_range.start","reel_name","speed","binding_state"],media:["name","binding_state","usage","codec","source_resolution_w","source_resolution_h","source_fps","source_timecode","target_url"],markers:["timeline","tc","color","name","note","duration","clip"]},w_=`Terms are separated by spaces and ALL must match; a leading - negates a term. text = in any column; field:text = in that column (field:/regex/, field:"two words", field:a|b; a field name with a space is quoted: "Frame rate":!=24); numbers: ${vT} (e.g. speed!=100, crop:1..2, track:in V5,V6 \u2014 whole-cell membership); field: alone = has a value; clips: overlaps:A..B = clips whose RECORD range touches A..B inclusive (record TC like 01:00:10:00, or timeline frames; overlaps:A alone = clips under that frame) \u2014 unlike timeline_range.start:A..B, which only asks where a clip starts. is:<lens> = a named question (clips: is:offline, is:visible = the topmost enabled picture somewhere, what actually plays, is:rate_mismatch, is:stabilized, is:effects, is:retimed, is:nested, is:multicam; media: is:unused, is:offline, is:linked; markers: is:<colour>, is:duration). An unknown field or lens matches nothing.`,cL=/^([-!]?)overlaps?:(.+)$/i;function uL(e){let t=[];return{rest:Cd(e).filter(o=>{let n=cL.exec(o);if(!n)return!0;let[i,a=i]=n[2].split(/\.\.\.?|-(?=\d)/);return t.push(s=>{if(!s.item||!s.tl)return!1;let l=Ze(s.tl),c=ce(s.tl.start_frame??0,l,!!s.tl.is_drop_frame),u,d;try{u=$n(i,l,c),d=$n(a,l,c)}catch{return!1}u>d&&([u,d]=[d,u]);let f=s.item.timeline_range.start.value,m=f+s.item.timeline_range.duration.value,p=f<=d&&m>u;return n[1]?!p:p}),!1}).join(" "),tests:t}}function dL(e){let t=i=>[i.timeline_range.start.value,i.timeline_range.start.value+i.timeline_range.duration.value],r=(e.tracks??[]).filter(i=>i.kind==="Video"&&i.enabled!==!1).sort((i,a)=>a.track_index-i.track_index).map(i=>i.items.filter(a=>a.enabled!==!1&&(a.kind==="clip"||a.kind==="nested")&&!a.title)),o=[...new Set(r.flat().flatMap(i=>t(i)))].sort((i,a)=>i-a),n=new Set;for(let i=0;i+1<o.length;i++){let a=o[i];for(let s of r){let l=s.find(c=>t(c)[0]<=a&&a<t(c)[1]);if(l){n.add(l.id);break}}}return n}var mL=/^([-!]?)is:visible$/i;function fL(e){let t=new Map,r=[];return{rest:Cd(e).filter(n=>{let i=mL.exec(n);return i?(r.push(a=>{if(!a.tl)return!1;t.has(a.tl)||t.set(a.tl,dL(a.tl));let s=t.get(a.tl).has(a.id);return i[1]?!s:s}),!1):!0}).join(" "),tests:r}}function pL(e,t,r){let o=e,n=Oi(o).filter(a=>!r||a.id===r);if(r&&!n.length){let a=Oi(o).map(s=>`${s.id} "${s.name}"`).join(", ");throw new P("not_found",`no timeline ${r} in this session (timelines: ${a||"none"})`)}if(t==="clips"){let a=new Set(n.map(d=>d.id)),s=new Map;for(let d of e.timelines){if(!a.has(d.id))continue;let f=Ze(d),m=p=>ce(p+(d.start_frame??0),f,!!d.is_drop_frame);for(let p of d.tracks??[])for(let g of p.items??[]){let _=g.timeline_range.start.value,v=_+g.timeline_range.duration.value,y=Yt({...p,name:null},d.tracks??[]);s.set(g.id,{tl:d,cells:{track_no:y,track_name:p.name??null,track_enabled:p.enabled!==!1,rec_in_tc:m(_),rec_out_tc:m(v)}})}}let l=gT(o),c=l.rows.filter(d=>s.has(d.id)).map(d=>({...d,tl:s.get(d.id).tl,cells:{...d.cells,...s.get(d.id).cells}})),u=[...l.columns];return u.splice(u.indexOf("track")+1,0,"track_no","track_name","track_enabled"),u.splice(u.indexOf("timeline_range.dur")+1,0,"rec_in_tc","rec_out_tc"),{rows:c,columns:u,lenses:IT}}if(t==="media"){let a=bT(AT(o));return{rows:a.rows,columns:a.columns,lenses:TT}}return{rows:n.flatMap(a=>nR(a,o).map(s=>({...s,id:`${a.id}:${s.id}`,cells:{timeline:a.name,...s.cells}}))),columns:["timeline","tc","frame","color","name","note","duration","frames","clip","item_id"],lenses:rR}}function hL(e,t,r){if(!e?.length)return lL[t].filter(a=>r.includes(a));let o=a=>a.toLowerCase().replace(/[^a-z0-9]/g,""),n=[],i=[];for(let a of e){let s=r.find(l=>l===a)??r.find(l=>o(l)===o(a)||o(Od(l))===o(a));s?n.push(s):i.push(a)}if(i.length)throw new P("invalid_args",`unknown column${i.length>1?"s":""} ${i.join(", ")} for ${t} (columns: ${r.slice(0,60).join(", ")}${r.length>60?", \u2026":""})`,{available:r});return n}function CT(e,t){let{rows:r,columns:o,lenses:n}=pL(e,t.table,t.timeline_id),i=hL(t.columns,t.table,o),a=fL(t.query?.trim()??""),{rest:s,tests:l}=uL(a.rest),c=[...a.tests,...l],u=r.filter(f=>c.every(m=>m(f))&&(!s||ST(f,s,n))),d={table:t.table,columns:i,available:o,lenses:RT(n),total:r.length,matched:u.length,fps:(()=>{let f=Oi(e).find(m=>!t.timeline_id||m.id===t.timeline_id);return f?Ze(f):void 0})(),rows:u.map(f=>({id:f.id,cells:Object.fromEntries(i.map(m=>[m,f.cells[m]??null]))}))};return t.csv&&(d.csv=t.table==="markers"&&!t.columns?.length?oR(u):ET(i,u)),d}async function DT(e,t,r){let o=e.table==="clips"?"Edit_Index":e.table==="media"?"Media":"Markers",n=await ar(t)?M(t,OT(r,o)):t;return await ge(n,e.csv??""),n}function jT(e,t,r){let o=`${e.table}: ${e.matched} of ${e.total} row${e.total===1?"":"s"}${t?` match "${t}"`:""}`;if(!e.matched)return`${o}
|
|
126
|
+
lenses: ${e.lenses.map(d=>`is:${d}`).join(" ")||"(none)"}
|
|
127
|
+
columns: ${e.available.slice(0,40).join(", ")}${e.available.length>40?", \u2026":""}
|
|
128
|
+
grammar: ${w_}
|
|
129
|
+
field queries: ${_T}`;let n=e.rows.slice(0,r),i=d=>(d==null?"":String(d)).replace(/\s+/g," ").slice(0,60),a=e.columns.map(d=>Math.min(60,Math.max(d.length,...n.map(f=>i(f.cells[d]).length)))),s=d=>d.map((f,m)=>f.padEnd(a[m])).join(" ").trimEnd(),l=[s(e.columns),...n.map(d=>s(e.columns.map(f=>i(d.cells[f]))))],c=e.matched>n.length?`TRUNCATED: showing ${n.length} of ${e.matched} matching rows \u2014 NOT the full list. Pass limit=${Math.min(e.matched,5e3)}, narrow the query, or out_path for the full CSV.
|
|
130
|
+
`:"",u=c?`
|
|
131
|
+
\u2026 ${e.matched-n.length} more not shown (see TRUNCATED above)`:"";return`${c}${o}
|
|
132
|
+
${l.join(`
|
|
133
|
+
`)}${u}`}var gL=/^0[1-4]_[A-Z_]+\//;function $_(e,t){let r=k_(e.target_url);if(!r)return"";let o=e.role==="reference"?"03_REFERENCES":"02_MEDIA";if(t&&e.target_url){let n=yL(e.target_url),i=n?n.replace(gL,""):r;return`${o}/${i}`}return`${o}/${r}`}function x_(e,t,r){return{entries:bL(e,t,r).entries.map(i=>{if(i.inlineBytes)return{path:i.path,bytes:i.inlineBytes};if(i.sourceBasename)return{path:i.path,sourceBasename:i.sourceBasename};throw new Error(`folder-layout entry missing both inlineBytes and sourceBasename: ${i.path}`)})}}function bL(e,t,r){let o=[],n=new Map,i=new Set;for(let l of r.sourceFiles??[]){let c=qi(`01_PROJECT_FILES/source/${l.name}`,i);o.push({path:c,section:"project-source",inlineBytes:l.data})}let a=new Set,s=(e.media_references??[]).filter(l=>{if(!l.target_url)return!1;let c=k_(l.target_url);if(!(c.length>0&&t.has(c)))return!1;let u=`${c.toLowerCase()}\0${l.role??""}`;return a.has(u)?!1:(a.add(u),!0)});for(let l of s){let c=k_(l.target_url);if(l.bundle&&l.bundle.files.length>0){for(let d of l.bundle.files){if(!t.has(d.basename))continue;let f=qi(`02_MEDIA/${d.rel_path}`,i);o.push({path:f,section:"media",sourceBasename:d.basename}),n.set(d.basename,f)}continue}let u=qi($_(l,r.preserveStructure===!0),i);o.push({path:u,section:l.role==="reference"?"reference":"media",sourceBasename:c}),l.role!=="reference"&&n.set(c,u)}for(let l of r.exchangeFiles??[]){let c=l.text?NT(l.bytes,n,r.volumeName):l.bytes,u=qi(`01_PROJECT_FILES/converted/${l.filename}`,i);o.push({path:u,section:"project-converted",inlineBytes:c})}if(r.timelineFile){let l=r.timelineFile,c=NT(l.bytes,n,r.volumeName);if(l.isConversion){let u=qi(`01_PROJECT_FILES/converted/${l.filename}`,i);o.push({path:u,section:"project-converted",inlineBytes:c})}else{let u=l.filename.includes(".")?l.filename.slice(l.filename.lastIndexOf(".")):"",f=`${l.filename.includes(".")?l.filename.slice(0,l.filename.lastIndexOf(".")):l.filename}_relinked${u}`,m=qi(`01_PROJECT_FILES/source/${f}`,i);o.push({path:m,section:"project-source",inlineBytes:c})}}return{entries:o,basenameToIsoPath:n}}function NT(e,t,r){let o;try{o=new TextDecoder("utf-8",{fatal:!1}).decode(e)}catch{return e}for(let[n,i]of t){let a=`/Volumes/${r}/${i}`,s=_L(n);o=o.replace(new RegExp(`(<pathurl>)[^<]*${s}(</pathurl>)`,"g"),`$1file://localhost${a}$2`).replace(new RegExp(`("target_url"\\s*:\\s*")[^"]*${s}"`,"g"),`$1${a}"`).replace(new RegExp(`(src="file://)[^"]*${s}"`,"g"),`$1localhost${a}"`)}return new TextEncoder().encode(o)}function k_(e){return e?e.split(/[/\\]/).pop()??"":""}function yL(e){if(e)try{return decodeURIComponent(e.replace(/^file:\/\//,"").replace(/^\//,"").replace(/^Volumes\//,""))||void 0}catch{return}}function qi(e,t){if(!t.has(e))return t.add(e),e;let r=e.lastIndexOf("."),o=r>0?e.slice(0,r):e,n=r>0?e.slice(r):"",i=2,a=`${o}_${i}${n}`;for(;t.has(a);)i++,a=`${o}_${i}${n}`;return t.add(a),a}function _L(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function FT(e){return e0(e)}function LT(e,t){let r=Math.max(0,Math.floor(e.handles??0)),o=e.frame_in-r,n=e.frame_out+r,i=Math.max(0,o),a=t!==void 0?Math.min(t,n):n;return{frame_in:i,frame_out:a,handles_applied_in:e.frame_in-i,handles_applied_out:a-e.frame_out,handles_requested:r}}function wo(e,t){if(t.format==="iso")return wL(e,t);if(t.format==="folder")return vL(e,t);throw new Error(`deriveLayout: unsupported format "${t.format}"`)}function vL(e,t){let r=zT(e),o=[],n=new Set,i=new Set,a=0;for(let s of r){let l=S_(s);if(!l)continue;i.add(l);let c=kL(s,l,t);n.add(c);let u=UT(s.id??l,t),d=BT(e,s,u,t.handles??0);o.push({dest_file:c,dest_offset:0,length:d,source:{kind:"file",basename:l,offset:0}}),a+=d}return{regions:o,total_bytes:a,dest_files:Array.from(n),source_basenames:Array.from(i)}}function wL(e,t){if(!t.volume_name)throw new Error("deriveLayout(iso): intent.volume_name is required");let r=zT(e),o=`${t.volume_name}.iso`,n=[],i=new Set,a=0;for(let s of r){let l=S_(s);if(!l)continue;i.add(l);let c=UT(s.id??l,t),u=BT(e,s,c,t.handles??0);n.push({dest_file:o,dest_offset:a,length:u,source:{kind:"file",basename:l,offset:0}}),a+=u}return{regions:n,total_bytes:a,dest_files:[o],source_basenames:Array.from(i)}}function zT(e){let t=e.media_references;return Array.isArray(t)?t.filter(r=>r.carry_whole===!0||!(r.binding_state&&r.binding_state!=="linked")):[]}function S_(e){if(!e.target_url)return null;let t=e.target_url.split(/[\\/]/).pop();return t&&t.length>0?t:null}function kL(e,t,r){let o=r.per_file_overrides?.[e.id]?.rel_path;if(o)return o;switch(r.folder_layout??"flat"){case"flat":return t;case"by-camera":{let n=e.reel_name;return n?`${n}/${t}`:t}case"media-organized":{let n=$L(e);return n?`${n}/${t}`:t}case"canonical-i2o":return $_(e,!1)}}function $L(e){if(Sw(e))return"Stills";switch(e.content_kind){case"still":return"Stills";case"audio":return"Audio";case"video":case"video_audio":return"Footage";case"compound":return"Compounds";default:return null}}function UT(e,t){return t.per_file_overrides?.[e]?.mode??t.per_file_mode}function BT(e,t,r,o){let n=t.size_bytes??0;if(n===0)return 0;let i=S_(t);if(!i||!FT(i)||r.mode==="sparse"&&r.populate.full===!0)return n;let a=t.available_range?.duration?.value??0;if(a<=0)return n;let s=xL(e,t.id);if(s.length===0)return n;let l=s.map(f=>{let m=LT({frame_in:f.start,frame_out:f.end,handles:o},a);return{start:m.frame_in,end:m.frame_out}});l.sort((f,m)=>f.start-m.start);let c=[{...l[0]}];for(let f=1;f<l.length;f++){let m=l[f],p=c[c.length-1];m.start<=p.end?p.end=Math.max(p.end,m.end):c.push({...m})}let u=0;for(let f of c){let m=Math.max(0,f.start),p=Math.min(a,f.end);p>m&&(u+=p-m)}let d=Math.min(1,u/a);return Math.round(d*n)}function xL(e,t){let r=[],o=e?.timelines??[];for(let n of o)for(let i of n.tracks??[])for(let a of i.items??[]){if(a.media_reference_id!==t||!a.source_range)continue;let s=a.source_range.start.value,l=a.source_range.duration.value;l>0&&r.push({start:s,end:s+l})}return r}function VT(e,t){let r=SL(e),o=r>=0?e.slice(0,r+1):"",n=r>=0?e.slice(r+1):e,i=n.lastIndexOf(".");return i<=0?o+n+t:o+n.slice(0,i)+t+n.slice(i)}function SL(e){let t=e.lastIndexOf("/"),r=e.lastIndexOf("\\");return t>r?t:r}async function ZT(e){try{return await e()}catch(t){let r=t0(t);throw r?new n0(r):t}}async function Dd(e){let t=Qw(e);if(!t||!t.trimSupported)return null;let r=t.flavor,o=n=>xl(r,[r0(e,n)]);return{byteSourceFromFile:RL,async prepareWrite(n,i,a){let l=(await ZT(()=>Nr(o(n),{verb:"sparsify",selection:{items:i,handles:a}})))[0];return{fileSize:l.fileSize,structuralRanges:l.structuralRanges,essenceRanges:l.essenceRanges,trimInputs:l.trimInputs??[],wholeFileFallback:l.wholeFileFallback}},async planTrim(n,i,a){let s=await ZT(()=>Nr(o(n),{verb:"trim",selection:{items:i,handles:a}}));if(r==="r3d")throw new Error(`planTrim(${e}): R3D must route through the R3D compact pass (r3d-trim-pass.ts), not the per-file path`);return s}}}async function RL(e){return{fileSize:e.size,async read(t,r){let o=Math.min(t+r,e.size),n=e.slice(t,o);return new Uint8Array(await n.arrayBuffer())}}}function IL(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}async function Ys(e,t="i2o",r,o,n=ua){await xm();let i;try{i=nw(JSON.stringify(e),t,o?JSON.stringify(o):"",n)}catch(s){let l="";try{l=rw()}catch{}throw l?new Error(`udf_build_layout failed: ${l} (raw: ${s instanceof Error?s.message:String(s)})`):s instanceof Error?s:new Error(`udf_build_layout failed: ${String(s)}`)}let a=JSON.parse(i);return{totalBytes:a.totalBytes,totalSectors:a.totalSectors,structuralRegions:a.structuralRegions.map(s=>({sectorStart:s.sectorStart,sectorCount:s.sectorCount,data:IL(s.dataB64)})),fileDataRegions:a.fileDataRegions}}async function HT(e){await xm();let t=32*2048,r=16*2048,o;if(e instanceof Uint8Array){if(e.length<t+r)return null;o=e.subarray(t,t+r)}else{if(e.size<t+r)return null;o=new Uint8Array(await e.slice(t,t+r).arrayBuffer())}let n=ow(o);if(!n)return null;try{return JSON.parse(n)}catch{return null}}function TL(e){return e.speed!=null&&e.speed!==100||e.speed_reverse||e.speed_ramped?!0:(e.keyframes??[]).some(t=>t.parameter_path==="speed")}function PL(e,t){let r=e.timelines??[];if(t)return r.filter(i=>i.name===t);let o=new Set;for(let i of r)for(let a of i.tracks??[])for(let s of a.items??[])s.nested_timeline_id&&o.add(s.nested_timeline_id);let n=r.filter(i=>!o.has(i.id));return n.length?n:r}function AL(e,t,r){let o=new Map((e.timelines??[]).map(i=>[i.id,i])),n=(i,a,s,l)=>{if(!(!i||s>8))for(let c of i.tracks??[])for(let u of c.items??[]){let d=s===0?u:l??u,f=Math.round(u.timeline_range?.start?.value??0),m=f+Math.round(u.timeline_range?.duration?.value??0),p=a?a.map(([_,v])=>[Math.max(f,_),Math.min(m,v)]).filter(([_,v])=>v>_):[[f,m]];if(p.length===0)continue;let g=TL(u);if(u.nested_timeline_id){let _=o.get(u.nested_timeline_id),v=Math.round(u.source_range?.start?.value??0),y=(i.fps_num??0)/Math.max(i.fps_den??1,1),b=_?(_.fps_num??0)/Math.max(_.fps_den??1,1):y,w=y>0&&b>0?b/y:1,k=p.map(([I,x])=>[Math.floor((v+(I-f))*w),Math.floor((v+(x-f))*w)]);n(_,k,s+1,d)}else if(u.media_reference_id){let _=Math.round(u.source_range?.start?.value??0),v=Math.round(u.source_range?.duration?.value??0);if(g){r({item:u,root:d,tl_id:i.id,depth:s,has_speed:!0,tl_in:f,src_in:_,a:f,b:f+v,reached_in:_,reached_out:_+v});continue}for(let[y,b]of p)r({item:u,root:d,tl_id:i.id,depth:s,has_speed:!1,tl_in:f,src_in:_,a:y,b,reached_in:_+(y-f),reached_out:_+(b-f)})}}};for(let i of PL(e,t.rootTimelineName))n(i,null,0,null)}function WT(e,t={}){let r=new Map;return AL(e,t,o=>{let n=o.item.media_reference_id,i={clip_src_in:o.src_in,reached_in:o.reached_in,reached_out:o.reached_out,has_speed:o.has_speed},a=r.get(n);a?a.push(i):r.set(n,[i])}),r}var On=2048;function jd(e,t,r){console.error(`[planIsoRegions] DROPPING "${t}" \u2014 ${r}. NOT shipping it whole: that would deliver the entire file to carry a few seconds of it.`),e.push({basename:t,reason:r})}async function JT(e){if(e.perFile.mode==="trim")throw new Error("planIsoRegions: ISO + trim is not supported. Use folder collection for compact trim output, or ISO sparse-segments for the canonical cloud / P2P shape (recipient can derive folder-of-trims at download time per project_upload_once_choose_at_download).");let t=e.perFile.populate,{ranges:r,dropped:o}=await EL(e),n=[],i=[];for(let v of e.entries){if("bytes"in v){n.push({path:v.path,totalSize:v.bytes.length,keptRanges:[{offset:0,length:v.bytes.length}],inlineBytes:v.bytes});continue}let y=e.files.get(v.sourceBasename);if(!y)continue;let b=()=>({path:v.path,sourceBasename:v.sourceBasename,totalSize:y.size,keptRanges:[{offset:0,length:y.size}],file:y}),w=await Dd(v.sourceBasename);if(!w||t.full){n.push(b());continue}if(ln(v.sourceBasename)){if(o.has(v.sourceBasename)){jd(i,v.sourceBasename,"delivery coverage miss (cut outside the clip's real frames)");continue}let R=r.get(v.sourceBasename);if(R&&(R.structuralRanges.length>0||R.essenceRanges.length>0)){let $=[...R.structuralRanges];t.segments&&$.push(...R.essenceRanges),n.push({path:v.path,sourceBasename:v.sourceBasename,totalSize:y.size,keptRanges:$,prep:{fileSize:y.size,structuralRanges:R.structuralRanges,essenceRanges:R.essenceRanges,trimInputs:[]},file:y})}else jd(i,v.sourceBasename,"R3D part has no planned sparse ranges");continue}let k=qT(e.session,v.sourceBasename),I=await w.byteSourceFromFile(y),x;try{x=await w.prepareWrite(I,k,e.handles)}catch(R){let $=jr(R);if($){console.warn(`[planIsoRegions] coverage miss detail for "${v.sourceBasename}":`,$),jd(i,v.sourceBasename,"delivery coverage miss (cut outside the clip's real frames)");continue}jd(i,v.sourceBasename,R instanceof Error?R.message:String(R));continue}let S=[...x.structuralRanges];t.segments&&S.push(...x.essenceRanges),n.push({path:v.path,sourceBasename:v.sourceBasename,totalSize:y.size,keptRanges:S,prep:x,source:I,file:y})}let a=n.map(v=>{let y=v.prep?OL(v.keptRanges,v.totalSize):void 0,b=e.pinSectorByPath?.get(v.path);return{name:v.path,totalSize:v.totalSize,...y?{dataExtents:y}:{},...b!==void 0?{fixedPartSector:b}:{}}}),s=await Ys(a,e.volumeName,{},e.iuvd,e.buildTimestamp),l=new Map;for(let v of s.fileDataRegions)l.has(v.name)||l.set(v.name,{byteOffset:v.sectorStart*On,partSector:v.sectorStart-257});let c=`${e.volumeName}.iso`,u=[],d=new Set;for(let v of s.structuralRegions)v.data.length!==0&&u.push({dest_file:c,dest_offset:v.sectorStart*On,length:v.data.length,source:{kind:"inline",bytes:v.data}});let f=new Map;for(let v of n)f.set(v.path,v);let m=new Map,p=new Map;for(let v of s.fileDataRegions){let y=f.get(v.name);if(!y)continue;let b=!!y.file&&!y.inlineBytes&&(!y.prep||y.prep.wholeFileFallback===!0);if(p.has(y.path)||p.set(y.path,b),y.inlineBytes){let x=y.inlineBytes.subarray(v.sourceOffset,v.sourceOffset+v.sourceLength);u.push({dest_file:c,dest_offset:v.sectorStart*On,length:x.length,source:{kind:"inline",bytes:x}}),m.set(y.path,(m.get(y.path)??0)+x.length);continue}if(!y.file){p.set(y.path,!0);continue}if(!y.prep){d.add(y.sourceBasename??y.file.name),u.push({dest_file:c,dest_offset:v.sectorStart*On,length:v.sourceLength,source:{kind:"file",basename:y.sourceBasename??y.file.name,offset:v.sourceOffset}}),m.set(y.path,(m.get(y.path)??0)+v.sourceLength);continue}let w=y.sourceBasename??y.file.name;d.add(w);let k=v.sourceOffset,I=v.sourceOffset+v.sourceLength;for(let x of y.keptRanges){let S=Math.max(x.offset,k),R=Math.min(x.offset+x.length,I);if(R<=S)continue;let $=R-S;u.push({dest_file:c,dest_offset:v.sectorStart*On+(S-k),length:$,source:{kind:"file",basename:w,offset:S}}),m.set(y.path,(m.get(y.path)??0)+$)}}u.sort((v,y)=>v.dest_offset-y.dest_offset);let g=n.map(v=>({path:v.path,bytesWritten:m.get(v.path)??0,fellBack:p.get(v.path)??!1})),_=0;for(let v of u)_+=v.length;return{layout:{regions:u,total_bytes:_,dest_files:[c],source_basenames:Array.from(d),image_total_bytes:s.totalBytes,file_extents:n.map(v=>{let y=s.fileDataRegions.filter(w=>w.name===v.path).map(w=>({at:w.sectorStart*On,from:w.sourceOffset,len:w.sourceLength})),b=u.filter(w=>w.source.kind!=="zero"&&y.some(k=>w.dest_offset>=k.at&&w.dest_offset<k.at+k.len)).map(w=>({at:w.dest_offset,len:w.length}));return{path:v.path,size:v.totalSize,extents:y,data:b}})},isoPositions:l,totalBytes:s.totalBytes,perFileSummary:g,untrimmable:i}}async function KT(e,t,r,o={}){let{layout:n,totalBytes:i}=e;if(n.dest_files.length!==1)throw new Error(`executeIsoPlan: expected single dest_file, got ${n.dest_files.length}`);let a=0;for(let l of n.regions)l.source.kind!=="zero"&&(a+=l.length);await r.reserveSize(i);let s=0;try{for(let l of n.regions){if(o.signal?.aborted)throw new DOMException("Aborted","AbortError");if(l.length!==0){switch(l.source.kind){case"inline":{await r.writeAt(l.dest_offset,l.source.bytes),s+=l.source.bytes.length;break}case"file":{let c=t.get(l.source.basename);if(!c)throw new Error(`executeIsoPlan: file not in files map: "${l.source.basename}"`);let u=16*1024*1024,d=0;for(;d<l.length;){let f=Math.min(u,l.length-d),m=c.slice(l.source.offset+d,l.source.offset+d+f),p=new Uint8Array(await m.arrayBuffer());await r.writeAt(l.dest_offset+d,p),d+=f,s+=f,o.onProgress?.({bytesWritten:s,totalBytes:a,currentFile:l.source.basename})}continue}case"zero":break;case"pack":throw new Error("executeIsoPlan: `pack` regions require the CAS executor, not a local-file build")}o.onProgress?.({bytesWritten:s,totalBytes:a})}}await r.close()}catch(l){throw await r.abort?.(l),l}return{bytesWritten:s}}async function EL(e){let t=new Map,r=new Set,o=e.session.media_references??[],n=[],i=new Set;for(let l of o){if(l.bundle?.kind!=="rdc")continue;let c=l.bundle,u=c.files.filter(f=>f.role==="anchor"||f.role==="part").slice().sort((f,m)=>(f.part_number??0)-(m.part_number??0)).map(f=>({filename:f.basename,file:e.files.get(f.basename)})).filter(f=>!!f.file);if(u.length===0)continue;let d=(l.target_url??"").split(/[/\\]/).pop()||u[0].filename;n.push({label:c.folder,anchorBasename:d,parts:u});for(let f of u)i.add(f.filename)}for(let l of o){if(l.bundle?.kind==="rdc")continue;let c=(l.target_url??"").split(/[/\\]/).pop()??"";if(!ln(c)||i.has(c))continue;let u=i0(c,e.files.keys()).map(d=>({filename:d,file:e.files.get(d)})).filter(d=>!!d.file);if(u.length!==0){n.push({label:c,anchorBasename:c,parts:u});for(let d of u)i.add(d.filename)}}if(n.length===0)return{ranges:t,dropped:r};let{mediaOp:a}=await import("./ops-FSOOBXMV.js"),{sourceFromFiles:s}=await import("./source-BDJAUQVR.js");for(let l of n){let{label:c,anchorBasename:u,parts:d}=l,f=qT(e.session,u);try{let m=s(d.map(g=>g.file)),p=await a(m,{verb:"sparsify",selection:{items:f,handles:e.handles}});for(let g of p)t.set(g.filename,{structuralRanges:g.structuralRanges,essenceRanges:g.essenceRanges})}catch(m){let p=jr(m);if(p){for(let g of d)r.add(g.filename);console.warn(`[planIsoRegions] DROPPING R3D clip "${c}" fail-closed \u2014 delivery coverage miss; NOT whole-filing:`,p);continue}console.warn(`[planIsoRegions] R3D spanned prep failed for "${c}":`,m)}}return{ranges:t,dropped:r}}function qT(e,t){let r=new Set,o=t.toLowerCase();for(let u of e.media_references??[]){if(!u.target_url)continue;(u.target_url.split(/[/\\]/).pop()??"").toLowerCase()===o&&r.add(u.id)}let n=[],i=!1;for(let u of e.timelines??[])for(let d of u.tracks??[])for(let f of d.items??[])f.media_reference_id&&r.has(f.media_reference_id)&&n.push(f),f.nested_timeline_id&&(i=!0);if(!i||n.length===0)return n;let a=WT(e),s=[...r].flatMap(u=>a.get(u)??[]);if(s.length===0)return n;let l=n[0],c=l.source_range?.start?.rate??l.source_range?.duration?.rate??1;return s.map(u=>({...l,kind:"clip",source_range:{start:{value:u.reached_in,rate:c},duration:{value:u.reached_out-u.reached_in,rate:c}}}))}function OL(e,t){if(e.length===0)return e;let r=e.map(n=>{let i=Math.floor(n.offset/On)*On,a=Math.min(Math.ceil((n.offset+n.length)/On)*On,t);return{offset:i,length:Math.max(0,a-i)}}).filter(n=>n.length>0);r.sort((n,i)=>n.offset-i.offset);let o=[];for(let n of r){let i=o[o.length-1];i&&n.offset<=i.offset+i.length?i.length=Math.max(i.length,n.offset+n.length-i.offset):o.push({...n})}return o}async function Xi(e,t,r,o,n){if(o.format==="iso"){if(!n)throw new Error("refineLayoutForTrim(iso): isoOptions is required (entries, pinSectorByPath, iuvd come from buildI2oFolderLayout in the wizard).");if(!o.volume_name)throw new Error("refineLayoutForTrim(iso): intent.volume_name is required");let c=DL(o,r),u=await JT({session:r,files:t,handles:o.handles??0,perFile:c,volumeName:o.volume_name,entries:n.entries,pinSectorByPath:n.pinSectorByPath,iuvd:n.iuvd,buildTimestamp:n.buildTimestamp});return u.untrimmable.length>0?{...u.layout,untrimmable:u.untrimmable}:u.layout}if(o.per_file_mode.mode!=="trim")return e;let i=I_(r),a=T_(r),s=new Map;for(let c of e.regions){let u=s.get(c.dest_file);u?u.push(c):s.set(c.dest_file,[c])}let l=[];for(let[c,u]of s){let d=u.length===1?u[0]:null;if(!d||d.source.kind!=="file"){l.push(...u);continue}let f=d.source.basename,m=t.get(f);if(!m){l.push(d);continue}let p=a.get(f),g=p?i.get(p.id)??[]:[],_=await ML({destFile:c,basename:f,file:m,ref:p,items:g,handles:o.handles??0});_!=="coverage-miss"&&(_?l.push(..._):l.push({dest_file:c,dest_offset:0,length:m.size,source:{kind:"file",basename:f,offset:0}}))}return CL(l)}async function ML(e){if(e.items.length===0)return null;let t=await Dd(e.basename);if(!t||!t.planTrim)return null;let r;try{let n=await t.byteSourceFromFile(e.file);r=await t.planTrim(n,e.items,e.handles)}catch(n){let i=jr(n);return i?(console.warn(`[refineLayoutForTrim] DROPPING "${e.basename}" fail-closed \u2014 delivery coverage miss; NOT whole-filing:`,i),"coverage-miss"):null}if(r.length===0)return null;if(r.length===1)return Qs(r[0],e.destFile,e.basename);let o=Math.max(3,String(r.length).length);return r.flatMap((n,i)=>Qs(n,VT(e.destFile,`_S${String(i+1).padStart(o,"0")}`),e.basename))}function Qs(e,t,r){let o=[],n=e.dest_header_bytes_base64?R_(e.dest_header_bytes_base64):null;n&&n.length>0&&o.push({dest_file:t,dest_offset:0,length:n.length,source:{kind:"inline",bytes:n}});for(let i of e.src_byte_ranges)i.length<=0||o.push({dest_file:t,dest_offset:i.write_to_dest_offset,length:i.length,source:{kind:"file",basename:i.src_file_name??r,offset:i.offset}});if(e.dest_footer_bytes_base64&&e.dest_footer_offset!=null){let i=R_(e.dest_footer_bytes_base64);i.length>0&&o.push({dest_file:t,dest_offset:e.dest_footer_offset,length:i.length,source:{kind:"inline",bytes:i}})}if(e.dest_patches)for(let i of e.dest_patches){let a=R_(i.bytes_base64);a.length!==0&&o.push({dest_file:t,dest_offset:i.offset,length:a.length,source:{kind:"inline",bytes:a}})}return o.sort((i,a)=>i.dest_offset-a.dest_offset),o}function I_(e){let t=new Map,r=e?.timelines??[];for(let o of r)for(let n of o.tracks??[])for(let i of n.items??[]){if(!i?.media_reference_id)continue;let a=t.get(i.media_reference_id);a?a.push(i):t.set(i.media_reference_id,[i])}return t}function XT(e,t,r){let o=t?.source_timecode?qe(t.source_timecode,r):null;return o==null?e:e.map(n=>{let i=n?.raw_extraction;if(i?.sourceConformedToMedia)return n;let a=i?.alternateFrame;if(a==null||!n.source_range)return n;let s=a-o;return s===0?n:{...n,source_range:{...n.source_range,start:{...n.source_range.start,value:n.source_range.start.value+s}}}})}function T_(e){let t=new Map,r=e?.media_references??[];for(let o of r){if(!o.target_url)continue;let n=o.target_url.split(/[\\/]/).pop();n&&n.length>0&&t.set(n,o)}return t}function CL(e){let t=new Set,r=new Set,o=0;for(let n of e)t.add(n.dest_file),n.source.kind==="file"&&r.add(n.source.basename),o+=n.length;return{regions:e,total_bytes:o,dest_files:Array.from(t),source_basenames:Array.from(r)}}function R_(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function DL(e,t){return e.per_file_mode.mode==="trim"?{mode:"trim"}:{mode:"sparse",populate:{structural:!0,segments:e.per_file_mode.populate.segments,full:e.per_file_mode.populate.full}}}var Yi=class{constructor(t){this.opts=t}async execute(){let{layout:t,sink:r}=this.opts,o=t.total_bytes,n=jL(t.regions),i=Math.max(1,this.opts.concurrency??1),a=0,s=0,l=[],c,u=async(d,f)=>{this.opts.signal?.throwIfAborted(),f.sort((_,v)=>_.dest_offset-v.dest_offset);let m=NL(f),p=await r.openFile(d,m),g=0;try{for(let _ of f){this.opts.signal?.throwIfAborted(),c=d,this.opts.onProgress?.({bytesWritten:a,totalBytes:o,currentFile:c});let v=0,y=await this.writeRegion(_,p,b=>{s+=b-v,v=b,this.opts.onProgress?.({bytesWritten:s,totalBytes:o,currentFile:c})});g+=y,a+=y}await p.close()}catch(_){throw await p.abort?.(_),_}return{path:d,bytesWritten:g}};if(i===1)for(let[d,f]of n)l.push(await u(d,f));else{let d=Array.from(n.entries()),f=0,m=[];for(let p=0;p<Math.min(i,d.length);p++)m.push((async()=>{for(;f<d.length;){let g=f++;if(g>=d.length)break;let[_,v]=d[g],y=await u(_,v);l.push(y)}})());await Promise.all(m)}return await r.closeCollection(),this.opts.onProgress?.({bytesWritten:a,totalBytes:o}),{bytesWritten:a,perFile:l}}async writeRegion(t,r,o){if(t.length===0)return 0;switch(t.source.kind){case"inline":return await r.writeAt(t.dest_offset,t.source.bytes),o?.(t.source.bytes.length),t.source.bytes.length;case"file":{let n=this.opts.files.get(t.source.basename);if(!n)throw new Error(`LocalDirectoryExecutor: file not found in files map: "${t.source.basename}"`);let i=16*1024*1024,a=t.source.offset,s=0;for(;s<t.length;){let l=Math.min(i,t.length-s),c=n.slice(a+s,a+s+l),u=new Uint8Array(await c.arrayBuffer());await r.writeAt(t.dest_offset+s,u),s+=l,o?.(s)}return t.length}case"zero":return 0;case"pack":throw new Error("LocalDirectoryExecutor: `pack` regions require the CAS executor, not a local-file executor")}}};function jL(e){let t=new Map;for(let r of e){let o=t.get(r.dest_file);o?o.push(r):t.set(r.dest_file,[r])}return t}function NL(e){let t=0;for(let r of e){let o=r.dest_offset+r.length;o>t&&(t=o)}return t}var Nd=class{constructor(t){this.opts=t}async execute(){return KT({layout:this.opts.layout,totalBytes:this.opts.totalBytes},this.opts.files,this.opts.sink,{onProgress:this.opts.onProgress,signal:this.opts.signal})}};import{mkdir as FL,open as YT}from"node:fs/promises";import{dirname as LL,join as zL}from"node:path";function QT(e){let t=!1;return{async reserveSize(r){await e.truncate(r)},async writeAt(r,o){if(t)throw new Error("nodeFileStream: closed");let n=Buffer.from(o.buffer,o.byteOffset,o.byteLength);await e.write(n,0,o.byteLength,r)},async close(){t||(t=!0,await e.close())},async abort(r){if(!t){t=!0;try{await e.close()}catch{}}}}}async function eP(e){let t=await YT(e,"w");return QT(t)}function Fd(e){return{async openFile(t,r){let o=zL(e,t);await FL(LL(o),{recursive:!0});let n=await YT(o,"w"),i=QT(n);return await i.reserveSize(r),i},async closeCollection(){}}}async function A_(e){let t=P_(e),r=new TextEncoder().encode(t),o=await crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(o)).map(n=>n.toString(16).padStart(2,"0")).join("")}function P_(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(P_).join(",")}]`;let t=e;return`{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${P_(t[n])}`).join(",")}}`}var BL="i2o-2026-05-08",VL=1;function tP(e){let t=e?.created_at?Date.parse(e.created_at):NaN;return Number.isFinite(t)?t:ua}async function nP(e){let[t,r]=await Promise.all([A_(e.session),A_(e.layoutIntent)]);return{payload:{v:1,conform_tools_version:BL,session_sha256:t,delivery_intent_sha256:r,layout_fn_version:VL,written_at:e.writtenAt??new Date(ua).toISOString(),...e.sessionIdHint?{session_id_hint:e.sessionIdHint}:{}},session_sha256:t,delivery_intent_sha256:r}}function Ld(e){return e.map((t,r)=>({partNumber:t.output_part_number??r+1,clipNumber:t.output_clip_number,clipCount:t.output_clip_count,plan:t}))}function ZL(e,t,r,o=""){let n=lr(t),i=n?n.clipBase:t.replace(/\.R3D$/i,""),a=`${i}_${String(r).padStart(3,"0")}.R3D`,s=e.split("/");return s.pop(),s.length&&/\.rdc$/i.test(s[s.length-1])&&s.pop(),[...s,`${i}${o}.RDC`,a].join("/")}function GL(e){let t=e.clipCount??1;if(t<=1)return"";let r=Math.max(3,String(t).length);return`_S${String(e.clipNumber??1).padStart(r,"0")}`}function HL(e){let t=new Map;for(let r of e){let o=lr(r.basename),n=o?o.clipBase:r.basename,i=t.get(n);i?i.push(r):t.set(n,[r])}for(let r of t.values())r.sort((o,n)=>(lr(o.basename)?.partNumber??0)-(lr(n.basename)?.partNumber??0));return[...t.values()]}async function zd(e){let t=[],r=new Map,o=[],n=0;for(let i of HL(e.parts)){let a=i[0];if(new Set(i.map(l=>l.basename)).size!==i.length){let l=lr(a.basename),c=l?l.clipBase:a.basename.replace(/\.R3D$/i,""),u={reason:"duplicate .R3D part filenames in one send (same clip name in two .RDC folders \u2014 e.g. re-sending two _S### islands of one source); byte-identical routing would be ambiguous"};console.warn(`[r3d-trim-pass] DROPPING R3D clip "${c}" fail-closed:`,u.reason),o.push({clipBase:c,parts:i.map(d=>d.basename),reason:u});continue}let s;try{s=await e.planClip(i)}catch(l){let c=jr(l);if(!c)throw l;let u=lr(a.basename),d=u?u.clipBase:a.basename.replace(/\.R3D$/i,"");console.warn(`[r3d-trim-pass] DROPPING R3D clip "${d}" fail-closed \u2014 delivery coverage miss (cut not within the file's real frames); NOT whole-filing:`,c),o.push({clipBase:d,parts:i.map(f=>f.basename),reason:c});continue}for(let l of i)r.set(l.basename,l.file);for(let l of s){let c=ZL(a.destPathHint,a.basename,l.partNumber,GL(l));t.push(...Qs(l.plan,c,a.basename)),n+=l.plan.src_byte_ranges.reduce((u,d)=>u+d.length,0)}}return{regions:t,filesByBasename:r,bytes:n,dropped:o}}function rP(e){switch(e){case"trim":return{mode:"trim"};case"skeleton":return{mode:"sparse",populate:{structural:!0}};case"sparse":return{mode:"sparse",populate:{structural:!0,segments:!0}};case"full":return{mode:"sparse",populate:{structural:!0,full:!0}}}}var WL=2048,Ir=".conform",oP=`${Ir}/delivery.json`;function iP(e,t){let r=new Set;for(let i of e.timelines)for(let a of i.tracks)for(let s of a.items)s.media_reference_id&&r.add(s.media_reference_id);let o=(e.media_references??[]).filter(i=>r.has(i.id)).map(i=>{let{local_path:a,target_url:s,...l}=i;return{...l,target_url:s&&s.split(/[\\/]/).pop()}}),n={v:1,timelines:e.timelines,media_references:o,handles:t};return new TextEncoder().encode(JSON.stringify(n))}var Ud=class{constructor(t,r,o,n){this.img=t;this.info=r;this.f=o;this.name=n;this.size=o.totalSize}slice(t=0,r=this.size){let o=Math.max(0,Math.min(t,this.size)),n=Math.max(o,Math.min(r,this.size)),{img:i,info:a,f:s}=this;return{size:n-o,async arrayBuffer(){let l=new Uint8Array(n-o);for(let c of Ln(s)){let u=Math.max(o,c.offset),d=Math.min(n,c.offset+c.length);d>u&&l.set(await i.read((a.partitionStartSector+c.imageSector)*WL+(u-c.offset),d-u),u-o)}return l.buffer}}}async arrayBuffer(){return this.slice().arrayBuffer()}dataRanges(){return Ln(this.f).map(({offset:t,length:r})=>({offset:t,length:r}))}},ko=e=>e.split("/").pop()||e,E_=e=>e.startsWith("02_MEDIA/")||e.startsWith("03_PROXIES/");async function O_(e){let t=await Fn(e);return{image:e.size(),recipes:t.files.filter(r=>r.name.startsWith(`${Ir}/`)).length,files:t.files.filter(r=>!r.name.startsWith(`${Ir}/`)&&r.name!==".i2o-manifest.json").map(r=>({name:r.name,size:r.totalSize,recorded:Ln(r).reduce((o,n)=>o+n.length,0)}))}}async function aP(e,t){let r=t.files.filter(a=>a.name.startsWith(`${Ir}/delivery`)&&a.name.endsWith(".json"));if(!r.length)return null;let o=[],n=new Map,i=0;for(let a of r){let s=JSON.parse(new TextDecoder().decode(await new Ud(e,t,a,a.name).arrayBuffer()));o.push(...s.timelines);for(let l of s.media_references)l.id&&n.set(l.id,l);i=Math.max(i,s.handles??0)}return{session:{timelines:o,media_references:[...n.values()]},handles:i}}async function sP(e,t){let r=await aP(e,t);return r?{timelines:r.session.timelines,media:r.session.media_references??[],handles:r.handles}:{timelines:[],media:[],handles:0}}async function M_(e,t,r={}){let o=await Fn(e),n=y=>!r.only?.length||r.only.some(b=>y.includes(b)),i=await aP(e,o),a=new Map,s=new Map,l=[];for(let y of o.files){if(y.name.startsWith(`${Ir}/`)||y.name===".i2o-manifest.json"||!n(y.name))continue;let b=new Ud(e,o,y,ko(y.name));E_(y.name)&&ln(ko(y.name))?l.push({udfPath:y.name,basename:ko(y.name),file:b}):E_(y.name)&&i?a.set(ko(y.name),b):s.set(y.name,b)}r.onProgress?.(0,0,"planning trims");let c=[],u={regions:[],total_bytes:0,dest_files:[],source_basenames:[]};if(i&&a.size){let y={format:"folder",folder_layout:"canonical-i2o",per_file_mode:{mode:"trim"},handles:i.handles},b={...i.session,media_references:(i.session.media_references??[]).filter(w=>a.has(ko(w.target_url??""))).map(w=>({...w,binding_state:"linked"}))};u=await Xi(wo(b,y),a,b,y);for(let w of u.untrimmable??[])c.push(`${w.basename}: ${w.reason}`)}else if(!i)for(let y of s.keys())E_(y)&&c.push(`${ko(y)}: no recipe in this .iso \u2014 written as stored`);let d=await zd({parts:l.map(y=>({basename:y.basename,destPathHint:y.udfPath,file:y.file,dataRanges:y.file.dataRanges()})),planClip:async y=>{let b=xl("r3d",y.map(w=>({filename:w.basename,fileSize:w.file.size,dataRanges:w.dataRanges??[],read:(k,I)=>w.file.slice(k,k+I).arrayBuffer().then(x=>new Uint8Array(x))})));return Ld(await Nr(b,{verb:"trim",selection:{items:[],handles:0}}))}}),f=new Set([...u.dest_files,...d.regions.map(y=>y.dest_file)]),m=[];for(let[y,b]of s)f.has(y)||m.push({dest_file:y,dest_offset:0,length:b.size,source:{kind:"file",basename:y,offset:0}});for(let[y,b]of a){let w=o.files.find(k=>ko(k.name)===y).name;!u.dest_files.includes(w)&&!u.regions.some(k=>k.source.kind==="file"&&k.source.basename===y)&&(m.push({dest_file:w,dest_offset:0,length:b.size,source:{kind:"file",basename:w,offset:0}}),s.set(w,b),c.push(`${y}: not in the recipe's cut \u2014 written as stored`))}let p=[...u.regions,...d.regions,...m],g={regions:p,total_bytes:p.reduce((y,b)=>y+b.length,0),dest_files:[...new Set(p.map(y=>y.dest_file))],source_basenames:[]},_=new Map([...a,...s,...d.filesByBasename]);await be(t);let v=await new Yi({layout:g,files:_,sink:Fd(t),signal:r.signal,concurrency:4,onProgress:y=>r.onProgress?.(y.bytesWritten,y.totalBytes,"writing trims")}).execute();return{files:g.dest_files.length,bytes:v.bytesWritten,untrimmed:c}}import{open as C_}from"node:fs/promises";import{createServer as JL}from"node:http";function lP(e,t=8*1024*1024,r=32){let o=new Map,n=(i,a)=>{let s=`${i}@${a}`,l=o.get(s);if(l)return o.delete(s),o.set(s,l),l;if(l=e(i,a*t,t).catch(c=>{throw o.delete(s),c}),o.set(s,l),o.size>r){let c=o.keys().next().value;c!==void 0&&o.delete(c)}return l};return async(i,a,s)=>{let l=Math.floor(a/t),c=Math.floor((a+s-1)/t);if(l===c){let m=await n(i,l),p=a-l*t;return m.subarray(p,Math.min(p+s,m.length))}let u=await Promise.all(Array.from({length:c-l+1},(m,p)=>n(i,l+p))),d=new Uint8Array(s),f=0;for(let m=0;m<u.length;m++){let p=u[m],g=(l+m)*t,_=Math.max(0,a-g),v=Math.min(p.length,a+s-g);v>_&&(d.set(p.subarray(_,v),f),f+=v-_)}return f===s?d:d.subarray(0,f)}}async function $o(e,t=!1){let r=await C_(e,t?"r+":"r"),o=(await r.stat()).size;return{read:async(n,i)=>{let a=new Uint8Array(i),{bytesRead:s}=await r.read(a,0,i,n);return s===i?a:a.subarray(0,s)},write:async(n,i)=>{await r.write(i,0,i.length,n),o=Math.max(o,n+i.length)},getSize:async()=>o,setSize:async n=>{await r.truncate(n),o=n},size:()=>o,close:()=>r.close()}}var KL=4<<20;async function D_(e,t=fetch){let r=await e(),o=async(s,l)=>{for(let c=0;;c++){let u=await t(r,{headers:{range:`bytes=${s}-${s+l-1}`}});if(u.status===403&&c===0){await u.body?.cancel(),r=await e();continue}if(u.status===416)return await u.body?.cancel(),new Uint8Array(0);if(!u.ok)throw new Error(`reading the .iso: ${u.status} ${(await u.text()).slice(0,200)}`);if(u.status===200&&s>0)throw new Error("the bucket ignored the byte range (no ranged GET)");return new Uint8Array(await u.arrayBuffer())}},n=await t(r,{headers:{range:"bytes=0-0"}});await n.body?.cancel();let i=Number(/\/(\d+)$/.exec(n.headers.get("content-range")??"")?.[1]??n.headers.get("content-length"));if(!n.ok||!Number.isFinite(i))throw new Error(`reading the .iso: ${n.status}`);let a=lP((s,l,c)=>o(l,Math.min(c,i-l)),1<<20,64);return{read:(s,l)=>{let c=Math.max(0,Math.min(l,i-s));return c?c<KL?a("iso",s,c):o(s,c):Promise.resolve(new Uint8Array(0))},write:()=>Promise.reject(new Error("a bucket .iso is read-only here (add_to patches an overlay)")),getSize:async()=>i,size:()=>i,close:async()=>{}}}function qL(e){let t=[];for(let r of[...e].sort((o,n)=>o.offset-n.offset)){let o=t[t.length-1];o&&r.offset<=o.offset+o.length?o.length=Math.max(o.length,r.offset+r.length-o.offset):t.push({...r})}return t}async function cP(e,t){let r=await C_(t,"w+"),o=[],n=e.size();return{read:async(a,s)=>{s=Math.max(0,Math.min(s,n-a));let l=new Uint8Array(s),c=Math.max(0,Math.min(s,e.size()-a));c>0&&l.set(await e.read(a,c),0);for(let u of o){let d=Math.max(u.offset,a),f=Math.min(u.offset+u.length,a+s);f>d&&await r.read(l,d-a,f-d,d)}return l},write:async(a,s)=>{await r.write(s,0,s.length,a),o=qL([...o,{offset:a,length:s.length}]),n=Math.max(n,a+s.length)},getSize:async()=>n,setSize:async a=>{n=a},size:()=>n,writes:()=>o,scratch:t,close:()=>r.close()}}async function uP(e){let t=JL((r,o)=>void(async()=>{let n=e.size(),i=/bytes=(\d+)-(\d*)/.exec(r.headers.range??""),a=i?Number(i[1]):0,s=i&&i[2]?Math.min(Number(i[2])+1,n):n;if(o.writeHead(i?206:200,{"Accept-Ranges":"bytes","Content-Length":s-a,...i?{"Content-Range":`bytes ${a}-${s-1}/${n}`}:{}}),r.method==="HEAD")return o.end();for(let l=a;l<s;l+=8388608)o.write(await e.read(l,Math.min(8388608,s-l)));o.end()})().catch(()=>{o.headersSent||o.writeHead(503),o.end()}));return await new Promise(r=>t.listen(0,"127.0.0.1",r)),{url:`http://127.0.0.1:${t.address().port}/disk.iso`,close:()=>new Promise(r=>t.close(()=>r()))}}async function dP(e){if(vt()!=="darwin")throw new Error("a live mount needs macOS (hdiutil attaches the image over HTTP); fetch the .iso or its trims elsewhere");let{execFile:t}=await import("node:child_process"),r=await new Promise((n,i)=>t("/usr/bin/hdiutil",["attach",e,"-readonly","-noverify","-noautoopen"],(a,s,l)=>a?i(new Error(l||a.message)):n(s))),o=r.trim().split(`
|
|
134
|
+
`).map(n=>n.split(" ").pop().trim()).filter(n=>n.startsWith("/")).pop();if(!o)throw new Error(`hdiutil attached nothing: ${r}`);return{mountpoint:o,detach:()=>new Promise(n=>t("/usr/bin/hdiutil",["detach",o,"-force"],()=>n()))}}async function mP(e,t,r,o,n=32<<20){let i=await C_(t,"w"),a=e.size(),s=0,l=0;try{await i.truncate(a),await Promise.all(Array.from({length:4},async()=>{for(;s<a;){o?.throwIfAborted();let c=s;s+=n;let u=await e.read(c,Math.min(n,a-c));await i.write(u,0,u.length,c),l+=u.length,r?.(l,a)}}))}finally{await i.close()}return a}var xo=class e extends File{#e;constructor(t,r,o){super([],r),this.path=t,this.#e=o}get size(){return this.#e}static async open(t,r=B(t)){return new e(t,r,(await ct(t)).size)}slice(t=0,r=this.size){let o=Math.max(0,t),n=Math.min(this.size,r),i=this.path;return{size:n-o,async arrayBuffer(){let a=await wm(i);try{let s=await a.readAt(o,n-o);return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}finally{await a.close()}}}}arrayBuffer(){return this.slice().arrayBuffer()}stream(){let t=this;return new ReadableStream({async start(r){r.enqueue(new Uint8Array(await t.arrayBuffer())),r.close()}})}text(){return this.arrayBuffer().then(t=>new TextDecoder().decode(t))}static async openClip(t){let r=ln(B(t))?await pa(t):[t];return r.length<2?e.open(t):new j_(t,await Promise.all(r.map(async o=>({path:o,name:B(o),size:(await ct(o)).size}))))}},j_=class extends xo{constructor(t,r){super(t,B(t),r.reduce((n,i)=>n+i.size,0)),this.parts=r;let o=0;this.bases=r.map(n=>(o+=n.size)-n.size)}slice(t=0,r=this.size){let o=Math.max(0,t),n=Math.min(this.size,r),i=this;return{size:Math.max(0,n-o),async arrayBuffer(){let a=new Uint8Array(Math.max(0,n-o));for(let s=0;s<i.parts.length;s++){let l=Math.max(o,i.bases[s]),c=Math.min(n,i.bases[s]+i.parts[s].size);if(l>=c)continue;let u=await wm(i.parts[s].path);try{a.set(await u.readAt(l-i.bases[s],c-l),l-o)}finally{await u.close()}}return a.buffer}}}};async function fP(e,t){let r=new Map,o=[],n=new Set;for(let i of e.timelines)for(let a of i.tracks)for(let s of a.items)s.media_reference_id&&n.add(s.media_reference_id);for(let i of e.media_references??[]){if(!n.has(i.id))continue;let a=i.local_path??i.target_url;if(!a){o.push(`${i.id}: no path`);continue}if(t.only_linked&&i.binding_state!=="linked"){o.push(`${i.id} ${B(a)}: not linked (run timeline_relink, or only_linked=false)`);continue}if(!await Ge(a)){o.push(`${i.id} ${a}: not on this machine`);continue}if(!Sl.has(Kt(a).toLowerCase())){o.push(`${i.id} ${B(a)}: unsupported container`);continue}for(let s of await pa(a))r.set(B(s),await xo.open(s))}return{files:r,skipped:o}}var XL=new Set(["resolve-xmeml","flame-fcpxml","resolve-otio","premiere-otio"]);async function pP(e,t,r){let o=await Ge(t)?[{name:B(t),data:await ut(t)}]:[],n=[],i=[];for(let s of r){let l=E0(s),c=await $0(l,e),u=typeof c.body=="string"?new TextEncoder().encode(c.body):c.body;if(l==="finalcut-fcpxmld"){for(let[d,f]of Object.entries(vl(u)))d.endsWith("/")||n.push({filename:d,bytes:f,text:!0});for(let d of c.issues??[])i.push(`${l}: ${d.message}`);continue}n.push({filename:c.filenameSuggestion,bytes:u,text:XL.has(l)});for(let d of c.issues??[])i.push(`${l}: ${d.message}`)}return{timelineFile:n.length?{bytes:n[0].bytes,filename:n[0].filename,isConversion:!0}:void 0,sourceFiles:o,exchangeFiles:n.slice(1),issues:i}}function YL(e,t){let r=t.filter(o=>o.bytes).map(o=>({dest_file:o.path,dest_offset:0,length:o.bytes.length,source:{kind:"inline",bytes:o.bytes}}));return r.length?{...e,regions:[...e.regions,...r],dest_files:[...new Set([...e.dest_files,...r.map(o=>o.dest_file)])],total_bytes:e.total_bytes+r.reduce((o,n)=>o+n.length,0)}:e}var hP=(e,t,r,o)=>["deliver",...t.length?["untrimmable"]:[],...r.length?["skipped"]:[],...e.length?["capability"]:[],...o?[]:["iso_unverified"]];async function gP(e,t,r){let{files:o,skipped:n}=await fP(e,{only_linked:r.only_linked});if(!o.size)throw new Error(`nothing to deliver \u2014 no linked media on this machine${n.length?`:
|
|
135
|
+
- ${n.join(`
|
|
136
|
+
- `)}`:""}`);let i=r.volume_name??B(r.out_path),a=await pP(e,t,r.timeline_formats),{entries:s}=x_(e,o,{volumeName:i,preserveStructure:r.preserve_structure,timelineFile:a.timelineFile,sourceFiles:a.sourceFiles,exchangeFiles:a.exchangeFiles,handles:r.handles}),l={format:"folder",volume_name:i,folder_layout:"canonical-i2o",per_file_mode:{mode:"trim"},handles:r.handles},c=wo(e,l),u=[...o.keys()].filter(ln),d=u.length?{...e,media_references:(e.media_references??[]).filter(y=>!ln(B(y.target_url??"")))}:e,f=await Xi(c,o,d,l),m=[];if(u.length){let y=new Map;for(let S of c.regions){let R=B(S.dest_file);ln(R)&&y.set(R,S.dest_file)}let b=I_(e),w=T_(e),k=await zd({parts:u.map(S=>({basename:S,destPathHint:y.get(S)??`02_MEDIA/${S}`,file:o.get(S)})),planClip:async S=>{let R=w.get(S[0].basename),$=XT(R?b.get(R.id)??[]:[],R,R?.source_fps??24),C=await Nr(o0(S.map(E=>E.file)),{verb:"trim",selection:{items:$,handles:r.handles}});return Ld(C)}});m=k.dropped??[];let x=[...f.regions.filter(S=>!ln(B(S.dest_file))),...k.regions];f={...f,regions:x,total_bytes:x.reduce((S,R)=>S+R.length,0),dest_files:[...new Set(x.map(S=>S.dest_file))],source_basenames:[...new Set(x.map(S=>S.source.kind==="file"?S.source.basename:"").filter(Boolean))]}}f=YL(f,s);let p=f.regions.filter(y=>y.source.kind!=="file"||o.has(y.source.basename));f={...f,regions:p,dest_files:[...new Set(p.map(y=>y.dest_file))],total_bytes:p.reduce((y,b)=>y+b.length,0)},await be(r.out_path);let g=await new Yi({layout:f,files:o,sink:Fd(r.out_path)}).execute(),_=[...f.untrimmable??[],...m],v=[...o.values()].reduce((y,b)=>y+b.size,0);return{text:[`delivered ${f.dest_files.length} file(s), ${(g.bytesWritten/1e6).toFixed(1)} MB (sources ${(v/1e6).toFixed(1)} MB) \u2192 ${r.out_path}`,...f.dest_files.map(y=>`- ${y}`),...a.issues.length?["timeline capability issues:",...a.issues.map(y=>` - ${y}`)]:[],..._.length?["not shipped (could not be trimmed \u2014 never shipped whole):",..._.map(y=>` - ${y.basename}: ${y.reason}`)]:[],...n.length?["skipped:",...n.map(y=>` - ${y}`)]:[]].join(`
|
|
137
|
+
`),files:f.dest_files.length,bytes:g.bytesWritten,keys:hP(a.issues,_,n,!0)}}async function bP(e,t,r){let{files:o,skipped:n}=await fP(e,{only_linked:r.only_linked});if(!o.size)throw new Error(`nothing to deliver \u2014 no linked media on this machine${n.length?`:
|
|
138
|
+
- ${n.join(`
|
|
139
|
+
- `)}`:""}`);let i=r.out_path.toLowerCase().endsWith(".iso")?r.out_path:M(r.out_path,`${r.volume_name??B(t,Kt(t))}.iso`),a=r.volume_name??B(i,".iso"),s=await pP(e,t,r.timeline_formats),l=x_(e,o,{volumeName:a,preserveStructure:r.preserve_structure,timelineFile:s.timelineFile,sourceFiles:s.sourceFiles,exchangeFiles:s.exchangeFiles,handles:r.handles}),{pinSectorByPath:c}=l,u=[...l.entries,{path:oP,bytes:iP(e,r.handles)}],d={format:"iso",volume_name:a,per_file_mode:rP("sparse"),handles:r.handles},f=tP(e),{payload:m}=await nP({session:e,layoutIntent:d,writtenAt:new Date(f).toISOString()}),p=await Xi(wo(e,d),o,e,d,{entries:u,pinSectorByPath:c,iuvd:m,buildTimestamp:f}),g=p.image_total_bytes??p.total_bytes;await be(ft(i));let _=await new Nd({layout:p,files:o,totalBytes:g,sink:await eP(i)}).execute(),v=await HT(await xo.open(i)).catch(()=>null),y=p.untrimmable??[],b=[...o.values()].reduce((w,k)=>w+k.size,0);return{text:[`wrote ${i}: ${(g/1e6).toFixed(1)} MB image, ${(_.bytesWritten/1e6).toFixed(1)} MB real data (sources ${(b/1e6).toFixed(1)} MB), volume "${a}"${v?", IUVD verified":", IUVD readback FAILED"}`,...[...new Set(p.dest_files)].map(w=>`- ${w}`),...s.issues.length?["timeline capability issues:",...s.issues.map(w=>` - ${w}`)]:[],...y.length?["not shipped (could not be planned \u2014 never shipped whole):",...y.map(w=>` - ${w.basename}: ${w.reason}`)]:[],...n.length?["skipped:",...n.map(w=>` - ${w}`)]:[]].join(`
|
|
140
|
+
`),path:i,bytes:g,keys:hP(s.issues,y,n,!!v)}}function QL(e,t){let r=[];for(let o of e){let n=[o];for(let i of t)n=n.flatMap(a=>{let s=Math.max(a.offset,i.offset),l=Math.min(a.offset+a.length,i.offset+i.length);return l<=s?[a]:[{offset:a.offset,length:s-a.offset},{offset:l,length:a.offset+a.length-l}].filter(c=>c.length>0)});r.push(...n)}return r}async function N_(e,t){let r=typeof t=="string"?await $o(t):t,o=typeof e=="string"?await $o(e,!0):e;try{let n=await Fn(r),i=await Fn(o),a=2048,s=n.partitionStartSector,l=(m,p)=>{let g=new Uint8Array(p.length);return Promise.all(Ln(m).map(async _=>{let v=Math.max(_.offset,p.offset),y=Math.min(_.offset+_.length,p.offset+p.length);y<=v||g.set(await r.read((s+_.imageSector)*a+(v-_.offset),y-v),v-p.offset)})).then(()=>g)},c=0,u=0,d=[],f=[];for(let m of n.files){let p=Ln(m).map(({offset:R,length:$})=>({offset:R,length:$})),g=m.name.lastIndexOf("."),_=g>m.name.lastIndexOf("/")?m.name.slice(0,g):m.name,v=_===m.name?"":m.name.slice(g),y=i.files.filter(R=>R.name===m.name||R.name.startsWith(`${_}_v`)&&R.name.endsWith(v)&&/^\d+$/.test(R.name.slice(_.length+2,R.name.length-v.length))),b=async R=>{if(R.totalSize!==m.totalSize)return!1;for(let $ of Ln(R))for(let C of p){let E=Math.max($.offset,C.offset),L=Math.min($.offset+$.length,C.offset+C.length);if(L<=E)continue;let q=await l(m,{offset:E,length:L-E}),O=await o.read((i.partitionStartSector+$.imageSector)*a+(E-$.offset),L-E);if(q.some((G,X)=>G!==O[X]))return!1}return!0},w;for(let R of y)if(await b(R)){w=R;break}let k=w?.name??m.name;if(!w&&y.length){let R=2;for(;i.files.some($=>$.name===`${_}_v${R}${v}`);)R++;k=`${_}_v${R}${v}`,f.push(k)}if(!w){try{i=await sw(o,i,k,m.totalSize)}catch(R){if(k.startsWith(".conform/"))continue;throw R}f.includes(k)||d.push(k)}let I=i.files.find(R=>R.name===k),x=QL(p,Ln(I).map(({offset:R,length:$})=>({offset:R,length:$}))),S=iw(I).flatMap(R=>x.map($=>{let C=Math.max(R.offset,$.offset),E=Math.min(R.offset+R.length,$.offset+$.length);return{offset:C,length:E-C}})).filter(R=>R.length>0);for(let R of S)i=await aw(o,i,k,R.offset,await l(m,R)),c++,u+=R.length}return{filled:c,added:d,versioned:f,bytes:u}}finally{typeof t=="string"&&await r.close(),typeof e=="string"&&await o.close()}}var Bd=32,yP=8,QK=(()=>{let e=new Float64Array(yP*Bd);for(let t=0;t<yP;t++)for(let r=0;r<Bd;r++)e[t*Bd+r]=Math.cos((2*r+1)*t*Math.PI/(2*Bd));return e})();function ez(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),e=e+(e>>>4)&252645135,Math.imul(e,16843009)>>>24}var ze=64,_P=(()=>{let e=new Float64Array(16*ze);for(let t=0;t<16;t++)for(let r=0;r<ze;r++)e[t*ze+r]=Math.cos(Math.PI*(t+1)*(2*r+1)/(2*ze));return e})();function Vd(e,t){let r=0;for(let o=0;o<8;o++)r+=ez((e.bits[o]^t.bits[o])>>>0);return r}var F_=72;function vP(e,t,r){let o=new Float64Array(ze*ze),n=t/ze,i=r/ze;for(let m=0;m<ze;m++)for(let p=0;p<ze;p++){let g=0,_=0,v=p*n|0,y=(p+1)*n|0,b=m*i|0,w=(m+1)*i|0;for(let k=b;k<w;k++){let I=k*t;for(let x=v;x<y;x++)g+=e[I+x],_++}o[m*ze+p]=_?g/_:0}let a=new Float64Array(16*ze);for(let m=0;m<16;m++)for(let p=0;p<ze;p++){let g=0;for(let _=0;_<ze;_++)g+=_P[m*ze+_]*o[_*ze+p];a[m*ze+p]=g}let s=new Float64Array(256);for(let m=0;m<16;m++)for(let p=0;p<16;p++){let g=0;for(let _=0;_<ze;_++)g+=a[m*ze+_]*_P[p*ze+_];s[m*16+p]=g}let l=Array.from(s).sort((m,p)=>m-p),c=(l[127]+l[128])/2,u=new Uint32Array(8);for(let m=0;m<256;m++)s[m]>c&&(u[m>>5]|=1<<(m&31));let d=0;for(let m=0;m<ze;m++)for(let p=0;p<ze-1;p++)d+=Math.abs(o[m*ze+p+1]-o[m*ze+p]);let f=0;for(let m=0;m<ze*ze;m++)f+=o[m];return{bits:u,quality:d,meanY:f/(ze*ze)}}function wP(e){let t={aSource:0,hole:0};for(let r of e)r.kind==="hole"?t.hole+=r.count:t.aSource+=r.count;return t}function L_(e,t="AX"){return e.replace(/\.[^.]+$/,"").replace(/[^A-Za-z0-9]/g,"").toUpperCase().slice(0,8)||t}function kP(e,t,r){let o=r?.title??"QC RECONFORM",n=L_(r?.aReel??"AX"),i=(r?.aReel??"").replace(/[\r\n]+/g," ").trim(),a=t.fps??24,s=_l(a,t.dropFrame)?"DROP FRAME":"NON-DROP FRAME",l=ce(0,a,t.dropFrame),c=[`TITLE: ${o}`,`FCM: ${s}`],u=0;for(let d of e){u++;let f=String(u).padStart(3,"0");if(d.kind==="hole"){let m=ce(d.count,a,t.dropFrame);c.push(`${f} ${"BL".padEnd(8)} V C ${l} ${m} ${d.recordInTc} ${d.recordOutTc}`),c.push(`* NEW MATERIAL (${d.count} frames)`)}else{if(c.push(`${f} ${n.padEnd(8)} V C ${d.aInTc} ${d.aOutTc} ${d.recordInTc} ${d.recordOutTc}`),i&&c.push(`* FROM CLIP NAME: ${i}`),d.motion&&!d.motion.ramp){let m=a*d.motion.percent/100,p=`${m<0?"-":""}${Math.abs(m).toFixed(1).padStart(5,"0")}`;c.push(`M2 ${n.padEnd(8)} ${p.padStart(6)} ${d.motion.entryTc}`),d.motion.percent<0&&c.push(`* REVERSE \u2014 PLAYS DOWN FROM ${d.motion.entryTc}`),d.motion.percent===0&&c.push(`* FREEZE FRAME AT ${d.motion.entryTc}`)}d.motion?.ramp&&c.push("* SPEED RAMP \u2014 NOT EXPRESSIBLE IN CMX3600; THE SESSION CARRIES THE CURVE"),d.unreproducible&&(c.push(`* CHECK BY EYE \u2014 ${d.unreproducible.note.toUpperCase()}`),d.motion||c.push("* THIS EVENT MAY NOT REBUILD THE CUT (HOLD / REVERSE / RETIME NOT EXPRESSIBLE)"))}}return c.join(`\r
|
|
141
|
+
`)+`\r
|
|
142
|
+
`}function tz(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function $P(e){let t=e.some(o=>o.motion),r=[["#","kind","rec_in","rec_out","A_in","A_out","frames",...t?["speed"]:[]]];for(let o of e)r.push([String(o.index),o.kind==="hole"?"HOLE":"A-SOURCE",o.recordInTc,o.recordOutTc,o.aInTc??"",o.aOutTc??"",String(o.count),...t?[o.motion?o.motion.ramp?"ramp":`${o.motion.percent.toFixed(1)}%`:""]:[]]);return r.map(o=>o.map(tz).join(",")).join(`\r
|
|
143
|
+
`)+`\r
|
|
144
|
+
`}var z_=["only_in_a","only_in_b","different_file","same_name_different_clip","source_tc"],nz=e=>e.replace(/^file:\/\//,"").split(/[\\/]/).pop()??e;function Zd(e,t){let r=e.timelines??[],o=t?r.find(n=>n.id===t):r.find(n=>n.kind==="primary"&&n.tracks?.some(i=>i.items?.length))??r[0];if(!o)throw new P("not_found",t?`no timeline ${t} (timelines: ${r.map(n=>`${n.id} "${n.name}"`).join(", ")})`:"the session has no timeline");return o}function Qi(e,t){let r=e.start_frame??0,o=[];for(let a of t)if(a.enabled!==!1)for(let s of a.items){if(s.kind!=="clip"||s.enabled===!1||!s.timeline_range.duration.value)continue;let l=r+s.timeline_range.start.value;o.push({s:l,e:l+s.timeline_range.duration.value,it:s,track:Yt(a,e.tracks),z:a.track_index??0})}let n=[...new Set(o.flatMap(a=>[a.s,a.e]))].sort((a,s)=>a-s),i=[];for(let a=0;a+1<n.length;a++){let[s,l]=[n[a],n[a+1]],c;for(let u of o)u.s<=s&&u.e>=l&&(!c||u.z>=c.z)&&(c=u);c&&i.push({s,e:l,it:c.it,track:c.track})}return i}function xP(e,t,r,o){let n=e.it,i=n.media_reference_id?o.get(n.media_reference_id):void 0,a=i?.local_path??i?.target_url??null,s=n.source_range?.start.rate||Ze(r),l=i?.source_fps||s,c=i?.source_timecode?qe(i.source_timecode,l)??0:0,u=(r.start_frame??0)+n.timeline_range.start.value,d=(n.speed??100)/100*(n.speed_reverse?-1:1),f=(n.source_range?.start.value??0)+(t-u)*d*s/Ze(r),m=Math.round(c+f*l/s);return{item_id:n.id,track:e.track,file:a?nz(a):n.name??"(unnamed)",path:a,reel:i?.reel_name??n.reel_name??null,file_tc:i?.source_timecode??null,file_frames:i?.available_range?.duration?.value??i?.declared_duration?.value??null,src_tc:ce(m,l,!!i?.source_timecode?.includes(";")),src_frame:m,rate:l}}function rz(e,t){if(!e&&!t)return null;if(!t)return{kind:"only_in_a",note:"A has picture here, B has none"};if(!e)return{kind:"only_in_b",note:"B has picture here, A has none (missing from A)"};let r=e.file.toLowerCase(),o=t.file.toLowerCase();if(r!==o)return{kind:"different_file",note:`${e.reel&&t.reel&&e.reel===t.reel?"same reel, ":""}different file; source TC ${e.src_tc} vs ${t.src_tc}${Math.abs(e.src_frame-t.src_frame)>1440?" (different TC base: temp vs master?)":""}`};if(e.file_tc&&t.file_tc&&e.file_tc!==t.file_tc||e.file_frames!=null&&t.file_frames!=null&&e.file_frames!==t.file_frames)return{kind:"same_name_different_clip",note:`same name, different clip: file TC ${e.file_tc??"?"} vs ${t.file_tc??"?"}, ${e.file_frames??"?"} vs ${t.file_frames??"?"} fr${e.path!==t.path?" (different folders)":""}`};let n=t.src_frame-e.src_frame;return n?{kind:"source_tc",note:`same file, source ${n>0?"+":""}${n} fr (A ${e.src_tc}, B ${t.src_tc})`}:null}function RP(e,t,r={}){let o=Zd(e,r.a_timeline_id),n=Zd(t,r.b_timeline_id),i=Ze(o),a=Ze(n);if(Math.abs(i-a)>.001)throw new P("invalid_args",`the timelines run at different rates (${i} vs ${a} fps); record TC cannot be aligned frame for frame`);let s=new Map((e.media_references??[]).map(m=>[m.id,m])),l=new Map((t.media_references??[]).map(m=>[m.id,m])),c=m=>m.tracks.filter(p=>p.kind==="Video"),u=[];if(r.by_track){let m=new Set([...c(o).map(p=>Yt(p,o.tracks)),...c(n).map(p=>Yt(p,n.tracks))]);for(let p of m)u.push({name:p,a:c(o).filter(g=>Yt(g,o.tracks)===p),b:c(n).filter(g=>Yt(g,n.tracks)===p)})}else u.push({name:"top",a:c(o),b:c(n)});let d=m=>ce(m,i,!!o.is_drop_frame),f=[];for(let m of u){let p=Qi(o,m.a),g=Qi(n,m.b),_=[...new Set([...p,...g].flatMap(y=>[y.s,y.e]))].sort((y,b)=>y-b),v=(y,b)=>y.find(w=>w.s<=b&&w.e>b);for(let y=0;y+1<_.length;y++){let[b,w]=[_[y],_[y+1]],k=v(p,b),I=v(g,b),x=k?xP(k,b,o,s):null,S=I?xP(I,b,n,l):null,R=rz(x,S);if(!R)continue;let $=f[f.length-1];if($&&$.lane===m.name&&$.rec_out===b&&$.kind===R.kind&&$.a?.item_id===x?.item_id&&$.b?.item_id===S?.item_id){$.rec_out=w,$.rec_out_tc=d(w),$.frames=w-$.rec_in;continue}f.push({lane:m.name,kind:R.kind,rec_in:b,rec_out:w,rec_in_tc:d(b),rec_out_tc:d(w),frames:w-b,a:x,b:S,note:R.note})}}return{ranges:f,ta:o,tb:n,lanes:u.map(m=>m.name)}}var SP=e=>e?`${e.file} @ ${e.src_tc} [${e.track} ${e.item_id}]`:"(nothing)";function IP(e,t,r,o){let n=z_.map(c=>[c,e.ranges.filter(u=>u.kind===c).length]).filter(([,c])=>c),i=e.ranges.length?`${e.ranges.length} record range${e.ranges.length===1?"":"s"} differ in source between A and B (${n.map(([c,u])=>`${u} ${c}`).join(", ")})`:`no source differences: A and B show the same source on every record frame (${e.lanes.join(", ")})`,a=e.ranges.slice(0,o),s=e.ranges.length>a.length?`TRUNCATED: showing ${a.length} of ${e.ranges.length} ranges \u2014 NOT the full list. Pass limit=${e.ranges.length}, or csv_path for all.
|
|
145
|
+
`:"",l=a.map(c=>`- ${c.lane==="top"?"":`${c.lane} `}${c.rec_in_tc}\u2013${c.rec_out_tc} (${c.frames} fr) ${c.kind}: A ${SP(c.a)} | B ${SP(c.b)} \u2014 ${c.note}`);return`${s}${i}
|
|
146
|
+
A: ${t} "${e.ta.name}"
|
|
147
|
+
B: ${r} "${e.tb.name}"
|
|
148
|
+
compared: ${e.lanes[0]==="top"?"topmost enabled video clip per record frame":`per video track (${e.lanes.join(", ")})`}; record TC from each timeline's start TC; out exclusive${l.length?`
|
|
149
|
+
${l.join(`
|
|
150
|
+
`)}`:""}`}var oz=e=>{let t=e==null?"":String(e);return/[",\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t};function TP(e){let t=["lane","kind","rec_in_tc","rec_out_tc","frames","a_file","a_src_tc","a_file_tc","a_track","a_item","a_path","b_file","b_src_tc","b_file_tc","b_track","b_item","b_path","note"],r=e.map(o=>[o.lane,o.kind,o.rec_in_tc,o.rec_out_tc,o.frames,o.a?.file,o.a?.src_tc,o.a?.file_tc,o.a?.track,o.a?.item_id,o.a?.path,o.b?.file,o.b?.src_tc,o.b?.file_tc,o.b?.track,o.b?.item_id,o.b?.path,o.note]);return[t,...r].map(o=>o.map(oz).join(",")).join(`
|
|
151
|
+
`)+`
|
|
152
|
+
`}function PP(e,t){let r=Ze(e.tb),o=!!e.tb.is_drop_frame,n=a=>ce(a,r,o),i=[`TITLE: ${t}`,`FCM: ${o?"DROP FRAME":"NON-DROP FRAME"}`];return e.ranges.forEach((a,s)=>{let l=String(s+1).padStart(3,"0");if(!a.b){i.push(`${l} ${"BL".padEnd(8)} V C ${n(0)} ${n(a.frames)} ${a.rec_in_tc} ${a.rec_out_tc}`,`* ${a.kind.toUpperCase()}: B HAS NO PICTURE HERE`);return}i.push(`${l} ${L_(a.b.reel??a.b.file).padEnd(8)} V C ${a.b.src_tc} ${ce(a.b.src_frame+Math.round(a.frames*a.b.rate/r),a.b.rate,a.b.src_tc.includes(";"))} ${a.rec_in_tc} ${a.rec_out_tc}`,`* FROM CLIP NAME: ${a.b.file}`,`* ${a.kind.toUpperCase()}: ${a.note.toUpperCase()}`)}),i.join(`\r
|
|
153
|
+
`)+`\r
|
|
154
|
+
`}function AP(e,t){let r=structuredClone(e),o=r.timelines.find(i=>i.id===t.tb.id);r.timelines=[o];let n=new Set(t.ranges.map(i=>i.b?.item_id).filter(Boolean));for(let i of o.tracks)i.items=i.kind==="Video"?i.items.filter(a=>n.has(a.id)):[];return o.name=`${o.name} \u2014 source diff`,r}var iz="klein4b-q8",az="https://pub-ed884bfa772244d89e9b6178f3b8ec9a.r2.dev/klein4b-q8/v2/manifest.json",sz=["transformer.safetensors","vae.safetensors","balance.safetensors","exposure.safetensors","exposure_s1.safetensors","exposure_s2.safetensors","yunet.safetensors","loma_b.safetensors","eomt_l_ade.safetensors","det_10g.onnx","w600k_r50.onnx","face_parsing.onnx"],B_={"darwin-arm64":["media-gen","mlx.metallib"],"linux-x64":["media-gen","libmlx.so","libmlxc.so"],"linux-arm64":["media-gen","libmlx.so","libmlxc.so"],"win32-x64":["media-gen.exe","mlx.dll","mlxc.dll"]},el=()=>`${vt()}-${vm()}`;function lz(e,t){return e.files.filter(r=>!r.platform||r.platform===t)}var cz=["loma_b.safetensors","eomt_l_ade.safetensors","det_10g.onnx","w600k_r50.onnx","face_parsing.onnx"];async function EP(e){for(let t of cz)if(!await Zt(M(e.model,t)))return!1;return!0}var uz=["exposure.safetensors","exposure_s1.safetensors","exposure_s2.safetensors"];async function OP(e){for(let t of uz)if(!await Zt(M(e.model,t)))return!1;return!0}var dz=16e9,Gd=()=>M(he(),"models",iz);function tl(){return B_[el()]?_m()<dz?`the local AI colour model needs 16 GB of memory (this machine has ${Math.round(_m()/1e9)} GB)`:null:`the local AI colour model runs on Apple Silicon Macs, Linux and Windows (x64), not ${vt()}/${vm()}`}async function er(){let e=Ke("CONFORM_AI_MODEL")??Gd(),t=Ke("CONFORM_MEDIA_GEN")??M(Gd(),B_[el()]?.[0]??"media-gen"),r={runner:t,model:e,preset:M(e,"balance.safetensors")};for(let o of[t,r.preset,M(e,"transformer.safetensors"),M(e,"vae.safetensors")])if(!await Zt(o))return null;return r}async function Hd(e={}){let t=tl();if(t)throw new Error(t);let r=e.manifestUrl??Ke("CONFORM_AI_PACK_URL")??az;if(!r)throw new Error("the AI colour model has not been published yet (no pack manifest URL)");let o=await fetch(r);if(!o.ok)throw new Error(`could not read the AI pack manifest (${o.status})`);let n=await o.json(),i=Gd();await be(i);let a=B_[el()]??[],s=lz(n,el());if(!a.every(c=>s.some(u=>u.name===c)))throw new Error(`the published AI pack has no runner for ${el()} yet`);for(let c of s){if(!sz.includes(c.name)&&!a.includes(c.name))throw new Error(`unexpected file in the AI pack: ${c.name}`);let u=M(i,c.name);if(await Zt(u)&&await km(u)===c.sha256)continue;let d=0;await Jv(new URL(c.url,r).href,u,(m,p)=>{let g=Math.floor(100*m/(p||c.bytes));g>=d+5&&(d=g,e.onProgress?.(`${c.name} ${g}% of ${(c.bytes/1e9).toFixed(2)} GB`))});let f=await km(u);if(f!==c.sha256)throw await sn(u),new Error(`${c.name} failed its checksum (got ${f}); deleted, run again to re-download`);c.name==="media-gen"&&await kn("chmod",["+x",u],()=>{})}let l=await er();if(!l)throw new Error("the AI pack downloaded but is incomplete");return l}async function MP(e,t,r={}){let o=new Uint8Array(t.w*t.h*3);for(let l=0;l<o.length;l++)o[l]=Math.max(0,Math.min(255,Math.round(t.data[l]*255)));let n=await nt("conform-ai-"),i=M(n,"in.rgb");await Nt(i,o);let a=[],s=Date.now();try{let l=await kn(e.runner,["balance","--input-rgb",`${i}:${t.w}x${t.h}`,"--raw","u8","--model",e.model,"--preset",e.preset,"--edge",String(r.edge??512),"--seed",String(r.seed??376436993),"--steps",String(r.steps??3),"--sampler","sdcpp"],g=>a.push(g));if(l.code!==0&&/non-empty mlx_stream/.test(l.stderr))throw new Error(`the AI colour model's GPU kernels (mlx.metallib) did not load on this macOS; delete ${Gd()} and run color_match reference "ai" again to fetch the current pack`);if(l.code!==0)throw new Error(`the AI colour model failed (exit ${l.code}): ${l.stderr.trim().slice(-400)}`);let c=l.stderr.match(/ (\d+)x(\d+) [\d.]+s/);if(!c)throw new Error(`the AI colour model gave no output size: ${l.stderr.trim().slice(-200)}`);let[u,d]=[Number(c[1]),Number(c[2])],f=new Uint8Array(a.reduce((g,_)=>g+_.length,0)),m=0;for(let g of a)f.set(g,m),m+=g.length;if(f.length!==u*d*3)throw new Error(`the AI colour model returned ${f.length} bytes for ${u}x${d}`);let p=new Float32Array(f.length);for(let g=0;g<f.length;g++)p[g]=f[g]/255;return{data:p,w:u,h:d,ms:Date.now()-s}}finally{await sn(n).catch(()=>{})}}var U_=[.2126,.7152,.0722];function CP(e,t,r=2){let o=(u,d)=>U_[0]*Math.max(0,Math.min(1,u[d]))**2.4+U_[1]*Math.max(0,Math.min(1,u[d+1]))**2.4+U_[2]*Math.max(0,Math.min(1,u[d+2]))**2.4,n=[];for(let u=0;u<e.data.length;u+=3){let d=o(e.data,u);d>1e-5&&Math.max(e.data[u],e.data[u+1],e.data[u+2])<.99&&n.push(Math.log2(Math.max(o(t.data,u),1e-9)/Math.max(d,1e-9)))}if(n.length<64)return{image:t,askedStops:0,appliedStops:0};n.sort((u,d)=>u-d);let i=n.length,a=i%2?n[i-1>>1]:(n[i/2-1]+n[i/2])/2;if(Math.abs(a)<.01)return{image:t,askedStops:a,appliedStops:a};let s=a*Math.exp(-Math.abs(a)/r),l=2**(s-a),c=new Float32Array(t.data.length);for(let u=0;u<c.length;u++)c[u]=Math.min(1,(Math.max(0,Math.min(1,t.data[u]))**2.4*l)**(1/2.4));return{image:{data:c,w:t.w,h:t.h},askedStops:a,appliedStops:s}}async function DP(e,t,r,o){let n=await nt("conform-serve-"),i="",a="",s=[],l=Wv(e.runner,["serve"],m=>{i+=new TextDecoder().decode(m);for(let p=i.indexOf(`
|
|
155
|
+
`);p>=0;p=i.indexOf(`
|
|
156
|
+
`)){let g=i.slice(0,p);i=i.slice(p+1),s.shift()?.(g)}},m=>{a=(a+m).slice(-4e3),r?.(m)});l.hold(!0);let c=!1;l.exited.then(()=>{c=!0;for(let m of s.splice(0))m(JSON.stringify({error:`media-gen serve exited: ${a.trim().slice(-400)}`}))});let u=async m=>{if(c)throw new Error(`media-gen serve is not running: ${a.trim().slice(-400)}`);let p=new Promise(_=>s.push(_));await l.write(new TextEncoder().encode(JSON.stringify(m)+`
|
|
157
|
+
`));let g=JSON.parse(await p);if(g.error)throw new Error(String(g.error));return g},d=o?{preset:M(e.model,"exposure.safetensors"),view_lut:o,loras:{s1:M(e.model,"exposure_s1.safetensors"),s2:M(e.model,"exposure_s2.safetensors")}}:{preset:e.preset};await u({cmd:"open",model:e.model,consist:t,...d});let f=0;return{async balance(m,p={}){let g=new Uint8Array(m.w*m.h*3);for(let x=0;x<g.length;x++)g[x]=Math.max(0,Math.min(255,Math.round(m.data[x]*255)));let[_,v]=[M(n,`in${f}.rgb`),M(n,`out${f++}.rgb`)];await Nt(_,g);let y=await u({cmd:"balance",rgb:_,w:m.w,h:m.h,edge:p.edge??512,seed:p.seed??376436993,steps:p.steps??3,out:v}),b=await ut(v);await sn(_).catch(()=>{}),await sn(v).catch(()=>{});let[w,k]=[Number(y.w),Number(y.h)];if(b.length!==w*k*3)throw new Error(`the AI colour model returned ${b.length} bytes for ${w}x${k}`);let I=new Float32Array(b.length);for(let x=0;x<b.length;x++)I[x]=b[x]/255;return{data:I,w,h:k,ms:Number(y.ms)}},async step1(m){let p=await u({cmd:"step1",frame:m});return{values:p.values,stage1:p.stage1,ms:Number(p.ms)}},async shot(m){return Number((await u({cmd:"shot",shot:m})).ms??0)},async finish(){return await u({cmd:"finish"})},close(){l.hold(!1),l.close(),et(n).catch(()=>{})}}}function mz(e,t){let r=(e.keyframes??[]).filter(a=>a.parameter_path==="speed"&&typeof a.time?.value=="number"&&typeof a.value=="number").map(a=>({x:a.time.value,y:a.value,t:Array.isArray(a.raw_extraction?.drtNativeTangent)?a.raw_extraction.drtNativeTangent:null,pre:!!a.raw_extraction?.speedPreRoll,g0:Array.isArray(a.raw_extraction?.speedGraphPoint)&&Math.abs(a.raw_extraction.speedGraphPoint[0])<1e-9})).sort((a,s)=>a.x-s.x);if(r.length<2)return null;let o=(r.find(a=>a.g0)??r.find(a=>!a.pre)??r[0]).x,n=(a,s)=>{let l=r[a].t;if(l&&l.length>=4){if(s==="in"&&l[0])return l[1]/l[0];if(s==="out"&&l[2])return l[3]/l[2]}let c=s==="out"?Math.min(a+1,r.length-1):Math.max(a-1,0),u=Math.min(a,c),d=Math.max(a,c);return r[d].x>r[u].x?(r[d].y-r[u].y)/(r[d].x-r[u].x):0},i=a=>{let s=r.length-1;if(a<=r[0].x)return r[0].y+(a-r[0].x)*n(0,"out");if(a>=r[s].x)return r[s].y+(a-r[s].x)*n(s,"in");for(let l=0;l<s;l++){let c=r[l],u=r[l+1];if(a>u.x)continue;let d=u.x-c.x;if(d<=0)return u.y;let f=(a-c.x)/d,m=f*f,p=m*f;return(2*p-3*m+1)*c.y+(p-2*m+f)*d*n(l,"out")+(-2*p+3*m)*u.y+(p-m)*d*n(l+1,"in")}return r[s].y};{let a=r[0].x-1,s=r[r.length-1].x+1;for(let l=0;l<80;l++){let c=(a+s)/2;i(c)<t?a=c:s=c}Math.abs(i(s)-t)<1e-4&&(o=s)}return a=>i(o+a)}function jP(e,t,r,o=0,n=0){let i=e.source_range.start.rate||r,a=t?.source_fps||i,s=Math.round(e.timeline_range.duration.value),l=mz(e,e.source_range.start.value/i),c=e.source_range.start.value*(a/i),u=a/r*((e.speed??100)/100)*(e.speed_reverse?-1:1),d=[];for(let f=-o;f<s+n;f++)d.push(l?l(f/r)*a:c+f*u);return d}var ea=e=>"a"in e;async function fz(){let e=[Ke("CONFORM_MEDIA_GEN"),jn(new URL("../../rust/target/release/media-gen",import.meta.url)),(await er())?.runner],t=Ke("CONFORM_RIFE_WEIGHTS")??M(he(),"models","rife","rife_v4.22_lite.safetensors"),r;for(let o of e)if(o&&await Zt(o)){r=o;break}if(!r)throw new Error("the interpolation model's runner (media-gen) is not installed (Apple Silicon; cargo build --release -p media-gen)");if(!await Zt(t))throw new Error(`RIFE's weights are not installed at ${t} (scripts/rife/oracle.py --out writes them)`);return{runner:r,weights:t}}async function NP(e){if(e.kind==="retime"&&(e.speed??100)<=0&&!e.ramp?.length)throw new Error("retime: speed must be above 0 (a reverse or a freeze is an edit, not a fix)");let t=async g=>(await Pe(g)).available_range?.duration.value||void 0,r=await pt({op:"fix",kind:e.kind,path:e.path,frames:await t(e.path),includeFreezes:!!e.include_freezes,plate:e.plate,plateStart:e.plate_start??0,plateFrames:e.plate_frames,mask:e.mask,plateCount:e.plate?await t(e.plate):void 0,srcIn:e.src_in??0,outFrames:e.frames,speed:e.speed!=null?e.speed/100:void 0,ramp:e.ramp?.map(([g,_])=>[g,_/100])}),o=r.out,n=r.between,i={kind:e.kind,status:"planned",frames_in:r.frames,frames_out:o.length,between:n,found:r.found},a=r.found;if(e.kind==="cadence"&&a.repace?.detected&&!e.force)return{...i,status:"refused: re-pace detected"};if(e.plan_only)return i;if(!(n>0||o.length!==i.frames_in||o.some((g,_)=>!ea(g)&&g.f!==_)))return{...i,status:"nothing to fix"};let l=e.out_path??e.path.replace(/(\.[^./]+)?$/,`_${e.kind}.mov`),c=async(g,_)=>{let v=await Pe(g),y=v.source_timecode?qe(v.source_timecode,v.source_fps??v.available_range?.duration.rate??24):null;return{tc:y!=null?y+_:-1,df:!!v.source_timecode?.includes(";")}},u=e.kind==="cadence"?await c(e.plate,a.plate.start):await c(e.path,ea(o[0])?o[0].a:o[0].f),[d,f]=String(r.rate??"24/1").split("/").map(Number),m=await LP(e.path,o,l,d,f||1,u),p=e.kind==="cadence"?await pt({op:"cadence_check",out:l,plate:e.plate,plateStart:a.plate.start,plateFrames:a.plate.frames}).then(g=>({motion_flags:g.motion_flags})):await pt({op:"fix",kind:"duplicates",path:l,frames:o.length}).then(g=>({repeats_left:g.between}));return{...i,status:"fixed",wrote:l,between_output_frames:m,check:p}}async function FP(e,t){let r=e.timelines.find(c=>c.kind==="primary")??e.timelines[0];if(!r)throw new Error("the session has no timeline");let o=Ze(r),n=Math.max(0,Math.floor(t.handles??12)),i=t.out_dir??M(he(),"renders",t.session_id);t.plan_only||await be(i);let a=[],s=e.media_references??[],l=!1;for(let c of r.tracks.filter(u=>u.kind==="Video"))for(let u of c.items){if(u.kind!=="clip"||u.enabled===!1||!u.source_range||t.item_ids&&!t.item_ids.includes(u.id))continue;let d=u.speed??100,f=!!u.speed_ramped;if(!f&&Math.abs(d-100)<1e-6)continue;let m=u.name??u.id,p=f?"ramp":`${+d.toFixed(2)} %`;if(u.speed_reverse||!f&&d<=0){a.push({item:u.id,name:m,speed:p,skipped:"a reverse or a freeze is an edit, not a retime to smooth"});continue}let g=s.find($=>$.id===u.media_reference_id),_=g?.local_path??g?.target_url?.replace(/^file:\/\//,"");if(!g||!_||!await Zt(_)){a.push({item:u.id,name:m,speed:p,skipped:"its media isn't linked on this machine (timeline_relink first)"});continue}let v=(await Pe(_)).available_range?.duration.value??0,y=jP(u,g,o,n,n),b=n;for(;b>0&&(y[0]<0||y[0]>v-1);)y=y.slice(1),b--;for(;y.length>Math.round(u.timeline_range.duration.value)+b&&(y[y.length-1]<0||y[y.length-1]>v-1);)y=y.slice(0,-1);let w=await pt({op:"fix",kind:"retime",path:_,frames:v||void 0,positions:y}),k=w.out;if(t.plan_only){a.push({item:u.id,name:m,speed:p,frames:k.length,between:w.between});continue}let I=Math.round(u.timeline_range.start.value),x=(r.start_frame??0)+I-b,S=M(i,`${B(_).replace(/\.[^.]+$/,"")}_flow_${ce(x,o,!!r.is_drop_frame).replace(/[:;]/g,"")}.mov`);await LP(_,k,S,r.fps_num,r.fps_den||1,{tc:x,df:!!r.is_drop_frame});let R=await Pe(S);R.id=`flow-${u.id}`,e.media_references=[...s.filter($=>$.id!==R.id),R],u.media_reference_id=R.id,u.source_range={start:{value:b,rate:o},duration:{value:Math.round(u.timeline_range.duration.value),rate:o}},u.speed=100,u.speed_ramped=!1,u.speed_reverse=!1,u.keyframes=(u.keyframes??[]).filter($=>$.parameter_path!=="speed"),l=!0,a.push({item:u.id,name:m,speed:p,wrote:S,frames:k.length,between:w.between})}return{session:e,items:a,changed:l}}async function LP(e,t,r,o,n,i){let a=await nt("conform-fix-");try{let s=x=>`${x.a}_${x.b}_${x.t}`,l=new Map;for(let x of t.filter(ea)){let S=l.get(`${x.a}_${x.b}`)??{a:x.a,b:x.b,t:[]};S.t.includes(x.t)||S.t.push(x.t),l.set(`${x.a}_${x.b}`,S)}let c=new Set([...l.values()].flatMap(x=>[x.a,x.b])),u=0,d=0,f=x=>{let S=new Uint8Array(x.length/4*3);for(let R=0,$=0;R<x.length;R+=4,$+=3)S[$]=x[R],S[$+1]=x[R+1],S[$+2]=x[R+2];return S};if(c.size){let x=[];await Mm(e,C=>{u=C.w,d=C.h},(C,E)=>{c.has(C)&&x.push(Nt(M(a,`${C}.bgr`),f(E)))}),await Promise.all(x);let S=[...l.values()].map(C=>({a:M(a,`${C.a}.bgr`),b:M(a,`${C.b}.bgr`),t:C.t,out:C.t.map(E=>M(a,`${s({a:C.a,b:C.b,t:E})}.mid.bgr`))}));await ge(M(a,"jobs.json"),JSON.stringify({w:u,h:d,pairs:S}));let R=await fz(),$=await wn(R.runner,["rife","--weights",R.weights,"--jobs",M(a,"jobs.json")]);if(!$.success)throw new Error(`the interpolation model (RIFE on media-gen) failed: ${$.stderr.trim().split(`
|
|
158
|
+
`).slice(-4).join(" | ")}`)}await sr();let m=(x,S)=>{let R=new Uint8Array(u*d*4);for(let $=0,C=0;C<R.length;$+=S,C+=4)R[C]=x[$+2],R[C+1]=x[$+1],R[C+2]=x[$],R[C+3]=255;return R},p=new Map;for(let x of t.filter(ea))p.has(s(x))||p.set(s(x),Om(m(await ut(M(a,`${s(x)}.mid.bgr`)),3),u,d));let g=new Map;t.forEach((x,S)=>{ea(x)||g.set(x.f,S)});let _=new Map,v=[],y=[],b=0,w=x=>{for(;b<t.length;){let S=t[b];if(ea(S))y.push(v.length),v.push(p.get(s(S)));else{if(S.f>x||!_.has(S.f))break;v.push(_.get(S.f)),g.get(S.f)===b&&_.delete(S.f)}b++}};if(await Mm(e,x=>{u=x.w,d=x.h},(x,S)=>{g.has(x)&&_.set(x,Om(m(S,4),u,d)),w(x)}),b<t.length)throw new Error(`the source stopped decoding at output frame ${b} of ${t.length}`);let k=new Uint8Array(v.reduce((x,S)=>x+S.length,0)),I=0;for(let x of v)k.set(x,I),I+=x.length;return await Nt(r,Gw(k,Uint32Array.from(v.map(x=>x.length)),u,d,o,n,"apch",!1,BigInt(i.tc),i.df,1,1)),y}finally{await et(a).catch(()=>{})}}function zP(e){let r=[`${e.status}: ${e.kind} \u2014 ${e.frames_in} source frames \u2192 ${e.frames_out} out, ${e.between} remade between frames`];if(e.kind==="duplicates"){let o=e.found;r.push(o.length?`found (${o.length}): ${o.map(n=>`${n.check} ${n.start}\u2013${n.end}`).join(", ")}`:"found: no repeated frames QC calls a defect")}if(e.kind==="cadence"){let o=e.found;r.push(`held frames cut (${o.held_frames.length}): ${o.held_frames.join(", ")||"none"}`),o.real_pauses_kept.length&&r.push(`kept as real pauses (the plate pauses too): ${o.real_pauses_kept.join(", ")}`),r.push(`skipped source frames: ${o.gaps.map(n=>`after render ${n.after_render_frame} \u2192 plate ${n.plate_frames.join("/")}`).join("; ")||"none"}`),o.repace.detected&&r.push(`RE-PACE: render frames ${o.repace.runs.fast.map(([n,i])=>`${n}\u2013${i}`).join(", ")} race ahead of the plate. ${o.repace.note}`)}return e.wrote&&r.push(`wrote ${e.wrote}; between frames at output ${e.between_output_frames?.join(", ")||"none"}`),e.check&&r.push(`check: ${JSON.stringify(e.check)}`),r.join(`
|
|
159
|
+
`)}async function Tr(e){let t=await Lr();if(!t)throw new P("unsupported","media_patch needs the native engine (conformtools-decode), which is not installed here. From a source checkout build it once: cd rust && cargo build --release -p media-native --bin conformtools-decode (or set CONFORM_NATIVE_DECODE to the binary); the npm package ships it.");let r=await wn(t,["patch",JSON.stringify(e)]);if(r.code!==0){let o=fa(r.stderr),n=/not supported|does not match|refus|outside|disagrees|no timecode|timecode mismatch|exists/.test(o);throw new P(n?"refused":"engine",o)}return JSON.parse(r.stdout.trim().split(`
|
|
160
|
+
`).pop())}var H_=()=>M(he(),"patches.jsonl"),Wd=e=>`${(e/1e9).toFixed(e<1e10?2:1)} GB`;function pz(e,t){return[`layout: ${e.top_level.map(r=>r.type).join(" ")} (index at the ${e.moov_at}), ${Wd(e.master_bytes)}`,` in_place grows the file by ${Wd(e.in_place_grows_by)}; new needs ${Wd(e.new_needs_free)} free${t!=null?` (${Wd(t)} free here${t<e.new_needs_free?": NOT enough for new, in_place only if the user asks to modify the master":""})`:""}`,` chunk offsets after the write: ${e.chunk_offsets_after}; bitrate box (btrt): ${e.btrt?"present, refreshed":"none"}`,` changes: ${e.changes}`].join(`
|
|
161
|
+
`)}async function hz(e){if(e.in==null||e.out==null)throw new P("invalid_args","plan needs in and out (the fixed range on the master, frames or TC)");let t=await Pe(e.path),r=t.source_fps??t.streams?.find(c=>c.kind==="video")?.rate??0,o=t.source_timecode??null,n=$n(e.in,r,o),i=$n(e.out,r,o);if(n<0||i<n)throw new P("invalid_args","in/out must be inside the master, in before out");let a=await Tr({mode:"plan",master:e.path,master_in:n,frames:i-n+1}),s=c=>ce((a.master_tc_start_frame??0)+c,r),l=a.frames-(i-n+1);return{text:[`${a.codec}: render master frames ${a.span[0]}\u2013${a.span[1]} (${a.frames} frames, ${s(a.span[0])}\u2013${s(a.span[1])}) for the fix at ${n}\u2013${i}${l?` (+${l} to whole GOPs)`:""}`,`GOP ${a.gop??"?"}${a.fixed_gop?" (fixed)":" (varies)"}, ${a.b_frames?"B-frames":"no B-frames"}${a.open_gop_after?"; the GOP after the fix is open, so it is included":""}`,a.swappable?`then: ${a.render}`:`the master's GOP at ${s(a.span[0])} is open: a swap there needs a re-encode across the seam; ask before rendering`].join(`
|
|
162
|
+
`),data:{...a,fixed:[n,i],tc_in:s(a.span[0]),tc_out:s(a.span[1])}}}async function gz(){try{return(await _e(H_())).split(`
|
|
163
|
+
`).filter(Boolean).map(e=>JSON.parse(e))}catch{return[]}}var V_=e=>`${((Number(e)||0)/1e6).toFixed(1)} MB`;async function W_(e,t){let r=e.mode??"new";if(r==="undo")return bz(e.path);if(e.patches?.length){if(r!=="in_place"&&r!=="check")throw new P("invalid_args","patches (several at once) is for mode in_place or check; one patch per new/section file");if(e.patch||e.in!=null||e.out!=null||e.patch_in!=null)throw new P("invalid_args","with patches, each is placed by its own TC: leave patch/in/out/patch_in out");let p=[];for(let[v,y]of e.patches.entries())t?.(v,e.patches.length,`check ${B(y)}`),p.push(await Tr({mode:"check",master:e.path,patch:y}));let g=p.map(v=>[v.master_in,v.master_in+v.frames-1]).sort((v,y)=>v[0]-y[0]);for(let v=1;v<g.length;v++)if(g[v][0]<=g[v-1][1])throw new P("refused",`patches overlap at master frames ${g[v][0]}\u2013${g[v-1][1]}; nothing written`);if(r==="check")return{text:`all ${p.length} patches fit: ${p.map(v=>`${v.frames} frames at ${v.master_in}`).join(", ")}
|
|
164
|
+
nothing written (mode=check)`,data:{plans:p}};let _=[];for(let[v,y]of e.patches.entries())t?.(v,e.patches.length,`patch ${v+1}/${e.patches.length}: ${B(y)}`),_.push(await W_({path:e.path,patch:y,mode:r,verify:e.verify}));return t?.(e.patches.length,e.patches.length,"done"),{text:_.map(v=>v.text).join(`
|
|
165
|
+
|
|
166
|
+
`),data:{mode:r,path:e.path,patches:_.map(v=>v.data)}}}if(r==="plan")return hz(e);if(!e.patch)throw new P("invalid_args","patch (the render of the fixed range, with record TC) is required");let o,n;if(e.in!=null||e.out!=null){let p=await Pe(e.path),g=p.source_fps??p.streams?.find(v=>v.kind==="video")?.rate??0,_=p.source_timecode??null;if(e.in!=null&&(o=$n(e.in,g,_)),e.out!=null){if(o==null)throw new P("invalid_args","out needs in");if(n=$n(e.out,g,_)-o+1,n<1)throw new P("invalid_args","out is before in")}if(o!=null&&o<0)throw new P("invalid_args",`in is before the master's start TC (${_})`)}let i=await Tr({mode:"check",master:e.path,patch:e.patch,master_in:o,frames:n,patch_in:e.patch_in}),a=`${i.master_in}\u2013${i.master_in+i.frames-1}`,s=Kt(e.path),l=B(e.path,s),c=async p=>{let g=e.out_path??M(ft(e.path),p);try{(await ct(g)).isDirectory&&(g=M(g,p))}catch{}if(await Ge(g))throw new P("refused",`${g} already exists; not overwriting (pass another out_path)`);return g},u=`${i.frames} frame${i.frames===1?"":"s"} of ${i.codec} cut in by timecode at master frames ${a} (patch frames ${i.patch_in}\u2013${i.patch_in+i.frames-1})`;if(r==="check"){let p=i.layout,g=await hl(ft(e.path)).catch(()=>null);return{text:`patch fits: ${u}, no re-encode
|
|
167
|
+
${p?pz(p,g)+`
|
|
168
|
+
`:""}nothing written (mode=check)`,data:{...i,free_bytes:g}}}let d={patch_in:i.patch_in,frames:i.frames};if(r==="section"){let p=await c(`${l}_patch_${a.replace("\u2013","-")}${s}`),g=await nt("conform-patch-");try{let _=M(g,`range${s}`);await Il({path:e.path,in:i.master_in,out:i.master_in+i.frames-1,out_path:_});let v=await Tr({mode:"new",master:_,patch:e.patch,out_path:p,...d}),y=await Pe(p);return{text:`wrote section ${p}: ${u}, with the master's TC and audio, no re-encode
|
|
169
|
+
verified: ${Z_(v)}; start TC ${y.source_timecode??"none"}`,data:{...d,master_in:i.master_in,mode:r,path:p,start_tc:y.source_timecode??null,verify:v.verify,cost:v.cost}}}finally{await et(g)}}if(r==="in_place"){t?.(0,1,`write + verify ${B(e.patch)}`);let p=await Tr({mode:"in_place",master:e.path,patch:e.patch,...d,verify:e.verify??"index"}),g={...p.undo,patch:e.patch,at:new Date().toISOString()};await be(he()),await ge(H_(),JSON.stringify(g)+`
|
|
170
|
+
`,{append:!0});let _=p.cost??{};return{text:`patched ${B(e.path)} in place: ${u}, no re-encode
|
|
171
|
+
verified: ${Z_(p)}
|
|
172
|
+
cost: the file grew ${V_(_.grew_bytes)}; ${V_(_.dead_bytes)} stay as dead bytes (the replaced frames + old index, kept so undo works); the patched span now sits at the end of the file, away from its audio (mode=new rewrites the file contiguously)${_.btrt_refreshed?"; bitrate box refreshed":""}
|
|
173
|
+
undo: media_patch mode=undo path=${e.path} restores the original byte for byte`,data:{...d,master_in:i.master_in,mode:r,path:e.path,verify:p.verify,cost:p.cost,undo:g}}}let f=await c(`${l}_patched${s}`),m=await Tr({mode:"new",master:e.path,patch:e.patch,out_path:f,...d});return{text:`wrote ${f}: ${B(e.path)} with ${u}, no re-encode
|
|
174
|
+
verified: ${Z_(m)}
|
|
175
|
+
rewritten contiguously in the master's interleave order (${V_(m.cost?.bytes)}); the master was not touched`,data:{...d,master_in:i.master_in,mode:r,path:f,verify:m.verify,cost:m.cost}}}function Z_(e){let t=e.verify??{},r=t.other_tracks_check==="index"?`${t.other_tracks} other tracks (audio/TC) untouched: every sample at its original offset and size, and the write never reached them (verify=full re-reads and hashes them)`:`${t.other_tracks} other tracks (audio/TC) hash-identical`;return`${t.frames} frames, the master's TC track unchanged, ${t.patched_frames_identical} frames at the patch's TC byte-identical to the patch (ends decode to the patch's pixels), frames either side are the master's (${(t.splice??[]).filter(o=>!o.is.startsWith("patch")).map(o=>o.frame).join(", ")||"none: the span is the whole file"}), ${r}`}async function bz(e){let t=await gz(),r=(await ct(e)).size,o=t.findLastIndex(i=>i.path===e&&i.size_after===r);if(o<0){let i=t.some(a=>a.path===e);throw new P(i?"refused":"not_found",i?`${B(e)} changed since its last in-place patch (size ${r}); nothing undone`:`no in-place patch of ${B(e)} on record`)}let n=t[o];return await Tr({mode:"undo",record:n}),t.splice(o,1),await ge(H_(),t.map(i=>JSON.stringify(i)+`
|
|
176
|
+
`).join("")),{text:`undid the in-place patch of ${B(e)} (master frames ${n.master_in}\u2013${n.master_in+n.frames-1}): the file is byte-identical to before it`,data:{mode:"undo",path:e,undone:n}}}var yz={rec709:1,bt709:1,rec2020:9,bt2020:9,"dci-p3":11,p3dci:11,p3d65:12,"display-p3":12},_z={rec709:1,bt709:1,g24:1,bt1886:1,pq:16,st2084:16,g26:17,st428:17,hlg:18},vz={rec709:1,bt709:1,rec2020:9,bt2020:9};function G_(e,t,r){if(typeof t=="number")return t;let o=r[t.toLowerCase().replace(/[\s_.]/g,"")];if(o==null)throw new P("invalid_args",`unknown ${e} '${t}' (use ${Object.keys(r).join(", ")} or an H.273 code)`);return o}async function UP(e){if(!e.out_path&&!e.in_place)throw new P("invalid_args","give out_path (a retagged copy) or in_place=true (only when the user asks to change this file itself)");let t=e.out_path;t&&await ct(t).then(a=>a.isDirectory).catch(()=>!1)&&(t=M(t,B(e.path)));let r=[G_("primaries",e.primaries,yz),G_("transfer",e.transfer,_z),G_("matrix",e.matrix,vz)],o=await Tr({mode:"retag",master:e.path,out_path:t,in_place:e.in_place??!1,primaries:r[0],transfer:r[1],matrix:r[2]}),n=o.retag,i=n.frames_before.map(a=>`${a.tags.join("/")} \xD7${a.frames}`).join(", ");return{text:`retagged ${o.path} (${o.codec}, no re-encode)
|
|
177
|
+
colr ${n.colr.kind}: ${n.colr.before.join("/")} \u2192 ${n.colr.after.join("/")} (primaries/transfer/matrix)
|
|
178
|
+
frame headers: ${n.frames} frames, ${i} \u2192 ${n.colr.after.join("/")}
|
|
179
|
+
read back: all match`,data:o}}async function J_(e,t,r,o){let n=await Lr();if(!n)throw new P("unsupported",`media_${e==="dcp"?"dcp":"dcp_kdm"} needs the native engine (conformtools-decode), which is not installed here. From a source checkout: cd rust && cargo build --release -p media-native --bin conformtools-decode (or set CONFORM_NATIVE_DECODE); the npm package ships it.`);let i="",a="",s=new TextDecoder,l=await kn(n,[e,JSON.stringify(t)],c=>{i+=s.decode(c,{stream:!0});let u=i.split(`
|
|
180
|
+
`);i=u.pop();for(let d of u){if(!d.trim())continue;let f=d.startsWith('{"progress"')?JSON.parse(d).progress:null;f?r?.(f[0],f[1],"encoding"):a=d}},{signal:o});if(i.trim()&&(a=i),l.code!==0){let c=fa(l.stderr);throw new P(/exists|is required|not ProRes|integer rate|mix is|Hz|not integer PCM|unknown|encrypted|no key|do not fit|fps|not a date|must be after|signing identity|CPL|VF|subtitles/.test(c)?"refused":"engine",c)}return a}async function BP(e,t,r){let o={...e,path:void 0,movie:e.path,out_dir:e.out_dir??ft(e.path)};return JSON.parse(await J_("dcp",o,t,r))}async function VP(e){return JSON.parse(await J_("kdm",e))}function K_(e){let t=o=>`${(o/1e6).toFixed(1)} MB`,r=[`wrote ${e.path}`];if(e.source_dcp)r.push(`from ${e.source_dcp.path}${e.source_dcp.encrypted?" (encrypted)":""}: ${e.frames} frames @ ${e.fps} fps, ${e.reels} reel(s)`),e.patch&&r.push(`patched frames ${e.patch.at}\u2013${e.patch.at+e.patch.count-1} from ${e.patch.movie} (its frames ${e.patch.from}\u2013${e.patch.from+e.patch.count-1}); every other codestream re-wrapped byte-for-byte`),e.carried_reels?.length&&r.push(`reel(s) ${e.carried_reels.join(", ")} carried unchanged`),e.sound_replaced&&r.push("sound replaced from the new mix");else if(e.source&&e.container&&e.audio){let[o,n]=e.container.picture,i=o!==e.container.width||n!==e.container.height?` (picture ${o}x${n}, rest black)`:"";r.push(`${e.frames} frames @ ${e.fps} fps, ${e.container.width}x${e.container.height}${i} from ${e.source.codec} ${e.source.width}x${e.source.height}`,`sound: ${e.audio.channels} ch ${e.audio.rate/1e3} kHz 24-bit (mix was ${e.audio.bits_in}-bit)`),e.reclock&&r.push(`reclocked ${e.reclock.from_fps.toFixed(3)} \u2192 ${e.reclock.to_fps} frame-for-frame; sound ${e.reclock.audio}`)}return r.push(...e.assets.map(o=>` ${o.file} ${t(o.size)} sha1 ${o.hash}`)),e.encrypted?(r.push(`CPL ${e.cpl}; ENCRYPTED (AES-128 + HMAC), CPL/PKL signed by ${e.signer?.subject}`,`content key: ${e.keys} \u2014 the ONLY copy. Keep it with the job; without it this DCP can never play or get a KDM. Do not ship it with the DCP.`),e.signer?.created&&r.push(`new facility signing identity created at ${e.signer.path} (back it up; KDMs are signed with it)`),r.push("next: media_dcp_kdm with keys + the venue's projector certificate")):r.push(`CPL ${e.cpl}; unencrypted OV, unsigned`),r.push(e.valid?`validation: PASS${e.findings.length?` with ${e.findings.length} note(s)`:""}`:"validation: FAIL",...e.findings.map(o=>` ${o.severity} ${o.code}: ${o.message}`)),r.join(`
|
|
181
|
+
`)}function ZP(e){return[`wrote ${e.path}`,`${e.title} (CPL ${e.cpl_id}), ${e.keys} key(s)`,`for ${e.recipient.cn} (${e.recipient.o}, thumbprint ${e.recipient.thumbprint})`,`plays ${e.not_valid_before} \u2192 ${e.not_valid_after} (UTC); signature self-checked`].join(`
|
|
182
|
+
`)}async function GP(e,t,r){if(e.patches?.length||e.mode==="vf"||e.mode==="check"||e.reel!==void 0||typeof e.at=="string"||e.start_tc!==void 0)throw new P("refused","an encrypted patch takes one fix: path + at (a composition frame number), as a new OV; patches=, mode=vf/check, reel= and timecode placement need an unencrypted source");if(!e.title)throw new P("refused","title is required for an encrypted patch (the new package's ContentTitleText)");let{dcp:o,keys:n,encrypt:i,path:a,at:s,color:l,from:c,count:u,wav:d,title:f,out_dir:m,issuer:p}=e,g={dcp:o,keys:n,encrypt:i,movie:a,at:s,color:l,from:c,count:u,wav:d,title:f,issuer:p,out_dir:m??ft(o.replace(/\/+$/,""))};return JSON.parse(await J_("dcp",g,t,r))}async function HP(e,t,r){let o=await Lr();if(!o)throw new P("unsupported","media_dcp_patch needs the native engine (conformtools-decode), which is not installed here. From a source checkout: cd rust && cargo build --release -p media-native --bin conformtools-decode (or set CONFORM_NATIVE_DECODE); the npm package ships it.");let{path:n,at:i,reel:a,color:s,from:l,count:c,patches:u,...d}=e,f=u?.length?u:n?[{path:n,at:i,reel:a,color:s,from:l,count:c}]:[];if(!f.length)throw new P("refused","give the fix as path= (with at=), or several as patches=[{path, at}, \u2026]");let m="",p="",g=new TextDecoder,_=await kn(o,["dcp-patch",JSON.stringify({...d,patches:f})],v=>{m+=g.decode(v,{stream:!0});let y=m.split(`
|
|
183
|
+
`);m=y.pop();for(let b of y){if(!b.trim())continue;let w=b.startsWith('{"progress"')?JSON.parse(b).progress:null;w?t?.(w[0],w[1],"encoding the fix"):p=b}},{signal:r});if(m.trim()&&(p=m),_.code!==0){let v=fa(_.stderr);throw new P(/did not verify/.test(v)?"engine":"refused",v)}return JSON.parse(p)}function WP(e){let t=o=>`${(o/1e6).toFixed(1)} MB`,r=e.mode==="check"?[`check: ${e.ok?"OK":"REFUSED"}, nothing written (would write ${e.would_write}, ${e.package})`]:[`wrote ${e.path} (${e.package}${e.package==="VF"?": plays only with the OV ingested":""})`];r.push(`${e.frames} frames @ ${e.fps} fps, ${e.reels} reel(s); re-wrapped: reel ${e.rewrap_reels.join(", ")||"none"}`);for(let o of e.patches)r.push(` ${o.essence} ${o.frames} frame(s) at ${o.at} (${o.tc}, reel ${o.reel} frame ${o.reel_frame}) from ${o.source} ${o.path?.split("/").pop()??""}`);e.encoded_frames&&r.push(`encoded ${e.encoded_frames} frame(s) of the fix to DCI J2K`);for(let o of e.assets??[])r.push(` ${o.file} ${t(o.size)} ${o.carried?"carried (same bytes)":"new"} sha1 ${o.hash}`);for(let o of e.verify??[])r.push(`${o.code==="VERIFY_OK"?"verified":o.code}: ${o.message}`);return e.decoded_frames&&r.push(`decoded: ${e.decoded_frames} patch and seam frame(s) decode cleanly (our J2K decoder)`),e.valid!==void 0&&r.push(e.valid?`validation: PASS${e.hashes_checked?" (every hash recomputed)":""}${e.findings.length?` with ${e.findings.length} warning(s)`:""}`:"validation: FAIL"),r.push(...e.findings.map(o=>` ${o.severity} ${o.code}: ${o.message}`)),r.join(`
|
|
184
|
+
`)}function Jd(e,t){let r=[...e].sort((o,n)=>o[0]-n[0]);if(t<=r[0][0])return r[0][1];for(let o=1;o<r.length;o++)if(t<=r[o][0])return r[o-1][1]+(r[o][1]-r[o-1][1])*(t-r[o-1][0])/Math.max(1e-9,r[o][0]-r[o-1][0]);return r[r.length-1][1]}function nl(e,t,r,o,n,i,a=0){let s=e.map(([_,v])=>[_,v*n/o]),l=[0,...s.map(_=>_[0]).filter(_=>_>1e-9&&_<t-1e-9),t].filter((_,v,y)=>y.indexOf(_)===v).sort((_,v)=>_-v),c=l.map(_=>Jd(s,_)/100),u=r/n,d=l.map(_=>u+_/o),f=[u];for(let _=1;_<l.length;_++)f.push(f[_-1]+(c[_-1]+c[_])*.5*(l[_]-l[_-1])/n);let m=_=>c[_]*o/n,p=[],g=(_,v,y)=>p.push({id:`${i}-${p.length}`,parameter_path:"speed",time:{value:_,rate:o},value:v,interp:"bezier",tangent_in:null,tangent_out:null,order_index:p.length,raw_extraction:y});if(u>1e-9){let _=u/3;g(0,0,{drtNativeTangent:[0,0,_,_,0,0],speedPreRoll:!0})}for(let _=0;_<l.length;_++){let v=[0,0,0,0,0,0];if(_>0){let b=(d[_]-d[_-1])/3;v[0]=-b,v[1]=-m(_)*b}else if(u>1e-9){let b=u/3;v[0]=-b,v[1]=-b}if(_+1<l.length){let b=(d[_+1]-d[_])/3;v[2]=b,v[3]=m(_)*b}let y=s.find(b=>Math.abs(b[0]-l[_])<1e-9);g(d[_],f[_],y?{drtNativeTangent:v,speedGraphPoint:[l[_],y[1]]}:{drtNativeTangent:v,speedGraphPoint:[l[_],c[_]*100],speedGraphSynth:!0})}return{keyframes:p,sourceFrames:(f[f.length-1]-u)*n}}var rl=class{constructor(t,r,o=100){this.channels=t;this.sampleRate=r;this.hz=o;this.counted=0;this.binSamples=Math.max(1,Math.round(r/o)),this.sums=new Float64Array(t),this.bins=Array.from({length:t},()=>[])}push(t){let r=this.channels,o=Math.floor(t.length/r);for(let n=0;n<o;n++){let i=n*r;for(let a=0;a<r;a++){let s=t[i+a];this.sums[a]+=s*s}++this.counted===this.binSamples&&this.flush()}}flush(){for(let t=0;t<this.channels;t++)this.bins[t].push(Math.sqrt(this.sums[t]/this.counted)),this.sums[t]=0;this.counted=0}finish(){return this.counted>0&&this.flush(),this.bins.map(t=>Float32Array.from(t))}};var Jq=typeof process<"u"&&!!process.env?.CONFORM_PROFILE;function ol(e,t,r,o){if(!r||!o||!(e>0)||!(t>0))return{w:e,h:t};let n=Math.min(e/r,t/o);return{w:r*n,h:o*n}}var lX=180/Math.PI;var il=(e,t)=>`conform-${e}-${t}`,kz=4,$z="1",xz=.025,Sz=.005,Rz=.5,Iz=.001,Tz=.5,Pz=.05;function Az(e,t,r){let o=e.measuredBy==="sizing";if(e.flipH||e.flipV)return!1;let n=o?Iz:xz,i=o?Pz:Rz,a=(s,l)=>!l||(o?Math.abs(s)<Tz:Math.abs(s/l)<Sz);return Math.abs(e.scaleX-1)<n&&Math.abs(e.scaleY-1)<n&&Math.abs(e.rotationDeg)<i&&a(e.dxCenter,t)&&a(e.dyCenter,r)&&!e.perspective}function Ez(e,t,r,o){e.scale=t.scale*100,Math.abs(t.scaleX-t.scaleY)>.001&&(e.scale_x=t.scaleX*100,e.scale_y=t.scaleY*100),r>0&&(e.position_x=t.dxCenter/r),o>0&&(e.position_y=t.dyCenter/o),Math.abs(t.rotationDeg)>.001&&(e.rotation=t.rotationDeg);let n=e;t.flipH&&(n.flip_horizontal=!0),t.flipV&&(n.flip_vertical=!0)}function Oz(e,t,r,o,n,i,a){let s=[],l=r.srcStart??0,c=0;for(let u of t.keyframes){let d=u.refFrame-r.refStart,f=r.srcEnd!=null&&r.refEnd>r.refStart?(r.srcEnd-l)/(r.refEnd-r.refStart):o/(n||o),p={value:l+d*f,rate:o},g=(_,v)=>{s.push({id:`${e}-kf-${c++}`,parameter_path:_,time:p,value:v})};g("scale",u.reframe.scale*100),i>0&&g("position.x",u.reframe.dxCenter/i),a>0&&g("position.y",u.reframe.dyCenter/a),Math.abs(u.reframe.rotationDeg)>.001&&g("rotation",u.reframe.rotationDeg)}return s}function JP(e,t={}){let r=[],o=e.refFps??24,n=bw(o)??{num:24,den:1},i=new Map(e.clips.map(b=>[b.label,b])),a=new Set(e.timeline.filter(b=>b.kind!=="gap"&&b.clipLabel).map(b=>b.clipLabel)),s=[],l=new Map;for(let b of e.clips){if(!a.has(b.label))continue;let w=il("media",b.clipIndex);l.set(b.label,w);let k=b.srcFps??o;s.push({id:w,kind:"external",content_kind:"video",target_url:b.label,display_name:b.label.replace(/\.[^.]+$/,""),source_fps:k,source_timecode:ce(b.srcStartFrame,k,b.srcDropFrame??!1),available_range:{start:{value:0,rate:k},duration:{value:b.srcFrames,rate:k}},source_resolution_w:b.srcW??null,source_resolution_h:b.srcH??null,reel_name:null,raw_extraction:{},metadata:{codec:b.codec}}),b.srcFps&&e.refFps&&Math.abs(b.srcFps-e.refFps)>.01&&r.push({kind:"rate",message:`${b.label} is ${b.srcFps.toFixed(3)} fps against a ${e.refFps.toFixed(3)} fps reference. The cut is written at the reference rate with source ranges in the clip's own rate, but the MATCH was made frame-index to frame-index \u2014 check this clip's in-points before trusting them.`});for(let I of b.warnings)r.push({kind:"rate",message:`${b.label}: ${I}`})}let c=[],u=0,d=0,f=0,m=0,p=0,g=[];for(let b of e.timeline){if(b.kind==="gap"||!b.clipLabel||b.srcStart==null||b.srcStart>=0){g.push(b);continue}let w=i.get(b.clipLabel),k=b.srcEnd!=null&&b.refEnd>b.refStart?(b.srcEnd-b.srcStart)/(b.refEnd-b.refStart):(w?.srcFps??o)/(o||1),I=k>0?Math.ceil(-b.srcStart/k-1e-9):b.refEnd-b.refStart+1;if(I>b.refEnd-b.refStart){g.push({...b,kind:"gap",clipLabel:void 0});continue}r.push({kind:"source-range",refStart:b.refStart,refEnd:b.refStart+I-1,message:`${b.clipLabel}: placed from source frame ${b.srcStart}, before the clip's first frame \u2014 the first ${I} frame(s) are left empty and the clip starts at frame 0. Usually a speed or frame-rate conform (e.g. 25 fps played frame-for-frame); check the shot's timing.`}),g.push({kind:"gap",refStart:b.refStart,refEnd:b.refStart+I-1}),g.push({...b,refStart:b.refStart+I,srcStart:b.srcStart+I*k})}for(let b of g){let w=b.refEnd-b.refStart+1;if(b.kind==="gap"||!b.clipLabel){d+=w,r.push({kind:"gap",refStart:b.refStart,refEnd:b.refEnd,message:`${w} frame(s) with no matching source \u2014 left empty on the timeline.`+(b.nothingSimilar!=null?` Nothing in the media you supplied resembles these frames (best similarity ${b.nothingSimilar.toFixed(2)}) \u2014 stock, graphics, or media that was not in the bucket.`:"")+(b.unconfirmed?` Best guess: ${b.unconfirmed.clipLabel} from source frame ${b.unconfirmed.srcFrame}, but the picture did not confirm it (${b.unconfirmed.why??"often graphics or stock that resembles a camera shot"}) \u2014 check it by eye if a shot is expected here.`:"")});continue}b.kind==="composite"&&r.push({kind:"composite",refStart:b.refStart,refEnd:b.refEnd,message:`split-screen / composite of ${b.regions?.length??0} sources \u2014 emitted as the first region only; rebuild the layout by hand.`});let k=i.get(b.clipLabel),I=l.get(b.clipLabel);if(!k||!I)continue;let x=k.srcFps??o,S=b.speed&&(b.speed.kind==="retime"||b.speed.kind==="reverse")?b.speed.percent/100:1,R=(o>0?w*(x/o):w)*S,$=b.speed?.kind==="reverse"?Math.min(b.srcStart??0,b.srcEnd??b.srcStart??0):b.srcStart??0;b.takeRival&&r.push({kind:"contested",refStart:b.refStart,refEnd:b.refEnd,message:`${b.clipLabel} or ${b.takeRival.clipLabel}? Two takes of one setup explain this shot almost equally (shot-sizing agreement ${b.takeRival.winnerAgreement.toFixed(2)} vs ${b.takeRival.agreement.toFixed(2)}). Conformed from ${b.clipLabel} \u2014 check the take against the offline.`}),b.contest?.settledBy==="label"&&r.push({kind:"contested",refStart:b.refStart,refEnd:b.refEnd,message:`${b.clipLabel} and ${b.contest.rivals.map(q=>q.clipLabel).join(", ")} explain these frames equally well (tied at ${b.contest.winnerScore?.toFixed(1)??"\u2014"} bits). Conformed from ${b.clipLabel} because it sorts first by name \u2014 verify the source timecode.`});let C=il("item",p),E={id:C,kind:"clip",item_index:p++,name:b.clipLabel,enabled:!0,timeline_range:{start:{value:b.refStart,rate:o},duration:{value:w,rate:o}},source_range:{start:{value:$,rate:x},duration:{value:R,rate:x}},media_reference_id:I,raw_extraction:{},metadata:{}},L=b.track;if(L&&L.kind!=="unresolved"&&L.keyframes.length>0&&!(L.kind==="static"&&Az(L.keyframes[L.keyframes.length>>1].reframe,e.refW,e.refH))){let q=L.keyframes[L.keyframes.length>>1],O=ol(e.refW,e.refH,k.srcW,k.srcH);Ez(E,q.reframe,O.w,O.h),f++,L.kind==="animated"&&(m++,E.keyframes=Oz(C,{keyframes:L.keyframes},b,x,o,O.w,O.h),r.push({kind:"reframe",refStart:b.refStart,refEnd:b.refEnd,message:`${b.clipLabel}: animated reframe (${L.keyframes.length} keys: ${L.label}) \u2014 measured, not declared; check the move against the reference.`}))}else L?.kind==="unresolved"&&r.push({kind:"unresolved",refStart:b.refStart,refEnd:b.refEnd,message:`${b.clipLabel}: placed, but its reframe could not be recovered${L.label&&!L.label.startsWith("unresolved")?` (${L.label})`:""} \u2014 the clip is full-frame on the timeline and may need resizing.`});if(b.ramp&&b.ramp.length>=2){let q=nl(b.ramp,w,$,o,x,`${C}-spd`);E.source_range={start:E.source_range.start,duration:{value:Math.max(1,Math.ceil(q.sourceFrames)+1),rate:x}},E.speed_ramped=!0,E.speed=Math.round(100*q.sourceFrames/w*(o/x)*100)/100;let O=E.keyframes??[];E.keyframes=[...O,...q.keyframes.map((G,X)=>({...G,order_index:O.length+X}))],r.push({kind:"retime",refStart:b.refStart,refEnd:b.refEnd,message:`${b.clipLabel}: SPEED RAMP read from the picture \u2014 ${b.ramp.map(([G,X])=>`${X.toFixed(0)}%@${Math.round(G)}`).join(" \u2192 ")}. Check the ramp against the reference.`})}b.speed&&b.speed.kind!=="normal"&&(E.speed=b.speed.percent,E.speed_ramped=!1,b.speed.kind==="reverse"&&(E.speed_reverse=!0),r.push({kind:"retime",refStart:b.refStart,refEnd:b.refEnd,message:b.speed.kind==="freeze"?`${b.clipLabel}: FREEZE FRAME \u2014 the source holds on one frame across ${w} reference frame(s). Emitted at 0% speed; a host may want an explicit freeze instead.`:b.speed.kind==="reverse"?`${b.clipLabel}: REVERSE at ${b.speed.percent.toFixed(1)}% \u2014 the source runs backwards across ${w} reference frame(s), read from the picture. Check the direction and speed against the reference.`:b.speed.basis==="frame-for-frame"?`${b.clipLabel}: plays FRAME FOR FRAME \u2014 one source frame per record frame, ${b.speed.percent.toFixed(1)}% of real time \u2014 measured from the picture at ${b.speed.samples} points. Usually the edit's rate-conform setting, not a retime.`:b.speed.basis==="convention"?`${b.clipLabel}: emitted at ${b.speed.percent.toFixed(1)}% to match the cut's other shots at this frame rate \u2014 this shot's own picture could not tell real time from frame-for-frame. Check its motion against the reference.`:`${b.clipLabel}: retimed to ${b.speed.percent.toFixed(1)}% (fitted over ${b.speed.samples} runs, residual ${b.speed.residual.toFixed(1)} frames). A speed RAMP would not fit one slope \u2014 check it if the residual is high.`})),b.inPointAmbiguity!=null&&b.inPointAmbiguity>=kz?r.push({kind:"ambiguous",refStart:b.refStart,refEnd:b.refEnd,message:`${b.clipLabel}: in-point uncertain \u2014 ${b.inPointAmbiguity} source frames match this shot equally well (the picture barely changes), so its source timecode may be out by up to \xB1${Math.ceil(b.inPointAmbiguity/2)} frames. Check it against the offline.`}):b.inPointUnconfirmed&&r.push({kind:"ambiguous",refStart:b.refStart,refEnd:b.refEnd,message:`${b.clipLabel}: in-point not confirmed \u2014 ${b.takeRival?"and the take itself is contested (see the red marker); ":"the take is right, but "}nothing in the shot (motion, difference mode) pinned the exact frame, so its source timecode may be off. Check it against the offline.`}),c.push(E),u++}let _={id:il("track",1),kind:"Video",track_index:1,name:"V1",enabled:!0,items:c,source_element_id:null,raw_extraction:{},metadata:{}},v={id:il("timeline",1),name:t.name??t.referenceName??"Auto-Conform",kind:"primary",timeline_index:0,fps_num:n.num,fps_den:n.den,resolution_w:e.refW||null,resolution_h:e.refH||null,start_frame:e.refStartFrame,is_drop_frame:e.refDropFrame,duration_frames:e.refFrames,tracks:[_],markers:[],source_element_id:null,raw_extraction:{},metadata:{}};return{session:{projects:[{id:il("project",1),user_id:"",created_at:"",source_format:"auto-conform",source_filename:t.referenceName??null,source_file_sha256:null,source_file_bytes:null,parser_name:"conform-session",parser_version:$z,status:"ready",error_message:null,metadata:{}}],timelines:[v],media_references:s,source_format:"auto-conform",source_filename:t.referenceName??null},issues:r,stats:{placed:u,gapFrames:d,reframed:f,animated:m}}}var Mz={gap:"Green",unresolved:"Red",contested:"Red",composite:"Yellow",rate:"Yellow",reframe:"Yellow",retime:"Yellow",ambiguous:"Yellow","source-range":"Yellow",vfx:"Cyan"},Cz={gap:"NO SOURCE",unresolved:"REFRAME UNRESOLVED",contested:"CONTESTED SOURCE",composite:"COMPOSITE",rate:"RATE",reframe:"REFRAME",retime:"RETIME",ambiguous:"IN-POINT UNCERTAIN","source-range":"SOURCE RANGE",vfx:"VFX / CLEANUP"};function Dz(e,t){return e.map((r,o)=>{let n=r.refStart??0,i=r.refEnd!=null&&r.refStart!=null?r.refEnd-r.refStart+1:1;return{id:`conform-marker-${o}`,name:Cz[r.kind]??r.kind.toUpperCase(),color:Mz[r.kind]??"Yellow",kind:null,note:r.message,time:{value:n,rate:t},duration:{value:Math.max(1,i),rate:t},item_id:null,raw_extraction:{},source_element_id:null,metadata:{}}})}function KP(e,t){let r=(e.timelines??[])[0];if(!r||t.length===0)return e;let o=Ze(r);return{...e,timelines:[{...r,markers:[...r.markers??[],...Dz(t,o)]},...(e.timelines??[]).slice(1)]}}var jz=.02,X_=100,Nz="the lowest enabled video track is read as the picture spine; anything on the tracks above it (titles, graphics, split-screens) is not hinted and falls to the pixel search";function qP(e){return e&&e.split(/[\\/]/).pop()||null}function tr(e,t){if(!e||!Number.isFinite(e.value))return 0;let r=e.rate&&Number.isFinite(e.rate)&&e.rate>0?e.rate:t;return Math.round(e.value*(t/r))}function XP(e){let t=e,r=(o,n)=>o!=null&&Number.isFinite(o)&&Math.abs(o-n)>1e-6;return r(t.scale,X_)||r(t.scale_x,X_)||r(t.scale_y,X_)||r(t.position_x,0)||r(t.position_y,0)||r(t.rotation,0)}var Fz=3;function Lz(e){let t=e;return(t.scale??100)>=100&&Math.abs(t.position_x??0)<1&&Math.abs(t.position_y??0)<1&&(t.opacity??100)>=100&&!(t.crop_left||t.crop_right||t.crop_top||t.crop_bottom)}function zz(e){let r=(e.tracks??[]).filter(o=>o.kind==="Video"&&o.enabled!==!1).sort((o,n)=>o.track_index-n.track_index).filter(o=>(o.items??[]).some(n=>n.kind==="clip"));return{track:r[0]??null,extraVideo:Math.max(0,r.length-1)}}function Uz(e,t,r){return!r||r<=0||!e.length?0:Math.min(...e.map(n=>tr(n.timeline_range?.start,t)))>=r-1?r:0}function YP(e,t,r={}){let o=[],n=(e.timelines??[]).filter(k=>k.kind!=="compound"),i=(t?n.find(k=>k.name===t):null)??n[0]??(e.timelines??[])[0];if(!i)return{timelineName:"",timelineId:null,startOffset:0,fps:0,frames:0,shots:[],cuts:[],warnings:["no timeline in this file"]};n.length>1&&o.push(`this file holds ${n.length} sequences \u2014 hinting from "${i.name}". If that is not the cut you rendered, the claims below will disagree with the picture everywhere.`);let a=Ze(i),{track:s,extraVideo:l}=zz(i);if(!s)return{timelineName:i.name,timelineId:i.id??null,startOffset:0,fps:a,frames:i.duration_frames??0,shots:[],cuts:[],warnings:[...o,"no video track with clips \u2014 nothing to hint from"]};let c=r.allTracks?(i.tracks??[]).filter(k=>k.kind==="Video"&&k.enabled!==!1):[s];l>0&&o.push(r.allTracks?`${l} video track(s) above the spine \u2014 their clips are hinted too, each checked against the picture like any other claim.`:`${l} video track(s) above the spine \u2014 ${Nz}.`);let u=c.flatMap(k=>k.items??[]).sort((k,I)=>tr(k.timeline_range?.start,a)-tr(I.timeline_range?.start,a)),d=Uz(u,a,i.start_frame??0);d>0&&o.push(`item times carry the timeline's start timecode (${d} frames); removed so they line up with a render that begins at its first frame.`);let f=new Map((e.media_references??[]).map(k=>[k.id,k])),m=new Map;for(let k of c)for(let I of k.items??[])m.set(I,k.track_index);let p=[];for(let k of c)for(let I of k.items??[]){if(I.enabled===!1||I.kind!=="clip"||!Lz(I))continue;let x=I.media_reference_id?f.get(I.media_reference_id):void 0;if(x?.content_kind==="still"||/\.(png|webp|tiff?|psd|exr|dpx|gif|jpe?g)$/i.test(x?.target_url??x?.display_name??""))continue;let S=tr(I.timeline_range?.start,a)-d,R=tr(I.timeline_range?.duration,a);R>0&&p.push({track:k.track_index,lo:S,hi:S+R-1})}let g=(k,I,x)=>{let S=[[k,I]];for(let R of p)R.track<=x||(S=S.flatMap(([$,C])=>{if(R.hi<$||R.lo>C)return[[$,C]];let E=[];return R.lo>$&&E.push([$,R.lo-1]),R.hi<C&&E.push([R.hi+1,C]),E}));return S.filter(([R,$])=>$-R+1>=Fz)},_=[],v=0,y=0,b=0,w=0;for(let k of u){if(k.enabled===!1){y++;continue}if(k.kind==="nested"||k.nested_timeline_id){v++;continue}if(k.kind!=="clip"){b++;continue}let I=tr(k.timeline_range?.start,a)-d,x=tr(k.timeline_range?.duration,a);if(x<=0){b++;continue}let S=k.media_reference_id?f.get(k.media_reference_id):void 0,R=qP(S?.local_path)??qP(S?.target_url)??S?.display_name??null,$=k.name??null,C=k.reel_name??S?.reel_name??null;if(!R&&!$&&!C){w++;continue}let E=k.source_range?.start?.rate||a,L=tr(k.source_range?.start,E),q=tr(k.source_range?.duration,E),O=x>0&&q>0?q/x:1,G=Math.abs(O-1)>jz?O:null,X=m.get(k)??0,ae=S?.source_timecode?yw(S.source_timecode,E):null;for(let[Y,j]of g(I,I+x-1,X)){let V=Math.round((Y-I)*O);_.push({index:_.length,itemId:k.id??null,refStart:Y,refEnd:j,clipName:$,reelName:C,sourceFilename:R,srcStart:L+V,srcTimecode:ae?ae.frames+L+V:null,srcRate:E,srcDropFrame:ae?.drop??!1,declaredReframe:XP(k),declaredTransform:XP(k)?{scale:k.scale,scale_x:k.scale_x,scale_y:k.scale_y,position_x:k.position_x,position_y:k.position_y,rotation:k.rotation}:null,declaredSpeed:G})}}return v&&o.push(`${v} nested/compound clip(s) not expanded \u2014 their shots fall to the pixel search rather than being hinted from the wrapper's own range, which would be wrong.`),y&&o.push(`${y} disabled clip(s) ignored.`),b&&o.push(`${b} non-clip item(s) (transitions, gaps) ignored.`),w&&o.push(`${w} clip(s) name no source at all \u2014 no file, no reel, no clip name. Nothing to bind them to, so they go to the pixel search.`),{timelineName:i.name,timelineId:i.id??null,startOffset:d,fps:a,frames:i.duration_frames??(_.length?_[_.length-1].refEnd+1:0),shots:_,cuts:[...new Set(_.slice(1).map(k=>k.refStart))].sort((k,I)=>k-I),warnings:o}}var LX=8*1024*1024;var Kz=new Set(["mov","mp4","m4v","r3d","mxf","braw","ari","arx","arri","crm"]),Y_=e=>e.split(".").pop()?.toLowerCase()??"",Q_=e=>Kz.has(Y_(e)),QP=new Set(["mov","mp4","m4v"]),Kd=e=>(e.split(/[\\/]/).pop()??e).replace(/\.[^.]+$/,"").toUpperCase();function eA(e,t){let r=new Set(e.map(t).filter(a=>!QP.has(Y_(a))).map(Kd)),o=new Set(e.map(t).map(Kd)),n=[],i=[];for(let a of e){let s=t(a),l=/^(.*)_TRIM_\d+-\d+$/.exec(Kd(s))?.[1];(QP.has(Y_(s))&&r.has(Kd(s))||l!=null&&o.has(l)?i:n).push(a)}return{kept:n,proxies:i}}var qd="autoconform",qz=new Set(["ambiguous","speed_unobservable"]),tA=["kind","clipLabel","srcStart","srcEnd","track","speed"],nA=(e,t)=>e.refStart<=t&&t<=e.refEnd;function ta(e){return e.report.timeline.flatMap(t=>{let r={ref_start:t.refStart,ref_end:t.refEnd};if(t.kind==="gap"&&t.unconfirmed)return[{...r,kind:"gap_guess",clip:t.unconfirmed.clipLabel,src_frame:Math.round(t.unconfirmed.srcFrame),why:t.unconfirmed.why??"the picture did not confirm it"}];if(t.kind==="gap"||!t.clipLabel||t.srcStart==null)return[];if(e.alignIssues.some(i=>i.kind==="reviewed"&&i.refStart===t.refStart))return[];let n=e.alignIssues.find(i=>qz.has(i.kind)&&nA(t,i.refStart))?.message??(t.takeRival?`another take (${t.takeRival.clipLabel}) explains it nearly as well`:null);return n?[{...r,kind:"doubtful",clip:t.clipLabel,src_frame:Math.round(t.srcStart),why:n}]:[]})}async function Xz(e,t,r){let o=e.pool.find(c=>B(c)===t.clip);if(!o)throw new P("not_found",`${t.clip} is not in the pool this conform ran on`);let n=Math.max(1,Math.floor((t.ref_end-t.ref_start)/4)),i=t.ref_start+2*n,a=r.unconfirmed?.placed??r,s=a.srcEnd!=null&&a.srcStart!=null&&t.ref_end>t.ref_start?(a.srcEnd-a.srcStart)/(t.ref_end-t.ref_start):1;return(await ha({path:e.reference,frame:i,around:2*n,step:n,b:o,b_frame:Math.max(0,Math.round(t.src_frame+(i-t.ref_start)*s)),width:192})).out_path}function Yz(e,t,r){let o=ta(e),n=[];for(let i of[...t,...r]){let a=t.includes(i)?"gap_guess":"doubtful";if(!o.some(s=>s.ref_start===i&&s.kind===a))throw new P("invalid_args",`${i} is not a ${a==="gap_guess"?"gap with a guess (accept)":"doubtful shot (reject)"}; review shots: ${o.map(s=>`${s.ref_start} ${s.kind}`).join(", ")||"none"}`)}for(let i of e.report.timeline)if(t.includes(i.refStart)&&i.unconfirmed){let a=i.unconfirmed;Object.assign(i,a.placed??{kind:"static",clipLabel:a.clipLabel,srcStart:a.srcFrame,srcEnd:a.srcFrame+(i.refEnd-i.refStart)}),delete i.unconfirmed,e.alignIssues.push({kind:"reviewed",refStart:i.refStart,refEnd:i.refEnd,message:`${a.clipLabel} from source frame ${Math.round(a.srcFrame)}: the engine could not confirm it; placed on review from the contact sheet; check the in-point.`}),n.push(`accepted ${i.refStart}-${i.refEnd} ${a.clipLabel}@${Math.round(a.srcFrame)}`)}else if(r.includes(i.refStart)&&i.clipLabel&&i.srcStart!=null){let a=Object.fromEntries(tA.map(s=>[s,i[s]]));i.unconfirmed={clipLabel:i.clipLabel,srcFrame:i.srcStart,why:"rejected on review",placed:a};for(let s of tA)s!=="kind"&&delete i[s];i.kind="gap",e.alignIssues=e.alignIssues.filter(s=>!nA(i,s.refStart)),n.push(`rejected ${i.refStart}-${i.refEnd} ${a.clipLabel}@${Math.round(a.srcStart)}`)}return n}function Qz(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}async function rA(e){let t=await gw(e.session_id,qd);if(!t)throw new P("not_found",`session ${e.session_id} was not made by timeline_autoconform (0.6.4 or later), so there is nothing to review`);let r=[];if(e.accept?.length||e.reject?.length){r=Yz(t,e.accept??[],e.reject??[]);let l=await Fe(e.session_id);l.session=ev(t).session,await yl(e.session_id,qd,t),await ht(l,`autoconform review: ${r.join("; ")}`)}let o=ta(t),n=e.offset??0,i=o.slice(n,n+(e.limit??4)),a=new Map(t.report.timeline.map(l=>[l.refStart,l])),s=[];for(let l of i)try{l.sheet=await Xz(t,l,a.get(l.ref_start)),s.push({data:Qz(await ut(l.sheet)),mimeType:"image/png"})}catch(c){l.why+=` (no contact sheet: ${c instanceof Error?c.message:c})`}return{settled:r,shots:o.length,from:n,review:i,images:s}}function oA(e){return[...e.settled,e.shots?`${e.shots} shot(s) to review${e.review.length?`; showing ${e.from+1}\u2013${e.from+e.review.length}`:""}`:"nothing left to review",...e.review.map(t=>`- ${t.ref_start}-${t.ref_end} ${t.kind==="gap_guess"?"GAP, guess":"PLACED, doubtful"}: ${t.clip} from source frame ${t.src_frame}: ${t.why}${t.sheet?`
|
|
185
|
+
image ${e.review.filter(r=>r.sheet).indexOf(t)+1}: ${t.sheet} (top row = reference, bottom = ${t.clip})`:""}`),...e.review.length?["Look at each sheet. Same shot, same moment? gap_guess \u2192 accept=[ref_start]; doubtful and clearly another shot or moment \u2192 reject=[ref_start]. Only decide when sure; otherwise leave it and tell the artist which shots to check (identical-looking takes of one setup are theirs to call)."]:[]].join(`
|
|
186
|
+
`)}async function tv(e,t=4e3){let r=[],o=new Set;async function n(a){let s=await pa(a).catch(()=>[a]);o.has(s[0])||(s.forEach(l=>o.add(l)),r.push(s[0]))}async function i(a,s){if(!(s>10||r.length>=t))for await(let l of je(a)){if(l.name.startsWith("."))continue;let c=M(a,l.name);if(l.isDirectory?await i(c,s+1):l.isFile&&Q_(l.name)&&await n(c),r.length>=t)return}}for(let a of e)if((await ct(a)).isDirectory)await i(a,0);else if(Q_(B(a)))await n(a);else throw new Error(`not a conformable media file: ${a}`);return eA(r,a=>a).kept}async function Xd(e){let t=await tv(e.pool);if(!t.length)throw new Error("pool is empty \u2014 no mov/mp4/r3d/mxf/braw/ari/crm files found");let r=[...t].sort((l,c)=>B(l).localeCompare(B(c))),o=e.hints?(await x0(e.hints))?.session??e.hints:void 0,n=o?YP(o,void 0,{allTracks:!0}).shots:[],i=performance.now(),a=l=>console.error(`[time] ${l} ${((performance.now()-i)/1e3).toFixed(1)} s`),s=await gl({reference:e.reference,clips:r,lite:!0,display:!!e.display_transform});try{let l=await s.ask({op:"autoconform",claims:n,referenceAudio:e.reference_audio??e.reference,sizing:e.sizing!==!1,trust:!!e.trust},(g,_,v)=>{e.signal?.throwIfAborted(),e.onProgress?.(g,_,v==="index"?`index: ${g} of ${_} clips`:v)});if(!l.ok)throw new Error(`analysis engine: ${l.why??l.miss}`);for(let g of l.laps)a(`engine: ${g}`);Ke("CONFORM_DEBUG_NOMINATIONS")&&l.soundLog.length&&console.error(`[sound] ${l.soundLog.join(" | ")}`);let c=l.report,u={...c,clips:c.clips.map(g=>({clipIndex:g.clip,label:g.label,shots:[],coverage:0,srcFps:g.srcFps,srcStartFrame:g.srcStartFrame,srcFrames:g.srcFrames,srcW:g.srcW,srcH:g.srcH,codec:g.codec,warnings:[]}))},d={reference:e.reference,name:e.name??`${B(e.reference)} auto conform`,pool:r,rotated:l.rotated,alignIssues:l.issues,report:u},{session:f,issues:m,stats:p}=ev(d);return{session:f,report:u,rebuild:d,issues:m,stats:p,pool:r,unreadable:l.unreadable}}finally{s.close()}}function ev(e){let{report:t}=e,r=new Set(e.rotated),o=JP(t,{name:e.name,referenceName:B(e.reference)});for(let a of o.session.timelines[0]?.tracks[0]?.items??[]){let s=Math.round(a.timeline_range?.start.value??-1);r.has(s)&&!t.timeline.find(l=>l.refStart===s)?.track&&(a.rotation=180)}o.issues.push(...e.alignIssues);let n=KP(o.session,o.issues),i=new Map(e.pool.map(a=>[B(a),a]));for(let a of n.media_references??[]){let s=i.get(B(a.target_url??""))??i.get(a.reel_name??"");s&&(a.target_url=s,a.local_path=s)}return{session:n,issues:o.issues,stats:o.stats}}function iA(e){let t=new Set(e.issues.map(r=>r.kind));return(e.report.timeline??[]).some(r=>r.kind==="gap")&&t.add("gap"),e.unreadable?.length&&t.add("unreadable"),ta(e.rebuild).length&&t.add("review"),t}function aA(e){let t=e.report,r=t.timeline??[],o={};for(let a of r)o[a.kind??"?"]=(o[a.kind??"?"]??0)+1;let n=e.issues,i={};for(let a of n)i[a.kind]=(i[a.kind]??0)+1;return[`reference ${t.refFrames??"?"} frames @ ${t.refFps??"?"} fps; pool ${e.pool.length} clip(s)${t.triage?` (examined ${t.triage.examined??"?"}, skipped ${t.triage.skipped??0})`:""}`,...e.unreadable?.length?[`unreadable pool files (left out): ${e.unreadable.length} \u2014 ${e.unreadable.slice(0,5).map(a=>`${B(a.path)}: ${a.error.slice(0,80)}`).join("; ")}${e.unreadable.length>5?"; \u2026":""}`]:[],`timeline segments: ${Object.entries(o).map(([a,s])=>`${s} ${a}`).join(", ")}`,`stats: ${JSON.stringify(e.stats)}`,`issues: ${n.length?Object.entries(i).map(([a,s])=>`${s} ${a}`).join(", "):"none"}`,...n.slice(0,25).map(a=>`- [${a.kind}] ${a.message??a.note??""}${a.refStart!=null?` @ ${a.refStart}${a.refEnd!=null?`\u2013${a.refEnd}`:""}`:""}`)].join(`
|
|
187
|
+
`)}var sl=["plain","short","jump","lookalike","punch_in","turned","animated","offrate","retime","ramp","pip","gap","lower_third","locator","title","frankenbite"],na={plain:{plain:1},hard:{plain:2,short:3,jump:2,lookalike:3,punch_in:2,turned:1,animated:1,offrate:1,gap:1},all:{plain:2,short:3,jump:2,lookalike:3,punch_in:2,turned:1,animated:1,offrate:1,retime:1,ramp:1,pip:1,gap:1,lower_third:1,locator:1,title:1},speed:{plain:1,offrate:3,retime:3,ramp:3},sound:{plain:2,short:1,jump:2,lookalike:3,punch_in:1,frankenbite:2},graphics:{plain:1,lower_third:3,locator:3,title:2}},nv=new Set(["lower_third","locator","title"]),sA=["MARIA ALVAREZ","DR. JAMES OKAFOR","SARAH CHEN","TOM WHITFIELD","ANA LUCIA REYES","MARCUS BELL"],lA=["Small Business Owner","Emergency Physician","City Council Member","Rancher, 4th Generation","Teacher","Veteran, U.S. Army"],cA=["AUSTIN, TEXAS","LOCKHART, TX","SAN MARCOS","CALDWELL COUNTY","HOUSTON, TEXAS","WEST TEXAS"],uA=["STRONGER TOGETHER","THE ROAD AHEAD","PLANNING AHEAD","RIGHT HERE AT HOME","VOTE NOVEMBER 5"];var e6=(e,t)=>e.path<t.path?-1:e.path>t.path?1:0;function t6(e){let t=[],r=[],o=new Map;for(let{path:n,ref:i}of[...e].sort(e6)){let a=i.available_range?.duration?.value??0,s=i.available_range?.duration?.rate||i.source_fps||0;if(!s||a<s*5||!i.source_resolution_w){r.push({path:n,reason:"too short or no picture"});continue}let l=n.slice(0,n.lastIndexOf("/")),c=o.get(l)??0;o.set(l,c+1);let u=Rw(i);t.push({path:n,dir:l,idx:c,frames:a,rate:s,w:i.source_resolution_w,h:i.source_resolution_h??0,sound:u})}return{clips:t,skipped:r}}function n6(e){let t=e>>>0,r=()=>{t=t+1831565813>>>0;let o=t;return o=Math.imul(o^o>>>15,o|1),o^=o+Math.imul(o^o>>>7,o|61),((o^o>>>14)>>>0)/4294967296};return{next:r,int:(o,n)=>o+Math.floor(r()*(n-o+1)),pick:o=>o[Math.floor(r()*o.length)],range:(o,n)=>o+r()*(n-o)}}function dA(e){let t=typeof e=="object"&&e!==null?e:na[e??"hard"];if(!t)throw new Error(`unknown mix '${e}' (presets: ${Object.keys(na).join(", ")})`);return t}function Yd(e){let t=dA(e),r=sl.filter(o=>(t[o]??0)>0);if(!r.length)throw new Error("the mix weights no class");return r}function r6(e,t){let r=n6(e.seed),o=e.fps_num??24e3,n=e.fps_den??1001,i=e.width??1920,a=e.height??1080,s=o/n,l=dA(e.mix),c=Yd(e.mix),u=c.reduce((S,R)=>S+l[R],0),d=()=>{let S=r.next()*u;for(let R of c)if((S-=l[R])<0)return R;return c[c.length-1]};if(!t.length)throw new Error("no usable clips");let f=t.filter(S=>Math.abs(S.rate-s)>.01),m=[],p=e.shots??24,g=0,_=null,v=0,y=(S,R,$)=>Math.max(1,Math.round(R*(S.rate/s)*($/100))),b=S=>Math.ceil(S.rate*Math.min(12,Math.max(2,.15*S.frames/S.rate))),w=(S,R,$)=>(e.avoid??[]).some(C=>C.path===S&&R<C.to&&R+$>C.from),k=(S,R)=>{let $=b(S),C=S.frames-Math.ceil(S.rate)-R;if(C<=$)return-1;for(let E=0;E<24;E++){let L=r.int($,C);if(!w(S.path,L,R))return L}return-1},I=(S,R,$)=>{let C=0;for(let E=0;E<R;E++)C+=Jd($,E+.5)/100;return Math.max(1,Math.ceil(C*(S.rate/s))+1)},x=[];for(let S=0;S<p;S++){let R=d(),$=[R];R==="gap"&&(g+=r.int(6,48));let C=R==="short"||R!=="plain"&&R!=="ramp"&&!nv.has(R)&&r.next()<.2;C&&R!=="short"&&$.push("short");let E=R==="ramp"?r.int(60,144):nv.has(R)?r.int(48,120):C?r.int(4,23):R==="plain"?r.int(24,120):24+Math.floor(r.next()**2*96),L,q=r.pick(t),O=100,G=-1,X={};if(R==="jump"&&_){q=_.clip;let Z=_.srcOut+r.int(6,120);Z+y(q,E,100)<q.frames-q.rate&&!w(q.path,Z,y(q,E,100))&&(G=Z)}else if(R==="lookalike"&&_){let Z=t.filter(Q=>Q.dir===_.clip.dir&&Q!==_.clip).sort((Q,ne)=>Math.abs(Q.idx-_.clip.idx)-Math.abs(ne.idx-_.clip.idx));Z.length&&(q=Z[Math.min(Z.length-1,r.int(0,2))])}else if(R==="offrate"&&f.length)q=r.pick(f),O=r.next()<.6?Math.round(s/q.rate*1e4)/100:100;else if(R==="retime")O=r.pick([25,50,150,200]);else if(R==="ramp"){let Z=Math.round(E*r.range(.2,.4)),Q=Math.round(E*r.range(.6,.8));L=r.pick([[[Z,100],[Q,40]],[[Z,40],[Q,100]],[[Z,100],[Q,200]],[[Z,200],[Q,100]],[[0,100],[Z,100],[Math.round((Z+Q)/2),30],[Q,100]]])}R==="jump"&&G<0&&($[0]="plain"),R==="lookalike"&&(!_||q.dir!==_.clip.dir)&&($[0]="plain"),R==="offrate"&&O===100&&Math.abs(q.rate-s)<.01&&($[0]="plain");let ae=L?I(q,E,L):y(q,E,O);if(G<0&&(G=k(q,ae)),G<0){if(++v>p*50)throw new Error("the clips are too short for this mix");S--;continue}let Y=Z=>(Z/100-1)/2*.8;if(R==="punch_in"){let Z=Math.round(r.range(110,200));Object.assign(X,{scale:Z,position_x:Math.round(r.range(-1,1)*Y(Z)*i),position_y:Math.round(r.range(-1,1)*Y(Z)*a)})}else if(R==="turned")if(r.next()<.35)Object.assign(X,r.next()<.7?{flip_h:!0}:{flip_v:!0});else{let Z=Math.round(r.range(1,6)*10)/10*(r.next()<.5?-1:1);Object.assign(X,{rotation:Z,scale:Math.round(100+Math.abs(Z)*4)})}else if(R==="animated")if(r.next()<.5)Object.assign(X,{scale:100,scale_end:Math.round(r.range(115,150))});else{let Z=Math.round(r.range(125,150)),Q=Y(Z)*i;Object.assign(X,{scale:Z,position_x:Math.round(-Q),position_x_end:Math.round(Q)})}let j=e.audio&&q.sound&&O===100&&!L&&Math.abs(q.rate-s)<.01,V;if(R==="frankenbite")if(!j)$[0]="plain";else{let Z=t.filter(ye=>ye.dir===q.dir&&ye!==q&&ye.sound&&Math.abs(ye.rate-s)<.01),Q=Z.length&&r.next()<.6?r.pick(Z):q,ne=k(Q,ae);ne>=0&&(Q!==q||Math.abs(ne-G)>48)?V={path:Q.path,source_in:ne}:$[0]="plain"}if(m.push({path:q.path,source_in:G,duration:E,at:g,track:1,...O!==100?{speed:O}:{},...L?{ramp:L}:{},...j?{audio:!0}:{},...V?{audio_from:V}:{},...X,classes:$,record_in:g,record_out:g+E}),nv.has(R)){let Z=g+Math.floor(E*r.range(0,.2)),Q=g+E-Math.floor(E*r.range(0,.15)),ne=r.int(0,sA.length-1),ye=R==="lower_third"?`${sA[ne]}
|
|
188
|
+
${lA[r.int(0,lA.length-1)]}`:R==="locator"?cA[r.int(0,cA.length-1)]:uA[r.int(0,uA.length-1)];x.push({kind:R,text:ye,at:Z,duration:Math.max(12,Q-Z),track:3})}if(R==="pip"&&E>=12){let Z=r.pick(t),Q=Math.max(8,Math.floor(E*r.range(.5,1))),ne=k(Z,y(Z,Q,100));if(ne>=0){let ye=Math.round(r.range(25,45)),Be=(1-ye/100)/2*.85,Ve=g+Math.floor((E-Q)*r.next());m.push({path:Z.path,source_in:ne,duration:Q,at:Ve,track:2,scale:ye,position_x:Math.round((r.next()<.5?-1:1)*Be*i),position_y:Math.round((r.next()<.5?-1:1)*Be*a),classes:["pip"],record_in:Ve,record_out:Ve+Q})}}_={clip:q,srcOut:G+ae},g+=E}return{shots:m,titles:x}}function al(e,t,r){let o=Tw(t);if(!o)throw new Error(`unknown operation '${t}'; known: ${Object.keys(Iw).join(", ")}`);return o(e,r)}function rv(e,t){let r={projects:[],timelines:[],media_references:[]},o="author-tl";al(r,"new_timeline",{timeline_id:o,name:e.name,fps_num:e.fps_num,fps_den:e.fps_den,resolution_w:e.width,resolution_h:e.height,start_frame:e.start_frame,is_drop_frame:e.drop_frame});let n=r.timelines.find(c=>c.id===o),i=e.fps_num/e.fps_den,a=()=>n.tracks.filter(c=>c.kind==="Video"),s=new Map,l=[];for(let[c,u]of e.shots.entries()){let d=Math.max(1,u.track??1);for(;a().length<d;)al(r,"add_track",{timeline_id:o,kind:"Video"});let f=a()[d-1],m=s.get(u.path);m||s.set(u.path,m=t(u.path));let p=m.available_range,g=p?.duration?.rate||m.source_fps||i,_=p?.duration?.value??1/0,v=u.speed??100,y=u.ramp?nl(u.ramp,u.duration,u.source_in,i,g,"spd"):null,b=y?Math.max(1,Math.ceil(y.sourceFrames)+1):Math.max(1,Math.round(u.duration*(g/i)*(v/100)));if(u.source_in<0||u.source_in+b>_)throw new Error(`shot ${c+1} (${m.id}): source ${u.source_in}+${b} is outside the clip (0\u2013${_-1})`);let w=al(r,"add_clip",{timeline_id:o,media_reference_id:m.id,media_reference:m,source_start:(p?.start?.value??0)+u.source_in,source_duration:u.duration,at_frame:u.at,track_id:f.id,without_audio:!u.audio}),k=w.meta?.item_id,I=f.items.find(E=>E.id===k);if(!I)throw new Error(`shot ${c+1}: ${w.summary}`);I.source_range={start:I.source_range.start,duration:{value:b,rate:g}};let x=w.meta?.audio_item_id;if(x&&u.audio_from){let E=n.tracks.flatMap(q=>q.items).find(q=>q.id===x),L=s.get(u.audio_from.path);if(L||s.set(u.audio_from.path,L=t(u.audio_from.path)),E){r.media_references.some(O=>O.id===L.id)||r.media_references.push(L),E.media_reference_id=L.id,E.name=L.id;let q=L.available_range?.duration?.rate||L.source_fps||i;E.source_range={start:{value:(L.available_range?.start?.value??0)+u.audio_from.source_in,rate:q},duration:{value:u.duration*(q/i),rate:q}}}}y?(I.speed_ramped=!0,I.speed=Math.round(100*y.sourceFrames/u.duration*(i/g)*100)/100):v!==100&&(I.speed=v);let S=ol(e.width,e.height,m.source_resolution_w,m.source_resolution_h);(u.scale!=null||u.position_x!=null||u.position_y!=null||u.rotation!=null)&&al(r,"transform",{timeline_id:o,item_id:I.id,...u.scale!=null?{scale:u.scale}:{},...u.position_x!=null?{position_x:u.position_x/S.w}:{},...u.position_y!=null?{position_y:u.position_y/S.h}:{},...u.rotation!=null?{rotation:u.rotation}:{}});let R=[["scale",u.scale??100,u.scale_end,E=>E],["position.x",u.position_x??0,u.position_x_end,E=>E/S.w],["position.y",u.position_y??0,u.position_y_end,E=>E/S.h],["rotation",u.rotation??0,u.rotation_end,E=>E]],$=[];for(let[E,L,q,O]of R)if(q!=null)for(let[G,X]of[[0,L],[b-1,q]])$.push({id:`${I.id}-kf-${$.length}`,parameter_path:E,time:{value:I.source_range.start.value+G,rate:g},value:O(X),interp:"linear",order_index:$.length,raw_extraction:{}});if(y)for(let E of y.keyframes)$.push({...E,id:`${I.id}-${E.id}`,order_index:$.length});$.length&&(I.keyframes=$);let C=I;u.flip_h&&(C.flip_horizontal=!0),u.flip_v&&(C.flip_vertical=!0),l.push(`${c+1}. V${d} @${I.timeline_range.start.value} ${u.duration}f ${m.id} src+${u.source_in}${v!==100?` ${v}%`:""}${u.scale!=null?` scale ${u.scale}`:""}${u.rotation?` rot ${u.rotation}`:""}${u.flip_h?" flipH":""}${u.flip_v?" flipV":""}${u.audio?u.audio_from?` sound from ${u.audio_from.path.split("/").pop()}+${u.audio_from.source_in}`:" +sound":""}${y?` ramp ${u.ramp.map(([E,L])=>`${L}%@${E}`).join("\u2192")}`:""}${$.length&&!y?` animated (${$.length/2} params)`:""}`)}for(let[c,u]of(e.titles??[]).entries()){for(;a().length<u.track;)al(r,"add_track",{timeline_id:o,kind:"Video"});let d=a()[u.track-1],f=e.height/1080,m={font:"Arial",raster_w:e.width,raster_h:e.height,color:"#FFFFFF",opacity:1,shadow_color:"#000000",shadow_opacity:.6,shadow_dx:2*f,shadow_dy:2*f,shadow_blur:4*f,source_tool:"Resolve Text+"},p=u.kind==="lower_third"?{font_style:"Bold",size:52*f,align:"left",anchor_x:.08,anchor_y:.8,anchor_ref:"baseline"}:u.kind==="locator"?{font_style:"Regular",size:40*f,align:"left",anchor_x:.06,anchor_y:.1,anchor_ref:"baseline",tracking:.08}:{font_style:"Bold",size:110*f,align:"center",anchor_x:.5,anchor_y:.5,anchor_ref:"center"};d.items.push({id:`${o}-title-${c}`,kind:"clip",item_index:d.items.length,name:u.text.split(`
|
|
189
|
+
`)[0],enabled:!0,timeline_range:{start:{value:u.at,rate:i},duration:{value:u.duration,rate:i}},title:{text:u.text,...m,...p}}),l.push(`T${c+1}. V${u.track} @${u.at} ${u.duration}f ${u.kind} "${u.text.replace(`
|
|
190
|
+
`," / ")}"`)}return{session:r,summary:l}}function mA(e,t){Yd(e.mix);let{clips:r,skipped:o}=t6(t);if(!r.length)throw new Error(`no usable clips (${o.length} skipped)`);let{shots:n,titles:i}=r6(e,r),a=e.fps_num??24e3,s=e.fps_den??1001,l=e.width??1920,c=e.height??1080,u=new Map(t.map(p=>[p.path,p.ref])),d=e.name??`generated ${e.seed}`,{session:f,summary:m}=rv({name:d,fps_num:a,fps_den:s,width:l,height:c,shots:n.map(({classes:p,record_in:g,record_out:_,...v})=>v),titles:i},p=>u.get(p));return{session:f,summary:m,shots:n,titles:i,pool:{used:r.length,skipped:o}}}async function ll(e){if(e.start_tc){let o=qe(e.start_tc,e.fps_num/e.fps_den);if(o==null)throw new Error(`start_tc: cannot parse '${e.start_tc}' (HH:MM:SS:FF, ';' before FF for drop frame)`);e={...e,start_frame:o,drop_frame:e.drop_frame??e.start_tc.includes(";")}}let t=new Map;for(let o of e.shots)if(!t.has(o.path))try{t.set(o.path,await Pe(o.path))}catch(n){t.set(o.path,n instanceof Error?n:new Error(String(n)))}let r=new Set;for(let o of t.values()){if(o instanceof Error)continue;let n=o.id,i=2;for(;r.has(n);)n=`${o.id} (${i++})`;r.add(o.id=n)}return rv(e,o=>{let n=t.get(o);if(n instanceof Error)throw n;return n})}async function fA(e,t,r){let o=await gl({reference:e,clips:[]});try{let n=await o.ask(t,r);if(!n.ok)throw new Error(`${B(e)}: ${n.why??"the analysis engine could not read it"}`);return n}finally{o.close()}}var pA=e=>t=>ce(e.startFrame+t,e.fps||24,e.dropFrame);async function hA(e,t,r){let o=await fA(e,{op:"cuts"},r),n=pA(o),i=o.fps||24,[a,s]=Math.abs(i-Math.round(i))>.01?[Math.round(i*1001/1e3)*1e3,1001]:[Math.round(i),1],{session:l}=await ll({name:t??`${B(e)} cuts`,fps_num:a,fps_den:s,width:o.w||1920,height:o.h||1080,start_tc:ce(o.startFrame,i,o.dropFrame),shots:o.shots.map(([u,d])=>({path:e,source_in:u,duration:d-u+1,at:u}))}),c=[`${B(e)}: ${o.frames} frames @ ${i.toFixed(3)} fps \u2014 ${o.shots.length} shot(s), ${o.cuts.length} cut(s)${o.flat.length?`, ${o.flat.length} black run(s)`:""}`,...o.shots.slice(0,200).map(([u,d],f)=>`${String(f+1).padStart(4)} ${n(u)} \u2013 ${n(d)} (${d-u+1} fr)${o.flat.some(([m,p])=>m<=u&&p>=d)?" black":""}`),...o.shots.length>200?[`\u2026 ${o.shots.length-200} more`]:[]];return{session:l,text:c.join(`
|
|
191
|
+
`),data:{frames:o.frames,fps:i,cuts:o.cuts,shots:o.shots,black:o.flat,cutsTc:o.cuts.map(n)}}}async function gA(e,t={},r){let o=await fA(e,{op:"qc",edgesEvery:t.edges_every??1},r),n=pA(o),i=(b,w)=>b===w?n(b):`${n(b)} \u2013 ${n(w)}`,a=o.temporal.findings.filter(b=>b.severity==="fail"),s=o.temporal.findings.filter(b=>b.severity==="warn"),[l,c]=o.matteRaster??[0,0],u=o.matte,d=o.format,f=["top","bottom","left","right"].flatMap(b=>o.edges[b].map(w=>({e:b,...w}))),m=o.audio??[],p=m.flatMap(b=>b.findings.map(w=>({track:b.track,...w}))),g=a.length||f.length||o.pixels.defects.length||p.some(b=>b.severity==="fail")?"FAIL":s.length||p.length?"CHECK":"PASS",_=[`${B(e)}: ${g} \u2014 ${o.frames} frames, ${o.w}\xD7${o.h} @ ${(o.fps||0).toFixed(3)} fps`,`frames: ${a.length} fail, ${s.length} to check (motion p50 ${o.temporal.stats.motionP50}, p90 ${o.temporal.stats.motionP90})`,...o.temporal.findings.filter(b=>b.severity!=="info").map(b=>` ${b.severity.toUpperCase().padEnd(4)} ${b.check.padEnd(9)} ${i(b.start,b.end)} ${b.detail}`),...u&&d?[`picture: ${u.h<c?"letterbox":"pillarbox"} ${d} \u2014 active ${u.w}\xD7${u.h} of ${l}\xD7${c} (the format: edges are checked past it)`]:[],`edges${o.edgesEvery>1?` (every ${o.edgesEvery}th frame)`:""}: ${f.length?`worst top ${o.edges.worst.top}, bottom ${o.edges.worst.bottom}, left ${o.edges.worst.left}, right ${o.edges.worst.right} px${d?" past the picture":""}`:"clean"}`,...f.slice(0,40).map(b=>` FAIL ${b.e.padEnd(6)} ${b.thickness} px ${i(b.start,b.end)}`),...o.cardFrames?.length?[` INFO picture on black (a card, logo or graphic) on ${o.cardFrames.length} frame(s) checked, first ${n(o.cardFrames[0])}: not blanking`]:[],...o.edges.cornerFrames.length?[` CHECK black corners on ${o.edges.cornerFrames.length} frame(s), first ${n(o.edges.cornerFrames[0])}`]:[],`pixels: ${o.pixels.measurable?o.pixels.defects.length?`${o.pixels.defects.length} defect(s)`:"clean":"not measurable (the picture barely moves across the frames sampled)"} (${o.pixels.frames} frames)`,...o.pixels.defects.map(b=>` FAIL ${b.kind.padEnd(4)} pixel at ${b.x},${b.y}${b.pixels>1?` (${b.pixels} px)`:""}, value ${b.value}, ${b.contrast>0?"+":""}${b.contrast} vs its neighbours`),`sound: ${m.length?m.map(b=>`track ${b.track} ${b.channels}ch ${b.lufs??"\u2014"} LUFS ${b.truePeak??"\u2014"} dBTP`).join("; "):"no audio track"}`,...p.slice(0,40).map(b=>` ${b.severity.toUpperCase().padEnd(4)} ${b.check.padEnd(14)} track ${b.track}${b.channel?` ch ${b.channel}`:""}${b.start!=null?` at ${n(Math.floor(b.start*(o.fps||24)))}`:""} ${b.detail}`)],v=o.temporal.findings.filter(b=>b.check==="duplicate"||b.check==="retime"),y=v.length?[{verb:"media_fix",args:{kind:"duplicates",path:e},why:`${v.length} repeated-frame finding(s): remade as the motion between their neighbours`}]:[];return y.length&&_.push(`fix: media_fix kind=duplicates \u2014 ${y[0].why} (plan_only first)`),{verdict:g,text:_.join(`
|
|
192
|
+
`),data:{verdict:g,...o,fixes:y}}}async function o6(e){let t=[];async function r(o,n){if(!(await ct(o)).isDirectory){if(/\.wav$/i.test(o))t.push(o);else throw new Error(`not a WAV: ${o}`);return}if(!(n>10))for await(let a of je(o))!a.name.startsWith(".")&&(a.isDirectory||/\.wav$/i.test(a.name))&&await r(M(o,a.name),n+1)}for(let o of e)await r(o,0);return t.sort((o,n)=>B(o).localeCompare(B(n)))}async function bA(e,t){let r=(await tv(e.picture)).sort((b,w)=>B(b).localeCompare(B(w))),o=await o6(e.sound);if(!r.length)throw new Error("no picture files found");if(!o.length)throw new Error("no recorder WAVs found");let n=await pt({op:"sync",picture:r,sound:o},t),i=n.synced,a=await Promise.all(r.map(b=>Pe(b))),s=b=>b.available_range?.duration.rate||24,l=s(a[0]),c=b=>(b.source_timecode?qe(b.source_timecode,s(b)):null)??0,u=r.map((b,w)=>w).sort((b,w)=>c(a[b])-c(a[w])||B(r[b]).localeCompare(B(r[w]))),[d,f]=Math.abs(l-Math.round(l))>.01?[Math.round(l*1001/1e3)*1e3,1001]:[Math.round(l),1],m=0,p=u.map(b=>{let w=Math.round(a[b].available_range?.duration.value??0),k={path:r[b],source_in:0,duration:w,at:m};return m+=w,k}),{session:g}=await ll({name:e.name??`${B(o[0])} dailies`,fps_num:d,fps_den:f,width:a[0].source_resolution_w||1920,height:a[0].source_resolution_h||1080,shots:p});i6(g,i,u,p,o,await Promise.all(o.map(b=>Pe(b))),l);let _=b=>ce(b,l,!1),v=(b,w)=>{let k=n.sound[b];return k.start!=null?_(Math.round((k.start+w)*l)):`+${w.toFixed(3)} s`},y=[`${r.length} picture file(s), ${o.length} recorder file(s): ${i.filter(b=>b.by==="sound").length} synced by sound, ${i.filter(b=>b.by==="timecode").length} by timecode only, ${i.filter(b=>b.by==="none").length} not found`,...u.map(b=>{let w=i[b];return` ${B(r[b]).padEnd(32)} ${w.sound==null?"\u2014".padEnd(24):B(o[w.sound]).padEnd(24)} ${w.by.padEnd(8)} ${w.offset==null?"":`at ${v(w.sound,w.offset)}`}${w.tcOffFrames!=null?` TC ${w.tcOffFrames>=0?"+":""}${w.tcOffFrames} fr`:""}${w.note?` \u2014 ${w.note}`:""}`})];return{session:g,text:y.join(`
|
|
193
|
+
`),data:{picture:r.map((b,w)=>({path:b,...i[w],sound:i[w].sound==null?null:o[i[w].sound]}))}}}function i6(e,t,r,o,n,i,a){let s=e.timelines[0],l=f=>f.streams?.find(m=>m.kind==="audio")?.channels??1,c=Math.max(1,...t.filter(f=>f.sound!=null).map(f=>l(i[f.sound]))),u=new Map;for(let[f,m]of i.entries())e.media_references?.some(p=>p.id===m.id)||e.media_references?.push(m),u.set(f,m.id);let d=f=>({value:f,rate:a});for(let f=0;f<c;f++){let m=[];r.forEach((p,g)=>{let _=t[p],v=o[g];_.sound==null||_.offset==null||f>=l(i[_.sound])||m.push({id:`sync-a${f+1}-${g+1}`,kind:"clip",item_index:m.length,name:B(n[_.sound]),enabled:!0,timeline_range:{start:d(v.at),duration:d(v.duration)},source_range:{start:d(_.offset*a),duration:d(v.duration)},media_reference_id:u.get(_.sound),channel_map:{routing:{[f]:0}}})}),s.tracks.push({id:`sync-a${f+1}`,kind:"Audio",track_index:f,name:`A${f+1}`,enabled:!0,items:m,audio_channel_count:1})}}var a6=2.5;async function s6(e,t){let r=t.map(i=>{let a=Math.max(1,Math.round(i.duration*((i.speed??100)/100)));return{s:i,need:a,frames:[i.source_in,i.source_in+(a>>1),i.source_in+a-1]}}),o=await e.ask({op:"detail",frames:r.flatMap(i=>i.frames.map(a=>[i.s.path,a]))});if(!o.ok)throw new Error(`the analysis engine could not read the planned shots: ${o.why}`);let n=o.detail;return r.flatMap((i,a)=>n.slice(3*a,3*a+3).filter(s=>s!=null&&s<a6).length>=2?[{path:i.s.path,from:i.s.source_in-24,to:i.s.source_in+i.need+24}]:[])}var l6=/\.(mov|mxf|mp4|m4v|mts|braw|r3d|ari)$/i,c6=/prox(y|ies)|^cache$/i;async function yA(e,t,r=!0){if((await Deno.stat(e)).isFile){l6.test(e)&&!e.split("/").pop().startsWith("._")&&t.push(e);return}if(!(!r&&c6.test(e.split("/").pop())))for await(let n of Deno.readDir(e))n.name.startsWith(".")||await yA(`${e}/${n.name}`,t,!1)}async function _A(e){Yd(e.mix);let t=[];for(let c of e.media)await yA(c,t);if(t.sort(),!t.length)throw new Error("no video files under the media given");let r=[],o=new Map;for(let c of t)try{r.push({path:c,ref:await Pe(c)})}catch(u){o.set(c,u instanceof Error?u.message:String(u))}let n=[...e.avoid??[]],i,a=e.look===!1?null:await Yv();try{for(let c=0;c<(e.look===!1?1:5);c++){try{i=mA({...e,avoid:n},r)}catch(d){throw d instanceof Error&&d.message.startsWith("no usable clips")?new Error(`no usable clips (${t.length} skipped)`):d}if(e.look===!1)break;let u=await s6(a,i.shots);if(!u.length)break;n.push(...u)}}finally{a?.close()}if(!i)throw new Error("no cut");let s=new Map([...o,...i.pool.skipped.map(c=>[c.path,c.reason])]),l=t.filter(c=>s.has(c)).map(c=>`${c} (${s.get(c)})`);return{session:i.session,summary:i.summary,shots:i.shots,titles:i.titles,pool:{used:i.pool.used,skipped:l}}}async function vA(e){let t=await Xd({reference:e.b,pool:[e.a],name:`${B(e.b)} rebuilt from ${B(e.a)}`,onProgress:e.onProgress,signal:e.signal}),r=t.report,o=r.clips[0],n={fps:r.refFps,frames:r.refFrames,startFrame:r.refStartFrame,dropFrame:r.refDropFrame,w:r.refW,h:r.refH,label:""},i=o?{fps:o.srcFps??r.refFps,frames:o.srcFrames,startFrame:o.srcStartFrame,dropFrame:r.refDropFrame,w:o.srcW,h:o.srcH,label:o.codec}:{...n,frames:0},a=m=>i.fps?ce(i.startFrame+m,i.fps,i.dropFrame):"",s=m=>n.fps?ce(n.startFrame+m,n.fps,n.dropFrame):"",l=t.issues,c=[],u=(m,p)=>{let g=c[c.length-1];g?.kind==="hole"&&g.recordOut===m?(g.count+=p-m,g.recordOut=p,g.recordOutTc=s(p)):c.push({index:0,kind:"hole",count:p-m,recordIn:m,recordOut:p,recordInTc:s(m),recordOutTc:s(p)})},d=0;for(let m of[...r.timeline].sort((p,g)=>p.refStart-g.refStart)){m.refStart>d&&u(d,m.refStart);let p=m.refEnd-m.refStart+1;if(!m.clipLabel||m.srcStart==null){u(m.refStart,m.refEnd+1),d=m.refEnd+1;continue}let g=m.speed?.slope??1,_=m.ramp?null:Array.from({length:p},(k,I)=>m.srcStart+Math.floor(I*g+.001)),v=_?Math.min(..._):m.srcStart,y=_?Math.max(..._):m.srcStart+p-1,b={index:0,kind:"a-source",count:p,recordIn:m.refStart,recordOut:m.refEnd+1,recordInTc:s(m.refStart),recordOutTc:s(m.refEnd+1),aIn:v,aOut:y+1,aInTc:a(v),aOutTc:a(y+1)};m.ramp?b.motion={percent:100,ramp:!0,entry:m.srcStart,entryTc:a(m.srcStart)}:m.speed&&m.speed.kind!=="normal"&&(b.motion={percent:m.speed.kind==="freeze"?0:(m.speed.kind==="reverse"?-1:1)*m.speed.percent,entry:m.srcStart,entryTc:a(m.srcStart)});let w=l.find(k=>k.refStart<=m.refEnd&&k.refEnd>=m.refStart&&k.kind!=="retime");w&&(b.unreproducible={checked:0,failed:0,note:w.message}),c.push(b),d=m.refEnd+1}d<n.frames&&u(d,n.frames),c.forEach((m,p)=>m.index=p+1);let f={...n,codec:"",kind:"unknown"};return{a:i,b:n,events:c,summary:wP(c),check:c.filter(m=>m.unreproducible),edl:kP(c,f,{title:`${B(e.b)} FROM ${B(e.a)}`.toUpperCase().slice(0,70),aReel:B(e.a)}),csv:$P(c),session:t.session,stats:t.stats}}function wA(e,t){let r=(i,a)=>`${B(a)}: ${i.label?`${i.label} `:""}${i.w}x${i.h} @ ${i.fps?.toFixed(3)??"?"} fps, ${i.frames} frames`,o=e.summary.hole===0&&e.events.length===1&&!e.events[0].motion&&e.events[0].aIn===0&&e.events[0].count===e.a.frames,n=i=>i.motion?i.motion.ramp?" SPEED RAMP":i.motion.percent===0?" FREEZE":i.motion.percent<0?` REVERSE ${-i.motion.percent.toFixed(1)}%`:` SPEED ${i.motion.percent.toFixed(1)}%`:"";return[`A (old) ${r(e.a,t.a)}`,`B (new) ${r(e.b,t.b)}`,o?"B is A, picture for picture (one event covers the whole cut).":`B rebuilt from A in ${e.events.length} event(s): ${e.events.filter(i=>i.kind!=="hole").length} from A (${e.summary.aSource} frames), ${e.events.filter(i=>i.kind==="hole").length} hole(s) of new material (${e.summary.hole} frames)`,"",...e.events.map(i=>`${String(i.index).padStart(4)} ${i.recordInTc}\u2013${i.recordOutTc} ${i.kind==="hole"?`NEW MATERIAL (${i.count} fr)`:`A ${i.aInTc}\u2013${i.aOutTc} (${i.count} fr)${n(i)}`}${i.unreproducible?` CHECK: ${i.unreproducible.note}`:""}`)].join(`
|
|
194
|
+
`)}import{basename as Io}from"node:path";var kA=48e3*30;function ov(e){return(t,r)=>e.slice(t,t+r).arrayBuffer().then(o=>new Uint8Array(o))}var u6=async e=>{let t=globalThis.OfflineAudioContext;if(!t)return null;let o=await new t(1,1,48e3).decodeAudioData(await e.arrayBuffer()),n=new Float32Array(o.length);for(let i=0;i<o.numberOfChannels;i++){let a=o.getChannelData(i);for(let s=0;s<a.length;s++)n[s]+=a[s]/o.numberOfChannels}return{sampleRate:o.sampleRate,channels:1,chunks:(async function*(){yield n})()}},d6=u6;async function m6(e){let t=await d6(e).catch(()=>null);if(!t)return null;let r=new rl(t.channels,t.sampleRate,100),o=0;for await(let n of t.chunks)r.push(n),o+=n.length/t.channels;return o?{sampleRate:t.sampleRate,channels:t.channels,sampleFrames:o,durationSec:o/t.sampleRate,envelopes:r.finish(),codec:"platform"}:null}async function $A(e){await sr();let t=ov(e),r=await wl(t,e.size),o=JSON.parse(r);if(!o||o.aac)return m6(e);let n=o.sample_rate??0,i=o.channels??0,a=o.sample_frames??0;if(!n||!i||!a)return null;let s=new rl(i,n,100);for(let l=0;l<a;l+=kA){let c=Math.min(kA,a-l),u=await kl(t,e.size,l,c);if(!u||u.length<12)break;let d=new DataView(u.buffer,u.byteOffset,u.byteLength),f=d.getUint32(8,!0),m=d.getUint32(4,!0);if(!f||!m)break;let p=u.byteOffset+12,g=p%4===0?new Float32Array(u.buffer,p,f*m):new Float32Array(u.slice(12).buffer,0,f*m);s.push(g)}return{sampleRate:n,channels:i,sampleFrames:a,durationSec:a/n,envelopes:s.finish(),codec:o.codec}}function f6(e){let t=1681.974450955533,r=3.999843853973347,o=.7071752369554196,n=Math.tan(Math.PI*t/e),i=Math.pow(10,r/20),a=Math.pow(i,.4996667741545416),s=1+n/o+n*n,l={b0:(i+a*n/o+n*n)/s,b1:2*(n*n-i)/s,b2:(i-a*n/o+n*n)/s,a1:2*(n*n-1)/s,a2:(1-n/o+n*n)/s},c=38.13547087602444,u=.5003270373238773,d=Math.tan(Math.PI*c/e),f=1+d/u+d*d,m={b0:1,b1:-2,b2:1,a1:2*(d*d-1)/f,a2:(1-d/u+d*d)/f};return{shelf:l,highpass:m}}function p6(e){switch(e){case 1:return[1];case 2:return[1,1];case 6:return[1,1,1,0,1.41,1.41];case 8:return[1,1,1,0,1.41,1.41,1.41,1.41];default:return new Array(e).fill(1)}}var h6=-.691,g6=-70,b6=10,y6=.4,_6=.75;var em=class{constructor(t,r){this.channels=t;this.sampleRate=r;this.blockFilled=0;this.historyAt=0;this.sinceLastBlock=0;this.totalSamples=0;this.blockPower=[];let o=f6(r);this.shelf=o.shelf,this.highpass=o.highpass,this.weights=p6(t),this.state=Array.from({length:t},()=>({s1:[0,0,0,0],s2:[0,0,0,0]})),this.blockSize=Math.round(y6*r),this.hop=Math.max(1,Math.round(this.blockSize*(1-_6))),this.blockSums=new Array(t).fill(0),this.history=Array.from({length:t},()=>new Float32Array(this.blockSize))}step(t,r,o){let n=t.b0*o+t.b1*r[0]+t.b2*r[1]-t.a1*r[2]-t.a2*r[3];return r[1]=r[0],r[0]=o,r[3]=r[2],r[2]=n,n}push(t){let r=Math.floor(t.length/this.channels);for(let o=0;o<r;o++){for(let n=0;n<this.channels;n++){let i=this.state[n],a=this.step(this.highpass,i.s2,this.step(this.shelf,i.s1,t[o*this.channels+n])),s=a*a;this.blockSums[n]+=s-this.history[n][this.historyAt],this.history[n][this.historyAt]=s}if(this.historyAt=(this.historyAt+1)%this.blockSize,this.totalSamples++,this.blockFilled<this.blockSize&&this.blockFilled++,this.blockFilled>=this.blockSize&&(this.sinceLastBlock++,this.sinceLastBlock>=this.hop||this.blockPower.length===0)){this.sinceLastBlock=0;let n=0;for(let i=0;i<this.channels;i++){let a=this.weights[i]??1;a!==0&&(n+=a*(this.blockSums[i]/this.blockSize))}this.blockPower.push(n)}}}finish(){return v6(this.blockPower)}get samplesSeen(){return this.totalSamples}};function v6(e){let t=s=>s>0?h6+10*Math.log10(s):-1/0,r=e.filter(s=>t(s)>g6);if(r.length===0)return{integratedLufs:null,gatedBlocks:0,totalBlocks:e.length};let o=r.reduce((s,l)=>s+l,0)/r.length,n=t(o)-b6,i=r.filter(s=>t(s)>n);if(i.length===0)return{integratedLufs:null,gatedBlocks:0,totalBlocks:e.length};let a=i.reduce((s,l)=>s+l,0)/i.length;return{integratedLufs:t(a),gatedBlocks:i.length,totalBlocks:e.length}}var w6=4,Qd=32;function k6(e=w6,t=Qd){let r=[],o=t/2;for(let n=0;n<e;n++){let i=new Float32Array(t),a=0;for(let s=0;s<t;s++){let l=s-o+1-n/e,c=l===0?1:Math.sin(Math.PI*l)/(Math.PI*l),u=.42-.5*Math.cos(2*Math.PI*s/(t-1))+.08*Math.cos(4*Math.PI*s/(t-1));i[s]=c*u,a+=i[s]}if(a!==0)for(let s=0;s<t;s++)i[s]/=a;r.push(i)}return r}var xA=1024;var tm=class{constructor(t){this.channelCount=t;this.base=0;this.next=0;this.peak=0;this.phases=k6(),this.half=Qd/2;let r=1;for(let o=1;o<this.phases.length;o++){let n=0;for(let i=0;i<Qd;i++)n+=Math.abs(this.phases[o][i]);n>r&&(r=n)}this.l1=r,this.buffers=Array.from({length:t},()=>new Float32Array(0))}push(t){let r=Math.floor(t.length/this.channelCount);if(r<=0)return;for(let n=0;n<this.channelCount;n++){let i=this.buffers[n],a=new Float32Array(i.length+r);a.set(i,0);for(let s=0;s<r;s++){let l=t[s*this.channelCount+n];a[i.length+s]=l;let c=l<0?-l:l;c>this.peak&&(this.peak=c)}this.buffers[n]=a}let o=this.base+this.buffers[0].length;this.evaluate(o-this.half,!1),this.trim()}finish(){let t=this.base+this.buffers[0].length;return this.evaluate(t,!0),this.peak>0?20*Math.log10(this.peak):-1/0}evaluate(t,r){if(!(t<=this.next)){for(let o=0;o<this.channelCount;o++){let n=this.buffers[o],i=this.base,a=this.base+n.length;for(let s=this.next;s<t;s+=xA){let l=Math.min(s+xA,t),c=Math.max(i,s-this.half),u=Math.min(a,l+this.half),d=0;for(let f=c;f<u;f++){let m=n[f-i]<0?-n[f-i]:n[f-i];m>d&&(d=m)}if(!(d*this.l1<=this.peak))for(let f=s;f<l;f++)for(let m=1;m<this.phases.length;m++){let p=this.phases[m],g=0;for(let v=0;v<Qd;v++){let y=f+v-this.half+1;y>=i&&y<a&&(g+=n[y-i]*p[v])}let _=g<0?-g:g;_>this.peak&&(this.peak=_)}}}this.next=t,r&&(this.next=Math.max(this.next,this.base+this.buffers[0].length))}}trim(){let t=Math.max(this.base,this.next-this.half+1),r=t-this.base;if(!(r<=0)){for(let o=0;o<this.channelCount;o++)this.buffers[o]=this.buffers[o].slice(r);this.base=t}}};var $6={fps:24,minTonality:.7,minIsolationDb:20,maxFrameMultiple:3};function x6(e,t,r,o,n){let i=Math.round(r*o/n),a=2*Math.PI*i/r,s=2*Math.cos(a),l=0,c=0;for(let u=0;u<r;u++){let d=e[t+u]+s*l-c;c=l,l=d}return Math.sqrt(l*l+c*c-s*l*c)/(r/2)}function S6(e,t,r){let o=0;for(let n=0;n<r;n++){let i=e[t+n];o+=i*i}return Math.sqrt(o/r)}var nm=e=>e>0?20*Math.log10(e):-1/0;function SA(e,t,r={}){let o={...$6,...r};if(t<=0||e.length===0)return null;let n=1e3/o.fps,i=Math.max(64,Math.round(20/1e3*t)),a=Math.max(1,Math.round(i/2)),s=Math.min(e.length,Math.round(12*t));if(s<i*4)return null;let l=[],c=[];for(let g=0;g+i<=s;g+=a){let _=S6(e,g,i);l.push(_),c.push(_>1e-6?Math.min(1,x6(e,g,i,1e3,t)/(_*Math.SQRT2)):0)}if(l.length<4)return null;let u=[...l].sort((g,_)=>g-_),d=u[Math.floor(u.length/2)],f=g=>c[g]>=o.minTonality&&nm(l[g])-nm(Math.max(d,1e-9))>=o.minIsolationDb,m=null,p=0;for(;p<l.length;){if(!f(p)){p++;continue}let g=p;for(;g+1<l.length&&f(g+1);)g++;let _=g-p+1,v=((_-1)*a+i)*1e3/t;if(v<=n*o.maxFrameMultiple){let y=(p*a+(g*a+i))/2,b=Math.max(...l.slice(p,g+1)),w=c.slice(p,g+1).reduce((I,x)=>I+x,0)/_,k={atSeconds:y/t,durationMs:v,tonality:w,isolationDb:nm(b)-nm(Math.max(d,1e-9))};(!m||k.isolationDb>m.isolationDb)&&(m=k)}p=g+1}return m}function RA(e,t){if(t<=1)return e;let r=Math.floor(e.length/t),o=new Float32Array(r);for(let n=0;n<r;n++){let i=0;for(let a=0;a<t;a++)i+=e[n*t+a];o[n]=i/t}return o}var IA=1<<18;async function TA(e,t={}){await sr();let r=ov(e),o=await wl(r,e.size),n=JSON.parse(o);if(!n||n.aac)return{loudness:null,twoPop:null,truePeakDb:null};let i=n.sample_rate??0,a=n.channels??0,s=n.sample_frames??0;if(!i||!a||!s)return{loudness:null,twoPop:null,truePeakDb:null};let l=new em(a,i),c=new tm(a),u=Math.min(s,Math.round(12*i)),d=new Float32Array(u*a),f=0;for(let _=0;_<s;_+=IA){if(t.signal?.aborted)return{loudness:null,twoPop:null,truePeakDb:null};let v=Math.min(IA,s-_),y=await kl(r,e.size,_,v);if(!y||y.length<12)break;let b=new DataView(y.buffer,y.byteOffset,y.byteLength),w=b.getUint32(8,!0),k=b.getUint32(4,!0);if(!w||!k)break;let I=y.byteOffset+12,x=I%4===0?new Float32Array(y.buffer,I,w*k):new Float32Array(y.slice(12).buffer,0,w*k);if(l.push(x),c.push(x),f<d.length){let S=Math.min(x.length,d.length-f);d.set(x.subarray(0,S),f),f+=S}t.onProgress?.(Math.min(_+v,s),s)}let m=l.finish(),p=f>0?SA(RA(d.subarray(0,f),a),i,{fps:t.fps&&t.fps>0?t.fps:void 0}):null,g=c.finish();return{loudness:m.integratedLufs===null?null:m,twoPop:p,truePeakDb:Number.isFinite(g)?g:null}}var I6={apco:"ProRes 422 Proxy",apcs:"ProRes 422 LT",apcn:"ProRes 422",apch:"ProRes 422 HQ",ap4h:"ProRes 4444",ap4x:"ProRes 4444 XQ",aprn:"ProRes RAW",aprh:"ProRes RAW HQ"};function PA(e){let t=(e??"").toLowerCase().trim(),r=qw(t);return{family:r,label:I6[t]??r??t,bitDepth:Xw(t),chroma:Yw(t)}}function iv(e){return e.toLowerCase().replace(/\b(apple|avid|sony|panasonic)\b/g,"").replace(/[\s_-]+/g,"")}function AA(e,t){let r=iv(e),o=iv(t.label);return!r||!o?!1:o===r||o.startsWith(r)?!0:t.family!=null&&iv(t.family)===r}var NQ={"23.98":24e3/1001,"23.976":24e3/1001,"29.97":3e4/1001,"59.94":6e4/1001,"47.95":48e3/1001,"119.88":12e4/1001};function EA(e,t,r,o=255){let n=e instanceof Int32Array?-13110.4:o*.1,i=Math.floor(r*.45),a=Math.floor(t*.45),s=m=>{let p=0,g=m*t;for(let _=0;_<t;_++)e[g+_]<=n&&p++;return p>=t*.95},l=m=>{let p=0;for(let g=0;g<r;g++)e[g*t+m]<=n&&p++;return p>=r*.95},c=0;for(;c<i&&s(c);)c++;let u=0;for(;u<i&&s(r-1-u);)u++;let d=0;for(;d<a&&l(d);)d++;let f=0;for(;f<a&&l(t-1-f);)f++;return{top:c,bottom:u,left:d,right:f}}function OA(e,t,r){if(e.length===0)return null;let o=(c,u)=>{let d=Math.floor(u*.02),f=e.filter(m=>m[c]>d);return f.length<e.length*.8?0:Math.min(...f.map(m=>m[c]))},n=o("top",r),i=o("bottom",r),a=o("left",t),s=o("right",t);if(n+i+a+s===0)return null;let l={x:a,y:n,w:t-a-s,h:r-n-i};return l.w<t*.3||l.h<r*.3?null:l}function MA(e,t=16){if(e<=0)return[];let r=Math.min(t,e);if(r===1)return[e>>1];let o=[];for(let n=0;n<r;n++)o.push(Math.min(e-1,Math.floor((n+.5)*e/r)));return[...new Set(o)]}function CA(e,t,r){if(!e)return null;let o=Math.round(e.y),n=Math.round(r-e.h-e.y),i=Math.round(e.x),a=Math.round(t-e.w-e.x),s=[];return(o||n)&&s.push(`letterboxed ${o===n?`${o} px top and bottom`:`${o} px top, ${n} px bottom`}`),(i||a)&&s.push(`pillarboxed ${i===a?`${i} px each side`:`${i} px left, ${a} px right`}`),s.length?s.join(", "):null}function T6(e){let t=new DataView(e.buffer,e.byteOffset,8);return{w:t.getUint32(0,!0),h:t.getUint32(4,!0)}}function av(e){let t=Nw(e),{w:r,h:o}=T6(t),n=new Int32Array(r*o),i=new DataView(t.buffer,t.byteOffset+8,r*o*4);for(let a=0;a<r*o;a++)n[a]=i.getInt32(a*4,!0);return{y:n,w:r,h:o}}function So(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=t.getUint32(0,!0),o=t.getUint32(4,!0),n=r*o;if(e.byteLength<8+n*4)throw new Error(`decoded frame short: ${e.byteLength} B for ${r}x${o}`);let i=new Uint8Array(n);for(let a=0,s=8;a<n;a++,s+=4)i[a]=54*e[s]+183*e[s+1]+19*e[s+2]+128>>8;return{y:i,w:r,h:o}}function Ro(e,t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),o=r.getUint32(0,!0),n=r.getUint32(4,!0),i=o*n;if(e.byteLength<8+i*2)throw new Error(`decoded luma short: ${e.byteLength} B for ${o}x${n}`);let a=new Uint16Array(i);for(let s=0,l=8;s<i;s++,l+=2)a[s]=r.getUint16(l,!0);return{y:a,w:o,h:n,peak:t}}function LA(e,t){switch(t.codec){case"prores":return Ro(Am(e),1023);case"r3d":return Ro(Fw(e),255);case"arriraw":return Ro(Ew(e,t.w,t.h),255);case"xocn":return Ro(Bw(e),255);case"vc3":return Ro(Lw(e),255);case"braw":return Ro(Mw(e),4095);case"proresraw":return Ro(Dw(e),255)}}var DA={gpu:0,wasm:0};var sv=null;function P6(){return sv||(sv=!Kw||typeof navigator>"u"||!("gpu"in navigator)?Promise.resolve(null):import("./prores-RIG37OIH.js").catch(()=>null)),sv}function A6(e,t,r,o){if(o===t&&e.length===t*r)return e;let n=new Uint16Array(t*r);for(let i=0;i<r;i++)n.set(e.subarray(i*o,i*o+t),i*t);return n}async function E6(e){try{let t=await P6();if(!t||!await t.proresGpuAvailable())return null;let r=await t.decodeProResFrameGpu(e);return r?{y:A6(r.y,r.width,r.height,r.strideY),w:r.width,h:r.height,peak:1023}:null}catch{return null}}async function O6(e,t){if(t.codec==="prores"){let r=await E6(e);if(r)return DA.gpu++,r;DA.wasm++}return LA(e,t)}function zA(e){let t=e.y.length,r=new Uint8Array(t);if(e.peak===255){for(let n=0;n<t;n++)r[n]=e.y[n]>255?255:e.y[n];return r}let o=255/e.peak;for(let n=0;n<t;n++){let i=Math.round(e.y[n]*o);r[n]=i>255?255:i}return r}function M6(e,t,r="coarse"){if(r==="exact"){let o=LA(e,t);return{y:zA(o),w:o.w,h:o.h}}if(r==="index"&&t.codec==="prores"){let o=av(e),n=e.length>20?e[18]<<8|e[19]:0,i=n>0?Math.min(o.h,Math.max(1,Math.round(n/8))):o.h,a=new Uint8Array(o.w*i);for(let s=0;s<a.length;s++)a[s]=Math.max(0,Math.min(255,Math.round(o.y[s]/128+128)));return{y:a,w:o.w,h:i}}if(r==="index"&&t.codec==="r3d")return So(Em(e,0));if(r==="index"&&t.codec==="xocn"){let o=Uw(e),n=new DataView(o.buffer,o.byteOffset,o.byteLength),i=n.getUint32(0,!0),a=n.getUint32(4,!0);return{y:o.subarray(8,8+i*a),w:i,h:a}}switch(t.codec){case"prores":{let o=av(e);return{y:o.y,w:o.w,h:o.h}}case"r3d":return So(Em(e,t.subbands));case"arriraw":return So(Ow(e,t.w,t.h,t.scale));case"xocn":return So(t.display==="rec709"?Zw(e):Vw(e,t.scale));case"vc3":return So(zw(e,t.scale));case"braw":return So(Cw(e,t.scale));case"proresraw":return So(jw(e,t.scale))}}var jA=512*1024,NA=160*1024,FA=16*1024;async function UA(e,t,r,o,n="coarse"){let i=async a=>new Uint8Array(await e.slice(t,t+a).arrayBuffer());if(n==="index"&&o?.codec==="xocn"&&r>NA){let a=await i(NA),s=Ww(a.subarray(0,128));if(s>0&&s<=r)return s<=a.length?a.subarray(0,s):await i(s)}if(n!=="exact"&&o?.codec==="r3d"&&r>FA){let a=await i(FA),s=Hw(a,r,n==="index"?0:Math.min(3,o.subbands)),l=new Uint8Array(r);if(l.set(a),!s.length)return l.set(new Uint8Array(await e.slice(t+a.length,t+r).arrayBuffer()),a.length),l;let c=s[0];await Promise.all(Array.from({length:c},async(u,d)=>{let f=s[1+2*d],m=f+s[2+2*d];f<a.length&&(f=a.length),f<m&&l.set(new Uint8Array(await e.slice(t+f,t+m).arrayBuffer()),f)}));for(let u=1+2*c;u<s.length;u++){let d=s[u];l[d]=255,l[d+1]=144,l[d+2]=0,l[d+3]=10,l[d+12]=255,l[d+13]=147}return l}if(n!=="exact"&&o?.codec==="xocn"&&r>jA){let a=await i(jA),s=Jw(a.subarray(0,128));if(s>0&&s<=r)return s<=a.length?a.subarray(0,s):await i(s)}return await i(r)}async function BA(e,t,r="coarse"){if(r!=="exact")return M6(e,t,r);let o=await O6(e,t);return{y:zA(o),w:o.w,h:o.h}}async function C6(e,t,r,o,n,i){let a=await BA(e,t,r),s={idx:n,ok:!0,w:a.w,h:a.h,black:GA(a.y)};if(o.diff&&i&&(s.diff=HA(i.y,a.y)),o.hash){let l=vP(a.y,a.w,a.h);s.bits=Array.from(l.bits),s.q=l.quality,s.my=l.meanY??0}return o.bars&&(s.bars=EA(a.y,a.w,a.h)),{result:s,plane:a}}var VA=e=>({idx:e,ok:!1,w:0,h:0,black:!1});async function D6(e,t,r,o,n,i,a){let s=[],l=null;for(let c=0;c<t.length;c++){let u=t[c],d=c<r,f;try{let m=await UA(e,u.offset,u.size,o,n),p=await C6(m,o,n,i,u.idx,l);l=p.plane,f=p.result}catch{f=VA(u.idx)}d||s.push(f),a?.(d?null:f)}return s}function j6(e,t){let r=[],o=Math.min(t,e.length);if(o===0)return r;let n=Math.ceil(e.length/o);for(let i=0;i<e.length;i+=n){let a=e.slice(i,i+n);i===0?r.push({jobs:a,primers:0}):r.push({jobs:[e[i-1],...a],primers:1})}return r}async function ZA(e,t,r,o,n,i={}){let{signal:a,onProgress:s}=i;if(t.length===0)return[];let l=t.length,c=0,u=()=>s?.(++c,l);if(typeof Worker>"u")return await D6(e,t,0,r,o,n,g=>{if(a?.aborted)throw new DOMException("aborted","AbortError");g&&u()});let d=Math.max(1,Math.min(navigator.hardwareConcurrency||4,16,t.length)),f=n.diff?j6(t,d):Array.from({length:d},(p,g)=>({jobs:t.filter((_,v)=>v%d===g),primers:0})),m=new Map;return await new Promise((p,g)=>{let _=f.filter(w=>w.jobs.length>0).length;if(_===0){p();return}let v=[],y=()=>{for(let w of v)w.terminate();a?.removeEventListener("abort",b)};function b(){y(),g(new DOMException("aborted","AbortError"))}if(a?.aborted){b();return}a?.addEventListener("abort",b,{once:!0});for(let w of f){if(w.jobs.length===0)continue;let k=new Worker(new URL("./workers/picture-worker.ts",import.meta.url),{type:"module"});v.push(k),k.onmessage=x=>{let S=x.data;if(S.progress)for(let R=0;R<S.progress;R++)u();if(S.results){for(let R of S.results)m.set(R.idx,R);--_===0&&(y(),p())}},k.onerror=x=>{y(),g(new Error(`picture worker error: ${x.message}`))};let I={file:e,jobs:w.jobs,primers:w.primers,spec:r,tier:o,want:n};k.postMessage(I)}}),t.map(p=>m.get(p.idx)??VA(p.idx))}var N6=16,F6=.075,L6=.12;function GA(e){let t=0,r=0;for(let o=0;o<e.length;o++){let n=e[o];t+=n,n>r&&(r=n)}return t/e.length<=255*F6&&r<=255*L6}function HA(e,t){let r=Math.min(e.length,t.length);if(r===0)return 0;let o=0;for(let n=0;n<r;n++)o+=Math.abs(e[n]-t[n]);return o/r}var z6=1.5,U6=1,B6=30;function V6(e,t){let r=[];for(let o of t){let n=e.frames[o];n&&r.push({idx:o,offset:n.offset,size:n.size})}return r}async function rm(e,t,r,o,n,i){if(!t.spec)return null;try{return await ZA(e,V6(t,r),t.spec,o,n,{signal:i.signal,onProgress:i.onProgress})}catch(a){if(a instanceof DOMException&&a.name==="AbortError")return null;throw a}}async function WA(e,t,r={}){let o;try{o=t??await Fr(e)}catch{return null}if(!o.spec||o.frames.length===0)return null;let n=MA(o.frames.length,N6),i=await rm(e,o,n,"exact",{bars:!0},r);if(!i)return null;let a=i.filter(y=>y.ok&&y.bars);if(a.length===0)return null;let{w:s,h:l}=a[0],c=OA(a.map(y=>y.bars),s,l),u=o.h>0&&l>0?o.h/l:1,d=o.w>0&&s>0?o.w/s:1,f=c?{x:Math.round(c.x*d),y:Math.round(c.y*u),w:Math.round(c.w*d),h:Math.round(c.h*u)}:null,m=f?CA(f,Math.round(s*d),Math.round(l*u)):null,p=Math.max(1,Math.round(u)),g=p>1?` (\xB1${p} px, measured at 1/${p} scale)`:"",_=`across ${a.length} sampled frame${a.length===1?"":"s"}`;return c==null||c.x===0&&c.y===0&&c.w===s&&c.h===l?{hasBlanking:!1,note:`none found ${_}`}:{hasBlanking:!0,note:`${m??"bars detected"}${g} ${_}`}}async function JA(e,t,r,o={}){let n;try{n=r??await Fr(e)}catch{return null}if(!n.spec||n.frames.length===0)return null;let i=n.frames.length,a=Math.min(t,i),s=Math.max(a,i-t);if(s<=a)return null;let l=[];for(let p=a;p<s;p++)l.push(p);let c=await rm(e,n,l,"exact",{},o);if(!c)return null;let u=[],d=0;for(let p of c)p.ok&&(d++,p.black&&u.push(p.idx));if(d===0)return null;let f=`${d} of ${s-a} interior frames`;if(u.length===0)return{hasBlackFrames:!1,note:`none found in ${f}`};let m=u.slice(0,5).join(", ");return{hasBlackFrames:!0,note:`${u.length} black frame${u.length===1?"":"s"} at ${m}${u.length>5?", \u2026":""} (${f})`}}function lv(e,t){let r=e/t,o=Math.floor(r/60);return`${o}:${(r-o*60).toFixed(2).padStart(5,"0")}`}async function KA(e,t,r={}){let o;try{o=t??await Fr(e)}catch{return null}if(!o.spec||o.frames.length===0)return null;let n=o.fps&&o.fps>0?o.fps:24,i=Math.min(o.frames.length,Math.round(n*B6)),a=[];for(let d=0;d<i;d++)a.push(d);let s=await rm(e,o,a,"exact",{diff:!0},r);if(!s)return null;let l=[],c=[],u=0;for(let d=0;d<s.length;d++){let f=s[d];if(!f.ok){l.push(l[d-1]??!1),c.push(!1);continue}u++,l.push(f.black),c.push(f.diff==null?!1:f.diff>z6)}return u===0?null:Z6(l,c,n)}function Z6(e,t,r){let o=e.length,n=Math.max(2,Math.round(r*U6)),i=0;for(;i<o&&e[i];)i++;let a=i,s=-1,l=-1;for(;i<o;){if(e[i]){i++;continue}let d=i,f=i+1;for(;f<o&&!e[f]&&!t[f];)f++;if(f-d>=n){s=d,l=f;break}i=Math.max(f,i+1)}let c=null;for(let d=l>=0?l:a;d<o;d++)if(!e[d]){c=d;break}let u=[];return a>0&&u.push(`${(a/r).toFixed(2)} s black at head`),s>=0?u.push(`a static card ${lv(s,r)}\u2013${lv(l,r)} (${((l-s)/r).toFixed(2)} s)`):u.push(`no static card in the first ${(o/r).toFixed(0)} s`),c!=null&&u.push(`picture from ${lv(c,r)}`),{hasSlate:s>=0,programmeStart:c,note:u.join(", ")}}var G6=1200,H6=.5,W6=.6,J6=.7,K6=3;function q6(e,t,r){let o=e.length;for(let n=r;n<o;n++){if(!e[n]||t[n])continue;let i=0,a=0;for(let s=n;s<o;s++)t[s]||(i++,e[s]&&a++);if(i>=3&&a>=i*J6)return n}return-1}async function qA(e,t,r={}){let o;try{o=t??await Fr(e)}catch{return null}if(!o.spec||o.frames.length===0)return null;let n=o.fps&&o.fps>0?o.fps:24,i=o.frames.length,a=Math.max(1,Math.round(n*H6),Math.ceil(i/G6)),s=[];for(let y=0;y<i;y+=a)s.push(y);let l=await rm(e,o,s,"coarse",{hash:!0},r);if(!l)return null;let c=[],u=[],d=[];for(let y of l)!y.ok||!y.bits||(c.push(y.idx),u.push({bits:Uint32Array.from(y.bits),quality:y.q??0,meanY:y.my}),d.push(y.black));let f=u.length,m=`sampled every ${(a/n).toFixed(2)} s`;if(f<8)return null;let p=Math.floor(f*W6);if(p<2)return null;let g=new Array(f).fill(!1);for(let y=p;y<f;y++)if(!d[y]){for(let b=0;b<p;b++)if(Vd(u[y],u[b])<=F_){g[y]=!0;break}}let _=q6(g,d,p);if(_<0)return{hasTextlessTail:!1,note:`no repeated material at the tail (${m})`};let v=(c[f-1]-c[_])/n;return v<K6?{hasTextlessTail:!1,note:`only ${v.toFixed(1)} s of repeated material at the tail, too short to be textless (${m})`}:{hasTextlessTail:!0,note:`${v.toFixed(1)} s from ${(c[_]/n/60).toFixed(0)}:${(c[_]/n%60).toFixed(2).padStart(5,"0")} repeats earlier picture (${m})`}}function X6(e){let t=e.toLowerCase().match(/\.([a-z0-9]{2,4})$/);return t?t[1]:void 0}function Y6(e){if(e===1)return"mono";if(e===2)return"stereo";if(e===6)return"5.1"}async function XA(e,t={}){let r={name:e.name,sizeBytes:e.size,wrapper:X6(e.name)},o;try{let n=await Fr(e);o=n,r.width=n.w||void 0,r.height=n.h||void 0,r.fps=n.fps??void 0,r.durationFrames=n.frames.length||void 0;let i=n.index?.codec,a=PA(i??n.label);r.codec=i?a.label:n.label,r.bitDepth=a.bitDepth??void 0,r.chroma=a.chroma??void 0,n.fps&&Number.isFinite(n.startFrame)&&(r.startTimecode=ce(n.startFrame,n.fps,n.dropFrame))}catch{}if(t.audio!==!1){try{let n=await $A(e);n&&(r.audioChannels=n.channels,r.audioSampleRate=n.sampleRate,r.audioLayout=Y6(n.channels))}catch{}if(t.loudness!==!1)try{let n=await TA(e,{signal:t.signal,fps:r.fps});n.loudness?.integratedLufs!=null&&(r.loudnessLufs=n.loudness.integratedLufs),n.truePeakDb!=null&&(r.truePeakDb=n.truePeakDb),r.hasTwoPop=n.twoPop!==null}catch{}}if(t.picture?.blanking){let n=await WA(e,o,{signal:t.signal});n&&(r.hasBlanking=n.hasBlanking,r.blankingNote=n.note)}if(t.picture?.headStructure){let n=await KA(e,o,{signal:t.signal});n&&(r.hasSlate=n.hasSlate,r.slateNote=n.note)}if(t.picture?.textlessTail){let n=await qA(e,o,{signal:t.signal});n&&(r.hasTextlessTail=n.hasTextlessTail,r.textlessNote=n.note)}if(t.picture?.blackFrames){let n=r.fps&&r.fps>0?Math.round(r.fps):24,i=await JA(e,n,o,{signal:t.signal});i&&(r.hasBlackFrames=i.hasBlackFrames,r.blackFramesNote=i.note)}return r}function ra(e,t,r,o,n,i){let a=St(e,t,r,o,(s,l)=>s===l,n);return i&&a.outcome!=="unstated"?{...a,note:i}:a}function cv(e,t){let r=t.plusMinus??0;return Math.abs(e-t.target)<=r+1e-9}function Q6(e){return e.plusMinus?`${e.target} \xB1${e.plusMinus}`:String(e.target)}function St(e,t,r,o,n,i){if(r==null)return{field:e,label:t,outcome:"unstated"};let a=i.required(r.value);return o==null||typeof o=="number"&&!Number.isFinite(o)?{field:e,label:t,outcome:"unmeasurable",required:a,note:"not reported by the probe"}:{field:e,label:t,outcome:n(r.value,o)?"pass":"fail",required:a,measured:i.measured(o)}}var cl={required:e=>e,measured:e=>e},oa={required:e=>String(e),measured:e=>String(e)},uv={required:Q6,measured:e=>String(e)};function YA(e,t){let r=e.video??{},o=e.audio??{},n=e.content??{};return[St("video.codec","Codec",r.codec,t.codec,(i,a)=>AA(i,{family:null,label:a}),cl),St("video.wrapper","Wrapper",r.wrapper,t.wrapper,(i,a)=>i.toLowerCase()===a.toLowerCase(),cl),St("video.width","Width",r.width,t.width,(i,a)=>i===a,oa),St("video.height","Height",r.height,t.height,(i,a)=>i===a,oa),St("video.fps","Frame rate",r.fps,t.fps,(i,a)=>cv(a,i),uv),St("video.durationFrames","Duration (frames)",r.durationFrames,t.durationFrames,(i,a)=>cv(a,i),uv),St("video.startTimecode","Start timecode",r.startTimecode,t.startTimecode,(i,a)=>i===a,cl),St("video.par","Pixel aspect ratio",r.par,t.par,(i,a)=>Math.abs(i-a)<=.005,oa),St("video.bitDepth","Bit depth",r.bitDepth,t.bitDepth,(i,a)=>i===a,oa),St("video.chroma","Chroma",r.chroma,t.chroma,(i,a)=>$l(i)===$l(a),cl),St("audio.channels","Audio channels",o.channels,t.audioChannels,(i,a)=>i===a,oa),St("audio.layout","Audio layout",o.layout,t.audioLayout,(i,a)=>i.toLowerCase()===a.toLowerCase(),cl),St("audio.sampleRate","Sample rate",o.sampleRate,t.audioSampleRate,(i,a)=>i===a,oa),St("audio.loudnessLufs","Loudness (LUFS)",o.loudnessLufs,t.loudnessLufs,(i,a)=>cv(a,i),uv),St("audio.truePeakDb","True peak (dBTP)",o.truePeakDb,t.truePeakDb,(i,a)=>a<=i+1e-9,{required:i=>`\u2264 ${i}`,measured:i=>i.toFixed(2)}),ra("content.twoPop","2-pop",n.twoPop,t.hasTwoPop,{required:i=>i?"present":"absent",measured:i=>i?"present":"absent"}),ra("content.slate","Slate",n.slate,t.hasSlate,{required:i=>i?"present":"absent",measured:i=>i?"present":"absent"},t.slateNote),ra("content.textlessAtTail","Textless at tail",n.textlessAtTail,t.hasTextlessTail,{required:i=>i?"present":"absent",measured:i=>i?"present":"absent"},t.textlessNote),ra("content.noBlanking","Free of blanking",n.noBlanking,t.hasBlanking==null?void 0:!t.hasBlanking,{required:i=>i?"no blanking":"blanking allowed",measured:i=>i?"none found":"blanking found"},t.blankingNote),ra("content.noBlackFrames","Free of black frames",n.noBlackFrames,t.hasBlackFrames==null?void 0:!t.hasBlackFrames,{required:i=>i?"no black frames":"black frames allowed",measured:i=>i?"none found":"black frames found"},t.blackFramesNote),ra("content.matchesMaster","Matches approved master",n.matchesMaster,t.matchesMaster,{required:i=>i?"must match":"need not match",measured:i=>i?"matches":"differs"})]}async function QA(e){let r=(await pt({op:"audio",path:e}).catch(()=>null))?.tracks??[];if(r.length===1){let n=(await Pe(e).catch(()=>null))?.streams?.filter(i=>i.kind==="audio").reduce((i,a)=>i+(a.channels??0),0)??0;n>r[0].channels&&(r[0].channels=n)}return r.map(o=>({track:o.track,channels:o.channels,rate:o.rate,lufs:o.lufs,peak_db:o.truePeak,findings:o.findings}))}var Ar=e=>e==null?"\u2014":`${e.toFixed(1)}`;function e3(e,t){if(!t.length)return[];let r=[],o=new Set;for(let n of e){if(n.lufs==null)continue;let i=t.map((l,c)=>({x:l,i:c,d:l.lufs==null?1/0:n.lufs-l.lufs})).sort((l,c)=>Math.abs(l.d)-Math.abs(c.d)),a=i.find(l=>Math.abs(l.d)<=.5&&l.x.channels===n.channels)??i.find(l=>Math.abs(l.d)<=.5),s=i.find(l=>l.d>=5&&l.d<=7);a&&o.add(a.i),r.push(a?{check:`Track ${n.track} vs mix`,outcome:a.x.channels===n.channels?"pass":"warn",measured:`= ${a.x.file} (${a.x.channels}ch, ${Ar(a.x.lufs)} LUFS, \u0394 ${a.d.toFixed(1)} LU)`,note:a.x.channels!==n.channels?"loudness matches but the channel count differs (downmix or wrong bus)":void 0}:{check:`Track ${n.track} vs mix`,outcome:"fail",measured:`${Ar(n.lufs)} LUFS`,note:s?`\u2248 +6 LU over ${s.x.file}: summed twice (two buses into one output, or a doubled track)`:`no mix file within 0.5 LU (nearest ${i[0]?.x.file??"\u2014"}: ${Ar(i[0]?.x.lufs??null)} LUFS)`})}return t.forEach((n,i)=>{o.has(i)||r.push({check:`Mix ${n.file}`,outcome:"warn",measured:`${n.channels}ch, ${Ar(n.lufs)} LUFS`,note:"no output track carries this mix (missing bus?)"})}),r}var Pr=e=>({value:e,source:"operator"});async function eE(e){let t=await xo.open(e.path),r=await XA(t,{loudness:!1}),o=e.fps??r.fps??24,n=y=>y==null?null:typeof y=="number"?y:qe(y,o),i=n(e.mark_in),a=n(e.mark_out),s=await po(),l=i!=null?ce(i,o):e.start_tc??s.conventions?.program_start,c=e.end_on_picture??s.conventions?.end_on_picture,u=e.frames??(i!=null&&a!=null?a-i+1:void 0),d={label:Io(e.path),video:{...e.codec?{codec:Pr(e.codec)}:{},...e.width?{width:Pr(e.width)}:{},...e.height?{height:Pr(e.height)}:{},...e.fps?{fps:Pr({target:e.fps,plusMinus:.001})}:{},...e.bit_depth?{bitDepth:Pr(e.bit_depth)}:{},...e.chroma?{chroma:Pr(e.chroma)}:{},...l?{startTimecode:Pr(l)}:{},...u?{durationFrames:Pr({target:u})}:{}}},f=YA(d,r).filter(y=>y.outcome!=="unstated").map(y=>({check:y.label,outcome:y.outcome==="pass"||y.outcome==="fail"?y.outcome:"unchecked",expected:y.required,measured:y.measured,note:y.note}));if(l||f.push({check:"Start timecode",outcome:"unchecked",measured:r.startTimecode,note:"no start TC stated and none in the artist's profile: confirm it (artist_profile action=remember convention program_start)"}),f.push({check:"Picture",outcome:"pass",measured:[r.codec,r.width&&`${r.width}x${r.height}`,r.fps&&`${+r.fps.toFixed(3)} fps`,r.bitDepth&&`${r.bitDepth}-bit`,r.chroma].filter(Boolean).join(", ")}),e.name!==!1)try{let y=zi(s,Io(e.path),{probe:await Pe(e.path)}),b=y.issues.filter(k=>k.level==="error"),w=y.issues.filter(k=>k.level==="warn");f.push({check:"Name",outcome:b.length?"fail":w.length?"warn":"pass",measured:Io(e.path),note:y.issues.map(k=>`${k.element}: ${k.message}`).join("; ")||void 0})}catch(y){f.push({check:"Name",outcome:"unchecked",note:String(y.message??y)})}try{let y=await pt({op:"ends",path:e.path,cap:Math.round(5*o),frames:r.durationFrames||void 0}),[b,w,k,I]=[y.first,y.last,y.head,y.tail],x=S=>S>=Math.round(5*o)?"5 s or more":`${S} frame(s)`;f.push({check:"First frame",outcome:b==null?"unchecked":b?"warn":"pass",measured:b==null?void 0:b?`black (${x(k)})`:"picture"}),f.push({check:"Last frame",outcome:w==null?"unchecked":w?c?"fail":"warn":"pass",measured:w==null?void 0:w?`black (last ${x(I)})`:"picture",note:w?c?"the job ends on picture: Mark Out past the end card, or a gap at the tail":"black tail: confirm the delivery spec pads with black":void 0})}catch{f.push({check:"First/last frame",outcome:"unchecked"})}let m=await QA(e.path),p=m.reduce((y,b)=>y+b.channels,0);e.channels!=null&&f.push({check:"Audio channels",outcome:p===e.channels?"pass":"fail",expected:String(e.channels),measured:`${p} (${m.map(y=>`track ${y.track}: ${y.channels}ch`).join(", ")||"no audio"})`});for(let y of m){let b=e.loudness_lufs==null||y.lufs==null?null:Math.abs(y.lufs-e.loudness_lufs)<=(e.loudness_tolerance??1),w=e.true_peak==null||y.peak_db==null?null:y.peak_db<=e.true_peak;f.push({check:`Audio track ${y.track}`,outcome:b===!1||w===!1?"fail":y.lufs==null?"unchecked":"pass",expected:[e.loudness_lufs!=null&&`${e.loudness_lufs} LUFS \xB1${e.loudness_tolerance??1}`,e.true_peak!=null&&`\u2264 ${e.true_peak} dBTP`].filter(Boolean).join(", ")||void 0,measured:`${y.channels}ch${y.rate?` ${y.rate/1e3} kHz`:""}, ${Ar(y.lufs)} LUFS, ${Ar(y.peak_db)} dBTP`})}for(let y of m)for(let b of y.findings)f.push({check:`Audio track ${y.track} ${b.check}`,outcome:b.severity==="fail"?"fail":"warn",measured:`${b.channel?`ch ${b.channel} `:""}${b.start!=null?`at ${b.start.toFixed(3)} s: `:""}${b.detail}`});let g=m.find(y=>y.channels===2)??m[0],_=s.conventions?.theatrical_tag;if(_&&g?.lufs!=null&&e.name!==!1){let y=new RegExp(`[_\\-. ]${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}([_\\-. ]|$)`,"i").test(Io(e.path));y&&g.lufs>-20&&f.push({check:`${_} tag`,outcome:"warn",measured:`${Ar(g.lufs)} LUFS on track ${g.track}`,note:`tagged ${_} (theatrical) but measures at a web/nearfield level`}),!y&&g.lufs<-27&&f.push({check:`${_} tag`,outcome:"warn",measured:`${Ar(g.lufs)} LUFS on track ${g.track}`,note:`measures at a theatrical level: add _${_} to the audio config? ask`})}m.length||f.push({check:"Audio",outcome:e.channels===0?"pass":e.channels||e.mix?.length?"fail":"warn",measured:"no audio tracks"});let v=[];for(let y of e.mix??[]){let b=await QA(y);b.length||f.push({check:`Mix ${Io(y)}`,outcome:"unchecked",measured:"no audio read from this file"});for(let{findings:w,...k}of b)v.push({...k,file:Io(y)})}if(f.push(...e3(m,v)),e.ref)try{let y=await Pl({a:e.path,b:e.ref,b_in:e.ref_in??r.startTimecode??l}),b=y.overall;f.push({check:"Picture vs REF",outcome:b.verdict==="exact"?"pass":b.verdict==="unverifiable"?"warn":"fail",measured:b.verdict==="offset"?`offset ${b.offset>0?"+":""}${b.offset} frame(s)`:b.verdict,expected:`exact at ${y.b_tc}`,note:[...y.shots.filter(w=>w.verdict!=="exact").slice(0,5).map(w=>`shot ${w.a_tc}: ${w.verdict}${w.offset?` ${w.offset>0?"+":""}${w.offset}`:""}`),...y.flash].join("; ")||void 0})}catch(y){f.push({check:"Picture vs REF",outcome:"unchecked",note:String(y.message??y)})}return{file:Io(e.path),verdict:f.some(y=>y.outcome==="fail")?"FAIL":"PASS",rows:f,tracks:m,mix:v}}function tE(e){let t={pass:"PASS",fail:"FAIL",warn:"WARN",unchecked:"----"};return[`${e.verdict}: ${e.file}`,...e.rows.map(r=>` ${t[r.outcome]} ${r.check}: ${r.measured??"could not measure"}${r.expected?` (expected ${r.expected})`:""}${r.note?` \u2014 ${r.note}`:""}`)].join(`
|
|
195
|
+
`)}import{basename as nE}from"node:path";async function t3(e,t){let o=(await Pe(e).catch(()=>null))?.vendor_metadata?.bext,n=await pt({op:"mix",path:e,fps:t}).catch(()=>null);if(!n)return null;let[i,a,s,l,c]=[n.rate,n.channels,n.samples,n.lastSound,n.pop],u=a0(o?.time_reference??0,o?.sample_rate||i,s,t),d=qe(u.tc,t)??0,f=m=>d+Math.floor(m*u.frames/Math.max(s,1));return{file:nE(e),channels:a,start:d,end:d+u.frames,last_sound:l<0?d:f(l)+1,pop:c?f(c.atSeconds*i):null}}function n3(e){let t=e.toUpperCase().split(/[_.]/),r=[];for(let n of t)n==="5-1"?r.push({label:"5.1",channels:6}):n==="7-1"?r.push({label:"7.1",channels:8}):n==="STEREO"||n==="LORO"?r.push({label:n==="LORO"?"LoRo":"stereo",channels:2}):n==="MONO"&&r.push({label:"mono",channels:1});let o=t.map(n=>/^(\d+)CH$/.exec(n)).find(Boolean);return{total:o?Number(o[1]):null,parts:r}}async function rE(e,t){let r=Zd(e,t.timeline_id),o=Ze(r),n=!!r.is_drop_frame,i=k=>ce(k,o,n),a=r.tracks.filter(k=>k.kind==="Video"),s=Qi(r,a),l=[];if(!s.length)throw new Error("the timeline has no enabled video");let c=s[0].s,u=s[s.length-1].e,d=[];for(let k of t.mix??[]){let I=await t3(k,o);I?d.push(I):l.push({check:`Mix ${nE(k)}`,outcome:"unchecked",measured:"no audio read from this file"})}let f=d[0],m=t.program_start??(await po()).conventions?.program_start,p=m?qe(m,o):null,g=f?.pop!=null?f.pop+Math.round(2*o):null,_=g??(p!=null&&p>=c-Math.round(10*o)?p:c);f&&l.push(f.pop!=null?{check:"2-pop",outcome:p==null||g===p?"pass":"warn",measured:`${i(f.pop)} in ${f.file} \u2192 program starts ${i(g)}`,note:p!=null&&g!==p?`the stated start is ${i(p)}`:void 0}:{check:"2-pop",outcome:"warn",measured:`none found in the first 15 s of ${f.file}`,note:`program start taken as ${i(_)}`});let v=f?f.last_sound:u;if(f){let k=u-f.last_sound;l.push({check:"Picture end vs mix end",outcome:k===0?"pass":"fail",measured:`picture ends ${i(u-1)} (last frame), sound ends ${i(f.last_sound-1)}`,note:k===0?void 0:k<0?`picture stops ${-k} frame(s) before the mix: ${-k} frame(s) of black under sound. EDIT ERROR: extend the last shot/card, or ask`:`picture runs ${k} frame(s) past the mix: picture with no sound at the end. EDIT ERROR: ask before trimming`});for(let I of d.slice(1))I.last_sound!==f.last_sound&&l.push({check:`Mix ${I.file} end`,outcome:"warn",measured:`sound ends ${i(I.last_sound-1)}`,note:`${f.file} ends ${i(f.last_sound-1)}`});f.start>_&&l.push({check:"Mix start",outcome:"fail",measured:`${f.file} starts ${i(f.start)}`,note:`after the program start ${i(_)}: no sound under the first frames`})}c>_&&l.push({check:"Picture start",outcome:"fail",measured:`first picture ${i(c)}`,note:`${c-_} frame(s) of black after the program start ${i(_)}`});let y=s.find(k=>k.s<=v-1&&k.e>=v);l.push({check:"Last program frame",outcome:y?"pass":"fail",measured:y?`${i(v-1)}: ${y.it.name??"clip"} (${y.track})`:`${i(v-1)}: no picture`,note:y?"confirm it is the end card, not black inside the clip":"the program ends on a gap"});let b=[],w=_;for(let k of s)if(!(k.e<=_)){if(k.s>=v)break;k.s>w&&b.push([w,Math.min(k.s,v)]),w=Math.max(w,k.e)}w<Math.min(v,u)&&b.push([w,Math.min(v,u)]),l.push(b.length?{check:"Gaps in the program",outcome:"warn",measured:b.map(([k,I])=>`${i(k)}\u2013${i(I-1)} (${I-k} fr)`).join(", "),note:"black in the render: check each against the REF (intentional or an edit error)"}:{check:"Gaps in the program",outcome:"pass",measured:"none"});for(let k of a){if(k.enabled===!1)continue;let I=k.items.filter(S=>S.kind==="clip"&&S.enabled!==!1).map(S=>(r.start_frame??0)+S.timeline_range.start.value+S.timeline_range.duration.value),x=Math.max(...I,-1/0);x>Math.min(v,u)-Math.round(o)&&x<Math.min(v,u)&&l.push({check:`Track ${Yt(k,r.tracks)}`,outcome:"warn",measured:`ends ${Math.min(v,u)-x} frame(s) before the picture ends`,note:"an effect/adjustment layer should cover the whole program"})}if(t.name){let k=n3(t.name),I=k.parts.reduce((x,S)=>x+S.channels,0);if(k.total!=null&&k.parts.length&&I!==k.total)l.push({check:"Name audio",outcome:"fail",measured:t.name,note:`${k.total}CH but ${k.parts.map(x=>x.label).join(" + ")} = ${I} channels`});else if(k.parts.length&&d.length){let x=[...d],S=k.parts.filter(R=>{let $=x.findIndex(C=>C.channels===R.channels);return $<0?!0:(x.splice($,1),!1)});l.push({check:"Name audio vs mix",outcome:S.length?"fail":"pass",measured:`${k.parts.map(R=>`${R.label} (${R.channels}ch)`).join(" + ")} = ${I}ch`,note:S.length?`no ${S.map(R=>`${R.channels}ch mix for ${R.label}`).join(", ")} among ${d.map(R=>`${R.file} (${R.channels}ch)`).join(", ")}`:"route each to an output track in this order (host_render audio_tracks), then qc_deliverable the render"})}}return{verdict:l.some(k=>k.outcome==="fail"||k.outcome==="unchecked"&&k.check.startsWith("Mix "))?"STOP":"READY",rows:l,mark_in:i(_),mark_out:i(v-1),program:[_,v],mix:d}}function oE(e){let t={pass:"PASS",fail:"FAIL",warn:"WARN",unchecked:"----"};return[`${e.verdict==="READY"?"READY to render":"STOP: fix before rendering"} \u2014 Mark In ${e.mark_in}, Mark Out ${e.mark_out} (inclusive, ${e.program[1]-e.program[0]} frames)`,...e.rows.map(r=>` ${t[r.outcome]} ${r.check}: ${r.measured??"could not measure"}${r.note?` \u2014 ${r.note}`:""}`)].join(`
|
|
196
|
+
`)}import{basename as iE}from"node:path";async function aE(e,t=16){let r=await Pe(e),o=r.streams?.find(w=>w.kind==="video"),n=o?.width??0,i=o?.height??0,a=r.available_range?.duration.value??0;if(!n||!i)throw new Error(`${iE(e)}: no raster in the probe`);let s=await pt({op:"aspect",path:e,samples:t,frames:a||void 0}),l=s.w,c=s.h,u=s.active??{x:0,y:0,w:l,h:c},d=n/l,f=i/c,m={x:Math.round(u.x*d),y:Math.round(u.y*f),w:Math.round(u.w*d),h:Math.round(u.h*f)},p=m.h<i-2,g=m.w<n-2,_=p&&g?"windowbox":p?"letterbox":g?"pillarbox":"none",v=m.w/m.h,y=w=>2*Math.round(w/2),b=_==="pillarbox"?`${y(i*v)}x${i}`:`${n}x${y(n/v)}`;return{file:iE(e),width:n,height:i,frames_sampled:s.sampled,active:m,boxing:_,aspect:+v.toFixed(4),aspect_name:s.name??v.toFixed(2),oar_raster:_==="none"?`${n}x${i}`:b}}function sE(e){return`${e.boxing==="none"?`${e.file}: full ${e.width}x${e.height} raster is picture \u2192 OAR ${e.aspect_name}, no boxing`:`${e.file}: ${e.boxing}: active picture ${e.active.w}x${e.active.h} at (${e.active.x},${e.active.y}) inside ${e.width}x${e.height} \u2192 OAR ${e.aspect_name}; OAR raster ${e.oar_raster}`}
|
|
197
|
+
(${e.frames_sampled} frames sampled across the clip; a bar counts only when \u226580% of them carry it)`}var mE=/lower ?thirds?|\bLTs?\b|titles?|subtitles?|\bsubs\b|captions?|graphics?|\bgfx\b|\btext\b|supers?/i,jt=e=>[e.timeline_range.start.value,e.timeline_range.start.value+e.timeline_range.duration.value],lE=e=>mE.test(e.name??"")||e.items.some(t=>t.kind!=="gap")&&e.items.every(t=>t.kind==="gap"||!!t.title),ul=e=>e.enabled!==!1&&(e.kind==="clip"||e.kind==="nested"),cE=e=>`V${e.track_index}${e.name?` "${e.name}"`:""}`,r3=/\b(TEXTED|TEXTLESS|MASTER|MEZZ(ANINE)?)(\b|_)/i,uE=300,o3=60;function fE(e,t,r={}){let o=e.timelines.filter(O=>O.kind!=="compound"),n=r.timeline_id?o.find(O=>O.id===r.timeline_id):o.find(O=>O.tracks.some(G=>G.kind==="Video"&&G.items.length));if(!n)throw new P("not_found",r.timeline_id?`no timeline ${r.timeline_id} in this session`:"the session has no timeline with video");if(!t.length)throw new P("invalid_args","changes is empty: give clip ids or record ranges");let i=Ze(n),a=n.start_frame??0,s=!!n.is_drop_frame,l=O=>ce(O+a,i,s),c=[],u=n.tracks.filter(O=>O.kind==="Video"&&O.enabled!==!1).sort((O,G)=>G.track_index-O.track_index),d=new Set,f=(O,G)=>u.some(X=>X.track_index<O.track_index&&X.items.some(ae=>ul(ae)&&jt(ae)[0]<jt(G)[1]&&jt(ae)[1]>jt(G)[0]));for(let O of u)for(let G of O.items)!ul(G)||G.title||(r3.test(G.name??"")||G.timeline_range.duration.value>=uE*i&&f(O,G))&&d.add(G);d.size&&c.push(`baked picture (a laid-back master, or a clip of ${uE/60} min or more) left out of the cut points, the edits under it decide: ${[...d].map(O=>`"${O.name??O.id}" ${l(jt(O)[0])}\u2013${l(jt(O)[1]-1)}`).join(", ")}`);let m=O=>ul(O)&&!d.has(O),p=u.filter(lE),g=u.filter(O=>!lE(O));for(let O of n.tracks)O.kind==="Video"&&O.enabled===!1&&mE.test(O.name??"")&&O.items.some(ul)&&c.push(`${cE(O)} is a graphics track but disabled: left out of TEXTED too; enable it if the master carries it`);let _=Math.max(0,...u.flatMap(O=>O.items.filter(ul).map(G=>jt(G)[1]))),v=new Set([0,_]);for(let O of g)for(let G of O.items)m(G)&&jt(G).forEach(X=>v.add(X));let y=[...v].filter(O=>O>=0&&O<=_).sort((O,G)=>O-G),b=[];for(let O=0;O+1<y.length;O++){let[G,X]=[y[O],y[O+1]],ae={start:G,end:X,item:null,track:null};for(let j of g){let V=j.items.find(Z=>m(Z)&&jt(Z)[0]<=G&&jt(Z)[1]>=X);if(V){ae={start:G,end:X,item:V,track:j};break}}let Y=b[b.length-1];Y&&Y.item===ae.item?Y.end=X:b.push(ae)}let w=[...p.flatMap(O=>O.items.filter(m).map(jt)),...u.flatMap(O=>O.items.filter(G=>G.kind==="transition").map(jt))],k=new Set([0,_,...b.map(O=>O.start)].filter(O=>!w.some(([G,X])=>G<O&&O<X))),I=O=>Math.max(...[...k].filter(G=>G<=O)),x=O=>Math.min(...[...k].filter(G=>G>=O)),S=O=>b.find(G=>G.start<=O&&O<G.end),R=new Map(n.tracks.flatMap(O=>O.items.map(G=>[G.id,G]))),$=O=>{if(typeof O=="number")return O-a;let G=qe(O,i);if(G==null){if(/^\d+$/.test(O))return Number(O)-a;throw new P("invalid_args",`cannot read '${O}' as a record timecode`)}return G-a},C=t.map(O=>{if(typeof O=="string"){let ae=R.get(O);if(!ae)throw new P("not_found",`no clip ${O} on ${n.name} (item ids come from timeline_query)`);return[...jt(ae)]}let[G,X]=[$(O.in),$(O.out)+1];if(X<=G)throw new P("invalid_args",`range ${O.in}..${O.out} is empty or backwards`);return[G,X]}).sort((O,G)=>O[0]-G[0]);for(let[O,G]of C)if(O<0||G>_)throw new P("invalid_args",`change ${l(O)}\u2013${l(G-1)} is outside the timeline (${l(0)}\u2013${l(_-1)})`);let E=[];for(let[O,G]of C){let X=O>0?S(O-1):void 0,ae=G<_?S(G):void 0,Y=I(X?.item?X.start:O),j=x(ae?.item?ae.end:G),V=E[E.length-1];V&&Y<=V.tail?(V.tail=Math.max(V.tail,j),V.changes.push([O,G])):E.push({head:Y,tail:j,changes:[[O,G]]})}let L=O=>O.item?O.item.name??O.item.reel_name??O.item.id:"(black)",q=E.map((O,G)=>{let X=b.filter(ne=>ne.end>O.head&&ne.start<O.tail),ae=ne=>O.changes.some(([ye,Be])=>ne.end>ye&&ne.start<Be),Y=X.findIndex(ae),j=X.length-1-[...X].reverse().findIndex(ae),V=X.map((ne,ye)=>({role:ae(ne)?"changed":ye===Y-1?"before":ye===j+1?"after":"inside",name:L(ne),track:ne.track?cE(ne.track):"-",rec_in_tc:l(ne.start),frames:ne.end-ne.start})),Z=p.filter(ne=>ne.items.some(ye=>m(ye)&&jt(ye)[1]>O.head&&jt(ye)[0]<O.tail)),Q=[];for(let ne of V)(ne.role==="before"||ne.role==="after")&&ne.frames>o3*i&&Q.push(`the ${ne.role} clip "${ne.name}" runs ${Math.round(ne.frames/i)} s: check it is a real shot, not baked picture`);return V.some(ne=>ne.role==="before")||Q.push("no clip before the change (timeline head or black): starts on the change"),V.some(ne=>ne.role==="after")||Q.push("no clip after the change (timeline tail or black): ends on the change"),Z.length||Q.push("no graphics in range: one render serves TEXTED and TEXTLESS"),{nn:(r.first_patch??1)+G,range:{in:O.head+a,out:O.tail-1+a},frames:O.tail-O.head,rec_in_tc:l(O.head),rec_out_tc:l(O.tail-1),start_tc:l(O.head),versions:Z.length?["TEXTED","TEXTLESS"]:["TEXTED"],textless_exclude_tracks:Z.map(ne=>({index:ne.track_index,name:ne.name??null})),audio:!1,neighbours:V,notes:Q}});return{timeline:n.name,fps:i,start_tc:l(0),patches:q,warnings:c}}function pE(e){let t=`${e.patches.length} patch${e.patches.length===1?"":"es"} on ${e.timeline}: `+e.patches.map(o=>`PATCH${String(o.nn).padStart(2,"0")} ${o.rec_in_tc}\u2013${o.rec_out_tc} (${o.frames} fr, ${o.versions.join("+")})`).join("; "),r=e.patches.flatMap(o=>[`PATCH${String(o.nn).padStart(2,"0")}: record ${o.rec_in_tc}\u2013${o.rec_out_tc} inclusive, ${o.frames} frames; host_render range {in:${o.range.in}, out:${o.range.out}}; file TC ${o.start_tc}; picture only`,...o.neighbours.map(n=>` ${n.role.padEnd(7)} ${n.rec_in_tc} ${String(n.frames).padStart(5)} fr ${n.track} ${n.name}`),o.textless_exclude_tracks.length?` TEXTLESS: leave out ${o.textless_exclude_tracks.map(n=>`V${n.index}${n.name?` "${n.name}"`:""}`).join(", ")}`:"",...o.notes.map(n=>` note: ${n}`)].filter(Boolean));return[t,...r,...e.warnings.map(o=>`warning: ${o}`)].join(`
|
|
198
|
+
`)}function dE(e){let t=e.streams?.find(o=>o.kind==="video"),r=t?.codec_specific??{};return{codec:t?.codec,fourcc:r.fourcc,profile:r.profile,pixel_format:r.pixel_format,bit_depth:t?.bit_depth,raster:t?.width?`${t.width}x${t.height}`:void 0,fps:Math.round((e.source_fps??t?.rate??0)*1e3)/1e3,colour:r.colr?`${r.colr.primaries}/${r.colr.transfer}/${r.colr.matrix}`:void 0}}async function dv(e,t,r){return(await pt({op:"hashes",path:e,from:t,count:r})).hashes.map(n=>n??void 0)}async function i3(e){let t=Math.max(2,Math.round(e.fps*2)),r=[];for(let[o,n]of[["head",e.offset],["tail",e.offset+e.frames]]){let i=Math.max(0,n-t),a=Math.min(e.mframes,n+t),s=a-i;if(s<=0)continue;let l=await dv(e.master,i,s),c=Math.max(i,e.offset),u=Math.min(a,e.offset+e.frames),d=u>c?await dv(e.patch,c-e.offset,u-c):[],f=e.original?await dv(e.original,i,s):null,m=0,p=0,g=0,_=0;l.forEach((y,b)=>{let w=i+b;w>=c&&w<u?(p++,(!y||y!==d[w-c])&&m++):f&&(_++,(!y||y!==f[b])&&g++)});let v=l.filter(y=>!y).length;r.push({seam:o,tc:ce(e.master_tc+n,e.fps),frames:[i,a-1],inside:p?m?`${m}/${p} frames differ from the patch`:`${p} frames = the patch`:"\u2014",outside:f?g?`${g}/${_} frames differ from the original`:`${_} frames = the original`:"no original given (pass original= a backup to prove the neighbours)",undecoded:v,ok:!m&&!g&&!v})}return r}async function hE(e,t){let[r,o]=await Promise.all([Pe(e.patch),Pe(e.master)]),n=dE(r),i=dE(o),a=Object.keys(n).map(w=>({field:w,patch:n[w],master:i[w],ok:n[w]===i[w]})),s=r.available_range?.duration.value??r.declared_duration?.value??0,l=o.available_range?.duration.value??o.declared_duration?.value??0,c=n.fps||i.fps,u=[];e.expected_frames!=null&&u.push({what:"frames",ok:s===e.expected_frames,detail:`${s} frames, expected ${e.expected_frames}`});let d=r.source_timecode??null,f=o.source_timecode??null;e.expected_tc&&u.push({what:"start TC",ok:d!=null&&qe(d,c)===qe(e.expected_tc,c),detail:`starts ${d??"with no TC"}, expected ${e.expected_tc}`});let m=r.streams?.filter(w=>w.kind==="audio").length??0;u.push({what:"picture only",ok:m===0,detail:m?`${m} audio track(s)`:"no audio"});let p=null,g=[],_=[],v=d?qe(d,c):null,y=f?qe(f,c):null;if(v==null||y==null)u.push({what:"position in master",ok:!1,detail:"no start TC on the patch or the master: cannot place it"});else if(v-y<0||v-y+s>l)u.push({what:"position in master",ok:!1,detail:`${d} + ${s} fr is outside the master (${f}, ${l} fr)`});else{p=v-y,u.push({what:"position in master",ok:!0,detail:`master frames ${p}\u2013${p+s-1}`});let w=await pt({op:"patch",patch:e.patch,master:e.master,offset:p,frames:s,tolerance:e.tolerance??10},t);for(let I of w.mismatches)g.push({...I,tc:ce((v??0)+I.frame,c)});for(let I of w.shotChanges)_.push(ce((v??0)+I,c));let k=w.undecoded;k&&u.push({what:"decode",ok:!1,detail:`${k} patch frame(s) did not decode`}),u.push({what:"picture vs master",ok:!g.length,detail:g.length?`${g.length}/${s} frames differ (first ${g[0].tc})`:`all ${s} frames match at the same TC`})}let b;if(p!=null)try{b=await i3({master:e.master,patch:e.patch,original:e.original,offset:p,frames:s,mframes:l,fps:c,master_tc:y??0});let w=b.filter(I=>!I.ok);b.length&&b.every(I=>/^(\d+)\/\1 frames differ from the patch$/.test(I.inside)&&!I.undecoded)?(u.push({what:"seam decode",ok:!0,detail:"not spliced yet: the master still has its own frames in the span; run patch_verify again after media_patch"}),b=void 0):u.push({what:"seam decode",ok:!w.length,detail:w.length?w.map(I=>`${I.seam} ${I.tc}: ${[I.inside,I.outside,I.undecoded?`${I.undecoded} undecoded`:""].filter(Boolean).join("; ")}`).join(" | "):`${b.length} seam(s): every frame decodes and matches${e.original?"":" the patch (neighbours unchecked: no original)"}`})}catch(w){if(!/not installed|missing/.test(String(w)))throw w}return{ok:a.every(w=>w.ok)&&u.every(w=>w.ok),spec:a,frames:s,start_tc:d,master_offset:p,checks:u,mismatches:g,shot_changes:_,seams:b}}function gE(e,t){let r=[...e.spec.filter(o=>!o.ok).map(o=>o.field),...e.checks.filter(o=>!o.ok).map(o=>o.what)];return[`${e.ok?"PASS":"FAIL"}: ${B(t.patch)} vs ${B(t.master)}${r.length?` (${r.join(", ")})`:""}`,...e.spec.map(o=>` ${o.ok?"ok ":"DIFF"} ${o.field}: ${o.patch??"-"}${o.ok?"":` (master ${o.master??"-"})`}`),...e.checks.map(o=>` ${o.ok?"ok ":"FAIL"} ${o.what}: ${o.detail}`),...e.mismatches.slice(0,40).map(o=>` frame ${o.frame} @ ${o.tc}: mean diff ${o.mean}, max ${o.max}`),e.mismatches.length>40?` \u2026 ${e.mismatches.length-40} more`:"",e.shot_changes.length?` shot changes in the patch at ${e.shot_changes.join(", ")}`:"",...(e.seams??[]).map(o=>` seam ${o.seam} ${o.tc} (master frames ${o.frames[0]}\u2013${o.frames[1]}): ${o.ok?"ok":"FAIL"} \u2014 inside: ${o.inside}; outside: ${o.outside}${o.undecoded?`; ${o.undecoded} undecoded`:""}`)].filter(Boolean).join(`
|
|
199
|
+
`)}var a3="ConformTools:blanking:error",s3="ConformTools:blanking:black";function l3(e,t,r){return e*175e4*(t*r/(1920*1080))}async function bE(e,t){let r=-1;for(let o=Date.now()+t;Date.now()<o;){if(await Ge(e)){let n=(await ct(e)).size;if(n>0&&n===r)return!0;r=n}await new Promise(n=>setTimeout(n,500))}return r>0}async function mv(e,t,r,o){let n=new Promise(i=>o?.addEventListener("abort",()=>i(),{once:!0}));for(;t.state==="queued"||t.state==="rendering";){if(r?.(t.percent,100,"rendering"),await Promise.race([n.then(()=>!0),new Promise(a=>setTimeout(()=>a(!1),1e3))]))return await e.renderCancel(t.job_id);t=await e.renderStatus(t.job_id)}return t}async function yE(e,t,r,o,n,i={}){let a=[],s=await(i.status??Ml)();if(s.readiness!=="ready")if(s.readiness==="unknown")a.push("Resolve's log does not say whether it loaded the renderplugin; trying anyway");else throw new Error(`renderplugin ${s.readiness}: ${s.next}`);let l=async(X,ae)=>{let Y=await t(X,ae,6e4);if(!Y.ok)throw new Error(`resolve: ${Y.detail||Y.why}`);return Y};o?.(0,100,"preparing");let c=await l("renderplugin_preset",{preset_path:await J0()});c.imported&&a.push(`imported the conform.tools render preset into this Resolve database${c.replaced?" (replaced a stale one)":""}`);let u=await l("clips",{timeline:r.timeline}),d=r.range?.in??u.start_frame,f=r.range?r.range.out-r.range.in+1:u.end_frame-u.start_frame,m=M(he(),"renderplugin",`${u.timeline.replace(/[^\w.-]+/g,"_")}_${Date.now()}`);await be(m);let p=l3(f,u.width,u.height)*1.15+5e9,g=await hl(m);if(!r.ignore_space&&g!==null&&g<p)throw await et(m),new Error(`not enough space for the throwaway render: about ${(p/1e9).toFixed(1)} GB needed, ${(g/1e9).toFixed(1)} GB free on the volume holding ${he()}. Free space, set CONFORM_MCP_HOME to a bigger volume, or pass ignore_space.`);let _=await e.renderStart({timeline:u.timeline,target_dir:m,name:"conform.tools",range:r.range,audio:r.audio??!0,renderplugin:r.checks??{}});if(_=await mv(e,_,o,n),_.state!=="complete")throw await et(m),new Error(`the renderplugin render ${_.state}${_.error?`: ${_.error}`:""}`);o?.(100,100,"reading the report");let v=M(m,"qc_report.json");if(!await bE(v,3e4))throw new Error("the render finished but wrote no qc_report.json: the preset is not selecting the renderplugin codec, or Resolve has not loaded the renderplugin (restart Resolve)");let y=JSON.parse(await _e(v)),b=y.width||u.width,w=y.height||u.height,k=y.fps_num&&y.fps_den?y.fps_num/y.fps_den:Number(u.fps)||24,I=ww(r.strictness,r.overrides),x=y.frame_stats??[],S=kw(x,u.clips,d,b,w,{...I,expected_aspect_ratio:r.expected_aspect}),R=x.some(X=>(X.avg_luma??0)>1.5)?1:255,$=xw(x.filter(X=>(X.avg_luma??255)*R<I.black_threshold).map(X=>({frame:d+X.pts,avg:(X.avg_luma??0)*R})),I.gap_frames),C=(y.checks??[]).filter(X=>X.status==="fail"||X.status==="warn").map(X=>({id:X.id,label:X.label??X.id,status:X.status,ranges:X.ranges?.length??0})),E,L=M(m,"qc_audio.json");if((r.audio??!0)&&await bE(L,8e3)){let X=JSON.parse(await _e(L));E={integrated_lufs:X.integrated_lufs,true_peak_dbtp:X.true_peak_dbtp,issues:X.issues?.length??0}}let q;if(r.markers??!0){let X=j=>ce(j,k),ae=[...S.map(j=>({frame:j.start_frame-u.start_frame,duration:j.duration_frames,color:"Red",tag:a3,name:"conform.tools blanking",note:`Zone: ${j.zones.join(", ")} | max ${Math.max(j.measured.bt,j.measured.bb,j.measured.bl,j.measured.br)}px | ${j.frame_count} frame(s) | frames ${j.start_frame}-${j.end_frame} @ ${X(j.start_frame)}`})),...$.map(j=>({frame:j.start_frame-u.start_frame,duration:j.duration_frames,color:"Yellow",tag:s3,name:"conform.tools black frames",note:`${j.frames} black frame(s) @ ${X(j.start_frame)}`}))];await l("markers",{timeline:u.timeline,tag:"ConformTools:blanking",clear:!0,place:[]});let Y=await l("markers",{timeline:u.timeline,tag:"ConformTools:blanking",place:ae});q={placed:Number(Y.placed),skipped:Y.skipped}}let O;for await(let X of je(m))!X.isFile||X.name.startsWith("qc_")||(r.keep_render?(O??=[]).push(M(m,X.name)):await et(M(m,X.name)));let G=$w(S).length;return S.length&&a.push(`${S.length} blanking finding(s) on ${G} clip(s)`),{timeline:u.timeline,frames:f,raster:{width:b,height:w},fps:k,strictness:I,blanking:S,black:$,checks:C,audio:E,markers:q,report_dir:m,...O?{render_kept:O}:{},notes:a}}function _E(e){let t=n=>ce(n,e.fps),r=e.blanking.length+e.black.length+e.checks.filter(n=>n.status==="fail").length,o=[`renderplugin scan of ${e.timeline}: ${r?`${r} finding(s)`:"clean"} over ${e.frames} frames (${e.raster.width}x${e.raster.height}, ${e.strictness.preset} strictness)`];for(let n of e.blanking){let i=Math.max(n.measured.bt,n.measured.bb,n.measured.bl,n.measured.br);o.push(` blanking ${t(n.start_frame)}\u2013${t(n.end_frame)} ${n.clip.name} (V${n.clip.track}) ${n.zones.join("/")} ${i}px, ${n.frame_count} frame(s)`)}for(let n of e.black)o.push(` black ${t(n.start_frame)}\u2013${t(n.end_frame)} ${n.frames} frame(s)`);for(let n of e.checks)o.push(` ${n.status.padEnd(9)} ${n.label}${n.ranges?` (${n.ranges} range(s))`:""}`);return e.audio&&o.push(` audio ${e.audio.integrated_lufs??"?"} LUFS integrated, ${e.audio.true_peak_dbtp??"?"} dBTP true peak, ${e.audio.issues} issue(s)`),e.markers&&o.push(`markers: ${e.markers.placed} placed on the timeline${e.markers.skipped.length?`, ${e.markers.skipped.length} skipped (a frame already had someone else's marker)`:""}`),o.push(...e.notes.map(n=>`note: ${n}`),`report: ${e.report_dir}`),e.render_kept&&o.push(`render kept: ${e.render_kept.join(", ")}`),o.join(`
|
|
200
|
+
`)}import{createHash as c3}from"node:crypto";var dl=e=>jn(new URL(e,import.meta.url)),To=e=>/^__version__\s*=\s*["']([^"']+)["']/m.exec(e)?.[1]??"";async function fv(e,t=""){let r={};for await(let o of je(e))o.name==="__pycache__"||/\.py[co]$/.test(o.name)||(o.isDirectory?Object.assign(r,await fv(M(e,o.name),`${t}${o.name}/`)):o.isFile&&(r[`${t}${o.name}`]=M(e,o.name)));return r}async function vE(){let e=dl("./peer-kit/ctpeer/"),t=[];for await(let i of je(e))i.isFile&&i.name.endsWith(".py")&&t.push(i.name);t.sort();let r={},o=c3("sha256");for(let i of t)r[i]=await ut(M(e,i)),o.update(i),o.update(r[i]);let n={ctpeer_version:To(new TextDecoder().decode(r["__init__.py"])),ctpeer_sha256:o.digest("hex")};return r["VENDORED.json"]=new TextEncoder().encode(JSON.stringify(n,null,2)),r}var om="conformtools_flame_hook.py",im="conformtools_flame.zip";function wE(e=vt()){return e==="darwin"?M(ir(),"Library","Preferences","Autodesk","flame","python"):M(ir(),"flame","python")}async function u3(e=wE()){let t=dl("./flame/hook/"),r={};for(let[o,n]of Object.entries(await fv(M(t,"conformtools_flame"))))r[`conformtools_flame/${o}`]=await ut(n);for(let[o,n]of Object.entries(await vE()))r[`ctpeer/${o}`]=n;return await be(e),await pl(M(t,om),M(e,om)),await Nt(M(e,im),Pw(r)),{version:To(await _e(M(t,"conformtools_flame","__init__.py"))),dest:e,files:[M(e,om),M(e,im)]}}async function d3(e=wE()){if(!await Ge(M(e,om))||!await Ge(M(e,im)))return{installed:!1,dest:e};let t=vl(await ut(M(e,im)),{filter:r=>r.name==="conformtools_flame/__init__.py"})["conformtools_flame/__init__.py"];return{installed:!0,dest:e,...t?{version:To(new TextDecoder().decode(t))}:{}}}async function m3(){return To(await _e(dl("./flame/hook/conformtools_flame/__init__.py")))}var kE=()=>M(ir(),".nuke");async function f3(e=kE()){let t=dl("./nuke/panel/python/"),r=M(e,"Python");await be(M(r,"Startup")),await pl(M(t,"Startup","conformtools_nuke_startup.py"),M(r,"Startup","conformtools_nuke_startup.py"));for(let o of["conformtools_nuke","ctpeer"])await et(M(r,o));for(let[o,n]of Object.entries(await fv(M(t,"conformtools_nuke"))))await be(M(r,"conformtools_nuke",...o.split("/").slice(0,-1))),await pl(n,M(r,"conformtools_nuke",o));await be(M(r,"ctpeer"));for(let[o,n]of Object.entries(await vE()))await Nt(M(r,"ctpeer",o),n);return{version:To(await _e(M(t,"conformtools_nuke","__init__.py"))),dest:e,files:[M(r,"Startup","conformtools_nuke_startup.py"),M(r,"conformtools_nuke"),M(r,"ctpeer")]}}async function p3(e=kE()){let t=M(e,"Python");if(!await Ge(M(t,"Startup","conformtools_nuke_startup.py")))return{installed:!1,dest:e};let r=M(t,"conformtools_nuke","__init__.py");return{installed:!0,dest:e,...await Ge(r)?{version:To(await _e(r))}:{}}}async function h3(){return To(await _e(dl("./nuke/panel/python/conformtools_nuke/__init__.py")))}var pv={flame:{install:()=>u3(),installed:()=>d3(),version:m3,what:"hook",next:"In Flame: Flame menu > Python > Rescan Python Hooks (or restart Flame), then Flame menu > CONFORM.TOOLS > Connect to CONFORM.TOOLS."},nuke:{install:()=>f3(),installed:()=>p3(),version:h3,what:"panel",next:"Restart Nuke Studio / Hiero, then CONFORM.TOOLS > Connect (Window > CONFORM.TOOLS shows its panel)."}};function hv(e,t,r){let o=t*r,n=new Float32Array(o*3);for(let i=0;i<o;i++)n[i*3]=e[i*4]/255,n[i*3+1]=e[i*4+1]/255,n[i*3+2]=e[i*4+2]/255;return{data:n,w:t,h:r}}function nr(e){return e<0?0:e>1?1:e}var gv="srgb";function $E(e){gv=e}function rr(e){return gv==="g24"?Math.pow(Math.max(e,0),2.4):e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function bv(e){return gv==="g24"?Math.pow(Math.max(e,0),1/2.4):e<=.0031308?e*12.92:1.055*Math.pow(e,1/2.4)-.055}function am(e,t){let r=Math.min(1,t/Math.max(e.w,e.h));if(r>=1)return e;let o=Math.max(1,Math.round(e.w*r)),n=Math.max(1,Math.round(e.h*r)),i=new Float32Array(o*n*3),a=e.w/o,s=e.h/n;for(let l=0;l<n;l++){let c=Math.floor(l*s),u=Math.min(e.h,Math.max(c+1,Math.floor((l+1)*s)));for(let d=0;d<o;d++){let f=Math.floor(d*a),m=Math.min(e.w,Math.max(f+1,Math.floor((d+1)*a))),p=0,g=0,_=0,v=0;for(let b=c;b<u;b++)for(let w=f;w<m;w++){let k=(b*e.w+w)*3;p+=e.data[k],g+=e.data[k+1],_+=e.data[k+2],v++}let y=(l*o+d)*3;i[y]=p/v,i[y+1]=g/v,i[y+2]=_/v}}return{data:i,w:o,h:n}}function Rt(e,t){let r=new Float64Array(9);for(let o=0;o<3;o++)for(let n=0;n<3;n++){let i=0;for(let a=0;a<3;a++)i+=e[o*3+a]*t[a*3+n];r[o*3+n]=i}return r}function vv(e){let t=new Float64Array(9);for(let r=0;r<3;r++)for(let o=0;o<3;o++)t[r*3+o]=e[o*3+r];return t}function sm(e){let t=new Float64Array(9);return t[0]=e[0],t[4]=e[1],t[8]=e[2],t}function wv(e){let t=Float64Array.from(e),r=new Float64Array([1,0,0,0,1,0,0,0,1]);for(let a=0;a<24;a++){let s=0;for(let[l,c]of[[0,1],[0,2],[1,2]])s+=t[l*3+c]**2;if(s<1e-30)break;for(let[l,c]of[[0,1],[0,2],[1,2]]){let u=t[l*3+c];if(Math.abs(u)<1e-300)continue;let d=(t[c*3+c]-t[l*3+l])/(2*u),f=Math.sign(d||1)/(Math.abs(d)+Math.sqrt(d*d+1)),m=1/Math.sqrt(f*f+1),p=f*m;for(let g=0;g<3;g++){let _=t[g*3+l],v=t[g*3+c];t[g*3+l]=m*_-p*v,t[g*3+c]=p*_+m*v}for(let g=0;g<3;g++){let _=t[l*3+g],v=t[c*3+g];t[l*3+g]=m*_-p*v,t[c*3+g]=p*_+m*v}for(let g=0;g<3;g++){let _=r[g*3+l],v=r[g*3+c];r[g*3+l]=m*_-p*v,r[g*3+c]=p*_+m*v}}}let o=[0,1,2].sort((a,s)=>t[a*3+a]-t[s*3+s]),n=new Float64Array(3),i=new Float64Array(9);return o.forEach((a,s)=>{n[s]=t[a*3+a];for(let l=0;l<3;l++)i[l*3+s]=r[l*3+a]}),{values:n,vectors:i}}function xE(e){let t=new Float64Array(9);for(let r=0;r<3;r++)for(let o=0;o<=r;o++){let n=e[r*3+o];for(let i=0;i<o;i++)n-=t[r*3+i]*t[o*3+i];if(r===o){if(n<=0)return null;t[r*3+o]=Math.sqrt(n)}else t[r*3+o]=n/t[o*3+o]}return t}function g3(e){let t=new Float64Array(9);for(let r=0;r<3;r++){t[r*3+r]=1/e[r*3+r];for(let o=0;o<r;o++){let n=0;for(let i=o;i<r;i++)n+=e[r*3+i]*t[i*3+o];t[r*3+o]=-n/e[r*3+r]}}return t}function yv(e){let{values:t,vectors:r}=wv(e),o=1e-12*Math.max(...Array.from(t).map(Math.abs),1e-30),n=new Float64Array(3);for(let i=0;i<3;i++)n[i]=Math.abs(t[i])>o?1/t[i]:0;return Rt(Rt(r,sm(n)),vv(r))}function b3(e){let{values:t,vectors:r}=wv(e),o=new Float64Array(3);for(let n=0;n<3;n++)o[n]=Math.sqrt(Math.max(t[n],0));return Rt(Rt(r,sm(o)),vv(r))}function SE(e){let t=e.w*e.h,r=new Float64Array(3);for(let i=0;i<t;i++)for(let a=0;a<3;a++)r[a]+=e.data[i*3+a];for(let i=0;i<3;i++)r[i]/=t;let o=new Float64Array(9);for(let i=0;i<t;i++){let a=e.data[i*3]-r[0],s=e.data[i*3+1]-r[1],l=e.data[i*3+2]-r[2];o[0]+=a*a,o[1]+=a*s,o[2]+=a*l,o[4]+=s*s,o[5]+=s*l,o[8]+=l*l}let n=Math.max(1,t-1);for(let i of[0,1,2,4,5,8])o[i]/=n;return o[3]=o[1],o[6]=o[2],o[7]=o[5],{mean:r,cov:o}}function y3(e,t,r,o){let n=e.w*e.h,i=new Float32Array(n*3);for(let a=0;a<n;a++){let s=e.data[a*3]-r[0],l=e.data[a*3+1]-r[1],c=e.data[a*3+2]-r[2];i[a*3]=t[0]*s+t[1]*l+t[2]*c+o[0],i[a*3+1]=t[3]*s+t[4]*l+t[5]*c+o[1],i[a*3+2]=t[6]*s+t[7]*l+t[8]*c+o[2]}return{data:i,w:e.w,h:e.h}}function _3(e,t){let{values:r,vectors:o}=wv(e),n=new Float64Array(3),i=new Float64Array(3);for(let d=0;d<3;d++){let f=Math.max(r[d],0);n[d]=Math.sqrt(f),i[d]=n[d]>1e-12?1/n[d]:0}let a=sm(n),s=sm(i),l=vv(o),c=Rt(Rt(Rt(Rt(a,l),t),o),a),u=b3(c);return Rt(Rt(Rt(Rt(o,s),u),s),l)}function v3(e,t){let o=Float64Array.from(e),n=Float64Array.from(t);for(let s of[0,4,8])o[s]+=1e-5,n[s]+=1e-5;let i=xE(o),a=xE(n);if(!i||!a){let s=new Float64Array(9);for(let l=0;l<3;l++){let c=Math.sqrt(Math.max(e[l*3+l],0)),u=Math.sqrt(Math.max(t[l*3+l],0));s[l*3+l]=c>1e-12?u/c:1}return s}return Rt(a,g3(i))}function w3(e,t,r,o){let n=yv(r.cov),i=yv(o.cov),a=e.w*e.h,s=new Float64Array(9);for(let c=0;c<a;c++){let u=t.data[c*3]-o.mean[0],d=t.data[c*3+1]-o.mean[1],f=t.data[c*3+2]-o.mean[2],m=e.data[c*3]-r.mean[0],p=e.data[c*3+1]-r.mean[1],g=e.data[c*3+2]-r.mean[2];s[0]+=u*m,s[1]+=u*p,s[2]+=u*g,s[3]+=d*m,s[4]+=d*p,s[5]+=d*g,s[6]+=f*m,s[7]+=f*p,s[8]+=f*g}let l=Math.max(1,a-1);for(let c=0;c<9;c++)s[c]/=l;return Rt(Rt(yv(i),i),Rt(s,n))}var _n=4096;function _v(e,t){let r=e.w*e.h,o=t.w*t.h,n=a=>Math.min(_n-1,Math.max(0,Math.round(nr(a)*(_n-1)))),i=[];for(let a=0;a<3;a++){let s=new Float64Array(_n),l=new Float64Array(_n);for(let p=0;p<r;p++)s[n(e.data[p*3+a])]++;for(let p=0;p<o;p++)l[n(t.data[p*3+a])]++;let c=0;for(let p=0;p<_n;p++)c+=s[p],s[p]=c/r;let u=[],d=[];c=0;for(let p=0;p<_n;p++)l[p]!==0&&(c+=l[p],u.push(p/(_n-1)),d.push(c/o));let f=new Float32Array(_n),m=0;for(let p=0;p<_n;p++){let g=s[p];for(;m<d.length-1&&d[m]<g;)m++;if(m===0||d[m]<=g)f[p]=u[m]??0;else{let _=d[m-1],v=d[m],y=v>_?(g-_)/(v-_):0;f[p]=u[m-1]+(u[m]-u[m-1])*y}}i.push(f)}return i}var ia=1/Math.sqrt(3),aa=1/Math.sqrt(6),lm=1/Math.sqrt(2),rte=[ia,ia,ia,aa,aa,-2*aa,lm,-lm,0],ote=[ia,aa,lm,ia,aa,-lm,ia,-2*aa,0];function cm(e,t,r="mvgd"){let o=e.w*e.h,n=_=>Math.min(_n-1,Math.max(0,Math.round(nr(_)*(_n-1)))),i=(_,v)=>{let y=new Float32Array(o*3);for(let b=0;b<3;b++){let w=v[b];for(let k=0;k<o;k++)y[k*3+b]=w[n(_.data[k*3+b])]}return{data:y,w:_.w,h:_.h}},a=_v(e,t),s=i(e,a),l=SE(s),c=SE(t),u;if(r==="mkl")u=_3(l.cov,c.cov);else if(r==="coral")u=v3(l.cov,c.cov);else if(r==="adain"){let _=new Float64Array(9);for(let v=0;v<3;v++){let y=Math.sqrt(Math.max(l.cov[v*3+v],0)),b=Math.sqrt(Math.max(c.cov[v*3+v],0));_[v*3+v]=y>1e-12?b/y:1}u=_}else u=w3(s,t,l,c);let d=y3(s,u,l.mean,c.mean),f={data:Float32Array.from(d.data,nr),w:e.w,h:e.h},m=_v(f,t),p=i(f,m),g=[c.mean[0]-(u[0]*l.mean[0]+u[1]*l.mean[1]+u[2]*l.mean[2]),c.mean[1]-(u[3]*l.mean[0]+u[4]*l.mean[1]+u[5]*l.mean[2]),c.mean[2]-(u[6]*l.mean[0]+u[7]*l.mean[1]+u[8]*l.mean[2])];return{hm1:a,matrix:Array.from(u),offset:g,mid:f,hm2:m,image:p}}function IE(e,t,r=1){let o=e.w*e.h,n=new Float32Array(o*3),i=[Math.pow(t[0],r),Math.pow(t[1],r),Math.pow(t[2],r)];for(let a=0;a<o;a++)for(let s=0;s<3;s++){let l=rr(Math.min(1,Math.max(0,e.data[a*3+s])))*i[s];n[a*3+s]=bv(l<0?0:l>1?1:l)}return{data:n,w:e.w,h:e.h}}function RE(e){let t=Math.hypot(e[0],e[1],e[2]);return t>0?[e[0]/t,e[1]/t,e[2]/t]:[1/Math.sqrt(3),1/Math.sqrt(3),1/Math.sqrt(3)]}function TE(e,t){let r=RE(e),o=RE(t),n=r[0]*o[0]+r[1]*o[1]+r[2]*o[2],i=[r[1]*o[2]-r[2]*o[1],r[2]*o[0]-r[0]*o[2],r[0]*o[1]-r[1]*o[0]],a=Math.hypot(i[0],i[1],i[2]);return Math.atan2(a,n)*180/Math.PI}var um={note:"Measured from DaVinci Resolve Studio 21 EXR renders of a 16-bit ramp chart (drt-color-re/render_grade.py batch 5, 2026-08-11). Absolute per-amplitude deltas vs the neutral render; regenerate with gen_wheel_basis.py.",x:[0,.033351,.066701,.100052,.133403,.166754,.200104,.233455,.266806,.300156,.333507,.366858,.400208,.433559,.46691,.500261,.533611,.566962,.600313,.633663,.667014,.700365,.733715,.767066,.800417,.833768,.867118,.900469,.93382,.96717,1],controls:{shadow:{amps:[-.4,-.2,-.1,.05,.1,.2,.3,.4],curves:{"-0.40":[-.4,-.361005,-.320961,-.28089,-.240827,-.200775,-.160651,-.119559,-.084823,-.054151,-.028079,-.007759,-487e-6,-487e-6,-493e-6,-492e-6,-49e-5,-49e-5,-488e-6,-49e-5,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6],"-0.20":[-.2,-.180746,-.160725,-.140689,-.120659,-.100632,-.08057,-.060049,-.042665,-.027551,-.014705,-.004394,-487e-6,-487e-6,-493e-6,-492e-6,-49e-5,-49e-5,-488e-6,-49e-5,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6],"-0.10":[-.1,-.090617,-.080607,-.070588,-.060574,-.05056,-.040529,-.030279,-.021573,-.014076,-.007709,-.002511,-487e-6,-487e-6,-493e-6,-492e-6,-49e-5,-49e-5,-488e-6,-49e-5,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6],"+0.05":[.01665,.014519,.01285,.011184,.009514,.007848,.006178,.004433,.003088,.001785,631e-6,-218e-6,-487e-6,-487e-6,-493e-6,-492e-6,-49e-5,-49e-5,-488e-6,-49e-5,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6],"+0.10":[.0333,.029526,.02619,.022856,.019518,.016185,.012843,.009357,.006657,.004041,.00172,24e-6,-487e-6,-487e-6,-493e-6,-492e-6,-49e-5,-49e-5,-488e-6,-49e-5,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6],"+0.20":[.0666,.059539,.052869,.046199,.039526,.032859,.026174,.019208,.013791,.008561,.003926,527e-6,-487e-6,-487e-6,-493e-6,-492e-6,-49e-5,-49e-5,-488e-6,-49e-5,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6],"+0.30":[.0999,.089552,.079548,.069542,.059534,.049533,.039505,.029067,.020915,.013093,.006169,.001059,-487e-6,-487e-6,-493e-6,-492e-6,-49e-5,-49e-5,-488e-6,-49e-5,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6],"+0.40":[.1332,.119565,.106227,.092886,.079542,.066207,.052837,.038936,.028026,.017634,.008453,.001622,-487e-6,-487e-6,-493e-6,-492e-6,-49e-5,-49e-5,-488e-6,-49e-5,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6]}},midtone:{amps:[-.4,-.2,-.1,.1,.2,.4],curves:{"-0.40":[0,-487e-6,-489e-6,-488e-6,-49e-5,-489e-6,-451e-6,263e-6,-.003632,-.010819,-.020501,-.032238,-.047185,-.059943,-.066296,-.060685,-.040876,-.017385,-303e-6,-447e-6,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6],"-0.20":[0,-487e-6,-489e-6,-488e-6,-49e-5,-489e-6,-466e-6,-57e-6,-.002523,-.007541,-.014006,-.020949,-.027712,-.032192,-.033342,-.029182,-.019455,-.008585,-391e-6,-467e-6,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6],"-0.10":[0,-487e-6,-489e-6,-488e-6,-49e-5,-489e-6,-476e-6,-266e-6,-.001602,-.004451,-.00808,-.011811,-.014895,-.016618,-.016765,-.014464,-.00969,-.004462,-438e-6,-478e-6,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6],"+0.10":[0,-487e-6,-489e-6,-488e-6,-49e-5,-489e-6,-509e-6,-938e-6,.001249,.004662,.008518,.012261,.014922,.015752,.01505,.012601,.007936,.002742,-514e-6,-496e-6,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6],"+0.20":[0,-487e-6,-489e-6,-488e-6,-49e-5,-489e-6,-53e-5,-.001381,.00303,.010093,.018105,.0258,.030902,.031857,.029403,.023831,.014993,.005523,-542e-6,-502e-6,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6],"+0.40":[0,-487e-6,-489e-6,-488e-6,-49e-5,-489e-6,-571e-6,-.002236,.006718,.021856,.039117,.055211,.063967,.062345,.052975,.039586,.02427,.009349,-592e-6,-514e-6,-488e-6,-487e-6,-489e-6,-488e-6,-49e-5,-488e-6,-491e-6,-489e-6,-488e-6,-49e-5,-489e-6]}},highlight:{amps:[-.4,-.2,-.1,.1,.2,.4],curves:{"-0.40":[0,-487e-6,-489e-6,-488e-6,-49e-5,-489e-6,-487e-6,-49e-5,-484e-6,-475e-6,-464e-6,-461e-6,-487e-6,-487e-6,-49e-6,-.001378,-.005676,-.012124,-.02034,-.033741,-.0471,-.060436,-.073779,-.087121,-.100459,-.1138,-.127144,-.14048,-.153821,-.167165,-.180293],"-0.20":[0,-487e-6,-489e-6,-488e-6,-49e-5,-489e-6,-487e-6,-49e-5,-484e-6,-475e-6,-464e-6,-461e-6,-487e-6,-487e-6,-285e-6,-921e-6,-.003101,-.006371,-.010411,-.017115,-.023794,-.030461,-.037134,-.043804,-.050474,-.057144,-.063817,-.070484,-.077154,-.083827,-.090391],"-0.10":[0,-487e-6,-489e-6,-488e-6,-49e-5,-489e-6,-487e-6,-49e-5,-484e-6,-475e-6,-464e-6,-461e-6,-487e-6,-487e-6,-392e-6,-703e-6,-.001797,-.003442,-.005449,-.008802,-.012141,-.015474,-.018812,-.022146,-.025482,-.028816,-.032154,-.035487,-.038821,-.042159,-.04544],"+0.10":[0,-487e-6,-489e-6,-488e-6,-49e-5,-489e-6,-487e-6,-49e-5,-484e-6,-475e-6,-464e-6,-461e-6,-487e-6,-487e-6,-913e-6,207e-6,.002501,.005682,.010558,.017987,.025407,.032818,.040228,.047642,.055048,.062463,.069872,.077283,.084698,.092108,.099403],"+0.20":[0,-487e-6,-489e-6,-488e-6,-49e-5,-489e-6,-487e-6,-49e-5,-484e-6,-475e-6,-464e-6,-461e-6,-487e-6,-487e-6,-.001308,875e-6,.005478,.011902,.021601,.036463,.051302,.066123,.080944,.095772,.110587,.125414,.140236,.155056,.169883,.184705,.199294],"+0.40":[0,-487e-6,-489e-6,-488e-6,-49e-5,-489e-6,-487e-6,-49e-5,-484e-6,-475e-6,-464e-6,-461e-6,-487e-6,-487e-6,-.002028,.002127,.011361,.024415,.043682,.073414,.103093,.132732,.162378,.192031,.221663,.251316,.280962,.310601,.340254,.3699,.399077]}}},contrast:{cs:[.5,.8,1.25,1.5,1.8],curves:{"0.50":[.2175,.200578,.183907,.167229,.15055,.13388,.117203,.100531,.083854,.067175,.050505,.033828,.017148,479e-6,-.016201,-.032878,-.049548,-.066227,-.082897,-.099576,-.116253,-.132923,-.149602,-.16628,-.182951,-.199629,-.216308,-.232978,-.249655,-.266334,-.282745],"0.80":[.087,.079939,.073269,.066599,.059926,.053259,.046589,.039919,.033249,.026576,.019909,.013239,.006566,-101e-6,-.006775,-.013445,-.020112,-.026785,-.033452,-.040125,-.046795,-.053462,-.060135,-.066805,-.073475,-.080145,-.086818,-.093485,-.100155,-.106828,-.113392],"1.25":[0,-.010727,-.021735,-.032532,-.042279,-.050126,-.055135,-.056541,-.054061,-.047509,-.037623,-.025716,-.013116,-.001136,.010563,.023076,.035617,.047411,.057676,.06563,.070555,.072344,.071151,.067141,.060599,.052178,.042386,.031729,.020695,.009783,-345e-6],"1.50":[0,-.021136,-.043244,-.065419,-.086537,-.105469,-.121116,-.131949,-.135345,-.128698,-.109132,-.077071,-.039172,-.002436,.033276,.07165,.108539,.139821,.161382,.172335,.174591,.16969,.159165,.144656,.12727,.107658,.086487,.064431,.042132,.020262,-196e-6],"1.80":[0,-.030247,-.061752,-.093815,-.125632,-.1564,-.185357,-.21169,-.23463,-.254734,-.26386,-.247374,-.163569,-.008383,.14496,.280152,.328288,.341546,.334832,.316817,.295588,.272004,.245823,.217525,.18759,.15646,.124616,.09254,.060672,.029492,-59e-6]}},pivot_probes:{pivot02_c15:[0,.011586,.023617,.041223,.072432,.128713,.199237,.267856,.339119,.410913,.481153,.547825,.60882,.662121,.707868,.747147,.780708,.809347,.833813,.8549,.873465,.889957,.904721,.918081,.93036,.941903,.953031,.964073,.975367,.987238,.999804],pivot08_c15:[0,.012599,.024474,.035774,.04682,.057941,.069476,.081743,.095087,.109829,.126295,.144829,.165876,.190289,.218866,.252371,.29155,.337202,.39039,.451293,.517901,.588105,.659892,.731177,.799843,.87034,.927,.958466,.976191,.988267,.999805],pivot02_c07:[.06,.083008,.106345,.129696,.153044,.176383,.199734,.223071,.246421,.269769,.293109,.316459,.339807,.363147,.386494,.409845,.433184,.456532,.479872,.50322,.52657,.54991,.573258,.596608,.619945,.643295,.666643,.689983,.713333,.736681,.759657],pivot08_c07:[.24,.263008,.286345,.309696,.333044,.356383,.379734,.403071,.426421,.449769,.473109,.496459,.519807,.543146,.566494,.589845,.613184,.636532,.659872,.68322,.70657,.72991,.753258,.776608,.799945,.823295,.846643,.869983,.893333,.916681,.939657]}};var vn=.435;var ME={shadow:[0,0,0],midtone:[0,0,0],highlight:[0,0,0],contrast:1,pivot:vn};function sa(e){if(!e)return!0;let t=r=>r.every(o=>Math.abs(o)<1e-9);return t(e.shadow)&&t(e.midtone)&&t(e.highlight)&&Math.abs(e.contrast-1)<1e-9}var It=um.x,Er=It.length;function $v(e){let t=um.controls[e],r=[],o=[];for(let i of t.amps)r.push(i),o.push(t.curves[`${i>=0?"+":""}${i.toFixed(2)}`]);let n=r.findIndex(i=>i>0);return n<0&&(n=r.length),r.splice(n,0,0),o.splice(n,0,new Array(Er).fill(0)),{amps:r,curves:o}}var $3=$v("shadow"),x3=$v("midtone"),S3=$v("highlight");function Po(e,t){if(t<=It[0])return e[0];let r=Er-1;if(t>=It[r])return e[r];let o=0,n=r;for(;n-o>1;){let a=o+n>>1;It[a]<=t?o=a:n=a}let i=(t-It[o])/(It[n]-It[o]);return e[o]+(e[n]-e[o])*i}function kv(e,t,r){if(t===0)return 0;let{amps:o,curves:n}=e,i=o.length-1;if(t<=o[0])return Po(n[0],r)*(t/o[0]);if(t>=o[i])return Po(n[i],r)*(t/o[i]);let a=0,s=i;for(;s-a>1;){let c=a+s>>1;o[c]<=t?a=c:s=c}let l=(t-o[a])/(o[s]-o[a]);return Po(n[a],r)+(Po(n[s],r)-Po(n[a],r))*l}var dm=(()=>{let e=um.contrast,t=e.cs.filter(r=>r>1).map(r=>({c:r,y:e.curves[r.toFixed(2)].map((o,n)=>It[n]+o)}));return t.unshift({c:1,y:[...It]}),t})();function PE(e,t){if(t<=e[0])return It[0];let r=Er-1;if(t>=e[r])return It[r];let o=0,n=r;for(;n-o>1;){let a=o+n>>1;e[a]<=t?o=a:n=a}let i=(t-e[o])/(e[n]-e[o]);return It[o]+(It[n]-It[o])*i}function R3(e,t){let r=0;for(;r<dm.length-2&&dm[r+1].c<=e;)r++;let o=dm[r],n=dm[r+1],i=(e-o.c)/(n.c-o.c),a=vn,s=new Array(Er);for(let u=0;u<Er;u++){let d=It[u],f=0,m=1;for(let p=0;p<30;p++){let g=(f+m)/2;PE(o.y,g)*(1-i)+PE(n.y,g)*i<d?f=g:m=g}s[u]=(f+m)/2}let l=s;if(Math.abs(t-a)>1e-6){l=new Array(Er);for(let u=0;u<Er;u++){let d=It[u],f=d<t?a*(d/t):a+(1-a)*((d-t)/(1-t)),m=Po(s,f);l[u]=m<a?t*(m/a):t+(1-t)*((m-a)/(1-a))}}let c=0;for(let u=0;u<Er;u++){let d=l[u]<c?c:l[u];l[u]=d<0?0:d>1?1:d,c=l[u]}return l}var AE=NaN,EE=NaN,OE=null;function I3(e,t,r){return t<1?r+t*(e-r):((t!==AE||r!==EE)&&(OE=R3(t,r),AE=t,EE=r),Po(OE,e))}function Or(e,t,r){let o=e+kv($3,t.shadow[r],e)+kv(x3,t.midtone[r],e)+kv(S3,t.highlight[r],e);return t.contrast!==1&&(o=I3(o,t.contrast,t.pivot)),o}var CE=[.2126,.7152,.0722];function DE(e,t){let r=t.wheels??ME,o=xv({...t,wheels:void 0,saturation:void 0,mixer:void 0}),n=!sa(t.wheels),i=e.w*e.h,a=new Float32Array(i*3),s=(c,u)=>{let d=c*o.slope[u]+o.offset[u],f=o.power[u];return f!==1&&(d=d<0?-Math.pow(-d,f):Math.pow(d,f)),n?Or(d,r,u):d};if(i*3>=32768){let u=new Float32Array(12288);for(let d=0;d<3;d++)for(let f=0;f<4096;f++)u[d*4096+f]=s(f/4095,d);for(let d=0;d<i;d++)for(let f=0;f<3;f++){let m=e.data[d*3+f];if(m>=0&&m<=1){let p=m*4095,g=p|0,_=p-g,v=u[f*4096+g];a[d*3+f]=_>0?v+(u[f*4096+g+1]-v)*_:v}else a[d*3+f]=s(m,f)}}else for(let c=0;c<i;c++)for(let u=0;u<3;u++)a[c*3+u]=s(e.data[c*3+u],u);let l=t.saturation??1;if(l!==1)for(let c=0;c<i;c++){let u=.21*a[c*3]+.7*a[c*3+1]+.09*a[c*3+2];for(let d=0;d<3;d++)a[c*3+d]=u+(a[c*3+d]-u)*l}if(!la(t.mixer)){let c=mm(t.mixer);for(let u=0;u<i;u++){let d=a[u*3],f=a[u*3+1],m=a[u*3+2];a[u*3]=c[0]*d+c[1]*f+c[2]*m,a[u*3+1]=c[3]*d+c[4]*f+c[5]*m,a[u*3+2]=c[6]*d+c[7]*f+c[8]*m}}return{data:a,w:e.w,h:e.h}}function la(e){if(!e)return!0;let t=[1,0,0,0,1,0,0,0,1];return e.every((r,o)=>Math.abs(r-t[o])<1e-9)}function mm(e){let t=e.slice();for(let r=0;r<3;r++){let o=-CE[r];for(let n=0;n<3;n++)o+=CE[n]*e[n*3+r];for(let n=0;n<3;n++)t[n*3+r]-=o}return t}function jE(e,t){if(!sa(t.wheels)||t.saturation!==void 0&&t.saturation!==1||!la(t.mixer)){let c=DE(e,t);for(let u=0;u<c.data.length;u++)c.data[u]=nr(c.data[u]);return c}let r=t.blackPointOffset,o=Math.pow(2,t.exposureStops),n=[t.wbGain[0]*o,t.wbGain[1]*o,t.wbGain[2]*o],i=e.w*e.h,a=new Float32Array(i*3);for(let c=0;c<i;c++)a[c*3]=nr(e.data[c*3]+r[0]),a[c*3+1]=nr(e.data[c*3+1]+r[1]),a[c*3+2]=nr(e.data[c*3+2]+r[2]);let s=IE({data:a,w:e.w,h:e.h},n,1),l=t.power;if(!l||l[0]===1&&l[1]===1&&l[2]===1)return s;for(let c=0;c<i;c++)for(let u=0;u<3;u++){let d=s.data[c*3+u];s.data[c*3+u]=d<=0?0:Math.pow(d,l[u])}return s}function xv(e){let t=Math.pow(2,e.exposureStops),r=e.wbGain.map(a=>Math.pow(a*t,1/2.4)),o=e.blackPointOffset.map((a,s)=>a*r[s]),n=e.power??[1,1,1],i={slope:r,offset:o,power:n};return sa(e.wheels)||(i.wheels=e.wheels),e.saturation!==void 0&&Math.abs(e.saturation-1)>1e-6&&(i.saturation=e.saturation),la(e.mixer)||(i.mixer=e.mixer),i}function NE(e,t,r){return .2126*e+.7152*t+.0722*r}function T3(e,t){let r=e.length;if(r===0)return 0;if(r===1)return e[0];let o=Math.min(r-1,Math.max(0,t*(r-1))),n=Math.floor(o),i=Math.min(r-1,n+1),a=o-n;return e[n]+a*(e[i]-e[n])}function FE(e,t,r=4,o=6e4){let n=e.w*e.h,i=Math.max(1,Math.floor(n/o)),a=new Float32Array(Math.ceil(n/i)),s=0;for(let c=0;c<n;c+=i){let u=rr(Math.max(0,Math.min(1,e.data[c*3]))),d=rr(Math.max(0,Math.min(1,e.data[c*3+1]))),f=rr(Math.max(0,Math.min(1,e.data[c*3+2]))),m=NE(u,d,f);if(m<=1e-5||Math.max(u,d,f)>=.99)continue;let p=rr(Math.max(0,Math.min(1,t.data[c*3]))),g=rr(Math.max(0,Math.min(1,t.data[c*3+1]))),_=rr(Math.max(0,Math.min(1,t.data[c*3+2]))),v=NE(p,g,_)/m;!Number.isFinite(v)||v<=0||(a[s++]=Math.max(-r,Math.min(r,Math.log2(v))))}if(s===0)return 0;let l=a.subarray(0,s);return l.sort(),T3(l,.5)}function P3(e,t,r,o,n,i,a){let l=new Float64Array(1024),c=new Float64Array(1024),u=new Float64Array(1024),d=0;for(let $=0;$<r;$+=o){let C=e[$*3+n],E=t[$*3+n];if(!(C>.004&&C<.996)||!(E>5e-4&&E<.9995))continue;let L=C*1023+.5|0,q=i?i[$]:1;l[L]+=C*q,c[L]+=E*q,u[L]+=q,d++}let f=[],m=[],p=[];for(let $=0;$<1024;$++)u[$]!==0&&(f.push(l[$]/u[$]),m.push(c[$]/u[$]),p.push(u[$]));let g=f.length;if(d<32||g<8)return{slope:1,offset:0,power:1,residual:0,samples:d};let _=0;for(let $=0;$<g;$++)_+=p[$];let v=($,C,E)=>{let L=0;for(let q=0;q<g;q++){let O=f[q]*$+C,G=O<=0?0:Math.pow(O,E);L+=p[q]*Math.abs((G>1?1:G)-m[q])}return L/_},y=$=>{let C=0,E=0,L=0,q=0,O=0;for(let Y=0;Y<g;Y++){let j=$===1?m[Y]:Math.pow(Math.max(m[Y],1e-9),1/$),V=p[Y];C+=V,E+=V*f[Y],L+=V*f[Y]*f[Y],q+=V*j,O+=V*f[Y]*j}let G=C*L-E*E;if(Math.abs(G)<1e-12)return null;let X=(C*O-E*q)/G,ae=(L*q-E*O)/G;for(let Y=0;Y<3;Y++){let j=0,V=0,Z=0,Q=0,ne=0;for(let Be=0;Be<g;Be++){let Ve=f[Be]*X+ae;if(Ve<=1e-9)continue;let st=Math.pow(Ve,$),lt=(st>1?1:st)-m[Be],H=$*Math.pow(Ve,$-1),oe=H*f[Be],se=p[Be];j+=se*oe*oe,V+=se*oe*H,Z+=se*H*H,Q+=se*oe*lt,ne+=se*H*lt}let ye=j*Z-V*V;if(!(Math.abs(ye)>1e-12))break;if(X-=(Z*Q-V*ne)/ye,ae-=(j*ne-V*Q)/ye,ae>0&&(ae=0),!(X>.02&&X<200)||!Number.isFinite(ae))return null}return!(X>.02&&X<200)||!Number.isFinite(ae)||ae>0?null:{s:X,o:ae}},b=a?Math.min(Math.max(1,a[0]),a[1]):1,w=y(b),k=w?{slope:w.s,offset:w.o,power:b,residual:v(w.s,w.o,b),samples:d}:{slope:1,offset:0,power:1,residual:v(1,0,1),samples:d},I=.02,x=160,S=Math.log(a?a[0]:.1),R=Math.log(a?a[1]:5);for(let $=0;$<x;$++){let C=Math.exp(S+(R-S)*$/(x-1)),E=y(C);if(!E)continue;let L=v(E.s,E.o,C);L<k.residual*(1-I)&&(k={slope:E.s,offset:E.o,power:C,residual:L,samples:d})}return k}function fm(e,t,r=4e4,o,n){if(e.w!==t.w||e.h!==t.h)throw new Error(`fitShotAnalysis: size mismatch \u2014 ${e.w}x${e.h} vs ${t.w}x${t.h}`);let i=e.w*e.h;if(o&&o.length!==i)throw new Error(`fitShotAnalysis: weights length ${o.length} != ${i} pixels`);let a=Math.max(1,Math.floor(i/r)),s=[1,1,1],l=[0,0,0],c=[1,1,1],u=[0,0,0],d=0;for(let _=0;_<3;_++){let v=P3(e.data,t.data,i,a,_,o,n?.[_]);s[_]=v.slope,l[_]=v.offset,c[_]=v.power,u[_]=v.residual,d=Math.max(d,v.samples)}let f=s.map(_=>Math.pow(_,2.4)),m=[f[0]/f[1],1,f[2]/f[1]],p=Math.log2(f[1]);return{analysis:{blackPointOffset:[l[0]/s[0],l[1]/s[1],l[2]/s[2]],wbGain:m,exposureStops:p,power:c,castDeg:TE(m,[1,1,1])},lumaStops:FE(e,t),slope:s,offset:l,power:c,residual:u,maxResidual:Math.max(u[0],u[1],u[2]),samples:d}}function LE(e,t,r,o=2e4,n,i){let a=e.w*e.h;if(n&&n.length!==a)throw new Error(`fitLogWheels: weights length ${n.length} != ${a} pixels`);let s=Math.max(1,Math.floor(a/o)),l=1024,c=[[],[],[]],u=[[],[],[]],d=[[],[],[]];for(let S=0;S<3;S++){let R=new Float64Array(l),$=new Float64Array(l),C=new Float64Array(l);for(let E=0;E<a;E+=s){let L=e.data[E*3+S];if(!(L>.002&&L<.998))continue;let q=L*(l-1)+.5|0,O=n?n[E]:1;R[q]+=L*O,$[q]+=t.data[E*3+S]*O,C[q]+=O}for(let E=0;E<l;E++)C[E]!==0&&(c[S].push(R[E]/C[E]),u[S].push($[E]/C[E]),d[S].push(C[E]))}let f=(S,R)=>R?Math.min(R[1],Math.max(R[0],S)):S,m={shadow:[0,0,0],midtone:[0,0,0],highlight:[0,0,0],contrast:f(1,i?.contrast),pivot:f(vn,i?.pivot)},p=r.wbGain,g=Math.pow(2,r.exposureStops),_=[0,1,2].map(S=>Math.pow(p[S]*g,1/2.4)),v=r.blackPointOffset,y=r.power??[1,1,1],b=[[],[],[]];for(let S=0;S<3;S++)for(let R=0;R<c[S].length;R++){let $=(c[S][R]+v[S])*_[S];y[S]!==1&&($=$<0?-Math.pow(-$,y[S]):Math.pow($,y[S])),b[S].push($)}let w=0;for(let S=0;S<3;S++)for(let R of d[S])w+=R;let k=()=>{let S=0;for(let R=0;R<3;R++)for(let $=0;$<b[R].length;$++){let C=Or(b[R][$],m,R);S+=d[R][$]*Math.abs((C<0?0:C>1?1:C)-u[R][$])}return w?S/w:0},I=(S,R,$)=>{let C=.6180339887,E=R,L=$,q=L-C*(L-E),O=E+C*(L-E);S(q);let G=k();S(O);let X=k(),ae=G,Y=X;for(let V=0;V<18&&L-E>1e-4;V++)ae<Y?(L=O,O=q,Y=ae,q=L-C*(L-E),S(q),ae=k()):(E=q,q=O,ae=Y,O=E+C*(L-E),S(O),Y=k());let j=ae<Y?q:O;S(j)},x=k();for(let S=0;S<3;S++){I($=>{m.contrast=$},Math.max(.4,i?.contrast[0]??.4),Math.min(2.2,i?.contrast[1]??2.2)),I($=>{m.pivot=$},Math.max(.15,i?.pivot[0]??.15),Math.min(.85,i?.pivot[1]??.85));for(let $=0;$<3;$++)I(C=>{m.shadow[$]=C},-.4,.4),I(C=>{m.midtone[$]=C},-.4,.4),I(C=>{m.highlight[$]=C},-.4,.4);let R=k();if(x-R<1e-5)break;x=R}return Math.abs(m.contrast-1)<1e-4&&(m.contrast=1,m.pivot=vn),{wheels:m,residual:k()}}var Vt=e=>e<0?0:e>1?1:e;function UE(e){let t=e[0]*(e[4]*e[8]-e[5]*e[7])-e[1]*(e[3]*e[8]-e[5]*e[6])+e[2]*(e[3]*e[7]-e[4]*e[6]);return[(e[4]*e[8]-e[5]*e[7])/t,(e[2]*e[7]-e[1]*e[8])/t,(e[1]*e[5]-e[2]*e[4])/t,(e[5]*e[6]-e[3]*e[8])/t,(e[0]*e[8]-e[2]*e[6])/t,(e[2]*e[3]-e[0]*e[5])/t,(e[3]*e[7]-e[4]*e[6])/t,(e[1]*e[6]-e[0]*e[7])/t,(e[0]*e[4]-e[1]*e[3])/t]}function A3(e,t){let r=e.w*e.h,o=new Float32Array(r*3);for(let n=0;n<3;n++){let i=t[n],a=i.length-1;for(let s=0;s<r;s++){let l=Math.min(a,Math.max(0,Math.round(Vt(e.data[s*3+n])*a)));o[s*3+n]=i[l]}}return{data:o,w:e.w,h:e.h}}function zE(e,t,r=1){let o=0,n=0;for(let i=0;i<e.w*e.h;i+=r){for(let a=0;a<3;a++)o+=Math.abs(Vt(e.data[i*3+a])-Vt(t.data[i*3+a]));n+=3}return o/n}var Tte=.8/255;function BE(e,t,r,o){let n=r??cm(e,t,o?.inner??"mvgd"),i=o?.tone1Contrast??null,a=o?.enableTone2??!0,s=o?.trimContrast??null,l=n.matrix,c=$=>({data:Float32Array.from($.data,Vt),w:$.w,h:$.h}),u=A3(e,n.hm1),d=Rv(e,u),f=n.offset,m=UE(l),p=[m[0]*f[0]+m[1]*f[1]+m[2]*f[2],m[3]*f[0]+m[4]*f[1]+m[5]*f[2],m[6]*f[0]+m[7]*f[1]+m[8]*f[2]],g=e.w*e.h,_=new Float32Array(g*3);for(let $=0;$<g;$++){let C=d.out.data[$*3],E=d.out.data[$*3+1],L=d.out.data[$*3+2];_[$*3]=Vt(l[0]*C+l[1]*E+l[2]*L+f[0]),_[$*3+1]=Vt(l[3]*C+l[4]*E+l[5]*L+f[1]),_[$*3+2]=Vt(l[6]*C+l[7]*E+l[8]*L+f[2])}let v={data:_,w:e.w,h:e.h},y=Rv(v,n.image);if(i==null&&a&&s==null){let $=zE(c(y.out),n.image);return{tone1:d.tone,offset:p,matrix:l,tone2:y.tone,tone2Enabled:!0,trim:null,residual:$}}let b=i==null?d.tone:{...d.tone,contrast:i,pivot:d.tone.pivot??.435},w=s==null?null:{slope:[1,1,1],offset:[0,0,0],power:[1,1,1],contrast:s,pivot:.435},k=Sv(e,b),I=new Float32Array(g*3);for(let $=0;$<g;$++){let C=k.data[$*3],E=k.data[$*3+1],L=k.data[$*3+2];I[$*3]=Vt(l[0]*C+l[1]*E+l[2]*L+f[0]),I[$*3+1]=Vt(l[3]*C+l[4]*E+l[5]*L+f[1]),I[$*3+2]=Vt(l[6]*C+l[7]*E+l[8]*L+f[2])}let x={data:I,w:e.w,h:e.h},S=a?Sv(x,y.tone):x;w&&(S=Sv(S,w));let R=zE(S,n.image);return{tone1:b,offset:p,matrix:l,tone2:y.tone,tone2Enabled:a,trim:w,residual:R}}function Sv(e,t){let o=t.shadow||t.midtone||t.highlight||t.contrast!==void 0&&Math.abs(t.contrast-1)>1e-9?{shadow:t.shadow??[0,0,0],midtone:t.midtone??[0,0,0],highlight:t.highlight??[0,0,0],contrast:t.contrast??1,pivot:t.pivot??.435}:null,n=new Float32Array(3*4096);for(let a=0;a<3;a++){let s=t.power?.[a]??1;for(let l=0;l<4096;l++){let c=l/4095*t.slope[a]+t.offset[a];s!==1&&(c=c<0?-Math.pow(-c,s):Math.pow(c,s)),o&&(c=Or(c,o,a)),n[a*4096+l]=Vt(c)}}let i=new Float32Array(e.data.length);for(let a=0;a<e.w*e.h;a++)for(let s=0;s<3;s++)i[a*3+s]=n[s*4096+Math.min(4095,Math.max(0,Math.round(Vt(e.data[a*3+s])*4095)))];return{data:i,w:e.w,h:e.h}}function Rv(e,t,r){let o=fm(e,t,void 0,r),n=o.analysis,i=LE(e,t,n,void 0,r);i.residual<o.maxResidual&&(n={...n,wheels:i.wheels});let a=jE(e,n),s={data:Float32Array.from(a.data,Vt),w:e.w,h:e.h},l=xv(n);return{tone:{slope:l.slope,offset:l.offset,power:l.power,...l.wheels?{shadow:l.wheels.shadow,midtone:l.wheels.midtone,highlight:l.wheels.highlight,contrast:l.wheels.contrast,pivot:l.wheels.pivot}:{}},out:s}}function Iv(e,t,r=16){let{w:o,h:n}=e,i=(s,l)=>.2126*s[l*3]+.7152*s[l*3+1]+.0722*s[l*3+2],a=new Float32Array(o*n);for(let s=0;s<n;s+=r)for(let l=0;l<o;l+=r){let c=0,u=0,d=0,f=0,m=0,p=0,g=Math.min(n,s+r),_=Math.min(o,l+r);for(let k=s;k<g;k++)for(let I=l;I<_;I++){let x=k*o+I,S=i(e.data,x),R=i(t.data,x);c++,u+=S,d+=R,f+=S*S,m+=R*R,p+=S*R}let v=f/c-(u/c)**2,y=m/c-(d/c)**2,b=2e-5,w=v<b&&y<b?1:v<b||y<b?.1:Math.min(1,Math.max(0,((p/c-u/c*(d/c))/Math.sqrt(v*y)-.2)/.6));for(let k=s;k<g;k++)for(let I=l;I<_;I++){let x=k*o+I,S=Math.max(e.data[x*3],e.data[x*3+1],e.data[x*3+2])>.99||Math.max(t.data[x*3],t.data[x*3+1],t.data[x*3+2])>.99;a[x]=S?0:w}}return a}function E3(e,t){let r=[0,1,2,3].map(o=>[e[o*4],e[o*4+1],e[o*4+2],e[o*4+3],t[o]]);for(let o=0;o<4;o++){let n=o;for(let i=o+1;i<4;i++)Math.abs(r[i][o])>Math.abs(r[n][o])&&(n=i);if([r[o],r[n]]=[r[n],r[o]],Math.abs(r[o][o])<1e-12)return o<3?[o===0?1:0,o===1?1:0,o===2?1:0,0]:[0,0,0,0];for(let i=0;i<4;i++)if(i!==o){let a=r[i][o]/r[o][o];for(let s=o;s<5;s++)r[i][s]-=a*r[o][s]}}return r.map((o,n)=>o[4]/o[n])}var O3=0;function VE(e,t,r){if(e.w!==t.w||e.h!==t.h)throw new Error(`pixelFitStages: size mismatch ${e.w}x${e.h} vs ${t.w}x${t.h}`);let o=e.w*e.h,n=r?.weights??Iv(e,t),i=new Float64Array(16),a=new Float64Array(12),s=0;for(let I=0;I<o;I++){let x=n[I];if(!x)continue;s+=x;let S=[e.data[I*3],e.data[I*3+1],e.data[I*3+2],1];for(let R=0;R<4;R++){for(let $=0;$<4;$++)i[R*4+$]+=x*S[R]*S[$];for(let $=0;$<3;$++)a[R*3+$]+=x*S[R]*t.data[I*3+$]}}let l=(r?.ridge??O3)*s;for(let I=0;I<3;I++)i[I*4+I]+=l,a[I*3+I]+=l;let c=[0,1,2].map(I=>E3(i,[0,1,2,3].map(x=>a[x*3+I]))),u=c.flatMap(I=>I.slice(0,3)),d=c.map(I=>I[3]),f=UE(u),m=[f[0]*d[0]+f[1]*d[1]+f[2]*d[2],f[3]*d[0]+f[4]*d[1]+f[5]*d[2],f[6]*d[0]+f[7]*d[1]+f[8]*d[2]],p=new Float32Array(o*3);for(let I=0;I<o;I++){let x=e.data[I*3],S=e.data[I*3+1],R=e.data[I*3+2];for(let $=0;$<3;$++)p[I*3+$]=Vt(u[$*3]*x+u[$*3+1]*S+u[$*3+2]*R+d[$])}let g={data:p,w:e.w,h:e.h},_=I=>{let x=0,S=0;for(let R=0;R<o;R++){let $=n[R];$&&(x+=$*(Math.abs(I.data[R*3]-t.data[R*3])+Math.abs(I.data[R*3+1]-t.data[R*3+1])+Math.abs(I.data[R*3+2]-t.data[R*3+2])),S+=3*$)}return S?x/S:0},v=Rv(g,t,n),y=_(g),b=_(v.out),w=b<y-.5/255;return{tone1:{slope:[1,1,1],offset:[0,0,0],power:[1,1,1]},offset:m,matrix:u,tone2:v.tone,tone2Enabled:w,trim:null,residual:w?b:y,trustedShare:s/o}}function ZE(e){let{wheels:t,...r}=e;return{...r,...t?{shadow:t.shadow,midtone:t.midtone,highlight:t.highlight,contrast:t.contrast,pivot:t.pivot}:{}}}function GE(e){if(e.mixerLumaLock!==!1||la(e.mixer))return!1;let t=(i,a)=>Math.abs(i-a)<1e-9,r=e.power??[1,1,1],o=e.curves,n=!!o&&[o.r,o.g,o.b].some(i=>i&&i.length>=2);return[0,1,2].every(i=>t(r[i],1))&&HE(e)===null&&!n}function M3(e,t){if(t<=e[0][0])return e[0][1];let r=e[e.length-1];if(t>=r[0])return r[1];let o=0,n=e.length-1;for(;n-o>1;){let c=o+n>>1;e[c][0]<=t?o=c:n=c}let[i,a]=e[o],[s,l]=e[n];return s>i?a+(l-a)*(t-i)/(s-i):a}var or=[.21,.7,.09];function HE(e){if(!e.shadow&&!e.midtone&&!e.highlight&&e.contrast===void 0)return null;let t=o=>[o?.[0]??0,o?.[1]??0,o?.[2]??0],r={shadow:t(e.shadow),midtone:t(e.midtone),highlight:t(e.highlight),contrast:e.contrast??1,pivot:e.pivot??vn};return sa(r)?null:r}function WE(e,t){if(GE(e))return a=>a;let r=HE(e),o=e.power??[1,1,1],n=[e.curves?.r,e.curves?.g,e.curves?.b].map(a=>a&&a.length>=2?a:null),i=a=>a<0?0:a>1?1:a;return(a,s)=>{let l=a*e.slope[s]+e.offset[s],c=o[s];c!==1&&(l=l<0?-Math.pow(-l,c):Math.pow(l,c)),r&&(l=Or(l,r,s));let u=n[s];return u&&(l=M3(u,i(l))),t?i(l):l}}function JE(e){let t=e.saturation??1,r=Math.abs(t-1)>1e-9,o=!la(e.mixer),n=GE(e);if(!r&&!o&&!n)return null;let i=[t+(1-t)*or[0],(1-t)*or[1],(1-t)*or[2],(1-t)*or[0],t+(1-t)*or[1],(1-t)*or[2],(1-t)*or[0],(1-t)*or[1],t+(1-t)*or[2]];if(o){let s=e.mixerLumaLock===!1?e.mixer:mm(e.mixer),l=new Array(9);for(let c=0;c<3;c++)for(let u=0;u<3;u++)l[c*3+u]=s[c*3]*i[u]+s[c*3+1]*i[3+u]+s[c*3+2]*i[6+u];i=l}let a=[0,0,0];if(n){let s=e.slope,l=e.offset;for(let c=0;c<3;c++){a[c]=i[c*3]*l[0]+i[c*3+1]*l[1]+i[c*3+2]*l[2];for(let u=0;u<3;u++)i[c*3+u]*=s[u]}}return{m:i,add:a}}var ml=-1,Mr=-1,qE=!1,Pv=.35,C3=[.25,-.5,Math.log(.25)],D3=[4,.5,Math.log(4)],Mn=-1;function Tv(e){let t={slope:[e[0],e[1],e[2]],offset:[e[3],e[4],e[5]],power:[Math.exp(e[6]),Math.exp(e[7]),Math.exp(e[8])],contrast:e[9],pivot:ml>=0?e[ml]:vn,saturation:e[10]};if(Mn>=0&&(t.master={slope:e[Mn],offset:e[Mn+1],power:Math.exp(e[Mn+2])}),Mr>=0){let r=e.slice(Mr,Mr+6);t.mixer=[1,r[0],r[1],r[2],1,r[3],r[4],r[5],1],qE&&(t.mixerLumaLock=!1)}return e.length-(ml>=0?1:0)-(Mr>=0?6:0)-(Mn>=0?3:0)>11&&(t.shadow=[e[11],e[12],e[13]],t.midtone=[e[14],e[15],e[16]],t.highlight=[e[17],e[18],e[19]]),t}var j3=[.25,.25,.25,-.5,-.5,-.5,Math.log(.25),Math.log(.25),Math.log(.25),.5,0,...Array(9).fill(-.3)],N3=[4,4,4,.5,.5,.5,Math.log(4),Math.log(4),Math.log(4),2,2,...Array(9).fill(.3)],F3=e=>e.map((t,r)=>r===ml?Math.min(.9,Math.max(.1,t)):Mn>=0&&r>=Mn?Math.min(D3[r-Mn],Math.max(C3[r-Mn],t)):Mr>=0&&r>=Mr&&r<Mr+6?Math.min(Pv,Math.max(-Pv,t)):Math.min(N3[r],Math.max(j3[r],t))),pm=(e,t)=>t===1?e:e<0?-Math.pow(-e,t):Math.pow(e,t);function KE(e,t,r,o){let n=e.master,i=n?{...e,slope:[1,1,1],offset:[0,0,0],power:[1,1,1]}:{...e},a=WE(i,!1),s=JE(i);for(let l=0;l<t.length;l+=3){let c,u,d;if(n){let f=t[l],m=t[l+1],p=t[l+2],g=pm(f*e.slope[0]+e.offset[0],e.power[0]),_=pm(m*e.slope[1]+e.offset[1],e.power[1]),v=pm(p*e.slope[2]+e.offset[2],e.power[2]),y=.2126*g+.7152*_+.0722*v,b=.2126*f+.7152*m+.0722*p,w=pm(b*n.slope+n.offset,n.power);c=a(g-y+w,0),u=a(_-y+w,1),d=a(v-y+w,2)}else c=a(t[l],0),u=a(t[l+1],1),d=a(t[l+2],2);if(s){let f=s.m,m=s.add,p=f[0]*c+f[1]*u+f[2]*d+m[0],g=f[3]*c+f[4]*u+f[5]*d+m[1],_=f[6]*c+f[7]*u+f[8]*d+m[2];c=p,u=g,d=_}r[l]=c,r[l+1]=u,r[l+2]=d}o?.(r);for(let l=0;l<r.length;l++)r[l]=r[l]<0?0:r[l]>1?1:r[l]}function L3(e,t,r){let o=e.slice(),n=t.slice();for(let a=0;a<r;a++){let s=a;for(let c=a+1;c<r;c++)Math.abs(o[c*r+a])>Math.abs(o[s*r+a])&&(s=c);if(s!==a){for(let c=0;c<r;c++)[o[a*r+c],o[s*r+c]]=[o[s*r+c],o[a*r+c]];[n[a],n[s]]=[n[s],n[a]]}let l=o[a*r+a]||1e-12;for(let c=a+1;c<r;c++){let u=o[c*r+a]/l;if(u){for(let d=a;d<r;d++)o[c*r+d]-=u*o[a*r+d];n[c]-=u*n[a]}}}let i=new Array(r).fill(0);for(let a=r-1;a>=0;a--){let s=n[a];for(let l=a+1;l<r;l++)s-=o[a*r+l]*i[l];i[a]=s/(o[a*r+a]||1e-12)}return i}function Av(e,t,r={}){if(r.matchChroma&&r.matchStats===void 0&&(r={...r,matchStats:1}),e.w!==t.w||e.h!==t.h)throw new Error(`fitPrimaries: size mismatch ${e.w}x${e.h} vs ${t.w}x${t.h}`);let o=e.w*e.h,n=r.samples??6e3;if(r.skinBoost&&r.skinBoost>1){let H=r.weights??new Float32Array(o).fill(1),oe=new Float32Array(o);for(let se=0;se<o;se++){if(oe[se]=H[se],!H[se])continue;let De=t.data[se*3]*255,fe=t.data[se*3+1]*255,Ee=t.data[se*3+2]*255,Qe=.299*De+.587*fe+.114*Ee,Tt=128-.168736*De-.331264*fe+.5*Ee,$e=128+.5*De-.418688*fe-.081312*Ee;(r.skinRegion===void 0||r.skinRegion!==null&&r.skinRegion[se]>1)&&Tt>=77&&Tt<=127&&$e>=133&&$e<=173&&Qe>40&&Qe<235&&(oe[se]=H[se]*r.skinBoost)}r={...r,weights:oe}}let i=[];for(let H=0;H<o;H++)(!r.weights||r.weights[H]>0)&&i.push(H);let a=[],s=Math.max(1,i.length/n);for(let H=0;H<i.length&&a.length<n;H+=s)a.push(i[Math.floor(H)]);let l=a.length,c=new Float64Array(l*3),u=new Float64Array(l*3),d=new Float64Array(l);a.forEach((H,oe)=>{for(let se=0;se<3;se++)c[oe*3+se]=e.data[H*3+se],u[oe*3+se]=t.data[H*3+se];d[oe]=Math.sqrt(r.weights?r.weights[H]:1)});let f=(r.wheels?20:11)+(r.freePivot?1:0)+(r.mixer||r.mixerRaw?6:0)+(r.lumMix100?3:0),m=[1,1,1,0,0,0,0,0,0,1,1,...r.wheels?Array(9).fill(0):[],...r.freePivot?[vn]:[],...r.mixer||r.mixerRaw?Array(6).fill(0):[]];Mn=r.lumMix100?f-3:-1,r.lumMix100&&(m=[...m,1,0,0]),Mr=r.mixer||r.mixerRaw?f-6-(r.lumMix100?3:0):-1,qE=!!r.mixerRaw,Pv=r.mixerRaw?1.5:.35,ml=r.freePivot?f-1-(r.mixer||r.mixerRaw?6:0)-(r.lumMix100?3:0):-1;let p=[.2126,.7152,.0722],g=r.keepTone;g&&(m=[...g.slope,...g.offset,...g.power.map(Math.log),g.contrast,g.saturation,...m.slice(11)]);let _=H=>{if(r.balanceOnly&&(H[7]=H[6],H[8]=H[6]),g){let oe=p[0]*H[0]+p[1]*H[1]+p[2]*H[2],se=p[0]*g.slope[0]+p[1]*g.slope[1]+p[2]*g.slope[2];for(let Ee=0;Ee<3;Ee++)H[Ee]*=se/oe;let De=p[0]*H[3]+p[1]*H[4]+p[2]*H[5],fe=p[0]*g.offset[0]+p[1]*g.offset[1]+p[2]*g.offset[2];for(let Ee=3;Ee<6;Ee++)H[Ee]+=fe-De}return H};if(r.lumMix100){let H=_;_=oe=>{H(oe);let se=p[0]*oe[0]+p[1]*oe[1]+p[2]*oe[2];for(let fe=0;fe<3;fe++)oe[fe]/=se;let De=p[0]*oe[3]+p[1]*oe[4]+p[2]*oe[5];for(let fe=3;fe<6;fe++)oe[fe]-=De;return oe[6]=oe[7]=oe[8]=0,oe}}let v=new Set([...r.balanceOnly?[7,8]:[],...g?[6,7,8,9]:[],...r.lumMix100?[6,7,8]:[],...r.noContrastSat?[9,10]:[]]),y=[1,1,1,0,0,0,0,0,0,1,1,...r.wheels?Array(9).fill(0):[],...r.freePivot?[vn]:[],...r.mixer||r.mixerRaw?Array(6).fill(0):[],...r.lumMix100?[1,0,0]:[]],b=[6,7,8,9],w=0;for(let H=0;H<l;H++)w+=d[H]*d[H];let k=Math.sqrt((r.prior??0)*w),I=[.02,.1,.25,.5,.75,.9,.98],x=H=>{let oe=new Float64Array(l),se=0,De=0;for(let $e=0;$e<l;$e++){let tt=H[$e*3],mt=H[$e*3+1],_t=H[$e*3+2],Bv=d[$e]*d[$e];De+=Bv,se+=Bv*(Math.max(tt,mt,_t)-Math.min(tt,mt,_t)),oe[$e]=.2126*tt+.7152*mt+.0722*_t}let fe=new Float64Array(9),Ee=[0,0,0];C.forEach(($e,tt)=>{for(let mt of $e){for(let _t=0;_t<3;_t++)fe[tt*3+_t]+=H[mt*3+_t];Ee[tt]++}});let Qe=new Float64Array(6),Tt=[0,0];return q.forEach(($e,tt)=>{for(let mt of $e){for(let _t=0;_t<3;_t++)Qe[tt*3+_t]+=H[mt*3+_t];Tt[tt]++}}),oe.sort(),[...I.map($e=>oe[Math.floor($e*(l-1))]),se/De,...Array.from(fe,($e,tt)=>Ee[tt/3|0]?$e/Ee[tt/3|0]:0),...[0,1].flatMap(()=>Array.from(Qe,($e,tt)=>Tt[tt/3|0]?$e/Tt[tt/3|0]:0))]},S=[];for(let H=0;H<l;H++){let oe=u[H*3],se=u[H*3+1],De=u[H*3+2],fe=.2126*oe+.7152*se+.0722*De;Math.max(oe,se,De)-Math.min(oe,se,De)<.06&&fe>.04&&fe<.96&&S.push(H)}let R=H=>.2126*u[H*3]+.7152*u[H*3+1]+.0722*u[H*3+2];S.sort((H,oe)=>R(H)-R(oe));let $=Math.floor(S.length/3),C=$>=20?[S.slice(0,$),S.slice($,2*$),S.slice(2*$)]:[[],[],[]],E=[];for(let H=0;H<l;H++){let oe=u[H*3]*255,se=u[H*3+1]*255,De=u[H*3+2]*255,fe=.299*oe+.587*se+.114*De,Ee=128-.168736*oe-.331264*se+.5*De,Qe=128+.5*oe-.418688*se-.081312*De;Ee>=77&&Ee<=127&&Qe>=133&&Qe<=173&&fe>40&&fe<235&&E.push(H)}E.sort((H,oe)=>R(H)-R(oe));let L=Math.floor(E.length/2),q=L>=15?[E.slice(0,L),E.slice(L)]:[[],[]],O=x(u),G=r.matchStats?O.length:0,X=Math.sqrt((r.matchStats??0)*w*3/Math.max(1,G)),ae=l*3+G+b.length,Y=new Float64Array(l*3),j=H=>{KE(Tv(H),c,Y,r.post);let oe=new Float64Array(ae);for(let se=0;se<l*3;se++)oe[se]=(Y[se]-u[se])*d[se/3|0];if(G){let se=x(Y);for(let De=0;De<G;De++)oe[l*3+De]=X*(se[De]-O[De])}return b.forEach((se,De)=>{oe[l*3+G+De]=k*(H[se]-y[se])}),oe},V=H=>{let oe=0;for(let se of H)oe+=se*se;return oe},Z=j(m),Q=V(Z),ne=.001,ye=0,Be=r.iterations??80,Ve=new Float64Array(ae*f);for(;ye<Be;ye++){for(let fe=0;fe<f;fe++){if(v.has(fe)){for(let $e=0;$e<ae;$e++)Ve[$e*f+fe]=0;continue}let Ee=1e-4,Qe=m.slice();Qe[fe]+=Ee,_(Qe);let Tt=j(Qe);for(let $e=0;$e<ae;$e++)Ve[$e*f+fe]=(Tt[$e]-Z[$e])/Ee}let H=new Array(f*f).fill(0),oe=new Array(f).fill(0);for(let fe=0;fe<ae;fe++){let Ee=Z[fe];for(let Qe=0;Qe<f;Qe++){let Tt=Ve[fe*f+Qe];if(Tt){oe[Qe]+=Tt*Ee;for(let $e=Qe;$e<f;$e++)H[Qe*f+$e]+=Tt*Ve[fe*f+$e]}}}for(let fe of v)H[fe*f+fe]+=1;for(let fe=0;fe<f;fe++)for(let Ee=0;Ee<fe;Ee++)H[fe*f+Ee]=H[Ee*f+fe];let se=!1,De=!1;for(let fe=0;fe<8;fe++){let Ee=H.slice();for(let mt=0;mt<f;mt++)Ee[mt*f+mt]*=1+ne;let Qe=L3(Ee,oe.map(mt=>-mt),f),Tt=_(F3(m.map((mt,_t)=>v.has(_t)?mt:mt+Qe[_t]))),$e=j(Tt),tt=V($e);if(tt<Q){De=(Q-tt)/Math.max(Q,1e-12)<1e-7,m=Tt,Q=tt,Z=$e,ne=Math.max(ne/3,1e-7),se=!0;break}ne*=4}if(!se||De)break}KE(Tv(m),c,Y,r.post);let st=0,lt=0;for(let H=0;H<l*3;H++){let oe=d[H/3|0]**2;st+=oe*Math.abs(Y[H]-u[H]),lt+=oe}return{cdl:Tv(m),residual:lt?st/lt:0,iterations:ye}}var z3="yunet.safetensors";async function XE(e){let t=await er(),r=t&&M(t.model,z3);if(!t||!r||!await Zt(r))return[];let o=new Uint8Array(e.w*e.h*3);for(let i=0;i<o.length;i++)o[i]=Math.max(0,Math.min(255,Math.round(e.data[i]*255)));let n=await nt("conform-faces-");try{let i=M(n,"in.rgb");await Nt(i,o);let a=[],s=await kn(t.runner,["faces","--weights",r,"--input-rgb",`${i}:${e.w}x${e.h}`],c=>a.push(c));if(s.code!==0)throw new Error(`face detection failed (exit ${s.code}): ${s.stderr.trim().slice(-300)}`);return JSON.parse(new TextDecoder().decode(U3(a)).trim()).faces.map(c=>({x0:Math.max(0,c.x/e.w),y0:Math.max(0,c.y/e.h),x1:Math.min(1,(c.x+c.w)/e.w),y1:Math.min(1,(c.y+c.h)/e.h),score:c.score}))}finally{await sn(n).catch(()=>{})}}function U3(e){let t=new Uint8Array(e.reduce((o,n)=>o+n.length,0)),r=0;for(let o of e)t.set(o,r),r+=o.length;return t}function YE(e,t,r=8){let o=t.filter(a=>a.x1>a.x0&&a.y1>a.y0&&a.score>0);if(o.length===0)return null;let n=e.w*e.h,i=new Float32Array(n).fill(1);for(let a of o){let s=(a.x0+a.x1)/2*e.w,l=(a.y0+a.y1)/2*e.h,c=Math.max(1,(a.x1-a.x0)/2*e.w),u=Math.max(1,(a.y1-a.y0)/2*e.h),d=Math.max(0,Math.floor(s-2.5*c)),f=Math.min(e.w,Math.ceil(s+2.5*c)),m=Math.max(0,Math.floor(l-2.5*u)),p=Math.min(e.h,Math.ceil(l+2.5*u));for(let g=m;g<p;g++){let _=(g-l)/u;for(let v=d;v<f;v++){let y=(v-s)/c,b=y*y+_*_,w=1+(r-1)*a.score*Math.exp(-b/(2*.45)),k=g*e.w+v;w>i[k]&&(i[k]=w)}}}return i}var QE=()=>({slope:[1,1,1],offset:[0,0,0],power:[1,1,1]});function Ev(e,t){let r=hm(t),o="engine"in e&&e.engine==="ai"?e:null,n=o?o.transferred?"AI Color Transfer":"AI Auto Balance":"Auto Balance",i={source:o?o.transferred?"ai_color_transfer_v1":"ai_balance_v1":"auto_balance_v1",castDeg:e.analysis.castDeg,exposureStops:e.analysis.exposureStops,wbGain:e.analysis.wbGain,blackPointOffset:e.analysis.blackPointOffset,framesUsed:e.framesUsed,transfer:e.transfer,...o?{seed:o.seed,prompt:o.prompt,fitResidual:o.fitResidual,inferenceMs:o.inferenceMs,matchMethod:o.matchMethod,gradeStyle:o.gradeStyle,usesLogWheels:e.cdl.wheels!==void 0,usesSaturation:e.cdl.saturation!==void 0,facesDetected:o.facesDetected,skinWeighted:o.skinWeighted}:{}};if(o?.fold){let s=o.fold;return[{id:r[0],kind:"cdl",label:`${n} \xB7 tone 1`,enabled:!0,cdl:{...s.tone1},meta:i},{id:r[1],kind:"cdl",label:`${n} \xB7 match matrix`,enabled:!0,cdl:{...QE(),offset:s.offset,mixer:s.matrix,mixerLumaLock:!1},meta:{source:i.source,part:"2/4"}},{id:r[2],kind:"cdl",label:`${n} \xB7 tone 2`,enabled:s.tone2Enabled??!0,cdl:{...s.tone2},meta:{source:i.source,part:"3/4"}},...s.trim?[{id:r[3],kind:"cdl",label:`${n} \xB7 trim`,enabled:!0,cdl:{...QE(),contrast:s.trim.contrast,pivot:s.trim.pivot},meta:{source:i.source,part:"4/4"}}]:[]]}let a=ZE(e.cdl);return[{id:r[0],kind:"cdl",label:n,enabled:!0,cdl:a,meta:i}]}function hm(e){let t=e?`@${e}`:"";return[`auto-balance${t}`,`auto-balance${t}-2`,`auto-balance${t}-3`,`auto-balance${t}-4`]}function eO(e,t,r,o){let n=Ev(e,o),i=new Set(n.map(s=>s.id)),a=o?[...hm(o),...hm()]:hm();return[...n.map(s=>({timeline_id:t,item_id:r,entry:s})),...a.filter(s=>!i.has(s)).map(s=>({timeline_id:t,item_id:r,remove_id:s}))]}var tO={inputColorSpace:"REC709_COLORSPACE",inputGamma:"TWOPOINTFOUR_GAMMA",outputColorSpace:"REC709_COLORSPACE",outputGamma:"TWOPOINTFOUR_GAMMA"};function nO(e){let t=String(e.outputGamma??tO.outputGamma);return t==="TWOPOINTFOUR_GAMMA"||t==="REC709_GAMMA"?"g24":t==="SRGB_GAMMA"?"srgb":null}function Ov(e){let t=r=>String(e[r]??tO[r]).replace(/_(COLORSPACE|GAMMA)$/,"");return`${t("inputColorSpace")}/${t("inputGamma")} \u2192 ${t("outputColorSpace")}/${t("outputGamma")}`}async function ca(e,t){await sr();let r=Float32Array.from(e.data);return Aw(JSON.stringify(t),r),{data:r,w:e.w,h:e.h}}var aO=["primaries","pixel","hm-mkl-hm","hm-coral-hm","hm-adain-hm","hm-mvgd-hm"],rO=1024;async function B3(e){let t=await p0(e);return hv(t.rgba,t.width,t.height)}async function V3(e,t){let r=await Pe(e),o=r.streams?.find(u=>u.kind==="video"),n=(o?.codec??"").toLowerCase(),i=r.source_fps??o?.rate??24,a=r.available_range?.duration?.value??0;if(["r3d","braw","crm","canon","arriraw","ari","xocn","prores_raw","prores raw","aprn","aprh"].some(u=>n.includes(u)))throw new Error(`${B(e)} is camera-native raw (${n}): the engine decodes it as log, so a display-referred match would be wrong \u2014 match on a proxy or a rendered frame`);let l=t==null?Math.floor(a/2):$n(t,i,r.source_timecode??null);if(a&&(l<0||l>=a))throw new Error(`frame ${l} is outside ${B(e)} (0\u2013${a-1})`);let c=await Rl(e,l,n);return{image:hv(c.rgba,c.width,c.height),frame:l,codec:n,transfer:"g24",fps:i}}async function oO(e,t){let r=Kt(e).toLowerCase();if(d0.has(r)||m0.has(r))return{image:await B3(e),frame:0,codec:"still",transfer:"srgb",fps:0};if(Sl.has(r))return V3(e,t);throw new Error(`unsupported file for color match: ${B(e)}`)}async function sO(e){let t=Date.now(),r=e.reference==="ai",o=e.method??(r?"primaries":"hm-mkl-hm"),n=o.split("-")[1],i=await oO(e.source,e.frame);if(e.cst){let w=nO(e.cst);if(!w)throw new Error(`the clip's Color Space Transform (${Ov(e.cst)}) does not end on a display; balance needs Rec.709/sRGB out`);i.image=await ca(i.image,e.cst),i.transfer=w}let a,s=r?await(async()=>{let w=tl();if(w)throw new Error(w);let k=await er();if(!k&&!e.download)throw new Error("the local AI colour model is not installed yet: run again with download: true to fetch it once (~4.3 GB, stays on this machine)");k??=await Hd({onProgress:e.onProgress});let I=await MP(k,am(i.image,1024)),x=CP(iO(i.image,I.w,I.h),I);return a={ms:I.ms,askedStops:x.askedStops,appliedStops:x.appliedStops},{image:x.image,frame:0,codec:"ai",transfer:i.transfer,fps:0}})():await oO(e.reference,e.reference_frame),l=e.transfer??i.transfer;$E(l);let c=am(i.image,rO),u=am(s.image,rO);(n==="mvgd"||o==="pixel"||o==="primaries")&&(u.w!==c.w||u.h!==c.h)&&(u=iO(u,c.w,c.h));let d,f,m,p,g=0,_=0;if(o==="primaries"){let w=Iv(c,u),k=0;for(let $ of w)k+=$;let I,x=e.skinBoost??3;if(x>1){let $=await XE(u);g=$.length,I=YE(u,$);let C=$.reduce((E,L)=>E+Math.max(0,L.x1-L.x0)*Math.max(0,L.y1-L.y0)*L.score,0);_=Math.min(1,C/.05)}let S={weights:w,balanceOnly:!0,mixerRaw:e.mixer===!0};p=Av(c,u,S);let R=1+(x-1)*_;I&&R>1.05&&(p=Av(c,u,{...S,skinBoost:R,skinRegion:I,keepTone:p.cdl})),f=u,m=k/w.length}else if(o==="pixel"){let w=VE(c,u);d=w,f=u,m=w.trustedShare}else{let w=cm(c,u,n);d=BE(c,u,w,{tone1Contrast:null,enableTone2:!1,trimContrast:null}),f=w.image}let v=fm(c,f),y={itemId:e.item_id??"color-match",averaged:c,balanced:f,report:{},analysis:v.analysis,cdl:{slope:[1,1,1],offset:[0,0,0],power:[1,1,1]},framesUsed:[i.frame],issues:[],transfer:l,sourceW:i.image.w,sourceH:i.image.h,totalMs:Date.now()-t,engine:"ai",transferred:!0,reference:u,seed:r?376436993:0,prompt:r?"balance (FLUX.2 klein, local)":"",matchMethod:o,fitResidual:p?.residual??d.residual,lumaStops:v.lumaStops,inferenceMs:a?.ms??0,facesDetected:g,skinWeighted:g>0,gradeStyle:p?"primaries":"fold",fold:d};if(p){let w=p.cdl;y.cdl={slope:w.slope,offset:w.offset,power:w.power,saturation:w.saturation,...w.mixer?{mixer:w.mixer,mixerLumaLock:w.mixerLumaLock}:{},wheels:{shadow:[0,0,0],midtone:[0,0,0],highlight:[0,0,0],contrast:w.contrast,pivot:w.pivot}}}let b=Ev(y);return{run:y,entries:b,method:o,transfer:l,source:{path:e.source,frame:i.frame,codec:i.codec,w:i.image.w,h:i.image.h},reference:{path:r?"FLUX.2 klein (local)":e.reference,w:s.image.w,h:s.image.h},residual:p?.residual??d.residual,lumaStops:v.lumaStops,ai:a,trustedShare:m,cst:e.cst?Ov(e.cst):void 0}}function lO(e,t,r){return eO(e.run,t,r)}function cO(e,t){for(let r of e.timelines)for(let o of r.tracks)for(let n of o.items){if(n.id!==t)continue;return(n.effects??[]).find(a=>a.kind==="color_space_transform")?.parameters}}function uO(e,t){let r=[];for(let o of e.timelines)for(let n of o.tracks)for(let i of n.items)(i.id===t||i.name===t)&&r.push({timelineId:o.id??"",itemId:i.id,name:i.name??""});return r.length===1?r[0]:r.length>1?r.find(n=>n.itemId===t)??r[0]:null}var Cr=e=>(Math.round(e*1e3)/1e3).toString(),Ao=e=>e?`[${e.map(Cr).join(", ")}]`:"\u2014";function dO(e){let t=[`source ${B(e.source.path)} frame ${e.source.frame} (${e.source.codec}, ${e.source.w}x${e.source.h}, ${e.cst?`after the clip's CST ${e.cst}, `:""}${e.transfer}) \u2192 reference ${B(e.reference.path)} (${e.reference.w}x${e.reference.h})`,`method ${e.method}; fit residual ${Cr(e.residual)} (mean |chain \u2212 match|, 0\u20131 codes); luma ${e.lumaStops>=0?"+":""}${Cr(e.lumaStops)} stops`,...e.ai?[`AI balance: FLUX.2 klein on this machine in ${(e.ai.ms/1e3).toFixed(1)} s; exposure held (model asked ${e.ai.askedStops>=0?"+":""}${Cr(e.ai.askedStops)} stops, applied ${e.ai.appliedStops>=0?"+":""}${Cr(e.ai.appliedStops)})`]:[],...e.method==="primaries"?[(r=>r.facesDetected?`skin: ${r.facesDetected} face${r.facesDetected>1?"s":""} found \u2014 skin protected (colour only, contrast kept)`:"skin: no faces in the frame \u2014 plain balance")(e.run)]:[],"grade (Resolve node order \u2014 timeline_write resolve-drt emits them as corrector nodes):"];for(let r of e.entries){let o=r.cdl??{},n=r.enabled===!1?" (bypassed)":"",i=[o.slope?`slope ${Ao(o.slope)}`:"",o.offset?`offset ${Ao(o.offset)}`:"",o.power?`power ${Ao(o.power)}`:"",o.mixer?`mixer ${Ao(o.mixer)}`:"",o.saturation!=null?`sat ${Cr(o.saturation)}`:"",o.contrast!=null?`contrast ${Cr(o.contrast)} @ pivot ${Cr(o.pivot??.435)}`:"",o.shadow?`wheels lift ${Ao(o.shadow)} gamma ${Ao(o.midtone)} gain ${Ao(o.highlight)}`:""].filter(Boolean);t.push(`- ${r.label??r.id}${n}: ${i.join("; ")}`)}return t.join(`
|
|
201
|
+
`)}function iO(e,t,r){let o=new Float32Array(t*r*3);for(let n=0;n<r;n++){let i=Math.min(e.h-1,Math.floor((n+.5)*e.h/r));for(let a=0;a<t;a++){let s=Math.min(e.w-1,Math.floor((a+.5)*e.w/t)),l=(i*e.w+s)*3,c=(n*t+a)*3;o[c]=e.data[l],o[c+1]=e.data[l+1],o[c+2]=e.data[l+2]}}return{data:o,w:t,h:r}}var Mv=960,Z3=187.5/1023,mO={lift:100663320,gain:100663325,gamma:100663330,offset:100663421,contrast:2248147137,pivot:2248147136,shadow:2248147138,temp:2248147221,tint:2248147222};function fO(e){let t=[];for(let r of["lift","gain","gamma","offset","shadow"])e[r].forEach((o,n)=>t.push([mO[r]+n,o]));for(let r of["contrast","pivot","temp","tint"])t.push([mO[r],e[r]]);return t.sort((r,o)=>r[0]-o[0])}function gO(e,t=`(3, ${e.h}, ${e.w})`){let r=`{'descr': '<f4', 'fortran_order': False, 'shape': ${t}, }`;for(;(10+r.length+1)%64;)r+=" ";r+=`
|
|
202
|
+
`;let o=e.w*e.h,n=new Uint8Array(10+r.length+12*o);n.set([147,78,85,77,80,89,1,0,r.length&255,r.length>>8]),n.set(new TextEncoder().encode(r),10);let i=new Float32Array(3*o);for(let a=0;a<o;a++)for(let s=0;s<3;s++)i[s*o+a]=e.data[a*3+s];return n.set(new Uint8Array(i.buffer),10+r.length),n}function G3(e,t=33){let r=new Float32Array(t*t*t*3);for(let o=0;o<t*t*t;o++)[Math.floor(o/(t*t)),Math.floor(o/t)%t,o%t].forEach((n,i)=>r[o*3+i]=-.15+1.5*n/(t-1));return gO(ca({data:r,w:t*t*t,h:1},e),`(3, ${t}, ${t}, ${t})`)}var H3=["H","Q1","M","Q3","T"],gm=["clip","group_pre","group_post","adjustment_clips","timeline","output"],W3=`How do you build your grade? (color_prep look_levels=[...] lut_dirs=[...])
|
|
203
|
+
look_levels: where your look lives, any of: clip (nodes after your balance node in this tree), group_pre, group_post, adjustment_clips, timeline, output (an output LUT in project settings)
|
|
204
|
+
lut_dirs: the folders your LUTs and DCTLs live in (so I can read your DCTLs and find your LUTs; anything encrypted I bake through Resolve in a scratch project)`;async function bO(e,t,r,o,n,i){let a=await _0(await _e(e));if(!a.ok)throw new P("invalid_args",`${B(e)}: ${a.why}`);let s=a.nodes.map(m=>` node ${m.id}${m.label?` "${m.label}"`:""}${m.cst?` (Color Space Transform: ${m.cst_params?.inputColorSpace??"?"}/${m.cst_params?.inputGamma??"?"} -> ${m.cst_params?.outputColorSpace??"?"}/${m.cst_params?.outputGamma??"?"})`:""}`).join(`
|
|
205
|
+
`);if(t==null||r==null&&!i||!o?.length)return{ask:`${B(e)} has ${a.nodes.length} nodes:
|
|
206
|
+
${s}
|
|
207
|
+
Which node is the BALANCE node, and which is the input Color Space Transform? (color_prep tree=\u2026 balance_node=<id> cst_node=<id>; if their input CST is not in this tree \u2014 in a group pre-clip grade or colour management \u2014 give working="<SPACE>_COLORSPACE/<CURVE>_GAMMA" for the space this tree works in instead of cst_node)
|
|
208
|
+
${W3}`};if(!a.nodes.find(m=>m.id===t))throw new P("invalid_args",`${B(e)} has no node ${t}:
|
|
209
|
+
${s}`);let c;if(r!=null){let m=a.nodes.find(p=>p.id===r);if(!m?.cst)throw new P("invalid_args",`node ${r} is not a Color Space Transform node:
|
|
210
|
+
${s}`);if(c=m.cst_params??{},!c.outputColorSpace||!c.outputGamma)throw new P("invalid_args",`node ${r}'s CST does not say its output (working) space; set it in Resolve and export the still again`)}else{let[m,p]=i.split("/").map(g=>g.trim());if(!m?.endsWith("_COLORSPACE")||!p?.endsWith("_GAMMA"))throw new P("invalid_args",`working '${i}': give <SPACE>_COLORSPACE/<CURVE>_GAMMA (Resolve CST names, e.g. DWG_COLORSPACE/DAV_INTER_OETF_GAMMA)`);c={outputColorSpace:m,outputGamma:p}}let u=o.filter(m=>!gm.includes(m));if(u.length)throw new P("invalid_args",`look_levels ${u.join(", ")}: use ${gm.join(", ")}`);let d={name:B(e),body_hex:a.body_hex,nodes:a.nodes,balance_node:t,...r!=null?{cst_node:r}:{},working:{space:String(c.outputColorSpace),gamma:String(c.outputGamma)},look_levels:o,lut_dirs:n},f=await on();return await Ns({...f,color_tree:d}),{tree:d}}async function yO(){return(await on()).color_tree??null}async function _O(e){let t=await Lr();if(!t)throw new P("unsupported","the native decoder (conformtools-decode) is not installed");let r=[],o=await kn(t,e,a=>r.push(a)),n=new Uint8Array(r.reduce((a,s)=>a+s.length,0)),i=0;for(let a of r)n.set(a,i),i+=a.length;return{out:n,...o}}async function pO(e){let t=await _O(["colour",e]).catch(r=>({code:1,out:new Uint8Array,stderr:String(r?.message??r)}));return t.code!==0?{kind:"unknown",evidence:`could not read it (${t.stderr.trim().slice(0,200)})`,confident:!1}:JSON.parse(new TextDecoder().decode(t.out))}function hO(e,t){let r=e?.find(a=>t.some(s=>s.toLowerCase().includes(a.match.toLowerCase())));if(!r)return null;let o=r.as.trim();if(/^(graphic|none|skip)$/i.test(o))return{kind:"graphic",evidence:`you said: ${o}`,confident:!0};if(/^rec\.?709$/i.test(o))return{kind:"display",color_space:"REC709_COLORSPACE",gamma:"TWOPOINTFOUR_GAMMA",evidence:"you said: Rec.709",confident:!0};let[n,i]=o.split("/").map(a=>a.trim());if(!n?.endsWith("_COLORSPACE")||!i?.endsWith("_GAMMA"))throw new P("invalid_args",`colour answer '${o}' for '${r.match}': give graphic, rec709, or <SPACE>_COLORSPACE/<CURVE>_GAMMA (Resolve CST names)`);return{kind:/709|SRGB|2020/.test(i)||i==="TWOPOINTFOUR_GAMMA"?"display":"log",color_space:n,gamma:i,evidence:`you said: ${o}`,confident:!0}}function J3(e,t){let r=t.tracks.filter(u=>u.kind==="Video"),o=Qi(t,r),n=new Map(e.media_references.map(u=>[u.id,u])),i=t.fps_den?t.fps_num/t.fps_den:t.fps_num,a=new Map;for(let u of o){let d=u.it,f=d.media_reference_id?n.get(d.media_reference_id):void 0,m=f?.local_path??f?.target_url?.replace(/^file:\/\//,"");if(!m||!d.source_range)continue;let p=(t.start_frame??0)+d.timeline_range.start.value,g=a.get(d.id);if(g){g.rec1=Math.max(g.rec1,u.e);continue}let _=f.source_timecode,v=_?_.split(/[:;]/).map(Number).reduce((y,b,w)=>w<3?y*60+b:y*Math.round(i)+b,0):0;a.set(d.id,{item:d,path:m,name:d.name??B(m),colour:{kind:"unknown",evidence:"",confident:!1},rec0:u.s,rec1:u.e,src0:d.source_range.start.value+(u.s-p),camFrame:v+d.source_range.start.value,fps:i})}let s=[...a.values()].sort((u,d)=>u.rec0-d.rec0),l=new Set(s.map(u=>u.item.id)),c=r.flatMap(u=>u.items).filter(u=>u.kind==="clip"&&!l.has(u.id)&&u.media_reference_id);return{shots:s,hidden:c}}function K3(e,t){let r=e.start_frame??0,o=e.tracks.flatMap(s=>s.items).filter(s=>s.kind==="transition").map(s=>({s:r+s.timeline_range.start.value,e:r+s.timeline_range.start.value+s.timeline_range.duration.value})),n=s=>o.some(l=>s>=l.s-1&&s<=l.e),i=0,a=t.rec1-t.rec0-1;for(;i<a&&n(t.rec0+i);)i++;for(;a>i&&n(t.rec0+a);)a--;return H3.map((s,l)=>({key:s,src:t.src0+Math.round(i+(a-i)*l/4)}))}async function q3(e,t,r){let o={outputColorSpace:r.space,outputGamma:r.gamma,doFwdOOTF:0},n="";if(/\.mxf$/i.test(e.path)){let i=await _O(["logframe",e.path,String(t),String(Mv)]);if(i.code!==0&&/not an X-OCN/.test(i.stderr)&&(n="h264"),i.code===0){let a=i.out.indexOf(10),s=JSON.parse(new TextDecoder().decode(i.out.subarray(0,a))),l=new Float32Array(i.out.slice(a+1).buffer);return ca({data:l,w:s.w,h:s.h},{inputColorSpace:s.color_space,inputGamma:s.gamma,...o,doInvOOTF:0})}}if(e.colour.kind==="log"&&/\.(r3d|braw|ari|arx|crm)$/i.test(e.path))return null;try{let i=await Rl(e.path,t,n,Mv),a=new Float32Array(i.width*i.height*3);for(let l=0,c=0;l<a.length;l+=3,c+=4)a[l]=i.rgba[c]/255,a[l+1]=i.rgba[c+1]/255,a[l+2]=i.rgba[c+2]/255;let s=X3({data:a,w:i.width,h:i.height},Mv);return ca(s,{inputColorSpace:e.colour.color_space,inputGamma:e.colour.gamma,...o,doInvOOTF:e.colour.kind==="display"?1:0})}catch{return null}}function X3(e,t){let r=Math.min(1,t/Math.max(e.w,e.h));if(r>=1)return e;let o=Math.round(e.w*r),n=Math.round(e.h*r),i=new Float32Array(o*n*3);for(let a=0;a<n;a++){let s=Math.floor(a*e.h/n),l=Math.max(s+1,Math.floor((a+1)*e.h/n));for(let c=0;c<o;c++){let u=Math.floor(c*e.w/o),d=Math.max(u+1,Math.floor((c+1)*e.w/o));for(let f=0;f<3;f++){let m=0;for(let p=s;p<l;p++)for(let g=u;g<d;g++)m+=e.data[(p*e.w+g)*3+f];i[(a*o+c)*3+f]=m/((l-s)*(d-u))}}}return{data:i,w:o,h:n}}var Y3=e=>({inputColorSpace:e.space,inputGamma:e.gamma,outputColorSpace:"REC709_COLORSPACE",outputGamma:"TWOPOINTFOUR_GAMMA",doFwdOOTF:1,doInvOOTF:0});async function vO(e,t){let r=t.progress??(()=>{}),o=e.timelines.find(g=>!t.timeline||g.id===t.timeline||g.name===t.timeline)??e.timelines[0];if(!o)throw new P("not_found","no timeline in this session");let{shots:n,hidden:i}=J3(e,o),a=new Map;for(let g of n)r(`reading colour metadata: ${g.name}`),g.colour=hO(t.answers,[g.name,B(g.path)])??a.get(g.path)??await pO(g.path),a.set(g.path,g.colour);let s=n.filter(g=>g.colour.kind==="unknown"||!g.colour.confident);if(s.length){let g=new Map;for(let v of s){let y=v.path.split("/").slice(-3,-1).join("/");g.set(y,[...g.get(y)??[],v])}return{text:`Before I build the colour prep I need to know what these clips are (nothing is written until then):
|
|
211
|
+
${[...g.entries()].map(([v,y])=>` ${v}: ${y.length} clip(s), e.g. ${y[0].name} \u2014 ${y[0].colour.evidence}${y[0].colour.color_space?` (tags say ${y[0].colour.color_space}/${y[0].colour.gamma})`:""}`).join(`
|
|
212
|
+
`)}
|
|
213
|
+
Answer with answers=[{match:"<part of the file or folder name>", as:"rec709" | "graphic" | "<SPACE>_COLORSPACE/<CURVE>_GAMMA"}].`,data:{questions:s.map(v=>({item:v.item.id,name:v.name,path:v.path,...v.colour}))},ops:[]}}let l=n.filter(g=>g.colour.kind!=="graphic"),c=[];if(t.balance!==!1&&l.length){let g=tl();if(g)throw new P("unsupported",`${g}; run with balance=false for the tree and CSTs only`);let _=await er(),v=_&&await EP(_)&&await OP(_);if(!v&&!t.download)throw new P("refused",_?"the balance needs the AI pack's new models (step 1's exposure LoRAs, step 2's shot-to-shot models; up to ~2.8 GB): ask the user, then download=true; or balance=false for the tree and CSTs only":"the balance needs the local AI pack (one-time download, ~4.4 GB): ask the user, then download=true; or balance=false for the tree and CSTs only");let y=v?_:await Hd({onProgress:r}),b=await nt("conform-prep-"),w=t.tree.working.space==="DWG_COLORSPACE"&&t.tree.working.gamma==="DAV_INTER_OETF_GAMMA";w||c.push(`shot-to-shot consistency skipped: it measures in DaVinci Wide Gamut / Intermediate and your tree works in ${t.tree.working.space}/${t.tree.working.gamma}; step 1 (the AI balance) only`);let k=w&&l.length>1?{look_tree:{body_hex:t.tree.body_hex,balance_node:t.tree.balance_node,lut_roots:t.tree.lut_dirs??[],dctl_roots:t.tree.lut_dirs??[]},loma:M(y.model,"loma_b.safetensors"),eomt:M(y.model,"eomt_l_ade.safetensors"),face_models:y.model}:null,I=Y3(t.tree.working),x=M(b,"view_lut.npy");await Nt(x,G3(I));let S=await DP(y,k,void 0,x),R=0,$=!!k;try{let C=Y=>q3(Y,K3(o,Y).find(j=>j.key==="M").src,t.tree.working),L=l.slice(0,3).map(C),q=async Y=>{let j;try{j=await Y.ai}catch(Z){c.push(`${Y.s.name}: the AI balance failed, CST set, no balance: ${Z.message.slice(0,200)}`);return}let V=Y.s;if(V.knobs=j.values,V.raw=fO(V.knobs),V.step1=V.offset=V.knobs.offset.map(Z=>Z*Z3),$){let Z=j.ms;O.push(S.shot({id:V.item.id,take:V.path,family:V.colour.color_space??"unknown",date:"",tod:V.camFrame/V.fps,frame:V.npy,base:V.knobs}).then(Q=>{R++,Ke("CONFORM_PREP_TIMING")&&console.error(`prep-timing klein_ms ${Z} shot_ms ${Q} ${V.name}`)}).catch(Q=>{$&&c.push(`shot-to-shot consistency failed, step 1 only: ${Q.message.slice(0,300)}`),$=!1}))}},O=[],G=null,X=Ke("CONFORM_PREP_TIMING")?(Y,j)=>console.error(`prep-timing ${Y} ${Math.round(performance.now()-j)}`):()=>{};for(let[Y,j]of l.entries()){r(`balance ${Y+1}/${l.length}: ${j.name}`);let V=performance.now(),Z=await L.shift();if(X("decode_wait",V),V=performance.now(),Y+3<l.length&&L.push(C(l[Y+3])),!Z){c.push(`${j.name}: could not decode to its log here (raw developer missing); CST set, no balance`);continue}j.npy=M(b,`${j.item.id}.npy`),await Nt(j.npy,gO(Z));let Q={s:j,ai:S.step1(j.npy)};Q.ai.catch(()=>{}),X("npy_view",V),V=performance.now(),G&&await q(G),X("finish_prev",V),G=Q}G&&await q(G),await Promise.all(O);let ae=l.filter(Y=>Y.step1&&Y.npy);if($&&R>1){r(`shot-to-shot consistency (V7-1): matching and deciding over ${R} shots`);try{let Y=await S.finish();for(let V of ae){let Z=Y.shots[V.item.id];Z?.moved&&Z.values&&(V.raw=fO(Z.values),V.moved=!0)}c.push(`shot-to-shot consistency (V7-1): ${ae.filter(V=>V.moved).length} of ${ae.length} shots nudged (${Y.moves.length} moves, ${Y.reverted.length} undone by the no-harm check), fitted through your tree's look after the balance node`);let j=(t.tree.look_levels??[]).filter(V=>V!=="clip");j.length&&c.push(`your look also lives in ${j.join(", ")}: not evaluated yet (that needs the project export, .drp/.drt); the fit sees only the clip tree's part`),c.push(...Y.notes.slice(0,20))}catch(Y){c.push(`shot-to-shot consistency failed, step 1 only: ${Y.message.slice(0,300)}`)}}}finally{S.close(),await et(b).catch(()=>{})}}let u=[],d=(g,_,v)=>({timeline_id:o.id,item_id:g.item.id,entry:{id:"color-prep",kind:"tree",label:"Colour prep",enabled:!0,meta:{tree:t.tree.body_hex,balance_node:t.tree.balance_node,...t.tree.cst_node!=null?{cst_node:t.tree.cst_node,cst:{inputColorSpace:g.colour.color_space,inputGamma:g.colour.gamma,doInvOOTF:g.colour.kind==="display"?1:0}}:{},...v?{raw:v}:_?{printer:_}:{}}}});for(let g of n)u.push(g.colour.kind==="graphic"?{timeline_id:o.id,item_id:g.item.id,remove_id:"color-prep"}:d(g,g.offset,g.raw));for(let g of i){let _=(o.start_frame??0)+g.timeline_range.start.value+g.timeline_range.duration.value/2,v=n.find(k=>k.rec0<=_&&_<k.rec1),y=e.media_references.find(k=>k.id===g.media_reference_id),b=y?.local_path??y?.target_url?.replace(/^file:\/\//,"")??"",w=hO(t.answers,[g.name??"",B(b)])??a.get(b)??(b?await pO(b):null);!w||w.kind==="graphic"||w.kind==="unknown"||!w.confident||u.push(d({item:g,colour:w},v?.offset,v?.raw))}let f=g=>n.filter(_=>_.colour.kind===g).length,m=[...new Set(l.map(g=>`${g.colour.color_space}/${g.colour.gamma}`))];return{text:[`colour prep on ${o.name}: your tree "${t.tree.name}" (balance node ${t.tree.balance_node}, ${t.tree.cst_node!=null?`CST node ${t.tree.cst_node}`:"input CST outside the tree: not written, yours stays"}, working ${t.tree.working.space}/${t.tree.working.gamma})`,`${f("log")} log, ${f("display")} Rec.709-type, ${f("graphic")} graphics/stills left ungraded`,`input CSTs: ${m.join(", ")||"none"}`,...t.balance===!1?["balance: skipped (balance=false)"]:c,"nothing written yet: timeline_write target=resolve-drt writes the .drt (a separate file; the user's project is untouched)"].join(`
|
|
214
|
+
`),data:{shots:n.map(g=>({item:g.item.id,name:g.name,colour:g.colour,offset:g.offset,consistency:g.moved?g.raw:void 0}))},ops:u}}import{execFile as SO,execFileSync as RO,spawn as Q3}from"node:child_process";import{createServer as eU}from"node:http";import{open as tU,readdir as nU,stat as IO}from"node:fs/promises";import{basename as TO,join as rU,relative as oU}from"node:path";var fl=2048,iU=4<<20,wO=6e4,Nv=e=>e?e.direct?`direct (${e.addr}, ${e.rtt_ms} ms)`:`through a relay (${e.addr.replace(/^Relay\((.*)\)$/,"$1")}, ${e.rtt_ms} ms): slower`:"connecting";async function aU(){let e=vt()==="win32"?"i2o-transfer.exe":"i2o-transfer",t=[Ke("CONFORM_P2P"),jn(new URL(`./${e}`,import.meta.url)),jn(new URL(`../../native-host/i2o-transfer/target/release/${e}`,import.meta.url))].filter(Boolean);for(let r of t)if(await Zt(r))return r;return null}var sU=e=>Buffer.from(JSON.stringify(e)).toString("base64url");function Cn(e){let t=JSON.parse(Buffer.from(e.trim(),"base64url").toString());if(t.v!==1||!t.node_id||!Array.isArray(t.files))throw new Error("not a conform.tools peer-to-peer ticket");return t}async function PO(e,t){let r=await aU();if(!r)throw new Error("the peer-to-peer engine (i2o-transfer) is not installed");let o=Q3(r,[],{stdio:["pipe","pipe","pipe"]}),n="";o.stdout.on("data",a=>{n+=a.toString();for(let s;(s=n.indexOf(`
|
|
215
|
+
`))>=0;){let l=n.slice(0,s).trim();if(n=n.slice(s+1),l)try{t(JSON.parse(l))}catch{}}}),o.stderr.on("data",()=>{});let i=a=>o.stdin.write(JSON.stringify(a)+`
|
|
216
|
+
`);return i(e),{child:o,send:i,stop:()=>o.kill()}}async function AO(e){return(await IO(e)).isDirectory()?(await nU(e,{recursive:!0,withFileTypes:!0})).filter(r=>r.isFile()&&!r.name.startsWith(".")).map(r=>rU(r.parentPath,r.name)).sort().map(r=>({path:r,name:oU(e,r).split("\\").join("/")})):[{path:e,name:TO(e)}]}async function Fv(e,t={}){let r=f=>Promise.all(f.map(m=>typeof m=="string"?{path:m,name:TO(m)}:m).map(async m=>({...m,size:(await IO(m.path)).size}))),o=await r(e),n=Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("hex"),i=!1,a,s,l=new Promise(f=>{s=f}),c=async()=>{let f,m,p=new Promise((y,b)=>{f=y,m=b}),g=await PO({type:"start-sender",files:o,secret_key:n},y=>{y.type==="endpoint-ready"?f(sU({v:1,node_id:String(y.node_id),relay_url:y.relay_url??null,addrs:y.addrs??[],files:o.map(({name:b,size:w})=>({name:b,size:w})),...o.length===1&&/\.iso$/i.test(o[0].name)?{iso:!0}:{},...t.label?{label:t.label}:{}})):y.type==="path"?t.onPath?.(y):y.type==="error"&&!String(y.error).startsWith("[debug]")&&m(new Error(String(y.error)))});a=g;let _=!1;g.child.on("exit",y=>{if(i)return s();if(!_)return m(new Error(`peer-to-peer sender exited (${y}) before its endpoint was ready`));c().catch(()=>s())});let v=await p;return _=!0,v};return{ticket:await c(),stop:()=>{i=!0,a?.stop()},closed:l,add:async f=>{let m=(await r(f)).filter(p=>!o.some(g=>g.name===p.name));return m.length?(o.push(...m),a?.send({type:"add-sender-files",files:m}),m.length):0}}}var Cv=257,lU=4096,cU=2e4,kO=e=>{let t=[];for(let r of[...e].sort((o,n)=>o[0]-n[0])){let o=t[t.length-1];o&&r[0]<=o[1]?o[1]=Math.max(o[1],r[1]):t.push([r[0],r[1]])}return t},$O=(e,t,r)=>{let o=[],n=e;for(let[i,a]of r)if(!(a<=n)){if(i>=t)break;i>n&&o.push([n,i]),n=Math.max(n,a)}return n<t&&o.push([n,t]),o};async function Lv(e,t,r={}){let o=Cn(e),n=r.volume??"CONFORM_P2P",i=o.files.map(j=>({name:j.name,size:j.size})),a=await tU(t,"w+"),s=[],l=[],c=[],u=0,d=0,f=async j=>{for(let Z of j)c[Z]=u,u+=Math.ceil(i[Z].size/fl);let V;try{V=await Ys(i.map((Z,Q)=>({name:Z.name,totalSize:Z.size,fixedPartSector:c[Q]})),n)}catch(Z){throw new Error(`can't add ${j.length} more file(s) to this mount: ${Z.message}. Mount it again to see them`)}(await a.stat()).size<V.totalBytes&&await a.truncate(V.totalBytes);for(let Z of V.structuralRegions)await a.write(Z.data,0,Z.data.length,Z.sectorStart*fl);for(let Z of j)s[Z]=(Cv+c[Z])*fl;l.push({regions:V.structuralRegions,totalBytes:V.totalBytes,files:i.length})};if(o.iso)await a.truncate(i[0].size),s.push(0),l.push({regions:[],totalBytes:i[0].size,files:1});else{let j=await Ys(i.map(Z=>({name:Z.name,totalSize:Z.size})),n);u=2*(Math.min(j.totalSectors-1,...j.fileDataRegions.map(Z=>Z.sectorStart))-Cv)+lU,d=(Cv+u)*fl,await f(i.map((Z,Q)=>Q))}let m=()=>i.reduce((j,V)=>j+V.size,0),p=j=>[s[j],s[j]+i[j].size],g=[],_=(j,V,Z=i.length)=>{let Q=0;for(let ne=0;ne<Z;ne++){let[ye,Be]=p(ne),Ve=Math.max(ye,j),st=Math.min(Be,V);if(st>Ve)for(let[lt,H]of $O(Ve,st,g))Q+=H-lt}return Q},v=[],y=0,b,w=new Promise((j,V)=>{b=Z=>Z?V(Z):j()});m()===0&&b();let k=(j,V)=>{g=kO([...g,[j,V]]),y=m()-_(0,1/0),r.onProgress?.(y,m());for(let Z of[...v])_(Z.a,Z.b,Z.n)||(v.splice(v.indexOf(Z),1),Z.ready());y>=m()&&b()},I=!1,x,S=null,R=[],$=(j,V)=>{if(!x)return;let Z=Date.now();R=R.filter(([,,Q])=>Z-Q<cU);for(let[Q,ne]of $O(j,V,kO([...g,...R.map(([ye,Be])=>[ye,Be])])))x.send({type:"need-bytes",offset:Q,length:ne-Q}),R.push([Q,ne,Z])},C=(j,V,Z=i.length)=>_(j,V,Z)?new Promise((Q,ne)=>{let ye={a:j,b:V,n:Z,ready:()=>{clearTimeout(Be),Q()}},Be=setTimeout(()=>{v.splice(v.indexOf(ye),1),ne(new Error(`bytes ${j}-${V} didn't arrive in ${wO/1e3} s`))},wO);v.push(ye);for(let Ve=0;Ve<Z;Ve++){let[st,lt]=p(Ve),H=Math.max(st,j),oe=Math.min(lt,Math.max(V,j+iU));oe>H&&$(H,oe)}}):Promise.resolve(),E=eU((j,V)=>void L(j,V).catch(()=>{V.headersSent||(V.statusCode=503),V.end()})),L=async(j,V)=>{if(I)return V.writeHead(503).end();let Z=new URL(j.url??"/","http://x");if(j.method==="POST"){let st=Number(Z.searchParams.get("offset")),lt=[];for await(let oe of j)lt.push(oe);let H=Buffer.concat(lt);return await a.write(H,0,H.length,st),k(st,st+H.length),V.end("ok")}let Q=l[Number(/^\/disk(?:_v(\d+))?\.iso$/.exec(Z.pathname)?.[1]??(Z.pathname==="/disk.iso"?1:0))-1];if(!Q)return V.writeHead(404).end();let ne=/bytes=(\d+)-(\d*)/.exec(j.headers.range??""),ye=ne?Number(ne[1]):0,Be=ne&&ne[2]?Math.min(Number(ne[2])+1,Q.totalBytes):Q.totalBytes;if(j.method==="GET"&&await C(ye,Be,Q.files),V.writeHead(ne?206:200,{"Accept-Ranges":"bytes","Content-Length":Be-ye,...ne?{"Content-Range":`bytes ${ye}-${Be-1}/${Q.totalBytes}`}:{}}),j.method==="HEAD")return V.end();let Ve=Buffer.alloc(Be-ye);await a.read(Ve,0,Ve.length,ye),ye<d&&Ve.fill(0,0,Math.min(Be,d)-ye);for(let st of Q.regions){let lt=st.sectorStart*fl,H=Math.max(ye,lt),oe=Math.min(Be,lt+st.data.length);oe>H&&Ve.set(st.data.subarray(H-lt,oe-lt),H-ye)}V.end(Ve)};await new Promise(j=>E.listen(0,"127.0.0.1",j));let q=E.address().port,O=Promise.resolve(),G=j=>{o.iso||j.length<=i.length||i.some((V,Z)=>j[Z]?.name!==V.name)||(O=O.then(async()=>{let V=i.length;if(j.length<=V)return;i.push(...j.slice(V).map(Q=>({name:Q.name,size:Q.size})));let Z=i.map((Q,ne)=>ne).slice(V);await f(Z),x.send({type:"update-file-offsets",fileOffsets:s,fileSizes:i.map(Q=>Q.size),senderMapping:i.map((Q,ne)=>ne<V?-2:-3)}),r.onGrow?.(l.length,Z)}).catch(V=>{X=V.message}))},X=null;x=await PO({type:"start-receiver",http_port:q,iso_path:t,file_offsets:s,peer_node_id:o.node_id,peer_relay_url:o.relay_url,peer_addrs:o.addrs},j=>{j.type==="path"?S=j:j.type==="manifest"?G(j.files):j.type==="error"&&!String(j.error).startsWith("[debug]")&&b(new Error(String(j.error)))}),x.send({type:"volume-mounted"}),x.child.on("exit",j=>{!I&&y<m()&&b(new Error(`peer-to-peer receiver exited (${j}) with ${y} of ${m()} bytes`))});let ae=async()=>{if(I=!0,x&&x.child.exitCode===null){let j=new Promise(V=>x.child.once("exit",()=>V()));x.send({type:"cancel"}),await Promise.race([j,new Promise(V=>setTimeout(V,2e3))]),x.stop()}E.close(),await a.close()};w.catch(()=>{});let Y=`http://127.0.0.1:${q}`;return{t:o,files:i,offsets:s,done:w,close:ae,daemon:x,ensure:C,fh:a,ask:$,url:(j=1)=>`${Y}/${j===1?"disk":`disk_v${j}`}.iso`,get version(){return l.length},get size(){return l[l.length-1].totalBytes},get total(){return m()},get have(){return y},get path(){return S},get grewError(){return X}}}async function EO(e,t,r={}){let o=r.chunk??8388608,n,i=a=>{let[s,l]=[n.offsets[a],n.files[a]];for(let c=0;c<l.size;c+=o)n.ask(s+c,s+Math.min(c+o,l.size))};n=await Lv(e,t,{onProgress:r.onProgress,onGrow:(a,s)=>{n&&s.forEach(i)}}),r.signal?.addEventListener("abort",()=>void n.close());try{return n.files.forEach((a,s)=>i(s)),await n.done,{path:t,bytes:n.have,files:n.files.length}}finally{await n.close()}}var Dv=(e,t)=>new Promise((r,o)=>SO(e,t,(n,i,a)=>n?o(new Error(String(a||n.message).trim())):r(String(i)))),jv=e=>new Promise(t=>SO("/usr/bin/hdiutil",["detach",e,"-force"],t)),bm=new Map,xO=!1;function uU(e,t){if(bm.set(e,t),!xO){xO=!0,process.on("exit",()=>{for(let r of bm.values())for(let o of[...r].reverse())try{RO("/usr/bin/hdiutil",["detach",o,"-force"],{stdio:"ignore",timeout:5e3})}catch{}});for(let r of["SIGINT","SIGTERM","SIGHUP"])process.once(r,()=>process.exit(128+{SIGHUP:1,SIGINT:2,SIGTERM:15}[r]))}}async function dU(){let e;try{e=JSON.parse(RO("/bin/sh",["-c","/usr/bin/hdiutil info -plist | /usr/bin/plutil -convert json -o - -"],{encoding:"utf8",timeout:1e4}))}catch{return[]}let t=new Set([...bm.values()].flat()),r=[];for(let o of e.images??[]){let n=o["image-path"]??"";if(!/^http:\/\/127\.0\.0\.1:\d+\/disk(_v\d+)?\.iso$/.test(n))continue;let i=o["system-entities"]??[],a=i.find(c=>c["mount-point"])?.["mount-point"],s=i[0]?.["dev-entry"];!s||t.has(s)||await fetch(n,{method:"HEAD",signal:AbortSignal.timeout(1500)}).then(()=>!0,()=>!1)||(await jv(s),r.push(a??s))}return r}var mU=e=>e.normalize("NFKD").replace(/[^A-Za-z0-9_-]+/g,"_").replace(/^_+|_+$/g,"").slice(0,30)||"CONFORM_P2P";async function OO(e,t,r={}){if(vt()!=="darwin")throw new Error("live mount needs macOS (hdiutil attaches the image over HTTP); use p2p_receive elsewhere");await dU();let o=0,n="",i=null,a,s=[],l=new Promise(p=>{a=p}),c=async p=>{if(p<=o)return;let g=/\/dev\/disk\d+/.exec(await Dv("/usr/bin/hdiutil",["attach",u.url(p),"-nomount","-readonly","-noverify","-noautoopen"]))?.[0];if(!g)throw new Error("hdiutil attached nothing");try{await Dv("/sbin/mount",["-t","udf","-r","-o","nobrowse",g,n])}catch(_){throw await jv(g),_}s.push(g)},u=await Lv(e,t,{volume:mU(r.volume??"CONFORM_P2P"),onGrow:p=>{l=l.then(()=>c(p)).catch(g=>{i=`files added, but not shown: ${g.message}`})}});try{o=u.version;let p=await Dv("/usr/bin/hdiutil",["attach",u.url(o),"-readonly","-noverify","-noautoopen"]);n=p.trim().split(`
|
|
217
|
+
`).map(_=>_.split(" ").pop().trim()).filter(_=>_.startsWith("/")).pop()??"";let g=/\/dev\/disk\d+/.exec(p)?.[0];if(!n||!g)throw new Error(`hdiutil attached nothing: ${p}`);s.push(g)}catch(p){throw await u.close(),p}uU(n,s),a();let f={at:Date.now(),have:u.have},m=0;return{mountpoint:n,path:t,status:()=>{let p=Date.now();return p-f.at>=1e3&&(m=(u.have-f.have)/((p-f.at)/1e3),f={at:p,have:u.have}),{path:u.path,files:u.files.length,fetched:u.have,total:u.total,rate:m,error:u.grewError??i}},stop:async()=>{await l.catch(()=>{});for(let p of[...s].reverse())await jv(p);bm.delete(n),await u.close()}}}async function MO(e,t){if(!Cn(e).iso)throw new Error("this ticket serves files, not a delivery .iso \u2014 use mount, or receive it whole");let r=await Lv(e,t),o=r.size;return{read:async(n,i)=>{let a=Math.max(0,Math.min(i,o-n));await r.ensure(n,n+a);let s=new Uint8Array(a);return await r.fh.read(s,0,a,n),s},write:()=>Promise.reject(new Error("a peer's .iso is read-only")),getSize:async()=>o,size:()=>o,close:()=>r.close()}}var fU=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function zv(e){let t=e.trim();if(t.startsWith("bucket:"))return{kind:"bucket",session_id:t.slice(7)};if(fU.test(t))return{kind:"bucket",session_id:t};if(/\.iso$/i.test(t)||t.includes("/")||t.includes("\\"))return{kind:"file",path:Eo(t)};try{return Cn(t),{kind:"peer",ticket:t}}catch{}throw new Error(`"${e.slice(0,40)}\u2026" is not a .iso path, a bucket delivery (bucket:<id>) or a p2p_send ticket`)}async function Uv(e){let{files:t}=await rt("v1-sessions",`/v1/sessions/${e}/files`),r=t.find(o=>o.chunks?._format==="iso"&&o.chunks.b2FileName);if(!r)throw new Error(`delivery ${e} has no .iso in its bucket`);return r}async function ym(e,t){if(e.kind==="file")return Object.assign(await $o(e.path),{name:B(e.path)});if(e.kind==="peer"){let n=Cn(e.ticket);return Object.assign(await MO(e.ticket,M(t,n.files[0]?.name??"peer.iso")),{name:n.files[0]?.name??"peer.iso"})}let r=await Uv(e.session_id),o=da(e.session_id);return Object.assign(await D_(()=>o.readUrl(r.chunks.b2FileName)),{name:r.file_name})}async function pU(){let{storage:e}=await rt("v1-me","/v1/me/storage");if(!e)throw new Error("your org has no bucket set up \u2014 the org owner adds one on conform.tools (Settings \u2192 Storage) or PUT /v1/me/storage");return e}var CO=()=>M(he(),"bucket-index");async function hU(e,t,r=50){let{sessions:o}=await rt("v1-sessions",`/v1/sessions?limit=${r}`),n=[];await be(CO());let i=o.filter(a=>a.id!==t);return await Promise.all(Array.from({length:6},async()=>{for(let a=i.shift();a;a=i.shift())try{let l=(await Uv(a.id)).chunks;if(!l.blocksKey||l.bucket!==e)continue;let c=M(CO(),`${a.id}-${l.isoSize}.json`),u;try{u=JSON.parse(await _e(c))}catch{let d=await da(a.id).readUrl(l.blocksKey),f=await fetch(d);if(!f.ok)continue;u=await f.json(),await ge(c,JSON.stringify(u))}u.size===l.isoSize&&n.push({key:l.b2FileName,index:u})}catch{}})),n}async function DO(e,t,r){let o=await rt("v1-sessions",`/v1/sessions/${e}/storage/upload-url`,{body:{key:t,content_type:"application/json",content_length:r.length}}),n=await fetch(o.upload_url,{method:o.method,headers:o.headers,body:r});if(!n.ok)throw new Error(`saving ${t}: ${n.status} ${(await n.text()).slice(0,200)}`)}async function jO(e,t,r){let o=await sP(t,r);o.timelines.length&&await rt("v1-sessions",`/v1/sessions/${e}/contents`,{body:{projects:[],timelines:o.timelines,media:o.media,delivery_intent:{format:"folder",folder_layout:"canonical-i2o",per_file_mode:{mode:"trim"},handles:o.handles}}})}async function NO(e,t={}){let r=await pU(),o=await $o(e),n=dw(e);try{let i=await Fn(o),a=B(e);t.onProgress?.(0,o.size(),"indexing the image");let s=0,l=await Rm(o,i,o.size(),y=>t.onProgress?.(s+=y,o.size(),"indexing the image")),{session:c}=await rt("v1-sessions","/v1/sessions",{body:{destination:"b2",storage:"org",status:"ready",label:t.label??a.replace(/\.iso$/i,""),...t.recipients?.length?{recipient_emails:t.recipients}:{}}}),u=c.id,d=`sessions/${u}/${a}`,f=t.dedupe===!1?[]:await hU(r.bucket,u),m=uw(l,f),p=Sm(o.size(),m),g=(t.bucket??da)(u),_=await Im(g,d,p,n.read,{onProgress:(y,b)=>t.onProgress?.(y,b,"uploading"),signal:t.signal}),v=`${d}.blocks.json`;return await DO(u,v,new TextEncoder().encode(JSON.stringify(l))),await rt("v1-sessions",`/v1/sessions/${u}/files`,{body:{files:[{file_name:a,file_size:o.size(),status:"completed",chunks:{_format:"iso",b2FileName:d,isoSize:o.size(),blocksKey:v,bucket:r.bucket,files:i.files.filter(y=>!y.name.startsWith(`${Ir}/`)).map(y=>({name:y.name,size:y.totalSize}))}}]}}),await jO(u,o,i),await rt("v1-sessions",`/v1/sessions/${u}`,{method:"PATCH",body:{status:"completed"}}),{session_id:u,key:d,image:o.size(),uploaded:_.uploaded,copied:_.copied,reused_from:new Set(m.map(y=>y.key)).size}}finally{await n.close(),await o.close()}}async function FO(e,t,r={}){if(e.kind==="peer")throw new Error("a peer's delivery is read-only \u2014 add_to a .iso on disk or a bucket delivery");if(e.kind==="file"){let u=await N_(e.path,t),d=await $o(e.path),f=d.size();return await d.close(),{...u,image:f}}let o=e.session_id,n=await Uv(o),i=n.chunks.b2FileName,a=(r.bucket??da)(o),s=await D_(()=>a.readUrl(i)),l=await nt("conform-grow-"),c=await cP(s,M(l,"overlay"));try{r.onProgress?.(0,0,"patching");let u=await N_(c,t);if(!c.writes().length)return{...u,uploaded:0,copied:0,image:s.size()};let d=Sm(c.size(),cw(i,s.size(),c.size(),c.writes())),f=await Im(a,i,d,c.read,{onProgress:(b,w)=>r.onProgress?.(b,w,"writing back"),signal:r.signal}),m=await Fn(c),p=n.chunks.blocksKey?await fetch(await a.readUrl(n.chunks.blocksKey)).then(b=>b.ok?b.json():null).catch(()=>null):null,g=new Map((p?.blocks??[]).map(b=>[`${b[1]}:${b[2]}`,b])),_=(b,w)=>c.writes().some(k=>k.offset<b+w&&k.offset+k.length>b),{blocks:v}=await Rm(c,m,c.size(),void 0,(b,w)=>_(b,w)?void 0:g.get(`${b}:${w}`)),y={v:1,block:lw,size:c.size(),blocks:v};return n.chunks.blocksKey&&await DO(o,n.chunks.blocksKey,new TextEncoder().encode(JSON.stringify(y))),await rt("v1-sessions",`/v1/sessions/${o}/files/${n.id}`,{method:"PATCH",body:{bytes_uploaded:c.size(),chunks:{...n.chunks,isoSize:c.size(),files:m.files.filter(b=>!b.name.startsWith(`${Ir}/`)).map(b=>({name:b.name,size:b.totalSize}))}}}),await jO(o,c,m),{...u,uploaded:f.uploaded,copied:f.copied,image:c.size()}}finally{await c.close(),await et(l)}}async function LO(e,t){if(e.kind==="peer"){let n=Cn(e.ticket),i=await OO(e.ticket,M(t,n.iso?B(n.files[0].name):"shared.iso"),{volume:n.label});return{mountpoint:i.mountpoint,stop:i.stop,status:i.status}}let r=await ym(e,t),o=await uP(r);try{let n=await dP(o.url);return{mountpoint:n.mountpoint,stop:async()=>{await n.detach(),await o.close(),await r.close()}}}catch(n){throw await o.close(),await r.close(),n}}async function zO(e,t,r,o,n){if(await be(ft(t)),e.kind==="peer")return(await EO(e.ticket,t,{onProgress:(a,s)=>o?.(a,s,"receiving"),signal:n})).bytes;let i=await ym(e,r);try{return await mP(i,t,(a,s)=>o?.(a,s,"downloading"),n)}finally{await i.close()}}var UO={resolve:["resolve-drt","drt"],premiere:["premiere-prproj","prproj"],avid:["avid-avb","avb"],flame:["flame-fcpxml","fcpxml"],nuke:["resolve-xmeml","xml"]},BO=["summary","flags","link"],gU=[{name:"account_login",title:"Sign in to conform.tools",description:"Sign in with the Google account you use on conform.tools. Opens the browser to the sign-in page and waits (up to 5 minutes) until it completes, then reports the plan. Needed once per machine; every other verb except timeline_routes and the account verbs requires a signed-in account with an active trial or subscription.",inputSchema:{},run:async()=>{let e="",t=await ew({onUrl:(r,o)=>{e=o?"":r,o||console.error(`open this URL to sign in: ${r}`)}});return z(`signed in
|
|
218
|
+
${$m(t)}${e?`
|
|
219
|
+
(sign-in URL: ${e})`:""}`,{account:t})}},{name:"account_status",title:"Account and plan",description:"The running conformtools version (and whether a newer one is on npm), who is signed in on this machine, and whether the account's trial or subscription is active (checked live against conform.tools, with a 72-hour offline grace).",inputSchema:{},run:async()=>{let[e,t]=await Promise.all([bl({force:!0}),qv()]);return z(`${await Xv()}
|
|
220
|
+
${$m(e)}`,{account:e,version:Nn,latest_version:t})}},{name:"account_logout",title:"Sign out",description:"Forget this machine's conform.tools sign-in.",inputSchema:{},run:async()=>(await tw(),z(`signed out (${qt().env})`,{signed_in:!1}))},{name:"account_telemetry",title:"Outcome telemetry on / off",description:"Turn the optional outcome telemetry on or off, or show its state (action=status, the default). It is OFF unless the user turns it on. When on it records, per tool run, the tool name, ok or the error code, duration, package version, engine mode and counts (numbers only), and per rejected call the tool name and the names of the failing arguments; never paths, file or clip names, timeline contents or media. Only change it when the user asks. Same as `conformtools telemetry on|off|status`.",inputSchema:{action:h.enum(["on","off","status"]).default("status")},run:async({action:e})=>((e==="on"||e==="off")&&await II(e==="on"),z(await TI(),{telemetry:await Ui()}))},{name:"conform_learn",title:"Load the conform.tools playbook for a task",description:`Call this FIRST, before any conform, timeline conversion, relink, verification or delivery task, and follow what it returns: the conform.tools playbook for the task (the order a conform artist works in, what to check, how to tell the user). task = conform (a turnover, timeline conversion, relink, online/offline conform, "is this conform right?") | autoconform (rebuild an edit from a reference render + source media) | deliver (consolidate, media manage, package or QC a turnover for the next facility) | deliverables (render and QC a finished program's deliverables: the usual set, naming, pre-render gate, audio routing, sign-off) | troubleshoot (a conformtools result looks wrong) | patch (fix a show already delivered: temps left in, replace with masters, insert timelines, patch renders and their QC). hosts = the editing systems involved, which adds their notes. Once per task per conversation is enough. Needs a signed-in account (account_login).`,inputSchema:{task:h.enum(Ny).describe(Ny.join(" | ")),hosts:h.array(h.enum(Fy)).max(Fy.length).optional().describe("The editing systems involved, source and target")},run:async({task:e,hosts:t})=>{try{let r=await GR(e,t??[]);return z(r.text)}catch(r){return D(new P("refused",`the playbook could not be loaded: ${r instanceof Error?r.message:String(r)}. Carry on with the tools; their descriptions still apply.`))}}},{name:"report_issue",hidden:!0,title:"Report a problem with a conformtools result",description:'Send the conform.tools team a problem report. Call it when the user says a conformtools result is wrong, complains about it, corrects an output ("that clip should be at 01:00:10:00", "the relink picked the proxy"), or when a tool failed unexpectedly. Give a short summary, what happened, what they expected, and the session_id / verb / job_id involved. It attaches the package version, engine mode, OS and runtime, the signed-in account, and the last 20 engine log lines for that session/job with paths cut to file names. It never sends media, file contents or timeline files. Tell the user it was sent and give the report id.',inputSchema:{summary:h.string().min(3).describe(`One line: what is wrong (max ${Ye.summary} chars; longer is cut)`),what_happened:h.string().optional().describe(`What the tool did or returned (max ${Ye.what_happened} chars; longer is cut)`),expected:h.string().optional().describe(`What the user expected instead (max ${Ye.expected} chars; longer is cut)`),session_id:h.string().optional().describe("The session involved, if any"),verb:h.string().optional().describe("The tool that produced the wrong result, e.g. timeline_write"),job_id:h.string().optional().describe("The background job involved, if any"),severity:h.enum(bd).default("medium").describe("blocker = the user cannot continue")},run:async e=>{try{let t=await Bs("issue",e),r=await Vs(t);return Zs("issue",r,t,e)}catch(t){return D(t)}}},{name:"report_gap",hidden:!0,title:"Report a task done without conformtools",description:`Tell the conform.tools team which post-production task needed something other than conformtools, so the missing tool gets built. Call it once per task whenever you use ffmpeg, ffprobe, mediainfo, exiftool, a python or shell script, another MCP server, or manual steps in a host app for a timeline / media / conform / delivery task, or when conformtools cannot do the task at all; before or right after the workaround. task = what the user wanted; used_instead = the tool or command (e.g. "ffprobe -show_streams"); why_not_conformtools = missing_tool | missing_option | tool_failed | did_not_know; needed = what you needed from it and which output fields you used, so the team can build it in. File names at most, never full paths; never file contents or values from the user's media. Tell the user you sent it.`,inputSchema:{task:h.string().min(3).describe(`What the user wanted done (max ${Ye.task} chars; longer is cut)`),used_instead:h.string().optional().describe(`The tool, command or manual step used instead (max ${Ye.used_instead} chars; longer is cut)`),why_not_conformtools:h.enum(yd).optional().describe("missing_tool: no tool for it; missing_option: a tool exists but lacks the option; tool_failed; did_not_know: a conformtools tool exists but was not used"),conformtools_verb_tried:h.string().optional().describe("The conformtools tool tried first, if any"),needed:h.string().max(2e3).optional().describe(`What you needed from the other tool, so it can be built into conformtools: the information or operation, and which of its output fields you actually used (e.g. "per-stream start timecode and audio channel layout of a MOV: ffprobe streams[].tags.timecode, channel_layout"). Field names and the kind of value, never values from the user's media`),session_id:h.string().optional()},run:async({needed:e,...t})=>{try{let r=await Bs("gap",{...t,...e?{expected:e}:{}}),o=await Vs(r);return Zs("gap",o,r,t)}catch(r){return D(r)}}},{name:"report_note",hidden:!0,title:"Send a playbook note or suggestion",description:`Send the conform.tools team a lesson, workflow rule or suggestion when nothing broke: something the playbooks should teach ("a patch runs from the whole clip before to the whole clip after", "this facility files patch renders in 200 - FINISH/<date>", "never match archival by file name alone") or an idea for the tools. Use report kind=issue for a wrong result and kind=gap for a task done with another tool. File names at most, never full paths or values from the user's media. Tell the user you sent it.`,inputSchema:{note:h.string().min(3).describe(`One line: the lesson or suggestion (max ${Ye.summary} chars; longer is cut)`),detail:h.string().optional().describe(`Why, when it applies, what went wrong without it (max ${Ye.what_happened} chars; longer is cut)`),topic:h.enum(["playbook","suggestion"]).default("playbook").describe("playbook = how the work should be done; suggestion = an idea for conformtools"),session_id:h.string().optional(),verb:h.string().optional().describe("The tool it is about, if any")},run:async({note:e,detail:t,topic:r,...o})=>{try{let n={...o,summary:`[${r??"playbook"}] ${e}`,...t?{what_happened:t}:{}},i=await Bs("note",n),a=await Vs(i);return Zs("note",a,i,n)}catch(n){return D(n)}}},{name:"report",title:"Report a problem, a tool gap or a note to conform.tools",description:`Send the conform.tools team a report; tell the user it was sent and give the report id. Never sends media, file contents or timeline files; file names at most, never full paths or values from the user's media.
|
|
221
|
+
kind=issue: the user says a conformtools result is wrong, complains, corrects an output ("that clip should be at 01:00:10:00", "the relink picked the proxy"), or a tool failed unexpectedly. summary, detail (what happened), expected, and the session_id / verb / job_id involved. Attaches the package version, engine mode, OS, the signed-in account and the last 20 engine log lines for that session/job, paths cut to file names.
|
|
222
|
+
kind=gap: a timeline / media / conform / delivery task needed something other than conformtools (ffmpeg, ffprobe, mediainfo, exiftool, a script, another MCP server, manual host steps) or could not be done at all; once per task, before or right after the workaround. summary = what the user wanted; used_instead; why_not_conformtools; expected = what you needed from it and which output fields you used, so it gets built in.
|
|
223
|
+
kind=note: a lesson, workflow rule or suggestion when nothing broke ("a patch runs from the whole clip before to the whole clip after", "never match archival by file name alone"). summary = the lesson; detail = why and when it applies; topic.`,inputSchema:{kind:h.enum(["issue","gap","note"]),summary:h.string().min(3).describe(`One line: issue = what is wrong (max ${Ye.summary} chars); gap = the task the user wanted (max ${Ye.task}); note = the lesson or suggestion (max ${Ye.summary}). Longer is cut`),detail:h.string().optional().describe(`issue: what the tool did or returned; note: why, when it applies (max ${Ye.what_happened} chars)`),expected:h.string().optional().describe(`issue: what the user expected instead; gap: what you needed from the other tool and which of its output fields you used (e.g. "per-stream start timecode of a MOV: ffprobe streams[].tags.timecode"), field names never values (max ${Ye.expected} chars)`),used_instead:h.string().optional().describe(`gap: the tool, command or manual step used instead (max ${Ye.used_instead} chars)`),why_not_conformtools:h.enum(yd).optional().describe("gap: missing_tool | missing_option (a tool lacks the option) | tool_failed | did_not_know (a conformtools tool exists but was not used)"),conformtools_verb_tried:h.string().optional().describe("gap: the conformtools tool tried first, if any"),severity:h.enum(bd).optional().describe("issue: blocker = the user cannot continue (default medium)"),topic:h.enum(["playbook","suggestion"]).optional().describe("note: playbook = how the work should be done (default); suggestion = an idea for conformtools"),session_id:h.string().optional(),verb:h.string().optional().describe("The tool it is about, e.g. timeline_write"),job_id:h.string().optional()},run:async({kind:e,summary:t,detail:r,topic:o,severity:n,...i})=>{try{let a=e==="gap"?{...i,task:t}:{...i,summary:e==="note"?`[${o??"playbook"}] ${t}`:t,...r?{what_happened:r}:{},...e==="issue"?{severity:n??"medium"}:{}},s=await Bs(e,a);return Zs(e,await Vs(s),s,a)}catch(a){return D(a)}}},{name:"timeline_read",protectedStages:["canonicalize"],title:"Read a timeline file",description:"Read an editorial timeline file (Avid AAF/AVB bin, Premiere .prproj, Resolve .drt, Final Cut .fcpxml/.fcpxmld or a project's own CurrentVersion.fcpevent inside a library, FCP7 XML, OTIO, Flame archive) into a session on this machine. Nothing is uploaded. Returns a session_id to pass to the other timeline_* tools, plus a summary (rates, raster, tracks, clip counts, media link state, conform flags). Call this first for any request that mentions a cut, sequence, bin, timeline or conform.",inputSchema:{engine:h.enum(["local","hosted"]).optional().describe("Where the conversion runs: local = this machine, offline, nothing uploaded; hosted = conform.tools (the website's engine). Default: local when this build has it"),path:h.string().describe("Absolute path to the timeline file (or .fcpxmld bundle directory)"),format:h.enum(S0).optional().describe("Override format detection (needed for Flame archives, which have no fixed extension)")},run:async({path:e,format:t})=>{try{let{session:r,format:o,sourcePath:n,notes:i}=await Oo(e,t),a=await Xt(r,n??e,o);return Ae(`session_id: ${a.id}
|
|
224
|
+
source: ${e} (${o})
|
|
225
|
+
${(i??[]).map(s=>`note: ${s}
|
|
226
|
+
`).join("")}${await Un(r)}`)}catch(r){return D(r)}}},{name:"host_current",protectedStages:["canonicalize"],title:"What is open in Resolve / Premiere / Media Composer / Flame / Nuke Studio / Final Cut",description:`Find the project and timeline each editing host on this machine has open right now \u2014 no host API, no export dialog \u2014 and read it into a session as if its file had been given to timeline_read. Resolve (Studio): the timeline in the viewer, exported by Resolve itself as its own .drt (its project database is never read). Premiere: the project window's .prproj and the sequences open in its Timeline panel (last save). Media Composer: the open project's bins (newest first; the loaded sequence is not on disk). Flame: the running project/workspace's live workspace file (every sequence on the desktop). Nuke Studio / Hiero: running, and its .hrox when the OS shows it (timelines come through its panel: host_current via=export). Final Cut: the project in the Timeline, decoded from its own store in the open library (CurrentVersion.fcpevent \u2192 FCPXML; effects, titles and the like come back as conform flags). via=export (or a timeline / out_path) asks the running host to export a timeline itself through its scripting door (read-only on the project) and reads that: Resolve any timeline of the open project by name as its own .drt; Baselight a scene (default the open one, or "host:job:scene") through FLAPI; Premiere, Media Composer, Flame, Nuke Studio through the conform.tools plugin (host_setup says how to install it). Use it when the open timeline is not readable from disk (a PostgreSQL project library, a timeline never saved) or to pick one by name; the reply carries project, timeline, path and session_id. Use when asked 'what do I have open', 'grab my current timeline', 'the sequence I'm working on', or to act on the open cut.`,inputSchema:{host:h.enum(at).optional().describe("One host; omit for all"),read:h.boolean().default(!0).describe("Also read the open timeline into a session (session_id in the reply)"),via:h.enum(["disk","export"]).default("disk").describe("disk: what the host has on disk, no host API; export: the running host exports the timeline itself (needs host)"),timeline:h.string().optional().describe("Timeline name to export (implies via=export); default the open one"),out_path:h.string().optional().describe("via=export: where to write the file; a temp file when omitted")},run:async({host:e,read:t,via:r,timeline:o,out_path:n})=>{if(r==="export"||o||n)return e?an("host_export").run({host:e,timeline:o,out_path:n,read:t}):D(new P("invalid_args","via=export needs host"));try{let a=await WI(e?[e]:void 0,void 0,t?async(l,c)=>{try{let{session:u}=await Oo(l,c);return u.timelines.some(d=>d.tracks?.some(f=>f.items?.length))}catch{return!1}}:void 0),s=[];for(let l of a){let c=JI(l);if(t&&l.read)try{let{session:u,format:d,sourcePath:f,notes:m}=await Oo(l.read.path,l.read.format);HI(u,l);let p=await Xt(u,f??l.read.path,d);c+=`${(m??[]).map(g=>`
|
|
227
|
+
note: ${g}`).join("")}
|
|
228
|
+
session_id: ${p.id}
|
|
229
|
+
${(await Un(u)).replace(/^/gm," ")}`}catch(u){c+=`
|
|
230
|
+
read failed: ${u instanceof Error?u.message:String(u)}`}s.push(c)}return Ae(s.join(`
|
|
231
|
+
|
|
232
|
+
`))}catch(i){return D(i)}}},{name:"host_export",hidden:!0,protectedStages:["canonicalize"],title:"Export a timeline from the running host",description:`Ask the running host to export a timeline in its own format, through its scripting door (read-only on the project), and read it into a session. Resolve: any timeline of the open project by name (default: the one in the viewer) as Resolve's own .drt. Baselight: a scene (default: the one open in the app; or "host:job:scene") read shot by shot through FLAPI into an OTIO. Premiere, Media Composer, Flame, Nuke Studio: through the conform.tools plugin in the host (host_setup says how to install it), as OTIO (Premiere / Media Composer: the host's own export; Flame / Nuke: the timeline as the plugin reads it). Use when host_current cannot read the open timeline from disk (a PostgreSQL project library, a timeline never saved), or to pick a timeline by name.`,inputSchema:{host:h.enum(at).describe("The host to export from"),timeline:h.string().optional().describe("Timeline name; the open one when omitted"),out_path:h.string().optional().describe("Where to write the file; a temp file when omitted"),read:h.boolean().default(!0).describe("Also read it into a session (session_id in the reply)")},run:async({host:e,timeline:t,out_path:r,read:o})=>{try{if(e==="premiere"&&!r&&o!==!1){let{premiereSession:l}=await import("./host-relink-D6CB2VOQ.js"),c=wt("premiere"),u=await l(c,t).catch(d=>{if(d.code==="panel_old")return null;throw d});if(u){let d=await Xt(u.session,u.path,/\.otio$/i.test(u.path)?"otio":"prproj"),f=await c.current(),m=u.session.timelines[0]?.name??t??f.timeline;return z([`read ${f.project} / ${m} from ${u.from}`,...u.lossy?[`\u26A0 ${u.lossy}`]:[],`session_id: ${d.id}`,await Un(u.session)].join(`
|
|
233
|
+
`),{path:u.path,format:/\.otio$/i.test(u.path)?"otio":"prproj",project:f.project,timeline:m,session_id:d.id,from:u.from})}}let n=r??M(await nt("conform-export-"),`${(t??"current").replace(/[^\w.-]+/g,"_")}.${e==="resolve"?"drt":"otio"}`),i=await wt(e).export({timeline:t,out_path:n}),a=[`exported ${i.project} / ${i.timeline} \u2192 ${i.path} (${i.format})`,...(i.notes??[]).map(l=>`\u26A0 ${l}`)].join(`
|
|
234
|
+
`),s={...i};if(o!==!1){let{session:l,format:c}=await Oo(i.path,i.format);e==="resolve"&&await(await import("./host-relink-D6CB2VOQ.js")).withOfflineReference(wt("resolve"),l).catch(()=>0),e==="premiere"&&await(await import("./host-relink-D6CB2VOQ.js")).withPremiereTimecodes(wt("premiere"),l).catch(()=>0);let u=await Xt(l,i.path,c);a+=`
|
|
235
|
+
session_id: ${u.id}
|
|
236
|
+
${await Un(l)}`,s.session_id=u.id}return z(a,s)}catch(n){return D(new P("refused",n instanceof Error?n.message:String(n)))}}},{name:"host_open",protectedStages:["write"],title:"Open a timeline file in the running host",description:`Import a timeline file into the running host as a NEW timeline (never overwrites one; a taken name gets a number). Resolve: into the open project's conform.tools media pool folder (into=current, the default), or into our scratch project (into=scratch: the user's project is saved first, then reopened). Baselight: a NEW scene in the open scene's job (into=current) or our job conform_tools (into=scratch), V1 built shot by shot from the file's media paths, saved; the scene in the app is never touched. folder (Resolve): the media pool folder to land it in, by path under Master, e.g. "000 - TIMELINES/20261006" (learn the project's layout with host_project first); a missing folder is refused unless create_folder=true. link_existing=true links the timeline to clips already in the media pool (no duplicate clips; Resolve importSourceClips off): the way to bring an insert/update timeline into a project that has the media. The user's timeline, folder and page are put back afterwards unless stay=true. Use after timeline_write to land a conversion in the host, or to bring a turnover in for checking. Premiere, Media Composer, Flame, Nuke Studio: through the host's conform.tools plugin, into the open project (Flame: the CONFORM.TOOLS reel group on the desktop, segments relinked to media on disk). session_id (+ timeline_id) opens a session's timeline directly \u2014 the push half of a Resolve tool: host_current via=export \u2192 timeline_edit add_handles / all_clips \u2192 host_open session_id timeline_id link_existing=true.`,inputSchema:{host:h.enum(at).describe("The host to open it in"),path:h.string().optional().describe("The timeline file (Resolve: .drt, .xml, .fcpxml, .aaf, .edl, .otio); or give session_id"),session_id:h.string().optional().describe("Open a timeline of this session instead of a file (written here first in the host's own format: .drt Resolve, .prproj Premiere, .avb Media Composer, .fcpxml Flame, FCP7 .xml Nuke Studio)"),timeline_id:h.string().optional().describe("With session_id: which timeline (e.g. the one timeline_edit just built); default the session's first"),name:h.string().optional().describe("Timeline name; the file name (or the session timeline's name) when omitted"),into:h.enum(["current","scratch"]).default("current").describe("current: the open project; scratch: our own project"),media_dirs:h.array(h.string()).optional().describe("Folders to link media from while importing"),stay:h.boolean().default(!1).describe("Leave the host showing the imported timeline"),folder:h.string().optional().describe('Resolve: media pool folder path to import into, e.g. "000 - TIMELINES/20261006" (default: conform.tools)'),create_folder:h.boolean().default(!1).describe("Create the folder (and its parents) when missing"),link_existing:h.boolean().default(!1).describe("Link to clips already in the media pool instead of importing new ones")},run:async({host:e,path:t,session_id:r,timeline_id:o,name:n,into:i,media_dirs:a,stay:s,folder:l,create_folder:c,link_existing:u})=>{try{if(r){let m=await Fe(r),p=m.session.timelines.find(b=>b.id===o)??m.session.timelines.find(b=>b.kind!=="compound");if(!p)return D(new P("not_found",`no timeline ${o??""} in session ${r}`));let g={...m.session,timelines:m.session.timelines.filter(b=>b.id===p.id||b.kind==="compound")},[_,v]=UO[e]??UO.resolve;t=(await Dm(g,_,M(await nt("conform-open-"),`${p.name.replace(/[^\w.-]+/g,"_")}.${v}`),m.source_path)).path,n??=p.name}if(!t)return D(new P("invalid_args","host_open needs path or session_id"));let d=await wt(e).open({path:t,name:n,into:i,media_dirs:a,stay:s,folder:l,create_folder:c,link_existing:u}),f=[`opened in ${e}: ${d.project} / ${d.timeline}${d.folder?` (media pool: ${d.folder})`:""}`,d.restored?"the user's timeline, folder and page were put back":"left showing the imported timeline",...u?["linked to clips already in the media pool (no new clips imported)"]:[],...d.notes];return z(f.join(`
|
|
237
|
+
`),{...d})}catch(d){return D(new P("refused",d instanceof Error?d.message:String(d)))}}},{name:"host_render",long:!0,title:"Render a timeline in the running host (optionally through the renderplugin)",description:`Render a timeline (or a frame range of it) with the host's own renderer and wait for the files. Only OUR job is queued and started; the user's render queue is never run, their Deliver settings are restored as soon as our job is queued, and their timeline and page come back when it finishes. Refuses while the host is already rendering. Resolve: preset = a render preset saved in Resolve (default: the project's current render settings); range = absolute timeline frames, inclusive; name = the output file name. Baselight: timeline = a scene (default: the one open in the app), preset = a deliverable defined in the scene (default: ProRes 422 HQ of the working space), queued on the local render queue as "conform.tools <name>". Premiere: preset = the path of a Media Encoder .epr. Flame (through its conform.tools hook): preset = one of Flame's export presets by name (required), range as Resolve's; Flame renders in the foreground and a running export cannot be cancelled from here. Picture only unless audio=true. audio_tracks (Resolve) = the Deliver page's audio output routing by timeline track, which its API cannot set: [1, 2] = A1 (5.1) on ch1-6 + A2 (stereo) on ch7-8 (an 8CH_5-1_STEREO deliverable), [2] = stereo only; set it whenever a name promises a channel layout. disable_tracks = video tracks to leave out of this render, by name (every track so named, e.g. ["Lower Thirds"] for a TEXTLESS version) or "V7": Resolve's API has no per-job track selection, so they are switched off on the Edit page (read back) for our job and switched back on when it ends. Resolve names the queued job itself ("Job N"); its API cannot. renderplugin=true (Resolve): render through the conform.tools renderplugin instead, which measures EVERY frame after grading and compositing, and return findings: black edges (blanking) per range with the clip and edge, black frames, failed/warned checks (clipping, freeze/flash, dead pixels, leader/slate), audio loudness and peak; markers go on the timeline (ours, tagged; a re-run replaces them, nobody else's are touched). The throwaway render is deleted unless keep_render. strictness: strict (1 px, 1 frame; default) | standard | relaxed. expected_aspect: the delivered ratio when bars are part of the deliverable (2.39 in UHD, 1.85 in DCI). Use for finishing QC ('check this timeline for black edges', 'QC the master before it goes'). Long: pass background=true for a job id, then job action=status.`,inputSchema:{host:h.enum(at).describe("The host to render in"),timeline:h.string().optional().describe("Timeline name; the open one when omitted"),target_dir:h.string().optional().describe("Folder for the render (required unless renderplugin=true); created if missing"),name:h.string().optional().describe("Output name without extension; the timeline name when omitted"),preset:h.string().optional().describe("A render preset saved in the host"),range:h.object({in:h.number().int(),out:h.number().int()}).optional().describe("Frame range, absolute timeline frames, inclusive"),audio:h.boolean().optional().describe("Render audio with the picture (default: off = picture only; on for renderplugin)"),disable_tracks:h.array(h.string()).optional().describe('Video tracks to leave out of this render, by name or "V7" (e.g. ["Lower Thirds"] for TEXTLESS)'),audio_tracks:h.array(h.number().int().positive()).optional().describe("Resolve: audio output n = timeline track audio_tracks[n], e.g. [1, 2] = 5.1 (A1) on ch1-6 + stereo (A2) on ch7-8; [2] = stereo only. Implies audio"),renderplugin:h.boolean().default(!1).describe("Resolve: render through the conform.tools renderplugin and return QC findings"),strictness:h.enum(Object.keys(ma)).optional().describe("renderplugin: strict (default) | standard | relaxed"),expected_aspect:h.number().positive().optional().describe("renderplugin: delivered aspect ratio when bars are expected, e.g. 2.39"),markers:h.boolean().default(!0).describe("renderplugin: place markers on the findings"),keep_render:h.boolean().default(!1).describe("renderplugin: keep the throwaway ProRes render"),ignore_space:h.boolean().default(!1).describe("renderplugin: skip the free-space check")},run:async({host:e,timeline:t,target_dir:r,name:o,preset:n,range:i,audio:a,disable_tracks:s,audio_tracks:l,renderplugin:c,strictness:u,expected_aspect:d,markers:f,keep_render:m,ignore_space:p,__progress:g,__signal:_})=>{let v=wt(e);try{if(c){if(e!=="resolve")return D(new P("unsupported","the renderplugin is a DaVinci Resolve plugin"));let w=await yE(v,ga,{timeline:t,range:i,strictness:u,expected_aspect:d,markers:f,keep_render:m,ignore_space:p,audio:a},g,_);return z(_E(w),{...w})}if(!r)return D(new P("invalid_args","target_dir is required (unless renderplugin=true)"));if(l?.length&&e!=="resolve")return D(new P("unsupported","audio_tracks (output routing) is for DaVinci Resolve"));let y=await v.renderStart({timeline:t,target_dir:r,name:o,preset:n,range:i,audio:(a??!1)||!!l?.length,...s?.length?{disable_tracks:s}:{},...l?.length?{audio_tracks:l}:{}});if(y=await mv(v,y,g,_),y.state!=="complete")return D(new P(y.state==="cancelled"?"cancelled":"engine",`render ${y.state}${y.error?`: ${y.error}`:""}${y.notes?.length?`; ${y.notes.join("; ")}`:""}`));let b=y.outputs?.length?y.outputs:await q0(r,o??t??"");return z([`rendered in ${e} \u2192 ${b.join(", ")||r}${a||l?.length?"":" (picture only)"}`,...s?.length?[`without video tracks: ${s.join(", ")}`]:[],...l?.length?[`audio outputs: ${l.map((w,k)=>`${k+1} = timeline track ${w}`).join(", ")} \u2014 probe the file to confirm the channel layout`]:[],"the user's render settings, timeline and page were put back",`${e} render queue job ${y.job_id} (the host's own id, kept in its queue \u2014 not a conform.tools job id)`,...y.notes??[]].join(`
|
|
238
|
+
`),{host_render_job:y.job_id,outputs:b,...y.notes?{notes:y.notes}:{}})}catch(y){return D(new P("refused",y instanceof Error?y.message:String(y)))}}},{name:"host_preset",title:"Read or author host render presets (incl. audio output routing)",description:"Resolve render presets. action=list: every preset (or names) with its container, codec, raster, audio codec and the Deliver page's audio OUTPUT routing (Timeline Track n / Bus n per output) \u2014 the routing the scripting API cannot read. action=author: save a NEW preset = base (a preset, or the Deliver page's current settings) with audio output n fed by timeline track audio_tracks[n] ([1, 2] = 5.1 on A1 \u2192 ch1-6 + stereo on A2 \u2192 ch7-8; [2] = stereo only). Never replaces a preset; names without dots. The user's Deliver settings and page are put back. Prove a new preset with a short test render (host_render range of ~11 frames) and media_probe the channels before the full render.",inputSchema:{host:h.enum(at).default("resolve").describe("The host"),action:h.enum(["list","author"]).default("list"),names:h.array(h.string()).optional().describe("list: only these presets"),name:h.string().optional().describe("author: the new preset's name (no dots), e.g. PR4444_8CH_5-1_STEREO"),base:h.string().optional().describe("author: the preset to start from; the Deliver page's current settings when omitted"),audio_tracks:h.array(h.number().int().positive()).optional().describe("author: timeline track per audio output, e.g. [1, 2]")},run:async({host:e,action:t,names:r,name:o,base:n,audio_tracks:i})=>{try{let a=wt(e??"resolve");if(!a.presets||!a.presetAuthor)return D(new P("unsupported",`${a.host}: host_preset is for DaVinci Resolve`));let s=c=>c.error?`${c.name}: ${c.error}`:`${c.name}: ${c.format??"?"} ${c.codec??"?"} ${c.width??"?"}x${c.height??"?"}; audio ${c.audio==="true"?`${c.audio_codec??"on"} \u2192 ${c.audio_outputs?.length?c.audio_outputs.map((u,d)=>`out ${d+1} = ${u}`).join(", "):"default routing"}`:"off"}`;if(t==="author"){if(!o||!i?.length)return D(new P("invalid_args","author needs name and audio_tracks"));let c=await a.presetAuthor({name:o,...n?{base:n}:{},audio_tracks:i});return z(`saved render preset "${c.preset}"${c.summary?`
|
|
239
|
+
${s({...c.summary,name:c.preset})}`:""}
|
|
240
|
+
prove it: host_render a ~11-frame range with this preset, then media_probe the channels`,c)}let l=await a.presets({...r?.length?{names:r}:{}});return z([`${l.presets.length} render preset(s) in "${l.project}":`,...l.presets.map(s)].join(`
|
|
241
|
+
`),l)}catch(a){return D(new P("refused",a instanceof Error?a.message:String(a)))}}},{name:"host_project",title:"Learn the open host project: media pool, render queue, tracks",description:"Read-only look at the project open in the running host, to learn its conventions before acting. Resolve: the media pool folder tree with clip counts (clips=true lists every clip with its file, start TC and usage); find = file paths or name fragments to look up project-wide ('is this file already in the project? where?'); the render queue with each job's name, timeline, output folder/file, status, mark in/out and the settings Resolve reports; and every track of a timeline (default: the open one) with its name and enabled/locked state. Use before host_open (which folder) and host_render (which tracks are Lower Thirds, which job made the deliverable).",inputSchema:{host:h.enum(at).default("resolve").describe("The host"),timeline:h.string().optional().describe("Timeline whose tracks to list; the open one when omitted"),clips:h.boolean().default(!1).describe("List every clip in every folder (large projects: long)"),find:h.array(h.string()).optional().describe("File paths or name fragments to look up in the media pool")},run:async({host:e,timeline:t,clips:r,find:o})=>{try{let n=wt(e??"resolve");if(!n.project)return D(new P("unsupported",`${n.host}: host_project is not available for this host yet`));let i=await n.project({timeline:t,clips:r,find:o}),a=0,s=0,l=[],c=(d,f)=>{f&&(a++,l.push(`${" ".repeat(f)}${d.path.split("/").pop()} (${d.clips} clip${d.clips===1?"":"s"})`)),s+=d.clips;for(let m of d.clip_list??[])l.push(`${" ".repeat(f+1)}- ${m.name} ${m.file}${m.start_tc?` TC ${m.start_tc}`:""}${m.usage?` used ${m.usage}x`:""}`);for(let m of d.folders)c(m,f+1)};c(i.pool,0);let u=[`${e??"resolve"} project "${i.project}": ${a} media pool folders, ${s} clips; ${i.jobs.length} render job(s)${i.timeline?`; timeline "${i.timeline}" has ${i.tracks.length} tracks`:""}`];u.push("media pool:",...l.length?l:[" (no folders)"]);for(let[d,f]of Object.entries(i.found??{}))u.push(f.length?`find "${d}": ${f.map(m=>`${m.folder||"Master"}/${m.name} (${m.file||"no file"}${m.usage?`, used ${m.usage}x`:""})`).join("; ")}`:`find "${d}": not in the project`);i.jobs.length&&u.push("render queue:");for(let d of i.jobs){let f=d.MarkIn!=null?` frames ${d.MarkIn}-${d.MarkOut}`:"";u.push(` ${d.RenderJobName??d.JobId} [${d.JobStatus||"?"}] "${d.TimelineName??""}" \u2192 ${Zv(String(d.TargetDir??""),String(d.OutputFilename??""))}${f}${d.VideoCodec?` ${d.VideoFormat??""} ${d.VideoCodec}`:""}${d.PresetName?` preset ${d.PresetName}`:""}`)}return i.tracks?.length&&u.push(`tracks: ${u_(i.tracks)}`),z(u.join(`
|
|
242
|
+
`),i)}catch(n){return D(new P("refused",n instanceof Error?n.message:String(n)))}}},{name:"host_items",title:"Live clip attributes in the host (colour, flags, versions, groups)",description:"Resolve: per item of a timeline (default the open one) what its timeline file does not carry: clip colour, flags, enabled, the loaded grade version, colour group, node count, keywords, and its unique id. Items are addressed like timeline_query rows: kind + 1-based track + start (record frames from the timeline start), so the two join. Also the project's colour groups and node-stack layer count. Read-only.",inputSchema:{host:h.enum(at).default("resolve").describe("The host (each says when it cannot do this yet)"),timeline:h.string().optional().describe("Timeline by name; the open one when omitted"),kind:h.enum(["video","audio"]).optional(),track:h.number().int().positive().optional(),selected:h.boolean().optional().describe("only the clips selected in the host's timeline right now: {selected: [{kind, track, start, id, name}]}")},run:async({host:e,timeline:t,kind:r,track:o,selected:n})=>{try{let i=wt(e??"resolve");if(!i.items)return D(new P("unsupported",`${i.host}: host_items is not available for this host yet`));if(n){let l=await i.items({timeline:t,selected:!0});return z(`"${l.timeline}": ${l.selected.length} clip(s) selected`,l)}let a=await i.items({timeline:t,kind:r,track:o}),s=l=>a.items.filter(c=>c[l]&&(!Array.isArray(c[l])||c[l].length)).length;return z(`"${a.timeline}": ${a.items.length} items; ${s("color")} with a clip colour, ${s("flags")} flagged, ${a.items.filter(l=>!l.enabled).length} disabled; colour groups: ${a.color_groups.join(", ")||"none"}`,a)}catch(i){return D(new P("refused",i instanceof Error?i.message:String(i)))}}},{name:"host_apply",title:"Change clips in the open host timeline (colour, flags, markers, grades, names)",description:"Resolve: carry out live edits on a timeline (default the open one), in order, each read back. Items are addressed {kind?, track, start} (a timeline_query row's track number and record start frame from the timeline start) or {id} (host_items). Ops: marker_add|marker_update|marker_delete {item?, frame, color?, name?, note?, duration?, data?, to_frame?} (no item = a timeline marker; frame from the timeline start, or from the clip's start for a clip marker); clip_color {item, color|''}; flags {item, add?:[colour], clear?:colour|'All'}; enabled {item, on}; name {item, name}; properties {item, set:{Pan, Tilt, ZoomX, ZoomY, RotationAngle, FlipX, CropLeft\u2026, Opacity, CompositeMode, RetimeProcess\u2026}}; metadata {item, set:{Keywords, Comments, Scene\u2026}} (the clip's media pool item); copy_grade {item, to:[item], from_timeline?} (verified by node count; from_timeline = the source item is in that timeline); copy_properties {item, to:[item], keys:[Pan, ZoomX, CropLeft, Opacity\u2026]} (the source's values as Resolve holds them); version {item, add|load|delete, type?:'local'|'remote'}; color_group {item, group|''}; cache {item, color?:bool, fusion?:'Auto'|'On'|'Off'}; fades {item, set}; output_blanking {item, set}; drx {item, path, graph?, mode?} (apply a .drx still); edit_keys {item, keys:[{t, transform, shape?}]} (timeline_align sizing_target edit, a move: Resolve cannot keyframe the Edit page from a script, so after every other op the moving clips are keyed on a copy, '<timeline> ALIGNED' \u2014 Resolve's own .drt of the timeline with only those clips' Transform keyed on Resolve's Edit-page law, every grade and setting as it was, linked to the same pool clips; the timeline itself is not changed); grade_sizing {item, target:'input'|'node', zoom, height?, rotation (degrees clockwise), pan, tilt (fractions of the timeline width / height, tilt up), flip_x?, flip_y?} (Color-page Input Sizing or node Sizing as timeline_align answers it, ADDED to the clip's grade as it stands on a new local version 'conform.tools aligned' (the colourist's version untouched; a grade that cannot be read is refused, never replaced); a clip on a remote version is moved onto its local one first; undo resets the grade and loads the remote version back); node_structure {item, node_structure: a .drx path} (that node tree onto the clip on a new local version 'conform.tools aligned', the colourist's own version untouched; undo goes back); lut {item, graph?, node, path}; node_copy {item, from:{layer|pre|post|timeline}, to:{\u2026}, to_item?, clear_source?}; playhead {tc} (move the playhead to a record timecode); pool_rename {clip:id, name}; pool_move {clips:[id], folder, create?}; pool_delete {clips:[id]}; pool_import {paths:[file], folder:'A/B', at?:[frame]} (import files into that pool folder, made if missing; at = lay each on one new top video track at that frame from the timeline start; undo removes the track and what it added); track_delete {kind, index}; timeline_rename {timeline?, name}; timeline_duplicate {timeline?, name} (a copy under a name no timeline has, made the open one; answers its name); goto {timeline?, frame} (open that timeline with the playhead on frame, from its start). The reply has one result per op and an undo_id: host_apply {undo: undo_id} puts back everything that batch changed (pool_delete, copy_grade and drx cannot be undone). Changes the user's project: only when asked.",inputSchema:{host:h.enum(at).default("resolve").describe("The host (each says when it cannot do this yet)"),timeline:h.string().optional().describe("Timeline by name; the open one when omitted"),ops:h.array(h.object({op:h.string()}).passthrough()).optional().describe("The edits, in order (see description)"),undo:h.string().optional().describe("An undo_id from an earlier host_apply: put that batch back")},protectedStages:["canonicalize","write"],run:async({host:e,timeline:t,ops:r,undo:o})=>{try{let n=wt(e??"resolve");if(!n.apply)return D(new P("unsupported",`${n.host}: host_apply is not available for this host yet`));let i=M(he(),"host-undo"),a=r;if(o){let d=JSON.parse(await _e(M(i,`${o.replace(/[^\w-]/g,"")}.json`)));a=d.ops,t=d.timeline}if(!a?.length)return D(new P("usage","host_apply needs ops (or undo)"));let s=await n.apply({timeline:t,ops:a}),l;s.undo.length&&(l=`${Date.now().toString(36)}-${crypto.randomUUID().slice(0,6)}`,await be(i),await ge(M(i,`${l}.json`),JSON.stringify({timeline:s.timeline,project:s.project,ops:s.undo})));let c=s.results.map((d,f)=>({...d,i:f})).filter(d=>!d.ok),u=[`${o?"undid":"applied"} ${s.applied}/${s.results.length} on "${s.timeline}" (${s.project})${l?`; undo_id: ${l}`:""}`];for(let d of c.slice(0,20))u.push(` #${d.i+1} ${d.op}: ${d.detail??(d.refused?`refused ${d.refused.join(", ")}`:"Resolve refused")}`);return c.length>20&&u.push(` \u2026and ${c.length-20} more`),z(u.join(`
|
|
243
|
+
`),{...s,undo:void 0,undo_id:l})}catch(n){return D(new P("refused",n instanceof Error?n.message:String(n)))}}},{name:"host_edit",title:"Edit the open Premiere sequence into a new one (resize, un-nest, frame rate, handles\u2026)",description:"Premiere: read the open sequence (the saved .prproj when it matches the live one \u2014 every effect, retime and nest \u2014 else Premiere's OTIO export with its timecodes), run timeline_edit operations on it, and import the result as a NEW sequence written by the conform.tools .prproj writer. The open sequence never changes. ops: [{kind, args}] in order, kinds as timeline_edit (timeline_id defaults to the sequence), plus unnest. Common jobs: resize without moving a pixel: {kind:'reformat', args:{resolution_w:3840, resolution_h:2160}} (HD \u2194 UHD: every clip keeps its framing; an aspect change needs fit:'fit'|'fill'|'stretch'); un-nest: {kind:'unnest'} (every nested sequence expanded into the cut with the nest's transform, opacity and speed composed onto its clips; multicam clips read as their active angle; adjustment layers kept); conform the rate: {kind:'timeline_rate', args:{fps_num, fps_den}}; a handles / all-clips / string-out version: add_handles {handles}, all_clips {}, stringout {}. name: the new sequence's name (default <sequence>_<KIND>). The reply lists what the writer could not carry.",inputSchema:{host:h.enum(["premiere"]).default("premiere"),timeline:h.string().optional().describe("Sequence by name; the active one when omitted"),ops:h.array(h.object({kind:h.string(),args:h.object({}).passthrough().optional()})).min(1),name:h.string().optional()},run:async({timeline:e,ops:t,name:r})=>{try{let{hostEdit:o}=await import("./host-relink-D6CB2VOQ.js"),n=await o(wt("premiere"),{timeline:e,ops:t,name:r});return z(n.text,n.data)}catch(o){return D(new P("refused",o instanceof Error?o.message:String(o)))}}},{name:"host_relink",title:"Conform into the open Premiere sequence (proxies \u2192 online, cut in returns)",description:"Premiere: link the open sequence's media with conform.tools' matcher (Conform Connect: reel, timecode containment, loose proxy names, picture when asked) instead of Premiere's Link Media, then hand the result to Premiere. The sequence is read from the saved .prproj when it matches the live one (every effect and retime), else Premiere's XML export. modes: replace = repoint every proxy project clip at its online file (every use follows; not in Premiere's undo, the reply says how to put it back); hires = attach the online file as full-res behind each proxy (Premiere's Toggle Proxies switches between them); proxy = the other way: the project is on the online media and each clip gets its proxy from the folder attached (matched by name + timecode, not by Premiere's Attach Proxies); cut_in = cut each matched return (VFX / colour returns trimmed with handles, matched by reel + timecode) in over its clip on the track above (track, default the top + 1), video only, the clip's sizing carried, originals left underneath \u2014 one \u2318Z in Premiere; new_version = a NEW sequence written by the conform.tools .prproj writer from the relinked cut and imported (nothing in the open sequence changes). dry_run=true lists what would link to what. criteria / tolerances as timeline_relink (default: loose names for replace/hires, reel + timecode for cut_in). Changes the user's project: only when asked.",inputSchema:{host:h.enum(["premiere"]).default("premiere"),media_root:h.string().describe("The folder with the online media / returns"),mode:h.enum(["replace","hires","proxy","cut_in","new_version"]).default("new_version"),timeline:h.string().optional().describe("Sequence by name; the active one when omitted"),track:h.number().int().positive().optional().describe("cut_in: the video track to cut onto (default above the top track)"),name:h.string().optional().describe("new_version: the new sequence's name (default <sequence>_CONFORMED)"),dry_run:h.boolean().default(!1),criteria:h.object({}).passthrough().optional().describe("as timeline_relink criteria"),tolerances:h.object({}).passthrough().optional().describe("as timeline_relink tolerances")},run:async({media_root:e,mode:t,timeline:r,track:o,name:n,dry_run:i,criteria:a,tolerances:s})=>{try{let{hostRelink:l}=await import("./host-relink-D6CB2VOQ.js"),c=await l(wt("premiere"),{media_root:e,mode:t,timeline:r,track:o,name:n,dry_run:i,criteria:a,tolerances:s});return z(c.text,c.data)}catch(l){return D(new P("refused",l instanceof Error?l.message:String(l)))}}},{name:"host_setup",title:"Host readiness, and installing the renderplugin",description:"What works with each editing host on this machine and what to do about what doesn't (Resolve: Studio, external scripting, an open project; the conform.tools renderplugin installed and loaded). action=install_renderplugin downloads the published renderplugin for this platform, verifies its checksum before writing anything, and installs it into Resolve's system I/O plugin folder (the OS asks for an administrator password). Resolve must be restarted afterwards. action=install_probe installs ColorMatchProbe, the OFX plugin the app ships (Apple silicon Macs): it lets conform.tools read the Color page's selected clips and node (administrator password, then restart Resolve). action=install_panel installs the host's conform.tools plugin: Premiere's UXP panel with Adobe's own installer (the user then opens Window > UXP Plugins > conform.tools once); Flame's Python hook into this user's hook folder (then Rescan Python Hooks); the Nuke Studio / Hiero panel into ~/.nuke (then restart it). Never with sudo. Only install when the user asks.",inputSchema:{host:h.enum(at).default("resolve").describe("The host"),action:h.enum(["status","install_renderplugin","install_panel","install_probe"]).default("status")},run:async({host:e,action:t})=>{try{let r=e??"resolve";if((t??"status")==="install_panel"){if(r==="flame"||r==="nuke"){let s=pv[r],l=await s.install();return z([`conform.tools ${s.what} ${l.version} installed in ${l.dest}`,s.next].join(`
|
|
244
|
+
`),{...l})}if(r!=="premiere")return D(new P("unsupported","install_panel installs the conform.tools plugin for Premiere Pro, Flame or Nuke Studio (Media Composer's panel: mcp/hosts/avid/panel)"));let a=await ek();return z([`conform.tools panel ${a.version} installed for Premiere Pro (Adobe's installer: ${a.output.split(`
|
|
245
|
+
`).pop()})`,"In Premiere: Window > UXP Plugins > conform.tools (restart Premiere first if it was running). It connects by itself from then on."].join(`
|
|
246
|
+
`),{...a})}if(t==="install_probe"){if(r!=="resolve")return D(new P("unsupported","the probe is a DaVinci Resolve plugin"));let{installProbe:a}=await import("./probe-F7WQHMIA.js"),s=await a();return z([`ColorMatchProbe installed at ${s.path} (with administrator approval)`,"Restart Resolve: it loads OFX plugins at launch."].join(`
|
|
247
|
+
`),{...s})}if((t??"status")==="install_renderplugin"){if(r!=="resolve")return D(new P("unsupported","the renderplugin is a DaVinci Resolve plugin"));let a=await K0();return z([`renderplugin ${a.version} installed at ${a.path}${a.elevated?" (with administrator approval)":""}`,"Restart Resolve: it loads I/O plugins only at launch.",...a.notes].join(`
|
|
248
|
+
`),{...a})}let o=await wt(r).support(),n=[`${r}:`,...Object.entries(o).map(([a,s])=>` ${a}: ${s.ok?"ready":`no: ${s.reason}${s.setup?` (${s.setup})`:""}`}`)],i={host:r,support:o};if(r==="premiere"){let a=await Q0();n.push(` panel: ${a.installed?`installed${a.version?` (${a.version})`:""}`:`not installed (this release ships ${await Y0()}; host_setup host=premiere action=install_panel)`}`),i.panel={installed:a.installed,version:a.version}}if(r==="flame"||r==="nuke"){let a=pv[r],s=await a.installed();n.push(` ${a.what}: ${s.installed?`installed in ${s.dest}${s.version?` (${s.version})`:""}`:`not installed (this release ships ${await a.version()}; host_setup host=${r} action=install_panel)`}`),i.panel={installed:s.installed,version:s.version}}if(r==="resolve"){let a=await Ml();n.push(` renderplugin: ${a.readiness}${a.version?` (${a.version})`:""}: ${a.next}`),i.renderplugin=a;let{probeStatus:s}=await import("./probe-F7WQHMIA.js"),l=await s();n.push(` probe: ${l.next}`),i.probe=l}return z(n.join(`
|
|
249
|
+
`),i)}catch(r){return D(new P("refused",r instanceof Error?r.message:String(r)))}}},{name:"timeline_inspect",hidden:!0,title:"Inspect a session",description:"Look inside a read timeline. detail=summary (default) gives rates/tracks/counts; clips lists every item per track with record and source timecodes, media link state, speed, effects and conform flags; media lists every media reference with path, reel, timecode, raster, fps and whether it is linked; flags lists only the conform flags (things the reader could not carry 1:1); link is the Conform Connect view: which match criteria are usable for this timeline (populated on the references), what is unresolved and why, and the remembered media locations. Use clips to find item_id values for timeline_edit.",inputSchema:{session_id:h.string(),detail:h.enum(["summary","clips","media","flags","link"]).default("summary"),timeline_id:h.string().optional().describe("Limit clips listing to one timeline")},run:async({session_id:e,detail:t,timeline_id:r})=>{try{let o=await Fe(e);switch(t){case"clips":return Ae(R0(o.session,r));case"media":return Ae(I0(o.session));case"flags":return Ae(T0(o.session));case"link":return Ae(await C0(o.session));default:return Ae(`${await Un(o.session)}
|
|
250
|
+
history: ${o.history.length?o.history.join(" \u2192 "):"(unedited)"}`)}}catch(o){return D(o)}}},{name:"timeline_query",title:"Query clips, media or markers (Edit Index)",description:`Search a read timeline the way the app's tables do \u2014 the Edit Index +, Unused Media and Marker Utility tools without a host app. table=clips: one row per clip with every IR field (record/source frames, reel, speed, transform, crop, opacity, media columns, link state), plus rec_in_tc / rec_out_tc (record timecode from the timeline's start TC and rate; out is exclusive), track_name (the lane's own name, if any) and track_enabled. table=media: one row per media reference with its usage count (how many clips use it) and link state \u2014 query "is:unused" lists media no cut uses. table=markers: every marker with record TC, colour, name, note, duration and the clip under it \u2014 "is:red" lists red markers. query grammar: ${w_} The reply shows at most limit rows (default 50); when more match it starts with TRUNCATED and truncated=true \u2014 never treat that list as complete. columns picks what to show (keys or the app's labels; the reply lists every available column). out_path writes the matched rows as CSV (a file, or a folder for a stamped name; markers use the Resolve suite's marker CSV). table=summary: rates, tracks, counts and the edit history; flags: only the conform flags (what the reader could not carry 1:1); link: which match criteria are usable for this timeline. Read-only: to change what it finds use timeline_edit with the item_ids in the rows.`,inputSchema:{session_id:h.string(),table:h.enum([...MT,...BO]).default("clips"),query:h.string().optional().describe(`Filter, e.g. 'is:offline', 'speed!=100 track:V1', 'track:in V5,V6', 'overlaps:01:00:10:00..01:00:12:00', 'is:unused', 'is:rate_mismatch', '"Frame rate":23.976', 'is:red note:vfx'. Omit for every row.`),timeline_id:h.string().optional().describe("Only this timeline (clips, markers); default every primary timeline"),columns:h.array(h.string()).optional().describe("Columns to return, by key or label; default the table's working set"),limit:h.number().int().min(1).max(5e3).default(50).describe("Rows in the reply (the CSV always has every match)"),out_path:h.string().optional().describe("Write the matched rows as CSV to this file or folder")},run:async({session_id:e,table:t,query:r,timeline_id:o,columns:n,limit:i,out_path:a})=>{if(BO.includes(t))return an("timeline_inspect").run({session_id:e,detail:t,timeline_id:o});try{let s=await Fe(e),l=CT(s.session,{table:t,query:r,timeline_id:o,columns:n,csv:!!a}),c=s.session.timelines.find(m=>m.id===o)?.name??s.source_path.split(/[\\/]/).pop()??"session",u=a?await DT(l,a,c):null,{csv:d,...f}=l;return z(`${jT(l,r??"",i)}${u?`
|
|
251
|
+
wrote ${u} (${l.matched} rows)`:""}`,{...f,rows:f.rows.slice(0,i),truncated:l.matched>i,csv_path:u})}catch(s){return D(s)}}},{name:"timeline_edit",title:"Edit a session",description:`Apply one editing operation to the session in place (frame-accurate, on the IR, no host app needed). Operations and their args:
|
|
252
|
+
- slip {timeline_id,item_id,delta_frames}: move the source window, keep the record position
|
|
253
|
+
- trim {timeline_id,item_id,edge:'in'|'out',delta_frames,ripple?}: move one edge (+ lengthens the clip at out / shortens at in)
|
|
254
|
+
- delete {timeline_id,item_id,ripple?}
|
|
255
|
+
- move_clip {timeline_id,item_id,to_track_id?,to_frame?}
|
|
256
|
+
- transform {timeline_id,item_id,scale?,opacity?,position_x?,position_y?,rotation?,crop_*?}
|
|
257
|
+
- reformat {timeline_id?,resolution_w,resolution_h,fit?}: change the sequence raster
|
|
258
|
+
- timeline_rate {timeline_id,fps_num,fps_den}
|
|
259
|
+
- add_markers {timeline_id?,markers:[{name?,note?,color?,time,duration?,item_id?}]}: time/duration in timeline frames (from the timeline start) or {value,rate}; duration defaults to 1 frame; the reply says why any marker was dropped
|
|
260
|
+
- stringout {extent?,handles?,name_prefix?}: build a string-out (every used source range, in order) with handles
|
|
261
|
+
- add_clip {timeline_id,path,source_start?,source_duration?,at_frame?,track_id?,fit?,without_audio?}: cut a media file in (probed here; its audio comes with it). source_start/source_duration in source frames (default the whole file); at_frame = timeline frame for the head, OVERWRITING what is there (default: append to the track); track_id default the last video track (an audio-only file goes to the last audio track)
|
|
262
|
+
- add_track {timeline_id,kind?:'Video'|'Audio'}: an empty track on top (video) or bottom (audio); reply carries its track_id
|
|
263
|
+
- add_handles {timeline_id?,handles,name?}: a NEW timeline, every video clip end to end with \xB1handles frames per side clamped to the media (negative trims each end); stills skipped and listed; named {TL}_{N}FR_HANDLES / {TL}_TRIM_{N}FR
|
|
264
|
+
- all_clips {timeline_ids?,handles?,name?,include_disabled?,include_image_sequences?(true),include_stills?,include_offline?(true),include_references?,reference_pattern?('_REF|_REFERENCE| REF'),mark_duplicates?(true),reduce_duplicates?,per_resolution?,stack?,order?:'timeline'|'source_tc'}: a NEW timeline of every piece of footage used across the timelines, overlapping uses of one clip merged; stack=V1 one uncut piece per shot with takes above; duplicates = the same shot under two clips (marked; reduce rebuilds from the copy holding every frame)
|
|
265
|
+
- relink, new_timeline, delete_track, node_sizing, finish_op (advanced)
|
|
266
|
+
args.sources [session_id\u2026]: also run over those sessions' timelines (one host_current via=export per Resolve timeline \u2192 all_clips over several); their ids become '<session_id>/<id>'; only the timelines the op builds are added here, the sources stay untouched.
|
|
267
|
+
Get item_id / timeline_id from timeline_query. Frame deltas are in timeline frames.`,inputSchema:{session_id:h.string(),kind:h.enum(P0),args:h.object({}).passthrough().describe("Arguments for the operation, see description")},run:async({session_id:e,kind:t,args:r})=>{try{let o=await Fe(e);t==="add_clip"&&(r=await _U(o.session,r));let n=Array.isArray(r.sources)?r.sources.map(String).filter(a=>a!==e):[],i=n.length?A0(o.session,await Promise.all(n.map(async a=>({id:a,session:(await Fe(a)).session}))),t,r):El(o.session,t,r);return await ht(o,`${t} ${JSON.stringify(r)}`),z(`${i.summary}${i.meta?`
|
|
268
|
+
${JSON.stringify(i.meta,null,1).slice(0,4e3)}`:""}`,{summary:i.summary,meta:i.meta??null})}catch(o){return D(o)}}},{name:"timeline_author",title:"Author a timeline from media",description:"Build a NEW timeline from media files and a shot list, on this machine, with the app's own editing operations (no host app). Each shot: path, source_in (first source frame, 0 = the file's first frame), duration (timeline frames), and optionally at (timeline frame; default append), track (1-based video track; created as needed), scale (percent), position_x/position_y (frame pixels from centre), rotation (degrees clockwise), flip_h/flip_v (mirror), scale_end/position_x_end/position_y_end/rotation_end (animate linearly to these by the shot's last frame), speed (percent of real time; a 29.97 clip played frame for frame in a 23.976 timeline is 80). Returns a session_id for timeline_write / timeline_query. Use to make a test cut whose answer is known exactly (write it, render it in the host, then auto conform the render against the media).",inputSchema:{name:h.string().describe("Timeline name"),fps_num:h.number().int().positive().describe("Timeline rate numerator, e.g. 24000"),fps_den:h.number().int().positive().describe("Timeline rate denominator, e.g. 1001"),width:h.number().int().positive(),height:h.number().int().positive(),start_tc:h.string().optional().describe("Timeline start timecode, e.g. \"00:59:52:00\" (';' before the frames = drop frame); default 00:00:00:00. Shot `at` stays frames from the timeline start"),shots:h.array(h.object({path:h.string(),source_in:h.number().int().nonnegative(),duration:h.number().int().positive(),at:h.number().int().nonnegative().optional(),track:h.number().int().positive().optional(),scale:h.number().positive().optional(),position_x:h.number().optional(),position_y:h.number().optional(),rotation:h.number().optional(),flip_h:h.boolean().optional(),flip_v:h.boolean().optional(),scale_end:h.number().positive().optional(),position_x_end:h.number().optional(),position_y_end:h.number().optional(),rotation_end:h.number().optional(),speed:h.number().positive().optional()})).min(1)},run:async e=>{try{let{session:t,summary:r}=await ll(e),o=await Xt(t,M(he(),"authored",`${e.name}.authored`),"authored");return Ae(`session_id: ${o.id}
|
|
269
|
+
${r.join(`
|
|
270
|
+
`)}
|
|
271
|
+
${await Un(t)}`)}catch(t){return D(t)}}},{name:"timeline_generate",repoOnly:!0,title:"Generate a test cut from a bucket",description:"Make a NEW timeline from a bucket of media: a seeded random edit with a chosen mix of hard cases, laid in by timeline_author, so its answer is known exactly. Same media + seed + mix = the same cut. Every shot is tagged with the classes it tests: "+sl.join(", ")+". mix: a preset ("+Object.keys(na).join(", ")+"; default hard) or weights per class. Returns a session_id for timeline_write and the shot list with record ranges and classes. Use to test auto conform, compare or any matcher: generate, write, render in the host (optionally grade it), auto conform the render, score per class.",inputSchema:{media:h.array(h.string()).min(1).describe("Media files or folders (walked; folders named *proxy*/*proxies* or cache skipped)"),seed:h.number().int().describe("Random seed"),shots:h.number().int().positive().max(500).optional().describe("V1 shots (default 24)"),audio:h.boolean().optional().describe("Lay sync sound in under normal-speed shots whose clips have it (needed for frankenbite)"),look:h.boolean().optional().describe("Look at each planned shot and re-plan around flat picture \u2014 empty backdrops, grey cards (default true)"),mix:h.union([h.enum(Object.keys(na)),h.record(h.enum(sl),h.number().nonnegative())]).optional(),name:h.string().optional(),fps_num:h.number().int().positive().optional().describe("Default 24000"),fps_den:h.number().int().positive().optional().describe("Default 1001"),width:h.number().int().positive().optional().describe("Default 1920"),height:h.number().int().positive().optional().describe("Default 1080")},run:async e=>{try{let t=await _A(e),r=e.name??`generated ${e.seed}`,o=await Xt(t.session,M(he(),"authored",`${r}.authored`),"authored"),n=new Map;for(let a of t.shots)for(let s of a.classes)n.set(s,(n.get(s)??0)+1);let i=[`session_id: ${o.id}`,`${t.shots.length} shots from ${t.pool.used} clips: ${[...n].map(([a,s])=>`${s} ${a}`).join(", ")}`,...t.pool.skipped.length?[`skipped ${t.pool.skipped.length}: ${t.pool.skipped.slice(0,5).join("; ")}`]:[],await Un(t.session)];return z(i.join(`
|
|
272
|
+
`),{session_id:o.id,shots:t.shots,titles:t.titles,skipped:t.pool.skipped})}catch(t){return D(t)}}},{name:"timeline_relink",title:"Link / relink media (Conform Connect)",description:`The app's Conform Connect link wizard, as one call, on the same matcher and coverage law. Finds the media for the session's unbound references under a folder on this machine and repoints them.
|
|
273
|
+
gather: 'walk' (default) scans the folder recursively (name-first pre-filter, cap 2000) and matches by the criteria; 'path' is strict link \u2014 each reference must exist at its recorded relative path under the folder, no scan.
|
|
274
|
+
criteria (all optional; default = file_name on, tight): file_name + file_name_mode tight|loose (loose strips _Sxxx, _vN and proxy words like proxy/prx/offline/h264/prores and accepts \u22650.6 similarity), reel_name, total_duration, resolution, bit_depth, file_format, codec, media_umid, extensions, picture (the analysis engine compares the reference's own file with each candidate at the same TC; needs the reference readable). Enabled criteria are strict AND. Timecode containment (the file must hold the cut) and fps are ALWAYS enforced. For renamed media use reel_name=true, file_name=false. For proxy\u2192OCF use file_name_mode loose and leave resolution/codec off.
|
|
275
|
+
tolerances: timecode_tolerance_frames (1), duration_tolerance_seconds (0.1), min_name_similarity (0.6), fps_tolerance (0.005).
|
|
276
|
+
scope: ref_ids limits to a zone; lane video|audio|both limits by track usage; reset=true re-points already-linked refs in scope (they are unbound first).
|
|
277
|
+
dry_run=true proposes without changing anything: per reference matched/ambiguous/unmatched, the chosen file, confidence, reasons, refusals with the coverage reason, and alternatives; compare=true adds the per-criterion project-vs-media table. accept=[{ref_id,candidate_id}] commits only those rows (ids from a dry run) \u2014 the manual pick. Without accept, every matched row is applied. media_root omitted \u2192 the remembered locations are tried; remember=true saves this folder. Ends with the link summary and what is still unresolved, with the reason.`,inputSchema:{session_id:h.string(),media_root:h.string().optional().describe("Folder to link from; omit to use remembered locations"),gather:h.enum(["walk","path"]).default("walk"),criteria:h.object({file_name:h.boolean().optional(),file_name_mode:h.enum(["tight","loose"]).optional(),reel_name:h.boolean().optional(),total_duration:h.boolean().optional(),resolution:h.boolean().optional(),bit_depth:h.boolean().optional(),file_format:h.boolean().optional(),codec:h.boolean().optional(),media_umid:h.boolean().optional(),extensions:h.array(h.string()).optional().describe("Only consider these extensions, e.g. ['mxf','mov']"),picture:h.boolean().optional().describe("Also match by picture where the reference's own file is readable (proxy \u2192 OCF): each candidate must show the same frames at the same TC; picks the one right file among ambiguous candidates, refuses a name match that shows another picture or a TC slip")}).optional(),tolerances:h.object({timecode_tolerance_frames:h.number().optional(),duration_tolerance_seconds:h.number().optional(),min_name_similarity:h.number().optional(),fps_tolerance:h.number().optional(),aspect_tolerance:h.number().optional()}).optional(),ref_ids:h.array(h.string()).optional().describe("Only these references (a zone)"),lane:h.enum(["video","audio","both"]).default("both"),reset:h.boolean().default(!1).describe("Re-point refs in scope even if already linked"),dry_run:h.boolean().default(!1).describe("Propose only; change nothing"),compare:h.boolean().default(!1).describe("With dry_run: show the per-criterion comparison for each matched row"),accept:h.array(h.object({ref_id:h.string(),candidate_id:h.string()})).optional().describe("Commit only these rows (from a dry run)"),cap:h.number().int().min(1).max(2e4).default(2e3),remember:h.boolean().default(!1)},run:async e=>{try{let t=await Fe(e.session_id),r=await tk(t.session,e);return r.changed&&(t.session=r.session,await ht(t,r.note)),Ae(r.text)}catch(t){return D(t)}}},{name:"timeline_write",protectedStages:["write"],title:"Write a timeline for a host",description:"Write the session for a host, on this machine. Prefer a DESTINATION (the host the user is going to): resolve, premiere, avid, flame, finalcut, baselight, protools \u2014 it writes the host's native file AND its fallback (e.g. resolve = .drt + XML for Resolve; avid = .avb + AAF) into one folder named for the host, with a README saying which to open first. Single formats still work as targets: resolve-drt (DaVinci Resolve timeline, preferred for Resolve), premiere-prproj, avid-avb (Media Composer bin), avid-aaf, flame-archive, baselight-blscene, finalcut-fcpxmld, resolve-xmeml, flame-fcpxml, resolve-otio. Short aliases drt/prproj/avb/aaf/xmeml/fcpxml/otio work. Returns the written path and the capability issues: what this target host cannot carry from the source (nests flattened, effects dropped, etc.) \u2014 always relay those to the user.",inputSchema:{engine:h.enum(["local","hosted"]).optional().describe("Where the conversion runs: local = this machine, offline, nothing uploaded; hosted = conform.tools (the website's engine). Default: local when this build has it"),session_id:h.string(),target:h.string().describe("A destination (resolve, premiere, avid, flame, finalcut, baselight, protools) or a single target format, e.g. resolve-drt, or an alias like drt"),out_path:h.string().optional().describe("Output file path, or a directory (file name is derived; a destination writes a host-named folder inside it). Defaults next to the source file."),timeline_id:h.string().optional().describe("Write only this timeline (e.g. the one timeline_edit add_handles / all_clips just built); default the session's timelines as read")},run:async({session_id:e,target:t,out_path:r,timeline_id:o})=>{try{let n=await Fe(e);if(o&&!n.session.timelines.some(c=>c.id===o))return D(new P("not_found",`no timeline ${o} in session ${e} (${n.session.timelines.map(c=>`${c.id} "${c.name}"`).join(", ")})`));let i=o?{...n.session,timelines:n.session.timelines.filter(c=>c.id===o||c.kind==="compound")}:n.session;if(vw(t)){let c=await O0(i,t,r,n.source_path);await ht(n,`write ${t} \u2192 ${c.folder}`);let u=c.files.map(d=>`${d.path} (${d.bytes} bytes, ${d.target})`+(d.issues.length?`
|
|
278
|
+
issues (${d.issues.length}):
|
|
279
|
+
${d.issues.map(f=>` - [${f.severity??"info"}] ${f.code?`${f.code}: `:""}${f.message}`).join(`
|
|
280
|
+
`)}`:`
|
|
281
|
+
no capability issues`));return Ae(`wrote ${c.folder}/ \u2014 README.txt says which to open first
|
|
282
|
+
${u.join(`
|
|
283
|
+
`)}${c.pending?`
|
|
284
|
+
${c.pending} is not included yet (writer pending its host's import law)`:""}`)}let a=await Dm(i,t,r,n.source_path);await ht(n,`write ${t} \u2192 ${a.path}`);let s=a.issues.length?`
|
|
285
|
+
issues (${a.issues.length}):
|
|
286
|
+
${a.issues.map(c=>`- [${c.severity??"info"}] ${c.code?`${c.code}: `:""}${c.message}`).join(`
|
|
287
|
+
`)}`:`
|
|
288
|
+
no capability issues`,l=await Ms("conform-artist",["write"]);return Ae(`wrote ${a.path} (${a.bytes} bytes)${s}${l?`
|
|
289
|
+
|
|
290
|
+
Reading this write (conform.tools playbook):
|
|
291
|
+
${l}`:""}`)}catch(n){return D(n)}}},{name:"timeline_routes",title:"Supported formats and operations",description:"List what can be read, what can be written (first-class vs beta), aliases, and the editing operations. Use when asked 'can you convert X to Y' or what the tool supports.",inputSchema:{},run:()=>Ae(M0())},{name:"timeline_sessions",title:"List sessions",description:"List sessions read earlier (id, source file, format, when, edit history). Sessions persist across restarts.",inputSchema:{},run:async()=>{let e=await hw();return Ae(e.length?e.map(t=>`${t.id} ${t.source_path} (${t.source_format}) updated ${t.updated_at}${t.history.length?` \u2014 ${t.history.length} edits`:""}`).join(`
|
|
292
|
+
`):"(no sessions)")}},{name:"session_export",title:"Export Session IR",description:"Write the session's IR JSON (the engine's canonical timeline representation) to a file, for tooling, diffing or archiving.",inputSchema:{session_id:h.string(),out_path:h.string()},run:async({session_id:e,out_path:t})=>{try{let r=await Fe(e);return await ge(t,JSON.stringify(r.session,null,1)),Ae(`wrote ${t}`)}catch(r){return D(r)}}},{name:"media_probe",title:"Probe a media file",description:"Read a media file's facts on this machine (never uploads): container, codec, raster, frame rate, start timecode, frame count, duration, audio, reel. Supports mov/mp4/m4v (ProRes, DNx, H.264/HEVC\u2026), braw, crm, mxf (ARRI/Sony/DNx), wav, RED .R3D (spanned clips: any part or the .RDC folder), stills (exr/dpx/tiff/jpg/png/dng/cr3: raster; an EXR's own framesPerSecond + timeCode from its header; a numbered frame's whole sequence from its folder \u2014 first/last, length, gaps, start TC). Use before media_trim to know the file's start timecode and length. A WAV has no frame rate: pass fps (the project's) for its BWF start TC and length in frames; without it both 23.976 and 24 are shown.",inputSchema:{path:h.string(),fps:h.number().positive().optional().describe("audio-only files: the video rate to count the BWF timecode and length at (23.976, 24, 25, 29.97\u2026)")},run:async({path:e,fps:t})=>{try{if(f0(e)){let o=await h0(e);return z(g0(o),{...o})}let r=await Pe(e);return z(s0(r,t),{...r})}catch(r){return D(r)}}},{name:"timeline_diff",protectedStages:["canonicalize"],title:"Source diff of two cuts (online vs editorial)",description:"Compare WHERE THE PICTURE COMES FROM in two cuts aligned by record TC: A = the online/colour timeline, B = the newest editorial turnover (each a session_id or a timeline file). Per record frame it takes the topmost enabled video clip (by_track=true: each video track by name, V1 vs V1\u2026) and reports the record ranges whose source differs: only_in_a / only_in_b (missing or extra clips), different_file (another file or reel \u2014 temp vs master; a different TC base is called out), same_name_different_clip (same file name but a different start TC or length: dated batch folders reuse names, never trust the name alone), source_tc (same file, slipped N frames). Starts with the count per kind; every range lists both sides' file, source TC, track and item id. csv_path / edl_path write every range (the EDL carries B's sources: what to drop into A); session=true makes a new session of B's clips under those ranges only (an insert timeline for timeline_write). Read-only on both cuts.",inputSchema:{a_session_id:h.string().optional().describe("A (online/colour) as a session"),a:h.string().optional().describe("A as a timeline file, instead of a_session_id"),b_session_id:h.string().optional().describe("B (editorial turnover) as a session"),b:h.string().optional().describe("B as a timeline file, instead of b_session_id"),a_timeline_id:h.string().optional(),b_timeline_id:h.string().optional(),by_track:h.boolean().default(!1).describe("Compare each video track by name instead of the topmost picture"),limit:h.number().int().min(1).max(5e3).default(100).describe("Ranges in the reply (files always have all)"),csv_path:h.string().optional(),edl_path:h.string().optional(),session:h.boolean().default(!1).describe("Also create a session of B's differing clips (insert timeline)")},run:async({a_session_id:e,a:t,b_session_id:r,b:o,a_timeline_id:n,b_timeline_id:i,by_track:a,limit:s=100,csv_path:l,edl_path:c,session:u})=>{try{let d=async(y,b,w)=>{if(y){let k=await Fe(y);return{session:k.session,name:`session ${y} (${B(k.source_path)})`}}if(b)return{session:(await Oo(b)).session,name:B(b)};throw new P("invalid_args",`give ${w}_session_id or ${w} (a timeline file)`)},f=await d(e,t,"a"),m=await d(r,o,"b"),p=RP(f.session,m.session,{a_timeline_id:n,b_timeline_id:i,by_track:a}),g=[];l&&(await ge(l,TP(p.ranges)),g.push(`CSV: ${l} (${p.ranges.length} ranges)`)),c&&(await ge(c,PP(p,`${p.tb.name} SOURCE DIFF`)),g.push(`EDL: ${c} (B sources)`));let _;if(u&&p.ranges.length){let y=await Xt(AP(m.session,p),M(he(),"authored",`${p.tb.name} source diff.authored`),"diff");_=y.id,g.push(`session_id: ${y.id} (B's clips under the differing ranges; timeline_write it)`)}let v=Object.fromEntries(z_.map(y=>[y,p.ranges.filter(b=>b.kind===y).length]));return z([IP(p,f.name,m.name,s),...g].join(`
|
|
293
|
+
`),{counts:v,total:p.ranges.length,ranges:p.ranges.slice(0,s),truncated:p.ranges.length>s,session_id:_,csv_path:l,edl_path:c})}catch(d){return D(d)}}},{name:"media_aspect",title:"Active picture and OAR of a movie",description:"Find a movie's active picture (letterbox / pillarbox / windowbox) and the original aspect ratio it implies, snapped to the standard ratios (1.33, 1.78, 1.85, 1.90, 2.00, 2.39 \u2026), with the OAR raster (full width, even height). 16 frames across the clip; a bar counts only when \u226580% of them carry it, so fades and black leaders don't invent one. Use on the screener / editorial REF to decide OAR deliverables vs a 16x9 container, and on a render to confirm it.",inputSchema:{path:h.string(),samples:h.number().int().min(4).max(64).optional().describe("Frames sampled (default 16)")},run:async({path:e,samples:t})=>{try{let r=await aE(e,t);return z(sE(r),{...r})}catch(r){return D(r)}}},{name:"media_find",title:"Find media by name or ID on a volume",description:"Search a folder or volume (read-only walk) for media whose name holds a name or ID fragment, and probe each match so temp and master can be told apart: codec, raster, rate, start\u2013end TC, frames, duration. Matching ignores case, spaces/underscores/dots and doubled extensions (`X.mov.mov`, `X.mov_001.mov`); when the whole fragment is not found, a file that holds every digit-bearing token of it matches as an id match (a misspelt word around the ID). Files with the same name in different folders are called out: dated batch folders reuse names for DIFFERENT clips, so match by TC + duration, never by name alone. Bounded by max_depth, max_entries and time_limit_s; when a bound stops it the reply starts with TRUNCATED.",inputSchema:{path:h.string().describe("Folder or volume to search"),query:h.string().min(2).describe("Name or ID fragment, e.g. 'XD32995' or 'XD32995_0158_0221_MultiClip.mov'"),max_depth:h.number().int().min(0).max(30).default(10),max_entries:h.number().int().min(1).max(2e6).default(2e5).describe("Directory entries to visit before stopping"),time_limit_s:h.number().min(1).max(600).default(60),probe:h.boolean().default(!0).describe("Probe each match (codec, raster, rate, TC, length)"),limit:h.number().int().min(1).max(5e3).default(100)},run:async({path:e,query:t,max_depth:r,max_entries:o,time_limit_s:n,probe:i,limit:a})=>{try{let s=await l0(e,t,{max_depth:r??10,max_entries:o??2e5,time_limit_s:n??60,probe:i??!0});return a??=100,z(c0(s,e,t,a),{scanned:s.scanned,truncated:s.truncated,total:s.hits.length,hits:s.hits.slice(0,a).map(l=>({path:l.path,match:l.match,size:l.size,facts:l.facts?Tl(l.facts):null,source_timecode:l.facts?.source_timecode??null,frames:l.facts?.available_range?.duration?.value??l.facts?.declared_duration?.value??null,error:l.error}))})}catch(s){return D(s)}}},{name:"media_coverage",title:"Does a file cover these TC ranges (and how much handle)?",description:"Check that a media file holds the source ranges a cut needs, and how much handle it has: per range covered, or NOT covered and short by N frames at head/tail, plus the head/tail handle in frames. ranges: [{in, out, label?}] as absolute source timecode (the file's own TC, e.g. 23:59:12:10; out exclusive, as an EDL reads; TC wraps at midnight) or file-local frame numbers. Or session_id + item_ids: the clips' used source ranges (from their own media's TC), checked against path, or against each clip's own file when path is omitted. A master with a different TC base than the temp the cut was made on will show NOT covered: that is the answer (the client's clip-TC list is then the mapping). handles: also flag ranges with less than this many frames each side.",inputSchema:{path:h.string().optional().describe("The media file to check (required with ranges)"),ranges:h.array(h.object({in:h.union([h.string(),h.number().int()]),out:h.union([h.string(),h.number().int()]),label:h.string().optional()})).optional(),session_id:h.string().optional(),item_ids:h.array(h.string()).optional().describe("Clip item ids (timeline_query / timeline_query)"),handles:h.number().int().min(0).default(0).describe("Required handle per side, frames")},run:async({path:e,ranges:t,session_id:r,item_ids:o,handles:n})=>{try{let i=new Map,a=[];if(t?.length){if(!e)throw new P("invalid_args","path is required with ranges");i.set(e,[...t])}if(r){if(!o?.length)throw new P("invalid_args","item_ids is required with session_id");let f=(await Fe(r)).session,m=new Map((f.media_references??[]).map(g=>[g.id,g])),p=new Map(f.timelines.flatMap(g=>g.tracks.flatMap(_=>_.items)).map(g=>[g.id,g]));for(let g of o){let _=p.get(g);if(!_?.source_range){a.push(`${g}: no such clip with a source range`);continue}let v=_.media_reference_id?m.get(_.media_reference_id):void 0,y=(v?.local_path??v?.target_url??"").replace(/^file:\/\//,""),b=e??y;if(!b){a.push(`${g}: the clip has no media path; pass path`);continue}let w=_.source_range.start.rate||v?.source_fps||24,k=v?.source_fps||w,I=_.source_range.start.value*k/w,x=_.source_range.duration.value*k/w,S=v?.source_timecode?qe(v.source_timecode,k):null,R=Math.round(k)*86400,$=!!v?.source_timecode?.includes(";"),C=E=>S==null?Math.round(E):ce(Math.round(S+E)%R,k,$);(i.get(b)??i.set(b,[]).get(b)).push({label:`${g} ${_.name??""}`.trim(),in:C(I),out:C(I+x)})}}if(!i.size)throw new P("invalid_args",a.length?a.join("; "):"give path + ranges, or session_id + item_ids");let s=[],l=[],c=0,u=0;for(let[f,m]of i){let p=await u0(f,m,n);l.push({path:f,facts:Tl(p.facts),rows:p.rows}),s.push(`${f}
|
|
294
|
+
${Tl(p.facts)}`,...p.rows.map(g=>` - ${g.label}: ${g.in_tc}\u2013${g.out_tc} (${g.frames} fr) ${g.note}`)),c+=p.rows.filter(g=>!g.covered).length,u+=p.rows.length}let d=c?`${c} of ${u} range${u===1?"":"s"} NOT covered`:`all ${u} range${u===1?"":"s"} covered`;return z([d,...s,...a.map(f=>`skipped ${f}`)].join(`
|
|
295
|
+
`),{covered:u-c,not_covered:c,files:l,skipped:a})}catch(i){return D(i)}}},{name:"media_trim",title:"Trim a media file",description:"Cut a shorter file out of a source WITHOUT re-encoding (byte-exact essence copy, index rebuilt; source timecode is preserved so the trim relinks in any host). in/out are frame indexes (0 = first frame) or timecodes relative to the file's start TC; out is the LAST frame included unless out_exclusive=true. handles adds frames on both sides (clamped to the file). Supports mov/mp4/m4v (ProRes, DNx, H.264/HEVC \u2014 long-GOP snaps to keyframes), braw, crm, mxf, wav, and RED .R3D (spanned .RDC clips: pass any part or the folder; output is a new .RDC). Returns the new path(s) and the frames written.",inputSchema:{path:h.string(),in:h.union([h.string(),h.number().int()]).describe("First frame: frame index or timecode like 01:00:10:00"),out:h.union([h.string(),h.number().int()]).describe("Last frame (inclusive) or timecode; set out_exclusive for an edit-style out point"),out_exclusive:h.boolean().optional(),handles:h.number().int().min(0).optional().describe("Extra frames on each side"),out_path:h.string().optional().describe("Output file or directory; default is next to the source as <name>_trim_<in>-<out>.<ext>")},run:async e=>{try{let t=await Il(e),r=t.facts.streams?.find(o=>o.kind==="video");return Ae(`${t.outputs.map(o=>`wrote ${o.path} (${(o.bytes/1e6).toFixed(1)} MB${o.part?`, part ${o.part}`:""})`).join(`
|
|
296
|
+
`)}
|
|
297
|
+
frames ${t.first_frame}\u2013${t.last_frame} (${t.frames} frames)${t.asked?` \u2014 snapped to keyframes (asked ${t.asked.first_frame}\u2013${t.asked.last_frame})`:""}
|
|
298
|
+
source: ${r?.codec??"?"} ${r?.width??"?"}x${r?.height??"?"} @ ${t.fps} fps, start TC ${t.facts.source_timecode??"none"}`)}catch(t){return D(t)}}},{name:"media_patch",long:!0,title:"Patch frames into a master",description:"Cut a fixed range of frames into a finished master BY TIMECODE, WITHOUT re-encoding (the Resolve 'bypass re-encode' fix, for ProRes and DNxHD/HR .mov). patch = a render of the fixed range in the master's exact spec with record TC: codec/profile, raster, rate, alpha/depth and colour tags are checked first, the patch lands at (patch start TC \u2212 master start TC) and needs a TC track at the master's TC rate and DF/NDF; a mismatch, a patch without TC or a range outside the master is refused and nothing is written. in/out on the master (frames or timecodes, like media_trim; out inclusive) only cross-check that placement or pick part of the patch: an in= that disagrees with the TC is refused. Patch frames may be bigger or smaller than the ones they replace. mode new (default): a new file beside the master (<name>_patched), rewritten contiguously in the master's interleave order; the master untouched. mode section: a new file of just the patched range with the master's TC and audio. mode in_place: ONLY when the user asks to modify the master itself \u2014 the patch frames are appended and the index rewritten (the file grows by the patch, the replaced frames stay as dead bytes, the patched span loses interleave locality), the old index kept so mode=undo restores the file byte for byte. mode check: the spec + TC check, nothing written. mode plan (H.264/HEVC, BEFORE rendering a patch; needs in/out, no patch): the whole-GOP span of the master to render (keyframe at/before in \u2192 frame before the next keyframe after out; an open GOP after it included), its TCs, the GOP length and B-frames. Every write is verified (frame count, the master's TC track unchanged, frames at the patch's TC byte-identical to the patch and decoding to its pixels, the frames either side the master's, audio and untouched frames identical) and rolled back if it fails. in_place proves audio/TC untouched from the index by default (every sample at its original offset and size, the write append-only), so a feature master patches in about a minute; verify=full re-reads and hashes them (minutes a pass over a share). patches=[\u2026] puts several into one master in one call (all checked first; overlap refused). Long: background=true for a job id with progress. H.264/HEVC (long-GOP): a patch that replaces whole closed GOPs encoded like the master's (span from a master keyframe to the frame before the next, identical avcC/hvcC, keyframes and B-frame offsets) cuts in with no re-encode; anything else is refused, naming the GOP span to render.",inputSchema:{path:h.string().describe("The master .mov"),patch:h.string().optional().describe("The render of the fixed range (not needed for mode=undo)"),mode:h.enum(["new","section","in_place","check","undo","plan"]).optional().describe("Default new; in_place only when asked to modify the master itself; plan before rendering a long-GOP patch"),in:h.union([h.string(),h.number().int()]).optional().describe("Cross-check: the master frame (index or timecode) to start at; must agree with the patch's TC"),out:h.union([h.string(),h.number().int()]).optional().describe("Last master frame to replace (inclusive); default: to the end of the patch"),patch_in:h.number().int().min(0).optional().describe("First patch frame to use (default: the one at in= by TC, else 0)"),out_path:h.string().optional().describe("Output file or folder for mode new/section; never overwritten"),patches:h.array(h.string()).optional().describe("in_place/check: several patch renders into this master in one call, each placed by its own TC (instead of patch)"),verify:h.enum(["index","full"]).optional().describe("in_place: index (default) proves audio/TC untouched from the index; full re-reads and hashes them")},run:async({__progress:e,__signal:t,...r})=>{try{let o=await W_(r,e);return z(o.text,o.data)}catch(o){return D(o)}}},{name:"media_retag",title:"Retag a file's colour (no re-encode)",description:"Change what a ProRes .mov SAYS its colour is (primaries / transfer / matrix), WITHOUT converting a pixel: the video colr atom (nclc/nclx) and every ProRes frame header are rewritten in place (same size, nothing moves) and read back. Use it for 'the same file tagged Rec.709' or to fix a mis-tagged render. Names: rec709, p3d65, dci-p3, rec2020 (primaries); rec709/g24, g26, pq, hlg (transfer); rec709, rec2020 (matrix); or ITU-T H.273 codes. out_path (file or folder) = a retagged copy, never overwriting (name it with the artist's naming: the colour/gamma fields change); in_place=true only when the user asks to change the file itself. The file's hash changes, so a checksum manifest that went out with it is stale. Refused: H.264/HEVC (the tags live in the SPS, a re-encode) and files without a colr atom.",inputSchema:{path:h.string().describe("The ProRes .mov to retag"),primaries:h.union([h.string(),h.number().int().min(0).max(255)]).describe("rec709 | p3d65 | dci-p3 | rec2020 | H.273 code"),transfer:h.union([h.string(),h.number().int().min(0).max(255)]).describe("rec709 (=g24) | g26 | pq | hlg | H.273 code"),matrix:h.union([h.string(),h.number().int().min(0).max(255)]).describe("rec709 | rec2020 | H.273 code"),out_path:h.string().optional().describe("A retagged copy (file or folder); never overwritten"),in_place:h.boolean().optional().describe("Retag this file itself (only when the user asks)")},run:async e=>{try{let t=await UP(e);return z(t.text,t.data)}catch(t){return D(t)}}},{name:"media_dcp",long:!0,title:"Make a DCP from a master",description:`Build a SMPTE OV DCP folder from a finished ProRes master and its mix WAV, natively on this machine (the same DCI J2K encoder, MXF writers and validator as conform.tools/dcp); to change frames of a finished DCP use media_dcp_patch. The master is fitted into the DCI container keeping its aspect (flat 1.85 up to 1.9:1, scope above; container= to force; 16:9 lands pillarboxed in flat, a 2.39 OAR master fills scope), rest black. color = what the master IS (rec709 = BT.1886 2.4, srgb, p3d65): ask if the master's tags or the artist's profile don't say. The rate is the master's own (24/25/30/48/50/60 in 2K, 24/25/30 in 4K). A 23.976/29.97 master needs reclock=true: frame-for-frame at 24/30, sound sped up 0.1% with no pitch correction (Resolve's method; the mix is the master-rate mix). Ask before reclocking. The WAV (48/96 kHz integer PCM, any channel count, 5.1 = 6 ch in SMPTE order) must end with the picture: a mix longer or a frame+ shorter is refused (run render_gate first). Prove a new master with from/count (~48 frames) first.
|
|
299
|
+
encrypt=true: SMPTE 429-6 AES-128 + HMAC, CPL/PKL signed with the facility identity (~/.conform-mcp/dcp/signer.pem, created on first use with issuer as the organisation). The content key is written ONLY to <out_dir>/<title>_KEYS/keys.json: tell the user it is the only copy, never ship it inside the DCP. Then media_dcp_kdm per venue.
|
|
300
|
+
title = ContentTitleText and folder name, DCNC form (naming / artist's profile; a new version gets a new date/version). Lands in out_dir/<title> (default beside the master), never overwritten, then validated (DCI raster, J2K rate caps, hashes, CPL/PKL/ASSETMAP, signatures) with PASS/FAIL. Refused up front if the volume lacks room for the worst case (250 Mb/s + sound). Speed \u2248 40+ fps 2K, \u2248 15 fps 4K encoded on an M-series Mac: a feature runs a long time, so background=true.`,inputSchema:{path:h.string().describe("The ProRes master .mov"),wav:h.string().describe("The program's mix WAV (5.1 = 6 channels L R C LFE Ls Rs)"),title:h.string().describe("ContentTitleText / folder name, DCNC form e.g. FILM_FTR-1_F_EN-XX_51_2K_20261009_TBD_SMPTE_OV"),color:h.enum(co(lo)).describe("The master's colour encoding"),out_dir:h.string().optional().describe("Folder the DCP folder is created in (default: beside the master)"),container:h.enum(co(ad)).optional().describe("DCI container; default from the master's aspect"),resolution:h.enum(co(sd)).optional().describe("Default 2k"),kind:h.string().optional().describe(`CPL ContentKind: ${co(ld).join(", ")}\u2026 (default feature)`),issuer:h.string().optional().describe("Issuer, and the organisation of a newly created signing identity"),encrypt:h.boolean().optional().describe("Encrypt + sign the package (fresh content key, written to keys.json beside it)"),reclock:h.boolean().optional().describe("23.976 \u2192 24 (29.97 \u2192 30): picture frame-for-frame, sound +0.1% varispeed"),from:h.number().int().min(0).optional().describe("First master frame (test builds)"),count:h.number().int().min(1).optional().describe("Frames to build (test builds); default to the end")},run:async({__progress:e,__signal:t,...r})=>{try{let o=await BP(r,e,t);return z(K_(o),o)}catch(o){return D(o)}}},{name:"media_dcp_patch",long:!0,title:"Patch frames into a DCP",description:"Overwrite frames of a finished SMPTE DCP with a fix (a VFX shot, a title, a bad frame, a sound pop) without rebuilding the package. The fix (path) is: a ProRes .mov render of just the fixed range (encoded here with the media_dcp DCI J2K encoder, fitted into the DCP's own container at its rate; color = what the render IS), .j2c codestreams (one file, or a folder of them, sorted by name), a picture track .mxf (another DCP's), a .wav (same channels and rate as the DCP's sound) or a sound track .mxf. at = the first composition frame it replaces: a frame number or HH:MM:SS:FF counted from the composition's first frame; reel=N makes at relative to reel N; a .mov with a TC track can be placed by its own TC with start_tc= (the DCP's first frame, e.g. 01:00:00:00). Length never changes (overwrite, not insert), so sound, subtitles and reel lengths stay where they were. Before anything is written every patch frame is checked against the reel it lands in (raster, components, 2K/4K profile; a different COD is a warning), against the DCI 250 Mb/s per-frame cap, and for range/overlap/channel layout; a refusal writes nothing. Only the reels a patch touches are re-wrapped (new track files with new asset UUIDs: changed bytes never keep the old id); untouched reels are carried as the same files (hard-linked on the same volume: instant for a feature) or, mode=vf, referenced from the OV (the VF carries only the re-wrapped reels: send it to venues and labs that hold the OV; it plays nowhere else). mode=ov (default) is a self-contained new OV. mode=check: placement, which reels re-wrap and every check, nothing written (a .mov fix: one frame is encoded to check it). The output is proven before it is reported: patch frames, the 2 frames either side of every seam and each reel's head/tail byte-identical to their source, every other edit unit by length, then the validator; verify=full also recomputes every hash. Lands in out_dir/<title> (default: beside the DCP; title default = the source's DCNC name with OV/VF set), never overwritten. Name a new version in the DCNC title (FTR-2) when the client tracks versions. Encrypted DCPs and Interop packages are refused. ENCRYPTED: an encrypted source needs keys (its keys.json from media_dcp encrypt=true); encrypt=true writes the result encrypted with a fresh key (+ signed, keys.json beside it). Without path it only re-packages: encrypt=true encrypts an OV, keys alone makes a decrypted copy. An encrypted patch is one fix (path + at as a frame number) into a new OV; wav= replaces the whole mix there.",inputSchema:{dcp:h.string().describe("The DCP folder (the one with ASSETMAP.xml)"),path:h.string().optional().describe("The fix: .mov (ProRes), .j2c or a folder of .j2c, .mxf, .wav"),at:h.union([h.number().int().min(0),h.string()]).optional().describe("First composition frame replaced: frame number or HH:MM:SS:FF from the composition start"),reel:h.number().int().min(1).optional().describe("Make at relative to this reel (1-based)"),color:h.enum(co(lo)).optional().describe("A .mov fix: its colour encoding (required for .mov)"),from:h.number().int().min(0).optional().describe("First frame of the fix to use (default 0)"),count:h.number().int().min(1).optional().describe("Frames of the fix to use (default: all of it)"),patches:h.array(h.object({path:h.string(),at:h.union([h.number().int().min(0),h.string()]).optional(),reel:h.number().int().min(1).optional(),color:h.enum(co(lo)).optional(),from:h.number().int().min(0).optional(),count:h.number().int().min(1).optional()})).optional().describe("Several fixes in one pass (instead of path/at); overlap refused"),mode:h.enum(["ov","vf","check"]).optional().describe("ov (default): a new self-contained OV; vf: only what changed, referencing the OV; check: nothing written"),package:h.enum(["ov","vf"]).optional().describe("mode=check: check as this package type"),title:h.string().optional().describe("ContentTitleText / folder name (default: the source's, OV/VF set)"),out_dir:h.string().optional().describe("Folder the new package is created in (default: beside the DCP)"),cpl:h.string().optional().describe("Which CPL, when the package has several (file name, title or uuid)"),start_tc:h.union([h.number().int().min(0),h.string()]).optional().describe("The composition's first frame as TC, to place a .mov fix by its own timecode"),issuer:h.string().optional(),keys:h.string().optional().describe("keys.json of an encrypted source DCP"),encrypt:h.boolean().optional().describe("Encrypt + sign the new package (fresh content key)"),wav:h.string().optional().describe("Encrypted patch only: a new mix WAV replacing the whole sound"),verify:h.enum(["quick","full"]).optional().describe("full: also recompute every asset hash (reads the whole package)")},run:async({__progress:e,__signal:t,...r})=>{try{let o=r;if(o.keys||o.encrypt){let i=await GP(o,e,t);return z(K_(i),i)}let n=await HP(o,e,t);return z(WP(n),n)}catch(o){return D(o)}}},{name:"media_dcp_kdm",title:"Make a KDM for a DCP",description:"Write a KDM (SMPTE 430-1) that lets ONE projector/media block play an encrypted DCP made by media_dcp, for a window. keys = that DCP's keys.json; recipient = the venue's server/projector certificate .pem (they send it; a chain file is fine, the device leaf is picked). from/to are UTC dates (YYYY-MM-DD; to is inclusive to 23:59:59) or full YYYY-MM-DDThh:mm:ss: confirm the screening dates with the user, and allow for the venue's time zone. Signed with the same facility identity as the DCP, self-verified. Written beside keys.json as <title>_KDM_<recipient>_<from>_<to>.xml, never overwritten. The KDM is safe to email; keys.json is not.",inputSchema:{keys:h.string().describe("The encrypted DCP's keys.json"),recipient:h.string().describe("The projector/server certificate (.pem) from the venue"),from:h.string().optional().describe("First day it plays, UTC (default now)"),to:h.string().describe("Last day it plays, UTC"),out_dir:h.string().optional().describe("Default: beside keys.json")},run:async e=>{try{let t=await VP(e);return z(ZP(t),t)}catch(t){return D(t)}}},{name:"gfx_make",long:!0,title:"Make a graphics package",description:`Design a graphic ONCE and get it for every deliverable: lower thirds, locators (location IDs), legal lines and end crawls, rendered on this machine as ProRes 4444 + alpha (the matte Resolve, Premiere, Avid and FCP read) for every aspect ratio and position. The reformat is automatic and art-directed, not a stretch: type is sized on the short edge so it is physically the same in every format, each graphic stays pinned to its anchor inside action-safe (9:16 also keeps clear of the platform caption band and right rail), and text re-wraps to each format's width with the plate growing to fit. Formats default to all of ${Nm.join(", ")} (or name a raster like 1280x720); resolution uhd doubles every raster. Positions: a lower third fans to bottom-left/bottom/bottom-right by default, a locator to top-left/top-right; any of ${Fm.join(", ")} or all \u2014 each enters from its own side. End crawls are full frame. Content: one graphic (name+title \xB7 location+sub \xB7 text \xB7 credits) or many (items=[{\u2026}] or csv_path, one package per item). End crawl credits use the paste dialect: '# Section', 'Role | Name', '> wrapped paragraph', '@image logo.png' or '@image sag.png | dga.png 18' (a row of logos, images_dir), blank = gap; or credits_path (.txt) / csv_path (a credits sheet: section, role, name columns). Look: a preset (${Lm.join(", ")}), an object of {family, accent, primary, secondary, plate (${rk.join("|")}), style (${ok.join("|")}), stagger, ease, radiusLu, padLu, uppercase, tracking}, or look_path (a .look.json from conform.tools/gfx or an earlier package) \u2014 the same look keeps every type on-brand. Fonts: family = a shipped face (${ik.join(", ")}), any installed family by name (gfx_fonts lists them), or a font file/folder; fonts= adds files (e.g. the bold) under their own family names. An unknown family is refused, never substituted. Every run writes <base>/preview.png (every format \xD7 position at the hold, true relative sizes) and <base>/still.png (the design full size): run preview_only=true first, LOOK at them, adjust, then render. Output: out_dir/<base>/<position>/<format>_<w>x<h>.mov, manifest.json and look.json (reuse with look_path). background_color=#rrggbb makes opaque ProRes 422 HQ instead (named _on_rrggbb). lottie=true also writes <base>.lottie (editable in Resolve/web; outlines for shipped and supplied fonts). options passes generator settings (lower third: center, nameLu, titleLu, maxWidthLu\u2026 \xB7 legal: sizeLu, minLu, sizeHpct, scrim, align \xB7 crawl: lineLu, colGapLu, gutterFrac). Held frames are encoded once, so a 21-file lower-third package takes seconds.`,inputSchema:{type:h.enum(Object.keys(nk)),name:h.string().optional().describe("lower_third: the name line"),title:h.string().optional().describe("lower_third: the title line"),location:h.string().optional().describe("locator: the location line"),sub:h.string().optional().describe("locator: the second line (time, date, INT./EXT.)"),text:h.string().optional().describe("legal: the disclaimer paragraph"),credits:h.string().optional().describe("end_crawl: credits in the paste dialect"),items:h.array(h.record(h.string())).optional().describe("Many graphics of this type, e.g. [{name, title}, \u2026]; one package each"),csv_path:h.string().optional().describe("A CSV of items (name,title \xB7 location,sub \xB7 text) or, for end_crawl, a credits sheet"),credits_path:h.string().optional().describe("end_crawl: a .txt (paste dialect) or .csv credits file"),images_dir:h.string().optional().describe("end_crawl: folder the @image names are in (default: the credits file's folder)"),look:h.union([h.string(),h.record(h.unknown())]).optional().describe(`A preset (${Lm.join(", ")}) or look fields`),look_path:h.string().optional().describe("A .look.json (conform.tools/gfx, or an earlier package's look.json)"),family:h.string().optional().describe("Typeface: shipped id, installed family name, or a font file/folder"),fonts:h.array(h.string()).optional().describe("Font files or folders to make available (each under its own family name)"),formats:h.array(h.string()).optional().describe(`Default all: ${Nm.join(", ")}; or a raster like 1280x720`),positions:h.array(h.string()).optional().describe(`Anchors (${Fm.join(", ")}) or ["all"]; default per type`),resolution:h.enum(["hd","uhd"]).optional().describe("hd (16:9 = 1920\xD71080, default) or uhd (\xD72)"),fps:h.number().positive().optional().describe("Default 23.976"),duration:h.number().positive().max(600).optional().describe("Seconds (default: lower third 6, locator 5, legal 6, crawl 12)"),start_tc:h.string().optional().describe("Start timecode (default 00:00:00:00)"),background_color:h.string().optional().describe("#rrggbb: opaque ProRes 422 HQ on this colour instead of 4444 + alpha"),options:h.record(h.unknown()).optional().describe("Generator settings beyond the look"),lottie:h.boolean().optional().describe("Also write an editable .lottie per graphic"),preview_only:h.boolean().optional().describe("Only the preview sheet + still; render nothing"),out_dir:h.string().optional().describe("Package folder (default <MCP home>/gfx/<type>_<time>)")},run:async({__progress:e,__signal:t,...r})=>{try{let o=await sk(r,e,t);return z(lk(o),o)}catch(o){return D(o)}}},{name:"gfx_fonts",title:"List typefaces for graphics",description:"The typefaces gfx_make can set: the shipped faces (by id; OFL, embeddable in a .lottie) and every family installed on this machine with its weights. query filters by name. A face not listed can still be used by passing its font file or folder to gfx_make.",inputSchema:{query:h.string().optional().describe("Part of a family name, e.g. 'helv'")},run:async({query:e})=>{try{let t=await ak(e),r=[`shipped: ${t.shipped.map(o=>`${o.id} (${o.label}, ${o.weights.join("/")})`).join(" \xB7 ")}`,`installed${e?` matching '${e}'`:""} (${t.installed.length}): ${t.installed.slice(0,200).map(o=>`${o.family}${o.weights.length>1?` [${o.weights.join("/")}]`:""}`).join(" \xB7 ")}${t.installed.length>200?" \u2026(query= to narrow)":""}`].join(`
|
|
301
|
+
`);return z(r,t)}catch(t){return D(t)}}},{name:"media_fix",long:!0,repoOnly:!0,title:"Fix frames: duplicates, cadence, retime",description:"Remake the frames a picture got wrong, as new media (ProRes 422 HQ at the source's timecode, so it relinks like the original). One plan, one executor: the analysis engine decides each output frame \u2014 a source frame as it is, or a frame BETWEEN two (RIFE v4.22.lite) \u2014 and the result is checked. Kinds: duplicates \u2014 the frames QC (qc_media) calls repeated: a double frame, a hang, slow motion by repeating frames; each repeat becomes the motion between the frames around it, the frame count kept (include_freezes: also a freeze continuing from motion \u2014 off by default, a freeze may be the edit's). cadence \u2014 an AI render (e.g. Seedance video_edit) against the plate it was made from: held frames cut, skipped plate frames put back, the output at the plate's count and rate; a render the AI RE-PACED is reported and not repaired unless force=true (filling it would cut real frames). retime \u2014 a constant speed (percent, 100 = real time) or a ramp ([frame, percent] keys) from src_in for `frames` output frames: optical-flow slow motion and speed changes better than a host's frame blend; or with session_id, every retimed clip of the timeline (its own speed or speed ramp, handles each side) rendered at the timeline's rate and record TC and the item relinked to it at 100 %. plan_only reports the plan without writing. The plan, the check, the decode and the encode are the engine and media-core; the between frames are RIFE on MLX (media-gen, Apple Silicon, its weights in models/rife/ of the MCP home); a plan with none (holds cut only) needs neither.",inputSchema:{kind:h.enum(["duplicates","cadence","retime"]),path:h.string().optional().describe("The clip to fix (cadence: the AI render); omit for a timeline retime"),session_id:h.string().optional().describe("retime: every retimed clip of this session's timeline (or item_ids) rendered with optical flow and relinked, played 1:1"),item_ids:h.array(h.string()).optional().describe("retime with session_id: only these items"),handles:h.number().int().min(0).max(240).optional().describe("retime with session_id: frames rendered each side of the used range (default 12)"),out_dir:h.string().optional().describe("retime with session_id: where the renders go (default <MCP home>/renders/<session id>)"),out_path:h.string().optional().describe("Output .mov; default <path>_<kind>.mov beside it"),plan_only:h.boolean().optional(),include_freezes:h.boolean().optional().describe("duplicates: also remake freezes continuing from motion"),plate:h.string().optional().describe("cadence: the source plate the AI was given"),plate_start:h.number().int().min(0).optional().describe("cadence: first plate frame the AI was given (default 0)"),plate_frames:h.number().int().min(2).optional().describe("cadence: plate frames the AI was given (default: to the end)"),mask:h.tuple([h.number(),h.number(),h.number(),h.number()]).optional().describe("cadence: x0,y0,x1,y1 fractions, an area the AI changed on purpose, left out of the alignment"),force:h.boolean().optional().describe("cadence: repair even when a re-pace is detected"),src_in:h.number().min(0).optional().describe("retime: source in-point (frame, default 0)"),frames:h.number().int().min(1).optional().describe("retime: output frames (default: the source's count)"),speed:h.number().positive().optional().describe("retime: constant speed in percent (50 = half speed)"),ramp:h.array(h.tuple([h.number(),h.number()])).optional().describe("retime: speed ramp keys [output frame, percent]")},run:async e=>{try{if(e.session_id){if(e.kind!=="retime")throw new Error("session_id is for kind=retime (a timeline's retimed clips)");let r=await Fe(e.session_id),o=await FP(r.session,{session_id:e.session_id,item_ids:e.item_ids,handles:e.handles,out_dir:e.out_dir,plan_only:e.plan_only});o.changed&&(r.session=o.session,await ht(r,`media_fix retime: ${o.items.filter(i=>i.wrote).length} clip(s) rendered with optical flow and relinked`));let n=[`${o.items.filter(i=>i.wrote).length} of ${o.items.length} retimed clip(s) ${e.plan_only?"planned":"rendered with optical flow and relinked (played 1:1)"}`,...o.items.map(i=>` ${i.name} (${i.speed}): ${i.skipped??`${i.frames} frames, ${i.between} remade${i.wrote?` \u2192 ${i.wrote}`:""}`}`)].join(`
|
|
302
|
+
`);return z(n,{session_id:e.session_id,items:o.items})}if(!e.path)throw new Error("path is required (or session_id with kind=retime)");let t=await NP(e);return z(zP(t),{...t})}catch(t){return D(t)}}},{name:"media_consolidate",long:!0,title:"Consolidate media for a timeline",description:"Timeline-driven trim: for every source file the cut uses, write a byte-exact trim of just the used frames plus handles into out_dir (no re-encode; ProRes/DNx/H.264 mov, mxf, wav, RED .R3D). This is the conform 'consolidate' / 'media manage' step. By default only linked references are trimmed (run timeline_relink first so paths are verified); set only_linked=false to trim whatever paths exist on disk. With relink=true (default) the session is repointed at the trims, so a following timeline_write links to the consolidated media. Reports each output and everything skipped, with the reason.",inputSchema:{session_id:h.string(),out_dir:h.string().describe("Folder for the trimmed media"),handles:h.number().int().min(0).default(24).describe("Frames of handle on each side of every used range"),relink:h.boolean().default(!0).describe("Repoint the session at the trims"),only_linked:h.boolean().default(!0)},run:async({session_id:e,out_dir:t,handles:r,relink:o,only_linked:n})=>{try{let i=await Fe(e),a=await D0(i.session,t,r,{relink:o,only_linked:n});return await ht(i,`consolidate \u2192 ${t} (${a.outputs.length} files, ${r} handles)`),Ae(a.text)}catch(i){return D(i)}}},{name:"color_prep",long:!0,title:"Prep a conform for colour: the colourist's node tree, input CSTs and a first balance",description:"The colour prep step of a conform, onto the session's timeline (timeline_read the prproj/drt/xml first). Every shot gets the colourist's OWN node tree, the input Color Space Transform for what it was shot in, and a first balance in their balance node; timeline_write target=resolve-drt then writes it as a separate .drt (their project is never touched). TREE: tree = a gallery still or PowerGrade (.drx) of their tree, exported from Resolve's gallery. The first time, call with tree only: it lists the nodes and you ASK the user which is the balance node and which the input CST (never pick from labels), AND how they build their grade \u2014 where their look lives (look_levels: clip / group_pre / group_post / adjustment_clips / timeline / output; colourists differ: groups or not, timeline grade, adjustment clips) and where their LUTs/DCTLs live (lut_dirs) \u2014 then call again with balance_node + cst_node + look_levels (+ lut_dirs); all of it is remembered in the artist profile, so later preps need no tree. CSTs: read per clip from the camera's own metadata (Sony X-OCN/XAVC, ARRI, RED; MOV colour tags): camera log \u2192 its space into the tree's working space; Rec.709 video \u2192 Rec.709 with inverse OOTF; graphics, stills and alpha \u2192 no tree, no grade. A clip that cannot be identified, or is identified only by container tags (camera files often tag log as Rec.709), is returned as a QUESTION and nothing is written: ask the user, then pass answers=[{match, as}]. BALANCE (default on; Apple Silicon, local AI pack, download=true the first time after asking): step 1 = the local AI balance per shot read as an Offset (exposure + white balance); step 2 = group consistency V7-1 (only obvious cast / contrast mismatches between shots that share surfaces or the same person are nudged, never exposure, a no-harm check on nearby cuts; DaVinci Wide Gamut / Intermediate trees), the moved shots' balance node refitted (primaries only, Lum Mix 100). The result lists how many shots were nudged. balance=false = tree and CSTs only. Long: background=true for a job id.",inputSchema:{session_id:h.string().describe("The conform's session (timeline_read of their timeline)"),timeline:h.string().optional().describe("Timeline id or name (default: the first)"),tree:h.string().optional().describe("Path to a .drx (gallery still / PowerGrade) of the colourist's node tree; omit to use the remembered one"),balance_node:h.number().int().optional().describe("With tree: the node id the USER says is their balance node"),cst_node:h.number().int().optional().describe("With tree: the node id the USER says is their input Color Space Transform"),look_levels:h.array(h.enum(gm)).optional().describe("With tree: where the USER says their look lives (any combination)"),lut_dirs:h.array(h.string()).optional().describe("With tree: the folders the USER keeps their LUTs and DCTLs in"),working:h.string().optional().describe("With tree, instead of cst_node when the USER says their input CST is not in this tree (group pre-clip / colour management): the space the tree works in, <SPACE>_COLORSPACE/<CURVE>_GAMMA"),answers:h.array(h.object({match:h.string(),as:h.string()})).optional().describe(`The user's answers to the colour questions: match = part of the file/folder/clip name; as = "rec709" | "graphic" | "<SPACE>_COLORSPACE/<CURVE>_GAMMA"`),balance:h.boolean().optional().describe("Balance the shots (default true); false = tree and CSTs only"),download:h.boolean().optional().describe("Allow the one-time AI pack download (ask the user first)")},run:async({session_id:e,timeline:t,tree:r,balance_node:o,cst_node:n,look_levels:i,lut_dirs:a,working:s,answers:l,balance:c,download:u,__progress:d})=>{try{let f=await Fe(e),m;if(r){let g=await bO(r,o,n,i,a,s);if(g.ask)return z(g.ask,{needs:"node choice"});m=g.tree}else m=await yO();if(!m)return z("I need the colourist's node tree once: export a still of it from Resolve's gallery (right-click the still > Export, .drx) or a PowerGrade, and give me the path (tree=\u2026).",{needs:"tree"});let p=await vO(f.session,{timeline:t,tree:m,answers:l,balance:c,download:u,progress:g=>d?.(0,0,g)});if(!p.ops.length)return z(p.text,p.data);for(let g of p.ops)El(f.session,"finish_op",g);return await ht(f,`color_prep: ${m.name}, ${p.ops.length} clips`),z(p.text,{...p.data,session_id:e})}catch(f){return D(f)}}},{name:"color_match",title:"Match a shot's color to a reference image",description:`Conform Connect's auto color, headless: solve the grade that moves a SOURCE frame onto a REFERENCE image (an AI-generated still, a client frame grab, a graded still \u2014 png/jpg/tiff/exr/dpx decoded by our own engine, or a frame of another clip). The same histogram + covariance match and fold fit the Lab runs; the result is Resolve corrector nodes (tone 1, match matrix, tone 2 bypassed) as finish entries. Default method hm-mkl-hm works against ANY reference; hm-mvgd-hm is the Lab's default and needs a pixel-aligned pair (the same frame recolored, e.g. an AI color transfer output). With session_id + item the grade is installed on that clip, so timeline_write resolve-drt then carries it as live nodes on Resolve's color page. reference "ai" balances the frame with the local model (colour from the model, exposure mostly held, as on conform.tools) and fits it from the pixel pairs (method pixel); the first use needs download: true. With session_id + item, a Color Space Transform on the clip's colour page (read from the .drt) runs first \u2014 our own CST, exact to Resolve's \u2014 so the balance and the fit happen after it, and the written .drt keeps that CST node in front of the new nodes. Camera-native raw sources are refused (they decode as log); match on a proxy or a rendered frame.`,inputSchema:{source:h.string().describe("Media file (ProRes/DNx/MXF) or a still to grade"),frame:h.union([h.number().int(),h.string()]).optional().describe("Frame index or timecode of the source frame (default: the middle of the file)"),reference:h.string().describe('The look to match: a still image, a media file (+reference_frame), or "ai" \u2014 a first-pass balance by FLUX.2 klein running on THIS machine (Apple Silicon, 16 GB+; nothing is uploaded)'),reference_frame:h.union([h.number().int(),h.string()]).optional(),method:h.enum(aO).optional().describe('default hm-mkl-hm; for reference "ai" the default is primaries: ONE corrector node of gain/lift per channel, one gamma, contrast and saturation, skin protected on faces'),mixer:h.boolean().optional().describe("method primaries: also use the RGB Mixer (default false: a plain balance of gain/lift/gamma/contrast/saturation)"),skin_protect:h.number().min(1).max(20).optional().describe("method primaries: skin protection strength, default 3 (1 = off). Only inside detected faces, scaled by how much of the frame they fill; it moves colour only and keeps the balance's contrast"),transfer:h.enum(["srgb","g24"]).optional().describe("Override the source's encoding (default: g24 for video, srgb for stills)"),session_id:h.string().optional().describe("Install the grade on a clip of this session"),item:h.string().optional().describe("The clip to grade: item id or unique clip name (with session_id)"),download:h.boolean().optional().describe('reference "ai" only: allow the one-time model download (~4.3 GB into ~/.conform-mcp/models). Ask the user first.')},run:async({source:e,frame:t,reference:r,reference_frame:o,method:n,transfer:i,session_id:a,item:s,download:l,mixer:c,skin_protect:u})=>{try{let d=a?await Fe(a):null;if(d&&!s)throw new P("invalid_args","item is required with session_id");let f=d&&s?uO(d.session,s):null;if(d&&!f)throw new P("not_found",`no clip '${s}' in session ${a} (timeline_query lists ids and names)`);let m=f?cO(d.session,f.itemId):void 0,p=await sO({source:e,frame:t,reference:r,reference_frame:o,method:n,transfer:i,item_id:s,download:l,cst:m,mixer:c,skinBoost:u}),g={method:p.method,transfer:p.transfer,residual:p.residual,luma_stops:p.lumaStops,source:p.source,reference:p.reference,entries:p.entries,...p.cst?{cst:p.cst}:{}},_="";if(d&&f){let v=lO(p,f.timelineId,f.itemId);for(let y of v)El(d.session,"finish_op",y);await ht(d,`color_match ${B(r)} \u2192 ${f.name||f.itemId} (${p.method})`),g.session_id=a,g.item_id=f.itemId,_=`
|
|
303
|
+
installed on ${f.name||f.itemId} in session ${a}: timeline_write target=resolve-drt writes it as corrector nodes`}return z(dO(p)+_,g)}catch(d){return D(d)}}},{name:"p2p_send",title:"Send files or a package peer to peer (Iroh)",description:"Serve a file, or a folder such as a media_deliver package, straight from this machine to one recipient over Iroh (encrypted QUIC, direct or relayed): no upload, no bucket. Returns a ticket for the recipient to pass to p2p_receive, and a job_id: the files are served until job action=cancel. The recipient only ever pulls the bytes it asks for (seek+response), so nothing is pushed.",inputSchema:{path:h.string().describe("A file, or a folder to send with its layout (e.g. a media_deliver folder package)")},run:async({path:e})=>{try{let t=await AO(e);if(!t.length)return D(new P("not_found",`nothing to send in ${e}`));let r=await Fv(t),o=Ds("p2p_send",async(i,a)=>(await new Promise(s=>{a.addEventListener("abort",()=>s()),r.closed.then(s)}),r.stop(),Ae("stopped serving"))),n=Cn(r.ticket).files.length;return z(`serving ${n} file(s) as ${o.id} \u2014 job action=cancel job_id=${o.id} to stop
|
|
304
|
+
ticket (give this to the recipient): ${r.ticket}`,{ticket:r.ticket,job_id:o.id,files:n})}catch(t){return D(t)}}},{name:"account_bucket",title:"Your bucket: where client sends and deliveries land",description:"Connect your own S3-compatible bucket (AWS S3, Cloudflare R2, Backblaze B2, Wasabi, MinIO) to your conform.tools account. Projects then default to it: what clients send through a project_link, and media_deliver destination=bucket, land there. action=show \xB7 set (endpoint https://\u2026, bucket, access_key_id, region?, secret_access_key \u2014 or leave it out and set CONFORM_BUCKET_SECRET in the MCP's environment so the secret never passes through the chat) \xB7 forget. set tests the bucket first (write, ranged server-side copy, read back, delete) and saves only if every step works. The secret is kept server-side (Vault), never shown again.",inputSchema:{action:h.enum(["show","set","forget"]).default("show"),endpoint:h.string().optional().describe("set: e.g. https://<account>.r2.cloudflarestorage.com, https://s3.us-west-2.amazonaws.com"),bucket:h.string().optional(),region:h.string().optional().describe("set: default auto"),access_key_id:h.string().optional(),secret_access_key:h.string().optional().describe("set: or CONFORM_BUCKET_SECRET in the environment")},run:async({action:e,endpoint:t,bucket:r,region:o,access_key_id:n,secret_access_key:i})=>{try{let a=c=>c?`your bucket: ${c.bucket} at ${c.endpoint} (key ${c.access_key_id}${c.verified_at?`, checked ${c.verified_at.slice(0,10)}`:""})`:"no bucket connected \u2014 account_bucket action=set endpoint=\u2026 bucket=\u2026 access_key_id=\u2026";if(e==="show"){let{storage:c}=await rt("v1-me","/v1/me/storage");return z(a(c),{storage:c})}if(e==="forget")return await rt("v1-me","/v1/me/storage",{method:"DELETE"}),Ae("bucket forgotten; new projects use conform.tools storage");let s=i??Ke("CONFORM_BUCKET_SECRET");if(!t||!r||!n||!s)return D(new P("invalid_args","set needs endpoint, bucket, access_key_id and secret_access_key (or CONFORM_BUCKET_SECRET)"));let{storage:l}=await rt("v1-me","/v1/me/storage",{method:"PUT",body:{endpoint:t,bucket:r,region:o,access_key_id:n,secret_access_key:s}});return z(`${a(l)} \u2014 tested and saved; new projects send into it`,{storage:l})}catch(a){return D(a)}}},{name:"project",title:"Projects: the job you are working on, its shared context, and what clients send into it",description:`A project is one job ("PRIMROSE \xB7 Ep 104") on conform.tools, shared by everyone in the org: its context (the standing notes \u2014 client, deliverables, naming, handles, specs, decisions \u2014 that everyone, and Claude over the MCP, works from), its sessions, and what clients send through its links (project_link), in conform.tools storage or the org's own bucket (storage='org'), trimmed to their cut + the project's handles. Starting work on a job: action=open first (project_id from list) \u2014 its context comes back, and every session you make from then on joins the project. When you learn something about the job, add it with action=context text=\u2026 (the whole notes, edited: read them first). action=open (project_id) \xB7 context (project_id? default the open one; text? saves the whole notes over the version read, else reads them) \xB7 attach (project_id?, session_id: one of the org's conform.tools sessions, e.g. an older send, joins it) \xB7 create (name, client_name?, handles?, storage?) \xB7 list \xB7 incoming (every client app sharing LIVE right now, on any project \u2014 mount one with delivery_fetch) \xB7 show (project_id: its links, every send newest first, and any client app sharing LIVE peer to peer) \xB7 archive (project_id: its links stop working).`,inputSchema:{action:h.enum(["open","context","attach","create","list","incoming","show","archive"]),project_id:h.string().optional().describe("default for context/attach: the open project"),text:h.string().max(2e5).optional().describe("context: the project's whole notes (markdown) to save; omit to read them"),session_id:h.string().optional().describe("attach: a conform.tools session id"),name:h.string().optional().describe("create: the job's name"),client_name:h.string().optional(),handles:h.number().int().min(0).max(240).optional().describe("create: trim handles in frames for what clients send (default 24)"),storage:h.enum(["conform","org"]).optional().describe("create: the org's own bucket (default when account_bucket has one) or conform.tools storage")},run:async({action:e,project_id:t,name:r,client_name:o,handles:n,storage:i,text:a,session_id:s})=>{try{let l=(f,m={})=>rt("v1-projects",f,m),c=f=>[f.updated_by?`saved by ${f.updated_by} ${String(f.updated_at).slice(0,16).replace("T"," ")}`:"",f.pending?"saved on this machine only; it goes up when conform.tools is reachable":f.offline?"offline: this machine's copy":""].filter(Boolean).join(" \xB7 ");if(e==="open"){if(!t)return D(new P("invalid_args","open needs project_id (project action=list)"));let{project:f}=await l(`/v1/projects/${t}`);await pw({id:f.id,name:f.name});let m=await Tm(f.id);return z([`open: ${f.name}${f.client_name?` \xB7 ${f.client_name}`:""} \u2014 ${f.handles}-frame handles; sessions you make now join it`,m.text.trim()?`context (${c(m)||"shared with the project"}):
|
|
305
|
+
${m.text.trim()}`:"context: none yet \u2014 when you learn the spec (deliverables, naming, handles, client), save it with project action=context text=\u2026"].join(`
|
|
306
|
+
`),{project:f,context:m})}if(e==="context"||e==="attach"){let f=t??(await zn())?.id;if(!f)return D(new P("invalid_args",`${e} needs project_id, or a project opened with project action=open`));if(e==="attach")return s?(await l(`/v1/projects/${f}/sessions`,{method:"PUT",body:{session_id:s}}),Ae(`session ${s} joined project ${f}`)):D(new P("invalid_args","attach needs session_id"));let m=a===void 0?await Tm(f):await fw(f,a);return z(a===void 0?m.text.trim()?`${m.text.trim()}
|
|
307
|
+
|
|
308
|
+
(${c(m)||"shared with the project"})`:"no context yet for this project":`saved the project's context (${m.text.length} characters)${m.pending?": on this machine only, it goes up when conform.tools is reachable":""}`,{context:m})}let u=f=>`${(Number(f||0)/1e6).toFixed(1)} MB`;if(e==="create"){if(!r)return D(new P("invalid_args","create needs name"));let f=i??((await rt("v1-me","/v1/me/storage").catch(()=>({storage:null}))).storage?"org":"conform"),{project:m}=await l("/v1/projects",{body:{name:r,client_name:o,handles:n,storage:f}});return z(`project ${m.name} (${m.id}) \u2014 ${m.handles}-frame handles, ${m.storage==="org"?"your bucket":"conform.tools storage"}
|
|
309
|
+
next: project_link project_id=${m.id} for a link to send your client`,{project:m})}if(e==="list"){let[{projects:f},m]=await Promise.all([l("/v1/projects"),zn()]);return z(f.length?f.map(p=>`- ${p.name}${p.client_name?` (${p.client_name})`:""} \xB7 ${p.id}${p.id===m?.id?" \xB7 OPEN":""}${p.live?.length?` \xB7 LIVE: ${p.live.length} sharing now (project action=incoming)`:""}`).join(`
|
|
310
|
+
`):"no projects yet \u2014 project action=create name=\u2026",{projects:f,open:m})}if(e==="incoming"){let{projects:f}=await l("/v1/projects"),m=f.flatMap(p=>(p.live??[]).map(g=>({project:p.name,project_id:p.id,...g})));return z(m.length?m.map(p=>`- ${p.project}${p.label?` \xB7 ${p.label}`:""} \xB7 sharing since ${String(p.seen_at).slice(11,16)} \u2192 delivery_fetch from=${p.ticket} as=mount (or as=trims / as=iso)`).join(`
|
|
311
|
+
`):'nobody is sharing right now \u2014 a client presses "Let <you> connect" in their Send app (project_link makes one)',{live:m})}if(!t)return D(new P("invalid_args",`${e} needs project_id`));if(e==="archive")return await l(`/v1/projects/${t}`,{method:"PATCH",body:{archived:!0}}),Ae(`archived ${t}; its links no longer work`);let d=await l(`/v1/projects/${t}`);return z([`${d.project.name}${d.project.client_name?` \xB7 ${d.project.client_name}`:""} \u2014 ${d.project.handles}-frame handles, ${d.project.storage==="org"?"your bucket":"conform.tools storage"}`,`links (${d.links.length}):`,...d.links.flatMap(f=>[` - ${f.label??"(no label)"} ${f.url} ${f.alive?`\xB7 expires ${f.expires_at?.slice(0,10)??"never"}`:"\xB7 OFF"}${f.last_used_at?` \xB7 last used ${f.last_used_at.slice(0,16)}`:""}`,...f.peer?[` LIVE: their app is sharing its cut from their machine \u2192 delivery_fetch from=${f.peer.ticket} as=mount (or as=trims / as=iso)`]:[]]),`sends (${d.sessions.length}):`,...d.sessions.map(f=>` - ${f.created_at.slice(0,16)} ${f.label??""} ${f.sender_email??""} ${f.status} ${u(f.total_bytes)} \u2192 delivery_fetch from=bucket:${f.id}`)].join(`
|
|
312
|
+
`),d)}catch(l){return D(l)}}},{name:"project_link",title:"A link for your client to send footage into a project",description:`Make a link for one client and one project. Send it to them: it downloads a small app named for you and the project ("Send to Stefan"); they double-click it, drop their Premiere/Avid/Resolve/Final Cut project on it, and it finds their media by the project's own paths, trims to the cut + handles and sends it into the project \u2014 no account, no folders to point at. Or, instead of Send, they press "Let <you> connect": the app serves the same trimmed cut from their machine peer to peer (nothing uploaded) and project action=show gives the ticket to mount it (delivery_fetch from=<ticket> as=mount \u2014 opening a clip fetches only what is read). action=create (project_id, label? e.g. 'Jen at Northlight', recipient_email?, expires_in_days? default 30, null = never) \xB7 revoke (project_id, link_id). Sends show up in project action=show.`,inputSchema:{action:h.enum(["create","revoke"]).default("create"),project_id:h.string(),link_id:h.string().optional(),label:h.string().optional(),recipient_email:h.string().optional(),expires_in_days:h.number().int().min(1).max(365).nullable().optional()},run:async({action:e,project_id:t,link_id:r,label:o,recipient_email:n,expires_in_days:i})=>{try{if(e==="revoke")return r?(await rt("v1-projects",`/v1/projects/${t}/links/${r}`,{method:"DELETE"}),Ae(`link ${r} turned off`)):D(new P("invalid_args","revoke needs link_id"));let{link:a}=await rt("v1-projects",`/v1/projects/${t}/links`,{body:{label:o,recipient_email:n,expires_in_days:i}});return z(`send this to your client: ${a.url}
|
|
313
|
+
(expires ${a.expires_at?.slice(0,10)??"never"}; project_link action=revoke link_id=${a.id} turns it off)`,{link:a})}catch(a){return D(a)}}},{name:"team",title:"Team: the org's seats and who is in it",description:"The org you belong to on conform.tools: everyone in it shares its projects (and their context) and rides on the owner's plan. action=list (members, seats used of the plan's cap, pending invites) \xB7 invite (email: they get an email to join; owner only, within the seat cap) \xB7 revoke (invite_id: a pending invite) \xB7 remove (profile_id: a member leaves the org; owner only).",inputSchema:{action:h.enum(["list","invite","revoke","remove"]),email:h.string().optional().describe("invite: who to invite"),invite_id:h.string().optional().describe("revoke: from action=list"),profile_id:h.string().optional().describe("remove: the member, from action=list")},run:async({action:e,email:t,invite_id:r,profile_id:o})=>{try{let n=(l,c={})=>rt("v1-orgs",l,c);if(e==="invite")return t?(await n("/v1/orgs/me/invites",{body:{email:t}}),Ae(`invited ${t}: they get an email to join your team`)):D(new P("invalid_args","invite needs email"));if(e==="revoke")return r?(await n(`/v1/orgs/me/invites/${r}`,{method:"DELETE"}),Ae(`invite ${r} revoked`)):D(new P("invalid_args","revoke needs invite_id (team action=list)"));if(e==="remove")return o?(await n(`/v1/orgs/me/members/${o}`,{method:"DELETE"}),Ae(`removed ${o} from the team`)):D(new P("invalid_args","remove needs profile_id (team action=list)"));let i=await n("/v1/orgs/me"),a=i.seatCap>=999?"unlimited":String(i.seatCap),s=i.members.map(l=>({profile_id:l.profile?.id,name:l.profile?.full_name??null,email:l.profile?.email??null,role:l.role}));return z([`${i.org?.name??"your team"} \u2014 ${i.seatsUsed} of ${a} seats${i.isOwner?" (you own it)":""}`,...s.map(l=>`- ${l.name??l.email} <${l.email}> ${l.role} \xB7 ${l.profile_id}`),...(i.pendingInvites??[]).map(l=>`- invited ${l.email} (until ${String(l.expires_at).slice(0,10)}) \xB7 invite ${l.id}`)].join(`
|
|
314
|
+
`),{org:i.org,is_owner:i.isOwner,seat_cap:i.seatCap,seats_used:i.seatsUsed,members:s,invites:i.pendingInvites??[]})}catch(n){return D(n)}}},{name:"delivery_fetch",long:!0,title:"Open a delivery: list it, fetch the .iso, cut trims from it, or mount it live",description:`A delivery is one .iso (media_deliver writes it). This reads one WHEREVER it is \u2014 from=a .iso path on this machine, a bucket delivery (bucket:<session id>, from media_deliver destination=bucket), or a peer's p2p_send ticket \u2014 the same way:
|
|
315
|
+
as=list: what it holds (files, sizes, how much of each is real bytes). as=iso: the whole image to out_path. as=trims: a folder at out_path in the delivery's own layout, each clip cut to the edit's frames + handles from the recipe the .iso carries; only reads the bytes the trims need (only=['A001C003'] or ['01_PROJECT_FILES'] keeps matching paths). as=mount (macOS): mount it now; from a bucket or a peer, opening a clip fetches only what is read; returns a job_id that keeps it mounted until job action=cancel. From a peer it says the path: direct (tens of MB/s on a good line) or through a relay when the two networks can't reach each other (a few MB/s: fine to browse and check shots, slow to play back hi-res); job action=status shows it live.
|
|
316
|
+
A peer's machine must stay on and serving. Long: background=true for a job id.`,inputSchema:{from:h.string().describe("A .iso path, bucket:<session id> (or the bare id), or a p2p_send ticket"),as:h.enum(["list","iso","trims","mount"]).default("list"),out_path:h.string().optional().describe("as=iso: the .iso to write; as=trims: the folder to write into"),only:h.array(h.string()).optional().describe("as=trims: keep only paths containing one of these"),background:h.boolean().default(!1).describe("Return a job id immediately; follow it with job action=status, cancel with job action=cancel")},run:async({from:e,as:t,out_path:r,only:o,__progress:n,__signal:i})=>{let a=await nt("conform-fetch-");try{let s=zv(e);if(t==="mount"){let c=await LO(s,a),u=Ds("delivery_fetch",async(f,m)=>{let p=c.status&&setInterval(()=>{let g=c.status();f(g.fetched,g.total,`${g.files} files \xB7 ${Nv(g.path)} \xB7 ${(g.rate/1e6).toFixed(1)} MB/s${g.error?` \xB7 ${g.error}`:""}`)},2e3);return await new Promise(g=>m.addEventListener("abort",()=>g())),p&&clearInterval(p),await c.stop(),await et(a),Ae(`unmounted ${c.mountpoint}`)});c.status&&await new Promise(f=>setTimeout(f,3e3));let d=c.status?.();return z(`mounted at ${c.mountpoint}${s.kind==="file"?"":" \u2014 clips fetch as they are read; files the sender adds while sharing appear in it"}`+(d?`
|
|
317
|
+
path: ${Nv(d.path)} (job action=status job_id=${u.id} shows it live, with MB/s)`:"")+`
|
|
318
|
+
job_cancel ${u.id} to unmount`,{mountpoint:c.mountpoint,job_id:u.id,...d?{path:d.path}:{}})}if(t==="iso"){if(!r)return D(new P("invalid_args","as=iso needs out_path (the .iso to write)"));if(s.kind==="file")return D(new P("invalid_args","that .iso is already on this machine"));let c=await zO(s,r,a,n,i);return z(`fetched ${(c/1e6).toFixed(1)} MB \u2192 ${r}`,{path:r,bytes:c})}if(t==="list"&&s.kind==="peer"&&!Cn(s.ticket).iso){let c=Cn(s.ticket),u=d=>`${(d/1e6).toFixed(1)} MB`;return z([`${c.label??"shared files"}: ${c.files.length} file(s), ${u(c.files.reduce((d,f)=>d+f.size,0))} \u2014 mount it, or as=iso to receive it whole`,...c.files.map(d=>`- ${d.name} ${u(d.size)}`)].join(`
|
|
319
|
+
`),{files:c.files,name:c.label??"shared files"})}let l=await ym(s,a);try{if(t==="list"){let u=await O_(l),d=f=>`${(f/1e6).toFixed(1)} MB`;return z([`${l.name}: ${u.files.length} file(s), ${d(u.image)} image${u.recipes?`, ${u.recipes} edit(s) in it (trims available)`:" (no recipe: trims come out as stored)"}`,...u.files.map(f=>`- ${f.name} ${d(f.size)}${f.recorded<f.size?` (${d(f.recorded)} real \u2014 the cut's frames)`:""}`)].join(`
|
|
320
|
+
`),{...u,name:l.name})}if(!r)return D(new P("invalid_args","as=trims needs out_path (the folder to write into)"));let c=await M_(l,r,{only:o,onProgress:n,signal:i});return z([`wrote ${c.files} file(s), ${(c.bytes/1e6).toFixed(1)} MB of trims \u2192 ${r}`,...c.untrimmed.length?["not trimmed (written as stored):",...c.untrimmed.map(u=>` - ${u}`)]:[]].join(`
|
|
321
|
+
`),c)}finally{await l.close()}}catch(s){return D(s)}finally{t!=="mount"&&await et(a)}}},{name:"media_deliver",protectedStages:["write"],long:!0,title:"Deliver a package: folder, .iso, into your bucket, or peer to peer",description:`The app's i2o delivery, on this machine: the conform package a colourist or VFX house receives. Layout: 01_PROJECT_FILES/source (the original timeline), 01_PROJECT_FILES/converted (the requested host timelines, media paths rewritten to the package), 02_MEDIA (every used source trimmed byte-exact to the used frames + handles; RED clips as .RDC bundles), 03_REFERENCES.
|
|
322
|
+
destination=folder writes that tree into out_path. destination=iso writes ONE sparse UDF image (mountable on macOS/Windows/Linux; only the cut's frames are real bytes) at out_path, with its recipe inside so trims can be cut from any copy of it later (delivery_fetch as=trims).
|
|
323
|
+
destination=bucket puts that .iso into the org's OWN bucket (bring-your-own bucket, set up on conform.tools) as a delivery the web inbox lists: blocks an earlier delivery in that bucket already holds are copied there server-side instead of uploaded. Returns bucket:<id> for delivery_fetch / add_to; recipients=[emails] are notified.
|
|
324
|
+
destination=p2p serves that .iso from this machine to one recipient over Iroh (no upload, no bucket): returns a ticket for their delivery_fetch (mount it live, cut trims, or take the .iso) and a job_id that serves until job action=cancel.
|
|
325
|
+
add_to=<a .iso path or bucket:<id>> adds this delivery INTO an earlier one instead (any destination=iso|bucket): only what it lacks goes in \u2014 a clip's new frames, new clips into their folder, a changed timeline beside the old one as name_v2 \u2014 so a re-cut costs only its new frames; in a bucket only those bytes are uploaded.
|
|
326
|
+
Only linked references ship (run timeline_relink first). A clip that cannot be trimmed is reported and NEVER shipped whole. timeline_formats picks which host timelines ride along, e.g. ['resolve-drt','avid-avb'] (default resolve-drt).`,inputSchema:{session_id:h.string(),destination:h.enum(["folder","iso","bucket","p2p"]),out_path:h.string().optional().describe("folder: where to write; iso: the .iso path; bucket/p2p: optional \u2014 also keep the .iso here"),add_to:h.string().optional().describe("An earlier delivery to add this one into: a .iso path or bucket:<session id>"),recipients:h.array(h.string()).optional().describe("destination=bucket: emails to notify"),label:h.string().optional().describe("destination=bucket: the delivery's name in the inbox (default: the volume name)"),volume_name:h.string().optional().describe("Package / volume name; default from the source file"),handles:h.number().int().min(0).default(24),preserve_structure:h.boolean().default(!1).describe("Mirror the sources' parent folders under 02_MEDIA"),timeline_formats:h.array(h.string()).default(["resolve-drt"]),only_linked:h.boolean().default(!0)},run:async({session_id:e,destination:t,out_path:r,add_to:o,recipients:n,label:i,volume_name:a,handles:s,preserve_structure:l,timeline_formats:c,only_linked:u,__progress:d,__signal:f})=>{try{let m=await Fe(e),p={volume_name:a,handles:s,preserve_structure:l,timeline_formats:c,only_linked:u},g=y=>`${(y/1e6).toFixed(1)} MB`;if(t==="folder"){if(o)return D(new P("invalid_args","add_to adds into a .iso: use destination=iso or bucket"));if(!r)return D(new P("invalid_args","out_path is required"));let y=await gP(m.session,m.source_path,{...p,out_path:r});await ht(m,`deliver folder \u2192 ${r}`);let b=await Ms("delivery-qc",y.keys);return Ae(`${y.text}${b?`
|
|
327
|
+
|
|
328
|
+
Reading this delivery (conform.tools playbook):
|
|
329
|
+
${b}`:""}`)}let _=await nt("conform-deliver-"),v=!1;try{let y=r&&!o?r:M(_,`${a??B(m.source_path,Kt(m.source_path))}.iso`);d?.(0,0,"building the .iso");let b=await bP(m.session,m.source_path,{...p,out_path:y}),w=b.text.split(`
|
|
330
|
+
`).filter(x=>!x.startsWith("wrote ")&&!x.startsWith("- ")).join(`
|
|
331
|
+
`);if(o){let x=zv(o),S=await FO(x,b.path,{onProgress:d,signal:f});return await ht(m,`deliver add_to \u2192 ${o}`),z(`added into ${o}: ${g(S.bytes)} in ${S.filled} range(s)${S.added.length?`
|
|
332
|
+
new: ${S.added.filter(R=>!R.startsWith(".conform/")).join(", ")}`:""}${S.versioned.filter(R=>!R.startsWith(".conform/")).length?`
|
|
333
|
+
changed, added beside the old: ${S.versioned.filter(R=>!R.startsWith(".conform/")).join(", ")}`:""}${S.bytes===0?`
|
|
334
|
+
(nothing new \u2014 this delivery was already in it)`:""}`+`${S.uploaded!==void 0?`
|
|
335
|
+
bucket: uploaded ${g(S.uploaded)}, copied ${g(S.copied??0)} server-side; the delivery is now ${g(S.image)}`:""}
|
|
336
|
+
|
|
337
|
+
${w}`.trimEnd(),S)}if(t==="iso"){await ht(m,`deliver iso \u2192 ${b.path}`);let x=await Ms("delivery-qc",b.keys);return Ae(`${b.text}${x?`
|
|
338
|
+
|
|
339
|
+
Reading this delivery (conform.tools playbook):
|
|
340
|
+
${x}`:""}`)}if(t==="bucket"){let x=await NO(b.path,{label:i,recipients:n,onProgress:d,signal:f});return await ht(m,`deliver bucket \u2192 ${x.session_id}`),z([`delivered to your bucket as bucket:${x.session_id} (${g(x.image)} image): uploaded ${g(x.uploaded)}${x.copied?`, ${g(x.copied)} already in ${x.reused_from} earlier deliver${x.reused_from===1?"y":"ies"} \u2014 copied there server-side, not uploaded`:""}`,`it is in the conform.tools inbox; delivery_fetch from=bucket:${x.session_id} lists it, cuts trims or mounts it${n?.length?`; ${n.join(", ")} notified`:""}`,...r?[`kept a copy at ${b.path}`]:[],"",w].join(`
|
|
341
|
+
`).trimEnd(),x)}let k=await Fv([b.path]);v=!r;let I=Ds("media_deliver",async(x,S)=>(await new Promise(R=>{S.addEventListener("abort",()=>R()),k.closed.then(R)}),k.stop(),v&&await et(_),Ae("stopped serving")));return await ht(m,`deliver p2p (${I.id})`),z(`serving ${B(b.path)} (${g(b.bytes)}) peer to peer as ${I.id} \u2014 job action=cancel job_id=${I.id} to stop
|
|
342
|
+
ticket for the recipient's delivery_fetch (as=mount to watch it now, as=trims, or as=iso): ${k.ticket}
|
|
343
|
+
|
|
344
|
+
${w}`.trimEnd(),{ticket:k.ticket,job_id:I.id})}finally{v||await et(_)}}catch(m){return D(m)}}},{name:"timeline_judge",hidden:!0,repoOnly:!0,title:"Judge a written timeline against its source",description:"Law-backed check of a written timeline file against the source it came from: the same timing, sizing, link and content judges that run on every production conversion, using each host's decoded rules. Pass the source file and the written file (e.g. the AAF you read and the .drt you wrote). Returns a verdict (clean / issues), the reasons, per-tier tallies and the clips with issues. Judged formats: prproj, drt, xmeml, aaf, avb, flame. Use after timeline_write when the user asks whether the conversion is right, or before delivering.",inputSchema:{source_path:h.string().describe("The original timeline file"),output_path:h.string().describe("The written timeline file to judge")},run:async({source_path:e,output_path:t})=>{try{return Ae(await j0(e,t))}catch(r){return D(r)}}},{name:"timeline_autoconform",long:!0,protectedStages:["canonicalize"],title:"Auto conform a reference to source media",description:`Rebuild a cut from a reference render, in the analysis engine (one native process): every frame of the reference and the pool as a small luma grid at each codec's cheapest tier, one alignment of the whole reference against the pool (grade-proof take codes name the clip, motion names the frame), each shot matched whole in its own framing (punch-ins, flops, retimes, ramps), every placement pinned by one sharp frame check, the production sound for what the picture can't settle, each shot's sizing measured (keyframed moves too), and a new timeline session at the reference's raster and rate with markers on every issue (gap, unresolved, ambiguous, xml). reference: the cut's render (ProRes, H.264, HEVC, or a camera original). pool: folders and/or files of source media (mov/mp4/r3d/mxf/braw/ari/crm; spanned RED = one clip). hints_session_id: an editor's timeline of the same cut \u2014 CHECKED, never believed: each claim is pinned from its own take and in-point, only what the claims that hold leave unexplained is searched (nearest takes first), and every claim not kept as written is reported ("the timeline has A at 120, the picture matches B at 133"). With a good timeline nothing is searched at all. trust=true (with hints_session_id): the Aligner \u2014 the timeline's takes and in-points stand as written and only the sizing is measured (Baselight-style: the clips have the right TC, match the framing, keyframed moves included). Returns a session_id for timeline_write plus the coverage stats and the issue list. H.264/HEVC decode with the OS's own decoder (macOS today).`,inputSchema:{reference:h.string().describe("Path to the reference render of the cut (ProRes, H.264, HEVC, or a camera original)"),pool:h.array(h.string()).min(1).describe("Folders and/or media files to search"),hints_session_id:h.string().optional().describe("Session id of the editor's timeline for this cut, if you have one"),trust:h.boolean().optional().describe("With hints_session_id: keep the timeline's takes and in-points as written and measure only the sizing (the Aligner)"),reference_audio:h.string().optional().describe("The reference's sound from another file (a .wav beside a picture-only render)"),display_transform:h.boolean().optional().describe("Decode camera originals display-referred (Log \u2192 Rec.709/2.4 through the Color Space Transform) to match a GRADED reference. Experimental; X-OCN today"),sizing:h.boolean().optional().describe("Measure each placed shot's scale/position/rotation/mirror (default on; shots it cannot measure are left at 100 % and flagged)"),name:h.string().optional().describe("Timeline name"),background:h.boolean().default(!1).describe("Return a job id immediately; follow it with job action=status, cancel with job action=cancel")},run:async({reference:e,pool:t,hints_session_id:r,trust:o,reference_audio:n,display_transform:i,sizing:a,name:s,__progress:l,__signal:c})=>{try{if(o&&!r)throw new P("invalid_args","trust keeps a timeline's in-points: give hints_session_id");let u=r?(await Fe(r)).session:void 0,d=await Xd({reference:e,pool:t,hints:u,trust:o,reference_audio:n,display_transform:i,sizing:a,name:s,onProgress:l,signal:c}),f=await Xt(d.session,e,"autoconform");await yl(f.id,qd,d.rebuild);let m=await Ms("auto-conform",iA(d)),p=ta(d.rebuild).length;return Ae(`session_id: ${f.id}
|
|
345
|
+
${aA(d)}
|
|
346
|
+
${await Un(d.session)}`+(p?`
|
|
347
|
+
|
|
348
|
+
${p} shot(s) the engine was unsure of: timeline_autoconform_review session_id=${f.id} shows each with a contact sheet to accept or reject.`:"")+(m?`
|
|
349
|
+
|
|
350
|
+
Reading this result (conform.tools playbook):
|
|
351
|
+
${m}`:""))}catch(u){return D(u)}}},{name:"media_cuts",long:!0,title:"Find the cuts in a movie (scene detection)",description:"Every shot boundary of a movie, from the analysis engine's one cut detector (a cut is a spike in the frame-to-frame change against the frames around it; going to or from black is a cut, black to black is not; a jump within one take counts when it stands far over the change around it), plus its black runs. Returns the shots with source timecode and a session_id of the movie cut at every shot (one clip per shot, the movie as its source) for timeline_write to any host \u2014 the cut-up an editor imports to re-edit or conform a flat render. Measured against authored cuts with an exact answer key (bench/cuts-bench.ts). Reads the grid index the conform builds, so a file already conformed is instant.",inputSchema:{path:h.string().describe("The movie (a render, a reference, a camera original)"),name:h.string().optional().describe("Name of the cut-up timeline (default: <file> cuts)"),background:h.boolean().default(!1).describe("Return a job id immediately; follow it with job action=status")},run:async({path:e,name:t,__progress:r})=>{try{let o=await hA(e,t,r),n=await Xt(o.session,e,"cuts");return z(`session_id: ${n.id}
|
|
352
|
+
${o.text}`,{session_id:n.id,...o.data})}catch(o){return D(o)}}},{name:"media_sync",long:!0,title:"Sync dailies: each picture file's sound found in the sound recorder's files",description:"Dailies sound sync in the analysis engine: every picture file's scratch track is found in the production sound recorder's WAVs (spectral landmarks, then the waveform lined up to the sample \u2014 it survives a different microphone, level and room). The sound decides and the timecode confirms: where camera and recorder both carry timecode (BWF time reference), how far they disagree is reported in frames (a jam to fix); a file with no scratch sound, or too quiet to match, is placed by timecode alone and says so. Returns, per picture file, the recorder file, the sync (recorder seconds / samples / timecode at the picture's first frame) and how it was found, plus a session_id of the dailies: every picture file whole on V1 in timecode order with its recorder file laid under it at the sync, one audio track per channel \u2014 for timeline_write to any host. Pinned by an authored test with an exact answer (rust/analysis-core/tests/sync_planted.rs).",inputSchema:{picture:h.array(h.string()).min(1).describe("Picture files or folders (camera originals, proxies), searched recursively"),sound:h.array(h.string()).min(1).describe("The sound recorder's WAVs or folders of them, searched recursively"),name:h.string().optional().describe("Name of the dailies timeline"),background:h.boolean().default(!1).describe("Return a job id immediately; follow it with job action=status")},run:async({picture:e,sound:t,name:r,__progress:o})=>{try{let n=await bA({picture:e,sound:t,name:r},o),i=await Xt(n.session,t[0],"sync");return z(`session_id: ${i.id}
|
|
353
|
+
${n.text}`,{session_id:i.id,...n.data})}catch(n){return D(n)}}},{name:"qc_media",long:!0,title:"QC of a movie: frames, edges, pixels, sound",description:"QC of one file, picture and sound, in the analysis engine: every frame for doubled frames inside motion, freezes, black flashes and black segments mid-program, and flash frames (one frame far from both neighbours that match each other; 4+ in 2 s is a strobe, reported to check); every frame's edges at full resolution for blanking (a flat-black line on any edge, 1 px counts) and black corners; and stuck / hot / dead pixels across 24 frames spread over the file (a pixel that holds one value while the picture around it moves). Sound, every audio track: integrated loudness (BS.1770) and true peak, clipping (runs at full scale), dropouts (digital silence cut into sound), a silent channel beside live ones, DC offset, a stereo pair out of phase. Verdict PASS / CHECK / FAIL with each finding at source timecode. Heads and tails (leaders, holds) are reported as information, not failures. edges_every N reads every Nth frame's edges instead of all (faster on long programs).",inputSchema:{path:h.string().describe("The file to QC (a deliverable render, a master)"),edges_every:h.number().int().min(1).max(240).optional().describe("Check the edges of every Nth frame (default 1: all)"),background:h.boolean().default(!1).describe("Return a job id immediately; follow it with job action=status")},run:async({path:e,edges_every:t,__progress:r})=>{try{let o=await gA(e,{edges_every:t},r);return z(o.text,o.data)}catch(o){return D(o)}}},{name:"timeline_autoconform_review",title:"Review the shots auto conform was unsure of",description:"After timeline_autoconform: the shots the engine could not confirm, each with an A/B contact sheet (top row = the reference, bottom = the guessed source clip, five frames across the shot) returned as images. gap_guess = left as a gap, with the engine's best guess; doubtful = placed, but the in-point or the take is in doubt. Look at each sheet and settle only what you are sure of: accept=[ref_start] places a gap's guess, reject=[ref_start] turns a doubtful placement into a gap. Same set, different moment or a near-identical take of the same setup: leave it and name it to the artist. Rebuilds the session from the engine's own result (no re-run); then timeline_write. offset/limit page through the sheets (4 per call).",inputSchema:{session_id:h.string().describe("The session timeline_autoconform returned"),accept:h.array(h.number().int()).optional().describe("ref_start of each gap_guess to place"),reject:h.array(h.number().int()).optional().describe("ref_start of each doubtful shot to turn into a gap"),offset:h.number().int().min(0).optional().describe("First review shot to show (default 0)"),limit:h.number().int().min(0).max(12).optional().describe("Contact sheets per call (default 4; 0 = list only)")},run:async e=>{try{let t=await rA(e),{images:r,...o}=t;return{...z(oA(t),{...o,session_id:e.session_id}),images:r}}catch(t){return D(t)}}},{name:"qc_compare",long:!0,title:"Compare two versions of a cut and rebuild the new one from the old",description:"Reference Compare: rebuild a new render of a cut (B) from the old one (A) and say what changed: frames inserted, removed, moved, replaced, held, reversed or retimed. It is an auto conform of B with A as the only source (the analysis engine), so it is perceptual (survives a regrade or a re-render), takes any codec and resolution either side, and places every frame of B on A's own frame with its timing: a freeze, a reverse, a retime at its speed, a ramp as its curve. Builds the reconform: A-source events + holes of new material tiling B (motion effects as CMX3600 M2); events the engine wants an eye on are flagged CHECK. Writes a CMX3600 EDL and/or CSV when given paths, and returns a session of B rebuilt from A's media (session_id, for timeline_write). Use for a re-cut after colour ('what changed in v3?'), checking a deliverable against the approved version, or reconforming changes into a graded timeline. Long: background=true for a job id.",inputSchema:{a:h.string().describe("Path to the OLD version (whose media and grade exist)"),b:h.string().describe("Path to the NEW version, to rebuild from A"),edl_path:h.string().optional().describe("Write the reconform as a CMX3600 EDL here"),csv_path:h.string().optional().describe("Write the reconform events as CSV here")},run:async({a:e,b:t,edl_path:r,csv_path:o,__progress:n,__signal:i})=>{try{let a=await vA({a:e,b:t,onProgress:n,signal:i});r&&await ge(r,a.edl),o&&await ge(o,a.csv);let s=await Xt(a.session,t,"reconform"),l=[`session_id: ${s.id} (B rebuilt from A; timeline_write it to any host)`,...r?[`EDL: ${r}`]:[],...o?[`CSV: ${o}`]:[],wA(a,{a:e,b:t})].join(`
|
|
354
|
+
`);return z(l,{session_id:s.id,summary:a.summary,stats:a.stats,events:a.events.map(c=>({index:c.index,kind:c.kind,record:[c.recordInTc,c.recordOutTc],...c.aInTc?{a:[c.aInTc,c.aOutTc]}:{},...c.motion?{speed:c.motion.ramp?"ramp":c.motion.percent}:{}})),check:a.check.map(c=>({index:c.index,record:[c.recordInTc,c.recordOutTc],note:c.unreproducible.note}))})}catch(a){return D(a)}}},{name:"render_gate",title:"Check a timeline before a deliverable render",description:"Run BEFORE every deliverable render. From the read timeline and the mix WAVs (placed by their BWF timecode): the program start (the mix's 2-pop + 2 s, else program_start, else the artist profile's, else the picture's first frame), picture end vs the mix's last sound (any difference, even 1 frame, is an EDIT ERROR: fix or ask, never cut at picture), picture/mix starting late, the last program frame (picture, not a gap), gaps inside the program, video layers ending just short of the end, and the deliverable name's audio promise (8CH_5-1_STEREO = 6ch + 2ch) vs the mix files. Returns READY/STOP and the Mark In/Out to render with (Out inclusive). Then render (host_render, audio_tracks for the output routing) and qc_deliverable the file.",inputSchema:{session_id:h.string().describe("The timeline (timeline_read / host_current)"),mix:h.array(h.string()).optional().describe("The mix WAV(s); the first sets the program length"),program_start:h.string().optional().describe("Program start TC when the mix has no 2-pop (default: the artist profile's program_start)"),name:h.string().optional().describe("The deliverable file name about to be rendered"),timeline_id:h.string().optional()},run:async({session_id:e,...t})=>{try{let r=await rE((await Fe(e)).session,t);return z(oE(r),{...r})}catch(r){return D(r)}}},{name:"qc_deliverable",long:!0,title:"Sign off a deliverable render",description:"QC a rendered deliverable before it goes out, PASS/FAIL per check: codec/raster/rate/bit depth/chroma (when given), start TC (mark_in, start_tc or the artist profile's program_start; else reported only) and frame count (mark_in..mark_out inclusive, or frames), the file name against the facility naming profile and against the file itself (codec, raster, colour tags, audio channels), black at the head/tail with its length (WARN; end_on_picture=true makes tail black FAIL), audio per output track (channels, integrated loudness, true peak; AAC included) and against the mix WAVs (each track must match one mix within 0.5 LU: +6 LU = summed twice, an unmatched mix = missing bus), and picture vs the approved REF (frame-exact at the render's start TC; burn-ins and a regrade do not count as differences). Use after every deliverable render. Long: background=true for a job id.",inputSchema:{path:h.string().describe("The rendered deliverable"),mark_in:h.union([h.string(),h.number().int()]).optional().describe("Timeline Mark In (TC or frame): the expected start TC"),mark_out:h.union([h.string(),h.number().int()]).optional().describe("Timeline Mark Out, INCLUSIVE: with mark_in, the expected frame count"),start_tc:h.string().optional().describe("Expected start TC when there is no mark_in (default: the artist profile's program_start)"),frames:h.number().int().positive().optional().describe("Expected frame count"),codec:h.string().optional().describe("e.g. 'ProRes 4444', 'ProRes 422 HQ', 'H.264'"),width:h.number().int().positive().optional(),height:h.number().int().positive().optional(),fps:h.number().positive().optional(),bit_depth:h.number().int().optional(),chroma:h.string().optional().describe("e.g. 4:4:4"),channels:h.number().int().min(0).optional().describe("Total audio channels expected"),loudness_lufs:h.number().optional().describe("Target integrated loudness per track (e.g. -24)"),loudness_tolerance:h.number().positive().optional().describe("\xB1 LU (default 1)"),true_peak:h.number().optional().describe("True-peak ceiling, dBTP (e.g. -2)"),mix:h.array(h.string()).optional().describe("The mix WAVs / stems the audio outputs must carry"),ref:h.string().optional().describe("The approved reference movie"),ref_in:h.union([h.string(),h.number().int()]).optional().describe("The REF's TC/frame for the render's first frame (default the render's start TC)"),name:h.boolean().optional().describe("Check the name against the naming profile (default true)"),end_on_picture:h.boolean().optional().describe("The program ends on its end card: any black at the tail FAILS (default: WARN with its length)")},run:async({__progress:e,__signal:t,...r})=>{try{let o=await eE(r);return z(tE(o),{...o})}catch(o){return D(o)}}},{name:"patch_plan",title:"Plan patch renders for changed shots",description:"Work out the patches to re-render for changed shots on a read timeline (a session from host_current / timeline_read), before anything is queued. Each patch runs from the head of the WHOLE clip before the change to the tail of the WHOLE clip after it, cut on existing edits of the picture as it plays (the topmost enabled video layer), never inside a lower third/title (graphics tracks, by name) or a transition; contiguous changes share one patch. Says the neighbouring clips, whether TEXTLESS is needed (a graphics track has content in range \u2192 TEXTED + TEXTLESS, with the tracks to leave out of TEXTLESS), picture only, file TC = record TC of the head. Returns host_render-ready ranges (absolute frames, inclusive) plus record TC. Give master (a delivered file's name) to get each patch's file name, render job name and folder from the naming profile. Read-only.",inputSchema:{session_id:h.string(),changes:h.array(h.union([h.string(),h.object({in:h.union([h.string(),h.number()]),out:h.union([h.string(),h.number()])})])).min(1).describe("The changed shots: clip item_ids (timeline_query), or record ranges {in, out} as record TC or absolute timeline frames, out inclusive"),timeline_id:h.string().optional().describe("The timeline (default the session's first with video)"),master:h.string().optional().describe("A delivered master's file name (or path) to name the patches from (naming profile)"),first_patch:h.number().int().min(1).default(1).describe("Number of the first patch (PATCH01)")},run:async({session_id:e,changes:t,timeline_id:r,master:o,first_patch:n})=>{try{let i=await Fe(e),a=fE(i.session,t,{timeline_id:r,first_patch:n}),s=pE(a);if(o){let l=await po(),c=new Date,u=a.patches.map(f=>f.versions.map(m=>({text:m,...Gy(l,o,{nn:f.nn,text:m,when:c})})));s+=`
|
|
355
|
+
`+u.flat().map(f=>`name ${f.file}${f.job?` job ${f.job}`:""} \u2192 ${f.folder}`).join(`
|
|
356
|
+
`);let d=[...new Set(u.flat().flatMap(f=>f.warnings))];return d.length&&(s+=`
|
|
357
|
+
`+d.map(f=>`warning: ${f}`).join(`
|
|
358
|
+
`)),z(s,{...a,names:u})}return z(s,{...a})}catch(i){return D(i)}}},{name:"media_frame",title:"Grab frames from a media file",description:"Decode a frame of a media file to a PNG on this machine (our own decoders: ProRes, DNx, H.264/HEVC, MXF, camera originals, stills \u2014 exr/dpx/tiff/jpg/png/dng/cr3, scaled with width=; never uploads). frame is a frame index (0 = first) or an ABSOLUTE source timecode (the file's start TC is honoured); default the middle frame. around=N makes a contact sheet of the frames \xB1N (every step-th), each labelled with its TC \u2014 check a shot change, not one middle frame. b = a second file: A/B rows of the same frames (b_frame defaults to the same absolute TC; give it when the TC bases differ) with a perceptual difference score per column (survives a regrade, burn-in/watermark, rescale). Prove a frame offset with media_align. session_id + item_id / record grabs the source frame under a timeline position (returns the source file, frame and TC it resolved to). Writes out_path (.png) or a temp file; returns the path \u2014 open it to look.",inputSchema:{path:h.string().optional().describe("The media file; or session_id + item_id / record for the source frame under a timeline position"),session_id:h.string().optional().describe("Through a session: the source file and frame under item_id (record moves inside it) or under record (the topmost enabled video clip); the clip must be linked (timeline_relink first)"),item_id:h.string().optional(),record:h.union([h.string(),h.number().int()]).optional().describe("With session_id: record TC like 01:00:10:00, or frames from the timeline head"),timeline:h.string().optional().describe("With session_id: timeline id or name (default the primary)"),frame:h.union([h.string(),h.number().int()]).optional().describe("Frame index or absolute source TC like 01:00:10:00; default the middle frame"),around:h.number().int().min(0).max(48).optional().describe("Contact sheet: \xB1N frames around frame"),step:h.number().int().min(1).optional().describe("Contact sheet: every Nth frame (default 1)"),b:h.string().optional().describe("A second file for A/B (e.g. the master against the temp)"),b_frame:h.union([h.string(),h.number().int()]).optional().describe("B's frame or TC for A's frame; default the same absolute TC"),width:h.number().int().min(16).max(8192).optional().describe("Output width per frame (default full size; 480 per tile on a sheet)"),out_path:h.string().optional().describe("PNG to write; default a temp file")},run:async({session_id:e,item_id:t,record:r,timeline:o,...n})=>{if(e)return an("timeline_frame").run({session_id:e,item_id:t,record:r,timeline:o,...n});if(!n.path)return D(new P("invalid_args","media_frame needs path, or session_id with item_id / record"));try{let i=await ha(n);return z(Cm(i),{...i})}catch(i){return D(i)}}},{name:"timeline_frame",hidden:!0,title:"Grab the source frame under a timeline position",description:"media_frame through a session: the source file and frame under an item (item_id; record moves inside it) or under a record TC (the topmost enabled video clip there), decoded to a PNG; around=N for a contact sheet. Returns the file, source frame and TC it resolved to. The clip must be linked (timeline_relink first).",inputSchema:{session_id:h.string(),item_id:h.string().optional(),record:h.union([h.string(),h.number().int()]).optional().describe("Record TC like 01:00:10:00, or frames from the timeline head"),timeline:h.string().optional().describe("Timeline id or name (default the primary)"),around:h.number().int().min(0).max(48).optional(),step:h.number().int().min(1).optional(),width:h.number().int().min(16).max(8192).optional(),out_path:h.string().optional()},run:async({session_id:e,item_id:t,record:r,timeline:o,...n})=>{try{let i=await Fe(e),a=y0(i.session,{item_id:t,record:r,timeline:o}),s=await ha({...n,path:a.path,frame:a.frame});return z(`record ${a.record_tc} (${a.track}, item ${a.item}) = ${B(a.path)} frame ${a.frame} (${s.frames[s.frames.length>>1]?.tc??"?"})
|
|
359
|
+
${Cm(s)}`,{...s,source:a})}catch(i){return D(i)}}},{name:"timeline_align",long:!0,title:"Match each clip's framing to a reference track",description:"The Aligner: for every clip on the target video tracks that sits over a clip of the REFERENCE track (an offline, a client render, the graded master), the reference's picture and the clip's raw source frame at the same record frame are fitted in the analysis engine (the sizing auto conform uses), and the clip's WHOLE transform comes back \u2014 scale, position, rotation, flips \u2014 in IR units and as Resolve edit-page properties (Pan, Tilt, ZoomX, ZoomY, RotationAngle, FlipX, FlipY in its scripting API's units). Verdict per clip: aligned / animated (samples \u2265 2 and the framing moves: the clip is then measured on EVERY frame, each frame's answer in `keys`, and written as the fewest keyframes on Resolve's own ease (Dissolve Type) that stay within 1 px at rest and half a frame of timing while it moves \u2014 `grade_keys`, for sizing_target input / node one keyframed Colour-page op (`grade_keys` on Resolve's Dissolve-Type ease); for edit an `edit_keys` op (`edit_keys` on Resolve's Edit-page Bezier law), keyed on a copy of the timeline, '<timeline> ALIGNED', as Resolve's API cannot keyframe the Edit page) / no_match (another shot or moment; confidence = the fit's agreement 0\u20131, trusted from 0.4) / refused (not linked, no reference under it, the reference clip itself resized). Returns host_apply ops: `properties` for every aligned clip and a marker per clip (data \"ConformTools:align\"); apply them with host_apply on the live timeline (host_current via=export it first, timeline_relink so the media is linked). apply_session writes the aligned transforms into the session (timeline_write / host_open builds a <TL>_ALIGNED). Resolve units assume the timeline's input scaling 'fit' (Scale entire image to fit); pass input_scaling for fill / crop / stretch. sizing_target says where the framing goes in Resolve: edit (default) = the Edit page transform (`properties` ops); input = the Color page's clip Input Sizing, node = the Sizing of node 1 (`grade_sizing` ops, written as a grade .drx). input / node leave the clip's own edit transform (the client XML's) untouched and carry only the correction on top of it, so the cut goes back to Premiere without the aligner's resizes; input ADDS the sizing to the clip's grade as it stands (every node and version kept) on a new local version 'conform.tools aligned', leaving the colourist's own version untouched (undo goes back to it); node writes Sizing into the chosen node of that same kept grade (a node that already has Sizing of its own is refused); a clip on a REMOTE grade version (shared by every use of that source clip, in every timeline) is first moved onto its local version, so the other uses never change. Node sizing has no flip and cannot show picture outside the clip's own fitted raster.",inputSchema:{session_id:h.string(),reference_track:h.union([h.number().int().positive(),h.literal("offline")]).optional().describe(`The reference's video track, 1-based (V1 = 1), or "offline" = the timeline's linked offline reference clip. Leave out: a track named REF / REFERENCE / OFFLINE, else the top video track`),tracks:h.array(h.number().int().positive()).optional().describe("Video tracks to align (default: every other video track)"),timeline_id:h.string().optional().describe("Timeline id or name (default the primary)"),samples:h.union([h.number().int().min(1).max(600),h.literal("all"),h.literal("half"),h.literal("ends")]).optional().describe('Frames measured per clip to SEE a move: "ends" = the first and last frames and the quarters between (a move shows as them disagreeing, even one that returns to where it started), "half" = every half second and the last frame (the default), a count spread over it, or "all" = every frame (up to 600 per clip; the static answer is the median of the trusted frames). A clip they show moving is measured on every frame anyway'),step:h.number().int().min(1).optional().describe("Measure every step-th frame instead (12 = every half second at 24 fps)"),scope:h.enum(["all","playhead","selected"]).optional().describe("Which clips: all (default), the clip under `at`, or the `picks`"),at:h.number().int().optional().describe("scope playhead: the record frame (from the timeline start)"),picks:h.array(h.string()).optional().describe('scope selected: "track:start" of each clip (video track, record start in frames from the timeline start)'),input_scaling:h.enum(jm).optional().describe("Resolve's input scaling for the clips (default fit)"),apply_session:h.boolean().optional().describe("Write the aligned transforms into the session"),markers:h.boolean().optional().describe("Include marker ops (default true)"),sizing_target:h.enum(N0).optional().describe("Where the framing goes in Resolve: edit (Edit page transform, default), input (Color page Input Sizing) or node (node 1 Sizing)"),node:h.union([h.number().int().positive(),h.string(),h.object({layer:h.number().int().positive(),node:h.union([h.number().int().positive(),h.string()])})]).optional().describe("node: which node gets the Sizing \u2014 its number as Resolve shows it, or its label (default 1), or {layer, node}. The clip's grade goes onto a new local version 'conform.tools aligned', every node kept, the colourist's version untouched"),layer:h.number().int().positive().optional().describe("node: which node stack `node` is in (1 = the first; default 1)"),background:h.boolean().default(!1).describe("Return a job id immediately; follow it with job action=status")},run:async({session_id:e,__progress:t,__signal:r,...o})=>{try{let n=await Fe(e),i;if(n.source_format==="drt"&&n.source_path&&await Ge(n.source_path)){i=new Map;let s=H0(await ut(n.source_path));for(let[l,c]of s)if(c.active){let u=W0(c.active);u.length&&i.set(l,u)}}let a=await F0(n.session,{...o,inputs:i},t,r);return o.apply_session&&a.applied&&await ht(n,`timeline_align: ${a.applied} transform(s) from V${a.reference_track}`),z(L0(a),{...a,session_id:e})}catch(n){return D(n)}}},{name:"qc_blanking",long:!0,title:"Find clips whose sizing shows black",description:"The Blanking Detector on a session: every clip's placement (its IR transform at each frame: scale, position, rotation, anchor, crop, over the source's fit) checked for black inside the delivery frame \u2014 the whole raster, or with `aspect` the centred delivered ratio (16:9, 1.85, 2.00, 2.20, 2.35, 2.39, 2.76, 4:3, 1:1, 9:16, none, or a number), so the deliverable's own bars are never a finding. pixels=true also decodes `samples` source frames per clip in the analysis engine and measures the source's own black edges (QC's edge rule): a letterbox baked into a source and revealed by a pull-out is caught too. Each frame is judged on the topmost enabled clip; findings are ranges (strictness strict 1 px / 1 frame \u2014 default, standard 2 px / 2 frames, relaxed 6 px / 4 frames) with depth per edge, zones, and the least zoom that fills the frame (about the clip's anchor, position kept). Returns host_apply ops: a ZoomX/ZoomY `properties` fix per clip (a keyframed clip gets markers only) and a marker per range (data \"ConformTools:blanking\").",inputSchema:{session_id:h.string(),timeline_id:h.string().optional().describe("Timeline id or name (default the primary)"),aspect:h.union([h.enum(Object.keys(Ol)),h.number().positive(),h.string()]).optional().describe("Delivered aspect when bars are part of the deliverable (default none: the whole raster)"),strictness:h.enum(Object.keys(ma)).optional(),pixels:h.boolean().optional().describe("Also measure the sources' own black edges on decoded frames (needs linked media)"),samples:h.number().int().min(1).max(12).optional().describe("pixels: source frames measured per clip (default 3)"),input_scaling:h.enum(jm).optional().describe("Resolve's input scaling, for the zoom fix's units (default fit)"),markers:h.boolean().optional().describe("Include marker ops (default true)"),background:h.boolean().default(!1).describe("Return a job id immediately; follow it with job action=status")},run:async({session_id:e,__progress:t,__signal:r,...o})=>{try{let n=await Fe(e),i=await z0(n.session,o,t,r);return z(U0(i),{...i,session_id:e})}catch(n){return D(n)}}},{name:"patch_verify",long:!0,title:"Verify a rendered patch against the delivered master",description:"Check a rendered patch against the master it patches: spec (codec, ProRes profile, pixel format, bit depth, raster, frame rate, colour tags), frame count, start TC = the record TC, picture only, then the picture frame by frame against the master at the same TC (every frame; per-frame mismatches with their TC and difference, plus the patch's shot changes). After a splice (media_patch), the seam decode proof: full-raster decoded frames \xB12 s around each seam, exact: inside the span = the patch, outside = original (a backup or the unpatched master) when given, and every frame decodes. Use after every patch render, before it goes to the client. Read-only. Long: background=true for a job id.",inputSchema:{patch:h.string().describe("The rendered patch file"),master:h.string().describe("The delivered master file it patches"),expected_tc:h.string().optional().describe("The record TC the patch must start at (patch_plan start_tc)"),expected_frames:h.number().int().min(1).optional().describe("The frame count it must have (patch_plan frames)"),tolerance:h.number().min(0).max(255).default(10).describe("Largest luma difference (0-255, on a 64-wide thumbnail) still counted as the same picture"),original:h.string().optional().describe("After a splice: the backup / unpatched master, so the seam proof checks the neighbouring frames are untouched")},run:async({patch:e,master:t,expected_tc:r,expected_frames:o,tolerance:n,original:i,__progress:a})=>{try{let s=await hE({patch:e,master:t,expected_tc:r,expected_frames:o,tolerance:n,original:i},a);return z(gE(s,{patch:e,master:t}),{...s})}catch(s){return D(s)}}},{name:"artist_profile",title:"How this artist works: learn, read and remember",description:"conform.tools works the way THIS artist/facility works, never one built-in way. Their profile holds naming templates, the usual deliverable set, folders/bins, conventions (program_start TC, end_on_picture, theatrical_tag) and workflow rules in their words, each with where it came from. action=get (default) shows it; read it before naming, rendering or delivering. learn reads a folder of their DELIVERED files (read only): matches each name element to what the file really is (codec, raster+rate, colour, audio, dates) and saves the naming template, the usual deliverable set and the codec folders (project= keeps them as that project's spellings; save=false previews). remember saves a preference: rule='\u2026' (topic e.g. deliverables/naming/render/patch) and/or conventions={program_start:'01:00:00:00', \u2026}. Save only what is THIS artist's choice; when they correct you, ask: 'your preference, or should every artist work this way?'; the second is a product issue (report kind=issue), not a profile rule. forget removes a rule (number or text). set replaces the whole profile JSON.",inputSchema:{action:h.enum(["get","learn","remember","forget","set"]).default("get"),path:h.string().optional().describe("learn: a folder of delivered files (or one file)"),project:h.string().optional().describe("learn: save as this project's spellings over the artist's"),facility:h.string().optional().describe("learn: the artist's or facility's name"),save:h.boolean().default(!0).describe("learn: false = preview only"),rule:h.string().optional().describe("remember: the preference in the artist's words; forget: text or number"),topic:h.string().optional().describe("remember: naming, deliverables, render, patch, conform\u2026"),source:h.string().optional().describe("remember: where it came from (default 'told')"),conventions:h.object({program_start:h.string().optional(),end_on_picture:h.boolean().optional(),theatrical_tag:h.string().optional(),no_audio_tag:h.string().optional()}).optional(),profile:h.record(h.string(),h.unknown()).optional().describe("set: the whole profile JSON")},run:async({action:e,path:t,project:r,facility:o,save:n,rule:i,topic:a,source:s,conventions:l,profile:c})=>{try{let u=await on();switch(e??"get"){case"learn":{if(!t)return D(new P("invalid_args","learn needs path (a folder of delivered files)"));let d=await QR(t,{project:r,facility:o,save:n}),f=[`${d.source}${d.saved?` \u2192 saved ${d.saved}`:" (preview, not saved)"}`,...Object.entries(d.learned.templates??{}).map(([m,p])=>` ${m}: ${p}`),...(d.learned.deliverables??[]).map(m=>` usual: ${m.label} (${m.CODEC} ${m.AUDIOCONFIG} .${m.ext}${m.texts.length?`, ${m.texts.join("/")}`:""})`),...Object.entries(d.learned.codec_folders??{}).map(([m,p])=>` folder: ${m}\u2026 \u2192 ${p}`),...d.misfits.length?[` ${d.misfits.length} name(s) follow another pattern: ${d.misfits.slice(0,5).join(", ")}`]:[],...d.name_issues.map(m=>` check ${m.file}: ${m.issues.join("; ")}`),"Ask the artist what files cannot show: is this the usual set, the program start TC, any optional kinds (artist_profile action=remember)."];return z(f.join(`
|
|
360
|
+
`),{...d})}case"remember":{if(!i&&!l)return D(new P("invalid_args","remember needs rule or conventions"));i&&(u=eI(u,{rule:i,topic:a,source:s??"told"})),l&&(u=nI(u,l,s??"told"));let d=await ho(u);return z(`remembered \u2192 ${d}
|
|
361
|
+
${Fs(u)}`,{profile:u,path:d})}case"forget":{if(!i)return D(new P("invalid_args","forget needs rule (its number or text)"));u=tI(u,/^\d+$/.test(i)?Number(i):i);let d=await ho(u);return z(`forgotten \u2192 ${d}
|
|
362
|
+
${Fs(u)}`,{profile:u,path:d})}case"set":{let d=await ho(c);return z(`saved \u2192 ${d}`,{path:d})}default:return z(Fs(u),{profile:u})}}catch(u){return D(u)}}},{name:"naming",title:"The artist's naming: build and check names",description:"The artist's own naming convention (from their artist_profile) for everything conform.tools names: deliverables, patches, timelines, documents, render jobs, folders. There is no built-in convention: with no profile, learn it first (artist_profile action=learn) or ask. Names are copied EXACTLY from the convention (separators, order, spellings). action=get shows the profile; set saves one ({facility, templates: {kind: '[TITLE]_[TEXT]_\u2026'}, values?, codec_folders?}); build makes a name of a kind from values; patch derives a patch's file name, render job name and folder FROM a delivered master's file name (the artist's patch template, their no-audio tag when picture-only, today's date/time, every other element the master's); check validates a name against the template (separators, order), against the file's probe facts (path: codec, raster, rate, colour tags, audio channels, the H264_25mbps bitrate) and against the master it patches; legacy operator initials after the date are noted, not required. deliverables expands the artist's usual deliverable set for a program (values: TITLE, COLORSPACE, GAMMA, FORMAT at the OAR) into file names: TEXTLESS only with textless=true (text over picture), optional kinds (UHD H.264) with include_optional. project applies that project's own spellings (profile.projects[PROJECT]: templates/values/deliverables) over the facility's structure.",inputSchema:{action:h.enum(["get","set","build","patch","check","deliverables"]).default("get"),project:h.string().optional().describe("Use this project's spellings (profile.projects[project]) over the facility's"),textless:h.boolean().optional().describe("deliverables: the program has text over picture, so a TEXTLESS version is made"),include_optional:h.boolean().optional().describe("deliverables: include the optional kinds (e.g. UHD H.264)"),profile:h.record(h.string(),h.unknown()).optional().describe("set: the profile JSON"),kind:h.string().optional().describe("build/check: the template kind (deliverable, patch, timeline, replace_list, tracklayout, qc, render_job, deliverables_folder)"),values:h.record(h.string(),h.string()).optional().describe("build: the elements, e.g. {TITLE: 'TRIMBLE', SOURCE: 'TRIMBLE_LP COLOR', PURPOSE: 'ARCHIVAL', SCOPE: 'REPLACE_XD32995'}; YYYYMMDD/HHMM default to now"),name:h.string().optional().describe("check: the name to check"),path:h.string().optional().describe("check: the file the name is for (probed)"),master:h.string().optional().describe("patch/check: the delivered master's file name"),nn:h.number().int().min(1).default(1).describe("patch: the patch number"),text:h.enum(["TEXTED","TEXTLESS"]).optional().describe("patch: the version (default the master's)"),picture_only:h.boolean().default(!0).describe("patch: AUDIOCONFIG = the artist's no-audio tag")},run:async({action:e,profile:t,kind:r,values:o,name:n,path:i,master:a,nn:s,text:l,picture_only:c,project:u,textless:d,include_optional:f})=>{try{let m=await po(u);switch(e??"get"){case"set":{let p=await ho(t);return z(`saved the ${t?.facility??""} naming profile \u2192 ${p}`,{path:p})}case"build":{if(!r)return D(new P("invalid_args","build needs kind"));let p=Fi(m,r,{...pd(),...o});return z(p,{name:p,kind:r})}case"patch":{if(!a)return D(new P("invalid_args","patch needs master (a delivered file's name)"));let p=Gy(m,a,{nn:s??1,text:l,picture_only:c});return z([p.file,p.job?`render job: ${p.job}`:"",`folder: ${p.folder}`,...p.warnings.map(g=>`warning: ${g}`)].filter(Boolean).join(`
|
|
363
|
+
`),{...p})}case"check":{if(!n)return D(new P("invalid_args","check needs name"));let p=zi(m,n,{kind:r,master:a,probe:i?await Pe(i):void 0}),g=p.issues.filter(_=>_.level==="error");return z([`${g.length?"WRONG":"ok"}: ${n} (${m.facility} ${p.kind})`,...p.issues.map(_=>` ${_.level}: ${_.element}: ${_.message}`)].join(`
|
|
364
|
+
`),{...p,ok_name:!g.length})}case"deliverables":{let p=qR(m,o??{},{textless:!!d,include_optional:f});return z([`${m.facility}${u?` / ${u}`:""} usual deliverables:`,...p.map(g=>` ${g.name} (${g.label}, ${g.text}, ${g.raster}${g.container?" 16x9 container":""}, ${g.audio})`),...d?[]:[" (no TEXTLESS: pass textless=true when the program has text over picture)"]].join(`
|
|
365
|
+
`),{deliverables:p})}default:return z(Object.keys(m.templates).length?`${m.facility} naming profile
|
|
366
|
+
${JSON.stringify(m,null,2)}`:Fs(m),{profile:m})}}catch(m){return D(m)}}},{name:"media_align",long:!0,title:"Frame offset between a temp and its master",description:"Prove (or find) where a range of file A (the temp / graded reference) sits in file B (the master), frame-exact. Give a_in/a_out (frame or absolute TC in A; default all of A) and b_in, the frame/TC in B the client maps a_in to; without b_in all of B is searched. Checks \xB1search frames (default 12), anchored on shot changes present in both; perceptual (a regrade, a burned-in TC/watermark, a rescale do not move it). Reports overall and per shot: exact / offset N frames (+ = later in B) with a confidence / unverifiable (static picture: the offsets that fit equally) / no match, plus flash-frame risk (a B shot change inside or within 3 frames of the range). Use before replacing a temp with a master on another TC base, and when the client's mapping disagrees with the graded temp.",inputSchema:{a:h.string().describe("The temp / graded reference"),a_in:h.union([h.string(),h.number().int()]).optional(),a_out:h.union([h.string(),h.number().int()]).optional().describe("Last frame included"),b:h.string().describe("The master"),b_in:h.union([h.string(),h.number().int()]).optional().describe("The client's in-point in B for a_in; omit to search"),search:h.number().int().min(1).max(250).optional().describe("\xB1frames checked (default 12)")},run:async({__progress:e,__signal:t,...r})=>{try{let o=await Pl({...r,signal:t});return z(b0(o),{...o})}catch(o){return D(o)}}},{name:"tool",title:"Tools: the artist's own and the ones that ship, as recipes",description:`Every tool in the conform.tools app is a recipe: typed inputs + nodes wired by reference, each node a block \u2014 a conform.tools verb (verb.<name>), a Resolve call (resolve.pull, resolve.apply, resolve.<edit>), or logic (rows.filter, review, ops.collect, plan.*). Every tool the app ships (${Ni.filter(e=>!e.hidden).map(e=>e.name).join(", ")}) and every verb as a one-node tool is an editable default: saving a recipe under a default's id replaces it for this artist, delete puts the default back. Host blocks (host.read, host.apply, host.open, host.render, edit.<op>) take host = resolve | premiere | avid | flame | nuke | fcp and work on whichever host's adapter or panel can do it (tool action=blocks says which). action=list (every tool) \xB7 show (id: its recipe) \xB7 blocks (every block with its params, to build with) \xB7 save (spec: a recipe \u2014 {id, name, group?, about?, host?, preview?, inputs:[{id, label, type: text|number|bool|choice|color|marker_color|file|files|folder|rename_steps|track|tracks|timeline|timelines|render_preset|source, choices?:[[value,label]], default?, optional?, when?:{input, is:[\u2026]}}], nodes:[{id, use, args, when?, label?}], view?}; view = the tool's screen when it opens in the app, a split tree {split:'row'|'col', panes:[\u2026], size?} whose leaves are {pane: knobs|viewer|rows|result|compare|graphics|running, show?: '$source'|'$review'|'$result'|'$<node>' (or two for compare), size?: 0\u20131}; leave it out and the app lays the screen out from the steps) \xB7 delete (id: one of the artist's own, or an edited default: back to the default) \xB7 export (ids or id, path: save the recipes out to a .json recipe file to share) \xB7 import (path: a recipe .json file; each tool checked and saved) \xB7 layout (the artist's hidden tools and \u2605 favourites) \xB7 arrange (layout: {hidden?:[ids], favourites?:[tool ids or block uses] | null}: merged in) \xB7 hide / show_tool (id) \xB7 workspace (project_id: the job's desktop and tabs \u2014 {desktop: [{id, at:[x,y] as 0\u20131 fractions}] | null (the default desktop), open:[tool ids in tabs], source: {host} | {session_id, name?} | {path} | null (the timeline the tools work on)}) \xB7 workspace_save (project_id, workspace: the whole thing; put a tool on the desktop or open it in a tab for the artist). References in args: "$in.x" an input, "$node" or "$node.a.b" an earlier node's output, "$a|$b" the first that is set; when: "$in.source=file". A review node pauses a run on its rows for the artist's OK. When the artist describes a tool they want, read tool action=blocks, write the recipe, save it, and tell them it is in Tools; run it with tool_run.`,inputSchema:{action:h.enum(["list","show","blocks","save","delete","layout","arrange","hide","show_tool","export","import","workspace","workspace_save"]).default("list"),project_id:h.string().optional().describe("workspace: the project"),workspace:h.record(h.unknown()).optional().describe("workspace_save: {open:[tool ids], source}"),id:h.string().optional(),ids:h.array(h.string()).optional().describe("export: several tools into one file"),path:h.string().optional().describe("export: the .json recipe file to write \xB7 import: the file to read"),spec:h.record(h.unknown()).optional().describe("save: the recipe"),layout:h.record(h.unknown()).optional().describe("arrange: the parts of the layout to change")},run:async({action:e,id:t,ids:r,path:o,spec:n,layout:i,project_id:a,workspace:s})=>{try{if(e==="workspace"||e==="workspace_save"){let c=a||"local",u=e==="workspace_save"?await Sr(c,s??{}):await Sd(c),d=u?.source?"host"in u.source?`${u.source.host} (live)`:"session_id"in u.source?`timeline ${u.source.name??u.source.session_id}`:u.source.path:"none chosen";return z(u?`desktop: ${u.desktop?u.desktop.map(f=>f.id).join(", "):"the default"} \xB7 open: ${u.open.join(", ")||"nothing"} \xB7 timeline: ${d}`:"the default desktop, nothing open",{workspace:u})}if(e==="export"){if(!o)return D(new P("invalid_args","export needs path"));let c=await VI(r?.length?r:t?[t]:[],o);return z(`saved ${c.tools.length} tool(s) to ${c.path}`,c)}if(e==="import"){if(!o)return D(new P("invalid_args","import needs path"));let c=await ZI(o,f_);for(let u of c)(await Yn(u.id)).shipped||await $d(u.id);return z(`imported ${c.map(u=>`'${u.name}' (${u.id})`).join(", ")} \u2014 in Tools`,{tools:c})}if(e==="layout"){let c=await Vi();return z(JSON.stringify(c,null,2),{layout:c})}if(e==="arrange"){let c=await kd(i??{});return z("layout saved",{layout:c})}if(e==="hide"||e==="show_tool"){if(!t)return D(new P("invalid_args",`${e} needs id`));let c=await Vi(),u=e==="hide"?[...new Set([...c.hidden,t])]:c.hidden.filter(m=>m!==t),d=c.favourites&&e==="hide"?c.favourites.filter(m=>m!==t):c.favourites,f=await kd({hidden:u,favourites:d});return e==="show_tool"&&await $d(t),z(`${t} ${e==="hide"?"hidden":"shown"}`,{layout:f})}if(e==="blocks"){let c=nT();return z(c.map(u=>`- ${u.use}${u.effect?" (changes things)":""}: ${u.about}`).join(`
|
|
367
|
+
`),{blocks:c})}if(e==="save"){let c=await l_(n,f_);return(await Yn(c.id)).shipped||await $d(c.id),z(`saved tool '${c.name}' (${c.id}) \u2014 it is in Tools; tool_run id=${c.id}`,{tool:c})}if(e==="delete"){if(!t)return D(new P("invalid_args","delete needs id"));let c=(await Js()).find(u=>u.id===t);return await LI(t)?Ae(c?.shipped?`${t} is back to the default`:`deleted ${t}`):D(new P("not_found",`${t} is not one of your tools, nor an edited default (a default as it ships can be hidden: action=hide)`))}if(e==="show"){if(!t)return D(new P("invalid_args","show needs id"));let c=await Yn(t);return z(JSON.stringify(c,null,2),{tool:c})}let l=await Js();return z(l.map(c=>`- ${c.id}: ${c.name} [${c.group}]${c.template?" (default)":c.shipped?" (default, edited)":" (yours)"}${c.hidden?" (hidden)":""} \u2014 ${c.about.split(". ")[0]}`).join(`
|
|
368
|
+
`),{tools:l})}catch(l){return D(l)}finally{["save","delete","import","arrange","hide","show_tool"].includes(e)&&aI().catch(()=>{})}}},{name:"tool_run",long:!0,title:"Run a tool, and the job's runs: what is waiting for an OK, apply, undo",description:"Run a tool (tool action=list) with its inputs: {id, inputs} \u2014 on top of the settings the artist left in its tab in this job (app action=state shows them), so 'run it' runs what they see. When it reaches a review it stops and answers state=review with the rows and a run_id: show the artist the rows, then action=apply (run_id, and keep:[row ids] or drop:[row ids or 1-based row numbers]; neither = every row). Every run is shared with the app: a run you start shows in that tool's tab in the artist's window, and a review the artist has open in a tab is yours to read (action=list), apply or drop. action=list (project_id?, id?: the job's runs, newest first \u2014 waiting reviews with their rows, results, what can be undone) \xB7 apply (run_id?, keep? | drop?: no run_id = the job's latest review, that tool's with id) \xB7 drop (leave a review without applying) \xB7 undo (run_id?: put back what a run changed; none = the job's latest run that can be undone). preview=true runs only up to the first review or the first node that changes anything (nothing changes). Answers state=done with the result (and undo_id when the host can put it back), and sessions: each step that made a timeline \u2192 its session_id. until = a node id: run only what that node needs and answer its output (the tool editor's Run on a node). A `source` input takes a timeline already read (a host.read answer, or {session_id}); left out, the tool reads its host's open timeline. project_id: the job (default: the open one).",inputSchema:{action:h.enum(["run","list","apply","drop","undo"]).default("run"),id:h.string().optional().describe("run: the tool \xB7 list / apply / undo: only that tool's runs"),spec:h.record(h.unknown()).optional().describe("a recipe to run without saving it (the builder's Try it)"),inputs:h.record(h.unknown()).default({}),preview:h.boolean().default(!1),run_id:h.string().optional().describe("apply / drop / undo: the run (its id, or its review's run_id)"),keep:h.array(h.string()).optional().describe("apply: exactly these review rows"),drop:h.array(h.union([h.string(),h.number().int()])).optional().describe("apply: every row but these (row ids, or 1-based row numbers)"),until:h.string().optional().describe("a node id: run only what it needs, answer its output"),project_id:h.string().optional().describe("the job (default: the job open in the app / the current project)"),by:h.string().optional().describe("who is asking (the app window says 'app'; default 'assistant')")},protectedStages:["canonicalize","write"],run:async({action:e,id:t,spec:r,inputs:o,preview:n,run_id:i,keep:a,drop:s,until:l,project_id:c,by:u,__signal:d,__progress:f})=>{try{let m=c||(await zn())?.id||"local",p={signal:d,progress:f,tool:Yn,until:l};if(e==="list"){let w=Wi(m,t);return z(w.length?w.slice(0,20).map(k=>g_(k)).join(`
|
|
369
|
+
`):"no runs in this job yet",{runs:w})}if(e==="drop"){let w=cT(m,{id:i,tool:t});return z(`left ${w.name}'s review; nothing applied`,{run:w})}if(e==="undo"){let w=await uT(m,{id:i,tool:t},async(k,I)=>{let x=await Ad("host_apply",{undo:k,...I?{timeline:I}:{}});return{ok:!x.isError,text:x.content.map(S=>S.text).join(`
|
|
370
|
+
`)}});return z(`${w.name}: ${w.undone}`,{run:w})}let g={project:m,by:u||"assistant"},_,v;if(e==="apply"||i)({run:_,state:v}=await lT(m,{id:i,tool:t,keep:a,drop:s,by:g.by,inputs:o},p));else{let w=r?Ws.parse(r):await Yn(String(t??"")),k=await Sd(m);if(!r&&k?.settings[w.id]&&g.by!=="app"){let I={...k.settings[w.id],...o};o=Object.fromEntries(Object.entries(I).filter(([x,S])=>{let R=w.inputs.find($=>$.id===x);return S!==""&&S!=null&&!(Array.isArray(S)&&!S.length)&&(!R?.when||R.when.is.includes(String(I[R.when.input]??"")))}))}w.inputs.some(I=>I.type==="source")&&o.source===void 0&&k?.source&&"session_id"in k.source&&(o={...o,source:{session_id:k.source.session_id}}),{run:_,state:v}=await sT(w,o,g,{...p,preview:n})}let y=v.state==="review"?`${v.label}: ${v.rows.length} row(s) waiting for the artist's OK (in the ${_?.name??"tool"} tab too) \u2014 tool_run action=apply run_id=${v.run_id} [keep | drop]`:v.state==="ready"?`ready to run: next is ${v.label}, which changes things`:v.text,b={...v,..._?{run:{id:_.id,tool:_.tool,status:_.status}}:{}};return v.state==="done"&&!v.ok?D(new P("engine",y)):z(y,b)}catch(m){return D(m)}}},{name:"app",title:"The app window: open a tool for the artist (settings filled in), the job's timeline, switch job, Home",description:"Drive the conform.tools app the artist has open, the way they would by hand. Everything here is saved with the job (its workspace), so it holds when the window opens later; a window that is open follows at once. action=state (project_id?: the job's open tabs, its timeline, each tool's settings, runs waiting for an OK) \xB7 open (tool, settings?, source?: open that tool's tab with these settings filled in \u2014 what the artist asked for, ready to Run; the rest stay at their defaults; source = its timeline) \xB7 close (tool) \xB7 timeline (source: {host: resolve|premiere|avid|flame|nuke|fcp} live | {session_id, name?} a timeline in the job | {path} a file; with tool: that tool's own timeline (each tab picks its own), without: the job's, which a tool takes until it has its own and when it works in that app) \xB7 job (project_id: switch the window to that job) \xB7 home (back to the job's Home) \xB7 dock (docked: true tucks Home's apps into a shelf along the bottom, false floats them) \xB7 put_away / put_back (tool: off Home into the Put away drawer, or back). To run a tool, review and apply: tool_run (its runs show in the tool's tab).",inputSchema:{action:h.enum(["state","open","close","timeline","job","home","dock","put_away","put_back"]).default("state"),project_id:h.string().optional().describe("the job (default: the one open)"),tool:h.string().optional().describe("open / close / put_away / put_back: the tool id (tool action=list)"),settings:h.record(h.unknown()).optional().describe("open: the tool's inputs to fill in, by input id"),source:h.record(h.unknown()).optional().describe("timeline / open: {host} | {session_id, name?} | {path}"),docked:h.boolean().optional()},run:async({action:e,project_id:t,tool:r,settings:o,source:n,docked:i})=>{try{let a=t||(await zn())?.id||"local",s=async()=>await Sd(a)??xd.parse({}),l=u=>{if(!r)throw new P("invalid_args",`${u} needs tool`);return r},c=()=>Bi()?"":" (the app window is not open: it shows when it opens)";if(e==="state"){let u=await s(),d=Wi(a).filter(g=>g.status==="review"),f=u.source?"host"in u.source?`${u.source.host} (live)`:"session_id"in u.source?`timeline ${u.source.name??u.source.session_id}`:u.source.path:"none chosen",m=Bi()?DI():null,p=m?` \xB7 the artist is looking at ${m.project!==a?`job ${m.project}, `:""}${m.view==="tool"&&m.tool?`the ${m.tool} tab`:"Home"}`:"";return z([`job ${a} \xB7 tabs: ${u.open.join(", ")||"none"} \xB7 timeline: ${f} \xB7 apps ${u.docked?"docked":"floating"}${Bi()?p:" \xB7 the window is not open"}`,...Object.entries(u.sources).map(([g,_])=>`${g} timeline: ${JSON.stringify(_)}`),...Object.entries(u.settings).filter(([g])=>u.open.includes(g)).map(([g,_])=>`${g} settings: ${JSON.stringify(_).slice(0,400)}`),...d.map(g=>g_(g,10))].join(`
|
|
371
|
+
`),{workspace:u,waiting:d,window_open:Bi()>0,front:m})}if(e==="open"){let u=await Yn(l("open")),d=await s();if(o){let f=new Set(u.inputs.map(p=>p.id)),m=Object.keys(o).filter(p=>!f.has(p));if(m.length)throw new P("invalid_args",`${u.name} has no setting ${m.join(", ")} (it has ${[...f].join(", ")})`)}return await Sr(a,{...d,open:d.open.includes(u.id)?d.open:[...d.open,u.id],settings:o?{...d.settings,[u.id]:{...FI(u),...o}}:d.settings,sources:n?{...d.sources,[u.id]:n}:d.sources}),Xn({type:"open",project:a,tool:u.id}),z(`opened ${u.name}${o?` with ${Object.entries(o).map(([f,m])=>`${f}=${JSON.stringify(m)}`).join(", ")}`:""}${c()}`,{tool:u.id})}if(e==="close"){let u=await s();return await Sr(a,{...u,open:u.open.filter(d=>d!==l("close"))}),z(`closed ${r}`)}if(e==="timeline"){if(!n)throw new P("invalid_args","timeline needs source");let u=await s();if(r){let f=await Yn(r),m=await Sr(a,{...u,sources:{...u.sources,[f.id]:n}});return z(`${f.name}'s timeline is ${JSON.stringify(m.sources[f.id])}${c()}`,{tool:f.id,source:m.sources[f.id]})}let d=await Sr(a,{...u,source:n});return z(`the job's timeline is ${JSON.stringify(d.source)}${c()}`,{source:d.source})}if(e==="job"){if(!t)throw new P("invalid_args","job needs project_id");return Xn({type:"job",project:t}),z(`switched to job ${t}${c()}`)}if(e==="home")return Xn({type:"home",project:a}),z(`Home${c()}`);if(e==="dock"){let u=await Sr(a,{...await s(),docked:i??!0});return z(u.docked?"apps docked in the shelf":"apps floating over Home")}if(e==="put_away"||e==="put_back"){let u=await Yn(l(e)),d=await s();if(d.desktop){let f=e==="put_away"?d.desktop.filter(m=>m.id!==u.id):d.desktop.some(m=>m.id===u.id)?d.desktop:[...d.desktop,{id:u.id,at:[.5,.5]}];await Sr(a,{...d,desktop:f})}else if(!Bi())throw new P("refused","Home is still the default layout and the window is not open: open the app, then ask again");return Xn({type:"desk",project:a,action:e,tool:u.id}),z(`${u.name} ${e==="put_away"?"put away (in the Put away drawer)":"back on Home"}`)}return D(new P("invalid_args",`unknown action ${e}`))}catch(a){return D(a)}}},{name:"job_status",hidden:!0,title:"Status of a background job",description:"Status, phase and progress of a job started with background=true (auto conform, deliver, consolidate), and its result once finished.",inputSchema:{job_id:h.string()},run:async({job_id:e})=>{let t=await HR(e);if(!t)return D(new P("not_found",`no job ${e}`));let r=Uy(t);return t.status==="done"&&t.result?z(`${r}
|
|
372
|
+
|
|
373
|
+
${t.result.content.map(o=>o.text).join(`
|
|
374
|
+
`)}`,{job:t,result:t.result.structuredContent??null}):z(r,{job:t})}},{name:"job_cancel",hidden:!0,title:"Cancel a background job",description:"Cancel a running background job. Partial outputs already written stay on disk and are named in the job's result.",inputSchema:{job_id:h.string()},run:async({job_id:e})=>zy(e)?z(`cancelling ${e}`,{job_id:e}):D(new P("not_found",`no running job ${e}`))},{name:"job_list",hidden:!0,title:"List jobs",description:"Recent background jobs (running and finished) with status and progress.",inputSchema:{},run:async()=>{let e=await WR();return z(e.length?e.map(Uy).join(`
|
|
375
|
+
`):"(no jobs)",{jobs:e})}},{name:"job",title:"Background jobs: status, cancel, list",description:"Jobs started with background=true (auto conform, deliver, consolidate, peer-to-peer serving). action=status (job_id): status, phase, progress and, once finished, its result \xB7 cancel (job_id): stop it; partial outputs already written stay on disk and are named in its result \xB7 list: recent jobs, running and finished.",inputSchema:{action:h.enum(["status","cancel","list"]).default("status"),job_id:h.string().optional()},run:async({action:e,job_id:t})=>e==="list"?an("job_list").run({}):t?an(e==="cancel"?"job_cancel":"job_status").run({job_id:t}):D(new P("invalid_args",`action=${e} needs job_id`))}],bU=new Set(["account_login","account_status","account_logout","account_telemetry","timeline_routes","report","report_issue","report_gap","report_note"]),Pd=new Set(["account_status","conform_learn","timeline_read","host_project","timeline_inspect","timeline_routes","timeline_sessions","host_items","media_probe","media_find","media_coverage","timeline_judge","timeline_autoconform","job_status","job_list","patch_plan","patch_verify","media_align","media_cuts","qc_media","media_sync","qc_blanking","gfx_fonts"]),yU=new Set(["account_login","account_logout","account_telemetry","report","job","timeline_query","host_current","report_issue","report_gap","report_note","host_open","host_setup","timeline_edit","timeline_autoconform_review","timeline_author","timeline_generate","timeline_relink","project","project_link","color_match","color_prep","job_cancel","naming","artist_profile","media_frame","timeline_frame","timeline_align","tool","app"]);function Lre(e){return{readOnlyHint:Pd.has(e),destructiveHint:!Pd.has(e)&&!yU.has(e)}}var VO=new Set(["timeline_id","path","media_reference_id","media_reference","source_start","source_duration","at_frame","track_id","fit","without_audio"]);async function _U(e,t){let r=Object.keys(t).filter(u=>!VO.has(u));if(r.length)throw new P("refused",`add_clip does not take ${r.join(", ")}; it takes ${[...VO].filter(u=>u!=="media_reference").join(", ")} (path = a file to probe; media_reference_id = a reference already in the session, from timeline_query table=media)`);if(typeof t.path!="string"||!t.path){if(t.media_reference_id)return t;throw new P("refused","add_clip needs path (the media file to cut in)")}let{path:o,...n}=t,i=await Pe(Eo(o)),a=e.media_references??[],s=a.find(u=>u.target_url===i.target_url);if(s)return{...n,media_reference_id:s.id};let l=i.id,c=2;for(;a.some(u=>u.id===l);)l=`${i.id} (${c++})`;return{...n,media_reference_id:l,media_reference:{...i,id:l}}}async function Ad(e,t,r={}){let o=an(e);if(!o)return D(new P("not_found",`unknown verb '${e}'`));if(!bU.has(e))try{await Qv()}catch(l){return D(l)}let n=wU(t),i=t.engine==="local"||t.engine==="hosted"?t.engine:void 0,a=()=>v0.run({verb:e,declared:o.protectedStages??[]},()=>xU(o,e,n,r)),s=i?await k0.run(i,a):await a();return o.long&&n.background||i_(e,n,s),$U(e,s)}var vU=new Set(["path","paths","out_path","out_dir","media_root","reference","pool","source_path","output_path","plate","render","target_dir","media_dirs","a","b","edl_path","csv_path","patch","master","credits_path","images_dir","look_path","fonts"]);function wU(e){let t={...e};for(let r of vU){let o=t[r];r==="reference"&&o==="ai"||(typeof o=="string"&&o?t[r]=Eo(o):Array.isArray(o)&&(t[r]=o.map(n=>typeof n=="string"&&n?Eo(n):n)))}return t}var kU={timeline_read:"conform",host_current:"conform",timeline_relink:"conform",timeline_write:"conform",timeline_autoconform:"autoconform",media_consolidate:"deliver",media_deliver:"deliver"};function $U(e,t){let r=kU[e];return!r||t.isError||ZR()?t:{...t,content:[...t.content,{type:"text",text:`Next: call conform_learn task=${r} (with the hosts involved) before going further, and follow the playbook it returns.`}]}}async function xU(e,t,r,o){let n=performance.now(),i=async(s,l)=>{let c=Math.round(performance.now()-n),u=s.content.map(f=>f.text).join(`
|
|
376
|
+
`),d=typeof r.session_id=="string"?r.session_id:u.match(/session_id: (\w+)/)?.[1];return await hI({ts:new Date().toISOString(),verb:t,ms:c,ok:!s.isError,code:s.isError?String(s.structuredContent?.code??"engine"):void 0,msg:s.isError?u.slice(0,500):void 0,...l.withArgs?{args:pI(r)}:{},job:l.job,session:d,note:l.note}),c},a=async(s,l)=>{let c=await i(s,{job:l,withArgs:!0});return e.long&&r.background||r_(t,s,c),s};if(e.long){let{background:s,...l}=r,c=Ds(t,async(u,d)=>await e.run({...l,__signal:d,__progress:s||!o.progress?u:(f,m,p)=>{u(f,m,p),o.progress(f,m,p)}}));return s||o.signal?.addEventListener("abort",()=>zy(c.id),{once:!0}),s?(Ly(c.id)?.then(async u=>{i_(t,l,u),r_(t,u,await i(u,{job:c.id,note:"job finished"}))}),a(z(`started ${c.id} (${t}) \u2014 poll job action=status`,{job_id:c.id}),c.id)):a(await Ly(c.id),c.id)}try{return await a(await e.run(r))}catch(s){return a(D(s))}}function zre(e,t){let r=an(e);if(!r)return{ok:!1,result:D(new P("not_found",`unknown verb '${e}'`))};let o=h.object(r.inputSchema).safeParse(t??{});if(o.success)return{ok:!0,data:o.data};o_(e,_d(o.error.issues));let n=o.error.issues.map(i=>`${i.path.join(".")||"(args)"}: ${i.message}`).join("; ");return{ok:!1,result:D(new P("invalid_args",n,{fields:_d(o.error.issues)}))}}function Ure(e,t){let r=an(e);if(!r)return;let o=h.object(r.inputSchema).safeParse(t??{});o.success||o_(e,_d(o.error.issues))}var ZO=gU.filter(e=>!e.repoOnly||w0),Ks=ZO.filter(e=>!e.hidden);function an(e){return Ks.find(t=>t.name===e)??ZO.find(t=>t.name===e)}export{Z5 as a,Oe as b,J as c,ur as d,kM as e,T as f,zl as g,Ul as h,PM as i,AM as j,pe as k,Vk as l,uu as m,ts as n,bb as o,yb as p,kb as q,eo as r,is as s,$S as t,SS as u,gi as v,IS as w,Eb as x,Cb as y,ju as z,MS as A,ls as B,to as C,ZS as D,qS as E,ms as F,h as G,Ts as H,DH as I,NH as J,FH as K,Y7 as L,md as M,dd as N,Q7 as O,eH as P,tH as Q,HR as R,zy as S,WR as T,yH as U,AH as V,Lre as W,Ad as X,zre as Y,Ure as Z,Ks as _,an as $};
|