@cerebriline/core 4.100.249 → 4.100.251

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,23 +1,34 @@
1
- import{createRequire as F$}from"node:module";var D=F$(import.meta.url);import{mkdir as wJ,writeFile as yJ}from"node:fs/promises";import{join as W$}from"node:path";import xJ from"node:fs/promises";import{existsSync as PQ,readdirSync as v$,readFileSync as AQ,statSync as S$}from"node:fs";import*as u from"node:path";import{createHash as C$}from"node:crypto";import{inflateSync as R$}from"node:zlib";var N$=new Set(["image/png","image/jpeg","image/gif","image/webp"]),L$={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/bmp":"bmp","image/tiff":"tif","image/svg+xml":"svg","image/emf":"emf","image/wmf":"wmf","image/x-pict":"pict"};function j$(Q){let $=(q,...Z)=>Z.every((K,H)=>Q[q+H]===K);if($(0,137,80,78,71))return"image/png";if($(0,255,216,255))return"image/jpeg";if($(0,71,73,70,56))return"image/gif";if($(0,82,73,70,70)&&$(8,87,69,66,80))return"image/webp";if($(0,66,77))return"image/bmp";if($(0,73,73,42,0)||$(0,77,77,0,42))return"image/tiff";if($(40,32,69,77,70))return"image/emf";if($(0,215,205,198,154)||$(0,1,0,9,0))return"image/wmf";if($(10,0,17,2,255))return"image/x-pict";let J=Buffer.from(Q.subarray(0,256)).toString("utf8").trimStart();if(J.startsWith("<svg")||J.startsWith("<?xml")&&J.includes("<svg"))return"image/svg+xml";return}function T$(Q){if(Q[0]!==120||![1,94,156,218].includes(Q[1]??0))return Q;try{return new Uint8Array(R$(Q))}catch{return Q}}class BQ{linkDir;byHash=new Map;names=new Set;pending=[];constructor(Q="images"){this.linkDir=Q}add(Q){if(Q.data.byteLength===0)return;let $=T$(Q.data),J=C$("sha1").update($).digest("hex"),q=this.byHash.get(J);if(q)return q;let Z=j$($)??Q.mediaType??"application/octet-stream",K=L$[Z]??"bin",H=this.uniqueName(O$(Q.stem),K),Y={file:H,link:`${this.linkDir}/${H}`,mediaType:Z,bytes:$.byteLength,...Q.width?{width:Q.width}:{},...Q.height?{height:Q.height}:{},...Q.source?{source:Q.source}:{},...Q.alt?.trim()?{alt:Q.alt.trim()}:{},...N$.has(Z)||Z==="image/svg+xml"?{}:{notViewable:!0},sha1:J};return this.byHash.set(J,Y),this.pending.push({image:Y,data:$}),Y}get images(){return this.pending.map((Q)=>Q.image)}entries(){return this.pending}uniqueName(Q,$){let J=`${Q}.${$}`;for(let q=2;this.names.has(J);q++)J=`${Q}-${q}.${$}`;return this.names.add(J),J}}function O$(Q){return Q.replace(/\.[a-z0-9]{2,4}$/i,"").replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)||"image"}function x(Q){return`![${(Q.alt??"").replace(/[[\]\n]/g," ").trim()}](${Q.link})`}var P$=/\.(png|jpe?g|gif|webp|bmp|svg|tiff?)$/i;function A$(Q){if(Q.length<90)return 0;let $=new DataView(Q.buffer,Q.byteOffset,Q.byteLength),J=$.getUint32(78);if(J+14>Q.length)return 0;return $.getUint16(J+12)}function I$(Q){let $=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);return $.includes("META-INF/rights.xml")||$.includes("META-INF/license.lcpl")}function k$(Q){let $=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);if($.length<22||$.readUInt32LE(0)!==67324752)return"it does not start as a ZIP archive, which every EPUB is";let J=$.lastIndexOf(Buffer.from([80,75,5,6]),$.length-22);if(J<0||J<$.length-22-65535)return`it ends before its index (${$.length.toLocaleString("en-US")} bytes), so it was cut short when it was copied, downloaded or unpacked`;let q=$.readUInt32LE(J+12),Z=$.readUInt32LE(J+16);if(Z!==4294967295&&q!==4294967295&&Z+q>J)return"its index points past the end of the file, so part of it is missing";return}var IQ=120000;async function $Q(Q){let $;try{return await Promise.race([Q,new Promise((J,q)=>{$=setTimeout(()=>q(Error(`The book could not be opened: the reader gave no answer in ${IQ/1000}s, which is what it does with a damaged file. Check that the file is complete.`)),IQ)})])}finally{clearTimeout($)}}function kQ(Q,$=0,J=[]){for(let q of Q){if(J.length>=200)break;let Z=String(q.label??"").trim();if(Z)J.push(`${" ".repeat($)}${Z}`);if(Array.isArray(q.children))kQ(q.children,$+1,J)}return J}function JQ(Q){if(typeof Q==="string")return Q.trim()||void 0;if(Array.isArray(Q))for(let $ of Q){let J=JQ(typeof $==="object"&&$!==null?$.contributor??$.name:$);if(J)return J}if(typeof Q==="object"&&Q!==null){let $=Q;return JQ($.contributor??$.name??$.value)}return}async function D$(Q){let{default:$}=await import("turndown"),{gfm:J}=await import("@joplin/turndown-plugin-gfm"),q=new $({headingStyle:"atx",codeBlockStyle:"fenced",bulletListMarker:"-"});return q.use(J),q.remove(["script","style","head"]),q.addRule("image",{filter:"img",replacement:(Z,K)=>{let H=K,Y=H.getAttribute("src")??"";return Q(Y,H.getAttribute("alt")??"")??""}}),q.addRule("svgImage",{filter:(Z)=>Z.nodeName.toLowerCase()==="image",replacement:(Z,K)=>{let H=K,Y=H.getAttribute("xlink:href")??H.getAttribute("href")??"";return Q(Y,"")??""}}),q}async function DQ(Q,$,J,q){if((J==="mobi"||J==="azw3")&&A$($)>1)throw Error("This Kindle book is DRM-protected. It can be read only in a Kindle app; nothing here can remove the protection.");if(J==="epub"&&I$($))throw Error("This EPUB is DRM-protected (Adobe ADEPT or Readium LCP). It can be read only in a reader app licensed for it.");if(J==="epub"){let U=k$($);if(U)throw Error(`This EPUB is damaged: ${U}. Nothing can be read from it; get the file again.`)}let Z=q.scratchDir,{initEpubFile:K}=await import("@lingo-reader/epub-parser"),{initFb2File:H}=await import("@lingo-reader/fb2-parser"),{initKf8File:Y,initMobiFile:X}=await import("@lingo-reader/mobi-parser"),B,F;if(J==="epub")B=await $Q(K(Q,Z)),F="lingo-reader (EPUB)";else if(J==="fb2")B=await $Q(H(Q,Z)),F="lingo-reader (FB2)";else{let[U,V]=J==="azw3"?[Y,X]:[X,Y];try{B=await $Q(U(Q,Z)),F=`lingo-reader (${U===Y?"KF8":"MOBI"})`}catch{B=await $Q(V(Q,Z)),F=`lingo-reader (${V===Y?"KF8":"MOBI"})`}}try{let U=new Map,V=0,G=await D$((L,T)=>{if(!q.wantImages||!L||/^(data:|https?:)/i.test(L))return;let S=L;try{S=decodeURI(L.replace(/^file:\/\//,""))}catch{}if(!u.isAbsolute(S)||!PQ(S))return;if(!U.has(S))U.set(S,q.images.add({data:AQ(S),stem:u.basename(S),source:`chapter ${V}`,...T?{alt:T}:{}}));let w=U.get(S);return w?x(w):void 0}),z=B.getSpine(),C=[],I=[];for(let L=0;L<z.length;L++){let T=L+1;if(q.selects&&!q.selects(T))continue;q.signal?.throwIfAborted(),V=T,q.onProgress?.({unit:"chapter",at:T,total:z.length,pictures:U.size}),C.push(T);let w=(await B.loadChapter(z[L].id))?.html??"",i=w?G.turndown(w).trim():"";if(i)I.push(i)}if(q.wantImages&&PQ(Z))for(let L of v$(Z,{recursive:!0})){let T=u.join(Z,L);if(!P$.test(L)||U.has(T)||!S$(T).isFile())continue;U.set(T,q.images.add({data:AQ(T),stem:u.basename(L)}))}let P=B.getMetadata()??{},v=JQ(P.title),b=JQ(P.creator??P.author),d=kQ(B.getToc()??[]);return{markdown:I.join(`
2
-
3
- `),reader:F,...v&&v!=="Unknown"?{title:v}:{},...b&&b!=="Unknown"?{author:b}:{},units:{name:"chapter",total:z.length,read:C},...d.length?{contents:d}:{}}}finally{B.destroy()}}import*as WQ from"node:path";var M$={pdf:"PDF",docx:"Word document (DOCX)",pptx:"PowerPoint presentation (PPTX)",xlsx:"Excel workbook (XLSX)",odt:"OpenDocument text (ODT)",odp:"OpenDocument presentation (ODP)",ods:"OpenDocument spreadsheet (ODS)",odg:"OpenDocument drawing (ODG)",rtf:"Rich Text (RTF)",csv:"CSV",html:"HTML",epub:"EPUB ebook",mobi:"Mobipocket / Kindle ebook (MOBI)",azw3:"Kindle KF8 ebook (AZW3)",fb2:"FictionBook (FB2)",doc:"Word 97-2003 document (DOC)",xls:"Excel 97-2003 workbook (XLS)",ppt:"PowerPoint 97-2003 presentation (PPT)"},MQ={".pdf":"pdf",".docx":"docx",".docm":"docx",".dotx":"docx",".pptx":"pptx",".pptm":"pptx",".ppsx":"pptx",".xlsx":"xlsx",".xlsm":"xlsx",".odt":"odt",".odp":"odp",".ods":"ods",".odg":"odg",".rtf":"rtf",".csv":"csv",".html":"html",".htm":"html",".xhtml":"html",".epub":"epub",".mobi":"mobi",".prc":"mobi",".azw":"mobi",".azw3":"azw3",".kf8":"azw3",".fb2":"fb2",".doc":"doc",".dot":"doc",".xls":"xls",".ppt":"ppt",".pps":"ppt"},E$={".djvu":"DjVu has no JavaScript reader.",".djv":"DjVu has no JavaScript reader.",".chm":"Compiled HTML Help (CHM) has no JavaScript reader.",".lit":"Microsoft Reader (LIT) has no JavaScript reader.",".lrf":"Sony BBeB (LRF) has no JavaScript reader.",".kfx":"KFX is Amazon's DRM-bound format and cannot be read.",".pages":"Apple Pages files have no JavaScript reader; export them as DOCX or PDF.",".key":"Apple Keynote files have no JavaScript reader; export them as PPTX or PDF.",".numbers":"Apple Numbers files have no JavaScript reader; export them as XLSX or CSV.",".xlsb":"Binary Excel workbooks (XLSB) are not read; save the workbook as XLSX.",".wps":"Microsoft Works documents are not read; save them as DOCX.",".cbz":"Comic archives are not read yet.",".cbr":"Comic archives are not read yet."},oJ=Object.keys(MQ);function EQ(Q,$){let J=WQ.extname(Q).toLowerCase(),q=E$[J];if(q)return{unsupported:q};let Z=Buffer.from($.subarray(0,512)).toString("latin1"),K=MQ[J];if(Z.startsWith("%PDF"))return{format:"pdf"};if(Z.startsWith("{\\rtf"))return{format:"rtf"};if(Z.slice(60,68)==="BOOKMOBI")return{format:K==="azw3"?"azw3":"mobi"};let H=Z.startsWith("PK\x03\x04"),Y=Z.startsWith("ÐÏ\x11ࡱ\x1Aá");if(H){if(Z.includes("mimetypeapplication/epub+zip"))return{format:"epub"};let X=/mimetypeapplication\/vnd\.oasis\.opendocument\.(text|presentation|spreadsheet|graphics)/.exec(Z);if(X)return{format:{text:"odt",presentation:"odp",spreadsheet:"ods",graphics:"odg"}[X[1]]};if(K&&["docx","pptx","xlsx","epub","odt","odp","ods","odg"].includes(K))return{format:K};if(K==="doc")return{format:"docx"};if(K==="xls")return{format:"xlsx"};if(K==="ppt")return{format:"pptx"}}if(Y){if(K==="doc"||K==="xls"||K==="ppt")return{format:K};if(K==="docx")return{format:"doc"};if(K==="xlsx")return{format:"xls"};if(K==="pptx")return{format:"ppt"};return{unsupported:"This is an OLE compound file, but its extension does not say which Office program wrote it; rename it to .doc, .xls or .ppt."}}if(K==="fb2"||/<FictionBook[\s>]/.test(Z))return{format:"fb2"};if(K==="html"||K==="csv")return{format:K};if(K)return{unsupported:`The file is named as ${M$[K]} but its contents are not; it may be damaged or a different format.`};return{unsupported:`No reader for ${J||"files without an extension"}. Readable: PDF, DOCX/DOC, PPTX/PPT, XLSX/XLS, ODT/ODP/ODS/ODG, RTF, CSV, HTML, EPUB, MOBI/AZW/AZW3, FB2.`}}import{existsSync as hQ,readFileSync as c$}from"node:fs";import{dirname as cQ,join as bQ}from"node:path";import{fileURLToPath as g$}from"node:url";class t{__destroy_into_raw(){let Q=this.__wbg_ptr;return this.__wbg_ptr=0,xQ.unregister(this),Q}free(){let Q=this.__destroy_into_raw();W.__wbg_wasmdocument_free(Q,0)}formatName(){let Q,$;try{let Z=W.__wbindgen_add_to_stack_pointer(-16);W.wasmdocument_formatName(Z,this.__wbg_ptr);var J=R().getInt32(Z+0,!0),q=R().getInt32(Z+4,!0);return Q=J,$=q,h(J,q)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_export3(Q,$,1)}}constructor(Q,$){try{let K=W.__wbindgen_add_to_stack_pointer(-16),H=wQ(Q,W.__wbindgen_export),Y=E,X=r($,W.__wbindgen_export,W.__wbindgen_export2),B=E;W.wasmdocument_new(K,H,Y,X,B);var J=R().getInt32(K+0,!0),q=R().getInt32(K+4,!0),Z=R().getInt32(K+8,!0);if(Z)throw M(q);return this.__wbg_ptr=J,xQ.register(this,this.__wbg_ptr,this),this}finally{W.__wbindgen_add_to_stack_pointer(16)}}plainText(){let Q,$;try{let Z=W.__wbindgen_add_to_stack_pointer(-16);W.wasmdocument_plainText(Z,this.__wbg_ptr);var J=R().getInt32(Z+0,!0),q=R().getInt32(Z+4,!0);return Q=J,$=q,h(J,q)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_export3(Q,$,1)}}toHtml(){let Q,$;try{let Z=W.__wbindgen_add_to_stack_pointer(-16);W.wasmdocument_toHtml(Z,this.__wbg_ptr);var J=R().getInt32(Z+0,!0),q=R().getInt32(Z+4,!0);return Q=J,$=q,h(J,q)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_export3(Q,$,1)}}toIr(){try{let q=W.__wbindgen_add_to_stack_pointer(-16);W.wasmdocument_toIr(q,this.__wbg_ptr);var Q=R().getInt32(q+0,!0),$=R().getInt32(q+4,!0),J=R().getInt32(q+8,!0);if(J)throw M($);return M(Q)}finally{W.__wbindgen_add_to_stack_pointer(16)}}toMarkdownWithImages(){let Q,$;try{let Z=W.__wbindgen_add_to_stack_pointer(-16);W.wasmdocument_toMarkdownWithImages(Z,this.__wbg_ptr);var J=R().getInt32(Z+0,!0),q=R().getInt32(Z+4,!0);return Q=J,$=q,h(J,q)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_export3(Q,$,1)}}toMarkdown(){let Q,$;try{let Z=W.__wbindgen_add_to_stack_pointer(-16);W.wasmdocument_toMarkdown(Z,this.__wbg_ptr);var J=R().getInt32(Z+0,!0),q=R().getInt32(Z+4,!0);return Q=J,$=q,h(J,q)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_export3(Q,$,1)}}}if(Symbol.dispose)t.prototype[Symbol.dispose]=t.prototype.free;class UQ{__destroy_into_raw(){let Q=this.__wbg_ptr;return this.__wbg_ptr=0,_Q.unregister(this),Q}free(){let Q=this.__destroy_into_raw();W.__wbg_wasmeditabledocument_free(Q,0)}constructor(Q,$){try{let K=W.__wbindgen_add_to_stack_pointer(-16),H=wQ(Q,W.__wbindgen_export),Y=E,X=r($,W.__wbindgen_export,W.__wbindgen_export2),B=E;W.wasmeditabledocument_new(K,H,Y,X,B);var J=R().getInt32(K+0,!0),q=R().getInt32(K+4,!0),Z=R().getInt32(K+8,!0);if(Z)throw M(q);return this.__wbg_ptr=J,_Q.register(this,this.__wbg_ptr,this),this}finally{W.__wbindgen_add_to_stack_pointer(16)}}replaceText(Q,$){try{let K=W.__wbindgen_add_to_stack_pointer(-16),H=r(Q,W.__wbindgen_export,W.__wbindgen_export2),Y=E,X=r($,W.__wbindgen_export,W.__wbindgen_export2),B=E;W.wasmeditabledocument_replaceText(K,this.__wbg_ptr,H,Y,X,B);var J=R().getInt32(K+0,!0),q=R().getInt32(K+4,!0),Z=R().getInt32(K+8,!0);if(Z)throw M(q);return J>>>0}finally{W.__wbindgen_add_to_stack_pointer(16)}}toBytes(){try{let K=W.__wbindgen_add_to_stack_pointer(-16);W.wasmeditabledocument_toBytes(K,this.__wbg_ptr);var Q=R().getInt32(K+0,!0),$=R().getInt32(K+4,!0),J=R().getInt32(K+8,!0),q=R().getInt32(K+12,!0);if(q)throw M(J);var Z=w$(Q,$).slice();return W.__wbindgen_export3(Q,$*1,1),Z}finally{W.__wbindgen_add_to_stack_pointer(16)}}}if(Symbol.dispose)UQ.prototype[Symbol.dispose]=UQ.prototype.free;function x$(){return{__proto__:null,"./office_oxide_bg.js":{__proto__:null,__wbg_Error_67e7344beaa85059:function($,J){let q=Error(h($,J));return y(q)},__wbg_String_8564e559799eccda:function($,J){let q=String(s(J)),Z=r(q,W.__wbindgen_export,W.__wbindgen_export2),K=E;R().setInt32($+4,K,!0),R().setInt32($+0,Z,!0)},__wbg___wbindgen_throw_5d9e815e6fdf150f:function($,J){throw Error(h($,J))},__wbg_new_bebc3f4757acf305:function(){return y({})},__wbg_new_ffa92086ea89f79c:function(){return y([])},__wbg_set_13d25b81ab403f5e:function($,J,q){s($)[J>>>0]=M(q)},__wbg_set_6be42768c690e380:function($,J,q){s($)[M(J)]=M(q)},__wbindgen_generic_0000000000000001:function($){return y($)},__wbindgen_generic_0000000000000002:function($){return y($)},__wbindgen_generic_0000000000000003:function($,J){let q=h($,J);return y(q)},__wbindgen_generic_0000000000000004:function($){let J=BigInt.asUintN(64,$);return y(J)},__wbindgen_object_clone_ref:function($){let J=s($);return y(J)},__wbindgen_object_drop_ref:function($){M($)}}}}var xQ=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((Q)=>W.__wbg_wasmdocument_free(Q,1)),_Q=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((Q)=>W.__wbg_wasmeditabledocument_free(Q,1));function y(Q){if(o===_.length)_.push(_.length+1);let $=o;return o=_[$],_[$]=Q,$}function _$(Q){if(Q<1028)return;_[Q]=o,o=Q}function w$(Q,$){return Q=Q>>>0,g().subarray(Q/1,Q/1+$)}var c=null;function R(){if(c===null||c.buffer.detached===!0||c.buffer.detached===void 0&&c.buffer!==W.memory.buffer)c=new DataView(W.memory.buffer);return c}function h(Q,$){return h$(Q>>>0,$)}var n=null;function g(){if(n===null||n.byteLength===0)n=new Uint8Array(W.memory.buffer);return n}function s(Q){return _[Q]}var _=Array(1024).fill(void 0);_.push(void 0,null,!0,!1);var o=_.length;function wQ(Q,$){let J=$(Q.length*1,1)>>>0;return g().set(Q,J/1),E=Q.length,J}function r(Q,$,J){if(J===void 0){let Y=a.encode(Q),X=$(Y.length,1)>>>0;return g().subarray(X,X+Y.length).set(Y),E=Y.length,X}let q=Q.length,Z=$(q,1)>>>0,K=g(),H=0;for(;H<q;H++){let Y=Q.charCodeAt(H);if(Y>127)break;K[Z+H]=Y}if(H!==q){if(H!==0)Q=Q.slice(H);Z=J(Z,q,q=H+Q.length*3,1)>>>0;let Y=g().subarray(Z+H,Z+q),X=a.encodeInto(Q,Y);H+=X.written,Z=J(Z,q,H,1)>>>0}return E=H,Z}function M(Q){let $=s(Q);return _$(Q),$}var qQ=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});qQ.decode();var y$=2146435072,GQ=0;function h$(Q,$){if(GQ+=$,GQ>=y$)qQ=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),qQ.decode(),GQ=$;return qQ.decode(g().subarray(Q,Q+$))}var a=new TextEncoder;if(!("encodeInto"in a))a.encodeInto=function(Q,$){let J=a.encode(Q);return $.set(J),{read:Q.length,written:J.length}};var E=0,b$,f$,W;function u$(Q,$){return f$=Q,W=Q.exports,b$=$,c=null,n=null,W}function yQ(Q){if(W!==void 0)return W;if(Q!==void 0)if(Object.getPrototypeOf(Q)===Object.prototype)({module:Q}=Q);else console.warn("using deprecated parameters for `initSync()`; pass a single object instead");let $=x$();if(!(Q instanceof WebAssembly.Module))Q=new WebAssembly.Module(Q);let J=new WebAssembly.Instance(Q,$);return u$(J,Q)}var fQ="office_oxide_bg.wasm",uQ=!1;function l$(Q=m$()){let $=bQ(Q,"office-oxide",fQ);if(hQ($))return $;let J=Q;for(let q=0;q<7;q++){let Z=bQ(J,"assets","office-oxide",fQ);if(hQ(Z))return Z;let K=cQ(J);if(K===J)break;J=K}return}function m$(){try{return cQ(g$(import.meta.url))}catch{return"."}}function gQ(Q,$){if(!uQ){let J=l$();if(!J)throw Error("The reader for Word, Excel and PowerPoint 97-2003 files is missing from this installation (office_oxide_bg.wasm was not found).");yQ({module:c$(J)}),uQ=!0}return new t(Q,$)}var p$=/\[image-base64:([A-Za-z0-9+/=\s]+)\]/g;function d$(Q){return Q.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"")}function i$(Q,$){let J=new DataView(Q.buffer,Q.byteOffset,Q.byteLength),q=$+8;while(q+12<=Q.length){let Z=J.getUint32(q),K=String.fromCharCode(...Q.subarray(q+4,q+8));if(q+=12+Z,K==="IEND")return q-$;if(Z>Q.length)return}return}function n$(Q,$){let J=$+2;while(J+4<=Q.length){if(Q[J]!==255)return;let q=Q[J+1];if(q===217)return J+2-$;if(q===218){J+=2+(Q[J+2]<<8|Q[J+3]);while(J+1<Q.length){if(Q[J]===255){let Z=Q[J+1];if(Z===217)return J+2-$;if(Z!==0&&(Z<208||Z>215))break}J++}continue}J+=2+(Q[J+2]<<8|Q[J+3])}return}async function s$(Q){let $=await import("cfb"),J=$.default??$,q;try{q=J.read(Buffer.from(Q),{type:"buffer"})}catch{return[]}let Z=[];for(let K of q.FileIndex){let H=K.content;if(K.type!==2||!H||H.length<64)continue;let Y=H instanceof Uint8Array?H:new Uint8Array(H);for(let X=0;X+8<Y.length;X++){let B;if(Y[X]===137&&Y[X+1]===80&&Y[X+2]===78&&Y[X+3]===71)B=i$(Y,X);else if(Y[X]===255&&Y[X+1]===216&&Y[X+2]===255)B=n$(Y,X);if(B&&B>64&&X+B<=Y.length)Z.push(Y.slice(X,X+B)),X+=B-1}}return Z}async function lQ(Q,$,J){let q=gQ(Q,$),Z;try{Z=q.toMarkdownWithImages()}finally{q.free()}let K=0;Z=Z.replace(p$,(Y,X)=>{if(!J.wantImages)return"";K++;let B=J.images.add({data:Buffer.from(X.replace(/\s/g,""),"base64"),stem:`${$}-image-${K}`});return B?x(B):""}),Z=d$(Z).replace(/\n{3,}/g,`
4
-
5
- `).trim();let H=[];if(J.wantImages&&$==="doc"){let Y=[];for(let X of await s$(Q)){let B=J.images.images.length;K++;let F=J.images.add({data:X,stem:`${$}-image-${K}`});if(F&&J.images.images.length>B)Y.push(x(F))}if(Y.length)Z+=`
1
+ import{createRequire as JX}from"node:module";var dK=Object.create;var{getPrototypeOf:oK,defineProperty:WJ,getOwnPropertyNames:nK}=Object;var iK=Object.prototype.hasOwnProperty;function rK(Q){return this[Q]}var aK,sK,j$=(Q,J,Y)=>{var $=Q!=null&&typeof Q==="object";if($){var q=J?aK??=new WeakMap:sK??=new WeakMap,V=q.get(Q);if(V)return V}Y=Q!=null?dK(oK(Q)):{};let K=J||!Q||!Q.__esModule?WJ(Y,"default",{value:Q,enumerable:!0}):Y;for(let X of nK(Q))if(!iK.call(K,X))WJ(K,X,{get:rK.bind(Q,X),enumerable:!0});if($)q.set(Q,K);return K};var E=(Q,J)=>()=>(J||Q((J={exports:{}}).exports,J),J.exports);var tK=(Q)=>Q;function eK(Q,J){this[Q]=tK.bind(null,J)}var QX=(Q,J)=>{for(var Y in J)WJ(Q,Y,{get:J[Y],enumerable:!0,configurable:!0,set:eK.bind(J,Y)})};var UJ=(Q,J)=>()=>(Q&&(J=Q(Q=0)),J);var a=JX(import.meta.url);var z$=E((KQ)=>{(function(Q){Q.parser=function(W,G){return new Y(W,G)},Q.SAXParser=Y,Q.SAXStream=U,Q.createStream=Z,Q.MAX_BUFFER_LENGTH=65536;var J=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];Q.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function Y(W,G){if(!(this instanceof Y))return new Y(W,G);var F=this;if(q(F),F.q=F.c="",F.bufferCheckPosition=Q.MAX_BUFFER_LENGTH,F.encoding=null,F.opt=G||{},F.opt.lowercase=F.opt.lowercase||F.opt.lowercasetags,F.looseCase=F.opt.lowercase?"toLowerCase":"toUpperCase",F.opt.maxEntityCount=F.opt.maxEntityCount||512,F.opt.maxEntityDepth=F.opt.maxEntityDepth||4,F.entityCount=F.entityDepth=0,F.tags=[],F.closed=F.closedRoot=F.sawRoot=!1,F.tag=F.error=null,F.strict=!!W,F.noscript=!!(W||F.opt.noscript),F.state=L.BEGIN,F.strictEntities=F.opt.strictEntities,F.ENTITIES=F.strictEntities?Object.create(Q.XML_ENTITIES):Object.create(Q.ENTITIES),F.attribList=[],F.opt.xmlns)F.ns=Object.create(j);if(F.opt.unquotedAttributeValues===void 0)F.opt.unquotedAttributeValues=!W;if(F.trackPosition=F.opt.position!==!1,F.trackPosition)F.position=F.line=F.column=0;I(F,"onready")}if(!Object.create)Object.create=function(W){function G(){}G.prototype=W;var F=new G;return F};if(!Object.keys)Object.keys=function(W){var G=[];for(var F in W)if(W.hasOwnProperty(F))G.push(F);return G};function $(W){var G=Math.max(Q.MAX_BUFFER_LENGTH,10),F=0;for(var O=0,u=J.length;O<u;O++){var r=W[J[O]].length;if(r>G)switch(J[O]){case"textNode":$0(W);break;case"cdata":y(W,"oncdata",W.cdata),W.cdata="";break;case"script":y(W,"onscript",W.script),W.script="";break;default:Q0(W,"Max buffer length exceeded: "+J[O])}F=Math.max(F,r)}var J0=Q.MAX_BUFFER_LENGTH-F;W.bufferCheckPosition=J0+W.position}function q(W){for(var G=0,F=J.length;G<F;G++)W[J[G]]=""}function V(W){if($0(W),W.cdata!=="")y(W,"oncdata",W.cdata),W.cdata="";if(W.script!=="")y(W,"onscript",W.script),W.script=""}Y.prototype={end:function(){$Q(this)},write:VQ,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){V(this)}};var K;try{K=a("stream").Stream}catch(W){K=function(){}}if(!K)K=function(){};var X=Q.EVENTS.filter(function(W){return W!=="error"&&W!=="end"});function Z(W,G){return new U(W,G)}function H(W,G){if(W.length>=2){if(W[0]===255&&W[1]===254)return"utf-16le";if(W[0]===254&&W[1]===255)return"utf-16be"}if(W.length>=3&&W[0]===239&&W[1]===187&&W[2]===191)return"utf8";if(W.length>=4){if(W[0]===60&&W[1]===0&&W[2]===63&&W[3]===0)return"utf-16le";if(W[0]===0&&W[1]===60&&W[2]===0&&W[3]===63)return"utf-16be";return"utf8"}return G?"utf8":null}function U(W,G){if(!(this instanceof U))return new U(W,G);K.apply(this),this._parser=new Y(W,G),this.writable=!0,this.readable=!0;var F=this;this._parser.onend=function(){F.emit("end")},this._parser.onerror=function(O){F.emit("error",O),F._parser.error=null},this._decoder=null,this._decoderBuffer=null,X.forEach(function(O){Object.defineProperty(F,"on"+O,{get:function(){return F._parser["on"+O]},set:function(u){if(!u)return F.removeAllListeners(O),F._parser["on"+O]=u,u;F.on(O,u)},enumerable:!0,configurable:!1})})}U.prototype=Object.create(K.prototype,{constructor:{value:U}}),U.prototype._decodeBuffer=function(W,G){if(this._decoderBuffer)W=Buffer.concat([this._decoderBuffer,W]),this._decoderBuffer=null;if(!this._decoder){var F=H(W,G);if(!F)return this._decoderBuffer=W,"";this._parser.encoding=F,this._decoder=new TextDecoder(F)}return this._decoder.decode(W,{stream:!G})},U.prototype.write=function(W){if(typeof Buffer==="function"&&typeof Buffer.isBuffer==="function"&&Buffer.isBuffer(W))W=this._decodeBuffer(W,!1);else if(this._decoderBuffer){var G=this._decodeBuffer(Buffer.alloc(0),!0);if(G)this._parser.write(G),this.emit("data",G)}return this._parser.write(W.toString()),this.emit("data",W),!0},U.prototype.end=function(W){if(W&&W.length)this.write(W);if(this._decoderBuffer){var G=this._decodeBuffer(Buffer.alloc(0),!0);if(G)this._parser.write(G),this.emit("data",G)}else if(this._decoder){var F=this._decoder.decode();if(F)this._parser.write(F),this.emit("data",F)}return this._parser.end(),!0},U.prototype.on=function(W,G){var F=this;if(!F._parser["on"+W]&&X.indexOf(W)!==-1)F._parser["on"+W]=function(){var O=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);O.splice(0,0,W),F.emit.apply(F,O)};return K.prototype.on.call(F,W,G)};var B=/^\[CDATA\[$/i,P=/^DOCTYPE$/i,z="http://www.w3.org/XML/1998/namespace",N="http://www.w3.org/2000/xmlns/",j={xml:z,xmlns:N},C=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,A=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,M=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,T=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function R(W){return W===" "||W===`
2
+ `||W==="\r"||W==="\t"}function D(W){return W==='"'||W==="'"}function x(W){return W===">"||R(W)}function w(W,G){return W.test(G)}function v(W,G){return!w(W,G)}var L=0;Q.STATE={BEGIN:L++,BEGIN_WHITESPACE:L++,TEXT:L++,TEXT_ENTITY:L++,OPEN_WAKA:L++,SGML_DECL:L++,SGML_DECL_QUOTED:L++,DOCTYPE:L++,DOCTYPE_QUOTED:L++,DOCTYPE_DTD:L++,DOCTYPE_DTD_QUOTED:L++,COMMENT_STARTING:L++,COMMENT:L++,COMMENT_ENDING:L++,COMMENT_ENDED:L++,CDATA:L++,CDATA_ENDING:L++,CDATA_ENDING_2:L++,PROC_INST:L++,PROC_INST_BODY:L++,PROC_INST_ENDING:L++,OPEN_TAG:L++,OPEN_TAG_SLASH:L++,ATTRIB:L++,ATTRIB_NAME:L++,ATTRIB_NAME_SAW_WHITE:L++,ATTRIB_VALUE:L++,ATTRIB_VALUE_QUOTED:L++,ATTRIB_VALUE_CLOSED:L++,ATTRIB_VALUE_UNQUOTED:L++,ATTRIB_VALUE_ENTITY_Q:L++,ATTRIB_VALUE_ENTITY_U:L++,CLOSE_TAG:L++,CLOSE_TAG_SAW_WHITE:L++,SCRIPT:L++,SCRIPT_ENDING:L++},Q.XML_ENTITIES=Object.assign(Object.create(null),{amp:"&",gt:">",lt:"<",quot:'"',apos:"'"}),Q.ENTITIES=Object.assign(Object.create(null),{amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830}),Object.keys(Q.ENTITIES).forEach(function(W){var G=Q.ENTITIES[W],F=typeof G==="number"?String.fromCharCode(G):G;Q.ENTITIES[W]=F});for(var k in Q.STATE)Q.STATE[Q.STATE[k]]=k;L=Q.STATE;function I(W,G,F){W[G]&&W[G](F)}function _(W){var G=W&&W.match(/(?:^|\s)encoding\s*=\s*(['"])([^'"]+)\1/i);return G?G[2]:null}function o(W){if(!W)return null;return W.toLowerCase().replace(/[^a-z0-9]/g,"")}function i(W,G){let F=o(W),O=o(G);if(!F||!O)return!0;if(O==="utf16")return F==="utf16le"||F==="utf16be";return F===O}function D0(W,G){if(!W.strict||!W.encoding||!G||G.name!=="xml")return;var F=_(G.body);if(F&&!i(W.encoding,F))m(W,"XML declaration encoding "+F+" does not match detected stream encoding "+W.encoding.toUpperCase())}function y(W,G,F){if(W.textNode)$0(W);I(W,G,F)}function $0(W){if(W.textNode=W0(W.opt,W.textNode),W.textNode)I(W,"ontext",W.textNode);W.textNode=""}function W0(W,G){if(W.trim)G=G.trim();if(W.normalize)G=G.replace(/\s+/g," ");return G}function Q0(W,G){if($0(W),W.trackPosition)G+=`
3
+ Line: `+W.line+`
4
+ Column: `+W.column+`
5
+ Char: `+W.c;return G=Error(G),W.error=G,I(W,"onerror",G),W}function $Q(W){if(W.sawRoot&&!W.closedRoot)m(W,"Unclosed root tag");if(W.state!==L.BEGIN&&W.state!==L.BEGIN_WHITESPACE&&W.state!==L.TEXT)Q0(W,"Unexpected end");return $0(W),W.c="",W.closed=!0,I(W,"onend"),Y.call(W,W.strict,W.opt),W}function m(W,G){if(typeof W!=="object"||!(W instanceof Y))throw Error("bad call to strictFail");if(W.strict)Q0(W,G)}function H8(W){if(!W.strict)W.tagName=W.tagName[W.looseCase]();var G=W.tags[W.tags.length-1]||W,F=W.tag={name:W.tagName,attributes:{}};if(W.opt.xmlns)F.ns=G.ns;W.attribList.length=0,y(W,"onopentagstart",F)}function E0(W,G){var F=W.indexOf(":"),O=F<0?["",W]:W.split(":"),u=O[0],r=O[1];if(G&&W==="xmlns")u="xmlns",r="";return{prefix:u,local:r}}function E6(W){if(!W.strict)W.attribName=W.attribName[W.looseCase]();if(W.attribList.indexOf(W.attribName)!==-1||W.tag.attributes.hasOwnProperty(W.attribName)){W.attribName=W.attribValue="";return}if(W.opt.xmlns){var G=E0(W.attribName,!0),F=G.prefix,O=G.local;if(F==="xmlns")if(O==="xml"&&W.attribValue!==z)m(W,"xml: prefix must be bound to "+z+`
6
+ Actual: `+W.attribValue);else if(O==="xmlns"&&W.attribValue!==N)m(W,"xmlns: prefix must be bound to "+N+`
7
+ Actual: `+W.attribValue);else{var u=W.tag,r=W.tags[W.tags.length-1]||W;if(u.ns===r.ns)u.ns=Object.create(r.ns);u.ns[O]=W.attribValue}W.attribList.push([W.attribName,W.attribValue])}else W.tag.attributes[W.attribName]=W.attribValue,y(W,"onattribute",{name:W.attribName,value:W.attribValue});W.attribName=W.attribValue=""}function B0(W,G){if(W.opt.xmlns){var F=W.tag,O=E0(W.tagName);if(F.prefix=O.prefix,F.local=O.local,F.uri=F.ns[O.prefix]||"",F.prefix&&!F.uri)m(W,"Unbound namespace prefix: "+JSON.stringify(W.tagName)),F.uri=O.prefix;var u=W.tags[W.tags.length-1]||W;if(F.ns&&u.ns!==F.ns)Object.keys(F.ns).forEach(function(P$){y(W,"onopennamespace",{prefix:P$,uri:F.ns[P$]})});for(var r=0,J0=W.attribList.length;r<J0;r++){var U0=W.attribList[r],Z0=U0[0],m0=U0[1],V0=E0(Z0,!0),u0=V0.prefix,lK=V0.local,O$=u0===""?"":F.ns[u0]||"",HJ={name:Z0,value:m0,prefix:u0,local:lK,uri:O$};if(u0&&u0!=="xmlns"&&!O$)m(W,"Unbound namespace prefix: "+JSON.stringify(u0)),HJ.uri=u0;W.tag.attributes[Z0]=HJ,y(W,"onattribute",HJ)}W.attribList.length=0}if(W.tag.isSelfClosing=!!G,W.sawRoot=!0,W.tags.push(W.tag),y(W,"onopentag",W.tag),!G){if(!W.noscript&&W.tagName.toLowerCase()==="script")W.state=L.SCRIPT;else W.state=L.TEXT;W.tag=null,W.tagName=""}W.attribName=W.attribValue="",W.attribList.length=0}function U6(W){if(!W.tagName){m(W,"Weird empty close tag."),W.textNode+="</>",W.state=L.TEXT;return}if(W.script){if(W.tagName!=="script"){W.script+="</"+W.tagName+">",W.tagName="",W.state=L.SCRIPT;return}y(W,"onscript",W.script),W.script=""}var G=W.tags.length,F=W.tagName;if(!W.strict)F=F[W.looseCase]();var O=F;while(G--){var u=W.tags[G];if(u.name!==O)m(W,"Unexpected close tag");else break}if(G<0){m(W,"Unmatched closing tag: "+W.tagName),W.textNode+="</"+W.tagName+">",W.state=L.TEXT;return}W.tagName=F;var r=W.tags.length;while(r-- >G){var J0=W.tag=W.tags.pop();W.tagName=W.tag.name,y(W,"onclosetag",W.tagName);var U0={};for(var Z0 in J0.ns)U0[Z0]=J0.ns[Z0];var m0=W.tags[W.tags.length-1]||W;if(W.opt.xmlns&&J0.ns!==m0.ns)Object.keys(J0.ns).forEach(function(V0){var u0=J0.ns[V0];y(W,"onclosenamespace",{prefix:V0,uri:u0})})}if(G===0)W.closedRoot=!0;W.tagName=W.attribValue=W.attribName="",W.attribList.length=0,W.state=L.TEXT}function W8(W){var G=W.entity,F=G.toLowerCase(),O,u="";if(W.ENTITIES[G])return W.ENTITIES[G];if(W.ENTITIES[F])return W.ENTITIES[F];if(G=F,G.charAt(0)==="#")if(G.charAt(1)==="x")G=G.slice(2),O=parseInt(G,16),u=O.toString(16);else G=G.slice(1),O=parseInt(G,10),u=O.toString(10);if(G=G.replace(/^0+/,""),isNaN(O)||u.toLowerCase()!==G||O<0||O>1114111||!qQ(O))return m(W,"Invalid character entity"),"&"+W.entity+";";return String.fromCodePoint(O)}function qQ(W){return W===9||W===10||W===13||W>=32&&W<=55295||W>=57344&&W<=65533||W>=65536&&W<=1114111}function U8(W,G){if(G==="<")W.state=L.OPEN_WAKA,W.startTagPosition=W.position;else if(!R(G))m(W,"Non-whitespace before first tag."),W.textNode=G,W.state=L.TEXT}function Z8(W,G){var F="";if(G<W.length)F=W.charAt(G);return F}function VQ(W){var G=this;if(this.error)throw this.error;if(G.closed)return Q0(G,"Cannot write after close. Assign an onready handler.");if(W===null)return $Q(G);if(typeof W==="object")W=W.toString();var F=0,O="";while(!0){if(O=Z8(W,F++),G.c=O,!O)break;if(G.trackPosition)if(G.position++,O===`
8
+ `)G.line++,G.column=0;else G.column++;switch(G.state){case L.BEGIN:if(G.state=L.BEGIN_WHITESPACE,O==="\uFEFF")continue;U8(G,O);continue;case L.BEGIN_WHITESPACE:U8(G,O);continue;case L.TEXT:if(G.sawRoot&&!G.closedRoot){var r=F-1;while(O&&O!=="<"&&O!=="&")if(O=Z8(W,F++),O&&G.trackPosition)if(G.position++,O===`
9
+ `)G.line++,G.column=0;else G.column++;G.textNode+=W.substring(r,F-1)}if(O==="<"&&!(G.sawRoot&&G.closedRoot&&!G.strict))G.state=L.OPEN_WAKA,G.startTagPosition=G.position;else{if(!R(O)&&(!G.sawRoot||G.closedRoot))m(G,"Text data outside of root node.");if(O==="&")G.state=L.TEXT_ENTITY;else G.textNode+=O}continue;case L.SCRIPT:if(O==="<")G.state=L.SCRIPT_ENDING;else G.script+=O;continue;case L.SCRIPT_ENDING:if(O==="/")G.state=L.CLOSE_TAG;else G.script+="<"+O,G.state=L.SCRIPT;continue;case L.OPEN_WAKA:if(O==="!")G.state=L.SGML_DECL,G.sgmlDecl="";else if(R(O));else if(w(C,O))G.state=L.OPEN_TAG,G.tagName=O;else if(O==="/")G.state=L.CLOSE_TAG,G.tagName="";else if(O==="?")G.state=L.PROC_INST,G.procInstName=G.procInstBody="";else{if(m(G,"Unencoded <"),G.startTagPosition+1<G.position){var u=G.position-G.startTagPosition;O=Array(u).join(" ")+O}G.textNode+="<"+O,G.state=L.TEXT}continue;case L.SGML_DECL:if(G.sgmlDecl+O==="--"){G.state=L.COMMENT,G.comment="",G.sgmlDecl="";continue}if(G.doctype&&G.doctype!==!0&&G.sgmlDecl)G.state=L.DOCTYPE_DTD,G.doctype+="<!"+G.sgmlDecl+O,G.sgmlDecl="";else if(B.test(G.sgmlDecl+O))y(G,"onopencdata"),G.state=L.CDATA,G.sgmlDecl="",G.cdata="";else if(P.test(G.sgmlDecl+O)){if(G.state=L.DOCTYPE,G.doctype||G.sawRoot)m(G,"Inappropriately located doctype declaration");G.doctype="",G.sgmlDecl=""}else if(O===">")y(G,"onsgmldeclaration",G.sgmlDecl),G.sgmlDecl="",G.state=L.TEXT;else if(D(O))G.state=L.SGML_DECL_QUOTED,G.sgmlDecl+=O;else G.sgmlDecl+=O;continue;case L.SGML_DECL_QUOTED:if(O===G.q)G.state=L.SGML_DECL,G.q="";G.sgmlDecl+=O;continue;case L.DOCTYPE:if(O===">")G.state=L.TEXT,y(G,"ondoctype",G.doctype),G.doctype=!0;else if(G.doctype+=O,O==="[")G.state=L.DOCTYPE_DTD;else if(D(O))G.state=L.DOCTYPE_QUOTED,G.q=O;continue;case L.DOCTYPE_QUOTED:if(G.doctype+=O,O===G.q)G.q="",G.state=L.DOCTYPE;continue;case L.DOCTYPE_DTD:if(O==="]")G.doctype+=O,G.state=L.DOCTYPE;else if(O==="<")G.state=L.OPEN_WAKA,G.startTagPosition=G.position;else if(D(O))G.doctype+=O,G.state=L.DOCTYPE_DTD_QUOTED,G.q=O;else G.doctype+=O;continue;case L.DOCTYPE_DTD_QUOTED:if(G.doctype+=O,O===G.q)G.state=L.DOCTYPE_DTD,G.q="";continue;case L.COMMENT:if(O==="-")G.state=L.COMMENT_ENDING;else G.comment+=O;continue;case L.COMMENT_ENDING:if(O==="-"){if(G.state=L.COMMENT_ENDED,G.comment=W0(G.opt,G.comment),G.comment)y(G,"oncomment",G.comment);G.comment=""}else G.comment+="-"+O,G.state=L.COMMENT;continue;case L.COMMENT_ENDED:if(O!==">")m(G,"Malformed comment"),G.comment+="--"+O,G.state=L.COMMENT;else if(G.doctype&&G.doctype!==!0)G.state=L.DOCTYPE_DTD;else G.state=L.TEXT;continue;case L.CDATA:var r=F-1;while(O&&O!=="]")if(O=Z8(W,F++),O&&G.trackPosition)if(G.position++,O===`
10
+ `)G.line++,G.column=0;else G.column++;if(G.cdata+=W.substring(r,F-1),O==="]")G.state=L.CDATA_ENDING;continue;case L.CDATA_ENDING:if(O==="]")G.state=L.CDATA_ENDING_2;else G.cdata+="]"+O,G.state=L.CDATA;continue;case L.CDATA_ENDING_2:if(O===">"){if(G.cdata)y(G,"oncdata",G.cdata);y(G,"onclosecdata"),G.cdata="",G.state=L.TEXT}else if(O==="]")G.cdata+="]";else G.cdata+="]]"+O,G.state=L.CDATA;continue;case L.PROC_INST:if(O==="?")G.state=L.PROC_INST_ENDING;else if(R(O))G.state=L.PROC_INST_BODY;else G.procInstName+=O;continue;case L.PROC_INST_BODY:if(!G.procInstBody&&R(O))continue;else if(O==="?")G.state=L.PROC_INST_ENDING;else G.procInstBody+=O;continue;case L.PROC_INST_ENDING:if(O===">"){let m0={name:G.procInstName,body:G.procInstBody};D0(G,m0),y(G,"onprocessinginstruction",m0),G.procInstName=G.procInstBody="",G.state=L.TEXT}else G.procInstBody+="?"+O,G.state=L.PROC_INST_BODY;continue;case L.OPEN_TAG:if(w(A,O))G.tagName+=O;else if(H8(G),O===">")B0(G);else if(O==="/")G.state=L.OPEN_TAG_SLASH;else{if(!R(O))m(G,"Invalid character in tag name");G.state=L.ATTRIB}continue;case L.OPEN_TAG_SLASH:if(O===">")B0(G,!0),U6(G);else m(G,"Forward-slash in opening tag not followed by >"),G.state=L.ATTRIB;continue;case L.ATTRIB:if(R(O))continue;else if(O===">")B0(G);else if(O==="/")G.state=L.OPEN_TAG_SLASH;else if(w(C,O))G.attribName=O,G.attribValue="",G.state=L.ATTRIB_NAME;else m(G,"Invalid attribute name");continue;case L.ATTRIB_NAME:if(O==="=")G.state=L.ATTRIB_VALUE;else if(O===">")m(G,"Attribute without value"),G.attribValue=G.attribName,E6(G),B0(G);else if(R(O))G.state=L.ATTRIB_NAME_SAW_WHITE;else if(w(A,O))G.attribName+=O;else m(G,"Invalid attribute name");continue;case L.ATTRIB_NAME_SAW_WHITE:if(O==="=")G.state=L.ATTRIB_VALUE;else if(R(O))continue;else if(m(G,"Attribute without value"),G.tag.attributes[G.attribName]="",G.attribValue="",y(G,"onattribute",{name:G.attribName,value:""}),G.attribName="",O===">")B0(G);else if(w(C,O))G.attribName=O,G.state=L.ATTRIB_NAME;else m(G,"Invalid attribute name"),G.state=L.ATTRIB;continue;case L.ATTRIB_VALUE:if(R(O))continue;else if(D(O))G.q=O,G.state=L.ATTRIB_VALUE_QUOTED;else{if(!G.opt.unquotedAttributeValues)Q0(G,"Unquoted attribute value");G.state=L.ATTRIB_VALUE_UNQUOTED,G.attribValue=O}continue;case L.ATTRIB_VALUE_QUOTED:if(O!==G.q){if(O==="&")G.state=L.ATTRIB_VALUE_ENTITY_Q;else G.attribValue+=O;continue}E6(G),G.q="",G.state=L.ATTRIB_VALUE_CLOSED;continue;case L.ATTRIB_VALUE_CLOSED:if(R(O))G.state=L.ATTRIB;else if(O===">")B0(G);else if(O==="/")G.state=L.OPEN_TAG_SLASH;else if(w(C,O))m(G,"No whitespace between attributes"),G.attribName=O,G.attribValue="",G.state=L.ATTRIB_NAME;else m(G,"Invalid attribute name");continue;case L.ATTRIB_VALUE_UNQUOTED:if(!x(O)){if(O==="&")G.state=L.ATTRIB_VALUE_ENTITY_U;else G.attribValue+=O;continue}if(E6(G),O===">")B0(G);else G.state=L.ATTRIB;continue;case L.CLOSE_TAG:if(!G.tagName)if(R(O))continue;else if(v(C,O))if(G.script)G.script+="</"+O,G.state=L.SCRIPT;else m(G,"Invalid tagname in closing tag.");else G.tagName=O;else if(O===">")U6(G);else if(w(A,O))G.tagName+=O;else if(G.script)G.script+="</"+G.tagName+O,G.tagName="",G.state=L.SCRIPT;else{if(!R(O))m(G,"Invalid tagname in closing tag");G.state=L.CLOSE_TAG_SAW_WHITE}continue;case L.CLOSE_TAG_SAW_WHITE:if(R(O))continue;if(O===">")U6(G);else m(G,"Invalid characters in closing tag");continue;case L.TEXT_ENTITY:case L.ATTRIB_VALUE_ENTITY_Q:case L.ATTRIB_VALUE_ENTITY_U:var J0,U0;switch(G.state){case L.TEXT_ENTITY:J0=L.TEXT,U0="textNode";break;case L.ATTRIB_VALUE_ENTITY_Q:J0=L.ATTRIB_VALUE_QUOTED,U0="attribValue";break;case L.ATTRIB_VALUE_ENTITY_U:J0=L.ATTRIB_VALUE_UNQUOTED,U0="attribValue";break}if(O===";"){var Z0=W8(G);if(G.opt.unparsedEntities&&!Object.values(Q.XML_ENTITIES).includes(Z0)){if((G.entityCount+=1)>G.opt.maxEntityCount)Q0(G,"Parsed entity count exceeds max entity count");if((G.entityDepth+=1)>G.opt.maxEntityDepth)Q0(G,"Parsed entity depth exceeds max entity depth");G.entity="",G.state=J0,G.write(Z0),G.entityDepth-=1}else G[U0]+=Z0,G.entity="",G.state=J0}else if(w(G.entity.length?T:M,O))G.entity+=O;else m(G,"Invalid character in entity name"),G[U0]+="&"+G.entity+O,G.entity="",G.state=J0;continue;default:throw Error(G,"Unknown state: "+G.state)}}if(G.position>=G.bufferCheckPosition)$(G);return G}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint)(function(){var W=String.fromCharCode,G=Math.floor,F=function(){var O=16384,u=[],r,J0,U0=-1,Z0=arguments.length;if(!Z0)return"";var m0="";while(++U0<Z0){var V0=Number(arguments[U0]);if(!isFinite(V0)||V0<0||V0>1114111||G(V0)!==V0)throw RangeError("Invalid code point: "+V0);if(V0<=65535)u.push(V0);else V0-=65536,r=(V0>>10)+55296,J0=V0%1024+56320,u.push(r,J0);if(U0+1===Z0||u.length>O)m0+=W.apply(null,u),u.length=0}return m0};if(Object.defineProperty)Object.defineProperty(String,"fromCodePoint",{value:F,configurable:!0,writable:!0});else String.fromCodePoint=F})()})(typeof KQ>"u"?KQ.sax={}:KQ)});import N$,{resolve as HX,basename as WX,extname as UX,dirname as ZX}from"node:path";import{EventEmitter as LX}from"events";function BX(...Q){return HX(...Q)}function OX(Q,J){return WX(Q,J)}function PX(Q){return UX(Q)}function jX(Q){return ZX(Q)}function zX(Q){return N$.posix.isAbsolute(Q)}function FX(...Q){return N$.posix.join(...Q)}function RX(Q){if(Q.charCodeAt(0)===65279)return Q.slice(1);return Q}function IX(Q){return Q.toLowerCase()}function MX(Q){return typeof Q==="object"&&Q!==null&&Object.keys(Q).length===0}function XQ(Q,J,Y){for(let $ of Q)J=$(J,Y);return J}function w6(Q,J,Y){let $=Object.create(null);$.value=Y,$.writable=!0,$.enumerable=!0,$.configurable=!0,Object.defineProperty(Q,J,$)}function AX(Q,J){let Y={};if(typeof J==="object")Y=J;return new R$(Y).parseStringPromise(Q)}async function v6(Q,J={}){return await AX(Q,J)}function GQ(Q){return Q.replace(/-([a-z])/gi,(J)=>J[1].toUpperCase())}var C$,t,NX,CX=(Q,J,Y)=>(J in Q)?NX(Q,J,{enumerable:!0,configurable:!0,writable:!0,value:Y}):Q[J]=Y,j0=(Q,J,Y)=>CX(Q,typeof J!=="symbol"?J+"":J,Y),F$,R$;var I$=UJ(()=>{C$=j$(z$(),1);t={resolve:BX,basename:OX,extname:PX,dirname:jX,isAbsolutePosix:zX,joinPosix:FX},NX=Object.defineProperty;F$={0.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},0.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
11
+ `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}};R$=class R$ extends LX{constructor(Q){super();if(j0(this,"options"),j0(this,"remaining",""),j0(this,"saxParser"),j0(this,"resultObject",null),j0(this,"EXPLICIT_CHARKEY"),j0(this,"errThrown",!1),j0(this,"ended",!1),j0(this,"processAsync",()=>{try{if(this.remaining.length<=this.options.chunkSize){let J=this.remaining;this.remaining="",this.saxParser=this.saxParser.write(J),this.saxParser.close()}else{let J=this.remaining.slice(0,this.options.chunkSize);this.remaining=this.remaining.slice(this.options.chunkSize),this.saxParser=this.saxParser.write(J),setTimeout(this.processAsync,0)}}catch(J){if(!this.errThrown)this.errThrown=!0,this.emit("error",J)}}),j0(this,"assignOrPush",(J,Y,$)=>{if(!(Y in J))if(!this.options.explicitArray)w6(J,Y,$);else w6(J,Y,[$]);else{if(!Array.isArray(J[Y]))w6(J,Y,[J[Y]]);J[Y].push($)}}),j0(this,"reset",()=>{this.removeAllListeners(),this.saxParser=C$.default.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.errThrown=!1,this.saxParser.onerror=(V)=>{if(this.saxParser.resume(),!this.errThrown)this.errThrown=!0,this.emit("error",V)},this.saxParser.onend=()=>{if(!this.ended)this.ended=!0,this.emit("end",this.resultObject)},this.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null;let J=[],Y=this.options.attrkey,$=this.options.charkey;this.saxParser.onopentag=(V)=>{let K={};if(K[$]="",!this.options.ignoreAttrs)Object.keys(V.attributes).forEach((X)=>{if(!(Y in K)&&!this.options.mergeAttrs)K[Y]={};let Z=this.options.attrValueProcessors?XQ(this.options.attrValueProcessors,V.attributes[X],X):V.attributes[X],H=this.options.attrNameProcessors?XQ(this.options.attrNameProcessors,X):X;if(this.options.mergeAttrs)this.assignOrPush(K,H,Z);else w6(K[Y],H,Z)});if(K["#name"]=this.options.tagNameProcessors?XQ(this.options.tagNameProcessors,V.name):V.name,this.options.xmlns)K[this.options.xmlnskey]={uri:V.uri,local:V.local};J.push(K)},this.saxParser.onclosetag=()=>{let V=J.pop(),K=V["#name"];if(!this.options.explicitChildren||!this.options.preserveChildrenOrder)delete V["#name"];let X;if(V.cdata===!0)X=V.cdata,delete V.cdata;let Z=J[J.length-1],H="";if(V[$].match(/^\s*$/)&&!X)H=V[$],delete V[$];else{if(this.options.trim)V[$]=V[$].trim();if(this.options.normalize)V[$]=V[$].replace(/\s{2,}/g," ").trim();if(V[$]=this.options.valueProcessors?XQ(this.options.valueProcessors,V[$],K):V[$],Object.keys(V).length===1&&$ in V&&!this.EXPLICIT_CHARKEY)V=V[$]}if(MX(V))if(typeof this.options.emptyTag==="function")V=this.options.emptyTag();else V=this.options.emptyTag!==""?this.options.emptyTag:H;if(this.options.validator){let U=`/${J.map((B)=>B["#name"]).concat(K).join("/")}`;(()=>{try{V=this.options.validator(U,Z&&Z[K],V)}catch(B){this.emit("error",B)}})()}if(this.options.explicitChildren&&!this.options.mergeAttrs&&typeof V==="object"){if(!this.options.preserveChildrenOrder){let U={};if(this.options.attrkey in V)U[this.options.attrkey]=V[this.options.attrkey],delete V[this.options.attrkey];if(!this.options.charsAsChildren&&this.options.charkey in V)U[this.options.charkey]=V[this.options.charkey],delete V[this.options.charkey];if(Object.getOwnPropertyNames(V).length>0)U[this.options.childkey]=V;V=U}else if(Z){Z[this.options.childkey]=Z[this.options.childkey]||[];let U={};if(Object.keys(V).forEach((B)=>{w6(U,B,V[B])}),Z[this.options.childkey].push(U),delete V["#name"],Object.keys(V).length===1&&$ in V&&!this.EXPLICIT_CHARKEY)V=V[$]}}if(J.length>0)this.assignOrPush(Z,K,V);else{if(this.options.explicitRoot){let U=V,B={};w6(B,K,U),V=B}this.resultObject=V,this.ended=!0,this.emit("end",this.resultObject)}};let q=(V)=>{let K=J[J.length-1];if(K){if(K[$]+=V,this.options.explicitChildren&&this.options.preserveChildrenOrder&&this.options.charsAsChildren&&(this.options.includeWhiteChars||V.replace(/\\n/g,"").trim()!=="")){K[this.options.childkey]=K[this.options.childkey]||[];let X={"#name":"__text__"};if(X[$]=V,this.options.normalize)X[$]=X[$].replace(/\s{2,}/g," ").trim();K[this.options.childkey].push(X)}}return K};this.saxParser.ontext=q,this.saxParser.oncdata=(V)=>{let K=q(V);if(K)K.cdata=!0}}),j0(this,"parseString",(J,Y)=>{if(Y&&typeof Y==="function")this.on("end",($)=>{this.reset(),Y(null,$)}),this.on("error",($)=>{this.reset(),Y($)});try{if(J=J.toString(),J.trim()==="")return this.emit("end",null),!0;if(J=RX(J),this.options.async)return this.remaining=J,setTimeout(this.processAsync,0),this.saxParser;return this.saxParser.write(J).close()}catch($){if(!this.errThrown&&!this.ended)this.emit("error",$),this.errThrown=!0;else if(this.ended)throw $}}),j0(this,"parseStringPromise",(J)=>{return new Promise((Y,$)=>{this.parseString(J,(q,V)=>{if(q)$(q);else Y(V)})})}),this.options={},Object.keys(F$["0.2"]).forEach((J)=>{this.options[J]=F$["0.2"][J]}),Q)Object.keys(Q).forEach((J)=>{this.options[J]=Q[J]});if(this.options.xmlns)this.options.xmlnskey=`${this.options.attrkey}ns`;if(this.options.normalizeTags){if(!this.options.tagNameProcessors)this.options.tagNameProcessors=[];this.options.tagNameProcessors.unshift(IX)}this.reset()}}});var L8=E((aZ,LJ)=>{if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)LJ.exports={nextTick:TX};else LJ.exports=process;function TX(Q,J,Y,$){if(typeof Q!=="function")throw TypeError('"callback" argument must be a function');var q=arguments.length,V,K;switch(q){case 0:case 1:return process.nextTick(Q);case 2:return process.nextTick(function(){Q.call(null,J)});case 3:return process.nextTick(function(){Q.call(null,J,Y)});case 4:return process.nextTick(function(){Q.call(null,J,Y,$)});default:V=Array(q-1),K=0;while(K<V.length)V[K++]=arguments[K];return process.nextTick(function(){Q.apply(null,V)})}}});var A$=E((sZ,M$)=>{var DX={}.toString;M$.exports=Array.isArray||function(Q){return DX.call(Q)=="[object Array]"}});var B8=E((BJ,D$)=>{var HQ=a("buffer"),p0=HQ.Buffer;function T$(Q,J){for(var Y in Q)J[Y]=Q[Y]}if(p0.from&&p0.alloc&&p0.allocUnsafe&&p0.allocUnsafeSlow)D$.exports=HQ;else T$(HQ,BJ),BJ.Buffer=x6;function x6(Q,J,Y){return p0(Q,J,Y)}T$(p0,x6);x6.from=function(Q,J,Y){if(typeof Q==="number")throw TypeError("Argument must not be a number");return p0(Q,J,Y)};x6.alloc=function(Q,J,Y){if(typeof Q!=="number")throw TypeError("Argument must be a number");var $=p0(Q);if(J!==void 0)if(typeof Y==="string")$.fill(J,Y);else $.fill(J);else $.fill(0);return $};x6.allocUnsafe=function(Q){if(typeof Q!=="number")throw TypeError("Argument must be a number");return p0(Q)};x6.allocUnsafeSlow=function(Q){if(typeof Q!=="number")throw TypeError("Argument must be a number");return HQ.SlowBuffer(Q)}});var S6=E((cX)=>{function EX(Q){if(Array.isArray)return Array.isArray(Q);return WQ(Q)==="[object Array]"}cX.isArray=EX;function wX(Q){return typeof Q==="boolean"}cX.isBoolean=wX;function vX(Q){return Q===null}cX.isNull=vX;function xX(Q){return Q==null}cX.isNullOrUndefined=xX;function SX(Q){return typeof Q==="number"}cX.isNumber=SX;function kX(Q){return typeof Q==="string"}cX.isString=kX;function yX(Q){return typeof Q==="symbol"}cX.isSymbol=yX;function gX(Q){return Q===void 0}cX.isUndefined=gX;function hX(Q){return WQ(Q)==="[object RegExp]"}cX.isRegExp=hX;function _X(Q){return typeof Q==="object"&&Q!==null}cX.isObject=_X;function bX(Q){return WQ(Q)==="[object Date]"}cX.isDate=bX;function fX(Q){return WQ(Q)==="[object Error]"||Q instanceof Error}cX.isError=fX;function mX(Q){return typeof Q==="function"}cX.isFunction=mX;function uX(Q){return Q===null||typeof Q==="boolean"||typeof Q==="number"||typeof Q==="string"||typeof Q==="symbol"||typeof Q>"u"}cX.isPrimitive=uX;cX.isBuffer=a("buffer").Buffer.isBuffer;function WQ(Q){return Object.prototype.toString.call(Q)}});var E$=E((eZ,OJ)=>{if(typeof Object.create==="function")OJ.exports=function(J,Y){if(Y)J.super_=Y,J.prototype=Object.create(Y.prototype,{constructor:{value:J,enumerable:!1,writable:!0,configurable:!0}})};else OJ.exports=function(J,Y){if(Y){J.super_=Y;var $=function(){};$.prototype=Y.prototype,J.prototype=new $,J.prototype.constructor=J}}});var k6=E((QL,PJ)=>{try{if(UQ=a("util"),typeof UQ.inherits!=="function")throw"";PJ.exports=UQ.inherits}catch(Q){PJ.exports=E$()}var UQ});var v$=E((JL,jJ)=>{function q4(Q,J){if(!(Q instanceof J))throw TypeError("Cannot call a class as a function")}var w$=B8().Buffer,O8=a("util");function V4(Q,J,Y){Q.copy(J,Y)}jJ.exports=function(){function Q(){q4(this,Q),this.head=null,this.tail=null,this.length=0}return Q.prototype.push=function(Y){var $={data:Y,next:null};if(this.length>0)this.tail.next=$;else this.head=$;this.tail=$,++this.length},Q.prototype.unshift=function(Y){var $={data:Y,next:this.head};if(this.length===0)this.tail=$;this.head=$,++this.length},Q.prototype.shift=function(){if(this.length===0)return;var Y=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,Y},Q.prototype.clear=function(){this.head=this.tail=null,this.length=0},Q.prototype.join=function(Y){if(this.length===0)return"";var $=this.head,q=""+$.data;while($=$.next)q+=Y+$.data;return q},Q.prototype.concat=function(Y){if(this.length===0)return w$.alloc(0);var $=w$.allocUnsafe(Y>>>0),q=this.head,V=0;while(q)V4(q.data,$,V),V+=q.data.length,q=q.next;return $},Q}();if(O8&&O8.inspect&&O8.inspect.custom)jJ.exports.prototype[O8.inspect.custom]=function(){var Q=O8.inspect({length:this.length});return this.constructor.name+" "+Q}});var zJ=E((YL,x$)=>{var ZQ=L8();function K4(Q,J){var Y=this,$=this._readableState&&this._readableState.destroyed,q=this._writableState&&this._writableState.destroyed;if($||q){if(J)J(Q);else if(Q){if(!this._writableState)ZQ.nextTick(LQ,this,Q);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,ZQ.nextTick(LQ,this,Q)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(Q||null,function(V){if(!J&&V){if(!Y._writableState)ZQ.nextTick(LQ,Y,V);else if(!Y._writableState.errorEmitted)Y._writableState.errorEmitted=!0,ZQ.nextTick(LQ,Y,V)}else if(J)J(V)}),this}function X4(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(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 LQ(Q,J){Q.emit("error",J)}x$.exports={destroy:K4,undestroy:X4}});var k$=E(($L,S$)=>{S$.exports=a("util").deprecate});var NJ=E((qL,u$)=>{var Z6=L8();u$.exports=e;function g$(Q){var J=this;this.next=null,this.entry=null,this.finish=function(){A4(J,Q)}}var G4=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Z6.nextTick,y6;e.WritableState=j8;var h$=Object.create(S6());h$.inherits=k6();var H4={deprecate:k$()},_$=a("stream"),OQ=B8().Buffer,W4=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function U4(Q){return OQ.from(Q)}function Z4(Q){return OQ.isBuffer(Q)||Q instanceof W4}var b$=zJ();h$.inherits(e,_$);function L4(){}function j8(Q,J){y6=y6||L6(),Q=Q||{};var Y=J instanceof y6;if(this.objectMode=!!Q.objectMode,Y)this.objectMode=this.objectMode||!!Q.writableObjectMode;var{highWaterMark:$,writableHighWaterMark:q}=Q,V=this.objectMode?16:16384;if($||$===0)this.highWaterMark=$;else if(Y&&(q||q===0))this.highWaterMark=q;else this.highWaterMark=V;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 K=Q.decodeStrings===!1;this.decodeStrings=!K,this.defaultEncoding=Q.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(X){N4(J,X)},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 g$(this)}j8.prototype.getBuffer=function(){var J=this.bufferedRequest,Y=[];while(J)Y.push(J),J=J.next;return Y};(function(){try{Object.defineProperty(j8.prototype,"buffer",{get:H4.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(Q){}})();var BQ;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")BQ=Function.prototype[Symbol.hasInstance],Object.defineProperty(e,Symbol.hasInstance,{value:function(Q){if(BQ.call(this,Q))return!0;if(this!==e)return!1;return Q&&Q._writableState instanceof j8}});else BQ=function(Q){return Q instanceof this};function e(Q){if(y6=y6||L6(),!BQ.call(e,this)&&!(this instanceof y6))return new e(Q);if(this._writableState=new j8(Q,this),this.writable=!0,Q){if(typeof Q.write==="function")this._write=Q.write;if(typeof Q.writev==="function")this._writev=Q.writev;if(typeof Q.destroy==="function")this._destroy=Q.destroy;if(typeof Q.final==="function")this._final=Q.final}_$.call(this)}e.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function B4(Q,J){var Y=Error("write after end");Q.emit("error",Y),Z6.nextTick(J,Y)}function O4(Q,J,Y,$){var q=!0,V=!1;if(Y===null)V=TypeError("May not write null values to stream");else if(typeof Y!=="string"&&Y!==void 0&&!J.objectMode)V=TypeError("Invalid non-string/buffer chunk");if(V)Q.emit("error",V),Z6.nextTick($,V),q=!1;return q}e.prototype.write=function(Q,J,Y){var $=this._writableState,q=!1,V=!$.objectMode&&Z4(Q);if(V&&!OQ.isBuffer(Q))Q=U4(Q);if(typeof J==="function")Y=J,J=null;if(V)J="buffer";else if(!J)J=$.defaultEncoding;if(typeof Y!=="function")Y=L4;if($.ended)B4(this,Y);else if(V||O4(this,$,Q,Y))$.pendingcb++,q=j4(this,$,V,Q,J,Y);return q};e.prototype.cork=function(){var Q=this._writableState;Q.corked++};e.prototype.uncork=function(){var Q=this._writableState;if(Q.corked){if(Q.corked--,!Q.writing&&!Q.corked&&!Q.bufferProcessing&&Q.bufferedRequest)f$(this,Q)}};e.prototype.setDefaultEncoding=function(J){if(typeof J==="string")J=J.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((J+"").toLowerCase())>-1))throw TypeError("Unknown encoding: "+J);return this._writableState.defaultEncoding=J,this};function P4(Q,J,Y){if(!Q.objectMode&&Q.decodeStrings!==!1&&typeof J==="string")J=OQ.from(J,Y);return J}Object.defineProperty(e.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function j4(Q,J,Y,$,q,V){if(!Y){var K=P4(J,$,q);if($!==K)Y=!0,q="buffer",$=K}var X=J.objectMode?1:$.length;J.length+=X;var Z=J.length<J.highWaterMark;if(!Z)J.needDrain=!0;if(J.writing||J.corked){var H=J.lastBufferedRequest;if(J.lastBufferedRequest={chunk:$,encoding:q,isBuf:Y,callback:V,next:null},H)H.next=J.lastBufferedRequest;else J.bufferedRequest=J.lastBufferedRequest;J.bufferedRequestCount+=1}else FJ(Q,J,!1,X,$,q,V);return Z}function FJ(Q,J,Y,$,q,V,K){if(J.writelen=$,J.writecb=K,J.writing=!0,J.sync=!0,Y)Q._writev(q,J.onwrite);else Q._write(q,V,J.onwrite);J.sync=!1}function z4(Q,J,Y,$,q){if(--J.pendingcb,Y)Z6.nextTick(q,$),Z6.nextTick(P8,Q,J),Q._writableState.errorEmitted=!0,Q.emit("error",$);else q($),Q._writableState.errorEmitted=!0,Q.emit("error",$),P8(Q,J)}function F4(Q){Q.writing=!1,Q.writecb=null,Q.length-=Q.writelen,Q.writelen=0}function N4(Q,J){var Y=Q._writableState,$=Y.sync,q=Y.writecb;if(F4(Y),J)z4(Q,Y,$,J,q);else{var V=m$(Y);if(!V&&!Y.corked&&!Y.bufferProcessing&&Y.bufferedRequest)f$(Q,Y);if($)G4(y$,Q,Y,V,q);else y$(Q,Y,V,q)}}function y$(Q,J,Y,$){if(!Y)C4(Q,J);J.pendingcb--,$(),P8(Q,J)}function C4(Q,J){if(J.length===0&&J.needDrain)J.needDrain=!1,Q.emit("drain")}function f$(Q,J){J.bufferProcessing=!0;var Y=J.bufferedRequest;if(Q._writev&&Y&&Y.next){var $=J.bufferedRequestCount,q=Array($),V=J.corkedRequestsFree;V.entry=Y;var K=0,X=!0;while(Y){if(q[K]=Y,!Y.isBuf)X=!1;Y=Y.next,K+=1}if(q.allBuffers=X,FJ(Q,J,!0,J.length,q,"",V.finish),J.pendingcb++,J.lastBufferedRequest=null,V.next)J.corkedRequestsFree=V.next,V.next=null;else J.corkedRequestsFree=new g$(J);J.bufferedRequestCount=0}else{while(Y){var{chunk:Z,encoding:H,callback:U}=Y,B=J.objectMode?1:Z.length;if(FJ(Q,J,!1,B,Z,H,U),Y=Y.next,J.bufferedRequestCount--,J.writing)break}if(Y===null)J.lastBufferedRequest=null}J.bufferedRequest=Y,J.bufferProcessing=!1}e.prototype._write=function(Q,J,Y){Y(Error("_write() is not implemented"))};e.prototype._writev=null;e.prototype.end=function(Q,J,Y){var $=this._writableState;if(typeof Q==="function")Y=Q,Q=null,J=null;else if(typeof J==="function")Y=J,J=null;if(Q!==null&&Q!==void 0)this.write(Q,J);if($.corked)$.corked=1,this.uncork();if(!$.ending)M4(this,$,Y)};function m$(Q){return Q.ending&&Q.length===0&&Q.bufferedRequest===null&&!Q.finished&&!Q.writing}function R4(Q,J){Q._final(function(Y){if(J.pendingcb--,Y)Q.emit("error",Y);J.prefinished=!0,Q.emit("prefinish"),P8(Q,J)})}function I4(Q,J){if(!J.prefinished&&!J.finalCalled)if(typeof Q._final==="function")J.pendingcb++,J.finalCalled=!0,Z6.nextTick(R4,Q,J);else J.prefinished=!0,Q.emit("prefinish")}function P8(Q,J){var Y=m$(J);if(Y){if(I4(Q,J),J.pendingcb===0)J.finished=!0,Q.emit("finish")}return Y}function M4(Q,J,Y){if(J.ending=!0,P8(Q,J),Y)if(J.finished)Z6.nextTick(Y);else Q.once("finish",Y);J.ended=!0,Q.writable=!1}function A4(Q,J,Y){var $=Q.entry;Q.entry=null;while($){var q=$.callback;J.pendingcb--,q(Y),$=$.next}J.corkedRequestsFree.next=Q}Object.defineProperty(e.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function(Q){if(!this._writableState)return;this._writableState.destroyed=Q}});e.prototype.destroy=b$.destroy;e.prototype._undestroy=b$.undestroy;e.prototype._destroy=function(Q,J){this.end(),J(Q)}});var L6=E((VL,d$)=>{var c$=L8(),T4=Object.keys||function(Q){var J=[];for(var Y in Q)J.push(Y);return J};d$.exports=l0;var p$=Object.create(S6());p$.inherits=k6();var l$=RJ(),CJ=NJ();p$.inherits(l0,l$);{PQ=T4(CJ.prototype);for(z8=0;z8<PQ.length;z8++)if(F8=PQ[z8],!l0.prototype[F8])l0.prototype[F8]=CJ.prototype[F8]}var PQ,F8,z8;function l0(Q){if(!(this instanceof l0))return new l0(Q);if(l$.call(this,Q),CJ.call(this,Q),Q&&Q.readable===!1)this.readable=!1;if(Q&&Q.writable===!1)this.writable=!1;if(this.allowHalfOpen=!0,Q&&Q.allowHalfOpen===!1)this.allowHalfOpen=!1;this.once("end",D4)}Object.defineProperty(l0.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function D4(){if(this.allowHalfOpen||this._writableState.ended)return;c$.nextTick(E4,this)}function E4(Q){Q.end()}Object.defineProperty(l0.prototype,"destroyed",{get:function(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set:function(Q){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=Q,this._writableState.destroyed=Q}});l0.prototype._destroy=function(Q,J){this.push(null),this.end(),c$.nextTick(J,Q)}});var AJ=E((c4)=>{var MJ=B8().Buffer,o$=MJ.isEncoding||function(Q){switch(Q=""+Q,Q&&Q.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 w4(Q){if(!Q)return"utf8";var J;while(!0)switch(Q){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 Q;default:if(J)return;Q=(""+Q).toLowerCase(),J=!0}}function v4(Q){var J=w4(Q);if(typeof J!=="string"&&(MJ.isEncoding===o$||!o$(Q)))throw Error("Unknown encoding: "+Q);return J||Q}c4.StringDecoder=N8;function N8(Q){this.encoding=v4(Q);var J;switch(this.encoding){case"utf16le":this.text=h4,this.end=_4,J=4;break;case"utf8":this.fillLast=k4,J=4;break;case"base64":this.text=b4,this.end=f4,J=3;break;default:this.write=m4,this.end=u4;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=MJ.allocUnsafe(J)}N8.prototype.write=function(Q){if(Q.length===0)return"";var J,Y;if(this.lastNeed){if(J=this.fillLast(Q),J===void 0)return"";Y=this.lastNeed,this.lastNeed=0}else Y=0;if(Y<Q.length)return J?J+this.text(Q,Y):this.text(Q,Y);return J||""};N8.prototype.end=g4;N8.prototype.text=y4;N8.prototype.fillLast=function(Q){if(this.lastNeed<=Q.length)return Q.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);Q.copy(this.lastChar,this.lastTotal-this.lastNeed,0,Q.length),this.lastNeed-=Q.length};function IJ(Q){if(Q<=127)return 0;else if(Q>>5===6)return 2;else if(Q>>4===14)return 3;else if(Q>>3===30)return 4;return Q>>6===2?-1:-2}function x4(Q,J,Y){var $=J.length-1;if($<Y)return 0;var q=IJ(J[$]);if(q>=0){if(q>0)Q.lastNeed=q-1;return q}if(--$<Y||q===-2)return 0;if(q=IJ(J[$]),q>=0){if(q>0)Q.lastNeed=q-2;return q}if(--$<Y||q===-2)return 0;if(q=IJ(J[$]),q>=0){if(q>0)if(q===2)q=0;else Q.lastNeed=q-3;return q}return 0}function S4(Q,J,Y){if((J[0]&192)!==128)return Q.lastNeed=0,"�";if(Q.lastNeed>1&&J.length>1){if((J[1]&192)!==128)return Q.lastNeed=1,"�";if(Q.lastNeed>2&&J.length>2){if((J[2]&192)!==128)return Q.lastNeed=2,"�"}}}function k4(Q){var J=this.lastTotal-this.lastNeed,Y=S4(this,Q,J);if(Y!==void 0)return Y;if(this.lastNeed<=Q.length)return Q.copy(this.lastChar,J,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);Q.copy(this.lastChar,J,0,Q.length),this.lastNeed-=Q.length}function y4(Q,J){var Y=x4(this,Q,J);if(!this.lastNeed)return Q.toString("utf8",J);this.lastTotal=Y;var $=Q.length-(Y-this.lastNeed);return Q.copy(this.lastChar,0,$),Q.toString("utf8",J,$)}function g4(Q){var J=Q&&Q.length?this.write(Q):"";if(this.lastNeed)return J+"�";return J}function h4(Q,J){if((Q.length-J)%2===0){var Y=Q.toString("utf16le",J);if(Y){var $=Y.charCodeAt(Y.length-1);if($>=55296&&$<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=Q[Q.length-2],this.lastChar[1]=Q[Q.length-1],Y.slice(0,-1)}return Y}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=Q[Q.length-1],Q.toString("utf16le",J,Q.length-1)}function _4(Q){var J=Q&&Q.length?this.write(Q):"";if(this.lastNeed){var Y=this.lastTotal-this.lastNeed;return J+this.lastChar.toString("utf16le",0,Y)}return J}function b4(Q,J){var Y=(Q.length-J)%3;if(Y===0)return Q.toString("base64",J);if(this.lastNeed=3-Y,this.lastTotal=3,Y===1)this.lastChar[0]=Q[Q.length-1];else this.lastChar[0]=Q[Q.length-2],this.lastChar[1]=Q[Q.length-1];return Q.toString("base64",J,Q.length-Y)}function f4(Q){var J=Q&&Q.length?this.write(Q):"";if(this.lastNeed)return J+this.lastChar.toString("base64",0,3-this.lastNeed);return J}function m4(Q){return Q.toString(this.encoding)}function u4(Q){return Q&&Q.length?this.write(Q):""}});var RJ=E((GL,q5)=>{var h6=L8();q5.exports=l;var l4=A$(),C8;l.ReadableState=e$;var XL=a("events").EventEmitter,a$=function(Q,J){return Q.listeners(J).length},vJ=a("stream"),R8=B8().Buffer,d4=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o4(Q){return R8.from(Q)}function n4(Q){return R8.isBuffer(Q)||Q instanceof d4}var s$=Object.create(S6());s$.inherits=k6();var TJ=a("util"),f=void 0;if(TJ&&TJ.debuglog)f=TJ.debuglog("stream");else f=function(){};var i4=v$(),t$=zJ(),g6;s$.inherits(l,vJ);var DJ=["error","close","destroy","pause","resume"];function r4(Q,J,Y){if(typeof Q.prependListener==="function")return Q.prependListener(J,Y);if(!Q._events||!Q._events[J])Q.on(J,Y);else if(l4(Q._events[J]))Q._events[J].unshift(Y);else Q._events[J]=[Y,Q._events[J]]}function e$(Q,J){C8=C8||L6(),Q=Q||{};var Y=J instanceof C8;if(this.objectMode=!!Q.objectMode,Y)this.objectMode=this.objectMode||!!Q.readableObjectMode;var{highWaterMark:$,readableHighWaterMark:q}=Q,V=this.objectMode?16:16384;if($||$===0)this.highWaterMark=$;else if(Y&&(q||q===0))this.highWaterMark=q;else this.highWaterMark=V;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new i4,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=Q.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,Q.encoding){if(!g6)g6=AJ().StringDecoder;this.decoder=new g6(Q.encoding),this.encoding=Q.encoding}}function l(Q){if(C8=C8||L6(),!(this instanceof l))return new l(Q);if(this._readableState=new e$(Q,this),this.readable=!0,Q){if(typeof Q.read==="function")this._read=Q.read;if(typeof Q.destroy==="function")this._destroy=Q.destroy}vJ.call(this)}Object.defineProperty(l.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(Q){if(!this._readableState)return;this._readableState.destroyed=Q}});l.prototype.destroy=t$.destroy;l.prototype._undestroy=t$.undestroy;l.prototype._destroy=function(Q,J){this.push(null),J(Q)};l.prototype.push=function(Q,J){var Y=this._readableState,$;if(!Y.objectMode){if(typeof Q==="string"){if(J=J||Y.defaultEncoding,J!==Y.encoding)Q=R8.from(Q,J),J="";$=!0}}else $=!0;return Q5(this,Q,J,!1,$)};l.prototype.unshift=function(Q){return Q5(this,Q,null,!0,!1)};function Q5(Q,J,Y,$,q){var V=Q._readableState;if(J===null)V.reading=!1,e4(Q,V);else{var K;if(!q)K=a4(V,J);if(K)Q.emit("error",K);else if(V.objectMode||J&&J.length>0){if(typeof J!=="string"&&!V.objectMode&&Object.getPrototypeOf(J)!==R8.prototype)J=o4(J);if($)if(V.endEmitted)Q.emit("error",Error("stream.unshift() after end event"));else EJ(Q,V,J,!0);else if(V.ended)Q.emit("error",Error("stream.push() after EOF"));else if(V.reading=!1,V.decoder&&!Y)if(J=V.decoder.write(J),V.objectMode||J.length!==0)EJ(Q,V,J,!1);else J5(Q,V);else EJ(Q,V,J,!1)}else if(!$)V.reading=!1}return s4(V)}function EJ(Q,J,Y,$){if(J.flowing&&J.length===0&&!J.sync)Q.emit("data",Y),Q.read(0);else{if(J.length+=J.objectMode?1:Y.length,$)J.buffer.unshift(Y);else J.buffer.push(Y);if(J.needReadable)jQ(Q)}J5(Q,J)}function a4(Q,J){var Y;if(!n4(J)&&typeof J!=="string"&&J!==void 0&&!Q.objectMode)Y=TypeError("Invalid non-string/buffer chunk");return Y}function s4(Q){return!Q.ended&&(Q.needReadable||Q.length<Q.highWaterMark||Q.length===0)}l.prototype.isPaused=function(){return this._readableState.flowing===!1};l.prototype.setEncoding=function(Q){if(!g6)g6=AJ().StringDecoder;return this._readableState.decoder=new g6(Q),this._readableState.encoding=Q,this};var n$=8388608;function t4(Q){if(Q>=n$)Q=n$;else Q--,Q|=Q>>>1,Q|=Q>>>2,Q|=Q>>>4,Q|=Q>>>8,Q|=Q>>>16,Q++;return Q}function i$(Q,J){if(Q<=0||J.length===0&&J.ended)return 0;if(J.objectMode)return 1;if(Q!==Q)if(J.flowing&&J.length)return J.buffer.head.data.length;else return J.length;if(Q>J.highWaterMark)J.highWaterMark=t4(Q);if(Q<=J.length)return Q;if(!J.ended)return J.needReadable=!0,0;return J.length}l.prototype.read=function(Q){f("read",Q),Q=parseInt(Q,10);var J=this._readableState,Y=Q;if(Q!==0)J.emittedReadable=!1;if(Q===0&&J.needReadable&&(J.length>=J.highWaterMark||J.ended)){if(f("read: emitReadable",J.length,J.ended),J.length===0&&J.ended)wJ(this);else jQ(this);return null}if(Q=i$(Q,J),Q===0&&J.ended){if(J.length===0)wJ(this);return null}var $=J.needReadable;if(f("need readable",$),J.length===0||J.length-Q<J.highWaterMark)$=!0,f("length less than watermark",$);if(J.ended||J.reading)$=!1,f("reading or ended",$);else if($){if(f("do read"),J.reading=!0,J.sync=!0,J.length===0)J.needReadable=!0;if(this._read(J.highWaterMark),J.sync=!1,!J.reading)Q=i$(Y,J)}var q;if(Q>0)q=Y5(Q,J);else q=null;if(q===null)J.needReadable=!0,Q=0;else J.length-=Q;if(J.length===0){if(!J.ended)J.needReadable=!0;if(Y!==Q&&J.ended)wJ(this)}if(q!==null)this.emit("data",q);return q};function e4(Q,J){if(J.ended)return;if(J.decoder){var Y=J.decoder.end();if(Y&&Y.length)J.buffer.push(Y),J.length+=J.objectMode?1:Y.length}J.ended=!0,jQ(Q)}function jQ(Q){var J=Q._readableState;if(J.needReadable=!1,!J.emittedReadable)if(f("emitReadable",J.flowing),J.emittedReadable=!0,J.sync)h6.nextTick(r$,Q);else r$(Q)}function r$(Q){f("emit readable"),Q.emit("readable"),xJ(Q)}function J5(Q,J){if(!J.readingMore)J.readingMore=!0,h6.nextTick(Q1,Q,J)}function Q1(Q,J){var Y=J.length;while(!J.reading&&!J.flowing&&!J.ended&&J.length<J.highWaterMark)if(f("maybeReadMore read 0"),Q.read(0),Y===J.length)break;else Y=J.length;J.readingMore=!1}l.prototype._read=function(Q){this.emit("error",Error("_read() is not implemented"))};l.prototype.pipe=function(Q,J){var Y=this,$=this._readableState;switch($.pipesCount){case 0:$.pipes=Q;break;case 1:$.pipes=[$.pipes,Q];break;default:$.pipes.push(Q);break}$.pipesCount+=1,f("pipe count=%d opts=%j",$.pipesCount,J);var q=(!J||J.end!==!1)&&Q!==process.stdout&&Q!==process.stderr,V=q?X:C;if($.endEmitted)h6.nextTick(V);else Y.once("end",V);Q.on("unpipe",K);function K(A,M){if(f("onunpipe"),A===Y){if(M&&M.hasUnpiped===!1)M.hasUnpiped=!0,U()}}function X(){f("onend"),Q.end()}var Z=J1(Y);Q.on("drain",Z);var H=!1;function U(){if(f("cleanup"),Q.removeListener("close",N),Q.removeListener("finish",j),Q.removeListener("drain",Z),Q.removeListener("error",z),Q.removeListener("unpipe",K),Y.removeListener("end",X),Y.removeListener("end",C),Y.removeListener("data",P),H=!0,$.awaitDrain&&(!Q._writableState||Q._writableState.needDrain))Z()}var B=!1;Y.on("data",P);function P(A){f("ondata"),B=!1;var M=Q.write(A);if(M===!1&&!B){if(($.pipesCount===1&&$.pipes===Q||$.pipesCount>1&&$5($.pipes,Q)!==-1)&&!H)f("false write response, pause",$.awaitDrain),$.awaitDrain++,B=!0;Y.pause()}}function z(A){if(f("onerror",A),C(),Q.removeListener("error",z),a$(Q,"error")===0)Q.emit("error",A)}r4(Q,"error",z);function N(){Q.removeListener("finish",j),C()}Q.once("close",N);function j(){f("onfinish"),Q.removeListener("close",N),C()}Q.once("finish",j);function C(){f("unpipe"),Y.unpipe(Q)}if(Q.emit("pipe",Y),!$.flowing)f("pipe resume"),Y.resume();return Q};function J1(Q){return function(){var J=Q._readableState;if(f("pipeOnDrain",J.awaitDrain),J.awaitDrain)J.awaitDrain--;if(J.awaitDrain===0&&a$(Q,"data"))J.flowing=!0,xJ(Q)}}l.prototype.unpipe=function(Q){var J=this._readableState,Y={hasUnpiped:!1};if(J.pipesCount===0)return this;if(J.pipesCount===1){if(Q&&Q!==J.pipes)return this;if(!Q)Q=J.pipes;if(J.pipes=null,J.pipesCount=0,J.flowing=!1,Q)Q.emit("unpipe",this,Y);return this}if(!Q){var{pipes:$,pipesCount:q}=J;J.pipes=null,J.pipesCount=0,J.flowing=!1;for(var V=0;V<q;V++)$[V].emit("unpipe",this,{hasUnpiped:!1});return this}var K=$5(J.pipes,Q);if(K===-1)return this;if(J.pipes.splice(K,1),J.pipesCount-=1,J.pipesCount===1)J.pipes=J.pipes[0];return Q.emit("unpipe",this,Y),this};l.prototype.on=function(Q,J){var Y=vJ.prototype.on.call(this,Q,J);if(Q==="data"){if(this._readableState.flowing!==!1)this.resume()}else if(Q==="readable"){var $=this._readableState;if(!$.endEmitted&&!$.readableListening){if($.readableListening=$.needReadable=!0,$.emittedReadable=!1,!$.reading)h6.nextTick(Y1,this);else if($.length)jQ(this)}}return Y};l.prototype.addListener=l.prototype.on;function Y1(Q){f("readable nexttick read 0"),Q.read(0)}l.prototype.resume=function(){var Q=this._readableState;if(!Q.flowing)f("resume"),Q.flowing=!0,$1(this,Q);return this};function $1(Q,J){if(!J.resumeScheduled)J.resumeScheduled=!0,h6.nextTick(q1,Q,J)}function q1(Q,J){if(!J.reading)f("resume read 0"),Q.read(0);if(J.resumeScheduled=!1,J.awaitDrain=0,Q.emit("resume"),xJ(Q),J.flowing&&!J.reading)Q.read(0)}l.prototype.pause=function(){if(f("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)f("pause"),this._readableState.flowing=!1,this.emit("pause");return this};function xJ(Q){var J=Q._readableState;f("flow",J.flowing);while(J.flowing&&Q.read()!==null);}l.prototype.wrap=function(Q){var J=this,Y=this._readableState,$=!1;Q.on("end",function(){if(f("wrapped end"),Y.decoder&&!Y.ended){var K=Y.decoder.end();if(K&&K.length)J.push(K)}J.push(null)}),Q.on("data",function(K){if(f("wrapped data"),Y.decoder)K=Y.decoder.write(K);if(Y.objectMode&&(K===null||K===void 0))return;else if(!Y.objectMode&&(!K||!K.length))return;var X=J.push(K);if(!X)$=!0,Q.pause()});for(var q in Q)if(this[q]===void 0&&typeof Q[q]==="function")this[q]=function(K){return function(){return Q[K].apply(Q,arguments)}}(q);for(var V=0;V<DJ.length;V++)Q.on(DJ[V],this.emit.bind(this,DJ[V]));return this._read=function(K){if(f("wrapped _read",K),$)$=!1,Q.resume()},this};Object.defineProperty(l.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});l._fromList=Y5;function Y5(Q,J){if(J.length===0)return null;var Y;if(J.objectMode)Y=J.buffer.shift();else if(!Q||Q>=J.length){if(J.decoder)Y=J.buffer.join("");else if(J.buffer.length===1)Y=J.buffer.head.data;else Y=J.buffer.concat(J.length);J.buffer.clear()}else Y=V1(Q,J.buffer,J.decoder);return Y}function V1(Q,J,Y){var $;if(Q<J.head.data.length)$=J.head.data.slice(0,Q),J.head.data=J.head.data.slice(Q);else if(Q===J.head.data.length)$=J.shift();else $=Y?K1(Q,J):X1(Q,J);return $}function K1(Q,J){var Y=J.head,$=1,q=Y.data;Q-=q.length;while(Y=Y.next){var V=Y.data,K=Q>V.length?V.length:Q;if(K===V.length)q+=V;else q+=V.slice(0,Q);if(Q-=K,Q===0){if(K===V.length)if(++$,Y.next)J.head=Y.next;else J.head=J.tail=null;else J.head=Y,Y.data=V.slice(K);break}++$}return J.length-=$,q}function X1(Q,J){var Y=R8.allocUnsafe(Q),$=J.head,q=1;$.data.copy(Y),Q-=$.data.length;while($=$.next){var V=$.data,K=Q>V.length?V.length:Q;if(V.copy(Y,Y.length-Q,0,K),Q-=K,Q===0){if(K===V.length)if(++q,$.next)J.head=$.next;else J.head=J.tail=null;else J.head=$,$.data=V.slice(K);break}++q}return J.length-=q,Y}function wJ(Q){var J=Q._readableState;if(J.length>0)throw Error('"endReadable()" called on non-empty stream');if(!J.endEmitted)J.ended=!0,h6.nextTick(G1,J,Q)}function G1(Q,J){if(!Q.endEmitted&&Q.length===0)Q.endEmitted=!0,J.readable=!1,J.emit("end")}function $5(Q,J){for(var Y=0,$=Q.length;Y<$;Y++)if(Q[Y]===J)return Y;return-1}});var SJ=E((HL,X5)=>{X5.exports=d0;var zQ=L6(),K5=Object.create(S6());K5.inherits=k6();K5.inherits(d0,zQ);function H1(Q,J){var Y=this._transformState;Y.transforming=!1;var $=Y.writecb;if(!$)return this.emit("error",Error("write callback called multiple times"));if(Y.writechunk=null,Y.writecb=null,J!=null)this.push(J);$(Q);var q=this._readableState;if(q.reading=!1,q.needReadable||q.length<q.highWaterMark)this._read(q.highWaterMark)}function d0(Q){if(!(this instanceof d0))return new d0(Q);if(zQ.call(this,Q),this._transformState={afterTransform:H1.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,Q){if(typeof Q.transform==="function")this._transform=Q.transform;if(typeof Q.flush==="function")this._flush=Q.flush}this.on("prefinish",W1)}function W1(){var Q=this;if(typeof this._flush==="function")this._flush(function(J,Y){V5(Q,J,Y)});else V5(this,null,null)}d0.prototype.push=function(Q,J){return this._transformState.needTransform=!1,zQ.prototype.push.call(this,Q,J)};d0.prototype._transform=function(Q,J,Y){throw Error("_transform() is not implemented")};d0.prototype._write=function(Q,J,Y){var $=this._transformState;if($.writecb=Y,$.writechunk=Q,$.writeencoding=J,!$.transforming){var q=this._readableState;if($.needTransform||q.needReadable||q.length<q.highWaterMark)this._read(q.highWaterMark)}};d0.prototype._read=function(Q){var J=this._transformState;if(J.writechunk!==null&&J.writecb&&!J.transforming)J.transforming=!0,this._transform(J.writechunk,J.writeencoding,J.afterTransform);else J.needTransform=!0};d0.prototype._destroy=function(Q,J){var Y=this;zQ.prototype._destroy.call(this,Q,function($){J($),Y.emit("close")})};function V5(Q,J,Y){if(J)return Q.emit("error",J);if(Y!=null)Q.push(Y);if(Q._writableState.length)throw Error("Calling transform done when ws.length != 0");if(Q._transformState.transforming)throw Error("Calling transform done when still transforming");return Q.push(null)}});var U5=E((WL,W5)=>{W5.exports=I8;var G5=SJ(),H5=Object.create(S6());H5.inherits=k6();H5.inherits(I8,G5);function I8(Q){if(!(this instanceof I8))return new I8(Q);G5.call(this,Q)}I8.prototype._transform=function(Q,J,Y){Y(null,Q)}});var kJ=E((K0,FQ)=>{var w0=a("stream");if(process.env.READABLE_STREAM==="disable"&&w0)FQ.exports=w0,K0=FQ.exports=w0.Readable,K0.Readable=w0.Readable,K0.Writable=w0.Writable,K0.Duplex=w0.Duplex,K0.Transform=w0.Transform,K0.PassThrough=w0.PassThrough,K0.Stream=w0;else K0=FQ.exports=RJ(),K0.Stream=w0||K0,K0.Readable=K0,K0.Writable=NJ(),K0.Duplex=L6(),K0.Transform=SJ(),K0.PassThrough=U5()});var o0=E((Z1)=>{Z1.base64=!0;Z1.array=!0;Z1.string=!0;Z1.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";Z1.nodebuffer=typeof Buffer<"u";Z1.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")Z1.blob=!1;else{NQ=new ArrayBuffer(0);try{Z1.blob=new Blob([NQ],{type:"application/zip"}).size===0}catch(Q){try{gJ=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,CQ=new gJ,CQ.append(NQ),Z1.blob=CQ.getBlob("application/zip").size===0}catch(J){Z1.blob=!1}}}var NQ,gJ,CQ;try{Z1.nodestream=!!kJ().Readable}catch(Q){Z1.nodestream=!1}});var hJ=E((C1)=>{var F1=n(),N1=o0(),v0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";C1.encode=function(Q){var J=[],Y,$,q,V,K,X,Z,H=0,U=Q.length,B=U,P=F1.getTypeOf(Q)!=="string";while(H<Q.length){if(B=U-H,!P)Y=Q.charCodeAt(H++),$=H<U?Q.charCodeAt(H++):0,q=H<U?Q.charCodeAt(H++):0;else Y=Q[H++],$=H<U?Q[H++]:0,q=H<U?Q[H++]:0;V=Y>>2,K=(Y&3)<<4|$>>4,X=B>1?($&15)<<2|q>>6:64,Z=B>2?q&63:64,J.push(v0.charAt(V)+v0.charAt(K)+v0.charAt(X)+v0.charAt(Z))}return J.join("")};C1.decode=function(Q){var J,Y,$,q,V,K,X,Z=0,H=0,U="data:";if(Q.substr(0,U.length)===U)throw Error("Invalid base64 input, it looks like a data url.");Q=Q.replace(/[^A-Za-z0-9+/=]/g,"");var B=Q.length*3/4;if(Q.charAt(Q.length-1)===v0.charAt(64))B--;if(Q.charAt(Q.length-2)===v0.charAt(64))B--;if(B%1!==0)throw Error("Invalid base64 input, bad content length.");var P;if(N1.uint8array)P=new Uint8Array(B|0);else P=Array(B|0);while(Z<Q.length){if(q=v0.indexOf(Q.charAt(Z++)),V=v0.indexOf(Q.charAt(Z++)),K=v0.indexOf(Q.charAt(Z++)),X=v0.indexOf(Q.charAt(Z++)),J=q<<2|V>>4,Y=(V&15)<<4|K>>2,$=(K&3)<<6|X,P[H++]=J,K!==64)P[H++]=Y;if(X!==64)P[H++]=$}return P}});var M8=E((LL,Z5)=>{Z5.exports={isNode:typeof Buffer<"u",newBufferFrom:function(Q,J){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(Q,J);else{if(typeof Q==="number")throw Error('The "data" argument must not be a number');return new Buffer(Q,J)}},allocBuffer:function(Q){if(Buffer.alloc)return Buffer.alloc(Q);else{var J=new Buffer(Q);return J.fill(0),J}},isBuffer:function(Q){return Buffer.isBuffer(Q)},isStream:function(Q){return Q&&typeof Q.on==="function"&&typeof Q.pause==="function"&&typeof Q.resume==="function"}}});var O5=E((OL,B5)=>{var BL=global.MutationObserver||global.WebKitMutationObserver,L5;L5=function(){process.nextTick(E1)};var M1,A1,T1,D1,_J,A8=[];function E1(){_J=!0;var Q,J,Y=A8.length;while(Y){J=A8,A8=[],Q=-1;while(++Q<Y)J[Q]();Y=A8.length}_J=!1}B5.exports=w1;function w1(Q){if(A8.push(Q)===1&&!_J)L5()}});var R5=E((PL,C5)=>{var P5=O5();function b6(){}var G0={},j5=["REJECTED"],bJ=["FULFILLED"],z5=["PENDING"];_6=["UNHANDLED"];var _6;C5.exports=e0;function e0(Q){if(typeof Q!=="function")throw TypeError("resolver must be a function");if(this.state=z5,this.queue=[],this.outcome=void 0,this.handled=_6,Q!==b6)F5(this,Q)}e0.prototype.finally=function(Q){if(typeof Q!=="function")return this;var J=this.constructor;return this.then(Y,$);function Y(q){function V(){return q}return J.resolve(Q()).then(V)}function $(q){function V(){throw q}return J.resolve(Q()).then(V)}};e0.prototype.catch=function(Q){return this.then(null,Q)};e0.prototype.then=function(Q,J){if(typeof Q!=="function"&&this.state===bJ||typeof J!=="function"&&this.state===j5)return this;var Y=new this.constructor(b6);if(this.handled===_6)this.handled=null;if(this.state!==z5){var $=this.state===bJ?Q:J;fJ(Y,$,this.outcome)}else this.queue.push(new T8(Y,Q,J));return Y};function T8(Q,J,Y){if(this.promise=Q,typeof J==="function")this.onFulfilled=J,this.callFulfilled=this.otherCallFulfilled;if(typeof Y==="function")this.onRejected=Y,this.callRejected=this.otherCallRejected}T8.prototype.callFulfilled=function(Q){G0.resolve(this.promise,Q)};T8.prototype.otherCallFulfilled=function(Q){fJ(this.promise,this.onFulfilled,Q)};T8.prototype.callRejected=function(Q){G0.reject(this.promise,Q)};T8.prototype.otherCallRejected=function(Q){fJ(this.promise,this.onRejected,Q)};function fJ(Q,J,Y){P5(function(){var $;try{$=J(Y)}catch(q){return G0.reject(Q,q)}if($===Q)G0.reject(Q,TypeError("Cannot resolve promise with itself"));else G0.resolve(Q,$)})}G0.resolve=function(Q,J){var Y=N5(v1,J);if(Y.status==="error")return G0.reject(Q,Y.value);var $=Y.value;if($)F5(Q,$);else{Q.state=bJ,Q.outcome=J;var q=-1,V=Q.queue.length;while(++q<V)Q.queue[q].callFulfilled(J)}return Q};G0.reject=function(Q,J){if(Q.state=j5,Q.outcome=J,Q.handled===_6)P5(function(){if(Q.handled===_6)process.emit("unhandledRejection",J,Q)});var Y=-1,$=Q.queue.length;while(++Y<$)Q.queue[Y].callRejected(J);return Q};function v1(Q){var J=Q&&Q.then;if(Q&&(typeof Q==="object"||typeof Q==="function")&&typeof J==="function")return function(){J.apply(Q,arguments)}}function F5(Q,J){var Y=!1;function $(X){if(Y)return;Y=!0,G0.reject(Q,X)}function q(X){if(Y)return;Y=!0,G0.resolve(Q,X)}function V(){J(q,$)}var K=N5(V);if(K.status==="error")$(K.value)}function N5(Q,J){var Y={};try{Y.value=Q(J),Y.status="success"}catch($){Y.status="error",Y.value=$}return Y}e0.resolve=x1;function x1(Q){if(Q instanceof this)return Q;return G0.resolve(new this(b6),Q)}e0.reject=S1;function S1(Q){var J=new this(b6);return G0.reject(J,Q)}e0.all=k1;function k1(Q){var J=this;if(Object.prototype.toString.call(Q)!=="[object Array]")return this.reject(TypeError("must be an array"));var Y=Q.length,$=!1;if(!Y)return this.resolve([]);var q=Array(Y),V=0,K=-1,X=new this(b6);while(++K<Y)Z(Q[K],K);return X;function Z(H,U){J.resolve(H).then(B,function(P){if(!$)$=!0,G0.reject(X,P)});function B(P){if(q[U]=P,++V===Y&&!$)$=!0,G0.resolve(X,q)}}}e0.race=y1;function y1(Q){var J=this;if(Object.prototype.toString.call(Q)!=="[object Array]")return this.reject(TypeError("must be an array"));var Y=Q.length,$=!1;if(!Y)return this.resolve([]);var q=-1,V=new this(b6);while(++q<Y)K(Q[q]);return V;function K(X){J.resolve(X).then(function(Z){if(!$)$=!0,G0.resolve(V,Z)},function(Z){if(!$)$=!0,G0.reject(V,Z)})}}});var f6=E((jL,I5)=>{var mJ=null;if(typeof Promise<"u")mJ=Promise;else mJ=R5();I5.exports={Promise:mJ}});var A5=E((M5)=>{(function(Q,J){if(Q.setImmediate)return;var Y=1,$={},q=!1,V=Q.document,K;function X(M){if(typeof M!=="function")M=Function(""+M);var T=Array(arguments.length-1);for(var R=0;R<T.length;R++)T[R]=arguments[R+1];var D={callback:M,args:T};return $[Y]=D,K(Y),Y++}function Z(M){delete $[M]}function H(M){var{callback:T,args:R}=M;switch(R.length){case 0:T();break;case 1:T(R[0]);break;case 2:T(R[0],R[1]);break;case 3:T(R[0],R[1],R[2]);break;default:T.apply(J,R);break}}function U(M){if(q)setTimeout(U,0,M);else{var T=$[M];if(T){q=!0;try{H(T)}finally{Z(M),q=!1}}}}function B(){K=function(M){process.nextTick(function(){U(M)})}}function P(){if(Q.postMessage&&!Q.importScripts){var M=!0,T=Q.onmessage;return Q.onmessage=function(){M=!1},Q.postMessage("","*"),Q.onmessage=T,M}}function z(){var M="setImmediate$"+Math.random()+"$",T=function(R){if(R.source===Q&&typeof R.data==="string"&&R.data.indexOf(M)===0)U(+R.data.slice(M.length))};if(Q.addEventListener)Q.addEventListener("message",T,!1);else Q.attachEvent("onmessage",T);K=function(R){Q.postMessage(M+R,"*")}}function N(){var M=new MessageChannel;M.port1.onmessage=function(T){var R=T.data;U(R)},K=function(T){M.port2.postMessage(T)}}function j(){var M=V.documentElement;K=function(T){var R=V.createElement("script");R.onreadystatechange=function(){U(T),R.onreadystatechange=null,M.removeChild(R),R=null},M.appendChild(R)}}function C(){K=function(M){setTimeout(U,0,M)}}var A=Object.getPrototypeOf&&Object.getPrototypeOf(Q);if(A=A&&A.setTimeout?A:Q,{}.toString.call(Q.process)==="[object process]")B();else if(P())z();else if(Q.MessageChannel)N();else if(V&&"onreadystatechange"in V.createElement("script"))j();else C();A.setImmediate=X,A.clearImmediate=Z})(typeof self>"u"?typeof global>"u"?M5:global:self)});var n=E((_1)=>{var Q6=o0(),g1=hJ(),m6=M8(),uJ=f6();A5();function h1(Q){var J=null;if(Q6.uint8array)J=new Uint8Array(Q.length);else J=Array(Q.length);return IQ(Q,J)}_1.newBlob=function(Q,J){_1.checkSupport("blob");try{return new Blob([Q],{type:J})}catch(q){try{var Y=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,$=new Y;return $.append(Q),$.getBlob(J)}catch(V){throw Error("Bug : can't construct the Blob.")}}};function D8(Q){return Q}function IQ(Q,J){for(var Y=0;Y<Q.length;++Y)J[Y]=Q.charCodeAt(Y)&255;return J}var RQ={stringifyByChunk:function(Q,J,Y){var $=[],q=0,V=Q.length;if(V<=Y)return String.fromCharCode.apply(null,Q);while(q<V){if(J==="array"||J==="nodebuffer")$.push(String.fromCharCode.apply(null,Q.slice(q,Math.min(q+Y,V))));else $.push(String.fromCharCode.apply(null,Q.subarray(q,Math.min(q+Y,V))));q+=Y}return $.join("")},stringifyByChar:function(Q){var J="";for(var Y=0;Y<Q.length;Y++)J+=String.fromCharCode(Q[Y]);return J},applyCanBeUsed:{uint8array:function(){try{return Q6.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch(Q){return!1}}(),nodebuffer:function(){try{return Q6.nodebuffer&&String.fromCharCode.apply(null,m6.allocBuffer(1)).length===1}catch(Q){return!1}}()}};function E8(Q){var J=65536,Y=_1.getTypeOf(Q),$=!0;if(Y==="uint8array")$=RQ.applyCanBeUsed.uint8array;else if(Y==="nodebuffer")$=RQ.applyCanBeUsed.nodebuffer;if($)while(J>1)try{return RQ.stringifyByChunk(Q,Y,J)}catch(q){J=Math.floor(J/2)}return RQ.stringifyByChar(Q)}_1.applyFromCharCode=E8;function MQ(Q,J){for(var Y=0;Y<Q.length;Y++)J[Y]=Q[Y];return J}var J6={};J6.string={string:D8,array:function(Q){return IQ(Q,Array(Q.length))},arraybuffer:function(Q){return J6.string.uint8array(Q).buffer},uint8array:function(Q){return IQ(Q,new Uint8Array(Q.length))},nodebuffer:function(Q){return IQ(Q,m6.allocBuffer(Q.length))}};J6.array={string:E8,array:D8,arraybuffer:function(Q){return new Uint8Array(Q).buffer},uint8array:function(Q){return new Uint8Array(Q)},nodebuffer:function(Q){return m6.newBufferFrom(Q)}};J6.arraybuffer={string:function(Q){return E8(new Uint8Array(Q))},array:function(Q){return MQ(new Uint8Array(Q),Array(Q.byteLength))},arraybuffer:D8,uint8array:function(Q){return new Uint8Array(Q)},nodebuffer:function(Q){return m6.newBufferFrom(new Uint8Array(Q))}};J6.uint8array={string:E8,array:function(Q){return MQ(Q,Array(Q.length))},arraybuffer:function(Q){return Q.buffer},uint8array:D8,nodebuffer:function(Q){return m6.newBufferFrom(Q)}};J6.nodebuffer={string:E8,array:function(Q){return MQ(Q,Array(Q.length))},arraybuffer:function(Q){return J6.nodebuffer.uint8array(Q).buffer},uint8array:function(Q){return MQ(Q,new Uint8Array(Q.length))},nodebuffer:D8};_1.transformTo=function(Q,J){if(!J)J="";if(!Q)return J;_1.checkSupport(Q);var Y=_1.getTypeOf(J),$=J6[Y][Q](J);return $};_1.resolve=function(Q){var J=Q.split("/"),Y=[];for(var $=0;$<J.length;$++){var q=J[$];if(q==="."||q===""&&$!==0&&$!==J.length-1)continue;else if(q==="..")Y.pop();else Y.push(q)}return Y.join("/")};_1.getTypeOf=function(Q){if(typeof Q==="string")return"string";if(Object.prototype.toString.call(Q)==="[object Array]")return"array";if(Q6.nodebuffer&&m6.isBuffer(Q))return"nodebuffer";if(Q6.uint8array&&Q instanceof Uint8Array)return"uint8array";if(Q6.arraybuffer&&Q instanceof ArrayBuffer)return"arraybuffer"};_1.checkSupport=function(Q){var J=Q6[Q.toLowerCase()];if(!J)throw Error(Q+" is not supported by this platform")};_1.MAX_VALUE_16BITS=65535;_1.MAX_VALUE_32BITS=-1;_1.pretty=function(Q){var J="",Y,$;for($=0;$<(Q||"").length;$++)Y=Q.charCodeAt($),J+="\\x"+(Y<16?"0":"")+Y.toString(16).toUpperCase();return J};_1.delay=function(Q,J,Y){setImmediate(function(){Q.apply(Y||null,J||[])})};_1.inherits=function(Q,J){var Y=function(){};Y.prototype=J.prototype,Q.prototype=new Y};_1.extend=function(){var Q={},J,Y;for(J=0;J<arguments.length;J++)for(Y in arguments[J])if(Object.prototype.hasOwnProperty.call(arguments[J],Y)&&typeof Q[Y]>"u")Q[Y]=arguments[J][Y];return Q};_1.prepareContent=function(Q,J,Y,$,q){var V=uJ.Promise.resolve(J).then(function(K){var X=Q6.blob&&(K instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(K))!==-1);if(X&&typeof FileReader<"u")return new uJ.Promise(function(Z,H){var U=new FileReader;U.onload=function(B){Z(B.target.result)},U.onerror=function(B){H(B.target.error)},U.readAsArrayBuffer(K)});else return K});return V.then(function(K){var X=_1.getTypeOf(K);if(!X)return uJ.Promise.reject(Error("Can't read the data of '"+Q+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(X==="arraybuffer")K=_1.transformTo("uint8array",K);else if(X==="string"){if(q)K=g1.decode(K);else if(Y){if($!==!0)K=h1(K)}}return K})}});var O0=E((NL,w5)=>{function E5(Q){this.name=Q||"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}E5.prototype={push:function(Q){this.emit("data",Q)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(Q){this.emit("error",Q)}return!0},error:function(Q){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=Q;else{if(this.isFinished=!0,this.emit("error",Q),this.previous)this.previous.error(Q);this.cleanUp()}return!0},on:function(Q,J){return this._listeners[Q].push(J),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(Q,J){if(this._listeners[Q])for(var Y=0;Y<this._listeners[Q].length;Y++)this._listeners[Q][Y].call(this,J)},pipe:function(Q){return Q.registerPrevious(this)},registerPrevious:function(Q){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");this.streamInfo=Q.streamInfo,this.mergeStreamInfo(),this.previous=Q;var J=this;return Q.on("data",function(Y){J.processChunk(Y)}),Q.on("end",function(){J.end()}),Q.on("error",function(Y){J.error(Y)}),this},pause:function(){if(this.isPaused||this.isFinished)return!1;if(this.isPaused=!0,this.previous)this.previous.pause();return!0},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var Q=!1;if(this.generatedError)this.error(this.generatedError),Q=!0;if(this.previous)this.previous.resume();return!Q},flush:function(){},processChunk:function(Q){this.push(Q)},withStreamInfo:function(Q,J){return this.extraStreamInfo[Q]=J,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var Q in this.extraStreamInfo){if(!Object.prototype.hasOwnProperty.call(this.extraStreamInfo,Q))continue;this.streamInfo[Q]=this.extraStreamInfo[Q]}},lock:function(){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");if(this.isLocked=!0,this.previous)this.previous.lock()},toString:function(){var Q="Worker "+this.name;if(this.previous)return this.previous+" -> "+Q;else return Q}};w5.exports=E5});var c6=E((t1)=>{var u6=n(),B6=o0(),i1=M8(),AQ=O0(),w8=Array(256);for(x0=0;x0<256;x0++)w8[x0]=x0>=252?6:x0>=248?5:x0>=240?4:x0>=224?3:x0>=192?2:1;var x0;w8[254]=w8[254]=1;var r1=function(Q){var J,Y,$,q,V,K=Q.length,X=0;for(q=0;q<K;q++){if(Y=Q.charCodeAt(q),(Y&64512)===55296&&q+1<K){if($=Q.charCodeAt(q+1),($&64512)===56320)Y=65536+(Y-55296<<10)+($-56320),q++}X+=Y<128?1:Y<2048?2:Y<65536?3:4}if(B6.uint8array)J=new Uint8Array(X);else J=Array(X);for(V=0,q=0;V<X;q++){if(Y=Q.charCodeAt(q),(Y&64512)===55296&&q+1<K){if($=Q.charCodeAt(q+1),($&64512)===56320)Y=65536+(Y-55296<<10)+($-56320),q++}if(Y<128)J[V++]=Y;else if(Y<2048)J[V++]=192|Y>>>6,J[V++]=128|Y&63;else if(Y<65536)J[V++]=224|Y>>>12,J[V++]=128|Y>>>6&63,J[V++]=128|Y&63;else J[V++]=240|Y>>>18,J[V++]=128|Y>>>12&63,J[V++]=128|Y>>>6&63,J[V++]=128|Y&63}return J},a1=function(Q,J){var Y;if(J=J||Q.length,J>Q.length)J=Q.length;Y=J-1;while(Y>=0&&(Q[Y]&192)===128)Y--;if(Y<0)return J;if(Y===0)return J;return Y+w8[Q[Y]]>J?Y:J},s1=function(Q){var J,Y,$,q,V=Q.length,K=Array(V*2);for(Y=0,J=0;J<V;){if($=Q[J++],$<128){K[Y++]=$;continue}if(q=w8[$],q>4){K[Y++]=65533,J+=q-1;continue}$&=q===2?31:q===3?15:7;while(q>1&&J<V)$=$<<6|Q[J++]&63,q--;if(q>1){K[Y++]=65533;continue}if($<65536)K[Y++]=$;else $-=65536,K[Y++]=55296|$>>10&1023,K[Y++]=56320|$&1023}if(K.length!==Y)if(K.subarray)K=K.subarray(0,Y);else K.length=Y;return u6.applyFromCharCode(K)};t1.utf8encode=function(J){if(B6.nodebuffer)return i1.newBufferFrom(J,"utf-8");return r1(J)};t1.utf8decode=function(J){if(B6.nodebuffer)return u6.transformTo("nodebuffer",J).toString("utf-8");return J=u6.transformTo(B6.uint8array?"uint8array":"array",J),s1(J)};function TQ(){AQ.call(this,"utf-8 decode"),this.leftOver=null}u6.inherits(TQ,AQ);TQ.prototype.processChunk=function(Q){var J=u6.transformTo(B6.uint8array?"uint8array":"array",Q.data);if(this.leftOver&&this.leftOver.length){if(B6.uint8array){var Y=J;J=new Uint8Array(Y.length+this.leftOver.length),J.set(this.leftOver,0),J.set(Y,this.leftOver.length)}else J=this.leftOver.concat(J);this.leftOver=null}var $=a1(J),q=J;if($!==J.length)if(B6.uint8array)q=J.subarray(0,$),this.leftOver=J.subarray($,J.length);else q=J.slice(0,$),this.leftOver=J.slice($,J.length);this.push({data:t1.utf8decode(q),meta:Q.meta})};TQ.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:t1.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};t1.Utf8DecodeWorker=TQ;function pJ(){AQ.call(this,"utf-8 encode")}u6.inherits(pJ,AQ);pJ.prototype.processChunk=function(Q){this.push({data:t1.utf8encode(Q.data),meta:Q.meta})};t1.Utf8EncodeWorker=pJ});var y5=E((RL,k5)=>{var x5=O0(),S5=n();function dJ(Q){x5.call(this,"ConvertWorker to "+Q),this.destType=Q}S5.inherits(dJ,x5);dJ.prototype.processChunk=function(Q){this.push({data:S5.transformTo(this.destType,Q.data),meta:Q.meta})};k5.exports=dJ});var _5=E((IL,h5)=>{var g5=kJ().Readable,JG=n();JG.inherits(oJ,g5);function oJ(Q,J,Y){g5.call(this,J),this._helper=Q;var $=this;Q.on("data",function(q,V){if(!$.push(q))$._helper.pause();if(Y)Y(V)}).on("error",function(q){$.emit("error",q)}).on("end",function(){$.push(null)})}oJ.prototype._read=function(){this._helper.resume()};h5.exports=oJ});var nJ=E((ML,m5)=>{var O6=n(),YG=y5(),$G=O0(),qG=hJ(),VG=o0(),KG=f6(),b5=null;if(VG.nodestream)try{b5=_5()}catch(Q){}function XG(Q,J,Y){switch(Q){case"blob":return O6.newBlob(O6.transformTo("arraybuffer",J),Y);case"base64":return qG.encode(J);default:return O6.transformTo(Q,J)}}function GG(Q,J){var Y,$=0,q=null,V=0;for(Y=0;Y<J.length;Y++)V+=J[Y].length;switch(Q){case"string":return J.join("");case"array":return Array.prototype.concat.apply([],J);case"uint8array":q=new Uint8Array(V);for(Y=0;Y<J.length;Y++)q.set(J[Y],$),$+=J[Y].length;return q;case"nodebuffer":return Buffer.concat(J);default:throw Error("concat : unsupported type '"+Q+"'")}}function HG(Q,J){return new KG.Promise(function(Y,$){var q=[],V=Q._internalType,K=Q._outputType,X=Q._mimeType;Q.on("data",function(Z,H){if(q.push(Z),J)J(H)}).on("error",function(Z){q=[],$(Z)}).on("end",function(){try{var Z=XG(K,GG(V,q),X);Y(Z)}catch(H){$(H)}q=[]}).resume()})}function f5(Q,J,Y){var $=J;switch(J){case"blob":case"arraybuffer":$="uint8array";break;case"base64":$="string";break}try{this._internalType=$,this._outputType=J,this._mimeType=Y,O6.checkSupport($),this._worker=Q.pipe(new YG($)),Q.lock()}catch(q){this._worker=new $G("error"),this._worker.error(q)}}f5.prototype={accumulate:function(Q){return HG(this,Q)},on:function(Q,J){var Y=this;if(Q==="data")this._worker.on(Q,function($){J.call(Y,$.data,$.meta)});else this._worker.on(Q,function(){O6.delay(J,arguments,Y)});return this},resume:function(){return O6.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(Q){if(O6.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new b5(this,{objectMode:this._outputType!=="nodebuffer"},Q)}};m5.exports=f5});var iJ=E((WG)=>{WG.base64=!1;WG.binary=!1;WG.dir=!1;WG.createFolders=!0;WG.date=null;WG.compression=null;WG.compressionOptions=null;WG.comment=null;WG.unixPermissions=null;WG.dosPermissions=null});var rJ=E((TL,u5)=>{var DQ=n(),EQ=O0(),CG=16384;function p6(Q){EQ.call(this,"DataWorker");var J=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,Q.then(function(Y){if(J.dataIsReady=!0,J.data=Y,J.max=Y&&Y.length||0,J.type=DQ.getTypeOf(Y),!J.isPaused)J._tickAndRepeat()},function(Y){J.error(Y)})}DQ.inherits(p6,EQ);p6.prototype.cleanUp=function(){EQ.prototype.cleanUp.call(this),this.data=null};p6.prototype.resume=function(){if(!EQ.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,DQ.delay(this._tickAndRepeat,[],this);return!0};p6.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)DQ.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};p6.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var Q=CG,J=null,Y=Math.min(this.max,this.index+Q);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":J=this.data.substring(this.index,Y);break;case"uint8array":J=this.data.subarray(this.index,Y);break;case"array":case"nodebuffer":J=this.data.slice(this.index,Y);break}return this.index=Y,this.push({data:J,meta:{percent:this.max?this.index/this.max*100:0}})}};u5.exports=p6});var wQ=E((DL,p5)=>{var RG=n();function IG(){var Q,J=[];for(var Y=0;Y<256;Y++){Q=Y;for(var $=0;$<8;$++)Q=Q&1?3988292384^Q>>>1:Q>>>1;J[Y]=Q}return J}var c5=IG();function MG(Q,J,Y,$){var q=c5,V=$+Y;Q=Q^-1;for(var K=$;K<V;K++)Q=Q>>>8^q[(Q^J[K])&255];return Q^-1}function AG(Q,J,Y,$){var q=c5,V=$+Y;Q=Q^-1;for(var K=$;K<V;K++)Q=Q>>>8^q[(Q^J.charCodeAt(K))&255];return Q^-1}p5.exports=function(J,Y){if(typeof J>"u"||!J.length)return 0;var $=RG.getTypeOf(J)!=="string";if($)return MG(Y|0,J,J.length,0);else return AG(Y|0,J,J.length,0)}});var sJ=E((EL,d5)=>{var l5=O0(),TG=wQ(),DG=n();function aJ(){l5.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}DG.inherits(aJ,l5);aJ.prototype.processChunk=function(Q){this.streamInfo.crc32=TG(Q.data,this.streamInfo.crc32||0),this.push(Q)};d5.exports=aJ});var n5=E((wL,o5)=>{var EG=n(),tJ=O0();function eJ(Q){tJ.call(this,"DataLengthProbe for "+Q),this.propName=Q,this.withStreamInfo(Q,0)}EG.inherits(eJ,tJ);eJ.prototype.processChunk=function(Q){if(Q){var J=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=J+Q.data.length}tJ.prototype.processChunk.call(this,Q)};o5.exports=eJ});var vQ=E((vL,a5)=>{var i5=f6(),r5=rJ(),wG=sJ(),QY=n5();function JY(Q,J,Y,$,q){this.compressedSize=Q,this.uncompressedSize=J,this.crc32=Y,this.compression=$,this.compressedContent=q}JY.prototype={getContentWorker:function(){var Q=new r5(i5.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new QY("data_length")),J=this;return Q.on("end",function(){if(this.streamInfo.data_length!==J.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),Q},getCompressedWorker:function(){return new r5(i5.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};JY.createWorkerFrom=function(Q,J,Y){return Q.pipe(new wG).pipe(new QY("uncompressedSize")).pipe(J.compressWorker(Y)).pipe(new QY("compressedSize")).withStreamInfo("compression",J)};a5.exports=JY});var Qq=E((xL,e5)=>{var vG=nJ(),xG=rJ(),YY=c6(),$Y=vQ(),s5=O0(),qY=function(Q,J,Y){this.name=Q,this.dir=Y.dir,this.date=Y.date,this.comment=Y.comment,this.unixPermissions=Y.unixPermissions,this.dosPermissions=Y.dosPermissions,this._data=J,this._dataBinary=Y.binary,this.options={compression:Y.compression,compressionOptions:Y.compressionOptions}};qY.prototype={internalStream:function(Q){var J=null,Y="string";try{if(!Q)throw Error("No output type specified.");Y=Q.toLowerCase();var $=Y==="string"||Y==="text";if(Y==="binarystring"||Y==="text")Y="string";J=this._decompressWorker();var q=!this._dataBinary;if(q&&!$)J=J.pipe(new YY.Utf8EncodeWorker);if(!q&&$)J=J.pipe(new YY.Utf8DecodeWorker)}catch(V){J=new s5("error"),J.error(V)}return new vG(J,Y,"")},async:function(Q,J){return this.internalStream(Q).accumulate(J)},nodeStream:function(Q,J){return this.internalStream(Q||"nodebuffer").toNodejsStream(J)},_compressWorker:function(Q,J){if(this._data instanceof $Y&&this._data.compression.magic===Q.magic)return this._data.getCompressedWorker();else{var Y=this._decompressWorker();if(!this._dataBinary)Y=Y.pipe(new YY.Utf8EncodeWorker);return $Y.createWorkerFrom(Y,Q,J)}},_decompressWorker:function(){if(this._data instanceof $Y)return this._data.getContentWorker();else if(this._data instanceof s5)return this._data;else return new xG(this._data)}};var t5=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],SG=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(v8=0;v8<t5.length;v8++)qY.prototype[t5[v8]]=SG;var v8;e5.exports=qY});var n0=E((VY)=>{var hG=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function _G(Q,J){return Object.prototype.hasOwnProperty.call(Q,J)}VY.assign=function(Q){var J=Array.prototype.slice.call(arguments,1);while(J.length){var Y=J.shift();if(!Y)continue;if(typeof Y!=="object")throw TypeError(Y+"must be non-object");for(var $ in Y)if(_G(Y,$))Q[$]=Y[$]}return Q};VY.shrinkBuf=function(Q,J){if(Q.length===J)return Q;if(Q.subarray)return Q.subarray(0,J);return Q.length=J,Q};var bG={arraySet:function(Q,J,Y,$,q){if(J.subarray&&Q.subarray){Q.set(J.subarray(Y,Y+$),q);return}for(var V=0;V<$;V++)Q[q+V]=J[Y+V]},flattenChunks:function(Q){var J,Y,$,q,V,K;$=0;for(J=0,Y=Q.length;J<Y;J++)$+=Q[J].length;K=new Uint8Array($),q=0;for(J=0,Y=Q.length;J<Y;J++)V=Q[J],K.set(V,q),q+=V.length;return K}},fG={arraySet:function(Q,J,Y,$,q){for(var V=0;V<$;V++)Q[q+V]=J[Y+V]},flattenChunks:function(Q){return[].concat.apply([],Q)}};VY.setTyped=function(Q){if(Q)VY.Buf8=Uint8Array,VY.Buf16=Uint16Array,VY.Buf32=Int32Array,VY.assign(VY,bG);else VY.Buf8=Array,VY.Buf16=Array,VY.Buf32=Array,VY.assign(VY,fG)};VY.setTyped(hG)});var Mq=E((G9)=>{var uG=n0(),cG=4,Yq=0,$q=1,pG=2;function d6(Q){var J=Q.length;while(--J>=0)Q[J]=0}var lG=0,Hq=1,dG=2,oG=3,nG=258,LY=29,h8=256,S8=h8+1+LY,l6=30,BY=19,Wq=2*S8+1,P6=15,XY=16,iG=7,OY=256,Uq=16,Zq=17,Lq=18,UY=[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],xQ=[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],rG=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Bq=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],aG=512,i0=Array((S8+2)*2);d6(i0);var x8=Array(l6*2);d6(x8);var k8=Array(aG);d6(k8);var y8=Array(nG-oG+1);d6(y8);var PY=Array(LY);d6(PY);var SQ=Array(l6);d6(SQ);function GY(Q,J,Y,$,q){this.static_tree=Q,this.extra_bits=J,this.extra_base=Y,this.elems=$,this.max_length=q,this.has_stree=Q&&Q.length}var Oq,Pq,jq;function HY(Q,J){this.dyn_tree=Q,this.max_code=0,this.stat_desc=J}function zq(Q){return Q<256?k8[Q]:k8[256+(Q>>>7)]}function g8(Q,J){Q.pending_buf[Q.pending++]=J&255,Q.pending_buf[Q.pending++]=J>>>8&255}function L0(Q,J,Y){if(Q.bi_valid>XY-Y)Q.bi_buf|=J<<Q.bi_valid&65535,g8(Q,Q.bi_buf),Q.bi_buf=J>>XY-Q.bi_valid,Q.bi_valid+=Y-XY;else Q.bi_buf|=J<<Q.bi_valid&65535,Q.bi_valid+=Y}function S0(Q,J,Y){L0(Q,Y[J*2],Y[J*2+1])}function Fq(Q,J){var Y=0;do Y|=Q&1,Q>>>=1,Y<<=1;while(--J>0);return Y>>>1}function sG(Q){if(Q.bi_valid===16)g8(Q,Q.bi_buf),Q.bi_buf=0,Q.bi_valid=0;else if(Q.bi_valid>=8)Q.pending_buf[Q.pending++]=Q.bi_buf&255,Q.bi_buf>>=8,Q.bi_valid-=8}function tG(Q,J){var{dyn_tree:Y,max_code:$}=J,q=J.stat_desc.static_tree,V=J.stat_desc.has_stree,K=J.stat_desc.extra_bits,X=J.stat_desc.extra_base,Z=J.stat_desc.max_length,H,U,B,P,z,N,j=0;for(P=0;P<=P6;P++)Q.bl_count[P]=0;Y[Q.heap[Q.heap_max]*2+1]=0;for(H=Q.heap_max+1;H<Wq;H++){if(U=Q.heap[H],P=Y[Y[U*2+1]*2+1]+1,P>Z)P=Z,j++;if(Y[U*2+1]=P,U>$)continue;if(Q.bl_count[P]++,z=0,U>=X)z=K[U-X];if(N=Y[U*2],Q.opt_len+=N*(P+z),V)Q.static_len+=N*(q[U*2+1]+z)}if(j===0)return;do{P=Z-1;while(Q.bl_count[P]===0)P--;Q.bl_count[P]--,Q.bl_count[P+1]+=2,Q.bl_count[Z]--,j-=2}while(j>0);for(P=Z;P!==0;P--){U=Q.bl_count[P];while(U!==0){if(B=Q.heap[--H],B>$)continue;if(Y[B*2+1]!==P)Q.opt_len+=(P-Y[B*2+1])*Y[B*2],Y[B*2+1]=P;U--}}}function Nq(Q,J,Y){var $=Array(P6+1),q=0,V,K;for(V=1;V<=P6;V++)$[V]=q=q+Y[V-1]<<1;for(K=0;K<=J;K++){var X=Q[K*2+1];if(X===0)continue;Q[K*2]=Fq($[X]++,X)}}function eG(){var Q,J,Y,$,q,V=Array(P6+1);Y=0;for($=0;$<LY-1;$++){PY[$]=Y;for(Q=0;Q<1<<UY[$];Q++)y8[Y++]=$}y8[Y-1]=$,q=0;for($=0;$<16;$++){SQ[$]=q;for(Q=0;Q<1<<xQ[$];Q++)k8[q++]=$}q>>=7;for(;$<l6;$++){SQ[$]=q<<7;for(Q=0;Q<1<<xQ[$]-7;Q++)k8[256+q++]=$}for(J=0;J<=P6;J++)V[J]=0;Q=0;while(Q<=143)i0[Q*2+1]=8,Q++,V[8]++;while(Q<=255)i0[Q*2+1]=9,Q++,V[9]++;while(Q<=279)i0[Q*2+1]=7,Q++,V[7]++;while(Q<=287)i0[Q*2+1]=8,Q++,V[8]++;Nq(i0,S8+1,V);for(Q=0;Q<l6;Q++)x8[Q*2+1]=5,x8[Q*2]=Fq(Q,5);Oq=new GY(i0,UY,h8+1,S8,P6),Pq=new GY(x8,xQ,0,l6,P6),jq=new GY([],rG,0,BY,iG)}function Cq(Q){var J;for(J=0;J<S8;J++)Q.dyn_ltree[J*2]=0;for(J=0;J<l6;J++)Q.dyn_dtree[J*2]=0;for(J=0;J<BY;J++)Q.bl_tree[J*2]=0;Q.dyn_ltree[OY*2]=1,Q.opt_len=Q.static_len=0,Q.last_lit=Q.matches=0}function Rq(Q){if(Q.bi_valid>8)g8(Q,Q.bi_buf);else if(Q.bi_valid>0)Q.pending_buf[Q.pending++]=Q.bi_buf;Q.bi_buf=0,Q.bi_valid=0}function Q9(Q,J,Y,$){if(Rq(Q),$)g8(Q,Y),g8(Q,~Y);uG.arraySet(Q.pending_buf,Q.window,J,Y,Q.pending),Q.pending+=Y}function qq(Q,J,Y,$){var q=J*2,V=Y*2;return Q[q]<Q[V]||Q[q]===Q[V]&&$[J]<=$[Y]}function WY(Q,J,Y){var $=Q.heap[Y],q=Y<<1;while(q<=Q.heap_len){if(q<Q.heap_len&&qq(J,Q.heap[q+1],Q.heap[q],Q.depth))q++;if(qq(J,$,Q.heap[q],Q.depth))break;Q.heap[Y]=Q.heap[q],Y=q,q<<=1}Q.heap[Y]=$}function Vq(Q,J,Y){var $,q,V=0,K,X;if(Q.last_lit!==0)do if($=Q.pending_buf[Q.d_buf+V*2]<<8|Q.pending_buf[Q.d_buf+V*2+1],q=Q.pending_buf[Q.l_buf+V],V++,$===0)S0(Q,q,J);else{if(K=y8[q],S0(Q,K+h8+1,J),X=UY[K],X!==0)q-=PY[K],L0(Q,q,X);if($--,K=zq($),S0(Q,K,Y),X=xQ[K],X!==0)$-=SQ[K],L0(Q,$,X)}while(V<Q.last_lit);S0(Q,OY,J)}function ZY(Q,J){var Y=J.dyn_tree,$=J.stat_desc.static_tree,q=J.stat_desc.has_stree,V=J.stat_desc.elems,K,X,Z=-1,H;Q.heap_len=0,Q.heap_max=Wq;for(K=0;K<V;K++)if(Y[K*2]!==0)Q.heap[++Q.heap_len]=Z=K,Q.depth[K]=0;else Y[K*2+1]=0;while(Q.heap_len<2)if(H=Q.heap[++Q.heap_len]=Z<2?++Z:0,Y[H*2]=1,Q.depth[H]=0,Q.opt_len--,q)Q.static_len-=$[H*2+1];J.max_code=Z;for(K=Q.heap_len>>1;K>=1;K--)WY(Q,Y,K);H=V;do K=Q.heap[1],Q.heap[1]=Q.heap[Q.heap_len--],WY(Q,Y,1),X=Q.heap[1],Q.heap[--Q.heap_max]=K,Q.heap[--Q.heap_max]=X,Y[H*2]=Y[K*2]+Y[X*2],Q.depth[H]=(Q.depth[K]>=Q.depth[X]?Q.depth[K]:Q.depth[X])+1,Y[K*2+1]=Y[X*2+1]=H,Q.heap[1]=H++,WY(Q,Y,1);while(Q.heap_len>=2);Q.heap[--Q.heap_max]=Q.heap[1],tG(Q,J),Nq(Y,Z,Q.bl_count)}function Kq(Q,J,Y){var $,q=-1,V,K=J[1],X=0,Z=7,H=4;if(K===0)Z=138,H=3;J[(Y+1)*2+1]=65535;for($=0;$<=Y;$++){if(V=K,K=J[($+1)*2+1],++X<Z&&V===K)continue;else if(X<H)Q.bl_tree[V*2]+=X;else if(V!==0){if(V!==q)Q.bl_tree[V*2]++;Q.bl_tree[Uq*2]++}else if(X<=10)Q.bl_tree[Zq*2]++;else Q.bl_tree[Lq*2]++;if(X=0,q=V,K===0)Z=138,H=3;else if(V===K)Z=6,H=3;else Z=7,H=4}}function Xq(Q,J,Y){var $,q=-1,V,K=J[1],X=0,Z=7,H=4;if(K===0)Z=138,H=3;for($=0;$<=Y;$++){if(V=K,K=J[($+1)*2+1],++X<Z&&V===K)continue;else if(X<H)do S0(Q,V,Q.bl_tree);while(--X!==0);else if(V!==0){if(V!==q)S0(Q,V,Q.bl_tree),X--;S0(Q,Uq,Q.bl_tree),L0(Q,X-3,2)}else if(X<=10)S0(Q,Zq,Q.bl_tree),L0(Q,X-3,3);else S0(Q,Lq,Q.bl_tree),L0(Q,X-11,7);if(X=0,q=V,K===0)Z=138,H=3;else if(V===K)Z=6,H=3;else Z=7,H=4}}function J9(Q){var J;Kq(Q,Q.dyn_ltree,Q.l_desc.max_code),Kq(Q,Q.dyn_dtree,Q.d_desc.max_code),ZY(Q,Q.bl_desc);for(J=BY-1;J>=3;J--)if(Q.bl_tree[Bq[J]*2+1]!==0)break;return Q.opt_len+=3*(J+1)+5+5+4,J}function Y9(Q,J,Y,$){var q;L0(Q,J-257,5),L0(Q,Y-1,5),L0(Q,$-4,4);for(q=0;q<$;q++)L0(Q,Q.bl_tree[Bq[q]*2+1],3);Xq(Q,Q.dyn_ltree,J-1),Xq(Q,Q.dyn_dtree,Y-1)}function $9(Q){var J=4093624447,Y;for(Y=0;Y<=31;Y++,J>>>=1)if(J&1&&Q.dyn_ltree[Y*2]!==0)return Yq;if(Q.dyn_ltree[18]!==0||Q.dyn_ltree[20]!==0||Q.dyn_ltree[26]!==0)return $q;for(Y=32;Y<h8;Y++)if(Q.dyn_ltree[Y*2]!==0)return $q;return Yq}var Gq=!1;function q9(Q){if(!Gq)eG(),Gq=!0;Q.l_desc=new HY(Q.dyn_ltree,Oq),Q.d_desc=new HY(Q.dyn_dtree,Pq),Q.bl_desc=new HY(Q.bl_tree,jq),Q.bi_buf=0,Q.bi_valid=0,Cq(Q)}function Iq(Q,J,Y,$){L0(Q,(lG<<1)+($?1:0),3),Q9(Q,J,Y,!0)}function V9(Q){L0(Q,Hq<<1,3),S0(Q,OY,i0),sG(Q)}function K9(Q,J,Y,$){var q,V,K=0;if(Q.level>0){if(Q.strm.data_type===pG)Q.strm.data_type=$9(Q);if(ZY(Q,Q.l_desc),ZY(Q,Q.d_desc),K=J9(Q),q=Q.opt_len+3+7>>>3,V=Q.static_len+3+7>>>3,V<=q)q=V}else q=V=Y+5;if(Y+4<=q&&J!==-1)Iq(Q,J,Y,$);else if(Q.strategy===cG||V===q)L0(Q,(Hq<<1)+($?1:0),3),Vq(Q,i0,x8);else L0(Q,(dG<<1)+($?1:0),3),Y9(Q,Q.l_desc.max_code+1,Q.d_desc.max_code+1,K+1),Vq(Q,Q.dyn_ltree,Q.dyn_dtree);if(Cq(Q),$)Rq(Q)}function X9(Q,J,Y){if(Q.pending_buf[Q.d_buf+Q.last_lit*2]=J>>>8&255,Q.pending_buf[Q.d_buf+Q.last_lit*2+1]=J&255,Q.pending_buf[Q.l_buf+Q.last_lit]=Y&255,Q.last_lit++,J===0)Q.dyn_ltree[Y*2]++;else Q.matches++,J--,Q.dyn_ltree[(y8[Y]+h8+1)*2]++,Q.dyn_dtree[zq(J)*2]++;return Q.last_lit===Q.lit_bufsize-1}G9._tr_init=q9;G9._tr_stored_block=Iq;G9._tr_flush_block=K9;G9._tr_tally=X9;G9._tr_align=V9});var jY=E((yL,Aq)=>{function B9(Q,J,Y,$){var q=Q&65535|0,V=Q>>>16&65535|0,K=0;while(Y!==0){K=Y>2000?2000:Y,Y-=K;do q=q+J[$++]|0,V=V+q|0;while(--K);q%=65521,V%=65521}return q|V<<16|0}Aq.exports=B9});var zY=E((gL,Tq)=>{function O9(){var Q,J=[];for(var Y=0;Y<256;Y++){Q=Y;for(var $=0;$<8;$++)Q=Q&1?3988292384^Q>>>1:Q>>>1;J[Y]=Q}return J}var P9=O9();function j9(Q,J,Y,$){var q=P9,V=$+Y;Q^=-1;for(var K=$;K<V;K++)Q=Q>>>8^q[(Q^J[K])&255];return Q^-1}Tq.exports=j9});var kQ=E((hL,Dq)=>{Dq.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 hq=E((a9)=>{var H0=n0(),z0=Mq(),xq=jY(),Y6=zY(),z9=kQ(),N6=0,F9=1,N9=3,X6=4,Eq=5,y0=0,wq=1,F0=-2,C9=-3,FY=-5,R9=-1,I9=1,yQ=2,M9=3,A9=4,T9=0,D9=2,bQ=8,E9=9,w9=15,v9=8,x9=29,S9=256,CY=S9+1+x9,k9=30,y9=19,g9=2*CY+1,h9=15,h=3,V6=258,I0=V6+h+1,_9=32,fQ=42,RY=69,gQ=73,hQ=91,_Q=103,j6=113,b8=666,Y0=1,f8=2,z6=3,i6=4,b9=3;function K6(Q,J){return Q.msg=z9[J],J}function vq(Q){return(Q<<1)-(Q>4?9:0)}function q6(Q){var J=Q.length;while(--J>=0)Q[J]=0}function $6(Q){var J=Q.state,Y=J.pending;if(Y>Q.avail_out)Y=Q.avail_out;if(Y===0)return;if(H0.arraySet(Q.output,J.pending_buf,J.pending_out,Y,Q.next_out),Q.next_out+=Y,J.pending_out+=Y,Q.total_out+=Y,Q.avail_out-=Y,J.pending-=Y,J.pending===0)J.pending_out=0}function X0(Q,J){z0._tr_flush_block(Q,Q.block_start>=0?Q.block_start:-1,Q.strstart-Q.block_start,J),Q.block_start=Q.strstart,$6(Q.strm)}function b(Q,J){Q.pending_buf[Q.pending++]=J}function _8(Q,J){Q.pending_buf[Q.pending++]=J>>>8&255,Q.pending_buf[Q.pending++]=J&255}function f9(Q,J,Y,$){var q=Q.avail_in;if(q>$)q=$;if(q===0)return 0;if(Q.avail_in-=q,H0.arraySet(J,Q.input,Q.next_in,q,Y),Q.state.wrap===1)Q.adler=xq(Q.adler,J,q,Y);else if(Q.state.wrap===2)Q.adler=Y6(Q.adler,J,q,Y);return Q.next_in+=q,Q.total_in+=q,q}function Sq(Q,J){var{max_chain_length:Y,strstart:$}=Q,q,V,K=Q.prev_length,X=Q.nice_match,Z=Q.strstart>Q.w_size-I0?Q.strstart-(Q.w_size-I0):0,H=Q.window,U=Q.w_mask,B=Q.prev,P=Q.strstart+V6,z=H[$+K-1],N=H[$+K];if(Q.prev_length>=Q.good_match)Y>>=2;if(X>Q.lookahead)X=Q.lookahead;do{if(q=J,H[q+K]!==N||H[q+K-1]!==z||H[q]!==H[$]||H[++q]!==H[$+1])continue;$+=2,q++;do;while(H[++$]===H[++q]&&H[++$]===H[++q]&&H[++$]===H[++q]&&H[++$]===H[++q]&&H[++$]===H[++q]&&H[++$]===H[++q]&&H[++$]===H[++q]&&H[++$]===H[++q]&&$<P);if(V=V6-(P-$),$=P-V6,V>K){if(Q.match_start=J,K=V,V>=X)break;z=H[$+K-1],N=H[$+K]}}while((J=B[J&U])>Z&&--Y!==0);if(K<=Q.lookahead)return K;return Q.lookahead}function F6(Q){var J=Q.w_size,Y,$,q,V,K;do{if(V=Q.window_size-Q.lookahead-Q.strstart,Q.strstart>=J+(J-I0)){H0.arraySet(Q.window,Q.window,J,J,0),Q.match_start-=J,Q.strstart-=J,Q.block_start-=J,$=Q.hash_size,Y=$;do q=Q.head[--Y],Q.head[Y]=q>=J?q-J:0;while(--$);$=J,Y=$;do q=Q.prev[--Y],Q.prev[Y]=q>=J?q-J:0;while(--$);V+=J}if(Q.strm.avail_in===0)break;if($=f9(Q.strm,Q.window,Q.strstart+Q.lookahead,V),Q.lookahead+=$,Q.lookahead+Q.insert>=h){K=Q.strstart-Q.insert,Q.ins_h=Q.window[K],Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[K+1])&Q.hash_mask;while(Q.insert)if(Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[K+h-1])&Q.hash_mask,Q.prev[K&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=K,K++,Q.insert--,Q.lookahead+Q.insert<h)break}}while(Q.lookahead<I0&&Q.strm.avail_in!==0)}function m9(Q,J){var Y=65535;if(Y>Q.pending_buf_size-5)Y=Q.pending_buf_size-5;for(;;){if(Q.lookahead<=1){if(F6(Q),Q.lookahead===0&&J===N6)return Y0;if(Q.lookahead===0)break}Q.strstart+=Q.lookahead,Q.lookahead=0;var $=Q.block_start+Y;if(Q.strstart===0||Q.strstart>=$){if(Q.lookahead=Q.strstart-$,Q.strstart=$,X0(Q,!1),Q.strm.avail_out===0)return Y0}if(Q.strstart-Q.block_start>=Q.w_size-I0){if(X0(Q,!1),Q.strm.avail_out===0)return Y0}}if(Q.insert=0,J===X6){if(X0(Q,!0),Q.strm.avail_out===0)return z6;return i6}if(Q.strstart>Q.block_start){if(X0(Q,!1),Q.strm.avail_out===0)return Y0}return Y0}function NY(Q,J){var Y,$;for(;;){if(Q.lookahead<I0){if(F6(Q),Q.lookahead<I0&&J===N6)return Y0;if(Q.lookahead===0)break}if(Y=0,Q.lookahead>=h)Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+h-1])&Q.hash_mask,Y=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;if(Y!==0&&Q.strstart-Y<=Q.w_size-I0)Q.match_length=Sq(Q,Y);if(Q.match_length>=h)if($=z0._tr_tally(Q,Q.strstart-Q.match_start,Q.match_length-h),Q.lookahead-=Q.match_length,Q.match_length<=Q.max_lazy_match&&Q.lookahead>=h){Q.match_length--;do Q.strstart++,Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+h-1])&Q.hash_mask,Y=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;while(--Q.match_length!==0);Q.strstart++}else Q.strstart+=Q.match_length,Q.match_length=0,Q.ins_h=Q.window[Q.strstart],Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+1])&Q.hash_mask;else $=z0._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++;if($){if(X0(Q,!1),Q.strm.avail_out===0)return Y0}}if(Q.insert=Q.strstart<h-1?Q.strstart:h-1,J===X6){if(X0(Q,!0),Q.strm.avail_out===0)return z6;return i6}if(Q.last_lit){if(X0(Q,!1),Q.strm.avail_out===0)return Y0}return f8}function o6(Q,J){var Y,$,q;for(;;){if(Q.lookahead<I0){if(F6(Q),Q.lookahead<I0&&J===N6)return Y0;if(Q.lookahead===0)break}if(Y=0,Q.lookahead>=h)Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+h-1])&Q.hash_mask,Y=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;if(Q.prev_length=Q.match_length,Q.prev_match=Q.match_start,Q.match_length=h-1,Y!==0&&Q.prev_length<Q.max_lazy_match&&Q.strstart-Y<=Q.w_size-I0){if(Q.match_length=Sq(Q,Y),Q.match_length<=5&&(Q.strategy===I9||Q.match_length===h&&Q.strstart-Q.match_start>4096))Q.match_length=h-1}if(Q.prev_length>=h&&Q.match_length<=Q.prev_length){q=Q.strstart+Q.lookahead-h,$=z0._tr_tally(Q,Q.strstart-1-Q.prev_match,Q.prev_length-h),Q.lookahead-=Q.prev_length-1,Q.prev_length-=2;do if(++Q.strstart<=q)Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+h-1])&Q.hash_mask,Y=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;while(--Q.prev_length!==0);if(Q.match_available=0,Q.match_length=h-1,Q.strstart++,$){if(X0(Q,!1),Q.strm.avail_out===0)return Y0}}else if(Q.match_available){if($=z0._tr_tally(Q,0,Q.window[Q.strstart-1]),$)X0(Q,!1);if(Q.strstart++,Q.lookahead--,Q.strm.avail_out===0)return Y0}else Q.match_available=1,Q.strstart++,Q.lookahead--}if(Q.match_available)$=z0._tr_tally(Q,0,Q.window[Q.strstart-1]),Q.match_available=0;if(Q.insert=Q.strstart<h-1?Q.strstart:h-1,J===X6){if(X0(Q,!0),Q.strm.avail_out===0)return z6;return i6}if(Q.last_lit){if(X0(Q,!1),Q.strm.avail_out===0)return Y0}return f8}function u9(Q,J){var Y,$,q,V,K=Q.window;for(;;){if(Q.lookahead<=V6){if(F6(Q),Q.lookahead<=V6&&J===N6)return Y0;if(Q.lookahead===0)break}if(Q.match_length=0,Q.lookahead>=h&&Q.strstart>0){if(q=Q.strstart-1,$=K[q],$===K[++q]&&$===K[++q]&&$===K[++q]){V=Q.strstart+V6;do;while($===K[++q]&&$===K[++q]&&$===K[++q]&&$===K[++q]&&$===K[++q]&&$===K[++q]&&$===K[++q]&&$===K[++q]&&q<V);if(Q.match_length=V6-(V-q),Q.match_length>Q.lookahead)Q.match_length=Q.lookahead}}if(Q.match_length>=h)Y=z0._tr_tally(Q,1,Q.match_length-h),Q.lookahead-=Q.match_length,Q.strstart+=Q.match_length,Q.match_length=0;else Y=z0._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++;if(Y){if(X0(Q,!1),Q.strm.avail_out===0)return Y0}}if(Q.insert=0,J===X6){if(X0(Q,!0),Q.strm.avail_out===0)return z6;return i6}if(Q.last_lit){if(X0(Q,!1),Q.strm.avail_out===0)return Y0}return f8}function c9(Q,J){var Y;for(;;){if(Q.lookahead===0){if(F6(Q),Q.lookahead===0){if(J===N6)return Y0;break}}if(Q.match_length=0,Y=z0._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++,Y){if(X0(Q,!1),Q.strm.avail_out===0)return Y0}}if(Q.insert=0,J===X6){if(X0(Q,!0),Q.strm.avail_out===0)return z6;return i6}if(Q.last_lit){if(X0(Q,!1),Q.strm.avail_out===0)return Y0}return f8}function k0(Q,J,Y,$,q){this.good_length=Q,this.max_lazy=J,this.nice_length=Y,this.max_chain=$,this.func=q}var n6;n6=[new k0(0,0,0,0,m9),new k0(4,4,8,4,NY),new k0(4,5,16,8,NY),new k0(4,6,32,32,NY),new k0(4,4,16,16,o6),new k0(8,16,32,32,o6),new k0(8,16,128,128,o6),new k0(8,32,128,256,o6),new k0(32,128,258,1024,o6),new k0(32,258,258,4096,o6)];function p9(Q){Q.window_size=2*Q.w_size,q6(Q.head),Q.max_lazy_match=n6[Q.level].max_lazy,Q.good_match=n6[Q.level].good_length,Q.nice_match=n6[Q.level].nice_length,Q.max_chain_length=n6[Q.level].max_chain,Q.strstart=0,Q.block_start=0,Q.lookahead=0,Q.insert=0,Q.match_length=Q.prev_length=h-1,Q.match_available=0,Q.ins_h=0}function l9(){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=bQ,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 H0.Buf16(g9*2),this.dyn_dtree=new H0.Buf16((2*k9+1)*2),this.bl_tree=new H0.Buf16((2*y9+1)*2),q6(this.dyn_ltree),q6(this.dyn_dtree),q6(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new H0.Buf16(h9+1),this.heap=new H0.Buf16(2*CY+1),q6(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new H0.Buf16(2*CY+1),q6(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 kq(Q){var J;if(!Q||!Q.state)return K6(Q,F0);if(Q.total_in=Q.total_out=0,Q.data_type=D9,J=Q.state,J.pending=0,J.pending_out=0,J.wrap<0)J.wrap=-J.wrap;return J.status=J.wrap?fQ:j6,Q.adler=J.wrap===2?0:1,J.last_flush=N6,z0._tr_init(J),y0}function yq(Q){var J=kq(Q);if(J===y0)p9(Q.state);return J}function d9(Q,J){if(!Q||!Q.state)return F0;if(Q.state.wrap!==2)return F0;return Q.state.gzhead=J,y0}function gq(Q,J,Y,$,q,V){if(!Q)return F0;var K=1;if(J===R9)J=6;if($<0)K=0,$=-$;else if($>15)K=2,$-=16;if(q<1||q>E9||Y!==bQ||$<8||$>15||J<0||J>9||V<0||V>A9)return K6(Q,F0);if($===8)$=9;var X=new l9;return Q.state=X,X.strm=Q,X.wrap=K,X.gzhead=null,X.w_bits=$,X.w_size=1<<X.w_bits,X.w_mask=X.w_size-1,X.hash_bits=q+7,X.hash_size=1<<X.hash_bits,X.hash_mask=X.hash_size-1,X.hash_shift=~~((X.hash_bits+h-1)/h),X.window=new H0.Buf8(X.w_size*2),X.head=new H0.Buf16(X.hash_size),X.prev=new H0.Buf16(X.w_size),X.lit_bufsize=1<<q+6,X.pending_buf_size=X.lit_bufsize*4,X.pending_buf=new H0.Buf8(X.pending_buf_size),X.d_buf=1*X.lit_bufsize,X.l_buf=3*X.lit_bufsize,X.level=J,X.strategy=V,X.method=Y,yq(Q)}function o9(Q,J){return gq(Q,J,bQ,w9,v9,T9)}function n9(Q,J){var Y,$,q,V;if(!Q||!Q.state||J>Eq||J<0)return Q?K6(Q,F0):F0;if($=Q.state,!Q.output||!Q.input&&Q.avail_in!==0||$.status===b8&&J!==X6)return K6(Q,Q.avail_out===0?FY:F0);if($.strm=Q,Y=$.last_flush,$.last_flush=J,$.status===fQ)if($.wrap===2)if(Q.adler=0,b($,31),b($,139),b($,8),!$.gzhead)b($,0),b($,0),b($,0),b($,0),b($,0),b($,$.level===9?2:$.strategy>=yQ||$.level<2?4:0),b($,b9),$.status=j6;else{if(b($,($.gzhead.text?1:0)+($.gzhead.hcrc?2:0)+(!$.gzhead.extra?0:4)+(!$.gzhead.name?0:8)+(!$.gzhead.comment?0:16)),b($,$.gzhead.time&255),b($,$.gzhead.time>>8&255),b($,$.gzhead.time>>16&255),b($,$.gzhead.time>>24&255),b($,$.level===9?2:$.strategy>=yQ||$.level<2?4:0),b($,$.gzhead.os&255),$.gzhead.extra&&$.gzhead.extra.length)b($,$.gzhead.extra.length&255),b($,$.gzhead.extra.length>>8&255);if($.gzhead.hcrc)Q.adler=Y6(Q.adler,$.pending_buf,$.pending,0);$.gzindex=0,$.status=RY}else{var K=bQ+($.w_bits-8<<4)<<8,X=-1;if($.strategy>=yQ||$.level<2)X=0;else if($.level<6)X=1;else if($.level===6)X=2;else X=3;if(K|=X<<6,$.strstart!==0)K|=_9;if(K+=31-K%31,$.status=j6,_8($,K),$.strstart!==0)_8($,Q.adler>>>16),_8($,Q.adler&65535);Q.adler=1}if($.status===RY)if($.gzhead.extra){q=$.pending;while($.gzindex<($.gzhead.extra.length&65535)){if($.pending===$.pending_buf_size){if($.gzhead.hcrc&&$.pending>q)Q.adler=Y6(Q.adler,$.pending_buf,$.pending-q,q);if($6(Q),q=$.pending,$.pending===$.pending_buf_size)break}b($,$.gzhead.extra[$.gzindex]&255),$.gzindex++}if($.gzhead.hcrc&&$.pending>q)Q.adler=Y6(Q.adler,$.pending_buf,$.pending-q,q);if($.gzindex===$.gzhead.extra.length)$.gzindex=0,$.status=gQ}else $.status=gQ;if($.status===gQ)if($.gzhead.name){q=$.pending;do{if($.pending===$.pending_buf_size){if($.gzhead.hcrc&&$.pending>q)Q.adler=Y6(Q.adler,$.pending_buf,$.pending-q,q);if($6(Q),q=$.pending,$.pending===$.pending_buf_size){V=1;break}}if($.gzindex<$.gzhead.name.length)V=$.gzhead.name.charCodeAt($.gzindex++)&255;else V=0;b($,V)}while(V!==0);if($.gzhead.hcrc&&$.pending>q)Q.adler=Y6(Q.adler,$.pending_buf,$.pending-q,q);if(V===0)$.gzindex=0,$.status=hQ}else $.status=hQ;if($.status===hQ)if($.gzhead.comment){q=$.pending;do{if($.pending===$.pending_buf_size){if($.gzhead.hcrc&&$.pending>q)Q.adler=Y6(Q.adler,$.pending_buf,$.pending-q,q);if($6(Q),q=$.pending,$.pending===$.pending_buf_size){V=1;break}}if($.gzindex<$.gzhead.comment.length)V=$.gzhead.comment.charCodeAt($.gzindex++)&255;else V=0;b($,V)}while(V!==0);if($.gzhead.hcrc&&$.pending>q)Q.adler=Y6(Q.adler,$.pending_buf,$.pending-q,q);if(V===0)$.status=_Q}else $.status=_Q;if($.status===_Q)if($.gzhead.hcrc){if($.pending+2>$.pending_buf_size)$6(Q);if($.pending+2<=$.pending_buf_size)b($,Q.adler&255),b($,Q.adler>>8&255),Q.adler=0,$.status=j6}else $.status=j6;if($.pending!==0){if($6(Q),Q.avail_out===0)return $.last_flush=-1,y0}else if(Q.avail_in===0&&vq(J)<=vq(Y)&&J!==X6)return K6(Q,FY);if($.status===b8&&Q.avail_in!==0)return K6(Q,FY);if(Q.avail_in!==0||$.lookahead!==0||J!==N6&&$.status!==b8){var Z=$.strategy===yQ?c9($,J):$.strategy===M9?u9($,J):n6[$.level].func($,J);if(Z===z6||Z===i6)$.status=b8;if(Z===Y0||Z===z6){if(Q.avail_out===0)$.last_flush=-1;return y0}if(Z===f8){if(J===F9)z0._tr_align($);else if(J!==Eq){if(z0._tr_stored_block($,0,0,!1),J===N9){if(q6($.head),$.lookahead===0)$.strstart=0,$.block_start=0,$.insert=0}}if($6(Q),Q.avail_out===0)return $.last_flush=-1,y0}}if(J!==X6)return y0;if($.wrap<=0)return wq;if($.wrap===2)b($,Q.adler&255),b($,Q.adler>>8&255),b($,Q.adler>>16&255),b($,Q.adler>>24&255),b($,Q.total_in&255),b($,Q.total_in>>8&255),b($,Q.total_in>>16&255),b($,Q.total_in>>24&255);else _8($,Q.adler>>>16),_8($,Q.adler&65535);if($6(Q),$.wrap>0)$.wrap=-$.wrap;return $.pending!==0?y0:wq}function i9(Q){var J;if(!Q||!Q.state)return F0;if(J=Q.state.status,J!==fQ&&J!==RY&&J!==gQ&&J!==hQ&&J!==_Q&&J!==j6&&J!==b8)return K6(Q,F0);return Q.state=null,J===j6?K6(Q,C9):y0}function r9(Q,J){var Y=J.length,$,q,V,K,X,Z,H,U;if(!Q||!Q.state)return F0;if($=Q.state,K=$.wrap,K===2||K===1&&$.status!==fQ||$.lookahead)return F0;if(K===1)Q.adler=xq(Q.adler,J,Y,0);if($.wrap=0,Y>=$.w_size){if(K===0)q6($.head),$.strstart=0,$.block_start=0,$.insert=0;U=new H0.Buf8($.w_size),H0.arraySet(U,J,Y-$.w_size,$.w_size,0),J=U,Y=$.w_size}X=Q.avail_in,Z=Q.next_in,H=Q.input,Q.avail_in=Y,Q.next_in=0,Q.input=J,F6($);while($.lookahead>=h){q=$.strstart,V=$.lookahead-(h-1);do $.ins_h=($.ins_h<<$.hash_shift^$.window[q+h-1])&$.hash_mask,$.prev[q&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=q,q++;while(--V);$.strstart=q,$.lookahead=h-1,F6($)}return $.strstart+=$.lookahead,$.block_start=$.strstart,$.insert=$.lookahead,$.lookahead=0,$.match_length=$.prev_length=h-1,$.match_available=0,Q.next_in=Z,Q.input=H,Q.avail_in=X,$.wrap=K,y0}a9.deflateInit=o9;a9.deflateInit2=gq;a9.deflateReset=yq;a9.deflateResetKeep=kq;a9.deflateSetHeader=d9;a9.deflate=n9;a9.deflateEnd=i9;a9.deflateSetDictionary=r9;a9.deflateInfo="pako deflate (from Nodeca project)"});var IY=E((KH)=>{var mQ=n0(),_q=!0,bq=!0;try{String.fromCharCode.apply(null,[0])}catch(Q){_q=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(Q){bq=!1}var m8=new mQ.Buf8(256);for(g0=0;g0<256;g0++)m8[g0]=g0>=252?6:g0>=248?5:g0>=240?4:g0>=224?3:g0>=192?2:1;var g0;m8[254]=m8[254]=1;KH.string2buf=function(Q){var J,Y,$,q,V,K=Q.length,X=0;for(q=0;q<K;q++){if(Y=Q.charCodeAt(q),(Y&64512)===55296&&q+1<K){if($=Q.charCodeAt(q+1),($&64512)===56320)Y=65536+(Y-55296<<10)+($-56320),q++}X+=Y<128?1:Y<2048?2:Y<65536?3:4}J=new mQ.Buf8(X);for(V=0,q=0;V<X;q++){if(Y=Q.charCodeAt(q),(Y&64512)===55296&&q+1<K){if($=Q.charCodeAt(q+1),($&64512)===56320)Y=65536+(Y-55296<<10)+($-56320),q++}if(Y<128)J[V++]=Y;else if(Y<2048)J[V++]=192|Y>>>6,J[V++]=128|Y&63;else if(Y<65536)J[V++]=224|Y>>>12,J[V++]=128|Y>>>6&63,J[V++]=128|Y&63;else J[V++]=240|Y>>>18,J[V++]=128|Y>>>12&63,J[V++]=128|Y>>>6&63,J[V++]=128|Y&63}return J};function fq(Q,J){if(J<65534){if(Q.subarray&&bq||!Q.subarray&&_q)return String.fromCharCode.apply(null,mQ.shrinkBuf(Q,J))}var Y="";for(var $=0;$<J;$++)Y+=String.fromCharCode(Q[$]);return Y}KH.buf2binstring=function(Q){return fq(Q,Q.length)};KH.binstring2buf=function(Q){var J=new mQ.Buf8(Q.length);for(var Y=0,$=J.length;Y<$;Y++)J[Y]=Q.charCodeAt(Y);return J};KH.buf2string=function(Q,J){var Y,$,q,V,K=J||Q.length,X=Array(K*2);for($=0,Y=0;Y<K;){if(q=Q[Y++],q<128){X[$++]=q;continue}if(V=m8[q],V>4){X[$++]=65533,Y+=V-1;continue}q&=V===2?31:V===3?15:7;while(V>1&&Y<K)q=q<<6|Q[Y++]&63,V--;if(V>1){X[$++]=65533;continue}if(q<65536)X[$++]=q;else q-=65536,X[$++]=55296|q>>10&1023,X[$++]=56320|q&1023}return fq(X,$)};KH.utf8border=function(Q,J){var Y;if(J=J||Q.length,J>Q.length)J=Q.length;Y=J-1;while(Y>=0&&(Q[Y]&192)===128)Y--;if(Y<0)return J;if(Y===0)return J;return Y+m8[Q[Y]]>J?Y:J}});var MY=E((fL,mq)=>{function ZH(){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}mq.exports=ZH});var lq=E((NH)=>{var u8=hq(),c8=n0(),TY=IY(),DY=kQ(),LH=MY(),pq=Object.prototype.toString,BH=0,AY=4,r6=0,uq=1,cq=2,OH=-1,PH=0,jH=8;function C6(Q){if(!(this instanceof C6))return new C6(Q);this.options=c8.assign({level:OH,method:jH,chunkSize:16384,windowBits:15,memLevel:8,strategy:PH,to:""},Q||{});var J=this.options;if(J.raw&&J.windowBits>0)J.windowBits=-J.windowBits;else if(J.gzip&&J.windowBits>0&&J.windowBits<16)J.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new LH,this.strm.avail_out=0;var Y=u8.deflateInit2(this.strm,J.level,J.method,J.windowBits,J.memLevel,J.strategy);if(Y!==r6)throw Error(DY[Y]);if(J.header)u8.deflateSetHeader(this.strm,J.header);if(J.dictionary){var $;if(typeof J.dictionary==="string")$=TY.string2buf(J.dictionary);else if(pq.call(J.dictionary)==="[object ArrayBuffer]")$=new Uint8Array(J.dictionary);else $=J.dictionary;if(Y=u8.deflateSetDictionary(this.strm,$),Y!==r6)throw Error(DY[Y]);this._dict_set=!0}}C6.prototype.push=function(Q,J){var Y=this.strm,$=this.options.chunkSize,q,V;if(this.ended)return!1;if(V=J===~~J?J:J===!0?AY:BH,typeof Q==="string")Y.input=TY.string2buf(Q);else if(pq.call(Q)==="[object ArrayBuffer]")Y.input=new Uint8Array(Q);else Y.input=Q;Y.next_in=0,Y.avail_in=Y.input.length;do{if(Y.avail_out===0)Y.output=new c8.Buf8($),Y.next_out=0,Y.avail_out=$;if(q=u8.deflate(Y,V),q!==uq&&q!==r6)return this.onEnd(q),this.ended=!0,!1;if(Y.avail_out===0||Y.avail_in===0&&(V===AY||V===cq))if(this.options.to==="string")this.onData(TY.buf2binstring(c8.shrinkBuf(Y.output,Y.next_out)));else this.onData(c8.shrinkBuf(Y.output,Y.next_out))}while((Y.avail_in>0||Y.avail_out===0)&&q!==uq);if(V===AY)return q=u8.deflateEnd(this.strm),this.onEnd(q),this.ended=!0,q===r6;if(V===cq)return this.onEnd(r6),Y.avail_out=0,!0;return!0};C6.prototype.onData=function(Q){this.chunks.push(Q)};C6.prototype.onEnd=function(Q){if(Q===r6)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=c8.flattenChunks(this.chunks);this.chunks=[],this.err=Q,this.msg=this.strm.msg};function EY(Q,J){var Y=new C6(J);if(Y.push(Q,!0),Y.err)throw Y.msg||DY[Y.err];return Y.result}function zH(Q,J){return J=J||{},J.raw=!0,EY(Q,J)}function FH(Q,J){return J=J||{},J.gzip=!0,EY(Q,J)}NH.Deflate=C6;NH.deflate=EY;NH.deflateRaw=zH;NH.gzip=FH});var oq=E((uL,dq)=>{var uQ=30,AH=12;dq.exports=function(J,Y){var $,q,V,K,X,Z,H,U,B,P,z,N,j,C,A,M,T,R,D,x,w,v,L,k,I;$=J.state,q=J.next_in,k=J.input,V=q+(J.avail_in-5),K=J.next_out,I=J.output,X=K-(Y-J.avail_out),Z=K+(J.avail_out-257),H=$.dmax,U=$.wsize,B=$.whave,P=$.wnext,z=$.window,N=$.hold,j=$.bits,C=$.lencode,A=$.distcode,M=(1<<$.lenbits)-1,T=(1<<$.distbits)-1;Q:do{if(j<15)N+=k[q++]<<j,j+=8,N+=k[q++]<<j,j+=8;R=C[N&M];J:for(;;){if(D=R>>>24,N>>>=D,j-=D,D=R>>>16&255,D===0)I[K++]=R&65535;else if(D&16){if(x=R&65535,D&=15,D){if(j<D)N+=k[q++]<<j,j+=8;x+=N&(1<<D)-1,N>>>=D,j-=D}if(j<15)N+=k[q++]<<j,j+=8,N+=k[q++]<<j,j+=8;R=A[N&T];Y:for(;;){if(D=R>>>24,N>>>=D,j-=D,D=R>>>16&255,D&16){if(w=R&65535,D&=15,j<D){if(N+=k[q++]<<j,j+=8,j<D)N+=k[q++]<<j,j+=8}if(w+=N&(1<<D)-1,w>H){J.msg="invalid distance too far back",$.mode=uQ;break Q}if(N>>>=D,j-=D,D=K-X,w>D){if(D=w-D,D>B){if($.sane){J.msg="invalid distance too far back",$.mode=uQ;break Q}}if(v=0,L=z,P===0){if(v+=U-D,D<x){x-=D;do I[K++]=z[v++];while(--D);v=K-w,L=I}}else if(P<D){if(v+=U+P-D,D-=P,D<x){x-=D;do I[K++]=z[v++];while(--D);if(v=0,P<x){D=P,x-=D;do I[K++]=z[v++];while(--D);v=K-w,L=I}}}else if(v+=P-D,D<x){x-=D;do I[K++]=z[v++];while(--D);v=K-w,L=I}while(x>2)I[K++]=L[v++],I[K++]=L[v++],I[K++]=L[v++],x-=3;if(x){if(I[K++]=L[v++],x>1)I[K++]=L[v++]}}else{v=K-w;do I[K++]=I[v++],I[K++]=I[v++],I[K++]=I[v++],x-=3;while(x>2);if(x){if(I[K++]=I[v++],x>1)I[K++]=I[v++]}}}else if((D&64)===0){R=A[(R&65535)+(N&(1<<D)-1)];continue Y}else{J.msg="invalid distance code",$.mode=uQ;break Q}break}}else if((D&64)===0){R=C[(R&65535)+(N&(1<<D)-1)];continue J}else if(D&32){$.mode=AH;break Q}else{J.msg="invalid literal/length code",$.mode=uQ;break Q}break}}while(q<V&&K<Z);x=j>>3,q-=x,j-=x<<3,N&=(1<<j)-1,J.next_in=q,J.next_out=K,J.avail_in=q<V?5+(V-q):5-(q-V),J.avail_out=K<Z?257+(Z-K):257-(K-Z),$.hold=N,$.bits=j;return}});var eq=E((cL,tq)=>{var nq=n0(),a6=15,iq=852,rq=592,aq=0,wY=1,sq=2,TH=[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],DH=[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],EH=[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],wH=[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];tq.exports=function(J,Y,$,q,V,K,X,Z){var H=Z.bits,U=0,B=0,P=0,z=0,N=0,j=0,C=0,A=0,M=0,T=0,R,D,x,w,v,L=null,k=0,I,_=new nq.Buf16(a6+1),o=new nq.Buf16(a6+1),i=null,D0=0,y,$0,W0;for(U=0;U<=a6;U++)_[U]=0;for(B=0;B<q;B++)_[Y[$+B]]++;N=H;for(z=a6;z>=1;z--)if(_[z]!==0)break;if(N>z)N=z;if(z===0)return V[K++]=20971520,V[K++]=20971520,Z.bits=1,0;for(P=1;P<z;P++)if(_[P]!==0)break;if(N<P)N=P;A=1;for(U=1;U<=a6;U++)if(A<<=1,A-=_[U],A<0)return-1;if(A>0&&(J===aq||z!==1))return-1;o[1]=0;for(U=1;U<a6;U++)o[U+1]=o[U]+_[U];for(B=0;B<q;B++)if(Y[$+B]!==0)X[o[Y[$+B]]++]=B;if(J===aq)L=i=X,I=19;else if(J===wY)L=TH,k-=257,i=DH,D0-=257,I=256;else L=EH,i=wH,I=-1;if(T=0,B=0,U=P,v=K,j=N,C=0,x=-1,M=1<<N,w=M-1,J===wY&&M>iq||J===sq&&M>rq)return 1;for(;;){if(y=U-C,X[B]<I)$0=0,W0=X[B];else if(X[B]>I)$0=i[D0+X[B]],W0=L[k+X[B]];else $0=96,W0=0;R=1<<U-C,D=1<<j,P=D;do D-=R,V[v+(T>>C)+D]=y<<24|$0<<16|W0|0;while(D!==0);R=1<<U-1;while(T&R)R>>=1;if(R!==0)T&=R-1,T+=R;else T=0;if(B++,--_[U]===0){if(U===z)break;U=Y[$+X[B]]}if(U>N&&(T&w)!==x){if(C===0)C=N;v+=P,j=U-C,A=1<<j;while(j+C<z){if(A-=_[j+C],A<=0)break;j++,A<<=1}if(M+=1<<j,J===wY&&M>iq||J===sq&&M>rq)return 1;x=T&w,V[x]=N<<24|j<<16|v-K|0}}if(T!==0)V[v+T]=U-C<<24|4194304|0;return Z.bits=N,0}});var yV=E((iH)=>{var P0=n0(),gY=jY(),h0=zY(),vH=oq(),p8=eq(),xH=0,AV=1,TV=2,QV=4,SH=5,cQ=6,R6=0,kH=1,yH=2,N0=-2,DV=-3,hY=-4,gH=-5,JV=8,EV=1,YV=2,$V=3,qV=4,VV=5,KV=6,XV=7,GV=8,HV=9,WV=10,dQ=11,r0=12,vY=13,UV=14,xY=15,ZV=16,LV=17,BV=18,OV=19,pQ=20,lQ=21,PV=22,jV=23,zV=24,FV=25,NV=26,SY=27,CV=28,RV=29,d=30,_Y=31,hH=32,_H=852,bH=592,fH=15,mH=fH;function IV(Q){return(Q>>>24&255)+(Q>>>8&65280)+((Q&65280)<<8)+((Q&255)<<24)}function uH(){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 P0.Buf16(320),this.work=new P0.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function wV(Q){var J;if(!Q||!Q.state)return N0;if(J=Q.state,Q.total_in=Q.total_out=J.total=0,Q.msg="",J.wrap)Q.adler=J.wrap&1;return J.mode=EV,J.last=0,J.havedict=0,J.dmax=32768,J.head=null,J.hold=0,J.bits=0,J.lencode=J.lendyn=new P0.Buf32(_H),J.distcode=J.distdyn=new P0.Buf32(bH),J.sane=1,J.back=-1,R6}function vV(Q){var J;if(!Q||!Q.state)return N0;return J=Q.state,J.wsize=0,J.whave=0,J.wnext=0,wV(Q)}function xV(Q,J){var Y,$;if(!Q||!Q.state)return N0;if($=Q.state,J<0)Y=0,J=-J;else if(Y=(J>>4)+1,J<48)J&=15;if(J&&(J<8||J>15))return N0;if($.window!==null&&$.wbits!==J)$.window=null;return $.wrap=Y,$.wbits=J,vV(Q)}function SV(Q,J){var Y,$;if(!Q)return N0;if($=new uH,Q.state=$,$.window=null,Y=xV(Q,J),Y!==R6)Q.state=null;return Y}function cH(Q){return SV(Q,mH)}var MV=!0,kY,yY;function pH(Q){if(MV){var J;kY=new P0.Buf32(512),yY=new P0.Buf32(32),J=0;while(J<144)Q.lens[J++]=8;while(J<256)Q.lens[J++]=9;while(J<280)Q.lens[J++]=7;while(J<288)Q.lens[J++]=8;p8(AV,Q.lens,0,288,kY,0,Q.work,{bits:9}),J=0;while(J<32)Q.lens[J++]=5;p8(TV,Q.lens,0,32,yY,0,Q.work,{bits:5}),MV=!1}Q.lencode=kY,Q.lenbits=9,Q.distcode=yY,Q.distbits=5}function kV(Q,J,Y,$){var q,V=Q.state;if(V.window===null)V.wsize=1<<V.wbits,V.wnext=0,V.whave=0,V.window=new P0.Buf8(V.wsize);if($>=V.wsize)P0.arraySet(V.window,J,Y-V.wsize,V.wsize,0),V.wnext=0,V.whave=V.wsize;else{if(q=V.wsize-V.wnext,q>$)q=$;if(P0.arraySet(V.window,J,Y-$,q,V.wnext),$-=q,$)P0.arraySet(V.window,J,Y-$,$,0),V.wnext=$,V.whave=V.wsize;else{if(V.wnext+=q,V.wnext===V.wsize)V.wnext=0;if(V.whave<V.wsize)V.whave+=q}}return 0}function lH(Q,J){var Y,$,q,V,K,X,Z,H,U,B,P,z,N,j,C=0,A,M,T,R,D,x,w,v,L=new P0.Buf8(4),k,I,_=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!Q||!Q.state||!Q.output||!Q.input&&Q.avail_in!==0)return N0;if(Y=Q.state,Y.mode===r0)Y.mode=vY;K=Q.next_out,q=Q.output,Z=Q.avail_out,V=Q.next_in,$=Q.input,X=Q.avail_in,H=Y.hold,U=Y.bits,B=X,P=Z,v=R6;Q:for(;;)switch(Y.mode){case EV:if(Y.wrap===0){Y.mode=vY;break}while(U<16){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if(Y.wrap&2&&H===35615){Y.check=0,L[0]=H&255,L[1]=H>>>8&255,Y.check=h0(Y.check,L,2,0),H=0,U=0,Y.mode=YV;break}if(Y.flags=0,Y.head)Y.head.done=!1;if(!(Y.wrap&1)||(((H&255)<<8)+(H>>8))%31){Q.msg="incorrect header check",Y.mode=d;break}if((H&15)!==JV){Q.msg="unknown compression method",Y.mode=d;break}if(H>>>=4,U-=4,w=(H&15)+8,Y.wbits===0)Y.wbits=w;else if(w>Y.wbits){Q.msg="invalid window size",Y.mode=d;break}Y.dmax=1<<w,Q.adler=Y.check=1,Y.mode=H&512?WV:r0,H=0,U=0;break;case YV:while(U<16){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if(Y.flags=H,(Y.flags&255)!==JV){Q.msg="unknown compression method",Y.mode=d;break}if(Y.flags&57344){Q.msg="unknown header flags set",Y.mode=d;break}if(Y.head)Y.head.text=H>>8&1;if(Y.flags&512)L[0]=H&255,L[1]=H>>>8&255,Y.check=h0(Y.check,L,2,0);H=0,U=0,Y.mode=$V;case $V:while(U<32){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if(Y.head)Y.head.time=H;if(Y.flags&512)L[0]=H&255,L[1]=H>>>8&255,L[2]=H>>>16&255,L[3]=H>>>24&255,Y.check=h0(Y.check,L,4,0);H=0,U=0,Y.mode=qV;case qV:while(U<16){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if(Y.head)Y.head.xflags=H&255,Y.head.os=H>>8;if(Y.flags&512)L[0]=H&255,L[1]=H>>>8&255,Y.check=h0(Y.check,L,2,0);H=0,U=0,Y.mode=VV;case VV:if(Y.flags&1024){while(U<16){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if(Y.length=H,Y.head)Y.head.extra_len=H;if(Y.flags&512)L[0]=H&255,L[1]=H>>>8&255,Y.check=h0(Y.check,L,2,0);H=0,U=0}else if(Y.head)Y.head.extra=null;Y.mode=KV;case KV:if(Y.flags&1024){if(z=Y.length,z>X)z=X;if(z){if(Y.head){if(w=Y.head.extra_len-Y.length,!Y.head.extra)Y.head.extra=Array(Y.head.extra_len);P0.arraySet(Y.head.extra,$,V,z,w)}if(Y.flags&512)Y.check=h0(Y.check,$,z,V);X-=z,V+=z,Y.length-=z}if(Y.length)break Q}Y.length=0,Y.mode=XV;case XV:if(Y.flags&2048){if(X===0)break Q;z=0;do if(w=$[V+z++],Y.head&&w&&Y.length<65536)Y.head.name+=String.fromCharCode(w);while(w&&z<X);if(Y.flags&512)Y.check=h0(Y.check,$,z,V);if(X-=z,V+=z,w)break Q}else if(Y.head)Y.head.name=null;Y.length=0,Y.mode=GV;case GV:if(Y.flags&4096){if(X===0)break Q;z=0;do if(w=$[V+z++],Y.head&&w&&Y.length<65536)Y.head.comment+=String.fromCharCode(w);while(w&&z<X);if(Y.flags&512)Y.check=h0(Y.check,$,z,V);if(X-=z,V+=z,w)break Q}else if(Y.head)Y.head.comment=null;Y.mode=HV;case HV:if(Y.flags&512){while(U<16){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if(H!==(Y.check&65535)){Q.msg="header crc mismatch",Y.mode=d;break}H=0,U=0}if(Y.head)Y.head.hcrc=Y.flags>>9&1,Y.head.done=!0;Q.adler=Y.check=0,Y.mode=r0;break;case WV:while(U<32){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}Q.adler=Y.check=IV(H),H=0,U=0,Y.mode=dQ;case dQ:if(Y.havedict===0)return Q.next_out=K,Q.avail_out=Z,Q.next_in=V,Q.avail_in=X,Y.hold=H,Y.bits=U,yH;Q.adler=Y.check=1,Y.mode=r0;case r0:if(J===SH||J===cQ)break Q;case vY:if(Y.last){H>>>=U&7,U-=U&7,Y.mode=SY;break}while(U<3){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}switch(Y.last=H&1,H>>>=1,U-=1,H&3){case 0:Y.mode=UV;break;case 1:if(pH(Y),Y.mode=pQ,J===cQ){H>>>=2,U-=2;break Q}break;case 2:Y.mode=LV;break;case 3:Q.msg="invalid block type",Y.mode=d}H>>>=2,U-=2;break;case UV:H>>>=U&7,U-=U&7;while(U<32){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if((H&65535)!==(H>>>16^65535)){Q.msg="invalid stored block lengths",Y.mode=d;break}if(Y.length=H&65535,H=0,U=0,Y.mode=xY,J===cQ)break Q;case xY:Y.mode=ZV;case ZV:if(z=Y.length,z){if(z>X)z=X;if(z>Z)z=Z;if(z===0)break Q;P0.arraySet(q,$,V,z,K),X-=z,V+=z,Z-=z,K+=z,Y.length-=z;break}Y.mode=r0;break;case LV:while(U<14){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if(Y.nlen=(H&31)+257,H>>>=5,U-=5,Y.ndist=(H&31)+1,H>>>=5,U-=5,Y.ncode=(H&15)+4,H>>>=4,U-=4,Y.nlen>286||Y.ndist>30){Q.msg="too many length or distance symbols",Y.mode=d;break}Y.have=0,Y.mode=BV;case BV:while(Y.have<Y.ncode){while(U<3){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}Y.lens[_[Y.have++]]=H&7,H>>>=3,U-=3}while(Y.have<19)Y.lens[_[Y.have++]]=0;if(Y.lencode=Y.lendyn,Y.lenbits=7,k={bits:Y.lenbits},v=p8(xH,Y.lens,0,19,Y.lencode,0,Y.work,k),Y.lenbits=k.bits,v){Q.msg="invalid code lengths set",Y.mode=d;break}Y.have=0,Y.mode=OV;case OV:while(Y.have<Y.nlen+Y.ndist){for(;;){if(C=Y.lencode[H&(1<<Y.lenbits)-1],A=C>>>24,M=C>>>16&255,T=C&65535,A<=U)break;if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if(T<16)H>>>=A,U-=A,Y.lens[Y.have++]=T;else{if(T===16){I=A+2;while(U<I){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if(H>>>=A,U-=A,Y.have===0){Q.msg="invalid bit length repeat",Y.mode=d;break}w=Y.lens[Y.have-1],z=3+(H&3),H>>>=2,U-=2}else if(T===17){I=A+3;while(U<I){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}H>>>=A,U-=A,w=0,z=3+(H&7),H>>>=3,U-=3}else{I=A+7;while(U<I){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}H>>>=A,U-=A,w=0,z=11+(H&127),H>>>=7,U-=7}if(Y.have+z>Y.nlen+Y.ndist){Q.msg="invalid bit length repeat",Y.mode=d;break}while(z--)Y.lens[Y.have++]=w}}if(Y.mode===d)break;if(Y.lens[256]===0){Q.msg="invalid code -- missing end-of-block",Y.mode=d;break}if(Y.lenbits=9,k={bits:Y.lenbits},v=p8(AV,Y.lens,0,Y.nlen,Y.lencode,0,Y.work,k),Y.lenbits=k.bits,v){Q.msg="invalid literal/lengths set",Y.mode=d;break}if(Y.distbits=6,Y.distcode=Y.distdyn,k={bits:Y.distbits},v=p8(TV,Y.lens,Y.nlen,Y.ndist,Y.distcode,0,Y.work,k),Y.distbits=k.bits,v){Q.msg="invalid distances set",Y.mode=d;break}if(Y.mode=pQ,J===cQ)break Q;case pQ:Y.mode=lQ;case lQ:if(X>=6&&Z>=258){if(Q.next_out=K,Q.avail_out=Z,Q.next_in=V,Q.avail_in=X,Y.hold=H,Y.bits=U,vH(Q,P),K=Q.next_out,q=Q.output,Z=Q.avail_out,V=Q.next_in,$=Q.input,X=Q.avail_in,H=Y.hold,U=Y.bits,Y.mode===r0)Y.back=-1;break}Y.back=0;for(;;){if(C=Y.lencode[H&(1<<Y.lenbits)-1],A=C>>>24,M=C>>>16&255,T=C&65535,A<=U)break;if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if(M&&(M&240)===0){R=A,D=M,x=T;for(;;){if(C=Y.lencode[x+((H&(1<<R+D)-1)>>R)],A=C>>>24,M=C>>>16&255,T=C&65535,R+A<=U)break;if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}H>>>=R,U-=R,Y.back+=R}if(H>>>=A,U-=A,Y.back+=A,Y.length=T,M===0){Y.mode=NV;break}if(M&32){Y.back=-1,Y.mode=r0;break}if(M&64){Q.msg="invalid literal/length code",Y.mode=d;break}Y.extra=M&15,Y.mode=PV;case PV:if(Y.extra){I=Y.extra;while(U<I){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}Y.length+=H&(1<<Y.extra)-1,H>>>=Y.extra,U-=Y.extra,Y.back+=Y.extra}Y.was=Y.length,Y.mode=jV;case jV:for(;;){if(C=Y.distcode[H&(1<<Y.distbits)-1],A=C>>>24,M=C>>>16&255,T=C&65535,A<=U)break;if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if((M&240)===0){R=A,D=M,x=T;for(;;){if(C=Y.distcode[x+((H&(1<<R+D)-1)>>R)],A=C>>>24,M=C>>>16&255,T=C&65535,R+A<=U)break;if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}H>>>=R,U-=R,Y.back+=R}if(H>>>=A,U-=A,Y.back+=A,M&64){Q.msg="invalid distance code",Y.mode=d;break}Y.offset=T,Y.extra=M&15,Y.mode=zV;case zV:if(Y.extra){I=Y.extra;while(U<I){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}Y.offset+=H&(1<<Y.extra)-1,H>>>=Y.extra,U-=Y.extra,Y.back+=Y.extra}if(Y.offset>Y.dmax){Q.msg="invalid distance too far back",Y.mode=d;break}Y.mode=FV;case FV:if(Z===0)break Q;if(z=P-Z,Y.offset>z){if(z=Y.offset-z,z>Y.whave){if(Y.sane){Q.msg="invalid distance too far back",Y.mode=d;break}}if(z>Y.wnext)z-=Y.wnext,N=Y.wsize-z;else N=Y.wnext-z;if(z>Y.length)z=Y.length;j=Y.window}else j=q,N=K-Y.offset,z=Y.length;if(z>Z)z=Z;Z-=z,Y.length-=z;do q[K++]=j[N++];while(--z);if(Y.length===0)Y.mode=lQ;break;case NV:if(Z===0)break Q;q[K++]=Y.length,Z--,Y.mode=lQ;break;case SY:if(Y.wrap){while(U<32){if(X===0)break Q;X--,H|=$[V++]<<U,U+=8}if(P-=Z,Q.total_out+=P,Y.total+=P,P)Q.adler=Y.check=Y.flags?h0(Y.check,q,P,K-P):gY(Y.check,q,P,K-P);if(P=Z,(Y.flags?H:IV(H))!==Y.check){Q.msg="incorrect data check",Y.mode=d;break}H=0,U=0}Y.mode=CV;case CV:if(Y.wrap&&Y.flags){while(U<32){if(X===0)break Q;X--,H+=$[V++]<<U,U+=8}if(H!==(Y.total&4294967295)){Q.msg="incorrect length check",Y.mode=d;break}H=0,U=0}Y.mode=RV;case RV:v=kH;break Q;case d:v=DV;break Q;case _Y:return hY;case hH:default:return N0}if(Q.next_out=K,Q.avail_out=Z,Q.next_in=V,Q.avail_in=X,Y.hold=H,Y.bits=U,Y.wsize||P!==Q.avail_out&&Y.mode<d&&(Y.mode<SY||J!==QV)){if(kV(Q,Q.output,Q.next_out,P-Q.avail_out))return Y.mode=_Y,hY}if(B-=Q.avail_in,P-=Q.avail_out,Q.total_in+=B,Q.total_out+=P,Y.total+=P,Y.wrap&&P)Q.adler=Y.check=Y.flags?h0(Y.check,q,P,Q.next_out-P):gY(Y.check,q,P,Q.next_out-P);if(Q.data_type=Y.bits+(Y.last?64:0)+(Y.mode===r0?128:0)+(Y.mode===pQ||Y.mode===xY?256:0),(B===0&&P===0||J===QV)&&v===R6)v=gH;return v}function dH(Q){if(!Q||!Q.state)return N0;var J=Q.state;if(J.window)J.window=null;return Q.state=null,R6}function oH(Q,J){var Y;if(!Q||!Q.state)return N0;if(Y=Q.state,(Y.wrap&2)===0)return N0;return Y.head=J,J.done=!1,R6}function nH(Q,J){var Y=J.length,$,q,V;if(!Q||!Q.state)return N0;if($=Q.state,$.wrap!==0&&$.mode!==dQ)return N0;if($.mode===dQ){if(q=1,q=gY(q,J,Y,0),q!==$.check)return DV}if(V=kV(Q,J,Y,Y),V)return $.mode=_Y,hY;return $.havedict=1,R6}iH.inflateReset=vV;iH.inflateReset2=xV;iH.inflateResetKeep=wV;iH.inflateInit=cH;iH.inflateInit2=SV;iH.inflate=lH;iH.inflateEnd=dH;iH.inflateGetHeader=oH;iH.inflateSetDictionary=nH;iH.inflateInfo="pako inflate (from Nodeca project)"});var bY=E((lL,gV)=>{gV.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 _V=E((dL,hV)=>{function VW(){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}hV.exports=VW});var fV=E((HW)=>{var s6=yV(),l8=n0(),oQ=IY(),s=bY(),fY=kQ(),KW=MY(),XW=_V(),bV=Object.prototype.toString;function I6(Q){if(!(this instanceof I6))return new I6(Q);this.options=l8.assign({chunkSize:16384,windowBits:0,to:""},Q||{});var J=this.options;if(J.raw&&J.windowBits>=0&&J.windowBits<16){if(J.windowBits=-J.windowBits,J.windowBits===0)J.windowBits=-15}if(J.windowBits>=0&&J.windowBits<16&&!(Q&&Q.windowBits))J.windowBits+=32;if(J.windowBits>15&&J.windowBits<48){if((J.windowBits&15)===0)J.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new KW,this.strm.avail_out=0;var Y=s6.inflateInit2(this.strm,J.windowBits);if(Y!==s.Z_OK)throw Error(fY[Y]);if(this.header=new XW,s6.inflateGetHeader(this.strm,this.header),J.dictionary){if(typeof J.dictionary==="string")J.dictionary=oQ.string2buf(J.dictionary);else if(bV.call(J.dictionary)==="[object ArrayBuffer]")J.dictionary=new Uint8Array(J.dictionary);if(J.raw){if(Y=s6.inflateSetDictionary(this.strm,J.dictionary),Y!==s.Z_OK)throw Error(fY[Y])}}}I6.prototype.push=function(Q,J){var Y=this.strm,$=this.options.chunkSize,q=this.options.dictionary,V,K,X,Z,H,U=!1;if(this.ended)return!1;if(K=J===~~J?J:J===!0?s.Z_FINISH:s.Z_NO_FLUSH,typeof Q==="string")Y.input=oQ.binstring2buf(Q);else if(bV.call(Q)==="[object ArrayBuffer]")Y.input=new Uint8Array(Q);else Y.input=Q;Y.next_in=0,Y.avail_in=Y.input.length;do{if(Y.avail_out===0)Y.output=new l8.Buf8($),Y.next_out=0,Y.avail_out=$;if(V=s6.inflate(Y,s.Z_NO_FLUSH),V===s.Z_NEED_DICT&&q)V=s6.inflateSetDictionary(this.strm,q);if(V===s.Z_BUF_ERROR&&U===!0)V=s.Z_OK,U=!1;if(V!==s.Z_STREAM_END&&V!==s.Z_OK)return this.onEnd(V),this.ended=!0,!1;if(Y.next_out){if(Y.avail_out===0||V===s.Z_STREAM_END||Y.avail_in===0&&(K===s.Z_FINISH||K===s.Z_SYNC_FLUSH))if(this.options.to==="string"){if(X=oQ.utf8border(Y.output,Y.next_out),Z=Y.next_out-X,H=oQ.buf2string(Y.output,X),Y.next_out=Z,Y.avail_out=$-Z,Z)l8.arraySet(Y.output,Y.output,X,Z,0);this.onData(H)}else this.onData(l8.shrinkBuf(Y.output,Y.next_out))}if(Y.avail_in===0&&Y.avail_out===0)U=!0}while((Y.avail_in>0||Y.avail_out===0)&&V!==s.Z_STREAM_END);if(V===s.Z_STREAM_END)K=s.Z_FINISH;if(K===s.Z_FINISH)return V=s6.inflateEnd(this.strm),this.onEnd(V),this.ended=!0,V===s.Z_OK;if(K===s.Z_SYNC_FLUSH)return this.onEnd(s.Z_OK),Y.avail_out=0,!0;return!0};I6.prototype.onData=function(Q){this.chunks.push(Q)};I6.prototype.onEnd=function(Q){if(Q===s.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=l8.flattenChunks(this.chunks);this.chunks=[],this.err=Q,this.msg=this.strm.msg};function mY(Q,J){var Y=new I6(J);if(Y.push(Q,!0),Y.err)throw Y.msg||fY[Y.err];return Y.result}function GW(Q,J){return J=J||{},J.raw=!0,mY(Q,J)}HW.Inflate=I6;HW.inflate=mY;HW.inflateRaw=GW;HW.ungzip=mY});var cV=E((nL,uV)=>{var BW=n0().assign,OW=lq(),PW=fV(),jW=bY(),mV={};BW(mV,OW,PW,jW);uV.exports=mV});var lV=E((CW)=>{var zW=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",FW=cV(),pV=n(),nQ=O0(),NW=zW?"uint8array":"array";CW.magic="\b\x00";function M6(Q,J){nQ.call(this,"FlateWorker/"+Q),this._pako=null,this._pakoAction=Q,this._pakoOptions=J,this.meta={}}pV.inherits(M6,nQ);M6.prototype.processChunk=function(Q){if(this.meta=Q.meta,this._pako===null)this._createPako();this._pako.push(pV.transformTo(NW,Q.data),!1)};M6.prototype.flush=function(){if(nQ.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};M6.prototype.cleanUp=function(){nQ.prototype.cleanUp.call(this),this._pako=null};M6.prototype._createPako=function(){this._pako=new FW[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var Q=this;this._pako.onData=function(J){Q.push({data:J,meta:Q.meta})}};CW.compressWorker=function(Q){return new M6("Deflate",Q)};CW.uncompressWorker=function(){return new M6("Inflate",{})}});var uY=E((AW)=>{var dV=O0();AW.STORE={magic:"\x00\x00",compressWorker:function(){return new dV("STORE compression")},uncompressWorker:function(){return new dV("STORE decompression")}};AW.DEFLATE=lV()});var cY=E((EW)=>{EW.LOCAL_FILE_HEADER="PK\x03\x04";EW.CENTRAL_FILE_HEADER="PK\x01\x02";EW.CENTRAL_DIRECTORY_END="PK\x05\x06";EW.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";EW.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";EW.DATA_DESCRIPTOR="PK\x07\b"});var rV=E((sL,iV)=>{var t6=n(),e6=O0(),pY=c6(),oV=wQ(),iQ=cY(),p=function(Q,J){var Y="",$;for($=0;$<J;$++)Y+=String.fromCharCode(Q&255),Q=Q>>>8;return Y},gW=function(Q,J){var Y=Q;if(!Q)Y=J?16893:33204;return(Y&65535)<<16},hW=function(Q){return(Q||0)&63},nV=function(Q,J,Y,$,q,V){var{file:K,compression:X}=Q,Z=V!==pY.utf8encode,H=t6.transformTo("string",V(K.name)),U=t6.transformTo("string",pY.utf8encode(K.name)),B=K.comment,P=t6.transformTo("string",V(B)),z=t6.transformTo("string",pY.utf8encode(B)),N=U.length!==K.name.length,j=z.length!==B.length,C,A,M="",T="",R="",D=K.dir,x=K.date,w={crc32:0,compressedSize:0,uncompressedSize:0};if(!J||Y)w.crc32=Q.crc32,w.compressedSize=Q.compressedSize,w.uncompressedSize=Q.uncompressedSize;var v=0;if(J)v|=8;if(!Z&&(N||j))v|=2048;var L=0,k=0;if(D)L|=16;if(q==="UNIX")k=798,L|=gW(K.unixPermissions,D);else k=20,L|=hW(K.dosPermissions,D);if(C=x.getUTCHours(),C=C<<6,C=C|x.getUTCMinutes(),C=C<<5,C=C|x.getUTCSeconds()/2,A=x.getUTCFullYear()-1980,A=A<<4,A=A|x.getUTCMonth()+1,A=A<<5,A=A|x.getUTCDate(),N)T=p(1,1)+p(oV(H),4)+U,M+="up"+p(T.length,2)+T;if(j)R=p(1,1)+p(oV(P),4)+z,M+="uc"+p(R.length,2)+R;var I="";I+=`
12
+ \x00`,I+=p(v,2),I+=X.magic,I+=p(C,2),I+=p(A,2),I+=p(w.crc32,4),I+=p(w.compressedSize,4),I+=p(w.uncompressedSize,4),I+=p(H.length,2),I+=p(M.length,2);var _=iQ.LOCAL_FILE_HEADER+I+H+M,o=iQ.CENTRAL_FILE_HEADER+p(k,2)+I+p(P.length,2)+"\x00\x00\x00\x00"+p(L,4)+p($,4)+H+M+P;return{fileRecord:_,dirRecord:o}},_W=function(Q,J,Y,$,q){var V="",K=t6.transformTo("string",q($));return V=iQ.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+p(Q,2)+p(Q,2)+p(J,4)+p(Y,4)+p(K.length,2)+K,V},bW=function(Q){var J="";return J=iQ.DATA_DESCRIPTOR+p(Q.crc32,4)+p(Q.compressedSize,4)+p(Q.uncompressedSize,4),J};function M0(Q,J,Y,$){e6.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=J,this.zipPlatform=Y,this.encodeFileName=$,this.streamFiles=Q,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}t6.inherits(M0,e6);M0.prototype.push=function(Q){var J=Q.meta.percent||0,Y=this.entriesCount,$=this._sources.length;if(this.accumulate)this.contentBuffer.push(Q);else this.bytesWritten+=Q.data.length,e6.prototype.push.call(this,{data:Q.data,meta:{currentFile:this.currentFile,percent:Y?(J+100*(Y-$-1))/Y:100}})};M0.prototype.openedSource=function(Q){this.currentSourceOffset=this.bytesWritten,this.currentFile=Q.file.name;var J=this.streamFiles&&!Q.file.dir;if(J){var Y=nV(Q,J,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:Y.fileRecord,meta:{percent:0}})}else this.accumulate=!0};M0.prototype.closedSource=function(Q){this.accumulate=!1;var J=this.streamFiles&&!Q.file.dir,Y=nV(Q,J,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(Y.dirRecord),J)this.push({data:bW(Q),meta:{percent:100}});else{this.push({data:Y.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};M0.prototype.flush=function(){var Q=this.bytesWritten;for(var J=0;J<this.dirRecords.length;J++)this.push({data:this.dirRecords[J],meta:{percent:100}});var Y=this.bytesWritten-Q,$=_W(this.dirRecords.length,Y,Q,this.zipComment,this.encodeFileName);this.push({data:$,meta:{percent:100}})};M0.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};M0.prototype.registerPrevious=function(Q){this._sources.push(Q);var J=this;return Q.on("data",function(Y){J.processChunk(Y)}),Q.on("end",function(){if(J.closedSource(J.previous.streamInfo),J._sources.length)J.prepareNextSource();else J.end()}),Q.on("error",function(Y){J.error(Y)}),this};M0.prototype.resume=function(){if(!e6.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};M0.prototype.error=function(Q){var J=this._sources;if(!e6.prototype.error.call(this,Q))return!1;for(var Y=0;Y<J.length;Y++)try{J[Y].error(Q)}catch($){}return!0};M0.prototype.lock=function(){e6.prototype.lock.call(this);var Q=this._sources;for(var J=0;J<Q.length;J++)Q[J].lock()};iV.exports=M0});var aV=E((cW)=>{var fW=uY(),mW=rV(),uW=function(Q,J){var Y=Q||J,$=fW[Y];if(!$)throw Error(Y+" is not a valid compression method !");return $};cW.generateWorker=function(Q,J,Y){var $=new mW(J.streamFiles,Y,J.platform,J.encodeFileName),q=0;try{Q.forEach(function(V,K){q++;var X=uW(K.options.compression,J.compression),Z=K.options.compressionOptions||J.compressionOptions||{},H=K.dir,U=K.date;K._compressWorker(X,Z).withStreamInfo("file",{name:V,dir:H,date:U,comment:K.comment||"",unixPermissions:K.unixPermissions,dosPermissions:K.dosPermissions}).pipe($)}),$.entriesCount=q}catch(V){$.error(V)}return $}});var tV=E((eL,sV)=>{var lW=n(),rQ=O0();function d8(Q,J){rQ.call(this,"Nodejs stream input adapter for "+Q),this._upstreamEnded=!1,this._bindStream(J)}lW.inherits(d8,rQ);d8.prototype._bindStream=function(Q){var J=this;this._stream=Q,Q.pause(),Q.on("data",function(Y){J.push({data:Y,meta:{percent:0}})}).on("error",function(Y){if(J.isPaused)this.generatedError=Y;else J.error(Y)}).on("end",function(){if(J.isPaused)J._upstreamEnded=!0;else J.end()})};d8.prototype.pause=function(){if(!rQ.prototype.pause.call(this))return!1;return this._stream.pause(),!0};d8.prototype.resume=function(){if(!rQ.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};sV.exports=d8});var G7=E((QB,X7)=>{var dW=c6(),o8=n(),Y7=O0(),oW=nJ(),$7=iJ(),eV=vQ(),nW=Qq(),iW=aV(),Q7=M8(),rW=tV(),q7=function(Q,J,Y){var $=o8.getTypeOf(J),q,V=o8.extend(Y||{},$7);if(V.date=V.date||new Date,V.compression!==null)V.compression=V.compression.toUpperCase();if(typeof V.unixPermissions==="string")V.unixPermissions=parseInt(V.unixPermissions,8);if(V.unixPermissions&&V.unixPermissions&16384)V.dir=!0;if(V.dosPermissions&&V.dosPermissions&16)V.dir=!0;if(V.dir)Q=V7(Q);if(V.createFolders&&(q=aW(Q)))K7.call(this,q,!0);var K=$==="string"&&V.binary===!1&&V.base64===!1;if(!Y||typeof Y.binary>"u")V.binary=!K;var X=J instanceof eV&&J.uncompressedSize===0;if(X||V.dir||!J||J.length===0)V.base64=!1,V.binary=!0,J="",V.compression="STORE",$="string";var Z=null;if(J instanceof eV||J instanceof Y7)Z=J;else if(Q7.isNode&&Q7.isStream(J))Z=new rW(Q,J);else Z=o8.prepareContent(Q,J,V.binary,V.optimizedBinaryString,V.base64);var H=new nW(Q,Z,V);this.files[Q]=H},aW=function(Q){if(Q.slice(-1)==="/")Q=Q.substring(0,Q.length-1);var J=Q.lastIndexOf("/");return J>0?Q.substring(0,J):""},V7=function(Q){if(Q.slice(-1)!=="/")Q+="/";return Q},K7=function(Q,J){if(J=typeof J<"u"?J:$7.createFolders,Q=V7(Q),!this.files[Q])q7.call(this,Q,null,{dir:!0,createFolders:J});return this.files[Q]};function J7(Q){return Object.prototype.toString.call(Q)==="[object RegExp]"}var sW={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(Q){var J,Y,$;for(J in this.files)if($=this.files[J],Y=J.slice(this.root.length,J.length),Y&&J.slice(0,this.root.length)===this.root)Q(Y,$)},filter:function(Q){var J=[];return this.forEach(function(Y,$){if(Q(Y,$))J.push($)}),J},file:function(Q,J,Y){if(arguments.length===1)if(J7(Q)){var $=Q;return this.filter(function(V,K){return!K.dir&&$.test(V)})}else{var q=this.files[this.root+Q];if(q&&!q.dir)return q;else return null}else Q=this.root+Q,q7.call(this,Q,J,Y);return this},folder:function(Q){if(!Q)return this;if(J7(Q))return this.filter(function(q,V){return V.dir&&Q.test(q)});var J=this.root+Q,Y=K7.call(this,J),$=this.clone();return $.root=Y.name,$},remove:function(Q){Q=this.root+Q;var J=this.files[Q];if(!J){if(Q.slice(-1)!=="/")Q+="/";J=this.files[Q]}if(J&&!J.dir)delete this.files[Q];else{var Y=this.filter(function(q,V){return V.name.slice(0,Q.length)===Q});for(var $=0;$<Y.length;$++)delete this.files[Y[$].name]}return this},generate:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(Q){var J,Y={};try{if(Y=o8.extend(Q||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:dW.utf8encode}),Y.type=Y.type.toLowerCase(),Y.compression=Y.compression.toUpperCase(),Y.type==="binarystring")Y.type="string";if(!Y.type)throw Error("No output type specified.");if(o8.checkSupport(Y.type),Y.platform==="darwin"||Y.platform==="freebsd"||Y.platform==="linux"||Y.platform==="sunos")Y.platform="UNIX";if(Y.platform==="win32")Y.platform="DOS";var $=Y.comment||this.comment||"";J=iW.generateWorker(this,Y,$)}catch(q){J=new Y7("error"),J.error(q)}return new oW(J,Y.type||"string",Y.mimeType)},generateAsync:function(Q,J){return this.generateInternalStream(Q).accumulate(J)},generateNodeStream:function(Q,J){if(Q=Q||{},!Q.type)Q.type="nodebuffer";return this.generateInternalStream(Q).toNodejsStream(J)}};X7.exports=sW});var lY=E((JB,W7)=>{var tW=n();function H7(Q){this.data=Q,this.length=Q.length,this.index=0,this.zero=0}H7.prototype={checkOffset:function(Q){this.checkIndex(this.index+Q)},checkIndex:function(Q){if(this.length<this.zero+Q||Q<0)throw Error("End of data reached (data length = "+this.length+", asked index = "+Q+"). Corrupted zip ?")},setIndex:function(Q){this.checkIndex(Q),this.index=Q},skip:function(Q){this.setIndex(this.index+Q)},byteAt:function(){},readInt:function(Q){var J=0,Y;this.checkOffset(Q);for(Y=this.index+Q-1;Y>=this.index;Y--)J=(J<<8)+this.byteAt(Y);return this.index+=Q,J},readString:function(Q){return tW.transformTo("string",this.readData(Q))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var Q=this.readInt(4);return new Date(Date.UTC((Q>>25&127)+1980,(Q>>21&15)-1,Q>>16&31,Q>>11&31,Q>>5&63,(Q&31)<<1))}};W7.exports=H7});var dY=E((YB,Z7)=>{var U7=lY(),eW=n();function Q8(Q){U7.call(this,Q);for(var J=0;J<this.data.length;J++)Q[J]=Q[J]&255}eW.inherits(Q8,U7);Q8.prototype.byteAt=function(Q){return this.data[this.zero+Q]};Q8.prototype.lastIndexOfSignature=function(Q){var J=Q.charCodeAt(0),Y=Q.charCodeAt(1),$=Q.charCodeAt(2),q=Q.charCodeAt(3);for(var V=this.length-4;V>=0;--V)if(this.data[V]===J&&this.data[V+1]===Y&&this.data[V+2]===$&&this.data[V+3]===q)return V-this.zero;return-1};Q8.prototype.readAndCheckSignature=function(Q){var J=Q.charCodeAt(0),Y=Q.charCodeAt(1),$=Q.charCodeAt(2),q=Q.charCodeAt(3),V=this.readData(4);return J===V[0]&&Y===V[1]&&$===V[2]&&q===V[3]};Q8.prototype.readData=function(Q){if(this.checkOffset(Q),Q===0)return[];var J=this.data.slice(this.zero+this.index,this.zero+this.index+Q);return this.index+=Q,J};Z7.exports=Q8});var O7=E(($B,B7)=>{var L7=lY(),Q3=n();function J8(Q){L7.call(this,Q)}Q3.inherits(J8,L7);J8.prototype.byteAt=function(Q){return this.data.charCodeAt(this.zero+Q)};J8.prototype.lastIndexOfSignature=function(Q){return this.data.lastIndexOf(Q)-this.zero};J8.prototype.readAndCheckSignature=function(Q){var J=this.readData(4);return Q===J};J8.prototype.readData=function(Q){this.checkOffset(Q);var J=this.data.slice(this.zero+this.index,this.zero+this.index+Q);return this.index+=Q,J};B7.exports=J8});var nY=E((qB,j7)=>{var P7=dY(),J3=n();function oY(Q){P7.call(this,Q)}J3.inherits(oY,P7);oY.prototype.readData=function(Q){if(this.checkOffset(Q),Q===0)return new Uint8Array(0);var J=this.data.subarray(this.zero+this.index,this.zero+this.index+Q);return this.index+=Q,J};j7.exports=oY});var N7=E((VB,F7)=>{var z7=nY(),Y3=n();function iY(Q){z7.call(this,Q)}Y3.inherits(iY,z7);iY.prototype.readData=function(Q){this.checkOffset(Q);var J=this.data.slice(this.zero+this.index,this.zero+this.index+Q);return this.index+=Q,J};F7.exports=iY});var rY=E((KB,R7)=>{var aQ=n(),C7=o0(),$3=dY(),q3=O7(),V3=N7(),K3=nY();R7.exports=function(Q){var J=aQ.getTypeOf(Q);if(aQ.checkSupport(J),J==="string"&&!C7.uint8array)return new q3(Q);if(J==="nodebuffer")return new V3(Q);if(C7.uint8array)return new K3(aQ.transformTo("uint8array",Q));return new $3(aQ.transformTo("array",Q))}});var T7=E((XB,A7)=>{var aY=rY(),G6=n(),X3=vQ(),I7=wQ(),sQ=c6(),tQ=uY(),G3=o0(),H3=0,W3=3,U3=function(Q){for(var J in tQ){if(!Object.prototype.hasOwnProperty.call(tQ,J))continue;if(tQ[J].magic===Q)return tQ[J]}return null};function M7(Q,J){this.options=Q,this.loadOptions=J}M7.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(Q){var J,Y;if(Q.skip(22),this.fileNameLength=Q.readInt(2),Y=Q.readInt(2),this.fileName=Q.readData(this.fileNameLength),Q.skip(Y),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(J=U3(this.compressionMethod),J===null)throw Error("Corrupted zip : compression "+G6.pretty(this.compressionMethod)+" unknown (inner file : "+G6.transformTo("string",this.fileName)+")");this.decompressed=new X3(this.compressedSize,this.uncompressedSize,this.crc32,J,Q.readData(this.compressedSize))},readCentralPart:function(Q){this.versionMadeBy=Q.readInt(2),Q.skip(2),this.bitFlag=Q.readInt(2),this.compressionMethod=Q.readString(2),this.date=Q.readDate(),this.crc32=Q.readInt(4),this.compressedSize=Q.readInt(4),this.uncompressedSize=Q.readInt(4);var J=Q.readInt(2);if(this.extraFieldsLength=Q.readInt(2),this.fileCommentLength=Q.readInt(2),this.diskNumberStart=Q.readInt(2),this.internalFileAttributes=Q.readInt(2),this.externalFileAttributes=Q.readInt(4),this.localHeaderOffset=Q.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");Q.skip(J),this.readExtraFields(Q),this.parseZIP64ExtraField(Q),this.fileComment=Q.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var Q=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,Q===H3)this.dosPermissions=this.externalFileAttributes&63;if(Q===W3)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var Q=aY(this.extraFields[1].value);if(this.uncompressedSize===G6.MAX_VALUE_32BITS)this.uncompressedSize=Q.readInt(8);if(this.compressedSize===G6.MAX_VALUE_32BITS)this.compressedSize=Q.readInt(8);if(this.localHeaderOffset===G6.MAX_VALUE_32BITS)this.localHeaderOffset=Q.readInt(8);if(this.diskNumberStart===G6.MAX_VALUE_32BITS)this.diskNumberStart=Q.readInt(4)},readExtraFields:function(Q){var J=Q.index+this.extraFieldsLength,Y,$,q;if(!this.extraFields)this.extraFields={};while(Q.index+4<J)Y=Q.readInt(2),$=Q.readInt(2),q=Q.readData($),this.extraFields[Y]={id:Y,length:$,value:q};Q.setIndex(J)},handleUTF8:function(){var Q=G3.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=sQ.utf8decode(this.fileName),this.fileCommentStr=sQ.utf8decode(this.fileComment);else{var J=this.findExtraFieldUnicodePath();if(J!==null)this.fileNameStr=J;else{var Y=G6.transformTo(Q,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(Y)}var $=this.findExtraFieldUnicodeComment();if($!==null)this.fileCommentStr=$;else{var q=G6.transformTo(Q,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(q)}}},findExtraFieldUnicodePath:function(){var Q=this.extraFields[28789];if(Q){var J=aY(Q.value);if(J.readInt(1)!==1)return null;if(I7(this.fileName)!==J.readInt(4))return null;return sQ.utf8decode(J.readData(Q.length-5))}return null},findExtraFieldUnicodeComment:function(){var Q=this.extraFields[25461];if(Q){var J=aY(Q.value);if(J.readInt(1)!==1)return null;if(I7(this.fileComment)!==J.readInt(4))return null;return sQ.utf8decode(J.readData(Q.length-5))}return null}};A7.exports=M7});var w7=E((GB,E7)=>{var Z3=rY(),a0=n(),A0=cY(),L3=T7(),B3=o0();function D7(Q){this.files=[],this.loadOptions=Q}D7.prototype={checkSignature:function(Q){if(!this.reader.readAndCheckSignature(Q)){this.reader.index-=4;var J=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+a0.pretty(J)+", expected "+a0.pretty(Q)+")")}},isSignature:function(Q,J){var Y=this.reader.index;this.reader.setIndex(Q);var $=this.reader.readString(4),q=$===J;return this.reader.setIndex(Y),q},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 Q=this.reader.readData(this.zipCommentLength),J=B3.uint8array?"uint8array":"array",Y=a0.transformTo(J,Q);this.zipComment=this.loadOptions.decodeFileName(Y)},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={};var Q=this.zip64EndOfCentralSize-44,J=0,Y,$,q;while(J<Q)Y=this.reader.readInt(2),$=this.reader.readInt(4),q=this.reader.readData($),this.zip64ExtensibleData[Y]={id:Y,length:$,value:q}},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 Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var Q,J;for(Q=0;Q<this.files.length;Q++)J=this.files[Q],this.reader.setIndex(J.localHeaderOffset),this.checkSignature(A0.LOCAL_FILE_HEADER),J.readLocalPart(this.reader),J.handleUTF8(),J.processAttributes()},readCentralDir:function(){var Q;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(A0.CENTRAL_FILE_HEADER))Q=new L3({zip64:this.zip64},this.loadOptions),Q.readCentralPart(this.reader),this.files.push(Q);if(this.centralDirRecords!==this.files.length){if(this.centralDirRecords!==0&&this.files.length===0)throw Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)}},readEndOfCentral:function(){var Q=this.reader.lastIndexOfSignature(A0.CENTRAL_DIRECTORY_END);if(Q<0){var J=!this.isSignature(0,A0.LOCAL_FILE_HEADER);if(J)throw 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");else throw Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(Q);var Y=Q;if(this.checkSignature(A0.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a0.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a0.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a0.MAX_VALUE_16BITS||this.centralDirRecords===a0.MAX_VALUE_16BITS||this.centralDirSize===a0.MAX_VALUE_32BITS||this.centralDirOffset===a0.MAX_VALUE_32BITS){if(this.zip64=!0,Q=this.reader.lastIndexOfSignature(A0.ZIP64_CENTRAL_DIRECTORY_LOCATOR),Q<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(Q),this.checkSignature(A0.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,A0.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(A0.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory")}this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(A0.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var $=this.centralDirOffset+this.centralDirSize;if(this.zip64)$+=20,$+=12+this.zip64EndOfCentralSize;var q=Y-$;if(q>0)if(this.isSignature(Y,A0.CENTRAL_FILE_HEADER));else this.reader.zero=q;else if(q<0)throw Error("Corrupted zip: missing "+Math.abs(q)+" bytes.")},prepareReader:function(Q){this.reader=Z3(Q)},load:function(Q){this.prepareReader(Q),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};E7.exports=D7});var S7=E((HB,x7)=>{var sY=n(),eQ=f6(),O3=c6(),P3=w7(),j3=sJ(),v7=M8();function z3(Q){return new eQ.Promise(function(J,Y){var $=Q.decompressed.getContentWorker().pipe(new j3);$.on("error",function(q){Y(q)}).on("end",function(){if($.streamInfo.crc32!==Q.decompressed.crc32)Y(Error("Corrupted zip : CRC32 mismatch"));else J()}).resume()})}x7.exports=function(Q,J){var Y=this;if(J=sY.extend(J||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:O3.utf8decode}),v7.isNode&&v7.isStream(Q))return eQ.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return sY.prepareContent("the loaded zip file",Q,!0,J.optimizedBinaryString,J.base64).then(function($){var q=new P3(J);return q.load($),q}).then(function(q){var V=[eQ.Promise.resolve(q)],K=q.files;if(J.checkCRC32)for(var X=0;X<K.length;X++)V.push(z3(K[X]));return eQ.Promise.all(V)}).then(function(q){var V=q.shift(),K=V.files;for(var X=0;X<K.length;X++){var Z=K[X],H=Z.fileNameStr,U=sY.resolve(Z.fileNameStr);if(Y.file(U,Z.decompressed,{binary:!0,optimizedBinaryString:!0,date:Z.date,dir:Z.dir,comment:Z.fileCommentStr.length?Z.fileCommentStr:null,unixPermissions:Z.unixPermissions,dosPermissions:Z.dosPermissions,createFolders:J.createFolders}),!Z.dir)Y.file(U).unsafeOriginalName=H}if(V.zipComment.length)Y.comment=V.zipComment;return Y})}});var y7=E((WB,k7)=>{function C0(){if(!(this instanceof C0))return new C0;if(arguments.length)throw 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 Q=new C0;for(var J in this)if(typeof this[J]!=="function")Q[J]=this[J];return Q}}C0.prototype=G7();C0.prototype.loadAsync=S7();C0.support=o0();C0.defaults=iJ();C0.version="3.10.1";C0.loadAsync=function(Q,J){return new C0().loadAsync(Q,J)};C0.external=f6();k7.exports=C0});import{createRequire as F3}from"module";function u7(Q,J){return S3(Q,{i:2},J&&J.out,J&&J.dictionary)}var N3,$8,C3,R3,R0,Y8,I3,g7,h7,M3,_7=function(Q,J){var Y=new Y8(31);for(var $=0;$<31;++$)Y[$]=J+=1<<Q[$-1];var q=new I3(Y[30]);for(var $=1;$<30;++$)for(var V=Y[$];V<Y[$+1];++V)q[V]=V-Y[$]<<5|$;return{b:Y,r:q}},$8,b7,A3,f7,T3,ZB,Q$,_0,g,n8=function(Q,J,Y){var $=Q.length,q=0,V=new Y8(J);for(;q<$;++q)if(Q[q])++V[Q[q]-1];var K=new Y8(J);for(q=1;q<J;++q)K[q]=K[q-1]+V[q-1]<<1;var X;if(Y){X=new Y8(1<<J);var Z=15-J;for(q=0;q<$;++q)if(Q[q]){var H=q<<4|Q[q],U=J-Q[q],B=K[Q[q]-1]++<<U;for(var P=B|(1<<U)-1;B<=P;++B)X[Q$[B]>>Z]=H}}else{X=new Y8($);for(q=0;q<$;++q)if(Q[q])X[q]=Q$[K[Q[q]-1]++]>>15-Q[q]}return X},i8,g,g,g,g,m7,g,D3,E3,tY=function(Q){var J=Q[0];for(var Y=1;Y<Q.length;++Y)if(Q[Y]>J)J=Q[Y];return J},T0=function(Q,J,Y){var $=J/8|0;return(Q[$]|Q[$+1]<<8)>>(J&7)&Y},eY=function(Q,J){var Y=J/8|0;return(Q[Y]|Q[Y+1]<<8|Q[Y+2]<<16)>>(J&7)},w3=function(Q){return(Q+7)/8|0},v3=function(Q,J,Y){if(J==null||J<0)J=0;if(Y==null||Y>Q.length)Y=Q.length;return new R0(Q.subarray(J,Y))},x3,s0=function(Q,J,Y){var $=Error(J||x3[Q]);if($.code=Q,Error.captureStackTrace)Error.captureStackTrace($,s0);if(!Y)throw $;return $},S3=function(Q,J,Y,$){var q=Q.length,V=$?$.length:0;if(!q||J.f&&!J.l)return Y||new R0(0);var K=!Y,X=K||J.i!=2,Z=J.i;if(K)Y=new R0(q*3);var H=function(VQ){var W=Y.length;if(VQ>W){var G=new R0(Math.max(W*2,VQ));G.set(Y),Y=G}},U=J.f||0,B=J.p||0,P=J.b||0,z=J.l,N=J.d,j=J.m,C=J.n,A=q*8;do{if(!z){U=T0(Q,B,1);var M=T0(Q,B+1,3);if(B+=3,!M){var T=w3(B)+4,R=Q[T-4]|Q[T-3]<<8,D=T+R;if(D>q){if(Z)s0(0);break}if(X)H(P+R);Y.set(Q.subarray(T,D),P),J.b=P+=R,J.p=B=D*8,J.f=U;continue}else if(M==1)z=D3,N=E3,j=9,C=5;else if(M==2){var x=T0(Q,B,31)+257,w=T0(Q,B+10,15)+4,v=x+T0(Q,B+5,31)+1;B+=14;var L=new R0(v),k=new R0(19);for(var I=0;I<w;++I)k[M3[I]]=T0(Q,B+I*3,7);B+=w*3;var _=tY(k),o=(1<<_)-1,i=n8(k,_,1);for(var I=0;I<v;){var D0=i[T0(Q,B,o)];B+=D0&15;var T=D0>>4;if(T<16)L[I++]=T;else{var y=0,$0=0;if(T==16)$0=3+T0(Q,B,3),B+=2,y=L[I-1];else if(T==17)$0=3+T0(Q,B,7),B+=3;else if(T==18)$0=11+T0(Q,B,127),B+=7;while($0--)L[I++]=y}}var W0=L.subarray(0,x),Q0=L.subarray(x);j=tY(W0),C=tY(Q0),z=n8(W0,j,1),N=n8(Q0,C,1)}else s0(1);if(B>A){if(Z)s0(0);break}}if(X)H(P+131072);var $Q=(1<<j)-1,m=(1<<C)-1,H8=B;for(;;H8=B){var y=z[eY(Q,B)&$Q],E0=y>>4;if(B+=y&15,B>A){if(Z)s0(0);break}if(!y)s0(2);if(E0<256)Y[P++]=E0;else if(E0==256){H8=B,z=null;break}else{var E6=E0-254;if(E0>264){var I=E0-257,B0=g7[I];E6=T0(Q,B,(1<<B0)-1)+b7[I],B+=B0}var U6=N[eY(Q,B)&m],W8=U6>>4;if(!U6)s0(3);B+=U6&15;var Q0=T3[W8];if(W8>3){var B0=h7[W8];Q0+=eY(Q,B)&(1<<B0)-1,B+=B0}if(B>A){if(Z)s0(0);break}if(X)H(P+131072);var qQ=P+E6;if(P<Q0){var U8=V-Q0,Z8=Math.min(Q0,qQ);if(U8+P<0)s0(3);for(;P<Z8;++P)Y[P]=$[U8+P]}for(;P<qQ;++P)Y[P]=Y[P-Q0]}}if(J.l=z,J.p=H8,J.b=P,J.f=U,z)U=1,J.m=j,J.d=N,J.n=C}while(!U);return P!=Y.length&&K?v3(Y,0,P):Y.subarray(0,P)},k3,y3,g3=0;var c7=UJ(()=>{N3=F3("/");try{$8=N3("worker_threads"),C3=$8.Worker,R3=$8.isMarkedAsUntransferable}catch(Q){}R0=Uint8Array,Y8=Uint16Array,I3=Int32Array,g7=new R0([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,0,0,0]),h7=new R0([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,0,0]),M3=new R0([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$8=_7(g7,2),b7=$8.b,A3=$8.r;b7[28]=258,A3[258]=28;f7=_7(h7,0),T3=f7.b,ZB=f7.r,Q$=new Y8(32768);for(g=0;g<32768;++g)_0=(g&43690)>>1|(g&21845)<<1,_0=(_0&52428)>>2|(_0&13107)<<2,_0=(_0&61680)>>4|(_0&3855)<<4,Q$[g]=((_0&65280)>>8|(_0&255)<<8)>>1;i8=new R0(288);for(g=0;g<144;++g)i8[g]=8;for(g=144;g<256;++g)i8[g]=9;for(g=256;g<280;++g)i8[g]=7;for(g=280;g<288;++g)i8[g]=8;m7=new R0(32);for(g=0;g<32;++g)m7[g]=5;D3=n8(i8,9,1),E3=n8(m7,5,1),x3=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],k3=new R0(0);y3=typeof TextDecoder<"u"&&new TextDecoder;try{y3.decode(k3,{stream:!0}),g3=1}catch(Q){}});var t7={};QX(t7,{initEpubFile:()=>RU,EPUB_HREF_PREFIX:()=>A6});import h3,{writeFileSync as _3,existsSync as b3,mkdirSync as f3,unlink as m3,readFileSync as u3}from"node:fs";import{Buffer as $$}from"node:buffer";import QJ from"node:crypto";function n7(Q,J,Y){_3(Q,J,Y)}function c3(Q,J){return u3(Q)}function p7(Q){return b3(Q)}function p3(Q,J){return f3(Q,J)}function l3(Q){m3(Q,()=>{})}async function n3(Q){let J=new i7(Q);return await J.loadZip(),J}class i7{constructor(Q){this.filePath=Q,J$(this,"jsZip"),J$(this,"names"),J$(this,"pathToProcessors",{})}getNames(){return[...this.names.values()]}useDeprocessors(Q){this.pathToProcessors={...this.pathToProcessors,...Q}}async loadZip(){this.jsZip=await this.readZip(this.filePath),this.names=new Map(Object.keys(this.jsZip.files).map((Q)=>{return[Q.toLowerCase(),Q]}))}async readZip(Q){return new Promise((J,Y)=>{{let $=typeof Q==="string"?new Uint8Array(h3.readFileSync(Q)):Q;new o7.default().loadAsync($).then((q)=>{J(q)})}})}async readFile(Q){let J=await this.readResource(Q);return new TextDecoder().decode(J)}async readResource(Q){if(!this.hasFile(Q))return console.warn(`${Q} file was not exit in ${this.filePath}, return an empty uint8 array`),new Uint8Array;let J=this.getFileName(Q),Y=await this.jsZip.file(J).async("uint8array");if(this.pathToProcessors[J])for(let $ of this.pathToProcessors[J])Y=await $(Y);return Y}hasFile(Q){return this.names.has(Q.toLowerCase())}getFileName(Q){return this.names.get(Q.toLowerCase())}}function Y$(Q){let J=new Set;for(let Y of String(Q).matchAll(/xmlns:([\w.-]+)\s*=\s*["']([^"']*)["']/g))if(s3.has(Y[2].trim().replace(/\/+$/,"")))J.add(Y[1]);return{tagNameProcessors:[(Y)=>{let $=Y.indexOf(":");return $>0&&J.has(Y.slice(0,$))?Y.slice($+1):Y}]}}function t3(Q){let J={};if(Q.rsaPrivateKey)J.rsaPrivateKey=typeof Q.rsaPrivateKey==="string"?Uint8Array.from(atob(Q.rsaPrivateKey),(Y)=>Y.charCodeAt(0)):Q.rsaPrivateKey;if(Q.aesSymmetricKey)J.aesSymmetricKey=typeof Q.aesSymmetricKey==="string"?Uint8Array.from(atob(Q.aesSymmetricKey),(Y)=>Y.charCodeAt(0)):Q.aesSymmetricKey;return J}function e3(Q){let J=new Map;return(...Y)=>{let $=JSON.stringify(Y);if(J.has($))return J.get($);let q=Q(...Y);return J.set($,q),q}}function QU(Q){if(Q.endsWith("s"))return Number.parseFloat(Q);let J=Q.split(":").map(Number);if(J.length===3){let[Y,$,q]=J;return Y*3600+$*60+q}else if(J.length===2){let[Y,$]=J;return Y*60+$}else return Number(Q)}async function JU(Q,J,Y="sha256"){{let $=$$.from(J,"base64"),q=QJ.createPrivateKey({key:$$.from(Q),format:"der",type:"pkcs8"}),V=QJ.privateDecrypt({key:q,padding:QJ.constants.RSA_PKCS1_OAEP_PADDING,oaepHash:Y},$);return new Uint8Array(V)}}async function d7(Q,J,Y){{let $=Q.endsWith("gcm"),q=$?12:16,V=$?16:0,K=Y.slice(0,q),X=$?Y.slice(Y.length-V):void 0,Z=Y.slice(q,Y.length-V),H=QJ.createDecipheriv(Q,J,K);if($&&X)H.setAuthTag(X);let U=$$.concat([H.update(Z),H.final()]);return new Uint8Array(U)}}function YU(Q){let J=Q.trim().toLowerCase();if(J!=="application/epub+zip")throw Error("Unsupported mime type. The mimetype file must be the application/epub+zip");return J}function $U(Q){let J=Q.container;if(!J||!J.rootfiles||J.rootfiles.length===0)throw Error("No <rootfiles></rootfiles> tag found in meta-inf/container.xml");let Y=J.rootfiles[0].rootfile[0];if(Y.$["media-type"]!=="application/oebps-package+xml")throw Error("media-type of <rootfile/> application/oebps-package+xml");let q=Y.$["full-path"];if(t.isAbsolutePosix(q))throw Error("full-path must be a relative path");return q}function qU(Q){let J={title:"",language:"",identifier:{id:""},packageIdentifier:{id:""},metas:{}},Y=new Map;for(let K in Q){let X=Q[K],Z=K.split(":").pop();switch(Z){case"title":case"language":case"description":case"publisher":case"type":case"format":case"source":case"relation":case"coverage":case"rights":{J[Z]=X[0]._??X[0];break}case"date":{J.date={};for(let H of X){let U=H.$?.["opf:event"]??"publication";J.date[U]=H._??H}break}case"identifier":{for(let H of X){let U={id:H._,scheme:H.$?.["opf:scheme"]??""},B=H.$&&H.$.id;if(B)J.packageIdentifier=U,Y.set(B,U);else J.identifier=U}break}case"subject":{J.subject=[];for(let H of X){let U=H.$,B={subject:H._??H,authority:U?.authority??"",term:U?.term??""};if(J.subject.push(B),H.$?.id)Y.set(H.$.id,B)}break}case"creator":case"contributor":{J[Z]=[];for(let H of X){let U=H.$,B={contributor:H._??H,fileAs:U?.["opf:file-as"]??"",role:U?.["opf:role"]??""};if(J[Z].push(B),U?.id)Y.set(U.id,B)}break}}}let $=Q.meta??[];for(let K of $){let X=K.$;if(K._)if(X.refines){let Z=X.refines.slice(1),H=Y.get(Z);if(!H){console.warn(`No element with id "${Z}" found when parsing <metadata>`);continue}let U=GQ(X.property);if("contributor"in H)H[U]||(H[U]=K._);else if("subject"in H)H[U]||(H[U]=K._);else if("id"in H)H[U]||(H[U]=K._),H.scheme=H.scheme||X.scheme}else{let Z=X.property;J.metas[Z]=K._}else{let Z=X.name;J.metas[Z]=X.content}}let q=Q.link??[],V=[];for(let K of q){let X=K.$;if(!X.refines){let Z={href:"",rel:""};for(let H in X)Z[GQ(H)]=X[H];V.push(Z)}else{let Z=X.refines.slice(1),H=Y.get(Z);if(!H){console.warn(`No element with id "${Z}" found when parsing <metadata>`);continue}let U=GQ(X.rel),B=X.href;H[U]=B}}return J.links=V,J}function VU(Q,J){let Y=Q.item;if(!Y)throw Error("The manifest element must contain one or more item elements");let $={},q=[];for(let V of Y){let K=V.$,{id:X,href:Z,"media-type":H,"media-overlay":U,properties:B}=K;if(!K||!X||!Z||!H){console.warn("The item in manifest must have attributes id, href and mediaType. So skip this item.");continue}if($[X]={id:X,href:t.joinPosix(J,Z),mediaType:H,properties:B||"",mediaOverlay:U||""},K.fallback)$[X].fallback=[K.fallback],q.push($[X])}for(let V of q){let K=new Set;K.add(V.id);let X=$[V.fallback[0]];while(X&&X.fallback){K.add(X.id);let Z=X.fallback;if(Z.length>1){V.fallback.push(...Z);break}let H=Z[0];if(K.has(H)){console.warn(`Cycle references have appeard when next item id is "${H}". Therefore stop parsing.`);break}V.fallback.push(H),X=$[H]}}return $}function KU(Q,J){let Y="";if(Q.$?.toc)Y=J[Q.$.toc]?.href??"";let $=[],q=Q.itemref;if(!q)throw Error("The spine element must contain one or more itemref elements");for(let V of q){let K=V.$;if(K.idref){let X=J[K.idref];if(!X)continue;$.push({...X,href:`epub:${X.href}`,linear:K.linear||"yes"})}}return{tocPath:Y,spine:$}}function XU(Q,J){let Y=[],$=Q.reference;if(!$)return Y;for(let q of $){let V=q.$;if(V.href&&V.href.length>0)V.href=A6+t.joinPosix(J,V.href);Y.push(V)}return Y}function GU(Q,J){let Y=[];for(let $ of Q){let q=$.$.role,V=[];for(let K of $.link)V.push(t.joinPosix(J,K.$.href));Y.push({role:q,links:V})}return Y}function HU(Q,J,Y){let $=[];return r7($,Q?.navPoint??[],J,Y),$}function r7(Q,J,Y,$){for(let q of J){let V={label:"",href:"",id:"",playOrder:""};if(q.navLabel){let K=t.joinPosix($,decodeURIComponent(q.content[0].$?.src)),X=K.split("#")[0];V={label:q.navLabel[0].text?.[0]??"",href:A6+K,id:Y[X],playOrder:q.$?.playOrder??""},Q.push(V)}if(q.navPoint)V.children=[],r7(V.children,q.navPoint,Y,$)}}function WU(Q,J,Y){let $="";if(Q.navLabel)$=Q.navLabel[0].text[0];let q=[];for(let V of Q.pageTarget){let K=t.joinPosix(Y,decodeURIComponent(V.content[0].$?.src)),X=K.split("#")[0],Z=V.$,H={label:V.navLabel[0].text[0]||"",value:Z.value||"",href:A6+K,playOrder:Z.playOrder||"",type:Z.type||"",correspondId:J[X]};q.push(H)}return{label:$,pageTargets:q}}function UU(Q,J,Y){let $="";if(Q.navLabel)$=Q.navLabel[0].text[0];let q=[];for(let V of Q.navTarget){let K=t.joinPosix(Y,decodeURIComponent(V.content[0].$?.src)),X=K.split("#")[0],Z={label:V.navLabel[0]?.text?.[0]||"",href:A6+K,correspondId:J[X]};q.push(Z)}return{label:$,navTargets:q}}async function ZU(Q,J){if(!Q)return{};let Y={};for(let $ of Q){let q=$.$.Id,V=$.EncryptionMethod[0],K=V.$.Algorithm.split("#")[1];if(!K.startsWith("rsa"))throw Error(`Unsupported encryption algorithm: ${K}. Only RSA and AES algorithms are supported.`);let X="sha1";if(K==="rsa-oaep")X=V.DigestMethod[0].$.Algorithm.split("#")[1];let Z=$.CipherData[0].CipherValue[0].trim(),H=await JU(J,Z,X);Y[q]=H}return Y}function LU(Q=[],J,Y){let $={};for(let q of Q){let V=q.EncryptionMethod[0].$.Algorithm.split("#")[1];if(!V.startsWith("aes")){console.warn(`Unsupported encryption algorithm: ${V}. Only AES and RSA algorithms are supported.`);continue}let K=V.replace("aes","aes-"),X=q.CipherData[0].CipherReference[0].$.URI;$[X]=[];let Z=$[X],H=q.KeyInfo?.[0];if(H&&H.RetrievalMethod){let B=H.RetrievalMethod[0].$.URI.slice(1),P=J[B];if(!P)throw Error(`No symmetric key found for id "${B}". Skipping decryption for file "${X}".`);let z=async(N)=>{return await d7(K,P,N)};Z.push(z)}else{let B=async(P)=>{return await d7(K,Y,P)};Z.push(B)}let U=q.EncryptionProperties?.[0].EncryptionProperty;if(U)for(let B of U){let P=B.Compression[0];if(P&&P.$.Method==="8")Z.push(u7)}$[X]=Z}return $}function OU(Q){let J=Q.EncryptionMethod?.[0]?.$?.Algorithm;return!BU.includes(J)}async function PU(Q,J){let Y=Q.encryption,$=Y.EncryptedKey,q=Y.EncryptedData??[],V=q?.filter(OU);if(q.length!==V.length){if(console.warn("lingo-reader doesn't handle font obfuscation and it doesn't read the font file."),V.length===0)return{}}if($&&!J.rsaPrivateKey)throw Error("Please provide the RSA private key to decrypt the encrypted AES keys.");if(!$&&V&&!J.aesSymmetricKey)throw Error("The file is encrypted with AES, but no symmetric key is provided. ");let K=await ZU($,J.rsaPrivateKey);return LU(V,K,J.aesSymmetricKey)}function q8(Q,J,Y){let $=t.joinPosix(J,Q).replace(/\//g,"_");return t.resolve(Y,$)}function jU(Q,J,Y){return Q=Q.replace(/<(img|video|audio|source)[^>]*>/g,($)=>{let q=$.match(/src="([^"]*)"/)?.[1];if(q){let K=q8(q,J,Y);$=$.replace(q,K)}let V=$.match(/poster="([^"]*)"/)?.[1];if(V){let K=q8(V,J,Y);$=$.replace(V,K)}return $}),Q=Q.replace(/<image[^>]*>/g,($)=>{let q=$.match(/href="([^"]*)"/)?.[1];if(q){let V=q8(q,J,Y);$=$.replace(q,V)}return $}),Q=Q.replace(/<a[^>]*>/g,($)=>{let q=$.match(/href="([^"]*)"/)?.[1];if(q&&!/^https?|mailto/.test(q)){let V=t.joinPosix(J,q);$=$.replace(q,A6+decodeURIComponent(V))}return $}),Q}function zU(Q,J,Y){let $=Q.match(/<head[^>]*>([\s\S]*)<\/head>/i),q=[];if($){let X=$[1].match(/<link[^>]*>/g);if(X)for(let Z of X){let H=Z.match(/href=["']([^"']*)["']/)?.[1];if(!H)continue;if(H.endsWith(".css")){let U=t.joinPosix(J,H),B=U.replace(/\//g,"_"),P=t.resolve(Y,B),z;try{z=new TextDecoder().decode(c3(P))}catch{continue}z=z.replace(/url\(([^)]*)\)/g,(N,j)=>{return j=j.replace(/['"]/g,""),`url(${q8(j.trim(),t.dirname(U),Y)})`}),n7(P,new TextEncoder().encode(z)),q.push({id:B,href:P})}}}let V=Q.match(/<body[^>]*>(.*?)<\/body>/is),K=V?jU(V[1],J,Y):"";return{css:q,html:K}}function a7(Q,J,Y,$){for(let q of Q)if(q["#name"]==="par"){let V=q.text[0].$.src.split("#")[1],K=q.audio[0].$,X=q8(K.src,J,Y),Z=l7(K.clipBegin),H=l7(K.clipEnd);if(!$[X])$[X]={audioSrc:X,pars:[]};$[X].pars.push({textDOMId:V,clipBegin:Z,clipEnd:H})}else a7(q.children,J,Y,$)}function FU(Q,J,Y){let $={},q=Q.smil.body[0].children;return a7(q,J,Y,$),Object.values($)}async function RU(Q,J="./images",Y={}){let $=new s7(Q,J,Y);return await $.loadEpub(),await $.parse(),$}class s7{constructor(Q,J="./images",Y={}){if(this.epub=Q,this.options=Y,q0(this,"fileName",""),q0(this,"mimeType",""),q0(this,"metadata"),q0(this,"manifest",{}),q0(this,"spine",[]),q0(this,"guide",[]),q0(this,"collections",[]),q0(this,"navMap",[]),q0(this,"pageList"),q0(this,"navList"),q0(this,"zip"),q0(this,"opfPath",""),q0(this,"opfDir",""),q0(this,"resourceSaveDir"),q0(this,"encryptionKeys",{}),q0(this,"savedResourcePath",[]),q0(this,"hrefToIdMap",{}),q0(this,"chapterCache",new Map),typeof Q==="string")this.fileName=t.basename(Q);else if(Q instanceof Uint8Array)this.fileName="";else this.fileName=Q.name;if(this.resourceSaveDir=J,!p7(this.resourceSaveDir))p3(this.resourceSaveDir,{recursive:!0});this.encryptionKeys=t3(this.options)}getFileInfo(){return{fileName:this.fileName,mimetype:this.mimeType}}getMetadata(){return this.metadata}getManifest(){return this.manifest}getSpine(){return this.spine}getGuide(){return this.guide}getCollection(){return this.collections}getToc(){return this.navMap}getPageList(){return this.pageList}getNavList(){return this.navList}async loadEpub(){this.zip=await n3(this.epub)}async parse(){let Q=await this.zip.readFile("mimetype");this.mimeType=YU(Q);let J=await this.zip.readFile("meta-inf/container.xml"),Y=await v6(J,Y$(J));if(this.opfPath=$U(Y),this.opfDir=t.dirname(this.opfPath),this.zip.hasFile("meta-inf/encryption.xml")){let $=await this.zip.readFile("meta-inf/encryption.xml"),q=await v6($,{tagNameProcessors:[(K)=>K.replace(a3,"")]}),V=await PU(q,this.encryptionKeys);this.zip.useDeprocessors(V)}await this.parseRootFile()}async parseRootFile(){let Q=await this.zip.readFile(this.opfPath),Y=(await v6(Q,Y$(Q))).package,$="";if(Y.metadata)this.metadata=qU(Y.metadata[0]);if(Y.manifest){this.manifest=VU(Y.manifest[0],this.opfDir);for(let q in this.manifest){let V=this.manifest[q];if(this.hrefToIdMap[V.href]=V.id,r3.has(V.mediaType)||V.mediaType.startsWith("text/css")){let K=V.href.replace(/\//g,"_"),X=t.resolve(this.resourceSaveDir,K);this.savedResourcePath.push(X),n7(X,await this.zip.readResource(V.href))}}}if(Y.spine){let q=KU(Y.spine[0],this.manifest);$=q.tocPath,this.spine=q.spine}if(Y.guide)this.guide=XU(Y.guide[0],this.opfDir);if(Y.collection)this.collections=GU(Y.collection,this.opfDir);if($.length>0){let q=t.dirname($),V=await this.zip.readFile($),K=(await v6(V,Y$(V))).ncx;if(K.navMap)this.navMap=HU(K.navMap[0],this.hrefToIdMap,q);if(K.pageList)this.pageList=WU(K.pageList[0],this.hrefToIdMap,q);if(K.navList)this.navList=UU(K.navList[0],this.hrefToIdMap,q)}}async loadChapter(Q){if(this.chapterCache.has(Q))return this.chapterCache.get(Q);let J=this.manifest[Q],Y=J.href,$=t.dirname(Y),q=zU(await this.zip.readFile(Y),$,this.resourceSaveDir),V=J.mediaOverlay;if(V){let X=this.manifest[V].href,Z=FU(await v6(await this.zip.readFile(X),{preserveChildrenOrder:!0,explicitChildren:!0,childkey:"children"}),t.dirname(X),this.resourceSaveDir);q.mediaOverlays=Z}return this.chapterCache.set(Q,q),q}resolveHref(Q){if(!Q.startsWith(A6))return;Q=Q.slice(5).trim();let[J,Y]=Q.split("#"),$="";if(this.hrefToIdMap[J])$=this.hrefToIdMap[J];else return;let q="";if(Y)q=`[id="${Y}"]`;return{id:$,selector:q}}getCoverImage(){let Q=this.guide.find((J)=>J.type==="cover");if(Q){let J=this.resolveHref(Q.href).id,Y=this.manifest[J];return q8(Y.href,"",this.resourceSaveDir)}return""}destroy(){this.savedResourcePath.forEach((Q)=>{if(p7(Q))l3(Q)}),this.savedResourcePath.length=0}}var o7,d3,o3=(Q,J,Y)=>(J in Q)?d3(Q,J,{enumerable:!0,configurable:!0,writable:!0,value:Y}):Q[J]=Y,J$=(Q,J,Y)=>o3(Q,typeof J!=="symbol"?J+"":J,Y),i3,r3,a3,s3,l7,A6="epub:",BU,NU,CU=(Q,J,Y)=>(J in Q)?NU(Q,J,{enumerable:!0,configurable:!0,writable:!0,value:Y}):Q[J]=Y,q0=(Q,J,Y)=>CU(Q,typeof J!=="symbol"?J+"":J,Y);var e7=UJ(()=>{I$();c7();o7=j$(y7(),1);d3=Object.defineProperty;i3={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",tiff:"image/tiff",tif:"image/tiff",heic:"image/heic",avif:"image/avif",css:"text/css",mp4:"video/mp4",mkv:"video/mkv",webm:"video/webm",mp3:"audio/mp3",wav:"audio/wav",ogg:"audio/ogg",ttf:"font/ttf",otf:"font/otf",woff:"font/woff",woff2:"font/woff2",eot:"font/eot"},r3=new Set(Object.values(i3)),a3=/(?!xmlns)^.*:/,s3=new Set(["http://www.idpf.org/2007/opf","http://www.daisy.org/z3986/2005/ncx","urn:oasis:names:tc:opendocument:xmlns:container"]);l7=e3(QU);BU=["http://www.idpf.org/2008/embedding","http://ns.adobe.com/pdf/enc#RC"];NU=Object.defineProperty});import{mkdir as yZ,writeFile as gZ}from"node:fs/promises";import{join as mK}from"node:path";import SZ from"node:fs/promises";import{existsSync as QK,readdirSync as IU,readFileSync as JK,statSync as MU}from"node:fs";import*as T6 from"node:path";import{createHash as YX}from"node:crypto";import{inflateSync as $X}from"node:zlib";var qX=new Set(["image/png","image/jpeg","image/gif","image/webp"]),VX={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/bmp":"bmp","image/tiff":"tif","image/svg+xml":"svg","image/emf":"emf","image/wmf":"wmf","image/x-pict":"pict"};function KX(Q){let J=($,...q)=>q.every((V,K)=>Q[$+K]===V);if(J(0,137,80,78,71))return"image/png";if(J(0,255,216,255))return"image/jpeg";if(J(0,71,73,70,56))return"image/gif";if(J(0,82,73,70,70)&&J(8,87,69,66,80))return"image/webp";if(J(0,66,77))return"image/bmp";if(J(0,73,73,42,0)||J(0,77,77,0,42))return"image/tiff";if(J(40,32,69,77,70))return"image/emf";if(J(0,215,205,198,154)||J(0,1,0,9,0))return"image/wmf";if(J(10,0,17,2,255))return"image/x-pict";let Y=Buffer.from(Q.subarray(0,256)).toString("utf8").trimStart();if(Y.startsWith("<svg")||Y.startsWith("<?xml")&&Y.includes("<svg"))return"image/svg+xml";return}function XX(Q){if(Q[0]!==120||![1,94,156,218].includes(Q[1]??0))return Q;try{return new Uint8Array($X(Q))}catch{return Q}}class ZJ{linkDir;byHash=new Map;names=new Set;pending=[];constructor(Q="images"){this.linkDir=Q}add(Q){if(Q.data.byteLength===0)return;let J=XX(Q.data),Y=YX("sha1").update(J).digest("hex"),$=this.byHash.get(Y);if($)return $;let q=KX(J)??Q.mediaType??"application/octet-stream",V=VX[q]??"bin",K=this.uniqueName(GX(Q.stem),V),X={file:K,link:`${this.linkDir}/${K}`,mediaType:q,bytes:J.byteLength,...Q.width?{width:Q.width}:{},...Q.height?{height:Q.height}:{},...Q.source?{source:Q.source}:{},...Q.alt?.trim()?{alt:Q.alt.trim()}:{},...qX.has(q)||q==="image/svg+xml"?{}:{notViewable:!0},sha1:Y};return this.byHash.set(Y,X),this.pending.push({image:X,data:J}),X}get images(){return this.pending.map((Q)=>Q.image)}entries(){return this.pending}uniqueName(Q,J){let Y=`${Q}.${J}`;for(let $=2;this.names.has(Y);$++)Y=`${Q}-${$}.${J}`;return this.names.add(Y),Y}}function GX(Q){return Q.replace(/\.[a-z0-9]{2,4}$/i,"").replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)||"image"}function c0(Q){return`![${(Q.alt??"").replace(/[[\]\n]/g," ").trim()}](${Q.link})`}var AU=/\.(png|jpe?g|gif|webp|bmp|svg|tiff?)$/i;function TU(Q){if(Q.length<90)return 0;let J=new DataView(Q.buffer,Q.byteOffset,Q.byteLength),Y=J.getUint32(78);if(Y+14>Q.length)return 0;return J.getUint16(Y+12)}function DU(Q){let J=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);return J.includes("META-INF/rights.xml")||J.includes("META-INF/license.lcpl")}function EU(Q){let J=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);if(J.length<22||J.readUInt32LE(0)!==67324752)return"it does not start as a ZIP archive, which every EPUB is";let Y=J.lastIndexOf(Buffer.from([80,75,5,6]),J.length-22);if(Y<0||Y<J.length-22-65535)return`it ends before its index (${J.length.toLocaleString("en-US")} bytes), so it was cut short when it was copied, downloaded or unpacked`;let $=J.readUInt32LE(Y+12),q=J.readUInt32LE(Y+16);if(q!==4294967295&&$!==4294967295&&q+$>Y)return"its index points past the end of the file, so part of it is missing";return}var YK=120000;async function JJ(Q){let J;try{return await Promise.race([Q,new Promise((Y,$)=>{J=setTimeout(()=>$(Error(`The book could not be opened: the reader gave no answer in ${YK/1000}s, which is what it does with a damaged file. Check that the file is complete.`)),YK)})])}finally{clearTimeout(J)}}function $K(Q,J=0,Y=[]){for(let $ of Q){if(Y.length>=200)break;let q=String($.label??"").trim();if(q)Y.push(`${" ".repeat(J)}${q}`);if(Array.isArray($.children))$K($.children,J+1,Y)}return Y}function YJ(Q){if(typeof Q==="string")return Q.trim()||void 0;if(Array.isArray(Q))for(let J of Q){let Y=YJ(typeof J==="object"&&J!==null?J.contributor??J.name:J);if(Y)return Y}if(typeof Q==="object"&&Q!==null){let J=Q;return YJ(J.contributor??J.name??J.value)}return}async function wU(Q){let{default:J}=await import("turndown"),{gfm:Y}=await import("@joplin/turndown-plugin-gfm"),$=new J({headingStyle:"atx",codeBlockStyle:"fenced",bulletListMarker:"-"});return $.use(Y),$.remove(["script","style","head"]),$.addRule("image",{filter:"img",replacement:(q,V)=>{let K=V,X=K.getAttribute("src")??"";return Q(X,K.getAttribute("alt")??"")??""}}),$.addRule("svgImage",{filter:(q)=>q.nodeName.toLowerCase()==="image",replacement:(q,V)=>{let K=V,X=K.getAttribute("xlink:href")??K.getAttribute("href")??"";return Q(X,"")??""}}),$}async function qK(Q,J,Y,$){if((Y==="mobi"||Y==="azw3")&&TU(J)>1)throw Error("This Kindle book is DRM-protected. It can be read only in a Kindle app; nothing here can remove the protection.");if(Y==="epub"&&DU(J))throw Error("This EPUB is DRM-protected (Adobe ADEPT or Readium LCP). It can be read only in a reader app licensed for it.");if(Y==="epub"){let B=EU(J);if(B)throw Error(`This EPUB is damaged: ${B}. Nothing can be read from it; get the file again.`)}let q=$.scratchDir,{initEpubFile:V}=await Promise.resolve().then(() => (e7(),t7)),{initFb2File:K}=await import("@lingo-reader/fb2-parser"),{initKf8File:X,initMobiFile:Z}=await import("@lingo-reader/mobi-parser"),H,U;if(Y==="epub")H=await JJ(V(Q,q)),U="lingo-reader (EPUB)";else if(Y==="fb2")H=await JJ(K(Q,q)),U="lingo-reader (FB2)";else{let[B,P]=Y==="azw3"?[X,Z]:[Z,X];try{H=await JJ(B(Q,q)),U=`lingo-reader (${B===X?"KF8":"MOBI"})`}catch{H=await JJ(P(Q,q)),U=`lingo-reader (${P===X?"KF8":"MOBI"})`}}try{let B=new Map,P=0,N=await wU((x,w)=>{if(!$.wantImages||!x||/^(data:|https?:)/i.test(x))return;let v=x;try{v=decodeURI(x.replace(/^file:\/\//,""))}catch{}if(!T6.isAbsolute(v)||!QK(v))return;if(!B.has(v))B.set(v,$.images.add({data:JK(v),stem:T6.basename(v),source:`chapter ${P}`,...w?{alt:w}:{}}));let L=B.get(v);return L?c0(L):void 0}),j=H.getSpine(),C=[],A=[];for(let x=0;x<j.length;x++){let w=x+1;if($.selects&&!$.selects(w))continue;$.signal?.throwIfAborted(),P=w,$.onProgress?.({unit:"chapter",at:w,total:j.length,pictures:B.size}),C.push(w);let L=(await H.loadChapter(j[x].id))?.html??"",k=L?N.turndown(L).trim():"";if(k)A.push(k)}if($.wantImages&&QK(q))for(let x of IU(q,{recursive:!0})){let w=T6.join(q,x);if(!AU.test(x)||B.has(w)||!MU(w).isFile())continue;B.set(w,$.images.add({data:JK(w),stem:T6.basename(x)}))}let M=H.getMetadata()??{},T=YJ(M.title),R=YJ(M.creator??M.author),D=$K(H.getToc()??[]);return{markdown:A.join(`
13
+
14
+ `),reader:U,...T&&T!=="Unknown"?{title:T}:{},...R&&R!=="Unknown"?{author:R}:{},units:{name:"chapter",total:j.length,read:C},...D.length?{contents:D}:{}}}finally{H.destroy()}}import*as q$ from"node:path";var vU={pdf:"PDF",docx:"Word document (DOCX)",pptx:"PowerPoint presentation (PPTX)",xlsx:"Excel workbook (XLSX)",odt:"OpenDocument text (ODT)",odp:"OpenDocument presentation (ODP)",ods:"OpenDocument spreadsheet (ODS)",odg:"OpenDocument drawing (ODG)",rtf:"Rich Text (RTF)",csv:"CSV",html:"HTML",epub:"EPUB ebook",mobi:"Mobipocket / Kindle ebook (MOBI)",azw3:"Kindle KF8 ebook (AZW3)",fb2:"FictionBook (FB2)",doc:"Word 97-2003 document (DOC)",xls:"Excel 97-2003 workbook (XLS)",ppt:"PowerPoint 97-2003 presentation (PPT)"},VK={".pdf":"pdf",".docx":"docx",".docm":"docx",".dotx":"docx",".pptx":"pptx",".pptm":"pptx",".ppsx":"pptx",".xlsx":"xlsx",".xlsm":"xlsx",".odt":"odt",".odp":"odp",".ods":"ods",".odg":"odg",".rtf":"rtf",".csv":"csv",".html":"html",".htm":"html",".xhtml":"html",".epub":"epub",".mobi":"mobi",".prc":"mobi",".azw":"mobi",".azw3":"azw3",".kf8":"azw3",".fb2":"fb2",".doc":"doc",".dot":"doc",".xls":"xls",".ppt":"ppt",".pps":"ppt"},xU={".djvu":"DjVu has no JavaScript reader.",".djv":"DjVu has no JavaScript reader.",".chm":"Compiled HTML Help (CHM) has no JavaScript reader.",".lit":"Microsoft Reader (LIT) has no JavaScript reader.",".lrf":"Sony BBeB (LRF) has no JavaScript reader.",".kfx":"KFX is Amazon's DRM-bound format and cannot be read.",".pages":"Apple Pages files have no JavaScript reader; export them as DOCX or PDF.",".key":"Apple Keynote files have no JavaScript reader; export them as PPTX or PDF.",".numbers":"Apple Numbers files have no JavaScript reader; export them as XLSX or CSV.",".xlsb":"Binary Excel workbooks (XLSB) are not read; save the workbook as XLSX.",".wps":"Microsoft Works documents are not read; save them as DOCX.",".cbz":"Comic archives are not read yet.",".cbr":"Comic archives are not read yet."},RB=Object.keys(VK);function KK(Q,J){let Y=q$.extname(Q).toLowerCase(),$=xU[Y];if($)return{unsupported:$};let q=Buffer.from(J.subarray(0,512)).toString("latin1"),V=VK[Y];if(q.startsWith("%PDF"))return{format:"pdf"};if(q.startsWith("{\\rtf"))return{format:"rtf"};if(q.slice(60,68)==="BOOKMOBI")return{format:V==="azw3"?"azw3":"mobi"};let K=q.startsWith("PK\x03\x04"),X=q.startsWith("ÐÏ\x11ࡱ\x1Aá");if(K){if(q.includes("mimetypeapplication/epub+zip"))return{format:"epub"};let Z=/mimetypeapplication\/vnd\.oasis\.opendocument\.(text|presentation|spreadsheet|graphics)/.exec(q);if(Z)return{format:{text:"odt",presentation:"odp",spreadsheet:"ods",graphics:"odg"}[Z[1]]};if(V&&["docx","pptx","xlsx","epub","odt","odp","ods","odg"].includes(V))return{format:V};if(V==="doc")return{format:"docx"};if(V==="xls")return{format:"xlsx"};if(V==="ppt")return{format:"pptx"}}if(X){if(V==="doc"||V==="xls"||V==="ppt")return{format:V};if(V==="docx")return{format:"doc"};if(V==="xlsx")return{format:"xls"};if(V==="pptx")return{format:"ppt"};return{unsupported:"This is an OLE compound file, but its extension does not say which Office program wrote it; rename it to .doc, .xls or .ppt."}}if(V==="fb2"||/<FictionBook[\s>]/.test(q))return{format:"fb2"};if(V==="html"||V==="csv")return{format:V};if(V)return{unsupported:`The file is named as ${vU[V]} but its contents are not; it may be damaged or a different format.`};return{unsupported:`No reader for ${Y||"files without an extension"}. Readable: PDF, DOCX/DOC, PPTX/PPT, XLSX/XLS, ODT/ODP/ODS/ODG, RTF, CSV, HTML, EPUB, MOBI/AZW/AZW3, FB2.`}}import{existsSync as UK,readFileSync as mU}from"node:fs";import{dirname as OK,join as ZK}from"node:path";import{fileURLToPath as uU}from"node:url";class QQ{__destroy_into_raw(){let Q=this.__wbg_ptr;return this.__wbg_ptr=0,XK.unregister(this),Q}free(){let Q=this.__destroy_into_raw();S.__wbg_wasmdocument_free(Q,0)}formatName(){let Q,J;try{let q=S.__wbindgen_add_to_stack_pointer(-16);S.wasmdocument_formatName(q,this.__wbg_ptr);var Y=c().getInt32(q+0,!0),$=c().getInt32(q+4,!0);return Q=Y,J=$,W6(Y,$)}finally{S.__wbindgen_add_to_stack_pointer(16),S.__wbindgen_export3(Q,J,1)}}constructor(Q,J){try{let V=S.__wbindgen_add_to_stack_pointer(-16),K=HK(Q,S.__wbindgen_export),X=f0,Z=t8(J,S.__wbindgen_export,S.__wbindgen_export2),H=f0;S.wasmdocument_new(V,K,X,Z,H);var Y=c().getInt32(V+0,!0),$=c().getInt32(V+4,!0),q=c().getInt32(V+8,!0);if(q)throw b0($);return this.__wbg_ptr=Y,XK.register(this,this.__wbg_ptr,this),this}finally{S.__wbindgen_add_to_stack_pointer(16)}}plainText(){let Q,J;try{let q=S.__wbindgen_add_to_stack_pointer(-16);S.wasmdocument_plainText(q,this.__wbg_ptr);var Y=c().getInt32(q+0,!0),$=c().getInt32(q+4,!0);return Q=Y,J=$,W6(Y,$)}finally{S.__wbindgen_add_to_stack_pointer(16),S.__wbindgen_export3(Q,J,1)}}toHtml(){let Q,J;try{let q=S.__wbindgen_add_to_stack_pointer(-16);S.wasmdocument_toHtml(q,this.__wbg_ptr);var Y=c().getInt32(q+0,!0),$=c().getInt32(q+4,!0);return Q=Y,J=$,W6(Y,$)}finally{S.__wbindgen_add_to_stack_pointer(16),S.__wbindgen_export3(Q,J,1)}}toIr(){try{let $=S.__wbindgen_add_to_stack_pointer(-16);S.wasmdocument_toIr($,this.__wbg_ptr);var Q=c().getInt32($+0,!0),J=c().getInt32($+4,!0),Y=c().getInt32($+8,!0);if(Y)throw b0(J);return b0(Q)}finally{S.__wbindgen_add_to_stack_pointer(16)}}toMarkdownWithImages(){let Q,J;try{let q=S.__wbindgen_add_to_stack_pointer(-16);S.wasmdocument_toMarkdownWithImages(q,this.__wbg_ptr);var Y=c().getInt32(q+0,!0),$=c().getInt32(q+4,!0);return Q=Y,J=$,W6(Y,$)}finally{S.__wbindgen_add_to_stack_pointer(16),S.__wbindgen_export3(Q,J,1)}}toMarkdown(){let Q,J;try{let q=S.__wbindgen_add_to_stack_pointer(-16);S.wasmdocument_toMarkdown(q,this.__wbg_ptr);var Y=c().getInt32(q+0,!0),$=c().getInt32(q+4,!0);return Q=Y,J=$,W6(Y,$)}finally{S.__wbindgen_add_to_stack_pointer(16),S.__wbindgen_export3(Q,J,1)}}}if(Symbol.dispose)QQ.prototype[Symbol.dispose]=QQ.prototype.free;class K${__destroy_into_raw(){let Q=this.__wbg_ptr;return this.__wbg_ptr=0,GK.unregister(this),Q}free(){let Q=this.__destroy_into_raw();S.__wbg_wasmeditabledocument_free(Q,0)}constructor(Q,J){try{let V=S.__wbindgen_add_to_stack_pointer(-16),K=HK(Q,S.__wbindgen_export),X=f0,Z=t8(J,S.__wbindgen_export,S.__wbindgen_export2),H=f0;S.wasmeditabledocument_new(V,K,X,Z,H);var Y=c().getInt32(V+0,!0),$=c().getInt32(V+4,!0),q=c().getInt32(V+8,!0);if(q)throw b0($);return this.__wbg_ptr=Y,GK.register(this,this.__wbg_ptr,this),this}finally{S.__wbindgen_add_to_stack_pointer(16)}}replaceText(Q,J){try{let V=S.__wbindgen_add_to_stack_pointer(-16),K=t8(Q,S.__wbindgen_export,S.__wbindgen_export2),X=f0,Z=t8(J,S.__wbindgen_export,S.__wbindgen_export2),H=f0;S.wasmeditabledocument_replaceText(V,this.__wbg_ptr,K,X,Z,H);var Y=c().getInt32(V+0,!0),$=c().getInt32(V+4,!0),q=c().getInt32(V+8,!0);if(q)throw b0($);return Y>>>0}finally{S.__wbindgen_add_to_stack_pointer(16)}}toBytes(){try{let V=S.__wbindgen_add_to_stack_pointer(-16);S.wasmeditabledocument_toBytes(V,this.__wbg_ptr);var Q=c().getInt32(V+0,!0),J=c().getInt32(V+4,!0),Y=c().getInt32(V+8,!0),$=c().getInt32(V+12,!0);if($)throw b0(Y);var q=yU(Q,J).slice();return S.__wbindgen_export3(Q,J*1,1),q}finally{S.__wbindgen_add_to_stack_pointer(16)}}}if(Symbol.dispose)K$.prototype[Symbol.dispose]=K$.prototype.free;function SU(){return{__proto__:null,"./office_oxide_bg.js":{__proto__:null,__wbg_Error_67e7344beaa85059:function(J,Y){let $=Error(W6(J,Y));return H6($)},__wbg_String_8564e559799eccda:function(J,Y){let $=String(a8(Y)),q=t8($,S.__wbindgen_export,S.__wbindgen_export2),V=f0;c().setInt32(J+4,V,!0),c().setInt32(J+0,q,!0)},__wbg___wbindgen_throw_5d9e815e6fdf150f:function(J,Y){throw Error(W6(J,Y))},__wbg_new_bebc3f4757acf305:function(){return H6({})},__wbg_new_ffa92086ea89f79c:function(){return H6([])},__wbg_set_13d25b81ab403f5e:function(J,Y,$){a8(J)[Y>>>0]=b0($)},__wbg_set_6be42768c690e380:function(J,Y,$){a8(J)[b0(Y)]=b0($)},__wbindgen_generic_0000000000000001:function(J){return H6(J)},__wbindgen_generic_0000000000000002:function(J){return H6(J)},__wbindgen_generic_0000000000000003:function(J,Y){let $=W6(J,Y);return H6($)},__wbindgen_generic_0000000000000004:function(J){let Y=BigInt.asUintN(64,J);return H6(Y)},__wbindgen_object_clone_ref:function(J){let Y=a8(J);return H6(Y)},__wbindgen_object_drop_ref:function(J){b0(J)}}}}var XK=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((Q)=>S.__wbg_wasmdocument_free(Q,1)),GK=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((Q)=>S.__wbg_wasmeditabledocument_free(Q,1));function H6(Q){if(s8===t0.length)t0.push(t0.length+1);let J=s8;return s8=t0[J],t0[J]=Q,J}function kU(Q){if(Q<1028)return;t0[Q]=s8,s8=Q}function yU(Q,J){return Q=Q>>>0,V8().subarray(Q/1,Q/1+J)}var D6=null;function c(){if(D6===null||D6.buffer.detached===!0||D6.buffer.detached===void 0&&D6.buffer!==S.memory.buffer)D6=new DataView(S.memory.buffer);return D6}function W6(Q,J){return hU(Q>>>0,J)}var r8=null;function V8(){if(r8===null||r8.byteLength===0)r8=new Uint8Array(S.memory.buffer);return r8}function a8(Q){return t0[Q]}var t0=Array(1024).fill(void 0);t0.push(void 0,null,!0,!1);var s8=t0.length;function HK(Q,J){let Y=J(Q.length*1,1)>>>0;return V8().set(Q,Y/1),f0=Q.length,Y}function t8(Q,J,Y){if(Y===void 0){let X=e8.encode(Q),Z=J(X.length,1)>>>0;return V8().subarray(Z,Z+X.length).set(X),f0=X.length,Z}let $=Q.length,q=J($,1)>>>0,V=V8(),K=0;for(;K<$;K++){let X=Q.charCodeAt(K);if(X>127)break;V[q+K]=X}if(K!==$){if(K!==0)Q=Q.slice(K);q=Y(q,$,$=K+Q.length*3,1)>>>0;let X=V8().subarray(q+K,q+$),Z=e8.encodeInto(Q,X);K+=Z.written,q=Y(q,$,K,1)>>>0}return f0=K,q}function b0(Q){let J=a8(Q);return kU(Q),J}var $J=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});$J.decode();var gU=2146435072,V$=0;function hU(Q,J){if(V$+=J,V$>=gU)$J=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),$J.decode(),V$=J;return $J.decode(V8().subarray(Q,Q+J))}var e8=new TextEncoder;if(!("encodeInto"in e8))e8.encodeInto=function(Q,J){let Y=e8.encode(Q);return J.set(Y),{read:Q.length,written:Y.length}};var f0=0,_U,bU,S;function fU(Q,J){return bU=Q,S=Q.exports,_U=J,D6=null,r8=null,S}function WK(Q){if(S!==void 0)return S;if(Q!==void 0)if(Object.getPrototypeOf(Q)===Object.prototype)({module:Q}=Q);else console.warn("using deprecated parameters for `initSync()`; pass a single object instead");let J=SU();if(!(Q instanceof WebAssembly.Module))Q=new WebAssembly.Module(Q);let Y=new WebAssembly.Instance(Q,J);return fU(Y,Q)}var LK="office_oxide_bg.wasm",BK=!1;function cU(Q=pU()){let J=ZK(Q,"office-oxide",LK);if(UK(J))return J;let Y=Q;for(let $=0;$<7;$++){let q=ZK(Y,"assets","office-oxide",LK);if(UK(q))return q;let V=OK(Y);if(V===Y)break;Y=V}return}function pU(){try{return OK(uU(import.meta.url))}catch{return"."}}function PK(Q,J){if(!BK){let Y=cU();if(!Y)throw Error("The reader for Word, Excel and PowerPoint 97-2003 files is missing from this installation (office_oxide_bg.wasm was not found).");WK({module:mU(Y)}),BK=!0}return new QQ(Q,J)}var lU=/\[image-base64:([A-Za-z0-9+/=\s]+)\]/g;function dU(Q){return Q.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"")}function oU(Q,J){let Y=new DataView(Q.buffer,Q.byteOffset,Q.byteLength),$=J+8;while($+12<=Q.length){let q=Y.getUint32($),V=String.fromCharCode(...Q.subarray($+4,$+8));if($+=12+q,V==="IEND")return $-J;if(q>Q.length)return}return}function nU(Q,J){let Y=J+2;while(Y+4<=Q.length){if(Q[Y]!==255)return;let $=Q[Y+1];if($===217)return Y+2-J;if($===218){Y+=2+(Q[Y+2]<<8|Q[Y+3]);while(Y+1<Q.length){if(Q[Y]===255){let q=Q[Y+1];if(q===217)return Y+2-J;if(q!==0&&(q<208||q>215))break}Y++}continue}Y+=2+(Q[Y+2]<<8|Q[Y+3])}return}async function iU(Q){let J=await import("cfb"),Y=J.default??J,$;try{$=Y.read(Buffer.from(Q),{type:"buffer"})}catch{return[]}let q=[];for(let V of $.FileIndex){let K=V.content;if(V.type!==2||!K||K.length<64)continue;let X=K instanceof Uint8Array?K:new Uint8Array(K);for(let Z=0;Z+8<X.length;Z++){let H;if(X[Z]===137&&X[Z+1]===80&&X[Z+2]===78&&X[Z+3]===71)H=oU(X,Z);else if(X[Z]===255&&X[Z+1]===216&&X[Z+2]===255)H=nU(X,Z);if(H&&H>64&&Z+H<=X.length)q.push(X.slice(Z,Z+H)),Z+=H-1}}return q}async function jK(Q,J,Y){let $=PK(Q,J),q;try{q=$.toMarkdownWithImages()}finally{$.free()}let V=0;q=q.replace(lU,(X,Z)=>{if(!Y.wantImages)return"";V++;let H=Y.images.add({data:Buffer.from(Z.replace(/\s/g,""),"base64"),stem:`${J}-image-${V}`});return H?c0(H):""}),q=dU(q).replace(/\n{3,}/g,`
15
+
16
+ `).trim();let K=[];if(Y.wantImages&&J==="doc"){let X=[];for(let Z of await iU(Q)){let H=Y.images.images.length;V++;let U=Y.images.add({data:Z,stem:`${J}-image-${V}`});if(U&&Y.images.images.length>H)X.push(c0(U))}if(X.length)q+=`
6
17
 
7
18
  ## Pictures not placed in the text
8
19
 
9
- ${Y.join(`
20
+ ${X.join(`
10
21
 
11
- `)}`,H.push(`${Y.length} picture(s) were found in the file but not at a place in its text; they are listed at the end.`)}return{markdown:Z,reader:"office_oxide",...H.length?{notes:H}:{}}}var o$={maxUncompressedBytes:268435456,maxZipEntries:20000},r$={pptx:{node:"slide",unit:"slide"},odp:{node:"slide",unit:"slide"},xlsx:{node:"sheet",unit:"sheet"},ods:{node:"sheet",unit:"sheet"}};async function a$(){let Q=await import("officeparser");return Q.OfficeParser??Q.default}function t$(Q,$){let J=Q?.message??"";if(!/password|encrypt/i.test(J))return;return Error($?"The document's password is not the one given in `password`.":"The document is password-protected. Ask the user for the password and call again with `password`.")}function e$(Q){return Q.replace(/^\s*---\n[\s\S]*?\n---\n/,"").trim()}async function mQ(Q,$,J){let q=await a$(),Z;try{Z=await q.parseOffice(Buffer.from(Q),{fileType:$,extractAttachments:J.wantImages,decompressionLimits:o$,...J.password?{password:J.password}:{}})}catch(V){throw t$(V,J.password)??V}let K=r$[$],H;if(K){let V=Z.content.filter((z)=>z.type===K.node),N=[],G=new Set;V.forEach((z,C)=>{if(!J.selects||J.selects(C+1))N.push(C+1),G.add(z)}),Z.content=Z.content.filter((z)=>z.type!==K.node||G.has(z)),H={name:K.unit,total:V.length,read:N}}let Y=new Map,X=(V,N)=>{if(Y.has(V))return Y.get(V);let G=Z.attachments?.find((C)=>C.name===V),z=G?J.images.add({data:Buffer.from(G.data,"base64"),stem:V,mediaType:G.mimeType,...N?{alt:N}:{}}):void 0;return Y.set(V,z),z},B=await Z.to("md",{mdConfig:{dialect:"github",fallbackToHtml:{textFormatting:!1,alignment:!1,anchors:!1,tables:!0,embeds:!1,cellLineBreaks:!0}},onNode:(V)=>{if(V.type!=="image")return;if(!J.wantImages)return!1;let N=V.metadata??{},G=N.attachmentName?X(N.attachmentName,N.altText):void 0;return G?x(G):!1}}),F=e$(String(B.value??""));if($==="rtf")F=F.replace(/^[ ]*\t[ \t]*(?![-*+] |\d+[.)] )/gm,"");if(J.wantImages){for(let V of Z.attachments??[])if(V.type==="image")X(V.name)}let U=Z.metadata??{};return{markdown:F,reader:"officeparser",...U.title?.trim()?{title:U.title.trim()}:{},...U.author?.trim()?{author:U.author.trim()}:{},...H?{units:H}:{}}}import{existsSync as VQ}from"node:fs";import{createRequire as QJ}from"node:module";import{dirname as pQ,join as l}from"node:path";import{fileURLToPath as $J}from"node:url";function FQ(){try{return pQ($J(import.meta.url))}catch{return"."}}function JJ(Q){try{let $=QJ(l(FQ(),"noop.js"));return pQ($.resolve(`${Q}/package.json`))}catch{return}}function CQ(Q,$,J,q){let Z=l(FQ(),Q);if(VQ(l(Z,q)))return Z;let K=JJ($),H=K?l(K,J):void 0;return H&&VQ(l(H,q))?H:void 0}function dQ(){return CQ("pdfjs/wasm","pdfjs-dist","wasm","jbig2.wasm")}function iQ(){return CQ("pdfjs/cmaps","pdfjs-dist","cmaps","UniJIS-UCS2-H.bcmap")}function nQ(){let Q=l(FQ(),"tesseract","worker.cjs");return VQ(Q)?Q:void 0}function sQ(){return CQ("tessdata","@tesseract.js-data/eng","4.0.0_best_int","eng.traineddata.gz")}var ZQ;function rQ(){return ZQ??=(async()=>{ZJ();let Q=globalThis;if(!Q.pdfjsWorker)Q.pdfjsWorker=await import("pdfjs-dist/legacy/build/pdf.worker.mjs");return await qJ(()=>import("pdfjs-dist/legacy/build/pdf.mjs"))})(),ZQ.catch(()=>{ZQ=void 0}),ZQ}async function qJ(Q){let $=console.warn;console.warn=(...J)=>{let q=String(J[0]??"");if(/^Warning: Cannot (load "@napi-rs\/canvas"|polyfill `(Path2D|DOMMatrix|ImageData)`)/.test(q))return;$(...J)};try{return await Q()}finally{console.warn=$}}function ZJ(){let Q=globalThis;if(Q.DOMMatrix)return;class ${a=1;b=0;c=0;d=1;e=0;f=0;constructor(J){if(J&&J.length>=6)[this.a,this.b,this.c,this.d,this.e,this.f]=Array.from(J).slice(0,6)}set(J){return[this.a,this.b,this.c,this.d,this.e,this.f]=J,this}product(J,q){return[J.a*q.a+J.c*q.b,J.b*q.a+J.d*q.b,J.a*q.c+J.c*q.d,J.b*q.c+J.d*q.d,J.a*q.e+J.c*q.f+J.e,J.b*q.e+J.d*q.f+J.f]}multiplySelf(J=new $){let q=J instanceof $?J:new $(J);return this.set(this.product(this,q))}preMultiplySelf(J=new $){let q=J instanceof $?J:new $(J);return this.set(this.product(q,this))}multiply(J){return new $(this.toArray()).multiplySelf(J)}translateSelf(J=0,q=0){return this.multiplySelf([1,0,0,1,J,q])}translate(J=0,q=0){return new $(this.toArray()).translateSelf(J,q)}scaleSelf(J=1,q=J){return this.multiplySelf([J,0,0,q,0,0])}scale(J=1,q=J){return new $(this.toArray()).scaleSelf(J,q)}invertSelf(){let J=this.a*this.d-this.b*this.c;if(!J)return this.set([Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN]);return this.set([this.d/J,-this.b/J,-this.c/J,this.a/J,(this.c*this.f-this.d*this.e)/J,(this.b*this.e-this.a*this.f)/J])}inverse(){return new $(this.toArray()).invertSelf()}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}}Q.DOMMatrix=$}function oQ(Q){return Q?`${Q.replace(/[\\/]+$/,"")}/`:void 0}function aQ(){let Q=oQ(dQ()),$=oQ(iQ());return{disableFontFace:!0,useSystemFonts:!1,isEvalSupported:!1,verbosity:0,...Q?{wasmUrl:Q}:{},...$?{cMapUrl:$,cMapPacked:!0}:{}}}var KJ=100,HJ=0.5,YJ=200,tQ=4,XJ=0.1,zJ=1,BJ=2,WJ=3;function GJ(Q,$){let[J=1,q=0,Z=0,K=1,H=0,Y=0]=$;return[Q[0]*J+Q[2]*q,Q[1]*J+Q[3]*q,Q[0]*Z+Q[2]*K,Q[1]*Z+Q[3]*K,Q[0]*H+Q[2]*Y+Q[4],Q[1]*H+Q[3]*Y+Q[5]]}async function UJ(Q,$){let[J,q,Z,K]=Q.view,H=Math.abs((Z-J)*(K-q))||1,Y=await Q.getOperatorList(),X=[1,0,0,1,0,0],B=[],F=0,U=!1,V=0,N=[];for(let G=0;G<Y.fnArray.length;G++){let z=Y.fnArray[G],C=Y.argsArray[G],I=()=>Math.abs(X[0]*X[3]-X[1]*X[2]);if(z===$.save)B.push(X);else if(z===$.restore)X=B.pop()??X;else if(z===$.transform)X=GJ(X,C);else if(z===$.setTextRenderingMode){if(C[0]===3)U=!0}else if(z===$.paintImageXObject||z===$.paintImageXObjectRepeat){if(F+=I(),typeof C[0]==="string")N.push({key:C[0],area:I()/H})}else if(z===$.paintInlineImageXObject)F+=I(),N.push({image:C[0],mask:!1,area:I()/H});else if(z===$.paintImageMaskXObject)F+=I(),N.push({image:C[0],mask:!0,area:I()/H});else if(z===$.constructPath)V++}return{coverage:Math.min(1,F/H),invisibleText:U,pathOps:V,pageArea:H,draws:N}}function eQ(Q){let $=Q.replace(/\s/g,"");if($.length<20)return!1;return($.match(/[-�\u0000-\u0008]/g)?.length??0)/$.length>0.3}var Q$=20000,$$=60000,KQ=new Set,e;function VJ(Q){if(KQ.add(Q),!e){let $=console.log;e=$,console.log=(...J)=>{let q=typeof J[0]==="string"?J[0]:"";if(q.startsWith("Warning: ")){for(let Z of KQ)Z(q.slice(9));return}$(...J)}}return()=>{if(KQ.delete(Q),KQ.size===0&&e)console.log=e,e=void 0}}function J$(Q,$,J){let q=$.startsWith("g_")?Q.commonObjs:Q.objs;return new Promise((Z)=>{let K=setTimeout(()=>Z("no answer"),J),H=(Y)=>{clearTimeout(K),Z(Y)};try{q.get($,(Y)=>H(Y??null))}catch{H(null)}})}function FJ(Q,$,J){let{width:q,height:Z,data:K}=$;if(!K||!q||!Z)return;if(J||$.kind===zJ){let X=q+7>>3;if(K.length<X*Z)return;let B=new Uint8Array(q*Z);for(let F=0;F<Z;F++){let U=F*X;for(let V=0;V<q;V++)B[F*q+V]=(K[U+(V>>3)]??0)>>7-(V&7)&1?255:0}return Q({width:q,height:Z,data:B,channels:1,depth:8})}let Y=$.kind===BJ?3:$.kind===WJ?4:K.length/(q*Z);if(Y!==1&&Y!==3&&Y!==4)return;return Q({width:q,height:Z,data:new Uint8Array(K.buffer,K.byteOffset,q*Z*Y),channels:Y,depth:8})}function CJ(Q,$){let J=Q?.name,q=Q?.message??"";if(J!=="PasswordException"&&!/password/i.test(q))return;return Error($?"The PDF's password is not the one given in `password`.":"The PDF is password-protected. Ask the user for the password and call again with `password`.")}async function q$(Q,$){let J=await rQ(),{encode:q}=await import("fast-png"),Z=new Set,K=$.onNote?VJ((X)=>{if(Z.size>=60||Z.has(X))return;Z.add(X),$.onNote?.(`pdf.js: ${X}`)}):void 0,H=J.getDocument({...aQ(),...$.onNote?{verbosity:1}:{},data:Q.slice(),...$.password?{password:$.password}:{}}),Y;try{Y=await H.promise}catch(X){throw await H.destroy().catch(()=>{}),K?.(),CJ(X,$.password)??X}try{return await RJ(Y,J.OPS,q,$)}finally{await H.destroy().catch(()=>{}),K?.()}}async function RJ(Q,$,J,q){let K=(await Q.getMetadata().catch(()=>{return}))?.info??{},H=Q.numPages,Y=[],X=[],B=[],F=[],U=[],V=[],N=0,G=(z,C)=>q.onProgress?.({unit:"page",at:z,total:H,pictures:N,...C?{activity:C}:{}});for(let z=1;z<=H;z++){if(q.selects&&!q.selects(z))continue;q.signal?.throwIfAborted(),G(z),Y.push(z),G(z,"opening the page");let C=await Q.getPage(z);G(z,"reading its text");let I=await C.getTextContent(),P="";for(let j of I.items){if(typeof j.str!=="string")continue;if(P+=j.str,j.hasEOL)P+=`
12
- `}P=P.replace(/[ \t]+\n/g,`
22
+ `)}`,K.push(`${X.length} picture(s) were found in the file but not at a place in its text; they are listed at the end.`)}return{markdown:q,reader:"office_oxide",...K.length?{notes:K}:{}}}var rU={maxUncompressedBytes:268435456,maxZipEntries:20000},aU={pptx:{node:"slide",unit:"slide"},odp:{node:"slide",unit:"slide"},xlsx:{node:"sheet",unit:"sheet"},ods:{node:"sheet",unit:"sheet"}};async function sU(){let Q=await import("officeparser");return Q.OfficeParser??Q.default}function tU(Q,J){let Y=Q?.message??"";if(!/password|encrypt/i.test(Y))return;return Error(J?"The document's password is not the one given in `password`.":"The document is password-protected. Ask the user for the password and call again with `password`.")}function eU(Q){return Q.replace(/^\s*---\n[\s\S]*?\n---\n/,"").trim()}async function zK(Q,J,Y){let $=await sU(),q;try{q=await $.parseOffice(Buffer.from(Q),{fileType:J,extractAttachments:Y.wantImages,decompressionLimits:rU,...Y.password?{password:Y.password}:{}})}catch(P){throw tU(P,Y.password)??P}let V=aU[J],K;if(V){let P=q.content.filter((j)=>j.type===V.node),z=[],N=new Set;P.forEach((j,C)=>{if(!Y.selects||Y.selects(C+1))z.push(C+1),N.add(j)}),q.content=q.content.filter((j)=>j.type!==V.node||N.has(j)),K={name:V.unit,total:P.length,read:z}}let X=new Map,Z=(P,z)=>{if(X.has(P))return X.get(P);let N=q.attachments?.find((C)=>C.name===P),j=N?Y.images.add({data:Buffer.from(N.data,"base64"),stem:P,mediaType:N.mimeType,...z?{alt:z}:{}}):void 0;return X.set(P,j),j},H=await q.to("md",{mdConfig:{dialect:"github",fallbackToHtml:{textFormatting:!1,alignment:!1,anchors:!1,tables:!0,embeds:!1,cellLineBreaks:!0}},onNode:(P)=>{if(P.type!=="image")return;if(!Y.wantImages)return!1;let z=P.metadata??{},N=z.attachmentName?Z(z.attachmentName,z.altText):void 0;return N?c0(N):!1}}),U=eU(String(H.value??""));if(J==="rtf")U=U.replace(/^[ ]*\t[ \t]*(?![-*+] |\d+[.)] )/gm,"");if(Y.wantImages){for(let P of q.attachments??[])if(P.type==="image")Z(P.name)}let B=q.metadata??{};return{markdown:U,reader:"officeparser",...B.title?.trim()?{title:B.title.trim()}:{},...B.author?.trim()?{author:B.author.trim()}:{},...K?{units:K}:{}}}import{existsSync as X$}from"node:fs";import{createRequire as QZ}from"node:module";import{dirname as FK,join as K8}from"node:path";import{fileURLToPath as JZ}from"node:url";function G$(){try{return FK(JZ(import.meta.url))}catch{return"."}}function YZ(Q){try{let J=QZ(K8(G$(),"noop.js"));return FK(J.resolve(`${Q}/package.json`))}catch{return}}function H$(Q,J,Y,$){let q=K8(G$(),Q);if(X$(K8(q,$)))return q;let V=YZ(J),K=V?K8(V,Y):void 0;return K&&X$(K8(K,$))?K:void 0}function NK(){return H$("pdfjs/wasm","pdfjs-dist","wasm","jbig2.wasm")}function CK(){return H$("pdfjs/cmaps","pdfjs-dist","cmaps","UniJIS-UCS2-H.bcmap")}function RK(){let Q=K8(G$(),"tesseract","worker.cjs");return X$(Q)?Q:void 0}function IK(){return H$("tessdata","@tesseract.js-data/eng","4.0.0_best_int","eng.traineddata.gz")}var qJ;function AK(){return qJ??=(async()=>{qZ();let Q=globalThis;if(!Q.pdfjsWorker)Q.pdfjsWorker=await import("pdfjs-dist/legacy/build/pdf.worker.mjs");return await $Z(()=>import("pdfjs-dist/legacy/build/pdf.mjs"))})(),qJ.catch(()=>{qJ=void 0}),qJ}async function $Z(Q){let J=console.warn;console.warn=(...Y)=>{let $=String(Y[0]??"");if(/^Warning: Cannot (load "@napi-rs\/canvas"|polyfill `(Path2D|DOMMatrix|ImageData)`)/.test($))return;J(...Y)};try{return await Q()}finally{console.warn=J}}function qZ(){let Q=globalThis;if(Q.DOMMatrix)return;class J{a=1;b=0;c=0;d=1;e=0;f=0;constructor(Y){if(Y&&Y.length>=6)[this.a,this.b,this.c,this.d,this.e,this.f]=Array.from(Y).slice(0,6)}set(Y){return[this.a,this.b,this.c,this.d,this.e,this.f]=Y,this}product(Y,$){return[Y.a*$.a+Y.c*$.b,Y.b*$.a+Y.d*$.b,Y.a*$.c+Y.c*$.d,Y.b*$.c+Y.d*$.d,Y.a*$.e+Y.c*$.f+Y.e,Y.b*$.e+Y.d*$.f+Y.f]}multiplySelf(Y=new J){let $=Y instanceof J?Y:new J(Y);return this.set(this.product(this,$))}preMultiplySelf(Y=new J){let $=Y instanceof J?Y:new J(Y);return this.set(this.product($,this))}multiply(Y){return new J(this.toArray()).multiplySelf(Y)}translateSelf(Y=0,$=0){return this.multiplySelf([1,0,0,1,Y,$])}translate(Y=0,$=0){return new J(this.toArray()).translateSelf(Y,$)}scaleSelf(Y=1,$=Y){return this.multiplySelf([Y,0,0,$,0,0])}scale(Y=1,$=Y){return new J(this.toArray()).scaleSelf(Y,$)}invertSelf(){let Y=this.a*this.d-this.b*this.c;if(!Y)return this.set([Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN]);return this.set([this.d/Y,-this.b/Y,-this.c/Y,this.a/Y,(this.c*this.f-this.d*this.e)/Y,(this.b*this.e-this.a*this.f)/Y])}inverse(){return new J(this.toArray()).invertSelf()}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}}Q.DOMMatrix=J}function MK(Q){return Q?`${Q.replace(/[\\/]+$/,"")}/`:void 0}function TK(){let Q=MK(NK()),J=MK(CK());return{disableFontFace:!0,useSystemFonts:!1,isEvalSupported:!1,verbosity:0,...Q?{wasmUrl:Q}:{},...J?{cMapUrl:J,cMapPacked:!0}:{}}}var VZ=100,KZ=0.5,XZ=200,DK=4,GZ=0.1,HZ=1,WZ=2,UZ=3;function ZZ(Q,J){let[Y=1,$=0,q=0,V=1,K=0,X=0]=J;return[Q[0]*Y+Q[2]*$,Q[1]*Y+Q[3]*$,Q[0]*q+Q[2]*V,Q[1]*q+Q[3]*V,Q[0]*K+Q[2]*X+Q[4],Q[1]*K+Q[3]*X+Q[5]]}async function LZ(Q,J){let[Y,$,q,V]=Q.view,K=Math.abs((q-Y)*(V-$))||1,X=await Q.getOperatorList(),Z=[1,0,0,1,0,0],H=[],U=0,B=!1,P=0,z=[];for(let N=0;N<X.fnArray.length;N++){let j=X.fnArray[N],C=X.argsArray[N],A=()=>Math.abs(Z[0]*Z[3]-Z[1]*Z[2]);if(j===J.save)H.push(Z);else if(j===J.restore)Z=H.pop()??Z;else if(j===J.transform)Z=ZZ(Z,C);else if(j===J.setTextRenderingMode){if(C[0]===3)B=!0}else if(j===J.paintImageXObject||j===J.paintImageXObjectRepeat){if(U+=A(),typeof C[0]==="string")z.push({key:C[0],area:A()/K})}else if(j===J.paintInlineImageXObject)U+=A(),z.push({image:C[0],mask:!1,area:A()/K});else if(j===J.paintImageMaskXObject)U+=A(),z.push({image:C[0],mask:!0,area:A()/K});else if(j===J.constructPath)P++}return{coverage:Math.min(1,U/K),invisibleText:B,pathOps:P,pageArea:K,draws:z}}function EK(Q){let J=Q.replace(/\s/g,"");if(J.length<20)return!1;return(J.match(/[-�\u0000-\u0008]/g)?.length??0)/J.length>0.3}var wK=20000,vK=60000,VJ=new Set,JQ;function BZ(Q){if(VJ.add(Q),!JQ){let J=console.log;JQ=J,console.log=(...Y)=>{let $=typeof Y[0]==="string"?Y[0]:"";if($.startsWith("Warning: ")){for(let q of VJ)q($.slice(9));return}J(...Y)}}return()=>{if(VJ.delete(Q),VJ.size===0&&JQ)console.log=JQ,JQ=void 0}}function xK(Q,J,Y){let $=J.startsWith("g_")?Q.commonObjs:Q.objs;return new Promise((q)=>{let V=setTimeout(()=>q("no answer"),Y),K=(X)=>{clearTimeout(V),q(X)};try{$.get(J,(X)=>K(X??null))}catch{K(null)}})}function OZ(Q,J,Y){let{width:$,height:q,data:V}=J;if(!V||!$||!q)return;if(Y||J.kind===HZ){let Z=$+7>>3;if(V.length<Z*q)return;let H=new Uint8Array($*q);for(let U=0;U<q;U++){let B=U*Z;for(let P=0;P<$;P++)H[U*$+P]=(V[B+(P>>3)]??0)>>7-(P&7)&1?255:0}return Q({width:$,height:q,data:H,channels:1,depth:8})}let X=J.kind===WZ?3:J.kind===UZ?4:V.length/($*q);if(X!==1&&X!==3&&X!==4)return;return Q({width:$,height:q,data:new Uint8Array(V.buffer,V.byteOffset,$*q*X),channels:X,depth:8})}function PZ(Q,J){let Y=Q?.name,$=Q?.message??"";if(Y!=="PasswordException"&&!/password/i.test($))return;return Error(J?"The PDF's password is not the one given in `password`.":"The PDF is password-protected. Ask the user for the password and call again with `password`.")}async function SK(Q,J){let Y=await AK(),{encode:$}=await import("fast-png"),q=new Set,V=J.onNote?BZ((Z)=>{if(q.size>=60||q.has(Z))return;q.add(Z),J.onNote?.(`pdf.js: ${Z}`)}):void 0,K=Y.getDocument({...TK(),...J.onNote?{verbosity:1}:{},data:Q.slice(),...J.password?{password:J.password}:{}}),X;try{X=await K.promise}catch(Z){throw await K.destroy().catch(()=>{}),V?.(),PZ(Z,J.password)??Z}try{return await jZ(X,Y.OPS,$,J)}finally{await K.destroy().catch(()=>{}),V?.()}}async function jZ(Q,J,Y,$){let V=(await Q.getMetadata().catch(()=>{return}))?.info??{},K=Q.numPages,X=[],Z=[],H=[],U=[],B=[],P=[],z=0,N=(j,C)=>$.onProgress?.({unit:"page",at:j,total:K,pictures:z,...C?{activity:C}:{}});for(let j=1;j<=K;j++){if($.selects&&!$.selects(j))continue;$.signal?.throwIfAborted(),N(j),X.push(j),N(j,"opening the page");let C=await Q.getPage(j);N(j,"reading its text");let A=await C.getTextContent(),M="";for(let I of A.items){if(typeof I.str!=="string")continue;if(M+=I.str,I.hasEOL)M+=`
23
+ `}M=M.replace(/[ \t]+\n/g,`
13
24
  `).replace(/\n{3,}/g,`
14
25
 
15
- `).trim(),G(z,"reading its layout");let v=await UJ(C,$);G(z);let b=P.replace(/\s/g,"").length,d=v.coverage>=HJ,L=!1;if(d&&v.invisibleText&&b>0)F.push(z);else if(d&&(b<KJ||eQ(P)))L=!0;else if(b===0&&v.coverage===0&&v.pathOps>=YJ)U.push(z);else if(eQ(P))L=!0;if(L)X.push(z);let T=q.wantImages||L&&!!q.recognize,S=[];if(T){let j=0,O=0;for(let k of v.draws){if(O++,"key"in k)G(z,`decoding picture ${O} of ${v.draws.length}`);let A="key"in k?await J$(C,k.key,Q$):k.image;if(A==="no answer"&&"key"in k){let{key:f}=k;q.onNote?.(`page ${z}: picture ${O} of ${v.draws.length} (${f}) did not arrive in ${Q$/1000}s; asking for the page's pictures again`),G(z,`decoding picture ${O} of ${v.draws.length} again`),C.cleanup();let vQ=await Promise.race([C.getOperatorList().then(()=>!0),new Promise((zQ)=>setTimeout(()=>zQ(!1),$$))]).catch(()=>!1);if(A=vQ?await J$(C,f,$$):"no answer",A==="no answer"){let zQ=f.startsWith("g_")?C.commonObjs:C.objs,SQ="unknown";try{SQ=zQ.has(f)?"delivered late":"never delivered"}catch{}q.problems?.push(`page ${z}: picture ${O} of ${v.draws.length} (${f}) was left out, the PDF decoder gave no answer for it when asked twice (${vQ?SQ:"the page's drawing did not come back either"})`),q.onNote?.(`page ${z}: picture ${O} (${f}) left out after the second request`);continue}q.onNote?.(`page ${z}: picture ${O} (${f}) arrived on the second request`)}if(A==="no answer")continue;if(!A){q.problems?.push(`page ${z}: a picture was left out, the PDF decoder could not decode it`);continue}if(A.width<tQ||A.height<tQ)continue;let OQ=FJ(J,A,"mask"in k&&k.mask);if(!OQ){q.problems?.push(`page ${z}: a ${A.width}x${A.height} picture was left out, its pixel layout is one this cannot write`);continue}j++,N++,S.push({png:OQ,width:A.width,height:A.height,coverage:k.area,stem:`p${z}-${j}`})}}let w;if(L&&q.recognize){let j=S.filter((k)=>k.coverage>=XJ);if(j.length>0)G(z,"recognizing text");let O=j.length>0?await q.recognize(z,j):void 0;if(O?.text.trim())B.push(z),w=`[Text recognized from the page image by ${O.by}]
26
+ `).trim(),N(j,"reading its layout");let T=await LZ(C,J);N(j);let R=M.replace(/\s/g,"").length,D=T.coverage>=KZ,x=!1;if(D&&T.invisibleText&&R>0)U.push(j);else if(D&&(R<VZ||EK(M)))x=!0;else if(R===0&&T.coverage===0&&T.pathOps>=XZ)B.push(j);else if(EK(M))x=!0;if(x)Z.push(j);let w=$.wantImages||x&&!!$.recognize,v=[];if(w){let I=0,_=0;for(let o of T.draws){if(_++,"key"in o)N(j,`decoding picture ${_} of ${T.draws.length}`);let i="key"in o?await xK(C,o.key,wK):o.image;if(i==="no answer"&&"key"in o){let{key:y}=o;$.onNote?.(`page ${j}: picture ${_} of ${T.draws.length} (${y}) did not arrive in ${wK/1000}s; asking for the page's pictures again`),N(j,`decoding picture ${_} of ${T.draws.length} again`),C.cleanup();let $0=await Promise.race([C.getOperatorList().then(()=>!0),new Promise((W0)=>setTimeout(()=>W0(!1),vK))]).catch(()=>!1);if(i=$0?await xK(C,y,vK):"no answer",i==="no answer"){let W0=y.startsWith("g_")?C.commonObjs:C.objs,Q0="unknown";try{Q0=W0.has(y)?"delivered late":"never delivered"}catch{}$.problems?.push(`page ${j}: picture ${_} of ${T.draws.length} (${y}) was left out, the PDF decoder gave no answer for it when asked twice (${$0?Q0:"the page's drawing did not come back either"})`),$.onNote?.(`page ${j}: picture ${_} (${y}) left out after the second request`);continue}$.onNote?.(`page ${j}: picture ${_} (${y}) arrived on the second request`)}if(i==="no answer")continue;if(!i){$.problems?.push(`page ${j}: a picture was left out, the PDF decoder could not decode it`);continue}if(i.width<DK||i.height<DK)continue;let D0=OZ(Y,i,"mask"in o&&o.mask);if(!D0){$.problems?.push(`page ${j}: a ${i.width}x${i.height} picture was left out, its pixel layout is one this cannot write`);continue}I++,z++,v.push({png:D0,width:i.width,height:i.height,coverage:o.area,stem:`p${j}-${I}`})}}let L;if(x&&$.recognize){let I=v.filter((o)=>o.coverage>=GZ);if(I.length>0)N(j,"recognizing text");let _=I.length>0?await $.recognize(j,I):void 0;if(_?.text.trim())H.push(j),L=`[Text recognized from the page image by ${_.by}]
16
27
 
17
- ${O.text.trim()}`}let i=[];if(q.wantImages)for(let j of S){let O=q.images.add({data:j.png,stem:j.stem,mediaType:"image/png",width:j.width,height:j.height,source:`page ${z}`});if(O)i.push(x(O))}G(z),V.push([`## Page ${z}`,P,w??"",...i].filter((j)=>j.length>0).join(`
28
+ ${_.text.trim()}`}let k=[];if($.wantImages)for(let I of v){let _=$.images.add({data:I.png,stem:I.stem,mediaType:"image/png",width:I.width,height:I.height,source:`page ${j}`});if(_)k.push(c0(_))}N(j),P.push([`## Page ${j}`,M,L??"",...k].filter((I)=>I.length>0).join(`
18
29
 
19
- `)),C.cleanup()}return{markdown:V.join(`
30
+ `)),C.cleanup()}return{markdown:P.join(`
20
31
 
21
- `),reader:"pdf.js",...typeof K.Title==="string"&&K.Title.trim()?{title:K.Title.trim()}:{},...typeof K.Author==="string"&&K.Author.trim()?{author:K.Author.trim()}:{},units:{name:"page",total:H,read:Y},...X.length?{scannedPages:X}:{},...B.length?{recognizedPages:B}:{},...F.length?{ocrLayerPages:F}:{},...U.length?{vectorPages:U}:{}}}function Z$(Q){let $=Q?.trim();if(!$)return;let J=[];for(let q of $.split(",")){let Z=q.trim();if(!Z)continue;let K=/^(\d+)\s*(?:-\s*(\d*))?$/.exec(Z);if(!K)throw Error(`range "${Q}" is not understood: use one-based numbers, spans and an open end, like "1-5,9,12-".`);let H=Number(K[1]),Y=K[2]===void 0?H:K[2]===""?Number.POSITIVE_INFINITY:Number(K[2]);if(H<1||Y<H)throw Error(`range "${Z}" is empty: numbers start at 1 and a span runs low to high.`);J.push([H,Y])}if(J.length===0)return;return{selects:(q)=>J.some(([Z,K])=>q>=Z&&q<=K),spec:$.replace(/\s+/g,"")}}function m(Q){let $=[...new Set(Q)].sort((q,Z)=>q-Z),J=[];for(let q=0;q<$.length;){let Z=q;while(Z+1<$.length&&$[Z+1]===$[Z]+1)Z++;J.push(q===Z?`${$[q]}`:`${$[q]}-${$[Z]}`),q=Z+1}return J.join(", ")}import{existsSync as K$}from"node:fs";import{copyFile as NJ,mkdir as LJ,readdir as T0,rename as O0,rm as v0,writeFile as S0}from"node:fs/promises";import{join as HQ}from"node:path";import{resolveClineDataDir as jJ}from"@cerebriline/shared/storage";var QQ="eng",RQ=".traineddata.gz";function LQ(){return HQ(jJ(),"tessdata")}function H$(Q){let J=(typeof Q==="string"?Q.split(/[+,\s]+/):Q??[]).map((q)=>q.trim().toLowerCase()).filter(Boolean);return[...new Set(J)]}async function TJ(Q,$){let J=sQ();if(J&&Q.every((K)=>K===QQ))return J;let q=Q.filter((K)=>!K$(HQ($,`${K}${RQ}`))&&!(K===QQ&&J));if(q.length>0)throw new YQ(q);let Z=HQ($,`${QQ}${RQ}`);if(J&&Q.includes(QQ)&&!K$(Z))await LJ($,{recursive:!0}),await NJ(HQ(J,`${QQ}${RQ}`),Z);return $}class YQ extends Error{languages;constructor(Q){super(`OCR language${Q.length===1?"":"s"} ${Q.join(", ")} ${Q.length===1?"is":"are"} not installed.`);this.languages=Q}}var OJ=180000,vJ=120000,SJ=1e4;function NQ(Q,$,J){let q;return Promise.race([Q,new Promise((Z,K)=>{q=setTimeout(()=>K(Error(`${J} gave no answer in ${$/1000}s`)),$)})]).finally(()=>clearTimeout(q))}class XQ{worker;languages;failure;dead;constructor(Q,$,J){this.worker=Q;this.languages=$;this.failure=J}static async open(Q,$=LQ()){let J=await TJ(Q,$),q=await import("tesseract.js"),Z=q.default??q,K=nQ(),H={},Y=await NQ(Z.createWorker(Q.join("+"),Z.OEM.LSTM_ONLY,{langPath:J,gzip:!0,cacheMethod:"none",...K?{workerPath:K}:{},errorHandler:(X)=>{let B=X instanceof Error?X:Error(`the OCR worker failed: ${String(X)}`);H.error=B,H.raise?.(B)}}),vJ,"Starting the OCR worker");return new XQ(Y,Q,H)}async recognize(Q){if(this.dead)throw this.dead;if(this.failure.error)throw this.dead=this.failure.error,this.dead;try{let{data:$}=await NQ(Promise.race([this.worker.recognize(Buffer.from(Q)),new Promise((J,q)=>{this.failure.raise=q})]),OJ,"The OCR worker");return{text:$.text??"",confidence:Math.round($.confidence??0)}}catch($){if(this.failure.error||$ instanceof Error&&/gave no answer/.test($.message))this.dead=$ instanceof Error?$:Error(String($));throw $}finally{this.failure.raise=void 0}}async close(){await NQ(this.worker.terminate(),SJ,"Stopping the OCR worker").catch(()=>{})}}var PJ=40,AJ=12,IJ=4;var kJ="This is a scanned page from a document. Transcribe all of its text exactly as written, in reading order, keeping paragraphs, headings and lists, and table rows as Markdown tables. Do not describe the page, summarize or add anything. Reply with the text only, or with nothing if the page has no text.";var Y$="The user can change this under Settings > Features > Document Reader.";function DJ(Q){let $=Q.settings.ocr??"tesseract";if(Q.request==="none")return{kind:"none",reason:'Text recognition was skipped (ocr: "none").'};if($==="off")return{kind:"none",reason:`Text recognition (OCR) is turned off. ${Y$}`};let J=!Q.request||Q.request==="auto"?$:Q.request,q=H$(Q.languages??Q.settings.ocrLanguages??["eng"]);if(J==="tesseract")return{kind:"tesseract",languages:q.length?q:["eng"]};if(Q.describeImages)return{kind:"vision"};if(Q.modelSupportsImages)return{kind:"self",why:"no vision model is configured"};return{kind:"tesseract",languages:q.length?q:["eng"],fallback:"No vision model is configured and this model does not take images, so tesseract read the pages instead."}}function X$(Q){let $=DJ(Q),J=[],q=[],Z=[],K,H=0,Y=Q.pageLimit!==void 0?Q.pageLimit:$.kind==="tesseract"?PJ:$.kind==="vision"?AJ:IJ;return{recognize:$.kind==="none"?void 0:async(B,F)=>{if(H>=Y){q.push(B);return}H++;let U=[...F].sort((z,C)=>C.coverage-z.coverage);if($.kind==="self"){let z=U[0];if(z)J.push({page:B,png:z.png});return}if($.kind==="vision")return EJ(Q.describeImages,B,U,Z);K??=XQ.open($.languages,Q.settings.ocrDataDir??LQ());let V;try{V=await K}catch(z){if(!Z.length)Z.push(MJ(z));return}let N=[],G=0;for(let z of U)try{let C=await V.recognize(z.png);if(C.text.trim())N.push(C.text.trim()),G=Math.max(G,C.confidence)}catch(C){Z.push(`page ${B}: ${C instanceof Error?C.message:String(C)}`)}if(!N.length)return;return{text:N.join(`
32
+ `),reader:"pdf.js",...typeof V.Title==="string"&&V.Title.trim()?{title:V.Title.trim()}:{},...typeof V.Author==="string"&&V.Author.trim()?{author:V.Author.trim()}:{},units:{name:"page",total:K,read:X},...Z.length?{scannedPages:Z}:{},...H.length?{recognizedPages:H}:{},...U.length?{ocrLayerPages:U}:{},...B.length?{vectorPages:B}:{}}}function kK(Q){let J=Q?.trim();if(!J)return;let Y=[];for(let $ of J.split(",")){let q=$.trim();if(!q)continue;let V=/^(\d+)\s*(?:-\s*(\d*))?$/.exec(q);if(!V)throw Error(`range "${Q}" is not understood: use one-based numbers, spans and an open end, like "1-5,9,12-".`);let K=Number(V[1]),X=V[2]===void 0?K:V[2]===""?Number.POSITIVE_INFINITY:Number(V[2]);if(K<1||X<K)throw Error(`range "${q}" is empty: numbers start at 1 and a span runs low to high.`);Y.push([K,X])}if(Y.length===0)return;return{selects:($)=>Y.some(([q,V])=>$>=q&&$<=V),spec:J.replace(/\s+/g,"")}}function X8(Q){let J=[...new Set(Q)].sort(($,q)=>$-q),Y=[];for(let $=0;$<J.length;){let q=$;while(q+1<J.length&&J[q+1]===J[q]+1)q++;Y.push($===q?`${J[$]}`:`${J[$]}-${J[q]}`),$=q+1}return Y.join(", ")}import{existsSync as yK}from"node:fs";import{copyFile as zZ,mkdir as FZ,readdir as iB,rename as rB,rm as aB,writeFile as sB}from"node:fs/promises";import{join as KJ}from"node:path";import{resolveClineDataDir as NZ}from"@cerebriline/shared/storage";var YQ="eng",W$=".traineddata.gz";function Z$(){return KJ(NZ(),"tessdata")}function gK(Q){let Y=(typeof Q==="string"?Q.split(/[+,\s]+/):Q??[]).map(($)=>$.trim().toLowerCase()).filter(Boolean);return[...new Set(Y)]}async function CZ(Q,J){let Y=IK();if(Y&&Q.every((V)=>V===YQ))return Y;let $=Q.filter((V)=>!yK(KJ(J,`${V}${W$}`))&&!(V===YQ&&Y));if($.length>0)throw new XJ($);let q=KJ(J,`${YQ}${W$}`);if(Y&&Q.includes(YQ)&&!yK(q))await FZ(J,{recursive:!0}),await zZ(KJ(Y,`${YQ}${W$}`),q);return J}class XJ extends Error{languages;constructor(Q){super(`OCR language${Q.length===1?"":"s"} ${Q.join(", ")} ${Q.length===1?"is":"are"} not installed.`);this.languages=Q}}var RZ=180000,IZ=120000,MZ=1e4;function U$(Q,J,Y){let $;return Promise.race([Q,new Promise((q,V)=>{$=setTimeout(()=>V(Error(`${Y} gave no answer in ${J/1000}s`)),J)})]).finally(()=>clearTimeout($))}class GJ{worker;languages;failure;dead;constructor(Q,J,Y){this.worker=Q;this.languages=J;this.failure=Y}static async open(Q,J=Z$()){let Y=await CZ(Q,J),$=await import("tesseract.js"),q=$.default??$,V=RK(),K={},X=await U$(q.createWorker(Q.join("+"),q.OEM.LSTM_ONLY,{langPath:Y,gzip:!0,cacheMethod:"none",...V?{workerPath:V}:{},errorHandler:(Z)=>{let H=Z instanceof Error?Z:Error(`the OCR worker failed: ${String(Z)}`);K.error=H,K.raise?.(H)}}),IZ,"Starting the OCR worker");return new GJ(X,Q,K)}async recognize(Q){if(this.dead)throw this.dead;if(this.failure.error)throw this.dead=this.failure.error,this.dead;try{let{data:J}=await U$(Promise.race([this.worker.recognize(Buffer.from(Q)),new Promise((Y,$)=>{this.failure.raise=$})]),RZ,"The OCR worker");return{text:J.text??"",confidence:Math.round(J.confidence??0)}}catch(J){if(this.failure.error||J instanceof Error&&/gave no answer/.test(J.message))this.dead=J instanceof Error?J:Error(String(J));throw J}finally{this.failure.raise=void 0}}async close(){await U$(this.worker.terminate(),MZ,"Stopping the OCR worker").catch(()=>{})}}var AZ=40,TZ=12,DZ=4;var EZ="This is a scanned page from a document. Transcribe all of its text exactly as written, in reading order, keeping paragraphs, headings and lists, and table rows as Markdown tables. Do not describe the page, summarize or add anything. Reply with the text only, or with nothing if the page has no text.";var hK="The user can change this under Settings > Features > Document Reader.";function wZ(Q){let J=Q.settings.ocr??"tesseract";if(Q.request==="none")return{kind:"none",reason:'Text recognition was skipped (ocr: "none").'};if(J==="off")return{kind:"none",reason:`Text recognition (OCR) is turned off. ${hK}`};let Y=!Q.request||Q.request==="auto"?J:Q.request,$=gK(Q.languages??Q.settings.ocrLanguages??["eng"]);if(Y==="tesseract")return{kind:"tesseract",languages:$.length?$:["eng"]};if(Q.describeImages)return{kind:"vision"};if(Q.modelSupportsImages)return{kind:"self",why:"no vision model is configured"};return{kind:"tesseract",languages:$.length?$:["eng"],fallback:"No vision model is configured and this model does not take images, so tesseract read the pages instead."}}function _K(Q){let J=wZ(Q),Y=[],$=[],q=[],V,K=0,X=Q.pageLimit!==void 0?Q.pageLimit:J.kind==="tesseract"?AZ:J.kind==="vision"?TZ:DZ;return{recognize:J.kind==="none"?void 0:async(H,U)=>{if(K>=X){$.push(H);return}K++;let B=[...U].sort((j,C)=>C.coverage-j.coverage);if(J.kind==="self"){let j=B[0];if(j)Y.push({page:H,png:j.png});return}if(J.kind==="vision")return xZ(Q.describeImages,H,B,q);V??=GJ.open(J.languages,Q.settings.ocrDataDir??Z$());let P;try{P=await V}catch(j){if(!q.length)q.push(vZ(j));return}let z=[],N=0;for(let j of B)try{let C=await P.recognize(j.png);if(C.text.trim())z.push(C.text.trim()),N=Math.max(N,C.confidence)}catch(C){q.push(`page ${H}: ${C instanceof Error?C.message:String(C)}`)}if(!z.length)return;return{text:z.join(`
22
33
 
23
- `),by:`tesseract (${$.languages.join("+")}, ${G}% confidence)`}},attachments:J,notes(B,F){if(!B.length)return[];let U=[],V=B.filter((G)=>!F.includes(G));if($.kind==="none")return U.push(`Scanned pages ${m(B)}: an image of text with no text layer, so their words are not in this text. ${$.reason}`),U;if(F.length){let G=$.kind==="vision"?"the vision model":`tesseract (${$.kind==="tesseract"?$.languages.join("+"):"eng"})`;U.push(`Scanned pages ${m(F)}: their text was recognized from the page image by ${G}, and may contain recognition errors.`)}if($.kind==="tesseract"&&$.fallback)U.push($.fallback);if($.kind==="self"&&J.length)U.push(`Scanned pages ${m(J.map((G)=>G.page))} are attached below as images (${$.why}): read their text from them.`);if(q.length)U.push(`Scanned pages ${m(q)} were not read: one call reads at most ${Y} scanned pages. Call again with range: "${q[0]}-" for the rest.`);let N=V.filter((G)=>!q.includes(G)&&!($.kind==="self"&&J.some((z)=>z.page===G)));if(N.length)U.push(`Scanned pages ${m(N)}: no text could be recognized${Z.length?` (${Z.slice(0,3).join("; ")})`:""}.`);return U},problems(B,F){let U=[],V=new Map;for(let G of Z){let z=/^page (\d+): ([\s\S]*)$/.exec(G);if(z)V.set(Number(z[1]),z[2]??"")}let N=Z.filter((G)=>!/^page \d+: /.test(G));for(let G of B){if(F.includes(G))continue;let z=q.includes(G)?`past the ${Y} pages recognized in one call`:V.get(G)??N[0]??($.kind==="none"?$.reason:"nothing readable was found on it");U.push(`page ${G}: a scan with no recognized text, ${z}`)}return U},async close(){if(K)await(await K.catch(()=>{return}))?.close()}}}function MJ(Q){if(Q instanceof YQ)return`${Q.message} ${Y$} In the CLI, --ocr-languages installs them`;return`tesseract did not start: ${Q instanceof Error?Q.message:String(Q)}`}async function EJ(Q,$,J,q){if(!Q)return;let Z=J[0];if(!Z)return;try{let[K]=await Q([{image:Buffer.from(Z.png).toString("base64"),mediaType:"image/png",instruction:kJ}]);return K?.trim()?{text:K.trim(),by:"the vision model"}:void 0}catch(K){q.push(`page ${$}: ${K instanceof Error?K.message:String(K)}`);return}}function _J(Q,$,J,q){switch(J){case"pdf":return q$($,q);case"doc":case"xls":case"ppt":return lQ($,J,q);case"epub":case"mobi":case"azw3":case"fb2":return DQ(Q,$,J,q);default:return mQ($,J,q)}}async function z$(Q,$={}){let J=new Uint8Array(await xJ.readFile(Q.filePath)),q=EQ(Q.namedAs??Q.filePath,J.subarray(0,512));if("unsupported"in q)throw Error(q.unsupported);let{format:Z}=q,K=Z$(Q.range),H=Z==="pdf"?X$({request:Q.recognition.request,languages:Q.recognition.languages,settings:Q.recognition.settings,describeImages:$.describeImages,modelSupportsImages:Q.recognition.modelSupportsImages,...Q.recognition.everyPage?{pageLimit:Number.POSITIVE_INFINITY}:{}}):void 0,Y=[],X=new BQ("images"),B;try{B=await _J(Q.filePath,J,Z,{images:X,wantImages:Q.wantImages,scratchDir:Q.scratchDir,problems:Y,...Q.password?{password:Q.password}:{},...K?{selects:K.selects}:{},...$.signal?{signal:$.signal}:{},...$.onProgress?{onProgress:$.onProgress}:{},...$.onNote?{onNote:$.onNote}:{},...H?.recognize?{recognize:H.recognize}:{}})}finally{await H?.close()}let F=B.scannedPages??[],U=B.recognizedPages??[];return{format:Z,result:B,images:[...X.entries()],recognitionNotes:H?.notes(F,U)??[],recognitionProblems:H?.problems(F,U)??[],attachments:H?.attachments??[],problems:Y}}var B$=".out";var G$=process;function p(Q){return new Promise(($)=>{if(!process.connected||!G$.send){$();return}G$.send(Q,()=>$())})}var jQ=new AbortController,TQ=new Map,hJ=0;function bJ(Q){let $=hJ++;return new Promise((J,q)=>{TQ.set($,{resolve:J,reject:q}),p({type:"describe",id:$,images:[...Q]})})}async function fJ(Q,$){let J=Date.now();try{let q=await z$(Q,{signal:jQ.signal,onProgress:(H)=>void p({type:"progress",progress:H}),onNote:(H)=>void p({type:"note",line:H}),...$?{describeImages:bJ}:{}}),Z=W$(Q.scratchDir,B$);await wJ(Z,{recursive:!0});let K=[];for(let[H,{image:Y,data:X}]of q.images.entries()){let B=W$(Z,String(H));await yJ(B,X),K.push({image:Y,file:B})}await p({type:"done",format:q.format,result:q.result,images:K,recognitionNotes:q.recognitionNotes,recognitionProblems:q.recognitionProblems,attachments:q.attachments,problems:q.problems,usage:{ms:Date.now()-J,peakRssMb:Math.round(process.resourceUsage().maxRSS/1024)}})}catch(q){await p({type:"failed",message:q instanceof Error?q.message:String(q),aborted:jQ.signal.aborted})}await Promise.race([cJ,new Promise((q)=>setTimeout(q,uJ).unref())]),process.exit(0)}var uJ=60000,V$=()=>{},cJ=new Promise((Q)=>{V$=Q}),U$=!1;process.on("message",(Q)=>{if(Q.type==="start"&&!U$)U$=!0,fJ(Q.job,Q.hasVision);else if(Q.type==="received")V$();else if(Q.type==="abort")jQ.abort();else if(Q.type==="described"){let $=TQ.get(Q.id);if(TQ.delete(Q.id),!$)return;if(Q.error!==void 0)$.reject(Error(Q.error));else $.resolve(Q.descriptions??[])}});process.on("disconnect",()=>process.exit(0));p({type:"ready"});
34
+ `),by:`tesseract (${J.languages.join("+")}, ${N}% confidence)`}},attachments:Y,notes(H,U){if(!H.length)return[];let B=[],P=H.filter((N)=>!U.includes(N));if(J.kind==="none")return B.push(`Scanned pages ${X8(H)}: an image of text with no text layer, so their words are not in this text. ${J.reason}`),B;if(U.length){let N=J.kind==="vision"?"the vision model":`tesseract (${J.kind==="tesseract"?J.languages.join("+"):"eng"})`;B.push(`Scanned pages ${X8(U)}: their text was recognized from the page image by ${N}, and may contain recognition errors.`)}if(J.kind==="tesseract"&&J.fallback)B.push(J.fallback);if(J.kind==="self"&&Y.length)B.push(`Scanned pages ${X8(Y.map((N)=>N.page))} are attached below as images (${J.why}): read their text from them.`);if($.length)B.push(`Scanned pages ${X8($)} were not read: one call reads at most ${X} scanned pages. Call again with range: "${$[0]}-" for the rest.`);let z=P.filter((N)=>!$.includes(N)&&!(J.kind==="self"&&Y.some((j)=>j.page===N)));if(z.length)B.push(`Scanned pages ${X8(z)}: no text could be recognized${q.length?` (${q.slice(0,3).join("; ")})`:""}.`);return B},problems(H,U){let B=[],P=new Map;for(let N of q){let j=/^page (\d+): ([\s\S]*)$/.exec(N);if(j)P.set(Number(j[1]),j[2]??"")}let z=q.filter((N)=>!/^page \d+: /.test(N));for(let N of H){if(U.includes(N))continue;let j=$.includes(N)?`past the ${X} pages recognized in one call`:P.get(N)??z[0]??(J.kind==="none"?J.reason:"nothing readable was found on it");B.push(`page ${N}: a scan with no recognized text, ${j}`)}return B},async close(){if(V)await(await V.catch(()=>{return}))?.close()}}}function vZ(Q){if(Q instanceof XJ)return`${Q.message} ${hK} In the CLI, --ocr-languages installs them`;return`tesseract did not start: ${Q instanceof Error?Q.message:String(Q)}`}async function xZ(Q,J,Y,$){if(!Q)return;let q=Y[0];if(!q)return;try{let[V]=await Q([{image:Buffer.from(q.png).toString("base64"),mediaType:"image/png",instruction:EZ}]);return V?.trim()?{text:V.trim(),by:"the vision model"}:void 0}catch(V){$.push(`page ${J}: ${V instanceof Error?V.message:String(V)}`);return}}function kZ(Q,J,Y,$){switch(Y){case"pdf":return SK(J,$);case"doc":case"xls":case"ppt":return jK(J,Y,$);case"epub":case"mobi":case"azw3":case"fb2":return qK(Q,J,Y,$);default:return zK(J,Y,$)}}async function bK(Q,J={}){let Y=new Uint8Array(await SZ.readFile(Q.filePath)),$=KK(Q.namedAs??Q.filePath,Y.subarray(0,512));if("unsupported"in $)throw Error($.unsupported);let{format:q}=$,V=kK(Q.range),K=q==="pdf"?_K({request:Q.recognition.request,languages:Q.recognition.languages,settings:Q.recognition.settings,describeImages:J.describeImages,modelSupportsImages:Q.recognition.modelSupportsImages,...Q.recognition.everyPage?{pageLimit:Number.POSITIVE_INFINITY}:{}}):void 0,X=[],Z=new ZJ("images"),H;try{H=await kZ(Q.filePath,Y,q,{images:Z,wantImages:Q.wantImages,scratchDir:Q.scratchDir,problems:X,...Q.password?{password:Q.password}:{},...V?{selects:V.selects}:{},...J.signal?{signal:J.signal}:{},...J.onProgress?{onProgress:J.onProgress}:{},...J.onNote?{onNote:J.onNote}:{},...K?.recognize?{recognize:K.recognize}:{}})}finally{await K?.close()}let U=H.scannedPages??[],B=H.recognizedPages??[];return{format:q,result:H,images:[...Z.entries()],recognitionNotes:K?.notes(U,B)??[],recognitionProblems:K?.problems(U,B)??[],attachments:K?.attachments??[],problems:X}}var fK=".out";var uK=process;function G8(Q){return new Promise((J)=>{if(!process.connected||!uK.send){J();return}uK.send(Q,()=>J())})}var L$=new AbortController,B$=new Map,hZ=0;function _Z(Q){let J=hZ++;return new Promise((Y,$)=>{B$.set(J,{resolve:Y,reject:$}),G8({type:"describe",id:J,images:[...Q]})})}async function bZ(Q,J){let Y=Date.now();try{let $=await bK(Q,{signal:L$.signal,onProgress:(K)=>void G8({type:"progress",progress:K}),onNote:(K)=>void G8({type:"note",line:K}),...J?{describeImages:_Z}:{}}),q=mK(Q.scratchDir,fK);await yZ(q,{recursive:!0});let V=[];for(let[K,{image:X,data:Z}]of $.images.entries()){let H=mK(q,String(K));await gZ(H,Z),V.push({image:X,file:H})}await G8({type:"done",format:$.format,result:$.result,images:V,recognitionNotes:$.recognitionNotes,recognitionProblems:$.recognitionProblems,attachments:$.attachments,problems:$.problems,usage:{ms:Date.now()-Y,peakRssMb:Math.round(process.resourceUsage().maxRSS/1024)}})}catch($){await G8({type:"failed",message:$ instanceof Error?$.message:String($),aborted:L$.signal.aborted})}await Promise.race([mZ,new Promise(($)=>setTimeout($,fZ).unref())]),process.exit(0)}var fZ=60000,pK=()=>{},mZ=new Promise((Q)=>{pK=Q}),cK=!1;process.on("message",(Q)=>{if(Q.type==="start"&&!cK)cK=!0,bZ(Q.job,Q.hasVision);else if(Q.type==="received")pK();else if(Q.type==="abort")L$.abort();else if(Q.type==="described"){let J=B$.get(Q.id);if(B$.delete(Q.id),!J)return;if(Q.error!==void 0)J.reject(Error(Q.error));else J.resolve(Q.descriptions??[])}});process.on("disconnect",()=>process.exit(0));G8({type:"ready"});