@tachybase/plugin-log-viewer 0.23.8

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.
@@ -0,0 +1,14 @@
1
+
2
+ 
3
+ > @tachybase/plugin-log-viewer@0.23.7 build /Users/seal/Documents/projects/tachybase/packages/plugin-log-viewer
4
+ > tachybase-build --no-dts @tachybase/plugin-log-viewer
5
+
6
+ The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
7
+ @tachybase/plugin-log-viewer: plugin-log-viewer build start
8
+ @tachybase/plugin-log-viewer: build plugin client
9
+ @tachybase/plugin-log-viewer: build plugin server source
10
+ @tachybase/plugin-log-viewer: delete server files
11
+ @tachybase/plugin-log-viewer: build plugin server dependencies
12
+ @tachybase/plugin-log-viewer: These packages tar-fs will be bundled to dist/node_modules. These packages @tachybase/server, @tachybase/actions, @tachybase/logger will be exclude.
13
+ @tachybase/plugin-log-viewer: write external version
14
+
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @tachybase/plugin-logger
package/client.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client';
2
+ export { default } from './dist/client';
package/client.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client/index.js');
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const LogsDownloader: React.NamedExoticComponent<object>;
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@tachybase/client';
2
+ export declare class PluginLogViewer extends Plugin {
3
+ load(): Promise<void>;
4
+ }
5
+ export default PluginLogViewer;
@@ -0,0 +1,3 @@
1
+ (function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@tachybase/client"),require("react-i18next"),require("react/jsx-runtime"),require("react"),require("@ant-design/icons"),require("ahooks"),require("antd")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react-i18next","react/jsx-runtime","react","@ant-design/icons","ahooks","antd"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@tachybase/plugin-log-viewer"]={},e["@tachybase/client"],e["react-i18next"],e.jsxRuntime,e.react,e["@ant-design/icons"],e.ahooks,e.antd))})(this,function(e,t,i,r,a,v,C,c){"use strict";var re=Object.defineProperty,se=Object.defineProperties;var ne=Object.getOwnPropertyDescriptors;var Q=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable;var J=(e,t,i)=>t in e?re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,_=(e,t)=>{for(var i in t||(t={}))oe.call(t,i)&&J(e,i,t[i]);if(Q)for(var i of Q(t))ie.call(t,i)&&J(e,i,t[i]);return e},j=(e,t)=>se(e,ne(t));var W=(e,t,i)=>new Promise((r,a)=>{var v=g=>{try{c(i.next(g))}catch(w){a(w)}},C=g=>{try{c(i.throw(g))}catch(w){a(w)}},c=g=>g.done?r(g.value):Promise.resolve(g.value).then(v,C);c((i=i.apply(e,t)).next())});const g="log-viewer";function w(p){return t.i18n.t(p,{ns:[g,"core"]})}function I(){return i.useTranslation([g,"core"])}const{Paragraph:L,Text:E}=c.Typography,B=a.memo(()=>{const{t:p}=I();return r.jsxs(c.Typography,{children:[r.jsxs(L,{children:[r.jsx(E,{code:!0,children:"[app]/request_*.log"})," - ",p("API request and response logs")]}),r.jsxs(L,{children:[r.jsx(E,{code:!0,children:"[app]/system_*.log"})," -"," ",p("Application, database, plugins and other system logs, the error level logs will be sent to")," ",r.jsx(E,{code:!0,children:"[app]/system_error_*.log"})]}),r.jsxs(L,{children:[r.jsx(E,{code:!0,children:"[app]/sql_*.log"})," -"," ",p("SQL execution logs, printed by Sequelize when the db logging is enabled")]})]})});B.displayName="Tips";const O=a.memo(p=>{const{token:f}=c.theme.useToken(),{t:y}=I(),x=C.useMemoizedFn(y),k=t.useAPIClient(),[b,m]=a.useState(["0"]),[T,X]=a.useState(""),[Y,D]=a.useState(!0),[$,F]=a.useState([]),[P,H]=a.useState(),{data:K}=t.useRequest(()=>k.resource("logger").list().then(o=>{var d;return(d=o.data)==null?void 0:d.data})),{data:A,run:Z}=t.useRequest({url:"logger:preview",method:"post",data:{file:P}},{manual:!0});a.useEffect(()=>{P&&Z()},[P]);const M=a.useCallback((o,d)=>o.map((n,u)=>{const s=`${d}-${u}`;return typeof n=="string"?{title:n,key:s,icon:r.jsx(v.FileOutlined,{})}:{title:n.name,key:s,icon:r.jsx(v.FolderOutlined,{}),children:M(n.files,s)}}),[]),S=a.useMemo(()=>{const o=K||[];return[{title:x("All"),key:"0",children:M(o,"0")}]},[K,M,x]),R=o=>{m(o),D(!1)},ee=o=>{const{value:d}=o.target,n=s=>s.reduce((l,h)=>{var q;return(q=h.title)!=null&&q.includes(d)&&l.push(h),h.children?[...l,...n(h.children)]:l},[]),u=n(S).map(s=>s.key);m(u),X(d),D(!0),F([])},N=a.useMemo(()=>{if(!T)return S;const o=d=>{const n=[];for(const u of d){const s=u.title,l=s.indexOf(T),h=s.substring(0,l),q=s.substring(l+T.length),U=l>-1?r.jsxs("span",{children:[h,r.jsx("span",{style:{color:f.colorPrimary},children:T}),q]}):r.jsx("span",{children:s});if(l>-1)n.push(j(_({},u),{title:U}));else if(u.children){const G=o(u.children);G.length&&n.push(j(_({},u),{title:U,children:G}))}}return n};return o(S)},[T,S,f.colorPrimary]),te=()=>{const o=(n,u)=>n.reduce((s,l)=>{let h=l.title;return h=l.key==="0"?h:`${u}/${h}`,l.children?[...s,...o(l.children,l.key==="0"?"":h)]:($.includes(l.key)&&l.key!=="0"&&s.push(h),s)},[]),d=o(S,"");d.length&&k.request({url:"logger:download",method:"post",responseType:"blob",data:{files:d}}).then(n=>{const u=window.URL.createObjectURL(new Blob([n.data],{type:"application/gzip"})),s=document.createElement("a");s.setAttribute("href",u),s.setAttribute("download","logs.tar.gz"),s.click(),s.remove()}).catch(n=>{console.log(n)})};return r.jsxs(c.Card,{style:{minHeight:"700px"},children:[r.jsx(c.Alert,{message:"",description:r.jsx(B,{}),type:"info",showIcon:!0}),r.jsx(c.Input.Search,{style:{marginTop:16,width:"450px"},placeholder:x("Search"),onChange:ee}),r.jsxs("div",{className:t.css`
2
+ display: flex;
3
+ `,children:[r.jsx("div",{style:{maxHeight:"400px",width:"450px",overflow:"auto",border:"1px solid",marginTop:"6px",marginBottom:"10px",borderColor:f.colorBorder},children:N.length?r.jsx(c.Tree,{checkable:!0,showIcon:!0,showLine:!0,checkedKeys:$,expandedKeys:b,autoExpandParent:Y,onExpand:R,onCheck:o=>F(o),treeData:N,selectable:!0,onSelect:(o,d)=>{if(!d.node.children){const n=V(N,o[0],0,"");H(n||void 0)}}}):r.jsx(c.Empty,{image:c.Empty.PRESENTED_IMAGE_SIMPLE})}),r.jsx("div",{style:{maxHeight:"400px",overflow:"auto",border:"1px solid",marginTop:"6px",marginBottom:"10px",borderColor:f.colorBorder,width:"1005px",marginLeft:"10px"},children:P?r.jsx(t.CodeMirror,{value:A==null?void 0:A.data,width:"1000px",height:"398px"}):null})]}),r.jsxs(c.Button,{type:"primary",onClick:te,children:[x("Download")," (.tar.gz)"]})]})});O.displayName="LogsDownloader";const V=(p,f,y,x)=>{const k=f.split("-"),b=k[y];let m=x;if(y>0&&(m+=`/${p[b].title}`),y===k.length-1)return m;if(p[b].children)return V(p[b].children,f,y+1,m)};class z extends t.Plugin{load(){return W(this,null,function*(){this.app.systemSettingsManager.add("system-services.log-viewer",{title:w("Log Viewer"),icon:"FileTextOutlined",Component:O})})}}e.PluginLogViewer=z,e.default=z,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,3 @@
1
+ export declare const NAMESPACE = "log-viewer";
2
+ export declare function lang(key: string): string;
3
+ export declare function useLoggerTranslation(): import("react-i18next").UseTranslationResponse<[string, string], undefined>;
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ "react": "18.3.1",
3
+ "@tachybase/client": "0.23.8",
4
+ "@ant-design/icons": "5.5.2",
5
+ "ahooks": "3.8.4",
6
+ "antd": "5.22.5",
7
+ "@tachybase/server": "0.23.8",
8
+ "react-i18next": "15.2.0",
9
+ "@tachybase/actions": "0.23.8",
10
+ "@tachybase/logger": "0.23.8"
11
+ };
@@ -0,0 +1,2 @@
1
+ export * from './server';
2
+ export { default } from './server';
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var src_exports = {};
30
+ __export(src_exports, {
31
+ default: () => import_server.default
32
+ });
33
+ module.exports = __toCommonJS(src_exports);
34
+ __reExport(src_exports, require("./server"), module.exports);
35
+ var import_server = __toESM(require("./server"));
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ ...require("./server")
39
+ });
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ Logger: string;
3
+ Search: string;
4
+ Download: string;
5
+ 'Download logs': string;
6
+ 'API request and response logs': string;
7
+ 'Application, database, plugins and other system logs, the error level logs will be sent to': string;
8
+ 'SQL execution logs, printed by Sequelize when the db logging is enabled': string;
9
+ 'App not found': string;
10
+ 'Log Viewer': string;
11
+ 'Permission denied': string;
12
+ };
13
+ export default _default;
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var en_US_exports = {};
19
+ __export(en_US_exports, {
20
+ default: () => en_US_default
21
+ });
22
+ module.exports = __toCommonJS(en_US_exports);
23
+ var en_US_default = {
24
+ Logger: "Logger",
25
+ Search: "Search",
26
+ Download: "Download",
27
+ "Download logs": "Download logs",
28
+ "API request and response logs": "API request and response logs",
29
+ "Application, database, plugins and other system logs, the error level logs will be sent to": "Application, database, plugins and other system logs, the error level logs will be sent to",
30
+ "SQL execution logs, printed by Sequelize when the db logging is enabled": "SQL execution logs, printed by Sequelize when the db logging is enabled",
31
+ "App not found": "App not found",
32
+ "Log Viewer": "Log Viewer",
33
+ "Permission denied": "Permission denied"
34
+ };
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ Logger: string;
3
+ Search: string;
4
+ Download: string;
5
+ 'Download logs': string;
6
+ 'API request and response logs': string;
7
+ 'Application, database, plugins and other system logs, the error level logs will be sent to': string;
8
+ 'SQL execution logs, printed by Sequelize when the db logging is enabled': string;
9
+ 'App not found': string;
10
+ 'Log Viewer': string;
11
+ 'Permission denied': string;
12
+ };
13
+ export default _default;
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var ko_KR_exports = {};
19
+ __export(ko_KR_exports, {
20
+ default: () => ko_KR_default
21
+ });
22
+ module.exports = __toCommonJS(ko_KR_exports);
23
+ var ko_KR_default = {
24
+ Logger: "\uAE30\uB85D\uAE30",
25
+ Search: "\uAC80\uC0C9",
26
+ Download: "\uB2E4\uC6B4\uB85C\uB4DC",
27
+ "Download logs": "\uB85C\uADF8 \uB2E4\uC6B4\uB85C\uB4DC",
28
+ "API request and response logs": "API \uC694\uCCAD \uBC0F \uC751\uB2F5 \uB85C\uADF8",
29
+ "Application, database, plugins and other system logs, the error level logs will be sent to": "\uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8, \uB370\uC774\uD130\uBCA0\uC774\uC2A4, \uD50C\uB7EC\uADF8\uC778 \uBC0F \uAE30\uD0C0 \uC2DC\uC2A4\uD15C \uB85C\uADF8, \uC624\uB958 \uC218\uC900 \uB85C\uADF8\uAC00 \uC804\uC1A1\uB429\uB2C8\uB2E4:",
30
+ "SQL execution logs, printed by Sequelize when the db logging is enabled": "\uB370\uC774\uD130\uBCA0\uC774\uC2A4 \uB85C\uAE45\uC774 \uD65C\uC131\uD654\uB418\uC5B4 \uC788\uC744 \uB54C Sequelize\uC5D0\uC11C \uC778\uC1C4\uD558\uB294 SQL \uC2E4\uD589 \uB85C\uADF8",
31
+ "App not found": "\uC571\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",
32
+ "Log Viewer": "\uB85C\uADF8 \uBCF4\uAE30",
33
+ "Permission denied": "\uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC2B5\uB2C8\uB2E4"
34
+ };
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ Logger: string;
3
+ Search: string;
4
+ Download: string;
5
+ 'Download logs': string;
6
+ 'API request and response logs': string;
7
+ 'Application, database, plugins and other system logs, the error level logs will be sent to': string;
8
+ 'SQL execution logs, printed by Sequelize when the db logging is enabled': string;
9
+ 'App not found': string;
10
+ 'Log Viewer': string;
11
+ 'Permission denied': string;
12
+ };
13
+ export default _default;
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var zh_CN_exports = {};
19
+ __export(zh_CN_exports, {
20
+ default: () => zh_CN_default
21
+ });
22
+ module.exports = __toCommonJS(zh_CN_exports);
23
+ var zh_CN_default = {
24
+ Logger: "\u65E5\u5FD7",
25
+ Search: "\u641C\u7D22",
26
+ Download: "\u4E0B\u8F7D",
27
+ "Download logs": "\u4E0B\u8F7D\u65E5\u5FD7",
28
+ "API request and response logs": "API \u63A5\u53E3\u8BF7\u6C42\u548C\u54CD\u5E94\u65E5\u5FD7",
29
+ "Application, database, plugins and other system logs, the error level logs will be sent to": "\u5E94\u7528\u3001\u6570\u636E\u5E93\u3001\u63D2\u4EF6\u548C\u5176\u4ED6\u7CFB\u7EDF\u65E5\u5FD7\uFF0C\u9519\u8BEF\u7EA7\u522B\u65E5\u5FD7\u5C06\u4F1A\u6253\u5370\u5230",
30
+ "SQL execution logs, printed by Sequelize when the db logging is enabled": "SQL \u6267\u884C\u65E5\u5FD7, \u6570\u636E\u5E93\u65E5\u5FD7\u542F\u7528\u65F6\uFF0CSequelize \u6253\u5370\u7684 SQL \u6267\u884C\u65E5\u5FD7",
31
+ "App not found": "\u5E94\u7528\u4E0D\u5B58\u5728",
32
+ "Log Viewer": "\u65E5\u5FD7\u67E5\u770B\u5668",
33
+ "Permission denied": "\u65E0\u6743\u9650"
34
+ };
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Mathias Buus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1 @@
1
+ (function(){var e={183:function(e){function isBuffer(e){return Buffer.isBuffer(e)||e instanceof Uint8Array}function isEncoding(e){return Buffer.isEncoding(e)}function alloc(e,t,n){return Buffer.alloc(e,t,n)}function allocUnsafe(e){return Buffer.allocUnsafe(e)}function allocUnsafeSlow(e){return Buffer.allocUnsafeSlow(e)}function byteLength(e,t){return Buffer.byteLength(e,t)}function compare(e,t){return Buffer.compare(e,t)}function concat(e,t){return Buffer.concat(e,t)}function copy(e,t,n,i,r){return toBuffer(e).copy(t,n,i,r)}function equals(e,t){return toBuffer(e).equals(t)}function fill(e,t,n,i,r){return toBuffer(e).fill(t,n,i,r)}function from(e,t,n){return Buffer.from(e,t,n)}function includes(e,t,n,i){return toBuffer(e).includes(t,n,i)}function indexOf(e,t,n,i){return toBuffer(e).indexOf(t,n,i)}function lastIndexOf(e,t,n,i){return toBuffer(e).lastIndexOf(t,n,i)}function swap16(e){return toBuffer(e).swap16()}function swap32(e){return toBuffer(e).swap32()}function swap64(e){return toBuffer(e).swap64()}function toBuffer(e){if(Buffer.isBuffer(e))return e;return Buffer.from(e.buffer,e.byteOffset,e.byteLength)}function toString(e,t,n,i){return toBuffer(e).toString(t,n,i)}function write(e,t,n,i,r){return toBuffer(e).write(t,n,i,r)}function writeDoubleLE(e,t,n){return toBuffer(e).writeDoubleLE(t,n)}function writeFloatLE(e,t,n){return toBuffer(e).writeFloatLE(t,n)}function writeUInt32LE(e,t,n){return toBuffer(e).writeUInt32LE(t,n)}function writeInt32LE(e,t,n){return toBuffer(e).writeInt32LE(t,n)}function readDoubleLE(e,t){return toBuffer(e).readDoubleLE(t)}function readFloatLE(e,t){return toBuffer(e).readFloatLE(t)}function readUInt32LE(e,t){return toBuffer(e).readUInt32LE(t)}function readInt32LE(e,t){return toBuffer(e).readInt32LE(t)}e.exports={isBuffer:isBuffer,isEncoding:isEncoding,alloc:alloc,allocUnsafe:allocUnsafe,allocUnsafeSlow:allocUnsafeSlow,byteLength:byteLength,compare:compare,concat:concat,copy:copy,equals:equals,fill:fill,from:from,includes:includes,indexOf:indexOf,lastIndexOf:lastIndexOf,swap16:swap16,swap32:swap32,swap64:swap64,toBuffer:toBuffer,toString:toString,write:write,writeDoubleLE:writeDoubleLE,writeFloatLE:writeFloatLE,writeUInt32LE:writeUInt32LE,writeInt32LE:writeInt32LE,readDoubleLE:readDoubleLE,readFloatLE:readFloatLE,readUInt32LE:readUInt32LE,readInt32LE:readInt32LE}},859:function(e,t,n){var i=n(68);var noop=function(){};var isRequest=function(e){return e.setHeader&&typeof e.abort==="function"};var isChildProcess=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3};var eos=function(e,t,n){if(typeof t==="function")return eos(e,null,t);if(!t)t={};n=i(n||noop);var r=e._writableState;var s=e._readableState;var a=t.readable||t.readable!==false&&e.readable;var o=t.writable||t.writable!==false&&e.writable;var u=false;var onlegacyfinish=function(){if(!e.writable)onfinish()};var onfinish=function(){o=false;if(!a)n.call(e)};var onend=function(){a=false;if(!o)n.call(e)};var onexit=function(t){n.call(e,t?new Error("exited with error code: "+t):null)};var onerror=function(t){n.call(e,t)};var onclose=function(){process.nextTick(onclosenexttick)};var onclosenexttick=function(){if(u)return;if(a&&!(s&&(s.ended&&!s.destroyed)))return n.call(e,new Error("premature close"));if(o&&!(r&&(r.ended&&!r.destroyed)))return n.call(e,new Error("premature close"))};var onrequest=function(){e.req.on("finish",onfinish)};if(isRequest(e)){e.on("complete",onfinish);e.on("abort",onclose);if(e.req)onrequest();else e.on("request",onrequest)}else if(o&&!r){e.on("end",onlegacyfinish);e.on("close",onlegacyfinish)}if(isChildProcess(e))e.on("exit",onexit);e.on("end",onend);e.on("finish",onfinish);if(t.error!==false)e.on("error",onerror);e.on("close",onclose);return function(){u=true;e.removeListener("complete",onfinish);e.removeListener("abort",onclose);e.removeListener("request",onrequest);if(e.req)e.req.removeListener("finish",onfinish);e.removeListener("end",onlegacyfinish);e.removeListener("close",onlegacyfinish);e.removeListener("finish",onfinish);e.removeListener("exit",onexit);e.removeListener("end",onend);e.removeListener("error",onerror);e.removeListener("close",onclose)}};e.exports=eos},494:function(e){e.exports=class FixedFIFO{constructor(e){if(!(e>0)||(e-1&e)!==0)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e);this.mask=e-1;this.top=0;this.btm=0;this.next=null}clear(){this.top=this.btm=0;this.next=null;this.buffer.fill(undefined)}push(e){if(this.buffer[this.top]!==undefined)return false;this.buffer[this.top]=e;this.top=this.top+1&this.mask;return true}shift(){const e=this.buffer[this.btm];if(e===undefined)return undefined;this.buffer[this.btm]=undefined;this.btm=this.btm+1&this.mask;return e}peek(){return this.buffer[this.btm]}isEmpty(){return this.buffer[this.btm]===undefined}}},0:function(e,t,n){const i=n(494);e.exports=class FastFIFO{constructor(e){this.hwm=e||16;this.head=new i(this.hwm);this.tail=this.head;this.length=0}clear(){this.head=this.tail;this.head.clear();this.length=0}push(e){this.length++;if(!this.head.push(e)){const t=this.head;this.head=t.next=new i(2*this.head.buffer.length);this.head.push(e)}}shift(){if(this.length!==0)this.length--;const e=this.tail.shift();if(e===undefined&&this.tail.next){const e=this.tail.next;this.tail.next=null;this.tail=e;return this.tail.shift()}return e}peek(){const e=this.tail.peek();if(e===undefined&&this.tail.next)return this.tail.next.peek();return e}isEmpty(){return this.length===0}}},68:function(e,t,n){var i=n(92);e.exports=i(once);e.exports.strict=i(onceStrict);once.proto=once((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:true});Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:true})}));function once(e){var f=function(){if(f.called)return f.value;f.called=true;return f.value=e.apply(this,arguments)};f.called=false;return f}function onceStrict(e){var f=function(){if(f.called)throw new Error(f.onceError);f.called=true;return f.value=e.apply(this,arguments)};var t=e.name||"Function wrapped with `once`";f.onceError=t+" shouldn't be called more than once";f.called=false;return f}},763:function(e,t,n){var i=n(68);var r=n(859);var s=n(896);var noop=function(){};var a=/^v?\.0/.test(process.version);var isFn=function(e){return typeof e==="function"};var isFS=function(e){if(!a)return false;if(!s)return false;return(e instanceof(s.ReadStream||noop)||e instanceof(s.WriteStream||noop))&&isFn(e.close)};var isRequest=function(e){return e.setHeader&&isFn(e.abort)};var destroyer=function(e,t,n,s){s=i(s);var a=false;e.on("close",(function(){a=true}));r(e,{readable:t,writable:n},(function(e){if(e)return s(e);a=true;s()}));var o=false;return function(t){if(a)return;if(o)return;o=true;if(isFS(e))return e.close(noop);if(isRequest(e))return e.abort();if(isFn(e.destroy))return e.destroy();s(t||new Error("stream was destroyed"))}};var call=function(e){e()};var pipe=function(e,t){return e.pipe(t)};var pump=function(){var e=Array.prototype.slice.call(arguments);var t=isFn(e[e.length-1]||noop)&&e.pop()||noop;if(Array.isArray(e[0]))e=e[0];if(e.length<2)throw new Error("pump requires two streams per minimum");var n;var i=e.map((function(r,s){var a=s<e.length-1;var o=s>0;return destroyer(r,a,o,(function(e){if(!n)n=e;if(e)i.forEach(call);if(a)return;i.forEach(call);t(n)}))}));return e.reduce(pipe)};e.exports=pump},899:function(e,t,n){e.exports=typeof process!=="undefined"&&typeof process.nextTick==="function"?process.nextTick.bind(process):n(833)},833:function(e){e.exports=typeof queueMicrotask==="function"?queueMicrotask:e=>Promise.resolve().then(e)},87:function(e,t,n){const{EventEmitter:i}=n(434);const r=new Error("Stream was destroyed");const s=new Error("Premature close");const a=n(899);const o=n(0);const u=(1<<27)-1;const l=1;const c=2;const h=4;const d=8;const p=u^l;const _=u^c;const m=1<<4;const b=2<<4;const y=4<<4;const S=8<<4;const x=16<<4;const w=32<<4;const g=64<<4;const k=128<<4;const v=256<<4;const L=512<<4;const E=1024<<4;const T=2048<<4;const P=4096<<4;const B=x|w;const I=m|P;const O=y|m;const F=v|S;const z=u^m;const N=u^y;const W=u^(y|P);const q=u^P;const U=u^x;const D=u^(S|L);const R=u^g;const A=u^B;const M=u^T;const j=u^b;const H=1<<17;const C=2<<17;const G=4<<17;const K=8<<17;const V=16<<17;const J=32<<17;const Q=64<<17;const X=128<<17;const Y=256<<17;const Z=512<<17;const $=u^(H|Y);const ee=u^G;const te=u^Z;const ne=u^V;const ie=u^K;const re=u^X;const se=u^C;const ae=m|H;const oe=u^ae;const ue=E|J;const le=h|d|c;const fe=le|l;const ce=le|ue;const he=ee&N;const de=X|T;const pe=de&oe;const _e=fe|pe;const me=fe|g|E;const be=fe|E|S;const ye=fe|g|S;const Se=fe|v|S|L;const xe=fe|m|g|E|P;const we=le|g|E;const ge=b|fe|T|y;const ke=fe|Z|J;const ve=K|V;const Le=K|H;const Ee=K|V|fe|H;const Te=fe|H|K;const Pe=G|H;const Be=H|Y;const Ie=fe|Z|Le|J;const Oe=V|le|Z|J;const Fe=C|fe|X|G;const ze=Symbol.asyncIterator||Symbol("asyncIterator");class WritableState{constructor(e,{highWaterMark:t=16384,map:n=null,mapWritable:i,byteLength:r,byteLengthWritable:s}={}){this.stream=e;this.queue=new o;this.highWaterMark=t;this.buffered=0;this.error=null;this.pipeline=null;this.drains=null;this.byteLength=s||r||defaultByteLength;this.map=i||n;this.afterWrite=afterWrite.bind(this);this.afterUpdateNextTick=updateWriteNT.bind(this)}get ended(){return(this.stream._duplexState&J)!==0}push(e){if(this.map!==null)e=this.map(e);this.buffered+=this.byteLength(e);this.queue.push(e);if(this.buffered<this.highWaterMark){this.stream._duplexState|=K;return true}this.stream._duplexState|=ve;return false}shift(){const e=this.queue.shift();this.buffered-=this.byteLength(e);if(this.buffered===0)this.stream._duplexState&=ie;return e}end(e){if(typeof e==="function")this.stream.once("finish",e);else if(e!==undefined&&e!==null)this.push(e);this.stream._duplexState=(this.stream._duplexState|Z)&ee}autoBatch(e,t){const n=[];const i=this.stream;n.push(e);while((i._duplexState&Te)===Le){n.push(i._writableState.shift())}if((i._duplexState&fe)!==0)return t(null);i._writev(n,t)}update(){const e=this.stream;e._duplexState|=C;do{while((e._duplexState&Te)===K){const t=this.shift();e._duplexState|=Be;e._write(t,this.afterWrite)}if((e._duplexState&Pe)===0)this.updateNonPrimary()}while(this.continueUpdate()===true);e._duplexState&=se}updateNonPrimary(){const e=this.stream;if((e._duplexState&Ie)===Z){e._duplexState=(e._duplexState|H)&te;e._final(afterFinal.bind(this));return}if((e._duplexState&le)===h){if((e._duplexState&de)===0){e._duplexState|=ae;e._destroy(afterDestroy.bind(this))}return}if((e._duplexState&_e)===l){e._duplexState=(e._duplexState|ae)&p;e._open(afterOpen.bind(this))}}continueUpdate(){if((this.stream._duplexState&X)===0)return false;this.stream._duplexState&=re;return true}updateCallback(){if((this.stream._duplexState&Fe)===G)this.update();else this.updateNextTick()}updateNextTick(){if((this.stream._duplexState&X)!==0)return;this.stream._duplexState|=X;if((this.stream._duplexState&C)===0)a(this.afterUpdateNextTick)}}class ReadableState{constructor(e,{highWaterMark:t=16384,map:n=null,mapReadable:i,byteLength:r,byteLengthReadable:s}={}){this.stream=e;this.queue=new o;this.highWaterMark=t;this.buffered=0;this.error=null;this.pipeline=null;this.byteLength=s||r||defaultByteLength;this.map=i||n;this.pipeTo=null;this.afterRead=afterRead.bind(this);this.afterUpdateNextTick=updateReadNT.bind(this)}get ended(){return(this.stream._duplexState&E)!==0}pipe(e,t){if(this.pipeTo!==null)throw new Error("Can only pipe to one destination");if(typeof t!=="function")t=null;this.stream._duplexState|=w;this.pipeTo=e;this.pipeline=new Pipeline(this.stream,e,t);if(t)this.stream.on("error",noop);if(isStreamx(e)){e._writableState.pipeline=this.pipeline;if(t)e.on("error",noop);e.on("finish",this.pipeline.finished.bind(this.pipeline))}else{const t=this.pipeline.done.bind(this.pipeline,e);const n=this.pipeline.done.bind(this.pipeline,e,null);e.on("error",t);e.on("close",n);e.on("finish",this.pipeline.finished.bind(this.pipeline))}e.on("drain",afterDrain.bind(this));this.stream.emit("piping",e);e.emit("pipe",this.stream)}push(e){const t=this.stream;if(e===null){this.highWaterMark=0;t._duplexState=(t._duplexState|g)&W;return false}if(this.map!==null)e=this.map(e);this.buffered+=this.byteLength(e);this.queue.push(e);t._duplexState=(t._duplexState|S)&q;return this.buffered<this.highWaterMark}shift(){const e=this.queue.shift();this.buffered-=this.byteLength(e);if(this.buffered===0)this.stream._duplexState&=D;return e}unshift(e){const t=[this.map!==null?this.map(e):e];while(this.buffered>0)t.push(this.shift());for(let e=0;e<t.length-1;e++){const n=t[e];this.buffered+=this.byteLength(n);this.queue.push(n)}this.push(t[t.length-1])}read(){const e=this.stream;if((e._duplexState&be)===S){const t=this.shift();if(this.pipeTo!==null&&this.pipeTo.write(t)===false)e._duplexState&=A;if((e._duplexState&k)!==0)e.emit("data",t);return t}return null}drain(){const e=this.stream;while((e._duplexState&be)===S&&(e._duplexState&B)!==0){const t=this.shift();if(this.pipeTo!==null&&this.pipeTo.write(t)===false)e._duplexState&=A;if((e._duplexState&k)!==0)e.emit("data",t)}}update(){const e=this.stream;e._duplexState|=b;do{this.drain();while(this.buffered<this.highWaterMark&&(e._duplexState&xe)===0){e._duplexState|=I;e._read(this.afterRead);this.drain()}if((e._duplexState&Se)===F){e._duplexState|=L;e.emit("readable")}if((e._duplexState&O)===0)this.updateNonPrimary()}while(this.continueUpdate()===true);e._duplexState&=j}updateNonPrimary(){const e=this.stream;if((e._duplexState&ye)===g){e._duplexState=(e._duplexState|E)&R;e.emit("end");if((e._duplexState&ce)===ue)e._duplexState|=h;if(this.pipeTo!==null)this.pipeTo.end()}if((e._duplexState&le)===h){if((e._duplexState&de)===0){e._duplexState|=ae;e._destroy(afterDestroy.bind(this))}return}if((e._duplexState&_e)===l){e._duplexState=(e._duplexState|ae)&p;e._open(afterOpen.bind(this))}}continueUpdate(){if((this.stream._duplexState&T)===0)return false;this.stream._duplexState&=M;return true}updateCallback(){if((this.stream._duplexState&ge)===y)this.update();else this.updateNextTick()}updateNextTick(){if((this.stream._duplexState&T)!==0)return;this.stream._duplexState|=T;if((this.stream._duplexState&b)===0)a(this.afterUpdateNextTick)}}class TransformState{constructor(e){this.data=null;this.afterTransform=afterTransform.bind(e);this.afterFinal=null}}class Pipeline{constructor(e,t,n){this.from=e;this.to=t;this.afterPipe=n;this.error=null;this.pipeToFinished=false}finished(){this.pipeToFinished=true}done(e,t){if(t)this.error=t;if(e===this.to){this.to=null;if(this.from!==null){if((this.from._duplexState&E)===0||!this.pipeToFinished){this.from.destroy(this.error||new Error("Writable stream closed prematurely"))}return}}if(e===this.from){this.from=null;if(this.to!==null){if((e._duplexState&E)===0){this.to.destroy(this.error||new Error("Readable stream closed before ending"))}return}}if(this.afterPipe!==null)this.afterPipe(this.error);this.to=this.from=this.afterPipe=null}}function afterDrain(){this.stream._duplexState|=w;this.updateCallback()}function afterFinal(e){const t=this.stream;if(e)t.destroy(e);if((t._duplexState&le)===0){t._duplexState|=J;t.emit("finish")}if((t._duplexState&ce)===ue){t._duplexState|=h}t._duplexState&=$;if((t._duplexState&C)===0)this.update();else this.updateNextTick()}function afterDestroy(e){const t=this.stream;if(!e&&this.error!==r)e=this.error;if(e)t.emit("error",e);t._duplexState|=d;t.emit("close");const n=t._readableState;const i=t._writableState;if(n!==null&&n.pipeline!==null)n.pipeline.done(t,e);if(i!==null){while(i.drains!==null&&i.drains.length>0)i.drains.shift().resolve(false);if(i.pipeline!==null)i.pipeline.done(t,e)}}function afterWrite(e){const t=this.stream;if(e)t.destroy(e);t._duplexState&=$;if(this.drains!==null)tickDrains(this.drains);if((t._duplexState&Ee)===V){t._duplexState&=ne;if((t._duplexState&Q)===Q){t.emit("drain")}}this.updateCallback()}function afterRead(e){if(e)this.stream.destroy(e);this.stream._duplexState&=z;this.updateCallback()}function updateReadNT(){if((this.stream._duplexState&b)===0){this.stream._duplexState&=M;this.update()}}function updateWriteNT(){if((this.stream._duplexState&C)===0){this.stream._duplexState&=re;this.update()}}function tickDrains(e){for(let t=0;t<e.length;t++){if(--e[t].writes===0){e.shift().resolve(true);t--}}}function afterOpen(e){const t=this.stream;if(e)t.destroy(e);if((t._duplexState&h)===0){if((t._duplexState&me)===0)t._duplexState|=y;if((t._duplexState&ke)===0)t._duplexState|=G;t.emit("open")}t._duplexState&=oe;if(t._writableState!==null){t._writableState.updateCallback()}if(t._readableState!==null){t._readableState.updateCallback()}}function afterTransform(e,t){if(t!==undefined&&t!==null)this.push(t);this._writableState.afterWrite(e)}class Stream extends i{constructor(e){super();this._duplexState=0;this._readableState=null;this._writableState=null;if(e){if(e.open)this._open=e.open;if(e.destroy)this._destroy=e.destroy;if(e.predestroy)this._predestroy=e.predestroy;if(e.signal){e.signal.addEventListener("abort",abort.bind(this))}}}_open(e){e(null)}_destroy(e){e(null)}_predestroy(){}get readable(){return this._readableState!==null?true:undefined}get writable(){return this._writableState!==null?true:undefined}get destroyed(){return(this._duplexState&d)!==0}get destroying(){return(this._duplexState&le)!==0}destroy(e){if((this._duplexState&le)===0){if(!e)e=r;this._duplexState=(this._duplexState|h)&he;if(this._readableState!==null){this._readableState.highWaterMark=0;this._readableState.error=e}if(this._writableState!==null){this._writableState.highWaterMark=0;this._writableState.error=e}this._duplexState|=c;this._predestroy();this._duplexState&=_;if(this._readableState!==null)this._readableState.updateNextTick();if(this._writableState!==null)this._writableState.updateNextTick()}}on(e,t){if(this._readableState!==null){if(e==="data"){this._duplexState|=k|x;this._readableState.updateNextTick()}if(e==="readable"){this._duplexState|=v;this._readableState.updateNextTick()}}if(this._writableState!==null){if(e==="drain"){this._duplexState|=Q;this._writableState.updateNextTick()}}return super.on(e,t)}}class Readable extends Stream{constructor(e){super(e);this._duplexState|=l|J;this._readableState=new ReadableState(this,e);if(e){if(e.read)this._read=e.read;if(e.eagerOpen)this._readableState.updateNextTick()}}_read(e){e(null)}pipe(e,t){this._readableState.updateNextTick();this._readableState.pipe(e,t);return e}read(){this._readableState.updateNextTick();return this._readableState.read()}push(e){this._readableState.updateNextTick();return this._readableState.push(e)}unshift(e){this._readableState.updateNextTick();return this._readableState.unshift(e)}resume(){this._duplexState|=x;this._readableState.updateNextTick();return this}pause(){this._duplexState&=U;return this}static _fromAsyncIterator(e,t){let n;const i=new Readable({...t,read(t){e.next().then(push).then(t.bind(null,null)).catch(t)},predestroy(){n=e.return()},destroy(e){if(!n)return e(null);n.then(e.bind(null,null)).catch(e)}});return i;function push(e){if(e.done)i.push(null);else i.push(e.value)}}static from(e,t){if(isReadStreamx(e))return e;if(e[ze])return this._fromAsyncIterator(e[ze](),t);if(!Array.isArray(e))e=e===undefined?[]:[e];let n=0;return new Readable({...t,read(t){this.push(n===e.length?null:e[n++]);t(null)}})}static isBackpressured(e){return(e._duplexState&we)!==0||e._readableState.buffered>=e._readableState.highWaterMark}static isPaused(e){return(e._duplexState&x)===0}[ze](){const e=this;let t=null;let n=null;let i=null;this.on("error",(e=>{t=e}));this.on("readable",onreadable);this.on("close",onclose);return{[ze](){return this},next(){return new Promise((function(t,r){n=t;i=r;const s=e.read();if(s!==null)ondata(s);else if((e._duplexState&d)!==0)ondata(null)}))},return(){return destroy(null)},throw(e){return destroy(e)}};function onreadable(){if(n!==null)ondata(e.read())}function onclose(){if(n!==null)ondata(null)}function ondata(s){if(i===null)return;if(t)i(t);else if(s===null&&(e._duplexState&E)===0)i(r);else n({value:s,done:s===null});i=n=null}function destroy(t){e.destroy(t);return new Promise(((n,i)=>{if(e._duplexState&d)return n({value:undefined,done:true});e.once("close",(function(){if(t)i(t);else n({value:undefined,done:true})}))}))}}}class Writable extends Stream{constructor(e){super(e);this._duplexState|=l|E;this._writableState=new WritableState(this,e);if(e){if(e.writev)this._writev=e.writev;if(e.write)this._write=e.write;if(e.final)this._final=e.final;if(e.eagerOpen)this._writableState.updateNextTick()}}_writev(e,t){t(null)}_write(e,t){this._writableState.autoBatch(e,t)}_final(e){e(null)}static isBackpressured(e){return(e._duplexState&Oe)!==0}static drained(e){if(e.destroyed)return Promise.resolve(false);const t=e._writableState;const n=t.queue.length+(e._duplexState&Y?1:0);if(n===0)return Promise.resolve(true);if(t.drains===null)t.drains=[];return new Promise((e=>{t.drains.push({writes:n,resolve:e})}))}write(e){this._writableState.updateNextTick();return this._writableState.push(e)}end(e){this._writableState.updateNextTick();this._writableState.end(e);return this}}class Duplex extends Readable{constructor(e){super(e);this._duplexState=l;this._writableState=new WritableState(this,e);if(e){if(e.writev)this._writev=e.writev;if(e.write)this._write=e.write;if(e.final)this._final=e.final}}_writev(e,t){t(null)}_write(e,t){this._writableState.autoBatch(e,t)}_final(e){e(null)}write(e){this._writableState.updateNextTick();return this._writableState.push(e)}end(e){this._writableState.updateNextTick();this._writableState.end(e);return this}}class Transform extends Duplex{constructor(e){super(e);this._transformState=new TransformState(this);if(e){if(e.transform)this._transform=e.transform;if(e.flush)this._flush=e.flush}}_write(e,t){if(this._readableState.buffered>=this._readableState.highWaterMark){this._transformState.data=e}else{this._transform(e,this._transformState.afterTransform)}}_read(e){if(this._transformState.data!==null){const t=this._transformState.data;this._transformState.data=null;e(null);this._transform(t,this._transformState.afterTransform)}else{e(null)}}_transform(e,t){t(null,e)}_flush(e){e(null)}_final(e){this._transformState.afterFinal=e;this._flush(transformAfterFlush.bind(this))}}class PassThrough extends Transform{}function transformAfterFlush(e,t){const n=this._transformState.afterFinal;if(e)return n(e);if(t!==null&&t!==undefined)this.push(t);this.push(null);n(null)}function pipelinePromise(...e){return new Promise(((t,n)=>pipeline(...e,(e=>{if(e)return n(e);t()}))))}function pipeline(e,...t){const n=Array.isArray(e)?[...e,...t]:[e,...t];const i=n.length&&typeof n[n.length-1]==="function"?n.pop():null;if(n.length<2)throw new Error("Pipeline requires at least 2 streams");let r=n[0];let a=null;let o=null;for(let e=1;e<n.length;e++){a=n[e];if(isStreamx(r)){r.pipe(a,onerror)}else{errorHandle(r,true,e>1,onerror);r.pipe(a)}r=a}if(i){let e=false;const t=isStreamx(a)||!!(a._writableState&&a._writableState.autoDestroy);a.on("error",(e=>{if(o===null)o=e}));a.on("finish",(()=>{e=true;if(!t)i(o)}));if(t){a.on("close",(()=>i(o||(e?null:s))))}}return a;function errorHandle(e,t,n,i){e.on("error",i);e.on("close",onclose);function onclose(){if(t&&e._readableState&&!e._readableState.ended)return i(s);if(n&&e._writableState&&!e._writableState.ended)return i(s)}}function onerror(e){if(!e||o)return;o=e;for(const t of n){t.destroy(e)}}}function isStream(e){return!!e._readableState||!!e._writableState}function isStreamx(e){return typeof e._duplexState==="number"&&isStream(e)}function getStreamError(e){const t=e._readableState&&e._readableState.error||e._writableState&&e._writableState.error;return t===r?null:t}function isReadStreamx(e){return isStreamx(e)&&e.readable}function isTypedArray(e){return typeof e==="object"&&e!==null&&typeof e.byteLength==="number"}function defaultByteLength(e){return isTypedArray(e)?e.byteLength:1024}function noop(){}function abort(){this.destroy(new Error("Stream aborted."))}e.exports={pipeline:pipeline,pipelinePromise:pipelinePromise,isStream:isStream,isStreamx:isStreamx,getStreamError:getStreamError,Stream:Stream,Writable:Writable,Readable:Readable,Duplex:Duplex,Transform:Transform,PassThrough:PassThrough}},543:function(e,t,n){const i={S_IFMT:61440,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960};try{e.exports=n(896).constants||i}catch{e.exports=i}},339:function(e,t,n){const{Writable:i,Readable:r,getStreamError:s}=n(87);const a=n(0);const o=n(183);const u=n(980);const l=o.alloc(0);class BufferList{constructor(){this.buffered=0;this.shifted=0;this.queue=new a;this._offset=0}push(e){this.buffered+=e.byteLength;this.queue.push(e)}shiftFirst(e){return this._buffered===0?null:this._next(e)}shift(e){if(e>this.buffered)return null;if(e===0)return l;let t=this._next(e);if(e===t.byteLength)return t;const n=[t];while((e-=t.byteLength)>0){t=this._next(e);n.push(t)}return o.concat(n)}_next(e){const t=this.queue.peek();const n=t.byteLength-this._offset;if(e>=n){const e=this._offset?t.subarray(this._offset,t.byteLength):t;this.queue.shift();this._offset=0;this.buffered-=n;this.shifted+=n;return e}this.buffered-=e;this.shifted+=e;return t.subarray(this._offset,this._offset+=e)}}class Source extends r{constructor(e,t,n){super();this.header=t;this.offset=n;this._parent=e}_read(e){if(this.header.size===0){this.push(null)}if(this._parent._stream===this){this._parent._update()}e(null)}_predestroy(){this._parent.destroy(s(this))}_detach(){if(this._parent._stream===this){this._parent._stream=null;this._parent._missing=overflow(this.header.size);this._parent._update()}}_destroy(e){this._detach();e(null)}}class Extract extends i{constructor(e){super(e);if(!e)e={};this._buffer=new BufferList;this._offset=0;this._header=null;this._stream=null;this._missing=0;this._longHeader=false;this._callback=noop;this._locked=false;this._finished=false;this._pax=null;this._paxGlobal=null;this._gnuLongPath=null;this._gnuLongLinkPath=null;this._filenameEncoding=e.filenameEncoding||"utf-8";this._allowUnknownFormat=!!e.allowUnknownFormat;this._unlockBound=this._unlock.bind(this)}_unlock(e){this._locked=false;if(e){this.destroy(e);this._continueWrite(e);return}this._update()}_consumeHeader(){if(this._locked)return false;this._offset=this._buffer.shifted;try{this._header=u.decode(this._buffer.shift(512),this._filenameEncoding,this._allowUnknownFormat)}catch(e){this._continueWrite(e);return false}if(!this._header)return true;switch(this._header.type){case"gnu-long-path":case"gnu-long-link-path":case"pax-global-header":case"pax-header":this._longHeader=true;this._missing=this._header.size;return true}this._locked=true;this._applyLongHeaders();if(this._header.size===0||this._header.type==="directory"){this.emit("entry",this._header,this._createStream(),this._unlockBound);return true}this._stream=this._createStream();this._missing=this._header.size;this.emit("entry",this._header,this._stream,this._unlockBound);return true}_applyLongHeaders(){if(this._gnuLongPath){this._header.name=this._gnuLongPath;this._gnuLongPath=null}if(this._gnuLongLinkPath){this._header.linkname=this._gnuLongLinkPath;this._gnuLongLinkPath=null}if(this._pax){if(this._pax.path)this._header.name=this._pax.path;if(this._pax.linkpath)this._header.linkname=this._pax.linkpath;if(this._pax.size)this._header.size=parseInt(this._pax.size,10);this._header.pax=this._pax;this._pax=null}}_decodeLongHeader(e){switch(this._header.type){case"gnu-long-path":this._gnuLongPath=u.decodeLongPath(e,this._filenameEncoding);break;case"gnu-long-link-path":this._gnuLongLinkPath=u.decodeLongPath(e,this._filenameEncoding);break;case"pax-global-header":this._paxGlobal=u.decodePax(e);break;case"pax-header":this._pax=this._paxGlobal===null?u.decodePax(e):Object.assign({},this._paxGlobal,u.decodePax(e));break}}_consumeLongHeader(){this._longHeader=false;this._missing=overflow(this._header.size);const e=this._buffer.shift(this._header.size);try{this._decodeLongHeader(e)}catch(e){this._continueWrite(e);return false}return true}_consumeStream(){const e=this._buffer.shiftFirst(this._missing);if(e===null)return false;this._missing-=e.byteLength;const t=this._stream.push(e);if(this._missing===0){this._stream.push(null);if(t)this._stream._detach();return t&&this._locked===false}return t}_createStream(){return new Source(this,this._header,this._offset)}_update(){while(this._buffer.buffered>0&&!this.destroying){if(this._missing>0){if(this._stream!==null){if(this._consumeStream()===false)return;continue}if(this._longHeader===true){if(this._missing>this._buffer.buffered)break;if(this._consumeLongHeader()===false)return false;continue}const e=this._buffer.shiftFirst(this._missing);if(e!==null)this._missing-=e.byteLength;continue}if(this._buffer.buffered<512)break;if(this._stream!==null||this._consumeHeader()===false)return}this._continueWrite(null)}_continueWrite(e){const t=this._callback;this._callback=noop;t(e)}_write(e,t){this._callback=t;this._buffer.push(e);this._update()}_final(e){this._finished=this._missing===0&&this._buffer.buffered===0;e(this._finished?null:new Error("Unexpected end of data"))}_predestroy(){this._continueWrite(null)}_destroy(e){if(this._stream)this._stream.destroy(s(this));e(null)}[Symbol.asyncIterator](){let e=null;let t=null;let n=null;let i=null;let r=null;const s=this;this.on("entry",onentry);this.on("error",(t=>{e=t}));this.on("close",onclose);return{[Symbol.asyncIterator](){return this},next(){return new Promise(onnext)},return(){return destroy(null)},throw(e){return destroy(e)}};function consumeCallback(e){if(!r)return;const t=r;r=null;t(e)}function onnext(r,a){if(e){return a(e)}if(i){r({value:i,done:false});i=null;return}t=r;n=a;consumeCallback(null);if(s._finished&&t){t({value:undefined,done:true});t=n=null}}function onentry(e,s,a){r=a;s.on("error",noop);if(t){t({value:s,done:false});t=n=null}else{i=s}}function onclose(){consumeCallback(e);if(!t)return;if(e)n(e);else t({value:undefined,done:true});t=n=null}function destroy(e){s.destroy(e);consumeCallback(e);return new Promise(((t,n)=>{if(s.destroyed)return t({value:undefined,done:true});s.once("close",(function(){if(e)n(e);else t({value:undefined,done:true})}))}))}}}e.exports=function extract(e){return new Extract(e)};function noop(){}function overflow(e){e&=511;return e&&512-e}},980:function(e,t,n){const i=n(183);const r="0000000000000000000";const s="7777777777777777777";const a="0".charCodeAt(0);const o=i.from([117,115,116,97,114,0]);const u=i.from([a,a]);const l=i.from([117,115,116,97,114,32]);const c=i.from([32,0]);const h=4095;const d=257;const p=263;t.decodeLongPath=function decodeLongPath(e,t){return decodeStr(e,0,e.length,t)};t.encodePax=function encodePax(e){let t="";if(e.name)t+=addLength(" path="+e.name+"\n");if(e.linkname)t+=addLength(" linkpath="+e.linkname+"\n");const n=e.pax;if(n){for(const e in n){t+=addLength(" "+e+"="+n[e]+"\n")}}return i.from(t)};t.decodePax=function decodePax(e){const t={};while(e.length){let n=0;while(n<e.length&&e[n]!==32)n++;const r=parseInt(e.subarray(0,n).toString(),10);if(!r)return t;const s=i.toString(e.subarray(n+1,r-1));const a=s.indexOf("=");if(a===-1)return t;t[s.slice(0,a)]=s.slice(a+1);e=e.subarray(r)}return t};t.encode=function encode(e){const t=i.alloc(512);let n=e.name;let r="";if(e.typeflag===5&&n[n.length-1]!=="/")n+="/";if(i.byteLength(n)!==n.length)return null;while(i.byteLength(n)>100){const e=n.indexOf("/");if(e===-1)return null;r+=r?"/"+n.slice(0,e):n.slice(0,e);n=n.slice(e+1)}if(i.byteLength(n)>100||i.byteLength(r)>155)return null;if(e.linkname&&i.byteLength(e.linkname)>100)return null;i.write(t,n);i.write(t,encodeOct(e.mode&h,6),100);i.write(t,encodeOct(e.uid,6),108);i.write(t,encodeOct(e.gid,6),116);encodeSize(e.size,t,124);i.write(t,encodeOct(e.mtime.getTime()/1e3|0,11),136);t[156]=a+toTypeflag(e.type);if(e.linkname)i.write(t,e.linkname,157);i.copy(o,t,d);i.copy(u,t,p);if(e.uname)i.write(t,e.uname,265);if(e.gname)i.write(t,e.gname,297);i.write(t,encodeOct(e.devmajor||0,6),329);i.write(t,encodeOct(e.devminor||0,6),337);if(r)i.write(t,r,345);i.write(t,encodeOct(cksum(t),6),148);return t};t.decode=function decode(e,t,n){let i=e[156]===0?0:e[156]-a;let r=decodeStr(e,0,100,t);const s=decodeOct(e,100,8);const o=decodeOct(e,108,8);const u=decodeOct(e,116,8);const l=decodeOct(e,124,12);const c=decodeOct(e,136,12);const h=toType(i);const d=e[157]===0?null:decodeStr(e,157,100,t);const p=decodeStr(e,265,32);const _=decodeStr(e,297,32);const m=decodeOct(e,329,8);const b=decodeOct(e,337,8);const y=cksum(e);if(y===8*32)return null;if(y!==decodeOct(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(isUSTAR(e)){if(e[345])r=decodeStr(e,345,155,t)+"/"+r}else if(isGNU(e)){}else{if(!n){throw new Error("Invalid tar header: unknown format.")}}if(i===0&&r&&r[r.length-1]==="/")i=5;return{name:r,mode:s,uid:o,gid:u,size:l,mtime:new Date(1e3*c),type:h,linkname:d,uname:p,gname:_,devmajor:m,devminor:b,pax:null}};function isUSTAR(e){return i.equals(o,e.subarray(d,d+6))}function isGNU(e){return i.equals(l,e.subarray(d,d+6))&&i.equals(c,e.subarray(p,p+2))}function clamp(e,t,n){if(typeof e!=="number")return n;e=~~e;if(e>=t)return t;if(e>=0)return e;e+=t;if(e>=0)return e;return 0}function toType(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}function toTypeflag(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}function indexOf(e,t,n,i){for(;n<i;n++){if(e[n]===t)return n}return i}function cksum(e){let t=8*32;for(let n=0;n<148;n++)t+=e[n];for(let n=156;n<512;n++)t+=e[n];return t}function encodeOct(e,t){e=e.toString(8);if(e.length>t)return s.slice(0,t)+" ";return r.slice(0,t-e.length)+e+" "}function encodeSizeBin(e,t,n){t[n]=128;for(let i=11;i>0;i--){t[n+i]=e&255;e=Math.floor(e/256)}}function encodeSize(e,t,n){if(e.toString(8).length>11){encodeSizeBin(e,t,n)}else{i.write(t,encodeOct(e,11),n)}}function parse256(e){let t;if(e[0]===128)t=true;else if(e[0]===255)t=false;else return null;const n=[];let i;for(i=e.length-1;i>0;i--){const r=e[i];if(t)n.push(r);else n.push(255-r)}let r=0;const s=n.length;for(i=0;i<s;i++){r+=n[i]*Math.pow(256,i)}return t?r:-1*r}function decodeOct(e,t,n){e=e.subarray(t,t+n);t=0;if(e[t]&128){return parse256(e)}else{while(t<e.length&&e[t]===32)t++;const n=clamp(indexOf(e,32,t,e.length),e.length,e.length);while(t<n&&e[t]===0)t++;if(n===t)return 0;return parseInt(e.subarray(t,n).toString(),8)}}function decodeStr(e,t,n,r){return i.toString(e.subarray(t,indexOf(e,0,t,t+n)),r)}function addLength(e){const t=i.byteLength(e);let n=Math.floor(Math.log(t)/Math.log(10))+1;if(t+n>=Math.pow(10,n))n++;return t+n+e}},462:function(e,t,n){t.extract=n(339);t.pack=n(749)},749:function(e,t,n){const{Readable:i,Writable:r,getStreamError:s}=n(87);const a=n(183);const o=n(543);const u=n(980);const l=493;const c=420;const h=a.alloc(1024);class Sink extends r{constructor(e,t,n){super({mapWritable:mapWritable,eagerOpen:true});this.written=0;this.header=t;this._callback=n;this._linkname=null;this._isLinkname=t.type==="symlink"&&!t.linkname;this._isVoid=t.type!=="file"&&t.type!=="contiguous-file";this._finished=false;this._pack=e;this._openCallback=null;if(this._pack._stream===null)this._pack._stream=this;else this._pack._pending.push(this)}_open(e){this._openCallback=e;if(this._pack._stream===this)this._continueOpen()}_continuePack(e){if(this._callback===null)return;const t=this._callback;this._callback=null;t(e)}_continueOpen(){if(this._pack._stream===null)this._pack._stream=this;const e=this._openCallback;this._openCallback=null;if(e===null)return;if(this._pack.destroying)return e(new Error("pack stream destroyed"));if(this._pack._finalized)return e(new Error("pack stream is already finalized"));this._pack._stream=this;if(!this._isLinkname){this._pack._encode(this.header)}if(this._isVoid){this._finish();this._continuePack(null)}e(null)}_write(e,t){if(this._isLinkname){this._linkname=this._linkname?a.concat([this._linkname,e]):e;return t(null)}if(this._isVoid){if(e.byteLength>0){return t(new Error("No body allowed for this entry"))}return t()}this.written+=e.byteLength;if(this._pack.push(e))return t();this._pack._drain=t}_finish(){if(this._finished)return;this._finished=true;if(this._isLinkname){this.header.linkname=this._linkname?a.toString(this._linkname,"utf-8"):"";this._pack._encode(this.header)}overflow(this._pack,this.header.size);this._pack._done(this)}_final(e){if(this.written!==this.header.size){return e(new Error("Size mismatch"))}this._finish();e(null)}_getError(){return s(this)||new Error("tar entry destroyed")}_predestroy(){this._pack.destroy(this._getError())}_destroy(e){this._pack._done(this);this._continuePack(this._finished?null:this._getError());e()}}class Pack extends i{constructor(e){super(e);this._drain=noop;this._finalized=false;this._finalizing=false;this._pending=[];this._stream=null}entry(e,t,n){if(this._finalized||this.destroying)throw new Error("already finalized or destroyed");if(typeof t==="function"){n=t;t=null}if(!n)n=noop;if(!e.size||e.type==="symlink")e.size=0;if(!e.type)e.type=modeToType(e.mode);if(!e.mode)e.mode=e.type==="directory"?l:c;if(!e.uid)e.uid=0;if(!e.gid)e.gid=0;if(!e.mtime)e.mtime=new Date;if(typeof t==="string")t=a.from(t);const i=new Sink(this,e,n);if(a.isBuffer(t)){e.size=t.byteLength;i.write(t);i.end();return i}if(i._isVoid){return i}return i}finalize(){if(this._stream||this._pending.length>0){this._finalizing=true;return}if(this._finalized)return;this._finalized=true;this.push(h);this.push(null)}_done(e){if(e!==this._stream)return;this._stream=null;if(this._finalizing)this.finalize();if(this._pending.length)this._pending.shift()._continueOpen()}_encode(e){if(!e.pax){const t=u.encode(e);if(t){this.push(t);return}}this._encodePax(e)}_encodePax(e){const t=u.encodePax({name:e.name,linkname:e.linkname,pax:e.pax});const n={name:"PaxHeader",mode:e.mode,uid:e.uid,gid:e.gid,size:t.byteLength,mtime:e.mtime,type:"pax-header",linkname:e.linkname&&"PaxHeader",uname:e.uname,gname:e.gname,devmajor:e.devmajor,devminor:e.devminor};this.push(u.encode(n));this.push(t);overflow(this,t.byteLength);n.size=e.size;n.type=e.type;this.push(u.encode(n))}_doDrain(){const e=this._drain;this._drain=noop;e()}_predestroy(){const e=s(this);if(this._stream)this._stream.destroy(e);while(this._pending.length){const t=this._pending.shift();t.destroy(e);t._continueOpen()}this._doDrain()}_read(e){this._doDrain();e()}}e.exports=function pack(e){return new Pack(e)};function modeToType(e){switch(e&o.S_IFMT){case o.S_IFBLK:return"block-device";case o.S_IFCHR:return"character-device";case o.S_IFDIR:return"directory";case o.S_IFIFO:return"fifo";case o.S_IFLNK:return"symlink"}return"file"}function noop(){}function overflow(e,t){t&=511;if(t)e.push(h.subarray(0,512-t))}function mapWritable(e){return a.isBuffer(e)?e:a.from(e)}},92:function(e){e.exports=wrappy;function wrappy(e,t){if(e&&t)return wrappy(e)(t);if(typeof e!=="function")throw new TypeError("need wrapper function");Object.keys(e).forEach((function(t){wrapper[t]=e[t]}));return wrapper;function wrapper(){var t=new Array(arguments.length);for(var n=0;n<t.length;n++){t[n]=arguments[n]}var i=e.apply(this,t);var r=t[t.length-1];if(typeof i==="function"&&i!==r){Object.keys(r).forEach((function(e){i[e]=r[e]}))}return i}}},434:function(e){"use strict";e.exports=require("events")},896:function(e){"use strict";e.exports=require("fs")},928:function(e){"use strict";e.exports=require("path")}};var t={};function __nccwpck_require__(n){var i=t[n];if(i!==undefined){return i.exports}var r=t[n]={exports:{}};var s=true;try{e[n](r,r.exports,__nccwpck_require__);s=false}finally{if(s)delete t[n]}return r.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n={};!function(){var e=n;const t=__nccwpck_require__(462);const i=__nccwpck_require__(763);const r=__nccwpck_require__(896);const s=__nccwpck_require__(928);const a=(global.Bare?.platform||process.platform)==="win32";e.pack=function pack(e,n){if(!e)e=".";if(!n)n={};const a=n.fs||r;const o=n.ignore||n.filter||noop;const u=n.mapStream||echo;const l=statAll(a,n.dereference?a.stat:a.lstat,e,o,n.entries,n.sort);const c=n.strict!==false;const h=typeof n.umask==="number"?~n.umask:~processUmask();const pack=n.pack||t.pack();const d=n.finish||noop;let p=n.map||noop;let _=typeof n.dmode==="number"?n.dmode:0;let m=typeof n.fmode==="number"?n.fmode:0;if(n.strip)p=strip(p,n.strip);if(n.readable){_|=parseInt(555,8);m|=parseInt(444,8)}if(n.writable){_|=parseInt(333,8);m|=parseInt(222,8)}onnextentry();function onsymlink(t,n){a.readlink(s.join(e,t),(function(e,t){if(e)return pack.destroy(e);n.linkname=normalize(t);pack.entry(n,onnextentry)}))}function onstat(t,r,o){if(pack.destroyed)return;if(t)return pack.destroy(t);if(!r){if(n.finalize!==false)pack.finalize();return d(pack)}if(o.isSocket())return onnextentry();let l={name:normalize(r),mode:(o.mode|(o.isDirectory()?_:m))&h,mtime:o.mtime,size:o.size,type:"file",uid:o.uid,gid:o.gid};if(o.isDirectory()){l.size=0;l.type="directory";l=p(l)||l;return pack.entry(l,onnextentry)}if(o.isSymbolicLink()){l.size=0;l.type="symlink";l=p(l)||l;return onsymlink(r,l)}l=p(l)||l;if(!o.isFile()){if(c)return pack.destroy(new Error("unsupported type for "+r));return onnextentry()}const b=pack.entry(l,onnextentry);const y=u(a.createReadStream(s.join(e,r),{start:0,end:l.size>0?l.size-1:l.size}),l);y.on("error",(function(e){b.destroy(e)}));i(y,b)}function onnextentry(e){if(e)return pack.destroy(e);l(onstat)}return pack};function head(e){return e.length?e[e.length-1]:null}function processGetuid(){return process.getuid?process.getuid():-1}function processUmask(){return process.umask?process.umask():0}e.extract=function extract(e,n){if(!e)e=".";if(!n)n={};const o=n.fs||r;const u=n.ignore||n.filter||noop;const l=n.mapStream||echo;const c=n.chown!==false&&!a&&processGetuid()===0;const extract=n.extract||t.extract();const h=[];const d=new Date;const p=typeof n.umask==="number"?~n.umask:~processUmask();const _=n.strict!==false;let m=n.map||noop;let b=typeof n.dmode==="number"?n.dmode:0;let y=typeof n.fmode==="number"?n.fmode:0;if(n.strip)m=strip(m,n.strip);if(n.readable){b|=parseInt(555,8);y|=parseInt(444,8)}if(n.writable){b|=parseInt(333,8);y|=parseInt(222,8)}extract.on("entry",onentry);if(n.finish)extract.on("finish",n.finish);return extract;function onentry(t,r,d){t=m(t)||t;t.name=normalize(t.name);const p=s.join(e,s.join("/",t.name));if(u(p,t)){r.resume();return d()}if(t.type==="directory"){h.push([p,t.mtime]);return mkdirfix(p,{fs:o,own:c,uid:t.uid,gid:t.gid,mode:t.mode},stat)}const b=s.dirname(p);validate(o,b,s.join(e,"."),(function(e,n){if(e)return d(e);if(!n)return d(new Error(b+" is not a valid path"));mkdirfix(b,{fs:o,own:c,uid:t.uid,gid:t.gid,mode:493},(function(e){if(e)return d(e);switch(t.type){case"file":return onfile();case"link":return onlink();case"symlink":return onsymlink()}if(_)return d(new Error("unsupported type for "+p+" ("+t.type+")"));r.resume();d()}))}));function stat(e){if(e)return d(e);utimes(p,t,(function(e){if(e)return d(e);if(a)return d();chperm(p,t,d)}))}function onsymlink(){if(a)return d();o.unlink(p,(function(){o.symlink(t.linkname,p,stat)}))}function onlink(){if(a)return d();o.unlink(p,(function(){const i=s.join(e,s.join("/",t.linkname));o.link(i,p,(function(e){if(e&&e.code==="EPERM"&&n.hardlinkAsFilesFallback){r=o.createReadStream(i);return onfile()}stat(e)}))}))}function onfile(){const e=o.createWriteStream(p);const n=l(r,t);e.on("error",(function(e){n.destroy(e)}));i(n,e,(function(t){if(t)return d(t);e.on("close",stat)}))}}function utimesParent(e,t){let n;while((n=head(h))&&e.slice(0,n[0].length)!==n[0])h.pop();if(!n)return t();o.utimes(n[0],d,n[1],t)}function utimes(e,t,i){if(n.utimes===false)return i();if(t.type==="directory")return o.utimes(e,d,t.mtime,i);if(t.type==="symlink")return utimesParent(e,i);o.utimes(e,d,t.mtime,(function(t){if(t)return i(t);utimesParent(e,i)}))}function chperm(e,t,n){const i=t.type==="symlink";const r=i?o.lchmod:o.chmod;const s=i?o.lchown:o.chown;if(!r)return n();const a=(t.mode|(t.type==="directory"?b:y))&p;if(s&&c)s.call(o,e,t.uid,t.gid,onchown);else onchown(null);function onchown(t){if(t)return n(t);if(!r)return n();r.call(o,e,a,n)}}function mkdirfix(e,t,n){o.stat(e,(function(i){if(!i)return n(null);if(i.code!=="ENOENT")return n(i);o.mkdir(e,{mode:t.mode,recursive:true},(function(i,r){if(i)return n(i);chperm(e,t,n)}))}))}};function validate(e,t,n,i){if(t===n)return i(null,true);e.lstat(t,(function(r,a){if(r&&r.code==="ENOENT")return validate(e,s.join(t,".."),n,i);else if(r)return i(r);i(null,a.isDirectory())}))}function noop(){}function echo(e){return e}function normalize(e){return a?e.replace(/\\/g,"/").replace(/[:?<>|]/g,"_"):e}function statAll(e,t,n,i,r,a){if(!r)r=["."];const o=r.slice(0);return function loop(u){if(!o.length)return u(null);const l=o.shift();const c=s.join(n,l);t.call(e,c,(function(t,h){if(t)return u(r.indexOf(l)===-1&&t.code==="ENOENT"?null:t);if(!h.isDirectory())return u(null,l,h);e.readdir(c,(function(e,t){if(e)return u(e);if(a)t.sort();for(let e=0;e<t.length;e++){if(!i(s.join(n,l,t[e])))o.push(s.join(l,t[e]))}u(null,l,h)}))}))}}function strip(e,t){return function(n){n.name=n.name.split("/").slice(t).join("/");const i=n.linkname;if(i&&(n.type==="link"||s.isAbsolute(i))){n.linkname=i.split("/").slice(t).join("/")}return e(n)}}}();module.exports=n})();
@@ -0,0 +1 @@
1
+ {"name":"tar-fs","version":"3.0.6","description":"filesystem bindings for tar-stream","dependencies":{"pump":"^3.0.0","tar-stream":"^3.1.5"},"optionalDependencies":{"bare-fs":"^2.1.1","bare-path":"^2.1.0"},"imports":{"fs":{"bare":"bare-fs","default":"fs"},"path":{"bare":"bare-path","default":"path"}},"files":["index.js"],"standard":{"ignore":["test/fixtures/**"]},"keywords":["tar","fs","file","tarball","directory","stream"],"devDependencies":{"brittle":"^3.1.3","rimraf":"^2.6.3","standard":"^17.0.1"},"scripts":{"test":"standard && brittle test/index.js"},"bugs":{"url":"https://github.com/mafintosh/tar-fs/issues"},"homepage":"https://github.com/mafintosh/tar-fs","main":"index.js","directories":{"test":"test"},"author":"Mathias Buus","license":"MIT","repository":{"type":"git","url":"https://github.com/mafintosh/tar-fs.git"},"_lastModified":"2024-12-22T16:06:36.105Z"}
@@ -0,0 +1 @@
1
+ export { default } from './plugin';
@@ -0,0 +1,33 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var server_exports = {};
29
+ __export(server_exports, {
30
+ default: () => import_plugin.default
31
+ });
32
+ module.exports = __toCommonJS(server_exports);
33
+ var import_plugin = __toESM(require("./plugin"));
@@ -0,0 +1,11 @@
1
+ import { InstallOptions, Plugin } from '@tachybase/server';
2
+ export declare class PluginLogViewerServer extends Plugin {
3
+ afterAdd(): void;
4
+ beforeLoad(): void;
5
+ load(): Promise<void>;
6
+ install(options?: InstallOptions): Promise<void>;
7
+ afterEnable(): Promise<void>;
8
+ afterDisable(): Promise<void>;
9
+ remove(): Promise<void>;
10
+ }
11
+ export default PluginLogViewerServer;
@@ -0,0 +1,61 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var plugin_exports = {};
29
+ __export(plugin_exports, {
30
+ PluginLogViewerServer: () => PluginLogViewerServer,
31
+ default: () => plugin_default
32
+ });
33
+ module.exports = __toCommonJS(plugin_exports);
34
+ var import_server = require("@tachybase/server");
35
+ var import_logger = __toESM(require("./resourcer/logger"));
36
+ class PluginLogViewerServer extends import_server.Plugin {
37
+ afterAdd() {
38
+ }
39
+ beforeLoad() {
40
+ }
41
+ async load() {
42
+ this.app.resource(import_logger.default);
43
+ this.app.acl.registerSnippet({
44
+ name: `pm.${this.name}.logger`,
45
+ actions: ["logger:*"]
46
+ });
47
+ }
48
+ async install(options) {
49
+ }
50
+ async afterEnable() {
51
+ }
52
+ async afterDisable() {
53
+ }
54
+ async remove() {
55
+ }
56
+ }
57
+ var plugin_default = PluginLogViewerServer;
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {
60
+ PluginLogViewerServer
61
+ });
@@ -0,0 +1,10 @@
1
+ import { Context, Next } from '@tachybase/actions';
2
+ declare const _default: {
3
+ name: string;
4
+ actions: {
5
+ list: (ctx: Context, next: Next) => Promise<void>;
6
+ download: (ctx: Context, next: Next) => Promise<void>;
7
+ preview: (ctx: Context, next: Next) => Promise<void>;
8
+ };
9
+ };
10
+ export default _default;
@@ -0,0 +1,157 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var logger_exports = {};
29
+ __export(logger_exports, {
30
+ default: () => logger_default
31
+ });
32
+ module.exports = __toCommonJS(logger_exports);
33
+ var import_promises = require("fs/promises");
34
+ var import_path = require("path");
35
+ var import_stream = __toESM(require("stream"));
36
+ var import_zlib = __toESM(require("zlib"));
37
+ var import_logger = require("@tachybase/logger");
38
+ var import_tar_fs = require("tar-fs");
39
+ const tarFiles = (files) => {
40
+ return new Promise((resolve, reject) => {
41
+ const passthrough = new import_stream.default.PassThrough();
42
+ const gz = import_zlib.default.createGzip();
43
+ (0, import_tar_fs.pack)((0, import_logger.getLoggerFilePath)(), {
44
+ entries: files
45
+ }).on("data", (chunk) => {
46
+ passthrough.write(chunk);
47
+ }).on("end", () => {
48
+ passthrough.end();
49
+ }).on("error", (err) => reject(err));
50
+ passthrough.on("data", (chunk) => {
51
+ gz.write(chunk);
52
+ }).on("end", () => {
53
+ gz.end();
54
+ resolve(gz);
55
+ }).on("error", (err) => reject(err));
56
+ gz.on("error", (err) => reject(err));
57
+ });
58
+ };
59
+ var logger_default = {
60
+ name: "logger",
61
+ actions: {
62
+ list: async (ctx, next) => {
63
+ const appName = ctx.app.name;
64
+ if (!appName) {
65
+ ctx.throw(400, ctx.t("App not found"));
66
+ }
67
+ const path = (0, import_logger.getLoggerFilePath)();
68
+ const readDir = async (path2, hasPermission) => {
69
+ const fileTree = [];
70
+ try {
71
+ const files2 = await (0, import_promises.readdir)(path2, { withFileTypes: true });
72
+ for (const file of files2) {
73
+ if (file.isDirectory()) {
74
+ let hasSubDirPermission = hasPermission;
75
+ if (hasSubDirPermission === void 0) {
76
+ hasSubDirPermission = appName === "main" || file.name === appName;
77
+ }
78
+ const subFiles = await readDir((0, import_path.join)(path2, file.name), hasSubDirPermission);
79
+ if (!subFiles.length) {
80
+ continue;
81
+ }
82
+ if (hasSubDirPermission) {
83
+ fileTree.push({
84
+ name: file.name,
85
+ files: subFiles
86
+ });
87
+ }
88
+ } else if (file.name.endsWith(".log")) {
89
+ if (hasPermission || appName === "main" || file.name.startsWith(appName + ".")) {
90
+ fileTree.push(file.name);
91
+ }
92
+ }
93
+ }
94
+ return fileTree;
95
+ } catch (err) {
96
+ ctx.log.error("readDir error", { err, path: path2 });
97
+ return [];
98
+ }
99
+ };
100
+ const files = await readDir(path, void 0);
101
+ ctx.body = files;
102
+ await next();
103
+ },
104
+ download: async (ctx, next) => {
105
+ const appName = ctx.app.name;
106
+ if (!appName) {
107
+ ctx.throw(400, ctx.t("App not found"));
108
+ }
109
+ let { files = [] } = ctx.action.params.values || {};
110
+ const invalid = files.some((file) => !file.endsWith(".log"));
111
+ if (invalid) {
112
+ ctx.throw(400, ctx.t("Invalid file type: ") + invalid);
113
+ }
114
+ files = files.map((file) => {
115
+ if (file.startsWith("/")) {
116
+ file = file.slice(1);
117
+ }
118
+ if (appName !== "main" && !file.startsWith(appName)) {
119
+ ctx.throw(401, ctx.t("Permission denied"));
120
+ }
121
+ return file;
122
+ });
123
+ try {
124
+ ctx.attachment("logs.tar.gz");
125
+ ctx.body = await tarFiles(files);
126
+ } catch (err) {
127
+ ctx.log.error(`download error: ${err.message}`, { files, err: err.stack });
128
+ ctx.throw(500, ctx.t("Download logs failed."));
129
+ }
130
+ await next();
131
+ },
132
+ preview: async (ctx, next) => {
133
+ const appName = ctx.app.name;
134
+ if (!appName) {
135
+ ctx.throw(400, ctx.t("App not found"));
136
+ }
137
+ let { file } = ctx.action.params.values || {};
138
+ if (!file || !file.endsWith(".log")) {
139
+ ctx.throw(400, ctx.t("Invalid file type: ") + file);
140
+ }
141
+ if (file.startsWith("/")) {
142
+ file = file.slice(1);
143
+ }
144
+ if (appName !== "main" && !file.startsWith(appName)) {
145
+ ctx.throw(401, ctx.t("Permission denied"));
146
+ }
147
+ try {
148
+ const path = (0, import_logger.getLoggerFilePath)();
149
+ ctx.body = await (0, import_promises.readFile)((0, import_path.join)(path, file), { encoding: "utf8" });
150
+ } catch (err) {
151
+ ctx.log.error(`preview error: ${err.message}`, { file, err: err.stack });
152
+ ctx.throw(500, ctx.t("Preview logs failed."));
153
+ }
154
+ await next();
155
+ }
156
+ }
157
+ };
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@tachybase/plugin-log-viewer",
3
+ "displayName": "Logger",
4
+ "version": "0.23.8",
5
+ "description": "Server-side logs, mainly including API request logs and system runtime logs, and allows to package and download log files.",
6
+ "keywords": [
7
+ "Logging and monitoring"
8
+ ],
9
+ "license": "Apache-2.0",
10
+ "main": "dist/server/index.js",
11
+ "devDependencies": {
12
+ "@ant-design/icons": "^5.5.2",
13
+ "@types/tar-fs": "^2.0.4",
14
+ "ahooks": "^3.8.4",
15
+ "antd": "5.22.5",
16
+ "react-i18next": "^15.2.0",
17
+ "tar-fs": "^3.0.6"
18
+ },
19
+ "peerDependencies": {
20
+ "@tachybase/client": "0.23.8",
21
+ "@tachybase/server": "0.23.8",
22
+ "@tachybase/test": "0.23.8",
23
+ "@tachybase/actions": "0.23.8",
24
+ "@tachybase/logger": "0.23.8"
25
+ },
26
+ "description.zh-CN": "服务端日志,主要包括接口请求日志和系统运行日志,并支持打包和下载日志文件。",
27
+ "displayName.zh-CN": "日志",
28
+ "scripts": {
29
+ "build": "tachybase-build --no-dts @tachybase/plugin-log-viewer"
30
+ }
31
+ }
package/server.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/server';
2
+ export { default } from './dist/server';
package/server.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/server/index.js');