Rebuild the MCP bundle for the contract and CLI changes
dist/mcp/server.js is a tracked build artifact gated by CI: regenerate it after the exit-code, config-loader, gate, redaction, parser and lazy-dispatch changes so the bundle gate passes. Text assets (skill cli.md) are embedded at bundle time, which is why the contract updates land here too.
This commit is contained in:
1 parent
07b8ba8064
commit
3d55ef7b4a
1 file changed
+240
-240
Vendored
+240
-240
@@ -1,167 +1,175 @@
|
||||
import{createRequire as Ox0}from"node:module";var Wx0=Object.create;var{getPrototypeOf:Xx0,defineProperty:hE,getOwnPropertyNames:Zx0}=Object;var qx0=Object.prototype.hasOwnProperty;function Vx0($){return this[$]}var Lx0,Fx0,H6=($,Y,U)=>{var Q=$!=null&&typeof $==="object";if(Q){var I=Y?Lx0??=new WeakMap:Fx0??=new WeakMap,J=I.get($);if(J)return J}U=$!=null?Wx0(Xx0($)):{};let K=Y||!$||!$.__esModule?hE(U,"default",{value:$,enumerable:!0}):U;for(let z of Zx0($))if(!qx0.call(K,z))hE(K,z,{get:Vx0.bind($,z),enumerable:!0});if(Q)I.set($,K);return K};var j=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);var wx0=($)=>$;function Mx0($,Y){this[$]=wx0.bind(null,Y)}var L8=($,Y)=>{for(var U in Y)hE($,U,{get:Y[U],enumerable:!0,configurable:!0,set:Mx0.bind(Y,U)})};var o=($,Y)=>()=>($&&(Y=$($=0)),Y);var K0=Ox0(import.meta.url);var Nx0,qV,Dx0,Ax0,Bx0,Px0,_0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),nr=($,Y)=>{let U={};for(var Q in $)qV(U,Q,{get:$[Q],enumerable:!0});if(Y)qV(U,Symbol.toStringTag,{value:"Module"});return U},Tx0=($,Y,U,Q)=>{if(Y&&typeof Y==="object"||typeof Y==="function"){for(var I=Ax0(Y),J=0,K=I.length,z;J<K;J++)if(z=I[J],!Px0.call($,z)&&z!==U)qV($,z,{get:((G)=>Y[G]).bind(null,z),enumerable:!(Q=Dx0(Y,z))||Q.enumerable})}return $},VV=($,Y,U)=>(U=$!=null?Nx0(Bx0($)):{},Tx0(Y||!$||!$.__esModule?qV(U,"default",{value:$,enumerable:!0}):U,$));var gE=o(()=>{Nx0=Object.create,qV=Object.defineProperty,Dx0=Object.getOwnPropertyDescriptor,Ax0=Object.getOwnPropertyNames,Bx0=Object.getPrototypeOf,Px0=Object.prototype.hasOwnProperty});function pr($){return typeof $==="string"&&dr.has($.replace(/#$/,""))}function mr($,Y){if(!("$schema"in $)||typeof $.$schema!=="string")return"2020-12";let U=$.$schema.replace(/#$/,"");if(Ex0.has(U))return"2020-12";if(dr.has(U))return"2019-09";if(jx0.has(U)||Cx0.has(U))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${$.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${Y}`)}var Ex0,dr,jx0,Cx0;var yE=o(()=>{Ex0=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),dr=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),jx0=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Cx0=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});function H0($,Y,U){function Q(z,G){if(!z._zod)Object.defineProperty(z,"_zod",{value:{def:G,constr:K,traits:new Set},enumerable:!1});if(z._zod.traits.has($))return;z._zod.traits.add($),Y(z,G);let H=K.prototype,W=Object.keys(H);for(let X=0;X<W.length;X++){let Z=W[X];if(!(Z in z))z[Z]=H[Z].bind(z)}}let I=U?.Parent??Object;class J extends I{}Object.defineProperty(J,"name",{value:$});function K(z){var G;let H=U?.Parent?new J:this;Q(H,z),(G=H._zod).deferred??(G.deferred=[]);for(let W of H._zod.deferred)W();return H}return Object.defineProperty(K,"init",{value:Q}),Object.defineProperty(K,Symbol.hasInstance,{value:(z)=>{if(U?.Parent&&z instanceof U.Parent)return!0;return z?._zod?.traits?.has($)}}),Object.defineProperty(K,"name",{value:$}),K}function e4($){if($)Object.assign(gY,$);return gY}var lr,GG,kE,e5,yY,gY;var kY=o(()=>{GG=Object.freeze({status:"aborted"});kE=Symbol("zod_brand");e5=class e5 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};yY=class yY extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(lr=globalThis).__zod_globalConfig??(lr.__zod_globalConfig={});gY=globalThis.__zod_globalConfig});var x0={};L8(x0,{unwrapMessage:()=>HG,uint8ArrayToHex:()=>ex0,uint8ArrayToBase64url:()=>tx0,uint8ArrayToBase64:()=>sr,stringifyPrimitive:()=>h0,slugify:()=>uE,shallowClone:()=>iE,safeExtend:()=>px0,required:()=>ox0,randomString:()=>fx0,propertyKeyTypes:()=>ZG,promiseAllObject:()=>xx0,primitiveTypes:()=>cE,prefixIssues:()=>l8,pick:()=>cx0,partial:()=>lx0,parsedType:()=>y0,optionalKeys:()=>nE,omit:()=>nx0,objectClone:()=>gx0,numKeys:()=>ux0,nullish:()=>O7,normalizeParams:()=>f0,mergeDefs:()=>$3,merge:()=>mx0,jsonStringifyReplacer:()=>$I,joinValues:()=>O0,issue:()=>UI,isPlainObject:()=>D7,isObject:()=>xY,hexToUint8Array:()=>ax0,getSizableOrigin:()=>qG,getParsedType:()=>bx0,getLengthableOrigin:()=>VG,getEnumValues:()=>WG,getElementAtPath:()=>kx0,floatSafeRemainder:()=>fE,finalizeIssue:()=>S8,extend:()=>dx0,explicitlyAborted:()=>mE,escapeRegex:()=>h$,esc:()=>LV,defineLazy:()=>C1,createTransparentProxy:()=>ix0,cloneDef:()=>yx0,clone:()=>v8,cleanRegex:()=>XG,cleanEnum:()=>rx0,captureStackTrace:()=>FV,cached:()=>YI,base64urlToUint8Array:()=>sx0,base64ToUint8Array:()=>rr,assignProp:()=>N7,assertNotEqual:()=>_x0,assertNever:()=>Sx0,assertIs:()=>vx0,assertEqual:()=>Rx0,assert:()=>hx0,allowsEval:()=>bE,aborted:()=>A7,NUMBER_FORMAT_RANGES:()=>dE,Class:()=>trLine truncated
|
||||
`)}var ar=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,$I,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},LG,o8;var rE=o(()=>{kY();$1();LG=H0("$ZodError",ar),o8=H0("$ZodError",ar,{Parent:Error})});var QI=($)=>(Y,U,Q,I)=>{let J=Q?{...Q,async:!1}:{async:!1},K=Y._zod.run({value:U,issues:[]},J);if(K instanceof Promise)throw new e5;if(K.issues.length){let z=new(I?.Err??$)(K.issues.map((G)=>S8(G,J,e4())));throw FV(z,I?.callee),z}return K.value},wV,II=($)=>async(Y,U,Q,I)=>{let J=Q?{...Q,async:!0}:{async:!0},K=Y._zod.run({value:U,issues:[]},J);if(K instanceof Promise)K=await K;if(K.issues.length){let z=new(I?.Err??$)(K.issues.map((G)=>S8(G,J,e4())));throw FV(z,I?.callee),z}return K.value},MV,JI=($)=>(Y,U,Q)=>{let I=Q?{...Q,async:!1}:{async:!1},J=Y._zod.run({value:U,issues:[]},I);if(J instanceof Promise)throw new e5;return J.issues.length?{success:!1,error:new($??LG)(J.issues.map((K)=>S8(K,I,e4())))}:{success:!0,data:J.value}},sE,KI=($)=>async(Y,U,Q)=>{let I=Q?{...Q,async:!0}:{async:!0},J=Y._zod.run({value:U,issues:[]},I);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((K)=>S8(K,I,e4())))}:{success:!0,data:J.value}},tE,OV=($)=>(Y,U,Q)=>{let I=Q?{...Q,direction:"backward"}:{direction:"backward"};return QI($)(Y,U,I)},Yf0,NV=($)=>(Y,U,Q)=>{return QI($)(Y,U,Q)},Uf0,DV=($)=>async(Y,U,Q)=>{let I=Q?{...Q,direction:"backward"}:{direction:"backward"};return II($)(Y,U,I)},Qf0,AV=($)=>async(Y,U,Q)=>{return II($)(Y,U,Q)},If0,BV=($)=>(Y,U,Q)=>{let I=Q?{...Q,direction:"backward"}:{direction:"backward"};return JI($)(Y,U,I)},Jf0,PV=($)=>(Y,U,Q)=>{return JI($)(Y,U,Q)},Kf0,TV=($)=>async(Y,U,Q)=>{let I=Q?{...Q,direction:"backward"}:{direction:"backward"};return KI($)(Y,U,I)},zf0,EV=($)=>async(Y,U,Q)=>{return KI($)(Y,U,Q)},Gf0;var aE=o(()=>{kY();rE();$1();wV=QI(o8),MV=II(o8),sE=JI(o8),tE=KI(o8),Yf0=OV(o8),Uf0=NV(o8),Qf0=DV(o8),If0=AV(o8),Jf0=BV(o8),Kf0=PV(o8),zf0=TV(o8),Gf0=EV(o8)});var Z$={};L8(Z$,{xid:()=>Uj,uuid7:()=>Zf0,uuid6:()=>Xf0,uuid4:()=>Wf0,uuid:()=>fY,uppercase:()=>jj,unicodeEmail:()=>$s,undefined:()=>Tj,ulid:()=>Yj,time:()=>Mj,string:()=>Nj,sha512_hex:()=>hf0,sha512_base64url:()=>yf0,sha512_base64:()=>gf0,sha384_hex:()=>_f0,sha384_base64url:()=>Sf0,sha384_base64:()=>vf0,sha256_hex:()=>jf0,sha256_base64url:()=>Rf0,sha256_base64:()=>Cf0,sha1_hex:()=>Pf0,sha1_base64url:()=>Ef0,sha1_base64:()=>Tf0,rfc5322Email:()=>Vf0,number:()=>MG,null:()=>Pj,nanoid:()=>Ij,md5_hex:()=>Df0,md5_base64url:()=>Bf0,md5_base64:()=>Af0,mac:()=>Xj,lowercase:()=>Ej,ksuid:()=>Qj,ipv6:()=>Wj,ipv4:()=>Hj,integer:()=>Aj,idnEmail:()=>Lf0,httpProtocol:()=>Lj,html5Email:()=>qf0,hostname:()=>Mf0,hex:()=>Nf0,guid:()=>Kj,extendedDuration:()=>Hf0,emoji:()=>Gj,email:()=>zj,e164:()=>Fj,duration:()=>Jj,domain:()=>Of0,datetime:()=>Oj,date:()=>wj,cuid2:()=>$j,cuid:()=>eE,cidrv6:()=>qj,cidrv4:()=>Zj,browserEmail:()=>Ff0,boolean:()=>Bj,bigint:()=>Dj,base64url:()=>jV,base64:()=>Vj});function Gj(){return new RegExp(wf0,"u")}function Us($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Mj($){return new RegExp(`^${Us($)}$`)}function Oj($){let Y=Us({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let Q=`${Y}(?:${U.join("|")})`;return new RegExp(`^${Ys}T(?:${Q})$`)}function OG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function NG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var eE,$j,Yj,Uj,Qj,Ij,Jj,Hf0,Kj,fY=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Wf0,Xf0,Zf0,zj,qf0,Vf0,$s,Lf0,Ff0,wf0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Hj,Wj,Xj=($)=>{let Y=h$($??":");return new RegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},Zj,qj,Vj,jV,Mf0,Of0,Lj,Fj,Ys="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",wj,Nj=($)=>{let Y=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)},Dj,Aj,MG,Bj,Pj,Tj,Ej,jj,Nf0,Df0,Af0,Bf0,Pf0,Tf0,Ef0,jf0,Cf0,Rf0,_f0,vf0,Sf0,hf0,gf0,yf0;var CV=o(()=>{$1();eE=/^[cC][0-9a-z]{6,}$/,$j=/^[0-9a-z]+$/,Yj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Uj=/^[0-9a-vA-V]{20}$/,Qj=/^[A-Za-z0-9]{27}$/,Ij=/^[a-zA-Z0-9_-]{21}$/,Jj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
|
||||
import{createRequire as _x0}from"node:module";var Nx0=Object.create;var{getPrototypeOf:Px0,defineProperty:cj,getOwnPropertyNames:Bx0}=Object;var Ax0=Object.prototype.hasOwnProperty;function Tx0($){return this[$]}var jx0,Ex0,X6=($,Y,U)=>{var Q=$!=null&&typeof $==="object";if(Q){var I=Y?jx0??=new WeakMap:Ex0??=new WeakMap,J=I.get($);if(J)return J}U=$!=null?Nx0(Px0($)):{};let K=Y||!$||!$.__esModule?cj(U,"default",{value:$,enumerable:!0}):U;for(let z of Bx0($))if(!Ax0.call(K,z))cj(K,z,{get:Tx0.bind($,z),enumerable:!0});if(Q)I.set($,K);return K};var E=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);var Cx0=($)=>$;function Rx0($,Y){this[$]=Cx0.bind(null,Y)}var M1=($,Y)=>{for(var U in Y)cj($,U,{get:Y[U],enumerable:!0,configurable:!0,set:Rx0.bind(Y,U)})};var o=($,Y)=>()=>($&&(Y=$($=0)),Y);var z0=_x0(import.meta.url);var vx0,PV,hx0,Sx0,gx0,yx0,_0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),tr=($,Y)=>{let U={};for(var Q in $)PV(U,Q,{get:$[Q],enumerable:!0});if(Y)PV(U,Symbol.toStringTag,{value:"Module"});return U},kx0=($,Y,U,Q)=>{if(Y&&typeof Y==="object"||typeof Y==="function"){for(var I=Sx0(Y),J=0,K=I.length,z;J<K;J++)if(z=I[J],!yx0.call($,z)&&z!==U)PV($,z,{get:((H)=>Y[H]).bind(null,z),enumerable:!(Q=hx0(Y,z))||Q.enumerable})}return $},BV=($,Y,U)=>(U=$!=null?vx0(gx0($)):{},kx0(Y||!$||!$.__esModule?PV(U,"default",{value:$,enumerable:!0}):U,$));var nj=o(()=>{vx0=Object.create,PV=Object.defineProperty,hx0=Object.getOwnPropertyDescriptor,Sx0=Object.getOwnPropertyNames,gx0=Object.getPrototypeOf,yx0=Object.prototype.hasOwnProperty});function $s($){return typeof $==="string"&&er.has($.replace(/#$/,""))}function Ys($,Y){if(!("$schema"in $)||typeof $.$schema!=="string")return"2020-12";let U=$.$schema.replace(/#$/,"");if(xx0.has(U))return"2020-12";if(er.has(U))return"2019-09";if(fx0.has(U)||ux0.has(U))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${$.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${Y}`)}var xx0,er,fx0,ux0;var pj=o(()=>{xx0=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),er=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),fx0=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),ux0=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});function W0($,Y,U){function Q(z,H){if(!z._zod)Object.defineProperty(z,"_zod",{value:{def:H,constr:K,traits:new Set},enumerable:!1});if(z._zod.traits.has($))return;z._zod.traits.add($),Y(z,H);let G=K.prototype,W=Object.keys(G);for(let X=0;X<W.length;X++){let Z=W[X];if(!(Z in z))z[Z]=G[Z].bind(z)}}let I=U?.Parent??Object;class J extends I{}Object.defineProperty(J,"name",{value:$});function K(z){var H;let G=U?.Parent?new J:this;Q(G,z),(H=G._zod).deferred??(H.deferred=[]);for(let W of G._zod.deferred)W();return G}return Object.defineProperty(K,"init",{value:Q}),Object.defineProperty(K,Symbol.hasInstance,{value:(z)=>{if(U?.Parent&&z instanceof U.Parent)return!0;return z?._zod?.traits?.has($)}}),Object.defineProperty(K,"name",{value:$}),K}function Y6($){if($)Object.assign(gY,$);return gY}var Us,WH,dj,t5,yY,gY;var kY=o(()=>{WH=Object.freeze({status:"aborted"});dj=Symbol("zod_brand");t5=class t5 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};yY=class yY extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(Us=globalThis).__zod_globalConfig??(Us.__zod_globalConfig={});gY=globalThis.__zod_globalConfig});var x0={};M1(x0,{unwrapMessage:()=>XH,uint8ArrayToHex:()=>Wf0,uint8ArrayToBase64url:()=>Hf0,uint8ArrayToBase64:()=>Js,stringifyPrimitive:()=>S0,slugify:()=>oj,shallowClone:()=>sj,safeExtend:()=>Uf0,required:()=>Jf0,randomString:()=>rx0,propertyKeyTypes:()=>VH,promiseAllObject:()=>ox0,primitiveTypes:()=>aj,prefixIssues:()=>m8,pick:()=>ex0,partial:()=>If0,parsedType:()=>y0,optionalKeys:()=>tj,omit:()=>$f0,objectClone:()=>dx0,numKeys:()=>sx0,nullish:()=>M7,normalizeParams:()=>f0,mergeDefs:()=>e9,merge:()=>Qf0,jsonStringifyReplacer:()=>YI,joinValues:()=>M0,issue:()=>QI,isPlainObject:()=>D7,isObject:()=>xY,hexToUint8Array:()=>Gf0,getSizableOrigin:()=>LH,getParsedType:()=>ax0,getLengthableOrigin:()=>wH,getEnumValues:()=>ZH,getElementAtPath:()=>lx0,floatSafeRemainder:()=>lj,finalizeIssue:()=>h8,extend:()=>Yf0,explicitlyAborted:()=>YE,escapeRegex:()=>g$,esc:()=>AV,defineLazy:()=>R1,createTransparentProxy:()=>tx0,cloneDef:()=>mx0,clone:()=>v8,cleanRegex:()=>qH,cleanEnum:()=>Kf0,captureStackTrace:()=>TV,cached:()=>UI,base64urlToUint8Array:()=>zf0,base64ToUint8Array:()=>Is,assignProp:()=>O7,assertNotEqual:()=>ix0,assertNever:()=>nx0,assertIs:()=>cx0,assertEqual:()=>bx0,assert:()=>px0,allowsEval:()=>rj,aborted:()=>N7,NUMBER_FORMAT_RANGES:()=>ej,Class:()=>KsLine truncated
|
||||
`)}var zs=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,YI,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},FH,l8;var IE=o(()=>{kY();$1();FH=W0("$ZodError",zs),l8=W0("$ZodError",zs,{Parent:Error})});var II=($)=>(Y,U,Q,I)=>{let J=Q?{...Q,async:!1}:{async:!1},K=Y._zod.run({value:U,issues:[]},J);if(K instanceof Promise)throw new t5;if(K.issues.length){let z=new(I?.Err??$)(K.issues.map((H)=>h8(H,J,Y6())));throw TV(z,I?.callee),z}return K.value},jV,JI=($)=>async(Y,U,Q,I)=>{let J=Q?{...Q,async:!0}:{async:!0},K=Y._zod.run({value:U,issues:[]},J);if(K instanceof Promise)K=await K;if(K.issues.length){let z=new(I?.Err??$)(K.issues.map((H)=>h8(H,J,Y6())));throw TV(z,I?.callee),z}return K.value},EV,KI=($)=>(Y,U,Q)=>{let I=Q?{...Q,async:!1}:{async:!1},J=Y._zod.run({value:U,issues:[]},I);if(J instanceof Promise)throw new t5;return J.issues.length?{success:!1,error:new($??FH)(J.issues.map((K)=>h8(K,I,Y6())))}:{success:!0,data:J.value}},JE,zI=($)=>async(Y,U,Q)=>{let I=Q?{...Q,async:!0}:{async:!0},J=Y._zod.run({value:U,issues:[]},I);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((K)=>h8(K,I,Y6())))}:{success:!0,data:J.value}},KE,CV=($)=>(Y,U,Q)=>{let I=Q?{...Q,direction:"backward"}:{direction:"backward"};return II($)(Y,U,I)},Zf0,RV=($)=>(Y,U,Q)=>{return II($)(Y,U,Q)},qf0,_V=($)=>async(Y,U,Q)=>{let I=Q?{...Q,direction:"backward"}:{direction:"backward"};return JI($)(Y,U,I)},Vf0,vV=($)=>async(Y,U,Q)=>{return JI($)(Y,U,Q)},Lf0,hV=($)=>(Y,U,Q)=>{let I=Q?{...Q,direction:"backward"}:{direction:"backward"};return KI($)(Y,U,I)},wf0,SV=($)=>(Y,U,Q)=>{return KI($)(Y,U,Q)},Ff0,gV=($)=>async(Y,U,Q)=>{let I=Q?{...Q,direction:"backward"}:{direction:"backward"};return zI($)(Y,U,I)},Mf0,yV=($)=>async(Y,U,Q)=>{return zI($)(Y,U,Q)},Of0;var zE=o(()=>{kY();IE();$1();jV=II(l8),EV=JI(l8),JE=KI(l8),KE=zI(l8),Zf0=CV(l8),qf0=RV(l8),Vf0=_V(l8),Lf0=vV(l8),wf0=hV(l8),Ff0=SV(l8),Mf0=gV(l8),Of0=yV(l8)});var X$={};M1(X$,{xid:()=>XE,uuid7:()=>Bf0,uuid6:()=>Pf0,uuid4:()=>Nf0,uuid:()=>fY,uppercase:()=>kE,unicodeEmail:()=>Gs,undefined:()=>gE,ulid:()=>WE,time:()=>EE,string:()=>RE,sha512_hex:()=>pf0,sha512_base64url:()=>mf0,sha512_base64:()=>df0,sha384_hex:()=>if0,sha384_base64url:()=>nf0,sha384_base64:()=>cf0,sha256_hex:()=>ff0,sha256_base64url:()=>bf0,sha256_base64:()=>uf0,sha1_hex:()=>yf0,sha1_base64url:()=>xf0,sha1_base64:()=>kf0,rfc5322Email:()=>Tf0,number:()=>DH,null:()=>SE,nanoid:()=>qE,md5_hex:()=>hf0,md5_base64url:()=>gf0,md5_base64:()=>Sf0,mac:()=>DE,lowercase:()=>yE,ksuid:()=>ZE,ipv6:()=>OE,ipv4:()=>ME,integer:()=>vE,idnEmail:()=>jf0,httpProtocol:()=>AE,html5Email:()=>Af0,hostname:()=>Rf0,hex:()=>vf0,guid:()=>LE,extendedDuration:()=>Df0,emoji:()=>FE,email:()=>wE,e164:()=>TE,duration:()=>VE,domain:()=>_f0,datetime:()=>CE,date:()=>jE,cuid2:()=>GE,cuid:()=>HE,cidrv6:()=>PE,cidrv4:()=>NE,browserEmail:()=>Ef0,boolean:()=>hE,bigint:()=>_E,base64url:()=>kV,base64:()=>BE});function FE(){return new RegExp(Cf0,"u")}function Xs($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function EE($){return new RegExp(`^${Xs($)}$`)}function CE($){let Y=Xs({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let Q=`${Y}(?:${U.join("|")})`;return new RegExp(`^${Ws}T(?:${Q})$`)}function NH($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function PH($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var HE,GE,WE,XE,ZE,qE,VE,Df0,LE,fY=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Nf0,Pf0,Bf0,wE,Af0,Tf0,Gs,jf0,Ef0,Cf0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ME,OE,DE=($)=>{let Y=g$($??":");return new RegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},NE,PE,BE,kV,Rf0,_f0,AE,TE,Ws="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",jE,RE=($)=>{let Y=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)},_E,vE,DH,hE,SE,gE,yE,kE,vf0,hf0,Sf0,gf0,yf0,kf0,xf0,ff0,uf0,bf0,if0,cf0,nf0,pf0,df0,mf0;var xV=o(()=>{$1();HE=/^[cC][0-9a-z]{6,}$/,GE=/^[0-9a-z]+$/,WE=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,XE=/^[0-9a-vA-V]{20}$/,ZE=/^[A-Za-z0-9]{27}$/,qE=/^[a-zA-Z0-9_-]{21}$/,VE=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
|
||||
`).filter((J)=>J),Q=Math.min(...U.map((J)=>J.length-J.trimStart().length)),I=U.map((J)=>J.slice(Q)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of I)this.content.push(J)}compile(){let $=Function,Y=this?.args,Q=[...(this?.content??[""]).map((I)=>` ${I}`)];return new $(...Y,Q.join(`
|
||||
`))}}var mj;var lj=o(()=>{mj={major:4,minor:4,patch:3}});function LC($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function Ns($){if(!jV.test($))return!1;let Y=$.replace(/[-_]/g,(Q)=>Q==="-"?"+":"/"),U=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return LC(U)}function Ds($,Y=null){try{let U=$.split(".");if(U.length!==3)return!1;let[Q]=U;if(!Q)return!1;let I=JSON.parse(atob(Q));if("typ"in I&&I?.typ!=="JWT")return!1;if(!I.alg)return!1;if(Y&&(!("alg"in I)||I.alg!==Y))return!1;return!0}catch{return!1}}function Ks($,Y,U){if($.issues.length)Y.issues.push(...l8(U,$.issues));Y.value[U]=$.value}function kV($,Y,U,Q,I,J){let K=U in Q;if($.issues.length){if(I&&J&&!K)return;Y.issues.push(...l8(U,$.issues))}if(!K&&!I){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[U]});return}if($.value===void 0){if(K)Y.value[U]=void 0}else Y.value[U]=$.value}function As($){let Y=Object.keys($.shape);for(let Q of Y)if(!$.shape?.[Q]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${Q}": expected a Zod schema`);let U=nE($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(U)}}function Bs($,Y,U,Q,I,J){let K=[],z=I.keySet,G=I.catchall._zod,H=G.def.type,W=G.optin==="optional",X=G.optout==="optional";for(let Z in Y){if(Z==="__proto__")continue;if(z.has(Z))continue;if(H==="never"){K.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},Q);if(q instanceof Promise)$.push(q.then((V)=>kV(V,U,Z,Y,W,X)));else kV(q,U,Z,Y,W,X)}if(K.length)U.issues.push({code:"unrecognized_keys",keys:K,input:Y,inst:J});if(!$.length)return U;return Promise.all($).then(()=>{return U})}function zs($,Y,U,Q){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let I=$.filter((J)=>!A7(J));if(I.length===1)return Y.value=I[0].value,I[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((K)=>S8(K,Q,e4())))}),Y}function Gs($,Y,U,Q){let I=$.filter((J)=>J.issues.length===0);if(I.length===1)return Y.value=I[0].value,Y;if(I.length===0)Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((K)=>S8(K,Q,e4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:[],inclusive:!1});return Y}function oj($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(D7($)&&D7(Y)){let U=Object.keys(Y),Q=Object.keys($).filter((J)=>U.indexOf(J)!==-1),I={...$,...Y};for(let J of Q){let K=oj($[J],Y[J]);if(!K.valid)return{valid:!1,mergeErrorPath:[J,...K.mergeErrorPath]};I[J]=K.data}return{valid:!0,data:I}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let Q=0;Q<$.length;Q++){let I=$[Q],J=Y[Q],K=oj(I,J);if(!K.valid)return{valid:!1,mergeErrorPath:[Q,...K.mergeErrorPath]};U.push(K.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function Hs($,Y,U){let Q=new Map,I;for(let z of Y.issues)if(z.code==="unrecognized_keys"){I??(I=z);for(let G of z.keys){if(!Q.has(G))Q.set(G,{});Q.get(G).l=!0}}else $.issues.push(z);for(let z of U.issues)if(z.code==="unrecognized_keys")for(let G of z.keys){if(!Q.has(G))Q.set(G,{});Q.get(G).r=!0}else $.issues.push(z);let J=[...Q].filter(([,z])=>z.l&&z.r).map(([z])=>z);if(J.length&&I)$.issues.push({...I,keys:J});if(A7($))return $;let K=oj(Y.value,U.value);if(!K.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}function Ws($,Y){for(let U=$.length-1;U>=0;U--)if($[U]._zod[Y]!=="optional")return U+1;return 0}function Xs($,Y,U){if($.issues.length)Y.issues.push(...l8(U,$.issues));Y.value[U]=$.value}function Zs($,Y,U,Q,I){for(let J=0;J<U.length;J++){let K=$[J],z=J<Q.length;if(K.issues.length){if(!z&&J>=I){Y.value.length=J;break}Y.issues.push(...l8(J,K.issues))}Y.value[J]=K.value}for(let J=Y.value.length-1;J>=Q.length;J--)if(U[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function qs($,Y,U,Q,I,J,K){if($.issues.length)if(ZG.has(typeof Q))U.issues.push(...l8(Q,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:I,inst:J,issues:$.issues.map((z)=>S8(z,K,e4()))});if(Y.issues.length)if(ZG.has(typeof Q))U.issues.push(...l8(Q,Y.issues));else U.issues.push({origin:"map",code:"invalid_element",input:I,inst:J,key:Q,issues:Y.issues.map((z)=>S8(z,K,e4()))});U.value.set($.value,Y.value)}function Vs($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function Ls($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function Fs($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function ws($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function hV($,Y,U){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa
Line truncated
|
||||
if (${D}.issues.length) {
|
||||
if (${P} in input) {
|
||||
payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
|
||||
`))}}var YC;var UC=o(()=>{YC={major:4,minor:4,patch:3}});function AC($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function Rs($){if(!kV.test($))return!1;let Y=$.replace(/[-_]/g,(Q)=>Q==="-"?"+":"/"),U=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return AC(U)}function _s($,Y=null){try{let U=$.split(".");if(U.length!==3)return!1;let[Q]=U;if(!Q)return!1;let I=JSON.parse(atob(Q));if("typ"in I&&I?.typ!=="JWT")return!1;if(!I.alg)return!1;if(Y&&(!("alg"in I)||I.alg!==Y))return!1;return!0}catch{return!1}}function Ls($,Y,U){if($.issues.length)Y.issues.push(...m8(U,$.issues));Y.value[U]=$.value}function dV($,Y,U,Q,I,J){let K=U in Q;if($.issues.length){if(I&&J&&!K)return;Y.issues.push(...m8(U,$.issues))}if(!K&&!I){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[U]});return}if($.value===void 0){if(K)Y.value[U]=void 0}else Y.value[U]=$.value}function vs($){let Y=Object.keys($.shape);for(let Q of Y)if(!$.shape?.[Q]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${Q}": expected a Zod schema`);let U=tj($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(U)}}function hs($,Y,U,Q,I,J){let K=[],z=I.keySet,H=I.catchall._zod,G=H.def.type,W=H.optin==="optional",X=H.optout==="optional";for(let Z in Y){if(Z==="__proto__")continue;if(z.has(Z))continue;if(G==="never"){K.push(Z);continue}let q=H.run({value:Y[Z],issues:[]},Q);if(q instanceof Promise)$.push(q.then((V)=>dV(V,U,Z,Y,W,X)));else dV(q,U,Z,Y,W,X)}if(K.length)U.issues.push({code:"unrecognized_keys",keys:K,input:Y,inst:J});if(!$.length)return U;return Promise.all($).then(()=>{return U})}function ws($,Y,U,Q){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let I=$.filter((J)=>!N7(J));if(I.length===1)return Y.value=I[0].value,I[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((K)=>h8(K,Q,Y6())))}),Y}function Fs($,Y,U,Q){let I=$.filter((J)=>J.issues.length===0);if(I.length===1)return Y.value=I[0].value,Y;if(I.length===0)Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((K)=>h8(K,Q,Y6())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:[],inclusive:!1});return Y}function QC($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(D7($)&&D7(Y)){let U=Object.keys(Y),Q=Object.keys($).filter((J)=>U.indexOf(J)!==-1),I={...$,...Y};for(let J of Q){let K=QC($[J],Y[J]);if(!K.valid)return{valid:!1,mergeErrorPath:[J,...K.mergeErrorPath]};I[J]=K.data}return{valid:!0,data:I}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let Q=0;Q<$.length;Q++){let I=$[Q],J=Y[Q],K=QC(I,J);if(!K.valid)return{valid:!1,mergeErrorPath:[Q,...K.mergeErrorPath]};U.push(K.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function Ms($,Y,U){let Q=new Map,I;for(let z of Y.issues)if(z.code==="unrecognized_keys"){I??(I=z);for(let H of z.keys){if(!Q.has(H))Q.set(H,{});Q.get(H).l=!0}}else $.issues.push(z);for(let z of U.issues)if(z.code==="unrecognized_keys")for(let H of z.keys){if(!Q.has(H))Q.set(H,{});Q.get(H).r=!0}else $.issues.push(z);let J=[...Q].filter(([,z])=>z.l&&z.r).map(([z])=>z);if(J.length&&I)$.issues.push({...I,keys:J});if(N7($))return $;let K=QC(Y.value,U.value);if(!K.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}function Os($,Y){for(let U=$.length-1;U>=0;U--)if($[U]._zod[Y]!=="optional")return U+1;return 0}function Ds($,Y,U){if($.issues.length)Y.issues.push(...m8(U,$.issues));Y.value[U]=$.value}function Ns($,Y,U,Q,I){for(let J=0;J<U.length;J++){let K=$[J],z=J<Q.length;if(K.issues.length){if(!z&&J>=I){Y.value.length=J;break}Y.issues.push(...m8(J,K.issues))}Y.value[J]=K.value}for(let J=Y.value.length-1;J>=Q.length;J--)if(U[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function Ps($,Y,U,Q,I,J,K){if($.issues.length)if(VH.has(typeof Q))U.issues.push(...m8(Q,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:I,inst:J,issues:$.issues.map((z)=>h8(z,K,Y6()))});if(Y.issues.length)if(VH.has(typeof Q))U.issues.push(...m8(Q,Y.issues));else U.issues.push({origin:"map",code:"invalid_element",input:I,inst:J,key:Q,issues:Y.issues.map((z)=>h8(z,K,Y6()))});U.value.set($.value,Y.value)}function Bs($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function As($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function Ts($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function js($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function cV($,Y,U){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa
Line truncated
|
||||
if (${N}.issues.length) {
|
||||
if (${B} in input) {
|
||||
payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
|
||||
...iss,
|
||||
path: iss.path ? [${P}, ...iss.path] : [${P}]
|
||||
path: iss.path ? [${B}, ...iss.path] : [${B}]
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
if (${D}.value === undefined) {
|
||||
if (${P} in input) {
|
||||
newResult[${P}] = undefined;
|
||||
if (${N}.value === undefined) {
|
||||
if (${B} in input) {
|
||||
newResult[${B}] = undefined;
|
||||
}
|
||||
} else {
|
||||
newResult[${P}] = ${D}.value;
|
||||
newResult[${B}] = ${N}.value;
|
||||
}
|
||||
|
||||
`);else if(!A)q.write(`
|
||||
const ${D}_present = ${P} in input;
|
||||
if (${D}.issues.length) {
|
||||
payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
|
||||
`);else if(!P)q.write(`
|
||||
const ${N}_present = ${B} in input;
|
||||
if (${N}.issues.length) {
|
||||
payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
|
||||
...iss,
|
||||
path: iss.path ? [${P}, ...iss.path] : [${P}]
|
||||
path: iss.path ? [${B}, ...iss.path] : [${B}]
|
||||
})));
|
||||
}
|
||||
if (!${D}_present && !${D}.issues.length) {
|
||||
if (!${N}_present && !${N}.issues.length) {
|
||||
payload.issues.push({
|
||||
code: "invalid_type",
|
||||
expected: "nonoptional",
|
||||
input: undefined,
|
||||
path: [${P}]
|
||||
path: [${B}]
|
||||
});
|
||||
}
|
||||
|
||||
if (${D}_present) {
|
||||
if (${D}.value === undefined) {
|
||||
newResult[${P}] = undefined;
|
||||
if (${N}_present) {
|
||||
if (${N}.value === undefined) {
|
||||
newResult[${B}] = undefined;
|
||||
} else {
|
||||
newResult[${P}] = ${D}.value;
|
||||
newResult[${B}] = ${N}.value;
|
||||
}
|
||||
}
|
||||
|
||||
`);else q.write(`
|
||||
if (${D}.issues.length) {
|
||||
payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
|
||||
if (${N}.issues.length) {
|
||||
payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
|
||||
...iss,
|
||||
path: iss.path ? [${P}, ...iss.path] : [${P}]
|
||||
path: iss.path ? [${B}, ...iss.path] : [${B}]
|
||||
})));
|
||||
}
|
||||
|
||||
if (${D}.value === undefined) {
|
||||
if (${P} in input) {
|
||||
newResult[${P}] = undefined;
|
||||
if (${N}.value === undefined) {
|
||||
if (${B} in input) {
|
||||
newResult[${B}] = undefined;
|
||||
}
|
||||
} else {
|
||||
newResult[${P}] = ${D}.value;
|
||||
newResult[${B}] = ${N}.value;
|
||||
}
|
||||
|
||||
`)}q.write("payload.value = newResult;"),q.write("return payload;");let N=q.compile();return(O,D)=>N(Z,O,D)},J,K=xY,z=!gY.jitless,H=z&&bE.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=Q.value);let V=Z.value;if(!K(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(z&&H&&q?.async===!1&&q.jitless!==!0){if(!J)J=I(Y.shape);if(Z=J(Z,q),!W)return Z;return Bs([],V,Z,q,X,$)}return U(Z,q)}});AG=H0("$ZodUnion",($,Y)=>{V1.init($,Y),C1($._zod,"optin",()=>Y.options.some((Q)=>Q._zod.optin==="optional")?"optional":void 0),C1($._zod,"optout",()=>Y.options.some((Q)=>Q._zod.optout==="optional")?"optional":void 0),C1($._zod,"values",()=>{if(Y.options.every((Q)=>Q._zod.values))return new Set(Y.options.flatMap((Q)=>Array.from(Q._zod.values)));return}),C1($._zod,"pattern",()=>{if(Y.options.every((Q)=>Q._zod.pattern)){let Q=Y.options.map((I)=>I._zod.pattern);return new RegExp(`^(${Q.map((I)=>XG(I.source)).join("|")})$`)}return});let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(Q,I)=>{if(U)return U(Q,I);let J=!1,K=[];for(let z of Y.options){let G=z._zod.run({value:Q.value,issues:[]},I);if(G instanceof Promise)K.push(G),J=!0;else{if(G.issues.length===0)return G;K.push(G)}}if(!J)return zs(K,Q,$,I);return Promise.all(K).then((z)=>{return zs(z,Q,$,I)})}});hC=H0("$ZodXor",($,Y)=>{AG.init($,Y),Y.inclusive=!1;let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(Q,I)=>{if(U)return U(Q,I);let J=!1,K=[];for(let z of Y.options){let G=z._zod.run({value:Q.value,issues:[]},I);if(G instanceof Promise)K.push(G),J=!0;else K.push(G)}if(!J)return Gs(K,Q,$,I);return Promise.all(K).then((z)=>{return Gs(z,Q,$,I)})}}),gC=H0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,AG.init($,Y);let U=$._zod.parse;C1($._zod,"propValues",()=>{let I={};for(let J of Y.options){let K=J._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(J)}"`);for(let[z,G]of Object.entries(K)){if(!I[z])I[z]=new Set;for(let H of G)I[z].add(H)}}return I});let Q=YI(()=>{let I=Y.options,J=new Map;for(let K of I){let z=K._zod.propValues?.[Y.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(K)}"`);for(let G of z){if(J.has(G))throw Error(`Duplicate discriminator value "${String(G)}"`);J.set(G,K)}}return J});$._zod.parse=(I,J)=>{let K=I.value;if(!xY(K))return I.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),I;let z=Q.value.get(K?.[Y.discriminator]);if(z)return z._zod.run(I,J);if(Y.unionFallback||J.direction==="backward")return U(I,J);return I.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(Q.value.keys()),input:K,path:[Y.discriminator],inst:$}),I}}),yC=H0("$ZodIntersection",($,Y)=>{V1.init($,Y),$._zod.parse=(U,Q)=>{let I=U.value,J=Y.left._zod.run({value:I,issues:[]},Q),K=Y.right._zod.run({value:I,issues:[]},Q);if(J instanceof Promise||K instanceof Promise)return Promise.all([J,K]).then(([G,H])=>{return Hs(U,G,H)});return Hs(U,J,K)}});uV=H0("$ZodTuple",($,Y)=>{V1.init($,Y);let U=Y.items;$._zod.parse=(Q,I)=>{let J=Q.value;if(!Array.isArray(J))return Q.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),Q;Q.value=[];let K=[],z=Ws(U,"optin"),G=Ws(U,"optout");if(!Y.rest){if(J.length<z)return Q.issues.push({code:"too_small",minimum:z,inclusive:!0,input:J,inst:$,origin:"array"}),Q;if(J.length>U.length)Q.issues.push({code:"too_big",maximum:U.length,inclusive:!0,input:J,inst:$,origin:"array"})}let H=Array(U.length);for(let W=0;W<U.length;W++){let X=U[W]._zod.run({value:J[W],issues:[]},I);if(X instanceof Promise)K.push(X.then((Z)=>{H[W]=Z}));else H[W]=X}if(Y.rest){let W=U.length-1,X=J.slice(U.length);for(let Z of X){W++;let q=Y.rest._zod.run({value:Z,issues:[]},I);if(q instanceof Promise)K.push(q.then((V)=>Xs(V,Q,W)));else Xs(q,Q,W)}}if(K.length)return Promise.all(K).then(()=>Zs(H,Q,U,J,G));return Zs(H,Q,U,J,G)}});kC=H0("$ZodRecord",($,Y)=>{V1.init($,Y),$._zod.parse=(U,Q)=>{let I=U.value;if(!D7(I))return U.issues.push({expected:"record",code:"invalid_type",input:I,inst:$}),U;let J=[],K=Y.keyType._zod.values;if(K){U.value={};let z=new Set;for(let H of K)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){z.add(typeof H==="number"?H.toString():H);let W=Y.keyType._zod.run({value:H,issues:[]},Q);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){U.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((q)=>S8(q,Q,e4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:I[H],issues:[]},Q);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)U.issues.push(...l8(H,q.issues));U.value[X]=q.value}));else{if(Z.issues.length)U.issues.push(...l8(H,Z.issues));U.value[X]=Z.value}}let G;for(let H in I)if(!z.has(H))G=G??[],G.push(H);if(G&&G.length>0)U.issues.push({code:"unrec
Line truncated
|
||||
`)}q.write("payload.value = newResult;"),q.write("return payload;");let D=q.compile();return(O,N)=>D(Z,O,N)},J,K=xY,z=!gY.jitless,G=z&&rj.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=Q.value);let V=Z.value;if(!K(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(z&&G&&q?.async===!1&&q.jitless!==!0){if(!J)J=I(Y.shape);if(Z=J(Z,q),!W)return Z;return hs([],V,Z,q,X,$)}return U(Z,q)}});AH=W0("$ZodUnion",($,Y)=>{V1.init($,Y),R1($._zod,"optin",()=>Y.options.some((Q)=>Q._zod.optin==="optional")?"optional":void 0),R1($._zod,"optout",()=>Y.options.some((Q)=>Q._zod.optout==="optional")?"optional":void 0),R1($._zod,"values",()=>{if(Y.options.every((Q)=>Q._zod.values))return new Set(Y.options.flatMap((Q)=>Array.from(Q._zod.values)));return}),R1($._zod,"pattern",()=>{if(Y.options.every((Q)=>Q._zod.pattern)){let Q=Y.options.map((I)=>I._zod.pattern);return new RegExp(`^(${Q.map((I)=>qH(I.source)).join("|")})$`)}return});let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(Q,I)=>{if(U)return U(Q,I);let J=!1,K=[];for(let z of Y.options){let H=z._zod.run({value:Q.value,issues:[]},I);if(H instanceof Promise)K.push(H),J=!0;else{if(H.issues.length===0)return H;K.push(H)}}if(!J)return ws(K,Q,$,I);return Promise.all(K).then((z)=>{return ws(z,Q,$,I)})}});cC=W0("$ZodXor",($,Y)=>{AH.init($,Y),Y.inclusive=!1;let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(Q,I)=>{if(U)return U(Q,I);let J=!1,K=[];for(let z of Y.options){let H=z._zod.run({value:Q.value,issues:[]},I);if(H instanceof Promise)K.push(H),J=!0;else K.push(H)}if(!J)return Fs(K,Q,$,I);return Promise.all(K).then((z)=>{return Fs(z,Q,$,I)})}}),nC=W0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,AH.init($,Y);let U=$._zod.parse;R1($._zod,"propValues",()=>{let I={};for(let J of Y.options){let K=J._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(J)}"`);for(let[z,H]of Object.entries(K)){if(!I[z])I[z]=new Set;for(let G of H)I[z].add(G)}}return I});let Q=UI(()=>{let I=Y.options,J=new Map;for(let K of I){let z=K._zod.propValues?.[Y.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(K)}"`);for(let H of z){if(J.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);J.set(H,K)}}return J});$._zod.parse=(I,J)=>{let K=I.value;if(!xY(K))return I.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),I;let z=Q.value.get(K?.[Y.discriminator]);if(z)return z._zod.run(I,J);if(Y.unionFallback||J.direction==="backward")return U(I,J);return I.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(Q.value.keys()),input:K,path:[Y.discriminator],inst:$}),I}}),pC=W0("$ZodIntersection",($,Y)=>{V1.init($,Y),$._zod.parse=(U,Q)=>{let I=U.value,J=Y.left._zod.run({value:I,issues:[]},Q),K=Y.right._zod.run({value:I,issues:[]},Q);if(J instanceof Promise||K instanceof Promise)return Promise.all([J,K]).then(([H,G])=>{return Ms(U,H,G)});return Ms(U,J,K)}});oV=W0("$ZodTuple",($,Y)=>{V1.init($,Y);let U=Y.items;$._zod.parse=(Q,I)=>{let J=Q.value;if(!Array.isArray(J))return Q.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),Q;Q.value=[];let K=[],z=Os(U,"optin"),H=Os(U,"optout");if(!Y.rest){if(J.length<z)return Q.issues.push({code:"too_small",minimum:z,inclusive:!0,input:J,inst:$,origin:"array"}),Q;if(J.length>U.length)Q.issues.push({code:"too_big",maximum:U.length,inclusive:!0,input:J,inst:$,origin:"array"})}let G=Array(U.length);for(let W=0;W<U.length;W++){let X=U[W]._zod.run({value:J[W],issues:[]},I);if(X instanceof Promise)K.push(X.then((Z)=>{G[W]=Z}));else G[W]=X}if(Y.rest){let W=U.length-1,X=J.slice(U.length);for(let Z of X){W++;let q=Y.rest._zod.run({value:Z,issues:[]},I);if(q instanceof Promise)K.push(q.then((V)=>Ds(V,Q,W)));else Ds(q,Q,W)}}if(K.length)return Promise.all(K).then(()=>Ns(G,Q,U,J,H));return Ns(G,Q,U,J,H)}});dC=W0("$ZodRecord",($,Y)=>{V1.init($,Y),$._zod.parse=(U,Q)=>{let I=U.value;if(!D7(I))return U.issues.push({expected:"record",code:"invalid_type",input:I,inst:$}),U;let J=[],K=Y.keyType._zod.values;if(K){U.value={};let z=new Set;for(let G of K)if(typeof G==="string"||typeof G==="number"||typeof G==="symbol"){z.add(typeof G==="number"?G.toString():G);let W=Y.keyType._zod.run({value:G,issues:[]},Q);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){U.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((q)=>h8(q,Q,Y6())),input:G,path:[G],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:I[G],issues:[]},Q);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)U.issues.push(...m8(G,q.issues));U.value[X]=q.value}));else{if(Z.issues.length)U.issues.push(...m8(G,Z.issues));U.value[X]=Z.value}}let H;for(let G in I)if(!z.has(G))H=H??[],H.push(G);if(H&&H.length>0)U.issues.push({code:"unrec
Line truncated
|
||||
|
||||
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let K of $.seen.entries()){let z=K[1];if(Y===K[0]){J(K);continue}if($.external){let H=$.external.registry.get(K[0])?.id;if(Y!==K[0]&&H){J(K);continue}}if($.metadataRegistry.get(K[0])?.id){J(K);continue}if(z.cycle){J(K);continue}if(z.count>1){if($.reused==="ref"){J(K);continue}}}}function j7($,Y){let U=$.seen.get(Y);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let Q=(z)=>{let G=$.seen.get(z);if(G.ref===null)return;let H=G.def??G.schema,W={...H},X=G.ref;if(G.ref=null,X){Q(X);let q=$.seen.get(X),V=q.schema;if(V.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))H.allOf=H.allOf??[],H.allOf.push(V);else Object.assign(H,V);if(Object.assign(H,W),z._zod.parent===X)for(let M in H){if(M==="$ref"||M==="allOf")continue;if(!(M in W))delete H[M]}if(V.$ref&&q.def)for(let M in H){if(M==="$ref"||M==="allOf")continue;if(M in q.def&&JSON.stringify(H[M])===JSON.stringify(q.def[M]))delete H[M]}}let Z=z._zod.parent;if(Z&&Z!==X){Q(Z);let q=$.seen.get(Z);if(q?.schema.$ref){if(H.$ref=q.schema.$ref,q.def)for(let V in H){if(V==="$ref"||V==="allOf")continue;if(V in q.def&&JSON.stringify(H[V])===JSON.stringify(q.def[V]))delete H[V]}}}$.override({zodSchema:z,jsonSchema:H,path:G.path??[]})};for(let z of[...$.seen.entries()].reverse())Q(z[0]);let I={};if($.target==="draft-2020-12")I.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")I.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")I.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let z=$.external.registry.get(Y)?.id;if(!z)throw Error("Schema is missing an `id` property");I.$id=$.external.uri(z)}Object.assign(I,U.def??U.schema);let J=$.metadataRegistry.get(Y)?.id;if(J!==void 0&&I.id===J)delete I.id;let K=$.external?.defs??{};for(let z of $.seen.entries()){let G=z[1];if(G.def&&G.defId){if(G.def.id===G.defId)delete G.def.id;K[G.defId]=G.def}}if($.external);else if(Object.keys(K).length>0)if($.target==="draft-2020-12")I.$defs=K;else I.definitions=K;try{let z=JSON.parse(JSON.stringify(I));return Object.defineProperty(z,"~standard",{value:{...Y["~standard"],jsonSchema:{input:AI(Y,"input",$.processors),output:AI(Y,"output",$.processors)}},enumerable:!1,writable:!1}),z}catch(z){throw Error("Error converting schema to JSON.")}}function g8($,Y){let U=Y??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let Q=$._zod.def;if(Q.type==="transform")return!0;if(Q.type==="array")return g8(Q.element,U);if(Q.type==="set")return g8(Q.valueType,U);if(Q.type==="lazy")return g8(Q.getter(),U);if(Q.type==="promise"||Q.type==="optional"||Q.type==="nonoptional"||Q.type==="nullable"||Q.type==="readonly"||Q.type==="default"||Q.type==="prefault")return g8(Q.innerType,U);if(Q.type==="intersection")return g8(Q.left,U)||g8(Q.right,U);if(Q.type==="record"||Q.type==="map")return g8(Q.keyType,U)||g8(Q.valueType,U);if(Q.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return g8(Q.in,U)||g8(Q.out,U)}if(Q.type==="object"){for(let I in Q.shape)if(g8(Q.shape[I],U))return!0;return!1}if(Q.type==="union"){for(let I of Q.options)if(g8(I,U))return!0;return!1}if(Q.type==="tuple"){for(let I of Q.items)if(g8(I,U))return!0;if(Q.rest&&g8(Q.rest,U))return!0;return!1}return!1}var m_=($,Y={})=>(U)=>{let Q=T7({...U,processors:Y});return H4($,Q),E7(Q,$),j7(Q,$)},AI=($,Y,U={})=>(Q)=>{let{libraryOptions:I,target:J}=Q??{},K=T7({...I??{},target:J,io:Y,processors:U});return H4($,K),E7(K,$),j7(K,$)};var SG=o(()=>{RG()});function nY($,Y){if("_idmap"in $){let Q=$,I=T7({...Y,processors:VL}),J={};for(let G of Q._idmap.entries()){let[H,W]=G;H4(W,I)}let K={},z={registry:Q,uri:Y?.uri,defs:J};I.external=z;for(let G of Q._idmap.entries()){let[H,W]=G;E7(I,W),K[H]=j7(I,W)}if(Object.keys(J).length>0){let G=I.target==="draft-2020-12"?"$defs":"definitions";K.__shared={[G]:J}}return{schemas:K}}let U=T7({...Y,processors:VL});return H4($,U),E7(U,$),j7(U,$)}var Qb0,l_=($,Y,U,Q)=>{let I=U;I.type="string";let{minimum:J,maximum:K,format:z,patterns:G,contentEncoding:H}=$._zod.bag;if(typeof J==="number")I.minLength=J;if(typeof K==="number")I.maxLength=K;if(z){if(I.format=Qb0[z]??z,I.format==="")delete I.format;if(z==="time")delete I.format}if(H)I.contentEncoding=H;if(G&&G.size>0){let W=[...G];if(W.length===1)I.pattern=W[0].source;else if(W.length>1)I.allOf=[...W.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},o_=($,Y,U,Q)=>{let I=U,{minimum:J,maximum:K,format:z,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeof z==="string"&&z.includes("int"))I.type="integer";else I.type="number";let X=typeof W==="number"&&W>=(J??Number.NEGATIVE_INFINITY),Z=typeof H==="number"&&H<=(K??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)I.minimum=W,I.exclusiveMinimum=!0;else I.exclusiveMinimuLine truncated
|
||||
`}function xi0($){let Y=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${$.length})`]};if($.includes(" "))Y.push("Tool name contains spaces, which may cause parsing issues");if($.includes(","))Y.push("Tool name contains commas, which may cause parsing issues");if($.startsWith("-")||$.endsWith("-"))Y.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if($.startsWith(".")||$.endsWith("."))Y.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!ki0.test($)){let U=[...$].filter((Q)=>!/[A-Za-z0-9._-]/.test(Q)).filter((Q,I,J)=>J.indexOf(Q)===I);return Y.push(`Tool name contains invalid characters: ${U.map((Q)=>`"${Q}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function fi0($,Y){if(Y.length>0){console.warn(`Tool name validation warning for "${$}":`);for(let U of Y)console.warn(` - ${U}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function nh($){let Y=xi0($);return fi0($,Y.warnings),Y.isValid}function ui0($){return typeof $==="object"&&$!==null&&"_zod"in $}function bi0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function ii0($){if(typeof $!=="object"||$===null)return!1;if(pI($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((U)=>ui0(U))}function $M($){if($===void 0)return;if(ii0($))return U0($);if(typeof $==="object"&&$!==null&&!pI($)&&Object.values($).some((Y)=>bi0(Y)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!pI($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var wh,Ob0,E1,L1,Nb0,we="2026-07-28",b7,Ne,Bb0,Pb0,Tb0,Be,Pe,jb0,fw,Gc1,Hc1,Je,Th,hb0,gb0,nI,i0,I1,lw,je,lI,ow,xb0=0,fb0="private",ub0,lb0,bw,Rh,_e,Wc1,Xc1,eb0,$i0,_h,iw,jH="2026-07-28",he,Qi0,g$=($)=>eG.safeParse($).success,i7=($)=>$H.safeParse($).success,TH=($)=>SI.safeParse($).success,aw=($)=>hI.safeParse($).success,G3=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",We="x-mcp-header",Ii0,Ji0,Ki0,zi0,dw=-32020,Zc1,Gi0,Xe=!1,Oh="draft-2020-12",Xi0,Fi0,wi0,Ze,Mi0,Pi0,ke=250,Ti0,Ei0,be,ie,ji0,Ci0,ne=60000,_i0,vi0,Si0,de,uh,yi0,qc1,pe=10485760,ih=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??pe}append($){if((this._buffer?.length??0)+$.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){while(this._buffer){let $=this._buffer.indexOf(`
|
||||
`);if($===-1)return null;let Y=this._buffer.toString("utf8",0,$).replace(/\r$/,"");this._buffer=this._buffer.subarray($+1);try{return me(Y)}catch(U){if(U instanceof SyntaxError)continue;throw U}}return null}clear(){this._buffer=void 0}},ki0;var YM=o(()=>{gE();yE();Ue();kS();wh=Symbol.for("mcp.sdk.errorBrands");Ob0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return dI(this,Y)}static isInstance(Y){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return dI(this,Y)}constructor(Y,U,Q){super(U);this.code=Y,this.errorUri=Q,this.name="OAuthError",Dh(this,new.target)}toResponseObject(){let Y={error:this.code,error_description:this.message};if(this.errorUri)Y.error_uri=this.errorUri;return Y}static fromResponse(Y){return new $(Y.error,Y.error_description??Y.error,Y.error_uri)}},E1=function($){return $.NotConnected="NOT_CONNECTED",$.AlreadyConnected="ALREADY_CONNECTED",$.NotInitialized="NOT_INITIALIZED",$.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",$.RequestTimeout="REQUEST_TIMEOUT",$.ConnectionClosed="CONNECTION_CLOSED",$.SendFailed="SEND_FAILED",$.InvalidResult="INVALID_RESULT",$.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",$.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",$.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",$.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",$.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",$.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",$.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",$.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",$.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",$.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",$.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",$}({}),L1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance]($){return dI(this,$)}static isInstance($){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return dI(this,$)}constructor($,Y,U){super(Y);this.code=$,this.data=U,this.name="SdkError",Dh(this,new.target)}},Nb0=class extends L1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,Y,U){super($,Y,U);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};b7=[we];Ne=["task","inputRequests","requestState"];Pb0=new Set(["const","enum","default","examples"]),Tb0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);Be={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Pe={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},jb0={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};Gc1=Object.keys(Be),Hc1=Object.keys(Pe);Je={ok:!1,reason:"not-in-era"};Th={era:"2025-11-25",hasRequestMethod:Te,hasNotificationMethod:Ee,validateRequest:($,Y)=>uw(_b0($),Y),validateResult:($,Y)=>uw(Rb0($),Y),validateNotification:($,Y)=>uw(vb0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Je,validateInputResponse:()=>Je,samplingResultVariant:($,Y)=>{let U=De();return uw($?U.CreateMessageResultWithToolsSchema:U.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let U=Oe($),Q=U.structuredContent;if(Q===void 0)return U;let I=typeof Q!=="object"||Q===null||Array.isArray(Q),J=Y!==void 0&&Ae(Y);if(!I&&!J)return U;return{...U,structuredContent:{result:Q}}},decodeResult($,Y){if(Mh(Y)&&"resultType"in Y){let U={...Y};return delete U.resultType,{kind:"complete",result:ze(U)}}return{kind:"complete",result:ze(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;l
Line truncated
|
||||
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let K of $.seen.entries()){let z=K[1];if(Y===K[0]){J(K);continue}if($.external){let G=$.external.registry.get(K[0])?.id;if(Y!==K[0]&&G){J(K);continue}}if($.metadataRegistry.get(K[0])?.id){J(K);continue}if(z.cycle){J(K);continue}if(z.count>1){if($.reused==="ref"){J(K);continue}}}}function j7($,Y){let U=$.seen.get(Y);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let Q=(z)=>{let H=$.seen.get(z);if(H.ref===null)return;let G=H.def??H.schema,W={...G},X=H.ref;if(H.ref=null,X){Q(X);let q=$.seen.get(X),V=q.schema;if(V.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))G.allOf=G.allOf??[],G.allOf.push(V);else Object.assign(G,V);if(Object.assign(G,W),z._zod.parent===X)for(let M in G){if(M==="$ref"||M==="allOf")continue;if(!(M in W))delete G[M]}if(V.$ref&&q.def)for(let M in G){if(M==="$ref"||M==="allOf")continue;if(M in q.def&&JSON.stringify(G[M])===JSON.stringify(q.def[M]))delete G[M]}}let Z=z._zod.parent;if(Z&&Z!==X){Q(Z);let q=$.seen.get(Z);if(q?.schema.$ref){if(G.$ref=q.schema.$ref,q.def)for(let V in G){if(V==="$ref"||V==="allOf")continue;if(V in q.def&&JSON.stringify(G[V])===JSON.stringify(q.def[V]))delete G[V]}}}$.override({zodSchema:z,jsonSchema:G,path:H.path??[]})};for(let z of[...$.seen.entries()].reverse())Q(z[0]);let I={};if($.target==="draft-2020-12")I.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")I.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")I.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let z=$.external.registry.get(Y)?.id;if(!z)throw Error("Schema is missing an `id` property");I.$id=$.external.uri(z)}Object.assign(I,U.def??U.schema);let J=$.metadataRegistry.get(Y)?.id;if(J!==void 0&&I.id===J)delete I.id;let K=$.external?.defs??{};for(let z of $.seen.entries()){let H=z[1];if(H.def&&H.defId){if(H.def.id===H.defId)delete H.def.id;K[H.defId]=H.def}}if($.external);else if(Object.keys(K).length>0)if($.target==="draft-2020-12")I.$defs=K;else I.definitions=K;try{let z=JSON.parse(JSON.stringify(I));return Object.defineProperty(z,"~standard",{value:{...Y["~standard"],jsonSchema:{input:BI(Y,"input",$.processors),output:BI(Y,"output",$.processors)}},enumerable:!1,writable:!1}),z}catch(z){throw Error("Error converting schema to JSON.")}}function g8($,Y){let U=Y??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let Q=$._zod.def;if(Q.type==="transform")return!0;if(Q.type==="array")return g8(Q.element,U);if(Q.type==="set")return g8(Q.valueType,U);if(Q.type==="lazy")return g8(Q.getter(),U);if(Q.type==="promise"||Q.type==="optional"||Q.type==="nonoptional"||Q.type==="nullable"||Q.type==="readonly"||Q.type==="default"||Q.type==="prefault")return g8(Q.innerType,U);if(Q.type==="intersection")return g8(Q.left,U)||g8(Q.right,U);if(Q.type==="record"||Q.type==="map")return g8(Q.keyType,U)||g8(Q.valueType,U);if(Q.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return g8(Q.in,U)||g8(Q.out,U)}if(Q.type==="object"){for(let I in Q.shape)if(g8(Q.shape[I],U))return!0;return!1}if(Q.type==="union"){for(let I of Q.options)if(g8(I,U))return!0;return!1}if(Q.type==="tuple"){for(let I of Q.items)if(g8(I,U))return!0;if(Q.rest&&g8(Q.rest,U))return!0;return!1}return!1}var Yv=($,Y={})=>(U)=>{let Q=A7({...U,processors:Y});return W4($,Q),T7(Q,$),j7(Q,$)},BI=($,Y,U={})=>(Q)=>{let{libraryOptions:I,target:J}=Q??{},K=A7({...I??{},target:J,io:Y,processors:U});return W4($,K),T7(K,$),j7(K,$)};var gH=o(()=>{vH()});function nY($,Y){if("_idmap"in $){let Q=$,I=A7({...Y,processors:BL}),J={};for(let H of Q._idmap.entries()){let[G,W]=H;W4(W,I)}let K={},z={registry:Q,uri:Y?.uri,defs:J};I.external=z;for(let H of Q._idmap.entries()){let[G,W]=H;T7(I,W),K[G]=j7(I,W)}if(Object.keys(J).length>0){let H=I.target==="draft-2020-12"?"$defs":"definitions";K.__shared={[H]:J}}return{schemas:K}}let U=A7({...Y,processors:BL});return W4($,U),T7(U,$),j7(U,$)}var Vb0,Uv=($,Y,U,Q)=>{let I=U;I.type="string";let{minimum:J,maximum:K,format:z,patterns:H,contentEncoding:G}=$._zod.bag;if(typeof J==="number")I.minLength=J;if(typeof K==="number")I.maxLength=K;if(z){if(I.format=Vb0[z]??z,I.format==="")delete I.format;if(z==="time")delete I.format}if(G)I.contentEncoding=G;if(H&&H.size>0){let W=[...H];if(W.length===1)I.pattern=W[0].source;else if(W.length>1)I.allOf=[...W.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},Qv=($,Y,U,Q)=>{let I=U,{minimum:J,maximum:K,format:z,multipleOf:H,exclusiveMaximum:G,exclusiveMinimum:W}=$._zod.bag;if(typeof z==="string"&&z.includes("int"))I.type="integer";else I.type="number";let X=typeof W==="number"&&W>=(J??Number.NEGATIVE_INFINITY),Z=typeof G==="number"&&G<=(K??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)I.minimum=W,I.exclusiveMinimum=!0;else I.exclusiveMinimuLine truncated
|
||||
`}function oi0($){let Y=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${$.length})`]};if($.includes(" "))Y.push("Tool name contains spaces, which may cause parsing issues");if($.includes(","))Y.push("Tool name contains commas, which may cause parsing issues");if($.startsWith("-")||$.endsWith("-"))Y.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if($.startsWith(".")||$.endsWith("."))Y.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!li0.test($)){let U=[...$].filter((Q)=>!/[A-Za-z0-9._-]/.test(Q)).filter((Q,I,J)=>J.indexOf(Q)===I);return Y.push(`Tool name contains invalid characters: ${U.map((Q)=>`"${Q}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function ri0($,Y){if(Y.length>0){console.warn(`Tool name validation warning for "${$}":`);for(let U of Y)console.warn(` - ${U}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function tS($){let Y=oi0($);return ri0($,Y.warnings),Y.isValid}function si0($){return typeof $==="object"&&$!==null&&"_zod"in $}function ai0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function ti0($){if(typeof $!=="object"||$===null)return!1;if(mI($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((U)=>si0(U))}function GM($){if($===void 0)return;if(ti0($))return Q0($);if(typeof $==="object"&&$!==null&&!mI($)&&Object.values($).some((Y)=>ai0(Y)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!mI($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var jS,_b0,T1,L1,vb0,je="2026-07-28",u7,Re,gb0,yb0,kb0,he,Se,fb0,lF,Yn1,Un1,Ve,gS,pb0,db0,pI,i0,I1,UM,ke,oI,QM,ob0=0,rb0="private",sb0,Ii0,rF,fS,ue,Qn1,In1,Wi0,Xi0,uS,sF,RG="2026-07-28",ce,Vi0,y$=($)=>YG.safeParse($).success,b7=($)=>UG.safeParse($).success,EG=($)=>SI.safeParse($).success,zM=($)=>gI.safeParse($).success,z3=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",Oe="x-mcp-header",Li0,wi0,Fi0,Mi0,eF=-32020,Jn1,Oi0,De=!1,CS="draft-2020-12",Pi0,Ei0,Ci0,Ne,Ri0,yi0,de=250,ki0,xi0,re,se,fi0,ui0,te=60000,ii0,ci0,ni0,ee,oS,mi0,Kn1,$00=10485760,sS=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??$00}append($){if((this._buffer?.length??0)+$.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){while(this._buffer){let $=this._buffer.indexOf(`
|
||||
`);if($===-1)return null;let Y=this._buffer.toString("utf8",0,$).replace(/\r$/,"");this._buffer=this._buffer.subarray($+1);try{return Y00(Y)}catch(U){if(U instanceof SyntaxError)continue;throw U}}return null}clear(){this._buffer=void 0}},li0;var WM=o(()=>{nj();pj();Xe();dh();jS=Symbol.for("mcp.sdk.errorBrands");_b0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return dI(this,Y)}static isInstance(Y){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return dI(this,Y)}constructor(Y,U,Q){super(U);this.code=Y,this.errorUri=Q,this.name="OAuthError",_S(this,new.target)}toResponseObject(){let Y={error:this.code,error_description:this.message};if(this.errorUri)Y.error_uri=this.errorUri;return Y}static fromResponse(Y){return new $(Y.error,Y.error_description??Y.error,Y.error_uri)}},T1=function($){return $.NotConnected="NOT_CONNECTED",$.AlreadyConnected="ALREADY_CONNECTED",$.NotInitialized="NOT_INITIALIZED",$.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",$.RequestTimeout="REQUEST_TIMEOUT",$.ConnectionClosed="CONNECTION_CLOSED",$.SendFailed="SEND_FAILED",$.InvalidResult="INVALID_RESULT",$.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",$.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",$.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",$.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",$.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",$.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",$.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",$.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",$.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",$.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",$.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",$}({}),L1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance]($){return dI(this,$)}static isInstance($){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return dI(this,$)}constructor($,Y,U){super(Y);this.code=$,this.data=U,this.name="SdkError",_S(this,new.target)}},vb0=class extends L1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,Y,U){super($,Y,U);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};u7=[je];Re=["task","inputRequests","requestState"];yb0=new Set(["const","enum","default","examples"]),kb0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);he={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Se={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},fb0={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};Yn1=Object.keys(he),Un1=Object.keys(Se);Ve={ok:!1,reason:"not-in-era"};gS={era:"2025-11-25",hasRequestMethod:ge,hasNotificationMethod:ye,validateRequest:($,Y)=>oF(ib0($),Y),validateResult:($,Y)=>oF(bb0($),Y),validateNotification:($,Y)=>oF(cb0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ve,validateInputResponse:()=>Ve,samplingResultVariant:($,Y)=>{let U=_e();return oF($?U.CreateMessageResultWithToolsSchema:U.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let U=Ce($),Q=U.structuredContent;if(Q===void 0)return U;let I=typeof Q!=="object"||Q===null||Array.isArray(Q),J=Y!==void 0&&ve(Y);if(!I&&!J)return U;return{...U,structuredContent:{result:Q}}},decodeResult($,Y){if(ES(Y)&&"resultType"in Y){let U={...Y};return delete U.resultType,{kind:"complete",result:we(U)}}return{kind:"complete",result:we(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;
Line truncated
|
||||
* content-type
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/yi0=_0(($)=>{var Y=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,U=/\\([\u000b\u0020-\u00ff])/g,Q=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;$.parse=I;function I(z){if(!z)throw TypeError("argument string is required");var G=typeof z==="object"?J(z):z;if(typeof G!=="string")throw TypeError("argument string is required to be a string");var H=G.indexOf(";"),W=H!==-1?G.slice(0,H).trim():G.trim();if(!Q.test(W))throw TypeError("invalid media type");var X=new K(W.toLowerCase());if(H!==-1){var Z,q,V;Y.lastIndex=H;while(q=Y.exec(G)){if(q.index!==H)throw TypeError("invalid parameter format");if(H+=q[0].length,Z=q[1].toLowerCase(),V=q[2],V.charCodeAt(0)===34){if(V=V.slice(1,-1),V.indexOf("\\")!==-1)V=V.replace(U,"$1")}X.parameters[Z]=V}if(H!==G.length)throw TypeError("invalid parameter format")}return X}function J(z){var G;if(typeof z.getHeader==="function")G=z.getHeader("content-type");else if(typeof z.headers==="object")G=z.headers&&z.headers["content-type"];if(typeof G!=="string")throw TypeError("content-type header is missing from object");return G}function K(z){this.parameters=Object.create(null),this.type=z}}),qc1=VV(yi0(),1);ki0=/^[A-Za-z0-9._-]{1,128}$/});function dh($){let Y=new $({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Qn0(Y),Y}var UM,le,F1,S1,w5,IM,ci0,oe,re,QM,ni0,M5,di0,pi0,se,mi0,JM,oI,RH,rI,KM,li0,te,oi0,ri0,si0,ph,ti0,mh,ae,ai0,ei0,$c0,Yc0,Uc0,Qc0,Ic0,Jc0,lh,Kc0,zc0,Gc0,ee,$00,Y00,Hc0,Wc0,Xc0,oh,Zc0,U00,qc0,Vc0,Lc0,Fc0,wc0,Mc0,Oc0,Nc0,Q00,Dc0,I00,J00,K00,Ac0,rh,Bc0,z00,G00,H00,Pc0,Tc0,W00,Ec0,jc0,Cc0,X00,Rc0,_c0,Z00,vc0,Sc0,hc0,gc0,yc0,kc0,xc0,fc0,uc0,bc0,ic0,cc0,nc0,dc0,pc0,mc0,lc0,oc0,rc0,sc0,tc0,ac0,ec0,q00,$n0,Yn0,Un0,Qn0,zM=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor($){this._userAjv=$!==void 0,this._ajv=$}get ajv(){return this._ajv??=dh(Yn0.Ajv2020)}_engineFor($){if(this._userAjv)return this.ajv;let Y=mr($,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(Y==="2020-12")return this.ajv;if(Y==="2019-09")return this._ajv2019??=dh($n0.Ajv2019);return this._ajvDraft7??=dh(q00.Ajv)}getValidator($){let Y=this._engineFor($),U="$id"in $&&typeof $.$id==="string"?Y.getSchema($.$id)??Y.compile($):Y.compile($);return(Q)=>{return U(Q)?{valid:!0,data:Q,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Y.errorsText(U.errors)}}}},Tc1;var V00=o(()=>{gE();yE();UM=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.regexpCode=$.getEsmExportName=$.getProperty=$.safeStringify=$.stringify=$.strConcat=$.addCodeArg=$.str=$._=$.nil=$._Code=$.Name=$.IDENTIFIER=$._CodeOrName=void 0;var Y=class{};$._CodeOrName=Y,$.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var U=class extends Y{constructor(F){super();if(!$.IDENTIFIER.test(F))throw Error("CodeGen: name must be a valid identifier");this.str=F}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};$.Name=U;var Q=class extends Y{constructor(F){super();this._items=typeof F==="string"?[F]:F}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let F=this._items[0];return F===""||F==='""'}get str(){var F;return(F=this._str)!==null&&F!==void 0?F:this._str=this._items.reduce((N,O)=>`${N}${O}`,"")}get names(){var F;return(F=this._names)!==null&&F!==void 0?F:this._names=this._items.reduce((N,O)=>{if(O instanceof U)N[O.str]=(N[O.str]||0)+1;return N},{})}};$._Code=Q,$.nil=new Q("");function I(F,...N){let O=[F[0]],D=0;while(D<N.length)z(O,N[D]),O.push(F[++D]);return new Q(O)}$._=I;let J=new Q("+");function K(F,...N){let O=[q(F[0])],D=0;while(D<N.length)O.push(J),z(O,N[D]),O.push(J,q(F[++D]));return G(O),new Q(O)}$.str=K;function z(F,N){if(N instanceof Q)F.push(...N._items);else if(N instanceof U)F.push(N);else F.push(X(N))}$.addCodeArg=z;function G(F){let N=1;while(N<F.length-1){if(F[N]===J){let O=H(F[N-1],F[N+1]);if(O!==void 0){F.splice(N-1,3,O);continue}F[N++]="+"}N++}}function H(F,N){if(N==='""')return F;if(F==='""')return N;if(typeof F=="string"){if(N instanceof U||F[F.length-1]!=='"')return;if(typeof N!="string")return`${F.slice(0,-1)}${N}"`;if(N[0]==='"')return F.slice(0,-1)+N.slice(1);return}if(typeof N=="string"&&N[0]==='"'&&!(F instanceof U))return`"${F}${N.slice(1)}`}function W(F,N){return N.emptyStr()?F:F.emptyStr()?N:K`${F}${N}`}$.strConcat=W;function X(F){return typeof F=="number"||typeof F=="boolean"||F===null?F:q(Array.isArray(F)?F.join(","):F)}function Z(F){return new Q(q(F))}$.stringify=Z;function q(F){return JSON.stringify(F).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}$.safeStringify=q;function V(F){return typeof F=="string"&&$.IDENTIFIER.test(F)?new Q(`.${F}`):I`[${F}]`}$.getProperty=V;function w(F){if(typeof F=="string"&&$.IDENTIFIER.test(F))return new Q(`${F}`);throw Error(`CodeGen: invalid export name: ${F}, use explicit $id name mapping`)}$.getEsmExportName=w;function M(F){return
Line truncated
|
||||
`:""},this._extScope=y,this._scope=new U.Scope({parent:y}),this._nodes=[new w]}toString(){return this._root.render(this.opts)}name(y){return this._scope.name(y)}scopeName(y){return this._extScope.name(y)}scopeValue(y,c){let e=this._extScope.value(y,c);return(this._values[e.prefix]||(this._values[e.prefix]=new Set)).add(e),e}getScopeValue(y,c){return this._extScope.getValue(y,c)}scopeRefs(y){return this._extScope.scopeRefs(y,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(y,c,e,V0){let j0=this._scope.toName(c);if(e!==void 0&&V0)this._constants[j0.str]=e;return this._leafNode(new K(y,j0,e)),j0}const(y,c,e){return this._def(U.varKinds.const,y,c,e)}let(y,c,e){return this._def(U.varKinds.let,y,c,e)}var(y,c,e){return this._def(U.varKinds.var,y,c,e)}assign(y,c,e){return this._leafNode(new z(y,c,e))}add(y,c){return this._leafNode(new G(y,$.operators.ADD,c))}code(y){if(typeof y=="function")y();else if(y!==Y.nil)this._leafNode(new Z(y));return this}object(...y){let c=["{"];for(let[e,V0]of y){if(c.length>1)c.push(",");if(c.push(e),e!==V0||this.opts.es5)c.push(":"),(0,Y.addCodeArg)(c,V0)}return c.push("}"),new Y._Code(c)}if(y,c,e){if(this._blockNode(new F(y)),c&&e)this.code(c).else().code(e).endIf();else if(c)this.code(c).endIf();else if(e)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(y){return this._elseNode(new F(y))}else(){return this._elseNode(new M)}endIf(){return this._endBlockNode(F,M)}_for(y,c){if(this._blockNode(y),c)this.code(c).endFor();return this}for(y,c){return this._for(new O(y),c)}forRange(y,c,e,V0,j0=this.opts.es5?U.varKinds.var:U.varKinds.let){let A0=this._scope.toName(y);return this._for(new D(j0,A0,c,e),()=>V0(A0))}forOf(y,c,e,V0=U.varKinds.const){let j0=this._scope.toName(y);if(this.opts.es5){let A0=c instanceof Y.Name?c:this.var("_arr",c);return this.forRange("_i",0,Y._`${A0}.length`,(R0)=>{this.var(j0,Y._`${A0}[${R0}]`),e(j0)})}return this._for(new P("of",V0,j0,c),()=>e(j0))}forIn(y,c,e,V0=this.opts.es5?U.varKinds.var:U.varKinds.const){if(this.opts.ownProperties)return this.forOf(y,Y._`Object.keys(${c})`,e);let j0=this._scope.toName(y);return this._for(new P("in",V0,j0,c),()=>e(j0))}endFor(){return this._endBlockNode(N)}label(y){return this._leafNode(new H(y))}break(y){return this._leafNode(new W(y))}return(y){let c=new A;if(this._blockNode(c),this.code(y),c.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(A)}try(y,c,e){if(!c&&!e)throw Error('CodeGen: "try" without "catch" and "finally"');let V0=new E;if(this._blockNode(V0),this.code(y),c){let j0=this.name("e");this._currNode=V0.catch=new C(j0),c(j0)}if(e)this._currNode=V0.finally=new i,this.code(e);return this._endBlockNode(C,i)}throw(y){return this._leafNode(new X(y))}block(y,c){if(this._blockStarts.push(this._nodes.length),y)this.code(y).endBlock(c);return this}endBlock(y){let c=this._blockStarts.pop();if(c===void 0)throw Error("CodeGen: not in self-balancing block");let e=this._nodes.length-c;if(e<0||y!==void 0&&e!==y)throw Error(`CodeGen: wrong number of nodes: ${e} vs ${y} expected`);return this._nodes.length=c,this}func(y,c=Y.nil,e,V0){if(this._blockNode(new T(y,c,e)),V0)this.code(V0).endFunc();return this}endFunc(){return this._endBlockNode(T)}optimize(y=1){while(y-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(y){return this._currNode.nodes.push(y),this}_blockNode(y){this._currNode.nodes.push(y),this._nodes.push(y)}_endBlockNode(y,c){let e=this._currNode;if(e instanceof y||c&&e instanceof c)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${c?`${y.kind}/${c.kind}`:y.kind}"`)}_elseNode(y){let c=this._currNode;if(!(c instanceof F))throw Error('CodeGen: "else" without "if"');return this._currNode=c.else=y,this}get _root(){return this._nodes[0]}get _currNode(){let y=this._nodes;return y[y.length-1]}set _currNode(y){let c=this._nodes;c[c.length-1]=y}};$.CodeGen=x;function h(y,c){for(let e in c)y[e]=(y[e]||0)+(c[e]||0);return y}function b(y,c){return c instanceof Y._CodeOrName?h(y,c.names):y}function n(y,c,e){if(y instanceof Y.Name)return V0(y);if(!j0(y))return y;return new Y._Code(y._items.reduce((A0,R0)=>{if(R0 instanceof Y.Name)R0=V0(R0);if(R0 instanceof Y._Code)A0.push(...R0._items);else A0.push(R0);return A0},[]));function V0(A0){let R0=e[A0.str];if(R0===void 0||c[A0.str]!==1)return A0;return delete c[A0.str],R0}function j0(A0){return A0 instanceof Y._Code&&A0._items.some((R0)=>R0 instanceof Y.Name&&c[R0.str]===1&&e[R0.str]!==void 0)}}function Q0(y,c){for(let e in c)y[e]=(y[e]||0)-(c[e]||0)}function k(y){return typeof y=="boolean"||typeof y=="number"||y===null?!y:Y._`!${Y0(y)}`}$.not=k;let m=p($.operators.AND);function a(...y){return y.reduce(m)}$.and=a;let $0=p($.operators.OR);function g(...y){return y.reduce($0)}$.or=g;function p(y){return(c,e)=>c===Y.nil?e:e===Y.nil?c:Y._`${Y0(c)} ${y} ${Y0(e)}`}function Y0(y){return y instanceof Y.Name?y:Y._`(${y})`}}),S1=_0((
Line truncated
|
||||
|| (${C} == "string" && ${A} && ${A} == +${A})`).assign(i,I._`+${A}`);return;case"integer":T.elseIf(I._`${C} === "boolean" || ${A} === null
|
||||
|| (${C} === "string" && ${A} && ${A} == +${A} && !(${A} % 1))`).assign(i,I._`+${A}`);return;case"boolean":T.elseIf(I._`${A} === "false" || ${A} === 0 || ${A} === null`).assign(i,!1).elseIf(I._`${A} === "true" || ${A} === 1`).assign(i,!0);return;case"null":T.elseIf(I._`${A} === "" || ${A} === 0 || ${A} === false`),T.assign(i,null);return;case"array":T.elseIf(I._`${C} === "string" || ${C} === "number"
|
||||
|| ${C} === "boolean" || ${A} === null`).assign(i,I._`[${A}]`)}}}function q({gen:O,parentData:D,parentDataProperty:P},T){O.if(I._`${D} !== undefined`,()=>O.assign(I._`${D}[${P}]`,T))}function V(O,D,P,T=K.Correct){let A=T===K.Correct?I.operators.EQ:I.operators.NEQ,E;switch(O){case"null":return I._`${D} ${A} null`;case"array":E=I._`Array.isArray(${D})`;break;case"object":E=I._`${D} && typeof ${D} == "object" && !Array.isArray(${D})`;break;case"integer":E=C(I._`!(${D} % 1) && !isNaN(${D})`);break;case"number":E=C();break;default:return I._`typeof ${D} ${A} ${O}`}return T===K.Correct?E:(0,I.not)(E);function C(i=I.nil){return(0,I.and)(I._`typeof ${D} == "number"`,i,P?I._`isFinite(${D})`:I.nil)}}$.checkDataType=V;function w(O,D,P,T){if(O.length===1)return V(O[0],D,P,T);let A,E=(0,J.toHash)(O);if(E.array&&E.object){let C=I._`typeof ${D} != "object"`;A=E.null?C:I._`!${D} || ${C}`,delete E.null,delete E.array,delete E.object}else A=I.nil;if(E.number)delete E.integer;for(let C in E)A=(0,I.and)(A,V(C,D,P,T));return A}$.checkDataTypes=w;let M={message:({schema:O})=>`must be ${O}`,params:({schema:O,schemaValue:D})=>typeof O=="string"?I._`{type: ${O}}`:I._`{type: ${D}}`};function F(O){let D=N(O);(0,Q.reportError)(D,M)}$.reportTypeError=F;function N(O){let{gen:D,data:P,schema:T}=O,A=(0,J.schemaRefOrVal)(O,T,"type");return{gen:D,keyword:"type",data:P,schema:T.type,schemaCode:A,schemaValue:A,parentSchema:T,params:{},it:O}}}),ni0=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.assignDefaults=void 0;let Y=F1(),U=S1();function Q(J,K){let{properties:z,items:G}=J.schema;if(K==="object"&&z)for(let H in z)I(J,H,z[H].default);else if(K==="array"&&Array.isArray(G))G.forEach((H,W)=>I(J,W,H.default))}$.assignDefaults=Q;function I(J,K,z){let{gen:G,compositeRule:H,data:W,opts:X}=J;if(z===void 0)return;let Z=Y._`${W}${(0,Y.getProperty)(K)}`;if(H){(0,U.checkStrictMode)(J,`default is ignored for: ${Z}`);return}let q=Y._`${Z} === undefined`;if(X.useDefaults==="empty")q=Y._`${q} || ${Z} === null || ${Z} === ""`;G.if(q,Y._`${Z} = ${(0,Y.stringify)(z)}`)}}),M5=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.validateUnion=$.validateArray=$.usePattern=$.callValidateCode=$.schemaProperties=$.allSchemaProperties=$.noPropertyInData=$.propertyInData=$.isOwnProperty=$.hasPropFunc=$.reportMissingProp=$.checkMissingProp=$.checkReportMissingProp=void 0;let Y=F1(),U=S1(),Q=w5(),I=S1();function J(O,D){let{gen:P,data:T,it:A}=O;P.if(X(P,T,D,A.opts.ownProperties),()=>{O.setParams({missingProperty:Y._`${D}`},!0),O.error()})}$.checkReportMissingProp=J;function K({gen:O,data:D,it:{opts:P}},T,A){return(0,Y.or)(...T.map((E)=>(0,Y.and)(X(O,D,E,P.ownProperties),Y._`${A} = ${E}`)))}$.checkMissingProp=K;function z(O,D){O.setParams({missingProperty:D},!0),O.error()}$.reportMissingProp=z;function G(O){return O.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Y._`Object.prototype.hasOwnProperty`})}$.hasPropFunc=G;function H(O,D,P){return Y._`${G(O)}.call(${D}, ${P})`}$.isOwnProperty=H;function W(O,D,P,T){let A=Y._`${D}${(0,Y.getProperty)(P)} !== undefined`;return T?Y._`${A} && ${H(O,D,P)}`:A}$.propertyInData=W;function X(O,D,P,T){let A=Y._`${D}${(0,Y.getProperty)(P)} === undefined`;return T?(0,Y.or)(A,(0,Y.not)(H(O,D,P))):A}$.noPropertyInData=X;function Z(O){return O?Object.keys(O).filter((D)=>D!=="__proto__"):[]}$.allSchemaProperties=Z;function q(O,D){return Z(D).filter((P)=>!(0,U.alwaysValidSchema)(O,D[P]))}$.schemaProperties=q;function V({schemaCode:O,data:D,it:{gen:P,topSchemaRef:T,schemaPath:A,errorPath:E},it:C},i,x,h){let b=h?Y._`${O}, ${D}, ${T}${A}`:D,n=[[Q.default.instancePath,(0,Y.strConcat)(Q.default.instancePath,E)],[Q.default.parentData,C.parentData],[Q.default.parentDataProperty,C.parentDataProperty],[Q.default.rootData,Q.default.rootData]];if(C.opts.dynamicRef)n.push([Q.default.dynamicAnchors,Q.default.dynamicAnchors]);let Q0=Y._`${b}, ${P.object(...n)}`;return x!==Y.nil?Y._`${i}.call(${x}, ${Q0})`:Y._`${i}(${Q0})`}$.callValidateCode=V;let w=Y._`new RegExp`;function M({gen:O,it:{opts:D}},P){let T=D.unicodeRegExp?"u":"",{regExp:A}=D.code,E=A(P,T);return O.scopeValue("pattern",{key:E.toString(),ref:E,code:Y._`${A.code==="new RegExp"?w:(0,I.useFunc)(O,A)}(${P}, ${T})`})}$.usePattern=M;function F(O){let{gen:D,data:P,keyword:T,it:A}=O,E=D.name("valid");if(A.allErrors){let i=D.let("valid",!0);return C(()=>D.assign(i,!1)),i}return D.var(E,!0),C(()=>D.break()),E;function C(i){let x=D.const("len",Y._`${P}.length`);D.forRange("i",0,x,(h)=>{O.subschema({keyword:T,dataProp:h,dataPropType:U.Type.Num},E),D.if((0,Y.not)(E),i)})}}$.validateArray=F;function N(O){let{gen:D,schema:P,keyword:T,it:A}=O;if(!Array.isArray(P))throw Error("ajv implementation error");if(P.some((i)=>(0,U.alwaysValidSchema)(A,i))&&!A.opts.unevaluated)return;let E=D.let("valid",!1),C=D.name("_valid");D.block(()=>P.forEach((i,x)=>{let h=O.subschema({keyword:T,schemaProp:x,compositeRule:!0},C);if(D.assign(E,Y._`${E} || ${C}`),!O.mergeValidEvaluated(h,C)
Line truncated
|
||||
*/mi0=_0(($)=>{var Y=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,U=/\\([\u000b\u0020-\u00ff])/g,Q=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;$.parse=I;function I(z){if(!z)throw TypeError("argument string is required");var H=typeof z==="object"?J(z):z;if(typeof H!=="string")throw TypeError("argument string is required to be a string");var G=H.indexOf(";"),W=G!==-1?H.slice(0,G).trim():H.trim();if(!Q.test(W))throw TypeError("invalid media type");var X=new K(W.toLowerCase());if(G!==-1){var Z,q,V;Y.lastIndex=G;while(q=Y.exec(H)){if(q.index!==G)throw TypeError("invalid parameter format");if(G+=q[0].length,Z=q[1].toLowerCase(),V=q[2],V.charCodeAt(0)===34){if(V=V.slice(1,-1),V.indexOf("\\")!==-1)V=V.replace(U,"$1")}X.parameters[Z]=V}if(G!==H.length)throw TypeError("invalid parameter format")}return X}function J(z){var H;if(typeof z.getHeader==="function")H=z.getHeader("content-type");else if(typeof z.headers==="object")H=z.headers&&z.headers["content-type"];if(typeof H!=="string")throw TypeError("content-type header is missing from object");return H}function K(z){this.parameters=Object.create(null),this.type=z}}),Kn1=BV(mi0(),1);li0=/^[A-Za-z0-9._-]{1,128}$/});function eS($){let Y=new $({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Vn0(Y),Y}var XM,U00,w1,g1,M5,qM,ei0,Q00,I00,ZM,$c0,O5,Yc0,Uc0,J00,Qc0,VM,rI,vG,sI,LM,Ic0,K00,Jc0,Kc0,zc0,$g,Hc0,Yg,z00,Gc0,Wc0,Xc0,Zc0,qc0,Vc0,Lc0,wc0,Ug,Fc0,Mc0,Oc0,H00,G00,W00,Dc0,Nc0,Pc0,Qg,Bc0,X00,Ac0,Tc0,jc0,Ec0,Cc0,Rc0,_c0,vc0,Z00,hc0,q00,V00,L00,Sc0,Ig,gc0,w00,F00,M00,yc0,kc0,O00,xc0,fc0,uc0,D00,bc0,ic0,N00,cc0,nc0,pc0,dc0,mc0,lc0,oc0,rc0,sc0,ac0,tc0,ec0,$n0,Yn0,Un0,Qn0,In0,Jn0,Kn0,zn0,Hn0,Gn0,Wn0,P00,Xn0,Zn0,qn0,Vn0,wM=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor($){this._userAjv=$!==void 0,this._ajv=$}get ajv(){return this._ajv??=eS(Zn0.Ajv2020)}_engineFor($){if(this._userAjv)return this.ajv;let Y=Ys($,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(Y==="2020-12")return this.ajv;if(Y==="2019-09")return this._ajv2019??=eS(Xn0.Ajv2019);return this._ajvDraft7??=eS(P00.Ajv)}getValidator($){let Y=this._engineFor($),U="$id"in $&&typeof $.$id==="string"?Y.getSchema($.$id)??Y.compile($):Y.compile($);return(Q)=>{return U(Q)?{valid:!0,data:Q,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Y.errorsText(U.errors)}}}},Mn1;var B00=o(()=>{nj();pj();XM=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.regexpCode=$.getEsmExportName=$.getProperty=$.safeStringify=$.stringify=$.strConcat=$.addCodeArg=$.str=$._=$.nil=$._Code=$.Name=$.IDENTIFIER=$._CodeOrName=void 0;var Y=class{};$._CodeOrName=Y,$.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var U=class extends Y{constructor(F){super();if(!$.IDENTIFIER.test(F))throw Error("CodeGen: name must be a valid identifier");this.str=F}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};$.Name=U;var Q=class extends Y{constructor(F){super();this._items=typeof F==="string"?[F]:F}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let F=this._items[0];return F===""||F==='""'}get str(){var F;return(F=this._str)!==null&&F!==void 0?F:this._str=this._items.reduce((D,O)=>`${D}${O}`,"")}get names(){var F;return(F=this._names)!==null&&F!==void 0?F:this._names=this._items.reduce((D,O)=>{if(O instanceof U)D[O.str]=(D[O.str]||0)+1;return D},{})}};$._Code=Q,$.nil=new Q("");function I(F,...D){let O=[F[0]],N=0;while(N<D.length)z(O,D[N]),O.push(F[++N]);return new Q(O)}$._=I;let J=new Q("+");function K(F,...D){let O=[q(F[0])],N=0;while(N<D.length)O.push(J),z(O,D[N]),O.push(J,q(F[++N]));return H(O),new Q(O)}$.str=K;function z(F,D){if(D instanceof Q)F.push(...D._items);else if(D instanceof U)F.push(D);else F.push(X(D))}$.addCodeArg=z;function H(F){let D=1;while(D<F.length-1){if(F[D]===J){let O=G(F[D-1],F[D+1]);if(O!==void 0){F.splice(D-1,3,O);continue}F[D++]="+"}D++}}function G(F,D){if(D==='""')return F;if(F==='""')return D;if(typeof F=="string"){if(D instanceof U||F[F.length-1]!=='"')return;if(typeof D!="string")return`${F.slice(0,-1)}${D}"`;if(D[0]==='"')return F.slice(0,-1)+D.slice(1);return}if(typeof D=="string"&&D[0]==='"'&&!(F instanceof U))return`"${F}${D.slice(1)}`}function W(F,D){return D.emptyStr()?F:F.emptyStr()?D:K`${F}${D}`}$.strConcat=W;function X(F){return typeof F=="number"||typeof F=="boolean"||F===null?F:q(Array.isArray(F)?F.join(","):F)}function Z(F){return new Q(q(F))}$.stringify=Z;function q(F){return JSON.stringify(F).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}$.safeStringify=q;function V(F){return typeof F=="string"&&$.IDENTIFIER.test(F)?new Q(`.${F}`):I`[${F}]`}$.getProperty=V;function w(F){if(typeof F=="string"&&$.IDENTIFIER.test(F))return new Q(`${F}`);throw Error(`CodeGen: invalid export name: ${F}, use explicit $id name mapping`)}$.getEsmExportName=w;function M(F){Line truncated
|
||||
`:""},this._extScope=y,this._scope=new U.Scope({parent:y}),this._nodes=[new w]}toString(){return this._root.render(this.opts)}name(y){return this._scope.name(y)}scopeName(y){return this._extScope.name(y)}scopeValue(y,i){let $0=this._extScope.value(y,i);return(this._values[$0.prefix]||(this._values[$0.prefix]=new Set)).add($0),$0}getScopeValue(y,i){return this._extScope.getValue(y,i)}scopeRefs(y){return this._extScope.scopeRefs(y,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(y,i,$0,V0){let E0=this._scope.toName(i);if($0!==void 0&&V0)this._constants[E0.str]=$0;return this._leafNode(new K(y,E0,$0)),E0}const(y,i,$0){return this._def(U.varKinds.const,y,i,$0)}let(y,i,$0){return this._def(U.varKinds.let,y,i,$0)}var(y,i,$0){return this._def(U.varKinds.var,y,i,$0)}assign(y,i,$0){return this._leafNode(new z(y,i,$0))}add(y,i){return this._leafNode(new H(y,$.operators.ADD,i))}code(y){if(typeof y=="function")y();else if(y!==Y.nil)this._leafNode(new Z(y));return this}object(...y){let i=["{"];for(let[$0,V0]of y){if(i.length>1)i.push(",");if(i.push($0),$0!==V0||this.opts.es5)i.push(":"),(0,Y.addCodeArg)(i,V0)}return i.push("}"),new Y._Code(i)}if(y,i,$0){if(this._blockNode(new F(y)),i&&$0)this.code(i).else().code($0).endIf();else if(i)this.code(i).endIf();else if($0)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(y){return this._elseNode(new F(y))}else(){return this._elseNode(new M)}endIf(){return this._endBlockNode(F,M)}_for(y,i){if(this._blockNode(y),i)this.code(i).endFor();return this}for(y,i){return this._for(new O(y),i)}forRange(y,i,$0,V0,E0=this.opts.es5?U.varKinds.var:U.varKinds.let){let P0=this._scope.toName(y);return this._for(new N(E0,P0,i,$0),()=>V0(P0))}forOf(y,i,$0,V0=U.varKinds.const){let E0=this._scope.toName(y);if(this.opts.es5){let P0=i instanceof Y.Name?i:this.var("_arr",i);return this.forRange("_i",0,Y._`${P0}.length`,(R0)=>{this.var(E0,Y._`${P0}[${R0}]`),$0(E0)})}return this._for(new B("of",V0,E0,i),()=>$0(E0))}forIn(y,i,$0,V0=this.opts.es5?U.varKinds.var:U.varKinds.const){if(this.opts.ownProperties)return this.forOf(y,Y._`Object.keys(${i})`,$0);let E0=this._scope.toName(y);return this._for(new B("in",V0,E0,i),()=>$0(E0))}endFor(){return this._endBlockNode(D)}label(y){return this._leafNode(new G(y))}break(y){return this._leafNode(new W(y))}return(y){let i=new P;if(this._blockNode(i),this.code(y),i.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(P)}try(y,i,$0){if(!i&&!$0)throw Error('CodeGen: "try" without "catch" and "finally"');let V0=new j;if(this._blockNode(V0),this.code(y),i){let E0=this.name("e");this._currNode=V0.catch=new C(E0),i(E0)}if($0)this._currNode=V0.finally=new u,this.code($0);return this._endBlockNode(C,u)}throw(y){return this._leafNode(new X(y))}block(y,i){if(this._blockStarts.push(this._nodes.length),y)this.code(y).endBlock(i);return this}endBlock(y){let i=this._blockStarts.pop();if(i===void 0)throw Error("CodeGen: not in self-balancing block");let $0=this._nodes.length-i;if($0<0||y!==void 0&&$0!==y)throw Error(`CodeGen: wrong number of nodes: ${$0} vs ${y} expected`);return this._nodes.length=i,this}func(y,i=Y.nil,$0,V0){if(this._blockNode(new A(y,i,$0)),V0)this.code(V0).endFunc();return this}endFunc(){return this._endBlockNode(A)}optimize(y=1){while(y-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(y){return this._currNode.nodes.push(y),this}_blockNode(y){this._currNode.nodes.push(y),this._nodes.push(y)}_endBlockNode(y,i){let $0=this._currNode;if($0 instanceof y||i&&$0 instanceof i)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${i?`${y.kind}/${i.kind}`:y.kind}"`)}_elseNode(y){let i=this._currNode;if(!(i instanceof F))throw Error('CodeGen: "else" without "if"');return this._currNode=i.else=y,this}get _root(){return this._nodes[0]}get _currNode(){let y=this._nodes;return y[y.length-1]}set _currNode(y){let i=this._nodes;i[i.length-1]=y}};$.CodeGen=x;function S(y,i){for(let $0 in i)y[$0]=(y[$0]||0)+(i[$0]||0);return y}function b(y,i){return i instanceof Y._CodeOrName?S(y,i.names):y}function n(y,i,$0){if(y instanceof Y.Name)return V0(y);if(!E0(y))return y;return new Y._Code(y._items.reduce((P0,R0)=>{if(R0 instanceof Y.Name)R0=V0(R0);if(R0 instanceof Y._Code)P0.push(...R0._items);else P0.push(R0);return P0},[]));function V0(P0){let R0=$0[P0.str];if(R0===void 0||i[P0.str]!==1)return P0;return delete i[P0.str],R0}function E0(P0){return P0 instanceof Y._Code&&P0._items.some((R0)=>R0 instanceof Y.Name&&i[R0.str]===1&&$0[R0.str]!==void 0)}}function I0(y,i){for(let $0 in i)y[$0]=(y[$0]||0)-(i[$0]||0)}function k(y){return typeof y=="boolean"||typeof y=="number"||y===null?!y:Y._`!${U0(y)}`}$.not=k;let m=d($.operators.AND);function e(...y){return y.reduce(m)}$.and=e;let Y0=d($.operators.OR);function g(...y){return y.reduce(Y0)}$.or=g;function d(y){return(i,$0)=>i===Y.nil?$0:$0===Y.nil?i:Y._`${U0(i)} ${y} ${U0($0)}`}functi
Line truncated
|
||||
|| (${C} == "string" && ${P} && ${P} == +${P})`).assign(u,I._`+${P}`);return;case"integer":A.elseIf(I._`${C} === "boolean" || ${P} === null
|
||||
|| (${C} === "string" && ${P} && ${P} == +${P} && !(${P} % 1))`).assign(u,I._`+${P}`);return;case"boolean":A.elseIf(I._`${P} === "false" || ${P} === 0 || ${P} === null`).assign(u,!1).elseIf(I._`${P} === "true" || ${P} === 1`).assign(u,!0);return;case"null":A.elseIf(I._`${P} === "" || ${P} === 0 || ${P} === false`),A.assign(u,null);return;case"array":A.elseIf(I._`${C} === "string" || ${C} === "number"
|
||||
|| ${C} === "boolean" || ${P} === null`).assign(u,I._`[${P}]`)}}}function q({gen:O,parentData:N,parentDataProperty:B},A){O.if(I._`${N} !== undefined`,()=>O.assign(I._`${N}[${B}]`,A))}function V(O,N,B,A=K.Correct){let P=A===K.Correct?I.operators.EQ:I.operators.NEQ,j;switch(O){case"null":return I._`${N} ${P} null`;case"array":j=I._`Array.isArray(${N})`;break;case"object":j=I._`${N} && typeof ${N} == "object" && !Array.isArray(${N})`;break;case"integer":j=C(I._`!(${N} % 1) && !isNaN(${N})`);break;case"number":j=C();break;default:return I._`typeof ${N} ${P} ${O}`}return A===K.Correct?j:(0,I.not)(j);function C(u=I.nil){return(0,I.and)(I._`typeof ${N} == "number"`,u,B?I._`isFinite(${N})`:I.nil)}}$.checkDataType=V;function w(O,N,B,A){if(O.length===1)return V(O[0],N,B,A);let P,j=(0,J.toHash)(O);if(j.array&&j.object){let C=I._`typeof ${N} != "object"`;P=j.null?C:I._`!${N} || ${C}`,delete j.null,delete j.array,delete j.object}else P=I.nil;if(j.number)delete j.integer;for(let C in j)P=(0,I.and)(P,V(C,N,B,A));return P}$.checkDataTypes=w;let M={message:({schema:O})=>`must be ${O}`,params:({schema:O,schemaValue:N})=>typeof O=="string"?I._`{type: ${O}}`:I._`{type: ${N}}`};function F(O){let N=D(O);(0,Q.reportError)(N,M)}$.reportTypeError=F;function D(O){let{gen:N,data:B,schema:A}=O,P=(0,J.schemaRefOrVal)(O,A,"type");return{gen:N,keyword:"type",data:B,schema:A.type,schemaCode:P,schemaValue:P,parentSchema:A,params:{},it:O}}}),$c0=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.assignDefaults=void 0;let Y=w1(),U=g1();function Q(J,K){let{properties:z,items:H}=J.schema;if(K==="object"&&z)for(let G in z)I(J,G,z[G].default);else if(K==="array"&&Array.isArray(H))H.forEach((G,W)=>I(J,W,G.default))}$.assignDefaults=Q;function I(J,K,z){let{gen:H,compositeRule:G,data:W,opts:X}=J;if(z===void 0)return;let Z=Y._`${W}${(0,Y.getProperty)(K)}`;if(G){(0,U.checkStrictMode)(J,`default is ignored for: ${Z}`);return}let q=Y._`${Z} === undefined`;if(X.useDefaults==="empty")q=Y._`${q} || ${Z} === null || ${Z} === ""`;H.if(q,Y._`${Z} = ${(0,Y.stringify)(z)}`)}}),O5=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.validateUnion=$.validateArray=$.usePattern=$.callValidateCode=$.schemaProperties=$.allSchemaProperties=$.noPropertyInData=$.propertyInData=$.isOwnProperty=$.hasPropFunc=$.reportMissingProp=$.checkMissingProp=$.checkReportMissingProp=void 0;let Y=w1(),U=g1(),Q=M5(),I=g1();function J(O,N){let{gen:B,data:A,it:P}=O;B.if(X(B,A,N,P.opts.ownProperties),()=>{O.setParams({missingProperty:Y._`${N}`},!0),O.error()})}$.checkReportMissingProp=J;function K({gen:O,data:N,it:{opts:B}},A,P){return(0,Y.or)(...A.map((j)=>(0,Y.and)(X(O,N,j,B.ownProperties),Y._`${P} = ${j}`)))}$.checkMissingProp=K;function z(O,N){O.setParams({missingProperty:N},!0),O.error()}$.reportMissingProp=z;function H(O){return O.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Y._`Object.prototype.hasOwnProperty`})}$.hasPropFunc=H;function G(O,N,B){return Y._`${H(O)}.call(${N}, ${B})`}$.isOwnProperty=G;function W(O,N,B,A){let P=Y._`${N}${(0,Y.getProperty)(B)} !== undefined`;return A?Y._`${P} && ${G(O,N,B)}`:P}$.propertyInData=W;function X(O,N,B,A){let P=Y._`${N}${(0,Y.getProperty)(B)} === undefined`;return A?(0,Y.or)(P,(0,Y.not)(G(O,N,B))):P}$.noPropertyInData=X;function Z(O){return O?Object.keys(O).filter((N)=>N!=="__proto__"):[]}$.allSchemaProperties=Z;function q(O,N){return Z(N).filter((B)=>!(0,U.alwaysValidSchema)(O,N[B]))}$.schemaProperties=q;function V({schemaCode:O,data:N,it:{gen:B,topSchemaRef:A,schemaPath:P,errorPath:j},it:C},u,x,S){let b=S?Y._`${O}, ${N}, ${A}${P}`:N,n=[[Q.default.instancePath,(0,Y.strConcat)(Q.default.instancePath,j)],[Q.default.parentData,C.parentData],[Q.default.parentDataProperty,C.parentDataProperty],[Q.default.rootData,Q.default.rootData]];if(C.opts.dynamicRef)n.push([Q.default.dynamicAnchors,Q.default.dynamicAnchors]);let I0=Y._`${b}, ${B.object(...n)}`;return x!==Y.nil?Y._`${u}.call(${x}, ${I0})`:Y._`${u}(${I0})`}$.callValidateCode=V;let w=Y._`new RegExp`;function M({gen:O,it:{opts:N}},B){let A=N.unicodeRegExp?"u":"",{regExp:P}=N.code,j=P(B,A);return O.scopeValue("pattern",{key:j.toString(),ref:j,code:Y._`${P.code==="new RegExp"?w:(0,I.useFunc)(O,P)}(${B}, ${A})`})}$.usePattern=M;function F(O){let{gen:N,data:B,keyword:A,it:P}=O,j=N.name("valid");if(P.allErrors){let u=N.let("valid",!0);return C(()=>N.assign(u,!1)),u}return N.var(j,!0),C(()=>N.break()),j;function C(u){let x=N.const("len",Y._`${B}.length`);N.forRange("i",0,x,(S)=>{O.subschema({keyword:A,dataProp:S,dataPropType:U.Type.Num},j),N.if((0,Y.not)(j),u)})}}$.validateArray=F;function D(O){let{gen:N,schema:B,keyword:A,it:P}=O;if(!Array.isArray(B))throw Error("ajv implementation error");if(B.some((u)=>(0,U.alwaysValidSchema)(P,u))&&!P.opts.unevaluated)return;let j=N.let("valid",!1),C=N.name("_valid");N.block(()=>B.forEach((u,x)=>{let S=O.subschema({keyword:A,schemaProp:x,compositeRule:!0},C);if(N.assign(j,Y._`${j} || ${C}`),!O.mergeValidEvaluated(S,C)
Line truncated
|
||||
missingProperty: ${X},
|
||||
depsCount: ${H},
|
||||
deps: ${W}}`};let I={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[H,W]=J(G);K(G,H),z(G,W)}};function J({schema:G}){let H={},W={};for(let X in G){if(X==="__proto__")continue;let Z=Array.isArray(G[X])?H:W;Z[X]=G[X]}return[H,W]}function K(G,H=G.schema){let{gen:W,data:X,it:Z}=G;if(Object.keys(H).length===0)return;let q=W.let("missing");for(let V in H){let w=H[V];if(w.length===0)continue;let M=(0,Q.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:w.length,deps:w.join(", ")}),Z.allErrors)W.if(M,()=>{for(let F of w)(0,Q.checkReportMissingProp)(G,F)});else W.if(Y._`${M} && (${(0,Q.checkMissingProp)(G,w,q)})`),(0,Q.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=K;function z(G,H=G.schema){let{gen:W,data:X,keyword:Z,it:q}=G,V=W.name("valid");for(let w in H){if((0,U.alwaysValidSchema)(q,H[w]))continue;W.if((0,Q.propertyInData)(W,X,w,q.opts.ownProperties),()=>{let M=G.subschema({keyword:Z,schemaProp:w},V);G.mergeValidEvaluated(M,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=z,$.default=I}),Zc0=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=F1(),U=S1(),Q={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:I})=>Y._`{propertyName: ${I.propertyName}}`},code(I){let{gen:J,schema:K,data:z,it:G}=I;if((0,U.alwaysValidSchema)(G,K))return;let H=J.name("valid");J.forIn("key",z,(W)=>{I.setParams({propertyName:W}),I.subschema({keyword:"propertyNames",data:W,dataTypes:["string"],propertyName:W,compositeRule:!0},H),J.if((0,Y.not)(H),()=>{if(I.error(!0),!G.allErrors)J.break()})}),I.ok(H)}};$.default=Q}),U00=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=M5(),U=F1(),Q=w5(),I=S1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:K})=>U._`{additionalProperty: ${K.additionalProperty}}`},code(K){let{gen:z,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=K;if(!X)throw Error("ajv implementation error");let{allErrors:q,opts:V}=Z;if(Z.props=!0,V.removeAdditional!=="all"&&(0,I.alwaysValidSchema)(Z,G))return;let w=(0,Y.allSchemaProperties)(H.properties),M=(0,Y.allSchemaProperties)(H.patternProperties);F(),K.ok(U._`${X} === ${Q.default.errors}`);function F(){z.forIn("key",W,(T)=>{if(!w.length&&!M.length)D(T);else z.if(N(T),()=>D(T))})}function N(T){let A;if(w.length>8){let E=(0,I.schemaRefOrVal)(Z,H.properties,"properties");A=(0,Y.isOwnProperty)(z,E,T)}else if(w.length)A=(0,U.or)(...w.map((E)=>U._`${T} === ${E}`));else A=U.nil;if(M.length)A=(0,U.or)(A,...M.map((E)=>U._`${(0,Y.usePattern)(K,E)}.test(${T})`));return(0,U.not)(A)}function O(T){z.code(U._`delete ${W}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){O(T);return}if(G===!1){if(K.setParams({additionalProperty:T}),K.error(),!q)z.break();return}if(typeof G=="object"&&!(0,I.alwaysValidSchema)(Z,G)){let A=z.name("valid");if(V.removeAdditional==="failing")P(T,A,!1),z.if((0,U.not)(A),()=>{K.reset(),O(T)});else if(P(T,A),!q)z.if((0,U.not)(A),()=>z.break())}}function P(T,A,E){let C={keyword:"additionalProperties",dataProp:T,dataPropType:I.Type.Str};if(E===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});K.subschema(C,A)}}};$.default=J}),qc0=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=oI(),U=M5(),Q=S1(),I=U00(),J={keyword:"properties",type:"object",schemaType:"object",code(K){let{gen:z,schema:G,parentSchema:H,data:W,it:X}=K;if(X.opts.removeAdditional==="all"&&H.additionalProperties===void 0)I.default.code(new Y.KeywordCxt(X,I.default,"additionalProperties"));let Z=(0,U.allSchemaProperties)(G);for(let F of Z)X.definedProperties.add(F);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=Q.mergeEvaluated.props(z,(0,Q.toHash)(Z),X.props);let q=Z.filter((F)=>!(0,Q.alwaysValidSchema)(X,G[F]));if(q.length===0)return;let V=z.name("valid");for(let F of q){if(w(F))M(F);else{if(z.if((0,U.propertyInData)(z,W,F,X.opts.ownProperties)),M(F),!X.allErrors)z.else().var(V,!0);z.endIf()}K.it.definedProperties.add(F),K.ok(V)}function w(F){return X.opts.useDefaults&&!X.compositeRule&&G[F].default!==void 0}function M(F){K.subschema({keyword:"properties",schemaProp:F,dataProp:F},V)}}};$.default=J}),Vc0=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=M5(),U=F1(),Q=S1(),I=S1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(K){let{gen:z,schema:G,data:H,parentSchema:W,it:X}=K,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((P)=>(0,Q.alwaysValidSchema)(X,G[P]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let w=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,M=z.name("valid");if(X.props!==!0&&!(X.props instanceof U.Name))X.props=(0,I.evaluatedPropsToName)(z,X.props);let{props:F}=X;N();function N(){for(let P of q){if(w)O(P);if(X.allError
Line truncated
|
||||
\x00`,x+=B4(E,2),x+=z.magic,x+=B4(M,2),x+=B4(F,2),x+=B4(A.crc32,4),x+=B4(A.compressedSize,4),x+=B4(A.uncompressedSize,4),x+=B4(H.length,2),x+=B4(N.length,2);var h=lO.LOCAL_FILE_HEADER+x+H+N,b=lO.CENTRAL_FILE_HEADER+B4(i,2)+x+B4(Z.length,2)+"\x00\x00\x00\x00"+B4(C,4)+B4(Q,4)+H+N+Z;return{fileRecord:h,dirRecord:b}},Ft0=function($,Y,U,Q,I){var J="",K=RJ.transformTo("string",I(Q));return J=lO.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+B4($,2)+B4($,2)+B4(Y,4)+B4(U,4)+B4(K.length,2)+K,J},wt0=function($){var Y="";return Y=lO.DATA_DESCRIPTOR+B4($.crc32,4)+B4($.compressedSize,4)+B4($.uncompressedSize,4),Y};function T5($,Y,U,Q){_J.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=U,this.encodeFileName=Q,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}RJ.inherits(T5,_J);T5.prototype.push=function($){var Y=$.meta.percent||0,U=this.entriesCount,Q=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,_J.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:U?(Y+100*(U-Q-1))/U:100}})};T5.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Y=this.streamFiles&&!$.file.dir;if(Y){var U=S90($,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0};T5.prototype.closedSource=function($){this.accumulate=!1;var Y=this.streamFiles&&!$.file.dir,U=S90($,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),Y)this.push({data:wt0($),meta:{percent:100}});else{this.push({data:U.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};T5.prototype.flush=function(){var $=this.bytesWritten;for(var Y=0;Y<this.dirRecords.length;Y++)this.push({data:this.dirRecords[Y],meta:{percent:100}});var U=this.bytesWritten-$,Q=Ft0(this.dirRecords.length,U,$,this.zipComment,this.encodeFileName);this.push({data:Q,meta:{percent:100}})};T5.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};T5.prototype.registerPrevious=function($){this._sources.push($);var Y=this;return $.on("data",function(U){Y.processChunk(U)}),$.on("end",function(){if(Y.closedSource(Y.previous.streamInfo),Y._sources.length)Y.prepareNextSource();else Y.end()}),$.on("error",function(U){Y.error(U)}),this};T5.prototype.resume=function(){if(!_J.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};T5.prototype.error=function($){var Y=this._sources;if(!_J.prototype.error.call(this,$))return!1;for(var U=0;U<Y.length;U++)try{Y[U].error($)}catch(Q){}return!0};T5.prototype.lock=function(){_J.prototype.lock.call(this);var $=this._sources;for(var Y=0;Y<$.length;Y++)$[Y].lock()};h90.exports=T5});var y90=j((Dt0)=>{var Mt0=Pk(),Ot0=g90(),Nt0=function($,Y){var U=$||Y,Q=Mt0[U];if(!Q)throw Error(U+" is not a valid compression method !");return Q};Dt0.generateWorker=function($,Y,U){var Q=new Ot0(Y.streamFiles,U,Y.platform,Y.encodeFileName),I=0;try{$.forEach(function(J,K){I++;var z=Nt0(K.options.compression,Y.compression),G=K.options.compressionOptions||Y.compressionOptions||{},H=K.dir,W=K.date;K._compressWorker(z,G).withStreamInfo("file",{name:J,dir:H,date:W,comment:K.comment||"",unixPermissions:K.unixPermissions,dosPermissions:K.dosPermissions}).pipe(Q)}),Q.entriesCount=I}catch(J){Q.error(J)}return Q}});var x90=j((wo1,k90)=>{var Bt0=m4(),oO=w$();function vW($,Y){oO.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Y)}Bt0.inherits(vW,oO);vW.prototype._bindStream=function($){var Y=this;this._stream=$,$.pause(),$.on("data",function(U){Y.push({data:U,meta:{percent:0}})}).on("error",function(U){if(Y.isPaused)this.generatedError=U;else Y.error(U)}).on("end",function(){if(Y.isPaused)Y._upstreamEnded=!0;else Y.end()})};vW.prototype.pause=function(){if(!oO.prototype.pause.call(this))return!1;return this._stream.pause(),!0};vW.prototype.resume=function(){if(!oO.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};k90.exports=vW});var l90=j((Mo1,m90)=>{var Pt0=OJ(),SW=m4(),i90=w$(),Tt0=_y(),c90=vy(),f90=RO(),Et0=u$0(),jt0=y90(),u90=WW(),Ct0=x90(),n90=function($,Y,U){var Q=SW.getTypeOf(Y),I,J=SW.extend(U||{},c90);if(J.date=J.date||new Date,J.compression!==null)J.compression=J.compression.toUpperCase();if(typeof J.unixPermissions==="string")J.unixPermissions=parseInt(J.unixPermissions,8);if(J.unixPermissions&&J.unixPermissions&16384)J.dir=!0;if(J.dosPermissions&&J.dosPermission
Line truncated
|
||||
`)}openNode($,Y){let U=this.tos,Q=this._xml;if(U&&this.open)Q.push(">");this._stack.push($),Q.push("<"),Q.push($),zx(Q,Y),this.leaf=!0,this.open=!0}addAttribute($,Y){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(Y!==void 0)x70(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");zx(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(k70.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),Y=this._xml;if(this.leaf)Y.push("/>");else Y.push("</"),Y.push($),Y.push(">");this.open=!1,this.leaf=!1}leafNode($,Y,U){if(this.openNode($,Y),U!==void 0)this.writeText(U);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}Gx.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};f70.exports=Gx});var Hx=j((O01)=>{var u70=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function M01($){if(typeof $==="string")return $;if(u70)return u70.decode($);return $.toString()}O01.bufferToString=M01});var d70=j((i70)=>{Object.defineProperty(i70,"__esModule",{value:!0});i70.CHAR=`
|
||||
\r --�\uD800\uDC00-\uDBFF\uDFFF`;i70.S=` \r
|
||||
`;i70.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";i70.NAME_CHAR="-"+i70.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";i70.CHAR_RE=new RegExp("^["+i70.CHAR+"]$","u");i70.S_RE=new RegExp("^["+i70.S+"]+$","u");i70.NAME_START_CHAR_RE=new RegExp("^["+i70.NAME_START_CHAR+"]$","u");i70.NAME_CHAR_RE=new RegExp("^["+i70.NAME_CHAR+"]$","u");i70.NAME_RE=new RegExp("^["+i70.NAME_START_CHAR+"]["+i70.NAME_CHAR+"]*$","u");i70.NMTOKEN_RE=new RegExp("^["+i70.NAME_CHAR+"]+$","u");var Wx=9,Xx=10,Zx=13,qx=32;i70.S_LIST=[qx,Xx,Zx,Wx];function D01($){return $>=qx&&$<=55295||$===Xx||$===Zx||$===Wx||$>=57344&&$<=65533||$>=65536&&$<=1114111}i70.isChar=D01;function A01($){return $===qx||$===Xx||$===Zx||$===Wx}i70.isS=A01;function b70($){return $>=65&&$<=90||$>=97&&$<=122||$===58||$===95||$===8204||$===8205||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}i70.isNameStartChar=b70;function B01($){return b70($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}i70.isNameChar=B01});var $20=j((s70)=>{Object.defineProperty(s70,"__esModule",{value:!0});s70.CHAR="\x01--�\uD800\uDC00-\uDBFF\uDFFF";s70.RESTRICTED_CHAR="\x01-\b\v\f\x0E-\x1F--";s70.S=` \r
|
||||
`;s70.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";s70.NAME_CHAR="-"+s70.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";s70.CHAR_RE=new RegExp("^["+s70.CHAR+"]$","u");s70.RESTRICTED_CHAR_RE=new RegExp("^["+s70.RESTRICTED_CHAR+"]$","u");s70.S_RE=new RegExp("^["+s70.S+"]+$","u");s70.NAME_START_CHAR_RE=new RegExp("^["+s70.NAME_START_CHAR+"]$","u");s70.NAME_CHAR_RE=new RegExp("^["+s70.NAME_CHAR+"]$","u");s70.NAME_RE=new RegExp("^["+s70.NAME_START_CHAR+"]["+s70.NAME_CHAR+"]*$","u");s70.NMTOKEN_RE=new RegExp("^["+s70.NAME_CHAR+"]+$","u");var p70=9,m70=10,l70=13,o70=32;s70.S_LIST=[o70,m70,l70,p70];function y01($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}s70.isChar=y01;function k01($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}s70.isRestrictedChar=k01;function x01($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}s70.isCharAndNotRestricted=x01;function f01($){return $===o70||$===m70||$===l70||$===p70}s70.isS=f01;function r70($){return $>=65&&$<=90||$>=97&&$<=122||$===58||$===95||$===8204||$===8205||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}s70.isNameStartChar=r70;function u01($){return r70($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}s70.isNameChar=u01});var Q20=j((U20)=>{Object.defineProperty(U20,"__esModule",{value:!0});U20.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";U20.NC_NAME_CHAR="-"+U20.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";U20.NC_NAME_START_CHAR_RE=new RegExp("^["+U20.NC_NAME_START_CHAR+"]$","u");U20.NC_NAME_CHAR_RE=new RegExp("^["+U20.NC_NAME_CHAR+"]$","u");U20.NC_NAME_RE=new RegExp("^["+U20.NC_NAME_START_CHAR+"]["+U20.NC_NAME_CHAR+"]*$","u");function Y20($){return $>=65&&$<=90||$===95||$>=97&&$<=122||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8204&&$<=8205||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}U20.isNCNameStartChar=Y20;function $11($){return Y20($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}U20.isNCNameChar=$11});var T20=j((P20)=>{Object.defineProperty(P20,"__esModule",{value:!0});var cJ=d70(),K11=$20(),jx=Q20(),$$=cJ.isS,z11=cJ.isChar,pW=cJ.isNameStartChar,I20=cJ.isNameChar,M20=cJ.S_LIST,G11=cJ.NAME_RE,H11=K11.isChar,W11=jx.isNCNameStartChar,X11=jx.isNCNameChar,Z11=jx.NC_NAME_RE,BN="http://www.w3.org/XML/1998/namespace",iJ="http://www.w3.org/2000/xmlns/",q11={__proto__:null,xml:BN,xmlns:iJ},V11={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},i4=-1,O9=-2,J20=0,L11=1,Lx=2,F11=3,fJ=4,w11=5,M11=6,O11=7,Fx=8,N11=9,D11=10,A11=11,B11=12,f8=13,MN=14,wx=15,P11=16,Mx=17,T11=18,E11=19,Ox=20,j11=21,C11=22,R11=23,K20=24,Nx=25,ON=26,z20=27,_11=28,v11=29,G20=30,S11=31,h11=32,AU=33,g11=34,Dx=35,mW=36,Ax=37,y11=38,H20=39,W20=40,k11=41,X20=42,x11=43,f11=44,Bx=9,j5=10,Px=13,Z20=32,q20=33,O20=34,lW=38,N20=39,NN=45,DN=47,u11=59,H2=60,uJ=61,_6=62,Y8=63,D20=91,bJ=93,V20=133,L20=8232,AN=($)=>$===O20||$===N20,A20=[O20,N20],b11=[...A20,D20,_6],i11=[...A20,H2,bJ],c11=[uJ,Y8,...M20],n11=[...M20,_6,lW,H2];function Ex($,Y,U){switch(Y){case"xml":if(U!==BN)$.fail(`xml prefix must be bound to ${BN}.`);break;case"xmlns":if(U!==iJ)$.fail(`xmlns prefix must be bound to ${iJ}.`);break;default:}switch(U){case iJ:$.fail(Y===""?`the default namespace may not be set to ${U}.`:`may not assign a prefix (even "xmlns") to the URI ${iJ}.`);break;case BN:switch(Y){case"xml":break;case"":$.fail(`the default namespace may not be set to ${U}.`);break;default:$.fail("may not assign the xml namespace to another prefix.")}break;default:}}function d11($,Y){for(let U of Object.keys(Y))Ex($,U,Y[U])}var p11=($)=>Z11.test($),m11=($)=>G11.test($),BU=0,F20=1,Tx=2;P20.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var w20={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};class B20{constructor($){this.opt=$!==null&&$!==void 0?$:{},this.fragmentOpt=!!this.opt.fragment;let Y=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,Y){this.nameStartCheck=W11,this.nameCheck=X11,this.isName=p11,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},q11);let U=this.opt.additionalNamesp
Line truncated
|
||||
`,Y=this.i}}captureToChar($){let{i:Y}=this,{chunk:U}=this;while(!0){let Q=this.getCode();switch(Q){case O9:this.text+=`${U.slice(Y,this.prevI)}
|
||||
`,Y=this.i,Q=j5;break;case i4:return this.text+=U.slice(Y),!1;default:}if(Q===$)return this.text+=U.slice(Y,this.prevI),!0}}captureNameChars(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCode();if(U===i4)return this.name+=$.slice(Y),i4;if(!I20(U))return this.name+=$.slice(Y,this.prevI),U===O9?j5:U}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===i4||!$$($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=z11,this.getCode=this.getCode10;else this.isChar=H11,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=L11}sBeginWhitespace(){let $=this.i,Y=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(Y){case H2:if(this.state=wx,this.text.length!==0)throw Error("no-empty text at start");break;case i4:break;default:this.unget(),this.state=f8,this.xmlDeclPossible=!1}}sDoctype(){var $;let Y=this.captureTo(b11);switch(Y){case _6:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=f8,this.doctype=!0;break}case i4:break;default:if(this.text+=String.fromCodePoint(Y),Y===D20)this.state=fJ;else if(AN(Y))this.state=F11,this.q=Y}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=Lx}sDTD(){let $=this.captureTo(i11);if($===i4)return;if(this.text+=String.fromCodePoint($),$===bJ)this.state=Lx;else if($===H2)this.state=M11;else if(AN($))this.state=w11,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=fJ,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case q20:this.state=O11,this.openWakaBang="";break;case Y8:this.state=A11;break;default:this.state=fJ}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),Y=this.openWakaBang+=$;if(this.text+=$,Y!=="-")this.state=Y==="--"?Fx:fJ,this.openWakaBang=""}sDTDComment(){if(this.captureToChar(NN))this.text+="-",this.state=N11}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===NN?D11:Fx}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===_6)this.state=fJ;else this.fail("malformed comment."),this.state=Fx}sDTDPI(){if(this.captureToChar(Y8))this.text+="?",this.state=B11}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===_6)this.state=fJ}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:Y}=this;$:while(!0)switch(this.getCode()){case O9:this.entity+=`${Y.slice($,this.prevI)}
|
||||
`,$=this.i;break;case u11:{let{entityReturnState:U}=this,Q=this.entity+Y.slice($,this.prevI);this.state=U;let I;if(Q==="")this.fail("empty entity name."),I="&;";else I=this.parseEntity(Q),this.entity="";if(U!==f8||this.textHandler!==void 0)this.text+=I;break $}case i4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(pW($))this.state=g11,this.unget(),this.xmlDeclPossible=!1;else switch($){case DN:this.state=x11,this.xmlDeclPossible=!1;break;case q20:this.state=P11,this.openWakaBang="",this.xmlDeclPossible=!1;break;case Y8:this.state=R11;break;default:this.fail("disallowed character in tag name"),this.state=f8,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0;this.state=Ox,this.openWakaBang="";break;case"--":this.state=Mx,this.openWakaBang="";break;case"DOCTYPE":if(this.state=Lx,this.doctype||this.sawRoot)this.fail("inappropriately located doctype declaration.");this.openWakaBang="";break;default:if(this.openWakaBang.length>=7)this.fail("incorrect syntax.")}}sComment(){if(this.captureToChar(NN))this.state=T11}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===NN)this.state=E11,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=Mx}sCommentEnded(){let $=this.getCodeNorm();if($!==_6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=Mx;else this.state=f8}sCData(){if(this.captureToChar(bJ))this.state=j11}sCDataEnding(){let $=this.getCodeNorm();if($===bJ)this.state=C11;else this.text+=`]${String.fromCodePoint($)}`,this.state=Ox}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case _6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=f8;break}case bJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=Ox}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=K20;else if($===Y8||$$($))this.fail("processing instruction without a target."),this.state=$===Y8?ON:Nx;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=K20}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCodeNorm();if(U===i4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(Y,this.prevI);let Q=U===Y8;if(Q||$$(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=Q?AU:z20}else this.state=Q?ON:Nx;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(U);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===Y8)this.state=ON;else if(!$$($))this.text=String.fromCodePoint($)}else if(this.captureToChar(Y8))this.state=ON}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===_6){let{piTarget:U}=this;if(U.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:U,body:this.text}),this.piTarget=this.text="",this.state=f8}else if(Y===Y8)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=Nx;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===Y8){this.state=AU;return}if($!==i4)this.state=_11,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(c11);if($===Y8){this.state=AU,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!($$($)||$===uJ))return;if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=$===uJ?G20:v11}sXMLDeclEq(){let $=this.getCodeNorm();if($===Y8){this.state=AU,this.fail("XML declaration is incomplete.");return}if($$($))return;if($!==uJ)this.fail("value required.");this.state=G20}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===Y8){this.state=AU,this.fail("XML declaration is incomplete.");return}if($$($))return;if(!AN($))this.fail("value must be quoted."),this.q=Z20;else this.q=$;this.state=S11}sXMLDeclValue(){let $=this.captureTo([this.q,Y8]);if($===Y8){this.state=AU,this.text="",this.fail("XML declaration is incomplete.");return}if($===i4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=Y;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("ver
Line truncated
|
||||
`;$=this.i,Y=BU;break;case i4:if(Q!==void 0)this.text+=U.slice($);break $;default:Y=BU}this.forbiddenState=Y}handleTextOutsideRoot(){let{i:$}=this,{chunk:Y,textHandler:U}=this,Q=!1;$:while(!0){let I=this.getCode();switch(I){case H2:{if(this.state=wx,U!==void 0){let{text:J}=this,K=Y.slice($,this.prevI);if(J.length!==0)U(J+K),this.text="";else if(K.length!==0)U(K)}break $}case lW:if(this.state=MN,this.entityReturnState=f8,U!==void 0)this.text+=Y.slice($,this.prevI);Q=!0;break $;case O9:if(U!==void 0)this.text+=`${Y.slice($,this.prevI)}
|
||||
`;$=this.i;break;case i4:if(U!==void 0)this.text+=Y.slice($);break $;default:if(!$$(I))Q=!0}}if(!Q)return;if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0}pushAttribNS($,Y){var U;let{prefix:Q,local:I}=this.qname($),J={name:$,prefix:Q,local:I,value:Y};if(this.attribList.push(J),(U=this.attributeHandler)===null||U===void 0||U.call(this,J),Q==="xmlns"){let K=Y.trim();if(this.currentXMLVersion==="1.0"&&K==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[I]=K,Ex(this,I,K)}else if($==="xmlns"){let K=Y.trim();this.topNS[""]=K,Ex(this,"",K)}}pushAttribPlain($,Y){var U;let Q={name:$,value:Y};this.attribList.push(Q),(U=this.attributeHandler)===null||U===void 0||U.call(this,Q)}end(){var $,Y;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:U}=this;while(U.length>0){let I=U.pop();this.fail(`unclosed tag: ${I.name}`)}if(this.state!==J20&&this.state!==f8)this.fail("unexpected end.");let{text:Q}=this;if(Q.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,Q),this.text="";return this._closed=!0,(Y=this.endHandler)===null||Y===void 0||Y.call(this),this._init(),this}resolve($){var Y,U;let Q=this.topNS[$];if(Q!==void 0)return Q;let{tags:I}=this;for(let J=I.length-1;J>=0;J--)if(Q=I[J].ns[$],Q!==void 0)return Q;if(Q=this.ns[$],Q!==void 0)return Q;return(U=(Y=this.opt).resolvePrefix)===null||U===void 0?void 0:U.call(Y,$)}qname($){let Y=$.indexOf(":");if(Y===-1)return{prefix:"",local:$};let U=$.slice(Y+1),Q=$.slice(0,Y);if(Q===""||U===""||U.includes(":"))this.fail(`malformed name: ${$}.`);return{prefix:Q,local:U}}processAttribsNS(){var $;let{attribList:Y}=this,U=this.tag;{let{prefix:J,local:K}=this.qname(U.name);U.prefix=J,U.local=K;let z=U.uri=($=this.resolve(J))!==null&&$!==void 0?$:"";if(J!==""){if(J==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(z==="")this.fail(`unbound namespace prefix: ${JSON.stringify(J)}.`),U.uri=J}}if(Y.length===0)return;let{attributes:Q}=U,I=new Set;for(let J of Y){let{name:K,prefix:z,local:G}=J,H,W;if(z==="")H=K==="xmlns"?iJ:"",W=K;else{if(H=this.resolve(z),H===void 0)this.fail(`unbound namespace prefix: ${JSON.stringify(z)}.`),H=z;W=`{${H}}${G}`}if(I.has(W))this.fail(`duplicate attribute: ${W}.`);I.add(W),J.uri=H,Q[K]=J}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,Y=this.tag.attributes;for(let{name:U,value:Q}of $){if(Y[U]!==void 0)this.fail(`duplicate attribute: ${U}.`);Y[U]=Q}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:Y}=this,U=this.tag;U.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,U),Y.push(U),this.state=f8,this.name=""}openSelfClosingTag(){var $,Y,U;this.processAttribs();let{tags:Q}=this,I=this.tag;if(I.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,I),(Y=this.closeTagHandler)===null||Y===void 0||Y.call(this,I),(this.tag=(U=Q[Q.length-1])!==null&&U!==void 0?U:null)===null)this.closedRoot=!0;this.state=f8,this.name=""}closeTag(){let{tags:$,name:Y}=this;if(this.state=f8,this.name="",Y===""){this.fail("weird empty close tag."),this.text+="</>";return}let U=this.closeTagHandler,Q=$.length;while(Q-- >0){let I=this.tag=$.pop();if(this.topNS=I.ns,U===null||U===void 0||U(I),I.name===Y)break;this.fail("unexpected close tag.")}if(Q===0)this.closedRoot=!0;else if(Q<0)this.fail(`unmatched closing tag: ${Y}.`),this.text+=`</${Y}>`}parseEntity($){if($[0]!=="#"){let U=this.ENTITIES[$];if(U!==void 0)return U;return this.fail(this.isName($)?"undefined entity.":"disallowed character in entity name."),`&${$};`}let Y=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))Y=parseInt($.slice(2),16);else if(/^#[0-9]+$/.test($))Y=parseInt($.slice(1),10);if(!this.isChar(Y))return this.fail("malformed character entity."),`&${$};`;return String.fromCodePoint(Y)}}P20.SaxesParser=B20});var oW=j((Yr1,E20)=>{var{SaxesParser:r11}=T20(),{PassThrough:s11}=x8(),{bufferToString:t11}=Hx();E20.exports=async function*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(new s11);let Y=new r11,U;Y.on("error",(I)=>{U=I});let Q=[];Y.on("opentag",(I)=>Q.push({eventType:"opentag",value:I})),Y.on("text",(I)=>Q.push({eventType:"text",value:I})),Y.on("closetag",(I)=>Q.push({eventType:"closetag",value:I}));for await(let I of $){if(Y.write(t11(I)),U)throw U;yield Q,Q=[]}}});var k0=j((Ur1,j20)=>{var a11=oW(),e11=$8();class nJ{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,Y){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($ instanceof nJ)$.reset();else if($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}async parse($){for await(let Y of $)for(let{eventType:U,value:Q}of Y)if(U==="opentag")this.parseOpen(Q);else if(U==="text")this.parseText(Q);else if(U==="closetag"){if(!this.parseClose(Q.name))return thLine truncated
|
||||
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <a:fillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:Line truncated
|
||||
`,this.quote='"',this.escape=this.quote,this.quoteColumns=!1,this.quoteHeaders=this.quoteColumns,this.headers=null,this.includeEndRowDelimiter=!1,this.writeBOM=!1,this.BOM="\uFEFF",this.alwaysWriteHeaders=!1,Object.assign(this,$||{}),typeof($===null||$===void 0?void 0:$.quoteHeaders)>"u")this.quoteHeaders=this.quoteColumns;if(($===null||$===void 0?void 0:$.quote)===!0)this.quote='"';else if(($===null||$===void 0?void 0:$.quote)===!1)this.quote="";if(typeof($===null||$===void 0?void 0:$.escape)!=="string")this.escape=this.quote;this.shouldWriteHeaders=!!this.headers&&((Y=$.writeHeaders)!==null&&Y!==void 0?Y:!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}Qz0.FormatterOptions=Uz0});var UD=j((jt1,Gz0)=>{var H31="[object AsyncFunction]",W31="[object Function]",X31="[object GeneratorFunction]",Z31="[object Null]",q31="[object Proxy]",V31="[object Undefined]",L31=typeof global=="object"&&global&&global.Object===Object&&global,F31=typeof self=="object"&&self&&self.Object===Object&&self,w31=L31||F31||Function("return this")(),Kz0=Object.prototype,M31=Kz0.hasOwnProperty,zz0=Kz0.toString,Jz0=w31.Symbol,_U=Jz0?Jz0.toStringTag:void 0;function O31($){if($==null)return $===void 0?V31:Z31;return _U&&_U in Object($)?N31($):D31($)}function N31($){var Y=M31.call($,_U),U=$[_U];try{$[_U]=void 0;var Q=!0}catch(J){}var I=zz0.call($);if(Q)if(Y)$[_U]=U;else delete $[_U];return I}function D31($){return zz0.call($)}function A31($){if(!B31($))return!1;var Y=O31($);return Y==W31||Y==X31||Y==H31||Y==q31}function B31($){var Y=typeof $;return $!=null&&(Y=="object"||Y=="function")}Gz0.exports=A31});var nz0=j((QD,eJ)=>{var P31=200,tf="__lodash_hash_undefined__",XD=1,Nz0=2,Dz0=9007199254740991,ID="[object Arguments]",df="[object Array]",T31="[object AsyncFunction]",Az0="[object Boolean]",Bz0="[object Date]",Pz0="[object Error]",Tz0="[object Function]",E31="[object GeneratorFunction]",JD="[object Map]",Ez0="[object Number]",j31="[object Null]",aJ="[object Object]",Hz0="[object Promise]",C31="[object Proxy]",jz0="[object RegExp]",KD="[object Set]",Cz0="[object String]",R31="[object Symbol]",_31="[object Undefined]",pf="[object WeakMap]",Rz0="[object ArrayBuffer]",zD="[object DataView]",v31="[object Float32Array]",S31="[object Float64Array]",h31="[object Int8Array]",g31="[object Int16Array]",y31="[object Int32Array]",k31="[object Uint8Array]",x31="[object Uint8ClampedArray]",f31="[object Uint16Array]",u31="[object Uint32Array]",b31=/[\\^$.*+?()[\]{}|]/g,i31=/^\[object .+?Constructor\]$/,c31=/^(?:0|[1-9]\d*)$/,R4={};R4[v31]=R4[S31]=R4[h31]=R4[g31]=R4[y31]=R4[k31]=R4[x31]=R4[f31]=R4[u31]=!0;R4[ID]=R4[df]=R4[Rz0]=R4[Az0]=R4[zD]=R4[Bz0]=R4[Pz0]=R4[Tz0]=R4[JD]=R4[Ez0]=R4[aJ]=R4[jz0]=R4[KD]=R4[Cz0]=R4[pf]=!1;var _z0=typeof global=="object"&&global&&global.Object===Object&&global,n31=typeof self=="object"&&self&&self.Object===Object&&self,T3=_z0||n31||Function("return this")(),vz0=typeof QD=="object"&&QD&&!QD.nodeType&&QD,Wz0=vz0&&typeof eJ=="object"&&eJ&&!eJ.nodeType&&eJ,Sz0=Wz0&&Wz0.exports===vz0,bf=Sz0&&_z0.process,Xz0=function(){try{return bf&&bf.binding&&bf.binding("util")}catch($){}}(),Zz0=Xz0&&Xz0.isTypedArray;function d31($,Y){var U=-1,Q=$==null?0:$.length,I=0,J=[];while(++U<Q){var K=$[U];if(Y(K,U,$))J[I++]=K}return J}function p31($,Y){var U=-1,Q=Y.length,I=$.length;while(++U<Q)$[I+U]=Y[U];return $}function m31($,Y){var U=-1,Q=$==null?0:$.length;while(++U<Q)if(Y($[U],U,$))return!0;return!1}function l31($,Y){var U=-1,Q=Array($);while(++U<$)Q[U]=Y(U);return Q}function o31($){return function(Y){return $(Y)}}function r31($,Y){return $.has(Y)}function s31($,Y){return $==null?void 0:$[Y]}function t31($){var Y=-1,U=Array($.size);return $.forEach(function(Q,I){U[++Y]=[I,Q]}),U}function a31($,Y){return function(U){return $(Y(U))}}function e31($){var Y=-1,U=Array($.size);return $.forEach(function(Q){U[++Y]=Q}),U}var $71=Array.prototype,Y71=Function.prototype,ZD=Object.prototype,cf=T3["__core-js_shared__"],hz0=Y71.toString,D9=ZD.hasOwnProperty,qz0=function(){var $=/[^.]+$/.exec(cf&&cf.keys&&cf.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),gz0=ZD.toString,U71=RegExp("^"+hz0.call(D9).replace(b31,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vz0=Sz0?T3.Buffer:void 0,GD=T3.Symbol,Lz0=T3.Uint8Array,yz0=ZD.propertyIsEnumerable,Q71=$71.splice,vU=GD?GD.toStringTag:void 0,Fz0=Object.getOwnPropertySymbols,I71=Vz0?Vz0.isBuffer:void 0,J71=a31(Object.keys,Object),mf=$K(T3,"DataView"),YX=$K(T3,"Map"),lf=$K(T3,"Promise"),of=$K(T3,"Set"),rf=$K(T3,"WeakMap"),UX=$K(Object,"create"),K71=gU(mf),z71=gU(YX),G71=gU(lf),H71=gU(of),W71=gU(rf),wz0=GD?GD.prototype:void 0,nf=wz0?wz0.valueOf:void 0;function SU($){var Y=-1,U=$==null?0:$.length;this.clear();while(++Y<U){var Q=$[Y];this.set(Q[0],Q[1])}}function X71(){this.__data__=UX?UX(null):{},this.size=0}function Z71($){var Y=this.has($)&&delete this.__data__[$];return this.size-=Y?1:0,Y}function q71($){var Y=this.__data
Line truncated
|
||||
]`;this.ESCAPE_REGEXP=new RegExp(Y)}set headers($){this._headers=$}shouldQuote($,Y){let U=Y?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(O21.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,Y,U){let Q=`${N21.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:I}=this;if(I.quote!==""){if(Q.indexOf(I.quote)!==-1)return this.quoteField(Q.replace(this.REPLACE_REGEXP,I.escapedQuote))}if(Q.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(Y,U))return this.quoteField(Q);return Q}quoteField($){let{quote:Y}=this.formatterOptions;return`${Y}${$}${Y}`}}YK.FieldFormatter=az0});var Uu=j((ez0)=>{Object.defineProperty(ez0,"__esModule",{value:!0});ez0.isSyncTransform=void 0;ez0.isSyncTransform=($)=>$.length===1});var UG0=j((UK)=>{var YG0=UK&&UK.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(UK,"__esModule",{value:!0});UK.RowFormatter=void 0;var A21=YG0(UD()),B21=YG0(nz0()),P21=Yu(),T21=Uu();class yU{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new P21.FieldFormatter($),this.headers=$.headers,this.shouldWriteHeaders=$.shouldWriteHeaders,this.hasWrittenHeaders=!1,this.headers!==null)this.fieldFormatter.headers=this.headers;if($.transform)this.rowTransform=$.transform}static isRowHashArray($){if(Array.isArray($))return Array.isArray($[0])&&$[0].length===2;return!1}static isRowArray($){return Array.isArray($)&&!this.isRowHashArray($)}static gatherHeaders($){if(yU.isRowHashArray($))return $.map((Y)=>Y[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(T21.isSyncTransform($))return(Y,U)=>{let Q=null;try{Q=$(Y)}catch(I){return U(I)}return U(null,Q)};return(Y,U)=>{$(Y,U)}}set rowTransform($){if(!A21.default($))throw TypeError("The transform should be a function");this._rowTransform=yU.createTransform($)}format($,Y){this.callTransformer($,(U,Q)=>{if(U)return Y(U);if(!$)return Y(null);let I=[];if(Q){let{shouldFormatColumns:J,headers:K}=this.checkHeaders(Q);if(this.shouldWriteHeaders&&K&&!this.hasWrittenHeaders)I.push(this.formatColumns(K,!0)),this.hasWrittenHeaders=!0;if(J){let z=this.gatherColumns(Q);I.push(this.formatColumns(z,!1))}}return Y(null,I)})}finish($){let Y=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));Y.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)Y.push(this.formatterOptions.rowDelimiter);return $(null,Y)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let Y=yU.gatherHeaders($);if(this.headers=Y,this.fieldFormatter.headers=Y,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!B21.default(Y,$),headers:Y}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((Y)=>$[Y]);if(yU.isRowHashArray($))return this.headers.map((Y,U)=>{let Q=$[U];if(Q)return Q[1];return""});if(yU.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((Y,U)=>$[U])}callTransformer($,Y){if(!this._rowTransform)return Y(null,$);return this._rowTransform($,Y)}formatColumns($,Y){let U=$.map((I,J)=>this.fieldFormatter.format(I,J,Y)).join(this.formatterOptions.delimiter),{rowCount:Q}=this;if(this.rowCount+=1,Q)return[this.formatterOptions.rowDelimiter,U].join("");return U}}UK.RowFormatter=yU});var QG0=j((LD)=>{Object.defineProperty(LD,"__esModule",{value:!0});LD.FieldFormatter=LD.RowFormatter=void 0;var E21=UG0();Object.defineProperty(LD,"RowFormatter",{enumerable:!0,get:function(){return E21.RowFormatter}});var j21=Yu();Object.defineProperty(LD,"FieldFormatter",{enumerable:!0,get:function(){return j21.FieldFormatter}})});var Qu=j((JG0)=>{Object.defineProperty(JG0,"__esModule",{value:!0});JG0.CsvFormatterStream=void 0;var R21=K0("stream"),_21=QG0();class IG0 extends R21.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new _21.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,Y,U){let Q=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(I,J)=>{if(I)return Q=!0,U(I);if(J)J.forEach((K)=>{this.push(Buffer.from(K,"utf8"))});return Q=!0,U()})}catch(I){if(Q)throw I;U(I)}}_flush($){this.rowFormatter.finish((Y,U)=>{if(Y)return $(Y);if(U)U.forEach((Q)=>{this.push(Buffer.from(Q,"utf8"))});return $()})}}JG0.CsvFormatterStream=IG0});var GG0=j((a1)=>{var zG0=a1&&a1.__createBinding||(Object.create?function($,Y,U,Q){if(Q===void 0)Q=U;Object.defineProperty($,Q,{enumerable:!0,get:function(){return Y[U]}})}:function($,Y,U,Q){if(Q===void 0)Q=U;$[Q]=Y[U]}),v21=a1&&a1.__setModuleDefault||(Object.create?function($,Y){O
Line truncated
|
||||
depsCount: ${G},
|
||||
deps: ${W}}`};let I={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(H){let[G,W]=J(H);K(H,G),z(H,W)}};function J({schema:H}){let G={},W={};for(let X in H){if(X==="__proto__")continue;let Z=Array.isArray(H[X])?G:W;Z[X]=H[X]}return[G,W]}function K(H,G=H.schema){let{gen:W,data:X,it:Z}=H;if(Object.keys(G).length===0)return;let q=W.let("missing");for(let V in G){let w=G[V];if(w.length===0)continue;let M=(0,Q.propertyInData)(W,X,V,Z.opts.ownProperties);if(H.setParams({property:V,depsCount:w.length,deps:w.join(", ")}),Z.allErrors)W.if(M,()=>{for(let F of w)(0,Q.checkReportMissingProp)(H,F)});else W.if(Y._`${M} && (${(0,Q.checkMissingProp)(H,w,q)})`),(0,Q.reportMissingProp)(H,q),W.else()}}$.validatePropertyDeps=K;function z(H,G=H.schema){let{gen:W,data:X,keyword:Z,it:q}=H,V=W.name("valid");for(let w in G){if((0,U.alwaysValidSchema)(q,G[w]))continue;W.if((0,Q.propertyInData)(W,X,w,q.opts.ownProperties),()=>{let M=H.subschema({keyword:Z,schemaProp:w},V);H.mergeValidEvaluated(M,V)},()=>W.var(V,!0)),H.ok(V)}}$.validateSchemaDeps=z,$.default=I}),Bc0=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=w1(),U=g1(),Q={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:I})=>Y._`{propertyName: ${I.propertyName}}`},code(I){let{gen:J,schema:K,data:z,it:H}=I;if((0,U.alwaysValidSchema)(H,K))return;let G=J.name("valid");J.forIn("key",z,(W)=>{I.setParams({propertyName:W}),I.subschema({keyword:"propertyNames",data:W,dataTypes:["string"],propertyName:W,compositeRule:!0},G),J.if((0,Y.not)(G),()=>{if(I.error(!0),!H.allErrors)J.break()})}),I.ok(G)}};$.default=Q}),X00=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=O5(),U=w1(),Q=M5(),I=g1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:K})=>U._`{additionalProperty: ${K.additionalProperty}}`},code(K){let{gen:z,schema:H,parentSchema:G,data:W,errsCount:X,it:Z}=K;if(!X)throw Error("ajv implementation error");let{allErrors:q,opts:V}=Z;if(Z.props=!0,V.removeAdditional!=="all"&&(0,I.alwaysValidSchema)(Z,H))return;let w=(0,Y.allSchemaProperties)(G.properties),M=(0,Y.allSchemaProperties)(G.patternProperties);F(),K.ok(U._`${X} === ${Q.default.errors}`);function F(){z.forIn("key",W,(A)=>{if(!w.length&&!M.length)N(A);else z.if(D(A),()=>N(A))})}function D(A){let P;if(w.length>8){let j=(0,I.schemaRefOrVal)(Z,G.properties,"properties");P=(0,Y.isOwnProperty)(z,j,A)}else if(w.length)P=(0,U.or)(...w.map((j)=>U._`${A} === ${j}`));else P=U.nil;if(M.length)P=(0,U.or)(P,...M.map((j)=>U._`${(0,Y.usePattern)(K,j)}.test(${A})`));return(0,U.not)(P)}function O(A){z.code(U._`delete ${W}[${A}]`)}function N(A){if(V.removeAdditional==="all"||V.removeAdditional&&H===!1){O(A);return}if(H===!1){if(K.setParams({additionalProperty:A}),K.error(),!q)z.break();return}if(typeof H=="object"&&!(0,I.alwaysValidSchema)(Z,H)){let P=z.name("valid");if(V.removeAdditional==="failing")B(A,P,!1),z.if((0,U.not)(P),()=>{K.reset(),O(A)});else if(B(A,P),!q)z.if((0,U.not)(P),()=>z.break())}}function B(A,P,j){let C={keyword:"additionalProperties",dataProp:A,dataPropType:I.Type.Str};if(j===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});K.subschema(C,P)}}};$.default=J}),Ac0=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=rI(),U=O5(),Q=g1(),I=X00(),J={keyword:"properties",type:"object",schemaType:"object",code(K){let{gen:z,schema:H,parentSchema:G,data:W,it:X}=K;if(X.opts.removeAdditional==="all"&&G.additionalProperties===void 0)I.default.code(new Y.KeywordCxt(X,I.default,"additionalProperties"));let Z=(0,U.allSchemaProperties)(H);for(let F of Z)X.definedProperties.add(F);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=Q.mergeEvaluated.props(z,(0,Q.toHash)(Z),X.props);let q=Z.filter((F)=>!(0,Q.alwaysValidSchema)(X,H[F]));if(q.length===0)return;let V=z.name("valid");for(let F of q){if(w(F))M(F);else{if(z.if((0,U.propertyInData)(z,W,F,X.opts.ownProperties)),M(F),!X.allErrors)z.else().var(V,!0);z.endIf()}K.it.definedProperties.add(F),K.ok(V)}function w(F){return X.opts.useDefaults&&!X.compositeRule&&H[F].default!==void 0}function M(F){K.subschema({keyword:"properties",schemaProp:F,dataProp:F},V)}}};$.default=J}),Tc0=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=O5(),U=w1(),Q=g1(),I=g1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(K){let{gen:z,schema:H,data:G,parentSchema:W,it:X}=K,{opts:Z}=X,q=(0,Y.allSchemaProperties)(H),V=q.filter((B)=>(0,Q.alwaysValidSchema)(X,H[B]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let w=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,M=z.name("valid");if(X.props!==!0&&!(X.props instanceof U.Name))X.props=(0,I.evaluatedPropsToName)(z,X.props);let{props:F}=X;D();function D(){for(let B of q){if(w)O(B);if(X.allError
Line truncated
|
||||
`)}function Zp0($){let Y=[];if(Y.push(`seal-use ${$.area} - ${$.title}`),$.description)Y.push($.description);Y.push(""),Y.push("Usage:");let U=new Map;for(let I of $.commands){let J=I.group??"",K=U.get(J)??[];K.push(I),U.set(J,K)}let Q=[...$.groupOrder??[],...[...U.keys()].filter((I)=>!$.groupOrder?.includes(I))];for(let I of Q){let J=U.get(I);if(!J)continue;if(I)Y.push(""),Y.push(`${I}:`);for(let K of J)for(let z of K.usage)Y.push(` ${z}`)}if($.commands.some((I)=>I.name))Y.push(""),Y.push(`Run 'seal-use ${$.area} <command> --help' for details on a specific command.`);return Y.join(`
|
||||
`)}function s00(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of a00)for(let U of Y.commands)for(let Q of U.usage)$.push(` ${Q}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
|
||||
`)}var a00;var Dg=o(()=>{t6();a00=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",groupOrder:["企业接入","发现与选择","企业配置","测试配对与验证","Hose 专属能力"],commands:[{name:"list",group:"发现与选择",summary:"List configured enterprises sorted by 7-day usage frequency",usage:["seal-use corps list [query] [--all] [--limit <n>] [--env <production|test>] [--strict] [--corp <corpId>]"],options:[{flag:"--all",description:"Display all configured enterprises without the default 10-item limit"},{flag:"--limit <n>",description:"Maximum number of enterprises to display (defaults to 10)"},{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}]},{name:"search",aliases:["find"],group:"发现与选择",summary:"Search configured enterprises with intelligent soft fuzzy matching",usage:["seal-use corps search <query> [--env <production|test>] [--strict]"],options:[{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}],description:"Searches enterprise ID, name, staff ID, domain, tenant slug, environment, or bindings. Uses soft search by default (case-insensitive, Chinese homophones, front/back nasal vowels, initials, typo/missing letter tolerance)."},{name:"get",aliases:["show"],group:"发现与选择",summary:"Get rich details and configuration of an enterprise",usage:["seal-use corps get <corpId>"],description:"Retrieves complete enterprise details (URLs, tenant slugs, custom headers/cookies, staff IDs, relations, config file path) with sensitive secrets safely redacted."},{name:"current",group:"发现与选择",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",group:"发现与选择",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",group:"企业配置",summary:"Mark enterprise environment as production or test",usage:["seal-use corps mark <corpId> --env <production|test> [--confirm]"],options:[{flag:"--env <production|test>",description:"Target environment: 'production' or 'test' (required)"},{flag:"--confirm",description:"Confirm the environment update (required)"}],description:"Explicitly updates an enterprise's environment tag. Requires --confirm to prevent accidental changes."},{name:"rename",group:"企业配置",summary:"Rename an enterprise display name",usage:["seal-use corps rename <corpId> --name <newName>"],options:[{flag:"--name <newName>",description:"New human-readable enterprise name (required)"}],description:"Safely updates the display name of a configured enterprise without modifying underlying files manually."},{name:"bind-test",group:"测试配对与验证",summary:"Bind a production enterprise to a test enterprise (1-to-1 association)",usage:["seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]","seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]"],options:[{flag:"--confirm",description:"Explicitly confirm binding and tag test environment (required)"},{flag:"--force",description:"Force re-binding if the production enterprise is already bound"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Establishes a strict 1-to-1 association between a production enterprise and a test enterprise. Automatically marks the test enterprise with environment 'test'."},{name:"unbind-test",group:"测试配对与验证",summary:"Unbind a production and test enterprise association",usage:["seal-use corps unbind-test [<corpId>] [--confirm]"],options:[{flag:"--confirm",description:"Explicitly confirm unbinding both sides (required)"},{flag:"--corp <corpId>",description:"Specify enterprise ID or name"}],description:"Removes the 1-to-1 test association from both the production enterprise and the test enterprise."},{name:"sync-test",group:"测试配对与验证",summary:"Synchronize rules and preferences from production to test enterprise",usage:["seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]"],options:[{flag:"--dry-run",description:"Preview sync diff without making network mutations (default)"},{flag:"--yes",description:"Execute synchronization and publish new rule version on test enterprise"},{flag:"--version-name <name>",description:"Custom version name for published test rule version"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Overwrites test enterprise decision preferences with production preferences, syncs production draft rules to test enterprise, and immediately publishes a new versi
Line truncated
|
||||
`)}
|
||||
`}function C0($,Y={}){Fp0($,Y);let U=`${JSON.stringify($,null,2)}
|
||||
`;if(Y.outputFile){qp0(Y.outputFile,U),console.log(JSON.stringify({outputFile:Y.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function Fp0($,Y={}){if(Y.allowFull||Y.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>wp0)throw new kG(`Output is large (${U} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function Y10($,Y){if(Y)return;let U=$&&typeof $==="object"?$:{},Q=typeof U.count==="number"?U.count:void 0,I=Array.isArray(U.rules)?U.rules.length:void 0,J=Buffer.byteLength(JSON.stringify($),"utf-8"),K=Q??I??0;if(K>Vp0||J>Lp0)throw new kG(`Rule list is large (${K} rules, ${J} bytes). Use "seal-use rules list --summary", "seal-use rules count", or --output-file; pass --full only when you really need full descriptions.`,"seal-use rules list --summary")}function T0($){return{allowFull:J0($.full)===!0,outputFile:R($.outputFile)??R($["output-file"])}}function U10($=[]){console.log(e00($))}var Vp0=100,Lp0=120000,$10,wp0=200000;var t1=o(()=>{L4();t6();Dg();$10=["code","status","strictness","scope","updatedAt"]});var W3;var iG=o(()=>{W3=class W3 extends Error{name="KyError";get isKyError(){return!0}}});var R6;var BM=o(()=>{iG();R6=class R6 extends W3{name="HTTPError";response;request;options;data;constructor($,Y,U){let Q=$.status||$.status===0?$.status:"",I=$.statusText??"",J=`${Q} ${I}`.trim(),K=J?`status code ${J}`:"an unknown error";super(`Request failed with ${K}: ${Y.method} ${Y.url}`);this.response=$,this.request=Y,this.options=U}}});var cG;var Pg=o(()=>{iG();cG=class cG extends W3{name="NetworkError";request;constructor($,Y){super(`Request failed due to a network error: ${$.method} ${$.url}`,Y);this.request=$}}});var nG;var Bg=o(()=>{nG=class nG extends Error{name="NonError";value;constructor($){let Y="Non-error value was thrown";try{if(typeof $==="string")Y=$;else if($&&typeof $==="object"&&"message"in $&&typeof $.message==="string")Y=$.message}catch{}super(Y);this.value=$}}});var $J;var Q10=o(()=>{iG();Bg();$J=class $J extends W3{name="ForceRetryError";customDelay;code;customRequest;constructor($){let Y=$?.cause?$.cause instanceof Error?$.cause:new nG($.cause):void 0;super($?.code?`Forced retry: ${$.code}`:"Forced retry",Y?{cause:Y}:void 0);this.customDelay=$?.delay,this.code=$?.code,this.customRequest=$?.request}}});var Ag;var I10=o(()=>{Ag=class Ag extends Error{name="SchemaValidationError";issues;constructor($){super("Response schema validation failed");this.issues=$}}});var N5;var AM=o(()=>{iG();N5=class N5 extends W3{name="TimeoutError";request;constructor($){super(`Request timed out: ${$.method} ${$.url}`);this.request=$}}});class CM{options;constructor($){this.options=$}}var Tg,J10,TM,K10,z10,jM,Mp0=()=>{return},H10,YJ=2147483647,G10=40,EM,W10=($)=>new CM($),X10,Z10;var YU=o(()=>{Tg=(()=>{let $=!1,Y=!1,U=typeof globalThis.ReadableStream==="function",Q=typeof globalThis.Request==="function";if(U&&Q)try{Y=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type")}catch(I){if(I instanceof Error&&I.message==="unsupported BodyInit type")return!1;throw I}return $&&!Y})(),J10=typeof globalThis.AbortController==="function",TM=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",K10=typeof globalThis.ReadableStream==="function",z10=typeof globalThis.FormData==="function",jM=["get","post","put","patch","head","delete"];Mp0();H10={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},EM=Symbol("stop");X10={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},Z10={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0}});var RM,Op0=($)=>{if(!$)return 0;if($ instanceof FormData){let Y=0;for(let[U,Q]of $)Y+=G10,Y+=RM.encode(`Content-Disposition: form-data; name="${U}"`).byteLength,Y+=typeof Q==="string"?RM.encode(Q).byteLength:Q.size;return Y}if($ instanceof Blob)return $.size;if($ instanceof ArrayBuffer||ArrayBuffer.isView($))return $.byteLength;if(typeof $==="string")return RM.encode($).byteLength;if($ instanceof URLSearchParams)return RM.encode($.toString()).byteLength;return 0},q10=($,Y,U)=>{let Q,I=0;return $.pipeThrough(new TransformStream({transform(J,K){if(K.enqueue(J),Q){I+=Q.byteLength;let z=Y===0?0:I/Y;if(z>=1)z=1-Number.EPSILON;U?.({percent:z,totalBytes:Math.max(Y,I),transferredBytes:I},Q)}Q=J},flush(){if(Q)I+=Q.byteLength,U?.({percent:1,totalBytes:Math.max(Y,I),transferredBytes:I},Q)}}))},V10=($,Y)=>{if(!$.body)return $;let U={status:$.status,statusText:$.statusText,headers:$.headers};if($.status===204)return new Response(null
Line truncated
|
||||
`,{mode:384}),Y}function rg($){let Y=w40();for(let U of Y){if(!w$(U))continue;for(let Q of mM(U).filter((I)=>I.endsWith(".json")).filter((I)=>!I.startsWith("example."))){let I=K9(U,Q);try{let J=oM(I,"utf-8"),K=JSON.parse(J);if(K&&typeof K==="object"&&K.id===$)return I}catch{}}}return}function z9($,Y){let U=rg($);if(!U)throw Error(`Enterprise config not found: ${$}`);let I={...JSON.parse(oM(U,"utf-8")),...Y};for(let K of Object.keys(Y))if(Y[K]===void 0)delete I[K];let J=aG.parse(I);return H40(U,`${JSON.stringify(J,null,2)}
|
||||
`,"utf-8"),J}var og="SEAL_USE_ENTERPRISES_DIR",G40="SEAL_HOME_ENTERPRISES_DIR",W40="SEAL_USE_USER_ENTERPRISES_DIR",X40="SEAL_HOME_USER_ENTERPRISES_DIR",Z40="SEAL_USE_CONFIG_FILE",q40="SEAL_HOME_CONFIG_FILE",HJ,lM,dM,J40,V40,K40,lg;var x$=o(()=>{pM();HJ=K9(rM(),".config","seal-use","enterprises"),lM=K9(rM(),".config","seal-home","enterprises"),dM=K9(rM(),".config","seal-use","config.json"),J40=K9(rM(),".config","seal-home","config.json");V40=[],K40=new Set});function p7($,Y,U=[]){let Q=Y.corpId?.trim()||void 0,I=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=Q??I;if(J){let z=$.find((W)=>W.id===J);if(z)return z;let H=$.find((W)=>W.id.toLowerCase()===J.toLowerCase());if(H)return H;let G=$.find((W)=>W.name.toLowerCase()===J.toLowerCase());if(G)return G;throw Error(`No enterprise config found for ${J}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-use config mode stateful` to enable a default enterprise.");let K=$[0];if(K)return K;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(U.length?U.join(", "):"the configured enterprise directories"))}import{existsSync as sg,mkdirSync as qd0,readFileSync as Vd0,renameSync as Ld0,unlinkSync as wd0,writeFileSync as Fd0}from"node:fs";import{homedir as Md0}from"node:os";import{dirname as Od0,join as Dd0}from"node:path";function $W(){let $=process.env[Nd0]?.trim();if($)return $;return Pd0}function O40($=new Date){return $.toISOString().slice(0,10)}function D40($=ag,Y=new Date){let U=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(U).toISOString().slice(0,10)}function N40($=$W()){if(!sg($))return{};try{let Y=Vd0($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&!Array.isArray(U))return U;return{}}catch{return{}}}function Bd0($,Y){let U={};for(let[Q,I]of Object.entries($)){if(!I||typeof I!=="object")continue;let J={},K=!1;for(let[z,H]of Object.entries(I))if(typeof H==="number"&&H>0&&z>=Y)J[z]=H,K=!0;if(K)U[Q]=J}return U}function Ad0($,Y=$W()){let U=Od0(Y);if(!sg(U))qd0(U,{recursive:!0,mode:448});let Q=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{Fd0(Q,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),Ld0(Q,Y)}catch(I){try{if(sg(Q))wd0(Q)}catch{}throw I}}function P40($,Y=new Date){if(!$||typeof $!=="string")return;try{let U=$W(),Q=N40(U),I=O40(Y),J=D40(ag,Y),K=Bd0(Q,J);K[$]=K[$]||{},K[$][I]=(K[$][I]??0)+1,Ad0(K,U)}catch{}}function Td0($,Y=ag,U=new Date){let Q=new Map;try{let I=N40(),J=D40(Y,U),K=O40(U),z=$??Object.keys(I);for(let H of z){let G=I[H];if(!G){Q.set(H,0);continue}let W=0;for(let[X,Z]of Object.entries(G))if(X>=J&&X<=K&&typeof Z==="number")W+=Z;Q.set(H,W)}}catch{if($)for(let I of $)Q.set(I,0)}return Q}function B40($,Y,U){let Q=U??Td0($.map((I)=>I.id));return[...$].sort((I,J)=>{if(Y){if(I.id===Y&&J.id!==Y)return-1;if(J.id===Y&&I.id!==Y)return 1}let K=Q.get(I.id)??0,z=Q.get(J.id)??0;if(K!==z)return z-K;let H=I.name??I.id,G=J.name??J.id,W=H.localeCompare(G,"zh-CN");if(W!==0)return W;return I.id.localeCompare(J.id)})}var Nd0="SEAL_USE_USAGE_FILE",Pd0,ag=7;var sM=o(()=>{Pd0=Dd0(Md0(),".config","seal-use","usage.json")});function GJ($=void 0){return eg.parse($??{})}function j40($,Y){return GJ({...GJ($),...Y})}var A40,tg,T40,eg,$y;var WJ=o(()=>{Z6();A40=[".pdf",".xls",".xlsx",".csv",".doc",".docx",".ppt",".pptx",".txt",".rtf",".odt",".ods",".odp",".jpg",".jpeg",".png",".gif",".bmp",".webp",".heic",".eml",".msg"],tg={minFileSizeBytes:500,allowedExtensions:[...A40]},T40=L.string().trim().min(1).transform(($)=>{let Y=$.toLowerCase();return Y.startsWith(".")?Y:`.${Y}`}).refine(($)=>/^\.[a-z0-9][a-z0-9+_-]*$/.test($),{message:"文件后缀必须是简单扩展名,例如 .pdf 或 xlsx"}),eg=L.object({minFileSizeBytes:L.number().int().min(0).default(tg.minFileSizeBytes),maxFileSizeBytes:L.number().int().positive().nullable().optional(),allowedExtensions:L.array(T40).min(1).default([...A40]).transform(($)=>[...new Set($)])}).superRefine(($,Y)=>{if($.maxFileSizeBytes!==void 0&&$.maxFileSizeBytes!==null&&$.maxFileSizeBytes<$.minFileSizeBytes)Y.addIssue({code:"custom",path:["maxFileSizeBytes"],message:"最大文件大小不能小于最小文件大小"})}),$y=L.object({minFileSizeBytes:L.number().int().min(0).optional(),maxFileSizeBytes:L.number().int().positive().nullable().optional(),allowedExtensions:L.array(T40).min(1).transform(($)=>[...new Set($)])}).optional()});var jd0,Ed0,Cd0,Rd0,C40,_d0,vd0,R40,aM,_40,hd0,tM,v40,UW,h40,Sd0,gd0,yd0,E40,QW,S40,kd0,xd0,eM,Yy,g40,y40,k40,x40,$O,f40,Uy,Qy,u40,b40,fd0,i40,ud0,c40,YW,n40,p40,d40,m40,l40,o40,r40,s40,a40,t40,e40,bd0,$60,id0,cd0,nd0,Iy,Jy,pd0,Y60,U60,Q60,I60,dd0,Ky,Nl1,Pl1,J60,Bl1;var zy=o(()=>{Z6();WJ();jd0=L.object({staffId:L.string(),name:L.string().optional(),code:L.string().default(""),bindTime:L.number().optional()}),Ed0=L.object({id:L.string(),tenantId:L.string(),name:L.string(),isAdmin:L.boolean().default(!1),permissions:L.array(L.string()).default([]),providerUser
Line truncated
|
||||
\x00`,x+=j4(j,2),x+=z.magic,x+=j4(M,2),x+=j4(F,2),x+=j4(P.crc32,4),x+=j4(P.compressedSize,4),x+=j4(P.uncompressedSize,4),x+=j4(G.length,2),x+=j4(D.length,2);var S=qD.LOCAL_FILE_HEADER+x+G+D,b=qD.CENTRAL_FILE_HEADER+j4(u,2)+x+j4(Z.length,2)+"\x00\x00\x00\x00"+j4(C,4)+j4(Q,4)+G+D+Z;return{fileRecord:S,dirRecord:b}},_t0=function($,Y,U,Q,I){var J="",K=gJ.transformTo("string",I(Q));return J=qD.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+j4($,2)+j4($,2)+j4(Y,4)+j4(U,4)+j4(K.length,2)+K,J},vt0=function($){var Y="";return Y=qD.DATA_DESCRIPTOR+j4($.crc32,4)+j4($.compressedSize,4)+j4($.uncompressedSize,4),Y};function j5($,Y,U,Q){yJ.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=U,this.encodeFileName=Q,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}gJ.inherits(j5,yJ);j5.prototype.push=function($){var Y=$.meta.percent||0,U=this.entriesCount,Q=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,yJ.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:U?(Y+100*(U-Q-1))/U:100}})};j5.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Y=this.streamFiles&&!$.file.dir;if(Y){var U=T30($,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0};j5.prototype.closedSource=function($){this.accumulate=!1;var Y=this.streamFiles&&!$.file.dir,U=T30($,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),Y)this.push({data:vt0($),meta:{percent:100}});else{this.push({data:U.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};j5.prototype.flush=function(){var $=this.bytesWritten;for(var Y=0;Y<this.dirRecords.length;Y++)this.push({data:this.dirRecords[Y],meta:{percent:100}});var U=this.bytesWritten-$,Q=_t0(this.dirRecords.length,U,$,this.zipComment,this.encodeFileName);this.push({data:Q,meta:{percent:100}})};j5.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};j5.prototype.registerPrevious=function($){this._sources.push($);var Y=this;return $.on("data",function(U){Y.processChunk(U)}),$.on("end",function(){if(Y.closedSource(Y.previous.streamInfo),Y._sources.length)Y.prepareNextSource();else Y.end()}),$.on("error",function(U){Y.error(U)}),this};j5.prototype.resume=function(){if(!yJ.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};j5.prototype.error=function($){var Y=this._sources;if(!yJ.prototype.error.call(this,$))return!1;for(var U=0;U<Y.length;U++)try{Y[U].error($)}catch(Q){}return!0};j5.prototype.lock=function(){yJ.prototype.lock.call(this);var $=this._sources;for(var Y=0;Y<$.length;Y++)$[Y].lock()};j30.exports=j5});var C30=E((yt0)=>{var ht0=ak(),St0=E30(),gt0=function($,Y){var U=$||Y,Q=ht0[U];if(!Q)throw Error(U+" is not a valid compression method !");return Q};yt0.generateWorker=function($,Y,U){var Q=new St0(Y.streamFiles,U,Y.platform,Y.encodeFileName),I=0;try{$.forEach(function(J,K){I++;var z=gt0(K.options.compression,Y.compression),H=K.options.compressionOptions||Y.compressionOptions||{},G=K.dir,W=K.date;K._compressWorker(z,H).withStreamInfo("file",{name:J,dir:G,date:W,comment:K.comment||"",unixPermissions:K.unixPermissions,dosPermissions:K.dosPermissions}).pipe(Q)}),Q.entriesCount=I}catch(J){Q.error(J)}return Q}});var _30=E((mr1,R30)=>{var xt0=o4(),VD=M$();function nW($,Y){VD.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Y)}xt0.inherits(nW,VD);nW.prototype._bindStream=function($){var Y=this;this._stream=$,$.pause(),$.on("data",function(U){Y.push({data:U,meta:{percent:0}})}).on("error",function(U){if(Y.isPaused)this.generatedError=U;else Y.error(U)}).on("end",function(){if(Y.isPaused)Y._upstreamEnded=!0;else Y.end()})};nW.prototype.pause=function(){if(!VD.prototype.pause.call(this))return!1;return this._stream.pause(),!0};nW.prototype.resume=function(){if(!VD.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};R30.exports=nW});var b30=E((lr1,u30)=>{var ft0=AJ(),pW=o4(),g30=M$(),ut0=Qk(),y30=Ik(),v30=rO(),bt0=h50(),it0=C30(),h30=PW(),ct0=_30(),k30=function($,Y,U){var Q=pW.getTypeOf(Y),I,J=pW.extend(U||{},y30);if(J.date=J.date||new Date,J.compression!==null)J.compression=J.compression.toUpperCase();if(typeof J.unixPermissions==="string")J.unixPermissions=parseInt(J.unixPermissions,8);if(J.unixPermissions&&J.unixPermissions&16384)J.dir=!0;if(J.dosPermissions&&J.dosPermission
Line truncated
|
||||
`)}openNode($,Y){let U=this.tos,Q=this._xml;if(U&&this.open)Q.push(">");this._stack.push($),Q.push("<"),Q.push($),gx(Q,Y),this.leaf=!0,this.open=!0}addAttribute($,Y){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(Y!==void 0)_20(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");gx(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(R20.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),Y=this._xml;if(this.leaf)Y.push("/>");else Y.push("</"),Y.push($),Y.push(">");this.open=!1,this.leaf=!1}leafNode($,Y,U){if(this.openNode($,Y),U!==void 0)this.writeText(U);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}yx.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};v20.exports=yx});var kx=E((S11)=>{var h20=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function h11($){if(typeof $==="string")return $;if(h20)return h20.decode($);return $.toString()}S11.bufferToString=h11});var x20=E((g20)=>{Object.defineProperty(g20,"__esModule",{value:!0});g20.CHAR=`
|
||||
\r --�\uD800\uDC00-\uDBFF\uDFFF`;g20.S=` \r
|
||||
`;g20.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";g20.NAME_CHAR="-"+g20.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";g20.CHAR_RE=new RegExp("^["+g20.CHAR+"]$","u");g20.S_RE=new RegExp("^["+g20.S+"]+$","u");g20.NAME_START_CHAR_RE=new RegExp("^["+g20.NAME_START_CHAR+"]$","u");g20.NAME_CHAR_RE=new RegExp("^["+g20.NAME_CHAR+"]$","u");g20.NAME_RE=new RegExp("^["+g20.NAME_START_CHAR+"]["+g20.NAME_CHAR+"]*$","u");g20.NMTOKEN_RE=new RegExp("^["+g20.NAME_CHAR+"]+$","u");var xx=9,fx=10,ux=13,bx=32;g20.S_LIST=[bx,fx,ux,xx];function y11($){return $>=bx&&$<=55295||$===fx||$===ux||$===xx||$>=57344&&$<=65533||$>=65536&&$<=1114111}g20.isChar=y11;function k11($){return $===bx||$===fx||$===ux||$===xx}g20.isS=k11;function S20($){return $>=65&&$<=90||$>=97&&$<=122||$===58||$===95||$===8204||$===8205||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}g20.isNameStartChar=S20;function x11($){return S20($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}g20.isNameChar=x11});var l20=E((n20)=>{Object.defineProperty(n20,"__esModule",{value:!0});n20.CHAR="\x01--�\uD800\uDC00-\uDBFF\uDFFF";n20.RESTRICTED_CHAR="\x01-\b\v\f\x0E-\x1F--";n20.S=` \r
|
||||
`;n20.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";n20.NAME_CHAR="-"+n20.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";n20.CHAR_RE=new RegExp("^["+n20.CHAR+"]$","u");n20.RESTRICTED_CHAR_RE=new RegExp("^["+n20.RESTRICTED_CHAR+"]$","u");n20.S_RE=new RegExp("^["+n20.S+"]+$","u");n20.NAME_START_CHAR_RE=new RegExp("^["+n20.NAME_START_CHAR+"]$","u");n20.NAME_CHAR_RE=new RegExp("^["+n20.NAME_CHAR+"]$","u");n20.NAME_RE=new RegExp("^["+n20.NAME_START_CHAR+"]["+n20.NAME_CHAR+"]*$","u");n20.NMTOKEN_RE=new RegExp("^["+n20.NAME_CHAR+"]+$","u");var f20=9,u20=10,b20=13,i20=32;n20.S_LIST=[i20,u20,b20,f20];function r11($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}n20.isChar=r11;function s11($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}n20.isRestrictedChar=s11;function a11($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}n20.isCharAndNotRestricted=a11;function t11($){return $===i20||$===u20||$===b20||$===f20}n20.isS=t11;function c20($){return $>=65&&$<=90||$>=97&&$<=122||$===58||$===95||$===8204||$===8205||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}n20.isNameStartChar=c20;function e11($){return c20($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}n20.isNameChar=e11});var s20=E((r20)=>{Object.defineProperty(r20,"__esModule",{value:!0});r20.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";r20.NC_NAME_CHAR="-"+r20.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";r20.NC_NAME_START_CHAR_RE=new RegExp("^["+r20.NC_NAME_START_CHAR+"]$","u");r20.NC_NAME_CHAR_RE=new RegExp("^["+r20.NC_NAME_CHAR+"]$","u");r20.NC_NAME_RE=new RegExp("^["+r20.NC_NAME_START_CHAR+"]["+r20.NC_NAME_CHAR+"]*$","u");function o20($){return $>=65&&$<=90||$===95||$>=97&&$<=122||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8204&&$<=8205||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}r20.isNCNameStartChar=o20;function V41($){return o20($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}r20.isNCNameChar=V41});var MY0=E((FY0)=>{Object.defineProperty(FY0,"__esModule",{value:!0});var lJ=x20(),D41=l20(),$f=s20(),$$=lJ.isS,N41=lJ.isChar,QX=lJ.isNameStartChar,a20=lJ.isNameChar,XY0=lJ.S_LIST,P41=lJ.NAME_RE,B41=D41.isChar,A41=$f.isNCNameStartChar,T41=$f.isNCNameChar,j41=$f.NC_NAME_RE,nD="http://www.w3.org/XML/1998/namespace",mJ="http://www.w3.org/2000/xmlns/",E41={__proto__:null,xml:nD,xmlns:mJ},C41={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},c4=-1,D9=-2,t20=0,R41=1,cx=2,_41=3,nJ=4,v41=5,h41=6,S41=7,nx=8,g41=9,y41=10,k41=11,x41=12,f8=13,fD=14,px=15,f41=16,dx=17,u41=18,b41=19,mx=20,i41=21,c41=22,n41=23,e20=24,lx=25,uD=26,$Y0=27,p41=28,d41=29,YY0=30,m41=31,l41=32,TU=33,o41=34,ox=35,IX=36,rx=37,r41=38,UY0=39,QY0=40,s41=41,IY0=42,a41=43,t41=44,sx=9,C5=10,ax=13,JY0=32,KY0=33,ZY0=34,JX=38,qY0=39,bD=45,iD=47,e41=59,G2=60,pJ=61,S6=62,Q8=63,VY0=91,dJ=93,zY0=133,HY0=8232,cD=($)=>$===ZY0||$===qY0,LY0=[ZY0,qY0],$61=[...LY0,VY0,S6],Y61=[...LY0,G2,dJ],U61=[pJ,Q8,...XY0],Q61=[...XY0,S6,JX,G2];function ex($,Y,U){switch(Y){case"xml":if(U!==nD)$.fail(`xml prefix must be bound to ${nD}.`);break;case"xmlns":if(U!==mJ)$.fail(`xmlns prefix must be bound to ${mJ}.`);break;default:}switch(U){case mJ:$.fail(Y===""?`the default namespace may not be set to ${U}.`:`may not assign a prefix (even "xmlns") to the URI ${mJ}.`);break;case nD:switch(Y){case"xml":break;case"":$.fail(`the default namespace may not be set to ${U}.`);break;default:$.fail("may not assign the xml namespace to another prefix.")}break;default:}}function I61($,Y){for(let U of Object.keys(Y))ex($,U,Y[U])}var J61=($)=>j41.test($),K61=($)=>P41.test($),jU=0,GY0=1,tx=2;FY0.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var WY0={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};class wY0{constructor($){this.opt=$!==null&&$!==void 0?$:{},this.fragmentOpt=!!this.opt.fragment;let Y=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,Y){this.nameStartCheck=A41,this.nameCheck=T41,this.isName=J61,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},E41);let U=this.opt.additionalNamesp
Line truncated
|
||||
`,Y=this.i}}captureToChar($){let{i:Y}=this,{chunk:U}=this;while(!0){let Q=this.getCode();switch(Q){case D9:this.text+=`${U.slice(Y,this.prevI)}
|
||||
`,Y=this.i,Q=C5;break;case c4:return this.text+=U.slice(Y),!1;default:}if(Q===$)return this.text+=U.slice(Y,this.prevI),!0}}captureNameChars(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCode();if(U===c4)return this.name+=$.slice(Y),c4;if(!a20(U))return this.name+=$.slice(Y,this.prevI),U===D9?C5:U}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===c4||!$$($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=N41,this.getCode=this.getCode10;else this.isChar=B41,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=R41}sBeginWhitespace(){let $=this.i,Y=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(Y){case G2:if(this.state=px,this.text.length!==0)throw Error("no-empty text at start");break;case c4:break;default:this.unget(),this.state=f8,this.xmlDeclPossible=!1}}sDoctype(){var $;let Y=this.captureTo($61);switch(Y){case S6:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=f8,this.doctype=!0;break}case c4:break;default:if(this.text+=String.fromCodePoint(Y),Y===VY0)this.state=nJ;else if(cD(Y))this.state=_41,this.q=Y}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=cx}sDTD(){let $=this.captureTo(Y61);if($===c4)return;if(this.text+=String.fromCodePoint($),$===dJ)this.state=cx;else if($===G2)this.state=h41;else if(cD($))this.state=v41,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=nJ,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case KY0:this.state=S41,this.openWakaBang="";break;case Q8:this.state=k41;break;default:this.state=nJ}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),Y=this.openWakaBang+=$;if(this.text+=$,Y!=="-")this.state=Y==="--"?nx:nJ,this.openWakaBang=""}sDTDComment(){if(this.captureToChar(bD))this.text+="-",this.state=g41}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===bD?y41:nx}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===S6)this.state=nJ;else this.fail("malformed comment."),this.state=nx}sDTDPI(){if(this.captureToChar(Q8))this.text+="?",this.state=x41}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===S6)this.state=nJ}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:Y}=this;$:while(!0)switch(this.getCode()){case D9:this.entity+=`${Y.slice($,this.prevI)}
|
||||
`,$=this.i;break;case e41:{let{entityReturnState:U}=this,Q=this.entity+Y.slice($,this.prevI);this.state=U;let I;if(Q==="")this.fail("empty entity name."),I="&;";else I=this.parseEntity(Q),this.entity="";if(U!==f8||this.textHandler!==void 0)this.text+=I;break $}case c4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(QX($))this.state=o41,this.unget(),this.xmlDeclPossible=!1;else switch($){case iD:this.state=a41,this.xmlDeclPossible=!1;break;case KY0:this.state=f41,this.openWakaBang="",this.xmlDeclPossible=!1;break;case Q8:this.state=n41;break;default:this.fail("disallowed character in tag name"),this.state=f8,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0;this.state=mx,this.openWakaBang="";break;case"--":this.state=dx,this.openWakaBang="";break;case"DOCTYPE":if(this.state=cx,this.doctype||this.sawRoot)this.fail("inappropriately located doctype declaration.");this.openWakaBang="";break;default:if(this.openWakaBang.length>=7)this.fail("incorrect syntax.")}}sComment(){if(this.captureToChar(bD))this.state=u41}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===bD)this.state=b41,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=dx}sCommentEnded(){let $=this.getCodeNorm();if($!==S6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=dx;else this.state=f8}sCData(){if(this.captureToChar(dJ))this.state=i41}sCDataEnding(){let $=this.getCodeNorm();if($===dJ)this.state=c41;else this.text+=`]${String.fromCodePoint($)}`,this.state=mx}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case S6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=f8;break}case dJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=mx}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=e20;else if($===Q8||$$($))this.fail("processing instruction without a target."),this.state=$===Q8?uD:lx;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=e20}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCodeNorm();if(U===c4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(Y,this.prevI);let Q=U===Q8;if(Q||$$(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=Q?TU:$Y0}else this.state=Q?uD:lx;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(U);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===Q8)this.state=uD;else if(!$$($))this.text=String.fromCodePoint($)}else if(this.captureToChar(Q8))this.state=uD}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===S6){let{piTarget:U}=this;if(U.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:U,body:this.text}),this.piTarget=this.text="",this.state=f8}else if(Y===Q8)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=lx;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===Q8){this.state=TU;return}if($!==c4)this.state=p41,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(U61);if($===Q8){this.state=TU,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!($$($)||$===pJ))return;if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=$===pJ?YY0:d41}sXMLDeclEq(){let $=this.getCodeNorm();if($===Q8){this.state=TU,this.fail("XML declaration is incomplete.");return}if($$($))return;if($!==pJ)this.fail("value required.");this.state=YY0}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===Q8){this.state=TU,this.fail("XML declaration is incomplete.");return}if($$($))return;if(!cD($))this.fail("value must be quoted."),this.q=JY0;else this.q=$;this.state=m41}sXMLDeclValue(){let $=this.captureTo([this.q,Q8]);if($===Q8){this.state=TU,this.text="",this.fail("XML declaration is incomplete.");return}if($===c4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=Y;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("ver
Line truncated
|
||||
`;$=this.i,Y=jU;break;case c4:if(Q!==void 0)this.text+=U.slice($);break $;default:Y=jU}this.forbiddenState=Y}handleTextOutsideRoot(){let{i:$}=this,{chunk:Y,textHandler:U}=this,Q=!1;$:while(!0){let I=this.getCode();switch(I){case G2:{if(this.state=px,U!==void 0){let{text:J}=this,K=Y.slice($,this.prevI);if(J.length!==0)U(J+K),this.text="";else if(K.length!==0)U(K)}break $}case JX:if(this.state=fD,this.entityReturnState=f8,U!==void 0)this.text+=Y.slice($,this.prevI);Q=!0;break $;case D9:if(U!==void 0)this.text+=`${Y.slice($,this.prevI)}
|
||||
`;$=this.i;break;case c4:if(U!==void 0)this.text+=Y.slice($);break $;default:if(!$$(I))Q=!0}}if(!Q)return;if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0}pushAttribNS($,Y){var U;let{prefix:Q,local:I}=this.qname($),J={name:$,prefix:Q,local:I,value:Y};if(this.attribList.push(J),(U=this.attributeHandler)===null||U===void 0||U.call(this,J),Q==="xmlns"){let K=Y.trim();if(this.currentXMLVersion==="1.0"&&K==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[I]=K,ex(this,I,K)}else if($==="xmlns"){let K=Y.trim();this.topNS[""]=K,ex(this,"",K)}}pushAttribPlain($,Y){var U;let Q={name:$,value:Y};this.attribList.push(Q),(U=this.attributeHandler)===null||U===void 0||U.call(this,Q)}end(){var $,Y;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:U}=this;while(U.length>0){let I=U.pop();this.fail(`unclosed tag: ${I.name}`)}if(this.state!==t20&&this.state!==f8)this.fail("unexpected end.");let{text:Q}=this;if(Q.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,Q),this.text="";return this._closed=!0,(Y=this.endHandler)===null||Y===void 0||Y.call(this),this._init(),this}resolve($){var Y,U;let Q=this.topNS[$];if(Q!==void 0)return Q;let{tags:I}=this;for(let J=I.length-1;J>=0;J--)if(Q=I[J].ns[$],Q!==void 0)return Q;if(Q=this.ns[$],Q!==void 0)return Q;return(U=(Y=this.opt).resolvePrefix)===null||U===void 0?void 0:U.call(Y,$)}qname($){let Y=$.indexOf(":");if(Y===-1)return{prefix:"",local:$};let U=$.slice(Y+1),Q=$.slice(0,Y);if(Q===""||U===""||U.includes(":"))this.fail(`malformed name: ${$}.`);return{prefix:Q,local:U}}processAttribsNS(){var $;let{attribList:Y}=this,U=this.tag;{let{prefix:J,local:K}=this.qname(U.name);U.prefix=J,U.local=K;let z=U.uri=($=this.resolve(J))!==null&&$!==void 0?$:"";if(J!==""){if(J==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(z==="")this.fail(`unbound namespace prefix: ${JSON.stringify(J)}.`),U.uri=J}}if(Y.length===0)return;let{attributes:Q}=U,I=new Set;for(let J of Y){let{name:K,prefix:z,local:H}=J,G,W;if(z==="")G=K==="xmlns"?mJ:"",W=K;else{if(G=this.resolve(z),G===void 0)this.fail(`unbound namespace prefix: ${JSON.stringify(z)}.`),G=z;W=`{${G}}${H}`}if(I.has(W))this.fail(`duplicate attribute: ${W}.`);I.add(W),J.uri=G,Q[K]=J}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,Y=this.tag.attributes;for(let{name:U,value:Q}of $){if(Y[U]!==void 0)this.fail(`duplicate attribute: ${U}.`);Y[U]=Q}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:Y}=this,U=this.tag;U.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,U),Y.push(U),this.state=f8,this.name=""}openSelfClosingTag(){var $,Y,U;this.processAttribs();let{tags:Q}=this,I=this.tag;if(I.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,I),(Y=this.closeTagHandler)===null||Y===void 0||Y.call(this,I),(this.tag=(U=Q[Q.length-1])!==null&&U!==void 0?U:null)===null)this.closedRoot=!0;this.state=f8,this.name=""}closeTag(){let{tags:$,name:Y}=this;if(this.state=f8,this.name="",Y===""){this.fail("weird empty close tag."),this.text+="</>";return}let U=this.closeTagHandler,Q=$.length;while(Q-- >0){let I=this.tag=$.pop();if(this.topNS=I.ns,U===null||U===void 0||U(I),I.name===Y)break;this.fail("unexpected close tag.")}if(Q===0)this.closedRoot=!0;else if(Q<0)this.fail(`unmatched closing tag: ${Y}.`),this.text+=`</${Y}>`}parseEntity($){if($[0]!=="#"){let U=this.ENTITIES[$];if(U!==void 0)return U;return this.fail(this.isName($)?"undefined entity.":"disallowed character in entity name."),`&${$};`}let Y=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))Y=parseInt($.slice(2),16);else if(/^#[0-9]+$/.test($))Y=parseInt($.slice(1),10);if(!this.isChar(Y))return this.fail("malformed character entity."),`&${$};`;return String.fromCodePoint(Y)}}FY0.SaxesParser=wY0});var KX=E((_s1,OY0)=>{var{SaxesParser:G61}=MY0(),{PassThrough:W61}=x8(),{bufferToString:X61}=kx();OY0.exports=async function*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(new W61);let Y=new G61,U;Y.on("error",(I)=>{U=I});let Q=[];Y.on("opentag",(I)=>Q.push({eventType:"opentag",value:I})),Y.on("text",(I)=>Q.push({eventType:"text",value:I})),Y.on("closetag",(I)=>Q.push({eventType:"closetag",value:I}));for await(let I of $){if(Y.write(X61(I)),U)throw U;yield Q,Q=[]}}});var k0=E((vs1,DY0)=>{var Z61=KX(),q61=U8();class oJ{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,Y){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($ instanceof oJ)$.reset();else if($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}async parse($){for await(let Y of $)for(let{eventType:U,value:Q}of Y)if(U==="opentag")this.parseOpen(Q);else if(U==="text")this.parseText(Q);else if(U==="closetag"){if(!this.parseClose(Q.name))return thLine truncated
|
||||
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <a:fillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:Line truncated
|
||||
`,this.quote='"',this.escape=this.quote,this.quoteColumns=!1,this.quoteHeaders=this.quoteColumns,this.headers=null,this.includeEndRowDelimiter=!1,this.writeBOM=!1,this.BOM="\uFEFF",this.alwaysWriteHeaders=!1,Object.assign(this,$||{}),typeof($===null||$===void 0?void 0:$.quoteHeaders)>"u")this.quoteHeaders=this.quoteColumns;if(($===null||$===void 0?void 0:$.quote)===!0)this.quote='"';else if(($===null||$===void 0?void 0:$.quote)===!1)this.quote="";if(typeof($===null||$===void 0?void 0:$.escape)!=="string")this.escape=this.quote;this.shouldWriteHeaders=!!this.headers&&((Y=$.writeHeaders)!==null&&Y!==void 0?Y:!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}sz0.FormatterOptions=rz0});var PN=E((Ue1,YH0)=>{var B71="[object AsyncFunction]",A71="[object Function]",T71="[object GeneratorFunction]",j71="[object Null]",E71="[object Proxy]",C71="[object Undefined]",R71=typeof global=="object"&&global&&global.Object===Object&&global,_71=typeof self=="object"&&self&&self.Object===Object&&self,v71=R71||_71||Function("return this")(),ez0=Object.prototype,h71=ez0.hasOwnProperty,$H0=ez0.toString,tz0=v71.Symbol,SU=tz0?tz0.toStringTag:void 0;function S71($){if($==null)return $===void 0?C71:j71;return SU&&SU in Object($)?g71($):y71($)}function g71($){var Y=h71.call($,SU),U=$[SU];try{$[SU]=void 0;var Q=!0}catch(J){}var I=$H0.call($);if(Q)if(Y)$[SU]=U;else delete $[SU];return I}function y71($){return $H0.call($)}function k71($){if(!x71($))return!1;var Y=S71($);return Y==A71||Y==T71||Y==B71||Y==E71}function x71($){var Y=typeof $;return $!=null&&(Y=="object"||Y=="function")}YH0.exports=k71});var kH0=E((BN,IK)=>{var f71=200,Au="__lodash_hash_undefined__",vN=1,qH0=2,VH0=9007199254740991,AN="[object Arguments]",Fu="[object Array]",u71="[object AsyncFunction]",LH0="[object Boolean]",wH0="[object Date]",FH0="[object Error]",MH0="[object Function]",b71="[object GeneratorFunction]",TN="[object Map]",OH0="[object Number]",i71="[object Null]",QK="[object Object]",UH0="[object Promise]",c71="[object Proxy]",DH0="[object RegExp]",jN="[object Set]",NH0="[object String]",n71="[object Symbol]",p71="[object Undefined]",Mu="[object WeakMap]",PH0="[object ArrayBuffer]",EN="[object DataView]",d71="[object Float32Array]",m71="[object Float64Array]",l71="[object Int8Array]",o71="[object Int16Array]",r71="[object Int32Array]",s71="[object Uint8Array]",a71="[object Uint8ClampedArray]",t71="[object Uint16Array]",e71="[object Uint32Array]",$21=/[\\^$.*+?()[\]{}|]/g,Y21=/^\[object .+?Constructor\]$/,U21=/^(?:0|[1-9]\d*)$/,v4={};v4[d71]=v4[m71]=v4[l71]=v4[o71]=v4[r71]=v4[s71]=v4[a71]=v4[t71]=v4[e71]=!0;v4[AN]=v4[Fu]=v4[PH0]=v4[LH0]=v4[EN]=v4[wH0]=v4[FH0]=v4[MH0]=v4[TN]=v4[OH0]=v4[QK]=v4[DH0]=v4[jN]=v4[NH0]=v4[Mu]=!1;var BH0=typeof global=="object"&&global&&global.Object===Object&&global,Q21=typeof self=="object"&&self&&self.Object===Object&&self,j3=BH0||Q21||Function("return this")(),AH0=typeof BN=="object"&&BN&&!BN.nodeType&&BN,QH0=AH0&&typeof IK=="object"&&IK&&!IK.nodeType&&IK,TH0=QH0&&QH0.exports===AH0,Vu=TH0&&BH0.process,IH0=function(){try{return Vu&&Vu.binding&&Vu.binding("util")}catch($){}}(),JH0=IH0&&IH0.isTypedArray;function I21($,Y){var U=-1,Q=$==null?0:$.length,I=0,J=[];while(++U<Q){var K=$[U];if(Y(K,U,$))J[I++]=K}return J}function J21($,Y){var U=-1,Q=Y.length,I=$.length;while(++U<Q)$[I+U]=Y[U];return $}function K21($,Y){var U=-1,Q=$==null?0:$.length;while(++U<Q)if(Y($[U],U,$))return!0;return!1}function z21($,Y){var U=-1,Q=Array($);while(++U<$)Q[U]=Y(U);return Q}function H21($){return function(Y){return $(Y)}}function G21($,Y){return $.has(Y)}function W21($,Y){return $==null?void 0:$[Y]}function X21($){var Y=-1,U=Array($.size);return $.forEach(function(Q,I){U[++Y]=[I,Q]}),U}function Z21($,Y){return function(U){return $(Y(U))}}function q21($){var Y=-1,U=Array($.size);return $.forEach(function(Q){U[++Y]=Q}),U}var V21=Array.prototype,L21=Function.prototype,hN=Object.prototype,Lu=j3["__core-js_shared__"],jH0=L21.toString,P9=hN.hasOwnProperty,KH0=function(){var $=/[^.]+$/.exec(Lu&&Lu.keys&&Lu.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),EH0=hN.toString,w21=RegExp("^"+jH0.call(P9).replace($21,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),zH0=TH0?j3.Buffer:void 0,CN=j3.Symbol,HH0=j3.Uint8Array,CH0=hN.propertyIsEnumerable,F21=V21.splice,gU=CN?CN.toStringTag:void 0,GH0=Object.getOwnPropertySymbols,M21=zH0?zH0.isBuffer:void 0,O21=Z21(Object.keys,Object),Ou=JK(j3,"DataView"),qX=JK(j3,"Map"),Du=JK(j3,"Promise"),Nu=JK(j3,"Set"),Pu=JK(j3,"WeakMap"),VX=JK(Object,"create"),D21=xU(Ou),N21=xU(qX),P21=xU(Du),B21=xU(Nu),A21=xU(Pu),WH0=CN?CN.prototype:void 0,wu=WH0?WH0.valueOf:void 0;function yU($){var Y=-1,U=$==null?0:$.length;this.clear();while(++Y<U){var Q=$[Y];this.set(Q[0],Q[1])}}function T21(){this.__data__=VX?VX(null):{},this.size=0}function j21($){var Y=this.has($)&&delete this.__data__[$];return this.size-=Y?1:0,Y}function E21($){var Y=this.__data
Line truncated
|
||||
]`;this.ESCAPE_REGEXP=new RegExp(Y)}set headers($){this._headers=$}shouldQuote($,Y){let U=Y?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(SY1.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,Y,U){let Q=`${gY1.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:I}=this;if(I.quote!==""){if(Q.indexOf(I.quote)!==-1)return this.quoteField(Q.replace(this.REPLACE_REGEXP,I.escapedQuote))}if(Q.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(Y,U))return this.quoteField(Q);return Q}quoteField($){let{quote:Y}=this.formatterOptions;return`${Y}${$}${Y}`}}KK.FieldFormatter=dH0});var Ru=E((mH0)=>{Object.defineProperty(mH0,"__esModule",{value:!0});mH0.isSyncTransform=void 0;mH0.isSyncTransform=($)=>$.length===1});var rH0=E((zK)=>{var oH0=zK&&zK.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(zK,"__esModule",{value:!0});zK.RowFormatter=void 0;var kY1=oH0(PN()),xY1=oH0(kH0()),fY1=Cu(),uY1=Ru();class fU{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new fY1.FieldFormatter($),this.headers=$.headers,this.shouldWriteHeaders=$.shouldWriteHeaders,this.hasWrittenHeaders=!1,this.headers!==null)this.fieldFormatter.headers=this.headers;if($.transform)this.rowTransform=$.transform}static isRowHashArray($){if(Array.isArray($))return Array.isArray($[0])&&$[0].length===2;return!1}static isRowArray($){return Array.isArray($)&&!this.isRowHashArray($)}static gatherHeaders($){if(fU.isRowHashArray($))return $.map((Y)=>Y[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(uY1.isSyncTransform($))return(Y,U)=>{let Q=null;try{Q=$(Y)}catch(I){return U(I)}return U(null,Q)};return(Y,U)=>{$(Y,U)}}set rowTransform($){if(!kY1.default($))throw TypeError("The transform should be a function");this._rowTransform=fU.createTransform($)}format($,Y){this.callTransformer($,(U,Q)=>{if(U)return Y(U);if(!$)return Y(null);let I=[];if(Q){let{shouldFormatColumns:J,headers:K}=this.checkHeaders(Q);if(this.shouldWriteHeaders&&K&&!this.hasWrittenHeaders)I.push(this.formatColumns(K,!0)),this.hasWrittenHeaders=!0;if(J){let z=this.gatherColumns(Q);I.push(this.formatColumns(z,!1))}}return Y(null,I)})}finish($){let Y=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));Y.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)Y.push(this.formatterOptions.rowDelimiter);return $(null,Y)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let Y=fU.gatherHeaders($);if(this.headers=Y,this.fieldFormatter.headers=Y,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!xY1.default(Y,$),headers:Y}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((Y)=>$[Y]);if(fU.isRowHashArray($))return this.headers.map((Y,U)=>{let Q=$[U];if(Q)return Q[1];return""});if(fU.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((Y,U)=>$[U])}callTransformer($,Y){if(!this._rowTransform)return Y(null,$);return this._rowTransform($,Y)}formatColumns($,Y){let U=$.map((I,J)=>this.fieldFormatter.format(I,J,Y)).join(this.formatterOptions.delimiter),{rowCount:Q}=this;if(this.rowCount+=1,Q)return[this.formatterOptions.rowDelimiter,U].join("");return U}}zK.RowFormatter=fU});var sH0=E((yN)=>{Object.defineProperty(yN,"__esModule",{value:!0});yN.FieldFormatter=yN.RowFormatter=void 0;var bY1=rH0();Object.defineProperty(yN,"RowFormatter",{enumerable:!0,get:function(){return bY1.RowFormatter}});var iY1=Cu();Object.defineProperty(yN,"FieldFormatter",{enumerable:!0,get:function(){return iY1.FieldFormatter}})});var _u=E((tH0)=>{Object.defineProperty(tH0,"__esModule",{value:!0});tH0.CsvFormatterStream=void 0;var nY1=z0("stream"),pY1=sH0();class aH0 extends nY1.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new pY1.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,Y,U){let Q=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(I,J)=>{if(I)return Q=!0,U(I);if(J)J.forEach((K)=>{this.push(Buffer.from(K,"utf8"))});return Q=!0,U()})}catch(I){if(Q)throw I;U(I)}}_flush($){this.rowFormatter.finish((Y,U)=>{if(Y)return $(Y);if(U)U.forEach((Q)=>{this.push(Buffer.from(Q,"utf8"))});return $()})}}tH0.CsvFormatterStream=aH0});var YG0=E(($4)=>{var $G0=$4&&$4.__createBinding||(Object.create?function($,Y,U,Q){if(Q===void 0)Q=U;Object.defineProperty($,Q,{enumerable:!0,get:function(){return Y[U]}})}:function($,Y,U,Q){if(Q===void 0)Q=U;$[Q]=Y[U]}),dY1=$4&&$4.__setModuleDefault||(Object.create?function($,Y){O
Line truncated
|
||||
`||Y===`\r
|
||||
`}static isTokenCarriageReturn($,Y){return $.token===Y.carriageReturn}static isTokenComment($,Y){return Y.supportsComments&&!!$&&$.token===Y.comment}static isTokenEscapeCharacter($,Y){return $.token===Y.escapeChar}static isTokenQuote($,Y){return $.token===Y.quote}static isTokenDelimiter($,Y){return $.token===Y.delimiter}}HH0.Token=GH0});var ju=j((qH0)=>{Object.defineProperty(qH0,"__esModule",{value:!0});qH0.Scanner=void 0;var XH0=N2(),uQ1=/((?:\r\n)|\n|\r)/;class ZH0{constructor($){this.cursor=0,this.line=$.line,this.lineLength=this.line.length,this.parserOptions=$.parserOptions,this.hasMoreData=$.hasMoreData,this.cursor=$.cursor||0}get hasMoreCharacters(){return this.lineLength>this.cursor}get nextNonSpaceToken(){let{lineFromCursor:$}=this,Y=this.parserOptions.NEXT_TOKEN_REGEXP;if($.search(Y)===-1)return null;let U=Y.exec($);if(U==null)return null;let Q=U[1],I=this.cursor+(U.index||0);return new XH0.Token({token:Q,startCursor:I,endCursor:I+Q.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:Y}=this;if(Y<=$)return null;return new XH0.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=uQ1.exec(this.lineFromCursor);if(!$){if(this.hasMoreData)return null;return this.cursor=this.lineLength,this}return this.cursor+=($.index||0)+$[0].length,this}advanceTo($){return this.cursor=$,this}advanceToToken($){return this.cursor=$.startCursor,this}advancePastToken($){return this.cursor=$.endCursor+1,this}truncateToCursor(){return this.line=this.lineFromCursor,this.lineLength=this.line.length,this.cursor=0,this}}qH0.Scanner=ZH0});var fD=j((FH0)=>{Object.defineProperty(FH0,"__esModule",{value:!0});FH0.ColumnFormatter=void 0;class LH0{constructor($){if($.trim)this.format=(Y)=>Y.trim();else if($.ltrim)this.format=(Y)=>Y.trimLeft();else if($.rtrim)this.format=(Y)=>Y.trimRight();else this.format=(Y)=>Y}}FH0.ColumnFormatter=LH0});var Cu=j((NH0)=>{Object.defineProperty(NH0,"__esModule",{value:!0});NH0.NonQuotedColumnParser=void 0;var bQ1=fD(),MH0=N2();class OH0{constructor($){this.parserOptions=$,this.columnFormatter=new bQ1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:Y}=this,U=[],Q=$.nextCharacterToken;for(;Q;Q=$.nextCharacterToken){if(MH0.Token.isTokenDelimiter(Q,Y)||MH0.Token.isTokenRowDelimiter(Q))break;U.push(Q.token),$.advancePastToken(Q)}return this.columnFormatter.format(U.join(""))}}NH0.NonQuotedColumnParser=OH0});var Ru=j((BH0)=>{Object.defineProperty(BH0,"__esModule",{value:!0});BH0.QuotedColumnParser=void 0;var iQ1=fD(),qK=N2();class AH0{constructor($){this.parserOptions=$,this.columnFormatter=new iQ1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let Y=$.cursor,{foundClosingQuote:U,col:Q}=this.gatherDataBetweenQuotes($);if(!U){if($.advanceTo(Y),!$.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||""}' in line: at '${$.lineFromCursor.replace(/[\r\n]/g,"\\n'")}'`);return null}return this.checkForMalformedColumn($),Q}gatherDataBetweenQuotes($){let{parserOptions:Y}=this,U=!1,Q=!1,I=[],J=$.nextCharacterToken;for(;!Q&&J!==null;J=$.nextCharacterToken){let K=qK.Token.isTokenQuote(J,Y);if(!U&&K)U=!0;else if(U)if(qK.Token.isTokenEscapeCharacter(J,Y)){$.advancePastToken(J);let z=$.nextCharacterToken;if(z!==null&&(qK.Token.isTokenQuote(z,Y)||qK.Token.isTokenEscapeCharacter(z,Y)))I.push(z.token),J=z;else if(K)Q=!0;else I.push(J.token)}else if(K)Q=!0;else I.push(J.token);$.advancePastToken(J)}return{col:this.columnFormatter.format(I.join("")),foundClosingQuote:Q}}checkForMalformedColumn($){let{parserOptions:Y}=this,{nextNonSpaceToken:U}=$;if(U){let Q=qK.Token.isTokenDelimiter(U,Y),I=qK.Token.isTokenRowDelimiter(U);if(!(Q||I)){let J=$.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw Error(`Parse Error: expected: '${Y.escapedDelimiter}' OR new line got: '${U.token}'. at '${J}`)}$.advanceToToken(U)}else if(!$.hasMoreData)$.advancePastLine()}}BH0.QuotedColumnParser=AH0});var CH0=j((EH0)=>{Object.defineProperty(EH0,"__esModule",{value:!0});EH0.ColumnParser=void 0;var cQ1=Cu(),nQ1=Ru(),dQ1=N2();class TH0{constructor($){this.parserOptions=$,this.quotedColumnParser=new nQ1.QuotedColumnParser($),this.nonQuotedColumnParser=new cQ1.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:Y}=$;if(Y!==null&&dQ1.Token.isTokenQuote(Y,this.parserOptions))return $.advanceToToken(Y),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}EH0.ColumnParser=TH0});var _u=j((VK)=>{Object.defineProperty(VK,"__esModule",{value:!0});VK.ColumnFormatter=VK.QuotedColumnParser=VK.NonQuotedColumnParser=VK.ColumnParser=void 0;var pQ1=CH0();Object.defineProperty(VK,"ColumnParser",{enumerable:!0,get:function(){return pQ1.ColumnParser}});var mQ1=Cu();Object.defineProperty(VK,"NonQuotedColumnParser",{enumerable:!0,get:function(){return mQ1.NonQuotedColumnParser}});var lQ1=Ru();Object.defineProperty(VK,"QuotedColumnParser",{enumerable:!0,get:function(){re
Line truncated
|
||||
%s`,T,T,q,Q);let A=q.type==="*"?pu:q.type==="?"?ou:"\\"+q.type;I=!0,Q=Q.slice(0,q.reStart)+A+"\\("+T}if(O(),J)Q+="\\\\";let D=fI1[Q.charAt(0)];for(let T=z.length-1;T>-1;T--){let A=z[T],E=Q.slice(0,A.reStart),C=Q.slice(A.reStart,A.reEnd-8),i=Q.slice(A.reEnd),x=Q.slice(A.reEnd-8,A.reEnd)+i,h=E.split(")").length,b=E.split("(").length-h,n=i;for(let k=0;k<b;k++)n=n.replace(/\)[+*?]?/,"");i=n;let Q0=i===""&&Y!==mu?"(?:$|\\/)":"";Q=E+C+i+Q0+x}if(Q!==""&&I)Q="(?=.)"+Q;if(D)Q=F()+Q;if(Y===mu)return[Q,I];if(U.nocase&&!I)I=$.toUpperCase()!==$.toLowerCase();if(!I)return bI1($);let P=U.nocase?"i":"";try{return Object.assign(new RegExp("^"+Q+"$",P),{_glob:$,_src:Q})}catch(T){return new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let $=this.set;if(!$.length)return this.regexp=!1,this.regexp;let Y=this.options,U=Y.noglobstar?pu:Y.dot?kI1:xI1,Q=Y.nocase?"i":"",I=$.map((J)=>{return J=J.map((K)=>typeof K==="string"?cI1(K):K===u8?u8:K._src).reduce((K,z)=>{if(!(K[K.length-1]===u8&&z===u8))K.push(z);return K},[]),J.forEach((K,z)=>{if(K!==u8||J[z-1]===u8)return;if(z===0)if(J.length>1)J[z+1]="(?:\\/|"+U+"\\/)?"+J[z+1];else J[z]=U;else if(z===J.length-1)J[z-1]+="(?:\\/|"+U+")?";else J[z-1]+="(?:\\/|\\/"+U+"\\/)"+J[z+1],J[z+1]=u8}),J.filter((K)=>K!==u8).join("/")}).join("|");if(I="^(?:"+I+")$",this.negate)I="^(?!"+I+").*$";try{this.regexp=new RegExp(I,Q)}catch(J){this.regexp=!1}return this.regexp}match($,Y=this.partial){if(this.debug("match",$,this.pattern),this.comment)return!1;if(this.empty)return $==="";if($==="/"&&Y)return!0;let U=this.options;if(lu.sep!=="/")$=$.split(lu.sep).join("/");$=$.split(DW0),this.debug(this.pattern,"split",$);let Q=this.set;this.debug(this.pattern,"set",Q);let I;for(let J=$.length-1;J>=0;J--)if(I=$[J],I)break;for(let J=0;J<Q.length;J++){let K=Q[J],z=$;if(U.matchBase&&K.length===1)z=[I];if(this.matchOne(z,K,Y)){if(U.flipNegate)return!0;return!this.negate}}if(U.flipNegate)return!1;return this.negate}static defaults($){return N$.defaults($).Minimatch}}N$.Minimatch=WX});var RW0=j((ka1,CW0)=>{CW0.exports=jW0;var tu=K0("fs"),{EventEmitter:dI1}=K0("events"),{Minimatch:su}=PW0(),{resolve:pI1}=K0("path");function mI1($,Y){return new Promise((U,Q)=>{tu.readdir($,{withFileTypes:!0},(I,J)=>{if(I)switch(I.code){case"ENOTDIR":if(Y)Q(I);else U([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":U([]);break;case"ELOOP":default:Q(I);break}else U(J)})})}function TW0($,Y){return new Promise((U,Q)=>{(Y?tu.stat:tu.lstat)($,(J,K)=>{if(J)switch(J.code){case"ENOENT":if(Y)U(TW0($,!1));else U(null);break;default:U(null);break}else U(K)})})}async function*EW0($,Y,U,Q,I,J){let K=await mI1(Y+$,J);for(let z of K){let G=z.name;if(G===void 0)G=z,Q=!0;let H=$+"/"+G,W=H.slice(1),X=Y+"/"+W,Z=null;if(Q||U)Z=await TW0(X,U);if(!Z&&z.name!==void 0)Z=z;if(Z===null)Z={isDirectory:()=>!1};if(Z.isDirectory()){if(!I(W))yield{relative:W,absolute:X,stats:Z},yield*EW0(H,Y,U,Q,I,!1)}else yield{relative:W,absolute:X,stats:Z}}}async function*lI1($,Y,U,Q){yield*EW0("",$,Y,U,Q,!0)}function oI1($){return{pattern:$.pattern,dot:!!$.dot,noglobstar:!!$.noglobstar,matchBase:!!$.matchBase,nocase:!!$.nocase,ignore:$.ignore,skip:$.skip,follow:!!$.follow,stat:!!$.stat,nodir:!!$.nodir,mark:!!$.mark,silent:!!$.silent,absolute:!!$.absolute}}class au extends dI1{constructor($,Y,U){super();if(typeof Y==="function")U=Y,Y=null;if(this.options=oI1(Y||{}),this.matchers=[],this.options.pattern){let Q=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=Q.map((I)=>new su(I,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let Q=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=Q.map((I)=>new su(I,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let Q=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=Q.map((I)=>new su(I,{dot:!0}))}if(this.iterator=lI1(pI1($||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,U)this._matches=[],this.on("match",(Q)=>this._matches.push(this.options.absolute?Q.absolute:Q.relative)),this.on("error",(Q)=>U(Q)),this.on("end",()=>U(null,this._matches));setTimeout(()=>this._next(),0)}_shouldSkipDirectory($){return this.skipMatchers.some((Y)=>Y.match($))}_fileMatches($,Y){let U=$+(Y?"/":"");return(this.matchers.length===0||this.matchers.some((Q)=>Q.match(U)))&&!this.ignoreMatchers.some((Q)=>Q.match(U))&&(!this.options.nodir||!Y)}_next(){if(!this.paused&&!this.aborted)this.iterator.next().then(($)=>{if(!$.done){let Y=$.value.stats.isDirectory();if(this._fileMatches($.value.relative,Y)){let U=$.value.relative,Q=$.value.absolute;if(this.options.mark&&Y)U+="/",Q+="/";if(this.options.stat)this.emit("match",{relative:U,absolute:Q,stat:$.value.stats});else this.emit("match",{relative:U
Line truncated
|
||||
`,r);r=F0===-1?f.length:F0}else if(G0!==-1&&f[r]==="/"&&f[r+1]==="*"){let F0=f.indexOf("*/",r);if(F0!==-1)r=F0+2,G0=f.indexOf("*/",r);else d+=f[r],r++}else d+=f[r],r++;return d}function c0(f){let d=b0(f.toString()),r=d.match(t);if(!r)r=d.match(X0);if(!r)throw Error(`could not parse args in autoInject
|
||||
`}static isTokenCarriageReturn($,Y){return $.token===Y.carriageReturn}static isTokenComment($,Y){return Y.supportsComments&&!!$&&$.token===Y.comment}static isTokenEscapeCharacter($,Y){return $.token===Y.escapeChar}static isTokenQuote($,Y){return $.token===Y.quote}static isTokenDelimiter($,Y){return $.token===Y.delimiter}}UW0.Token=YW0});var $b=E((KW0)=>{Object.defineProperty(KW0,"__esModule",{value:!0});KW0.Scanner=void 0;var IW0=D2(),eI1=/((?:\r\n)|\n|\r)/;class JW0{constructor($){this.cursor=0,this.line=$.line,this.lineLength=this.line.length,this.parserOptions=$.parserOptions,this.hasMoreData=$.hasMoreData,this.cursor=$.cursor||0}get hasMoreCharacters(){return this.lineLength>this.cursor}get nextNonSpaceToken(){let{lineFromCursor:$}=this,Y=this.parserOptions.NEXT_TOKEN_REGEXP;if($.search(Y)===-1)return null;let U=Y.exec($);if(U==null)return null;let Q=U[1],I=this.cursor+(U.index||0);return new IW0.Token({token:Q,startCursor:I,endCursor:I+Q.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:Y}=this;if(Y<=$)return null;return new IW0.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=eI1.exec(this.lineFromCursor);if(!$){if(this.hasMoreData)return null;return this.cursor=this.lineLength,this}return this.cursor+=($.index||0)+$[0].length,this}advanceTo($){return this.cursor=$,this}advanceToToken($){return this.cursor=$.startCursor,this}advancePastToken($){return this.cursor=$.endCursor+1,this}truncateToCursor(){return this.line=this.lineFromCursor,this.lineLength=this.line.length,this.cursor=0,this}}KW0.Scanner=JW0});var IP=E((GW0)=>{Object.defineProperty(GW0,"__esModule",{value:!0});GW0.ColumnFormatter=void 0;class HW0{constructor($){if($.trim)this.format=(Y)=>Y.trim();else if($.ltrim)this.format=(Y)=>Y.trimLeft();else if($.rtrim)this.format=(Y)=>Y.trimRight();else this.format=(Y)=>Y}}GW0.ColumnFormatter=HW0});var Yb=E((qW0)=>{Object.defineProperty(qW0,"__esModule",{value:!0});qW0.NonQuotedColumnParser=void 0;var $J1=IP(),XW0=D2();class ZW0{constructor($){this.parserOptions=$,this.columnFormatter=new $J1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:Y}=this,U=[],Q=$.nextCharacterToken;for(;Q;Q=$.nextCharacterToken){if(XW0.Token.isTokenDelimiter(Q,Y)||XW0.Token.isTokenRowDelimiter(Q))break;U.push(Q.token),$.advancePastToken(Q)}return this.columnFormatter.format(U.join(""))}}qW0.NonQuotedColumnParser=ZW0});var Ub=E((wW0)=>{Object.defineProperty(wW0,"__esModule",{value:!0});wW0.QuotedColumnParser=void 0;var YJ1=IP(),MK=D2();class LW0{constructor($){this.parserOptions=$,this.columnFormatter=new YJ1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let Y=$.cursor,{foundClosingQuote:U,col:Q}=this.gatherDataBetweenQuotes($);if(!U){if($.advanceTo(Y),!$.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||""}' in line: at '${$.lineFromCursor.replace(/[\r\n]/g,"\\n'")}'`);return null}return this.checkForMalformedColumn($),Q}gatherDataBetweenQuotes($){let{parserOptions:Y}=this,U=!1,Q=!1,I=[],J=$.nextCharacterToken;for(;!Q&&J!==null;J=$.nextCharacterToken){let K=MK.Token.isTokenQuote(J,Y);if(!U&&K)U=!0;else if(U)if(MK.Token.isTokenEscapeCharacter(J,Y)){$.advancePastToken(J);let z=$.nextCharacterToken;if(z!==null&&(MK.Token.isTokenQuote(z,Y)||MK.Token.isTokenEscapeCharacter(z,Y)))I.push(z.token),J=z;else if(K)Q=!0;else I.push(J.token)}else if(K)Q=!0;else I.push(J.token);$.advancePastToken(J)}return{col:this.columnFormatter.format(I.join("")),foundClosingQuote:Q}}checkForMalformedColumn($){let{parserOptions:Y}=this,{nextNonSpaceToken:U}=$;if(U){let Q=MK.Token.isTokenDelimiter(U,Y),I=MK.Token.isTokenRowDelimiter(U);if(!(Q||I)){let J=$.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw Error(`Parse Error: expected: '${Y.escapedDelimiter}' OR new line got: '${U.token}'. at '${J}`)}$.advanceToToken(U)}else if(!$.hasMoreData)$.advancePastLine()}}wW0.QuotedColumnParser=LW0});var NW0=E((OW0)=>{Object.defineProperty(OW0,"__esModule",{value:!0});OW0.ColumnParser=void 0;var UJ1=Yb(),QJ1=Ub(),IJ1=D2();class MW0{constructor($){this.parserOptions=$,this.quotedColumnParser=new QJ1.QuotedColumnParser($),this.nonQuotedColumnParser=new UJ1.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:Y}=$;if(Y!==null&&IJ1.Token.isTokenQuote(Y,this.parserOptions))return $.advanceToToken(Y),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}OW0.ColumnParser=MW0});var Qb=E((OK)=>{Object.defineProperty(OK,"__esModule",{value:!0});OK.ColumnFormatter=OK.QuotedColumnParser=OK.NonQuotedColumnParser=OK.ColumnParser=void 0;var JJ1=NW0();Object.defineProperty(OK,"ColumnParser",{enumerable:!0,get:function(){return JJ1.ColumnParser}});var KJ1=Yb();Object.defineProperty(OK,"NonQuotedColumnParser",{enumerable:!0,get:function(){return KJ1.NonQuotedColumnParser}});var zJ1=Ub();Object.defineProperty(OK,"QuotedColumnParser",{enumerable:!0,get:function(){re
Line truncated
|
||||
%s`,A,A,q,Q);let P=q.type==="*"?Mb:q.type==="?"?Nb:"\\"+q.type;I=!0,Q=Q.slice(0,q.reStart)+P+"\\("+A}if(O(),J)Q+="\\\\";let N=tJ1[Q.charAt(0)];for(let A=z.length-1;A>-1;A--){let P=z[A],j=Q.slice(0,P.reStart),C=Q.slice(P.reStart,P.reEnd-8),u=Q.slice(P.reEnd),x=Q.slice(P.reEnd-8,P.reEnd)+u,S=j.split(")").length,b=j.split("(").length-S,n=u;for(let k=0;k<b;k++)n=n.replace(/\)[+*?]?/,"");u=n;let I0=u===""&&Y!==Ob?"(?:$|\\/)":"";Q=j+C+u+I0+x}if(Q!==""&&I)Q="(?=.)"+Q;if(N)Q=F()+Q;if(Y===Ob)return[Q,I];if(U.nocase&&!I)I=$.toUpperCase()!==$.toLowerCase();if(!I)return $K1($);let B=U.nocase?"i":"";try{return Object.assign(new RegExp("^"+Q+"$",B),{_glob:$,_src:Q})}catch(A){return new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let $=this.set;if(!$.length)return this.regexp=!1,this.regexp;let Y=this.options,U=Y.noglobstar?Mb:Y.dot?sJ1:aJ1,Q=Y.nocase?"i":"",I=$.map((J)=>{return J=J.map((K)=>typeof K==="string"?UK1(K):K===u8?u8:K._src).reduce((K,z)=>{if(!(K[K.length-1]===u8&&z===u8))K.push(z);return K},[]),J.forEach((K,z)=>{if(K!==u8||J[z-1]===u8)return;if(z===0)if(J.length>1)J[z+1]="(?:\\/|"+U+"\\/)?"+J[z+1];else J[z]=U;else if(z===J.length-1)J[z-1]+="(?:\\/|"+U+")?";else J[z-1]+="(?:\\/|\\/"+U+"\\/)"+J[z+1],J[z+1]=u8}),J.filter((K)=>K!==u8).join("/")}).join("|");if(I="^(?:"+I+")$",this.negate)I="^(?!"+I+").*$";try{this.regexp=new RegExp(I,Q)}catch(J){this.regexp=!1}return this.regexp}match($,Y=this.partial){if(this.debug("match",$,this.pattern),this.comment)return!1;if(this.empty)return $==="";if($==="/"&&Y)return!0;let U=this.options;if(Db.sep!=="/")$=$.split(Db.sep).join("/");$=$.split(VX0),this.debug(this.pattern,"split",$);let Q=this.set;this.debug(this.pattern,"set",Q);let I;for(let J=$.length-1;J>=0;J--)if(I=$[J],I)break;for(let J=0;J<Q.length;J++){let K=Q[J],z=$;if(U.matchBase&&K.length===1)z=[I];if(this.matchOne(z,K,Y)){if(U.flipNegate)return!0;return!this.negate}}if(U.flipNegate)return!1;return this.negate}static defaults($){return N$.defaults($).Minimatch}}N$.Minimatch=PX});var PX0=E((X04,NX0)=>{NX0.exports=DX0;var Ab=z0("fs"),{EventEmitter:IK1}=z0("events"),{Minimatch:Bb}=FX0(),{resolve:JK1}=z0("path");function KK1($,Y){return new Promise((U,Q)=>{Ab.readdir($,{withFileTypes:!0},(I,J)=>{if(I)switch(I.code){case"ENOTDIR":if(Y)Q(I);else U([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":U([]);break;case"ELOOP":default:Q(I);break}else U(J)})})}function MX0($,Y){return new Promise((U,Q)=>{(Y?Ab.stat:Ab.lstat)($,(J,K)=>{if(J)switch(J.code){case"ENOENT":if(Y)U(MX0($,!1));else U(null);break;default:U(null);break}else U(K)})})}async function*OX0($,Y,U,Q,I,J){let K=await KK1(Y+$,J);for(let z of K){let H=z.name;if(H===void 0)H=z,Q=!0;let G=$+"/"+H,W=G.slice(1),X=Y+"/"+W,Z=null;if(Q||U)Z=await MX0(X,U);if(!Z&&z.name!==void 0)Z=z;if(Z===null)Z={isDirectory:()=>!1};if(Z.isDirectory()){if(!I(W))yield{relative:W,absolute:X,stats:Z},yield*OX0(G,Y,U,Q,I,!1)}else yield{relative:W,absolute:X,stats:Z}}}async function*zK1($,Y,U,Q){yield*OX0("",$,Y,U,Q,!0)}function HK1($){return{pattern:$.pattern,dot:!!$.dot,noglobstar:!!$.noglobstar,matchBase:!!$.matchBase,nocase:!!$.nocase,ignore:$.ignore,skip:$.skip,follow:!!$.follow,stat:!!$.stat,nodir:!!$.nodir,mark:!!$.mark,silent:!!$.silent,absolute:!!$.absolute}}class Tb extends IK1{constructor($,Y,U){super();if(typeof Y==="function")U=Y,Y=null;if(this.options=HK1(Y||{}),this.matchers=[],this.options.pattern){let Q=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=Q.map((I)=>new Bb(I,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let Q=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=Q.map((I)=>new Bb(I,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let Q=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=Q.map((I)=>new Bb(I,{dot:!0}))}if(this.iterator=zK1(JK1($||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,U)this._matches=[],this.on("match",(Q)=>this._matches.push(this.options.absolute?Q.absolute:Q.relative)),this.on("error",(Q)=>U(Q)),this.on("end",()=>U(null,this._matches));setTimeout(()=>this._next(),0)}_shouldSkipDirectory($){return this.skipMatchers.some((Y)=>Y.match($))}_fileMatches($,Y){let U=$+(Y?"/":"");return(this.matchers.length===0||this.matchers.some((Q)=>Q.match(U)))&&!this.ignoreMatchers.some((Q)=>Q.match(U))&&(!this.options.nodir||!Y)}_next(){if(!this.paused&&!this.aborted)this.iterator.next().then(($)=>{if(!$.done){let Y=$.value.stats.isDirectory();if(this._fileMatches($.value.relative,Y)){let U=$.value.relative,Q=$.value.absolute;if(this.options.mark&&Y)U+="/",Q+="/";if(this.options.stat)this.emit("match",{relative:U,absolute:Q,stat:$.value.stats});else this.emit("match",{relative:U
Line truncated
|
||||
`,r);r=w0===-1?f.length:w0}else if(H0!==-1&&f[r]==="/"&&f[r+1]==="*"){let w0=f.indexOf("*/",r);if(w0!==-1)r=w0+2,H0=f.indexOf("*/",r);else p+=f[r],r++}else p+=f[r],r++;return p}function n0(f){let p=b0(f.toString()),r=p.match(t);if(!r)r=p.match(G0);if(!r)throw Error(`could not parse args in autoInject
|
||||
Source:
|
||||
`+d);let[,G0]=r;return G0.replace(/\s/g,"").split(w0).map((F0)=>F0.replace(u0,"").trim())}function T1(f,d){var r={};return Object.keys(f).forEach((G0)=>{var F0=f[G0],N0,P0=q(F0),E0=!P0&&F0.length===1||P0&&F0.length===0;if(Array.isArray(F0))N0=[...F0],F0=N0.pop(),r[G0]=N0.concat(N0.length>0?g0:F0);else if(E0)r[G0]=F0;else{if(N0=c0(F0),F0.length===0&&!P0&&N0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!P0)N0.pop();r[G0]=N0.concat(g0)}function g0(Y1,f1){var r1=N0.map((c1)=>Y1[c1]);r1.push(f1),M(F0)(...r1)}}),X1(r,d)}class x1{constructor(){this.head=this.tail=null,this.length=0}removeLink(f){if(f.prev)f.prev.next=f.next;else this.head=f.next;if(f.next)f.next.prev=f.prev;else this.tail=f.prev;return f.prev=f.next=null,this.length-=1,f}empty(){while(this.head)this.shift();return this}insertAfter(f,d){if(d.prev=f,d.next=f.next,f.next)f.next.prev=d;else this.tail=d;f.next=d,this.length+=1}insertBefore(f,d){if(d.prev=f.prev,d.next=f,f.prev)f.prev.next=d;else this.head=d;f.prev=d,this.length+=1}unshift(f){if(this.head)this.insertBefore(this.head,f);else b1(this,f)}push(f){if(this.tail)this.insertAfter(this.tail,f);else b1(this,f)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){var f=this.head;while(f)yield f.data,f=f.next}remove(f){var d=this.head;while(d){var{next:r}=d;if(f(d))this.removeLink(d);d=r}return this}}function b1(f,d){f.length=1,f.head=f.tail=d}function i1(f,d,r){if(d==null)d=1;else if(d===0)throw RangeError("Concurrency must not be zero");var G0=M(f),F0=0,N0=[];let P0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function E0(z1,e0){P0[z1].push(e0)}function g0(z1,e0){let G1=(...n1)=>{Y1(z1,G1),e0(...n1)};P0[z1].push(G1)}function Y1(z1,e0){if(!z1)return Object.keys(P0).forEach((G1)=>P0[G1]=[]);if(!e0)return P0[z1]=[];P0[z1]=P0[z1].filter((G1)=>G1!==e0)}function f1(z1,...e0){P0[z1].forEach((G1)=>G1(...e0))}var r1=!1;function c1(z1,e0,G1,n1){if(n1!=null&&typeof n1!=="function")throw Error("task callback must be a function");s1.started=!0;var f4,f6;function S$(hY,...zG){if(hY)return G1?f6(hY):f4();if(zG.length<=1)return f4(zG[0]);f4(zG)}var eQ=s1._createTaskItem(z1,G1?S$:n1||S$);if(e0)s1._tasks.unshift(eQ);else s1._tasks.push(eQ);if(!r1)r1=!0,H(()=>{r1=!1,s1.process()});if(G1||!n1)return new Promise((hY,zG)=>{f4=hY,f6=zG})}function v$(z1){return function(e0,...G1){F0-=1;for(var n1=0,f4=z1.length;n1<f4;n1++){var f6=z1[n1],S$=N0.indexOf(f6);if(S$===0)N0.shift();else if(S$>0)N0.splice(S$,1);if(f6.callback(e0,...G1),e0!=null)f1("error",e0,f6.data)}if(F0<=s1.concurrency-s1.buffer)f1("unsaturated");if(s1.idle())f1("drain");s1.process()}}function aQ(z1){if(z1.length===0&&s1.idle())return H(()=>f1("drain")),!0;return!1}let SY=(z1)=>(e0)=>{if(!e0)return new Promise((G1,n1)=>{g0(z1,(f4,f6)=>{if(f4)return n1(f4);G1(f6)})});Y1(z1),E0(z1,e0)};var KG=!1,s1={_tasks:new x1,_createTaskItem(z1,e0){return{data:z1,callback:e0}},*[Symbol.iterator](){yield*s1._tasks[Symbol.iterator]()},concurrency:d,payload:r,buffer:d/4,started:!1,paused:!1,push(z1,e0){if(Array.isArray(z1)){if(aQ(z1))return;return z1.map((G1)=>c1(G1,!1,!1,e0))}return c1(z1,!1,!1,e0)},pushAsync(z1,e0){if(Array.isArray(z1)){if(aQ(z1))return;return z1.map((G1)=>c1(G1,!1,!0,e0))}return c1(z1,!1,!0,e0)},kill(){Y1(),s1._tasks.empty()},unshift(z1,e0){if(Array.isArray(z1)){if(aQ(z1))return;return z1.map((G1)=>c1(G1,!0,!1,e0))}return c1(z1,!0,!1,e0)},unshiftAsync(z1,e0){if(Array.isArray(z1)){if(aQ(z1))return;return z1.map((G1)=>c1(G1,!0,!0,e0))}return c1(z1,!0,!0,e0)},remove(z1){s1._tasks.remove(z1)},process(){if(KG)return;KG=!0;while(!s1.paused&&F0<s1.concurrency&&s1._tasks.length){var z1=[],e0=[],G1=s1._tasks.length;if(s1.payload)G1=Math.min(G1,s1.payload);for(var n1=0;n1<G1;n1++){var f4=s1._tasks.shift();z1.push(f4),N0.push(f4),e0.push(f4.data)}if(F0+=1,s1._tasks.length===0)f1("empty");if(F0===s1.concurrency)f1("saturated");var f6=h(v$(z1));G0(e0,f6)}KG=!1},length(){return s1._tasks.length},running(){return F0},workersList(){return N0},idle(){return s1._tasks.length+F0===0},pause(){s1.paused=!0},resume(){if(s1.paused===!1)return;s1.paused=!1,H(s1.process)}};return Object.defineProperties(s1,{saturated:{writable:!1,value:SY("saturated")},unsaturated:{writable:!1,value:SY("unsaturated")},empty:{writable:!1,value:SY("empty")},drain:{writable:!1,value:SY("drain")},error:{writable:!1,value:SY("error")}}),s1}function D0(f,d){return i1(f,1,d)}function I0(f,d,r){return i1(f,d,r)}function B(f,d,r,G0){G0=T(G0);var F0=M(r);return e(f,(N0,P0,E0)=>{F0(d,N0,(g0,Y1)=>{d=Y1,E0(g0)})},(N0)=>G0(N0,d))}var S=F(B,4);function u(...f){var d=f.map(M);return function(...r){var G0=this,F0=r[r.length-1];if(typeof F0=="function")r.pop();else F0=r0();return S(d,r,(N0,P0,E0)=>{P0.apply(G0,N0.concat((g0,...Y1)=>{E0(g0,Y1)}))},(N0,P0)=>F0(N0,...P0)),F0[R0]}}function s(...f){return u(...f.reverse())}function W0(f,d,r,G0){return O(n(d),f,r,G0)}var J0
Line truncated
|
||||
GFS4: `),console.error($)};if(!o4[Q8]){if($b=global[Q8]||[],uW0(o4,$b),o4.close=function($){function Y(U,Q){return $.call(o4,U,function(I){if(!I)fW0();if(typeof Q==="function")Q.apply(this,arguments)})}return Object.defineProperty(Y,oD,{value:$}),Y}(o4.close),o4.closeSync=function($){function Y(U){$.apply(o4,arguments),fW0()}return Object.defineProperty(Y,oD,{value:$}),Y}(o4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){uU(o4[Q8]),K0("assert").equal(o4[Q8].length,0)})}var $b;if(!global[Q8])uW0(global,o4[Q8]);Qb.exports=Yb(QJ1(o4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!o4.__patched)Qb.exports=Yb(o4),o4.__patched=!0;function Yb($){YJ1($),$.gracefulify=Yb,$.createReadStream=P,$.createWriteStream=T;var Y=$.readFile;$.readFile=U;function U(C,i,x){if(typeof i==="function")x=i,i=null;return h(C,i,x);function h(b,n,Q0,k){return Y(b,n,function(m){if(m&&(m.code==="EMFILE"||m.code==="ENFILE"))wK([h,[b,n,Q0],m,k||Date.now(),Date.now()]);else if(typeof Q0==="function")Q0.apply(this,arguments)})}}var Q=$.writeFile;$.writeFile=I;function I(C,i,x,h){if(typeof x==="function")h=x,x=null;return b(C,i,x,h);function b(n,Q0,k,m,a){return Q(n,Q0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))wK([b,[n,Q0,k,m],$0,a||Date.now(),Date.now()]);else if(typeof m==="function")m.apply(this,arguments)})}}var J=$.appendFile;if(J)$.appendFile=K;function K(C,i,x,h){if(typeof x==="function")h=x,x=null;return b(C,i,x,h);function b(n,Q0,k,m,a){return J(n,Q0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))wK([b,[n,Q0,k,m],$0,a||Date.now(),Date.now()]);else if(typeof m==="function")m.apply(this,arguments)})}}var z=$.copyFile;if(z)$.copyFile=G;function G(C,i,x,h){if(typeof x==="function")h=x,x=0;return b(C,i,x,h);function b(n,Q0,k,m,a){return z(n,Q0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))wK([b,[n,Q0,k,m],$0,a||Date.now(),Date.now()]);else if(typeof m==="function")m.apply(this,arguments)})}}var H=$.readdir;$.readdir=X;var W=/^v[0-5]\./;function X(C,i,x){if(typeof i==="function")x=i,i=null;var h=W.test(process.version)?function(Q0,k,m,a){return H(Q0,b(Q0,k,m,a))}:function(Q0,k,m,a){return H(Q0,k,b(Q0,k,m,a))};return h(C,i,x);function b(n,Q0,k,m){return function(a,$0){if(a&&(a.code==="EMFILE"||a.code==="ENFILE"))wK([h,[n,Q0,k],a,m||Date.now(),Date.now()]);else{if($0&&$0.sort)$0.sort();if(typeof k==="function")k.call(this,a,$0)}}}}if(process.version.substr(0,4)==="v0.8"){var Z=UJ1($);F=Z.ReadStream,O=Z.WriteStream}var q=$.ReadStream;if(q)F.prototype=Object.create(q.prototype),F.prototype.open=N;var V=$.WriteStream;if(V)O.prototype=Object.create(V.prototype),O.prototype.open=D;Object.defineProperty($,"ReadStream",{get:function(){return F},set:function(C){F=C},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return O},set:function(C){O=C},enumerable:!0,configurable:!0});var w=F;Object.defineProperty($,"FileReadStream",{get:function(){return w},set:function(C){w=C},enumerable:!0,configurable:!0});var M=O;Object.defineProperty($,"FileWriteStream",{get:function(){return M},set:function(C){M=C},enumerable:!0,configurable:!0});function F(C,i){if(this instanceof F)return q.apply(this,arguments),this;else return F.apply(Object.create(F.prototype),arguments)}function N(){var C=this;E(C.path,C.flags,C.mode,function(i,x){if(i){if(C.autoClose)C.destroy();C.emit("error",i)}else C.fd=x,C.emit("open",x),C.read()})}function O(C,i){if(this instanceof O)return V.apply(this,arguments),this;else return O.apply(Object.create(O.prototype),arguments)}function D(){var C=this;E(C.path,C.flags,C.mode,function(i,x){if(i)C.destroy(),C.emit("error",i);else C.fd=x,C.emit("open",x)})}function P(C,i){return new $.ReadStream(C,i)}function T(C,i){return new $.WriteStream(C,i)}var A=$.open;$.open=E;function E(C,i,x,h){if(typeof x==="function")h=x,x=null;return b(C,i,x,h);function b(n,Q0,k,m,a){return A(n,Q0,k,function($0,g){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))wK([b,[n,Q0,k,m],$0,a||Date.now(),Date.now()]);else if(typeof m==="function")m.apply(this,arguments)})}}return $}function wK($){uU("ENQUEUE",$[0].name,$[1]),o4[Q8].push($),Ub()}var lD;function fW0(){var $=Date.now();for(var Y=0;Y<o4[Q8].length;++Y)if(o4[Q8][Y].length>2)o4[Q8][Y][3]=$,o4[Q8][Y][4]=$;Ub()}function Ub(){if(clearTimeout(lD),lD=void 0,o4[Q8].length===0)return;var $=o4[Q8].shift(),Y=$[0],U=$[1],Q=$[2],I=$[3],J=$[4];if(I===void 0)uU("RETRY",Y.name,U),Y.apply(null,U);else if(Date.now()-I>=60000){uU("TIMEOUT",Y.name,U);var K=U.pop();if(typeof K==="function")K.call(null,Q)}else{var z=Date.now()-J,G=Math.max(J-I,1),H=Math.min(G*1.2,100);if(z>=H)uU("RETRY",Y.name,U),Y.apply(null,U.concat([I]));else o4[Q8].push($)}if(lD===void 0)lD=setTimeout(Ub,0)}});var iW0=j((ia1,Ib)=>{function JJ1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var bW0=Z6().Buffer,XX=K0("util");function KJ1($,Y,U){$.copy(Y,U)}Ib.exports=function(){function $(){JJ1(this,$),this.h
Line truncated
|
||||
`+p);let[,H0]=r;return H0.replace(/\s/g,"").split(O0).map((w0)=>w0.replace(u0,"").trim())}function O1(f,p){var r={};return Object.keys(f).forEach((H0)=>{var w0=f[H0],D0,A0=q(w0),j0=!A0&&w0.length===1||A0&&w0.length===0;if(Array.isArray(w0))D0=[...w0],w0=D0.pop(),r[H0]=D0.concat(D0.length>0?g0:w0);else if(j0)r[H0]=w0;else{if(D0=n0(w0),w0.length===0&&!A0&&D0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!A0)D0.pop();r[H0]=D0.concat(g0)}function g0(Y1,u1){var s1=D0.map((n1)=>Y1[n1]);s1.push(u1),M(w0)(...s1)}}),X1(r,p)}class r1{constructor(){this.head=this.tail=null,this.length=0}removeLink(f){if(f.prev)f.prev.next=f.next;else this.head=f.next;if(f.next)f.next.prev=f.prev;else this.tail=f.prev;return f.prev=f.next=null,this.length-=1,f}empty(){while(this.head)this.shift();return this}insertAfter(f,p){if(p.prev=f,p.next=f.next,f.next)f.next.prev=p;else this.tail=p;f.next=p,this.length+=1}insertBefore(f,p){if(p.prev=f.prev,p.next=f,f.prev)f.prev.next=p;else this.head=p;f.prev=p,this.length+=1}unshift(f){if(this.head)this.insertBefore(this.head,f);else c1(this,f)}push(f){if(this.tail)this.insertAfter(this.tail,f);else c1(this,f)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){var f=this.head;while(f)yield f.data,f=f.next}remove(f){var p=this.head;while(p){var{next:r}=p;if(f(p))this.removeLink(p);p=r}return this}}function c1(f,p){f.length=1,f.head=f.tail=p}function C1(f,p,r){if(p==null)p=1;else if(p===0)throw RangeError("Concurrency must not be zero");var H0=M(f),w0=0,D0=[];let A0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function j0(z1,e0){A0[z1].push(e0)}function g0(z1,e0){let H1=(...p1)=>{Y1(z1,H1),e0(...p1)};A0[z1].push(H1)}function Y1(z1,e0){if(!z1)return Object.keys(A0).forEach((H1)=>A0[H1]=[]);if(!e0)return A0[z1]=[];A0[z1]=A0[z1].filter((H1)=>H1!==e0)}function u1(z1,...e0){A0[z1].forEach((H1)=>H1(...e0))}var s1=!1;function n1(z1,e0,H1,p1){if(p1!=null&&typeof p1!=="function")throw Error("task callback must be a function");a1.started=!0;var u4,b6;function S$(SY,...GH){if(SY)return H1?b6(SY):u4();if(GH.length<=1)return u4(GH[0]);u4(GH)}var $I=a1._createTaskItem(z1,H1?S$:p1||S$);if(e0)a1._tasks.unshift($I);else a1._tasks.push($I);if(!s1)s1=!0,G(()=>{s1=!1,a1.process()});if(H1||!p1)return new Promise((SY,GH)=>{u4=SY,b6=GH})}function h$(z1){return function(e0,...H1){w0-=1;for(var p1=0,u4=z1.length;p1<u4;p1++){var b6=z1[p1],S$=D0.indexOf(b6);if(S$===0)D0.shift();else if(S$>0)D0.splice(S$,1);if(b6.callback(e0,...H1),e0!=null)u1("error",e0,b6.data)}if(w0<=a1.concurrency-a1.buffer)u1("unsaturated");if(a1.idle())u1("drain");a1.process()}}function eQ(z1){if(z1.length===0&&a1.idle())return G(()=>u1("drain")),!0;return!1}let hY=(z1)=>(e0)=>{if(!e0)return new Promise((H1,p1)=>{g0(z1,(u4,b6)=>{if(u4)return p1(u4);H1(b6)})});Y1(z1),j0(z1,e0)};var HH=!1,a1={_tasks:new r1,_createTaskItem(z1,e0){return{data:z1,callback:e0}},*[Symbol.iterator](){yield*a1._tasks[Symbol.iterator]()},concurrency:p,payload:r,buffer:p/4,started:!1,paused:!1,push(z1,e0){if(Array.isArray(z1)){if(eQ(z1))return;return z1.map((H1)=>n1(H1,!1,!1,e0))}return n1(z1,!1,!1,e0)},pushAsync(z1,e0){if(Array.isArray(z1)){if(eQ(z1))return;return z1.map((H1)=>n1(H1,!1,!0,e0))}return n1(z1,!1,!0,e0)},kill(){Y1(),a1._tasks.empty()},unshift(z1,e0){if(Array.isArray(z1)){if(eQ(z1))return;return z1.map((H1)=>n1(H1,!0,!1,e0))}return n1(z1,!0,!1,e0)},unshiftAsync(z1,e0){if(Array.isArray(z1)){if(eQ(z1))return;return z1.map((H1)=>n1(H1,!0,!0,e0))}return n1(z1,!0,!0,e0)},remove(z1){a1._tasks.remove(z1)},process(){if(HH)return;HH=!0;while(!a1.paused&&w0<a1.concurrency&&a1._tasks.length){var z1=[],e0=[],H1=a1._tasks.length;if(a1.payload)H1=Math.min(H1,a1.payload);for(var p1=0;p1<H1;p1++){var u4=a1._tasks.shift();z1.push(u4),D0.push(u4),e0.push(u4.data)}if(w0+=1,a1._tasks.length===0)u1("empty");if(w0===a1.concurrency)u1("saturated");var b6=S(h$(z1));H0(e0,b6)}HH=!1},length(){return a1._tasks.length},running(){return w0},workersList(){return D0},idle(){return a1._tasks.length+w0===0},pause(){a1.paused=!0},resume(){if(a1.paused===!1)return;a1.paused=!1,G(a1.process)}};return Object.defineProperties(a1,{saturated:{writable:!1,value:hY("saturated")},unsaturated:{writable:!1,value:hY("unsaturated")},empty:{writable:!1,value:hY("empty")},drain:{writable:!1,value:hY("drain")},error:{writable:!1,value:hY("error")}}),a1}function N0(f,p){return C1(f,1,p)}function a(f,p,r){return C1(f,p,r)}function T(f,p,r,H0){H0=A(H0);var w0=M(r);return $0(f,(D0,A0,j0)=>{w0(p,D0,(g0,Y1)=>{p=Y1,j0(g0)})},(D0)=>H0(D0,p))}var v=F(T,4);function c(...f){var p=f.map(M);return function(...r){var H0=this,w0=r[r.length-1];if(typeof w0=="function")r.pop();else w0=r0();return v(p,r,(D0,A0,j0)=>{A0.apply(H0,D0.concat((g0,...Y1)=>{j0(g0,Y1)}))},(D0,A0)=>w0(D0,...A0)),w0[R0]}}function s(...f){return c(...f.reverse())}function X0(f,p,r,H0){return O(n(p),f,r,H0)}var K0
Line truncated
|
||||
GFS4: `),console.error($)};if(!s4[J8]){if(Eb=global[J8]||[],hX0(s4,Eb),s4.close=function($){function Y(U,Q){return $.call(s4,U,function(I){if(!I)vX0();if(typeof Q==="function")Q.apply(this,arguments)})}return Object.defineProperty(Y,VP,{value:$}),Y}(s4.close),s4.closeSync=function($){function Y(U){$.apply(s4,arguments),vX0()}return Object.defineProperty(Y,VP,{value:$}),Y}(s4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){cU(s4[J8]),z0("assert").equal(s4[J8].length,0)})}var Eb;if(!global[J8])hX0(global,s4[J8]);_b.exports=Cb(FK1(s4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!s4.__patched)_b.exports=Cb(s4),s4.__patched=!0;function Cb($){LK1($),$.gracefulify=Cb,$.createReadStream=B,$.createWriteStream=A;var Y=$.readFile;$.readFile=U;function U(C,u,x){if(typeof u==="function")x=u,u=null;return S(C,u,x);function S(b,n,I0,k){return Y(b,n,function(m){if(m&&(m.code==="EMFILE"||m.code==="ENFILE"))PK([S,[b,n,I0],m,k||Date.now(),Date.now()]);else if(typeof I0==="function")I0.apply(this,arguments)})}}var Q=$.writeFile;$.writeFile=I;function I(C,u,x,S){if(typeof x==="function")S=x,x=null;return b(C,u,x,S);function b(n,I0,k,m,e){return Q(n,I0,k,function(Y0){if(Y0&&(Y0.code==="EMFILE"||Y0.code==="ENFILE"))PK([b,[n,I0,k,m],Y0,e||Date.now(),Date.now()]);else if(typeof m==="function")m.apply(this,arguments)})}}var J=$.appendFile;if(J)$.appendFile=K;function K(C,u,x,S){if(typeof x==="function")S=x,x=null;return b(C,u,x,S);function b(n,I0,k,m,e){return J(n,I0,k,function(Y0){if(Y0&&(Y0.code==="EMFILE"||Y0.code==="ENFILE"))PK([b,[n,I0,k,m],Y0,e||Date.now(),Date.now()]);else if(typeof m==="function")m.apply(this,arguments)})}}var z=$.copyFile;if(z)$.copyFile=H;function H(C,u,x,S){if(typeof x==="function")S=x,x=0;return b(C,u,x,S);function b(n,I0,k,m,e){return z(n,I0,k,function(Y0){if(Y0&&(Y0.code==="EMFILE"||Y0.code==="ENFILE"))PK([b,[n,I0,k,m],Y0,e||Date.now(),Date.now()]);else if(typeof m==="function")m.apply(this,arguments)})}}var G=$.readdir;$.readdir=X;var W=/^v[0-5]\./;function X(C,u,x){if(typeof u==="function")x=u,u=null;var S=W.test(process.version)?function(I0,k,m,e){return G(I0,b(I0,k,m,e))}:function(I0,k,m,e){return G(I0,k,b(I0,k,m,e))};return S(C,u,x);function b(n,I0,k,m){return function(e,Y0){if(e&&(e.code==="EMFILE"||e.code==="ENFILE"))PK([S,[n,I0,k],e,m||Date.now(),Date.now()]);else{if(Y0&&Y0.sort)Y0.sort();if(typeof k==="function")k.call(this,e,Y0)}}}}if(process.version.substr(0,4)==="v0.8"){var Z=wK1($);F=Z.ReadStream,O=Z.WriteStream}var q=$.ReadStream;if(q)F.prototype=Object.create(q.prototype),F.prototype.open=D;var V=$.WriteStream;if(V)O.prototype=Object.create(V.prototype),O.prototype.open=N;Object.defineProperty($,"ReadStream",{get:function(){return F},set:function(C){F=C},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return O},set:function(C){O=C},enumerable:!0,configurable:!0});var w=F;Object.defineProperty($,"FileReadStream",{get:function(){return w},set:function(C){w=C},enumerable:!0,configurable:!0});var M=O;Object.defineProperty($,"FileWriteStream",{get:function(){return M},set:function(C){M=C},enumerable:!0,configurable:!0});function F(C,u){if(this instanceof F)return q.apply(this,arguments),this;else return F.apply(Object.create(F.prototype),arguments)}function D(){var C=this;j(C.path,C.flags,C.mode,function(u,x){if(u){if(C.autoClose)C.destroy();C.emit("error",u)}else C.fd=x,C.emit("open",x),C.read()})}function O(C,u){if(this instanceof O)return V.apply(this,arguments),this;else return O.apply(Object.create(O.prototype),arguments)}function N(){var C=this;j(C.path,C.flags,C.mode,function(u,x){if(u)C.destroy(),C.emit("error",u);else C.fd=x,C.emit("open",x)})}function B(C,u){return new $.ReadStream(C,u)}function A(C,u){return new $.WriteStream(C,u)}var P=$.open;$.open=j;function j(C,u,x,S){if(typeof x==="function")S=x,x=null;return b(C,u,x,S);function b(n,I0,k,m,e){return P(n,I0,k,function(Y0,g){if(Y0&&(Y0.code==="EMFILE"||Y0.code==="ENFILE"))PK([b,[n,I0,k,m],Y0,e||Date.now(),Date.now()]);else if(typeof m==="function")m.apply(this,arguments)})}}return $}function PK($){cU("ENQUEUE",$[0].name,$[1]),s4[J8].push($),Rb()}var qP;function vX0(){var $=Date.now();for(var Y=0;Y<s4[J8].length;++Y)if(s4[J8][Y].length>2)s4[J8][Y][3]=$,s4[J8][Y][4]=$;Rb()}function Rb(){if(clearTimeout(qP),qP=void 0,s4[J8].length===0)return;var $=s4[J8].shift(),Y=$[0],U=$[1],Q=$[2],I=$[3],J=$[4];if(I===void 0)cU("RETRY",Y.name,U),Y.apply(null,U);else if(Date.now()-I>=60000){cU("TIMEOUT",Y.name,U);var K=U.pop();if(typeof K==="function")K.call(null,Q)}else{var z=Date.now()-J,H=Math.max(J-I,1),G=Math.min(H*1.2,100);if(z>=G)cU("RETRY",Y.name,U),Y.apply(null,U.concat([I]));else s4[J8].push($)}if(qP===void 0)qP=setTimeout(Rb,0)}});var gX0=E((w04,vb)=>{function OK1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var SX0=L6().Buffer,BX=z0("util");function DK1($,Y,U){$.copy(Y,U)}vb.exports=function(){function $(){OK1(this,$),this.h
Line truncated
|
||||
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
||||
*
|
||||
* Copyright (c) 2014-2018, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/jX0.exports=function($,Y){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var U=$.length;if(U<=1)return $;var Q="";if(U>4&&$[3]==="\\"){var I=$[2];if((I==="?"||I===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),Q="//"}var J=$.split(/[/\\]+/);if(Y!==!1&&J[J.length-1]==="")J.pop();return Q+J.join("/")}});var Bb=j((ea1,gX0)=>{var RX0=9007199254740991,ZK1="[object Arguments]",qK1="[object Function]",VK1="[object GeneratorFunction]",LK1=/^(?:0|[1-9]\d*)$/;function _X0($,Y,U){switch(U.length){case 0:return $.call(Y);case 1:return $.call(Y,U[0]);case 2:return $.call(Y,U[0],U[1]);case 3:return $.call(Y,U[0],U[1],U[2])}return $.apply(Y,U)}function FK1($,Y){var U=-1,Q=Array($);while(++U<$)Q[U]=Y(U);return Q}var NX=Object.prototype,DX=NX.hasOwnProperty,vX0=NX.toString,wK1=NX.propertyIsEnumerable,CX0=Math.max;function MK1($,Y){var U=CK1($)||jK1($)?FK1($.length,String):[],Q=U.length,I=!!Q;for(var J in $)if((Y||DX.call($,J))&&!(I&&(J=="length"||hX0(J,Q))))U.push(J);return U}function OK1($,Y,U,Q){if($===void 0||Nb($,NX[U])&&!DX.call(Q,U))return Y;return $}function NK1($,Y,U){var Q=$[Y];if(!(DX.call($,Y)&&Nb(Q,U))||U===void 0&&!(Y in $))$[Y]=U}function DK1($){if(!Ab($))return EK1($);var Y=TK1($),U=[];for(var Q in $)if(!(Q=="constructor"&&(Y||!DX.call($,Q))))U.push(Q);return U}function SX0($,Y){return Y=CX0(Y===void 0?$.length-1:Y,0),function(){var U=arguments,Q=-1,I=CX0(U.length-Y,0),J=Array(I);while(++Q<I)J[Q]=U[Y+Q];Q=-1;var K=Array(Y+1);while(++Q<Y)K[Q]=U[Q];return K[Y]=J,_X0($,this,K)}}function AK1($,Y,U,Q){U||(U={});var I=-1,J=Y.length;while(++I<J){var K=Y[I],z=Q?Q(U[K],$[K],K,U,$):void 0;NK1(U,K,z===void 0?$[K]:z)}return U}function BK1($){return SX0(function(Y,U){var Q=-1,I=U.length,J=I>1?U[I-1]:void 0,K=I>2?U[2]:void 0;if(J=$.length>3&&typeof J=="function"?(I--,J):void 0,K&&PK1(U[0],U[1],K))J=I<3?void 0:J,I=1;Y=Object(Y);while(++Q<I){var z=U[Q];if(z)$(Y,z,Q,J)}return Y})}function hX0($,Y){return Y=Y==null?RX0:Y,!!Y&&(typeof $=="number"||LK1.test($))&&($>-1&&$%1==0&&$<Y)}function PK1($,Y,U){if(!Ab(U))return!1;var Q=typeof Y;if(Q=="number"?Db(U)&&hX0(Y,U.length):Q=="string"&&(Y in U))return Nb(U[Y],$);return!1}function TK1($){var Y=$&&$.constructor,U=typeof Y=="function"&&Y.prototype||NX;return $===U}function EK1($){var Y=[];if($!=null)for(var U in Object($))Y.push(U);return Y}function Nb($,Y){return $===Y||$!==$&&Y!==Y}function jK1($){return RK1($)&&DX.call($,"callee")&&(!wK1.call($,"callee")||vX0.call($)==ZK1)}var CK1=Array.isArray;function Db($){return $!=null&&vK1($.length)&&!_K1($)}function RK1($){return SK1($)&&Db($)}function _K1($){var Y=Ab($)?vX0.call($):"";return Y==qK1||Y==VK1}function vK1($){return typeof $=="number"&&$>-1&&$%1==0&&$<=RX0}function Ab($){var Y=typeof $;return!!$&&(Y=="object"||Y=="function")}function SK1($){return!!$&&typeof $=="object"}var hK1=BK1(function($,Y,U,Q){AK1(Y,yK1(Y),$,Q)}),gK1=SX0(function($){return $.push(void 0,OK1),_X0(hK1,void 0,$)});function yK1($){return Db($)?MK1($,!0):DK1($)}gX0.exports=gK1});var kX0=j(($e1,Pb)=>{function kK1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var yX0=Z6().Buffer,AX=K0("util");function xK1($,Y,U){$.copy(Y,U)}Pb.exports=function(){function $(){kK1(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(U){var Q={data:U,next:null};if(this.length>0)this.tail.next=Q;else this.head=Q;this.tail=Q,++this.length},$.prototype.unshift=function(U){var Q={data:U,next:this.head};if(this.length===0)this.tail=Q;this.head=Q,++this.length},$.prototype.shift=function(){if(this.length===0)return;var U=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,U},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(U){if(this.length===0)return"";var Q=this.head,I=""+Q.data;while(Q=Q.next)I+=U+Q.data;return I},$.prototype.concat=function(U){if(this.length===0)return yX0.alloc(0);var Q=yX0.allocUnsafe(U>>>0),I=this.head,J=0;while(I)xK1(I.data,Q,J),J+=I.data.length,I=I.next;return Q},$}();if(AX&&AX.inspect&&AX.inspect.custom)Pb.exports.prototype[AX.inspect.custom]=function(){var $=AX.inspect({length:this.length});return this.constructor.name+" "+$}});var Tb=j((Ye1,xX0)=>{var zA=X6();function fK1($,Y){var U=this,Q=this._readableState&&this._readableState.destroyed,I=this._writableState&&this._writableState.destroyed;if(Q||I){if(Y)Y($);else if($){if(!this._writableState)zA.nextTick(GA,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,zA.nextTick(GA,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(J){if(!Y&&J){if(!U._writableState)zA.nextTick(GA,U,J);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,zA.nextTick(GA,U,J)}else if(Y)Y(J)}),this}function uK1(){if(this._readableState)this._readabl
Line truncated
|
||||
%s`,P,P,N,Q);var T=N.type==="*"?Hi:N.type==="?"?Gi:"\\"+N.type;I=!0,Q=Q.slice(0,N.reStart)+T+"\\("+P}if(V(),J)Q+="\\\\";var A=!1;switch(Q.charAt(0)){case"[":case".":case"(":A=!0}for(var E=z.length-1;E>-1;E--){var C=z[E],i=Q.slice(0,C.reStart),x=Q.slice(C.reStart,C.reEnd-8),h=Q.slice(C.reEnd-8,C.reEnd),b=Q.slice(C.reEnd);h+=b;var n=i.split("(").length-1,Q0=b;for(w=0;w<n;w++)Q0=Q0.replace(/\)[+*?]?/,"");b=Q0;var k="";if(b===""&&Y!==PA)k="$";var m=i+x+b+k+h;Q=m}if(Q!==""&&I)Q="(?=.)"+Q;if(A)Q=Z+Q;if(Y===PA)return[Q,I];if(!I)return IX1($);var a=U.nocase?"i":"";try{var $0=new RegExp("^"+Q+"$",a)}catch(g){return new RegExp("$.")}return $0._glob=$,$0._src=Q,$0}D$.makeRe=function($,Y){return new N6($,Y||{}).makeRe()};N6.prototype.makeRe=QX1;function QX1(){if(this.regexp||this.regexp===!1)return this.regexp;var $=this.set;if(!$.length)return this.regexp=!1,this.regexp;var Y=this.options,U=Y.noglobstar?Hi:Y.dot?rW1:sW1,Q=Y.nocase?"i":"",I=$.map(function(J){return J.map(function(K){return K===oU?U:typeof K==="string"?JX1(K):K._src}).join("\\/")}).join("|");if(I="^(?:"+I+")$",this.negate)I="^(?!"+I+").*$";try{this.regexp=new RegExp(I,Q)}catch(J){this.regexp=!1}return this.regexp}D$.match=function($,Y,U){U=U||{};var Q=new N6(Y,U);if($=$.filter(function(I){return Q.match(I)}),Q.options.nonull&&!$.length)$.push(Y);return $};N6.prototype.match=function(Y,U){if(typeof U>"u")U=this.partial;if(this.debug("match",Y,this.pattern),this.comment)return!1;if(this.empty)return Y==="";if(Y==="/"&&U)return!0;var Q=this.options;if(gX.sep!=="/")Y=Y.split(gX.sep).join("/");Y=Y.split(Fq0),this.debug(this.pattern,"split",Y);var I=this.set;this.debug(this.pattern,"set",I);var J,K;for(K=Y.length-1;K>=0;K--)if(J=Y[K],J)break;for(K=0;K<I.length;K++){var z=I[K],G=Y;if(Q.matchBase&&z.length===1)G=[J];var H=this.matchOne(G,z,U);if(H){if(Q.flipNegate)return!0;return!this.negate}}if(Q.flipNegate)return!1;return this.negate};N6.prototype.matchOne=function($,Y,U){if(Y.indexOf(oU)!==-1)return this._matchGlobstar($,Y,U,0,0);return this._matchOne($,Y,U,0,0)};N6.prototype._matchGlobstar=function($,Y,U,Q,I){var J,K=-1;for(J=I;J<Y.length;J++)if(Y[J]===oU){K=J;break}var z=-1;for(J=Y.length-1;J>=0;J--)if(Y[J]===oU){z=J;break}var G=Y.slice(I,K),H=U?Y.slice(K+1):Y.slice(K+1,z),W=U?[]:Y.slice(z+1);if(G.length){var X=$.slice(Q,Q+G.length);if(!this._matchOne(X,G,U,0,0))return!1;Q+=G.length}var Z=0;if(W.length){if(W.length+Q>$.length)return!1;var q=$.length-W.length;if(this._matchOne($,W,U,q,0))Z=W.length;else{if($[$.length-1]!==""||Q+W.length===$.length)return!1;if(q--,!this._matchOne($,W,U,q,0))return!1;Z=W.length+1}}if(!H.length){var V=!!Z;for(J=Q;J<$.length-Z;J++){var w=String($[J]);if(V=!0,w==="."||w===".."||!this.options.dot&&w.charAt(0)===".")return!1}return U||V}var M=[[[],0]],F=M[0],N=0,O=[0];for(var D=0;D<H.length;D++){var P=H[D];if(P===oU)O.push(N),F=[[],0],M.push(F);else F[0].push(P),N++}var T=M.length-1,A=$.length-Z;for(var E=0;E<M.length;E++)M[E][1]=A-(O[T--]+M[E][0].length);return!!this._matchGlobStarBodySections($,M,Q,0,U,0,!!Z)};N6.prototype._matchGlobStarBodySections=function($,Y,U,Q,I,J,K){var z=Y[Q];if(!z){for(var G=U;G<$.length;G++){K=!0;var H=$[G];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1}return K}var W=z[0],X=z[1];while(U<=X){var Z=this._matchOne($.slice(0,U+W.length),W,I,U,0);if(Z&&J<this.maxGlobstarRecursion){var q=this._matchGlobStarBodySections($,Y,U+W.length,Q+1,I,J+1,K);if(q!==!1)return q}var H=$[U];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1;U++}return I||null};N6.prototype._matchOne=function($,Y,U,Q,I){var J,K,z,G;for(J=Q,K=I,z=$.length,G=Y.length;J<z&&K<G;J++,K++){this.debug("matchOne loop");var H=Y[K],W=$[J];if(this.debug(Y,H,W),H===!1||H===oU)return!1;var X;if(typeof H==="string")X=W===H,this.debug("string match",H,W,X);else X=W.match(H),this.debug("pattern match",H,W,X);if(!X)return!1}if(J===z&&K===G)return!0;else if(J===z)return U;else if(K===G)return J===z-1&&$[J]==="";throw Error("wtf?")};function IX1($){return $.replace(/\\(.)/g,"$1")}function JX1($){return $.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var CA=j((De1,jA)=>{function Oq0($){return $.charAt(0)==="/"}function Nq0($){var Y=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,U=Y.exec($),Q=U[1]||"",I=Boolean(Q&&Q.charAt(1)!==":");return Boolean(U[2]||I)}jA.exports=process.platform==="win32"?Nq0:Oq0;jA.exports.posix=Oq0;jA.exports.win32=Nq0});var Xi=j((LX1)=>{LX1.setopts=XX1;LX1.ownProp=Dq0;LX1.makeAbs=yX;LX1.finish=ZX1;LX1.mark=qX1;LX1.isIgnored=Bq0;LX1.childrenIgnored=VX1;function Dq0($,Y){return Object.prototype.hasOwnProperty.call($,Y)}var KX1=K0("fs"),_K=K0("path"),zX1=EA(),Aq0=CA(),Wi=zX1.Minimatch;function GX1($,Y){return $.localeCompare(Y,"en")}function HX1($,Y){if($.ignore=Y.ignore||[],!Array.isArray($.ignore))$.ignore=[$.ignore];if($.ignore.length)$.ignore=$.ignore.map(WX1)}function WX1($){var Y=null;if($.slice(-3)==="/**"){var U=$.replace(/(\/\*\*)+$/,"");Y=new Wi(U,{dot:!0})}return{ma
Line truncated
|
||||
See: https://github.com/isaacs/node-glob/issues/167`);return new v6($,Y).found}function v6($,Y){if(!$)throw Error("must provide pattern");if(typeof Y==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
|
||||
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof v6))return new v6($,Y);if(PX1(this,$,Y),this.noprocess)return this;var U=this.minimatch.set.length;this.matches=Array(U);for(var Q=0;Q<U;Q++)this._process(this.minimatch.set[Q],Q,!1);this._finish()}v6.prototype._finish=function(){if(Tq0.ok(this instanceof v6),this.realpath){var $=this;this.matches.forEach(function(Y,U){var Q=$.matches[U]=Object.create(null);for(var I in Y)try{I=$._makeAbs(I);var J=BX1.realpathSync(I,$.realpathCache);Q[J]=!0}catch(K){if(K.syscall==="stat")Q[$._makeAbs(I)]=!0;else throw K}})}rU.finish(this)};v6.prototype._process=function($,Y,U){Tq0.ok(this instanceof v6);var Q=0;while(typeof $[Q]==="string")Q++;var I;switch(Q){case $.length:this._processSimple($.join("/"),Y);return;case 0:I=null;break;default:I=$.slice(0,Q).join("/");break}var J=$.slice(Q),K;if(I===null)K=".";else if(RA(I)||RA($.map(function(H){return typeof H==="string"?H:"[*]"}).join("/"))){if(!I||!RA(I))I="/"+I;K=I}else K=I;var z=this._makeAbs(K);if(TX1(this,K))return;var G=J[0]===Pq0.GLOBSTAR;if(G)this._processGlobStar(I,K,z,J,Y,U);else this._processReaddir(I,K,z,J,Y,U)};v6.prototype._processReaddir=function($,Y,U,Q,I,J){var K=this._readdir(U,J);if(!K)return;var z=Q[0],G=!!this.minimatch.negate,H=z._glob,W=this.dot||H.charAt(0)===".",X=[];for(var Z=0;Z<K.length;Z++){var q=K[Z];if(q.charAt(0)!=="."||W){var V;if(G&&!$)V=!q.match(z);else V=q.match(z);if(V)X.push(q)}}var w=X.length;if(w===0)return;if(Q.length===1&&!this.mark&&!this.stat){if(!this.matches[I])this.matches[I]=Object.create(null);for(var Z=0;Z<w;Z++){var q=X[Z];if($)if($.slice(-1)!=="/")q=$+"/"+q;else q=$+q;if(q.charAt(0)==="/"&&!this.nomount)q=Zi.join(this.root,q);this._emitMatch(I,q)}return}Q.shift();for(var Z=0;Z<w;Z++){var q=X[Z],M;if($)M=[$,q];else M=[q];this._process(M.concat(Q),I,J)}};v6.prototype._emitMatch=function($,Y){if(EX1(this,Y))return;var U=this._makeAbs(Y);if(this.mark)Y=this._mark(Y);if(this.absolute)Y=U;if(this.matches[$][Y])return;if(this.nodir){var Q=this.cache[U];if(Q==="DIR"||Array.isArray(Q))return}if(this.matches[$][Y]=!0,this.stat)this._stat(Y)};v6.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var Y,U,Q;try{U=this.fs.lstatSync($)}catch(J){if(J.code==="ENOENT")return null}var I=U&&U.isSymbolicLink();if(this.symlinks[$]=I,!I&&U&&!U.isDirectory())this.cache[$]="FILE";else Y=this._readdir($,!1);return Y};v6.prototype._readdir=function($,Y){var U;if(Y&&!qi(this.symlinks,$))return this._readdirInGlobStar($);if(qi(this.cache,$)){var Q=this.cache[$];if(!Q||Q==="FILE")return null;if(Array.isArray(Q))return Q}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(I){return this._readdirError($,I),null}};v6.prototype._readdirEntries=function($,Y){if(!this.mark&&!this.stat)for(var U=0;U<Y.length;U++){var Q=Y[U];if($==="/")Q=$+Q;else Q=$+"/"+Q;this.cache[Q]=!0}return this.cache[$]=Y,Y};v6.prototype._readdirError=function($,Y){switch(Y.code){case"ENOTSUP":case"ENOTDIR":var U=this._makeAbs($);if(this.cache[U]="FILE",U===this.cwdAbs){var Q=Error(Y.code+" invalid cwd "+this.cwd);throw Q.path=this.cwd,Q.code=Y.code,Q}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs($)]=!1;break;default:if(this.cache[this._makeAbs($)]=!1,this.strict)throw Y;if(!this.silent)console.error("glob error",Y);break}};v6.prototype._processGlobStar=function($,Y,U,Q,I,J){var K=this._readdir(U,J);if(!K)return;var z=Q.slice(1),G=$?[$]:[],H=G.concat(z);this._process(H,I,!1);var W=K.length,X=this.symlinks[U];if(X&&J)return;for(var Z=0;Z<W;Z++){var q=K[Z];if(q.charAt(0)==="."&&!this.dot)continue;var V=G.concat(K[Z],z);this._process(V,I,!0);var w=G.concat(K[Z],Q);this._process(w,I,!0)}};v6.prototype._processSimple=function($,Y){var U=this._stat($);if(!this.matches[Y])this.matches[Y]=Object.create(null);if(!U)return;if($&&RA($)&&!this.nomount){var Q=/[\/\\]$/.test($);if($.charAt(0)==="/")$=Zi.join(this.root,$);else if($=Zi.resolve(this.root,$),Q)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(Y,$)};v6.prototype._stat=function($){var Y=this._makeAbs($),U=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&qi(this.cache,Y)){var K=this.cache[Y];if(Array.isArray(K))K="DIR";if(!U||K==="DIR")return K;if(U&&K==="FILE")return!1}var Q,I=this.statCache[Y];if(!I){var J;try{J=this.fs.lstatSync(Y)}catch(z){if(z&&(z.code==="ENOENT"||z.code==="ENOTDIR"))return this.statCache[Y]=!1,!1}if(J&&J.isSymbolicLink())try{I=this.fs.statSync(Y)}catch(z){I=J}else I=J}this.statCache[Y]=I;var K=!0;if(I)K=I.isDirectory()?"DIR":"FILE";if(this.cache[Y]=this.cache[Y]||K,U&&K==="FILE")return!1;return K};v6.prototype._mark=function($){return rU.mark(this,$)};v6.prototype._makeAbs=function($){return rU.makeAbs(this,$)}});var Vi=j((je1,_q0)=>{_q0.exports=Rq0;function Rq0($,Y){if($&&Y)return Rq0($)(Y);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(Q){U[Q]=$[Q]}),U;f
Line truncated
|
||||
`);if($.linkname)Y+=Zc(" linkpath="+$.linkname+`
|
||||
`);var U=$.pax;if(U)for(var Q in U)Y+=Zc(" "+Q+"="+U[Q]+`
|
||||
`);return Buffer.from(Y)};kV1.decodePax=function($){var Y={};while($.length){var U=0;while(U<$.length&&$[U]!==32)U++;var Q=parseInt($.slice(0,U).toString(),10);if(!Q)return Y;var I=$.slice(U+1,Q-1).toString(),J=I.indexOf("=");if(J===-1)return Y;Y[I.slice(0,J)]=I.slice(J+1),$=$.slice(Q)}return Y};kV1.encode=function($){var Y=TV1(512),U=$.name,Q="";if($.typeflag===5&&U[U.length-1]!=="/")U+="/";if(Buffer.byteLength(U)!==U.length)return null;while(Buffer.byteLength(U)>100){var I=U.indexOf("/");if(I===-1)return null;Q+=Q?"/"+U.slice(0,I):U.slice(0,I),U=U.slice(I+1)}if(Buffer.byteLength(U)>100||Buffer.byteLength(Q)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(Y.write(U),Y.write(y2($.mode&vV1,6),100),Y.write(y2($.uid,6),108),Y.write(y2($.gid,6),116),Y.write(y2($.size,11),124),Y.write(y2($.mtime.getTime()/1000|0,11),136),Y[156]=dL0+gV1($.type),$.linkname)Y.write($.linkname,157);if(pL0.copy(Y,tX),CV1.copy(Y,qc),$.uname)Y.write($.uname,265);if($.gname)Y.write($.gname,297);if(Y.write(y2($.devmajor||0,6),329),Y.write(y2($.devminor||0,6),337),Q)Y.write(Q,345);return Y.write(y2(lL0(Y),6),148),Y};kV1.decode=function($,Y,U){var Q=$[156]===0?0:$[156]-dL0,I=uK($,0,100,Y),J=k2($,100,8),K=k2($,108,8),z=k2($,116,8),G=k2($,124,12),H=k2($,136,12),W=hV1(Q),X=$[157]===0?null:uK($,157,100,Y),Z=uK($,265,32),q=uK($,297,32),V=k2($,329,8),w=k2($,337,8),M=lL0($);if(M===256)return null;if(M!==k2($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(pL0.compare($,tX,tX+6)===0){if($[345])I=uK($,345,155,Y)+"/"+I}else if(RV1.compare($,tX,tX+6)===0&&_V1.compare($,qc,qc+2)===0);else if(!U)throw Error("Invalid tar header: unknown format.");if(Q===0&&I&&I[I.length-1]==="/")Q=5;return{name:I,mode:J,uid:K,gid:z,size:G,mtime:new Date(1000*H),type:W,linkname:X,uname:Z,gname:q,devmajor:V,devminor:w}}});var $F0=j((D04,eL0)=>{var rL0=K0("util"),cV1=nL0(),aX=Vc(),sL0=x8().Writable,tL0=x8().PassThrough,aL0=function(){},oL0=function($){return $&=511,$&&512-$},nV1=function($,Y){var U=new rA($,Y);return U.end(),U},dV1=function($,Y){if(Y.path)$.name=Y.path;if(Y.linkpath)$.linkname=Y.linkpath;if(Y.size)$.size=parseInt(Y.size,10);return $.pax=Y,$},rA=function($,Y){this._parent=$,this.offset=Y,tL0.call(this,{autoDestroy:!1})};rL0.inherits(rA,tL0);rA.prototype.destroy=function($){this._parent.destroy($)};var k3=function($){if(!(this instanceof k3))return new k3($);sL0.call(this,$),$=$||{},this._offset=0,this._buffer=cV1(),this._missing=0,this._partial=!1,this._onparse=aL0,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var Y=this,U=Y._buffer,Q=function(){Y._continue()},I=function(Z){if(Y._locked=!1,Z)return Y.destroy(Z);if(!Y._stream)Q()},J=function(){Y._stream=null;var Z=oL0(Y._header.size);if(Z)Y._parse(Z,K);else Y._parse(512,X);if(!Y._locked)Q()},K=function(){Y._buffer.consume(oL0(Y._header.size)),Y._parse(512,X),Q()},z=function(){var Z=Y._header.size;Y._paxGlobal=aX.decodePax(U.slice(0,Z)),U.consume(Z),J()},G=function(){var Z=Y._header.size;if(Y._pax=aX.decodePax(U.slice(0,Z)),Y._paxGlobal)Y._pax=Object.assign({},Y._paxGlobal,Y._pax);U.consume(Z),J()},H=function(){var Z=Y._header.size;this._gnuLongPath=aX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},W=function(){var Z=Y._header.size;this._gnuLongLinkPath=aX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},X=function(){var Z=Y._offset,q;try{q=Y._header=aX.decode(U.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(V){Y.emit("error",V)}if(U.consume(512),!q){Y._parse(512,X),Q();return}if(q.type==="gnu-long-path"){Y._parse(q.size,H),Q();return}if(q.type==="gnu-long-link-path"){Y._parse(q.size,W),Q();return}if(q.type==="pax-global-header"){Y._parse(q.size,z),Q();return}if(q.type==="pax-header"){Y._parse(q.size,G),Q();return}if(Y._gnuLongPath)q.name=Y._gnuLongPath,Y._gnuLongPath=null;if(Y._gnuLongLinkPath)q.linkname=Y._gnuLongLinkPath,Y._gnuLongLinkPath=null;if(Y._pax)Y._header=q=dV1(q,Y._pax),Y._pax=null;if(Y._locked=!0,!q.size||q.type==="directory"){Y._parse(512,X),Y.emit("entry",q,nV1(Y,Z),I);return}Y._stream=new rA(Y,Z),Y.emit("entry",q,Y._stream,I),Y._parse(q.size,J),Q()};this._onheader=X,this._parse(512,X)};rL0.inherits(k3,sL0);k3.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};k3.prototype._parse=function($,Y){if(this._destroyed)return;if(this._offset+=$,this._missing=$,Y===this._onheader)this._partial=!1;this._onparse=Y};k3.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=aL0,this._overflow)this._write(this._overflow,void 0,$);else $()};k3.prototype._write=function($,Y,U){if(this._destroyed)return;var Q=this._stream,I=this._buffer,J=this._missing;if($.length)this._partial=!0;if($.length<J)
Line truncated
|
||||
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`)}_writeRelationship($){if(!this.count)this._writeOpen();let Y=`rId${++this.count}`;if($.TargetMode)this.stream.write(`<Relationship Id="${Y}" Type="${$.Type}" Target="${HL1.xmlEncode($.Target)}" TargetMode="${$.TargetMode}"/>`);else this.stream.write(`<Relationship Id="${Y}" Type="${$.Type}" Target="${$.Target}"/>`);return Y}_writeClose(){this.stream.write("</Relationships>")}}EF0.exports=TF0});var SF0=j((v04,vF0)=>{var CF0=$8(),RF0=q2(),XL1=p4(),ZL1=jf(),qL1=Rf();class _F0{constructor($,Y,U){this.id=U.id,this.count=0,this._worksheet=$,this._workbook=U.workbook,this._sheetRelsWriter=Y}get commentsStream(){if(!this._commentsStream)this._commentsStream=this._workbook._openStream(`/xl/comments${this.id}.xml`);return this._commentsStream}get vmlStream(){if(!this._vmlStream)this._vmlStream=this._workbook._openStream(`xl/drawings/vmlDrawing${this.id}.vml`);return this._vmlStream}_addRelationships(){let $={Type:RF0.Comments,Target:`../comments${this.id}.xml`};this._sheetRelsWriter.addRelationship($);let Y={Type:RF0.VmlDrawing,Target:`../drawings/vmlDrawing${this.id}.vml`};this.vmlRelId=this._sheetRelsWriter.addRelationship(Y)}_addCommentRefs(){this._workbook.commentRefs.push({commentName:`comments${this.id}`,vmlDrawing:`vmlDrawing${this.id}`})}_writeOpen(){this.commentsStream.write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><authors><author>Author</author></authors><commentList>'),this.vmlStream.write('<?xml version="1.0" encoding="UTF-8"?><xml xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:x="urn:schemas-microsoft-com:office:excel"><o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1" /></o:shapelayout><v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter" /><v:path gradientshapeok="t" o:connecttype="rect" /></v:shapetype>')}_writeComment($,Y){let U=new ZL1,Q=new CF0;U.render(Q,$),this.commentsStream.write(Q.xml);let I=new qL1,J=new CF0;I.render(J,$,Y),this.vmlStream.write(J.xml)}_writeClose(){this.commentsStream.write("</commentList></comments>"),this.vmlStream.write("</xml>")}addComments($){if($&&$.length){if(!this.startedData)this._worksheet.comments=[],this._writeOpen(),this._addRelationships(),this._addCommentRefs(),this.startedData=!0;$.forEach((Y)=>{Y.refAddress=XL1.decodeAddress(Y.ref)}),$.forEach((Y)=>{this._writeComment(Y,this.count),this.count+=1})}}commit(){if(this.count)this._writeClose(),this.commentsStream.end(),this.vmlStream.end()}}vF0.exports=_F0});var fF0=j((S04,xF0)=>{var VL1=J6(),LL1=q2(),wc=p4(),hF0=mg(),gF0=q3(),FL1=Kx(),yF0=$O(),Mc=UO(),wL1=jF0(),ML1=SF0(),OL1=dg(),n6=new FL1,Oc=W2(),NL1=Yf(),DL1=Uf(),AL1=Qf(),BL1=tx(),PL1=rx(),TL1=ax(),EL1=If(),jL1=Jf(),CL1=Kf(),RL1=zf(),_L1=Gf(),vL1=Hf(),SL1=Vf(),hL1=Xf(),gL1=Wf(),d6={dataValidations:new NL1,sheetProperties:new DL1,sheetFormatProperties:new AL1,columns:new Oc({tag:"cols",length:!1,childXform:new BL1}),row:new PL1,hyperlinks:new Oc({tag:"hyperlinks",length:!1,childXform:new TL1}),sheetViews:new Oc({tag:"sheetViews",length:!1,childXform:new EL1}),sheetProtection:new jL1,pageMargins:new CL1,pageSeteup:new RL1,autoFilter:new _L1,picture:new vL1,conditionalFormattings:new SL1,headerFooter:new hL1,rowBreaks:new gL1};class kF0{constructor($){this.id=$.id,this.name=$.name||`Sheet${this.id}`,this.state=$.state||"visible",this._rows=[],this._columns=null,this._keys={},this._merges=[],this._merges.add=function(){},this._sheetRelsWriter=new wL1($),this._sheetCommentsWriter=new ML1(this,this._sheetRelsWriter,$),this._dimensions=new gF0,this._rowZero=1,this.committed=!1,this.dataValidations=new OL1,this._formulae={},this._siFormulae=0,this.conditionalFormatting=[],this.rowBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},$.properties),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},$.headerFooter),this.pageSetup=Object.assign({},{margins:{left:0.7,right:0.7,top:0.75,bottom:0.75,header:0.3,footer:0.3},orientation:"portrait",horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!!($.pageSetup&&($.pageSetup.fitToWidth||$.pageSetup.fitToHeight)&&!$.pageSetup.scale),pageOrder:"downThenOver",blackAndWhite:!1,draft:!1,cellComments:"None",errors:"displayed",scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},$.pageSetup),this.useSharedStrings=$.useSharedStrings||!1,this._workbook=$.workbook,this.hasComments=!1,this._views=$.views||[],this.autoFilter=$.autoFilter||null,this._media=[],this.sheetProtection=null,this._writeOpenWorksheet(),this.startedData=!1}get
Line truncated
|
||||
*/DZ0.exports=function($,Y){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var U=$.length;if(U<=1)return $;var Q="";if(U>4&&$[3]==="\\"){var I=$[2];if((I==="?"||I===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),Q="//"}var J=$.split(/[/\\]+/);if(Y!==!1&&J[J.length-1]==="")J.pop();return Q+J.join("/")}});var sb=E((C04,EZ0)=>{var PZ0=9007199254740991,jz1="[object Arguments]",Ez1="[object Function]",Cz1="[object GeneratorFunction]",Rz1=/^(?:0|[1-9]\d*)$/;function BZ0($,Y,U){switch(U.length){case 0:return $.call(Y);case 1:return $.call(Y,U[0]);case 2:return $.call(Y,U[0],U[1]);case 3:return $.call(Y,U[0],U[1],U[2])}return $.apply(Y,U)}function _z1($,Y){var U=-1,Q=Array($);while(++U<$)Q[U]=Y(U);return Q}var hX=Object.prototype,SX=hX.hasOwnProperty,AZ0=hX.toString,vz1=hX.propertyIsEnumerable,NZ0=Math.max;function hz1($,Y){var U=cz1($)||iz1($)?_z1($.length,String):[],Q=U.length,I=!!Q;for(var J in $)if((Y||SX.call($,J))&&!(I&&(J=="length"||jZ0(J,Q))))U.push(J);return U}function Sz1($,Y,U,Q){if($===void 0||lb($,hX[U])&&!SX.call(Q,U))return Y;return $}function gz1($,Y,U){var Q=$[Y];if(!(SX.call($,Y)&&lb(Q,U))||U===void 0&&!(Y in $))$[Y]=U}function yz1($){if(!rb($))return bz1($);var Y=uz1($),U=[];for(var Q in $)if(!(Q=="constructor"&&(Y||!SX.call($,Q))))U.push(Q);return U}function TZ0($,Y){return Y=NZ0(Y===void 0?$.length-1:Y,0),function(){var U=arguments,Q=-1,I=NZ0(U.length-Y,0),J=Array(I);while(++Q<I)J[Q]=U[Y+Q];Q=-1;var K=Array(Y+1);while(++Q<Y)K[Q]=U[Q];return K[Y]=J,BZ0($,this,K)}}function kz1($,Y,U,Q){U||(U={});var I=-1,J=Y.length;while(++I<J){var K=Y[I],z=Q?Q(U[K],$[K],K,U,$):void 0;gz1(U,K,z===void 0?$[K]:z)}return U}function xz1($){return TZ0(function(Y,U){var Q=-1,I=U.length,J=I>1?U[I-1]:void 0,K=I>2?U[2]:void 0;if(J=$.length>3&&typeof J=="function"?(I--,J):void 0,K&&fz1(U[0],U[1],K))J=I<3?void 0:J,I=1;Y=Object(Y);while(++Q<I){var z=U[Q];if(z)$(Y,z,Q,J)}return Y})}function jZ0($,Y){return Y=Y==null?PZ0:Y,!!Y&&(typeof $=="number"||Rz1.test($))&&($>-1&&$%1==0&&$<Y)}function fz1($,Y,U){if(!rb(U))return!1;var Q=typeof Y;if(Q=="number"?ob(U)&&jZ0(Y,U.length):Q=="string"&&(Y in U))return lb(U[Y],$);return!1}function uz1($){var Y=$&&$.constructor,U=typeof Y=="function"&&Y.prototype||hX;return $===U}function bz1($){var Y=[];if($!=null)for(var U in Object($))Y.push(U);return Y}function lb($,Y){return $===Y||$!==$&&Y!==Y}function iz1($){return nz1($)&&SX.call($,"callee")&&(!vz1.call($,"callee")||AZ0.call($)==jz1)}var cz1=Array.isArray;function ob($){return $!=null&&dz1($.length)&&!pz1($)}function nz1($){return mz1($)&&ob($)}function pz1($){var Y=rb($)?AZ0.call($):"";return Y==Ez1||Y==Cz1}function dz1($){return typeof $=="number"&&$>-1&&$%1==0&&$<=PZ0}function rb($){var Y=typeof $;return!!$&&(Y=="object"||Y=="function")}function mz1($){return!!$&&typeof $=="object"}var lz1=xz1(function($,Y,U,Q){kz1(Y,rz1(Y),$,Q)}),oz1=TZ0(function($){return $.push(void 0,Sz1),BZ0(lz1,void 0,$)});function rz1($){return ob($)?hz1($,!0):yz1($)}EZ0.exports=oz1});var RZ0=E((R04,ab)=>{function sz1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var CZ0=L6().Buffer,gX=z0("util");function az1($,Y,U){$.copy(Y,U)}ab.exports=function(){function $(){sz1(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(U){var Q={data:U,next:null};if(this.length>0)this.tail.next=Q;else this.head=Q;this.tail=Q,++this.length},$.prototype.unshift=function(U){var Q={data:U,next:this.head};if(this.length===0)this.tail=Q;this.head=Q,++this.length},$.prototype.shift=function(){if(this.length===0)return;var U=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,U},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(U){if(this.length===0)return"";var Q=this.head,I=""+Q.data;while(Q=Q.next)I+=U+Q.data;return I},$.prototype.concat=function(U){if(this.length===0)return CZ0.alloc(0);var Q=CZ0.allocUnsafe(U>>>0),I=this.head,J=0;while(I)az1(I.data,Q,J),J+=I.data.length,I=I.next;return Q},$}();if(gX&&gX.inspect&&gX.inspect.custom)ab.exports.prototype[gX.inspect.custom]=function(){var $=gX.inspect({length:this.length});return this.constructor.name+" "+$}});var tb=E((_04,_Z0)=>{var EP=V6();function tz1($,Y){var U=this,Q=this._readableState&&this._readableState.destroyed,I=this._writableState&&this._writableState.destroyed;if(Q||I){if(Y)Y($);else if($){if(!this._writableState)EP.nextTick(CP,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,EP.nextTick(CP,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(J){if(!Y&&J){if(!U._writableState)EP.nextTick(CP,U,J);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,EP.nextTick(CP,U,J)}else if(Y)Y(J)}),this}function ez1(){if(this._readableState)this._readabl
Line truncated
|
||||
%s`,B,B,D,Q);var A=D.type==="*"?ki:D.type==="?"?yi:"\\"+D.type;I=!0,Q=Q.slice(0,D.reStart)+A+"\\("+B}if(V(),J)Q+="\\\\";var P=!1;switch(Q.charAt(0)){case"[":case".":case"(":P=!0}for(var j=z.length-1;j>-1;j--){var C=z[j],u=Q.slice(0,C.reStart),x=Q.slice(C.reStart,C.reEnd-8),S=Q.slice(C.reEnd-8,C.reEnd),b=Q.slice(C.reEnd);S+=b;var n=u.split("(").length-1,I0=b;for(w=0;w<n;w++)I0=I0.replace(/\)[+*?]?/,"");b=I0;var k="";if(b===""&&Y!==pP)k="$";var m=u+x+b+k+S;Q=m}if(Q!==""&&I)Q="(?=.)"+Q;if(P)Q=Z+Q;if(Y===pP)return[Q,I];if(!I)return MZ1($);var e=U.nocase?"i":"";try{var Y0=new RegExp("^"+Q+"$",e)}catch(g){return new RegExp("$.")}return Y0._glob=$,Y0._src=Q,Y0}P$.makeRe=function($,Y){return new P6($,Y||{}).makeRe()};P6.prototype.makeRe=FZ1;function FZ1(){if(this.regexp||this.regexp===!1)return this.regexp;var $=this.set;if(!$.length)return this.regexp=!1,this.regexp;var Y=this.options,U=Y.noglobstar?ki:Y.dot?GZ1:WZ1,Q=Y.nocase?"i":"",I=$.map(function(J){return J.map(function(K){return K===aU?U:typeof K==="string"?OZ1(K):K._src}).join("\\/")}).join("|");if(I="^(?:"+I+")$",this.negate)I="^(?!"+I+").*$";try{this.regexp=new RegExp(I,Q)}catch(J){this.regexp=!1}return this.regexp}P$.match=function($,Y,U){U=U||{};var Q=new P6(Y,U);if($=$.filter(function(I){return Q.match(I)}),Q.options.nonull&&!$.length)$.push(Y);return $};P6.prototype.match=function(Y,U){if(typeof U>"u")U=this.partial;if(this.debug("match",Y,this.pattern),this.comment)return!1;if(this.empty)return Y==="";if(Y==="/"&&U)return!0;var Q=this.options;if(mX.sep!=="/")Y=Y.split(mX.sep).join("/");Y=Y.split(GV0),this.debug(this.pattern,"split",Y);var I=this.set;this.debug(this.pattern,"set",I);var J,K;for(K=Y.length-1;K>=0;K--)if(J=Y[K],J)break;for(K=0;K<I.length;K++){var z=I[K],H=Y;if(Q.matchBase&&z.length===1)H=[J];var G=this.matchOne(H,z,U);if(G){if(Q.flipNegate)return!0;return!this.negate}}if(Q.flipNegate)return!1;return this.negate};P6.prototype.matchOne=function($,Y,U){if(Y.indexOf(aU)!==-1)return this._matchGlobstar($,Y,U,0,0);return this._matchOne($,Y,U,0,0)};P6.prototype._matchGlobstar=function($,Y,U,Q,I){var J,K=-1;for(J=I;J<Y.length;J++)if(Y[J]===aU){K=J;break}var z=-1;for(J=Y.length-1;J>=0;J--)if(Y[J]===aU){z=J;break}var H=Y.slice(I,K),G=U?Y.slice(K+1):Y.slice(K+1,z),W=U?[]:Y.slice(z+1);if(H.length){var X=$.slice(Q,Q+H.length);if(!this._matchOne(X,H,U,0,0))return!1;Q+=H.length}var Z=0;if(W.length){if(W.length+Q>$.length)return!1;var q=$.length-W.length;if(this._matchOne($,W,U,q,0))Z=W.length;else{if($[$.length-1]!==""||Q+W.length===$.length)return!1;if(q--,!this._matchOne($,W,U,q,0))return!1;Z=W.length+1}}if(!G.length){var V=!!Z;for(J=Q;J<$.length-Z;J++){var w=String($[J]);if(V=!0,w==="."||w===".."||!this.options.dot&&w.charAt(0)===".")return!1}return U||V}var M=[[[],0]],F=M[0],D=0,O=[0];for(var N=0;N<G.length;N++){var B=G[N];if(B===aU)O.push(D),F=[[],0],M.push(F);else F[0].push(B),D++}var A=M.length-1,P=$.length-Z;for(var j=0;j<M.length;j++)M[j][1]=P-(O[A--]+M[j][0].length);return!!this._matchGlobStarBodySections($,M,Q,0,U,0,!!Z)};P6.prototype._matchGlobStarBodySections=function($,Y,U,Q,I,J,K){var z=Y[Q];if(!z){for(var H=U;H<$.length;H++){K=!0;var G=$[H];if(G==="."||G===".."||!this.options.dot&&G.charAt(0)===".")return!1}return K}var W=z[0],X=z[1];while(U<=X){var Z=this._matchOne($.slice(0,U+W.length),W,I,U,0);if(Z&&J<this.maxGlobstarRecursion){var q=this._matchGlobStarBodySections($,Y,U+W.length,Q+1,I,J+1,K);if(q!==!1)return q}var G=$[U];if(G==="."||G===".."||!this.options.dot&&G.charAt(0)===".")return!1;U++}return I||null};P6.prototype._matchOne=function($,Y,U,Q,I){var J,K,z,H;for(J=Q,K=I,z=$.length,H=Y.length;J<z&&K<H;J++,K++){this.debug("matchOne loop");var G=Y[K],W=$[J];if(this.debug(Y,G,W),G===!1||G===aU)return!1;var X;if(typeof G==="string")X=W===G,this.debug("string match",G,W,X);else X=W.match(G),this.debug("pattern match",G,W,X);if(!X)return!1}if(J===z&&K===H)return!0;else if(J===z)return U;else if(K===H)return J===z-1&&$[J]==="";throw Error("wtf?")};function MZ1($){return $.replace(/\\(.)/g,"$1")}function OZ1($){return $.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var oP=E((s04,lP)=>{function ZV0($){return $.charAt(0)==="/"}function qV0($){var Y=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,U=Y.exec($),Q=U[1]||"",I=Boolean(Q&&Q.charAt(1)!==":");return Boolean(U[2]||I)}lP.exports=process.platform==="win32"?qV0:ZV0;lP.exports.posix=ZV0;lP.exports.win32=qV0});var fi=E((RZ1)=>{RZ1.setopts=TZ1;RZ1.ownProp=VV0;RZ1.makeAbs=lX;RZ1.finish=jZ1;RZ1.mark=EZ1;RZ1.isIgnored=wV0;RZ1.childrenIgnored=CZ1;function VV0($,Y){return Object.prototype.hasOwnProperty.call($,Y)}var DZ1=z0("fs"),yK=z0("path"),NZ1=mP(),LV0=oP(),xi=NZ1.Minimatch;function PZ1($,Y){return $.localeCompare(Y,"en")}function BZ1($,Y){if($.ignore=Y.ignore||[],!Array.isArray($.ignore))$.ignore=[$.ignore];if($.ignore.length)$.ignore=$.ignore.map(AZ1)}function AZ1($){var Y=null;if($.slice(-3)==="/**"){var U=$.replace(/(\/\*\*)+$/,"");Y=new xi(U,{dot:!0})}return{ma
Line truncated
|
||||
See: https://github.com/isaacs/node-glob/issues/167`);return new g6($,Y).found}function g6($,Y){if(!$)throw Error("must provide pattern");if(typeof Y==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
|
||||
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof g6))return new g6($,Y);if(fZ1(this,$,Y),this.noprocess)return this;var U=this.minimatch.set.length;this.matches=Array(U);for(var Q=0;Q<U;Q++)this._process(this.minimatch.set[Q],Q,!1);this._finish()}g6.prototype._finish=function(){if(MV0.ok(this instanceof g6),this.realpath){var $=this;this.matches.forEach(function(Y,U){var Q=$.matches[U]=Object.create(null);for(var I in Y)try{I=$._makeAbs(I);var J=xZ1.realpathSync(I,$.realpathCache);Q[J]=!0}catch(K){if(K.syscall==="stat")Q[$._makeAbs(I)]=!0;else throw K}})}tU.finish(this)};g6.prototype._process=function($,Y,U){MV0.ok(this instanceof g6);var Q=0;while(typeof $[Q]==="string")Q++;var I;switch(Q){case $.length:this._processSimple($.join("/"),Y);return;case 0:I=null;break;default:I=$.slice(0,Q).join("/");break}var J=$.slice(Q),K;if(I===null)K=".";else if(rP(I)||rP($.map(function(G){return typeof G==="string"?G:"[*]"}).join("/"))){if(!I||!rP(I))I="/"+I;K=I}else K=I;var z=this._makeAbs(K);if(uZ1(this,K))return;var H=J[0]===FV0.GLOBSTAR;if(H)this._processGlobStar(I,K,z,J,Y,U);else this._processReaddir(I,K,z,J,Y,U)};g6.prototype._processReaddir=function($,Y,U,Q,I,J){var K=this._readdir(U,J);if(!K)return;var z=Q[0],H=!!this.minimatch.negate,G=z._glob,W=this.dot||G.charAt(0)===".",X=[];for(var Z=0;Z<K.length;Z++){var q=K[Z];if(q.charAt(0)!=="."||W){var V;if(H&&!$)V=!q.match(z);else V=q.match(z);if(V)X.push(q)}}var w=X.length;if(w===0)return;if(Q.length===1&&!this.mark&&!this.stat){if(!this.matches[I])this.matches[I]=Object.create(null);for(var Z=0;Z<w;Z++){var q=X[Z];if($)if($.slice(-1)!=="/")q=$+"/"+q;else q=$+q;if(q.charAt(0)==="/"&&!this.nomount)q=ui.join(this.root,q);this._emitMatch(I,q)}return}Q.shift();for(var Z=0;Z<w;Z++){var q=X[Z],M;if($)M=[$,q];else M=[q];this._process(M.concat(Q),I,J)}};g6.prototype._emitMatch=function($,Y){if(bZ1(this,Y))return;var U=this._makeAbs(Y);if(this.mark)Y=this._mark(Y);if(this.absolute)Y=U;if(this.matches[$][Y])return;if(this.nodir){var Q=this.cache[U];if(Q==="DIR"||Array.isArray(Q))return}if(this.matches[$][Y]=!0,this.stat)this._stat(Y)};g6.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var Y,U,Q;try{U=this.fs.lstatSync($)}catch(J){if(J.code==="ENOENT")return null}var I=U&&U.isSymbolicLink();if(this.symlinks[$]=I,!I&&U&&!U.isDirectory())this.cache[$]="FILE";else Y=this._readdir($,!1);return Y};g6.prototype._readdir=function($,Y){var U;if(Y&&!bi(this.symlinks,$))return this._readdirInGlobStar($);if(bi(this.cache,$)){var Q=this.cache[$];if(!Q||Q==="FILE")return null;if(Array.isArray(Q))return Q}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(I){return this._readdirError($,I),null}};g6.prototype._readdirEntries=function($,Y){if(!this.mark&&!this.stat)for(var U=0;U<Y.length;U++){var Q=Y[U];if($==="/")Q=$+Q;else Q=$+"/"+Q;this.cache[Q]=!0}return this.cache[$]=Y,Y};g6.prototype._readdirError=function($,Y){switch(Y.code){case"ENOTSUP":case"ENOTDIR":var U=this._makeAbs($);if(this.cache[U]="FILE",U===this.cwdAbs){var Q=Error(Y.code+" invalid cwd "+this.cwd);throw Q.path=this.cwd,Q.code=Y.code,Q}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs($)]=!1;break;default:if(this.cache[this._makeAbs($)]=!1,this.strict)throw Y;if(!this.silent)console.error("glob error",Y);break}};g6.prototype._processGlobStar=function($,Y,U,Q,I,J){var K=this._readdir(U,J);if(!K)return;var z=Q.slice(1),H=$?[$]:[],G=H.concat(z);this._process(G,I,!1);var W=K.length,X=this.symlinks[U];if(X&&J)return;for(var Z=0;Z<W;Z++){var q=K[Z];if(q.charAt(0)==="."&&!this.dot)continue;var V=H.concat(K[Z],z);this._process(V,I,!0);var w=H.concat(K[Z],Q);this._process(w,I,!0)}};g6.prototype._processSimple=function($,Y){var U=this._stat($);if(!this.matches[Y])this.matches[Y]=Object.create(null);if(!U)return;if($&&rP($)&&!this.nomount){var Q=/[\/\\]$/.test($);if($.charAt(0)==="/")$=ui.join(this.root,$);else if($=ui.resolve(this.root,$),Q)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(Y,$)};g6.prototype._stat=function($){var Y=this._makeAbs($),U=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&bi(this.cache,Y)){var K=this.cache[Y];if(Array.isArray(K))K="DIR";if(!U||K==="DIR")return K;if(U&&K==="FILE")return!1}var Q,I=this.statCache[Y];if(!I){var J;try{J=this.fs.lstatSync(Y)}catch(z){if(z&&(z.code==="ENOENT"||z.code==="ENOTDIR"))return this.statCache[Y]=!1,!1}if(J&&J.isSymbolicLink())try{I=this.fs.statSync(Y)}catch(z){I=J}else I=J}this.statCache[Y]=I;var K=!0;if(I)K=I.isDirectory()?"DIR":"FILE";if(this.cache[Y]=this.cache[Y]||K,U&&K==="FILE")return!1;return K};g6.prototype._mark=function($){return tU.mark(this,$)};g6.prototype._makeAbs=function($){return tU.makeAbs(this,$)}});var ii=E((U14,BV0)=>{BV0.exports=PV0;function PV0($,Y){if($&&Y)return PV0($)(Y);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(Q){U[Q]=$[Q]}),U;f
Line truncated
|
||||
`);if($.linkname)Y+=uc(" linkpath="+$.linkname+`
|
||||
`);var U=$.pax;if(U)for(var Q in U)Y+=uc(" "+Q+"="+U[Q]+`
|
||||
`);return Buffer.from(Y)};sL1.decodePax=function($){var Y={};while($.length){var U=0;while(U<$.length&&$[U]!==32)U++;var Q=parseInt($.slice(0,U).toString(),10);if(!Q)return Y;var I=$.slice(U+1,Q-1).toString(),J=I.indexOf("=");if(J===-1)return Y;Y[I.slice(0,J)]=I.slice(J+1),$=$.slice(Q)}return Y};sL1.encode=function($){var Y=uL1(512),U=$.name,Q="";if($.typeflag===5&&U[U.length-1]!=="/")U+="/";if(Buffer.byteLength(U)!==U.length)return null;while(Buffer.byteLength(U)>100){var I=U.indexOf("/");if(I===-1)return null;Q+=Q?"/"+U.slice(0,I):U.slice(0,I),U=U.slice(I+1)}if(Buffer.byteLength(U)>100||Buffer.byteLength(Q)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(Y.write(U),Y.write(y2($.mode&dL1,6),100),Y.write(y2($.uid,6),108),Y.write(y2($.gid,6),116),Y.write(y2($.size,11),124),Y.write(y2($.mtime.getTime()/1000|0,11),136),Y[156]=xw0+oL1($.type),$.linkname)Y.write($.linkname,157);if(fw0.copy(Y,GZ),cL1.copy(Y,bc),$.uname)Y.write($.uname,265);if($.gname)Y.write($.gname,297);if(Y.write(y2($.devmajor||0,6),329),Y.write(y2($.devminor||0,6),337),Q)Y.write(Q,345);return Y.write(y2(bw0(Y),6),148),Y};sL1.decode=function($,Y,U){var Q=$[156]===0?0:$[156]-xw0,I=pK($,0,100,Y),J=k2($,100,8),K=k2($,108,8),z=k2($,116,8),H=k2($,124,12),G=k2($,136,12),W=lL1(Q),X=$[157]===0?null:pK($,157,100,Y),Z=pK($,265,32),q=pK($,297,32),V=k2($,329,8),w=k2($,337,8),M=bw0($);if(M===256)return null;if(M!==k2($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(fw0.compare($,GZ,GZ+6)===0){if($[345])I=pK($,345,155,Y)+"/"+I}else if(nL1.compare($,GZ,GZ+6)===0&&pL1.compare($,bc,bc+2)===0);else if(!U)throw Error("Invalid tar header: unknown format.");if(Q===0&&I&&I[I.length-1]==="/")Q=5;return{name:I,mode:J,uid:K,gid:z,size:H,mtime:new Date(1000*G),type:W,linkname:X,uname:Z,gname:q,devmajor:V,devminor:w}}});var lw0=E((s14,mw0)=>{var cw0=z0("util"),Uw1=kw0(),WZ=ic(),nw0=x8().Writable,pw0=x8().PassThrough,dw0=function(){},iw0=function($){return $&=511,$&&512-$},Qw1=function($,Y){var U=new LB($,Y);return U.end(),U},Iw1=function($,Y){if(Y.path)$.name=Y.path;if(Y.linkpath)$.linkname=Y.linkpath;if(Y.size)$.size=parseInt(Y.size,10);return $.pax=Y,$},LB=function($,Y){this._parent=$,this.offset=Y,pw0.call(this,{autoDestroy:!1})};cw0.inherits(LB,pw0);LB.prototype.destroy=function($){this._parent.destroy($)};var x3=function($){if(!(this instanceof x3))return new x3($);nw0.call(this,$),$=$||{},this._offset=0,this._buffer=Uw1(),this._missing=0,this._partial=!1,this._onparse=dw0,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var Y=this,U=Y._buffer,Q=function(){Y._continue()},I=function(Z){if(Y._locked=!1,Z)return Y.destroy(Z);if(!Y._stream)Q()},J=function(){Y._stream=null;var Z=iw0(Y._header.size);if(Z)Y._parse(Z,K);else Y._parse(512,X);if(!Y._locked)Q()},K=function(){Y._buffer.consume(iw0(Y._header.size)),Y._parse(512,X),Q()},z=function(){var Z=Y._header.size;Y._paxGlobal=WZ.decodePax(U.slice(0,Z)),U.consume(Z),J()},H=function(){var Z=Y._header.size;if(Y._pax=WZ.decodePax(U.slice(0,Z)),Y._paxGlobal)Y._pax=Object.assign({},Y._paxGlobal,Y._pax);U.consume(Z),J()},G=function(){var Z=Y._header.size;this._gnuLongPath=WZ.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},W=function(){var Z=Y._header.size;this._gnuLongLinkPath=WZ.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},X=function(){var Z=Y._offset,q;try{q=Y._header=WZ.decode(U.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(V){Y.emit("error",V)}if(U.consume(512),!q){Y._parse(512,X),Q();return}if(q.type==="gnu-long-path"){Y._parse(q.size,G),Q();return}if(q.type==="gnu-long-link-path"){Y._parse(q.size,W),Q();return}if(q.type==="pax-global-header"){Y._parse(q.size,z),Q();return}if(q.type==="pax-header"){Y._parse(q.size,H),Q();return}if(Y._gnuLongPath)q.name=Y._gnuLongPath,Y._gnuLongPath=null;if(Y._gnuLongLinkPath)q.linkname=Y._gnuLongLinkPath,Y._gnuLongLinkPath=null;if(Y._pax)Y._header=q=Iw1(q,Y._pax),Y._pax=null;if(Y._locked=!0,!q.size||q.type==="directory"){Y._parse(512,X),Y.emit("entry",q,Qw1(Y,Z),I);return}Y._stream=new LB(Y,Z),Y.emit("entry",q,Y._stream,I),Y._parse(q.size,J),Q()};this._onheader=X,this._parse(512,X)};cw0.inherits(x3,nw0);x3.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};x3.prototype._parse=function($,Y){if(this._destroyed)return;if(this._offset+=$,this._missing=$,Y===this._onheader)this._partial=!1;this._onparse=Y};x3.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=dw0,this._overflow)this._write(this._overflow,void 0,$);else $()};x3.prototype._write=function($,Y,U){if(this._destroyed)return;var Q=this._stream,I=this._buffer,J=this._missing;if($.length)this._partial=!0;if($.length<J)
Line truncated
|
||||
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`)}_writeRelationship($){if(!this.count)this._writeOpen();let Y=`rId${++this.count}`;if($.TargetMode)this.stream.write(`<Relationship Id="${Y}" Type="${$.Type}" Target="${Bw1.xmlEncode($.Target)}" TargetMode="${$.TargetMode}"/>`);else this.stream.write(`<Relationship Id="${Y}" Type="${$.Type}" Target="${$.Target}"/>`);return Y}_writeClose(){this.stream.write("</Relationships>")}}OF0.exports=MF0});var TF0=E((K44,AF0)=>{var NF0=U8(),PF0=q2(),Tw1=l4(),jw1=Yu(),Ew1=Qu();class BF0{constructor($,Y,U){this.id=U.id,this.count=0,this._worksheet=$,this._workbook=U.workbook,this._sheetRelsWriter=Y}get commentsStream(){if(!this._commentsStream)this._commentsStream=this._workbook._openStream(`/xl/comments${this.id}.xml`);return this._commentsStream}get vmlStream(){if(!this._vmlStream)this._vmlStream=this._workbook._openStream(`xl/drawings/vmlDrawing${this.id}.vml`);return this._vmlStream}_addRelationships(){let $={Type:PF0.Comments,Target:`../comments${this.id}.xml`};this._sheetRelsWriter.addRelationship($);let Y={Type:PF0.VmlDrawing,Target:`../drawings/vmlDrawing${this.id}.vml`};this.vmlRelId=this._sheetRelsWriter.addRelationship(Y)}_addCommentRefs(){this._workbook.commentRefs.push({commentName:`comments${this.id}`,vmlDrawing:`vmlDrawing${this.id}`})}_writeOpen(){this.commentsStream.write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><authors><author>Author</author></authors><commentList>'),this.vmlStream.write('<?xml version="1.0" encoding="UTF-8"?><xml xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:x="urn:schemas-microsoft-com:office:excel"><o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1" /></o:shapelayout><v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter" /><v:path gradientshapeok="t" o:connecttype="rect" /></v:shapetype>')}_writeComment($,Y){let U=new jw1,Q=new NF0;U.render(Q,$),this.commentsStream.write(Q.xml);let I=new Ew1,J=new NF0;I.render(J,$,Y),this.vmlStream.write(J.xml)}_writeClose(){this.commentsStream.write("</commentList></comments>"),this.vmlStream.write("</xml>")}addComments($){if($&&$.length){if(!this.startedData)this._worksheet.comments=[],this._writeOpen(),this._addRelationships(),this._addCommentRefs(),this.startedData=!0;$.forEach((Y)=>{Y.refAddress=Tw1.decodeAddress(Y.ref)}),$.forEach((Y)=>{this._writeComment(Y,this.count),this.count+=1})}}commit(){if(this.count)this._writeClose(),this.commentsStream.end(),this.vmlStream.end()}}AF0.exports=BF0});var vF0=E((z44,_F0)=>{var Cw1=z6(),Rw1=q2(),pc=l4(),jF0=Oy(),EF0=V3(),_w1=Sx(),CF0=DO(),dc=PO(),vw1=DF0(),hw1=TF0(),Sw1=Fy(),d6=new _w1,mc=W2(),gw1=Cf(),yw1=Rf(),kw1=_f(),xw1=Af(),fw1=Pf(),uw1=Tf(),bw1=vf(),iw1=hf(),cw1=Sf(),nw1=gf(),pw1=yf(),dw1=kf(),mw1=cf(),lw1=ff(),ow1=xf(),m6={dataValidations:new gw1,sheetProperties:new yw1,sheetFormatProperties:new kw1,columns:new mc({tag:"cols",length:!1,childXform:new xw1}),row:new fw1,hyperlinks:new mc({tag:"hyperlinks",length:!1,childXform:new uw1}),sheetViews:new mc({tag:"sheetViews",length:!1,childXform:new bw1}),sheetProtection:new iw1,pageMargins:new cw1,pageSeteup:new nw1,autoFilter:new pw1,picture:new dw1,conditionalFormattings:new mw1,headerFooter:new lw1,rowBreaks:new ow1};class RF0{constructor($){this.id=$.id,this.name=$.name||`Sheet${this.id}`,this.state=$.state||"visible",this._rows=[],this._columns=null,this._keys={},this._merges=[],this._merges.add=function(){},this._sheetRelsWriter=new vw1($),this._sheetCommentsWriter=new hw1(this,this._sheetRelsWriter,$),this._dimensions=new EF0,this._rowZero=1,this.committed=!1,this.dataValidations=new Sw1,this._formulae={},this._siFormulae=0,this.conditionalFormatting=[],this.rowBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},$.properties),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},$.headerFooter),this.pageSetup=Object.assign({},{margins:{left:0.7,right:0.7,top:0.75,bottom:0.75,header:0.3,footer:0.3},orientation:"portrait",horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!!($.pageSetup&&($.pageSetup.fitToWidth||$.pageSetup.fitToHeight)&&!$.pageSetup.scale),pageOrder:"downThenOver",blackAndWhite:!1,draft:!1,cellComments:"None",errors:"displayed",scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},$.pageSetup),this.useSharedStrings=$.useSharedStrings||!1,this._workbook=$.workbook,this.hasComments=!1,this._views=$.views||[],this.autoFilter=$.autoFilter||null,this._media=[],this.sheetProtection=null,this._writeOpenWorksheet(),this.startedData=!1}get
Line truncated
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`)},xc=fc.getNativePromise();if(fc.isNode&&typeof MutationObserver>"u")uc=global.setImmediate,bc=process.nextTick,zQ=fc.isRecentNode?function($){uc.call(global,$)}:function($){bc.call(process,$)};else if(typeof xc==="function"&&typeof xc.resolve==="function")ic=xc.resolve(),zQ=function($){ic.then($)};else if(typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova)))zQ=function(){var $=document.createElement("div"),Y={attributes:!0},U=!1,Q=document.createElement("div"),I=new MutationObserver(function(){$.classList.toggle("foo"),U=!1});I.observe(Q,Y);var J=function(){if(U)return;U=!0,Q.classList.toggle("foo")};return function(z){var G=new MutationObserver(function(){G.disconnect(),z()});G.observe($,Y),J()}}();else if(typeof setImmediate<"u")zQ=function($){setImmediate($)};else if(typeof setTimeout<"u")zQ=function($){setTimeout($,0)};else zQ=TF1;var uc,bc,ic;ww0.exports=zQ});var Nw0=j((d04,Ow0)=>{function EF1($,Y,U,Q,I){for(var J=0;J<I;++J)U[J+Q]=$[J+Y],$[J+Y]=void 0}function u2($){this._capacity=$,this._length=0,this._front=0}u2.prototype._willBeOverCapacity=function($){return this._capacity<$};u2.prototype._pushOne=function($){var Y=this.length();this._checkCapacity(Y+1);var U=this._front+Y&this._capacity-1;this[U]=$,this._length=Y+1};u2.prototype.push=function($,Y,U){var Q=this.length()+3;if(this._willBeOverCapacity(Q)){this._pushOne($),this._pushOne(Y),this._pushOne(U);return}var I=this._front+Q-3;this._checkCapacity(Q);var J=this._capacity-1;this[I+0&J]=$,this[I+1&J]=Y,this[I+2&J]=U,this._length=Q};u2.prototype.shift=function(){var $=this._front,Y=this[$];return this[$]=void 0,this._front=$+1&this._capacity-1,this._length--,Y};u2.prototype.length=function(){return this._length};u2.prototype._checkCapacity=function($){if(this._capacity<$)this._resizeTo(this._capacity<<1)};u2.prototype._resizeTo=function($){var Y=this._capacity;this._capacity=$;var U=this._front,Q=this._length,I=U+Q&Y-1;EF1(this,0,this,Y,I)};Ow0.exports=u2});var jw0=j((p04,cc)=>{var Tw0;try{throw Error()}catch($){Tw0=$}var jF1=Mw0(),Dw0=Nw0(),Ew0=N4();function p6(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new Dw0(16),this._normalQueue=new Dw0(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var $=this;this.drainQueues=function(){$._drainQueues()},this._schedule=jF1}p6.prototype.setScheduler=function($){var Y=this._schedule;return this._schedule=$,this._customScheduler=!0,Y};p6.prototype.hasCustomScheduler=function(){return this._customScheduler};p6.prototype.enableTrampoline=function(){this._trampolineEnabled=!0};p6.prototype.disableTrampolineIfNecessary=function(){if(Ew0.hasDevTools)this._trampolineEnabled=!1};p6.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};p6.prototype.fatalError=function($,Y){if(Y)process.stderr.write("Fatal "+($ instanceof Error?$.stack:$)+`
|
||||
`),process.exit(2);else this.throwLater($)};p6.prototype.throwLater=function($,Y){if(arguments.length===1)Y=$,$=function(){throw Y};if(typeof setTimeout<"u")setTimeout(function(){$(Y)},0);else try{this._schedule(function(){$(Y)})}catch(U){throw Error(`No async scheduler available
|
||||
`)},Wn=Xn.getNativePromise();if(Xn.isNode&&typeof MutationObserver>"u")Zn=global.setImmediate,qn=process.nextTick,WQ=Xn.isRecentNode?function($){Zn.call(global,$)}:function($){qn.call(process,$)};else if(typeof Wn==="function"&&typeof Wn.resolve==="function")Vn=Wn.resolve(),WQ=function($){Vn.then($)};else if(typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova)))WQ=function(){var $=document.createElement("div"),Y={attributes:!0},U=!1,Q=document.createElement("div"),I=new MutationObserver(function(){$.classList.toggle("foo"),U=!1});I.observe(Q,Y);var J=function(){if(U)return;U=!0,Q.classList.toggle("foo")};return function(z){var H=new MutationObserver(function(){H.disconnect(),z()});H.observe($,Y),J()}}();else if(typeof setImmediate<"u")WQ=function($){setImmediate($)};else if(typeof setTimeout<"u")WQ=function($){setTimeout($,0)};else WQ=uF1;var Zn,qn,Vn;WM0.exports=WQ});var qM0=E((O44,ZM0)=>{function bF1($,Y,U,Q,I){for(var J=0;J<I;++J)U[J+Q]=$[J+Y],$[J+Y]=void 0}function u2($){this._capacity=$,this._length=0,this._front=0}u2.prototype._willBeOverCapacity=function($){return this._capacity<$};u2.prototype._pushOne=function($){var Y=this.length();this._checkCapacity(Y+1);var U=this._front+Y&this._capacity-1;this[U]=$,this._length=Y+1};u2.prototype.push=function($,Y,U){var Q=this.length()+3;if(this._willBeOverCapacity(Q)){this._pushOne($),this._pushOne(Y),this._pushOne(U);return}var I=this._front+Q-3;this._checkCapacity(Q);var J=this._capacity-1;this[I+0&J]=$,this[I+1&J]=Y,this[I+2&J]=U,this._length=Q};u2.prototype.shift=function(){var $=this._front,Y=this[$];return this[$]=void 0,this._front=$+1&this._capacity-1,this._length--,Y};u2.prototype.length=function(){return this._length};u2.prototype._checkCapacity=function($){if(this._capacity<$)this._resizeTo(this._capacity<<1)};u2.prototype._resizeTo=function($){var Y=this._capacity;this._capacity=$;var U=this._front,Q=this._length,I=U+Q&Y-1;bF1(this,0,this,Y,I)};ZM0.exports=u2});var DM0=E((D44,Ln)=>{var MM0;try{throw Error()}catch($){MM0=$}var iF1=XM0(),VM0=qM0(),OM0=B4();function l6(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new VM0(16),this._normalQueue=new VM0(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var $=this;this.drainQueues=function(){$._drainQueues()},this._schedule=iF1}l6.prototype.setScheduler=function($){var Y=this._schedule;return this._schedule=$,this._customScheduler=!0,Y};l6.prototype.hasCustomScheduler=function(){return this._customScheduler};l6.prototype.enableTrampoline=function(){this._trampolineEnabled=!0};l6.prototype.disableTrampolineIfNecessary=function(){if(OM0.hasDevTools)this._trampolineEnabled=!1};l6.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};l6.prototype.fatalError=function($,Y){if(Y)process.stderr.write("Fatal "+($ instanceof Error?$.stack:$)+`
|
||||
`),process.exit(2);else this.throwLater($)};l6.prototype.throwLater=function($,Y){if(arguments.length===1)Y=$,$=function(){throw Y};if(typeof setTimeout<"u")setTimeout(function(){$(Y)},0);else try{this._schedule(function(){$(Y)})}catch(U){throw Error(`No async scheduler available
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`)}};function Aw0($,Y,U){this._lateQueue.push($,Y,U),this._queueTick()}function Bw0($,Y,U){this._normalQueue.push($,Y,U),this._queueTick()}function Pw0($){this._normalQueue._pushOne($),this._queueTick()}if(!Ew0.hasDevTools)p6.prototype.invokeLater=Aw0,p6.prototype.invoke=Bw0,p6.prototype.settlePromises=Pw0;else p6.prototype.invokeLater=function($,Y,U){if(this._trampolineEnabled)Aw0.call(this,$,Y,U);else this._schedule(function(){setTimeout(function(){$.call(Y,U)},100)})},p6.prototype.invoke=function($,Y,U){if(this._trampolineEnabled)Bw0.call(this,$,Y,U);else this._schedule(function(){$.call(Y,U)})},p6.prototype.settlePromises=function($){if(this._trampolineEnabled)Pw0.call(this,$);else this._schedule(function(){$._settlePromises()})};p6.prototype._drainQueue=function($){while($.length()>0){var Y=$.shift();if(typeof Y!=="function"){Y._settlePromises();continue}var U=$.shift(),Q=$.shift();Y.call(U,Q)}};p6.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)};p6.prototype._queueTick=function(){if(!this._isTickUsed)this._isTickUsed=!0,this._schedule(this.drainQueues)};p6.prototype._reset=function(){this._isTickUsed=!1};cc.exports=p6;cc.exports.firstLineError=Tw0});var f3=j((m04,_w0)=>{var pc=KQ(),CF1=pc.freeze,Cw0=N4(),Rw0=Cw0.inherits,dK=Cw0.notEnumerableProp;function pK($,Y){function U(Q){if(!(this instanceof U))return new U(Q);if(dK(this,"message",typeof Q==="string"?Q:Y),dK(this,"name",$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else Error.call(this)}return Rw0(U,Error),U}var nc,dc,RF1=pK("Warning","warning"),_F1=pK("CancellationError","cancellation error"),vF1=pK("TimeoutError","timeout error"),IZ=pK("AggregateError","aggregate error");try{nc=TypeError,dc=RangeError}catch($){nc=pK("TypeError","type error"),dc=pK("RangeError","range error")}var IB="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(GQ=0;GQ<IB.length;++GQ)if(typeof Array.prototype[IB[GQ]]==="function")IZ.prototype[IB[GQ]]=Array.prototype[IB[GQ]];var GQ;pc.defineProperty(IZ.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0});IZ.prototype.isOperational=!0;var JB=0;IZ.prototype.toString=function(){var $=Array(JB*4+1).join(" "),Y=`
|
||||
`)}};function LM0($,Y,U){this._lateQueue.push($,Y,U),this._queueTick()}function wM0($,Y,U){this._normalQueue.push($,Y,U),this._queueTick()}function FM0($){this._normalQueue._pushOne($),this._queueTick()}if(!OM0.hasDevTools)l6.prototype.invokeLater=LM0,l6.prototype.invoke=wM0,l6.prototype.settlePromises=FM0;else l6.prototype.invokeLater=function($,Y,U){if(this._trampolineEnabled)LM0.call(this,$,Y,U);else this._schedule(function(){setTimeout(function(){$.call(Y,U)},100)})},l6.prototype.invoke=function($,Y,U){if(this._trampolineEnabled)wM0.call(this,$,Y,U);else this._schedule(function(){$.call(Y,U)})},l6.prototype.settlePromises=function($){if(this._trampolineEnabled)FM0.call(this,$);else this._schedule(function(){$._settlePromises()})};l6.prototype._drainQueue=function($){while($.length()>0){var Y=$.shift();if(typeof Y!=="function"){Y._settlePromises();continue}var U=$.shift(),Q=$.shift();Y.call(U,Q)}};l6.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)};l6.prototype._queueTick=function(){if(!this._isTickUsed)this._isTickUsed=!0,this._schedule(this.drainQueues)};l6.prototype._reset=function(){this._isTickUsed=!1};Ln.exports=l6;Ln.exports.firstLineError=MM0});var u3=E((N44,BM0)=>{var Mn=GQ(),cF1=Mn.freeze,NM0=B4(),PM0=NM0.inherits,rK=NM0.notEnumerableProp;function sK($,Y){function U(Q){if(!(this instanceof U))return new U(Q);if(rK(this,"message",typeof Q==="string"?Q:Y),rK(this,"name",$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else Error.call(this)}return PM0(U,Error),U}var wn,Fn,nF1=sK("Warning","warning"),pF1=sK("CancellationError","cancellation error"),dF1=sK("TimeoutError","timeout error"),wZ=sK("AggregateError","aggregate error");try{wn=TypeError,Fn=RangeError}catch($){wn=sK("TypeError","type error"),Fn=sK("RangeError","range error")}var AB="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(XQ=0;XQ<AB.length;++XQ)if(typeof Array.prototype[AB[XQ]]==="function")wZ.prototype[AB[XQ]]=Array.prototype[AB[XQ]];var XQ;Mn.defineProperty(wZ.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0});wZ.prototype.isOperational=!0;var TB=0;wZ.prototype.toString=function(){var $=Array(TB*4+1).join(" "),Y=`
|
||||
`+$+`AggregateError of:
|
||||
`;JB++,$=Array(JB*4+1).join(" ");for(var U=0;U<this.length;++U){var Q=this[U]===this?"[Circular AggregateError]":this[U]+"",I=Q.split(`
|
||||
`;TB++,$=Array(TB*4+1).join(" ");for(var U=0;U<this.length;++U){var Q=this[U]===this?"[Circular AggregateError]":this[U]+"",I=Q.split(`
|
||||
`);for(var J=0;J<I.length;++J)I[J]=$+I[J];Q=I.join(`
|
||||
`),Y+=Q+`
|
||||
`}return JB--,Y};function QZ($){if(!(this instanceof QZ))return new QZ($);if(dK(this,"name","OperationalError"),dK(this,"message",$),this.cause=$,this.isOperational=!0,$ instanceof Error)dK(this,"message",$.message),dK(this,"stack",$.stack);else if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}Rw0(QZ,Error);var HQ=Error.__BluebirdErrorTypes__;if(!HQ)HQ=CF1({CancellationError:_F1,TimeoutError:vF1,OperationalError:QZ,RejectionError:QZ,AggregateError:IZ}),pc.defineProperty(Error,"__BluebirdErrorTypes__",{value:HQ,writable:!1,enumerable:!1,configurable:!1});_w0.exports={Error,TypeError:nc,RangeError:dc,CancellationError:HQ.CancellationError,OperationalError:HQ.OperationalError,TimeoutError:HQ.TimeoutError,AggregateError:HQ.AggregateError,Warning:RF1}});var Sw0=j((l04,vw0)=>{vw0.exports=function($,Y){var U=N4(),Q=U.errorObj,I=U.isObject;function J(X,Z){if(I(X)){if(X instanceof $)return X;var q=z(X);if(q===Q){if(Z)Z._pushContext();var V=$.reject(q.e);if(Z)Z._popContext();return V}else if(typeof q==="function"){if(H(X)){var V=new $(Y);return X._then(V._fulfill,V._reject,void 0,V,null),V}return W(X,q,Z)}}return X}function K(X){return X.then}function z(X){try{return K(X)}catch(Z){return Q.e=Z,Q}}var G={}.hasOwnProperty;function H(X){try{return G.call(X,"_promise0")}catch(Z){return!1}}function W(X,Z,q){var V=new $(Y),w=V;if(q)q._pushContext();if(V._captureStackTrace(),q)q._popContext();var M=!0,F=U.tryCatch(Z).call(X,N,O);if(M=!1,V&&F===Q)V._rejectCallback(F.e,!0,!0),V=null;function N(D){if(!V)return;V._resolveCallback(D),V=null}function O(D){if(!V)return;V._rejectCallback(D,M,!0),V=null}return w}return J}});var gw0=j((o04,hw0)=>{hw0.exports=function($,Y,U,Q,I){var J=N4(),K=J.isArray;function z(H){switch(H){case-2:return[];case-3:return{}}}function G(H){var W=this._promise=new $(Y);if(H instanceof $)W._propagateFrom(H,3);W._setOnCancel(this),this._values=H,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return J.inherits(G,I),G.prototype.length=function(){return this._length},G.prototype.promise=function(){return this._promise},G.prototype._init=function H(W,X){var Z=U(this._values,this._promise);if(Z instanceof $){Z=Z._target();var q=Z._bitField;if(this._values=Z,(q&50397184)===0)return this._promise._setAsyncGuaranteed(),Z._then(H,this._reject,void 0,this,X);else if((q&33554432)!==0)Z=Z._value();else if((q&16777216)!==0)return this._reject(Z._reason());else return this._cancel()}if(Z=J.asArray(Z),Z===null){var V=Q("expecting an array or an iterable object but got "+J.classString(Z)).reason();this._promise._rejectCallback(V,!1);return}if(Z.length===0){if(X===-5)this._resolveEmptyArray();else this._resolve(z(X));return}this._iterate(Z)},G.prototype._iterate=function(H){var W=this.getActualLength(H.length);this._length=W,this._values=this.shouldCopyValues()?Array(W):this._values;var X=this._promise,Z=!1,q=null;for(var V=0;V<W;++V){var w=U(H[V],X);if(w instanceof $)w=w._target(),q=w._bitField;else q=null;if(Z){if(q!==null)w.suppressUnhandledRejections()}else if(q!==null)if((q&50397184)===0)w._proxy(this,V),this._values[V]=w;else if((q&33554432)!==0)Z=this._promiseFulfilled(w._value(),V);else if((q&16777216)!==0)Z=this._promiseRejected(w._reason(),V);else Z=this._promiseCancelled(V);else Z=this._promiseFulfilled(w,V)}if(!Z)X._setAsyncGuaranteed()},G.prototype._isResolved=function(){return this._values===null},G.prototype._resolve=function(H){this._values=null,this._promise._fulfill(H)},G.prototype._cancel=function(){if(this._isResolved()||!this._promise._isCancellable())return;this._values=null,this._promise._cancel()},G.prototype._reject=function(H){this._values=null,this._promise._rejectCallback(H,!1)},G.prototype._promiseFulfilled=function(H,W){this._values[W]=H;var X=++this._totalResolved;if(X>=this._length)return this._resolve(this._values),!0;return!1},G.prototype._promiseCancelled=function(){return this._cancel(),!0},G.prototype._promiseRejected=function(H){return this._totalResolved++,this._reject(H),!0},G.prototype._resultCancelled=function(){if(this._isResolved())return;var H=this._values;if(this._cancel(),H instanceof $)H.cancel();else for(var W=0;W<H.length;++W)if(H[W]instanceof $)H[W].cancel()},G.prototype.shouldCopyValues=function(){return!0},G.prototype.getActualLength=function(H){return H},G}});var kw0=j((r04,yw0)=>{yw0.exports=function($){var Y=!1,U=[];$.prototype._promiseCreated=function(){},$.prototype._pushContext=function(){},$.prototype._popContext=function(){return null},$._peekContext=$.prototype._peekContext=function(){};function Q(){this._trace=new Q.CapturedTrace(J())}Q.prototype._pushContext=function(){if(this._trace!==void 0)this._trace._promiseCreated=null,U.push(this._trace)},Q.prototype._popContext=function(){if(this._trace!==void 0){var K=U.pop(),z=K._promiseCreated;return K._promiseCreated=null,z}return null};function I(){if(Y)return new Q}function J(){var K=U.length-1;if(K>=0)return U[K];return}return Q.CapturedTrace=null,Q.create=I,Q.deactivateLong
Line truncated
|
||||
`}return TB--,Y};function LZ($){if(!(this instanceof LZ))return new LZ($);if(rK(this,"name","OperationalError"),rK(this,"message",$),this.cause=$,this.isOperational=!0,$ instanceof Error)rK(this,"message",$.message),rK(this,"stack",$.stack);else if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}PM0(LZ,Error);var ZQ=Error.__BluebirdErrorTypes__;if(!ZQ)ZQ=cF1({CancellationError:pF1,TimeoutError:dF1,OperationalError:LZ,RejectionError:LZ,AggregateError:wZ}),Mn.defineProperty(Error,"__BluebirdErrorTypes__",{value:ZQ,writable:!1,enumerable:!1,configurable:!1});BM0.exports={Error,TypeError:wn,RangeError:Fn,CancellationError:ZQ.CancellationError,OperationalError:ZQ.OperationalError,TimeoutError:ZQ.TimeoutError,AggregateError:ZQ.AggregateError,Warning:nF1}});var TM0=E((P44,AM0)=>{AM0.exports=function($,Y){var U=B4(),Q=U.errorObj,I=U.isObject;function J(X,Z){if(I(X)){if(X instanceof $)return X;var q=z(X);if(q===Q){if(Z)Z._pushContext();var V=$.reject(q.e);if(Z)Z._popContext();return V}else if(typeof q==="function"){if(G(X)){var V=new $(Y);return X._then(V._fulfill,V._reject,void 0,V,null),V}return W(X,q,Z)}}return X}function K(X){return X.then}function z(X){try{return K(X)}catch(Z){return Q.e=Z,Q}}var H={}.hasOwnProperty;function G(X){try{return H.call(X,"_promise0")}catch(Z){return!1}}function W(X,Z,q){var V=new $(Y),w=V;if(q)q._pushContext();if(V._captureStackTrace(),q)q._popContext();var M=!0,F=U.tryCatch(Z).call(X,D,O);if(M=!1,V&&F===Q)V._rejectCallback(F.e,!0,!0),V=null;function D(N){if(!V)return;V._resolveCallback(N),V=null}function O(N){if(!V)return;V._rejectCallback(N,M,!0),V=null}return w}return J}});var EM0=E((B44,jM0)=>{jM0.exports=function($,Y,U,Q,I){var J=B4(),K=J.isArray;function z(G){switch(G){case-2:return[];case-3:return{}}}function H(G){var W=this._promise=new $(Y);if(G instanceof $)W._propagateFrom(G,3);W._setOnCancel(this),this._values=G,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return J.inherits(H,I),H.prototype.length=function(){return this._length},H.prototype.promise=function(){return this._promise},H.prototype._init=function G(W,X){var Z=U(this._values,this._promise);if(Z instanceof $){Z=Z._target();var q=Z._bitField;if(this._values=Z,(q&50397184)===0)return this._promise._setAsyncGuaranteed(),Z._then(G,this._reject,void 0,this,X);else if((q&33554432)!==0)Z=Z._value();else if((q&16777216)!==0)return this._reject(Z._reason());else return this._cancel()}if(Z=J.asArray(Z),Z===null){var V=Q("expecting an array or an iterable object but got "+J.classString(Z)).reason();this._promise._rejectCallback(V,!1);return}if(Z.length===0){if(X===-5)this._resolveEmptyArray();else this._resolve(z(X));return}this._iterate(Z)},H.prototype._iterate=function(G){var W=this.getActualLength(G.length);this._length=W,this._values=this.shouldCopyValues()?Array(W):this._values;var X=this._promise,Z=!1,q=null;for(var V=0;V<W;++V){var w=U(G[V],X);if(w instanceof $)w=w._target(),q=w._bitField;else q=null;if(Z){if(q!==null)w.suppressUnhandledRejections()}else if(q!==null)if((q&50397184)===0)w._proxy(this,V),this._values[V]=w;else if((q&33554432)!==0)Z=this._promiseFulfilled(w._value(),V);else if((q&16777216)!==0)Z=this._promiseRejected(w._reason(),V);else Z=this._promiseCancelled(V);else Z=this._promiseFulfilled(w,V)}if(!Z)X._setAsyncGuaranteed()},H.prototype._isResolved=function(){return this._values===null},H.prototype._resolve=function(G){this._values=null,this._promise._fulfill(G)},H.prototype._cancel=function(){if(this._isResolved()||!this._promise._isCancellable())return;this._values=null,this._promise._cancel()},H.prototype._reject=function(G){this._values=null,this._promise._rejectCallback(G,!1)},H.prototype._promiseFulfilled=function(G,W){this._values[W]=G;var X=++this._totalResolved;if(X>=this._length)return this._resolve(this._values),!0;return!1},H.prototype._promiseCancelled=function(){return this._cancel(),!0},H.prototype._promiseRejected=function(G){return this._totalResolved++,this._reject(G),!0},H.prototype._resultCancelled=function(){if(this._isResolved())return;var G=this._values;if(this._cancel(),G instanceof $)G.cancel();else for(var W=0;W<G.length;++W)if(G[W]instanceof $)G[W].cancel()},H.prototype.shouldCopyValues=function(){return!0},H.prototype.getActualLength=function(G){return G},H}});var RM0=E((A44,CM0)=>{CM0.exports=function($){var Y=!1,U=[];$.prototype._promiseCreated=function(){},$.prototype._pushContext=function(){},$.prototype._popContext=function(){return null},$._peekContext=$.prototype._peekContext=function(){};function Q(){this._trace=new Q.CapturedTrace(J())}Q.prototype._pushContext=function(){if(this._trace!==void 0)this._trace._promiseCreated=null,U.push(this._trace)},Q.prototype._popContext=function(){if(this._trace!==void 0){var K=U.pop(),z=K._promiseCreated;return K._promiseCreated=null,z}return null};function I(){if(Y)return new Q}function J(){var K=U.length-1;if(K>=0)return U[K];return}return Q.CapturedTrace=null,Q.create=I,Q.deactivateLong
Line truncated
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`);if(!D0.longStackTraces&&u0()){var I0=$.prototype._captureStackTrace,B=$.prototype._attachExtraTrace;D0.longStackTraces=!0,D=function(){if(Q.haveItemsQueued()&&!D0.longStackTraces)throw Error(`cannot enable long stack traces after promises have been created
|
||||
`);if(!N0.longStackTraces&&u0()){var a=$.prototype._captureStackTrace,T=$.prototype._attachExtraTrace;N0.longStackTraces=!0,N=function(){if(Q.haveItemsQueued()&&!N0.longStackTraces)throw Error(`cannot enable long stack traces after promises have been created
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`);$.prototype._captureStackTrace=I0,$.prototype._attachExtraTrace=B,Y.deactivateLongStackTraces(),Q.enableTrampoline(),D0.longStackTraces=!1},$.prototype._captureStackTrace=g,$.prototype._attachExtraTrace=p,Y.activateLongStackTraces(),Q.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return D0.longStackTraces&&u0()};var P=function(){try{if(typeof CustomEvent==="function"){var I0=new CustomEvent("CustomEvent");return J.global.dispatchEvent(I0),function(B,S){var u=new CustomEvent(B.toLowerCase(),{detail:S,cancelable:!0});return!J.global.dispatchEvent(u)}}else if(typeof Event==="function"){var I0=new Event("CustomEvent");return J.global.dispatchEvent(I0),function(S,u){var s=new Event(S.toLowerCase(),{cancelable:!0});return s.detail=u,!J.global.dispatchEvent(s)}}else{var I0=document.createEvent("CustomEvent");return I0.initCustomEvent("testingtheevent",!1,!0,{}),J.global.dispatchEvent(I0),function(S,u){var s=document.createEvent("CustomEvent");return s.initCustomEvent(S.toLowerCase(),!1,!0,u),!J.global.dispatchEvent(s)}}}catch(B){}return function(){return!1}}(),T=function(){if(J.isNode)return function(){return process.emit.apply(process,arguments)};else{if(!J.global)return function(){return!1};return function(I0){var B="on"+I0.toLowerCase(),S=J.global[B];if(!S)return!1;return S.apply(J.global,[].slice.call(arguments,1)),!0}}}();function A(I0,B){return{promise:B}}var E={promiseCreated:A,promiseFulfilled:A,promiseRejected:A,promiseResolved:A,promiseCancelled:A,promiseChained:function(I0,B,S){return{promise:B,child:S}},warning:function(I0,B){return{warning:B}},unhandledRejection:function(I0,B,S){return{reason:B,promise:S}},rejectionHandled:A},C=function(I0){var B=!1;try{B=T.apply(null,arguments)}catch(u){Q.throwLater(u),B=!0}var S=!1;try{S=P(I0,E[I0].apply(null,arguments))}catch(u){Q.throwLater(u),S=!0}return S||B};$.config=function(I0){if(I0=Object(I0),"longStackTraces"in I0){if(I0.longStackTraces)$.longStackTraces();else if(!I0.longStackTraces&&$.hasLongStackTraces())D()}if("warnings"in I0){var B=I0.warnings;if(D0.warnings=!!B,O=D0.warnings,J.isObject(B)){if("wForgottenReturn"in B)O=!!B.wForgottenReturn}}if("cancellation"in I0&&I0.cancellation&&!D0.cancellation){if(Q.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=Q0,$.prototype._propagateFrom=k,$.prototype._onCancel=b,$.prototype._setOnCancel=n,$.prototype._attachCancellationCallback=h,$.prototype._execute=x,a=k,D0.cancellation=!0}if("monitoring"in I0){if(I0.monitoring&&!D0.monitoring)D0.monitoring=!0,$.prototype._fireEvent=C;else if(!I0.monitoring&&D0.monitoring)D0.monitoring=!1,$.prototype._fireEvent=i}return $};function i(){return!1}$.prototype._fireEvent=i,$.prototype._execute=function(I0,B,S){try{I0(B,S)}catch(u){return u}},$.prototype._onCancel=function(){},$.prototype._setOnCancel=function(I0){},$.prototype._attachCancellationCallback=function(I0){},$.prototype._captureStackTrace=function(){},$.prototype._attachExtraTrace=function(){},$.prototype._clearCancellationData=function(){},$.prototype._propagateFrom=function(I0,B){};function x(I0,B,S){var u=this;try{I0(B,S,function(s){if(typeof s!=="function")throw TypeError("onCancel must be a function, got: "+J.toString(s));u._attachCancellationCallback(s)})}catch(s){return s}}function h(I0){if(!this._isCancellable())return this;var B=this._onCancel();if(B!==void 0)if(J.isArray(B))B.push(I0);else this._setOnCancel([B,I0]);else this._setOnCancel(I0)}function b(){return this._onCancelField}function n(I0){this._onCancelField=I0}function Q0(){this._cancellationParent=void 0,this._onCancelField=void 0}function k(I0,B){if((B&1)!==0){this._cancellationParent=I0;var S=I0._branchesRemainingToCancel;if(S===void 0)S=0;I0._branchesRemainingToCancel=S+1}if((B&2)!==0&&I0._isBound())this._setBoundTo(I0._boundTo)}function m(I0,B){if((B&2)!==0&&I0._isBound())this._setBoundTo(I0._boundTo)}var a=m;function $0(){var I0=this._boundTo;if(I0!==void 0){if(I0 instanceof $)if(I0.isFulfilled())return I0.value();else return}return I0}function g(){this._trace=new b1(this._peekContext())}function p(I0,B){if(K(I0)){var S=this._trace;if(S!==void 0){if(B)S=S._parent}if(S!==void 0)S.attachExtraTrace(I0);else if(!I0.__stackCleaned__){var u=r0(I0);J.notEnumerableProp(I0,"stack",u.message+`
|
||||
`+u.stack.join(`
|
||||
`)),J.notEnumerableProp(I0,"__stackCleaned__",!0)}}}function Y0(I0,B,S,u,s){if(I0===void 0&&B!==null&&O){if(s!==void 0&&s._returnedNonUndefined())return;if((u._bitField&65535)===0)return;if(S)S=S+" ";var W0="",J0="";if(B._trace){var Z0=B._trace.stack.split(`
|
||||
`),M0=A0(Z0);for(var B0=M0.length-1;B0>=0;--B0){var s0=M0[B0];if(!W.test(s0)){var J1=s0.match(X);if(J1)W0="at "+J1[1]+":"+J1[2]+":"+J1[3]+" ";break}}if(M0.length>0){var U1=M0[0];for(var B0=0;B0<Z0.length;++B0)if(Z0[B0]===U1){if(B0>0)J0=`
|
||||
`+Z0[B0-1];break}}}var B1="a promise was created in a "+S+"handler "+W0+"but was not returned from it, see http://goo.gl/rRqMUw"+J0;u._warn(B1,!0,B)}}function y(I0,B){var S=I0+" is deprecated and will be removed in a future version.";if(B)S+=" Use "+B+" instead.";return c(S)}function c(I0,B,S){if(!D0.warnings)return;var u=new I(I0),s;if(B)S._attachExtraTrace(u);else if(D0.longStackTraces&&(s=$._peekContext()))s.attachExtraTrace(u);else{var W0=r0(u);u.stack=W0.message+`
|
||||
`+W0.stack.join(`
|
||||
`)}if(!C("warning",u))X1(u,"",!0)}function e(I0,B){for(var S=0;S<B.length-1;++S)B[S].push("From previous event:"),B[S]=B[S].join(`
|
||||
`);if(S<B.length)B[S]=B[S].join(`
|
||||
`);return I0+`
|
||||
`+B.join(`
|
||||
`)}function V0(I0){for(var B=0;B<I0.length;++B)if(I0[B].length===0||B+1<I0.length&&I0[B][0]===I0[B+1][0])I0.splice(B,1),B--}function j0(I0){var B=I0[0];for(var S=1;S<I0.length;++S){var u=I0[S],s=B.length-1,W0=B[s],J0=-1;for(var Z0=u.length-1;Z0>=0;--Z0)if(u[Z0]===W0){J0=Z0;break}for(var Z0=J0;Z0>=0;--Z0){var M0=u[Z0];if(B[s]===M0)B.pop(),s--;else break}B=u}}function A0(I0){var B=[];for(var S=0;S<I0.length;++S){var u=I0[S],s=u===" (No stack trace)"||Z.test(u),W0=s&&b0(u);if(s&&!W0){if(V&&u.charAt(0)!==" ")u=" "+u;B.push(u)}}return B}function R0(I0){var B=I0.stack.replace(/\s+$/g,"").split(`
|
||||
`);for(var S=0;S<B.length;++S){var u=B[S];if(u===" (No stack trace)"||Z.test(u))break}if(S>0&&I0.name!="SyntaxError")B=B.slice(S);return B}function r0(I0){var B=I0.stack,S=I0.toString();return B=typeof B==="string"&&B.length>0?R0(I0):[" (No stack trace)"],{message:S,stack:I0.name=="SyntaxError"?B:A0(B)}}function X1(I0,B,S){if(typeof console<"u"){var u;if(J.isObject(I0)){var s=I0.stack;u=B+q(s,I0)}else u=B+String(I0);if(typeof w==="function")w(u,S);else if(typeof console.log==="function"||typeof console.log==="object")console.log(u)}}function t(I0,B,S,u){var s=!1;try{if(typeof B==="function")if(s=!0,I0==="rejectionHandled")B(u);else B(S,u)}catch(W0){Q.throwLater(W0)}if(I0==="unhandledRejection"){if(!C(I0,S,u)&&!s)X1(S,"Unhandled rejection ")}else C(I0,u)}function X0(I0){var B;if(typeof I0==="function")B="[function "+(I0.name||"anonymous")+"]";else{B=I0&&typeof I0.toString==="function"?I0.toString():J.toString(I0);var S=/\[object [a-zA-Z0-9$_]+\]/;if(S.test(B))try{var u=JSON.stringify(I0);B=u}catch(s){}if(B.length===0)B="(empty array)"}return"(<"+w0(B)+">, no stack trace)"}function w0(I0){var B=41;if(I0.length<B)return I0;return I0.substr(0,B-3)+"..."}function u0(){return typeof i1==="function"}var b0=function(){return!1},c0=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function T1(I0){var B=I0.match(c0);if(B)return{fileName:B[1],line:parseInt(B[2],10)}}function x1(I0,B){if(!u0())return;var S=I0.stack.split(`
|
||||
`),u=B.stack.split(`
|
||||
`),s=-1,W0=-1,J0,Z0;for(var M0=0;M0<S.length;++M0){var B0=T1(S[M0]);if(B0){J0=B0.fileName,s=B0.line;break}}for(var M0=0;M0<u.length;++M0){var B0=T1(u[M0]);if(B0){Z0=B0.fileName,W0=B0.line;break}}if(s<0||W0<0||!J0||!Z0||J0!==Z0||s>=W0)return;b0=function(s0){if(H.test(s0))return!0;var J1=T1(s0);if(J1){if(J1.fileName===J0&&(s<=J1.line&&J1.line<=W0))return!0}return!1}}function b1(I0){this._parent=I0,this._promisesCreated=0;var B=this._length=1+(I0===void 0?0:I0._length);if(i1(this,b1),B>32)this.uncycle()}J.inherits(b1,Error),Y.CapturedTrace=b1,b1.prototype.uncycle=function(){var I0=this._length;if(I0<2)return;var B=[],S={};for(var u=0,s=this;s!==void 0;++u)B.push(s),s=s._parent;I0=this._length=u;for(var u=I0-1;u>=0;--u){var W0=B[u].stack;if(S[W0]===void 0)S[W0]=u}for(var u=0;u<I0;++u){var J0=B[u].stack,Z0=S[J0];if(Z0!==void 0&&Z0!==u){if(Z0>0)B[Z0-1]._parent=void 0,B[Z0-1]._length=1;B[u]._parent=void 0,B[u]._length=1;var M0=u>0?B[u-1]:this;if(Z0<I0-1)M0._parent=B[Z0+1],M0._parent.uncycle(),M0._length=M0._parent._length+1;else M0._parent=void 0,M0._length=1;var B0=M0._length+1;for(var s0=u-2;s0>=0;--s0)B[s0]._length=B0,B0++;return}}},b1.prototype.attachExtraTrace=function(I0){if(I0.__stackCleaned__)return;this.uncycle();var B=r0(I0),S=B.message,u=[B.stack],s=this;while(s!==void 0)u.push(A0(s.stack.split(`
|
||||
`))),s=s._parent;j0(u),V0(u),J.notEnumerableProp(I0,"stack",e(S,u)),J.notEnumerableProp(I0,"__stackCleaned__",!0)};var i1=function(){var B=/^\s*at\s*/,S=function(J0,Z0){if(typeof J0==="string")return J0;if(Z0.name!==void 0&&Z0.message!==void 0)return Z0.toString();return X0(Z0)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,Z=B,q=S;var u=Error.captureStackTrace;return b0=function(J0){return H.test(J0)},function(J0,Z0){Error.stackTraceLimit+=6,u(J0,Z0),Error.stackTraceLimit-=6}}var s=Error();if(typeof s.stack==="string"&&s.stack.split(`
|
||||
`)[0].indexOf("stackDetection@")>=0)return Z=/@/,q=S,V=!0,function(Z0){Z0.stack=Error().stack};var W0;try{throw Error()}catch(J0){W0="stack"in J0}if(!("stack"in s)&&W0&&typeof Error.stackTraceLimit==="number")return Z=B,q=S,function(Z0){Error.stackTraceLimit+=6;try{throw Error()}catch(M0){Z0.stack=M0.stack}Error.stackTraceLimit-=6};return q=function(J0,Z0){if(typeof J0==="string")return J0;if((typeof Z0==="object"||typeof Z0==="function")&&Z0.name!==void 0&&Z0.message!==void 0)return Z0.toString();return X0(Z0)},null}([]);if(typeof console<"u"&&typeof console.warn<"u"){if(w=function(I0){console.warn(I0)},J.isNode&&process.stderr.isTTY)w=function(I0,B){var S=B?"\x1B[33m":"\x1B[31m";console.warn(S+I0+`\x1B[0m
|
||||
`)};else if(!J.isNode&&typeof Error().stack==="string")w=function(I0,B){console.warn("%c"+I0,B?"color: darkorange":"color: red")}}var D0={warnings:F,longStackTraces:!1,cancellation:!1,monitoring:!1};if(N)$.longStackTraces();return{longStackTraces:function(){return D0.longStackTraces},warnings:function(){return D0.warnings},cancellation:function(){return D0.cancellation},monitoring:function(){return D0.monitoring},propagateFromFunction:function(){return a},boundValueFunction:function(){return $0},checkForgottenReturns:Y0,setBounds:x1,warn:c,deprecated:y,CapturedTrace:b1,fireDomEvent:P,fireGlobalEvent:T}}});var bw0=j((t04,uw0)=>{uw0.exports=function($,Y){var U=N4(),Q=$.CancellationError,I=U.errorObj;function J(X,Z,q){this.promise=X,this.type=Z,this.handler=q,this.called=!1,this.cancelPromise=null}J.prototype.isFinallyHandler=function(){return this.type===0};function K(X){this.finallyHandler=X}K.prototype._resultCancelled=function(){z(this.finallyHandler)};function z(X,Z){if(X.cancelPromise!=null){if(arguments.length>1)X.cancelPromise._reject(Z);else X.cancelPromise._cancel();return X.cancelPromise=null,!0}return!1}function G(){return W.call(this,this.promise._target()._settledValue())}function H(X){if(z(this,X))return;return I.e=X,I}function W(X){var Z=this.promise,q=this.handler;if(!this.called){this.called=!0;var V=this.isFinallyHandler()?q.call(Z._boundValue()):q.call(Z._boundValue(),X);if(V!==void 0){Z._setReturnedNonUndefined();var w=Y(V,Z);if(w instanceof $){if(this.cancelPromise!=null){if(w._isCancelled()){var M=new Q("late cancellation observer");return Z._attachExtraTrace(M),I.e=M,I}else if(w.isPending())w._attachCancellationCallback(new K(this))}return w._then(G,H,void 0,this,void 0)}}}if(Z.isRejected())return z(this),I.e=X,I;else return z(this),X}return $.prototype._passThrough=function(X,Z,q,V){if(typeof X!=="function")return this.then();return this._then(q,V,void 0,new J(this,Z,X),void 0)},$.prototype.lastly=$.prototype.finally=function(X){return this._passThrough(X,0,W,W)},$.prototype.tap=function(X){return this._passThrough(X,1,W)},J}});var cw0=j((a04,iw0)=>{iw0.exports=function($){var Y=N4(),U=KQ().keys,Q=Y.tryCatch,I=Y.errorObj;function J(K,z,G){return function(H){var W=G._boundValue();$:for(var X=0;X<K.length;++X){var Z=K[X];if(Z===Error||Z!=null&&Z.prototype instanceof Error){if(H instanceof Z)return Q(z).call(W,H)}else if(typeof Z==="function"){var q=Q(Z).call(W,H);if(q===I)return q;else if(q)return Q(z).call(W,H)}else if(Y.isObject(H)){var V=U(Z);for(var w=0;w<V.length;++w){var M=V[w];if(Z[M]!=H[M])continue $}return Q(z).call(W,H)}}return $}}return J}});var mc=j((e04,pw0)=>{var nw0=N4(),SF1=nw0.maybeWrapAsError,hF1=f3(),gF1=hF1.OperationalError,dw0=KQ();function yF1($){return $ instanceof Error&&dw0.getPrototypeOf($)===Error.prototype}var kF1=/^(?:name|message|stack|cause)$/;function xF1($){var Y;if(yF1($)){Y=new gF1($),Y.name=$.name,Y.message=$.message,Y.stack=$.stack;var U=dw0.keys($);for(var Q=0;Q<U.length;++Q){var I=U[Q];if(!kF1.test(I))Y[I]=$[I]}return Y}return nw0.markAsOriginatingFromRejection($),$}function fF1($,Y){return function(U,Q){if($===null)return;if(U){var I=xF1(SF1(U));$._attachExtraTrace(I),$._reject(I)}else if(!Y)$._fulfill(Q);else{var J=arguments.length,K=Array(Math.max(J-1,0));for(var z=1;z<J;++z)K[z-1]=arguments[z];$._fulfill(K)}$=null}}pw0.exports=fF1});var lw0=j(($14,mw0)=>{mw0.exports=function($,Y,U,Q,I){var J=N4(),K=J.tryCatch;$.method=function(z){if(typeof z!=="function")throw new $.TypeError("expecting a function but got "+J.classString(z));return function(){var G=new $(Y);G._captureStackTrace(),G._pushContext();var H=K(z).apply(this,arguments),W=G._popContext();return I.checkForgottenReturns(H,W,"Promise.method",G),G._resolveFromSyncValue(H),G}},$.attempt=$.try=function(z){if(typeof z!=="function")return Q("expecting a function but got "+J.classString(z));var G=new $(Y);G._captureStackTrace(),G._pushContext();var H;if(arguments.length>1){I.deprecated("calling Promise.try with more than 1 argument");var W=arguments[1],X=arguments[2];H=J.isArray(W)?K(z).apply(X,W):K(z).call(X,W)}else H=K(z)();var Z=G._popContext();return I.checkForgottenReturns(H,Z,"Promise.try",G),G._resolveFromSyncValue(H),G},$.prototype._resolveFromSyncValue=function(z){if(z===J.errorObj)this._rejectCallback(z.e,!1);else this._resolveCallback(z,!0)}}});var rw0=j((Y14,ow0)=>{ow0.exports=function($,Y,U,Q){var I=!1,J=function(H,W){this._reject(W)},K=function(H,W){W.promiseRejectionQueued=!0,W.bindingPromise._then(J,J,null,this,H)},z=function(H,W){if((this._bitField&50397184)===0)this._resolveCallback(W.target)},G=function(H,W){if(!W.promiseRejectionQueued)this._reject(H)};$.prototype.bind=function(H){if(!I)I=!0,$.prototype._propagateFrom=Q.propagateFromFunction(),$.prototype._boundValue=Q.boundValueFunction();var W=U(H),X=new $(Y);X._propagateFrom(this,1);var Z=this._target();if(X._setBoundTo(W),W instanceof $){var q={promiseRejectionQueued:!1,promise:X,target:Z,bindingPromise:W};Z._then(Y,K,vo
Line truncated
|
||||
`);$.prototype._captureStackTrace=a,$.prototype._attachExtraTrace=T,Y.deactivateLongStackTraces(),Q.enableTrampoline(),N0.longStackTraces=!1},$.prototype._captureStackTrace=g,$.prototype._attachExtraTrace=d,Y.activateLongStackTraces(),Q.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return N0.longStackTraces&&u0()};var B=function(){try{if(typeof CustomEvent==="function"){var a=new CustomEvent("CustomEvent");return J.global.dispatchEvent(a),function(T,v){var c=new CustomEvent(T.toLowerCase(),{detail:v,cancelable:!0});return!J.global.dispatchEvent(c)}}else if(typeof Event==="function"){var a=new Event("CustomEvent");return J.global.dispatchEvent(a),function(v,c){var s=new Event(v.toLowerCase(),{cancelable:!0});return s.detail=c,!J.global.dispatchEvent(s)}}else{var a=document.createEvent("CustomEvent");return a.initCustomEvent("testingtheevent",!1,!0,{}),J.global.dispatchEvent(a),function(v,c){var s=document.createEvent("CustomEvent");return s.initCustomEvent(v.toLowerCase(),!1,!0,c),!J.global.dispatchEvent(s)}}}catch(T){}return function(){return!1}}(),A=function(){if(J.isNode)return function(){return process.emit.apply(process,arguments)};else{if(!J.global)return function(){return!1};return function(a){var T="on"+a.toLowerCase(),v=J.global[T];if(!v)return!1;return v.apply(J.global,[].slice.call(arguments,1)),!0}}}();function P(a,T){return{promise:T}}var j={promiseCreated:P,promiseFulfilled:P,promiseRejected:P,promiseResolved:P,promiseCancelled:P,promiseChained:function(a,T,v){return{promise:T,child:v}},warning:function(a,T){return{warning:T}},unhandledRejection:function(a,T,v){return{reason:T,promise:v}},rejectionHandled:P},C=function(a){var T=!1;try{T=A.apply(null,arguments)}catch(c){Q.throwLater(c),T=!0}var v=!1;try{v=B(a,j[a].apply(null,arguments))}catch(c){Q.throwLater(c),v=!0}return v||T};$.config=function(a){if(a=Object(a),"longStackTraces"in a){if(a.longStackTraces)$.longStackTraces();else if(!a.longStackTraces&&$.hasLongStackTraces())N()}if("warnings"in a){var T=a.warnings;if(N0.warnings=!!T,O=N0.warnings,J.isObject(T)){if("wForgottenReturn"in T)O=!!T.wForgottenReturn}}if("cancellation"in a&&a.cancellation&&!N0.cancellation){if(Q.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=I0,$.prototype._propagateFrom=k,$.prototype._onCancel=b,$.prototype._setOnCancel=n,$.prototype._attachCancellationCallback=S,$.prototype._execute=x,e=k,N0.cancellation=!0}if("monitoring"in a){if(a.monitoring&&!N0.monitoring)N0.monitoring=!0,$.prototype._fireEvent=C;else if(!a.monitoring&&N0.monitoring)N0.monitoring=!1,$.prototype._fireEvent=u}return $};function u(){return!1}$.prototype._fireEvent=u,$.prototype._execute=function(a,T,v){try{a(T,v)}catch(c){return c}},$.prototype._onCancel=function(){},$.prototype._setOnCancel=function(a){},$.prototype._attachCancellationCallback=function(a){},$.prototype._captureStackTrace=function(){},$.prototype._attachExtraTrace=function(){},$.prototype._clearCancellationData=function(){},$.prototype._propagateFrom=function(a,T){};function x(a,T,v){var c=this;try{a(T,v,function(s){if(typeof s!=="function")throw TypeError("onCancel must be a function, got: "+J.toString(s));c._attachCancellationCallback(s)})}catch(s){return s}}function S(a){if(!this._isCancellable())return this;var T=this._onCancel();if(T!==void 0)if(J.isArray(T))T.push(a);else this._setOnCancel([T,a]);else this._setOnCancel(a)}function b(){return this._onCancelField}function n(a){this._onCancelField=a}function I0(){this._cancellationParent=void 0,this._onCancelField=void 0}function k(a,T){if((T&1)!==0){this._cancellationParent=a;var v=a._branchesRemainingToCancel;if(v===void 0)v=0;a._branchesRemainingToCancel=v+1}if((T&2)!==0&&a._isBound())this._setBoundTo(a._boundTo)}function m(a,T){if((T&2)!==0&&a._isBound())this._setBoundTo(a._boundTo)}var e=m;function Y0(){var a=this._boundTo;if(a!==void 0){if(a instanceof $)if(a.isFulfilled())return a.value();else return}return a}function g(){this._trace=new c1(this._peekContext())}function d(a,T){if(K(a)){var v=this._trace;if(v!==void 0){if(T)v=v._parent}if(v!==void 0)v.attachExtraTrace(a);else if(!a.__stackCleaned__){var c=r0(a);J.notEnumerableProp(a,"stack",c.message+`
|
||||
`+c.stack.join(`
|
||||
`)),J.notEnumerableProp(a,"__stackCleaned__",!0)}}}function U0(a,T,v,c,s){if(a===void 0&&T!==null&&O){if(s!==void 0&&s._returnedNonUndefined())return;if((c._bitField&65535)===0)return;if(v)v=v+" ";var X0="",K0="";if(T._trace){var Z0=T._trace.stack.split(`
|
||||
`),F0=P0(Z0);for(var B0=F0.length-1;B0>=0;--B0){var s0=F0[B0];if(!W.test(s0)){var J1=s0.match(X);if(J1)X0="at "+J1[1]+":"+J1[2]+":"+J1[3]+" ";break}}if(F0.length>0){var U1=F0[0];for(var B0=0;B0<Z0.length;++B0)if(Z0[B0]===U1){if(B0>0)K0=`
|
||||
`+Z0[B0-1];break}}}var A1="a promise was created in a "+v+"handler "+X0+"but was not returned from it, see http://goo.gl/rRqMUw"+K0;c._warn(A1,!0,T)}}function y(a,T){var v=a+" is deprecated and will be removed in a future version.";if(T)v+=" Use "+T+" instead.";return i(v)}function i(a,T,v){if(!N0.warnings)return;var c=new I(a),s;if(T)v._attachExtraTrace(c);else if(N0.longStackTraces&&(s=$._peekContext()))s.attachExtraTrace(c);else{var X0=r0(c);c.stack=X0.message+`
|
||||
`+X0.stack.join(`
|
||||
`)}if(!C("warning",c))X1(c,"",!0)}function $0(a,T){for(var v=0;v<T.length-1;++v)T[v].push("From previous event:"),T[v]=T[v].join(`
|
||||
`);if(v<T.length)T[v]=T[v].join(`
|
||||
`);return a+`
|
||||
`+T.join(`
|
||||
`)}function V0(a){for(var T=0;T<a.length;++T)if(a[T].length===0||T+1<a.length&&a[T][0]===a[T+1][0])a.splice(T,1),T--}function E0(a){var T=a[0];for(var v=1;v<a.length;++v){var c=a[v],s=T.length-1,X0=T[s],K0=-1;for(var Z0=c.length-1;Z0>=0;--Z0)if(c[Z0]===X0){K0=Z0;break}for(var Z0=K0;Z0>=0;--Z0){var F0=c[Z0];if(T[s]===F0)T.pop(),s--;else break}T=c}}function P0(a){var T=[];for(var v=0;v<a.length;++v){var c=a[v],s=c===" (No stack trace)"||Z.test(c),X0=s&&b0(c);if(s&&!X0){if(V&&c.charAt(0)!==" ")c=" "+c;T.push(c)}}return T}function R0(a){var T=a.stack.replace(/\s+$/g,"").split(`
|
||||
`);for(var v=0;v<T.length;++v){var c=T[v];if(c===" (No stack trace)"||Z.test(c))break}if(v>0&&a.name!="SyntaxError")T=T.slice(v);return T}function r0(a){var T=a.stack,v=a.toString();return T=typeof T==="string"&&T.length>0?R0(a):[" (No stack trace)"],{message:v,stack:a.name=="SyntaxError"?T:P0(T)}}function X1(a,T,v){if(typeof console<"u"){var c;if(J.isObject(a)){var s=a.stack;c=T+q(s,a)}else c=T+String(a);if(typeof w==="function")w(c,v);else if(typeof console.log==="function"||typeof console.log==="object")console.log(c)}}function t(a,T,v,c){var s=!1;try{if(typeof T==="function")if(s=!0,a==="rejectionHandled")T(c);else T(v,c)}catch(X0){Q.throwLater(X0)}if(a==="unhandledRejection"){if(!C(a,v,c)&&!s)X1(v,"Unhandled rejection ")}else C(a,c)}function G0(a){var T;if(typeof a==="function")T="[function "+(a.name||"anonymous")+"]";else{T=a&&typeof a.toString==="function"?a.toString():J.toString(a);var v=/\[object [a-zA-Z0-9$_]+\]/;if(v.test(T))try{var c=JSON.stringify(a);T=c}catch(s){}if(T.length===0)T="(empty array)"}return"(<"+O0(T)+">, no stack trace)"}function O0(a){var T=41;if(a.length<T)return a;return a.substr(0,T-3)+"..."}function u0(){return typeof C1==="function"}var b0=function(){return!1},n0=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function O1(a){var T=a.match(n0);if(T)return{fileName:T[1],line:parseInt(T[2],10)}}function r1(a,T){if(!u0())return;var v=a.stack.split(`
|
||||
`),c=T.stack.split(`
|
||||
`),s=-1,X0=-1,K0,Z0;for(var F0=0;F0<v.length;++F0){var B0=O1(v[F0]);if(B0){K0=B0.fileName,s=B0.line;break}}for(var F0=0;F0<c.length;++F0){var B0=O1(c[F0]);if(B0){Z0=B0.fileName,X0=B0.line;break}}if(s<0||X0<0||!K0||!Z0||K0!==Z0||s>=X0)return;b0=function(s0){if(G.test(s0))return!0;var J1=O1(s0);if(J1){if(J1.fileName===K0&&(s<=J1.line&&J1.line<=X0))return!0}return!1}}function c1(a){this._parent=a,this._promisesCreated=0;var T=this._length=1+(a===void 0?0:a._length);if(C1(this,c1),T>32)this.uncycle()}J.inherits(c1,Error),Y.CapturedTrace=c1,c1.prototype.uncycle=function(){var a=this._length;if(a<2)return;var T=[],v={};for(var c=0,s=this;s!==void 0;++c)T.push(s),s=s._parent;a=this._length=c;for(var c=a-1;c>=0;--c){var X0=T[c].stack;if(v[X0]===void 0)v[X0]=c}for(var c=0;c<a;++c){var K0=T[c].stack,Z0=v[K0];if(Z0!==void 0&&Z0!==c){if(Z0>0)T[Z0-1]._parent=void 0,T[Z0-1]._length=1;T[c]._parent=void 0,T[c]._length=1;var F0=c>0?T[c-1]:this;if(Z0<a-1)F0._parent=T[Z0+1],F0._parent.uncycle(),F0._length=F0._parent._length+1;else F0._parent=void 0,F0._length=1;var B0=F0._length+1;for(var s0=c-2;s0>=0;--s0)T[s0]._length=B0,B0++;return}}},c1.prototype.attachExtraTrace=function(a){if(a.__stackCleaned__)return;this.uncycle();var T=r0(a),v=T.message,c=[T.stack],s=this;while(s!==void 0)c.push(P0(s.stack.split(`
|
||||
`))),s=s._parent;E0(c),V0(c),J.notEnumerableProp(a,"stack",$0(v,c)),J.notEnumerableProp(a,"__stackCleaned__",!0)};var C1=function(){var T=/^\s*at\s*/,v=function(K0,Z0){if(typeof K0==="string")return K0;if(Z0.name!==void 0&&Z0.message!==void 0)return Z0.toString();return G0(Z0)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,Z=T,q=v;var c=Error.captureStackTrace;return b0=function(K0){return G.test(K0)},function(K0,Z0){Error.stackTraceLimit+=6,c(K0,Z0),Error.stackTraceLimit-=6}}var s=Error();if(typeof s.stack==="string"&&s.stack.split(`
|
||||
`)[0].indexOf("stackDetection@")>=0)return Z=/@/,q=v,V=!0,function(Z0){Z0.stack=Error().stack};var X0;try{throw Error()}catch(K0){X0="stack"in K0}if(!("stack"in s)&&X0&&typeof Error.stackTraceLimit==="number")return Z=T,q=v,function(Z0){Error.stackTraceLimit+=6;try{throw Error()}catch(F0){Z0.stack=F0.stack}Error.stackTraceLimit-=6};return q=function(K0,Z0){if(typeof K0==="string")return K0;if((typeof Z0==="object"||typeof Z0==="function")&&Z0.name!==void 0&&Z0.message!==void 0)return Z0.toString();return G0(Z0)},null}([]);if(typeof console<"u"&&typeof console.warn<"u"){if(w=function(a){console.warn(a)},J.isNode&&process.stderr.isTTY)w=function(a,T){var v=T?"\x1B[33m":"\x1B[31m";console.warn(v+a+`\x1B[0m
|
||||
`)};else if(!J.isNode&&typeof Error().stack==="string")w=function(a,T){console.warn("%c"+a,T?"color: darkorange":"color: red")}}var N0={warnings:F,longStackTraces:!1,cancellation:!1,monitoring:!1};if(D)$.longStackTraces();return{longStackTraces:function(){return N0.longStackTraces},warnings:function(){return N0.warnings},cancellation:function(){return N0.cancellation},monitoring:function(){return N0.monitoring},propagateFromFunction:function(){return e},boundValueFunction:function(){return Y0},checkForgottenReturns:U0,setBounds:r1,warn:i,deprecated:y,CapturedTrace:c1,fireDomEvent:B,fireGlobalEvent:A}}});var SM0=E((j44,hM0)=>{hM0.exports=function($,Y){var U=B4(),Q=$.CancellationError,I=U.errorObj;function J(X,Z,q){this.promise=X,this.type=Z,this.handler=q,this.called=!1,this.cancelPromise=null}J.prototype.isFinallyHandler=function(){return this.type===0};function K(X){this.finallyHandler=X}K.prototype._resultCancelled=function(){z(this.finallyHandler)};function z(X,Z){if(X.cancelPromise!=null){if(arguments.length>1)X.cancelPromise._reject(Z);else X.cancelPromise._cancel();return X.cancelPromise=null,!0}return!1}function H(){return W.call(this,this.promise._target()._settledValue())}function G(X){if(z(this,X))return;return I.e=X,I}function W(X){var Z=this.promise,q=this.handler;if(!this.called){this.called=!0;var V=this.isFinallyHandler()?q.call(Z._boundValue()):q.call(Z._boundValue(),X);if(V!==void 0){Z._setReturnedNonUndefined();var w=Y(V,Z);if(w instanceof $){if(this.cancelPromise!=null){if(w._isCancelled()){var M=new Q("late cancellation observer");return Z._attachExtraTrace(M),I.e=M,I}else if(w.isPending())w._attachCancellationCallback(new K(this))}return w._then(H,G,void 0,this,void 0)}}}if(Z.isRejected())return z(this),I.e=X,I;else return z(this),X}return $.prototype._passThrough=function(X,Z,q,V){if(typeof X!=="function")return this.then();return this._then(q,V,void 0,new J(this,Z,X),void 0)},$.prototype.lastly=$.prototype.finally=function(X){return this._passThrough(X,0,W,W)},$.prototype.tap=function(X){return this._passThrough(X,1,W)},J}});var yM0=E((E44,gM0)=>{gM0.exports=function($){var Y=B4(),U=GQ().keys,Q=Y.tryCatch,I=Y.errorObj;function J(K,z,H){return function(G){var W=H._boundValue();$:for(var X=0;X<K.length;++X){var Z=K[X];if(Z===Error||Z!=null&&Z.prototype instanceof Error){if(G instanceof Z)return Q(z).call(W,G)}else if(typeof Z==="function"){var q=Q(Z).call(W,G);if(q===I)return q;else if(q)return Q(z).call(W,G)}else if(Y.isObject(G)){var V=U(Z);for(var w=0;w<V.length;++w){var M=V[w];if(Z[M]!=G[M])continue $}return Q(z).call(W,G)}}return $}}return J}});var On=E((C44,fM0)=>{var kM0=B4(),mF1=kM0.maybeWrapAsError,lF1=u3(),oF1=lF1.OperationalError,xM0=GQ();function rF1($){return $ instanceof Error&&xM0.getPrototypeOf($)===Error.prototype}var sF1=/^(?:name|message|stack|cause)$/;function aF1($){var Y;if(rF1($)){Y=new oF1($),Y.name=$.name,Y.message=$.message,Y.stack=$.stack;var U=xM0.keys($);for(var Q=0;Q<U.length;++Q){var I=U[Q];if(!sF1.test(I))Y[I]=$[I]}return Y}return kM0.markAsOriginatingFromRejection($),$}function tF1($,Y){return function(U,Q){if($===null)return;if(U){var I=aF1(mF1(U));$._attachExtraTrace(I),$._reject(I)}else if(!Y)$._fulfill(Q);else{var J=arguments.length,K=Array(Math.max(J-1,0));for(var z=1;z<J;++z)K[z-1]=arguments[z];$._fulfill(K)}$=null}}fM0.exports=tF1});var bM0=E((R44,uM0)=>{uM0.exports=function($,Y,U,Q,I){var J=B4(),K=J.tryCatch;$.method=function(z){if(typeof z!=="function")throw new $.TypeError("expecting a function but got "+J.classString(z));return function(){var H=new $(Y);H._captureStackTrace(),H._pushContext();var G=K(z).apply(this,arguments),W=H._popContext();return I.checkForgottenReturns(G,W,"Promise.method",H),H._resolveFromSyncValue(G),H}},$.attempt=$.try=function(z){if(typeof z!=="function")return Q("expecting a function but got "+J.classString(z));var H=new $(Y);H._captureStackTrace(),H._pushContext();var G;if(arguments.length>1){I.deprecated("calling Promise.try with more than 1 argument");var W=arguments[1],X=arguments[2];G=J.isArray(W)?K(z).apply(X,W):K(z).call(X,W)}else G=K(z)();var Z=H._popContext();return I.checkForgottenReturns(G,Z,"Promise.try",H),H._resolveFromSyncValue(G),H},$.prototype._resolveFromSyncValue=function(z){if(z===J.errorObj)this._rejectCallback(z.e,!1);else this._resolveCallback(z,!0)}}});var cM0=E((_44,iM0)=>{iM0.exports=function($,Y,U,Q){var I=!1,J=function(G,W){this._reject(W)},K=function(G,W){W.promiseRejectionQueued=!0,W.bindingPromise._then(J,J,null,this,G)},z=function(G,W){if((this._bitField&50397184)===0)this._resolveCallback(W.target)},H=function(G,W){if(!W.promiseRejectionQueued)this._reject(G)};$.prototype.bind=function(G){if(!I)I=!0,$.prototype._propagateFrom=Q.propagateFromFunction(),$.prototype._boundValue=Q.boundValueFunction();var W=U(G),X=new $(Y);X._propagateFrom(this,1);var Z=this._target();if(X._setBoundTo(W),W instanceof $){var q={promiseRejectionQueued:!1,promise:X,target:Z,bindingPromise:W};Z._then(Y,K,void
Line truncated
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`);return this._settledValue()},Q=Y.prototype.error=Y.prototype.reason=function(){if(!this.isRejected())throw TypeError(`cannot get rejection reason of a non-rejected promise
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`);return this._settledValue()},I=Y.prototype.isFulfilled=function(){return(this._bitField&33554432)!==0},J=Y.prototype.isRejected=function(){return(this._bitField&16777216)!==0},K=Y.prototype.isPending=function(){return(this._bitField&50397184)===0},z=Y.prototype.isResolved=function(){return(this._bitField&50331648)!==0};Y.prototype.isCancelled=function(){return(this._bitField&8454144)!==0},$.prototype.__isCancelled=function(){return(this._bitField&65536)===65536},$.prototype._isCancelled=function(){return this._target().__isCancelled()},$.prototype.isCancelled=function(){return(this._target()._bitField&8454144)!==0},$.prototype.isPending=function(){return K.call(this._target())},$.prototype.isRejected=function(){return J.call(this._target())},$.prototype.isFulfilled=function(){return I.call(this._target())},$.prototype.isResolved=function(){return z.call(this._target())},$.prototype.value=function(){return U.call(this._target())},$.prototype.reason=function(){var G=this._target();return G._unsetRejectionIsUnhandled(),Q.call(G)},$.prototype._value=function(){return this._settledValue()},$.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},$.PromiseInspection=Y}});var QM0=j((J14,UM0)=>{UM0.exports=function($,Y,U,Q,I,J){var K=N4(),z=K.canEvaluate,G=K.tryCatch,H=K.errorObj,W;if(z){var X=function(N){return Function("value","holder",`
|
||||
`);return this._settledValue()},I=Y.prototype.isFulfilled=function(){return(this._bitField&33554432)!==0},J=Y.prototype.isRejected=function(){return(this._bitField&16777216)!==0},K=Y.prototype.isPending=function(){return(this._bitField&50397184)===0},z=Y.prototype.isResolved=function(){return(this._bitField&50331648)!==0};Y.prototype.isCancelled=function(){return(this._bitField&8454144)!==0},$.prototype.__isCancelled=function(){return(this._bitField&65536)===65536},$.prototype._isCancelled=function(){return this._target().__isCancelled()},$.prototype.isCancelled=function(){return(this._target()._bitField&8454144)!==0},$.prototype.isPending=function(){return K.call(this._target())},$.prototype.isRejected=function(){return J.call(this._target())},$.prototype.isFulfilled=function(){return I.call(this._target())},$.prototype.isResolved=function(){return z.call(this._target())},$.prototype.value=function(){return U.call(this._target())},$.prototype.reason=function(){var H=this._target();return H._unsetRejectionIsUnhandled(),Q.call(H)},$.prototype._value=function(){return this._settledValue()},$.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},$.PromiseInspection=Y}});var sM0=E((g44,rM0)=>{rM0.exports=function($,Y,U,Q,I,J){var K=B4(),z=K.canEvaluate,H=K.tryCatch,G=K.errorObj,W;if(z){var X=function(D){return Function("value","holder",`
|
||||
'use strict';
|
||||
holder.pIndex = value;
|
||||
holder.checkFulfillment(this);
|
||||
`.replace(/Index/g,N))},Z=function(N){return Function("promise","holder",`
|
||||
`.replace(/Index/g,D))},Z=function(D){return Function("promise","holder",`
|
||||
'use strict';
|
||||
holder.pIndex = promise;
|
||||
`.replace(/Index/g,N))},q=function(N){var O=Array(N);for(var D=0;D<O.length;++D)O[D]="this.p"+(D+1);var P=O.join(" = ")+" = null;",T=`var promise;
|
||||
`+O.map(function(i){return`
|
||||
promise = `+i+`;
|
||||
`.replace(/Index/g,D))},q=function(D){var O=Array(D);for(var N=0;N<O.length;++N)O[N]="this.p"+(N+1);var B=O.join(" = ")+" = null;",A=`var promise;
|
||||
`+O.map(function(u){return`
|
||||
promise = `+u+`;
|
||||
if (promise instanceof Promise) {
|
||||
promise.cancel();
|
||||
}
|
||||
`}).join(`
|
||||
`),A=O.join(", "),E="Holder$"+N,C=`return function(tryCatch, errorObj, Promise, async) {
|
||||
`),P=O.join(", "),j="Holder$"+D,C=`return function(tryCatch, errorObj, Promise, async) {
|
||||
'use strict';
|
||||
function [TheName](fn) {
|
||||
[TheProperties]
|
||||
@@ -199,7 +207,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof v6))r
|
||||
|
||||
return [TheName];
|
||||
}(tryCatch, errorObj, Promise, async);
|
||||
`;return C=C.replace(/\[TheName\]/g,E).replace(/\[TheTotal\]/g,N).replace(/\[ThePassedArguments\]/g,A).replace(/\[TheProperties\]/g,P).replace(/\[CancellationCode\]/g,T),Function("tryCatch","errorObj","Promise","async",C)(G,H,$,I)},V=[],w=[],M=[];for(var F=0;F<8;++F)V.push(q(F+1)),w.push(X(F+1)),M.push(Z(F+1));W=function(N){this._reject(N)}}$.join=function(){var N=arguments.length-1,O;if(N>0&&typeof arguments[N]==="function"){if(O=arguments[N],N<=8&&z){var n=new $(Q);n._captureStackTrace();var D=V[N-1],P=new D(O),T=w;for(var A=0;A<N;++A){var E=U(arguments[A],n);if(E instanceof $){E=E._target();var C=E._bitField;if((C&50397184)===0)E._then(T[A],W,void 0,n,P),M[A](E,P),P.asyncNeeded=!1;else if((C&33554432)!==0)T[A].call(n,E._value(),P);else if((C&16777216)!==0)n._reject(E._reason());else n._cancel()}else T[A].call(n,E,P)}if(!n._isFateSealed()){if(P.asyncNeeded){var i=J();if(i!==null)P.fn=K.domainBind(i,P.fn)}n._setAsyncGuaranteed(),n._setOnCancel(P)}return n}}var x=arguments.length,h=Array(x);for(var b=0;b<x;++b)h[b]=arguments[b];if(O)h.pop();var n=new Y(h).promise();return O!==void 0?n.spread(O):n}}});var JM0=j((K14,IM0)=>{IM0.exports=function($,Y,U,Q,I,J){var K=$._getDomain,z=N4(),G=z.tryCatch,H=z.errorObj,W=$._async;function X(q,V,w,M){this.constructor$(q),this._promise._captureStackTrace();var F=K();this._callback=F===null?V:z.domainBind(F,V),this._preservedValues=M===I?Array(this.length()):null,this._limit=w,this._inFlight=0,this._queue=[],W.invoke(this._asyncInit,this,void 0)}z.inherits(X,Y),X.prototype._asyncInit=function(){this._init$(void 0,-2)},X.prototype._init=function(){},X.prototype._promiseFulfilled=function(q,V){var w=this._values,M=this.length(),F=this._preservedValues,N=this._limit;if(V<0){if(V=V*-1-1,w[V]=q,N>=1){if(this._inFlight--,this._drainQueue(),this._isResolved())return!0}}else{if(N>=1&&this._inFlight>=N)return w[V]=q,this._queue.push(V),!1;if(F!==null)F[V]=q;var O=this._promise,D=this._callback,P=O._boundValue();O._pushContext();var T=G(D).call(P,q,V,M),A=O._popContext();if(J.checkForgottenReturns(T,A,F!==null?"Promise.filter":"Promise.map",O),T===H)return this._reject(T.e),!0;var E=Q(T,this._promise);if(E instanceof $){E=E._target();var C=E._bitField;if((C&50397184)===0){if(N>=1)this._inFlight++;return w[V]=E,E._proxy(this,(V+1)*-1),!1}else if((C&33554432)!==0)T=E._value();else if((C&16777216)!==0)return this._reject(E._reason()),!0;else return this._cancel(),!0}w[V]=T}var i=++this._totalResolved;if(i>=M){if(F!==null)this._filter(w,F);else this._resolve(w);return!0}return!1},X.prototype._drainQueue=function(){var q=this._queue,V=this._limit,w=this._values;while(q.length>0&&this._inFlight<V){if(this._isResolved())return;var M=q.pop();this._promiseFulfilled(w[M],M)}},X.prototype._filter=function(q,V){var w=V.length,M=Array(w),F=0;for(var N=0;N<w;++N)if(q[N])M[F++]=V[N];M.length=F,this._resolve(M)},X.prototype.preservedValues=function(){return this._preservedValues};function Z(q,V,w,M){if(typeof V!=="function")return U("expecting a function but got "+z.classString(V));var F=0;if(w!==void 0)if(typeof w==="object"&&w!==null){if(typeof w.concurrency!=="number")return $.reject(TypeError("'concurrency' must be a number but it is "+z.classString(w.concurrency)));F=w.concurrency}else return $.reject(TypeError("options argument must be an object but it is "+z.classString(w)));return F=typeof F==="number"&&isFinite(F)&&F>=1?F:0,new X(q,V,F,M).promise()}$.prototype.map=function(q,V){return Z(this,q,V,null)},$.map=function(q,V,w,M){return Z(q,V,w,M)}}});var zM0=j((z14,KM0)=>{var lc=Object.create;if(lc)KB=lc(null),zB=lc(null),KB[" size"]=zB[" size"]=0;var KB,zB;KM0.exports=function($){var Y=N4(),U=Y.canEvaluate,Q=Y.isIdentifier,I,J,K=function(q){return Function("ensureMethod",`
|
||||
`;return C=C.replace(/\[TheName\]/g,j).replace(/\[TheTotal\]/g,D).replace(/\[ThePassedArguments\]/g,P).replace(/\[TheProperties\]/g,B).replace(/\[CancellationCode\]/g,A),Function("tryCatch","errorObj","Promise","async",C)(H,G,$,I)},V=[],w=[],M=[];for(var F=0;F<8;++F)V.push(q(F+1)),w.push(X(F+1)),M.push(Z(F+1));W=function(D){this._reject(D)}}$.join=function(){var D=arguments.length-1,O;if(D>0&&typeof arguments[D]==="function"){if(O=arguments[D],D<=8&&z){var n=new $(Q);n._captureStackTrace();var N=V[D-1],B=new N(O),A=w;for(var P=0;P<D;++P){var j=U(arguments[P],n);if(j instanceof $){j=j._target();var C=j._bitField;if((C&50397184)===0)j._then(A[P],W,void 0,n,B),M[P](j,B),B.asyncNeeded=!1;else if((C&33554432)!==0)A[P].call(n,j._value(),B);else if((C&16777216)!==0)n._reject(j._reason());else n._cancel()}else A[P].call(n,j,B)}if(!n._isFateSealed()){if(B.asyncNeeded){var u=J();if(u!==null)B.fn=K.domainBind(u,B.fn)}n._setAsyncGuaranteed(),n._setOnCancel(B)}return n}}var x=arguments.length,S=Array(x);for(var b=0;b<x;++b)S[b]=arguments[b];if(O)S.pop();var n=new Y(S).promise();return O!==void 0?n.spread(O):n}}});var tM0=E((y44,aM0)=>{aM0.exports=function($,Y,U,Q,I,J){var K=$._getDomain,z=B4(),H=z.tryCatch,G=z.errorObj,W=$._async;function X(q,V,w,M){this.constructor$(q),this._promise._captureStackTrace();var F=K();this._callback=F===null?V:z.domainBind(F,V),this._preservedValues=M===I?Array(this.length()):null,this._limit=w,this._inFlight=0,this._queue=[],W.invoke(this._asyncInit,this,void 0)}z.inherits(X,Y),X.prototype._asyncInit=function(){this._init$(void 0,-2)},X.prototype._init=function(){},X.prototype._promiseFulfilled=function(q,V){var w=this._values,M=this.length(),F=this._preservedValues,D=this._limit;if(V<0){if(V=V*-1-1,w[V]=q,D>=1){if(this._inFlight--,this._drainQueue(),this._isResolved())return!0}}else{if(D>=1&&this._inFlight>=D)return w[V]=q,this._queue.push(V),!1;if(F!==null)F[V]=q;var O=this._promise,N=this._callback,B=O._boundValue();O._pushContext();var A=H(N).call(B,q,V,M),P=O._popContext();if(J.checkForgottenReturns(A,P,F!==null?"Promise.filter":"Promise.map",O),A===G)return this._reject(A.e),!0;var j=Q(A,this._promise);if(j instanceof $){j=j._target();var C=j._bitField;if((C&50397184)===0){if(D>=1)this._inFlight++;return w[V]=j,j._proxy(this,(V+1)*-1),!1}else if((C&33554432)!==0)A=j._value();else if((C&16777216)!==0)return this._reject(j._reason()),!0;else return this._cancel(),!0}w[V]=A}var u=++this._totalResolved;if(u>=M){if(F!==null)this._filter(w,F);else this._resolve(w);return!0}return!1},X.prototype._drainQueue=function(){var q=this._queue,V=this._limit,w=this._values;while(q.length>0&&this._inFlight<V){if(this._isResolved())return;var M=q.pop();this._promiseFulfilled(w[M],M)}},X.prototype._filter=function(q,V){var w=V.length,M=Array(w),F=0;for(var D=0;D<w;++D)if(q[D])M[F++]=V[D];M.length=F,this._resolve(M)},X.prototype.preservedValues=function(){return this._preservedValues};function Z(q,V,w,M){if(typeof V!=="function")return U("expecting a function but got "+z.classString(V));var F=0;if(w!==void 0)if(typeof w==="object"&&w!==null){if(typeof w.concurrency!=="number")return $.reject(TypeError("'concurrency' must be a number but it is "+z.classString(w.concurrency)));F=w.concurrency}else return $.reject(TypeError("options argument must be an object but it is "+z.classString(w)));return F=typeof F==="number"&&isFinite(F)&&F>=1?F:0,new X(q,V,F,M).promise()}$.prototype.map=function(q,V){return Z(this,q,V,null)},$.map=function(q,V,w,M){return Z(q,V,w,M)}}});var $O0=E((k44,eM0)=>{var Dn=Object.create;if(Dn)jB=Dn(null),EB=Dn(null),jB[" size"]=EB[" size"]=0;var jB,EB;eM0.exports=function($){var Y=B4(),U=Y.canEvaluate,Q=Y.isIdentifier,I,J,K=function(q){return Function("ensureMethod",`
|
||||
return function(obj) {
|
||||
'use strict'
|
||||
var len = this.length;
|
||||
@@ -213,29 +221,29 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof v6))r
|
||||
return obj.methodName.apply(obj, this);
|
||||
}
|
||||
};
|
||||
`.replace(/methodName/g,q))(H)},z=function(q){return Function("obj",`
|
||||
`.replace(/methodName/g,q))(G)},z=function(q){return Function("obj",`
|
||||
'use strict';
|
||||
return obj.propertyName;
|
||||
`.replace("propertyName",q))},G=function(q,V,w){var M=w[q];if(typeof M!=="function"){if(!Q(q))return null;if(M=V(q),w[q]=M,w[" size"]++,w[" size"]>512){var F=Object.keys(w);for(var N=0;N<256;++N)delete w[F[N]];w[" size"]=F.length-256}}return M};I=function(q){return G(q,K,KB)},J=function(q){return G(q,z,zB)};function H(q,V){var w;if(q!=null)w=q[V];if(typeof w!=="function"){var M="Object "+Y.classString(q)+" has no method '"+Y.toString(V)+"'";throw new $.TypeError(M)}return w}function W(q){var V=this.pop(),w=H(q,V);return w.apply(q,this)}$.prototype.call=function(q){var V=arguments.length,w=Array(Math.max(V-1,0));for(var M=1;M<V;++M)w[M-1]=arguments[M];if(U){var F=I(q);if(F!==null)return this._then(F,void 0,void 0,w,void 0)}return w.push(q),this._then(W,void 0,void 0,w,void 0)};function X(q){return q[this]}function Z(q){var V=+this;if(V<0)V=Math.max(0,V+q.length);return q[V]}$.prototype.get=function(q){var V=typeof q==="number",w;if(!V)if(U){var M=J(q);w=M!==null?M:X}else w=X;else w=Z;return this._then(w,void 0,void 0,q,void 0)}}});var HM0=j((G14,GM0)=>{GM0.exports=function($,Y,U,Q,I,J){var K=N4(),z=f3().TypeError,G=N4().inherits,H=K.errorObj,W=K.tryCatch,X={};function Z(O){setTimeout(function(){throw O},0)}function q(O){var D=U(O);if(D!==O&&typeof O._isDisposable==="function"&&typeof O._getDisposer==="function"&&O._isDisposable())D._setDisposable(O._getDisposer());return D}function V(O,D){var P=0,T=O.length,A=new $(I);function E(){if(P>=T)return A._fulfill();var C=q(O[P++]);if(C instanceof $&&C._isDisposable()){try{C=U(C._getDisposer().tryDispose(D),O.promise)}catch(i){return Z(i)}if(C instanceof $)return C._then(E,Z,null,null,null)}E()}return E(),A}function w(O,D,P){this._data=O,this._promise=D,this._context=P}w.prototype.data=function(){return this._data},w.prototype.promise=function(){return this._promise},w.prototype.resource=function(){if(this.promise().isFulfilled())return this.promise().value();return X},w.prototype.tryDispose=function(O){var D=this.resource(),P=this._context;if(P!==void 0)P._pushContext();var T=D!==X?this.doDispose(D,O):null;if(P!==void 0)P._popContext();return this._promise._unsetDisposable(),this._data=null,T},w.isDisposer=function(O){return O!=null&&typeof O.resource==="function"&&typeof O.tryDispose==="function"};function M(O,D,P){this.constructor$(O,D,P)}G(M,w),M.prototype.doDispose=function(O,D){var P=this.data();return P.call(O,O,D)};function F(O){if(w.isDisposer(O))return this.resources[this.index]._setDisposable(O),O.promise();return O}function N(O){this.length=O,this.promise=null,this[O-1]=null}N.prototype._resultCancelled=function(){var O=this.length;for(var D=0;D<O;++D){var P=this[D];if(P instanceof $)P.cancel()}},$.using=function(){var O=arguments.length;if(O<2)return Y("you must pass at least 2 arguments to Promise.using");var D=arguments[O-1];if(typeof D!=="function")return Y("expecting a function but got "+K.classString(D));var P,T=!0;if(O===2&&Array.isArray(arguments[0]))P=arguments[0],O=P.length,T=!1;else P=arguments,O--;var A=new N(O);for(var E=0;E<O;++E){var C=P[E];if(w.isDisposer(C)){var i=C;C=C.promise(),C._setDisposable(i)}else{var x=U(C);if(x instanceof $)C=x._then(F,null,null,{resources:A,index:E},void 0)}A[E]=C}var h=Array(A.length);for(var E=0;E<h.length;++E)h[E]=$.resolve(A[E]).reflect();var b=$.all(h).then(function(Q0){for(var k=0;k<Q0.length;++k){var m=Q0[k];if(m.isRejected())return H.e=m.error(),H;else if(!m.isFulfilled()){b.cancel();return}Q0[k]=m.value()}n._pushContext(),D=W(D);var a=T?D.apply(void 0,Q0):D(Q0),$0=n._popContext();return J.checkForgottenReturns(a,$0,"Promise.using",n),a}),n=b.lastly(function(){var Q0=new $.PromiseInspection(b);return V(A,Q0)});return A.promise=n,n._setOnCancel(A),n},$.prototype._setDisposable=function(O){this._bitField=this._bitField|131072,this._disposer=O},$.prototype._isDisposable=function(){return(this._bitField&131072)>0},$.prototype._getDisposer=function(){return this._disposer},$.prototype._unsetDisposable=function(){this._bitField=this._bitField&-131073,this._disposer=void 0},$.prototype.disposer=function(O){if(typeof O==="function")return new M(O,this,Q());throw new z}}});var XM0=j((H14,WM0)=>{WM0.exports=function($,Y,U){var Q=N4(),I=$.TimeoutError;function J(X){this.handle=X}J.prototype._resultCancelled=function(){clearTimeout(this.handle)};var K=function(X){return z(+this).thenReturn(X)},z=$.delay=function(X,Z){var q,V;if(Z!==void 0){if(q=$.resolve(Z)._then(K,null,null,X,void 0),U.cancellation()&&Z instanceof $)q._setOnCancel(Z)}else{if(q=new $(Y),V=setTimeout(function(){q._fulfill()},+X),U.cancellation())q._setOnCancel(new J(V));q._captureStackTrace()}return q._setAsyncGuaranteed(),q};$.prototype.delay=function(X){return z(X,this)};var G=function(X,Z,q){var V;if(typeof Z!=="string")if(Z instanceof Error)V=Z;else V=new I("operation timed out");else V=new I(Z);if(Q.markAsOriginatingFromRejection(V),X._attachExtraTrace(V),X._reject(V),q!=null)q.cancel()};function H(X){return clearTimeout(this.handle),X
Line truncated
|
||||
`.replace("propertyName",q))},H=function(q,V,w){var M=w[q];if(typeof M!=="function"){if(!Q(q))return null;if(M=V(q),w[q]=M,w[" size"]++,w[" size"]>512){var F=Object.keys(w);for(var D=0;D<256;++D)delete w[F[D]];w[" size"]=F.length-256}}return M};I=function(q){return H(q,K,jB)},J=function(q){return H(q,z,EB)};function G(q,V){var w;if(q!=null)w=q[V];if(typeof w!=="function"){var M="Object "+Y.classString(q)+" has no method '"+Y.toString(V)+"'";throw new $.TypeError(M)}return w}function W(q){var V=this.pop(),w=G(q,V);return w.apply(q,this)}$.prototype.call=function(q){var V=arguments.length,w=Array(Math.max(V-1,0));for(var M=1;M<V;++M)w[M-1]=arguments[M];if(U){var F=I(q);if(F!==null)return this._then(F,void 0,void 0,w,void 0)}return w.push(q),this._then(W,void 0,void 0,w,void 0)};function X(q){return q[this]}function Z(q){var V=+this;if(V<0)V=Math.max(0,V+q.length);return q[V]}$.prototype.get=function(q){var V=typeof q==="number",w;if(!V)if(U){var M=J(q);w=M!==null?M:X}else w=X;else w=Z;return this._then(w,void 0,void 0,q,void 0)}}});var UO0=E((x44,YO0)=>{YO0.exports=function($,Y,U,Q,I,J){var K=B4(),z=u3().TypeError,H=B4().inherits,G=K.errorObj,W=K.tryCatch,X={};function Z(O){setTimeout(function(){throw O},0)}function q(O){var N=U(O);if(N!==O&&typeof O._isDisposable==="function"&&typeof O._getDisposer==="function"&&O._isDisposable())N._setDisposable(O._getDisposer());return N}function V(O,N){var B=0,A=O.length,P=new $(I);function j(){if(B>=A)return P._fulfill();var C=q(O[B++]);if(C instanceof $&&C._isDisposable()){try{C=U(C._getDisposer().tryDispose(N),O.promise)}catch(u){return Z(u)}if(C instanceof $)return C._then(j,Z,null,null,null)}j()}return j(),P}function w(O,N,B){this._data=O,this._promise=N,this._context=B}w.prototype.data=function(){return this._data},w.prototype.promise=function(){return this._promise},w.prototype.resource=function(){if(this.promise().isFulfilled())return this.promise().value();return X},w.prototype.tryDispose=function(O){var N=this.resource(),B=this._context;if(B!==void 0)B._pushContext();var A=N!==X?this.doDispose(N,O):null;if(B!==void 0)B._popContext();return this._promise._unsetDisposable(),this._data=null,A},w.isDisposer=function(O){return O!=null&&typeof O.resource==="function"&&typeof O.tryDispose==="function"};function M(O,N,B){this.constructor$(O,N,B)}H(M,w),M.prototype.doDispose=function(O,N){var B=this.data();return B.call(O,O,N)};function F(O){if(w.isDisposer(O))return this.resources[this.index]._setDisposable(O),O.promise();return O}function D(O){this.length=O,this.promise=null,this[O-1]=null}D.prototype._resultCancelled=function(){var O=this.length;for(var N=0;N<O;++N){var B=this[N];if(B instanceof $)B.cancel()}},$.using=function(){var O=arguments.length;if(O<2)return Y("you must pass at least 2 arguments to Promise.using");var N=arguments[O-1];if(typeof N!=="function")return Y("expecting a function but got "+K.classString(N));var B,A=!0;if(O===2&&Array.isArray(arguments[0]))B=arguments[0],O=B.length,A=!1;else B=arguments,O--;var P=new D(O);for(var j=0;j<O;++j){var C=B[j];if(w.isDisposer(C)){var u=C;C=C.promise(),C._setDisposable(u)}else{var x=U(C);if(x instanceof $)C=x._then(F,null,null,{resources:P,index:j},void 0)}P[j]=C}var S=Array(P.length);for(var j=0;j<S.length;++j)S[j]=$.resolve(P[j]).reflect();var b=$.all(S).then(function(I0){for(var k=0;k<I0.length;++k){var m=I0[k];if(m.isRejected())return G.e=m.error(),G;else if(!m.isFulfilled()){b.cancel();return}I0[k]=m.value()}n._pushContext(),N=W(N);var e=A?N.apply(void 0,I0):N(I0),Y0=n._popContext();return J.checkForgottenReturns(e,Y0,"Promise.using",n),e}),n=b.lastly(function(){var I0=new $.PromiseInspection(b);return V(P,I0)});return P.promise=n,n._setOnCancel(P),n},$.prototype._setDisposable=function(O){this._bitField=this._bitField|131072,this._disposer=O},$.prototype._isDisposable=function(){return(this._bitField&131072)>0},$.prototype._getDisposer=function(){return this._disposer},$.prototype._unsetDisposable=function(){this._bitField=this._bitField&-131073,this._disposer=void 0},$.prototype.disposer=function(O){if(typeof O==="function")return new M(O,this,Q());throw new z}}});var IO0=E((f44,QO0)=>{QO0.exports=function($,Y,U){var Q=B4(),I=$.TimeoutError;function J(X){this.handle=X}J.prototype._resultCancelled=function(){clearTimeout(this.handle)};var K=function(X){return z(+this).thenReturn(X)},z=$.delay=function(X,Z){var q,V;if(Z!==void 0){if(q=$.resolve(Z)._then(K,null,null,X,void 0),U.cancellation()&&Z instanceof $)q._setOnCancel(Z)}else{if(q=new $(Y),V=setTimeout(function(){q._fulfill()},+X),U.cancellation())q._setOnCancel(new J(V));q._captureStackTrace()}return q._setAsyncGuaranteed(),q};$.prototype.delay=function(X){return z(X,this)};var H=function(X,Z,q){var V;if(typeof Z!=="string")if(Z instanceof Error)V=Z;else V=new I("operation timed out");else V=new I(Z);if(Q.markAsOriginatingFromRejection(V),X._attachExtraTrace(V),X._reject(V),q!=null)q.cancel()};function G(X){return clearTimeout(this.handle),X
Line truncated
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
|
||||
`.replace("%s",M)+`From coroutine:
|
||||
`+this._stack.split(`
|
||||
`).slice(1,-7).join(`
|
||||
`)));return}}F=F._target();var N=F._bitField;if((N&50397184)===0)this._yieldedPromise=F,F._proxy(this,null);else if((N&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,F._value());else if((N&16777216)!==0)$._async.invoke(this._promiseRejected,this,F._reason());else this._promiseCancelled()}},$.coroutine=function(V,w){if(typeof V!=="function")throw new z(`generatorFunction must be a function
|
||||
`)));return}}F=F._target();var D=F._bitField;if((D&50397184)===0)this._yieldedPromise=F,F._proxy(this,null);else if((D&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,F._value());else if((D&16777216)!==0)$._async.invoke(this._promiseRejected,this,F._reason());else this._promiseCancelled()}},$.coroutine=function(V,w){if(typeof V!=="function")throw new z(`generatorFunction must be a function
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`);var M=Object(w).yieldHandler,F=q,N=Error().stack;return function(){var O=V.apply(this,arguments),D=new F(void 0,void 0,M,N),P=D.promise();return D._generator=O,D._promiseFulfilled(void 0),P}},$.coroutine.addYieldHandler=function(V){if(typeof V!=="function")throw new z("expecting a function but got "+G.classString(V));X.push(V)},$.spawn=function(V){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof V!=="function")return Y(`generatorFunction must be a function
|
||||
`);var M=Object(w).yieldHandler,F=q,D=Error().stack;return function(){var O=V.apply(this,arguments),N=new F(void 0,void 0,M,D),B=N.promise();return N._generator=O,N._promiseFulfilled(void 0),B}},$.coroutine.addYieldHandler=function(V){if(typeof V!=="function")throw new z("expecting a function but got "+H.classString(V));X.push(V)},$.spawn=function(V){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof V!=="function")return Y(`generatorFunction must be a function
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`);var w=new q(V,this),M=w.promise();return w._run($.spawn),M}}});var LM0=j((X14,VM0)=>{VM0.exports=function($){var Y=N4(),U=$._async,Q=Y.tryCatch,I=Y.errorObj;function J(G,H){var W=this;if(!Y.isArray(G))return K.call(W,G,H);var X=Q(H).apply(W._boundValue(),[null].concat(G));if(X===I)U.throwLater(X.e)}function K(G,H){var W=this,X=W._boundValue(),Z=G===void 0?Q(H).call(X,null):Q(H).call(X,null,G);if(Z===I)U.throwLater(Z.e)}function z(G,H){var W=this;if(!G){var X=Error(G+"");X.cause=G,G=X}var Z=Q(H).call(W._boundValue(),G);if(Z===I)U.throwLater(Z.e)}$.prototype.asCallback=$.prototype.nodeify=function(G,H){if(typeof G=="function"){var W=K;if(H!==void 0&&Object(H).spread)W=J;this._then(W,z,void 0,this,G)}return this}}});var wM0=j((Z14,FM0)=>{FM0.exports=function($,Y){var U={},Q=N4(),I=mc(),J=Q.withAppended,K=Q.maybeWrapAsError,z=Q.canEvaluate,G=f3().TypeError,H="Async",W={__isPromisified__:!0},X=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],Z=new RegExp("^(?:"+X.join("|")+")$"),q=function(b){return Q.isIdentifier(b)&&b.charAt(0)!=="_"&&b!=="constructor"};function V(b){return!Z.test(b)}function w(b){try{return b.__isPromisified__===!0}catch(n){return!1}}function M(b,n,Q0){var k=Q.getDataPropertyOrDefault(b,n+Q0,W);return k?w(k):!1}function F(b,n,Q0){for(var k=0;k<b.length;k+=2){var m=b[k];if(Q0.test(m)){var a=m.replace(Q0,"");for(var $0=0;$0<b.length;$0+=2)if(b[$0]===a)throw new G(`Cannot promisify an API that has normal methods with '%s'-suffix
|
||||
`);var w=new q(V,this),M=w.promise();return w._run($.spawn),M}}});var HO0=E((b44,zO0)=>{zO0.exports=function($){var Y=B4(),U=$._async,Q=Y.tryCatch,I=Y.errorObj;function J(H,G){var W=this;if(!Y.isArray(H))return K.call(W,H,G);var X=Q(G).apply(W._boundValue(),[null].concat(H));if(X===I)U.throwLater(X.e)}function K(H,G){var W=this,X=W._boundValue(),Z=H===void 0?Q(G).call(X,null):Q(G).call(X,null,H);if(Z===I)U.throwLater(Z.e)}function z(H,G){var W=this;if(!H){var X=Error(H+"");X.cause=H,H=X}var Z=Q(G).call(W._boundValue(),H);if(Z===I)U.throwLater(Z.e)}$.prototype.asCallback=$.prototype.nodeify=function(H,G){if(typeof H=="function"){var W=K;if(G!==void 0&&Object(G).spread)W=J;this._then(W,z,void 0,this,H)}return this}}});var WO0=E((i44,GO0)=>{GO0.exports=function($,Y){var U={},Q=B4(),I=On(),J=Q.withAppended,K=Q.maybeWrapAsError,z=Q.canEvaluate,H=u3().TypeError,G="Async",W={__isPromisified__:!0},X=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],Z=new RegExp("^(?:"+X.join("|")+")$"),q=function(b){return Q.isIdentifier(b)&&b.charAt(0)!=="_"&&b!=="constructor"};function V(b){return!Z.test(b)}function w(b){try{return b.__isPromisified__===!0}catch(n){return!1}}function M(b,n,I0){var k=Q.getDataPropertyOrDefault(b,n+I0,W);return k?w(k):!1}function F(b,n,I0){for(var k=0;k<b.length;k+=2){var m=b[k];if(I0.test(m)){var e=m.replace(I0,"");for(var Y0=0;Y0<b.length;Y0+=2)if(b[Y0]===e)throw new H(`Cannot promisify an API that has normal methods with '%s'-suffix
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`.replace("%s",n))}}}function N(b,n,Q0,k){var m=Q.inheritedDataKeys(b),a=[];for(var $0=0;$0<m.length;++$0){var g=m[$0],p=b[g],Y0=k===q?!0:q(g,p,b);if(typeof p==="function"&&!w(p)&&!M(b,g,n)&&k(g,p,b,Y0))a.push(g,p)}return F(a,n,Q0),a}var O=function(b){return b.replace(/([$])/,"\\$")},D,P=function(b){var n=[b],Q0=Math.max(0,b-1-3);for(var k=b-1;k>=Q0;--k)n.push(k);for(var k=b+1;k<=3;++k)n.push(k);return n},T=function(b){return Q.filledRange(b,"_arg","")},A=function(b){return Q.filledRange(Math.max(b,3),"_arg","")},E=function(b){if(typeof b.length==="number")return Math.max(Math.min(b.length,1024),0);return 0};D=function(b,n,Q0,k,m,a){var $0=Math.max(0,E(k)-1),g=P($0),p=typeof b==="string"||n===U;function Y0(V0){var j0=T(V0).join(", "),A0=V0>0?", ":"",R0;if(p)R0=`ret = callback.call(this, {{args}}, nodeback); break;
|
||||
`.replace("%s",n))}}}function D(b,n,I0,k){var m=Q.inheritedDataKeys(b),e=[];for(var Y0=0;Y0<m.length;++Y0){var g=m[Y0],d=b[g],U0=k===q?!0:q(g,d,b);if(typeof d==="function"&&!w(d)&&!M(b,g,n)&&k(g,d,b,U0))e.push(g,d)}return F(e,n,I0),e}var O=function(b){return b.replace(/([$])/,"\\$")},N,B=function(b){var n=[b],I0=Math.max(0,b-1-3);for(var k=b-1;k>=I0;--k)n.push(k);for(var k=b+1;k<=3;++k)n.push(k);return n},A=function(b){return Q.filledRange(b,"_arg","")},P=function(b){return Q.filledRange(Math.max(b,3),"_arg","")},j=function(b){if(typeof b.length==="number")return Math.max(Math.min(b.length,1024),0);return 0};N=function(b,n,I0,k,m,e){var Y0=Math.max(0,j(k)-1),g=B(Y0),d=typeof b==="string"||n===U;function U0(V0){var E0=A(V0).join(", "),P0=V0>0?", ":"",R0;if(d)R0=`ret = callback.call(this, {{args}}, nodeback); break;
|
||||
`;else R0=n===void 0?`ret = callback({{args}}, nodeback); break;
|
||||
`:`ret = callback.call(receiver, {{args}}, nodeback); break;
|
||||
`;return R0.replace("{{args}}",j0).replace(", ",A0)}function y(){var V0="";for(var j0=0;j0<g.length;++j0)V0+="case "+g[j0]+":"+Y0(g[j0]);return V0+=`
|
||||
`;return R0.replace("{{args}}",E0).replace(", ",P0)}function y(){var V0="";for(var E0=0;E0<g.length;++E0)V0+="case "+g[E0]+":"+U0(g[E0]);return V0+=`
|
||||
default:
|
||||
var args = new Array(len + 1);
|
||||
var i = 0;
|
||||
@@ -245,15 +253,15 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof v6))r
|
||||
args[i] = nodeback;
|
||||
[CodeForCall]
|
||||
break;
|
||||
`.replace("[CodeForCall]",p?`ret = callback.apply(this, args);
|
||||
`.replace("[CodeForCall]",d?`ret = callback.apply(this, args);
|
||||
`:`ret = callback.apply(receiver, args);
|
||||
`),V0}var c=typeof b==="string"?"this != null ? this['"+b+"'] : fn":"fn",e=`'use strict';
|
||||
`),V0}var i=typeof b==="string"?"this != null ? this['"+b+"'] : fn":"fn",$0=`'use strict';
|
||||
var ret = function (Parameters) {
|
||||
'use strict';
|
||||
var len = arguments.length;
|
||||
var promise = new Promise(INTERNAL);
|
||||
promise._captureStackTrace();
|
||||
var nodeback = nodebackForPromise(promise, `+a+`);
|
||||
var nodeback = nodebackForPromise(promise, `+e+`);
|
||||
var ret;
|
||||
var callback = tryCatch([GetFunctionCode]);
|
||||
switch(len) {
|
||||
@@ -267,25 +275,25 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof v6))r
|
||||
};
|
||||
notEnumerableProp(ret, '__isPromisified__', true);
|
||||
return ret;
|
||||
`.replace("[CodeForSwitchCase]",y()).replace("[GetFunctionCode]",c);return e=e.replace("Parameters",A($0)),Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",e)($,k,n,J,K,I,Q.tryCatch,Q.errorObj,Q.notEnumerableProp,Y)};function C(b,n,Q0,k,m,a){var $0=function(){return this}(),g=b;if(typeof g==="string")b=k;function p(){var Y0=n;if(n===U)Y0=this;var y=new $(Y);y._captureStackTrace();var c=typeof g==="string"&&this!==$0?this[g]:b,e=I(y,a);try{c.apply(Y0,J(arguments,e))}catch(V0){y._rejectCallback(K(V0),!0,!0)}if(!y._isFateSealed())y._setAsyncGuaranteed();return y}return Q.notEnumerableProp(p,"__isPromisified__",!0),p}var i=z?D:C;function x(b,n,Q0,k,m){var a=new RegExp(O(n)+"$"),$0=N(b,n,a,Q0);for(var g=0,p=$0.length;g<p;g+=2){var Y0=$0[g],y=$0[g+1],c=Y0+n;if(k===i)b[c]=i(Y0,U,Y0,y,n,m);else{var e=k(y,function(){return i(Y0,U,Y0,y,n,m)});Q.notEnumerableProp(e,"__isPromisified__",!0),b[c]=e}}return Q.toFastProperties(b),b}function h(b,n,Q0){return i(b,n,void 0,b,null,Q0)}$.promisify=function(b,n){if(typeof b!=="function")throw new G("expecting a function but got "+Q.classString(b));if(w(b))return b;n=Object(n);var Q0=n.context===void 0?U:n.context,k=!!n.multiArgs,m=h(b,Q0,k);return Q.copyDescriptors(b,m,V),m},$.promisifyAll=function(b,n){if(typeof b!=="function"&&typeof b!=="object")throw new G(`the target of promisifyAll must be an object or a function
|
||||
`.replace("[CodeForSwitchCase]",y()).replace("[GetFunctionCode]",i);return $0=$0.replace("Parameters",P(Y0)),Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",$0)($,k,n,J,K,I,Q.tryCatch,Q.errorObj,Q.notEnumerableProp,Y)};function C(b,n,I0,k,m,e){var Y0=function(){return this}(),g=b;if(typeof g==="string")b=k;function d(){var U0=n;if(n===U)U0=this;var y=new $(Y);y._captureStackTrace();var i=typeof g==="string"&&this!==Y0?this[g]:b,$0=I(y,e);try{i.apply(U0,J(arguments,$0))}catch(V0){y._rejectCallback(K(V0),!0,!0)}if(!y._isFateSealed())y._setAsyncGuaranteed();return y}return Q.notEnumerableProp(d,"__isPromisified__",!0),d}var u=z?N:C;function x(b,n,I0,k,m){var e=new RegExp(O(n)+"$"),Y0=D(b,n,e,I0);for(var g=0,d=Y0.length;g<d;g+=2){var U0=Y0[g],y=Y0[g+1],i=U0+n;if(k===u)b[i]=u(U0,U,U0,y,n,m);else{var $0=k(y,function(){return u(U0,U,U0,y,n,m)});Q.notEnumerableProp($0,"__isPromisified__",!0),b[i]=$0}}return Q.toFastProperties(b),b}function S(b,n,I0){return u(b,n,void 0,b,null,I0)}$.promisify=function(b,n){if(typeof b!=="function")throw new H("expecting a function but got "+Q.classString(b));if(w(b))return b;n=Object(n);var I0=n.context===void 0?U:n.context,k=!!n.multiArgs,m=S(b,I0,k);return Q.copyDescriptors(b,m,V),m},$.promisifyAll=function(b,n){if(typeof b!=="function"&&typeof b!=="object")throw new H(`the target of promisifyAll must be an object or a function
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`);n=Object(n);var Q0=!!n.multiArgs,k=n.suffix;if(typeof k!=="string")k=H;var m=n.filter;if(typeof m!=="function")m=q;var a=n.promisifier;if(typeof a!=="function")a=i;if(!Q.isIdentifier(k))throw RangeError(`suffix must be a valid identifier
|
||||
`);n=Object(n);var I0=!!n.multiArgs,k=n.suffix;if(typeof k!=="string")k=G;var m=n.filter;if(typeof m!=="function")m=q;var e=n.promisifier;if(typeof e!=="function")e=u;if(!Q.isIdentifier(k))throw RangeError(`suffix must be a valid identifier
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`);var $0=Q.inheritedDataKeys(b);for(var g=0;g<$0.length;++g){var p=b[$0[g]];if($0[g]!=="constructor"&&Q.isClass(p))x(p.prototype,k,m,a,Q0),x(p,k,m,a,Q0)}return x(b,k,m,a,Q0)}}});var OM0=j((q14,MM0)=>{MM0.exports=function($,Y,U,Q){var I=N4(),J=I.isObject,K=KQ(),z;if(typeof Map==="function")z=Map;var G=function(){var Z=0,q=0;function V(w,M){this[Z]=w,this[Z+q]=M,Z++}return function(M){q=M.size,Z=0;var F=Array(M.size*2);return M.forEach(V,F),F}}(),H=function(Z){var q=new z,V=Z.length/2|0;for(var w=0;w<V;++w){var M=Z[V+w],F=Z[w];q.set(M,F)}return q};function W(Z){var q=!1,V;if(z!==void 0&&Z instanceof z)V=G(Z),q=!0;else{var w=K.keys(Z),M=w.length;V=Array(M*2);for(var F=0;F<M;++F){var N=w[F];V[F]=Z[N],V[F+M]=N}}this.constructor$(V),this._isMap=q,this._init$(void 0,-3)}I.inherits(W,Y),W.prototype._init=function(){},W.prototype._promiseFulfilled=function(Z,q){this._values[q]=Z;var V=++this._totalResolved;if(V>=this._length){var w;if(this._isMap)w=H(this._values);else{w={};var M=this.length();for(var F=0,N=this.length();F<N;++F)w[this._values[F+M]]=this._values[F]}return this._resolve(w),!0}return!1},W.prototype.shouldCopyValues=function(){return!1},W.prototype.getActualLength=function(Z){return Z>>1};function X(Z){var q,V=U(Z);if(!J(V))return Q(`cannot await properties of a non-object
|
||||
`);var Y0=Q.inheritedDataKeys(b);for(var g=0;g<Y0.length;++g){var d=b[Y0[g]];if(Y0[g]!=="constructor"&&Q.isClass(d))x(d.prototype,k,m,e,I0),x(d,k,m,e,I0)}return x(b,k,m,e,I0)}}});var ZO0=E((c44,XO0)=>{XO0.exports=function($,Y,U,Q){var I=B4(),J=I.isObject,K=GQ(),z;if(typeof Map==="function")z=Map;var H=function(){var Z=0,q=0;function V(w,M){this[Z]=w,this[Z+q]=M,Z++}return function(M){q=M.size,Z=0;var F=Array(M.size*2);return M.forEach(V,F),F}}(),G=function(Z){var q=new z,V=Z.length/2|0;for(var w=0;w<V;++w){var M=Z[V+w],F=Z[w];q.set(M,F)}return q};function W(Z){var q=!1,V;if(z!==void 0&&Z instanceof z)V=H(Z),q=!0;else{var w=K.keys(Z),M=w.length;V=Array(M*2);for(var F=0;F<M;++F){var D=w[F];V[F]=Z[D],V[F+M]=D}}this.constructor$(V),this._isMap=q,this._init$(void 0,-3)}I.inherits(W,Y),W.prototype._init=function(){},W.prototype._promiseFulfilled=function(Z,q){this._values[q]=Z;var V=++this._totalResolved;if(V>=this._length){var w;if(this._isMap)w=G(this._values);else{w={};var M=this.length();for(var F=0,D=this.length();F<D;++F)w[this._values[F+M]]=this._values[F]}return this._resolve(w),!0}return!1},W.prototype.shouldCopyValues=function(){return!1},W.prototype.getActualLength=function(Z){return Z>>1};function X(Z){var q,V=U(Z);if(!J(V))return Q(`cannot await properties of a non-object
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`);else if(V instanceof $)q=V._then($.props,void 0,void 0,void 0,void 0);else q=new W(V).promise();if(V instanceof $)q._propagateFrom(V,2);return q}$.prototype.props=function(){return X(this)},$.props=function(Z){return X(Z)}}});var DM0=j((V14,NM0)=>{NM0.exports=function($,Y,U,Q){var I=N4(),J=function(z){return z.then(function(G){return K(G,z)})};function K(z,G){var H=U(z);if(H instanceof $)return J(H);else if(z=I.asArray(z),z===null)return Q("expecting an array or an iterable object but got "+I.classString(z));var W=new $(Y);if(G!==void 0)W._propagateFrom(G,3);var{_fulfill:X,_reject:Z}=W;for(var q=0,V=z.length;q<V;++q){var w=z[q];if(w===void 0&&!(q in z))continue;$.cast(w)._then(X,Z,void 0,W,null)}return W}$.race=function(z){return K(z,void 0)},$.prototype.race=function(){return K(this,void 0)}}});var BM0=j((L14,AM0)=>{AM0.exports=function($,Y,U,Q,I,J){var K=$._getDomain,z=N4(),G=z.tryCatch;function H(V,w,M,F){this.constructor$(V);var N=K();if(this._fn=N===null?w:z.domainBind(N,w),M!==void 0)M=$.resolve(M),M._attachCancellationCallback(this);if(this._initialValue=M,this._currentCancellable=null,F===I)this._eachValues=Array(this._length);else if(F===0)this._eachValues=null;else this._eachValues=void 0;this._promise._captureStackTrace(),this._init$(void 0,-5)}z.inherits(H,Y),H.prototype._gotAccum=function(V){if(this._eachValues!==void 0&&this._eachValues!==null&&V!==I)this._eachValues.push(V)},H.prototype._eachComplete=function(V){if(this._eachValues!==null)this._eachValues.push(V);return this._eachValues},H.prototype._init=function(){},H.prototype._resolveEmptyArray=function(){this._resolve(this._eachValues!==void 0?this._eachValues:this._initialValue)},H.prototype.shouldCopyValues=function(){return!1},H.prototype._resolve=function(V){this._promise._resolveCallback(V),this._values=null},H.prototype._resultCancelled=function(V){if(V===this._initialValue)return this._cancel();if(this._isResolved())return;if(this._resultCancelled$(),this._currentCancellable instanceof $)this._currentCancellable.cancel();if(this._initialValue instanceof $)this._initialValue.cancel()},H.prototype._iterate=function(V){this._values=V;var w,M,F=V.length;if(this._initialValue!==void 0)w=this._initialValue,M=0;else w=$.resolve(V[0]),M=1;if(this._currentCancellable=w,!w.isRejected())for(;M<F;++M){var N={accum:null,value:V[M],index:M,length:F,array:this};w=w._then(Z,void 0,void 0,N,void 0)}if(this._eachValues!==void 0)w=w._then(this._eachComplete,void 0,void 0,this,void 0);w._then(W,W,void 0,w,this)},$.prototype.reduce=function(V,w){return X(this,V,w,null)},$.reduce=function(V,w,M,F){return X(V,w,M,F)};function W(V,w){if(this.isFulfilled())w._resolve(V);else w._reject(V)}function X(V,w,M,F){if(typeof w!=="function")return U("expecting a function but got "+z.classString(w));var N=new H(V,w,M,F);return N.promise()}function Z(V){this.accum=V,this.array._gotAccum(V);var w=Q(this.value,this.array._promise);if(w instanceof $)return this.array._currentCancellable=w,w._then(q,void 0,void 0,this,void 0);else return q.call(this,w)}function q(V){var w=this.array,M=w._promise,F=G(w._fn);M._pushContext();var N;if(w._eachValues!==void 0)N=F.call(M._boundValue(),V,this.index,this.length);else N=F.call(M._boundValue(),this.accum,V,this.index,this.length);if(N instanceof $)w._currentCancellable=N;var O=M._popContext();return J.checkForgottenReturns(N,O,w._eachValues!==void 0?"Promise.each":"Promise.reduce",M),N}}});var TM0=j((F14,PM0)=>{PM0.exports=function($,Y,U){var Q=$.PromiseInspection,I=N4();function J(K){this.constructor$(K)}I.inherits(J,Y),J.prototype._promiseResolved=function(K,z){this._values[K]=z;var G=++this._totalResolved;if(G>=this._length)return this._resolve(this._values),!0;return!1},J.prototype._promiseFulfilled=function(K,z){var G=new Q;return G._bitField=33554432,G._settledValueField=K,this._promiseResolved(z,G)},J.prototype._promiseRejected=function(K,z){var G=new Q;return G._bitField=16777216,G._settledValueField=K,this._promiseResolved(z,G)},$.settle=function(K){return U.deprecated(".settle()",".reflect()"),new J(K).promise()},$.prototype.settle=function(){return $.settle(this)}}});var jM0=j((w14,EM0)=>{EM0.exports=function($,Y,U){var Q=N4(),I=f3().RangeError,J=f3().AggregateError,K=Q.isArray,z={};function G(W){this.constructor$(W),this._howMany=0,this._unwrap=!1,this._initialized=!1}Q.inherits(G,Y),G.prototype._init=function(){if(!this._initialized)return;if(this._howMany===0){this._resolve([]);return}this._init$(void 0,-5);var W=K(this._values);if(!this._isResolved()&&W&&this._howMany>this._canPossiblyFulfill())this._reject(this._getRangeError(this.length()))},G.prototype.init=function(){this._initialized=!0,this._init()},G.prototype.setUnwrap=function(){this._unwrap=!0},G.prototype.howMany=function(){return this._howMany},G.prototype.setHowMany=function(W){this._howMany=W},G.prototype._promiseFulfilled=function(W){if(this._addFulfilled(W),this._fulfilled()===this.howMany()){if(this._values.length=this.howMany(),this.howMany()=
Line truncated
|
||||
`);else if(V instanceof $)q=V._then($.props,void 0,void 0,void 0,void 0);else q=new W(V).promise();if(V instanceof $)q._propagateFrom(V,2);return q}$.prototype.props=function(){return X(this)},$.props=function(Z){return X(Z)}}});var VO0=E((n44,qO0)=>{qO0.exports=function($,Y,U,Q){var I=B4(),J=function(z){return z.then(function(H){return K(H,z)})};function K(z,H){var G=U(z);if(G instanceof $)return J(G);else if(z=I.asArray(z),z===null)return Q("expecting an array or an iterable object but got "+I.classString(z));var W=new $(Y);if(H!==void 0)W._propagateFrom(H,3);var{_fulfill:X,_reject:Z}=W;for(var q=0,V=z.length;q<V;++q){var w=z[q];if(w===void 0&&!(q in z))continue;$.cast(w)._then(X,Z,void 0,W,null)}return W}$.race=function(z){return K(z,void 0)},$.prototype.race=function(){return K(this,void 0)}}});var wO0=E((p44,LO0)=>{LO0.exports=function($,Y,U,Q,I,J){var K=$._getDomain,z=B4(),H=z.tryCatch;function G(V,w,M,F){this.constructor$(V);var D=K();if(this._fn=D===null?w:z.domainBind(D,w),M!==void 0)M=$.resolve(M),M._attachCancellationCallback(this);if(this._initialValue=M,this._currentCancellable=null,F===I)this._eachValues=Array(this._length);else if(F===0)this._eachValues=null;else this._eachValues=void 0;this._promise._captureStackTrace(),this._init$(void 0,-5)}z.inherits(G,Y),G.prototype._gotAccum=function(V){if(this._eachValues!==void 0&&this._eachValues!==null&&V!==I)this._eachValues.push(V)},G.prototype._eachComplete=function(V){if(this._eachValues!==null)this._eachValues.push(V);return this._eachValues},G.prototype._init=function(){},G.prototype._resolveEmptyArray=function(){this._resolve(this._eachValues!==void 0?this._eachValues:this._initialValue)},G.prototype.shouldCopyValues=function(){return!1},G.prototype._resolve=function(V){this._promise._resolveCallback(V),this._values=null},G.prototype._resultCancelled=function(V){if(V===this._initialValue)return this._cancel();if(this._isResolved())return;if(this._resultCancelled$(),this._currentCancellable instanceof $)this._currentCancellable.cancel();if(this._initialValue instanceof $)this._initialValue.cancel()},G.prototype._iterate=function(V){this._values=V;var w,M,F=V.length;if(this._initialValue!==void 0)w=this._initialValue,M=0;else w=$.resolve(V[0]),M=1;if(this._currentCancellable=w,!w.isRejected())for(;M<F;++M){var D={accum:null,value:V[M],index:M,length:F,array:this};w=w._then(Z,void 0,void 0,D,void 0)}if(this._eachValues!==void 0)w=w._then(this._eachComplete,void 0,void 0,this,void 0);w._then(W,W,void 0,w,this)},$.prototype.reduce=function(V,w){return X(this,V,w,null)},$.reduce=function(V,w,M,F){return X(V,w,M,F)};function W(V,w){if(this.isFulfilled())w._resolve(V);else w._reject(V)}function X(V,w,M,F){if(typeof w!=="function")return U("expecting a function but got "+z.classString(w));var D=new G(V,w,M,F);return D.promise()}function Z(V){this.accum=V,this.array._gotAccum(V);var w=Q(this.value,this.array._promise);if(w instanceof $)return this.array._currentCancellable=w,w._then(q,void 0,void 0,this,void 0);else return q.call(this,w)}function q(V){var w=this.array,M=w._promise,F=H(w._fn);M._pushContext();var D;if(w._eachValues!==void 0)D=F.call(M._boundValue(),V,this.index,this.length);else D=F.call(M._boundValue(),this.accum,V,this.index,this.length);if(D instanceof $)w._currentCancellable=D;var O=M._popContext();return J.checkForgottenReturns(D,O,w._eachValues!==void 0?"Promise.each":"Promise.reduce",M),D}}});var MO0=E((d44,FO0)=>{FO0.exports=function($,Y,U){var Q=$.PromiseInspection,I=B4();function J(K){this.constructor$(K)}I.inherits(J,Y),J.prototype._promiseResolved=function(K,z){this._values[K]=z;var H=++this._totalResolved;if(H>=this._length)return this._resolve(this._values),!0;return!1},J.prototype._promiseFulfilled=function(K,z){var H=new Q;return H._bitField=33554432,H._settledValueField=K,this._promiseResolved(z,H)},J.prototype._promiseRejected=function(K,z){var H=new Q;return H._bitField=16777216,H._settledValueField=K,this._promiseResolved(z,H)},$.settle=function(K){return U.deprecated(".settle()",".reflect()"),new J(K).promise()},$.prototype.settle=function(){return $.settle(this)}}});var DO0=E((m44,OO0)=>{OO0.exports=function($,Y,U){var Q=B4(),I=u3().RangeError,J=u3().AggregateError,K=Q.isArray,z={};function H(W){this.constructor$(W),this._howMany=0,this._unwrap=!1,this._initialized=!1}Q.inherits(H,Y),H.prototype._init=function(){if(!this._initialized)return;if(this._howMany===0){this._resolve([]);return}this._init$(void 0,-5);var W=K(this._values);if(!this._isResolved()&&W&&this._howMany>this._canPossiblyFulfill())this._reject(this._getRangeError(this.length()))},H.prototype.init=function(){this._initialized=!0,this._init()},H.prototype.setUnwrap=function(){this._unwrap=!0},H.prototype.howMany=function(){return this._howMany},H.prototype.setHowMany=function(W){this._howMany=W},H.prototype._promiseFulfilled=function(W){if(this._addFulfilled(W),this._fulfilled()===this.howMany()){if(this._values.length=this.howMany(),this.howMany()=
Line truncated
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`);var Z=new G(W),q=Z.promise();return Z.setHowMany(X),Z.init(),q}$.some=function(W,X){return H(W,X)},$.prototype.some=function(W){return H(this,W)},$._SomePromiseArray=G}});var RM0=j((M14,CM0)=>{CM0.exports=function($,Y){var U=$.map;$.prototype.filter=function(Q,I){return U(this,Q,I,Y)},$.filter=function(Q,I,J){return U(Q,I,J,Y)}}});var vM0=j((O14,_M0)=>{_M0.exports=function($,Y){var{reduce:U,all:Q}=$;function I(){return Q(this)}function J(K,z){return U(K,z,Y,Y)}$.prototype.each=function(K){return U(this,K,Y,0)._then(I,void 0,void 0,this,void 0)},$.prototype.mapSeries=function(K){return U(this,K,Y,Y)},$.each=function(K,z){return U(K,z,Y,0)._then(I,void 0,void 0,K,void 0)},$.mapSeries=J}});var hM0=j((N14,SM0)=>{SM0.exports=function($){var Y=$._SomePromiseArray;function U(Q){var I=new Y(Q),J=I.promise();return I.setHowMany(1),I.setUnwrap(),I.init(),J}$.any=function(Q){return U(Q)},$.prototype.any=function(){return U(this)}}});var gM0=j((D14,oc)=>{oc.exports=function(){var $=function(){return new X(`circular promise resolution chain
|
||||
`);var Z=new H(W),q=Z.promise();return Z.setHowMany(X),Z.init(),q}$.some=function(W,X){return G(W,X)},$.prototype.some=function(W){return G(this,W)},$._SomePromiseArray=H}});var PO0=E((l44,NO0)=>{NO0.exports=function($,Y){var U=$.map;$.prototype.filter=function(Q,I){return U(this,Q,I,Y)},$.filter=function(Q,I,J){return U(Q,I,J,Y)}}});var AO0=E((o44,BO0)=>{BO0.exports=function($,Y){var{reduce:U,all:Q}=$;function I(){return Q(this)}function J(K,z){return U(K,z,Y,Y)}$.prototype.each=function(K){return U(this,K,Y,0)._then(I,void 0,void 0,this,void 0)},$.prototype.mapSeries=function(K){return U(this,K,Y,Y)},$.each=function(K,z){return U(K,z,Y,0)._then(I,void 0,void 0,K,void 0)},$.mapSeries=J}});var jO0=E((r44,TO0)=>{TO0.exports=function($){var Y=$._SomePromiseArray;function U(Q){var I=new Y(Q),J=I.promise();return I.setHowMany(1),I.setUnwrap(),I.init(),J}$.any=function(Q){return U(Q)},$.prototype.any=function(){return U(this)}}});var EO0=E((s44,Nn)=>{Nn.exports=function(){var $=function(){return new X(`circular promise resolution chain
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`)},Y=function(){return new h.PromiseInspection(this._target())},U=function(k){return h.reject(new X(k))};function Q(){}var I={},J=N4(),K;if(J.isNode)K=function(){var k=process.domain;if(k===void 0)k=null;return k};else K=function(){return null};J.notEnumerableProp(h,"_getDomain",K);var z=KQ(),G=jw0(),H=new G;z.defineProperty(h,"_async",{value:H});var W=f3(),X=h.TypeError=W.TypeError;h.RangeError=W.RangeError;var Z=h.CancellationError=W.CancellationError;h.TimeoutError=W.TimeoutError,h.OperationalError=W.OperationalError,h.RejectionError=W.OperationalError,h.AggregateError=W.AggregateError;var q=function(){},V={},w={},M=Sw0()(h,q),F=gw0()(h,q,M,U,Q),N=kw0()(h),O=N.create,D=fw0()(h,N),P=D.CapturedTrace,T=bw0()(h,M),A=cw0()(w),E=mc(),C=J.errorObj,i=J.tryCatch;function x(k,m){if(typeof m!=="function")throw new X("expecting a function but got "+J.classString(m));if(k.constructor!==h)throw new X(`the promise constructor cannot be invoked directly
|
||||
`)},Y=function(){return new S.PromiseInspection(this._target())},U=function(k){return S.reject(new X(k))};function Q(){}var I={},J=B4(),K;if(J.isNode)K=function(){var k=process.domain;if(k===void 0)k=null;return k};else K=function(){return null};J.notEnumerableProp(S,"_getDomain",K);var z=GQ(),H=DM0(),G=new H;z.defineProperty(S,"_async",{value:G});var W=u3(),X=S.TypeError=W.TypeError;S.RangeError=W.RangeError;var Z=S.CancellationError=W.CancellationError;S.TimeoutError=W.TimeoutError,S.OperationalError=W.OperationalError,S.RejectionError=W.OperationalError,S.AggregateError=W.AggregateError;var q=function(){},V={},w={},M=TM0()(S,q),F=EM0()(S,q,M,U,Q),D=RM0()(S),O=D.create,N=vM0()(S,D),B=N.CapturedTrace,A=SM0()(S,M),P=yM0()(w),j=On(),C=J.errorObj,u=J.tryCatch;function x(k,m){if(typeof m!=="function")throw new X("expecting a function but got "+J.classString(m));if(k.constructor!==S)throw new X(`the promise constructor cannot be invoked directly
|
||||
|
||||
See http://goo.gl/MqrFmX
|
||||
`)}function h(k){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,k!==q)x(this,k),this._resolveFromExecutor(k);this._promiseCreated(),this._fireEvent("promiseCreated",this)}h.prototype.toString=function(){return"[object Promise]"},h.prototype.caught=h.prototype.catch=function(k){var m=arguments.length;if(m>1){var a=Array(m-1),$0=0,g;for(g=0;g<m-1;++g){var p=arguments[g];if(J.isObject(p))a[$0++]=p;else return U("expecting an object but got A catch statement predicate "+J.classString(p))}return a.length=$0,k=arguments[g],this.then(void 0,A(a,k,this))}return this.then(void 0,k)},h.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},h.prototype.then=function(k,m){if(D.warnings()&&arguments.length>0&&typeof k!=="function"&&typeof m!=="function"){var a=".then() only accepts functions but was passed: "+J.classString(k);if(arguments.length>1)a+=", "+J.classString(m);this._warn(a)}return this._then(k,m,void 0,void 0,void 0)},h.prototype.done=function(k,m){var a=this._then(k,m,void 0,void 0,void 0);a._setIsFinal()},h.prototype.spread=function(k){if(typeof k!=="function")return U("expecting a function but got "+J.classString(k));return this.all()._then(k,void 0,void 0,V,void 0)},h.prototype.toJSON=function(){var k={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())k.fulfillmentValue=this.value(),k.isFulfilled=!0;else if(this.isRejected())k.rejectionReason=this.reason(),k.isRejected=!0;return k},h.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new F(this).promise()},h.prototype.error=function(k){return this.caught(J.originatesFromRejection,k)},h.getNewLibraryCopy=oc.exports,h.is=function(k){return k instanceof h},h.fromNode=h.fromCallback=function(k){var m=new h(q);m._captureStackTrace();var a=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=i(k)(E(m,a));if($0===C)m._rejectCallback($0.e,!0);if(!m._isFateSealed())m._setAsyncGuaranteed();return m},h.all=function(k){return new F(k).promise()},h.cast=function(k){var m=M(k);if(!(m instanceof h))m=new h(q),m._captureStackTrace(),m._setFulfilled(),m._rejectionHandler0=k;return m},h.resolve=h.fulfilled=h.cast,h.reject=h.rejected=function(k){var m=new h(q);return m._captureStackTrace(),m._rejectCallback(k,!0),m},h.setScheduler=function(k){if(typeof k!=="function")throw new X("expecting a function but got "+J.classString(k));return H.setScheduler(k)},h.prototype._then=function(k,m,a,$0,g){var p=g!==void 0,Y0=p?g:new h(q),y=this._target(),c=y._bitField;if(!p){if(Y0._propagateFrom(this,3),Y0._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((c&50397184)!==0)$0=this._boundValue();else $0=y===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,Y0)}var e=K();if((c&50397184)!==0){var V0,j0,A0=y._settlePromiseCtx;if((c&33554432)!==0)j0=y._rejectionHandler0,V0=k;else if((c&16777216)!==0)j0=y._fulfillmentHandler0,V0=m,y._unsetRejectionIsUnhandled();else A0=y._settlePromiseLateCancellationObserver,j0=new Z("late cancellation observer"),y._attachExtraTrace(j0),V0=m;H.invoke(A0,y,{handler:e===null?V0:typeof V0==="function"&&J.domainBind(e,V0),promise:Y0,receiver:$0,value:j0})}else y._addCallbacks(k,m,Y0,$0,e);return Y0},h.prototype._length=function(){return this._bitField&65535},h.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},h.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},h.prototype._setLength=function(k){this._bitField=this._bitField&-65536|k&65535},h.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},h.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},h.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},h.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},h.prototype._isFinal=function(){return(this._bitField&4194304)>0},h.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},h.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},h.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},h.prototype._setAsyncGuaranteed=function(){if(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},h.prototype._receiverAt=function(k){var m=k===0?this._receiver0:this[k*4-4+3];if(m===I)return;else if(m===void 0&&this._isBound())return this._boundValue();return m},h.prototype._promiseAt=function(k){return this[k*4-4+2]},h.prototype._fulfillmentHandlerAt=function(k){return this[k*4-4+0]},h.prototype._rejectionHandlerAt=function(k){return this[k*4-4+1]},h.prototype._boundValue=function(){},h.prototype._migrateCallback0=function(k){var{_bitField:m,_fulfillmentHand
Line truncated
|
||||
`)}function S(k){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,k!==q)x(this,k),this._resolveFromExecutor(k);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(k){var m=arguments.length;if(m>1){var e=Array(m-1),Y0=0,g;for(g=0;g<m-1;++g){var d=arguments[g];if(J.isObject(d))e[Y0++]=d;else return U("expecting an object but got A catch statement predicate "+J.classString(d))}return e.length=Y0,k=arguments[g],this.then(void 0,P(e,k,this))}return this.then(void 0,k)},S.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},S.prototype.then=function(k,m){if(N.warnings()&&arguments.length>0&&typeof k!=="function"&&typeof m!=="function"){var e=".then() only accepts functions but was passed: "+J.classString(k);if(arguments.length>1)e+=", "+J.classString(m);this._warn(e)}return this._then(k,m,void 0,void 0,void 0)},S.prototype.done=function(k,m){var e=this._then(k,m,void 0,void 0,void 0);e._setIsFinal()},S.prototype.spread=function(k){if(typeof k!=="function")return U("expecting a function but got "+J.classString(k));return this.all()._then(k,void 0,void 0,V,void 0)},S.prototype.toJSON=function(){var k={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())k.fulfillmentValue=this.value(),k.isFulfilled=!0;else if(this.isRejected())k.rejectionReason=this.reason(),k.isRejected=!0;return k},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new F(this).promise()},S.prototype.error=function(k){return this.caught(J.originatesFromRejection,k)},S.getNewLibraryCopy=Nn.exports,S.is=function(k){return k instanceof S},S.fromNode=S.fromCallback=function(k){var m=new S(q);m._captureStackTrace();var e=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,Y0=u(k)(j(m,e));if(Y0===C)m._rejectCallback(Y0.e,!0);if(!m._isFateSealed())m._setAsyncGuaranteed();return m},S.all=function(k){return new F(k).promise()},S.cast=function(k){var m=M(k);if(!(m instanceof S))m=new S(q),m._captureStackTrace(),m._setFulfilled(),m._rejectionHandler0=k;return m},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(k){var m=new S(q);return m._captureStackTrace(),m._rejectCallback(k,!0),m},S.setScheduler=function(k){if(typeof k!=="function")throw new X("expecting a function but got "+J.classString(k));return G.setScheduler(k)},S.prototype._then=function(k,m,e,Y0,g){var d=g!==void 0,U0=d?g:new S(q),y=this._target(),i=y._bitField;if(!d){if(U0._propagateFrom(this,3),U0._captureStackTrace(),Y0===void 0&&(this._bitField&2097152)!==0)if((i&50397184)!==0)Y0=this._boundValue();else Y0=y===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,U0)}var $0=K();if((i&50397184)!==0){var V0,E0,P0=y._settlePromiseCtx;if((i&33554432)!==0)E0=y._rejectionHandler0,V0=k;else if((i&16777216)!==0)E0=y._fulfillmentHandler0,V0=m,y._unsetRejectionIsUnhandled();else P0=y._settlePromiseLateCancellationObserver,E0=new Z("late cancellation observer"),y._attachExtraTrace(E0),V0=m;G.invoke(P0,y,{handler:$0===null?V0:typeof V0==="function"&&J.domainBind($0,V0),promise:U0,receiver:Y0,value:E0})}else y._addCallbacks(k,m,U0,Y0,$0);return U0},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(k){this._bitField=this._bitField&-65536|k&65535},S.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},S.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},S.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},S.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},S.prototype._isFinal=function(){return(this._bitField&4194304)>0},S.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},S.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},S.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},S.prototype._setAsyncGuaranteed=function(){if(G.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(k){var m=k===0?this._receiver0:this[k*4-4+3];if(m===I)return;else if(m===void 0&&this._isBound())return this._boundValue();return m},S.prototype._promiseAt=function(k){return this[k*4-4+2]},S.prototype._fulfillmentHandlerAt=function(k){return this[k*4-4+0]},S.prototype._rejectionHandlerAt=function(k){return this[k*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(k){var{_bitField:m,_fulfillment
Line truncated
|
||||
path = %s
|
||||
syscall = %s
|
||||
fstream_type = %s
|
||||
@@ -295,30 +303,27 @@ fstream_class = %s
|
||||
fstream_stack =
|
||||
%s
|
||||
`,Y||"UNKNOWN",Q.stack,Q.path,Q.syscall,Q.fstream_type,Q.fstream_path,Q.fstream_unc_path,Q.fstream_class,Q.fstream_stack.join(`
|
||||
`));else U.emit("warn",Q)};c2.prototype.info=function($,Y){this.emit("info",$,Y)};c2.prototype.error=function($,Y,U){var Q=qN0($,Y,this);if(U)throw Q;else this.emit("error",Q)};function qN0($,Y,U){if(!($ instanceof Error))$=Error($);if($.code=$.code||Y,$.path=$.path||U.path,$.fstream_type=$.fstream_type||U.type,$.fstream_path=$.fstream_path||U.path,U._path!==U.path)$.fstream_unc_path=$.fstream_unc_path||U._path;if(U.linkpath)$.fstream_linkpath=$.fstream_linkpath||U.linkpath;return $.fstream_class=$.fstream_class||U.constructor.name,$.fstream_stack=$.fstream_stack||Error().stack.split(/\n/).slice(3).map(function(Q){return Q.replace(/^ {4}at /,"")}),$}});var jZ=j((t14,LN0)=>{LN0.exports=wO1;function wO1($){var Y=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],U;if($.type&&Y.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var Q=0,I=Y.length;Q<I;Q++){U=Y[Q];var J=$[U]||$["is"+U];if(typeof J==="function")J=J.call($);if(J)return $[U]=!0,$.type=U,U}return null}});var gn=j((a14,FN0)=>{FN0.exports=CZ;var MO1=Q$(),OO1=W1(),hn=LQ();OO1(CZ,hn);function CZ($){var Y=this;if(!(Y instanceof CZ))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);hn.call(Y,$)}CZ.prototype._stat=function($){var Y=this;MO1.readlink(Y._path,function(U,Q){if(U)return Y.error(U);Y.linkpath=Y.props.linkpath=Q,Y.emit("linkpath",Q),hn.prototype._stat.call(Y,$)})};CZ.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var kn=j((e14,ON0)=>{ON0.exports=v9;var MN0=Q$(),NO1=W1(),RZ=K0("path"),yn=LQ(),wN0=K0("assert").ok;NO1(v9,yn);function v9($){var Y=this;if(!(Y instanceof v9))throw Error("DirReader must be called as constructor.");if($.type!=="Directory"||!$.Directory)throw Error("Non-directory type "+$.type);if(Y.entries=null,Y._index=-1,Y._paused=!1,Y._length=-1,$.sort)this.sort=$.sort;yn.call(this,$)}v9.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,MN0.readdir($._path,function(Y,U){if(Y)return $.error(Y);if($.entries=U,$.emit("entries",U),$._paused)$.once("resume",Q);else Q();function Q(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};v9.prototype._read=function(){var $=this;if(!$.entries)return $._getEntries();if($._paused||$._currentEntry||$._aborted)return;if($._index++,$._index>=$.entries.length){if(!$._ended)$._ended=!0,$.emit("end"),$.emit("close");return}var Y=RZ.resolve($._path,$.entries[$._index]);wN0(Y!==$._path),wN0($.entries[$._index]),$._currentEntry=Y,MN0[$.props.follow?"stat":"lstat"](Y,function(U,Q){if(U)return $.error(U);var I=$._proxy||$;Q.path=Y,Q.basename=RZ.basename(Y),Q.dirname=RZ.dirname(Y);var J=$.getChildProps.call(I,Q);J.path=Y,J.basename=RZ.basename(Y),J.dirname=RZ.dirname(Y);var K=yn(J,Q);$._currentEntry=K,K.on("pause",function(H){if(!$._paused&&!K._disowned)$.pause(H)}),K.on("resume",function(H){if($._paused&&!K._disowned)$.resume(H)}),K.on("stat",function(H){if($.emit("_entryStat",K,H),K._aborted)return;if(K._paused)K.once("resume",function(){$.emit("entryStat",K,H)});else $.emit("entryStat",K,H)}),K.on("ready",function H(){if($._paused)return K.pause($),$.once("resume",H);if(K.type==="Socket")$.emit("socket",K);else $.emitEntry(K)});var z=!1;K.on("close",G),K.on("disown",G);function G(){if(z)return;if(z=!0,$.emit("childEnd",K),$.emit("entryEnd",K),$._currentEntry=null,!$._paused)$._read()}K.on("error",function(H){if(K._swallowErrors)$.warn(H),K.emit("end"),K.emit("close");else $.emit("error",H)}),["child","childEnd","warn"].forEach(function(H){K.on(H,$.emit.bind($,H))})})};v9.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};v9.prototype.getChildProps=function(){return{depth:this.depth+1,root:this.root||this,parent:this,follow:this.follow,filter:this.filter,sort:this.props.sort,hardlinks:this.props.hardlinks}};v9.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._currentEntry&&Y._currentEntry.pause)Y._currentEntry.pause($);Y.emit("pause",$)};v9.prototype.resume=function($){var Y=this;if(!Y._paused)return;if($=$||Y,Y._paused=!1,Y.emit("resume",$),Y._paused)return;if(Y._currentEntry){if(Y._currentEntry.resume)Y._currentEntry.resume($)}else Y._read()};v9.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var xn=j(($44,BN0)=>{BN0.exports=FQ;var DO1=Q$(),AO1=W1(),NN0=LQ(),DN0={EOF:!0},AN0={CLOSE:!0};AO1(FQ,NN0);function FQ($){var Y=this;if(!(Y instanceof FQ))throw Error("FileReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="File"&&$.File))throw Error("Non-file type "+$.type);Y._buffer=[],Y._bytesEmitted=0,NN0.call(Y,$)}FQ.prototype._getStream=function(){var $=this,Y=$._stream=DO1.createReadStream($._path,$.p
Line truncated
|
||||
`));else U.emit("warn",Q)};c2.prototype.info=function($,Y){this.emit("info",$,Y)};c2.prototype.error=function($,Y,U){var Q=KN0($,Y,this);if(U)throw Q;else this.emit("error",Q)};function KN0($,Y,U){if(!($ instanceof Error))$=Error($);if($.code=$.code||Y,$.path=$.path||U.path,$.fstream_type=$.fstream_type||U.type,$.fstream_path=$.fstream_path||U.path,U._path!==U.path)$.fstream_unc_path=$.fstream_unc_path||U._path;if(U.linkpath)$.fstream_linkpath=$.fstream_linkpath||U.linkpath;return $.fstream_class=$.fstream_class||U.constructor.name,$.fstream_stack=$.fstream_stack||Error().stack.split(/\n/).slice(3).map(function(Q){return Q.replace(/^ {4}at /,"")}),$}});var uZ=E((j64,HN0)=>{HN0.exports=vD1;function vD1($){var Y=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],U;if($.type&&Y.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var Q=0,I=Y.length;Q<I;Q++){U=Y[Q];var J=$[U]||$["is"+U];if(typeof J==="function")J=J.call($);if(J)return $[U]=!0,$.type=U,U}return null}});var Hp=E((E64,GN0)=>{GN0.exports=bZ;var hD1=Q$(),SD1=W1(),zp=MQ();SD1(bZ,zp);function bZ($){var Y=this;if(!(Y instanceof bZ))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);zp.call(Y,$)}bZ.prototype._stat=function($){var Y=this;hD1.readlink(Y._path,function(U,Q){if(U)return Y.error(U);Y.linkpath=Y.props.linkpath=Q,Y.emit("linkpath",Q),zp.prototype._stat.call(Y,$)})};bZ.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Wp=E((C64,ZN0)=>{ZN0.exports=h9;var XN0=Q$(),gD1=W1(),iZ=z0("path"),Gp=MQ(),WN0=z0("assert").ok;gD1(h9,Gp);function h9($){var Y=this;if(!(Y instanceof h9))throw Error("DirReader must be called as constructor.");if($.type!=="Directory"||!$.Directory)throw Error("Non-directory type "+$.type);if(Y.entries=null,Y._index=-1,Y._paused=!1,Y._length=-1,$.sort)this.sort=$.sort;Gp.call(this,$)}h9.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,XN0.readdir($._path,function(Y,U){if(Y)return $.error(Y);if($.entries=U,$.emit("entries",U),$._paused)$.once("resume",Q);else Q();function Q(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};h9.prototype._read=function(){var $=this;if(!$.entries)return $._getEntries();if($._paused||$._currentEntry||$._aborted)return;if($._index++,$._index>=$.entries.length){if(!$._ended)$._ended=!0,$.emit("end"),$.emit("close");return}var Y=iZ.resolve($._path,$.entries[$._index]);WN0(Y!==$._path),WN0($.entries[$._index]),$._currentEntry=Y,XN0[$.props.follow?"stat":"lstat"](Y,function(U,Q){if(U)return $.error(U);var I=$._proxy||$;Q.path=Y,Q.basename=iZ.basename(Y),Q.dirname=iZ.dirname(Y);var J=$.getChildProps.call(I,Q);J.path=Y,J.basename=iZ.basename(Y),J.dirname=iZ.dirname(Y);var K=Gp(J,Q);$._currentEntry=K,K.on("pause",function(G){if(!$._paused&&!K._disowned)$.pause(G)}),K.on("resume",function(G){if($._paused&&!K._disowned)$.resume(G)}),K.on("stat",function(G){if($.emit("_entryStat",K,G),K._aborted)return;if(K._paused)K.once("resume",function(){$.emit("entryStat",K,G)});else $.emit("entryStat",K,G)}),K.on("ready",function G(){if($._paused)return K.pause($),$.once("resume",G);if(K.type==="Socket")$.emit("socket",K);else $.emitEntry(K)});var z=!1;K.on("close",H),K.on("disown",H);function H(){if(z)return;if(z=!0,$.emit("childEnd",K),$.emit("entryEnd",K),$._currentEntry=null,!$._paused)$._read()}K.on("error",function(G){if(K._swallowErrors)$.warn(G),K.emit("end"),K.emit("close");else $.emit("error",G)}),["child","childEnd","warn"].forEach(function(G){K.on(G,$.emit.bind($,G))})})};h9.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};h9.prototype.getChildProps=function(){return{depth:this.depth+1,root:this.root||this,parent:this,follow:this.follow,filter:this.filter,sort:this.props.sort,hardlinks:this.props.hardlinks}};h9.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._currentEntry&&Y._currentEntry.pause)Y._currentEntry.pause($);Y.emit("pause",$)};h9.prototype.resume=function($){var Y=this;if(!Y._paused)return;if($=$||Y,Y._paused=!1,Y.emit("resume",$),Y._paused)return;if(Y._currentEntry){if(Y._currentEntry.resume)Y._currentEntry.resume($)}else Y._read()};h9.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var Xp=E((R64,wN0)=>{wN0.exports=OQ;var yD1=Q$(),kD1=W1(),qN0=MQ(),VN0={EOF:!0},LN0={CLOSE:!0};kD1(OQ,qN0);function OQ($){var Y=this;if(!(Y instanceof OQ))throw Error("FileReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="File"&&$.File))throw Error("Non-file type "+$.type);Y._buffer=[],Y._bytesEmitted=0,qN0.call(Y,$)}OQ.prototype._getStream=function(){var $=this,Y=$._stream=yD1.createReadStream($._path,$.p
Line truncated
|
||||
expect: `+$.props.size+`
|
||||
actual: `+$._bytesEmitted)}),Y.on("close",function(){if($._paused||$._buffer.length)$._buffer.push(AN0),$._read();else $.emit("close")}),Y.on("error",function(U){$.emit("error",U)}),$._read()};FQ.prototype._read=function(){var $=this;if($._paused)return;if(!$._stream)return $._getStream();if($._buffer.length){var Y=$._buffer;for(var U=0,Q=Y.length;U<Q;U++){var I=Y[U];if(I===DN0)$.emit("end");else if(I===AN0)$.emit("close");else $.emit("data",I);if($._paused){$._buffer=Y.slice(U);return}}$._buffer.length=0}};FQ.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._stream)Y._stream.pause();Y.emit("pause",$)};FQ.prototype.resume=function($){var Y=this;if(!Y._paused)return;if($=$||Y,Y.emit("resume",$),Y._paused=!1,Y._stream)Y._stream.resume();Y._read()}});var EN0=j((Y44,TN0)=>{TN0.exports=hB;var BO1=W1(),PN0=LQ();BO1(hB,PN0);function hB($){var Y=this;if(!(Y instanceof hB))throw Error("SocketReader must be called as constructor.");if(!($.type==="Socket"&&$.Socket))throw Error("Non-socket type "+$.type);PN0.call(Y,$)}hB.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var un=j((U44,jN0)=>{jN0.exports=wQ;var fn=LQ(),PO1=jZ(),TO1=W1(),EO1=Q$();TO1(wQ,fn);function wQ($){var Y=this;if(!(Y instanceof wQ))throw Error("ProxyReader must be called as constructor.");Y.props=$,Y._buffer=[],Y.ready=!1,fn.call(Y,$)}wQ.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";EO1[U](Y.path,function(Q,I){var J;if(Q||!I)J="File";else J=PO1(I);Y[J]=!0,Y.type=$.type=J,$._old=I,$._addProxy(fn(Y,I))})};wQ.prototype._addProxy=function($){var Y=this;if(Y._proxyTarget)return Y.error("proxy already set");Y._proxyTarget=$,$._proxy=Y,["error","data","end","close","linkpath","entry","entryEnd","child","childEnd","warn","stat"].forEach(function(Q){$.on(Q,Y.emit.bind(Y,Q))}),Y.emit("proxy",$),$.on("ready",function(){Y.ready=!0,Y.emit("ready")});var U=Y._buffer;Y._buffer.length=0,U.forEach(function(Q){$[Q[0]].apply($,Q[1])})};wQ.prototype.pause=function(){return this._proxyTarget?this._proxyTarget.pause():!1};wQ.prototype.resume=function(){return this._proxyTarget?this._proxyTarget.resume():!1}});var LQ=j((Q44,_N0)=>{_N0.exports=h5;var jO1=Q$(),CO1=K0("stream").Stream,RO1=W1(),bn=K0("path"),cn=jZ(),gB=h5.hardLinks={},CN0=SB();RO1(h5,CN0);var RN0=gn();function h5($,Y){var U=this;if(!(U instanceof h5))return new h5($,Y);if(typeof $==="string")$={path:$};var Q,I;if($.type&&typeof $.type==="function")Q=$.type,I=Q;else Q=cn($),I=h5;if(Y&&!Q)Q=cn(Y),$[Q]=!0,$.type=Q;switch(Q){case"Directory":I=kn();break;case"Link":case"File":I=xn();break;case"SymbolicLink":I=RN0;break;case"Socket":I=EN0();break;case null:I=un();break}if(!(U instanceof I))return new I($);if(CN0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.readable=!0,U.writable=!1,U.type=Q,U.props=$,U.depth=$.depth=$.depth||0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=bn.resolve($.path),process.platform==="win32"){if(U.path=U._path=U.path.replace(/\?/g,"_"),U._path.length>=260)U._swallowErrors=!0,U._path="\\\\?\\"+U.path.replace(/\//g,"\\")}if(U.basename=$.basename=bn.basename(U.path),U.dirname=$.dirname=bn.dirname(U.path),$.parent=$.root=null,U.size=$.size,U.filter=typeof $.filter==="function"?$.filter:null,$.sort==="alpha")$.sort=_O1;U._stat(Y)}function _O1($,Y){return $===Y?0:$.toLowerCase()>Y.toLowerCase()?1:$.toLowerCase()<Y.toLowerCase()?-1:$>Y?1:-1}h5.prototype._stat=function($){var Y=this,U=Y.props,Q=U.follow?"stat":"lstat";if($)process.nextTick(I.bind(null,null,$));else jO1[Q](Y._path,I);function I(J,K){if(J)return Y.error(J);if(Object.keys(K).forEach(function(q){U[q]=K[q]}),Y.size!==void 0&&U.size!==Y.size)return Y.error("incorrect size");Y.size=U.size;var z=cn(U),G=U.hardlinks!==!1;if(G&&z!=="Directory"&&U.nlink&&U.nlink>1){var H=U.dev+":"+U.ino;if(gB[H]===Y._path||!gB[H])gB[H]=Y._path;else z=Y.type=Y.props.type="Link",Y.Link=Y.props.Link=!0,Y.linkpath=Y.props.linkpath=gB[H],Y._stat=Y._read=RN0.prototype._read}if(Y.type&&Y.type!==z)Y.error("Unexpected type: "+z);if(Y.filter){var W=Y._proxy||Y;if(!Y.filter.call(W,W,U)){if(!Y._disowned)Y.abort(),Y.emit("end"),Y.emit("close");return}}var X=["_stat","stat","ready"],Z=0;(function q(){if(Y._aborted){Y.emit("end"),Y.emit("close");return}if(Y._paused&&Y.type!=="Directory"){Y.once("resume",q);return}var V=X[Z++];if(!V)return Y._read();Y.emit(V,U),q()})()}};h5.prototype.pipe=function($){var Y=this;if(typeof $.add==="function")Y.on("entry",function(U){var Q=$.add(U);if(Q===!1)Y.pause()});return CO1.prototype.pipe.apply(this,arguments)};h5.prototype.pause=function($){if(this._paused=!0,$=$||this,this.emit("pause",$),this._stream)this._stream.pause($)};h5.prototype.resume=function($){if(this._paused=!1,$=$||this,this.emit("resume",$),this._stream)this._stream.resume($);this._read()};h5.prototype._read=function(){this.error("Cannot read unknown type: "+this.type)}});var mn=j((I44,fN0)=>
Line truncated
|
||||
actual: `+$._bytesEmitted)}),Y.on("close",function(){if($._paused||$._buffer.length)$._buffer.push(LN0),$._read();else $.emit("close")}),Y.on("error",function(U){$.emit("error",U)}),$._read()};OQ.prototype._read=function(){var $=this;if($._paused)return;if(!$._stream)return $._getStream();if($._buffer.length){var Y=$._buffer;for(var U=0,Q=Y.length;U<Q;U++){var I=Y[U];if(I===VN0)$.emit("end");else if(I===LN0)$.emit("close");else $.emit("data",I);if($._paused){$._buffer=Y.slice(U);return}}$._buffer.length=0}};OQ.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._stream)Y._stream.pause();Y.emit("pause",$)};OQ.prototype.resume=function($){var Y=this;if(!Y._paused)return;if($=$||Y,Y.emit("resume",$),Y._paused=!1,Y._stream)Y._stream.resume();Y._read()}});var ON0=E((_64,MN0)=>{MN0.exports=eB;var xD1=W1(),FN0=MQ();xD1(eB,FN0);function eB($){var Y=this;if(!(Y instanceof eB))throw Error("SocketReader must be called as constructor.");if(!($.type==="Socket"&&$.Socket))throw Error("Non-socket type "+$.type);FN0.call(Y,$)}eB.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var qp=E((v64,DN0)=>{DN0.exports=DQ;var Zp=MQ(),fD1=uZ(),uD1=W1(),bD1=Q$();uD1(DQ,Zp);function DQ($){var Y=this;if(!(Y instanceof DQ))throw Error("ProxyReader must be called as constructor.");Y.props=$,Y._buffer=[],Y.ready=!1,Zp.call(Y,$)}DQ.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";bD1[U](Y.path,function(Q,I){var J;if(Q||!I)J="File";else J=fD1(I);Y[J]=!0,Y.type=$.type=J,$._old=I,$._addProxy(Zp(Y,I))})};DQ.prototype._addProxy=function($){var Y=this;if(Y._proxyTarget)return Y.error("proxy already set");Y._proxyTarget=$,$._proxy=Y,["error","data","end","close","linkpath","entry","entryEnd","child","childEnd","warn","stat"].forEach(function(Q){$.on(Q,Y.emit.bind(Y,Q))}),Y.emit("proxy",$),$.on("ready",function(){Y.ready=!0,Y.emit("ready")});var U=Y._buffer;Y._buffer.length=0,U.forEach(function(Q){$[Q[0]].apply($,Q[1])})};DQ.prototype.pause=function(){return this._proxyTarget?this._proxyTarget.pause():!1};DQ.prototype.resume=function(){return this._proxyTarget?this._proxyTarget.resume():!1}});var MQ=E((h64,BN0)=>{BN0.exports=g5;var iD1=Q$(),cD1=z0("stream").Stream,nD1=W1(),Vp=z0("path"),Lp=uZ(),$A=g5.hardLinks={},NN0=tB();nD1(g5,NN0);var PN0=Hp();function g5($,Y){var U=this;if(!(U instanceof g5))return new g5($,Y);if(typeof $==="string")$={path:$};var Q,I;if($.type&&typeof $.type==="function")Q=$.type,I=Q;else Q=Lp($),I=g5;if(Y&&!Q)Q=Lp(Y),$[Q]=!0,$.type=Q;switch(Q){case"Directory":I=Wp();break;case"Link":case"File":I=Xp();break;case"SymbolicLink":I=PN0;break;case"Socket":I=ON0();break;case null:I=qp();break}if(!(U instanceof I))return new I($);if(NN0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.readable=!0,U.writable=!1,U.type=Q,U.props=$,U.depth=$.depth=$.depth||0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=Vp.resolve($.path),process.platform==="win32"){if(U.path=U._path=U.path.replace(/\?/g,"_"),U._path.length>=260)U._swallowErrors=!0,U._path="\\\\?\\"+U.path.replace(/\//g,"\\")}if(U.basename=$.basename=Vp.basename(U.path),U.dirname=$.dirname=Vp.dirname(U.path),$.parent=$.root=null,U.size=$.size,U.filter=typeof $.filter==="function"?$.filter:null,$.sort==="alpha")$.sort=pD1;U._stat(Y)}function pD1($,Y){return $===Y?0:$.toLowerCase()>Y.toLowerCase()?1:$.toLowerCase()<Y.toLowerCase()?-1:$>Y?1:-1}g5.prototype._stat=function($){var Y=this,U=Y.props,Q=U.follow?"stat":"lstat";if($)process.nextTick(I.bind(null,null,$));else iD1[Q](Y._path,I);function I(J,K){if(J)return Y.error(J);if(Object.keys(K).forEach(function(q){U[q]=K[q]}),Y.size!==void 0&&U.size!==Y.size)return Y.error("incorrect size");Y.size=U.size;var z=Lp(U),H=U.hardlinks!==!1;if(H&&z!=="Directory"&&U.nlink&&U.nlink>1){var G=U.dev+":"+U.ino;if($A[G]===Y._path||!$A[G])$A[G]=Y._path;else z=Y.type=Y.props.type="Link",Y.Link=Y.props.Link=!0,Y.linkpath=Y.props.linkpath=$A[G],Y._stat=Y._read=PN0.prototype._read}if(Y.type&&Y.type!==z)Y.error("Unexpected type: "+z);if(Y.filter){var W=Y._proxy||Y;if(!Y.filter.call(W,W,U)){if(!Y._disowned)Y.abort(),Y.emit("end"),Y.emit("close");return}}var X=["_stat","stat","ready"],Z=0;(function q(){if(Y._aborted){Y.emit("end"),Y.emit("close");return}if(Y._paused&&Y.type!=="Directory"){Y.once("resume",q);return}var V=X[Z++];if(!V)return Y._read();Y.emit(V,U),q()})()}};g5.prototype.pipe=function($){var Y=this;if(typeof $.add==="function")Y.on("entry",function(U){var Q=$.add(U);if(Q===!1)Y.pause()});return cD1.prototype.pipe.apply(this,arguments)};g5.prototype.pause=function($){if(this._paused=!0,$=$||this,this.emit("pause",$),this._stream)this._stream.pause($)};g5.prototype.resume=function($){if(this._paused=!1,$=$||this,this.emit("resume",$),this._stream)this._stream.resume($);this._read()};g5.prototype._read=function(){this.error("Cannot read unknown type: "+this.type)}});var Op=E((S64,vN0)=>
Line truncated
|
||||
expect: `+$.size+`
|
||||
actual: `+$._bytesWritten);pB.prototype._finish.call($)}});var Qd=j((A44,jD0)=>{jD0.exports=l2;var Ud=Qz(),QN1=jZ(),IN1=W1(),JN1=nB(),KN1=K0("fs");IN1(l2,Ud);function l2($){var Y=this;if(!(Y instanceof l2))throw Error("ProxyWriter must be called as constructor.");Y.props=$,Y._needDrain=!1,Ud.call(Y,$)}l2.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";KN1[U](Y.path,function(Q,I){var J;if(Q||!I)J="File";else J=QN1(I);Y[J]=!0,Y.type=$.type=J,$._old=I,$._addProxy(Ud(Y,I))})};l2.prototype._addProxy=function($){var Y=this;if(Y._proxy)return Y.error("proxy already set");Y._proxy=$,["ready","error","close","pipe","drain","warn"].forEach(function(Q){$.on(Q,Y.emit.bind(Y,Q))}),Y.emit("proxy",$);var U=Y._buffer;if(U.forEach(function(Q){$[Q[0]].apply($,Q[1])}),Y._buffer.length=0,Y._needsDrain)Y.emit("drain")};l2.prototype.add=function($){if(JN1($),!this._proxy)return this._buffer.push(["add",[$]]),this._needDrain=!0,!1;return this._proxy.add($)};l2.prototype.write=function($){if(!this._proxy)return this._buffer.push(["write",[$]]),this._needDrain=!0,!1;return this._proxy.write($)};l2.prototype.end=function($){if(!this._proxy)return this._buffer.push(["end",[$]]),!1;return this._proxy.end($)}});var Qz=j((B44,kD0)=>{kD0.exports=r$;var o$=Q$(),zN1=W1(),GN1=mn(),HN1=tn(),hZ=K0("path"),RD0=process.platform==="win32"?0:process.umask(),_D0=jZ(),vD0=SB();zN1(r$,vD0);r$.dirmode=parseInt("0777",8)&~RD0;r$.filemode=parseInt("0666",8)&~RD0;var WN1=en(),XN1=$d(),ZN1=Yd(),qN1=Qd();function r$($,Y){var U=this;if(typeof $==="string")$={path:$};var Q=_D0($),I=r$;switch(Q){case"Directory":I=WN1;break;case"File":I=ZN1;break;case"Link":case"SymbolicLink":I=XN1;break;case null:default:I=qN1;break}if(!(U instanceof I))return new I($);if(vD0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.type=$.type,U.props=$,U.depth=$.depth||0,U.clobber=$.clobber===!1?$.clobber:!0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=hZ.resolve($.path),process.platform==="win32"){if(U.path=U._path=U.path.replace(/\?/g,"_"),U._path.length>=260)U._swallowErrors=!0,U._path="\\\\?\\"+U.path.replace(/\//g,"\\")}if(U.basename=hZ.basename($.path),U.dirname=hZ.dirname($.path),U.linkpath=$.linkpath||null,$.parent=$.root=null,U.size=$.size,typeof $.mode==="string")$.mode=parseInt($.mode,8);U.readable=!1,U.writable=!0,U._buffer=[],U.ready=!1,U.filter=typeof $.filter==="function"?$.filter:null,U._stat(Y)}r$.prototype._create=function(){var $=this;o$[$.props.follow?"stat":"lstat"]($._path,function(Y){if(Y)return $.warn("Cannot create "+$._path+`
|
||||
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};r$.prototype._stat=function($){var Y=this,U=Y.props,Q=U.follow?"stat":"lstat",I=Y._proxy||Y;if($)J(null,$);else o$[Q](Y._path,J);function J(K,z){if(Y.filter&&!Y.filter.call(I,I,z)){Y._aborted=!0,Y.emit("end"),Y.emit("close");return}if(K||!z)return Id(Y);Y._old=z;var G=_D0(z);if(G!==Y.type||Y.type==="File"&&z.nlink>1)return GN1(Y._path,function(H){if(H)return Y.error(H);Y._old=null,Id(Y)});Id(Y)}};function Id($){HN1(hZ.dirname($._path),r$.dirmode,function(Y,U){if(Y)return $.error(Y);return $._madeDir=U,$._create()})}function SD0($,Y,U,Q,I){var J=Y.mode,K=Y.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!o$[K])return I();if(typeof J!=="number")return I();var z=U.mode&parseInt("0777",8);if(J=J&parseInt("0777",8),J===z)return I();o$[K](Q,J,I)}function hD0($,Y,U,Q,I){if(process.platform==="win32")return I();if(!process.getuid||process.getuid()!==0)return I();if(typeof Y.uid!=="number"&&typeof Y.gid!=="number")return I();if(U.uid===Y.uid&&U.gid===Y.gid)return I();var J=$.props.follow||$.type!=="SymbolicLink"?"chown":"lchown";if(!o$[J])return I();if(typeof Y.uid!=="number")Y.uid=U.uid;if(typeof Y.gid!=="number")Y.gid=U.gid;o$[J](Q,Y.uid,Y.gid,I)}function gD0($,Y,U,Q,I){if(!o$.utimes||process.platform==="win32")return I();var J=Y.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(J==="lutimes"&&!o$[J])J="utimes";if(!o$[J])return I();var{atime:K,mtime:z}=U,G=Y.atime,H=Y.mtime;if(G===void 0)G=K;if(H===void 0)H=z;if(!CD0(G))G=new Date(G);if(!CD0(H))G=new Date(H);if(G.getTime()===K.getTime()&&H.getTime()===z.getTime())return I();o$[J](Q,G,H,I)}r$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var Y=0,U=null,Q=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),J($._old);else{var I=$.props.follow?"stat":"lstat";o$[I]($._path,function(z,G){if(z)if(z.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(z);J($._old=G)})}return;function J(z){Y+=3,SD0($,$.props,z,$._path,K("chmod")),hD0($,$.props,z,$._path,K("chown")),gD0($,$.props,z,$._path,K("utimes"))}function K(z){return function(G){if(U)return;if(G)return G.fstream_finish_call=z,$.error(U=G);if(--Y>0)return;if(Q)return;if(Q=!0,!$._madeDir)return H();else yD0($,$._path,H);function H(W){if(W)return W.fstream_finish_call="setupMadeDir",$.error(W);$.emit("end"),$.emit("close")}}}};function yD0($,Y,U){var Q=$._madeDir,I=hZ.dirname(Y);VN1($,I,function(J){if(J)return U(J);if(I===Q)return U();yD0($,I,U)})}function VN1($,Y,U){var Q={};Object.keys($.props).forEach(function(z){if(Q[z]=$.props[z],z==="mode"&&$.type!=="Directory")Q[z]=Q[z]|parseInt("0111",8)});var I=3,J=null;o$.stat(Y,function(z,G){if(z)return U(J=z);SD0($,Q,G,Y,K),hD0($,Q,G,Y,K),gD0($,Q,G,Y,K)});function K(z){if(J)return;if(z)return U(J=z);if(--I===0)return U()}}r$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};r$.prototype.add=function(){this.error("Can't add to non-Directory type")};r$.prototype.write=function(){return!0};function LN1($){return Object.prototype.toString.call($)}function CD0($){return typeof $==="object"&&LN1($)==="[object Date]"}});var Hd=j((FN1)=>{FN1.Abstract=SB();FN1.Reader=LQ();FN1.Writer=Qz();FN1.File={Reader:xn(),Writer:Yd()};FN1.Dir={Reader:kn(),Writer:en()};FN1.Link={Reader:gn(),Writer:$d()};FN1.Proxy={Reader:un(),Writer:Qd()};FN1.Reader.Dir=FN1.DirReader=FN1.Dir.Reader;FN1.Reader.File=FN1.FileReader=FN1.File.Reader;FN1.Reader.Link=FN1.LinkReader=FN1.Link.Reader;FN1.Reader.Proxy=FN1.ProxyReader=FN1.Proxy.Reader;FN1.Writer.Dir=FN1.DirWriter=FN1.Dir.Writer;FN1.Writer.File=FN1.FileWriter=FN1.File.Writer;FN1.Writer.Link=FN1.LinkWriter=FN1.Link.Writer;FN1.Writer.Proxy=FN1.ProxyWriter=FN1.Proxy.Writer;FN1.collect=nB()});var fD0=j((h44,xD0)=>{xD0.exports=PN1;var ON1=BB(),NN1=Hd().Writer,Wd=K0("path"),DN1=K0("stream"),AN1=vn(),BN1=b2();function PN1($){$.path=Wd.resolve(Wd.normalize($.path));var Y=new ON1($),U=new DN1.Writable({objectMode:!0});U._write=function(I,J,K){if(I.type=="Directory")return K();var z=Wd.join($.path,I.path);if(z.indexOf($.path)!=0)return K();let G=$.getWriter?$.getWriter({path:z}):NN1({path:z});I.pipe(G).on("error",K).on("close",K)};var Q=AN1(Y,U);return Y.once("crx-header",function(I){Q.crxHeader=I}),Y.pipe(U).on("finish",function(){Q.emit("close")}),Q.promise=function(){return new BN1(function(I,J){Q.on("close",I),Q.on("error",J)})},Q}});var uD0=j((g44,mB)=>{var S6=function($){var Y=1e7,U=7,Q=9007199254740992,I=Z(Q),J="0123456789abcdefghijklmnopqrstuvwxyz",K=typeof BigInt==="function";function z(B,S,u,s){if(typeof B>"u")return z[0];if(typeof S<"u")return+S===10&&!u?D0(B):u0(B,S,u,s);return D0(B)}function G(B,S){this.value=B,this.sign=S,this.isSmall=!1}G.prototype=Object.create(z.prototype);function H(B){this.value=B,this.sign=B<0,this.isSmall=!0}H.prototype=Object.create(z.prototype);function W(B){
Line truncated
|
||||
actual: `+$._bytesWritten);XA.prototype._finish.call($)}});var _p=E((a64,DP0)=>{DP0.exports=l2;var Rp=Hz(),FN1=uZ(),MN1=W1(),ON1=GA(),DN1=z0("fs");MN1(l2,Rp);function l2($){var Y=this;if(!(Y instanceof l2))throw Error("ProxyWriter must be called as constructor.");Y.props=$,Y._needDrain=!1,Rp.call(Y,$)}l2.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";DN1[U](Y.path,function(Q,I){var J;if(Q||!I)J="File";else J=FN1(I);Y[J]=!0,Y.type=$.type=J,$._old=I,$._addProxy(Rp(Y,I))})};l2.prototype._addProxy=function($){var Y=this;if(Y._proxy)return Y.error("proxy already set");Y._proxy=$,["ready","error","close","pipe","drain","warn"].forEach(function(Q){$.on(Q,Y.emit.bind(Y,Q))}),Y.emit("proxy",$);var U=Y._buffer;if(U.forEach(function(Q){$[Q[0]].apply($,Q[1])}),Y._buffer.length=0,Y._needsDrain)Y.emit("drain")};l2.prototype.add=function($){if(ON1($),!this._proxy)return this._buffer.push(["add",[$]]),this._needDrain=!0,!1;return this._proxy.add($)};l2.prototype.write=function($){if(!this._proxy)return this._buffer.push(["write",[$]]),this._needDrain=!0,!1;return this._proxy.write($)};l2.prototype.end=function($){if(!this._proxy)return this._buffer.push(["end",[$]]),!1;return this._proxy.end($)}});var Hz=E((t64,RP0)=>{RP0.exports=a$;var s$=Q$(),NN1=W1(),PN1=Op(),BN1=Ap(),dZ=z0("path"),PP0=process.platform==="win32"?0:process.umask(),BP0=uZ(),AP0=tB();NN1(a$,AP0);a$.dirmode=parseInt("0777",8)&~PP0;a$.filemode=parseInt("0666",8)&~PP0;var AN1=jp(),TN1=Ep(),jN1=Cp(),EN1=_p();function a$($,Y){var U=this;if(typeof $==="string")$={path:$};var Q=BP0($),I=a$;switch(Q){case"Directory":I=AN1;break;case"File":I=jN1;break;case"Link":case"SymbolicLink":I=TN1;break;case null:default:I=EN1;break}if(!(U instanceof I))return new I($);if(AP0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.type=$.type,U.props=$,U.depth=$.depth||0,U.clobber=$.clobber===!1?$.clobber:!0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=dZ.resolve($.path),process.platform==="win32"){if(U.path=U._path=U.path.replace(/\?/g,"_"),U._path.length>=260)U._swallowErrors=!0,U._path="\\\\?\\"+U.path.replace(/\//g,"\\")}if(U.basename=dZ.basename($.path),U.dirname=dZ.dirname($.path),U.linkpath=$.linkpath||null,$.parent=$.root=null,U.size=$.size,typeof $.mode==="string")$.mode=parseInt($.mode,8);U.readable=!1,U.writable=!0,U._buffer=[],U.ready=!1,U.filter=typeof $.filter==="function"?$.filter:null,U._stat(Y)}a$.prototype._create=function(){var $=this;s$[$.props.follow?"stat":"lstat"]($._path,function(Y){if(Y)return $.warn("Cannot create "+$._path+`
|
||||
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};a$.prototype._stat=function($){var Y=this,U=Y.props,Q=U.follow?"stat":"lstat",I=Y._proxy||Y;if($)J(null,$);else s$[Q](Y._path,J);function J(K,z){if(Y.filter&&!Y.filter.call(I,I,z)){Y._aborted=!0,Y.emit("end"),Y.emit("close");return}if(K||!z)return vp(Y);Y._old=z;var H=BP0(z);if(H!==Y.type||Y.type==="File"&&z.nlink>1)return PN1(Y._path,function(G){if(G)return Y.error(G);Y._old=null,vp(Y)});vp(Y)}};function vp($){BN1(dZ.dirname($._path),a$.dirmode,function(Y,U){if(Y)return $.error(Y);return $._madeDir=U,$._create()})}function TP0($,Y,U,Q,I){var J=Y.mode,K=Y.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!s$[K])return I();if(typeof J!=="number")return I();var z=U.mode&parseInt("0777",8);if(J=J&parseInt("0777",8),J===z)return I();s$[K](Q,J,I)}function jP0($,Y,U,Q,I){if(process.platform==="win32")return I();if(!process.getuid||process.getuid()!==0)return I();if(typeof Y.uid!=="number"&&typeof Y.gid!=="number")return I();if(U.uid===Y.uid&&U.gid===Y.gid)return I();var J=$.props.follow||$.type!=="SymbolicLink"?"chown":"lchown";if(!s$[J])return I();if(typeof Y.uid!=="number")Y.uid=U.uid;if(typeof Y.gid!=="number")Y.gid=U.gid;s$[J](Q,Y.uid,Y.gid,I)}function EP0($,Y,U,Q,I){if(!s$.utimes||process.platform==="win32")return I();var J=Y.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(J==="lutimes"&&!s$[J])J="utimes";if(!s$[J])return I();var{atime:K,mtime:z}=U,H=Y.atime,G=Y.mtime;if(H===void 0)H=K;if(G===void 0)G=z;if(!NP0(H))H=new Date(H);if(!NP0(G))H=new Date(G);if(H.getTime()===K.getTime()&&G.getTime()===z.getTime())return I();s$[J](Q,H,G,I)}a$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var Y=0,U=null,Q=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),J($._old);else{var I=$.props.follow?"stat":"lstat";s$[I]($._path,function(z,H){if(z)if(z.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(z);J($._old=H)})}return;function J(z){Y+=3,TP0($,$.props,z,$._path,K("chmod")),jP0($,$.props,z,$._path,K("chown")),EP0($,$.props,z,$._path,K("utimes"))}function K(z){return function(H){if(U)return;if(H)return H.fstream_finish_call=z,$.error(U=H);if(--Y>0)return;if(Q)return;if(Q=!0,!$._madeDir)return G();else CP0($,$._path,G);function G(W){if(W)return W.fstream_finish_call="setupMadeDir",$.error(W);$.emit("end"),$.emit("close")}}}};function CP0($,Y,U){var Q=$._madeDir,I=dZ.dirname(Y);CN1($,I,function(J){if(J)return U(J);if(I===Q)return U();CP0($,I,U)})}function CN1($,Y,U){var Q={};Object.keys($.props).forEach(function(z){if(Q[z]=$.props[z],z==="mode"&&$.type!=="Directory")Q[z]=Q[z]|parseInt("0111",8)});var I=3,J=null;s$.stat(Y,function(z,H){if(z)return U(J=z);TP0($,Q,H,Y,K),jP0($,Q,H,Y,K),EP0($,Q,H,Y,K)});function K(z){if(J)return;if(z)return U(J=z);if(--I===0)return U()}}a$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};a$.prototype.add=function(){this.error("Can't add to non-Directory type")};a$.prototype.write=function(){return!0};function RN1($){return Object.prototype.toString.call($)}function NP0($){return typeof $==="object"&&RN1($)==="[object Date]"}});var kp=E((_N1)=>{_N1.Abstract=tB();_N1.Reader=MQ();_N1.Writer=Hz();_N1.File={Reader:Xp(),Writer:Cp()};_N1.Dir={Reader:Wp(),Writer:jp()};_N1.Link={Reader:Hp(),Writer:Ep()};_N1.Proxy={Reader:qp(),Writer:_p()};_N1.Reader.Dir=_N1.DirReader=_N1.Dir.Reader;_N1.Reader.File=_N1.FileReader=_N1.File.Reader;_N1.Reader.Link=_N1.LinkReader=_N1.Link.Reader;_N1.Reader.Proxy=_N1.ProxyReader=_N1.Proxy.Reader;_N1.Writer.Dir=_N1.DirWriter=_N1.Dir.Writer;_N1.Writer.File=_N1.FileWriter=_N1.File.Writer;_N1.Writer.Link=_N1.LinkWriter=_N1.Link.Writer;_N1.Writer.Proxy=_N1.ProxyWriter=_N1.Proxy.Writer;_N1.collect=GA()});var vP0=E((H84,_P0)=>{_P0.exports=fN1;var SN1=nB(),gN1=kp().Writer,xp=z0("path"),yN1=z0("stream"),kN1=Jp(),xN1=b2();function fN1($){$.path=xp.resolve(xp.normalize($.path));var Y=new SN1($),U=new yN1.Writable({objectMode:!0});U._write=function(I,J,K){if(I.type=="Directory")return K();var z=xp.join($.path,I.path);if(z.indexOf($.path)!=0)return K();let H=$.getWriter?$.getWriter({path:z}):gN1({path:z});I.pipe(H).on("error",K).on("close",K)};var Q=kN1(Y,U);return Y.once("crx-header",function(I){Q.crxHeader=I}),Y.pipe(U).on("finish",function(){Q.emit("close")}),Q.promise=function(){return new xN1(function(I,J){Q.on("close",I),Q.on("error",J)})},Q}});var hP0=E((G84,ZA)=>{var y6=function($){var Y=1e7,U=7,Q=9007199254740992,I=Z(Q),J="0123456789abcdefghijklmnopqrstuvwxyz",K=typeof BigInt==="function";function z(T,v,c,s){if(typeof T>"u")return z[0];if(typeof v<"u")return+v===10&&!c?N0(T):u0(T,v,c,s);return N0(T)}function H(T,v){this.value=T,this.sign=v,this.isSmall=!1}H.prototype=Object.create(z.prototype);function G(T){this.value=T,this.sign=T<0,this.isSmall=!0}G.prototype=Object.create(z.prototype);function W(T){
Line truncated
|
||||
* Tmp
|
||||
*
|
||||
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
|
||||
*
|
||||
* MIT Licensed
|
||||
*/var M4=K0("fs"),aB=K0("os"),h6=K0("path"),aD0=K0("crypto"),S9={fs:M4.constants,os:aB.constants},UA0=/XXXXXX/,QA0=(S9.O_CREAT||S9.fs.O_CREAT)|(S9.O_EXCL||S9.fs.O_EXCL)|(S9.O_RDWR||S9.fs.O_RDWR),oN1=aB.platform()==="win32",rN1=S9.EBADF||S9.os.errno.EBADF,sN1=S9.ENOENT||S9.os.errno.ENOENT,Jz=[],IA0=M4.rmdirSync.bind(M4),JA0=!1;function tN1($,Y){return M4.rm($,{recursive:!0},Y)}function KA0($){return M4.rmSync($,{recursive:!0})}function Ld($,Y){let U=Kz($,Y),Q=U[0],I=U[1];zD1(Q,function(J,K){if(J)return I(J);let z=K.tries;(function G(){try{let H=GA0(K);M4.stat(H,function(W){if(!W){if(z-- >0)return G();return I(Error("Could not get a unique tmp filename, max tries reached "+H))}I(null,H)})}catch(H){I(H)}})()})}function Fd($){let Y=Kz($),U=Y[0],Q=GD1(U),I=Q.tries;do{let J=GA0(Q);try{M4.statSync(J)}catch(K){return J}}while(I-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function aN1($,Y){let U=Kz($,Y),Q=U[0],I=U[1];Ld(Q,function(K,z){if(K)return I(K);M4.open(z,QA0,Q.mode||384,function(H,W){if(H)return I(H);if(Q.discardDescriptor)return M4.close(W,function(Z){return I(Z,z,void 0,qd(z,-1,Q,!1))});else{let X=Q.discardDescriptor||Q.detachDescriptor;I(null,z,W,qd(z,X?-1:W,Q,!1))}})})}function eN1($){let Y=Kz($),U=Y[0],Q=U.discardDescriptor||U.detachDescriptor,I=Fd(U),J=M4.openSync(I,QA0,U.mode||384);if(U.discardDescriptor)M4.closeSync(J),J=void 0;return{name:I,fd:J,removeCallback:qd(I,Q?-1:J,U,!0)}}function $D1($,Y){let U=Kz($,Y),Q=U[0],I=U[1];Ld(Q,function(K,z){if(K)return I(K);M4.mkdir(z,Q.mode||448,function(H){if(H)return I(H);I(null,z,zA0(z,Q,!1))})})}function YD1($){let Y=Kz($),U=Y[0],Q=Fd(U);return M4.mkdirSync(Q,U.mode||448),{name:Q,removeCallback:zA0(Q,U,!0)}}function UD1($,Y){let U=function(Q){if(Q&&!Vd(Q))return Y(Q);Y()};if(0<=$[0])M4.close($[0],function(){M4.unlink($[1],U)});else M4.unlink($[1],U)}function QD1($){let Y=null;try{if(0<=$[0])M4.closeSync($[0])}catch(U){if(!HD1(U)&&!Vd(U))throw U}finally{try{M4.unlinkSync($[1])}catch(U){if(!Vd(U))Y=U}}if(Y!==null)throw Y}function qd($,Y,U,Q){let I=tB(QD1,[Y,$],Q),J=tB(UD1,[Y,$],Q,I);if(!U.keep)Jz.unshift(I);return Q?I:J}function zA0($,Y,U){let Q=Y.unsafeCleanup?tN1:M4.rmdir.bind(M4),I=Y.unsafeCleanup?KA0:IA0,J=tB(I,$,U),K=tB(Q,$,U,J);if(!Y.keep)Jz.unshift(J);return U?J:K}function tB($,Y,U,Q){let I=!1;return function J(K){if(!I){let z=Q||J,G=Jz.indexOf(z);if(G>=0)Jz.splice(G,1);if(I=!0,U||$===IA0||$===KA0)return $(Y);else return $(Y,K||function(){})}}}function ID1(){if(!JA0)return;while(Jz.length)try{Jz[0]()}catch($){}}function eD0($){let Y=[],U=null;try{U=aD0.randomBytes($)}catch(Q){U=aD0.pseudoRandomBytes($)}for(let Q=0;Q<$;Q++)Y.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[U[Q]%62]);return Y.join("")}function J$($){return typeof $>"u"}function Kz($,Y){if(typeof $==="function")return[{},$];if(J$($))return[{},Y];let U={};for(let Q of Object.getOwnPropertyNames($))U[Q]=$[Q];return[U,Y]}function JD1($,Y,U){let Q=h6.isAbsolute($)?$:h6.join(Y,$);M4.stat(Q,function(I){if(I)M4.realpath(h6.dirname(Q),function(J,K){if(J)return U(J);U(null,h6.join(K,h6.basename(Q)))});else M4.realpath(Q,U)})}function KD1($,Y){let U=h6.isAbsolute($)?$:h6.join(Y,$);try{return M4.statSync(U),M4.realpathSync(U)}catch(Q){let I=M4.realpathSync(h6.dirname(U));return h6.join(I,h6.basename(U))}}function GA0($){let Y=$.tmpdir;if(!J$($.name))return h6.join(Y,$.dir,$.name);if(!J$($.template))return h6.join(Y,$.dir,$.template).replace(UA0,eD0(6));let U=[$.prefix?$.prefix:"tmp","-",process.pid,"-",eD0(12),$.postfix?"-"+$.postfix:""].join("");return h6.join(Y,$.dir,U)}function Zd($,Y){if(typeof Y!=="string")throw Error(`${$} option must be a string, got "${typeof Y}".`);if(Y.includes(".."))throw Error("Relative value not allowed");return Y}function HA0($){if(!J$($.name)){let Y=$.name;if(h6.isAbsolute(Y))throw Error(`name option must not contain an absolute path, found "${Y}".`);let U=h6.basename(Y);if(U===".."||U==="."||U!==Y)throw Error(`name option must not contain a path, found "${Y}".`)}if(!J$($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match(UA0))throw Error(`Invalid template, found "${$.template}".`)}if(!J$($.tries)&&isNaN($.tries)||$.tries<0)throw Error(`Invalid tries, found "${$.tries}".`);$.tries=J$($.name)?$.tries||3:1,$.keep=!!$.keep,$.detachDescriptor=!!$.detachDescriptor,$.discardDescriptor=!!$.discardDescriptor,$.unsafeCleanup=!!$.unsafeCleanup,$.prefix=J$($.prefix)?"":Zd("prefix",$.prefix),$.postfix=J$($.postfix)?"":Zd("postfix",$.postfix),$.template=J$($.template)?void 0:Zd("template",$.template)}function $A0($,Y,U,Q){if(J$(Y))return Q(null);JD1(Y,U,function(I,J){if(I)return Q(I);let K=h6.relative(U,J);if(K.startsWith("..")||h6.isAbsolute(K))return Q(Error(`${$} option must be relative to "${U}", found "${K}".`));Q(null,K)})}function YA0($,Y,U){if(J$(Y))return;let Q=KD1(Y,U),I=h6.relative(U,Q);if(I.startsWith("..")||h6.isAbsolute(I))thrLine truncated
|
||||
*/var D4=z0("fs"),MA=z0("os"),k6=z0("path"),dP0=z0("crypto"),S9={fs:D4.constants,os:MA.constants},rP0=/XXXXXX/,sP0=(S9.O_CREAT||S9.fs.O_CREAT)|(S9.O_EXCL||S9.fs.O_EXCL)|(S9.O_RDWR||S9.fs.O_RDWR),HP1=MA.platform()==="win32",GP1=S9.EBADF||S9.os.errno.EBADF,WP1=S9.ENOENT||S9.os.errno.ENOENT,Wz=[],aP0=D4.rmdirSync.bind(D4),tP0=!1;function XP1($,Y){return D4.rm($,{recursive:!0},Y)}function eP0($){return D4.rmSync($,{recursive:!0})}function cp($,Y){let U=Xz($,Y),Q=U[0],I=U[1];NP1(Q,function(J,K){if(J)return I(J);let z=K.tries;(function H(){try{let G=YB0(K);D4.stat(G,function(W){if(!W){if(z-- >0)return H();return I(Error("Could not get a unique tmp filename, max tries reached "+G))}I(null,G)})}catch(G){I(G)}})()})}function np($){let Y=Xz($),U=Y[0],Q=PP1(U),I=Q.tries;do{let J=YB0(Q);try{D4.statSync(J)}catch(K){return J}}while(I-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function ZP1($,Y){let U=Xz($,Y),Q=U[0],I=U[1];cp(Q,function(K,z){if(K)return I(K);D4.open(z,sP0,Q.mode||384,function(G,W){if(G)return I(G);if(Q.discardDescriptor)return D4.close(W,function(Z){return I(Z,z,void 0,bp(z,-1,Q,!1))});else{let X=Q.discardDescriptor||Q.detachDescriptor;I(null,z,W,bp(z,X?-1:W,Q,!1))}})})}function qP1($){let Y=Xz($),U=Y[0],Q=U.discardDescriptor||U.detachDescriptor,I=np(U),J=D4.openSync(I,sP0,U.mode||384);if(U.discardDescriptor)D4.closeSync(J),J=void 0;return{name:I,fd:J,removeCallback:bp(I,Q?-1:J,U,!0)}}function VP1($,Y){let U=Xz($,Y),Q=U[0],I=U[1];cp(Q,function(K,z){if(K)return I(K);D4.mkdir(z,Q.mode||448,function(G){if(G)return I(G);I(null,z,$B0(z,Q,!1))})})}function LP1($){let Y=Xz($),U=Y[0],Q=np(U);return D4.mkdirSync(Q,U.mode||448),{name:Q,removeCallback:$B0(Q,U,!0)}}function wP1($,Y){let U=function(Q){if(Q&&!ip(Q))return Y(Q);Y()};if(0<=$[0])D4.close($[0],function(){D4.unlink($[1],U)});else D4.unlink($[1],U)}function FP1($){let Y=null;try{if(0<=$[0])D4.closeSync($[0])}catch(U){if(!BP1(U)&&!ip(U))throw U}finally{try{D4.unlinkSync($[1])}catch(U){if(!ip(U))Y=U}}if(Y!==null)throw Y}function bp($,Y,U,Q){let I=FA(FP1,[Y,$],Q),J=FA(wP1,[Y,$],Q,I);if(!U.keep)Wz.unshift(I);return Q?I:J}function $B0($,Y,U){let Q=Y.unsafeCleanup?XP1:D4.rmdir.bind(D4),I=Y.unsafeCleanup?eP0:aP0,J=FA(I,$,U),K=FA(Q,$,U,J);if(!Y.keep)Wz.unshift(J);return U?J:K}function FA($,Y,U,Q){let I=!1;return function J(K){if(!I){let z=Q||J,H=Wz.indexOf(z);if(H>=0)Wz.splice(H,1);if(I=!0,U||$===aP0||$===eP0)return $(Y);else return $(Y,K||function(){})}}}function MP1(){if(!tP0)return;while(Wz.length)try{Wz[0]()}catch($){}}function mP0($){let Y=[],U=null;try{U=dP0.randomBytes($)}catch(Q){U=dP0.pseudoRandomBytes($)}for(let Q=0;Q<$;Q++)Y.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[U[Q]%62]);return Y.join("")}function J$($){return typeof $>"u"}function Xz($,Y){if(typeof $==="function")return[{},$];if(J$($))return[{},Y];let U={};for(let Q of Object.getOwnPropertyNames($))U[Q]=$[Q];return[U,Y]}function OP1($,Y,U){let Q=k6.isAbsolute($)?$:k6.join(Y,$);D4.stat(Q,function(I){if(I)D4.realpath(k6.dirname(Q),function(J,K){if(J)return U(J);U(null,k6.join(K,k6.basename(Q)))});else D4.realpath(Q,U)})}function DP1($,Y){let U=k6.isAbsolute($)?$:k6.join(Y,$);try{return D4.statSync(U),D4.realpathSync(U)}catch(Q){let I=D4.realpathSync(k6.dirname(U));return k6.join(I,k6.basename(U))}}function YB0($){let Y=$.tmpdir;if(!J$($.name))return k6.join(Y,$.dir,$.name);if(!J$($.template))return k6.join(Y,$.dir,$.template).replace(rP0,mP0(6));let U=[$.prefix?$.prefix:"tmp","-",process.pid,"-",mP0(12),$.postfix?"-"+$.postfix:""].join("");return k6.join(Y,$.dir,U)}function up($,Y){if(typeof Y!=="string")throw Error(`${$} option must be a string, got "${typeof Y}".`);if(Y.includes(".."))throw Error("Relative value not allowed");return Y}function UB0($){if(!J$($.name)){let Y=$.name;if(k6.isAbsolute(Y))throw Error(`name option must not contain an absolute path, found "${Y}".`);let U=k6.basename(Y);if(U===".."||U==="."||U!==Y)throw Error(`name option must not contain a path, found "${Y}".`)}if(!J$($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match(rP0))throw Error(`Invalid template, found "${$.template}".`)}if(!J$($.tries)&&isNaN($.tries)||$.tries<0)throw Error(`Invalid tries, found "${$.tries}".`);$.tries=J$($.name)?$.tries||3:1,$.keep=!!$.keep,$.detachDescriptor=!!$.detachDescriptor,$.discardDescriptor=!!$.discardDescriptor,$.unsafeCleanup=!!$.unsafeCleanup,$.prefix=J$($.prefix)?"":up("prefix",$.prefix),$.postfix=J$($.postfix)?"":up("postfix",$.postfix),$.template=J$($.template)?void 0:up("template",$.template)}function lP0($,Y,U,Q){if(J$(Y))return Q(null);OP1(Y,U,function(I,J){if(I)return Q(I);let K=k6.relative(U,J);if(K.startsWith("..")||k6.isAbsolute(K))return Q(Error(`${$} option must be relative to "${U}", found "${K}".`));Q(null,K)})}function oP0($,Y,U){if(J$(Y))return;let Q=DP1(Y,U),I=k6.relative(U,Q);if(I.startsWith("..")||k6.isAbsolute(I))thrLine truncated
|
||||
`)}let Q=[];Y.forEach((I,J)=>{let K=$.length+J+1,z=J===0?"⏳ ":"";Q.push(`${z}${K}. ${I}`)});for(let I=$.length-1;I>=0;I--){let J=I+1;Q.push(`${J}. ${$[I]}`)}return Q.join(`
|
||||
`)}function jd($,Y,U,Q,I){let J=$?.operator||Y?.operator||U?.operator,K=J?.name||J?.id||U?.operatorName||"",z=($?.nodeName||Y?.fromNodeName||Y?.nodeName||U?.nodeName||"").trim();if(z==="合思审批节点"||z==="外部审批节点"||z.includes("合思审批")||z.includes("外部审批"))z="";if((!z||z==="提交人"||z==="审批节点")&&K&&Q){let M=Q.find((F)=>F.operator?.name===K&&F.nodeName&&F.nodeName.trim()!=="提交人"&&!F.isEbot&&F.rawAction!=="freeflow.reject");if(M?.nodeName)z=M.nodeName.trim()}let H=$?.comment||Y?.reason||U?.rejectComment||"修改";if(H.includes(":")){let M=H.split(":");if(M.length>1)H=M.slice(1).join(":").trim()}let W=H;if(z&&K)W=`${z}(${K}) ❌: ${H}`;else if(K)W=`${K} ❌: ${H}`;else if(z)W=`${z} ❌: ${H}`;else W=H;let X=$?.rejectTargetNodeName||Y?.targetNodeName||"提交人",Z=$?.rejectTargetOperator?.name||Y?.targetOperator?.name||I?.submitter?.name,q=Z?`${X}(${Z})`:X,V=$?.resubmitRuleText||Y?.resubmitRuleText||(K?`重新提交后由${K}继续审批`:"重新提交后继续审批");return{comment:`${W}
|
||||
`)}function $d($,Y,U,Q,I){let J=$?.operator||Y?.operator||U?.operator,K=J?.name||J?.id||U?.operatorName||"",z=($?.nodeName||Y?.fromNodeName||Y?.nodeName||U?.nodeName||"").trim();if(z==="合思审批节点"||z==="外部审批节点"||z.includes("合思审批")||z.includes("外部审批"))z="";if((!z||z==="提交人"||z==="审批节点")&&K&&Q){let M=Q.find((F)=>F.operator?.name===K&&F.nodeName&&F.nodeName.trim()!=="提交人"&&!F.isEbot&&F.rawAction!=="freeflow.reject");if(M?.nodeName)z=M.nodeName.trim()}let G=$?.comment||Y?.reason||U?.rejectComment||"修改";if(G.includes(":")){let M=G.split(":");if(M.length>1)G=M.slice(1).join(":").trim()}let W=G;if(z&&K)W=`${z}(${K}) ❌: ${G}`;else if(K)W=`${K} ❌: ${G}`;else if(z)W=`${z} ❌: ${G}`;else W=G;let X=$?.rejectTargetNodeName||Y?.targetNodeName||"提交人",Z=$?.rejectTargetOperator?.name||Y?.targetOperator?.name||I?.submitter?.name,q=Z?`${X}(${Z})`:X,V=$?.resubmitRuleText||Y?.resubmitRuleText||(K?`重新提交后由${K}继续审批`:"重新提交后继续审批");return{comment:`${W}
|
||||
↳ 驳回至: ${q}
|
||||
↳ ${V}`,operator:J}}function mA0($){if(!$)return[];let Y=$.pending||[],U=String($.rawState||"").toUpperCase(),Q=String($.state||"").toUpperCase(),I=[];if(Y.length>0)for(let J of Y){let K=J.approver?.name||J.approver?.id||"待定",z=(J.name||$.currentNode||"").trim(),G=z?`${z}(${K})`:K,W=J.type?.toUpperCase()==="PAYING"||z.includes("支付")||U==="PAYING"||Q==="支付中"?"待支付":"待审批";I.push(`${G}: ${W}`)}else if($.currentNode?.trim()){let K=$.currentNode.includes("支付")||U==="PAYING"||Q==="支付中"?"待支付":"待审批";I.push(`${$.currentNode.trim()}: ${K}`)}return I}function NQ($,Y){let U=new Map;if(!$||$.length===0)return U;if(!Y){for(let q of $){let w=(q.result||{}).decision||q.aiDecision||"-";U.set(q.id,{recordId:q.id,sourceDocumentSN:q.sourceDocumentSN,taskMode:q.taskMode,aiDecision:pA0(typeof w==="string"?w:"-"),aiAction:"-",eHumanAction:"-",eHumanComment:"-",auditDrift:!1})}return U}let Q=[...$].sort((q,V)=>(Number(q.createdAt)||0)-(Number(V.createdAt)||0)),I=Y.history||[],J=String(Y.rawState||"").toUpperCase(),K=String(Y.state||"").toUpperCase(),z=J==="DRAFT"||J==="REVOKED"||J==="CANCELED"||J==="CANCELLED"||K==="草稿"||K==="已撤回"||K==="已取消",G=J==="REJECTED"||J==="TERMINATED"||K==="审批驳回"||K==="已驳回",H=!z&&!G&&(J==="PAID"||K==="已支付"||I.some((q)=>!q.isEbot&&(q.rawAction==="freeflow.pay"||q.action==="支付成功"||q.action==="支付完成"))),W=!z&&!G&&!H&&(J==="PAYING"||K==="支付中"||(Y.pending||[]).some((q)=>q.isCurrent&&(q.type?.toUpperCase()==="PAYING"||q.name?.includes("支付")))||Y.currentNode?.includes("支付")===!0),Z=H||!z&&!G&&!W&&(J==="COMPLETED"||J==="APPROVED"||K==="已完成"||K==="审批通过");for(let q=0;q<Q.length;q++){let V=Q[q];if(!V)continue;let w=Number(V.createdAt)||0,M=V.document||{},F=V.manualApprovalRecord||V.result?.manualApprovalRecord||M.manualApprovalRecord||{},N=typeof V.sourceExtendData?.nodeId==="string"?String(V.sourceExtendData.nodeId):void 0,O=typeof F.nodeId==="string"?String(F.nodeId):void 0,D=O?decodeURIComponent(O).replace(/^hcnode_/,"").replace(/_r\d+$/,""):void 0,P=N||D,T=P?I.find((D0)=>D0.nodeId&&(D0.nodeId===P||P.includes(D0.nodeId))):void 0,A=T?.time??w,E=Q[q+1],C=E?Number(E.createdAt)||1/0:1/0,i=q===Q.length-1,x=I.find((D0)=>(D0.time??0)>A+5000&&D0.isEbot&&(D0.nodeName?.includes("智能")||D0.nodeName?.includes("AI")||D0.action?.includes("智能")||D0.comment?.includes("AI")||D0.comment?.includes("approval-result"))&&!D0.nodeName?.includes("费用标准检查")&&!D0.nodeName?.includes("标准检查")&&!D0.nodeName?.includes("预算"));if(x){if(i=!1,(x.time??1/0)<C)C=x.time}let h=V.result||{},b=h.decision||V.aiDecision||"-",n=typeof b==="string"?b:"-",Q0=n.toUpperCase(),k=Q0==="REJECT"||Q0==="驳回",m=Q0==="APPROVE"||Q0==="通过",a=Q0==="EXEMPT_APPROVE"||Q0==="免审通过"||Q0==="备注通过",$0=V.taskMode||V.finalExecutionMode||"",p=String($0).toLowerCase().includes("auto")||V.finalExecutionMode==="automatic"||$0==="automatic"||$0==="fully_automatic",Y0="-";if(m||a)Y0="添加评论";else if(k)Y0=p?"驳回":"添加评论";else if(Q0==="REVIEW"||Q0==="转交复核")Y0="转交复核";let y=typeof F.status==="object"&&F.status!==null?String(F.status.type||F.status.label||"").toUpperCase():"",c=typeof F.status==="object"&&F.status!==null?String(F.status.sourceStatus||""):"",e=M.manualApprovalStatus||h.manualApprovalStatus||V.manualApprovalStatus,V0=typeof e==="string"?e.toUpperCase():"",j0=V0==="CANCELLED"||V0==="CANCELED"||V0==="已取消"||V0==="已撤回"||V0==="REVOKED"||y==="CANCELLED"||y==="CANCELED"||c.includes("撤回")||c.includes("取消"),A0=V0==="APPROVED"||V0==="已支付/审批完成"||V0==="已通过"||V0==="已完成"||V0==="已支付"||y==="APPROVED",r0=!(c.includes("补偿")||c.includes("已支付"))&&(V0==="TERMINATED"||V0==="REJECTED"||V0==="REJECT"||V0==="已驳回"||V0==="被驳回"||y==="TERMINATED"||y==="REJECTED"||y==="已驳回"||y==="被驳回"),X1=T?1000:60000,t=I.filter((D0)=>{let I0=D0.time??0;return I0>=A-X1&&I0<C}),X0="-",w0="-",u0=!1,b0,c0,T1=m||a,x1=I.filter((D0)=>(D0.time??0)>A+5000),b1=x1.some((D0)=>D0.rawAction==="freeflow.retract"||D0.action==="单据撤回"),i1=x1.some((D0)=>D0.rawAction==="freeflow.submit"||D0.action==="提交送审");if(T1&&i&&(b1||i1))u0=!0,b0="AI通过后单据发生撤回/修改重提,后续未经AI复审";if(p&&k)X0="无操作",w0="-";else{let D0=t.filter((S)=>(S.time??0)>=A-1000&&!S.isEbot&&S.rawAction!=="freeflow.submit"&&S.action!=="提交送审"&&!((S.rawAction==="freeflow.comment"||S.action==="发表评论")&&!S.comment)&&!((S.rawAction==="freeflow.print"||S.action==="打印提醒")&&!S.comment)&&!(S.rawAction==="freeflow.carbonCopy"||S.rawAction==="freeflow.cc"||S.action==="抄送通知")),I0=D0.find((S)=>S.rawAction==="freeflow.retract"||S.action==="单据撤回"),B=D0.find((S)=>S.rawAction==="freeflow.reject"||S.action==="审批驳回");if(!i)if(B||!Y&&r0){X0="审批驳回",u0=!1,b0=void 0;let S=jd(B,void 0,F,I,Y);w0=S.comme
Line truncated
|
||||
`,{mode:384}),Y}function xd($){let Y=ZB0();for(let U of Y){if(!T$(U))continue;for(let Q of XP(U).filter((I)=>I.endsWith(".json")).filter((I)=>!I.startsWith("example."))){let I=g9(U,Q);try{let J=qP(I,"utf-8"),K=JSON.parse(J);if(K&&typeof K==="object"&&K.id===$)return I}catch{}}}return}function y9($,Y){let U=xd($);if(!U)throw Error(`Enterprise config not found: ${$}`);let I={...JSON.parse(qP(U,"utf-8")),...Y};for(let K of Object.keys(Y))if(Y[K]===void 0)delete I[K];let J=dZ.parse(I);return KB0(U,`${JSON.stringify(J,null,2)}
|
||||
`,"utf-8"),J}var kd="SEAL_USE_ENTERPRISES_DIR",zB0="SEAL_HOME_ENTERPRISES_DIR",GB0="SEAL_USE_USER_ENTERPRISES_DIR",HB0="SEAL_HOME_USER_ENTERPRISES_DIR",WB0="SEAL_USE_CONFIG_FILE",XB0="SEAL_HOME_CONFIG_FILE",Xz,ZP,WP,IB0;var a$=o(()=>{HP();Xz=g9(VP(),".config","seal-use","enterprises"),ZP=g9(VP(),".config","seal-home","enterprises"),WP=g9(VP(),".config","seal-use","config.json"),IB0=g9(VP(),".config","seal-home","config.json")});function r2($,Y,U=[]){let Q=Y.corpId?.trim()||void 0,I=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=Q??I;if(J){let z=$.find((W)=>W.id===J);if(z)return z;let G=$.find((W)=>W.id.toLowerCase()===J.toLowerCase());if(G)return G;let H=$.find((W)=>W.name.toLowerCase()===J.toLowerCase());if(H)return H;throw Error(`No enterprise config found for ${J}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-use config mode stateful` to enable a default enterprise.");let K=$[0];if(K)return K;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(U.length?U.join(", "):"the configured enterprise directories"))}import{existsSync as fd,mkdirSync as cA1,readFileSync as nA1,renameSync as dA1,unlinkSync as pA1,writeFileSync as mA1}from"node:fs";import{homedir as lA1}from"node:os";import{dirname as oA1,join as rA1}from"node:path";function mZ(){let $=process.env[sA1]?.trim();if($)return $;return tA1}function VB0($=new Date){return $.toISOString().slice(0,10)}function LB0($=ud,Y=new Date){let U=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(U).toISOString().slice(0,10)}function FB0($=mZ()){if(!fd($))return{};try{let Y=nA1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&!Array.isArray(U))return U;return{}}catch{return{}}}function aA1($,Y){let U={};for(let[Q,I]of Object.entries($)){if(!I||typeof I!=="object")continue;let J={},K=!1;for(let[z,G]of Object.entries(I))if(typeof G==="number"&&G>0&&z>=Y)J[z]=G,K=!0;if(K)U[Q]=J}return U}function eA1($,Y=mZ()){let U=oA1(Y);if(!fd(U))cA1(U,{recursive:!0,mode:448});let Q=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{mA1(Q,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),dA1(Q,Y)}catch(I){try{if(fd(Q))pA1(Q)}catch{}throw I}}function wB0($,Y=new Date){if(!$||typeof $!=="string")return;try{let U=mZ(),Q=FB0(U),I=VB0(Y),J=LB0(ud,Y),K=aA1(Q,J);K[$]=K[$]||{},K[$][I]=(K[$][I]??0)+1,eA1(K,U)}catch{}}function $B1($,Y=ud,U=new Date){let Q=new Map;try{let I=FB0(),J=LB0(Y,U),K=VB0(U),z=$??Object.keys(I);for(let G of z){let H=I[G];if(!H){Q.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=J&&X<=K&&typeof Z==="number")W+=Z;Q.set(G,W)}}catch{if($)for(let I of $)Q.set(I,0)}return Q}function MB0($,Y,U){let Q=U??$B1($.map((I)=>I.id));return[...$].sort((I,J)=>{if(Y){if(I.id===Y&&J.id!==Y)return-1;if(J.id===Y&&I.id!==Y)return 1}let K=Q.get(I.id)??0,z=Q.get(J.id)??0;if(K!==z)return z-K;let G=I.name??I.id,H=J.name??J.id,W=G.localeCompare(H,"zh-CN");if(W!==0)return W;return I.id.localeCompare(J.id)})}var sA1="SEAL_USE_USAGE_FILE",tA1,ud=7;var LP=o(()=>{tA1=rA1(lA1(),".config","seal-use","usage.json")});var H8={};L8(H8,{withApprovalRunFilters:()=>jB1,toDate:()=>td,timestampOf:()=>cd,summarizeSimulationBatch:()=>GB1,summarizeRunBridge:()=>LB1,summarizeRuleVersion:()=>FB1,summarizeApprovalRuns:()=>XB1,summarizeApprovalRunResult:()=>DP,summarizeApprovalRunDocument:()=>EB0,summarizeApprovalRunDetail:()=>qB1,summarizeApprovalRun:()=>aZ,stringifyHumanResultValue:()=>sd,stringFromUnknown:()=>q4,simulationBatchCreatedAtMs:()=>PB0,setPath:()=>jB0,scalarIncludes:()=>MP,runtimeRuleIndex:()=>NB1,runtimeRuleIdToCode:()=>vB0,rulesHaveSameContent:()=>AB0,ruleChangedFields:()=>BB0,resolveSealBaseUrl:()=>BB1,resolveRuleVersionSelector:()=>EB1,resolveRuleVersionForLookup:()=>wB1,resolveRuleVersion:()=>nd,resolveManualApprovalStatus:()=>hB0,resolveApprovalRunForUrl:()=>AB1,redactPreviewValue:()=>rZ,redactIntegrationSecrets:()=>JB1,projectApprovalRules:()=>UB1,presentWebhookIntegration:()=>YB1,prepareApprovalRuns:()=>CB1,pickRunFields:()=>TB0,pickRuleFields:()=>DB0,pickApprovalRuns:()=>TB1,pickApprovalRunCandidate:()=>DB1,parseRuleCodeNumber:()=>z$,parseFieldPaths:()=>ZB1,parseDurationMs:()=>IB1,objectContainsScalar:()=>OP,numberFromUnknown:()=>CB0,normalizeUrl:()=>PB1,normalizeRuleStrictness:()=>ld,normalizeRuleCode:()=>oZ,mutationPreview:()=>KB1,matchesRunLookup:()=>_B1,localParts:()=>ad,localDateKey:()=>vB1,isHumanResultKey:()=>dd,getPath:()=>e$,getConfiguredSealBaseUrl:()=>NB0,formatRuleCode:()=>t2,formatLocalDateTime:()=>md,flattenDocumentFields:()=>RB0,firstPath:()=>sZ,firstByLabel:()=>lZ,findRuleInVersion:()=>OB1,findRuleInDraft:()=>MB1,findReusableSimulationBatch:()=>WB1,findKeywordLines:()=>id,findHumanResultValue:()=>NP,filterRunsByHumanResult:()=>SB0,filterRuns:()=>rd,extractHumanResult:()=>BQ,extractCitedRules:()=>VB1,countPathCandidates:()=>bd,countBy:()=>pd,compactObject:()=>s2,collectInvoiceSummary:()=>_B0,collectInvoiceObjects:
Line truncated
|
||||
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:s2({id:Y?.id,sn:Y?.sn??Y?.sourceDocumentSN??$.sourceDocumentSN,title:Y?.title??Y?.name,template:sZ(Y,["template.name","templateName","form.name","formName","formTitle"]),amount:lZ(U,["金额","报销金额","付款金额","合计","价税合计"])??sZ(Y,["amount","totalAmount","expenseAmount"]),expenseType:lZ(U,["费用类型","费用类别","报销类型"]),costCompany:lZ(U,["费用承担公司","承担公司","成本中心","费用归属"]),payee:lZ(U,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:U.slice(0,30)}),invoices:_B0($),attachments:p3($,{summary:!0}).attachments,aiResult:DP($),manualResult:BQ($)?.value,hints:s2({amountMentions:id(Q,["金额","合计","税率"],8),partyMentions:id(Q,["买方","卖方","甲方","乙方","收款"],8)})}}function VB1($){let Y=[["result.rulesResult",e$($,"result.rulesResult")],["result.hitRules",e$($,"result.hitRules")],["result.citedRules",e$($,"result.citedRules")],["result.matchedRules",e$($,"result.matchedRules")],["result.ruleResults",e$($,"result.ruleResults")],["result.rules",e$($,"result.rules")],["pipelineData.citedRules",e$($,"pipelineData.citedRules")],["pipelineData.matchedRules",e$($,"pipelineData.matchedRules")]],U=[],Q=new Map,I=new Set;for(let[J,K]of Y)(Array.isArray(K)?K:K&&typeof K==="object"?Object.values(K):[]).forEach((G,H)=>{let W=Zz(G);if(!W)return;let X=q4(W.runtimeRuleId)??q4(W.runtimeId)??q4(W.id)??q4(W.ruleId),Z=W.ruleCode??W.code,q=z$(Z??X),V=X??(q!==void 0?`rule-${q}`:void 0),w=(q!==void 0?t2(q):void 0)??q4(W.ruleCode)??q4(W.code)??(V?vB0(V):void 0),M=s2({code:w,runtimeRuleId:V,ruleCode:w,versionNumber:CB0(W.versionNumber)??$.ruleSetVersionNumber,description:q4(W.description),scope:q4(W.scope),strictness:q4(W.strictness),ruleIntent:q4(W.ruleIntent),appliedAnalysis:W.appliedAnalysis??W.analysis??W.reasoning,checkResult:W.checkResult??W.result??W.decision,findings:W.findings??W.riskPoints??W.evidence,sourcePath:`${J}.${H}`}),F=V??w;if(F){let O=Q.get(F);if(O){for(let[D,P]of Object.entries(M))if(O[D]===void 0&&P!==void 0)O[D]=P;return}Q.set(F,M),U.push(M);return}let N=JSON.stringify(M);if(!I.has(N))I.add(N),U.push(M)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:U.length,rules:U}}function sZ($,Y){if(!$)return;for(let U of Y){let Q=e$($,U);if(Q!==void 0)return Q}return}function bd($,Y){if(!$)return 0;for(let U of Y){let Q=e$($,U);if(Array.isArray(Q))return Q.length;if(Q&&typeof Q==="object")return Object.keys(Q).length;if(typeof Q==="number")return Q}return 0}function e$($,Y){return Y.split(".").reduce((U,Q)=>{if(U===void 0||U===null)return;if(Array.isArray(U)){let I=Number(Q);return Number.isInteger(I)?U[I]:void 0}if(typeof U==="object")return U[Q];return},$)}function jB0($,Y,U){let Q=Y.split("."),I=$;for(let J of Q.slice(0,-1)){let K=I[J];if(!K||typeof K!=="object"||Array.isArray(K))I[J]={};I=I[J]}I[Q[Q.length-1]??Y]=U}function s2($){return Object.fromEntries(Object.entries($).filter(([,Y])=>Y!==void 0))}function Zz($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function CB0($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function RB0($){let Y=[];return wP($,"document",Y),Y}function wP($,Y,U){if(Array.isArray($)){$.forEach((K,z)=>wP(K,`${Y}.${z}`,U));return}let Q=Zz($);if(!Q)return;let I=q4(Q.label)??q4(Q.name)??q4(Q.title)??q4(Q.fieldName),J=Q.value??Q.displayValue??Q.text??Q.content;if(I&&J!==void 0&&typeof J!=="object")U.push(s2({path:Y,label:I,value:J,type:q4(Q.type)??q4(Q.fieldType)}));for(let[K,z]of Object.entries(Q)){if(K==="attachments")continue;wP(z,`${Y}.${K}`,U)}}function lZ($,Y){return $.find((Q)=>{let I=q4(Q.label)??"";return Y.some((J)=>I.includes(J))})?.value}function _B0($){let Y=[];return tZ($.result,"result",Y),tZ($.document,"document",Y),Y.slice(0,20)}function tZ($,Y,U){if(Array.isArray($)){$.forEach((I,J)=>tZ(I,`${Y}.${J}`,U));return}let Q=Zz($);if(!Q)return;if(/invoice|发票/i.test(Y))U.push(s2({path:Y,fileName:q4(Q.fileName)??q4(Q.filename)??q4(Q.name),buyer:Q.buyer??Q.buyerName??Q.purchaserName,seller:Q.seller??Q.sellerName,amount:Q.amount??Q.totalAmount??Q.total,taxRate:Q.taxRate,category:Q.category??Q.type}));for(let[I,J]of Object.entries(Q))tZ(J,`${Y}.${I}`,U)}function id($,Y,U){return $.split(/\r?\n/).filter((Q)=>Y.some((I)=>Q.includes(I))).slice(0,U)}function LB1($){return $.map((Y)=>{let U=aZ(Y);return{recordId:U.id,tenantId:U.tenantId,agentId:U.agentId,sourceDocumentSN:U.sourceDocumentSN,sourceDocumentId:U.sourceDocumentId,simulationBatchId:U.simulationBatchId,langfuseTraceId:U.langfuseTraceId,langfuseSessionFallback:U.langfuseSessionFallback,ruleSetVersionNumber:U.ruleSetVersionNumber,ruleSetPublishedAt:U.ruleSetPublishedAt,ruleSetPublishedByName:U.ruleSetPublishedByName,resolution:U.langfuseTraceId?"trace":U.langfuseSessionFallback?"session-fallback"
Line truncated
|
||||
`):[]}function rB1($,Y){let U=Array.from({length:$.length+1},()=>Array(Y.length+1).fill(0));for(let K=$.length-1;K>=0;K-=1)for(let z=Y.length-1;z>=0;z-=1)U[K][z]=$[K]===Y[z]?U[K+1][z+1]+1:Math.max(U[K+1][z],U[K][z+1]);let Q=[],I=0,J=0;while(I<$.length&&J<Y.length)if($[I]===Y[J])Q.push(` ${$[I]}`),I+=1,J+=1;else if(U[I+1][J]>=U[I][J+1])Q.push(`-${$[I++]}`);else Q.push(`+${Y[J++]}`);while(I<$.length)Q.push(`-${$[I++]}`);while(J<Y.length)Q.push(`+${Y[J++]}`);return Q}function sB1($,Y,U,Q,I,J){let K=sB0(Q,J),z=sB0(I,J),G=Q?`a/rules/${$}`:"/dev/null",H=I?`b/rules/${$}`:"/dev/null";return[`diff --git a/rules/${$} b/rules/${$}`,`--- ${G} v${Y.versionNumber}`,`+++ ${H} v${U.versionNumber}`,`@@ -${K.length?1:0},${K.length} +${z.length?1:0},${z.length} @@`,...rB1(K,z)].join(`
|
||||
`)}function tB0($){return{id:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedAt:$.publishedAt}}function aB0($,Y){let U=new Map;for(let Q of $.rules){let I=eZ(Q),J=Y==="stable-id"?$P0(I):$q(I.code??I.ruleCode);if(!J)throw Error(`Rule version ${$.versionNumber} contains a rule without a ${Y==="stable-id"?"stable rule ID":"code"}.`);if(U.has(J))throw Error(`Rule version ${$.versionNumber} contains duplicate ${Y==="stable-id"?"stable rule ID":"code"}: ${J}`);U.set(J,I)}return U}function tB1($,Y,U){if(U!=="auto")return U;if([...$.rules,...Y.rules].every((J)=>Boolean($P0(J))))return"stable-id";if([...$.rules,...Y.rules].every((J)=>Boolean($q(eZ(J).code??eZ(J).ruleCode))))return"code";throw Error("Rule snapshots have neither a complete stable-ID mapping nor a complete code mapping.")}function YP0($,Y,U={}){let Q=tB1($,Y,U.identityMode??"auto"),I=aB0($,Q),J=aB0(Y,Q),K=[...new Set([...I.keys(),...J.keys()])],z=[],G={added:0,removed:0,modified:0,unchanged:0},H=tB0($),W=tB0(Y);for(let Z of K){let q=I.get(Z),V=J.get(Z),w=q?PQ(q,Q):void 0,M=V?PQ(V,Q):void 0,F=!q?"added":!V?"removed":JSON.stringify(w)!==JSON.stringify(M)?"modified":"unchanged";if(G[F]+=1,F==="unchanged"&&!U.includeUnchanged)continue;let N=F==="modified"?[...new Set([...Object.keys(w??{}),...Object.keys(M??{})])].filter((O)=>JSON.stringify(w?.[O])!==JSON.stringify(M?.[O])):void 0;z.push({status:F,ruleId:Z,identityMode:Q,...q?{before:q}:{},...V?{after:V}:{},...N?.length?{changedFields:N}:{},...F!=="unchanged"?{diff:sB1(Z,H,W,q,V,Q)}:{}})}let X={from:H,to:W,identityMode:Q,counts:G,changes:z,unifiedDiff:z.filter((Z)=>Z.diff).map((Z)=>Z.diff).join(`
|
||||
`)};if(Q==="code"){let Z=K.filter((P)=>I.has(P)&&J.has(P)).length,q=K.filter((P)=>I.has(P)&&J.has(P)&&JSON.stringify(PQ(I.get(P),"code"))===JSON.stringify(PQ(J.get(P),"code"))).length,V=I.size,w=J.size,M=Math.min(V,w)?Z/Math.min(V,w):1,F=new Map;for(let[P,T]of I)F.set(JSON.stringify(PQ(T,"code")),P);let N=0;for(let[P,T]of J){let A=F.get(JSON.stringify(PQ(T,"code")));if(A&&A!==P)N+=1}let D=(Math.min(V,w)?q/Math.min(V,w):1)>=0.5?"high":q>0||N>0?"ambiguous":"low";X.codeStats={oldCount:V,newCount:w,sameCodeCount:Z,sameCodeUnchanged:q,sameBodyDifferentCode:N,overlapRatio:M,confidence:D,warning:"Published snapshots do not carry stable IDs; code matching can report reorderings as remove/add or modified rules."}}return X}function Yp($,Y=20000,U=!1){if(U||$.unifiedDiff.length<=Y)return{...$,truncation:{truncated:!1,maxChars:Y,omittedChars:0,hint:"Use --full only when the complete diff is required."}};let Q=$.unifiedDiff.length-Y,I=`
|
||||
... [diff truncated: ${Q} characters omitted; rerun with --full for the complete diff]`,J=$.changes.map(({before:K,after:z,diff:G,...H})=>({...H,...G?{diff:G.length>Y?`${G.slice(0,Y)}${I}`:G}:{}}));return{...$,changes:J,unifiedDiff:`${$.unifiedDiff.slice(0,Y)}${I}`,truncation:{truncated:!0,maxChars:Y,omittedChars:Q,hint:"Use --full for the complete diff."}}}var eB0,oB1;var UP0=o(()=>{eB0=["id","ruleId","stableId"],oB1=new Set([...eB0,"runtimeRuleId","runtimeId","tenantId","createdAt","updatedAt","versionId","versionNumber"])});import{existsSync as aB1,mkdirSync as eB1,readFileSync as $P1,renameSync as YP1,writeFileSync as UP1}from"node:fs";import{homedir as QP1}from"node:os";import{join as QP0}from"node:path";function Yq($){if($===void 0||$===null)return;let Y=String($).trim().toLowerCase().replace(/^rule[-_:]?/,"").replace(/^#/,"");if(!Y)return;return/^\d+$/.test(Y)?String(Number(Y)):Y}function TP($){return JSON.stringify([$.description??"",$.scope??"",$.strictness??""])}function IP0(){return process.env.SEAL_USE_RULE_VERSION_SNAPSHOTS_DIR?.trim()||QP0(QP1(),".config","seal-use","rule-version-snapshots")}function IP1($){return $.replace(/[^a-zA-Z0-9._-]/g,"_")}function JP0($,Y){return QP0(IP0(),`${IP1($)}-v${Y}.json`)}function Uq($,Y,U){let Q=new Map,I=new Map;for(let W of U){let X=Yq(W.code);if(X)Q.set(X,[...Q.get(X)??[],W]);let Z=TP(W);I.set(Z,[...I.get(Z)??[],W])}let J=[];for(let W of Y.rules??[]){let X=Yq(W.code),Z=X?Q.get(X)??[]:[],q=I.get(TP(W))??[],V=Z.length===1?Z[0]:q.length===1?q[0]:void 0;if(!V)continue;J.push({stableId:V.id,...W.code!==void 0?{code:W.code}:{},description:W.description,scope:W.scope,strictness:W.strictness})}let K={corpId:$,versionId:Y.id,versionNumber:Y.versionNumber,capturedAt:A1(),rules:J},z=IP0();eB1(z,{recursive:!0,mode:448});let G=JP0($,Y.versionNumber),H=`${G}.${process.pid}.tmp`;return UP1(H,`${JSON.stringify(K,null,2)}
|
||||
`,{encoding:"utf8",mode:384}),YP1(H,G),G}function JP1($,Y){let U=JP0($,Y.versionNumber);if(!aB1(U))return null;try{return JSON.parse($P1(U,"utf8"))}catch{return null}}function EP($,Y){let U=JP1($,Y);if(!U?.rules.length)return Y;let Q=new Map(U.rules.flatMap((J)=>{let K=Yq(J.code);return K?[[K,J]]:[]})),I=new Map(U.rules.map((J)=>[TP(J),J]));return{...Y,rules:Y.rules.map((J)=>{if(J.id!==void 0||J.ruleId!==void 0||J.stableId!==void 0)return J;let K=(Yq(J.code)?Q.get(Yq(J.code)):void 0)??I.get(TP(J));return K?{...J,stableId:K.stableId}:J})}}var Up=()=>{};var KP0,d84,KP1,p84;var zP0=o(()=>{W6();KP0=L.object({level:L.enum(["error","warning","info"]),code:L.string(),message:L.string(),snippet:L.string().optional(),suggestion:L.string().optional()}),d84=L.object({score:L.number().min(0).max(100),passed:L.boolean(),issues:L.array(KP0)}),KP1=L.object({ruleId:L.string().optional(),ruleCode:L.string().optional(),ruleName:L.string().optional(),score:L.number().min(0).max(100),passed:L.boolean(),issues:L.array(KP0),description:L.string().optional()}),p84=L.object({linter:L.string(),linterType:L.enum(["builtin","official","custom"]),totalRules:L.number(),healthyCount:L.number(),issueCount:L.number(),overallScore:L.number().min(0).max(100),passed:L.boolean(),issues:L.array(KP1)})});function qz($){let Y=($.description||"").trim(),U=[];if(Y.length<5)U.push({level:"error",code:"TOO_SHORT",message:"规则描述过于简短(少于 5 个字),大模型难以形成明确的判定逻辑",suggestion:"请补充具体的费用类型、核验条件与限制标准"});for(let G of zP1)if(Y.includes(G))U.push({level:"error",code:"VAGUE_WORD",snippet:G,message:`包含主观模糊词 "${G}",容易导致大模型判定标准产生波动与幻觉`,suggestion:`建议移除 "${G}",改为具体的金额上限、枚举范围或刚性判定条件`});let Q=GP1.find((G)=>Y.includes(G)),I=HP1.some((G)=>Y.includes(G));if(Q&&!I)U.push({level:"warning",code:"HANGING_EXCEPTION",snippet:Q,message:`包含例外条款 "${Q}",但未指定 AI 从何处核验该例外成立的依据`,suggestion:'建议补充明确的凭据来源(例如:"需在【单据备注】中说明原因" 或 "需在【附件】中上传审批截图")'});let J=U.filter((G)=>G.level==="error").length,K=U.filter((G)=>G.level==="warning").length;return{score:Math.max(0,100-J*25-K*10),passed:J===0,issues:U}}var zP1,GP1,HP1;var Qp=o(()=>{zP1=["原则上","尽量","适当","酌情","一般情况下","尽可能","合理控制","视情况","视具体情况"],GP1=["除非","特殊情况","特殊原因","经批准","经审批","经领导同意","除外","例外"],HP1=["备注","说明","附件","证明","邮件","截图","凭证","审批","单据","发票"]});function GP0($){let Y=($.description||"").trim(),U=[];if(Y.length<5)U.push({level:"error",code:"TOO_SHORT",message:"规则描述过于简短(少于 5 个字),大模型难以形成明确的判定逻辑",suggestion:"请补充具体的费用类型、核验条件与限制标准"});else if(Y.length<10)U.push({level:"warning",code:"SHORT_DESCRIPTION",message:"规则描述偏短(少于 10 个字),可能缺少适用的单据范围或执行细节",suggestion:"建议扩充核验场景、限制标准或异常处理方式"});for(let Z of WP1)if(Y.includes(Z))U.push({level:"error",code:"VAGUE_WORD",snippet:Z,message:`包含主观模糊词 "${Z}",在严格风控模式下容易引起审核判定分歧`,suggestion:`请移除 "${Z}",明确量化标准或枚举具体允许的情形`});let Q=XP1.find((Z)=>Y.includes(Z)),I=ZP1.some((Z)=>Y.includes(Z));if(Q&&!I)U.push({level:"error",code:"HANGING_EXCEPTION",snippet:Q,message:`包含例外条款 "${Q}",但未指定 AI 从何处核验该例外成立的凭证依据`,suggestion:'严格模式要求必须补充明确的核验来源(如:"需在【单据备注】中说明原因" 或 "需在【附件】中提供审批截图")'});let J=/\d+/.test(Y),K=qP1.some((Z)=>Y.includes(Z));if(!J&&!K)U.push({level:"warning",code:"LACKS_EXPLICIT_CONSTRAINT",message:"规则缺乏明确的定量标准(如金额、天数、频次)或绝对刚性边界词(如不得、禁止、仅限)",suggestion:"建议设定具体数值阈值或明确的禁止/准入条件,以便大模型精确判定"});let z=/经(批准|审批|领导同意|领导签字)|审批通过/.test(Y),G=VP1.some((Z)=>Y.includes(Z));if(z&&!G)U.push({level:"warning",code:"AMBIGUOUS_APPROVER",message:"规则提及审批例外,但未明确指定具体的审批角色(如部门总监、直接上级、财务负责人)",suggestion:"建议明确审批人角色(例如:经【部门总监】批准,经【直接上级】邮件确认)"});let H=U.filter((Z)=>Z.level==="error").length,W=U.filter((Z)=>Z.level==="warning").length;return{score:Math.max(0,100-H*30-W*15),passed:H===0,issues:U}}var WP1,XP1,ZP1,qP1,VP1;var Ip=o(()=>{WP1=["原则上","尽量","适当","酌情","一般情况下","尽可能","合理控制","视情况","视
Line truncated
|
||||
↳ ${V}`,operator:J}}function uB0($){if(!$)return[];let Y=$.pending||[],U=String($.rawState||"").toUpperCase(),Q=String($.state||"").toUpperCase(),I=[];if(Y.length>0)for(let J of Y){let K=J.approver?.name||J.approver?.id||"待定",z=(J.name||$.currentNode||"").trim(),H=z?`${z}(${K})`:K,W=J.type?.toUpperCase()==="PAYING"||z.includes("支付")||U==="PAYING"||Q==="支付中"?"待支付":"待审批";I.push(`${H}: ${W}`)}else if($.currentNode?.trim()){let K=$.currentNode.includes("支付")||U==="PAYING"||Q==="支付中"?"待支付":"待审批";I.push(`${$.currentNode.trim()}: ${K}`)}return I}function BQ($,Y){let U=new Map;if(!$||$.length===0)return U;if(!Y){for(let q of $){let w=(q.result||{}).decision||q.aiDecision||"-";U.set(q.id,{recordId:q.id,sourceDocumentSN:q.sourceDocumentSN,taskMode:q.taskMode,aiDecision:fB0(typeof w==="string"?w:"-"),aiAction:"-",eHumanAction:"-",eHumanComment:"-",auditDrift:!1})}return U}let Q=[...$].sort((q,V)=>(Number(q.createdAt)||0)-(Number(V.createdAt)||0)),I=Y.history||[],J=String(Y.rawState||"").toUpperCase(),K=String(Y.state||"").toUpperCase(),z=J==="DRAFT"||J==="REVOKED"||J==="CANCELED"||J==="CANCELLED"||K==="草稿"||K==="已撤回"||K==="已取消",H=J==="REJECTED"||J==="TERMINATED"||K==="审批驳回"||K==="已驳回",G=!z&&!H&&(J==="PAID"||K==="已支付"||I.some((q)=>!q.isEbot&&(q.rawAction==="freeflow.pay"||q.action==="支付成功"||q.action==="支付完成"))),W=!z&&!H&&!G&&(J==="PAYING"||K==="支付中"||(Y.pending||[]).some((q)=>q.isCurrent&&(q.type?.toUpperCase()==="PAYING"||q.name?.includes("支付")))||Y.currentNode?.includes("支付")===!0),Z=G||!z&&!H&&!W&&(J==="COMPLETED"||J==="APPROVED"||K==="已完成"||K==="审批通过");for(let q=0;q<Q.length;q++){let V=Q[q];if(!V)continue;let w=Number(V.createdAt)||0,M=V.document||{},F=V.manualApprovalRecord||V.result?.manualApprovalRecord||M.manualApprovalRecord||{},D=typeof V.sourceExtendData?.nodeId==="string"?String(V.sourceExtendData.nodeId):void 0,O=typeof F.nodeId==="string"?String(F.nodeId):void 0,N=O?decodeURIComponent(O).replace(/^hcnode_/,"").replace(/_r\d+$/,""):void 0,B=D||N,A=B?I.find((N0)=>N0.nodeId&&(N0.nodeId===B||B.includes(N0.nodeId))):void 0,P=A?.time??w,j=Q[q+1],C=j?Number(j.createdAt)||1/0:1/0,u=q===Q.length-1,x=I.find((N0)=>(N0.time??0)>P+5000&&N0.isEbot&&(N0.nodeName?.includes("智能")||N0.nodeName?.includes("AI")||N0.action?.includes("智能")||N0.comment?.includes("AI")||N0.comment?.includes("approval-result"))&&!N0.nodeName?.includes("费用标准检查")&&!N0.nodeName?.includes("标准检查")&&!N0.nodeName?.includes("预算"));if(x){if(u=!1,(x.time??1/0)<C)C=x.time}let S=V.result||{},b=S.decision||V.aiDecision||"-",n=typeof b==="string"?b:"-",I0=n.toUpperCase(),k=I0==="REJECT"||I0==="驳回",m=I0==="APPROVE"||I0==="通过",e=I0==="EXEMPT_APPROVE"||I0==="免审通过"||I0==="备注通过",Y0=V.taskMode||V.finalExecutionMode||"",d=String(Y0).toLowerCase().includes("auto")||V.finalExecutionMode==="automatic"||Y0==="automatic"||Y0==="fully_automatic",U0="-";if(m||e)U0="添加评论";else if(k)U0=d?"驳回":"添加评论";else if(I0==="REVIEW"||I0==="转交复核")U0="转交复核";let y=typeof F.status==="object"&&F.status!==null?String(F.status.type||F.status.label||"").toUpperCase():"",i=typeof F.status==="object"&&F.status!==null?String(F.status.sourceStatus||""):"",$0=M.manualApprovalStatus||S.manualApprovalStatus||V.manualApprovalStatus,V0=typeof $0==="string"?$0.toUpperCase():"",E0=V0==="CANCELLED"||V0==="CANCELED"||V0==="已取消"||V0==="已撤回"||V0==="REVOKED"||y==="CANCELLED"||y==="CANCELED"||i.includes("撤回")||i.includes("取消"),P0=V0==="APPROVED"||V0==="已支付/审批完成"||V0==="已通过"||V0==="已完成"||V0==="已支付"||y==="APPROVED",r0=!(i.includes("补偿")||i.includes("已支付"))&&(V0==="TERMINATED"||V0==="REJECTED"||V0==="REJECT"||V0==="已驳回"||V0==="被驳回"||y==="TERMINATED"||y==="REJECTED"||y==="已驳回"||y==="被驳回"),X1=A?1000:60000,t=I.filter((N0)=>{let a=N0.time??0;return a>=P-X1&&a<C}),G0="-",O0="-",u0=!1,b0,n0,O1=m||e,r1=I.filter((N0)=>(N0.time??0)>P+5000),c1=r1.some((N0)=>N0.rawAction==="freeflow.retract"||N0.action==="单据撤回"),C1=r1.some((N0)=>N0.rawAction==="freeflow.submit"||N0.action==="提交送审");if(O1&&u&&(c1||C1))u0=!0,b0="AI通过后单据发生撤回/修改重提,后续未经AI复审";if(d&&k)G0="无操作",O0="-";else{let N0=t.filter((v)=>(v.time??0)>=P-1000&&!v.isEbot&&v.rawAction!=="freeflow.submit"&&v.action!=="提交送审"&&!((v.rawAction==="freeflow.comment"||v.action==="发表评论")&&!v.comment)&&!((v.rawAction==="freeflow.print"||v.action==="打印提醒")&&!v.comment)&&!(v.rawAction==="freeflow.carbonCopy"||v.rawAction==="freeflow.cc"||v.action==="抄送通知")),a=N0.find((v)=>v.rawAction==="freeflow.retract"||v.action==="单据撤回"),T=N0.find((v)=>v.rawAction==="freeflow.reject"||v.action==="审批驳回");if(!u)if(T||!Y&&r0){G0="审批驳回",u0=!1,b0=void 0;let v=$d(T,void 0,F,I,Y);O0=v.commen
Line truncated
|
||||
`):[]}function QA1($,Y){let U=Array.from({length:$.length+1},()=>Array(Y.length+1).fill(0));for(let K=$.length-1;K>=0;K-=1)for(let z=Y.length-1;z>=0;z-=1)U[K][z]=$[K]===Y[z]?U[K+1][z+1]+1:Math.max(U[K+1][z],U[K][z+1]);let Q=[],I=0,J=0;while(I<$.length&&J<Y.length)if($[I]===Y[J])Q.push(` ${$[I]}`),I+=1,J+=1;else if(U[I+1][J]>=U[I][J+1])Q.push(`-${$[I++]}`);else Q.push(`+${Y[J++]}`);while(I<$.length)Q.push(`-${$[I++]}`);while(J<Y.length)Q.push(`+${Y[J++]}`);return Q}function IA1($,Y,U,Q,I,J){let K=QA0(Q,J),z=QA0(I,J),H=Q?`a/rules/${$}`:"/dev/null",G=I?`b/rules/${$}`:"/dev/null";return[`diff --git a/rules/${$} b/rules/${$}`,`--- ${H} v${Y.versionNumber}`,`+++ ${G} v${U.versionNumber}`,`@@ -${K.length?1:0},${K.length} +${z.length?1:0},${z.length} @@`,...QA1(K,z)].join(`
|
||||
`)}function IA0($){return{id:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedAt:$.publishedAt}}function JA0($,Y){let U=new Map;for(let Q of $.rules){let I=Yq(Q),J=Y==="stable-id"?zA0(I):Uq(I.code??I.ruleCode);if(!J)throw Error(`Rule version ${$.versionNumber} contains a rule without a ${Y==="stable-id"?"stable rule ID":"code"}.`);if(U.has(J))throw Error(`Rule version ${$.versionNumber} contains duplicate ${Y==="stable-id"?"stable rule ID":"code"}: ${J}`);U.set(J,I)}return U}function JA1($,Y,U){if(U!=="auto")return U;if([...$.rules,...Y.rules].every((J)=>Boolean(zA0(J))))return"stable-id";if([...$.rules,...Y.rules].every((J)=>Boolean(Uq(Yq(J).code??Yq(J).ruleCode))))return"code";throw Error("Rule snapshots have neither a complete stable-ID mapping nor a complete code mapping.")}function HA0($,Y,U={}){let Q=JA1($,Y,U.identityMode??"auto"),I=JA0($,Q),J=JA0(Y,Q),K=[...new Set([...I.keys(),...J.keys()])],z=[],H={added:0,removed:0,modified:0,unchanged:0},G=IA0($),W=IA0(Y);for(let Z of K){let q=I.get(Z),V=J.get(Z),w=q?AQ(q,Q):void 0,M=V?AQ(V,Q):void 0,F=!q?"added":!V?"removed":JSON.stringify(w)!==JSON.stringify(M)?"modified":"unchanged";if(H[F]+=1,F==="unchanged"&&!U.includeUnchanged)continue;let D=F==="modified"?[...new Set([...Object.keys(w??{}),...Object.keys(M??{})])].filter((O)=>JSON.stringify(w?.[O])!==JSON.stringify(M?.[O])):void 0;z.push({status:F,ruleId:Z,identityMode:Q,...q?{before:q}:{},...V?{after:V}:{},...D?.length?{changedFields:D}:{},...F!=="unchanged"?{diff:IA1(Z,G,W,q,V,Q)}:{}})}let X={from:G,to:W,identityMode:Q,counts:H,changes:z,unifiedDiff:z.filter((Z)=>Z.diff).map((Z)=>Z.diff).join(`
|
||||
`)};if(Q==="code"){let Z=K.filter((B)=>I.has(B)&&J.has(B)).length,q=K.filter((B)=>I.has(B)&&J.has(B)&&JSON.stringify(AQ(I.get(B),"code"))===JSON.stringify(AQ(J.get(B),"code"))).length,V=I.size,w=J.size,M=Math.min(V,w)?Z/Math.min(V,w):1,F=new Map;for(let[B,A]of I)F.set(JSON.stringify(AQ(A,"code")),B);let D=0;for(let[B,A]of J){let P=F.get(JSON.stringify(AQ(A,"code")));if(P&&P!==B)D+=1}let N=(Math.min(V,w)?q/Math.min(V,w):1)>=0.5?"high":q>0||D>0?"ambiguous":"low";X.codeStats={oldCount:V,newCount:w,sameCodeCount:Z,sameCodeUnchanged:q,sameBodyDifferentCode:D,overlapRatio:M,confidence:N,warning:"Published snapshots do not carry stable IDs; code matching can report reorderings as remove/add or modified rules."}}return X}function Kd($,Y=20000,U=!1){if(U||$.unifiedDiff.length<=Y)return{...$,truncation:{truncated:!1,maxChars:Y,omittedChars:0,hint:"Use --full only when the complete diff is required."}};let Q=$.unifiedDiff.length-Y,I=`
|
||||
... [diff truncated: ${Q} characters omitted; rerun with --full for the complete diff]`,J=$.changes.map(({before:K,after:z,diff:H,...G})=>({...G,...H?{diff:H.length>Y?`${H.slice(0,Y)}${I}`:H}:{}}));return{...$,changes:J,unifiedDiff:`${$.unifiedDiff.slice(0,Y)}${I}`,truncation:{truncated:!0,maxChars:Y,omittedChars:Q,hint:"Use --full for the complete diff."}}}var KA0,UA1;var GA0=o(()=>{KA0=["id","ruleId","stableId"],UA1=new Set([...KA0,"runtimeRuleId","runtimeId","tenantId","createdAt","updatedAt","versionId","versionNumber"])});import{existsSync as KA1,mkdirSync as zA1,readFileSync as HA1,renameSync as GA1,writeFileSync as WA1}from"node:fs";import{homedir as XA1}from"node:os";import{join as WA0}from"node:path";function Qq($){if($===void 0||$===null)return;let Y=String($).trim().toLowerCase().replace(/^rule[-_:]?/,"").replace(/^#/,"");if(!Y)return;return/^\d+$/.test(Y)?String(Number(Y)):Y}function _A($){return JSON.stringify([$.description??"",$.scope??"",$.strictness??""])}function XA0(){return process.env.SEAL_USE_RULE_VERSION_SNAPSHOTS_DIR?.trim()||WA0(XA1(),".config","seal-use","rule-version-snapshots")}function ZA1($){return $.replace(/[^a-zA-Z0-9._-]/g,"_")}function ZA0($,Y){return WA0(XA0(),`${ZA1($)}-v${Y}.json`)}function Iq($,Y,U){let Q=new Map,I=new Map;for(let W of U){let X=Qq(W.code);if(X)Q.set(X,[...Q.get(X)??[],W]);let Z=_A(W);I.set(Z,[...I.get(Z)??[],W])}let J=[];for(let W of Y.rules??[]){let X=Qq(W.code),Z=X?Q.get(X)??[]:[],q=I.get(_A(W))??[],V=Z.length===1?Z[0]:q.length===1?q[0]:void 0;if(!V)continue;J.push({stableId:V.id,...W.code!==void 0?{code:W.code}:{},description:W.description,scope:W.scope,strictness:W.strictness})}let K={corpId:$,versionId:Y.id,versionNumber:Y.versionNumber,capturedAt:N1(),rules:J},z=XA0();zA1(z,{recursive:!0,mode:448});let H=ZA0($,Y.versionNumber),G=`${H}.${process.pid}.tmp`;return WA1(G,`${JSON.stringify(K,null,2)}
|
||||
`,{encoding:"utf8",mode:384}),GA1(G,H),H}function qA1($,Y){let U=ZA0($,Y.versionNumber);if(!KA1(U))return null;try{return JSON.parse(HA1(U,"utf8"))}catch{return null}}function vA($,Y){let U=qA1($,Y);if(!U?.rules.length)return Y;let Q=new Map(U.rules.flatMap((J)=>{let K=Qq(J.code);return K?[[K,J]]:[]})),I=new Map(U.rules.map((J)=>[_A(J),J]));return{...Y,rules:Y.rules.map((J)=>{if(J.id!==void 0||J.ruleId!==void 0||J.stableId!==void 0)return J;let K=(Qq(J.code)?Q.get(Qq(J.code)):void 0)??I.get(_A(J));return K?{...J,stableId:K.stableId}:J})}}var zd=()=>{};var qA0,c$4,VA1,n$4;var VA0=o(()=>{Z6();qA0=L.object({level:L.enum(["error","warning","info"]),code:L.string(),message:L.string(),snippet:L.string().optional(),suggestion:L.string().optional()}),c$4=L.object({score:L.number().min(0).max(100),passed:L.boolean(),issues:L.array(qA0)}),VA1=L.object({ruleId:L.string().optional(),ruleCode:L.string().optional(),ruleName:L.string().optional(),score:L.number().min(0).max(100),passed:L.boolean(),issues:L.array(qA0),description:L.string().optional()}),n$4=L.object({linter:L.string(),linterType:L.enum(["builtin","official","custom"]),totalRules:L.number(),healthyCount:L.number(),issueCount:L.number(),overallScore:L.number().min(0).max(100),passed:L.boolean(),issues:L.array(VA1)})});function wz($){let Y=($.description||"").trim(),U=[];if(Y.length<5)U.push({level:"error",code:"TOO_SHORT",message:"规则描述过于简短(少于 5 个字),大模型难以形成明确的判定逻辑",suggestion:"请补充具体的费用类型、核验条件与限制标准"});for(let H of LA1)if(Y.includes(H))U.push({level:"error",code:"VAGUE_WORD",snippet:H,message:`包含主观模糊词 "${H}",容易导致大模型判定标准产生波动与幻觉`,suggestion:`建议移除 "${H}",改为具体的金额上限、枚举范围或刚性判定条件`});let Q=wA1.find((H)=>Y.includes(H)),I=FA1.some((H)=>Y.includes(H));if(Q&&!I)U.push({level:"warning",code:"HANGING_EXCEPTION",snippet:Q,message:`包含例外条款 "${Q}",但未指定 AI 从何处核验该例外成立的依据`,suggestion:'建议补充明确的凭据来源(例如:"需在【单据备注】中说明原因" 或 "需在【附件】中上传审批截图")'});let J=U.filter((H)=>H.level==="error").length,K=U.filter((H)=>H.level==="warning").length;return{score:Math.max(0,100-J*25-K*10),passed:J===0,issues:U}}var LA1,wA1,FA1;var Hd=o(()=>{LA1=["原则上","尽量","适当","酌情","一般情况下","尽可能","合理控制","视情况","视具体情况"],wA1=["除非","特殊情况","特殊原因","经批准","经审批","经领导同意","除外","例外"],FA1=["备注","说明","附件","证明","邮件","截图","凭证","审批","单据","发票"]});function LA0($){let Y=($.description||"").trim(),U=[];if(Y.length<5)U.push({level:"error",code:"TOO_SHORT",message:"规则描述过于简短(少于 5 个字),大模型难以形成明确的判定逻辑",suggestion:"请补充具体的费用类型、核验条件与限制标准"});else if(Y.length<10)U.push({level:"warning",code:"SHORT_DESCRIPTION",message:"规则描述偏短(少于 10 个字),可能缺少适用的单据范围或执行细节",suggestion:"建议扩充核验场景、限制标准或异常处理方式"});for(let Z of MA1)if(Y.includes(Z))U.push({level:"error",code:"VAGUE_WORD",snippet:Z,message:`包含主观模糊词 "${Z}",在严格风控模式下容易引起审核判定分歧`,suggestion:`请移除 "${Z}",明确量化标准或枚举具体允许的情形`});let Q=OA1.find((Z)=>Y.includes(Z)),I=DA1.some((Z)=>Y.includes(Z));if(Q&&!I)U.push({level:"error",code:"HANGING_EXCEPTION",snippet:Q,message:`包含例外条款 "${Q}",但未指定 AI 从何处核验该例外成立的凭证依据`,suggestion:'严格模式要求必须补充明确的核验来源(如:"需在【单据备注】中说明原因" 或 "需在【附件】中提供审批截图")'});let J=/\d+/.test(Y),K=NA1.some((Z)=>Y.includes(Z));if(!J&&!K)U.push({level:"warning",code:"LACKS_EXPLICIT_CONSTRAINT",message:"规则缺乏明确的定量标准(如金额、天数、频次)或绝对刚性边界词(如不得、禁止、仅限)",suggestion:"建议设定具体数值阈值或明确的禁止/准入条件,以便大模型精确判定"});let z=/经(批准|审批|领导同意|领导签字)|审批通过/.test(Y),H=PA1.some((Z)=>Y.includes(Z));if(z&&!H)U.push({level:"warning",code:"AMBIGUOUS_APPROVER",message:"规则提及审批例外,但未明确指定具体的审批角色(如部门总监、直接上级、财务负责人)",suggestion:"建议明确审批人角色(例如:经【部门总监】批准,经【直接上级】邮件确认)"});let G=U.filter((Z)=>Z.level==="error").length,W=U.filter((Z)=>Z.level==="warning").length;return{score:Math.max(0,100-G*30-W*15),passed:G===0,issues:U}}var MA1,OA1,DA1,NA1,PA1;var Gd=o(()=>{MA1=["原则上","尽量","适当","酌情","一般情况下","尽可能","合理控制","视情况","视
Line truncated
|
||||
* ==============================================================================
|
||||
* Seal 官方标准规则校验器 (Official Standard Rule Linter)
|
||||
* ==============================================================================
|
||||
@@ -881,85 +886,49 @@ export function lintRule(rule: RuleLintTarget): RuleLintResult {
|
||||
}
|
||||
|
||||
export default lintRule;
|
||||
`}});import{homedir as NP1}from"node:os";import{join as Gp}from"node:path";var DP1,E$,j$;var Hp=o(()=>{DP1=Gp(NP1(),".config","seal-use"),E$=Gp(DP1,"linters"),j$=Gp(E$,"official")});import{existsSync as TQ,mkdirSync as AP1,readFileSync as BP1,readdirSync as ZP0,rmSync as PP1,unlinkSync as TP1,writeFileSync as EP1}from"node:fs";import{isAbsolute as jP1,join as E8,resolve as CP1}from"node:path";import{pathToFileURL as WP0}from"node:url";function qP0($=j$){let Y=[],U=[];try{if(!TQ($))AP1($,{recursive:!0});let Q=Object.keys(Kp);for(let[J,K]of Object.entries(Kp)){let z=E8($,J),G=!0;if(TQ(z))try{if(BP1(z,"utf8")===K)G=!1}catch{G=!0}if(G)EP1(z,K,"utf8");Y.push(J)}let I=ZP0($,{withFileTypes:!0});for(let J of I)if(!Q.includes(J.name)){let K=E8($,J.name);try{if(J.isDirectory())PP1(K,{recursive:!0,force:!0});else TP1(K);U.push(J.name)}catch{}}}catch{}return{synced:Y,pruned:U}}function VP0($={syncOfficial:!0}){if($.syncOfficial!==!1)qP0();let Y=[{name:"builtin",type:"builtin",path:E8(j$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:E8(j$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:E8(j$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],U=[E$,jP];for(let Q of U)if(TQ(Q))try{let I=ZP0(Q,{withFileTypes:!0});for(let J of I){if(J.isDirectory())continue;let K=J.name;if(K.endsWith(".ts")||K.endsWith(".js")||K.endsWith(".mjs")){let z=K.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===z))Y.push({name:z,type:"custom",path:E8(Q,K),description:`用户自定义规则校验器 (${K})`})}}}catch{}return Y}function RP1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:E8(j$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:E8(j$,"strict.ts"),isOfficial:!0,officialKind:"strict"};if(Y==="hlab"||Y==="hlab-sop"||Y==="hlab-rules"||Y==="hlab-standard"||Y==="official/hlab"||Y==="official/hlab.ts")return{path:E8(j$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(jP1(Y)||Y.startsWith("./")||Y.startsWith("../")){let Q=CP1(Y);if(TQ(Q))return{path:Q};for(let I of[".ts",".js",".mjs"])if(TQ(`${Q}${I}`))return{path:`${Q}${I}`}}let U=[E8(E$,`${Y}.ts`),E8(E$,`${Y}.js`),E8(E$,`${Y}.mjs`),E8(jP,`${Y}.ts`),E8(jP,`${Y}.js`),E8(jP,`${Y}.mjs`)];for(let Q of U)if(TQ(Q))return{path:Q};return{}}async function Wp($){qP0();let Y=RP1($??"builtin");if(Y.isOfficial){let Q=Y.officialKind==="strict"?GP0:Y.officialKind==="hlab"?HP0:qz,I=Y.officialKind==="builtin"?"builtin":"official",J=Y.path;if(J&&TQ(J))try{let z=await import(WP0(J).href),G=z.default??z.lintRule??z.linter??z.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:I,filePath:J,linter:XP0(G,Q)}}catch{}return{name:Y.officialKind??"builtin",type:I,filePath:J,linter:Q}}let U=Y.path;if(!U)return console.error(`⚠️ [linter] 未找到自定义校验器 "${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:qz};try{let I=await import(WP0(U).href),J=I.default??I.lintRule??I.linter??I.lint;if(typeof J!=="function")return console.error(`⚠️ [linter] 自定义校验器 "${U}" 未导出标准函数 (default / lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:qz};return{name:$??"custom",type:"custom",filePath:U,linter:XP0(J,qz)}}catch(Q){return console.error(`⚠️ [linter] 加载自定义校验器脚本 "${U}" 失败(语法错误或依赖缺失: ${Q?.message??Q}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:qz}}}function XP0($,Y){return async(U,Q)=>{try{let I=await $(U,Q);if(I&&typeof I==="object"&&typeof I.score==="number"&&Array.isArray(I.issues))return I;return console.error("⚠️ [linter] 自定义校验器返回值格式不符合 RuleLintResult 契约,已回退至内置结果。"),Y(U,Q)}catch(I){return console.error("⚠️ [linter] 自定义校验器执行异常:",I),Y(U,Q)}}}var jP;var LP0=o(()=>{Hp();Qp();Jp();zp();Ip();jP=E8(process.cwd(),"linters")});async function Xp($,Y,U){let Q=await Y.linter($,U);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:Q.score,passed:Q.passed,issues:Q.issues,description:$.description}}async function FP0($,Y,U,Q){let I=Q?.minScore??0,J=Q?.level??"all",K=[],z=0;for(let q of $){let V=await Xp(q,Y,U);z+=V.score;let w=V.issues;if(J==="error")w=V.issues.filter((F)=>F.level==="error");else if(J==="warning")w=V.issues.filter((F)=>F.level==="warning"||F.level==="error");let M=w.every((F)=>F.level!=="error");if(Q?.summary){if(w.length>0)K.push({...V,passed:M,issues:w})}else K.push({...V,passed:M,issues:w})}let G=$.length,H=G===Line truncated
|
||||
`,"utf8"),U}function DP0($){return $.map((Y,U)=>{let Q=OP0(Y.code),I;if(Q!==void 0)I=String(Q).padStart(4,"0");else if(typeof Y.code==="string"&&Y.code.trim())I=Y.code.trim().replace(/^#/,"");else I=String(U).padStart(4,"0");return{id:Y.id,code:I,name:Y.name,description:Y.description,scope:Y.scope,strictness:Y.strictness}})}var AP0=()=>{};var S$4,h$4,BP0,g$4,kP1,y$4,k$4,PP0,x$4,f$4,TP0,u$4,b$4,i$4,c$4,n$4,d$4,p$4,m$4,l$4,o$4,r$4,s$4,t$4,a$4,e$4,$54,Y54,U54,Q54,I54,J54,K54,z54,G54,H54,W54,Vp,xP1,fP1,uP1,l3,Vz,X54,Z54,CP,q54,V54,L54,F54,w54,M54,O54,bP1,Lp,N54,D54,A54,B54,P54,T54,E54,j54,C54,R54,_54,v54,S54,h54,g54,y54,k54,x54,EP0;var jP0=o(()=>{W6();X4();a$();rB0();UP0();Up();Zp();AP0();$5();({presentWebhookIntegration:S$4,getConfiguredSealBaseUrl:h$4,projectApprovalRules:BP0,pickRuleFields:g$4,buildRulePushPlan:kP1,rulesHaveSameContent:y$4,ruleChangedFields:k$4,normalizeRuleStrictness:PP0,parseDurationMs:x$4,redactIntegrationSecrets:f$4,mutationPreview:TP0,redactPreviewValue:u$4,buildSimulationBatchParams:b$4,summarizeSimulationBatch:i$4,summarizeApprovalRun:c$4,summarizeApprovalRuns:n$4,parseFieldPaths:d$4,pickRunFields:p$4,approvalRunMetadata:m$4,summarizeApprovalRunDetail:l$4,summarizeApprovalRunResult:o$4,summarizeApprovalRunDocument:r$4,extractCitedRules:s$4,firstPath:t$4,countPathCandidates:a$4,getPath:e$4,setPath:$54,compactObject:Y54,asRecord:U54,numberFromUnknown:Q54,flattenDocumentFields:I54,collectDocumentFields:J54,firstByLabel:K54,collectInvoiceSummary:z54,collectInvoiceObjects:G54,findKeywordLines:H54,summarizeRunBridge:W54,summarizeRuleVersion:Vp,resolveRuleVersionForLookup:xP1,findRuleInDraft:fP1,findRuleInVersion:uP1,parseRuleCodeNumber:l3,normalizeRuleCode:Vz,runtimeRuleIndex:X54,runtimeRuleIdToCode:Z54,formatRuleCode:CP,pickApprovalRunCandidate:q54,resolveApprovalRunForUrl:V54,resolveSealBaseUrl:L54,normalizeUrl:F54,stringFromUnknown:w54,pickApprovalRuns:M54,timestampOf:O54,resolveRuleVersion:bP1,resolveRuleVersionSelector:Lp,filterRuns:N54,scalarIncludes:D54,objectContainsScalar:A54,filterRunsByHumanResult:B54,withApprovalRunFilters:P54,resolveManualApprovalStatus:T54,prepareApprovalRuns:E54,approvalRunAliases:j54,extractHumanResult:C54,findHumanResultValue:R54,isHumanResultKey:_54,stringifyHumanResultValue:v54,matchesRunLookup:S54,countBy:h54,localDateKey:g54,formatLocalDateTime:y54,toDate:k54,localParts:x54}=H8),EP0=[{name:"seal_approval_rules_list",description:"列出 Seal 审批规则(默认当前草稿,传 version='latest' 或版本号则列出对应已发布版本);支持 countOnly、fields、limit",parameters:L.object({version:L.string().optional().describe("可选发布版本号或 'latest';不传则读取当前草稿"),countOnly:L.boolean().optional().describe("只返回规则数量,不返回规则列表"),fields:L.array(L.enum(["id","code","tenantId","status","strictness","scope","createdAt","updatedAt","description"])).optional().describe("只返回指定字段;不传则返回完整规则"),limit:L.number().int().nonnegative().optional().describe("最多返回多少条规则;0 可配合 fields 或 countOnly 只取数量"),offset:L.number().int().nonnegative().optional().describe("跳过前多少条规则")}),handler:async($,Y)=>{if(Y.version){let Q=await Lp($,Y.version),I=(Q.rules??[]).map((K)=>({id:K.id??String(K.code),tenantId:K.tenantId??"",code:l3(K.code)??K.code,description:K.description,scope:K.scope,strictness:K.strictness,status:typeof K.status==="string"?K.status:"published",createdAt:K.createdAt??Q.publishedAt??Q.createdAt??0,updatedAt:K.updatedAt??Q.publishedAt??Q.createdAt??0}));return{...BP0({rules:I,hasPendingDeletes:!1},Y),versionNumber:Q.versionNumber,versionName:Q.versionName??null}}let U=await Q6($);return BP0(U,Y)}},{name:"seal_approval_rules_clear",description:"清空 Seal 当前草稿审批规则;用于测试环境导入规则前重置草稿规则集",parameters:L.object({dryRun:L.boolean().optional().describe("只预览将删除的规则数量,不执行删除"),recode:L.boolean().optional().describe("删除后尝试重新编排规则编号;失败会作为 warning 返回")}),handler:async($,Y,U)=>{let Q=await Q6($);if(Y.dryRun)return{...TP0(U,"api/v1/rules",Q.rules,[],Q.rules.length),corpId:U.corp.id,corpName:U.corp.name,dryRun:!0,beforeCount:Q.rules.length,deleted:0,afterCount:Q.rules.length,hasPendingDeletes:Q.hasPendingDeletes};let I=[],J=0;for(let H of Q.rules)try{await zJ($,H.id),J+=1}catch(W){I.push({ruleId:H.id,error:t8(W instanceof Error?W.message:String(W))})}let K=[],z;if(J>0&&Y.recode!==!1){if(z=await fM($),z&&typeof z==="object"&&"ok"in z&&z.ok!==!0)K.push("batch-recode did not complete; current rules were still deleted")}let G=await Q6($);return{corpId:U.corp.id,corpName:U.corp.name,dryRun:!1,beforeCount:Q.rules.length,deleted:J,failed:I,afterCount:G.rules.length,hasPendingDeletes:G.hasPendingDeletes,warnings:K,recode:z}}},{name:"seal_approval_rule_create",description:"新建 Seal 草稿审批规则",parameters:L.object({
Line truncated
|
||||
`)},{...Yp(J,20000,Y.full===!0),format:Y.format??"unified"}}},{name:"seal_approval_rule_version_publish",description:"发布 Seal 草稿审批规则为新版本",parameters:L.object({versionName:L.string().describe("版本名称")}),handler:async($,Y,U)=>{let Q=await Q6($).catch(()=>{return}),I=await oH($,Y.versionName);if(Q)try{Uq(U.corp.id,I.version,Q.rules)}catch{}return I}},{name:"seal_approval_rule_get",description:"按规则编号 code(或规则 ID)获取单条规则详情;默认读取当前草稿(含规则 ID),指定 version 或 recordId 时读取对应发布版本快照",parameters:L.object({versionId:L.string().optional().describe("规则版本 ID"),versionNumber:L.number().int().positive().optional().describe("规则版本号"),latest:L.boolean().optional().describe("为 true 时取最新已发布版本"),code:L.string().optional().describe("规则编号(如 0025)"),runtimeId:L.string().optional().describe("规则编号兼容别名"),ruleId:L.string().optional().describe("规则 ID 兼容别名"),recordId:L.string().optional().describe("从审批运行记录推断所使用的已发布版本")}),handler:async($,Y,U)=>{let Q={code:Y.code,runtimeId:Y.runtimeId,ruleId:Y.ruleId},I=Boolean(Y.versionId||Y.versionNumber||Y.latest||Y.recordId),J=await Q6($).catch(()=>{return});if(!I&&J?.rules){let H=fP1(J.rules,Q);if(H)return H}let K=await xP1($,Y).catch((H)=>{if(!I&&J?.rules)throw Error(`Rule not found in current draft: ${Y.code??Y.runtimeId??Y.ruleId??""}`);throw H}),z=U?.corp?.id?EP(U.corp.id,K):K,G=uP1(z,Q,J?.rules);if(!G)throw Error(I?`Rule not found in version ${z.versionNumber}`:`Rule not found in current draft or version ${z.versionNumber}`);return G}},{name:"seal_approval_rules_lint",description:"对 Seal 本地规则文件、草稿审批规则或指定发布版本规则进行质量与可执行性检查(模糊词、悬空例外检测)",parameters:L.object({file:L.string().optional().describe("指定本地规则文件路径进行离线质检(支持 .json),0网络请求、不污染远端草稿"),linter:L.string().optional().describe("指定使用的校验器名称或脚本路径(如 builtin、strict、./my-linter.ts)"),version:L.string().optional().describe("指定要质检的历史发布版本号或 ID(如 16 或 latest),不传默认质检当前草稿"),code:L.string().optional().describe("按规则编号过滤(如 25)"),ruleId:L.string().optional().describe("按规则 ID 过滤"),minScore:L.number().optional().describe("最低合格质量分阈值(0~100),低于该分值抛出错误以返回非零退出码"),level:L.enum(["all","error","warning"]).default("all").describe("问题报告等级过滤"),summary:L.boolean().optional().describe("为 true 时仅返回存在瑕疵/扣分的规则")}),handler:async($,Y,U)=>{let Q=[],I;if(Y.file){let H=qp(Y.file);Q=DP0(H.rules),I=H.meta.versionNumber}else if(Y.version){let H=await y8($),W=Number(Y.version),X=isNaN(W)?Y.version==="latest"?H[0]:H.find((Z)=>Z.id===Y.version):H.find((Z)=>Z.versionNumber===W);if(!X)throw Error(`未找到指定的规则版本: ${Y.version}`);I=X.versionNumber,Q=(X.rules??[]).map((Z,q)=>({id:Z.id??Z.runtimeId,code:Vz(Z.code)??CP(q),name:Z.name??Z.title,description:Z.description??"",scope:Z.scope,strictness:Z.strictness}))}else Q=((await Q6($)).rules??[]).map((W,X)=>({id:W.id,code:Vz(W.code)??CP(X),name:W.name??W.title,description:W.description??"",scope:W.scope,strictness:W.strictness}));if(Y.code){let H=Vz(Y.code);Q=Q.filter((W)=>Vz(W.code)===H)}if(Y.ruleId){let H=Vz(Y.ruleId);Q=Q.filter((W)=>W.id===Y.ruleId||H!==void 0&&Vz(W.code)===H)}let J=T4(),K=Y.linter??J.lint?.activeLinter??"builtin",z=await Wp(K),G=await FP0(Q,z,{corpId:U?.corp?.id,versionNumber:I,allRules:Q},{minScore:Y.minScore,level:Y.level,summary:Y.summary});if(Y.minScore&&G.overallScore<Y.minScore)throw Error(`[Linter 质量门禁未通过] 综合评分 ${G.overallScore} 低于要求的最低分 ${Y.minScore} 分 (共发现 ${G.issueCount} 条问题规则)。`);return G}},{name:"seal_approval_rules_pull",description:"从 Seal 远端拉取草稿或指定版本规则,保存至本地规则文件(支持离线编辑与本地 Lint,绝不污染远端草稿)",parameters:L.object({version:L.string().optional().describe("指定拉取的历史发布版本号或 ID(如 16 或 latest),不传默认拉取当前草稿规则"),out:L.string().optional().describe("保存的目标本地文件路径,默认为 ./rules.local.json")}),handler:async($,Y,U)=>{let Q=Y.out??"./rules.local.json",I=[],J="draft",K;if(Y.version){let G=await y8($),H=Number(Y.version),W=isNaN(H)?Y.version==="latest"?G[0]:G.find((X)=>X.id===Y.version):G.find((X)=>X.versionNumber===H);if(!W)throw Error(`未找到指定的规则版本: ${Y.version}`);K=W.versionNumber,J=`version:${K}`,I=(W.rules??[]).map((X,Z)=>({code:l3(X.code)??Z,name:X.name??X.title,description:X.description??"",scope:X.scope??"ALL",strictness:X.strictness??"MUST_FOLLOW"}))}else I=((await
Line truncated
|
||||
\uD83D\uDC49 Next action: 若您已直接修改远端草稿、仅需发布正式版本,请执行 seal-use rules publish "${q}" --corp ${U.corp.id}`)}throw Z}let K=Y.confirm!==!0||Y.dryRun===!0,z=await Q6($),G=kP1(z.rules,I.rules);if(K)return{...TP0(U,"api/v1/rules",z.rules,I.rules.map((Z)=>({description:Z.description,scope:Z.scope??"ALL",strictness:Z.strictness??"MUST_FOLLOW"})),z.rules.length+I.rules.length),corpId:U.corp.id,dryRun:!0,localFile:I.resolvedPath,localRulesCount:I.rules.length,remoteDraftCount:z.rules.length,changes:G,impactCount:G.created.length+G.updated.length+G.deleted.length,preservedRuleIds:[...G.updated.map((Z)=>Z.id),...G.unchanged.map((Z)=>Z.id)],warning:"Incremental mode preserves matched rule IDs and does not recode the draft rule set.",willPublish:Boolean(Y.publish),message:"Preview mode. Use --yes or confirm=true to apply the listed incremental changes to the remote draft."};for(let Z of G.deleted)await zJ($,Z.id);let H=[];for(let Z of G.created){let q=await lH($,{description:Z.description,scope:Z.scope??"ALL",strictness:PP0(Z.strictness)});H.push({id:q.id,description:q.description,code:q.code})}let W=[];for(let Z of G.updated)await yg($,Z.id,{description:Z.rule.description,scope:Z.rule.scope??"ALL",strictness:PP0(Z.rule.strictness)}),W.push(Z.id);let X=void 0;if(Y.publish){let Z=A1().slice(0,10).replace(/-/g,""),q=Y.versionName||`v-local-${Z}-${Date.now().toString().slice(-4)}`;X=await oH($,q);try{let V=await Q6($);Uq(U.corp.id,X.version,V.rules)}catch{}}return{corpId:U.corp.id,dryRun:!1,localFile:I.resolvedPath,deletedRules:G.deleted.length,createdRules:H.length,updatedRules:W.length,unchangedRules:G.unchanged.length,preservedRuleIds:[...W,...G.unchanged.map((Z)=>Z.id)],recoded:!1,published:X??!1}}},{name:"seal_approval_documents_list",description:"列出 Seal 审批知识文档",parameters:L.object({scenarios:L.array(L.string()).optional().describe("场景过滤"),offset:L.number().int().nonnegative().optional(),limit:L.number().int().positive().optional()}),handler:async($,Y)=>YU($,Y)},{name:"seal_approval_document_get",description:"获取 Seal 审批知识文档详情",parameters:L.object({documentId:L.string().describe("文档 ID")}),handler:async($,Y)=>A40($,Y.documentId)},{name:"seal_approval_document_create",description:"新建 Seal 审批知识文档",parameters:L.object({title:L.string(),purpose:L.string(),content:L.string().describe("正文,通常为 Markdown"),contentType:L.string().optional(),status:L.string().optional(),enabled:L.boolean().optional(),scenarios:L.array(L.string()).optional(),tags:L.array(L.string()).optional()}),handler:async($,Y)=>uM($,Y)},{name:"seal_approval_document_update",description:"更新 Seal 审批知识文档",parameters:L.object({documentId:L.string(),title:L.string().optional(),purpose:L.string().optional(),content:L.string().optional(),contentType:L.string().optional(),status:L.string().optional(),enabled:L.boolean().optional(),scenarios:L.array(L.string()).optional(),tags:L.array(L.string()).optional()}),handler:async($,Y)=>{let{documentId:U,...Q}=Y;return bM($,U,Q)}},{name:"seal_approval_delete_document",description:"删除 Seal 审批知识文档",parameters:L.object({documentId:L.string().describe("知识文档 ID")}),handler:($,Y)=>iM($,Y.documentId)},{name:"seal_approval_search",description:"按关键词组检索 Seal 审批规则、审批文档和审批偏好配置,返回命中位置、字段、行号和前后三行上下文",parameters:L.object({keywords:L.array(L.string()).min(1).describe("关键词组"),matchMode:L.enum(["any","all"]).optional().describe("any 命中任一关键词,all 要求同一行命中全部关键词"),areas:L.array(L.enum(["rules","documents","preferences"])).optional().describe("检索范围"),caseSensitive:L.boolean().optional().describe("是否大小写敏感"),contextLines:L.number().int().nonnegative().optional().describe("返回命中行前后几行,默认 3"),documentLimit:L.number().int().positive().optional().describe("缓存刷新时最多拉取文档数,默认 100"),maxResults:L.number().int().positive().optional().describe("最多返回命中数,默认 50"),refresh:L.boolean().optional().describe("是否跳过 5 分钟内存缓存并强制刷新"),ruleVersionScope:L.enum(["current","all","version"]).optional().describe("规则检索范围,默认 current;all 会检索所有已发布历史版本"),ruleVersionId:L.string().optional().describe("ruleVersionScope=version 时指定版本 ID"),ruleVersionNumber:L.number().int().positive().optional().describe("ruleVersionScope=version 时指定版本号"),latestRuleVersion:L.boolean().optional().describe("ruleVersionScope=version 时取最新已发布版本"),snippetOnly:L.boolean().optional().describe("只返回命中行,不返回前后文"),maxChars:L.number().int().positive().optional().describe("每个文本片段最多返回字符数"),fields:L.array(L.string()).optional().describe("只搜索指定字段,如 history.descrip
Line truncated
|
||||
`+"为防止测试单据污染生产审批流,禁止向生产环境重放单据。请指定测试企业 (--target-corp <testCorpId>),或在确有需要时添加 --force。",1,`seal-use webhook replay --target-corp <testCorpId>${U.id!==Q.id?` --source-corp ${U.id}`:""}`);return{sourceCorp:U,targetCorp:Q}}async function Mp($,Y,U){let Q=Y.seal?.endpoints?.approvalStylePreferences??"api/v1/agent/ai-approval/config",I=await F$($,Q);if(U||I.length>0)return RP0(I,U,Y.id);if(Y.environment==="test"||Y.id.toLowerCase().includes("test")){console.error(`[webhook-replay] 测试企业「${Y.name}」未配置 Webhook 通道,正在自动创建「(Seal测-回放通道)」...`);let J=(Y.seal.url??Y.source?.sealUrl??`https://${Y.id.toLowerCase()}.sealai.cc`).replace(/\/+$/,"");return await cM($,J,{name:"(Seal测-回放通道)",mode:"assisted",outgoingResultWebhook:`${J}/api/v1/integrations/webhook/replay-mock-callback`},Y.seal.endpoints.approvalStylePreferences)}throw new G4(`当前租户「${Y.name}」未配置任何 Webhook 集成通道。`,1,`seal-use webhook add --name <name> --result-url <url> --corp ${Y.id}`)}async function Fz($){let{query:Y,sourceClient:U,targetClient:Q,sourceCorp:I,targetCorp:J,webhookSelector:K,snPrefix:z,snSuffix:G,docIdPrefix:H,docIdSuffix:W,dryRun:X,fetchFn:Z=fetch}=$,q=[];if(Y.recordId){let P=await W4(U,Y.recordId);q.push(P)}else if(Y.recordIds&&Y.recordIds.length>0)for(let P of Y.recordIds)q.push(await W4(U,P));else if(Y.sn){let T=(await u4(U,{search:Y.sn,sourceDocumentSN:Y.sn,limit:20})).records.find((A)=>A.sourceDocumentSN===Y.sn||A.sourceDocumentId===Y.sn||A.document?.sourceDocumentSN===Y.sn||A.document?.sn===Y.sn);if(!T)throw Error(`在企业「${I.name}」中未找到单据编号为「${Y.sn}」的审批记录。`);q.push(T)}else if(Y.sns&&Y.sns.length>0)for(let P of Y.sns){let A=(await u4(U,{search:P,sourceDocumentSN:P,limit:20})).records.find((E)=>E.sourceDocumentSN===P||E.sourceDocumentId===P||E.document?.sourceDocumentSN===P||E.document?.sn===P);if(!A)throw Error(`在企业「${I.name}」中未找到单据编号为「${P}」的审批记录。`);q.push(A)}else if(Y.limit!==void 0){let P=await u4(U,{limit:Y.limit,status:Y.status,startDate:Y.startDate,endDate:Y.endDate});if(!P.records.length)throw Error(`在企业「${I.name}」中未检索到符合条件的审批记录。`);q=P.records}else throw Error("Usage: seal-use webhook replay <recordId> [--sn <documentSN>] [--limit <n>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--dry-run]");let V=q.map((P)=>({run:P,doc:Fp(P,{snPrefix:z,snSuffix:G,docIdPrefix:H,docIdSuffix:W})}));if(X){let P={id:"preview-webhook",name:K??"预览目标通道",mode:"assisted",incomingDocumentWebhookUrl:`${J.seal.url}/api/v1/integrations/webhook/preview`};try{let E=await F$(Q,J.seal.endpoints.approvalStylePreferences);if(E.length>0){let C=RP0(E,K,J.id);P={id:C.id,name:C.name,mode:C.mode,incomingDocumentWebhookUrl:C.incomingDocumentWebhook.url}}}catch{}let T=V.map(({run:E,doc:C})=>({originalRecord:{id:E.id,sourceSystem:E.sourceSystem,sourceDocumentSN:E.sourceDocumentSN,sourceDocumentId:E.sourceDocumentId},document:C,success:!0})),A=T.length===1;return{dryRun:!0,success:!0,sourceCorp:{id:I.id,name:I.name,environment:I.environment},targetCorp:{id:J.id,name:J.name,environment:J.environment},targetWebhook:P,totalCount:T.length,successCount:T.length,failureCount:0,originalRecord:A?T[0].originalRecord:void 0,document:A?T[0].document:void 0,records:T}}let w=await Mp(Q,J,K),M={id:w.id,name:w.name,mode:w.mode,incomingDocumentWebhookUrl:w.incomingDocumentWebhook.url},F=[],N=0,O=0;for(let{run:P,doc:T}of V){console.error(`[webhook-replay] 正在向 Webhook 通道「${w.name}」推送单据: ${T.documentSN}...`);try{let A=await wp(w.incomingDocumentWebhook.url,w.secret,T,Z,j6(J.seal));F.push({originalRecord:{id:P.id,sourceSystem:P.sourceSystem,sourceDocumentSN:P.sourceDocumentSN,sourceDocumentId:P.sourceDocumentId},replayedDocument:{documentSN:T.documentSN,documentId:T.documentId,fieldCount:T.fields.length},pushResult:A,success:!0}),N+=1}catch(A){let E=A instanceof Error?A.message:String(A);F.push({originalRecord:{id:P.id,sourceSystem:P.sourceSystem,sourceDocumentSN:P.sourceDocumentSN,sourceDocumentId:P.sourceDocumentId},replayedDocument:{documentSN:T.documentSN,documentId:T.documentId,fieldCount:T.fields.length},error:E,success:!1}),O+=1}}let D=F.length===1;return{success:O===0,dryRun:!1,sourceCorp:{id:I.id,name:I.name,environment:I.environment},targetCorp:{id:J.id,name:J.name,environment:J.environment},targetWebhook:M,totalCount:F.length,successCount:N,failureCount:O,originalRecord:D?F[0].originalRecord:void 0,replayedDocument:D?F[0].replayedDocument:void 0,pushResult:D?F[0].pushResult:void 0,records:F}}var pP1;var Jq=o(()=>{RP();_P();X4();pP1=new Set(["TEXT","NUMBER","DATE","AMOUNT","PERSON","ATTACHMENT","DATE_RANGE","DEPARTMENT","LIST","CITY","OBJECT"])});var _P0,y5;var wz=o(()=>{_P0=class _P0 extends Error{errors;warnings;constructor($,Y=
Line truncated
|
||||
`));this.errors=$;this.warnings=Y;this.name="ResourcePackValidationError"}};y5=_P0});var gP0=j((l54,hP0)=>{hP0.exports=SP;function SP(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}SP.prototype.go=function($){if(this.pending<this.max)SP0(this,$);else this.waiting.push($)};SP.prototype.wait=function($){if(this.pending===0)$(this.error);else this.listeners.push($)};SP.prototype.hold=function(){return vP0(this)};function vP0($){$.pending+=1;var Y=!1;return U;function U(I){if(Y)throw Error("callback called twice");if(Y=!0,$.error=$.error||I,$.pending-=1,$.waiting.length>0&&$.pending<$.max)SP0($,$.waiting.shift());else if($.pending===0){var J=$.listeners;$.listeners=[],J.forEach(Q)}}function Q(I){I($.error)}}function SP0($,Y){Y(vP0($))}});var xP0=j((rP1)=>{var Op=K0("fs"),Np=K0("util"),yP0=K0("stream"),kP0=yP0.Readable,lP1=yP0.PassThrough,oP1=gP0(),hP=K0("events").EventEmitter;rP1.BufferSlicer=Oz;rP1.FdSlicer=Mz;Np.inherits(Mz,hP);function Mz($){hP.call(this),this.fd=$,this.pend=new oP1,this.pend.max=1,this.refCount=0}Mz.prototype.read=function($,Y,U,Q,I){var J=this;J.pend.go(function(K){Op.read(J.fd,$,Y,U,Q,function(z,G,H){K(),I(z,G,H)})})};Mz.prototype.createReadStream=function($){return new Kq(this,$)};Mz.prototype.ref=function(){this.refCount+=1};Mz.prototype.unref=function(){var $=this;if($.refCount-=1,$.refCount<0)throw Error("invalid unref");if($.refCount>0)return;Op.close($.fd,Y);function Y(U){if(U)$.emit("error",U);else $.emit("close")}};Np.inherits(Kq,kP0);function Kq($,Y){Y=Y||{},kP0.call(this,Y),this.context=$,this.context.ref(),this.start=Y.start||0,this.endOffset=Y.end,this.pos=this.start}Kq.prototype._read=function($){var Y=this,U=Math.min(Y._readableState.highWaterMark,$);if(Y.endOffset!=null)U=Math.min(U,Y.endOffset-Y.pos);if(U<=0){Y.push(null),this._cleanup();return}Y.context.pend.go(function(Q){var I=Buffer.allocUnsafe(U);Op.read(Y.context.fd,I,0,U,Y.pos,function(J,K){if(J)Y.destroy(J);else if(K===0)Y.push(null),Y._cleanup();else Y.pos+=K,Y.push(I.slice(0,K));Q()})})};Kq.prototype._destroy=function($,Y){this._cleanup(),Y($)};Kq.prototype._cleanup=function(){if(this.context!=null)this.context.unref(),this.context=null};Np.inherits(Oz,hP);function Oz($){hP.call(this),this.refCount=0,this.buffer=$}Oz.prototype.read=function($,Y,U,Q,I){if(!(0<=Y&&Y<=$.length))throw RangeError("offset outside buffer: 0 <= "+Y+" <= "+$.length);if(Q<0)throw RangeError("position is negative: "+Q);if(Y+U>$.length)U=$.length-Y;if(Q+U>this.buffer.length)U=this.buffer.length-Q;if(U<=0){setImmediate(function(){I(null,0)});return}this.buffer.copy($,Y,Q,Q+U),setImmediate(function(){I(null,U)})};Oz.prototype.createReadStream=function($){$=$||{};var Y=new lP1($);Y.start=$.start||0,Y.endOffset=$.end,Y.pos=Y.endOffset||this.buffer.length;var U=this.buffer.slice(Y.start,Y.pos),Q=65536,I=0;while(!0){var J=I+Q;if(J>=U.length){if(I<U.length)Y.write(U.slice(I,U.length));break}Y.write(U.slice(I,J)),I=J}return Y.end(),Y};Oz.prototype.ref=function(){this.refCount+=1};Oz.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")}});var uP0=j((r54,fP0)=>{var aP1=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,
Line truncated
|
||||
`}});import{homedir as CA1}from"node:os";import{join as qd}from"node:path";var RA1,j$,E$;var Vd=o(()=>{RA1=qd(CA1(),".config","seal-use"),j$=qd(RA1,"linters"),E$=qd(j$,"official")});import{existsSync as TQ,mkdirSync as _A1,readFileSync as vA1,readdirSync as OA0,rmSync as hA1,unlinkSync as SA1,writeFileSync as gA1}from"node:fs";import{isAbsolute as yA1,join as j8,resolve as kA1}from"node:path";import{pathToFileURL as FA0}from"node:url";function DA0($=E$){let Y=[],U=[];try{if(!TQ($))_A1($,{recursive:!0});let Q=Object.keys(Xd);for(let[J,K]of Object.entries(Xd)){let z=j8($,J),H=!0;if(TQ(z))try{if(vA1(z,"utf8")===K)H=!1}catch{H=!0}if(H)gA1(z,K,"utf8");Y.push(J)}let I=OA0($,{withFileTypes:!0});for(let J of I)if(!Q.includes(J.name)){let K=j8($,J.name);try{if(J.isDirectory())hA1(K,{recursive:!0,force:!0});else SA1(K);U.push(J.name)}catch{}}}catch{}return{synced:Y,pruned:U}}function NA0($={syncOfficial:!0}){if($.syncOfficial!==!1)DA0();let Y=[{name:"builtin",type:"builtin",path:j8(E$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:j8(E$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:j8(E$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],U=[j$,hA];for(let Q of U)if(TQ(Q))try{let I=OA0(Q,{withFileTypes:!0});for(let J of I){if(J.isDirectory())continue;let K=J.name;if(K.endsWith(".ts")||K.endsWith(".js")||K.endsWith(".mjs")){let z=K.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((H)=>H.name===z))Y.push({name:z,type:"custom",path:j8(Q,K),description:`用户自定义规则校验器 (${K})`})}}}catch{}return Y}function xA1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:j8(E$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:j8(E$,"strict.ts"),isOfficial:!0,officialKind:"strict"};if(Y==="hlab"||Y==="hlab-sop"||Y==="hlab-rules"||Y==="hlab-standard"||Y==="official/hlab"||Y==="official/hlab.ts")return{path:j8(E$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(yA1(Y)||Y.startsWith("./")||Y.startsWith("../")){let Q=kA1(Y);if(TQ(Q))return{path:Q};for(let I of[".ts",".js",".mjs"])if(TQ(`${Q}${I}`))return{path:`${Q}${I}`}}let U=[j8(j$,`${Y}.ts`),j8(j$,`${Y}.js`),j8(j$,`${Y}.mjs`),j8(hA,`${Y}.ts`),j8(hA,`${Y}.js`),j8(hA,`${Y}.mjs`)];for(let Q of U)if(TQ(Q))return{path:Q};return{}}async function Ld($){DA0();let Y=xA1($??"builtin");if(Y.isOfficial){let Q=Y.officialKind==="strict"?LA0:Y.officialKind==="hlab"?wA0:wz,I=Y.officialKind==="builtin"?"builtin":"official",J=Y.path;if(J&&TQ(J))try{let z=await import(FA0(J).href),H=z.default??z.lintRule??z.linter??z.lint;if(typeof H==="function")return{name:Y.officialKind??"builtin",type:I,filePath:J,linter:MA0(H,Q)}}catch{}return{name:Y.officialKind??"builtin",type:I,filePath:J,linter:Q}}let U=Y.path;if(!U)return console.error(`⚠️ [linter] 未找到自定义校验器 "${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:wz};try{let I=await import(FA0(U).href),J=I.default??I.lintRule??I.linter??I.lint;if(typeof J!=="function")return console.error(`⚠️ [linter] 自定义校验器 "${U}" 未导出标准函数 (default / lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:wz};return{name:$??"custom",type:"custom",filePath:U,linter:MA0(J,wz)}}catch(Q){return console.error(`⚠️ [linter] 加载自定义校验器脚本 "${U}" 失败(语法错误或依赖缺失: ${Q?.message??Q}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:wz}}}function MA0($,Y){return async(U,Q)=>{try{let I=await $(U,Q);if(I&&typeof I==="object"&&typeof I.score==="number"&&Array.isArray(I.issues))return I;return console.error("⚠️ [linter] 自定义校验器返回值格式不符合 RuleLintResult 契约,已回退至内置结果。"),Y(U,Q)}catch(I){return console.error("⚠️ [linter] 自定义校验器执行异常:",I),Y(U,Q)}}}var hA;var PA0=o(()=>{Vd();Hd();Wd();Zd();Gd();hA=j8(process.cwd(),"linters")});async function wd($,Y,U){let Q=await Y.linter($,U);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:Q.score,passed:Q.passed,issues:Q.issues,description:$.description}}async function BA0($,Y,U,Q){let I=Q?.minScore??0,J=Q?.level??"all",K=[],z=0;for(let q of $){let V=await wd(q,Y,U);z+=V.score;let w=V.issues;if(J==="error")w=V.issues.filter((F)=>F.level==="error");else if(J==="warning")w=V.issues.filter((F)=>F.level==="warning"||F.level==="error");let M=w.every((F)=>F.level!=="error");if(Q?.summary){if(w.length>0)K.push({...V,passed:M,issues:w})}else K.push({...V,passed:M,issues:w})}let H=$.length,G=H===Line truncated
|
||||
`,"utf8"),U}function CA0($){return $.map((Y,U)=>{let Q=jA0(Y.code),I;if(Q!==void 0)I=String(Q).padStart(4,"0");else if(typeof Y.code==="string"&&Y.code.trim())I=Y.code.trim().replace(/^#/,"");else I=String(U).padStart(4,"0");return{id:Y.id,code:I,name:Y.name,description:Y.description,scope:Y.scope,strictness:Y.strictness}})}var RA0=()=>{};import _A0 from"node:fs";import vA0 from"node:path";function pA1($){try{let Y=new URL($);if(Y.search)return`${Y.origin}${Y.pathname}?[MASKED]`;return $}catch{return $.replace(/\?.*$/,"?[MASKED]")}}function Nd($){return $.replace(/[/\\?%*:|"<>]/g,"_").trim()||"attachment"}function hA0($){return Object.fromEntries(Object.entries($).filter(([,Y])=>Y!==void 0))}function dA1($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function G4($){return typeof $==="string"&&$.trim()?$.trim():void 0}function Od($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function mA1($){if(!$)return;if(typeof $==="string")try{let Y=JSON.parse($);if(Y&&typeof Y==="object")return Y}catch{return}if(typeof $==="object"&&!Array.isArray($))return $;return}function lA1($,Y,U){if(U?.fieldType?.toUpperCase()==="ATTACHMENT"){if(Boolean($.fileName||$.filename||$.name||$.originalName||$.fileId||$.ossPath||$.url||$.ossSignedUrl||$.signedUrl||$.token))return!0}if($.ossSignedUrl||$.signedUrl)return!0;let Q=$.fileName??$.filename??$.name??$.originalName,I=$.fileId??$.id??$.attachmentId,J=$.ossPath??$.ossKey,K=$.url??$.downloadUrl??$.previewUrl,z=$.mimeType??$.mimetype??$.contentType,H=$.ossFileSize??$.fileSize??$.size;if(Q&&(K||J||I||H))return!0;if(I&&(z||H||J||K))return!0;let G=Object.keys($).map((Z)=>Z.toLowerCase());return(/(attachment|attachments|invoice|receipt|file|files|附件|发票)/i.test(Y)||Boolean(U?.fieldKey&&/(attachment|attachments|invoice|receipt|file|files|附件|发票)/i.test(U.fieldKey))||Boolean(U?.fieldLabel&&/(attachment|attachments|invoice|receipt|file|files|附件|发票)/i.test(U.fieldLabel)))&&["filename","filename","mimetype","contenttype","fileid","osspath","signedurl","downloadurl","previewurl","attachmentid","ossfilesize","osssignedurl"].some((Z)=>G.includes(Z))}function oA1($,Y,U){let Q=`${$} ${U?.fieldLabel??""} ${U?.fieldKey??""} ${G4(Y.type)??""} ${G4(Y.category)??""}`.toLowerCase();if(Q.includes("invoice")||Q.includes("发票"))return"invoice";if(Q.includes("receipt"))return"receipt";let I=(G4(Y.fileName)??G4(Y.name)??"").toLowerCase();if(I.includes("发票")||I.includes("invoice"))return"invoice";return"attachment"}function Dd($,Y,U,Q,I){if(Array.isArray($)){$.forEach((G,W)=>Dd(G,`${Y}.${W}`,U,Q,I));return}let J=dA1($);if(!J)return;let K=J.type&&typeof J.type==="string"||"label"in J&&"value"in J||"key"in J&&"value"in J,z=I;if(K)z={fieldLabel:G4(J.label)??I?.fieldLabel,fieldKey:G4(J.key)??I?.fieldKey,fieldType:G4(J.type)??I?.fieldType};if(!(Array.isArray(J.value)&&!J.url&&!J.ossSignedUrl&&!J.fileId)&&lA1(J,Y,I)){let G=mA1(J.token),W=G4(G?.key),X=G4(G?.fileId),Z=hA0({path:Y,fieldPath:Y,kind:oA1(Y,J,I),fileName:G4(J.fileName)??G4(J.filename)??G4(J.name)??G4(J.originalName),mimeType:G4(J.mimeType)??G4(J.mimetype)??G4(J.contentType),fileId:G4(J.fileId)??G4(J.id)??G4(J.attachmentId)??X,ossPath:G4(J.ossPath)??G4(J.ossKey)??W,url:G4(J.url)??G4(J.signedUrl)??G4(J.downloadUrl)??G4(J.previewUrl),ossSignedUrl:G4(J.ossSignedUrl)??G4(J.signedUrl),token:J.token,tokenKey:W,category:G4(J.category),ossFileSize:Od(J.ossFileSize)??Od(J.fileSize)??Od(J.size),invoiceId:G4(J.invoiceId),sourceField:G4(J.fieldName)??G4(J.label)??I?.fieldLabel??I?.fieldKey}),q=JSON.stringify(Z);if(!Q.has(q))Q.add(q),U.push(Z)}for(let[G,W]of Object.entries(J))Dd(W,`${Y}.${G}`,U,Q,z)}function m3($,Y={}){let U=[["document",$.document],["result",$.result],["pipelineData",$.pipelineData],["sourceExtendData",$.sourceExtendData]],Q=[],I=new Set;for(let[J,K]of U)Dd(K,J,Q,I);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,count:Q.length,attachments:Y.summary?Q.map((J)=>hA0({path:J.path,kind:J.kind,fileName:J.fileName,mimeType:J.mimeType,fileId:J.fileId,sourceField:J.sourceField,ossFileSize:J.ossFileSize,hasSignedUrl:Boolean(J.ossSignedUrl)})):Q}}async function SA($){let{record:Y,fetchFn:U=globalThis.fetch}=$,I=m3(Y,{summary:!1}).attachments,J=vA0.resolve($.outDir??"./attachments");if(I.length===0)return{recordId:Y.id,outDir:J,total:0,downloaded:0,failed:0,files:[]};let K=[];if($.name){let X=$.name.toLowerCase();if(K=I.filter((Z)=>{let q=Z.fileName?.toLowerCase()??"",V=Z.fileId?.toLowerCase()??"",w=Z.tokenKey?.toLowerCase()??"";return q.includes(X)||V===X||w.includes(X)}),K.length===0){let Z=I.map((q)=>q.fileName??q.fileId).filter(Boolean).join(", ");throw Error(`未找到匹配 "${$.name}" 的附件。可选附件: ${Z||"无"}`)}}else if(!$.all){if(I.length>1){let X=I.map((Z)=>Z.fileName??Z.fileId).filter(Boolean).join(", ");throw Error(`共发现 ${I.length} 个附件。请使用 --all 下载全部附件,或使用 --name <名称|fileId> 指定下载项。可Line truncated
|
||||
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:r2({id:Y?.id,sn:Y?.sn??Y?.sourceDocumentSN??$.sourceDocumentSN,title:Y?.title??Y?.name,template:Gq(Y,["template.name","templateName","form.name","formName","formTitle"]),amount:Kq(U,["金额","报销金额","付款金额","合计","价税合计"])??Gq(Y,["amount","totalAmount","expenseAmount"]),expenseType:Kq(U,["费用类型","费用类别","报销类型"]),costCompany:Kq(U,["费用承担公司","承担公司","成本中心","费用归属"]),payee:Kq(U,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:U.slice(0,30)}),invoices:pA0($),attachments:m3($,{summary:!0}).attachments,aiResult:uA($),manualResult:jQ($)?.value,hints:r2({amountMentions:Bd(Q,["金额","合计","税率"],8),partyMentions:Bd(Q,["买方","卖方","甲方","乙方","收款"],8)})}}function HT1($){let Y=[["result.rulesResult",$5($,"result.rulesResult")],["result.hitRules",$5($,"result.hitRules")],["result.citedRules",$5($,"result.citedRules")],["result.matchedRules",$5($,"result.matchedRules")],["result.ruleResults",$5($,"result.ruleResults")],["result.rules",$5($,"result.rules")],["pipelineData.citedRules",$5($,"pipelineData.citedRules")],["pipelineData.matchedRules",$5($,"pipelineData.matchedRules")]],U=[],Q=new Map,I=new Set;for(let[J,K]of Y)(Array.isArray(K)?K:K&&typeof K==="object"?Object.values(K):[]).forEach((H,G)=>{let W=Fz(H);if(!W)return;let X=V4(W.runtimeRuleId)??V4(W.runtimeId)??V4(W.id)??V4(W.ruleId),Z=W.ruleCode??W.code,q=K$(Z??X),V=X??(q!==void 0?`rule-${q}`:void 0),w=(q!==void 0?s2(q):void 0)??V4(W.ruleCode)??V4(W.code)??(V?dA0(V):void 0),M=r2({code:w,runtimeRuleId:V,ruleCode:w,versionNumber:cA0(W.versionNumber)??$.ruleSetVersionNumber,description:V4(W.description),scope:V4(W.scope),strictness:V4(W.strictness),ruleIntent:V4(W.ruleIntent),appliedAnalysis:W.appliedAnalysis??W.analysis??W.reasoning,checkResult:W.checkResult??W.result??W.decision,findings:W.findings??W.riskPoints??W.evidence,sourcePath:`${J}.${G}`}),F=V??w;if(F){let O=Q.get(F);if(O){for(let[N,B]of Object.entries(M))if(O[N]===void 0&&B!==void 0)O[N]=B;return}Q.set(F,M),U.push(M);return}let D=JSON.stringify(M);if(!I.has(D))I.add(D),U.push(M)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:U.length,rules:U}}function Gq($,Y){if(!$)return;for(let U of Y){let Q=$5($,U);if(Q!==void 0)return Q}return}function Pd($,Y){if(!$)return 0;for(let U of Y){let Q=$5($,U);if(Array.isArray(Q))return Q.length;if(Q&&typeof Q==="object")return Object.keys(Q).length;if(typeof Q==="number")return Q}return 0}function $5($,Y){return Y.split(".").reduce((U,Q)=>{if(U===void 0||U===null)return;if(Array.isArray(U)){let I=Number(Q);return Number.isInteger(I)?U[I]:void 0}if(typeof U==="object")return U[Q];return},$)}function iA0($,Y,U){let Q=Y.split("."),I=$;for(let J of Q.slice(0,-1)){let K=I[J];if(!K||typeof K!=="object"||Array.isArray(K))I[J]={};I=I[J]}I[Q[Q.length-1]??Y]=U}function r2($){return Object.fromEntries(Object.entries($).filter(([,Y])=>Y!==void 0))}function Fz($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function cA0($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function nA0($){let Y=[];return yA($,"document",Y),Y}function yA($,Y,U){if(Array.isArray($)){$.forEach((K,z)=>yA(K,`${Y}.${z}`,U));return}let Q=Fz($);if(!Q)return;let I=V4(Q.label)??V4(Q.name)??V4(Q.title)??V4(Q.fieldName),J=Q.value??Q.displayValue??Q.text??Q.content;if(I&&J!==void 0&&typeof J!=="object")U.push(r2({path:Y,label:I,value:J,type:V4(Q.type)??V4(Q.fieldType)}));for(let[K,z]of Object.entries(Q)){if(K==="attachments")continue;yA(z,`${Y}.${K}`,U)}}function Kq($,Y){return $.find((Q)=>{let I=V4(Q.label)??"";return Y.some((J)=>I.includes(J))})?.value}function pA0($){let Y=[];return Wq($.result,"result",Y),Wq($.document,"document",Y),Y.slice(0,20)}function Wq($,Y,U){if(Array.isArray($)){$.forEach((I,J)=>Wq(I,`${Y}.${J}`,U));return}let Q=Fz($);if(!Q)return;if(/invoice|发票/i.test(Y))U.push(r2({path:Y,fileName:V4(Q.fileName)??V4(Q.filename)??V4(Q.name),buyer:Q.buyer??Q.buyerName??Q.purchaserName,seller:Q.seller??Q.sellerName,amount:Q.amount??Q.totalAmount??Q.total,taxRate:Q.taxRate,category:Q.category??Q.type}));for(let[I,J]of Object.entries(Q))Wq(J,`${Y}.${I}`,U)}function Bd($,Y,U){return $.split(/\r?\n/).filter((Q)=>Y.some((I)=>Q.includes(I))).slice(0,U)}function GT1($){return $.map((Y)=>{let U=Xq(Y);return{recordId:U.id,tenantId:U.tenantId,agentId:U.agentId,sourceDocumentSN:U.sourceDocumentSN,sourceDocumentId:U.sourceDocumentId,simulationBatchId:U.simulationBatchId,langfuseTraceId:U.langfuseTraceId,langfuseSessionFallback:U.langfuseSessionFallback,ruleSetVersionNumber:U.ruleSetVersionNumber,ruleSetPublishedAt:U.ruleSetPublishedAt,ruleSetPublishedByName:U.ruleSetPublishedByName,resolution:U.langfuseTraceId?"trace":U.langfuseSessionFallback?"session-fallback"
Line truncated
|
||||
`)},{...Kd(J,20000,Y.full===!0),format:Y.format??"unified"}}},{name:"seal_approval_rule_version_publish",description:"发布 Seal 草稿审批规则为新版本",parameters:L.object({versionName:L.string().describe("版本名称")}),handler:async($,Y,U)=>{let Q=await J6($).catch(()=>{return}),I=await KW($,Y.versionName);if(Q)try{Iq(U.corp.id,I.version,Q.rules)}catch{}return I}},{name:"seal_approval_rule_get",description:"按规则编号 code(或规则 ID)获取单条规则详情;默认读取当前草稿(含规则 ID),指定 version 或 recordId 时读取对应发布版本快照",parameters:L.object({versionId:L.string().optional().describe("规则版本 ID"),versionNumber:L.number().int().positive().optional().describe("规则版本号"),latest:L.boolean().optional().describe("为 true 时取最新已发布版本"),code:L.string().optional().describe("规则编号(如 0025)"),runtimeId:L.string().optional().describe("规则编号兼容别名"),ruleId:L.string().optional().describe("规则 ID 兼容别名"),recordId:L.string().optional().describe("从审批运行记录推断所使用的已发布版本")}),handler:async($,Y,U)=>{let Q={code:Y.code,runtimeId:Y.runtimeId,ruleId:Y.ruleId},I=Boolean(Y.versionId||Y.versionNumber||Y.latest||Y.recordId),J=await J6($).catch(()=>{return});if(!I&&J?.rules){let G=RT1(J.rules,Q);if(G)return G}let K=await CT1($,Y).catch((G)=>{if(!I&&J?.rules)throw Error(`Rule not found in current draft: ${Y.code??Y.runtimeId??Y.ruleId??""}`);throw G}),z=U?.corp?.id?vA(U.corp.id,K):K,H=_T1(z,Q,J?.rules);if(!H)throw Error(I?`Rule not found in version ${z.versionNumber}`:`Rule not found in current draft or version ${z.versionNumber}`);return H}},{name:"seal_approval_rules_lint",description:"对 Seal 本地规则文件、草稿审批规则或指定发布版本规则进行质量与可执行性检查(模糊词、悬空例外检测)",parameters:L.object({file:L.string().optional().describe("指定本地规则文件路径进行离线质检(支持 .json),0网络请求、不污染远端草稿"),linter:L.string().optional().describe("指定使用的校验器名称或脚本路径(如 builtin、strict、./my-linter.ts)"),version:L.string().optional().describe("指定要质检的历史发布版本号或 ID(如 16 或 latest),不传默认质检当前草稿"),code:L.string().optional().describe("按规则编号过滤(如 25)"),ruleId:L.string().optional().describe("按规则 ID 过滤"),minScore:L.number().optional().describe("最低合格质量分阈值(0~100),低于该分值抛出错误以返回非零退出码"),level:L.enum(["all","error","warning"]).default("all").describe("问题报告等级过滤"),summary:L.boolean().optional().describe("为 true 时仅返回存在瑕疵/扣分的规则")}),handler:async($,Y,U)=>{let Q=[],I;if(Y.file){let G=Md(Y.file);Q=CA0(G.rules),I=G.meta.versionNumber}else if(Y.version){let G=await y8($),W=Number(Y.version),X=isNaN(W)?Y.version==="latest"?G[0]:G.find((Z)=>Z.id===Y.version):G.find((Z)=>Z.versionNumber===W);if(!X)throw Error(`未找到指定的规则版本: ${Y.version}`);I=X.versionNumber,Q=(X.rules??[]).map((Z,q)=>({id:Z.id??Z.runtimeId,code:Mz(Z.code)??bA(q),name:Z.name??Z.title,description:Z.description??"",scope:Z.scope,strictness:Z.strictness}))}else Q=((await J6($)).rules??[]).map((W,X)=>({id:W.id,code:Mz(W.code)??bA(X),name:W.name??W.title,description:W.description??"",scope:W.scope,strictness:W.strictness}));if(Y.code){let G=Mz(Y.code);Q=Q.filter((W)=>Mz(W.code)===G)}if(Y.ruleId){let G=Mz(Y.ruleId);Q=Q.filter((W)=>W.id===Y.ruleId||G!==void 0&&Mz(W.code)===G)}let J=A4(),K=Y.linter??J.lint?.activeLinter??"builtin",z=await Ld(K),H=await BA0(Q,z,{corpId:U?.corp?.id,versionNumber:I,allRules:Q},{minScore:Y.minScore,level:Y.level,summary:Y.summary});if(Y.minScore&&H.overallScore<Y.minScore)throw Error(`[Linter 质量门禁未通过] 综合评分 ${H.overallScore} 低于要求的最低分 ${Y.minScore} 分 (共发现 ${H.issueCount} 条问题规则)。`);return H}},{name:"seal_approval_rules_pull",description:"从 Seal 远端拉取草稿或指定版本规则,保存至本地规则文件(支持离线编辑与本地 Lint,绝不污染远端草稿)",parameters:L.object({version:L.string().optional().describe("指定拉取的历史发布版本号或 ID(如 16 或 latest),不传默认拉取当前草稿规则"),out:L.string().optional().describe("保存的目标本地文件路径,默认为 ./rules.local.json")}),handler:async($,Y,U)=>{let Q=Y.out??"./rules.local.json",I=[],J="draft",K;if(Y.version){let H=await y8($),G=Number(Y.version),W=isNaN(G)?Y.version==="latest"?H[0]:H.find((X)=>X.id===Y.version):H.find((X)=>X.versionNumber===G);if(!W)throw Error(`未找到指定的规则版本: ${Y.version}`);K=W.versionNumber,J=`version:${K}`,I=(W.rules??[]).map((X,Z)=>({code:l3(X.code)??Z,name:X.name??X.title,description:X.description??"",scope:X.scope??"ALL",strictness:X.strictness??"MUST_FOLLOW"}))}else I=((await
Line truncated
|
||||
\uD83D\uDC49 Next action: 若您已直接修改远端草稿、仅需发布正式版本,请执行 seal-use rules publish "${q}" --corp ${U.corp.id}`)}throw Z}let K=Y.confirm!==!0||Y.dryRun===!0,z=await J6($),H=ET1(z.rules,I.rules);if(K)return{...sA0(U,"api/v1/rules",z.rules,I.rules.map((Z)=>({description:Z.description,scope:Z.scope??"ALL",strictness:Z.strictness??"MUST_FOLLOW"})),z.rules.length+I.rules.length),corpId:U.corp.id,dryRun:!0,localFile:I.resolvedPath,localRulesCount:I.rules.length,remoteDraftCount:z.rules.length,changes:H,impactCount:H.created.length+H.updated.length+H.deleted.length,preservedRuleIds:[...H.updated.map((Z)=>Z.id),...H.unchanged.map((Z)=>Z.id)],warning:"Incremental mode preserves matched rule IDs and does not recode the draft rule set.",willPublish:Boolean(Y.publish),message:"Preview mode. Use --yes or confirm=true to apply the listed incremental changes to the remote draft."};for(let Z of H.deleted)await ZJ($,Z.id);let G=[];for(let Z of H.created){let q=await JW($,{description:Z.description,scope:Z.scope??"ALL",strictness:rA0(Z.strictness)});G.push({id:q.id,description:q.description,code:q.code})}let W=[];for(let Z of H.updated)await Hy($,Z.id,{description:Z.rule.description,scope:Z.rule.scope??"ALL",strictness:rA0(Z.rule.strictness)}),W.push(Z.id);let X=void 0;if(Y.publish){let Z=N1().slice(0,10).replace(/-/g,""),q=Y.versionName||`v-local-${Z}-${Date.now().toString().slice(-4)}`;X=await KW($,q);try{let V=await J6($);Iq(U.corp.id,X.version,V.rules)}catch{}}return{corpId:U.corp.id,dryRun:!1,localFile:I.resolvedPath,deletedRules:H.deleted.length,createdRules:G.length,updatedRules:W.length,unchangedRules:H.unchanged.length,preservedRuleIds:[...W,...H.unchanged.map((Z)=>Z.id)],recoded:!1,published:X??!1}}},{name:"seal_approval_documents_list",description:"列出 Seal 审批知识文档",parameters:L.object({scenarios:L.array(L.string()).optional().describe("场景过滤"),offset:L.number().int().nonnegative().optional(),limit:L.number().int().positive().optional()}),handler:async($,Y)=>IU($,Y)},{name:"seal_approval_document_get",description:"获取 Seal 审批知识文档详情",parameters:L.object({documentId:L.string().describe("文档 ID")}),handler:async($,Y)=>X60($,Y.documentId)},{name:"seal_approval_document_create",description:"新建 Seal 审批知识文档",parameters:L.object({title:L.string(),purpose:L.string(),content:L.string().describe("正文,通常为 Markdown"),contentType:L.string().optional(),status:L.string().optional(),enabled:L.boolean().optional(),scenarios:L.array(L.string()).optional(),tags:L.array(L.string()).optional()}),handler:async($,Y)=>JO($,Y)},{name:"seal_approval_document_update",description:"更新 Seal 审批知识文档",parameters:L.object({documentId:L.string(),title:L.string().optional(),purpose:L.string().optional(),content:L.string().optional(),contentType:L.string().optional(),status:L.string().optional(),enabled:L.boolean().optional(),scenarios:L.array(L.string()).optional(),tags:L.array(L.string()).optional()}),handler:async($,Y)=>{let{documentId:U,...Q}=Y;return KO($,U,Q)}},{name:"seal_approval_delete_document",description:"删除 Seal 审批知识文档",parameters:L.object({documentId:L.string().describe("知识文档 ID")}),handler:($,Y)=>zO($,Y.documentId)},{name:"seal_approval_search",description:"按关键词组检索 Seal 审批规则、审批文档和审批偏好配置,返回命中位置、字段、行号和前后三行上下文",parameters:L.object({keywords:L.array(L.string()).min(1).describe("关键词组"),matchMode:L.enum(["any","all"]).optional().describe("any 命中任一关键词,all 要求同一行命中全部关键词"),areas:L.array(L.enum(["rules","documents","preferences"])).optional().describe("检索范围"),caseSensitive:L.boolean().optional().describe("是否大小写敏感"),contextLines:L.number().int().nonnegative().optional().describe("返回命中行前后几行,默认 3"),documentLimit:L.number().int().positive().optional().describe("缓存刷新时最多拉取文档数,默认 100"),maxResults:L.number().int().positive().optional().describe("最多返回命中数,默认 50"),refresh:L.boolean().optional().describe("是否跳过 5 分钟内存缓存并强制刷新"),ruleVersionScope:L.enum(["current","all","version"]).optional().describe("规则检索范围,默认 current;all 会检索所有已发布历史版本"),ruleVersionId:L.string().optional().describe("ruleVersionScope=version 时指定版本 ID"),ruleVersionNumber:L.number().int().positive().optional().describe("ruleVersionScope=version 时指定版本号"),latestRuleVersion:L.boolean().optional().describe("ruleVersionScope=version 时取最新已发布版本"),snippetOnly:L.boolean().optional().describe("只返回命中行,不返回前后文"),maxChars:L.number().int().positive().optional().describe("每个文本片段最多返回字符数"),fields:L.array(L.string()).optional().describe("只搜索指定字段,如 history.descrip
Line truncated
|
||||
`+"为防止测试单据污染生产审批流,禁止向生产环境重放单据。请指定测试企业 (--target-corp <testCorpId>),或在确有需要时添加 --force。",`seal-use webhook replay --target-corp <testCorpId>${U.id!==Q.id?` --source-corp ${U.id}`:""}`);return{sourceCorp:U,targetCorp:Q}}async function ud($,Y,U){let Q=Y.seal?.endpoints?.approvalStylePreferences??"api/v1/agent/ai-approval/config",I=await F$($,Q);if(U||I.length>0)return $T0(I,U,Y.id);if(Y.environment==="test"||Y.id.toLowerCase().includes("test")){console.error(`[webhook-replay] 测试企业「${Y.name}」未配置 Webhook 通道,正在自动创建「(Seal测-回放通道)」...`);let J=(Y.seal.url??Y.source?.sealUrl??`https://${Y.id.toLowerCase()}.sealai.cc`).replace(/\/+$/,"");return await HO($,J,{name:"(Seal测-回放通道)",mode:"assisted",outgoingResultWebhook:`${J}/api/v1/integrations/webhook/replay-mock-callback`},Y.seal.endpoints.approvalStylePreferences)}throw new U4(`当前租户「${Y.name}」未配置任何 Webhook 集成通道。`,1,`seal-use webhook add --name <name> --result-url <url> --corp ${Y.id}`)}async function Oz($){let{query:Y,sourceClient:U,targetClient:Q,sourceCorp:I,targetCorp:J,webhookSelector:K,snPrefix:z,snSuffix:H,docIdPrefix:G,docIdSuffix:W,dryRun:X,fetchFn:Z=fetch}=$,q=[];if(Y.recordId){let B=await X4(U,Y.recordId);q.push(B)}else if(Y.recordIds&&Y.recordIds.length>0)for(let B of Y.recordIds)q.push(await X4(U,B));else if(Y.sn){let A=(await b4(U,{search:Y.sn,sourceDocumentSN:Y.sn,limit:20})).records.find((P)=>P.sourceDocumentSN===Y.sn||P.sourceDocumentId===Y.sn||P.document?.sourceDocumentSN===Y.sn||P.document?.sn===Y.sn);if(!A)throw Error(`在企业「${I.name}」中未找到单据编号为「${Y.sn}」的审批记录。`);q.push(A)}else if(Y.sns&&Y.sns.length>0)for(let B of Y.sns){let P=(await b4(U,{search:B,sourceDocumentSN:B,limit:20})).records.find((j)=>j.sourceDocumentSN===B||j.sourceDocumentId===B||j.document?.sourceDocumentSN===B||j.document?.sn===B);if(!P)throw Error(`在企业「${I.name}」中未找到单据编号为「${B}」的审批记录。`);q.push(P)}else if(Y.limit!==void 0){let B=await b4(U,{limit:Y.limit,status:Y.status,startDate:Y.startDate,endDate:Y.endDate});if(!B.records.length)throw Error(`在企业「${I.name}」中未检索到符合条件的审批记录。`);q=B.records}else throw Error("Usage: seal-use webhook replay <recordId> [--sn <documentSN>] [--limit <n>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--dry-run]");let V=q.map((B)=>({run:B,doc:xd(B,{snPrefix:z,snSuffix:H,docIdPrefix:G,docIdSuffix:W})}));if(X){let B={id:"preview-webhook",name:K??"预览目标通道",mode:"assisted",incomingDocumentWebhookUrl:`${J.seal.url}/api/v1/integrations/webhook/preview`};try{let j=await F$(Q,J.seal.endpoints.approvalStylePreferences);if(j.length>0){let C=$T0(j,K,J.id);B={id:C.id,name:C.name,mode:C.mode,incomingDocumentWebhookUrl:C.incomingDocumentWebhook.url}}}catch{}let A=V.map(({run:j,doc:C})=>({originalRecord:{id:j.id,sourceSystem:j.sourceSystem,sourceDocumentSN:j.sourceDocumentSN,sourceDocumentId:j.sourceDocumentId},document:C,success:!0})),P=A.length===1;return{dryRun:!0,success:!0,sourceCorp:{id:I.id,name:I.name,environment:I.environment},targetCorp:{id:J.id,name:J.name,environment:J.environment},targetWebhook:B,totalCount:A.length,successCount:A.length,failureCount:0,originalRecord:P?A[0].originalRecord:void 0,document:P?A[0].document:void 0,records:A}}let w=await ud(Q,J,K),M={id:w.id,name:w.name,mode:w.mode,incomingDocumentWebhookUrl:w.incomingDocumentWebhook.url},F=[],D=0,O=0;for(let{run:B,doc:A}of V){console.error(`[webhook-replay] 正在向 Webhook 通道「${w.name}」推送单据: ${A.documentSN}...`);try{let P=await fd(w.incomingDocumentWebhook.url,w.secret,A,Z,_6(J.seal));F.push({originalRecord:{id:B.id,sourceSystem:B.sourceSystem,sourceDocumentSN:B.sourceDocumentSN,sourceDocumentId:B.sourceDocumentId},replayedDocument:{documentSN:A.documentSN,documentId:A.documentId,fieldCount:A.fields.length},pushResult:P,success:!0}),D+=1}catch(P){let j=P instanceof Error?P.message:String(P);F.push({originalRecord:{id:B.id,sourceSystem:B.sourceSystem,sourceDocumentSN:B.sourceDocumentSN,sourceDocumentId:B.sourceDocumentId},replayedDocument:{documentSN:A.documentSN,documentId:A.documentId,fieldCount:A.fields.length},error:j,success:!1}),O+=1}}let N=F.length===1;return{success:O===0,dryRun:!1,sourceCorp:{id:I.id,name:I.name,environment:I.environment},targetCorp:{id:J.id,name:J.name,environment:J.environment},targetWebhook:M,totalCount:F.length,successCount:D,failureCount:O,originalRecord:N?F[0].originalRecord:void 0,replayedDocument:N?F[0].replayedDocument:void 0,pushResult:N?F[0].pushResult:void 0,records:F}}var yT1;var qq=o(()=>{iA();fG();Z4();yT1=new Set(["TEXT","NUMBER","DATE","AMOUNT","PERSON","ATTACHMENT","DATE_RANGE","DEPARTMENT","LIST","CITY","OBJECT"])});var YT0,k5;var Dz=o(()=>{YT0=class YT0 extends Error{errors;warnings;constructor($,Y=[]
Line truncated
|
||||
`));this.errors=$;this.warnings=Y;this.name="ResourcePackValidationError"}};k5=YT0});var JT0=E((i54,IT0)=>{IT0.exports=nA;function nA(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}nA.prototype.go=function($){if(this.pending<this.max)QT0(this,$);else this.waiting.push($)};nA.prototype.wait=function($){if(this.pending===0)$(this.error);else this.listeners.push($)};nA.prototype.hold=function(){return UT0(this)};function UT0($){$.pending+=1;var Y=!1;return U;function U(I){if(Y)throw Error("callback called twice");if(Y=!0,$.error=$.error||I,$.pending-=1,$.waiting.length>0&&$.pending<$.max)QT0($,$.waiting.shift());else if($.pending===0){var J=$.listeners;$.listeners=[],J.forEach(Q)}}function Q(I){I($.error)}}function QT0($,Y){Y(UT0($))}});var HT0=E((uT1)=>{var bd=z0("fs"),id=z0("util"),KT0=z0("stream"),zT0=KT0.Readable,xT1=KT0.PassThrough,fT1=JT0(),pA=z0("events").EventEmitter;uT1.BufferSlicer=Pz;uT1.FdSlicer=Nz;id.inherits(Nz,pA);function Nz($){pA.call(this),this.fd=$,this.pend=new fT1,this.pend.max=1,this.refCount=0}Nz.prototype.read=function($,Y,U,Q,I){var J=this;J.pend.go(function(K){bd.read(J.fd,$,Y,U,Q,function(z,H,G){K(),I(z,H,G)})})};Nz.prototype.createReadStream=function($){return new Vq(this,$)};Nz.prototype.ref=function(){this.refCount+=1};Nz.prototype.unref=function(){var $=this;if($.refCount-=1,$.refCount<0)throw Error("invalid unref");if($.refCount>0)return;bd.close($.fd,Y);function Y(U){if(U)$.emit("error",U);else $.emit("close")}};id.inherits(Vq,zT0);function Vq($,Y){Y=Y||{},zT0.call(this,Y),this.context=$,this.context.ref(),this.start=Y.start||0,this.endOffset=Y.end,this.pos=this.start}Vq.prototype._read=function($){var Y=this,U=Math.min(Y._readableState.highWaterMark,$);if(Y.endOffset!=null)U=Math.min(U,Y.endOffset-Y.pos);if(U<=0){Y.push(null),this._cleanup();return}Y.context.pend.go(function(Q){var I=Buffer.allocUnsafe(U);bd.read(Y.context.fd,I,0,U,Y.pos,function(J,K){if(J)Y.destroy(J);else if(K===0)Y.push(null),Y._cleanup();else Y.pos+=K,Y.push(I.slice(0,K));Q()})})};Vq.prototype._destroy=function($,Y){this._cleanup(),Y($)};Vq.prototype._cleanup=function(){if(this.context!=null)this.context.unref(),this.context=null};id.inherits(Pz,pA);function Pz($){pA.call(this),this.refCount=0,this.buffer=$}Pz.prototype.read=function($,Y,U,Q,I){if(!(0<=Y&&Y<=$.length))throw RangeError("offset outside buffer: 0 <= "+Y+" <= "+$.length);if(Q<0)throw RangeError("position is negative: "+Q);if(Y+U>$.length)U=$.length-Y;if(Q+U>this.buffer.length)U=this.buffer.length-Q;if(U<=0){setImmediate(function(){I(null,0)});return}this.buffer.copy($,Y,Q,Q+U),setImmediate(function(){I(null,U)})};Pz.prototype.createReadStream=function($){$=$||{};var Y=new xT1($);Y.start=$.start||0,Y.endOffset=$.end,Y.pos=Y.endOffset||this.buffer.length;var U=this.buffer.slice(Y.start,Y.pos),Q=65536,I=0;while(!0){var J=I+Q;if(J>=U.length){if(I<U.length)Y.write(U.slice(I,U.length));break}Y.write(U.slice(I,J)),I=J}return Y.end(),Y};Pz.prototype.ref=function(){this.refCount+=1};Pz.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")}});var WT0=E((n54,GT0)=>{var cT1=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,
Line truncated
|
||||
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�`},ibm864:"cp864",csibm864:"cp864",cp865:{type:"_sbcs",chars:"ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "},ibm865:"cp865",csibm865:"cp865",cp866:{type:"_sbcs",chars:"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ "},ibm866:"cp866",csibm866:"cp866",cp869:{type:"_sbcs",chars:"������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄±υφχ§ψ΅°¨ωϋΰώ■ "},ibm869:"cp869",csibm869:"cp869",cp922:{type:"_sbcs",chars:"
¡¢£¤¥¦§¨©ª«¬®‾°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖרÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ"},ibm922:"cp922",csibm922:"cp922",cp1046:{type:"_sbcs",chars:"ﺈ×÷ﹱ■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ�"},ibm1046:"cp1046",csibm1046:"cp1046",cp1124:{type:"_sbcs",chars:"
ЁЂҐЄЅІЇЈЉЊЋЌЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ"},ibm1124:"cp1124",csibm1124:"cp1124",cp1125:{type:"_sbcs",chars:"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ "},ibm1125:"cp1125",csibm1125:"cp1125",cp1129:{type:"_sbcs",chars:"
¡¢£¤¥¦§œ©ª«¬®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"},ibm1129:"cp1129",csibm1129:"cp1129",cp1133:{type:"_sbcs",chars:"
ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�"},ibm1133:"cp1133",csibm1133:"cp1133",cp1161:{type:"_sbcs",chars:"��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ "},ibm1161:"cp1161",csibm1161:"cp1161",cp1162:{type:"_sbcs",chars:"€…‘’“”•–— กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"},ibm1162:"cp1162",csibm1162:"cp1162",cp1163:{type:"_sbcs",chars:"
¡¢£€¥¦§œ©ª«¬®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"},ibm1163:"cp1163",csiLine truncated
|
||||
\v\f\r\x0E\x0F\x10ỨỰỲỶỸÝỴ\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ`},georgianacademy:{type:"_sbcs",chars:"‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ"},georgianps:{type:"_sbcs",chars:"‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"},pt154:{type:"_sbcs",chars:"ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө¶·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"},viscii:{type:"_sbcs",chars:`\x00\x01Ẳ\x03\x04ẴẪ\x07\b
|
||||
\v\f\r\x0E\x0F\x10\x11\x12\x13Ỷ\x15\x16\x17\x18Ỹ\x1A\x1B\x1C\x1DỴ\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ`},iso646cn:{type:"_sbcs",chars:`\x00\x01\x02\x03\x04\x05\x06\x07\b
|
||||
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������`},iso646jp:{type:"_sbcs",chars:`\x00\x01\x02\x03\x04\x05\x06\x07\b
|
||||
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_\`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������`},hproman8:{type:"_sbcs",chars:"
ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¶¾—¼½ªº«■»±�"},macintosh:{type:"_sbcs",chars:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"},ascii:{type:"_sbcs",chars:"��������������������������������������������������������������������������������������������������������������������������������"},tis620:{type:"_sbcs",chars:"���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"}}});var wT0=j((sT1)=>{var Um=r3().Buffer;sT1._dbcs=t3;var W8=-1,FT0=-2,Q5=-10,c8=-1000,Ez=Array(256),Hq=-1;for(Gq=0;Gq<256;Gq++)Ez[Gq]=W8;var Gq;function t3($,Y){if(this.encodingName=$.encodingName,!$)throw Error("DBCS codec is called without the data.");if(!$.table)throw Error("Encoding '"+this.encodingName+"' has no data.");var U=$.table();this.decodeTables=[],this.decodeTables[0]=Ez.slice(0),this.decodeTableSeq=[];for(var Q=0;Q<U.length;Q++)this._addDecodeChunk(U[Q]);if(typeof $.gb18030==="function"){this.gb18030=$.gb18030();var I=this.decodeTables.length;this.decodeTables.push(Ez.slice(0));var J=this.decodeTables.length;this.decodeTables.push(Ez.slice(0));var K=this.decodeTables[0];for(var Q=129;Q<=254;Q++){var z=this.decodeTables[c8-K[Q]];for(var G=48;G<=57;G++){if(z[G]===W8)z[G]=c8-I;else if(z[G]>c8)throw Error("gb18030 decode tables conflict at byte 2");var H=this.decodeTables[c8-z[G]];for(var W=129;W<=254;W++){if(H[W]===W8)H[W]=c8-J;else if(H[W]===c8-J)continue;else if(H[W]>c8)throw Error("gb18030 decode tables conflict at byte 3");var X=this.decodeTables[c8-H[W]];for(var Z=48;Z<=57;Z++)if(X[Z]===W8)X[Z]=FT0}}}}this.defaultCharUnicode=Y.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var q={};if($.encodeSkipVals)for(var Q=0;Q<$.encodeSkipVals.length;Q++){var V=$.encodeSkipVals[Q];if(typeof V==="number")q[V]=!0;else for(var G=V.from;G<=V.to;G++)q[G]=!0}if(this._fillEncodeTable(0,0,q),$.encodeAdd){for(var w in $.encodeAdd)if(Object.prototype.hasOwnProperty.call($.encodeAdd,w))this._setEncodeChar(w.charCodeAt(0),$.encodeAdd[w])}if(this.defCharSB=this.encodeTable[0][Y.defaultCharSingleByte.charCodeAt(0)],this.defCharSB===W8)this.defCharSB=this.encodeTable[0]["?"];if(this.defCharSB===W8)this.defCharSB=63}t3.prototype.encoder=mP;t3.prototype.decoder=Qm;t3.prototype._getDecodeTrieNode=function($){var Y=[];for(;$>0;$>>>=8)Y.push($&255);if(Y.length==0)Y.push(0);var U=this.decodeTables[0];for(var Q=Y.length-1;Q>0;Q--){var I=U[Y[Q]];if(I==W8)U[Y[Q]]=c8-this.decodeTables.length,this.decodeTables.push(U=Ez.slice(0));else if(I<=c8)U=this.decodeTables[c8-I];else throw Error("Overwrite byte in "+this.encodingName+", addr: "+$.toString(16))}return U};t3.prototype._addDecodeChunk=function($){var Y=parseInt($[0],16),U=this._getDecodeTrieNode(Y);Y=Y&255;for(var Q=1;Q<$.length;Q++){var I=$[Q];if(typeof I==="string")for(var J=0;J<I.length;){var K=I.charCodeAt(J++);if(K>=55296&&K<56320){var z=I.charCodeAt(J++);if(z>=56320&&z<57344)U[Y++]=65536+(K-55296)*1024+(z-56320);else throw Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+$[0])}else if(K>4080&&K<=4095){var G=4095-K+2,H=[];for(var W=0;W<G;W++)H.push(I.charCodeAt(J++));U[Y++]=Q5-this.decodeTableSeq.length,this.decodeTableSeq.push(H)}else U[Y++]=K}else if(typeof I==="number"){var X=U[Y-1]+1;for(var J=0;J<I;J++)U[Y++]=X++}else throw Error("Incorrect type '"+typeof I+"' given in "+this.encodingName+" at chunk "+$[0])}if(Y>255)throw Error("Incorrect chunk in "+this.encoLine truncated
|
||||
`;super(Y);this.name="AggregateError",this.errors=$}}EE0.exports={AggregateError:TE0,ArrayIsArray($){return Array.isArray($)},ArrayPrototypeIncludes($,Y){return $.includes(Y)},ArrayPrototypeIndexOf($,Y){return $.indexOf(Y)},ArrayPrototypeJoin($,Y){return $.join(Y)},ArrayPrototypeMap($,Y){return $.map(Y)},ArrayPrototypePop($,Y){return $.pop(Y)},ArrayPrototypePush($,Y){return $.push(Y)},ArrayPrototypeSlice($,Y,U){return $.slice(Y,U)},Error,FunctionPrototypeCall($,Y,...U){return $.call(Y,...U)},FunctionPrototypeSymbolHasInstance($,Y){return Function.prototype[Symbol.hasInstance].call($,Y)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties($,Y){return Object.defineProperties($,Y)},ObjectDefineProperty($,Y,U){return Object.defineProperty($,Y,U)},ObjectGetOwnPropertyDescriptor($,Y){return Object.getOwnPropertyDescriptor($,Y)},ObjectKeys($){return Object.keys($)},ObjectSetPrototypeOf($,Y){return Object.setPrototypeOf($,Y)},Promise,PromisePrototypeCatch($,Y){return $.catch(Y)},PromisePrototypeThen($,Y,U){return $.then(Y,U)},PromiseReject($){return Promise.reject($)},PromiseResolve($){return Promise.resolve($)},ReflectApply:Reflect.apply,RegExpPrototypeTest($,Y){return $.test(Y)},SafeSet:Set,String,StringPrototypeSlice($,Y,U){return $.slice(Y,U)},StringPrototypeToLowerCase($){return $.toLowerCase()},StringPrototypeToUpperCase($){return $.toUpperCase()},StringPrototypeTrim($){return $.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet($,Y,U){return $.set(Y,U)},Boolean,Uint8Array}});var Em=j((e94,jE0)=>{jE0.exports={format($,...Y){return $.replace(/%([sdifj])/g,function(...[U,Q]){let I=Y.shift();if(Q==="f")return I.toFixed(6);else if(Q==="j")return JSON.stringify(I);else if(Q==="s"&&typeof I==="object")return`${I.constructor!==Object?I.constructor.name:""} {}`.trim();else return I.toString()})},inspect($){switch(typeof $){case"string":if($.includes("'")){if(!$.includes('"'))return`"${$}"`;else if(!$.includes("`")&&!$.includes("${"))return`\`${$}\``}return`'${$}'`;case"number":if(isNaN($))return"NaN";else if(Object.is($,-0))return String($);return $;case"bigint":return`${String($)}n`;case"boolean":case"undefined":return String($);case"object":return"{}"}}}});var C8=j(($34,vE0)=>{var{format:nj1,inspect:aP}=Em(),{AggregateError:dj1}=c4(),pj1=globalThis.AggregateError||dj1,mj1=Symbol("kIsNodeError"),lj1=["string","function","number","object","Function","Object","boolean","bigint","symbol"],oj1=/^([A-Z][a-z0-9]*)+$/,eP={};function CQ($,Y){if(!$)throw new eP.ERR_INTERNAL_ASSERTION(Y)}function CE0($){let Y="",U=$.length,Q=$[0]==="-"?1:0;for(;U>=Q+4;U-=3)Y=`_${$.slice(U-3,U)}${Y}`;return`${$.slice(0,U)}${Y}`}function rj1($,Y,U){if(typeof Y==="function")return CQ(Y.length<=U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${Y.length}).`),Y(...U);let Q=(Y.match(/%[dfijoOs]/g)||[]).length;if(CQ(Q===U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${Q}).`),U.length===0)return Y;return nj1(Y,...U)}function X8($,Y,U){if(!U)U=Error;class Q extends U{constructor(...I){super(rj1($,Y,I))}toString(){return`${this.name} [${$}]: ${this.message}`}}Object.defineProperties(Q.prototype,{name:{value:U.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${$}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),Q.prototype.code=$,Q.prototype[mj1]=!0,eP[$]=Q}function RE0($){let Y="__node_internal_"+$.name;return Object.defineProperty($,"name",{value:Y}),$}function sj1($,Y){if($&&Y&&$!==Y){if(Array.isArray(Y.errors))return Y.errors.push($),Y;let U=new pj1([Y,$],Y.message);return U.code=Y.code,U}return $||Y}class _E0 extends Error{constructor($="The operation was aborted",Y=void 0){if(Y!==void 0&&typeof Y!=="object")throw new eP.ERR_INVALID_ARG_TYPE("options","Object",Y);super($,Y);this.code="ABORT_ERR",this.name="AbortError"}}X8("ERR_ASSERTION","%s",Error);X8("ERR_INVALID_ARG_TYPE",($,Y,U)=>{if(CQ(typeof $==="string","'name' must be a string"),!Array.isArray(Y))Y=[Y];let Q="The ";if($.endsWith(" argument"))Q+=`${$} `;else Q+=`"${$}" ${$.includes(".")?"property":"argument"} `;Q+="must be ";let I=[],J=[],K=[];for(let G of Y)if(CQ(typeof G==="string","All expected entries have to be of type string"),lj1.includes(G))I.push(G.toLowerCase());else if(oj1.test(G))J.push(G);else CQ(G!=="object",'The value "object" should be written as "Object"'),K.push(G);if(J.length>0){let G=I.indexOf("object");if(G!==-1)I.splice(I,G,1),J.push("Object")}if(I.length>0){switch(I.length){case 1:Q+=`of type ${I[Line truncated
|
||||
`);if(Y.linkname)U+=Uo(" linkpath="+Y.linkname+`
|
||||
`);let Q=Y.pax;if(Q)for(let I in Q)U+=Uo(" "+I+"="+Q[I]+`
|
||||
`);return p1.from(U)};lg1.decodePax=function(Y){let U={};while(Y.length){let Q=0;while(Q<Y.length&&Y[Q]!==32)Q++;let I=parseInt(p1.toString(Y.subarray(0,Q)),10);if(!I)return U;let J=p1.toString(Y.subarray(Q+1,I-1)),K=J.indexOf("=");if(K===-1)return U;U[J.slice(0,K)]=J.slice(K+1),Y=Y.subarray(I)}return U};lg1.encode=function(Y){let U=p1.alloc(512),Q=Y.name,I="";if(Y.typeflag===5&&Q[Q.length-1]!=="/")Q+="/";if(p1.byteLength(Q)!==Q.length)return null;while(p1.byteLength(Q)>100){let J=Q.indexOf("/");if(J===-1)return null;I+=I?"/"+Q.slice(0,J):Q.slice(0,J),Q=Q.slice(J+1)}if(p1.byteLength(Q)>100||p1.byteLength(I)>155)return null;if(Y.linkname&&p1.byteLength(Y.linkname)>100)return null;if(p1.write(U,Q),p1.write(U,JY(Y.mode&4095,6),100),p1.write(U,JY(Y.uid,6),108),p1.write(U,JY(Y.gid,6),116),pg1(Y.size,U,124),p1.write(U,JY(Y.mtime.getTime()/1000|0,11),136),U[156]=48+ng1(Y.type),Y.linkname)p1.write(U,Y.linkname,157);if(p1.copy(Yv0,U,257),p1.copy(kg1,U,263),Y.uname)p1.write(U,Y.uname,265);if(Y.gname)p1.write(U,Y.gname,297);if(p1.write(U,JY(Y.devmajor||0,6),329),p1.write(U,JY(Y.devminor||0,6),337),I)p1.write(U,I,345);return p1.write(U,JY(Qv0(U),6),148),U};lg1.decode=function(Y,U,Q){let I=Y[156]===0?0:Y[156]-48,J=mz(Y,0,100,U),K=IY(Y,100,8),z=IY(Y,108,8),G=IY(Y,116,8),H=IY(Y,124,12),W=IY(Y,136,12),X=cg1(I),Z=Y[157]===0?null:mz(Y,157,100,U),q=mz(Y,265,32),V=mz(Y,297,32),w=IY(Y,329,8),M=IY(Y,337,8),F=Qv0(Y);if(F===256)return null;if(F!==IY(Y,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(ug1(Y)){if(Y[345])J=mz(Y,345,155,U)+"/"+J}else if(bg1(Y));else if(!Q)throw Error("Invalid tar header: unknown format.");if(I===0&&J&&J[J.length-1]==="/")I=5;return{name:J,mode:K,uid:z,gid:G,size:H,byteOffset:0,mtime:new Date(1000*W),type:X,linkname:Z,uname:q,gname:V,devmajor:w,devminor:M,pax:null}};function ug1($){return p1.equals(Yv0,$.subarray(257,263))}function bg1($){return p1.equals(xg1,$.subarray(257,263))&&p1.equals(fg1,$.subarray(263,265))}function ig1($,Y,U){if(typeof $!=="number")return U;if($=~~$,$>=Y)return Y;if($>=0)return $;if($+=Y,$>=0)return $;return 0}function cg1($){switch($){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 ng1($){switch($){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 Uv0($,Y,U,Q){for(;U<Q;U++)if($[U]===Y)return U;return Q}function Qv0($){let Y=256;for(let U=0;U<148;U++)Y+=$[U];for(let U=156;U<512;U++)Y+=$[U];return Y}function JY($,Y){if($=$.toString(8),$.length>Y)return"7777777777777777777".slice(0,Y)+" ";return"0000000000000000000".slice(0,Y-$.length)+$+" "}function dg1($,Y,U){Y[U]=128;for(let Q=11;Q>0;Q--)Y[U+Q]=$&255,$=Math.floor($/256)}function pg1($,Y,U){if($.toString(8).length>11)dg1($,Y,U);else p1.write(Y,JY($,11),U)}function mg1($){let Y;if($[0]===128)Y=!0;else if($[0]===255)Y=!1;else return null;let U=[],Q;for(Q=$.length-1;Q>0;Q--){let K=$[Q];if(Y)U.push(K);else U.push(255-K)}let I=0,J=U.length;for(Q=0;Q<J;Q++)I+=U[Q]*Math.pow(256,Q);return Y?I:-1*I}function IY($,Y,U){if($=$.subarray(Y,Y+U),Y=0,$[Y]&128)return mg1($);else{while(Y<$.length&&$[Y]===32)Y++;let Q=ig1(Uv0($,32,Y,$.length),$.length,$.length);while(Y<Q&&$[Y]===0)Y++;if(Q===Y)return 0;return parseInt(p1.toString($.subarray(Y,Q)),8)}}function mz($,Y,U,Q){return p1.toString($.subarray(Y,Uv0($,0,Y,Y+U)),Q)}function Uo($){let Y=p1.byteLength($),U=Math.floor(Math.log(Y)/Math.log(10))+1;if(Y+U>=Math.pow(10,U))U++;return Y+U+$}});var Xv0=j((d74,Wv0)=>{var{Writable:eg1,Readable:$y1,getStreamError:Iv0}=Yo(),Yy1=ll(),Jv0=pz(),lz=Qo(),Uy1=Jv0.alloc(0);class Kv0{constructor(){this.buffered=0,this.shifted=0,this.queue=new Yy1,this._offset=0}push($){this.buffered+=$.byteLength,this.queue.push($)}shiftFirst($){return this.buffered===0?null:this._next($)}shift($){if($>this.buffered)return null;if($===0)return Uy1;let Y=this._next($);if($===Y.byteLength)return Y;let U=[Y];while(($-=Y.byteLength)>0)Y=this._next($),U.push(Y);return Jv0.concat(U)}_next($){let Y=this.queue.peek(),U=Y.byteLength-this._offset;if($>=U){let Q=this._offset?Y.subarray(this._offset,Y.byteLength):Y;return this.queue.shift(),this._offset=0,this.buffered-=U,this.shifted+=U,Q}return this.buffered-=$,this.shifted+=$,Y.subarray(this._offset,this._offset+=$)}}class zv0 extends $y1{constructor($,Y,U){super();this.header=Y,this.offset=U,this._parent=$}_read($){if(this.header.size===0)this.push(null);if(this._parent._stream===this)this._parent._update();$(null)}_predestroy(){this._parent.destroy(Iv0(this))}_detach(){if(this._parent._stream=
Line truncated
|
||||
`),Q=[await W4($,U.recordId)];else if(U.recordIds&&U.recordIds.length>0)process.stderr.write(`\uD83D\uDD0D 批量查询 ${U.recordIds.length} 条单据记录...
|
||||
`),Q=await Promise.all(U.recordIds.map((F)=>W4($,F)));else{let F=U.limit??10;process.stderr.write(`\uD83D\uDD0D 检索企业「${Y.name}」(${Y.id}) 的线上审核记录 (限制 ${F} 条)...
|
||||
`);let O=(await u4($,{limit:F,status:U.status,startDate:U.startDate!==void 0?String(U.startDate):void 0,endDate:U.endDate!==void 0?String(U.endDate):void 0})).records??[];if(O.length===0)throw Error("未检索到符合条件的线上审核记录,无法导出 webhook 资源包。");process.stderr.write(`\uD83D\uDCE5 正在拉取 ${O.length} 条审核记录完整详情...
|
||||
`),Q=await Promise.all(O.map((D)=>W4($,D.id)))}let I=new Map,J=0;for(let F of Q){let N=F.document,O=F.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??F.documentId??F.id,D=`${U.docIdPrefix??""}${O}${U.docIdSuffix??""}`,P=[];if(U.includeAttachments!==!1){let A=p3(F,{summary:!1}).attachments,E=new Set;for(let C of A){let i=C.ossSignedUrl??C.url;if(!i)continue;let x=C.fileName??C.fileId??"attachment",h=hd(x),b=h,n=h.lastIndexOf("."),Q0=n>0?h.slice(0,n):h,k=n>0?h.slice(n):"",m=1;while(E.has(b.toLowerCase()))b=`${Q0}_${m}${k}`,m++;E.add(b.toLowerCase());try{process.stderr.write(`⬇ 下载单据「${D}」附件: ${x}...
|
||||
`);let a=await fetch(i);if(a.ok){let $0=await a.arrayBuffer(),g=Buffer.from($0);P.push({fileName:b,zipPath:`${D}/${b}`,buffer:g,sourceField:C.sourceField??"附件"}),J++}}catch(a){process.stderr.write(`⚠️ [跳过附件] 下载失败 ${x}: ${a}
|
||||
`)}}}I.set(D,P)}let K=new Rv0.default.Workbook;K.creator="seal-use",K.created=new Date;let z=new Set;for(let F of I.values())for(let N of F)z.add(N.sourceField);if(z.size===0)z.add("附件");let G=new Set;for(let F of Q){let N=F.document,O=Array.isArray(N?.fields)?N.fields:[];for(let D of O)if(D&&typeof D==="object"){let P=D,T=typeof P.label==="string"?P.label.trim():typeof P.key==="string"?P.key.trim():"",A=typeof P.type==="string"?P.type.toUpperCase():"";if(T&&A!=="ATTACHMENT"&&A!=="LIST")G.add(T)}}let H=["会议编号","会议名称","状态","总金额","报销事由","申请日期"],W=Array.from(G).filter((F)=>!H.includes(F)&&F!=="单据编号"&&F!=="单号"),X=Array.from(z).map((F)=>`[附件]${F}`),Z=[...H,...W,...X],q=K.addWorksheet("主表");q.addRow(Z),q.getRow(1).font={bold:!0};for(let F of Q){let N=F.document,O=F.sourceDocumentSN??(typeof N?.sn==="string"?N.sn:void 0)??(typeof N?.sourceDocumentSN==="string"?N.sourceDocumentSN:void 0)??F.id,D=F.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??F.documentId??F.id,P=`${U.docIdPrefix??""}${D}${U.docIdSuffix??""}`,T=`${U.docIdPrefix??""}${O}${U.docIdSuffix??""}`,A=(typeof N?.title==="string"?N.title:void 0)??(typeof N?.name==="string"?N.name:void 0)??T,E="";if(typeof N?.sourceStartTime==="number")E=new Date(N.sourceStartTime*1000).toLocaleDateString("en-CA",{timeZone:"Asia/Shanghai"});else if(typeof F.createdAt==="number")E=new Date(F.createdAt).toLocaleDateString("en-CA",{timeZone:"Asia/Shanghai"});else if(typeof F.createdAt==="string")E=F.createdAt.slice(0,10);let C=new Map,i=Array.isArray(N?.fields)?N.fields:[];for(let Q0 of i)if(Q0&&typeof Q0==="object"){let k=Q0,m=typeof k.label==="string"?k.label.trim():typeof k.key==="string"?k.key.trim():"";if(m)C.set(m,k.value)}let x,h=C.get("总金额")??C.get("报销金额")??C.get("total_amount");if(typeof h==="number")x=h;else if(h&&typeof h==="object"&&"amount"in h&&typeof h.amount==="number")x=h.amount;let b=[];b.push(P),b.push(A),b.push(F.status??"已审批"),b.push(x??""),b.push(C.get("报销事由")??C.get("事由")??A),b.push(E);for(let Q0 of W){let k=C.get(Q0);if(k===void 0||k===null)b.push("");else if(typeof k==="object")if("amount"in k)b.push(k.amount);else b.push(JSON.stringify(k));else b.push(k)}let n=I.get(P)??[];for(let Q0 of z){let k=n.filter((m)=>m.sourceField===Q0||z.size===1);if(k.length>0)b.push(k.map((m)=>m.zipPath).join(`
|
||||
`));else b.push("")}q.addRow(b)}let V=Dy1(U,Y);Fy1(Oy1(V),{recursive:!0});let w=await K.xlsx.writeBuffer();process.stderr.write(`\uD83D\uDCE6 正在压缩生成 Webhook 资源包: ${V}...
|
||||
`),await new Promise((F,N)=>{let O=Ly1(V),D=new Go({zlib:{level:9}});O.on("close",()=>F()),D.on("error",(P)=>N(P)),D.pipe(O),D.append(Buffer.from(w),{name:"信息表.xlsx"});for(let P of I.values())for(let T of P)D.append(T.buffer,{name:T.zipPath});D.finalize()});let M=wy1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:Q.length,attachmentCount:J,fileSizeBytes:M.size,exportedAt:A1(),nextAction:`seal-use webhook resource-pack push ${V} --corp <targetCorpId>`}}var Rv0;var Ho=o(()=>{jv0();X4();nZ();Rv0=H6(iZ(),1)});import{readFileSync as Ay1}from"node:fs";function By1($){let Y=new URL($),U=Y.pathname.match(/\/webhook\/([^/]+)/);if(!U)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${Y.protocol}//${Y.host}`,webhookId:U[1]}}function Py1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function Ty1($,Y){if(!$.length)return;let U=new Set($.map((J)=>{let K=J.fileName.split("/")[0],z=K.indexOf("@");return z>=0?K.slice(0,z):K}).filter((J)=>J!=="信息表.xlsx")),Q=[];for(let J of Y){let K=J.document.documentId;if((J.documentAttachments.length>0||Object.values(J.expenseAttachments).some((G)=>G.length>0)||Object.values(J.personAttachments).some((G)=>G.length>0))&&!U.has(K))Q.push(`Excel 会议编号「${K}」声明了附件,但在 ZIP 中找不到对应的根目录「${K}/」或「${K}@.../」。`)}let I=new Set(Y.map((J)=>J.document.documentId));for(let J of U)if(!I.has(J))Q.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(Q.length)throw new y5(Q)}async function _v0($,Y,U){let Q=[],I=$;if(Py1($,Y)){Q=await bT0($),cT0(Q,U);let G=Q.find((H)=>H.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");I=await Hm($,G)}let J=await rT0(I);Ty1(Q,J);let K=sT0(Q,J),z=J.map((G)=>G.document);return{entries:Q,parsed:J,plans:K,documents:z,fileBuffer:$}}async function mQ($,Y,U){let Q=await _v0($,Y,U),I=Q.parsed.map((J,K)=>Lm(J.document,Q.plans[K],new Map));return{warnings:[],documents:I,attachmentPlan:Q.plans}}async function cT($,Y,U){let Q=await _v0($,Y,U.materialPackFilePolicy),{baseUrl:I,webhookId:J}=By1(U.webhookUrl),K=[];for(let z=0;z<Q.parsed.length;z+=1){let G=Q.parsed[z],H=Q.plans[z],W=new Map,X=[...H.categoryFields,...Object.values(H.personAttachments).flat(),...Object.values(H.expenseAttachments).flat()];for(let V of X)for(let w of V.paths){if(W.has(w))continue;let M=Q.entries.find((T)=>T.fileName===w);if(!M)continue;process.stderr.write(`⬆ 上传附件: ${w}
|
||||
`);let F=new FormData,N=await Hm(Q.fileBuffer,M),O=w.split("/").pop()??w;F.append("files",new File([new Uint8Array(N)],O));let D=await fetch(`${I}/api/v1/integrations/webhook/${encodeURIComponent(J)}/attachments`,{method:"POST",headers:{...U.customHeaders??{},...Qq({},U.secret)},body:F});if(!D.ok)throw Error(`附件上传失败 ${D.status}: ${await D.text()}`);let P=await D.json();W.set(w,P.attachments?.map((T)=>T.data)??(P.data===void 0?[]:[P.data])),process.stderr.write(`✓ 附件上传成功: ${w}
|
||||
`)}process.stderr.write(`\uD83D\uDCE4 推送单据: ${G.document.documentId}
|
||||
`);let Z=Lm(G.document,H,W),q=await fetch(`${I}/api/v1/integrations/webhook/${encodeURIComponent(J)}/document`,{method:"POST",headers:{...U.customHeaders??{},"Content-Type":"application/json",...Qq({webhookId:J,...Z},U.secret)},body:JSON.stringify(Z)});if(!q.ok)throw Error(`Webhook 单据推送失败 ${q.status}: ${await q.text()}`);K.push({documentId:Z.documentId,document:Z,pushResult:await q.json()}),process.stderr.write(`✓ 单据推送成功: ${Z.documentId}
|
||||
`)}return{warnings:[],results:K}}function lQ($){return{fileBuffer:Ay1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}var Wo=o(()=>{RP();Fm();Vm();Wm();wz();Ho()});import{existsSync as Ey1}from"node:fs";async function nT($,Y,U={}){let I=T4().stateful?"stateful":"stateless",J="ok",K,z,G;try{let D=await t6($);G={id:D.user.id,name:D.user.name,isAdmin:D.user.isAdmin},z={id:D.tenant.id,name:D.tenant.name,tenantSlug:D.tenant.tenantSlug,corporationName:D.tenant.hoseCorpConfig?.corporationName}}catch(D){J="error",K=D instanceof Error?D.message:String(D)}let H=[];if(J==="ok")try{H=await F$($,Y.seal.endpoints.approvalStylePreferences)}catch(D){J="error",K=`读取 Webhook 配置失败: ${D instanceof Error?D.message:String(D)}`}let W=H.length===1,X=H.map((D)=>({id:D.id,name:D.name,mode:D.mode,incomingDocumentWebhookUrl:D.incomingDocumentWebhook.url,outgoingResultWebhookUrl:D.outgoingResultWebhook,autoApprovalRate:D.autoApprovalRate,...W?{isDefault:!0}:{}})),Z=W?{id:H[0].id,name:H[0].name,mode:H[0].mode}:null,q=U.webhook?p7(H,U.webhook):W?H[0]:void 0,V;if(U.filePath)if(!Ey1(U.filePath))V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在: ${U.filePath}`]};else try{let D=lQ(U.filePath),P=await mQ(D.fileBuffer,D.fileName,q?.materialPackFilePolicy);V={valid:!0,filePath:U.filePath,fileName:D.fileName,documentCount:P.documents.length,warnings:P.warnings}}catch(D){V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[D instanceof Error?D.message:String(D)]}}let w=V?V.valid:!0,M=J==="ok"&&X.length>0&&w,F=I==="stateful"?"":` --corp ${Y.id}`,N="",O="";if(J!=="ok")O=`凭证鉴权异常: ${K}`,N=`seal-use auth diagnose${F}`;else if(X.length===0)O="当前企业尚未配置任何 Webhook 集成通道",N=`seal-use webhook add --name "默认入站通道" --result-url "https://your-domain.com/callback"${F}`;else if(V&&!V.valid)O=`资源包预检失败: ${V.errors?.join("; ")}`,N=`seal-use webhook resource-pack preview ${V.filePath}${F}`;else{O=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到 ${X.length} 个 Webhook 通道,等待载入`;let D=V?.filePath??"<资源包.zip>",P=W?"":` --webhook ${Z?Z.id:"<webhookIdOrName>"}`;N=`seal-use webhook resource-pack push ${D}${P}${F}`}return{ready:M,corp:{id:Y.id,name:Y.name,sourceType:Y.source.type,tenant:z,user:G},stateMode:I,authStatus:J,authError:K,activeWebhooks:X,defaultWebhook:Z,resourcePack:V,materialPack:V,statusMessage:O,nextAction:N}}var vv0=o(()=>{a$();X4();Wo()});var Xo=o(()=>{wz();JJ();RP();Wm();Vm();Fm();Wo();vv0();Ho()});var uq,jy1,l24,o24,r24,s24,t24,a24,e24,$Y4,Zo,YY4,UY4,QY4,IY4,JY4,KY4,zY4,GY4,HY4,WY4,XY4,ZY4,qY4,VY4,LY4,FY4,wY4,MY4,OY4,NY4,DY4,AY4,BY4,PY4,TY4,EY4,jY4,CY4,RY4,_Y4,vY4,SY4,hY4,gY4,yY4,kY4,xY4,fY4,uY4,bY4,iY4,cY4,nY4,dY4,pY4,mY4,lY4,oY4,rY4,sY4,tY4,aY4,eY4,$U4,YU4,UU4,QU4,IU4,JU4,KU4,Sv0;var hv0=o(()=>{W6();X4();a$();i6();Jq();Xo();JJ();$5();({presentWebhookIntegration:uq,getConfiguredSealBaseUrl:jy1,projectApprovalRules:l24,pickRuleFields:o24,buildRulePushPlan:r24,rulesHaveSameContent:s24,ruleChangedFields:t24,normalizeRuleStrictness:a24,parseDurationMs:e24,redactIntegrationSecrets:$Y4,mutationPreview:Zo,redactPreviewValue:YY4,buildSimulationBatchParams:UY4,summarizeSimulationBatch:QY4,summarizeApprovalRun:IY4,summarizeApprovalRuns:JY4,parseFieldPaths:KY4,pickRunFields:zY4,approvalRunMetadata:GY4,summarizeApprovalRunDetail:HY4,summarizeApprovalRunResult:WY4,summarizeApprovalRunDocument:XY4,extractCitedRules:ZY4,firstPath:qY4,countPathCandidates:VY4,getPath:LY4,setPath:FY4,compactObject:wY4,asRecord:MY4,numberFromUnknown:OY4,flattenDocumentFields:NY4,collectDocumentFields:DY4,firstByLabel:AY4,collectInvoiceSummary:BY4,collectInvoiceObjects:PY4,findKeywordLines:TY4,summarizeRunBridge:EY4,summarizeRuleVersion:jY4,resolveRuleVersionForLookup:CY4,findRuleInVersion:RY4,normalizeRuleCode:_Y4,runtimeRuleIndex:vY4,runtimeRuleIdToCode:SY4,formatRuleCode:hY4,pickApprovalRunCandidate:gY4,resolveApprovalRunForUrl:yY4,resolveSealBaseUrl:kY4,normalizeUrl:xY4,stringFromUnknown:fY4,pickApprovalRuns:uY4,timestampOf:bY4,resolveRuleVersion:iY4,resolveRuleVersionSelector:cY4,filterRuns:nY4,scalarIncludes:dY4,objectContainsScalar:pY4,filterRunsByHumanResult:mY4,withApprovalRunFilters:lY4,resolveManualApprovalStatus:oY4,prepareApprovalRuns:rY4,approvalRunAliases:sY4,extractHumanResult:tY4,findHumanResultValue:aY4,isHumanResultKey:eY4,stringifyHumanResultValue:$U4,matchesRunLookup:YU4,countBy:UU4,localDateKey:QU4,formatLocalDateTime:IU4,toDate:JU4,localParts:KU4}=H8),Sv0=[{name:"seal_webhook_list",description:"列出当前 Seal 租户的 Webhook 集成,可按 ID、名称或 URL 查找",parameters:L.object({query:L.string().optional().describe("按集成 ID、名称或 URL 做本地包含匹配"),includeSecret:L.boolean().optional().describe("是否返回 Webhook secret;默认遮罩")}
Line truncated
|
||||
`+`• 身份主体:${T}${A}
|
||||
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_\`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������`},hproman8:{type:"_sbcs",chars:"
ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¶¾—¼½ªº«■»±�"},macintosh:{type:"_sbcs",chars:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"},ascii:{type:"_sbcs",chars:"��������������������������������������������������������������������������������������������������������������������������������"},tis620:{type:"_sbcs",chars:"���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"}}});var cT0=E((bj1)=>{var Bm=r3().Buffer;bj1._dbcs=a3;var X8=-1,iT0=-2,Q5=-10,c8=-1000,Rz=Array(256),Fq=-1;for(wq=0;wq<256;wq++)Rz[wq]=X8;var wq;function a3($,Y){if(this.encodingName=$.encodingName,!$)throw Error("DBCS codec is called without the data.");if(!$.table)throw Error("Encoding '"+this.encodingName+"' has no data.");var U=$.table();this.decodeTables=[],this.decodeTables[0]=Rz.slice(0),this.decodeTableSeq=[];for(var Q=0;Q<U.length;Q++)this._addDecodeChunk(U[Q]);if(typeof $.gb18030==="function"){this.gb18030=$.gb18030();var I=this.decodeTables.length;this.decodeTables.push(Rz.slice(0));var J=this.decodeTables.length;this.decodeTables.push(Rz.slice(0));var K=this.decodeTables[0];for(var Q=129;Q<=254;Q++){var z=this.decodeTables[c8-K[Q]];for(var H=48;H<=57;H++){if(z[H]===X8)z[H]=c8-I;else if(z[H]>c8)throw Error("gb18030 decode tables conflict at byte 2");var G=this.decodeTables[c8-z[H]];for(var W=129;W<=254;W++){if(G[W]===X8)G[W]=c8-J;else if(G[W]===c8-J)continue;else if(G[W]>c8)throw Error("gb18030 decode tables conflict at byte 3");var X=this.decodeTables[c8-G[W]];for(var Z=48;Z<=57;Z++)if(X[Z]===X8)X[Z]=iT0}}}}this.defaultCharUnicode=Y.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var q={};if($.encodeSkipVals)for(var Q=0;Q<$.encodeSkipVals.length;Q++){var V=$.encodeSkipVals[Q];if(typeof V==="number")q[V]=!0;else for(var H=V.from;H<=V.to;H++)q[H]=!0}if(this._fillEncodeTable(0,0,q),$.encodeAdd){for(var w in $.encodeAdd)if(Object.prototype.hasOwnProperty.call($.encodeAdd,w))this._setEncodeChar(w.charCodeAt(0),$.encodeAdd[w])}if(this.defCharSB=this.encodeTable[0][Y.defaultCharSingleByte.charCodeAt(0)],this.defCharSB===X8)this.defCharSB=this.encodeTable[0]["?"];if(this.defCharSB===X8)this.defCharSB=63}a3.prototype.encoder=QT;a3.prototype.decoder=Am;a3.prototype._getDecodeTrieNode=function($){var Y=[];for(;$>0;$>>>=8)Y.push($&255);if(Y.length==0)Y.push(0);var U=this.decodeTables[0];for(var Q=Y.length-1;Q>0;Q--){var I=U[Y[Q]];if(I==X8)U[Y[Q]]=c8-this.decodeTables.length,this.decodeTables.push(U=Rz.slice(0));else if(I<=c8)U=this.decodeTables[c8-I];else throw Error("Overwrite byte in "+this.encodingName+", addr: "+$.toString(16))}return U};a3.prototype._addDecodeChunk=function($){var Y=parseInt($[0],16),U=this._getDecodeTrieNode(Y);Y=Y&255;for(var Q=1;Q<$.length;Q++){var I=$[Q];if(typeof I==="string")for(var J=0;J<I.length;){var K=I.charCodeAt(J++);if(K>=55296&&K<56320){var z=I.charCodeAt(J++);if(z>=56320&&z<57344)U[Y++]=65536+(K-55296)*1024+(z-56320);else throw Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+$[0])}else if(K>4080&&K<=4095){var H=4095-K+2,G=[];for(var W=0;W<H;W++)G.push(I.charCodeAt(J++));U[Y++]=Q5-this.decodeTableSeq.length,this.decodeTableSeq.push(G)}else U[Y++]=K}else if(typeof I==="number"){var X=U[Y-1]+1;for(var J=0;J<I;J++)U[Y++]=X++}else throw Error("Incorrect type '"+typeof I+"' given in "+this.encodingName+" at chunk "+$[0])}if(Y>255)throw Error("Incorrect chunk in "+this.encoLine truncated
|
||||
`;super(Y);this.name="AggregateError",this.errors=$}}aj0.exports={AggregateError:sj0,ArrayIsArray($){return Array.isArray($)},ArrayPrototypeIncludes($,Y){return $.includes(Y)},ArrayPrototypeIndexOf($,Y){return $.indexOf(Y)},ArrayPrototypeJoin($,Y){return $.join(Y)},ArrayPrototypeMap($,Y){return $.map(Y)},ArrayPrototypePop($,Y){return $.pop(Y)},ArrayPrototypePush($,Y){return $.push(Y)},ArrayPrototypeSlice($,Y,U){return $.slice(Y,U)},Error,FunctionPrototypeCall($,Y,...U){return $.call(Y,...U)},FunctionPrototypeSymbolHasInstance($,Y){return Function.prototype[Symbol.hasInstance].call($,Y)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties($,Y){return Object.defineProperties($,Y)},ObjectDefineProperty($,Y,U){return Object.defineProperty($,Y,U)},ObjectGetOwnPropertyDescriptor($,Y){return Object.getOwnPropertyDescriptor($,Y)},ObjectKeys($){return Object.keys($)},ObjectSetPrototypeOf($,Y){return Object.setPrototypeOf($,Y)},Promise,PromisePrototypeCatch($,Y){return $.catch(Y)},PromisePrototypeThen($,Y,U){return $.then(Y,U)},PromiseReject($){return Promise.reject($)},PromiseResolve($){return Promise.resolve($)},ReflectApply:Reflect.apply,RegExpPrototypeTest($,Y){return $.test(Y)},SafeSet:Set,String,StringPrototypeSlice($,Y,U){return $.slice(Y,U)},StringPrototypeToLowerCase($){return $.toLowerCase()},StringPrototypeToUpperCase($){return $.toUpperCase()},StringPrototypeTrim($){return $.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet($,Y,U){return $.set(Y,U)},Boolean,Uint8Array}});var lm=E((l94,tj0)=>{tj0.exports={format($,...Y){return $.replace(/%([sdifj])/g,function(...[U,Q]){let I=Y.shift();if(Q==="f")return I.toFixed(6);else if(Q==="j")return JSON.stringify(I);else if(Q==="s"&&typeof I==="object")return`${I.constructor!==Object?I.constructor.name:""} {}`.trim();else return I.toString()})},inspect($){switch(typeof $){case"string":if($.includes("'")){if(!$.includes('"'))return`"${$}"`;else if(!$.includes("`")&&!$.includes("${"))return`\`${$}\``}return`'${$}'`;case"number":if(isNaN($))return"NaN";else if(Object.is($,-0))return String($);return $;case"bigint":return`${String($)}n`;case"boolean":case"undefined":return String($);case"object":return"{}"}}}});var C8=E((o94,UE0)=>{var{format:SC1,inspect:GT}=lm(),{AggregateError:gC1}=n4(),yC1=globalThis.AggregateError||gC1,kC1=Symbol("kIsNodeError"),xC1=["string","function","number","object","Function","Object","boolean","bigint","symbol"],fC1=/^([A-Z][a-z0-9]*)+$/,WT={};function RQ($,Y){if(!$)throw new WT.ERR_INTERNAL_ASSERTION(Y)}function ej0($){let Y="",U=$.length,Q=$[0]==="-"?1:0;for(;U>=Q+4;U-=3)Y=`_${$.slice(U-3,U)}${Y}`;return`${$.slice(0,U)}${Y}`}function uC1($,Y,U){if(typeof Y==="function")return RQ(Y.length<=U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${Y.length}).`),Y(...U);let Q=(Y.match(/%[dfijoOs]/g)||[]).length;if(RQ(Q===U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${Q}).`),U.length===0)return Y;return SC1(Y,...U)}function Z8($,Y,U){if(!U)U=Error;class Q extends U{constructor(...I){super(uC1($,Y,I))}toString(){return`${this.name} [${$}]: ${this.message}`}}Object.defineProperties(Q.prototype,{name:{value:U.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${$}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),Q.prototype.code=$,Q.prototype[kC1]=!0,WT[$]=Q}function $E0($){let Y="__node_internal_"+$.name;return Object.defineProperty($,"name",{value:Y}),$}function bC1($,Y){if($&&Y&&$!==Y){if(Array.isArray(Y.errors))return Y.errors.push($),Y;let U=new yC1([Y,$],Y.message);return U.code=Y.code,U}return $||Y}class YE0 extends Error{constructor($="The operation was aborted",Y=void 0){if(Y!==void 0&&typeof Y!=="object")throw new WT.ERR_INVALID_ARG_TYPE("options","Object",Y);super($,Y);this.code="ABORT_ERR",this.name="AbortError"}}Z8("ERR_ASSERTION","%s",Error);Z8("ERR_INVALID_ARG_TYPE",($,Y,U)=>{if(RQ(typeof $==="string","'name' must be a string"),!Array.isArray(Y))Y=[Y];let Q="The ";if($.endsWith(" argument"))Q+=`${$} `;else Q+=`"${$}" ${$.includes(".")?"property":"argument"} `;Q+="must be ";let I=[],J=[],K=[];for(let H of Y)if(RQ(typeof H==="string","All expected entries have to be of type string"),xC1.includes(H))I.push(H.toLowerCase());else if(fC1.test(H))J.push(H);else RQ(H!=="object",'The value "object" should be written as "Object"'),K.push(H);if(J.length>0){let H=I.indexOf("object");if(H!==-1)I.splice(I,H,1),J.push("Object")}if(I.length>0){switch(I.length){case 1:Q+=`of type ${I[Line truncated
|
||||
`);if(Y.linkname)U+=Bo(" linkpath="+Y.linkname+`
|
||||
`);let Q=Y.pax;if(Q)for(let I in Q)U+=Bo(" "+I+"="+Q[I]+`
|
||||
`);return m1.from(U)};xy1.decodePax=function(Y){let U={};while(Y.length){let Q=0;while(Q<Y.length&&Y[Q]!==32)Q++;let I=parseInt(m1.toString(Y.subarray(0,Q)),10);if(!I)return U;let J=m1.toString(Y.subarray(Q+1,I-1)),K=J.indexOf("=");if(K===-1)return U;U[J.slice(0,K)]=J.slice(K+1),Y=Y.subarray(I)}return U};xy1.encode=function(Y){let U=m1.alloc(512),Q=Y.name,I="";if(Y.typeflag===5&&Q[Q.length-1]!=="/")Q+="/";if(m1.byteLength(Q)!==Q.length)return null;while(m1.byteLength(Q)>100){let J=Q.indexOf("/");if(J===-1)return null;I+=I?"/"+Q.slice(0,J):Q.slice(0,J),Q=Q.slice(J+1)}if(m1.byteLength(Q)>100||m1.byteLength(I)>155)return null;if(Y.linkname&&m1.byteLength(Y.linkname)>100)return null;if(m1.write(U,Q),m1.write(U,JY(Y.mode&4095,6),100),m1.write(U,JY(Y.uid,6),108),m1.write(U,JY(Y.gid,6),116),yy1(Y.size,U,124),m1.write(U,JY(Y.mtime.getTime()/1000|0,11),136),U[156]=48+Sy1(Y.type),Y.linkname)m1.write(U,Y.linkname,157);if(m1.copy(jv0,U,257),m1.copy(jy1,U,263),Y.uname)m1.write(U,Y.uname,265);if(Y.gname)m1.write(U,Y.gname,297);if(m1.write(U,JY(Y.devmajor||0,6),329),m1.write(U,JY(Y.devminor||0,6),337),I)m1.write(U,I,345);return m1.write(U,JY(Cv0(U),6),148),U};xy1.decode=function(Y,U,Q){let I=Y[156]===0?0:Y[156]-48,J=rz(Y,0,100,U),K=IY(Y,100,8),z=IY(Y,108,8),H=IY(Y,116,8),G=IY(Y,124,12),W=IY(Y,136,12),X=hy1(I),Z=Y[157]===0?null:rz(Y,157,100,U),q=rz(Y,265,32),V=rz(Y,297,32),w=IY(Y,329,8),M=IY(Y,337,8),F=Cv0(Y);if(F===256)return null;if(F!==IY(Y,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(Ry1(Y)){if(Y[345])J=rz(Y,345,155,U)+"/"+J}else if(_y1(Y));else if(!Q)throw Error("Invalid tar header: unknown format.");if(I===0&&J&&J[J.length-1]==="/")I=5;return{name:J,mode:K,uid:z,gid:H,size:G,byteOffset:0,mtime:new Date(1000*W),type:X,linkname:Z,uname:q,gname:V,devmajor:w,devminor:M,pax:null}};function Ry1($){return m1.equals(jv0,$.subarray(257,263))}function _y1($){return m1.equals(Ey1,$.subarray(257,263))&&m1.equals(Cy1,$.subarray(263,265))}function vy1($,Y,U){if(typeof $!=="number")return U;if($=~~$,$>=Y)return Y;if($>=0)return $;if($+=Y,$>=0)return $;return 0}function hy1($){switch($){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 Sy1($){switch($){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 Ev0($,Y,U,Q){for(;U<Q;U++)if($[U]===Y)return U;return Q}function Cv0($){let Y=256;for(let U=0;U<148;U++)Y+=$[U];for(let U=156;U<512;U++)Y+=$[U];return Y}function JY($,Y){if($=$.toString(8),$.length>Y)return"7777777777777777777".slice(0,Y)+" ";return"0000000000000000000".slice(0,Y-$.length)+$+" "}function gy1($,Y,U){Y[U]=128;for(let Q=11;Q>0;Q--)Y[U+Q]=$&255,$=Math.floor($/256)}function yy1($,Y,U){if($.toString(8).length>11)gy1($,Y,U);else m1.write(Y,JY($,11),U)}function ky1($){let Y;if($[0]===128)Y=!0;else if($[0]===255)Y=!1;else return null;let U=[],Q;for(Q=$.length-1;Q>0;Q--){let K=$[Q];if(Y)U.push(K);else U.push(255-K)}let I=0,J=U.length;for(Q=0;Q<J;Q++)I+=U[Q]*Math.pow(256,Q);return Y?I:-1*I}function IY($,Y,U){if($=$.subarray(Y,Y+U),Y=0,$[Y]&128)return ky1($);else{while(Y<$.length&&$[Y]===32)Y++;let Q=vy1(Ev0($,32,Y,$.length),$.length,$.length);while(Y<Q&&$[Y]===0)Y++;if(Q===Y)return 0;return parseInt(m1.toString($.subarray(Y,Q)),8)}}function rz($,Y,U,Q){return m1.toString($.subarray(Y,Ev0($,0,Y,Y+U)),Q)}function Bo($){let Y=m1.byteLength($),U=Math.floor(Math.log(Y)/Math.log(10))+1;if(Y+U>=Math.pow(10,U))U++;return Y+U+$}});var kv0=E((f74,yv0)=>{var{Writable:ny1,Readable:py1,getStreamError:Rv0}=Po(),dy1=Vo(),_v0=oz(),sz=Ao(),my1=_v0.alloc(0);class vv0{constructor(){this.buffered=0,this.shifted=0,this.queue=new dy1,this._offset=0}push($){this.buffered+=$.byteLength,this.queue.push($)}shiftFirst($){return this.buffered===0?null:this._next($)}shift($){if($>this.buffered)return null;if($===0)return my1;let Y=this._next($);if($===Y.byteLength)return Y;let U=[Y];while(($-=Y.byteLength)>0)Y=this._next($),U.push(Y);return _v0.concat(U)}_next($){let Y=this.queue.peek(),U=Y.byteLength-this._offset;if($>=U){let Q=this._offset?Y.subarray(this._offset,Y.byteLength):Y;return this.queue.shift(),this._offset=0,this.buffered-=U,this.shifted+=U,Q}return this.buffered-=$,this.shifted+=$,Y.subarray(this._offset,this._offset+=$)}}class hv0 extends py1{constructor($,Y,U){super();this.header=Y,this.offset=U,this._parent=$}_read($){if(this.header.size===0)this.push(null);if(this._parent._stream===this)this._parent._update();$(null)}_predestroy(){this._parent.destroy(Rv0(this))}_detach(){if(this._parent._stream=
Line truncated
|
||||
`),Q=[await X4($,U.recordId)];else if(U.recordIds&&U.recordIds.length>0)process.stderr.write(`\uD83D\uDD0D 批量查询 ${U.recordIds.length} 条单据记录...
|
||||
`),Q=await Promise.all(U.recordIds.map((F)=>X4($,F)));else{let F=U.limit??10;process.stderr.write(`\uD83D\uDD0D 检索企业「${Y.name}」(${Y.id}) 的线上审核记录 (限制 ${F} 条)...
|
||||
`);let O=(await b4($,{limit:F,status:U.status,startDate:U.startDate!==void 0?String(U.startDate):void 0,endDate:U.endDate!==void 0?String(U.endDate):void 0})).records??[];if(O.length===0)throw Error("未检索到符合条件的线上审核记录,无法导出 webhook 资源包。");process.stderr.write(`\uD83D\uDCE5 正在拉取 ${O.length} 条审核记录完整详情...
|
||||
`),Q=await Promise.all(O.map((N)=>X4($,N.id)))}let I=new Map,J=0;for(let F of Q){let D=F.document,O=F.sourceDocumentId??(typeof D?.id==="string"?D.id:void 0)??(typeof D?.sourceDocumentId==="string"?D.sourceDocumentId:void 0)??F.documentId??F.id,N=`${U.docIdPrefix??""}${O}${U.docIdSuffix??""}`,B=[];if(U.includeAttachments!==!1){let P=m3(F,{summary:!1}).attachments,j=new Set;for(let C of P){let u=C.ossSignedUrl??C.url;if(!u)continue;let x=C.fileName??C.fileId??"attachment",S=Nd(x),b=S,n=S.lastIndexOf("."),I0=n>0?S.slice(0,n):S,k=n>0?S.slice(n):"",m=1;while(j.has(b.toLowerCase()))b=`${I0}_${m}${k}`,m++;j.add(b.toLowerCase());try{process.stderr.write(`⬇ 下载单据「${N}」附件: ${x}...
|
||||
`);let e=await fetch(u);if(e.ok){let Y0=await e.arrayBuffer(),g=Buffer.from(Y0);B.push({fileName:b,zipPath:`${N}/${b}`,buffer:g,sourceField:C.sourceField??"附件"}),J++}}catch(e){process.stderr.write(`⚠️ [跳过附件] 下载失败 ${x}: ${e}
|
||||
`)}}}I.set(N,B)}let K=new $h0.default.Workbook;K.creator="seal-use",K.created=new Date;let z=new Set;for(let F of I.values())for(let D of F)z.add(D.sourceField);if(z.size===0)z.add("附件");let H=new Set;for(let F of Q){let D=F.document,O=Array.isArray(D?.fields)?D.fields:[];for(let N of O)if(N&&typeof N==="object"){let B=N,A=typeof B.label==="string"?B.label.trim():typeof B.key==="string"?B.key.trim():"",P=typeof B.type==="string"?B.type.toUpperCase():"";if(A&&P!=="ATTACHMENT"&&P!=="LIST")H.add(A)}}let G=["会议编号","会议名称","状态","总金额","报销事由","申请日期"],W=Array.from(H).filter((F)=>!G.includes(F)&&F!=="单据编号"&&F!=="单号"),X=Array.from(z).map((F)=>`[附件]${F}`),Z=[...G,...W,...X],q=K.addWorksheet("主表");q.addRow(Z),q.getRow(1).font={bold:!0};for(let F of Q){let D=F.document,O=F.sourceDocumentSN??(typeof D?.sn==="string"?D.sn:void 0)??(typeof D?.sourceDocumentSN==="string"?D.sourceDocumentSN:void 0)??F.id,N=F.sourceDocumentId??(typeof D?.id==="string"?D.id:void 0)??(typeof D?.sourceDocumentId==="string"?D.sourceDocumentId:void 0)??F.documentId??F.id,B=`${U.docIdPrefix??""}${N}${U.docIdSuffix??""}`,A=`${U.docIdPrefix??""}${O}${U.docIdSuffix??""}`,P=(typeof D?.title==="string"?D.title:void 0)??(typeof D?.name==="string"?D.name:void 0)??A,j="";if(typeof D?.sourceStartTime==="number")j=new Date(D.sourceStartTime*1000).toLocaleDateString("en-CA",{timeZone:"Asia/Shanghai"});else if(typeof F.createdAt==="number")j=new Date(F.createdAt).toLocaleDateString("en-CA",{timeZone:"Asia/Shanghai"});else if(typeof F.createdAt==="string")j=F.createdAt.slice(0,10);let C=new Map,u=Array.isArray(D?.fields)?D.fields:[];for(let I0 of u)if(I0&&typeof I0==="object"){let k=I0,m=typeof k.label==="string"?k.label.trim():typeof k.key==="string"?k.key.trim():"";if(m)C.set(m,k.value)}let x,S=C.get("总金额")??C.get("报销金额")??C.get("total_amount");if(typeof S==="number")x=S;else if(S&&typeof S==="object"&&"amount"in S&&typeof S.amount==="number")x=S.amount;let b=[];b.push(B),b.push(P),b.push(F.status??"已审批"),b.push(x??""),b.push(C.get("报销事由")??C.get("事由")??P),b.push(j);for(let I0 of W){let k=C.get(I0);if(k===void 0||k===null)b.push("");else if(typeof k==="object")if("amount"in k)b.push(k.amount);else b.push(JSON.stringify(k));else b.push(k)}let n=I.get(B)??[];for(let I0 of z){let k=n.filter((m)=>m.sourceField===I0||z.size===1);if(k.length>0)b.push(k.map((m)=>m.zipPath).join(`
|
||||
`));else b.push("")}q.addRow(b)}let V=Xk1(U,Y);Kk1(Gk1(V),{recursive:!0});let w=await K.xlsx.writeBuffer();process.stderr.write(`\uD83D\uDCE6 正在压缩生成 Webhook 资源包: ${V}...
|
||||
`),await new Promise((F,D)=>{let O=Jk1(V),N=new Ro({zlib:{level:9}});O.on("close",()=>F()),N.on("error",(B)=>D(B)),N.pipe(O),N.append(Buffer.from(w),{name:"信息表.xlsx"});for(let B of I.values())for(let A of B)N.append(A.buffer,{name:A.zipPath});N.finalize()});let M=zk1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:Q.length,attachmentCount:J,fileSizeBytes:M.size,exportedAt:N1(),nextAction:`seal-use webhook resource-pack push ${V} --corp <targetCorpId>`}}var $h0;var _o=o(()=>{tv0();Z4();Jq();$h0=X6(eZ(),1)});import{readFileSync as Zk1}from"node:fs";function qk1($){let Y=new URL($),U=Y.pathname.match(/\/webhook\/([^/]+)/);if(!U)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${Y.protocol}//${Y.host}`,webhookId:U[1]}}function Vk1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function Lk1($,Y){if(!$.length)return;let U=new Set($.map((J)=>{let K=J.fileName.split("/")[0],z=K.indexOf("@");return z>=0?K.slice(0,z):K}).filter((J)=>J!=="信息表.xlsx")),Q=[];for(let J of Y){let K=J.document.documentId;if((J.documentAttachments.length>0||Object.values(J.expenseAttachments).some((H)=>H.length>0)||Object.values(J.personAttachments).some((H)=>H.length>0))&&!U.has(K))Q.push(`Excel 会议编号「${K}」声明了附件,但在 ZIP 中找不到对应的根目录「${K}/」或「${K}@.../」。`)}let I=new Set(Y.map((J)=>J.document.documentId));for(let J of U)if(!I.has(J))Q.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(Q.length)throw new k5(Q)}async function Yh0($,Y,U){let Q=[],I=$;if(Vk1($,Y)){Q=await Xj0($),qj0(Q,U);let H=Q.find((G)=>G.fileName==="信息表.xlsx");if(!H)throw Error("ZIP 根目录缺少信息表.xlsx");I=await _m($,H)}let J=await Dj0(I);Lk1(Q,J);let K=Nj0(Q,J),z=J.map((H)=>H.document);return{entries:Q,parsed:J,plans:K,documents:z,fileBuffer:$}}async function lQ($,Y,U){let Q=await Yh0($,Y,U),I=Q.parsed.map((J,K)=>km(J.document,Q.plans[K],new Map));return{warnings:[],documents:I,attachmentPlan:Q.plans}}async function eT($,Y,U){let Q=await Yh0($,Y,U.materialPackFilePolicy),{baseUrl:I,webhookId:J}=qk1(U.webhookUrl),K=[];for(let z=0;z<Q.parsed.length;z+=1){let H=Q.parsed[z],G=Q.plans[z],W=new Map,X=[...G.categoryFields,...Object.values(G.personAttachments).flat(),...Object.values(G.expenseAttachments).flat()];for(let V of X)for(let w of V.paths){if(W.has(w))continue;let M=Q.entries.find((A)=>A.fileName===w);if(!M)continue;process.stderr.write(`⬆ 上传附件: ${w}
|
||||
`);let F=new FormData,D=await _m(Q.fileBuffer,M),O=w.split("/").pop()??w;F.append("files",new File([new Uint8Array(D)],O));let N=await fetch(`${I}/api/v1/integrations/webhook/${encodeURIComponent(J)}/attachments`,{method:"POST",headers:{...U.customHeaders,...Zq({},U.secret)},body:F});if(!N.ok)throw Error(`附件上传失败 ${N.status}: ${await N.text()}`);let B=await N.json();W.set(w,B.attachments?.map((A)=>A.data)??(B.data===void 0?[]:[B.data])),process.stderr.write(`✓ 附件上传成功: ${w}
|
||||
`)}process.stderr.write(`\uD83D\uDCE4 推送单据: ${H.document.documentId}
|
||||
`);let Z=km(H.document,G,W),q=await fetch(`${I}/api/v1/integrations/webhook/${encodeURIComponent(J)}/document`,{method:"POST",headers:{...U.customHeaders,"Content-Type":"application/json",...Zq({webhookId:J,...Z},U.secret)},body:JSON.stringify(Z)});if(!q.ok)throw Error(`Webhook 单据推送失败 ${q.status}: ${await q.text()}`);K.push({documentId:Z.documentId,document:Z,pushResult:await q.json()}),process.stderr.write(`✓ 单据推送成功: ${Z.documentId}
|
||||
`)}return{warnings:[],results:K}}function oQ($){return{fileBuffer:Zk1($),fileName:$.split(/[\\/]/).pop()??"material-pack.zip"}}var vo=o(()=>{iA();xm();ym();vm();Dz();_o()});import{existsSync as wk1}from"node:fs";async function $j($,Y,U={}){let I=A4().stateful?"stateful":"stateless",J="ok",K,z,H;try{let N=await e6($);H={id:N.user.id,name:N.user.name,isAdmin:N.user.isAdmin},z={id:N.tenant.id,name:N.tenant.name,tenantSlug:N.tenant.tenantSlug,corporationName:N.tenant.hoseCorpConfig?.corporationName}}catch(N){J="error",K=N instanceof Error?N.message:String(N)}let G=[];if(J==="ok")try{G=await F$($,Y.seal.endpoints.approvalStylePreferences)}catch(N){J="error",K=`读取 Webhook 配置失败: ${N instanceof Error?N.message:String(N)}`}let W=G.length===1,X=G.map((N)=>({id:N.id,name:N.name,mode:N.mode,incomingDocumentWebhookUrl:N.incomingDocumentWebhook.url,outgoingResultWebhookUrl:N.outgoingResultWebhook,autoApprovalRate:N.autoApprovalRate,...W?{isDefault:!0}:{}})),Z=W?{id:G[0].id,name:G[0].name,mode:G[0].mode}:null,q=U.webhook?d7(G,U.webhook):W?G[0]:void 0,V;if(U.filePath)if(!wk1(U.filePath))V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在: ${U.filePath}`]};else try{let N=oQ(U.filePath),B=await lQ(N.fileBuffer,N.fileName,q?.materialPackFilePolicy);V={valid:!0,filePath:U.filePath,fileName:N.fileName,documentCount:B.documents.length,warnings:B.warnings}}catch(N){V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[N instanceof Error?N.message:String(N)]}}let w=V?V.valid:!0,M=J==="ok"&&X.length>0&&w,F=I==="stateful"?"":` --corp ${Y.id}`,D="",O="";if(J!=="ok")O=`凭证鉴权异常: ${K}`,D=`seal-use auth diagnose${F}`;else if(X.length===0)O="当前企业尚未配置任何 Webhook 集成通道",D=`seal-use webhook add --name "默认入站通道" --result-url "https://your-domain.com/callback"${F}`;else if(V&&!V.valid)O=`资源包预检失败: ${V.errors?.join("; ")}`,D=`seal-use webhook resource-pack preview ${V.filePath}${F}`;else{O=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到 ${X.length} 个 Webhook 通道,等待载入`;let N=V?.filePath??"<资源包.zip>",B=W?"":` --webhook ${Z?Z.id:"<webhookIdOrName>"}`;D=`seal-use webhook resource-pack push ${N}${B}${F}`}return{ready:M,corp:{id:Y.id,name:Y.name,sourceType:Y.source.type,tenant:z,user:H},stateMode:I,authStatus:J,authError:K,activeWebhooks:X,defaultWebhook:Z,resourcePack:V,materialPack:V,statusMessage:O,nextAction:D}}var Uh0=o(()=>{x$();Z4();vo()});var ho=o(()=>{Dz();WJ();iA();vm();ym();xm();vo();Uh0();_o()});var lq,Fk1,So,Qh0;var Ih0=o(()=>{Z6();Z4();fG();x$();n6();qq();ho();WJ();a2();({presentWebhookIntegration:lq,getConfiguredSealBaseUrl:Fk1,mutationPreview:So}=C$),Qh0=[{name:"seal_webhook_list",description:"列出当前 Seal 租户的 Webhook 集成,可按 ID、名称或 URL 查找",parameters:L.object({query:L.string().optional().describe("按集成 ID、名称或 URL 做本地包含匹配"),includeSecret:L.boolean().optional().describe("是否返回 Webhook secret;默认遮罩")}),handler:async($,Y,U)=>{let Q=F60(await F$($,U.corp.seal.endpoints.approvalStylePreferences),Y.query);return{count:Q.length,integrations:Q.map((I)=>lq(I,Y.includeSecret===!0))}}},{name:"seal_webhook_get",description:"按 Webhook 集成 ID 或名称精确查找一条集成",parameters:L.object({selector:L.string().min(1).describe("Webhook 集成 ID 或名称"),includeSecret:L.boolean().optional().describe("是否返回 Webhook secret;默认遮罩")}),handler:async($,Y,U)=>{let Q=d7(await F$($,U.corp.seal.endpoints.approvalStylePreferences),Y.selector);return lq(Q,Y.includeSecret===!0)}},{name:"seal_webhook_add",description:"新增 Webhook 集成;使用 dryRun=true 可只预览请求而不持久化",parameters:L.object({name:L.string().min(1).describe("集成名称"),mode:L.enum(["assisted","semi_automatic","fully_automatic"]).optional(),outgoingResultWebhook:L.string().url().describe("Seal 完成 AI 审核后回调的外部地址"),autoApprovalRate:L.number().int().min(0).max(100).optional(),secret:L.string().min(1).optional().describe("可选;不传则生成 32 位十六进制 secret"),materialPackFilePolicy:$y.describe("材料包附件文件策略:大小和后缀白名单"),dryRun:L.boolean().optional().describe("只返回前后配置 Diff,不执行写入")}),handler:async($,Y,U)=>{let Q=Fk1(U.corp),I=Y.dryRun?await Z60($,Q,Y,U.corp.seal.endpoints.approvalStylePreferences):void 0,J=I?.integration??await HO($,Q,Y,U.corp.seal.endpoints.approvalStylePreferences);if(Y.dryRun)return So(U,U.corp.seal.endpoints.approvalStylePreferences,I.before,I.after,1);return{saved:!0,integration:lq(J,!0)}}},{name:"seal_webhook_update",description:"更新现有 Webhook 集成;使用 dryRun=true 可只预览请求而不持久化",parameters:L.object({selector:L.string().min(1).describe("Webhook
Line truncated
|
||||
`+`• 身份主体:${A}${P}
|
||||
`+`• 权限范围:持有该链接者在 Seal AI 中拥有该用户的完整操作权限(含系统设置与规则编辑)
|
||||
`+`• 时效性:换票凭证有效时间 ${q} 秒(${Math.round(q/60)} 分钟),在浏览器打开后将保留 30 天会话
|
||||
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:W?K:Z?V:G,type:X,mode:Z?"auto_login":"direct",sealResultUrl:G,hoseDocumentUrl:K,documentUrl:K,ssoUrl:V,expiresIn:Z?q:void 0,identity:w,warning:M,hoseDomain:J.type==="hose"?xy1(J.domain):void 0,recordId:I.id,sourceDocumentSN:I.sourceDocumentSN,sourceDocumentId:I.sourceDocumentId,sourceSystem:I.sourceSystem,missing:{hoseDocumentUrl:!K?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:L.object({query:L.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:L.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:L.string().optional().describe("模拟批次 ID"),latest:L.boolean().optional().describe("只返回最新一条匹配记录"),fields:L.union([L.string(),L.array(L.string())]).optional().describe("限制返回字段"),limit:L.number().int().positive().max(100).optional(),maxScan:L.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:L.boolean().optional()}),handler:async($,Y,U)=>{let Q=Y.sn??Y.query;if(!Q)throw Error("query or sn is required");let I=await uy1($,{query:Q,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),J=await Promise.all(I.records.map((W)=>W4($,W.id))),K=yv0(Y.fields),z=J.map((W)=>gy1(W,K)),G=J.find((W)=>W.ruleSetVersionNumber!==void 0)?.ruleSetVersionNumber,H=G===void 0?"latest":String(G);return{query:Q,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:I.total,scanned:I.scanned,matched:z.length,records:z,next:{getSummary:`seal-use approval-runs get <recordId> --summary --corp ${U.corp.id}`,getRuleVersion:`seal-use rules version ${H} --corp ${U.corp.id}`,searchRuleVersion:`seal-use rules search <keyword> --version ${H} --corp ${U.corp.id}`,getVersionContext:`seal-use context --ruleVersion ${H} --corp ${U.corp.id}`},...Y.includeBridge?{bridge:qo(J)}:{}}}},{name:"seal_approval_run_langfuse_bridge_get",description:"从 Seal approval run 中抽取 Langfuse 定位信息;优先返回 _langfuseTraceId,没有时给出 hosecloud-{sourceDocumentSN} session 回退",parameters:L.object({recordId:L.string().optional(),sourceDocumentSN:L.string().optional(),sourceDocumentId:L.string().optional(),simulationBatchId:L.string().optional(),limit:L.number().int().positive().max(100).optional()}),handler:async($,Y)=>{let Q=(Y.simulationBatchId?await mM($,Y.simulationBatchId):(await u4($,{limit:Y.limit??50,search:Y.sourceDocumentSN??Y.sourceDocumentId,sourceDocumentSN:Y.sourceDocumentSN,sourceDocumentId:Y.sourceDocumentId})).records).filter((I)=>dy1(I,{recordId:Y.recordId,sourceDocumentSN:Y.sourceDocumentSN,sourceDocumentId:Y.sourceDocumentId}));return{count:Q.length,records:Q.map(gv0),bridge:qo(Q)}}},{name:"seal_approval_runs_stats",description:"统计审核记录状态分布、来源系统分布及按单号/ID去重统计",parameters:L.object({since:L.string().optional().describe("时间范围,如 3months, 7days, 24hours"),dedupeBy:L.enum(["sourceDocumentSN","sourceDocumentId","id"]).default("sourceDocumentSN").describe("去重字段"),status:L.string().optional(),sourceSystem:L.string().optional(),taskMode:L.string().optional()}),handler:async($,Y)=>{let U=await u4($,{limit:1000,status:Y.status,sourceSystem:Y.sourceSystem,taskMode:Y.taskMode}),Q=Y.dedupeBy??"sourceDocumentSN",I=U.records,J={},K={},z=new Set;for(let H of I){let W=H.status??"unknown";J[W]=(J[W]??0)+1;let X=H.sourceSystem??"unknown";K[X]=(K[X]??0)+1;let Z=H[Q];if(Z)z.add(String(Z))}let G=Math.max(0,I.length-z.size);return{total:I.length,dedupeBy:Q,unique:z.size,duplicateRuns:G,dedupeNote:G>0?`存在 ${G} 笔重复运行记录 (同一单据重跑或修改重推)`:"全部单据唯一,无重复记录",byStatus:J,bySourceSystem:K}}},{name:"seal_approval_runs_count",description:"统计符合条件的审核记录总数",parameters:L.object({status:L.string().optional(),sourceSystem:L.string().optional(),taskMode:L.string().optional(),search:L.string().optional(),startDate:L.string().optional().describe("起始时间戳(毫秒)或日期字符串"),endDate:L.string().optional().describe("结束时间戳(毫秒)或日期字符串")}),handler:async($,Y)=>{let U=await u4($,{limit:1,status:Y.status,sourceSystem:Y.sourceSystem,taskMode:Y.taskMode,search:Y.search,startDate:t$(Y.startDate,!1),endDate:t$(Y.endDate,!0)});return{total:U.total??U.records.length}}}]});import{readFileSync as py1}from"node:fs";var LQ4,FQ4,wQ4,MQ4,OQ4,NQ4,DQ4,AQ4,Vo,BQ4,PQ4,TQ4,my1,ly1,oy1,EQ4,jQ4,CQ4,RQ4,_Q4,vQ4,SQ4,hQ4,ry1,gQ4,yQ4,kQ4
Line truncated
|
||||
`)}function Gk1($){let Y=[];if(Y.push(`seal-use ${$.area} - ${$.title}`),$.description)Y.push($.description);Y.push(""),Y.push("Usage:");let U=new Map;for(let I of $.commands){let J=I.group??"",K=U.get(J)??[];K.push(I),U.set(J,K)}let Q=[...$.groupOrder??[],...[...U.keys()].filter((I)=>!$.groupOrder?.includes(I))];for(let I of Q){let J=U.get(I);if(!J)continue;if(I)Y.push(""),Y.push(`${I}:`);for(let K of J)for(let z of K.usage)Y.push(` ${z}`)}if($.commands.some((I)=>I.name))Y.push(""),Y.push(`Run 'seal-use ${$.area} <command> --help' for details on a specific command.`);return Y.join(`
|
||||
`)}function lv0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of ov0)for(let U of Y.commands)for(let Q of U.usage)$.push(` ${Q}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
|
||||
`)}var ov0;var Bo=o(()=>{p8();ov0=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",groupOrder:["企业接入","发现与选择","企业配置","测试配对与验证","Hose 专属能力"],commands:[{name:"list",group:"发现与选择",summary:"List configured enterprises sorted by 7-day usage frequency",usage:["seal-use corps list [query] [--all] [--limit <n>] [--env <production|test>] [--strict] [--corp <corpId>]"],options:[{flag:"--all",description:"Display all configured enterprises without the default 10-item limit"},{flag:"--limit <n>",description:"Maximum number of enterprises to display (defaults to 10)"},{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}]},{name:"search",aliases:["find"],group:"发现与选择",summary:"Search configured enterprises with intelligent soft fuzzy matching",usage:["seal-use corps search <query> [--env <production|test>] [--strict]"],options:[{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}],description:"Searches enterprise ID, name, staff ID, domain, tenant slug, environment, or bindings. Uses soft search by default (case-insensitive, Chinese homophones, front/back nasal vowels, initials, typo/missing letter tolerance)."},{name:"get",aliases:["show"],group:"发现与选择",summary:"Get rich details and configuration of an enterprise",usage:["seal-use corps get <corpId>"],description:"Retrieves complete enterprise details (URLs, tenant slugs, custom headers/cookies, staff IDs, relations, config file path) with sensitive secrets safely redacted."},{name:"current",group:"发现与选择",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",group:"发现与选择",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",group:"企业配置",summary:"Mark enterprise environment as production or test",usage:["seal-use corps mark <corpId> --env <production|test> [--confirm]"],options:[{flag:"--env <production|test>",description:"Target environment: 'production' or 'test' (required)"},{flag:"--confirm",description:"Confirm the environment update (required)"}],description:"Explicitly updates an enterprise's environment tag. Requires --confirm to prevent accidental changes."},{name:"rename",group:"企业配置",summary:"Rename an enterprise display name",usage:["seal-use corps rename <corpId> --name <newName>"],options:[{flag:"--name <newName>",description:"New human-readable enterprise name (required)"}],description:"Safely updates the display name of a configured enterprise without modifying underlying files manually."},{name:"bind-test",group:"测试配对与验证",summary:"Bind a production enterprise to a test enterprise (1-to-1 association)",usage:["seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]","seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]"],options:[{flag:"--confirm",description:"Explicitly confirm binding and tag test environment (required)"},{flag:"--force",description:"Force re-binding if the production enterprise is already bound"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Establishes a strict 1-to-1 association between a production enterprise and a test enterprise. Automatically marks the test enterprise with environment 'test'."},{name:"unbind-test",group:"测试配对与验证",summary:"Unbind a production and test enterprise association",usage:["seal-use corps unbind-test [<corpId>] [--confirm]"],options:[{flag:"--confirm",description:"Explicitly confirm unbinding both sides (required)"},{flag:"--corp <corpId>",description:"Specify enterprise ID or name"}],description:"Removes the 1-to-1 test association from both the production enterprise and the test enterprise."},{name:"sync-test",group:"测试配对与验证",summary:"Synchronize rules and preferences from production to test enterprise",usage:["seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]"],options:[{flag:"--dry-run",description:"Preview sync diff without making network mutations (default)"},{flag:"--yes",description:"Execute synchronization and publish new rule version on test enterprise"},{flag:"--version-name <name>",description:"Custom version name for published test rule version"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Overwrites test enterprise decision preferences with production preferences, syncs production draft rules to test enterprise, and immediately publishes a new versi
Line truncated
|
||||
`)}
|
||||
`}function C0($,Y={}){qk1($,Y);let U=`${JSON.stringify($,null,2)}
|
||||
`;if(Y.outputFile){Hk1(Y.outputFile,U),console.log(JSON.stringify({outputFile:Y.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function qk1($,Y={}){if(Y.allowFull||Y.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>Zk1)throw new Iq(`Output is large (${U} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function av0($,Y){if(Y)return;let U=$&&typeof $==="object"?$:{},Q=typeof U.count==="number"?U.count:void 0,I=Array.isArray(U.rules)?U.rules.length:void 0,J=Buffer.byteLength(JSON.stringify($),"utf-8"),K=Q??I??0;if(K>Wk1||J>Xk1)throw new Iq(`Rule list is large (${K} rules, ${J} bytes). Use "seal-use rules list --summary", "seal-use rules count", or --output-file; pass --full only when you really need full descriptions.`,"seal-use rules list --summary")}function T0($){return{allowFull:z0($.full)===!0,outputFile:R($.outputFile)??R($["output-file"])}}function ev0($=[]){console.log(sv0($))}var Wk1=100,Xk1=120000,tv0,Zk1=200000;var $4=o(()=>{L4();p8();Bo();tv0=["code","status","strictness","scope","updatedAt"]});var To={};L8(To,{selectCorp:()=>M1,runToolResult:()=>C$,runTool:()=>v0,globalConfigSummary:()=>KY});function M1($){let Y=K$(),U=T4(),Q=r2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},m3());return wB0(Q.id),Q}function KY($=T4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:DQ()}}async function v0($,Y,U,Q,I={}){C0(await C$($,Y,U,Q),I)}async function C$($,Y,U,Q){let I=Lo.find((z)=>z.name===$);if(!I)throw Error(`Unknown Seal tool: ${$}`);let J=Object.fromEntries(Object.entries(Q).filter(([,z])=>z!==void 0)),K=I.handler;return K(Y,J,{corp:U})}var D4=o(()=>{a$();LP();Fo();$4()});import{existsSync as $S0}from"node:fs";async function YS0($,Y){if(!$S0($))throw Error(`File not found: ${$}`);let U=lQ($);C0(await mQ(U.fileBuffer,U.fileName,Y))}async function rT($,Y,U,Q,I){if($==="ready"||$==="status"){let J=Y??R(I.options.file)??R(I.options.input),K=await nT(U,Q,{filePath:J,webhook:R(I.options.webhook)??R(I.options.selector)});if(console.error(`[webhook-ready] 企业环境: ${K.corp.name} (${K.corp.id}) [${K.stateMode}]`),K.corp.tenant?.name)console.error(`[webhook-ready] 租户信息: ${K.corp.tenant.name} (${K.corp.tenant.id})`);console.error(`[webhook-ready] 凭证状态: ${K.authStatus==="ok"?"OK":`异常 (${K.authError})`}`),console.error(`[webhook-ready] Webhook 通道: ${K.activeWebhooks.length} 个可用`);for(let z of K.activeWebhooks){let G=z.isDefault?" [默认通道]":"";console.error(` - ${z.name} (${z.id}) mode=${z.mode}${G}`)}if(K.materialPack)console.error(`[webhook-ready] 材料包预检: ${K.materialPack.valid?`通过 (${K.materialPack.documentCount} 单)`:`失败 (${K.materialPack.errors?.join("; ")})`}`);if(K.ready)console.error(`\uD83D\uDFE2 ${K.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${K.nextAction}`);else console.error(`\uD83D\uDD34 准备阶段未通过: ${K.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${K.nextAction}`);C0(K,T0(I.options));return}if($==="replay"){let J=Y??R(I.options.recordId)??R(I.options["record-id"])??R(I.options.id),K=R(I.options.recordIds)??R(I.options["record-ids"]),z=K?K.split(",").map((n)=>n.trim()).filter(Boolean):void 0,G=R(I.options.sn)??R(I.options.documentSn)??R(I.options["document-sn"]),H=R(I.options.sns)??R(I.options["document-sns"]),W=H?H.split(",").map((n)=>n.trim()).filter(Boolean):void 0,X=l0(I.options.limit),Z=R(I.options.status),q=R(I.options.startDate)??R(I.options["start-date"]),V=R(I.options.endDate)??R(I.options["end-date"]);if(!J&&!z&&!G&&!W&&X===void 0)throw Error("Usage: seal-use webhook replay <recordId> [--sn <documentSN>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--dry-run]");let w=R(I.options.sourceCorp)??R(I.options["source-corp"])??R(I.options.prodCorp)??R(I.options["prod-corp"]),M=R(I.options.targetCorp)??R(I.options["target-corp"])??R(I.options.testCorp)??R(I.options["test-corp"]),F=z0(I.options.force)===!0,{sourceCorp:N,targetCorp:O}=vP({sourceCorpId:w,targetCorpId:M,activeCorp:Q,force:F},M1),D=N.id===Q.id?U:await P1(N),P=O.id===Q.id?U:await P1(O),T=R(I.options.webhook)??R(I.options.selector),A=R(I.options.snSuffix)??R(I.options["sn-suffix"]),E=R(I.options.snPrefix)??R(I.options["sn-prefix"]),C=R(I.options.docIdSuffix)??R(I.options["doc-id-suffix"]),i=R(I.options.docIdPrefix)??R(I.options["doc-id-prefix"]),x=z0(I.options.dryRun)??z0(I.options["dry-run"]),b=await Fz({query:{recordId:J,recordIds:z,sn:G,sns:W,limit:X,status:Z,startDate:q,endDate:V},sourceClient:D,targetClient:P,sourceCorp:N,targetCorp:O,webhookSelector:T,snPrefix:E,snSuffix:A,docIdPrefix:i,docIdSuffix:C,dryRun:x});if(x){console.error(`[webhook-replay] 预Line truncated
|
||||
or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]`);let J=M1(Q),K=M1(I);if(J.id===K.id)throw E4(`Cannot bind enterprise '${J.id}' to itself.`);if(J.prodCorpId&&J.prodCorpId!==K.id)throw E4(`Cannot use '${J.id}' as a production enterprise because it is already registered as a test enterprise for '${J.prodCorpId}'. Multi-tier chaining is not permitted.`);if(K.testCorpId&&K.testCorpId!==J.id)throw E4(`Cannot bind '${K.id}' as a test enterprise because it already has a bound test enterprise '${K.testCorpId}'. Multi-tier chaining is not permitted.`);let z=z0(U.options.force)===!0;if(J.testCorpId&&J.testCorpId!==K.id||K.prodCorpId&&K.prodCorpId!==J.id){if(!z)throw m6(`Enterprise binding conflict: production enterprise '${J.id}' is bound to '${J.testCorpId??"none"}', and test enterprise '${K.id}' is bound to '${K.prodCorpId??"none"}'. Overwriting an existing binding requires --force and --confirm.`,`seal-use corps bind-test ${J.id} ${K.id} --confirm --force`)}if(!(z0(U.options.confirm)===!0||z0(U.options.yes)===!0)){let X=z?" --force":"";throw m6(`Refusing to bind test enterprise '${K.name}' (${K.id}) to production enterprise '${J.name}' (${J.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${K.id}' as a test environment.`,`seal-use corps bind-test ${J.id} ${K.id} --confirm${X}`)}if(J.testCorpId&&J.testCorpId!==K.id)try{y9(J.testCorpId,{prodCorpId:void 0})}catch{}if(K.prodCorpId&&K.prodCorpId!==J.id)try{y9(K.prodCorpId,{testCorpId:void 0})}catch{}let H=y9(J.id,{environment:"production",testCorpId:K.id}),W=y9(K.id,{environment:"test",prodCorpId:J.id});return C0({success:!0,productionEnterprise:{id:H.id,name:H.name,environment:H.environment,testCorpId:H.testCorpId},testEnterprise:{id:W.id,name:W.name,environment:W.environment,prodCorpId:W.prodCorpId}}),!0}if($==="unbind-test"){let Q=Y??R(U.options.corp),I=M1(Q);if(!I.testCorpId&&!I.prodCorpId)return C0({unbound:!1,message:`Enterprise '${I.name}' (${I.id}) does not have an active test enterprise binding.`}),!0;let J=I.testCorpId?I.id:I.prodCorpId,K=I.testCorpId?I.testCorpId:I.id;if(!(z0(U.options.confirm)===!0||z0(U.options.yes)===!0))throw m6(`Refusing to unbind production enterprise '${J}' and test enterprise '${K}' without --confirm.`,`seal-use corps unbind-test ${I.id} --confirm`);y9(J,{testCorpId:void 0});try{y9(K,{prodCorpId:void 0})}catch{}return C0({success:!0,unboundProduction:J,unboundTest:K}),!0}return!1}var zS0=o(()=>{a$();D4();p8();L4();$4()});function sT($){let Y;try{Y=new URL($.trim())}catch{throw Error("Invalid Seal delegate link: expected a valid HTTPS URL")}if(Y.protocol!=="https:")throw Error("Invalid Seal delegate link: expected HTTPS");let U=Y.hostname.toLowerCase();if(!U.endsWith(GS0))throw Error(`Invalid Seal delegate link: expected host ending in ${GS0}, got ${U}`);let Q=Y.pathname.replace(/\/+$/,"");if(Q!==HS0)throw Error(`Invalid Seal delegate link: expected path ${HS0}, got ${Q}`);let I=Y.searchParams.get("token");if(!I)throw Error("Invalid Seal delegate link: token query parameter is required");return{sealUrl:Y.origin,delegateToken:I}}async function WS0($){let Y=typeof $==="string"?sT($):$;return(await C6(Y.sealUrl,void 0).post("api/v1/delegation/preview",{json:{token:Y.delegateToken}}).json()).data}async function XS0($){let Y=typeof $==="string"?sT($):$,U=Y.sealUrl,Q=C6(U,void 0),I=await Q.post("api/v1/delegation/consume",{json:{token:Y.delegateToken}}),J=I.headers.get("set-cookie")??"",K=typeof I.headers.getSetCookie==="function"?I.headers.getSetCookie():[J],z="";for(let M of K)if(M&&M.includes("session_token=")){z=(M.split(";")[0]??"").trim();break}let G;try{G=await Q.get("api/auth/get-session",{headers:z?{cookie:z}:{}}).json()}catch{}let H=G?.session?.token;if(!H&&z){let M=z.match(/session_token=([^.;]+)/);if(M?.[1])H=decodeURIComponent(M[1])}if(!H)throw Error("Seal delegate exchange did not return a session token");let W=86400;if(G?.session?.expiresAt){let M=new Date(G.session.expiresAt).getTime();if(Number.isFinite(M)){let F=Math.floor((M-Date.now())/1000);if(F>0)W=F}}let Z=await C6(U,H).get("api/v1/auth/me").json(),q=Z.data&&typeof Z.data==="object"?Z.data:Z,V=q.user??G?.user??{},w=q.tenant??{};return{sealUrl:U,token:H,expiresIn:W,user:V,tenant:w}}function tT($){let Y=[],U=0,Q="";try{let K=new URL($.trim()),z=K.hostname.toLowerCase(),G=K.pathname.replace(/\/+$/,"");if(z.endsWith(".ekuaibao.com")||z.endsWith(".hosecloud.com")||z==="ekuaibao.com"||z==="hosecloud.com")U+=40,Q="host is Hose domain";if(G==="/web/thirdparty.html")U+=40,Q+="; path is /web/thirdparty.html";if(K.searchParams.has("accessToken"))U+=10,Q+="; has accessToken";if(K.searchParams.has("ekbCorpId"))U+=10,Q+="; has ekbCorpId"}catch{U=0}if(U>0)Y.push({kind:"hose",score:U,reason:Q});let I=0,J="";try{let K=new URL($.trim()),z=K.hostname.toLowerCase(),G=K.pathname.replace(/\/+$/,"");if(z.endsWith(".sealai.cc"))I+=40,J="host ends with .sealai.cc";if(G==="/delegate")I+=40,J+="; path is /delegate";if(
Line truncated
|
||||
`,{mode:384}),{config:U,path:I}}var Co=o(()=>{a$();HP()});function W5($){return typeof $==="string"&&$?$:void 0}function Ok1($){return{headers:gd.parse($.headers),cookies:yd.parse($.cookies)}}async function Nk1($,Y,U={}){let Q=await t6(C6($,Y,U));return{user:Q.user??{},tenant:Q.tenant??{}}}async function ZS0($){let Y=$.sealUrl.replace(/\/+$/,""),U=$.expiresIn??2592000,Q=$.force===!0||$.verify===!1?!1:!0,I=Ok1($),J=Q?await Nk1(Y,$.token,j6(I)):void 0,K=VS0($,{token:$.token,sealUrl:Y,expiresIn:U,expiresAt:$.expiresAt,verify:Q,remote:J,custom:I}),z=$.tenantId??W5(J?.tenant.id),G=$.tenantSlug??W5(J?.tenant.tenantSlug);return{...K,verified:Q,tenantId:z,tenantSlug:G}}function qS0($){let Y=W5($.session.tenant.tenantSlug),U=W5($.session.tenant.id),Q=Y??U??"seal-delegate";return{...VS0({id:Q,corpId:Q,name:$.name,provider:"seal",overwrite:$.overwrite},{token:$.session.token,sealUrl:$.session.sealUrl,expiresIn:$.session.expiresIn,verify:!0,remote:{user:$.session.user,tenant:$.session.tenant}}),tenantId:U,tenantSlug:Y}}function VS0($,Y){let U=Y.remote?.user,Q=Y.remote?.tenant,I=$.tenantSlug??W5(Q?.tenantSlug),J=$.tenantId??W5(Q?.id),K=$.tenantName??W5(Q?.name),z=$.id??I??J;if(!z)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let G=Y.expiresAt?T8(Y.expiresAt):A1(Date.now()+Y.expiresIn*1000),H=$.staffId??W5(U?.providerUserId)??W5(U?.id)??"seal",W=$.provider??W5(U?.provider)??W5(Q?.providerConfig?.provider),X=$.corpId??I??J??z,Z={id:z,name:$.name??K??z,environment:"production",seal:{url:Y.sealUrl,tenantSlug:I,headers:Y.custom?.headers,cookies:Y.custom?.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:Y.token,sealUrl:Y.sealUrl,expiresIn:Y.expiresIn,expiresAt:G,staffId:H,corpId:X,tenantId:J,tenantSlug:I,tenantName:K,providerUserId:W5(U?.providerUserId),provider:W},auth:{refreshTtl:300}};return cq(Z,{overwrite:$.overwrite===!0})}var Ro=o(()=>{Co();HP();i6();X4()});async function tz($){let[Y,U]=await Promise.all([R10($),P1($)]),Q=await t6(U);return{...Y,tenantId:Q.tenant.id,tenantSlug:Q.tenant.tenantSlug??Y.tenantSlug,tenantName:Q.tenant.name,raw:{...typeof Y.raw==="object"&&Y.raw!==null?Y.raw:{},user:{id:Q.user.id,name:Q.user.name,isAdmin:Q.user.isAdmin,providerUserId:Q.user.providerUserId,hosecloudStaff:Q.user.hosecloudStaff},tenant:Q.tenant}}}var aT=o(()=>{i6();Ag();X4()});async function LS0($){let Y=await QJ($.appKey,$.appSecurity,$.domain),U=await CM(Y.domain,Y.openapiToken).catch(()=>[]);return{...Y,roleCount:U.reduce((Q,I)=>Q+I.roleDefs.length,0),roleGroups:U.map((Q)=>({id:Q.id,name:Q.name,roleDefs:Q.roleDefs.map((I)=>({id:I.id,name:I.name,sourceType:I.sourceType}))}))}}async function FS0($){let Y=await QJ($.appKey,$.appSecurity,$.domain),U=$.role??$.roleDefId??"admin",Q=await CM(Y.domain,Y.openapiToken),I,J;for(let G of Q){for(let H of G.roleDefs)if(H.id===U||H.id===`${Y.corpId}:${U}`){I=H.id,J=H.name;break}if(I)break}if(!I&&(U==="admin"||U==="主管理员"))for(let G of Q){for(let H of G.roleDefs)if(H.id.endsWith(":admin")||H.name==="主管理员"){I=H.id,J=H.name;break}if(I)break}if(!I)for(let G of Q){for(let H of G.roleDefs)if(H.name.toLowerCase().includes(U.toLowerCase())){I=H.id,J=H.name;break}if(I)break}if(!I)throw Error(`Role not found matching query: '${U}'. Run 'seal-use corps probe-hose' to view all available roles.`);let K=await Mg(Y.domain,Y.openapiToken,I),z=await Og(Y.domain,Y.openapiToken,K.staffs);return{domain:Y.domain,corpId:Y.corpId,corpName:Y.corpName??Y.corpId,roleId:I,roleName:J,staffs:z}}async function nq($){let Y=$.domain,U=$.staffId??$.proxyStaffBizId,Q=$.force===!0,I=Q||$.verify===!1?!1:!0,J=Y,K=$.corpId??$.corporationId,z=$.name,G;if(!J||!K||!U){let V=await QJ($.appKey,$.appSecurity,Y);J=V.domain,K=K??V.corpId,z=z??V.corpName,G=V.openapiToken}let H=U;if(!H&&G&&J){let V=$.role??"admin",w=await CM(J,G).catch(()=>[]),M;for(let F of w){for(let N of F.roleDefs)if(N.id.endsWith(`:${V}`)||N.name===V||N.id===V){M=N.id;break}if(M)break}if(!M)M=w.find((F)=>F.roleDefs.some((N)=>N.id.endsWith(":admin")))?.roleDefs.find((F)=>F.id.endsWith(":admin"))?.id;if(M){let F=await Mg(J,G,M).catch(()=>({staffs:[]})),N=await Og(J,G,F.staffs).catch(()=>[]);if($.staffName||$.staffPhone){let O=N.filter((D)=>{if($.staffName&&D.name!==$.staffName&&!D.name.includes($.staffName))return!1;if($.staffPhone&&(!D.cellphone||!D.cellphone.includes($.staffPhone)))return!1;return!0});if(O.length===1&&O[0])H=O[0].id;else if(O.length>1)throw Error(`Multiple staff members matched '${$.staffName??$.staffPhone}': ${O.map((D)=>`${D.name}(${D.id})`).join(", ")}. Please specify exact staffId.`);else throw Error(`No staff member found matching '${$.staffName??$.staffPhone}' under role ${M}. Run 'seal-use corps hose-staffs' to view candidates.`)}else if(!Q){let O=N.map((D)=>({id:D.id,name:D.name,cellphone:D.cellphone,active:D.active}));throw Error(`Missing required parameter: staffId. Candidates: ${JSON.stringify(O)}`)}else H=N.find(
Line truncated
|
||||
`+"\uD83D\uDCA1 说明:此能力专属于合思 (Hose) 子域,用于将临时会话提权为标准 OpenAPI 开发者接入。需要企业管理员已在合思开放平台创建应用并生成 appKey/appSecurity。",Q);if(U.keyId||U.appKey){let I=$.find((J)=>U.keyId&&J.id===U.keyId||U.appKey&&J.appKey===U.appKey);if(!I)throw new oQ(`指定的合思密钥不存在,请从上述候选列表中选择正确的 appKey 或 keyId。
|
||||
`+`当前企业存在以下 ${$.length} 套候选密钥:
|
||||
`+$.map((J)=>` • "${J.name||"未命名应用"}" (appKey: ${J.appKey}, keyId: ${J.id}, 状态: ${J.active?"\uD83D\uDFE2 启用":"⚪ 停用"})`).join(`
|
||||
`),`${Q} --app-key ${$[0].appKey}`);return I}if($.length===1)return $[0];throw new oQ(`
|
||||
ℹ️ [合思子域提权] 合思企业 [${Y}] 存在多套 (${$.length} 套) OpenAPI 应用密钥凭据:
|
||||
${$.map((I,J)=>` [${J+1}] "${I.name||"未命名应用"}" (appKey: ${I.appKey}, keyId: ${I.id}, 状态: ${I.active?"\uD83D\uDFE2 启用":"⚪ 停用"})`).join(`
|
||||
`)}
|
||||
|
||||
\uD83D\uDC49 为确保权限提权绑定正确的业务应用,请显式指定要使用的密钥套件:
|
||||
在命令后追加 --app-key <key> 或 --key-id <id> 参数。
|
||||
`,`${Q} --app-key ${$[0].appKey}`)}async function NS0($){let Y=await Dg($.link),U=OS0(Y.keys,Y.corpId,$,'seal-use corps add-link "<url>" --elevate-hose');if($.dryRun)return{result:Y,selectedKey:U,dryRun:!0};let Q=await nq({domain:Y.baseUrl,appKey:U.appKey,appSecurity:U.appSecurity,corpId:Y.corpId,name:$.name??Y.corpName,staffId:Y.staffId,overwrite:$.overwrite,force:$.force});return{result:Y,selectedKey:U,saved:Q,dryRun:!1}}async function DS0($){let Y=await Dg($.link);if(!$.save)return{result:Y,reveal:$.reveal===!0};let U=OS0(Y.keys,Y.corpId,$,'seal-use corps hose-extract-keys "<url>" --save'),Q=await nq({domain:Y.baseUrl,appKey:U.appKey,appSecurity:U.appSecurity,corpId:Y.corpId,name:$.name??Y.corpName,staffId:Y.staffId,overwrite:$.overwrite,force:$.force});return{result:Y,selectedKey:U,saved:Q,reveal:$.reveal===!0}}function AS0($,Y){return{id:$.id,name:$.name||"-",appKey:$.appKey,appSecurity:Y?$.appSecurity:iH($.appSecurity),active:$.active,createTime:$.createTime,updateTime:$.updateTime}}var oQ;var BS0=o(()=>{s8();$E();oQ=class oQ extends Error{nextAction;constructor($,Y){super($);this.name="HoseKeySelectionError",this.nextAction=Y}}});function PS0($){if(!$)return;if($.length<=8)return"****";return`${$.slice(0,4)}...${$.slice(-4)}`}function TS0($){if($.source.type==="hose")return d7($,$.source);return $.seal.url??$.source.sealUrl}function ES0($){if($.type==="hose"){let Y=$.appKey??$.key;return{type:"hose",provider:$.provider??"hosecloud",domain:$.domain,corpId:$.corpId,staffId:$.staffId,appKey:PS0(Y),hasAppSecurity:Boolean($.appSecurity??$.password),hasCloseToken:Boolean($.closeToken),closeTokenExpiresIn:$.closeToken?$.expiresIn:void 0,closeTokenExpiresAt:$.closeToken?$.expiresAt:void 0,credentialMode:$.closeToken?"web-session":"persistent",sealUrl:$.sealUrl}}if($.type==="seal")return{type:"seal",provider:$.provider??"seal",tenantId:$.tenantId,tenantSlug:$.tenantSlug,tenantName:$.tenantName,providerUserId:$.providerUserId,staffId:$.staffId,corpId:$.corpId,sealUrl:$.sealUrl,hasToken:Boolean($.token),tokenMasked:PS0($.token),expiresIn:$.expiresIn,expiresAt:$.expiresAt};throw Error(`Unsupported enterprise source type: ${$.type}`)}function _o($){if(!$)return"未绑定手机";let Y=$.trim();if(Y.length===11)return`${Y.slice(0,3)}****${Y.slice(7)}`;if(Y.length>=7)return`${Y.slice(0,3)}****${Y.slice(-4)}`;if(Y.length>4)return`${Y.slice(0,2)}****${Y.slice(-2)}`;return Y}var YE=o(()=>{s8()});async function jS0($,Y,U){if($==="probe-hose"){let Q=F6(U.json),I=await LS0({appKey:Q7(Q,"appKey"),appSecurity:Q7(Q,"appSecurity"),domain:k6(Q,"domain")});return C0({domain:I.domain,corpId:I.corpId,name:I.corpName??I.corpId,roleCount:I.roleCount,roleGroups:I.roleGroups}),!0}if($==="hose-staffs"){let Q=F6(U.json),I=await FS0({appKey:Q7(Q,"appKey"),appSecurity:Q7(Q,"appSecurity"),domain:k6(Q,"domain"),role:k6(Q,"role"),roleDefId:k6(Q,"roleDefId")});return C0({domain:I.domain,corpId:I.corpId,corpName:I.corpName,roleId:I.roleId,roleName:I.roleName,count:I.staffs.length,staffs:I.staffs.map((J)=>({id:J.id,name:J.name,cellphone:_o(J.cellphone),active:J.active,authState:J.authState,userId:J.userId,email:J.email}))}),!0}if($==="add-hose-persistent"||$==="add-hose"){let I={...F6(U.json),...U.options.staffName?{staffName:R(U.options.staffName)}:{},...U.options["staff-name"]?{staffName:R(U.options["staff-name"])}:{},...U.options.staffPhone?{staffPhone:R(U.options.staffPhone)}:{},...U.options["staff-phone"]?{staffPhone:R(U.options["staff-phone"])}:{},...U.options.name?{name:R(U.options.name)}:{},...U.options.domain?{domain:R(U.options.domain)}:{},...U.options.corpId?{corpId:R(U.options.corpId)}:{},...U.options["corp-id"]?{corpId:R(U.options["corp-id"])}:{},...U.options.appKey?{appKey:R(U.options.appKey)}:{},...U.options["app-key"]?{appKey:R(U.options["app-key"])}:{},...U.options.appSecurity?{appSecurity:R(U.options.appSecurity)}:{},...U.options["app-security"]?{appSecurity:R(U.options["app-security"])}:{},...U.options.force!==void 0?{force:z0(U.options.force)}:{},...U.options.overwrite!==void 0?{overwrite:z0(U.options.overwrite)}:{}},J=await nq({...I,appKey:Q7(I,"appKey"),appSecurity:Q7(I,"appSecurity")});return C0({id:J.config.id,name:J.config.name,corpId:J.config.source.type==="hose"?J.config.source.corpId:void 0,domain:J.domain,staffId:J.staffId,verified:J.verified,path:J.path}),!0}if($==="add-hose-web-session"){let I={...F6(U.json),...U.options.name?{name:R(U.options.name)}:{},...U.options.domain?{baseUrl:R(U.options.domain)}:{},...U.options["base-url"]?{baseUrl:R(U.options["base-url"])}:{},...U.options.corpId?{corpId:R(U.options.corpId)}:{},...U.options["corp-id"]?{corpId:R(U.options["corp-id"])}:{},...U.options.staffId?{staffId:R(U.options.staffId)}:{},...U.options["staff-id"]?{staffId:R(U.options["staff-id"])}:{},...U.options.accessToken?{accessToken:R(U.options.accessToken)}:{},...U.options["access-token"]?{accessToken:R(U.options["access-token"])}:{},...U.options.overwrite!==void 0?{overwrite:z0(U.options.overwrite)}:{},...U.optio
Line truncated
|
||||
`);else console.error(`⚠️ [合思子域提权] 正在以明文展示合思 (Hose) appSecurity 接入密码,请妥善保管敏感凭据。
|
||||
`);C0({provider:"hose",capability:"privilege-elevation",corpId:Q.corpId,corpName:Q.corpName??Q.corpId,baseUrl:Q.baseUrl,staffId:Q.staffId,keyCount:Q.keys.length,keys:Q.keys.map((J)=>AS0(J,I))})}async function UE($,Y){let U=M1($),Q=Y.reveal===!0;if(U.source.type!=="hose")throw new G4(`【合思子域专享能力】当前企业「${U.name}」(id: ${U.id}) 为原生 Seal (${U.source.type}) 租户,非合思 (Hose/合思云/易快报) 渠道企业。
|
||||
`+"OpenAPI 密钥查询与提权能力专属于合思生态租户(用于从合思协助链接或合思凭据中提取开发者密钥提升权限等级),非合思渠道企业不支持此能力。",2);let I=U.source.appKey??U.source.key,J=U.source.appSecurity??U.source.password;if(!Q)console.error(`\uD83D\uDCA1 [合思子域] 接入密码默认脱敏,附加 --reveal (或 -r) 可查看完整 appSecurity 明文。
|
||||
`);else console.error(`⚠️ [合思子域] 正在以明文展示合思 appSecurity 接入密码,请妥善保管敏感凭据。
|
||||
`);C0({provider:"hose",capability:"privilege-elevation",corpId:U.id,corpName:U.name,domain:U.source.domain,staffId:U.source.staffId,appKey:I??"-",appSecurity:J?Q?J:iH(J):"-",active:!0})}var CS0=o(()=>{s8();jo();Ro();MS0();$E();BS0();p8();D4();L4();$4();YE()});var _S0,vS0,QE,RS0,t4;var X5=o(()=>{_S0=/^[\uD800-\uDBFF]$/,vS0=/^[\uDC00-\uDFFF]$/,QE=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;(function($){$[$.Unknown=0.0000000000001]="Unknown",$[$.Rule=0.000000000001]="Rule",$[$.DICT=0.00000002]="DICT",$[$.Surname=1]="Surname",$[$.Custom=1]="Custom"})(RS0||(RS0={}));t4={Normal:1,Surname:10,Custom:100}});function zY($){var Y;return $.length-(((Y=$.match(QE))===null||Y===void 0?void 0:Y.length)||0)}function R$($){if(QE.lastIndex=0,!QE.test($))return $.split("");let Y=[],U=0;while(U<$.length){let Q=$[U];if(_S0.test(Q)&&vS0.test($[U+1]))Y.push($.substring(U,U+2)),U+=2;else Y.push(Q),U+=1}return Y}class az{constructor(){this.NumberDICT=[],this.StringDICT=new Map}get($){if($.length>1)return this.StringDICT.get($);else{let Y=$.charCodeAt(0);return this.NumberDICT[Y]}}set($,Y){if($.length>1)this.StringDICT.set($,Y);else{let U=$.charCodeAt(0);this.NumberDICT[U]=Y}}clear(){this.NumberDICT=[],this.StringDICT.clear()}}var n9=o(()=>{X5()});function Pk1(){let $={零一:"líng yī",〇一:"líng yī",十一:"shí yī",一十:"yī shí",第一:"dì yī",一十一:"yī shí yī"};for(let Y in SS0)for(let U in hS0){let Q=`${Y}${U}`,I=`${SS0[Y]} ${hS0[U]}`;$[Q]=I}return $}var yS0,kS0,xS0,fS0,uS0,SS0,hS0,gS0,bS0,vo,iS0,cS0;var So=o(()=>{X5();n9();yS0=["zh","ch","sh","z","c","s","b","p","m","f","d","t","n","l","g","k","h","j","q","x","r","y","w",""],kS0=["j","q","x"],xS0=["uān","uán","uǎn","uàn","uan","uē","ué","uě","uè","ue","ūn","ún","ǔn","ùn","un","ū","ú","ǔ","ù","u"],fS0={uān:"üān",uán:"üán",uǎn:"üǎn",uàn:"üàn",uan:"üan",uē:"üē",ué:"üé",uě:"üě",uè:"üè",ue:"üe",ūn:"ǖn",ún:"ǘn",ǔn:"ǚn",ùn:"ǜn",un:"ün",ū:"ǖ",ú:"ǘ",ǔ:"ǚ",ù:"ǜ",u:"ü"},uS0=["ia","ian","iang","iao","ie","iu","iong","ua","uai","uan","uang","ue","ui","uo","üan","üe","van","ve"],SS0={一:"yì",二:"èr",三:"sān",四:"sì",五:"wǔ",六:"liù",七:"qī",八:"bā",九:"jiǔ",十:"shí",百:"bǎi",千:"qiān",万:"wàn",亿:"yì",单:"dān",两:"liǎng",双:"shuāng",多:"duō",几:"jǐ",十一:"shí yī",零一:"líng yī",第一:"dì yī",一十:"yī shí",一十一:"yī shí yī"},hS0={重:"chóng",行:"háng",斗:"dǒu",更:"gēng"};gS0=Pk1(),bS0=Object.keys(gS0).map(($)=>({zh:$,pinyin:gS0[$],probability:0.000000000001,length:zY($),priority:t4.Normal,dict:Symbol("rule")})),vo={不:{bú:[4]},一:{yí:[4],yì:[1,2,3]}},iS0={不:["的","而","之","后","也","还","地"],一:["的","而","之","后","也","还","是"]},cS0=Object.keys(vo)});var nS0,u5;var IE=o(()=>{n9();nS0={"bǎng páng pāng":["膀"],líng:["〇","伶","凌","刢","囹","坽","夌","姈","婈","孁","岺","彾","掕","昤","朎","柃","棂","櫺","欞","泠","淩","澪","灵","燯","爧","狑","玲","琌","瓴","皊","砱","祾","秢","竛","笭","紷","綾","绫","羐","羚","翎","聆","舲","苓","菱","蓤","蔆","蕶","蛉","衑","裬","詅","跉","軨","輘","酃","醽","鈴","錂","铃","閝","陵","零","霊","霗","霛","霝","靈","駖","魿","鯪","鲮","鴒","鸰","鹷","麢","齡","齢","龄","龗","㥄"],yī:["一","乊","伊","依","医","吚","咿","噫","壱","壹","夁","嫛","嬄","弌","揖","撎","檹","毉","洢","渏","漪","瑿","畩","祎","禕","稦","繄","蛜","衤","譩","辷","郼","醫","銥","铱","鷖","鹥","黟","黳"],"dīng zhēng":["丁"],"kǎo qiǎo yú":["丂"],qī:["七","倛","僛","凄","嘁","墄","娸","悽","慼","慽","戚","捿","柒","桤","桼","棲","榿","欺","沏","淒","漆","紪","緀","萋","褄","諆","迉","郪","鏚","霋","魌","鶈"],shàng:["丄","尙","尚","恦","緔","绱"],xià:["丅","下","乤","圷","夏","夓","懗","梺","疜","睱","罅","鎼","鏬"],hǎn:["丆","喊","浫","罕","豃","㘎"],"wàn mò":["万"],zhàng:["丈","仗","墇","嶂","帐","帳","幛","扙","杖","涱","痮","瘬","瘴","瞕","粀","胀","脹","賬","账","障"],sān:["三","厁","叁","弎","毵","毶","毿","犙","鬖"],"shàng shǎng shang":["上"],"qí jī":["丌","其","奇"],"bù fǒu":["不"],"yǔ yù yú":["与"],miǎn:["丏","偭","免","冕","勉","勔","喕","娩","愐","汅","沔","湎","睌","緬","缅","腼","葂","靦","鮸","\uD867\uDF83"],gài:["丐","乢","匃","匄","戤","概","槩","槪","溉","漑","瓂","葢","鈣","钙","\uD872\uDFBF"],chǒu:["丑","丒","侴","吜","杽","瞅","矁","醜","魗"],zhuān:["专","叀","嫥","専","專","瑼","甎","砖","磗","磚","蟤","諯","鄟","顓","颛","鱄","䏝"],"qiě jū":["且"],pī:["丕","伓","伾","噼","坯","岯","憵","批","披","炋","狉","狓","砒","磇","礔","礕","秛","秠","耚","豾","邳","鈚","鉟","銔","錃","錍","霹","駓","髬","魾","\uD873\uDCF5"],shì:["世","丗","亊","事","仕","侍","冟","势","勢"
Line truncated
|
||||
`+`\uD83D\uDC49 查看全部请添加: seal-use corps list --all
|
||||
`+"\uD83D\uDC49 检索指定企业请使用: seal-use corps search <keyword>")}return C0(F.map((N)=>({id:N.id,name:N.name,environment:N.environment??"production",sourceType:N.source.type,provider:N.source.provider??N.source.type,staffId:N.source.staffId,testCorpId:N.testCorpId,prodCorpId:N.prodCorpId,current:N.id===H}))),!0}if($==="get"||$==="show"){let Q=Y??R(U.options.corp);if(!Q)throw E4("Usage: seal-use corps get <corpId>");let I=M1(Q),J=xd(I.id),K=TS0(I);return C0({id:I.id,name:I.name,environment:I.environment??"production",configFile:J,seal:{url:K,tenantSlug:I.seal.tenantSlug??I.source.tenantSlug,customHeaderNames:I.seal.headers?Object.keys(I.seal.headers):[],customCookieNames:I.seal.cookies?Object.keys(I.seal.cookies):[],endpoints:I.seal.endpoints},source:ES0(I.source),relations:{testCorpId:I.testCorpId,prodCorpId:I.prodCorpId},auth:{refreshTtl:I.auth.refreshTtl}}),!0}if($==="current"){let Q=M1(R(U.options.corp));return C0({id:Q.id,name:Q.name,environment:Q.environment??"production",sourceType:Q.source.type,provider:Q.source.provider??Q.source.type,staffId:Q.source.staffId,testCorpId:Q.testCorpId,prodCorpId:Q.prodCorpId}),!0}if($==="mark"||$==="mark-test"||$==="mark-prod"){let Q=Y??R(U.options.corp);if(!Q)throw E4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");let I=M1(Q),J=$==="mark-test"?"test":$==="mark-prod"?"production":R(U.options.env)??R(U.options.environment);if(J!=="production"&&J!=="test")throw E4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");if(!(z0(U.options.confirm)===!0||z0(U.options.yes)===!0))throw m6(`Refusing to change environment tag of enterprise '${I.name}' (${I.id}) to '${J}' without --confirm. Marking alters synchronization safety guards.`,`seal-use corps mark ${I.id} --env ${J} --confirm`);let z=y9(I.id,{environment:J});return C0({id:z.id,name:z.name,environment:z.environment,testCorpId:z.testCorpId,prodCorpId:z.prodCorpId}),!0}if($==="rename"){let Q=Y??R(U.options.corp)??R(U.options.id),I=R(U.options.name)??R(U.options.to)??(U.command[3]&&!U.command[3].startsWith("-")?U.command[3]:void 0);if(!Q||!I)throw Error("Usage: seal-use corps rename <corpId> --name <newName>");let J=M1(Q),K=y9(J.id,{name:I});return C0({success:!0,id:K.id,name:K.name,previousName:J.name}),!0}if($==="switch"){let Q=Y;if(!Q)throw Error("Usage: seal-use corps switch <corpId>");let I=T4();if(!I.stateful)throw Error("Cannot switch the default enterprise while stateless mode is enabled. Use `seal-use config mode stateful` first.");let J=M1(Q);return AQ({...I,stateful:!0,defaultCorpId:J.id}),C0({current:!0,id:J.id,name:J.name}),!0}return!1}var mh0=o(()=>{a$();dh0();LP();D4();p8();L4();$4();YE()});import{existsSync as lk1,mkdirSync as ok1,readFileSync as rk1,writeFileSync as lh0}from"node:fs";import{homedir as sk1}from"node:os";import{join as WE}from"node:path";function oh0(){let $=process.env.SEAL_USE_MAPPINGS_DIR?.trim();if($)return $;return WE(sk1(),".config","seal-use","mappings")}function rh0($){let Y=oh0();ok1(Y,{recursive:!0,mode:448});let U=WE(Y,`${$.target.id}-v${$.target.publishedVersionNumber}.json`),Q=WE(Y,`${$.target.id}-latest.json`),I=JSON.stringify($,null,2);return lh0(U,I,{encoding:"utf-8",mode:384}),lh0(Q,I,{encoding:"utf-8",mode:384}),U}function sh0($,Y){let U=oh0(),Q;if(!Y||Y==="latest")Q=`${$}-latest.json`;else{let J=String(Y).replace(/^v/i,"");Q=`${$}-v${J}.json`}let I=WE(U,Q);if(!lk1(I))return null;try{let J=rk1(I,"utf-8"),K=JSON.parse(J);if(typeof K.syncedAt==="string")K.syncedAt=T8(K.syncedAt);return K}catch{return null}}function no($){return $.replace(/^0+(?=\d)/,"")}function th0($,Y){if(!Y)return $;let U=no(Y.trim().toLowerCase().replace(/^#/,""));return $.filter((Q)=>{let I=String(Q.sourceRuleCode).toLowerCase().replace(/^#/,""),J=String(Q.targetRuleCode).toLowerCase().replace(/^#/,""),K=no(J.replace(/^rule-/,"")),z=no(I.replace(/^rule-/,""));return I===U||J===U||z===U||K===U||Q.sourceRuleId.toLowerCase()===U||Q.targetRuleId.toLowerCase()===U})}function ah0($,Y,U){let Q=0,I=Y!==void 0?new RegExp(`\\[Prod v${Y}\\s*·\\s*#(\\d+)(?:[^\\]]*)\\]`):/\[Prod draft\s*·\s*#(\d+)(?:[^\]]*)\]/;for(let K of U){if(!K.versionName)continue;let z=K.versionName.match(I);if(z&&z[1]){let G=parseInt(z[1],10);if(!isNaN(G)&&G>Q)Q=G}}if(Q>0)return Q+1;if(!U.some((K)=>K.versionName&&/\[Prod v\d+/.test(K.versionName))){let K=U.filter((z)=>z.versionName&&z.versionName.includes(`Sync from ${$}`)).length;if(K>0)return K+1}return 1}function eh0($,Y,U,Q){let I=Y!==void 0?`Prod v${Y}`:"Prod draft",J=Q!==void 0?` -> Test v${Q}`:"";return`Sync from ${$} [${I} · #${U}${J}]`}var po=()=>{};import{randomBytes as tk1}from"node:crypto";async function XE($,Y,U={}){let Q=await P1($),I=await P1(Y),[J,K,z,G,H,W,X,Z]=await Promise.all([d1(Q,$.seal.endpoints.approvalStylePreferences),d1(I,Y.seal.endpoints.approvalStylePreferences),Q6(Q),Q6(I),y8(Q),y8(I),$g0(Q),$g0(I)]),q=(X.articles||[]).filter((c)=>!c.isDeleted),V=(Z.articles||[]).filter((c)=>!c.isDeleted),w=new Map(V
Line truncated
|
||||
Run 'seal-use corps bind-test ${I.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association.`);let J=M1(I.testCorpId);if(J.environment!=="test")throw Error(`Target enterprise '${J.name}' (${J.id}) is marked as '${J.environment}', NOT 'test'. Aborting sync to protect non-test environments.`);let K=R(U.options["version-name"])??R(U.options.versionName),z=z0(U.options["dry-run"])===!0||z0(U.options.dryRun)===!0,G=z0(U.options.yes)===!0||z0(U.options.confirm)===!0;if(z)return C0(await XE(I,J,{versionName:K,dryRun:!0})),!0;if(!G){let H=await XE(I,J,{versionName:K,execute:!1});throw m6(`Refusing to overwrite test enterprise '${J.name}' (${J.id}) with preferences, ${H.rulesPlan.sourceDraftRuleCount} draft rules, and ${H.documentsPlan.sourceDocumentCount} knowledge documents from production enterprise '${I.name}' (${I.id}) without --yes. This will replace test draft rules, synchronize knowledge documents, and publish a new version on the test enterprise.`,`seal-use corps sync-test ${I.id} --yes`)}return C0(await XE(I,J,{versionName:K,execute:!0})),!0}if($==="replay-test"){let Q=Y??R(U.options.corp)??R(U.options.prodCorp)??R(U.options["prod-corp"]),I=M1(Q),J=z0(U.options.force)===!0,K=z0(U.options.dryRun)??z0(U.options["dry-run"]),z=z0(U.options.yes)===!0||z0(U.options.confirm)===!0,G;if(!I.testCorpId){if(!J)throw E4(`Production enterprise '${I.name}' (${I.id}) has no bound test enterprise.
|
||||
Run 'seal-use corps bind-test ${I.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association,
|
||||
or add '--force' (or use 'seal-use webhook replay <recordId> --force') if you explicitly intend to replay directly within production.`);G=I}else if(G=M1(I.testCorpId),G.environment!=="test"&&!J)throw Error(`Target enterprise '${G.name}' (${G.id}) is marked as '${G.environment}', NOT 'test'. Aborting replay to protect non-test environments (use --force to override).`);if(!K&&!z)throw m6("Refusing to replay approval records without --confirm. Use --dry-run to preview the payload without sending it.",`seal-use corps replay-test ${Q??"<prodCorpId>"} --confirm`);let H=R(U.options.recordId)??R(U.options["record-id"])??R(U.options.id),W=R(U.options.recordIds)??R(U.options["record-ids"]),X=W?W.split(",").map((D)=>D.trim()).filter(Boolean):void 0,Z=R(U.options.sn)??R(U.options.documentSn)??R(U.options["document-sn"]),q=R(U.options.sns)??R(U.options["document-sns"]),V=q?q.split(",").map((D)=>D.trim()).filter(Boolean):void 0,w=l0(U.options.limit)??(!H&&!X&&!Z&&!V?1:void 0),M={recordId:H,recordIds:X,sn:Z,sns:V,limit:w,status:R(U.options.status),startDate:R(U.options.startDate)??R(U.options["start-date"]),endDate:R(U.options.endDate)??R(U.options["end-date"])},F=await P1(I),N=I.id===G.id?F:await P1(G);console.error(`[corps-replay-test] 正式企业「${I.name}」(${I.id}) -> 测试企业「${G.name}」(${G.id})`);let O=await Fz({query:M,sourceClient:F,targetClient:N,sourceCorp:I,targetCorp:G,webhookSelector:R(U.options.webhook)??R(U.options.selector),snPrefix:R(U.options.snPrefix)??R(U.options["sn-prefix"]),snSuffix:R(U.options.snSuffix)??R(U.options["sn-suffix"]),docIdPrefix:R(U.options.docIdPrefix)??R(U.options["doc-id-prefix"]),docIdSuffix:R(U.options.docIdSuffix)??R(U.options["doc-id-suffix"]),dryRun:K});if(K)return console.error(`[corps-replay-test] 预览模式:已成功从 ${I.name} 提取单据并转换为 Webhook Payload(未实际推送)。`),C0(O),!0;if(O.success)console.error(`\uD83D\uDFE2 成功重放 ${O.successCount} 条单据(来自「${I.name}」)至「${G.name}」(${O.targetWebhook?.name??"Webhook 通道"})`);else console.error(`\uD83D\uDD34 单据重放部分或全部失败(成功 ${O.successCount} 条,失败 ${O.failureCount} 条)至「${G.name}」`);if(console.error(`\uD83D\uDC49 Next action: seal-use approval-runs list --corp ${G.id} --limit ${O.totalCount}`),C0(O),!O.success)throw new G4(`Approval record replay failed: ${O.failureCount} record(s) failed.`,1);return!0}return!1}var Ug0=o(()=>{i6();mo();Jq();D4();p8();L4();$4();mo()});async function Qg0($,Y,U){if(await ph0($,Y,U))return;if(await KS0($,Y,U))return;if(await Yg0($,Y,U))return;if(await jS0($,Y,U))return;throw Error(`Unknown corps command: ${$??""}. Run 'seal-use help' for available commands.`)}var lo=o(()=>{zS0();CS0();mh0();Ug0();YE()});var Kg0={};L8(Kg0,{handleAuthExtractKeysCommand:()=>ro,handleAuthCommand:()=>VE,formatBeijingIso:()=>A1});async function ro($,Y){let U=$??R(Y.options.link)??R(Y.options.url);if(!U)throw Error("Usage: seal-use auth hose-extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let Q=z0(Y.options.reveal)===!0||z0(Y.options.r)===!0||z0(Y.options.plain)===!0,I=z0(Y.options.save)===!0||z0(Y.options.add)===!0;await dq(U,{reveal:Q,save:I,name:R(Y.options.name),overwrite:z0(Y.options.overwrite)===!0,force:z0(Y.options.force)===!0,appKey:R(Y.options["app-key"])??R(Y.options.appKey),keyId:R(Y.options["key-id"])??R(Y.options.keyId)})}async function VE($,Y,U){let Q=U.command[2]?.toLowerCase(),I=R(U.options["from-link"])??(Q==="from-link"?U.command[3]:void 0);if(($==="seal-link"||$==="link"||$==="hose-link"&&Y?.source?.type==="seal")&&I){let J=R(U.options.note),K=await PM(I),z=C6(K.sealUrl,K.token),G=await t6(z);TM(K.corpId,G.tenant);let H=await KJ(z,{note:J});C0({tenant:{id:G.tenant.id,name:G.tenant.name,tenantSlug:G.tenant.tenantSlug,corpId:K.corpId},user:{id:G.user.id,name:G.user.name,providerUserId:G.user.providerUserId,isAdmin:G.user.isAdmin},delegation:H,expiresIn:K.expiresIn});return}if(!Y)throw Error(`auth ${$??""} requires an enterprise. Provide --corp <id> or select one.`);if($==="check"||$==="diagnose"||$==="status"||$==="test"||$==="doctor"){C0(await $x1(Y));return}if($==="seal-link"||$==="link"||$==="hose-link"&&Y.source?.type==="seal"){let J=await P1(Y);if(Q==="list"){await v0("seal_delegation_list",J,Y,{},T0(U.options));return}if(Q==="revoke"){let X=U.command[3]??R(U.options.tokenId)??R(U.options.id);if(!X)throw Error("Usage: seal-use auth link revoke <tokenId>");await v0("seal_delegation_revoke",J,Y,{tokenId:X},T0(U.options));return}let K=R(U.options.note)??"CLI generated provisional access link",z=await C$("seal_delegation_create",J,Y,{note:K});if($==="hose-link")console.error(`\uD83D\uDC49 提示: 企业「${Y.name}」源类型为 Seal 原生测试环境,已自动为您生成委托免登直达链接。`);let G=z,H="staffName"in Y.source&&typeof Y.source.staffName==="string"?Y.source.staffName:void 0,W=A1(Date.now()+86400000);C0({id
Line truncated
|
||||
|
||||
`+`支持的审批系统与发布目标:
|
||||
`+` • hosecloud (合思费控): seal-use deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>
|
||||
`+` • webhook (通用审批流回调): seal-use webhook <list|get|add|update|delete> --corp <corpId>
|
||||
`+` • feishu (飞书审批): 建议使用 Webhook 模式对接
|
||||
`+` • weaver (泛微 OA): 建议使用 Webhook 模式对接
|
||||
`+` • helios (汇联易): 建议使用 Webhook 模式对接
|
||||
`+" • maycur (每刻报销): 建议使用 Webhook 模式对接");if($==="webhook"||$==="webhooks")throw Error("Webhook 审批流发布请直接使用专有命令:seal-use webhook <list|get|add|update|delete> --corp <corpId>");if($==="feishu"||$==="lark")throw Error("飞书审批发布:建议使用 Webhook 通用发布模式对接。命令:seal-use webhook add --name '飞书审批' --result-url <url> --corp <corpId>");if($==="weaver")throw Error("泛微 OA 发布:建议使用 Webhook 通用发布模式对接。命令:seal-use webhook add --name '泛微OA' --result-url <url> --corp <corpId>");if($==="maycur"||$==="helios"){let H=$==="maycur"?"每刻报销":"汇联易";throw Error(`${H}发布:目前可通过 Webhook 模式接入。命令:seal-use webhook add --name '${H}' --result-url <url> --corp <corpId>`)}let K=$==="hosecloud",z=$==="hosecloud"?Y:$,G=$==="hosecloud"?U:Y;if(!K)throw Error(`未知的发布目标系统: ${$}。当前支持: hosecloud (合思费控) 与 webhook (通用回调)。`);if(z==="requirements"){await v0("seal_deploy_hosecloud_requirements",Q,I,{},T0(J.options));return}if(z==="list"){await v0("seal_deploy_hosecloud_list",Q,I,{},T0(J.options));return}if(z==="get"){let H=G??R(J.options.signKey)??R(J.options["sign-key"]);if(!H){let X=((await d1(Q)).integrations??[]).filter((Z)=>Z.type==="hosecloud");if(X.length===0)throw Error(`当前企业 (${I.name}) 尚未添加合思发布配置。
|
||||
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${I.id}`);console.error(`Usage: seal-use deploy hosecloud get <sign-key> [--corp ${I.id}]
|
||||
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let Z of X){let q=Z.outboundName??"SealAI 审批",V=Z.signKey,w=Z.apiOrigin??"production";console.error(` • "${q}" (signKey: ${V}, 环境: ${w})`),console.error(` \uD83D\uDC49 查看命令: seal-use deploy hosecloud get ${V} --corp ${I.id}
|
||||
`)}throw new G4("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。",2,X.length===1?`seal-use deploy hosecloud get ${X[0].signKey} --corp ${I.id}`:void 0)}await v0("seal_deploy_hosecloud_get",Q,I,{signKey:H},T0(J.options));return}if(z==="status"){await v0("seal_deploy_hosecloud_status",Q,I,{},T0(J.options));return}if(z==="configure"){let H=R(J.options.input),W=H?JSON.parse(Ix1(H,"utf8")):F6(J.json);if(!W||Object.keys(W).length===0)throw Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");await v0("seal_deploy_hosecloud_configure",Q,I,{...W,dryRun:z0(J.options.dryRun)??z0(J.options["dry-run"])},T0(J.options));return}if(z==="sync"){let H=G??R(J.options.signKey)??R(J.options["sign-key"]),W=z0(J.options.auto)??z0(J.options.yes);if(!H){let Z=((await d1(Q)).integrations??[]).filter((V)=>V.type==="hosecloud");if(Z.length===0)throw Error(`当前企业 (${I.name}) 尚未添加合思发布配置。
|
||||
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${I.id}`);let q=Z[0];if(q&&Z.length===1&&W){let V=q.signKey;console.error(`ℹ️ [auto] 检测到企业仅有 1 个合思配置,已自动选择 (signKey: ${V})`),await v0("seal_deploy_hosecloud_sync",Q,I,{signKey:V},T0(J.options));return}console.error(`Usage: seal-use deploy hosecloud sync <sign-key> [--corp ${I.id}]
|
||||
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of Z){let w=V.outboundName??"SealAI 审批",M=V.signKey,F=V.apiOrigin??"production";console.error(` • "${w}" (signKey: ${M}, 环境: ${F})`),console.error(` \uD83D\uDC49 同步命令: seal-use deploy hosecloud sync ${M} --corp ${I.id}
|
||||
`)}if(Z.length===1)console.error(`\uD83D\uDCA1 提示:若希望单配置自动同步,可附加 --auto 参数:seal-use deploy hosecloud sync --auto --corp ${I.id}
|
||||
`);throw new G4("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,Z.length===1?`seal-use deploy hosecloud sync ${Z[0].signKey} --corp ${I.id}`:void 0)}await v0("seal_deploy_hosecloud_sync",Q,I,{signKey:H},T0(J.options));return}throw Error(`Unknown deploy hosecloud action: ${z??""}. Available: requirements, list, get, status, configure, sync.`)}var Mg0=o(()=>{D4();L4();$4();X4();p8()});var Ng0='---\nname: seal-use\ndescription: "v0.10.40: Use for Seal Use enterprise onboarding, Hose/合思 or Seal-native authentication, approval operations, diagnosis, simulation, rules, users, configuration, and search."\nmetadata:\n version: 0.10.40\n short-description: Seal tenant and Hose approval automation (v0.10.40)\n---\n\n# Seal Use\n\nCLI 是主执行通道。机器通道 `stdout` 必须是纯 JSON;诊断日志、进度和下一步建议写入 `stderr`。MCP 默认关闭。\n\n## 时间与输出\n\n- 机器字段统一使用带 `+08:00` 北京时间偏移的 ISO 8601 秒级格式,不带毫秒,例如 `2026-09-28T11:51:09+08:00`。\n- 面向用户解释时间时,直接基于 `Asia/Shanghai`(北京时间)表述,无需再做 `+8` 小时换算。\n- 不向用户暴露 Bearer、`accessToken`、`closeToken`、`appSecurity`、原始 cURL 或未脱敏手机号。\n- 不向用户直接暴露底层 UUID、`tenantSlug`、`boundCorpRole` 等内部字段;优先使用企业名称、规则编号(例如 `0038`)和脱敏后的业务信息。\n\n## 企业接入:先识别材料,再选择入口\n\n最终企业来源只有两种:`source.type: "seal"` 和 `source.type: "hose"`。不要把材料格式、认证凭据和最终来源混为一谈。\n\n| 用户材料 | 标准入口 | 最终配置形态 |\n| --- | --- | --- |\n| Hose 开放平台 `appKey + appSecurity` | `corps add-hose-persistent` | Hose 持久化凭据 |\n| Seal URL + Bearer,或 Seal 页面 cURL | `corps add-seal-bearer` | Seal Bearer 会话 |\n| Seal 原生委托链接 | `corps add-link <url>` | Seal 委托会话 |\n| Hose 协助链接 | `corps add-link <url>` | Hose Web Session;加 `--elevate-hose` 才提取长期密钥 |\n| Hose 页面 cURL | 先提取密钥;失败时 `corps add-hose-web-session` | Hose 持久化或 Hose Web Session |\n| 已规范化的 Hose `corpId + accessToken + baseUrl` | `corps add-hose-web-session` | Hose Web Session |\n\n### 凭据边界\n\n- Seal Bearer 只能给 `add-seal-bearer`;Hose `accessToken/accesstoken/closeToken` 不能直接当作 Seal Bearer。\n- Hose Web Session 保存 `closeToken + staffId`,需要调用 Seal 时才通过 SSO 换取运行时 Seal Bearer。\n- Hose 持久化配置保存 `appKey + appSecurity`,适合无人值守、部署和长期同步。\n- 会话有有效期时,Hose source 保存 `expiresIn` 和北京时间 ISO 秒级 `expiresAt`(`+08:00`)。\n- `add-link` 是 URL 混合入口,不接收 cURL:自动识别 Seal 委托链接和 Hose 协助链接。\n- `--elevate-hose` 是唯一明确的 Hose 提权动作。\n\n收到 Hose 管理员 cURL 时,按 Hose 协助链接处理:解析主机、`accesstoken`、企业标识和必要会话信息,优先调用密钥提取路径;无法提取长期密钥时才保存 Web Session。收到 Seal cURL 时,提取 Seal 主机和 `Authorization: Bearer`,走 `add-seal-bearer`。不要盲目执行 cURL,也不要把原文写入文件或日志。\n\n详细来源决策、提权边界和 cURL 处理见 `references/enterprise-onboarding.md`;首次找材料时必须使用 `references/first-time-user.md`。\n\n## 首次接入图文规则\n\n当用户首次接入、询问如何取得材料,或需要用户打开后台找凭据时:\n\n1. 先确认用户手上是 Hose 开放平台凭据、协助链接、Seal 委托链接,还是已登录网页 cURL。\n2. 读取 `references/first-time-user.md`,只渲染与当前路径对应的截图;不能只给纯文字步骤。\n3. 接收材料后由 Agent 自动发现企业、域名和管理员。除非自动发现失败,不要要求用户先填写 `corpId`、`staffId` 或域名。\n\n## `corps` 主线\n\n- 接入:`add-link`、`add-seal-bearer`、`add-hose-persistent`、`add-hose-web-session`\n- 发现:`list`、`search`/`find`、`get`/`show`、`current`、`switch`\n- 维护:`mark`、`rename`\n- 测试闭环:`bind-test`、`unbind-test`、`sync-test`、`replay-test`\n- Hose 专属:`probe-hose`、`hose-staffs`、`hose-extract-keys`、`hose-keys`\n\nHose 专属命令应从命令名或选项中明确可见:`auth hose-*`、`approval-runs hose-flow`、`deploy hosecloud`、`simulation --mode hosecloud`。跨来源入口只有在明确使用 `--elevate-hose`、`--with-flow` 或 `--type hose-document` 时才启用对应 Hose 能力。\n\n生产规则变更遵循:生产改草稿 → 同步测试 → 模拟/回归验证 → 用户确认 → 生产发布。`sync-test`、`replay-test`、规则发布和清空等高风险操作优先 `--dry-run`Line truncated
|
||||
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:W?K:Z?V:H,type:X,mode:Z?"auto_login":"direct",sealResultUrl:H,hoseDocumentUrl:K,documentUrl:K,ssoUrl:V,expiresIn:Z?q:void 0,identity:w,warning:M,hoseDomain:J.type==="hose"?Ek1(J.domain):void 0,recordId:I.id,sourceDocumentSN:I.sourceDocumentSN,sourceDocumentId:I.sourceDocumentId,sourceSystem:I.sourceSystem,missing:{hoseDocumentUrl:!K?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:L.object({query:L.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:L.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:L.string().optional().describe("模拟批次 ID"),latest:L.boolean().optional().describe("只返回最新一条匹配记录"),fields:L.union([L.string(),L.array(L.string())]).optional().describe("限制返回字段"),limit:L.number().int().positive().max(100).optional(),maxScan:L.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:L.boolean().optional()}),handler:async($,Y,U)=>{let Q=Y.sn??Y.query;if(!Q)throw Error("query or sn is required");let I=await Rk1($,{query:Q,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),J=await Promise.all(I.records.map((W)=>X4($,W.id))),K=Kh0(Y.fields),z=J.map((W)=>Ak1(W,K)),H=J.find((W)=>W.ruleSetVersionNumber!==void 0)?.ruleSetVersionNumber,G=H===void 0?"latest":String(H);return{query:Q,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:I.total,scanned:I.scanned,matched:z.length,records:z,next:{getSummary:`seal-use approval-runs get <recordId> --summary --corp ${U.corp.id}`,getRuleVersion:`seal-use rules version ${G} --corp ${U.corp.id}`,searchRuleVersion:`seal-use rules search <keyword> --version ${G} --corp ${U.corp.id}`,getVersionContext:`seal-use context --ruleVersion ${G} --corp ${U.corp.id}`},...Y.includeBridge?{bridge:go(J)}:{}}}},{name:"seal_approval_run_langfuse_bridge_get",description:"从 Seal approval run 中抽取 Langfuse 定位信息;优先返回 _langfuseTraceId,没有时给出 hosecloud-{sourceDocumentSN} session 回退",parameters:L.object({recordId:L.string().optional(),sourceDocumentSN:L.string().optional(),sourceDocumentId:L.string().optional(),simulationBatchId:L.string().optional(),limit:L.number().int().positive().max(100).optional()}),handler:async($,Y)=>{let Q=(Y.simulationBatchId?await ZO($,Y.simulationBatchId):(await b4($,{limit:Y.limit??50,search:Y.sourceDocumentSN??Y.sourceDocumentId,sourceDocumentSN:Y.sourceDocumentSN,sourceDocumentId:Y.sourceDocumentId})).records).filter((I)=>gk1(I,{recordId:Y.recordId,sourceDocumentSN:Y.sourceDocumentSN,sourceDocumentId:Y.sourceDocumentId}));return{count:Q.length,records:Q.map(Jh0),bridge:go(Q)}}},{name:"seal_approval_runs_stats",description:"统计审核记录状态分布、来源系统分布及按单号/ID去重统计",parameters:L.object({since:L.string().optional().describe("时间范围,如 3months, 7days, 24hours"),dedupeBy:L.enum(["sourceDocumentSN","sourceDocumentId","id"]).default("sourceDocumentSN").describe("去重字段"),status:L.string().optional(),sourceSystem:L.string().optional(),taskMode:L.string().optional()}),handler:async($,Y)=>{let U=await b4($,{limit:1000,status:Y.status,sourceSystem:Y.sourceSystem,taskMode:Y.taskMode}),Q=Y.dedupeBy??"sourceDocumentSN",I=U.records,J={},K={},z=new Set;for(let G of I){let W=G.status??"unknown";J[W]=(J[W]??0)+1;let X=G.sourceSystem??"unknown";K[X]=(K[X]??0)+1;let Z=G[Q];if(Z)z.add(String(Z))}let H=Math.max(0,I.length-z.size);return{total:I.length,dedupeBy:Q,unique:z.size,duplicateRuns:H,dedupeNote:H>0?`存在 ${H} 笔重复运行记录 (同一单据重跑或修改重推)`:"全部单据唯一,无重复记录",byStatus:J,bySourceSystem:K}}},{name:"seal_approval_runs_count",description:"统计符合条件的审核记录总数",parameters:L.object({status:L.string().optional(),sourceSystem:L.string().optional(),taskMode:L.string().optional(),search:L.string().optional(),startDate:L.string().optional().describe("起始时间戳(毫秒)或日期字符串"),endDate:L.string().optional().describe("结束时间戳(毫秒)或日期字符串")}),handler:async($,Y)=>{let U=await b4($,{limit:1,status:Y.status,sourceSystem:Y.sourceSystem,taskMode:Y.taskMode,search:Y.search,startDate:e$(Y.startDate,!1),endDate:e$(Y.endDate,!0)});return{total:U.total??U.records.length}}}]});import{readFileSync as yk1}from"node:fs";var yo,kk1,xk1,fk1,uk1,bk1,ik1,ck1,Xh0;var Zh0=o(()=>{Z6();Z4();a2();({parseDurationMs:yo,buildSimulationBatch
Line truncated
|
||||
the credentials already stored on this machine for the selected enterprise. Keep it bound
|
||||
to loopback (\`--host 127.0.0.1\`) and do not expose the port to a network or an origin you
|
||||
do not control.
|
||||
`}},parameters:{CorpId:{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."},Offset:{name:"offset",in:"query",schema:{type:"integer",minimum:0,default:0},description:"Zero-based pagination offset."},Limit:{name:"limit",in:"query",schema:{type:"integer",minimum:1,maximum:100,default:50},description:"Maximum number of records to return."},RuleId:{name:"ruleId",in:"path",required:!0,schema:{type:"string"},description:"Approval rule ID."},VersionId:{name:"versionId",in:"path",required:!0,schema:{type:"string"},description:"Published rule version ID."},DocumentId:{name:"documentId",in:"path",required:!0,schema:{type:"string"},description:"Approval knowledge document ID."},RecordId:{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-use approval run record ID."},BatchId:{name:"batchId",in:"path",required:!0,schema:{type:"string"},description:"Simulation batch ID."}},responses:{BadRequest:{description:"Invalid request.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},Unauthorized:{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},NotFound:{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}},schemas:{ErrorResponse:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}},CorpSummary:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","seal"]},current:{type:"boolean"}}},SwitchCorpRequest:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}},SwitchCorpResponse:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}},SourceConfig:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."},AuthStage:{type:"object",additionalProperties:!0,required:["name","ok"],properties:{name:{type:"string",examples:["hose.openapi","hose.provisional","seal.sso","seal.whoami"]},ok:{type:"boolean"},error:{type:"string"}}},AuthDiagnosis:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}},SealUser:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},tenantId:{type:"string"},name:{type:"string"},isAdmin:{type:"boolean"},permissions:{type:"array",items:{type:"string"}}}},SealTenant:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},name:{type:"string"},tenantSlug:{type:"string"}}},WhoamiResponse:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}},SessionResponse:{type:"object",additionalProperties:!0,required:["user","session"],properties:{user:{$ref:"#/components/schemas/SealUser"},session:{type:"object",additionalProperties:!0}}},ApprovalRule:{type:"object",additionalProperties:!0,required:["id","description","scope","strictness"],properties:{id:{type:"string"},description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]},status:{type:"string"}}},ApprovalRuleInput:{type:"object",required:["description","scope","strictness"],properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulePatch:{type:"object",additionalProperties:!1,properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulesResponse:{type:"object",required:["rules"],properties:{rules:{type:"array",items:{$ref:"#/components/schemas/ApprovalRule"}},hasPendingDeletes:{type:"boolean"}}},RuleSetVersion:{type:"object",additionalProperties:!0,required:["id","versionNumber","versionName","rules"],properties:{id:{type:"string"},versionNumber:{type:"integer"},versionName:{type:"string"},publishedByName:{type:"string"},rules:{type:"array",items:{type:"object",additionalProperties:!0}}}},PublishRuleVersionRequest:{type:"object",required:["versionName"],properties:{versionName:{type:"string"}}},ApprovalDocument:{type:"object",additionalProperties:!0,required:["id","title","content"],properties:{id:{type:"string"},title:{typ
Line truncated
|
||||
`,"utf8"),{detected:Q,configured:!0,configPath:U,targetDir:Y,action:"created"};let I={};try{I=JSON.parse(Eh0(U,"utf8"))}catch{I={entries:[]}}if(!Array.isArray(I.entries))I.entries=[];if(I.entries.findIndex((z)=>z&&typeof z.path==="string"&&z.path===Y)!==-1)return{detected:Q,configured:!0,configPath:U,targetDir:Y,action:"already_present"};let K=I.entries.findIndex((z)=>z&&typeof z.path==="string"&&(z.path==="~/.agents/skills"||z.path==="~/.agents/skills/"));if(K!==-1)return I.entries[K]={...I.entries[K],path:Y},no(U,JSON.stringify(I,null,2)+`
|
||||
`,"utf8"),{detected:Q,configured:!0,configPath:U,targetDir:Y,action:"updated_tilde"};return I.entries.unshift({path:Y}),no(U,JSON.stringify(I,null,2)+`
|
||||
`,"utf8"),{detected:Q,configured:!0,configPath:U,targetDir:Y,action:"prepended"}}function lo($){let Y=$?.targetSkillsDir??Ch0(),U=$?.configFile??Rh0(),Q=_h0(),I=!1;if(rq(U))try{let J=JSON.parse(Eh0(U,"utf8"));if(Array.isArray(J?.entries))I=J.entries.some((K)=>K?.path===Y)}catch{}return{detected:Q,configured:I,configPath:U,targetDir:Y}}var oo=()=>{};import{cpSync as tk1,existsSync as tz,lstatSync as hh0,mkdirSync as ek1,realpathSync as zY,rmSync as $x1,symlinkSync as Yx1,unlinkSync as vh0}from"node:fs";import{homedir as Sh0}from"node:os";import{dirname as gh0,join as HY}from"node:path";function Ux1($,Y){let U=Y?.baseHomeDir??Sh0(),Q=HY(U,$.rootDirName),I=Y?.sourceSkillDir??HY(U,".agents","skills","seal-use"),J=gh0(I),K=HY(Q,"skills"),z=HY(K,"seal-use");if(!tz(Q))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(tz(K)&&tz(J))try{if(zY(K)===zY(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}ek1(K,{recursive:!0});let H;try{H=hh0(z)}catch{H=void 0}let G=!1;if(H)if(H.isSymbolicLink()){try{if(zY(z)===zY(I))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:z}}catch{}try{vh0(z)}catch{}}else if(H.isDirectory())$x1(z,{recursive:!0,force:!0}),G=!0;else vh0(z);let W=process.platform==="win32"?"junction":"dir";try{return Yx1(I,z,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:G?"replaced_real_dir":"linked",targetPath:z}}catch{try{return tk1(I,z,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:z}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:z,error:X?.message||String(X)}}}}function Qx1($,Y){let U=Y?.baseHomeDir??Sh0(),Q=HY(U,$.rootDirName),I=Y?.sourceSkillDir??HY(U,".agents","skills","seal-use"),J=gh0(I),K=HY(Q,"skills"),z=HY(K,"seal-use");if(!tz(Q))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(tz(K)&&tz(J))try{if(zY(K)===zY(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}let H;try{H=hh0(z)}catch{H=void 0}if(H){if(H.isSymbolicLink())try{if(zY(z)===zY(I))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:z}}catch{}else if(H.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:z}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:z}}function ro($){return yh0.map((Y)=>Ux1(Y,$))}function so($){return yh0.map((Y)=>Qx1(Y,$))}var yh0;var ao=o(()=>{yh0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var to=o(()=>{oo();ao();oo();ao()});var xh0='---\nname: seal-use\ndescription: "v0.10.40: Use for Seal Use enterprise onboarding, Hose/合思 or Seal-native authentication, approval operations, diagnosis, simulation, rules, users, configuration, and search."\nmetadata:\n version: 0.10.40\n short-description: Seal tenant and Hose approval automation (v0.10.40)\n---\n\n# Seal Use\n\nCLI 是主执行通道。机器通道 `stdout` 必须是纯 JSON;诊断日志、进度和下一步建议写入 `stderr`。MCP 默认关闭。\n\n## 时间与输出\n\n- 机器字段统一使用带 `+08:00` 北京时间偏移的 ISO 8601 秒级格式,不带毫秒,例如 `2026-09-28T11:51:09+08:00`。\n- 面向用户解释时间时,直接基于 `Asia/Shanghai`(北京时间)表述,无需再做 `+8` 小时换算。\n- 不向用户暴露 Bearer、`accessToken`、`closeToken`、`appSecurity`、原始 cURL 或未脱敏手机号。\n- 不向用户直接暴露底层 UUID、`tenantSlug`、`boundCorpRole` 等内部字段;优先使用企业名称、规则编号(例如 `0038`)和脱敏后的业务信息。\n\n## 企业接入:先识别材料,再选择入口\n\n最终企业来源只有两种:`source.type: "seal"` 和 `source.type: "hose"`。不要把材料格式、认证凭据和最终来源混为一谈。\n\n| 用户材料 | 标准入口 | 最终配置形态 |\n| --- | --- | --- |\n| Hose 开放平台 `appKey + appSecurity` | `corps add-hose-persistent` | Hose 持久化凭据 |\n| Seal URL + Bearer,或 Seal 页面 cURL | `corps add-seal-bearer` | Seal Bearer 会话 |\n| Seal 原生委托链接 | `corps add-link <url>` | Seal 委托会话 |\n| Hose 协助链接 | `corps add-link <url>` | Hose Web Session;加 `--elevate-hose` 才提取长期密钥 |\n| Hose 页面 cURL | 先提取密钥;失败时 `corps add-hose-web-session` | Hose 持久化或 Hose Web Session |\n| 已规范化的 Hose `corpId + accessToken + baseUrl` | `corps add-hose-web-session` | Hose Web Session |\n\n### 凭据边界\n\n- Seal Bearer 只能给 `add-seal-bearer`;Hose `accessToken/accesstoken/closeToken` 不能直接当作 Seal Bearer。\n- Hose Web Session 保存 `closeToken + staffId`,需要调用 Seal 时才通过 SSO 换取运行时 Sea
Line truncated
|
||||
display_name: "Seal Use"
|
||||
short_description: "Diagnose approval feedback and publish minimal rule fixes"
|
||||
default_prompt: "Use $seal-use to resolve a customer feedback package to the correct tenant, diagnose the approval run, propose a minimal rule diff, and publish only after explicit confirmation."
|
||||
`;var Dg0=()=>{};var Pg0=`# Approval Attachment Trace Investigation
|
||||
`;var fh0=()=>{};var ih0=`# Approval Attachment Trace Investigation
|
||||
|
||||
Use this workflow when a customer disputes an AI approval finding about an attachment, invoice, receipt, OCR result, or a UI-highlighted audit result.
|
||||
|
||||
@@ -1180,7 +1149,7 @@ Manual image check:
|
||||
- The customer's objection that they were receipts rather than invoices was reasonable.
|
||||
|
||||
However, the final rejection also had an independent rule-37 reason: payment screenshots totaled 699.48 while reimbursement was 700.00.
|
||||
`;var Bg0=()=>{};var Eg0=`# Approval Bad Case Catalog
|
||||
`;var bh0=()=>{};var nh0=`# Approval Bad Case Catalog
|
||||
|
||||
Use this file only as a comparison catalog after inspecting the current trace. Do not treat any case below as a default diagnosis.
|
||||
|
||||
@@ -1230,7 +1199,7 @@ Important nuance:
|
||||
|
||||
- This is a bad-case pattern, not a general rule that every amount-total dispute is caused by \`pre_analysis\`.
|
||||
- Use it when the current trace shows recognized amounts being excluded downstream or duplicate attachments producing inconsistent conclusions.
|
||||
`;var Tg0=()=>{};var Cg0="# Approval Run Lightweight Queries\n\nUse this reference when the user gives a 合思/易快报单号, source document SN, record ID, simulation batch ID, or asks for an approval decision without needing the full raw run payload.\n\n## Locate A Run By Document Number\n\nPrefer `pick` before broad search + bridge + get.\n\n```bash\nseal-use approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest\nseal-use approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --batch <batchId> --latest\nseal-use approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest --fields recordId,sourceDocumentSN,status,aiDecision,aiSummary\n```\n\nDefault output is intentionally small: `recordId`, `sourceDocumentSN`, `sourceDocumentId`, `simulationBatchId`, `status`, `taskMode`, `ruleSetVersionNumber`, `langfuseTraceId`, `manualResult`, `aiDecision`, and `aiSummary`.\n\nIf there are multiple candidates and `--latest` was not used, report the candidates and ask which one to inspect.\n\n## Read Compact Run Detail\n\nUse `--summary` for most diagnosis and support questions.\n\n```bash\nseal-use approval-runs get <recordId> --corp <corpId> --summary\n```\n\nUse `--fields` when the user needs a particular slice.\n\n```bash\nseal-use approval-runs get <recordId> --corp <corpId> --fields metadata\nseal-use approval-runs get <recordId> --corp <corpId> --fields document.fields,result.summary\nseal-use approval-runs get <recordId> --corp <corpId> --fields result.summary,result.decision,result.riskPoints\nseal-use approval-runs get <recordId> --corp <corpId> --fields document.keyFields,result,manualApprovalRecord,ruleSetVersionNumber\n```\n\nAvoid full `approval-runs get <recordId>` unless the user specifically needs raw document fields, pipeline logs, invoice rawData, or signed URLs. Prefer `--output-file` for full payloads.\n\n## Understand The Case First\n\nBefore pulling the full document, use:\n\n```bash\nseal-use approval-runs document-summary <recordId> --corp <corpId>\n```\n\nThis is for quick case reading: template/title, key fields, amount, expense type, cost company, payee, invoice summary, attachment names, AI result, and manual result.\n\n## Extract AI-Cited Rules\n\nUse this when the user asks \"AI 用了哪条规则\", \"为什么命中这条\", or needs the rule evidence for a specific run.\n\n```bash\nseal-use approval-runs cited-rules <recordId> --corp <corpId>\n```\n\nReturn and discuss `code`, `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule from that run's snapshot, use `seal-use rules get <code> --record-id <recordId> --corp <corpId>` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\n# 查看附件列表摘要(包含文件名、类型、大小及直链可用性)\nseal-use approval-runs attachments <recordId> --corp <corpId> --summary\n\n# 下载全部附件到本地目录(优先使用 ossSignedUrl 签名直链)\nseal-use approval-runs attachments download <recordId> --all --out-dir ./downloads --corp <corpId>\n\n# 按名称或 fileId 过滤下载单个附件\nseal-use approval-runs attachments download <recordId> --name 发票 --corp <corpId>\n```\n\nThis should be enough for file names, file IDs, mime types, positions, invoice/attachment grouping, and links when available. For customer disputes about OCR, receipt/invoice classification, or image content, switch to `approval-attachment-trace.md`.\n\n## Result Summary\n\nUse:\n\n```bash\nseal-use approval-runs result <recordId> --corp <corpId> --summary\n```\n\nThis is for decision, summary, risk point count, matched rule count, trace ID, and record ID.\n\n## Approval Run Web Links & Auto-Login Links\n\nUse this when the user asks for a link to an approval run or wants to open the run directly in their browser:\n\n```bash\n# 默认推荐:生成 Seal AI 审核详情直达链接(无凭证、无越权风险,用户在已有登录状态的浏览器中直接打开)\nseal-use approval-runs link <recordId> --corp <corpId>\nseal-use approval-runs link --sn <sourceDocumentSN> --corp <corpId>\n\n# 生成合思主系统原始单据页面链接\nseal-use approval-runs link <recordId> --type hose-document --corp <corpId>\n\n# 仅当用户明确要求免密/跨浏览器/无登录直达且确认知晓安全风险时:生成携带合思单次临时票据的免登直达链接\nseal-use approval-runs link <recordId> --auto-login [--expire 7200] --corp <corpId>\n```\n\n### 返回字段说明与语义规范\n- `sealResultUrl`: Seal AI 单据智能审核结果页\n- `hoseDocumentUrl`: 合思费控主系统原始报销/借款单详情页\n- `type`: 链接类型,默认为 `seal_result`,指定时可为 `hose_document`\n- `mode`: 鉴权模式,`direct`(原生直接打开)或 `auto_login`(免密换票)\n\n### 免登链接安全与声明规范\nLine truncated
|
||||
`;var ch0=()=>{};var dh0="# Approval Run Lightweight Queries\n\nUse this reference when the user gives a 合思/易快报单号, source document SN, record ID, simulation batch ID, or asks for an approval decision without needing the full raw run payload.\n\n## Locate A Run By Document Number\n\nPrefer `pick` before broad search + bridge + get.\n\n```bash\nseal-use approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest\nseal-use approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --batch <batchId> --latest\nseal-use approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest --fields recordId,sourceDocumentSN,status,aiDecision,aiSummary\n```\n\nDefault output is intentionally small: `recordId`, `sourceDocumentSN`, `sourceDocumentId`, `simulationBatchId`, `status`, `taskMode`, `ruleSetVersionNumber`, `langfuseTraceId`, `manualResult`, `aiDecision`, and `aiSummary`.\n\nIf there are multiple candidates and `--latest` was not used, report the candidates and ask which one to inspect.\n\n## Read Compact Run Detail\n\nUse `--summary` for most diagnosis and support questions.\n\n```bash\nseal-use approval-runs get <recordId> --corp <corpId> --summary\n```\n\nUse `--fields` when the user needs a particular slice.\n\n```bash\nseal-use approval-runs get <recordId> --corp <corpId> --fields metadata\nseal-use approval-runs get <recordId> --corp <corpId> --fields document.fields,result.summary\nseal-use approval-runs get <recordId> --corp <corpId> --fields result.summary,result.decision,result.riskPoints\nseal-use approval-runs get <recordId> --corp <corpId> --fields document.keyFields,result,manualApprovalRecord,ruleSetVersionNumber\n```\n\nAvoid full `approval-runs get <recordId>` unless the user specifically needs raw document fields, pipeline logs, invoice rawData, or signed URLs. Prefer `--output-file` for full payloads.\n\n## Understand The Case First\n\nBefore pulling the full document, use:\n\n```bash\nseal-use approval-runs document-summary <recordId> --corp <corpId>\n```\n\nThis is for quick case reading: template/title, key fields, amount, expense type, cost company, payee, invoice summary, attachment names, AI result, and manual result.\n\n## Extract AI-Cited Rules\n\nUse this when the user asks \"AI 用了哪条规则\", \"为什么命中这条\", or needs the rule evidence for a specific run.\n\n```bash\nseal-use approval-runs cited-rules <recordId> --corp <corpId>\n```\n\nReturn and discuss `code`, `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule from that run's snapshot, use `seal-use rules get <code> --record-id <recordId> --corp <corpId>` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\n# 查看附件列表摘要(包含文件名、类型、大小及直链可用性)\nseal-use approval-runs attachments <recordId> --corp <corpId> --summary\n\n# 下载全部附件到本地目录(优先使用 ossSignedUrl 签名直链)\nseal-use approval-runs attachments download <recordId> --all --out-dir ./downloads --corp <corpId>\n\n# 按名称或 fileId 过滤下载单个附件\nseal-use approval-runs attachments download <recordId> --name 发票 --corp <corpId>\n```\n\nThis should be enough for file names, file IDs, mime types, positions, invoice/attachment grouping, and links when available. For customer disputes about OCR, receipt/invoice classification, or image content, switch to `approval-attachment-trace.md`.\n\n## Result Summary\n\nUse:\n\n```bash\nseal-use approval-runs result <recordId> --corp <corpId> --summary\n```\n\nThis is for decision, summary, risk point count, matched rule count, trace ID, and record ID.\n\n## Approval Run Web Links & Auto-Login Links\n\nUse this when the user asks for a link to an approval run or wants to open the run directly in their browser:\n\n```bash\n# 默认推荐:生成 Seal AI 审核详情直达链接(无凭证、无越权风险,用户在已有登录状态的浏览器中直接打开)\nseal-use approval-runs link <recordId> --corp <corpId>\nseal-use approval-runs link --sn <sourceDocumentSN> --corp <corpId>\n\n# 生成合思主系统原始单据页面链接\nseal-use approval-runs link <recordId> --type hose-document --corp <corpId>\n\n# 仅当用户明确要求免密/跨浏览器/无登录直达且确认知晓安全风险时:生成携带合思单次临时票据的免登直达链接\nseal-use approval-runs link <recordId> --auto-login [--expire 7200] --corp <corpId>\n```\n\n### 返回字段说明与语义规范\n- `sealResultUrl`: Seal AI 单据智能审核结果页\n- `hoseDocumentUrl`: 合思费控主系统原始报销/借款单详情页\n- `type`: 链接类型,默认为 `seal_result`,指定时可为 `hose_document`\n- `mode`: 鉴权模式,`direct`(原生直接打开)或 `auto_login`(免密换票)\n\n### 免登链接安全与声明规范\nLine truncated
|
||||
|
||||
Use this low-freedom workflow when the user provides packaged customer feedback from WeChat, screenshots, rejection notifications, a document number, or expected business behavior and wants diagnosis or an approval-rule change.
|
||||
|
||||
@@ -1496,7 +1465,7 @@ Do not automatically rerun or resubmit the customer's production document. Run a
|
||||
- **系统调用凭证账号**:显式说明“周晚容(系统调用凭证账号,由智能助手代执行)”
|
||||
- **全量规则总数**:核对总数是否变化
|
||||
- **规则一致性校验**:确认目标规则文本与确认内容 100% 逐字吻合
|
||||
`;var vg0=()=>{};var gg0=`# Enterprise Onboarding
|
||||
`;var oh0=()=>{};var ah0=`# Enterprise Onboarding
|
||||
|
||||
本文是企业接入的唯一决策参考:先识别用户材料,再选择标准入口;不要把输入格式、凭据类型和最终来源混为一谈。
|
||||
|
||||
@@ -1655,7 +1624,7 @@ seal-use auth check --corp <discovered-id>
|
||||
\`\`\`
|
||||
|
||||
向用户报告:企业中文名、身份来源、凭据模式和验证是否成功;不要回显秘密或无必要的内部 ID。临时会话过期时说明需要重新获取材料;需要无人值守访问时推荐 Hose 开放平台凭据。
|
||||
`;var hg0=()=>{};var kg0=`# 第一次接入:看图找到材料
|
||||
`;var sh0=()=>{};var eh0=`# 第一次接入:看图找到材料
|
||||
|
||||
> **【Agent 呈现铁律(Mandatory Image Rule)】**:
|
||||
> 当向用户提供接入指引或引导用户获取材料时,**Agent 必须将本文档中对应的截图主动按顺序渲染到 Markdown 对话中**(使用图片语法 \`\`),**绝不允许只讲纯文字步骤!** 真实业务用户必须对照图片界面才能准确找到按钮。
|
||||
@@ -1742,7 +1711,7 @@ macOS 也可以使用 \`Option + Command + I\`;Windows 常见快捷键是 \`F1
|
||||
## 安全提醒
|
||||
|
||||
协助平台、网页登录、SSO 和浏览器 cURL 都可能携带当前用户的访问权限。只把材料交给正在处理本机接入的可信助手,并在接入完成后关闭或刷新该网页会话。不要把原始 cURL、接入密码或完整截图发送到外部渠道。
|
||||
`;var yg0=()=>{};var fg0=`# Hose Enterprise Auth
|
||||
`;var th0=()=>{};var YS0=`# Hose Enterprise Auth
|
||||
|
||||
Use this reference for Hose/合思 enterprise configuration and user-facing Hose authorization links.
|
||||
|
||||
@@ -1811,7 +1780,7 @@ Important:
|
||||
3. BOTH a code block (\` \`\`\`text ... \`\`\` \`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
|
||||
- **Dedicated CLI Command**: Use \`seal-use auth hose-link --corp <corpId> [--expire <seconds>] [--force]\`. This command directly generates an independent provisional auth link without reading or mutating internal CLI session cache. It supports \`--expire\` (default 7200, e.g. 86400 for 1 day).
|
||||
- **Seal AI Platform Direct Link**: Use \`seal-use auth link --corp <corpId> [--note <note>]\`. This generates a 24-hour provisional delegation link for the Seal AI audit platform (\`https://*.sealai.cc\`).
|
||||
`;var xg0=()=>{};var bg0=`# Seal AI 智能审核发布到合思费控 (HoseCloud Deployment)
|
||||
`;var $S0=()=>{};var QS0=`# Seal AI 智能审核发布到合思费控 (HoseCloud Deployment)
|
||||
|
||||
Use this reference when configuring, deploying, or troubleshooting Seal AI smart approval integrations with Hose/合思费控 (界面路径:【智能审核】 $\\to$ 【发布】 $\\to$ 【合思费控】).
|
||||
|
||||
@@ -1909,7 +1878,7 @@ seal-use deploy hosecloud status --corp <corpId>
|
||||
| \`signKey\` | string | 否 | 随机生成 | 集成配置卡片唯一标识,编辑时传入以更新对应配置 |
|
||||
| \`apiOrigin\` | string | 否 | 自动探测 | \`production\` / \`custom\` |
|
||||
| \`customApiUrl\` | string | 否 | - | 专属私有云 API 地址(当 \`apiOrigin=custom\` 时必填) |
|
||||
`;var ug0=()=>{};var cg0=`# Hose Enterprise Initialization & Automated Discovery
|
||||
`;var US0=()=>{};var JS0=`# Hose Enterprise Initialization & Automated Discovery
|
||||
|
||||
Use this reference for automated Hose/合思 enterprise onboarding, multi-domain probing (including dedicated private cloud domains like 美年大健康), OpenAPI role and staff discovery, and non-TUI safe administrator selection.
|
||||
|
||||
@@ -2015,7 +1984,7 @@ seal-use corps hose-staffs --json '{
|
||||
}'
|
||||
\`\`\`
|
||||
* 直接使用指定 ID 完成接入并进行连通性验证。
|
||||
`;var ig0=()=>{};var dg0="# Rule Lightweight Queries\n\nUse this reference when the user wants rule counts, compact rule lists, one rule from draft or a historical version, or approval rule search without dumping hundreds of rule descriptions.\n\n## Draft Default vs. Published Version (`--version latest`)\n\nEvery rule has a 4-digit zero-padded `code` (`0000, 0001, 0025, 0038, ...`).\n\n- **Default = Current Draft (`草稿`)**: When `--version` is omitted, `rules count`, `rules list`, `rules get <code>`, `rules search`, `rules lint`, and `rules pull` **all read the current draft**.\n- **Latest Published Version = `--version latest` (`最新发布`)**: To inspect the latest published version, **always pass `--version latest`** (or `--version <number>` for a specific historical version).\n- Publishing or deleting rules can shift `code` numbers across versions, so a `code` in a historical run must be resolved together with `--version <number>` or `--record-id <recordId>`.\n\n## Count Rules\n\nUse count when only scale or existence matters.\n\n```bash\n# Count current draft rules (default)\nseal-use rules count --corp <corpId>\n\n# Count rules in latest published version\nseal-use rules count --version latest --corp <corpId>\n```\n\nExpected shape:\n\n```json\n{ \"count\": 191 }\n```\n\n## List Rule Summaries\n\nUse summaries for navigation and selection.\n\n```bash\n# List current draft rule summaries (default)\nseal-use rules list --summary --corp <corpId>\n\n# List latest published version rule summaries\nseal-use rules list --version latest --summary --corp <corpId>\n```\n\nDefault summary includes `code`, `status`, `strictness`, `scope`, and `updatedAt`. Do not pull full `description` fields across all rules unless the user needs rule text.\n\n## Get One Rule (Draft or Published Version)\n\nRead a single rule from the current draft (default):\n\n```bash\nseal-use rules get 0038 --corp <corpId>\n```\n\nRead a single rule from the latest published version, a specific published version, or the version used by an approval run:\n\n```bash\nseal-use rules get 0038 --version latest --corp <corpId>\nseal-use rules get 0038 --version 16 --corp <corpId>\nseal-use rules get 0205 --record-id <recordId> --corp <corpId>\n```\n\nReturns `id`, `code`, `ruleCode`, `runtimeRuleId`, `description`, `scope`, `strictness`, `status`, and version metadata when reading from a published version.\n\n## Search Rules Compactly\n\n```bash\n# Search current draft rules (default)\nseal-use rules search <keyword> --maxResults 20 --corp <corpId>\n\n# Search latest published version or a specific historical version\nseal-use rules search <keyword> --version latest --maxResults 20 --corp <corpId>\nseal-use rules search <keyword> --version 16 --maxResults 20 --corp <corpId>\n```\n\n## Clear Draft Rules Before Import\n\nUse this for test tenants when the next step is importing another tenant's rule set. Always preview first unless the user has already confirmed the exact tenant.\n\n```bash\nseal-use rules clear --dry-run --corp <corpId>\nseal-use rules clear --yes --corp <corpId>\n```\n\nExpected shape:\n\n```json\n{\n \"corpId\": \"xiezihao\",\n \"dryRun\": false,\n \"beforeCount\": 49,\n \"deleted\": 49,\n \"afterCount\": 0\n}\n```\n\n## Output Discipline\n\nIf a rule command would return many descriptions or more than about 20 rules, use `rules count`, `rules list --summary`, `rules search`, or `--output-file`. Use `--full` only for deliberate exports.\n";var ng0=()=>{};var mg0="# Seal Approval Rule Linter & Quality Validation\n\nUse this reference when analyzing, validating, or linting Seal AI approval rules to detect vague phrasing, missing exception evidence, or formatting defects before publishing.\n\n## Key Principles\n\n- **Default State**: Linter is **disabled by default** in global configuration (`lint.enabled: false`) to avoid unsolicited noise during standard operations.\n- **Doctor Visibility**: `seal-use doctor` audits the rule linter configuration state and active linter name in its health checks, and surfaces a one-click hint (`seal-use config lint enable`) when disabled.\n- **Explicit Triggering**: `seal-use rules lint` always runs regardless of global configuration.\n- **Draft Hook**: When `seal-use config lint enable` is set, `seal-use rules update` outputs real-time diagnostic warnings to `stderr` without mutating `stdout` payloads.\n- **Fault-Tolerant Fallback**: If a custom `.ts` linter file has syntax errors, runtime exceptions, or is missing, the engine logs a warning to `stderr` and **silently falls back to the built-in heuristic linter without failing**.\n\n## CLI Commands\n\n### 1. Lint Current Draft Rules (Whole-RuleSet Scan)\n\n```bash\nseal-use rules lint --corp <corpId>\n```\n\n### 2. Lint Specific Historical Version or Single Rule\n\n```bash\n# Lint rules in published version 16\nseal-use rules lint --version 16 --corp <corpId>\n\n# Lint a specific rule by code\nseal-use rules lint --code 0038 --corp <cor
Line truncated
|
||||
`;var IS0=()=>{};var zS0="# Rule Lightweight Queries\n\nUse this reference when the user wants rule counts, compact rule lists, one rule from draft or a historical version, or approval rule search without dumping hundreds of rule descriptions.\n\n## Draft Default vs. Published Version (`--version latest`)\n\nEvery rule has a 4-digit zero-padded `code` (`0000, 0001, 0025, 0038, ...`).\n\n- **Default = Current Draft (`草稿`)**: When `--version` is omitted, `rules count`, `rules list`, `rules get <code>`, `rules search`, `rules lint`, and `rules pull` **all read the current draft**.\n- **Latest Published Version = `--version latest` (`最新发布`)**: To inspect the latest published version, **always pass `--version latest`** (or `--version <number>` for a specific historical version).\n- Publishing or deleting rules can shift `code` numbers across versions, so a `code` in a historical run must be resolved together with `--version <number>` or `--record-id <recordId>`.\n\n## Count Rules\n\nUse count when only scale or existence matters.\n\n```bash\n# Count current draft rules (default)\nseal-use rules count --corp <corpId>\n\n# Count rules in latest published version\nseal-use rules count --version latest --corp <corpId>\n```\n\nExpected shape:\n\n```json\n{ \"count\": 191 }\n```\n\n## List Rule Summaries\n\nUse summaries for navigation and selection.\n\n```bash\n# List current draft rule summaries (default)\nseal-use rules list --summary --corp <corpId>\n\n# List latest published version rule summaries\nseal-use rules list --version latest --summary --corp <corpId>\n```\n\nDefault summary includes `code`, `status`, `strictness`, `scope`, and `updatedAt`. Do not pull full `description` fields across all rules unless the user needs rule text.\n\n## Get One Rule (Draft or Published Version)\n\nRead a single rule from the current draft (default):\n\n```bash\nseal-use rules get 0038 --corp <corpId>\n```\n\nRead a single rule from the latest published version, a specific published version, or the version used by an approval run:\n\n```bash\nseal-use rules get 0038 --version latest --corp <corpId>\nseal-use rules get 0038 --version 16 --corp <corpId>\nseal-use rules get 0205 --record-id <recordId> --corp <corpId>\n```\n\nReturns `id`, `code`, `ruleCode`, `runtimeRuleId`, `description`, `scope`, `strictness`, `status`, and version metadata when reading from a published version.\n\n## Search Rules Compactly\n\n```bash\n# Search current draft rules (default)\nseal-use rules search <keyword> --maxResults 20 --corp <corpId>\n\n# Search latest published version or a specific historical version\nseal-use rules search <keyword> --version latest --maxResults 20 --corp <corpId>\nseal-use rules search <keyword> --version 16 --maxResults 20 --corp <corpId>\n```\n\n## Clear Draft Rules Before Import\n\nUse this for test tenants when the next step is importing another tenant's rule set. Always preview first unless the user has already confirmed the exact tenant.\n\n```bash\nseal-use rules clear --dry-run --corp <corpId>\nseal-use rules clear --yes --corp <corpId>\n```\n\nExpected shape:\n\n```json\n{\n \"corpId\": \"xiezihao\",\n \"dryRun\": false,\n \"beforeCount\": 49,\n \"deleted\": 49,\n \"afterCount\": 0\n}\n```\n\n## Output Discipline\n\nIf a rule command would return many descriptions or more than about 20 rules, use `rules count`, `rules list --summary`, `rules search`, or `--output-file`. Use `--full` only for deliberate exports.\n";var KS0=()=>{};var GS0="# Seal Approval Rule Linter & Quality Validation\n\nUse this reference when analyzing, validating, or linting Seal AI approval rules to detect vague phrasing, missing exception evidence, or formatting defects before publishing.\n\n## Key Principles\n\n- **Default State**: Linter is **disabled by default** in global configuration (`lint.enabled: false`) to avoid unsolicited noise during standard operations.\n- **Doctor Visibility**: `seal-use doctor` audits the rule linter configuration state and active linter name in its health checks, and surfaces a one-click hint (`seal-use config lint enable`) when disabled.\n- **Explicit Triggering**: `seal-use rules lint` always runs regardless of global configuration.\n- **Draft Hook**: When `seal-use config lint enable` is set, `seal-use rules update` outputs real-time diagnostic warnings to `stderr` without mutating `stdout` payloads.\n- **Fault-Tolerant Fallback**: If a custom `.ts` linter file has syntax errors, runtime exceptions, or is missing, the engine logs a warning to `stderr` and **silently falls back to the built-in heuristic linter without failing**.\n\n## CLI Commands\n\n### 1. Lint Current Draft Rules (Whole-RuleSet Scan)\n\n```bash\nseal-use rules lint --corp <corpId>\n```\n\n### 2. Lint Specific Historical Version or Single Rule\n\n```bash\n# Lint rules in published version 16\nseal-use rules lint --version 16 --corp <corpId>\n\n# Lint a specific rule by code\nseal-use rules lint --code 0038 --corp <cor
Line truncated
|
||||
|
||||
本文档面向 AI Agent 与运维人员,规范从**生产/测试环境搭配接入**、**配置与合思集成自动同步**、**测试环境单据模拟验证**,到**生产规则安全投产**的端到端标准工作流。
|
||||
|
||||
@@ -2231,7 +2200,7 @@ flowchart TD
|
||||
seal-use rules publish "审核规则 版本N" --corp <prodCorpId>
|
||||
\`\`\`
|
||||
发布后核实版本状态,完成业务安全闭环。
|
||||
`;var lg0=()=>{};var sg0=`# Webhook Resource Pack Workflow (Webhook 资源包)
|
||||
`;var WS0=()=>{};var qS0=`# Webhook Resource Pack Workflow (Webhook 资源包)
|
||||
|
||||
A **Webhook resource pack** (webhook 资源包 / 资源包, CLI: \`resource-pack\`, alias: \`pack\`, legacy alias: \`material-pack\`) is a ZIP file that bundles an Excel information sheet (\`信息表.xlsx\`) with attachments organised by document ID. It is designed for exporting online approval runs and transferring them offline across environments or teams to be replayed via inbound Webhooks.
|
||||
|
||||
@@ -2382,10 +2351,8 @@ The direct local \`resource-pack preview\` command uses the default or temporary
|
||||
| \`附件后缀不在白名单中\` | Attachment extension is not allowed by the Webhook policy | Add the extension with \`--allowed-extensions\` or convert the file |
|
||||
| \`附件上传失败 <status>\` | Network/server error during file upload | Check webhook URL, secret, and server availability |
|
||||
|
||||
`;var rg0=()=>{};var Dx1="iVBORw0KGgoAAAANSUhEUgAADVgAAAdwCAYAAACUWcTmAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAANWKADAAQAAAABAAAHcAAAAAD4n9OGAABAAElEQVR4AeydB4AdVfX/z246pNAD0hK6dOki0rsU+dMJJVIFRYoUFUFAQUCqgHSkxx8gTRCpFkB6CU06SQi9BEhC+u7/fu7b83J3dt7bt33f5nuStzNz5947M583c+fOvPO9p6Y+mMlEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4kUDsHHrMOWQREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAQigd7jxo8TChEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYIwkogtUc+bXroEVABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABCBQUx9MKERABERABERABERABERABERABERABERABERABERABERABERABESgqwiMHz/eBgwY0FWb13ZFQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQATmcAKKYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwn0npMPXscuAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAj2RwP8+n26vfjbd3vpyho2fPN0+mjLTJs+qs/qaOhvYp8YWGtDLFh/U25YZ3NdWnr+/rTDvgJ6IQcckAhURqKkPVlFOZRIBERABERABERABERABERABERABERABERABERABERABERABERCBDiAwfvx4GzBAP9p2AFpVKQIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiMIcR+GhSnT347lT713tT7eOpM4OYqj5+LEzNEFdZ+MyKU5Zr4jLp9fat/r1ss28NtM0WG2KLzN1nDiOnw53TCUhgNaefATp+ERABERABERABERABERABERABERABERABERABERABERABEehiAhJYdfEXoM2LgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAhUPYFJ08z+7+Updsc7U8OxFARURKqyIKAqCKnqbVYQUdU2CK7iOiuIr4oirLBcgxArfHZZcrDttcwCNnefXlXPRgcgApUQkMCqEkrKIwIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0GEEJLDqMLSqWAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4g8MR7M+2Cp6fY5JmFSFQhRlUQStUVBVUsF0VUCKiSSFZEsKqLkawa5yH/oN5mP195qK0/dPAcQFGHOKcTkMBqTj8DdPwiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0MUEJLDq4i+gCzY/ZcqUuNUBAwZ0wda1SREQAREQAREQAREQAREQAREQAREQAREQAREQARHoHAKd8S501AszbNT/psXIUwWhVDi2IK6qj5GriGRVEE4RlSoVWlUayYry+w2fx0Yst1DnQNNWRKCLCAQ9oUwEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKCaCFz035n20JgZ1stqQowqs9qaWmJVBR1VbRBZkdLLakN0qiCzCtMGgVXMURfW1YQsTHsFEdasMC0UCSWjOIvcbte++6V9MX2mHb7ytzypS6e/+93v7H//+1/uPuy888727W9/O35yMyhRBEoQ4NyXiYAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiECPIXDbbbfZiBEjGh0PP7aSxif90dXzks68G3k8P2VTYznNm67TvAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BoGLHp1lD74zM6qh6kK4qprwqW+YMl9TR1pYHcRWtUFHhZaqLi6TFsJbhflCOYRVtbG818H6+KGOhnr+9v4ku/DlDzrj0Mpug/fz6Xv+bOa//vWvxkcmAi0loAhWLSWm/CIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAt2WAD+sdvQPp/xwy0cjYHbb00A7JgIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAI9msCo5+rt4XdDVKoaIlfVxChVHHCMPtXoyIO4KuSoy0ayqifOFeWJUxVqSCJZfW/hwfbox1/FuqiKHF4zIqt5+39qey+zYEztij/pbwC8p0/NhVc+TddpXgSaIyCBVXOEtF4EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKBqCLz66qudtq/8iPvrX/+607aX3VBniMluvPHG7Ga1LAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiUIJAzT+vi2vqN9m3RA4li0DbCTw5xuyWl+qMIFQWIk8Rpqo+Cq1YDlKokL7m4v2D7IrFOgurwvqwoiaEsIpyKebNHv9wki+FdERaSKlq7fytlrEj73vLHvvoq7gNUkM4q1BPKBTque7tCbbUoH62/tDBrOkyQ1yVfUf/u9/9rmx0qy7b2VZu2H8H4FhXXHFF+3//7/+1siYVq4RATX2wSjIqjwiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BIHx48fbgAEDOqLqHlun/6ja0QfYUQKrKVOmxF3X997R36DqFwEREAEREAEREAEREAEREAEREAEREAER6EwCs074btxcr9Me78zNalvdmEB7vwudNM3ssFvNJs2oi0KqWUE0FQVUUUiF6KreLtx5QVtt0X5lqYz+cIodevfYkKcg1KpHfBXKHvadobbvdxay0R9NsgPveyOsD3KTWiQniLjCNHyYDgqhfq7bcCmbu0+vsttpy0rEUlgqLErfje+8885NBEepwMrXE83Ko16ldbVl3zqjbHqsvj0EZdmoXb5O07YTUASrtjNUDSIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiLQqQQ6M1JXpx5YD96Yj3sZR3ntwcdZyaHNmDHDPv74Y1t00UULo95WUqiL8syaNct69eo4J5EuOqwu3Szff58+fZrsg66RJkiU0MkEGJ4YhzSZCHQmAdpEjHtNbW0Ydb4djHvX9OnTNYBBA0ucWfv169dufNvhK+oxVUydOtXq6upsrrnm6jHHpAMRAREQAREQgbYS8OhV1FN/1VFWc8B5ba2yWJ6+45gxY+ytt96y/v3729JLL22LLbZYbj+H9y4u6ilWUGJm7rnntgUXXDCu/frrr+2LL74okbNxMv3XJZZYonFia5fGjLaad0e3tnSx3JwSNezmZ2ts8vQQTSr8C9KoOA2Sp8ChJvyttQPXG9SsuMqh1VEslIviqTBdf5G5o7iK1NUWHmg/XW1Ru/iF960+aK8QVbE1j2SFwOumtz6zg749lOztbqlQygVSCIuYL2cIqDwPoirepfsy5ZgnLRv5qlydXbUu73cAjqka9h1mCMSw1kbdamv5uPEW/pHAqoXAlF0EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEuppA+oNwR0WZ6upj7Enbf+ONN+yUU06Jh3Tsscfa6quv3pMOLx7Lhx9+aMcff3yc33vvvW3LLbfMPcZbbrnF7rjjjrjuF7/4ha2yyiq5+dLEyZMn24QJE2zhhRe23r1720svvWTnn39+zPLLX/7SlllmmTR77jyORb/61a/iuv3339++973v5eZLE99++2076aSTbNlll7UtttiiojJp+WqZHz16dBQ84XziNnPmTPv00099sUVTHLMGDx6cW2bcuHHRAWSzzTazHXfc0eaZZ56Y7/HHH7eLLroozh933HG21FJL2Zlnnmm77LJLm6+Xb775xr766qvc/ckmzjvvvNFJLZveluWzzz7b3nrzTVty2DDjfG2JTZs2ze677z7bZpttGonSvvzyy4od5bLb4zqqJqHnxxNmWcHZK3skLV/u16fG5huUL2B5cPRUO
Line truncated
|
||||
`,"utf8"),{detected:Q,configured:!0,configPath:U,targetDir:Y,action:"created"};let I={};try{I=JSON.parse(eg0(U,"utf8"))}catch{I={entries:[]}}if(!Array.isArray(I.entries))I.entries=[];if(I.entries.findIndex((z)=>z&&typeof z.path==="string"&&z.path===Y)!==-1)return{detected:Q,configured:!0,configPath:U,targetDir:Y,action:"already_present"};let K=I.entries.findIndex((z)=>z&&typeof z.path==="string"&&(z.path==="~/.agents/skills"||z.path==="~/.agents/skills/"));if(K!==-1)return I.entries[K]={...I.entries[K],path:Y},ao(U,JSON.stringify(I,null,2)+`
|
||||
`,"utf8"),{detected:Q,configured:!0,configPath:U,targetDir:Y,action:"updated_tilde"};return I.entries.unshift({path:Y}),ao(U,JSON.stringify(I,null,2)+`
|
||||
`,"utf8"),{detected:Q,configured:!0,configPath:U,targetDir:Y,action:"prepended"}}function Yr($){let Y=$?.targetSkillsDir??$y0(),U=$?.configFile??Yy0(),Q=Uy0(),I=!1;if(sq(U))try{let J=JSON.parse(eg0(U,"utf8"));if(Array.isArray(J?.entries))I=J.entries.some((K)=>K?.path===Y)}catch{}return{detected:Q,configured:I,configPath:U,targetDir:Y}}var Ur=()=>{};import{cpSync as Rx1,existsSync as $G,lstatSync as Iy0,mkdirSync as _x1,realpathSync as GY,rmSync as vx1,symlinkSync as Sx1,unlinkSync as Qy0}from"node:fs";import{homedir as Jy0}from"node:os";import{dirname as Ky0,join as HY}from"node:path";function hx1($,Y){let U=Y?.baseHomeDir??Jy0(),Q=HY(U,$.rootDirName),I=Y?.sourceSkillDir??HY(U,".agents","skills","seal-use"),J=Ky0(I),K=HY(Q,"skills"),z=HY(K,"seal-use");if(!$G(Q))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if($G(K)&&$G(J))try{if(GY(K)===GY(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}_x1(K,{recursive:!0});let G;try{G=Iy0(z)}catch{G=void 0}let H=!1;if(G)if(G.isSymbolicLink()){try{if(GY(z)===GY(I))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:z}}catch{}try{Qy0(z)}catch{}}else if(G.isDirectory())vx1(z,{recursive:!0,force:!0}),H=!0;else Qy0(z);let W=process.platform==="win32"?"junction":"dir";try{return Sx1(I,z,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:H?"replaced_real_dir":"linked",targetPath:z}}catch{try{return Rx1(I,z,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:z}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:z,error:X?.message||String(X)}}}}function gx1($,Y){let U=Y?.baseHomeDir??Jy0(),Q=HY(U,$.rootDirName),I=Y?.sourceSkillDir??HY(U,".agents","skills","seal-use"),J=Ky0(I),K=HY(Q,"skills"),z=HY(K,"seal-use");if(!$G(Q))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if($G(K)&&$G(J))try{if(GY(K)===GY(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}let G;try{G=Iy0(z)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if(GY(z)===GY(I))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:z}}catch{}else if(G.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:z}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:z}}function Qr($){return zy0.map((Y)=>hx1(Y,$))}function Ir($){return zy0.map((Y)=>gx1(Y,$))}var zy0;var Jr=o(()=>{zy0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var Kr=o(()=>{Ur();Jr();Ur();Jr()});import{existsSync as yx1,mkdirSync as zr,readFileSync as kx1,rmSync as xx1,writeFileSync as Gy0}from"node:fs";import{homedir as Wy0}from"node:os";import{dirname as Hy0,join as aq}from"node:path";function Gr(){return Xy0["SKILL.md"]||""}function Zy0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function qy0($=aq(rQ(),"SKILL.md")){try{return Zy0(kx1($,"utf8"))}catch{return}}function rQ(){return aq(Wy0(),".agents","skills","seal-use")}function ux1(){return aq(Wy0(),".agents","skills","seal-home")}function bx1(){let $=ux1();if(yx1($))try{return xx1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function Vy0($=rQ()){bx1(),zr($,{recursive:!0});let Y=[];for(let[U,Q]of Object.entries(Xy0)){let I=aq($,U);zr(Hy0(I),{recursive:!0}),Gy0(I,Q,"utf8"),Y.push(U)}for(let[U,Q]of Object.entries(fx1)){let I=aq($,U);zr(Hy0(I),{recursive:!0}),Gy0(I,Q),Y.push(U)}return{targetDir:$,files:Y}}var Xy0,fx1,Mq4;var eq=o(()=>{to();to();Kr();Xy0=tg0,fx1=Object.fromEntries(Object.entries(ag0).map(([$,Y])=>[$,Buffer.from(Y,"base64")]));Mq4=Zy0(Gr())});function Ly0(){return`# Seal Use 系统架构与运行规范白皮书
|
||||
`;var ZS0=()=>{};var Dx1="iVBORw0KGgoAAAANSUhEUgAADVgAAAdwCAYAAACUWcTmAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAANWKADAAQAAAABAAAHcAAAAAD4n9OGAABAAElEQVR4AeydB4AdVfX/z246pNAD0hK6dOki0rsU+dMJJVIFRYoUFUFAQUCqgHSkxx8gTRCpFkB6CU06SQi9BEhC+u7/fu7b83J3dt7bt33f5nuStzNz5947M583c+fOvPO9p6Y+mMlEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4kUDsHHrMOWQREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAQigd7jxo8TChEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYIwkogtUc+bXroEVABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABCBQUx9MKERABERABERABERABERABERABERABERABERABERABERABERABESgqwiMHz/eBgwY0FWb13ZFQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQATmcAKKYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwn0npMPXscuAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAj2RwP8+n26vfjbd3vpyho2fPN0+mjLTJs+qs/qaOhvYp8YWGtDLFh/U25YZ3NdWnr+/rTDvgJ6IQcckAhURqKkPVlFOZRIBERABERABERABERABERABERABERABERABERABERABERABERCBDiAwfvx4GzBAP9p2AFpVKQIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiMIcR+GhSnT347lT713tT7eOpM4OYqj5+LEzNEFdZ+MyKU5Zr4jLp9fat/r1ss28NtM0WG2KLzN1nDiOnw53TCUhgNaefATp+ERABERABERABERABERABERABERABERABERABERABERABEehiAhJYdfEXoM2LgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAhUPYFJ08z+7+Updsc7U8OxFARURKqyIKAqCKnqbVYQUdU2CK7iOiuIr4oirLBcgxArfHZZcrDttcwCNnefXlXPRgcgApUQkMCqEkrKIwIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0GEEJLDqMLSqWAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4g8MR7M+2Cp6fY5JmFSFQhRlUQStUVBVUsF0VUCKiSSFZEsKqLkawa5yH/oN5mP195qK0/dPAcQFGHOKcTkMBqTj8DdPwiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0MUEJLDq4i+gCzY/ZcqUuNUBAwZ0wda1SREQAREQAREQAREQAREQAREQAREQAREQAREQARHoHAKd8S501AszbNT/psXIUwWhVDi2IK6qj5GriGRVEE4RlSoVWlUayYry+w2fx0Yst1DnQNNWRKCLCAQ9oUwEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKCaCFz035n20JgZ1stqQowqs9qaWmJVBR1VbRBZkdLLakN0qiCzCtMGgVXMURfW1YQsTHsFEdasMC0UCSWjOIvcbte++6V9MX2mHb7ytzypS6e/+93v7H//+1/uPuy888727W9/O35yMyhRBEoQ4NyXiYAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiECPIXDbbbfZiBEjGh0PP7aSxif90dXzks68G3k8P2VTYznNm67TvAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BoGLHp1lD74zM6qh6kK4qprwqW+YMl9TR1pYHcRWtUFHhZaqLi6TFsJbhflCOYRVtbG818H6+KGOhnr+9v4ku/DlDzrj0Mpug/fz6Xv+bOa//vWvxkcmAi0loAhWLSWm/CIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAt2WAD+sdvQPp/xwy0cjYHbb00A7JgIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAI9msCo5+rt4XdDVKoaIlfVxChVHHCMPtXoyIO4KuSoy0ayqifOFeWJUxVqSCJZfW/hwfbox1/FuqiKHF4zIqt5+39qey+zYEztij/pbwC8p0/NhVc+TddpXgSaIyCBVXOEtF4EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKBqCLz66qudtq/8iPvrX/+607aX3VBniMluvPHG7Ga1LAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiUIJAzT+vi2vqN9m3RA4li0DbCTw5xuyWl+qMIFQWIk8Rpqo+Cq1YDlKokL7m4v2D7IrFOgurwvqwoiaEsIpyKebNHv9wki+FdERaSKlq7fytlrEj73vLHvvoq7gNUkM4q1BPKBTque7tCbbUoH62/tDBrOkyQ1yVfUf/u9/9rmx0qy7b2VZu2H8H4FhXXHFF+3//7/+1siYVq4RATX2wSjIqjwiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BIHx48fbgAEDOqLqHlun/6ja0QfYUQKrKVOmxF3X997R36DqFwEREAEREAEREAEREAEREAEREAEREAER6EwCs074btxcr9Me78zNalvdmEB7vwudNM3ssFvNJs2oi0KqWUE0FQVUUUiF6KreLtx5QVtt0X5lqYz+cIodevfYkKcg1KpHfBXKHvadobbvdxay0R9NsgPveyOsD3KTWiQniLjCNHyYDgqhfq7bcCmbu0+vsttpy0rEUlgqLErfje+8885NBEepwMrXE83Ko16ldbVl3zqjbHqsvj0EZdmoXb5O07YTUASrtjNUDSIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiLQqQQ6M1JXpx5YD96Yj3sZR3ntwcdZyaHNmDHDPv74Y1t00UULo95WUqiL8syaNct69eo4J5EuOqwu3Szff58+fZrsg66RJkiU0MkEGJ4YhzSZCHQmAdpEjHtNbW0Ydb4djHvX9OnTNYBBA0ucWfv169dufNvhK+oxVUydOtXq6upsrrnm6jHHpAMRAREQAREQgbYS8OhV1FN/1VFWc8B5ba2yWJ6+45gxY+ytt96y/v3729JLL22LLbZYbj+H9y4u6ilWUGJm7rnntgUXXDCu/frrr+2LL74okbNxMv3XJZZYonFia5fGjLaad0e3tnSx3JwSNezmZ2ts8vQQTSr8C9KoOA2Sp8ChJvyttQPXG9SsuMqh1VEslIviqTBdf5G5o7iK1NUWHmg/XW1Ru/iF960+aK8QVbE1j2SFwOumtz6zg749lOztbqlQygVSCIuYL2cIqDwPoirepfsy5ZgnLRv5qlydXbUu73cAjqka9h1mCMSw1kbdamv5uPEW/pHAqoXAlF0EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEuppA+oNwR0WZ6upj7Enbf+ONN+yUU06Jh3Tsscfa6quv3pMOLx7Lhx9+aMcff3yc33vvvW3LLbfMPcZbbrnF7rjjjrjuF7/4ha2yyiq5+dLEyZMn24QJE2zhhRe23r1720svvWTnn39+zPLLX/7SlllmmTR77jyORb/61a/iuv3339++973v5eZLE99++2076aSTbNlll7UtttiiojJp+WqZHz16dBQ84XziNnPmTPv00099sUVTHLMGDx6cW2bcuHHRAWSzzTazHXfc0eaZZ56Y7/HHH7eLLroozh933HG21FJL2Zlnnmm77LJLm6+Xb775xr766qvc/ckmzjvvvNFJLZveluWzzz7b3nrzTVty2DDjfG2JTZs2ze677z7bZpttGonSvvzyy4od5bLb4zqqJqHnxxNmWcHZK3skLV/u16fG5huUL2B5cPRUO
Line truncated
|
||||
`);return}if($==="install"||$==="init"||$==="sync"){let Q=J0(U.options.local)||J0(U.options.workspace),I=R(U.options.dir)??R(U.options.target)??Y,J=I?I:Q?Jj(process.cwd(),".agents","skills","seal-use"):rQ(),K=PS0(J),z=!Q&&!I,H=z?mo():void 0,G=z?ro():void 0;C0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files,...H?{antigravity:H}:{},...G?{hosts:G}:{}});return}if($==="status"||$==="get"||!$){let Q=rQ(),I=Jj(process.cwd(),".agents","skills","seal-use"),J=lo(),K=so();C0({global:{dir:Q,installed:BS0(Jj(Q,"SKILL.md"))},local:{dir:I,installed:BS0(Jj(I,"SKILL.md"))},antigravity:J,hosts:K});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}var TS0=o(()=>{to();tq();L4();t1()});async function ez($){let[Y,U]=await Promise.all([e10($),_1($)]),Q=await e6(U);return{...Y,tenantId:Q.tenant.id,tenantSlug:Q.tenant.tenantSlug??Y.tenantSlug,tenantName:Q.tenant.name,raw:{...typeof Y.raw==="object"&&Y.raw!==null?Y.raw:{},user:{id:Q.user.id,name:Q.user.name,isAdmin:Q.user.isAdmin,providerUserId:Q.user.providerUserId,hosecloudStaff:Q.user.hosecloudStaff},tenant:Q.tenant}}}var Kj=o(()=>{n6();cg();Z4()});async function jS0($={}){let Y=a8(),U=A4(),Q=p7(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},X3());console.log(`[probe] corp=${Q.id} source=${Q.source.type}`);let I=await ez(Q);console.log("[probe] seal enterprise"),console.log(JSON.stringify(I,null,2));let J=await _1(Q),K=await XO(J,{documentLimit:20,stylePreferencesEndpoint:Q.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:K.rules.rules.length,hasPendingRuleDeletes:K.rules.hasPendingDeletes,documents:K.documents.articles.length,documentsTotal:K.documents.total,stylePreferences:K.stylePreferences.ok?"ok":`error: ${K.stylePreferences.error}`},null,2))}var ES0=o(()=>{x$();n6();Kj();Z4()});var CS0={};M1(CS0,{handleProbeCommand:()=>Sx1});async function Sx1($,Y,U){let Q=Y??R(U.options.corp)??($&&$!=="--corp"?$:void 0);await jS0({corpId:Q})}var RS0=o(()=>{ES0();L4()});function _S0(){return`# Seal Use 系统架构与运行规范白皮书
|
||||
|
||||
> 本文档由 \`seal-use\` 单文件二进制程序内嵌提供,纯内存只读,未向用户电脑写入任何临时文件。
|
||||
|
||||
@@ -2408,14 +2375,14 @@ The direct local \`resource-pack preview\` command uses the default or temporary
|
||||
|
||||
| 目录名称 | 类别 | 规范路径 | 作用与生命周期 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
${Hr.map(($)=>`| **${$.name}** | \`${$.category}\` | \`${$.standardPath}\` | ${$.purpose} (${$.retention}) |`).join(`
|
||||
${Ur.map(($)=>`| **${$.name}** | \`${$.category}\` | \`${$.standardPath}\` | ${$.purpose} (${$.retention}) |`).join(`
|
||||
`)}
|
||||
|
||||
---
|
||||
|
||||
## 3. 安全与数据隐私保证
|
||||
|
||||
${Wr.map(($,Y)=>`### 3.${Y+1} ${$.topic}
|
||||
${Qr.map(($,Y)=>`### 3.${Y+1} ${$.topic}
|
||||
- **安全承诺**:${$.guarantee}
|
||||
- **实现约束**:${$.enforcement}
|
||||
`).join(`
|
||||
@@ -2425,7 +2392,7 @@ ${Wr.map(($,Y)=>`### 3.${Y+1} ${$.topic}
|
||||
|
||||
## 4. 业务域能力图谱
|
||||
|
||||
${Xr.map(($)=>`### \`seal-use ${$.domain}\`
|
||||
${Ir.map(($)=>`### \`seal-use ${$.domain}\`
|
||||
* **能力定位**:${$.summary}
|
||||
* **核心命令**:${$.primaryCommands.map((Y)=>`\`seal-use ${Y}\``).join("、")}
|
||||
`).join(`
|
||||
@@ -2438,14 +2405,39 @@ ${Xr.map(($)=>`### \`seal-use ${$.domain}\`
|
||||
- **环境自检**:运行 \`seal-use doctor\`,一键检查当前运行时版本、本地目录健康度、企业资产接入数量以及守护服务状态。
|
||||
- **查看企业配置源文件**:运行 \`seal-use corps get <corpId>\`,可直接查看指定企业的本地 JSON 存储绝对路径。
|
||||
- **查阅完整操作手册**:运行 \`seal-use doctor guide\` 随时在离线状态下查看本文档。
|
||||
`}var Hr,Wr,Xr;var Zr=o(()=>{Hr=[{name:"配置与状态根目录",category:"config",standardPath:"~/.config/seal-use",purpose:"用户本地持久化配置根目录,存放企业连接元数据、会话缓存与全局状态。",accessMode:"read-write",retention:"persistent"},{name:"企业配置文件目录",category:"config",standardPath:"~/.config/seal-use/enterprises",purpose:"存放各已添加企业的配置 JSON 文件(如 xiezihao.json),存储企业域名、脱敏 Token、员工绑定关系等。",accessMode:"read-write",retention:"persistent"},{name:"全局配置文件",category:"config",standardPath:"~/.config/seal-use/config.json",purpose:"维护全局工作模式(stateful/stateless)、默认激活企业 defaultCorpId 以及 Lint 偏好。",accessMode:"read-write",retention:"persistent"},{name:"会话凭据安全缓存",category:"config",standardPath:"~/.config/seal-use/seal_tokens.json",purpose:"缓存已认证租户的 Bearer Token 与过期时间戳,避免高频调用上游 OAuth 换票接口。",accessMode:"read-write",retention:"cache"},{name:"规则版本映射快照",category:"config",standardPath:"~/.config/seal-use/mappings",purpose:"存储 corps sync-test 生成的生产与测试规则版本/编号对照映射快照,供 rules map 离线毫秒级速查。",accessMode:"read-write",retention:"persistent"},{name:"后台守护服务日志",category:"config",standardPath:"~/.config/seal-use/service.log",purpose:"常驻后台 HTTP 服务守护进程运行输出日志。",accessMode:"read-write",retention:"persistent"},{name:"全局命令行程序",category:"binary",standardPath:"/opt/homebrew/bin/seal-use",purpose:"macOS / Linux 全局独立单文件二进制程序;旧版 seal-home 命令仅保留解析兼容,不再新建全局别名。",accessMode:"executable",retention:"persistent"},{name:"AI Agent 技能主目录",category:"skill",standardPath:"~/.agents/skills/seal-use",purpose:"面向 Antigravity、Codex 等 AI 智能体的标准技能目录,包含 SKILL.md、参考文档与操作规程。",accessMode:"read-write",retention:"persistent"},{name:"报表默认导出目录",category:"export",standardPath:"~/Downloads",purpose:"执行 approval-runs export 等大盘报表命令且未指定 --out 时,默认写入的 Excel 文件路径。",accessMode:"read-write",retention:"persistent"},{name:"系统隔离临时目录",category:"temp",standardPath:"/tmp 或 /var/folders/.../T",purpose:"自动化测试(bun test)生成的隔离工作副本,执行完毕后通过 afterEach 钩子彻底删除,零残留。",accessMode:"transient",retention:"ephemeral"}],Wr=[{topic:"敏感凭据脱敏保护",guarantee:"appSecurity、password 等高危密钥永不回显在 stdout,Session Token 采用掩码处理(如 5oUL...Y%3D)。",enforcement:"CLI 所有展示接口(corps get、corps list、probe 等)均经 formatSafeSourceDetail 脱敏过滤。"},{topic:"正式环境与测试环境严格隔离",guarantee:"正式企业与测试企业必须严格 1 对 1 下挂,禁止多层级级联绑定;环境标记需显式 --confirm 确认。",enforcement:"corps bind-test 与 mark 强制要求 --confirm,缺少时阻断并返回退出码 10(confirmationRequired)。"},{topic:"跨环境规则同步安全基线",guarantee:"corps sync-test 仅将正式企业偏好与规则覆盖同步至测试企业并自动发布,正式企业规则严格维持草稿态永不发布。",enforcement:"规则同步流水线由 sync-test 独占受控,正式环境端仅执行拉取草稿读取操作,零发版变更。"},{topic:"只读诊断无副作用原则",guarantee:"doctor、search、get、list、context、probe 等命令为严格只读操作,不修改用户本地文件系统,零写入污染。",enforcement:"核心领域函数严格分离 Mutation 操作与 Query 操作,Query 路径杜绝写文件与环境篡改。"}],Xr=[{domain:"corps (企业管理)",summary:"多租户接入、智能软搜索、富属性查看、环境标记、测试绑定与配置规则同步",primaryCommands:["corps list","corps search <query>","corps get <corpId>","corps mark","corps bind-test","corps sync-test"]},{domain:"approval-runs (审核大盘)",summary:"AI 审核单据检索、统计分析、引证规则查看、附件全链路追踪、Excel 报表导出、单据直达链接与免登",primaryCommands:["approval-runs list","approval-runs stats","approval-runs get","approval-runs export","approval-runs link"]},{domain:"rules (规则治理)",summary:"审核规则拉取、本地 Lint 质量检查、增量差量推送、离线版本与编号对照映射速查",primaryCommands:["rules pull","rules lint","rules push","rules map","rules count"]},{domain:"preference (决策偏好)",summary:"AI 审核偏好读取与更新、全局与分品类思考深度策略(medium/high)配置",primaryCommands:["preference get","preference decision update","preference thinking-depth set"]},{domain:"simulation (模拟演练)",summary:"合
Line truncated
|
||||
`)}var Ny0=o(()=>{Hp();W3();a$();eq();LP();Zr()});async function Dy0($,Y){let U=[],Q=Y.environment==="test"?"test":"production",I=Q==="test"?Y.prodCorpId:Y.testCorpId,J=Q==="test"?"prodParent":"testTarget",K=I?Q==="test"?"已绑定生产母企业 (上游配置与样本源)":"已绑定测试靶场 (下游隔离演练环境)":void 0,z=null,G=null;try{let F=await t6($);if(z=F.user,G=F.tenant,Boolean(z?.isAdmin||z?.permissions?.includes("*")))U.push({id:"auth_identity",name:"身份与权限契约",status:"pass",summary:`已认证为管理员「${z.name??"未知"}」(${z.id??""}),具备完整操作权限`,details:{userId:z.id,userName:z.name,isAdmin:!0,permissionLevel:"超级管理员(具备完整操作权限)",tenantName:G?.name,tenantSlug:G?.tenantSlug,permissions:z.permissions}});else U.push({id:"auth_identity",name:"身份与权限契约",status:"warn",summary:`已认证为普通用户「${z.name??"未知"}」,非超级管理员,部分配置操作可能受限`,details:{userId:z.id,userName:z.name,isAdmin:!1,permissionLevel:"普通用户(部分管理配置受限)",tenantName:G?.name,permissions:z.permissions},recommendation:"建议使用具有管理权限的企业主账号执行规则修改与集成发布"})}catch(F){U.push({id:"auth_identity",name:"身份与权限契约",status:"fail",summary:`鉴权握手失败:${F instanceof Error?F.message:String(F)}`,details:{error:String(F)},recommendation:`请执行 seal-use auth login --corp ${Y.id} 重新登录或更新 Token`})}let H={featureCode:"ai-approval",balance:0,deductionAmount:120,estimatedRuns:0,status:"exhausted"},W={used:0,remaining:0};try{let F=await UU($),N=Array.isArray(F.features)?F.features:[],O=N.find((P)=>P?.code==="ai-approval");if(O){let P=typeof O.balance==="number"?O.balance:0,T=typeof O.deductionAmount==="number"&&O.deductionAmount>0?O.deductionAmount:120,A=Math.floor(P/T);if(H.balance=P,H.deductionAmount=T,H.estimatedRuns=A,P<=0)H.status="exhausted",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"fail",summary:"当前额度已耗尽 (余量 0 点),无法执行审批模拟或回归测试",details:{balance:P,deductionAmount:T,estimatedRuns:A},recommendation:`请前往后台充值补充额度 (可通过 seal-use auth link --corp ${Y.id} 免密直达)`});else if(A<10)H.status="low",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`额度偏低:剩余 ${P} 点 (单笔扣除 ${T} 点),仅可支持约 ${A} 笔审核`,details:{balance:P,deductionAmount:T,estimatedRuns:A},recommendation:`建议补充额度 (可通过 seal-use auth link --corp ${Y.id} 免密直达)`});else H.status="sufficient",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"pass",summary:`额度充裕:剩余 ${P} 点,预估可支持 ${A} 笔审核单据`,details:{balance:P,deductionAmount:T,estimatedRuns:A}})}else U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:"未检索到「ai-approval」功能包额度明细,按默认通道运行",details:{features:N.map((P)=>P?.code)}});let D=N.find((P)=>P?.code==="approval-rules");if(D)W.used=typeof D.used==="number"?D.used:0,W.remaining=typeof D.remaining==="number"?D.remaining:0}catch(F){U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`读取计费状态失败:${F instanceof Error?F.message:String(F)}`,details:{error:String(F)}})}let X={totalCount:0,activeCount:0,quotaUsed:W.used,quotaRemaining:W.remaining};try{let F=await Q6($),N=Array.isArray(F.rules)?F.rules:[];if(X.totalCount=N.length,X.activeCount=N.filter((O)=>O.status==="ACTIVE").length,N.length===0)U.push({id:"rules_status",name:"审核规则状态",status:"warn",summary:"当前租户未配置任何审核规则 (规则数为 0)",details:{totalCount:0,activeCount:0},recommendation:Q==="test"&&I?`可运行 seal-use corps sync-test --corp ${I} 从生产企业同步规则`:"可运行 seal-use rules add 创建基础规则"});else U.push({id:"rules_status",name:"审核规则状态",status:"pass",summary:`审核规则健康:共 ${X.totalCount} 条规则,其中生效活跃 ${X.activeCount} 条`,details:{totalCount:X.totalCount,activeCount:X.activeCount,quotaUsed:W.used,quotaRemaining:W.remaining}})}catch(F){U.push({id:"rules_status",name:"审核规则状态",status:"fail",summary:`拉取规则列表失败:${F instanceof Error?F.message:String(F)}`,details:{error:String(F)}})}let Z={integrationCount:0,hasReplayChannel:!1,activeWebhookId:void 0};try{let F=await F$($);Z.integrationCount=F.length;let N=F.find((O)=>O.name.includes("回放")||O.name.toLowerCase().includes("replay"));if(Z.hasReplayChannel=Boolean(N),Z.activeWebhookId=N?.id??F[0]?.id,F.length===0)U.push({id:"webhook_integrations",name:"单据推送 Webhook 通道",status:"pass",summary:"未配置任何 Webhook 集成通道 (日常审批无影响;若需自动化系统推流或单据重放将自动创建)",details:{integrationCount:0}});else U.push({id:"webhook_integrations",nam
Line truncated
|
||||
`)}var By0=o(()=>{X4()});var Py0={};L8(Py0,{formatTenantDoctorDashboard:()=>Ay0,diagnoseTenantContract:()=>Dy0});var Ty0=o(()=>{By0()});async function Ey0($,Y,U){let Q=($??Y??"").toLowerCase();if(Q==="guide"||Q==="doc"||Q==="knowledge"||Q==="book"){console.error(`\uD83D\uDCD6 [Seal Use Doctor] 正在读取内嵌系统规范白皮书(纯内存只读)...
|
||||
`),console.log(Ly0());return}if(Q==="paths"||Q==="dirs"||Q==="directories"){let K=qr();C0(K.directories);return}if(Q==="auth"){let{selectCorp:K}=await Promise.resolve().then(() => (D4(),To)),{stringOption:z}=await Promise.resolve().then(() => (L4(),Ao)),{handleAuthCommand:G}=await Promise.resolve().then(() => (so(),Kg0)),H=z(U.options.corp)??(Y&&Y!==Q?Y:void 0)??(U.command[2]&&U.command[2]!==Q?U.command[2]:void 0),W=K(H);await G("check",W,U);return}if(Q==="tenant"||Q==="corp"||Q==="enterprise"){let{selectCorp:K}=await Promise.resolve().then(() => (D4(),To)),{createSealClient:z}=await Promise.resolve().then(() => (i6(),S10)),{stringOption:G}=await Promise.resolve().then(() => (L4(),Ao)),{diagnoseTenantContract:H,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (Ty0(),Py0)),X=G(U.options.corp)??(Y&&Y!==Q?Y:void 0)??(U.command[2]&&U.command[2]!==Q?U.command[2]:void 0),Z=K(X),q=await z(Z),V=await H(q,Z);if(!(z0(U.options.quiet)||z0(U.options.silent)))console.error(W(V));C0(V);return}let I=qr();if(!(z0(U.options.quiet)||z0(U.options.silent)))console.error(Oy0(I));C0(I)}var jy0=o(()=>{Ny0();Zr();L4();$4()});import{readFileSync as mx1}from"node:fs";function Cy0($,Y){let U=R($.options.contentFile)??R($.options["content-file"])??R($.options.file)??R($.options.f);if(U)return mx1(U,"utf8");let Q=R($.options.content);if(Q!==void 0)return Q;return typeof Y.content==="string"?Y.content:void 0}async function Ry0($,Y,U,Q,I){if(!$||$==="list"){let J=x4(I.options.scenarios),K=l0(I.options.limit),z=l0(I.options.offset);await v0("seal_approval_documents_list",U,Q,{scenarios:J,limit:K,offset:z},T0(I.options));return}if($==="get"){let J=(Y&&!Y.startsWith("-")?Y:void 0)??R(I.options.documentId)??R(I.options["document-id"])??R(I.options.id);if(!J)throw Error("Usage: seal-use documents get <documentId> [--corp <corpId>]");await v0("seal_approval_document_get",U,Q,{documentId:J},T0(I.options));return}if($==="search"){let J=Y??R(I.options.query);if(!J)throw Error("Usage: seal-use documents search <keyword> [--maxResults 20] [--corp <corpId>]");await v0("seal_approval_search",U,Q,{keywords:[J],areas:["documents"],maxResults:l0(I.options.maxResults),contextLines:l0(I.options.contextLines),refresh:z0(I.options.refresh),snippetOnly:z0(I.options.snippetOnly)??z0(I.options["snippet-only"]),maxChars:l0(I.options.maxChars)??l0(I.options["max-chars"]),fields:x4(I.options.fields)},T0(I.options));return}if($==="create"){let J=F6(I.json),K=R(I.options.title)??(typeof J.title==="string"?J.title:void 0),z=R(I.options.purpose)??(typeof J.purpose==="string"?J.purpose:void 0),G=Cy0(I,J),H=R(I.options.type)??R(I.options.contentType)??R(I.options["content-type"])??(typeof J.contentType==="string"?J.contentType:"policy"),W=R(I.options.status)??(typeof J.status==="string"?J.status:"published"),X=z0(I.options.enabled)??(typeof J.enabled==="boolean"?J.enabled:void 0),Z=x4(I.options.scenarios)??(Array.isArray(J.scenarios)?J.scenarios:["audit"]),q=x4(I.options.tags)??(Array.isArray(J.tags)?J.tags:void 0);if(!K||!z||G===void 0)throw Error("Usage: seal-use documents create --title <title> --purpose <purpose> [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]");await v0("seal_approval_document_create",U,Q,{title:K,purpose:z,content:G,contentType:H,status:W,enabled:X,scenarios:Z,tags:q},T0(I.options));return}if($==="update"){let J=F6(I.json),K=(Y&&!Y.startsWith("-")?Y:void 0)??R(I.options.documentId)??R(I.options["document-id"])??R(I.options.id)??(typeof J.documentId==="string"?J.documentId:void 0),z=R(I.options.title)??(typeof J.title==="string"?J.title:void 0),G=R(I.options.purpose)??(typeof J.purpose==="string"?J.purpose:void 0),H=Cy0(I,J),W=R(I.options.type)??R(I.options.contentType)??R(I.options["content-type"])??(typeof J.contentType==="string"?J.contentType:void 0),X=R(I.options.status)??(typeof J.status==="string"?J.status:void 0),Z=z0(I.options.enabled)??(typeof J.enabled==="boolean"?J.enabled:void 0),q=x4(I.options.scenarios)??(Array.isArray(J.scenarios)?J.scenarios:void 0),V=x4(I.options.tags)??(Array.isArray(J.tags)?J.tags:void 0);if(!K||!(z!==void 0||G!==void 0||H!==void 0||W!==void 0||X!==void 0||Z!==void 0||q!==void 0||V!==void 0))throw Error("Usage: seal-use documents update <documentId> [--title <title>] [--purpose <purpose>] [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--enabled <true|false>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]");await v0("seal_approval_document_update",U,Q,{documentId:K,title:z,purpose:G,content:H,contentType:W,status:X,enabled:Z,scenarios:q,tags:V},T0(I.options));return}if($==="delete"){let J=(Y&&!Y.startsWith("-")?Y:void 0)??R(I.options.documentId)??R(I.options["document-id"])??R(I.options.id);if(!J)throw Error("Usage: seal-use documents delete <documentId> --yes [--corp <co
Line truncated
|
||||
the credentials already stored on this machine for the selected enterprise. Keep it bound
|
||||
to loopback (\`--host 127.0.0.1\`) and do not expose the port to a network or an origin you
|
||||
do not control.
|
||||
`}},parameters:{CorpId:{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."},Offset:{name:"offset",in:"query",schema:{type:"integer",minimum:0,default:0},description:"Zero-based pagination offset."},Limit:{name:"limit",in:"query",schema:{type:"integer",minimum:1,maximum:100,default:50},description:"Maximum number of records to return."},RuleId:{name:"ruleId",in:"path",required:!0,schema:{type:"string"},description:"Approval rule ID."},VersionId:{name:"versionId",in:"path",required:!0,schema:{type:"string"},description:"Published rule version ID."},DocumentId:{name:"documentId",in:"path",required:!0,schema:{type:"string"},description:"Approval knowledge document ID."},RecordId:{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-use approval run record ID."},BatchId:{name:"batchId",in:"path",required:!0,schema:{type:"string"},description:"Simulation batch ID."}},responses:{BadRequest:{description:"Invalid request.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},Unauthorized:{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},NotFound:{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}},schemas:{ErrorResponse:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}},CorpSummary:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","seal"]},current:{type:"boolean"}}},SwitchCorpRequest:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}},SwitchCorpResponse:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}},SourceConfig:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."},AuthStage:{type:"object",additionalProperties:!0,required:["name","ok"],properties:{name:{type:"string",examples:["hose.openapi","hose.provisional","seal.sso","seal.whoami"]},ok:{type:"boolean"},error:{type:"string"}}},AuthDiagnosis:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}},SealUser:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},tenantId:{type:"string"},name:{type:"string"},isAdmin:{type:"boolean"},permissions:{type:"array",items:{type:"string"}}}},SealTenant:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},name:{type:"string"},tenantSlug:{type:"string"}}},WhoamiResponse:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}},SessionResponse:{type:"object",additionalProperties:!0,required:["user","session"],properties:{user:{$ref:"#/components/schemas/SealUser"},session:{type:"object",additionalProperties:!0}}},ApprovalRule:{type:"object",additionalProperties:!0,required:["id","description","scope","strictness"],properties:{id:{type:"string"},description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]},status:{type:"string"}}},ApprovalRuleInput:{type:"object",required:["description","scope","strictness"],properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulePatch:{type:"object",additionalProperties:!1,properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulesResponse:{type:"object",required:["rules"],properties:{rules:{type:"array",items:{$ref:"#/components/schemas/ApprovalRule"}},hasPendingDeletes:{type:"boolean"}}},RuleSetVersion:{type:"object",additionalProperties:!0,required:["id","versionNumber","versionName","rules"],properties:{id:{type:"string"},versionNumber:{type:"integer"},versionName:{type:"string"},publishedByName:{type:"string"},rules:{type:"array",items:{type:"object",additionalProperties:!0}}}},PublishRuleVersionRequest:{type:"object",required:["versionName"],properties:{versionName:{type:"string"}}},ApprovalDocument:{type:"object",additionalProperties:!0,required:["id","title","content"],properties:{id:{type:"string"},title:{typ
Line truncated
|
||||
`}var Ur,Qr,Ir;var Jr=o(()=>{Ur=[{name:"配置与状态根目录",category:"config",standardPath:"~/.config/seal-use",purpose:"用户本地持久化配置根目录,存放企业连接元数据、会话缓存与全局状态。",accessMode:"read-write",retention:"persistent"},{name:"企业配置文件目录",category:"config",standardPath:"~/.config/seal-use/enterprises",purpose:"存放各已添加企业的配置 JSON 文件(如 xiezihao.json),存储企业域名、脱敏 Token、员工绑定关系等。",accessMode:"read-write",retention:"persistent"},{name:"全局配置文件",category:"config",standardPath:"~/.config/seal-use/config.json",purpose:"维护全局工作模式(stateful/stateless)、默认激活企业 defaultCorpId 以及 Lint 偏好。",accessMode:"read-write",retention:"persistent"},{name:"会话凭据安全缓存",category:"config",standardPath:"~/.config/seal-use/seal_tokens.json",purpose:"缓存已认证租户的 Bearer Token 与过期时间戳,避免高频调用上游 OAuth 换票接口。",accessMode:"read-write",retention:"cache"},{name:"规则版本映射快照",category:"config",standardPath:"~/.config/seal-use/mappings",purpose:"存储 corps sync-test 生成的生产与测试规则版本/编号对照映射快照,供 rules map 离线毫秒级速查。",accessMode:"read-write",retention:"persistent"},{name:"后台守护服务日志",category:"config",standardPath:"~/.config/seal-use/service.log",purpose:"常驻后台 HTTP 服务守护进程运行输出日志。",accessMode:"read-write",retention:"persistent"},{name:"全局命令行程序",category:"binary",standardPath:"/opt/homebrew/bin/seal-use",purpose:"macOS / Linux 全局独立单文件二进制程序;旧版 seal-home 命令仅保留解析兼容,不再新建全局别名。",accessMode:"executable",retention:"persistent"},{name:"AI Agent 技能主目录",category:"skill",standardPath:"~/.agents/skills/seal-use",purpose:"面向 Antigravity、Codex 等 AI 智能体的标准技能目录,包含 SKILL.md、参考文档与操作规程。",accessMode:"read-write",retention:"persistent"},{name:"报表默认导出目录",category:"export",standardPath:"~/Downloads",purpose:"执行 approval-runs export 等大盘报表命令且未指定 --out 时,默认写入的 Excel 文件路径。",accessMode:"read-write",retention:"persistent"},{name:"系统隔离临时目录",category:"temp",standardPath:"/tmp 或 /var/folders/.../T",purpose:"自动化测试(bun test)生成的隔离工作副本,执行完毕后通过 afterEach 钩子彻底删除,零残留。",accessMode:"transient",retention:"ephemeral"}],Qr=[{topic:"敏感凭据脱敏保护",guarantee:"appSecurity、password 等高危密钥永不回显在 stdout,Session Token 采用掩码处理(如 5oUL...Y%3D)。",enforcement:"CLI 所有展示接口(corps get、corps list、probe 等)均经 formatSafeSourceDetail 脱敏过滤。"},{topic:"正式环境与测试环境严格隔离",guarantee:"正式企业与测试企业必须严格 1 对 1 下挂,禁止多层级级联绑定;环境标记需显式 --confirm 确认。",enforcement:"corps bind-test 与 mark 强制要求 --confirm,缺少时阻断并返回退出码 10(confirmationRequired)。"},{topic:"跨环境规则同步安全基线",guarantee:"corps sync-test 仅将正式企业偏好与规则覆盖同步至测试企业并自动发布,正式企业规则严格维持草稿态永不发布。",enforcement:"规则同步流水线由 sync-test 独占受控,正式环境端仅执行拉取草稿读取操作,零发版变更。"},{topic:"只读诊断无副作用原则",guarantee:"doctor、search、get、list、context、probe 等命令为严格只读操作,不修改用户本地文件系统,零写入污染。",enforcement:"核心领域函数严格分离 Mutation 操作与 Query 操作,Query 路径杜绝写文件与环境篡改。"}],Ir=[{domain:"corps (企业管理)",summary:"多租户接入、智能软搜索、富属性查看、环境标记、测试绑定与配置规则同步",primaryCommands:["corps list","corps search <query>","corps get <corpId>","corps mark","corps bind-test","corps sync-test"]},{domain:"approval-runs (审核大盘)",summary:"AI 审核单据检索、统计分析、引证规则查看、附件全链路追踪、Excel 报表导出、单据直达链接与免登",primaryCommands:["approval-runs list","approval-runs stats","approval-runs get","approval-runs export","approval-runs link"]},{domain:"rules (规则治理)",summary:"审核规则拉取、本地 Lint 质量检查、增量差量推送、离线版本与编号对照映射速查",primaryCommands:["rules pull","rules lint","rules push","rules map","rules count"]},{domain:"preference (决策偏好)",summary:"AI 审核偏好读取与更新、全局与分品类思考深度策略(medium/high)配置",primaryCommands:["preference get","preference decision update","preference thinking-depth set"]},{domain:"simulation (模拟演练)",summary:"合
Line truncated
|
||||
`)}var yS0=o(()=>{Vd();H3();x$();tq();sM();Jr()});async function kS0($,Y,U){if($==="bind-test"){let Q,I;if(Y&&U.command[3])Q=Y,I=U.command[3];else if(Y){let X=R(U.options.corp),Z=R(U.options["test-corp"])??R(U.options.testCorp);if(X)Q=X,I=Y;else if(Z)Q=Y,I=Z}if(!Q||!I)throw O4(`Usage: seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]
|
||||
or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]`);let J=E1(Q),K=E1(I);if(J.id===K.id)throw O4(`Cannot bind enterprise '${J.id}' to itself.`);if(J.prodCorpId&&J.prodCorpId!==K.id)throw O4(`Cannot use '${J.id}' as a production enterprise because it is already registered as a test enterprise for '${J.prodCorpId}'. Multi-tier chaining is not permitted.`);if(K.testCorpId&&K.testCorpId!==J.id)throw O4(`Cannot bind '${K.id}' as a test enterprise because it already has a bound test enterprise '${K.testCorpId}'. Multi-tier chaining is not permitted.`);let z=J0(U.options.force)===!0;if(J.testCorpId&&J.testCorpId!==K.id||K.prodCorpId&&K.prodCorpId!==J.id){if(!z)throw m4(`Enterprise binding conflict: production enterprise '${J.id}' is bound to '${J.testCorpId??"none"}', and test enterprise '${K.id}' is bound to '${K.prodCorpId??"none"}'. Overwriting an existing binding requires --force and --confirm.`,`seal-use corps bind-test ${J.id} ${K.id} --confirm --force`)}if(!(J0(U.options.confirm)===!0||J0(U.options.yes)===!0)){let X=z?" --force":"";throw m4(`Refusing to bind test enterprise '${K.name}' (${K.id}) to production enterprise '${J.name}' (${J.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${K.id}' as a test environment.`,`seal-use corps bind-test ${J.id} ${K.id} --confirm${X}`)}if(J.testCorpId&&J.testCorpId!==K.id)try{z9(J.testCorpId,{prodCorpId:void 0})}catch{}if(K.prodCorpId&&K.prodCorpId!==J.id)try{z9(K.prodCorpId,{testCorpId:void 0})}catch{}let G=z9(J.id,{environment:"production",testCorpId:K.id}),W=z9(K.id,{environment:"test",prodCorpId:J.id});return C0({success:!0,productionEnterprise:{id:G.id,name:G.name,environment:G.environment,testCorpId:G.testCorpId},testEnterprise:{id:W.id,name:W.name,environment:W.environment,prodCorpId:W.prodCorpId}}),!0}if($==="unbind-test"){let Q=Y??R(U.options.corp),I=E1(Q);if(!I.testCorpId&&!I.prodCorpId)return C0({unbound:!1,message:`Enterprise '${I.name}' (${I.id}) does not have an active test enterprise binding.`}),!0;let J=I.testCorpId?I.id:I.prodCorpId,K=I.testCorpId?I.testCorpId:I.id;if(!(J0(U.options.confirm)===!0||J0(U.options.yes)===!0))throw m4(`Refusing to unbind production enterprise '${J}' and test enterprise '${K}' without --confirm.`,`seal-use corps unbind-test ${I.id} --confirm`);z9(J,{testCorpId:void 0});try{z9(K,{prodCorpId:void 0})}catch{}return C0({success:!0,unboundProduction:J,unboundTest:K}),!0}return!1}var xS0=o(()=>{x$();N4();t6();L4();t1()});function Hj($){let Y;try{Y=new URL($.trim())}catch{throw Error("Invalid Seal delegate link: expected a valid HTTPS URL")}if(Y.protocol!=="https:")throw Error("Invalid Seal delegate link: expected HTTPS");let U=Y.hostname.toLowerCase();if(!U.endsWith(fS0))throw Error(`Invalid Seal delegate link: expected host ending in ${fS0}, got ${U}`);let Q=Y.pathname.replace(/\/+$/,"");if(Q!==uS0)throw Error(`Invalid Seal delegate link: expected path ${uS0}, got ${Q}`);let I=Y.searchParams.get("token");if(!I)throw Error("Invalid Seal delegate link: token query parameter is required");return{sealUrl:Y.origin,delegateToken:I}}async function bS0($){let Y=typeof $==="string"?Hj($):$;return(await v6(Y.sealUrl,void 0).post("api/v1/delegation/preview",{json:{token:Y.delegateToken}}).json()).data}async function iS0($){let Y=typeof $==="string"?Hj($):$,U=Y.sealUrl,Q=v6(U,void 0),I=await Q.post("api/v1/delegation/consume",{json:{token:Y.delegateToken}}),J=I.headers.get("set-cookie")??"",K=typeof I.headers.getSetCookie==="function"?I.headers.getSetCookie():[J],z="";for(let M of K)if(M&&M.includes("session_token=")){z=(M.split(";")[0]??"").trim();break}let H;try{H=await Q.get("api/auth/get-session",{headers:z?{cookie:z}:{}}).json()}catch{}let G=H?.session?.token;if(!G&&z){let M=z.match(/session_token=([^.;]+)/);if(M?.[1])G=decodeURIComponent(M[1])}if(!G)throw Error("Seal delegate exchange did not return a session token");let W=86400;if(H?.session?.expiresAt){let M=new Date(H.session.expiresAt).getTime();if(Number.isFinite(M)){let F=Math.floor((M-Date.now())/1000);if(F>0)W=F}}let Z=await v6(U,G).get("api/v1/auth/me").json(),q=Z.data&&typeof Z.data==="object"?Z.data:Z,V=q.user??H?.user??{},w=q.tenant??{};return{sealUrl:U,token:G,expiresIn:W,user:V,tenant:w}}function Gj($){let Y=[],U=0,Q="";try{let K=new URL($.trim()),z=K.hostname.toLowerCase(),H=K.pathname.replace(/\/+$/,"");if(z.endsWith(".ekuaibao.com")||z.endsWith(".hosecloud.com")||z==="ekuaibao.com"||z==="hosecloud.com")U+=40,Q="host is Hose domain";if(H==="/web/thirdparty.html")U+=40,Q+="; path is /web/thirdparty.html";if(K.searchParams.has("accessToken"))U+=10,Q+="; has accessToken";if(K.searchParams.has("ekbCorpId"))U+=10,Q+="; has ekbCorpId"}catch{U=0}if(U>0)Y.push({kind:"hose",score:U,reason:Q});let I=0,J="";try{let K=new URL($.trim()),z=K.hostname.toLowerCase(),H=K.pathname.replace(/\/+$/,"");if(z.endsWith(".sealai.cc"))I+=40,J="host ends with .sealai.cc";if(H==="/delegate")I+=40,J+="; path is /delegate";if(
Line truncated
|
||||
`,{mode:384}),{config:U,path:I}}var Hr=o(()=>{x$();pM()});function X5($){return typeof $==="string"&&$?$:void 0}function px1($){return{headers:dg.parse($.headers),cookies:mg.parse($.cookies)}}async function dx1($,Y,U={}){let Q=await e6(v6($,Y,U));return{user:Q.user??{},tenant:Q.tenant??{}}}async function cS0($){let Y=$.sealUrl.replace(/\/+$/,""),U=$.expiresIn??2592000,Q=$.force===!0||$.verify===!1?!1:!0,I=px1($),J=Q?await dx1(Y,$.token,_6(I)):void 0,K=pS0($,{token:$.token,sealUrl:Y,expiresIn:U,expiresAt:$.expiresAt,verify:Q,remote:J,custom:I}),z=$.tenantId??X5(J?.tenant.id),H=$.tenantSlug??X5(J?.tenant.tenantSlug);return{...K,verified:Q,tenantId:z,tenantSlug:H}}function nS0($){let Y=X5($.session.tenant.tenantSlug),U=X5($.session.tenant.id),Q=Y??U??"seal-delegate";return{...pS0({id:Q,corpId:Q,name:$.name,provider:"seal",overwrite:$.overwrite},{token:$.session.token,sealUrl:$.session.sealUrl,expiresIn:$.session.expiresIn,verify:!0,remote:{user:$.session.user,tenant:$.session.tenant}}),tenantId:U,tenantSlug:Y}}function pS0($,Y){let U=Y.remote?.user,Q=Y.remote?.tenant,I=$.tenantSlug??X5(Q?.tenantSlug),J=$.tenantId??X5(Q?.id),K=$.tenantName??X5(Q?.name),z=$.id??I??J;if(!z)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let H=Y.expiresAt?O8(Y.expiresAt):N1(Date.now()+Y.expiresIn*1000),G=$.staffId??X5(U?.providerUserId)??X5(U?.id)??"seal",W=$.provider??X5(U?.provider)??X5(Q?.providerConfig?.provider),X=$.corpId??I??J??z,Z={id:z,name:$.name??K??z,environment:"production",seal:{url:Y.sealUrl,tenantSlug:I,headers:Y.custom?.headers,cookies:Y.custom?.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:Y.token,sealUrl:Y.sealUrl,expiresIn:Y.expiresIn,expiresAt:H,staffId:G,corpId:X,tenantId:J,tenantSlug:I,tenantName:K,providerUserId:X5(U?.providerUserId),provider:W},auth:{refreshTtl:300}};return eq(Z,{overwrite:$.overwrite===!0})}var Gr=o(()=>{Hr();pM();n6();Z4()});async function dS0($){let Y=await zJ($.appKey,$.appSecurity,$.domain),U=await iM(Y.domain,Y.openapiToken).catch(()=>[]);return{...Y,roleCount:U.reduce((Q,I)=>Q+I.roleDefs.length,0),roleGroups:U.map((Q)=>({id:Q.id,name:Q.name,roleDefs:Q.roleDefs.map((I)=>({id:I.id,name:I.name,sourceType:I.sourceType}))}))}}async function mS0($){let Y=await zJ($.appKey,$.appSecurity,$.domain),U=$.role??$.roleDefId??"admin",Q=await iM(Y.domain,Y.openapiToken),I,J;for(let H of Q){for(let G of H.roleDefs)if(G.id===U||G.id===`${Y.corpId}:${U}`){I=G.id,J=G.name;break}if(I)break}if(!I&&(U==="admin"||U==="主管理员"))for(let H of Q){for(let G of H.roleDefs)if(G.id.endsWith(":admin")||G.name==="主管理员"){I=G.id,J=G.name;break}if(I)break}if(!I)for(let H of Q){for(let G of H.roleDefs)if(G.name.toLowerCase().includes(U.toLowerCase())){I=G.id,J=G.name;break}if(I)break}if(!I)throw Error(`Role not found matching query: '${U}'. Run 'seal-use corps probe-hose' to view all available roles.`);let K=await fg(Y.domain,Y.openapiToken,I),z=await ug(Y.domain,Y.openapiToken,K.staffs);return{domain:Y.domain,corpId:Y.corpId,corpName:Y.corpName??Y.corpId,roleId:I,roleName:J,staffs:z}}async function $V($){let Y=$.domain,U=$.staffId??$.proxyStaffBizId,Q=$.force===!0,I=Q||$.verify===!1?!1:!0,J=Y,K=$.corpId??$.corporationId,z=$.name,H;if(!J||!K||!U){let V=await zJ($.appKey,$.appSecurity,Y);J=V.domain,K=K??V.corpId,z=z??V.corpName,H=V.openapiToken}let G=U;if(!G&&H&&J){let V=$.role??"admin",w=await iM(J,H).catch(()=>[]),M;for(let F of w){for(let D of F.roleDefs)if(D.id.endsWith(`:${V}`)||D.name===V||D.id===V){M=D.id;break}if(M)break}if(!M)M=w.find((F)=>F.roleDefs.some((D)=>D.id.endsWith(":admin")))?.roleDefs.find((F)=>F.id.endsWith(":admin"))?.id;if(M){let F=await fg(J,H,M).catch(()=>({staffs:[]})),D=await ug(J,H,F.staffs).catch(()=>[]);if($.staffName||$.staffPhone){let O=D.filter((N)=>{if($.staffName&&N.name!==$.staffName&&!N.name.includes($.staffName))return!1;if($.staffPhone&&(!N.cellphone||!N.cellphone.includes($.staffPhone)))return!1;return!0});if(O.length===1&&O[0])G=O[0].id;else if(O.length>1)throw Error(`Multiple staff members matched '${$.staffName??$.staffPhone}': ${O.map((N)=>`${N.name}(${N.id})`).join(", ")}. Please specify exact staffId.`);else throw Error(`No staff member found matching '${$.staffName??$.staffPhone}' under role ${M}. Run 'seal-use corps hose-staffs' to view candidates.`)}else if(!Q){let O=D.map((N)=>({id:N.id,name:N.name,cellphone:N.cellphone,active:N.active}));throw Error(`Missing required parameter: staffId. Candidates: ${JSON.stringify(O)}`)}else G=D.find((O)=>O.active)?.id??D[0]?.id}}if(!G)if(!I&&U)G=U;else throw Error("Missing required parameter: staffId (or proxyStaffBizId). Run 'seal-use corps hose-staffs' to discover available administrators.");if(!K||!J)throw Error("Unable to resolve Hose corporation or domain");let W=$.id??K,X={id:W,name:$.name??z??K,environment:"production",seal:{url:$.sealUrl??`https://${K.toLowerCase()}.sealai.cc`,endpoints:{approvalStylePr
Line truncated
|
||||
`+"\uD83D\uDCA1 说明:此能力专属于合思 (Hose) 子域,用于将临时会话提权为标准 OpenAPI 开发者接入。需要企业管理员已在合思开放平台创建应用并生成 appKey/appSecurity。",Q);if(U.keyId||U.appKey){let I=$.find((J)=>U.keyId&&J.id===U.keyId||U.appKey&&J.appKey===U.appKey);if(!I)throw new sQ(`指定的合思密钥不存在,请从上述候选列表中选择正确的 appKey 或 keyId。
|
||||
`+`当前企业存在以下 ${$.length} 套候选密钥:
|
||||
`+$.map((J)=>` • "${J.name||"未命名应用"}" (appKey: ${J.appKey}, keyId: ${J.id}, 状态: ${J.active?"\uD83D\uDFE2 启用":"⚪ 停用"})`).join(`
|
||||
`),`${Q} --app-key ${$[0].appKey}`);return I}if($.length===1)return $[0];throw new sQ(`
|
||||
ℹ️ [合思子域提权] 合思企业 [${Y}] 存在多套 (${$.length} 套) OpenAPI 应用密钥凭据:
|
||||
${$.map((I,J)=>` [${J+1}] "${I.name||"未命名应用"}" (appKey: ${I.appKey}, keyId: ${I.id}, 状态: ${I.active?"\uD83D\uDFE2 启用":"⚪ 停用"})`).join(`
|
||||
`)}
|
||||
|
||||
\uD83D\uDC49 为确保权限提权绑定正确的业务应用,请显式指定要使用的密钥套件:
|
||||
在命令后追加 --app-key <key> 或 --key-id <id> 参数。
|
||||
`,`${Q} --app-key ${$[0].appKey}`)}async function sS0($){let Y=await ig($.link),U=rS0(Y.keys,Y.corpId,$,'seal-use corps add-link "<url>" --elevate-hose');if($.dryRun)return{result:Y,selectedKey:U,dryRun:!0};let Q=await $V({domain:Y.baseUrl,appKey:U.appKey,appSecurity:U.appSecurity,corpId:Y.corpId,name:$.name??Y.corpName,staffId:Y.staffId,overwrite:$.overwrite,force:$.force});return{result:Y,selectedKey:U,saved:Q,dryRun:!1}}async function aS0($){let Y=await ig($.link);if(!$.save)return{result:Y,reveal:$.reveal===!0};let U=rS0(Y.keys,Y.corpId,$,'seal-use corps hose-extract-keys "<url>" --save'),Q=await $V({domain:Y.baseUrl,appKey:U.appKey,appSecurity:U.appSecurity,corpId:Y.corpId,name:$.name??Y.corpName,staffId:Y.staffId,overwrite:$.overwrite,force:$.force});return{result:Y,selectedKey:U,saved:Q,reveal:$.reveal===!0}}function tS0($,Y){return{id:$.id,name:$.name||"-",appKey:$.appKey,appSecurity:Y?$.appSecurity:sG($.appSecurity),active:$.active,createTime:$.createTime,updateTime:$.updateTime}}var sQ;var eS0=o(()=>{s8();Xj();sQ=class sQ extends Error{nextAction;constructor($,Y){super($);this.name="HoseKeySelectionError",this.nextAction=Y}}});function $g0($){if(!$)return;if($.length<=8)return"****";return`${$.slice(0,4)}...${$.slice(-4)}`}function Yg0($){if($.source.type==="hose")return n7($,$.source);return $.seal.url??$.source.sealUrl}function Ug0($){if($.type==="hose"){let Y=$.appKey??$.key;return{type:"hose",provider:$.provider??"hosecloud",domain:$.domain,corpId:$.corpId,staffId:$.staffId,appKey:$g0(Y),hasAppSecurity:Boolean($.appSecurity??$.password),hasCloseToken:Boolean($.closeToken),closeTokenExpiresIn:$.closeToken?$.expiresIn:void 0,closeTokenExpiresAt:$.closeToken?$.expiresAt:void 0,credentialMode:$.closeToken?"web-session":"persistent",sealUrl:$.sealUrl}}if($.type==="seal")return{type:"seal",provider:$.provider??"seal",tenantId:$.tenantId,tenantSlug:$.tenantSlug,tenantName:$.tenantName,providerUserId:$.providerUserId,staffId:$.staffId,corpId:$.corpId,sealUrl:$.sealUrl,hasToken:Boolean($.token),tokenMasked:$g0($.token),expiresIn:$.expiresIn,expiresAt:$.expiresAt};throw Error(`Unsupported enterprise source type: ${$.type}`)}function Zj($){if(!$)return"未绑定手机";let Y=$.trim();if(Y.length===11)return`${Y.slice(0,3)}****${Y.slice(7)}`;if(Y.length>=7)return`${Y.slice(0,3)}****${Y.slice(-4)}`;if(Y.length>4)return`${Y.slice(0,2)}****${Y.slice(-2)}`;return Y}var qj=o(()=>{s8()});async function Qg0($,Y,U){if($==="probe-hose"){let Q=q6(U.json),I=await dS0({appKey:G3(Q,"appKey"),appSecurity:G3(Q,"appSecurity"),domain:C6(Q,"domain")});return C0({domain:I.domain,corpId:I.corpId,name:I.corpName??I.corpId,roleCount:I.roleCount,roleGroups:I.roleGroups}),!0}if($==="hose-staffs"){let Q=q6(U.json),I=await mS0({appKey:G3(Q,"appKey"),appSecurity:G3(Q,"appSecurity"),domain:C6(Q,"domain"),role:C6(Q,"role"),roleDefId:C6(Q,"roleDefId")});return C0({domain:I.domain,corpId:I.corpId,corpName:I.corpName,roleId:I.roleId,roleName:I.roleName,count:I.staffs.length,staffs:I.staffs.map((J)=>({id:J.id,name:J.name,cellphone:Zj(J.cellphone),active:J.active,authState:J.authState,userId:J.userId,email:J.email}))}),!0}if($==="add-hose-persistent"||$==="add-hose"){let I={...q6(U.json),...U.options.staffName?{staffName:R(U.options.staffName)}:{},...U.options["staff-name"]?{staffName:R(U.options["staff-name"])}:{},...U.options.staffPhone?{staffPhone:R(U.options.staffPhone)}:{},...U.options["staff-phone"]?{staffPhone:R(U.options["staff-phone"])}:{},...U.options.name?{name:R(U.options.name)}:{},...U.options.domain?{domain:R(U.options.domain)}:{},...U.options.corpId?{corpId:R(U.options.corpId)}:{},...U.options["corp-id"]?{corpId:R(U.options["corp-id"])}:{},...U.options.appKey?{appKey:R(U.options.appKey)}:{},...U.options["app-key"]?{appKey:R(U.options["app-key"])}:{},...U.options.appSecurity?{appSecurity:R(U.options.appSecurity)}:{},...U.options["app-security"]?{appSecurity:R(U.options["app-security"])}:{},...U.options.force!==void 0?{force:J0(U.options.force)}:{},...U.options.overwrite!==void 0?{overwrite:J0(U.options.overwrite)}:{}},J=await $V({...I,appKey:G3(I,"appKey"),appSecurity:G3(I,"appSecurity")});return C0({id:J.config.id,name:J.config.name,corpId:J.config.source.type==="hose"?J.config.source.corpId:void 0,domain:J.domain,staffId:J.staffId,verified:J.verified,path:J.path}),!0}if($==="add-hose-web-session"){let I={...q6(U.json),...U.options.name?{name:R(U.options.name)}:{},...U.options.domain?{baseUrl:R(U.options.domain)}:{},...U.options["base-url"]?{baseUrl:R(U.options["base-url"])}:{},...U.options.corpId?{corpId:R(U.options.corpId)}:{},...U.options["corp-id"]?{corpId:R(U.options["corp-id"])}:{},...U.options.staffId?{staffId:R(U.options.staffId)}:{},...U.options["staff-id"]?{staffId:R(U.options["staff-id"])}:{},...U.options.accessToken?{accessToken:R(U.options.accessToken)}:{},...U.options["access-token"]?{accessToken:R(U.options["access-token"])}:{},...U.options.overwrite!==void 0?{overwrite:J0(U.options.overwrite)}:{},...U.optio
Line truncated
|
||||
`);else console.error(`⚠️ [合思子域提权] 正在以明文展示合思 (Hose) appSecurity 接入密码,请妥善保管敏感凭据。
|
||||
`);C0({provider:"hose",capability:"privilege-elevation",corpId:Q.corpId,corpName:Q.corpName??Q.corpId,baseUrl:Q.baseUrl,staffId:Q.staffId,keyCount:Q.keys.length,keys:Q.keys.map((J)=>tS0(J,I))})}async function YV($,Y){let U=E1($),Q=Y.reveal===!0;if(U.source.type!=="hose")throw new U4(`【合思子域专享能力】当前企业「${U.name}」(id: ${U.id}) 为原生 Seal (${U.source.type}) 租户,非合思 (Hose/合思云/易快报) 渠道企业。
|
||||
`+"OpenAPI 密钥查询与提权能力专属于合思生态租户(用于从合思协助链接或合思凭据中提取开发者密钥提升权限等级),非合思渠道企业不支持此能力。",2);let I=U.source.appKey??U.source.key,J=U.source.appSecurity??U.source.password;if(!Q)console.error(`\uD83D\uDCA1 [合思子域] 接入密码默认脱敏,附加 --reveal (或 -r) 可查看完整 appSecurity 明文。
|
||||
`);else console.error(`⚠️ [合思子域] 正在以明文展示合思 appSecurity 接入密码,请妥善保管敏感凭据。
|
||||
`);C0({provider:"hose",capability:"privilege-elevation",corpId:U.id,corpName:U.name,domain:U.source.domain,staffId:U.source.staffId,appKey:I??"-",appSecurity:J?Q?J:sG(J):"-",active:!0})}var Ig0=o(()=>{s8();zr();Gr();oS0();Xj();eS0();t6();N4();L4();t1();qj()});var Kg0,zg0,Vj,Jg0,e4;var Z5=o(()=>{Kg0=/^[\uD800-\uDBFF]$/,zg0=/^[\uDC00-\uDFFF]$/,Vj=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;(function($){$[$.Unknown=0.0000000000001]="Unknown",$[$.Rule=0.000000000001]="Rule",$[$.DICT=0.00000002]="DICT",$[$.Surname=1]="Surname",$[$.Custom=1]="Custom"})(Jg0||(Jg0={}));e4={Normal:1,Surname:10,Custom:100}});function GY($){var Y;return $.length-(((Y=$.match(Vj))===null||Y===void 0?void 0:Y.length)||0)}function _$($){if(Vj.lastIndex=0,!Vj.test($))return $.split("");let Y=[],U=0;while(U<$.length){let Q=$[U];if(Kg0.test(Q)&&zg0.test($[U+1]))Y.push($.substring(U,U+2)),U+=2;else Y.push(Q),U+=1}return Y}class YH{constructor(){this.NumberDICT=[],this.StringDICT=new Map}get($){if($.length>1)return this.StringDICT.get($);else{let Y=$.charCodeAt(0);return this.NumberDICT[Y]}}set($,Y){if($.length>1)this.StringDICT.set($,Y);else{let U=$.charCodeAt(0);this.NumberDICT[U]=Y}}clear(){this.NumberDICT=[],this.StringDICT.clear()}}var c9=o(()=>{Z5()});function rx1(){let $={零一:"líng yī",〇一:"líng yī",十一:"shí yī",一十:"yī shí",第一:"dì yī",一十一:"yī shí yī"};for(let Y in Hg0)for(let U in Gg0){let Q=`${Y}${U}`,I=`${Hg0[Y]} ${Gg0[U]}`;$[Q]=I}return $}var Xg0,Zg0,qg0,Vg0,Lg0,Hg0,Gg0,Wg0,wg0,Wr,Fg0,Mg0;var Xr=o(()=>{Z5();c9();Xg0=["zh","ch","sh","z","c","s","b","p","m","f","d","t","n","l","g","k","h","j","q","x","r","y","w",""],Zg0=["j","q","x"],qg0=["uān","uán","uǎn","uàn","uan","uē","ué","uě","uè","ue","ūn","ún","ǔn","ùn","un","ū","ú","ǔ","ù","u"],Vg0={uān:"üān",uán:"üán",uǎn:"üǎn",uàn:"üàn",uan:"üan",uē:"üē",ué:"üé",uě:"üě",uè:"üè",ue:"üe",ūn:"ǖn",ún:"ǘn",ǔn:"ǚn",ùn:"ǜn",un:"ün",ū:"ǖ",ú:"ǘ",ǔ:"ǚ",ù:"ǜ",u:"ü"},Lg0=["ia","ian","iang","iao","ie","iu","iong","ua","uai","uan","uang","ue","ui","uo","üan","üe","van","ve"],Hg0={一:"yì",二:"èr",三:"sān",四:"sì",五:"wǔ",六:"liù",七:"qī",八:"bā",九:"jiǔ",十:"shí",百:"bǎi",千:"qiān",万:"wàn",亿:"yì",单:"dān",两:"liǎng",双:"shuāng",多:"duō",几:"jǐ",十一:"shí yī",零一:"líng yī",第一:"dì yī",一十:"yī shí",一十一:"yī shí yī"},Gg0={重:"chóng",行:"háng",斗:"dǒu",更:"gēng"};Wg0=rx1(),wg0=Object.keys(Wg0).map(($)=>({zh:$,pinyin:Wg0[$],probability:0.000000000001,length:GY($),priority:e4.Normal,dict:Symbol("rule")})),Wr={不:{bú:[4]},一:{yí:[4],yì:[1,2,3]}},Fg0={不:["的","而","之","后","也","还","地"],一:["的","而","之","后","也","还","是"]},Mg0=Object.keys(Wr)});var Og0,b5;var Lj=o(()=>{c9();Og0={"bǎng páng pāng":["膀"],líng:["〇","伶","凌","刢","囹","坽","夌","姈","婈","孁","岺","彾","掕","昤","朎","柃","棂","櫺","欞","泠","淩","澪","灵","燯","爧","狑","玲","琌","瓴","皊","砱","祾","秢","竛","笭","紷","綾","绫","羐","羚","翎","聆","舲","苓","菱","蓤","蔆","蕶","蛉","衑","裬","詅","跉","軨","輘","酃","醽","鈴","錂","铃","閝","陵","零","霊","霗","霛","霝","靈","駖","魿","鯪","鲮","鴒","鸰","鹷","麢","齡","齢","龄","龗","㥄"],yī:["一","乊","伊","依","医","吚","咿","噫","壱","壹","夁","嫛","嬄","弌","揖","撎","檹","毉","洢","渏","漪","瑿","畩","祎","禕","稦","繄","蛜","衤","譩","辷","郼","醫","銥","铱","鷖","鹥","黟","黳"],"dīng zhēng":["丁"],"kǎo qiǎo yú":["丂"],qī:["七","倛","僛","凄","嘁","墄","娸","悽","慼","慽","戚","捿","柒","桤","桼","棲","榿","欺","沏","淒","漆","紪","緀","萋","褄","諆","迉","郪","鏚","霋","魌","鶈"],shàng:["丄","尙","尚","恦","緔","绱"],xià:["丅","下","乤","圷","夏","夓","懗","梺","疜","睱","罅","鎼","鏬"],hǎn:["丆","喊","浫","罕","豃","㘎"],"wàn mò":["万"],zhàng:["丈","仗","墇","嶂","帐","帳","幛","扙","杖","涱","痮","瘬","瘴","瞕","粀","胀","脹","賬","账","障"],sān:["三","厁","叁","弎","毵","毶","毿","犙","鬖"],"shàng shǎng shang":["上"],"qí jī":["丌","其","奇"],"bù fǒu":["不"],"yǔ yù yú":["与"],miǎn:["丏","偭","免","冕","勉","勔","喕","娩","愐","汅","沔","湎","睌","緬","缅","腼","葂","靦","鮸","\uD867\uDF83"],gài:["丐","乢","匃","匄","戤","概","槩","槪","溉","漑","瓂","葢","鈣","钙","\uD872\uDFBF"],chǒu:["丑","丒","侴","吜","杽","瞅","矁","醜","魗"],zhuān:["专","叀","嫥","専","專","瑼","甎","砖","磗","磚","蟤","諯","鄟","顓","颛","鱄","䏝"],"qiě jū":["且"],pī:["丕","伓","伾","噼","坯","岯","憵","批","披","炋","狉","狓","砒","磇","礔","礕","秛","秠","耚","豾","邳","鈚","鉟","銔","錃","錍","霹","駓","髬","魾","\uD873\uDCF5"],shì:["世","丗","亊","事","仕","侍","冟","势","勢"
Line truncated
|
||||
`+`\uD83D\uDC49 查看全部请添加: seal-use corps list --all
|
||||
`+"\uD83D\uDC49 检索指定企业请使用: seal-use corps search <keyword>")}return C0(F.map((D)=>({id:D.id,name:D.name,environment:D.environment??"production",sourceType:D.source.type,provider:D.source.provider??D.source.type,staffId:D.source.staffId,testCorpId:D.testCorpId,prodCorpId:D.prodCorpId,current:D.id===G}))),!0}if($==="get"||$==="show"){let Q=Y??R(U.options.corp);if(!Q)throw O4("Usage: seal-use corps get <corpId>");let I=E1(Q),J=rg(I.id),K=Yg0(I);return C0({id:I.id,name:I.name,environment:I.environment??"production",configFile:J,seal:{url:K,tenantSlug:I.seal.tenantSlug??I.source.tenantSlug,customHeaderNames:I.seal.headers?Object.keys(I.seal.headers):[],customCookieNames:I.seal.cookies?Object.keys(I.seal.cookies):[],endpoints:I.seal.endpoints},source:Ug0(I.source),relations:{testCorpId:I.testCorpId,prodCorpId:I.prodCorpId},auth:{refreshTtl:I.auth.refreshTtl}}),!0}if($==="current"){let Q=E1(R(U.options.corp));return C0({id:Q.id,name:Q.name,environment:Q.environment??"production",sourceType:Q.source.type,provider:Q.source.provider??Q.source.type,staffId:Q.source.staffId,testCorpId:Q.testCorpId,prodCorpId:Q.prodCorpId}),!0}if($==="mark"||$==="mark-test"||$==="mark-prod"){let Q=Y??R(U.options.corp);if(!Q)throw O4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");let I=E1(Q),J=$==="mark-test"?"test":$==="mark-prod"?"production":R(U.options.env)??R(U.options.environment);if(J!=="production"&&J!=="test")throw O4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");if(!(J0(U.options.confirm)===!0||J0(U.options.yes)===!0))throw m4(`Refusing to change environment tag of enterprise '${I.name}' (${I.id}) to '${J}' without --confirm. Marking alters synchronization safety guards.`,`seal-use corps mark ${I.id} --env ${J} --confirm`);let z=z9(I.id,{environment:J});return C0({id:z.id,name:z.name,environment:z.environment,testCorpId:z.testCorpId,prodCorpId:z.prodCorpId}),!0}if($==="rename"){let Q=Y??R(U.options.corp)??R(U.options.id),I=R(U.options.name)??R(U.options.to)??(U.command[3]&&!U.command[3].startsWith("-")?U.command[3]:void 0);if(!Q||!I)throw Error("Usage: seal-use corps rename <corpId> --name <newName>");let J=E1(Q),K=z9(J.id,{name:I});return C0({success:!0,id:K.id,name:K.name,previousName:J.name}),!0}if($==="switch"){let Q=Y;if(!Q)throw Error("Usage: seal-use corps switch <corpId>");let I=A4();if(!I.stateful)throw Error("Cannot switch the default enterprise while stateless mode is enabled. Use `seal-use config mode stateful` first.");let J=E1(Q);return QU({...I,stateful:!0,defaultCorpId:J.id}),C0({current:!0,id:J.id,name:J.name}),!0}return!1}var Py0=o(()=>{x$();Dy0();sM();N4();t6();L4();t1();qj()});import{existsSync as Mf1,mkdirSync as Of1,readFileSync as Df1,writeFileSync as By0}from"node:fs";import{homedir as Nf1}from"node:os";import{join as Nj}from"node:path";function Ay0(){let $=process.env.SEAL_USE_MAPPINGS_DIR?.trim();if($)return $;return Nj(Nf1(),".config","seal-use","mappings")}function Ty0($){let Y=Ay0();Of1(Y,{recursive:!0,mode:448});let U=Nj(Y,`${$.target.id}-v${$.target.publishedVersionNumber}.json`),Q=Nj(Y,`${$.target.id}-latest.json`),I=JSON.stringify($,null,2);return By0(U,I,{encoding:"utf-8",mode:384}),By0(Q,I,{encoding:"utf-8",mode:384}),U}function jy0($,Y){let U=Ay0(),Q;if(!Y||Y==="latest")Q=`${$}-latest.json`;else{let J=String(Y).replace(/^v/i,"");Q=`${$}-v${J}.json`}let I=Nj(U,Q);if(!Mf1(I))return null;try{let J=Df1(I,"utf-8"),K=JSON.parse(J);if(typeof K.syncedAt==="string")K.syncedAt=O8(K.syncedAt);return K}catch{return null}}function Pr($){return $.replace(/^0+(?=\d)/,"")}function Ey0($,Y){if(!Y)return $;let U=Pr(Y.trim().toLowerCase().replace(/^#/,""));return $.filter((Q)=>{let I=String(Q.sourceRuleCode).toLowerCase().replace(/^#/,""),J=String(Q.targetRuleCode).toLowerCase().replace(/^#/,""),K=Pr(J.replace(/^rule-/,"")),z=Pr(I.replace(/^rule-/,""));return I===U||J===U||z===U||K===U||Q.sourceRuleId.toLowerCase()===U||Q.targetRuleId.toLowerCase()===U})}function Cy0($,Y,U){let Q=0,I=Y!==void 0?new RegExp(`\\[Prod v${Y}\\s*·\\s*#(\\d+)(?:[^\\]]*)\\]`):/\[Prod draft\s*·\s*#(\d+)(?:[^\]]*)\]/;for(let K of U){if(!K.versionName)continue;let z=K.versionName.match(I);if(z&&z[1]){let H=parseInt(z[1],10);if(!isNaN(H)&&H>Q)Q=H}}if(Q>0)return Q+1;if(!U.some((K)=>K.versionName&&/\[Prod v\d+/.test(K.versionName))){let K=U.filter((z)=>z.versionName&&z.versionName.includes(`Sync from ${$}`)).length;if(K>0)return K+1}return 1}function Ry0($,Y,U,Q){let I=Y!==void 0?`Prod v${Y}`:"Prod draft",J=Q!==void 0?` -> Test v${Q}`:"";return`Sync from ${$} [${I} · #${U}${J}]`}var Br=()=>{};import{randomBytes as Pf1}from"node:crypto";async function Pj($,Y,U={}){let Q=await _1($),I=await _1(Y),[J,K,z,H,G,W,X,Z]=await Promise.all([d1(Q,$.seal.endpoints.approvalStylePreferences),d1(I,Y.seal.endpoints.approvalStylePreferences),J6(Q),J6(I),y8(Q),y8(I),_y0(Q),_y0(I)]),q=(X.articles||[]).filter((i)=>!i.isDeleted),V=(Z.articles||[]).filter((i)=>!i.isDeleted),w=new Map(V
Line truncated
|
||||
Run 'seal-use corps bind-test ${I.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association.`);let J=E1(I.testCorpId);if(J.environment!=="test")throw Error(`Target enterprise '${J.name}' (${J.id}) is marked as '${J.environment}', NOT 'test'. Aborting sync to protect non-test environments.`);let K=R(U.options["version-name"])??R(U.options.versionName),z=J0(U.options["dry-run"])===!0||J0(U.options.dryRun)===!0,H=J0(U.options.yes)===!0||J0(U.options.confirm)===!0;if(z)return C0(await Pj(I,J,{versionName:K,dryRun:!0})),!0;if(!H){let G=await Pj(I,J,{versionName:K,execute:!1});throw m4(`Refusing to overwrite test enterprise '${J.name}' (${J.id}) with preferences, ${G.rulesPlan.sourceDraftRuleCount} draft rules, and ${G.documentsPlan.sourceDocumentCount} knowledge documents from production enterprise '${I.name}' (${I.id}) without --yes. This will replace test draft rules, synchronize knowledge documents, and publish a new version on the test enterprise.`,`seal-use corps sync-test ${I.id} --yes`)}return C0(await Pj(I,J,{versionName:K,execute:!0})),!0}if($==="replay-test"){let Q=Y??R(U.options.corp)??R(U.options.prodCorp)??R(U.options["prod-corp"]),I=E1(Q),J=J0(U.options.force)===!0,K=J0(U.options.dryRun)??J0(U.options["dry-run"]),z=J0(U.options.yes)===!0||J0(U.options.confirm)===!0,H;if(!I.testCorpId){if(!J)throw O4(`Production enterprise '${I.name}' (${I.id}) has no bound test enterprise.
|
||||
Run 'seal-use corps bind-test ${I.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association,
|
||||
or add '--force' (or use 'seal-use webhook replay <recordId> --force') if you explicitly intend to replay directly within production.`);H=I}else if(H=E1(I.testCorpId),H.environment!=="test"&&!J)throw Error(`Target enterprise '${H.name}' (${H.id}) is marked as '${H.environment}', NOT 'test'. Aborting replay to protect non-test environments (use --force to override).`);if(!K&&!z)throw m4("Refusing to replay approval records without --confirm. Use --dry-run to preview the payload without sending it.",`seal-use corps replay-test ${Q??"<prodCorpId>"} --confirm`);let G=R(U.options.recordId)??R(U.options["record-id"])??R(U.options.id),W=R(U.options.recordIds)??R(U.options["record-ids"]),X=W?W.split(",").map((N)=>N.trim()).filter(Boolean):void 0,Z=R(U.options.sn)??R(U.options.documentSn)??R(U.options["document-sn"]),q=R(U.options.sns)??R(U.options["document-sns"]),V=q?q.split(",").map((N)=>N.trim()).filter(Boolean):void 0,w=l0(U.options.limit)??(!G&&!X&&!Z&&!V?1:void 0),M={recordId:G,recordIds:X,sn:Z,sns:V,limit:w,status:R(U.options.status),startDate:R(U.options.startDate)??R(U.options["start-date"]),endDate:R(U.options.endDate)??R(U.options["end-date"])},F=await _1(I),D=I.id===H.id?F:await _1(H);console.error(`[corps-replay-test] 正式企业「${I.name}」(${I.id}) -> 测试企业「${H.name}」(${H.id})`);let O=await Oz({query:M,sourceClient:F,targetClient:D,sourceCorp:I,targetCorp:H,webhookSelector:R(U.options.webhook)??R(U.options.selector),snPrefix:R(U.options.snPrefix)??R(U.options["sn-prefix"]),snSuffix:R(U.options.snSuffix)??R(U.options["sn-suffix"]),docIdPrefix:R(U.options.docIdPrefix)??R(U.options["doc-id-prefix"]),docIdSuffix:R(U.options.docIdSuffix)??R(U.options["doc-id-suffix"]),dryRun:K});if(K)return console.error(`[corps-replay-test] 预览模式:已成功从 ${I.name} 提取单据并转换为 Webhook Payload(未实际推送)。`),C0(O),!0;if(O.success)console.error(`\uD83D\uDFE2 成功重放 ${O.successCount} 条单据(来自「${I.name}」)至「${H.name}」(${O.targetWebhook?.name??"Webhook 通道"})`);else console.error(`\uD83D\uDD34 单据重放部分或全部失败(成功 ${O.successCount} 条,失败 ${O.failureCount} 条)至「${H.name}」`);if(console.error(`\uD83D\uDC49 Next action: seal-use approval-runs list --corp ${H.id} --limit ${O.totalCount}`),C0(O),!O.success)throw new U4(`Approval record replay failed: ${O.failureCount} record(s) failed.`,1);return!0}return!1}var hy0=o(()=>{n6();Ar();qq();N4();t6();L4();t1();Ar()});var Sy0={};M1(Sy0,{showCorpKeysAction:()=>YV,maskCellphone:()=>Zj,handleCorpsCommand:()=>Tf1,extractKeysFromLinkAction:()=>$H,buildTestHosecloudOutboundName:()=>KV});async function Tf1($,Y,U){if(await Ny0($,Y,U))return;if(await kS0($,Y,U))return;if(await vy0($,Y,U))return;if(await Qg0($,Y,U))return;throw Error(`Unknown corps command: ${$??""}. Run 'seal-use help' for available commands.`)}var Tr=o(()=>{xS0();Ig0();Py0();hy0();qj()});var HV={};M1(HV,{handleAuthExtractKeysCommand:()=>jf1,handleAuthCommand:()=>Ef1,formatBeijingIso:()=>N1});async function jf1($,Y){let U=$??R(Y.options.link)??R(Y.options.url);if(!U)throw Error("Usage: seal-use auth hose-extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let Q=J0(Y.options.reveal)===!0||J0(Y.options.r)===!0||J0(Y.options.plain)===!0,I=J0(Y.options.save)===!0||J0(Y.options.add)===!0;await $H(U,{reveal:Q,save:I,name:R(Y.options.name),overwrite:J0(Y.options.overwrite)===!0,force:J0(Y.options.force)===!0,appKey:R(Y.options["app-key"])??R(Y.options.appKey),keyId:R(Y.options["key-id"])??R(Y.options.keyId)})}async function Ef1($,Y,U){let Q=U.command[2]?.toLowerCase(),I=R(U.options["from-link"])??(Q==="from-link"?U.command[3]:void 0);if(($==="seal-link"||$==="link"||$==="hose-link"&&Y?.source?.type==="seal")&&I){let J=R(U.options.note),K=await xM(I),z=v6(K.sealUrl,K.token),H=await e6(z);fM(K.corpId,H.tenant);let G=await XJ(z,{note:J});C0({tenant:{id:H.tenant.id,name:H.tenant.name,tenantSlug:H.tenant.tenantSlug,corpId:K.corpId},user:{id:H.user.id,name:H.user.name,providerUserId:H.user.providerUserId,isAdmin:H.user.isAdmin},delegation:G,expiresIn:K.expiresIn});return}if(!Y)throw Error(`auth ${$??""} requires an enterprise. Provide --corp <id> or select one.`);if($==="check"||$==="diagnose"||$==="status"||$==="test"||$==="doctor"){C0(await Cf1(Y));return}if($==="seal-link"||$==="link"||$==="hose-link"&&Y.source?.type==="seal"){let J=await _1(Y);if(Q==="list"){await v0("seal_delegation_list",J,Y,{},T0(U.options));return}if(Q==="revoke"){let X=U.command[3]??R(U.options.tokenId)??R(U.options.id);if(!X)throw Error("Usage: seal-use auth link revoke <tokenId>");await v0("seal_delegation_revoke",J,Y,{tokenId:X},T0(U.options));return}let K=R(U.options.note)??"CLI generated provisional access link",z=await R$("seal_delegation_create",J,Y,{note:K});if($==="hose-link")console.error(`\uD83D\uDC49 提示: 企业「${Y.name}」源类型为 Seal 原生测试环境,已自动为Line truncated
|
||||
`)}var fy0=o(()=>{Z4()});var uy0={};M1(uy0,{formatTenantDoctorDashboard:()=>xy0,diagnoseTenantContract:()=>ky0});var by0=o(()=>{fy0()});var iy0={};M1(iy0,{handleDoctorCommand:()=>hf1});async function hf1($,Y,U){let Q=($??Y??"").toLowerCase();if(Q==="guide"||Q==="doc"||Q==="knowledge"||Q==="book"){console.error(`\uD83D\uDCD6 [Seal Use Doctor] 正在读取内嵌系统规范白皮书(纯内存只读)...
|
||||
`),console.log(_S0());return}if(Q==="paths"||Q==="dirs"||Q==="directories"){let K=Kr();C0(K.directories);return}if(Q==="auth"){let{selectCorp:K}=await Promise.resolve().then(() => (N4(),oq)),{stringOption:z}=await Promise.resolve().then(() => (L4(),Og)),{handleAuthCommand:H}=await Promise.resolve().then(() => (GV(),HV)),G=z(U.options.corp)??(Y&&Y!==Q?Y:void 0)??(U.command[2]&&U.command[2]!==Q?U.command[2]:void 0),W=K(G);await H("check",W,U);return}if(Q==="tenant"||Q==="corp"||Q==="enterprise"){let{selectCorp:K}=await Promise.resolve().then(() => (N4(),oq)),{createSealClient:z}=await Promise.resolve().then(() => (n6(),pg)),{stringOption:H}=await Promise.resolve().then(() => (L4(),Og)),{diagnoseTenantContract:G,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (by0(),uy0)),X=H(U.options.corp)??(Y&&Y!==Q?Y:void 0)??(U.command[2]&&U.command[2]!==Q?U.command[2]:void 0),Z=K(X),q=await z(Z),V=await G(q,Z);if(!(J0(U.options.quiet)||J0(U.options.silent)))console.error(W(V));C0(V);return}let I=Kr();if(!(J0(U.options.quiet)||J0(U.options.silent)))console.error(gS0(I));C0(I)}var cy0=o(()=>{yS0();Jr();L4();t1()});function Er($){if(typeof $!=="string"||!$.trim())return"UNKNOWN";let Y=$.toUpperCase().trim();if(Y==="APPROVE"||Y==="PASS")return"APPROVE";if(Y==="REJECT"||Y==="DENIED")return"REJECT";if(Y==="MANUAL"||Y==="ASSISTED")return"MANUAL";if(Y==="ERROR"||Y==="FAILED")return"ERROR";return Y}async function ny0($){let{sourceCorp:Y,targetCorp:U,sourceClient:Q,targetClient:I,samples:J=10,dryRun:K=!1,pollIntervalMs:z=2000,timeoutMs:H=45000,snPrefix:G="REG_",fetchFn:W=fetch}=$;if(U.environment!=="test")throw xG(`重放目标企业「${U.name}」(${U.id}) 的环境为「${U.environment}」,非测试环境!
|
||||
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",`seal-use corps bind-test ${Y.id} <testCorpId>`);let X=await JU(I),q=(Array.isArray(X.features)?X.features:[]).find((m)=>m?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,w=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,M=J*w;if(V<M)throw new U4(`测试企业「${U.name}」AI 审批额度不足:当前剩余 ${V} 点,本次回归抽样 ${J} 笔需要约 ${M} 点。
|
||||
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${U.id}」充值 AI 审批额度,或降低抽样笔数 (--samples ${Math.max(1,Math.floor(V/w))})`);let F=await b4(Q,{limit:J,status:"completed"}),D=Array.isArray(F.records)?F.records:[];if(D.length===0){let m=await b4(Q,{limit:J});D=Array.isArray(m.records)?m.records:[]}if(D.length===0)throw new U4(`在母企业「${Y.name}」(${Y.id}) 中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(D=D.slice(0,J),K){let m=D.map((e)=>{let Y0=e.sourceDocumentSN??e.id,g=e?.result?.decision??e.aiDecision??e?.decision,d=Er(g),U0=e?.result?.summary??e.aiSummary;return{sn:Y0,sourceRecordId:e.id,prodDecision:d,prodSummary:U0,status:"DRY_RUN"}});return{ok:!0,verdict:"DRY_RUN",safeToPublish:!0,timestamp:N1(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:w,estimatedRequired:M},metrics:{sampleCount:m.length,successCount:m.length,failureCount:0,matchCount:m.length,flipCount:0,concordanceRate:1},flips:[],records:m}}let O=await ud(I,U,$.webhookSelector),N=[];for(let m of D){let e=Date.now(),Y0=m.sourceDocumentSN??m.id,g=Er(m?.result?.decision??m.aiDecision??m?.decision),d=m?.result?.summary??m.aiSummary;try{let U0=await X4(Q,m.id),y=`${G}${Y0}`,i=xd(U0,{snPrefix:G,docIdPrefix:G});await fd(O.incomingDocumentWebhook.url,O.secret,i,W,_6(U.seal));let $0=null,V0=Date.now();while(Date.now()-V0<H){await new Promise((G0)=>setTimeout(G0,z));let t=await b4(I,{sourceDocumentSN:y,limit:1});if(t.records&&t.records.length>0){let G0=t.records[0];if(G0.status==="completed"||G0.status==="failed"){$0=G0;break}}}if(!$0){N.push({sn:Y0,sourceRecordId:m.id,prodDecision:g,prodSummary:d,status:"FAILED",error:`测试租户单据审核超时 (${Math.round(H/1000)}s 未完成)`,durationMs:Date.now()-e});continue}let E0=Er($0?.result?.decision??$0.aiDecision??$0?.decision??($0.status==="completed"?"APPROVE":"ERROR")),P0=$0?.result?.summary??$0.aiSummary,R0=g===E0,r0=R0?"MATCHED":"FLIPPED",X1={sn:Y0,sourceRecordId:m.id,prodDecision:g,prodSummary:d,testRecordId:$0.id,testDecision:E0,testSummary:P0,status:r0,durationMs:Date.now()-e};if(!R0)X1.diff={from:g,to:E0,reasonDiff:P0&&d&&P0!==d?`生产: ${d.slice(0,60)}... -> 测试: ${P0.slice(0,60)}...`:void 0};N.push(X1)}catch(U0){N.push({sn:Y0,sourceRecordId:m.id,prodDecision:g,prodSummary:d,status:"FAILED",error:U0 instanceof Error?U0.message:String(U0),durationMs:Date.now()-e})}}let B=N.filter((m)=>m.status==="MATCHED"||m.status==="FLIPPED"),A=N.filter((m)=>m.status==="MATCHED"),P=N.filter((m)=>m.status==="FLIPPED"),j=N.filter((m)=>m.status==="FAILED").length,C=A.length,u=P.length,x=C+u,S=x>0?C/x:0,b=u>0,n=b?"REGRESSIONS_DETECTED":"CLEAN",I0=!b&&j===0,k;try{let m=await JU(I),Y0=(Array.isArray(m.features)?m.features:[]).find((g)=>g?.code==="ai-approval");if(typeof Y0?.balance==="number")k=Y0.balance}catch{}return{ok:!b&&j===0,verdict:n,safeToPublish:I0,timestamp:N1(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:w,estimatedRequired:M,balanceAfter:k},metrics:{sampleCount:N.length,successCount:B.length,failureCount:j,matchCount:C,flipCount:u,concordanceRate:Number(S.toFixed(4))},flips:P,records:N}}function py0($){let{sourceCorp:Y,targetCorp:U,verdict:Q,safeToPublish:I,metrics:J,quota:K,flips:z}=$,H=Q==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":Q==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",G=["",`\uD83E\uDDEA [Seal Use Test] 规则回归测试矩阵: 生产「${Y.name}」-> 测试靶场「${U.name}」`,` 判定: ${H} · 准许发布: ${I?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),` 样本总数: ${J.sampleCount} | 一致通过: ${J.matchCount} | 决策翻转: ${J.flipCount} | 异常失败: ${J.failureCount}`,` 一致率: ${(J.concordanceRate*100).toFixed(1)}% | 消耗预估: ${K.estimatedRequired} 点 (余量: ${K.balanceBefore}${K.balanceAfter!==void 0?` -> ${K.balanceAfter}`:""})`," "+"─".repeat(65)];if(z.length>0){G.push(` ⚠️ 决策翻转清单 (${z.length} 笔单据在新规则下结果改变):`);for(let W of z)if(G.push(` • 单据 [${W.sn}]: 原生产判定「${W.prodDecision}」 ➔ 测试新判定「${W.testDecision}」`),W.diff?.reasonDiff)G.push(` 理由差异: ${W.diff.reasonDiff}`);G.push(" "+"─".repeat(65)),G.push(" \uD83D\uDC49 建议: 请检查上述翻转单据是否符合预期修正。若为意外误杀,请调整测试环境规则后再次回归。")}else if(Q==="CLEAN")G.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100% 吻合,无任何意外误杀或漏判
Line truncated
|
||||
`)}var dy0=o(()=>{fG();Z4();qq()});var Cr={};M1(Cr,{handleTestCommand:()=>Sf1});async function Sf1($,Y,U){let Q=($??Y??"regression").toLowerCase();if(Q==="regression"||Q==="regress"||Q==="matrix"){let I=R(U.options.corp)??(Y&&Y!==Q?Y:void 0),J=E1(I),K=J,z=J;if(J.environment==="test"){z=J;let O=R(U.options["prod-corp"])??R(U.options.prod)??J.prodCorpId;if(!O)throw new U4(`测试企业「${J.name}」(${J.id}) 未绑定生产母企业,无法拉取历史样本。
|
||||
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-use corps bind-test <prodCorpId> ${J.id}`);K=E1(O)}else{K=J;let O=R(U.options["test-corp"])??R(U.options.test)??J.testCorpId;if(!O)throw new U4(`生产企业「${J.name}」(${J.id}) 未绑定测试靶场企业。
|
||||
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${J.id} <testCorpId>`);z=E1(O)}let H=await _1(K),G=await _1(z),W=l0(U.options.samples)??l0(U.options.limit)??l0(U.options.n)??10,X=J0(U.options["dry-run"]),Z=J0(U.options["fail-on-flips"]),q=l0(U.options["poll-interval"])??2000,V=l0(U.options.timeout)??45000,w=R(U.options["sn-prefix"])??"REG_",M=R(U.options.webhook)??R(U.options.selector),F=await ny0({sourceCorp:K,targetCorp:z,sourceClient:H,targetClient:G,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:w,failOnFlips:Z,webhookSelector:M});if(!(J0(U.options.quiet)||J0(U.options.silent)))console.error(py0(F));if(C0(F),Z&&!F.ok)throw new U4(`回归测试发现 ${F.metrics.flipCount} 笔单据决策翻转,已按 --fail-on-flips 策略非零终止。`,1);return}throw new U4(`未知的 test 子命令: "${Q}"。
|
||||
可用子命令: seal-use test regression [--corp <id>] [--samples <N>] [--dry-run]`,2,"seal-use test regression --help")}var Rr=o(()=>{t6();N4();L4();t1();n6();dy0()});var my0={};M1(my0,{handleConfigCommand:()=>gf1});function gf1($,Y,U){if($==="paths"){C0({candidates:X3(),globalConfigFile:UU()});return}if($==="get"||$==="status"){C0(KY());return}if($==="mode"){let Q=Y??R(U.options.mode);if(!Q){C0(KY());return}let I=Lg(Q),J=R(U.options.corp),K=A4(),z=I?J?p7(a8(),{stateful:!0,corpId:J},X3()).id:K.defaultCorpId:void 0,H=QU({...K,stateful:I,...z?{defaultCorpId:z}:{}});C0(KY(H));return}if($==="lint"){let Q=Y??R(U.options.state)??R(U.options.enable),I=A4(),J=I.lint??{enabled:!1,activeLinter:"builtin",minScore:0};if(!Q||Q==="status"||Q==="get"){C0({lint:J,configFile:UU()});return}let K=J.enabled;if(Q==="enable"||Q==="on"||Q==="true")K=!0;else if(Q==="disable"||Q==="off"||Q==="false")K=!1;let z=R(U.options.linter)??J.activeLinter,H=U.options.minScore!==void 0||U.options["min-score"]!==void 0?Number(U.options.minScore??U.options["min-score"]):J.minScore,G={enabled:K,activeLinter:z,minScore:isNaN(H)?0:Math.max(0,Math.min(100,H))},W=QU({...I,lint:G});C0(KY(W));return}if($==="test-dir"||$==="test-enterprises-dir"){let Q=U.options.clear===!0||Y==="--clear"||Y==="clear",I=A4();if(Q){let z=QU({...I,testEnterprisesDir:void 0});C0(KY(z));return}let J=Y&&!Y.startsWith("-")?Y:R(U.options.path)??R(U.options.dir);if(!J){C0({testEnterprisesDir:I.testEnterprisesDir??null,configFile:UU()});return}let K=QU({...I,testEnterprisesDir:J});C0(KY(K));return}throw Error(`Unknown config command: ${$??""}. Available: paths, get, status, mode, lint, test-dir. Run 'seal-use help' for available commands.`)}var ly0=o(()=>{x$();N4();L4();t1()});function WV($){let Y=[],U="",Q,I=!1,J=!1;for(let K of $){if(I){U+=K,I=!1,J=!0;continue}if(K==="\\"&&Q!=="'"){I=!0,J=!0;continue}if(Q){if(K===Q)Q=void 0;else U+=K;J=!0;continue}if(K==="'"||K==='"'){Q=K,J=!0;continue}if(/\s/.test(K)){if(J)Y.push(U),U="",J=!1;continue}U+=K,J=!0}if(I)throw Error("Invalid command: trailing escape");if(Q)throw Error("Invalid command: unterminated quote");if(J)Y.push(U);return Y}function oy0($){let Y=$[0];if(!Y)return[];if(Y==="seal-use"||Y==="seal-home"||Y.endsWith("/seal-use")||Y.endsWith("/seal-home"))return $.slice(1);return $}function ry0(){return`<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
@@ -2469,23 +2461,31 @@ do not control.
|
||||
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.101/dist/browser/standalone.js"
|
||||
></script>
|
||||
</body>
|
||||
</html>`}var yy0=o(()=>{W3()});import{URL as ox1}from"node:url";async function x6($,Y,U,Q){let I=$.handler;return I(Y,U,{corp:Q})}async function ky0($,Y){if(Y.setHeader("Access-Control-Allow-Origin","*"),Y.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS, PATCH"),Y.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization, X-Seal-Corp, X-Seal-Home-Session"),$.method==="OPTIONS"){Y.writeHead(204),Y.end();return}let U=$.headers.host||"localhost",Q=$.headers["x-forwarded-proto"]||"http",I=new ox1($.url||"/",`${Q}://${U}`),J=I.pathname.replace(/\/+$/,"")||"/",K=($.method||"GET").toUpperCase();try{if(K==="GET"&&J==="/"){j4(Y,200,{name:"seal-use",version:Z1,description:"Seal tenant operations and approval automation HTTP API",docs:"/docs",openapi:"/openapi.json",health:"/health",endpoints:{cli:"POST /api/cli",tools:"GET /api/tools",toolInvoke:"POST /api/tool/:name",restV1:"GET/POST /v1/*"}});return}if(K==="GET"&&J==="/docs"){sx1(Y,200,gy0());return}if(K==="GET"&&J==="/openapi.json"){j4(Y,200,FE());return}if(K==="GET"&&J==="/health"){j4(Y,200,{status:"ok",version:Z1,name:"seal-use",timestamp:A1()});return}if(K==="POST"&&(J==="/shutdown"||J==="/api/shutdown")){j4(Y,200,{success:!0,message:"Shutting down seal-use background daemon",pid:process.pid}),setTimeout(()=>{process.kill(process.pid,"SIGTERM")},50);return}if(K==="POST"&&J==="/api/cli"){let z=await ME($),G=(typeof z?.command==="string"?z.command:"").trim();if(!G){wE(Y,400,"Missing 'command' property in request body");return}let H=$V(G),W=H[0]==="seal-use"||H[0]==="seal-home"||H[0]?.endsWith("/seal-use")||H[0]?.endsWith("/seal-home")?H.slice(1):H,X=await YV(W),Z=void 0;try{if(X.stdout.trim().startsWith("{")||X.stdout.trim().startsWith("["))Z=JSON.parse(X.stdout)}catch{}j4(Y,X.isError?400:200,{success:!X.isError,stdout:X.stdout,stderr:X.stderr,exitCode:X.exitCode,data:Z});return}if(K==="POST"&&J.startsWith("/api/tool/")){let z=J.slice(10).trim(),G=B6(z);if(!G){wE(Y,404,`Tool not found: '${z}'`);return}let H=await ME($)||{},W=m8($,I,H),X=M1(W),Z=await P1(X),q={...H};delete q.corp;let V=await x6(G,Z,q,X);j4(Y,200,V);return}if(J.startsWith("/v1/")){if(await rx1($,Y,K,J,I))return}wE(Y,404,`Cannot ${K} ${J}. Visit /docs for available endpoints.`)}catch(z){let G=z instanceof Error?z.message:String(z);wE(Y,500,G)}}async function rx1($,Y,U,Q,I){let J=Object.fromEntries(I.searchParams.entries());if(U==="GET"&&Q==="/v1/corps"){let K=K$(),z=T4();return j4(Y,200,{count:K.length,mode:z.stateful?"stateful":"stateless",defaultCorpId:z.defaultCorpId,corps:K.map((G)=>({id:G.id,name:G.name,sourceType:G.source.type,sealUrl:G.seal?.url}))}),!0}if(U==="GET"&&Q==="/v1/whoami"){let K=m8($,I,J),z=M1(K),G=await P1(z),H=B6("seal_whoami"),W=await x6(H,G,{},z);return j4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/session"){let K=m8($,I,J),z=M1(K),G=await P1(z),H=B6("seal_session_get"),W=await x6(H,G,{},z);return j4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/approval-runs/summary"){let K=m8($,I,J),z=M1(K),G=await P1(z),H=B6("seal_approval_runs_summary"),W=await x6(H,G,J,z);return j4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/approval-runs/stats"){let K=m8($,I,J),z=M1(K),G=await P1(z),H=B6("seal_approval_runs_stats"),W=await x6(H,G,J,z);return j4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/approval-runs/pick"){let K=m8($,I,J),z=M1(K),G=await P1(z),H=B6("seal_approval_run_pick"),W=await x6(H,G,J,z);return j4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/approval-runs/url"){let K=m8($,I,J),z=M1(K),G=await P1(z),H=B6("seal_approval_run_url_get"),W=await x6(H,G,J,z);return j4(Y,200,W),!0}if(Q.startsWith("/v1/approval-runs/")){let K=Q.slice(18).split("/"),z=K[0],G=K[1];if(z&&!["summary","pick","stats","url","bridge"].includes(z)){let H=m8($,I,J),W=M1(H),X=await P1(W);if(!G){let Z=B6("seal_approval_run_get"),q=await x6(Z,X,{recordId:z,...J},W);return j4(Y,200,q),!0}if(G==="attachments"){let Z=B6("seal_approval_run_attachments_get"),q=await x6(Z,X,{recordId:z,...J},W);return j4(Y,200,q),!0}if(G==="cited-rules"){let Z=B6("seal_approval_run_cited_rules_get"),q=await x6(Z,X,{recordId:z,...J},W);return j4(Y,200,q),!0}if(G==="document-summary"){let Z=B6("seal_approval_run_document_summary_get"),q=await x6(Z,X,{recordId:z,...J},W);return j4(Y,200,q),!0}if(G==="result"){let Z=B6("seal_approval_run_result_get"),q=await x6(Z,X,{recordId:z,...J},W);return j4(Y,200,q),!0}}}if(U==="GET"&&Q==="/v1/approval-runs"){let K=m8($,I,J),z=M1(K),G=await P1(z),H=B6("seal_approval_runs_search"),W=await x6(H,G,{...J,limit:J.limit?Number(J.limit):void 0,offset:J.offset?Number(J.offset):void 0,includeBridge:J.includeBridge==="true"},z);return j4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/approval/rules"){let K=m8($,I,J),z=M1(K),G=await P1(z),H=B6("seal_approval_rules_list"),W=await x6(H,G,J,z);return j4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/simulation/batches"){let K=m8($,I,J),z=M1(K),G=await P1(z),H=B6("seal_simulation_batches_list"),W=await x6(H,G,J,z);return j4(Y,200,W),!0}if(U==="POST"&&Q==="/v1/simulation/create-batch"){let K=await ME($)Line truncated
|
||||
</html>`}var sy0=o(()=>{H3()});import{URL as yf1}from"node:url";async function u6($,Y,U,Q){let I=$.handler;return I(Y,U,{corp:Q})}async function ay0($,Y){if(Y.setHeader("Access-Control-Allow-Origin","*"),Y.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS, PATCH"),Y.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization, X-Seal-Corp, X-Seal-Home-Session"),$.method==="OPTIONS"){Y.writeHead(204),Y.end();return}let U=$.headers.host||"localhost",Q=$.headers["x-forwarded-proto"]||"http",I=new yf1($.url||"/",`${Q}://${U}`),J=I.pathname.replace(/\/+$/,"")||"/",K=($.method||"GET").toUpperCase();try{if(K==="GET"&&J==="/"){C4(Y,200,{name:"seal-use",version:Z1,description:"Seal tenant operations and approval automation HTTP API",docs:"/docs",openapi:"/openapi.json",health:"/health",endpoints:{cli:"POST /api/cli",tools:"GET /api/tools",toolInvoke:"POST /api/tool/:name",restV1:"GET/POST /v1/*"}});return}if(K==="GET"&&J==="/docs"){xf1(Y,200,ry0());return}if(K==="GET"&&J==="/openapi.json"){C4(Y,200,Ij());return}if(K==="GET"&&J==="/health"){C4(Y,200,{status:"ok",version:Z1,name:"seal-use",timestamp:N1()});return}if(K==="POST"&&(J==="/shutdown"||J==="/api/shutdown")){C4(Y,200,{success:!0,message:"Shutting down seal-use background daemon",pid:process.pid}),setTimeout(()=>{process.kill(process.pid,"SIGTERM")},50);return}if(K==="POST"&&J==="/api/cli"){let z=await Tj($),H=(typeof z?.command==="string"?z.command:"").trim();if(!H){Aj(Y,400,"Missing 'command' property in request body");return}let G=WV(H),W=G[0]==="seal-use"||G[0]==="seal-home"||G[0]?.endsWith("/seal-use")||G[0]?.endsWith("/seal-home")?G.slice(1):G,X=await XV(W),Z=void 0;try{if(X.stdout.trim().startsWith("{")||X.stdout.trim().startsWith("["))Z=JSON.parse(X.stdout)}catch{}C4(Y,X.isError?400:200,{success:!X.isError,stdout:X.stdout,stderr:X.stderr,exitCode:X.exitCode,data:Z});return}if(K==="POST"&&J.startsWith("/api/tool/")){let z=J.slice(10).trim(),H=T6(z);if(!H){Aj(Y,404,`Tool not found: '${z}'`);return}let G=await Tj($)||{},W=d8($,I,G),X=E1(W),Z=await _1(X),q={...G};delete q.corp;let V=await u6(H,Z,q,X);C4(Y,200,V);return}if(J.startsWith("/v1/")){if(await kf1($,Y,K,J,I))return}Aj(Y,404,`Cannot ${K} ${J}. Visit /docs for available endpoints.`)}catch(z){let H=z instanceof Error?z.message:String(z);Aj(Y,500,H)}}async function kf1($,Y,U,Q,I){let J=Object.fromEntries(I.searchParams.entries());if(U==="GET"&&Q==="/v1/corps"){let K=a8(),z=A4();return C4(Y,200,{count:K.length,mode:z.stateful?"stateful":"stateless",defaultCorpId:z.defaultCorpId,corps:K.map((H)=>({id:H.id,name:H.name,sourceType:H.source.type,sealUrl:H.seal?.url}))}),!0}if(U==="GET"&&Q==="/v1/whoami"){let K=d8($,I,J),z=E1(K),H=await _1(z),G=T6("seal_whoami"),W=await u6(G,H,{},z);return C4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/session"){let K=d8($,I,J),z=E1(K),H=await _1(z),G=T6("seal_session_get"),W=await u6(G,H,{},z);return C4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/approval-runs/summary"){let K=d8($,I,J),z=E1(K),H=await _1(z),G=T6("seal_approval_runs_summary"),W=await u6(G,H,J,z);return C4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/approval-runs/stats"){let K=d8($,I,J),z=E1(K),H=await _1(z),G=T6("seal_approval_runs_stats"),W=await u6(G,H,J,z);return C4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/approval-runs/pick"){let K=d8($,I,J),z=E1(K),H=await _1(z),G=T6("seal_approval_run_pick"),W=await u6(G,H,J,z);return C4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/approval-runs/url"){let K=d8($,I,J),z=E1(K),H=await _1(z),G=T6("seal_approval_run_url_get"),W=await u6(G,H,J,z);return C4(Y,200,W),!0}if(Q.startsWith("/v1/approval-runs/")){let K=Q.slice(18).split("/"),z=K[0],H=K[1];if(z&&!["summary","pick","stats","url","bridge"].includes(z)){let G=d8($,I,J),W=E1(G),X=await _1(W);if(!H){let Z=T6("seal_approval_run_get"),q=await u6(Z,X,{recordId:z,...J},W);return C4(Y,200,q),!0}if(H==="attachments"){let Z=T6("seal_approval_run_attachments_get"),q=await u6(Z,X,{recordId:z,...J},W);return C4(Y,200,q),!0}if(H==="cited-rules"){let Z=T6("seal_approval_run_cited_rules_get"),q=await u6(Z,X,{recordId:z,...J},W);return C4(Y,200,q),!0}if(H==="document-summary"){let Z=T6("seal_approval_run_document_summary_get"),q=await u6(Z,X,{recordId:z,...J},W);return C4(Y,200,q),!0}if(H==="result"){let Z=T6("seal_approval_run_result_get"),q=await u6(Z,X,{recordId:z,...J},W);return C4(Y,200,q),!0}}}if(U==="GET"&&Q==="/v1/approval-runs"){let K=d8($,I,J),z=E1(K),H=await _1(z),G=T6("seal_approval_runs_search"),W=await u6(G,H,{...J,limit:J.limit?Number(J.limit):void 0,offset:J.offset?Number(J.offset):void 0,includeBridge:J.includeBridge==="true"},z);return C4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/approval/rules"){let K=d8($,I,J),z=E1(K),H=await _1(z),G=T6("seal_approval_rules_list"),W=await u6(G,H,J,z);return C4(Y,200,W),!0}if(U==="GET"&&Q==="/v1/simulation/batches"){let K=d8($,I,J),z=E1(K),H=await _1(z),G=T6("seal_simulation_batches_list"),W=await u6(G,H,J,z);return C4(Y,200,W),!0}if(U==="POST"&&Q==="/v1/simulation/create-batch"){let K=await Tj($)Line truncated
|
||||
\uD83D\uDE80 seal-use HTTP Server (v${Z1}) started`),console.error(` URL: http://${U}:${Y}`),console.error(` Docs: http://${U}:${Y}/docs`),console.error(` OpenAPI: http://${U}:${Y}/openapi.json`),console.error(` CLI Exec: POST http://${U}:${Y}/api/cli`),console.error(` REST API: http://${U}:${Y}/v1/...
|
||||
`);I(Q)})})}var OE=8787,NE="127.0.0.1";var Fr=o(()=>{xy0();W3()});async function fy0($){let Y=l0($.options.port)??l0($.options.p),U=R($.options.host)??R($.options.h),Q=await DE({port:Y,host:U}),I=()=>{Q.close(()=>{process.exit(0)})};process.on("SIGINT",I),process.on("SIGTERM",I),await new Promise(()=>{})}var uy0=o(()=>{L4();Fr()});async function by0($,Y,U,Q){if($==="config"||$==="get"){await v0("seal_llm_config_get",Y,U,{},T0(Q.options));return}if($==="providers"||$==="list"){await v0("seal_llm_providers_list",Y,U,{},T0(Q.options));return}throw Error(`Unknown llm command: ${$??""}. Run 'seal-use help' for available commands.`)}var iy0=o(()=>{D4();$4()});async function cy0($,Y){if($==="config"||$==="json"){wr();return}let{startServer:U}=await py0().then(() => dy0);U()}function wr(){C0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var ny0=o(()=>{$4()});function my0($){let Y=FE();C0(Y,{...T0($.options),allowFull:!0})}var ly0=o(()=>{Vr();$4()});async function oy0($,Y,U,Q){if($==="available"){await v0("seal_permissions_available_list",Y,U,{},T0(Q.options));return}if($==="configs"||$==="list"){await v0("seal_permissions_configs_list",Y,U,{},T0(Q.options));return}throw Error(`Unknown permissions command: ${$??""}. Run 'seal-use help' for available commands.`)}var ry0=o(()=>{D4();$4()});import{readFileSync as sy0}from"node:fs";async function ty0($,Y,U,Q,I,J,K){if(!$||$==="get"){await v0("seal_preference_get",I,J,{},T0(K.options));return}if($==="decision"){if(Y==="update"||!Y){let z=R(K.options.input),G=z?JSON.parse(sy0(z,"utf8")):F6(K.json);if(!G||Object.keys(G).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await v0("seal_preference_decision_update",I,J,{...G,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let z=R(K.options.default)??R(K.options.level)??Q;if(z!=="medium"&&z!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await v0("seal_preference_thinking_depth_set",I,J,{defaultLevel:z,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}if(Y==="policies"){if(U==="list"||!U){await v0("seal_preference_thinking_depth_policies_list",I,J,{},T0(K.options));return}if(U==="upsert"){let z=R(K.options.input),G=z?JSON.parse(sy0(z,"utf8")):F6(K.json);if(!G||!G.id||!G.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await v0("seal_preference_thinking_depth_policies_upsert",I,J,{...G,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}if(U==="remove"||U==="delete"){let z=Q??R(K.options.id)??R(K.options.policyId);if(!z)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await v0("seal_preference_thinking_depth_policies_remove",I,J,{policyId:z,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}var ay0=o(()=>{D4();L4();$4()});async function ey0($={}){let Y=K$(),U=T4(),Q=r2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},m3());console.log(`[probe] corp=${Q.id} source=${Q.source.type}`);let I=await tz(Q);console.log("[probe] seal enterprise"),console.log(JSON.stringify(I,null,2));let J=await P1(Q),K=await pM(J,{documentLimit:20,stylePreferencesEndpoint:Q.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:K.rules.rules.length,hasPendingRuleDeletes:K.rules.hasPendingDeletes,documents:K.documents.articles.length,documentsTotal:K.documents.total,stylePreferences:K.stylePreferences.ok?"ok":`error: ${K.stylePreferences.error}`},null,2))}var $k0=o(()=>{a$();i6();aT();X4()});async function Yk0($,Y,U){let Q=Y??R(U.options.corp)??($&&$!=="--corp"?$:void 0);await ey0({corpId:Q})}var Uk0=o(()=>{$k0();L4()});import{readFileSync as ax1}from"node:fs";function Qk0($,Y){let U=R($.options.descriptionFile)??R($.options["description-file"]);if(U)return ax1(U,"utf8").trim();let Q=R($.options.description)??R($.options.desc);if(Q!==void 0)return Q;return typeof Y.description==="string"?Y.description:void 0}function WY($,Y){let U=R($.options.version);if(U!==void 0)return U;if(z0($.options.latest))return"latest";if(Y!==void 0&&!Y.startsWith("-"))return Y;return}async function Mr($,Y,U,Q,I){if(!U&&!($==="lint"||$==="linters"||$==="linter-list"||$==="map"))throw Error(`rules ${$??""} requires an authenticated enterprise. Run 'seal-use corps list' to select one.`);if($==="count"){let K=WY(I);await v0("seal_approval_rules_list",U,Q,{version:K,countOnly:!0},T0(I.options));return}if($==="list"){let K=WY(I);if(z0(I.options.count)){await v0("seal_approval_rules_list",U,Q,{version:K,countOn
Line truncated
|
||||
`).filter(Boolean),J=I.slice(-Y);return{logFile:U,lines:J,totalLines:I.length}}async function Qf1($){let Y=TE($),U=Dr($),Q=UV($);Gk0($.stateDir);let I=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):OE),J=$.host??(process.env.HOST?process.env.HOST:NE);BE(Y,`${process.pid}
|
||||
`,{mode:384}),BE(U,JSON.stringify({pid:process.pid,port:I,host:J,version:$.version,startedAt:A1()},null,2),{mode:384}),YG(Q,`service starting on http://${J}:${I} pid=${process.pid}`);let K=null;try{K=await DE({port:I,host:J,silent:!0}),YG(Q,`service listening pid=${process.pid}`)}catch(G){if(YG(Q,`service failed to bind port ${I}: ${G instanceof Error?G.message:String(G)}`),PE(Y)===process.pid)d9(Y,{force:!0}),d9(U,{force:!0});throw G}let z=()=>{if(K)K.close(),K=null;if(PE(Y)===process.pid)d9(Y,{force:!0}),d9(U,{force:!0});YG(Q,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,z(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function Jk0($){Gk0($.stateDir);let Y=sQ($);if(Y.running)return Y;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},Q=[...U.args??[],"service","run"];if($.port)Q.push("--port",String($.port));if($.host)Q.push("--host",String($.host));let I=ex1(U.command,Q,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});I.unref();let J=TE($);return BE(J,`${I.pid}
|
||||
`,{mode:384}),YG(UV($),`started pid=${I.pid}`),{started:!0,...sQ($)}}function Kk0($,Y={}){let U=TE($),Q=Dr($),I=PE(U);if(!I||!zk0(I,$.appRoot))return d9(U,{force:!0}),d9(Q,{force:!0}),Y.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(I,"SIGTERM"),d9(U,{force:!0}),d9(Q,{force:!0}),YG(UV($),`stop requested pid=${I}`),Y.quiet?void 0:{stopped:!0,pid:I}}function zk0($,Y){if(!If1($))return!1;try{let U=$f1("ps",["-p",String($),"-o","command="],{encoding:"utf8"}),Q=U.trim().split(/\s+/).filter(Boolean),I=Q.indexOf("service"),J=I!==-1&&Q[I+1]==="run",K=U.includes(Y)||Q.some((z)=>/(^|[\\/])(seal-use|seal-home)(\.exe)?$/.test(z));return J&&K}catch{return!1}}function If1($){try{return process.kill($,0),!0}catch{return!1}}function TE($){return Nr($.stateDir,"service.pid")}function Dr($){return Nr($.stateDir,"service.json")}function UV($){return Nr($.stateDir,"service.log")}function PE($){if(!AE($))return;let Y=Number(Or($,"utf8").trim());return Number.isInteger(Y)&&Y>0?Y:void 0}function Gk0($){Yf1($,{recursive:!0,mode:448})}function YG($,Y){BE($,`${A1()} ${Y}
|
||||
`,{flag:"a",mode:384})}var Ar=o(()=>{Fr()});import{homedir as Jf1}from"node:os";import{join as Kf1}from"node:path";async function Pr($,Y,U){let Q=U?l0(U.options.port)??l0(U.options.p):void 0,I=U?R(U.options.host)??R(U.options.h):void 0,J=U?l0(U.options.lines)??l0(U.options.n):void 0,K=await J7($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:Br,version:Z1,launcher:Y.launcher,port:Q,host:I},{maxLines:J});if(K!==void 0)C0(K)}var Br;var Tr=o(()=>{W3();Ar();$4();L4();Br=Kf1(Jf1(),".config","seal-use")});import{existsSync as zf1,readFileSync as Hk0}from"node:fs";async function Wk0($,Y,U,Q,I){if($==="batch-records"||$==="records"){let J=Y??R(I.options.batchId)??R(I.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await v0("seal_simulation_batch_records_get",U,Q,{batchId:J,query:R(I.options.query)},T0(I.options));return}if($==="create"||$==="run"){let J=R(I.options.mode)??R(I.options.sourceSystem)??R(I.options["source-system"])??"hosecloud",K=J==="material-pack"?"material_pack":J,z=R(I.options.schemaConfig)??R(I.options["schema-config"]),G=z?JSON.parse(Hk0(z,"utf8")):void 0,H=R(I.options.input),W=H?JSON.parse(Hk0(H,"utf8")):F6(I.json),X=R(I.options.packageId)??R(I.options["package-id"]),Z=x4(I.options.packageIds)??x4(I.options["package-ids"])??(X?[X]:void 0),q=x4(I.options.flowIds)??x4(I.options["flow-ids"])??x4(I.options.documentSn)??x4(I.options["document-sn"]),V=R(I.options.signKey)??R(I.options["sign-key"])??R(I.options.integration),w=z0(I.options.wait)===!0,M=z0(I.options.noWait)??z0(I.options["no-wait"])??(w?!1:!0),F=await C$("seal_simulation_batch_create",U,Q,{mode:K,sourceSystem:K,flowIds:q,documentSn:q,rejectNodeName:R(I.options.rejectNode)??R(I.options["reject-node"])??null,thinkingDepthOverride:R(I.options.thinkingDepth)??R(I.options["thinking-depth"]),skipInvoiceGeneration:z0(I.options.skipInvoiceGeneration)??z0(I.options["skip-invoice-generation"]),skipExpenseExtraction:z0(I.options.skipExpenseExtraction)??z0(I.options["skip-expense-extraction"]),disableAttachmentCache:z0(I.options.disableAttachmentCache)??z0(I.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:R(I.options.templateId)??R(I.options["template-id"]),schemaConfig:G,requestIds:x4(I.options.requestIds)??x4(I.options["request-ids"]),workflowTypeId:R(I.options.workflowTypeId)??R(I.options["workflow-type-id"]),flowStatusList:x4(I.options.flowStatusList)?.map(Number)??x4(I.options["flow-status-list"])?.map(Number),businessCodes:x4(I.options.businessCodes)??x4(I.options["business-codes"]),documentType:R(I.options.documentType)??R(I.options["document-type"]),startTime:l0(I.options.startTime)??l0(I.options["start-time"]),endTime:l0(I.options.endTime)??l0(I.options["end-time"]),status:x4(I.options.status),limit:l0(I.options.limit),force:z0(I.options.force),reuseWindow:R(I.options["reuse-window"])??R(I.options.reuseWindow),noWait:M,rawParams:W});if(w&&F&&typeof F==="object"&&"batchId"in F&&typeof F.batchId==="string"){await v0("seal_simulation_batch_wait",U,Q,{batchId:F.batchId,timeout:R(I.options.timeout),pollInterval:R(I.options.pollInterval)??R(I.options["poll-interval"])},T0(I.options));return}C0(F,T0(I.options));return}if($==="wait"){let J=Y??R(I.options.batchId)??R(I.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await v0("seal_simulation_batch_wait",U,Q,{batchId:J,timeout:R(I.options.timeout),pollInterval:R(I.options.pollInterval)??R(I.options["poll-interval"])},T0(I.options));return}if($==="status"){let J=Y??R(I.options.batchId)??R(I.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation status <batchId>");await v0("seal_simulation_batch_status",U,Q,{batchId:J},T0(I.options));return}if($==="clean"||$==="delete"){let J=Y??R(I.options.batchId)??R(I.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await v0("seal_simulation_batch_clean",U,Q,{batchId:J},T0(I.options));return}if($==="specifications"){let J=Y??R(I.options.integration)??R(I.options.signKey)??R(I.options["sign-key"]);await v0("seal_simulation_specifications_list",U,Q,{signKey:J},T0(I.options));return}if($==="approval-definitions"||$==="definitions"){await v0("seal_simulation_feishu_approval_definitions_list",U,Q,{},T0(I.options));return}if($==="list"){await v0("seal_simulation_batches_list",U,Q,{limit:l0(I.options.limit)},T0(I.options));return}if($==="get"){let J=Y??R(I.options.batchId)??R(I.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await v0("seal_simulation_batch_get",U,Q,{batchId:J},T0(I.options));return}if($==="templates"){await v0("seal_simulation_templates_get",U,Q,{},T0(I.options));return}if($==="integrations"){await v0("seal_simulation_integrations_get",U,Q,{},T0(I.options));return}if($==="package-upload"){let J=Y??R(I.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!zf1(J))throw Error(`FileLine truncated
|
||||
`);return}if($==="install"||$==="init"||$==="sync"){let Q=z0(U.options.local)||z0(U.options.workspace),I=R(U.options.dir)??R(U.options.target)??Y,J=I?I:Q?EE(process.cwd(),".agents","skills","seal-use"):rQ(),K=Vy0(J),z=!Q&&!I,G=z?$r():void 0,H=z?Qr():void 0;C0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let Q=rQ(),I=EE(process.cwd(),".agents","skills","seal-use"),J=Yr(),K=Ir();C0({global:{dir:Q,installed:Zk0(EE(Q,"SKILL.md"))},local:{dir:I,installed:Zk0(EE(I,"SKILL.md"))},antigravity:J,hosts:K});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}var Vk0=o(()=>{Kr();eq();L4();$4()});async function Lk0($,Y){if($==="config"){C0(await tz(Y));return}throw Error(`Unknown source command: ${$??""}. Run 'seal-use help' for available commands.`)}var Fk0=o(()=>{aT();$4()});function Er($){if(typeof $!=="string"||!$.trim())return"UNKNOWN";let Y=$.toUpperCase().trim();if(Y==="APPROVE"||Y==="PASS")return"APPROVE";if(Y==="REJECT"||Y==="DENIED")return"REJECT";if(Y==="MANUAL"||Y==="ASSISTED")return"MANUAL";if(Y==="ERROR"||Y==="FAILED")return"ERROR";return Y}async function wk0($){let{sourceCorp:Y,targetCorp:U,sourceClient:Q,targetClient:I,samples:J=10,dryRun:K=!1,pollIntervalMs:z=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(U.environment!=="test")throw new G4(`重放目标企业「${U.name}」(${U.id}) 的环境为「${U.environment}」,非测试环境!
|
||||
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${Y.id} <testCorpId>`);let X=await UU(I),q=(Array.isArray(X.features)?X.features:[]).find((m)=>m?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,w=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,M=J*w;if(V<M)throw new G4(`测试企业「${U.name}」AI 审批额度不足:当前剩余 ${V} 点,本次回归抽样 ${J} 笔需要约 ${M} 点。
|
||||
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${U.id}」充值 AI 审批额度,或降低抽样笔数 (--samples ${Math.max(1,Math.floor(V/w))})`);let F=await u4(Q,{limit:J,status:"completed"}),N=Array.isArray(F.records)?F.records:[];if(N.length===0){let m=await u4(Q,{limit:J});N=Array.isArray(m.records)?m.records:[]}if(N.length===0)throw new G4(`在母企业「${Y.name}」(${Y.id}) 中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(N=N.slice(0,J),K){let m=N.map((a)=>{let $0=a.sourceDocumentSN??a.id,g=a?.result?.decision??a.aiDecision??a?.decision,p=Er(g),Y0=a?.result?.summary??a.aiSummary;return{sn:$0,sourceRecordId:a.id,prodDecision:p,prodSummary:Y0,status:"DRY_RUN"}});return{ok:!0,verdict:"DRY_RUN",safeToPublish:!0,timestamp:A1(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:w,estimatedRequired:M},metrics:{sampleCount:m.length,successCount:m.length,failureCount:0,matchCount:m.length,flipCount:0,concordanceRate:1},flips:[],records:m}}let O=await Mp(I,U,$.webhookSelector),D=[];for(let m of N){let a=Date.now(),$0=m.sourceDocumentSN??m.id,g=Er(m?.result?.decision??m.aiDecision??m?.decision),p=m?.result?.summary??m.aiSummary;try{let Y0=await W4(Q,m.id),y=`${H}${$0}`,c=Fp(Y0,{snPrefix:H,docIdPrefix:H});await wp(O.incomingDocumentWebhook.url,O.secret,c,W,j6(U.seal));let e=null,V0=Date.now();while(Date.now()-V0<G){await new Promise((X0)=>setTimeout(X0,z));let t=await u4(I,{sourceDocumentSN:y,limit:1});if(t.records&&t.records.length>0){let X0=t.records[0];if(X0.status==="completed"||X0.status==="failed"){e=X0;break}}}if(!e){D.push({sn:$0,sourceRecordId:m.id,prodDecision:g,prodSummary:p,status:"FAILED",error:`测试租户单据审核超时 (${Math.round(G/1000)}s 未完成)`,durationMs:Date.now()-a});continue}let j0=Er(e?.result?.decision??e.aiDecision??e?.decision??(e.status==="completed"?"APPROVE":"ERROR")),A0=e?.result?.summary??e.aiSummary,R0=g===j0,r0=R0?"MATCHED":"FLIPPED",X1={sn:$0,sourceRecordId:m.id,prodDecision:g,prodSummary:p,testRecordId:e.id,testDecision:j0,testSummary:A0,status:r0,durationMs:Date.now()-a};if(!R0)X1.diff={from:g,to:j0,reasonDiff:A0&&p&&A0!==p?`生产: ${p.slice(0,60)}... -> 测试: ${A0.slice(0,60)}...`:void 0};D.push(X1)}catch(Y0){D.push({sn:$0,sourceRecordId:m.id,prodDecision:g,prodSummary:p,status:"FAILED",error:Y0 instanceof Error?Y0.message:String(Y0),durationMs:Date.now()-a})}}let P=D.filter((m)=>m.status==="MATCHED"||m.status==="FLIPPED"),T=D.filter((m)=>m.status==="MATCHED"),A=D.filter((m)=>m.status==="FLIPPED"),E=D.filter((m)=>m.status==="FAILED").length,C=T.length,i=A.length,x=C+i,h=x>0?C/x:0,b=i>0,n=b?"REGRESSIONS_DETECTED":"CLEAN",Q0=!b&&E===0,k;try{let m=await UU(I),$0=(Array.isArray(m.features)?m.features:[]).find((g)=>g?.code==="ai-approval");if(typeof $0?.balance==="number")k=$0.balance}catch{}return{ok:!b&&E===0,verdict:n,safeToPublish:Q0,timestamp:A1(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:w,estimatedRequired:M,balanceAfter:k},metrics:{sampleCount:D.length,successCount:P.length,failureCount:E,matchCount:C,flipCount:i,concordanceRate:Number(h.toFixed(4))},flips:A,records:D}}function Mk0($){let{sourceCorp:Y,targetCorp:U,verdict:Q,safeToPublish:I,metrics:J,quota:K,flips:z,records:G}=$,H=Q==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":Q==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",W=["",`\uD83E\uDDEA [Seal Use Test] 规则回归测试矩阵: 生产「${Y.name}」-> 测试靶场「${U.name}」`,` 判定: ${H} · 准许发布: ${I?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),` 样本总数: ${J.sampleCount} | 一致通过: ${J.matchCount} | 决策翻转: ${J.flipCount} | 异常失败: ${J.failureCount}`,` 一致率: ${(J.concordanceRate*100).toFixed(1)}% | 消耗预估: ${K.estimatedRequired} 点 (余量: ${K.balanceBefore}${K.balanceAfter!==void 0?` -> ${K.balanceAfter}`:""})`," "+"─".repeat(65)];if(z.length>0){W.push(` ⚠️ 决策翻转清单 (${z.length} 笔单据在新规则下结果改变):`);for(let X of z)if(W.push(` • 单据 [${X.sn}]: 原生产判定「${X.prodDecision}」 ➔ 测试新判定「${X.testDecision}」`),X.diff?.reasonDiff)W.push(` 理由差异: ${X.diff.reasonDiff}`);W.push(" "+"─".repeat(65)),W.push(" \uD83D\uDC49 建议: 请检查上述翻转单据是否符合预期修正。若为意外误杀,请调整测试环境规则后再次回归。")}else if(Q==="CLEAN")W.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100% 吻合,无任何意外误杀或漏判
Line truncated
|
||||
`)}var Ok0=o(()=>{_P();X4();Jq()});async function jr($,Y,U){let Q=($??Y??"regression").toLowerCase();if(Q==="regression"||Q==="regress"||Q==="matrix"){let I=R(U.options.corp)??(Y&&Y!==Q?Y:void 0),J=M1(I),K=J,z=J;if(J.environment==="test"){z=J;let O=R(U.options["prod-corp"])??R(U.options.prod)??J.prodCorpId;if(!O)throw new G4(`测试企业「${J.name}」(${J.id}) 未绑定生产母企业,无法拉取历史样本。
|
||||
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-use corps bind-test <prodCorpId> ${J.id}`);K=M1(O)}else{K=J;let O=R(U.options["test-corp"])??R(U.options.test)??J.testCorpId;if(!O)throw new G4(`生产企业「${J.name}」(${J.id}) 未绑定测试靶场企业。
|
||||
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${J.id} <testCorpId>`);z=M1(O)}let G=await P1(K),H=await P1(z),W=l0(U.options.samples)??l0(U.options.limit)??l0(U.options.n)??10,X=z0(U.options["dry-run"]),Z=z0(U.options["fail-on-flips"]),q=l0(U.options["poll-interval"])??2000,V=l0(U.options.timeout)??45000,w=R(U.options["sn-prefix"])??"REG_",M=R(U.options.webhook)??R(U.options.selector),F=await wk0({sourceCorp:K,targetCorp:z,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:w,failOnFlips:Z,webhookSelector:M});if(!(z0(U.options.quiet)||z0(U.options.silent)))console.error(Mk0(F));if(C0(F),Z&&!F.ok)throw new G4(`回归测试发现 ${F.metrics.flipCount} 笔单据决策翻转,已按 --fail-on-flips 策略非零终止。`,1);return}throw new G4(`未知的 test 子命令: "${Q}"。
|
||||
可用子命令: seal-use test regression [--corp <id>] [--samples <N>] [--dry-run]`,2,"seal-use test regression --help")}var Nk0=o(()=>{p8();D4();L4();$4();i6();Ok0()});function jE($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.includes("\\$bunfs\\"))return!0;let U=$.toLowerCase().replace(/\\/g,"/");return!U.endsWith("/bun")&&!U.endsWith("/bun.exe")&&!U.endsWith("/node")&&!U.endsWith("/node.exe")}var Dk0=o(()=>{eq()});import{existsSync as Gf1,mkdirSync as Hf1,readFileSync as Wf1,renameSync as Xf1,writeFileSync as Zf1}from"node:fs";import{homedir as qf1}from"node:os";import{dirname as Vf1,join as Lf1}from"node:path";import{spawn as Ff1}from"node:child_process";function Ak0(){let $=process.env[wf1]?.trim();if($)return $;return Of1}function Bk0($=Ak0()){if(!Gf1($))return null;try{let Y=Wf1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&typeof U.latestVersion==="string"&&typeof U.checkedAt==="string")return{...U,checkedAt:T8(U.checkedAt),...typeof U.publishedAt==="string"?{publishedAt:T8(U.publishedAt)}:{}};return null}catch{return null}}function QV($,Y=Ak0()){try{let U=Vf1(Y);Hf1(U,{recursive:!0,mode:448});let Q={checkedAt:$.checkedAt?T8($.checkedAt):A1(),latestVersion:$.latestVersion,publishedAt:$.publishedAt?T8($.publishedAt):void 0,releaseUrl:$.releaseUrl},I=`${Y}.tmp.${Date.now()}.${Math.random().toString(36).slice(2,8)}`;Zf1(I,JSON.stringify(Q,null,2),{mode:384}),Xf1(I,Y)}catch{}}function Pk0($,Y=Mf1){if(!$||!$.checkedAt)return!0;let U=new Date($.checkedAt).getTime();if(Number.isNaN(U))return!0;return Date.now()-U>Y}function Tk0($){if(process.env.SEAL_DISABLE_BG_UPDATE==="1"||!1||process.env.CI)return!1;if(!$||!$.command)return!1;try{let Y=$.command,U=[...$.args??[],"update","check","--bg-save"];return Ff1(Y,U,{detached:!0,stdio:"ignore",env:{...process.env,SEAL_DISABLE_BG_UPDATE:"1"}}).unref(),!0}catch{return!1}}var wf1="SEAL_USE_UPDATE_CACHE_FILE",Mf1=86400000,Of1;var Cr=o(()=>{Of1=Lf1(qf1(),".config","seal-use","update-cache.json")});import{chmodSync as Nf1,mkdirSync as Df1,readdirSync as Af1,realpathSync as Ek0,renameSync as Rr,rmSync as Bf1,unlinkSync as vk0,writeFileSync as jk0}from"node:fs";import{basename as Pf1,dirname as Tf1,isAbsolute as Ef1,join as _E,relative as jf1}from"node:path";import{spawn as Cf1,spawnSync as K7}from"node:child_process";async function hk0($,Y={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Br,version:Z1,launcher:$.launcher},Q=Y.repo||process.env[Rf1]?.trim()||process.env[_f1]?.trim()||Sk0,I=Y.targetVersion?.trim(),J=I&&I.toLowerCase()!=="latest"?I:void 0;if(J){let D=J.replace(/^v/,""),P=xk0(D,Z1);if(P<0)if(!Pg&&Y.force);else{C0({updated:!1,currentVersion:Z1,targetVersion:D,mode:jE()?"binary":"source",message:!Pg?`Cannot downgrade seal-use from dev build v${Z1} to release v${D}. Use --force to overwrite.`:`Cannot downgrade seal-use from v${Z1} to older version v${D}. Updates must be forward-only.`});return}if(P===0&&!Y.force){C0({updated:!1,currentVersion:Z1,targetVersion:D,mode:jE()?"binary":"source",message:`seal-use is already at version v${Z1}. Use --force to reinstall.`});return}}if(Y.changelogOnly){let D=await RE(Q,Y.limit??10);C0({currentVersion:Z1,totalQueried:D.length,releases:D.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl,isCurrent:P.version===Z1,isNewer:i5(P.version,Z1)}))});return}if(!jE()){if(Y.checkOnly){let P=await RE(Q,30),T=P[0],A=T?.version??Z1,E=P.find((x)=>x.version===Z1),C=i5(A,Z1),i=P.filter((x)=>i5(x.version,Z1));if(T?.version)QV({latestVersion:T.version,publishedAt:T.publishedAt,releaseUrl:T.htmlUrl});if(Y.bgSave)return;C0({updated:!1,updateAvailable:C,currentVersion:Z1,currentVersionPublishedAt:E?.publishedAt,latestVersion:A,latestVersionPublishedAt:T?.publishedAt,behindCount:i.length,pendingReleases:i.map((x)=>({version:x.version,tagName:x.tagName,publishedAt:x.publishedAt,author:x.author,releaseNotes:x.notes,releaseUrl:x.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"当前运行的是开发版。正式用户请安装正式版后使用 seal-use update。"});return}let D=sQ(U).running;if(D)await J7("stop",U);try{_k0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(P){console.error(`⚠️ 开发版更新同步失败,继续刷新本地依赖: ${P instanceof Error?P.message:String(P)}`)}if(_k0("bun",["install"],{cwd:$.appRoot}),D)await J7("start",U);C0({updated:!0,serviceRestarted:D,version:Z1,mode:"source"});return}if(yf1())try{await kf1($,Y,U,Q,J);return}catch(D){console.error(`⚠️ Homebrew 自动更新失败,回退至原生二进制更新: ${D instanceof Error?D.message:String(D)}`)}let K=Sf1(),z=hf1(),G=await RE(Q,30),H=J?G.find((D)=>D.version===J||D.tagName===J||D.tagName===`v${J}`)??await vE(Q,J):G[0]??await vE(Q);if(!H){C0({updated:!1,currentVersion:Z1,mode:"binary",message:`Failed to query releases from repository '${Q}'`});return}let W=H.version,X=G.find((D)=>D.version=
Line truncated
|
||||
`)}catch{}}async function uf1($,Y,U,Q){let I=_r(),J=[],K=U?U.startsWith("v")?U:`v${U}`:void 0,z=Q||$.split("/").pop()||"";if(I!=="github"){if(K&&z)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${z}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${z}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(I!=="gitea")if(K&&z){let w=`https://github.com/${Sk0}/releases/download/${K}/${z}`;if(!process.env.CI)J.push(`https://ghfast.top/${w}`,`https://gh.ddlc.top/${w}`);J.push(w)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let G=Array.from(new Set(J)),H,W=6000,X=6000,Z=307200,q=1e4,V=180000;for(let w=0;w<G.length;w++){let M=G[w],F=new AbortController,N="",O=(A)=>{N=A;try{F.abort()}catch{}},D=setTimeout(()=>{O("Connection timed out (no response headers within 6s)")},W),P,T;try{CE(`==> [${w+1}/${G.length}] Downloading via: ${M}`);let A=await fetch(M,{signal:F.signal});if(D)clearTimeout(D),D=void 0;if(!A.ok)throw Error(`HTTP ${A.status} ${A.statusText}`);P=setTimeout(()=>{O("Overall download time exceeded 3 minutes")},V);let E=Number(A.headers.get("content-length"))||0,C=A.body?.getReader();if(!C){let n=Buffer.from(await A.arrayBuffer());if(n.length<1000)throw Error(`Downloaded content is suspiciously small (${n.length} bytes)`);jk0(Y,n),CE(`✓ Download succeeded (${(n.length/1024/1024).toFixed(1)} MB)`);return}let i=[],x=0,h=0;T=setTimeout(()=>{if(x<Z){let n=(x/1024).toFixed(1);O(`Initial transfer too slow (${n} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let n=C.read(),Q0,k=new Promise((g,p)=>{Q0=setTimeout(()=>{p(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),m;try{m=await Promise.race([n,k])}finally{if(Q0)clearTimeout(Q0)}let{done:a,value:$0}=m;if(a)break;if($0){if(i.push($0),x+=$0.length,T&&x>=Z)clearTimeout(T),T=void 0;let g=Date.now();if(g-h>200){h=g;let p=E?Math.round(x/E*100):0,Y0=(x/1048576).toFixed(1),y=E?(E/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${p}% (${Y0} / ${y} MB)...`)}catch{}}}}try{process.stderr.write(`
|
||||
`)}catch{}let b=Buffer.concat(i);if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);jk0(Y,b),CE(`✓ Download completed successfully (${(b.length/1024/1024).toFixed(1)} MB)`);return}catch(A){if(D)clearTimeout(D);if(T)clearTimeout(T);if(P)clearTimeout(P);let E=N||(A instanceof Error?A.message:String(A));H=Error(E),CE(`
|
||||
↳ Mirror failed: ${H.message}`)}finally{if(D)clearTimeout(D);if(T)clearTimeout(T);if(P)clearTimeout(P)}}throw Error(`Failed to download asset from all mirrors: ${H?.message}`)}function yk0($){let Y;try{Y=Af1($,{withFileTypes:!0})}catch{return[]}let U=[];for(let Q of Y){let I=_E($,Q.name);if(Q.isDirectory())U.push(...yk0(I));else if(Q.isFile())U.push(I)}return U}function kk0($,Y,U){let Q=Y==="windows"?"seal-use.exe":"seal-use",I=yk0($);return I.find((J)=>Pf1(J)===Q)??I[0]??U}function bf1($,Y,U){let Q=K7("tar",["-xzf",$,"-C",Y],{stdio:"pipe"});if(Q.status!==0)throw Error(`Failed to extract tar archive: ${Q.stderr.toString()}`);return vk0($),kk0(Y,U,$)}function if1($,Y,U){let Q=K7("unzip",["-q","-o",$,"-d",Y],{stdio:"pipe"});if(Q.status!==0)throw Error(`Failed to extract zip archive: ${Q.stderr.toString()}`);return vk0($),kk0(Y,U,$)}function xk0($,Y){let U=$.replace(/^v/,"").split(".").map((I)=>Number.parseInt(I,10)||0),Q=Y.replace(/^v/,"").split(".").map((I)=>Number.parseInt(I,10)||0);for(let I=0;I<Math.max(U.length,Q.length);I++){let J=U[I]??0,K=Q[I]??0;if(J>K)return 1;if(J<K)return-1}return 0}function i5($,Y){return xk0($,Y)>0}function _k0($,Y,U={}){let Q=K7($,Y,{cwd:U.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(Q.stdout)console.error(Q.stdout.trimEnd());if(Q.stderr)console.error(Q.stderr.trimEnd());if(Q.status!==0)throw Error(`${$} ${Y.join(" ")} failed with status ${Q.status}`)}var Sk0="yunyingk/seal-use",IV="yunyingk/seal-home",Rf1="SEAL_USE_GITHUB_REPO",_f1="SEAL_HOME_GITHUB_REPO";var fk0=o(()=>{Dk0();eq();Cr();W3();Ar();$4();Tr()});async function uk0($,Y,U,Q,I){if($==="create"){let J=R(I.options.name)??Y,K=R(I.options.phone);if(!J||!K)throw Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");let z=R(I.options.dept)??R(I.options.departmentId);await v0("seal_user_create",U,Q,{name:J,phone:K,departmentIds:z?[z]:void 0},T0(I.options));return}if($==="reset-password"){let J=Y??R(I.options.userId);if(!J)throw Error("Usage: seal-use users reset-password <userId>");await v0("seal_user_reset_password",U,Q,{userId:J},T0(I.options));return}if($==="search"||$==="list"){let J=Y??R(I.options.keyword)??R(I.options.query)??"";await v0("seal_user_search",U,Q,{keyword:J},T0(I.options));return}if($==="get"){let J=Y??R(I.options.userId);if(!J)throw Error("Usage: seal-use users get <userId>");await v0("seal_user_get",U,Q,{userId:J},T0(I.options));return}if($==="delete"){let J=Y??R(I.options.userId);if(!J)throw Error("Usage: seal-use users delete <userId>");await v0("seal_user_delete",U,Q,{userId:J},T0(I.options));return}if($==="activate"){let J=Y??R(I.options.userId);if(!J)throw Error("Usage: seal-use users activate <userId>");await v0("seal_user_activate",U,Q,{userId:J},T0(I.options));return}if($==="delegation"||$==="impersonate"){let J=Y??R(I.options.userId)??R(I.options.phone);if(!J)throw Error("Usage: seal-use users delegation <userIdOrPhone> [--note <note>]");let K=R(I.options.note);await v0("seal_user_delegation_create",U,Q,{userIdOrPhone:J,note:K},T0(I.options));return}throw Error(`Unknown users command: ${$??""}. Run 'seal-use help' for available commands.`)}var bk0=o(()=>{D4();L4();$4()});import{dirname as vr,join as cf1}from"node:path";import{fileURLToPath as nf1}from"node:url";function lf1($){if(!$.length)return!1;let Y=$[0]?.toLowerCase(),U=$[1]?.toLowerCase();if(Y&&mf1.has(Y))return!0;if((Y==="service"||Y==="daemon")&&U==="run")return!0;return!1}function YV($,Y={}){if(lf1($))return nk0($,Y);let U=ck0.then(()=>nk0($,Y));return ck0=U.then(()=>{return},()=>{return}),U}async function nk0($,Y){let U=[],Q=[],I=console.log,J=console.error,K={appRoot:Y.appRoot??ik0,entryFile:Y.entryFile??cf1(Y.appRoot??ik0,"src","cli.ts"),launcher:Y.launcher};console.log=(...z)=>{U.push(Po(z))},console.error=(...z)=>{Q.push(Po(z))};try{return await of1($,K),{stdout:iq(U),stderr:iq(Q),isError:!1,exitCode:0}}catch(z){let G=t8(z instanceof Error?z.message:String(z)),H=Lz(z);if(Q.push(G),H.nextAction&&!G.includes("Next action:"))Q.push(`\uD83D\uDC49 Next action: ${H.nextAction}`);return{stdout:iq(U),stderr:iq(Q),isError:!0,exitCode:H.exitCode}}finally{console.log=I,console.error=J}}async function of1($,Y){let U=bq($),[Q,I,J]=U.command,K=Q?.toLowerCase(),z=K?df1.has(K):!1,G=z?"update":K;if(G==="version"||G==="v"||!G&&(Boolean(U.options.version)||Boolean(U.options.v)||Boolean(U.options.V))){let Z=Bk0(),q=Z?.latestVersion?i5(Z.latestVersion,$U.version):!1,V={...$U,...Z?.latestVersion?{latestVersion:Z.latestVersion,updateAvailable:q,lastCheckedAt:Z.checkedAt}:{}};if(q&&Z?.latestVersion)console.error(`\uD83D\uDCA1 发现新版本可用: v${$U.version} -> v${Z.latestVersion}`),console.error(`\uD83D\uDC49 Next action: seal-use update
|
||||
`);if(C0(V),Pk0(Z))Tk0(Y.launcher);return}let H=rv0(U);if(H.isHelp){ev0(H.target);return}if(!G||!pf1.has(G))throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`);if(G==="webhook"&&(I==="resource-pack"||I==="pack"||I==="material-pack")&&J==="preview"){let Z=U.command[3]??R(U.options.file)??R(U.options.input);if(!Z)throw Error("Usage: seal-use webhook resource-pack preview <资源包.zip>");await YS0(Z,sz(U.options));return}if(G==="openapi"){my0(U);return}if(G==="mcp-config"){wr();return}if(G==="skill"){qk0(I,J,U);return}if(G==="mcp"||G==="server"){await cy0(I,U);return}if(G==="probe"){await Yk0(I,J,U);return}if(G==="doctor"){await Ey0(I,J,U);return}if(G==="test"){await jr(I,J,U);return}if(G==="config"){Hg0(I,J,U);return}if(G==="service"){await Pr(I,Y,U);return}if(G==="stop"){await Pr("stop",Y,U);return}if(G==="http"||G==="serve"){await fy0(U);return}if(z||G==="changelog"){if(z&&Q!=="update")console.error(`⚠️ Notice: '${Q}' is an alias for 'seal-use update'. Please use 'seal-use update' instead.`);let Z=I?.toLowerCase(),q=G==="changelog"||Z==="changelog"||Z==="log"||Z==="history"||z0(U.options.changelog)===!0,V=Z==="check"||z0(U.options.check)===!0||z0(U.options["check-only"])===!0,w=z0(U.options["bg-save"])===!0||z0(U.options["silent-save"])===!0,M=R(U.options.version)??R(U.options.tag)??(!q&&!V&&!w&&I&&!I.startsWith("-")?I:void 0);await hk0(Y,{checkOnly:V||w,changelogOnly:q,limit:l0(U.options.limit),force:z0(U.options.force),targetVersion:M,repo:R(U.options.repo),bgSave:w});return}if(G==="corps"||G==="corp"){if(I==="regression"||I==="test-regression"){await jr("regression",J,U);return}await Qg0(I,J,U);return}if(G==="rules"&&I==="lint"&&(("file"in U.options)||("f"in U.options))){let Z;try{Z=M1(R(U.options.corp))}catch{Z={id:"local",name:"Local Workspace",source:{type:"native"}}}await Mr(I,J,null,Z,U);return}if(G==="auth"&&(I==="extract-keys"||I==="extract-key"||I==="extract-hose-keys"||I==="hose-extract-keys")){await ro(J,U);return}if(G==="auth"&&(I==="link"||I==="seal-link")&&(("from-link"in U.options)||J==="from-link")){await VE(I,null,U);return}let W=M1(R(U.options.corp));if(G==="source"){await Lk0(I,W);return}if(G==="auth"){await VE(I,W,U);return}let X=await P1(W);if(G==="users"){await uk0(I,J,X,W,U);return}if(G==="contacts"){await Xg0(I,J,X,W,U);return}if(G==="data"){await qg0(I,X,W,U);return}if(G==="llm"){await by0(I,X,W,U);return}if(G==="permissions"){await oy0(I,X,W,U);return}if(G==="billing"){await zg0(I,X,W,U);return}if(G==="webhook"||G==="webhooks"){await rT(I,J,X,W,U);return}if(G==="context"){await Lg0(X,W,U);return}if(G==="documents"){await Ry0(I,J,X,W,U);return}if(G==="rules"){await Mr(I,J,X,W,U);return}if(G==="approval-runs"){await US0(I,J,X,W,U);return}if(G==="analytics"){await IS0(I,J,X,W,U);return}if(G==="simulation"){await Wk0(I,J,X,W,U);return}if(G==="deploy"){await wg0(I,J,U.command[3],X,W,U);return}if(G==="preference"||G==="preferences"){await ty0(I,J,U.command[3],U.command[4],X,W,U);return}throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`)}var ik0,df1,pf1,mf1,ck0;var Lr=o(()=>{i6();W3();QS0();JS0();so();Gg0();Wg0();Zg0();Vg0();Fg0();lo();Mg0();jy0();_y0();uy0();iy0();ny0();ly0();ry0();ay0();Uk0();Ik0();Tr();Xk0();Vk0();Fk0();Nk0();fk0();Cr();bk0();Eo();p8();D4();L4();Bo();$4();ik0=vr(vr(vr(nf1(import.meta.url)))),df1=new Set(["update","upgrade","up","self-update","selfupdate"]),pf1=new Set(["config","service","stop","http","serve","update","corps","corp","source","auth","users","contacts","data","llm","permissions","billing","webhook","webhooks","context","documents","rules","approval-runs","analytics","simulation","deploy","preference","preferences","mcp","server","mcp-config","skill","openapi","probe","doctor","changelog","test"]),mf1=new Set(["http","server","web","mcp"]);ck0=Promise.resolve()});function af1($){let{command:Y}=bq($),U=(Y[0]??"").toLowerCase();return{area:rf1[U]??U,actionTokens:Y.slice(1).map((Q)=>Q.toLowerCase())}}function dk0($){let Y,U;try{({area:Y,actionTokens:U}=af1($))}catch{return!1}if(U.length===0&&tf1.has(Y))return!0;let Q=sf1[Y];if(!Q)return!1;return Q.some((I)=>{let J=I.split(" ").filter(Boolean);if(J.length===0)return U.length===0;if(J.length>U.length)return!1;return J.every((K,z)=>K===U[z])})}var rf1,sf1,tf1;var pk0=o(()=>{L4();rf1={corp:"corps",webhooks:"webhook",preferences:"preference"},sf1={corps:["list","search","get","current"],rules:["count","list","versions","version","diff","get","search","lint","linters","pull","map"],documents:["list","get","search"],webhook:["ready","status","list","get","resource-pack export","resource-pack preview"],"approval-runs":["summary","stats","count","export","flow","list","search","pick","bridge","get","cited-rules","document-summary","attachments","result","link","url"],simulation:["batch-records","status","wait","specifications","approval-definitions","list","get","templates","integrations"],deploy:["hosecloud requi
Line truncated
|
||||
`);I(Q)})})}var jj=8787,Ej="127.0.0.1";var vr=o(()=>{ty0();H3()});import{spawn as uf1,execFileSync as bf1}from"node:child_process";import{existsSync as Rj,mkdirSync as if1,readFileSync as hr,rmSync as n9,writeFileSync as _j}from"node:fs";import{join as Sr}from"node:path";async function I7($,Y,U={}){switch($){case"run":await nf1(Y);return;case"start":return ey0(Y);case"stop":case"kill":case"down":case"shutdown":return $k0(Y,U);case"restart":return $k0(Y,{quiet:!0}),ey0(Y);case"logs":case"log":return cf1(Y,U.maxLines);case"status":case void 0:return aQ(Y);default:throw Error("Usage: seal-use service <start|stop|restart|status|logs>")}}function aQ($){let Y=hj($),U=gr($),Q=vj(Y),I=Q?Yk0(Q,$.appRoot):!1;if(!I){if(Q)n9(Y,{force:!0});if(Rj(U))n9(U,{force:!0})}let J;if(I&&Rj(U))try{J=JSON.parse(hr(U,"utf8"))}catch{}let K=$.port??J?.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):jj),z=$.host??J?.host??(process.env.HOST?process.env.HOST:Ej),H=$.version??J?.version;return{running:I,pid:I?Q:void 0,version:H,port:K,host:z,url:I?`http://${z}:${K}`:void 0,appRoot:$.appRoot,stateDir:$.stateDir,pidFile:Y,logFile:ZV($)}}function cf1($,Y=50){let U=ZV($);if(!Rj(U))return{logFile:U,lines:[],totalLines:0};let I=hr(U,"utf8").split(`
|
||||
`).filter(Boolean),J=I.slice(-Y);return{logFile:U,lines:J,totalLines:I.length}}async function nf1($){let Y=hj($),U=gr($),Q=ZV($);Uk0($.stateDir);let I=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):jj),J=$.host??(process.env.HOST?process.env.HOST:Ej);_j(Y,`${process.pid}
|
||||
`,{mode:384}),_j(U,JSON.stringify({pid:process.pid,port:I,host:J,version:$.version,startedAt:N1()},null,2),{mode:384}),QH(Q,`service starting on http://${J}:${I} pid=${process.pid}`);let K=null;try{K=await Cj({port:I,host:J,silent:!0}),QH(Q,`service listening pid=${process.pid}`)}catch(H){if(QH(Q,`service failed to bind port ${I}: ${H instanceof Error?H.message:String(H)}`),vj(Y)===process.pid)n9(Y,{force:!0}),n9(U,{force:!0});throw H}let z=()=>{if(K)K.close(),K=null;if(vj(Y)===process.pid)n9(Y,{force:!0}),n9(U,{force:!0});QH(Q,`stopped pid=${process.pid}`)};await new Promise((H)=>{let G=!1,W=()=>{if(G)return;G=!0,z(),process.off("SIGTERM",W),process.off("SIGINT",W),H()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function ey0($){Uk0($.stateDir);let Y=aQ($);if(Y.running)return Y;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},Q=[...U.args??[],"service","run"];if($.port)Q.push("--port",String($.port));if($.host)Q.push("--host",String($.host));let I=uf1(U.command,Q,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});I.unref();let J=hj($);return _j(J,`${I.pid}
|
||||
`,{mode:384}),QH(ZV($),`started pid=${I.pid}`),{started:!0,...aQ($)}}function $k0($,Y={}){let U=hj($),Q=gr($),I=vj(U);if(!I||!Yk0(I,$.appRoot))return n9(U,{force:!0}),n9(Q,{force:!0}),Y.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(I,"SIGTERM"),n9(U,{force:!0}),n9(Q,{force:!0}),QH(ZV($),`stop requested pid=${I}`),Y.quiet?void 0:{stopped:!0,pid:I}}function Yk0($,Y){if(!pf1($))return!1;try{let U=bf1("ps",["-p",String($),"-o","command="],{encoding:"utf8"}),Q=U.trim().split(/\s+/).filter(Boolean),I=Q.indexOf("service"),J=I!==-1&&Q[I+1]==="run",K=U.includes(Y)||Q.some((z)=>/(^|[\\/])(seal-use|seal-home)(\.exe)?$/.test(z));return J&&K}catch{return!1}}function pf1($){try{return process.kill($,0),!0}catch{return!1}}function hj($){return Sr($.stateDir,"service.pid")}function gr($){return Sr($.stateDir,"service.json")}function ZV($){return Sr($.stateDir,"service.log")}function vj($){if(!Rj($))return;let Y=Number(hr($,"utf8").trim());return Number.isInteger(Y)&&Y>0?Y:void 0}function Uk0($){if1($,{recursive:!0,mode:448})}function QH($,Y){_j($,`${N1()} ${Y}
|
||||
`,{flag:"a",mode:384})}var yr=o(()=>{vr()});var kr={};M1(kr,{handleServiceCommand:()=>lf1,STATE_DIR:()=>Sj});import{homedir as df1}from"node:os";import{join as mf1}from"node:path";async function lf1($,Y,U){let Q=U?l0(U.options.port)??l0(U.options.p):void 0,I=U?R(U.options.host)??R(U.options.h):void 0,J=U?l0(U.options.lines)??l0(U.options.n):void 0,K=await I7($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:Sj,version:Z1,launcher:Y.launcher,port:Q,host:I},{maxLines:J});if(K!==void 0)C0(K)}var Sj;var gj=o(()=>{H3();yr();t1();L4();Sj=mf1(df1(),".config","seal-use")});var Qk0={};M1(Qk0,{handleHttpCommand:()=>of1});async function of1($){let Y=l0($.options.port)??l0($.options.p),U=R($.options.host)??R($.options.h),Q=await Cj({port:Y,host:U}),I=()=>{Q.close(()=>{process.exit(0)})};process.on("SIGINT",I),process.on("SIGTERM",I),await new Promise(()=>{})}var Ik0=o(()=>{L4();vr()});function yj($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.includes("\\$bunfs\\"))return!0;let U=$.toLowerCase().replace(/\\/g,"/");return!U.endsWith("/bun")&&!U.endsWith("/bun.exe")&&!U.endsWith("/node")&&!U.endsWith("/node.exe")}var Jk0=o(()=>{tq()});var Mk0={};M1(Mk0,{matchAssetForPlatform:()=>Lk0,isNewerVersion:()=>L$,isHomebrewInstall:()=>qk0,handleUpdateCommand:()=>Ku1,getMirrorMode:()=>bj,compareSemVer:()=>PM});import{chmodSync as rf1,mkdirSync as sf1,readdirSync as af1,realpathSync as Kk0,renameSync as xr,rmSync as tf1,unlinkSync as Xk0,writeFileSync as zk0}from"node:fs";import{basename as ef1,dirname as $u1,isAbsolute as Yu1,join as fj,relative as Uu1}from"node:path";import{spawn as Qu1,spawnSync as J7}from"node:child_process";async function Ku1($,Y={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Sj,version:Z1,launcher:$.launcher},Q=Y.repo||process.env[Iu1]?.trim()||process.env[Ju1]?.trim()||Zk0,I=Y.targetVersion?.trim(),J=I&&I.toLowerCase()!=="latest"?I:void 0;if(J){let N=J.replace(/^v/,""),B=PM(N,Z1);if(B<0)if(!Xg&&Y.force);else{C0({updated:!1,currentVersion:Z1,targetVersion:N,mode:yj()?"binary":"source",message:!Xg?`Cannot downgrade seal-use from dev build v${Z1} to release v${N}. Use --force to overwrite.`:`Cannot downgrade seal-use from v${Z1} to older version v${N}. Updates must be forward-only.`});return}if(B===0&&!Y.force){C0({updated:!1,currentVersion:Z1,targetVersion:N,mode:yj()?"binary":"source",message:`seal-use is already at version v${Z1}. Use --force to reinstall.`});return}}if(Y.changelogOnly){let N=await xj(Q,Y.limit??10);C0({currentVersion:Z1,totalQueried:N.length,releases:N.map((B)=>({version:B.version,tagName:B.tagName,publishedAt:B.publishedAt,author:B.author,releaseNotes:B.notes,releaseUrl:B.htmlUrl,isCurrent:B.version===Z1,isNewer:L$(B.version,Z1)}))});return}if(!yj()){if(Y.checkOnly){let B=await xj(Q,30),A=B[0],P=A?.version??Z1,j=B.find((x)=>x.version===Z1),C=L$(P,Z1),u=B.filter((x)=>L$(x.version,Z1));if(A?.version)yG({latestVersion:A.version,publishedAt:A.publishedAt,releaseUrl:A.htmlUrl});if(Y.bgSave)return;C0({updated:!1,updateAvailable:C,currentVersion:Z1,currentVersionPublishedAt:j?.publishedAt,latestVersion:P,latestVersionPublishedAt:A?.publishedAt,behindCount:u.length,pendingReleases:u.map((x)=>({version:x.version,tagName:x.tagName,publishedAt:x.publishedAt,author:x.author,releaseNotes:x.notes,releaseUrl:x.htmlUrl})),releaseNotes:A?.notes??"",releaseUrl:A?.htmlUrl??"",mode:"source",message:"当前运行的是开发版。正式用户请安装正式版后使用 seal-use update。"});return}let N=aQ(U).running;if(N)await I7("stop",U);try{Wk0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`⚠️ 开发版更新同步失败,继续刷新本地依赖: ${B instanceof Error?B.message:String(B)}`)}if(Wk0("bun",["install"],{cwd:$.appRoot}),N)await I7("start",U);C0({updated:!0,serviceRestarted:N,version:Z1,mode:"source"});return}if(qk0())try{await Xu1(Y,U,Q,J);return}catch(N){console.error(`⚠️ Homebrew 自动更新失败,回退至原生二进制更新: ${N instanceof Error?N.message:String(N)}`)}let K=Hu1(),z=Gu1(),H=await xj(Q,30),G=J?H.find((N)=>N.version===J||N.tagName===J||N.tagName===`v${J}`)??await uj(Q,J):H[0]??await uj(Q);if(!G){C0({updated:!1,currentVersion:Z1,mode:"binary",message:`Failed to query releases from repository '${Q}'`});return}let W=G.version,X=H.find((N)=>N.version===Z1),Z=L$(W,Z1),q=Z||Boolean(Y.force),V=H.filter((N)=>L$(N.version,Z1));if(G?.version)yG({latestVersion:G.version,publishedAt:G.publishedAt,releaseUrl:G.htmlUrl});if(Y.bgSave)return;if(J&&!Y.checkOnly){C0({updated:!1,currentVersion:Z1,targetVersion:J,latestVersion:W,mode:"homebrew",message:"Homebrew-managed installations follow the formula version and do not support selecting a historical release. Use Homebrew directly for version pinning."});return}if(Y.checkOnly){C0({updated:!1,updateAvailable:Z,currentVersion:Z1,currentVersionPublishedAt:X?.publishedAt,latestVersion:W,latestVersionPublishedAt:G.publishedAt,behindCount:V.length,pendingReleases:V.map((N)=>({versio
Line truncated
|
||||
`)}catch{}}async function qu1($,Y,U,Q){let I=bj(),J=[],K=U?U.startsWith("v")?U:`v${U}`:void 0,z=Q||$.split("/").pop()||"";if(I!=="github"){if(K&&z)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${z}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${z}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(I!=="gitea")if(K&&z){let w=`https://github.com/${Zk0}/releases/download/${K}/${z}`;if(!process.env.CI)J.push(`https://ghfast.top/${w}`,`https://gh.ddlc.top/${w}`);J.push(w)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let H=Array.from(new Set(J)),G,W=6000,X=6000,Z=307200,q=1e4,V=180000;for(let w=0;w<H.length;w++){let M=H[w],F=new AbortController,D="",O=(P)=>{D=P;try{F.abort()}catch{}},N=setTimeout(()=>{O("Connection timed out (no response headers within 6s)")},W),B,A;try{kj(`==> [${w+1}/${H.length}] Downloading via: ${M}`);let P=await fetch(M,{signal:F.signal});if(N)clearTimeout(N),N=void 0;if(!P.ok)throw Error(`HTTP ${P.status} ${P.statusText}`);B=setTimeout(()=>{O("Overall download time exceeded 3 minutes")},V);let j=Number(P.headers.get("content-length"))||0,C=P.body?.getReader();if(!C){let n=Buffer.from(await P.arrayBuffer());if(n.length<1000)throw Error(`Downloaded content is suspiciously small (${n.length} bytes)`);zk0(Y,n),kj(`✓ Download succeeded (${(n.length/1024/1024).toFixed(1)} MB)`);return}let u=[],x=0,S=0;A=setTimeout(()=>{if(x<Z){let n=(x/1024).toFixed(1);O(`Initial transfer too slow (${n} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let n=C.read(),I0,k=new Promise((g,d)=>{I0=setTimeout(()=>{d(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),m;try{m=await Promise.race([n,k])}finally{if(I0)clearTimeout(I0)}let{done:e,value:Y0}=m;if(e)break;if(Y0){if(u.push(Y0),x+=Y0.length,A&&x>=Z)clearTimeout(A),A=void 0;let g=Date.now();if(g-S>200){S=g;let d=j?Math.round(x/j*100):0,U0=(x/1048576).toFixed(1),y=j?(j/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${d}% (${U0} / ${y} MB)...`)}catch{}}}}try{process.stderr.write(`
|
||||
`)}catch{}let b=Buffer.concat(u);if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);zk0(Y,b),kj(`✓ Download completed successfully (${(b.length/1024/1024).toFixed(1)} MB)`);return}catch(P){if(N)clearTimeout(N);if(A)clearTimeout(A);if(B)clearTimeout(B);let j=D||(P instanceof Error?P.message:String(P));G=Error(j),kj(`
|
||||
↳ Mirror failed: ${G.message}`)}finally{if(N)clearTimeout(N);if(A)clearTimeout(A);if(B)clearTimeout(B)}}throw Error(`Failed to download asset from all mirrors: ${G?.message}`)}function wk0($){let Y;try{Y=af1($,{withFileTypes:!0})}catch{return[]}let U=[];for(let Q of Y){let I=fj($,Q.name);if(Q.isDirectory())U.push(...wk0(I));else if(Q.isFile())U.push(I)}return U}function Fk0($,Y,U){let Q=Y==="windows"?"seal-use.exe":"seal-use",I=wk0($);return I.find((J)=>ef1(J)===Q)??I[0]??U}function Vu1($,Y,U){let Q=J7("tar",["-xzf",$,"-C",Y],{stdio:"pipe"});if(Q.status!==0)throw Error(`Failed to extract tar archive: ${Q.stderr.toString()}`);return Xk0($),Fk0(Y,U,$)}function Lu1($,Y,U){let Q=J7("unzip",["-q","-o",$,"-d",Y],{stdio:"pipe"});if(Q.status!==0)throw Error(`Failed to extract zip archive: ${Q.stderr.toString()}`);return Xk0($),Fk0(Y,U,$)}function Wk0($,Y,U={}){let Q=J7($,Y,{cwd:U.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(Q.stdout)console.error(Q.stdout.trimEnd());if(Q.stderr)console.error(Q.stderr.trimEnd());if(Q.status!==0)throw Error(`${$} ${Y.join(" ")} failed with status ${Q.status}`)}var Zk0="yunyingk/seal-use",qV="yunyingk/seal-home",Iu1="SEAL_USE_GITHUB_REPO",Ju1="SEAL_HOME_GITHUB_REPO";var Ok0=o(()=>{Jk0();tq();Zg();H3();yr();t1();gj()});var fr={};M1(fr,{handleRulesCommand:()=>Fu1});import{readFileSync as wu1}from"node:fs";function Dk0($,Y){let U=R($.options.descriptionFile)??R($.options["description-file"]);if(U)return wu1(U,"utf8").trim();let Q=R($.options.description)??R($.options.desc);if(Q!==void 0)return Q;return typeof Y.description==="string"?Y.description:void 0}function WY($,Y){let U=R($.options.version);if(U!==void 0)return U;if(J0($.options.latest))return"latest";if(Y!==void 0&&!Y.startsWith("-"))return Y;return}async function Fu1($,Y,U,Q,I){if(!U&&!($==="lint"||$==="linters"||$==="linter-list"||$==="map"))throw Error(`rules ${$??""} requires an authenticated enterprise. Run 'seal-use corps list' to select one.`);if($==="count"){let K=WY(I);await v0("seal_approval_rules_list",U,Q,{version:K,countOnly:!0},T0(I.options));return}if($==="list"){let K=WY(I);if(J0(I.options.count)){await v0("seal_approval_rules_list",U,Q,{version:K,countOnly:!0},T0(I.options));return}let z=l0(I.options.limit),H=l0(I.options.offset);if(J0(I.options.summary)){await v0("seal_approval_rules_list",U,Q,{version:K,fields:$10,limit:z,offset:H},T0(I.options));return}let G=await R$("seal_approval_rules_list",U,Q,{version:K,limit:z,offset:H}),W=T0(I.options);Y10(G,W.allowFull===!0||Boolean(W.outputFile)),C0(G,W);return}if($==="clear"){let K=J0(I.options.yes)===!0,z=J0(I.options.dryRun)??J0(I.options["dry-run"])??!K;if(!K&&!z)throw m4("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-use rules clear --corp ${Q.id} --dry-run`);let H=await R$("seal_approval_rules_clear",U,Q,{dryRun:z,recode:J0(I.options.recode)});if(!K&&z&&H&&typeof H==="object"){C0({...H,nextCommand:`seal-use rules clear --corp ${Q.id} --yes`},T0(I.options));return}C0(H,T0(I.options));return}if($==="versions"){await v0("seal_approval_rule_versions_list",U,Q,{},T0(I.options));return}if($==="version"){let K=WY(I,Y);if(!K)throw Error("Usage: seal-use rules version <versionNumber|latest>");await v0("seal_approval_rule_version_get",U,Q,tI(K),T0(I.options));return}if($==="diff"){let K=R(I.options.from)??Y,z=R(I.options.to)??I.command[3];if(!K||!z)throw Error("Usage: seal-use rules diff <fromVersion> <toVersion> [--code <code>] [--full]");let H=I.command[4];await v0("seal_approval_rule_version_diff",U,Q,{from:K,to:z,ruleId:R(I.options.ruleId)??R(I.options["rule-id"]),code:R(I.options.code)??H,includeUnchanged:J0(I.options.includeUnchanged)??J0(I.options["include-unchanged"]),full:J0(I.options.full),format:R(I.options.format)},T0(I.options));return}if($==="get"){let K=(Y&&!Y.startsWith("-")?Y:void 0)??R(I.options.code)??R(I.options.runtimeId)??R(I.options["runtime-id"])??R(I.options.ruleId)??R(I.options["rule-id"]);if(!K)throw Error("Usage: seal-use rules get <code> [--version <number|latest>] [--record-id <recordId>] [--corp <corpId>]");await v0("seal_approval_rule_get",U,Q,{...Mg(WY(I)),code:K,recordId:R(I.options.recordId)??R(I.options["record-id"])},T0(I.options));return}if($==="create"){let K=q6(I.json),z=Dk0(I,K),H=R(I.options.scope)??(typeof K.scope==="string"?K.scope:void 0),G=R(I.options.strictness)??(typeof K.strictness==="string"?K.strictness:"MUST_FOLLOW");if(!z||!H)throw Error("Usage: seal-use rules create --description <text> --scope <scope> [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--description-file <path>] [--corp <corpId>]");await v0("seal_approval_rule_create",U,Q,{description:z,scope:H,strictness:G},T0(I.options));return}if($==="update"){let K=q6(I.json),z=(Y&&!Y.startsWith("-")?Y:void 0)??R(I.options.ruleId)??R(I.options["rule-id"])??R(I.options.code)??(typeof K.ruleId==="string"?K.ruleId:void 0),H=Dk0(I,K),G=R(I.options.scope)??(typeof K.scope==="string"?K.scope:void 0),W=R(I.options.strictness
Line truncated
|
||||
|
||||
`+`支持的审批系统与发布目标:
|
||||
`+` • hosecloud (合思费控): seal-use deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>
|
||||
`+` • webhook (通用审批流回调): seal-use webhook <list|get|add|update|delete> --corp <corpId>
|
||||
`+` • feishu (飞书审批): 建议使用 Webhook 模式对接
|
||||
`+` • weaver (泛微 OA): 建议使用 Webhook 模式对接
|
||||
`+` • helios (汇联易): 建议使用 Webhook 模式对接
|
||||
`+" • maycur (每刻报销): 建议使用 Webhook 模式对接");if($==="webhook"||$==="webhooks")throw Error("Webhook 审批流发布请直接使用专有命令:seal-use webhook <list|get|add|update|delete> --corp <corpId>");if($==="feishu"||$==="lark")throw Error("飞书审批发布:建议使用 Webhook 通用发布模式对接。命令:seal-use webhook add --name '飞书审批' --result-url <url> --corp <corpId>");if($==="weaver")throw Error("泛微 OA 发布:建议使用 Webhook 通用发布模式对接。命令:seal-use webhook add --name '泛微OA' --result-url <url> --corp <corpId>");if($==="maycur"||$==="helios"){let G=$==="maycur"?"每刻报销":"汇联易";throw Error(`${G}发布:目前可通过 Webhook 模式接入。命令:seal-use webhook add --name '${G}' --result-url <url> --corp <corpId>`)}let K=$==="hosecloud",z=$==="hosecloud"?Y:$,H=$==="hosecloud"?U:Y;if(!K)throw Error(`未知的发布目标系统: ${$}。当前支持: hosecloud (合思费控) 与 webhook (通用回调)。`);if(z==="requirements"){await v0("seal_deploy_hosecloud_requirements",Q,I,{},T0(J.options));return}if(z==="list"){await v0("seal_deploy_hosecloud_list",Q,I,{},T0(J.options));return}if(z==="get"){let G=H??R(J.options.signKey)??R(J.options["sign-key"]);if(!G){let X=((await d1(Q)).integrations??[]).filter((Z)=>Z.type==="hosecloud");if(X.length===0)throw Error(`当前企业 (${I.name}) 尚未添加合思发布配置。
|
||||
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${I.id}`);console.error(`Usage: seal-use deploy hosecloud get <sign-key> [--corp ${I.id}]
|
||||
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let Z of X){let q=Z.outboundName??"SealAI 审批",V=Z.signKey,w=Z.apiOrigin??"production";console.error(` • "${q}" (signKey: ${V}, 环境: ${w})`),console.error(` \uD83D\uDC49 查看命令: seal-use deploy hosecloud get ${V} --corp ${I.id}
|
||||
`)}throw new U4("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。",2,X.length===1?`seal-use deploy hosecloud get ${X[0].signKey} --corp ${I.id}`:void 0)}await v0("seal_deploy_hosecloud_get",Q,I,{signKey:G},T0(J.options));return}if(z==="status"){await v0("seal_deploy_hosecloud_status",Q,I,{},T0(J.options));return}if(z==="configure"){let G=R(J.options.input),W=G?JSON.parse(hu1(G,"utf8")):q6(J.json);if(!W||Object.keys(W).length===0)throw Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");await v0("seal_deploy_hosecloud_configure",Q,I,{...W,dryRun:J0(J.options.dryRun)??J0(J.options["dry-run"])},T0(J.options));return}if(z==="sync"){let G=H??R(J.options.signKey)??R(J.options["sign-key"]),W=J0(J.options.auto)??J0(J.options.yes);if(!G){let Z=((await d1(Q)).integrations??[]).filter((V)=>V.type==="hosecloud");if(Z.length===0)throw Error(`当前企业 (${I.name}) 尚未添加合思发布配置。
|
||||
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${I.id}`);let q=Z[0];if(q&&Z.length===1&&W){let V=q.signKey;console.error(`ℹ️ [auto] 检测到企业仅有 1 个合思配置,已自动选择 (signKey: ${V})`),await v0("seal_deploy_hosecloud_sync",Q,I,{signKey:V},T0(J.options));return}console.error(`Usage: seal-use deploy hosecloud sync <sign-key> [--corp ${I.id}]
|
||||
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of Z){let w=V.outboundName??"SealAI 审批",M=V.signKey,F=V.apiOrigin??"production";console.error(` • "${w}" (signKey: ${M}, 环境: ${F})`),console.error(` \uD83D\uDC49 同步命令: seal-use deploy hosecloud sync ${M} --corp ${I.id}
|
||||
`)}if(Z.length===1)console.error(`\uD83D\uDCA1 提示:若希望单配置自动同步,可附加 --auto 参数:seal-use deploy hosecloud sync --auto --corp ${I.id}
|
||||
`);throw new U4("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,Z.length===1?`seal-use deploy hosecloud sync ${Z[0].signKey} --corp ${I.id}`:void 0)}await v0("seal_deploy_hosecloud_sync",Q,I,{signKey:G},T0(J.options));return}throw Error(`Unknown deploy hosecloud action: ${z??""}. Available: requirements, list, get, status, configure, sync.`)}var ok0=o(()=>{N4();L4();t1();Z4();t6()});var sk0={};M1(sk0,{handlePreferenceCommand:()=>gu1});import{readFileSync as rk0}from"node:fs";async function gu1($,Y,U,Q,I,J,K){if(!$||$==="get"){await v0("seal_preference_get",I,J,{},T0(K.options));return}if($==="decision"){if(Y==="update"||!Y){let z=R(K.options.input),H=z?JSON.parse(rk0(z,"utf8")):q6(K.json);if(!H||Object.keys(H).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await v0("seal_preference_decision_update",I,J,{...H,dryRun:J0(K.options.dryRun)??J0(K.options["dry-run"])},T0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let z=R(K.options.default)??R(K.options.level)??Q;if(z!=="medium"&&z!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await v0("seal_preference_thinking_depth_set",I,J,{defaultLevel:z,dryRun:J0(K.options.dryRun)??J0(K.options["dry-run"])},T0(K.options));return}if(Y==="policies"){if(U==="list"||!U){await v0("seal_preference_thinking_depth_policies_list",I,J,{},T0(K.options));return}if(U==="upsert"){let z=R(K.options.input),H=z?JSON.parse(rk0(z,"utf8")):q6(K.json);if(!H||!H.id||!H.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await v0("seal_preference_thinking_depth_policies_upsert",I,J,{...H,dryRun:J0(K.options.dryRun)??J0(K.options["dry-run"])},T0(K.options));return}if(U==="remove"||U==="delete"){let z=Q??R(K.options.id)??R(K.options.policyId);if(!z)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await v0("seal_preference_thinking_depth_policies_remove",I,J,{policyId:z,dryRun:J0(K.options.dryRun)??J0(K.options["dry-run"])},T0(K.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}var ak0=o(()=>{N4();L4();t1()});import{dirname as br,join as yu1}from"node:path";import{fileURLToPath as ku1}from"node:url";function bu1($){if(!$.length)return!1;let Y=$[0]?.toLowerCase(),U=$[1]?.toLowerCase();if(Y&&uu1.has(Y))return!0;if((Y==="service"||Y==="daemon")&&U==="run")return!0;return!1}function XV($,Y={}){if(bu1($))return $x0($,Y);let U=ek0.then(()=>$x0($,Y));return ek0=U.then(()=>{return},()=>{return}),U}async function $x0($,Y){let U=[],Q=[],I=console.log,J=console.error,K={appRoot:Y.appRoot??tk0,entryFile:Y.entryFile??yu1(Y.appRoot??tk0,"src","cli.ts"),launcher:Y.launcher};console.log=(...z)=>{U.push(Ng(z))},console.error=(...z)=>{Q.push(Ng(z))};try{return await iu1($,K),{stdout:bG(U),stderr:bG(Q),isError:!1,exitCode:0}}catch(z){let H=r8(z instanceof Error?z.message:String(z)),G=aI(z);if(Q.push(H),G.nextAction&&!H.includes("Next action:"))Q.push(`\uD83D\uDC49 Next action: ${G.nextAction}`);return{stdout:bG(U),stderr:bG(Q),isError:!0,exitCode:G.exitCode}}finally{console.log=I,console.error=J}}async function iu1($,Y){let U=uG($),[Q,I,J]=U.command,K=Q?.toLowerCase(),z=K?xu1.has(K):!1,H=z?"update":K;if(H==="version"||H==="v"||!H&&(Boolean(U.options.version)||Boolean(U.options.v)||Boolean(U.options.V))){let Z=d00(),q=Z?.latestVersion?L$(Z.latestVersion,eY.version):!1,V={...eY,...Z?.latestVersion?{latestVersion:Z.latestVersion,updateAvailable:q,lastCheckedAt:Z.checkedAt}:{}};if(q&&Z?.latestVersion)console.error(`\uD83D\uDCA1 发现新版本可用: v${eY.version} -> v${Z.latestVersion}`),console.error(`\uD83D\uDC49 Next action: seal-use update
|
||||
`);if(C0(V),m00(Z))l00(Y.launcher);return}let G=t00(U);if(G.isHelp){U10(G.target);return}if(!H||!fu1.has(H))throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`);if(H==="webhook"&&(I==="resource-pack"||I==="pack"||I==="material-pack")&&J==="preview"){let Z=U.command[3]??R(U.options.file)??R(U.options.input);if(!Z)throw Error("Usage: seal-use webhook resource-pack preview <资源包.zip>");await(await Promise.resolve().then(() => (Qj(),uo))).handleWebhookResourcePackPreview(Z,eI(U.options));return}if(H==="openapi"){(await Promise.resolve().then(() => (Bh0(),Ph0))).handleOpenApiCommand(U);return}if(H==="mcp-config"){(await Promise.resolve().then(() => (co(),io))).printMcpConfig();return}if(H==="skill"){(await Promise.resolve().then(() => (TS0(),AS0))).handleSkillCommand(I,J,U);return}if(H==="mcp"||H==="server"){await(await Promise.resolve().then(() => (co(),io))).handleMcpCommand(I);return}if(H==="probe"){await(await Promise.resolve().then(() => (RS0(),CS0))).handleProbeCommand(I,J,U);return}if(H==="doctor"){await(await Promise.resolve().then(() => (cy0(),iy0))).handleDoctorCommand(I,J,U);return}if(H==="test"){await(await Promise.resolve().then(() => (Rr(),Cr))).handleTestCommand(I,J,U);return}if(H==="config"){(await Promise.resolve().then(() => (ly0(),my0))).handleConfigCommand(I,J,U);return}if(H==="service"){await(await Promise.resolve().then(() => (gj(),kr))).handleServiceCommand(I,Y,U);return}if(H==="stop"){await(await Promise.resolve().then(() => (gj(),kr))).handleServiceCommand("stop",Y,U);return}if(H==="http"||H==="serve"){await(await Promise.resolve().then(() => (Ik0(),Qk0))).handleHttpCommand(U);return}if(z||H==="changelog"){if(z&&Q!=="update")console.error(`⚠️ Notice: '${Q}' is an alias for 'seal-use update'. Please use 'seal-use update' instead.`);let Z=I?.toLowerCase(),q=H==="changelog"||Z==="changelog"||Z==="log"||Z==="history"||J0(U.options.changelog)===!0,V=Z==="check"||J0(U.options.check)===!0||J0(U.options["check-only"])===!0,w=J0(U.options["bg-save"])===!0||J0(U.options["silent-save"])===!0,M=R(U.options.version)??R(U.options.tag)??(!q&&!V&&!w&&I&&!I.startsWith("-")?I:void 0);await(await Promise.resolve().then(() => (Ok0(),Mk0))).handleUpdateCommand(Y,{checkOnly:V||w,changelogOnly:q,limit:l0(U.options.limit),force:J0(U.options.force),targetVersion:M,repo:R(U.options.repo),bgSave:w});return}if(H==="corps"||H==="corp"){if(I==="regression"||I==="test-regression"){await(await Promise.resolve().then(() => (Rr(),Cr))).handleTestCommand("regression",J,U);return}await(await Promise.resolve().then(() => (Tr(),Sy0))).handleCorpsCommand(I,J,U);return}if(H==="rules"&&I==="lint"&&(("file"in U.options)||("f"in U.options))){let Z;try{Z=(await Promise.resolve().then(() => (N4(),oq))).selectCorp(R(U.options.corp))}catch{Z={id:"local",name:"Local Workspace",source:{type:"native"}}}await(await Promise.resolve().then(() => (ur(),fr))).handleRulesCommand(I,J,null,Z,U);return}if(H==="auth"&&(I==="extract-keys"||I==="extract-key"||I==="extract-hose-keys"||I==="hose-extract-keys")){await(await Promise.resolve().then(() => (GV(),HV))).handleAuthExtractKeysCommand(J,U);return}if(H==="auth"&&(I==="link"||I==="seal-link")&&(("from-link"in U.options)||J==="from-link")){await(await Promise.resolve().then(() => (GV(),HV))).handleAuthCommand(I,null,U);return}let W=(await Promise.resolve().then(() => (N4(),oq))).selectCorp(R(U.options.corp));if(H==="source"){await(await Promise.resolve().then(() => (Pk0(),Nk0))).handleSourceCommand(I,W);return}if(H==="auth"){await(await Promise.resolve().then(() => (GV(),HV))).handleAuthCommand(I,W,U);return}let X=await(await Promise.resolve().then(() => (n6(),pg))).createSealClient(W);if(H==="users"){await(await Promise.resolve().then(() => (Ak0(),Bk0))).handleUsersCommand(I,J,X,W,U);return}if(H==="contacts"){await(await Promise.resolve().then(() => (jk0(),Tk0))).handleContactsCommand(I,J,X,W,U);return}if(H==="data"){await(await Promise.resolve().then(() => (Ck0(),Ek0))).handleDataCommand(I,X,W,U);return}if(H==="llm"){await(await Promise.resolve().then(() => (_k0(),Rk0))).handleLlmCommand(I,X,W,U);return}if(H==="permissions"){await(await Promise.resolve().then(() => (hk0(),vk0))).handlePermissionsCommand(I,X,W,U);return}if(H==="billing"){await(await Promise.resolve().then(() => (gk0(),Sk0))).handleBillingCommand(I,X,W,U);return}if(H==="webhook"||H==="webhooks"){await(await Promise.resolve().then(() => (Qj(),uo))).handleWebhookCommand(I,J,X,W,U);return}if(H==="context"){await(await Promise.resolve().then(() => (kk0(),yk0))).handleContextCommand(X,W,U);return}if(H==="documents"){await(await Promise.resolve().then(() => (uk0(),fk0))).handleDocumentsCommand(I,J,X,W,U);return}if(H==="rules"){await(await Promise.resolve().then(() => (ur(),fr))).handleRulesCommand(I,J,X,W,U);return}if(H==="approval-runs"){await(await Promise.resolve().then(() => (ik0(),bk0))).handleApprovalRunsCommand(I,J,X,W,U);return}if(H==="analytics"){await(await Promise.reso
Line truncated
|
||||
`)?"":`
|
||||
`}`);process.exitCode=$.exitCode}var z7,ok0,SE="seal_cli",zV="seal_cli_write",rk0="SEAL_USE_MCP_ENABLED",sk0="SEAL_HOME_MCP_ENABLED",Yu1;var py0=o(async()=>{R00();S00();W6();Lr();pk0();p8();W3();z7=ef1(import.meta.url),ok0=z7.includes("/dist/mcp/")||z7.includes("\\dist\\mcp\\")?JV(JV(JV(z7))):JV(JV(z7));Yu1=Boolean(K0.main==K0.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&mk0(process.argv[1])===mk0(z7));if(Yu1)if(process.argv[2]==="--seal-use-cli")await $u1();else try{ek0()}catch($){console.error($),process.exitCode=1}});await py0();export{$V as tokenizeCommand,ek0 as startServer,tk0 as resolveMcpEnabled,ak0 as createServer,rk0 as SEAL_MCP_ENABLED_ENV,zV as SEAL_CLI_WRITE_TOOL_NAME,SE as SEAL_CLI_TOOL_NAME,sk0 as LEGACY_SEAL_MCP_ENABLED_ENV};
|
||||
`}`);process.exitCode=$.exitCode}var K7,Jx0,ij="seal_cli",wV="seal_cli_write",Kx0="SEAL_USE_MCP_ENABLED",zx0="SEAL_HOME_MCP_ENABLED",ou1;var jh0=o(async()=>{f00();i00();Z6();_r();Ux0();t6();H3();K7=mu1(import.meta.url),Jx0=K7.includes("/dist/mcp/")||K7.includes("\\dist\\mcp\\")?VV(VV(VV(K7))):VV(VV(K7));ou1=Boolean(z0.main==z0.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&Qx0(process.argv[1])===Qx0(K7));if(ou1)if(process.argv[2]==="--seal-use-cli")await lu1();else try{Wx0()}catch($){console.error($),process.exitCode=1}});await jh0();export{WV as tokenizeCommand,Wx0 as startServer,Hx0 as resolveMcpEnabled,Gx0 as createServer,Kx0 as SEAL_MCP_ENABLED_ENV,wV as SEAL_CLI_WRITE_TOOL_NAME,ij as SEAL_CLI_TOOL_NAME,zx0 as LEGACY_SEAL_MCP_ENABLED_ENV};
|
||||
Reference in new issue
Block a user