conformtools 0.6.27 → 0.6.28

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.
@@ -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 i1}from"./chunk-IN6XVTUS.js";import{f as $9,g as e1,h as t1,k as n1,l as ni,p as r1}from"./chunk-E4KQR4M3.js";import{a as ym}from"./chunk-3PVQ5QP4.js";import{a as pm,c as Qr}from"./chunk-6BL5HE4S.js";import{b as E9}from"./chunk-TNCXZIOX.js";import{a as Y9,b as bc}from"./chunk-5JIFRR7U.js";import{b as A9}from"./chunk-WRDA44QF.js";import{b as B9}from"./chunk-PGJMKUUP.js";import{b as Q9}from"./chunk-6QB4DV22.js";import{a as hc}from"./chunk-OSUIS4JU.js";import{b as Ao,c as vc,d as Qi,e as C9,g as K9}from"./chunk-JV7TZDKJ.js";import{a as gm}from"./chunk-ASFUV3PB.js";import{p as Bi,t as $r,u as bm,v as M9,w as ei}from"./chunk-RL5XRG6O.js";import{i as I9}from"./chunk-IDADYIY6.js";import{b as a1,i as o1,p as s1}from"./chunk-N34DQ6MH.js";import{a as _9,b as We,c as xm,d as ke,f as Bo}from"./chunk-NU3X7P4N.js";import{Ja as ti,ba as J9,j as hm,t as U9,u as G9}from"./chunk-7Z65WW4I.js";import{k as Eo,l as vm,m as R9,p as kn,u as Yo,v as H9,w as F9}from"./chunk-AR5BTVBM.js";import{c as _r,d as D9}from"./chunk-HNEKQMQG.js";import{a as Me,b as Z9}from"./chunk-E75BCWXY.js";import{A as Yi,B as Re,C as Se,E as Co,G as dm,I as N9,L as mm,N as Ai,O as it,P as Ko,Q as S9,R as W9,aa as K,b as Br,ba as Ke,c as P9,ca as at,d as z9,da as C,e as k9,ea as q9,j as O9,n as fm,o as Te,p as X9,q as T9,r as L9,t as pc,u as Ei,v as st,w as j9,x as br,y as lt,z as Ye}from"./chunk-ZPIY5DOU.js";import{S as V9}from"./chunk-C2ESM27Z.js";import{a as Un,c as _,d as Gn,f as RX}from"./chunk-PSANHDZM.js";var os=_((uJ,Bm)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Bm.exports={nextTick:bL}:Bm.exports=process;function bL(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 k0=_((fJ,z0)=>{var hL={}.toString;z0.exports=Array.isArray||function(e){return hL.call(e)=="[object Array]"}});var Qm=_((dJ,O0)=>{O0.exports=Un("stream")});var ss=_((_m,T0)=>{var qc=Un("buffer"),Bn=qc.Buffer;function X0(e,t){for(var n in e)t[n]=e[n]}Bn.from&&Bn.alloc&&Bn.allocUnsafe&&Bn.allocUnsafeSlow?T0.exports=qc:(X0(qc,_m),_m.Buffer=ra);function ra(e,t,n){return Bn(e,t,n)}X0(Bn,ra);ra.from=function(e,t,n){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Bn(e,t,n)};ra.alloc=function(e,t,n){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=Bn(e);return t!==void 0?typeof n=="string"?i.fill(t,n):i.fill(t):i.fill(0),i};ra.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Bn(e)};ra.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return qc.SlowBuffer(e)}});var ia=_(vt=>{function gL(e){return Array.isArray?Array.isArray(e):Zc(e)==="[object Array]"}vt.isArray=gL;function yL(e){return typeof e=="boolean"}vt.isBoolean=yL;function xL(e){return e===null}vt.isNull=xL;function wL(e){return e==null}vt.isNullOrUndefined=wL;function PL(e){return typeof e=="number"}vt.isNumber=PL;function zL(e){return typeof e=="string"}vt.isString=zL;function kL(e){return typeof e=="symbol"}vt.isSymbol=kL;function OL(e){return e===void 0}vt.isUndefined=OL;function XL(e){return Zc(e)==="[object RegExp]"}vt.isRegExp=XL;function TL(e){return typeof e=="object"&&e!==null}vt.isObject=TL;function LL(e){return Zc(e)==="[object Date]"}vt.isDate=LL;function jL(e){return Zc(e)==="[object Error]"||e instanceof Error}vt.isError=jL;function NL(e){return typeof e=="function"}vt.isFunction=NL;function SL(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}vt.isPrimitive=SL;vt.isBuffer=Un("buffer").Buffer.isBuffer;function Zc(e){return Object.prototype.toString.call(e)}});var L0=_((pJ,$m)=>{typeof Object.create=="function"?$m.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:$m.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 aa=_((vJ,tp)=>{try{if(ep=Un("util"),typeof ep.inherits!="function")throw"";tp.exports=ep.inherits}catch{tp.exports=L0()}var ep});var N0=_((bJ,np)=>{"use strict";function WL(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var j0=ss().Buffer,ls=Un("util");function qL(e,t,n){e.copy(t,n)}np.exports=(function(){function e(){WL(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 j0.alloc(0);for(var i=j0.allocUnsafe(n>>>0),r=this.head,a=0;r;)qL(r.data,i,a),a+=r.data.length,r=r.next;return i},e})();ls&&ls.inspect&&ls.inspect.custom&&(np.exports.prototype[ls.inspect.custom]=function(){var e=ls.inspect({length:this.length});return this.constructor.name+" "+e})});var rp=_((hJ,S0)=>{"use strict";var Vc=os();function ZL(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,Vc.nextTick(Rc,this,e)):Vc.nextTick(Rc,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,Vc.nextTick(Rc,n,a)):Vc.nextTick(Rc,n,a):t&&t(a)}),this)}function VL(){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 Rc(e,t){e.emit("error",t)}S0.exports={destroy:ZL,undestroy:VL}});var q0=_((gJ,W0)=>{W0.exports=Un("util").deprecate});var ap=_((yJ,I0)=>{"use strict";var oi=os();I0.exports=Be;function V0(e){var t=this;this.next=null,this.entry=null,this.finish=function(){$L(t,e)}}var RL=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:oi.nextTick,oa;Be.WritableState=us;var R0=Object.create(ia());R0.inherits=aa();var DL={deprecate:q0()},D0=Qm(),Hc=ss().Buffer,HL=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function FL(e){return Hc.from(e)}function ML(e){return Hc.isBuffer(e)||e instanceof HL}var H0=rp();R0.inherits(Be,D0);function IL(){}function us(e,t){oa=oa||si(),e=e||{};var n=t instanceof oa;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){YL(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 V0(this)}us.prototype.getBuffer=function(){for(var t=this.bufferedRequest,n=[];t;)n.push(t),t=t.next;return n};(function(){try{Object.defineProperty(us.prototype,"buffer",{get:DL.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Dc;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Dc=Function.prototype[Symbol.hasInstance],Object.defineProperty(Be,Symbol.hasInstance,{value:function(e){return Dc.call(this,e)?!0:this!==Be?!1:e&&e._writableState instanceof us}})):Dc=function(e){return e instanceof this};function Be(e){if(oa=oa||si(),!Dc.call(Be,this)&&!(this instanceof oa))return new Be(e);this._writableState=new us(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)),D0.call(this)}Be.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function UL(e,t){var n=new Error("write after end");e.emit("error",n),oi.nextTick(t,n)}function GL(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),oi.nextTick(i,a),r=!1),r}Be.prototype.write=function(e,t,n){var i=this._writableState,r=!1,a=!i.objectMode&&ML(e);return a&&!Hc.isBuffer(e)&&(e=FL(e)),typeof t=="function"&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),typeof n!="function"&&(n=IL),i.ended?UL(this,n):(a||GL(this,i,e,n))&&(i.pendingcb++,r=CL(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&&F0(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 JL(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=Hc.from(t,n)),t}Object.defineProperty(Be.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function CL(e,t,n,i,r,a){if(!n){var o=JL(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 ip(e,t,!1,s,i,r,a);return c}function ip(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 KL(e,t,n,i,r){--t.pendingcb,n?(oi.nextTick(r,i),oi.nextTick(cs,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(r(i),e._writableState.errorEmitted=!0,e.emit("error",i),cs(e,t))}function EL(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function YL(e,t){var n=e._writableState,i=n.sync,r=n.writecb;if(EL(n),t)KL(e,n,i,t,r);else{var a=M0(n);!a&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&F0(e,n),i?RL(Z0,e,n,a,r):Z0(e,n,a,r)}}function Z0(e,t,n,i){n||AL(e,t),t.pendingcb--,i(),cs(e,t)}function AL(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function F0(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,ip(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 V0(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,u=n.callback,f=t.objectMode?1:c.length;if(ip(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||_L(this,i,n)};function M0(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function BL(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),cs(e,t)})}function QL(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,oi.nextTick(BL,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function cs(e,t){var n=M0(t);return n&&(QL(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),n}function _L(e,t,n){t.ending=!0,cs(e,t),n&&(t.finished?oi.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}function $L(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=H0.destroy;Be.prototype._undestroy=H0.undestroy;Be.prototype._destroy=function(e,t){this.end(),t(e)}});var si=_((xJ,C0)=>{"use strict";var U0=os(),ej=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};C0.exports=Qn;var G0=Object.create(ia());G0.inherits=aa();var J0=lp(),sp=ap();G0.inherits(Qn,J0);for(op=ej(sp.prototype),Fc=0;Fc<op.length;Fc++)Mc=op[Fc],Qn.prototype[Mc]||(Qn.prototype[Mc]=sp.prototype[Mc]);var op,Mc,Fc;function Qn(e){if(!(this instanceof Qn))return new Qn(e);J0.call(this,e),sp.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",tj)}Object.defineProperty(Qn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function tj(){this.allowHalfOpen||this._writableState.ended||U0.nextTick(nj,this)}function nj(e){e.end()}Object.defineProperty(Qn.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)}});Qn.prototype._destroy=function(e,t){this.push(null),this.end(),U0.nextTick(t,e)}});var fp=_(E0=>{"use strict";var up=ss().Buffer,K0=up.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 rj(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 ij(e){var t=rj(e);if(typeof t!="string"&&(up.isEncoding===K0||!K0(e)))throw new Error("Unknown encoding: "+e);return t||e}E0.StringDecoder=fs;function fs(e){this.encoding=ij(e);var t;switch(this.encoding){case"utf16le":this.text=uj,this.end=fj,t=4;break;case"utf8":this.fillLast=sj,t=4;break;case"base64":this.text=dj,this.end=mj,t=3;break;default:this.write=pj,this.end=vj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=up.allocUnsafe(t)}fs.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||""};fs.prototype.end=cj;fs.prototype.text=lj;fs.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 cp(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function aj(e,t,n){var i=t.length-1;if(i<n)return 0;var r=cp(t[i]);return r>=0?(r>0&&(e.lastNeed=r-1),r):--i<n||r===-2?0:(r=cp(t[i]),r>=0?(r>0&&(e.lastNeed=r-2),r):--i<n||r===-2?0:(r=cp(t[i]),r>=0?(r>0&&(r===2?r=0:e.lastNeed=r-3),r):0))}function oj(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 sj(e){var t=this.lastTotal-this.lastNeed,n=oj(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 lj(e,t){var n=aj(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 cj(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function uj(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 fj(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 dj(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 mj(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function pj(e){return e.toString(this.encoding)}function vj(e){return e&&e.length?this.write(e):""}});var lp=_((zJ,a3)=>{"use strict";var la=os();a3.exports=Fe;var bj=k0(),ds;Fe.ReadableState=e3;var PJ=Un("events").EventEmitter,Q0=function(e,t){return e.listeners(t).length},bp=Qm(),ms=ss().Buffer,hj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function gj(e){return ms.from(e)}function yj(e){return ms.isBuffer(e)||e instanceof hj}var _0=Object.create(ia());_0.inherits=aa();var dp=Un("util"),Xe=void 0;dp&&dp.debuglog?Xe=dp.debuglog("stream"):Xe=function(){};var xj=N0(),$0=rp(),sa;_0.inherits(Fe,bp);var mp=["error","close","destroy","pause","resume"];function wj(e,t,n){if(typeof e.prependListener=="function")return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):bj(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}function e3(e,t){ds=ds||si(),e=e||{};var n=t instanceof ds;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 xj,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&&(sa||(sa=fp().StringDecoder),this.decoder=new sa(e.encoding),this.encoding=e.encoding)}function Fe(e){if(ds=ds||si(),!(this instanceof Fe))return new Fe(e);this._readableState=new e3(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),bp.call(this)}Object.defineProperty(Fe.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Fe.prototype.destroy=$0.destroy;Fe.prototype._undestroy=$0.undestroy;Fe.prototype._destroy=function(e,t){this.push(null),t(e)};Fe.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=ms.from(e,t),t=""),i=!0),t3(this,e,t,!1,i)};Fe.prototype.unshift=function(e){return t3(this,e,null,!0,!1)};function t3(e,t,n,i,r){var a=e._readableState;if(t===null)a.reading=!1,Oj(e,a);else{var o;r||(o=Pj(a,t)),o?e.emit("error",o):a.objectMode||t&&t.length>0?(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==ms.prototype&&(t=gj(t)),i?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):pp(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?pp(e,a,t,!1):n3(e,a)):pp(e,a,t,!1))):i||(a.reading=!1)}return zj(a)}function pp(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&&Ic(e)),n3(e,t)}function Pj(e,t){var n;return!yj(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(n=new TypeError("Invalid non-string/buffer chunk")),n}function zj(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}Fe.prototype.isPaused=function(){return this._readableState.flowing===!1};Fe.prototype.setEncoding=function(e){return sa||(sa=fp().StringDecoder),this._readableState.decoder=new sa(e),this._readableState.encoding=e,this};var Y0=8388608;function kj(e){return e>=Y0?e=Y0:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function A0(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=kj(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}Fe.prototype.read=function(e){Xe("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 Xe("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?vp(this):Ic(this),null;if(e=A0(e,t),e===0&&t.ended)return t.length===0&&vp(this),null;var i=t.needReadable;Xe("need readable",i),(t.length===0||t.length-e<t.highWaterMark)&&(i=!0,Xe("length less than watermark",i)),t.ended||t.reading?(i=!1,Xe("reading or ended",i)):i&&(Xe("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=A0(n,t)));var r;return e>0?r=r3(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&&vp(this)),r!==null&&this.emit("data",r),r};function Oj(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,Ic(e)}}function Ic(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Xe("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?la.nextTick(B0,e):B0(e))}function B0(e){Xe("emit readable"),e.emit("readable"),hp(e)}function n3(e,t){t.readingMore||(t.readingMore=!0,la.nextTick(Xj,e,t))}function Xj(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(Xe("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}Fe.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};Fe.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,Xe("pipe count=%d opts=%j",i.pipesCount,t);var r=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,a=r?s:b;i.endEmitted?la.nextTick(a):n.once("end",a),e.on("unpipe",o);function o(h,g){Xe("onunpipe"),h===n&&g&&g.hasUnpiped===!1&&(g.hasUnpiped=!0,u())}function s(){Xe("onend"),e.end()}var c=Tj(n);e.on("drain",c);var l=!1;function u(){Xe("cleanup"),e.removeListener("close",p),e.removeListener("finish",v),e.removeListener("drain",c),e.removeListener("error",m),e.removeListener("unpipe",o),n.removeListener("end",s),n.removeListener("end",b),n.removeListener("data",d),l=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c()}var f=!1;n.on("data",d);function d(h){Xe("ondata"),f=!1;var g=e.write(h);g===!1&&!f&&((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&i3(i.pipes,e)!==-1)&&!l&&(Xe("false write response, pause",i.awaitDrain),i.awaitDrain++,f=!0),n.pause())}function m(h){Xe("onerror",h),b(),e.removeListener("error",m),Q0(e,"error")===0&&e.emit("error",h)}wj(e,"error",m);function p(){e.removeListener("finish",v),b()}e.once("close",p);function v(){Xe("onfinish"),e.removeListener("close",p),b()}e.once("finish",v);function b(){Xe("unpipe"),n.unpipe(e)}return e.emit("pipe",n),i.flowing||(Xe("pipe resume"),n.resume()),e};function Tj(e){return function(){var t=e._readableState;Xe("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&Q0(e,"data")&&(t.flowing=!0,hp(e))}}Fe.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=i3(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)};Fe.prototype.on=function(e,t){var n=bp.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&&Ic(this):la.nextTick(Lj,this))}return n};Fe.prototype.addListener=Fe.prototype.on;function Lj(e){Xe("readable nexttick read 0"),e.read(0)}Fe.prototype.resume=function(){var e=this._readableState;return e.flowing||(Xe("resume"),e.flowing=!0,jj(this,e)),this};function jj(e,t){t.resumeScheduled||(t.resumeScheduled=!0,la.nextTick(Nj,e,t))}function Nj(e,t){t.reading||(Xe("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),hp(e),t.flowing&&!t.reading&&e.read(0)}Fe.prototype.pause=function(){return Xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function hp(e){var t=e._readableState;for(Xe("flow",t.flowing);t.flowing&&e.read()!==null;);}Fe.prototype.wrap=function(e){var t=this,n=this._readableState,i=!1;e.on("end",function(){if(Xe("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(Xe("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<mp.length;a++)e.on(mp[a],this.emit.bind(this,mp[a]));return this._read=function(o){Xe("wrapped _read",o),i&&(i=!1,e.resume())},this};Object.defineProperty(Fe.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Fe._fromList=r3;function r3(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=Sj(e,t.buffer,t.decoder),n}function Sj(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?Wj(e,t):qj(e,t),i}function Wj(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 qj(e,t){var n=ms.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 vp(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,la.nextTick(Zj,t,e))}function Zj(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function i3(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}});var gp=_((kJ,l3)=>{"use strict";l3.exports=_n;var Uc=si(),s3=Object.create(ia());s3.inherits=aa();s3.inherits(_n,Uc);function Vj(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 _n(e){if(!(this instanceof _n))return new _n(e);Uc.call(this,e),this._transformState={afterTransform:Vj.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",Rj)}function Rj(){var e=this;typeof this._flush=="function"?this._flush(function(t,n){o3(e,t,n)}):o3(this,null,null)}_n.prototype.push=function(e,t){return this._transformState.needTransform=!1,Uc.prototype.push.call(this,e,t)};_n.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")};_n.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)}};_n.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};_n.prototype._destroy=function(e,t){var n=this;Uc.prototype._destroy.call(this,e,function(i){t(i),n.emit("close")})};function o3(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 d3=_((OJ,f3)=>{"use strict";f3.exports=ps;var c3=gp(),u3=Object.create(ia());u3.inherits=aa();u3.inherits(ps,c3);function ps(e){if(!(this instanceof ps))return new ps(e);c3.call(this,e)}ps.prototype._transform=function(e,t,n){n(null,e)}});var yp=_((ct,Gc)=>{var On=Un("stream");process.env.READABLE_STREAM==="disable"&&On?(Gc.exports=On,ct=Gc.exports=On.Readable,ct.Readable=On.Readable,ct.Writable=On.Writable,ct.Duplex=On.Duplex,ct.Transform=On.Transform,ct.PassThrough=On.PassThrough,ct.Stream=On):(ct=Gc.exports=lp(),ct.Stream=On||ct,ct.Readable=ct,ct.Writable=ap(),ct.Duplex=si(),ct.Transform=gp(),ct.PassThrough=d3())});var $n=_(Mt=>{"use strict";Mt.base64=!0;Mt.array=!0;Mt.string=!0;Mt.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";Mt.nodebuffer=typeof Buffer<"u";Mt.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")Mt.blob=!1;else{xp=new ArrayBuffer(0);try{Mt.blob=new Blob([xp],{type:"application/zip"}).size===0}catch{try{m3=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,wp=new m3,wp.append(xp),Mt.blob=wp.getBlob("application/zip").size===0}catch{Mt.blob=!1}}}var xp,m3,wp;try{Mt.nodestream=!!yp().Readable}catch{Mt.nodestream=!1}});var zp=_(Pp=>{"use strict";var Dj=Ce(),Hj=$n(),Xn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";Pp.encode=function(e){for(var t=[],n,i,r,a,o,s,c,l=0,u=e.length,f=u,d=Dj.getTypeOf(e)!=="string";l<e.length;)f=u-l,d?(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(Xn.charAt(a)+Xn.charAt(o)+Xn.charAt(s)+Xn.charAt(c));return t.join("")};Pp.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)===Xn.charAt(64)&&f--,e.charAt(e.length-2)===Xn.charAt(64)&&f--,f%1!==0)throw new Error("Invalid base64 input, bad content length.");var d;for(Hj.uint8array?d=new Uint8Array(f|0):d=new Array(f|0);c<e.length;)r=Xn.indexOf(e.charAt(c++)),a=Xn.indexOf(e.charAt(c++)),o=Xn.indexOf(e.charAt(c++)),s=Xn.indexOf(e.charAt(c++)),t=r<<2|a>>4,n=(a&15)<<4|o>>2,i=(o&3)<<6|s,d[l++]=t,o!==64&&(d[l++]=n),s!==64&&(d[l++]=i);return d}});var vs=_((LJ,p3)=>{"use strict";p3.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 g3=_((jJ,h3)=>{"use strict";var v3=global.MutationObserver||global.WebKitMutationObserver,ca;process.browser?v3?(kp=0,b3=new v3(bs),Op=global.document.createTextNode(""),b3.observe(Op,{characterData:!0}),ca=function(){Op.data=kp=++kp%2}):!global.setImmediate&&typeof global.MessageChannel<"u"?(Xp=new global.MessageChannel,Xp.port1.onmessage=bs,ca=function(){Xp.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?ca=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){bs(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:ca=function(){setTimeout(bs,0)}:ca=function(){process.nextTick(bs)};var kp,b3,Op,Xp,Tp,hs=[];function bs(){Tp=!0;for(var e,t,n=hs.length;n;){for(t=hs,hs=[],e=-1;++e<n;)t[e]();n=hs.length}Tp=!1}h3.exports=Fj;function Fj(e){hs.push(e)===1&&!Tp&&ca()}});var O3=_((NJ,k3)=>{"use strict";var y3=g3();function ua(){}var bt={},x3=["REJECTED"],Lp=["FULFILLED"],w3=["PENDING"];process.browser||(gs=["UNHANDLED"]);var gs;k3.exports=gr;function gr(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=w3,this.queue=[],this.outcome=void 0,process.browser||(this.handled=gs),e!==ua&&P3(this,e)}gr.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)}};gr.prototype.catch=function(e){return this.then(null,e)};gr.prototype.then=function(e,t){if(typeof e!="function"&&this.state===Lp||typeof t!="function"&&this.state===x3)return this;var n=new this.constructor(ua);if(process.browser||this.handled===gs&&(this.handled=null),this.state!==w3){var i=this.state===Lp?e:t;jp(n,i,this.outcome)}else this.queue.push(new ys(n,e,t));return n};function ys(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)}ys.prototype.callFulfilled=function(e){bt.resolve(this.promise,e)};ys.prototype.otherCallFulfilled=function(e){jp(this.promise,this.onFulfilled,e)};ys.prototype.callRejected=function(e){bt.reject(this.promise,e)};ys.prototype.otherCallRejected=function(e){jp(this.promise,this.onRejected,e)};function jp(e,t,n){y3(function(){var i;try{i=t(n)}catch(r){return bt.reject(e,r)}i===e?bt.reject(e,new TypeError("Cannot resolve promise with itself")):bt.resolve(e,i)})}bt.resolve=function(e,t){var n=z3(Mj,t);if(n.status==="error")return bt.reject(e,n.value);var i=n.value;if(i)P3(e,i);else{e.state=Lp,e.outcome=t;for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callFulfilled(t)}return e};bt.reject=function(e,t){e.state=x3,e.outcome=t,process.browser||e.handled===gs&&y3(function(){e.handled===gs&&process.emit("unhandledRejection",t,e)});for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e};function Mj(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function P3(e,t){var n=!1;function i(s){n||(n=!0,bt.reject(e,s))}function r(s){n||(n=!0,bt.resolve(e,s))}function a(){t(r,i)}var o=z3(a);o.status==="error"&&i(o.value)}function z3(e,t){var n={};try{n.value=e(t),n.status="success"}catch(i){n.status="error",n.value=i}return n}gr.resolve=Ij;function Ij(e){return e instanceof this?e:bt.resolve(new this(ua),e)}gr.reject=Uj;function Uj(e){var t=new this(ua);return bt.reject(t,e)}gr.all=Gj;function Gj(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(ua);++o<n;)c(e[o],o);return s;function c(l,u){t.resolve(l).then(f,function(d){i||(i=!0,bt.reject(s,d))});function f(d){r[u]=d,++a===n&&!i&&(i=!0,bt.resolve(s,r))}}}gr.race=Jj;function Jj(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(ua);++r<n;)o(e[r]);return a;function o(s){t.resolve(s).then(function(c){i||(i=!0,bt.resolve(a,c))},function(c){i||(i=!0,bt.reject(a,c))})}}});var fa=_((SJ,X3)=>{"use strict";var Np=null;typeof Promise<"u"?Np=Promise:Np=O3();X3.exports={Promise:Np}});var L3=_(T3=>{(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 P={callback:g,args:y};return i[n]=P,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 d(){if(e.postMessage&&!e.importScripts){var g=!0,y=e.onmessage;return e.onmessage=function(){g=!1},e.postMessage("","*"),e.onmessage=y,g}}function m(){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 b(){o=function(g){setTimeout(u,0,g)}}var h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,{}.toString.call(e.process)==="[object process]"?f():d()?m():e.MessageChannel?p():a&&"onreadystatechange"in a.createElement("script")?v():b(),h.setImmediate=s,h.clearImmediate=c})(typeof self>"u"?typeof global>"u"?T3:global:self)});var Ce=_(Qe=>{"use strict";var yr=$n(),Cj=zp(),da=vs(),Sp=fa();L3();function Kj(e){var t=null;return yr.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),Cc(e,t)}Qe.newBlob=function(e,t){Qe.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 xs(e){return e}function Cc(e,t){for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)&255;return t}var Jc={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 yr.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return yr.nodebuffer&&String.fromCharCode.apply(null,da.allocBuffer(1)).length===1}catch{return!1}})()}};function ws(e){var t=65536,n=Qe.getTypeOf(e),i=!0;if(n==="uint8array"?i=Jc.applyCanBeUsed.uint8array:n==="nodebuffer"&&(i=Jc.applyCanBeUsed.nodebuffer),i)for(;t>1;)try{return Jc.stringifyByChunk(e,n,t)}catch{t=Math.floor(t/2)}return Jc.stringifyByChar(e)}Qe.applyFromCharCode=ws;function Kc(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}var xr={};xr.string={string:xs,array:function(e){return Cc(e,new Array(e.length))},arraybuffer:function(e){return xr.string.uint8array(e).buffer},uint8array:function(e){return Cc(e,new Uint8Array(e.length))},nodebuffer:function(e){return Cc(e,da.allocBuffer(e.length))}};xr.array={string:ws,array:xs,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return da.newBufferFrom(e)}};xr.arraybuffer={string:function(e){return ws(new Uint8Array(e))},array:function(e){return Kc(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:xs,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return da.newBufferFrom(new Uint8Array(e))}};xr.uint8array={string:ws,array:function(e){return Kc(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:xs,nodebuffer:function(e){return da.newBufferFrom(e)}};xr.nodebuffer={string:ws,array:function(e){return Kc(e,new Array(e.length))},arraybuffer:function(e){return xr.nodebuffer.uint8array(e).buffer},uint8array:function(e){return Kc(e,new Uint8Array(e.length))},nodebuffer:xs};Qe.transformTo=function(e,t){if(t||(t=""),!e)return t;Qe.checkSupport(e);var n=Qe.getTypeOf(t),i=xr[n][e](t);return i};Qe.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("/")};Qe.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(yr.nodebuffer&&da.isBuffer(e))return"nodebuffer";if(yr.uint8array&&e instanceof Uint8Array)return"uint8array";if(yr.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};Qe.checkSupport=function(e){var t=yr[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};Qe.MAX_VALUE_16BITS=65535;Qe.MAX_VALUE_32BITS=-1;Qe.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};Qe.delay=function(e,t,n){setImmediate(function(){e.apply(n||null,t||[])})};Qe.inherits=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n};Qe.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};Qe.prepareContent=function(e,t,n,i,r){var a=Sp.Promise.resolve(t).then(function(o){var s=yr.blob&&(o instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(o))!==-1);return s&&typeof FileReader<"u"?new Sp.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=Qe.getTypeOf(o);return s?(s==="arraybuffer"?o=Qe.transformTo("uint8array",o):s==="string"&&(r?o=Cj.decode(o):n&&i!==!0&&(o=Kj(o))),o):Sp.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var It=_((ZJ,N3)=>{"use strict";function j3(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}j3.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}};N3.exports=j3});var pa=_(wr=>{"use strict";var ma=Ce(),li=$n(),Ej=vs(),Ec=It(),Ps=new Array(256);for(er=0;er<256;er++)Ps[er]=er>=252?6:er>=248?5:er>=240?4:er>=224?3:er>=192?2:1;var er;Ps[254]=Ps[254]=1;var Yj=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(li.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},Aj=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+Ps[e[n]]>t?n:t},Bj=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=Ps[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),ma.applyFromCharCode(o)};wr.utf8encode=function(t){return li.nodebuffer?Ej.newBufferFrom(t,"utf-8"):Yj(t)};wr.utf8decode=function(t){return li.nodebuffer?ma.transformTo("nodebuffer",t).toString("utf-8"):(t=ma.transformTo(li.uint8array?"uint8array":"array",t),Bj(t))};function Yc(){Ec.call(this,"utf-8 decode"),this.leftOver=null}ma.inherits(Yc,Ec);Yc.prototype.processChunk=function(e){var t=ma.transformTo(li.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(li.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=Aj(t),r=t;i!==t.length&&(li.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:wr.utf8decode(r),meta:e.meta})};Yc.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:wr.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};wr.Utf8DecodeWorker=Yc;function Wp(){Ec.call(this,"utf-8 encode")}ma.inherits(Wp,Ec);Wp.prototype.processChunk=function(e){this.push({data:wr.utf8encode(e.data),meta:e.meta})};wr.Utf8EncodeWorker=Wp});var Z3=_((RJ,q3)=>{"use strict";var S3=It(),W3=Ce();function qp(e){S3.call(this,"ConvertWorker to "+e),this.destType=e}W3.inherits(qp,S3);qp.prototype.processChunk=function(e){this.push({data:W3.transformTo(this.destType,e.data),meta:e.meta})};q3.exports=qp});var D3=_((DJ,R3)=>{"use strict";var V3=yp().Readable,Qj=Ce();Qj.inherits(Zp,V3);function Zp(e,t,n){V3.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)})}Zp.prototype._read=function(){this._helper.resume()};R3.exports=Zp});var Vp=_((HJ,M3)=>{"use strict";var ci=Ce(),_j=Z3(),$j=It(),eN=zp(),tN=$n(),nN=fa(),H3=null;if(tN.nodestream)try{H3=D3()}catch{}function rN(e,t,n){switch(e){case"blob":return ci.newBlob(ci.transformTo("arraybuffer",t),n);case"base64":return eN.encode(t);default:return ci.transformTo(e,t)}}function iN(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 aN(e,t){return new nN.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=rN(o,iN(a,r),s);n(c)}catch(l){i(l)}r=[]}).resume()})}function F3(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,ci.checkSupport(i),this._worker=e.pipe(new _j(i)),e.lock()}catch(r){this._worker=new $j("error"),this._worker.error(r)}}F3.prototype={accumulate:function(e){return aN(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(){ci.delay(t,arguments,n)}),this},resume:function(){return ci.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(ci.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new H3(this,{objectMode:this._outputType!=="nodebuffer"},e)}};M3.exports=F3});var Rp=_(ln=>{"use strict";ln.base64=!1;ln.binary=!1;ln.dir=!1;ln.createFolders=!0;ln.date=null;ln.compression=null;ln.compressionOptions=null;ln.comment=null;ln.unixPermissions=null;ln.dosPermissions=null});var Dp=_((MJ,I3)=>{"use strict";var Ac=Ce(),Bc=It(),oN=16*1024;function va(e){Bc.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=Ac.getTypeOf(n),t.isPaused||t._tickAndRepeat()},function(n){t.error(n)})}Ac.inherits(va,Bc);va.prototype.cleanUp=function(){Bc.prototype.cleanUp.call(this),this.data=null};va.prototype.resume=function(){return Bc.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,Ac.delay(this._tickAndRepeat,[],this)),!0):!1};va.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(Ac.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};va.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=oN,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}})};I3.exports=va});var Qc=_((IJ,G3)=>{"use strict";var sN=Ce();function lN(){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 U3=lN();function cN(e,t,n,i){var r=U3,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 uN(e,t,n,i){var r=U3,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}G3.exports=function(t,n){if(typeof t>"u"||!t.length)return 0;var i=sN.getTypeOf(t)!=="string";return i?cN(n|0,t,t.length,0):uN(n|0,t,t.length,0)}});var Fp=_((UJ,C3)=>{"use strict";var J3=It(),fN=Qc(),dN=Ce();function Hp(){J3.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}dN.inherits(Hp,J3);Hp.prototype.processChunk=function(e){this.streamInfo.crc32=fN(e.data,this.streamInfo.crc32||0),this.push(e)};C3.exports=Hp});var E3=_((GJ,K3)=>{"use strict";var mN=Ce(),Mp=It();function Ip(e){Mp.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}mN.inherits(Ip,Mp);Ip.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}Mp.prototype.processChunk.call(this,e)};K3.exports=Ip});var _c=_((JJ,B3)=>{"use strict";var Y3=fa(),A3=Dp(),pN=Fp(),Up=E3();function Gp(e,t,n,i,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=i,this.compressedContent=r}Gp.prototype={getContentWorker:function(){var e=new A3(Y3.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Up("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 A3(Y3.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};Gp.createWorkerFrom=function(e,t,n){return e.pipe(new pN).pipe(new Up("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new Up("compressedSize")).withStreamInfo("compression",t)};B3.exports=Gp});var eP=_((CJ,$3)=>{"use strict";var vN=Vp(),bN=Dp(),Jp=pa(),Cp=_c(),Q3=It(),Kp=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}};Kp.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 Jp.Utf8EncodeWorker)),!r&&i&&(t=t.pipe(new Jp.Utf8DecodeWorker))}catch(a){t=new Q3("error"),t.error(a)}return new vN(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 Cp&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new Jp.Utf8EncodeWorker)),Cp.createWorkerFrom(n,e,t)},_decompressWorker:function(){return this._data instanceof Cp?this._data.getContentWorker():this._data instanceof Q3?this._data:new bN(this._data)}};var _3=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],hN=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for($c=0;$c<_3.length;$c++)Kp.prototype[_3[$c]]=hN;var $c;$3.exports=Kp});var tr=_(yt=>{"use strict";var gN=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function yN(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)yN(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 xN={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}},wN={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,xN)):(yt.Buf8=Array,yt.Buf16=Array,yt.Buf32=Array,yt.assign(yt,wN))};yt.setTyped(gN)});var zP=_(ga=>{"use strict";var PN=tr(),zN=4,tP=0,nP=1,kN=2;function ha(e){for(var t=e.length;--t>=0;)e[t]=0}var ON=0,lP=1,XN=2,TN=3,LN=258,$p=29,Ls=256,ks=Ls+1+$p,ba=30,ev=19,cP=2*ks+1,ui=15,Ep=16,jN=7,tv=256,uP=16,fP=17,dP=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],eu=[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],NN=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],mP=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],SN=512,nr=new Array((ks+2)*2);ha(nr);var zs=new Array(ba*2);ha(zs);var Os=new Array(SN);ha(Os);var Xs=new Array(LN-TN+1);ha(Xs);var nv=new Array($p);ha(nv);var tu=new Array(ba);ha(tu);function Yp(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 pP,vP,bP;function Ap(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function hP(e){return e<256?Os[e]:Os[256+(e>>>7)]}function Ts(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function St(e,t,n){e.bi_valid>Ep-n?(e.bi_buf|=t<<e.bi_valid&65535,Ts(e,e.bi_buf),e.bi_buf=t>>Ep-e.bi_valid,e.bi_valid+=n-Ep):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function Tn(e,t,n){St(e,n[t*2],n[t*2+1])}function gP(e,t){var n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1}function WN(e){e.bi_valid===16?(Ts(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 qN(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,d,m,p,v=0;for(d=0;d<=ui;d++)e.bl_count[d]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<cP;l++)u=e.heap[l],d=n[n[u*2+1]*2+1]+1,d>c&&(d=c,v++),n[u*2+1]=d,!(u>i)&&(e.bl_count[d]++,m=0,u>=s&&(m=o[u-s]),p=n[u*2],e.opt_len+=p*(d+m),a&&(e.static_len+=p*(r[u*2+1]+m)));if(v!==0){do{for(d=c-1;e.bl_count[d]===0;)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[c]--,v-=2}while(v>0);for(d=c;d!==0;d--)for(u=e.bl_count[d];u!==0;)f=e.heap[--l],!(f>i)&&(n[f*2+1]!==d&&(e.opt_len+=(d-n[f*2+1])*n[f*2],n[f*2+1]=d),u--)}}function yP(e,t,n){var i=new Array(ui+1),r=0,a,o;for(a=1;a<=ui;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]=gP(i[s]++,s))}}function ZN(){var e,t,n,i,r,a=new Array(ui+1);for(n=0,i=0;i<$p-1;i++)for(nv[i]=n,e=0;e<1<<Qp[i];e++)Xs[n++]=i;for(Xs[n-1]=i,r=0,i=0;i<16;i++)for(tu[i]=r,e=0;e<1<<eu[i];e++)Os[r++]=i;for(r>>=7;i<ba;i++)for(tu[i]=r<<7,e=0;e<1<<eu[i]-7;e++)Os[256+r++]=i;for(t=0;t<=ui;t++)a[t]=0;for(e=0;e<=143;)nr[e*2+1]=8,e++,a[8]++;for(;e<=255;)nr[e*2+1]=9,e++,a[9]++;for(;e<=279;)nr[e*2+1]=7,e++,a[7]++;for(;e<=287;)nr[e*2+1]=8,e++,a[8]++;for(yP(nr,ks+1,a),e=0;e<ba;e++)zs[e*2+1]=5,zs[e*2]=gP(e,5);pP=new Yp(nr,Qp,Ls+1,ks,ui),vP=new Yp(zs,eu,0,ba,ui),bP=new Yp(new Array(0),NN,0,ev,jN)}function xP(e){var t;for(t=0;t<ks;t++)e.dyn_ltree[t*2]=0;for(t=0;t<ba;t++)e.dyn_dtree[t*2]=0;for(t=0;t<ev;t++)e.bl_tree[t*2]=0;e.dyn_ltree[tv*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function wP(e){e.bi_valid>8?Ts(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 VN(e,t,n,i){wP(e),i&&(Ts(e,n),Ts(e,~n)),PN.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}function rP(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 Bp(e,t,n){for(var i=e.heap[n],r=n<<1;r<=e.heap_len&&(r<e.heap_len&&rP(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!rP(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i}function iP(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=Xs[r],Tn(e,o+Ls+1,t),s=Qp[o],s!==0&&(r-=nv[o],St(e,r,s)),i--,o=hP(i),Tn(e,o,n),s=eu[o],s!==0&&(i-=tu[o],St(e,i,s)));while(a<e.last_lit);Tn(e,tv,t)}function _p(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=cP,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--)Bp(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Bp(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++,Bp(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],qN(e,t),yP(n,c,e.bl_count)}function aP(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[uP*2]++):s<=10?e.bl_tree[fP*2]++:e.bl_tree[dP*2]++,s=0,r=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))}function oP(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,uP,e.bl_tree),St(e,s-3,2)):s<=10?(Tn(e,fP,e.bl_tree),St(e,s-3,3)):(Tn(e,dP,e.bl_tree),St(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 RN(e){var t;for(aP(e,e.dyn_ltree,e.l_desc.max_code),aP(e,e.dyn_dtree,e.d_desc.max_code),_p(e,e.bl_desc),t=ev-1;t>=3&&e.bl_tree[mP[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function DN(e,t,n,i){var r;for(St(e,t-257,5),St(e,n-1,5),St(e,i-4,4),r=0;r<i;r++)St(e,e.bl_tree[mP[r]*2+1],3);oP(e,e.dyn_ltree,t-1),oP(e,e.dyn_dtree,n-1)}function HN(e){var t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return tP;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return nP;for(n=32;n<Ls;n++)if(e.dyn_ltree[n*2]!==0)return nP;return tP}var sP=!1;function FN(e){sP||(ZN(),sP=!0),e.l_desc=new Ap(e.dyn_ltree,pP),e.d_desc=new Ap(e.dyn_dtree,vP),e.bl_desc=new Ap(e.bl_tree,bP),e.bi_buf=0,e.bi_valid=0,xP(e)}function PP(e,t,n,i){St(e,(ON<<1)+(i?1:0),3),VN(e,t,n,!0)}function MN(e){St(e,lP<<1,3),Tn(e,tv,nr),WN(e)}function IN(e,t,n,i){var r,a,o=0;e.level>0?(e.strm.data_type===kN&&(e.strm.data_type=HN(e)),_p(e,e.l_desc),_p(e,e.d_desc),o=RN(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?PP(e,t,n,i):e.strategy===zN||a===r?(St(e,(lP<<1)+(i?1:0),3),iP(e,nr,zs)):(St(e,(XN<<1)+(i?1:0),3),DN(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),iP(e,e.dyn_ltree,e.dyn_dtree)),xP(e),i&&wP(e)}function UN(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[(Xs[n]+Ls+1)*2]++,e.dyn_dtree[hP(t)*2]++),e.last_lit===e.lit_bufsize-1}ga._tr_init=FN;ga._tr_stored_block=PP;ga._tr_flush_block=IN;ga._tr_tally=UN;ga._tr_align=MN});var rv=_((YJ,kP)=>{"use strict";function GN(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}kP.exports=GN});var iv=_((AJ,OP)=>{"use strict";function JN(){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 CN=JN();function KN(e,t,n,i){var r=CN,a=i+n;e^=-1;for(var o=i;o<a;o++)e=e>>>8^r[(e^t[o])&255];return e^-1}OP.exports=KN});var nu=_((BJ,XP)=>{"use strict";XP.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 VP=_(Nn=>{"use strict";var xt=tr(),Et=zP(),NP=rv(),Pr=iv(),EN=nu(),pi=0,YN=1,AN=3,Tr=4,TP=5,jn=0,LP=1,Yt=-2,BN=-3,av=-5,QN=-1,_N=1,ru=2,$N=3,eS=4,tS=0,nS=2,su=8,rS=9,iS=15,aS=8,oS=29,sS=256,sv=sS+1+oS,lS=30,cS=19,uS=2*sv+1,fS=15,xe=3,Or=258,cn=Or+xe+1,dS=32,lu=42,lv=69,iu=73,au=91,ou=103,fi=113,Ns=666,et=1,Ss=2,di=3,wa=4,mS=3;function Xr(e,t){return e.msg=EN[t],t}function jP(e){return(e<<1)-(e>4?9:0)}function kr(e){for(var t=e.length;--t>=0;)e[t]=0}function zr(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 ut(e,t){Et._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,zr(e.strm)}function Oe(e,t){e.pending_buf[e.pending++]=t}function js(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function pS(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=NP(e.adler,t,r,n):e.state.wrap===2&&(e.adler=Pr(e.adler,t,r,n)),e.next_in+=r,e.total_in+=r,r)}function SP(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-cn?e.strstart-(e.w_size-cn):0,l=e.window,u=e.w_mask,f=e.prev,d=e.strstart+Or,m=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]!==m||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<d);if(a=Or-(d-i),i=d-Or,a>o){if(e.match_start=t,o=a,a>=s)break;m=l[i+o-1],p=l[i+o]}}while((t=f[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead}function mi(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-cn)){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=pS(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<cn&&e.strm.avail_in!==0)}function vS(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(mi(e),e.lookahead===0&&t===pi)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,ut(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-cn&&(ut(e,!1),e.strm.avail_out===0))return et}return e.insert=0,t===Tr?(ut(e,!0),e.strm.avail_out===0?di:wa):(e.strstart>e.block_start&&(ut(e,!1),e.strm.avail_out===0),et)}function ov(e,t){for(var n,i;;){if(e.lookahead<cn){if(mi(e),e.lookahead<cn&&t===pi)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-cn&&(e.match_length=SP(e,n)),e.match_length>=xe)if(i=Et._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=Et._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(ut(e,!1),e.strm.avail_out===0))return et}return e.insert=e.strstart<xe-1?e.strstart:xe-1,t===Tr?(ut(e,!0),e.strm.avail_out===0?di:wa):e.last_lit&&(ut(e,!1),e.strm.avail_out===0)?et:Ss}function ya(e,t){for(var n,i,r;;){if(e.lookahead<cn){if(mi(e),e.lookahead<cn&&t===pi)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-cn&&(e.match_length=SP(e,n),e.match_length<=5&&(e.strategy===_N||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=Et._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&&(ut(e,!1),e.strm.avail_out===0))return et}else if(e.match_available){if(i=Et._tr_tally(e,0,e.window[e.strstart-1]),i&&ut(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=Et._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<xe-1?e.strstart:xe-1,t===Tr?(ut(e,!0),e.strm.avail_out===0?di:wa):e.last_lit&&(ut(e,!1),e.strm.avail_out===0)?et:Ss}function bS(e,t){for(var n,i,r,a,o=e.window;;){if(e.lookahead<=Or){if(mi(e),e.lookahead<=Or&&t===pi)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+Or;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=Or-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=xe?(n=Et._tr_tally(e,1,e.match_length-xe),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Et._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(ut(e,!1),e.strm.avail_out===0))return et}return e.insert=0,t===Tr?(ut(e,!0),e.strm.avail_out===0?di:wa):e.last_lit&&(ut(e,!1),e.strm.avail_out===0)?et:Ss}function hS(e,t){for(var n;;){if(e.lookahead===0&&(mi(e),e.lookahead===0)){if(t===pi)return et;break}if(e.match_length=0,n=Et._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(ut(e,!1),e.strm.avail_out===0))return et}return e.insert=0,t===Tr?(ut(e,!0),e.strm.avail_out===0?di:wa):e.last_lit&&(ut(e,!1),e.strm.avail_out===0)?et:Ss}function Ln(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 xa;xa=[new Ln(0,0,0,0,vS),new Ln(4,4,8,4,ov),new Ln(4,5,16,8,ov),new Ln(4,6,32,32,ov),new Ln(4,4,16,16,ya),new Ln(8,16,32,32,ya),new Ln(8,16,128,128,ya),new Ln(8,32,128,256,ya),new Ln(32,128,258,1024,ya),new Ln(32,258,258,4096,ya)];function gS(e){e.window_size=2*e.w_size,kr(e.head),e.max_lazy_match=xa[e.level].max_lazy,e.good_match=xa[e.level].good_length,e.nice_match=xa[e.level].nice_length,e.max_chain_length=xa[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 yS(){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=su,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(uS*2),this.dyn_dtree=new xt.Buf16((2*lS+1)*2),this.bl_tree=new xt.Buf16((2*cS+1)*2),kr(this.dyn_ltree),kr(this.dyn_dtree),kr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new xt.Buf16(fS+1),this.heap=new xt.Buf16(2*sv+1),kr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new xt.Buf16(2*sv+1),kr(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 WP(e){var t;return!e||!e.state?Xr(e,Yt):(e.total_in=e.total_out=0,e.data_type=nS,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?lu:fi,e.adler=t.wrap===2?0:1,t.last_flush=pi,Et._tr_init(t),jn)}function qP(e){var t=WP(e);return t===jn&&gS(e.state),t}function xS(e,t){return!e||!e.state||e.state.wrap!==2?Yt:(e.state.gzhead=t,jn)}function ZP(e,t,n,i,r,a){if(!e)return Yt;var o=1;if(t===QN&&(t=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),r<1||r>rS||n!==su||i<8||i>15||t<0||t>9||a<0||a>eS)return Xr(e,Yt);i===8&&(i=9);var s=new yS;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,qP(e)}function wS(e,t){return ZP(e,t,su,iS,aS,tS)}function PS(e,t){var n,i,r,a;if(!e||!e.state||t>TP||t<0)return e?Xr(e,Yt):Yt;if(i=e.state,!e.output||!e.input&&e.avail_in!==0||i.status===Ns&&t!==Tr)return Xr(e,e.avail_out===0?av:Yt);if(i.strm=e,n=i.last_flush,i.last_flush=t,i.status===lu)if(i.wrap===2)e.adler=0,Oe(i,31),Oe(i,139),Oe(i,8),i.gzhead?(Oe(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)),Oe(i,i.gzhead.time&255),Oe(i,i.gzhead.time>>8&255),Oe(i,i.gzhead.time>>16&255),Oe(i,i.gzhead.time>>24&255),Oe(i,i.level===9?2:i.strategy>=ru||i.level<2?4:0),Oe(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(Oe(i,i.gzhead.extra.length&255),Oe(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=Pr(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=lv):(Oe(i,0),Oe(i,0),Oe(i,0),Oe(i,0),Oe(i,0),Oe(i,i.level===9?2:i.strategy>=ru||i.level<2?4:0),Oe(i,mS),i.status=fi);else{var o=su+(i.w_bits-8<<4)<<8,s=-1;i.strategy>=ru||i.level<2?s=0:i.level<6?s=1:i.level===6?s=2:s=3,o|=s<<6,i.strstart!==0&&(o|=dS),o+=31-o%31,i.status=fi,js(i,o),i.strstart!==0&&(js(i,e.adler>>>16),js(i,e.adler&65535)),e.adler=1}if(i.status===lv)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=Pr(e.adler,i.pending_buf,i.pending-r,r)),zr(e),r=i.pending,i.pending===i.pending_buf_size));)Oe(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>r&&(e.adler=Pr(e.adler,i.pending_buf,i.pending-r,r)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=iu)}else i.status=iu;if(i.status===iu)if(i.gzhead.name){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=Pr(e.adler,i.pending_buf,i.pending-r,r)),zr(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,Oe(i,a)}while(a!==0);i.gzhead.hcrc&&i.pending>r&&(e.adler=Pr(e.adler,i.pending_buf,i.pending-r,r)),a===0&&(i.gzindex=0,i.status=au)}else i.status=au;if(i.status===au)if(i.gzhead.comment){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=Pr(e.adler,i.pending_buf,i.pending-r,r)),zr(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,Oe(i,a)}while(a!==0);i.gzhead.hcrc&&i.pending>r&&(e.adler=Pr(e.adler,i.pending_buf,i.pending-r,r)),a===0&&(i.status=ou)}else i.status=ou;if(i.status===ou&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&zr(e),i.pending+2<=i.pending_buf_size&&(Oe(i,e.adler&255),Oe(i,e.adler>>8&255),e.adler=0,i.status=fi)):i.status=fi),i.pending!==0){if(zr(e),e.avail_out===0)return i.last_flush=-1,jn}else if(e.avail_in===0&&jP(t)<=jP(n)&&t!==Tr)return Xr(e,av);if(i.status===Ns&&e.avail_in!==0)return Xr(e,av);if(e.avail_in!==0||i.lookahead!==0||t!==pi&&i.status!==Ns){var c=i.strategy===ru?hS(i,t):i.strategy===$N?bS(i,t):xa[i.level].func(i,t);if((c===di||c===wa)&&(i.status=Ns),c===et||c===di)return e.avail_out===0&&(i.last_flush=-1),jn;if(c===Ss&&(t===YN?Et._tr_align(i):t!==TP&&(Et._tr_stored_block(i,0,0,!1),t===AN&&(kr(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),zr(e),e.avail_out===0))return i.last_flush=-1,jn}return t!==Tr?jn:i.wrap<=0?LP:(i.wrap===2?(Oe(i,e.adler&255),Oe(i,e.adler>>8&255),Oe(i,e.adler>>16&255),Oe(i,e.adler>>24&255),Oe(i,e.total_in&255),Oe(i,e.total_in>>8&255),Oe(i,e.total_in>>16&255),Oe(i,e.total_in>>24&255)):(js(i,e.adler>>>16),js(i,e.adler&65535)),zr(e),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?jn:LP)}function zS(e){var t;return!e||!e.state?Yt:(t=e.state.status,t!==lu&&t!==lv&&t!==iu&&t!==au&&t!==ou&&t!==fi&&t!==Ns?Xr(e,Yt):(e.state=null,t===fi?Xr(e,BN):jn))}function kS(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!==lu||i.lookahead))return Yt;for(o===1&&(e.adler=NP(e.adler,t,n,0)),i.wrap=0,n>=i.w_size&&(o===0&&(kr(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,mi(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,mi(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=wS;Nn.deflateInit2=ZP;Nn.deflateReset=qP;Nn.deflateResetKeep=WP;Nn.deflateSetHeader=xS;Nn.deflate=PS;Nn.deflateEnd=zS;Nn.deflateSetDictionary=kS;Nn.deflateInfo="pako deflate (from Nodeca project)"});var cv=_(Pa=>{"use strict";var cu=tr(),RP=!0,DP=!0;try{String.fromCharCode.apply(null,[0])}catch{RP=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{DP=!1}var Ws=new cu.Buf8(256);for(rr=0;rr<256;rr++)Ws[rr]=rr>=252?6:rr>=248?5:rr>=240?4:rr>=224?3:rr>=192?2:1;var rr;Ws[254]=Ws[254]=1;Pa.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 cu.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 HP(e,t){if(t<65534&&(e.subarray&&DP||!e.subarray&&RP))return String.fromCharCode.apply(null,cu.shrinkBuf(e,t));for(var n="",i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n}Pa.buf2binstring=function(e){return HP(e,e.length)};Pa.binstring2buf=function(e){for(var t=new cu.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t};Pa.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=Ws[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 HP(s,i)};Pa.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+Ws[e[n]]>t?n:t}});var uv=_(($J,FP)=>{"use strict";function OS(){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}FP.exports=OS});var GP=_(Vs=>{"use strict";var qs=VP(),Zs=tr(),dv=cv(),mv=nu(),XS=uv(),UP=Object.prototype.toString,TS=0,fv=4,za=0,MP=1,IP=2,LS=-1,jS=0,NS=8;function vi(e){if(!(this instanceof vi))return new vi(e);this.options=Zs.assign({level:LS,method:NS,chunkSize:16384,windowBits:15,memLevel:8,strategy:jS,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 XS,this.strm.avail_out=0;var n=qs.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==za)throw new Error(mv[n]);if(t.header&&qs.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(typeof t.dictionary=="string"?i=dv.string2buf(t.dictionary):UP.call(t.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(t.dictionary):i=t.dictionary,n=qs.deflateSetDictionary(this.strm,i),n!==za)throw new Error(mv[n]);this._dict_set=!0}}vi.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?fv:TS,typeof e=="string"?n.input=dv.string2buf(e):UP.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),r=qs.deflate(n,a),r!==MP&&r!==za)return this.onEnd(r),this.ended=!0,!1;(n.avail_out===0||n.avail_in===0&&(a===fv||a===IP))&&(this.options.to==="string"?this.onData(dv.buf2binstring(Zs.shrinkBuf(n.output,n.next_out))):this.onData(Zs.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||n.avail_out===0)&&r!==MP);return a===fv?(r=qs.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===za):(a===IP&&(this.onEnd(za),n.avail_out=0),!0)};vi.prototype.onData=function(e){this.chunks.push(e)};vi.prototype.onEnd=function(e){e===za&&(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 pv(e,t){var n=new vi(t);if(n.push(e,!0),n.err)throw n.msg||mv[n.err];return n.result}function SS(e,t){return t=t||{},t.raw=!0,pv(e,t)}function WS(e,t){return t=t||{},t.gzip=!0,pv(e,t)}Vs.Deflate=vi;Vs.deflate=pv;Vs.deflateRaw=SS;Vs.gzip=WS});var CP=_((tC,JP)=>{"use strict";var uu=30,qS=12;JP.exports=function(t,n){var i,r,a,o,s,c,l,u,f,d,m,p,v,b,h,g,y,x,P,T,z,L,S,w,O;i=t.state,r=t.next_in,w=t.input,a=r+(t.avail_in-5),o=t.next_out,O=t.output,s=o-(n-t.avail_out),c=o+(t.avail_out-257),l=i.dmax,u=i.wsize,f=i.whave,d=i.wnext,m=i.window,p=i.hold,v=i.bits,b=i.lencode,h=i.distcode,g=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;e:do{v<15&&(p+=w[r++]<<v,v+=8,p+=w[r++]<<v,v+=8),x=b[p&g];t:for(;;){if(P=x>>>24,p>>>=P,v-=P,P=x>>>16&255,P===0)O[o++]=x&65535;else if(P&16){T=x&65535,P&=15,P&&(v<P&&(p+=w[r++]<<v,v+=8),T+=p&(1<<P)-1,p>>>=P,v-=P),v<15&&(p+=w[r++]<<v,v+=8,p+=w[r++]<<v,v+=8),x=h[p&y];n:for(;;){if(P=x>>>24,p>>>=P,v-=P,P=x>>>16&255,P&16){if(z=x&65535,P&=15,v<P&&(p+=w[r++]<<v,v+=8,v<P&&(p+=w[r++]<<v,v+=8)),z+=p&(1<<P)-1,z>l){t.msg="invalid distance too far back",i.mode=uu;break e}if(p>>>=P,v-=P,P=o-s,z>P){if(P=z-P,P>f&&i.sane){t.msg="invalid distance too far back",i.mode=uu;break e}if(L=0,S=m,d===0){if(L+=u-P,P<T){T-=P;do O[o++]=m[L++];while(--P);L=o-z,S=O}}else if(d<P){if(L+=u+d-P,P-=d,P<T){T-=P;do O[o++]=m[L++];while(--P);if(L=0,d<T){P=d,T-=P;do O[o++]=m[L++];while(--P);L=o-z,S=O}}}else if(L+=d-P,P<T){T-=P;do O[o++]=m[L++];while(--P);L=o-z,S=O}for(;T>2;)O[o++]=S[L++],O[o++]=S[L++],O[o++]=S[L++],T-=3;T&&(O[o++]=S[L++],T>1&&(O[o++]=S[L++]))}else{L=o-z;do O[o++]=O[L++],O[o++]=O[L++],O[o++]=O[L++],T-=3;while(T>2);T&&(O[o++]=O[L++],T>1&&(O[o++]=O[L++]))}}else if((P&64)===0){x=h[(x&65535)+(p&(1<<P)-1)];continue n}else{t.msg="invalid distance code",i.mode=uu;break e}break}}else if((P&64)===0){x=b[(x&65535)+(p&(1<<P)-1)];continue t}else if(P&32){i.mode=qS;break e}else{t.msg="invalid literal/length code",i.mode=uu;break e}break}}while(r<a&&o<c);T=v>>3,r-=T,v-=T<<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 _P=_((nC,QP)=>{"use strict";var KP=tr(),ka=15,EP=852,YP=592,AP=0,vv=1,BP=2,ZS=[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],VS=[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],RS=[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],DS=[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];QP.exports=function(t,n,i,r,a,o,s,c){var l=c.bits,u=0,f=0,d=0,m=0,p=0,v=0,b=0,h=0,g=0,y=0,x,P,T,z,L,S=null,w=0,O,j=new KP.Buf16(ka+1),U=new KP.Buf16(ka+1),Q=null,q=0,G,E,B;for(u=0;u<=ka;u++)j[u]=0;for(f=0;f<r;f++)j[n[i+f]]++;for(p=l,m=ka;m>=1&&j[m]===0;m--);if(p>m&&(p=m),m===0)return a[o++]=1<<24|64<<16|0,a[o++]=1<<24|64<<16|0,c.bits=1,0;for(d=1;d<m&&j[d]===0;d++);for(p<d&&(p=d),h=1,u=1;u<=ka;u++)if(h<<=1,h-=j[u],h<0)return-1;if(h>0&&(t===AP||m!==1))return-1;for(U[1]=0,u=1;u<ka;u++)U[u+1]=U[u]+j[u];for(f=0;f<r;f++)n[i+f]!==0&&(s[U[n[i+f]]++]=f);if(t===AP?(S=Q=s,O=19):t===vv?(S=ZS,w-=257,Q=VS,q-=257,O=256):(S=RS,Q=DS,O=-1),y=0,f=0,u=d,L=o,v=p,b=0,T=-1,g=1<<p,z=g-1,t===vv&&g>EP||t===BP&&g>YP)return 1;for(;;){G=u-b,s[f]<O?(E=0,B=s[f]):s[f]>O?(E=Q[q+s[f]],B=S[w+s[f]]):(E=96,B=0),x=1<<u-b,P=1<<v,d=P;do P-=x,a[L+(y>>b)+P]=G<<24|E<<16|B|0;while(P!==0);for(x=1<<u-1;y&x;)x>>=1;if(x!==0?(y&=x-1,y+=x):y=0,f++,--j[u]===0){if(u===m)break;u=n[i+s[f]]}if(u>p&&(y&z)!==T){for(b===0&&(b=p),L+=d,v=u-b,h=1<<v;v+b<m&&(h-=j[v+b],!(h<=0));)v++,h<<=1;if(g+=1<<v,t===vv&&g>EP||t===BP&&g>YP)return 1;T=y&z,a[T]=p<<24|v<<16|L-o|0}}return y!==0&&(a[L+y]=u-b<<24|64<<16|0),c.bits=p,0}});var qz=_(un=>{"use strict";var Ut=tr(),wv=rv(),Sn=iv(),HS=CP(),Rs=_P(),FS=0,kz=1,Oz=2,$P=4,MS=5,fu=6,bi=0,IS=1,US=2,At=-2,Xz=-3,Pv=-4,GS=-5,ez=8,Tz=1,tz=2,nz=3,rz=4,iz=5,az=6,oz=7,sz=8,lz=9,cz=10,pu=11,ir=12,bv=13,uz=14,hv=15,fz=16,dz=17,mz=18,pz=19,du=20,mu=21,vz=22,bz=23,hz=24,gz=25,yz=26,gv=27,xz=28,wz=29,Ie=30,zv=31,JS=32,CS=852,KS=592,ES=15,YS=ES;function Pz(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function AS(){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 Ut.Buf16(320),this.work=new Ut.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Lz(e){var t;return!e||!e.state?At:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Tz,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Ut.Buf32(CS),t.distcode=t.distdyn=new Ut.Buf32(KS),t.sane=1,t.back=-1,bi)}function jz(e){var t;return!e||!e.state?At:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Lz(e))}function Nz(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))?At:(i.window!==null&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,jz(e))}function Sz(e,t){var n,i;return e?(i=new AS,e.state=i,i.window=null,n=Nz(e,t),n!==bi&&(e.state=null),n):At}function BS(e){return Sz(e,YS)}var zz=!0,yv,xv;function QS(e){if(zz){var t;for(yv=new Ut.Buf32(512),xv=new Ut.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(Rs(kz,e.lens,0,288,yv,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Rs(Oz,e.lens,0,32,xv,0,e.work,{bits:5}),zz=!1}e.lencode=yv,e.lenbits=9,e.distcode=xv,e.distbits=5}function Wz(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 Ut.Buf8(a.wsize)),i>=a.wsize?(Ut.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),Ut.arraySet(a.window,t,n-i,r,a.wnext),i-=r,i?(Ut.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 _S(e,t){var n,i,r,a,o,s,c,l,u,f,d,m,p,v,b=0,h,g,y,x,P,T,z,L,S=new Ut.Buf8(4),w,O,j=[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 At;n=e.state,n.mode===ir&&(n.mode=bv),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,d=c,L=bi;e:for(;;)switch(n.mode){case Tz:if(n.wrap===0){n.mode=bv;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,S[0]=l&255,S[1]=l>>>8&255,n.check=Sn(n.check,S,2,0),l=0,u=0,n.mode=tz;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=Ie;break}if((l&15)!==ez){e.msg="unknown compression method",n.mode=Ie;break}if(l>>>=4,u-=4,z=(l&15)+8,n.wbits===0)n.wbits=z;else if(z>n.wbits){e.msg="invalid window size",n.mode=Ie;break}n.dmax=1<<z,e.adler=n.check=1,n.mode=l&512?cz:ir,l=0,u=0;break;case tz:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(n.flags=l,(n.flags&255)!==ez){e.msg="unknown compression method",n.mode=Ie;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=Ie;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&(S[0]=l&255,S[1]=l>>>8&255,n.check=Sn(n.check,S,2,0)),l=0,u=0,n.mode=nz;case nz:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.head&&(n.head.time=l),n.flags&512&&(S[0]=l&255,S[1]=l>>>8&255,S[2]=l>>>16&255,S[3]=l>>>24&255,n.check=Sn(n.check,S,4,0)),l=0,u=0,n.mode=rz;case rz: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&&(S[0]=l&255,S[1]=l>>>8&255,n.check=Sn(n.check,S,2,0)),l=0,u=0,n.mode=iz;case iz: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&&(S[0]=l&255,S[1]=l>>>8&255,n.check=Sn(n.check,S,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=az;case az:if(n.flags&1024&&(m=n.length,m>s&&(m=s),m&&(n.head&&(z=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Ut.arraySet(n.head.extra,i,a,m,z)),n.flags&512&&(n.check=Sn(n.check,i,m,a)),s-=m,a+=m,n.length-=m),n.length))break e;n.length=0,n.mode=oz;case oz:if(n.flags&2048){if(s===0)break e;m=0;do z=i[a+m++],n.head&&z&&n.length<65536&&(n.head.name+=String.fromCharCode(z));while(z&&m<s);if(n.flags&512&&(n.check=Sn(n.check,i,m,a)),s-=m,a+=m,z)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=sz;case sz:if(n.flags&4096){if(s===0)break e;m=0;do z=i[a+m++],n.head&&z&&n.length<65536&&(n.head.comment+=String.fromCharCode(z));while(z&&m<s);if(n.flags&512&&(n.check=Sn(n.check,i,m,a)),s-=m,a+=m,z)break e}else n.head&&(n.head.comment=null);n.mode=lz;case lz: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=Ie;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=ir;break;case cz:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}e.adler=n.check=Pz(l),l=0,u=0,n.mode=pu;case pu: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,US;e.adler=n.check=1,n.mode=ir;case ir:if(t===MS||t===fu)break e;case bv:if(n.last){l>>>=u&7,u-=u&7,n.mode=gv;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=uz;break;case 1:if(QS(n),n.mode=du,t===fu){l>>>=2,u-=2;break e}break;case 2:n.mode=dz;break;case 3:e.msg="invalid block type",n.mode=Ie}l>>>=2,u-=2;break;case uz: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=Ie;break}if(n.length=l&65535,l=0,u=0,n.mode=hv,t===fu)break e;case hv:n.mode=fz;case fz:if(m=n.length,m){if(m>s&&(m=s),m>c&&(m=c),m===0)break e;Ut.arraySet(r,i,a,m,o),s-=m,a+=m,c-=m,o+=m,n.length-=m;break}n.mode=ir;break;case dz: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=Ie;break}n.have=0,n.mode=mz;case mz:for(;n.have<n.ncode;){for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.lens[j[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[j[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,w={bits:n.lenbits},L=Rs(FS,n.lens,0,19,n.lencode,0,n.work,w),n.lenbits=w.bits,L){e.msg="invalid code lengths set",n.mode=Ie;break}n.have=0,n.mode=pz;case pz:for(;n.have<n.nlen+n.ndist;){for(;b=n.lencode[l&(1<<n.lenbits)-1],h=b>>>24,g=b>>>16&255,y=b&65535,!(h<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(y<16)l>>>=h,u-=h,n.lens[n.have++]=y;else{if(y===16){for(O=h+2;u<O;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(l>>>=h,u-=h,n.have===0){e.msg="invalid bit length repeat",n.mode=Ie;break}z=n.lens[n.have-1],m=3+(l&3),l>>>=2,u-=2}else if(y===17){for(O=h+3;u<O;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=h,u-=h,z=0,m=3+(l&7),l>>>=3,u-=3}else{for(O=h+7;u<O;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=h,u-=h,z=0,m=11+(l&127),l>>>=7,u-=7}if(n.have+m>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Ie;break}for(;m--;)n.lens[n.have++]=z}}if(n.mode===Ie)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Ie;break}if(n.lenbits=9,w={bits:n.lenbits},L=Rs(kz,n.lens,0,n.nlen,n.lencode,0,n.work,w),n.lenbits=w.bits,L){e.msg="invalid literal/lengths set",n.mode=Ie;break}if(n.distbits=6,n.distcode=n.distdyn,w={bits:n.distbits},L=Rs(Oz,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,w),n.distbits=w.bits,L){e.msg="invalid distances set",n.mode=Ie;break}if(n.mode=du,t===fu)break e;case du:n.mode=mu;case mu: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,HS(e,d),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===ir&&(n.back=-1);break}for(n.back=0;b=n.lencode[l&(1<<n.lenbits)-1],h=b>>>24,g=b>>>16&255,y=b&65535,!(h<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(g&&(g&240)===0){for(x=h,P=g,T=y;b=n.lencode[T+((l&(1<<x+P)-1)>>x)],h=b>>>24,g=b>>>16&255,y=b&65535,!(x+h<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=x,u-=x,n.back+=x}if(l>>>=h,u-=h,n.back+=h,n.length=y,g===0){n.mode=yz;break}if(g&32){n.back=-1,n.mode=ir;break}if(g&64){e.msg="invalid literal/length code",n.mode=Ie;break}n.extra=g&15,n.mode=vz;case vz:if(n.extra){for(O=n.extra;u<O;){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=bz;case bz:for(;b=n.distcode[l&(1<<n.distbits)-1],h=b>>>24,g=b>>>16&255,y=b&65535,!(h<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((g&240)===0){for(x=h,P=g,T=y;b=n.distcode[T+((l&(1<<x+P)-1)>>x)],h=b>>>24,g=b>>>16&255,y=b&65535,!(x+h<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=x,u-=x,n.back+=x}if(l>>>=h,u-=h,n.back+=h,g&64){e.msg="invalid distance code",n.mode=Ie;break}n.offset=y,n.extra=g&15,n.mode=hz;case hz:if(n.extra){for(O=n.extra;u<O;){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=Ie;break}n.mode=gz;case gz:if(c===0)break e;if(m=d-c,n.offset>m){if(m=n.offset-m,m>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Ie;break}m>n.wnext?(m-=n.wnext,p=n.wsize-m):p=n.wnext-m,m>n.length&&(m=n.length),v=n.window}else v=r,p=o-n.offset,m=n.length;m>c&&(m=c),c-=m,n.length-=m;do r[o++]=v[p++];while(--m);n.length===0&&(n.mode=mu);break;case yz:if(c===0)break e;r[o++]=n.length,c--,n.mode=mu;break;case gv:if(n.wrap){for(;u<32;){if(s===0)break e;s--,l|=i[a++]<<u,u+=8}if(d-=c,e.total_out+=d,n.total+=d,d&&(e.adler=n.check=n.flags?Sn(n.check,r,d,o-d):wv(n.check,r,d,o-d)),d=c,(n.flags?l:Pz(l))!==n.check){e.msg="incorrect data check",n.mode=Ie;break}l=0,u=0}n.mode=xz;case xz: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=Ie;break}l=0,u=0}n.mode=wz;case wz:L=IS;break e;case Ie:L=Xz;break e;case zv:return Pv;case JS:default:return At}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||d!==e.avail_out&&n.mode<Ie&&(n.mode<gv||t!==$P))&&Wz(e,e.output,e.next_out,d-e.avail_out)?(n.mode=zv,Pv):(f-=e.avail_in,d-=e.avail_out,e.total_in+=f,e.total_out+=d,n.total+=d,n.wrap&&d&&(e.adler=n.check=n.flags?Sn(n.check,r,d,e.next_out-d):wv(n.check,r,d,e.next_out-d)),e.data_type=n.bits+(n.last?64:0)+(n.mode===ir?128:0)+(n.mode===du||n.mode===hv?256:0),(f===0&&d===0||t===$P)&&L===bi&&(L=GS),L)}function $S(e){if(!e||!e.state)return At;var t=e.state;return t.window&&(t.window=null),e.state=null,bi}function e5(e,t){var n;return!e||!e.state||(n=e.state,(n.wrap&2)===0)?At:(n.head=t,t.done=!1,bi)}function t5(e,t){var n=t.length,i,r,a;return!e||!e.state||(i=e.state,i.wrap!==0&&i.mode!==pu)?At:i.mode===pu&&(r=1,r=wv(r,t,n,0),r!==i.check)?Xz:(a=Wz(e,t,n,n),a?(i.mode=zv,Pv):(i.havedict=1,bi))}un.inflateReset=jz;un.inflateReset2=Nz;un.inflateResetKeep=Lz;un.inflateInit=BS;un.inflateInit2=Sz;un.inflate=_S;un.inflateEnd=$S;un.inflateGetHeader=e5;un.inflateSetDictionary=t5;un.inflateInfo="pako inflate (from Nodeca project)"});var kv=_((iC,Zz)=>{"use strict";Zz.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 Rz=_((aC,Vz)=>{"use strict";function n5(){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}Vz.exports=n5});var Hz=_(Hs=>{"use strict";var Oa=qz(),Ds=tr(),vu=cv(),Ae=kv(),Ov=nu(),r5=uv(),i5=Rz(),Dz=Object.prototype.toString;function hi(e){if(!(this instanceof hi))return new hi(e);this.options=Ds.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 r5,this.strm.avail_out=0;var n=Oa.inflateInit2(this.strm,t.windowBits);if(n!==Ae.Z_OK)throw new Error(Ov[n]);if(this.header=new i5,Oa.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=vu.string2buf(t.dictionary):Dz.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Oa.inflateSetDictionary(this.strm,t.dictionary),n!==Ae.Z_OK)))throw new Error(Ov[n])}hi.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?Ae.Z_FINISH:Ae.Z_NO_FLUSH,typeof e=="string"?n.input=vu.binstring2buf(e):Dz.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 Ds.Buf8(i),n.next_out=0,n.avail_out=i),a=Oa.inflate(n,Ae.Z_NO_FLUSH),a===Ae.Z_NEED_DICT&&r&&(a=Oa.inflateSetDictionary(this.strm,r)),a===Ae.Z_BUF_ERROR&&u===!0&&(a=Ae.Z_OK,u=!1),a!==Ae.Z_STREAM_END&&a!==Ae.Z_OK)return this.onEnd(a),this.ended=!0,!1;n.next_out&&(n.avail_out===0||a===Ae.Z_STREAM_END||n.avail_in===0&&(o===Ae.Z_FINISH||o===Ae.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=vu.utf8border(n.output,n.next_out),c=n.next_out-s,l=vu.buf2string(n.output,s),n.next_out=c,n.avail_out=i-c,c&&Ds.arraySet(n.output,n.output,s,c,0),this.onData(l)):this.onData(Ds.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!==Ae.Z_STREAM_END);return a===Ae.Z_STREAM_END&&(o=Ae.Z_FINISH),o===Ae.Z_FINISH?(a=Oa.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Ae.Z_OK):(o===Ae.Z_SYNC_FLUSH&&(this.onEnd(Ae.Z_OK),n.avail_out=0),!0)};hi.prototype.onData=function(e){this.chunks.push(e)};hi.prototype.onEnd=function(e){e===Ae.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ds.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Xv(e,t){var n=new hi(t);if(n.push(e,!0),n.err)throw n.msg||Ov[n.err];return n.result}function a5(e,t){return t=t||{},t.raw=!0,Xv(e,t)}Hs.Inflate=hi;Hs.inflate=Xv;Hs.inflateRaw=a5;Hs.ungzip=Xv});var Iz=_((sC,Mz)=>{"use strict";var o5=tr().assign,s5=GP(),l5=Hz(),c5=kv(),Fz={};o5(Fz,s5,l5,c5);Mz.exports=Fz});var Gz=_(hu=>{"use strict";var u5=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",f5=Iz(),Uz=Ce(),bu=It(),d5=u5?"uint8array":"array";hu.magic="\b\0";function gi(e,t){bu.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}Uz.inherits(gi,bu);gi.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(Uz.transformTo(d5,e.data),!1)};gi.prototype.flush=function(){bu.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};gi.prototype.cleanUp=function(){bu.prototype.cleanUp.call(this),this._pako=null};gi.prototype._createPako=function(){this._pako=new f5[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};hu.compressWorker=function(e){return new gi("Deflate",e)};hu.uncompressWorker=function(){return new gi("Inflate",{})}});var Lv=_(Tv=>{"use strict";var Jz=It();Tv.STORE={magic:"\0\0",compressWorker:function(){return new Jz("STORE compression")},uncompressWorker:function(){return new Jz("STORE decompression")}};Tv.DEFLATE=Gz()});var jv=_(yi=>{"use strict";yi.LOCAL_FILE_HEADER="PK";yi.CENTRAL_FILE_HEADER="PK";yi.CENTRAL_DIRECTORY_END="PK";yi.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";yi.ZIP64_CENTRAL_DIRECTORY_END="PK";yi.DATA_DESCRIPTOR="PK\x07\b"});var Yz=_((fC,Ez)=>{"use strict";var Xa=Ce(),Ta=It(),Nv=pa(),Cz=Qc(),gu=jv(),He=function(e,t){var n="",i;for(i=0;i<t;i++)n+=String.fromCharCode(e&255),e=e>>>8;return n},m5=function(e,t){var n=e;return e||(n=t?16893:33204),(n&65535)<<16},p5=function(e){return(e||0)&63},Kz=function(e,t,n,i,r,a){var o=e.file,s=e.compression,c=a!==Nv.utf8encode,l=Xa.transformTo("string",a(o.name)),u=Xa.transformTo("string",Nv.utf8encode(o.name)),f=o.comment,d=Xa.transformTo("string",a(f)),m=Xa.transformTo("string",Nv.utf8encode(f)),p=u.length!==o.name.length,v=m.length!==f.length,b,h,g="",y="",x="",P=o.dir,T=o.date,z={crc32:0,compressedSize:0,uncompressedSize:0};(!t||n)&&(z.crc32=e.crc32,z.compressedSize=e.compressedSize,z.uncompressedSize=e.uncompressedSize);var L=0;t&&(L|=8),!c&&(p||v)&&(L|=2048);var S=0,w=0;P&&(S|=16),r==="UNIX"?(w=798,S|=m5(o.unixPermissions,P)):(w=20,S|=p5(o.dosPermissions,P)),b=T.getUTCHours(),b=b<<6,b=b|T.getUTCMinutes(),b=b<<5,b=b|T.getUTCSeconds()/2,h=T.getUTCFullYear()-1980,h=h<<4,h=h|T.getUTCMonth()+1,h=h<<5,h=h|T.getUTCDate(),p&&(y=He(1,1)+He(Cz(l),4)+u,g+="up"+He(y.length,2)+y),v&&(x=He(1,1)+He(Cz(d),4)+m,g+="uc"+He(x.length,2)+x);var O="";O+=`
3
+ import{a as i1}from"./chunk-IN6XVTUS.js";import{f as $9,g as e1,h as t1,k as n1,l as ni,p as r1}from"./chunk-TIZC6IEH.js";import{a as ym}from"./chunk-3PVQ5QP4.js";import{a as pm,c as Qr}from"./chunk-CV7OBWOX.js";import{b as E9}from"./chunk-TNCXZIOX.js";import{a as Y9,b as bc}from"./chunk-5JIFRR7U.js";import{b as A9}from"./chunk-WRDA44QF.js";import{b as B9}from"./chunk-PGJMKUUP.js";import{b as Q9}from"./chunk-6QB4DV22.js";import{a as hc}from"./chunk-OSUIS4JU.js";import{b as Ao,c as vc,d as Qi,e as C9,g as K9}from"./chunk-JV7TZDKJ.js";import{a as gm}from"./chunk-ASFUV3PB.js";import{p as Bi,t as $r,u as bm,v as M9,w as ei}from"./chunk-RL5XRG6O.js";import{i as I9}from"./chunk-IDADYIY6.js";import{b as a1,i as o1,p as s1}from"./chunk-N34DQ6MH.js";import{a as _9,b as We,c as xm,d as ke,f as Bo}from"./chunk-NU3X7P4N.js";import{Ja as ti,ba as J9,j as hm,t as U9,u as G9}from"./chunk-7Z65WW4I.js";import{k as Eo,l as vm,m as R9,p as kn,u as Yo,v as H9,w as F9}from"./chunk-AR5BTVBM.js";import{c as _r,d as D9}from"./chunk-HNEKQMQG.js";import{a as Me,b as Z9}from"./chunk-E75BCWXY.js";import{A as Yi,B as Re,C as Se,E as Co,G as dm,I as N9,L as mm,N as Ai,O as it,P as Ko,Q as S9,R as W9,aa as K,b as Br,ba as Ke,c as P9,ca as at,d as z9,da as C,e as k9,ea as q9,j as O9,n as fm,o as Te,p as X9,q as T9,r as L9,t as pc,u as Ei,v as st,w as j9,x as br,y as lt,z as Ye}from"./chunk-ZPIY5DOU.js";import{S as V9}from"./chunk-C2ESM27Z.js";import{a as Un,c as _,d as Gn,f as RX}from"./chunk-PSANHDZM.js";var os=_((uJ,Bm)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Bm.exports={nextTick:bL}:Bm.exports=process;function bL(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 k0=_((fJ,z0)=>{var hL={}.toString;z0.exports=Array.isArray||function(e){return hL.call(e)=="[object Array]"}});var Qm=_((dJ,O0)=>{O0.exports=Un("stream")});var ss=_((_m,T0)=>{var qc=Un("buffer"),Bn=qc.Buffer;function X0(e,t){for(var n in e)t[n]=e[n]}Bn.from&&Bn.alloc&&Bn.allocUnsafe&&Bn.allocUnsafeSlow?T0.exports=qc:(X0(qc,_m),_m.Buffer=ra);function ra(e,t,n){return Bn(e,t,n)}X0(Bn,ra);ra.from=function(e,t,n){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Bn(e,t,n)};ra.alloc=function(e,t,n){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=Bn(e);return t!==void 0?typeof n=="string"?i.fill(t,n):i.fill(t):i.fill(0),i};ra.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Bn(e)};ra.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return qc.SlowBuffer(e)}});var ia=_(vt=>{function gL(e){return Array.isArray?Array.isArray(e):Zc(e)==="[object Array]"}vt.isArray=gL;function yL(e){return typeof e=="boolean"}vt.isBoolean=yL;function xL(e){return e===null}vt.isNull=xL;function wL(e){return e==null}vt.isNullOrUndefined=wL;function PL(e){return typeof e=="number"}vt.isNumber=PL;function zL(e){return typeof e=="string"}vt.isString=zL;function kL(e){return typeof e=="symbol"}vt.isSymbol=kL;function OL(e){return e===void 0}vt.isUndefined=OL;function XL(e){return Zc(e)==="[object RegExp]"}vt.isRegExp=XL;function TL(e){return typeof e=="object"&&e!==null}vt.isObject=TL;function LL(e){return Zc(e)==="[object Date]"}vt.isDate=LL;function jL(e){return Zc(e)==="[object Error]"||e instanceof Error}vt.isError=jL;function NL(e){return typeof e=="function"}vt.isFunction=NL;function SL(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}vt.isPrimitive=SL;vt.isBuffer=Un("buffer").Buffer.isBuffer;function Zc(e){return Object.prototype.toString.call(e)}});var L0=_((pJ,$m)=>{typeof Object.create=="function"?$m.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:$m.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 aa=_((vJ,tp)=>{try{if(ep=Un("util"),typeof ep.inherits!="function")throw"";tp.exports=ep.inherits}catch{tp.exports=L0()}var ep});var N0=_((bJ,np)=>{"use strict";function WL(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var j0=ss().Buffer,ls=Un("util");function qL(e,t,n){e.copy(t,n)}np.exports=(function(){function e(){WL(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 j0.alloc(0);for(var i=j0.allocUnsafe(n>>>0),r=this.head,a=0;r;)qL(r.data,i,a),a+=r.data.length,r=r.next;return i},e})();ls&&ls.inspect&&ls.inspect.custom&&(np.exports.prototype[ls.inspect.custom]=function(){var e=ls.inspect({length:this.length});return this.constructor.name+" "+e})});var rp=_((hJ,S0)=>{"use strict";var Vc=os();function ZL(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,Vc.nextTick(Rc,this,e)):Vc.nextTick(Rc,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,Vc.nextTick(Rc,n,a)):Vc.nextTick(Rc,n,a):t&&t(a)}),this)}function VL(){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 Rc(e,t){e.emit("error",t)}S0.exports={destroy:ZL,undestroy:VL}});var q0=_((gJ,W0)=>{W0.exports=Un("util").deprecate});var ap=_((yJ,I0)=>{"use strict";var oi=os();I0.exports=Be;function V0(e){var t=this;this.next=null,this.entry=null,this.finish=function(){$L(t,e)}}var RL=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:oi.nextTick,oa;Be.WritableState=us;var R0=Object.create(ia());R0.inherits=aa();var DL={deprecate:q0()},D0=Qm(),Hc=ss().Buffer,HL=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function FL(e){return Hc.from(e)}function ML(e){return Hc.isBuffer(e)||e instanceof HL}var H0=rp();R0.inherits(Be,D0);function IL(){}function us(e,t){oa=oa||si(),e=e||{};var n=t instanceof oa;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){YL(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 V0(this)}us.prototype.getBuffer=function(){for(var t=this.bufferedRequest,n=[];t;)n.push(t),t=t.next;return n};(function(){try{Object.defineProperty(us.prototype,"buffer",{get:DL.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Dc;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Dc=Function.prototype[Symbol.hasInstance],Object.defineProperty(Be,Symbol.hasInstance,{value:function(e){return Dc.call(this,e)?!0:this!==Be?!1:e&&e._writableState instanceof us}})):Dc=function(e){return e instanceof this};function Be(e){if(oa=oa||si(),!Dc.call(Be,this)&&!(this instanceof oa))return new Be(e);this._writableState=new us(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)),D0.call(this)}Be.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function UL(e,t){var n=new Error("write after end");e.emit("error",n),oi.nextTick(t,n)}function GL(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),oi.nextTick(i,a),r=!1),r}Be.prototype.write=function(e,t,n){var i=this._writableState,r=!1,a=!i.objectMode&&ML(e);return a&&!Hc.isBuffer(e)&&(e=FL(e)),typeof t=="function"&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),typeof n!="function"&&(n=IL),i.ended?UL(this,n):(a||GL(this,i,e,n))&&(i.pendingcb++,r=CL(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&&F0(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 JL(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=Hc.from(t,n)),t}Object.defineProperty(Be.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function CL(e,t,n,i,r,a){if(!n){var o=JL(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 ip(e,t,!1,s,i,r,a);return c}function ip(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 KL(e,t,n,i,r){--t.pendingcb,n?(oi.nextTick(r,i),oi.nextTick(cs,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(r(i),e._writableState.errorEmitted=!0,e.emit("error",i),cs(e,t))}function EL(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function YL(e,t){var n=e._writableState,i=n.sync,r=n.writecb;if(EL(n),t)KL(e,n,i,t,r);else{var a=M0(n);!a&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&F0(e,n),i?RL(Z0,e,n,a,r):Z0(e,n,a,r)}}function Z0(e,t,n,i){n||AL(e,t),t.pendingcb--,i(),cs(e,t)}function AL(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function F0(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,ip(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 V0(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,u=n.callback,f=t.objectMode?1:c.length;if(ip(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||_L(this,i,n)};function M0(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function BL(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),cs(e,t)})}function QL(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,oi.nextTick(BL,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function cs(e,t){var n=M0(t);return n&&(QL(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),n}function _L(e,t,n){t.ending=!0,cs(e,t),n&&(t.finished?oi.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}function $L(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=H0.destroy;Be.prototype._undestroy=H0.undestroy;Be.prototype._destroy=function(e,t){this.end(),t(e)}});var si=_((xJ,C0)=>{"use strict";var U0=os(),ej=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};C0.exports=Qn;var G0=Object.create(ia());G0.inherits=aa();var J0=lp(),sp=ap();G0.inherits(Qn,J0);for(op=ej(sp.prototype),Fc=0;Fc<op.length;Fc++)Mc=op[Fc],Qn.prototype[Mc]||(Qn.prototype[Mc]=sp.prototype[Mc]);var op,Mc,Fc;function Qn(e){if(!(this instanceof Qn))return new Qn(e);J0.call(this,e),sp.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",tj)}Object.defineProperty(Qn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function tj(){this.allowHalfOpen||this._writableState.ended||U0.nextTick(nj,this)}function nj(e){e.end()}Object.defineProperty(Qn.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)}});Qn.prototype._destroy=function(e,t){this.push(null),this.end(),U0.nextTick(t,e)}});var fp=_(E0=>{"use strict";var up=ss().Buffer,K0=up.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 rj(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 ij(e){var t=rj(e);if(typeof t!="string"&&(up.isEncoding===K0||!K0(e)))throw new Error("Unknown encoding: "+e);return t||e}E0.StringDecoder=fs;function fs(e){this.encoding=ij(e);var t;switch(this.encoding){case"utf16le":this.text=uj,this.end=fj,t=4;break;case"utf8":this.fillLast=sj,t=4;break;case"base64":this.text=dj,this.end=mj,t=3;break;default:this.write=pj,this.end=vj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=up.allocUnsafe(t)}fs.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||""};fs.prototype.end=cj;fs.prototype.text=lj;fs.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 cp(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function aj(e,t,n){var i=t.length-1;if(i<n)return 0;var r=cp(t[i]);return r>=0?(r>0&&(e.lastNeed=r-1),r):--i<n||r===-2?0:(r=cp(t[i]),r>=0?(r>0&&(e.lastNeed=r-2),r):--i<n||r===-2?0:(r=cp(t[i]),r>=0?(r>0&&(r===2?r=0:e.lastNeed=r-3),r):0))}function oj(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 sj(e){var t=this.lastTotal-this.lastNeed,n=oj(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 lj(e,t){var n=aj(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 cj(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function uj(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 fj(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 dj(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 mj(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function pj(e){return e.toString(this.encoding)}function vj(e){return e&&e.length?this.write(e):""}});var lp=_((zJ,a3)=>{"use strict";var la=os();a3.exports=Fe;var bj=k0(),ds;Fe.ReadableState=e3;var PJ=Un("events").EventEmitter,Q0=function(e,t){return e.listeners(t).length},bp=Qm(),ms=ss().Buffer,hj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function gj(e){return ms.from(e)}function yj(e){return ms.isBuffer(e)||e instanceof hj}var _0=Object.create(ia());_0.inherits=aa();var dp=Un("util"),Xe=void 0;dp&&dp.debuglog?Xe=dp.debuglog("stream"):Xe=function(){};var xj=N0(),$0=rp(),sa;_0.inherits(Fe,bp);var mp=["error","close","destroy","pause","resume"];function wj(e,t,n){if(typeof e.prependListener=="function")return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):bj(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}function e3(e,t){ds=ds||si(),e=e||{};var n=t instanceof ds;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 xj,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&&(sa||(sa=fp().StringDecoder),this.decoder=new sa(e.encoding),this.encoding=e.encoding)}function Fe(e){if(ds=ds||si(),!(this instanceof Fe))return new Fe(e);this._readableState=new e3(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),bp.call(this)}Object.defineProperty(Fe.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Fe.prototype.destroy=$0.destroy;Fe.prototype._undestroy=$0.undestroy;Fe.prototype._destroy=function(e,t){this.push(null),t(e)};Fe.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=ms.from(e,t),t=""),i=!0),t3(this,e,t,!1,i)};Fe.prototype.unshift=function(e){return t3(this,e,null,!0,!1)};function t3(e,t,n,i,r){var a=e._readableState;if(t===null)a.reading=!1,Oj(e,a);else{var o;r||(o=Pj(a,t)),o?e.emit("error",o):a.objectMode||t&&t.length>0?(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==ms.prototype&&(t=gj(t)),i?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):pp(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?pp(e,a,t,!1):n3(e,a)):pp(e,a,t,!1))):i||(a.reading=!1)}return zj(a)}function pp(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&&Ic(e)),n3(e,t)}function Pj(e,t){var n;return!yj(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(n=new TypeError("Invalid non-string/buffer chunk")),n}function zj(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}Fe.prototype.isPaused=function(){return this._readableState.flowing===!1};Fe.prototype.setEncoding=function(e){return sa||(sa=fp().StringDecoder),this._readableState.decoder=new sa(e),this._readableState.encoding=e,this};var Y0=8388608;function kj(e){return e>=Y0?e=Y0:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function A0(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=kj(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}Fe.prototype.read=function(e){Xe("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 Xe("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?vp(this):Ic(this),null;if(e=A0(e,t),e===0&&t.ended)return t.length===0&&vp(this),null;var i=t.needReadable;Xe("need readable",i),(t.length===0||t.length-e<t.highWaterMark)&&(i=!0,Xe("length less than watermark",i)),t.ended||t.reading?(i=!1,Xe("reading or ended",i)):i&&(Xe("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=A0(n,t)));var r;return e>0?r=r3(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&&vp(this)),r!==null&&this.emit("data",r),r};function Oj(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,Ic(e)}}function Ic(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Xe("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?la.nextTick(B0,e):B0(e))}function B0(e){Xe("emit readable"),e.emit("readable"),hp(e)}function n3(e,t){t.readingMore||(t.readingMore=!0,la.nextTick(Xj,e,t))}function Xj(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(Xe("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}Fe.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};Fe.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,Xe("pipe count=%d opts=%j",i.pipesCount,t);var r=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,a=r?s:b;i.endEmitted?la.nextTick(a):n.once("end",a),e.on("unpipe",o);function o(h,g){Xe("onunpipe"),h===n&&g&&g.hasUnpiped===!1&&(g.hasUnpiped=!0,u())}function s(){Xe("onend"),e.end()}var c=Tj(n);e.on("drain",c);var l=!1;function u(){Xe("cleanup"),e.removeListener("close",p),e.removeListener("finish",v),e.removeListener("drain",c),e.removeListener("error",m),e.removeListener("unpipe",o),n.removeListener("end",s),n.removeListener("end",b),n.removeListener("data",d),l=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c()}var f=!1;n.on("data",d);function d(h){Xe("ondata"),f=!1;var g=e.write(h);g===!1&&!f&&((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&i3(i.pipes,e)!==-1)&&!l&&(Xe("false write response, pause",i.awaitDrain),i.awaitDrain++,f=!0),n.pause())}function m(h){Xe("onerror",h),b(),e.removeListener("error",m),Q0(e,"error")===0&&e.emit("error",h)}wj(e,"error",m);function p(){e.removeListener("finish",v),b()}e.once("close",p);function v(){Xe("onfinish"),e.removeListener("close",p),b()}e.once("finish",v);function b(){Xe("unpipe"),n.unpipe(e)}return e.emit("pipe",n),i.flowing||(Xe("pipe resume"),n.resume()),e};function Tj(e){return function(){var t=e._readableState;Xe("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&Q0(e,"data")&&(t.flowing=!0,hp(e))}}Fe.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=i3(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)};Fe.prototype.on=function(e,t){var n=bp.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&&Ic(this):la.nextTick(Lj,this))}return n};Fe.prototype.addListener=Fe.prototype.on;function Lj(e){Xe("readable nexttick read 0"),e.read(0)}Fe.prototype.resume=function(){var e=this._readableState;return e.flowing||(Xe("resume"),e.flowing=!0,jj(this,e)),this};function jj(e,t){t.resumeScheduled||(t.resumeScheduled=!0,la.nextTick(Nj,e,t))}function Nj(e,t){t.reading||(Xe("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),hp(e),t.flowing&&!t.reading&&e.read(0)}Fe.prototype.pause=function(){return Xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function hp(e){var t=e._readableState;for(Xe("flow",t.flowing);t.flowing&&e.read()!==null;);}Fe.prototype.wrap=function(e){var t=this,n=this._readableState,i=!1;e.on("end",function(){if(Xe("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(Xe("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<mp.length;a++)e.on(mp[a],this.emit.bind(this,mp[a]));return this._read=function(o){Xe("wrapped _read",o),i&&(i=!1,e.resume())},this};Object.defineProperty(Fe.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Fe._fromList=r3;function r3(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=Sj(e,t.buffer,t.decoder),n}function Sj(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?Wj(e,t):qj(e,t),i}function Wj(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 qj(e,t){var n=ms.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 vp(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,la.nextTick(Zj,t,e))}function Zj(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function i3(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}});var gp=_((kJ,l3)=>{"use strict";l3.exports=_n;var Uc=si(),s3=Object.create(ia());s3.inherits=aa();s3.inherits(_n,Uc);function Vj(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 _n(e){if(!(this instanceof _n))return new _n(e);Uc.call(this,e),this._transformState={afterTransform:Vj.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",Rj)}function Rj(){var e=this;typeof this._flush=="function"?this._flush(function(t,n){o3(e,t,n)}):o3(this,null,null)}_n.prototype.push=function(e,t){return this._transformState.needTransform=!1,Uc.prototype.push.call(this,e,t)};_n.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")};_n.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)}};_n.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};_n.prototype._destroy=function(e,t){var n=this;Uc.prototype._destroy.call(this,e,function(i){t(i),n.emit("close")})};function o3(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 d3=_((OJ,f3)=>{"use strict";f3.exports=ps;var c3=gp(),u3=Object.create(ia());u3.inherits=aa();u3.inherits(ps,c3);function ps(e){if(!(this instanceof ps))return new ps(e);c3.call(this,e)}ps.prototype._transform=function(e,t,n){n(null,e)}});var yp=_((ct,Gc)=>{var On=Un("stream");process.env.READABLE_STREAM==="disable"&&On?(Gc.exports=On,ct=Gc.exports=On.Readable,ct.Readable=On.Readable,ct.Writable=On.Writable,ct.Duplex=On.Duplex,ct.Transform=On.Transform,ct.PassThrough=On.PassThrough,ct.Stream=On):(ct=Gc.exports=lp(),ct.Stream=On||ct,ct.Readable=ct,ct.Writable=ap(),ct.Duplex=si(),ct.Transform=gp(),ct.PassThrough=d3())});var $n=_(Mt=>{"use strict";Mt.base64=!0;Mt.array=!0;Mt.string=!0;Mt.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";Mt.nodebuffer=typeof Buffer<"u";Mt.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")Mt.blob=!1;else{xp=new ArrayBuffer(0);try{Mt.blob=new Blob([xp],{type:"application/zip"}).size===0}catch{try{m3=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,wp=new m3,wp.append(xp),Mt.blob=wp.getBlob("application/zip").size===0}catch{Mt.blob=!1}}}var xp,m3,wp;try{Mt.nodestream=!!yp().Readable}catch{Mt.nodestream=!1}});var zp=_(Pp=>{"use strict";var Dj=Ce(),Hj=$n(),Xn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";Pp.encode=function(e){for(var t=[],n,i,r,a,o,s,c,l=0,u=e.length,f=u,d=Dj.getTypeOf(e)!=="string";l<e.length;)f=u-l,d?(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(Xn.charAt(a)+Xn.charAt(o)+Xn.charAt(s)+Xn.charAt(c));return t.join("")};Pp.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)===Xn.charAt(64)&&f--,e.charAt(e.length-2)===Xn.charAt(64)&&f--,f%1!==0)throw new Error("Invalid base64 input, bad content length.");var d;for(Hj.uint8array?d=new Uint8Array(f|0):d=new Array(f|0);c<e.length;)r=Xn.indexOf(e.charAt(c++)),a=Xn.indexOf(e.charAt(c++)),o=Xn.indexOf(e.charAt(c++)),s=Xn.indexOf(e.charAt(c++)),t=r<<2|a>>4,n=(a&15)<<4|o>>2,i=(o&3)<<6|s,d[l++]=t,o!==64&&(d[l++]=n),s!==64&&(d[l++]=i);return d}});var vs=_((LJ,p3)=>{"use strict";p3.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 g3=_((jJ,h3)=>{"use strict";var v3=global.MutationObserver||global.WebKitMutationObserver,ca;process.browser?v3?(kp=0,b3=new v3(bs),Op=global.document.createTextNode(""),b3.observe(Op,{characterData:!0}),ca=function(){Op.data=kp=++kp%2}):!global.setImmediate&&typeof global.MessageChannel<"u"?(Xp=new global.MessageChannel,Xp.port1.onmessage=bs,ca=function(){Xp.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?ca=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){bs(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:ca=function(){setTimeout(bs,0)}:ca=function(){process.nextTick(bs)};var kp,b3,Op,Xp,Tp,hs=[];function bs(){Tp=!0;for(var e,t,n=hs.length;n;){for(t=hs,hs=[],e=-1;++e<n;)t[e]();n=hs.length}Tp=!1}h3.exports=Fj;function Fj(e){hs.push(e)===1&&!Tp&&ca()}});var O3=_((NJ,k3)=>{"use strict";var y3=g3();function ua(){}var bt={},x3=["REJECTED"],Lp=["FULFILLED"],w3=["PENDING"];process.browser||(gs=["UNHANDLED"]);var gs;k3.exports=gr;function gr(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=w3,this.queue=[],this.outcome=void 0,process.browser||(this.handled=gs),e!==ua&&P3(this,e)}gr.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)}};gr.prototype.catch=function(e){return this.then(null,e)};gr.prototype.then=function(e,t){if(typeof e!="function"&&this.state===Lp||typeof t!="function"&&this.state===x3)return this;var n=new this.constructor(ua);if(process.browser||this.handled===gs&&(this.handled=null),this.state!==w3){var i=this.state===Lp?e:t;jp(n,i,this.outcome)}else this.queue.push(new ys(n,e,t));return n};function ys(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)}ys.prototype.callFulfilled=function(e){bt.resolve(this.promise,e)};ys.prototype.otherCallFulfilled=function(e){jp(this.promise,this.onFulfilled,e)};ys.prototype.callRejected=function(e){bt.reject(this.promise,e)};ys.prototype.otherCallRejected=function(e){jp(this.promise,this.onRejected,e)};function jp(e,t,n){y3(function(){var i;try{i=t(n)}catch(r){return bt.reject(e,r)}i===e?bt.reject(e,new TypeError("Cannot resolve promise with itself")):bt.resolve(e,i)})}bt.resolve=function(e,t){var n=z3(Mj,t);if(n.status==="error")return bt.reject(e,n.value);var i=n.value;if(i)P3(e,i);else{e.state=Lp,e.outcome=t;for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callFulfilled(t)}return e};bt.reject=function(e,t){e.state=x3,e.outcome=t,process.browser||e.handled===gs&&y3(function(){e.handled===gs&&process.emit("unhandledRejection",t,e)});for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e};function Mj(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function P3(e,t){var n=!1;function i(s){n||(n=!0,bt.reject(e,s))}function r(s){n||(n=!0,bt.resolve(e,s))}function a(){t(r,i)}var o=z3(a);o.status==="error"&&i(o.value)}function z3(e,t){var n={};try{n.value=e(t),n.status="success"}catch(i){n.status="error",n.value=i}return n}gr.resolve=Ij;function Ij(e){return e instanceof this?e:bt.resolve(new this(ua),e)}gr.reject=Uj;function Uj(e){var t=new this(ua);return bt.reject(t,e)}gr.all=Gj;function Gj(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(ua);++o<n;)c(e[o],o);return s;function c(l,u){t.resolve(l).then(f,function(d){i||(i=!0,bt.reject(s,d))});function f(d){r[u]=d,++a===n&&!i&&(i=!0,bt.resolve(s,r))}}}gr.race=Jj;function Jj(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(ua);++r<n;)o(e[r]);return a;function o(s){t.resolve(s).then(function(c){i||(i=!0,bt.resolve(a,c))},function(c){i||(i=!0,bt.reject(a,c))})}}});var fa=_((SJ,X3)=>{"use strict";var Np=null;typeof Promise<"u"?Np=Promise:Np=O3();X3.exports={Promise:Np}});var L3=_(T3=>{(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 P={callback:g,args:y};return i[n]=P,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 d(){if(e.postMessage&&!e.importScripts){var g=!0,y=e.onmessage;return e.onmessage=function(){g=!1},e.postMessage("","*"),e.onmessage=y,g}}function m(){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 b(){o=function(g){setTimeout(u,0,g)}}var h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,{}.toString.call(e.process)==="[object process]"?f():d()?m():e.MessageChannel?p():a&&"onreadystatechange"in a.createElement("script")?v():b(),h.setImmediate=s,h.clearImmediate=c})(typeof self>"u"?typeof global>"u"?T3:global:self)});var Ce=_(Qe=>{"use strict";var yr=$n(),Cj=zp(),da=vs(),Sp=fa();L3();function Kj(e){var t=null;return yr.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),Cc(e,t)}Qe.newBlob=function(e,t){Qe.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 xs(e){return e}function Cc(e,t){for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)&255;return t}var Jc={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 yr.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return yr.nodebuffer&&String.fromCharCode.apply(null,da.allocBuffer(1)).length===1}catch{return!1}})()}};function ws(e){var t=65536,n=Qe.getTypeOf(e),i=!0;if(n==="uint8array"?i=Jc.applyCanBeUsed.uint8array:n==="nodebuffer"&&(i=Jc.applyCanBeUsed.nodebuffer),i)for(;t>1;)try{return Jc.stringifyByChunk(e,n,t)}catch{t=Math.floor(t/2)}return Jc.stringifyByChar(e)}Qe.applyFromCharCode=ws;function Kc(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}var xr={};xr.string={string:xs,array:function(e){return Cc(e,new Array(e.length))},arraybuffer:function(e){return xr.string.uint8array(e).buffer},uint8array:function(e){return Cc(e,new Uint8Array(e.length))},nodebuffer:function(e){return Cc(e,da.allocBuffer(e.length))}};xr.array={string:ws,array:xs,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return da.newBufferFrom(e)}};xr.arraybuffer={string:function(e){return ws(new Uint8Array(e))},array:function(e){return Kc(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:xs,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return da.newBufferFrom(new Uint8Array(e))}};xr.uint8array={string:ws,array:function(e){return Kc(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:xs,nodebuffer:function(e){return da.newBufferFrom(e)}};xr.nodebuffer={string:ws,array:function(e){return Kc(e,new Array(e.length))},arraybuffer:function(e){return xr.nodebuffer.uint8array(e).buffer},uint8array:function(e){return Kc(e,new Uint8Array(e.length))},nodebuffer:xs};Qe.transformTo=function(e,t){if(t||(t=""),!e)return t;Qe.checkSupport(e);var n=Qe.getTypeOf(t),i=xr[n][e](t);return i};Qe.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("/")};Qe.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(yr.nodebuffer&&da.isBuffer(e))return"nodebuffer";if(yr.uint8array&&e instanceof Uint8Array)return"uint8array";if(yr.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};Qe.checkSupport=function(e){var t=yr[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};Qe.MAX_VALUE_16BITS=65535;Qe.MAX_VALUE_32BITS=-1;Qe.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};Qe.delay=function(e,t,n){setImmediate(function(){e.apply(n||null,t||[])})};Qe.inherits=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n};Qe.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};Qe.prepareContent=function(e,t,n,i,r){var a=Sp.Promise.resolve(t).then(function(o){var s=yr.blob&&(o instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(o))!==-1);return s&&typeof FileReader<"u"?new Sp.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=Qe.getTypeOf(o);return s?(s==="arraybuffer"?o=Qe.transformTo("uint8array",o):s==="string"&&(r?o=Cj.decode(o):n&&i!==!0&&(o=Kj(o))),o):Sp.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var It=_((ZJ,N3)=>{"use strict";function j3(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}j3.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}};N3.exports=j3});var pa=_(wr=>{"use strict";var ma=Ce(),li=$n(),Ej=vs(),Ec=It(),Ps=new Array(256);for(er=0;er<256;er++)Ps[er]=er>=252?6:er>=248?5:er>=240?4:er>=224?3:er>=192?2:1;var er;Ps[254]=Ps[254]=1;var Yj=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(li.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},Aj=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+Ps[e[n]]>t?n:t},Bj=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=Ps[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),ma.applyFromCharCode(o)};wr.utf8encode=function(t){return li.nodebuffer?Ej.newBufferFrom(t,"utf-8"):Yj(t)};wr.utf8decode=function(t){return li.nodebuffer?ma.transformTo("nodebuffer",t).toString("utf-8"):(t=ma.transformTo(li.uint8array?"uint8array":"array",t),Bj(t))};function Yc(){Ec.call(this,"utf-8 decode"),this.leftOver=null}ma.inherits(Yc,Ec);Yc.prototype.processChunk=function(e){var t=ma.transformTo(li.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(li.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=Aj(t),r=t;i!==t.length&&(li.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:wr.utf8decode(r),meta:e.meta})};Yc.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:wr.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};wr.Utf8DecodeWorker=Yc;function Wp(){Ec.call(this,"utf-8 encode")}ma.inherits(Wp,Ec);Wp.prototype.processChunk=function(e){this.push({data:wr.utf8encode(e.data),meta:e.meta})};wr.Utf8EncodeWorker=Wp});var Z3=_((RJ,q3)=>{"use strict";var S3=It(),W3=Ce();function qp(e){S3.call(this,"ConvertWorker to "+e),this.destType=e}W3.inherits(qp,S3);qp.prototype.processChunk=function(e){this.push({data:W3.transformTo(this.destType,e.data),meta:e.meta})};q3.exports=qp});var D3=_((DJ,R3)=>{"use strict";var V3=yp().Readable,Qj=Ce();Qj.inherits(Zp,V3);function Zp(e,t,n){V3.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)})}Zp.prototype._read=function(){this._helper.resume()};R3.exports=Zp});var Vp=_((HJ,M3)=>{"use strict";var ci=Ce(),_j=Z3(),$j=It(),eN=zp(),tN=$n(),nN=fa(),H3=null;if(tN.nodestream)try{H3=D3()}catch{}function rN(e,t,n){switch(e){case"blob":return ci.newBlob(ci.transformTo("arraybuffer",t),n);case"base64":return eN.encode(t);default:return ci.transformTo(e,t)}}function iN(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 aN(e,t){return new nN.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=rN(o,iN(a,r),s);n(c)}catch(l){i(l)}r=[]}).resume()})}function F3(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,ci.checkSupport(i),this._worker=e.pipe(new _j(i)),e.lock()}catch(r){this._worker=new $j("error"),this._worker.error(r)}}F3.prototype={accumulate:function(e){return aN(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(){ci.delay(t,arguments,n)}),this},resume:function(){return ci.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(ci.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new H3(this,{objectMode:this._outputType!=="nodebuffer"},e)}};M3.exports=F3});var Rp=_(ln=>{"use strict";ln.base64=!1;ln.binary=!1;ln.dir=!1;ln.createFolders=!0;ln.date=null;ln.compression=null;ln.compressionOptions=null;ln.comment=null;ln.unixPermissions=null;ln.dosPermissions=null});var Dp=_((MJ,I3)=>{"use strict";var Ac=Ce(),Bc=It(),oN=16*1024;function va(e){Bc.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=Ac.getTypeOf(n),t.isPaused||t._tickAndRepeat()},function(n){t.error(n)})}Ac.inherits(va,Bc);va.prototype.cleanUp=function(){Bc.prototype.cleanUp.call(this),this.data=null};va.prototype.resume=function(){return Bc.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,Ac.delay(this._tickAndRepeat,[],this)),!0):!1};va.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(Ac.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};va.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=oN,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}})};I3.exports=va});var Qc=_((IJ,G3)=>{"use strict";var sN=Ce();function lN(){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 U3=lN();function cN(e,t,n,i){var r=U3,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 uN(e,t,n,i){var r=U3,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}G3.exports=function(t,n){if(typeof t>"u"||!t.length)return 0;var i=sN.getTypeOf(t)!=="string";return i?cN(n|0,t,t.length,0):uN(n|0,t,t.length,0)}});var Fp=_((UJ,C3)=>{"use strict";var J3=It(),fN=Qc(),dN=Ce();function Hp(){J3.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}dN.inherits(Hp,J3);Hp.prototype.processChunk=function(e){this.streamInfo.crc32=fN(e.data,this.streamInfo.crc32||0),this.push(e)};C3.exports=Hp});var E3=_((GJ,K3)=>{"use strict";var mN=Ce(),Mp=It();function Ip(e){Mp.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}mN.inherits(Ip,Mp);Ip.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}Mp.prototype.processChunk.call(this,e)};K3.exports=Ip});var _c=_((JJ,B3)=>{"use strict";var Y3=fa(),A3=Dp(),pN=Fp(),Up=E3();function Gp(e,t,n,i,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=i,this.compressedContent=r}Gp.prototype={getContentWorker:function(){var e=new A3(Y3.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Up("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 A3(Y3.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};Gp.createWorkerFrom=function(e,t,n){return e.pipe(new pN).pipe(new Up("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new Up("compressedSize")).withStreamInfo("compression",t)};B3.exports=Gp});var eP=_((CJ,$3)=>{"use strict";var vN=Vp(),bN=Dp(),Jp=pa(),Cp=_c(),Q3=It(),Kp=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}};Kp.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 Jp.Utf8EncodeWorker)),!r&&i&&(t=t.pipe(new Jp.Utf8DecodeWorker))}catch(a){t=new Q3("error"),t.error(a)}return new vN(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 Cp&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new Jp.Utf8EncodeWorker)),Cp.createWorkerFrom(n,e,t)},_decompressWorker:function(){return this._data instanceof Cp?this._data.getContentWorker():this._data instanceof Q3?this._data:new bN(this._data)}};var _3=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],hN=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for($c=0;$c<_3.length;$c++)Kp.prototype[_3[$c]]=hN;var $c;$3.exports=Kp});var tr=_(yt=>{"use strict";var gN=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function yN(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)yN(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 xN={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}},wN={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,xN)):(yt.Buf8=Array,yt.Buf16=Array,yt.Buf32=Array,yt.assign(yt,wN))};yt.setTyped(gN)});var zP=_(ga=>{"use strict";var PN=tr(),zN=4,tP=0,nP=1,kN=2;function ha(e){for(var t=e.length;--t>=0;)e[t]=0}var ON=0,lP=1,XN=2,TN=3,LN=258,$p=29,Ls=256,ks=Ls+1+$p,ba=30,ev=19,cP=2*ks+1,ui=15,Ep=16,jN=7,tv=256,uP=16,fP=17,dP=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],eu=[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],NN=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],mP=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],SN=512,nr=new Array((ks+2)*2);ha(nr);var zs=new Array(ba*2);ha(zs);var Os=new Array(SN);ha(Os);var Xs=new Array(LN-TN+1);ha(Xs);var nv=new Array($p);ha(nv);var tu=new Array(ba);ha(tu);function Yp(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 pP,vP,bP;function Ap(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function hP(e){return e<256?Os[e]:Os[256+(e>>>7)]}function Ts(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function St(e,t,n){e.bi_valid>Ep-n?(e.bi_buf|=t<<e.bi_valid&65535,Ts(e,e.bi_buf),e.bi_buf=t>>Ep-e.bi_valid,e.bi_valid+=n-Ep):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function Tn(e,t,n){St(e,n[t*2],n[t*2+1])}function gP(e,t){var n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1}function WN(e){e.bi_valid===16?(Ts(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 qN(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,d,m,p,v=0;for(d=0;d<=ui;d++)e.bl_count[d]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<cP;l++)u=e.heap[l],d=n[n[u*2+1]*2+1]+1,d>c&&(d=c,v++),n[u*2+1]=d,!(u>i)&&(e.bl_count[d]++,m=0,u>=s&&(m=o[u-s]),p=n[u*2],e.opt_len+=p*(d+m),a&&(e.static_len+=p*(r[u*2+1]+m)));if(v!==0){do{for(d=c-1;e.bl_count[d]===0;)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[c]--,v-=2}while(v>0);for(d=c;d!==0;d--)for(u=e.bl_count[d];u!==0;)f=e.heap[--l],!(f>i)&&(n[f*2+1]!==d&&(e.opt_len+=(d-n[f*2+1])*n[f*2],n[f*2+1]=d),u--)}}function yP(e,t,n){var i=new Array(ui+1),r=0,a,o;for(a=1;a<=ui;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]=gP(i[s]++,s))}}function ZN(){var e,t,n,i,r,a=new Array(ui+1);for(n=0,i=0;i<$p-1;i++)for(nv[i]=n,e=0;e<1<<Qp[i];e++)Xs[n++]=i;for(Xs[n-1]=i,r=0,i=0;i<16;i++)for(tu[i]=r,e=0;e<1<<eu[i];e++)Os[r++]=i;for(r>>=7;i<ba;i++)for(tu[i]=r<<7,e=0;e<1<<eu[i]-7;e++)Os[256+r++]=i;for(t=0;t<=ui;t++)a[t]=0;for(e=0;e<=143;)nr[e*2+1]=8,e++,a[8]++;for(;e<=255;)nr[e*2+1]=9,e++,a[9]++;for(;e<=279;)nr[e*2+1]=7,e++,a[7]++;for(;e<=287;)nr[e*2+1]=8,e++,a[8]++;for(yP(nr,ks+1,a),e=0;e<ba;e++)zs[e*2+1]=5,zs[e*2]=gP(e,5);pP=new Yp(nr,Qp,Ls+1,ks,ui),vP=new Yp(zs,eu,0,ba,ui),bP=new Yp(new Array(0),NN,0,ev,jN)}function xP(e){var t;for(t=0;t<ks;t++)e.dyn_ltree[t*2]=0;for(t=0;t<ba;t++)e.dyn_dtree[t*2]=0;for(t=0;t<ev;t++)e.bl_tree[t*2]=0;e.dyn_ltree[tv*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function wP(e){e.bi_valid>8?Ts(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 VN(e,t,n,i){wP(e),i&&(Ts(e,n),Ts(e,~n)),PN.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}function rP(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 Bp(e,t,n){for(var i=e.heap[n],r=n<<1;r<=e.heap_len&&(r<e.heap_len&&rP(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!rP(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i}function iP(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=Xs[r],Tn(e,o+Ls+1,t),s=Qp[o],s!==0&&(r-=nv[o],St(e,r,s)),i--,o=hP(i),Tn(e,o,n),s=eu[o],s!==0&&(i-=tu[o],St(e,i,s)));while(a<e.last_lit);Tn(e,tv,t)}function _p(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=cP,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--)Bp(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Bp(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++,Bp(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],qN(e,t),yP(n,c,e.bl_count)}function aP(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[uP*2]++):s<=10?e.bl_tree[fP*2]++:e.bl_tree[dP*2]++,s=0,r=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))}function oP(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,uP,e.bl_tree),St(e,s-3,2)):s<=10?(Tn(e,fP,e.bl_tree),St(e,s-3,3)):(Tn(e,dP,e.bl_tree),St(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 RN(e){var t;for(aP(e,e.dyn_ltree,e.l_desc.max_code),aP(e,e.dyn_dtree,e.d_desc.max_code),_p(e,e.bl_desc),t=ev-1;t>=3&&e.bl_tree[mP[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function DN(e,t,n,i){var r;for(St(e,t-257,5),St(e,n-1,5),St(e,i-4,4),r=0;r<i;r++)St(e,e.bl_tree[mP[r]*2+1],3);oP(e,e.dyn_ltree,t-1),oP(e,e.dyn_dtree,n-1)}function HN(e){var t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return tP;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return nP;for(n=32;n<Ls;n++)if(e.dyn_ltree[n*2]!==0)return nP;return tP}var sP=!1;function FN(e){sP||(ZN(),sP=!0),e.l_desc=new Ap(e.dyn_ltree,pP),e.d_desc=new Ap(e.dyn_dtree,vP),e.bl_desc=new Ap(e.bl_tree,bP),e.bi_buf=0,e.bi_valid=0,xP(e)}function PP(e,t,n,i){St(e,(ON<<1)+(i?1:0),3),VN(e,t,n,!0)}function MN(e){St(e,lP<<1,3),Tn(e,tv,nr),WN(e)}function IN(e,t,n,i){var r,a,o=0;e.level>0?(e.strm.data_type===kN&&(e.strm.data_type=HN(e)),_p(e,e.l_desc),_p(e,e.d_desc),o=RN(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?PP(e,t,n,i):e.strategy===zN||a===r?(St(e,(lP<<1)+(i?1:0),3),iP(e,nr,zs)):(St(e,(XN<<1)+(i?1:0),3),DN(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),iP(e,e.dyn_ltree,e.dyn_dtree)),xP(e),i&&wP(e)}function UN(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[(Xs[n]+Ls+1)*2]++,e.dyn_dtree[hP(t)*2]++),e.last_lit===e.lit_bufsize-1}ga._tr_init=FN;ga._tr_stored_block=PP;ga._tr_flush_block=IN;ga._tr_tally=UN;ga._tr_align=MN});var rv=_((YJ,kP)=>{"use strict";function GN(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}kP.exports=GN});var iv=_((AJ,OP)=>{"use strict";function JN(){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 CN=JN();function KN(e,t,n,i){var r=CN,a=i+n;e^=-1;for(var o=i;o<a;o++)e=e>>>8^r[(e^t[o])&255];return e^-1}OP.exports=KN});var nu=_((BJ,XP)=>{"use strict";XP.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 VP=_(Nn=>{"use strict";var xt=tr(),Et=zP(),NP=rv(),Pr=iv(),EN=nu(),pi=0,YN=1,AN=3,Tr=4,TP=5,jn=0,LP=1,Yt=-2,BN=-3,av=-5,QN=-1,_N=1,ru=2,$N=3,eS=4,tS=0,nS=2,su=8,rS=9,iS=15,aS=8,oS=29,sS=256,sv=sS+1+oS,lS=30,cS=19,uS=2*sv+1,fS=15,xe=3,Or=258,cn=Or+xe+1,dS=32,lu=42,lv=69,iu=73,au=91,ou=103,fi=113,Ns=666,et=1,Ss=2,di=3,wa=4,mS=3;function Xr(e,t){return e.msg=EN[t],t}function jP(e){return(e<<1)-(e>4?9:0)}function kr(e){for(var t=e.length;--t>=0;)e[t]=0}function zr(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 ut(e,t){Et._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,zr(e.strm)}function Oe(e,t){e.pending_buf[e.pending++]=t}function js(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function pS(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=NP(e.adler,t,r,n):e.state.wrap===2&&(e.adler=Pr(e.adler,t,r,n)),e.next_in+=r,e.total_in+=r,r)}function SP(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-cn?e.strstart-(e.w_size-cn):0,l=e.window,u=e.w_mask,f=e.prev,d=e.strstart+Or,m=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]!==m||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<d);if(a=Or-(d-i),i=d-Or,a>o){if(e.match_start=t,o=a,a>=s)break;m=l[i+o-1],p=l[i+o]}}while((t=f[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead}function mi(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-cn)){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=pS(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<cn&&e.strm.avail_in!==0)}function vS(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(mi(e),e.lookahead===0&&t===pi)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,ut(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-cn&&(ut(e,!1),e.strm.avail_out===0))return et}return e.insert=0,t===Tr?(ut(e,!0),e.strm.avail_out===0?di:wa):(e.strstart>e.block_start&&(ut(e,!1),e.strm.avail_out===0),et)}function ov(e,t){for(var n,i;;){if(e.lookahead<cn){if(mi(e),e.lookahead<cn&&t===pi)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-cn&&(e.match_length=SP(e,n)),e.match_length>=xe)if(i=Et._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=Et._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(ut(e,!1),e.strm.avail_out===0))return et}return e.insert=e.strstart<xe-1?e.strstart:xe-1,t===Tr?(ut(e,!0),e.strm.avail_out===0?di:wa):e.last_lit&&(ut(e,!1),e.strm.avail_out===0)?et:Ss}function ya(e,t){for(var n,i,r;;){if(e.lookahead<cn){if(mi(e),e.lookahead<cn&&t===pi)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-cn&&(e.match_length=SP(e,n),e.match_length<=5&&(e.strategy===_N||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=Et._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&&(ut(e,!1),e.strm.avail_out===0))return et}else if(e.match_available){if(i=Et._tr_tally(e,0,e.window[e.strstart-1]),i&&ut(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=Et._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<xe-1?e.strstart:xe-1,t===Tr?(ut(e,!0),e.strm.avail_out===0?di:wa):e.last_lit&&(ut(e,!1),e.strm.avail_out===0)?et:Ss}function bS(e,t){for(var n,i,r,a,o=e.window;;){if(e.lookahead<=Or){if(mi(e),e.lookahead<=Or&&t===pi)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+Or;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=Or-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=xe?(n=Et._tr_tally(e,1,e.match_length-xe),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Et._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(ut(e,!1),e.strm.avail_out===0))return et}return e.insert=0,t===Tr?(ut(e,!0),e.strm.avail_out===0?di:wa):e.last_lit&&(ut(e,!1),e.strm.avail_out===0)?et:Ss}function hS(e,t){for(var n;;){if(e.lookahead===0&&(mi(e),e.lookahead===0)){if(t===pi)return et;break}if(e.match_length=0,n=Et._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(ut(e,!1),e.strm.avail_out===0))return et}return e.insert=0,t===Tr?(ut(e,!0),e.strm.avail_out===0?di:wa):e.last_lit&&(ut(e,!1),e.strm.avail_out===0)?et:Ss}function Ln(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 xa;xa=[new Ln(0,0,0,0,vS),new Ln(4,4,8,4,ov),new Ln(4,5,16,8,ov),new Ln(4,6,32,32,ov),new Ln(4,4,16,16,ya),new Ln(8,16,32,32,ya),new Ln(8,16,128,128,ya),new Ln(8,32,128,256,ya),new Ln(32,128,258,1024,ya),new Ln(32,258,258,4096,ya)];function gS(e){e.window_size=2*e.w_size,kr(e.head),e.max_lazy_match=xa[e.level].max_lazy,e.good_match=xa[e.level].good_length,e.nice_match=xa[e.level].nice_length,e.max_chain_length=xa[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 yS(){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=su,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(uS*2),this.dyn_dtree=new xt.Buf16((2*lS+1)*2),this.bl_tree=new xt.Buf16((2*cS+1)*2),kr(this.dyn_ltree),kr(this.dyn_dtree),kr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new xt.Buf16(fS+1),this.heap=new xt.Buf16(2*sv+1),kr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new xt.Buf16(2*sv+1),kr(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 WP(e){var t;return!e||!e.state?Xr(e,Yt):(e.total_in=e.total_out=0,e.data_type=nS,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?lu:fi,e.adler=t.wrap===2?0:1,t.last_flush=pi,Et._tr_init(t),jn)}function qP(e){var t=WP(e);return t===jn&&gS(e.state),t}function xS(e,t){return!e||!e.state||e.state.wrap!==2?Yt:(e.state.gzhead=t,jn)}function ZP(e,t,n,i,r,a){if(!e)return Yt;var o=1;if(t===QN&&(t=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),r<1||r>rS||n!==su||i<8||i>15||t<0||t>9||a<0||a>eS)return Xr(e,Yt);i===8&&(i=9);var s=new yS;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,qP(e)}function wS(e,t){return ZP(e,t,su,iS,aS,tS)}function PS(e,t){var n,i,r,a;if(!e||!e.state||t>TP||t<0)return e?Xr(e,Yt):Yt;if(i=e.state,!e.output||!e.input&&e.avail_in!==0||i.status===Ns&&t!==Tr)return Xr(e,e.avail_out===0?av:Yt);if(i.strm=e,n=i.last_flush,i.last_flush=t,i.status===lu)if(i.wrap===2)e.adler=0,Oe(i,31),Oe(i,139),Oe(i,8),i.gzhead?(Oe(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)),Oe(i,i.gzhead.time&255),Oe(i,i.gzhead.time>>8&255),Oe(i,i.gzhead.time>>16&255),Oe(i,i.gzhead.time>>24&255),Oe(i,i.level===9?2:i.strategy>=ru||i.level<2?4:0),Oe(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(Oe(i,i.gzhead.extra.length&255),Oe(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=Pr(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=lv):(Oe(i,0),Oe(i,0),Oe(i,0),Oe(i,0),Oe(i,0),Oe(i,i.level===9?2:i.strategy>=ru||i.level<2?4:0),Oe(i,mS),i.status=fi);else{var o=su+(i.w_bits-8<<4)<<8,s=-1;i.strategy>=ru||i.level<2?s=0:i.level<6?s=1:i.level===6?s=2:s=3,o|=s<<6,i.strstart!==0&&(o|=dS),o+=31-o%31,i.status=fi,js(i,o),i.strstart!==0&&(js(i,e.adler>>>16),js(i,e.adler&65535)),e.adler=1}if(i.status===lv)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=Pr(e.adler,i.pending_buf,i.pending-r,r)),zr(e),r=i.pending,i.pending===i.pending_buf_size));)Oe(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>r&&(e.adler=Pr(e.adler,i.pending_buf,i.pending-r,r)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=iu)}else i.status=iu;if(i.status===iu)if(i.gzhead.name){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=Pr(e.adler,i.pending_buf,i.pending-r,r)),zr(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,Oe(i,a)}while(a!==0);i.gzhead.hcrc&&i.pending>r&&(e.adler=Pr(e.adler,i.pending_buf,i.pending-r,r)),a===0&&(i.gzindex=0,i.status=au)}else i.status=au;if(i.status===au)if(i.gzhead.comment){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=Pr(e.adler,i.pending_buf,i.pending-r,r)),zr(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,Oe(i,a)}while(a!==0);i.gzhead.hcrc&&i.pending>r&&(e.adler=Pr(e.adler,i.pending_buf,i.pending-r,r)),a===0&&(i.status=ou)}else i.status=ou;if(i.status===ou&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&zr(e),i.pending+2<=i.pending_buf_size&&(Oe(i,e.adler&255),Oe(i,e.adler>>8&255),e.adler=0,i.status=fi)):i.status=fi),i.pending!==0){if(zr(e),e.avail_out===0)return i.last_flush=-1,jn}else if(e.avail_in===0&&jP(t)<=jP(n)&&t!==Tr)return Xr(e,av);if(i.status===Ns&&e.avail_in!==0)return Xr(e,av);if(e.avail_in!==0||i.lookahead!==0||t!==pi&&i.status!==Ns){var c=i.strategy===ru?hS(i,t):i.strategy===$N?bS(i,t):xa[i.level].func(i,t);if((c===di||c===wa)&&(i.status=Ns),c===et||c===di)return e.avail_out===0&&(i.last_flush=-1),jn;if(c===Ss&&(t===YN?Et._tr_align(i):t!==TP&&(Et._tr_stored_block(i,0,0,!1),t===AN&&(kr(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),zr(e),e.avail_out===0))return i.last_flush=-1,jn}return t!==Tr?jn:i.wrap<=0?LP:(i.wrap===2?(Oe(i,e.adler&255),Oe(i,e.adler>>8&255),Oe(i,e.adler>>16&255),Oe(i,e.adler>>24&255),Oe(i,e.total_in&255),Oe(i,e.total_in>>8&255),Oe(i,e.total_in>>16&255),Oe(i,e.total_in>>24&255)):(js(i,e.adler>>>16),js(i,e.adler&65535)),zr(e),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?jn:LP)}function zS(e){var t;return!e||!e.state?Yt:(t=e.state.status,t!==lu&&t!==lv&&t!==iu&&t!==au&&t!==ou&&t!==fi&&t!==Ns?Xr(e,Yt):(e.state=null,t===fi?Xr(e,BN):jn))}function kS(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!==lu||i.lookahead))return Yt;for(o===1&&(e.adler=NP(e.adler,t,n,0)),i.wrap=0,n>=i.w_size&&(o===0&&(kr(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,mi(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,mi(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=wS;Nn.deflateInit2=ZP;Nn.deflateReset=qP;Nn.deflateResetKeep=WP;Nn.deflateSetHeader=xS;Nn.deflate=PS;Nn.deflateEnd=zS;Nn.deflateSetDictionary=kS;Nn.deflateInfo="pako deflate (from Nodeca project)"});var cv=_(Pa=>{"use strict";var cu=tr(),RP=!0,DP=!0;try{String.fromCharCode.apply(null,[0])}catch{RP=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{DP=!1}var Ws=new cu.Buf8(256);for(rr=0;rr<256;rr++)Ws[rr]=rr>=252?6:rr>=248?5:rr>=240?4:rr>=224?3:rr>=192?2:1;var rr;Ws[254]=Ws[254]=1;Pa.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 cu.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 HP(e,t){if(t<65534&&(e.subarray&&DP||!e.subarray&&RP))return String.fromCharCode.apply(null,cu.shrinkBuf(e,t));for(var n="",i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n}Pa.buf2binstring=function(e){return HP(e,e.length)};Pa.binstring2buf=function(e){for(var t=new cu.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t};Pa.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=Ws[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 HP(s,i)};Pa.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+Ws[e[n]]>t?n:t}});var uv=_(($J,FP)=>{"use strict";function OS(){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}FP.exports=OS});var GP=_(Vs=>{"use strict";var qs=VP(),Zs=tr(),dv=cv(),mv=nu(),XS=uv(),UP=Object.prototype.toString,TS=0,fv=4,za=0,MP=1,IP=2,LS=-1,jS=0,NS=8;function vi(e){if(!(this instanceof vi))return new vi(e);this.options=Zs.assign({level:LS,method:NS,chunkSize:16384,windowBits:15,memLevel:8,strategy:jS,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 XS,this.strm.avail_out=0;var n=qs.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==za)throw new Error(mv[n]);if(t.header&&qs.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(typeof t.dictionary=="string"?i=dv.string2buf(t.dictionary):UP.call(t.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(t.dictionary):i=t.dictionary,n=qs.deflateSetDictionary(this.strm,i),n!==za)throw new Error(mv[n]);this._dict_set=!0}}vi.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?fv:TS,typeof e=="string"?n.input=dv.string2buf(e):UP.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),r=qs.deflate(n,a),r!==MP&&r!==za)return this.onEnd(r),this.ended=!0,!1;(n.avail_out===0||n.avail_in===0&&(a===fv||a===IP))&&(this.options.to==="string"?this.onData(dv.buf2binstring(Zs.shrinkBuf(n.output,n.next_out))):this.onData(Zs.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||n.avail_out===0)&&r!==MP);return a===fv?(r=qs.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===za):(a===IP&&(this.onEnd(za),n.avail_out=0),!0)};vi.prototype.onData=function(e){this.chunks.push(e)};vi.prototype.onEnd=function(e){e===za&&(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 pv(e,t){var n=new vi(t);if(n.push(e,!0),n.err)throw n.msg||mv[n.err];return n.result}function SS(e,t){return t=t||{},t.raw=!0,pv(e,t)}function WS(e,t){return t=t||{},t.gzip=!0,pv(e,t)}Vs.Deflate=vi;Vs.deflate=pv;Vs.deflateRaw=SS;Vs.gzip=WS});var CP=_((tC,JP)=>{"use strict";var uu=30,qS=12;JP.exports=function(t,n){var i,r,a,o,s,c,l,u,f,d,m,p,v,b,h,g,y,x,P,T,z,L,S,w,O;i=t.state,r=t.next_in,w=t.input,a=r+(t.avail_in-5),o=t.next_out,O=t.output,s=o-(n-t.avail_out),c=o+(t.avail_out-257),l=i.dmax,u=i.wsize,f=i.whave,d=i.wnext,m=i.window,p=i.hold,v=i.bits,b=i.lencode,h=i.distcode,g=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;e:do{v<15&&(p+=w[r++]<<v,v+=8,p+=w[r++]<<v,v+=8),x=b[p&g];t:for(;;){if(P=x>>>24,p>>>=P,v-=P,P=x>>>16&255,P===0)O[o++]=x&65535;else if(P&16){T=x&65535,P&=15,P&&(v<P&&(p+=w[r++]<<v,v+=8),T+=p&(1<<P)-1,p>>>=P,v-=P),v<15&&(p+=w[r++]<<v,v+=8,p+=w[r++]<<v,v+=8),x=h[p&y];n:for(;;){if(P=x>>>24,p>>>=P,v-=P,P=x>>>16&255,P&16){if(z=x&65535,P&=15,v<P&&(p+=w[r++]<<v,v+=8,v<P&&(p+=w[r++]<<v,v+=8)),z+=p&(1<<P)-1,z>l){t.msg="invalid distance too far back",i.mode=uu;break e}if(p>>>=P,v-=P,P=o-s,z>P){if(P=z-P,P>f&&i.sane){t.msg="invalid distance too far back",i.mode=uu;break e}if(L=0,S=m,d===0){if(L+=u-P,P<T){T-=P;do O[o++]=m[L++];while(--P);L=o-z,S=O}}else if(d<P){if(L+=u+d-P,P-=d,P<T){T-=P;do O[o++]=m[L++];while(--P);if(L=0,d<T){P=d,T-=P;do O[o++]=m[L++];while(--P);L=o-z,S=O}}}else if(L+=d-P,P<T){T-=P;do O[o++]=m[L++];while(--P);L=o-z,S=O}for(;T>2;)O[o++]=S[L++],O[o++]=S[L++],O[o++]=S[L++],T-=3;T&&(O[o++]=S[L++],T>1&&(O[o++]=S[L++]))}else{L=o-z;do O[o++]=O[L++],O[o++]=O[L++],O[o++]=O[L++],T-=3;while(T>2);T&&(O[o++]=O[L++],T>1&&(O[o++]=O[L++]))}}else if((P&64)===0){x=h[(x&65535)+(p&(1<<P)-1)];continue n}else{t.msg="invalid distance code",i.mode=uu;break e}break}}else if((P&64)===0){x=b[(x&65535)+(p&(1<<P)-1)];continue t}else if(P&32){i.mode=qS;break e}else{t.msg="invalid literal/length code",i.mode=uu;break e}break}}while(r<a&&o<c);T=v>>3,r-=T,v-=T<<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 _P=_((nC,QP)=>{"use strict";var KP=tr(),ka=15,EP=852,YP=592,AP=0,vv=1,BP=2,ZS=[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],VS=[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],RS=[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],DS=[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];QP.exports=function(t,n,i,r,a,o,s,c){var l=c.bits,u=0,f=0,d=0,m=0,p=0,v=0,b=0,h=0,g=0,y=0,x,P,T,z,L,S=null,w=0,O,j=new KP.Buf16(ka+1),U=new KP.Buf16(ka+1),Q=null,q=0,G,E,B;for(u=0;u<=ka;u++)j[u]=0;for(f=0;f<r;f++)j[n[i+f]]++;for(p=l,m=ka;m>=1&&j[m]===0;m--);if(p>m&&(p=m),m===0)return a[o++]=1<<24|64<<16|0,a[o++]=1<<24|64<<16|0,c.bits=1,0;for(d=1;d<m&&j[d]===0;d++);for(p<d&&(p=d),h=1,u=1;u<=ka;u++)if(h<<=1,h-=j[u],h<0)return-1;if(h>0&&(t===AP||m!==1))return-1;for(U[1]=0,u=1;u<ka;u++)U[u+1]=U[u]+j[u];for(f=0;f<r;f++)n[i+f]!==0&&(s[U[n[i+f]]++]=f);if(t===AP?(S=Q=s,O=19):t===vv?(S=ZS,w-=257,Q=VS,q-=257,O=256):(S=RS,Q=DS,O=-1),y=0,f=0,u=d,L=o,v=p,b=0,T=-1,g=1<<p,z=g-1,t===vv&&g>EP||t===BP&&g>YP)return 1;for(;;){G=u-b,s[f]<O?(E=0,B=s[f]):s[f]>O?(E=Q[q+s[f]],B=S[w+s[f]]):(E=96,B=0),x=1<<u-b,P=1<<v,d=P;do P-=x,a[L+(y>>b)+P]=G<<24|E<<16|B|0;while(P!==0);for(x=1<<u-1;y&x;)x>>=1;if(x!==0?(y&=x-1,y+=x):y=0,f++,--j[u]===0){if(u===m)break;u=n[i+s[f]]}if(u>p&&(y&z)!==T){for(b===0&&(b=p),L+=d,v=u-b,h=1<<v;v+b<m&&(h-=j[v+b],!(h<=0));)v++,h<<=1;if(g+=1<<v,t===vv&&g>EP||t===BP&&g>YP)return 1;T=y&z,a[T]=p<<24|v<<16|L-o|0}}return y!==0&&(a[L+y]=u-b<<24|64<<16|0),c.bits=p,0}});var qz=_(un=>{"use strict";var Ut=tr(),wv=rv(),Sn=iv(),HS=CP(),Rs=_P(),FS=0,kz=1,Oz=2,$P=4,MS=5,fu=6,bi=0,IS=1,US=2,At=-2,Xz=-3,Pv=-4,GS=-5,ez=8,Tz=1,tz=2,nz=3,rz=4,iz=5,az=6,oz=7,sz=8,lz=9,cz=10,pu=11,ir=12,bv=13,uz=14,hv=15,fz=16,dz=17,mz=18,pz=19,du=20,mu=21,vz=22,bz=23,hz=24,gz=25,yz=26,gv=27,xz=28,wz=29,Ie=30,zv=31,JS=32,CS=852,KS=592,ES=15,YS=ES;function Pz(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function AS(){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 Ut.Buf16(320),this.work=new Ut.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Lz(e){var t;return!e||!e.state?At:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Tz,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Ut.Buf32(CS),t.distcode=t.distdyn=new Ut.Buf32(KS),t.sane=1,t.back=-1,bi)}function jz(e){var t;return!e||!e.state?At:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Lz(e))}function Nz(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))?At:(i.window!==null&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,jz(e))}function Sz(e,t){var n,i;return e?(i=new AS,e.state=i,i.window=null,n=Nz(e,t),n!==bi&&(e.state=null),n):At}function BS(e){return Sz(e,YS)}var zz=!0,yv,xv;function QS(e){if(zz){var t;for(yv=new Ut.Buf32(512),xv=new Ut.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(Rs(kz,e.lens,0,288,yv,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Rs(Oz,e.lens,0,32,xv,0,e.work,{bits:5}),zz=!1}e.lencode=yv,e.lenbits=9,e.distcode=xv,e.distbits=5}function Wz(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 Ut.Buf8(a.wsize)),i>=a.wsize?(Ut.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),Ut.arraySet(a.window,t,n-i,r,a.wnext),i-=r,i?(Ut.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 _S(e,t){var n,i,r,a,o,s,c,l,u,f,d,m,p,v,b=0,h,g,y,x,P,T,z,L,S=new Ut.Buf8(4),w,O,j=[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 At;n=e.state,n.mode===ir&&(n.mode=bv),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,d=c,L=bi;e:for(;;)switch(n.mode){case Tz:if(n.wrap===0){n.mode=bv;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,S[0]=l&255,S[1]=l>>>8&255,n.check=Sn(n.check,S,2,0),l=0,u=0,n.mode=tz;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=Ie;break}if((l&15)!==ez){e.msg="unknown compression method",n.mode=Ie;break}if(l>>>=4,u-=4,z=(l&15)+8,n.wbits===0)n.wbits=z;else if(z>n.wbits){e.msg="invalid window size",n.mode=Ie;break}n.dmax=1<<z,e.adler=n.check=1,n.mode=l&512?cz:ir,l=0,u=0;break;case tz:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(n.flags=l,(n.flags&255)!==ez){e.msg="unknown compression method",n.mode=Ie;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=Ie;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&(S[0]=l&255,S[1]=l>>>8&255,n.check=Sn(n.check,S,2,0)),l=0,u=0,n.mode=nz;case nz:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.head&&(n.head.time=l),n.flags&512&&(S[0]=l&255,S[1]=l>>>8&255,S[2]=l>>>16&255,S[3]=l>>>24&255,n.check=Sn(n.check,S,4,0)),l=0,u=0,n.mode=rz;case rz: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&&(S[0]=l&255,S[1]=l>>>8&255,n.check=Sn(n.check,S,2,0)),l=0,u=0,n.mode=iz;case iz: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&&(S[0]=l&255,S[1]=l>>>8&255,n.check=Sn(n.check,S,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=az;case az:if(n.flags&1024&&(m=n.length,m>s&&(m=s),m&&(n.head&&(z=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Ut.arraySet(n.head.extra,i,a,m,z)),n.flags&512&&(n.check=Sn(n.check,i,m,a)),s-=m,a+=m,n.length-=m),n.length))break e;n.length=0,n.mode=oz;case oz:if(n.flags&2048){if(s===0)break e;m=0;do z=i[a+m++],n.head&&z&&n.length<65536&&(n.head.name+=String.fromCharCode(z));while(z&&m<s);if(n.flags&512&&(n.check=Sn(n.check,i,m,a)),s-=m,a+=m,z)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=sz;case sz:if(n.flags&4096){if(s===0)break e;m=0;do z=i[a+m++],n.head&&z&&n.length<65536&&(n.head.comment+=String.fromCharCode(z));while(z&&m<s);if(n.flags&512&&(n.check=Sn(n.check,i,m,a)),s-=m,a+=m,z)break e}else n.head&&(n.head.comment=null);n.mode=lz;case lz: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=Ie;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=ir;break;case cz:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}e.adler=n.check=Pz(l),l=0,u=0,n.mode=pu;case pu: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,US;e.adler=n.check=1,n.mode=ir;case ir:if(t===MS||t===fu)break e;case bv:if(n.last){l>>>=u&7,u-=u&7,n.mode=gv;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=uz;break;case 1:if(QS(n),n.mode=du,t===fu){l>>>=2,u-=2;break e}break;case 2:n.mode=dz;break;case 3:e.msg="invalid block type",n.mode=Ie}l>>>=2,u-=2;break;case uz: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=Ie;break}if(n.length=l&65535,l=0,u=0,n.mode=hv,t===fu)break e;case hv:n.mode=fz;case fz:if(m=n.length,m){if(m>s&&(m=s),m>c&&(m=c),m===0)break e;Ut.arraySet(r,i,a,m,o),s-=m,a+=m,c-=m,o+=m,n.length-=m;break}n.mode=ir;break;case dz: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=Ie;break}n.have=0,n.mode=mz;case mz:for(;n.have<n.ncode;){for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}n.lens[j[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[j[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,w={bits:n.lenbits},L=Rs(FS,n.lens,0,19,n.lencode,0,n.work,w),n.lenbits=w.bits,L){e.msg="invalid code lengths set",n.mode=Ie;break}n.have=0,n.mode=pz;case pz:for(;n.have<n.nlen+n.ndist;){for(;b=n.lencode[l&(1<<n.lenbits)-1],h=b>>>24,g=b>>>16&255,y=b&65535,!(h<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(y<16)l>>>=h,u-=h,n.lens[n.have++]=y;else{if(y===16){for(O=h+2;u<O;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(l>>>=h,u-=h,n.have===0){e.msg="invalid bit length repeat",n.mode=Ie;break}z=n.lens[n.have-1],m=3+(l&3),l>>>=2,u-=2}else if(y===17){for(O=h+3;u<O;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=h,u-=h,z=0,m=3+(l&7),l>>>=3,u-=3}else{for(O=h+7;u<O;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=h,u-=h,z=0,m=11+(l&127),l>>>=7,u-=7}if(n.have+m>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Ie;break}for(;m--;)n.lens[n.have++]=z}}if(n.mode===Ie)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Ie;break}if(n.lenbits=9,w={bits:n.lenbits},L=Rs(kz,n.lens,0,n.nlen,n.lencode,0,n.work,w),n.lenbits=w.bits,L){e.msg="invalid literal/lengths set",n.mode=Ie;break}if(n.distbits=6,n.distcode=n.distdyn,w={bits:n.distbits},L=Rs(Oz,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,w),n.distbits=w.bits,L){e.msg="invalid distances set",n.mode=Ie;break}if(n.mode=du,t===fu)break e;case du:n.mode=mu;case mu: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,HS(e,d),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===ir&&(n.back=-1);break}for(n.back=0;b=n.lencode[l&(1<<n.lenbits)-1],h=b>>>24,g=b>>>16&255,y=b&65535,!(h<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(g&&(g&240)===0){for(x=h,P=g,T=y;b=n.lencode[T+((l&(1<<x+P)-1)>>x)],h=b>>>24,g=b>>>16&255,y=b&65535,!(x+h<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=x,u-=x,n.back+=x}if(l>>>=h,u-=h,n.back+=h,n.length=y,g===0){n.mode=yz;break}if(g&32){n.back=-1,n.mode=ir;break}if(g&64){e.msg="invalid literal/length code",n.mode=Ie;break}n.extra=g&15,n.mode=vz;case vz:if(n.extra){for(O=n.extra;u<O;){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=bz;case bz:for(;b=n.distcode[l&(1<<n.distbits)-1],h=b>>>24,g=b>>>16&255,y=b&65535,!(h<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((g&240)===0){for(x=h,P=g,T=y;b=n.distcode[T+((l&(1<<x+P)-1)>>x)],h=b>>>24,g=b>>>16&255,y=b&65535,!(x+h<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=x,u-=x,n.back+=x}if(l>>>=h,u-=h,n.back+=h,g&64){e.msg="invalid distance code",n.mode=Ie;break}n.offset=y,n.extra=g&15,n.mode=hz;case hz:if(n.extra){for(O=n.extra;u<O;){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=Ie;break}n.mode=gz;case gz:if(c===0)break e;if(m=d-c,n.offset>m){if(m=n.offset-m,m>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Ie;break}m>n.wnext?(m-=n.wnext,p=n.wsize-m):p=n.wnext-m,m>n.length&&(m=n.length),v=n.window}else v=r,p=o-n.offset,m=n.length;m>c&&(m=c),c-=m,n.length-=m;do r[o++]=v[p++];while(--m);n.length===0&&(n.mode=mu);break;case yz:if(c===0)break e;r[o++]=n.length,c--,n.mode=mu;break;case gv:if(n.wrap){for(;u<32;){if(s===0)break e;s--,l|=i[a++]<<u,u+=8}if(d-=c,e.total_out+=d,n.total+=d,d&&(e.adler=n.check=n.flags?Sn(n.check,r,d,o-d):wv(n.check,r,d,o-d)),d=c,(n.flags?l:Pz(l))!==n.check){e.msg="incorrect data check",n.mode=Ie;break}l=0,u=0}n.mode=xz;case xz: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=Ie;break}l=0,u=0}n.mode=wz;case wz:L=IS;break e;case Ie:L=Xz;break e;case zv:return Pv;case JS:default:return At}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||d!==e.avail_out&&n.mode<Ie&&(n.mode<gv||t!==$P))&&Wz(e,e.output,e.next_out,d-e.avail_out)?(n.mode=zv,Pv):(f-=e.avail_in,d-=e.avail_out,e.total_in+=f,e.total_out+=d,n.total+=d,n.wrap&&d&&(e.adler=n.check=n.flags?Sn(n.check,r,d,e.next_out-d):wv(n.check,r,d,e.next_out-d)),e.data_type=n.bits+(n.last?64:0)+(n.mode===ir?128:0)+(n.mode===du||n.mode===hv?256:0),(f===0&&d===0||t===$P)&&L===bi&&(L=GS),L)}function $S(e){if(!e||!e.state)return At;var t=e.state;return t.window&&(t.window=null),e.state=null,bi}function e5(e,t){var n;return!e||!e.state||(n=e.state,(n.wrap&2)===0)?At:(n.head=t,t.done=!1,bi)}function t5(e,t){var n=t.length,i,r,a;return!e||!e.state||(i=e.state,i.wrap!==0&&i.mode!==pu)?At:i.mode===pu&&(r=1,r=wv(r,t,n,0),r!==i.check)?Xz:(a=Wz(e,t,n,n),a?(i.mode=zv,Pv):(i.havedict=1,bi))}un.inflateReset=jz;un.inflateReset2=Nz;un.inflateResetKeep=Lz;un.inflateInit=BS;un.inflateInit2=Sz;un.inflate=_S;un.inflateEnd=$S;un.inflateGetHeader=e5;un.inflateSetDictionary=t5;un.inflateInfo="pako inflate (from Nodeca project)"});var kv=_((iC,Zz)=>{"use strict";Zz.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 Rz=_((aC,Vz)=>{"use strict";function n5(){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}Vz.exports=n5});var Hz=_(Hs=>{"use strict";var Oa=qz(),Ds=tr(),vu=cv(),Ae=kv(),Ov=nu(),r5=uv(),i5=Rz(),Dz=Object.prototype.toString;function hi(e){if(!(this instanceof hi))return new hi(e);this.options=Ds.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 r5,this.strm.avail_out=0;var n=Oa.inflateInit2(this.strm,t.windowBits);if(n!==Ae.Z_OK)throw new Error(Ov[n]);if(this.header=new i5,Oa.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=vu.string2buf(t.dictionary):Dz.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Oa.inflateSetDictionary(this.strm,t.dictionary),n!==Ae.Z_OK)))throw new Error(Ov[n])}hi.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?Ae.Z_FINISH:Ae.Z_NO_FLUSH,typeof e=="string"?n.input=vu.binstring2buf(e):Dz.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 Ds.Buf8(i),n.next_out=0,n.avail_out=i),a=Oa.inflate(n,Ae.Z_NO_FLUSH),a===Ae.Z_NEED_DICT&&r&&(a=Oa.inflateSetDictionary(this.strm,r)),a===Ae.Z_BUF_ERROR&&u===!0&&(a=Ae.Z_OK,u=!1),a!==Ae.Z_STREAM_END&&a!==Ae.Z_OK)return this.onEnd(a),this.ended=!0,!1;n.next_out&&(n.avail_out===0||a===Ae.Z_STREAM_END||n.avail_in===0&&(o===Ae.Z_FINISH||o===Ae.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=vu.utf8border(n.output,n.next_out),c=n.next_out-s,l=vu.buf2string(n.output,s),n.next_out=c,n.avail_out=i-c,c&&Ds.arraySet(n.output,n.output,s,c,0),this.onData(l)):this.onData(Ds.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!==Ae.Z_STREAM_END);return a===Ae.Z_STREAM_END&&(o=Ae.Z_FINISH),o===Ae.Z_FINISH?(a=Oa.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Ae.Z_OK):(o===Ae.Z_SYNC_FLUSH&&(this.onEnd(Ae.Z_OK),n.avail_out=0),!0)};hi.prototype.onData=function(e){this.chunks.push(e)};hi.prototype.onEnd=function(e){e===Ae.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ds.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Xv(e,t){var n=new hi(t);if(n.push(e,!0),n.err)throw n.msg||Ov[n.err];return n.result}function a5(e,t){return t=t||{},t.raw=!0,Xv(e,t)}Hs.Inflate=hi;Hs.inflate=Xv;Hs.inflateRaw=a5;Hs.ungzip=Xv});var Iz=_((sC,Mz)=>{"use strict";var o5=tr().assign,s5=GP(),l5=Hz(),c5=kv(),Fz={};o5(Fz,s5,l5,c5);Mz.exports=Fz});var Gz=_(hu=>{"use strict";var u5=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",f5=Iz(),Uz=Ce(),bu=It(),d5=u5?"uint8array":"array";hu.magic="\b\0";function gi(e,t){bu.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}Uz.inherits(gi,bu);gi.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(Uz.transformTo(d5,e.data),!1)};gi.prototype.flush=function(){bu.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};gi.prototype.cleanUp=function(){bu.prototype.cleanUp.call(this),this._pako=null};gi.prototype._createPako=function(){this._pako=new f5[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};hu.compressWorker=function(e){return new gi("Deflate",e)};hu.uncompressWorker=function(){return new gi("Inflate",{})}});var Lv=_(Tv=>{"use strict";var Jz=It();Tv.STORE={magic:"\0\0",compressWorker:function(){return new Jz("STORE compression")},uncompressWorker:function(){return new Jz("STORE decompression")}};Tv.DEFLATE=Gz()});var jv=_(yi=>{"use strict";yi.LOCAL_FILE_HEADER="PK";yi.CENTRAL_FILE_HEADER="PK";yi.CENTRAL_DIRECTORY_END="PK";yi.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";yi.ZIP64_CENTRAL_DIRECTORY_END="PK";yi.DATA_DESCRIPTOR="PK\x07\b"});var Yz=_((fC,Ez)=>{"use strict";var Xa=Ce(),Ta=It(),Nv=pa(),Cz=Qc(),gu=jv(),He=function(e,t){var n="",i;for(i=0;i<t;i++)n+=String.fromCharCode(e&255),e=e>>>8;return n},m5=function(e,t){var n=e;return e||(n=t?16893:33204),(n&65535)<<16},p5=function(e){return(e||0)&63},Kz=function(e,t,n,i,r,a){var o=e.file,s=e.compression,c=a!==Nv.utf8encode,l=Xa.transformTo("string",a(o.name)),u=Xa.transformTo("string",Nv.utf8encode(o.name)),f=o.comment,d=Xa.transformTo("string",a(f)),m=Xa.transformTo("string",Nv.utf8encode(f)),p=u.length!==o.name.length,v=m.length!==f.length,b,h,g="",y="",x="",P=o.dir,T=o.date,z={crc32:0,compressedSize:0,uncompressedSize:0};(!t||n)&&(z.crc32=e.crc32,z.compressedSize=e.compressedSize,z.uncompressedSize=e.uncompressedSize);var L=0;t&&(L|=8),!c&&(p||v)&&(L|=2048);var S=0,w=0;P&&(S|=16),r==="UNIX"?(w=798,S|=m5(o.unixPermissions,P)):(w=20,S|=p5(o.dosPermissions,P)),b=T.getUTCHours(),b=b<<6,b=b|T.getUTCMinutes(),b=b<<5,b=b|T.getUTCSeconds()/2,h=T.getUTCFullYear()-1980,h=h<<4,h=h|T.getUTCMonth()+1,h=h<<5,h=h|T.getUTCDate(),p&&(y=He(1,1)+He(Cz(l),4)+u,g+="up"+He(y.length,2)+y),v&&(x=He(1,1)+He(Cz(d),4)+m,g+="uc"+He(x.length,2)+x);var O="";O+=`
4
4
  \0`,O+=He(L,2),O+=s.magic,O+=He(b,2),O+=He(h,2),O+=He(z.crc32,4),O+=He(z.compressedSize,4),O+=He(z.uncompressedSize,4),O+=He(l.length,2),O+=He(g.length,2);var j=gu.LOCAL_FILE_HEADER+O+l+g,U=gu.CENTRAL_FILE_HEADER+He(w,2)+O+He(d.length,2)+"\0\0\0\0"+He(S,4)+He(i,4)+l+g+d;return{fileRecord:j,dirRecord:U}},v5=function(e,t,n,i,r){var a="",o=Xa.transformTo("string",r(i));return a=gu.CENTRAL_DIRECTORY_END+"\0\0\0\0"+He(e,2)+He(e,2)+He(t,4)+He(n,4)+He(o.length,2)+o,a},b5=function(e){var t="";return t=gu.DATA_DESCRIPTOR+He(e.crc32,4)+He(e.compressedSize,4)+He(e.uncompressedSize,4),t};function fn(e,t,n,i){Ta.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=[]}Xa.inherits(fn,Ta);fn.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,Ta.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-i-1))/n:100}}))};fn.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=Kz(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0};fn.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=Kz(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:b5(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};fn.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=v5(this.dirRecords.length,n,e,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})};fn.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};fn.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};fn.prototype.resume=function(){if(!Ta.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};fn.prototype.error=function(e){var t=this._sources;if(!Ta.prototype.error.call(this,e))return!1;for(var n=0;n<t.length;n++)try{t[n].error(e)}catch{}return!0};fn.prototype.lock=function(){Ta.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};Ez.exports=fn});var Bz=_(Az=>{"use strict";var h5=Lv(),g5=Yz(),y5=function(e,t){var n=e||t,i=h5[n];if(!i)throw new Error(n+" is not a valid compression method !");return i};Az.generateWorker=function(e,t,n){var i=new g5(t.streamFiles,n,t.platform,t.encodeFileName),r=0;try{e.forEach(function(a,o){r++;var s=y5(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 _z=_((mC,Qz)=>{"use strict";var x5=Ce(),yu=It();function Fs(e,t){yu.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}x5.inherits(Fs,yu);Fs.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()})};Fs.prototype.pause=function(){return yu.prototype.pause.call(this)?(this._stream.pause(),!0):!1};Fs.prototype.resume=function(){return yu.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};Qz.exports=Fs});var lk=_((pC,sk)=>{"use strict";var w5=pa(),Ms=Ce(),nk=It(),P5=Vp(),rk=Rp(),$z=_c(),z5=eP(),k5=Bz(),ek=vs(),O5=_z(),ik=function(e,t,n){var i=Ms.getTypeOf(t),r,a=Ms.extend(n||{},rk);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=ak(e)),a.createFolders&&(r=X5(e))&&ok.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 $z&&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 $z||t instanceof nk?c=t:ek.isNode&&ek.isStream(t)?c=new O5(e,t):c=Ms.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var l=new z5(e,c,a);this.files[e]=l},X5=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},ak=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},ok=function(e,t){return t=typeof t<"u"?t:rk.createFolders,e=ak(e),this.files[e]||ik.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function tk(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var T5={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(tk(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,ik.call(this,e,t,n);return this},folder:function(e){if(!e)return this;if(tk(e))return this.filter(function(r,a){return a.dir&&e.test(r)});var t=this.root+e,n=ok.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=Ms.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:w5.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.");Ms.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=k5.generateWorker(this,n,i)}catch(r){t=new nk("error"),t.error(r)}return new P5(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)}};sk.exports=T5});var Sv=_((vC,uk)=>{"use strict";var L5=Ce();function ck(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}ck.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 L5.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))}};uk.exports=ck});var Wv=_((bC,dk)=>{"use strict";var fk=Sv(),j5=Ce();function La(e){fk.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}j5.inherits(La,fk);La.prototype.byteAt=function(e){return this.data[this.zero+e]};La.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};La.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]};La.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};dk.exports=La});var vk=_((hC,pk)=>{"use strict";var mk=Sv(),N5=Ce();function ja(e){mk.call(this,e)}N5.inherits(ja,mk);ja.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)};ja.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero};ja.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t};ja.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};pk.exports=ja});var Zv=_((gC,hk)=>{"use strict";var bk=Wv(),S5=Ce();function qv(e){bk.call(this,e)}S5.inherits(qv,bk);qv.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};hk.exports=qv});var xk=_((yC,yk)=>{"use strict";var gk=Zv(),W5=Ce();function Vv(e){gk.call(this,e)}W5.inherits(Vv,gk);Vv.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};yk.exports=Vv});var Rv=_((xC,Pk)=>{"use strict";var xu=Ce(),wk=$n(),q5=Wv(),Z5=vk(),V5=xk(),R5=Zv();Pk.exports=function(e){var t=xu.getTypeOf(e);return xu.checkSupport(t),t==="string"&&!wk.uint8array?new Z5(e):t==="nodebuffer"?new V5(e):wk.uint8array?new R5(xu.transformTo("uint8array",e)):new q5(xu.transformTo("array",e))}});var Xk=_((wC,Ok)=>{"use strict";var Dv=Rv(),Lr=Ce(),D5=_c(),zk=Qc(),wu=pa(),Pu=Lv(),H5=$n(),F5=0,M5=3,I5=function(e){for(var t in Pu)if(Object.prototype.hasOwnProperty.call(Pu,t)&&Pu[t].magic===e)return Pu[t];return null};function kk(e,t){this.options=e,this.loadOptions=t}kk.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=I5(this.compressionMethod),t===null)throw new Error("Corrupted zip : compression "+Lr.pretty(this.compressionMethod)+" unknown (inner file : "+Lr.transformTo("string",this.fileName)+")");this.decompressed=new D5(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===F5&&(this.dosPermissions=this.externalFileAttributes&63),e===M5&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=Dv(this.extraFields[1].value);this.uncompressedSize===Lr.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===Lr.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===Lr.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===Lr.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=H5.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=wu.utf8decode(this.fileName),this.fileCommentStr=wu.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var n=Lr.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var i=this.findExtraFieldUnicodeComment();if(i!==null)this.fileCommentStr=i;else{var r=Lr.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(r)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=Dv(e.value);return t.readInt(1)!==1||zk(this.fileName)!==t.readInt(4)?null:wu.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=Dv(e.value);return t.readInt(1)!==1||zk(this.fileComment)!==t.readInt(4)?null:wu.utf8decode(t.readData(e.length-5))}return null}};Ok.exports=kk});var jk=_((PC,Lk)=>{"use strict";var U5=Rv(),ar=Ce(),dn=jv(),G5=Xk(),J5=$n();function Tk(e){this.files=[],this.loadOptions=e}Tk.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 ("+ar.pretty(t)+", expected "+ar.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=J5.uint8array?"uint8array":"array",n=ar.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(dn.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(dn.CENTRAL_FILE_HEADER);)e=new G5({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(dn.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,dn.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(dn.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===ar.MAX_VALUE_16BITS||this.diskWithCentralDirStart===ar.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===ar.MAX_VALUE_16BITS||this.centralDirRecords===ar.MAX_VALUE_16BITS||this.centralDirSize===ar.MAX_VALUE_32BITS||this.centralDirOffset===ar.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(dn.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(dn.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,dn.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(dn.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(dn.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,dn.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=U5(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};Lk.exports=Tk});var Wk=_((zC,Sk)=>{"use strict";var Hv=Ce(),zu=fa(),C5=pa(),K5=jk(),E5=Fp(),Nk=vs();function Y5(e){return new zu.Promise(function(t,n){var i=e.decompressed.getContentWorker().pipe(new E5);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()})}Sk.exports=function(e,t){var n=this;return t=Hv.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:C5.utf8decode}),Nk.isNode&&Nk.isStream(e)?zu.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):Hv.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(i){var r=new K5(t);return r.load(i),r}).then(function(r){var a=[zu.Promise.resolve(r)],o=r.files;if(t.checkCRC32)for(var s=0;s<o.length;s++)a.push(Y5(o[s]));return zu.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=Hv.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 Zk=_((kC,qk)=>{"use strict";function Bt(){if(!(this instanceof Bt))return new Bt;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 Bt;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}Bt.prototype=lk();Bt.prototype.loadAsync=Wk();Bt.support=$n();Bt.defaults=Rp();Bt.version="3.10.1";Bt.loadAsync=function(e,t){return new Bt().loadAsync(e,t)};Bt.external=fa();qk.exports=Bt});function DX(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 wm(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 gc=(e,{matches:t})=>{let n=e.media_references??[],i=[];for(let a of t){let o=n.find(Q=>Q.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=HX(u.path,o.target_url),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(Q=>Q.kind!=="video"?Q:{...Q,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}),FX(l,u),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,d=u.recipe&&"frame_count"in u.recipe?u.recipe.frame_count:u.frame_count??null,m=d??null,p=f??o.source_fps??null;m!=null&&p?o.available_range={start:{value:0,rate:p},duration:{value:m,rate:p}}:u.keep_range_if_unknown||(o.available_range=null);let v=o.raw_extraction;v&&"proxyResolution"in v&&delete v.proxyResolution;let b=c.resolution_w,h=c.resolution_h,g=u.resolution_w??null,y=u.resolution_h??null,x=u.pixel_aspect??o.source_pixel_aspect??1,P=b!=null&&h!=null&&g!=null&&y!=null&&b*y!==g*h,T=g!=null&&y!=null,z=[];for(let Q of e.timelines??[]){let q=Q.resolution_w??0,G=Q.resolution_h??0;for(let E of Q.tracks??[])for(let B of E.items??[])if(B.media_reference_id===a.ref_id&&B.source_range){if(z.push({it:B}),P){let H=wm(b,h,1,q,G),ae=wm(g,y,x,q,G),R=H.kx!==0?ae.kx/H.kx:1,D=H.ky!==0?ae.ky/H.ky:1;typeof B.position_x=="number"&&(B.position_x*=R),typeof B.position_y=="number"&&(B.position_y*=D);for(let N of B.keyframes??[])if(N.parameter_path==="position"&&Array.isArray(N.value)){let J=N.value;typeof J[0]=="number"&&(J[0]*=R),typeof J[1]=="number"&&(J[1]*=D)}}if(T){let H=wm(g,y,x,q,G);B.render_base_w=H.baseW,B.render_base_h=H.baseH,B.render_pos_div_x=H.kx,B.render_pos_div_y=H.ky}}}let L="linked",S,w=!1,O=u.path.split(/[/\\]/).pop()??u.path,j=()=>{let Q=z.find(({it:q})=>(q.source_range.duration?.value??0)>m);if(Q){L="unbound",w=!0,S=`cut duration ${Q.it.source_range.duration?.value??0}f exceeds linked media ${O} extent ${m}f`;return}for(let{it:q}of z){let G=q.source_range.duration?.value??0,E=q.source_range.start.value;if(E<0||E+G>m){let B=Math.max(0,Math.floor((m-G)/2));q.source_range={...q.source_range,start:{...q.source_range.start,value:B}};let H=q.raw_extraction??(q.raw_extraction={});H.sourceConformedToMedia=!0}}};if(vc(o))o.content_kind==null&&(o.content_kind="still");else if(m==null)L="unbound",S=`matched ${O} by name but not probed \u2014 coverage unverified`;else if(c.timecode&&u.timecode!=null){let Q=u.fps??c.fps??0,q=Q>0?ke(c.timecode,Q):null,G=Q>0?ke(u.timecode,Q):null;if(q==null||G==null)L="unbound",S=`could not verify ${O} timecode placement \u2014 coverage unverified`;else{let E=q-G,B=z.find(({it:H})=>{let ae=H.source_range.start.value+E,R=H.source_range.duration?.value??0;return ae<0||ae+R>m});if(B)if(s!=="probed"&&q===0)j();else{L="unbound",w=!0;let ae=B.it.source_range.start.value+E,R=B.it.source_range.duration?.value??0;S=`cut [${ae}..${ae+R}] not within linked media ${O} [0..${m}] (source TC ${c.timecode} \u2192 ${u.timecode})`}else if(E!==0)for(let{it:H}of z){let ae=H.source_range.start.rate||1;H.source_range={...H.source_range,start:{...H.source_range.start,value:H.source_range.start.value+E}};for(let D of H.keyframes??[])if(!(!D.time||typeof D.time.value!="number"))if(D.parameter_path==="speed"){let N=E/ae;if(D.time.value===0&&D.value===0)continue;D.time={...D.time,value:Math.max(0,D.time.value+N)},typeof D.value=="number"&&(D.value=Math.max(0,D.value+N))}else{let N=D.time.rate||ae;D.time={...D.time,value:Math.max(0,D.time.value+E*(N/ae))}}let R=H.raw_extraction??(H.raw_extraction={});typeof R.alternateFrame=="number"&&(R.alternateFrame=G),R.sourceConformedToMedia=!0}}}else j();o.binding_state=L;let U;S?(o.coverage_reason=S,w&&(U=S)):delete o.coverage_reason,i.push({ref_id:a.ref_id,confidence:a.confidence,reasons:a.reasons??[],before:c,after:DX(u),...U?{warning:U}:{}})}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}}},l1=e=>/^(\/|\\\\|[A-Za-z]:[\\/]|file:)/i.test(e);function HX(e,t){if(!e||l1(e)||!/[\\/]/.test(e)||!t||!l1(t))return e;let n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"))+1;return t.slice(0,n)+e.slice(Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"))+1)}function FX(e,t){if(t.resolution_w==null&&t.timecode==null&&t.fps==null)return;for(let i of["avb_external_master_mob_id","avb_file_mob_id","avb_file_mob_kind"])delete e[i];let n=t.vendor_metadata?.avid;!n?.master_mob_id||!n.file_mob_id||!/[/\\]Avid MediaFiles[/\\]MXF[/\\]/i.test(t.path)||(e.avb_external_master_mob_id=n.master_mob_id,e.avb_file_mob_id=n.file_mob_id,e.avb_file_mob_kind=n.kind??"picture")}function Jn(e,t){return e.timelines?.find(n=>n.id===t)}function _i(e,t,n){let i=Jn(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 Cn(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 Qo(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 c1(e){let t=e.timeline_range.start.value;return[t,t+e.timeline_range.duration.value]}function MX(e,t,n,i){return n>t?(e.items??[]).filter(r=>{if(i&&r.id===i)return!1;let[a,o]=c1(r);return a<n&&t<o}):[]}function hr(e,t,n,i,r){let a={removed:0,trimmed:0,split:0},o=MX(t,n,i,r);if(o.length===0)return a;let s=new Set,c=[];for(let l of o){let[u,f]=c1(l);if(l.kind==="transition"||u>=n&&f<=i){s.add(l),a.removed++;continue}if(u<n&&f>i){let d=structuredClone(l);d.id=Qo(e,"ov-it"),d.timeline_range.start.value=i,d.timeline_range.duration.value=f-i,d.source_range&&(d.source_range.start.value+=i-u,d.source_range.duration.value=f-i),c.push(d),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 d=i-u;l.timeline_range.start.value=i,l.timeline_range.duration.value=f-i,l.source_range&&(l.source_range.start.value+=d,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),Cn(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 yc={head:null,tail:null};function IX(e,t){if(!t?.start||!t.duration||!e||e.content_kind==="still")return yc;let n=e.available_range,i=n?.duration?.value;if(!n||typeof i!="number"||!(i>1))return yc;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 Pm(e,t){if(!t.media_reference_id)return yc;let n=(e.media_references??[]).find(i=>i.id===t.media_reference_id);return IX(n,t.source_range)}function UX(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 GX(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 u1=(e,{timeline_id:t,item_id:n,edge:i,delta_frames:r,ripple:a})=>{let o=Jn(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",d=l.start.value,m=d+l.duration.value,p=Pm(e,c),v=Math.round(Number(r)||0),b=UX(i,v,l.duration.value,p,{startFrame:d,sourceStart:u?.start.value});if(b===0)return{summary:v===0?`Trim: "${f}" \u2014 no change`:`Trim: "${f}" won't move \u2014 ${GX(i,v,l.duration.value,p,d)}`,meta:{timeline_id:t,item_id:n,edge:i,delta_frames:0,asked:v,clamped:v!==0}};let h=0;if(i==="out"?(l.duration.value+=b,u&&(u.duration.value+=b),h=b):(l.start.value+=b,l.duration.value-=b,u&&(u.start.value+=b,u.duration.value-=b),h=-b),a&&h!==0)for(let x of s.items)x.id!==c.id&&x.timeline_range.start.value>=m&&(x.timeline_range.start.value+=h);let g={removed:0,trimmed:0,split:0};i==="in"&&b<0?g=hr(e,s,l.start.value,d,c.id):i==="out"&&b>0&&!a&&(g=hr(e,s,m,l.start.value+l.duration.value,c.id)),Nt(o);let y=b>0?"+":"";return{summary:`Trimmed ${i} of "${f}" by ${y}${b}f`+(a?" (rippled)":"")+(b!==v?" (limited by the media)":"")+$i(g),meta:{timeline_id:t,item_id:n,edge:i,delta_frames:b,asked:v,clamped:b!==v,ripple:!!a,cleared:g}}}return{summary:"Trim: item not found"}};var f1=(e,{timeline_id:t,item_id:n,delta_frames:i})=>{let r=_i(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}=Pm(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)),d=Math.max(0,a.source_range.start.value+f),m=d-a.source_range.start.value;if(a.source_range.start.value=d,m===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=m>0?"+":"";return{summary:`Slipped "${a.name??"clip"}" ${p}${m}f`+(m!==c?" (limited by the media)":""),meta:{timeline_id:t,item_id:n,delta_frames:m,asked:c,clamped:m!==c}}};var d1=(e,{timeline_id:t,item_id:n,item_ids:i,ripple:r})=>{let a=Jn(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(d=>o.includes(d.id)).map(d=>({track:f,item:d}))).sort((f,d)=>d.item.timeline_range.start.value-f.item.timeline_range.start.value);for(let{track:f,item:d}of s){let m=d.timeline_range.start.value,p=d.timeline_range.duration.value;if(f.items.splice(f.items.indexOf(d),1),r)for(let v of f.items)v.timeline_range.start.value>=m&&(v.timeline_range.start.value-=p)}for(let f of new Set(s.map(d=>d.track)))Cn(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}}};var zm="asked_changes";function km(e,t){let n=e,i=Array.isArray(n[zm])?n[zm]:[];i.includes(t)||(n[zm]=[...i,t])}function xc(e){return e==="fit"||e==="fill"||e==="stretch"||e==="none"}var JX=.005;function CX(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)<=JX}function Xm(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,d=1;l>u?d=l/u:l<u&&(f=u/l);let m=Math.max(s/a,c/o);return m>0||(m=1),[s*n/m,c/m,f,d]}function Tm(e,t,n,i){let r=Math.max(e/n,t/i);return r>0?r:1}function m1(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 _o(e,t){return`${e}\xD7${t}`}function KX(e,t){for(let n of e.tracks??[])if(n.kind==="Video"){for(let i of n.items??[])if(p1(i)&&(i.reframe_fit??"fit")!==t)return!0}return!1}function p1(e){let t=e.kind??"clip";return t==="clip"||t==="nested"}function v1(e,t,n,i){return e/n<t/i?"x":"y"}function EX(e,t,n,i,r){let a=e.reframe_fit;if(!a||a==="fit")return;let o=a==="none"?Tm(t,n,i,r):m1(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"&&(v1(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 b1(e,t,n,i,r,a){if(!n||!i||n<=0||i<=0){e.reframe_fit=t;return}h1(e,t,n,i,r,a)}function h1(e,t,n,i,r,a){if(e.reframe_fit=t,t==="fit")return;if(t==="none"){let s=Tm(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=m1(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;v1(n,i,r,a)==="x"?e.scale_x=(e.scale_x??s)*o:e.scale_y=(e.scale_y??s)*o}}function Om(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(!p1(l))continue;let{w:u,h:f,par:d}=t(l),m=!!u&&!!f&&u>0&&f>0;m&&o!=null&&EX(l,u,f,r,a);let[p,v,b,h]=Xm(u,f,d,n,i);l.render_base_w=p,l.render_base_h=v,l.render_pos_div_x=b,l.render_pos_div_y=h,l.raw_scale!=null&&m&&(l.raw_scale=(l.scale??100)/Tm(u,f,n,i)),m&&o!=null&&h1(l,o,u,f,n,i),s++}return o!=null&&(e.mismatch_policy=o),s}var g1=(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: ${_o(n,i)} \u2014 dimensions must be even`};let r=t?.fit??null;if(r!=null&&!xc(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=Jn(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,d=!1,m=!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,km(g,"reformat"),g.resolution_h=i,f+=Om(g,o,n,i,n,i,r),l.push(g.id);continue}if(y===n&&x===i){let T=r!=null&&KX(g,r),z=r!=null&&(g.mismatch_policy??"fit")!==r;if(T||z){T?f+=Om(g,o,n,i,y,x,r):r!=null&&(g.mismatch_policy=r),l.push(g.id),m=!0;continue}u.push({timeline_id:g.id,name:g.name??null,reason:`already ${_o(n,i)}`});continue}let P=!CX(y,x,n,i);if(P&&r==null){u.push({timeline_id:g.id,name:g.name??null,reason:`${_o(y,x)} \u2192 ${_o(n,i)} changes the aspect ratio \u2014 choose fit (bars), fill (crop), stretch (distort) or none (native pixels)`});continue}g.resolution_w=n,km(g,"reformat"),g.resolution_h=i,f+=Om(g,o,n,i,y,x,r),l.push(g.id),P&&(d=!0)}let p=l.length,v=f>0?` \xB7 ${f} clip${f===1?"":"s"}`:"",b=u.length>0?` \xB7 ${u.length} skipped`:"";return{summary:p===0?`Reformat: nothing changed \u2014 ${u[0]?.reason??"no eligible timeline"}`:m&&!d?`Reframed ${p} timeline${p===1?"":"s"} to ${r}${v}${b}`:`Reformatted ${p} timeline${p===1?"":"s"} to ${_o(n,i)}`+(d&&r?` (${r})`:"")+(v?`${v} re-based`:"")+b,meta:{resolution_w:n,resolution_h:i,fit:r??void 0,changed:l,skipped:u,clips_rebased:f,reframe_only:m}}};var YX=[{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}],y1=[...YX,{label:"47.952",num:48e3,den:1001},{label:"119.88",num:12e4,den:1001},{label:"120",num:120,den:1}];function lI(e){if(e==null||!Number.isFinite(e)||e<=0)return null;let t=null,n=1/0;for(let i of y1){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 wc(e,t){if(!(t>0))return"\u2014";let n=y1.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 Lm(e){return e==null||!Number.isFinite(e)?"?":wc(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 P1="conform.stringout",x1=(e,t)=>({value:e,rate:t}),w1=(e,t,n)=>({start:x1(e,n),duration:x1(t,n)});function Pc(e){return e.generated_by===P1}function AX(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 BX(e,t,n,i){let r=e.source_range,a=AX(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 QX(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=>!Pc(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 d of f.items??[]){if(d.kind!=="clip"||d.enabled===!1)continue;let m=d.media_reference_id?i.get(d.media_reference_id):void 0,p=m?.source_resolution_w,v=m?.source_resolution_h;if(!p||!v||p<=0||v<=0){l++;continue}let b=BX(d,m,t,n);if(!b){c++;continue}let h=d.source_range,g=h?.duration?.rate||h?.start?.rate||m?.available_range?.duration?.rate||o,y=d.pixel_aspect_ratio??m?.source_pixel_aspect??1;s.push({item:d,mrefId:d.media_reference_id??null,w:p,h:v,par:y>0?y:1,start:b.start,duration:b.duration,rate:g,name:d.name,reel:d.reel_name??null})}return{shots:s,fallbackRate:o,noRange:c,noRaster:l}}function _X(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 z1=(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}=QX(e,n,i),l=_X(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 z of l){let L=`${z.w}x${z.h}`,S=u.get(L);S?S.push(z):u.set(L,[z])}let f=[...u.entries()].sort((z,L)=>{let[S,w]=z[0].split("x").map(Number),[O,j]=L[0].split("x").map(Number);return O*j-S*w||O-S||j-w}),d=(e.timelines??[]).filter(z=>!Pc(z)),m=d[0]?.fps_num??Math.round(o*1e3),p=d[0]?.fps_den??1e3,v=p?m/p:o,b=0,h=z=>`so-${z}-${++b}`,g=[],y=(e.timelines??[]).length;for(let[,z]of f){let{w:L,h:S,par:w}=z[0],O=h("tl"),j=`${r} ${L}\xD7${S}${w!==1?` PAR ${$X(w)}`:""}`,U=[],Q=0;z.forEach((G,E)=>{U.push({id:h("it"),kind:"clip",item_index:E,name:G.name,enabled:!0,timeline_range:w1(Q,G.duration,v),source_range:w1(G.start,G.duration,G.rate||v),media_reference_id:G.mrefId,reel_name:G.reel,pixel_aspect_ratio:G.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:L*G.par,render_base_h:S,render_pos_div_x:1,render_pos_div_y:1,keyframes:[],effects:[]}),Q+=G.duration});let q={id:h("tr"),kind:"Video",track_index:0,name:"V1",enabled:!0,items:U};(e.timelines??=[]).push({id:O,name:j,kind:"primary",timeline_index:y++,fps_num:m,fps_den:p,resolution_w:L,resolution_h:S,pixel_aspect_ratio:w,start_frame:0,is_drop_frame:d[0]?.is_drop_frame??!1,duration_frames:Q,tracks:[q],markers:[],generated_by:P1}),g.push({id:O,name:j,w:L,h:S,clips:z.length})}let x=a.length-l.length,P=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(z=>`${z.w}\xD7${z.h}\xD7${z.clips}`).join(", ")}) \xB7 ${P}`+(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 $X(e){return Math.round(e*1e4)/1e4}var eT=["position","scale","rotation"];function zc(e,t){return t.length===0?[e,e]:[Math.min(...t),Math.max(...t)]}var tT={"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 nT(e,t){let n=new Map;for(let N of e.keyframes??[]){let J=N.parameter_path??"";if(!eT.some(ie=>J===ie||J.startsWith(ie+".")))continue;let ne=n.get(J)??[];ne.push(N.value),n.set(J,ne)}let i=N=>{let J=n.get(N);if(!J||J.length===0)return!1;let ne=JSON.stringify(J[0]);return J.some(ie=>JSON.stringify(ie)!==ne)},r=[...n.keys()].some(i),a=N=>typeof N=="number"?N:null,o=(N,J)=>(n.get(N)??[]).map(ne=>J?J(ne):a(ne)).filter(ne=>ne!=null),s=[...o("position",N=>Array.isArray(N)?a(N[0]):null),...o("position.x")],c=[...o("position",N=>Array.isArray(N)?a(N[1]):null),...o("position.y")],l=o("scale"),u=o("rotation"),f=e.position_x??0,d=e.position_y??0,m=e.scale??100,p=e.scale_x??null,v=e.scale_y??null,b=e.rotation??0,h=e;if(!(r||h.flip_horizontal===!0||h.flip_vertical===!0||Math.abs(f)>1e-9||Math.abs(d)>1e-9||Math.abs(m-100)>1e-9||p!=null&&Math.abs(p-m)>1e-9||v!=null&&Math.abs(v-m)>1e-9||Math.abs(b)>1e-9||s.some(N=>Math.abs(N)>1e-9)||c.some(N=>Math.abs(N)>1e-9)||l.some(N=>Math.abs(N-100)>1e-9)||u.some(N=>Math.abs(N)>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(N=>Math.abs(N??0)>1e-9)||(e.keyframes??[]).some(N=>(N.parameter_path??"").startsWith("crop")&&Math.abs(a(N.value)??0)>1e-9))return{verdict:"kept",reason:"cropped"};if(t){let N=t.sourcePar??1;if(Math.abs(N-1)>1e-4)return{verdict:"kept",reason:"mixed-format"};let J=t.sourceW??0,ne=t.sourceH??0;if(J>0&&ne>0&&Math.abs(J/ne-t.frameAr)/t.frameAr>.005)return{verdict:"kept",reason:"mixed-format"}}let z=t?.frameAr??16/9,[L]=zc(m,l),[S,w]=zc(f,s),[O,j]=zc(d,c),[U,Q]=zc(b,u),q=Math.max(Math.abs(S),Math.abs(w)),G=Math.max(Math.abs(O),Math.abs(j)),B=Math.max(Math.abs(U),Math.abs(Q))*Math.PI/180,H=Math.cos(B)+z*Math.sin(B),ae=(p!=null&&l.length===0?p:L)/100,R=(v!=null&&l.length===0?v:L)/100;return ae>=H+2*q-1e-6&&R>=H+2*G-1e-6||(t?.surface??"node")!=="input"?{verdict:"moves"}:{verdict:"kept",reason:"revealing"}}function rT(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 iT(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=nT(l,{frameAr:r,sourceW:u?.source_resolution_w,sourceH:u?.source_resolution_h,sourcePar:u?.source_pixel_aspect,transitionOverlap:rT(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 k1=(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=iT(u,e);a+=f.moves,o+=f.kept;for(let[d,m]of Object.entries(f.reasons)){let p=d;s[p]=(s[p]??0)+(m??0)}}let c=Object.entries(s).sort((u,f)=>(f[1]??0)-(u[1]??0)).map(([u,f])=>`${f} ${tT[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 O1=(e,t)=>({value:e,rate:t}),kc=(e,t,n)=>({start:O1(e,n),duration:O1(t,n)});function aT(e){let t=e.streams??[];return t.length?t.some(n=>n.kind==="video"):e.content_kind!=="audio"}function oT(e){let t=e.streams??[];return t.length?t.some(n=>n.kind==="audio"):e.content_kind==="audio"||e.content_kind==="video_audio"}function sT(e){return(e.streams??[]).find(t=>t.kind==="audio")?.channels??null}function X1(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:Qo(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 jm(e){return e.display_name?e.display_name:(e.target_url??"").split("/").pop()||e.id}var T1=(e,t)=>{let n=(e.timelines??[]).find(S=>S.id===t.timeline_id);if(!n)return{summary:"Add clip: timeline not found"};let i=(e.media_references??[]).find(S=>S.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=aT(i),u=!t.without_audio&&oT(i),f=l?"Video":"Audio",d=t.track_id?(n.tracks??[]).find(S=>S.id===t.track_id):null;if(t.track_id&&!d)return{summary:"Add clip: track not found"};if(d&&d.kind!==f)return{summary:`Add clip: ${d.name??d.id} is a ${d.kind} track`};let m=d??X1(e,n,f),p=0;for(let S of m.items??[]){let w=S.timeline_range.start.value+S.timeline_range.duration.value;w>p&&(p=w)}typeof t.at_frame=="number"&&Number.isFinite(t.at_frame)&&(p=Math.max(0,Math.round(t.at_frame)));let v=hr(e,m,p,p+c),b=i.source_pixel_aspect??1,[h,g,y,x]=Xm(i.source_resolution_w,i.source_resolution_h,b,n.resolution_w??0,n.resolution_h??0),P=xc(t.fit)?t.fit:xc(n.mismatch_policy)?n.mismatch_policy:"fit",T={id:Qo(e,"ac-it"),kind:"clip",item_index:(m.items??[]).length,name:jm(i),enabled:!0,timeline_range:kc(p,c,r),source_range:kc(s,c,o),media_reference_id:i.id,reel_name:i.reel_name??null,pixel_aspect_ratio:b,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:h,render_base_h:g,render_pos_div_x:y,render_pos_div_y:x,keyframes:[],effects:[]};b1(T,P,i.source_resolution_w,i.source_resolution_h,n.resolution_w??0,n.resolution_h??0),(m.items??=[]).push(T),m.items.sort((S,w)=>S.timeline_range.start.value-w.timeline_range.start.value),Cn(m);let z=null;if(u&&l){let S=X1(e,n,"Audio");S.audio_channel_count==null&&(S.audio_channel_count=sT(i)),hr(e,S,p,p+c);let w={id:Qo(e,"ac-it"),kind:"clip",item_index:(S.items??[]).length,name:jm(i),enabled:!0,timeline_range:kc(p,c,r),source_range:kc(s,c,o),media_reference_id:i.id,reel_name:i.reel_name??null,keyframes:[],effects:[]};(S.items??=[]).push(w),S.items.sort((O,j)=>O.timeline_range.start.value-j.timeline_range.start.value),Cn(S),z={track:S,item:w}}Nt(n);let L=z?"picture + sound":l?"picture":"sound";return{summary:`Added "${jm(i)}" (${L}) to ${n.name??"timeline"} at ${p}f (${c}f)`+$i(v),meta:{timeline_id:n.id,track_id:m.id,item_id:T.id,media_reference_id:i.id,at_frame:p,duration_frames:c,ref_added:i===t.media_reference,fit:P,cleared:v,audio_track_id:z?.track.id??null,audio_item_id:z?.item.id??null}}};function lT(e,t){let n=new Set((e.timelines??[]).map(r=>r.id)),i=1;for(;n.has(`${t}-${i}`);)i++;return`${t}-${i}`}function cT(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 L1=(e,t)=>{let n=e.timelines??[];if(t.timeline_id&&n.some(d=>d.id===t.timeline_id))return{summary:`New timeline: id "${t.timeline_id}" is already in the session`};let i=t.timeline_id||lT(e,"nt-tl"),r=t.name||cT(e),a=n.find(d=>d.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 uT(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 j1=(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:uT(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 N1=(e,t)=>{let n=e.timelines??[],i=d=>n.find(m=>m.id===d||m.name===d),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(d=>d.kind==="Video").sort((d,m)=>d.track_index-m.track_index)[o-1];if(!s)return{summary:`Stack track: ${a.name} has no V${o}`};let c=(r.tracks??[]).filter(d=>d.kind==="Video").length,l=new Set((r.tracks??[]).flatMap(d=>[d.id,...d.items.map(m=>m.id)])),u=d=>{let m=`stk-${d}`,p=1;for(;l.has(m);)m=`stk-${d}-${p++}`;return l.add(m),m},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 d of f.items)d.id=u(d.id);return(r.tracks??=[]).push(f),{summary:`Stacked ${a.name}'s V${o} (${f.items.filter(d=>d.kind==="clip").length} clips) onto ${r.name} as V${c+1}`,meta:{timeline_id:r.id,track:c+1,track_id:f.id}}};function fT(e){let t=e;return t.finish_ops??=[]}var S1=(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=_i(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=fT(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 W1=(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 q1=(e,t)=>{let n=(e.timelines??[]).find(m=>m.id===t.timeline_id);if(!n)return{summary:"Move: timeline not found"};let i,r,a=-1;for(let m of n.tracks??[]){let p=(m.items??[]).findIndex(v=>v.id===t.item_id);if(p>=0){i=m,r=m.items[p],a=p;break}}if(!i||!r)return{summary:"Move: clip not found"};let o=t.to_track_id?(n.tracks??[]).find(m=>m.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=hr(e,o,l,l+c,r.id);if(o!==i){let m=i.items.findIndex(p=>p.id===r.id);i.items.splice(m>=0?m:a,1),(o.items??=[]).push(r)}r.timeline_range.start.value=l,o.items.sort((m,p)=>m.timeline_range.start.value-p.timeline_range.start.value),Cn(i),o!==i&&Cn(o),Nt(n);let f=o!==i?` to ${o.name??"track"}`:"",d=l!==s?` to ${l}f`:"";return{summary:`Moved "${r.name??"clip"}"${f}${d}${$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 dT(e){let t=0;for(let n of e.tracks??[])t+=(n.items??[]).length;return t}var Z1=(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=Jn(e,t?.timeline_id);if(!r)return{summary:"Frame rate: timeline not found"};let a=wc(r.fps_num??0,r.fps_den??0),o=wc(n,i);if(r.fps_num===n&&r.fps_den===i)return{summary:`Frame rate: already ${o} fps`};let s=dT(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 mT=["crop_left","crop_right","crop_top","crop_bottom"],pT={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"},Nm=(e,t,n)=>Math.min(n,Math.max(t,e));function ea(e){return typeof e=="number"&&Number.isFinite(e)?e:null}var V1=(e,t)=>{let n=_i(e,t.timeline_id,t.item_id);if(!n)return{summary:"Transform: clip not found"};let i=n.item,r=[],a=(m,p)=>{i[m]!==p&&(i[m]=p,r.push(m))},o=ea(t.scale);o!=null&&a("scale",Nm(o,.01,1e5));let s=ea(t.opacity);s!=null&&a("opacity",Nm(s,0,100));let c=ea(t.position_x);c!=null&&a("position_x",c);let l=ea(t.position_y);l!=null&&a("position_y",l);let u=ea(t.rotation);u!=null&&a("rotation",u);for(let m of mT){let p=ea(t[m]);p!=null&&a(m,Nm(p,0,100))}if(r.length===0)return{summary:"Transform: nothing changed"};let f=i.name??t.item_id;return{summary:`Set ${r.map(m=>pT[m]??m).join(", ")} on "${f}"`,meta:{timeline_id:t.timeline_id,item_id:t.item_id,changed:r}}};var vT=e=>!!e&&typeof e=="object"&&Number.isFinite(e.value)&&Number.isFinite(e.rate)&&e.rate>0,R1=(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,d)=>typeof f=="number"&&Number.isFinite(f)?{value:f,rate:r}:vT(f)?f:f==null&&d?d:null,o=new Set((i.tracks??[]).flatMap(f=>(f.items??[]).map(d=>d.id))),s=new Set((i.markers??[]).map(f=>f.id)),c=[],l=[];(t.markers??[]).forEach((f,d)=>{let m=f??{},p=`marker ${d}${typeof m.name=="string"?` "${m.name}"`:""}`;if(typeof f!="object"||f===null)return void l.push(`${p}: not an object`);let v=a(m.time??m.frame);if(!v)return void l.push(`${p}: time must be timeline frames or {value, rate}, got ${JSON.stringify(m.time??m.frame)}`);if(v.value<0)return void l.push(`${p}: time ${v.value} is before the timeline start`);let b=a(m.duration,{value:1,rate:v.rate});if(!b||b.value<0)return void l.push(`${p}: duration must be frames or {value, rate}, got ${JSON.stringify(m.duration)}`);let h=typeof m.item_id=="string"?m.item_id:null;if(h&&!o.has(h))return void l.push(`${p}: no item ${h} on this timeline`);let g=typeof m.id=="string"&&m.id?m.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:{},...m,id:g,time:v,duration:b,item_id:h,name:typeof m.name=="string"?m.name:null,note:typeof m.note=="string"?m.note:null,color:typeof m.color=="string"?m.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 F1="generated_by",bT="conform.add_handles",Sm=e=>typeof e[F1]=="string"||Pc(e);function hT(e,t){return t<0?`${e}_TRIM_${-t}FR`:`${e}_${t}FR_HANDLES`}function ri(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&&!Qi(e)&&vc(e);function $o(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 qm(e,t,n,i){let r=$o(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 D1=(e,t)=>({value:e,rate:t}),H1=(e,t,n)=>({start:D1(e,n),duration:D1(t,n)});function Zm(e,t,n,i,r,a,o,s){return{id:e,kind:"clip",item_index:0,name:t.name,enabled:!0,timeline_range:H1(o,r,s),source_range:H1(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 es(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:{},[F1]:o}}function gT(e,t){let n=e.timelines??[];return t?n.find(i=>i.id===t):n.find(i=>i.kind==="primary"&&!Sm(i))??n[0]}var M1=(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=gT(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 h of e.media_references??[])h.id&&r.set(h.id,h);let a=[];(i.tracks??[]).filter(h=>h.kind==="Video").forEach((h,g)=>{for(let y of h.items??[])y.kind==="clip"&&a.push({item:y,track:g})}),a.sort((h,g)=>h.item.timeline_range.start.value-g.item.timeline_range.start.value||h.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,d=0;for(let{item:h}of a){let g=h.media_reference_id?r.get(h.media_reference_id):void 0,y=h.source_range,x=z=>l.push({item_id:h.id,name:h.name,reason:z});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 P=qm(y.start.value,y.start.value+y.duration.value,n,g);if(!P){x(n<0?`shorter than the ${-n*2}-frame trim`:"cut lies outside the media's extent");continue}P.clamped&&n>0&&f++,P.unverified&&d++;let T=P.end-P.start;c.push(Zm(`ah${s}-it-${c.length+1}`,h,g.id,P.start,T,y.start.rate||o,u,o)),u+=T}if(c.forEach((h,g)=>h.item_index=g),c.length===0)return{summary:`Add handles: no usable video clips on "${i.name}"`,meta:{skipped:l}};let m=ri(t?.name?.trim()||hT(i.name,n),(e.timelines??[]).map(h=>h.name)),p=`ah${s}-tl`,v={id:`ah${s}-v1`,kind:"Video",track_index:0,name:"V1",enabled:!0,items:c};(e.timelines??=[]).push(es(i,p,m,s,[v],u,bT));let b=n>0?`\xB1${n}f handles`:`trimmed ${-n}f each end`;return{summary:`New timeline "${m}": ${c.length} clip${c.length===1?"":"s"}, ${b}`+(f?` \xB7 ${f} clamped at the media's ends`:"")+(d?` \xB7 ${d} unprobed (tail handle not checked against the file)`:"")+(l.length?` \xB7 ${l.length} skipped`:""),meta:{timeline_id:p,name:m,source_timeline_id:i.id,handles:n,clips:c.length,clamped:f,unverified:d,skipped:l}}};var yT="conform.all_clips",xT="_REF|_REFERENCE| REF",ts=e=>e.replace(/\\/g,"/").replace(/\/+$/,"").split("/").pop()??"",U1=(e,t)=>e.source_fps||e.available_range?.duration?.rate||t;function G1(e,t){return e.source_timecode?ke(e.source_timecode,U1(e,t)):null}function wT(e,t){let i=(ts(e.target_url??"")||e.display_name||"").replace(/\.[^.]*$/,"").replace(/[._ ]?\[\d+\s*-\s*\d+\]/,"");return Qi(e)&&(i=i.replace(/[._ ]\d{3,}$/,"")),i=i.trim().toLowerCase(),!i&&e.reel_name&&(i=`reel:${e.reel_name.trim().toLowerCase()}`),i?`${i}@${U1(e,t).toFixed(3)}`:null}function PT(e){let t=$o(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 zT(e,t){let n=new Map;for(let a of e){let o=wT(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:G1(a.mref,t),uses:[]}),c.uses.push(a)}let i=[];for(let a of n.values()){let o=[...a.keys()],s=o.filter(d=>a.get(d).tc!=null),c=new Map(s.map(d=>[d,d])),l=d=>c.get(d)===d?d:l(c.get(d)),u=new Map(s.map(d=>[d,PT(a.get(d))]));for(let d=0;d<s.length;d++)for(let m=d+1;m<s.length;m++){let[p,v]=[u.get(s[d]),u.get(s[m])];p[0]<v[1]&&v[0]<p[1]&&c.set(l(s[d]),l(s[m]))}let f=new Map;for(let d of o){let m=c.has(d)?l(d):`alone:${d}`;f.has(m)||f.set(m,new Map),f.get(m).set(d,a.get(d))}for(let d of f.values())i.push({members:d,aligned:[...d.values()].every(m=>m.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 Kn=(e,t,n)=>(e.aligned?t.tc:0)+n,Vm=e=>(e.source_resolution_w??0)*(e.source_resolution_h??0),Oc=e=>e.kind==="missing",I1=e=>{let t=e.display_name||ts(e.target_url??"")||e.id,n=ts((e.target_url??"").replace(/\\/g,"/").replace(/\/[^/]*$/,""));return n?`${t} (${n})`:t};function kT(e){let t=[...e.members.values()].flatMap(l=>l.uses.map(u=>[Kn(e,l,u.start),Kn(e,l,u.end)])),n=l=>{let u=$o(l.mref);return l.tc!=null&&!!u&&t.every(([f,d])=>l.tc+u.start<=f&&d<=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[Oc(u)?0:1,Vm(u),$o(u)?.end??0,-i.indexOf(l)]},o=r.reduce((l,u)=>{let[f,d]=[a(l),a(u)];for(let m=0;m<f.length;m++)if(f[m]!==d[m])return f[m]>d[m]?l:u;return l}),s=[];!Oc(e.members.get(o).mref)&&i.some(l=>l!==o&&Oc(e.members.get(l).mref))&&s.push("online");let c=r.filter(l=>l!==o).map(l=>Vm(e.members.get(l).mref));return c.length&&Vm(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 OT(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(Kn(e,t[n],r.start)<Kn(e,t[i],a.end)&&Kn(e,t[i],a.start)<Kn(e,t[n],r.end))return"overlap";return"separate"}function XT(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 TT(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=(h,g)=>Kn(l,l.members.get(h.mref.id),g),f=new Map;for(let h of c){let g=f.get(h.mref.id);g?(h.start<g.lo&&(g.lo=h.start,g.first=h),g.hi=Math.max(g.hi,h.end)):f.set(h.mref.id,{lo:h.start,hi:h.end,first:h})}let d=[...f.values()].reduce((h,g)=>{let y=h.hi-h.lo,x=g.hi-g.lo;return x>y||x===y&&u(g.first,g.lo)<u(h.first,h.lo)?g:h}),m=Math.min(...c.map(h=>u(h,h.start))),p=Math.max(...c.map(h=>u(h,h.end)));a.push({...d.first,start:d.lo,end:d.hi,track:1,at:o+u(d.first,d.lo)-m});let v=c.filter(h=>!(h.mref.id===d.first.mref.id&&h.start===d.lo&&h.end===d.hi)).sort((h,g)=>u(h,h.start)-u(g,g.start)||u(g,g.end)-u(h,h.end)),b=[];for(let h of v){let g=u(h,h.start),y=b.findIndex(x=>x<=g);y<0&&(b.push(0),y=b.length-1),b[y]=u(h,h.end),a.push({...h,track:y+2,at:o+g-m})}o+=p-m+n}return a}var J1=(e,t={})=>{let n=t??{},i=Math.max(0,Math.round(Number(n.handles??0))||0),r=(e.timelines??[]).filter(R=>n.timeline_ids?.length?n.timeline_ids.includes(R.id):R.kind==="primary"&&!Sm(R));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??xT).split("|").map(R=>R.toUpperCase()).filter(Boolean),c=new Map;for(let R of e.media_references??[])R.id&&c.set(R.id,R);let l={disabled:0,reference:0,still:0,image_sequence:0,offline:0,no_media:0,no_range:0,nested:0},u=0,f=[],d=R=>(ts(R.target_url??"").split(".").pop()??"").toLowerCase(),m=R=>{let N=((typeof R=="string"?R.split(/[,|]/):R)??[]).map(J=>J.trim().replace(/^\./,"").toLowerCase()).filter(Boolean);return N.length?new Set(N):null},p=m(n.still_extensions),v=m(n.sequence_extensions),b=R=>v?v.has(d(R))&&Qi(R):Qi(R),h=R=>p?p.has(d(R)):Wm(R),g=new Map((e.timelines??[]).map(R=>[R.id,R])),y=(R,D)=>{let N=R.nested_timeline_id?g.get(R.nested_timeline_id):void 0,J=R.source_range;if(!N||!J||D>3)return[];let[ne,ie]=[J.start.value,J.start.value+J.duration.value];return(N.tracks??[]).filter(ee=>ee.kind==="Video").flatMap(ee=>ee.items??[]).flatMap(ee=>{if(ee.kind==="nested")return y(ee,D+1);let ce=ee.timeline_range.start.value,ve=ce+ee.timeline_range.duration.value,Ze=Math.max(ce,ne),ye=Math.min(ve,ie);if(ee.kind!=="clip"||!ee.source_range||ye<=Ze)return[];let Ve=(ee.speed??100)/100;return[{...ee,timeline_range:{start:{...R.timeline_range.start,value:R.timeline_range.start.value+(Ze-ne)},duration:{...ee.timeline_range.duration,value:ye-Ze}},source_range:{start:{...ee.source_range.start,value:ee.source_range.start.value+(Ze-ce)*Ve},duration:{...ee.source_range.duration,value:(ye-Ze)*Ve}}}]})};for(let R of r){let D=[];(R.tracks??[]).filter(N=>N.kind==="Video").forEach((N,J)=>(N.items??[]).forEach(ne=>{if(ne.kind==="nested"&&n.include_nested!==!1)for(let ie of y(ne,1))D.push({item:ie,track:J});else D.push({item:ne,track:J})})),D.sort((N,J)=>N.item.timeline_range.start.value-J.item.timeline_range.start.value||N.track-J.track);for(let{item:N}of D){if(N.kind==="nested"){l.nested++;continue}if(N.kind!=="clip")continue;if(N.enabled===!1&&!n.include_disabled){l.disabled++;continue}let J=N.media_reference_id?c.get(N.media_reference_id):void 0;if(!J){l.no_media++;continue}let ne=[N.name,J.display_name,ts(J.target_url??"")].filter(Boolean).map(ee=>ee.toUpperCase());if(!n.include_references&&(J.role==="reference"||ne.some(ee=>s.some(ce=>ee.includes(ce))))){l.reference++;continue}if(b(J)){if(n.include_image_sequences===!1){l.image_sequence++;continue}}else if(h(J)&&!n.include_stills){l.still++;continue}if(Oc(J)&&n.include_offline===!1){l.offline++;continue}let ie=N.source_range;if(!ie||!(ie.duration.value>0)){l.no_range++;continue}N.speed!=null&&N.speed!==100&&u++,f.push({pos:f.length,item:N,mref:J,start:ie.start.value,end:ie.start.value+ie.duration.value,rate:ie.start.rate||o,group:-1})}}if(f.length===0)return{summary:"All clips: nothing to gather after the filters",meta:{skipped:l}};let x=zT(f,o),P=[];for(let[R,D]of x.entries()){if(D.members.size<2)continue;let N=OT(D),J=[...D.members.values()].map(ve=>I1(ve.mref)),{best:ne,reason:ie}=kT(D),ee=[...D.members.values()].reduce((ve,Ze)=>ve+Ze.uses.length,0),ce=!!n.reduce_duplicates&&!!ne;if(ce){let ve=D.members.get(ne);for(let[Ze,ye]of D.members)if(Ze!==ne){for(let Ve of ye.uses)Object.assign(Ve,{mref:ve.mref,start:Kn(D,ye,Ve.start)-ve.tc,end:Kn(D,ye,Ve.end)-ve.tc}),ve.uses.push(Ve);D.members.delete(Ze)}}P.push({group:R,kind:N,clips:J,uses:ee,best:ne?I1(c.get(ne)):null,reason:ie,reduced:ce})}let T=0,z=0;for(let R of f){if(!i)continue;let D=qm(R.start,R.end,i,R.mref);D.clamped&&T++,D.unverified&&z++,R.start=D.start,R.end=D.end}let L=new Map,S=R=>(L.has(R.id)||L.set(R.id,G1(R,o)),L.get(R.id)),w=R=>n.order==="source_tc"?R.sort((D,N)=>{let J=S(D.mref),ne=S(N.mref);return J==null!=(ne==null)?J==null?1:-1:(J==null?0:J+D.start-(ne+N.start))||D.pos-N.pos}):R.sort((D,N)=>D.pos-N.pos),O=R=>R.map(D=>({mref:D.mref,item:D.item,start:D.start,end:D.end,rate:D.rate,pos:D.pos,group:D.group,track:1,at:0})),j=R=>{if(n.stack)return TT(w(O(R)),x,Math.round(o));let D=0;return w(XT(R)).map(N=>{let J={...N,at:D};return D+=N.end-N.start,J})},U=(e.timelines??[]).map(R=>R.name),Q=n.name?.trim()||`All_Clips_Timeline_${i}FR_HANDLES`,q=new Map(P.map(R=>[R.group,R])),G=[],E=(R,D,N)=>{let J=(e.timelines??[]).length,ne=`ac${J}`,ie=Math.max(1,...R.map(ye=>ye.track)),ee=Array.from({length:ie},(ye,Ve)=>({id:`${ne}-v${Ve+1}`,kind:"Video",track_index:Ve,name:`V${Ve+1}`,enabled:!0,items:R.filter(Pe=>Pe.track===Ve+1).sort((Pe,Ft)=>Pe.at-Ft.at).map((Pe,Ft)=>Zm(`${ne}-it-${Ve+1}-${Ft+1}`,Pe.item,Pe.mref.id,Pe.start,Pe.end-Pe.start,Pe.rate,Pe.at,o))}));ee.forEach(ye=>ye.items.forEach((Ve,Pe)=>Ve.item_index=Pe));let ce=Math.max(0,...R.map(ye=>ye.at+ye.end-ye.start)),ve=ri(D,U);U.push(ve);let Ze=es(a,`${ne}-tl`,ve,J,ee,ce,yT);if(Object.assign(Ze,{start_frame:0},N?{resolution_w:N[0],resolution_h:N[1]}:{}),n.mark_duplicates!==!1){let ye=[];for(let Ve of R){let Pe=q.get(Ve.group);Pe&&ye.push({id:`${ne}-dup-${ye.length+1}`,name:"Duplicate footage",color:"Yellow",kind:null,note:`${Pe.clips.length} clips hold this footage: ${Pe.clips.join(", ")} \xB7 `+(Pe.kind==="overlap"?"the same frames are cut in from different clips":"different parts of one camera clip come from different copies")+(Pe.reduced?` \xB7 this timeline uses ${Pe.best}`:Pe.best?` \xB7 best version: ${Pe.best} (${Pe.reason})`:` \xB7 ${Pe.reason}`),time:{value:Ve.at,rate:o},duration:{value:Ve.end-Ve.start,rate:o},item_id:null,raw_extraction:{},source_element_id:null,metadata:{}})}Ze.markers=ye}return(e.timelines??=[]).push(Ze),G.push({id:Ze.id,name:ve,clips:R.length,tracks:ie,resolution:N?`${N[0]}x${N[1]}`:null}),Ze},B=j(f);if(E(B,Q,null),n.per_resolution){let R=new Map;for(let N of f){let J=N.mref.source_resolution_w,ne=N.mref.source_resolution_h,ie=J&&ne?`${J}x${ne}`:"unknown";(R.get(ie)??R.set(ie,[]).get(ie)).push(N)}let D=[...R.keys()].sort((N,J)=>{let ne=N==="unknown"?-1:N.split("x").map(Number).reduce((ee,ce)=>ee*ce);return(J==="unknown"?-1:J.split("x").map(Number).reduce((ee,ce)=>ee*ce))-ne||N.localeCompare(J)});for(let N of D){let J=N==="unknown"?null:N.split("x").map(Number);if(!n.disable_non_matching){E(j(R.get(N)),`${Q}_${N==="unknown"?"UNKNOWN_RES":N}`,J);continue}let ne=E(j(f),`${Q}_${N==="unknown"?"UNKNOWN_RES":N}`,J),ie=new Set(R.get(N).map(ee=>ee.mref.id));for(let ee of ne.tracks)for(let ce of ee.items)ie.has(String(ce.media_reference_id))||(ce.enabled=!1)}}let H=Object.values(l).reduce((R,D)=>R+D,0),ae=G[0].clips;return{summary:`All clips: ${f.length} use${f.length===1?"":"s"} from ${r.length} timeline${r.length===1?"":"s"} \u2192 ${ae} piece${ae===1?"":"s"} on "${G[0].name}"${n.stack?` (stacked, ${G[0].tracks} tracks)`:""}`+(i?` \xB7 \xB1${i}f handles${T?` (${T} clamped)`:""}`:"")+(G.length>1?` \xB7 ${G.length-1} per-resolution timeline${G.length===2?"":"s"}`:"")+(P.length?` \xB7 ${P.length} duplicate footage group${P.length===1?"":"s"}${P.some(R=>R.reduced)?` (${P.filter(R=>R.reduced).length} reduced)`:""}`:"")+(u?` \xB7 ${u} retimed clip${u===1?"":"s"} land at 100%`:"")+(H?` \xB7 ${H} skipped`:""),meta:{timelines:G,sources:r.length,uses:f.length,handles:i,clamped:T,unverified:z,retimed:u,skipped:l,duplicates:P}}};var C1=e=>e.fps_den?e.fps_num/e.fps_den:24,K1=(e,t={})=>{let n=e.timelines??[],i=t.timeline_ids?.length?t.timeline_ids.map(b=>n.find(h=>h.id===b||h.name===b)):n.filter(b=>b.kind==="primary"),r=(t.timeline_ids??[]).filter((b,h)=>!i[h]);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=C1(o),c=Math.max(0,Math.round(t.gap_frames??0)),l=[],u=(b,h,g)=>{let y=l.find(x=>x.kind===b&&x.track_index===h);return y||(y={...structuredClone({...g,items:[]}),id:`join-${b[0].toLowerCase()}${h+1}`,track_index:h,items:[]},l.push(y)),y},f=[],d=0,m=0;a.forEach((b,h)=>{let g=s/C1(b),y=Math.round((b.duration_frames??Math.max(0,...(b.tracks??[]).flatMap(P=>(P.items??[]).map(T=>T.timeline_range.start.value+T.timeline_range.duration.value))))*g);t.mark!==!1&&f.push({id:`join-m${h+1}`,name:b.name,color:"Blue",kind:null,note:`from ${b.name}`,time:{value:d,rate:s},duration:{value:1,rate:s},item_id:null,raw_extraction:{},source_element_id:null,metadata:{}});let x=new Map;for(let P of b.tracks??[]){let T=x.get(P.kind)??0;x.set(P.kind,T+1);let z=u(P.kind,T,P);for(let L of P.items??[]){if(L.kind==="gap")continue;let S=structuredClone(L);S.id=`j${h+1}-${L.id}`,S.timeline_range={start:{value:d+Math.round(L.timeline_range.start.value*g),rate:s},duration:{value:Math.round(L.timeline_range.duration.value*g),rate:s}};for(let w of S.markers??[])w.id=`j${h+1}-${w.id}`,w.item_id=S.id;z.items.push(S),m++}}for(let P of b.markers??[])f.push({...structuredClone(P),id:`j${h+1}-${P.id}`,time:{value:d+Math.round(P.time.value*g),rate:s}});d+=y+c});for(let b of l)b.items.sort((h,g)=>h.timeline_range.start.value-g.timeline_range.start.value),b.items.forEach((h,g)=>{h.item_index=g});l.sort((b,h)=>b.kind===h.kind?b.track_index-h.track_index:b.kind==="Video"?-1:1);let p=ri(t.name?.trim()||`${o.name}_JOINED`,n.map(b=>b.name)),v=es(o,`join-${n.length+1}`,p,n.length,l,d-c,"conform.join");return v.markers=f,Nt(v),e.timelines.push(v),{summary:`Joined ${a.length} timelines (${a.map(b=>b.name).join(" + ")}) into ${p}: ${m} items, ${v.duration_frames} frames`,meta:{timeline_id:v.id,name:p,timelines:a.length,items:m}}};var E1=(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 Rm={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\./}},Y1=e=>e.source_range?[e.source_range.start.value,e.source_range.start.value+e.source_range.duration.value]:null,ns=(e,t)=>e.rate===t?e.value:e.value*t/e.rate,Dm=e=>e.tracks.filter(t=>t.kind==="Video").flatMap(t=>t.items.map(n=>({it:n,track:t.track_index}))),A1=(e,t)=>{let n=e.timelines??[],i=v=>n.find(b=>b.id===v||b.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(Rm).filter(v=>s[v]!==!1)).filter(v=>Rm[v]),l=structuredClone(o);l.id=`carry-${o.id.replace(/\W+/g,"")}`,l.name=ri(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 b of v.items)b.id=`${l.id}-${b.id}`}let u=Dm(a),f=new Map,d=0,m=[];for(let{it:v}of Dm(l)){let b=Y1(v);if(!b||!v.media_reference_id)continue;let h=u.map(({it:g,track:y})=>{let x=g.media_reference_id===v.media_reference_id?Y1(g):null;return{a:g,track:y,common:x?Math.min(x[1],b[1])-Math.max(x[0],b[0]):0}}).filter(g=>g.common>0).sort((g,y)=>y.common-g.common||y.track-g.track)[0];if(!h){m.push(v.name??v.id);continue}f.has(h.a)||f.set(h.a,v);for(let g of c){let{fields:y,paths:x}=Rm[g];for(let P of y)v[P]=structuredClone(h.a[P]??null);v.keyframes=[...(v.keyframes??[]).filter(P=>!x.test(P.parameter_path)),...structuredClone((h.a.keyframes??[]).filter(P=>x.test(P.parameter_path)))]}d++}let p=t.markers===!1?null:LT(a,l,u,f);return e.timelines.push(l),{summary:`Carry: "${l.name}" \u2014 ${d} clip(s) took ${c.join(", ")} from "${a.name}"${m.length?`; ${m.length} new (no clip of the same media in A): ${m.slice(0,8).join(", ")}${m.length>8?" \u2026":""}`:""}${p?`; ${p.carried} marker(s) carried${p.dropped.length?`, ${p.dropped.length} dropped`:""}`:""}`,meta:{timeline_id:l.id,carried:d,new_material:m,what:c,...p?{markers:p}:{}}}};function LT(e,t,n,i){let r={carried:0,kept_in_place:0,duplicates:0,dropped:[]},a=(u,f)=>[ns(u.timeline_range.start,f),ns(u.timeline_range.start,f)+ns(u.timeline_range.duration,f)],o=Dm(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,d=u.time.value,m=u.name??"",p=u.item_id?l.get(u.item_id):n.filter(({it:y})=>y.enabled!==!1&&a(y,f)[0]<=d&&d<a(y,f)[1]).sort((y,x)=>x.track-y.track)[0]?.it,v,b;if(p){let y=i.get(p);if(!y||!p.source_range||!y.source_range){r.dropped.push({name:m||(p.name??p.id),reason:"its shot is gone from the new cut"});continue}let x=u.item_id?1:(p.speed??100)/100,P=u.item_id?1:(y.speed??100)/100,T=ns(p.source_range.start,f)+(d-a(p,f)[0])*x;if(v=Math.abs(P)<1e-6?a(y,f)[0]:a(y,f)[0]+Math.round((T-ns(y.source_range.start,f))/P),v<a(y,f)[0]||v>=a(y,f)[1]){r.dropped.push({name:m||(p.name??p.id),reason:"the frame it marks was trimmed out of the new cut"});continue}u.item_id&&(b=y)}else{if(u.item_id){r.dropped.push({name:m,reason:"its clip is not a video clip of the old cut"});continue}if(v=d,v<0||v>=s){r.dropped.push({name:m,reason:"past the end of the new cut"});continue}r.kept_in_place++}let h=`${Math.round(v)}|${m}`;if(c.has(h)){r.duplicates++;continue}c.add(h);let g={...structuredClone(u),id:`${t.id}-m${(t.markers??[]).length}`,time:{value:v,rate:f},item_id:b?.id??null};(t.markers??=[]).push(g),r.carried++}return r}var Hm={relink:gc,slip:f1,delete:d1,trim:u1,reformat:g1,stringout:z1,node_sizing:k1,add_clip:T1,new_timeline:L1,add_track:j1,stack_track:N1,finish_op:S1,delete_track:W1,move_clip:q1,timeline_rate:Z1,transform:V1,add_markers:R1,add_handles:M1,all_clips:J1,join:K1,carry:A1,remove_audio:E1};function B1(e){return Hm[e]}var jT=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});jT.decode();var Fm=new TextEncoder;"encodeInto"in Fm||(Fm.encodeInto=function(e,t){let n=Fm.encode(e);return t.set(n),{read:e.length,written:n.length}});var hU=8*1024*1024;var SU=new TextEncoder,WU=new TextDecoder;var qU=256*1024;var ZU=new Uint8Array(0);var Mm=["resolve-otio","resolve-xmeml","premiere-xmeml","flame-fcpxml","flame-xmeml","flame-archive","resolve-drt","avid-aaf","resolve-aaf","avid-avb","premiere-prproj","premiere-otio","baselight-blscene","finalcut-fcpxmld","protools-aaf","protools-ptx","session_json"],Q1=["premiere-prproj","resolve-drt","flame-archive","avid-avb","resolve-xmeml"],_1=["resolve-otio","flame-fcpxml","avid-aaf","resolve-aaf","premiere-otio","session_json"],$1=["baselight-blscene","finalcut-fcpxmld","protools-ptx","protools-aaf"],e0=[],Xc={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 t0(e){return e==="Video"?"V":e==="Audio"?"A":e?.[0]??"T"}function Im(e,t){let n=e.name?.trim();if(n)return n;let i=Um(e.kind,t),r=i.indexOf(e);return r<0&&e.id&&(r=i.findIndex(a=>a?.id===e.id)),r<0?`${t0(e.kind)}${Math.max(1,Math.abs(e.track_index??0))}`:`${t0(e.kind)}${r+1}`}function Um(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 WT=["proxy","prx","low","offline","rough","preview","comp","temp","draft","h264","dnxhr","prores"];function Tc(e,t,n,i={}){let r=DT(i),a=[],o=[],s=[],c=new Map,l=JT(t),u=IT(n.fileExtensions),f=u?l.filter(m=>u.has(MT(m.filename))):l;for(let m of e){let p=[];for(let x of f){let P=HT(m,x,n,r);if(P.confidence>0){let T=rs(m,x,r);p.push({candidate:x,contains:T.known&&T.contains,confidence:P.confidence,reasons:P.reasons})}else P.refusal&&!c.has(m.id)&&c.set(m.id,{candidate_id:x.id,reason:P.refusal})}if(p.sort((x,P)=>P.confidence-x.confidence),p.length===0){o.push(m.id);continue}let v=p[0].confidence,b=p.filter(x=>v-x.confidence<.05),h=b.filter(x=>x.contains);if(h.length===1&&!b[0].contains){let x=p.indexOf(h[0]);p.splice(x,1),p.unshift(h[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:m.id,candidate_ids:[g,...y].map(x=>x.candidate.id)}),a.push({proxy_id:m.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 m=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=ii(y.filename).toLowerCase(),P=v.get(x);P?P.push(y):v.set(x,[y])}let b=a.filter(y=>y.confidence>=.5),h=new Set,g=[];for(let y of b){let x=m.get(y.proxy_id),P=p.get(y.candidate_id);if(!x||!P)continue;let T=ZT(ii(x.filename),ii(P.filename));T&&h.add(T);let z=x.original_path??x.id,L=VT(z,P.path);L&&g.push(L)}if(h.size>0||g.length>0){let y=[];for(let x of o){let P=m.get(x);if(!P){y.push(x);continue}let T=null,z=null;for(let S of h){let w=(ii(P.filename)+S).toLowerCase(),O=v.get(w);if(O&&O.length>0){T=qT(P,O,r),z=`filename pattern inferred (${S} suffix)`;break}}if(!T&&P.original_path)for(let S of g){let w=RT(P.original_path,S);if(!w)continue;let O=w.toLowerCase();for(let j of f){let U=(j.path??"").replace(/\\/g,"/").toLowerCase();if(U&&U.endsWith(O)){T=j,z="directory proximity";break}}if(T)break}let L=T?rs(P,T,r):null;T&&L?.known&&!L.contains?(c.has(P.id)||c.set(P.id,{candidate_id:T.id,reason:`cut not within linked media ${T.filename} (inferred name ${z??""})`}),y.push(x)):T?a.push({proxy_id:P.id,candidate_id:T.id,matched_path:T.path??T.filename,confidence:.5,reasons:z?[z]:[]}):y.push(x)}o.length=0,o.push(...y)}}let d=o.filter(m=>c.has(m)).map(m=>({proxy_id:m,...c.get(m)}));return{matches:a,unmatched:o,ambiguous:s,refusals:d}}function qT(e,t,n){return t.length===1?t[0]:t.find(r=>rs(e,r,n).contains)??t[0]}function Lc(e,t,n,i,r){if(n==null||i==null||t==null)return{known:!1,contains:!1};let a=ke(n,r);if(a==null)return{known:!1,contains:!1};let o=ke(e??"00:00:00:00",r)??0;return{known:!0,contains:o<=a&&a+i<=o+t}}function rs(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 Lc(t.timecode_start,r,e.cut_timecode_start,e.cut_duration_frames,i)}function ZT(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 VT(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 RT(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 DT(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 HT(e,t,n,i){let r=[],a=0;if(n.fileName)if(n.fileNameMode==="tight"){if(ii(e.filename)!==ii(t.filename))return{confidence:0,reasons:[]};a+=.6,r.push("exact filename")}else{let s=jc(En(e.filename),En(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=En(e.filename).toLowerCase(),f=En(t.filename).toLowerCase(),d=u===f||f.startsWith(u)||u.startsWith(f);if(l&&!d)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=Ao(e.filename)||Ao(t.filename);if(!o)if(e.tc_unrecorded){let s=rs(e,t,i);s.known&&s.contains&&(a+=.2,r.push("cut within source timecode range"))}else{let s=rs(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=ke(e.cut_timecode_start??"00:00:00:00",c)??0,u=ke(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=ke(e.cut_timecode_start??e.timecode_start??"00:00:00:00",c),u=ke(t.timecode_start??"00:00:00:00",c),f=e.duration_seconds!=null?Math.round(e.duration_seconds*c):null,d=t.duration_seconds!=null?Math.round(t.duration_seconds*c):null;if(l!=null&&u!=null)if(f!=null&&d!=null)if(Math.max(l,u)<Math.min(l+f,u+d))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+d}]`};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:FT(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&&!Ao(e.filename)&&!Ao(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(UT(t.container,e.container))a+=.05,r.push(`container ${t.container}`);else return{confidence:0,reasons:[]};if(n.codec&&e.codec&&t.codec)if(GT(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 ii(e){return e.replace(/\.[^.]+$/,"").toLowerCase()}function En(e){let t=ii(e);t=t.replace(/[-_]s\d{3}$/i,""),t=t.replace(/[-_]+v\d+$/i,"");let n=new Set(WT);return t.split(/[-_\s]+/).filter(i=>i&&!n.has(i)).join("_")}function FT(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 jc(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 MT(e){let t=e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""}function IT(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 UT(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 GT(e,t){let n=gm(e),i=gm(t);if(n&&i)return n===i;let r=e.toLowerCase(),a=t.toLowerCase();return r.includes(a)||a.includes(r)}function JT(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 CT(e){return e?e.split(/[/\\]/).pop()??"":""}var KT={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 Yn(e,t){let n=e.length,i=0;for(let r of e)r!=null&&r!==""&&i++;return n0(i,n,t)}function n0(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 ${KT[n]}.`}:{populated:e,total:t,available:!0,unavailable_reason:null}}function ET(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 Nc(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 r0(e){let t=e.length,i=e.map(r=>CT(r.target_url)).filter(r=>r.length>0).length;return{fileName:n0(i,t,"fileName"),timecode:Yn(e.map(r=>r.source_timecode),"timecode"),reelName:Yn(e.map(r=>r.reel_name),"reelName"),totalDuration:Yn(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:Yn(e.map(r=>r.source_resolution_w&&r.source_resolution_h?`${r.source_resolution_w}\xD7${r.source_resolution_h}`:null),"resolution"),bitDepth:Yn(e.map(r=>Nc(r)),"bitDepth"),frameRate:Yn(e.map(r=>r.source_fps??null),"frameRate"),fileFormat:Yn(e.map(r=>r.container??null),"fileFormat"),codec:Yn(e.map(r=>r.codec??null),"codec"),mediaUmid:Yn(e.map(r=>ET(r)),"mediaUmid")}}function a0(e){let t=Sc(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:Nc(e),media_umid:e.vendor_metadata?.umid??null,facts_origin:e.source_facts_origin??null}}function o0(e){return{...a0(e),path:e.local_path??e.target_url??null}}function s0(e,t){let n=a0(t),i=l0(e,t);i&&(n.cut_timecode_start=i.tcStart,n.cut_duration_frames=i.durFrames);let r=ke(t.source_timecode,t.source_fps??24);return(t.source_facts_origin??"declared")!=="probed"&&(r==null||r===0)&&(n.tc_unrecorded=!0),n}function l0(e,t){let n=t.source_fps??24,i=ke(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:We(r,n,xm(t.source_timecode)),durFrames:Math.max(0,a-r)}}var ta=/_S\d{3}$/i,An=e=>((e??"").split(/[/\\]/).pop()??"").replace(/\.[^.]+$/,"");function aG(e,t,n){let i=[];if(!t.filter(c=>ta.test(An(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=An(c.target_url).toLowerCase();if(!l||ta.test(l))continue;let u=t.filter(z=>{let L=An(z.target_url).toLowerCase();return L===l||ta.test(L)&&L.replace(ta,"")===l});if(!u.some(z=>ta.test(An(z.target_url))))continue;let f=c.source_fps??24,d=ke(c.source_timecode,f),m=o.filter(z=>z.media_reference_id===c.id&&z.source_range);if(d==null||m.length===0)continue;let p=xm(c.source_timecode),v=(z,L,S)=>Lc(z.source_timecode,z.available_range?.duration?.value??null,We(L,f,p),S,f).contains,b=l0(a,c);if(b&&u.some(z=>!ta.test(An(z.target_url))&&Lc(z.source_timecode,z.available_range?.duration?.value??null,b.tcStart,b.durFrames,f).contains))continue;let h=new Map,g=!0;for(let z of m){let L=d+z.source_range.start.value,S=u.find(w=>v(w,L,z.source_range.duration?.value??0));if(!S){g=!1;break}h.set(S,[...h.get(S)??[],z])}if(!g)continue;let y=[...h].sort((z,L)=>An(z[0].target_url).localeCompare(An(L[0].target_url))),x=[],P=An(c.target_url),T=structuredClone(c);y.forEach(([z,L],S)=>{let w=An(z.target_url),O=U=>{if(!U)return U;let Q=Math.max(U.lastIndexOf("/"),U.lastIndexOf("\\"))+1,q=U.slice(Q);return q.startsWith(P)?U.slice(0,Q)+w+q.slice(P.length):U},j=S===0?c:{...structuredClone(T),id:`${c.id}~${w.slice(-4)}`};j.target_url=O(T.target_url)??j.target_url,T.local_path&&(j.local_path=O(T.local_path)??j.local_path);for(let U of L)U.media_reference_id=j.id;S>0&&s.push(j),x.push(j.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 c0(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 d=r.get(f.candidate_id);d&&(a.push({ref_id:f.proxy_id,to:{path:d.local_path??d.target_url??"",size_bytes:d.size_bytes??null,resolution_w:d.source_resolution_w??null,resolution_h:d.source_resolution_h??null,codec:d.codec??null,container:d.container??null,fps:d.source_fps??null,bit_depth:Nc(d),reel_name:d.reel_name??null,timecode:d.source_timecode??null,recipe:d.recipe??null,frame_count:d.available_range?.duration?.value??null,pixel_aspect:d.source_pixel_aspect??null,bitrate_bps:d.bitrate_bps??null,local_path:d.local_path??null,vendor_metadata:d.vendor_metadata??null,reel_sources:d.reel_sources??null},confidence:f.confidence,reasons:f.reasons}),o.add(d.id))}let s=YT(e)?structuredClone(e):e,l=gc(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 YT(e){return Object.isFrozen(e)||Object.isFrozen(e.media_references??{})||(e.media_references??[]).some(t=>Object.isFrozen(t)||Object.isFrozen(t.metadata??{}))}function Sc(e){return e?e.split(/[/\\]/).pop()??"":""}var i0=(e,t)=>`${Sc(e)}|${t}`,AT=2;function u0(e,t){let n=new Map,i=new Map;for(let c of t){n.set(i0(c.source_path,c.source_in),c);let l=Sc(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 d=u.source_range?.start?.value??0,m=f.target_url??"",p=n.get(i0(m,d));if(!p&&m&&(p=BT(i.get(Sc(m)),d)),!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 b=u.source_range?.duration??{value:p.render_frames,rate:p.rate};if(u.source_range={start:{value:p.lead_handle,rate:p.rate},duration:b},p.render_start_frame!=null){let h=u.raw_extraction??(u.raw_extraction={});h.alternateFrame=p.render_start_frame}o++}return{matched:o,unmatched:s}}function BT(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>AT||r))return n}async function f0(e){await ti();try{return hc(G9(e))}catch{return null}}async function d0(e){await ti();try{return hc(U9(e))}catch{return null}}var QT=/\.(dpx|exr|tif|tiff|cin|ari|arx|jpg|jpeg|png)$/i;function Gm(e){if(!QT.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 _T=new Set([".png",".jpg",".jpeg",".jpe",".jfif",".tif",".tiff",".exr",".dpx",".dng",".cr3"]),$T=new Set([".webp",".avif",".heic",".heif",".gif",".bmp"]),Jm=e=>_T.has(at(e).toLowerCase());async function Cm(e){let t=at(e).toLowerCase();if($T.has(t))throw new Error(`${K(e)}: ${t.slice(1)} stills are not decoded by the engine yet \u2014 save it as PNG or JPEG`);let n=t===".png"?f0:t===".jpg"||t===".jpeg"||t===".jpe"||t===".jfif"?d0:t===".dpx"?E9:t===".exr"?bc:t===".tif"||t===".tiff"?Q9:t===".dng"?A9:t===".cr3"?B9:null;if(!n)throw new Error(`unsupported still: ${K(e)}`);let i=await n(await lt(e));if(!i)throw new Error(`could not decode ${K(e)}`);return{rgba:new Uint8Array(i.rgba.buffer,i.rgba.byteOffset,i.rgba.byteLength),width:i.width,height:i.height}}var eL=["none","rle","zips","zip","piz","pxr24","b44","b44a","dwaa","dwab"];async function m0(e){let t=await Y9(await lt(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 TG(e){let t=at(e).toLowerCase(),n={file:K(e),width:null,height:null,fps:null,timecode:null};if(t===".exr"){let r=await m0(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 K9(t.slice(1),C9(await lt(e)));if(r)Object.assign(n,{width:r.width,height:r.height});else{let a=await Cm(e);Object.assign(n,{width:a.width,height:a.height})}}let i=Gm(K(e));if(i){let r=[],a=K(e),o=K(e);for await(let l of it(Ke(e))){let u=l.isFile?Gm(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 m0(C(Ke(e),a)).catch(()=>null))?.timecode??null),!c&&n.timecode&&n.fps){let l=ke(n.timecode,n.fps);l!=null&&(c=We(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 LG(e){let t=e.fps?String(Math.round(e.fps*1e3)/1e3):null;return[`${e.file}: still${e.exr?` OpenEXR (${eL[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 v0=.35,tL=e=>(/\.[^./]+$/.exec(e)?.[0]??"").toLowerCase();async function nL(e,t){let n=await t(await lt(e));if(!n)throw new Error(`could not decode ${K(e)}`);return n}async function rL(e,t){if(e.codec==="still")return Cm(e.path);if(e.codec==="exr"){let n=await $9(e.path);return nL(n.frames[t]??n.frames[0],bc)}return n1(e.path,t,e.codec)}async function is(e){if(Jm(e)&&tL(e)!==".exr")return{path:e,name:K(e),fps:24,start:0,df:!1,frames:1,codec:"still"};let t=await ni(e),n=t.streams?.find(a=>a.kind==="video");if(!n)throw new Error(`${K(e)} has no video`);let i=t.source_fps??n.rate??24,r=t.source_timecode??null;return{path:e,name:K(e),fps:i,start:r?ke(r,i)??0:0,df:!!r?.includes(";"),frames:t.available_range?.duration?.value??0,codec:(n.codec??"").toLowerCase()}}var $e=(e,t)=>We(e.start+t,e.fps,e.df);function ai(e,t){if(e.codec==="still")return 0;let n=t==null?Math.floor(e.frames/2):Bo(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 FG(e){if(e.out_path&&!/\.png$/i.test(e.out_path))throw new Me("invalid_args",`out_path must be a .png file (${K(e.out_path)})`);let t=await is(e.path),n=ai(t,e.frame),i=e.b?await is(e.b):null,r=i?e.b_frame!=null?ai(i,e.b_frame):ai(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},(z,L)=>(L-Math.floor(a/o))*o),c=s.length>1||!!i,l=[{clip:t,frames:s.map(z=>n+z)}];i&&l.push({clip:i,frames:s.map(z=>r+z)});let u=[];for(let z of l){let L=[];for(let S of z.frames){if(S<0||z.clip.frames&&S>=z.clip.frames){L.push(null);continue}let w=await rL(z.clip,S),O=e.width??(c?Math.min(w.width,480):w.width),j=O===w.width?{rgba:w.rgba,w:w.width,h:w.height}:iL(w.rgba,w.width,w.height,O);L.push({...j,label:`${i?z.clip===t?"A ":"B ":""}${$e(z.clip,S)} f${S}`})}u.push(L)}let f=u.flat().filter(Boolean);if(!f.length)throw new Error("no frame in range");let d=Math.max(...f.map(z=>z.w)),m=Math.max(...f.map(z=>z.h)),p=Math.max(1,Math.round(d/240)),v=c?7*p+6:0,b=c?4:0,h=s.length*d+(s.length-1)*b,g=l.length*(m+v)+(l.length-1)*b,y=new Uint8Array(h*g*4);for(let z=3;z<y.length;z+=4)y[z]=255;u.forEach((z,L)=>z.forEach((S,w)=>{if(!S)return;let O=w*(d+b),j=L*(m+v+b);for(let U=0;U<S.h;U++)y.set(S.rgba.subarray(U*S.w*4,(U+1)*S.w*4),((j+U)*h+O)*4);c&&oL(y,h,O+3,j+m+3,S.label,p)}));let x=e.out_path??C(await Ai("conform-frame-"),`${t.name.replace(/\.[^.]+$/,"")}_${$e(t,n).replace(/[:;]/g,"")}${i?"_AB":a?`_pm${a}`:""}.png`);await Yi(x,await cL(y,h,g));let P=l.flatMap(z=>z.frames.filter(L=>L>=0&&(!z.clip.frames||L<z.clip.frames)).map(L=>({file:z.clip.name,frame:L,tc:$e(z.clip,L)}))),T;if(i){let z=s.map((w,O)=>({o:w,a:u[0][O],b:u[1][O]})).filter(w=>w.a&&w.b),L=w=>({w:w.w,h:w.h,y:Array.from({length:w.w*w.h},(O,j)=>w.rgba[j*4+1])}),S=await _r({op:"pairs",pairs:z.map(w=>[L(w.a),L(w.b)])});T=z.map((w,O)=>{let j=S.distance[O]??1/0;return{a_frame:n+w.o,b_frame:r+w.o,tc:$e(t,n+w.o),distance:j,same:j<=v0}})}return{out_path:x,w:h,h:g,frames:P,...T?{diff:T}:{}}}function MG(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${v0} = 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 iL(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)),d=0,m=0,p=0,v=0;for(let h=s;h<c;h++)for(let g=u;g<f;g++){let y=(h*t+g)*4;d+=e[y],m+=e[y+1],p+=e[y+2],v++}let b=(o*i+l)*4;a[b]=d/v,a[b+1]=m/v,a[b+2]=p/v,a[b+3]=255}}return{rgba:a,w:i,h:r}}var aL={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 oL(e,t,n,i,r,a){for(let o of r){let s=aL[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 d=((i+c*a+u)*t+n+l*a+f)*4;e[d]=e[d+1]=e[d+2]=255}}n+=6*a}}var sL=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 lL(e){let t=4294967295;for(let n of e)t=sL[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}async function cL(e,t,n){let i=new Uint8Array(n*(t*3+1));for(let f=0,d=0;f<n;f++){i[d++]=1;for(let m=0;m<t;m++){let p=(f*t+m)*4;for(let v=0;v<3;v++)i[d++]=e[p+v]-(m?e[p+v-4]:0)&255}}let r=new Uint8Array(await new Response(new Blob([i]).stream().pipeThrough(new CompressionStream("deflate"))).arrayBuffer()),a=(f,d)=>{let m=new Uint8Array(12+d.length),p=new DataView(m.buffer);return p.setUint32(0,d.length),m.set(new TextEncoder().encode(f),4),m.set(d,8),p.setUint32(8+d.length,lL(m.subarray(4,8+d.length))),m},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,d)=>f+d.length,0)),u=0;for(let f of c)l.set(f,u),u+=f.length;return l}async function b0(e){let t=await is(e.a),n=await is(e.b),i=e.a_in!=null?ai(t,e.a_in):0,r=e.a_out!=null?ai(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?ai(n,e.b_in):null,o=await _r({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=m=>({a_in:m.aIn,a_out:m.aOut,a_tc:$e(t,m.aIn),verdict:m.verdict,offset:m.offset,confidence:m.confidence,...m.ambiguous?{ambiguous:m.ambiguous}:{},cost:m.cost}),[c,l]=o.aRange,u=o.bIn,f=s(o.overall),d=o.flash.map(m=>m.kind==="inside"?`B has a shot change inside the range that A does not, at B ${$e(n,m.at.b)} (A ${$e(t,m.at.a)}): a flash frame / wrong shot`:m.kind==="early"?`B cuts ${m.frames} frame(s) before the head (B ${$e(n,m.at.b)}): a ${m.frames}-frame slip early shows the previous shot`:`B cuts ${m.frames} frame(s) after the tail (B ${$e(n,m.at.b)}): a slip late shows the next shot`);return a!=null&&f.offset&&d.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(m=>({a_cut:m.aCut,tc:$e(t,m.aCut+1),in_b:m.inB})),flash:d}}function IG(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 p0=(e,t)=>[...e].sort((n,i)=>n.track_index-i.track_index).indexOf(t)+1;function uL(e,t){let n=e.timelines.filter(h=>!t.timeline||h.id===t.timeline||h.name===t.timeline),i=t.item_id?n.find(h=>h.tracks.some(g=>g.items.some(y=>y.id===t.item_id))):n.find(h=>h.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?Bo(t.record,r,We(a,r,o)):null,c=i.tracks.filter(h=>h.kind==="Video"),l;if(t.item_id){for(let h of c)for(let g of h.items)g.id===t.item_id&&(l={it:g,tr:h});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 h=t.track?c.filter(g=>p0(c,g)===t.track):c.filter(g=>g.enabled!==!1);for(let g of[...h].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 ${We(a+s,r,o)}`)}let{it:u,tr:f}=l,d=e.media_references.find(h=>h.id===u.media_reference_id),m=d?.local_path??d?.target_url?.replace(/^file:\/\//,"");if(!m||!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 b=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:m,frame:b,item:u.id,track:f.name??`V${f.track_index}`,record_tc:We(a+p+v,r,o),video_track:p0(c,f),record_start:p}}var Km=new Map,Em=null,fL=0;async function dL(e,t,n,i,r,a){if(r==="offline"){let m=e.timelines.find(h=>!i||h.id===i||h.name===i)??e.timelines[0],{offlineLane:p}=await import("./framing-PHFTZ4GL.js"),{lane:v,media:b}=await p(e,m);m.tracks.push(v),e.media_references.push(...b);try{return await dL(e,t,n,i,m.tracks.filter(h=>h.kind==="Video").length)}finally{m.tracks.splice(m.tracks.indexOf(v),1),e.media_references=e.media_references.filter(h=>!b.includes(h))}}let o=uL(e,{record:t,timeline:i,track:r});if(Jm(o.path))return null;let s=Km.get(o.path);s||(s=is(o.path),Km.set(o.path,s),s.catch(()=>Km.delete(o.path)));let c=await s;if(c.codec==="still")return null;let l=await(Em??=D9().catch(m=>{throw Em=null,m})),u=C(Te(),"tmp",`picture-${process.pid}-${fL++%1024}.raw`);await Se(C(Te(),"tmp"));let f=await l.ask({op:"picture",path:o.path,frame:ai(c,o.frame),width:n,out:u,...a?{lut:a}:{}});if(!f.ok)throw f.why?.startsWith("the analysis engine exited")&&(Em=null),new Error(f.why==="no_picture"?`no picture at frame ${o.frame} of ${K(o.path)}`:f.why??"no picture");let d=await lt(u);return await Co(u).catch(()=>{}),{w:f.w,h:f.h,px:d,order:f.order??"rgba"}}var mL=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"]),pL={...i1,fileName:!0,fileNameMode:"tight"};function _G(e){return{...pL,...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 $G(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 as=e=>e.replace(/\.[^.]+$/,"");async function eJ(e,t,n=2e3,i={}){let r=i.exts?.length?new Set(i.exts.map(f=>f.replace(/^\./,"").toLowerCase())):mL,a=t.map(f=>En(as(K(f.target_url??f.reel_name??"")).toLowerCase())).filter(Boolean),o=new Set(t.map(f=>ym(K(f.target_url??""))?.clipBase.toLowerCase()).filter(Boolean)),s=f=>{if(!a.length||i.byName===!1)return!0;let d=ym(f)?.clipBase.toLowerCase();if(d&&o.has(d))return!0;let m=En(as(f.toLowerCase()));return!!m&&a.some(p=>jc(p,m)>=.5)},c=[],l=!1;async function u(f,d){if(d>12||l)return;let m=[];try{for await(let p of it(f))m.push(p)}catch{return}for(let p of m){if(p.name.startsWith("."))continue;let v=C(f,p.name);if(p.isDirectory){await u(v,d+1);continue}if(!p.isFile)continue;let b=at(p.name).slice(1).toLowerCase();if(!(!r.has(b)||!s(p.name))&&(c.push(v),c.length>=n)){l=!0;return}}}return await u(e,0),{paths:c,capped:l}}async function tJ(e,t){let n=t.split(/[/\\]/).filter(Boolean),i=K(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=C(e,...a);try{if((await Ei(o)).isFile)return o}catch{}}return null}async function nJ(e){let t=[],n=[],i=new Set,r=0;for(let a of e){let o=await t1(a).catch(()=>[a]);if(!i.has(o[0])){o.forEach(s=>i.add(s));try{let s=await ni(o[0]);s.id=`cand-${++r}`,s.binding_state="unbound",t.push(s)}catch(s){n.push(`${K(a)}: ${s.message.slice(0,80)}`),t.push({id:`cand-${++r}`,kind:"external",target_url:o[0],local_path:o[0],reel_name:as(K(o[0])),binding_state:"unbound",streams:[],raw_extraction:{},metadata:{}})}}}return{refs:t,failed:n}}function rJ(e,t,n,i,r){let a=t.map(f=>s0(e,f)),o=n.map(o0),s=Tc(a,o,i,r),c=Tc(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 d=s.matches.find(b=>b.proxy_id===f.id),m=s.ambiguous.find(b=>b.proxy_id===f.id),p=s.refusals?.filter(b=>b.proxy_id===f.id).map(b=>`${K(l.get(b.candidate_id)?.target_url??b.candidate_id)}: ${b.reason}`).join("; "),v=new Set;for(let b of c.matches)b.proxy_id===f.id&&b.candidate_id!==d?.candidate_id&&v.add(b.candidate_id);for(let b of c.ambiguous)b.proxy_id===f.id&&b.candidate_ids.forEach(h=>h!==d?.candidate_id&&v.add(h));if(m&&m.candidate_ids.forEach(b=>v.add(b)),!d&&!m&&!v.size){let b=En(as(K(f.target_url??"")).toLowerCase()),h=n.map(g=>({c:g,s:jc(b,En(as(K(g.target_url??"")).toLowerCase()))})).filter(g=>g.s>=.4).sort((g,y)=>y.s-g.s)[0];h&&v.add(h.c.id)}return{ref_id:f.id,name:K(f.target_url??f.reel_name??f.id),status:d?"matched":m?"ambiguous":"unmatched",candidate:d?l.get(d.candidate_id):void 0,confidence:d?.confidence??0,reasons:d?.reasons??[],alternatives:[...v].map(b=>l.get(b)).filter(Boolean),refusal:p||void 0}}),result:s,candidates:n,config:i}}var h0=24;async function iJ(e,t){let n=[],i=r=>{let a=r.source_fps??r.available_range?.duration.rate??0;return{fps:a,tc:r.source_timecode?ke(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 Ei(o)).isFile&&(s=await ni(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)-h0/2),f=Math.min(l-1,u+h0-1),d=[...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)])],m=new Map;for(let x of d){let P=t.candidates.find(L=>L.id===x),T=P?.local_path??P?.target_url?.replace(/^file:\/\//,""),z=P&&i(P);if(!(!P||!T||z?.tc==null||Math.abs(z.fps-c.fps)>.01))try{let L=await b0({a:o,b:T,a_in:u,a_out:f,b_in:c.tc+u-z.tc,search:2});m.set(x,L.overall.verdict==="offset"?`offset ${L.overall.offset>0?"+":""}${L.overall.offset}`:L.overall.verdict)}catch(L){m.set(x,`unreadable (${String(L.message??L).slice(0,80)})`)}}let p=d.filter(x=>m.get(x)==="exact"),v=x=>t.candidates.find(P=>P.id===x),b=x=>(v(x).target_url??x).replace(/^file:\/\//,"").split("/").slice(-2).join("/"),h=d.filter(x=>m.has(x)).map(x=>`${b(x)}: ${m.get(x)}`).join(", "),g=r.candidate?.id,y=x=>m.has(x)&&m.get(x)!=="exact"&&m.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(P=>P.id!==p[0]&&P.id!==x?.id)],x&&(r.refusal=[r.refusal,`picture: ${b(x.id)} is ${m.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: ${h} (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=[]);h&&n.push(`picture ${r.ref_id} ${r.name}: ${h}`)}return n}function vL(e,t,n,i){let r=o=>o.streams?.find(s=>s.kind==="video");return[["file name",i.fileName,K(t.target_url??""),K(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,at(t.target_url??"").slice(1)||"\u2014",at(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 aJ(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 c0(e,t.candidates,i,!0)}var g0=Te(),y0=C(g0,"locations.json");async function Ym(){try{return JSON.parse(await Ye(y0))}catch{return[]}}async function oJ(e){await Se(g0);let t=(await Ym()).filter(n=>n!==e);await Re(y0,JSON.stringify([e,...t].slice(0,12)))}function x0(e){let t=e.media_references??[],n=r0(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 p0=(e,t)=>[...e].sort((n,i)=>n.track_index-i.track_index).indexOf(t)+1;function uL(e,t){let n=e.timelines.filter(h=>!t.timeline||h.id===t.timeline||h.name===t.timeline),i=t.item_id?n.find(h=>h.tracks.some(g=>g.items.some(y=>y.id===t.item_id))):n.find(h=>h.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?Bo(t.record,r,We(a,r,o)):null,c=i.tracks.filter(h=>h.kind==="Video"),l;if(t.item_id){for(let h of c)for(let g of h.items)g.id===t.item_id&&(l={it:g,tr:h});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 h=t.track?c.filter(g=>p0(c,g)===t.track):c.filter(g=>g.enabled!==!1);for(let g of[...h].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 ${We(a+s,r,o)}`)}let{it:u,tr:f}=l,d=e.media_references.find(h=>h.id===u.media_reference_id),m=d?.local_path??d?.target_url?.replace(/^file:\/\//,"");if(!m||!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 b=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:m,frame:b,item:u.id,track:f.name??`V${f.track_index}`,record_tc:We(a+p+v,r,o),video_track:p0(c,f),record_start:p}}var Km=new Map,Em=null,fL=0;async function dL(e,t,n,i,r,a){if(r==="offline"){let m=e.timelines.find(h=>!i||h.id===i||h.name===i)??e.timelines[0],{offlineLane:p}=await import("./framing-QC7Z2GRK.js"),{lane:v,media:b}=await p(e,m);m.tracks.push(v),e.media_references.push(...b);try{return await dL(e,t,n,i,m.tracks.filter(h=>h.kind==="Video").length)}finally{m.tracks.splice(m.tracks.indexOf(v),1),e.media_references=e.media_references.filter(h=>!b.includes(h))}}let o=uL(e,{record:t,timeline:i,track:r});if(Jm(o.path))return null;let s=Km.get(o.path);s||(s=is(o.path),Km.set(o.path,s),s.catch(()=>Km.delete(o.path)));let c=await s;if(c.codec==="still")return null;let l=await(Em??=D9().catch(m=>{throw Em=null,m})),u=C(Te(),"tmp",`picture-${process.pid}-${fL++%1024}.raw`);await Se(C(Te(),"tmp"));let f=await l.ask({op:"picture",path:o.path,frame:ai(c,o.frame),width:n,out:u,...a?{lut:a}:{}});if(!f.ok)throw f.why?.startsWith("the analysis engine exited")&&(Em=null),new Error(f.why==="no_picture"?`no picture at frame ${o.frame} of ${K(o.path)}`:f.why??"no picture");let d=await lt(u);return await Co(u).catch(()=>{}),{w:f.w,h:f.h,px:d,order:f.order??"rgba"}}var mL=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"]),pL={...i1,fileName:!0,fileNameMode:"tight"};function _G(e){return{...pL,...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 $G(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 as=e=>e.replace(/\.[^.]+$/,"");async function eJ(e,t,n=2e3,i={}){let r=i.exts?.length?new Set(i.exts.map(f=>f.replace(/^\./,"").toLowerCase())):mL,a=t.map(f=>En(as(K(f.target_url??f.reel_name??"")).toLowerCase())).filter(Boolean),o=new Set(t.map(f=>ym(K(f.target_url??""))?.clipBase.toLowerCase()).filter(Boolean)),s=f=>{if(!a.length||i.byName===!1)return!0;let d=ym(f)?.clipBase.toLowerCase();if(d&&o.has(d))return!0;let m=En(as(f.toLowerCase()));return!!m&&a.some(p=>jc(p,m)>=.5)},c=[],l=!1;async function u(f,d){if(d>12||l)return;let m=[];try{for await(let p of it(f))m.push(p)}catch{return}for(let p of m){if(p.name.startsWith("."))continue;let v=C(f,p.name);if(p.isDirectory){await u(v,d+1);continue}if(!p.isFile)continue;let b=at(p.name).slice(1).toLowerCase();if(!(!r.has(b)||!s(p.name))&&(c.push(v),c.length>=n)){l=!0;return}}}return await u(e,0),{paths:c,capped:l}}async function tJ(e,t){let n=t.split(/[/\\]/).filter(Boolean),i=K(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=C(e,...a);try{if((await Ei(o)).isFile)return o}catch{}}return null}async function nJ(e){let t=[],n=[],i=new Set,r=0;for(let a of e){let o=await t1(a).catch(()=>[a]);if(!i.has(o[0])){o.forEach(s=>i.add(s));try{let s=await ni(o[0]);s.id=`cand-${++r}`,s.binding_state="unbound",t.push(s)}catch(s){n.push(`${K(a)}: ${s.message.slice(0,80)}`),t.push({id:`cand-${++r}`,kind:"external",target_url:o[0],local_path:o[0],reel_name:as(K(o[0])),binding_state:"unbound",streams:[],raw_extraction:{},metadata:{}})}}}return{refs:t,failed:n}}function rJ(e,t,n,i,r){let a=t.map(f=>s0(e,f)),o=n.map(o0),s=Tc(a,o,i,r),c=Tc(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 d=s.matches.find(b=>b.proxy_id===f.id),m=s.ambiguous.find(b=>b.proxy_id===f.id),p=s.refusals?.filter(b=>b.proxy_id===f.id).map(b=>`${K(l.get(b.candidate_id)?.target_url??b.candidate_id)}: ${b.reason}`).join("; "),v=new Set;for(let b of c.matches)b.proxy_id===f.id&&b.candidate_id!==d?.candidate_id&&v.add(b.candidate_id);for(let b of c.ambiguous)b.proxy_id===f.id&&b.candidate_ids.forEach(h=>h!==d?.candidate_id&&v.add(h));if(m&&m.candidate_ids.forEach(b=>v.add(b)),!d&&!m&&!v.size){let b=En(as(K(f.target_url??"")).toLowerCase()),h=n.map(g=>({c:g,s:jc(b,En(as(K(g.target_url??"")).toLowerCase()))})).filter(g=>g.s>=.4).sort((g,y)=>y.s-g.s)[0];h&&v.add(h.c.id)}return{ref_id:f.id,name:K(f.target_url??f.reel_name??f.id),status:d?"matched":m?"ambiguous":"unmatched",candidate:d?l.get(d.candidate_id):void 0,confidence:d?.confidence??0,reasons:d?.reasons??[],alternatives:[...v].map(b=>l.get(b)).filter(Boolean),refusal:p||void 0}}),result:s,candidates:n,config:i}}var h0=24;async function iJ(e,t){let n=[],i=r=>{let a=r.source_fps??r.available_range?.duration.rate??0;return{fps:a,tc:r.source_timecode?ke(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 Ei(o)).isFile&&(s=await ni(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)-h0/2),f=Math.min(l-1,u+h0-1),d=[...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)])],m=new Map;for(let x of d){let P=t.candidates.find(L=>L.id===x),T=P?.local_path??P?.target_url?.replace(/^file:\/\//,""),z=P&&i(P);if(!(!P||!T||z?.tc==null||Math.abs(z.fps-c.fps)>.01))try{let L=await b0({a:o,b:T,a_in:u,a_out:f,b_in:c.tc+u-z.tc,search:2});m.set(x,L.overall.verdict==="offset"?`offset ${L.overall.offset>0?"+":""}${L.overall.offset}`:L.overall.verdict)}catch(L){m.set(x,`unreadable (${String(L.message??L).slice(0,80)})`)}}let p=d.filter(x=>m.get(x)==="exact"),v=x=>t.candidates.find(P=>P.id===x),b=x=>(v(x).target_url??x).replace(/^file:\/\//,"").split("/").slice(-2).join("/"),h=d.filter(x=>m.has(x)).map(x=>`${b(x)}: ${m.get(x)}`).join(", "),g=r.candidate?.id,y=x=>m.has(x)&&m.get(x)!=="exact"&&m.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(P=>P.id!==p[0]&&P.id!==x?.id)],x&&(r.refusal=[r.refusal,`picture: ${b(x.id)} is ${m.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: ${h} (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=[]);h&&n.push(`picture ${r.ref_id} ${r.name}: ${h}`)}return n}function vL(e,t,n,i){let r=o=>o.streams?.find(s=>s.kind==="video");return[["file name",i.fileName,K(t.target_url??""),K(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,at(t.target_url??"").slice(1)||"\u2014",at(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 aJ(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 c0(e,t.candidates,i,!0)}var g0=Te(),y0=C(g0,"locations.json");async function Ym(){try{return JSON.parse(await Ye(y0))}catch{return[]}}async function oJ(e){await Se(g0);let t=(await Ym()).filter(n=>n!==e);await Re(y0,JSON.stringify([e,...t].slice(0,12)))}function x0(e){let t=e.media_references??[],n=r0(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 sJ(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} ${K(c.target_url??"")}`).join(", ")}`),i.push(s),n.compare&&a.candidate&&i.push(...vL(e,o,a.candidate,t.config))}return i.join(`
@@ -90,7 +90,7 @@ ${c}
90
90
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let s=o[1];if(t===o[0]){a(o);continue}if(e.external){let l=e.external.registry.get(o[0])?.id;if(t!==o[0]&&l){a(o);continue}}if(e.metadataRegistry.get(o[0])?.id){a(o);continue}if(s.cycle){a(o);continue}s.count>1&&e.reused==="ref"&&a(o)}e.external&&(e.sharedDefsExtractedFor=e.external)}function r4(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let i of t){if(!i||typeof i!="object")return;r4(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;let a=i.type;for(let o of Array.isArray(a)?a:[a]){if(typeof o!="string")return;n.includes(o)||n.push(o)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var i4=new Set(["type","properties","required","additionalProperties"]),t4=["oneOf","anyOf"];function n4(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Hy(e){let t=[];for(let a of e){if(typeof a!="object"||a.type!=="object")return null;for(let o in a)if(!i4.has(o))return null;t.push(a)}let n={},i=new Set;for(let a of t){for(let o in a.properties){if(Object.prototype.hasOwnProperty.call(n,o))continue;let s=[];for(let l of t){let u=l.properties?.[o]??n4(l);u!=null&&(s.some(f=>JSON.stringify(f)===JSON.stringify(u))||s.push(u))}let c=s.length===1?s[0]:Hy(s)??{allOf:s};dt(n,o,c)}for(let o of a.required??[])i.add(o)}let r={type:"object",properties:n};if(i.size&&(r.required=[...i]),t.every(a=>a.additionalProperties===!1))r.additionalProperties=!1;else{let a=[];for(let o of t){let s=n4(o);s&&!a.some(c=>JSON.stringify(c)===JSON.stringify(s))&&a.push(s)}a.length===1?r.additionalProperties=a[0]:a.length>1&&(r.additionalProperties={allOf:a})}return r}function WD(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let r of i4)if(r in e)return;let n=t.filter(r=>t4.some(a=>Array.isArray(r[a]))),i=null;if(!n.length)i=Hy(t);else{let r=n[0],a=t4.find(c=>Array.isArray(r[c]));if(Object.keys(r).length!==1)return;let o=t.filter(c=>c!==r),s=r[a].map(c=>Hy([...o,c]));if(s.some(c=>!c))return;i={[a]:s}}i&&(delete e.allOf,Fl(e,i))}function Mr(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=s=>{let c=e.seen.get(s);if(c.ref===null)return;let l=c.def??c.schema,u={...l},f=c.ref;if(c.ref=null,f){i(f);let m=e.seen.get(f),p=m.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(p)):Fl(l,p),Fl(l,u),s._zod.parent===f)for(let b in l)b==="$ref"||b==="allOf"||b in u||delete l[b];if(p.$ref&&m.def)for(let b in l)b==="$ref"||b==="allOf"||b in m.def&&JSON.stringify(l[b])===JSON.stringify(m.def[b])&&delete l[b]}let d=s._zod.parent;if(d&&d!==f){i(d);let m=e.seen.get(d);if(m?.schema.$ref&&(l.$ref=m.schema.$ref,m.def))for(let p in l)p==="$ref"||p==="allOf"||p in m.def&&JSON.stringify(l[p])===JSON.stringify(m.def[p])&&delete l[p]}e.override({zodSchema:s,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())i(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())r4(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let f=s.get(u);f?f.push(l):s.set(u,[l])}for(let c of e.intersections)for(let l of s.get(c)??[])WD(l)}}let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(s)}Fl(r,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&r.id===a&&delete r.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let c=s[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,dt(o,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?r.$defs=o:r.definitions=o);try{let s=JSON.parse(JSON.stringify(r));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:zo(t,"input",e.processors),output:zo(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function Tt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Tt(i.element,n);if(i.type==="set")return Tt(i.valueType,n);if(i.type==="lazy")return Tt(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return Tt(i.innerType,n);if(i.type==="intersection")return Tt(i.left,n)||Tt(i.right,n);if(i.type==="record"||i.type==="map")return Tt(i.keyType,n)||Tt(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Tt(i.in,n)||Tt(i.out,n);if(i.type==="object"){for(let r in i.shape)if(Tt(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(Tt(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(Tt(r,n))return!0;return!!(i.rest&&Tt(i.rest,n))}return!1}var Fy=(e,t={})=>n=>{let i=Hr({...n,processors:t});return Ne(e,i),Fr(i,e),Mr(i,e)},zo=(e,t,n={})=>i=>{let{libraryOptions:r,target:a}=i??{},o=Hr({...r??{},target:a,io:t,processors:n});return Ne(e,o),Fr(o,e),Mr(o,e)};var ko=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Oo=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},a4=(e,t)=>{ko(e,"minimum",t),Oo(e,"maximum",t)},c4=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},u4=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},f4=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},d4=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},o4=(e,t)=>ko(e,"minimum",t.minimum),s4=(e,t)=>Oo(e,"maximum",t.maximum),l4=e=>(t,n)=>{d4(t,n.format);let[i,r]=e[n.format];ko(t,"minimum",i),Oo(t,"maximum",r)},qD={greater_than:(e,t)=>ko(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Oo(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>c4(e,t.value),number_format:l4(sl),bigint_format:l4(ll),min_length:o4,max_length:s4,length_equals:(e,t)=>a4(e,t.length),min_size:o4,max_size:s4,size_equals:(e,t)=>a4(e,t.size),string_format:(e,t)=>{d4(e,t.format),t.pattern&&u4(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>f4(e,t.mime)};function nt(e){let t={},n=e._zod.def,i=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let a of i)qD[a._zod.def.check]?.(t,a._zod.def);let r=e._zod.bag;r.minimum!==void 0&&ko(t,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&ko(t,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&Oo(t,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&Oo(t,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&c4(t,r.multipleOf),r.format!==void 0&&(t.format??(t.format=r.format),r.format.includes("int")&&(t.isInt=!0)),r.mime&&f4(t,r.mime);for(let a of r.patterns??[])u4(t,a);return t}var ZD={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},VD=new Map([[mf,Eb],[kl,Yb]]),m4=e=>VD.get(e)??e,Uy=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=nt(e);if(typeof a=="number"&&(r.minLength=a),typeof o=="number"&&(r.maxLength=o),s&&(r.format=ZD[s]??s,r.format===""&&delete r.format,(s==="time"||u)&&delete r.format),l&&(r.contentEncoding=l),c&&c.size>0){let f=[...c].map(m4);f.length===1?r.pattern=f[0].source:f.length>1&&(r.allOf=[...f.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Gy=(e,t,n,i)=>{let r=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=nt(e);r.type=u?"integer":"number";let f=typeof l=="number"&&l>=(a??Number.NEGATIVE_INFINITY),d=typeof c=="number"&&c<=(o??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f?m?(r.minimum=l,r.exclusiveMinimum=!0):r.exclusiveMinimum=l:typeof a=="number"&&(r.minimum=a),d?m?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:typeof o=="number"&&(r.maximum=o),s){let p=new Set;for(let h of s)Number.isFinite(h)&&h!==0?p.add(Math.abs(h)):tt(e,t,r,i,`A multipleOf divisor of ${h} cannot be represented in JSON Schema`);let[v,...b]=p;v!==void 0&&(r.multipleOf=v),b.length&&(r.allOf=[...r.allOf??[],...b.map(h=>({multipleOf:h}))])}},Jy=(e,t,n,i)=>{n.type="boolean"},Cy=(e,t,n,i)=>{tt(e,t,n,i,"BigInt cannot be represented in JSON Schema")},Ky=(e,t,n,i)=>{tt(e,t,n,i,"Symbols cannot be represented in JSON Schema")},Ey=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Yy=(e,t,n,i)=>{tt(e,t,n,i,"Undefined cannot be represented in JSON Schema")},Ay=(e,t,n,i)=>{tt(e,t,n,i,"Void cannot be represented in JSON Schema")},By=(e,t,n,i)=>{n.not={}},Qy=(e,t,n,i)=>{},_y=(e,t,n,i)=>{},$y=(e,t,n,i)=>{tt(e,t,n,i,"Date cannot be represented in JSON Schema")},ex=(e,t,n,i)=>{let r=e._zod.def,a=Aa(r.entries);if(a.length===0){n.not={};return}a.every(o=>typeof o=="number")&&(n.type="number"),a.every(o=>typeof o=="string")&&(n.type="string"),n.enum=a},tx=(e,t,n,i)=>{let r=e._zod.def;if(r.values.length===0){n.not={};return}let a=[];for(let o of r.values)if(o===void 0){if(tt(e,t,n,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o=="bigint"){if(tt(e,t,n,i,"BigInt literals cannot be represented in JSON Schema"))return;a.push(Number(o))}else a.push(o);if(a.length!==0)if(a.length===1){let o=a[0];n.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[o]:n.const=o}else a.every(o=>typeof o=="number")&&(n.type="number"),a.every(o=>typeof o=="string")&&(n.type="string"),a.every(o=>typeof o=="boolean")&&(n.type="boolean"),a.every(o=>o===null)&&(n.type="null"),n.enum=a},nx=(e,t,n,i)=>{tt(e,t,n,i,"NaN cannot be represented in JSON Schema")},rx=(e,t,n,i)=>{let r=n,a=e._zod.pattern;if(!a)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=a.source},ix=(e,t,n,i)=>{let r=n;r.type="string",r.format="binary",r.contentEncoding="binary";let{minimum:a,maximum:o,mime:s}=nt(e);a!==void 0&&(r.minLength=a),o!==void 0&&(r.maxLength=o),s&&(s.length===0?r.not={}:s.length===1?r.contentMediaType=s[0]:r.anyOf=s.map(c=>({contentMediaType:c})))},ax=(e,t,n,i)=>{n.type="boolean"},ox=(e,t,n,i)=>{tt(e,t,n,i,"Custom types cannot be represented in JSON Schema")},sx=(e,t,n,i)=>{tt(e,t,n,i,"Function types cannot be represented in JSON Schema")},lx=(e,t,n,i)=>{tt(e,t,n,i,"Transforms cannot be represented in JSON Schema")},cx=(e,t,n,i)=>{tt(e,t,n,i,"Map cannot be represented in JSON Schema")},ux=(e,t,n,i)=>{tt(e,t,n,i,"Set cannot be represented in JSON Schema")},fx=(e,t,n,i)=>{let r=n,a=e._zod.def,{minimum:o,maximum:s}=nt(e);typeof o=="number"&&(r.minItems=o),typeof s=="number"&&(r.maxItems=s),r.type="array",r.items=Ne(a.element,t,{...i,path:[...i.path,"items"]})};function Ml(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Ml(t.out):t.type==="catch"?Ml(t.innerType):e._zod.optin}var dx=(e,t,n,i)=>{let r=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&tt(e,t,r,i,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let l in o)dt(r.properties,l,Ne(o[l],t,{...i,path:[...i.path,"properties",l]}));let c=[];for(let l of Object.keys(o)){let u=a.shape[l];(t.io==="input"?Ml(u)===void 0:u._zod.optout===void 0)&&c.push(l)}c.length>0&&(r.required=c),a.catchall?._zod.def.type==="never"?r.additionalProperties=!1:a.catchall?a.catchall&&(r.additionalProperties=Ne(a.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},ud=(e,t,n,i)=>{let r=e._zod.def,a=r.inclusive===!1,o=r.options.map((s,c)=>Ne(s,t,{...i,path:[...i.path,a?"oneOf":"anyOf",c]}));a?n.oneOf=o:n.anyOf=o},mx=(e,t,n,i)=>{let r=e._zod.def,a=Ne(r.left,t,{...i,path:[...i.path,"allOf",0]}),o=Ne(r.right,t,{...i,path:[...i.path,"allOf",1]}),s=l=>"allOf"in l&&Object.keys(l).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},px=(e,t,n,i)=>{let r=n,a=e._zod.def;r.type="array";let o=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=a.items.map((v,b)=>Ne(v,t,{...i,path:[...i.path,o,b]})),l=a.rest?Ne(a.rest,t,{...i,path:[...i.path,s,...t.target==="openapi-3.0"?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let v=a.items[u-1];if(!(t.io==="input"?Ml(v)!==void 0:v._zod.optout==="optional"))break;u--}let f=a.items.length,d=!a.rest;t.target==="draft-2020-12"?(r.prefixItems=c,d?r.items=!1:l&&(r.items=l),u>0&&(r.minItems=u),d&&(r.maxItems=f)):t.target==="openapi-3.0"?(r.items={anyOf:c},l&&r.items.anyOf.push(l),u>0&&(r.minItems=u),d&&(r.maxItems=f)):(r.items=c,d?r.additionalItems=!1:l&&(r.additionalItems=l),u>0&&(r.minItems=u),d&&(r.maxItems=f));let{minimum:m,maximum:p}=nt(e);typeof m=="number"&&(r.minItems=m),typeof p=="number"&&(r.maxItems=p)};function My(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let p=e.get(t)?.def;if(!p)return t;let v=My(e,p,n);return v===p?t:v}for(let p of["anyOf","oneOf"]){let v=t[p];if(!Array.isArray(v))continue;let b=v.map(h=>My(e,h,n));b.some((h,g)=>h!==v[g])&&(t={...t,[p]:b})}let i=Array.isArray(t.type)?t.type:[t.type],r=!i.includes("string")&&i.some(p=>p==="number"||p==="integer"),a=t.enum??(t.const!==void 0?[t.const]:void 0);if(!r&&!a?.some(p=>typeof p=="number"))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:f,id:d,...m}=t;return m.enum?m.enum=m.enum.map(p=>typeof p=="number"?String(p):p):typeof m.const=="number"&&(m.const=String(m.const)),r&&(m.type="string",a||(m.pattern=(i.includes("number")?dr:hl).source)),m}var Iy=new WeakMap;function RD(e){let t=new Map;for(let i of e.seen.values())i.def&&!t.has(i.schema)&&t.set(i.schema,i);let n=new Map;for(let i of Iy.get(e)??[]){let r=e.seen.get(i),a=(r?.def??r?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=My(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let i of e.seen.values())for(let r of[i.schema,i.def]){let a=r&&n.get(r.propertyNames);a&&(r.propertyNames=a)}}var vx=(e,t,n,i)=>{let r=n,a=e._zod.def;r.type="object";let o=a.keyType,s=nt(o).patterns;if(a.mode==="loose"&&s&&s.size>0){let u=Ne(a.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let f of s)dt(r.patternProperties,m4(f).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){r.propertyNames=Ne(a.keyType,t,{...i,path:[...i.path,"propertyNames"]});let u=Iy.get(t);u||(u=[],Iy.set(t,u),t.deferred.push(()=>RD(t))),u.push(e)}r.additionalProperties=Ne(a.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let c=o._zod.values,l=t.io==="input"&&Ml(a.valueType)!==void 0;if(c&&!a.partial&&!l){let u=[...c].filter(f=>typeof f=="string"||typeof f=="number");u.length>0&&(r.required=u.map(String))}},bx=(e,t,n,i)=>{let r=e._zod.def,a=Ne(r.innerType,t,i),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=r.innerType,n.nullable=!0):n.anyOf=[a,{type:"null"}]},hx=(e,t,n,i)=>{let r=e._zod.def;Ne(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType},gx=Symbol();function p4(e,t,n,i,r){let a=!1,o=JSON.stringify(e,(s,c)=>typeof c!="bigint"?c:(a=!0,null));return a?(tt(t,n,i,r,"BigInt defaults cannot be represented in JSON Schema"),gx):JSON.parse(o)}var yx=(e,t,n,i)=>{let r=e._zod.def;Ne(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType;let o=p4(r.defaultValue,e,t,n,i);o!==gx&&(n.default=o)},xx=(e,t,n,i)=>{let r=e._zod.def;Ne(r.innerType,t,i);let a=t.seen.get(e);if(a.ref=r.innerType,t.io!=="input")return;let o=p4(r.defaultValue,e,t,n,i);o!==gx&&(n._prefault=o)},wx=(e,t,n,i)=>{let r=e._zod.def;Ne(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType;let o;try{o=r.catchValue(void 0)}catch{tt(e,t,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=o},Px=(e,t,n,i)=>{let r=e._zod.def,a=r.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?a?r.out:r.in:r.out;Ne(o,t,i);let s=t.seen.get(e);s.ref=o},zx=(e,t,n,i)=>{let r=e._zod.def;Ne(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType,n.readOnly=!0},kx=(e,t,n,i)=>{let r=e._zod.def;Ne(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType},fd=(e,t,n,i)=>{let r=e._zod.def;Ne(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType},Ox=(e,t,n,i)=>{let r=e._zod.innerType;Ne(r,t,i);let a=t.seen.get(e);a.ref=r},cd={string:Uy,number:Gy,boolean:Jy,bigint:Cy,symbol:Ky,null:Ey,undefined:Yy,void:Ay,never:By,any:Qy,unknown:_y,date:$y,enum:ex,literal:tx,nan:nx,template_literal:rx,file:ix,success:ax,custom:ox,function:sx,transform:lx,map:cx,set:ux,array:fx,object:dx,union:ud,intersection:mx,tuple:px,record:vx,nullable:bx,nonoptional:hx,default:yx,prefault:xx,catch:wx,pipe:Px,readonly:zx,promise:kx,optional:fd,lazy:Ox};function dd(e,t){if("_idmap"in e){let i=e,r=Hr({...t,processors:cd}),a={};for(let c of i._idmap.entries()){let[l,u]=c;Ne(u,r)}let o={},s={registry:i,uri:t?.uri,defs:a};r.external=s;for(let c of i._idmap.entries()){let[l,u]=c;Fr(r,u),dt(o,l,Mr(r,u))}if(Object.keys(a).length>0){let c=r.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[c]:a}}return{schemas:o}}let n=Hr({...t,processors:cd});return Ne(e,n),Fr(n,e),Mr(n,e)}var md=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Hr({processors:cd,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return Ne(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Fr(this.ctx,t);let i=Mr(this.ctx,t),{"~standard":r,...a}=i;return a}};var v4={};var qo={};Gn(qo,{ZodAny:()=>Ex,ZodArray:()=>Qx,ZodBase64:()=>Wd,ZodBase64URL:()=>qd,ZodBigInt:()=>So,ZodBigIntFormat:()=>Rd,ZodBoolean:()=>No,ZodCIDRv4:()=>Nd,ZodCIDRv6:()=>Sd,ZodCUID:()=>zd,ZodCUID2:()=>kd,ZodCatch:()=>gw,ZodCodec:()=>Bl,ZodCreditCard:()=>Fx,ZodCustom:()=>Ql,ZodCustomStringFormat:()=>Ii,ZodDate:()=>Jl,ZodDefault:()=>dw,ZodDiscriminatedUnion:()=>$x,ZodE164:()=>Zd,ZodEmail:()=>yd,ZodEmoji:()=>wd,ZodEnum:()=>To,ZodExactOptional:()=>Md,ZodFile:()=>lw,ZodFunction:()=>Lw,ZodGUID:()=>xd,ZodIBAN:()=>Mx,ZodIPv4:()=>Ld,ZodIPv6:()=>jd,ZodISODate:()=>Ur,ZodISODateTime:()=>Ir,ZodISODuration:()=>Jr,ZodISOTime:()=>Gr,ZodInstanceOf:()=>Sw,ZodIntersection:()=>ew,ZodJWT:()=>Vd,ZodKSUID:()=>Td,ZodLazy:()=>Ow,ZodLiteral:()=>sw,ZodMAC:()=>Hx,ZodMap:()=>aw,ZodNaN:()=>xw,ZodNanoID:()=>Pd,ZodNever:()=>Ax,ZodNonOptional:()=>Id,ZodNull:()=>Cx,ZodNullable:()=>fw,ZodNumber:()=>jo,ZodNumberFormat:()=>Ui,ZodObject:()=>Kl,ZodOptional:()=>Yl,ZodPipe:()=>Al,ZodPrefault:()=>pw,ZodPreprocess:()=>ww,ZodPromise:()=>Tw,ZodReadonly:()=>Pw,ZodRecord:()=>Xo,ZodSet:()=>ow,ZodString:()=>Lo,ZodStringFormat:()=>qe,ZodSuccess:()=>hw,ZodSymbol:()=>Gx,ZodTemplateLiteral:()=>kw,ZodTransform:()=>cw,ZodTuple:()=>nw,ZodType:()=>me,ZodULID:()=>Od,ZodURL:()=>Gl,ZodUUID:()=>Hn,ZodUndefined:()=>Jx,ZodUnion:()=>El,ZodUnknown:()=>Yx,ZodVoid:()=>Bx,ZodXID:()=>Xd,ZodXor:()=>_x,_ZodString:()=>gd,_default:()=>mw,_function:()=>T6,any:()=>i6,array:()=>Cl,base64:()=>H4,base64url:()=>F4,bigint:()=>$4,boolean:()=>Ux,catch:()=>yw,check:()=>L6,cidrv4:()=>R4,cidrv6:()=>D4,codec:()=>z6,creditCard:()=>I4,cuid:()=>L4,cuid2:()=>j4,currencyCode:()=>E4,custom:()=>j6,date:()=>o6,describe:()=>N6,discriminatedUnion:()=>d6,e164:()=>M4,email:()=>g4,emoji:()=>X4,enum:()=>Hd,exactOptional:()=>uw,file:()=>y6,float32:()=>A4,float64:()=>B4,function:()=>T6,guid:()=>y4,hash:()=>Y4,hex:()=>K4,hostname:()=>C4,httpUrl:()=>O4,iban:()=>U4,instanceof:()=>W6,int:()=>bd,int32:()=>Q4,int64:()=>e6,intersection:()=>tw,invertCodec:()=>k6,ipv4:()=>q4,ipv6:()=>V4,json:()=>Z6,jwt:()=>G4,keyof:()=>s6,ksuid:()=>W4,lazy:()=>Xw,literal:()=>g6,looseObject:()=>u6,looseRecord:()=>p6,mac:()=>Z4,map:()=>v6,meta:()=>S6,nan:()=>P6,nanoid:()=>T4,nativeEnum:()=>h6,never:()=>Dd,nonoptional:()=>bw,null:()=>Kx,nullable:()=>Ul,nullish:()=>x6,number:()=>Ix,object:()=>l6,optional:()=>Fi,partialRecord:()=>m6,pipe:()=>hd,prefault:()=>vw,preprocess:()=>V6,promise:()=>X6,readonly:()=>zw,record:()=>iw,refine:()=>jw,set:()=>b6,strictObject:()=>c6,string:()=>Il,stringFormat:()=>J4,stringbool:()=>q6,success:()=>w6,superRefine:()=>Nw,symbol:()=>n6,templateLiteral:()=>O6,transform:()=>Fd,tuple:()=>rw,uint32:()=>_4,uint64:()=>t6,ulid:()=>N4,undefined:()=>r6,union:()=>Wo,unknown:()=>Hi,url:()=>k4,uuid:()=>x4,uuidv4:()=>w4,uuidv6:()=>P4,uuidv7:()=>z4,void:()=>a6,xid:()=>S4,xor:()=>f6});var pd={};Gn(pd,{endsWith:()=>vo,gt:()=>Rn,gte:()=>Kt,includes:()=>mo,length:()=>Ri,lowercase:()=>uo,lt:()=>Vn,lte:()=>Ct,maxLength:()=>Vi,maxSize:()=>Dr,mime:()=>ho,minLength:()=>mr,minSize:()=>Dn,multipleOf:()=>Rr,negative:()=>ad,nonnegative:()=>sd,nonpositive:()=>od,normalize:()=>go,overwrite:()=>Pn,positive:()=>id,properties:()=>bo,property:()=>ld,regex:()=>co,size:()=>Zi,slugify:()=>Po,startsWith:()=>po,toLowerCase:()=>xo,toUpperCase:()=>wo,trim:()=>yo,uppercase:()=>fo});var b4=new WeakSet([Object.prototype,Error.prototype]);function vd(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=n(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var h4=(e,t)=>{Tb.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);b4.has(n)||(b4.add(n),vd(n,"format",i=>r=>ml(i,r)),vd(n,"flatten",i=>r=>dl(i,r)),vd(n,"addIssue",i=>r=>{i.issues.push(r),i.message=JSON.stringify(i.issues,Ba,2)}),vd(n,"addIssues",i=>r=>{i.issues.push(...r),i.message=JSON.stringify(i.issues,Ba,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},HD=k("ZodError",h4),Rt=k("ZodError",h4,void 0,{Parent:Error});var Xx=eo(Rt),Tx=to(Rt),Lx=no(Rt),jx=ro(Rt),Nx=Gu(Rt),Sx=Ju(Rt),Wx=Cu(Rt),qx=Ku(Rt),Zx=Eu(Rt),Vx=Yu(Rt),Rx=Au(Rt),Dx=Bu(Rt);function MD(){ot.localeError||Ee(jf())}function Mi(){ot.memoizer||Ee({memoizer:Sl()})}var me=k("ZodType",(e,t)=>(MD(),ue.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(W.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Le(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(jw(e,t))},superRefine(e,t){return this.check(Nw(e,t))},overwrite(e){return this.check(Pn(e))},optional(){return Fi(this)},exactOptional(){return uw(this)},nullable(){return Ul(this)},nullish(){return Fi(Ul(this))},nonoptional(e){return bw(this,e)},array(){return Cl(this)},or(e){return Wo([this,e])},and(e){return tw(this,e)},transform(e){return hd(this,Fd(e))},default(e){return mw(this,e)},prefault(e){return vw(this,e)},catch(e){return yw(this,e)},pipe(e){return hd(this,e)},readonly(){return zw(this)},describe(e){let t=this.clone();return mt.add(t,{description:e}),t},meta(...e){if(e.length===0)return mt.get(this);let t=this.clone();return mt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return W.hide(this,"~standard",{...lf(this),jsonSchema:{input:zo(this,"input"),output:zo(this,"output")}})},set"~standard"(e){W.own(this,"~standard",e)},parse:function e(t,n){return Xx(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Tx(this,t,n,{callee:e})},safeParse(e,t){return Lx(this,e,t)},async safeParseAsync(e,t){return jx(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){W.own(this,"spa",e)},validate(e,t){return pl(this,e,t)},validateAsync(e,t){return vl(this,e,t)},encode:function e(t,n){return Nx(this,t,n,{callee:e})},decode:function e(t,n){return Sx(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Wx(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await qx(this,t,n,{callee:e})},safeEncode(e,t){return Zx(this,e,t)},safeDecode(e,t){return Vx(this,e,t)},async safeEncodeAsync(e,t){return Rx(this,e,t)},async safeDecodeAsync(e,t){return Dx(this,e,t)},toJSONSchema(e){return Fy(this,{})(e)},get description(){return mt.get(this)?.description},get _def(){return this._zod.def}}),gd=k("_ZodString",(e,t)=>{ji.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Uy(e,n,i,r)},W.derived({format:e=>nt(e).format??null,minLength:e=>nt(e).minimum??null,maxLength:e=>nt(e).maximum??null},{regex(...e){return this.check(co(...e))},includes(...e){return this.check(mo(...e))},startsWith(...e){return this.check(po(...e))},endsWith(...e){return this.check(vo(...e))},min(...e){return this.check(mr(...e))},max(...e){return this.check(Vi(...e))},length(...e){return this.check(Ri(...e))},nonempty(...e){return this.check(mr(1,...e))},lowercase(e){return this.check(uo(e))},uppercase(e){return this.check(fo(e))},trim(){return this.check(yo())},normalize(...e){return this.check(go(...e))},toLowerCase(){return this.check(xo())},toUpperCase(){return this.check(wo())},slugify(){return this.check(Po())}})),Lo=k("ZodString",(e,t)=>{ji.init(e,t),gd.init(e,t)},{email(e){return this.check(Df(yd,e))},url(e){return this.check(Zl(Gl,e))},jwt(e){return this.check(rd(Vd,e))},emoji(e){return this.check(Gf(wd,e))},guid(e){return this.check(Hf(xd,e))},uuid(e){return this.check(Ff(Hn,e))},uuidv4(e){return this.check(Mf(Hn,e))},uuidv6(e){return this.check(If(Hn,e))},uuidv7(e){return this.check(Uf(Hn,e))},nanoid(e){return this.check(Jf(Pd,e))},cuid(e){return this.check(Cf(zd,e))},cuid2(e){return this.check(Kf(kd,e))},ulid(e){return this.check(Ef(Od,e))},base64(e){return this.check(ed(Wd,e))},base64url(e){return this.check(td(qd,e))},xid(e){return this.check(Yf(Xd,e))},ksuid(e){return this.check(Af(Td,e))},ipv4(e){return this.check(Bf(Ld,e))},ipv6(e){return this.check(Qf(jd,e))},cidrv4(e){return this.check(_f(Nd,e))},cidrv6(e){return this.check($f(Sd,e))},e164(e){return this.check(nd(Zd,e))},datetime(e){return this.check(Vl(Ir,e))},date(e){return this.check(Rl(Ur,e))},time(e){return this.check(Dl(Gr,e))},duration(e){return this.check(Hl(Jr,e))}});function Il(e){return ty(Lo,e)}var qe=k("ZodStringFormat",(e,t)=>{je.init(e,t),gd.init(e,t)}),Ir=k("ZodISODateTime",(e,t)=>{Eh.init(e,t),qe.init(e,t)}),Ur=k("ZodISODate",(e,t)=>{Yh.init(e,t),qe.init(e,t)}),Gr=k("ZodISOTime",(e,t)=>{Ah.init(e,t),qe.init(e,t)}),Jr=k("ZodISODuration",(e,t)=>{Bh.init(e,t),qe.init(e,t)}),yd=k("ZodEmail",(e,t)=>{Rh.init(e,t),qe.init(e,t)});function g4(e){return Df(yd,e)}var xd=k("ZodGUID",(e,t)=>{Zh.init(e,t),qe.init(e,t)});function y4(e){return Hf(xd,e)}var Hn=k("ZodUUID",(e,t)=>{Vh.init(e,t),qe.init(e,t)});function x4(e){return Ff(Hn,e)}function w4(e){return Mf(Hn,e)}function P4(e){return If(Hn,e)}function z4(e){return Uf(Hn,e)}var Gl=k("ZodURL",(e,t)=>{Fh.init(e,t),qe.init(e,t)});function k4(e){return Zl(Gl,e)}function O4(e){return Zl(Gl,{protocol:bl,hostname:Bb,...W.normalizeParams(e)})}var wd=k("ZodEmoji",(e,t)=>{Mh.init(e,t),qe.init(e,t)});function X4(e){return Gf(wd,e)}var Pd=k("ZodNanoID",(e,t)=>{Ih.init(e,t),qe.init(e,t)});function T4(e){return Jf(Pd,e)}var zd=k("ZodCUID",(e,t)=>{Uh.init(e,t),qe.init(e,t)});function L4(e){return Cf(zd,e)}var kd=k("ZodCUID2",(e,t)=>{Gh.init(e,t),qe.init(e,t)});function j4(e){return Kf(kd,e)}var Od=k("ZodULID",(e,t)=>{Jh.init(e,t),qe.init(e,t)});function N4(e){return Ef(Od,e)}var Xd=k("ZodXID",(e,t)=>{Ch.init(e,t),qe.init(e,t)});function S4(e){return Yf(Xd,e)}var Td=k("ZodKSUID",(e,t)=>{Kh.init(e,t),qe.init(e,t)});function W4(e){return Af(Td,e)}var Ld=k("ZodIPv4",(e,t)=>{Qh.init(e,t),qe.init(e,t)});function q4(e){return Bf(Ld,e)}var Hx=k("ZodMAC",(e,t)=>{$h.init(e,t),qe.init(e,t)});function Z4(e){return ry(Hx,e)}var jd=k("ZodIPv6",(e,t)=>{_h.init(e,t),qe.init(e,t)});function V4(e){return Qf(jd,e)}var Nd=k("ZodCIDRv4",(e,t)=>{eg.init(e,t),qe.init(e,t)});function R4(e){return _f(Nd,e)}var Sd=k("ZodCIDRv6",(e,t)=>{tg.init(e,t),qe.init(e,t)});function D4(e){return $f(Sd,e)}var Wd=k("ZodBase64",(e,t)=>{ng.init(e,t),qe.init(e,t)});function H4(e){return ed(Wd,e)}var qd=k("ZodBase64URL",(e,t)=>{rg.init(e,t),qe.init(e,t)});function F4(e){return td(qd,e)}var Zd=k("ZodE164",(e,t)=>{ig.init(e,t),qe.init(e,t)});function M4(e){return nd(Zd,e)}var Fx=k("ZodCreditCard",(e,t)=>{ag.init(e,t),qe.init(e,t)});function I4(e){return iy(Fx,e)}var Mx=k("ZodIBAN",(e,t)=>{og.init(e,t),qe.init(e,t)});function U4(e){return ay(Mx,e)}var Vd=k("ZodJWT",(e,t)=>{sg.init(e,t),qe.init(e,t)});function G4(e){return rd(Vd,e)}var Ii=k("ZodCustomStringFormat",(e,t)=>{lg.init(e,t),qe.init(e,t)});function J4(e,t,n={}){return Di(Ii,e,t,n)}function C4(e){return Di(Ii,"hostname",Ab,e)}function K4(e){return Di(Ii,"hex",uh,e)}function E4(e){return Di(Ii,"currency_code",_b,e)}function Y4(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=tn[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return Di(Ii,i,r,t)}var jo=k("ZodNumber",(e,t)=>{gf.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Gy(e,n,i,r),e.isFinite=!0},W.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=nt(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=nt(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:n}=nt(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>nt(e).format??null},{gt(e,t){return this.check(Rn(e,t))},gte(e,t){return this.check(Kt(e,t))},min(e,t){return this.check(Kt(e,t))},lt(e,t){return this.check(Vn(e,t))},lte(e,t){return this.check(Ct(e,t))},max(e,t){return this.check(Ct(e,t))},int(e){return this.check(bd(e))},safe(e){return this.check(bd(e))},positive(e){return this.check(Rn(0,e))},nonnegative(e){return this.check(Kt(0,e))},negative(e){return this.check(Vn(0,e))},nonpositive(e){return this.check(Ct(0,e))},multipleOf(e,t){return this.check(Rr(e,t))},step(e,t){return this.check(Rr(e,t))},finite(){return this}}));function Ix(e){return sy(jo,e)}var Ui=k("ZodNumberFormat",(e,t)=>{cg.init(e,t),jo.init(e,t)});function bd(e){return cy(Ui,e)}function A4(e){return uy(Ui,e)}function B4(e){return fy(Ui,e)}function Q4(e){return dy(Ui,e)}function _4(e){return my(Ui,e)}var No=k("ZodBoolean",(e,t)=>{Ol.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Jy(e,n,i,r)});function Ux(e){return py(No,e)}var So=k("ZodBigInt",(e,t)=>{yf.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Cy(e,n,i,r)},W.derived({minValue:e=>nt(e).minimum??null,maxValue:e=>nt(e).maximum??null,format:e=>nt(e).format??null},{gte(e,t){return this.check(Kt(e,t))},min(e,t){return this.check(Kt(e,t))},gt(e,t){return this.check(Rn(e,t))},lt(e,t){return this.check(Vn(e,t))},lte(e,t){return this.check(Ct(e,t))},max(e,t){return this.check(Ct(e,t))},positive(e){return this.check(Rn(BigInt(0),e))},negative(e){return this.check(Vn(BigInt(0),e))},nonpositive(e){return this.check(Ct(BigInt(0),e))},nonnegative(e){return this.check(Kt(BigInt(0),e))},multipleOf(e,t){return this.check(Rr(e,t))}}));function $4(e){return by(So,e)}var Rd=k("ZodBigIntFormat",(e,t)=>{ug.init(e,t),So.init(e,t)});function e6(e){return gy(Rd,e)}function t6(e){return yy(Rd,e)}var Gx=k("ZodSymbol",(e,t)=>{fg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ky(e,n,i,r)});function n6(e){return xy(Gx,e)}var Jx=k("ZodUndefined",(e,t)=>{dg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Yy(e,n,i,r)});function r6(e){return wy(Jx,e)}var Cx=k("ZodNull",(e,t)=>{mg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ey(e,n,i,r)});function Kx(e){return Py(Cx,e)}var Ex=k("ZodAny",(e,t)=>{pg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Qy(e,n,i,r)});function i6(){return zy(Ex)}var Yx=k("ZodUnknown",(e,t)=>{vg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>_y(e,n,i,r)});function Hi(){return ky(Yx)}var Ax=k("ZodNever",(e,t)=>{bg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>By(e,n,i,r)});function Dd(e){return Oy(Ax,e)}var Bx=k("ZodVoid",(e,t)=>{hg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ay(e,n,i,r)});function a6(e){return Xy(Bx,e)}var Jl=k("ZodDate",(e,t)=>{gg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>$y(e,n,i,r),e.min=(n,i)=>e.check(Kt(n,i)),e.max=(n,i)=>e.check(Ct(n,i))},W.derived({minDate:e=>{let{minimum:t}=nt(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=nt(e);return t?new Date(t):null}},{}));function o6(e){return Ty(Jl,e)}var Qx=k("ZodArray",(e,t)=>{Mi(),yg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>fx(e,n,i,r),e.element=t.element},{min(e,t){return this.check(mr(e,t))},nonempty(e){return this.check(mr(1,e))},max(e,t){return this.check(Vi(e,t))},length(e,t){return this.check(Ri(e,t))},unwrap(){return this.element}});function Cl(e,t){return Ny(Qx,e,t)}function s6(e){let t=e._zod.def.shape;return Hd(Object.keys(t))}var Kl=k("ZodObject",(e,t)=>{Mi(),xg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>dx(e,n,i,r),W.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Hd(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(W.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(W.mergeDefs(this._zod.def,{catchall:Hi()}))},loose(){return this.clone(W.mergeDefs(this._zod.def,{catchall:Hi()}))},strict(){return this.clone(W.mergeDefs(this._zod.def,{catchall:Dd()}))},strip(){return this.clone(W.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return W.extend(this,e)},safeExtend(e){return W.safeExtend(this,e)},merge(e){return W.merge(this,e)},pick(e){return W.pick(this,e)},omit(e){return W.omit(this,e)},partial(...e){return W.partial(Yl,this,e[0])},exactPartial(...e){return W.partial(Md,this,e[0],"exactPartial")},required(...e){return W.required(Id,this,e[0])}});function l6(e,t){let n={type:"object",shape:e??{},...W.normalizeParams(t)};return new Kl(n)}function c6(e,t){return new Kl({type:"object",shape:e,catchall:Dd(),...W.normalizeParams(t)})}function u6(e,t){return new Kl({type:"object",shape:e,catchall:Hi(),...W.normalizeParams(t)})}var El=k("ZodUnion",(e,t)=>{Xl.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ud(e,n,i,r),e.options=t.options});function Wo(e,t){return new El({type:"union",options:e,...W.normalizeParams(t)})}var _x=k("ZodXor",(e,t)=>{El.init(e,t),wg.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ud(e,n,i,r),e.options=t.options});function f6(e,t){return new _x({type:"union",options:e,inclusive:!1,...W.normalizeParams(t)})}var $x=k("ZodDiscriminatedUnion",(e,t)=>{El.init(e,t),zg.init(e,t)});function d6(e,t,n){return new $x({type:"union",options:t,discriminator:e,...W.normalizeParams(n)})}var ew=k("ZodIntersection",(e,t)=>{kg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>mx(e,n,i,r)});function tw(e,t){return new ew({type:"intersection",left:e,right:t})}var nw=k("ZodTuple",(e,t)=>{Mi(),xf.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>px(e,n,i,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Yl({type:"optional",innerType:t}))})}});function rw(e,t,n){let i=t instanceof ue,r=i?n:t,a=i?t:null;return new nw({type:"tuple",items:e,rest:a,...W.normalizeParams(r)})}var Xo=k("ZodRecord",(e,t)=>{Mi(),Og.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>vx(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function iw(e,t,n){return!t||!t._zod?new Xo({type:"record",keyType:Il(),valueType:e,...W.normalizeParams(t)}):new Xo({type:"record",keyType:e,valueType:t,...W.normalizeParams(n)})}function m6(e,t,n){return new Xo({type:"record",keyType:e,valueType:t,...W.normalizeParams(n),partial:!0})}function p6(e,t,n){return new Xo({type:"record",keyType:e,valueType:t,mode:"loose",...W.normalizeParams(n)})}var aw=k("ZodMap",(e,t)=>{Mi(),Xg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>cx(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Dn(...n)),e.nonempty=n=>e.check(Dn(1,n)),e.max=(...n)=>e.check(Dr(...n)),e.size=(...n)=>e.check(Zi(...n))});function v6(e,t,n){return new aw({type:"map",keyType:e,valueType:t,...W.normalizeParams(n)})}var ow=k("ZodSet",(e,t)=>{Mi(),Tg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ux(e,n,i,r),e.min=(...n)=>e.check(Dn(...n)),e.nonempty=n=>e.check(Dn(1,n)),e.max=(...n)=>e.check(Dr(...n)),e.size=(...n)=>e.check(Zi(...n))});function b6(e,t){return new ow({type:"set",valueType:e,...W.normalizeParams(t)})}var To=k("ZodEnum",(e,t)=>{Lg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(i,r,a)=>ex(e,i,r,a),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let a={};for(let o of i)if(n.has(o))a[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new To({...t,checks:[],...W.normalizeParams(r),entries:a})},e.exclude=(i,r)=>{let a={...t.entries};for(let o of i)if(n.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new To({...t,checks:[],...W.normalizeParams(r),entries:a})}});function Hd(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new To({type:"enum",entries:n,...W.normalizeParams(t)})}function h6(e,t){return new To({type:"enum",entries:e,...W.normalizeParams(t)})}var sw=k("ZodLiteral",(e,t)=>{jg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>tx(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function g6(e,t){return new sw({type:"literal",values:Array.isArray(e)?e:[e],...W.normalizeParams(t)})}var lw=k("ZodFile",(e,t)=>{Ng.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ix(e,n,i,r),e.min=(n,i)=>e.check(Dn(n,i)),e.max=(n,i)=>e.check(Dr(n,i)),e.mime=(n,i)=>e.check(ho(Array.isArray(n)?n:[n],i))});function y6(e){return Sy(lw,e)}var cw=k("ZodTransform",(e,t)=>{Mi(),Sg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>lx(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Vr(e.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(W.issue(a,n.value,t));else{let o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=n.value),o.inst??(o.inst=e),n.issues.push(W.issue(o))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(a=>(n.value=a,n)):(n.value=r,n)}});function Fd(e){return new cw({type:"transform",transform:e})}var Yl=k("ZodOptional",(e,t)=>{wf.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>fd(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Fi(e){return new Yl({type:"optional",innerType:e})}var Md=k("ZodExactOptional",(e,t)=>{Wg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>fd(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function uw(e){return new Md({type:"optional",innerType:e})}var fw=k("ZodNullable",(e,t)=>{qg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>bx(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Ul(e){return new fw({type:"nullable",innerType:e})}function x6(e){return Fi(Ul(e))}var dw=k("ZodDefault",(e,t)=>{Zg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>yx(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function mw(e,t){return new dw({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():W.shallowClone(t)}})}var pw=k("ZodPrefault",(e,t)=>{Vg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xx(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function vw(e,t){return new pw({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():W.shallowClone(t)}})}var Id=k("ZodNonOptional",(e,t)=>{Rg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>hx(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function bw(e,t){return new Id({type:"nonoptional",innerType:e,...W.normalizeParams(t)})}var hw=k("ZodSuccess",(e,t)=>{Dg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ax(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function w6(e){return new hw({type:"success",innerType:e})}var gw=k("ZodCatch",(e,t)=>{Hg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>wx(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yw(e,t){return new gw({type:"catch",innerType:e,catchValue:typeof t=="function"?t:W.constantCatch(t)})}var xw=k("ZodNaN",(e,t)=>{Fg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>nx(e,n,i,r)});function P6(e){return jy(xw,e)}var Al=k("ZodPipe",(e,t)=>{Pf.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Px(e,n,i,r),e.in=t.in,e.out=t.out});function hd(e,t){return new Al({type:"pipe",in:e,out:t})}var Bl=k("ZodCodec",(e,t)=>{Al.init(e,t),Tl.init(e,t)});function z6(e,t,n){return new Bl({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function k6(e){let t=e._zod.def;return new Bl({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var ww=k("ZodPreprocess",(e,t)=>{Al.init(e,t),Mg.init(e,t)}),Pw=k("ZodReadonly",(e,t)=>{Ig.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>zx(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function zw(e){return new Pw({type:"readonly",innerType:e})}var kw=k("ZodTemplateLiteral",(e,t)=>{Ug.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>rx(e,n,i,r)});function O6(e,t){return new kw({type:"template_literal",parts:e,...W.normalizeParams(t)})}var Ow=k("ZodLazy",(e,t)=>{Ll.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ox(e,n,i,r),e.unwrap=()=>e._zod.def.getter()});function Xw(e){return new Ow({type:"lazy",getter:e})}var Tw=k("ZodPromise",(e,t)=>{Jg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>kx(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function X6(e){return new Tw({type:"promise",innerType:e})}var Lw=k("ZodFunction",(e,t)=>{Gg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>sx(e,n,i,r)});function T6(e){return new Lw({type:"function",input:Array.isArray(e?.input)?rw(e?.input):e?.input??Cl(Hi()),output:e?.output??Hi()})}var Ql=k("ZodCustom",(e,t)=>{Cg.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ox(e,n,i,r)});function L6(e){let t=new De({check:"custom"});return t._zod.check=e,t}function j6(e,t){return Wy(Ql,e??(()=>!0),t)}function jw(e,t={}){return qy(Ql,e,t)}function Nw(e,t){return Zy(e,t)}var N6=Vy,S6=Ry,Sw=k("ZodInstanceOf",(e,t)=>{Ql.init(e,t)},{properties(e,t){return this.check(bo(e,t))}});function W6(e,t={}){let n=new Sw({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...W.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:n,path:[...n._zod.def.path??[]]})},n}var q6=(...e)=>Dy({Codec:Bl,Boolean:No,String:Lo},...e);function Z6(e){let t=Xw(()=>Wo([Il(e),Ix(),Ux(),Kx(),Cl(t),iw(Il(),t)]));return t}function V6(e,t){return new ww({type:"pipe",in:Fd(e),out:t})}var ID={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function UD(e){Ee({customError:e})}function GD(){return Ee().customError}var Ww;Ww||(Ww={});var _l={};Gn(_l,{ZodISODate:()=>Ur,ZodISODateTime:()=>Ir,ZodISODuration:()=>Jr,ZodISOTime:()=>Gr,date:()=>CD,datetime:()=>JD,duration:()=>ED,time:()=>KD});function JD(e){return Vl(Ir,e)}function CD(e){return Rl(Ur,e)}function KD(e){return Dl(Gr,e)}function ED(e){return Hl(Jr,e)}var A={...qo,...pd,iso:_l},YD=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function AD(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function R6(e,t){return e.map((n,i)=>i<t?n:n.optional())}function BD(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function QD(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===i){let r=n[1]===void 0?void 0:BD(n[1]);if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function _D(e,t){return A.transform(i=>i).check(i=>{let r=i.value;if(typeof r!="object"||r===null||Array.isArray(r))return;let a=Object.getOwnPropertyNames(r);if(t.minProperties!==void 0&&a.length<t.minProperties&&i.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:r,inst:e,continue:!0}),t.maxProperties!==void 0&&a.length>t.maxProperties&&i.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:r,inst:e,continue:!0}),t.keySchema)for(let o of a){let s=t.keySchema.safeParse(o);s.success||i.issues.push({code:"invalid_key",origin:"record",issues:s.error.issues,input:o,path:[o],continue:!0})}}).pipe(e)}function qw(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let i=String(e);return`${n[0]}${i.length}:${i}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let a=[];for(let o of e){let s=qw(o,t);if(s===null)return null;a.push(s)}return`a${a.length}:[${a.join(",")}]`}let i=Object.keys(e).sort(),r=[];for(let a of i){let o=qw(e[a],t);if(o===null)return null;r.push(`${a.length}:${a}=${o}`)}return`o${r.length}:{${r.join(",")}}`}finally{t.delete(e)}}var $D=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),eH=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function $l(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some($l):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>$D.has(t)?$l(n):!eH.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some($l))}function D6(e){return e===1?"element":"elements"}function tH(e,t){return A.transform(i=>i).check(i=>{let r=i.value;if(Array.isArray(r)){if(t.uniqueItems===!0){let a=new Map;for(let o=0;o<r.length;o++){let s=qw(r[o],new Set);if(s===null)continue;let c=a.get(s);if(c===void 0){a.set(s,o);continue}i.issues.push({code:"custom",message:`Array items must be unique: element at index ${o} duplicates the one at index ${c}`,input:r,path:[o],continue:!0})}}if(t.containsSchema){let a=t.minContains??1,o=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,s=0;for(let c of r)if(t.containsSchema.safeParse(c).success&&++s>=o)break;s<a&&i.issues.push({code:"custom",message:`Array must contain at least ${a} matching ${D6(a)}; found ${s}`,input:r,continue:!0}),t.maxContains!==void 0&&s>t.maxContains&&i.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${D6(t.maxContains)}`,input:r,continue:!0})}}}).pipe(e)}function H6(e,t){if(e!==!1)return e===void 0||e===!0?A.any():Lt(e,t)}var nH=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function F6(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return A.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return A.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let a=QD(r,t),o=Lt(a,t);return t.refs.set(r,o),t.processing.delete(r),o}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return A.null();if(r.length===0)return A.never();if(r.length===1)return A.literal(r[0]);if(r.every(o=>typeof o=="string"))return A.enum(r);let a=r.map(o=>A.literal(o));return a.length<2?a[0]:A.union([a[0],a[1],...a.slice(2)])}if(e.const!==void 0)return A.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(a=>{let o={...e,type:a};return F6(o,t)});return r.length===0?A.never():r.length===1?r[0]:A.union(r)}if(!n)return A.any();let i;switch(n){case"string":{let r=A.string();if(e.format){let a=e.format;a==="email"?r=r.check(A.email()):a==="uri"||a==="uri-reference"?r=r.check(A.url()):a==="uuid"||a==="guid"?r=r.check(A.uuid()):a==="date-time"?r=r.check(A.iso.datetime({offset:!0})):a==="date"?r=r.check(A.iso.date()):a==="time"?r=r.check(A.regex(nH)):a==="duration"?r=r.check(A.iso.duration()):a==="hostname"?r=r.check(A.hostname()):a==="ipv4"?r=r.check(A.ipv4()):a==="ipv6"?r=r.check(A.ipv6()):a==="mac"?r=r.check(A.mac()):a==="cidr"?r=r.check(A.cidrv4()):a==="cidr-v6"?r=r.check(A.cidrv6()):a==="base64"?r=r.check(A.base64()):a==="base64url"?r=r.check(A.base64url()):a==="e164"?r=r.check(A.e164()):a==="credit_card"?r=r.check(A.creditCard()):a==="iban"?r=r.check(A.iban()):a==="jwt"?r=r.check(A.jwt()):a==="emoji"?r=r.check(A.emoji()):a==="nanoid"?r=r.check(A.nanoid()):a==="cuid"?r=r.check(A.cuid()):a==="cuid2"?r=r.check(A.cuid2()):a==="ulid"?r=r.check(A.ulid()):a==="xid"?r=r.check(A.xid()):a==="ksuid"&&(r=r.check(A.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),i=r;break}case"number":case"integer":{let r=n==="integer"?A.number().int():A.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),i=r;break}case"boolean":{i=A.boolean();break}case"null":{i=A.null();break}case"object":{let r={},a=e.properties||{},o=new Set(e.required||[]),s=typeof e.additionalProperties=="object"?Lt(e.additionalProperties,t):void 0;for(let[f,d]of Object.entries(a)){let m=Lt(d,t);dt(r,f,o.has(f)?m:m.optional())}if(e.patternProperties){let f=e.patternProperties,d=Object.keys(f),m=[];for(let v of d){let b=Lt(f[v],t),h=A.string().regex(new RegExp(v));m.push(A.looseRecord(h,b))}let p=[];if(Object.keys(r).length>0&&p.push(A.object(r).passthrough()),p.push(...m),p.length===0)i=A.object({}).passthrough();else if(p.length===1)i=p[0];else{let v=A.intersection(p[0],p[1]);for(let b=2;b<p.length;b++)v=A.intersection(v,p[b]);i=v}if(e.additionalProperties===!1){let v=Object.keys(r),b=d.map(g=>new RegExp(g)),h=i;i=i.check(g=>{if(!$t(g.value))return;let y=[];for(let x of Object.keys(g.value))v.includes(x)||b.some(P=>P.test(x))||y.push(x);y.length&&g.issues.push({code:"unrecognized_keys",keys:y,input:g.value,inst:h})})}}else{let f=A.object(r);e.additionalProperties===!1?i=f.strict():s?i=f.catchall(s):i=f.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties=="number"?e.minProperties:void 0,u=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||l!==void 0||u!==void 0){let f;if(c){let d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;f=Lt(d,t)}i=_D(i,{keySchema:f,minProperties:l,maxProperties:u})}break}case"array":{let r=e.prefixItems,a=e.items;if(r&&Array.isArray(r)){let o=typeof e.minItems=="number"?e.minItems:0,s=r.map(f=>Lt(f,t)),c=R6(s,o),l=Array.isArray(a)?void 0:H6(a,t),u=A.tuple(c);i=l?u.rest(l):u,typeof e.minItems=="number"&&(i=i.check(A.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(A.maxLength(e.maxItems)))}else if(Array.isArray(a)){let o=typeof e.minItems=="number"?e.minItems:0,s=a.map(f=>Lt(f,t)),c=R6(s,o),l=H6(e.additionalItems,t),u=A.tuple(c);i=l?u.rest(l):u,typeof e.minItems=="number"&&(i=i.check(A.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(A.maxLength(e.maxItems)))}else if(a!==void 0){let o=Lt(a,t),s=A.array(o);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),i=s}else i=A.array(A.any());(e.uniqueItems===!0||e.contains!==void 0)&&(i=tH(i,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?Lt(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${n}`)}return i}function Lt(e,t){if(typeof e=="boolean")return e?A.any():A.never();let n=F6(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(l=>Lt(l,t)),c=A.union(s);n=i?A.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(l=>Lt(l,t)),c=A.xor(s);n=i?A.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=i?n:A.any();else{let s=i?n:Lt(e.allOf[0],t),c=i?0:1;for(let l=c;l<e.allOf.length;l++)s=A.intersection(s,Lt(e.allOf[l],t));n=s}e.nullable===!0&&t.version==="openapi-3.0"&&(n=A.nullable(n)),e.readOnly===!0&&(n=A.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},a=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of a)s in e&&(r[s]=e[s]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let s of o)s in e&&(r[s]=e[s]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!$l(e.propertyNames)&&(r.propertyNames=e.propertyNames);for(let s of["minProperties","maxProperties"])e[s]!==void 0&&(r[s]=e[s])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!$l(e.contains)&&(r.contains=e.contains);for(let s of["uniqueItems","minContains","maxContains"])e[s]!==void 0&&(r[s]=e[s])}for(let s of Object.keys(e))YD.has(s)||dt(r,s,e[s]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function M6(e,t){if(typeof e=="boolean")return e?A.any():A.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=AD(n,t?.defaultTarget),r=n.$defs||n.definitions||{},a={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??mt};return Lt(n,a)}var I6=Symbol("z.visit/resolving");function ec(e,t){let n=typeof t=="function"?t:(o,s)=>{let c=t[o._zod.def.type];return c?c(o,s):o},i=new Map;function r(o){let s=i.get(o);if(s===I6)return new Ll({type:"lazy",getter:()=>i.get(o)});if(s!==void 0)return s;i.set(o,I6);let c=a(o),l=n(c,c!==o);return i.set(o,l),l}function a(o){let s=o._zod.def,c=s.type;switch(c){case"object":{let l=s.shape,u=Object.keys(l),f=!1,d={};for(let p of u){let v=r(l[p]);v!==l[p]&&(f=!0),d[p]=v}let m=s.catchall;return s.catchall&&(m=r(s.catchall),m!==s.catchall&&(f=!0)),f?Le(o,{...s,shape:d,catchall:m}):o}case"array":{let l=r(s.element);return l===s.element?o:Le(o,{...s,element:l})}case"tuple":{let l=s.items,u=!1,f=[];for(let m of l){let p=r(m);p!==m&&(u=!0),f.push(p)}let d=s.rest;return s.rest&&(d=r(s.rest),d!==s.rest&&(u=!0)),u?Le(o,{...s,items:f,rest:d}):o}case"record":case"map":{let l=r(s.keyType),u=r(s.valueType);return l===s.keyType&&u===s.valueType?o:Le(o,{...s,keyType:l,valueType:u})}case"set":{let l=r(s.valueType);return l===s.valueType?o:Le(o,{...s,valueType:l})}case"union":{let l=s.options,u=!1,f=[];for(let d of l){let m=r(d);m!==d&&(u=!0),f.push(m)}return u?Le(o,{...s,options:f}):o}case"intersection":{let l=r(s.left),u=r(s.right);return l===s.left&&u===s.right?o:Le(o,{...s,left:l,right:u})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=r(s.innerType);return l===s.innerType?o:Le(o,{...s,innerType:l})}case"pipe":{let l=r(s.in),u=r(s.out);return l===s.in&&u===s.out?o:Le(o,{...s,in:l,out:u})}case"function":{let l=r(s.input),u=r(s.output);return l===s.input&&u===s.output?o:Le(o,{...s,input:l,output:u})}case"lazy":{let l=s.getter,{_cachedInner:u,...f}=s;return Le(o,{...f,getter:()=>r(l())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return o;default:return o}}return r(e)}function U6(e){return ec(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:Wo(n.options)}})}function rH(e,t){if(!t?.length)return e;let n=e._zod.def;return Le(e,xn(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function G6(e){return rH(e.out,e.checks)}function iH(e){return e.in._zod.traits.has("$ZodTransform")?G6(e):e.in}function J6(e){return ec(e,{pipe:t=>iH(t._zod.def),default:(t,n)=>n?Fi(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function C6(e){return ec(e,{pipe:t=>G6(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var Zw={};Gn(Zw,{bigint:()=>lH,boolean:()=>sH,date:()=>cH,number:()=>oH,string:()=>aH});function aH(e){return ny(Lo,e)}function oH(e){return ly(jo,e)}function sH(e){return vy(No,e)}function lH(e){return hy(So,e)}function cH(e){return Ly(Jl,e)}function K6(e,t){let n=[],i=[];for(let r of e){let a,o=0;for(let s of t){let c=Math.min(s.end,r.end)-Math.max(s.start,r.start);c>o&&(o=c,a=s)}a?n.push({dest:r,source:a,exact:a.start===r.start&&a.end===r.end}):i.push(r)}return{pairs:n,misses:i}}function E6(e,t){let n=e.time??e.timeline_range?.start;if(!n||!Number.isFinite(n.value))return null;let i=n.rate&&n.rate>0?n.rate:t;return Math.round(n.value*(t/i))}function Y6(e,t){let n=e.duration??e.timeline_range?.duration;if(!n||!Number.isFinite(n.value))return 1;let i=n.rate&&n.rate>0?n.rate:t;return Math.max(1,Math.round(n.value*(t/i)))}function Q$(e){let t=(e.timelines??[]).filter(n=>n.kind==="primary");return t.length?t:e.timelines??[]}function uH(e,t){if(t.media_reference_id)return(e.media_references??[]).find(n=>n.id===t.media_reference_id)}var fH={tc:35,reel:25,filename:20,camera_roll:10,duration:5,filepath:5,resolution:0};var dH=[["Exact",95],["High",80],["Medium",60],["Low",40],["None",0]],mH=e=>dH.find(([,t])=>e>=t)?.[0]??"None";function Vw(e){let t=(e??"").trim();for(let n of[".[","_["]){let i=t.lastIndexOf(n);i!==-1&&(t=t.slice(0,i))}return t}var Zo=e=>(e??"").trim().toLowerCase(),A6=(e,t=3)=>e?e.replace(/\\/g,"/").trim().replace(/\/+$/,"").split("/").filter(Boolean).slice(-t).join("/").toLowerCase():"",Vo=e=>typeof e=="number"&&Number.isFinite(e)?Math.trunc(e):null;function pH(e,t){let[n,i,r,a]=[Vo(e.src_start),Vo(e.src_end),Vo(t.src_start),Vo(t.src_end)];if(n===null||i===null||r===null||a===null||i<=n||a<=r)return 0;let o=Math.min(i,a)-Math.max(n,r);return o<=0?0:Math.min(1,o/Math.min(i-n,a-r))}var vH=e=>{let t=e*10,n=Math.round(t);return(t-Math.floor(t)===.5&&n%2?n-1:n)/10};function bH(e,t,n={}){let i={...fH,...n},r=m=>Math.max(0,Math.trunc(i[m])),a=Object.keys(i).reduce((m,p)=>m+r(p),0)||1,o=[],s={},c=0;if(r("tc")>0){let m=pH(e,t);c+=r("tc")*m,m>=.999?o.push("TC: full overlap"):m>0?o.push(`TC: ${Math.round(m*100)}% overlap`):s.tc={dest:[e.src_start,e.src_end],src:[t.src_start,t.src_end]}}let l=(m,p,v,b,h)=>{r(m)<=0||(p&&v&&p===v?(c+=r(m),o.push(b)):(p||v)&&(s[m]=h))};if(l("reel",Zo(e.reel_name),Zo(t.reel_name),`Reel: ${e.reel_name}`,{dest:e.reel_name,src:t.reel_name}),l("filename",Vw(e.file_name).toLowerCase(),Vw(t.file_name).toLowerCase(),`Filename: ${Vw(e.file_name)}`,{dest:e.file_name,src:t.file_name}),l("camera_roll",Zo(e.camera_roll),Zo(t.camera_roll),`Camera Roll: ${e.camera_roll}`,{dest:e.camera_roll,src:t.camera_roll}),r("duration")>0){let m=Vo(e.src_dur),p=Vo(t.src_dur);m!==null&&p!==null&&Math.abs(m-p)<=1?(c+=r("duration"),o.push("Duration: match (\xB11f)")):m!==null&&p!==null&&(s.duration={dest:m,src:p,delta:p-m})}let u=A6(e.file_path),f=A6(t.file_path);l("filepath",u,f,"Path tail: match",{dest:u,src:f}),l("resolution",Zo(e.resolution),Zo(t.resolution),`Resolution: ${e.resolution}`,{dest:e.resolution,src:t.resolution});let d=vH(c/a*100);return{score:d,band:mH(d),reasons:o,deltas:s}}function hH(e,t,n={}){return t.map(i=>({...i,match:bH(e,i,n.weights)})).filter(i=>i.match.score>=(n.minScore??0)).sort((i,r)=>r.match.score-i.match.score).slice(0,Math.max(1,Math.trunc(n.topN??5)))}function B6(e,t,n={}){return e.map(i=>{let r=hH(i,t,{weights:n.weights,topN:n.topN??3,minScore:n.minScore??40}),a=r[0]?.match;return{dest:i,matches:r,band:a?.band??"None",confident:!!a&&a.score>=(n.floor??95)}})}var _6=[["plates","VFX_0010_PLATE01"],["scene_take","VFX_0010_SC_TK"],["clip","VFX_0010_clip name"]];function gH(e){let t=e.replace(/\.[^.]*$/,""),n=/^([A-Z]\d{3})([A-Z]\d{3})/.exec(t)??/^([A-Za-z]?\d+[A-Za-z]?)[-_]([A-Za-z]?\d+)/.exec(t);if(n)return{scene:n[1],take:n[2]};let i=t.split("_");return i.length>=2?{scene:i[0],take:i[1]}:{scene:i[0].slice(0,4),take:""}}function Q6(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=t?new RegExp(`^${n}[_-]?(\\d+)`,"i").exec(e):/(\d+)$/.exec(e);return i?Number(i[1]):void 0}function yH(e,t){let n=Math.max(1,t||10),i=new Set(e.filter(a=>!!a)),r=0;return e.map(a=>{if(a)return r=Math.max(r,a),a;let o=(Math.floor(r/n)+1)*n;for(;i.has(o);)o+=n;return i.add(o),r=o})}function xH(e,t,n,i){let r=Math.max(i?i[0]:-1/0,e-n),a=Math.min(i?i[1]:1/0,t+n);return[r,a>r?a:r+1]}function $6(e,t,n){let i=n.prefix??"VFX",r=Math.max(0,n.handles??6),a=n.startFrame??1001,o=n.digits??4,s=e.filter(m=>n.color==="All"||m.color===n.color).sort((m,p)=>m.frame-p.frame),c=yH(s.map(m=>Q6(m.name,i)),n.increment??10),l=(m,p,v,b,h)=>{let[g,y]=xH(b[0],b[1],r,v.media_range),x=b[0]-g,P=gH(v.name??""),T=v.scene||P.scene,z=v.take||P.take,L=n.naming==="scene_take"?[m,T,z].filter(Boolean).join("_").toUpperCase():n.naming==="clip"?`${m}_${(v.name??"").replace(/\.[^.]*$/,"")}`:m;return{role:p,clip:v,scene:T,take:z,src_in:g,src_out:y,name:p==="HERO"?L:p==="REFERENCE"?`${L}_reference`:`${L}_${p}`,first:a,cut_in:a+x,cut_out:a+x+h-1,last:a+(y-g)-1}},u=s.map((m,p)=>{let v=`${i}_${String(c[p]).padStart(o,"0")}`,b=t.filter(z=>z.start<=m.frame&&m.frame<z.end&&z.media&&(!n.skipDisabled||z.enabled!==!1&&z.track_enabled!==!1)),h=n.referenceTrack?b.find(z=>z.track===n.referenceTrack):void 0,g=b.filter(z=>z!==h).sort((z,L)=>n.hero==="highest"?L.track-z.track:z.track-L.track),y=g.map((z,L)=>l(v,L===0?"HERO":`PLATE${String(L).padStart(2,"0")}`,z,[z.src_in,z.src_out],z.end-z.start)),x=g[0],P=h&&x?l(v,"REFERENCE",h,[h.src_in+(x.start-h.start),h.src_in+(x.end-h.start)],x.end-x.start):void 0;P&&y[0]&&(P.name=`${y[0].name}_reference`);let T=[`Shot: ${v}`];return y.length>1&&T.push(`Plates: ${y.map(z=>z.role).join(", ")}`),y[0]?.scene&&T.push(`Scene: ${y[0].scene}`),y[0]?.take&&T.push(`Take: ${y[0].take}`),{frame:m.frame,number:c[p],name:v,committed:!!Q6(m.name,i),plates:y,reference:P,note:T.join(" | ")}}),f=[],d=0;for(let m of u){let p=[...m.plates,...m.reference?[m.reference]:[]];if(p.length){f.length&&(d+=Math.max(0,n.gap??0));for(let v of p){let b=v.src_out-v.src_in,h=(n.folder||"{shot}").replace(/\{(\w+)\}/g,(g,y)=>({prefix:i,shot:m.name,number:String(m.number).padStart(o,"0"),scene:m.plates[0]?.scene??"",take:m.plates[0]?.take??""})[y]??g);f.push({shot:h,name:v.name,role:v.role,media:v.clip.media,track:1,src_in:v.src_in,src_out:v.src_out,rec_in:d,rec_out:d+b}),d+=b}}}return{shots:u,stringout:f}}var wH={"ACES 2065-1 (AP0)":"ap0",ADX:"adx","ARRI Wide Gamut":"arriwg","ARRI Wide Gamut 4":"arriwg4","BMD Film":"bmdfilm","BMD Film 4.6K":"bmdfilm46k","Canon DCI-P3+":"canonp3dci","Canon CineGamut":"canoncine",CFColor:"cfcolor","Cineon (printing density)":"cineonpd","DaVinci Wide Gamut":"dwg","DCI P3":"p3dci",DRAGONcolor:"dragonc",DRAGONcolor2:"dragonc2",REDWideGamutRGB:"rwg","Filmlight E-Gamut":"egamut","Panasonic V-Gamut":"vgamut","Rec. 709":"rec709","Rec. 2020":"rec2020","Sony S-Gamut":"sgamut","Sony S-Gamut3":"sgamut3","Sony S-Gamut3.Cine":"sgamut3-cine",sRGB:"srgb",XYZ:"xyz"},PH={"ACES 2065-1 (AP0)":"ap0",ACEScct:"acescct",ADX:"adx","ARRI LogC3":"logc3","ARRI LogC4":"logc4","BMD Log":"bmdlog","BMD Log 4.6K":"bmdlog46k","Canon Log2":"canonlog2","Canon Log3":"canonlog3",CFLog:"cflog","Cineon Log":"cineon","DaVinci Intermediate":"dint","DCI (2.6 Gamma)":"g26","Filmlight T-Log":"tlog",HLG:"hlg","ITU-R BT.1886 (2.4 Gamma)":"g24","Linear (1.0 Gamma)":"lin",LogCv3:"logc","Panasonic V-Log":"vlog","Rec. 709 (2.2 Gamma)":"g22",RedLog3G10:"log3g10",RedLogFilm:"redlogfilm","S-Log2":"slog2","S-Log3":"slog3","sRGB (2.2 Gamma)":"g22","ST-2084 (PQ)":"pq","SMPTE ST-2084 (PQ)":"pq"},zH={"Digital Cinema Distribution Master":"dcdm","Digital Cinema Distribution Master: Textless":"dcdm-txtls","Graded Archival Master":"gam","Non-Graded Archival Master":"nam","Non-Graded Archival Master: Textless":"nam-txtls","Video Display Master":"vdm"},kH={"8-bit":"8b","10-bit":"10b","12-bit":"12b","16-bit":"16b"},OH={"ProRes 422 Proxy":"prproxy","ProRes 422 LT":"prlt","ProRes 422":"pr422","ProRes 422 HQ":"prhq","ProRes 4444":"pr4444","ProRes 4444 XQ":"pr4444xq",DNxHD:"dnxhd","DNxHD HQ":"dnxhd-hq","DNxHD LB":"dnxhd-lb","DNxHR LB":"dnxhr-lb","DNxHR SQ":"dnxhr-sq","DNxHR HQ":"dnxhrhq","DNxHR HQX":"dnxhrhqx","DNxHR 444":"dnxhr444","H.264":"h264","H.265 / HEVC":"h265",AV1:"av1",VP9:"vp9","DPX 10-bit":"dpx10b","DPX 16-bit":"dpx16b","EXR 16-bit":"exr16b","EXR 32-bit":"exr32b","TIFF 8-bit":"tiff8b","TIFF 16-bit":"tiff16b",JPEG:"jpeg","JPEG 2000":"j2k",ARRIRAW:"arriraw","REDCODE RAW":"redraw","Cinema DNG":"cinemadng","XAVC-I":"xavc-i","XAVC-L":"xavc-l","XAVC HS":"xavc-hs","XDCAM HD":"xdcamhd","MXF OP1a":"mxf-op1a",CineForm:"cineform","Motion JPEG":"mjpeg"},XH={"High Dynamic Range":"hdr","Standard Dynamic Range":"sdr"},TH={"1.33 (4:3)":"133","1.78 (16:9)":"178","1.85 (Flat)":"185","2.00 (Univisium)":"200","2.35 (Scope)":"235","2.39 (Scope)":"239","2.40 (Scope)":"240"},LH={"ACES 1.0":"aces100","ACES 1.03":"aces103","ACES 1.1":"aces110","ACES 1.2":"aces120","ACES 1.3":"aces130","ACES 2.0":"aces200"},Je=(e,t,n)=>({id:e,enabled:!0,value:t,order:n}),Gi=(e,t,n,i)=>({name:e,fields:[...t,...n.map(([r,a],o)=>Je(r,a,t.length+o))],caseTransform:"lowercase",separator:"_",folderStructure:i}),Gd=[Je("show","",0),Je("episode","s01e101",1)],Rw=[["bitDepth","16-bit"],["colorspace","REDWideGamutRGB"],["gamma","RedLog3G10"],["date",""],["resolution","3840x2160"]],Dw=[["bitDepth","16-bit"],["dynamicRange","Standard Dynamic Range"],["colorspace","XYZ"],["gamma","DCI (2.6 Gamma)"],["date",""],["aspectRatio","2.39 (Scope)"],["resolution","4096x1716"]],Do={conformtools:{name:"CONFORM.TOOLS",fields:[Je("marker","",0),Je("colorspace","Rec. 709",1),Je("gamma","ITU-R BT.1886 (2.4 Gamma)",2),Je("codec","ProRes 422 HQ",3),Je("date","",4),Je("time","",5),Je("artist","",6)],caseTransform:"uppercase",separator:"_",folderStructure:"{project}/{timeline}/{date}"},netflix_episodic_nam:Gi("Netflix: Episodic NAM",Gd,[["assetType","Non-Graded Archival Master"],...Rw],"{show}_s{season}/{show}_{episode}_nam"),netflix_episodic_nam_textless:Gi("Netflix: Episodic NAM Textless",Gd,[["assetType","Non-Graded Archival Master: Textless"],...Rw],"{show}_s{season}/{show}_{episode}_nam-txtls"),netflix_episodic_dcdm:Gi("Netflix: Episodic DCDM",Gd,[["assetType","Digital Cinema Distribution Master"],...Dw],"{show}_s{season}/{show}_{episode}_dcdm"),netflix_film_nam:Gi("Netflix: Film NAM",[Je("film","",0),Je("reel","lp",1)],[["assetType","Non-Graded Archival Master"],...Rw],"{film}_nam"),netflix_film_dcdm_sdr:Gi("Netflix: Film DCDM SDR",[Je("film","",0)],[["assetType","Digital Cinema Distribution Master"],...Dw],"{film}_dcdm"),netflix_film_segmented:Gi("Netflix: Film Segmented/Reel",[Je("film","",0),Je("reel","r01",1)],[["assetType","Digital Cinema Distribution Master"],...Dw],"{film}_dcdm/{reel}"),netflix_aces_episodic:Gi("Netflix: ACES Episodic",Gd,[["assetType","Non-Graded Archival Master"],["bitDepth","16-bit"],["acesVersion","ACES 1.03"],["colorspace","ACES 2065-1 (AP0)"],["gamma","Linear (1.0 Gamma)"],["date",""],["resolution","3840x2160"]],"{show}_s{season}/{show}_{episode}_nam_aces"),color_posting:{name:"Color Posting",fields:[Je("marker","",0),Je("colorspace","Rec. 709",1),Je("gamma","ITU-R BT.1886 (2.4 Gamma)",2),Je("date","",3)],caseTransform:"uppercase",separator:"_",folderStructure:"{project}/Deliveries/{date}"},tv_series:{name:"TV Series",fields:[Je("marker","",0),Je("show","",1),Je("episode","",2),Je("colorspace","Rec. 709",3),Je("version","v001",4)],caseTransform:"none",separator:"_",folderStructure:"{show}/Season_{season}/{episode}"}},Jd=e=>String(e).padStart(2,"0"),Hw=(e=new Date)=>`${e.getFullYear()}${Jd(e.getMonth()+1)}${Jd(e.getDate())}`,jH=(e=new Date)=>`${Jd(e.getHours())}${Jd(e.getMinutes())}`;function Mw(e,t){return t==="uppercase"?e.toUpperCase():t==="lowercase"?e.toLowerCase():e}var Fw={marker:"{MARKER}",timelineTC:"{TL_TC}",sourceTC:"{SRC_TC}"},NH=new Set([...Object.keys(Fw),"date","time"]),Ro=(e,t)=>e.toLowerCase().replace(new RegExp(`[^${t}]`,"g"),""),SH={colorspace:[wH,e=>Ro(e,"a-z0-9")],gamma:[PH,e=>Ro(e,"a-z0-9")],codec:[OH,e=>Ro(e,"a-z0-9")],assetType:[zH,e=>Ro(e,"a-z0-9-")],bitDepth:[kH,e=>Ro(e,"a-z0-9")],dynamicRange:[XH,e=>e.toLowerCase()],aspectRatio:[TH,e=>e.replace(/[^0-9]/g,"")],acesVersion:[LH,e=>Ro(e,"a-z0-9")]};function WH(e,t,n){if(Fw[e])return Fw[e];let i=n.customDropdownOptions?.[e]?.find(o=>o.label===t)?.abbr,r=SH[e],a=i??(e==="date"?Hw(n.now):e==="time"?jH(n.now):r?r[0][t]||r[1](t||""):t||"");return a&&!a.startsWith("{")?Mw(a,n.caseTransform):a}function qH(e,t){let i=[...e].sort((r,a)=>r.order-a.order).filter(r=>r.enabled&&(r.value||NH.has(r.id))).map(r=>({text:WH(r.id,r.value,t),sep:r.separator})).filter(r=>r.text).reduce((r,a,o)=>o===0?a.text:r+(a.sep??t.separator)+a.text,"");if(t.markerName!==void 0){let r=Mw(t.markerName,t.caseTransform);i=i.includes("{MARKER}")?i.split("{MARKER}").join(r):i?`${r}_${i}`:r}return i}var tO=["project","timeline","date","show","episode","season","film","reel","title"];function ZH(e,t){let n=e;for(let i of tO)n=n.split(`{${i}}`).join(t[i]??"");return n.replace(/\/{2,}/g,"/").replace(/^\/+|\/+$/g,"")}var eO=e=>e?e.replace(/[:;]/g,"-"):"";function nO(e,t){let n=t.scope??"duration",i=Math.round(t.naming.handleFrames??0),r=e.filter(l=>l.color===t.color&&(n==="all"||(n==="frame"?l.duration<=1:l.duration>1))).sort((l,u)=>l.frame-u.frame),a={caseTransform:t.naming.caseTransform,customDropdownOptions:t.naming.customDropdownOptions,now:t.now,separator:t.naming.separator},o=r.map((l,u)=>{let d=((t.template?.trim()?Mw(tO.reduce((h,g)=>h.split(`{${g}}`).join((g==="date"?Hw(t.now):t.folder?.[g])??""),t.template).split("{MARKER}").join(l.name||`Marker_${u+1}`).split("{N}").join(String(u+1).padStart(3,"0")),t.naming.caseTransform):null)??qH(t.naming.fields,{...a,markerName:l.name||`Marker_${u+1}`})).split("{TL_TC}").join(eO(l.tc)).split("{SRC_TC}").join(eO(l.srcTc)).replace(/[^\w-]+/g,t.naming.separator||"_"),m=t.startFrame+l.frame,p=m+Math.max(1,l.duration)-1,v=m-i,b=p+i;return v>b&&(v=b=Math.floor((m+p)/2)),{name:d,in:Math.max(t.startFrame,v),out:Math.min(t.lastFrame,b),marker:l,dupe:!1}}),s=new Set;for(let l of o)l.dupe=s.has(l.name),s.add(l.name);return{dir:ZH(t.naming.folderStructure,{date:Hw(t.now),...t.folder}),jobs:o}}function rO(e){return/[",\n\r]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function VH(e){return e==null?"":String(e)}function iO(e,t){let n=e.map(r=>rO(r.header)).join(","),i=t.map(r=>e.map(a=>rO(VH(a.value(r)))).join(","));return[n,...i].join(`
91
91
  `)}var Iw=["Blue","Cyan","Green","Yellow","Red","Pink","Purple","Fuchsia","Rose","Lavender","Sky","Mint","Lemon","Sand","Cocoa","Cream"];function lee(e,t){let n=_e(e),i=_9(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,d=u.timeline_range?.duration?.value??0;if(l>=f&&l<f+d)return u.name??u.id}return""},c=[];return(e.markers??[]).forEach((l,u)=>{let f=E6(l,n);if(f==null)return;let d=Y6(l,n),m=l.id??`marker-${u}`,p=l.item_id&&a.get(l.item_id)?.name||s(f),v={id:m,marker:l,frame:f,tc:We(r+f,n,i),duration:d,durationTc:d>1?We(d,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:d},c.push(v)}),c.sort((l,u)=>l.frame-u.frame)}var cee={...Object.fromEntries(Iw.map(e=>[e.toLowerCase(),t=>t.color.toLowerCase()===e.toLowerCase()])),duration:e=>e.duration>1};function uee(e){return iO([{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 RH=["#","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"],DH=["tc","frame","color","name","note","duration","frames","clip","item_id"];function HH(e,t){return t?e.map(n=>{let i=t[String(n.cells.target_url??"")],r=Number(i?.fps),a=Number(i?.frames);if(!i||Number(n.cells["available_range.dur"])>0||!(r>0)||!(a>0))return n;let o=ke(i.start_tc,r);return o==null?n:{...n,cells:{...n.cells,"available_range.start":o,"available_range.dur":a,"available_range.rate":r}}}):e}function FH(e,t,n,i,r){let a=n.map(l=>({c:l,ref:nn(l)})).filter(l=>l.ref?.kind==="video"),o=l=>a.filter(({c:u,ref:f})=>l>=f.start&&l<f.start+Number(u.cells["timeline_range.dur"]??0)).sort((u,f)=>f.ref.track-u.ref.track)[0]?.c,s=(l,u,f,d,m)=>({id:l,cells:{tc:We(f+r,i),frame:f,color:u.color,name:u.name,note:u.note,duration:"",frames:Math.max(1,u.duration),clip:String(m?.cells.name??""),item_id:d==="clip"?m.id:"",on:d,...u.data?{data:u.data}:{}}}),c=e.map(l=>s(`api-marker-${l.frame}`,l,l.frame,"timeline",o(l.frame)));for(let l of t){if(l.kind!=="video"||!l.marker_list?.length)continue;let u=a.find(({ref:d})=>d.track===l.track&&d.start===l.start)?.c;if(!u)continue;let f=Number(u.cells["source_range.start"]??0);for(let d of l.marker_list)c.push(s(`api-clip-marker-${u.id}-${d.frame}`,d,l.start+d.frame-f,"clip",u))}return c.sort((l,u)=>Number(l.cells.frame)-Number(u.cells.frame))}function nn(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 Ji=(e,t)=>e.media.find(n=>n.id===`mr:${t.cells.media_reference_id}`);function Fn(e,t){let n=nn(t);return n?e.items.find(i=>i.kind===n.kind&&i.track===n.track&&i.start===n.start)??null:null}var pee=[...Iw];async function vee(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 MH(e,String(i.session_id),{host:n,project:String(i.project??""),timeline:String(i.timeline??"")})}async function MH(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(b=>b.ok?b:r,()=>r):a,e("timeline_query",{session_id:t,table:"clips",limit:5e3,columns:RH}),e("timeline_query",{session_id:t,table:"markers",limit:5e3,columns:DH}),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","source_resolution_w","source_resolution_h"]})]);for(let b of[o,s,c])if(!b.ok)throw new Error(b.text);let f=i==="resolve"?parseFloat(String(o.fps??"")):NaN,d=i==="resolve"?Number(o.frames):NaN,m=f>0?f:Number(s.fps??24),p=Number(o.start_frame??0),v=i==="resolve"&&Array.isArray(o.marker_list)?FH(o.marker_list,o.items??[],s.rows??[],m,p):null;return{host:i,project:n.project??"",timeline:n.timeline??"",session_id:t,start_frame:Number(o.start_frame??0),fps:m,frames:d>0?d:Math.max(0,...(s.rows??[]).map(b=>Number(b.cells["timeline_range.start"]??0)+Number(b.cells["timeline_range.dur"]??0))),clips:s.rows??[],markers:v??c.rows??[],media:HH(u.rows??[],i==="resolve"?o.media_facts:void 0),items:o.items??[],color_groups:o.color_groups??[],marker_data:o.marker_data??{},...o.playhead_tc?{playhead:(ke(String(o.playhead_tc),m)??0)-Number(o.start_frame??0)}:{},layers:Number(o.layers??1),tracks:l.tracks??[],...IH(o.output_blanking,o.raster)}}function IH(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 Cr(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&&nn(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 UH(e,t,n){let i=e.clips.map(r=>({c:r,ref:nn(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 GH={name:"name",note:"note",keyword:"data"},JH=(e,t,n)=>t?e.replace(new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi"),()=>n):e;function gee(e){for(let t of e.markers){let n=Cr(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 yee(e,t,n,i,r,a={}){let o=[],s=a.field??"name",c=a.separator??"";for(let l of t){let u=Cr(e,l);if(!u)continue;let f=String(l.cells.name??""),d=String(l.cells.note??""),m=Math.max(1,Number(l.cells.frames??1)),p=String(l.cells.data??l.cells.keyword??""),v={name:f,note:d,keyword:p}[s],b={...u.item?{item:u.item,record:u.record}:{},frame:u.frame},h=g=>o.push({op:"marker_update",...b,[GH[s]]:g});if(n==="recolor")o.push({op:"marker_update",...b,color:i});else if(n==="swap"){let g=String(l.cells.color);(g===i||g===r)&&o.push({op:"marker_update",...b,color:g===i?r:i})}else if(n==="rename")h(r);else if(n==="note")o.push({op:"marker_update",...b,note:r});else if(n==="keyword")o.push({op:"marker_update",...b,data:r});else if(n==="prefix")h(`${r}${v&&r?c:""}${v}`);else if(n==="suffix")h(`${v}${v&&r?c:""}${r}`);else if(n==="replace"){let g=JH(v,r,a.with??"");g!==v&&h(g)}else if(n==="duration"){let g=Math.max(1,Math.round(Number(a.frames??0)));a.frames&&g!==m&&o.push({op:"marker_update",...b,duration:g})}else if(n==="delete")o.push({op:"marker_delete",...b});else{let y=n==="to_clip"||n==="copy_to_clip"||n==="swap_places"&&!u.item?u.item?null:UH(e,u.frame,a.track):u.item?{frame:Number(l.cells.frame)}:null;if(!y||a.overwrite===!1&&n!=="swap_places"&&e.markers.some(x=>x!==l&&Number(x.cells.frame)===("record"in y?y.record:y.frame)&&("item"in y?Cr(e,x)?.item?.track===y.item.track&&Cr(e,x)?.item?.start===y.item.start:!x.cells.item_id)))continue;n.startsWith("copy_")||o.push({op:"marker_delete",...b}),o.push({op:"marker_add",...y,color:String(l.cells.color||"Blue"),name:f,note:d,duration:m,...p?{data:p}:{}})}}return n==="swap_places"?[...o.filter(l=>l.op==="marker_delete"),...o.filter(l=>l.op!=="marker_delete")]:o}var aO=(e,t)=>e.media===t.media||!!e.alt&&e.alt===t.alt,CH=(e,t)=>aO(e,t)?Math.min(e.src_out,t.src_out)-Math.max(e.src_in,t.src_in):0;function Cd(e,t){let n=e.flatMap(p=>t.map(v=>({a:p,b:v,o:CH(p,v)}))).filter(p=>p.o>0).sort((p,v)=>v.o-p.o||+(v.a.track===v.b.track)-+(p.a.track===p.b.track)||Math.abs(p.a.rec_in-p.b.rec_in)-Math.abs(v.a.rec_in-v.b.rec_in)),i=new Map,r=new Set;for(let p of n)!i.has(p.b)&&!r.has(p.a)&&(i.set(p.b,p.a),r.add(p.a));let a=p=>`${p.track}|${p.media}|${p.src_in}|${p.src_out}`,o=new Map;for(let[p,v]of i)a(v)===a(p)&&o.set(a(v),[...o.get(a(v))??[],[p,v]]);for(let p of o.values()){if(p.length<2)continue;let v=p.map(([h])=>h).sort((h,g)=>h.rec_in-g.rec_in),b=p.map(([,h])=>h).sort((h,g)=>h.rec_in-g.rec_in);v.forEach((h,g)=>i.set(h,b[g]))}for(let p of n)!i.has(p.b)&&r.has(p.a)&&i.set(p.b,p.a);let s=new Map;for(let[p,v]of i)s.set(v,[...s.get(v)??[],p]);let c=new Map;for(let p of e){if(s.has(p))continue;let v=t.find(b=>aO(p,b)&&b.src_in<=p.src_in&&p.src_out<=b.src_out);v&&c.set(v,[...c.get(v)??[],p])}let l=new Set([...c.values()].flat()),u=new Map([...c].map(([p,v])=>[p,v.length+1])),f=[...i].sort((p,v)=>p[0].rec_in-v[0].rec_in),d=new Set;for(let p of new Set(f.map(([v])=>v.track))){let v=f.map((b,h)=>[b,h]).filter(([[b]])=>b.track===p);for(let b of KH(v.map(([[,h]])=>h.rec_in)))d.add(v[b][1])}f.forEach(([p,v],b)=>{p.rec_in===v.rec_in&&d.add(b)});let m=[];f.forEach(([p,v],b)=>{let h=[],g=p.src_in-v.src_in,y=p.src_out-v.src_out;(s.get(v)?.length??0)>1&&h.push("split"),(u.get(p)??0)>1&&h.push("joined"),d.has(b)||h.push("moved"),g&&y&&g===y?h.push("slipped"):(g>0?h.push("trimmed head"):g<0&&h.push("extended head"),y<0?h.push("trimmed tail"):y>0&&h.push("extended tail")),(v.speed??100)!==(p.speed??100)&&h.push("retimed"),(v.sizing??"")!==(p.sizing??"")&&h.push("reframed"),m.push({kinds:h.length?h:["unchanged"],a:v,b:p,...g?{head:g}:{},...y?{tail:y}:{},...v.media!==p.media?{loose:!0}:{}})});for(let p of t)i.has(p)||m.push({kinds:["inserted"],b:p});for(let p of e)!s.has(p)&&!l.has(p)&&m.push({kinds:["deleted"],a:p});return m.sort((p,v)=>(p.b?.rec_in??p.a.rec_in)-(v.b?.rec_in??v.a.rec_in)||+!p.b-+!v.b)}function KH(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}function EH(e){let t=e.kinds[0];return e.loose&&t==="unchanged"?"unconfirmed":t==="trimmed head"||t==="trimmed tail"?"trimmed":t==="extended head"||t==="extended tail"?"extended":t==="joined"?"split":t}function oO(e,t,n){let i=new Map(e.map((u,f)=>[u.id,f])),r=new Map(t.map((u,f)=>[u.id,f])),a=new Map,o=new Map,s=[],c=[];for(let u of Cd(e,t)){let f=EH(u),d=u.a?i.get(u.a.id)??null:null,m=u.b?r.get(u.b.id)??null:null;d!=null&&a.set(d,f),m!=null&&o.set(m,f),d!=null&&m!=null&&s.push({a:d,b:m,kind:f}),c.push({kind:f,a_index:d,b_index:m,detail:u.kinds.join(", "),delta_head:u.head,delta_tail:u.tail,timecode_a:u.a&&n?n("a",u.a.rec_in):void 0,timecode_b:u.b&&n?n("b",u.b.rec_in):void 0})}let l=(u,f,d,m)=>({i:f,name:u.name,start:u.rec_in,end:u.rec_out,track:u.track,kind:d.get(f)??m});return{map:{a:e.map((u,f)=>l(u,f,a,"deleted")),b:t.map((u,f)=>l(u,f,o,"inserted")),links:s,a_frames:Math.max(0,...e.map(u=>u.rec_out)),b_frames:Math.max(0,...t.map(u=>u.rec_out))},changes:c}}var sO=/(?<![A-Za-z0-9])[vV](\d{1,4})(?![A-Za-z0-9])/,YH=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"]),AH=/^(?:19|20)\d{6}$|^\d{4}-\d{2}-\d{2}$|^\d{6}$/,BH=/^\d{3,4}x\d{3,4}$/i,QH=/^[#%]+d?$/,_H=/^(?:sh|shot|s)?[_-]?(\d{2,5})(?:[a-z])?$/i;function $H(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 lO(e){let t=$H(e),n=sO.exec(t),i=n?Number(n[1]):null,r=t.replace(new RegExp(sO.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=>!(YH.has(f.toLowerCase())||AH.test(f)||BH.test(f)||QH.test(f))),s=a.filter((f,d)=>o[d]),c=(f,d)=>{let m=[];for(let b=f-1;b>=0&&m.length<2&&o[b]&&/^[A-Za-z]{1,6}\d{0,3}$/.test(a[b]);b--)m.unshift(a[b]);let p=m.join("_"),v=[d];for(let b=f+1;b<a.length&&o[b]&&/^\d{2,5}[a-zA-Z]?$/.test(a[b]);b++)v.push(a[b]);return[[...p?[p]:[],...v].join("_"),p]},l="",u="";if(/^[A-Z]\d{3}$/i.test(a[0]??"")&&/^C\d{3}/i.test(a[1]??"")||/^[A-Z]\d{3}C\d{3}/i.test(a[0]??""))return{shot:l,version:i,tokens:s,sequence:u,stem:t};for(let f=0;f<a.length;f++){let d=a[f];if(!o[f])continue;if(/^\d{2,5}$/.test(d)){[l,u]=c(f,d);break}let m=_H.exec(d);if(m&&/^(sh|shot|s)/i.test(d)){[l,u]=c(f,/^(sh|shot)/i.test(d)?d:m[1]);break}}return{shot:l,version:i,tokens:s,sequence:u,stem:t}}function Ho(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 Fo(e){let t=new Set,n=String(e??""),i=lO(n);i.shot&&t.add(Ho(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(Ho([...a?[a]:[],...o].join("_"))),a&&t.add(Ho(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(Ho(`${r[1]}_${r[2]}`));return t.delete(""),t}function eF(e){if(!e.shot)return["",""];let t=Ho(e.shot);return e.sequence&&e.shot.toLowerCase().startsWith(e.sequence.toLowerCase())?[t,Ho(e.shot.slice(e.sequence.length))]:[t,t]}var tc={marker:.95,plate_name:.9,metadata:.85,timecode:.92},tF=(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},Kd=e=>String(e??"").toLowerCase().replace(/[^a-z0-9]/g,"");function cO(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 nF(e,t,n,i){let[r,a]=eF(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 rF(e,t){let n=tF(e.start_tc,e.fps);if(!n)return[];let i=n+e.frames,r=Kd(e.reel);return t.flatMap(a=>{if(!a.src_tc||Math.abs((a.media_fps??e.fps)-e.fps)>.01)return[];if(r&&Kd(a.reel)&&r!==Kd(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&&Kd(a.reel)===r}]:[]}).sort((a,o)=>o.overlap-a.overlap||a.start-o.start)}function uO(e,t,n){return e.map(i=>{let r=lO(i.name),a={comp:i,shot:r.shot,version:r.version,status:"unmatched",matched_by:"",confidence:0,offset:0,reasons:[]},o=nF(i,r,t,n),s=rF(i,t),c=d=>`${d.start}:${d.end}`,l=new Set(o.map(c)),u;if(l.size===1){let d=[...o].sort((p,v)=>tc[v.tier]-tc[p.tier])[0];u={...d,confidence:tc[d.tier]};let m=s.find(p=>c(p)===c(d));m?(u.offset=m.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 d=s.filter(m=>l.has(c(m)));if(new Set(d.map(c)).size===1)u={...d[0],confidence:Math.min(.99,tc.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 d=s[0],m=s.filter(p=>p.contained);if(m.length>1||s.length>1&&s[1].overlap>=.9*d.overlap&&!d.reel_agrees)return a.status="ambiguous",a.reasons.push(`the comp's source timecode covers ${Math.max(m.length,2)} plates - name it for the shot, or place it by hand`),a;u={...d,confidence:tc.timecode+(d.reel_agrees?.04:0)}}if(!u)return a.reasons.push(r.shot?`no plate or VFX marker is shot ${r.shot}, and no plate's source timecode overlaps it`:"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=cO(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 ze=e=>({track:e.track,start:e.start}),Vee=[["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 Ree(e,t){return e.clips.filter(n=>!t||t.has(n.id)).map(n=>{let i=Fn(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 fO(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 Dee(e,t,n,i,r){let a=[];for(let o of t){let s=nn(o),c=Fn(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=fO(r,!0);Object.keys(u).length&&a.push({op:"properties",item:l,set:u});break}case"metadata":{let u=fO(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(m=>m.trim()).filter(Boolean),f=r.split(",").map(m=>m.trim()).filter(Boolean),d=n==="keywords_add"?[...new Set([...u,...f])]:u.filter(m=>!f.some(p=>p.toLowerCase()===m.toLowerCase()));d.join(",")!==u.join(",")&&a.push({op:"metadata",item:l,set:{Keywords:d.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=Cr(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 bO=e=>[...e.clip_list??[],...(e.folders??[]).flatMap(bO)],iF=e=>e.match(/^(\/Volumes\/[^/]+|[A-Za-z]:\\|\/mnt\/[^/]+|\/[^/]+)/)?.[1]??"(no file)",Hee=(e,t="",n=new Set)=>bO(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:iF(i.file),type:i.type||"",duration:i.duration||""}})),Fee=(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,from:e.map(i=>String(i.cells.folder??""))}]:[],Jw=[["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 aF(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 oF=1;function Ad(e,t,n){let i=aF(e,t,n);return e.version_type===oF&&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 Mee(e,t,n){let i=e.items.filter(o=>o.kind==="video"),{pairs:r,misses:a}=K6(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?Ad(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:We(e.start_frame+o.dest.start,e.fps||24),tc:We(e.start_frame+o.dest.start,e.fps||24),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??"",...s?.do==="skip"?{why:"not the same shot: its grade is not copied, the clip is marked"}:{},...e.playhead!=null&&e.playhead>=o.dest.start&&e.playhead<o.dest.end?{at:"playhead"}:{}}}})}function sF(e,t,n){let i=c=>e.clips.find(l=>{let u=nn(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=Cr(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 lF=(e,t)=>[...new Set([...e.split(","),...t.split(",")].map(n=>n.trim()).filter(Boolean))].join(","),Iee=e=>String(e??"").split(",").map(t=>t.trim()).filter(Boolean);function Uee(e,t,n,i,r=!1,a=[]){let o=r?{overwrite:!0}:{},s=[],c=new Map,l=new Map,u=[];for(let d of e){let m=d.dest,p=d.source;if(!p){n&&s.push({op:"marker_add",frame:m.start,color:n,name:"Copy Grades: no source",note:m.name,data:"ConformTools:copy-grades",...o});continue}let v=`${p.track}:${p.start}`;if(c.set(v,{src:p,dests:[...c.get(v)?.dests??[],m]}),!t.has("grade"))continue;let b=Ad(p,m,!!d.exact);b.do==="remote"?u.push({op:"version",item:ze(m),type:"remote",load:p.version}):b.do==="copy"?l.set(v,[...l.get(v)??[],m]):s.push({op:"marker_add",frame:m.start,color:n||"Yellow",name:"Copy Grades: not sure",note:`${m.name}: ${b.why}`,data:"ConformTools:copy-grades",...o})}let f=Jw.filter(([d])=>t.has(d)).flatMap(([,,d])=>d);for(let[d,{src:m,dests:p}]of c){let v=l.get(d);if(v?.length&&a.length?u.push(...v.map(b=>({op:"copy_nodes",item:ze(b),from:ze(m),nodes:a}))):v?.length&&u.push({op:"copy_grade",item:ze(m),to:v.map(ze)}),t.has("versions")&&v?.length&&!a.length&&(m.versions?.length??0)>1){for(let b of m.versions){u.push({op:"version",item:ze(m),load:b});for(let h of v)u.push(h.versions?.includes(b)?{op:"version",item:ze(h),load:b}:{op:"version",item:ze(h),add:b});u.push({op:"copy_grade",item:ze(m),to:v.map(ze)})}m.version&&u.push({op:"version",item:ze(m),load:m.version},...v.map(b=>({op:"version",item:ze(b),load:m.version})))}f.length&&u.push({op:"copy_properties",item:ze(m),to:p.map(ze),keys:f});for(let b of p){t.has("clip_color")&&b.color!==m.color&&u.push({op:"clip_color",item:ze(b),color:m.color}),t.has("flags")&&b.flags.join()!==m.flags.join()&&u.push({op:"flags",item:ze(b),clear:"All",add:m.flags}),t.has("group")&&m.group&&b.group!==m.group&&u.push({op:"color_group",item:ze(b),group:m.group});let h=lF(b.keywords??"",m.keywords??"");t.has("keywords")&&m.keywords&&h!==(b.keywords??"")&&u.push({op:"metadata",item:ze(b),set:{Keywords:h}}),t.has("markers")&&i&&u.push(...sF(i,m,b))}}return[...u,...s]}function Gee(e,t,n,i=[],r={}){let a={clips:t,media:n,items:i};return t.flatMap(o=>{let s=nn(o);if(!s||s.kind!=="video")return[];if(r.enabledOnly&&(o.cells.enabled===!1||o.cells.track_enabled===!1||Fn(a,o)?.enabled===!1))return[];let c=Ji(a,o),l=c?String(c.cells.target_url??""):"",u=Number(c?.cells["available_range.dur"]),f=u>0?u:NaN,d=Number.isFinite(f)?Number(c?.cells["available_range.start"]):NaN,m=Fn(a,o),p=m?.version;return[{timeline:e,track:s.track,start:s.start,name:String(o.cells.name??""),...p?{version:p}:{},...m?{color:m.color,flags:m.flags}:{},file_name:l?l.split(/[\\/]/).pop():String(o.cells.name??""),file_path:l||null,reel_name:o.cells.reel_name??null,src_start:Number.isFinite(d)?d:null,src_end:Number.isFinite(d)&&Number.isFinite(f)?d+f:null,src_dur:Number.isFinite(f)?f:null,src_fps:Number(c?.cells.source_fps)>0?Number(c?.cells.source_fps):null,resolution:Number(c?.cells.source_resolution_w)>0?`${c.cells.source_resolution_w}x${c.cells.source_resolution_h}`:null}]})}function Jee(e,t,n){return B6(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 Cee(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=[ze(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:ze(c),to:a}),t.keys?.length&&!o&&!u&&n.push({op:"copy_properties",from_timeline:c.timeline,item:ze(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 rn=(e,t=3)=>Math.abs(e)<1e-9?"0":e.toFixed(t).replace(/\.?0+$/,"");function Kee(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?"":rn(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 ${rn(r.zoom,4)}${r.height!==1?` \xB7 Height ${rn(r.height,4)}`:""} \xB7 Pan ${rn(r.pan,4)} \xB7 Tilt ${rn(r.tilt,4)} \xB7 Rotate ${rn(r.rotation,2)}\xB0${r.flip_x?" \xB7 Flip H":""}${r.flip_y?" \xB7 Flip V":""}`:i?`Zoom ${rn(i.ZoomX,4)}${i.ZoomY!==i.ZoomX?`\xD7${rn(i.ZoomY,4)}`:""} \xB7 Pan ${rn(i.Pan,1)} \xB7 Tilt ${rn(i.Tilt,1)} \xB7 Rot ${rn(i.RotationAngle,2)}\xB0${i.FlipX?" \xB7 FlipX":""}${i.FlipY?" \xB7 FlipY":""}`:"",why:n.verdict==="aligned"?"":n.reason??"",cant:s?"":"not aligned"}}})}function Eee(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 Yee=(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 ${rn(i.zoom_fix,4)}`)}}))};function Aee(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 Uw={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"]},Ed=e=>e?`${e.file} @ ${e.src_tc??"\u2013"} [${e.track}]`:"",Bee=(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:Uw[n.kind]?.[0]??n.kind,a:Ed(n.a),b:Ed(n.b),tc:n.rec_in_tc},op:{op:"marker_add",frame:n.rec_in-t,color:Uw[n.kind]?.[1]??"Blue",name:`Reconform: ${Uw[n.kind]?.[0]??n.kind}`,note:`${n.note??""}
92
92
  A ${Ed(n.a)}
93
- B ${Ed(n.b)}`.trim(),duration:Math.max(1,n.frames),data:"ConformTools:reconform"}}));function dO(e){return e.clips.flatMap(t=>{let n=nn(t),i=Fn(e,t);if(!n||n.kind!=="video"||!i)return[];let r=Ji(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 Gw(e,t){let n=e.clips.find(a=>Fn(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 hO="100|100|0|0|0|0|0|0|0",mO=e=>{let[t,n,i,r,a]=e.split("|").map(Number);return e===hO?"as shot":`${t===n?`${t}%`:`${t}\xD7${n}%`}${i||r?` \xB7 ${i},${r}`:""}${a?` \xB7 ${a}\xB0`:""}`};function Qee(e,t){let n=dO(e),i=new Map;for(let r of n)i.set(r.key,[...i.get(r.key)??[],r]);return dO(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(m=>({s:m,shared:Math.min(m.s1,r.s1)-Math.max(m.s0,r.s0)})).filter(m=>m.shared>0).sort((m,p)=>p.shared-m.shared||Math.abs(m.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?Ad(o.s.it,r.it,!0):void 0,l=o?Gw(e,o.s.it):"",u=Gw(t,r.it),f=!!o&&!!l&&!!u&&l!==u&&u!==hO,d=(()=>{if(a.length<2||r.s1-r.s0!==r.it.end-r.it.start)return;let m=[...a].sort((p,v)=>p.s.s0-v.s.s0).map(p=>{let v=Math.max(p.s.s0,r.s0),b=Math.min(p.s.s1,r.s1);return{start:r.it.start+(v-r.s0),end:r.it.start+(b-r.s0),source:p.s.it,a_src:p.s.s0,d_src:v}}).filter(p=>p.end>p.start);return new Set(m.map(p=>Gw(e,p.source))).size>1?m: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,...d?{segments:d}:{},cells:{...f?{sizing_differs:!0,a_sizing:mO(l),b_sizing:mO(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:d?`cut into ${d.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 gO=[["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 _ee(e,t,n,i,r){let a=[],o=Jw.filter(([u])=>t.has(u)).flatMap(([,,u])=>u),s=new Set(Jw.filter(([u])=>u==="sizing").flatMap(([,,u])=>u)),c=n.timeline,l=e.flatMap(u=>{let f=u.segments,d=u.dest;return f?(a.push({op:"split_clip",item:ze(d),at:f.slice(1).map(m=>m.start)}),f.map(m=>({...u,dest:{...d,start:m.start,end:m.end},source:m.source,d_src:m.d_src,a_src:m.a_src}))):[u]});for(let u of l){let f=u.dest,d=u.source;if(!d){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")&&(Ad(d,f,!0).do==="remote"?a.push({op:"version",item:ze(f),type:"remote",load:d.version}):a.push({op:"copy_grade",from_timeline:c,item:ze(d),to:[ze(f)]}));let m=r?.has(u.id)?o.filter(p=>!s.has(p)):o;if(m.length&&a.push({op:"copy_properties",from_timeline:c,item:ze(d),to:[ze(f)],keys:m}),t.has("clip_color")&&d.color!==f.color&&a.push({op:"clip_color",item:ze(f),color:d.color}),t.has("speed")&&a.push({op:"copy_speed",from_timeline:c,item:ze(d),to:[ze(f)]}),t.has("fades")&&a.push({op:"copy_fades",from_timeline:c,item:ze(d),to:[ze(f)]}),t.has("markers")){let p=Number(u.d_src),v=f.end-f.start;for(let b of n.markers){let h=Cr(n,b);!h?.item||h.item.track!==d.track||h.item.start!==d.start||h.frame<p||h.frame>=p+v||a.push({op:"marker_add",item:{kind:"video",...ze(f)},frame:h.frame,record:ze(f).start+h.frame-p,color:String(b.cells.color??"Blue"),name:String(b.cells.name??""),note:String(b.cells.note??""),duration:Math.max(1,Number(b.cells.frames??1))})}}}return a}function $ee(e,t){let n=e.clips.flatMap(u=>{let f=nn(u),d=Fn(e,u),m=Ji(e,u);if(!f||f.kind!=="video"||!d)return[];let p=Number(u.cells["source_range.start"]??0),v=Number(m?.cells["available_range.start"]),b=Number(m?.cells["available_range.dur"]);return[{...d,media:String(m?.cells.target_url??"")||void 0,src_in:p,src_out:p+(d.end-d.start),media_range:Number.isFinite(v)&&b>0?[v,v+b]:void 0,track_enabled:u.cells.track_enabled!==!1}]}),i=$6(e.markers.filter(u=>!u.cells.item_id).map(u=>({frame:Number(u.cells.frame),color:String(u.cells.color),name:String(u.cells.name??""),note:String(u.cells.note??"")})),n,t),r=new Map(String(t.names??"").split(",").map(u=>u.split("=").map(f=>f.trim())).filter(u=>u.length===2&&u[0]&&u[1]));if(r.size){for(let u of i.shots)for(let f of[...u.plates,...u.reference?[u.reference]:[]])f.name=r.get(f.name)??f.name;for(let u of i.stringout)u.name=r.get(u.name)??u.name}let a=i.shots.flatMap(u=>[...u.plates,...u.reference?[u.reference]:[]].map((f,d)=>({id:`${u.name}-${d}`,shot:u.name,pull:f.name,cells:{shot:u.name,role:f.role,name:f.name,clip:`${f.clip.name??""}${f.clip.scene?` \xB7 sc ${f.clip.scene}`:""}${f.clip.take?` tk ${f.clip.take}`:""}`,frames:`${f.first}\u2013${f.last}`,cut:`${f.cut_in}\u2013${f.cut_out}`}}))),o=e.markers.filter(u=>!u.cells.item_id),s=[...new Set(o.map(u=>String(u.cells.color)))],c=o.filter(u=>String(u.cells.color).toLowerCase()===t.color.toLowerCase()).length,l=i.shots.length?void 0:c?`${c} ${t.color} marker${c===1?"":"s"}, none over a clip`:`no ${t.color} markers on the timeline${s.length?` (its markers are ${s.join(", ")})`:""}`;return{...i,rows:a,...l?{text:l}:{}}}var ete=(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}))},cF=(e,t)=>{let n=new Set(t.map(i=>i.pull));return e.stringout.filter(i=>n.has(i.name)&&i.media)};function tte(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(d=>c.has(d.name)).map(d=>{let m=d.role==="REFERENCE",p=m?o:a;return{name:d.name,in:Math.max(n.start_frame,n.start_frame+d.clip.start-i),out:Math.min(u,n.start_frame+d.clip.end-1+i),target_dir:`${r.replace(/[\\/]$/,"")}${s}${f.name}`,...m?{}:{disable_tracks:l.filter(v=>v!==d.clip.track).map(v=>`V${v}`)},...p?{preset:p}:{}}}))}function nte(e,t,n,i,r="",a=""){let o=/\\/.test(i)?"\\":"/";return cF(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 uF(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=Ji(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"?ke(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 We(s,r)}var yO=Object.entries(Do).map(([e,t])=>[e,t.name]);function rte(e,t){let n=Do[t.naming]??Do.conformtools,i=t.case?{...n,caseTransform:t.case}:n,r={...i,handleFrames:t.handles,...t.folder?{folderStructure:t.folder==="."?"":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=nO(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:uF(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??"",frame:l.marker.frame,marker:l.marker.name,frames:l.out-l.in+1,name:l.name,folder:c,dupe:l.dupe?"same name as another job":""}}))}function ite(e,t){return{...oO(Yd(e),Yd(t),(i,r)=>{let a=i==="a"?e:t;return We(a.start_frame+r,a.fps||24)}),a:{start:e.start_frame,fps:e.fps||24,name:e.timeline},b:{start:t.start_frame,fps:t.fps||24,name:t.timeline}}}function Yd(e){return e.clips.flatMap(t=>{let n=nn(t);if(!n||n.kind!=="video"||t.cells.kind==="transition")return[];let i=Ji(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(f=>t.cells[f]??"").join("|"),c=(o.split(/[\\/]/).pop()??"").replace(/\.[^.]+$/,"").toLowerCase(),l=String(t.cells.reel_name??"").toLowerCase(),u=!i?.cells.target_url&&t.cells.kind!=="nested";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:u?n.start:a,src_out:u?n.start+r:a+Number(t.cells["source_range.dur"]??r),speed:t.cells.speed==null||t.cells.speed===""?100:Number(t.cells.speed),sizing:s}]})}var pO={inserted:"Green",deleted:"Red",moved:"Purple",split:"Pink",joined:"Pink",slipped:"Cyan",retimed:"Yellow",reframed:"Sand"};function ate(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)||We(o.start_frame+s,o.fps||24);return Cd(Yd(e),Yd(t)).filter(o=>o.kinds[0]!=="unchanged"||o.loose).map((o,s)=>{let c=o.kinds.join(", "),l=pO[o.kinds.find(p=>pO[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},d=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,m=d!=null&&o.a.media&&o.b.media?{a:{path:o.a.media,frame:d},b:{path:o.b.media}}:void 0;return{id:String(s),...m?{pair:m}:{},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 ote(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 ste(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=Fn(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),d=f+Math.round((c-s)*u),m=a.at(-1);if(m&&m.id===l.id&&m.end===s&&m.src_out===f){m.end=c,m.src_out=d;continue}a.push({id:l.id,media_id:l.media_id,name:l.name,start:s,end:c,src_in:f,src_out:d})}return a.map(({id:o,...s})=>s)}var fF=e=>{let t=/(\d+)\s*[xX×]\s*(\d+)/.exec(String(e??""));return t?[Number(t[1]),Number(t[2])]:void 0};function dF(e){let t=e.clips.flatMap(i=>{let r=Fn(e,i),a=Ji(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([...Fo(r.name),...Fo(o.split(/[\\/]/).pop()??"")]),meta_keys:new Set([...Fo(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:fF(i.cells.Resolution)}]}),n=e.markers.filter(i=>!i.cells.item_id).flatMap(i=>{let r=new Set([...Fo(String(i.cells.name??"")),...Fo(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 vO={marker:"shot marker",plate_name:"plate name",metadata:"plate metadata",timecode:"source timecode","":""};function lte(e,t){let{plates:n,markers:i}=dF(e),r=a=>We(e.start_frame+a,e.fps||24);return uO(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 ${vO[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:vO[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 cte(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 Cw=[["rec709","Rec.709 (gamma 2.4)"],["srgb","sRGB"],["p3d65","P3-D65 (gamma 2.6)"]],xO=[["flat","Flat 1.85"],["scope","Scope 2.39"],["full","Full 1.90"]],wO=[["2k","2K"],["4k","4K"]],PO=[["feature","Feature"],["trailer","Trailer"],["teaser","Teaser"],["short","Short"],["advertisement","Ad"],["test","Test"]],fte=e=>e.map(t=>t[0]);var zO=[{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:"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}],Mn=zO.filter(e=>e.edits).map(e=>[e.id,e.label]),mte=zO.map(e=>e.id);var Bd=["marker_add","marker_update","marker_delete"],mF={resolve:"all",premiere:["clip_color","enabled","metadata","name","playhead","properties","timeline_rename",...Bd],flame:["clip_color","enabled",...Bd],avid:Bd,protools:Bd,baselight:[]},pte=(e,t)=>{let n=mF[e];return n==="all"||!!n?.includes(t)};var rc={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}},Kw="strict",kO={tolerance_px:[0,512],min_frames:[1,600],gap_frames:[0,600],black_threshold:[0,255]};function OO(e,t={}){let n=(e??Kw).trim().toLowerCase(),i=rc[n]??rc[Kw],r=rc[n]?n:n==="custom"?"custom":Kw,a={...i};for(let o of Object.keys(kO)){let s=t[o];if(s===void 0||!Number.isFinite(Number(s)))continue;let[c,l]=kO[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 nc(e,t){let n=Number(e),i=Number(t);return!Number.isFinite(n)||!Number.isFinite(i)?!1:n>0&&n>=i}function pF(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:Math.abs(t/n-e)/e>=.02}function vF(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 bF(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 hF=[["bt","ct"],["bb","cb"],["bl","cl"],["br","cr"]],Qd=e=>Math.max(0,Math.trunc(Number(e)||0)),_d=e=>Math.max(0,Math.min(1,Number(e)||0));function gF(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=Qd(c.bt),f=Qd(c.bb),d=Qd(c.bl),m=Qd(c.br);if(!nc(Math.max(u,f,d,m),o)||bF(u,f,d,m,a.declared_blanking,o))continue;let p=Number(a.expected_aspect_ratio)||0;if(p>0){let h=Math.max(1,i-d-m),g=Math.max(1,r-u-f),y=d<=o&&m<=o,x=u<=o&&f<=o;if((y||x)&&pF(p,i,r)&&vF(u,f,d,m,o)&&Math.abs(h/g-p)/p<.02)continue}let v=n+l,b;for(let h of t??[])h.start<=v&&v<h.end&&(!b||h.track>b.track)&&(b=h);b&&s.push({frame_abs:v,bt:u,bb:f,bl:d,br:m,ct:_d(c.ct),cb:_d(c.cb),cl:_d(c.cl),cr:_d(c.cr),source:c.source??"pixels",clip:b})}return s.sort((c,l)=>c.frame_abs-l.frame_abs)}function yF(e,t){let n=[];return nc(e.bt,t)&&n.push("Top"),nc(e.bb,t)&&n.push("Bottom"),nc(e.bl,t)&&n.push("Left"),nc(e.br,t)&&n.push("Right"),n}function XO(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 gF(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[d,m]of hF)f[d]>=u.measured[d]&&(u.measured[d]=f[d],u.coverage[m]=f[m])}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:yF(f.measured,c)}))}var Dt=()=>({"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}}),an=(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}}),Ew=()=>Object.fromEntries(Object.keys(an(-23,2,-1)).map(e=>[e,{enabled:!1}])),Yw=(e,...t)=>Object.fromEntries(Object.entries(e).map(([n,i])=>[n,{...i,enabled:t.includes(n)}])),Aw=e=>({...e,"video.maxcll":{enabled:!0,max_cll:0,max_fall:0},"video.hdr_metadata":{enabled:!0},"video.legal_range":{enabled:!1}}),Ht=(e,t,n,i,r,a,o)=>({id:e,label:t,group:n,description:i,color_space:r,checks:a,audio:o}),TO=[Ht("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",{...Dt(),...an(-23,2,-1)},{lufs:-23,tolerance:2,true_peak:-1}),Ht("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",{...Yw(Dt(),"video.shots","video.effective_resolution","video.blockiness","video.burn_in","video.text"),...Ew()},null),Ht("textless_master","Textless master","Conform","Conform default, and any text-like graphics anywhere in the picture fails.","sdr_rec709",{...Dt(),...an(-23,2,-1),"video.text":{enabled:!0,fail_on_text:1}},{lufs:-23,tolerance:2,true_peak:-1}),Ht("blanking_only","Blanking only","Conform","Black edges, partial reveals and black frames, nothing else.","sdr_rec709",{...Yw(Dt(),"video.blanking","video.black_frame","video.aspect"),...Ew()},null),Ht("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",{...Yw(Dt(),"video.pse","video.shots"),...Ew()},null),Ht("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",{...Dt(),...an(-27,2,-2)},{lufs:-27,tolerance:2,true_peak:-2}),Ht("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",{...Aw(Dt()),...an(-27,2,-2)},{lufs:-27,tolerance:2,true_peak:-2}),Ht("apple_tv_sdr","Apple TV+ SDR","Streaming","Rec.709 legal range, PSE, -24 LKFS \xB12, -2 dBTP.","sdr_rec709",{...Dt(),...an(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Ht("apple_tv_hdr","Apple TV+ HDR (PQ)","Streaming","PQ light levels reported, HDR metadata checked, PSE, -24 LKFS \xB12 / -2 dBTP.","hdr_pq",{...Aw(Dt()),...an(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Ht("amazon_sdr","Amazon / Prime Video SDR","Streaming","Rec.709 legal range, PSE, -24 LKFS \xB12, -2 dBTP.","sdr_rec709",{...Dt(),...an(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Ht("amazon_hdr","Amazon / Prime Video HDR (PQ)","Streaming","PQ light levels reported, HDR metadata checked, PSE, -24 LKFS \xB12 / -2 dBTP.","hdr_pq",{...Aw(Dt()),...an(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Ht("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",{...Dt(),...an(-23,1,-1,20)},{lufs:-23,tolerance:1,true_peak:-1}),Ht("bbc_dpp","BBC / DPP (AS-11 UK)","Broadcast","EBU R128 loudness (-23 LUFS \xB11), true peak -3 dBTP, R103 gamut, PSE mandatory.","sdr_rec709",{...Dt(),...an(-23,1,-3,20)},{lufs:-23,tolerance:1,true_peak:-3}),Ht("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",{...Dt(),...an(-24,2,-2,20)},{lufs:-24,tolerance:2,true_peak:-2})],LO=TO.filter(e=>e.id!=="proxy_leak").map(e=>[e.id,e.label]),hte=e=>TO.find(t=>t.id===e);function Mo(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 xF(e,t,n){let i=0,r=1;for(let o=0;o<48;o++){let s=(i+r)/2;Mo(t[0],t[1],t[2],t[3],s)<e?i=s:r=s}let a=(i+r)/2;return Mo(n[0],n[1],n[2],n[3],a)}var Bw=e=>!!(e.sOutX||e.sOutY||e.sInX||e.sInY);function NO(e){return e.some(t=>Bw(t)||t.interp==="bezier")}var jO=new WeakMap;function wF(e,t){let n=jO.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;Bw(e)||Bw(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],d=i,m=r;for(let v=1;v<=256;v++){let b=v/256,h=Mo(i,s,l,a,b),g=Mo(r,c,u,o,b);f.push(f[f.length-1]+Math.hypot(h-d,g-m)),d=h,m=g}let p={to:t,arc:f,ctrl:[i,s,l,a,r,c,u,o]};return jO.set(e,p),p}function SO(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}=wF(o,s),d=u[u.length-1];if(!(d>1e-12))return[o.x,o.y];let m=l>0?d/l:0,p=o.interp==="bezier"&&o.outSpeed!=null?o.outSpeed:m,v=o.interp==="bezier"&&o.outInfluence!=null?o.outInfluence:1/3,b=s.interp==="bezier"&&s.inSpeed!=null?s.inSpeed:m,h=s.interp==="bezier"&&s.inInfluence!=null?s.inInfluence:1/3,g=1/6,y=(Q,q)=>Math.abs(Q-q)<1e-9,x=p===0&&y(v,1/3),P=b===0&&y(h,1/3);y(v,g)&&(p=m,v=P?.5:1/3),y(h,g)&&(b=m,h=x?.5:1/3);let T=(t-o.time)/(n||24),z=Math.min(Math.max(xF(T,[0,v*l,l-h*l,l],[0,p*v*l,d-b*h*l,d]),0),d),L=1,S=256;for(;L<S;){let Q=L+S>>1;u[Q]<z?L=Q+1:S=Q}let w=u[L-1],O=u[L],j=O>w?(z-w)/(O-w):0,U=(L-1+j)/256;return[Mo(f[0],f[1],f[2],f[3],U),Mo(f[4],f[5],f[6],f[7],U)]}return[r.x,r.y]}function WO(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 on(e,t){return typeof e=="number"&&Number.isFinite(e)?e:Array.isArray(e)&&typeof e[t]=="number"?e[t]:null}function PF(e,t,n,i,r){let a;Array.isArray(e.value)&&Array.isArray(t.value)?a=Math.hypot((on(t.value,0)??0)-(on(e.value,0)??0),(on(t.value,1)??0)-(on(e.value,1)??0)):a=(on(t.value,0)??0)-(on(e.value,0)??0);let o=i/n;if(a===0||!(r>0))return o;let s=b=>{let h=typeof b?.x=="number"?b.x:null,g=typeof b?.y=="number"?b.y:null;if(h===null||g===null)return null;let y=Math.min(Math.max(g,0),1)*n;return{dx:y,dy:h/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,d=n-Math.min(Math.max(l.dx,0),n),m=1-l.dy,p=(b,h,g,y)=>{let x=1-y;return 3*b*y*x*x+3*h*y*y*x+g*y*y*y},v=o;for(let b=0;b<8;b++){let h=p(u,d,n,v)-i,g=1-v,y=3*(u*(g*g-2*v*g)+d*(2*v*g-v*v)+n*v*v);if(Math.abs(y)<1e-9)break;let x=v-h/y;if(!(x>=0&&x<=1))break;if(Math.abs(x-v)<1e-7){v=x;break}v=x}if(Math.abs(p(u,d,n,v)-i)>n*1e-4){let b=0,h=1;for(let g=0;g<40;g++)v=(b+h)/2,p(u,d,n,v)<i?b=v:h=v}return p(f,m,1,v)}function zF(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=on(o[0].value,i)??0,c=on(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 d=on(u.value,i)??0,m=on(f.value,i)??0;if(u.interp==="hold")return d;let p=f.time-u.time||1,v=(u.tout||f.tin)&&!u.drt&&!f.drt?PF(u,f,p,n-u.time,r):(n-u.time)/p;return d+(m-d)*v}}return c}function kF(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 qO(e){let t=e.speed;return typeof t=="number"&&Number.isFinite(t)?Math.abs(t)/100:1}function OF(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 ZO(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),d=i[f].x-i[u].x;return d>0?(i[f].y-i[u].y)/d: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,d=f*u,m=r(o,"out"),p=r(o+1,"in");return(2*d-3*f+1)*s.y+(d-2*f+u)*l*m+(-2*d+3*f)*c.y+(d-f)*l*p}return i[a].y}function XF(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=ZO(e,a);if(c!=null)return(s+c)*n;let l=qO(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 TF(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=ZO(e,(t-i)/r);if(c!=null)return o+c*s;let l=qO(e)*OF(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 LF(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=on(r,0),o=on(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),NO(n)?n:null)}function VO(e,t){let n=kF(e)??e.timeline_range?.start?.rate??24,i=XF(e,t,n),r=!1,a=(l,u=0)=>{let f=zF(e,l,i,u,n);return f!==void 0&&(r=!0),f},o=l=>typeof l=="number"?l:null,s=LF(e);s&&(r=!0);let c=s?SO(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:WO(e,"flip_horizontal"),flipV:WO(e,"flip_vertical"),animated:r}}function RO(e,t){return Math.floor(TF(e,t)+1e-9)}function e9(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 jF=e=>e.fps_den?e.fps_num/e.fps_den:e.fps_num,Io=(e,t)=>We((e.start_frame??0)+t,jF(e),!!e.is_drop_frame),NF=e=>e.split(/[\\/]/).pop()??e,ac=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]},$d=e=>e.items.filter(t=>t.kind==="clip");function Uo(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 Kr=(e,t)=>VO(e,t),Qw=(e,t)=>RO(e,t),DO=(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 HO(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 CO(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 t9=["fit","fill","crop","stretch"];function KO(e,t,n){if(n)return n;let i=e.reframe_fit??t.mismatch_policy??"fit";return i==="none"?"crop":t9.includes(i)?i:"fit"}function EO(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 sn=(e,t)=>Math.round(e*10**t)/10**t||0;function _w(e,t,n,i=[1,1]){return{Pan:sn(e.position_x*t/i[0],3),Tilt:sn(-e.position_y*n/i[1],3),ZoomX:sn(e.scale_x/100/i[0],5),ZoomY:sn(e.scale_y/100/i[1],5),RotationAngle:sn(-e.rotation,3),FlipX:e.flip_h,FlipY:e.flip_v}}function FO(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}}function SF(e,t,n,i,r=[1,1]){if(Math.abs(e.rotation)>.05||e.flip_h||e.flip_v||Math.abs(r[0]-1)>1e-6||Math.abs(r[1]-1)>1e-6)return null;let a=e.scale_x/100,o=e.scale_y/100,s=.5+e.position_x,c=.5+e.position_y,l=u=>Math.max(0,Math.min(1,u));return{CropLeft:sn(l((t.cropL/100-(s-a/2))/a)*n,3),CropRight:sn(l((s+a/2-(1-t.cropR/100))/a)*n,3),CropTop:sn(l((t.cropT/100-(c-o/2))/o)*i,3),CropBottom:sn(l((c+o/2-(1-t.cropB/100))/o)*i,3)}}var YO=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}),MO=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,jte=["edit","input","node"];function IO(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 WF={aligned:"Green",animated:"Yellow",no_match:"Red",refused:"Red"};async function qF(e,t){let n=t.offline_reference,i=_e(t),r=i,a=Math.max(...t.tracks.flatMap(v=>v.items.map(b=>b.timeline_range.start.value+b.timeline_range.duration.value)),0),o=v=>({kind:"Video",track_index:Math.max(0,...ac(t).map(b=>b.track_index))+1,name:"OFFLINE REFERENCE",enabled:!0,items:v});if(n?.session_id){let{getSession:v}=await import("./store-F2CTSR6E.js"),b=(await v(n.session_id)).session,h=b.timelines.find(z=>z.kind==="primary")??b.timelines[0],g=(t.start_frame??0)+(n.frame_offset??0)-(h.start_frame??0),y=ac(h).filter(z=>z.enabled!==!1).flatMap(z=>z.items.filter(L=>L.kind==="clip"&&L.enabled!==!1&&L.media_reference_id).map(L=>({i:L,top:z.track_index}))),x=[...new Set(y.flatMap(({i:z})=>[z.timeline_range.start.value,z.timeline_range.start.value+z.timeline_range.duration.value]))].sort((z,L)=>z-L),P=[];for(let z=0;z+1<x.length;z++){let[L,S]=[x[z],x[z+1]],w=y.filter(({i:R})=>R.timeline_range.start.value<=L&&L<R.timeline_range.start.value+R.timeline_range.duration.value).sort((R,D)=>D.top-R.top)[0],[O,j]=[Math.max(0,L-g),Math.min(a,S-g)];if(!w||j<=O)continue;let U=w.i,Q=P.at(-1);if(Q&&Q.from===U.id&&Q.timeline_range.start.value+Q.timeline_range.duration.value===O){Q.timeline_range.duration.value+=j-O,Q.source_range.duration.value+=j-O;continue}let{id:q,timeline_range:G,source_range:E,media_reference_id:B,keyframes:H,...ae}=U;P.push({...ae,id:`offline-ref-${P.length}`,from:U.id,kind:"clip",enabled:!0,media_reference_id:`offref:${B}`,timeline_range:{start:{value:O,rate:r},duration:{value:j-O,rate:r}},source_range:{start:{value:E.start.value+(O+g-U.timeline_range.start.value),rate:E.start.rate},duration:{value:j-O,rate:E.start.rate}}})}if(!P.length)throw new Me("not_found",`the offline reference timeline "${h.name}" has no picture over this timeline`);let T=new Set(P.map(z=>String(z.media_reference_id).slice(7)));return{lane:o(P),media:b.media_references.filter(z=>T.has(z.id)).map(z=>({...z,id:`offref:${z.id}`})),name:`timeline ${h.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 Me("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-OXHZ3PGZ.js"),u=await l(c),f=u.source_timecode?Bo(u.source_timecode,i,null):0,d=u.available_range?.duration?.value??u.declared_duration?.value??null,m=(t.start_frame??0)+(n.frame_offset??0)-f;d!=null&&(m>=d||m+a<=0)&&(m=n.frame_offset??0);let p=d!=null?Math.max(1,Math.min(a,d-m)):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:m,rate:r},duration:{value:p,rate:r}}}]),media:[],name:s.name??NF(c)}}async function Nte(e,t,n,i){if(t.reference_track!=="offline")return await UO(e,t,n,i);let r=e9(e,t.timeline_id),{lane:a,media:o,name:s}=await qF(e,r);r.tracks.push(a),e.media_references.push(...o);try{return{...await UO(e,{...t,reference_track:ac(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 UO(e,t,n,i){let r=e9(e,t.timeline_id),a=r.resolution_w,o=r.resolution_h,s=ac(r),c=t.reference_track;if(!c)throw new Error(`say which track is the reference: reference_track = its video track (V1 = 1, the timeline has ${s.length}) or "offline"`);let l=s[c-1];if(!l)throw new Error(`no video track V${c} (the timeline has ${s.length})`);if(t.tracks?.includes(c))throw new Me("invalid_args",`the track to align cannot be the reference track (V${c})`);let u=(t.tracks?.length?t.tracks:s.map((w,O)=>O+1).filter(w=>s[w-1].enabled!==!1)).filter(w=>w!==c);for(let w of u)if(!s[w-1])throw new Error(`no video track V${w} (the timeline has ${s.length})`);let f=t.input_scaling??"fit",d=t.sizing_target??"edit",m=600,p=(w,O)=>{let j=Math.max(1,O-w);if(t.samples==="ends")return[...new Set([0,.25,.5,.75,1].map(q=>w+Math.round(q*(Math.max(w,O-1)-w))))];let U=(t.samples??"half")==="half"&&!t.step?Math.max(1,Math.round(_e(r)/2)):t.step,Q=t.samples==="all"?Math.max(1,Math.ceil(j/m)):U?Math.max(1,Math.floor(U),Math.ceil(j/m)):0;if(Q){let q=[];for(let G=w;G<O;G+=Q)q.push(G);return q.at(-1)!==O-1&&q.push(O-1),q}return CO(w,O,Math.max(1,Math.min(m,Math.floor(Number(t.samples))||1)))},v=Number(r.start_frame??0),b=[],h=[],g=$d(l),y=t.scope??"all",x=new Set(t.picks??[]);if(y==="selected"&&!x.size)throw new Error("no clips selected: select clips in the timeline, or align the whole timeline");for(let w of u)for(let O of $d(s[w-1])){let[j,U]=zn(O);if(y==="playhead"&&!(j<=(t.at??-1)&&(t.at??-1)<U)||y==="selected"&&!x.has(`${w}:${j}`))continue;let Q={item_id:O.id,name:O.name??O.id,track:w,start:j,end:U,record_tc:Io(r,j),verdict:"refused",confidence:null,samples:[]};b.push(Q);let q=ee=>{Q.reason=ee};if(O.enabled===!1){q("disabled");continue}let G,E=0,B=0;for(let ee of g){let[ce,ve]=zn(ee),Ze=Math.max(j,ce),ye=Math.min(U,ve);ye-Ze>B-E&&(G=ee,E=Ze,B=ye)}if(!G){if(t.reference_label){q(`${t.reference_label} does not cover it (${Io(r,j)}\u2013${Io(r,U)}): it ends before this clip`);continue}let ee=l.items.find(ce=>{let[ve,Ze]=zn(ce);return ce.kind!=="clip"&&ce.kind!=="gap"&&Math.min(U,Ze)>Math.max(j,ve)});q(ee?`V${c} has ${/compound|stack|timeline/i.test(String(ee.kind))?"a compound clip or nested timeline":`a ${ee.kind}`} over it, not a movie clip: Align reads a media file there (decompose it, or use Offline ref)`:g.length?`nothing on V${c} over it (${Io(r,j)}\u2013${Io(r,U)}): the reference does not cover this clip`:`V${c} has no movie clips: pick the track the reference is on, or Offline ref`);continue}let H=Uo(e,G),ae=Uo(e,O);if(!H.path){q(`the reference clip ${G.name??G.id} is not linked (timeline_relink first)`);continue}if(!ae.path){q("not linked (timeline_relink first)");continue}let R=p(E,B),D=Kr(G,E),N=MO(D)?void 0:D;if(N){let ee=N.scaleX??N.scale??100,ce=N.scaleY??N.scale??100,ve=N.animated||R.some(Ze=>JSON.stringify(Kr(G,Ze))!==JSON.stringify(D))?"keyframed":Math.abs(ee-ce)>1e-6?"scaled unevenly":N.flipH||N.flipV?"flipped":N.anchorX||N.anchorY?"anchored off centre":d!=="edit"?"resized (Colour-page sizing is solved against an unresized reference only)":"";if(ve){q(`the reference clip ${G.name??G.id} is ${ve}; the fit is against its raw picture`);continue}}if(H.w>0&&H.h>0&&Math.abs(H.w/H.h-a/o)>.01*(a/o)){q(`the reference ${H.w}x${H.h} does not fill the ${a}x${o} frame`);continue}let J=ee=>ee.map(ce=>({ref:H.path,refFrame:Qw(G,ce),src:ae.path,srcFrame:Qw(O,ce)})),ne=Array.from({length:B-E},(ee,ce)=>E+ce),ie=Kr(O,j);h.push({row:Q,item:O,recs:R,every:ne,refT:N,ask:{pairs:J(R),every:J(ne),every_t:ne.map(ee=>ee-j),edit:YO(ie),edit_identity:MO(ie),edit_animated:!!ie.animated,anchor_off:!!(ie.anchorX||ie.anchorY),...t.inputs?.get(`${w}:${j+v}`)?.length?{input:t.inputs.get(`${w}:${j+v}`)}:{}}})}let P=h.length?await _r({op:"reframe",items:h.map(w=>w.ask),out:[a,o],target:d},n,i):{items:[],offsets:[]},T=P.offsets;P.items.forEach((w,O)=>{let{row:j,item:U,recs:Q,every:q,ask:G,refT:E}=h[O],B=w.transform;if(E&&(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=FO(w.transform,E,a,o)),w.edit_transform&&(w.edit_transform=FO(w.edit_transform,E,a,o)),w.transform)){let D=G.edit,N=w.transform,J=.5/a;w.unchanged=Math.abs(N.scale_x-D.scale_x)<.05&&Math.abs(N.scale_y-D.scale_y)<.05&&Math.abs(N.position_x-D.position_x)<J&&Math.abs(N.position_y-D.position_y)<.5/o&&Math.abs(N.rotation-D.rotation)<.02}let H=w.measured==="every"?q:Q,ae=w.measured==="every"?G.every:G.pairs,R=(({w:D,h:N})=>EO(D,N,a,o,KO(U,r,t.input_scaling)))(Uo(e,U));if(j.samples=w.scores.map((D,N)=>({record:H[w.at[N]],ref_frame:ae[w.at[N]].refFrame,src_frame:ae[w.at[N]].srcFrame,score:D})),Object.assign(j,{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&&(j.transform=w.transform,j.properties=_w(w.edit_transform??w.transform,a,o,R)),E&&B&&(E.cropL||E.cropR||E.cropT||E.cropB)){let D=SF(B,E,a,o,R);if(!D)j.reason=[j.reason,"the reference's crop is not carried: the clip is rotated or flipped against it, or does not fill the frame"].filter(Boolean).join("; ");else{j.crop=D;let N=Kr(U,j.start),J={CropLeft:N.cropL/100*a,CropRight:N.cropR/100*a,CropTop:N.cropT/100*o,CropBottom:N.cropB/100*o};Object.keys(D).some(ne=>Math.abs(D[ne]-J[ne])>.5)&&(j.unchanged=void 0)}}w.keys?.length&&(j.keys=w.keys.map(D=>({record:H[w.at[D.j]],transform:D.transform,properties:_w(D.transform,a,o,R),confidence:D.confidence}))),w.grade_keys?.length&&(j.grade_keys=w.grade_keys.map(({shape:D,...N})=>D?.kind==="resolve_dissolve"?{...N,ease_in:D.start,ease_out:D.end}:N),j.grade_keys[0].t>0&&j.grade_keys.unshift({...j.grade_keys[0],t:0,ease_in:void 0,ease_out:void 0})),w.edit_keys?.length&&(j.edit_keys=w.edit_keys[0].t>0?[{...w.edit_keys[0],t:0,shape:void 0},...w.edit_keys]:w.edit_keys)});let z=[];for(let w of b){let O={track:w.track,start:w.start};if(w.verdict==="aligned"&&d==="edit"&&!w.unchanged){let j=w.properties;z.push({op:"properties",item:O,set:{...j.ZoomX!==j.ZoomY?{ZoomGang:!1}:{},...j,...w.crop??{}}})}if(w.verdict==="animated"&&w.edit_keys&&z.push({op:"edit_keys",item:O,keys:w.edit_keys}),w.verdict==="animated"&&w.grade_keys&&z.push({op:"grade_sizing",item:O,target:d==="node"?"node":"input",keys:w.grade_keys,...d==="node"?IO(t):{}}),w.verdict==="aligned"&&w.grade_sizing&&!w.unchanged&&z.push({op:"grade_sizing",item:O,target:d,...w.grade_sizing,...d==="node"?IO(t):{}}),t.markers??!0){let j={aligned:"Aligned",animated:"Animated",no_match:"No match",refused:"Not aligned"}[w.verdict],U=[w.label,w.confidence!=null?`confidence ${w.confidence}`:"",w.reason].filter(Boolean).join(" \xB7 ");z.push({op:"marker_add",frame:w.start,color:WF[w.verdict],name:`${j}: ${w.name}`,note:U,data:"ConformTools:align"})}}let L;if(t.apply_session){L=0;for(let w of b.filter(O=>O.verdict==="aligned")){let O=w.transform;$w(e,"transform",{timeline_id:r.id,item_id:w.item_id,scale:O.scale_x,position_x:O.position_x,position_y:O.position_y,rotation:O.rotation});let j=r.tracks.flatMap(U=>U.items).find(U=>U.id===w.item_id);Math.abs(O.scale_x-O.scale_y)>.001&&(j.scale_x=O.scale_x,j.scale_y=O.scale_y),O.flip_h?j.flip_horizontal=!0:delete j.flip_horizontal,O.flip_v?j.flip_vertical=!0:delete j.flip_vertical,L++}}let S={aligned:0,animated:0,no_match:0,refused:0};for(let w of b)S[w.verdict]++;return{timeline:r.name??r.id,raster:[a,o],reference_track:c,rows:b,counts:S,ops:z,...L!=null?{applied:L}:{},input_scaling:f,sizing_target:d,...T.length?{offsets:T}:{}}}function Ste(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(`
93
+ B ${Ed(n.b)}`.trim(),duration:Math.max(1,n.frames),data:"ConformTools:reconform"}}));function dO(e){return e.clips.flatMap(t=>{let n=nn(t),i=Fn(e,t);if(!n||n.kind!=="video"||!i)return[];let r=Ji(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 Gw(e,t){let n=e.clips.find(a=>Fn(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 hO="100|100|0|0|0|0|0|0|0",mO=e=>{let[t,n,i,r,a]=e.split("|").map(Number);return e===hO?"as shot":`${t===n?`${t}%`:`${t}\xD7${n}%`}${i||r?` \xB7 ${i},${r}`:""}${a?` \xB7 ${a}\xB0`:""}`};function Qee(e,t){let n=dO(e),i=new Map;for(let r of n)i.set(r.key,[...i.get(r.key)??[],r]);return dO(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(m=>({s:m,shared:Math.min(m.s1,r.s1)-Math.max(m.s0,r.s0)})).filter(m=>m.shared>0).sort((m,p)=>p.shared-m.shared||Math.abs(m.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?Ad(o.s.it,r.it,!0):void 0,l=o?Gw(e,o.s.it):"",u=Gw(t,r.it),f=!!o&&!!l&&!!u&&l!==u&&u!==hO,d=(()=>{if(a.length<2||r.s1-r.s0!==r.it.end-r.it.start)return;let m=[...a].sort((p,v)=>p.s.s0-v.s.s0).map(p=>{let v=Math.max(p.s.s0,r.s0),b=Math.min(p.s.s1,r.s1);return{start:r.it.start+(v-r.s0),end:r.it.start+(b-r.s0),source:p.s.it,a_src:p.s.s0,d_src:v}}).filter(p=>p.end>p.start);return new Set(m.map(p=>Gw(e,p.source))).size>1?m: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,...d?{segments:d}:{},cells:{...f?{sizing_differs:!0,a_sizing:mO(l),b_sizing:mO(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:d?`cut into ${d.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 gO=[["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 _ee(e,t,n,i,r){let a=[],o=Jw.filter(([u])=>t.has(u)).flatMap(([,,u])=>u),s=new Set(Jw.filter(([u])=>u==="sizing").flatMap(([,,u])=>u)),c=n.timeline,l=e.flatMap(u=>{let f=u.segments,d=u.dest;return f?(a.push({op:"split_clip",item:ze(d),at:f.slice(1).map(m=>m.start)}),f.map(m=>({...u,dest:{...d,start:m.start,end:m.end},source:m.source,d_src:m.d_src,a_src:m.a_src}))):[u]});for(let u of l){let f=u.dest,d=u.source;if(!d){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")&&(Ad(d,f,!0).do==="remote"?a.push({op:"version",item:ze(f),type:"remote",load:d.version}):a.push({op:"copy_grade",from_timeline:c,item:ze(d),to:[ze(f)]}));let m=r?.has(u.id)?o.filter(p=>!s.has(p)):o;if(m.length&&a.push({op:"copy_properties",from_timeline:c,item:ze(d),to:[ze(f)],keys:m}),t.has("clip_color")&&d.color!==f.color&&a.push({op:"clip_color",item:ze(f),color:d.color}),t.has("speed")&&a.push({op:"copy_speed",from_timeline:c,item:ze(d),to:[ze(f)]}),t.has("fades")&&a.push({op:"copy_fades",from_timeline:c,item:ze(d),to:[ze(f)]}),t.has("markers")){let p=Number(u.d_src),v=f.end-f.start;for(let b of n.markers){let h=Cr(n,b);!h?.item||h.item.track!==d.track||h.item.start!==d.start||h.frame<p||h.frame>=p+v||a.push({op:"marker_add",item:{kind:"video",...ze(f)},frame:h.frame,record:ze(f).start+h.frame-p,color:String(b.cells.color??"Blue"),name:String(b.cells.name??""),note:String(b.cells.note??""),duration:Math.max(1,Number(b.cells.frames??1))})}}}return a}function $ee(e,t){let n=e.clips.flatMap(u=>{let f=nn(u),d=Fn(e,u),m=Ji(e,u);if(!f||f.kind!=="video"||!d)return[];let p=Number(u.cells["source_range.start"]??0),v=Number(m?.cells["available_range.start"]),b=Number(m?.cells["available_range.dur"]);return[{...d,media:String(m?.cells.target_url??"")||void 0,src_in:p,src_out:p+(d.end-d.start),media_range:Number.isFinite(v)&&b>0?[v,v+b]:void 0,track_enabled:u.cells.track_enabled!==!1}]}),i=$6(e.markers.filter(u=>!u.cells.item_id).map(u=>({frame:Number(u.cells.frame),color:String(u.cells.color),name:String(u.cells.name??""),note:String(u.cells.note??"")})),n,t),r=new Map(String(t.names??"").split(",").map(u=>u.split("=").map(f=>f.trim())).filter(u=>u.length===2&&u[0]&&u[1]));if(r.size){for(let u of i.shots)for(let f of[...u.plates,...u.reference?[u.reference]:[]])f.name=r.get(f.name)??f.name;for(let u of i.stringout)u.name=r.get(u.name)??u.name}let a=i.shots.flatMap(u=>[...u.plates,...u.reference?[u.reference]:[]].map((f,d)=>({id:`${u.name}-${d}`,shot:u.name,pull:f.name,cells:{shot:u.name,role:f.role,name:f.name,clip:`${f.clip.name??""}${f.clip.scene?` \xB7 sc ${f.clip.scene}`:""}${f.clip.take?` tk ${f.clip.take}`:""}`,frames:`${f.first}\u2013${f.last}`,cut:`${f.cut_in}\u2013${f.cut_out}`}}))),o=e.markers.filter(u=>!u.cells.item_id),s=[...new Set(o.map(u=>String(u.cells.color)))],c=o.filter(u=>String(u.cells.color).toLowerCase()===t.color.toLowerCase()).length,l=i.shots.length?void 0:c?`${c} ${t.color} marker${c===1?"":"s"}, none over a clip`:`no ${t.color} markers on the timeline${s.length?` (its markers are ${s.join(", ")})`:""}`;return{...i,rows:a,...l?{text:l}:{}}}var ete=(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}))},cF=(e,t)=>{let n=new Set(t.map(i=>i.pull));return e.stringout.filter(i=>n.has(i.name)&&i.media)};function tte(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(d=>c.has(d.name)).map(d=>{let m=d.role==="REFERENCE",p=m?o:a;return{name:d.name,in:Math.max(n.start_frame,n.start_frame+d.clip.start-i),out:Math.min(u,n.start_frame+d.clip.end-1+i),target_dir:`${r.replace(/[\\/]$/,"")}${s}${f.name}`,...m?{}:{disable_tracks:l.filter(v=>v!==d.clip.track).map(v=>`V${v}`)},...p?{preset:p}:{}}}))}function nte(e,t,n,i,r="",a=""){let o=/\\/.test(i)?"\\":"/";return cF(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 uF(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=Ji(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"?ke(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 We(s,r)}var yO=Object.entries(Do).map(([e,t])=>[e,t.name]);function rte(e,t){let n=Do[t.naming]??Do.conformtools,i=t.case?{...n,caseTransform:t.case}:n,r={...i,handleFrames:t.handles,...t.folder?{folderStructure:t.folder==="."?"":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=nO(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:uF(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??"",frame:l.marker.frame,marker:l.marker.name,frames:l.out-l.in+1,name:l.name,folder:c,dupe:l.dupe?"same name as another job":""}}))}function ite(e,t){return{...oO(Yd(e),Yd(t),(i,r)=>{let a=i==="a"?e:t;return We(a.start_frame+r,a.fps||24)}),a:{start:e.start_frame,fps:e.fps||24,name:e.timeline},b:{start:t.start_frame,fps:t.fps||24,name:t.timeline}}}function Yd(e){return e.clips.flatMap(t=>{let n=nn(t);if(!n||n.kind!=="video"||t.cells.kind==="transition")return[];let i=Ji(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(f=>t.cells[f]??"").join("|"),c=(o.split(/[\\/]/).pop()??"").replace(/\.[^.]+$/,"").toLowerCase(),l=String(t.cells.reel_name??"").toLowerCase(),u=!i?.cells.target_url&&t.cells.kind!=="nested";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:u?n.start:a,src_out:u?n.start+r:a+Number(t.cells["source_range.dur"]??r),speed:t.cells.speed==null||t.cells.speed===""?100:Number(t.cells.speed),sizing:s}]})}var pO={inserted:"Green",deleted:"Red",moved:"Purple",split:"Pink",joined:"Pink",slipped:"Cyan",retimed:"Yellow",reframed:"Sand"};function ate(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)||We(o.start_frame+s,o.fps||24);return Cd(Yd(e),Yd(t)).filter(o=>o.kinds[0]!=="unchanged"||o.loose).map((o,s)=>{let c=o.kinds.join(", "),l=pO[o.kinds.find(p=>pO[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},d=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,m=d!=null&&o.a.media&&o.b.media?{a:{path:o.a.media,frame:d},b:{path:o.b.media}}:void 0;return{id:String(s),...m?{pair:m}:{},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 ote(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 ste(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=Fn(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),d=f+Math.round((c-s)*u),m=a.at(-1);if(m&&m.id===l.id&&m.end===s&&m.src_out===f){m.end=c,m.src_out=d;continue}a.push({id:l.id,media_id:l.media_id,name:l.name,start:s,end:c,src_in:f,src_out:d})}return a.map(({id:o,...s})=>s)}var fF=e=>{let t=/(\d+)\s*[xX×]\s*(\d+)/.exec(String(e??""));return t?[Number(t[1]),Number(t[2])]:void 0};function dF(e){let t=e.clips.flatMap(i=>{let r=Fn(e,i),a=Ji(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([...Fo(r.name),...Fo(o.split(/[\\/]/).pop()??"")]),meta_keys:new Set([...Fo(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:fF(i.cells.Resolution)}]}),n=e.markers.filter(i=>!i.cells.item_id).flatMap(i=>{let r=new Set([...Fo(String(i.cells.name??"")),...Fo(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 vO={marker:"shot marker",plate_name:"plate name",metadata:"plate metadata",timecode:"source timecode","":""};function lte(e,t){let{plates:n,markers:i}=dF(e),r=a=>We(e.start_frame+a,e.fps||24);return uO(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 ${vO[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:vO[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 cte(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 Cw=[["rec709","Rec.709 (gamma 2.4)"],["srgb","sRGB"],["p3d65","P3-D65 (gamma 2.6)"]],xO=[["flat","Flat 1.85"],["scope","Scope 2.39"],["full","Full 1.90"]],wO=[["2k","2K"],["4k","4K"]],PO=[["feature","Feature"],["trailer","Trailer"],["teaser","Teaser"],["short","Short"],["advertisement","Ad"],["test","Test"]],fte=e=>e.map(t=>t[0]);var zO=[{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:"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}],Mn=zO.filter(e=>e.edits).map(e=>[e.id,e.label]),mte=zO.map(e=>e.id);var Bd=["marker_add","marker_update","marker_delete"],mF={resolve:"all",premiere:["clip_color","enabled","metadata","name","playhead","properties","timeline_rename",...Bd],flame:["clip_color","enabled",...Bd],avid:Bd,protools:Bd,baselight:[]},pte=(e,t)=>{let n=mF[e];return n==="all"||!!n?.includes(t)};var rc={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}},Kw="strict",kO={tolerance_px:[0,512],min_frames:[1,600],gap_frames:[0,600],black_threshold:[0,255]};function OO(e,t={}){let n=(e??Kw).trim().toLowerCase(),i=rc[n]??rc[Kw],r=rc[n]?n:n==="custom"?"custom":Kw,a={...i};for(let o of Object.keys(kO)){let s=t[o];if(s===void 0||!Number.isFinite(Number(s)))continue;let[c,l]=kO[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 nc(e,t){let n=Number(e),i=Number(t);return!Number.isFinite(n)||!Number.isFinite(i)?!1:n>0&&n>=i}function pF(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:Math.abs(t/n-e)/e>=.02}function vF(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 bF(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 hF=[["bt","ct"],["bb","cb"],["bl","cl"],["br","cr"]],Qd=e=>Math.max(0,Math.trunc(Number(e)||0)),_d=e=>Math.max(0,Math.min(1,Number(e)||0));function gF(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=Qd(c.bt),f=Qd(c.bb),d=Qd(c.bl),m=Qd(c.br);if(!nc(Math.max(u,f,d,m),o)||bF(u,f,d,m,a.declared_blanking,o))continue;let p=Number(a.expected_aspect_ratio)||0;if(p>0){let h=Math.max(1,i-d-m),g=Math.max(1,r-u-f),y=d<=o&&m<=o,x=u<=o&&f<=o;if((y||x)&&pF(p,i,r)&&vF(u,f,d,m,o)&&Math.abs(h/g-p)/p<.02)continue}let v=n+l,b;for(let h of t??[])h.start<=v&&v<h.end&&(!b||h.track>b.track)&&(b=h);b&&s.push({frame_abs:v,bt:u,bb:f,bl:d,br:m,ct:_d(c.ct),cb:_d(c.cb),cl:_d(c.cl),cr:_d(c.cr),source:c.source??"pixels",clip:b})}return s.sort((c,l)=>c.frame_abs-l.frame_abs)}function yF(e,t){let n=[];return nc(e.bt,t)&&n.push("Top"),nc(e.bb,t)&&n.push("Bottom"),nc(e.bl,t)&&n.push("Left"),nc(e.br,t)&&n.push("Right"),n}function XO(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 gF(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[d,m]of hF)f[d]>=u.measured[d]&&(u.measured[d]=f[d],u.coverage[m]=f[m])}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:yF(f.measured,c)}))}var Dt=()=>({"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}}),an=(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}}),Ew=()=>Object.fromEntries(Object.keys(an(-23,2,-1)).map(e=>[e,{enabled:!1}])),Yw=(e,...t)=>Object.fromEntries(Object.entries(e).map(([n,i])=>[n,{...i,enabled:t.includes(n)}])),Aw=e=>({...e,"video.maxcll":{enabled:!0,max_cll:0,max_fall:0},"video.hdr_metadata":{enabled:!0},"video.legal_range":{enabled:!1}}),Ht=(e,t,n,i,r,a,o)=>({id:e,label:t,group:n,description:i,color_space:r,checks:a,audio:o}),TO=[Ht("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",{...Dt(),...an(-23,2,-1)},{lufs:-23,tolerance:2,true_peak:-1}),Ht("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",{...Yw(Dt(),"video.shots","video.effective_resolution","video.blockiness","video.burn_in","video.text"),...Ew()},null),Ht("textless_master","Textless master","Conform","Conform default, and any text-like graphics anywhere in the picture fails.","sdr_rec709",{...Dt(),...an(-23,2,-1),"video.text":{enabled:!0,fail_on_text:1}},{lufs:-23,tolerance:2,true_peak:-1}),Ht("blanking_only","Blanking only","Conform","Black edges, partial reveals and black frames, nothing else.","sdr_rec709",{...Yw(Dt(),"video.blanking","video.black_frame","video.aspect"),...Ew()},null),Ht("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",{...Yw(Dt(),"video.pse","video.shots"),...Ew()},null),Ht("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",{...Dt(),...an(-27,2,-2)},{lufs:-27,tolerance:2,true_peak:-2}),Ht("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",{...Aw(Dt()),...an(-27,2,-2)},{lufs:-27,tolerance:2,true_peak:-2}),Ht("apple_tv_sdr","Apple TV+ SDR","Streaming","Rec.709 legal range, PSE, -24 LKFS \xB12, -2 dBTP.","sdr_rec709",{...Dt(),...an(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Ht("apple_tv_hdr","Apple TV+ HDR (PQ)","Streaming","PQ light levels reported, HDR metadata checked, PSE, -24 LKFS \xB12 / -2 dBTP.","hdr_pq",{...Aw(Dt()),...an(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Ht("amazon_sdr","Amazon / Prime Video SDR","Streaming","Rec.709 legal range, PSE, -24 LKFS \xB12, -2 dBTP.","sdr_rec709",{...Dt(),...an(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Ht("amazon_hdr","Amazon / Prime Video HDR (PQ)","Streaming","PQ light levels reported, HDR metadata checked, PSE, -24 LKFS \xB12 / -2 dBTP.","hdr_pq",{...Aw(Dt()),...an(-24,2,-2)},{lufs:-24,tolerance:2,true_peak:-2}),Ht("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",{...Dt(),...an(-23,1,-1,20)},{lufs:-23,tolerance:1,true_peak:-1}),Ht("bbc_dpp","BBC / DPP (AS-11 UK)","Broadcast","EBU R128 loudness (-23 LUFS \xB11), true peak -3 dBTP, R103 gamut, PSE mandatory.","sdr_rec709",{...Dt(),...an(-23,1,-3,20)},{lufs:-23,tolerance:1,true_peak:-3}),Ht("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",{...Dt(),...an(-24,2,-2,20)},{lufs:-24,tolerance:2,true_peak:-2})],LO=TO.filter(e=>e.id!=="proxy_leak").map(e=>[e.id,e.label]),hte=e=>TO.find(t=>t.id===e);function Mo(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 xF(e,t,n){let i=0,r=1;for(let o=0;o<48;o++){let s=(i+r)/2;Mo(t[0],t[1],t[2],t[3],s)<e?i=s:r=s}let a=(i+r)/2;return Mo(n[0],n[1],n[2],n[3],a)}var Bw=e=>!!(e.sOutX||e.sOutY||e.sInX||e.sInY);function NO(e){return e.some(t=>Bw(t)||t.interp==="bezier")}var jO=new WeakMap;function wF(e,t){let n=jO.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;Bw(e)||Bw(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],d=i,m=r;for(let v=1;v<=256;v++){let b=v/256,h=Mo(i,s,l,a,b),g=Mo(r,c,u,o,b);f.push(f[f.length-1]+Math.hypot(h-d,g-m)),d=h,m=g}let p={to:t,arc:f,ctrl:[i,s,l,a,r,c,u,o]};return jO.set(e,p),p}function SO(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}=wF(o,s),d=u[u.length-1];if(!(d>1e-12))return[o.x,o.y];let m=l>0?d/l:0,p=o.interp==="bezier"&&o.outSpeed!=null?o.outSpeed:m,v=o.interp==="bezier"&&o.outInfluence!=null?o.outInfluence:1/3,b=s.interp==="bezier"&&s.inSpeed!=null?s.inSpeed:m,h=s.interp==="bezier"&&s.inInfluence!=null?s.inInfluence:1/3,g=1/6,y=(Q,q)=>Math.abs(Q-q)<1e-9,x=p===0&&y(v,1/3),P=b===0&&y(h,1/3);y(v,g)&&(p=m,v=P?.5:1/3),y(h,g)&&(b=m,h=x?.5:1/3);let T=(t-o.time)/(n||24),z=Math.min(Math.max(xF(T,[0,v*l,l-h*l,l],[0,p*v*l,d-b*h*l,d]),0),d),L=1,S=256;for(;L<S;){let Q=L+S>>1;u[Q]<z?L=Q+1:S=Q}let w=u[L-1],O=u[L],j=O>w?(z-w)/(O-w):0,U=(L-1+j)/256;return[Mo(f[0],f[1],f[2],f[3],U),Mo(f[4],f[5],f[6],f[7],U)]}return[r.x,r.y]}function WO(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 on(e,t){return typeof e=="number"&&Number.isFinite(e)?e:Array.isArray(e)&&typeof e[t]=="number"?e[t]:null}function PF(e,t,n,i,r){let a;Array.isArray(e.value)&&Array.isArray(t.value)?a=Math.hypot((on(t.value,0)??0)-(on(e.value,0)??0),(on(t.value,1)??0)-(on(e.value,1)??0)):a=(on(t.value,0)??0)-(on(e.value,0)??0);let o=i/n;if(a===0||!(r>0))return o;let s=b=>{let h=typeof b?.x=="number"?b.x:null,g=typeof b?.y=="number"?b.y:null;if(h===null||g===null)return null;let y=Math.min(Math.max(g,0),1)*n;return{dx:y,dy:h/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,d=n-Math.min(Math.max(l.dx,0),n),m=1-l.dy,p=(b,h,g,y)=>{let x=1-y;return 3*b*y*x*x+3*h*y*y*x+g*y*y*y},v=o;for(let b=0;b<8;b++){let h=p(u,d,n,v)-i,g=1-v,y=3*(u*(g*g-2*v*g)+d*(2*v*g-v*v)+n*v*v);if(Math.abs(y)<1e-9)break;let x=v-h/y;if(!(x>=0&&x<=1))break;if(Math.abs(x-v)<1e-7){v=x;break}v=x}if(Math.abs(p(u,d,n,v)-i)>n*1e-4){let b=0,h=1;for(let g=0;g<40;g++)v=(b+h)/2,p(u,d,n,v)<i?b=v:h=v}return p(f,m,1,v)}function zF(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=on(o[0].value,i)??0,c=on(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 d=on(u.value,i)??0,m=on(f.value,i)??0;if(u.interp==="hold")return d;let p=f.time-u.time||1,v=(u.tout||f.tin)&&!u.drt&&!f.drt?PF(u,f,p,n-u.time,r):(n-u.time)/p;return d+(m-d)*v}}return c}function kF(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 qO(e){let t=e.speed;return typeof t=="number"&&Number.isFinite(t)?Math.abs(t)/100:1}function OF(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 ZO(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),d=i[f].x-i[u].x;return d>0?(i[f].y-i[u].y)/d: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,d=f*u,m=r(o,"out"),p=r(o+1,"in");return(2*d-3*f+1)*s.y+(d-2*f+u)*l*m+(-2*d+3*f)*c.y+(d-f)*l*p}return i[a].y}function XF(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=ZO(e,a);if(c!=null)return(s+c)*n;let l=qO(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 TF(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=ZO(e,(t-i)/r);if(c!=null)return o+c*s;let l=qO(e)*OF(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 LF(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=on(r,0),o=on(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),NO(n)?n:null)}function VO(e,t){let n=kF(e)??e.timeline_range?.start?.rate??24,i=XF(e,t,n),r=!1,a=(l,u=0)=>{let f=zF(e,l,i,u,n);return f!==void 0&&(r=!0),f},o=l=>typeof l=="number"?l:null,s=LF(e);s&&(r=!0);let c=s?SO(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:WO(e,"flip_horizontal"),flipV:WO(e,"flip_vertical"),animated:r}}function RO(e,t){return Math.floor(TF(e,t)+1e-9)}function e9(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 jF=e=>e.fps_den?e.fps_num/e.fps_den:e.fps_num,Io=(e,t)=>We((e.start_frame??0)+t,jF(e),!!e.is_drop_frame),NF=e=>e.split(/[\\/]/).pop()??e,ac=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]},$d=e=>e.items.filter(t=>t.kind==="clip");function Uo(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 Kr=(e,t)=>VO(e,t),Qw=(e,t)=>RO(e,t),DO=(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 HO(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 CO(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 t9=["fit","fill","crop","stretch"];function KO(e,t,n){if(n)return n;let i=e.reframe_fit??t.mismatch_policy??"fit";return i==="none"?"crop":t9.includes(i)?i:"fit"}function EO(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 sn=(e,t)=>Math.round(e*10**t)/10**t||0;function _w(e,t,n,i=[1,1]){return{Pan:sn(e.position_x*t/i[0],3),Tilt:sn(-e.position_y*n/i[1],3),ZoomX:sn(e.scale_x/100/i[0],5),ZoomY:sn(e.scale_y/100/i[1],5),RotationAngle:sn(-e.rotation,3),FlipX:e.flip_h,FlipY:e.flip_v}}function FO(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}}function SF(e,t,n,i,r=[1,1]){if(Math.abs(e.rotation)>.05||e.flip_h||e.flip_v||Math.abs(r[0]-1)>1e-6||Math.abs(r[1]-1)>1e-6)return null;let a=e.scale_x/100,o=e.scale_y/100,s=.5+e.position_x,c=.5+e.position_y,l=u=>Math.max(0,Math.min(1,u));return{CropLeft:sn(l((t.cropL/100-(s-a/2))/a)*n,3),CropRight:sn(l((s+a/2-(1-t.cropR/100))/a)*n,3),CropTop:sn(l((t.cropT/100-(c-o/2))/o)*i,3),CropBottom:sn(l((c+o/2-(1-t.cropB/100))/o)*i,3)}}var YO=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}),MO=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,jte=["edit","input","node"];function IO(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 WF={aligned:"Green",animated:"Yellow",no_match:"Red",refused:"Red"};async function qF(e,t){let n=t.offline_reference,i=_e(t),r=i,a=Math.max(...t.tracks.flatMap(v=>v.items.map(b=>b.timeline_range.start.value+b.timeline_range.duration.value)),0),o=v=>({kind:"Video",track_index:Math.max(0,...ac(t).map(b=>b.track_index))+1,name:"OFFLINE REFERENCE",enabled:!0,items:v});if(n?.session_id){let{getSession:v}=await import("./store-F2CTSR6E.js"),b=(await v(n.session_id)).session,h=b.timelines.find(z=>z.kind==="primary")??b.timelines[0],g=(t.start_frame??0)+(n.frame_offset??0)-(h.start_frame??0),y=ac(h).filter(z=>z.enabled!==!1).flatMap(z=>z.items.filter(L=>L.kind==="clip"&&L.enabled!==!1&&L.media_reference_id).map(L=>({i:L,top:z.track_index}))),x=[...new Set(y.flatMap(({i:z})=>[z.timeline_range.start.value,z.timeline_range.start.value+z.timeline_range.duration.value]))].sort((z,L)=>z-L),P=[];for(let z=0;z+1<x.length;z++){let[L,S]=[x[z],x[z+1]],w=y.filter(({i:R})=>R.timeline_range.start.value<=L&&L<R.timeline_range.start.value+R.timeline_range.duration.value).sort((R,D)=>D.top-R.top)[0],[O,j]=[Math.max(0,L-g),Math.min(a,S-g)];if(!w||j<=O)continue;let U=w.i,Q=P.at(-1);if(Q&&Q.from===U.id&&Q.timeline_range.start.value+Q.timeline_range.duration.value===O){Q.timeline_range.duration.value+=j-O,Q.source_range.duration.value+=j-O;continue}let{id:q,timeline_range:G,source_range:E,media_reference_id:B,keyframes:H,...ae}=U;P.push({...ae,id:`offline-ref-${P.length}`,from:U.id,kind:"clip",enabled:!0,media_reference_id:`offref:${B}`,timeline_range:{start:{value:O,rate:r},duration:{value:j-O,rate:r}},source_range:{start:{value:E.start.value+(O+g-U.timeline_range.start.value),rate:E.start.rate},duration:{value:j-O,rate:E.start.rate}}})}if(!P.length)throw new Me("not_found",`the offline reference timeline "${h.name}" has no picture over this timeline`);let T=new Set(P.map(z=>String(z.media_reference_id).slice(7)));return{lane:o(P),media:b.media_references.filter(z=>T.has(z.id)).map(z=>({...z,id:`offref:${z.id}`})),name:`timeline ${h.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 Me("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-NCUTSVJ4.js"),u=await l(c),f=u.source_timecode?Bo(u.source_timecode,i,null):0,d=u.available_range?.duration?.value??u.declared_duration?.value??null,m=(t.start_frame??0)+(n.frame_offset??0)-f;d!=null&&(m>=d||m+a<=0)&&(m=n.frame_offset??0);let p=d!=null?Math.max(1,Math.min(a,d-m)):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:m,rate:r},duration:{value:p,rate:r}}}]),media:[],name:s.name??NF(c)}}async function Nte(e,t,n,i){if(t.reference_track!=="offline")return await UO(e,t,n,i);let r=e9(e,t.timeline_id),{lane:a,media:o,name:s}=await qF(e,r);r.tracks.push(a),e.media_references.push(...o);try{return{...await UO(e,{...t,reference_track:ac(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 UO(e,t,n,i){let r=e9(e,t.timeline_id),a=r.resolution_w,o=r.resolution_h,s=ac(r),c=t.reference_track;if(!c)throw new Error(`say which track is the reference: reference_track = its video track (V1 = 1, the timeline has ${s.length}) or "offline"`);let l=s[c-1];if(!l)throw new Error(`no video track V${c} (the timeline has ${s.length})`);if(t.tracks?.includes(c))throw new Me("invalid_args",`the track to align cannot be the reference track (V${c})`);let u=(t.tracks?.length?t.tracks:s.map((w,O)=>O+1).filter(w=>s[w-1].enabled!==!1)).filter(w=>w!==c);for(let w of u)if(!s[w-1])throw new Error(`no video track V${w} (the timeline has ${s.length})`);let f=t.input_scaling??"fit",d=t.sizing_target??"edit",m=600,p=(w,O)=>{let j=Math.max(1,O-w);if(t.samples==="ends")return[...new Set([0,.25,.5,.75,1].map(q=>w+Math.round(q*(Math.max(w,O-1)-w))))];let U=(t.samples??"half")==="half"&&!t.step?Math.max(1,Math.round(_e(r)/2)):t.step,Q=t.samples==="all"?Math.max(1,Math.ceil(j/m)):U?Math.max(1,Math.floor(U),Math.ceil(j/m)):0;if(Q){let q=[];for(let G=w;G<O;G+=Q)q.push(G);return q.at(-1)!==O-1&&q.push(O-1),q}return CO(w,O,Math.max(1,Math.min(m,Math.floor(Number(t.samples))||1)))},v=Number(r.start_frame??0),b=[],h=[],g=$d(l),y=t.scope??"all",x=new Set(t.picks??[]);if(y==="selected"&&!x.size)throw new Error("no clips selected: select clips in the timeline, or align the whole timeline");for(let w of u)for(let O of $d(s[w-1])){let[j,U]=zn(O);if(y==="playhead"&&!(j<=(t.at??-1)&&(t.at??-1)<U)||y==="selected"&&!x.has(`${w}:${j}`))continue;let Q={item_id:O.id,name:O.name??O.id,track:w,start:j,end:U,record_tc:Io(r,j),verdict:"refused",confidence:null,samples:[]};b.push(Q);let q=ee=>{Q.reason=ee};if(O.enabled===!1){q("disabled");continue}let G,E=0,B=0;for(let ee of g){let[ce,ve]=zn(ee),Ze=Math.max(j,ce),ye=Math.min(U,ve);ye-Ze>B-E&&(G=ee,E=Ze,B=ye)}if(!G){if(t.reference_label){q(`${t.reference_label} does not cover it (${Io(r,j)}\u2013${Io(r,U)}): it ends before this clip`);continue}let ee=l.items.find(ce=>{let[ve,Ze]=zn(ce);return ce.kind!=="clip"&&ce.kind!=="gap"&&Math.min(U,Ze)>Math.max(j,ve)});q(ee?`V${c} has ${/compound|stack|timeline/i.test(String(ee.kind))?"a compound clip or nested timeline":`a ${ee.kind}`} over it, not a movie clip: Align reads a media file there (decompose it, or use Offline ref)`:g.length?`nothing on V${c} over it (${Io(r,j)}\u2013${Io(r,U)}): the reference does not cover this clip`:`V${c} has no movie clips: pick the track the reference is on, or Offline ref`);continue}let H=Uo(e,G),ae=Uo(e,O);if(!H.path){q(`the reference clip ${G.name??G.id} is not linked (timeline_relink first)`);continue}if(!ae.path){q("not linked (timeline_relink first)");continue}let R=p(E,B),D=Kr(G,E),N=MO(D)?void 0:D;if(N){let ee=N.scaleX??N.scale??100,ce=N.scaleY??N.scale??100,ve=N.animated||R.some(Ze=>JSON.stringify(Kr(G,Ze))!==JSON.stringify(D))?"keyframed":Math.abs(ee-ce)>1e-6?"scaled unevenly":N.flipH||N.flipV?"flipped":N.anchorX||N.anchorY?"anchored off centre":d!=="edit"?"resized (Colour-page sizing is solved against an unresized reference only)":"";if(ve){q(`the reference clip ${G.name??G.id} is ${ve}; the fit is against its raw picture`);continue}}if(H.w>0&&H.h>0&&Math.abs(H.w/H.h-a/o)>.01*(a/o)){q(`the reference ${H.w}x${H.h} does not fill the ${a}x${o} frame`);continue}let J=ee=>ee.map(ce=>({ref:H.path,refFrame:Qw(G,ce),src:ae.path,srcFrame:Qw(O,ce)})),ne=Array.from({length:B-E},(ee,ce)=>E+ce),ie=Kr(O,j);h.push({row:Q,item:O,recs:R,every:ne,refT:N,ask:{pairs:J(R),every:J(ne),every_t:ne.map(ee=>ee-j),edit:YO(ie),edit_identity:MO(ie),edit_animated:!!ie.animated,anchor_off:!!(ie.anchorX||ie.anchorY),...t.inputs?.get(`${w}:${j+v}`)?.length?{input:t.inputs.get(`${w}:${j+v}`)}:{}}})}let P=h.length?await _r({op:"reframe",items:h.map(w=>w.ask),out:[a,o],target:d},n,i):{items:[],offsets:[]},T=P.offsets;P.items.forEach((w,O)=>{let{row:j,item:U,recs:Q,every:q,ask:G,refT:E}=h[O],B=w.transform;if(E&&(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=FO(w.transform,E,a,o)),w.edit_transform&&(w.edit_transform=FO(w.edit_transform,E,a,o)),w.transform)){let D=G.edit,N=w.transform,J=.5/a;w.unchanged=Math.abs(N.scale_x-D.scale_x)<.05&&Math.abs(N.scale_y-D.scale_y)<.05&&Math.abs(N.position_x-D.position_x)<J&&Math.abs(N.position_y-D.position_y)<.5/o&&Math.abs(N.rotation-D.rotation)<.02}let H=w.measured==="every"?q:Q,ae=w.measured==="every"?G.every:G.pairs,R=(({w:D,h:N})=>EO(D,N,a,o,KO(U,r,t.input_scaling)))(Uo(e,U));if(j.samples=w.scores.map((D,N)=>({record:H[w.at[N]],ref_frame:ae[w.at[N]].refFrame,src_frame:ae[w.at[N]].srcFrame,score:D})),Object.assign(j,{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&&(j.transform=w.transform,j.properties=_w(w.edit_transform??w.transform,a,o,R)),E&&B&&(E.cropL||E.cropR||E.cropT||E.cropB)){let D=SF(B,E,a,o,R);if(!D)j.reason=[j.reason,"the reference's crop is not carried: the clip is rotated or flipped against it, or does not fill the frame"].filter(Boolean).join("; ");else{j.crop=D;let N=Kr(U,j.start),J={CropLeft:N.cropL/100*a,CropRight:N.cropR/100*a,CropTop:N.cropT/100*o,CropBottom:N.cropB/100*o};Object.keys(D).some(ne=>Math.abs(D[ne]-J[ne])>.5)&&(j.unchanged=void 0)}}w.keys?.length&&(j.keys=w.keys.map(D=>({record:H[w.at[D.j]],transform:D.transform,properties:_w(D.transform,a,o,R),confidence:D.confidence}))),w.grade_keys?.length&&(j.grade_keys=w.grade_keys.map(({shape:D,...N})=>D?.kind==="resolve_dissolve"?{...N,ease_in:D.start,ease_out:D.end}:N),j.grade_keys[0].t>0&&j.grade_keys.unshift({...j.grade_keys[0],t:0,ease_in:void 0,ease_out:void 0})),w.edit_keys?.length&&(j.edit_keys=w.edit_keys[0].t>0?[{...w.edit_keys[0],t:0,shape:void 0},...w.edit_keys]:w.edit_keys)});let z=[];for(let w of b){let O={track:w.track,start:w.start};if(w.verdict==="aligned"&&d==="edit"&&!w.unchanged){let j=w.properties;z.push({op:"properties",item:O,set:{...j.ZoomX!==j.ZoomY?{ZoomGang:!1}:{},...j,...w.crop??{}}})}if(w.verdict==="animated"&&w.edit_keys&&z.push({op:"edit_keys",item:O,keys:w.edit_keys}),w.verdict==="animated"&&w.grade_keys&&z.push({op:"grade_sizing",item:O,target:d==="node"?"node":"input",keys:w.grade_keys,...d==="node"?IO(t):{}}),w.verdict==="aligned"&&w.grade_sizing&&!w.unchanged&&z.push({op:"grade_sizing",item:O,target:d,...w.grade_sizing,...d==="node"?IO(t):{}}),t.markers??!0){let j={aligned:"Aligned",animated:"Animated",no_match:"No match",refused:"Not aligned"}[w.verdict],U=[w.label,w.confidence!=null?`confidence ${w.confidence}`:"",w.reason].filter(Boolean).join(" \xB7 ");z.push({op:"marker_add",frame:w.start,color:WF[w.verdict],name:`${j}: ${w.name}`,note:U,data:"ConformTools:align"})}}let L;if(t.apply_session){L=0;for(let w of b.filter(O=>O.verdict==="aligned")){let O=w.transform;$w(e,"transform",{timeline_id:r.id,item_id:w.item_id,scale:O.scale_x,position_x:O.position_x,position_y:O.position_y,rotation:O.rotation});let j=r.tracks.flatMap(U=>U.items).find(U=>U.id===w.item_id);Math.abs(O.scale_x-O.scale_y)>.001&&(j.scale_x=O.scale_x,j.scale_y=O.scale_y),O.flip_h?j.flip_horizontal=!0:delete j.flip_horizontal,O.flip_v?j.flip_vertical=!0:delete j.flip_vertical,L++}}let S={aligned:0,animated:0,no_match:0,refused:0};for(let w of b)S[w.verdict]++;return{timeline:r.name??r.id,raster:[a,o],reference_track:c,rows:b,counts:S,ops:z,...L!=null?{applied:L}:{},input_scaling:f,sizing_target:d,...T.length?{offsets:T}:{}}}function Ste(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
94
  `)}var ic={"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 ZF(e){if(e==null)return null;if(typeof e=="number")return e>0?e:null;if(e in ic)return ic[e];let t=/^(\d+(?:\.\d+)?)(?:[:/](\d+(?:\.\d+)?))?$/.exec(e.trim());if(!t)throw new Error(`aspect '${e}': one of ${Object.keys(ic).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 Wte(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 GO(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 JO(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 qte(e,t,n,i){let r=e9(e,t.timeline_id),a=r.resolution_w,o=r.resolution_h,s=ZF(t.aspect),c=OO(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=ac(r),d=f.filter(q=>q.enabled!==!1),m=[],p=[],v=q=>{let G=Uo(e,q);if(!(G.w>0&&G.h>0))return!1;let[E,B]=HO(a,o,G.w,G.h),H=Kr(q,zn(q)[0]);return!H.animated&&Math.abs(E-a)<.5&&Math.abs(B-o)<.5&&(H.scaleX??H.scale??100)===100&&(H.scaleY??H.scale??100)===100&&!H.posX&&!H.posY&&!H.rotation&&!H.cropL&&!H.cropR&&!H.cropT&&!H.cropB},b=new Map,h=[];for(let q of d)b.set(q,h),h=$d(q).filter(G=>G.enabled!==!1&&v(G)).reduce((G,E)=>JO(G,...zn(E)),h);let g=[];for(let q of[...d].reverse()){let G=$d(q).filter(H=>H.enabled!==!1),E=G.reduce((H,ae)=>JO(H,...zn(ae)),g),B=f.indexOf(q)+1;for(let H of G){let[ae,R]=zn(H),D=b.get(q)??[],N=GO(ae,R,g).flatMap(([ye,Ve])=>GO(ye,Ve,D));if(!N.length)continue;let J=Uo(e,H);if(!(J.w>0&&J.h>0)){m.push({item_id:H.id,name:H.name??H.id,track:B,reason:"the source raster is unknown (timeline_relink the clip first)"});continue}l&&!J.path&&m.push({item_id:H.id,name:H.name??H.id,track:B,reason:"not linked: its source frames were not measured (timeline_relink first); its transform was checked"});let[ne,ie]=HO(a,o,J.w,J.h),ee=Kr(H,ae).animated,ce=ye=>DO(Kr(H,ye),ne,ie),ve=[],Ze=new Map;for(let[ye,Ve]of N){let Pe=new Set(l&&J.path?CO(ye,Ve,u):[]),Ft=new Set(ee?Array.from({length:Ve-ye},(jt,In)=>ye+In):Pe.size?[]:[ye]);for(let jt of Pe)Ft.add(jt);let Jo=[...Ft].sort((jt,In)=>jt-In);Jo.forEach((jt,In)=>{Ze.set(jt,[In?jt:ye,Jo[In+1]??Ve]),ve.push({rec:jt,place:ce(jt),...Pe.has(jt)?{src:Qw(H,jt)}:{}})})}p.push({item:H,track:B,path:J.path,frames:ve,hold:Ze,animated:ee,box:[ne,ie]})}g=E}let y=p.length?await _r({op:"blanking",items:p.map(q=>({path:q.path,frames:q.frames})),out:[a,o],aspect:s},n,i):{items:[],target:[0,0,a,o]},x=y.target,P=[],T=new Map,z=0;y.items.forEach((q,G)=>{let E=p[G],B=new Map;T.set(E.item.id,B);for(let H of q){if(H.bars&&z++,H.black||!H.edges.some(D=>D>0))continue;let[ae,R]=E.hold.get(H.rec);for(let D=ae;D<R;D++)P.push({pts:D,bt:H.edges[0],bb:H.edges[1],bl:H.edges[2],br:H.edges[3],source:H.bars?"pixels":"geometry"}),B.set(D,H.zoom)}});let L=p.map(q=>({id:q.item.id,name:q.item.name??q.item.id,start:zn(q.item)[0],end:zn(q.item)[1],track:q.track})),w=XO(P,L,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(q=>{let G=1,E=T.get(q.clip.id);for(let B=q.start_frame;B<=q.end_frame;B++){if(!E.has(B))continue;let H=E.get(B);G=H==null||G==null?null:Math.max(G,H)}return{item_id:q.clip.id,name:q.clip.name,track:q.clip.track,record_start:q.start_frame,record_end:q.end_frame,record_tc:Io(r,q.start_frame),frames:q.duration_frames,edges:{top:q.measured.bt,bottom:q.measured.bb,left:q.measured.bl,right:q.measured.br},zones:q.zones,sources:q.sources,zoom_fix:G}}),O=[],j=new Map;for(let q of w)j.set(q.item_id,[...j.get(q.item_id)??[],q]);let U=new Map,Q=async(q,G)=>{let B=(await _r({op:"blanking",items:[{path:null,frames:q.frames.map(ae=>({rec:ae.rec,place:DO(G,q.box[0],q.box[1])}))}],out:[a,o],aspect:s},void 0,i)).items[0]??[],H=[0,1,2,3].map(ae=>Math.max(0,...B.map(R=>R.edges[ae])));return{ok:H.every(ae=>ae<=c.tolerance_px),edges:H}};for(let[q,G]of j){let E=p.find(ie=>ie.item.id===q);if(E.animated)continue;let B=Uo(e,E.item),H={track:E.track,start:zn(E.item)[0]},ae=Kr(E.item,zn(E.item)[0]),R=ie=>_w(YO(ie),a,o,EO(B.w,B.h,a,o,KO(E.item,r,t.input_scaling))),D;if(G.every(ie=>ie.sources.every(ee=>ee==="geometry"))){let ie=["top","bottom","left","right"].map(ce=>Math.max(...G.map(ve=>ve.edges[ce]))),ee=[];if(ae.rotation&&Math.abs(ae.rotation)<1){let ce={...ae,rotation:0},ve=await Q(E,ce);ve.ok?D={t:ce,what:`rotation ${sn(ae.rotation,2)}\xB0 removed`}:ee.push({t:ce,what:`rotation ${sn(ae.rotation,2)}\xB0 removed, `,edges:ve.edges})}ee.push({t:ae,what:"",edges:ie});for(let ce of D?[]:ee){let[ve,Ze,ye,Ve]=ce.edges,Pe=ye-Ve,Ft=ve-Ze;if(!(!Pe&&!Ft)){for(let[Jo,jt]of[[1,1],[-1,1],[1,-1],[-1,-1]]){let In={...ce.t,posX:ce.t.posX+Jo*Pe/E.box[0],posY:ce.t.posY+jt*Ft/E.box[1]};if((await Q(E,In)).ok){D={t:In,what:`${ce.what}pan / tilt ${[Pe&&`${Pe>0?"+":""}${Pe} px across`,Ft&&`${Ft>0?"+":""}${Ft} px up/down`].filter(Boolean).join(", ")}`};break}if(!Ft&&jt===1&&Jo===-1)break}if(D)break}}}if(D){let ie=R(ae),ee=R(D.t),ce=Object.fromEntries(["Pan","Tilt","RotationAngle"].filter(ve=>ee[ve]!==ie[ve]).map(ve=>[ve,ee[ve]]));O.push({op:"properties",item:H,set:ce}),U.set(q,`${D.what} fills it`);for(let ve of G)ve.fix=D.what;continue}if(G.some(ie=>ie.zoom_fix==null))continue;let N=Math.max(...G.map(ie=>ie.zoom_fix)),J=R(ae),ne=ie=>Math.ceil(ie*N*1e5)/1e5;O.push({op:"properties",item:H,set:{ZoomX:ne(J.ZoomX),ZoomY:ne(J.ZoomY)}})}if(t.markers??!0)for(let q of w){let G=p.find(H=>H.item.id===q.item_id),E=q.zones.map(H=>`${H} ${q.edges[H.toLowerCase()]} px`).join(" \xB7 "),B=G.animated?"keyframed sizing: fix the keys":U.get(q.item_id)??(q.zoom_fix==null?"no zoom about its anchor fills it":`zoom \xD7${q.zoom_fix} fills it`);O.push({op:"marker_add",frame:q.record_start,duration:q.frames,color:"Red",name:`Blanking: ${q.name}`,note:`${E} (${q.sources.join("+")}) \u2014 ${B}`,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:z,findings:w,refused:m,ops:O}}function Zte(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 ${sn(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(`
95
95
  `)}var oc=e=>e.map(([t,n])=>[t,n]),BO=e=>e[0].toUpperCase()+e.slice(1),n9=na.map(e=>[e.id,e.short]),QO=e=>({host:e}),fe=QO("resolve"),em=QO("premiere"),VF=a1.map(e=>[e.id,e.label]),pt={id:"source",label:"Timeline",type:"source",optional:!0,placeholder:"the timeline open in Resolve"},Er=(e="Read the timeline")=>({id:"pull",use:"host.read",args:{...fe,from:"$in.source"},label:e}),AO=gO,tm=(e,t)=>({id:"apply",use:"host.apply",args:{...fe,ops:"$ops",timeline:"$pull.timeline",source:"$pull"},...e?{when:e}:{},...t?{label:t}:{}}),RF=Object.keys(rc).map(e=>[e,BO(e)]),DF=[["","Full frame"],...Object.keys(ic).filter(e=>e!=="none").map(e=>[e,e])],_O=e=>Object.entries(Do).filter(([,t])=>t.folderStructure.includes(`{${e}}`)).map(([t])=>t),r9=_O("show"),HF=_O("film"),$O=[{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:[{...pt,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:n9,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",app:!0,playbook:"conform",output:"timeline",aka:["join reels","combine reels","stitch acts","one long timeline","full film","LFOA","reel string-out","merge timelines"],group:"Prep",about:"Several timelines end to end as one new timeline (reels into the whole film, acts into one): timelines in the project land in it as a new timeline; timeline files are written as a new file for any app. Tracks line up by number; a marker at each join names where it came from.",inputs:[{id:"from",label:"Join",type:"choice",choices:[["project","Timelines in the project"],["files","Timeline files"]],default:"project"},{id:"host",label:"App",type:"choice",choices:Mn,default:"resolve",when:{input:"from",is:["project"]}},{id:"timelines",label:"Timelines, in order",type:"timelines",when:{input:"from",is:["project"]}},{id:"paths",label:"Timeline files, in order",type:"files",when:{input:"from",is:["files"]}},{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:"Write for",type:"choice",choices:n9,default:"resolve",when:{input:"from",is:["files"]}},{id:"out",label:"Write to",type:"folder",optional:!0,placeholder:"a folder (default: next to the first)",when:{input:"from",is:["files"]}}],nodes:[{id:"pread",use:"host.export_many",args:{host:"$in.host",timelines:"$in.timelines"},when:"$in.from=project",label:"Read the timelines"},{id:"read",use:"timeline.read_many",args:{paths:"$in.paths"},when:"$in.from=files",label:"Read the files"},{id:"join",use:"timeline.join",args:{session_id:"$pread.session_id|$read.session_id",sources:"$pread.sources|$read.sources",name:"$in.name",gap_frames:"$in.gap"},label:"Join them"},{id:"mute",use:"timeline.remove_audio",args:{session_id:"$pread.session_id|$read.session_id",timeline_id:"$join.timeline_id"},when:"$in.no_audio=true"},{id:"open",use:"host.open",args:{host:"$in.host",session_id:"$pread.session_id",timeline_id:"$join.timeline_id"},when:"$in.from=project",label:"Into the project"},{id:"write",use:"verb.timeline_write",args:{session_id:"$read.session_id",timeline_id:"$join.timeline_id",target:"$in.target",out_path:"$in.out"},when:"$in.from=files",label:"Write it"}]},{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:[pt,{id:"host",label:"App",type:"choice",choices:Mn,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:"Change",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:"Color",type:"color",default:"Orange",when:{input:"action",is:["color"]}},{id:"marker_color",label:"Color",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:"Values",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:{empty:"no clips match",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","Color"],["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,preview:!0,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:[pt,{id:"host",label:"App",type:"choice",choices:Mn,default:"resolve"},{id:"only",label:"Only color",type:"marker_color",optional:!0,placeholder:"any color"},{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:"Apply to",type:"choice",choices:[["","Every marker"],["playhead","The one at the playhead"]],default:""},{id:"action",label:"Change",type:"choice",default:"recolor",choices:[["recolor","Color"],["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:"Color",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",label:"Change",args:{empty:"no markers match",rows:"$rows",columns:[["tc","Record TC"],["color","Color"],["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,preview:!0,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:"Then",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:{empty:"every clip in the pool is used by a timeline",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:"Clip Renamer",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:[pt,{id:"host",label:"App",type:"choice",choices:Mn,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 (@selected: the bin selected in Resolve)",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",label:"Rename",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",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:[pt,{id:"host",label:"App",type:"choice",choices:Mn,default:"resolve"},{id:"handles",label:"Handles (frames each side)",type:"number",default:6},{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",built:"$build"},label:"Into the host"}],view:{split:"row",panes:[{pane:"knobs"},{pane:"viewer",show:"$build|$source"}]}},{id:"all-clips",name:"All Clips Timeline",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:"App",type:"choice",choices:Mn,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:"selected_bin",label:"Every timeline in the bin selected in Resolve",type:"bool",default:!1},{id:"subfolders",label:"Its subfolders too",type:"bool",default:!1},{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:"sequence_extensions",label:"Image sequence extensions",type:"text",optional:!0,placeholder:"the built-in list (e.g. dpx, exr, dng)"},{id:"include_nested",label:"Include what's inside compound clips",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:"Keep 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",selected_bin:"$in.selected_bin"},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",sequence_extensions:"$in.sequence_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",built:"$build",read:"$read"},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",built:"$build",read:"$read"},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",built:"$build",read:"$read"},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,preview:!0,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:[pt,{id:"mode",label:"",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:"Number step",type:"number",default:10},{id:"digits",label:"Digits",type:"number",default:4},{id:"handles",label:"Handles",type:"number",default:8,when:{input:"mode",is:["pull"]}},{id:"gap",label:"Gap between shots",type:"number",default:24,when:{input:"mode",is:["pull"]}},{id:"start_frame",label:"First frame",type:"number",default:1001,when:{input:"mode",is:["pull"]}},{id:"naming",label:"Name pulls",type:"choice",choices:_6,default:"plates",when:{input:"mode",is:["pull"]}},{id:"folder",label:"Shot folder",type:"text",optional:!0,placeholder:"{shot} \xB7 {prefix} {number} {scene} {take}",when:{input:"mode",is:["pull"]}},{id:"names",label:"Rename pulls",type:"text",optional:!0,placeholder:"VFX_0010_PLATE01=SMOKE_0010, \u2026",when:{input:"mode",is:["pull"]}},{id:"hero",label:"Hero is the",type:"choice",choices:[["lowest","lowest track"],["highest","highest track"]],default:"lowest",when:{input:"mode",is:["pull"]}},{id:"reference_track",label:"Reference track",type:"track",optional:!0,when:{input:"mode",is:["pull"]}},{id:"skip_disabled",label:"Skip disabled clips",type:"bool",default:!0,when:{input:"mode",is:["pull"]}},{id:"name_markers",label:"Name the markers",type:"bool",default:!0,when:{input:"mode",is:["pull"]}},{id:"build",label:"Build the string-out",type:"bool",default:!0,when:{input:"mode",is:["pull"]}},{id:"root",label:"Render into",type:"folder",optional:!0,placeholder:"a folder (leave empty to skip rendering)",when:{input:"mode",is:["pull"]}},{id:"plate_preset",label:"Plates render with",type:"render_preset",optional:!0,placeholder:"the current settings",when:{input:"mode",is:["pull"]}},{id:"reference_preset",label:"Reference renders with",type:"render_preset",optional:!0,placeholder:"the current settings",when:{input:"mode",is:["pull"]}},{id:"queue",label:"Only add to Resolve's render queue",type:"bool",default:!1,when:{input:"mode",is:["pull"]}}],nodes:[Er(),{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",label:"Pull",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:[pt,{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",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:[Er(),{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"}},tm()]},{id:"copy-grades",name:"Copy Grades",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:[pt,{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:!0},{id:"nodes",label:"Only these nodes",type:"text",optional:!0,placeholder:"e.g. 2, Skin (matched by node label) \xB7 empty = the whole grade"},{id:"group",label:"Color group",type:"bool",default:!0},{id:"keywords",label:"Keywords",type:"bool",default:!0},{id:"which",label:"Apply to",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},{id:"overwrite_markers",label:"Overwrite existing markers",type:"bool",default:!1}],nodes:[Er(),{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","Color"],["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",overwrite_markers:"$in.overwrite_markers",nodes:"$in.nodes"}},tm()]},{id:"trace",name:"Grade Tracer",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:[pt,{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:"Minimum match score",type:"number",default:60},{id:"top_n",label:"Alternatives to keep",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:[Er(),{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"}},tm()]},{id:"reconform",name:"Reconform",part:!0,app:!0,playbook:"patch",aka:["auto conform","autoconform","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:[pt,{id:"do",label:"",type:"choice",choices:[["carry","Carry the grade to the new cut"],["mark","Mark the changes"],["files","Reconform from files"],["compare","Compare two renders"],["dropin","Drop in VFX (Resolve)"],["cutin","Cut in returns (Premiere)"],["match","Match sizing to the new cut"],["discard","Delete a reconformed timeline"]],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:"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:n9,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"]}},...AO.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",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 by",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","files"]}},{id:"compare_a",label:"Old version (movie)",type:"file",placeholder:"the cut whose media and grade exist",when:{input:"do",is:["compare"]}},{id:"compare_b",label:"New version (movie)",type:"file",when:{input:"do",is:["compare"]}},{id:"compare_edl_path",label:"Changes as an EDL",type:"file",optional:!0,placeholder:"write a CMX3600 EDL here",when:{input:"do",is:["compare"]}},{id:"compare_csv_path",label:"Changes as a CSV",type:"file",optional:!0,when:{input:"do",is:["compare"]}},{id:"cutin_media_root",label:"Returns folder",type:"folder",when:{input:"do",is:["cutin"]}},{id:"cutin_mode",label:"Cut into",type:"choice",choices:[["cut_in","The open sequence, on the track above"],["new_version","A new sequence"]],default:"cut_in",when:{input:"do",is:["cutin"]}},{id:"cutin_track",label:"Onto video track",type:"number",optional:!0,placeholder:"default: above the top track",when:{input:"do",is:["cutin"]}},{id:"cutin_dry_run",label:"Dry run (change nothing)",type:"bool",default:!1,when:{input:"do",is:["cutin"]}}],nodes:[{id:"pull",use:"host.read",args:{...fe,timeline:"$in.a",from:"$in.source"},when:"$in.do!=files & $in.do!=discard & $in.do!=match & $in.do!=compare & $in.do!=cutin",label:"Read A"},{id:"cutin",use:"tool.cutin",args:{media_root:"$in.cutin_media_root",mode:"$in.cutin_mode",track:"$in.cutin_track",dry_run:"$in.cutin_dry_run"},when:"$in.do=cutin",label:"Cut in the returns"},{id:"movies",use:"tool.compare",args:{a:"$in.compare_a",b:"$in.compare_b",edl_path:"$in.compare_edl_path",csv_path:"$in.compare_csv_path"},when:"$in.do=compare",label:"Compare the renders"},{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:"fa",use:"source.file",args:{path:"$in.a_file"},when:"$in.do=files",label:"Read A"},{id:"la",use:"host.read",args:{...fe,from:"$fa"},when:"$in.do=files",label:"A's clips"},{id:"lb",use:"host.read",args:{...fe,from:"$bf"},when:"$in.do=files",label:"B's clips"},{id:"file_edits",use:"plan.edit_changes",args:{a:"$la",b:"$lb"},when:"$in.do=files",label:"Compare the edit"},{id:"file_map",use:"plan.parity_map",args:{a:"$la",b:"$lb"},when:"$in.do=files"},{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(AO.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:"map",use:"plan.parity_map",args:{a:"$pull",b:"$b|$bl"},when:"$in.do=mark & $in.compare=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"]],empty:"A and B are the same cut"},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"]],empty:"A and B are the same cut"},when:"$in.do=mark & $in.compare=source"},{id:"ops",use:"ops.collect",args:{rows:"$review"},when:"$in.do=mark & $in.compare=source"},tm("$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|$file_edits",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|$in.name|$la.timeline",folder:"$in.report"},when:"$in.report!=",label:"Save the report"},{id:"file_table",use:"table",args:{rows:"$file_edits",columns:[["b_tc","B"],["a_tc","A"],["change","Change"],["clip","Clip"],["head","Head"],["tail","Tail"],["frames","Frames"]],text:"$write.text"},when:"$in.do=files",label:"The change list"}],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:[pt,{id:"kind",label:"Kind",type:"choice",choices:o1.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:VF,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:s1.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:[{...Er(),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:[pt,{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:[Er(),{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:[pt,{id:"host",label:"App",type:"choice",choices:Mn,default:"resolve"},{id:"aspect",label:"Delivery aspect",type:"choice",choices:DF,default:""},{id:"strictness",label:"Strictness",type:"choice",choices:RF,default:"strict"},{id:"scaling",label:"Input scaling",type:"choice",choices:t9.map(e=>[e,BO(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:"Suggest zoom fixes",type:"bool",default:!0},{id:"which",label:"Apply to",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",blanking:!0},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"],group:"Check",about:"Holds a rendered master from any app to a delivery spec (Netflix, Apple, Amazon, EBU R128, BBC/DPP, ATSC A/85): every frame measured on this machine (black, freezes, flashes, black edges, dead pixels; each audio track's loudness, true peak, clipping, dropouts, silence, phase), at the master's own timecode.",inputs:[{id:"path",label:"The master",type:"file"},{id:"pack",label:"Spec",type:"choice",choices:LO,default:"conform_default"},{id:"report",label:"Save a report (HTML) into",type:"folder",optional:!0,placeholder:"no report"}],nodes:[{id:"file",use:"qc.master_file",args:{path:"$in.path",pack:"$in.pack"},label:"Measure the master"},{id:"report",use:"qc.report",args:{rows:"$file.rows",text:"$file.text",subject:"$in.path",pack:"$in.pack",folder:"$in.report",verdict:"$file.verdict"},when:"$in.report!=",label:"Save the report"},{id:"show",use:"table",args:{rows:"$file.rows",text:"$file.text",columns:[["tc","In"],["out","Out"],["kind","Finding"],["severity",""],["detail","Measured"]]}}]},{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",preview:!0,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",label:"Fix",args:{empty:"no odd-sized stills in the folder",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:"seq-rename",name:"Image Sequence Renamer",part:!0,app:!0,aka:["image sequence renamer","rename frames","renumber frames","offset frame numbers","rename an image sequence","exr renamer","dpx renamer"],group:"Prep",preview:!0,about:"Every image sequence in a folder renamed on disk: the rename steps on the name part (the frame number and extension kept, or the extension set), then the frame numbers offset, or renumbered from a start with an increment and a padding. Previewed frame by frame; DUPEs and names already taken are never written; Undo puts every name back. No app needed.",inputs:[{id:"folder",label:"Folder",type:"folder"},{id:"steps",label:"Steps",type:"rename_steps",default:[{type:"find_replace",find:"",replace:""}]},{id:"only",label:"Only names matching",type:"text",optional:!0,placeholder:"a pattern, e.g. ^SH010"},{id:"offset",label:"Offset frame numbers by",type:"number",optional:!0,placeholder:"0"},{id:"start_at",label:"\u2026or start each sequence at",type:"number",optional:!0,placeholder:"as they are"},{id:"increment",label:"Frames apart",type:"number",optional:!0,placeholder:"1"},{id:"digits",label:"Frame number digits",type:"number",optional:!0,placeholder:"as they are"}],nodes:[{id:"plan",use:"files.rename_plan",args:{folder:"$in.folder",steps:"$in.steps",only:"$in.only",offset:"$in.offset",start_at:"$in.start_at",increment:"$in.increment",digits:"$in.digits"},label:"Read the folder"},{id:"review",use:"review",label:"Rename",args:{rows:"$plan",columns:[["where","Where"],["old","Now"],["new","New"],["dupe",""],["error",""]],skip:"hold"}},{id:"files",use:"files.rename",args:{rows:"$review"},label:"Rename the files"}]},{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",preview:!0,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:u2.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",label:"File",args:{empty:"no files in the folder to sort",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",preview:!0,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",label:"Patch",args:{empty:'no patch frames beside the sequence (a folder next to it with "patch" in its name)',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",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:[pt,{id:"host",label:"App",type:"choice",choices:Mn,default:"resolve"},{id:"color",label:"Markers",type:"marker_color",default:"Blue"},{id:"scope",label:"Render",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:yO,default:"conformtools"},{id:"show",label:"Show",type:"text",optional:!0,when:{input:"naming",is:r9}},{id:"season",label:"Season",type:"text",optional:!0,when:{input:"naming",is:r9}},{id:"episode",label:"Episode",type:"text",optional:!0,when:{input:"naming",is:r9}},{id:"film",label:"Film",type:"text",optional:!0,when:{input:"naming",is:HF}},{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:{empty:"no markers of that color",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 Media",app:!0,playbook:"autoconform",output:"timeline",aka:["conform","conform from media","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},pt],nodes:[{...Er("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:[pt,{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:[Er(),{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",...em,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",...em,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:"Cut 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",...em,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",...em,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:[pt,{id:"host",label:"App",type:"choice",choices:Mn,default:"resolve"},{id:"out",label:"Copy 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 renders of a cut (movies, not timelines): 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). Two timelines: Reconform.",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",hidden:!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:"Output",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:oc(Cw),default:"rec709"},{id:"container",label:"Container",type:"choice",choices:[["","From the master"],...oc(xO)],default:""},{id:"resolution",label:"Size",type:"choice",choices:oc(wO),default:"2k"},{id:"kind",label:"Kind",type:"choice",choices:oc(PO),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:"The fix's color space",type:"choice",choices:oc(Cw),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 Ci(e,t){let n=[{id:"mode",label:"",type:"choice",choices:t.map(([a,o])=>[a,o]),default:t[0][0]}],i=[],r=t.map(([a,,o])=>[a,$O.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 eX=[...$O,{id:"autobalance",name:"Autobalance",app:!0,aka:["autocolor","auto balance","balance the shots","first balance","color prep","prep for color","one light","input CSTs","node tree on every shot"],group:"Look",about:"Every shot gets your node tree, the input Color Space Transform from the camera's own metadata, and a first balance in your balance node: each shot on its own, then matched to its neighbours in edit order, then each person's skin matched across a setup. Written as a separate .drt beside the timeline; your project is never touched.",inputs:[{id:"from",label:"Timeline",type:"choice",choices:[["resolve","Resolve's open timeline"],["file","A timeline file"]],default:"resolve"},{id:"path",label:"Timeline file",type:"file",optional:!0,placeholder:".drt .prproj .xml .aaf",when:{input:"from",is:["file"]}},{id:"tree",label:"Your node tree",type:"file",optional:!0,placeholder:"a .drx still or PowerGrade (the first time; remembered after)"},{id:"balance_node",label:"Balance node",type:"number",optional:!0,placeholder:"its node number in that tree"},{id:"cst_node",label:"Input CST node",type:"number",optional:!0,placeholder:"its node number in that tree"},{id:"balance",label:"Balance the shots",type:"bool",default:!0},{id:"download",label:"Allow the Autocolor pack download (first run, ~4 GB)",type:"bool",default:!1},{id:"out",label:"Write to",type:"folder",optional:!0,placeholder:"a folder (default: next to the timeline)"}],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:"prep",use:"verb.color_prep",args:{session_id:"$read.session_id|$resolve.session_id",tree:"$in.tree",balance_node:"$in.balance_node",cst_node:"$in.cst_node",balance:"$in.balance",download:"$in.download"},label:"Tree, CSTs and balance"},{id:"write",use:"verb.timeline_write",args:{session_id:"$prep.session_id",target:"resolve-drt",out_path:"$in.out"},when:"$prep.session_id",label:"Write the .drt"}]},Ci({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: filter them, tick, and change them in one undoable batch in Resolve or Premiere (0.9.5's Edit Index +)."},[["clips","Clips","clips"]]),Ci({id:"relinking",name:"Relink",app:!0,playbook:"conform",aka:["relink","link media","find missing media","reconnect"],group:"Match",about:"Link the timeline to media in a folder (every clip matched by reel, timecode, name and duration), or on Premiere repoint every proxy to its camera original."},[["relink","Relink","relink"],["uprez","Proxies to online (Premiere)","uprez"]]),Ci({id:"sequence",name:"Modify Timeline",app:!0,playbook:"conform",aka:["rebuild sequence","modify sequence","un-nest","unnest","resize sequence","flatten nests"],group:"Prep",about:"Premiere: the open sequence as a NEW sequence with every nest expanded into the cut, or at another raster where nothing moves. The open sequence is never edited."},[["unnest","Un-nest","unnest"],["resize","Resize","resize"]]),Ci({id:"image-tools",name:"Image Tools",group:"Prep",aka:["image tools","stills","image sequences"],about:"Stills and image sequences on disk: odd sizes made even (and scaled down), and frames renamed, offset or renumbered. No app needed for either."},[["odd","Odd Image Fixer","odd-images"],["seq","Image Sequence Renamer","seq-rename"]]),Ci({id:"qc",name:"QC",playbook:"deliverables",group:"Check",...fe,about:"Check a rendered master frame by frame (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"]]),Ci({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"]]),Ci({id:"delivery",name:"DCP",playbook:"deliverables",aka:["manage delivery"],group:"Deliver",about:"A SMPTE DCP from the ProRes master and the mix, or a fix dropped into a finished DCP without rebuilding it."},[["dcp","Make a DCP","dcp"],["dcppatch","Patch a DCP","dcp-patch"]])],FF=new Set(["account_login","account_status","account_logout","account_telemetry","conform_learn","feedback","job","tool","app","project","project_link","team","timeline_routes","timeline_sessions","artist_profile","naming"]),MF=new Set(["path","reference","a","b","plate","render","master","patch","edl_path","csv_path","credits_path","look_path"]),IF=new Set(["out_dir","media_root","target_dir","images_dir","pool"]),UF=new Set(["pool","paths","picture","sound","mix","media_dirs","fonts"]);function Qte(e){let t=[];for(let n of e){if(FF.has(n.name)||n.name.startsWith("host_"))continue;let i=ub(Ud.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"?MF.has(o)?"file":IF.has(o)?"folder":"text":l==="array"&&s.items?.type==="string"&&UF.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 nne="io.modelcontextprotocol/skills",rX=3e5,GF=512,JF=16*1024*1024;async function CF(){let e=Br("CONFORM_PLAYBOOKS_DIR");if(e)return await br(e)?e:null;let t=pc(new URL("../../api/playbooks/",import.meta.url));return await br(t)?t:null}var KF={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"},EF=e=>KF[e.split(".").pop()?.toLowerCase()??""]??"application/octet-stream";async function YF(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 AF(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 iX(e,t,n,i){let r=[];for await(let a of it(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 iX(C(e,a.name),o,n,i)):a.isFile&&n.push({rel:o,abs:C(e,a.name)})}}async function BF(e){let t=[];for await(let i of it(e))i.isDirectory&&!i.name.startsWith(".")&&t.push(i.name);let n=[];for(let i of t.sort()){let r=[];await iX(C(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 lt(a.abs)})))})}return n}var QF=()=>`${kn().supabaseUrl}/functions/v1/v1-me/v1/engine/playbooks`;async function _F(){let{token:e,error:t}=await H9("the playbooks");if(!e)throw t;let n=await fetch(QF(),{headers:{authorization:`Bearer ${e}`,apikey:kn().anonKey},signal:AbortSignal.timeout(8e3)}),i=await n.json().catch(()=>null);if(!n.ok||!Array.isArray(i?.playbooks))throw new Error(i?.error?.message??`conform.tools answered ${n.status}`);let r=new TextEncoder;return{version:String(i.version??"unknown"),skills:i.playbooks.map(a=>({name:a.name,files:a.files.map(o=>({path:o.path,bytes:r.encode(o.text)}))}))}}async function tX(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 YF(s.bytes),mimeType:EF(s.path)})}let o=AF(new TextDecoder().decode(r.find(s=>s.path==="SKILL.md").bytes));!o||o.name!==n.name||typeof o.description!="string"||r.length>GF||r.reduce((s,c)=>s+c.bytes.length,0)>JF||t.push({name:n.name,uri:`${i}/SKILL.md`,root:i,frontmatter:o,files:r,dirs:a})}return t}var nm=null;function i9(){nm??=(async()=>{let t=await CF();if(t)return{skills:await tX(await BF(t)),source:"local",version:"local"};let n=await _F();return{skills:await tX(n.skills),source:"conform.tools",version:n.version}})();let e=nm;return e.catch(()=>{nm===e&&(nm=null)}),e}async function im(){try{return(await i9()).skills}catch{return[]}}function aX(e){return{uri:e.uri,frontmatter:e.frontmatter,resources:e.files.map(t=>({uri:t.uri,digest:t.digest,size:t.bytes.length}))}}var rm=class extends Error{constructor(n,i){super(i);this.code=n}},oX=-32602;async function rne(){return{resultType:"complete",skills:(await im()).map(aX),ttlMs:rX,cacheScope:"public"}}async function ine(e){let t=(await im()).find(n=>n.uri===e);if(!t)throw new rm(oX,`No skill is served at ${String(e)}`);return{resultType:"complete",skill:aX(t),ttlMs:rX,cacheScope:"public"}}async function ane(e){let t=String(e??"").replace(/\/$/,"");for(let n of await im()){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 rm(oX,`No skill directory at ${t}`)}async function sX(e=!1){let t=await im();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(`
96
96
  `):""}var one=["conform","autoconform","deliver","deliverables","troubleshoot","patch","prep"],sne=["avid","premiere","resolve","finalcut","flame","baselight","protools"],$F={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"]],prep:["media-prep",["SKILL.md"]]},nX={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"},eM=e=>e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").trimStart(),lX=new Set,lne=()=>lX.size>0;async function cne(e,t=[]){let{skills:n,version:i}=await i9(),[r,a]=$F[e],o=n.find(d=>d.name===r);if(!o)throw new Error(`the ${r} playbook is not available (version ${i})`);let s=n.find(d=>d.name==="conform-artist"),c=a.map(d=>[o,d]);for(let d of t)c.some(([,m])=>m===nX[d])||c.push([s,nX[d]]);let l=[],u=[];for(let[d,m]of c){let p=d?.files.find(v=>v.path===m);p&&(u.push(p.uri),l.push(`<!-- ${p.uri} -->