conformtools 0.6.13 → 0.6.14
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/dist/{bridge-PWYOJ7E7.js → bridge-46P34WCD.js} +1 -1
- package/dist/{chunk-LKQTE6T5.js → chunk-5PTQAFU5.js} +3 -3
- package/dist/{chunk-H4BU5WA6.js → chunk-764P7TUD.js} +1 -1
- package/dist/{chunk-BYMCZJBQ.js → chunk-BO462NEL.js} +1 -1
- package/dist/{chunk-LZRCXSUJ.js → chunk-CQSNVQQE.js} +1 -1
- package/dist/{chunk-LRGA6QJQ.js → chunk-DP4KJ3KL.js} +5 -5
- package/dist/{chunk-ERUN634Q.js → chunk-EKTETRKB.js} +1 -1
- package/dist/{chunk-4VFDGL4E.js → chunk-FXK53VEO.js} +1 -1
- package/dist/chunk-MJBJI6DV.js +3 -0
- package/dist/{chunk-7W5AFZYX.js → chunk-MOSLNNO5.js} +1 -1
- package/dist/{chunk-I2Y2P5NH.js → chunk-O372NT7V.js} +2 -2
- package/dist/{chunk-Y455Y6V4.js → chunk-P3EOFAZR.js} +1 -1
- package/dist/{chunk-G3HBKJ5L.js → chunk-YKKB27VF.js} +1 -1
- package/dist/{chunk-B54TEGMG.js → chunk-YYR3FM6A.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/{framing-P5RGN5V3.js → framing-4HAHAG4I.js} +1 -1
- package/dist/{h264-JI62TU4W.js → h264-MAUQSLPY.js} +1 -1
- package/dist/{h264-mxf-J2QPZO4U.js → h264-mxf-2SZ66MPB.js} +1 -1
- package/dist/{host-relink-76CFY32O.js → host-relink-664IB3BC.js} +1 -1
- package/dist/{hosts-TBHEPV6A.js → hosts-BGWD7BKM.js} +1 -1
- package/dist/http.js +2 -2
- package/dist/{inspect-U656APGR.js → inspect-ZM7IW23B.js} +1 -1
- package/dist/{isobmff-UISATYUR.js → isobmff-6ZPEXUF4.js} +1 -1
- package/dist/{mc-video-LSTKUKNL.js → mc-video-KMWTRVES.js} +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{media-XBNKYKB7.js → media-MSMXMA6E.js} +1 -1
- package/dist/{mxf-ZL57VJ3C.js → mxf-GOWHEH4A.js} +1 -1
- package/dist/{ops-ZQEQXW2N.js → ops-FI2NBTYK.js} +1 -1
- package/dist/{r3d-R4TLYJVE.js → r3d-LO5Z6DEX.js} +1 -1
- package/dist/{still-4UR35GZH.js → still-6FU7ALUV.js} +1 -1
- package/dist/{timeline-JONFBIA3.js → timeline-WVETLJZN.js} +1 -1
- package/package.json +5 -5
- package/dist/chunk-JV7TZDKJ.js +0 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as Y3}from"./chunk-IN6XVTUS.js";import{e as D3,f as J3,g as U3,i as E3,k as Qr,o as C3}from"./chunk-Y455Y6V4.js";import{a as um}from"./chunk-PFZVET7S.js";import{a as mr}from"./chunk-H4BU5WA6.js";import{b as R3}from"./chunk-ISKNIQVO.js";import{a as H3,b as pc}from"./chunk-JKOB3U54.js";import{b as F3}from"./chunk-EEDLRRKU.js";import{b as M3}from"./chunk-WJ5EWXP2.js";import{b as I3}from"./chunk-YUO3UWPH.js";import{a as mc}from"./chunk-DKGGJM6Z.js";import{b as Eo,c as dc,d as Ai,e as W3,g as V3}from"./chunk-JV7TZDKJ.js";import{a as cm}from"./chunk-XDI6CPPV.js";import{i as S3}from"./chunk-BTS3DFPD.js";import{b as X3,c as j3}from"./chunk-6WLSIH2N.js";import{S as T3}from"./chunk-C2ESM27Z.js";import{b as G3,i as K3,p as B3}from"./chunk-N34DQ6MH.js";import{a as q3,b as qe,c as fm,d as Oe,f as Co}from"./chunk-NU3X7P4N.js";import{Ia as Ar,ba as Z3,j as lm,t as N3,u as L3}from"./chunk-DPA26AOI.js";import{p as Bi,t as Kr,u as sm,v as O3,w as Br}from"./chunk-L3HRAIDR.js";import{a as Pn,d as Gr,e as k3}from"./chunk-OD445COC.js";import{c as Yr,d as P3}from"./chunk-EP4L2BWV.js";import{a as He,b as z3}from"./chunk-PHAMF4JF.js";import{$ as it,A as We,C as fc,E as im,G as g3,J as am,K as Ki,L as mt,M as om,N as y3,O as x3,Z as G,_ as Ge,aa as A,b as dr,ba as w3,c as f3,d as d3,h as m3,l as rm,m as Te,n as p3,o as v3,p as h3,r as uc,s as Ci,t as gt,u as b3,v as Yi,w as dt,x as Qe,y as Gi,z as Ze}from"./chunk-XI6XF7FQ.js";import{a as Mn,c as _,d as In,f as NS}from"./chunk-PSANHDZM.js";var ts=_((qU,Im)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Im.exports={nextTick:sX}:Im.exports=process;function sX(e,t,n,i){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var r=arguments.length,a,o;switch(r){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,n)});case 4:return process.nextTick(function(){e.call(null,t,n,i)});default:for(a=new Array(r-1),o=0;o<a.length;)a[o++]=arguments[o];return process.nextTick(function(){e.apply(null,a)})}}});var f0=_((DU,u0)=>{var lX={}.toString;u0.exports=Array.isArray||function(e){return lX.call(e)=="[object Array]"}});var qm=_((JU,d0)=>{d0.exports=Mn("stream")});var ns=_((Dm,p0)=>{var jc=Mn("buffer"),Cn=jc.Buffer;function m0(e,t){for(var n in e)t[n]=e[n]}Cn.from&&Cn.alloc&&Cn.allocUnsafe&&Cn.allocUnsafeSlow?p0.exports=jc:(m0(jc,Dm),Dm.Buffer=ta);function ta(e,t,n){return Cn(e,t,n)}m0(Cn,ta);ta.from=function(e,t,n){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Cn(e,t,n)};ta.alloc=function(e,t,n){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=Cn(e);return t!==void 0?typeof n=="string"?i.fill(t,n):i.fill(t):i.fill(0),i};ta.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Cn(e)};ta.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return jc.SlowBuffer(e)}});var na=_(pt=>{function cX(e){return Array.isArray?Array.isArray(e):Nc(e)==="[object Array]"}pt.isArray=cX;function uX(e){return typeof e=="boolean"}pt.isBoolean=uX;function fX(e){return e===null}pt.isNull=fX;function dX(e){return e==null}pt.isNullOrUndefined=dX;function mX(e){return typeof e=="number"}pt.isNumber=mX;function pX(e){return typeof e=="string"}pt.isString=pX;function vX(e){return typeof e=="symbol"}pt.isSymbol=vX;function hX(e){return e===void 0}pt.isUndefined=hX;function bX(e){return Nc(e)==="[object RegExp]"}pt.isRegExp=bX;function gX(e){return typeof e=="object"&&e!==null}pt.isObject=gX;function yX(e){return Nc(e)==="[object Date]"}pt.isDate=yX;function xX(e){return Nc(e)==="[object Error]"||e instanceof Error}pt.isError=xX;function wX(e){return typeof e=="function"}pt.isFunction=wX;function zX(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}pt.isPrimitive=zX;pt.isBuffer=Mn("buffer").Buffer.isBuffer;function Nc(e){return Object.prototype.toString.call(e)}});var v0=_((EU,Jm)=>{typeof Object.create=="function"?Jm.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Jm.exports=function(t,n){if(n){t.super_=n;var i=function(){};i.prototype=n.prototype,t.prototype=new i,t.prototype.constructor=t}}});var ra=_((CU,Em)=>{try{if(Um=Mn("util"),typeof Um.inherits!="function")throw"";Em.exports=Um.inherits}catch{Em.exports=v0()}var Um});var b0=_((YU,Cm)=>{"use strict";function PX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var h0=ns().Buffer,rs=Mn("util");function kX(e,t,n){e.copy(t,n)}Cm.exports=(function(){function e(){PX(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(n){var i={data:n,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length},e.prototype.unshift=function(n){var i={data:n,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length},e.prototype.shift=function(){if(this.length!==0){var n=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,n}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(n){if(this.length===0)return"";for(var i=this.head,r=""+i.data;i=i.next;)r+=n+i.data;return r},e.prototype.concat=function(n){if(this.length===0)return h0.alloc(0);for(var i=h0.allocUnsafe(n>>>0),r=this.head,a=0;r;)kX(r.data,i,a),a+=r.data.length,r=r.next;return i},e})();rs&&rs.inspect&&rs.inspect.custom&&(Cm.exports.prototype[rs.inspect.custom]=function(){var e=rs.inspect({length:this.length});return this.constructor.name+" "+e})});var Ym=_((GU,g0)=>{"use strict";var Lc=ts();function OX(e,t){var n=this,i=this._readableState&&this._readableState.destroyed,r=this._writableState&&this._writableState.destroyed;return i||r?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Lc.nextTick(Zc,this,e)):Lc.nextTick(Zc,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(a){!t&&a?n._writableState?n._writableState.errorEmitted||(n._writableState.errorEmitted=!0,Lc.nextTick(Zc,n,a)):Lc.nextTick(Zc,n,a):t&&t(a)}),this)}function SX(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Zc(e,t){e.emit("error",t)}g0.exports={destroy:OX,undestroy:SX}});var x0=_((KU,y0)=>{y0.exports=Mn("util").deprecate});var Km=_((BU,X0)=>{"use strict";var ni=ts();X0.exports=Be;function z0(e){var t=this;this.next=null,this.entry=null,this.finish=function(){EX(t,e)}}var TX=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:ni.nextTick,ia;Be.WritableState=as;var P0=Object.create(na());P0.inherits=ra();var XX={deprecate:x0()},k0=qm(),Vc=ns().Buffer,jX=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function NX(e){return Vc.from(e)}function LX(e){return Vc.isBuffer(e)||e instanceof jX}var O0=Ym();P0.inherits(Be,k0);function ZX(){}function as(e,t){ia=ia||ri(),e=e||{};var n=t instanceof ia;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,r=e.writableHighWaterMark,a=this.objectMode?16:16*1024;i||i===0?this.highWaterMark=i:n&&(r||r===0)?this.highWaterMark=r:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=e.decodeStrings===!1;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(s){IX(t,s)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new z0(this)}as.prototype.getBuffer=function(){for(var t=this.bufferedRequest,n=[];t;)n.push(t),t=t.next;return n};(function(){try{Object.defineProperty(as.prototype,"buffer",{get:XX.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Wc;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Wc=Function.prototype[Symbol.hasInstance],Object.defineProperty(Be,Symbol.hasInstance,{value:function(e){return Wc.call(this,e)?!0:this!==Be?!1:e&&e._writableState instanceof as}})):Wc=function(e){return e instanceof this};function Be(e){if(ia=ia||ri(),!Wc.call(Be,this)&&!(this instanceof ia))return new Be(e);this._writableState=new as(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),k0.call(this)}Be.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function WX(e,t){var n=new Error("write after end");e.emit("error",n),ni.nextTick(t,n)}function VX(e,t,n,i){var r=!0,a=!1;return n===null?a=new TypeError("May not write null values to stream"):typeof n!="string"&&n!==void 0&&!t.objectMode&&(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),ni.nextTick(i,a),r=!1),r}Be.prototype.write=function(e,t,n){var i=this._writableState,r=!1,a=!i.objectMode&&LX(e);return a&&!Vc.isBuffer(e)&&(e=NX(e)),typeof t=="function"&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),typeof n!="function"&&(n=ZX),i.ended?WX(this,n):(a||VX(this,i,e,n))&&(i.pendingcb++,r=HX(this,i,a,e,t,n)),r};Be.prototype.cork=function(){var e=this._writableState;e.corked++};Be.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&S0(this,e))};Be.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function RX(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=Vc.from(t,n)),t}Object.defineProperty(Be.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function HX(e,t,n,i,r,a){if(!n){var o=RX(t,i,r);i!==o&&(n=!0,r="buffer",i=o)}var s=t.objectMode?1:i.length;t.length+=s;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:r,isBuf:n,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Gm(e,t,!1,s,i,r,a);return c}function Gm(e,t,n,i,r,a,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(r,t.onwrite):e._write(r,a,t.onwrite),t.sync=!1}function FX(e,t,n,i,r){--t.pendingcb,n?(ni.nextTick(r,i),ni.nextTick(is,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(r(i),e._writableState.errorEmitted=!0,e.emit("error",i),is(e,t))}function MX(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function IX(e,t){var n=e._writableState,i=n.sync,r=n.writecb;if(MX(n),t)FX(e,n,i,t,r);else{var a=T0(n);!a&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&S0(e,n),i?TX(w0,e,n,a,r):w0(e,n,a,r)}}function w0(e,t,n,i){n||qX(e,t),t.pendingcb--,i(),is(e,t)}function qX(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function S0(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var i=t.bufferedRequestCount,r=new Array(i),a=t.corkedRequestsFree;a.entry=n;for(var o=0,s=!0;n;)r[o]=n,n.isBuf||(s=!1),n=n.next,o+=1;r.allBuffers=s,Gm(e,t,!0,t.length,r,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new z0(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,u=n.callback,f=t.objectMode?1:c.length;if(Gm(e,t,!1,f,c,l,u),n=n.next,t.bufferedRequestCount--,t.writing)break}n===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}Be.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))};Be.prototype._writev=null;Be.prototype.end=function(e,t,n){var i=this._writableState;typeof e=="function"?(n=e,e=null,t=null):typeof t=="function"&&(n=t,t=null),e!=null&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||UX(this,i,n)};function T0(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function DX(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),is(e,t)})}function JX(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,ni.nextTick(DX,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function is(e,t){var n=T0(t);return n&&(JX(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),n}function UX(e,t,n){t.ending=!0,is(e,t),n&&(t.finished?ni.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}function EX(e,t,n){var i=e.entry;for(e.entry=null;i;){var r=i.callback;t.pendingcb--,r(n),i=i.next}t.corkedRequestsFree.next=e}Object.defineProperty(Be.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});Be.prototype.destroy=O0.destroy;Be.prototype._undestroy=O0.undestroy;Be.prototype._destroy=function(e,t){this.end(),t(e)}});var ri=_((AU,Z0)=>{"use strict";var j0=ts(),CX=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};Z0.exports=Yn;var N0=Object.create(na());N0.inherits=ra();var L0=Qm(),Am=Km();N0.inherits(Yn,L0);for(Bm=CX(Am.prototype),Rc=0;Rc<Bm.length;Rc++)Hc=Bm[Rc],Yn.prototype[Hc]||(Yn.prototype[Hc]=Am.prototype[Hc]);var Bm,Hc,Rc;function Yn(e){if(!(this instanceof Yn))return new Yn(e);L0.call(this,e),Am.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",YX)}Object.defineProperty(Yn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function YX(){this.allowHalfOpen||this._writableState.ended||j0.nextTick(GX,this)}function GX(e){e.end()}Object.defineProperty(Yn.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}});Yn.prototype._destroy=function(e,t){this.push(null),this.end(),j0.nextTick(t,e)}});var ep=_(V0=>{"use strict";var $m=ns().Buffer,W0=$m.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function KX(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function BX(e){var t=KX(e);if(typeof t!="string"&&($m.isEncoding===W0||!W0(e)))throw new Error("Unknown encoding: "+e);return t||e}V0.StringDecoder=os;function os(e){this.encoding=BX(e);var t;switch(this.encoding){case"utf16le":this.text=tj,this.end=nj,t=4;break;case"utf8":this.fillLast=_X,t=4;break;case"base64":this.text=rj,this.end=ij,t=3;break;default:this.write=aj,this.end=oj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=$m.allocUnsafe(t)}os.prototype.write=function(e){if(e.length===0)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""};os.prototype.end=ej;os.prototype.text=$X;os.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function _m(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function AX(e,t,n){var i=t.length-1;if(i<n)return 0;var r=_m(t[i]);return r>=0?(r>0&&(e.lastNeed=r-1),r):--i<n||r===-2?0:(r=_m(t[i]),r>=0?(r>0&&(e.lastNeed=r-2),r):--i<n||r===-2?0:(r=_m(t[i]),r>=0?(r>0&&(r===2?r=0:e.lastNeed=r-3),r):0))}function QX(e,t,n){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function _X(e){var t=this.lastTotal-this.lastNeed,n=QX(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function $X(e,t){var n=AX(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)}function ej(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function tj(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function nj(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function rj(e,t){var n=(e.length-t)%3;return n===0?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function ij(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function aj(e){return e.toString(this.encoding)}function oj(e){return e&&e.length?this.write(e):""}});var Qm=_(($U,Y0)=>{"use strict";var oa=ts();Y0.exports=Ie;var sj=f0(),ss;Ie.ReadableState=D0;var _U=Mn("events").EventEmitter,M0=function(e,t){return e.listeners(t).length},ap=qm(),ls=ns().Buffer,lj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function cj(e){return ls.from(e)}function uj(e){return ls.isBuffer(e)||e instanceof lj}var I0=Object.create(na());I0.inherits=ra();var tp=Mn("util"),Se=void 0;tp&&tp.debuglog?Se=tp.debuglog("stream"):Se=function(){};var fj=b0(),q0=Ym(),aa;I0.inherits(Ie,ap);var np=["error","close","destroy","pause","resume"];function dj(e,t,n){if(typeof e.prependListener=="function")return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):sj(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}function D0(e,t){ss=ss||ri(),e=e||{};var n=t instanceof ss;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,r=e.readableHighWaterMark,a=this.objectMode?16:16*1024;i||i===0?this.highWaterMark=i:n&&(r||r===0)?this.highWaterMark=r:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new fj,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(aa||(aa=ep().StringDecoder),this.decoder=new aa(e.encoding),this.encoding=e.encoding)}function Ie(e){if(ss=ss||ri(),!(this instanceof Ie))return new Ie(e);this._readableState=new D0(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),ap.call(this)}Object.defineProperty(Ie.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Ie.prototype.destroy=q0.destroy;Ie.prototype._undestroy=q0.undestroy;Ie.prototype._destroy=function(e,t){this.push(null),t(e)};Ie.prototype.push=function(e,t){var n=this._readableState,i;return n.objectMode?i=!0:typeof e=="string"&&(t=t||n.defaultEncoding,t!==n.encoding&&(e=ls.from(e,t),t=""),i=!0),J0(this,e,t,!1,i)};Ie.prototype.unshift=function(e){return J0(this,e,null,!0,!1)};function J0(e,t,n,i,r){var a=e._readableState;if(t===null)a.reading=!1,hj(e,a);else{var o;r||(o=mj(a,t)),o?e.emit("error",o):a.objectMode||t&&t.length>0?(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==ls.prototype&&(t=cj(t)),i?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):rp(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||t.length!==0?rp(e,a,t,!1):U0(e,a)):rp(e,a,t,!1))):i||(a.reading=!1)}return pj(a)}function rp(e,t,n,i){t.flowing&&t.length===0&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&Fc(e)),U0(e,t)}function mj(e,t){var n;return!uj(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(n=new TypeError("Invalid non-string/buffer chunk")),n}function pj(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}Ie.prototype.isPaused=function(){return this._readableState.flowing===!1};Ie.prototype.setEncoding=function(e){return aa||(aa=ep().StringDecoder),this._readableState.decoder=new aa(e),this._readableState.encoding=e,this};var R0=8388608;function vj(e){return e>=R0?e=R0:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function H0(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=vj(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}Ie.prototype.read=function(e){Se("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return Se("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?ip(this):Fc(this),null;if(e=H0(e,t),e===0&&t.ended)return t.length===0&&ip(this),null;var i=t.needReadable;Se("need readable",i),(t.length===0||t.length-e<t.highWaterMark)&&(i=!0,Se("length less than watermark",i)),t.ended||t.reading?(i=!1,Se("reading or ended",i)):i&&(Se("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=H0(n,t)));var r;return e>0?r=E0(e,t):r=null,r===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&ip(this)),r!==null&&this.emit("data",r),r};function hj(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,Fc(e)}}function Fc(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Se("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?oa.nextTick(F0,e):F0(e))}function F0(e){Se("emit readable"),e.emit("readable"),op(e)}function U0(e,t){t.readingMore||(t.readingMore=!0,oa.nextTick(bj,e,t))}function bj(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(Se("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}Ie.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};Ie.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e);break}i.pipesCount+=1,Se("pipe count=%d opts=%j",i.pipesCount,t);var r=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,a=r?s:h;i.endEmitted?oa.nextTick(a):n.once("end",a),e.on("unpipe",o);function o(b,g){Se("onunpipe"),b===n&&g&&g.hasUnpiped===!1&&(g.hasUnpiped=!0,u())}function s(){Se("onend"),e.end()}var c=gj(n);e.on("drain",c);var l=!1;function u(){Se("cleanup"),e.removeListener("close",p),e.removeListener("finish",v),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",o),n.removeListener("end",s),n.removeListener("end",h),n.removeListener("data",m),l=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c()}var f=!1;n.on("data",m);function m(b){Se("ondata"),f=!1;var g=e.write(b);g===!1&&!f&&((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&C0(i.pipes,e)!==-1)&&!l&&(Se("false write response, pause",i.awaitDrain),i.awaitDrain++,f=!0),n.pause())}function d(b){Se("onerror",b),h(),e.removeListener("error",d),M0(e,"error")===0&&e.emit("error",b)}dj(e,"error",d);function p(){e.removeListener("finish",v),h()}e.once("close",p);function v(){Se("onfinish"),e.removeListener("close",p),h()}e.once("finish",v);function h(){Se("unpipe"),n.unpipe(e)}return e.emit("pipe",n),i.flowing||(Se("pipe resume"),n.resume()),e};function gj(e){return function(){var t=e._readableState;Se("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&M0(e,"data")&&(t.flowing=!0,op(e))}}Ie.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var i=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<r;a++)i[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=C0(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n),this)};Ie.prototype.on=function(e,t){var n=ap.prototype.on.call(this,e,t);if(e==="data")this._readableState.flowing!==!1&&this.resume();else if(e==="readable"){var i=this._readableState;!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&Fc(this):oa.nextTick(yj,this))}return n};Ie.prototype.addListener=Ie.prototype.on;function yj(e){Se("readable nexttick read 0"),e.read(0)}Ie.prototype.resume=function(){var e=this._readableState;return e.flowing||(Se("resume"),e.flowing=!0,xj(this,e)),this};function xj(e,t){t.resumeScheduled||(t.resumeScheduled=!0,oa.nextTick(wj,e,t))}function wj(e,t){t.reading||(Se("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),op(e),t.flowing&&!t.reading&&e.read(0)}Ie.prototype.pause=function(){return Se("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Se("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function op(e){var t=e._readableState;for(Se("flow",t.flowing);t.flowing&&e.read()!==null;);}Ie.prototype.wrap=function(e){var t=this,n=this._readableState,i=!1;e.on("end",function(){if(Se("wrapped end"),n.decoder&&!n.ended){var o=n.decoder.end();o&&o.length&&t.push(o)}t.push(null)}),e.on("data",function(o){if(Se("wrapped data"),n.decoder&&(o=n.decoder.write(o)),!(n.objectMode&&o==null)&&!(!n.objectMode&&(!o||!o.length))){var s=t.push(o);s||(i=!0,e.pause())}});for(var r in e)this[r]===void 0&&typeof e[r]=="function"&&(this[r]=(function(o){return function(){return e[o].apply(e,arguments)}})(r));for(var a=0;a<np.length;a++)e.on(np[a],this.emit.bind(this,np[a]));return this._read=function(o){Se("wrapped _read",o),i&&(i=!1,e.resume())},this};Object.defineProperty(Ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Ie._fromList=E0;function E0(e,t){if(t.length===0)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(t.decoder?n=t.buffer.join(""):t.buffer.length===1?n=t.buffer.head.data:n=t.buffer.concat(t.length),t.buffer.clear()):n=zj(e,t.buffer,t.decoder),n}function zj(e,t,n){var i;return e<t.head.data.length?(i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?i=t.shift():i=n?Pj(e,t):kj(e,t),i}function Pj(e,t){var n=t.head,i=1,r=n.data;for(e-=r.length;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(o===a.length?r+=a:r+=a.slice(0,e),e-=o,e===0){o===a.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++i}return t.length-=i,r}function kj(e,t){var n=ls.allocUnsafe(e),i=t.head,r=1;for(i.data.copy(n),e-=i.data.length;i=i.next;){var a=i.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),e-=o,e===0){o===a.length?(++r,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=a.slice(o));break}++r}return t.length-=r,n}function ip(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,oa.nextTick(Oj,t,e))}function Oj(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C0(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}});var sp=_((eE,B0)=>{"use strict";B0.exports=Gn;var Mc=ri(),K0=Object.create(na());K0.inherits=ra();K0.inherits(Gn,Mc);function Sj(e,t){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,t!=null&&this.push(t),i(e);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function Gn(e){if(!(this instanceof Gn))return new Gn(e);Mc.call(this,e),this._transformState={afterTransform:Sj.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",Tj)}function Tj(){var e=this;typeof this._flush=="function"?this._flush(function(t,n){G0(e,t,n)}):G0(this,null,null)}Gn.prototype.push=function(e,t){return this._transformState.needTransform=!1,Mc.prototype.push.call(this,e,t)};Gn.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")};Gn.prototype._write=function(e,t,n){var i=this._transformState;if(i.writecb=n,i.writechunk=e,i.writeencoding=t,!i.transforming){var r=this._readableState;(i.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}};Gn.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Gn.prototype._destroy=function(e,t){var n=this;Mc.prototype._destroy.call(this,e,function(i){t(i),n.emit("close")})};function G0(e,t,n){if(t)return e.emit("error",t);if(n!=null&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}});var $0=_((tE,_0)=>{"use strict";_0.exports=cs;var A0=sp(),Q0=Object.create(na());Q0.inherits=ra();Q0.inherits(cs,A0);function cs(e){if(!(this instanceof cs))return new cs(e);A0.call(this,e)}cs.prototype._transform=function(e,t,n){n(null,e)}});var lp=_((ot,Ic)=>{var On=Mn("stream");process.env.READABLE_STREAM==="disable"&&On?(Ic.exports=On,ot=Ic.exports=On.Readable,ot.Readable=On.Readable,ot.Writable=On.Writable,ot.Duplex=On.Duplex,ot.Transform=On.Transform,ot.PassThrough=On.PassThrough,ot.Stream=On):(ot=Ic.exports=Qm(),ot.Stream=On||ot,ot.Readable=ot,ot.Writable=Km(),ot.Duplex=ri(),ot.Transform=sp(),ot.PassThrough=$0())});var Kn=_(qt=>{"use strict";qt.base64=!0;qt.array=!0;qt.string=!0;qt.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";qt.nodebuffer=typeof Buffer<"u";qt.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")qt.blob=!1;else{cp=new ArrayBuffer(0);try{qt.blob=new Blob([cp],{type:"application/zip"}).size===0}catch{try{e1=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,up=new e1,up.append(cp),qt.blob=up.getBlob("application/zip").size===0}catch{qt.blob=!1}}}var cp,e1,up;try{qt.nodestream=!!lp().Readable}catch{qt.nodestream=!1}});var dp=_(fp=>{"use strict";var Xj=Ce(),jj=Kn(),Sn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";fp.encode=function(e){for(var t=[],n,i,r,a,o,s,c,l=0,u=e.length,f=u,m=Xj.getTypeOf(e)!=="string";l<e.length;)f=u-l,m?(n=e[l++],i=l<u?e[l++]:0,r=l<u?e[l++]:0):(n=e.charCodeAt(l++),i=l<u?e.charCodeAt(l++):0,r=l<u?e.charCodeAt(l++):0),a=n>>2,o=(n&3)<<4|i>>4,s=f>1?(i&15)<<2|r>>6:64,c=f>2?r&63:64,t.push(Sn.charAt(a)+Sn.charAt(o)+Sn.charAt(s)+Sn.charAt(c));return t.join("")};fp.decode=function(e){var t,n,i,r,a,o,s,c=0,l=0,u="data:";if(e.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");e=e.replace(/[^A-Za-z0-9+/=]/g,"");var f=e.length*3/4;if(e.charAt(e.length-1)===Sn.charAt(64)&&f--,e.charAt(e.length-2)===Sn.charAt(64)&&f--,f%1!==0)throw new Error("Invalid base64 input, bad content length.");var m;for(jj.uint8array?m=new Uint8Array(f|0):m=new Array(f|0);c<e.length;)r=Sn.indexOf(e.charAt(c++)),a=Sn.indexOf(e.charAt(c++)),o=Sn.indexOf(e.charAt(c++)),s=Sn.indexOf(e.charAt(c++)),t=r<<2|a>>4,n=(a&15)<<4|o>>2,i=(o&3)<<6|s,m[l++]=t,o!==64&&(m[l++]=n),s!==64&&(m[l++]=i);return m}});var us=_((iE,t1)=>{"use strict";t1.exports={isNode:typeof Buffer<"u",newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if(typeof e=="number")throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on=="function"&&typeof e.pause=="function"&&typeof e.resume=="function"}}});var a1=_((aE,i1)=>{"use strict";var n1=global.MutationObserver||global.WebKitMutationObserver,sa;process.browser?n1?(mp=0,r1=new n1(fs),pp=global.document.createTextNode(""),r1.observe(pp,{characterData:!0}),sa=function(){pp.data=mp=++mp%2}):!global.setImmediate&&typeof global.MessageChannel<"u"?(vp=new global.MessageChannel,vp.port1.onmessage=fs,sa=function(){vp.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?sa=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){fs(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:sa=function(){setTimeout(fs,0)}:sa=function(){process.nextTick(fs)};var mp,r1,pp,vp,hp,ds=[];function fs(){hp=!0;for(var e,t,n=ds.length;n;){for(t=ds,ds=[],e=-1;++e<n;)t[e]();n=ds.length}hp=!1}i1.exports=Nj;function Nj(e){ds.push(e)===1&&!hp&&sa()}});var d1=_((oE,f1)=>{"use strict";var o1=a1();function la(){}var vt={},s1=["REJECTED"],bp=["FULFILLED"],l1=["PENDING"];process.browser||(ms=["UNHANDLED"]);var ms;f1.exports=vr;function vr(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=l1,this.queue=[],this.outcome=void 0,process.browser||(this.handled=ms),e!==la&&c1(this,e)}vr.prototype.finally=function(e){if(typeof e!="function")return this;var t=this.constructor;return this.then(n,i);function n(r){function a(){return r}return t.resolve(e()).then(a)}function i(r){function a(){throw r}return t.resolve(e()).then(a)}};vr.prototype.catch=function(e){return this.then(null,e)};vr.prototype.then=function(e,t){if(typeof e!="function"&&this.state===bp||typeof t!="function"&&this.state===s1)return this;var n=new this.constructor(la);if(process.browser||this.handled===ms&&(this.handled=null),this.state!==l1){var i=this.state===bp?e:t;gp(n,i,this.outcome)}else this.queue.push(new ps(n,e,t));return n};function ps(e,t,n){this.promise=e,typeof t=="function"&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),typeof n=="function"&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}ps.prototype.callFulfilled=function(e){vt.resolve(this.promise,e)};ps.prototype.otherCallFulfilled=function(e){gp(this.promise,this.onFulfilled,e)};ps.prototype.callRejected=function(e){vt.reject(this.promise,e)};ps.prototype.otherCallRejected=function(e){gp(this.promise,this.onRejected,e)};function gp(e,t,n){o1(function(){var i;try{i=t(n)}catch(r){return vt.reject(e,r)}i===e?vt.reject(e,new TypeError("Cannot resolve promise with itself")):vt.resolve(e,i)})}vt.resolve=function(e,t){var n=u1(Lj,t);if(n.status==="error")return vt.reject(e,n.value);var i=n.value;if(i)c1(e,i);else{e.state=bp,e.outcome=t;for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callFulfilled(t)}return e};vt.reject=function(e,t){e.state=s1,e.outcome=t,process.browser||e.handled===ms&&o1(function(){e.handled===ms&&process.emit("unhandledRejection",t,e)});for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e};function Lj(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function c1(e,t){var n=!1;function i(s){n||(n=!0,vt.reject(e,s))}function r(s){n||(n=!0,vt.resolve(e,s))}function a(){t(r,i)}var o=u1(a);o.status==="error"&&i(o.value)}function u1(e,t){var n={};try{n.value=e(t),n.status="success"}catch(i){n.status="error",n.value=i}return n}vr.resolve=Zj;function Zj(e){return e instanceof this?e:vt.resolve(new this(la),e)}vr.reject=Wj;function Wj(e){var t=new this(la);return vt.reject(t,e)}vr.all=Vj;function Vj(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var r=new Array(n),a=0,o=-1,s=new this(la);++o<n;)c(e[o],o);return s;function c(l,u){t.resolve(l).then(f,function(m){i||(i=!0,vt.reject(s,m))});function f(m){r[u]=m,++a===n&&!i&&(i=!0,vt.resolve(s,r))}}}vr.race=Rj;function Rj(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var r=-1,a=new this(la);++r<n;)o(e[r]);return a;function o(s){t.resolve(s).then(function(c){i||(i=!0,vt.resolve(a,c))},function(c){i||(i=!0,vt.reject(a,c))})}}});var ca=_((sE,m1)=>{"use strict";var yp=null;typeof Promise<"u"?yp=Promise:yp=d1();m1.exports={Promise:yp}});var v1=_(p1=>{(function(e,t){"use strict";if(e.setImmediate)return;var n=1,i={},r=!1,a=e.document,o;function s(g){typeof g!="function"&&(g=new Function(""+g));for(var y=new Array(arguments.length-1),x=0;x<y.length;x++)y[x]=arguments[x+1];var z={callback:g,args:y};return i[n]=z,o(n),n++}function c(g){delete i[g]}function l(g){var y=g.callback,x=g.args;switch(x.length){case 0:y();break;case 1:y(x[0]);break;case 2:y(x[0],x[1]);break;case 3:y(x[0],x[1],x[2]);break;default:y.apply(t,x);break}}function u(g){if(r)setTimeout(u,0,g);else{var y=i[g];if(y){r=!0;try{l(y)}finally{c(g),r=!1}}}}function f(){o=function(g){process.nextTick(function(){u(g)})}}function m(){if(e.postMessage&&!e.importScripts){var g=!0,y=e.onmessage;return e.onmessage=function(){g=!1},e.postMessage("","*"),e.onmessage=y,g}}function d(){var g="setImmediate$"+Math.random()+"$",y=function(x){x.source===e&&typeof x.data=="string"&&x.data.indexOf(g)===0&&u(+x.data.slice(g.length))};e.addEventListener?e.addEventListener("message",y,!1):e.attachEvent("onmessage",y),o=function(x){e.postMessage(g+x,"*")}}function p(){var g=new MessageChannel;g.port1.onmessage=function(y){var x=y.data;u(x)},o=function(y){g.port2.postMessage(y)}}function v(){var g=a.documentElement;o=function(y){var x=a.createElement("script");x.onreadystatechange=function(){u(y),x.onreadystatechange=null,g.removeChild(x),x=null},g.appendChild(x)}}function h(){o=function(g){setTimeout(u,0,g)}}var b=Object.getPrototypeOf&&Object.getPrototypeOf(e);b=b&&b.setTimeout?b:e,{}.toString.call(e.process)==="[object process]"?f():m()?d():e.MessageChannel?p():a&&"onreadystatechange"in a.createElement("script")?v():h(),b.setImmediate=s,b.clearImmediate=c})(typeof self>"u"?typeof global>"u"?p1:global:self)});var Ce=_(Ae=>{"use strict";var hr=Kn(),Hj=dp(),ua=us(),xp=ca();v1();function Fj(e){var t=null;return hr.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),Dc(e,t)}Ae.newBlob=function(e,t){Ae.checkSupport("blob");try{return new Blob([e],{type:t})}catch{try{var n=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,i=new n;return i.append(e),i.getBlob(t)}catch{throw new Error("Bug : can't construct the Blob.")}}};function vs(e){return e}function Dc(e,t){for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)&255;return t}var qc={stringifyByChunk:function(e,t,n){var i=[],r=0,a=e.length;if(a<=n)return String.fromCharCode.apply(null,e);for(;r<a;)t==="array"||t==="nodebuffer"?i.push(String.fromCharCode.apply(null,e.slice(r,Math.min(r+n,a)))):i.push(String.fromCharCode.apply(null,e.subarray(r,Math.min(r+n,a)))),r+=n;return i.join("")},stringifyByChar:function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},applyCanBeUsed:{uint8array:(function(){try{return hr.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return hr.nodebuffer&&String.fromCharCode.apply(null,ua.allocBuffer(1)).length===1}catch{return!1}})()}};function hs(e){var t=65536,n=Ae.getTypeOf(e),i=!0;if(n==="uint8array"?i=qc.applyCanBeUsed.uint8array:n==="nodebuffer"&&(i=qc.applyCanBeUsed.nodebuffer),i)for(;t>1;)try{return qc.stringifyByChunk(e,n,t)}catch{t=Math.floor(t/2)}return qc.stringifyByChar(e)}Ae.applyFromCharCode=hs;function Jc(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}var br={};br.string={string:vs,array:function(e){return Dc(e,new Array(e.length))},arraybuffer:function(e){return br.string.uint8array(e).buffer},uint8array:function(e){return Dc(e,new Uint8Array(e.length))},nodebuffer:function(e){return Dc(e,ua.allocBuffer(e.length))}};br.array={string:hs,array:vs,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return ua.newBufferFrom(e)}};br.arraybuffer={string:function(e){return hs(new Uint8Array(e))},array:function(e){return Jc(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:vs,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return ua.newBufferFrom(new Uint8Array(e))}};br.uint8array={string:hs,array:function(e){return Jc(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:vs,nodebuffer:function(e){return ua.newBufferFrom(e)}};br.nodebuffer={string:hs,array:function(e){return Jc(e,new Array(e.length))},arraybuffer:function(e){return br.nodebuffer.uint8array(e).buffer},uint8array:function(e){return Jc(e,new Uint8Array(e.length))},nodebuffer:vs};Ae.transformTo=function(e,t){if(t||(t=""),!e)return t;Ae.checkSupport(e);var n=Ae.getTypeOf(t),i=br[n][e](t);return i};Ae.resolve=function(e){for(var t=e.split("/"),n=[],i=0;i<t.length;i++){var r=t[i];r==="."||r===""&&i!==0&&i!==t.length-1||(r===".."?n.pop():n.push(r))}return n.join("/")};Ae.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(hr.nodebuffer&&ua.isBuffer(e))return"nodebuffer";if(hr.uint8array&&e instanceof Uint8Array)return"uint8array";if(hr.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};Ae.checkSupport=function(e){var t=hr[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};Ae.MAX_VALUE_16BITS=65535;Ae.MAX_VALUE_32BITS=-1;Ae.pretty=function(e){var t="",n,i;for(i=0;i<(e||"").length;i++)n=e.charCodeAt(i),t+="\\x"+(n<16?"0":"")+n.toString(16).toUpperCase();return t};Ae.delay=function(e,t,n){setImmediate(function(){e.apply(n||null,t||[])})};Ae.inherits=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n};Ae.extend=function(){var e={},t,n;for(t=0;t<arguments.length;t++)for(n in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],n)&&typeof e[n]>"u"&&(e[n]=arguments[t][n]);return e};Ae.prepareContent=function(e,t,n,i,r){var a=xp.Promise.resolve(t).then(function(o){var s=hr.blob&&(o instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(o))!==-1);return s&&typeof FileReader<"u"?new xp.Promise(function(c,l){var u=new FileReader;u.onload=function(f){c(f.target.result)},u.onerror=function(f){l(f.target.error)},u.readAsArrayBuffer(o)}):o});return a.then(function(o){var s=Ae.getTypeOf(o);return s?(s==="arraybuffer"?o=Ae.transformTo("uint8array",o):s==="string"&&(r?o=Hj.decode(o):n&&i!==!0&&(o=Fj(o))),o):xp.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var Dt=_((uE,b1)=>{"use strict";function h1(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}h1.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return this.isFinished?!1:(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n<this._listeners[e].length;n++)this._listeners[e][n].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(n){t.processChunk(n)}),e.on("end",function(){t.end()}),e.on("error",function(n){t.error(n)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}};b1.exports=h1});var da=_(gr=>{"use strict";var fa=Ce(),ii=Kn(),Mj=us(),Uc=Dt(),bs=new Array(256);for(Bn=0;Bn<256;Bn++)bs[Bn]=Bn>=252?6:Bn>=248?5:Bn>=240?4:Bn>=224?3:Bn>=192?2:1;var Bn;bs[254]=bs[254]=1;var Ij=function(e){var t,n,i,r,a,o=e.length,s=0;for(r=0;r<o;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<o&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(ii.uint8array?t=new Uint8Array(s):t=new Array(s),a=0,r=0;a<s;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<o&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t},qj=function(e,t){var n;for(t=t||e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+bs[e[n]]>t?n:t},Dj=function(e){var t,n,i,r,a=e.length,o=new Array(a*2);for(n=0,t=0;t<a;){if(i=e[t++],i<128){o[n++]=i;continue}if(r=bs[i],r>4){o[n++]=65533,t+=r-1;continue}for(i&=r===2?31:r===3?15:7;r>1&&t<a;)i=i<<6|e[t++]&63,r--;if(r>1){o[n++]=65533;continue}i<65536?o[n++]=i:(i-=65536,o[n++]=55296|i>>10&1023,o[n++]=56320|i&1023)}return o.length!==n&&(o.subarray?o=o.subarray(0,n):o.length=n),fa.applyFromCharCode(o)};gr.utf8encode=function(t){return ii.nodebuffer?Mj.newBufferFrom(t,"utf-8"):Ij(t)};gr.utf8decode=function(t){return ii.nodebuffer?fa.transformTo("nodebuffer",t).toString("utf-8"):(t=fa.transformTo(ii.uint8array?"uint8array":"array",t),Dj(t))};function Ec(){Uc.call(this,"utf-8 decode"),this.leftOver=null}fa.inherits(Ec,Uc);Ec.prototype.processChunk=function(e){var t=fa.transformTo(ii.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(ii.uint8array){var n=t;t=new Uint8Array(n.length+this.leftOver.length),t.set(this.leftOver,0),t.set(n,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var i=qj(t),r=t;i!==t.length&&(ii.uint8array?(r=t.subarray(0,i),this.leftOver=t.subarray(i,t.length)):(r=t.slice(0,i),this.leftOver=t.slice(i,t.length))),this.push({data:gr.utf8decode(r),meta:e.meta})};Ec.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:gr.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};gr.Utf8DecodeWorker=Ec;function wp(){Uc.call(this,"utf-8 encode")}fa.inherits(wp,Uc);wp.prototype.processChunk=function(e){this.push({data:gr.utf8encode(e.data),meta:e.meta})};gr.Utf8EncodeWorker=wp});var w1=_((dE,x1)=>{"use strict";var g1=Dt(),y1=Ce();function zp(e){g1.call(this,"ConvertWorker to "+e),this.destType=e}y1.inherits(zp,g1);zp.prototype.processChunk=function(e){this.push({data:y1.transformTo(this.destType,e.data),meta:e.meta})};x1.exports=zp});var k1=_((mE,P1)=>{"use strict";var z1=lp().Readable,Jj=Ce();Jj.inherits(Pp,z1);function Pp(e,t,n){z1.call(this,t),this._helper=e;var i=this;e.on("data",function(r,a){i.push(r)||i._helper.pause(),n&&n(a)}).on("error",function(r){i.emit("error",r)}).on("end",function(){i.push(null)})}Pp.prototype._read=function(){this._helper.resume()};P1.exports=Pp});var kp=_((pE,T1)=>{"use strict";var ai=Ce(),Uj=w1(),Ej=Dt(),Cj=dp(),Yj=Kn(),Gj=ca(),O1=null;if(Yj.nodestream)try{O1=k1()}catch{}function Kj(e,t,n){switch(e){case"blob":return ai.newBlob(ai.transformTo("arraybuffer",t),n);case"base64":return Cj.encode(t);default:return ai.transformTo(e,t)}}function Bj(e,t){var n,i=0,r=null,a=0;for(n=0;n<t.length;n++)a+=t[n].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(r=new Uint8Array(a),n=0;n<t.length;n++)r.set(t[n],i),i+=t[n].length;return r;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}function Aj(e,t){return new Gj.Promise(function(n,i){var r=[],a=e._internalType,o=e._outputType,s=e._mimeType;e.on("data",function(c,l){r.push(c),t&&t(l)}).on("error",function(c){r=[],i(c)}).on("end",function(){try{var c=Kj(o,Bj(a,r),s);n(c)}catch(l){i(l)}r=[]}).resume()})}function S1(e,t,n){var i=t;switch(t){case"blob":case"arraybuffer":i="uint8array";break;case"base64":i="string";break}try{this._internalType=i,this._outputType=t,this._mimeType=n,ai.checkSupport(i),this._worker=e.pipe(new Uj(i)),e.lock()}catch(r){this._worker=new Ej("error"),this._worker.error(r)}}S1.prototype={accumulate:function(e){return Aj(this,e)},on:function(e,t){var n=this;return e==="data"?this._worker.on(e,function(i){t.call(n,i.data,i.meta)}):this._worker.on(e,function(){ai.delay(t,arguments,n)}),this},resume:function(){return ai.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(ai.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new O1(this,{objectMode:this._outputType!=="nodebuffer"},e)}};T1.exports=S1});var Op=_(on=>{"use strict";on.base64=!1;on.binary=!1;on.dir=!1;on.createFolders=!0;on.date=null;on.compression=null;on.compressionOptions=null;on.comment=null;on.unixPermissions=null;on.dosPermissions=null});var Sp=_((hE,X1)=>{"use strict";var Cc=Ce(),Yc=Dt(),Qj=16*1024;function ma(e){Yc.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(n){t.dataIsReady=!0,t.data=n,t.max=n&&n.length||0,t.type=Cc.getTypeOf(n),t.isPaused||t._tickAndRepeat()},function(n){t.error(n)})}Cc.inherits(ma,Yc);ma.prototype.cleanUp=function(){Yc.prototype.cleanUp.call(this),this.data=null};ma.prototype.resume=function(){return Yc.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,Cc.delay(this._tickAndRepeat,[],this)),!0):!1};ma.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(Cc.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};ma.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=Qj,t=null,n=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,n);break;case"uint8array":t=this.data.subarray(this.index,n);break;case"array":case"nodebuffer":t=this.data.slice(this.index,n);break}return this.index=n,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})};X1.exports=ma});var Gc=_((bE,N1)=>{"use strict";var _j=Ce();function $j(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var j1=$j();function eN(e,t,n,i){var r=j1,a=i+n;e=e^-1;for(var o=i;o<a;o++)e=e>>>8^r[(e^t[o])&255];return e^-1}function tN(e,t,n,i){var r=j1,a=i+n;e=e^-1;for(var o=i;o<a;o++)e=e>>>8^r[(e^t.charCodeAt(o))&255];return e^-1}N1.exports=function(t,n){if(typeof t>"u"||!t.length)return 0;var i=_j.getTypeOf(t)!=="string";return i?eN(n|0,t,t.length,0):tN(n|0,t,t.length,0)}});var Xp=_((gE,Z1)=>{"use strict";var L1=Dt(),nN=Gc(),rN=Ce();function Tp(){L1.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}rN.inherits(Tp,L1);Tp.prototype.processChunk=function(e){this.streamInfo.crc32=nN(e.data,this.streamInfo.crc32||0),this.push(e)};Z1.exports=Tp});var V1=_((yE,W1)=>{"use strict";var iN=Ce(),jp=Dt();function Np(e){jp.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}iN.inherits(Np,jp);Np.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}jp.prototype.processChunk.call(this,e)};W1.exports=Np});var Kc=_((xE,F1)=>{"use strict";var R1=ca(),H1=Sp(),aN=Xp(),Lp=V1();function Zp(e,t,n,i,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=i,this.compressedContent=r}Zp.prototype={getContentWorker:function(){var e=new H1(R1.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Lp("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new H1(R1.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};Zp.createWorkerFrom=function(e,t,n){return e.pipe(new aN).pipe(new Lp("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new Lp("compressedSize")).withStreamInfo("compression",t)};F1.exports=Zp});var D1=_((wE,q1)=>{"use strict";var oN=kp(),sN=Sp(),Wp=da(),Vp=Kc(),M1=Dt(),Rp=function(e,t,n){this.name=e,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=t,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}};Rp.prototype={internalStream:function(e){var t=null,n="string";try{if(!e)throw new Error("No output type specified.");n=e.toLowerCase();var i=n==="string"||n==="text";(n==="binarystring"||n==="text")&&(n="string"),t=this._decompressWorker();var r=!this._dataBinary;r&&!i&&(t=t.pipe(new Wp.Utf8EncodeWorker)),!r&&i&&(t=t.pipe(new Wp.Utf8DecodeWorker))}catch(a){t=new M1("error"),t.error(a)}return new oN(t,n,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof Vp&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new Wp.Utf8EncodeWorker)),Vp.createWorkerFrom(n,e,t)},_decompressWorker:function(){return this._data instanceof Vp?this._data.getContentWorker():this._data instanceof M1?this._data:new sN(this._data)}};var I1=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],lN=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(Bc=0;Bc<I1.length;Bc++)Rp.prototype[I1[Bc]]=lN;var Bc;q1.exports=Rp});var An=_(yt=>{"use strict";var cN=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function uN(e,t){return Object.prototype.hasOwnProperty.call(e,t)}yt.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(var i in n)uN(n,i)&&(e[i]=n[i])}}return e};yt.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var fN={arraySet:function(e,t,n,i,r){if(t.subarray&&e.subarray){e.set(t.subarray(n,n+i),r);return}for(var a=0;a<i;a++)e[r+a]=t[n+a]},flattenChunks:function(e){var t,n,i,r,a,o;for(i=0,t=0,n=e.length;t<n;t++)i+=e[t].length;for(o=new Uint8Array(i),r=0,t=0,n=e.length;t<n;t++)a=e[t],o.set(a,r),r+=a.length;return o}},dN={arraySet:function(e,t,n,i,r){for(var a=0;a<i;a++)e[r+a]=t[n+a]},flattenChunks:function(e){return[].concat.apply([],e)}};yt.setTyped=function(e){e?(yt.Buf8=Uint8Array,yt.Buf16=Uint16Array,yt.Buf32=Int32Array,yt.assign(yt,fN)):(yt.Buf8=Array,yt.Buf16=Array,yt.Buf32=Array,yt.assign(yt,dN))};yt.setTyped(cN)});var u9=_(ha=>{"use strict";var mN=An(),pN=4,J1=0,U1=1,vN=2;function va(e){for(var t=e.length;--t>=0;)e[t]=0}var hN=0,B1=1,bN=2,gN=3,yN=258,Jp=29,Ps=256,ys=Ps+1+Jp,pa=30,Up=19,A1=2*ys+1,oi=15,Hp=16,xN=7,Ep=256,Q1=16,_1=17,$1=18,qp=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Ac=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],wN=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],e9=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],zN=512,Qn=new Array((ys+2)*2);va(Qn);var gs=new Array(pa*2);va(gs);var xs=new Array(zN);va(xs);var ws=new Array(yN-gN+1);va(ws);var Cp=new Array(Jp);va(Cp);var Qc=new Array(pa);va(Qc);function Fp(e,t,n,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}var t9,n9,r9;function Mp(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function i9(e){return e<256?xs[e]:xs[256+(e>>>7)]}function zs(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function Lt(e,t,n){e.bi_valid>Hp-n?(e.bi_buf|=t<<e.bi_valid&65535,zs(e,e.bi_buf),e.bi_buf=t>>Hp-e.bi_valid,e.bi_valid+=n-Hp):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function Tn(e,t,n){Lt(e,n[t*2],n[t*2+1])}function a9(e,t){var n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1}function PN(e){e.bi_valid===16?(zs(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function kN(e,t){var n=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,f,m,d,p,v=0;for(m=0;m<=oi;m++)e.bl_count[m]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<A1;l++)u=e.heap[l],m=n[n[u*2+1]*2+1]+1,m>c&&(m=c,v++),n[u*2+1]=m,!(u>i)&&(e.bl_count[m]++,d=0,u>=s&&(d=o[u-s]),p=n[u*2],e.opt_len+=p*(m+d),a&&(e.static_len+=p*(r[u*2+1]+d)));if(v!==0){do{for(m=c-1;e.bl_count[m]===0;)m--;e.bl_count[m]--,e.bl_count[m+1]+=2,e.bl_count[c]--,v-=2}while(v>0);for(m=c;m!==0;m--)for(u=e.bl_count[m];u!==0;)f=e.heap[--l],!(f>i)&&(n[f*2+1]!==m&&(e.opt_len+=(m-n[f*2+1])*n[f*2],n[f*2+1]=m),u--)}}function o9(e,t,n){var i=new Array(oi+1),r=0,a,o;for(a=1;a<=oi;a++)i[a]=r=r+n[a-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=a9(i[s]++,s))}}function ON(){var e,t,n,i,r,a=new Array(oi+1);for(n=0,i=0;i<Jp-1;i++)for(Cp[i]=n,e=0;e<1<<qp[i];e++)ws[n++]=i;for(ws[n-1]=i,r=0,i=0;i<16;i++)for(Qc[i]=r,e=0;e<1<<Ac[i];e++)xs[r++]=i;for(r>>=7;i<pa;i++)for(Qc[i]=r<<7,e=0;e<1<<Ac[i]-7;e++)xs[256+r++]=i;for(t=0;t<=oi;t++)a[t]=0;for(e=0;e<=143;)Qn[e*2+1]=8,e++,a[8]++;for(;e<=255;)Qn[e*2+1]=9,e++,a[9]++;for(;e<=279;)Qn[e*2+1]=7,e++,a[7]++;for(;e<=287;)Qn[e*2+1]=8,e++,a[8]++;for(o9(Qn,ys+1,a),e=0;e<pa;e++)gs[e*2+1]=5,gs[e*2]=a9(e,5);t9=new Fp(Qn,qp,Ps+1,ys,oi),n9=new Fp(gs,Ac,0,pa,oi),r9=new Fp(new Array(0),wN,0,Up,xN)}function s9(e){var t;for(t=0;t<ys;t++)e.dyn_ltree[t*2]=0;for(t=0;t<pa;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Up;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Ep*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function l9(e){e.bi_valid>8?zs(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function SN(e,t,n,i){l9(e),i&&(zs(e,n),zs(e,~n)),mN.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}function E1(e,t,n,i){var r=t*2,a=n*2;return e[r]<e[a]||e[r]===e[a]&&i[t]<=i[n]}function Ip(e,t,n){for(var i=e.heap[n],r=n<<1;r<=e.heap_len&&(r<e.heap_len&&E1(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!E1(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i}function C1(e,t,n){var i,r,a=0,o,s;if(e.last_lit!==0)do i=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1],r=e.pending_buf[e.l_buf+a],a++,i===0?Tn(e,r,t):(o=ws[r],Tn(e,o+Ps+1,t),s=qp[o],s!==0&&(r-=Cp[o],Lt(e,r,s)),i--,o=i9(i),Tn(e,o,n),s=Ac[o],s!==0&&(i-=Qc[o],Lt(e,i,s)));while(a<e.last_lit);Tn(e,Ep,t)}function Dp(e,t){var n=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,c=-1,l;for(e.heap_len=0,e.heap_max=A1,o=0;o<a;o++)n[o*2]!==0?(e.heap[++e.heap_len]=c=o,e.depth[o]=0):n[o*2+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,r&&(e.static_len-=i[l*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)Ip(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ip(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[l*2]=n[o*2]+n[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=l,e.heap[1]=l++,Ip(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],kN(e,t),o9(n,c,e.bl_count)}function Y1(e,t,n){var i,r=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(n+1)*2+1]=65535,i=0;i<=n;i++)a=o,o=t[(i+1)*2+1],!(++s<c&&a===o)&&(s<l?e.bl_tree[a*2]+=s:a!==0?(a!==r&&e.bl_tree[a*2]++,e.bl_tree[Q1*2]++):s<=10?e.bl_tree[_1*2]++:e.bl_tree[$1*2]++,s=0,r=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))}function G1(e,t,n){var i,r=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),i=0;i<=n;i++)if(a=o,o=t[(i+1)*2+1],!(++s<c&&a===o)){if(s<l)do Tn(e,a,e.bl_tree);while(--s!==0);else a!==0?(a!==r&&(Tn(e,a,e.bl_tree),s--),Tn(e,Q1,e.bl_tree),Lt(e,s-3,2)):s<=10?(Tn(e,_1,e.bl_tree),Lt(e,s-3,3)):(Tn(e,$1,e.bl_tree),Lt(e,s-11,7));s=0,r=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}}function TN(e){var t;for(Y1(e,e.dyn_ltree,e.l_desc.max_code),Y1(e,e.dyn_dtree,e.d_desc.max_code),Dp(e,e.bl_desc),t=Up-1;t>=3&&e.bl_tree[e9[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function XN(e,t,n,i){var r;for(Lt(e,t-257,5),Lt(e,n-1,5),Lt(e,i-4,4),r=0;r<i;r++)Lt(e,e.bl_tree[e9[r]*2+1],3);G1(e,e.dyn_ltree,t-1),G1(e,e.dyn_dtree,n-1)}function jN(e){var t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return J1;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return U1;for(n=32;n<Ps;n++)if(e.dyn_ltree[n*2]!==0)return U1;return J1}var K1=!1;function NN(e){K1||(ON(),K1=!0),e.l_desc=new Mp(e.dyn_ltree,t9),e.d_desc=new Mp(e.dyn_dtree,n9),e.bl_desc=new Mp(e.bl_tree,r9),e.bi_buf=0,e.bi_valid=0,s9(e)}function c9(e,t,n,i){Lt(e,(hN<<1)+(i?1:0),3),SN(e,t,n,!0)}function LN(e){Lt(e,B1<<1,3),Tn(e,Ep,Qn),PN(e)}function ZN(e,t,n,i){var r,a,o=0;e.level>0?(e.strm.data_type===vN&&(e.strm.data_type=jN(e)),Dp(e,e.l_desc),Dp(e,e.d_desc),o=TN(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=n+5,n+4<=r&&t!==-1?c9(e,t,n,i):e.strategy===pN||a===r?(Lt(e,(B1<<1)+(i?1:0),3),C1(e,Qn,gs)):(Lt(e,(bN<<1)+(i?1:0),3),XN(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),C1(e,e.dyn_ltree,e.dyn_dtree)),s9(e),i&&l9(e)}function WN(e,t,n){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=n&255,e.last_lit++,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(ws[n]+Ps+1)*2]++,e.dyn_dtree[i9(t)*2]++),e.last_lit===e.lit_bufsize-1}ha._tr_init=NN;ha._tr_stored_block=c9;ha._tr_flush_block=ZN;ha._tr_tally=WN;ha._tr_align=LN});var Yp=_((kE,f9)=>{"use strict";function VN(e,t,n,i){for(var r=e&65535|0,a=e>>>16&65535|0,o=0;n!==0;){o=n>2e3?2e3:n,n-=o;do r=r+t[i++]|0,a=a+r|0;while(--o);r%=65521,a%=65521}return r|a<<16|0}f9.exports=VN});var Gp=_((OE,d9)=>{"use strict";function RN(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var HN=RN();function FN(e,t,n,i){var r=HN,a=i+n;e^=-1;for(var o=i;o<a;o++)e=e>>>8^r[(e^t[o])&255];return e^-1}d9.exports=FN});var _c=_((SE,m9)=>{"use strict";m9.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var z9=_(Nn=>{"use strict";var xt=An(),Gt=u9(),b9=Yp(),yr=Gp(),MN=_c(),ui=0,IN=1,qN=3,kr=4,p9=5,jn=0,v9=1,Kt=-2,DN=-3,Kp=-5,JN=-1,UN=1,$c=2,EN=3,CN=4,YN=0,GN=2,ru=8,KN=9,BN=15,AN=8,QN=29,_N=256,Ap=_N+1+QN,$N=30,eL=19,tL=2*Ap+1,nL=15,xe=3,zr=258,sn=zr+xe+1,rL=32,iu=42,Qp=69,eu=73,tu=91,nu=103,si=113,Os=666,et=1,Ss=2,li=3,ya=4,iL=3;function Pr(e,t){return e.msg=MN[t],t}function h9(e){return(e<<1)-(e>4?9:0)}function wr(e){for(var t=e.length;--t>=0;)e[t]=0}function xr(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(xt.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))}function st(e,t){Gt._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,xr(e.strm)}function Pe(e,t){e.pending_buf[e.pending++]=t}function ks(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function aL(e,t,n,i){var r=e.avail_in;return r>i&&(r=i),r===0?0:(e.avail_in-=r,xt.arraySet(t,e.input,e.next_in,r,n),e.state.wrap===1?e.adler=b9(e.adler,t,r,n):e.state.wrap===2&&(e.adler=yr(e.adler,t,r,n)),e.next_in+=r,e.total_in+=r,r)}function g9(e,t){var n=e.max_chain_length,i=e.strstart,r,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-sn?e.strstart-(e.w_size-sn):0,l=e.window,u=e.w_mask,f=e.prev,m=e.strstart+zr,d=l[i+o-1],p=l[i+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(r=t,!(l[r+o]!==p||l[r+o-1]!==d||l[r]!==l[i]||l[++r]!==l[i+1])){i+=2,r++;do;while(l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&i<m);if(a=zr-(m-i),i=m-zr,a>o){if(e.match_start=t,o=a,a>=s)break;d=l[i+o-1],p=l[i+o]}}while((t=f[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead}function ci(e){var t=e.w_size,n,i,r,a,o;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-sn)){xt.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,i=e.hash_size,n=i;do r=e.head[--n],e.head[n]=r>=t?r-t:0;while(--i);i=t,n=i;do r=e.prev[--n],e.prev[n]=r>=t?r-t:0;while(--i);a+=t}if(e.strm.avail_in===0)break;if(i=aL(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=i,e.lookahead+e.insert>=xe)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+xe-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<xe)););}while(e.lookahead<sn&&e.strm.avail_in!==0)}function oL(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(ci(e),e.lookahead===0&&t===ui)return et;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+n;if((e.strstart===0||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,st(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-sn&&(st(e,!1),e.strm.avail_out===0))return et}return e.insert=0,t===kr?(st(e,!0),e.strm.avail_out===0?li:ya):(e.strstart>e.block_start&&(st(e,!1),e.strm.avail_out===0),et)}function Bp(e,t){for(var n,i;;){if(e.lookahead<sn){if(ci(e),e.lookahead<sn&&t===ui)return et;if(e.lookahead===0)break}if(n=0,e.lookahead>=xe&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+xe-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-sn&&(e.match_length=g9(e,n)),e.match_length>=xe)if(i=Gt._tr_tally(e,e.strstart-e.match_start,e.match_length-xe),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=xe){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+xe-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=Gt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(st(e,!1),e.strm.avail_out===0))return et}return e.insert=e.strstart<xe-1?e.strstart:xe-1,t===kr?(st(e,!0),e.strm.avail_out===0?li:ya):e.last_lit&&(st(e,!1),e.strm.avail_out===0)?et:Ss}function ba(e,t){for(var n,i,r;;){if(e.lookahead<sn){if(ci(e),e.lookahead<sn&&t===ui)return et;if(e.lookahead===0)break}if(n=0,e.lookahead>=xe&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+xe-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=xe-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-sn&&(e.match_length=g9(e,n),e.match_length<=5&&(e.strategy===UN||e.match_length===xe&&e.strstart-e.match_start>4096)&&(e.match_length=xe-1)),e.prev_length>=xe&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-xe,i=Gt._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-xe),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=r&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+xe-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=xe-1,e.strstart++,i&&(st(e,!1),e.strm.avail_out===0))return et}else if(e.match_available){if(i=Gt._tr_tally(e,0,e.window[e.strstart-1]),i&&st(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return et}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=Gt._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<xe-1?e.strstart:xe-1,t===kr?(st(e,!0),e.strm.avail_out===0?li:ya):e.last_lit&&(st(e,!1),e.strm.avail_out===0)?et:Ss}function sL(e,t){for(var n,i,r,a,o=e.window;;){if(e.lookahead<=zr){if(ci(e),e.lookahead<=zr&&t===ui)return et;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=xe&&e.strstart>0&&(r=e.strstart-1,i=o[r],i===o[++r]&&i===o[++r]&&i===o[++r])){a=e.strstart+zr;do;while(i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&r<a);e.match_length=zr-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=xe?(n=Gt._tr_tally(e,1,e.match_length-xe),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Gt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(st(e,!1),e.strm.avail_out===0))return et}return e.insert=0,t===kr?(st(e,!0),e.strm.avail_out===0?li:ya):e.last_lit&&(st(e,!1),e.strm.avail_out===0)?et:Ss}function lL(e,t){for(var n;;){if(e.lookahead===0&&(ci(e),e.lookahead===0)){if(t===ui)return et;break}if(e.match_length=0,n=Gt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(st(e,!1),e.strm.avail_out===0))return et}return e.insert=0,t===kr?(st(e,!0),e.strm.avail_out===0?li:ya):e.last_lit&&(st(e,!1),e.strm.avail_out===0)?et:Ss}function Xn(e,t,n,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=r}var ga;ga=[new Xn(0,0,0,0,oL),new Xn(4,4,8,4,Bp),new Xn(4,5,16,8,Bp),new Xn(4,6,32,32,Bp),new Xn(4,4,16,16,ba),new Xn(8,16,32,32,ba),new Xn(8,16,128,128,ba),new Xn(8,32,128,256,ba),new Xn(32,128,258,1024,ba),new Xn(32,258,258,4096,ba)];function cL(e){e.window_size=2*e.w_size,wr(e.head),e.max_lazy_match=ga[e.level].max_lazy,e.good_match=ga[e.level].good_length,e.nice_match=ga[e.level].nice_length,e.max_chain_length=ga[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=xe-1,e.match_available=0,e.ins_h=0}function uL(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ru,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new xt.Buf16(tL*2),this.dyn_dtree=new xt.Buf16((2*$N+1)*2),this.bl_tree=new xt.Buf16((2*eL+1)*2),wr(this.dyn_ltree),wr(this.dyn_dtree),wr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new xt.Buf16(nL+1),this.heap=new xt.Buf16(2*Ap+1),wr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new xt.Buf16(2*Ap+1),wr(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function y9(e){var t;return!e||!e.state?Pr(e,Kt):(e.total_in=e.total_out=0,e.data_type=GN,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?iu:si,e.adler=t.wrap===2?0:1,t.last_flush=ui,Gt._tr_init(t),jn)}function x9(e){var t=y9(e);return t===jn&&cL(e.state),t}function fL(e,t){return!e||!e.state||e.state.wrap!==2?Kt:(e.state.gzhead=t,jn)}function w9(e,t,n,i,r,a){if(!e)return Kt;var o=1;if(t===JN&&(t=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),r<1||r>KN||n!==ru||i<8||i>15||t<0||t>9||a<0||a>CN)return Pr(e,Kt);i===8&&(i=9);var s=new uL;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=r+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+xe-1)/xe),s.window=new xt.Buf8(s.w_size*2),s.head=new xt.Buf16(s.hash_size),s.prev=new xt.Buf16(s.w_size),s.lit_bufsize=1<<r+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new xt.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=n,x9(e)}function dL(e,t){return w9(e,t,ru,BN,AN,YN)}function mL(e,t){var n,i,r,a;if(!e||!e.state||t>p9||t<0)return e?Pr(e,Kt):Kt;if(i=e.state,!e.output||!e.input&&e.avail_in!==0||i.status===Os&&t!==kr)return Pr(e,e.avail_out===0?Kp:Kt);if(i.strm=e,n=i.last_flush,i.last_flush=t,i.status===iu)if(i.wrap===2)e.adler=0,Pe(i,31),Pe(i,139),Pe(i,8),i.gzhead?(Pe(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Pe(i,i.gzhead.time&255),Pe(i,i.gzhead.time>>8&255),Pe(i,i.gzhead.time>>16&255),Pe(i,i.gzhead.time>>24&255),Pe(i,i.level===9?2:i.strategy>=$c||i.level<2?4:0),Pe(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(Pe(i,i.gzhead.extra.length&255),Pe(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=yr(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=Qp):(Pe(i,0),Pe(i,0),Pe(i,0),Pe(i,0),Pe(i,0),Pe(i,i.level===9?2:i.strategy>=$c||i.level<2?4:0),Pe(i,iL),i.status=si);else{var o=ru+(i.w_bits-8<<4)<<8,s=-1;i.strategy>=$c||i.level<2?s=0:i.level<6?s=1:i.level===6?s=2:s=3,o|=s<<6,i.strstart!==0&&(o|=rL),o+=31-o%31,i.status=si,ks(i,o),i.strstart!==0&&(ks(i,e.adler>>>16),ks(i,e.adler&65535)),e.adler=1}if(i.status===Qp)if(i.gzhead.extra){for(r=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=yr(e.adler,i.pending_buf,i.pending-r,r)),xr(e),r=i.pending,i.pending===i.pending_buf_size));)Pe(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>r&&(e.adler=yr(e.adler,i.pending_buf,i.pending-r,r)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=eu)}else i.status=eu;if(i.status===eu)if(i.gzhead.name){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=yr(e.adler,i.pending_buf,i.pending-r,r)),xr(e),r=i.pending,i.pending===i.pending_buf_size)){a=1;break}i.gzindex<i.gzhead.name.length?a=i.gzhead.name.charCodeAt(i.gzindex++)&255:a=0,Pe(i,a)}while(a!==0);i.gzhead.hcrc&&i.pending>r&&(e.adler=yr(e.adler,i.pending_buf,i.pending-r,r)),a===0&&(i.gzindex=0,i.status=tu)}else i.status=tu;if(i.status===tu)if(i.gzhead.comment){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=yr(e.adler,i.pending_buf,i.pending-r,r)),xr(e),r=i.pending,i.pending===i.pending_buf_size)){a=1;break}i.gzindex<i.gzhead.comment.length?a=i.gzhead.comment.charCodeAt(i.gzindex++)&255:a=0,Pe(i,a)}while(a!==0);i.gzhead.hcrc&&i.pending>r&&(e.adler=yr(e.adler,i.pending_buf,i.pending-r,r)),a===0&&(i.status=nu)}else i.status=nu;if(i.status===nu&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&xr(e),i.pending+2<=i.pending_buf_size&&(Pe(i,e.adler&255),Pe(i,e.adler>>8&255),e.adler=0,i.status=si)):i.status=si),i.pending!==0){if(xr(e),e.avail_out===0)return i.last_flush=-1,jn}else if(e.avail_in===0&&h9(t)<=h9(n)&&t!==kr)return Pr(e,Kp);if(i.status===Os&&e.avail_in!==0)return Pr(e,Kp);if(e.avail_in!==0||i.lookahead!==0||t!==ui&&i.status!==Os){var c=i.strategy===$c?lL(i,t):i.strategy===EN?sL(i,t):ga[i.level].func(i,t);if((c===li||c===ya)&&(i.status=Os),c===et||c===li)return e.avail_out===0&&(i.last_flush=-1),jn;if(c===Ss&&(t===IN?Gt._tr_align(i):t!==p9&&(Gt._tr_stored_block(i,0,0,!1),t===qN&&(wr(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),xr(e),e.avail_out===0))return i.last_flush=-1,jn}return t!==kr?jn:i.wrap<=0?v9:(i.wrap===2?(Pe(i,e.adler&255),Pe(i,e.adler>>8&255),Pe(i,e.adler>>16&255),Pe(i,e.adler>>24&255),Pe(i,e.total_in&255),Pe(i,e.total_in>>8&255),Pe(i,e.total_in>>16&255),Pe(i,e.total_in>>24&255)):(ks(i,e.adler>>>16),ks(i,e.adler&65535)),xr(e),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?jn:v9)}function pL(e){var t;return!e||!e.state?Kt:(t=e.state.status,t!==iu&&t!==Qp&&t!==eu&&t!==tu&&t!==nu&&t!==si&&t!==Os?Pr(e,Kt):(e.state=null,t===si?Pr(e,DN):jn))}function vL(e,t){var n=t.length,i,r,a,o,s,c,l,u;if(!e||!e.state||(i=e.state,o=i.wrap,o===2||o===1&&i.status!==iu||i.lookahead))return Kt;for(o===1&&(e.adler=b9(e.adler,t,n,0)),i.wrap=0,n>=i.w_size&&(o===0&&(wr(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new xt.Buf8(i.w_size),xt.arraySet(u,t,n-i.w_size,i.w_size,0),t=u,n=i.w_size),s=e.avail_in,c=e.next_in,l=e.input,e.avail_in=n,e.next_in=0,e.input=t,ci(i);i.lookahead>=xe;){r=i.strstart,a=i.lookahead-(xe-1);do i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+xe-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++;while(--a);i.strstart=r,i.lookahead=xe-1,ci(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=xe-1,i.match_available=0,e.next_in=c,e.input=l,e.avail_in=s,i.wrap=o,jn}Nn.deflateInit=dL;Nn.deflateInit2=w9;Nn.deflateReset=x9;Nn.deflateResetKeep=y9;Nn.deflateSetHeader=fL;Nn.deflate=mL;Nn.deflateEnd=pL;Nn.deflateSetDictionary=vL;Nn.deflateInfo="pako deflate (from Nodeca project)"});var _p=_(xa=>{"use strict";var au=An(),P9=!0,k9=!0;try{String.fromCharCode.apply(null,[0])}catch{P9=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{k9=!1}var Ts=new au.Buf8(256);for(_n=0;_n<256;_n++)Ts[_n]=_n>=252?6:_n>=248?5:_n>=240?4:_n>=224?3:_n>=192?2:1;var _n;Ts[254]=Ts[254]=1;xa.string2buf=function(e){var t,n,i,r,a,o=e.length,s=0;for(r=0;r<o;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<o&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new au.Buf8(s),a=0,r=0;a<s;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<o&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t};function O9(e,t){if(t<65534&&(e.subarray&&k9||!e.subarray&&P9))return String.fromCharCode.apply(null,au.shrinkBuf(e,t));for(var n="",i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n}xa.buf2binstring=function(e){return O9(e,e.length)};xa.binstring2buf=function(e){for(var t=new au.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t};xa.buf2string=function(e,t){var n,i,r,a,o=t||e.length,s=new Array(o*2);for(i=0,n=0;n<o;){if(r=e[n++],r<128){s[i++]=r;continue}if(a=Ts[r],a>4){s[i++]=65533,n+=a-1;continue}for(r&=a===2?31:a===3?15:7;a>1&&n<o;)r=r<<6|e[n++]&63,a--;if(a>1){s[i++]=65533;continue}r<65536?s[i++]=r:(r-=65536,s[i++]=55296|r>>10&1023,s[i++]=56320|r&1023)}return O9(s,i)};xa.utf8border=function(e,t){var n;for(t=t||e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+Ts[e[n]]>t?n:t}});var $p=_((jE,S9)=>{"use strict";function hL(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}S9.exports=hL});var N9=_(Ns=>{"use strict";var Xs=z9(),js=An(),tv=_p(),nv=_c(),bL=$p(),j9=Object.prototype.toString,gL=0,ev=4,wa=0,T9=1,X9=2,yL=-1,xL=0,wL=8;function fi(e){if(!(this instanceof fi))return new fi(e);this.options=js.assign({level:yL,method:wL,chunkSize:16384,windowBits:15,memLevel:8,strategy:xL,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new bL,this.strm.avail_out=0;var n=Xs.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==wa)throw new Error(nv[n]);if(t.header&&Xs.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(typeof t.dictionary=="string"?i=tv.string2buf(t.dictionary):j9.call(t.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(t.dictionary):i=t.dictionary,n=Xs.deflateSetDictionary(this.strm,i),n!==wa)throw new Error(nv[n]);this._dict_set=!0}}fi.prototype.push=function(e,t){var n=this.strm,i=this.options.chunkSize,r,a;if(this.ended)return!1;a=t===~~t?t:t===!0?ev:gL,typeof e=="string"?n.input=tv.string2buf(e):j9.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new js.Buf8(i),n.next_out=0,n.avail_out=i),r=Xs.deflate(n,a),r!==T9&&r!==wa)return this.onEnd(r),this.ended=!0,!1;(n.avail_out===0||n.avail_in===0&&(a===ev||a===X9))&&(this.options.to==="string"?this.onData(tv.buf2binstring(js.shrinkBuf(n.output,n.next_out))):this.onData(js.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||n.avail_out===0)&&r!==T9);return a===ev?(r=Xs.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===wa):(a===X9&&(this.onEnd(wa),n.avail_out=0),!0)};fi.prototype.onData=function(e){this.chunks.push(e)};fi.prototype.onEnd=function(e){e===wa&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=js.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function rv(e,t){var n=new fi(t);if(n.push(e,!0),n.err)throw n.msg||nv[n.err];return n.result}function zL(e,t){return t=t||{},t.raw=!0,rv(e,t)}function PL(e,t){return t=t||{},t.gzip=!0,rv(e,t)}Ns.Deflate=fi;Ns.deflate=rv;Ns.deflateRaw=zL;Ns.gzip=PL});var Z9=_((LE,L9)=>{"use strict";var ou=30,kL=12;L9.exports=function(t,n){var i,r,a,o,s,c,l,u,f,m,d,p,v,h,b,g,y,x,z,S,P,T,j,X,w;i=t.state,r=t.next_in,X=t.input,a=r+(t.avail_in-5),o=t.next_out,w=t.output,s=o-(n-t.avail_out),c=o+(t.avail_out-257),l=i.dmax,u=i.wsize,f=i.whave,m=i.wnext,d=i.window,p=i.hold,v=i.bits,h=i.lencode,b=i.distcode,g=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;e:do{v<15&&(p+=X[r++]<<v,v+=8,p+=X[r++]<<v,v+=8),x=h[p&g];t:for(;;){if(z=x>>>24,p>>>=z,v-=z,z=x>>>16&255,z===0)w[o++]=x&65535;else if(z&16){S=x&65535,z&=15,z&&(v<z&&(p+=X[r++]<<v,v+=8),S+=p&(1<<z)-1,p>>>=z,v-=z),v<15&&(p+=X[r++]<<v,v+=8,p+=X[r++]<<v,v+=8),x=b[p&y];n:for(;;){if(z=x>>>24,p>>>=z,v-=z,z=x>>>16&255,z&16){if(P=x&65535,z&=15,v<z&&(p+=X[r++]<<v,v+=8,v<z&&(p+=X[r++]<<v,v+=8)),P+=p&(1<<z)-1,P>l){t.msg="invalid distance too far back",i.mode=ou;break e}if(p>>>=z,v-=z,z=o-s,P>z){if(z=P-z,z>f&&i.sane){t.msg="invalid distance too far back",i.mode=ou;break e}if(T=0,j=d,m===0){if(T+=u-z,z<S){S-=z;do w[o++]=d[T++];while(--z);T=o-P,j=w}}else if(m<z){if(T+=u+m-z,z-=m,z<S){S-=z;do w[o++]=d[T++];while(--z);if(T=0,m<S){z=m,S-=z;do w[o++]=d[T++];while(--z);T=o-P,j=w}}}else if(T+=m-z,z<S){S-=z;do w[o++]=d[T++];while(--z);T=o-P,j=w}for(;S>2;)w[o++]=j[T++],w[o++]=j[T++],w[o++]=j[T++],S-=3;S&&(w[o++]=j[T++],S>1&&(w[o++]=j[T++]))}else{T=o-P;do w[o++]=w[T++],w[o++]=w[T++],w[o++]=w[T++],S-=3;while(S>2);S&&(w[o++]=w[T++],S>1&&(w[o++]=w[T++]))}}else if((z&64)===0){x=b[(x&65535)+(p&(1<<z)-1)];continue n}else{t.msg="invalid distance code",i.mode=ou;break e}break}}else if((z&64)===0){x=h[(x&65535)+(p&(1<<z)-1)];continue t}else if(z&32){i.mode=kL;break e}else{t.msg="invalid literal/length code",i.mode=ou;break e}break}}while(r<a&&o<c);S=v>>3,r-=S,v-=S<<3,p&=(1<<v)-1,t.next_in=r,t.next_out=o,t.avail_in=r<a?5+(a-r):5-(r-a),t.avail_out=o<c?257+(c-o):257-(o-c),i.hold=p,i.bits=v}});var I9=_((ZE,M9)=>{"use strict";var W9=An(),za=15,V9=852,R9=592,H9=0,iv=1,F9=2,OL=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],SL=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],TL=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],XL=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];M9.exports=function(t,n,i,r,a,o,s,c){var l=c.bits,u=0,f=0,m=0,d=0,p=0,v=0,h=0,b=0,g=0,y=0,x,z,S,P,T,j=null,X=0,w,N=new W9.Buf16(za+1),F=new W9.Buf16(za+1),C=null,R=0,E,Y,K;for(u=0;u<=za;u++)N[u]=0;for(f=0;f<r;f++)N[n[i+f]]++;for(p=l,d=za;d>=1&&N[d]===0;d--);if(p>d&&(p=d),d===0)return a[o++]=1<<24|64<<16|0,a[o++]=1<<24|64<<16|0,c.bits=1,0;for(m=1;m<d&&N[m]===0;m++);for(p<m&&(p=m),b=1,u=1;u<=za;u++)if(b<<=1,b-=N[u],b<0)return-1;if(b>0&&(t===H9||d!==1))return-1;for(F[1]=0,u=1;u<za;u++)F[u+1]=F[u]+N[u];for(f=0;f<r;f++)n[i+f]!==0&&(s[F[n[i+f]]++]=f);if(t===H9?(j=C=s,w=19):t===iv?(j=OL,X-=257,C=SL,R-=257,w=256):(j=TL,C=XL,w=-1),y=0,f=0,u=m,T=o,v=p,h=0,S=-1,g=1<<p,P=g-1,t===iv&&g>V9||t===F9&&g>R9)return 1;for(;;){E=u-h,s[f]<w?(Y=0,K=s[f]):s[f]>w?(Y=C[R+s[f]],K=j[X+s[f]]):(Y=96,K=0),x=1<<u-h,z=1<<v,m=z;do z-=x,a[T+(y>>h)+z]=E<<24|Y<<16|K|0;while(z!==0);for(x=1<<u-1;y&x;)x>>=1;if(x!==0?(y&=x-1,y+=x):y=0,f++,--N[u]===0){if(u===d)break;u=n[i+s[f]]}if(u>p&&(y&P)!==S){for(h===0&&(h=p),T+=m,v=u-h,b=1<<v;v+h<d&&(b-=N[v+h],!(b<=0));)v++,b<<=1;if(g+=1<<v,t===iv&&g>V9||t===F9&&g>R9)return 1;S=y&P,a[S]=p<<24|v<<16|T-o|0}}return y!==0&&(a[T+y]=u-h<<24|64<<16|0),c.bits=p,0}});var x7=_(ln=>{"use strict";var Jt=An(),uv=Yp(),Ln=Gp(),jL=Z9(),Ls=I9(),NL=0,f7=1,d7=2,q9=4,LL=5,su=6,di=0,ZL=1,WL=2,Bt=-2,m7=-3,fv=-4,VL=-5,D9=8,p7=1,J9=2,U9=3,E9=4,C9=5,Y9=6,G9=7,K9=8,B9=9,A9=10,uu=11,$n=12,av=13,Q9=14,ov=15,_9=16,$9=17,e7=18,t7=19,lu=20,cu=21,n7=22,r7=23,i7=24,a7=25,o7=26,sv=27,s7=28,l7=29,De=30,dv=31,RL=32,HL=852,FL=592,ML=15,IL=ML;function c7(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function qL(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Jt.Buf16(320),this.work=new Jt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v7(e){var t;return!e||!e.state?Bt:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=p7,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Jt.Buf32(HL),t.distcode=t.distdyn=new Jt.Buf32(FL),t.sane=1,t.back=-1,di)}function h7(e){var t;return!e||!e.state?Bt:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,v7(e))}function b7(e,t){var n,i;return!e||!e.state||(i=e.state,t<0?(n=0,t=-t):(n=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?Bt:(i.window!==null&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,h7(e))}function g7(e,t){var n,i;return e?(i=new qL,e.state=i,i.window=null,n=b7(e,t),n!==di&&(e.state=null),n):Bt}function DL(e){return g7(e,IL)}var u7=!0,lv,cv;function JL(e){if(u7){var t;for(lv=new Jt.Buf32(512),cv=new Jt.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Ls(f7,e.lens,0,288,lv,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Ls(d7,e.lens,0,32,cv,0,e.work,{bits:5}),u7=!1}e.lencode=lv,e.lenbits=9,e.distcode=cv,e.distbits=5}function y7(e,t,n,i){var r,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Jt.Buf8(a.wsize)),i>=a.wsize?(Jt.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>i&&(r=i),Jt.arraySet(a.window,t,n-i,r,a.wnext),i-=r,i?(Jt.arraySet(a.window,t,n-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0}function UL(e,t){var n,i,r,a,o,s,c,l,u,f,m,d,p,v,h=0,b,g,y,x,z,S,P,T,j=new Jt.Buf8(4),X,w,N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return Bt;n=e.state,n.mode===$n&&(n.mode=av),o=e.next_out,r=e.output,c=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=n.hold,u=n.bits,f=s,m=c,T=di;e:for(;;)switch(n.mode){case p7:if(n.wrap===0){n.mode=av;break}for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(n.wrap&2&&l===35615){n.check=0,j[0]=l&255,j[1]=l>>>8&255,n.check=Ln(n.check,j,2,0),l=0,u=0,n.mode=J9;break}if(n.flags=0,n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg="incorrect header check",n.mode=De;break}if((l&15)!==D9){e.msg="unknown compression method",n.mode=De;break}if(l>>>=4,u-=4,P=(l&15)+8,n.wbits===0)n.wbits=P;else if(P>n.wbits){e.msg="invalid window size",n.mode=De;break}n.dmax=1<<P,e.adler=n.check=1,n.mode=l&512?A9:$n,l=0,u=0;break;case J9:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(n.flags=l,(n.flags&255)!==D9){e.msg="unknown compression method",n.mode=De;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=De;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&(j[0]=l&255,j[1]=l>>>8&255,n.check=Ln(n.check,j,2,0)),l=0,u=0,n.mode=U9;case U9:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.head&&(n.head.time=l),n.flags&512&&(j[0]=l&255,j[1]=l>>>8&255,j[2]=l>>>16&255,j[3]=l>>>24&255,n.check=Ln(n.check,j,4,0)),l=0,u=0,n.mode=E9;case E9:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&(j[0]=l&255,j[1]=l>>>8&255,n.check=Ln(n.check,j,2,0)),l=0,u=0,n.mode=C9;case C9:if(n.flags&1024){for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&(j[0]=l&255,j[1]=l>>>8&255,n.check=Ln(n.check,j,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=Y9;case Y9:if(n.flags&1024&&(d=n.length,d>s&&(d=s),d&&(n.head&&(P=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Jt.arraySet(n.head.extra,i,a,d,P)),n.flags&512&&(n.check=Ln(n.check,i,d,a)),s-=d,a+=d,n.length-=d),n.length))break e;n.length=0,n.mode=G9;case G9:if(n.flags&2048){if(s===0)break e;d=0;do P=i[a+d++],n.head&&P&&n.length<65536&&(n.head.name+=String.fromCharCode(P));while(P&&d<s);if(n.flags&512&&(n.check=Ln(n.check,i,d,a)),s-=d,a+=d,P)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=K9;case K9:if(n.flags&4096){if(s===0)break e;d=0;do P=i[a+d++],n.head&&P&&n.length<65536&&(n.head.comment+=String.fromCharCode(P));while(P&&d<s);if(n.flags&512&&(n.check=Ln(n.check,i,d,a)),s-=d,a+=d,P)break e}else n.head&&(n.head.comment=null);n.mode=B9;case B9:if(n.flags&512){for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(l!==(n.check&65535)){e.msg="header crc mismatch",n.mode=De;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=$n;break;case A9:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}e.adler=n.check=c7(l),l=0,u=0,n.mode=uu;case uu:if(n.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,WL;e.adler=n.check=1,n.mode=$n;case $n:if(t===LL||t===su)break e;case av:if(n.last){l>>>=u&7,u-=u&7,n.mode=sv;break}for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}switch(n.last=l&1,l>>>=1,u-=1,l&3){case 0:n.mode=Q9;break;case 1:if(JL(n),n.mode=lu,t===su){l>>>=2,u-=2;break e}break;case 2:n.mode=$9;break;case 3:e.msg="invalid block type",n.mode=De}l>>>=2,u-=2;break;case Q9:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((l&65535)!==(l>>>16^65535)){e.msg="invalid stored block lengths",n.mode=De;break}if(n.length=l&65535,l=0,u=0,n.mode=ov,t===su)break e;case ov:n.mode=_9;case _9:if(d=n.length,d){if(d>s&&(d=s),d>c&&(d=c),d===0)break e;Jt.arraySet(r,i,a,d,o),s-=d,a+=d,c-=d,o+=d,n.length-=d;break}n.mode=$n;break;case $9:for(;u<14;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(n.nlen=(l&31)+257,l>>>=5,u-=5,n.ndist=(l&31)+1,l>>>=5,u-=5,n.ncode=(l&15)+4,l>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=De;break}n.have=0,n.mode=e7;case e7:for(;n.have<n.ncode;){for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.lens[N[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[N[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,X={bits:n.lenbits},T=Ls(NL,n.lens,0,19,n.lencode,0,n.work,X),n.lenbits=X.bits,T){e.msg="invalid code lengths set",n.mode=De;break}n.have=0,n.mode=t7;case t7:for(;n.have<n.nlen+n.ndist;){for(;h=n.lencode[l&(1<<n.lenbits)-1],b=h>>>24,g=h>>>16&255,y=h&65535,!(b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(y<16)l>>>=b,u-=b,n.lens[n.have++]=y;else{if(y===16){for(w=b+2;u<w;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(l>>>=b,u-=b,n.have===0){e.msg="invalid bit length repeat",n.mode=De;break}P=n.lens[n.have-1],d=3+(l&3),l>>>=2,u-=2}else if(y===17){for(w=b+3;u<w;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=b,u-=b,P=0,d=3+(l&7),l>>>=3,u-=3}else{for(w=b+7;u<w;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=b,u-=b,P=0,d=11+(l&127),l>>>=7,u-=7}if(n.have+d>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=De;break}for(;d--;)n.lens[n.have++]=P}}if(n.mode===De)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=De;break}if(n.lenbits=9,X={bits:n.lenbits},T=Ls(f7,n.lens,0,n.nlen,n.lencode,0,n.work,X),n.lenbits=X.bits,T){e.msg="invalid literal/lengths set",n.mode=De;break}if(n.distbits=6,n.distcode=n.distdyn,X={bits:n.distbits},T=Ls(d7,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,X),n.distbits=X.bits,T){e.msg="invalid distances set",n.mode=De;break}if(n.mode=lu,t===su)break e;case lu:n.mode=cu;case cu:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,jL(e,m),o=e.next_out,r=e.output,c=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=n.hold,u=n.bits,n.mode===$n&&(n.back=-1);break}for(n.back=0;h=n.lencode[l&(1<<n.lenbits)-1],b=h>>>24,g=h>>>16&255,y=h&65535,!(b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(g&&(g&240)===0){for(x=b,z=g,S=y;h=n.lencode[S+((l&(1<<x+z)-1)>>x)],b=h>>>24,g=h>>>16&255,y=h&65535,!(x+b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=x,u-=x,n.back+=x}if(l>>>=b,u-=b,n.back+=b,n.length=y,g===0){n.mode=o7;break}if(g&32){n.back=-1,n.mode=$n;break}if(g&64){e.msg="invalid literal/length code",n.mode=De;break}n.extra=g&15,n.mode=n7;case n7:if(n.extra){for(w=n.extra;u<w;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=r7;case r7:for(;h=n.distcode[l&(1<<n.distbits)-1],b=h>>>24,g=h>>>16&255,y=h&65535,!(b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((g&240)===0){for(x=b,z=g,S=y;h=n.distcode[S+((l&(1<<x+z)-1)>>x)],b=h>>>24,g=h>>>16&255,y=h&65535,!(x+b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=x,u-=x,n.back+=x}if(l>>>=b,u-=b,n.back+=b,g&64){e.msg="invalid distance code",n.mode=De;break}n.offset=y,n.extra=g&15,n.mode=i7;case i7:if(n.extra){for(w=n.extra;u<w;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=De;break}n.mode=a7;case a7:if(c===0)break e;if(d=m-c,n.offset>d){if(d=n.offset-d,d>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=De;break}d>n.wnext?(d-=n.wnext,p=n.wsize-d):p=n.wnext-d,d>n.length&&(d=n.length),v=n.window}else v=r,p=o-n.offset,d=n.length;d>c&&(d=c),c-=d,n.length-=d;do r[o++]=v[p++];while(--d);n.length===0&&(n.mode=cu);break;case o7:if(c===0)break e;r[o++]=n.length,c--,n.mode=cu;break;case sv:if(n.wrap){for(;u<32;){if(s===0)break e;s--,l|=i[a++]<<u,u+=8}if(m-=c,e.total_out+=m,n.total+=m,m&&(e.adler=n.check=n.flags?Ln(n.check,r,m,o-m):uv(n.check,r,m,o-m)),m=c,(n.flags?l:c7(l))!==n.check){e.msg="incorrect data check",n.mode=De;break}l=0,u=0}n.mode=s7;case s7:if(n.wrap&&n.flags){for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(l!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=De;break}l=0,u=0}n.mode=l7;case l7:T=ZL;break e;case De:T=m7;break e;case dv:return fv;case RL:default:return Bt}return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,(n.wsize||m!==e.avail_out&&n.mode<De&&(n.mode<sv||t!==q9))&&y7(e,e.output,e.next_out,m-e.avail_out)?(n.mode=dv,fv):(f-=e.avail_in,m-=e.avail_out,e.total_in+=f,e.total_out+=m,n.total+=m,n.wrap&&m&&(e.adler=n.check=n.flags?Ln(n.check,r,m,e.next_out-m):uv(n.check,r,m,e.next_out-m)),e.data_type=n.bits+(n.last?64:0)+(n.mode===$n?128:0)+(n.mode===lu||n.mode===ov?256:0),(f===0&&m===0||t===q9)&&T===di&&(T=VL),T)}function EL(e){if(!e||!e.state)return Bt;var t=e.state;return t.window&&(t.window=null),e.state=null,di}function CL(e,t){var n;return!e||!e.state||(n=e.state,(n.wrap&2)===0)?Bt:(n.head=t,t.done=!1,di)}function YL(e,t){var n=t.length,i,r,a;return!e||!e.state||(i=e.state,i.wrap!==0&&i.mode!==uu)?Bt:i.mode===uu&&(r=1,r=uv(r,t,n,0),r!==i.check)?m7:(a=y7(e,t,n,n),a?(i.mode=dv,fv):(i.havedict=1,di))}ln.inflateReset=h7;ln.inflateReset2=b7;ln.inflateResetKeep=v7;ln.inflateInit=DL;ln.inflateInit2=g7;ln.inflate=UL;ln.inflateEnd=EL;ln.inflateGetHeader=CL;ln.inflateSetDictionary=YL;ln.inflateInfo="pako inflate (from Nodeca project)"});var mv=_((VE,w7)=>{"use strict";w7.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var P7=_((RE,z7)=>{"use strict";function GL(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}z7.exports=GL});var O7=_(Ws=>{"use strict";var Pa=x7(),Zs=An(),fu=_p(),Ke=mv(),pv=_c(),KL=$p(),BL=P7(),k7=Object.prototype.toString;function mi(e){if(!(this instanceof mi))return new mi(e);this.options=Zs.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new KL,this.strm.avail_out=0;var n=Pa.inflateInit2(this.strm,t.windowBits);if(n!==Ke.Z_OK)throw new Error(pv[n]);if(this.header=new BL,Pa.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=fu.string2buf(t.dictionary):k7.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Pa.inflateSetDictionary(this.strm,t.dictionary),n!==Ke.Z_OK)))throw new Error(pv[n])}mi.prototype.push=function(e,t){var n=this.strm,i=this.options.chunkSize,r=this.options.dictionary,a,o,s,c,l,u=!1;if(this.ended)return!1;o=t===~~t?t:t===!0?Ke.Z_FINISH:Ke.Z_NO_FLUSH,typeof e=="string"?n.input=fu.binstring2buf(e):k7.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Zs.Buf8(i),n.next_out=0,n.avail_out=i),a=Pa.inflate(n,Ke.Z_NO_FLUSH),a===Ke.Z_NEED_DICT&&r&&(a=Pa.inflateSetDictionary(this.strm,r)),a===Ke.Z_BUF_ERROR&&u===!0&&(a=Ke.Z_OK,u=!1),a!==Ke.Z_STREAM_END&&a!==Ke.Z_OK)return this.onEnd(a),this.ended=!0,!1;n.next_out&&(n.avail_out===0||a===Ke.Z_STREAM_END||n.avail_in===0&&(o===Ke.Z_FINISH||o===Ke.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=fu.utf8border(n.output,n.next_out),c=n.next_out-s,l=fu.buf2string(n.output,s),n.next_out=c,n.avail_out=i-c,c&&Zs.arraySet(n.output,n.output,s,c,0),this.onData(l)):this.onData(Zs.shrinkBuf(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(u=!0)}while((n.avail_in>0||n.avail_out===0)&&a!==Ke.Z_STREAM_END);return a===Ke.Z_STREAM_END&&(o=Ke.Z_FINISH),o===Ke.Z_FINISH?(a=Pa.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Ke.Z_OK):(o===Ke.Z_SYNC_FLUSH&&(this.onEnd(Ke.Z_OK),n.avail_out=0),!0)};mi.prototype.onData=function(e){this.chunks.push(e)};mi.prototype.onEnd=function(e){e===Ke.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Zs.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function vv(e,t){var n=new mi(t);if(n.push(e,!0),n.err)throw n.msg||pv[n.err];return n.result}function AL(e,t){return t=t||{},t.raw=!0,vv(e,t)}Ws.Inflate=mi;Ws.inflate=vv;Ws.inflateRaw=AL;Ws.ungzip=vv});var X7=_((FE,T7)=>{"use strict";var QL=An().assign,_L=N9(),$L=O7(),eZ=mv(),S7={};QL(S7,_L,$L,eZ);T7.exports=S7});var N7=_(mu=>{"use strict";var tZ=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",nZ=X7(),j7=Ce(),du=Dt(),rZ=tZ?"uint8array":"array";mu.magic="\b\0";function pi(e,t){du.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}j7.inherits(pi,du);pi.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(j7.transformTo(rZ,e.data),!1)};pi.prototype.flush=function(){du.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};pi.prototype.cleanUp=function(){du.prototype.cleanUp.call(this),this._pako=null};pi.prototype._createPako=function(){this._pako=new nZ[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};mu.compressWorker=function(e){return new pi("Deflate",e)};mu.uncompressWorker=function(){return new pi("Inflate",{})}});var bv=_(hv=>{"use strict";var L7=Dt();hv.STORE={magic:"\0\0",compressWorker:function(){return new L7("STORE compression")},uncompressWorker:function(){return new L7("STORE decompression")}};hv.DEFLATE=N7()});var gv=_(vi=>{"use strict";vi.LOCAL_FILE_HEADER="PK";vi.CENTRAL_FILE_HEADER="PK";vi.CENTRAL_DIRECTORY_END="PK";vi.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";vi.ZIP64_CENTRAL_DIRECTORY_END="PK";vi.DATA_DESCRIPTOR="PK\x07\b"});var R7=_((DE,V7)=>{"use strict";var ka=Ce(),Oa=Dt(),yv=da(),Z7=Gc(),pu=gv(),Me=function(e,t){var n="",i;for(i=0;i<t;i++)n+=String.fromCharCode(e&255),e=e>>>8;return n},iZ=function(e,t){var n=e;return e||(n=t?16893:33204),(n&65535)<<16},aZ=function(e){return(e||0)&63},W7=function(e,t,n,i,r,a){var o=e.file,s=e.compression,c=a!==yv.utf8encode,l=ka.transformTo("string",a(o.name)),u=ka.transformTo("string",yv.utf8encode(o.name)),f=o.comment,m=ka.transformTo("string",a(f)),d=ka.transformTo("string",yv.utf8encode(f)),p=u.length!==o.name.length,v=d.length!==f.length,h,b,g="",y="",x="",z=o.dir,S=o.date,P={crc32:0,compressedSize:0,uncompressedSize:0};(!t||n)&&(P.crc32=e.crc32,P.compressedSize=e.compressedSize,P.uncompressedSize=e.uncompressedSize);var T=0;t&&(T|=8),!c&&(p||v)&&(T|=2048);var j=0,X=0;z&&(j|=16),r==="UNIX"?(X=798,j|=iZ(o.unixPermissions,z)):(X=20,j|=aZ(o.dosPermissions,z)),h=S.getUTCHours(),h=h<<6,h=h|S.getUTCMinutes(),h=h<<5,h=h|S.getUTCSeconds()/2,b=S.getUTCFullYear()-1980,b=b<<4,b=b|S.getUTCMonth()+1,b=b<<5,b=b|S.getUTCDate(),p&&(y=Me(1,1)+Me(Z7(l),4)+u,g+="up"+Me(y.length,2)+y),v&&(x=Me(1,1)+Me(Z7(m),4)+d,g+="uc"+Me(x.length,2)+x);var w="";w+=`
|
|
3
|
+
import{a as Y3}from"./chunk-IN6XVTUS.js";import{e as D3,f as J3,g as U3,i as E3,k as Qr,o as C3}from"./chunk-P3EOFAZR.js";import{a as um}from"./chunk-PFZVET7S.js";import{a as mr}from"./chunk-764P7TUD.js";import{b as R3}from"./chunk-ISKNIQVO.js";import{a as H3,b as pc}from"./chunk-JKOB3U54.js";import{b as F3}from"./chunk-EEDLRRKU.js";import{b as M3}from"./chunk-WJ5EWXP2.js";import{b as I3}from"./chunk-YUO3UWPH.js";import{a as mc}from"./chunk-DKGGJM6Z.js";import{b as Eo,c as dc,d as Ai,e as W3,g as V3}from"./chunk-MJBJI6DV.js";import{a as cm}from"./chunk-XDI6CPPV.js";import{i as S3}from"./chunk-BTS3DFPD.js";import{b as X3,c as j3}from"./chunk-6WLSIH2N.js";import{S as T3}from"./chunk-C2ESM27Z.js";import{b as G3,i as K3,p as B3}from"./chunk-N34DQ6MH.js";import{a as q3,b as qe,c as fm,d as Oe,f as Co}from"./chunk-NU3X7P4N.js";import{Ia as Ar,ba as Z3,j as lm,t as N3,u as L3}from"./chunk-DPA26AOI.js";import{p as Bi,t as Kr,u as sm,v as O3,w as Br}from"./chunk-L3HRAIDR.js";import{a as Pn,d as Gr,e as k3}from"./chunk-OD445COC.js";import{c as Yr,d as P3}from"./chunk-EP4L2BWV.js";import{a as He,b as z3}from"./chunk-PHAMF4JF.js";import{$ as it,A as We,C as fc,E as im,G as g3,J as am,K as Ki,L as mt,M as om,N as y3,O as x3,Z as G,_ as Ge,aa as A,b as dr,ba as w3,c as f3,d as d3,h as m3,l as rm,m as Te,n as p3,o as v3,p as h3,r as uc,s as Ci,t as gt,u as b3,v as Yi,w as dt,x as Qe,y as Gi,z as Ze}from"./chunk-XI6XF7FQ.js";import{a as Mn,c as _,d as In,f as NS}from"./chunk-PSANHDZM.js";var ts=_((qU,Im)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Im.exports={nextTick:sX}:Im.exports=process;function sX(e,t,n,i){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var r=arguments.length,a,o;switch(r){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,n)});case 4:return process.nextTick(function(){e.call(null,t,n,i)});default:for(a=new Array(r-1),o=0;o<a.length;)a[o++]=arguments[o];return process.nextTick(function(){e.apply(null,a)})}}});var f0=_((DU,u0)=>{var lX={}.toString;u0.exports=Array.isArray||function(e){return lX.call(e)=="[object Array]"}});var qm=_((JU,d0)=>{d0.exports=Mn("stream")});var ns=_((Dm,p0)=>{var jc=Mn("buffer"),Cn=jc.Buffer;function m0(e,t){for(var n in e)t[n]=e[n]}Cn.from&&Cn.alloc&&Cn.allocUnsafe&&Cn.allocUnsafeSlow?p0.exports=jc:(m0(jc,Dm),Dm.Buffer=ta);function ta(e,t,n){return Cn(e,t,n)}m0(Cn,ta);ta.from=function(e,t,n){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Cn(e,t,n)};ta.alloc=function(e,t,n){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=Cn(e);return t!==void 0?typeof n=="string"?i.fill(t,n):i.fill(t):i.fill(0),i};ta.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Cn(e)};ta.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return jc.SlowBuffer(e)}});var na=_(pt=>{function cX(e){return Array.isArray?Array.isArray(e):Nc(e)==="[object Array]"}pt.isArray=cX;function uX(e){return typeof e=="boolean"}pt.isBoolean=uX;function fX(e){return e===null}pt.isNull=fX;function dX(e){return e==null}pt.isNullOrUndefined=dX;function mX(e){return typeof e=="number"}pt.isNumber=mX;function pX(e){return typeof e=="string"}pt.isString=pX;function vX(e){return typeof e=="symbol"}pt.isSymbol=vX;function hX(e){return e===void 0}pt.isUndefined=hX;function bX(e){return Nc(e)==="[object RegExp]"}pt.isRegExp=bX;function gX(e){return typeof e=="object"&&e!==null}pt.isObject=gX;function yX(e){return Nc(e)==="[object Date]"}pt.isDate=yX;function xX(e){return Nc(e)==="[object Error]"||e instanceof Error}pt.isError=xX;function wX(e){return typeof e=="function"}pt.isFunction=wX;function zX(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}pt.isPrimitive=zX;pt.isBuffer=Mn("buffer").Buffer.isBuffer;function Nc(e){return Object.prototype.toString.call(e)}});var v0=_((EU,Jm)=>{typeof Object.create=="function"?Jm.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Jm.exports=function(t,n){if(n){t.super_=n;var i=function(){};i.prototype=n.prototype,t.prototype=new i,t.prototype.constructor=t}}});var ra=_((CU,Em)=>{try{if(Um=Mn("util"),typeof Um.inherits!="function")throw"";Em.exports=Um.inherits}catch{Em.exports=v0()}var Um});var b0=_((YU,Cm)=>{"use strict";function PX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var h0=ns().Buffer,rs=Mn("util");function kX(e,t,n){e.copy(t,n)}Cm.exports=(function(){function e(){PX(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(n){var i={data:n,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length},e.prototype.unshift=function(n){var i={data:n,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length},e.prototype.shift=function(){if(this.length!==0){var n=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,n}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(n){if(this.length===0)return"";for(var i=this.head,r=""+i.data;i=i.next;)r+=n+i.data;return r},e.prototype.concat=function(n){if(this.length===0)return h0.alloc(0);for(var i=h0.allocUnsafe(n>>>0),r=this.head,a=0;r;)kX(r.data,i,a),a+=r.data.length,r=r.next;return i},e})();rs&&rs.inspect&&rs.inspect.custom&&(Cm.exports.prototype[rs.inspect.custom]=function(){var e=rs.inspect({length:this.length});return this.constructor.name+" "+e})});var Ym=_((GU,g0)=>{"use strict";var Lc=ts();function OX(e,t){var n=this,i=this._readableState&&this._readableState.destroyed,r=this._writableState&&this._writableState.destroyed;return i||r?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Lc.nextTick(Zc,this,e)):Lc.nextTick(Zc,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(a){!t&&a?n._writableState?n._writableState.errorEmitted||(n._writableState.errorEmitted=!0,Lc.nextTick(Zc,n,a)):Lc.nextTick(Zc,n,a):t&&t(a)}),this)}function SX(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Zc(e,t){e.emit("error",t)}g0.exports={destroy:OX,undestroy:SX}});var x0=_((KU,y0)=>{y0.exports=Mn("util").deprecate});var Km=_((BU,X0)=>{"use strict";var ni=ts();X0.exports=Be;function z0(e){var t=this;this.next=null,this.entry=null,this.finish=function(){EX(t,e)}}var TX=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:ni.nextTick,ia;Be.WritableState=as;var P0=Object.create(na());P0.inherits=ra();var XX={deprecate:x0()},k0=qm(),Vc=ns().Buffer,jX=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function NX(e){return Vc.from(e)}function LX(e){return Vc.isBuffer(e)||e instanceof jX}var O0=Ym();P0.inherits(Be,k0);function ZX(){}function as(e,t){ia=ia||ri(),e=e||{};var n=t instanceof ia;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,r=e.writableHighWaterMark,a=this.objectMode?16:16*1024;i||i===0?this.highWaterMark=i:n&&(r||r===0)?this.highWaterMark=r:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=e.decodeStrings===!1;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(s){IX(t,s)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new z0(this)}as.prototype.getBuffer=function(){for(var t=this.bufferedRequest,n=[];t;)n.push(t),t=t.next;return n};(function(){try{Object.defineProperty(as.prototype,"buffer",{get:XX.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Wc;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Wc=Function.prototype[Symbol.hasInstance],Object.defineProperty(Be,Symbol.hasInstance,{value:function(e){return Wc.call(this,e)?!0:this!==Be?!1:e&&e._writableState instanceof as}})):Wc=function(e){return e instanceof this};function Be(e){if(ia=ia||ri(),!Wc.call(Be,this)&&!(this instanceof ia))return new Be(e);this._writableState=new as(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),k0.call(this)}Be.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function WX(e,t){var n=new Error("write after end");e.emit("error",n),ni.nextTick(t,n)}function VX(e,t,n,i){var r=!0,a=!1;return n===null?a=new TypeError("May not write null values to stream"):typeof n!="string"&&n!==void 0&&!t.objectMode&&(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),ni.nextTick(i,a),r=!1),r}Be.prototype.write=function(e,t,n){var i=this._writableState,r=!1,a=!i.objectMode&&LX(e);return a&&!Vc.isBuffer(e)&&(e=NX(e)),typeof t=="function"&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),typeof n!="function"&&(n=ZX),i.ended?WX(this,n):(a||VX(this,i,e,n))&&(i.pendingcb++,r=HX(this,i,a,e,t,n)),r};Be.prototype.cork=function(){var e=this._writableState;e.corked++};Be.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&S0(this,e))};Be.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function RX(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=Vc.from(t,n)),t}Object.defineProperty(Be.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function HX(e,t,n,i,r,a){if(!n){var o=RX(t,i,r);i!==o&&(n=!0,r="buffer",i=o)}var s=t.objectMode?1:i.length;t.length+=s;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:r,isBuf:n,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Gm(e,t,!1,s,i,r,a);return c}function Gm(e,t,n,i,r,a,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(r,t.onwrite):e._write(r,a,t.onwrite),t.sync=!1}function FX(e,t,n,i,r){--t.pendingcb,n?(ni.nextTick(r,i),ni.nextTick(is,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(r(i),e._writableState.errorEmitted=!0,e.emit("error",i),is(e,t))}function MX(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function IX(e,t){var n=e._writableState,i=n.sync,r=n.writecb;if(MX(n),t)FX(e,n,i,t,r);else{var a=T0(n);!a&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&S0(e,n),i?TX(w0,e,n,a,r):w0(e,n,a,r)}}function w0(e,t,n,i){n||qX(e,t),t.pendingcb--,i(),is(e,t)}function qX(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function S0(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var i=t.bufferedRequestCount,r=new Array(i),a=t.corkedRequestsFree;a.entry=n;for(var o=0,s=!0;n;)r[o]=n,n.isBuf||(s=!1),n=n.next,o+=1;r.allBuffers=s,Gm(e,t,!0,t.length,r,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new z0(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,u=n.callback,f=t.objectMode?1:c.length;if(Gm(e,t,!1,f,c,l,u),n=n.next,t.bufferedRequestCount--,t.writing)break}n===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}Be.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))};Be.prototype._writev=null;Be.prototype.end=function(e,t,n){var i=this._writableState;typeof e=="function"?(n=e,e=null,t=null):typeof t=="function"&&(n=t,t=null),e!=null&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||UX(this,i,n)};function T0(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function DX(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),is(e,t)})}function JX(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,ni.nextTick(DX,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function is(e,t){var n=T0(t);return n&&(JX(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),n}function UX(e,t,n){t.ending=!0,is(e,t),n&&(t.finished?ni.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}function EX(e,t,n){var i=e.entry;for(e.entry=null;i;){var r=i.callback;t.pendingcb--,r(n),i=i.next}t.corkedRequestsFree.next=e}Object.defineProperty(Be.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});Be.prototype.destroy=O0.destroy;Be.prototype._undestroy=O0.undestroy;Be.prototype._destroy=function(e,t){this.end(),t(e)}});var ri=_((AU,Z0)=>{"use strict";var j0=ts(),CX=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};Z0.exports=Yn;var N0=Object.create(na());N0.inherits=ra();var L0=Qm(),Am=Km();N0.inherits(Yn,L0);for(Bm=CX(Am.prototype),Rc=0;Rc<Bm.length;Rc++)Hc=Bm[Rc],Yn.prototype[Hc]||(Yn.prototype[Hc]=Am.prototype[Hc]);var Bm,Hc,Rc;function Yn(e){if(!(this instanceof Yn))return new Yn(e);L0.call(this,e),Am.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",YX)}Object.defineProperty(Yn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function YX(){this.allowHalfOpen||this._writableState.ended||j0.nextTick(GX,this)}function GX(e){e.end()}Object.defineProperty(Yn.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}});Yn.prototype._destroy=function(e,t){this.push(null),this.end(),j0.nextTick(t,e)}});var ep=_(V0=>{"use strict";var $m=ns().Buffer,W0=$m.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function KX(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function BX(e){var t=KX(e);if(typeof t!="string"&&($m.isEncoding===W0||!W0(e)))throw new Error("Unknown encoding: "+e);return t||e}V0.StringDecoder=os;function os(e){this.encoding=BX(e);var t;switch(this.encoding){case"utf16le":this.text=tj,this.end=nj,t=4;break;case"utf8":this.fillLast=_X,t=4;break;case"base64":this.text=rj,this.end=ij,t=3;break;default:this.write=aj,this.end=oj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=$m.allocUnsafe(t)}os.prototype.write=function(e){if(e.length===0)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""};os.prototype.end=ej;os.prototype.text=$X;os.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function _m(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function AX(e,t,n){var i=t.length-1;if(i<n)return 0;var r=_m(t[i]);return r>=0?(r>0&&(e.lastNeed=r-1),r):--i<n||r===-2?0:(r=_m(t[i]),r>=0?(r>0&&(e.lastNeed=r-2),r):--i<n||r===-2?0:(r=_m(t[i]),r>=0?(r>0&&(r===2?r=0:e.lastNeed=r-3),r):0))}function QX(e,t,n){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function _X(e){var t=this.lastTotal-this.lastNeed,n=QX(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function $X(e,t){var n=AX(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)}function ej(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function tj(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function nj(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function rj(e,t){var n=(e.length-t)%3;return n===0?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function ij(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function aj(e){return e.toString(this.encoding)}function oj(e){return e&&e.length?this.write(e):""}});var Qm=_(($U,Y0)=>{"use strict";var oa=ts();Y0.exports=Ie;var sj=f0(),ss;Ie.ReadableState=D0;var _U=Mn("events").EventEmitter,M0=function(e,t){return e.listeners(t).length},ap=qm(),ls=ns().Buffer,lj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function cj(e){return ls.from(e)}function uj(e){return ls.isBuffer(e)||e instanceof lj}var I0=Object.create(na());I0.inherits=ra();var tp=Mn("util"),Se=void 0;tp&&tp.debuglog?Se=tp.debuglog("stream"):Se=function(){};var fj=b0(),q0=Ym(),aa;I0.inherits(Ie,ap);var np=["error","close","destroy","pause","resume"];function dj(e,t,n){if(typeof e.prependListener=="function")return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):sj(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}function D0(e,t){ss=ss||ri(),e=e||{};var n=t instanceof ss;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,r=e.readableHighWaterMark,a=this.objectMode?16:16*1024;i||i===0?this.highWaterMark=i:n&&(r||r===0)?this.highWaterMark=r:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new fj,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(aa||(aa=ep().StringDecoder),this.decoder=new aa(e.encoding),this.encoding=e.encoding)}function Ie(e){if(ss=ss||ri(),!(this instanceof Ie))return new Ie(e);this._readableState=new D0(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),ap.call(this)}Object.defineProperty(Ie.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Ie.prototype.destroy=q0.destroy;Ie.prototype._undestroy=q0.undestroy;Ie.prototype._destroy=function(e,t){this.push(null),t(e)};Ie.prototype.push=function(e,t){var n=this._readableState,i;return n.objectMode?i=!0:typeof e=="string"&&(t=t||n.defaultEncoding,t!==n.encoding&&(e=ls.from(e,t),t=""),i=!0),J0(this,e,t,!1,i)};Ie.prototype.unshift=function(e){return J0(this,e,null,!0,!1)};function J0(e,t,n,i,r){var a=e._readableState;if(t===null)a.reading=!1,hj(e,a);else{var o;r||(o=mj(a,t)),o?e.emit("error",o):a.objectMode||t&&t.length>0?(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==ls.prototype&&(t=cj(t)),i?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):rp(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||t.length!==0?rp(e,a,t,!1):U0(e,a)):rp(e,a,t,!1))):i||(a.reading=!1)}return pj(a)}function rp(e,t,n,i){t.flowing&&t.length===0&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&Fc(e)),U0(e,t)}function mj(e,t){var n;return!uj(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(n=new TypeError("Invalid non-string/buffer chunk")),n}function pj(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}Ie.prototype.isPaused=function(){return this._readableState.flowing===!1};Ie.prototype.setEncoding=function(e){return aa||(aa=ep().StringDecoder),this._readableState.decoder=new aa(e),this._readableState.encoding=e,this};var R0=8388608;function vj(e){return e>=R0?e=R0:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function H0(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=vj(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}Ie.prototype.read=function(e){Se("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return Se("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?ip(this):Fc(this),null;if(e=H0(e,t),e===0&&t.ended)return t.length===0&&ip(this),null;var i=t.needReadable;Se("need readable",i),(t.length===0||t.length-e<t.highWaterMark)&&(i=!0,Se("length less than watermark",i)),t.ended||t.reading?(i=!1,Se("reading or ended",i)):i&&(Se("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=H0(n,t)));var r;return e>0?r=E0(e,t):r=null,r===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&ip(this)),r!==null&&this.emit("data",r),r};function hj(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,Fc(e)}}function Fc(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Se("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?oa.nextTick(F0,e):F0(e))}function F0(e){Se("emit readable"),e.emit("readable"),op(e)}function U0(e,t){t.readingMore||(t.readingMore=!0,oa.nextTick(bj,e,t))}function bj(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(Se("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}Ie.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};Ie.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e);break}i.pipesCount+=1,Se("pipe count=%d opts=%j",i.pipesCount,t);var r=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,a=r?s:h;i.endEmitted?oa.nextTick(a):n.once("end",a),e.on("unpipe",o);function o(b,g){Se("onunpipe"),b===n&&g&&g.hasUnpiped===!1&&(g.hasUnpiped=!0,u())}function s(){Se("onend"),e.end()}var c=gj(n);e.on("drain",c);var l=!1;function u(){Se("cleanup"),e.removeListener("close",p),e.removeListener("finish",v),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",o),n.removeListener("end",s),n.removeListener("end",h),n.removeListener("data",m),l=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c()}var f=!1;n.on("data",m);function m(b){Se("ondata"),f=!1;var g=e.write(b);g===!1&&!f&&((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&C0(i.pipes,e)!==-1)&&!l&&(Se("false write response, pause",i.awaitDrain),i.awaitDrain++,f=!0),n.pause())}function d(b){Se("onerror",b),h(),e.removeListener("error",d),M0(e,"error")===0&&e.emit("error",b)}dj(e,"error",d);function p(){e.removeListener("finish",v),h()}e.once("close",p);function v(){Se("onfinish"),e.removeListener("close",p),h()}e.once("finish",v);function h(){Se("unpipe"),n.unpipe(e)}return e.emit("pipe",n),i.flowing||(Se("pipe resume"),n.resume()),e};function gj(e){return function(){var t=e._readableState;Se("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&M0(e,"data")&&(t.flowing=!0,op(e))}}Ie.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var i=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<r;a++)i[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=C0(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n),this)};Ie.prototype.on=function(e,t){var n=ap.prototype.on.call(this,e,t);if(e==="data")this._readableState.flowing!==!1&&this.resume();else if(e==="readable"){var i=this._readableState;!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&Fc(this):oa.nextTick(yj,this))}return n};Ie.prototype.addListener=Ie.prototype.on;function yj(e){Se("readable nexttick read 0"),e.read(0)}Ie.prototype.resume=function(){var e=this._readableState;return e.flowing||(Se("resume"),e.flowing=!0,xj(this,e)),this};function xj(e,t){t.resumeScheduled||(t.resumeScheduled=!0,oa.nextTick(wj,e,t))}function wj(e,t){t.reading||(Se("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),op(e),t.flowing&&!t.reading&&e.read(0)}Ie.prototype.pause=function(){return Se("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Se("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function op(e){var t=e._readableState;for(Se("flow",t.flowing);t.flowing&&e.read()!==null;);}Ie.prototype.wrap=function(e){var t=this,n=this._readableState,i=!1;e.on("end",function(){if(Se("wrapped end"),n.decoder&&!n.ended){var o=n.decoder.end();o&&o.length&&t.push(o)}t.push(null)}),e.on("data",function(o){if(Se("wrapped data"),n.decoder&&(o=n.decoder.write(o)),!(n.objectMode&&o==null)&&!(!n.objectMode&&(!o||!o.length))){var s=t.push(o);s||(i=!0,e.pause())}});for(var r in e)this[r]===void 0&&typeof e[r]=="function"&&(this[r]=(function(o){return function(){return e[o].apply(e,arguments)}})(r));for(var a=0;a<np.length;a++)e.on(np[a],this.emit.bind(this,np[a]));return this._read=function(o){Se("wrapped _read",o),i&&(i=!1,e.resume())},this};Object.defineProperty(Ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Ie._fromList=E0;function E0(e,t){if(t.length===0)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(t.decoder?n=t.buffer.join(""):t.buffer.length===1?n=t.buffer.head.data:n=t.buffer.concat(t.length),t.buffer.clear()):n=zj(e,t.buffer,t.decoder),n}function zj(e,t,n){var i;return e<t.head.data.length?(i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?i=t.shift():i=n?Pj(e,t):kj(e,t),i}function Pj(e,t){var n=t.head,i=1,r=n.data;for(e-=r.length;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(o===a.length?r+=a:r+=a.slice(0,e),e-=o,e===0){o===a.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++i}return t.length-=i,r}function kj(e,t){var n=ls.allocUnsafe(e),i=t.head,r=1;for(i.data.copy(n),e-=i.data.length;i=i.next;){var a=i.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),e-=o,e===0){o===a.length?(++r,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=a.slice(o));break}++r}return t.length-=r,n}function ip(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,oa.nextTick(Oj,t,e))}function Oj(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C0(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}});var sp=_((eE,B0)=>{"use strict";B0.exports=Gn;var Mc=ri(),K0=Object.create(na());K0.inherits=ra();K0.inherits(Gn,Mc);function Sj(e,t){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,t!=null&&this.push(t),i(e);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function Gn(e){if(!(this instanceof Gn))return new Gn(e);Mc.call(this,e),this._transformState={afterTransform:Sj.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",Tj)}function Tj(){var e=this;typeof this._flush=="function"?this._flush(function(t,n){G0(e,t,n)}):G0(this,null,null)}Gn.prototype.push=function(e,t){return this._transformState.needTransform=!1,Mc.prototype.push.call(this,e,t)};Gn.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")};Gn.prototype._write=function(e,t,n){var i=this._transformState;if(i.writecb=n,i.writechunk=e,i.writeencoding=t,!i.transforming){var r=this._readableState;(i.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}};Gn.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Gn.prototype._destroy=function(e,t){var n=this;Mc.prototype._destroy.call(this,e,function(i){t(i),n.emit("close")})};function G0(e,t,n){if(t)return e.emit("error",t);if(n!=null&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}});var $0=_((tE,_0)=>{"use strict";_0.exports=cs;var A0=sp(),Q0=Object.create(na());Q0.inherits=ra();Q0.inherits(cs,A0);function cs(e){if(!(this instanceof cs))return new cs(e);A0.call(this,e)}cs.prototype._transform=function(e,t,n){n(null,e)}});var lp=_((ot,Ic)=>{var On=Mn("stream");process.env.READABLE_STREAM==="disable"&&On?(Ic.exports=On,ot=Ic.exports=On.Readable,ot.Readable=On.Readable,ot.Writable=On.Writable,ot.Duplex=On.Duplex,ot.Transform=On.Transform,ot.PassThrough=On.PassThrough,ot.Stream=On):(ot=Ic.exports=Qm(),ot.Stream=On||ot,ot.Readable=ot,ot.Writable=Km(),ot.Duplex=ri(),ot.Transform=sp(),ot.PassThrough=$0())});var Kn=_(qt=>{"use strict";qt.base64=!0;qt.array=!0;qt.string=!0;qt.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";qt.nodebuffer=typeof Buffer<"u";qt.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")qt.blob=!1;else{cp=new ArrayBuffer(0);try{qt.blob=new Blob([cp],{type:"application/zip"}).size===0}catch{try{e1=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,up=new e1,up.append(cp),qt.blob=up.getBlob("application/zip").size===0}catch{qt.blob=!1}}}var cp,e1,up;try{qt.nodestream=!!lp().Readable}catch{qt.nodestream=!1}});var dp=_(fp=>{"use strict";var Xj=Ce(),jj=Kn(),Sn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";fp.encode=function(e){for(var t=[],n,i,r,a,o,s,c,l=0,u=e.length,f=u,m=Xj.getTypeOf(e)!=="string";l<e.length;)f=u-l,m?(n=e[l++],i=l<u?e[l++]:0,r=l<u?e[l++]:0):(n=e.charCodeAt(l++),i=l<u?e.charCodeAt(l++):0,r=l<u?e.charCodeAt(l++):0),a=n>>2,o=(n&3)<<4|i>>4,s=f>1?(i&15)<<2|r>>6:64,c=f>2?r&63:64,t.push(Sn.charAt(a)+Sn.charAt(o)+Sn.charAt(s)+Sn.charAt(c));return t.join("")};fp.decode=function(e){var t,n,i,r,a,o,s,c=0,l=0,u="data:";if(e.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");e=e.replace(/[^A-Za-z0-9+/=]/g,"");var f=e.length*3/4;if(e.charAt(e.length-1)===Sn.charAt(64)&&f--,e.charAt(e.length-2)===Sn.charAt(64)&&f--,f%1!==0)throw new Error("Invalid base64 input, bad content length.");var m;for(jj.uint8array?m=new Uint8Array(f|0):m=new Array(f|0);c<e.length;)r=Sn.indexOf(e.charAt(c++)),a=Sn.indexOf(e.charAt(c++)),o=Sn.indexOf(e.charAt(c++)),s=Sn.indexOf(e.charAt(c++)),t=r<<2|a>>4,n=(a&15)<<4|o>>2,i=(o&3)<<6|s,m[l++]=t,o!==64&&(m[l++]=n),s!==64&&(m[l++]=i);return m}});var us=_((iE,t1)=>{"use strict";t1.exports={isNode:typeof Buffer<"u",newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if(typeof e=="number")throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on=="function"&&typeof e.pause=="function"&&typeof e.resume=="function"}}});var a1=_((aE,i1)=>{"use strict";var n1=global.MutationObserver||global.WebKitMutationObserver,sa;process.browser?n1?(mp=0,r1=new n1(fs),pp=global.document.createTextNode(""),r1.observe(pp,{characterData:!0}),sa=function(){pp.data=mp=++mp%2}):!global.setImmediate&&typeof global.MessageChannel<"u"?(vp=new global.MessageChannel,vp.port1.onmessage=fs,sa=function(){vp.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?sa=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){fs(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:sa=function(){setTimeout(fs,0)}:sa=function(){process.nextTick(fs)};var mp,r1,pp,vp,hp,ds=[];function fs(){hp=!0;for(var e,t,n=ds.length;n;){for(t=ds,ds=[],e=-1;++e<n;)t[e]();n=ds.length}hp=!1}i1.exports=Nj;function Nj(e){ds.push(e)===1&&!hp&&sa()}});var d1=_((oE,f1)=>{"use strict";var o1=a1();function la(){}var vt={},s1=["REJECTED"],bp=["FULFILLED"],l1=["PENDING"];process.browser||(ms=["UNHANDLED"]);var ms;f1.exports=vr;function vr(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=l1,this.queue=[],this.outcome=void 0,process.browser||(this.handled=ms),e!==la&&c1(this,e)}vr.prototype.finally=function(e){if(typeof e!="function")return this;var t=this.constructor;return this.then(n,i);function n(r){function a(){return r}return t.resolve(e()).then(a)}function i(r){function a(){throw r}return t.resolve(e()).then(a)}};vr.prototype.catch=function(e){return this.then(null,e)};vr.prototype.then=function(e,t){if(typeof e!="function"&&this.state===bp||typeof t!="function"&&this.state===s1)return this;var n=new this.constructor(la);if(process.browser||this.handled===ms&&(this.handled=null),this.state!==l1){var i=this.state===bp?e:t;gp(n,i,this.outcome)}else this.queue.push(new ps(n,e,t));return n};function ps(e,t,n){this.promise=e,typeof t=="function"&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),typeof n=="function"&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}ps.prototype.callFulfilled=function(e){vt.resolve(this.promise,e)};ps.prototype.otherCallFulfilled=function(e){gp(this.promise,this.onFulfilled,e)};ps.prototype.callRejected=function(e){vt.reject(this.promise,e)};ps.prototype.otherCallRejected=function(e){gp(this.promise,this.onRejected,e)};function gp(e,t,n){o1(function(){var i;try{i=t(n)}catch(r){return vt.reject(e,r)}i===e?vt.reject(e,new TypeError("Cannot resolve promise with itself")):vt.resolve(e,i)})}vt.resolve=function(e,t){var n=u1(Lj,t);if(n.status==="error")return vt.reject(e,n.value);var i=n.value;if(i)c1(e,i);else{e.state=bp,e.outcome=t;for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callFulfilled(t)}return e};vt.reject=function(e,t){e.state=s1,e.outcome=t,process.browser||e.handled===ms&&o1(function(){e.handled===ms&&process.emit("unhandledRejection",t,e)});for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e};function Lj(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function c1(e,t){var n=!1;function i(s){n||(n=!0,vt.reject(e,s))}function r(s){n||(n=!0,vt.resolve(e,s))}function a(){t(r,i)}var o=u1(a);o.status==="error"&&i(o.value)}function u1(e,t){var n={};try{n.value=e(t),n.status="success"}catch(i){n.status="error",n.value=i}return n}vr.resolve=Zj;function Zj(e){return e instanceof this?e:vt.resolve(new this(la),e)}vr.reject=Wj;function Wj(e){var t=new this(la);return vt.reject(t,e)}vr.all=Vj;function Vj(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var r=new Array(n),a=0,o=-1,s=new this(la);++o<n;)c(e[o],o);return s;function c(l,u){t.resolve(l).then(f,function(m){i||(i=!0,vt.reject(s,m))});function f(m){r[u]=m,++a===n&&!i&&(i=!0,vt.resolve(s,r))}}}vr.race=Rj;function Rj(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var r=-1,a=new this(la);++r<n;)o(e[r]);return a;function o(s){t.resolve(s).then(function(c){i||(i=!0,vt.resolve(a,c))},function(c){i||(i=!0,vt.reject(a,c))})}}});var ca=_((sE,m1)=>{"use strict";var yp=null;typeof Promise<"u"?yp=Promise:yp=d1();m1.exports={Promise:yp}});var v1=_(p1=>{(function(e,t){"use strict";if(e.setImmediate)return;var n=1,i={},r=!1,a=e.document,o;function s(g){typeof g!="function"&&(g=new Function(""+g));for(var y=new Array(arguments.length-1),x=0;x<y.length;x++)y[x]=arguments[x+1];var z={callback:g,args:y};return i[n]=z,o(n),n++}function c(g){delete i[g]}function l(g){var y=g.callback,x=g.args;switch(x.length){case 0:y();break;case 1:y(x[0]);break;case 2:y(x[0],x[1]);break;case 3:y(x[0],x[1],x[2]);break;default:y.apply(t,x);break}}function u(g){if(r)setTimeout(u,0,g);else{var y=i[g];if(y){r=!0;try{l(y)}finally{c(g),r=!1}}}}function f(){o=function(g){process.nextTick(function(){u(g)})}}function m(){if(e.postMessage&&!e.importScripts){var g=!0,y=e.onmessage;return e.onmessage=function(){g=!1},e.postMessage("","*"),e.onmessage=y,g}}function d(){var g="setImmediate$"+Math.random()+"$",y=function(x){x.source===e&&typeof x.data=="string"&&x.data.indexOf(g)===0&&u(+x.data.slice(g.length))};e.addEventListener?e.addEventListener("message",y,!1):e.attachEvent("onmessage",y),o=function(x){e.postMessage(g+x,"*")}}function p(){var g=new MessageChannel;g.port1.onmessage=function(y){var x=y.data;u(x)},o=function(y){g.port2.postMessage(y)}}function v(){var g=a.documentElement;o=function(y){var x=a.createElement("script");x.onreadystatechange=function(){u(y),x.onreadystatechange=null,g.removeChild(x),x=null},g.appendChild(x)}}function h(){o=function(g){setTimeout(u,0,g)}}var b=Object.getPrototypeOf&&Object.getPrototypeOf(e);b=b&&b.setTimeout?b:e,{}.toString.call(e.process)==="[object process]"?f():m()?d():e.MessageChannel?p():a&&"onreadystatechange"in a.createElement("script")?v():h(),b.setImmediate=s,b.clearImmediate=c})(typeof self>"u"?typeof global>"u"?p1:global:self)});var Ce=_(Ae=>{"use strict";var hr=Kn(),Hj=dp(),ua=us(),xp=ca();v1();function Fj(e){var t=null;return hr.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),Dc(e,t)}Ae.newBlob=function(e,t){Ae.checkSupport("blob");try{return new Blob([e],{type:t})}catch{try{var n=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,i=new n;return i.append(e),i.getBlob(t)}catch{throw new Error("Bug : can't construct the Blob.")}}};function vs(e){return e}function Dc(e,t){for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)&255;return t}var qc={stringifyByChunk:function(e,t,n){var i=[],r=0,a=e.length;if(a<=n)return String.fromCharCode.apply(null,e);for(;r<a;)t==="array"||t==="nodebuffer"?i.push(String.fromCharCode.apply(null,e.slice(r,Math.min(r+n,a)))):i.push(String.fromCharCode.apply(null,e.subarray(r,Math.min(r+n,a)))),r+=n;return i.join("")},stringifyByChar:function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},applyCanBeUsed:{uint8array:(function(){try{return hr.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return hr.nodebuffer&&String.fromCharCode.apply(null,ua.allocBuffer(1)).length===1}catch{return!1}})()}};function hs(e){var t=65536,n=Ae.getTypeOf(e),i=!0;if(n==="uint8array"?i=qc.applyCanBeUsed.uint8array:n==="nodebuffer"&&(i=qc.applyCanBeUsed.nodebuffer),i)for(;t>1;)try{return qc.stringifyByChunk(e,n,t)}catch{t=Math.floor(t/2)}return qc.stringifyByChar(e)}Ae.applyFromCharCode=hs;function Jc(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}var br={};br.string={string:vs,array:function(e){return Dc(e,new Array(e.length))},arraybuffer:function(e){return br.string.uint8array(e).buffer},uint8array:function(e){return Dc(e,new Uint8Array(e.length))},nodebuffer:function(e){return Dc(e,ua.allocBuffer(e.length))}};br.array={string:hs,array:vs,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return ua.newBufferFrom(e)}};br.arraybuffer={string:function(e){return hs(new Uint8Array(e))},array:function(e){return Jc(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:vs,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return ua.newBufferFrom(new Uint8Array(e))}};br.uint8array={string:hs,array:function(e){return Jc(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:vs,nodebuffer:function(e){return ua.newBufferFrom(e)}};br.nodebuffer={string:hs,array:function(e){return Jc(e,new Array(e.length))},arraybuffer:function(e){return br.nodebuffer.uint8array(e).buffer},uint8array:function(e){return Jc(e,new Uint8Array(e.length))},nodebuffer:vs};Ae.transformTo=function(e,t){if(t||(t=""),!e)return t;Ae.checkSupport(e);var n=Ae.getTypeOf(t),i=br[n][e](t);return i};Ae.resolve=function(e){for(var t=e.split("/"),n=[],i=0;i<t.length;i++){var r=t[i];r==="."||r===""&&i!==0&&i!==t.length-1||(r===".."?n.pop():n.push(r))}return n.join("/")};Ae.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(hr.nodebuffer&&ua.isBuffer(e))return"nodebuffer";if(hr.uint8array&&e instanceof Uint8Array)return"uint8array";if(hr.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};Ae.checkSupport=function(e){var t=hr[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};Ae.MAX_VALUE_16BITS=65535;Ae.MAX_VALUE_32BITS=-1;Ae.pretty=function(e){var t="",n,i;for(i=0;i<(e||"").length;i++)n=e.charCodeAt(i),t+="\\x"+(n<16?"0":"")+n.toString(16).toUpperCase();return t};Ae.delay=function(e,t,n){setImmediate(function(){e.apply(n||null,t||[])})};Ae.inherits=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n};Ae.extend=function(){var e={},t,n;for(t=0;t<arguments.length;t++)for(n in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],n)&&typeof e[n]>"u"&&(e[n]=arguments[t][n]);return e};Ae.prepareContent=function(e,t,n,i,r){var a=xp.Promise.resolve(t).then(function(o){var s=hr.blob&&(o instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(o))!==-1);return s&&typeof FileReader<"u"?new xp.Promise(function(c,l){var u=new FileReader;u.onload=function(f){c(f.target.result)},u.onerror=function(f){l(f.target.error)},u.readAsArrayBuffer(o)}):o});return a.then(function(o){var s=Ae.getTypeOf(o);return s?(s==="arraybuffer"?o=Ae.transformTo("uint8array",o):s==="string"&&(r?o=Hj.decode(o):n&&i!==!0&&(o=Fj(o))),o):xp.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var Dt=_((uE,b1)=>{"use strict";function h1(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}h1.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return this.isFinished?!1:(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n<this._listeners[e].length;n++)this._listeners[e][n].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(n){t.processChunk(n)}),e.on("end",function(){t.end()}),e.on("error",function(n){t.error(n)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}};b1.exports=h1});var da=_(gr=>{"use strict";var fa=Ce(),ii=Kn(),Mj=us(),Uc=Dt(),bs=new Array(256);for(Bn=0;Bn<256;Bn++)bs[Bn]=Bn>=252?6:Bn>=248?5:Bn>=240?4:Bn>=224?3:Bn>=192?2:1;var Bn;bs[254]=bs[254]=1;var Ij=function(e){var t,n,i,r,a,o=e.length,s=0;for(r=0;r<o;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<o&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(ii.uint8array?t=new Uint8Array(s):t=new Array(s),a=0,r=0;a<s;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<o&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t},qj=function(e,t){var n;for(t=t||e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+bs[e[n]]>t?n:t},Dj=function(e){var t,n,i,r,a=e.length,o=new Array(a*2);for(n=0,t=0;t<a;){if(i=e[t++],i<128){o[n++]=i;continue}if(r=bs[i],r>4){o[n++]=65533,t+=r-1;continue}for(i&=r===2?31:r===3?15:7;r>1&&t<a;)i=i<<6|e[t++]&63,r--;if(r>1){o[n++]=65533;continue}i<65536?o[n++]=i:(i-=65536,o[n++]=55296|i>>10&1023,o[n++]=56320|i&1023)}return o.length!==n&&(o.subarray?o=o.subarray(0,n):o.length=n),fa.applyFromCharCode(o)};gr.utf8encode=function(t){return ii.nodebuffer?Mj.newBufferFrom(t,"utf-8"):Ij(t)};gr.utf8decode=function(t){return ii.nodebuffer?fa.transformTo("nodebuffer",t).toString("utf-8"):(t=fa.transformTo(ii.uint8array?"uint8array":"array",t),Dj(t))};function Ec(){Uc.call(this,"utf-8 decode"),this.leftOver=null}fa.inherits(Ec,Uc);Ec.prototype.processChunk=function(e){var t=fa.transformTo(ii.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(ii.uint8array){var n=t;t=new Uint8Array(n.length+this.leftOver.length),t.set(this.leftOver,0),t.set(n,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var i=qj(t),r=t;i!==t.length&&(ii.uint8array?(r=t.subarray(0,i),this.leftOver=t.subarray(i,t.length)):(r=t.slice(0,i),this.leftOver=t.slice(i,t.length))),this.push({data:gr.utf8decode(r),meta:e.meta})};Ec.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:gr.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};gr.Utf8DecodeWorker=Ec;function wp(){Uc.call(this,"utf-8 encode")}fa.inherits(wp,Uc);wp.prototype.processChunk=function(e){this.push({data:gr.utf8encode(e.data),meta:e.meta})};gr.Utf8EncodeWorker=wp});var w1=_((dE,x1)=>{"use strict";var g1=Dt(),y1=Ce();function zp(e){g1.call(this,"ConvertWorker to "+e),this.destType=e}y1.inherits(zp,g1);zp.prototype.processChunk=function(e){this.push({data:y1.transformTo(this.destType,e.data),meta:e.meta})};x1.exports=zp});var k1=_((mE,P1)=>{"use strict";var z1=lp().Readable,Jj=Ce();Jj.inherits(Pp,z1);function Pp(e,t,n){z1.call(this,t),this._helper=e;var i=this;e.on("data",function(r,a){i.push(r)||i._helper.pause(),n&&n(a)}).on("error",function(r){i.emit("error",r)}).on("end",function(){i.push(null)})}Pp.prototype._read=function(){this._helper.resume()};P1.exports=Pp});var kp=_((pE,T1)=>{"use strict";var ai=Ce(),Uj=w1(),Ej=Dt(),Cj=dp(),Yj=Kn(),Gj=ca(),O1=null;if(Yj.nodestream)try{O1=k1()}catch{}function Kj(e,t,n){switch(e){case"blob":return ai.newBlob(ai.transformTo("arraybuffer",t),n);case"base64":return Cj.encode(t);default:return ai.transformTo(e,t)}}function Bj(e,t){var n,i=0,r=null,a=0;for(n=0;n<t.length;n++)a+=t[n].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(r=new Uint8Array(a),n=0;n<t.length;n++)r.set(t[n],i),i+=t[n].length;return r;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}function Aj(e,t){return new Gj.Promise(function(n,i){var r=[],a=e._internalType,o=e._outputType,s=e._mimeType;e.on("data",function(c,l){r.push(c),t&&t(l)}).on("error",function(c){r=[],i(c)}).on("end",function(){try{var c=Kj(o,Bj(a,r),s);n(c)}catch(l){i(l)}r=[]}).resume()})}function S1(e,t,n){var i=t;switch(t){case"blob":case"arraybuffer":i="uint8array";break;case"base64":i="string";break}try{this._internalType=i,this._outputType=t,this._mimeType=n,ai.checkSupport(i),this._worker=e.pipe(new Uj(i)),e.lock()}catch(r){this._worker=new Ej("error"),this._worker.error(r)}}S1.prototype={accumulate:function(e){return Aj(this,e)},on:function(e,t){var n=this;return e==="data"?this._worker.on(e,function(i){t.call(n,i.data,i.meta)}):this._worker.on(e,function(){ai.delay(t,arguments,n)}),this},resume:function(){return ai.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(ai.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new O1(this,{objectMode:this._outputType!=="nodebuffer"},e)}};T1.exports=S1});var Op=_(on=>{"use strict";on.base64=!1;on.binary=!1;on.dir=!1;on.createFolders=!0;on.date=null;on.compression=null;on.compressionOptions=null;on.comment=null;on.unixPermissions=null;on.dosPermissions=null});var Sp=_((hE,X1)=>{"use strict";var Cc=Ce(),Yc=Dt(),Qj=16*1024;function ma(e){Yc.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(n){t.dataIsReady=!0,t.data=n,t.max=n&&n.length||0,t.type=Cc.getTypeOf(n),t.isPaused||t._tickAndRepeat()},function(n){t.error(n)})}Cc.inherits(ma,Yc);ma.prototype.cleanUp=function(){Yc.prototype.cleanUp.call(this),this.data=null};ma.prototype.resume=function(){return Yc.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,Cc.delay(this._tickAndRepeat,[],this)),!0):!1};ma.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(Cc.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};ma.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=Qj,t=null,n=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,n);break;case"uint8array":t=this.data.subarray(this.index,n);break;case"array":case"nodebuffer":t=this.data.slice(this.index,n);break}return this.index=n,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})};X1.exports=ma});var Gc=_((bE,N1)=>{"use strict";var _j=Ce();function $j(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var j1=$j();function eN(e,t,n,i){var r=j1,a=i+n;e=e^-1;for(var o=i;o<a;o++)e=e>>>8^r[(e^t[o])&255];return e^-1}function tN(e,t,n,i){var r=j1,a=i+n;e=e^-1;for(var o=i;o<a;o++)e=e>>>8^r[(e^t.charCodeAt(o))&255];return e^-1}N1.exports=function(t,n){if(typeof t>"u"||!t.length)return 0;var i=_j.getTypeOf(t)!=="string";return i?eN(n|0,t,t.length,0):tN(n|0,t,t.length,0)}});var Xp=_((gE,Z1)=>{"use strict";var L1=Dt(),nN=Gc(),rN=Ce();function Tp(){L1.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}rN.inherits(Tp,L1);Tp.prototype.processChunk=function(e){this.streamInfo.crc32=nN(e.data,this.streamInfo.crc32||0),this.push(e)};Z1.exports=Tp});var V1=_((yE,W1)=>{"use strict";var iN=Ce(),jp=Dt();function Np(e){jp.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}iN.inherits(Np,jp);Np.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}jp.prototype.processChunk.call(this,e)};W1.exports=Np});var Kc=_((xE,F1)=>{"use strict";var R1=ca(),H1=Sp(),aN=Xp(),Lp=V1();function Zp(e,t,n,i,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=i,this.compressedContent=r}Zp.prototype={getContentWorker:function(){var e=new H1(R1.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Lp("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new H1(R1.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};Zp.createWorkerFrom=function(e,t,n){return e.pipe(new aN).pipe(new Lp("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new Lp("compressedSize")).withStreamInfo("compression",t)};F1.exports=Zp});var D1=_((wE,q1)=>{"use strict";var oN=kp(),sN=Sp(),Wp=da(),Vp=Kc(),M1=Dt(),Rp=function(e,t,n){this.name=e,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=t,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}};Rp.prototype={internalStream:function(e){var t=null,n="string";try{if(!e)throw new Error("No output type specified.");n=e.toLowerCase();var i=n==="string"||n==="text";(n==="binarystring"||n==="text")&&(n="string"),t=this._decompressWorker();var r=!this._dataBinary;r&&!i&&(t=t.pipe(new Wp.Utf8EncodeWorker)),!r&&i&&(t=t.pipe(new Wp.Utf8DecodeWorker))}catch(a){t=new M1("error"),t.error(a)}return new oN(t,n,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof Vp&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new Wp.Utf8EncodeWorker)),Vp.createWorkerFrom(n,e,t)},_decompressWorker:function(){return this._data instanceof Vp?this._data.getContentWorker():this._data instanceof M1?this._data:new sN(this._data)}};var I1=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],lN=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(Bc=0;Bc<I1.length;Bc++)Rp.prototype[I1[Bc]]=lN;var Bc;q1.exports=Rp});var An=_(yt=>{"use strict";var cN=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function uN(e,t){return Object.prototype.hasOwnProperty.call(e,t)}yt.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(var i in n)uN(n,i)&&(e[i]=n[i])}}return e};yt.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var fN={arraySet:function(e,t,n,i,r){if(t.subarray&&e.subarray){e.set(t.subarray(n,n+i),r);return}for(var a=0;a<i;a++)e[r+a]=t[n+a]},flattenChunks:function(e){var t,n,i,r,a,o;for(i=0,t=0,n=e.length;t<n;t++)i+=e[t].length;for(o=new Uint8Array(i),r=0,t=0,n=e.length;t<n;t++)a=e[t],o.set(a,r),r+=a.length;return o}},dN={arraySet:function(e,t,n,i,r){for(var a=0;a<i;a++)e[r+a]=t[n+a]},flattenChunks:function(e){return[].concat.apply([],e)}};yt.setTyped=function(e){e?(yt.Buf8=Uint8Array,yt.Buf16=Uint16Array,yt.Buf32=Int32Array,yt.assign(yt,fN)):(yt.Buf8=Array,yt.Buf16=Array,yt.Buf32=Array,yt.assign(yt,dN))};yt.setTyped(cN)});var u9=_(ha=>{"use strict";var mN=An(),pN=4,J1=0,U1=1,vN=2;function va(e){for(var t=e.length;--t>=0;)e[t]=0}var hN=0,B1=1,bN=2,gN=3,yN=258,Jp=29,Ps=256,ys=Ps+1+Jp,pa=30,Up=19,A1=2*ys+1,oi=15,Hp=16,xN=7,Ep=256,Q1=16,_1=17,$1=18,qp=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Ac=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],wN=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],e9=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],zN=512,Qn=new Array((ys+2)*2);va(Qn);var gs=new Array(pa*2);va(gs);var xs=new Array(zN);va(xs);var ws=new Array(yN-gN+1);va(ws);var Cp=new Array(Jp);va(Cp);var Qc=new Array(pa);va(Qc);function Fp(e,t,n,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}var t9,n9,r9;function Mp(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function i9(e){return e<256?xs[e]:xs[256+(e>>>7)]}function zs(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function Lt(e,t,n){e.bi_valid>Hp-n?(e.bi_buf|=t<<e.bi_valid&65535,zs(e,e.bi_buf),e.bi_buf=t>>Hp-e.bi_valid,e.bi_valid+=n-Hp):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function Tn(e,t,n){Lt(e,n[t*2],n[t*2+1])}function a9(e,t){var n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1}function PN(e){e.bi_valid===16?(zs(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function kN(e,t){var n=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,f,m,d,p,v=0;for(m=0;m<=oi;m++)e.bl_count[m]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<A1;l++)u=e.heap[l],m=n[n[u*2+1]*2+1]+1,m>c&&(m=c,v++),n[u*2+1]=m,!(u>i)&&(e.bl_count[m]++,d=0,u>=s&&(d=o[u-s]),p=n[u*2],e.opt_len+=p*(m+d),a&&(e.static_len+=p*(r[u*2+1]+d)));if(v!==0){do{for(m=c-1;e.bl_count[m]===0;)m--;e.bl_count[m]--,e.bl_count[m+1]+=2,e.bl_count[c]--,v-=2}while(v>0);for(m=c;m!==0;m--)for(u=e.bl_count[m];u!==0;)f=e.heap[--l],!(f>i)&&(n[f*2+1]!==m&&(e.opt_len+=(m-n[f*2+1])*n[f*2],n[f*2+1]=m),u--)}}function o9(e,t,n){var i=new Array(oi+1),r=0,a,o;for(a=1;a<=oi;a++)i[a]=r=r+n[a-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=a9(i[s]++,s))}}function ON(){var e,t,n,i,r,a=new Array(oi+1);for(n=0,i=0;i<Jp-1;i++)for(Cp[i]=n,e=0;e<1<<qp[i];e++)ws[n++]=i;for(ws[n-1]=i,r=0,i=0;i<16;i++)for(Qc[i]=r,e=0;e<1<<Ac[i];e++)xs[r++]=i;for(r>>=7;i<pa;i++)for(Qc[i]=r<<7,e=0;e<1<<Ac[i]-7;e++)xs[256+r++]=i;for(t=0;t<=oi;t++)a[t]=0;for(e=0;e<=143;)Qn[e*2+1]=8,e++,a[8]++;for(;e<=255;)Qn[e*2+1]=9,e++,a[9]++;for(;e<=279;)Qn[e*2+1]=7,e++,a[7]++;for(;e<=287;)Qn[e*2+1]=8,e++,a[8]++;for(o9(Qn,ys+1,a),e=0;e<pa;e++)gs[e*2+1]=5,gs[e*2]=a9(e,5);t9=new Fp(Qn,qp,Ps+1,ys,oi),n9=new Fp(gs,Ac,0,pa,oi),r9=new Fp(new Array(0),wN,0,Up,xN)}function s9(e){var t;for(t=0;t<ys;t++)e.dyn_ltree[t*2]=0;for(t=0;t<pa;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Up;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Ep*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function l9(e){e.bi_valid>8?zs(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function SN(e,t,n,i){l9(e),i&&(zs(e,n),zs(e,~n)),mN.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}function E1(e,t,n,i){var r=t*2,a=n*2;return e[r]<e[a]||e[r]===e[a]&&i[t]<=i[n]}function Ip(e,t,n){for(var i=e.heap[n],r=n<<1;r<=e.heap_len&&(r<e.heap_len&&E1(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!E1(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i}function C1(e,t,n){var i,r,a=0,o,s;if(e.last_lit!==0)do i=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1],r=e.pending_buf[e.l_buf+a],a++,i===0?Tn(e,r,t):(o=ws[r],Tn(e,o+Ps+1,t),s=qp[o],s!==0&&(r-=Cp[o],Lt(e,r,s)),i--,o=i9(i),Tn(e,o,n),s=Ac[o],s!==0&&(i-=Qc[o],Lt(e,i,s)));while(a<e.last_lit);Tn(e,Ep,t)}function Dp(e,t){var n=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,c=-1,l;for(e.heap_len=0,e.heap_max=A1,o=0;o<a;o++)n[o*2]!==0?(e.heap[++e.heap_len]=c=o,e.depth[o]=0):n[o*2+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,r&&(e.static_len-=i[l*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)Ip(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ip(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[l*2]=n[o*2]+n[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=l,e.heap[1]=l++,Ip(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],kN(e,t),o9(n,c,e.bl_count)}function Y1(e,t,n){var i,r=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(n+1)*2+1]=65535,i=0;i<=n;i++)a=o,o=t[(i+1)*2+1],!(++s<c&&a===o)&&(s<l?e.bl_tree[a*2]+=s:a!==0?(a!==r&&e.bl_tree[a*2]++,e.bl_tree[Q1*2]++):s<=10?e.bl_tree[_1*2]++:e.bl_tree[$1*2]++,s=0,r=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))}function G1(e,t,n){var i,r=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),i=0;i<=n;i++)if(a=o,o=t[(i+1)*2+1],!(++s<c&&a===o)){if(s<l)do Tn(e,a,e.bl_tree);while(--s!==0);else a!==0?(a!==r&&(Tn(e,a,e.bl_tree),s--),Tn(e,Q1,e.bl_tree),Lt(e,s-3,2)):s<=10?(Tn(e,_1,e.bl_tree),Lt(e,s-3,3)):(Tn(e,$1,e.bl_tree),Lt(e,s-11,7));s=0,r=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}}function TN(e){var t;for(Y1(e,e.dyn_ltree,e.l_desc.max_code),Y1(e,e.dyn_dtree,e.d_desc.max_code),Dp(e,e.bl_desc),t=Up-1;t>=3&&e.bl_tree[e9[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function XN(e,t,n,i){var r;for(Lt(e,t-257,5),Lt(e,n-1,5),Lt(e,i-4,4),r=0;r<i;r++)Lt(e,e.bl_tree[e9[r]*2+1],3);G1(e,e.dyn_ltree,t-1),G1(e,e.dyn_dtree,n-1)}function jN(e){var t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return J1;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return U1;for(n=32;n<Ps;n++)if(e.dyn_ltree[n*2]!==0)return U1;return J1}var K1=!1;function NN(e){K1||(ON(),K1=!0),e.l_desc=new Mp(e.dyn_ltree,t9),e.d_desc=new Mp(e.dyn_dtree,n9),e.bl_desc=new Mp(e.bl_tree,r9),e.bi_buf=0,e.bi_valid=0,s9(e)}function c9(e,t,n,i){Lt(e,(hN<<1)+(i?1:0),3),SN(e,t,n,!0)}function LN(e){Lt(e,B1<<1,3),Tn(e,Ep,Qn),PN(e)}function ZN(e,t,n,i){var r,a,o=0;e.level>0?(e.strm.data_type===vN&&(e.strm.data_type=jN(e)),Dp(e,e.l_desc),Dp(e,e.d_desc),o=TN(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=n+5,n+4<=r&&t!==-1?c9(e,t,n,i):e.strategy===pN||a===r?(Lt(e,(B1<<1)+(i?1:0),3),C1(e,Qn,gs)):(Lt(e,(bN<<1)+(i?1:0),3),XN(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),C1(e,e.dyn_ltree,e.dyn_dtree)),s9(e),i&&l9(e)}function WN(e,t,n){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=n&255,e.last_lit++,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(ws[n]+Ps+1)*2]++,e.dyn_dtree[i9(t)*2]++),e.last_lit===e.lit_bufsize-1}ha._tr_init=NN;ha._tr_stored_block=c9;ha._tr_flush_block=ZN;ha._tr_tally=WN;ha._tr_align=LN});var Yp=_((kE,f9)=>{"use strict";function VN(e,t,n,i){for(var r=e&65535|0,a=e>>>16&65535|0,o=0;n!==0;){o=n>2e3?2e3:n,n-=o;do r=r+t[i++]|0,a=a+r|0;while(--o);r%=65521,a%=65521}return r|a<<16|0}f9.exports=VN});var Gp=_((OE,d9)=>{"use strict";function RN(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var HN=RN();function FN(e,t,n,i){var r=HN,a=i+n;e^=-1;for(var o=i;o<a;o++)e=e>>>8^r[(e^t[o])&255];return e^-1}d9.exports=FN});var _c=_((SE,m9)=>{"use strict";m9.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var z9=_(Nn=>{"use strict";var xt=An(),Gt=u9(),b9=Yp(),yr=Gp(),MN=_c(),ui=0,IN=1,qN=3,kr=4,p9=5,jn=0,v9=1,Kt=-2,DN=-3,Kp=-5,JN=-1,UN=1,$c=2,EN=3,CN=4,YN=0,GN=2,ru=8,KN=9,BN=15,AN=8,QN=29,_N=256,Ap=_N+1+QN,$N=30,eL=19,tL=2*Ap+1,nL=15,xe=3,zr=258,sn=zr+xe+1,rL=32,iu=42,Qp=69,eu=73,tu=91,nu=103,si=113,Os=666,et=1,Ss=2,li=3,ya=4,iL=3;function Pr(e,t){return e.msg=MN[t],t}function h9(e){return(e<<1)-(e>4?9:0)}function wr(e){for(var t=e.length;--t>=0;)e[t]=0}function xr(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(xt.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))}function st(e,t){Gt._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,xr(e.strm)}function Pe(e,t){e.pending_buf[e.pending++]=t}function ks(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function aL(e,t,n,i){var r=e.avail_in;return r>i&&(r=i),r===0?0:(e.avail_in-=r,xt.arraySet(t,e.input,e.next_in,r,n),e.state.wrap===1?e.adler=b9(e.adler,t,r,n):e.state.wrap===2&&(e.adler=yr(e.adler,t,r,n)),e.next_in+=r,e.total_in+=r,r)}function g9(e,t){var n=e.max_chain_length,i=e.strstart,r,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-sn?e.strstart-(e.w_size-sn):0,l=e.window,u=e.w_mask,f=e.prev,m=e.strstart+zr,d=l[i+o-1],p=l[i+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(r=t,!(l[r+o]!==p||l[r+o-1]!==d||l[r]!==l[i]||l[++r]!==l[i+1])){i+=2,r++;do;while(l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&i<m);if(a=zr-(m-i),i=m-zr,a>o){if(e.match_start=t,o=a,a>=s)break;d=l[i+o-1],p=l[i+o]}}while((t=f[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead}function ci(e){var t=e.w_size,n,i,r,a,o;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-sn)){xt.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,i=e.hash_size,n=i;do r=e.head[--n],e.head[n]=r>=t?r-t:0;while(--i);i=t,n=i;do r=e.prev[--n],e.prev[n]=r>=t?r-t:0;while(--i);a+=t}if(e.strm.avail_in===0)break;if(i=aL(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=i,e.lookahead+e.insert>=xe)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+xe-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<xe)););}while(e.lookahead<sn&&e.strm.avail_in!==0)}function oL(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(ci(e),e.lookahead===0&&t===ui)return et;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+n;if((e.strstart===0||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,st(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-sn&&(st(e,!1),e.strm.avail_out===0))return et}return e.insert=0,t===kr?(st(e,!0),e.strm.avail_out===0?li:ya):(e.strstart>e.block_start&&(st(e,!1),e.strm.avail_out===0),et)}function Bp(e,t){for(var n,i;;){if(e.lookahead<sn){if(ci(e),e.lookahead<sn&&t===ui)return et;if(e.lookahead===0)break}if(n=0,e.lookahead>=xe&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+xe-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-sn&&(e.match_length=g9(e,n)),e.match_length>=xe)if(i=Gt._tr_tally(e,e.strstart-e.match_start,e.match_length-xe),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=xe){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+xe-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=Gt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(st(e,!1),e.strm.avail_out===0))return et}return e.insert=e.strstart<xe-1?e.strstart:xe-1,t===kr?(st(e,!0),e.strm.avail_out===0?li:ya):e.last_lit&&(st(e,!1),e.strm.avail_out===0)?et:Ss}function ba(e,t){for(var n,i,r;;){if(e.lookahead<sn){if(ci(e),e.lookahead<sn&&t===ui)return et;if(e.lookahead===0)break}if(n=0,e.lookahead>=xe&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+xe-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=xe-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-sn&&(e.match_length=g9(e,n),e.match_length<=5&&(e.strategy===UN||e.match_length===xe&&e.strstart-e.match_start>4096)&&(e.match_length=xe-1)),e.prev_length>=xe&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-xe,i=Gt._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-xe),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=r&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+xe-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=xe-1,e.strstart++,i&&(st(e,!1),e.strm.avail_out===0))return et}else if(e.match_available){if(i=Gt._tr_tally(e,0,e.window[e.strstart-1]),i&&st(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return et}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=Gt._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<xe-1?e.strstart:xe-1,t===kr?(st(e,!0),e.strm.avail_out===0?li:ya):e.last_lit&&(st(e,!1),e.strm.avail_out===0)?et:Ss}function sL(e,t){for(var n,i,r,a,o=e.window;;){if(e.lookahead<=zr){if(ci(e),e.lookahead<=zr&&t===ui)return et;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=xe&&e.strstart>0&&(r=e.strstart-1,i=o[r],i===o[++r]&&i===o[++r]&&i===o[++r])){a=e.strstart+zr;do;while(i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&r<a);e.match_length=zr-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=xe?(n=Gt._tr_tally(e,1,e.match_length-xe),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Gt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(st(e,!1),e.strm.avail_out===0))return et}return e.insert=0,t===kr?(st(e,!0),e.strm.avail_out===0?li:ya):e.last_lit&&(st(e,!1),e.strm.avail_out===0)?et:Ss}function lL(e,t){for(var n;;){if(e.lookahead===0&&(ci(e),e.lookahead===0)){if(t===ui)return et;break}if(e.match_length=0,n=Gt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(st(e,!1),e.strm.avail_out===0))return et}return e.insert=0,t===kr?(st(e,!0),e.strm.avail_out===0?li:ya):e.last_lit&&(st(e,!1),e.strm.avail_out===0)?et:Ss}function Xn(e,t,n,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=r}var ga;ga=[new Xn(0,0,0,0,oL),new Xn(4,4,8,4,Bp),new Xn(4,5,16,8,Bp),new Xn(4,6,32,32,Bp),new Xn(4,4,16,16,ba),new Xn(8,16,32,32,ba),new Xn(8,16,128,128,ba),new Xn(8,32,128,256,ba),new Xn(32,128,258,1024,ba),new Xn(32,258,258,4096,ba)];function cL(e){e.window_size=2*e.w_size,wr(e.head),e.max_lazy_match=ga[e.level].max_lazy,e.good_match=ga[e.level].good_length,e.nice_match=ga[e.level].nice_length,e.max_chain_length=ga[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=xe-1,e.match_available=0,e.ins_h=0}function uL(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ru,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new xt.Buf16(tL*2),this.dyn_dtree=new xt.Buf16((2*$N+1)*2),this.bl_tree=new xt.Buf16((2*eL+1)*2),wr(this.dyn_ltree),wr(this.dyn_dtree),wr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new xt.Buf16(nL+1),this.heap=new xt.Buf16(2*Ap+1),wr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new xt.Buf16(2*Ap+1),wr(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function y9(e){var t;return!e||!e.state?Pr(e,Kt):(e.total_in=e.total_out=0,e.data_type=GN,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?iu:si,e.adler=t.wrap===2?0:1,t.last_flush=ui,Gt._tr_init(t),jn)}function x9(e){var t=y9(e);return t===jn&&cL(e.state),t}function fL(e,t){return!e||!e.state||e.state.wrap!==2?Kt:(e.state.gzhead=t,jn)}function w9(e,t,n,i,r,a){if(!e)return Kt;var o=1;if(t===JN&&(t=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),r<1||r>KN||n!==ru||i<8||i>15||t<0||t>9||a<0||a>CN)return Pr(e,Kt);i===8&&(i=9);var s=new uL;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=r+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+xe-1)/xe),s.window=new xt.Buf8(s.w_size*2),s.head=new xt.Buf16(s.hash_size),s.prev=new xt.Buf16(s.w_size),s.lit_bufsize=1<<r+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new xt.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=n,x9(e)}function dL(e,t){return w9(e,t,ru,BN,AN,YN)}function mL(e,t){var n,i,r,a;if(!e||!e.state||t>p9||t<0)return e?Pr(e,Kt):Kt;if(i=e.state,!e.output||!e.input&&e.avail_in!==0||i.status===Os&&t!==kr)return Pr(e,e.avail_out===0?Kp:Kt);if(i.strm=e,n=i.last_flush,i.last_flush=t,i.status===iu)if(i.wrap===2)e.adler=0,Pe(i,31),Pe(i,139),Pe(i,8),i.gzhead?(Pe(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Pe(i,i.gzhead.time&255),Pe(i,i.gzhead.time>>8&255),Pe(i,i.gzhead.time>>16&255),Pe(i,i.gzhead.time>>24&255),Pe(i,i.level===9?2:i.strategy>=$c||i.level<2?4:0),Pe(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(Pe(i,i.gzhead.extra.length&255),Pe(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=yr(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=Qp):(Pe(i,0),Pe(i,0),Pe(i,0),Pe(i,0),Pe(i,0),Pe(i,i.level===9?2:i.strategy>=$c||i.level<2?4:0),Pe(i,iL),i.status=si);else{var o=ru+(i.w_bits-8<<4)<<8,s=-1;i.strategy>=$c||i.level<2?s=0:i.level<6?s=1:i.level===6?s=2:s=3,o|=s<<6,i.strstart!==0&&(o|=rL),o+=31-o%31,i.status=si,ks(i,o),i.strstart!==0&&(ks(i,e.adler>>>16),ks(i,e.adler&65535)),e.adler=1}if(i.status===Qp)if(i.gzhead.extra){for(r=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=yr(e.adler,i.pending_buf,i.pending-r,r)),xr(e),r=i.pending,i.pending===i.pending_buf_size));)Pe(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>r&&(e.adler=yr(e.adler,i.pending_buf,i.pending-r,r)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=eu)}else i.status=eu;if(i.status===eu)if(i.gzhead.name){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=yr(e.adler,i.pending_buf,i.pending-r,r)),xr(e),r=i.pending,i.pending===i.pending_buf_size)){a=1;break}i.gzindex<i.gzhead.name.length?a=i.gzhead.name.charCodeAt(i.gzindex++)&255:a=0,Pe(i,a)}while(a!==0);i.gzhead.hcrc&&i.pending>r&&(e.adler=yr(e.adler,i.pending_buf,i.pending-r,r)),a===0&&(i.gzindex=0,i.status=tu)}else i.status=tu;if(i.status===tu)if(i.gzhead.comment){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=yr(e.adler,i.pending_buf,i.pending-r,r)),xr(e),r=i.pending,i.pending===i.pending_buf_size)){a=1;break}i.gzindex<i.gzhead.comment.length?a=i.gzhead.comment.charCodeAt(i.gzindex++)&255:a=0,Pe(i,a)}while(a!==0);i.gzhead.hcrc&&i.pending>r&&(e.adler=yr(e.adler,i.pending_buf,i.pending-r,r)),a===0&&(i.status=nu)}else i.status=nu;if(i.status===nu&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&xr(e),i.pending+2<=i.pending_buf_size&&(Pe(i,e.adler&255),Pe(i,e.adler>>8&255),e.adler=0,i.status=si)):i.status=si),i.pending!==0){if(xr(e),e.avail_out===0)return i.last_flush=-1,jn}else if(e.avail_in===0&&h9(t)<=h9(n)&&t!==kr)return Pr(e,Kp);if(i.status===Os&&e.avail_in!==0)return Pr(e,Kp);if(e.avail_in!==0||i.lookahead!==0||t!==ui&&i.status!==Os){var c=i.strategy===$c?lL(i,t):i.strategy===EN?sL(i,t):ga[i.level].func(i,t);if((c===li||c===ya)&&(i.status=Os),c===et||c===li)return e.avail_out===0&&(i.last_flush=-1),jn;if(c===Ss&&(t===IN?Gt._tr_align(i):t!==p9&&(Gt._tr_stored_block(i,0,0,!1),t===qN&&(wr(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),xr(e),e.avail_out===0))return i.last_flush=-1,jn}return t!==kr?jn:i.wrap<=0?v9:(i.wrap===2?(Pe(i,e.adler&255),Pe(i,e.adler>>8&255),Pe(i,e.adler>>16&255),Pe(i,e.adler>>24&255),Pe(i,e.total_in&255),Pe(i,e.total_in>>8&255),Pe(i,e.total_in>>16&255),Pe(i,e.total_in>>24&255)):(ks(i,e.adler>>>16),ks(i,e.adler&65535)),xr(e),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?jn:v9)}function pL(e){var t;return!e||!e.state?Kt:(t=e.state.status,t!==iu&&t!==Qp&&t!==eu&&t!==tu&&t!==nu&&t!==si&&t!==Os?Pr(e,Kt):(e.state=null,t===si?Pr(e,DN):jn))}function vL(e,t){var n=t.length,i,r,a,o,s,c,l,u;if(!e||!e.state||(i=e.state,o=i.wrap,o===2||o===1&&i.status!==iu||i.lookahead))return Kt;for(o===1&&(e.adler=b9(e.adler,t,n,0)),i.wrap=0,n>=i.w_size&&(o===0&&(wr(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new xt.Buf8(i.w_size),xt.arraySet(u,t,n-i.w_size,i.w_size,0),t=u,n=i.w_size),s=e.avail_in,c=e.next_in,l=e.input,e.avail_in=n,e.next_in=0,e.input=t,ci(i);i.lookahead>=xe;){r=i.strstart,a=i.lookahead-(xe-1);do i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+xe-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++;while(--a);i.strstart=r,i.lookahead=xe-1,ci(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=xe-1,i.match_available=0,e.next_in=c,e.input=l,e.avail_in=s,i.wrap=o,jn}Nn.deflateInit=dL;Nn.deflateInit2=w9;Nn.deflateReset=x9;Nn.deflateResetKeep=y9;Nn.deflateSetHeader=fL;Nn.deflate=mL;Nn.deflateEnd=pL;Nn.deflateSetDictionary=vL;Nn.deflateInfo="pako deflate (from Nodeca project)"});var _p=_(xa=>{"use strict";var au=An(),P9=!0,k9=!0;try{String.fromCharCode.apply(null,[0])}catch{P9=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{k9=!1}var Ts=new au.Buf8(256);for(_n=0;_n<256;_n++)Ts[_n]=_n>=252?6:_n>=248?5:_n>=240?4:_n>=224?3:_n>=192?2:1;var _n;Ts[254]=Ts[254]=1;xa.string2buf=function(e){var t,n,i,r,a,o=e.length,s=0;for(r=0;r<o;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<o&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new au.Buf8(s),a=0,r=0;a<s;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<o&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t};function O9(e,t){if(t<65534&&(e.subarray&&k9||!e.subarray&&P9))return String.fromCharCode.apply(null,au.shrinkBuf(e,t));for(var n="",i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n}xa.buf2binstring=function(e){return O9(e,e.length)};xa.binstring2buf=function(e){for(var t=new au.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t};xa.buf2string=function(e,t){var n,i,r,a,o=t||e.length,s=new Array(o*2);for(i=0,n=0;n<o;){if(r=e[n++],r<128){s[i++]=r;continue}if(a=Ts[r],a>4){s[i++]=65533,n+=a-1;continue}for(r&=a===2?31:a===3?15:7;a>1&&n<o;)r=r<<6|e[n++]&63,a--;if(a>1){s[i++]=65533;continue}r<65536?s[i++]=r:(r-=65536,s[i++]=55296|r>>10&1023,s[i++]=56320|r&1023)}return O9(s,i)};xa.utf8border=function(e,t){var n;for(t=t||e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+Ts[e[n]]>t?n:t}});var $p=_((jE,S9)=>{"use strict";function hL(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}S9.exports=hL});var N9=_(Ns=>{"use strict";var Xs=z9(),js=An(),tv=_p(),nv=_c(),bL=$p(),j9=Object.prototype.toString,gL=0,ev=4,wa=0,T9=1,X9=2,yL=-1,xL=0,wL=8;function fi(e){if(!(this instanceof fi))return new fi(e);this.options=js.assign({level:yL,method:wL,chunkSize:16384,windowBits:15,memLevel:8,strategy:xL,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new bL,this.strm.avail_out=0;var n=Xs.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==wa)throw new Error(nv[n]);if(t.header&&Xs.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(typeof t.dictionary=="string"?i=tv.string2buf(t.dictionary):j9.call(t.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(t.dictionary):i=t.dictionary,n=Xs.deflateSetDictionary(this.strm,i),n!==wa)throw new Error(nv[n]);this._dict_set=!0}}fi.prototype.push=function(e,t){var n=this.strm,i=this.options.chunkSize,r,a;if(this.ended)return!1;a=t===~~t?t:t===!0?ev:gL,typeof e=="string"?n.input=tv.string2buf(e):j9.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new js.Buf8(i),n.next_out=0,n.avail_out=i),r=Xs.deflate(n,a),r!==T9&&r!==wa)return this.onEnd(r),this.ended=!0,!1;(n.avail_out===0||n.avail_in===0&&(a===ev||a===X9))&&(this.options.to==="string"?this.onData(tv.buf2binstring(js.shrinkBuf(n.output,n.next_out))):this.onData(js.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||n.avail_out===0)&&r!==T9);return a===ev?(r=Xs.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===wa):(a===X9&&(this.onEnd(wa),n.avail_out=0),!0)};fi.prototype.onData=function(e){this.chunks.push(e)};fi.prototype.onEnd=function(e){e===wa&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=js.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function rv(e,t){var n=new fi(t);if(n.push(e,!0),n.err)throw n.msg||nv[n.err];return n.result}function zL(e,t){return t=t||{},t.raw=!0,rv(e,t)}function PL(e,t){return t=t||{},t.gzip=!0,rv(e,t)}Ns.Deflate=fi;Ns.deflate=rv;Ns.deflateRaw=zL;Ns.gzip=PL});var Z9=_((LE,L9)=>{"use strict";var ou=30,kL=12;L9.exports=function(t,n){var i,r,a,o,s,c,l,u,f,m,d,p,v,h,b,g,y,x,z,S,P,T,j,X,w;i=t.state,r=t.next_in,X=t.input,a=r+(t.avail_in-5),o=t.next_out,w=t.output,s=o-(n-t.avail_out),c=o+(t.avail_out-257),l=i.dmax,u=i.wsize,f=i.whave,m=i.wnext,d=i.window,p=i.hold,v=i.bits,h=i.lencode,b=i.distcode,g=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;e:do{v<15&&(p+=X[r++]<<v,v+=8,p+=X[r++]<<v,v+=8),x=h[p&g];t:for(;;){if(z=x>>>24,p>>>=z,v-=z,z=x>>>16&255,z===0)w[o++]=x&65535;else if(z&16){S=x&65535,z&=15,z&&(v<z&&(p+=X[r++]<<v,v+=8),S+=p&(1<<z)-1,p>>>=z,v-=z),v<15&&(p+=X[r++]<<v,v+=8,p+=X[r++]<<v,v+=8),x=b[p&y];n:for(;;){if(z=x>>>24,p>>>=z,v-=z,z=x>>>16&255,z&16){if(P=x&65535,z&=15,v<z&&(p+=X[r++]<<v,v+=8,v<z&&(p+=X[r++]<<v,v+=8)),P+=p&(1<<z)-1,P>l){t.msg="invalid distance too far back",i.mode=ou;break e}if(p>>>=z,v-=z,z=o-s,P>z){if(z=P-z,z>f&&i.sane){t.msg="invalid distance too far back",i.mode=ou;break e}if(T=0,j=d,m===0){if(T+=u-z,z<S){S-=z;do w[o++]=d[T++];while(--z);T=o-P,j=w}}else if(m<z){if(T+=u+m-z,z-=m,z<S){S-=z;do w[o++]=d[T++];while(--z);if(T=0,m<S){z=m,S-=z;do w[o++]=d[T++];while(--z);T=o-P,j=w}}}else if(T+=m-z,z<S){S-=z;do w[o++]=d[T++];while(--z);T=o-P,j=w}for(;S>2;)w[o++]=j[T++],w[o++]=j[T++],w[o++]=j[T++],S-=3;S&&(w[o++]=j[T++],S>1&&(w[o++]=j[T++]))}else{T=o-P;do w[o++]=w[T++],w[o++]=w[T++],w[o++]=w[T++],S-=3;while(S>2);S&&(w[o++]=w[T++],S>1&&(w[o++]=w[T++]))}}else if((z&64)===0){x=b[(x&65535)+(p&(1<<z)-1)];continue n}else{t.msg="invalid distance code",i.mode=ou;break e}break}}else if((z&64)===0){x=h[(x&65535)+(p&(1<<z)-1)];continue t}else if(z&32){i.mode=kL;break e}else{t.msg="invalid literal/length code",i.mode=ou;break e}break}}while(r<a&&o<c);S=v>>3,r-=S,v-=S<<3,p&=(1<<v)-1,t.next_in=r,t.next_out=o,t.avail_in=r<a?5+(a-r):5-(r-a),t.avail_out=o<c?257+(c-o):257-(o-c),i.hold=p,i.bits=v}});var I9=_((ZE,M9)=>{"use strict";var W9=An(),za=15,V9=852,R9=592,H9=0,iv=1,F9=2,OL=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],SL=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],TL=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],XL=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];M9.exports=function(t,n,i,r,a,o,s,c){var l=c.bits,u=0,f=0,m=0,d=0,p=0,v=0,h=0,b=0,g=0,y=0,x,z,S,P,T,j=null,X=0,w,N=new W9.Buf16(za+1),F=new W9.Buf16(za+1),C=null,R=0,E,Y,K;for(u=0;u<=za;u++)N[u]=0;for(f=0;f<r;f++)N[n[i+f]]++;for(p=l,d=za;d>=1&&N[d]===0;d--);if(p>d&&(p=d),d===0)return a[o++]=1<<24|64<<16|0,a[o++]=1<<24|64<<16|0,c.bits=1,0;for(m=1;m<d&&N[m]===0;m++);for(p<m&&(p=m),b=1,u=1;u<=za;u++)if(b<<=1,b-=N[u],b<0)return-1;if(b>0&&(t===H9||d!==1))return-1;for(F[1]=0,u=1;u<za;u++)F[u+1]=F[u]+N[u];for(f=0;f<r;f++)n[i+f]!==0&&(s[F[n[i+f]]++]=f);if(t===H9?(j=C=s,w=19):t===iv?(j=OL,X-=257,C=SL,R-=257,w=256):(j=TL,C=XL,w=-1),y=0,f=0,u=m,T=o,v=p,h=0,S=-1,g=1<<p,P=g-1,t===iv&&g>V9||t===F9&&g>R9)return 1;for(;;){E=u-h,s[f]<w?(Y=0,K=s[f]):s[f]>w?(Y=C[R+s[f]],K=j[X+s[f]]):(Y=96,K=0),x=1<<u-h,z=1<<v,m=z;do z-=x,a[T+(y>>h)+z]=E<<24|Y<<16|K|0;while(z!==0);for(x=1<<u-1;y&x;)x>>=1;if(x!==0?(y&=x-1,y+=x):y=0,f++,--N[u]===0){if(u===d)break;u=n[i+s[f]]}if(u>p&&(y&P)!==S){for(h===0&&(h=p),T+=m,v=u-h,b=1<<v;v+h<d&&(b-=N[v+h],!(b<=0));)v++,b<<=1;if(g+=1<<v,t===iv&&g>V9||t===F9&&g>R9)return 1;S=y&P,a[S]=p<<24|v<<16|T-o|0}}return y!==0&&(a[T+y]=u-h<<24|64<<16|0),c.bits=p,0}});var x7=_(ln=>{"use strict";var Jt=An(),uv=Yp(),Ln=Gp(),jL=Z9(),Ls=I9(),NL=0,f7=1,d7=2,q9=4,LL=5,su=6,di=0,ZL=1,WL=2,Bt=-2,m7=-3,fv=-4,VL=-5,D9=8,p7=1,J9=2,U9=3,E9=4,C9=5,Y9=6,G9=7,K9=8,B9=9,A9=10,uu=11,$n=12,av=13,Q9=14,ov=15,_9=16,$9=17,e7=18,t7=19,lu=20,cu=21,n7=22,r7=23,i7=24,a7=25,o7=26,sv=27,s7=28,l7=29,De=30,dv=31,RL=32,HL=852,FL=592,ML=15,IL=ML;function c7(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function qL(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Jt.Buf16(320),this.work=new Jt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v7(e){var t;return!e||!e.state?Bt:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=p7,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Jt.Buf32(HL),t.distcode=t.distdyn=new Jt.Buf32(FL),t.sane=1,t.back=-1,di)}function h7(e){var t;return!e||!e.state?Bt:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,v7(e))}function b7(e,t){var n,i;return!e||!e.state||(i=e.state,t<0?(n=0,t=-t):(n=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?Bt:(i.window!==null&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,h7(e))}function g7(e,t){var n,i;return e?(i=new qL,e.state=i,i.window=null,n=b7(e,t),n!==di&&(e.state=null),n):Bt}function DL(e){return g7(e,IL)}var u7=!0,lv,cv;function JL(e){if(u7){var t;for(lv=new Jt.Buf32(512),cv=new Jt.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Ls(f7,e.lens,0,288,lv,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Ls(d7,e.lens,0,32,cv,0,e.work,{bits:5}),u7=!1}e.lencode=lv,e.lenbits=9,e.distcode=cv,e.distbits=5}function y7(e,t,n,i){var r,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Jt.Buf8(a.wsize)),i>=a.wsize?(Jt.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>i&&(r=i),Jt.arraySet(a.window,t,n-i,r,a.wnext),i-=r,i?(Jt.arraySet(a.window,t,n-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0}function UL(e,t){var n,i,r,a,o,s,c,l,u,f,m,d,p,v,h=0,b,g,y,x,z,S,P,T,j=new Jt.Buf8(4),X,w,N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return Bt;n=e.state,n.mode===$n&&(n.mode=av),o=e.next_out,r=e.output,c=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=n.hold,u=n.bits,f=s,m=c,T=di;e:for(;;)switch(n.mode){case p7:if(n.wrap===0){n.mode=av;break}for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(n.wrap&2&&l===35615){n.check=0,j[0]=l&255,j[1]=l>>>8&255,n.check=Ln(n.check,j,2,0),l=0,u=0,n.mode=J9;break}if(n.flags=0,n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg="incorrect header check",n.mode=De;break}if((l&15)!==D9){e.msg="unknown compression method",n.mode=De;break}if(l>>>=4,u-=4,P=(l&15)+8,n.wbits===0)n.wbits=P;else if(P>n.wbits){e.msg="invalid window size",n.mode=De;break}n.dmax=1<<P,e.adler=n.check=1,n.mode=l&512?A9:$n,l=0,u=0;break;case J9:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(n.flags=l,(n.flags&255)!==D9){e.msg="unknown compression method",n.mode=De;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=De;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&(j[0]=l&255,j[1]=l>>>8&255,n.check=Ln(n.check,j,2,0)),l=0,u=0,n.mode=U9;case U9:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.head&&(n.head.time=l),n.flags&512&&(j[0]=l&255,j[1]=l>>>8&255,j[2]=l>>>16&255,j[3]=l>>>24&255,n.check=Ln(n.check,j,4,0)),l=0,u=0,n.mode=E9;case E9:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&(j[0]=l&255,j[1]=l>>>8&255,n.check=Ln(n.check,j,2,0)),l=0,u=0,n.mode=C9;case C9:if(n.flags&1024){for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&(j[0]=l&255,j[1]=l>>>8&255,n.check=Ln(n.check,j,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=Y9;case Y9:if(n.flags&1024&&(d=n.length,d>s&&(d=s),d&&(n.head&&(P=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Jt.arraySet(n.head.extra,i,a,d,P)),n.flags&512&&(n.check=Ln(n.check,i,d,a)),s-=d,a+=d,n.length-=d),n.length))break e;n.length=0,n.mode=G9;case G9:if(n.flags&2048){if(s===0)break e;d=0;do P=i[a+d++],n.head&&P&&n.length<65536&&(n.head.name+=String.fromCharCode(P));while(P&&d<s);if(n.flags&512&&(n.check=Ln(n.check,i,d,a)),s-=d,a+=d,P)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=K9;case K9:if(n.flags&4096){if(s===0)break e;d=0;do P=i[a+d++],n.head&&P&&n.length<65536&&(n.head.comment+=String.fromCharCode(P));while(P&&d<s);if(n.flags&512&&(n.check=Ln(n.check,i,d,a)),s-=d,a+=d,P)break e}else n.head&&(n.head.comment=null);n.mode=B9;case B9:if(n.flags&512){for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(l!==(n.check&65535)){e.msg="header crc mismatch",n.mode=De;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=$n;break;case A9:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}e.adler=n.check=c7(l),l=0,u=0,n.mode=uu;case uu:if(n.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,WL;e.adler=n.check=1,n.mode=$n;case $n:if(t===LL||t===su)break e;case av:if(n.last){l>>>=u&7,u-=u&7,n.mode=sv;break}for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}switch(n.last=l&1,l>>>=1,u-=1,l&3){case 0:n.mode=Q9;break;case 1:if(JL(n),n.mode=lu,t===su){l>>>=2,u-=2;break e}break;case 2:n.mode=$9;break;case 3:e.msg="invalid block type",n.mode=De}l>>>=2,u-=2;break;case Q9:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((l&65535)!==(l>>>16^65535)){e.msg="invalid stored block lengths",n.mode=De;break}if(n.length=l&65535,l=0,u=0,n.mode=ov,t===su)break e;case ov:n.mode=_9;case _9:if(d=n.length,d){if(d>s&&(d=s),d>c&&(d=c),d===0)break e;Jt.arraySet(r,i,a,d,o),s-=d,a+=d,c-=d,o+=d,n.length-=d;break}n.mode=$n;break;case $9:for(;u<14;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(n.nlen=(l&31)+257,l>>>=5,u-=5,n.ndist=(l&31)+1,l>>>=5,u-=5,n.ncode=(l&15)+4,l>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=De;break}n.have=0,n.mode=e7;case e7:for(;n.have<n.ncode;){for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.lens[N[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[N[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,X={bits:n.lenbits},T=Ls(NL,n.lens,0,19,n.lencode,0,n.work,X),n.lenbits=X.bits,T){e.msg="invalid code lengths set",n.mode=De;break}n.have=0,n.mode=t7;case t7:for(;n.have<n.nlen+n.ndist;){for(;h=n.lencode[l&(1<<n.lenbits)-1],b=h>>>24,g=h>>>16&255,y=h&65535,!(b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(y<16)l>>>=b,u-=b,n.lens[n.have++]=y;else{if(y===16){for(w=b+2;u<w;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(l>>>=b,u-=b,n.have===0){e.msg="invalid bit length repeat",n.mode=De;break}P=n.lens[n.have-1],d=3+(l&3),l>>>=2,u-=2}else if(y===17){for(w=b+3;u<w;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=b,u-=b,P=0,d=3+(l&7),l>>>=3,u-=3}else{for(w=b+7;u<w;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=b,u-=b,P=0,d=11+(l&127),l>>>=7,u-=7}if(n.have+d>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=De;break}for(;d--;)n.lens[n.have++]=P}}if(n.mode===De)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=De;break}if(n.lenbits=9,X={bits:n.lenbits},T=Ls(f7,n.lens,0,n.nlen,n.lencode,0,n.work,X),n.lenbits=X.bits,T){e.msg="invalid literal/lengths set",n.mode=De;break}if(n.distbits=6,n.distcode=n.distdyn,X={bits:n.distbits},T=Ls(d7,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,X),n.distbits=X.bits,T){e.msg="invalid distances set",n.mode=De;break}if(n.mode=lu,t===su)break e;case lu:n.mode=cu;case cu:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,jL(e,m),o=e.next_out,r=e.output,c=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=n.hold,u=n.bits,n.mode===$n&&(n.back=-1);break}for(n.back=0;h=n.lencode[l&(1<<n.lenbits)-1],b=h>>>24,g=h>>>16&255,y=h&65535,!(b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(g&&(g&240)===0){for(x=b,z=g,S=y;h=n.lencode[S+((l&(1<<x+z)-1)>>x)],b=h>>>24,g=h>>>16&255,y=h&65535,!(x+b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=x,u-=x,n.back+=x}if(l>>>=b,u-=b,n.back+=b,n.length=y,g===0){n.mode=o7;break}if(g&32){n.back=-1,n.mode=$n;break}if(g&64){e.msg="invalid literal/length code",n.mode=De;break}n.extra=g&15,n.mode=n7;case n7:if(n.extra){for(w=n.extra;u<w;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=r7;case r7:for(;h=n.distcode[l&(1<<n.distbits)-1],b=h>>>24,g=h>>>16&255,y=h&65535,!(b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((g&240)===0){for(x=b,z=g,S=y;h=n.distcode[S+((l&(1<<x+z)-1)>>x)],b=h>>>24,g=h>>>16&255,y=h&65535,!(x+b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=x,u-=x,n.back+=x}if(l>>>=b,u-=b,n.back+=b,g&64){e.msg="invalid distance code",n.mode=De;break}n.offset=y,n.extra=g&15,n.mode=i7;case i7:if(n.extra){for(w=n.extra;u<w;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=De;break}n.mode=a7;case a7:if(c===0)break e;if(d=m-c,n.offset>d){if(d=n.offset-d,d>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=De;break}d>n.wnext?(d-=n.wnext,p=n.wsize-d):p=n.wnext-d,d>n.length&&(d=n.length),v=n.window}else v=r,p=o-n.offset,d=n.length;d>c&&(d=c),c-=d,n.length-=d;do r[o++]=v[p++];while(--d);n.length===0&&(n.mode=cu);break;case o7:if(c===0)break e;r[o++]=n.length,c--,n.mode=cu;break;case sv:if(n.wrap){for(;u<32;){if(s===0)break e;s--,l|=i[a++]<<u,u+=8}if(m-=c,e.total_out+=m,n.total+=m,m&&(e.adler=n.check=n.flags?Ln(n.check,r,m,o-m):uv(n.check,r,m,o-m)),m=c,(n.flags?l:c7(l))!==n.check){e.msg="incorrect data check",n.mode=De;break}l=0,u=0}n.mode=s7;case s7:if(n.wrap&&n.flags){for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(l!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=De;break}l=0,u=0}n.mode=l7;case l7:T=ZL;break e;case De:T=m7;break e;case dv:return fv;case RL:default:return Bt}return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,(n.wsize||m!==e.avail_out&&n.mode<De&&(n.mode<sv||t!==q9))&&y7(e,e.output,e.next_out,m-e.avail_out)?(n.mode=dv,fv):(f-=e.avail_in,m-=e.avail_out,e.total_in+=f,e.total_out+=m,n.total+=m,n.wrap&&m&&(e.adler=n.check=n.flags?Ln(n.check,r,m,e.next_out-m):uv(n.check,r,m,e.next_out-m)),e.data_type=n.bits+(n.last?64:0)+(n.mode===$n?128:0)+(n.mode===lu||n.mode===ov?256:0),(f===0&&m===0||t===q9)&&T===di&&(T=VL),T)}function EL(e){if(!e||!e.state)return Bt;var t=e.state;return t.window&&(t.window=null),e.state=null,di}function CL(e,t){var n;return!e||!e.state||(n=e.state,(n.wrap&2)===0)?Bt:(n.head=t,t.done=!1,di)}function YL(e,t){var n=t.length,i,r,a;return!e||!e.state||(i=e.state,i.wrap!==0&&i.mode!==uu)?Bt:i.mode===uu&&(r=1,r=uv(r,t,n,0),r!==i.check)?m7:(a=y7(e,t,n,n),a?(i.mode=dv,fv):(i.havedict=1,di))}ln.inflateReset=h7;ln.inflateReset2=b7;ln.inflateResetKeep=v7;ln.inflateInit=DL;ln.inflateInit2=g7;ln.inflate=UL;ln.inflateEnd=EL;ln.inflateGetHeader=CL;ln.inflateSetDictionary=YL;ln.inflateInfo="pako inflate (from Nodeca project)"});var mv=_((VE,w7)=>{"use strict";w7.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var P7=_((RE,z7)=>{"use strict";function GL(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}z7.exports=GL});var O7=_(Ws=>{"use strict";var Pa=x7(),Zs=An(),fu=_p(),Ke=mv(),pv=_c(),KL=$p(),BL=P7(),k7=Object.prototype.toString;function mi(e){if(!(this instanceof mi))return new mi(e);this.options=Zs.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new KL,this.strm.avail_out=0;var n=Pa.inflateInit2(this.strm,t.windowBits);if(n!==Ke.Z_OK)throw new Error(pv[n]);if(this.header=new BL,Pa.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=fu.string2buf(t.dictionary):k7.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Pa.inflateSetDictionary(this.strm,t.dictionary),n!==Ke.Z_OK)))throw new Error(pv[n])}mi.prototype.push=function(e,t){var n=this.strm,i=this.options.chunkSize,r=this.options.dictionary,a,o,s,c,l,u=!1;if(this.ended)return!1;o=t===~~t?t:t===!0?Ke.Z_FINISH:Ke.Z_NO_FLUSH,typeof e=="string"?n.input=fu.binstring2buf(e):k7.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Zs.Buf8(i),n.next_out=0,n.avail_out=i),a=Pa.inflate(n,Ke.Z_NO_FLUSH),a===Ke.Z_NEED_DICT&&r&&(a=Pa.inflateSetDictionary(this.strm,r)),a===Ke.Z_BUF_ERROR&&u===!0&&(a=Ke.Z_OK,u=!1),a!==Ke.Z_STREAM_END&&a!==Ke.Z_OK)return this.onEnd(a),this.ended=!0,!1;n.next_out&&(n.avail_out===0||a===Ke.Z_STREAM_END||n.avail_in===0&&(o===Ke.Z_FINISH||o===Ke.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=fu.utf8border(n.output,n.next_out),c=n.next_out-s,l=fu.buf2string(n.output,s),n.next_out=c,n.avail_out=i-c,c&&Zs.arraySet(n.output,n.output,s,c,0),this.onData(l)):this.onData(Zs.shrinkBuf(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(u=!0)}while((n.avail_in>0||n.avail_out===0)&&a!==Ke.Z_STREAM_END);return a===Ke.Z_STREAM_END&&(o=Ke.Z_FINISH),o===Ke.Z_FINISH?(a=Pa.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Ke.Z_OK):(o===Ke.Z_SYNC_FLUSH&&(this.onEnd(Ke.Z_OK),n.avail_out=0),!0)};mi.prototype.onData=function(e){this.chunks.push(e)};mi.prototype.onEnd=function(e){e===Ke.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Zs.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function vv(e,t){var n=new mi(t);if(n.push(e,!0),n.err)throw n.msg||pv[n.err];return n.result}function AL(e,t){return t=t||{},t.raw=!0,vv(e,t)}Ws.Inflate=mi;Ws.inflate=vv;Ws.inflateRaw=AL;Ws.ungzip=vv});var X7=_((FE,T7)=>{"use strict";var QL=An().assign,_L=N9(),$L=O7(),eZ=mv(),S7={};QL(S7,_L,$L,eZ);T7.exports=S7});var N7=_(mu=>{"use strict";var tZ=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",nZ=X7(),j7=Ce(),du=Dt(),rZ=tZ?"uint8array":"array";mu.magic="\b\0";function pi(e,t){du.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}j7.inherits(pi,du);pi.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(j7.transformTo(rZ,e.data),!1)};pi.prototype.flush=function(){du.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};pi.prototype.cleanUp=function(){du.prototype.cleanUp.call(this),this._pako=null};pi.prototype._createPako=function(){this._pako=new nZ[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};mu.compressWorker=function(e){return new pi("Deflate",e)};mu.uncompressWorker=function(){return new pi("Inflate",{})}});var bv=_(hv=>{"use strict";var L7=Dt();hv.STORE={magic:"\0\0",compressWorker:function(){return new L7("STORE compression")},uncompressWorker:function(){return new L7("STORE decompression")}};hv.DEFLATE=N7()});var gv=_(vi=>{"use strict";vi.LOCAL_FILE_HEADER="PK";vi.CENTRAL_FILE_HEADER="PK";vi.CENTRAL_DIRECTORY_END="PK";vi.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";vi.ZIP64_CENTRAL_DIRECTORY_END="PK";vi.DATA_DESCRIPTOR="PK\x07\b"});var R7=_((DE,V7)=>{"use strict";var ka=Ce(),Oa=Dt(),yv=da(),Z7=Gc(),pu=gv(),Me=function(e,t){var n="",i;for(i=0;i<t;i++)n+=String.fromCharCode(e&255),e=e>>>8;return n},iZ=function(e,t){var n=e;return e||(n=t?16893:33204),(n&65535)<<16},aZ=function(e){return(e||0)&63},W7=function(e,t,n,i,r,a){var o=e.file,s=e.compression,c=a!==yv.utf8encode,l=ka.transformTo("string",a(o.name)),u=ka.transformTo("string",yv.utf8encode(o.name)),f=o.comment,m=ka.transformTo("string",a(f)),d=ka.transformTo("string",yv.utf8encode(f)),p=u.length!==o.name.length,v=d.length!==f.length,h,b,g="",y="",x="",z=o.dir,S=o.date,P={crc32:0,compressedSize:0,uncompressedSize:0};(!t||n)&&(P.crc32=e.crc32,P.compressedSize=e.compressedSize,P.uncompressedSize=e.uncompressedSize);var T=0;t&&(T|=8),!c&&(p||v)&&(T|=2048);var j=0,X=0;z&&(j|=16),r==="UNIX"?(X=798,j|=iZ(o.unixPermissions,z)):(X=20,j|=aZ(o.dosPermissions,z)),h=S.getUTCHours(),h=h<<6,h=h|S.getUTCMinutes(),h=h<<5,h=h|S.getUTCSeconds()/2,b=S.getUTCFullYear()-1980,b=b<<4,b=b|S.getUTCMonth()+1,b=b<<5,b=b|S.getUTCDate(),p&&(y=Me(1,1)+Me(Z7(l),4)+u,g+="up"+Me(y.length,2)+y),v&&(x=Me(1,1)+Me(Z7(m),4)+d,g+="uc"+Me(x.length,2)+x);var w="";w+=`
|
|
4
4
|
\0`,w+=Me(T,2),w+=s.magic,w+=Me(h,2),w+=Me(b,2),w+=Me(P.crc32,4),w+=Me(P.compressedSize,4),w+=Me(P.uncompressedSize,4),w+=Me(l.length,2),w+=Me(g.length,2);var N=pu.LOCAL_FILE_HEADER+w+l+g,F=pu.CENTRAL_FILE_HEADER+Me(X,2)+w+Me(m.length,2)+"\0\0\0\0"+Me(j,4)+Me(i,4)+l+g+m;return{fileRecord:N,dirRecord:F}},oZ=function(e,t,n,i,r){var a="",o=ka.transformTo("string",r(i));return a=pu.CENTRAL_DIRECTORY_END+"\0\0\0\0"+Me(e,2)+Me(e,2)+Me(t,4)+Me(n,4)+Me(o.length,2)+o,a},sZ=function(e){var t="";return t=pu.DATA_DESCRIPTOR+Me(e.crc32,4)+Me(e.compressedSize,4)+Me(e.uncompressedSize,4),t};function cn(e,t,n,i){Oa.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}ka.inherits(cn,Oa);cn.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,Oa.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-i-1))/n:100}}))};cn.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=W7(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0};cn.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=W7(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:sZ(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null};cn.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var n=this.bytesWritten-e,i=oZ(this.dirRecords.length,n,e,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})};cn.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};cn.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(n){t.processChunk(n)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(n){t.error(n)}),this};cn.prototype.resume=function(){if(!Oa.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};cn.prototype.error=function(e){var t=this._sources;if(!Oa.prototype.error.call(this,e))return!1;for(var n=0;n<t.length;n++)try{t[n].error(e)}catch{}return!0};cn.prototype.lock=function(){Oa.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};V7.exports=cn});var F7=_(H7=>{"use strict";var lZ=bv(),cZ=R7(),uZ=function(e,t){var n=e||t,i=lZ[n];if(!i)throw new Error(n+" is not a valid compression method !");return i};H7.generateWorker=function(e,t,n){var i=new cZ(t.streamFiles,n,t.platform,t.encodeFileName),r=0;try{e.forEach(function(a,o){r++;var s=uZ(o.options.compression,t.compression),c=o.options.compressionOptions||t.compressionOptions||{},l=o.dir,u=o.date;o._compressWorker(s,c).withStreamInfo("file",{name:a,dir:l,date:u,comment:o.comment||"",unixPermissions:o.unixPermissions,dosPermissions:o.dosPermissions}).pipe(i)}),i.entriesCount=r}catch(a){i.error(a)}return i}});var I7=_((UE,M7)=>{"use strict";var fZ=Ce(),vu=Dt();function Vs(e,t){vu.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}fZ.inherits(Vs,vu);Vs.prototype._bindStream=function(e){var t=this;this._stream=e,e.pause(),e.on("data",function(n){t.push({data:n,meta:{percent:0}})}).on("error",function(n){t.isPaused?this.generatedError=n:t.error(n)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})};Vs.prototype.pause=function(){return vu.prototype.pause.call(this)?(this._stream.pause(),!0):!1};Vs.prototype.resume=function(){return vu.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};M7.exports=Vs});var B7=_((EE,K7)=>{"use strict";var dZ=da(),Rs=Ce(),U7=Dt(),mZ=kp(),E7=Op(),q7=Kc(),pZ=D1(),vZ=F7(),D7=us(),hZ=I7(),C7=function(e,t,n){var i=Rs.getTypeOf(t),r,a=Rs.extend(n||{},E7);a.date=a.date||new Date,a.compression!==null&&(a.compression=a.compression.toUpperCase()),typeof a.unixPermissions=="string"&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&a.unixPermissions&16384&&(a.dir=!0),a.dosPermissions&&a.dosPermissions&16&&(a.dir=!0),a.dir&&(e=Y7(e)),a.createFolders&&(r=bZ(e))&&G7.call(this,r,!0);var o=i==="string"&&a.binary===!1&&a.base64===!1;(!n||typeof n.binary>"u")&&(a.binary=!o);var s=t instanceof q7&&t.uncompressedSize===0;(s||a.dir||!t||t.length===0)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",i="string");var c=null;t instanceof q7||t instanceof U7?c=t:D7.isNode&&D7.isStream(t)?c=new hZ(e,t):c=Rs.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var l=new pZ(e,c,a);this.files[e]=l},bZ=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},Y7=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},G7=function(e,t){return t=typeof t<"u"?t:E7.createFolders,e=Y7(e),this.files[e]||C7.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function J7(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var gZ={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,n,i;for(t in this.files)i=this.files[t],n=t.slice(this.root.length,t.length),n&&t.slice(0,this.root.length)===this.root&&e(n,i)},filter:function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(i)}),t},file:function(e,t,n){if(arguments.length===1)if(J7(e)){var i=e;return this.filter(function(a,o){return!o.dir&&i.test(a)})}else{var r=this.files[this.root+e];return r&&!r.dir?r:null}else e=this.root+e,C7.call(this,e,t,n);return this},folder:function(e){if(!e)return this;if(J7(e))return this.filter(function(r,a){return a.dir&&e.test(r)});var t=this.root+e,n=G7.call(this,t),i=this.clone();return i.root=n.name,i},remove:function(e){e=this.root+e;var t=this.files[e];if(t||(e.slice(-1)!=="/"&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var n=this.filter(function(r,a){return a.name.slice(0,e.length)===e}),i=0;i<n.length;i++)delete this.files[n[i].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,n={};try{if(n=Rs.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:dZ.utf8encode}),n.type=n.type.toLowerCase(),n.compression=n.compression.toUpperCase(),n.type==="binarystring"&&(n.type="string"),!n.type)throw new Error("No output type specified.");Rs.checkSupport(n.type),(n.platform==="darwin"||n.platform==="freebsd"||n.platform==="linux"||n.platform==="sunos")&&(n.platform="UNIX"),n.platform==="win32"&&(n.platform="DOS");var i=n.comment||this.comment||"";t=vZ.generateWorker(this,n,i)}catch(r){t=new U7("error"),t.error(r)}return new mZ(t,n.type||"string",n.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return e=e||{},e.type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};K7.exports=gZ});var xv=_((CE,Q7)=>{"use strict";var yZ=Ce();function A7(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}A7.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t=0,n;for(this.checkOffset(e),n=this.index+e-1;n>=this.index;n--)t=(t<<8)+this.byteAt(n);return this.index+=e,t},readString:function(e){return yZ.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(e&31)<<1))}};Q7.exports=A7});var wv=_((YE,$7)=>{"use strict";var _7=xv(),xZ=Ce();function Sa(e){_7.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}xZ.inherits(Sa,_7);Sa.prototype.byteAt=function(e){return this.data[this.zero+e]};Sa.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),n=e.charCodeAt(1),i=e.charCodeAt(2),r=e.charCodeAt(3),a=this.length-4;a>=0;--a)if(this.data[a]===t&&this.data[a+1]===n&&this.data[a+2]===i&&this.data[a+3]===r)return a-this.zero;return-1};Sa.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),i=e.charCodeAt(2),r=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&n===a[1]&&i===a[2]&&r===a[3]};Sa.prototype.readData=function(e){if(this.checkOffset(e),e===0)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};$7.exports=Sa});var nP=_((GE,tP)=>{"use strict";var eP=xv(),wZ=Ce();function Ta(e){eP.call(this,e)}wZ.inherits(Ta,eP);Ta.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)};Ta.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero};Ta.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t};Ta.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};tP.exports=Ta});var Pv=_((KE,iP)=>{"use strict";var rP=wv(),zZ=Ce();function zv(e){rP.call(this,e)}zZ.inherits(zv,rP);zv.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};iP.exports=zv});var sP=_((BE,oP)=>{"use strict";var aP=Pv(),PZ=Ce();function kv(e){aP.call(this,e)}PZ.inherits(kv,aP);kv.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};oP.exports=kv});var Ov=_((AE,cP)=>{"use strict";var hu=Ce(),lP=Kn(),kZ=wv(),OZ=nP(),SZ=sP(),TZ=Pv();cP.exports=function(e){var t=hu.getTypeOf(e);return hu.checkSupport(t),t==="string"&&!lP.uint8array?new OZ(e):t==="nodebuffer"?new SZ(e):lP.uint8array?new TZ(hu.transformTo("uint8array",e)):new kZ(hu.transformTo("array",e))}});var mP=_((QE,dP)=>{"use strict";var Sv=Ov(),Or=Ce(),XZ=Kc(),uP=Gc(),bu=da(),gu=bv(),jZ=Kn(),NZ=0,LZ=3,ZZ=function(e){for(var t in gu)if(Object.prototype.hasOwnProperty.call(gu,t)&&gu[t].magic===e)return gu[t];return null};function fP(e,t){this.options=e,this.loadOptions=t}fP.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(e){var t,n;if(e.skip(22),this.fileNameLength=e.readInt(2),n=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(n),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(t=ZZ(this.compressionMethod),t===null)throw new Error("Corrupted zip : compression "+Or.pretty(this.compressionMethod)+" unknown (inner file : "+Or.transformTo("string",this.fileName)+")");this.decompressed=new XZ(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),e===NZ&&(this.dosPermissions=this.externalFileAttributes&63),e===LZ&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=Sv(this.extraFields[1].value);this.uncompressedSize===Or.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===Or.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===Or.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===Or.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t=e.index+this.extraFieldsLength,n,i,r;for(this.extraFields||(this.extraFields={});e.index+4<t;)n=e.readInt(2),i=e.readInt(2),r=e.readData(i),this.extraFields[n]={id:n,length:i,value:r};e.setIndex(t)},handleUTF8:function(){var e=jZ.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=bu.utf8decode(this.fileName),this.fileCommentStr=bu.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var n=Or.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var i=this.findExtraFieldUnicodeComment();if(i!==null)this.fileCommentStr=i;else{var r=Or.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(r)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=Sv(e.value);return t.readInt(1)!==1||uP(this.fileName)!==t.readInt(4)?null:bu.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=Sv(e.value);return t.readInt(1)!==1||uP(this.fileComment)!==t.readInt(4)?null:bu.utf8decode(t.readData(e.length-5))}return null}};dP.exports=fP});var hP=_((_E,vP)=>{"use strict";var WZ=Ov(),er=Ce(),un=gv(),VZ=mP(),RZ=Kn();function pP(e){this.files=[],this.loadOptions=e}pP.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+er.pretty(t)+", expected "+er.pretty(e)+")")}},isSignature:function(e,t){var n=this.reader.index;this.reader.setIndex(e);var i=this.reader.readString(4),r=i===t;return this.reader.setIndex(n),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=RZ.uint8array?"uint8array":"array",n=er.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(n)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e=this.zip64EndOfCentralSize-44,t=0,n,i,r;t<e;)n=this.reader.readInt(2),i=this.reader.readInt(4),r=this.reader.readData(i),this.zip64ExtensibleData[n]={id:n,length:i,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(un.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(un.CENTRAL_FILE_HEADER);)e=new VZ({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(un.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,un.LOCAL_FILE_HEADER);throw t?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(e);var n=e;if(this.checkSignature(un.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===er.MAX_VALUE_16BITS||this.diskWithCentralDirStart===er.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===er.MAX_VALUE_16BITS||this.centralDirRecords===er.MAX_VALUE_16BITS||this.centralDirSize===er.MAX_VALUE_32BITS||this.centralDirOffset===er.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(un.ZIP64_CENTRAL_DIRECTORY_LOCATOR),e<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(un.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,un.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(un.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(un.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var r=n-i;if(r>0)this.isSignature(n,un.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=WZ(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};vP.exports=pP});var yP=_(($E,gP)=>{"use strict";var Tv=Ce(),yu=ca(),HZ=da(),FZ=hP(),MZ=Xp(),bP=us();function IZ(e){return new yu.Promise(function(t,n){var i=e.decompressed.getContentWorker().pipe(new MZ);i.on("error",function(r){n(r)}).on("end",function(){i.streamInfo.crc32!==e.decompressed.crc32?n(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}gP.exports=function(e,t){var n=this;return t=Tv.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:HZ.utf8decode}),bP.isNode&&bP.isStream(e)?yu.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):Tv.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(i){var r=new FZ(t);return r.load(i),r}).then(function(r){var a=[yu.Promise.resolve(r)],o=r.files;if(t.checkCRC32)for(var s=0;s<o.length;s++)a.push(IZ(o[s]));return yu.Promise.all(a)}).then(function(r){for(var a=r.shift(),o=a.files,s=0;s<o.length;s++){var c=o[s],l=c.fileNameStr,u=Tv.resolve(c.fileNameStr);n.file(u,c.decompressed,{binary:!0,optimizedBinaryString:!0,date:c.date,dir:c.dir,comment:c.fileCommentStr.length?c.fileCommentStr:null,unixPermissions:c.unixPermissions,dosPermissions:c.dosPermissions,createFolders:t.createFolders}),c.dir||(n.file(u).unsafeOriginalName=l)}return a.zipComment.length&&(n.comment=a.zipComment),n})}});var wP=_((eC,xP)=>{"use strict";function At(){if(!(this instanceof At))return new At;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new At;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}At.prototype=B7();At.prototype.loadAsync=yP();At.support=Kn();At.defaults=Op();At.version="3.10.1";At.loadAsync=function(e,t){return new At().loadAsync(e,t)};At.external=ca();xP.exports=At});function LS(e){return{path:e.path,resolution_w:e.resolution_w??null,resolution_h:e.resolution_h??null,codec:e.codec??null,container:e.container??null,fps:e.fps??null,bit_depth:e.bit_depth??null,reel:e.reel_name??null,timecode:e.timecode??null}}function dm(e,t,n,i,r){if(!(e>0&&t>0&&i>0&&r>0))return{baseW:i,baseH:r,kx:1,ky:1};let a=e/t,o=i/r,[s,c]=a>o?[1,a/o]:a<o?[o/a,1]:[1,1],l=Math.max(e/i,t/r)||1;return{baseW:e*n/l,baseH:t/l,kx:s,ky:c}}var vc=(e,{matches:t})=>{let n=e.media_references??[],i=[];for(let a of t){let o=n.find(C=>C.id===a.ref_id);if(!o)continue;let s=o.source_facts_origin??null,c={path:o.target_url??null,resolution_w:o.source_resolution_w??null,resolution_h:o.source_resolution_h??null,codec:o.codec??null,container:o.container??null,fps:o.source_fps??null,bit_depth:o.streams?.[0]?.bit_depth??null,reel:o.reel_name??null,timecode:o.source_timecode??null},l=o.metadata??={};l.pre_relink||(l.pre_relink={...c,pixel_aspect:o.source_pixel_aspect??null,facts_origin:o.source_facts_origin??null,available_range:o.available_range?JSON.parse(JSON.stringify(o.available_range)):null});let u=a.to;o.target_url=u.path,u.size_bytes!=null&&(o.size_bytes=u.size_bytes),u.resolution_w!=null&&(o.source_resolution_w=u.resolution_w),u.resolution_h!=null&&(o.source_resolution_h=u.resolution_h),u.codec!=null&&(o.codec=u.codec),u.container!=null&&(o.container=u.container),u.fps!=null&&(o.source_fps=u.fps),u.pixel_aspect!=null&&(o.source_pixel_aspect=u.pixel_aspect),u.bitrate_bps!=null&&(o.bitrate_bps=u.bitrate_bps),u.reel_name!=null&&(o.reel_name=u.reel_name),u.timecode!=null&&(o.source_timecode=u.timecode),u.local_path!=null&&(o.local_path=u.local_path),u.streams&&u.streams.length>0&&(o.streams=u.streams),(u.resolution_w!=null||u.timecode!=null||u.fps!=null||u.pixel_aspect!=null)&&(o.source_facts_origin="probed",o.codec=u.codec??null,u.streams&&u.streams.length>0||(o.streams=(o.streams??[]).map(C=>C.kind!=="video"?C:{...C,codec:u.codec??null,codec_specific:null,...u.resolution_w!=null?{width:u.resolution_w}:{},...u.resolution_h!=null?{height:u.resolution_h}:{},...u.fps!=null?{rate:u.fps}:{}}))),u.vendor_metadata&&Object.keys(u.vendor_metadata).length>0&&(o.vendor_metadata={...o.vendor_metadata??{},...u.vendor_metadata}),u.reel_sources&&(o.reel_sources={...o.reel_sources??{},...u.reel_sources}),u.recipe!==void 0&&(o.recipe=u.recipe);let f=u.fps??null,m=u.recipe&&"frame_count"in u.recipe?u.recipe.frame_count:u.frame_count??null,d=m??null,p=f??o.source_fps??null;d!=null&&p?o.available_range={start:{value:0,rate:p},duration:{value:d,rate:p}}:u.keep_range_if_unknown||(o.available_range=null);let v=o.raw_extraction;v&&"proxyResolution"in v&&delete v.proxyResolution;let h=c.resolution_w,b=c.resolution_h,g=u.resolution_w??null,y=u.resolution_h??null,x=u.pixel_aspect??o.source_pixel_aspect??1,z=h!=null&&b!=null&&g!=null&&y!=null&&h*y!==g*b,S=g!=null&&y!=null,P=[];for(let C of e.timelines??[]){let R=C.resolution_w??0,E=C.resolution_h??0;for(let Y of C.tracks??[])for(let K of Y.items??[])if(K.media_reference_id===a.ref_id&&K.source_range){if(P.push({it:K}),z){let I=dm(h,b,1,R,E),te=dm(g,y,x,R,E),H=I.kx!==0?te.kx/I.kx:1,M=I.ky!==0?te.ky/I.ky:1;typeof K.position_x=="number"&&(K.position_x*=H),typeof K.position_y=="number"&&(K.position_y*=M);for(let W of K.keyframes??[])if(W.parameter_path==="position"&&Array.isArray(W.value)){let D=W.value;typeof D[0]=="number"&&(D[0]*=H),typeof D[1]=="number"&&(D[1]*=M)}}if(S){let I=dm(g,y,x,R,E);K.render_base_w=I.baseW,K.render_base_h=I.baseH,K.render_pos_div_x=I.kx,K.render_pos_div_y=I.ky}}}let T="linked",j,X=!1,w=u.path.split(/[/\\]/).pop()??u.path,N=()=>{let C=P.find(({it:R})=>(R.source_range.duration?.value??0)>d);if(C){T="unbound",X=!0,j=`cut duration ${C.it.source_range.duration?.value??0}f exceeds linked media ${w} extent ${d}f`;return}for(let{it:R}of P){let E=R.source_range.duration?.value??0,Y=R.source_range.start.value;if(Y<0||Y+E>d){let K=Math.max(0,Math.floor((d-E)/2));R.source_range={...R.source_range,start:{...R.source_range.start,value:K}};let I=R.raw_extraction??(R.raw_extraction={});I.sourceConformedToMedia=!0}}};if(dc(o))o.content_kind==null&&(o.content_kind="still");else if(d==null)T="unbound",j=`matched ${w} by name but not probed \u2014 coverage unverified`;else if(c.timecode&&u.timecode!=null){let C=u.fps??c.fps??0,R=C>0?Oe(c.timecode,C):null,E=C>0?Oe(u.timecode,C):null;if(R==null||E==null)T="unbound",j=`could not verify ${w} timecode placement \u2014 coverage unverified`;else{let Y=R-E,K=P.find(({it:I})=>{let te=I.source_range.start.value+Y,H=I.source_range.duration?.value??0;return te<0||te+H>d});if(K)if(s!=="probed"&&R===0)N();else{T="unbound",X=!0;let te=K.it.source_range.start.value+Y,H=K.it.source_range.duration?.value??0;j=`cut [${te}..${te+H}] not within linked media ${w} [0..${d}] (source TC ${c.timecode} \u2192 ${u.timecode})`}else if(Y!==0)for(let{it:I}of P){let te=I.source_range.start.rate||1;I.source_range={...I.source_range,start:{...I.source_range.start,value:I.source_range.start.value+Y}};for(let M of I.keyframes??[])if(!(!M.time||typeof M.time.value!="number"))if(M.parameter_path==="speed"){let W=Y/te;if(M.time.value===0&&M.value===0)continue;M.time={...M.time,value:Math.max(0,M.time.value+W)},typeof M.value=="number"&&(M.value=Math.max(0,M.value+W))}else{let W=M.time.rate||te;M.time={...M.time,value:Math.max(0,M.time.value+Y*(W/te))}}let H=I.raw_extraction??(I.raw_extraction={});typeof H.alternateFrame=="number"&&(H.alternateFrame=E),H.sourceConformedToMedia=!0}}}else N();o.binding_state=T;let F;j?(o.coverage_reason=j,X&&(F=j)):delete o.coverage_reason,i.push({ref_id:a.ref_id,confidence:a.confidence,reasons:a.reasons??[],before:c,after:LS(u),...F?{warning:F}:{}})}let r=i.filter(a=>a.warning).length;return{summary:`Relinked ${i.length} reference${i.length===1?"":"s"}`+(r?` \xB7 ${r} unresolved (cut not covered)`:""),meta:{applied:i}}};function qn(e,t){return e.timelines?.find(n=>n.id===t)}function Qi(e,t,n){let i=qn(e,t);if(i)for(let r of i.tracks??[]){let a=(r.items??[]).findIndex(o=>o.id===n);if(a!==-1)return{timeline:i,track:r,item:r.items[a],index:a}}}function Dn(e){(e.items??[]).forEach((t,n)=>{t.item_index=n})}function Nt(e){let t=0;for(let n of e.tracks??[])for(let i of n.items??[])t=Math.max(t,i.timeline_range.start.value+i.timeline_range.duration.value);e.duration_frames=t}function Yo(e,t){let n=new Set;for(let r of e.timelines??[])for(let a of r.tracks??[]){n.add(a.id);for(let o of a.items??[])n.add(o.id)}for(let r of e.media_references??[])n.add(r.id);let i=1;for(;n.has(`${t}-${i}`);)i++;return`${t}-${i}`}function A3(e){let t=e.timeline_range.start.value;return[t,t+e.timeline_range.duration.value]}function ZS(e,t,n,i){return n>t?(e.items??[]).filter(r=>{if(i&&r.id===i)return!1;let[a,o]=A3(r);return a<n&&t<o}):[]}function pr(e,t,n,i,r){let a={removed:0,trimmed:0,split:0},o=ZS(t,n,i,r);if(o.length===0)return a;let s=new Set,c=[];for(let l of o){let[u,f]=A3(l);if(l.kind==="transition"||u>=n&&f<=i){s.add(l),a.removed++;continue}if(u<n&&f>i){let m=structuredClone(l);m.id=Yo(e,"ov-it"),m.timeline_range.start.value=i,m.timeline_range.duration.value=f-i,m.source_range&&(m.source_range.start.value+=i-u,m.source_range.duration.value=f-i),c.push(m),l.timeline_range.duration.value=n-u,l.source_range&&(l.source_range.duration.value=n-u),a.split++;continue}if(u<n)l.timeline_range.duration.value=n-u,l.source_range&&(l.source_range.duration.value=n-u);else{let m=i-u;l.timeline_range.start.value=i,l.timeline_range.duration.value=f-i,l.source_range&&(l.source_range.start.value+=m,l.source_range.duration.value=f-i)}a.trimmed++}return(s.size||c.length)&&(t.items=[...(t.items??[]).filter(l=>!s.has(l)),...c]),(t.items??=[]).sort((l,u)=>l.timeline_range.start.value-u.timeline_range.start.value),Dn(t),a}function _i(e){let t=[];return e.removed&&t.push(`${e.removed} overwritten`),e.trimmed&&t.push(`${e.trimmed} trimmed`),e.split&&t.push(`${e.split} split`),t.length?` \xB7 ${t.join(", ")}`:""}var hc={head:null,tail:null};function WS(e,t){if(!t?.start||!t.duration||!e||e.content_kind==="still")return hc;let n=e.available_range,i=n?.duration?.value;if(!n||typeof i!="number"||!(i>1))return hc;let r=n.start?.value??0,a=r+i,o=t.start.value,s=o+t.duration.value;return{head:Math.max(0,Math.round(o-r)),tail:Math.max(0,Math.round(a-s))}}function mm(e,t){if(!t.media_reference_id)return hc;let n=(e.media_references??[]).find(i=>i.id===t.media_reference_id);return WS(n,t.source_range)}function VS(e,t,n,i,r={}){let a=Math.round(t),o=Math.max(0,n-1);if(e==="in"){let c=[i.head,r.startFrame,r.sourceStart].filter(u=>typeof u=="number").map(u=>-Math.max(0,u)),l=c.length?Math.max(...c):-1/0;return Math.min(o,Math.max(l,a))}let s=i.tail==null?1/0:i.tail;return Math.max(-o,Math.min(s,a))}function RS(e,t,n,i,r){return(e==="in"?t<0:t>0)?e==="out"?"there is no media after its out point":r<=0?"it already starts at the head of the timeline":"there is no media before its in point":n<=1?"it is already one frame long":"it cannot get any shorter"}var Q3=(e,{timeline_id:t,item_id:n,edge:i,delta_frames:r,ripple:a})=>{let o=qn(e,t);if(!o)return{summary:"Trim: timeline not found"};for(let s of o.tracks??[]){let c=(s.items??[]).find(x=>x.id===n);if(!c)continue;let l=c.timeline_range,u=c.source_range,f=c.name??"clip",m=l.start.value,d=m+l.duration.value,p=mm(e,c),v=Math.round(Number(r)||0),h=VS(i,v,l.duration.value,p,{startFrame:m,sourceStart:u?.start.value});if(h===0)return{summary:v===0?`Trim: "${f}" \u2014 no change`:`Trim: "${f}" won't move \u2014 ${RS(i,v,l.duration.value,p,m)}`,meta:{timeline_id:t,item_id:n,edge:i,delta_frames:0,asked:v,clamped:v!==0}};let b=0;if(i==="out"?(l.duration.value+=h,u&&(u.duration.value+=h),b=h):(l.start.value+=h,l.duration.value-=h,u&&(u.start.value+=h,u.duration.value-=h),b=-h),a&&b!==0)for(let x of s.items)x.id!==c.id&&x.timeline_range.start.value>=d&&(x.timeline_range.start.value+=b);let g={removed:0,trimmed:0,split:0};i==="in"&&h<0?g=pr(e,s,l.start.value,m,c.id):i==="out"&&h>0&&!a&&(g=pr(e,s,d,l.start.value+l.duration.value,c.id)),Nt(o);let y=h>0?"+":"";return{summary:`Trimmed ${i} of "${f}" by ${y}${h}f`+(a?" (rippled)":"")+(h!==v?" (limited by the media)":"")+_i(g),meta:{timeline_id:t,item_id:n,edge:i,delta_frames:h,asked:v,clamped:h!==v,ripple:!!a,cleared:g}}}return{summary:"Trim: item not found"}};var _3=(e,{timeline_id:t,item_id:n,delta_frames:i})=>{let r=Qi(e,t,n);if(!r)return{summary:"Slip: item not found"};let{item:a}=r;if(!a.source_range)return{summary:"Slip: clip has no source range"};let{head:o,tail:s}=mm(e,a),c=Math.round(Number(i)||0),l=s??1/0,u=o==null?-a.source_range.start.value:-o,f=Math.max(u,Math.min(l,c)),m=Math.max(0,a.source_range.start.value+f),d=m-a.source_range.start.value;if(a.source_range.start.value=m,d===0)return{summary:c===0?`Slip: "${a.name??"clip"}" \u2014 no change`:`Slip: "${a.name??"clip"}" is already at the ${c>0?"end":"start"} of its media`,meta:{timeline_id:t,item_id:n,delta_frames:0,asked:c,clamped:c!==0}};let p=d>0?"+":"";return{summary:`Slipped "${a.name??"clip"}" ${p}${d}f`+(d!==c?" (limited by the media)":""),meta:{timeline_id:t,item_id:n,delta_frames:d,asked:c,clamped:d!==c}}};var $3=(e,{timeline_id:t,item_id:n,item_ids:i,ripple:r})=>{let a=qn(e,t);if(!a)return{summary:"Delete: timeline not found"};let o=[...new Set([...i??[],...n?[n]:[]])];if(!o.length)return{summary:"Delete: give item_id or item_ids"};let s=(a.tracks??[]).flatMap(f=>(f.items??[]).filter(m=>o.includes(m.id)).map(m=>({track:f,item:m}))).sort((f,m)=>m.item.timeline_range.start.value-f.item.timeline_range.start.value);for(let{track:f,item:m}of s){let d=m.timeline_range.start.value,p=m.timeline_range.duration.value;if(f.items.splice(f.items.indexOf(m),1),r)for(let v of f.items)v.timeline_range.start.value>=d&&(v.timeline_range.start.value-=p)}for(let f of new Set(s.map(m=>m.track)))Dn(f);Nt(a);let c=new Set(s.map(f=>f.item.id)),l=o.filter(f=>!c.has(f));return s.length?{summary:`Deleted ${s.length===1?`"${s[0].item.name??"clip"}"`:`${s.length} clips`}${r?" (rippled)":""}${l.length?`; not found: ${l.slice(0,10).join(", ")}${l.length>10?` (+${l.length-10})`:""}`:""}`,meta:{timeline_id:t,...n&&!i?{item_id:n}:{deleted:s.length},...l.length?{missing:l}:{},ripple:!!r}}:{summary:"Delete: item not found",meta:{timeline_id:t,missing:l}}};function bc(e){return e==="fit"||e==="fill"||e==="stretch"||e==="none"}var HS=.005;function FS(e,t,n,i){if(e<=0||t<=0||n<=0||i<=0)return!1;let r=e/t,a=n/i;return Math.abs(r-a)/Math.max(r,a)<=HS}function vm(e,t,n,i,r){let a=i,o=r;if(!e||!t||e<=0||t<=0||a<=0||o<=0)return[a,o,1,1];let s=e,c=t,l=s/c,u=a/o,f=1,m=1;l>u?m=l/u:l<u&&(f=u/l);let d=Math.max(s/a,c/o);return d>0||(d=1),[s*n/d,c/d,f,m]}function hm(e,t,n,i){let r=Math.max(e/n,t/i);return r>0?r:1}function ez(e,t,n,i){let r=e/n,a=t/i,o=Math.max(r,a),s=Math.min(r,a);return s>0?o/s:1}function Go(e,t){return`${e}\xD7${t}`}function MS(e,t){for(let n of e.tracks??[])if(n.kind==="Video"){for(let i of n.items??[])if(tz(i)&&(i.reframe_fit??"fit")!==t)return!0}return!1}function tz(e){let t=e.kind??"clip";return t==="clip"||t==="nested"}function nz(e,t,n,i){return e/n<t/i?"x":"y"}function IS(e,t,n,i,r){let a=e.reframe_fit;if(!a||a==="fit")return;let o=a==="none"?hm(t,n,i,r):ez(t,n,i,r);o!==1&&(a==="fill"||a==="none"?(e.scale!=null&&(e.scale=e.scale/o),e.raw_scale!=null&&(e.raw_scale=e.raw_scale/o)):a==="stretch"&&(nz(t,n,i,r)==="x"?e.scale_x!=null&&(e.scale_x=e.scale_x/o):e.scale_y!=null&&(e.scale_y=e.scale_y/o)))}function rz(e,t,n,i,r,a){if(!n||!i||n<=0||i<=0){e.reframe_fit=t;return}iz(e,t,n,i,r,a)}function iz(e,t,n,i,r,a){if(e.reframe_fit=t,t==="fit")return;if(t==="none"){let s=hm(n,i,r,a);if(s===1)return;e.scale=(e.scale??100)*s,e.raw_scale!=null&&(e.raw_scale=e.raw_scale*s);return}let o=ez(n,i,r,a);if(o!==1)if(t==="fill")e.scale=(e.scale??100)*o,e.raw_scale!=null&&(e.raw_scale=e.raw_scale*o);else{let s=e.scale??100;nz(n,i,r,a)==="x"?e.scale_x=(e.scale_x??s)*o:e.scale_y=(e.scale_y??s)*o}}function pm(e,t,n,i,r,a,o){let s=0;for(let c of e.tracks??[])if(c.kind==="Video")for(let l of c.items??[]){if(!tz(l))continue;let{w:u,h:f,par:m}=t(l),d=!!u&&!!f&&u>0&&f>0;d&&o!=null&&IS(l,u,f,r,a);let[p,v,h,b]=vm(u,f,m,n,i);l.render_base_w=p,l.render_base_h=v,l.render_pos_div_x=h,l.render_pos_div_y=b,l.raw_scale!=null&&d&&(l.raw_scale=(l.scale??100)/hm(u,f,n,i)),d&&o!=null&&iz(l,o,u,f,n,i),s++}return o!=null&&(e.mismatch_policy=o),s}var az=(e,t)=>{let n=Math.round(Number(t?.resolution_w)),i=Math.round(Number(t?.resolution_h));if(!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0)return{summary:"Reformat: resolution must be two positive numbers"};if(n%2!==0||i%2!==0)return{summary:`Reformat: ${Go(n,i)} \u2014 dimensions must be even`};let r=t?.fit??null;if(r!=null&&!bc(r))return{summary:`Reformat: unknown fit policy "${r}"`};let a=new Map;for(let g of e.media_references??[])g.id&&a.set(g.id,g);let o=g=>{let y=g.media_reference_id?a.get(g.media_reference_id):void 0,x=g.pixel_aspect_ratio??y?.source_pixel_aspect??1;return{w:y?.source_resolution_w??null,h:y?.source_resolution_h??null,par:x>0?x:1}},s=e.timelines??[],c;if(t.timeline_id&&t.timeline_id!=="*"){let g=qn(e,t.timeline_id);if(!g)return{summary:"Reformat: timeline not found"};c=[g]}else c=s;if(c.length===0)return{summary:"Reformat: no timelines in this session"};let l=[],u=[],f=0,m=!1,d=!1;for(let g of c){let y=g.resolution_w,x=g.resolution_h;if(y==null||x==null||y<=0||x<=0){g.resolution_w=n,g.resolution_h=i,f+=pm(g,o,n,i,n,i,r),l.push(g.id);continue}if(y===n&&x===i){let S=r!=null&&MS(g,r),P=r!=null&&(g.mismatch_policy??"fit")!==r;if(S||P){S?f+=pm(g,o,n,i,y,x,r):r!=null&&(g.mismatch_policy=r),l.push(g.id),d=!0;continue}u.push({timeline_id:g.id,name:g.name??null,reason:`already ${Go(n,i)}`});continue}let z=!FS(y,x,n,i);if(z&&r==null){u.push({timeline_id:g.id,name:g.name??null,reason:`${Go(y,x)} \u2192 ${Go(n,i)} changes the aspect ratio \u2014 choose fit (bars), fill (crop), stretch (distort) or none (native pixels)`});continue}g.resolution_w=n,g.resolution_h=i,f+=pm(g,o,n,i,y,x,r),l.push(g.id),z&&(m=!0)}let p=l.length,v=f>0?` \xB7 ${f} clip${f===1?"":"s"}`:"",h=u.length>0?` \xB7 ${u.length} skipped`:"";return{summary:p===0?`Reformat: nothing changed \u2014 ${u[0]?.reason??"no eligible timeline"}`:d&&!m?`Reframed ${p} timeline${p===1?"":"s"} to ${r}${v}${h}`:`Reformatted ${p} timeline${p===1?"":"s"} to ${Go(n,i)}`+(m&&r?` (${r})`:"")+(v?`${v} re-based`:"")+h,meta:{resolution_w:n,resolution_h:i,fit:r??void 0,changed:l,skipped:u,clips_rebased:f,reframe_only:d}}};var qS=[{label:"23.976",num:24e3,den:1001},{label:"24",num:24,den:1},{label:"25",num:25,den:1},{label:"29.97",num:3e4,den:1001},{label:"30",num:30,den:1},{label:"48",num:48,den:1},{label:"50",num:50,den:1},{label:"59.94",num:6e4,den:1001},{label:"60",num:60,den:1}],oz=[...qS,{label:"47.952",num:48e3,den:1001},{label:"119.88",num:12e4,den:1001},{label:"120",num:120,den:1}];function Dq(e){if(e==null||!Number.isFinite(e)||e<=0)return null;let t=null,n=1/0;for(let i of oz){let r=Math.abs(i.num/i.den-e);r<n&&r<=e*.005&&(t={num:i.num,den:i.den},n=r)}return t||(Number.isInteger(e)?{num:e,den:1}:{num:Math.round(e*1e3),den:1e3})}function gc(e,t){if(!(t>0))return"\u2014";let n=oz.find(r=>r.num===e&&r.den===t);if(n)return n.label;let i=e/t;return Number.isInteger(i)?String(i):i.toFixed(3).replace(/0+$/,"").replace(/\.$/,"")}function bm(e){return e==null||!Number.isFinite(e)?"?":gc(e,1)}function _e(e){let t=e.fps_num??0;if(t>0)return t/((e.fps_den??0)>0?e.fps_den:1);for(let n of e.tracks??[])for(let i of n.items??[]){let r=i.timeline_range?.start?.rate;if(r&&r>0)return r}return 24}var cz="conform.stringout",sz=(e,t)=>({value:e,rate:t}),lz=(e,t,n)=>({start:sz(e,n),duration:sz(t,n)});function yc(e){return e.generated_by===cz}function DS(e){let t=e?.available_range;if(!t)return null;let n=t.start?.value,i=t.duration?.value;return typeof n!="number"||typeof i!="number"||i<=0?null:{start:n,duration:i}}function JS(e,t,n,i){let r=e.source_range,a=DS(t);if(n==="full")return a||(r?{start:r.start.value,duration:r.duration.value}:null);if(!r||!(r.duration.value>0))return null;let o=r.start.value,s=r.duration.value;if(n==="handles"&&i>0){let c=o-i,l=o+s+i;a?(c=Math.max(a.start,c),l=Math.min(a.start+a.duration,l)):c=Math.max(0,c),o=c,s=Math.max(1,l-c)}return{start:o,duration:s}}function US(e,t,n){let i=new Map;for(let u of e.media_references??[])u.id&&i.set(u.id,u);let r=(e.timelines??[]).filter(u=>!yc(u)),a=r[0],o=a?_e(a):24,s=[],c=0,l=0;for(let u of r)for(let f of u.tracks??[])if(f.kind==="Video")for(let m of f.items??[]){if(m.kind!=="clip"||m.enabled===!1)continue;let d=m.media_reference_id?i.get(m.media_reference_id):void 0,p=d?.source_resolution_w,v=d?.source_resolution_h;if(!p||!v||p<=0||v<=0){l++;continue}let h=JS(m,d,t,n);if(!h){c++;continue}let b=m.source_range,g=b?.duration?.rate||b?.start?.rate||d?.available_range?.duration?.rate||o,y=m.pixel_aspect_ratio??d?.source_pixel_aspect??1;s.push({item:m,mrefId:m.media_reference_id??null,w:p,h:v,par:y>0?y:1,start:h.start,duration:h.duration,rate:g,name:m.name,reel:m.reel_name??null})}return{shots:s,fallbackRate:o,noRange:c,noRaster:l}}function ES(e,t){let n=new Set,i=[];for(let r of e){let a=t==="full"?`m:${r.mrefId??r.item.id}`:`m:${r.mrefId??r.item.id}|${r.start}|${r.duration}`;n.has(a)||(n.add(a),i.push(r))}return i}var uz=(e,t)=>{let n=t?.extent??"cut";if(n!=="cut"&&n!=="handles"&&n!=="full")return{summary:`Stringout: unknown extent "${n}"`};let i=n==="handles"?Math.max(0,Math.round(t?.handles??24)):0,r=(t?.name_prefix??"STRINGOUT").trim()||"STRINGOUT",{shots:a,fallbackRate:o,noRange:s,noRaster:c}=US(e,n,i),l=ES(a,n);if(l.length===0)return{summary:c>0?`Stringout: no clip has a probed resolution to group by (${c} unprobed)`:"Stringout: no clips with a usable range in this session"};let u=new Map;for(let P of l){let T=`${P.w}x${P.h}`,j=u.get(T);j?j.push(P):u.set(T,[P])}let f=[...u.entries()].sort((P,T)=>{let[j,X]=P[0].split("x").map(Number),[w,N]=T[0].split("x").map(Number);return w*N-j*X||w-j||N-X}),m=(e.timelines??[]).filter(P=>!yc(P)),d=m[0]?.fps_num??Math.round(o*1e3),p=m[0]?.fps_den??1e3,v=p?d/p:o,h=0,b=P=>`so-${P}-${++h}`,g=[],y=(e.timelines??[]).length;for(let[,P]of f){let{w:T,h:j,par:X}=P[0],w=b("tl"),N=`${r} ${T}\xD7${j}${X!==1?` PAR ${CS(X)}`:""}`,F=[],C=0;P.forEach((E,Y)=>{F.push({id:b("it"),kind:"clip",item_index:Y,name:E.name,enabled:!0,timeline_range:lz(C,E.duration,v),source_range:lz(E.start,E.duration,E.rate||v),media_reference_id:E.mrefId,reel_name:E.reel,pixel_aspect_ratio:E.par,scale:100,position_x:0,position_y:0,rotation:0,crop_left:0,crop_right:0,crop_top:0,crop_bottom:0,render_base_w:T*E.par,render_base_h:j,render_pos_div_x:1,render_pos_div_y:1,keyframes:[],effects:[]}),C+=E.duration});let R={id:b("tr"),kind:"Video",track_index:0,name:"V1",enabled:!0,items:F};(e.timelines??=[]).push({id:w,name:N,kind:"primary",timeline_index:y++,fps_num:d,fps_den:p,resolution_w:T,resolution_h:j,pixel_aspect_ratio:X,start_frame:0,is_drop_frame:m[0]?.is_drop_frame??!1,duration_frames:C,tracks:[R],markers:[],generated_by:cz}),g.push({id:w,name:N,w:T,h:j,clips:P.length})}let x=a.length-l.length,z=n==="handles"?`handles \xB1${i}f`:n;return{summary:`Strung out ${l.length} clip${l.length===1?"":"s"} into ${g.length} reel${g.length===1?"":"s"} by resolution (${g.map(P=>`${P.w}\xD7${P.h}\xD7${P.clips}`).join(", ")}) \xB7 ${z}`+(x>0?` \xB7 ${x} duplicate${x===1?"":"s"} collapsed`:"")+(c>0?` \xB7 ${c} unprobed skipped`:"")+(s>0?` \xB7 ${s} skipped (no range)`:""),meta:{timelines:g,clips:l.length,extent:n,handles:i,duplicates_collapsed:x,skipped_no_raster:c,skipped_no_range:s}}};function CS(e){return Math.round(e*1e4)/1e4}var YS=["position","scale","rotation"];function xc(e,t){return t.length===0?[e,e]:[Math.min(...t),Math.max(...t)]}var GS={"anchor-or-flip":"off-centre anchor",nested:"compound clip",retimed:"retimed",cropped:"cropped","mixed-format":"mixed-format conform sizing",revealing:"zooms out or repositions past the frame",transition:"animated under a transition"};function KS(e,t){let n=new Map;for(let W of e.keyframes??[]){let D=W.parameter_path??"";if(!YS.some(oe=>D===oe||D.startsWith(oe+".")))continue;let ae=n.get(D)??[];ae.push(W.value),n.set(D,ae)}let i=W=>{let D=n.get(W);if(!D||D.length===0)return!1;let ae=JSON.stringify(D[0]);return D.some(oe=>JSON.stringify(oe)!==ae)},r=[...n.keys()].some(i),a=W=>typeof W=="number"?W:null,o=(W,D)=>(n.get(W)??[]).map(ae=>D?D(ae):a(ae)).filter(ae=>ae!=null),s=[...o("position",W=>Array.isArray(W)?a(W[0]):null),...o("position.x")],c=[...o("position",W=>Array.isArray(W)?a(W[1]):null),...o("position.y")],l=o("scale"),u=o("rotation"),f=e.position_x??0,m=e.position_y??0,d=e.scale??100,p=e.scale_x??null,v=e.scale_y??null,h=e.rotation??0,b=e;if(!(r||b.flip_horizontal===!0||b.flip_vertical===!0||Math.abs(f)>1e-9||Math.abs(m)>1e-9||Math.abs(d-100)>1e-9||p!=null&&Math.abs(p-d)>1e-9||v!=null&&Math.abs(v-d)>1e-9||Math.abs(h)>1e-9||s.some(W=>Math.abs(W)>1e-9)||c.some(W=>Math.abs(W)>1e-9)||l.some(W=>Math.abs(W-100)>1e-9)||u.some(W=>Math.abs(W)>1e-9)))return{verdict:"none"};let y=Math.abs(e.anchor_x??0)>1e-9||Math.abs(e.anchor_y??0)>1e-9,x=e;if(y)return{verdict:"kept",reason:"anchor-or-flip"};if(e.kind==="nested")return{verdict:"kept",reason:"nested"};if((x.speed!=null&&Math.abs(x.speed-100)>1e-9||x.speed_reverse===!0||x.speed_ramped===!0)&&(r||x.speed_ramped===!0))return{verdict:"kept",reason:"retimed"};if(r&&t?.transitionOverlap)return{verdict:"kept",reason:"transition"};if([e.crop_left,e.crop_right,e.crop_top,e.crop_bottom].some(W=>Math.abs(W??0)>1e-9)||(e.keyframes??[]).some(W=>(W.parameter_path??"").startsWith("crop")&&Math.abs(a(W.value)??0)>1e-9))return{verdict:"kept",reason:"cropped"};if(t){let W=t.sourcePar??1;if(Math.abs(W-1)>1e-4)return{verdict:"kept",reason:"mixed-format"};let D=t.sourceW??0,ae=t.sourceH??0;if(D>0&&ae>0&&Math.abs(D/ae-t.frameAr)/t.frameAr>.005)return{verdict:"kept",reason:"mixed-format"}}let P=t?.frameAr??16/9,[T]=xc(d,l),[j,X]=xc(f,s),[w,N]=xc(m,c),[F,C]=xc(h,u),R=Math.max(Math.abs(j),Math.abs(X)),E=Math.max(Math.abs(w),Math.abs(N)),K=Math.max(Math.abs(F),Math.abs(C))*Math.PI/180,I=Math.cos(K)+P*Math.sin(K),te=(p!=null&&l.length===0?p:T)/100,H=(v!=null&&l.length===0?v:T)/100;return te>=I+2*R-1e-6&&H>=I+2*E-1e-6||(t?.surface??"node")!=="input"?{verdict:"moves"}:{verdict:"kept",reason:"revealing"}}function BS(e,t){let n=e.timeline_range;if(!n)return!1;let i=n.start.value,r=n.start.value+n.duration.value;return(t.items??[]).some(a=>{if(a.kind!=="transition"||!a.timeline_range)return!1;let o=a.timeline_range.start.value,s=a.timeline_range.start.value+a.timeline_range.duration.value;return o<r&&s>i})}function AS(e,t,n="node"){let i=new Map((t?.media_references??[]).map(c=>[c.id,c])),r=(e.resolution_w||1920)/(e.resolution_h||1080),a=0,o=0,s={};for(let c of e.tracks??[])if(c.kind==="Video")for(let l of c.items??[]){if(l.kind!=="clip"&&l.kind!=="nested")continue;let u=l.media_reference_id?i.get(l.media_reference_id):void 0,f=KS(l,{frameAr:r,sourceW:u?.source_resolution_w,sourceH:u?.source_resolution_h,sourcePar:u?.source_pixel_aspect,transitionOverlap:BS(l,c),surface:n});f.verdict==="moves"?a++:f.verdict==="kept"&&(o++,f.reason&&(s[f.reason]=(s[f.reason]??0)+1))}return{moves:a,kept:o,reasons:s}}var fz=(e,t)=>{let n=t?.surface==="edit"?"edit":"node",i=t?.timeline_id,r=(e.timelines??[]).filter(u=>!i||i==="*"||u.id===i);if(r.length===0)return{summary:"No matching timeline"};let a=0,o=0,s={};for(let u of r){u.sizing_surface=n;let f=AS(u,e);a+=f.moves,o+=f.kept;for(let[m,d]of Object.entries(f.reasons)){let p=m;s[p]=(s[p]??0)+(d??0)}}let c=Object.entries(s).sort((u,f)=>(f[1]??0)-(u[1]??0)).map(([u,f])=>`${f} ${GS[u]}`).join(" \xB7 ");if(n==="edit")return{summary:"Sizing back on the edit page \u2014 the next Resolve export keeps clip transforms in the inspector",meta:{surface:n,moves:a,kept:o,reasons:s,timelines:r.length}};let l=[`${a} clip${a===1?"":"s"} move to the color page in the next Resolve export`];return o>0&&l.push(`${o} stay on the edit page (${c})`),a===0&&o===0&&(l[0]="No clip transforms to move \u2014 the flag is set for anything added later"),{summary:l.join(" \xB7 "),meta:{surface:n,moves:a,kept:o,reasons:s,timelines:r.length}}};var dz=(e,t)=>({value:e,rate:t}),wc=(e,t,n)=>({start:dz(e,n),duration:dz(t,n)});function QS(e){let t=e.streams??[];return t.length?t.some(n=>n.kind==="video"):e.content_kind!=="audio"}function _S(e){let t=e.streams??[];return t.length?t.some(n=>n.kind==="audio"):e.content_kind==="audio"||e.content_kind==="video_audio"}function $S(e){return(e.streams??[]).find(t=>t.kind==="audio")?.channels??null}function mz(e,t,n){let i=[...t.tracks??[]].reverse().find(o=>o.kind===n);if(i)return i;let r=(t.tracks??[]).filter(o=>o.kind===n).length,a={id:Yo(e,"ac-tr"),kind:n,track_index:r,name:`${n==="Video"?"V":"A"}${r+1}`,enabled:!0,items:[]};return(t.tracks??=[]).push(a),a}function gm(e){return e.display_name?e.display_name:(e.target_url??"").split("/").pop()||e.id}var pz=(e,t)=>{let n=(e.timelines??[]).find(j=>j.id===t.timeline_id);if(!n)return{summary:"Add clip: timeline not found"};let i=(e.media_references??[]).find(j=>j.id===t.media_reference_id);if(!i){if(!t.media_reference||t.media_reference.id!==t.media_reference_id)return{summary:"Add clip: media reference not in session and none supplied"};(e.media_references??=[]).push(t.media_reference),i=t.media_reference}let r=_e(n),a=i.available_range,o=a?.duration?.rate||a?.start?.rate||r,s=t.source_start??a?.start?.value??0,c=Math.max(1,Math.round(t.source_duration??a?.duration?.value??r)),l=QS(i),u=!t.without_audio&&_S(i),f=l?"Video":"Audio",m=t.track_id?(n.tracks??[]).find(j=>j.id===t.track_id):null;if(t.track_id&&!m)return{summary:"Add clip: track not found"};if(m&&m.kind!==f)return{summary:`Add clip: ${m.name??m.id} is a ${m.kind} track`};let d=m??mz(e,n,f),p=0;for(let j of d.items??[]){let X=j.timeline_range.start.value+j.timeline_range.duration.value;X>p&&(p=X)}typeof t.at_frame=="number"&&Number.isFinite(t.at_frame)&&(p=Math.max(0,Math.round(t.at_frame)));let v=pr(e,d,p,p+c),h=i.source_pixel_aspect??1,[b,g,y,x]=vm(i.source_resolution_w,i.source_resolution_h,h,n.resolution_w??0,n.resolution_h??0),z=bc(t.fit)?t.fit:bc(n.mismatch_policy)?n.mismatch_policy:"fit",S={id:Yo(e,"ac-it"),kind:"clip",item_index:(d.items??[]).length,name:gm(i),enabled:!0,timeline_range:wc(p,c,r),source_range:wc(s,c,o),media_reference_id:i.id,reel_name:i.reel_name??null,pixel_aspect_ratio:h,scale:100,position_x:0,position_y:0,rotation:0,crop_left:0,crop_right:0,crop_top:0,crop_bottom:0,render_base_w:b,render_base_h:g,render_pos_div_x:y,render_pos_div_y:x,keyframes:[],effects:[]};rz(S,z,i.source_resolution_w,i.source_resolution_h,n.resolution_w??0,n.resolution_h??0),(d.items??=[]).push(S),d.items.sort((j,X)=>j.timeline_range.start.value-X.timeline_range.start.value),Dn(d);let P=null;if(u&&l){let j=mz(e,n,"Audio");j.audio_channel_count==null&&(j.audio_channel_count=$S(i)),pr(e,j,p,p+c);let X={id:Yo(e,"ac-it"),kind:"clip",item_index:(j.items??[]).length,name:gm(i),enabled:!0,timeline_range:wc(p,c,r),source_range:wc(s,c,o),media_reference_id:i.id,reel_name:i.reel_name??null,keyframes:[],effects:[]};(j.items??=[]).push(X),j.items.sort((w,N)=>w.timeline_range.start.value-N.timeline_range.start.value),Dn(j),P={track:j,item:X}}Nt(n);let T=P?"picture + sound":l?"picture":"sound";return{summary:`Added "${gm(i)}" (${T}) to ${n.name??"timeline"} at ${p}f (${c}f)`+_i(v),meta:{timeline_id:n.id,track_id:d.id,item_id:S.id,media_reference_id:i.id,at_frame:p,duration_frames:c,ref_added:i===t.media_reference,fit:z,cleared:v,audio_track_id:P?.track.id??null,audio_item_id:P?.item.id??null}}};function eT(e,t){let n=new Set((e.timelines??[]).map(r=>r.id)),i=1;for(;n.has(`${t}-${i}`);)i++;return`${t}-${i}`}function tT(e){let t=new Set((e.timelines??[]).map(i=>i.name)),n=(e.timelines??[]).length+1;for(;t.has(`Timeline ${n}`);)n++;return`Timeline ${n}`}var vz=(e,t)=>{let n=e.timelines??[];if(t.timeline_id&&n.some(m=>m.id===t.timeline_id))return{summary:`New timeline: id "${t.timeline_id}" is already in the session`};let i=t.timeline_id||eT(e,"nt-tl"),r=t.name||tT(e),a=n.find(m=>m.kind==="primary")??n[0],o=typeof t.fps_num=="number"&&t.fps_num>0&&typeof t.fps_den=="number"&&t.fps_den>0,s=o?t.fps_num:a?.fps_num??24,c=o?t.fps_den:a?.fps_den??1,l={id:`${i}-v1`,kind:"Video",track_index:0,name:"V1",enabled:!0,items:[]},u={id:i,name:r,kind:"primary",timeline_index:n.length,fps_num:s,fps_den:c,resolution_w:t.resolution_w||a?.resolution_w||1920,resolution_h:t.resolution_h||a?.resolution_h||1080,pixel_aspect_ratio:t.pixel_aspect_ratio??1,start_frame:t.start_frame??0,is_drop_frame:t.is_drop_frame??!1,duration_frames:0,tracks:[l],markers:[],source_element_id:null,raw_extraction:{},metadata:{}};(e.timelines??=[]).push(u);let f=c?s/c:0;return{summary:`New timeline "${r}" \u2014 ${u.resolution_w}\xD7${u.resolution_h} @ ${Number.isInteger(f)?f:f.toFixed(3)}`,meta:{timeline_id:i,track_id:l.id,name:r,fps_num:s,fps_den:c,resolution_w:u.resolution_w,resolution_h:u.resolution_h}}};function nT(e,t){let n=new Set;for(let r of e.timelines??[])for(let a of r.tracks??[])n.add(a.id);let i=1;for(;n.has(`${t}-${i}`);)i++;return`${t}-${i}`}var hz=(e,t)=>{let n=(e.timelines??[]).find(c=>c.id===t.timeline_id);if(!n)return{summary:"Add track: timeline not found"};let i=String(t.kind??"Video").toLowerCase();if(i!=="video"&&i!=="audio")return{summary:`Add track: kind must be Video or Audio, not '${t.kind}'`};let r=i==="video"?"Video":"Audio",a=(n.tracks??[]).filter(c=>c.kind===r).length,o=`${r==="Video"?"V":"A"}${a+1}`,s={id:nT(e,"at-tr"),kind:r,track_index:a,name:o,enabled:!0,items:[]};return(n.tracks??=[]).push(s),{summary:`Added ${o} to ${n.name??"timeline"}`,meta:{timeline_id:n.id,track_id:s.id,kind:r,name:o}}};var bz=(e,t)=>{let n=e.timelines??[],i=m=>n.find(d=>d.id===m||d.name===m),r=i(t.timeline_id),a=i(t.from);if(!r)return{summary:`Stack track: no timeline ${t.timeline_id}`};if(!a)return{summary:`Stack track: no timeline ${t.from} (a timeline of another session comes in through sources)`};let o=Math.max(1,Math.round(t.from_track??1)),s=(a.tracks??[]).filter(m=>m.kind==="Video").sort((m,d)=>m.track_index-d.track_index)[o-1];if(!s)return{summary:`Stack track: ${a.name} has no V${o}`};let c=(r.tracks??[]).filter(m=>m.kind==="Video").length,l=new Set((r.tracks??[]).flatMap(m=>[m.id,...m.items.map(d=>d.id)])),u=m=>{let d=`stk-${m}`,p=1;for(;l.has(d);)d=`stk-${m}-${p++}`;return l.add(d),d},f=structuredClone(s);Object.assign(f,{id:u(s.id),track_index:c,name:t.name?.trim()||`REF ${a.name??""}`.trim(),enabled:!1});for(let m of f.items)m.id=u(m.id);return(r.tracks??=[]).push(f),{summary:`Stacked ${a.name}'s V${o} (${f.items.filter(m=>m.kind==="clip").length} clips) onto ${r.name} as V${c+1}`,meta:{timeline_id:r.id,track:c+1,track_id:f.id}}};function rT(e){let t=e;return t.finish_ops??=[]}var gz=(e,t)=>{let n,i,r;if(t.timeline_level){let s=(e.timelines??[]).find(c=>c.id===t.timeline_id);if(!s)return{summary:"Finish: timeline not found"};n=s,i=s.name??"timeline",r=s.id}else{if(!t.item_id)return{summary:"Finish: item_id required for a clip-level stack"};let s=Qi(e,t.timeline_id,t.item_id);if(!s)return{summary:"Finish: item not found"};n=s.item,i=s.item.name??"clip",r=s.item.id}let a={id:r},o=rT(n);if(t.entry){let s=o.findIndex(l=>l.id===t.entry.id),c=s>=0;return c?o[s]=t.entry:o.push(t.entry),{summary:`${c?"Updated":"Added"} ${t.entry.label??t.entry.kind} on "${i}"`,meta:{item_id:a.id,entry_id:t.entry.id,upserted:!0}}}if(t.toggle_id){let s=o.find(c=>c.id===t.toggle_id);return s?(s.enabled=!s.enabled,{summary:`${s.enabled?"Enabled":"Bypassed"} ${s.label??s.kind} on "${i}"`,meta:{item_id:a.id,entry_id:s.id,enabled:s.enabled}}):{summary:`Finish: operator not found on "${i}"`}}if(t.remove_id){let s=o.findIndex(l=>l.id===t.remove_id);if(s<0)return{summary:`Finish: operator not found on "${i}"`};let[c]=o.splice(s,1);return{summary:`Removed ${c.label??c.kind} from "${i}"`,meta:{item_id:a.id,entry_id:c.id,removed:!0}}}return{summary:"Finish: nothing to do (no entry / toggle_id / remove_id)"}};var yz=(e,t)=>{let n=(e.timelines??[]).find(s=>s.id===t.timeline_id);if(!n)return{summary:"Delete track: timeline not found"};let i=(n.tracks??[]).findIndex(s=>s.id===t.track_id);if(i<0)return{summary:"Delete track: track not found"};let[r]=n.tracks.splice(i,1),a=0;for(let s of n.tracks)s.kind===r.kind&&(s.track_index=a++);Nt(n);let o=(r.items??[]).filter(s=>s.kind!=="gap").length;return{summary:`Deleted ${r.name??r.kind} (${o} clip${o===1?"":"s"}) from ${n.name??"timeline"}`,meta:{timeline_id:n.id,track_id:r.id,kind:r.kind,clips:o}}};var xz=(e,t)=>{let n=(e.timelines??[]).find(d=>d.id===t.timeline_id);if(!n)return{summary:"Move: timeline not found"};let i,r,a=-1;for(let d of n.tracks??[]){let p=(d.items??[]).findIndex(v=>v.id===t.item_id);if(p>=0){i=d,r=d.items[p],a=p;break}}if(!i||!r)return{summary:"Move: clip not found"};let o=t.to_track_id?(n.tracks??[]).find(d=>d.id===t.to_track_id):i;if(!o)return{summary:"Move: destination track not found"};if(o.kind!==i.kind)return{summary:`Move: can't put a ${i.kind} clip on a ${o.kind} track`};let s=r.timeline_range.start.value,c=r.timeline_range.duration.value,l=typeof t.to_frame=="number"&&Number.isFinite(t.to_frame)?Math.max(0,Math.round(t.to_frame)):s;if(o===i&&l===s)return{summary:"Move: already there"};let u=pr(e,o,l,l+c,r.id);if(o!==i){let d=i.items.findIndex(p=>p.id===r.id);i.items.splice(d>=0?d:a,1),(o.items??=[]).push(r)}r.timeline_range.start.value=l,o.items.sort((d,p)=>d.timeline_range.start.value-p.timeline_range.start.value),Dn(i),o!==i&&Dn(o),Nt(n);let f=o!==i?` to ${o.name??"track"}`:"",m=l!==s?` to ${l}f`:"";return{summary:`Moved "${r.name??"clip"}"${f}${m}${_i(u)}`,meta:{timeline_id:n.id,item_id:r.id,from_track_id:i.id,to_track_id:o.id,from_frame:s,to_frame:l,cleared:u}}};function iT(e){let t=0;for(let n of e.tracks??[])t+=(n.items??[]).length;return t}var wz=(e,t)=>{let n=Math.round(Number(t?.fps_num)),i=Math.round(Number(t?.fps_den));if(!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0)return{summary:"Frame rate: must be a positive rational (fps_num / fps_den)"};let r=qn(e,t?.timeline_id);if(!r)return{summary:"Frame rate: timeline not found"};let a=gc(r.fps_num??0,r.fps_den??0),o=gc(n,i);if(r.fps_num===n&&r.fps_den===i)return{summary:`Frame rate: already ${o} fps`};let s=iT(r);return s>0?{summary:`Frame rate: ${r.name??"this timeline"} has ${s} item${s===1?"":"s"} in it \u2014 changing ${a} \u2192 ${o} would move every cut. Set the rate on an empty timeline, or export and re-conform at the new rate.`,meta:{timeline_id:r.id,refused:"populated",items:s}}:(r.fps_num=n,r.fps_den=i,{summary:`Frame rate: ${a} \u2192 ${o} fps`,meta:{timeline_id:r.id,fps_num:n,fps_den:i,was:a}})};var aT=["crop_left","crop_right","crop_top","crop_bottom"],oT={scale:"scale",opacity:"opacity",position_x:"position X",position_y:"position Y",rotation:"rotation",crop_left:"crop L",crop_right:"crop R",crop_top:"crop T",crop_bottom:"crop B"},ym=(e,t,n)=>Math.min(n,Math.max(t,e));function $i(e){return typeof e=="number"&&Number.isFinite(e)?e:null}var zz=(e,t)=>{let n=Qi(e,t.timeline_id,t.item_id);if(!n)return{summary:"Transform: clip not found"};let i=n.item,r=[],a=(d,p)=>{i[d]!==p&&(i[d]=p,r.push(d))},o=$i(t.scale);o!=null&&a("scale",ym(o,.01,1e5));let s=$i(t.opacity);s!=null&&a("opacity",ym(s,0,100));let c=$i(t.position_x);c!=null&&a("position_x",c);let l=$i(t.position_y);l!=null&&a("position_y",l);let u=$i(t.rotation);u!=null&&a("rotation",u);for(let d of aT){let p=$i(t[d]);p!=null&&a(d,ym(p,0,100))}if(r.length===0)return{summary:"Transform: nothing changed"};let f=i.name??t.item_id;return{summary:`Set ${r.map(d=>oT[d]??d).join(", ")} on "${f}"`,meta:{timeline_id:t.timeline_id,item_id:t.item_id,changed:r}}};var sT=e=>!!e&&typeof e=="object"&&Number.isFinite(e.value)&&Number.isFinite(e.rate)&&e.rate>0,Pz=(e,t)=>{let n=e.timelines??[],i=t.timeline_id?n.find(f=>f.id===t.timeline_id):n.length===1?n[0]:n.find(f=>f.kind==="primary");if(!i)return{summary:`Add markers: timeline not found (${t.timeline_id??"no timeline_id"}); timelines: ${n.map(f=>f.id).join(", ")||"none"}`};let r=_e(i),a=(f,m)=>typeof f=="number"&&Number.isFinite(f)?{value:f,rate:r}:sT(f)?f:f==null&&m?m:null,o=new Set((i.tracks??[]).flatMap(f=>(f.items??[]).map(m=>m.id))),s=new Set((i.markers??[]).map(f=>f.id)),c=[],l=[];(t.markers??[]).forEach((f,m)=>{let d=f??{},p=`marker ${m}${typeof d.name=="string"?` "${d.name}"`:""}`;if(typeof f!="object"||f===null)return void l.push(`${p}: not an object`);let v=a(d.time??d.frame);if(!v)return void l.push(`${p}: time must be timeline frames or {value, rate}, got ${JSON.stringify(d.time??d.frame)}`);if(v.value<0)return void l.push(`${p}: time ${v.value} is before the timeline start`);let h=a(d.duration,{value:1,rate:v.rate});if(!h||h.value<0)return void l.push(`${p}: duration must be frames or {value, rate}, got ${JSON.stringify(d.duration)}`);let b=typeof d.item_id=="string"?d.item_id:null;if(b&&!o.has(b))return void l.push(`${p}: no item ${b} on this timeline`);let g=typeof d.id=="string"&&d.id?d.id:"";if(g&&s.has(g))return void l.push(`${p}: id ${g} already present`);for(let y=(i.markers??[]).length+c.length;!g||s.has(g);y++)g=`marker-${y}`;s.add(g),c.push({kind:null,raw_extraction:{},source_element_id:null,metadata:{},...d,id:g,time:v,duration:h,item_id:b,name:typeof d.name=="string"?d.name:null,note:typeof d.note=="string"?d.note:null,color:typeof d.color=="string"?d.color:null})});let u=l.length?`; dropped ${l.length}: ${l.join("; ")}`:"";return c.length===0?{summary:`Add markers: nothing added${u||" (no markers given)"}`,meta:{added:0,dropped:l}}:(i.markers=[...i.markers??[],...c],{summary:`Added ${c.length} marker(s) to "${i.name}"${u}`,meta:{timeline_id:i.id,added:c.length,dropped:l}})};var Sz="generated_by",lT="conform.add_handles",xm=e=>typeof e[Sz]=="string"||yc(e);function cT(e,t){return t<0?`${e}_TRIM_${-t}FR`:`${e}_${t}FR_HANDLES`}function _r(e,t){let n=new Set(t);if(!n.has(e))return e;for(let i=2;;i++){let r=`${e}_${String(i).padStart(2,"0")}`;if(!n.has(r))return r}}var wm=e=>!!e&&!Ai(e)&&dc(e);function Ko(e){let t=e?.available_range,n=t?.start?.value,i=t?.duration?.value;return typeof n=="number"&&typeof i=="number"&&i>0?{start:n,end:n+i}:null}function zm(e,t,n,i){let r=Ko(i),a=Math.max(r?.start??0,e-n),o=r?Math.min(r.end,t+n):t+n;return o<=a?null:{start:a,end:o,clamped:a!==e-n||o!==t+n,unverified:!r&&n>0}}var kz=(e,t)=>({value:e,rate:t}),Oz=(e,t,n)=>({start:kz(e,n),duration:kz(t,n)});function Pm(e,t,n,i,r,a,o,s){return{id:e,kind:"clip",item_index:0,name:t.name,enabled:!0,timeline_range:Oz(o,r,s),source_range:Oz(i,r,a),media_reference_id:n,reel_name:t.reel_name??null,...t.pixel_aspect_ratio!=null?{pixel_aspect_ratio:t.pixel_aspect_ratio}:{},keyframes:[],effects:[]}}function Bo(e,t,n,i,r,a,o){return{id:t,name:n,kind:"primary",timeline_index:i,...e.project_id?{project_id:e.project_id}:{},fps_num:e.fps_num,fps_den:e.fps_den,resolution_w:e.resolution_w,resolution_h:e.resolution_h,pixel_aspect_ratio:e.pixel_aspect_ratio??1,start_frame:e.start_frame,is_drop_frame:e.is_drop_frame,duration_frames:a,tracks:r,markers:[],source_element_id:null,raw_extraction:{},metadata:{},[Sz]:o}}function uT(e,t){let n=e.timelines??[];return t?n.find(i=>i.id===t):n.find(i=>i.kind==="primary"&&!xm(i))??n[0]}var Tz=(e,t)=>{let n=Math.round(Number(t?.handles));if(!Number.isFinite(n)||n===0)return{summary:"Add handles: handles must be a non-zero frame count (positive adds, negative trims)"};let i=uT(e,t?.timeline_id);if(!i)return{summary:`Add handles: timeline not found (${t?.timeline_id??"no timeline in session"})`};let r=new Map;for(let b of e.media_references??[])b.id&&r.set(b.id,b);let a=[];(i.tracks??[]).filter(b=>b.kind==="Video").forEach((b,g)=>{for(let y of b.items??[])y.kind==="clip"&&a.push({item:y,track:g})}),a.sort((b,g)=>b.item.timeline_range.start.value-g.item.timeline_range.start.value||b.track-g.track);let o=i.fps_den?i.fps_num/i.fps_den:24,s=(e.timelines??[]).length,c=[],l=[],u=0,f=0,m=0;for(let{item:b}of a){let g=b.media_reference_id?r.get(b.media_reference_id):void 0,y=b.source_range,x=P=>l.push({item_id:b.id,name:b.name,reason:P});if(!g){x("no media (generator, title or compound)");continue}if(wm(g)){x("still");continue}if(!y||!(y.duration.value>0)){x("no source range");continue}let z=zm(y.start.value,y.start.value+y.duration.value,n,g);if(!z){x(n<0?`shorter than the ${-n*2}-frame trim`:"cut lies outside the media's extent");continue}z.clamped&&n>0&&f++,z.unverified&&m++;let S=z.end-z.start;c.push(Pm(`ah${s}-it-${c.length+1}`,b,g.id,z.start,S,y.start.rate||o,u,o)),u+=S}if(c.forEach((b,g)=>b.item_index=g),c.length===0)return{summary:`Add handles: no usable video clips on "${i.name}"`,meta:{skipped:l}};let d=_r(t?.name?.trim()||cT(i.name,n),(e.timelines??[]).map(b=>b.name)),p=`ah${s}-tl`,v={id:`ah${s}-v1`,kind:"Video",track_index:0,name:"V1",enabled:!0,items:c};(e.timelines??=[]).push(Bo(i,p,d,s,[v],u,lT));let h=n>0?`\xB1${n}f handles`:`trimmed ${-n}f each end`;return{summary:`New timeline "${d}": ${c.length} clip${c.length===1?"":"s"}, ${h}`+(f?` \xB7 ${f} clamped at the media's ends`:"")+(m?` \xB7 ${m} unprobed (tail handle not checked against the file)`:"")+(l.length?` \xB7 ${l.length} skipped`:""),meta:{timeline_id:p,name:d,source_timeline_id:i.id,handles:n,clips:c.length,clamped:f,unverified:m,skipped:l}}};var fT="conform.all_clips",dT="_REF|_REFERENCE| REF",Ao=e=>e.replace(/\\/g,"/").replace(/\/+$/,"").split("/").pop()??"",jz=(e,t)=>e.source_fps||e.available_range?.duration?.rate||t;function Nz(e,t){return e.source_timecode?Oe(e.source_timecode,jz(e,t)):null}function mT(e,t){let i=(Ao(e.target_url??"")||e.display_name||"").replace(/\.[^.]*$/,"").replace(/[._ ]?\[\d+\s*-\s*\d+\]/,"");return Ai(e)&&(i=i.replace(/[._ ]\d{3,}$/,"")),i=i.trim().toLowerCase(),!i&&e.reel_name&&(i=`reel:${e.reel_name.trim().toLowerCase()}`),i?`${i}@${jz(e,t).toFixed(3)}`:null}function pT(e){let t=Ko(e.mref);return t?[e.tc+t.start,e.tc+t.end]:[e.tc+Math.min(...e.uses.map(n=>n.start)),e.tc+Math.max(...e.uses.map(n=>n.end))]}function vT(e,t){let n=new Map;for(let a of e){let o=mT(a.mref,t)??`mref:${a.mref.id}`,s=n.get(o);s||n.set(o,s=new Map);let c=s.get(a.mref.id);c||s.set(a.mref.id,c={mref:a.mref,tc:Nz(a.mref,t),uses:[]}),c.uses.push(a)}let i=[];for(let a of n.values()){let o=[...a.keys()],s=o.filter(m=>a.get(m).tc!=null),c=new Map(s.map(m=>[m,m])),l=m=>c.get(m)===m?m:l(c.get(m)),u=new Map(s.map(m=>[m,pT(a.get(m))]));for(let m=0;m<s.length;m++)for(let d=m+1;d<s.length;d++){let[p,v]=[u.get(s[m]),u.get(s[d])];p[0]<v[1]&&v[0]<p[1]&&c.set(l(s[m]),l(s[d]))}let f=new Map;for(let m of o){let d=c.has(m)?l(m):`alone:${m}`;f.has(d)||f.set(d,new Map),f.get(d).set(m,a.get(m))}for(let m of f.values())i.push({members:m,aligned:[...m.values()].every(d=>d.tc!=null)})}let r=a=>Math.min(...[...a.members.values()].flatMap(o=>o.uses.map(s=>s.pos)));return i.sort((a,o)=>r(a)-r(o)),i.forEach((a,o)=>a.members.forEach(s=>s.uses.forEach(c=>c.group=o))),i}var Jn=(e,t,n)=>(e.aligned?t.tc:0)+n,km=e=>(e.source_resolution_w??0)*(e.source_resolution_h??0),zc=e=>e.kind==="missing",Xz=e=>{let t=e.display_name||Ao(e.target_url??"")||e.id,n=Ao((e.target_url??"").replace(/\\/g,"/").replace(/\/[^/]*$/,""));return n?`${t} (${n})`:t};function hT(e){let t=[...e.members.values()].flatMap(l=>l.uses.map(u=>[Jn(e,l,u.start),Jn(e,l,u.end)])),n=l=>{let u=Ko(l.mref);return l.tc!=null&&!!u&&t.every(([f,m])=>l.tc+u.start<=f&&m<=l.tc+u.end)},i=[...e.members.keys()],r=i.filter(l=>n(e.members.get(l)));if(r.length===0)return{best:null,reason:"no single clip holds every frame the edit uses"};let a=l=>{let u=e.members.get(l).mref;return[zc(u)?0:1,km(u),Ko(u)?.end??0,-i.indexOf(l)]},o=r.reduce((l,u)=>{let[f,m]=[a(l),a(u)];for(let d=0;d<f.length;d++)if(f[d]!==m[d])return f[d]>m[d]?l:u;return l}),s=[];!zc(e.members.get(o).mref)&&i.some(l=>l!==o&&zc(e.members.get(l).mref))&&s.push("online");let c=r.filter(l=>l!==o).map(l=>km(e.members.get(l).mref));return c.length&&km(e.members.get(o).mref)>Math.max(...c)&&s.push("largest picture"),s.push(r.length===1?"the only clip that holds every frame used":"holds every frame used"),{best:o,reason:s.join(", ")}}function bT(e){let t=[...e.members.values()];for(let n=0;n<t.length;n++)for(let i=n+1;i<t.length;i++)for(let r of t[n].uses)for(let a of t[i].uses)if(Jn(e,t[n],r.start)<Jn(e,t[i],a.end)&&Jn(e,t[i],a.start)<Jn(e,t[n],r.end))return"overlap";return"separate"}function gT(e){let t=new Map;for(let i of e)(t.get(i.mref.id)??t.set(i.mref.id,[]).get(i.mref.id)).push(i);let n=[];for(let i of t.values()){i.sort((a,o)=>a.start-o.start||a.pos-o.pos);let r=null;for(let a of i)r&&a.start<=r.end?(r.end=Math.max(r.end,a.end),a.pos<r.pos&&(r.pos=a.pos,r.item=a.item)):n.push(r={mref:a.mref,item:a.item,start:a.start,end:a.end,rate:a.rate,pos:a.pos,group:a.group,track:1,at:0})}return n}function yT(e,t,n){let i=new Set,r=new Map;for(let s of e){let c=`${s.mref.id}|${s.start}|${s.end}`;i.has(c)||(i.add(c),(r.get(s.group)??r.set(s.group,[]).get(s.group)).push(s))}let a=[],o=0;for(let[s,c]of r){let l=t[s],u=(b,g)=>Jn(l,l.members.get(b.mref.id),g),f=new Map;for(let b of c){let g=f.get(b.mref.id);g?(b.start<g.lo&&(g.lo=b.start,g.first=b),g.hi=Math.max(g.hi,b.end)):f.set(b.mref.id,{lo:b.start,hi:b.end,first:b})}let m=[...f.values()].reduce((b,g)=>{let y=b.hi-b.lo,x=g.hi-g.lo;return x>y||x===y&&u(g.first,g.lo)<u(b.first,b.lo)?g:b}),d=Math.min(...c.map(b=>u(b,b.start))),p=Math.max(...c.map(b=>u(b,b.end)));a.push({...m.first,start:m.lo,end:m.hi,track:1,at:o+u(m.first,m.lo)-d});let v=c.filter(b=>!(b.mref.id===m.first.mref.id&&b.start===m.lo&&b.end===m.hi)).sort((b,g)=>u(b,b.start)-u(g,g.start)||u(g,g.end)-u(b,b.end)),h=[];for(let b of v){let g=u(b,b.start),y=h.findIndex(x=>x<=g);y<0&&(h.push(0),y=h.length-1),h[y]=u(b,b.end),a.push({...b,track:y+2,at:o+g-d})}o+=p-d+n}return a}var Lz=(e,t={})=>{let n=t??{},i=Math.max(0,Math.round(Number(n.handles??0))||0),r=(e.timelines??[]).filter(H=>n.timeline_ids?.length?n.timeline_ids.includes(H.id):H.kind==="primary"&&!xm(H));if(r.length===0)return{summary:`All clips: no timelines to gather${n.timeline_ids?.length?` (${n.timeline_ids.join(", ")} not found)`:""}`};let a=r[0],o=a.fps_den?a.fps_num/a.fps_den:24,s=(n.reference_pattern??dT).split("|").map(H=>H.toUpperCase()).filter(Boolean),c=new Map;for(let H of e.media_references??[])H.id&&c.set(H.id,H);let l={disabled:0,reference:0,still:0,image_sequence:0,offline:0,no_media:0,no_range:0,nested:0},u=0,f=[],m=H=>(Ao(H.target_url??"").split(".").pop()??"").toLowerCase(),d=H=>{let W=((typeof H=="string"?H.split(","):H)??[]).map(D=>D.trim().replace(/^\./,"").toLowerCase()).filter(Boolean);return W.length?new Set(W):null},p=d(n.still_extensions),v=d(n.sequence_extensions),h=H=>v?v.has(m(H))&&Ai(H):Ai(H),b=H=>p?p.has(m(H)):wm(H),g=new Map((e.timelines??[]).map(H=>[H.id,H])),y=(H,M)=>{let W=H.nested_timeline_id?g.get(H.nested_timeline_id):void 0,D=H.source_range;if(!W||!D||M>3)return[];let[ae,oe]=[D.start.value,D.start.value+D.duration.value];return(W.tracks??[]).filter(ie=>ie.kind==="Video").flatMap(ie=>ie.items??[]).flatMap(ie=>{if(ie.kind==="nested")return y(ie,M+1);let re=ie.timeline_range.start.value,he=re+ie.timeline_range.duration.value,Re=Math.max(re,ae),ve=Math.min(he,oe);if(ie.kind!=="clip"||!ie.source_range||ve<=Re)return[];let Fe=(ie.speed??100)/100;return[{...ie,timeline_range:{start:{...H.timeline_range.start,value:H.timeline_range.start.value+(Re-ae)},duration:{...ie.timeline_range.duration,value:ve-Re}},source_range:{start:{...ie.source_range.start,value:ie.source_range.start.value+(Re-re)*Fe},duration:{...ie.source_range.duration,value:(ve-Re)*Fe}}}]})};for(let H of r){let M=[];(H.tracks??[]).filter(W=>W.kind==="Video").forEach((W,D)=>(W.items??[]).forEach(ae=>{if(ae.kind==="nested"&&n.include_nested!==!1)for(let oe of y(ae,1))M.push({item:oe,track:D});else M.push({item:ae,track:D})})),M.sort((W,D)=>W.item.timeline_range.start.value-D.item.timeline_range.start.value||W.track-D.track);for(let{item:W}of M){if(W.kind==="nested"){l.nested++;continue}if(W.kind!=="clip")continue;if(W.enabled===!1&&!n.include_disabled){l.disabled++;continue}let D=W.media_reference_id?c.get(W.media_reference_id):void 0;if(!D){l.no_media++;continue}let ae=[W.name,D.display_name,Ao(D.target_url??"")].filter(Boolean).map(ie=>ie.toUpperCase());if(!n.include_references&&(D.role==="reference"||ae.some(ie=>s.some(re=>ie.includes(re))))){l.reference++;continue}if(h(D)){if(n.include_image_sequences===!1){l.image_sequence++;continue}}else if(b(D)&&!n.include_stills){l.still++;continue}if(zc(D)&&n.include_offline===!1){l.offline++;continue}let oe=W.source_range;if(!oe||!(oe.duration.value>0)){l.no_range++;continue}W.speed!=null&&W.speed!==100&&u++,f.push({pos:f.length,item:W,mref:D,start:oe.start.value,end:oe.start.value+oe.duration.value,rate:oe.start.rate||o,group:-1})}}if(f.length===0)return{summary:"All clips: nothing to gather after the filters",meta:{skipped:l}};let x=vT(f,o),z=[];for(let[H,M]of x.entries()){if(M.members.size<2)continue;let W=bT(M),D=[...M.members.values()].map(re=>Xz(re.mref)),{best:ae,reason:oe}=hT(M),ie=!!n.reduce_duplicates&&!!ae;if(ie){let re=M.members.get(ae);for(let[he,Re]of M.members)if(he!==ae){for(let ve of Re.uses)Object.assign(ve,{mref:re.mref,start:Jn(M,Re,ve.start)-re.tc,end:Jn(M,Re,ve.end)-re.tc}),re.uses.push(ve);M.members.delete(he)}}z.push({group:H,kind:W,clips:D,best:ae?Xz(c.get(ae)):null,reason:oe,reduced:ie})}let S=0,P=0;for(let H of f){if(!i)continue;let M=zm(H.start,H.end,i,H.mref);M.clamped&&S++,M.unverified&&P++,H.start=M.start,H.end=M.end}let T=new Map,j=H=>(T.has(H.id)||T.set(H.id,Nz(H,o)),T.get(H.id)),X=H=>n.order==="source_tc"?H.sort((M,W)=>{let D=j(M.mref),ae=j(W.mref);return D==null!=(ae==null)?D==null?1:-1:(D==null?0:D+M.start-(ae+W.start))||M.pos-W.pos}):H.sort((M,W)=>M.pos-W.pos),w=H=>H.map(M=>({mref:M.mref,item:M.item,start:M.start,end:M.end,rate:M.rate,pos:M.pos,group:M.group,track:1,at:0})),N=H=>{if(n.stack)return yT(X(w(H)),x,Math.round(o));let M=0;return X(gT(H)).map(W=>{let D={...W,at:M};return M+=W.end-W.start,D})},F=(e.timelines??[]).map(H=>H.name),C=n.name?.trim()||`All_Clips_Timeline_${i}FR_HANDLES`,R=new Map(z.map(H=>[H.group,H])),E=[],Y=(H,M,W)=>{let D=(e.timelines??[]).length,ae=`ac${D}`,oe=Math.max(1,...H.map(ve=>ve.track)),ie=Array.from({length:oe},(ve,Fe)=>({id:`${ae}-v${Fe+1}`,kind:"Video",track_index:Fe,name:`V${Fe+1}`,enabled:!0,items:H.filter(ze=>ze.track===Fe+1).sort((ze,It)=>ze.at-It.at).map((ze,It)=>Pm(`${ae}-it-${Fe+1}-${It+1}`,ze.item,ze.mref.id,ze.start,ze.end-ze.start,ze.rate,ze.at,o))}));ie.forEach(ve=>ve.items.forEach((Fe,ze)=>Fe.item_index=ze));let re=Math.max(0,...H.map(ve=>ve.at+ve.end-ve.start)),he=_r(M,F);F.push(he);let Re=Bo(a,`${ae}-tl`,he,D,ie,re,fT);if(Object.assign(Re,{start_frame:0},W?{resolution_w:W[0],resolution_h:W[1]}:{}),n.mark_duplicates!==!1){let ve=[];for(let Fe of H){let ze=R.get(Fe.group);ze&&ve.push({id:`${ae}-dup-${ve.length+1}`,name:"Duplicate footage",color:"Yellow",kind:null,note:`${ze.clips.length} clips hold this footage: ${ze.clips.join(", ")} \xB7 `+(ze.kind==="overlap"?"the same frames are cut in from different clips":"different parts of one camera clip come from different copies")+(ze.reduced?` \xB7 this timeline uses ${ze.best}`:ze.best?` \xB7 best version: ${ze.best} (${ze.reason})`:` \xB7 ${ze.reason}`),time:{value:Fe.at,rate:o},duration:{value:Fe.end-Fe.start,rate:o},item_id:null,raw_extraction:{},source_element_id:null,metadata:{}})}Re.markers=ve}return(e.timelines??=[]).push(Re),E.push({id:Re.id,name:he,clips:H.length,tracks:oe,resolution:W?`${W[0]}x${W[1]}`:null}),Re},K=N(f);if(Y(K,C,null),n.per_resolution){let H=new Map;for(let W of f){let D=W.mref.source_resolution_w,ae=W.mref.source_resolution_h,oe=D&&ae?`${D}x${ae}`:"unknown";(H.get(oe)??H.set(oe,[]).get(oe)).push(W)}let M=[...H.keys()].sort((W,D)=>{let ae=W==="unknown"?-1:W.split("x").map(Number).reduce((ie,re)=>ie*re);return(D==="unknown"?-1:D.split("x").map(Number).reduce((ie,re)=>ie*re))-ae||W.localeCompare(D)});for(let W of M){let D=W==="unknown"?null:W.split("x").map(Number);if(!n.disable_non_matching){Y(N(H.get(W)),`${C}_${W==="unknown"?"UNKNOWN_RES":W}`,D);continue}let ae=Y(N(f),`${C}_${W==="unknown"?"UNKNOWN_RES":W}`,D),oe=new Set(H.get(W).map(ie=>ie.mref.id));for(let ie of ae.tracks)for(let re of ie.items)oe.has(String(re.media_reference_id))||(re.enabled=!1)}}let I=Object.values(l).reduce((H,M)=>H+M,0),te=E[0].clips;return{summary:`All clips: ${f.length} use${f.length===1?"":"s"} from ${r.length} timeline${r.length===1?"":"s"} \u2192 ${te} piece${te===1?"":"s"} on "${E[0].name}"${n.stack?` (stacked, ${E[0].tracks} tracks)`:""}`+(i?` \xB7 \xB1${i}f handles${S?` (${S} clamped)`:""}`:"")+(E.length>1?` \xB7 ${E.length-1} per-resolution timeline${E.length===2?"":"s"}`:"")+(z.length?` \xB7 ${z.length} duplicate footage group${z.length===1?"":"s"}${z.some(H=>H.reduced)?` (${z.filter(H=>H.reduced).length} reduced)`:""}`:"")+(u?` \xB7 ${u} retimed clip${u===1?"":"s"} land at 100%`:"")+(I?` \xB7 ${I} skipped`:""),meta:{timelines:E,uses:f.length,handles:i,clamped:S,unverified:P,retimed:u,skipped:l,duplicates:z}}};var Zz=e=>e.fps_den?e.fps_num/e.fps_den:24,Wz=(e,t={})=>{let n=e.timelines??[],i=t.timeline_ids?.length?t.timeline_ids.map(h=>n.find(b=>b.id===h||b.name===h)):n.filter(h=>h.kind==="primary"),r=(t.timeline_ids??[]).filter((h,b)=>!i[b]);if(r.length)return{summary:`Join: no timeline ${r.join(", ")}`};let a=i;if(a.length<2)return{summary:"Join: needs two timelines or more"};let o=a[0],s=Zz(o),c=Math.max(0,Math.round(t.gap_frames??0)),l=[],u=(h,b,g)=>{let y=l.find(x=>x.kind===h&&x.track_index===b);return y||(y={...structuredClone({...g,items:[]}),id:`join-${h[0].toLowerCase()}${b+1}`,track_index:b,items:[]},l.push(y)),y},f=[],m=0,d=0;a.forEach((h,b)=>{let g=s/Zz(h),y=Math.round((h.duration_frames??Math.max(0,...(h.tracks??[]).flatMap(z=>(z.items??[]).map(S=>S.timeline_range.start.value+S.timeline_range.duration.value))))*g);t.mark!==!1&&f.push({id:`join-m${b+1}`,name:h.name,color:"Blue",kind:null,note:`from ${h.name}`,time:{value:m,rate:s},duration:{value:1,rate:s},item_id:null,raw_extraction:{},source_element_id:null,metadata:{}});let x=new Map;for(let z of h.tracks??[]){let S=x.get(z.kind)??0;x.set(z.kind,S+1);let P=u(z.kind,S,z);for(let T of z.items??[]){if(T.kind==="gap")continue;let j=structuredClone(T);j.id=`j${b+1}-${T.id}`,j.timeline_range={start:{value:m+Math.round(T.timeline_range.start.value*g),rate:s},duration:{value:Math.round(T.timeline_range.duration.value*g),rate:s}};for(let X of j.markers??[])X.id=`j${b+1}-${X.id}`,X.item_id=j.id;P.items.push(j),d++}}for(let z of h.markers??[])f.push({...structuredClone(z),id:`j${b+1}-${z.id}`,time:{value:m+Math.round(z.time.value*g),rate:s}});m+=y+c});for(let h of l)h.items.sort((b,g)=>b.timeline_range.start.value-g.timeline_range.start.value),h.items.forEach((b,g)=>{b.item_index=g});l.sort((h,b)=>h.kind===b.kind?h.track_index-b.track_index:h.kind==="Video"?-1:1);let p=_r(t.name?.trim()||`${o.name}_JOINED`,n.map(h=>h.name)),v=Bo(o,`join-${n.length+1}`,p,n.length,l,m-c,"conform.join");return v.markers=f,Nt(v),e.timelines.push(v),{summary:`Joined ${a.length} timelines (${a.map(h=>h.name).join(" + ")}) into ${p}: ${d} items, ${v.duration_frames} frames`,meta:{timeline_id:v.id,name:p,timelines:a.length,items:d}}};var Vz=(e,t={})=>{let n=(e.timelines??[]).filter(o=>t.timeline_id?o.id===t.timeline_id||o.name===t.timeline_id:o.kind==="primary");if(!n.length)return{summary:`Remove audio: no timeline ${t.timeline_id??""}`.trim()};let i=new Set((t.keep_tracks??[]).map(o=>o.toUpperCase())),r=0,a=0;for(let o of n){let s=0;o.tracks=(o.tracks??[]).filter(l=>l.kind!=="Audio"||(s++,i.has(`A${s}`)||l.name&&i.has(l.name.toUpperCase()))?!0:(r++,a+=(l.items??[]).filter(u=>u.kind!=="gap").length,!1));let c=0;for(let l of o.tracks)l.kind==="Audio"&&(l.track_index=c++);Nt(o)}return{summary:`Removed ${r} audio track${r===1?"":"s"} (${a} clips) from ${n.map(o=>o.name).join(", ")}`,meta:{tracks:r,clips:a}}};var Om={sizing:{fields:["position_x","position_y","position_z","scale","scale_x","scale_y","scale_z","rotation","rotation_x","rotation_y","rotation_z","anchor_x","anchor_y","anchor_z","raw_scale","raw_position_x","raw_position_y","reframe_fit","render_base_w","render_base_h","render_pos_div_x","render_pos_div_y"],paths:/^(position|scale|rotation|anchor)(\.|$)/},crop:{fields:["crop_left","crop_right","crop_top","crop_bottom"],paths:/^crop(\.|$)/},opacity:{fields:["opacity","blend_mode"],paths:/^opacity$/},effects:{fields:["effects"],paths:/^effect\./}},Rz=e=>e.source_range?[e.source_range.start.value,e.source_range.start.value+e.source_range.duration.value]:null,Qo=(e,t)=>e.rate===t?e.value:e.value*t/e.rate,Sm=e=>e.tracks.filter(t=>t.kind==="Video").flatMap(t=>t.items.map(n=>({it:n,track:t.track_index}))),Hz=(e,t)=>{let n=e.timelines??[],i=v=>n.find(h=>h.id===v||h.name===v),r=t?.sources?.[0],a=t?.from?i(t.from):r?n.find(v=>v.kind==="primary"&&v.id.startsWith(`${r}/`)):void 0;if(!a)return{summary:`Carry: no timeline ${t?.from??"to carry from (from, or a source session)"}`};let o=t.to?i(t.to):n.find(v=>v.kind==="primary"&&v!==a&&!v.id.includes("/"));if(!o)return{summary:`Carry: no timeline ${t.to??"to carry onto"}`};let s=t,c=(t.what?.length?t.what:Object.keys(Om).filter(v=>s[v]!==!1)).filter(v=>Om[v]),l=structuredClone(o);l.id=`carry-${o.id.replace(/\W+/g,"")}`,l.name=_r(t.name?.trim()||`${o.name}_RECONFORMED`,n.map(v=>v.name)),l.timeline_index=n.length,l.kind="primary";for(let v of l.tracks){v.id=`${l.id}-${v.id}`;for(let h of v.items)h.id=`${l.id}-${h.id}`}let u=Sm(a),f=new Map,m=0,d=[];for(let{it:v}of Sm(l)){let h=Rz(v);if(!h||!v.media_reference_id)continue;let b=u.map(({it:g,track:y})=>{let x=g.media_reference_id===v.media_reference_id?Rz(g):null;return{a:g,track:y,common:x?Math.min(x[1],h[1])-Math.max(x[0],h[0]):0}}).filter(g=>g.common>0).sort((g,y)=>y.common-g.common||y.track-g.track)[0];if(!b){d.push(v.name??v.id);continue}f.has(b.a)||f.set(b.a,v);for(let g of c){let{fields:y,paths:x}=Om[g];for(let z of y)v[z]=structuredClone(b.a[z]??null);v.keyframes=[...(v.keyframes??[]).filter(z=>!x.test(z.parameter_path)),...structuredClone((b.a.keyframes??[]).filter(z=>x.test(z.parameter_path)))]}m++}let p=t.markers===!1?null:xT(a,l,u,f);return e.timelines.push(l),{summary:`Carry: "${l.name}" \u2014 ${m} clip(s) took ${c.join(", ")} from "${a.name}"${d.length?`; ${d.length} new (no clip of the same media in A): ${d.slice(0,8).join(", ")}${d.length>8?" \u2026":""}`:""}${p?`; ${p.carried} marker(s) carried${p.dropped.length?`, ${p.dropped.length} dropped`:""}`:""}`,meta:{timeline_id:l.id,carried:m,new_material:d,what:c,...p?{markers:p}:{}}}};function xT(e,t,n,i){let r={carried:0,kept_in_place:0,duplicates:0,dropped:[]},a=(u,f)=>[Qo(u.timeline_range.start,f),Qo(u.timeline_range.start,f)+Qo(u.timeline_range.duration,f)],o=Sm(t).map(u=>u.it),s=Math.max(0,...o.map(u=>a(u,u.timeline_range.start.rate)[1])),c=new Set((t.markers??[]).map(u=>`${Math.round(u.time.value)}|${u.name??""}`)),l=new Map(n.map(({it:u})=>[u.id,u]));for(let u of e.markers??[]){let f=u.time.rate,m=u.time.value,d=u.name??"",p=u.item_id?l.get(u.item_id):n.filter(({it:y})=>y.enabled!==!1&&a(y,f)[0]<=m&&m<a(y,f)[1]).sort((y,x)=>x.track-y.track)[0]?.it,v,h;if(p){let y=i.get(p);if(!y||!p.source_range||!y.source_range){r.dropped.push({name:d||(p.name??p.id),reason:"its shot is gone from the new cut"});continue}let x=u.item_id?1:(p.speed??100)/100,z=u.item_id?1:(y.speed??100)/100,S=Qo(p.source_range.start,f)+(m-a(p,f)[0])*x;if(v=Math.abs(z)<1e-6?a(y,f)[0]:a(y,f)[0]+Math.round((S-Qo(y.source_range.start,f))/z),v<a(y,f)[0]||v>=a(y,f)[1]){r.dropped.push({name:d||(p.name??p.id),reason:"the frame it marks was trimmed out of the new cut"});continue}u.item_id&&(h=y)}else{if(u.item_id){r.dropped.push({name:d,reason:"its clip is not a video clip of the old cut"});continue}if(v=m,v<0||v>=s){r.dropped.push({name:d,reason:"past the end of the new cut"});continue}r.kept_in_place++}let b=`${Math.round(v)}|${d}`;if(c.has(b)){r.duplicates++;continue}c.add(b);let g={...structuredClone(u),id:`${t.id}-m${(t.markers??[]).length}`,time:{value:v,rate:f},item_id:h?.id??null};(t.markers??=[]).push(g),r.carried++}return r}var Tm={relink:vc,slip:_3,delete:$3,trim:Q3,reformat:az,stringout:uz,node_sizing:fz,add_clip:pz,new_timeline:vz,add_track:hz,stack_track:bz,finish_op:gz,delete_track:yz,move_clip:xz,timeline_rate:wz,transform:zz,add_markers:Pz,add_handles:Tz,all_clips:Lz,join:Wz,carry:Hz,remove_audio:Vz};function Fz(e){return Tm[e]}var wT=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});wT.decode();var Xm=new TextEncoder;"encodeInto"in Xm||(Xm.encodeInto=function(e,t){let n=Xm.encode(e);return t.set(n),{read:e.length,written:n.length}});var cJ=new TextEncoder,uJ=new TextDecoder;var fJ=256*1024;var dJ=new Uint8Array(0);var PJ=2*1024*1024,jm=["resolve-otio","resolve-xmeml","premiere-xmeml","flame-fcpxml","flame-archive","resolve-drt","avid-aaf","resolve-aaf","avid-avb","premiere-prproj","premiere-otio","baselight-blscene","finalcut-fcpxmld","protools-aaf","protools-ptx","session_json"],Mz=["premiere-prproj","resolve-drt","flame-archive","avid-avb","resolve-xmeml"],Iz=["resolve-otio","flame-fcpxml","avid-aaf","resolve-aaf","premiere-otio","session_json"],qz=["baselight-blscene","finalcut-fcpxmld","protools-ptx","protools-aaf"],Dz=[];var Pc={prproj:"premiere-prproj",otio:"resolve-otio","resolve-xml":"resolve-xmeml",xmeml:"resolve-xmeml",drt:"resolve-drt",fcpxml:"flame-fcpxml",aaf:"avid-aaf",avb:"avid-avb"};function Jz(e){return e==="Video"?"V":e==="Audio"?"A":e?.[0]??"T"}function Nm(e,t){let n=e.name?.trim();if(n)return n;let i=Lm(e.kind,t),r=i.indexOf(e);return r<0&&e.id&&(r=i.findIndex(a=>a?.id===e.id)),r<0?`${Jz(e.kind)}${Math.max(1,Math.abs(e.track_index??0))}`:`${Jz(e.kind)}${r+1}`}function Lm(e,t){let n=t.filter(a=>a?.kind===e),i=n.length>0&&n.every(a=>(a.track_index??0)<=0),r=a=>i?-(a.track_index??0):a.track_index??0;return[...n].sort((a,o)=>r(a)-r(o))}var PT=["proxy","prx","low","offline","rough","preview","comp","temp","draft","h264","dnxhr","prores"];function kc(e,t,n,i={}){let r=XT(i),a=[],o=[],s=[],c=new Map,l=RT(t),u=ZT(n.fileExtensions),f=u?l.filter(d=>u.has(LT(d.filename))):l;for(let d of e){let p=[];for(let x of f){let z=jT(d,x,n,r);if(z.confidence>0){let S=_o(d,x,r);p.push({candidate:x,contains:S.known&&S.contains,confidence:z.confidence,reasons:z.reasons})}else z.refusal&&!c.has(d.id)&&c.set(d.id,{candidate_id:x.id,reason:z.refusal})}if(p.sort((x,z)=>z.confidence-x.confidence),p.length===0){o.push(d.id);continue}let v=p[0].confidence,h=p.filter(x=>v-x.confidence<.05),b=h.filter(x=>x.contains);if(b.length===1&&!h[0].contains){let x=p.indexOf(b[0]);p.splice(x,1),p.unshift(b[0])}let g=p[0],y=p.slice(1).filter(x=>g.confidence-x.confidence<.05&&x.contains===g.contains);y.length>0&&s.push({proxy_id:d.id,candidate_ids:[g,...y].map(x=>x.candidate.id)}),a.push({proxy_id:d.id,candidate_id:g.candidate.id,matched_path:g.candidate.path??g.candidate.filename,confidence:g.confidence,reasons:g.reasons})}if(o.length>0&&a.length>0){let d=new Map(e.map(y=>[y.id,y])),p=new Map(f.map(y=>[y.id,y])),v=new Map;for(let y of f){let x=$r(y.filename).toLowerCase(),z=v.get(x);z?z.push(y):v.set(x,[y])}let h=a.filter(y=>y.confidence>=.5),b=new Set,g=[];for(let y of h){let x=d.get(y.proxy_id),z=p.get(y.candidate_id);if(!x||!z)continue;let S=OT($r(x.filename),$r(z.filename));S&&b.add(S);let P=x.original_path??x.id,T=ST(P,z.path);T&&g.push(T)}if(b.size>0||g.length>0){let y=[];for(let x of o){let z=d.get(x);if(!z){y.push(x);continue}let S=null,P=null;for(let j of b){let X=($r(z.filename)+j).toLowerCase(),w=v.get(X);if(w&&w.length>0){S=kT(z,w,r),P=`filename pattern inferred (${j} suffix)`;break}}if(!S&&z.original_path)for(let j of g){let X=TT(z.original_path,j);if(!X)continue;let w=X.toLowerCase();for(let N of f){let F=(N.path??"").replace(/\\/g,"/").toLowerCase();if(F&&F.endsWith(w)){S=N,P="directory proximity";break}}if(S)break}let T=S?_o(z,S,r):null;S&&T?.known&&!T.contains?(c.has(z.id)||c.set(z.id,{candidate_id:S.id,reason:`cut not within linked media ${S.filename} (inferred name ${P??""})`}),y.push(x)):S?a.push({proxy_id:z.id,candidate_id:S.id,matched_path:S.path??S.filename,confidence:.5,reasons:P?[P]:[]}):y.push(x)}o.length=0,o.push(...y)}}let m=o.filter(d=>c.has(d)).map(d=>({proxy_id:d,...c.get(d)}));return{matches:a,unmatched:o,ambiguous:s,refusals:m}}function kT(e,t,n){return t.length===1?t[0]:t.find(r=>_o(e,r,n).contains)??t[0]}function Oc(e,t,n,i,r){if(n==null||i==null||t==null)return{known:!1,contains:!1};let a=Oe(n,r);if(a==null)return{known:!1,contains:!1};let o=Oe(e??"00:00:00:00",r)??0;return{known:!0,contains:o<=a&&a+i<=o+t}}function _o(e,t,n){if(e.cut_timecode_start==null||e.cut_duration_frames==null)return{known:!1,contains:!1};let i=e.fps??t.fps??n.timecode_rate,r=t.duration_frames??(t.duration_seconds!=null?Math.round(t.duration_seconds*i):null);return Oc(t.timecode_start,r,e.cut_timecode_start,e.cut_duration_frames,i)}function OT(e,t){let n=e.toLowerCase(),i=t.toLowerCase();if(i.length<=n.length||!i.startsWith(n))return null;let r=i.slice(n.length);return!r.startsWith("_")&&!r.startsWith("-")?null:t.slice(e.length)}function ST(e,t){if(!e||!t)return null;let n=e.replace(/\\/g,"/").split("/").filter(Boolean),i=t.replace(/\\/g,"/").split("/").filter(Boolean),r=0;for(;r<n.length&&r<i.length&&n[n.length-1-r].toLowerCase()===i[i.length-1-r].toLowerCase();)r++;return r===0?null:{proxyPrefix:n.slice(0,n.length-r).join("/")}}function TT(e,t){let n=e.replace(/\\/g,"/").replace(/^\/+/,""),i=t.proxyPrefix.replace(/^\/+/,"");return i?n.toLowerCase().startsWith(i.toLowerCase())?n.slice(i.length).replace(/^\/+/,""):null:n}function XT(e){return{timecode_tolerance_frames:e.timecode_tolerance_frames??1,timecode_rate:e.timecode_rate??24,duration_tolerance_seconds:e.duration_tolerance_seconds??.1,min_name_similarity:e.min_name_similarity??.6,aspect_tolerance:e.aspect_tolerance??.01,fps_tolerance:e.fps_tolerance??.005}}function jT(e,t,n,i){let r=[],a=0;if(n.fileName)if(n.fileNameMode==="tight"){if($r(e.filename)!==$r(t.filename))return{confidence:0,reasons:[]};a+=.6,r.push("exact filename")}else{let s=Sc(Un(e.filename),Un(t.filename));if(s<i.min_name_similarity)return{confidence:0,reasons:[]};let c=e.cut_timecode_start??e.timecode_start,l=c==null||/^00:00:00[:;]00$/.test(c),u=Un(e.filename).toLowerCase(),f=Un(t.filename).toLowerCase(),m=u===f||f.startsWith(u)||u.startsWith(f);if(l&&!m)return{confidence:0,reasons:[],refusal:`filename similarity ${s.toFixed(2)} but no source timecode to confirm a non-exact name \u2014 exact name required`};a+=s*.6,r.push(`filename similarity ${s.toFixed(2)}`)}else a+=.1;let o=Eo(e.filename)||Eo(t.filename);if(!o)if(e.tc_unrecorded){let s=_o(e,t,i);s.known&&s.contains&&(a+=.2,r.push("cut within source timecode range"))}else{let s=_o(e,t,i);if(s.known)if(s.contains)a+=.2,r.push("cut within source timecode range");else{let c=e.fps??t.fps??i.timecode_rate,l=Oe(e.cut_timecode_start??"00:00:00:00",c)??0,u=Oe(t.timecode_start??"00:00:00:00",c)??0,f=t.duration_frames??(t.duration_seconds!=null?Math.round(t.duration_seconds*c):0);return{confidence:0,reasons:[],refusal:`cut [${l}..${l+(e.cut_duration_frames??0)}] not within linked media ${t.filename} [${u}..${u+f}]`}}else{let c=e.fps??t.fps??i.timecode_rate,l=Oe(e.cut_timecode_start??e.timecode_start??"00:00:00:00",c),u=Oe(t.timecode_start??"00:00:00:00",c),f=e.duration_seconds!=null?Math.round(e.duration_seconds*c):null,m=t.duration_seconds!=null?Math.round(t.duration_seconds*c):null;if(l!=null&&u!=null)if(f!=null&&m!=null)if(Math.max(l,u)<Math.min(l+f,u+m))a+=.2,r.push("source timecode overlaps");else return{confidence:0,reasons:[],refusal:`source timecode [${l}..${l+f}] does not overlap ${t.filename} [${u}..${u+m}]`};else Math.abs(l-u)<=i.timecode_tolerance_frames&&(a+=.2,r.push("source timecode aligned"))}}if(n.reelName){let s=e.reel_name&&t.reel_name&&e.reel_name===t.reel_name,c=s?null:NT(e.reel_sources,t.reel_sources);if(s)a+=.15,r.push("reel name matched");else if(c)a+=.075,r.push(`reel matched (proxy.${c.proxySource} = candidate.${c.candidateSource})`);else if(e.reel_name&&t.reel_name)return{confidence:0,reasons:[]}}if(n.totalDuration&&!o&&e.duration_seconds!=null&&t.duration_seconds!=null){let s=u=>u==null?null:u>=1e3?"sample":"frame",c=s(e.duration_rate),l=s(t.duration_rate);if(c!=null&&l!=null&&c!==l)r.push("duration units differ (frames vs samples) \u2014 not compared");else if(Math.abs(e.duration_seconds-t.duration_seconds)<=i.duration_tolerance_seconds)a+=.1,r.push("duration matches");else return{confidence:0,reasons:[]}}if(n.resolution&&e.resolution_w!=null&&e.resolution_h!=null&&t.resolution_w!=null&&t.resolution_h!=null)if(e.resolution_w===t.resolution_w&&e.resolution_h===t.resolution_h)a+=.05,r.push(`resolution ${t.resolution_w}\xD7${t.resolution_h}`);else return{confidence:0,reasons:[]};if(n.bitDepth&&e.bit_depth!=null&&t.bit_depth!=null)if(e.bit_depth===t.bit_depth)a+=.05,r.push(`${t.bit_depth}-bit`);else return{confidence:0,reasons:[]};if(e.fps!=null&&t.fps!=null&&!Eo(e.filename)&&!Eo(t.filename)){let s=e.fps;if(Math.abs(t.fps-s)/s<i.fps_tolerance)a+=.05,r.push(`${s} fps`);else return{confidence:0,reasons:[],refusal:`frame rate ${t.fps} does not match the edit's ${s} \u2014 different-rate media is never the same clip`}}if(n.fileFormat&&e.container&&t.container)if(WT(t.container,e.container))a+=.05,r.push(`container ${t.container}`);else return{confidence:0,reasons:[]};if(n.codec&&e.codec&&t.codec)if(VT(t.codec,e.codec))a+=.05,r.push(`codec ${t.codec}`);else return{confidence:0,reasons:[]};return n.mediaUmid&&e.media_umid&&t.media_umid&&e.media_umid===t.media_umid&&(a=Math.max(a,.95),r.push("UMID match")),{confidence:Math.min(a,1),reasons:r}}function $r(e){return e.replace(/\.[^.]+$/,"").toLowerCase()}function Un(e){let t=$r(e);t=t.replace(/[-_]s\d{3}$/i,""),t=t.replace(/[-_]+v\d+$/i,"");let n=new Set(PT);return t.split(/[-_\s]+/).filter(i=>i&&!n.has(i)).join("_")}function NT(e,t){if(!e||!t)return null;let n=["embedded","project_metadata","parent_folder","filename_pattern"];for(let i of n){let r=e[i];if(r)for(let a of n){let o=t[a];if(o&&r===o)return{proxySource:i,candidateSource:a}}}return null}function Sc(e,t){if(!e||!t)return 0;if(e===t)return 1;if(Math.min(e.length,t.length)>=6&&(e.includes(t)||t.includes(e)))return .8;let i=e.split(/[_\-\s]+/),r=new Set(t.split(/[_\-\s]+/)),a=i.filter(o=>r.has(o));return a.length===0?0:a.length/Math.max(i.length,r.size)}function LT(e){let t=e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""}function ZT(e){if(!e||!e.trim())return null;let t=e.split(/[,\s]+/).map(n=>n.replace(/^\./,"").toLowerCase()).filter(Boolean);return t.length===0?null:new Set(t)}function WT(e,t){let n=e.toLowerCase(),i=t.toLowerCase();return!!(n===i||i.includes("quicktime")&&(n==="mov"||n==="quicktime")||i.includes("mxf")&&n==="mxf"||i.includes("mp4")&&(n==="mp4"||n==="mpeg-4"))}function VT(e,t){let n=cm(e),i=cm(t);if(n&&i)return n===i;let r=e.toLowerCase(),a=t.toLowerCase();return r.includes(a)||a.includes(r)}function RT(e){let t=e.filter(r=>/\.r3d$/i.test(r.filename)),n=e.filter(r=>!/\.r3d$/i.test(r.filename));if(t.length===0)return e;let i=new Map;for(let r of t){let o=`${r.filename.toLowerCase().replace(/_\d{3}\.r3d$/i,"")}|${r.timecode_start??r.id??""}`,s=i.get(o);(!s||r.filename<s.filename)&&i.set(o,r)}return[...n,...i.values()]}function HT(e){return e?e.split(/[/\\]/).pop()??"":""}var FT={fileName:"a file name",timecode:"source timecode",reelName:"a reel name",totalDuration:"duration data",resolution:"resolution data",bitDepth:"bit-depth data",frameRate:"frame-rate data",fileFormat:"container/format data",codec:"codec data",mediaUmid:"a UMID/clip-ID"};function En(e,t){let n=e.length,i=0;for(let r of e)r!=null&&r!==""&&i++;return Uz(i,n,t)}function Uz(e,t,n){return t===0?{populated:0,total:0,available:!0,unavailable_reason:null}:e===0?{populated:e,total:t,available:!1,unavailable_reason:`No clips in this timeline carry ${FT[n]}.`}:{populated:e,total:t,available:!0,unavailable_reason:null}}function MT(e){let t=e.vendor_metadata??{},n=["umid","media_umid","clip_id","mxf_umid","package_uid","material_package_uid","source_package_uid","mob_id","MobID","avid_mob_id","MasterMobID","SourceMobID","SourceID","media_pool_item_id"];for(let i of n){let r=t[i];if(typeof r=="string"&&r.length>0)return r}return null}function Tc(e){for(let t of e.streams??[]){if(t.kind!=="video")continue;if(typeof t.bit_depth=="number")return t.bit_depth;let n=t.codec_specific;if(!n)continue;let i=n.BitDepth??n.bit_depth??n.bits_per_sample;if(typeof i=="number")return i;if(typeof i=="string"&&/^\d+$/.test(i))return parseInt(i,10)}return null}function Ez(e){let t=e.length,i=e.map(r=>HT(r.target_url)).filter(r=>r.length>0).length;return{fileName:Uz(i,t,"fileName"),timecode:En(e.map(r=>r.source_timecode),"timecode"),reelName:En(e.map(r=>r.reel_name),"reelName"),totalDuration:En(e.map(r=>{let a=r.available_range?.duration;if(a&&a.value!=null&&a.rate)return a.value;let o=r.declared_duration;return o&&o.value!=null&&o.rate?o.value:null}),"totalDuration"),resolution:En(e.map(r=>r.source_resolution_w&&r.source_resolution_h?`${r.source_resolution_w}\xD7${r.source_resolution_h}`:null),"resolution"),bitDepth:En(e.map(r=>Tc(r)),"bitDepth"),frameRate:En(e.map(r=>r.source_fps??null),"frameRate"),fileFormat:En(e.map(r=>r.container??null),"fileFormat"),codec:En(e.map(r=>r.codec??null),"codec"),mediaUmid:En(e.map(r=>MT(r)),"mediaUmid")}}function Yz(e){let t=Xc(e.target_url);return{id:e.id,filename:t,original_path:e.target_url??null,container:e.container??null,codec:e.codec??null,size_bytes:e.size_bytes??null,duration_seconds:e.available_range?.duration?.value?e.available_range.duration.value/(e.available_range.duration.rate??1):e.declared_duration?.value&&e.declared_duration.rate?e.declared_duration.value/e.declared_duration.rate:null,duration_rate:e.available_range?.duration?.rate??e.declared_duration?.rate??null,duration_frames:e.available_range?.duration?.value??(typeof e.vendor_metadata?.frame_count=="number"?e.vendor_metadata.frame_count:null),timecode_start:e.source_timecode??null,reel_name:e.reel_name??null,reel_sources:e.reel_sources,resolution_w:e.source_resolution_w??null,resolution_h:e.source_resolution_h??null,fps:e.source_fps??null,bit_depth:Tc(e),media_umid:e.vendor_metadata?.umid??null,facts_origin:e.source_facts_origin??null}}function Gz(e){return{...Yz(e),path:e.local_path??e.target_url??null}}function Kz(e,t){let n=Yz(t),i=Bz(e,t);i&&(n.cut_timecode_start=i.tcStart,n.cut_duration_frames=i.durFrames);let r=Oe(t.source_timecode,t.source_fps??24);return(t.source_facts_origin??"declared")!=="probed"&&(r==null||r===0)&&(n.tc_unrecorded=!0),n}function Bz(e,t){let n=t.source_fps??24,i=Oe(t.source_timecode,n);if(i==null)return null;let r=1/0,a=-1/0;for(let o of e.timelines??[])for(let s of o.tracks??[])for(let c of s.items??[])if(c.media_reference_id===t.id&&c.source_range){let l=i+c.source_range.start.value,u=l+(c.source_range.duration?.value??0);l<r&&(r=l),u>a&&(a=u)}return r===1/0?null:{tcStart:qe(r,n,fm(t.source_timecode)),durFrames:Math.max(0,a-r)}}var ei=/_S\d{3}$/i,kn=e=>((e??"").split(/[/\\]/).pop()??"").replace(/\.[^.]+$/,"");function RJ(e,t,n){let i=[];if(!t.filter(c=>ei.test(kn(c.target_url))).length)return{session:e,splits:i};let a=structuredClone(e),o=(a.timelines??[]).flatMap(c=>(c.tracks??[]).flatMap(l=>l.items??[])),s=[];for(let c of a.media_references??[]){if((c.binding_state??"unbound")==="linked"||n&&!n.has(c.id))continue;let l=kn(c.target_url).toLowerCase();if(!l||ei.test(l))continue;let u=t.filter(P=>{let T=kn(P.target_url).toLowerCase();return T===l||ei.test(T)&&T.replace(ei,"")===l});if(!u.some(P=>ei.test(kn(P.target_url))))continue;let f=c.source_fps??24,m=Oe(c.source_timecode,f),d=o.filter(P=>P.media_reference_id===c.id&&P.source_range);if(m==null||d.length===0)continue;let p=fm(c.source_timecode),v=(P,T,j)=>Oc(P.source_timecode,P.available_range?.duration?.value??null,qe(T,f,p),j,f).contains,h=Bz(a,c);if(h&&u.some(P=>!ei.test(kn(P.target_url))&&Oc(P.source_timecode,P.available_range?.duration?.value??null,h.tcStart,h.durFrames,f).contains))continue;let b=new Map,g=!0;for(let P of d){let T=m+P.source_range.start.value,j=u.find(X=>ei.test(kn(X.target_url))&&v(X,T,P.source_range.duration?.value??0));if(!j){g=!1;break}b.set(j,[...b.get(j)??[],P])}if(!g)continue;let y=[...b].sort((P,T)=>kn(P[0].target_url).localeCompare(kn(T[0].target_url))),x=[],z=kn(c.target_url),S=structuredClone(c);y.forEach(([P,T],j)=>{let X=kn(P.target_url),w=F=>{if(!F)return F;let C=Math.max(F.lastIndexOf("/"),F.lastIndexOf("\\"))+1,R=F.slice(C);return R.startsWith(z)?F.slice(0,C)+X+R.slice(z.length):F},N=j===0?c:{...structuredClone(S),id:`${c.id}~${X.slice(-4)}`};N.target_url=w(S.target_url)??N.target_url,S.local_path&&(N.local_path=w(S.local_path)??N.local_path);for(let F of T)F.media_reference_id=N.id;j>0&&s.push(N),x.push(N.id)}),i.push({ref_id:c.id,into:x})}return i.length?(a.media_references=[...a.media_references??[],...s],{session:a,splits:i}):{session:e,splits:i}}function Az(e,t,n,i=!1){let r=new Map;for(let f of t)r.set(f.id,f);let a=[],o=new Set;for(let f of n){let m=r.get(f.candidate_id);m&&(a.push({ref_id:f.proxy_id,to:{path:m.local_path??m.target_url??"",size_bytes:m.size_bytes??null,resolution_w:m.source_resolution_w??null,resolution_h:m.source_resolution_h??null,codec:m.codec??null,container:m.container??null,fps:m.source_fps??null,bit_depth:Tc(m),reel_name:m.reel_name??null,timecode:m.source_timecode??null,recipe:m.recipe??null,frame_count:m.available_range?.duration?.value??null,pixel_aspect:m.source_pixel_aspect??null,bitrate_bps:m.bitrate_bps??null,local_path:m.local_path??null,vendor_metadata:m.vendor_metadata??null,reel_sources:m.reel_sources??null},confidence:f.confidence,reasons:f.reasons}),o.add(m.id))}let s=IT(e)?structuredClone(e):e,l=vc(s,{matches:a}).meta?.applied??[],u=i?(s.media_references??[]).filter(f=>!o.has(f.id)):s.media_references??[];return{session:{...s,media_references:u},applied:l}}function IT(e){return Object.isFrozen(e)||Object.isFrozen(e.media_references??{})||(e.media_references??[]).some(t=>Object.isFrozen(t)||Object.isFrozen(t.metadata??{}))}function Xc(e){return e?e.split(/[/\\]/).pop()??"":""}var Cz=(e,t)=>`${Xc(e)}|${t}`,qT=2;function Qz(e,t){let n=new Map,i=new Map;for(let c of t){n.set(Cz(c.source_path,c.source_in),c);let l=Xc(c.source_path);(i.get(l)??(i.set(l,[]),i.get(l))).push(c)}let r=e.media_references??(e.media_references=[]),a=new Map(r.map(c=>[c.id,c])),o=0,s=0;for(let c of e.timelines??[])for(let l of c.tracks??[])for(let u of l.items??[]){if(!u.media_reference_id)continue;let f=a.get(u.media_reference_id);if(!f){s++;continue}let m=u.source_range?.start?.value??0,d=f.target_url??"",p=n.get(Cz(d,m));if(!p&&d&&(p=DT(i.get(Xc(d)),m)),!p){s++;continue}let v={...f,id:crypto.randomUUID(),kind:"external",content_kind:f.content_kind??"video",target_url:p.render_path,local_path:p.render_path,size_bytes:null,source_timecode:p.render_start_tc??f.source_timecode,available_range:{start:{value:0,rate:p.rate},duration:{value:p.render_frames,rate:p.rate}}};r.push(v),a.set(v.id,v),u.media_reference_id=v.id;let h=u.source_range?.duration??{value:p.render_frames,rate:p.rate};if(u.source_range={start:{value:p.lead_handle,rate:p.rate},duration:h},p.render_start_frame!=null){let b=u.raw_extraction??(u.raw_extraction={});b.alternateFrame=p.render_start_frame}o++}return{matched:o,unmatched:s}}function DT(e,t){if(!e||e.length===0)return;let n,i=1/0,r=!1;for(let a of e){let o=Math.abs(a.source_in-t);o<i?(i=o,n=a,r=!1):o===i&&(r=!0)}if(!(!n||i>qT||r))return n}async function _z(e){await Ar();try{return mc(L3(e))}catch{return null}}async function $z(e){await Ar();try{return mc(N3(e))}catch{return null}}var JT=/\.(dpx|exr|tif|tiff|cin|ari|arx|jpg|jpeg|png)$/i;function Zm(e){if(!JT.test(e))return null;let t=e.match(/^(.*?)(\d{3,})(\.[^.]+)$/);return t?{stem:t[1],frame:parseInt(t[2],10),digits:t[2].length,ext:t[3].toLowerCase()}:null}var UT=new Set([".png",".jpg",".jpeg",".jpe",".jfif",".tif",".tiff",".exr",".dpx",".dng",".cr3"]),ET=new Set([".webp",".avif",".heic",".heif",".gif",".bmp"]),Wm=e=>UT.has(it(e).toLowerCase());async function Vm(e){let t=it(e).toLowerCase();if(ET.has(t))throw new Error(`${G(e)}: ${t.slice(1)} stills are not decoded by the engine yet \u2014 save it as PNG or JPEG`);let n=t===".png"?_z:t===".jpg"||t===".jpeg"||t===".jpe"||t===".jfif"?$z:t===".dpx"?R3:t===".exr"?pc:t===".tif"||t===".tiff"?I3:t===".dng"?F3:t===".cr3"?M3:null;if(!n)throw new Error(`unsupported still: ${G(e)}`);let i=await n(await dt(e));if(!i)throw new Error(`could not decode ${G(e)}`);return{rgba:new Uint8Array(i.rgba.buffer,i.rgba.byteOffset,i.rgba.byteLength),width:i.width,height:i.height}}var CT=["none","rle","zips","zip","piz","pxr24","b44","b44a","dwaa","dwab"];async function e0(e){let t=await H3(await dt(e));if(!t)return null;let n=t.attributes??{},i=/^(\d+)\/(\d+)$/.exec(n.framesPerSecond??"");return{meta:t,fps:i&&+i[2]?+i[1]/+i[2]:null,timecode:n.timeCode??null}}async function rU(e){let t=it(e).toLowerCase(),n={file:G(e),width:null,height:null,fps:null,timecode:null};if(t===".exr"){let r=await e0(e);r&&Object.assign(n,{width:r.meta.width,height:r.meta.height,fps:r.fps,timecode:r.timecode,exr:{compression:r.meta.compression,channels:r.meta.channels.map(a=>a.name),attributes:r.meta.attributes??{}}})}else{let r=await V3(t.slice(1),W3(await dt(e)));if(r)Object.assign(n,{width:r.width,height:r.height});else{let a=await Vm(e);Object.assign(n,{width:a.width,height:a.height})}}let i=Zm(G(e));if(i){let r=[],a=G(e),o=G(e);for await(let l of mt(Ge(e))){let u=l.isFile?Zm(l.name):null;!u||u.stem!==i.stem||u.digits!==i.digits||u.ext!==i.ext||r.push(u.frame)}r.sort((l,u)=>l-u);let s=l=>`${i.stem}${String(l).padStart(i.digits,"0")}${i.ext}`;a=s(r[0]),o=s(r[r.length-1]);let c=null;if(t===".exr"&&(c=(await e0(A(Ge(e),a)).catch(()=>null))?.timecode??null),!c&&n.timecode&&n.fps){let l=Oe(n.timecode,n.fps);l!=null&&(c=qe(l-(i.frame-r[0]),n.fps,n.timecode.includes(";")))}n.sequence={first:a,last:o,frames:r.length,first_frame:r[0],last_frame:r[r.length-1],missing:r[r.length-1]-r[0]+1-r.length,start_tc:c,index:r.indexOf(i.frame)}}return n}function iU(e){let t=e.fps?String(Math.round(e.fps*1e3)/1e3):null;return[`${e.file}: still${e.exr?` OpenEXR (${CT[e.exr.compression]??e.exr.compression}, channels ${e.exr.channels.join(",")})`:""}, ${e.width??"?"}x${e.height??"?"}`,e.exr?`header: ${t?`${t} fps`:"no framesPerSecond"}; ${e.timecode?`timeCode ${e.timecode}`:"no timeCode"} (what the file says, not a timeline's declaration)`:"",e.sequence?`sequence: ${e.sequence.first} \u2026 ${e.sequence.last}, ${e.sequence.frames} frames (${e.sequence.first_frame}\u2013${e.sequence.last_frame}${e.sequence.missing?`, ${e.sequence.missing} MISSING`:""})${e.sequence.start_tc?`, starts ${e.sequence.start_tc}`:""}; this is frame ${e.sequence.index} of it`:"",e.exr&&Object.keys(e.exr.attributes).length?`attributes: ${Object.entries(e.exr.attributes).filter(([n])=>!["channels","chlist"].includes(n)).map(([n,i])=>`${n}=${i.length>60?i.slice(0,60)+"\u2026":i}`).join("; ")}`:""].filter(Boolean).join(`
|
|
5
5
|
`)}var n0=.35,YT=e=>(/\.[^./]+$/.exec(e)?.[0]??"").toLowerCase();async function GT(e,t){let n=await t(await dt(e));if(!n)throw new Error(`could not decode ${G(e)}`);return n}async function KT(e,t){if(e.codec==="still")return Vm(e.path);if(e.codec==="exr"){let n=await D3(e.path);return GT(n.frames[t]??n.frames[0],pc)}return E3(e.path,t,e.codec)}async function $o(e){if(Wm(e)&&YT(e)!==".exr")return{path:e,name:G(e),fps:24,start:0,df:!1,frames:1,codec:"still"};let t=await Qr(e),n=t.streams?.find(a=>a.kind==="video");if(!n)throw new Error(`${G(e)} has no video`);let i=t.source_fps??n.rate??24,r=t.source_timecode??null;return{path:e,name:G(e),fps:i,start:r?Oe(r,i)??0:0,df:!!r?.includes(";"),frames:t.available_range?.duration?.value??0,codec:(n.codec??"").toLowerCase()}}var $e=(e,t)=>qe(e.start+t,e.fps,e.df);function ti(e,t){let n=t==null?Math.floor(e.frames/2):Co(t,e.fps,e.start?$e(e,0):null);if(e.frames&&(n<0||n>=e.frames))throw new Error(`frame ${n} is outside ${e.name} (0\u2013${e.frames-1}, ${$e(e,0)}\u2013${$e(e,e.frames-1)})`);return n}async function vU(e){if(e.out_path&&!/\.png$/i.test(e.out_path))throw new He("invalid_args",`out_path must be a .png file (${G(e.out_path)})`);let t=await $o(e.path),n=ti(t,e.frame),i=e.b?await $o(e.b):null,r=i?e.b_frame!=null?ti(i,e.b_frame):ti(i,$e(t,n)):0,a=Math.max(0,Math.floor(e.around??0)),o=Math.max(1,Math.floor(e.step??1)),s=Array.from({length:2*Math.floor(a/o)+1},(P,T)=>(T-Math.floor(a/o))*o),c=s.length>1||!!i,l=[{clip:t,frames:s.map(P=>n+P)}];i&&l.push({clip:i,frames:s.map(P=>r+P)});let u=[];for(let P of l){let T=[];for(let j of P.frames){if(j<0||P.clip.frames&&j>=P.clip.frames){T.push(null);continue}let X=await KT(P.clip,j),w=e.width??(c?Math.min(X.width,480):X.width),N=w===X.width?{rgba:X.rgba,w:X.width,h:X.height}:BT(X.rgba,X.width,X.height,w);T.push({...N,label:`${i?P.clip===t?"A ":"B ":""}${$e(P.clip,j)} f${j}`})}u.push(T)}let f=u.flat().filter(Boolean);if(!f.length)throw new Error("no frame in range");let m=Math.max(...f.map(P=>P.w)),d=Math.max(...f.map(P=>P.h)),p=Math.max(1,Math.round(m/240)),v=c?7*p+6:0,h=c?4:0,b=s.length*m+(s.length-1)*h,g=l.length*(d+v)+(l.length-1)*h,y=new Uint8Array(b*g*4);for(let P=3;P<y.length;P+=4)y[P]=255;u.forEach((P,T)=>P.forEach((j,X)=>{if(!j)return;let w=X*(m+h),N=T*(d+v+h);for(let F=0;F<j.h;F++)y.set(j.rgba.subarray(F*j.w*4,(F+1)*j.w*4),((N+F)*b+w)*4);c&&QT(y,b,w+3,N+d+3,j.label,p)}));let x=e.out_path??A(await Ki("conform-frame-"),`${t.name.replace(/\.[^.]+$/,"")}_${$e(t,n).replace(/[:;]/g,"")}${i?"_AB":a?`_pm${a}`:""}.png`);await Gi(x,await eX(y,b,g));let z=l.flatMap(P=>P.frames.filter(T=>T>=0&&(!P.clip.frames||T<P.clip.frames)).map(T=>({file:P.clip.name,frame:T,tc:$e(P.clip,T)}))),S;if(i){let P=s.map((X,w)=>({o:X,a:u[0][w],b:u[1][w]})).filter(X=>X.a&&X.b),T=X=>({w:X.w,h:X.h,y:Array.from({length:X.w*X.h},(w,N)=>X.rgba[N*4+1])}),j=await Yr({op:"pairs",pairs:P.map(X=>[T(X.a),T(X.b)])});S=P.map((X,w)=>{let N=j.distance[w]??1/0;return{a_frame:n+X.o,b_frame:r+X.o,tc:$e(t,n+X.o),distance:N,same:N<=n0}})}return{out_path:x,w:b,h:g,frames:z,...S?{diff:S}:{}}}function hU(e){let t=`wrote ${e.out_path} (${e.w}x${e.h} PNG, ${e.frames.length} frame${e.frames.length>1?"s":""})`;if(!e.diff)return[t,...e.frames.map(i=>`${i.file} f${i.frame} ${i.tc}`)].join(`
|
|
6
6
|
`);let n=e.diff[e.diff.length>>1];return[`${n?.same?"A and B show the same picture":"A and B DIFFER"} at A ${n?.tc??"?"} (distance ${n?.distance??"?"}; 0 = identical, \u2264${n0} = same picture through a grade/burn-in/rescale; a neighbouring frame also scores low, so prove the frame offset with media_align)`,t,...e.diff.map(i=>`A f${i.a_frame} vs B f${i.b_frame} (A ${i.tc}): ${i.distance}${i.same?"":" DIFFERENT"}`)].join(`
|
|
7
7
|
`)}function BT(e,t,n,i){i=Math.max(1,Math.round(i));let r=Math.max(1,Math.round(n*i/t)),a=new Uint8Array(i*r*4);for(let o=0;o<r;o++){let s=Math.floor(o*n/r),c=Math.max(s+1,Math.floor((o+1)*n/r));for(let l=0;l<i;l++){let u=Math.floor(l*t/i),f=Math.max(u+1,Math.floor((l+1)*t/i)),m=0,d=0,p=0,v=0;for(let b=s;b<c;b++)for(let g=u;g<f;g++){let y=(b*t+g)*4;m+=e[y],d+=e[y+1],p+=e[y+2],v++}let h=(o*i+l)*4;a[h]=m/v,a[h+1]=d/v,a[h+2]=p/v,a[h+3]=255}}return{rgba:a,w:i,h:r}}var AT={0:[14,17,19,21,25,17,14],1:[4,12,4,4,4,4,14],2:[14,17,1,2,4,8,31],3:[31,2,4,2,1,17,14],4:[2,6,10,18,31,2,2],5:[31,16,30,1,1,17,14],6:[6,8,16,30,17,17,14],7:[31,1,2,4,8,8,8],8:[14,17,17,14,17,17,14],9:[14,17,17,15,1,2,12],":":[0,12,12,0,12,12,0],";":[0,12,12,0,12,4,8],"+":[0,4,4,31,4,4,0],"-":[0,0,0,31,0,0,0],A:[14,17,17,31,17,17,17],B:[30,17,17,30,17,17,30],f:[6,9,8,28,8,8,8]};function QT(e,t,n,i,r,a){for(let o of r){let s=AT[o];if(s){for(let c=0;c<7;c++)for(let l=0;l<5;l++)if(s[c]>>4-l&1)for(let u=0;u<a;u++)for(let f=0;f<a;f++){let m=((i+c*a+u)*t+n+l*a+f)*4;e[m]=e[m+1]=e[m+2]=255}}n+=6*a}}var _T=Array.from({length:256},(e,t)=>{let n=t;for(let i=0;i<8;i++)n=n&1?3988292384^n>>>1:n>>>1;return n>>>0});function $T(e){let t=4294967295;for(let n of e)t=_T[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}async function eX(e,t,n){let i=new Uint8Array(n*(t*3+1));for(let f=0,m=0;f<n;f++){i[m++]=1;for(let d=0;d<t;d++){let p=(f*t+d)*4;for(let v=0;v<3;v++)i[m++]=e[p+v]-(d?e[p+v-4]:0)&255}}let r=new Uint8Array(await new Response(new Blob([i]).stream().pipeThrough(new CompressionStream("deflate"))).arrayBuffer()),a=(f,m)=>{let d=new Uint8Array(12+m.length),p=new DataView(d.buffer);return p.setUint32(0,m.length),d.set(new TextEncoder().encode(f),4),d.set(m,8),p.setUint32(8+m.length,$T(d.subarray(4,8+m.length))),d},o=new Uint8Array(13),s=new DataView(o.buffer);s.setUint32(0,t),s.setUint32(4,n),o[8]=8,o[9]=2;let c=[new Uint8Array([137,80,78,71,13,10,26,10]),a("IHDR",o),a("IDAT",r),a("IEND",new Uint8Array(0))],l=new Uint8Array(c.reduce((f,m)=>f+m.length,0)),u=0;for(let f of c)l.set(f,u),u+=f.length;return l}async function r0(e){let t=await $o(e.a),n=await $o(e.b),i=e.a_in!=null?ti(t,e.a_in):0,r=e.a_out!=null?ti(t,e.a_out):t.frames?t.frames-1:void 0;if(r!=null&&r<i)throw new Error(`a_out (${r}) is before a_in (${i})`);let a=e.b_in!=null?ti(n,e.b_in):null,o=await Yr({op:"align",a:e.a,b:e.b,aIn:i,aOut:r,bIn:a,search:Math.max(1,Math.floor(e.search??12)),aFrames:t.frames||void 0,bFrames:n.frames||void 0},void 0,e.signal),s=d=>({a_in:d.aIn,a_out:d.aOut,a_tc:$e(t,d.aIn),verdict:d.verdict,offset:d.offset,confidence:d.confidence,...d.ambiguous?{ambiguous:d.ambiguous}:{},cost:d.cost}),[c,l]=o.aRange,u=o.bIn,f=s(o.overall),m=o.flash.map(d=>d.kind==="inside"?`B has a shot change inside the range that A does not, at B ${$e(n,d.at.b)} (A ${$e(t,d.at.a)}): a flash frame / wrong shot`:d.kind==="early"?`B cuts ${d.frames} frame(s) before the head (B ${$e(n,d.at.b)}): a ${d.frames}-frame slip early shows the previous shot`:`B cuts ${d.frames} frame(s) after the tail (B ${$e(n,d.at.b)}): a slip late shows the next shot`);return a!=null&&f.offset&&m.unshift(`the client's in-point ${$e(n,a)} is ${f.offset>0?"early":"late"} by ${Math.abs(f.offset)} frame(s): the measured in-point is ${$e(n,u)}`),{a:t.name,b:n.name,a_range:[c,l],a_tc:[$e(t,c),$e(t,l)],proposed_b_in:a,b_in:u,b_tc:$e(n,u),searched:a==null,overall:f,shots:o.shots.map(s),anchors:o.anchors.map(d=>({a_cut:d.aCut,tc:$e(t,d.aCut+1),in_b:d.inB})),flash:m}}function bU(e){let t=e.overall,n=t.verdict==="exact"?`EXACT: ${e.a} ${e.a_tc[0]} = ${e.b} ${e.b_tc} (confidence ${t.confidence})`:t.verdict==="offset"?`OFFSET ${t.offset>0?"+":""}${t.offset} frame(s): ${e.a} ${e.a_tc[0]} = ${e.b} ${e.b_tc}${e.proposed_b_in!=null?" (not the client's in-point)":""} (confidence ${t.confidence})`:t.verdict==="unverifiable"?`UNVERIFIABLE: offsets ${t.ambiguous[0]}\u2026${t.ambiguous[1]} fit equally (static picture, no shot change to anchor on)`:`NO MATCH: ${e.a} ${e.a_tc[0]}\u2013${e.a_tc[1]} is not in ${e.b} within the searched frames (cost ${t.cost})`,i=r=>` shot A ${r.a_tc} (f${r.a_in}\u2013${r.a_out}): ${r.verdict}${r.offset?` ${r.offset>0?"+":""}${r.offset}`:""}${r.ambiguous?` (${r.ambiguous[0]}\u2026${r.ambiguous[1]})`:""}, confidence ${r.confidence}`;return[n,`A ${e.a} ${e.a_tc[0]}\u2013${e.a_tc[1]} (${e.a_range[1]-e.a_range[0]+1} frames) vs B ${e.b}${e.searched?" (searched all of B)":` from ${e.b_tc}`}; offset = measured \u2212 client in-point (+ = later in B)`,`anchors: ${e.anchors.length?`${e.anchors.filter(r=>r.in_b).length} of ${e.anchors.length} shot change(s) in A are in B at the same frame`:"no shot change inside the range: the offset rests on motion alone"}`,`shots (${e.shots.length}):`,...e.shots.map(i),...e.flash.length?["flash-frame risk:",...e.flash.map(r=>` ${r}`)]:["flash-frame risk: none found (no B shot change within 3 frames of the range ends)"]].join(`
|
|
8
|
-
`)}var t0=(e,t)=>[...e].sort((n,i)=>n.track_index-i.track_index).indexOf(t)+1;function tX(e,t){let n=e.timelines.filter(b=>!t.timeline||b.id===t.timeline||b.name===t.timeline),i=t.item_id?n.find(b=>b.tracks.some(g=>g.items.some(y=>y.id===t.item_id))):n.find(b=>b.kind==="primary")??n[0];if(!i)throw new Error(t.item_id?`no item ${t.item_id} in this session`:`no timeline ${t.timeline??""} in this session`);let r=_e(i),a=i.start_frame??0,o=!!i.is_drop_frame,s=t.record!=null?Co(t.record,r,qe(a,r,o)):null,c=i.tracks.filter(b=>b.kind==="Video"),l;if(t.item_id){for(let b of c)for(let g of b.items)g.id===t.item_id&&(l={it:g,tr:b});if(!l)throw new Error(`${t.item_id} is not a video clip`)}else{if(s==null)throw new Error("give item_id or record (a record TC or frame)");let b=t.track?c.filter(g=>t0(c,g)===t.track):c.filter(g=>g.enabled!==!1);for(let g of[...b].sort((y,x)=>x.track_index-y.track_index)){let y=g.items.find(x=>x.kind==="clip"&&x.enabled!==!1&&x.timeline_range.start.value<=s&&s<x.timeline_range.start.value+x.timeline_range.duration.value);if(y){l={it:y,tr:g};break}}if(!l)throw new Error(`no enabled video clip at record ${qe(a+s,r,o)}`)}let{it:u,tr:f}=l,m=e.media_references.find(b=>b.id===u.media_reference_id),d=m?.local_path??m?.target_url?.replace(/^file:\/\//,"");if(!d||!u.source_range)throw new Error(`${u.name??u.id} has no linked media (relink it first)`);let p=u.timeline_range.start.value,v=s!=null?s-p:0;if(v<0||v>=u.timeline_range.duration.value)throw new Error(`record ${s} is outside ${u.name??u.id}`);let h=Math.round(u.source_range.start.value)+Math.floor(v*u.source_range.duration.value/Math.max(1,u.timeline_range.duration.value));return{path:d,frame:h,item:u.id,track:f.name??`V${f.track_index}`,record_tc:qe(a+p+v,r,o),video_track:t0(c,f),record_start:p}}var Rm=new Map,Hm=null,nX=0;async function rX(e,t,n,i,r,a){if(r==="offline"){let d=e.timelines.find(b=>!i||b.id===i||b.name===i)??e.timelines[0],{offlineLane:p}=await import("./framing-P5RGN5V3.js"),{lane:v,media:h}=await p(e,d);d.tracks.push(v),e.media_references.push(...h);try{return await rX(e,t,n,i,d.tracks.filter(b=>b.kind==="Video").length)}finally{d.tracks.splice(d.tracks.indexOf(v),1),e.media_references=e.media_references.filter(b=>!h.includes(b))}}let o=tX(e,{record:t,timeline:i,track:r});if(Wm(o.path))return null;let s=Rm.get(o.path);s||(s=$o(o.path),Rm.set(o.path,s),s.catch(()=>Rm.delete(o.path)));let c=await s;if(c.codec==="still")return null;let l=await(Hm??=P3().catch(d=>{throw Hm=null,d})),u=A(Te(),"tmp",`picture-${process.pid}-${nX++%1024}.raw`);await We(A(Te(),"tmp"));let f=await l.ask({op:"picture",path:o.path,frame:ti(c,o.frame),width:n,out:u,...a?{lut:a}:{}});if(!f.ok)throw f.why?.startsWith("the analysis engine exited")&&(Hm=null),new Error(f.why==="no_picture"?`no picture at frame ${o.frame} of ${G(o.path)}`:f.why??"no picture");let m=await dt(u);return await fc(u).catch(()=>{}),{w:f.w,h:f.h,px:m,order:f.order??"rgba"}}var iX=new Set(["mov","mp4","m4v","mxf","avi","mkv","mts","m2ts","webm","r3d","braw","ari","arx","arri","crm","dng","dpx","exr","png","jpg","jpeg","tif","tiff","wav","aif","aiff","psd","tga","bmp","gif","webp","avif"]),aX={...Y3,fileName:!0,fileNameMode:"tight"};function XU(e){return{...aX,...e?.file_name!=null?{fileName:e.file_name}:{},...e?.file_name_mode?{fileNameMode:e.file_name_mode}:{},...e?.reel_name!=null?{reelName:e.reel_name}:{},...e?.total_duration!=null?{totalDuration:e.total_duration}:{},...e?.resolution!=null?{resolution:e.resolution}:{},...e?.bit_depth!=null?{bitDepth:e.bit_depth}:{},...e?.file_format!=null?{fileFormat:e.file_format}:{},...e?.codec!=null?{codec:e.codec}:{},...e?.media_umid!=null?{mediaUmid:e.media_umid}:{},...e?.extensions?.length?{fileExtensions:e.extensions.join(",")}:{}}}function jU(e,t){let n=new Map;for(let r of e.timelines)for(let a of r.tracks)for(let o of a.items)o.media_reference_id&&(n.get(o.media_reference_id)??n.set(o.media_reference_id,new Set).get(o.media_reference_id)).add(a.kind);let i=t.ref_ids?new Set(t.ref_ids):null;return(e.media_references??[]).filter(r=>{if(!n.has(r.id)||i&&!i.has(r.id)||!t.reset&&r.binding_state==="linked")return!1;if(t.lane&&t.lane!=="both"){let a=n.get(r.id),o=a.has("Video"),s=a.has("Audio");if(t.lane==="video"&&!o||t.lane==="audio"&&!s)return!1}return!0})}var es=e=>e.replace(/\.[^.]+$/,"");async function NU(e,t,n=2e3){let i=t.map(l=>Un(es(G(l.target_url??l.reel_name??"")).toLowerCase())).filter(Boolean),r=new Set(t.map(l=>um(G(l.target_url??""))?.clipBase.toLowerCase()).filter(Boolean)),a=l=>{if(!i.length)return!0;let u=um(l)?.clipBase.toLowerCase();if(u&&r.has(u))return!0;let f=Un(es(l.toLowerCase()));return!!f&&i.some(m=>Sc(m,f)>=.5)},o=[],s=!1;async function c(l,u){if(u>12||s)return;let f=[];try{for await(let m of mt(l))f.push(m)}catch{return}for(let m of f){if(m.name.startsWith("."))continue;let d=A(l,m.name);if(m.isDirectory){await c(d,u+1);continue}if(!m.isFile)continue;let p=it(m.name).slice(1).toLowerCase();if(!(!iX.has(p)||!a(m.name))&&(o.push(d),o.length>=n)){s=!0;return}}}return await c(e,0),{paths:o,capped:s}}async function LU(e,t){let n=t.split(/[/\\]/).filter(Boolean),i=G(e).toLowerCase(),r=[];for(let a=n.length-2;a>=0;a--)n[a].toLowerCase()===i&&r.push(n.slice(a+1));r.push([n[n.length-1]]);for(let a of r){let o=A(e,...a);try{if((await Ci(o)).isFile)return o}catch{}}return null}async function ZU(e){let t=[],n=[],i=new Set,r=0;for(let a of e){let o=await U3(a).catch(()=>[a]);if(!i.has(o[0])){o.forEach(s=>i.add(s));try{let s=await Qr(o[0]);s.id=`cand-${++r}`,s.binding_state="unbound",t.push(s)}catch(s){n.push(`${G(a)}: ${s.message.slice(0,80)}`),t.push({id:`cand-${++r}`,kind:"external",target_url:o[0],local_path:o[0],reel_name:es(G(o[0])),binding_state:"unbound",streams:[],raw_extraction:{},metadata:{}})}}}return{refs:t,failed:n}}function WU(e,t,n,i,r){let a=t.map(f=>Kz(e,f)),o=n.map(Gz),s=kc(a,o,i,r),c=kc(a,o,{...i,reelName:!1,totalDuration:!1,resolution:!1,bitDepth:!1,fileFormat:!1,codec:!1,mediaUmid:!1,fileNameMode:"loose"},r),l=new Map(n.map(f=>[f.id,f]));return{rows:t.map(f=>{let m=s.matches.find(h=>h.proxy_id===f.id),d=s.ambiguous.find(h=>h.proxy_id===f.id),p=s.refusals?.filter(h=>h.proxy_id===f.id).map(h=>`${G(l.get(h.candidate_id)?.target_url??h.candidate_id)}: ${h.reason}`).join("; "),v=new Set;for(let h of c.matches)h.proxy_id===f.id&&h.candidate_id!==m?.candidate_id&&v.add(h.candidate_id);for(let h of c.ambiguous)h.proxy_id===f.id&&h.candidate_ids.forEach(b=>b!==m?.candidate_id&&v.add(b));if(d&&d.candidate_ids.forEach(h=>v.add(h)),!m&&!d&&!v.size){let h=Un(es(G(f.target_url??"")).toLowerCase()),b=n.map(g=>({c:g,s:Sc(h,Un(es(G(g.target_url??"")).toLowerCase()))})).filter(g=>g.s>=.4).sort((g,y)=>y.s-g.s)[0];b&&v.add(b.c.id)}return{ref_id:f.id,name:G(f.target_url??f.reel_name??f.id),status:m?"matched":d?"ambiguous":"unmatched",candidate:m?l.get(m.candidate_id):void 0,confidence:m?.confidence??0,reasons:m?.reasons??[],alternatives:[...v].map(h=>l.get(h)).filter(Boolean),refusal:p||void 0}}),result:s,candidates:n,config:i}}var i0=24;async function VU(e,t){let n=[],i=r=>{let a=r.source_fps??r.available_range?.duration.rate??0;return{fps:a,tc:r.source_timecode?Oe(r.source_timecode,a):null}};for(let r of t.rows.filter(a=>a.status!=="unmatched")){let a=e.media_references.find(x=>x.id===r.ref_id),o=a.local_path??a.target_url?.replace(/^file:\/\//,""),s=null;try{o&&(await Ci(o)).isFile&&(s=await Qr(o))}catch{}let c=s&&i(s),l=s?.available_range?.duration.value??0;if(!s||c?.tc==null||l<1)continue;let u=Math.max(0,Math.floor(l/2)-i0/2),f=Math.min(l-1,u+i0-1),m=[...new Set([...r.candidate?[r.candidate.id]:[],...t.result.ambiguous.find(x=>x.proxy_id===r.ref_id)?.candidate_ids??[],...r.alternatives.map(x=>x.id)])],d=new Map;for(let x of m){let z=t.candidates.find(T=>T.id===x),S=z?.local_path??z?.target_url?.replace(/^file:\/\//,""),P=z&&i(z);if(!(!z||!S||P?.tc==null||Math.abs(P.fps-c.fps)>.01))try{let T=await r0({a:o,b:S,a_in:u,a_out:f,b_in:c.tc+u-P.tc,search:2});d.set(x,T.overall.verdict==="offset"?`offset ${T.overall.offset>0?"+":""}${T.overall.offset}`:T.overall.verdict)}catch(T){d.set(x,`unreadable (${String(T.message??T).slice(0,80)})`)}}let p=m.filter(x=>d.get(x)==="exact"),v=x=>t.candidates.find(z=>z.id===x),h=x=>(v(x).target_url??x).replace(/^file:\/\//,"").split("/").slice(-2).join("/"),b=m.filter(x=>d.has(x)).map(x=>`${h(x)}: ${d.get(x)}`).join(", "),g=r.candidate?.id,y=x=>d.has(x)&&d.get(x)!=="exact"&&d.get(x)!=="unverifiable";if(p.length===1&&p[0]!==g){let x=r.candidate;r.status="matched",r.candidate=v(p[0]),r.confidence=1,r.reasons=["picture: the only candidate with the same frames at the same TC"],r.alternatives=[...x?[x]:[],...r.alternatives.filter(z=>z.id!==p[0]&&z.id!==x?.id)],x&&(r.refusal=[r.refusal,`picture: ${h(x.id)} is ${d.get(x.id)??"unread"}`].filter(Boolean).join("; "))}else g&&p.includes(g)?r.reasons=[...r.reasons,p.length>1?`picture: the same frames at the same TC (as ${p.length-1} other copy/copies)`:"picture: the same frames at the same TC"]:g&&y(g)&&(r.refusal=[r.refusal,`picture: ${b} (another picture, or the TC is off by the offset)`].filter(Boolean).join("; "),r.alternatives=[r.candidate,...r.alternatives.filter(x=>x.id!==g)],r.status="unmatched",r.candidate=void 0,r.confidence=0,r.reasons=[]);b&&n.push(`picture ${r.ref_id} ${r.name}: ${b}`)}return n}function oX(e,t,n,i){let r=o=>o.streams?.find(s=>s.kind==="video");return[["file name",i.fileName,G(t.target_url??""),G(n.target_url??"")],["reel",i.reelName,t.reel_name??"\u2014",n.reel_name??"\u2014"],["timecode (cut must be inside)",!0,`${t.source_timecode??"\u2014"}`,`${n.source_timecode??"\u2014"} \xD7 ${n.available_range?.duration?.value??n.declared_duration?.value??"?"} fr`],["fps (must agree)",!0,`${t.source_fps??"\u2014"}`,`${n.source_fps??r(n)?.rate??"\u2014"}`],["duration",i.totalDuration,`${t.declared_duration?.value??"\u2014"} fr`,`${n.available_range?.duration?.value??n.declared_duration?.value??"\u2014"} fr`],["resolution",i.resolution,`${t.source_resolution_w??"\u2014"}x${t.source_resolution_h??"\u2014"}`,`${n.source_resolution_w??r(n)?.width??"\u2014"}x${n.source_resolution_h??r(n)?.height??"\u2014"}`],["bit depth",i.bitDepth,`${r(t)?.bit_depth??"\u2014"}`,`${r(n)?.bit_depth??"\u2014"}`],["format",i.fileFormat,it(t.target_url??"").slice(1)||"\u2014",it(n.target_url??"").slice(1)||"\u2014"],["codec",i.codec,r(t)?.codec??"\u2014",r(n)?.codec??"\u2014"]].map(([o,s,c,l])=>` ${s?"\u2022":"\xB7"} ${o}: ${c} \u2192 ${l}`)}function RU(e,t,n){let i=n.map(r=>({proxy_id:r.ref_id,candidate_id:r.candidate_id,matched_path:t.candidates.find(a=>a.id===r.candidate_id)?.target_url??"",confidence:1,reasons:["accepted"]}));return Az(e,t.candidates,i,!0)}var a0=Te(),o0=A(a0,"locations.json");async function Fm(){try{return JSON.parse(await Qe(o0))}catch{return[]}}async function HU(e){await We(a0);let t=(await Fm()).filter(n=>n!==e);await Ze(o0,JSON.stringify([e,...t].slice(0,12)))}function s0(e){let t=e.media_references??[],n=Ez(t);return Object.entries(n).map(([i,r])=>`- ${i}: ${r.available?"usable":"not usable"} (${r.populated}/${r.total} populated${r.unavailable_reason?`; ${r.unavailable_reason}`:""})`).join(`
|
|
8
|
+
`)}var t0=(e,t)=>[...e].sort((n,i)=>n.track_index-i.track_index).indexOf(t)+1;function tX(e,t){let n=e.timelines.filter(b=>!t.timeline||b.id===t.timeline||b.name===t.timeline),i=t.item_id?n.find(b=>b.tracks.some(g=>g.items.some(y=>y.id===t.item_id))):n.find(b=>b.kind==="primary")??n[0];if(!i)throw new Error(t.item_id?`no item ${t.item_id} in this session`:`no timeline ${t.timeline??""} in this session`);let r=_e(i),a=i.start_frame??0,o=!!i.is_drop_frame,s=t.record!=null?Co(t.record,r,qe(a,r,o)):null,c=i.tracks.filter(b=>b.kind==="Video"),l;if(t.item_id){for(let b of c)for(let g of b.items)g.id===t.item_id&&(l={it:g,tr:b});if(!l)throw new Error(`${t.item_id} is not a video clip`)}else{if(s==null)throw new Error("give item_id or record (a record TC or frame)");let b=t.track?c.filter(g=>t0(c,g)===t.track):c.filter(g=>g.enabled!==!1);for(let g of[...b].sort((y,x)=>x.track_index-y.track_index)){let y=g.items.find(x=>x.kind==="clip"&&x.enabled!==!1&&x.timeline_range.start.value<=s&&s<x.timeline_range.start.value+x.timeline_range.duration.value);if(y){l={it:y,tr:g};break}}if(!l)throw new Error(`no enabled video clip at record ${qe(a+s,r,o)}`)}let{it:u,tr:f}=l,m=e.media_references.find(b=>b.id===u.media_reference_id),d=m?.local_path??m?.target_url?.replace(/^file:\/\//,"");if(!d||!u.source_range)throw new Error(`${u.name??u.id} has no linked media (relink it first)`);let p=u.timeline_range.start.value,v=s!=null?s-p:0;if(v<0||v>=u.timeline_range.duration.value)throw new Error(`record ${s} is outside ${u.name??u.id}`);let h=Math.round(u.source_range.start.value)+Math.floor(v*u.source_range.duration.value/Math.max(1,u.timeline_range.duration.value));return{path:d,frame:h,item:u.id,track:f.name??`V${f.track_index}`,record_tc:qe(a+p+v,r,o),video_track:t0(c,f),record_start:p}}var Rm=new Map,Hm=null,nX=0;async function rX(e,t,n,i,r,a){if(r==="offline"){let d=e.timelines.find(b=>!i||b.id===i||b.name===i)??e.timelines[0],{offlineLane:p}=await import("./framing-4HAHAG4I.js"),{lane:v,media:h}=await p(e,d);d.tracks.push(v),e.media_references.push(...h);try{return await rX(e,t,n,i,d.tracks.filter(b=>b.kind==="Video").length)}finally{d.tracks.splice(d.tracks.indexOf(v),1),e.media_references=e.media_references.filter(b=>!h.includes(b))}}let o=tX(e,{record:t,timeline:i,track:r});if(Wm(o.path))return null;let s=Rm.get(o.path);s||(s=$o(o.path),Rm.set(o.path,s),s.catch(()=>Rm.delete(o.path)));let c=await s;if(c.codec==="still")return null;let l=await(Hm??=P3().catch(d=>{throw Hm=null,d})),u=A(Te(),"tmp",`picture-${process.pid}-${nX++%1024}.raw`);await We(A(Te(),"tmp"));let f=await l.ask({op:"picture",path:o.path,frame:ti(c,o.frame),width:n,out:u,...a?{lut:a}:{}});if(!f.ok)throw f.why?.startsWith("the analysis engine exited")&&(Hm=null),new Error(f.why==="no_picture"?`no picture at frame ${o.frame} of ${G(o.path)}`:f.why??"no picture");let m=await dt(u);return await fc(u).catch(()=>{}),{w:f.w,h:f.h,px:m,order:f.order??"rgba"}}var iX=new Set(["mov","mp4","m4v","mxf","avi","mkv","mts","m2ts","webm","r3d","braw","ari","arx","arri","crm","dng","dpx","exr","png","jpg","jpeg","tif","tiff","wav","aif","aiff","psd","tga","bmp","gif","webp","avif"]),aX={...Y3,fileName:!0,fileNameMode:"tight"};function XU(e){return{...aX,...e?.file_name!=null?{fileName:e.file_name}:{},...e?.file_name_mode?{fileNameMode:e.file_name_mode}:{},...e?.reel_name!=null?{reelName:e.reel_name}:{},...e?.total_duration!=null?{totalDuration:e.total_duration}:{},...e?.resolution!=null?{resolution:e.resolution}:{},...e?.bit_depth!=null?{bitDepth:e.bit_depth}:{},...e?.file_format!=null?{fileFormat:e.file_format}:{},...e?.codec!=null?{codec:e.codec}:{},...e?.media_umid!=null?{mediaUmid:e.media_umid}:{},...e?.extensions?.length?{fileExtensions:e.extensions.join(",")}:{}}}function jU(e,t){let n=new Map;for(let r of e.timelines)for(let a of r.tracks)for(let o of a.items)o.media_reference_id&&(n.get(o.media_reference_id)??n.set(o.media_reference_id,new Set).get(o.media_reference_id)).add(a.kind);let i=t.ref_ids?new Set(t.ref_ids):null;return(e.media_references??[]).filter(r=>{if(!n.has(r.id)||i&&!i.has(r.id)||!t.reset&&r.binding_state==="linked")return!1;if(t.lane&&t.lane!=="both"){let a=n.get(r.id),o=a.has("Video"),s=a.has("Audio");if(t.lane==="video"&&!o||t.lane==="audio"&&!s)return!1}return!0})}var es=e=>e.replace(/\.[^.]+$/,"");async function NU(e,t,n=2e3){let i=t.map(l=>Un(es(G(l.target_url??l.reel_name??"")).toLowerCase())).filter(Boolean),r=new Set(t.map(l=>um(G(l.target_url??""))?.clipBase.toLowerCase()).filter(Boolean)),a=l=>{if(!i.length)return!0;let u=um(l)?.clipBase.toLowerCase();if(u&&r.has(u))return!0;let f=Un(es(l.toLowerCase()));return!!f&&i.some(m=>Sc(m,f)>=.5)},o=[],s=!1;async function c(l,u){if(u>12||s)return;let f=[];try{for await(let m of mt(l))f.push(m)}catch{return}for(let m of f){if(m.name.startsWith("."))continue;let d=A(l,m.name);if(m.isDirectory){await c(d,u+1);continue}if(!m.isFile)continue;let p=it(m.name).slice(1).toLowerCase();if(!(!iX.has(p)||!a(m.name))&&(o.push(d),o.length>=n)){s=!0;return}}}return await c(e,0),{paths:o,capped:s}}async function LU(e,t){let n=t.split(/[/\\]/).filter(Boolean),i=G(e).toLowerCase(),r=[];for(let a=n.length-2;a>=0;a--)n[a].toLowerCase()===i&&r.push(n.slice(a+1));r.push([n[n.length-1]]);for(let a of r){let o=A(e,...a);try{if((await Ci(o)).isFile)return o}catch{}}return null}async function ZU(e){let t=[],n=[],i=new Set,r=0;for(let a of e){let o=await U3(a).catch(()=>[a]);if(!i.has(o[0])){o.forEach(s=>i.add(s));try{let s=await Qr(o[0]);s.id=`cand-${++r}`,s.binding_state="unbound",t.push(s)}catch(s){n.push(`${G(a)}: ${s.message.slice(0,80)}`),t.push({id:`cand-${++r}`,kind:"external",target_url:o[0],local_path:o[0],reel_name:es(G(o[0])),binding_state:"unbound",streams:[],raw_extraction:{},metadata:{}})}}}return{refs:t,failed:n}}function WU(e,t,n,i,r){let a=t.map(f=>Kz(e,f)),o=n.map(Gz),s=kc(a,o,i,r),c=kc(a,o,{...i,reelName:!1,totalDuration:!1,resolution:!1,bitDepth:!1,fileFormat:!1,codec:!1,mediaUmid:!1,fileNameMode:"loose"},r),l=new Map(n.map(f=>[f.id,f]));return{rows:t.map(f=>{let m=s.matches.find(h=>h.proxy_id===f.id),d=s.ambiguous.find(h=>h.proxy_id===f.id),p=s.refusals?.filter(h=>h.proxy_id===f.id).map(h=>`${G(l.get(h.candidate_id)?.target_url??h.candidate_id)}: ${h.reason}`).join("; "),v=new Set;for(let h of c.matches)h.proxy_id===f.id&&h.candidate_id!==m?.candidate_id&&v.add(h.candidate_id);for(let h of c.ambiguous)h.proxy_id===f.id&&h.candidate_ids.forEach(b=>b!==m?.candidate_id&&v.add(b));if(d&&d.candidate_ids.forEach(h=>v.add(h)),!m&&!d&&!v.size){let h=Un(es(G(f.target_url??"")).toLowerCase()),b=n.map(g=>({c:g,s:Sc(h,Un(es(G(g.target_url??"")).toLowerCase()))})).filter(g=>g.s>=.4).sort((g,y)=>y.s-g.s)[0];b&&v.add(b.c.id)}return{ref_id:f.id,name:G(f.target_url??f.reel_name??f.id),status:m?"matched":d?"ambiguous":"unmatched",candidate:m?l.get(m.candidate_id):void 0,confidence:m?.confidence??0,reasons:m?.reasons??[],alternatives:[...v].map(h=>l.get(h)).filter(Boolean),refusal:p||void 0}}),result:s,candidates:n,config:i}}var i0=24;async function VU(e,t){let n=[],i=r=>{let a=r.source_fps??r.available_range?.duration.rate??0;return{fps:a,tc:r.source_timecode?Oe(r.source_timecode,a):null}};for(let r of t.rows.filter(a=>a.status!=="unmatched")){let a=e.media_references.find(x=>x.id===r.ref_id),o=a.local_path??a.target_url?.replace(/^file:\/\//,""),s=null;try{o&&(await Ci(o)).isFile&&(s=await Qr(o))}catch{}let c=s&&i(s),l=s?.available_range?.duration.value??0;if(!s||c?.tc==null||l<1)continue;let u=Math.max(0,Math.floor(l/2)-i0/2),f=Math.min(l-1,u+i0-1),m=[...new Set([...r.candidate?[r.candidate.id]:[],...t.result.ambiguous.find(x=>x.proxy_id===r.ref_id)?.candidate_ids??[],...r.alternatives.map(x=>x.id)])],d=new Map;for(let x of m){let z=t.candidates.find(T=>T.id===x),S=z?.local_path??z?.target_url?.replace(/^file:\/\//,""),P=z&&i(z);if(!(!z||!S||P?.tc==null||Math.abs(P.fps-c.fps)>.01))try{let T=await r0({a:o,b:S,a_in:u,a_out:f,b_in:c.tc+u-P.tc,search:2});d.set(x,T.overall.verdict==="offset"?`offset ${T.overall.offset>0?"+":""}${T.overall.offset}`:T.overall.verdict)}catch(T){d.set(x,`unreadable (${String(T.message??T).slice(0,80)})`)}}let p=m.filter(x=>d.get(x)==="exact"),v=x=>t.candidates.find(z=>z.id===x),h=x=>(v(x).target_url??x).replace(/^file:\/\//,"").split("/").slice(-2).join("/"),b=m.filter(x=>d.has(x)).map(x=>`${h(x)}: ${d.get(x)}`).join(", "),g=r.candidate?.id,y=x=>d.has(x)&&d.get(x)!=="exact"&&d.get(x)!=="unverifiable";if(p.length===1&&p[0]!==g){let x=r.candidate;r.status="matched",r.candidate=v(p[0]),r.confidence=1,r.reasons=["picture: the only candidate with the same frames at the same TC"],r.alternatives=[...x?[x]:[],...r.alternatives.filter(z=>z.id!==p[0]&&z.id!==x?.id)],x&&(r.refusal=[r.refusal,`picture: ${h(x.id)} is ${d.get(x.id)??"unread"}`].filter(Boolean).join("; "))}else g&&p.includes(g)?r.reasons=[...r.reasons,p.length>1?`picture: the same frames at the same TC (as ${p.length-1} other copy/copies)`:"picture: the same frames at the same TC"]:g&&y(g)&&(r.refusal=[r.refusal,`picture: ${b} (another picture, or the TC is off by the offset)`].filter(Boolean).join("; "),r.alternatives=[r.candidate,...r.alternatives.filter(x=>x.id!==g)],r.status="unmatched",r.candidate=void 0,r.confidence=0,r.reasons=[]);b&&n.push(`picture ${r.ref_id} ${r.name}: ${b}`)}return n}function oX(e,t,n,i){let r=o=>o.streams?.find(s=>s.kind==="video");return[["file name",i.fileName,G(t.target_url??""),G(n.target_url??"")],["reel",i.reelName,t.reel_name??"\u2014",n.reel_name??"\u2014"],["timecode (cut must be inside)",!0,`${t.source_timecode??"\u2014"}`,`${n.source_timecode??"\u2014"} \xD7 ${n.available_range?.duration?.value??n.declared_duration?.value??"?"} fr`],["fps (must agree)",!0,`${t.source_fps??"\u2014"}`,`${n.source_fps??r(n)?.rate??"\u2014"}`],["duration",i.totalDuration,`${t.declared_duration?.value??"\u2014"} fr`,`${n.available_range?.duration?.value??n.declared_duration?.value??"\u2014"} fr`],["resolution",i.resolution,`${t.source_resolution_w??"\u2014"}x${t.source_resolution_h??"\u2014"}`,`${n.source_resolution_w??r(n)?.width??"\u2014"}x${n.source_resolution_h??r(n)?.height??"\u2014"}`],["bit depth",i.bitDepth,`${r(t)?.bit_depth??"\u2014"}`,`${r(n)?.bit_depth??"\u2014"}`],["format",i.fileFormat,it(t.target_url??"").slice(1)||"\u2014",it(n.target_url??"").slice(1)||"\u2014"],["codec",i.codec,r(t)?.codec??"\u2014",r(n)?.codec??"\u2014"]].map(([o,s,c,l])=>` ${s?"\u2022":"\xB7"} ${o}: ${c} \u2192 ${l}`)}function RU(e,t,n){let i=n.map(r=>({proxy_id:r.ref_id,candidate_id:r.candidate_id,matched_path:t.candidates.find(a=>a.id===r.candidate_id)?.target_url??"",confidence:1,reasons:["accepted"]}));return Az(e,t.candidates,i,!0)}var a0=Te(),o0=A(a0,"locations.json");async function Fm(){try{return JSON.parse(await Qe(o0))}catch{return[]}}async function HU(e){await We(a0);let t=(await Fm()).filter(n=>n!==e);await Ze(o0,JSON.stringify([e,...t].slice(0,12)))}function s0(e){let t=e.media_references??[],n=Ez(t);return Object.entries(n).map(([i,r])=>`- ${i}: ${r.available?"usable":"not usable"} (${r.populated}/${r.total} populated${r.unavailable_reason?`; ${r.unavailable_reason}`:""})`).join(`
|
|
9
9
|
`)}function FU(e,t,n){let i=[],r=a=>t.rows.filter(o=>o.status===a).length;i.push(`proposal: ${r("matched")} matched, ${r("ambiguous")} ambiguous, ${r("unmatched")} unmatched of ${t.rows.length} in scope; ${t.candidates.length} candidates`);for(let a of t.rows){let o=e.media_references.find(c=>c.id===a.ref_id),s=`- ${a.ref_id} ${a.name}: ${a.status}`;a.candidate&&(s+=` \u2192 ${a.candidate.target_url} (${Math.round(a.confidence*100)}%${a.reasons.length?`; ${a.reasons.join("; ")}`:""})`),a.refusal&&(s+=`
|
|
10
10
|
refused: ${a.refusal}`),a.alternatives.length&&(s+=`
|
|
11
11
|
alternatives: ${a.alternatives.slice(0,4).map(c=>`${c.id} ${G(c.target_url??"")}`).join(", ")}`),i.push(s),n.compare&&a.candidate&&i.push(...oX(e,o,a.candidate,t.config))}return i.join(`
|
|
@@ -91,7 +91,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
91
91
|
`)}var Ww=["Blue","Cyan","Green","Yellow","Red","Pink","Purple","Fuchsia","Rose","Lavender","Sky","Mint","Lemon","Sand","Cocoa","Cream"];function J$(e,t){let n=_e(e),i=q3(n,!!e.is_drop_frame),r=e.start_frame??0,a=new Map,o=(e.tracks??[]).filter(l=>l.kind==="Video")[0];for(let l of e.tracks??[])for(let u of l.items??[])a.set(u.id,{name:u.name??u.id});let s=l=>{for(let u of o?.items??[]){let f=u.timeline_range?.start?.value??0,m=u.timeline_range?.duration?.value??0;if(l>=f&&l<f+m)return u.name??u.id}return""},c=[];return(e.markers??[]).forEach((l,u)=>{let f=IO(l,n);if(f==null)return;let m=qO(l,n),d=l.id??`marker-${u}`,p=l.item_id&&a.get(l.item_id)?.name||s(f),v={id:d,marker:l,frame:f,tc:qe(r+f,n,i),duration:m,durationTc:m>1?qe(m,n,!1).replace(/^00:/,""):"",color:l.color??"",name:l.name??"",note:l.note??l.comment??"",clip:p,cells:{}};v.cells={tc:v.tc,frame:f,color:v.color,name:v.name,note:v.note,duration:v.durationTc,clip:p,item_id:l.item_id??"",frames:m},c.push(v)}),c.sort((l,u)=>l.frame-u.frame)}var U$={...Object.fromEntries(Ww.map(e=>[e.toLowerCase(),t=>t.color.toLowerCase()===e.toLowerCase()])),duration:e=>e.duration>1};function E$(e){return AO([{header:"Record TC",value:n=>n.tc},{header:"Source TC",value:()=>""},{header:"Frame",value:n=>n.frame},{header:"Color",value:n=>n.color},{header:"Source",value:n=>n.marker.item_id?"clip":"timeline"},{header:"Clip Name",value:n=>n.clip},{header:"Name",value:n=>n.name},{header:"Note",value:n=>n.note},{header:"Duration",value:n=>n.duration},{header:"Keywords",value:()=>""},{header:"Custom Data",value:n=>n.marker.metadata?JSON.stringify(n.marker.metadata):""}],e)}var NM=["#","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","scale","scale_x","scale_y","position_x","position_y","rotation","crop_left","crop_right","crop_top","crop_bottom"],LM=["tc","frame","color","name","note","duration","frames","clip","item_id"];function wn(e){let t=String(e.cells.track_no??e.cells.track??"").match(/^([VA])(\d+)$/),n=Number(e.cells["timeline_range.start"]);return!t||!Number.isFinite(n)?null:{kind:t[1]==="V"?"video":"audio",track:Number(t[2]),start:n}}var Di=(e,t)=>e.media.find(n=>n.id===`mr:${t.cells.media_reference_id}`);function ur(e,t){let n=wn(t);return n?e.items.find(i=>i.kind===n.kind&&i.track===n.track&&i.start===n.start)??null:null}var K$=[...Ww];async function B$(e,t,n="resolve"){let i=await e("host_export",{host:n,...t?{timeline:t}:{}});if(!i.ok||!i.session_id)throw new Error(i.text);return ZM(e,String(i.session_id),{host:n,project:String(i.project??""),timeline:String(i.timeline??"")})}async function ZM(e,t,n={}){let i=n.host,r={ok:!0,text:""},a=Promise.resolve(r),[o,s,c,l,u]=await Promise.all([i==="resolve"?e("host_items",{timeline:n.timeline}):i==="premiere"?e("host_items",{host:i,timeline:n.timeline}).then(f=>f.ok?f:r,()=>r):a,e("timeline_query",{session_id:t,table:"clips",limit:5e3,columns:NM}),e("timeline_query",{session_id:t,table:"markers",limit:5e3,columns:LM}),i?e("host_project",{host:i,timeline:n.timeline}).catch(()=>({ok:!1,text:""})):a,e("timeline_query",{session_id:t,table:"media",limit:5e3,columns:["name","target_url","available_range.start","available_range.dur","source_fps","source_timecode","binding_state"]})]);for(let f of[o,s,c])if(!f.ok)throw new Error(f.text);return{host:i,project:n.project??"",timeline:n.timeline??"",session_id:t,start_frame:Number(o.start_frame??0),fps:Number(s.fps??24),frames:Math.max(0,...(s.rows??[]).map(f=>Number(f.cells["timeline_range.start"]??0)+Number(f.cells["timeline_range.dur"]??0))),clips:s.rows??[],markers:c.rows??[],media:u.rows??[],items:o.items??[],color_groups:o.color_groups??[],marker_data:o.marker_data??{},...o.playhead_tc?{playhead:(Oe(String(o.playhead_tc),Number(s.fps??24))??0)-Number(o.start_frame??0)}:{},layers:Number(o.layers??1),tracks:l.tracks??[],...WM(o.output_blanking,o.raster)}}function WM(e,t){if(!e||!(e.top||e.bottom||e.left||e.right))return{};let[n,i]=t??[0,0],r=n-e.left-e.right,a=i-e.top-e.bottom;return{output_blanking:e,...r>0&&a>0?{output_aspect:r/a}:{}}}function Wo(e,t){let n=Number(t.cells.frame),i=String(t.cells.item_id??"");if(!i)return{frame:n};let r=e.clips.find(o=>o.id===i),a=r&&wn(r);return!r||!a?null:{item:{kind:a.kind??"video",track:a.track,start:a.start},frame:Number(r.cells["source_range.start"]??0)+n-a.start,record:n}}function VM(e,t,n){let i=e.clips.map(r=>({c:r,ref:wn(r)})).filter(({ref:r,c:a})=>r&&r.kind==="video"&&(!n||r.track===n)&&t>=r.start&&t<r.start+Number(a.cells["timeline_range.dur"]??0)).sort((r,a)=>a.ref.track-r.ref.track)[0];return i&&{item:{kind:"video",track:i.ref.track,start:i.ref.start},frame:Number(i.c.cells["source_range.start"]??0)+t-i.ref.start,record:t}}var RM={name:"name",note:"note",keyword:"data"},HM=(e,t,n)=>t?e.replace(new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi"),()=>n):e;function _$(e){for(let t of e.markers){let n=Wo(e,t);if(!n)continue;let i=n.item&&e.items.find(a=>a.kind===n.item.kind&&a.track===n.item.track&&a.start===n.item.start),r=(n.item?i?.marker_data:e.marker_data)?.[String(n.frame)];r&&(t.cells.data=r)}return e}function $$(e,t,n,i,r,a={}){let o=[],s=a.field??"name",c=a.separator??"";for(let l of t){let u=Wo(e,l);if(!u)continue;let f=String(l.cells.name??""),m=String(l.cells.note??""),d=Math.max(1,Number(l.cells.frames??1)),p=String(l.cells.data??l.cells.keyword??""),v={name:f,note:m,keyword:p}[s],h={...u.item?{item:u.item,record:u.record}:{},frame:u.frame},b=g=>o.push({op:"marker_update",...h,[RM[s]]:g});if(n==="recolor")o.push({op:"marker_update",...h,color:i});else if(n==="swap"){let g=String(l.cells.color);(g===i||g===r)&&o.push({op:"marker_update",...h,color:g===i?r:i})}else if(n==="rename")b(r);else if(n==="note")o.push({op:"marker_update",...h,note:r});else if(n==="keyword")o.push({op:"marker_update",...h,data:r});else if(n==="prefix")b(`${r}${v&&r?c:""}${v}`);else if(n==="suffix")b(`${v}${v&&r?c:""}${r}`);else if(n==="replace"){let g=HM(v,r,a.with??"");g!==v&&b(g)}else if(n==="duration"){let g=Math.max(1,Math.round(Number(a.frames??0)));a.frames&&g!==d&&o.push({op:"marker_update",...h,duration:g})}else if(n==="delete")o.push({op:"marker_delete",...h});else{let y=n==="to_clip"||n==="copy_to_clip"||n==="swap_places"&&!u.item?u.item?null:VM(e,u.frame,a.track):u.item?{frame:Number(l.cells.frame)}:null;if(!y)continue;n.startsWith("copy_")||o.push({op:"marker_delete",...h}),o.push({op:"marker_add",...y,color:String(l.cells.color||"Blue"),name:f,note:m,duration:d,...p?{data:p}:{}})}}return n==="swap_places"?[...o.filter(l=>l.op==="marker_delete"),...o.filter(l=>l.op!=="marker_delete")]:o}var QO=(e,t)=>e.media===t.media||!!e.alt&&e.alt===t.alt,FM=(e,t)=>QO(e,t)?Math.min(e.src_out,t.src_out)-Math.max(e.src_in,t.src_in):0;function _O(e,t){let n=e.flatMap(d=>t.map(p=>({a:d,b:p,o:FM(d,p)}))).filter(d=>d.o>0).sort((d,p)=>p.o-d.o||+(p.a.track===p.b.track)-+(d.a.track===d.b.track)||Math.abs(d.a.rec_in-d.b.rec_in)-Math.abs(p.a.rec_in-p.b.rec_in)),i=new Map,r=new Set;for(let d of n)!i.has(d.b)&&!r.has(d.a)&&(i.set(d.b,d.a),r.add(d.a));for(let d of n)!i.has(d.b)&&r.has(d.a)&&i.set(d.b,d.a);let a=new Map;for(let[d,p]of i)a.set(p,[...a.get(p)??[],d]);let o=new Map;for(let d of e){if(a.has(d))continue;let p=t.find(v=>QO(d,v)&&v.src_in<=d.src_in&&d.src_out<=v.src_out);p&&o.set(p,[...o.get(p)??[],d])}let s=new Set([...o.values()].flat()),c=new Map([...o].map(([d,p])=>[d,p.length+1])),l=[...i].sort((d,p)=>d[0].rec_in-p[0].rec_in),u=l.map(([,d])=>d.rec_in),f=MM(u),m=[];l.forEach(([d,p],v)=>{let h=[],b=d.src_in-p.src_in,g=d.src_out-p.src_out;(a.get(p)?.length??0)>1&&h.push("split"),(c.get(d)??0)>1&&h.push("joined"),f.has(v)||h.push("moved"),b&&g&&b===g?h.push("slipped"):(b>0?h.push("trimmed head"):b<0&&h.push("extended head"),g<0?h.push("trimmed tail"):g>0&&h.push("extended tail")),(p.speed??100)!==(d.speed??100)&&h.push("retimed"),(p.sizing??"")!==(d.sizing??"")&&h.push("reframed"),m.push({kinds:h.length?h:["unchanged"],a:p,b:d,...b?{head:b}:{},...g?{tail:g}:{},...p.media!==d.media?{loose:!0}:{}})});for(let d of t)i.has(d)||m.push({kinds:["inserted"],b:d});for(let d of e)!a.has(d)&&!s.has(d)&&m.push({kinds:["deleted"],a:d});return m.sort((d,p)=>(d.b?.rec_in??d.a.rec_in)-(p.b?.rec_in??p.a.rec_in)||+!d.b-+!p.b)}function MM(e){let t=[],n=Array(e.length).fill(-1);for(let r=0;r<e.length;r++){let a=0,o=t.length;for(;a<o;){let s=a+o>>1;e[t[s]]<e[r]?a=s+1:o=s}a>0&&(n[r]=t[a-1]),t[a]=r}let i=new Set;for(let r=t.length?t[t.length-1]:-1;r>=0;r=n[r])i.add(r);return i}var $O=/(?<![A-Za-z0-9])[vV](\d{1,4})(?![A-Za-z0-9])/,IM=new Set(["comp","composite","final","vfx","cg","plate","prores","dnx","dnxhr","dnxhd","h264","h265","mov","mxf","exr","dpx","png","jpg","jpeg","tif","tiff","render","out","output","delivery","rec709","rec2020","srgb","log","aces","acescg","lin","linear","1080p","2160p","4k","uhd","hd","hq","lt","master","approved","client","review","wip","temp","tmp","test","left","right","l","r","v","beauty","denoise","denoised","stab","stabilized","stabilised","retime","retimed","graded"]),qM=/^(?:19|20)\d{6}$|^\d{4}-\d{2}-\d{2}$|^\d{6}$/,DM=/^\d{3,4}x\d{3,4}$/i,JM=/^[#%]+d?$/,UM=/^(?:sh|shot|s)?[_-]?(\d{2,5})(?:[a-z])?$/i;function EM(e){let t=String(e??"").split(/[\\/]/).pop().trim();return t=t.replace(/\.\[?\d+(?:-\d+)?\]?\.[A-Za-z0-9]+$/,""),t=t.replace(/\.(?:[#%]+d?|\d{4,8})\.[A-Za-z0-9]+$/,""),t.replace(/\.[A-Za-z0-9]{2,4}$/,"")}function e4(e){let t=EM(e),n=$O.exec(t),i=n?Number(n[1]):null,r=t.replace(new RegExp($O.source,"g")," ");r=r.replace(/(?<!\d)(?:19|20)\d{2}-\d{2}-\d{2}(?!\d)/g," ").replace(/(?<![A-Za-z0-9])\d{3,4}[xX]\d{3,4}(?![A-Za-z0-9])/g," ");let a=r.split(/[\s_\-.]+/).filter(Boolean),o=a.map(f=>!(IM.has(f.toLowerCase())||qM.test(f)||DM.test(f)||JM.test(f))),s=a.filter((f,m)=>o[m]),c=(f,m)=>{let d=[];for(let h=f-1;h>=0&&d.length<2&&o[h]&&/^[A-Za-z]{1,6}\d{0,3}$/.test(a[h]);h--)d.unshift(a[h]);let p=d.join("_"),v=[m];for(let h=f+1;h<a.length&&o[h]&&/^\d{2,5}[a-zA-Z]?$/.test(a[h]);h++)v.push(a[h]);return[[...p?[p]:[],...v].join("_"),p]},l="",u="";for(let f=0;f<a.length;f++){let m=a[f];if(!o[f])continue;if(/^\d{2,5}$/.test(m)){[l,u]=c(f,m);break}let d=UM.exec(m);if(d&&/^(sh|shot|s)/i.test(m)){[l,u]=c(f,/^(sh|shot)/i.test(m)?m:d[1]);break}}return{shot:l,version:i,tokens:s,sequence:u,stem:t}}function Vo(e){let t=String(e??"").trim().split(/[\s_\-.]+/).filter(Boolean),n=[];return t.forEach((i,r)=>{if(/^(sh|shot)$/i.test(i)&&r+1<t.length&&/^\d+[a-zA-Z]?$/.test(t[r+1]))return;let a=/^(sh|shot|s)?(\d+)([a-z]?)$/i.exec(i);n.push(a?String(Number(a[2]))+a[3].toLowerCase():/^\d+$/.test(i)?String(Number(i)):i.toLowerCase())}),n.join(":")}function Ro(e){let t=new Set,n=String(e??""),i=e4(n);i.shot&&t.add(Vo(i.shot));for(let r of n.matchAll(/(?<![a-z0-9])([a-z]{2,6}\d{0,2}[_\-.])?(?:sh|shot)?[_\-.\s]?(\d{2,5})(?:[_\-.](\d{2,5}))?(?![a-z0-9])/gi)){let a=(r[1]??"").replace(/[_\-.]+$/,""),o=[r[2],...r[3]?[r[3]]:[]];t.add(Vo([...a?[a]:[],...o].join("_"))),a&&t.add(Vo(o.join("_")))}for(let r of n.matchAll(/\b(?:scene|sc)\s*[:#]?\s*(\d{1,5})\b[^\d]{0,20}\b(?:shot|sh)\s*[:#]?\s*(\d{1,5})\b/gi))t.add(Vo(`${r[1]}_${r[2]}`));return t.delete(""),t}function CM(e){if(!e.shot)return["",""];let t=Vo(e.shot);return e.sequence&&e.shot.toLowerCase().startsWith(e.sequence.toLowerCase())?[t,Vo(e.shot.slice(e.sequence.length))]:[t,t]}var _l={marker:.95,plate_name:.9,metadata:.85,timecode:.92},YM=(e,t)=>{let n=/^(\d{1,2})[:;](\d{2})[:;](\d{2})[:;](\d{2,3})$/.exec(String(e??"").trim());if(!n)return null;let[i,r,a,o]=n.slice(1).map(Number),s=Math.round(t)||24;return((i*60+r)*60+a)*s+o},Jd=e=>String(e??"").toLowerCase().replace(/[^a-z0-9]/g,"");function GM(e,t,n){let i=Math.max(0,e),r=Math.max(0,t);if(!i||!r)return{src_in:0,src_out:0,record_offset:0,covers:0,of:r,note:"nothing to place"};let a=n<0?-n:0,o=Math.max(0,n),s=Math.min(i,n+r),c=Math.max(0,s-o);return c<=0?{src_in:0,src_out:0,record_offset:0,covers:0,of:r,note:"the comp does not reach the cut"}:{src_in:o,src_out:s,record_offset:a,covers:c,of:r,note:c<r?`covers ${c} of ${r} frames`:i>r?`trimmed to the cut (${i} frames in the comp)`:""}}function KM(e,t,n,i){let[r,a]=CM(t);if(!r)return[];let o=c=>[...i.filter(l=>l.keys.has(c)).map(l=>({tier:"marker",plate:l.plate,start:l.start,end:l.end})),...n.flatMap(l=>l.keys.has(c)?[{tier:"plate_name",plate:l,start:l.start,end:l.end}]:l.meta_keys.has(c)?[{tier:"metadata",plate:l,start:l.start,end:l.end}]:[])],s=o(r);return s.length||!a||a===r?s:o(a)}function BM(e,t){let n=YM(e.start_tc,e.fps);if(!n)return[];let i=n+e.frames,r=Jd(e.reel);return t.flatMap(a=>{if(!a.src_tc||Math.abs((a.media_fps??e.fps)-e.fps)>.01)return[];if(r&&Jd(a.reel)&&r!==Jd(a.reel))return[];let[o,s]=a.src_tc,c=Math.max(0,Math.min(i,s)-Math.max(n,o));return c>0?[{tier:"timecode",plate:a,start:a.start,end:a.end,offset:o-n,overlap:c,contained:c>=s-o,reel_agrees:!!r&&Jd(a.reel)===r}]:[]}).sort((a,o)=>o.overlap-a.overlap||a.start-o.start)}function t4(e,t,n){return e.map(i=>{let r=e4(i.name),a={comp:i,shot:r.shot,version:r.version,status:"unmatched",matched_by:"",confidence:0,offset:0,reasons:[]},o=KM(i,r,t,n),s=BM(i,t),c=m=>`${m.start}:${m.end}`,l=new Set(o.map(c)),u;if(l.size===1){let m=[...o].sort((p,v)=>_l[v.tier]-_l[p.tier])[0];u={...m,confidence:_l[m.tier]};let d=s.find(p=>c(p)===c(m));d?(u.offset=d.offset,u.confidence=Math.min(.99,u.confidence+.04),a.reasons.push("source timecode agrees")):s.length&&a.reasons.push(`source timecode points at ${s[0].plate.name} instead`)}else if(l.size>1){let m=s.filter(d=>l.has(c(d)));if(new Set(m.map(c)).size===1)u={...m[0],confidence:Math.min(.99,_l.timecode+.04)},a.reasons.push("the shot id is on several plates; source timecode picked this one");else return a.status="ambiguous",a.reasons.push(`the shot id is on ${l.size} plates`),a}else if(s.length){let m=s[0],d=s.filter(p=>p.contained);if(d.length>1||s.length>1&&s[1].overlap>=.9*m.overlap&&!m.reel_agrees)return a.status="ambiguous",a.reasons.push(`the comp's source timecode covers ${Math.max(d.length,2)} plates - name it for the shot, or place it by hand`),a;u={...m,confidence:_l.timecode+(m.reel_agrees?.04:0)}}if(!u)return a.reasons.push("no shot id in the name and no source timecode overlap"),a;if(Object.assign(a,{matched_by:u.tier,confidence:Math.round(u.confidence*1e3)/1e3,plate:u.plate,record_start:u.start,record_end:u.end,offset:u.offset??0}),u.plate&&Math.abs((u.plate.speed??100)-100)>1)return a.status="retimed",a.reasons.push(`the plate is retimed (${u.plate.speed}%) - place it by hand`),a;let f=GM(i.frames,u.end-u.start,a.offset);return a.plan=f,f.covers<=0?(a.reasons.push(f.note),a):(f.note&&a.reasons.push(f.note),u.plate?.raster&&i.raster&&(u.plate.raster[0]!==i.raster[0]||u.plate.raster[1]!==i.raster[1])&&a.reasons.push(`comp is ${i.raster.join("x")}, plate ${u.plate.raster.join("x")} - its sizing is not copied, check with the Aligner`),a.status="ready",a)})}var ke=e=>({track:e.track,start:e.start}),dee=[["color","Clip color"],["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","Color group"],["ungroup","Leave color group"],["prefix","Name prefix"],["suffix","Name suffix"],["cache_on","Color cache on"],["cache_off","Color cache off"],["properties","Set properties"],["metadata","Set metadata"],["keywords_add","Add keywords"],["keywords_remove","Remove keywords"],["markers_remove","Remove the clip's markers"],["fade_in","Fade in (frames; Resolve 21.1.1 does not save it)"],["fade_out","Fade out (frames; Resolve 21.1.1 does not save it)"],["audio_level","Audio level (dB)"],["normalize","Normalize audio (peak dBFS)"]];function mee(e,t){return e.clips.filter(n=>!t||t.has(n.id)).map(n=>{let i=ur(e,n);return{id:n.id,cells:{...n.cells,name:i?.name??n.cells.name,color:i?.color??"",flags:i?.flags.join(", ")??"",on:i?i.enabled?"on":"off":"",version:i?.version??"",group:i?.group??"",nodes:i?.nodes||"",keywords:i?.keywords??"",effects:i?.effects?.length?i.effects.join(", "):String(n.cells.effect_names??""),stabilized:i?.stabilized||/stabiliz/i.test(String(n.cells.effect_names??""))?"yes":"",retimed:i?.remapped||n.cells.speed_ramped===!0||n.cells.speed!=null&&Math.abs(Number(n.cells.speed)-100)>1e-6?"yes":""}}})}function n4(e,t){return Object.fromEntries(e.split(",").map(n=>n.split("=")).filter(n=>n.length===2&&n[0].trim()).map(([n,i])=>[n.trim(),t&&i.trim()!==""&&Number.isFinite(Number(i))?Number(i):i.trim()]))}function pee(e,t,n,i,r){let a=[];for(let o of t){let s=wn(o),c=ur(e,o);if(!s||!c)continue;let l={kind:s.kind,track:s.track,start:s.start};switch(n){case"color":a.push({op:"clip_color",item:l,color:i});break;case"flag":a.push({op:"flags",item:l,add:[i]});break;case"unflag":a.push({op:"flags",item:l,clear:"All"});break;case"enable":case"disable":a.push({op:"enabled",item:l,on:n==="enable"});break;case"marker":a.push({op:"marker_add",frame:s.start,color:i,name:r||"conform.tools",note:c.name});break;case"keywords":a.push({op:"metadata",item:l,set:{Keywords:r}});break;case"version_add":a.push({op:"version",item:l,add:r});break;case"version_load":a.push({op:"version",item:l,load:r});break;case"group":a.push({op:"color_group",item:l,group:r});break;case"ungroup":a.push({op:"color_group",item:l,group:""});break;case"prefix":a.push({op:"name",item:l,name:`${r}${c.name}`});break;case"suffix":a.push({op:"name",item:l,name:`${c.name}${r}`});break;case"cache_on":case"cache_off":a.push({op:"cache",item:l,color:n==="cache_on"});break;case"properties":{let u=n4(r,!0);Object.keys(u).length&&a.push({op:"properties",item:l,set:u});break}case"metadata":{let u=n4(r,!1);Object.keys(u).length&&a.push({op:"metadata",item:l,set:u});break}case"keywords_add":case"keywords_remove":{let u=c.keywords.split(",").map(d=>d.trim()).filter(Boolean),f=r.split(",").map(d=>d.trim()).filter(Boolean),m=n==="keywords_add"?[...new Set([...u,...f])]:u.filter(d=>!f.some(p=>p.toLowerCase()===d.toLowerCase()));m.join(",")!==u.join(",")&&a.push({op:"metadata",item:l,set:{Keywords:m.join(",")}});break}case"fade_in":case"fade_out":{let u=Number(r);Number.isFinite(u)&&u>=0&&a.push({op:"fades",item:l,set:{[n==="fade_in"?"FadeIn":"FadeOut"]:Math.round(u)}});break}case"audio_level":{let u=Number(r);s.kind==="audio"&&Number.isFinite(u)&&a.push({op:"properties",item:l,set:{AudioVolume:u}});break}case"normalize":s.kind==="audio"&&a.push({op:"normalize_audio",item:l,mode:"Sample Peak Program",target_level:r===""?-1:Number(r)});break;case"markers_remove":for(let u of e.markers.filter(f=>f.cells.item_id===o.id)){let f=Wo(e,u);f?.item&&a.push({op:"marker_delete",item:f.item,frame:f.frame,record:f.record})}break}}return n==="marker"?a.filter((o,s)=>a.findIndex(c=>c.frame===o.frame)===s):a}var l4=e=>[...e.clip_list??[],...(e.folders??[]).flatMap(l4)],AM=e=>e.match(/^(\/Volumes\/[^/]+|[A-Za-z]:\\|\/mnt\/[^/]+|\/[^/]+)/)?.[1]??"(no file)",vee=(e,t="",n=new Set)=>l4(e).filter(i=>!n.has(i.id)).filter(i=>i.type?.toLowerCase()!=="timeline"&&(i.usage===""||i.usage==="0")&&(!t||i.folder!==t)).map(i=>({id:i.id,cells:{name:i.name,folder:i.folder||"Master",start_tc:i.start_tc||"",file:i.file||"",drive:AM(i.file)}})),hee=(e,t,n)=>e.length?[t==="remove"?{op:"pool_delete",clips:e.map(i=>i.id)}:{op:"pool_move",clips:e.map(i=>i.id),folder:n||"UNUSED MEDIA",create:!0}]:[],Hw=[["grade","Grade",[]],["sizing","Sizing",["ZoomGang","Pan","Tilt","ZoomX","ZoomY","RotationAngle","AnchorPointX","AnchorPointY","Pitch","Yaw","FlipX","FlipY","DynamicZoomEase","Distortion","RetimeProcess","MotionEstimation","Scaling","ResizeFilter"]],["crop","Crop",["CropLeft","CropRight","CropTop","CropBottom","CropSoftness","CropRetain"]],["composite","Composite + opacity",["CompositeMode","Opacity"]],["clip_color","Clip color",[]],["flags","Flags",[]],["markers","Clip markers",[]],["versions","Every local grade version",[]],["group","Color group",[]],["keywords","Keywords",[]]];function QM(e,t,n){let i=!!e.media_id&&e.media_id===t.media_id;return n?{certain:!0,same_media:i,why:"same edit position"}:i?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:i,why:"same media, same moment"}:{certain:!1,same_media:i,why:"same media but another part of the take"}:{certain:!1,same_media:i,why:"different media and not at the same edit position"}}var _M=1;function Ed(e,t,n){let i=QM(e,t,n);return e.version_type===_M&&i.same_media?{do:"remote",why:`remote grade '${e.version}' selected`}:i.certain?{do:"copy",why:i.why}:{do:"skip",why:`not sure this is the same shot (${i.why}): no grade copied`}}function bee(e,t,n){let i=e.items.filter(o=>o.kind==="video"),{pairs:r,misses:a}=MO(i.filter(o=>o.track===n),i.filter(o=>o.track===t));return[...r.map(o=>({id:o.dest.id,dest:o.dest,source:o.source,exact:o.exact})),...a.map(o=>({id:o.id,dest:o,source:void 0,exact:!1}))].sort((o,s)=>o.dest.start-s.dest.start).map(o=>{let s=o.source?Ed(o.source,o.dest,o.exact):void 0;return{id:o.id,dest:o.dest,source:o.source,exact:o.exact,cells:{clip:o.dest.name,record:o.dest.start,from:o.source?o.source.name:"no clip above",color:o.source?.color??"",fit:s?s.do==="remote"?"remote: select":s.do==="copy"?o.exact?"exact":"same moment":"not sure":"",nodes:o.source?.nodes??"",...e.playhead!=null&&e.playhead>=o.dest.start&&e.playhead<o.dest.end?{at:"playhead"}:{}}}})}function $M(e,t,n){let i=c=>e.clips.find(l=>{let u=wn(l);return u?.kind===c.kind&&u.track===c.track&&u.start===c.start}),r=i(t),a=i(n);if(!r||!a)return[];let o=Number(r.cells["source_range.start"]??0),s=Number(a.cells["source_range.start"]??0);return e.markers.filter(c=>c.cells.item_id===r.id).flatMap(c=>{let l=Wo(e,c),u=l?l.frame-o:-1;return!l||u<0||u>=n.end-n.start?[]:[{op:"marker_add",item:{kind:n.kind,track:n.track,start:n.start},frame:s+u,record:n.start+u,color:String(c.cells.color||"Blue"),name:String(c.cells.name??""),note:String(c.cells.note??""),duration:Math.max(1,Number(c.cells.frames??1)),...c.cells.data?{data:String(c.cells.data)}:{}}]})}var eI=(e,t)=>[...new Set([...e.split(","),...t.split(",")].map(n=>n.trim()).filter(Boolean))].join(",");function gee(e,t,n,i){let r=[],a=new Map,o=new Map,s=[];for(let l of e){let u=l.dest,f=l.source;if(!f){n&&r.push({op:"marker_add",frame:u.start,color:n,name:"Copy Grades: no source",note:u.name,data:"ConformTools:copy-grades"});continue}let m=`${f.track}:${f.start}`;if(a.set(m,{src:f,dests:[...a.get(m)?.dests??[],u]}),!t.has("grade"))continue;let d=Ed(f,u,!!l.exact);d.do==="remote"?s.push({op:"version",item:ke(u),type:"remote",load:f.version}):d.do==="copy"?o.set(m,[...o.get(m)??[],u]):r.push({op:"marker_add",frame:u.start,color:n||"Yellow",name:"Copy Grades: not sure",note:`${u.name}: ${d.why}`,data:"ConformTools:copy-grades"})}let c=Hw.filter(([l])=>t.has(l)).flatMap(([,,l])=>l);for(let[l,{src:u,dests:f}]of a){let m=o.get(l);if(m?.length&&s.push({op:"copy_grade",item:ke(u),to:m.map(ke)}),t.has("versions")&&m?.length&&(u.versions?.length??0)>1){for(let d of u.versions){s.push({op:"version",item:ke(u),load:d});for(let p of m)s.push(p.versions?.includes(d)?{op:"version",item:ke(p),load:d}:{op:"version",item:ke(p),add:d});s.push({op:"copy_grade",item:ke(u),to:m.map(ke)})}u.version&&s.push({op:"version",item:ke(u),load:u.version},...m.map(d=>({op:"version",item:ke(d),load:u.version})))}c.length&&s.push({op:"copy_properties",item:ke(u),to:f.map(ke),keys:c});for(let d of f){t.has("clip_color")&&d.color!==u.color&&s.push({op:"clip_color",item:ke(d),color:u.color}),t.has("flags")&&d.flags.join()!==u.flags.join()&&s.push({op:"flags",item:ke(d),clear:"All",add:u.flags}),t.has("group")&&u.group&&d.group!==u.group&&s.push({op:"color_group",item:ke(d),group:u.group});let p=eI(d.keywords??"",u.keywords??"");t.has("keywords")&&u.keywords&&p!==(d.keywords??"")&&s.push({op:"metadata",item:ke(d),set:{Keywords:p}}),t.has("markers")&&i&&s.push(...$M(i,u,d))}}return[...s,...r]}function yee(e,t,n,i=[]){let r={clips:t,media:n,items:i};return t.flatMap(a=>{let o=wn(a);if(!o||o.kind!=="video")return[];let s=Di(r,a),c=s?String(s.cells.target_url??""):"",l=Number(s?.cells["available_range.dur"]),u=l>0?l:NaN,f=Number.isFinite(u)?Number(s?.cells["available_range.start"]):NaN,m=ur(r,a),d=m?.version;return[{timeline:e,track:o.track,start:o.start,name:String(a.cells.name??""),...d?{version:d}:{},...m?{color:m.color,flags:m.flags}:{},file_name:c?c.split(/[\\/]/).pop():String(a.cells.name??""),file_path:c||null,reel_name:a.cells.reel_name??null,src_start:Number.isFinite(f)?f:null,src_end:Number.isFinite(f)&&Number.isFinite(u)?f+u:null,src_dur:Number.isFinite(u)?u:null}]})}function xee(e,t,n){return JO(e,t,n).map(i=>({id:`${i.dest.track}:${i.dest.start}`,trace:i,cells:{clip:i.dest.name,at:`V${i.dest.track} ${i.dest.start}`,match:`${i.band}${i.matches[0]?` ${i.matches[0].match.score}`:""}`,from:i.matches[0]?`${i.matches[0].project?`${i.matches[0].project} / `:""}${i.matches[0].timeline} \xB7 V${i.matches[0].track} \xB7 ${i.matches[0].name}`:"",why:i.matches[0]?.match.reasons.join(", ")??"",others:Math.max(0,i.matches.length-1),trusted:i.confident?"trusted":i.matches.length?"review":"unmatched"}}))}function wee(e,t){let n=(t.clear??[]).filter(i=>i.cells.data==="ConformTools:trace"&&!i.cells.item_id).map(i=>({op:"marker_delete",frame:Number(i.cells.frame)}));for(let i of e){let r=i.trace,a=[ke(r.dest)],o=t.variants&&!(t.unsureOnly&&r.confident);if(!r.matches.length||t.onlyTrusted&&!r.confident&&!o){t.markColor&&n.push({op:"marker_add",frame:r.dest.start,color:t.markColor,name:r.matches.length?"Grade Tracer: below trust":"Grade Tracer: no match",note:`${r.dest.name}${r.matches.length?` \xB7 best ${r.matches[0].match.score} from ${r.matches[0].timeline}`:""}`,data:"ConformTools:trace"});continue}(o?r.matches:r.matches.slice(0,1)).forEach((c,l)=>{o&&n.push({op:"version",item:a[0],add:`${t.prefix||"trace"} ${l+1} \xB7 ${c.match.score} \xB7 ${c.timeline}`});let u=c.project;n.push({op:"copy_grade",...u?{from_project:u}:{},from_timeline:c.timeline,item:ke(c),to:a}),t.keys?.length&&!o&&!u&&n.push({op:"copy_properties",from_timeline:c.timeline,item:ke(c),to:a,keys:t.keys});let f=c;t.color&&!o&&f.color&&n.push({op:"clip_color",item:a[0],color:f.color}),t.flags&&!o&&f.flags?.length&&n.push({op:"flags",item:a[0],clear:"All",add:f.flags})});let s=r.dest.version;o&&s&&n.push({op:"version",item:a[0],load:s})}return n}var nn=(e,t=3)=>Math.abs(e)<1e-9?"0":e.toFixed(t).replace(/\.?0+$/,"");function zee(e,t){return e.map(n=>{let i=n.properties,r=n.grade_sizing,a=n.grade_keys,o=n.edit_keys,s=n.verdict==="aligned"||n.verdict==="animated"&&!!(a?.length||o?.length);return{id:n.item_id,track:n.track,start:n.start,end:n.end,transform:n.transform,keys:n.keys?.map(c=>({record:c.record,transform:c.transform})),cells:{record_tc:n.record_tc,track:`V${n.track}`,name:n.name,verdict:n.verdict==="refused"?"not aligned":n.verdict.replace("_"," "),confidence:n.confidence==null?"":nn(n.confidence,2),sizing:a?.length?`Color page ${t==="node"?"Node":"Input"} Sizing \xB7 ${a.length} keyframes${a.some(c=>c.ease_in)?" \xB7 eased":""} (${n.keys?.length??a.length} frames measured)`:o?.length?`Edit page \xB7 ${o.length} keyframes${o.some(c=>c.shape)?" \xB7 eased":""} on the timeline's ALIGNED copy (${n.keys?.length??o.length} frames measured)`:r?`Color page \xB7 Zoom ${nn(r.zoom,4)}${r.height!==1?` \xB7 Height ${nn(r.height,4)}`:""} \xB7 Pan ${nn(r.pan,4)} \xB7 Tilt ${nn(r.tilt,4)} \xB7 Rotate ${nn(r.rotation,2)}\xB0${r.flip_x?" \xB7 Flip H":""}${r.flip_y?" \xB7 Flip V":""}`:i?`Zoom ${nn(i.ZoomX,4)}${i.ZoomY!==i.ZoomX?`\xD7${nn(i.ZoomY,4)}`:""} \xB7 Pan ${nn(i.Pan,1)} \xB7 Tilt ${nn(i.Tilt,1)} \xB7 Rot ${nn(i.RotationAngle,2)}\xB0${i.FlipX?" \xB7 FlipX":""}${i.FlipY?" \xB7 FlipY":""}`:"",why:n.verdict==="aligned"?"":n.reason??"",cant:s?"":"not aligned"}}})}function Pee(e,t,n){let i=new Set(t.map(r=>`${r.track}:${r.start}`));return e.filter(r=>r.op==="properties"||r.op==="grade_sizing"||r.op==="edit_keys"?i.has(`${r.item.track}:${r.item.start}`):n)}var kee=(e,t)=>{let n=t==null?void 0:e.filter(i=>i.record_start>t).sort((i,r)=>i.record_start-r.record_start)[0];return e.map((i,r)=>({id:`${i.item_id}@${i.record_start}#${r}`,finding:i,cells:{...t!=null&&i.record_start<=t&&t<i.record_start+i.frames?{at:"playhead"}:i===n?{at:"next"}:{},record_tc:i.record_tc,frames:i.frames,track:`V${i.track}`,name:i.name,edges:["top","bottom","left","right"].filter(a=>i.edges[a]>0).map(a=>`${a} ${i.edges[a]}`).join(" \xB7 "),fix:i.fix??(i.zoom_fix==null?"keyframed: marker only":`\xD7 ${nn(i.zoom_fix,4)}`)}}))};function Oee(e,t,n,i,r=!1){let a=t.map(l=>l.finding),o=new Set(a.map(l=>l.record_start)),s=new Set(a.flatMap(l=>n.items.filter(u=>u.kind==="video"&&u.track===l.track&&u.start<=l.record_start&&l.record_start<u.end).map(u=>`${u.track}:${u.start}`)));return[...r?n.markers.filter(l=>l.cells.data==="ConformTools:blanking"&&!l.cells.item_id).map(l=>({op:"marker_delete",frame:Number(l.cells.frame)})):[],...e.filter(l=>l.op==="properties"?i&&s.has(`${l.item.track}:${l.item.start}`):l.op==="marker_add"?o.has(Number(l.frame)):!0)]}var Vw={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"]},Ud=e=>e?`${e.file} @ ${e.src_tc??"\u2013"} [${e.track}]`:"",See=(e,t)=>e.map((n,i)=>({id:String(i),cells:{rec_in_tc:n.rec_in_tc,rec_out_tc:n.rec_out_tc,frames:n.frames,kind:Vw[n.kind]?.[0]??n.kind,a:Ud(n.a),b:Ud(n.b),tc:n.rec_in_tc},op:{op:"marker_add",frame:n.rec_in-t,color:Vw[n.kind]?.[1]??"Blue",name:`Reconform: ${Vw[n.kind]?.[0]??n.kind}`,note:`${n.note??""}
|
|
92
92
|
A ${Ud(n.a)}
|
|
93
93
|
B ${Ud(n.b)}`.trim(),duration:Math.max(1,n.frames),data:"ConformTools:reconform"}}));function r4(e){return e.clips.flatMap(t=>{let n=wn(t),i=ur(e,t);if(!n||n.kind!=="video"||!i)return[];let r=Di(e,t),a=i.media_id||String(r?.cells.target_url??"")||`${t.cells.reel_name??""}|${t.cells.name??""}`,o=Number(t.cells["source_range.start"]??i.src_in),s=Number(t.cells["source_range.dur"]??i.end-i.start);return!Number.isFinite(o)||!Number.isFinite(s)?[]:[{it:i,key:a,s0:o,s1:o+Math.max(1,s),tc:String(t.cells.rec_in_tc??"")}]})}function Rw(e,t){let n=e.clips.find(a=>ur(e,a)?.id===t.id);if(!n)return"";let i=(a,o)=>{let s=n.cells[a],c=s==null||s===""?NaN:Number(s);return Number.isFinite(c)?Math.round(c*1e3)/1e3:o};return[i("scale_x",i("scale",100)),i("scale_y",i("scale",100)),i("position_x",0),i("position_y",0),i("rotation",0),i("crop_left",0),i("crop_right",0),i("crop_top",0),i("crop_bottom",0)].join("|")}var c4="100|100|0|0|0|0|0|0|0",i4=e=>{let[t,n,i,r,a]=e.split("|").map(Number);return e===c4?"as shot":`${t===n?`${t}%`:`${t}\xD7${n}%`}${i||r?` \xB7 ${i},${r}`:""}${a?` \xB7 ${a}\xB0`:""}`};function Tee(e,t){let n=r4(e),i=new Map;for(let r of n)i.set(r.key,[...i.get(r.key)??[],r]);return r4(t).sort((r,a)=>r.it.start-a.it.start||r.it.track-a.it.track).map(r=>{let a=(i.get(r.key)??[]).map(d=>({s:d,shared:Math.min(d.s1,r.s1)-Math.max(d.s0,r.s0)})).filter(d=>d.shared>0).sort((d,p)=>p.shared-d.shared||Math.abs(d.s.it.start-r.it.start)-Math.abs(p.s.it.start-r.it.start)),o=a[0],s=o?Math.round(100*o.shared/(r.s1-r.s0)):0,c=o?Ed(o.s.it,r.it,!0):void 0,l=o?Rw(e,o.s.it):"",u=Rw(t,r.it),f=!!o&&!!l&&!!u&&l!==u&&u!==c4,m=(()=>{if(a.length<2||r.s1-r.s0!==r.it.end-r.it.start)return;let d=[...a].sort((p,v)=>p.s.s0-v.s.s0).map(p=>{let v=Math.max(p.s.s0,r.s0),h=Math.min(p.s.s1,r.s1);return{start:r.it.start+(v-r.s0),end:r.it.start+(h-r.s0),source:p.s.it,a_src:p.s.s0,d_src:v}}).filter(p=>p.end>p.start);return new Set(d.map(p=>Rw(e,p.source))).size>1?d:void 0})();return{id:`${r.it.track}:${r.it.start}`,dest:r.it,source:o?.s.it,d_src:r.s0,a_src:o?.s.s0,...m?{segments:m}:{},cells:{...f?{sizing_differs:!0,a_sizing:i4(l),b_sizing:i4(u)}:{},clip:r.it.name,record:r.tc,from:o?`V${o.s.it.track} ${o.s.it.name} @ ${o.s.tc}`:"new in B",cover:o?`${s}%`:"",grade:c?c.do==="remote"?`remote '${o.s.it.version}'`:`${o.s.it.nodes} node${o.s.it.nodes===1?"":"s"}`:"",pieces:m?`cut into ${m.length} (A's through edit)`:a.length>1?`A has ${a.length} pieces (framed alike: whole)`:"",b_tl:t.timeline,b_at:r.it.start,...o?{a_tl:e.timeline,a_at:o.s.it.start+Math.max(0,r.s0-o.s.s0)}:{}}}})}var u4=[["grade","Grade"],["sizing","Sizing"],["crop","Crop"],["composite","Composite + opacity"],["clip_color","Clip color"],["markers","Clip markers"],["speed","Speed"],["fades","Fades (Resolve 21.1.1 does not save them)"]];function Xee(e,t,n,i,r){let a=[],o=Hw.filter(([u])=>t.has(u)).flatMap(([,,u])=>u),s=new Set(Hw.filter(([u])=>u==="sizing").flatMap(([,,u])=>u)),c=n.timeline,l=e.flatMap(u=>{let f=u.segments,m=u.dest;return f?(a.push({op:"split_clip",item:ke(m),at:f.slice(1).map(d=>d.start)}),f.map(d=>({...u,dest:{...m,start:d.start,end:d.end},source:d.source,d_src:d.d_src,a_src:d.a_src}))):[u]});for(let u of l){let f=u.dest,m=u.source;if(!m){i&&a.push({op:"marker_add",frame:f.start,color:i,name:"Reconform: new in B",note:f.name,data:"ConformTools:reconform"});continue}t.has("grade")&&(Ed(m,f,!0).do==="remote"?a.push({op:"version",item:ke(f),type:"remote",load:m.version}):a.push({op:"copy_grade",from_timeline:c,item:ke(m),to:[ke(f)]}));let d=r?.has(u.id)?o.filter(p=>!s.has(p)):o;if(d.length&&a.push({op:"copy_properties",from_timeline:c,item:ke(m),to:[ke(f)],keys:d}),t.has("clip_color")&&m.color!==f.color&&a.push({op:"clip_color",item:ke(f),color:m.color}),t.has("speed")&&a.push({op:"copy_speed",from_timeline:c,item:ke(m),to:[ke(f)]}),t.has("fades")&&a.push({op:"copy_fades",from_timeline:c,item:ke(m),to:[ke(f)]}),t.has("markers")){let p=Number(u.d_src),v=f.end-f.start;for(let h of n.markers){let b=Wo(n,h);!b?.item||b.item.track!==m.track||b.item.start!==m.start||b.frame<p||b.frame>=p+v||a.push({op:"marker_add",item:{kind:"video",...ke(f)},frame:b.frame,record:ke(f).start+b.frame-p,color:String(h.cells.color??"Blue"),name:String(h.cells.name??""),note:String(h.cells.note??""),duration:Math.max(1,Number(h.cells.frames??1))})}}}return a}var Ho=(e,t)=>{let n=Math.round(t)||24,i=r=>String(Math.floor(r)).padStart(2,"0");return`${i(e/(n*3600))}:${i(e/(n*60)%60)}:${i(e/n%60)}:${i(e%n)}`},tI=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 jee(e){let t=[...e.blanking.map((r,a)=>({id:`b${a}`,start:r.start_frame,key:`video.blanking|${r.start_frame}|${r.end_frame}|${r.clip.name}`,evidence:e.evidence?.blanking[a],cells:{tc:Ho(r.start_frame,e.fps),out:Ho(r.end_frame,e.fps),kind:"Black edges",severity:(e.checks.find(o=>o.id==="video.blanking")?.status??"warn").toUpperCase(),clip:r.clip.name,detail:tI(r.measured)}})),...e.black.map((r,a)=>({id:`k${a}`,start:r.start_frame,key:`video.black_frame|${r.start_frame}|${r.end_frame}|${e.evidence?.black_clip?.[a]??""}`,evidence:e.evidence?.black[a],cells:(()=>{let o=e.evidence?.black_clip?.[a];return{tc:Ho(r.start_frame,e.fps),out:Ho(r.end_frame,e.fps),kind:"Black frames",severity:o===""?"INFO":"FAIL",clip:o??"",detail:`${r.frames} frame${r.frames===1?"":"s"}, darkest ${r.darkest}${o===""?" \xB7 in a timeline gap":o?" \xB7 on the clip: missing media or a black source":""}`}})()})),...(e.findings??[]).map((r,a)=>({id:`c${a}`,start:r.start_frame,key:`${r.check??r.label}|${r.start_frame}|${r.end_frame}|${r.clip}`,evidence:r.evidence,cells:{tc:Ho(r.start_frame,e.fps),out:Ho(r.end_frame,e.fps),kind:r.label,severity:r.severity.toUpperCase(),clip:r.clip,detail:r.detail}}))].sort((r,a)=>r.start-a.start),n=e.audio?.integrated_lufs,i=[`${e.frames} frames \xB7 ${e.blanking.length} black-edge range(s) \xB7 ${e.black.length} black-frame range(s)${n!=null?` \xB7 ${n<-70?"silent":`${n.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(r=>`${r.label}: ${r.status}`).join(" \xB7 "),...e.notes].filter(Boolean).join(`
|
|
94
|
-
`);return{rows:t,text:i}}function Nee(e,t){let n=e.clips.flatMap(o=>{let s=wn(o),c=ur(e,o),l=Di(e,o);if(!s||s.kind!=="video"||!c)return[];let u=Number(o.cells["source_range.start"]??0),f=Number(l?.cells["available_range.start"]),m=Number(l?.cells["available_range.dur"]);return[{...c,media:String(l?.cells.target_url??"")||void 0,src_in:u,src_out:u+(c.end-c.start),media_range:Number.isFinite(f)&&m>0?[f,f+m]:void 0,track_enabled:o.cells.track_enabled!==!1}]}),i=CO(e.markers.filter(o=>!o.cells.item_id).map(o=>({frame:Number(o.cells.frame),color:String(o.cells.color),name:String(o.cells.name??""),note:String(o.cells.note??"")})),n,t),r=new Map(String(t.names??"").split(",").map(o=>o.split("=").map(s=>s.trim())).filter(o=>o.length===2&&o[0]&&o[1]));if(r.size){for(let o of i.shots)for(let s of[...o.plates,...o.reference?[o.reference]:[]])s.name=r.get(s.name)??s.name;for(let o of i.stringout)o.name=r.get(o.name)??o.name}let a=i.shots.flatMap(o=>[...o.plates,...o.reference?[o.reference]:[]].map((s,c)=>({id:`${o.name}-${c}`,shot:o.name,pull:s.name,cells:{shot:o.name,role:s.role,name:s.name,clip:`${s.clip.name??""}${s.scene?` \xB7 sc ${s.scene}`:""}${s.take?` tk ${s.take}`:""}`,frames:`${s.first}\u2013${s.last}`,cut:`${s.cut_in}\u2013${s.cut_out}`}})));return{...i,rows:a}}var Lee=(e,t)=>{let n=new Set(t.map(i=>i.shot));return e.shots.filter(i=>n.has(i.name)).map(i=>({op:"marker_update",frame:i.frame,name:i.name,note:i.note}))},nI=(e,t)=>{let n=new Set(t.map(i=>i.pull));return e.stringout.filter(i=>n.has(i.name)&&i.media)};function Zee(e,t,n,i,r,a="",o=""){let s=/\\/.test(r)?"\\":"/",c=new Set(t.map(f=>f.pull)),l=[...new Set(n.items.filter(f=>f.kind==="video").map(f=>f.track))],u=n.start_frame+Math.max(0,...n.items.map(f=>f.end))-1;return e.shots.flatMap(f=>[...f.plates,...f.reference?[f.reference]:[]].filter(m=>c.has(m.name)).map(m=>{let d=m.role==="REFERENCE",p=d?o:a;return{name:m.name,in:Math.max(n.start_frame,n.start_frame+m.clip.start-i),out:Math.min(u,n.start_frame+m.clip.end-1+i),target_dir:`${r.replace(/[\\/]$/,"")}${s}${f.name}`,...d?{}:{disable_tracks:l.filter(v=>v!==m.clip.track).map(v=>`V${v}`)},...p?{preset:p}:{}}}))}function Wee(e,t,n,i,r="",a=""){let o=/\\/.test(i)?"\\":"/";return nI(e,t).map(s=>({name:s.name,in:n+s.rec_in,out:n+s.rec_out-1,target_dir:`${i.replace(/[\\/]$/,"")}${o}${s.shot}`,...(s.role==="REFERENCE"?a:r)?{preset:s.role==="REFERENCE"?a:r}:{}}))}function rI(e,t){let n=e.clips.filter(c=>c.cells.kind!=="audio"&&/^V\d+$/.test(String(c.cells.track_no??""))&&c.cells.enabled!==!1&&c.cells.track_enabled!==!1).filter(c=>{let l=Number(c.cells["timeline_range.start"]);return t>=l&&t<l+Number(c.cells["timeline_range.dur"])}).sort((c,l)=>Number(String(l.cells.track_no).slice(1))-Number(String(c.cells.track_no).slice(1)))[0];if(!n)return"";let i=Di(e,n),r=Number(i?.cells.source_fps)||e.fps||24,a=n.cells.speed==null||n.cells.speed===""?1:Number(n.cells.speed)/100,s=(i?.cells.binding_state==="linked"?Oe(String(i.cells.source_timecode??""),r)??0:0)+Number(n.cells["source_range.start"]??0)+Math.floor((t-Number(n.cells["timeline_range.start"]))*a);return qe(s,r)}var f4=Object.entries(Zo).map(([e,t])=>[e,t.name]);function Vee(e,t){let n=Zo[t.naming]??Zo.conformtools,i=t.case?{...n,caseTransform:t.case}:n,r={...i,handleFrames:t.handles,...t.folder?{folderStructure:t.folder}:{},fields:i.fields.map(l=>t.fields[l.id]?{...l,value:t.fields[l.id]}:l)},a=e.start_frame+Math.max(0,...e.items.map(l=>l.end))-1,o=KO(e.markers.filter(l=>!l.cells.item_id).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??""),srcTc:rI(e,Number(l.cells.frame))})),{color:t.color,scope:t.scope,naming:r,startFrame:e.start_frame,lastFrame:a,folder:{project:e.project,timeline:e.timeline,...Object.fromEntries(r.fields.map(l=>[l.id,l.value])),...t.fields},...t.template?{template:t.template}:{}}),s=/\\/.test(t.root)?"\\":"/",c=t.root?`${t.root.replace(/[\\/]$/,"")}${o.dir?s+o.dir:""}`:"";return o.jobs.map((l,u)=>({id:String(u),job:{name:l.name,in:l.in,out:l.out,target_dir:c,...t.preset?{preset:t.preset}:{}},cells:{tc:l.marker.tc??"",marker:l.marker.name,frames:l.out-l.in+1,name:l.name,folder:c,dupe:l.dupe?"same name as another job":""}}))}function a4(e){return e.clips.flatMap(t=>{let n=wn(t);if(!n||n.kind!=="video"||t.cells.kind==="transition")return[];let i=Di(e,t),r=Number(t.cells["timeline_range.dur"]??0),a=Number(t.cells["source_range.start"]??0),o=String(i?.cells.target_url||t.cells.name||""),s=["scale","scale_x","scale_y","position_x","position_y","rotation","crop_left","crop_right","crop_top","crop_bottom"].map(u=>t.cells[u]??"").join("|"),c=(o.split(/[\\/]/).pop()??"").replace(/\.[^.]+$/,"").toLowerCase(),l=String(t.cells.reel_name??"").toLowerCase();return[{id:t.id,name:String(t.cells.name??""),track:n.track,rec_in:n.start,rec_out:n.start+r,media:o,alt:c||l||void 0,src_in:a,src_out:a+Number(t.cells["source_range.dur"]??r),speed:t.cells.speed==null||t.cells.speed===""?100:Number(t.cells.speed),sizing:s}]})}var o4={inserted:"Green",deleted:"Red",moved:"Purple",split:"Pink",joined:"Pink",slipped:"Cyan",retimed:"Yellow",reframed:"Sand"};function Ree(e,t){let n=o=>new Map(o.clips.map(s=>[s.id,String(s.cells.rec_in_tc??"")])),i=n(e),r=n(t),a=(o,s,c)=>c&&(o===e?i:r).get(c)||qe(o.start_frame+s,o.fps||24);return _O(a4(e),a4(t)).filter(o=>o.kinds[0]!=="unchanged"||o.loose).map((o,s)=>{let c=o.kinds.join(", "),l=o4[o.kinds.find(p=>o4[p])??""]??"Blue",u=`${c}${o.head?` \xB7 head ${o.head>0?"+":""}${o.head}f`:""}${o.tail?` \xB7 tail ${o.tail>0?"+":""}${o.tail}f`:""}${o.a&&o.b?` \xB7 A ${a(e,o.a.rec_in,o.a.id)}`:""}`,f=o.b?{side:"B",frame:o.b.rec_in}:{side:"A",frame:o.a.rec_in},m=o.a&&o.b?Math.floor((Math.max(o.a.src_in,o.b.src_in)+Math.min(o.a.src_out,o.b.src_out))/2):void 0,d=m!=null&&o.a.media&&o.b.media?{a:{path:o.a.media,frame:m},b:{path:o.b.media}}:void 0;return{id:String(s),...d?{pair:d}:{},mark:{...f,op:{op:"marker_add",frame:f.frame,color:l,name:`Reconform: ${o.kinds[0]}`,note:u,data:"ConformTools:reconform"}},cells:{b_tc:o.b?a(t,o.b.rec_in,o.b.id):"",a_tc:o.a?a(e,o.a.rec_in,o.a.id):"",change:c,clip:(o.b??o.a).name,paired:o.loose?"by name: check the picture":"",head:o.head??"",tail:o.tail??"",frames:o.b?o.b.rec_out-o.b.rec_in:o.a.rec_out-o.a.rec_in}}})}function Hee(e,t,n){let i=new Set((n?.markers??[]).filter(r=>!r.cells.item_id).map(r=>Number(r.cells.frame)));return e.filter(r=>r.cells.change!=="unchanged"||/differs/i.test(String(r.cells.picture??""))).map(r=>r.mark).filter(r=>r?.side===t).map(({op:r})=>{let a=r.frame;for(;i.has(a);)a++;return i.add(a),a===r.frame?r:{...r,frame:a,note:`${r.note} \xB7 ${a-r.frame}f after its cut (a marker was there)`}})}function Fee(e){let t=new Set(e.tracks.filter(o=>o.kind==="video"&&o.enabled===!1).map(o=>o.index)),n=new Map;for(let o of e.clips){let s=ur(e,o),c=Number(o.cells["timeline_range.dur"]??0),l=Number(o.cells["source_range.dur"]??c);s&&c>0&&n.set(s.id,l/c)}let i=e.items.filter(o=>o.kind==="video"&&o.enabled!==!1&&o.media_id&&o.src_in!=null&&!t.has(o.track)),r=[...new Set(i.flatMap(o=>[o.start,o.end]))].sort((o,s)=>o-s),a=[];for(let o=0;o+1<r.length;o++){let[s,c]=[r[o],r[o+1]],l=i.filter(p=>p.start<=s&&p.end>=c).sort((p,v)=>v.track-p.track)[0];if(!l)continue;let u=n.get(l.id)??1,f=l.src_in+Math.round((s-l.start)*u),m=f+Math.round((c-s)*u),d=a.at(-1);if(d&&d.id===l.id&&d.end===s&&d.src_out===f){d.end=c,d.src_out=m;continue}a.push({id:l.id,media_id:l.media_id,name:l.name,start:s,end:c,src_in:f,src_out:m})}return a.map(({id:o,...s})=>s)}var iI=e=>{let t=/(\d+)\s*[xX×]\s*(\d+)/.exec(String(e??""));return t?[Number(t[1]),Number(t[2])]:void 0};function aI(e){let t=e.clips.flatMap(i=>{let r=ur(e,i),a=Di(e,i);if(!r||r.kind!=="video"||i.cells.kind==="transition")return[];let o=String(a?.cells.target_url??""),s=Number(a?.cells["available_range.start"]),c=Number(i.cells["source_range.start"]??0),l=Number(i.cells["source_range.dur"]??r.end-r.start);return[{id:r.id,name:r.name,track:r.track,start:r.start,end:r.end,keys:new Set([...Ro(r.name),...Ro(o.split(/[\\/]/).pop()??"")]),meta_keys:new Set([...Ro(String(i.cells.reel_name??""))]),...Number.isFinite(s)?{src_tc:[s+c,s+c+l]}:{},media_fps:Number(a?.cells["available_range.rate"]??a?.cells.source_fps??e.fps??24),reel:String(i.cells.reel_name??"")||void 0,speed:i.cells.speed==null||i.cells.speed===""?100:Number(i.cells.speed),raster:iI(i.cells.Resolution)}]}),n=e.markers.filter(i=>!i.cells.item_id).flatMap(i=>{let r=new Set([...Ro(String(i.cells.name??"")),...Ro(String(i.cells.note??""))]);if(!r.size)return[];let a=Number(i.cells.frame),o=t.filter(s=>s.start<=a&&a<s.end).sort((s,c)=>s.track-c.track)[0];return[{frame:a,name:String(i.cells.name??""),keys:r,start:o?.start??a,end:o?.end??a+Math.max(1,Number(i.cells.duration??1)),plate:o}]});return{plates:t,markers:n}}var s4={marker:"shot marker",plate_name:"plate name",metadata:"plate metadata",timecode:"source timecode","":""};function Mee(e,t){let{plates:n,markers:i}=aI(e),r=a=>qe(e.start_frame+a,e.fps||24);return t4(t,n,i).map((a,o)=>({id:String(o),...a.status==="ready"&&a.plan?{piece:{path:a.comp.path,src_in:a.plan.src_in,src_out:a.plan.src_out,start:a.record_start+a.plan.record_offset,end:a.record_start+a.plan.record_offset+a.plan.covers,...a.plate?{plate:{track:a.plate.track,start:a.plate.start}}:{},copy_sizing:!!a.plate&&(!a.plate.raster||!a.comp.raster||a.plate.raster[0]===a.comp.raster[0]&&a.plate.raster[1]===a.comp.raster[1]),note:`Matched by ${s4[a.matched_by]} \xB7 confidence ${Math.round(a.confidence*100)}% \xB7 comp frame ${a.plan.src_in} on the cut${a.plan.note?` \xB7 ${a.plan.note}`:""}`}}:{},cells:{cant:a.status!=="ready",comp:a.comp.name,shot:a.shot,version:a.version??"",status:a.status,by:s4[a.matched_by],confidence:a.confidence?`${Math.round(a.confidence*100)}%`:"",plate:a.plate?.name??"",at:a.record_start!=null?r(a.record_start):"",why:a.reasons.join("; ")}}))}function Iee(e,t){let n=e.map(i=>i.piece).filter(Boolean);return n.length?[{op:"drop_in",name:t.name||"VFX",disable_plates:!!t.disable_plates,pieces:n}]:[]}var Fw=[["rec709","Rec.709 (gamma 2.4)"],["srgb","sRGB"],["p3d65","P3-D65 (gamma 2.6)"]],d4=[["flat","Flat 1.85"],["scope","Scope 2.39"],["full","Full 1.90"]],m4=[["2k","2K"],["4k","4K"]],p4=[["feature","Feature"],["trailer","Trailer"],["teaser","Teaser"],["short","Short"],["advertisement","Ad"],["test","Test"]],Dee=e=>e.map(t=>t[0]);var v4=[{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}],fr=v4.filter(e=>e.edits).map(e=>[e.id,e.label]),Uee=v4.map(e=>e.id);var $l=["marker_add","marker_update","marker_delete"],oI={resolve:"all",premiere:["clip_color","enabled","metadata","name","playhead","properties","timeline_rename",...$l],flame:["clip_color","enabled",...$l],nuke:$l,avid:$l,protools:$l,baselight:[]},Eee=(e,t)=>{let n=oI[e];return n==="all"||!!n?.includes(t)};var tc={strict:{tolerance_px:1,min_frames:1,gap_frames:0,black_threshold:16},standard:{tolerance_px:2,min_frames:2,gap_frames:1,black_threshold:10},relaxed:{tolerance_px:6,min_frames:4,gap_frames:3,black_threshold:6}},Mw="strict",h4={tolerance_px:[0,512],min_frames:[1,600],gap_frames:[0,600],black_threshold:[0,255]};function b4(e,t={}){let n=(e??Mw).trim().toLowerCase(),i=tc[n]??tc[Mw],r=tc[n]?n:n==="custom"?"custom":Mw,a={...i};for(let o of Object.keys(h4)){let s=t[o];if(s===void 0||!Number.isFinite(Number(s)))continue;let[c,l]=h4[o],u=Math.max(c,Math.min(l,Math.round(Number(s))));u!==a[o]&&(r="custom"),a[o]=u}return{...a,preset:r}}function ec(e,t){let n=Number(e),i=Number(t);return!Number.isFinite(n)||!Number.isFinite(i)?!1:n>0&&n>=i}function sI(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:Math.abs(t/n-e)/e>=.02}function lI(e,t,n,i,r){let a=Math.max(2,Number(r)||0);return Math.abs(e-t)<=a&&Math.abs(n-i)<=a}function cI(e,t,n,i,r,a){return!r||!(r.top>0||r.bottom>0||r.left>0||r.right>0)?!1:Math.abs(e-r.top)<=a&&Math.abs(t-r.bottom)<=a&&Math.abs(n-r.left)<=a&&Math.abs(i-r.right)<=a}var g4=[["bt","ct"],["bb","cb"],["bl","cl"],["br","cr"]],Cd=e=>Math.max(0,Math.trunc(Number(e)||0)),Yd=e=>Math.max(0,Math.min(1,Number(e)||0));function uI(e,t,n,i,r,a={}){let o=a.tolerance_px??4;i=Math.max(1,Math.trunc(i)),r=Math.max(1,Math.trunc(r));let s=[];for(let c of e??[]){let l=Math.trunc(Number(c.pts)||0),u=Cd(c.bt),f=Cd(c.bb),m=Cd(c.bl),d=Cd(c.br);if(!ec(Math.max(u,f,m,d),o)||cI(u,f,m,d,a.declared_blanking,o))continue;let p=Number(a.expected_aspect_ratio)||0;if(p>0){let b=Math.max(1,i-m-d),g=Math.max(1,r-u-f),y=m<=o&&d<=o,x=u<=o&&f<=o;if((y||x)&&sI(p,i,r)&&lI(u,f,m,d,o)&&Math.abs(b/g-p)/p<.02)continue}let v=n+l,h;for(let b of t??[])b.start<=v&&v<b.end&&(!h||b.track>h.track)&&(h=b);h&&s.push({frame_abs:v,bt:u,bb:f,bl:m,br:d,ct:Yd(c.ct),cb:Yd(c.cb),cl:Yd(c.cl),cr:Yd(c.cr),source:c.source??"pixels",clip:h})}return s.sort((c,l)=>c.frame_abs-l.frame_abs)}function fI(e,t){let n=[];return ec(e.bt,t)&&n.push("Top"),ec(e.bb,t)&&n.push("Bottom"),ec(e.bl,t)&&n.push("Left"),ec(e.br,t)&&n.push("Right"),n}function y4(e,t,n,i,r,a={}){let o=Math.max(1,Math.trunc(a.min_frames??1)),s=Math.max(0,Math.trunc(a.gap_frames??0)),c=a.tolerance_px??4,l=[],u;for(let f of uI(e,t,n,i,r,a)){(!u||u.clip!==f.clip||f.frame_abs-u.end_frame-1>s)&&(u={clip:f.clip,start_frame:f.frame_abs,end_frame:f.frame_abs,frame_count:0,measured:{bt:0,bb:0,bl:0,br:0},coverage:{ct:0,cb:0,cl:0,cr:0},sources:new Set},l.push(u)),u.end_frame=f.frame_abs,u.frame_count++,u.sources.add(f.source);for(let[m,d]of g4)f[m]>=u.measured[m]&&(u.measured[m]=f[m],u.coverage[d]=f[d])}return l.filter(f=>f.frame_count>=o).map(f=>({...f,duration_frames:f.end_frame-f.start_frame+1,sources:[...f.sources].sort(),zones:fI(f.measured,c)}))}function Yee(e){let t=new Map;for(let i of e){let r=t.get(i.clip.id);r||(r={clip:i.clip,measured:{bt:0,bb:0,bl:0,br:0},coverage:{ct:0,cb:0,cl:0,cr:0},frames:0,first_frame_abs:i.start_frame,zones:[],sources:[],ranges:[]},t.set(i.clip.id,r)),r.frames+=i.frame_count,r.first_frame_abs=Math.min(r.first_frame_abs,i.start_frame);for(let[a,o]of g4)i.measured[a]>=r.measured[a]&&(r.measured[a]=i.measured[a],r.coverage[o]=i.coverage[o]);r.sources=[...new Set([...r.sources,...i.sources])].sort(),r.ranges.push(i)}let n=["Top","Bottom","Left","Right"];return[...t.values()].map(i=>{let r=new Set(i.ranges.flatMap(a=>a.zones));return{...i,zones:n.filter(a=>r.has(a)),ranges:i.ranges.sort((a,o)=>a.start_frame-o.start_frame)}}).sort((i,r)=>i.clip.start-r.clip.start)}function Gee(e,t=1){let n=Math.max(0,Math.trunc(t)),i=[];for(let r of[...e].sort((a,o)=>a.frame-o.frame)){let a=i.at(-1);if(a&&r.frame-a.end_frame<=n+1){a.end_frame=Math.max(a.end_frame,r.frame),a.frames++,a.darkest=Math.min(a.darkest,r.avg);continue}i.push({start_frame:r.frame,end_frame:r.frame,duration_frames:1,frames:1,darkest:r.avg})}for(let r of i)r.duration_frames=r.end_frame-r.start_frame+1;return i}var Ft=()=>({"video.black_frame":{enabled:!0},"video.white_frame":{enabled:!0},"video.blanking":{enabled:!0,min_bar_px:1,min_reveal_depth_px:4},"video.clipping":{enabled:!0},"video.legal_range":{enabled:!0,max_pct:1},"video.banding":{enabled:!0,max_pct:.8},"video.interlace":{enabled:!0,expect:"progressive"},"video.freeze":{enabled:!0},"video.dead_pixel":{enabled:!0,min_run_frames:20},"video.maxcll":{enabled:!0,max_cll:0,max_fall:0},"video.aspect":{enabled:!0},"video.pse":{enabled:!0,sdr_peak_nits:200,flash_delta_nits:20,dark_max_nits:160,area_frac:.25,max_flashes_per_sec:3,red_flash:!0,patterns:!0,pattern_min_pairs:5},"video.shots":{enabled:!0,cut_threshold:.35,cut_ratio:4},"video.log_look":{enabled:!0},"video.video_range":{enabled:!0},"video.effective_resolution":{enabled:!0,soft_ratio:.5},"video.blockiness":{enabled:!0,threshold:.35},"video.noise":{enabled:!0},"video.exposure_outlier":{enabled:!0,z:3},"video.cadence":{enabled:!0,min_repeats:4},"video.gamut":{enabled:!0,max_pct:1,low:-.05,high:1.05},"video.text":{enabled:!0,fail_on_text:0},"video.burn_in":{enabled:!0,min_frames:24,change_frac:.8},"video.overlay":{enabled:!0,persist_frac:.8,min_shots:3},"video.leader":{enabled:!0,window_secs:120},"video.hdr_metadata":{enabled:!0}}),rn=(e,t,n,i=20)=>({"audio.integrated_loudness":{enabled:!0,target_lufs:e,tolerance_lu:t},"audio.true_peak":{enabled:!0,max_dbtp:n},"audio.lra":{enabled:!0,max_lra:i},"audio.short_term":{enabled:!1,max_lufs:0},"audio.momentary":{enabled:!1,max_lufs:0},"audio.silence":{enabled:!0,threshold_dbfs:-60,min_secs:1},"audio.phase":{enabled:!0,min_corr:-.3},"audio.clipping":{enabled:!0},"audio.clicks":{enabled:!0,ratio:12},"audio.dc_offset":{enabled:!0},"audio.tone":{enabled:!1,expected:0,level_dbfs:-20,tolerance_db:1.5},"audio.pop":{enabled:!1,expected:0}}),Iw=()=>Object.fromEntries(Object.keys(rn(-23,2,-1)).map(e=>[e,{enabled:!1}])),qw=(e,...t)=>Object.fromEntries(Object.entries(e).map(([n,i])=>[n,{...i,enabled:t.includes(n)}])),Dw=e=>({...e,"video.maxcll":{enabled:!0,max_cll:0,max_fall:0},"video.hdr_metadata":{enabled:!0},"video.legal_range":{enabled:!1}}),Mt=(e,t,n,i,r,a,o)=>({id:e,label:t,group:n,description:i,color_space:r,checks:a,audio:o}),x4=[Mt("conform_default","Conform default","Conform","Every video check (dead / stuck / hot pixels included), PSE, a 120 s leader window, EBU R128 audio (-23 LUFS, -1 dBTP) with a house \xB12 LU tolerance. The pack when there is no delivery spec.","sdr_rec709",{...Ft(),...rn(-23,2,-1)},{lufs:-23,tolerance:2,true_peak:-1}),Mt("proxy_leak","Proxy leak (shots on offline media)","Conform","Only the per-shot checks that expose offline media in the online: shots, effective resolution, blockiness, burn-in counters, text. Fast: no PSE, no audio.","sdr_rec709",{...qw(Ft(),"video.shots","video.effective_resolution","video.blockiness","video.burn_in","video.text"),...Iw()},null),Mt("textless_master","Textless master","Conform","Conform default, and any text-like graphics anywhere in the picture fails.","sdr_rec709",{...Ft(),...rn(-23,2,-1),"video.text":{enabled:!0,fail_on_text:1}},{lufs:-23,tolerance:2,true_peak:-1}),Mt("blanking_only","Blanking only","Conform","Black edges, partial reveals and black frames, nothing else.","sdr_rec709",{...qw(Ft(),"video.blanking","video.black_frame","video.aspect"),...Iw()},null),Mt("pse_only","PSE (Harding-style) only","Conform","The Ofcom / ITU-R BT.1702 flash, red-flash and pattern rules alone. Not a certified Harding test.","sdr_rec709",{...qw(Ft(),"video.pse","video.shots"),...Iw()},null),Mt("netflix_sdr","Netflix SDR","Streaming","Rec.709 legal range, PSE mandatory, -27 LKFS \xB12 (programme-gated here, dialogue-gated in the spec), -2 dBTP.","sdr_rec709",{...Ft(),...rn(-27,2,-2)},{lufs:-27,tolerance:2,true_peak:-2}),Mt("netflix_hdr","Netflix HDR (PQ)","Streaming","PQ light levels measured and reported, declared-vs-measured HDR metadata, PSE, -27 LKFS \xB12 / -2 dBTP.","hdr_pq",{...Dw(Ft()),...rn(-27,2,-2)},{lufs:-27,tolerance:2,true_peak:-2}),Mt("apple_tv_sdr","Apple TV+ SDR","Streaming","Rec.709 legal range, PSE, -24 LKFS \xB12, -2 dBTP.","sdr_rec709",{...Ft(),...rn(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Mt("apple_tv_hdr","Apple TV+ HDR (PQ)","Streaming","PQ light levels reported, HDR metadata checked, PSE, -24 LKFS \xB12 / -2 dBTP.","hdr_pq",{...Dw(Ft()),...rn(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Mt("amazon_sdr","Amazon / Prime Video SDR","Streaming","Rec.709 legal range, PSE, -24 LKFS \xB12, -2 dBTP.","sdr_rec709",{...Ft(),...rn(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Mt("amazon_hdr","Amazon / Prime Video HDR (PQ)","Streaming","PQ light levels reported, HDR metadata checked, PSE, -24 LKFS \xB12 / -2 dBTP.","hdr_pq",{...Dw(Ft()),...rn(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Mt("ebu_r128","EBU R128","Broadcast","Programme loudness -23 LUFS \xB11, true peak -1 dBTP, LRA \u2264 20 LU; EBU R103 RGB gamut on.","sdr_rec709",{...Ft(),...rn(-23,1,-1,20)},{lufs:-23,tolerance:1,true_peak:-1}),Mt("bbc_dpp","BBC / DPP (AS-11 UK)","Broadcast","EBU R128 loudness (-23 LUFS \xB11), true peak -3 dBTP, R103 gamut, PSE mandatory.","sdr_rec709",{...Ft(),...rn(-23,1,-3,20)},{lufs:-23,tolerance:1,true_peak:-3}),Mt("atsc_a85","ATSC A/85 (US broadcast)","Broadcast","Dialnorm target -24 LKFS \xB12, true peak -2 dBTP; SMPTE legal range and PSE on.","sdr_rec709",{...Ft(),...rn(-24,2,-2,20)},{lufs:-24,tolerance:2,true_peak:-2})],w4=x4.map(e=>[e.id,e.label]),Bee=e=>x4.find(t=>t.id===e);function Fo(e,t,n,i,r){let a=1-r;return a*a*a*e+3*a*a*r*t+3*a*r*r*n+r*r*r*i}function dI(e,t,n){let i=0,r=1;for(let o=0;o<48;o++){let s=(i+r)/2;Fo(t[0],t[1],t[2],t[3],s)<e?i=s:r=s}let a=(i+r)/2;return Fo(n[0],n[1],n[2],n[3],a)}var Jw=e=>!!(e.sOutX||e.sOutY||e.sInX||e.sInY);function P4(e){return e.some(t=>Jw(t)||t.interp==="bezier")}var z4=new WeakMap;function mI(e,t){let n=z4.get(e);if(n&&n.to===t)return n;let i=e.x,r=e.y,a=t.x,o=t.y,s,c,l,u;Jw(e)||Jw(t)?(s=i+(e.sOutX??0),c=r+(e.sOutY??0),l=a+(t.sInX??0),u=o+(t.sInY??0)):(s=i+(a-i)/3,c=r+(o-r)/3,l=a-(a-i)/3,u=o-(o-r)/3);let f=[0],m=i,d=r;for(let v=1;v<=256;v++){let h=v/256,b=Fo(i,s,l,a,h),g=Fo(r,c,u,o,h);f.push(f[f.length-1]+Math.hypot(b-m,g-d)),m=b,d=g}let p={to:t,arc:f,ctrl:[i,s,l,a,r,c,u,o]};return z4.set(e,p),p}function k4(e,t,n){if(!e.length)return[0,0];let i=e[0],r=e[e.length-1];if(t<=i.time)return[i.x,i.y];if(t>=r.time)return[r.x,r.y];for(let a=0;a<e.length-1;a++){let o=e[a],s=e[a+1];if(!(t>=o.time&&t<s.time))continue;if(o.interp==="hold")return[o.x,o.y];let c=s.time-o.time;if(c<=0)return[s.x,s.y];let l=c/(n||24),{arc:u,ctrl:f}=mI(o,s),m=u[u.length-1];if(!(m>1e-12))return[o.x,o.y];let d=l>0?m/l:0,p=o.interp==="bezier"&&o.outSpeed!=null?o.outSpeed:d,v=o.interp==="bezier"&&o.outInfluence!=null?o.outInfluence:1/3,h=s.interp==="bezier"&&s.inSpeed!=null?s.inSpeed:d,b=s.interp==="bezier"&&s.inInfluence!=null?s.inInfluence:1/3,g=1/6,y=(C,R)=>Math.abs(C-R)<1e-9,x=p===0&&y(v,1/3),z=h===0&&y(b,1/3);y(v,g)&&(p=d,v=z?.5:1/3),y(b,g)&&(h=d,b=x?.5:1/3);let S=(t-o.time)/(n||24),P=Math.min(Math.max(dI(S,[0,v*l,l-b*l,l],[0,p*v*l,m-h*b*l,m]),0),m),T=1,j=256;for(;T<j;){let C=T+j>>1;u[C]<P?T=C+1:j=C}let X=u[T-1],w=u[T],N=w>X?(P-X)/(w-X):0,F=(T-1+N)/256;return[Fo(f[0],f[1],f[2],f[3],F),Fo(f[4],f[5],f[6],f[7],F)]}return[r.x,r.y]}function O4(e,t){if((t==="flip_horizontal"?e.flip_horizontal:e.flip_vertical)===!0)return!0;let i=e.effects;return Array.isArray(i)?i.some(r=>{let a=r;return a?.kind===t&&a.enabled!==!1}):!1}function an(e,t){return typeof e=="number"&&Number.isFinite(e)?e:Array.isArray(e)&&typeof e[t]=="number"?e[t]:null}function pI(e,t,n,i,r){let a;Array.isArray(e.value)&&Array.isArray(t.value)?a=Math.hypot((an(t.value,0)??0)-(an(e.value,0)??0),(an(t.value,1)??0)-(an(e.value,1)??0)):a=(an(t.value,0)??0)-(an(e.value,0)??0);let o=i/n;if(a===0||!(r>0))return o;let s=h=>{let b=typeof h?.x=="number"?h.x:null,g=typeof h?.y=="number"?h.y:null;if(b===null||g===null)return null;let y=Math.min(Math.max(g,0),1)*n;return{dx:y,dy:b/r/a*y}},c=s(e.tout)??{dx:n/3,dy:n/3/n},l=s(t.tin)??{dx:n/3,dy:n/3/n},u=Math.min(Math.max(c.dx,0),n),f=c.dy,m=n-Math.min(Math.max(l.dx,0),n),d=1-l.dy,p=(h,b,g,y)=>{let x=1-y;return 3*h*y*x*x+3*b*y*y*x+g*y*y*y},v=o;for(let h=0;h<8;h++){let b=p(u,m,n,v)-i,g=1-v,y=3*(u*(g*g-2*v*g)+m*(2*v*g-v*v)+n*v*v);if(Math.abs(y)<1e-9)break;let x=v-b/y;if(!(x>=0&&x<=1))break;if(Math.abs(x-v)<1e-7){v=x;break}v=x}if(Math.abs(p(u,m,n,v)-i)>n*1e-4){let h=0,b=1;for(let g=0;g<40;g++)v=(h+b)/2,p(u,m,n,v)<i?h=v:b=v}return p(f,d,1,v)}function vI(e,t,n,i=0,r=0){let o=(e.keyframes??[]).filter(l=>l.parameter_path===t&&typeof l.time?.value=="number").map(l=>({time:l.time.value,value:l.value,interp:l.interp??"linear",tin:l.tangent_in,tout:l.tangent_out,drt:!!l.raw_extraction?.drt_tangent})).sort((l,u)=>l.time-u.time);if(!o.length)return;let s=an(o[0].value,i)??0,c=an(o[o.length-1].value,i)??0;if(n<=o[0].time)return s;if(n>=o[o.length-1].time)return c;for(let l=0;l<o.length-1;l++){let u=o[l],f=o[l+1];if(n>=u.time&&n<=f.time){let m=an(u.value,i)??0,d=an(f.value,i)??0;if(u.interp==="hold")return m;let p=f.time-u.time||1,v=(u.tout||f.tin)&&!u.drt&&!f.drt?pI(u,f,p,n-u.time,r):(n-u.time)/p;return m+(d-m)*v}}return c}function hI(e){let t=e.keyframes??[];for(let n of t){if(n.parameter_path==="speed")continue;let i=n.time?.rate;if(typeof i=="number"&&i>0)return i}}function S4(e){let t=e.speed;return typeof t=="number"&&Number.isFinite(t)?Math.abs(t)/100:1}function bI(e){let t=e,n=t.raw_extraction??void 0,i=c=>{let l=n?.[c];return typeof l=="number"&&Number.isFinite(l)?l:void 0};if(!(t.is_reinterpreted===!0||n?.isReinterpreted===!0))return 1;let a=t.original_fps??i("originalFps"),o=t.interpreted_fps??i("reinterpretedFps");if(a!=null&&o!=null&&a>0&&o>0)return o/a;let s=i("reinterpretationSpeedAdjustment");return s!=null&&s>0?s/100:1}function T4(e,t){let i=(e.keyframes??[]).filter(o=>o.parameter_path==="speed"&&typeof o.time?.value=="number"&&typeof o.value=="number").map(o=>({x:o.time.value,y:o.value,tan:Array.isArray(o.raw_extraction?.drtNativeTangent)?o.raw_extraction.drtNativeTangent:null})).sort((o,s)=>o.x-s.x);if(i.length<2)return null;let r=(o,s)=>{let c=i[o].tan;if(c&&c.length>=4){if(s==="in"&&c[0])return c[1]/c[0];if(s==="out"&&c[2])return c[3]/c[2]}let l=s==="out"?Math.min(o+1,i.length-1):Math.max(o-1,0),u=Math.min(o,l),f=Math.max(o,l),m=i[f].x-i[u].x;return m>0?(i[f].y-i[u].y)/m:0},a=i.length-1;if(t<=i[0].x)return i[0].y+(t-i[0].x)*r(0,"out");if(t>=i[a].x)return i[a].y+(t-i[a].x)*r(a,"in");for(let o=0;o<a;o++){let s=i[o],c=i[o+1];if(t>c.x)continue;let l=c.x-s.x;if(l<=0)return c.y;let u=(t-s.x)/l,f=u*u,m=f*u,d=r(o,"out"),p=r(o+1,"in");return(2*m-3*f+1)*s.y+(m-2*f+u)*l*d+(-2*m+3*f)*c.y+(m-f)*l*p}return i[a].y}function gI(e,t,n){let i=e.timeline_range?.start?.value??0,r=e.timeline_range?.start?.rate||n,a=(t-i)/r,o=e.source_range?.start,s=o&&typeof o.value=="number"&&o.rate?o.value/o.rate:0,c=T4(e,a);if(c!=null)return(s+c)*n;let l=S4(e);if(e.speed_reverse){let u=e.source_range?.duration,f=u&&typeof u.value=="number"&&u.rate?Math.max(0,u.value-1)/u.rate:0;return(s+f-a*l)*n}return(s+a*l)*n}function yI(e,t){let n=e.timeline_range?.start,i=n?.value??0,r=n?.rate||24,a=e.source_range?.start,o=a?.value??0,s=a?.rate||r,c=T4(e,(t-i)/r);if(c!=null)return o+c*s;let l=S4(e)*bI(e),u=(t-i)*(s/r)*l;if(e.speed_reverse){let f=e.source_range?.duration?.value??0;return o+Math.max(0,f-1)-u}return o+u}function xI(e){let t=e.keyframes??[],n=[];for(let i of t){if(i.parameter_path!=="position"||typeof i.time?.value!="number")continue;let r=i.value,a=an(r,0),o=an(r,1);if(a==null||o==null)return null;let s=i.raw_extraction?.tangentPs??void 0,c=(l,u)=>{let f=l?.[u];return typeof f=="number"&&Number.isFinite(f)?f:void 0};n.push({time:i.time.value,x:a,y:o,interp:i.interp??"linear",outSpeed:i.tangent_out?.x??void 0,outInfluence:i.tangent_out?.y??void 0,inSpeed:i.tangent_in?.x??void 0,inInfluence:i.tangent_in?.y??void 0,sOutX:c(s,"spatialOutX"),sOutY:c(s,"spatialOutY"),sInX:c(s,"spatialInX"),sInY:c(s,"spatialInY")})}return n.length<2?null:(n.sort((i,r)=>i.time-r.time),P4(n)?n:null)}function X4(e,t){let n=hI(e)??e.timeline_range?.start?.rate??24,i=gI(e,t,n),r=!1,a=(l,u=0)=>{let f=vI(e,l,i,u,n);return f!==void 0&&(r=!0),f},o=l=>typeof l=="number"?l:null,s=xI(e);s&&(r=!0);let c=s?k4(s,i,n):null;return{scale:a("scale")??o(e.scale),scaleX:a("scale.x")??o(e.scale_x),scaleY:a("scale.y")??o(e.scale_y),posX:c?c[0]:a("position",0)??a("position.x")??o(e.position_x)??0,posY:c?c[1]:a("position",1)??a("position.y")??o(e.position_y)??0,rotation:a("rotation")??o(e.rotation)??0,anchorX:a("anchor",0)??a("anchor.x")??o(e.anchor_x)??0,anchorY:a("anchor",1)??a("anchor.y")??o(e.anchor_y)??0,opacity:a("opacity")??o(e.opacity),cropL:a("crop.left")??o(e.crop_left)??0,cropR:a("crop.right")??o(e.crop_right)??0,cropT:a("crop.top")??o(e.crop_top)??0,cropB:a("crop.bottom")??o(e.crop_bottom)??0,flipH:O4(e,"flip_horizontal"),flipV:O4(e,"flip_vertical"),animated:r}}function j4(e,t){return Math.floor(yI(e,t)+1e-9)}function Yw(e,t){let n=t?e.timelines.find(i=>i.id===t||i.name===t):e.timelines.find(i=>i.kind==="primary")??e.timelines[0];if(!n)throw new Error(t?`no timeline ${t} in this session`:"this session has no timeline");if(!n.resolution_w||!n.resolution_h)throw new Error(`${n.name}: the timeline has no raster (resolution) in the session`);return n}var wI=e=>e.fps_den?e.fps_num/e.fps_den:e.fps_num,Mo=(e,t)=>qe((e.start_frame??0)+t,wI(e),!!e.is_drop_frame),zI=e=>e.split(/[\\/]/).pop()??e,rc=e=>e.tracks.filter(t=>t.kind==="Video").sort((t,n)=>t.track_index-n.track_index),zn=e=>{let t=e.timeline_range.start.value;return[t,t+e.timeline_range.duration.value]},Gd=e=>e.items.filter(t=>t.kind==="clip");function Io(e,t){let n=e.media_references.find(s=>s.id===t.media_reference_id),i=n?.local_path??n?.target_url?.replace(/^file:\/\//,"")??null,r=n?.source_resolution_w??0,a=n?.source_resolution_h??0,o=n?.source_pixel_aspect||1;return{path:i,w:r*o,h:a}}var Ji=(e,t)=>X4(e,t),Uw=(e,t)=>j4(e,t),N4=(e,t,n)=>({box:[t,n],scale:[(e.scaleX??e.scale??100)/100,(e.scaleY??e.scale??100)/100],pos:[e.posX*t,e.posY*n],rot:e.rotation,anchor:[e.anchorX,e.anchorY],crop:[e.cropL/100,e.cropR/100,e.cropT/100,e.cropB/100],flip:[e.flipH,e.flipV]});function L4(e,t,n,i){if(!(n>0&&i>0))return[e,t];let r=Math.min(e/n,t/i);return[n*r,i*r]}function M4(e,t,n){let i=t-e,r=Math.max(1,Math.min(n,i));return[...new Set(Array.from({length:r},(a,o)=>e+Math.min(i-1,Math.floor((o+.5)*i/r))))]}var Gw=["fit","fill","crop","stretch"];function I4(e,t,n){if(n)return n;let i=e.reframe_fit??t.mismatch_policy??"fit";return i==="none"?"crop":Gw.includes(i)?i:"fit"}function q4(e,t,n,i,r){if(!(e>0&&t>0)||r==="fit")return[1,1];let a=n/e,o=i/t,s=[a,a],c=[o,o],l=a<=o?s:c,u=r==="crop"?[1,1]:r==="fill"?a>o?s:c:[a,o];return[u[0]/l[0],u[1]/l[1]]}var Er=(e,t)=>Math.round(e*10**t)/10**t||0;function Ew(e,t,n,i=[1,1]){return{Pan:Er(e.position_x*t/i[0],3),Tilt:Er(-e.position_y*n/i[1],3),ZoomX:Er(e.scale_x/100/i[0],5),ZoomY:Er(e.scale_y/100/i[1],5),RotationAngle:Er(-e.rotation,3),FlipX:e.flip_h,FlipY:e.flip_v}}function Z4(e,t,n,i){let r=(t.scaleX??t.scale??100)/100,a=t.rotation*Math.PI/180,o=Math.cos(a),s=Math.sin(a),c=e.position_x*n,l=e.position_y*i;return{...e,scale_x:e.scale_x*r,scale_y:e.scale_y*r,rotation:e.rotation+t.rotation,position_x:(t.posX*n+r*(o*c-s*l))/n,position_y:(t.posY*i+r*(s*c+o*l))/i}}var D4=e=>({scale_x:e.scaleX??e.scale??100,scale_y:e.scaleY??e.scale??100,position_x:e.posX,position_y:e.posY,rotation:e.rotation,flip_h:e.flipH,flip_v:e.flipV}),W4=e=>(e.scale??100)===100&&(e.scaleX??100)===100&&(e.scaleY??100)===100&&!e.posX&&!e.posY&&!e.rotation&&!e.cropL&&!e.cropR&&!e.cropT&&!e.cropB&&!e.flipH&&!e.flipV,ste=["edit","input","node"];function V4(e){let t=e.node,n=typeof t=="object"&&t?t:{layer:e.layer??1,node:t};return{...n.node!==void 0&&n.node!==""?{node:n.node}:{},...n.layer&&n.layer!==1?{layer:n.layer}:{}}}var PI={aligned:"Green",animated:"Yellow",no_match:"Red",refused:"Red"};async function kI(e,t){let n=t.offline_reference,i=_e(t),r=i,a=Math.max(...t.tracks.flatMap(v=>v.items.map(h=>h.timeline_range.start.value+h.timeline_range.duration.value)),0),o=v=>({kind:"Video",track_index:Math.max(0,...rc(t).map(h=>h.track_index))+1,name:"OFFLINE REFERENCE",enabled:!0,items:v});if(n?.session_id){let{getSession:v}=await import("./store-JNWELX35.js"),h=(await v(n.session_id)).session,b=h.timelines.find(P=>P.kind==="primary")??h.timelines[0],g=(t.start_frame??0)+(n.frame_offset??0)-(b.start_frame??0),y=rc(b).filter(P=>P.enabled!==!1).flatMap(P=>P.items.filter(T=>T.kind==="clip"&&T.enabled!==!1&&T.media_reference_id).map(T=>({i:T,top:P.track_index}))),x=[...new Set(y.flatMap(({i:P})=>[P.timeline_range.start.value,P.timeline_range.start.value+P.timeline_range.duration.value]))].sort((P,T)=>P-T),z=[];for(let P=0;P+1<x.length;P++){let[T,j]=[x[P],x[P+1]],X=y.filter(({i:H})=>H.timeline_range.start.value<=T&&T<H.timeline_range.start.value+H.timeline_range.duration.value).sort((H,M)=>M.top-H.top)[0],[w,N]=[Math.max(0,T-g),Math.min(a,j-g)];if(!X||N<=w)continue;let F=X.i,C=z.at(-1);if(C&&C.from===F.id&&C.timeline_range.start.value+C.timeline_range.duration.value===w){C.timeline_range.duration.value+=N-w,C.source_range.duration.value+=N-w;continue}let{id:R,timeline_range:E,source_range:Y,media_reference_id:K,keyframes:I,...te}=F;z.push({...te,id:`offline-ref-${z.length}`,from:F.id,kind:"clip",enabled:!0,media_reference_id:`offref:${K}`,timeline_range:{start:{value:w,rate:r},duration:{value:N-w,rate:r}},source_range:{start:{value:Y.start.value+(w+g-F.timeline_range.start.value),rate:Y.start.rate},duration:{value:N-w,rate:Y.start.rate}}})}if(!z.length)throw new He("not_found",`the offline reference timeline "${b.name}" has no picture over this timeline`);let S=new Set(z.map(P=>String(P.media_reference_id).slice(7)));return{lane:o(z),media:h.media_references.filter(P=>S.has(P.id)).map(P=>({...P,id:`offref:${P.id}`})),name:`timeline ${b.name}`}}let s=n?.media_reference_id?e.media_references.find(v=>v.id===n.media_reference_id):void 0,c=s?.local_path??s?.target_url?.replace(/^file:\/\//,"");if(!s||!c)throw new He("not_found","this timeline has no offline reference linked in Resolve (Timeline \u203A Link Offline Reference Clip): a movie or another timeline");let{probeMedia:l}=await import("./media-XBNKYKB7.js"),u=await l(c),f=u.source_timecode?Co(u.source_timecode,i,null):0,m=u.available_range?.duration?.value??u.declared_duration?.value??null,d=(t.start_frame??0)+(n.frame_offset??0)-f;m!=null&&(d>=m||d+a<=0)&&(d=n.frame_offset??0);let p=m!=null?Math.max(1,Math.min(a,m-d)):a;return{lane:o([{id:"offline-reference",kind:"clip",name:s.name??"offline reference",enabled:!0,media_reference_id:s.id,timeline_range:{start:{value:0,rate:r},duration:{value:p,rate:r}},source_range:{start:{value:d,rate:r},duration:{value:p,rate:r}}}]),media:[],name:s.name??zI(c)}}async function lte(e,t,n,i){if(t.reference_track!=="offline")return await R4(e,t,n,i);let r=Yw(e,t.timeline_id),{lane:a,media:o,name:s}=await kI(e,r);r.tracks.push(a),e.media_references.push(...o);try{return{...await R4(e,{...t,reference_track:rc(r).length,reference_label:"the offline reference"},n,i),reference:`the offline reference (${s})`}}finally{r.tracks.splice(r.tracks.indexOf(a),1),e.media_references=e.media_references.filter(c=>!o.includes(c))}}async function R4(e,t,n,i){let r=Yw(e,t.timeline_id),a=r.resolution_w,o=r.resolution_h,s=rc(r),c=s.findIndex(w=>/\b(ref|reference|offline)\b/i.test(String(w.name??""))),l=t.reference_track||(c>=0?c+1:s.length),u=s[l-1];if(!u)throw new Error(`no video track V${l} (the timeline has ${s.length})`);if(t.tracks?.includes(l))throw new He("invalid_args",`the track to align cannot be the reference track (V${l})`);let f=(t.tracks?.length?t.tracks:s.map((w,N)=>N+1).filter(w=>s[w-1].enabled!==!1)).filter(w=>w!==l);for(let w of f)if(!s[w-1])throw new Error(`no video track V${w} (the timeline has ${s.length})`);let m=t.input_scaling??"fit",d=t.sizing_target??"edit",p=600,v=(w,N)=>{let F=Math.max(1,N-w);if(t.samples==="ends")return[...new Set([0,.25,.5,.75,1].map(E=>w+Math.round(E*(Math.max(w,N-1)-w))))];let C=(t.samples??"half")==="half"&&!t.step?Math.max(1,Math.round(_e(r)/2)):t.step,R=t.samples==="all"?Math.max(1,Math.ceil(F/p)):C?Math.max(1,Math.floor(C),Math.ceil(F/p)):0;if(R){let E=[];for(let Y=w;Y<N;Y+=R)E.push(Y);return E.at(-1)!==N-1&&E.push(N-1),E}return M4(w,N,Math.max(1,Math.min(p,Math.floor(Number(t.samples))||1)))},h=Number(r.start_frame??0),b=[],g=[],y=Gd(u),x=t.scope??"all",z=new Set(t.picks??[]);if(x==="selected"&&!z.size)throw new Error("no clips selected: select clips in the timeline, or align the whole timeline");for(let w of f)for(let N of Gd(s[w-1])){let[F,C]=zn(N);if(x==="playhead"&&!(F<=(t.at??-1)&&(t.at??-1)<C)||x==="selected"&&!z.has(`${w}:${F}`))continue;let R={item_id:N.id,name:N.name??N.id,track:w,start:F,end:C,record_tc:Mo(r,F),verdict:"refused",confidence:null,samples:[]};b.push(R);let E=re=>{R.reason=re};if(N.enabled===!1){E("disabled");continue}let Y,K=0,I=0;for(let re of y){let[he,Re]=zn(re),ve=Math.max(F,he),Fe=Math.min(C,Re);Fe-ve>I-K&&(Y=re,K=ve,I=Fe)}if(!Y){if(t.reference_label){E(`${t.reference_label} does not cover it (${Mo(r,F)}\u2013${Mo(r,C)}): it ends before this clip`);continue}let re=u.items.find(he=>{let[Re,ve]=zn(he);return he.kind!=="clip"&&he.kind!=="gap"&&Math.min(C,ve)>Math.max(F,Re)});E(re?`V${l} has ${/compound|stack|timeline/i.test(String(re.kind))?"a compound clip or nested timeline":`a ${re.kind}`} over it, not a movie clip: Align reads a media file there (decompose it, or use Offline ref)`:y.length?`nothing on V${l} over it (${Mo(r,F)}\u2013${Mo(r,C)}): the reference does not cover this clip`:`V${l} has no movie clips: pick the track the reference is on, or Offline ref`);continue}let te=Io(e,Y),H=Io(e,N);if(!te.path){E(`the reference clip ${Y.name??Y.id} is not linked (timeline_relink first)`);continue}if(!H.path){E("not linked (timeline_relink first)");continue}let M=v(K,I),W=Ji(Y,K),D=W4(W)?void 0:W;if(D){let re=D.scaleX??D.scale??100,he=D.scaleY??D.scale??100,Re=D.animated||M.some(ve=>JSON.stringify(Ji(Y,ve))!==JSON.stringify(W))?"keyframed":Math.abs(re-he)>1e-6?"scaled unevenly":D.cropL||D.cropR||D.cropT||D.cropB?"cropped":D.flipH||D.flipV?"flipped":D.anchorX||D.anchorY?"anchored off centre":d!=="edit"?"resized (Colour-page sizing is solved against an unresized reference only)":"";if(Re){E(`the reference clip ${Y.name??Y.id} is ${Re}; the fit is against its raw picture`);continue}}if(te.w>0&&te.h>0&&Math.abs(te.w/te.h-a/o)>.01*(a/o)){E(`the reference ${te.w}x${te.h} does not fill the ${a}x${o} frame`);continue}let ae=re=>re.map(he=>({ref:te.path,refFrame:Uw(Y,he),src:H.path,srcFrame:Uw(N,he)})),oe=Array.from({length:I-K},(re,he)=>K+he),ie=Ji(N,F);g.push({row:R,item:N,recs:M,every:oe,refT:D,ask:{pairs:ae(M),every:ae(oe),every_t:oe.map(re=>re-F),edit:D4(ie),edit_identity:W4(ie),edit_animated:!!ie.animated,anchor_off:!!(ie.anchorX||ie.anchorY),...t.inputs?.get(`${w}:${F+h}`)?.length?{input:t.inputs.get(`${w}:${F+h}`)}:{}}})}let S=g.length?await Yr({op:"reframe",items:g.map(w=>w.ask),out:[a,o],target:d},n,i):{items:[],offsets:[]},P=S.offsets;S.items.forEach((w,N)=>{let{row:F,item:C,recs:R,every:E,ask:Y,refT:K}=g[N];if(K&&(w.verdict==="animated"&&Object.assign(w,{verdict:"refused",reason:"a move under a resized reference is not solved yet",keys:void 0,edit_keys:void 0,grade_keys:void 0}),w.transform&&(w.transform=Z4(w.transform,K,a,o)),w.edit_transform&&(w.edit_transform=Z4(w.edit_transform,K,a,o)),w.transform)){let M=Y.edit,W=w.transform,D=.5/a;w.unchanged=Math.abs(W.scale_x-M.scale_x)<.05&&Math.abs(W.scale_y-M.scale_y)<.05&&Math.abs(W.position_x-M.position_x)<D&&Math.abs(W.position_y-M.position_y)<.5/o&&Math.abs(W.rotation-M.rotation)<.02}let I=w.measured==="every"?E:R,te=w.measured==="every"?Y.every:Y.pairs,H=(({w:M,h:W})=>q4(M,W,a,o,I4(C,r,t.input_scaling)))(Io(e,C));F.samples=w.scores.map((M,W)=>({record:I[w.at[W]],ref_frame:te[w.at[W]].refFrame,src_frame:te[w.at[W]].srcFrame,score:M})),Object.assign(F,{verdict:w.verdict,confidence:w.confidence,...w.reason?{reason:w.reason}:{},...w.label?{label:w.label}:{},...w.unchanged?{unchanged:!0}:{},...w.grade_sizing?{grade_sizing:w.grade_sizing}:{}}),w.transform&&(F.transform=w.transform,F.properties=Ew(w.edit_transform??w.transform,a,o,H)),w.keys?.length&&(F.keys=w.keys.map(M=>({record:I[w.at[M.j]],transform:M.transform,properties:Ew(M.transform,a,o,H),confidence:M.confidence}))),w.grade_keys?.length&&(F.grade_keys=w.grade_keys.map(({shape:M,...W})=>M?.kind==="resolve_dissolve"?{...W,ease_in:M.start,ease_out:M.end}:W),F.grade_keys[0].t>0&&F.grade_keys.unshift({...F.grade_keys[0],t:0,ease_in:void 0,ease_out:void 0})),w.edit_keys?.length&&(F.edit_keys=w.edit_keys[0].t>0?[{...w.edit_keys[0],t:0,shape:void 0},...w.edit_keys]:w.edit_keys)});let T=[];for(let w of b){let N={track:w.track,start:w.start};if(w.verdict==="aligned"&&d==="edit"&&!w.unchanged){let F=w.properties;T.push({op:"properties",item:N,set:{...F.ZoomX!==F.ZoomY?{ZoomGang:!1}:{},...F}})}if(w.verdict==="animated"&&w.edit_keys&&T.push({op:"edit_keys",item:N,keys:w.edit_keys}),w.verdict==="animated"&&w.grade_keys&&T.push({op:"grade_sizing",item:N,target:d==="node"?"node":"input",keys:w.grade_keys,...d==="node"?V4(t):{}}),w.verdict==="aligned"&&w.grade_sizing&&!w.unchanged&&T.push({op:"grade_sizing",item:N,target:d,...w.grade_sizing,...d==="node"?V4(t):{}}),t.markers??!0){let F={aligned:"Aligned",animated:"Animated",no_match:"No match",refused:"Not aligned"}[w.verdict],C=[w.label,w.confidence!=null?`confidence ${w.confidence}`:"",w.reason].filter(Boolean).join(" \xB7 ");T.push({op:"marker_add",frame:w.start,color:PI[w.verdict],name:`${F}: ${w.name}`,note:C,data:"ConformTools:align"})}}let j;if(t.apply_session){j=0;for(let w of b.filter(N=>N.verdict==="aligned")){let N=w.transform;Cw(e,"transform",{timeline_id:r.id,item_id:w.item_id,scale:N.scale_x,position_x:N.position_x,position_y:N.position_y,rotation:N.rotation});let F=r.tracks.flatMap(C=>C.items).find(C=>C.id===w.item_id);Math.abs(N.scale_x-N.scale_y)>.001&&(F.scale_x=N.scale_x,F.scale_y=N.scale_y),N.flip_h?F.flip_horizontal=!0:delete F.flip_horizontal,N.flip_v?F.flip_vertical=!0:delete F.flip_vertical,j++}}let X={aligned:0,animated:0,no_match:0,refused:0};for(let w of b)X[w.verdict]++;return{timeline:r.name??r.id,raster:[a,o],reference_track:l,rows:b,counts:X,ops:T,...j!=null?{applied:j}:{},input_scaling:m,sizing_target:d,...P.length?{offsets:P}:{}}}function cte(e){let t=e.counts,n=`${e.timeline} (${e.raster.join("x")}): ${t.aligned} aligned, ${t.animated} animated, ${t.no_match} no match, ${t.refused} not aligned \u2014 against ${e.reference??`V${e.reference_track}`}${e.input_scaling!=="fit"?` (Resolve units for input scaling "${e.input_scaling}")`:""}${e.sizing_target!=="edit"?`; written as Color-page ${e.sizing_target==="input"?"Input Sizing":"node Sizing"} on top of each clip's own edit transform`:""}${e.sizing_target==="edit"&&t.animated?`; the ${t.animated} moving clip(s) get Edit-page keyframes on a copy of the timeline, "${e.timeline} ALIGNED" (Resolve cannot keyframe the Edit page from a script; the copy carries every grade and setting)`:""}${e.applied!=null?`; ${e.applied} transform(s) written into the session`:""}`,i=a=>{let o=a.properties,s=a.grade_sizing,c=s?` \u2192 ${e.sizing_target} sizing Zoom ${s.zoom}${s.height!==1?` Height ${s.height}`:""} Pan ${s.pan} Tilt ${s.tilt} Rotate ${s.rotation}${s.flip_x?" FlipH":""}${s.flip_y?" FlipV":""}`:o?` \u2192 Pan ${o.Pan} Tilt ${o.Tilt} Zoom ${o.ZoomX}${o.ZoomY!==o.ZoomX?`/${o.ZoomY}`:""} Rot ${o.RotationAngle}${o.FlipX?" FlipX":""}${o.FlipY?" FlipY":""}`:"",l=a.grade_keys?.length?` \u2192 ${a.grade_keys.length} keyframes (${e.sizing_target==="node"?"node":"Input"} Sizing)`:a.edit_keys?.length?` \u2192 ${a.edit_keys.length} Edit-page keyframes`:"";return` V${a.track} ${a.record_tc} ${a.name}: ${a.verdict.toUpperCase()}${a.label?` (${a.label})`:""}${c}${l}${a.confidence!=null?`, confidence ${a.confidence}`:""}${a.reason?` \u2014 ${a.reason}`:""}`},r=(e.offsets??[]).map(a=>` the reference differs from the ${a.raster} online by ${a.label} on ${a.clips} of ${a.of} clips: a render / decode difference, not sizing \u2014 taken out of every clip, never written`);return[n,...r,...e.rows.map(i),`host_apply ops ready: ${e.ops.filter(a=>a.op==="properties"||a.op==="grade_sizing").length} ${e.sizing_target==="edit"?"properties":"grade_sizing"}, ${e.ops.filter(a=>a.op==="marker_add").length} markers (data "ConformTools:align")`].join(`
|
|
94
|
+
`);return{rows:t,text:i}}function Nee(e,t){let n=e.clips.flatMap(o=>{let s=wn(o),c=ur(e,o),l=Di(e,o);if(!s||s.kind!=="video"||!c)return[];let u=Number(o.cells["source_range.start"]??0),f=Number(l?.cells["available_range.start"]),m=Number(l?.cells["available_range.dur"]);return[{...c,media:String(l?.cells.target_url??"")||void 0,src_in:u,src_out:u+(c.end-c.start),media_range:Number.isFinite(f)&&m>0?[f,f+m]:void 0,track_enabled:o.cells.track_enabled!==!1}]}),i=CO(e.markers.filter(o=>!o.cells.item_id).map(o=>({frame:Number(o.cells.frame),color:String(o.cells.color),name:String(o.cells.name??""),note:String(o.cells.note??"")})),n,t),r=new Map(String(t.names??"").split(",").map(o=>o.split("=").map(s=>s.trim())).filter(o=>o.length===2&&o[0]&&o[1]));if(r.size){for(let o of i.shots)for(let s of[...o.plates,...o.reference?[o.reference]:[]])s.name=r.get(s.name)??s.name;for(let o of i.stringout)o.name=r.get(o.name)??o.name}let a=i.shots.flatMap(o=>[...o.plates,...o.reference?[o.reference]:[]].map((s,c)=>({id:`${o.name}-${c}`,shot:o.name,pull:s.name,cells:{shot:o.name,role:s.role,name:s.name,clip:`${s.clip.name??""}${s.scene?` \xB7 sc ${s.scene}`:""}${s.take?` tk ${s.take}`:""}`,frames:`${s.first}\u2013${s.last}`,cut:`${s.cut_in}\u2013${s.cut_out}`}})));return{...i,rows:a}}var Lee=(e,t)=>{let n=new Set(t.map(i=>i.shot));return e.shots.filter(i=>n.has(i.name)).map(i=>({op:"marker_update",frame:i.frame,name:i.name,note:i.note}))},nI=(e,t)=>{let n=new Set(t.map(i=>i.pull));return e.stringout.filter(i=>n.has(i.name)&&i.media)};function Zee(e,t,n,i,r,a="",o=""){let s=/\\/.test(r)?"\\":"/",c=new Set(t.map(f=>f.pull)),l=[...new Set(n.items.filter(f=>f.kind==="video").map(f=>f.track))],u=n.start_frame+Math.max(0,...n.items.map(f=>f.end))-1;return e.shots.flatMap(f=>[...f.plates,...f.reference?[f.reference]:[]].filter(m=>c.has(m.name)).map(m=>{let d=m.role==="REFERENCE",p=d?o:a;return{name:m.name,in:Math.max(n.start_frame,n.start_frame+m.clip.start-i),out:Math.min(u,n.start_frame+m.clip.end-1+i),target_dir:`${r.replace(/[\\/]$/,"")}${s}${f.name}`,...d?{}:{disable_tracks:l.filter(v=>v!==m.clip.track).map(v=>`V${v}`)},...p?{preset:p}:{}}}))}function Wee(e,t,n,i,r="",a=""){let o=/\\/.test(i)?"\\":"/";return nI(e,t).map(s=>({name:s.name,in:n+s.rec_in,out:n+s.rec_out-1,target_dir:`${i.replace(/[\\/]$/,"")}${o}${s.shot}`,...(s.role==="REFERENCE"?a:r)?{preset:s.role==="REFERENCE"?a:r}:{}}))}function rI(e,t){let n=e.clips.filter(c=>c.cells.kind!=="audio"&&/^V\d+$/.test(String(c.cells.track_no??""))&&c.cells.enabled!==!1&&c.cells.track_enabled!==!1).filter(c=>{let l=Number(c.cells["timeline_range.start"]);return t>=l&&t<l+Number(c.cells["timeline_range.dur"])}).sort((c,l)=>Number(String(l.cells.track_no).slice(1))-Number(String(c.cells.track_no).slice(1)))[0];if(!n)return"";let i=Di(e,n),r=Number(i?.cells.source_fps)||e.fps||24,a=n.cells.speed==null||n.cells.speed===""?1:Number(n.cells.speed)/100,s=(i?.cells.binding_state==="linked"?Oe(String(i.cells.source_timecode??""),r)??0:0)+Number(n.cells["source_range.start"]??0)+Math.floor((t-Number(n.cells["timeline_range.start"]))*a);return qe(s,r)}var f4=Object.entries(Zo).map(([e,t])=>[e,t.name]);function Vee(e,t){let n=Zo[t.naming]??Zo.conformtools,i=t.case?{...n,caseTransform:t.case}:n,r={...i,handleFrames:t.handles,...t.folder?{folderStructure:t.folder}:{},fields:i.fields.map(l=>t.fields[l.id]?{...l,value:t.fields[l.id]}:l)},a=e.start_frame+Math.max(0,...e.items.map(l=>l.end))-1,o=KO(e.markers.filter(l=>!l.cells.item_id).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??""),srcTc:rI(e,Number(l.cells.frame))})),{color:t.color,scope:t.scope,naming:r,startFrame:e.start_frame,lastFrame:a,folder:{project:e.project,timeline:e.timeline,...Object.fromEntries(r.fields.map(l=>[l.id,l.value])),...t.fields},...t.template?{template:t.template}:{}}),s=/\\/.test(t.root)?"\\":"/",c=t.root?`${t.root.replace(/[\\/]$/,"")}${o.dir?s+o.dir:""}`:"";return o.jobs.map((l,u)=>({id:String(u),job:{name:l.name,in:l.in,out:l.out,target_dir:c,...t.preset?{preset:t.preset}:{}},cells:{tc:l.marker.tc??"",marker:l.marker.name,frames:l.out-l.in+1,name:l.name,folder:c,dupe:l.dupe?"same name as another job":""}}))}function a4(e){return e.clips.flatMap(t=>{let n=wn(t);if(!n||n.kind!=="video"||t.cells.kind==="transition")return[];let i=Di(e,t),r=Number(t.cells["timeline_range.dur"]??0),a=Number(t.cells["source_range.start"]??0),o=String(i?.cells.target_url||t.cells.name||""),s=["scale","scale_x","scale_y","position_x","position_y","rotation","crop_left","crop_right","crop_top","crop_bottom"].map(u=>t.cells[u]??"").join("|"),c=(o.split(/[\\/]/).pop()??"").replace(/\.[^.]+$/,"").toLowerCase(),l=String(t.cells.reel_name??"").toLowerCase();return[{id:t.id,name:String(t.cells.name??""),track:n.track,rec_in:n.start,rec_out:n.start+r,media:o,alt:c||l||void 0,src_in:a,src_out:a+Number(t.cells["source_range.dur"]??r),speed:t.cells.speed==null||t.cells.speed===""?100:Number(t.cells.speed),sizing:s}]})}var o4={inserted:"Green",deleted:"Red",moved:"Purple",split:"Pink",joined:"Pink",slipped:"Cyan",retimed:"Yellow",reframed:"Sand"};function Ree(e,t){let n=o=>new Map(o.clips.map(s=>[s.id,String(s.cells.rec_in_tc??"")])),i=n(e),r=n(t),a=(o,s,c)=>c&&(o===e?i:r).get(c)||qe(o.start_frame+s,o.fps||24);return _O(a4(e),a4(t)).filter(o=>o.kinds[0]!=="unchanged"||o.loose).map((o,s)=>{let c=o.kinds.join(", "),l=o4[o.kinds.find(p=>o4[p])??""]??"Blue",u=`${c}${o.head?` \xB7 head ${o.head>0?"+":""}${o.head}f`:""}${o.tail?` \xB7 tail ${o.tail>0?"+":""}${o.tail}f`:""}${o.a&&o.b?` \xB7 A ${a(e,o.a.rec_in,o.a.id)}`:""}`,f=o.b?{side:"B",frame:o.b.rec_in}:{side:"A",frame:o.a.rec_in},m=o.a&&o.b?Math.floor((Math.max(o.a.src_in,o.b.src_in)+Math.min(o.a.src_out,o.b.src_out))/2):void 0,d=m!=null&&o.a.media&&o.b.media?{a:{path:o.a.media,frame:m},b:{path:o.b.media}}:void 0;return{id:String(s),...d?{pair:d}:{},mark:{...f,op:{op:"marker_add",frame:f.frame,color:l,name:`Reconform: ${o.kinds[0]}`,note:u,data:"ConformTools:reconform"}},cells:{b_tc:o.b?a(t,o.b.rec_in,o.b.id):"",a_tc:o.a?a(e,o.a.rec_in,o.a.id):"",change:c,clip:(o.b??o.a).name,paired:o.loose?"by name: check the picture":"",head:o.head??"",tail:o.tail??"",frames:o.b?o.b.rec_out-o.b.rec_in:o.a.rec_out-o.a.rec_in}}})}function Hee(e,t,n){let i=new Set((n?.markers??[]).filter(r=>!r.cells.item_id).map(r=>Number(r.cells.frame)));return e.filter(r=>r.cells.change!=="unchanged"||/differs/i.test(String(r.cells.picture??""))).map(r=>r.mark).filter(r=>r?.side===t).map(({op:r})=>{let a=r.frame;for(;i.has(a);)a++;return i.add(a),a===r.frame?r:{...r,frame:a,note:`${r.note} \xB7 ${a-r.frame}f after its cut (a marker was there)`}})}function Fee(e){let t=new Set(e.tracks.filter(o=>o.kind==="video"&&o.enabled===!1).map(o=>o.index)),n=new Map;for(let o of e.clips){let s=ur(e,o),c=Number(o.cells["timeline_range.dur"]??0),l=Number(o.cells["source_range.dur"]??c);s&&c>0&&n.set(s.id,l/c)}let i=e.items.filter(o=>o.kind==="video"&&o.enabled!==!1&&o.media_id&&o.src_in!=null&&!t.has(o.track)),r=[...new Set(i.flatMap(o=>[o.start,o.end]))].sort((o,s)=>o-s),a=[];for(let o=0;o+1<r.length;o++){let[s,c]=[r[o],r[o+1]],l=i.filter(p=>p.start<=s&&p.end>=c).sort((p,v)=>v.track-p.track)[0];if(!l)continue;let u=n.get(l.id)??1,f=l.src_in+Math.round((s-l.start)*u),m=f+Math.round((c-s)*u),d=a.at(-1);if(d&&d.id===l.id&&d.end===s&&d.src_out===f){d.end=c,d.src_out=m;continue}a.push({id:l.id,media_id:l.media_id,name:l.name,start:s,end:c,src_in:f,src_out:m})}return a.map(({id:o,...s})=>s)}var iI=e=>{let t=/(\d+)\s*[xX×]\s*(\d+)/.exec(String(e??""));return t?[Number(t[1]),Number(t[2])]:void 0};function aI(e){let t=e.clips.flatMap(i=>{let r=ur(e,i),a=Di(e,i);if(!r||r.kind!=="video"||i.cells.kind==="transition")return[];let o=String(a?.cells.target_url??""),s=Number(a?.cells["available_range.start"]),c=Number(i.cells["source_range.start"]??0),l=Number(i.cells["source_range.dur"]??r.end-r.start);return[{id:r.id,name:r.name,track:r.track,start:r.start,end:r.end,keys:new Set([...Ro(r.name),...Ro(o.split(/[\\/]/).pop()??"")]),meta_keys:new Set([...Ro(String(i.cells.reel_name??""))]),...Number.isFinite(s)?{src_tc:[s+c,s+c+l]}:{},media_fps:Number(a?.cells["available_range.rate"]??a?.cells.source_fps??e.fps??24),reel:String(i.cells.reel_name??"")||void 0,speed:i.cells.speed==null||i.cells.speed===""?100:Number(i.cells.speed),raster:iI(i.cells.Resolution)}]}),n=e.markers.filter(i=>!i.cells.item_id).flatMap(i=>{let r=new Set([...Ro(String(i.cells.name??"")),...Ro(String(i.cells.note??""))]);if(!r.size)return[];let a=Number(i.cells.frame),o=t.filter(s=>s.start<=a&&a<s.end).sort((s,c)=>s.track-c.track)[0];return[{frame:a,name:String(i.cells.name??""),keys:r,start:o?.start??a,end:o?.end??a+Math.max(1,Number(i.cells.duration??1)),plate:o}]});return{plates:t,markers:n}}var s4={marker:"shot marker",plate_name:"plate name",metadata:"plate metadata",timecode:"source timecode","":""};function Mee(e,t){let{plates:n,markers:i}=aI(e),r=a=>qe(e.start_frame+a,e.fps||24);return t4(t,n,i).map((a,o)=>({id:String(o),...a.status==="ready"&&a.plan?{piece:{path:a.comp.path,src_in:a.plan.src_in,src_out:a.plan.src_out,start:a.record_start+a.plan.record_offset,end:a.record_start+a.plan.record_offset+a.plan.covers,...a.plate?{plate:{track:a.plate.track,start:a.plate.start}}:{},copy_sizing:!!a.plate&&(!a.plate.raster||!a.comp.raster||a.plate.raster[0]===a.comp.raster[0]&&a.plate.raster[1]===a.comp.raster[1]),note:`Matched by ${s4[a.matched_by]} \xB7 confidence ${Math.round(a.confidence*100)}% \xB7 comp frame ${a.plan.src_in} on the cut${a.plan.note?` \xB7 ${a.plan.note}`:""}`}}:{},cells:{cant:a.status!=="ready",comp:a.comp.name,shot:a.shot,version:a.version??"",status:a.status,by:s4[a.matched_by],confidence:a.confidence?`${Math.round(a.confidence*100)}%`:"",plate:a.plate?.name??"",at:a.record_start!=null?r(a.record_start):"",why:a.reasons.join("; ")}}))}function Iee(e,t){let n=e.map(i=>i.piece).filter(Boolean);return n.length?[{op:"drop_in",name:t.name||"VFX",disable_plates:!!t.disable_plates,pieces:n}]:[]}var Fw=[["rec709","Rec.709 (gamma 2.4)"],["srgb","sRGB"],["p3d65","P3-D65 (gamma 2.6)"]],d4=[["flat","Flat 1.85"],["scope","Scope 2.39"],["full","Full 1.90"]],m4=[["2k","2K"],["4k","4K"]],p4=[["feature","Feature"],["trailer","Trailer"],["teaser","Teaser"],["short","Short"],["advertisement","Ad"],["test","Test"]],Dee=e=>e.map(t=>t[0]);var v4=[{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}],fr=v4.filter(e=>e.edits).map(e=>[e.id,e.label]),Uee=v4.map(e=>e.id);var $l=["marker_add","marker_update","marker_delete"],oI={resolve:"all",premiere:["clip_color","enabled","metadata","name","playhead","properties","timeline_rename",...$l],flame:["clip_color","enabled",...$l],nuke:$l,avid:$l,protools:$l,baselight:[]},Eee=(e,t)=>{let n=oI[e];return n==="all"||!!n?.includes(t)};var tc={strict:{tolerance_px:1,min_frames:1,gap_frames:0,black_threshold:16},standard:{tolerance_px:2,min_frames:2,gap_frames:1,black_threshold:10},relaxed:{tolerance_px:6,min_frames:4,gap_frames:3,black_threshold:6}},Mw="strict",h4={tolerance_px:[0,512],min_frames:[1,600],gap_frames:[0,600],black_threshold:[0,255]};function b4(e,t={}){let n=(e??Mw).trim().toLowerCase(),i=tc[n]??tc[Mw],r=tc[n]?n:n==="custom"?"custom":Mw,a={...i};for(let o of Object.keys(h4)){let s=t[o];if(s===void 0||!Number.isFinite(Number(s)))continue;let[c,l]=h4[o],u=Math.max(c,Math.min(l,Math.round(Number(s))));u!==a[o]&&(r="custom"),a[o]=u}return{...a,preset:r}}function ec(e,t){let n=Number(e),i=Number(t);return!Number.isFinite(n)||!Number.isFinite(i)?!1:n>0&&n>=i}function sI(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:Math.abs(t/n-e)/e>=.02}function lI(e,t,n,i,r){let a=Math.max(2,Number(r)||0);return Math.abs(e-t)<=a&&Math.abs(n-i)<=a}function cI(e,t,n,i,r,a){return!r||!(r.top>0||r.bottom>0||r.left>0||r.right>0)?!1:Math.abs(e-r.top)<=a&&Math.abs(t-r.bottom)<=a&&Math.abs(n-r.left)<=a&&Math.abs(i-r.right)<=a}var g4=[["bt","ct"],["bb","cb"],["bl","cl"],["br","cr"]],Cd=e=>Math.max(0,Math.trunc(Number(e)||0)),Yd=e=>Math.max(0,Math.min(1,Number(e)||0));function uI(e,t,n,i,r,a={}){let o=a.tolerance_px??4;i=Math.max(1,Math.trunc(i)),r=Math.max(1,Math.trunc(r));let s=[];for(let c of e??[]){let l=Math.trunc(Number(c.pts)||0),u=Cd(c.bt),f=Cd(c.bb),m=Cd(c.bl),d=Cd(c.br);if(!ec(Math.max(u,f,m,d),o)||cI(u,f,m,d,a.declared_blanking,o))continue;let p=Number(a.expected_aspect_ratio)||0;if(p>0){let b=Math.max(1,i-m-d),g=Math.max(1,r-u-f),y=m<=o&&d<=o,x=u<=o&&f<=o;if((y||x)&&sI(p,i,r)&&lI(u,f,m,d,o)&&Math.abs(b/g-p)/p<.02)continue}let v=n+l,h;for(let b of t??[])b.start<=v&&v<b.end&&(!h||b.track>h.track)&&(h=b);h&&s.push({frame_abs:v,bt:u,bb:f,bl:m,br:d,ct:Yd(c.ct),cb:Yd(c.cb),cl:Yd(c.cl),cr:Yd(c.cr),source:c.source??"pixels",clip:h})}return s.sort((c,l)=>c.frame_abs-l.frame_abs)}function fI(e,t){let n=[];return ec(e.bt,t)&&n.push("Top"),ec(e.bb,t)&&n.push("Bottom"),ec(e.bl,t)&&n.push("Left"),ec(e.br,t)&&n.push("Right"),n}function y4(e,t,n,i,r,a={}){let o=Math.max(1,Math.trunc(a.min_frames??1)),s=Math.max(0,Math.trunc(a.gap_frames??0)),c=a.tolerance_px??4,l=[],u;for(let f of uI(e,t,n,i,r,a)){(!u||u.clip!==f.clip||f.frame_abs-u.end_frame-1>s)&&(u={clip:f.clip,start_frame:f.frame_abs,end_frame:f.frame_abs,frame_count:0,measured:{bt:0,bb:0,bl:0,br:0},coverage:{ct:0,cb:0,cl:0,cr:0},sources:new Set},l.push(u)),u.end_frame=f.frame_abs,u.frame_count++,u.sources.add(f.source);for(let[m,d]of g4)f[m]>=u.measured[m]&&(u.measured[m]=f[m],u.coverage[d]=f[d])}return l.filter(f=>f.frame_count>=o).map(f=>({...f,duration_frames:f.end_frame-f.start_frame+1,sources:[...f.sources].sort(),zones:fI(f.measured,c)}))}function Yee(e){let t=new Map;for(let i of e){let r=t.get(i.clip.id);r||(r={clip:i.clip,measured:{bt:0,bb:0,bl:0,br:0},coverage:{ct:0,cb:0,cl:0,cr:0},frames:0,first_frame_abs:i.start_frame,zones:[],sources:[],ranges:[]},t.set(i.clip.id,r)),r.frames+=i.frame_count,r.first_frame_abs=Math.min(r.first_frame_abs,i.start_frame);for(let[a,o]of g4)i.measured[a]>=r.measured[a]&&(r.measured[a]=i.measured[a],r.coverage[o]=i.coverage[o]);r.sources=[...new Set([...r.sources,...i.sources])].sort(),r.ranges.push(i)}let n=["Top","Bottom","Left","Right"];return[...t.values()].map(i=>{let r=new Set(i.ranges.flatMap(a=>a.zones));return{...i,zones:n.filter(a=>r.has(a)),ranges:i.ranges.sort((a,o)=>a.start_frame-o.start_frame)}}).sort((i,r)=>i.clip.start-r.clip.start)}function Gee(e,t=1){let n=Math.max(0,Math.trunc(t)),i=[];for(let r of[...e].sort((a,o)=>a.frame-o.frame)){let a=i.at(-1);if(a&&r.frame-a.end_frame<=n+1){a.end_frame=Math.max(a.end_frame,r.frame),a.frames++,a.darkest=Math.min(a.darkest,r.avg);continue}i.push({start_frame:r.frame,end_frame:r.frame,duration_frames:1,frames:1,darkest:r.avg})}for(let r of i)r.duration_frames=r.end_frame-r.start_frame+1;return i}var Ft=()=>({"video.black_frame":{enabled:!0},"video.white_frame":{enabled:!0},"video.blanking":{enabled:!0,min_bar_px:1,min_reveal_depth_px:4},"video.clipping":{enabled:!0},"video.legal_range":{enabled:!0,max_pct:1},"video.banding":{enabled:!0,max_pct:.8},"video.interlace":{enabled:!0,expect:"progressive"},"video.freeze":{enabled:!0},"video.dead_pixel":{enabled:!0,min_run_frames:20},"video.maxcll":{enabled:!0,max_cll:0,max_fall:0},"video.aspect":{enabled:!0},"video.pse":{enabled:!0,sdr_peak_nits:200,flash_delta_nits:20,dark_max_nits:160,area_frac:.25,max_flashes_per_sec:3,red_flash:!0,patterns:!0,pattern_min_pairs:5},"video.shots":{enabled:!0,cut_threshold:.35,cut_ratio:4},"video.log_look":{enabled:!0},"video.video_range":{enabled:!0},"video.effective_resolution":{enabled:!0,soft_ratio:.5},"video.blockiness":{enabled:!0,threshold:.35},"video.noise":{enabled:!0},"video.exposure_outlier":{enabled:!0,z:3},"video.cadence":{enabled:!0,min_repeats:4},"video.gamut":{enabled:!0,max_pct:1,low:-.05,high:1.05},"video.text":{enabled:!0,fail_on_text:0},"video.burn_in":{enabled:!0,min_frames:24,change_frac:.8},"video.overlay":{enabled:!0,persist_frac:.8,min_shots:3},"video.leader":{enabled:!0,window_secs:120},"video.hdr_metadata":{enabled:!0}}),rn=(e,t,n,i=20)=>({"audio.integrated_loudness":{enabled:!0,target_lufs:e,tolerance_lu:t},"audio.true_peak":{enabled:!0,max_dbtp:n},"audio.lra":{enabled:!0,max_lra:i},"audio.short_term":{enabled:!1,max_lufs:0},"audio.momentary":{enabled:!1,max_lufs:0},"audio.silence":{enabled:!0,threshold_dbfs:-60,min_secs:1},"audio.phase":{enabled:!0,min_corr:-.3},"audio.clipping":{enabled:!0},"audio.clicks":{enabled:!0,ratio:12},"audio.dc_offset":{enabled:!0},"audio.tone":{enabled:!1,expected:0,level_dbfs:-20,tolerance_db:1.5},"audio.pop":{enabled:!1,expected:0}}),Iw=()=>Object.fromEntries(Object.keys(rn(-23,2,-1)).map(e=>[e,{enabled:!1}])),qw=(e,...t)=>Object.fromEntries(Object.entries(e).map(([n,i])=>[n,{...i,enabled:t.includes(n)}])),Dw=e=>({...e,"video.maxcll":{enabled:!0,max_cll:0,max_fall:0},"video.hdr_metadata":{enabled:!0},"video.legal_range":{enabled:!1}}),Mt=(e,t,n,i,r,a,o)=>({id:e,label:t,group:n,description:i,color_space:r,checks:a,audio:o}),x4=[Mt("conform_default","Conform default","Conform","Every video check (dead / stuck / hot pixels included), PSE, a 120 s leader window, EBU R128 audio (-23 LUFS, -1 dBTP) with a house \xB12 LU tolerance. The pack when there is no delivery spec.","sdr_rec709",{...Ft(),...rn(-23,2,-1)},{lufs:-23,tolerance:2,true_peak:-1}),Mt("proxy_leak","Proxy leak (shots on offline media)","Conform","Only the per-shot checks that expose offline media in the online: shots, effective resolution, blockiness, burn-in counters, text. Fast: no PSE, no audio.","sdr_rec709",{...qw(Ft(),"video.shots","video.effective_resolution","video.blockiness","video.burn_in","video.text"),...Iw()},null),Mt("textless_master","Textless master","Conform","Conform default, and any text-like graphics anywhere in the picture fails.","sdr_rec709",{...Ft(),...rn(-23,2,-1),"video.text":{enabled:!0,fail_on_text:1}},{lufs:-23,tolerance:2,true_peak:-1}),Mt("blanking_only","Blanking only","Conform","Black edges, partial reveals and black frames, nothing else.","sdr_rec709",{...qw(Ft(),"video.blanking","video.black_frame","video.aspect"),...Iw()},null),Mt("pse_only","PSE (Harding-style) only","Conform","The Ofcom / ITU-R BT.1702 flash, red-flash and pattern rules alone. Not a certified Harding test.","sdr_rec709",{...qw(Ft(),"video.pse","video.shots"),...Iw()},null),Mt("netflix_sdr","Netflix SDR","Streaming","Rec.709 legal range, PSE mandatory, -27 LKFS \xB12 (programme-gated here, dialogue-gated in the spec), -2 dBTP.","sdr_rec709",{...Ft(),...rn(-27,2,-2)},{lufs:-27,tolerance:2,true_peak:-2}),Mt("netflix_hdr","Netflix HDR (PQ)","Streaming","PQ light levels measured and reported, declared-vs-measured HDR metadata, PSE, -27 LKFS \xB12 / -2 dBTP.","hdr_pq",{...Dw(Ft()),...rn(-27,2,-2)},{lufs:-27,tolerance:2,true_peak:-2}),Mt("apple_tv_sdr","Apple TV+ SDR","Streaming","Rec.709 legal range, PSE, -24 LKFS \xB12, -2 dBTP.","sdr_rec709",{...Ft(),...rn(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Mt("apple_tv_hdr","Apple TV+ HDR (PQ)","Streaming","PQ light levels reported, HDR metadata checked, PSE, -24 LKFS \xB12 / -2 dBTP.","hdr_pq",{...Dw(Ft()),...rn(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Mt("amazon_sdr","Amazon / Prime Video SDR","Streaming","Rec.709 legal range, PSE, -24 LKFS \xB12, -2 dBTP.","sdr_rec709",{...Ft(),...rn(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Mt("amazon_hdr","Amazon / Prime Video HDR (PQ)","Streaming","PQ light levels reported, HDR metadata checked, PSE, -24 LKFS \xB12 / -2 dBTP.","hdr_pq",{...Dw(Ft()),...rn(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Mt("ebu_r128","EBU R128","Broadcast","Programme loudness -23 LUFS \xB11, true peak -1 dBTP, LRA \u2264 20 LU; EBU R103 RGB gamut on.","sdr_rec709",{...Ft(),...rn(-23,1,-1,20)},{lufs:-23,tolerance:1,true_peak:-1}),Mt("bbc_dpp","BBC / DPP (AS-11 UK)","Broadcast","EBU R128 loudness (-23 LUFS \xB11), true peak -3 dBTP, R103 gamut, PSE mandatory.","sdr_rec709",{...Ft(),...rn(-23,1,-3,20)},{lufs:-23,tolerance:1,true_peak:-3}),Mt("atsc_a85","ATSC A/85 (US broadcast)","Broadcast","Dialnorm target -24 LKFS \xB12, true peak -2 dBTP; SMPTE legal range and PSE on.","sdr_rec709",{...Ft(),...rn(-24,2,-2,20)},{lufs:-24,tolerance:2,true_peak:-2})],w4=x4.map(e=>[e.id,e.label]),Bee=e=>x4.find(t=>t.id===e);function Fo(e,t,n,i,r){let a=1-r;return a*a*a*e+3*a*a*r*t+3*a*r*r*n+r*r*r*i}function dI(e,t,n){let i=0,r=1;for(let o=0;o<48;o++){let s=(i+r)/2;Fo(t[0],t[1],t[2],t[3],s)<e?i=s:r=s}let a=(i+r)/2;return Fo(n[0],n[1],n[2],n[3],a)}var Jw=e=>!!(e.sOutX||e.sOutY||e.sInX||e.sInY);function P4(e){return e.some(t=>Jw(t)||t.interp==="bezier")}var z4=new WeakMap;function mI(e,t){let n=z4.get(e);if(n&&n.to===t)return n;let i=e.x,r=e.y,a=t.x,o=t.y,s,c,l,u;Jw(e)||Jw(t)?(s=i+(e.sOutX??0),c=r+(e.sOutY??0),l=a+(t.sInX??0),u=o+(t.sInY??0)):(s=i+(a-i)/3,c=r+(o-r)/3,l=a-(a-i)/3,u=o-(o-r)/3);let f=[0],m=i,d=r;for(let v=1;v<=256;v++){let h=v/256,b=Fo(i,s,l,a,h),g=Fo(r,c,u,o,h);f.push(f[f.length-1]+Math.hypot(b-m,g-d)),m=b,d=g}let p={to:t,arc:f,ctrl:[i,s,l,a,r,c,u,o]};return z4.set(e,p),p}function k4(e,t,n){if(!e.length)return[0,0];let i=e[0],r=e[e.length-1];if(t<=i.time)return[i.x,i.y];if(t>=r.time)return[r.x,r.y];for(let a=0;a<e.length-1;a++){let o=e[a],s=e[a+1];if(!(t>=o.time&&t<s.time))continue;if(o.interp==="hold")return[o.x,o.y];let c=s.time-o.time;if(c<=0)return[s.x,s.y];let l=c/(n||24),{arc:u,ctrl:f}=mI(o,s),m=u[u.length-1];if(!(m>1e-12))return[o.x,o.y];let d=l>0?m/l:0,p=o.interp==="bezier"&&o.outSpeed!=null?o.outSpeed:d,v=o.interp==="bezier"&&o.outInfluence!=null?o.outInfluence:1/3,h=s.interp==="bezier"&&s.inSpeed!=null?s.inSpeed:d,b=s.interp==="bezier"&&s.inInfluence!=null?s.inInfluence:1/3,g=1/6,y=(C,R)=>Math.abs(C-R)<1e-9,x=p===0&&y(v,1/3),z=h===0&&y(b,1/3);y(v,g)&&(p=d,v=z?.5:1/3),y(b,g)&&(h=d,b=x?.5:1/3);let S=(t-o.time)/(n||24),P=Math.min(Math.max(dI(S,[0,v*l,l-b*l,l],[0,p*v*l,m-h*b*l,m]),0),m),T=1,j=256;for(;T<j;){let C=T+j>>1;u[C]<P?T=C+1:j=C}let X=u[T-1],w=u[T],N=w>X?(P-X)/(w-X):0,F=(T-1+N)/256;return[Fo(f[0],f[1],f[2],f[3],F),Fo(f[4],f[5],f[6],f[7],F)]}return[r.x,r.y]}function O4(e,t){if((t==="flip_horizontal"?e.flip_horizontal:e.flip_vertical)===!0)return!0;let i=e.effects;return Array.isArray(i)?i.some(r=>{let a=r;return a?.kind===t&&a.enabled!==!1}):!1}function an(e,t){return typeof e=="number"&&Number.isFinite(e)?e:Array.isArray(e)&&typeof e[t]=="number"?e[t]:null}function pI(e,t,n,i,r){let a;Array.isArray(e.value)&&Array.isArray(t.value)?a=Math.hypot((an(t.value,0)??0)-(an(e.value,0)??0),(an(t.value,1)??0)-(an(e.value,1)??0)):a=(an(t.value,0)??0)-(an(e.value,0)??0);let o=i/n;if(a===0||!(r>0))return o;let s=h=>{let b=typeof h?.x=="number"?h.x:null,g=typeof h?.y=="number"?h.y:null;if(b===null||g===null)return null;let y=Math.min(Math.max(g,0),1)*n;return{dx:y,dy:b/r/a*y}},c=s(e.tout)??{dx:n/3,dy:n/3/n},l=s(t.tin)??{dx:n/3,dy:n/3/n},u=Math.min(Math.max(c.dx,0),n),f=c.dy,m=n-Math.min(Math.max(l.dx,0),n),d=1-l.dy,p=(h,b,g,y)=>{let x=1-y;return 3*h*y*x*x+3*b*y*y*x+g*y*y*y},v=o;for(let h=0;h<8;h++){let b=p(u,m,n,v)-i,g=1-v,y=3*(u*(g*g-2*v*g)+m*(2*v*g-v*v)+n*v*v);if(Math.abs(y)<1e-9)break;let x=v-b/y;if(!(x>=0&&x<=1))break;if(Math.abs(x-v)<1e-7){v=x;break}v=x}if(Math.abs(p(u,m,n,v)-i)>n*1e-4){let h=0,b=1;for(let g=0;g<40;g++)v=(h+b)/2,p(u,m,n,v)<i?h=v:b=v}return p(f,d,1,v)}function vI(e,t,n,i=0,r=0){let o=(e.keyframes??[]).filter(l=>l.parameter_path===t&&typeof l.time?.value=="number").map(l=>({time:l.time.value,value:l.value,interp:l.interp??"linear",tin:l.tangent_in,tout:l.tangent_out,drt:!!l.raw_extraction?.drt_tangent})).sort((l,u)=>l.time-u.time);if(!o.length)return;let s=an(o[0].value,i)??0,c=an(o[o.length-1].value,i)??0;if(n<=o[0].time)return s;if(n>=o[o.length-1].time)return c;for(let l=0;l<o.length-1;l++){let u=o[l],f=o[l+1];if(n>=u.time&&n<=f.time){let m=an(u.value,i)??0,d=an(f.value,i)??0;if(u.interp==="hold")return m;let p=f.time-u.time||1,v=(u.tout||f.tin)&&!u.drt&&!f.drt?pI(u,f,p,n-u.time,r):(n-u.time)/p;return m+(d-m)*v}}return c}function hI(e){let t=e.keyframes??[];for(let n of t){if(n.parameter_path==="speed")continue;let i=n.time?.rate;if(typeof i=="number"&&i>0)return i}}function S4(e){let t=e.speed;return typeof t=="number"&&Number.isFinite(t)?Math.abs(t)/100:1}function bI(e){let t=e,n=t.raw_extraction??void 0,i=c=>{let l=n?.[c];return typeof l=="number"&&Number.isFinite(l)?l:void 0};if(!(t.is_reinterpreted===!0||n?.isReinterpreted===!0))return 1;let a=t.original_fps??i("originalFps"),o=t.interpreted_fps??i("reinterpretedFps");if(a!=null&&o!=null&&a>0&&o>0)return o/a;let s=i("reinterpretationSpeedAdjustment");return s!=null&&s>0?s/100:1}function T4(e,t){let i=(e.keyframes??[]).filter(o=>o.parameter_path==="speed"&&typeof o.time?.value=="number"&&typeof o.value=="number").map(o=>({x:o.time.value,y:o.value,tan:Array.isArray(o.raw_extraction?.drtNativeTangent)?o.raw_extraction.drtNativeTangent:null})).sort((o,s)=>o.x-s.x);if(i.length<2)return null;let r=(o,s)=>{let c=i[o].tan;if(c&&c.length>=4){if(s==="in"&&c[0])return c[1]/c[0];if(s==="out"&&c[2])return c[3]/c[2]}let l=s==="out"?Math.min(o+1,i.length-1):Math.max(o-1,0),u=Math.min(o,l),f=Math.max(o,l),m=i[f].x-i[u].x;return m>0?(i[f].y-i[u].y)/m:0},a=i.length-1;if(t<=i[0].x)return i[0].y+(t-i[0].x)*r(0,"out");if(t>=i[a].x)return i[a].y+(t-i[a].x)*r(a,"in");for(let o=0;o<a;o++){let s=i[o],c=i[o+1];if(t>c.x)continue;let l=c.x-s.x;if(l<=0)return c.y;let u=(t-s.x)/l,f=u*u,m=f*u,d=r(o,"out"),p=r(o+1,"in");return(2*m-3*f+1)*s.y+(m-2*f+u)*l*d+(-2*m+3*f)*c.y+(m-f)*l*p}return i[a].y}function gI(e,t,n){let i=e.timeline_range?.start?.value??0,r=e.timeline_range?.start?.rate||n,a=(t-i)/r,o=e.source_range?.start,s=o&&typeof o.value=="number"&&o.rate?o.value/o.rate:0,c=T4(e,a);if(c!=null)return(s+c)*n;let l=S4(e);if(e.speed_reverse){let u=e.source_range?.duration,f=u&&typeof u.value=="number"&&u.rate?Math.max(0,u.value-1)/u.rate:0;return(s+f-a*l)*n}return(s+a*l)*n}function yI(e,t){let n=e.timeline_range?.start,i=n?.value??0,r=n?.rate||24,a=e.source_range?.start,o=a?.value??0,s=a?.rate||r,c=T4(e,(t-i)/r);if(c!=null)return o+c*s;let l=S4(e)*bI(e),u=(t-i)*(s/r)*l;if(e.speed_reverse){let f=e.source_range?.duration?.value??0;return o+Math.max(0,f-1)-u}return o+u}function xI(e){let t=e.keyframes??[],n=[];for(let i of t){if(i.parameter_path!=="position"||typeof i.time?.value!="number")continue;let r=i.value,a=an(r,0),o=an(r,1);if(a==null||o==null)return null;let s=i.raw_extraction?.tangentPs??void 0,c=(l,u)=>{let f=l?.[u];return typeof f=="number"&&Number.isFinite(f)?f:void 0};n.push({time:i.time.value,x:a,y:o,interp:i.interp??"linear",outSpeed:i.tangent_out?.x??void 0,outInfluence:i.tangent_out?.y??void 0,inSpeed:i.tangent_in?.x??void 0,inInfluence:i.tangent_in?.y??void 0,sOutX:c(s,"spatialOutX"),sOutY:c(s,"spatialOutY"),sInX:c(s,"spatialInX"),sInY:c(s,"spatialInY")})}return n.length<2?null:(n.sort((i,r)=>i.time-r.time),P4(n)?n:null)}function X4(e,t){let n=hI(e)??e.timeline_range?.start?.rate??24,i=gI(e,t,n),r=!1,a=(l,u=0)=>{let f=vI(e,l,i,u,n);return f!==void 0&&(r=!0),f},o=l=>typeof l=="number"?l:null,s=xI(e);s&&(r=!0);let c=s?k4(s,i,n):null;return{scale:a("scale")??o(e.scale),scaleX:a("scale.x")??o(e.scale_x),scaleY:a("scale.y")??o(e.scale_y),posX:c?c[0]:a("position",0)??a("position.x")??o(e.position_x)??0,posY:c?c[1]:a("position",1)??a("position.y")??o(e.position_y)??0,rotation:a("rotation")??o(e.rotation)??0,anchorX:a("anchor",0)??a("anchor.x")??o(e.anchor_x)??0,anchorY:a("anchor",1)??a("anchor.y")??o(e.anchor_y)??0,opacity:a("opacity")??o(e.opacity),cropL:a("crop.left")??o(e.crop_left)??0,cropR:a("crop.right")??o(e.crop_right)??0,cropT:a("crop.top")??o(e.crop_top)??0,cropB:a("crop.bottom")??o(e.crop_bottom)??0,flipH:O4(e,"flip_horizontal"),flipV:O4(e,"flip_vertical"),animated:r}}function j4(e,t){return Math.floor(yI(e,t)+1e-9)}function Yw(e,t){let n=t?e.timelines.find(i=>i.id===t||i.name===t):e.timelines.find(i=>i.kind==="primary")??e.timelines[0];if(!n)throw new Error(t?`no timeline ${t} in this session`:"this session has no timeline");if(!n.resolution_w||!n.resolution_h)throw new Error(`${n.name}: the timeline has no raster (resolution) in the session`);return n}var wI=e=>e.fps_den?e.fps_num/e.fps_den:e.fps_num,Mo=(e,t)=>qe((e.start_frame??0)+t,wI(e),!!e.is_drop_frame),zI=e=>e.split(/[\\/]/).pop()??e,rc=e=>e.tracks.filter(t=>t.kind==="Video").sort((t,n)=>t.track_index-n.track_index),zn=e=>{let t=e.timeline_range.start.value;return[t,t+e.timeline_range.duration.value]},Gd=e=>e.items.filter(t=>t.kind==="clip");function Io(e,t){let n=e.media_references.find(s=>s.id===t.media_reference_id),i=n?.local_path??n?.target_url?.replace(/^file:\/\//,"")??null,r=n?.source_resolution_w??0,a=n?.source_resolution_h??0,o=n?.source_pixel_aspect||1;return{path:i,w:r*o,h:a}}var Ji=(e,t)=>X4(e,t),Uw=(e,t)=>j4(e,t),N4=(e,t,n)=>({box:[t,n],scale:[(e.scaleX??e.scale??100)/100,(e.scaleY??e.scale??100)/100],pos:[e.posX*t,e.posY*n],rot:e.rotation,anchor:[e.anchorX,e.anchorY],crop:[e.cropL/100,e.cropR/100,e.cropT/100,e.cropB/100],flip:[e.flipH,e.flipV]});function L4(e,t,n,i){if(!(n>0&&i>0))return[e,t];let r=Math.min(e/n,t/i);return[n*r,i*r]}function M4(e,t,n){let i=t-e,r=Math.max(1,Math.min(n,i));return[...new Set(Array.from({length:r},(a,o)=>e+Math.min(i-1,Math.floor((o+.5)*i/r))))]}var Gw=["fit","fill","crop","stretch"];function I4(e,t,n){if(n)return n;let i=e.reframe_fit??t.mismatch_policy??"fit";return i==="none"?"crop":Gw.includes(i)?i:"fit"}function q4(e,t,n,i,r){if(!(e>0&&t>0)||r==="fit")return[1,1];let a=n/e,o=i/t,s=[a,a],c=[o,o],l=a<=o?s:c,u=r==="crop"?[1,1]:r==="fill"?a>o?s:c:[a,o];return[u[0]/l[0],u[1]/l[1]]}var Er=(e,t)=>Math.round(e*10**t)/10**t||0;function Ew(e,t,n,i=[1,1]){return{Pan:Er(e.position_x*t/i[0],3),Tilt:Er(-e.position_y*n/i[1],3),ZoomX:Er(e.scale_x/100/i[0],5),ZoomY:Er(e.scale_y/100/i[1],5),RotationAngle:Er(-e.rotation,3),FlipX:e.flip_h,FlipY:e.flip_v}}function Z4(e,t,n,i){let r=(t.scaleX??t.scale??100)/100,a=t.rotation*Math.PI/180,o=Math.cos(a),s=Math.sin(a),c=e.position_x*n,l=e.position_y*i;return{...e,scale_x:e.scale_x*r,scale_y:e.scale_y*r,rotation:e.rotation+t.rotation,position_x:(t.posX*n+r*(o*c-s*l))/n,position_y:(t.posY*i+r*(s*c+o*l))/i}}var D4=e=>({scale_x:e.scaleX??e.scale??100,scale_y:e.scaleY??e.scale??100,position_x:e.posX,position_y:e.posY,rotation:e.rotation,flip_h:e.flipH,flip_v:e.flipV}),W4=e=>(e.scale??100)===100&&(e.scaleX??100)===100&&(e.scaleY??100)===100&&!e.posX&&!e.posY&&!e.rotation&&!e.cropL&&!e.cropR&&!e.cropT&&!e.cropB&&!e.flipH&&!e.flipV,ste=["edit","input","node"];function V4(e){let t=e.node,n=typeof t=="object"&&t?t:{layer:e.layer??1,node:t};return{...n.node!==void 0&&n.node!==""?{node:n.node}:{},...n.layer&&n.layer!==1?{layer:n.layer}:{}}}var PI={aligned:"Green",animated:"Yellow",no_match:"Red",refused:"Red"};async function kI(e,t){let n=t.offline_reference,i=_e(t),r=i,a=Math.max(...t.tracks.flatMap(v=>v.items.map(h=>h.timeline_range.start.value+h.timeline_range.duration.value)),0),o=v=>({kind:"Video",track_index:Math.max(0,...rc(t).map(h=>h.track_index))+1,name:"OFFLINE REFERENCE",enabled:!0,items:v});if(n?.session_id){let{getSession:v}=await import("./store-JNWELX35.js"),h=(await v(n.session_id)).session,b=h.timelines.find(P=>P.kind==="primary")??h.timelines[0],g=(t.start_frame??0)+(n.frame_offset??0)-(b.start_frame??0),y=rc(b).filter(P=>P.enabled!==!1).flatMap(P=>P.items.filter(T=>T.kind==="clip"&&T.enabled!==!1&&T.media_reference_id).map(T=>({i:T,top:P.track_index}))),x=[...new Set(y.flatMap(({i:P})=>[P.timeline_range.start.value,P.timeline_range.start.value+P.timeline_range.duration.value]))].sort((P,T)=>P-T),z=[];for(let P=0;P+1<x.length;P++){let[T,j]=[x[P],x[P+1]],X=y.filter(({i:H})=>H.timeline_range.start.value<=T&&T<H.timeline_range.start.value+H.timeline_range.duration.value).sort((H,M)=>M.top-H.top)[0],[w,N]=[Math.max(0,T-g),Math.min(a,j-g)];if(!X||N<=w)continue;let F=X.i,C=z.at(-1);if(C&&C.from===F.id&&C.timeline_range.start.value+C.timeline_range.duration.value===w){C.timeline_range.duration.value+=N-w,C.source_range.duration.value+=N-w;continue}let{id:R,timeline_range:E,source_range:Y,media_reference_id:K,keyframes:I,...te}=F;z.push({...te,id:`offline-ref-${z.length}`,from:F.id,kind:"clip",enabled:!0,media_reference_id:`offref:${K}`,timeline_range:{start:{value:w,rate:r},duration:{value:N-w,rate:r}},source_range:{start:{value:Y.start.value+(w+g-F.timeline_range.start.value),rate:Y.start.rate},duration:{value:N-w,rate:Y.start.rate}}})}if(!z.length)throw new He("not_found",`the offline reference timeline "${b.name}" has no picture over this timeline`);let S=new Set(z.map(P=>String(P.media_reference_id).slice(7)));return{lane:o(z),media:h.media_references.filter(P=>S.has(P.id)).map(P=>({...P,id:`offref:${P.id}`})),name:`timeline ${b.name}`}}let s=n?.media_reference_id?e.media_references.find(v=>v.id===n.media_reference_id):void 0,c=s?.local_path??s?.target_url?.replace(/^file:\/\//,"");if(!s||!c)throw new He("not_found","this timeline has no offline reference linked in Resolve (Timeline \u203A Link Offline Reference Clip): a movie or another timeline");let{probeMedia:l}=await import("./media-MSMXMA6E.js"),u=await l(c),f=u.source_timecode?Co(u.source_timecode,i,null):0,m=u.available_range?.duration?.value??u.declared_duration?.value??null,d=(t.start_frame??0)+(n.frame_offset??0)-f;m!=null&&(d>=m||d+a<=0)&&(d=n.frame_offset??0);let p=m!=null?Math.max(1,Math.min(a,m-d)):a;return{lane:o([{id:"offline-reference",kind:"clip",name:s.name??"offline reference",enabled:!0,media_reference_id:s.id,timeline_range:{start:{value:0,rate:r},duration:{value:p,rate:r}},source_range:{start:{value:d,rate:r},duration:{value:p,rate:r}}}]),media:[],name:s.name??zI(c)}}async function lte(e,t,n,i){if(t.reference_track!=="offline")return await R4(e,t,n,i);let r=Yw(e,t.timeline_id),{lane:a,media:o,name:s}=await kI(e,r);r.tracks.push(a),e.media_references.push(...o);try{return{...await R4(e,{...t,reference_track:rc(r).length,reference_label:"the offline reference"},n,i),reference:`the offline reference (${s})`}}finally{r.tracks.splice(r.tracks.indexOf(a),1),e.media_references=e.media_references.filter(c=>!o.includes(c))}}async function R4(e,t,n,i){let r=Yw(e,t.timeline_id),a=r.resolution_w,o=r.resolution_h,s=rc(r),c=s.findIndex(w=>/\b(ref|reference|offline)\b/i.test(String(w.name??""))),l=t.reference_track||(c>=0?c+1:s.length),u=s[l-1];if(!u)throw new Error(`no video track V${l} (the timeline has ${s.length})`);if(t.tracks?.includes(l))throw new He("invalid_args",`the track to align cannot be the reference track (V${l})`);let f=(t.tracks?.length?t.tracks:s.map((w,N)=>N+1).filter(w=>s[w-1].enabled!==!1)).filter(w=>w!==l);for(let w of f)if(!s[w-1])throw new Error(`no video track V${w} (the timeline has ${s.length})`);let m=t.input_scaling??"fit",d=t.sizing_target??"edit",p=600,v=(w,N)=>{let F=Math.max(1,N-w);if(t.samples==="ends")return[...new Set([0,.25,.5,.75,1].map(E=>w+Math.round(E*(Math.max(w,N-1)-w))))];let C=(t.samples??"half")==="half"&&!t.step?Math.max(1,Math.round(_e(r)/2)):t.step,R=t.samples==="all"?Math.max(1,Math.ceil(F/p)):C?Math.max(1,Math.floor(C),Math.ceil(F/p)):0;if(R){let E=[];for(let Y=w;Y<N;Y+=R)E.push(Y);return E.at(-1)!==N-1&&E.push(N-1),E}return M4(w,N,Math.max(1,Math.min(p,Math.floor(Number(t.samples))||1)))},h=Number(r.start_frame??0),b=[],g=[],y=Gd(u),x=t.scope??"all",z=new Set(t.picks??[]);if(x==="selected"&&!z.size)throw new Error("no clips selected: select clips in the timeline, or align the whole timeline");for(let w of f)for(let N of Gd(s[w-1])){let[F,C]=zn(N);if(x==="playhead"&&!(F<=(t.at??-1)&&(t.at??-1)<C)||x==="selected"&&!z.has(`${w}:${F}`))continue;let R={item_id:N.id,name:N.name??N.id,track:w,start:F,end:C,record_tc:Mo(r,F),verdict:"refused",confidence:null,samples:[]};b.push(R);let E=re=>{R.reason=re};if(N.enabled===!1){E("disabled");continue}let Y,K=0,I=0;for(let re of y){let[he,Re]=zn(re),ve=Math.max(F,he),Fe=Math.min(C,Re);Fe-ve>I-K&&(Y=re,K=ve,I=Fe)}if(!Y){if(t.reference_label){E(`${t.reference_label} does not cover it (${Mo(r,F)}\u2013${Mo(r,C)}): it ends before this clip`);continue}let re=u.items.find(he=>{let[Re,ve]=zn(he);return he.kind!=="clip"&&he.kind!=="gap"&&Math.min(C,ve)>Math.max(F,Re)});E(re?`V${l} has ${/compound|stack|timeline/i.test(String(re.kind))?"a compound clip or nested timeline":`a ${re.kind}`} over it, not a movie clip: Align reads a media file there (decompose it, or use Offline ref)`:y.length?`nothing on V${l} over it (${Mo(r,F)}\u2013${Mo(r,C)}): the reference does not cover this clip`:`V${l} has no movie clips: pick the track the reference is on, or Offline ref`);continue}let te=Io(e,Y),H=Io(e,N);if(!te.path){E(`the reference clip ${Y.name??Y.id} is not linked (timeline_relink first)`);continue}if(!H.path){E("not linked (timeline_relink first)");continue}let M=v(K,I),W=Ji(Y,K),D=W4(W)?void 0:W;if(D){let re=D.scaleX??D.scale??100,he=D.scaleY??D.scale??100,Re=D.animated||M.some(ve=>JSON.stringify(Ji(Y,ve))!==JSON.stringify(W))?"keyframed":Math.abs(re-he)>1e-6?"scaled unevenly":D.cropL||D.cropR||D.cropT||D.cropB?"cropped":D.flipH||D.flipV?"flipped":D.anchorX||D.anchorY?"anchored off centre":d!=="edit"?"resized (Colour-page sizing is solved against an unresized reference only)":"";if(Re){E(`the reference clip ${Y.name??Y.id} is ${Re}; the fit is against its raw picture`);continue}}if(te.w>0&&te.h>0&&Math.abs(te.w/te.h-a/o)>.01*(a/o)){E(`the reference ${te.w}x${te.h} does not fill the ${a}x${o} frame`);continue}let ae=re=>re.map(he=>({ref:te.path,refFrame:Uw(Y,he),src:H.path,srcFrame:Uw(N,he)})),oe=Array.from({length:I-K},(re,he)=>K+he),ie=Ji(N,F);g.push({row:R,item:N,recs:M,every:oe,refT:D,ask:{pairs:ae(M),every:ae(oe),every_t:oe.map(re=>re-F),edit:D4(ie),edit_identity:W4(ie),edit_animated:!!ie.animated,anchor_off:!!(ie.anchorX||ie.anchorY),...t.inputs?.get(`${w}:${F+h}`)?.length?{input:t.inputs.get(`${w}:${F+h}`)}:{}}})}let S=g.length?await Yr({op:"reframe",items:g.map(w=>w.ask),out:[a,o],target:d},n,i):{items:[],offsets:[]},P=S.offsets;S.items.forEach((w,N)=>{let{row:F,item:C,recs:R,every:E,ask:Y,refT:K}=g[N];if(K&&(w.verdict==="animated"&&Object.assign(w,{verdict:"refused",reason:"a move under a resized reference is not solved yet",keys:void 0,edit_keys:void 0,grade_keys:void 0}),w.transform&&(w.transform=Z4(w.transform,K,a,o)),w.edit_transform&&(w.edit_transform=Z4(w.edit_transform,K,a,o)),w.transform)){let M=Y.edit,W=w.transform,D=.5/a;w.unchanged=Math.abs(W.scale_x-M.scale_x)<.05&&Math.abs(W.scale_y-M.scale_y)<.05&&Math.abs(W.position_x-M.position_x)<D&&Math.abs(W.position_y-M.position_y)<.5/o&&Math.abs(W.rotation-M.rotation)<.02}let I=w.measured==="every"?E:R,te=w.measured==="every"?Y.every:Y.pairs,H=(({w:M,h:W})=>q4(M,W,a,o,I4(C,r,t.input_scaling)))(Io(e,C));F.samples=w.scores.map((M,W)=>({record:I[w.at[W]],ref_frame:te[w.at[W]].refFrame,src_frame:te[w.at[W]].srcFrame,score:M})),Object.assign(F,{verdict:w.verdict,confidence:w.confidence,...w.reason?{reason:w.reason}:{},...w.label?{label:w.label}:{},...w.unchanged?{unchanged:!0}:{},...w.grade_sizing?{grade_sizing:w.grade_sizing}:{}}),w.transform&&(F.transform=w.transform,F.properties=Ew(w.edit_transform??w.transform,a,o,H)),w.keys?.length&&(F.keys=w.keys.map(M=>({record:I[w.at[M.j]],transform:M.transform,properties:Ew(M.transform,a,o,H),confidence:M.confidence}))),w.grade_keys?.length&&(F.grade_keys=w.grade_keys.map(({shape:M,...W})=>M?.kind==="resolve_dissolve"?{...W,ease_in:M.start,ease_out:M.end}:W),F.grade_keys[0].t>0&&F.grade_keys.unshift({...F.grade_keys[0],t:0,ease_in:void 0,ease_out:void 0})),w.edit_keys?.length&&(F.edit_keys=w.edit_keys[0].t>0?[{...w.edit_keys[0],t:0,shape:void 0},...w.edit_keys]:w.edit_keys)});let T=[];for(let w of b){let N={track:w.track,start:w.start};if(w.verdict==="aligned"&&d==="edit"&&!w.unchanged){let F=w.properties;T.push({op:"properties",item:N,set:{...F.ZoomX!==F.ZoomY?{ZoomGang:!1}:{},...F}})}if(w.verdict==="animated"&&w.edit_keys&&T.push({op:"edit_keys",item:N,keys:w.edit_keys}),w.verdict==="animated"&&w.grade_keys&&T.push({op:"grade_sizing",item:N,target:d==="node"?"node":"input",keys:w.grade_keys,...d==="node"?V4(t):{}}),w.verdict==="aligned"&&w.grade_sizing&&!w.unchanged&&T.push({op:"grade_sizing",item:N,target:d,...w.grade_sizing,...d==="node"?V4(t):{}}),t.markers??!0){let F={aligned:"Aligned",animated:"Animated",no_match:"No match",refused:"Not aligned"}[w.verdict],C=[w.label,w.confidence!=null?`confidence ${w.confidence}`:"",w.reason].filter(Boolean).join(" \xB7 ");T.push({op:"marker_add",frame:w.start,color:PI[w.verdict],name:`${F}: ${w.name}`,note:C,data:"ConformTools:align"})}}let j;if(t.apply_session){j=0;for(let w of b.filter(N=>N.verdict==="aligned")){let N=w.transform;Cw(e,"transform",{timeline_id:r.id,item_id:w.item_id,scale:N.scale_x,position_x:N.position_x,position_y:N.position_y,rotation:N.rotation});let F=r.tracks.flatMap(C=>C.items).find(C=>C.id===w.item_id);Math.abs(N.scale_x-N.scale_y)>.001&&(F.scale_x=N.scale_x,F.scale_y=N.scale_y),N.flip_h?F.flip_horizontal=!0:delete F.flip_horizontal,N.flip_v?F.flip_vertical=!0:delete F.flip_vertical,j++}}let X={aligned:0,animated:0,no_match:0,refused:0};for(let w of b)X[w.verdict]++;return{timeline:r.name??r.id,raster:[a,o],reference_track:l,rows:b,counts:X,ops:T,...j!=null?{applied:j}:{},input_scaling:m,sizing_target:d,...P.length?{offsets:P}:{}}}function cte(e){let t=e.counts,n=`${e.timeline} (${e.raster.join("x")}): ${t.aligned} aligned, ${t.animated} animated, ${t.no_match} no match, ${t.refused} not aligned \u2014 against ${e.reference??`V${e.reference_track}`}${e.input_scaling!=="fit"?` (Resolve units for input scaling "${e.input_scaling}")`:""}${e.sizing_target!=="edit"?`; written as Color-page ${e.sizing_target==="input"?"Input Sizing":"node Sizing"} on top of each clip's own edit transform`:""}${e.sizing_target==="edit"&&t.animated?`; the ${t.animated} moving clip(s) get Edit-page keyframes on a copy of the timeline, "${e.timeline} ALIGNED" (Resolve cannot keyframe the Edit page from a script; the copy carries every grade and setting)`:""}${e.applied!=null?`; ${e.applied} transform(s) written into the session`:""}`,i=a=>{let o=a.properties,s=a.grade_sizing,c=s?` \u2192 ${e.sizing_target} sizing Zoom ${s.zoom}${s.height!==1?` Height ${s.height}`:""} Pan ${s.pan} Tilt ${s.tilt} Rotate ${s.rotation}${s.flip_x?" FlipH":""}${s.flip_y?" FlipV":""}`:o?` \u2192 Pan ${o.Pan} Tilt ${o.Tilt} Zoom ${o.ZoomX}${o.ZoomY!==o.ZoomX?`/${o.ZoomY}`:""} Rot ${o.RotationAngle}${o.FlipX?" FlipX":""}${o.FlipY?" FlipY":""}`:"",l=a.grade_keys?.length?` \u2192 ${a.grade_keys.length} keyframes (${e.sizing_target==="node"?"node":"Input"} Sizing)`:a.edit_keys?.length?` \u2192 ${a.edit_keys.length} Edit-page keyframes`:"";return` V${a.track} ${a.record_tc} ${a.name}: ${a.verdict.toUpperCase()}${a.label?` (${a.label})`:""}${c}${l}${a.confidence!=null?`, confidence ${a.confidence}`:""}${a.reason?` \u2014 ${a.reason}`:""}`},r=(e.offsets??[]).map(a=>` the reference differs from the ${a.raster} online by ${a.label} on ${a.clips} of ${a.of} clips: a render / decode difference, not sizing \u2014 taken out of every clip, never written`);return[n,...r,...e.rows.map(i),`host_apply ops ready: ${e.ops.filter(a=>a.op==="properties"||a.op==="grade_sizing").length} ${e.sizing_target==="edit"?"properties":"grade_sizing"}, ${e.ops.filter(a=>a.op==="marker_add").length} markers (data "ConformTools:align")`].join(`
|
|
95
95
|
`)}var nc={"16:9":16/9,"1.85":1.85,"2.00":2,"2.20":2.2,"2.35":2.35,"2.39":2.39,"2.76":2.76,"4:3":4/3,"1:1":1,"9:16":9/16,none:null};function OI(e){if(e==null)return null;if(typeof e=="number")return e>0?e:null;if(e in nc)return nc[e];let t=/^(\d+(?:\.\d+)?)(?:[:/](\d+(?:\.\d+)?))?$/.exec(e.trim());if(!t)throw new Error(`aspect '${e}': one of ${Object.keys(nc).join(", ")}, or a ratio like 1.66 or 3:2`);let n=t[2]?Number(t[1])/Number(t[2]):Number(t[1]);return n>0?n:null}function ute(e,t,n){let i=t/n,r=o=>{let s=Math.round(o);return s-s%2};if(!(e>0)||Math.abs(i-e)/e<.002)return{top:0,bottom:0,left:0,right:0};if(e>i){let o=r((n-t/e)/2);return{top:o,bottom:o,left:0,right:0}}let a=r((t-n*e)/2);return{top:0,bottom:0,left:a,right:a}}function H4(e,t,n){let i=[],r=e;for(let[a,o]of n)if(!(o<=r)&&(a>=t||(a>r&&i.push([r,Math.min(a,t)]),r=Math.max(r,o),r>=t)))break;return r<t&&i.push([r,t]),i}function F4(e,t,n){let i=[...e,[t,n]].sort((a,o)=>a[0]-o[0]),r=[];for(let a of i){let o=r.at(-1);o&&a[0]<=o[1]?o[1]=Math.max(o[1],a[1]):r.push([a[0],a[1]])}return r}async function fte(e,t,n,i){let r=Yw(e,t.timeline_id),a=r.resolution_w,o=r.resolution_h,s=OI(t.aspect),c=b4(t.strictness,{tolerance_px:t.tolerance_px,min_frames:t.min_frames,gap_frames:t.gap_frames,black_threshold:t.black_threshold}),l=!!t.pixels,u=Math.max(1,Math.min(12,Math.floor(t.samples??3))),f=rc(r),m=f.filter(R=>R.enabled!==!1),d=[],p=[],v=R=>{let E=Io(e,R);if(!(E.w>0&&E.h>0))return!1;let[Y,K]=L4(a,o,E.w,E.h),I=Ji(R,zn(R)[0]);return!I.animated&&Math.abs(Y-a)<.5&&Math.abs(K-o)<.5&&(I.scaleX??I.scale??100)===100&&(I.scaleY??I.scale??100)===100&&!I.posX&&!I.posY&&!I.rotation&&!I.cropL&&!I.cropR&&!I.cropT&&!I.cropB},h=new Map,b=[];for(let R of m)h.set(R,b),b=Gd(R).filter(E=>E.enabled!==!1&&v(E)).reduce((E,Y)=>F4(E,...zn(Y)),b);let g=[];for(let R of[...m].reverse()){let E=Gd(R).filter(I=>I.enabled!==!1),Y=E.reduce((I,te)=>F4(I,...zn(te)),g),K=f.indexOf(R)+1;for(let I of E){let[te,H]=zn(I),M=h.get(R)??[],W=H4(te,H,g).flatMap(([ve,Fe])=>H4(ve,Fe,M));if(!W.length)continue;let D=Io(e,I);if(!(D.w>0&&D.h>0)){d.push({item_id:I.id,name:I.name??I.id,track:K,reason:"the source raster is unknown (timeline_relink the clip first)"});continue}l&&!D.path&&d.push({item_id:I.id,name:I.name??I.id,track:K,reason:"not linked: its source frames were not measured (timeline_relink first); its transform was checked"});let[ae,oe]=L4(a,o,D.w,D.h),ie=Ji(I,te).animated,re=ve=>N4(Ji(I,ve),ae,oe),he=[],Re=new Map;for(let[ve,Fe]of W){let ze=new Set(l&&D.path?M4(ve,Fe,u):[]),It=new Set(ie?Array.from({length:Fe-ve},(jt,Fn)=>ve+Fn):ze.size?[]:[ve]);for(let jt of ze)It.add(jt);let Uo=[...It].sort((jt,Fn)=>jt-Fn);Uo.forEach((jt,Fn)=>{Re.set(jt,[Fn?jt:ve,Uo[Fn+1]??Fe]),he.push({rec:jt,place:re(jt),...ze.has(jt)?{src:Uw(I,jt)}:{}})})}p.push({item:I,track:K,path:D.path,frames:he,hold:Re,animated:ie,box:[ae,oe]})}g=Y}let y=p.length?await Yr({op:"blanking",items:p.map(R=>({path:R.path,frames:R.frames})),out:[a,o],aspect:s},n,i):{items:[],target:[0,0,a,o]},x=y.target,z=[],S=new Map,P=0;y.items.forEach((R,E)=>{let Y=p[E],K=new Map;S.set(Y.item.id,K);for(let I of R){if(I.bars&&P++,I.black||!I.edges.some(M=>M>0))continue;let[te,H]=Y.hold.get(I.rec);for(let M=te;M<H;M++)z.push({pts:M,bt:I.edges[0],bb:I.edges[1],bl:I.edges[2],br:I.edges[3],source:I.bars?"pixels":"geometry"}),K.set(M,I.zoom)}});let T=p.map(R=>({id:R.item.id,name:R.item.name??R.item.id,start:zn(R.item)[0],end:zn(R.item)[1],track:R.track})),X=y4(z,T,0,Math.round(x[2]-x[0]),Math.round(x[3]-x[1]),{tolerance_px:c.tolerance_px,min_frames:c.min_frames,gap_frames:c.gap_frames}).map(R=>{let E=1,Y=S.get(R.clip.id);for(let K=R.start_frame;K<=R.end_frame;K++){if(!Y.has(K))continue;let I=Y.get(K);E=I==null||E==null?null:Math.max(E,I)}return{item_id:R.clip.id,name:R.clip.name,track:R.clip.track,record_start:R.start_frame,record_end:R.end_frame,record_tc:Mo(r,R.start_frame),frames:R.duration_frames,edges:{top:R.measured.bt,bottom:R.measured.bb,left:R.measured.bl,right:R.measured.br},zones:R.zones,sources:R.sources,zoom_fix:E}}),w=[],N=new Map;for(let R of X)N.set(R.item_id,[...N.get(R.item_id)??[],R]);let F=new Map,C=async(R,E)=>{let K=(await Yr({op:"blanking",items:[{path:null,frames:R.frames.map(te=>({rec:te.rec,place:N4(E,R.box[0],R.box[1])}))}],out:[a,o],aspect:s},void 0,i)).items[0]??[],I=[0,1,2,3].map(te=>Math.max(0,...K.map(H=>H.edges[te])));return{ok:I.every(te=>te<=c.tolerance_px),edges:I}};for(let[R,E]of N){let Y=p.find(oe=>oe.item.id===R);if(Y.animated)continue;let K=Io(e,Y.item),I={track:Y.track,start:zn(Y.item)[0]},te=Ji(Y.item,zn(Y.item)[0]),H=oe=>Ew(D4(oe),a,o,q4(K.w,K.h,a,o,I4(Y.item,r,t.input_scaling))),M;if(E.every(oe=>oe.sources.every(ie=>ie==="geometry"))){let oe=["top","bottom","left","right"].map(re=>Math.max(...E.map(he=>he.edges[re]))),ie=[];if(te.rotation&&Math.abs(te.rotation)<1){let re={...te,rotation:0},he=await C(Y,re);he.ok?M={t:re,what:`rotation ${Er(te.rotation,2)}\xB0 removed`}:ie.push({t:re,what:`rotation ${Er(te.rotation,2)}\xB0 removed, `,edges:he.edges})}ie.push({t:te,what:"",edges:oe});for(let re of M?[]:ie){let[he,Re,ve,Fe]=re.edges,ze=ve-Fe,It=he-Re;if(!(!ze&&!It)){for(let[Uo,jt]of[[1,1],[-1,1],[1,-1],[-1,-1]]){let Fn={...re.t,posX:re.t.posX+Uo*ze/Y.box[0],posY:re.t.posY+jt*It/Y.box[1]};if((await C(Y,Fn)).ok){M={t:Fn,what:`${re.what}pan / tilt ${[ze&&`${ze>0?"+":""}${ze} px across`,It&&`${It>0?"+":""}${It} px up/down`].filter(Boolean).join(", ")}`};break}if(!It&&jt===1&&Uo===-1)break}if(M)break}}}if(M){let oe=H(te),ie=H(M.t),re=Object.fromEntries(["Pan","Tilt","RotationAngle"].filter(he=>ie[he]!==oe[he]).map(he=>[he,ie[he]]));w.push({op:"properties",item:I,set:re}),F.set(R,`${M.what} fills it`);for(let he of E)he.fix=M.what;continue}if(E.some(oe=>oe.zoom_fix==null))continue;let W=Math.max(...E.map(oe=>oe.zoom_fix)),D=H(te),ae=oe=>Math.ceil(oe*W*1e5)/1e5;w.push({op:"properties",item:I,set:{ZoomX:ae(D.ZoomX),ZoomY:ae(D.ZoomY)}})}if(t.markers??!0)for(let R of X){let E=p.find(I=>I.item.id===R.item_id),Y=R.zones.map(I=>`${I} ${R.edges[I.toLowerCase()]} px`).join(" \xB7 "),K=E.animated?"keyframed sizing: fix the keys":F.get(R.item_id)??(R.zoom_fix==null?"no zoom about its anchor fills it":`zoom \xD7${R.zoom_fix} fills it`);w.push({op:"marker_add",frame:R.record_start,duration:R.frames,color:"Red",name:`Blanking: ${R.name}`,note:`${Y} (${R.sources.join("+")}) \u2014 ${K}`,data:"ConformTools:blanking"})}return{timeline:r.name??r.id,raster:[a,o],aspect:s,target:x,strictness:c,pixels:l,clips_checked:p.length,frames_measured:P,findings:X,refused:d,ops:w}}function dte(e){return[`${e.findings.length?`BLANKING: ${e.findings.length} range(s) on ${new Set(e.findings.map(n=>n.item_id)).size} clip(s)`:"CLEAN: no clip shows black"} \u2014 ${e.timeline} ${e.raster.join("x")}${e.aspect?`, delivered ${Er(e.aspect,3)}:1 (black counted inside it only)`:""}; ${e.strictness.preset} (${e.strictness.tolerance_px} px, ${e.strictness.min_frames} frame(s)); ${e.clips_checked} clip(s) by their transform${e.pixels?`, ${e.frames_measured} source frame(s) measured for their own black edges`:" (pixels:false: a black edge baked into a source is not seen)"}`,...e.findings.map(n=>` V${n.track} ${n.record_tc} ${n.name} (${n.frames} frame${n.frames>1?"s":""}): ${n.zones.map(i=>`${i} ${n.edges[i.toLowerCase()]} px`).join(", ")} [${n.sources.join("+")}]${n.zoom_fix?` \u2014 zoom \xD7${n.zoom_fix} fills it`:" \u2014 no zoom about its anchor fills it"}`),...e.refused.map(n=>` V${n.track} ${n.name}: ${n.reason}`),`host_apply ops ready: ${e.ops.filter(n=>n.op==="properties").length} ZoomX/ZoomY fixes, ${e.ops.filter(n=>n.op==="marker_add").length} markers (data "ConformTools:blanking")`].join(`
|
|
96
96
|
`)}var ic=e=>e.map(([t,n])=>[t,n]),E4=e=>e[0].toUpperCase()+e.slice(1),Kw=ea.map(e=>[e.id,e.short]),C4=e=>({host:e}),fe=C4("resolve"),Kd=C4("premiere"),SI=G3.map(e=>[e.id,e.label]),ft={id:"source",label:"Timeline",type:"source",optional:!0,placeholder:"the timeline open in Resolve"},Cr=(e="Read the timeline")=>({id:"pull",use:"host.read",args:{...fe,from:"$in.source"},label:e}),J4=u4,Bd=(e,t)=>({id:"apply",use:"host.apply",args:{...fe,ops:"$ops",timeline:"$pull.timeline",source:"$pull"},...e?{when:e}:{},...t?{label:t}:{}}),U4=Object.keys(tc).map(e=>[e,E4(e)]),TI=[["","Full frame"],...Object.keys(nc).filter(e=>e!=="none").map(e=>[e,e])],Y4=e=>Object.entries(Zo).filter(([,t])=>t.folderStructure.includes(`{${e}}`)).map(([t])=>t),Bw=Y4("show"),XI=Y4("film"),G4=[{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:[{...ft,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:Kw,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:Kw,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 color","flag clips","enable / disable clips","tag clips"],group:"Look",...fe,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 color (Premiere: the clip's label), enabled, markers, names, keywords; on Resolve also flags, grade versions, color group, cache.",inputs:[ft,{id:"host",label:"In",type:"choice",choices:fr,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 color"],["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","Color group"],["ungroup","Leave color group"],["prefix","Name prefix"],["suffix","Name suffix"],["cache_on","Color cache on"],["cache_off","Color cache off"],["properties","Set properties"],["metadata","Set metadata"],["keywords_add","Add keywords"],["keywords_remove","Remove keywords"],["markers_remove","Remove the clip's markers"],["fade_in","Fade in (not saved by Resolve 21.1.1)"],["fade_out","Fade out (not saved by Resolve 21.1.1)"],["audio_level","Audio level"],["normalize","Normalize audio"]]},{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","keywords_add","keywords_remove"]}},{id:"set",label:"Set",type:"text",optional:!0,placeholder:"ZoomX=1.2, Opacity=50 \xB7 Comments=VFX, Scene=12",when:{input:"action",is:["properties","metadata"]}},{id:"amount",label:"Frames / dB",type:"text",optional:!0,placeholder:"12 frames \xB7 -6 dB \xB7 -1 dBFS peak",when:{input:"action",is:["fade_in","fade_out","audio_level","normalize"]}}],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.set|$in.amount|$in.text"}},{id:"apply",use:"host.apply",args:{host:"$in.host",ops:"$ops",timeline:"$pull.timeline",source:"$pull"}}]},{id:"markers",name:"Markers",part:!0,app:!0,aka:["marker utility","marker colors","recolor markers","delete markers","rename markers","locators","marker cleanup","marker keywords"],group:"Look",...fe,about:"Timeline and clip markers of the open timeline in Resolve or Premiere: filter them, then recolor, swap two colors, rename, note, keyword, find and replace, change the duration, delete, or move / copy them between the timeline and the clip, in one undoable batch. On Premiere a clip marker is on the media: it shows on every use of it, listed once.",inputs:[ft,{id:"host",label:"In",type:"choice",choices:fr,default:"resolve"},{id:"only",label:"Only color",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:"which",label:"Which",type:"choice",choices:[["","Every marker"],["playhead","The one at the playhead"]],default:""},{id:"action",label:"Do",type:"choice",default:"recolor",choices:[["recolor","Colour"],["swap","Swap colors"],["rename","Set text"],["note","Note"],["keyword","Keyword"],["prefix","Add before"],["suffix","Add after"],["replace","Find and replace"],["duration","Duration"],["delete","Delete"],["to_clip","Move onto the clip"],["to_timeline","Move onto the timeline"],["copy_to_clip","Copy onto the clip"],["copy_to_timeline","Copy onto the timeline"],["swap_places","Swap timeline \u2194 clip"]]},{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:"field",label:"Change",type:"choice",choices:[["name","Name"],["note","Note"],["keyword","Keyword"]],default:"name",when:{input:"action",is:["rename","prefix","suffix","replace"]}},{id:"text",label:"Text",type:"text",when:{input:"action",is:["rename","note","keyword","prefix","suffix","replace"]}},{id:"with",label:"Replace with",type:"text",optional:!0,when:{input:"action",is:["replace"]}},{id:"separator",label:"Separator",type:"text",optional:!0,placeholder:"none",when:{input:"action",is:["prefix","suffix"]}},{id:"frames",label:"Frames",type:"number",default:1,when:{input:"action",is:["duration"]}},{id:"track",label:"Onto track",type:"number",optional:!0,placeholder:"the topmost clip",when:{input:"action",is:["to_clip","copy_to_clip","swap_places"]}}],nodes:[{id:"pull",use:"host.read",args:{host:"$in.host",from:"$in.source"},label:"Read the timeline"},{id:"scoped",use:"rows.filter",args:{rows:"$pull.markers",where:[["on","=","$in.on"],["name|note","contains","$in.find"],["at","=","$in.which"]]}},{id:"rows",use:"rows.filter",args:{rows:"$scoped",where:[["color","=","$in.only"]]}},{id:"review",use:"review",args:{rows:"$rows",columns:[["tc","Record TC"],["color","Colour"],["name","Name"],["note","Note"],["data","Keyword"],["frames","Frames"],["on","On"],["clip","Clip"]]}},{id:"ops",use:"plan.marker_ops",args:{live:"$pull",rows:"$review",all:"$scoped",action:"$in.action",color:"$in.color",text:"$in.color2|$in.text",field:"$in.field",with:"$in.with",separator:"$in.separator",frames:"$in.frames",track:"$in.track"}},{id:"apply",use:"host.apply",args:{host:"$in.host",ops:"$ops",timeline:"$pull.timeline",source:"$pull"}}]},{id:"unused",name:"Unused Media",part:!0,app:!0,aka:["unused media","clean the media pool","tidy the bin","purge","orphan clips","not in any timeline"],group:"Look",...fe,about:"Media pool clips that no timeline in the project uses (every timeline read, and Resolve's own usage count: used if either says so), by drive: move them into one bin, take them out of the pool, or move the files themselves into a folder on disk (Undo puts them back).",inputs:[{id:"drive",label:"Only on drives",type:"text",optional:!0,placeholder:"/Volumes/RAID, /Volumes/SHUTTLE (default: every drive)"},{id:"not_drive",label:"Not on drives",type:"text",optional:!0,placeholder:"/Volumes/ARCHIVE"},{id:"find",label:"Find in name / file",type:"text",optional:!0},{id:"action",label:"Do",type:"choice",choices:[["move","Move into a bin"],["files","Move the files on disk"],["remove","Remove from the pool (cannot be undone)"]],default:"move"},{id:"bin",label:"Bin",type:"text",default:"UNUSED MEDIA",when:{input:"action",is:["move"]}},{id:"destination",label:"Into the folder",type:"folder",when:{input:"action",is:["files"]}}],nodes:[{id:"pool",use:"host.pool",args:{...fe,unused:!0,skip_folder:"$in.bin"},label:"Find the unused clips"},{id:"rows",use:"rows.filter",args:{rows:"$pool",where:[["drive","starts","$in.drive"],["drive","!starts","$in.not_drive"],["name|file","contains","$in.find"]]}},{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"},when:"$in.action!=files"},{id:"apply",use:"host.apply",args:{...fe,ops:"$ops"},when:"$in.action!=files"},{id:"files",use:"files.move",args:{rows:"$review",destination:"$in.destination"},when:"$in.action=files",label:"Move the files"}]},{id:"rename",name:"Rename",part:!0,app:!0,aka:["clip renamer","resolve renamer","rename clips","batch rename","find and replace names","fix clip names"],group:"Prep",...fe,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 or Premiere in one undoable batch (media pool clips: Resolve). Files in a folder (image sequences) are renamed on disk when that is the target.",inputs:[ft,{id:"host",label:"In",type:"choice",choices:fr,default:"resolve"},{id:"target",label:"Rename",type:"choice",choices:[["clips","Timeline clips"],["pool","Media pool clips"],["timelines","Timelines"],["files","Files in a folder (image sequences)"]],default:"clips"},{id:"files_in",label:"Folder",type:"folder",when:{input:"target",is:["files"]}},{id:"offset",label:"Offset frame numbers by",type:"number",optional:!0,placeholder:"0",when:{input:"target",is:["files"]}},{id:"start_at",label:"\u2026or start each sequence at",type:"number",optional:!0,placeholder:"as they are",when:{input:"target",is:["files"]}},{id:"folder",label:"Pool folder",type:"text",optional:!0,placeholder:"all folders",when:{input:"target",is:["pool"]}},{id:"subfolders",label:"Its subfolders too",type:"bool",default:!0,when:{input:"target",is:["pool"]}},{id:"only",label:"Only names matching",type:"text",optional:!0,placeholder:"a pattern, e.g. ^A0\\d+ (numbering counts these)"},{id:"steps",label:"Steps",type:"rename_steps",default:[{type:"find_replace",find:"",replace:""}]}],nodes:[{id:"pull",use:"host.read",args:{host:"$in.host",from:"$in.source"},when:"$in.target!=files",label:"Read the timeline"},{id:"fplan",use:"files.rename_plan",args:{folder:"$in.files_in",steps:"$in.steps",only:"$in.only",offset:"$in.offset",start_at:"$in.start_at"},when:"$in.target=files",label:"Read the folder"},{id:"subjects",use:"rename.subjects",when:"$in.target!=files",args:{host:"$in.host",live:"$pull",target:"$in.target",folder:"$in.folder",subfolders:"$in.subfolders",only:"$in.only"}},{id:"plan",use:"plan.rename",args:{subjects:"$subjects",steps:"$in.steps"},when:"$in.target!=files"},{id:"review",use:"review",args:{rows:"$plan|$fplan",columns:[["where","Where"],["old","Now"],["new","New"],["dupe",""],["error",""]],skip:"hold"}},{id:"ops",use:"ops.collect",args:{rows:"$review"},when:"$in.target!=files"},{id:"apply",use:"host.apply",args:{host:"$in.host",ops:"$ops",timeline:"$pull.timeline",source:"$pull"},when:"$in.target!=files"},{id:"files",use:"files.rename",args:{rows:"$review"},when:"$in.target=files",label:"Rename the files"}]},{id:"handles",name:"Add Handles",part:!0,app:!0,playbook:"conform",output:"timeline",aka:["handles","pad clips","extend clips","add head and tail"],group:"Prep",...fe,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:[ft,{id:"host",label:"In",type:"choice",choices:fr,default:"resolve"},{id:"handles",label:"Handles (frames each side)",type:"number",default:12},{id:"name",label:"New timeline name",type:"text",optional:!0,placeholder:"{TL}_{N}FR_HANDLES"}],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",name:"$in.name"},label:"Build the timeline"},{id:"open",use:"host.open",args:{host:"$in.host",session_id:"$build.session_id",timeline_ids:"$build.timeline_ids",like:"$pull"},label:"Into the host"}],view:{split:"row",panes:[{pane:"knobs"},{pane:"viewer",show:"$build|$source"}]}},{id:"all-clips",name:"All Clips Timeline",part:!0,app:!0,playbook:"conform",output:"timeline",aka:["all clips timeline","sources reel","select reel","string-out of every clip","all source media","used clips timeline","pull list"],group:"Prep",...fe,about:"One timeline of every clip the chosen timelines use (or every timeline in a bin), overlapping uses of the same media merged into one piece, with handles clamped to the media. Duplicate footage (the same shot media-managed twice) is marked or reduced to the best copy. Lands in Resolve or Premiere as a new timeline.",inputs:[{id:"host",label:"In",type:"choice",choices:fr,default:"resolve"},{id:"timelines",label:"From timelines",type:"timelines",optional:!0,placeholder:"the open one"},{id:"bin",label:"Or every timeline in the bin",type:"text",optional:!0,placeholder:"a media pool folder, e.g. REELS (Resolve)"},{id:"subfolders",label:"Its subfolders too",type:"bool",default:!0},{id:"name",label:"New timeline name",type:"text",optional:!0,placeholder:"All_Clips_Timeline_{N}FR_HANDLES"},{id:"settings",label:"Timeline settings",type:"choice",choices:[["project","The project's"],["source","The (first) timeline's, checked"]],default:"project"},{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:"still_extensions",label:"Still extensions",type:"text",optional:!0,placeholder:"the built-in list (e.g. tif, png, jpg)"},{id:"include_nested",label:"What compound / nested clips show",type:"bool",default:!0},{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:"disable_non_matching",label:"\u2026with every clip, the others disabled",type:"bool",default:!1,when:{input:"per_resolution",is:["true"]}},{id:"stack",label:"Stack takes in place",type:"bool",default:!1}],nodes:[{id:"read",use:"host.export_many",args:{host:"$in.host",timelines:"$in.timelines",bin:"$in.bin",subfolders:"$in.subfolders"},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",name:"$in.name",include_nested:"$in.include_nested",still_extensions:"$in.still_extensions",disable_non_matching:"$in.disable_non_matching"}},{id:"open",use:"host.open",args:{host:"$in.host",session_id:"$build.session_id",timeline_ids:"$build.timeline_ids"},when:"$in.settings!=source",label:"Into the host"},{id:"open_like",use:"host.open",args:{host:"$in.host",session_id:"$build.session_id",timeline_ids:"$build.timeline_ids",like:"$read.first"},when:"$in.settings=source & $in.per_resolution!=true",label:"Into the host"},{id:"open_res",use:"host.open",args:{host:"$in.host",session_id:"$build.session_id",timeline_ids:"$build.timeline_ids"},when:"$in.settings=source & $in.per_resolution=true",label:"Into the host"}],view:{split:"row",panes:[{pane:"knobs"},{pane:"viewer",show:"$build|$source"}]}},{id:"vfx",name:"VFX Pulls",part:!0,app:!0,aka:["vfx pulls","visual effects","VFX shots","plate pulls","pulls","shot list","turnover to VFX","EXR plates"],group:"Prep",...fe,about:"Markers of one color 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:[ft,{id:"mode",label:"Do",type:"choice",choices:[["pull","Pull the shots"],["mark","Add the next VFX marker at the playhead"]],default:"pull"},{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:"naming",label:"Name pulls",type:"choice",choices:EO,default:"plates"},{id:"folder",label:"Shot folder",type:"text",optional:!0,placeholder:"{shot} \xB7 {prefix} {number} {scene} {take}"},{id:"names",label:"Rename pulls",type:"text",optional:!0,placeholder:"VFX_0010_PLATE01=SMOKE_0010, \u2026"},{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"},{id:"queue",label:"Only add to Resolve's render queue",type:"bool",default:!1}],nodes:[Cr(),{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",naming:"$in.naming",folder:"$in.folder",names:"$in.names"}},{id:"review",use:"review",args:{rows:"$plan.rows",columns:[["shot","Shot"],["role","Pull"],["name","Name"],["clip","Clip"],["frames","Frames"],["cut","Cut"]]},when:"$in.mode!=mark"},{id:"names",use:"plan.vfx_names",args:{plan:"$plan",rows:"$review"},when:"$in.mode!=mark & $in.name_markers=true"},{id:"name_apply",use:"host.apply",args:{...fe,ops:"$names",timeline:"$pull.timeline"},when:"$in.mode!=mark & $in.name_markers=true",label:"Name the markers"},{id:"stringout",use:"vfx.stringout",args:{...fe,live:"$pull",plan:"$plan",rows:"$review"},when:"$in.mode!=mark & $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.mode!=mark & $in.root!= & $in.build=true"},{id:"render",use:"host.render",args:{...fe,timeline:"$stringout.timeline",jobs:"$jobs",queue:"$in.queue"},when:"$in.mode!=mark & $in.root!= & $in.build=true",label:"Render the pulls"},{id:"cut_jobs",use:"plan.vfx_cut_renders",args:{plan:"$plan",rows:"$review",live:"$pull",handles:"$in.handles",root:"$in.root",plate_preset:"$in.plate_preset",reference_preset:"$in.reference_preset"},when:"$in.mode!=mark & $in.root!= & $in.build!=true"},{id:"cut_render",use:"host.render",args:{...fe,timeline:"$pull.timeline",jobs:"$cut_jobs",queue:"$in.queue"},when:"$in.mode!=mark & $in.root!= & $in.build!=true",label:"Render the pulls off the cut"},{id:"next",use:"plan.vfx_next_marker",args:{live:"$pull",plan:"$plan",color:"$in.color",prefix:"$in.prefix",digits:"$in.digits",increment:"$in.increment"},when:"$in.mode=mark"},{id:"mark",use:"host.apply",args:{...fe,ops:"$next",timeline:"$pull.timeline"},when:"$in.mode=mark",label:"Add the marker"}]},{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",...fe,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:[ft,{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:[Cr(),{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"}},Bd()]},{id:"copy-grades",name:"Copy Grades",part:!0,app:!0,aka:["copy grades","copy grade","copy color","copy sizing","copy repo","grade transfer","track to track"],group:"Match",...fe,about:"Every clip on the destination track (or the one at the playhead) takes the grade \u2014 and the sizing, crop, composite, clip color, flags, clip markers, color group and keywords 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:[ft,{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 color",type:"bool",default:!0},{id:"flags",label:"Flags",type:"bool",default:!0},{id:"markers",label:"Clip markers",type:"bool",default:!0},{id:"versions",label:"Every local grade version",type:"bool",default:!1},{id:"group",label:"Color group",type:"bool",default:!1},{id:"keywords",label:"Keywords",type:"bool",default:!1},{id:"which",label:"Which",type:"choice",choices:[["","Every clip"],["playhead","The clip at the playhead"]],default:""},{id:"miss_color",label:"Mark clips with no source",type:"marker_color",default:"Red",optional:!0}],nodes:[Cr(),{id:"paired",use:"plan.copy_pairs",args:{live:"$pull",from:"$in.from",to:"$in.to"}},{id:"pairs",use:"rows.filter",args:{rows:"$paired",where:[["at","=","$in.which"]]}},{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",live:"$pull",grade:"$in.grade",sizing:"$in.sizing",crop:"$in.crop",composite:"$in.composite",clip_color:"$in.clip_color",flags:"$in.flags",markers:"$in.markers",versions:"$in.versions",group:"$in.group",keywords:"$in.keywords",miss_color:"$in.miss_color"}},Bd()]},{id:"trace",name:"Grade Tracer",part:!0,app:!0,playbook:"patch",aka:["grade tracer","find old grades","where grades came from","previous versions","recover grades","grade history"],group:"Match",...fe,about:"After a re-conform, find each clip's earlier grade in the project's other timelines, or in other projects (source timecode, reel, file name, path, duration), and copy it across, or bring the top matches in as local versions to choose between. Another project is opened in Resolve for the search and again for the grades it gives (each carried over as a grade file), then yours is back as it was.",inputs:[ft,{id:"timelines",label:"Earlier timelines",type:"timelines",optional:!0},{id:"projects",label:"Other projects",type:"projects",optional:!0,placeholder:"none (Resolve opens each in turn, then yours again)"},{id:"min_score",label:"Least score",type:"number",default:60},{id:"floor",label:"Trust from",type:"number",default:60},{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:"unsure_only",label:"Versions only where unsure",type:"bool",default:!1,when:{input:"variants",is:["true"]}},{id:"prefix",label:"Version name",type:"text",default:"trace",when:{input:"variants",is:["true"]}},{id:"tracks",label:"Only tracks",type:"text",optional:!0,placeholder:"1, 3 (default all)"},{id:"sizing",label:"Sizing too",type:"bool",default:!1},{id:"crop",label:"Crop too",type:"bool",default:!1},{id:"composite",label:"Composite + opacity too",type:"bool",default:!1},{id:"clip_color",label:"Clip color too",type:"bool",default:!1},{id:"flags",label:"Flags too",type:"bool",default:!1},{id:"mark_color",label:"Mark unmatched",type:"marker_color",optional:!0},{id:"clear",label:"Clear earlier tracer markers",type:"bool",default:!0}],nodes:[Cr(),{id:"trace",use:"plan.grade_trace",args:{...fe,live:"$pull",timelines:"$in.timelines",projects:"$in.projects",top_n:"$in.top_n",min_score:"$in.min_score",floor:"$in.floor",tracks:"$in.tracks",clip_color:"$in.clip_color",flags:"$in.flags"}},{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",live:"$pull",variants:"$in.variants",only_trusted:"$in.only_trusted",mark_color:"$in.mark_color",prefix:"$in.prefix",unsure_only:"$in.unsure_only",sizing:"$in.sizing",crop:"$in.crop",composite:"$in.composite",clip_color:"$in.clip_color",flags:"$in.flags",clear:"$in.clear"}},Bd()]},{id:"reconform",name:"Reconform",part:!0,app:!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",...fe,about:"The color 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 color 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:[ft,{id:"do",label:"Do",type:"choice",choices:[["carry","Build B with A's grade"],["mark","Mark what changed on A"],["files","Two timeline files \u2192 one (no app)"],["dropin","Drop in finished VFX"],["match","Match the build's sizing to B's picture"],["discard","Discard a build (\u2026_RECONFORMED)"]],default:"carry"},{id:"copy",label:"The build",type:"timeline",when:{input:"do",is:["discard","match"]}},{id:"comps",label:"Finished comps",type:"folder",when:{input:"do",is:["dropin"]}},{id:"disable_plates",label:"Switch the plates off",type:"bool",default:!1,when:{input:"do",is:["dropin"]}},{id:"track",label:"New track",type:"text",optional:!0,placeholder:"VFX",when:{input:"do",is:["dropin"]}},{id:"a",label:"A (color)",type:"timeline",optional:!0,placeholder:"the open one",when:{input:"do",is:["carry","mark"]}},{id:"b",label:"B (new cut)",type:"timeline",optional:!0,when:{input:"do",is:["carry","mark","match"]}},{id:"a_file",label:"A, the finished cut (file)",type:"file",placeholder:".drt .aaf .xml .prproj .fcpxml .otio, Flame archive",when:{input:"do",is:["files"]}},{id:"b_file",label:"\u2026or B as a file",type:"file",optional:!0,placeholder:".aaf .xml .edl .drt .prproj",when:{input:"do",is:["carry","mark","files"]}},{id:"effects",label:"Effects",type:"bool",default:!0,when:{input:"do",is:["files"]}},{id:"carry_markers",label:"Markers (follow their clips)",type:"bool",default:!0,when:{input:"do",is:["files"]}},{id:"target",label:"Write for",type:"choice",choices:Kw,default:"resolve",when:{input:"do",is:["files"]}},{id:"out",label:"Write to",type:"folder",optional:!0,placeholder:"a folder (default: next to B)",when:{input:"do",is:["files"]}},...J4.map(([e,t])=>({id:e,label:t,type:"bool",default:e!=="fades",when:{input:"do",is:["sizing","crop","composite"].includes(e)?["carry","files"]:["carry"]}})),{id:"miss_color",label:"Mark new material",type:"marker_color",default:"Green",optional:!0,when:{input:"do",is:["carry"]}},{id:"history",label:"Keep A's program on a HISTORY track (off)",type:"bool",default:!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","files"]}},{id:"compare",label:"Compare",type:"choice",choices:[["edit","The edit, clip by clip"],["source","What plays at each frame"]],default:"edit",when:{input:"do",is:["mark"]}},{id:"by_track",label:"Track by track",type:"bool",default:!1,when:{input:"compare",is:["source"]}},{id:"picture",label:"Check the picture",type:"choice",choices:[["loose","Pairs made by name"],["all","Every pair"],["","No"]],default:"loose",when:{input:"compare",is:["edit"]}},{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:"compare",is:["source"]}},{id:"report",label:"Save the change list (HTML) into",type:"folder",optional:!0,placeholder:"no report",when:{input:"do",is:["mark","carry","dropin"]}}],nodes:[{id:"pull",use:"host.read",args:{...fe,timeline:"$in.a",from:"$in.source"},when:"$in.do!=files & $in.do!=discard & $in.do!=match",label:"Read A"},{id:"mc",use:"host.read",args:{...fe,timeline:"$in.copy"},when:"$in.do=match",label:"Read the build"},{id:"mb",use:"host.read",args:{...fe,timeline:"$in.b"},when:"$in.do=match",label:"Read B"},{id:"measure",use:"align.against",args:{session_id:"$mc.session_id",timeline:"$mc.timeline",b_session_id:"$mb.session_id",b_timeline:"$mb.timeline"},when:"$in.do=match",label:"Measure against B"},{id:"match_rows",use:"plan.align_rows",args:{result:"$measure"},when:"$in.do=match"},{id:"match_review",use:"review",args:{rows:"$match_rows",columns:[["record_tc","Record"],["name","Clip"],["verdict","Verdict"],["confidence","Confidence"],["sizing","Sizing"],["why","Why"]],skip:"cant"},when:"$in.do=match",label:"Match sizing"},{id:"match_ops",use:"plan.align_ops",args:{result:"$measure",rows:"$match_review"},when:"$in.do=match"},{id:"match",use:"host.apply",args:{...fe,ops:"$match_ops",timeline:"$mc.timeline",source:"$mc"},when:"$in.do=match",label:"Match the build's sizing"},{id:"gone_review",use:"review",args:{rows:[{id:"discard",cells:{timeline:"$in.copy",what:"deleted from the project \u2014 a deleted timeline cannot be undone"},op:{op:"timeline_discard",timeline:"$in.copy"}}],columns:[["timeline","Timeline"],["what",""]]},when:"$in.do=discard",label:"Discard"},{id:"gone_ops",use:"ops.collect",args:{rows:"$gone_review"},when:"$in.do=discard"},{id:"discard",use:"host.apply",args:{...fe,ops:"$gone_ops",timeline:"$in.copy"},when:"$in.do=discard",label:"Discard the build"},{id:"drops",use:"plan.vfx_dropin",args:{live:"$pull",folder:"$in.comps"},when:"$in.do=dropin",label:"Match the comps"},{id:"drop_review",use:"review",args:{rows:"$drops",columns:[["comp","Comp"],["shot","Shot"],["version","v"],["status","Status"],["by","Matched by"],["confidence","Sure"],["plate","Over"],["at","At"],["why","Why"]],skip:"cant"},when:"$in.do=dropin"},{id:"drop_ops",use:"plan.vfx_dropin_ops",args:{rows:"$drop_review",name:"$in.track",disable_plates:"$in.disable_plates"},when:"$in.do=dropin"},{id:"drop",use:"host.apply",args:{...fe,ops:"$drop_ops",timeline:"$pull.timeline"},when:"$in.do=dropin",label:"Drop the comps in"},{id:"b",use:"host.read",args:{...fe,timeline:"$in.b"},when:"$in.b!= & $in.do!=match",label:"Read B"},{id:"bf",use:"source.file",args:{path:"$in.b_file"},when:"$in.b_file",label:"Read B (file)"},{id:"b_in",use:"host.open",args:{...fe,session_id:"$bf.session_id",like:"$pull"},when:"$in.do=carry & $in.b_file!=",label:"Bring B into Resolve"},{id:"b2",use:"host.read",args:{...fe,timeline:"$b_in.timeline"},when:"$in.do=carry & $in.b_file!=",label:"Read B"},{id:"files",use:"timeline.read_many",args:{paths:["$in.b_file","$in.a_file"]},when:"$in.do=files",label:"Read B and A"},{id:"carried_file",use:"timeline.carry",args:{session_id:"$files.session_id",sources:"$files.sources",name:"$in.name",sizing:"$in.sizing",crop:"$in.crop",opacity:"$in.composite",effects:"$in.effects",markers:"$in.carry_markers"},when:"$in.do=files",label:"Carry A onto B"},{id:"write",use:"verb.timeline_write",args:{session_id:"$files.session_id",timeline_id:"$carried_file.timeline_id",target:"$in.target",out_path:"$in.out"},when:"$in.do=files",label:"Write it"},{id:"pairs",use:"plan.carry_rows",args:{a:"$pull",b:"$b|$b2"},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:"sizes",use:"rows.filter",args:{rows:"$carried",where:[["sizing_differs","=","true"]]},when:"$in.do=carry & $in.sizing=true"},{id:"sizing_review",use:"review",args:{rows:"$sizes",columns:[["record","Record"],["clip","Clip"],["a_sizing","A's sizing (ticked)"],["b_sizing","B's own (unticked)"]]},when:"$in.do=carry & $in.sizing=true & $sizes.0.id!=",label:"A's sizing or B's"},{id:"dup",use:"host.duplicate",args:{...fe,timeline:"$b.timeline|$b2.timeline",name:"$in.name"},when:"$in.do=carry",label:"Copy B"},{id:"carry",use:"plan.carry_ops",args:{rows:"$carried",a:"$pull",...Object.fromEntries(J4.map(([e])=>[e,`$in.${e}`])),miss_color:"$in.miss_color",a_sizing:"$sizing_review"},when:"$in.do=carry"},{id:"build",use:"host.apply",args:{...fe,ops:"$carry",timeline:"$dup.timeline",source:"$b|$b2"},when:"$in.do=carry",label:"Carry A onto the copy"},{id:"hist",use:"plan.history",args:{a:"$pull"},when:"$in.do=carry & $in.history=true"},{id:"keep_a",use:"host.apply",args:{...fe,ops:"$hist",timeline:"$dup.timeline"},when:"$in.do=carry & $in.history=true",label:"Keep A on a HISTORY track"},{id:"bl",use:"host.read",args:{...fe,from:"$bf"},when:"$in.do=mark & $in.compare=edit & $in.b_file!=",label:"Read B"},{id:"edits",use:"plan.edit_changes",args:{a:"$pull",b:"$b|$bl"},when:"$in.do=mark & $in.compare=edit",label:"Compare the edit"},{id:"pictures",use:"verify.pictures",args:{rows:"$edits",which:"$in.picture"},when:"$in.do=mark & $in.compare=edit & $in.picture!=",label:"Check the picture"},{id:"edit_review",use:"review",args:{rows:"$pictures|$edits",columns:[["b_tc","B"],["a_tc","A"],["change","Change"],["clip","Clip"],["head","Head"],["tail","Tail"],["frames","Frames"],["paired",""],["picture","Picture"]]},when:"$in.do=mark & $in.compare=edit"},{id:"b_marks",use:"plan.edit_change_ops",args:{rows:"$edit_review",side:"B",live:"$b"},when:"$in.do=mark & $in.compare=edit & $in.mark=true & $in.b!="},{id:"mark_b",use:"host.apply",args:{...fe,ops:"$b_marks",timeline:"$b.timeline",source:"$b"},when:"$in.do=mark & $in.compare=edit & $in.mark=true & $in.b!=",label:"Mark the changes on B"},{id:"a_marks",use:"plan.edit_change_ops",args:{rows:"$edit_review",side:"A",live:"$pull"},when:"$in.do=mark & $in.compare=edit & $in.mark=true"},{id:"mark_a",use:"host.apply",args:{...fe,ops:"$a_marks",timeline:"$pull.timeline",source:"$pull"},when:"$in.do=mark & $in.compare=edit & $in.mark=true",label:"Mark the deletions on A"},{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 & $in.compare=source",label:"Compare"},{id:"rows",use:"plan.reconform",args:{diff:"$diff",start_frame:"$pull.start_frame"},when:"$in.do=mark & $in.compare=source"},{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 & $in.compare=source"},{id:"ops",use:"ops.collect",args:{rows:"$review"},when:"$in.do=mark & $in.compare=source"},Bd("$in.do=mark & $in.compare=source & $in.mark=true","Mark the changes on A"),{id:"inserts",use:"host.open",args:{...fe,session_id:"$diff.session_id"},when:"$in.do=mark & $in.compare=source & $in.inserts=true",label:"Open the insert timeline"},{id:"page",use:"rows.html",args:{rows:"$edit_review|$review|$carried|$drop_review",columns:[["b_tc","B"],["a_tc","A"],["change","Change"],["clip","Clip"],["head","Head"],["tail","Tail"],["record","Record"],["from","Takes from A"],["grade","Grade"],["comp","Comp"],["status","Status"],["plate","Over"],["at","At"],["why","Why"]],title:"$pull.timeline",folder:"$in.report"},when:"$in.report!= & $in.do!=files",label:"Save the report"}],view:{split:"row",panes:[{split:"col",size:.34,panes:[{pane:"knobs",size:.45},{pane:"rows"}]},{pane:"compare",show:["$pull|$source|$files","$b|$bf|$carried_file"]}]}},{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:[ft,{id:"kind",label:"Kind",type:"choice",choices:K3.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:SI,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:B3.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:[{...Cr(),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 colorist / 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:[ft,{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:[Cr(),{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,app:!0,aka:["blanking detector","black edges","black borders","bad repo","sizing check","edge check"],group:"Check",...fe,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:[ft,{id:"host",label:"In",type:"choice",choices:fr,default:"resolve"},{id:"aspect",label:"Delivered as",type:"choice",choices:TI,default:""},{id:"strictness",label:"Strictness",type:"choice",choices:U4,default:"strict"},{id:"scaling",label:"Input scaling",type:"choice",choices:Gw.map(e=>[e,E4(e)]),default:"fit"},{id:"tolerance_px",label:"Tolerance (px)",type:"number",optional:!0,placeholder:"the strictness's"},{id:"min_frames",label:"At least (frames)",type:"number",optional:!0,placeholder:"the strictness's"},{id:"gap_frames",label:"Joins over (frames)",type:"number",optional:!0,placeholder:"the strictness's"},{id:"black_threshold",label:"Black at or under (8-bit)",type:"number",optional:!0,placeholder:"the strictness's"},{id:"pixels",label:"Measure pixels (slower)",type:"bool",default:!1},{id:"samples",label:"Frames measured per clip",type:"number",default:3,when:{input:"pixels",is:["true"]}},{id:"fixes",label:"Zoom fixes",type:"bool",default:!0},{id:"which",label:"Which",type:"choice",choices:[["","Every finding"],["playhead","The one at the playhead"],["next","The next one after the playhead"]],default:""},{id:"clear",label:"Clear earlier blanking markers",type:"bool",default:!0},{id:"set_blanking",label:"Set the timeline's output blanking to it",type:"bool",default:!1,when:{input:"host",is:["resolve"]}}],nodes:[{id:"pull",use:"host.read",args:{host:"$in.host",from:"$in.source"},label:"Read the timeline"},{id:"check",use:"verb.qc_blanking",args:{session_id:"$pull.session_id",aspect:"$in.aspect|$pull.output_aspect",strictness:"$in.strictness",input_scaling:"$in.scaling",pixels:"$in.pixels",samples:"$in.samples",tolerance_px:"$in.tolerance_px",min_frames:"$in.min_frames",gap_frames:"$in.gap_frames",black_threshold:"$in.black_threshold"},label:"Check"},{id:"found",use:"plan.blanking_rows",args:{result:"$check",live:"$pull"}},{id:"rows",use:"rows.filter",args:{rows:"$found",where:[["at","=","$in.which"]]}},{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",clear:"$in.clear",which:"$in.which"}},{id:"apply",use:"host.apply",args:{host:"$in.host",ops:"$ops",timeline:"$pull.timeline",source:"$pull"}},{id:"blank_ops",use:"plan.output_blanking",args:{aspect:"$in.aspect",check:"$check",live:"$pull"},when:"$in.set_blanking=true & $in.aspect!="},{id:"blank",use:"host.apply",args:{host:"$in.host",ops:"$blank_ops",timeline:"$pull.timeline"},when:"$in.set_blanking=true & $in.aspect!=",label:"Set the output blanking"}],view:{split:"row",panes:[{pane:"knobs"},{pane:"viewer",show:"$source"}]}},{id:"finishing-qc",name:"Finishing QC",part:!0,app:!0,playbook:"deliverables",aka:["master qc","quality control","final check","tech check","QC report","pre-delivery check","netflix spec","ebu r128","loudness spec","proxy leak detector","proxies in the conform","offline media in the online"],group:"Check",about:"Holds the master to a delivery spec (Netflix, Apple, Amazon, EBU R128, BBC/DPP, ATSC A/85, or a conform pack \u2014 Proxy leak lists the shots still on proxy or offline media, each scored as 0.9.5's Proxy Leak Detector did). Render the timeline through the conform.tools render plugin in Resolve, which measures every frame after the grade and marks the findings on the timeline; or check a rendered master from any app, every frame measured on this machine.",inputs:[{id:"from",label:"Check",type:"choice",choices:[["resolve","The timeline (render in Resolve)"],["file","A rendered master (any app)"],["earlier","An earlier scan (no render)"]],default:"resolve"},{id:"scan_dir",label:"The scan",type:"folder",optional:!0,placeholder:"the newest scan",when:{input:"from",is:["earlier"]}},{id:"path",label:"The master",type:"file",when:{input:"from",is:["file"]}},{id:"pack",label:"Spec",type:"choice",choices:w4,default:"conform_default"},{id:"strictness",label:"Strictness",type:"choice",choices:U4,default:"strict",when:{input:"from",is:["resolve"]}},{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:"",when:{input:"from",is:["resolve"]}},{id:"timelines",label:"Timelines (a batch)",type:"timelines",optional:!0,placeholder:"the open one",when:{input:"from",is:["resolve"]}},{id:"markers",label:"Markers",type:"bool",default:!0,when:{input:"from",is:["resolve"]}},{id:"marker_scope",label:"Markers on",type:"choice",choices:[["timeline","The timeline"],["clips","The clips (picture findings)"]],default:"timeline",when:{input:"markers",is:["true"]}},{id:"audio",label:"Audio",type:"bool",default:!0,when:{input:"from",is:["resolve"]}},{id:"report",label:"Save a report (HTML) into",type:"folder",optional:!0,placeholder:"no report"}],nodes:[{id:"scan",use:"host.qc",args:{pack:"$in.pack",timelines:"$in.timelines",strictness:"$in.strictness",expected_aspect:"$in.aspect",markers:"$in.markers",marker_scope:"$in.marker_scope",audio:"$in.audio"},when:"$in.from=resolve",label:"Render through the plugin"},{id:"file",use:"qc.master_file",args:{path:"$in.path",pack:"$in.pack"},when:"$in.from=file",label:"Measure the master"},{id:"again",use:"qc.reopen",args:{folder:"$in.scan_dir"},when:"$in.from=earlier",label:"Read the scan again"},{id:"report",use:"qc.report",args:{rows:"$scan.rows|$file.rows|$again.rows",text:"$scan.text|$file.text|$again.text",subject:"$in.path|$scan.scan.timeline|$again.scan.timeline",pack:"$in.pack",folder:"$in.report",verdict:"$file.verdict"},when:"$in.report!=",label:"Save the report"},{id:"show",use:"table",args:{rows:"$scan.rows|$file.rows|$again.rows",text:"$scan.text|$file.text|$again.text",columns:[["tc","In"],["out","Out"],["kind","Finding"],["severity",""],["clip","Clip"],["detail","Measured"],["decision","Decision"]]}}]},{id:"odd-images",name:"Odd Image Fixer",part:!0,app:!0,aka:["odd image size fixer","odd dimensions","uneven image size","black line on a still","even pixels"],group:"Prep",about:"Stills whose width or height is odd \u2014 most codecs and some apps refuse them, Resolve draws a black line \u2014 rewritten at even sizes in their own format (a row / column cropped; or scaled to a maximum), color profile and metadata kept, the originals in 'zORIGINAL IMAGES' beside them. Undo puts them back. No app needed.",inputs:[{id:"folder",label:"The folder of stills",type:"folder"},{id:"max",label:"Also scale down to fit",type:"number",optional:!0,placeholder:"no maximum (pixels)"},{id:"refresh",label:"Refresh them in Resolve's media pool",type:"bool",default:!1}],nodes:[{id:"plan",use:"files.odd_plan",args:{folder:"$in.folder",max:"$in.max"},label:"Find the odd sizes"},{id:"review",use:"review",args:{rows:"$plan",columns:[["file","Still"],["now","Now"],["becomes","Becomes"],["why",""]],skip:"cant"}},{id:"fix",use:"files.odd_fix",args:{rows:"$review",max:"$in.max"},label:"Make them even"},{id:"pool",use:"host.apply",args:{host:"resolve",ops:[{op:"pool_refresh",paths:"$fix.paths"}]},when:"$in.refresh=true",label:"Refresh in Resolve"}]},{id:"output-sorter",name:"Output Sorter",part:!0,app:!0,aka:["output sorter","sort deliverables","file the mixes","mixes and splits","organise renders","sort files into folders"],group:"Deliver",about:"A folder of deliverables (mixes, stems, renders, masters) filed into folders by a recipe: ordered rules (a keyword, an extension, a pattern), the project read from each name, folder templates. Previewed file by file; nothing is ever overwritten; Undo puts every file back. No app needed.",inputs:[{id:"folder",label:"The folder to sort",type:"folder"},{id:"recipe",label:"Recipe",type:"choice",choices:nk.map(e=>[e.id,e.name]),default:"mixes-splits"},{id:"recipe_file",label:"\u2026or a recipe file",type:"file",optional:!0,placeholder:".json (0.9.5's recipe format)"},{id:"recursive",label:"Into subfolders too",type:"bool",default:!1},{id:"destination_root",label:"File into",type:"folder",optional:!0,placeholder:"inside the folder itself"},{id:"operation",label:"Move or copy",type:"choice",choices:[["move","Move"],["copy","Copy (keep the originals)"]],default:"move"}],nodes:[{id:"plan",use:"files.sort_plan",args:{folder:"$in.folder",recipe:"$in.recipe_file|$in.recipe",recursive:"$in.recursive",destination_root:"$in.destination_root",operation:"$in.operation"},label:"Plan the filing"},{id:"review",use:"review",args:{rows:"$plan",columns:[["file","File"],["rule","Rule"],["project","Project"],["to","Goes to"],["status",""],["why","Why"]],skip:"cant"}},{id:"sort",use:"files.sort",args:{folder:"$in.folder",recipe:"$in.recipe_file|$in.recipe",recursive:"$in.recursive",destination_root:"$in.destination_root",operation:"$in.operation",rows:"$review"},label:"File them"}]},{id:"seq-patch",name:"Image Sequence Patcher",part:!0,app:!0,aka:["image sequence patcher","patch frames","replace frames","fix frames in a sequence","drop in fixed frames"],group:"Deliver",about:`Fixed frames into an image sequence: every folder beside the sequence's with "patch" in its name holds frames named as the ones they replace. Previewed frame by frame; the originals kept in <sequence>_originalframes, the patch folders filed under zAPPLIED_PATCHES; Undo puts it all back. No app needed.`,inputs:[{id:"sequence",label:"The sequence's folder",type:"folder"}],nodes:[{id:"plan",use:"files.patch_plan",args:{sequence:"$in.sequence"},label:"Read the patch folders"},{id:"review",use:"review",args:{rows:"$plan",columns:[["frame","Frame"],["folder","From"],["status",""]],skip:"cant"}},{id:"patch",use:"files.patch",args:{sequence:"$in.sequence",rows:"$review"},label:"Patch the frames in"}]},{id:"renders",name:"Marker Renders",part:!0,app:!0,playbook:"deliverables",aka:["marker batch renderer","render markers","export marker ranges","stills at markers","frame grabs","review renders"],group:"Deliver",...fe,about:"One render per marker of a color, 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:[ft,{id:"host",label:"In",type:"choice",choices:fr,default:"resolve"},{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:"duration"},{id:"handles",label:"Handles",type:"number",default:0},{id:"naming",label:"Naming",type:"choice",choices:f4,default:"conformtools"},{id:"show",label:"Show",type:"text",optional:!0,when:{input:"naming",is:Bw}},{id:"season",label:"Season",type:"text",optional:!0,when:{input:"naming",is:Bw}},{id:"episode",label:"Episode",type:"text",optional:!0,when:{input:"naming",is:Bw}},{id:"film",label:"Film",type:"text",optional:!0,when:{input:"naming",is:XI}},{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:"title",label:"Title",type:"text",optional:!0},{id:"project",label:"Project name",type:"text",optional:!0,placeholder:"the host's project name"},{id:"template",label:"Name pattern",type:"text",optional:!0,placeholder:"the convention's (e.g. {show}_{episode}_{MARKER}_{TL_TC})"},{id:"case",label:"Case",type:"choice",choices:[["","The convention's"],["none","As typed"],["uppercase","UPPER"],["lowercase","lower"]],default:""},{id:"folder",label:"Folders",type:"text",optional:!0,placeholder:"the convention's ({project}/{timeline}/{date} \u2026)"},{id:"root",label:"Render into",type:"folder"},{id:"preset",label:"Render with",type:"render_preset",optional:!0,placeholder:"the current Deliver settings"},{id:"queue",label:"Only add to Resolve's render queue",type:"bool",default:!1},{id:"clear_jobs",label:"First delete from Resolve's render queue",type:"choice",choices:[["","Nothing"],["completed","Completed jobs"],["incomplete","Jobs not rendered"],["all","Every job (cannot be undone)"]],default:""}],nodes:[{id:"pull",use:"host.read",args:{host:"$in.host",from:"$in.source"},label:"Read the timeline"},{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",folder:"$in.folder",template:"$in.template",case:"$in.case",fields:{show:"$in.show",season:"$in.season",episode:"$in.episode",film:"$in.film",reel:"$in.reel",version:"$in.version",artist:"$in.artist",title:"$in.title",project:"$in.project"}}},{id:"review",use:"review",args:{rows:"$plan",columns:[["tc","Marker"],["marker","Marker name"],["frames","Frames"],["name","Renders as"],["folder","Into"],["dupe",""]],skip:"dupe"}},{id:"clear",use:"host.apply",args:{...fe,ops:[{op:"render_jobs_delete",which:"$in.clear_jobs"}]},when:"$in.clear_jobs",label:"Delete render jobs"},{id:"render",use:"host.render",args:{host:"$in.host",timeline:"$pull.timeline",jobs:"$review",queue:"$in.queue"},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, color 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},ft],nodes:[{...Cr("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",...fe,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:[ft,{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:[Cr(),{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",...Kd,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","color returns","drop in the comps","version up the shots","returns onto the timeline"],group:"Prep",...Kd,about:"Premiere: VFX or color 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",...Kd,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",...Kd,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",...fe,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:[ft,{id:"host",label:"From",type:"choice",choices:fr,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, color 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:ic(Fw),default:"rec709"},{id:"container",label:"Container",type:"choice",choices:[["","From the master"],...ic(d4)],default:""},{id:"resolution",label:"Size",type:"choice",choices:ic(m4),default:"2k"},{id:"kind",label:"Kind",type:"choice",choices:ic(p4),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:ic(Fw),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 Ui(e,t){let n=[{id:"mode",label:"Do",type:"choice",choices:t.map(([a,o])=>[a,o]),default:t[0][0]}],i=[],r=t.map(([a,,o])=>[a,G4.find(s=>s.id===o)]);for(let[a,o]of r){let s=c=>c==="source"?c:`${a}_${c}`;for(let c of o.inputs){if(c.id==="source"){n.some(l=>l.id==="source")||n.splice(0,0,c);continue}n.push({...c,id:s(c.id),...c.not?{not:s(c.not)}:{},when:c.when?{input:s(c.when.input),is:c.when.is}:{input:"mode",is:[a]}})}i.push({id:a,use:`tool.${o.id}`,args:Object.fromEntries(o.inputs.map(c=>[c.id,`$in.${s(c.id)}`])),when:`$in.mode=${a}`,label:o.name})}return{...e,aka:[...e.aka??[],...r.flatMap(([,a])=>[a.name,...a.aka??[]])],inputs:n,nodes:i,...r[0][1].view?{view:r[0][1].view}:{}}}var K4=[...G4,Ui({id:"index",name:"Edit Index+",app:!0,aka:["edit index +","edit index plus"],group:"Look",...fe,about:"The open timeline's clips as a table to filter and change in one undoable batch; relink; and on Premiere: proxies to online, cut in returns, un-nest, resize the sequence."},[["clips","Clips","clips"],["relink","Relink","relink"],["uprez","Proxies to online (Premiere)","uprez"],["cutin","Cut in returns (Premiere)","cutin"],["unnest","Un-nest (Premiere)","unnest"],["resize","Resize sequence (Premiere)","resize"]]),Ui({id:"grades",name:"Grades",playbook:"patch",group:"Match",...fe,about:"Copy grades (and sizing, crop, composite, color, 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"]]),Ui({id:"allclips",name:"Build Timeline",playbook:"conform",output:"timeline",group:"Prep",...fe,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"]]),Ui({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 color 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"]]),Ui({id:"qc",name:"QC",playbook:"deliverables",group:"Check",...fe,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"]]),Ui({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"]]),Ui({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"]])],jI=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"]),NI=new Set(["path","reference","a","b","plate","render","master","patch","edl_path","csv_path","credits_path","look_path"]),LI=new Set(["out_dir","media_root","target_dir","images_dir","pool"]),ZI=new Set(["pool","paths","picture","sound","mix","media_dirs","fonts"]);function jte(e){let t=[];for(let n of e){if(jI.has(n.name)||n.name.startsWith("host_"))continue;let i=nh(Md.object(n.inputSchema)),r=[],a=!0;for(let[o,s]of Object.entries(i.properties??{})){if(o==="background"||o.startsWith("__"))continue;let c=!!i.required?.includes(o)&&s.default===void 0,l=Array.isArray(s.type)?s.type[0]:s.type,u=s.enum?"choice":l==="boolean"?"bool":l==="number"||l==="integer"?"number":l==="string"?NI.has(o)?"file":LI.has(o)?"folder":"text":l==="array"&&s.items?.type==="string"&&ZI.has(o)?"files":null;if(!u){if(c){a=!1;break}continue}r.push({id:o,label:o.replace(/_/g," "),type:u,optional:!c,...s.default!==void 0?{default:s.default}:{},...s.enum?{choices:s.enum.map(f=>[f,f])}:{},...s.description?{placeholder:s.description.slice(0,120)}:{}})}a&&t.push({id:`verb-${n.name.replace(/_/g,"-")}`,name:n.title??n.name,group:"API",about:String(n.description??"").split(/(?<=\.)\s/)[0],inputs:r,nodes:[{id:"run",use:`verb.${n.name}`,args:Object.fromEntries(r.map(o=>[o.id,`$in.${o.id}`]))}]})}return t}var Vte="io.modelcontextprotocol/skills",Q4=3e5,WI=512,VI=16*1024*1024;async function RI(){let e=dr("CONFORM_PLAYBOOKS_DIR");if(e)return await Yi(e)?e:null;let t=uc(new URL("../../api/playbooks/",import.meta.url));return await Yi(t)?t:null}var HI={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"},FI=e=>HI[e.split(".").pop()?.toLowerCase()??""]??"application/octet-stream";async function MI(e){let t=new Uint8Array(await crypto.subtle.digest("SHA-256",e));return"sha256:"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function II(e){let t=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(e);if(!t)return null;let n={};for(let i of t[1].split(/\r?\n/)){let r=/^([A-Za-z0-9_-]+):\s*(.*)$/.exec(i);if(!r)continue;let a=r[2].trim();(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))&&(a=a.slice(1,-1)),n[r[1]]=a}return n}async function _4(e,t,n,i){let r=[];for await(let a of mt(e))r.push(a);r.sort((a,o)=>a.name.localeCompare(o.name));for(let a of r){if(a.name.startsWith("."))continue;let o=t?`${t}/${a.name}`:a.name;a.isDirectory?(i.push(o),await _4(A(e,a.name),o,n,i)):a.isFile&&n.push({rel:o,abs:A(e,a.name)})}}async function qI(e){let t=[];for await(let i of mt(e))i.isDirectory&&!i.name.startsWith(".")&&t.push(i.name);let n=[];for(let i of t.sort()){let r=[];await _4(A(e,i),"",r,[]),n.push({name:i,files:await Promise.all(r.filter(a=>a.rel.endsWith(".md")).map(async a=>({path:a.rel,bytes:await dt(a.abs)})))})}return n}var DI=()=>`${Pn().supabaseUrl}/functions/v1/v1-me/v1/engine/playbooks`;async function JI(){let e=await Gr().catch(()=>null);if(!e)throw new Error("not signed in: call account_login, then try again");let t=await fetch(DI(),{headers:{authorization:`Bearer ${e}`,apikey:Pn().anonKey},signal:AbortSignal.timeout(8e3)}),n=await t.json().catch(()=>null);if(!t.ok||!Array.isArray(n?.playbooks))throw new Error(n?.error?.message??`conform.tools answered ${t.status}`);let i=new TextEncoder;return{version:String(n.version??"unknown"),skills:n.playbooks.map(r=>({name:r.name,files:r.files.map(a=>({path:a.path,bytes:i.encode(a.text)}))}))}}async function B4(e){let t=[];for(let n of e){if(!n.files.some(s=>s.path==="SKILL.md"))continue;let i=`skill://${n.name}`,r=[],a=new Set([""]);for(let s of[...n.files].sort((c,l)=>c.path.localeCompare(l.path))){let c=s.path.split("/");for(let l=1;l<c.length;l++)a.add(c.slice(0,l).join("/"));r.push({uri:`${i}/${s.path}`,path:s.path,name:c[c.length-1],bytes:s.bytes,digest:await MI(s.bytes),mimeType:FI(s.path)})}let o=II(new TextDecoder().decode(r.find(s=>s.path==="SKILL.md").bytes));!o||o.name!==n.name||typeof o.description!="string"||r.length>WI||r.reduce((s,c)=>s+c.bytes.length,0)>VI||t.push({name:n.name,uri:`${i}/SKILL.md`,root:i,frontmatter:o,files:r,dirs:a})}return t}var Ad=null;function Aw(){Ad??=(async()=>{let t=await RI();if(t)return{skills:await B4(await qI(t)),source:"local",version:"local"};let n=await JI();return{skills:await B4(n.skills),source:"conform.tools",version:n.version}})();let e=Ad;return e.catch(()=>{Ad===e&&(Ad=null)}),e}async function _d(){try{return(await Aw()).skills}catch{return[]}}function $4(e){return{uri:e.uri,frontmatter:e.frontmatter,resources:e.files.map(t=>({uri:t.uri,digest:t.digest,size:t.bytes.length}))}}var Qd=class extends Error{constructor(n,i){super(i);this.code=n}},eS=-32602;async function Rte(){return{resultType:"complete",skills:(await _d()).map($4),ttlMs:Q4,cacheScope:"public"}}async function Hte(e){let t=(await _d()).find(n=>n.uri===e);if(!t)throw new Qd(eS,`No skill is served at ${String(e)}`);return{resultType:"complete",skill:$4(t),ttlMs:Q4,cacheScope:"public"}}async function Fte(e){let t=String(e??"").replace(/\/$/,"");for(let n of await _d()){if(t!==n.root&&!t.startsWith(n.root+"/"))continue;let i=t===n.root?"":t.slice(n.root.length+1);if(!n.dirs.has(i))break;let r=i?i+"/":"",a=[];for(let o of[...n.dirs].sort())o&&o.startsWith(r)&&!o.slice(r.length).includes("/")&&a.push({uri:`${n.root}/${o}`,name:o.slice(r.length),mimeType:"inode/directory"});for(let o of n.files)o.path.startsWith(r)&&!o.path.slice(r.length).includes("/")&&a.push({uri:o.uri,name:o.name,mimeType:o.mimeType});return{resultType:"complete",resources:a}}throw new Qd(eS,`No skill directory at ${t}`)}async function tS(e=!1){let t=await _d();return t.length?e?`Playbooks (conform_learn task=\u2026, or read the skill): ${t.map(n=>n.uri).join(", ")}.`:["Skills: this server ships Agent Skills that say how a conform artist uses these tools. Load the one that fits the task:",...t.map(n=>`- ${n.uri} \u2014 ${n.frontmatter.description}`)].join(`
|
|
97
97
|
`):""}var Mte=["conform","autoconform","deliver","deliverables","troubleshoot","patch"],Ite=["avid","premiere","resolve","finalcut","flame","baselight","protools"],UI={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"]]},A4={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"},EI=e=>e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").trimStart(),nS=new Set,qte=()=>nS.size>0;async function Dte(e,t=[]){let{skills:n,version:i}=await Aw(),[r,a]=UI[e],o=n.find(m=>m.name===r);if(!o)throw new Error(`the ${r} playbook is not available (version ${i})`);let s=n.find(m=>m.name==="conform-artist"),c=a.map(m=>[o,m]);for(let m of t)c.some(([,d])=>d===A4[m])||c.push([s,A4[m]]);let l=[],u=[];for(let[m,d]of c){let p=m?.files.find(v=>v.path===d);p&&(u.push(p.uri),l.push(`<!-- ${p.uri} -->
|