import{createRequireasig0}from"node:module";varhg0=Object.create;var{getPrototypeOf:Sg0,defineProperty:iT,getOwnPropertyNames:gg0}=Object;varyg0=Object.prototype.hasOwnProperty;functionkg0($){returnthis[$]}varxg0,fg0,Q6=($,Y,z)=>{varU=$!=null&&typeof$==="object";if(U){varI=Y?xg0??=newWeakMap:fg0??=newWeakMap,Q=I.get($);if(Q)returnQ}z=$!=null?hg0(Sg0($)):{};letJ=Y||!$||!$.__esModule?iT(z,"default",{value:$,enumerable:!0}):z;for(letKofgg0($))if(!yg0.call(J,K))iT(J,K,{get:kg0.bind($,K),enumerable:!0});if(U)I.set($,J);returnJ};varE=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);varug0=($)=>$;functionbg0($,Y){this[$]=ug0.bind(null,Y)}varx8=($,Y)=>{for(varzinY)iT($,z,{get:Y[z],enumerable:!0,configurable:!0,set:bg0.bind(Y,z)})};varo=($,Y)=>()=>($&&(Y=$($=0)),Y);varJ0=ig0(import.meta.url);varcg0,xq,ng0,pg0,dg0,mg0,R0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),Bo=($,Y)=>{letz={};for(varUin$)xq(z,U,{get:$[U],enumerable:!0});if(Y)xq(z,Symbol.toStringTag,{value:"Module"});returnz},lg0=($,Y,z,U)=>{if(Y&&typeofY==="object"||typeofY==="function"){for(varI=pg0(Y),Q=0,J=I.length,K;Q<J;Q++)if(K=I[Q],!mg0.call($,K)&&K!==z)xq($,K,{get:((G)=>Y[G]).bind(null,K),enumerable:!(U=ng0(Y,K))||U.enumerable})}return$},fq=($,Y,z)=>(z=$!=null?cg0(dg0($)):{},lg0(Y||!$||!$.__esModule?xq(z,"default",{value:$,enumerable:!0}):z,$));varcT=o(()=>{cg0=Object.create,xq=Object.defineProperty,ng0=Object.getOwnPropertyDescriptor,pg0=Object.getOwnPropertyNames,dg0=Object.getPrototypeOf,mg0=Object.prototype.hasOwnProperty});functionTo($){returntypeof$==="string"&&Ao.has($.replace(/#$/,""))}functionjo($,Y){if(!("$schema"in$)||typeof$.$schema!=="string")return"2020-12";letz=$.$schema.replace(/#$/,"");if(og0.has(z))return"2020-12";if(Ao.has(z))return"2019-09";if(rg0.has(z)||sg0.has(z))return"draft-7";throwError(`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}`)}varog0,Ao,rg0,sg0;varnT=o(()=>{og0=newSet(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Ao=newSet(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),rg0=newSet(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),sg0=newSet(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});functionW0($,Y,z){functionU(K,G){if(!K._zod)Object.defineProperty(K,"_zod",{value:{def:G,constr:J,traits:newSet},enumerable:!1});if(K._zod.traits.has($))return;K._zod.traits.add($),Y(K,G);letW=J.prototype,H=Object.keys(W);for(letX=0;X<H.length;X++){letZ=H[X];if(!(ZinK))K[Z]=W[Z].bind(K)}}letI=z?.Parent??Object;classQextendsI{}Object.defineProperty(Q,"name",{value:$});functionJ(K){varG;letW=z?.Parent?newQ:this;U(W,K),(G=W._zod).deferred??(G.deferred=[]);for(letHofW._zod.deferred)H();returnW}returnObject.defineProperty(J,"init",{value:U}),Object.defineProperty(J,Symbol.hasInstance,{value:(K)=>{if(z?.Parent&&Kinstanceofz.Parent)return!0;returnK?._zod?.traits?.has($)}}),Object.defineProperty(J,"name",{value:$}),J}functiona4($){if($)Object.assign(NY,$);returnNY}varEo,nK,pT,f5,DY,NY;varPY=o(()=>{nK=Object.freeze({status:"aborted"});pT=Symbol("zod_brand");f5=classf5extendsError{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};DY=classDYextendsError{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(Eo=globalThis).__zod_globalConfig??(Eo.__zod_globalConfig={});NY=globalThis.__zod_globalConfig});vary0={};x8(y0,{unwrapMessage:()=>pK,uint8ArrayToHex:()=>Dy0,uint8ArrayToBase64url:()=>Oy0,uint8ArrayToBase64:()=>_o,stringifyPrimitive:()=>v0,slugify:()=>lT,shallowClone:()=>rT,safeExtend:()=>qy0,required:()=>Fy0,randomString:()=>Jy0,propertyKeyTypes:()=>lK,promiseAllObject:()=>Qy0,primitiveTypes:()=>sT,prefixIssues:()=>f8,pick:()=>Hy0,partial:()=>Ly0,parsedType:()=>S0,optionalKeys:()=>aT,omit:()=>Xy0,objectClone:()=>zy0,numKeys:()=>Ky0,nullish:()=>I7,normalizeParams:()=>x0,mergeDefs:()=>i9,merge:()=>Vy0,jsonStringifyReplacer:()=>xU,joinValues:()=>N0,issue:()=>uU,isPlainObject:()=>J7,isObject:()=>BY,hexToUint8Array:()=>Ny0,getSizableOrigin:()=>oK,getParsedType:()=>Gy0,getLengthableOrigin:()=>rK,getEnumValues:()=>dK,getElementAtPath:()=>Iy0,floatSafeRemainder:()=>mT,finalizeIssue:()=>P8,extend:()=>Zy0,explicitlyAborted:()=>$j,escapeRegex:()=>N$,esc:()=>uq,defineLazy:()=>T1,createTransparentProxy:()=>Wy0,cloneDef:()=>Uy0,clone:()=>D8,cleanRegex:()=>mK,cleanEnum:()=>wy0,captureStackTrace:()=>bq,cached:()=>fU,base64urlToUint8Array:()=>My0,base64ToUint8Array:()=>Ro,assignProp:()=>Q7,assertNotEqual:()=>tg0,assertNever:()=>$y0,assertIs:()=>eg0,assertEqual:()=>ag0,assert:()=>Yy0,allowsEval:()=>oT,aborted:()=>K7,NUMBER_FORMAT_RANGES:()=>tT,Class:()=>voLine truncated
`)}var ho=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,xU,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},sK,u8;var Uj=o(()=>{PY();$1();sK=W0("$ZodError",ho),u8=W0("$ZodError",ho,{Parent:Error})});var bU=($)=>(Y,z,U,I)=>{let Q=U?{...U,async:!1}:{async:!1},J=Y._zod.run({value:z,issues:[]},Q);if(J instanceof Promise)throw new f5;if(J.issues.length){let K=new(I?.Err??$)(J.issues.map((G)=>P8(G,Q,a4())));throw bq(K,I?.callee),K}return J.value},iq,iU=($)=>async(Y,z,U,I)=>{let Q=U?{...U,async:!0}:{async:!0},J=Y._zod.run({value:z,issues:[]},Q);if(J instanceof Promise)J=await J;if(J.issues.length){let K=new(I?.Err??$)(J.issues.map((G)=>P8(G,Q,a4())));throw bq(K,I?.callee),K}return J.value},cq,cU=($)=>(Y,z,U)=>{let I=U?{...U,async:!1}:{async:!1},Q=Y._zod.run({value:z,issues:[]},I);if(Q instanceof Promise)throw new f5;return Q.issues.length?{success:!1,error:new($??sK)(Q.issues.map((J)=>P8(J,I,a4())))}:{success:!0,data:Q.value}},Ij,nU=($)=>async(Y,z,U)=>{let I=U?{...U,async:!0}:{async:!0},Q=Y._zod.run({value:z,issues:[]},I);if(Q instanceof Promise)Q=await Q;return Q.issues.length?{success:!1,error:new $(Q.issues.map((J)=>P8(J,I,a4())))}:{success:!0,data:Q.value}},Qj,nq=($)=>(Y,z,U)=>{let I=U?{...U,direction:"backward"}:{direction:"backward"};return bU($)(Y,z,I)},By0,pq=($)=>(Y,z,U)=>{return bU($)(Y,z,U)},Ay0,dq=($)=>async(Y,z,U)=>{let I=U?{...U,direction:"backward"}:{direction:"backward"};return iU($)(Y,z,I)},Ty0,mq=($)=>async(Y,z,U)=>{return iU($)(Y,z,U)},jy0,lq=($)=>(Y,z,U)=>{let I=U?{...U,direction:"backward"}:{direction:"backward"};return cU($)(Y,z,I)},Ey0,oq=($)=>(Y,z,U)=>{return cU($)(Y,z,U)},Cy0,rq=($)=>async(Y,z,U)=>{let I=U?{...U,direction:"backward"}:{direction:"backward"};return nU($)(Y,z,I)},Ry0,sq=($)=>async(Y,z,U)=>{return nU($)(Y,z,U)},_y0;var Jj=o(()=>{PY();Uj();$1();iq=bU(u8),cq=iU(u8),Ij=cU(u8),Qj=nU(u8),By0=nq(u8),Ay0=pq(u8),Ty0=dq(u8),jy0=mq(u8),Ey0=lq(u8),Cy0=oq(u8),Ry0=rq(u8),_y0=sq(u8)});var Y$={};x8(Y$,{xid:()=>Hj,uuid7:()=>gy0,uuid6:()=>Sy0,uuid4:()=>hy0,uuid:()=>AY,uppercase:()=>yj,unicodeEmail:()=>go,undefined:()=>Sj,ulid:()=>Wj,time:()=>jj,string:()=>Cj,sha512_hex:()=>Yk0,sha512_base64url:()=>Uk0,sha512_base64:()=>zk0,sha384_hex:()=>ty0,sha384_base64url:()=>$k0,sha384_base64:()=>ey0,sha256_hex:()=>ry0,sha256_base64url:()=>ay0,sha256_base64:()=>sy0,sha1_hex:()=>my0,sha1_base64url:()=>oy0,sha1_base64:()=>ly0,rfc5322Email:()=>ky0,number:()=>eK,null:()=>hj,nanoid:()=>Zj,md5_hex:()=>ny0,md5_base64url:()=>dy0,md5_base64:()=>py0,mac:()=>Oj,lowercase:()=>gj,ksuid:()=>Xj,ipv6:()=>Mj,ipv4:()=>wj,integer:()=>_j,idnEmail:()=>xy0,httpProtocol:()=>Bj,html5Email:()=>yy0,hostname:()=>by0,hex:()=>cy0,guid:()=>Vj,extendedDuration:()=>vy0,emoji:()=>Fj,email:()=>Lj,e164:()=>Aj,duration:()=>qj,domain:()=>iy0,datetime:()=>Ej,date:()=>Tj,cuid2:()=>Gj,cuid:()=>Kj,cidrv6:()=>Dj,cidrv4:()=>Nj,browserEmail:()=>fy0,boolean:()=>vj,bigint:()=>Rj,base64url:()=>aq,base64:()=>Pj});function Fj(){return new RegExp(uy0,"u")}function ko($){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 jj($){return new RegExp(`^${ko($)}$`)}function Ej($){let Y=ko({precision:$.precision}),z=["Z"];if($.local)z.push("");if($.offset)z.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let U=`${Y}(?:${z.join("|")})`;return new RegExp(`^${yo}T(?:${U})$`)}function $G($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function YG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var Kj,Gj,Wj,Hj,Xj,Zj,qj,vy0,Vj,AY=($)=>{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)$/;returnnewRegExp(`^([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})$`)},hy0,Sy0,gy0,Lj,yy0,ky0,go,xy0,fy0,uy0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",wj,Mj,Oj=($)=>{letY=N$($??":");returnnewRegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},Nj,Dj,Pj,aq,by0,iy0,Bj,Aj,yo="(?:(?:\\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])))",Tj,Cj=($)=>{letY=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";returnnewRegExp(`^${Y}$`)},Rj,_j,eK,vj,hj,Sj,gj,yj,cy0,ny0,py0,dy0,my0,ly0,oy0,ry0,sy0,ay0,ty0,ey0,$k0,Yk0,zk0,Uk0;vartq=o(()=>{$1();Kj=/^[cC][0-9a-z]{6,}$/,Gj=/^[0-9a-z]+$/,Wj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Hj=/^[0-9a-vA-V]{20}$/,Xj=/^[A-Za-z0-9]{27}$/,Zj=/^[a-zA-Z0-9_-]{21}$/,qj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
import{createRequireasWy0}from"node:module";varYy0=Object.create;var{getPrototypeOf:zy0,defineProperty:mT,getOwnPropertyNames:Uy0}=Object;varIy0=Object.prototype.hasOwnProperty;functionQy0($){returnthis[$]}varJy0,Ky0,Q6=($,Y,z)=>{varU=$!=null&&typeof$==="object";if(U){varI=Y?Jy0??=newWeakMap:Ky0??=newWeakMap,Q=I.get($);if(Q)returnQ}z=$!=null?Yy0(zy0($)):{};letJ=Y||!$||!$.__esModule?mT(z,"default",{value:$,enumerable:!0}):z;for(letKofUy0($))if(!Iy0.call(J,K))mT(J,K,{get:Qy0.bind($,K),enumerable:!0});if(U)I.set($,J);returnJ};varE=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);varGy0=($)=>$;functionHy0($,Y){this[$]=Gy0.bind(null,Y)}varx8=($,Y)=>{for(varzinY)mT($,z,{get:Y[z],enumerable:!0,configurable:!0,set:Hy0.bind(Y,z)})};varo=($,Y)=>()=>($&&(Y=$($=0)),Y);varJ0=Wy0(import.meta.url);varXy0,cq,Zy0,qy0,Vy0,Ly0,R0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),xo=($,Y)=>{letz={};for(varUin$)cq(z,U,{get:$[U],enumerable:!0});if(Y)cq(z,Symbol.toStringTag,{value:"Module"});returnz},Fy0=($,Y,z,U)=>{if(Y&&typeofY==="object"||typeofY==="function"){for(varI=qy0(Y),Q=0,J=I.length,K;Q<J;Q++)if(K=I[Q],!Ly0.call($,K)&&K!==z)cq($,K,{get:((G)=>Y[G]).bind(null,K),enumerable:!(U=Zy0(Y,K))||U.enumerable})}return$},nq=($,Y,z)=>(z=$!=null?Xy0(Vy0($)):{},Fy0(Y||!$||!$.__esModule?cq(z,"default",{value:$,enumerable:!0}):z,$));varlT=o(()=>{Xy0=Object.create,cq=Object.defineProperty,Zy0=Object.getOwnPropertyDescriptor,qy0=Object.getOwnPropertyNames,Vy0=Object.getPrototypeOf,Ly0=Object.prototype.hasOwnProperty});functionuo($){returntypeof$==="string"&&fo.has($.replace(/#$/,""))}functionbo($,Y){if(!("$schema"in$)||typeof$.$schema!=="string")return"2020-12";letz=$.$schema.replace(/#$/,"");if(wy0.has(z))return"2020-12";if(fo.has(z))return"2019-09";if(My0.has(z)||Oy0.has(z))return"draft-7";throwError(`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}`)}varwy0,fo,My0,Oy0;varoT=o(()=>{wy0=newSet(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),fo=newSet(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),My0=newSet(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Oy0=newSet(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});functionH0($,Y,z){functionU(K,G){if(!K._zod)Object.defineProperty(K,"_zod",{value:{def:G,constr:J,traits:newSet},enumerable:!1});if(K._zod.traits.has($))return;K._zod.traits.add($),Y(K,G);letH=J.prototype,W=Object.keys(H);for(letX=0;X<W.length;X++){letZ=W[X];if(!(ZinK))K[Z]=H[Z].bind(K)}}letI=z?.Parent??Object;classQextendsI{}Object.defineProperty(Q,"name",{value:$});functionJ(K){varG;letH=z?.Parent?newQ:this;U(H,K),(G=H._zod).deferred??(G.deferred=[]);for(letWofH._zod.deferred)W();returnH}returnObject.defineProperty(J,"init",{value:U}),Object.defineProperty(J,Symbol.hasInstance,{value:(K)=>{if(z?.Parent&&Kinstanceofz.Parent)return!0;returnK?._zod?.traits?.has($)}}),Object.defineProperty(J,"name",{value:$}),J}functiona4($){if($)Object.assign(AY,$);returnAY}vario,mK,rT,f5,PY,AY;varBY=o(()=>{mK=Object.freeze({status:"aborted"});rT=Symbol("zod_brand");f5=classf5extendsError{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};PY=classPYextendsError{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(io=globalThis).__zod_globalConfig??(io.__zod_globalConfig={});AY=globalThis.__zod_globalConfig});vary0={};x8(y0,{unwrapMessage:()=>lK,uint8ArrayToHex:()=>py0,uint8ArrayToBase64url:()=>cy0,uint8ArrayToBase64:()=>po,stringifyPrimitive:()=>v0,slugify:()=>tT,shallowClone:()=>$j,safeExtend:()=>ky0,required:()=>uy0,randomString:()=>Ry0,propertyKeyTypes:()=>sK,promiseAllObject:()=>Cy0,primitiveTypes:()=>Yj,prefixIssues:()=>f8,pick:()=>Sy0,partial:()=>fy0,parsedType:()=>S0,optionalKeys:()=>zj,omit:()=>gy0,objectClone:()=>Ty0,numKeys:()=>_y0,nullish:()=>I7,normalizeParams:()=>x0,mergeDefs:()=>i9,merge:()=>xy0,jsonStringifyReplacer:()=>uU,joinValues:()=>N0,issue:()=>iU,isPlainObject:()=>J7,isObject:()=>TY,hexToUint8Array:()=>ny0,getSizableOrigin:()=>aK,getParsedType:()=>vy0,getLengthableOrigin:()=>tK,getEnumValues:()=>oK,getElementAtPath:()=>Ey0,floatSafeRemainder:()=>aT,finalizeIssue:()=>A8,extend:()=>yy0,explicitlyAborted:()=>Qj,escapeRegex:()=>N$,esc:()=>pq,defineLazy:()=>T1,createTransparentProxy:()=>hy0,cloneDef:()=>jy0,clone:()=>D8,cleanRegex:()=>rK,cleanEnum:()=>by0,captureStackTrace:()=>dq,cached:()=>bU,base64urlToUint8Array:()=>iy0,base64ToUint8Array:()=>no,assignProp:()=>Q7,assertNotEqual:()=>Dy0,assertNever:()=>Py0,assertIs:()=>Ay0,assertEqual:()=>Ny0,assert:()=>By0,allowsEval:()=>eT,aborted:()=>K7,NUMBER_FORMAT_RANGES:()=>Uj,Class:()=>moLine truncated
`)}var lo=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,uU,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},eK,u8;var Gj=o(()=>{BY();$1();eK=H0("$ZodError",lo),u8=H0("$ZodError",lo,{Parent:Error})});var cU=($)=>(Y,z,U,I)=>{let Q=U?{...U,async:!1}:{async:!1},J=Y._zod.run({value:z,issues:[]},Q);if(J instanceof Promise)throw new f5;if(J.issues.length){let K=new(I?.Err??$)(J.issues.map((G)=>A8(G,Q,a4())));throw dq(K,I?.callee),K}return J.value},mq,nU=($)=>async(Y,z,U,I)=>{let Q=U?{...U,async:!0}:{async:!0},J=Y._zod.run({value:z,issues:[]},Q);if(J instanceof Promise)J=await J;if(J.issues.length){let K=new(I?.Err??$)(J.issues.map((G)=>A8(G,Q,a4())));throw dq(K,I?.callee),K}return J.value},lq,pU=($)=>(Y,z,U)=>{let I=U?{...U,async:!1}:{async:!1},Q=Y._zod.run({value:z,issues:[]},I);if(Q instanceof Promise)throw new f5;return Q.issues.length?{success:!1,error:new($??eK)(Q.issues.map((J)=>A8(J,I,a4())))}:{success:!0,data:Q.value}},Hj,dU=($)=>async(Y,z,U)=>{let I=U?{...U,async:!0}:{async:!0},Q=Y._zod.run({value:z,issues:[]},I);if(Q instanceof Promise)Q=await Q;return Q.issues.length?{success:!1,error:new $(Q.issues.map((J)=>A8(J,I,a4())))}:{success:!0,data:Q.value}},Wj,oq=($)=>(Y,z,U)=>{let I=U?{...U,direction:"backward"}:{direction:"backward"};return cU($)(Y,z,I)},my0,rq=($)=>(Y,z,U)=>{return cU($)(Y,z,U)},ly0,sq=($)=>async(Y,z,U)=>{let I=U?{...U,direction:"backward"}:{direction:"backward"};return nU($)(Y,z,I)},oy0,aq=($)=>async(Y,z,U)=>{return nU($)(Y,z,U)},ry0,tq=($)=>(Y,z,U)=>{let I=U?{...U,direction:"backward"}:{direction:"backward"};return pU($)(Y,z,I)},sy0,eq=($)=>(Y,z,U)=>{return pU($)(Y,z,U)},ay0,$V=($)=>async(Y,z,U)=>{let I=U?{...U,direction:"backward"}:{direction:"backward"};return dU($)(Y,z,I)},ty0,YV=($)=>async(Y,z,U)=>{return dU($)(Y,z,U)},ey0;var Xj=o(()=>{BY();Gj();$1();mq=cU(u8),lq=nU(u8),Hj=pU(u8),Wj=dU(u8),my0=oq(u8),ly0=rq(u8),oy0=sq(u8),ry0=aq(u8),sy0=tq(u8),ay0=eq(u8),ty0=$V(u8),ey0=YV(u8)});var Y$={};x8(Y$,{xid:()=>Lj,uuid7:()=>Uk0,uuid6:()=>zk0,uuid4:()=>Yk0,uuid:()=>jY,uppercase:()=>bj,unicodeEmail:()=>ro,undefined:()=>fj,ulid:()=>Vj,time:()=>vj,string:()=>Sj,sha512_hex:()=>Bk0,sha512_base64url:()=>jk0,sha512_base64:()=>Tk0,sha384_hex:()=>Dk0,sha384_base64url:()=>Pk0,sha384_base64:()=>Ak0,sha256_hex:()=>Mk0,sha256_base64url:()=>Nk0,sha256_base64:()=>Ok0,sha1_hex:()=>Lk0,sha1_base64url:()=>wk0,sha1_base64:()=>Fk0,rfc5322Email:()=>Qk0,number:()=>zG,null:()=>xj,nanoid:()=>wj,md5_hex:()=>Zk0,md5_base64url:()=>Vk0,md5_base64:()=>qk0,mac:()=>Bj,lowercase:()=>uj,ksuid:()=>Fj,ipv6:()=>Pj,ipv4:()=>Aj,integer:()=>yj,idnEmail:()=>Jk0,httpProtocol:()=>Cj,html5Email:()=>Ik0,hostname:()=>Hk0,hex:()=>Xk0,guid:()=>Oj,extendedDuration:()=>$k0,emoji:()=>Dj,email:()=>Nj,e164:()=>Rj,duration:()=>Mj,domain:()=>Wk0,datetime:()=>hj,date:()=>_j,cuid2:()=>qj,cuid:()=>Zj,cidrv6:()=>jj,cidrv4:()=>Tj,browserEmail:()=>Kk0,boolean:()=>kj,bigint:()=>gj,base64url:()=>zV,base64:()=>Ej});function Dj(){return new RegExp(Gk0,"u")}function ao($){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 vj($){return new RegExp(`^${ao($)}$`)}function hj($){let Y=ao({precision:$.precision}),z=["Z"];if($.local)z.push("");if($.offset)z.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let U=`${Y}(?:${z.join("|")})`;return new RegExp(`^${so}T(?:${U})$`)}function UG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function IG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var Zj,qj,Vj,Lj,Fj,wj,Mj,$k0,Oj,jY=($)=>{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)$/;returnnewRegExp(`^([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})$`)},Yk0,zk0,Uk0,Nj,Ik0,Qk0,ro,Jk0,Kk0,Gk0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Aj,Pj,Bj=($)=>{letY=N$($??":");returnnewRegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},Tj,jj,Ej,zV,Hk0,Wk0,Cj,Rj,so="(?:(?:\\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])))",_j,Sj=($)=>{letY=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";returnnewRegExp(`^${Y}$`)},gj,yj,zG,kj,xj,fj,uj,bj,Xk0,Zk0,qk0,Vk0,Lk0,Fk0,wk0,Mk0,Ok0,Nk0,Dk0,Ak0,Pk0,Bk0,Tk0,jk0;varUV=o(()=>{$1();Zj=/^[cC][0-9a-z]{6,}$/,qj=/^[0-9a-z]+$/,Vj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Lj=/^[0-9a-vA-V]{20}$/,Fj=/^[A-Za-z0-9]{27}$/,wj=/^[a-zA-Z0-9_-]{21}$/,Mj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
`).filter((Q)=>Q),U=Math.min(...z.map((Q)=>Q.length-Q.trimStart().length)),I=z.map((Q)=>Q.slice(U)).map((Q)=>" ".repeat(this.indent*2)+Q);for(let Q of I)this.content.push(Q)}compile(){let $=Function,Y=this?.args,U=[...(this?.content??[""]).map((I)=>`${I}`)];return new $(...Y,U.join(`
`))}}var $E;var YE=o(()=>{$E={major:4,minor:4,patch:3}});function BE($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function Yr($){if(!aq.test($))return!1;let Y=$.replace(/[-_]/g,(U)=>U==="-"?"+":"/"),z=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return BE(z)}function zr($,Y=null){try{let z=$.split(".");if(z.length!==3)return!1;let[U]=z;if(!U)return!1;let I=JSON.parse(atob(U));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 bo($,Y,z){if($.issues.length)Y.issues.push(...f8(z,$.issues));Y.value[z]=$.value}function JV($,Y,z,U,I,Q){let J=z in U;if($.issues.length){if(I&&Q&&!J)return;Y.issues.push(...f8(z,$.issues))}if(!J&&!I){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[z]});return}if($.value===void 0){if(J)Y.value[z]=void 0}else Y.value[z]=$.value}function Ur($){let Y=Object.keys($.shape);for(let U of Y)if(!$.shape?.[U]?._zod?.traits?.has("$ZodType"))throw Error(`Invalidelementatkey"${U}":expectedaZodschema`);let z=aT($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(z)}}function Ir($,Y,z,U,I,Q){let J=[],K=I.keySet,G=I.catchall._zod,W=G.def.type,H=G.optin==="optional",X=G.optout==="optional";for(let Z in Y){if(Z==="__proto__")continue;if(K.has(Z))continue;if(W==="never"){J.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},U);if(q instanceof Promise)$.push(q.then((V)=>JV(V,z,Z,Y,H,X)));else JV(q,z,Z,Y,H,X)}if(J.length)z.issues.push({code:"unrecognized_keys",keys:J,input:Y,inst:Q});if(!$.length)return z;return Promise.all($).then(()=>{return z})}function io($,Y,z,U){for(let Q of $)if(Q.issues.length===0)return Y.value=Q.value,Y;let I=$.filter((Q)=>!K7(Q));if(I.length===1)return Y.value=I[0].value,I[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:z,errors:$.map((Q)=>Q.issues.map((J)=>P8(J,U,a4())))}),Y}function co($,Y,z,U){let I=$.filter((Q)=>Q.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:z,errors:$.map((Q)=>Q.issues.map((J)=>P8(J,U,a4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:z,errors:[],inclusive:!1});return Y}function zE($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(J7($)&&J7(Y)){let z=Object.keys(Y),U=Object.keys($).filter((Q)=>z.indexOf(Q)!==-1),I={...$,...Y};for(let Q of U){let J=zE($[Q],Y[Q]);if(!J.valid)return{valid:!1,mergeErrorPath:[Q,...J.mergeErrorPath]};I[Q]=J.data}return{valid:!0,data:I}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let z=[];for(let U=0;U<$.length;U++){let I=$[U],Q=Y[U],J=zE(I,Q);if(!J.valid)return{valid:!1,mergeErrorPath:[U,...J.mergeErrorPath]};z.push(J.data)}return{valid:!0,data:z}}return{valid:!1,mergeErrorPath:[]}}function no($,Y,z){let U=new Map,I;for(let K of Y.issues)if(K.code==="unrecognized_keys"){I??(I=K);for(let G of K.keys){if(!U.has(G))U.set(G,{});U.get(G).l=!0}}else $.issues.push(K);for(let K of z.issues)if(K.code==="unrecognized_keys")for(let G of K.keys){if(!U.has(G))U.set(G,{});U.get(G).r=!0}else $.issues.push(K);let Q=[...U].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(Q.length&&I)$.issues.push({...I,keys:Q});if(K7($))return $;let J=zE(Y.value,z.value);if(!J.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}function po($,Y){for(let z=$.length-1;z>=0;z--)if($[z]._zod[Y]!=="optional")return z+1;return 0}function mo($,Y,z){if($.issues.length)Y.issues.push(...f8(z,$.issues));Y.value[z]=$.value}function lo($,Y,z,U,I){for(let Q=0;Q<z.length;Q++){let J=$[Q],K=Q<U.length;if(J.issues.length){if(!K&&Q>=I){Y.value.length=Q;break}Y.issues.push(...f8(Q,J.issues))}Y.value[Q]=J.value}for(let Q=Y.value.length-1;Q>=U.length;Q--)if(z[Q]._zod.optout==="optional"&&Y.value[Q]===void 0)Y.value.length=Q;else break;return Y}function oo($,Y,z,U,I,Q,J){if($.issues.length)if(lK.has(typeof U))z.issues.push(...f8(U,$.issues));else z.issues.push({code:"invalid_key",origin:"map",input:I,inst:Q,issues:$.issues.map((K)=>P8(K,J,a4()))});if(Y.issues.length)if(lK.has(typeof U))z.issues.push(...f8(U,Y.issues));else z.issues.push({origin:"map",code:"invalid_element",input:I,inst:Q,key:U,issues:Y.issues.map((K)=>P8(K,J,a4()))});z.value.set($.value,Y.value)}function ro($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function so($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function ao($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function to($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function UV($,Y,z){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa
Line truncated
`))}}var QE;var JE=o(()=>{QE={major:4,minor:4,patch:3}});function CE($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function Lr($){if(!zV.test($))return!1;let Y=$.replace(/[-_]/g,(U)=>U==="-"?"+":"/"),z=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return CE(z)}function Fr($,Y=null){try{let z=$.split(".");if(z.length!==3)return!1;let[U]=z;if(!U)return!1;let I=JSON.parse(atob(U));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 Yr($,Y,z){if($.issues.length)Y.issues.push(...f8(z,$.issues));Y.value[z]=$.value}function XV($,Y,z,U,I,Q){let J=z in U;if($.issues.length){if(I&&Q&&!J)return;Y.issues.push(...f8(z,$.issues))}if(!J&&!I){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[z]});return}if($.value===void 0){if(J)Y.value[z]=void 0}else Y.value[z]=$.value}function wr($){let Y=Object.keys($.shape);for(let U of Y)if(!$.shape?.[U]?._zod?.traits?.has("$ZodType"))throw Error(`Invalidelementatkey"${U}":expectedaZodschema`);let z=zj($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(z)}}function Mr($,Y,z,U,I,Q){let J=[],K=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(K.has(Z))continue;if(H==="never"){J.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},U);if(q instanceof Promise)$.push(q.then((V)=>XV(V,z,Z,Y,W,X)));else XV(q,z,Z,Y,W,X)}if(J.length)z.issues.push({code:"unrecognized_keys",keys:J,input:Y,inst:Q});if(!$.length)return z;return Promise.all($).then(()=>{return z})}function zr($,Y,z,U){for(let Q of $)if(Q.issues.length===0)return Y.value=Q.value,Y;let I=$.filter((Q)=>!K7(Q));if(I.length===1)return Y.value=I[0].value,I[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:z,errors:$.map((Q)=>Q.issues.map((J)=>A8(J,U,a4())))}),Y}function Ur($,Y,z,U){let I=$.filter((Q)=>Q.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:z,errors:$.map((Q)=>Q.issues.map((J)=>A8(J,U,a4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:z,errors:[],inclusive:!1});return Y}function KE($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(J7($)&&J7(Y)){let z=Object.keys(Y),U=Object.keys($).filter((Q)=>z.indexOf(Q)!==-1),I={...$,...Y};for(let Q of U){let J=KE($[Q],Y[Q]);if(!J.valid)return{valid:!1,mergeErrorPath:[Q,...J.mergeErrorPath]};I[Q]=J.data}return{valid:!0,data:I}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let z=[];for(let U=0;U<$.length;U++){let I=$[U],Q=Y[U],J=KE(I,Q);if(!J.valid)return{valid:!1,mergeErrorPath:[U,...J.mergeErrorPath]};z.push(J.data)}return{valid:!0,data:z}}return{valid:!1,mergeErrorPath:[]}}function Ir($,Y,z){let U=new Map,I;for(let K of Y.issues)if(K.code==="unrecognized_keys"){I??(I=K);for(let G of K.keys){if(!U.has(G))U.set(G,{});U.get(G).l=!0}}else $.issues.push(K);for(let K of z.issues)if(K.code==="unrecognized_keys")for(let G of K.keys){if(!U.has(G))U.set(G,{});U.get(G).r=!0}else $.issues.push(K);let Q=[...U].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(Q.length&&I)$.issues.push({...I,keys:Q});if(K7($))return $;let J=KE(Y.value,z.value);if(!J.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}function Qr($,Y){for(let z=$.length-1;z>=0;z--)if($[z]._zod[Y]!=="optional")return z+1;return 0}function Jr($,Y,z){if($.issues.length)Y.issues.push(...f8(z,$.issues));Y.value[z]=$.value}function Kr($,Y,z,U,I){for(let Q=0;Q<z.length;Q++){let J=$[Q],K=Q<U.length;if(J.issues.length){if(!K&&Q>=I){Y.value.length=Q;break}Y.issues.push(...f8(Q,J.issues))}Y.value[Q]=J.value}for(let Q=Y.value.length-1;Q>=U.length;Q--)if(z[Q]._zod.optout==="optional"&&Y.value[Q]===void 0)Y.value.length=Q;else break;return Y}function Gr($,Y,z,U,I,Q,J){if($.issues.length)if(sK.has(typeof U))z.issues.push(...f8(U,$.issues));else z.issues.push({code:"invalid_key",origin:"map",input:I,inst:Q,issues:$.issues.map((K)=>A8(K,J,a4()))});if(Y.issues.length)if(sK.has(typeof U))z.issues.push(...f8(U,Y.issues));else z.issues.push({origin:"map",code:"invalid_element",input:I,inst:Q,key:U,issues:Y.issues.map((K)=>A8(K,J,a4()))});z.value.set($.value,Y.value)}function Hr($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function Wr($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function Xr($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function Zr($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function GV($,Y,z){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa
Line truncated
`)}q.write("payload.value = newResult;"),q.write("return payload;");let O=q.compile();return(D,N)=>O(Z,D,N)},Q,J=BY,K=!NY.jitless,W=K&&oT.value,H=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=U.value);let V=Z.value;if(!J(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(K&&W&&q?.async===!1&&q.jitless!==!0){if(!Q)Q=I(Y.shape);if(Z=Q(Z,q),!H)return Z;return Ir([],V,Z,q,X,$)}return z(Z,q)}});UG=W0("$ZodUnion",($,Y)=>{q1.init($,Y),T1($._zod,"optin",()=>Y.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),T1($._zod,"optout",()=>Y.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),T1($._zod,"values",()=>{if(Y.options.every((U)=>U._zod.values))return new Set(Y.options.flatMap((U)=>Array.from(U._zod.values)));return}),T1($._zod,"pattern",()=>{if(Y.options.every((U)=>U._zod.pattern)){let U=Y.options.map((I)=>I._zod.pattern);return new RegExp(`^(${U.map((I)=>mK(I.source)).join("|")})$`)}return});let z=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(U,I)=>{if(z)return z(U,I);let Q=!1,J=[];for(let K of Y.options){let G=K._zod.run({value:U.value,issues:[]},I);if(G instanceof Promise)J.push(G),Q=!0;else{if(G.issues.length===0)return G;J.push(G)}}if(!Q)return io(J,U,$,I);return Promise.all(J).then((K)=>{return io(K,U,$,I)})}});iE=W0("$ZodXor",($,Y)=>{UG.init($,Y),Y.inclusive=!1;let z=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(U,I)=>{if(z)return z(U,I);let Q=!1,J=[];for(let K of Y.options){let G=K._zod.run({value:U.value,issues:[]},I);if(G instanceof Promise)J.push(G),Q=!0;else J.push(G)}if(!Q)return co(J,U,$,I);return Promise.all(J).then((K)=>{return co(K,U,$,I)})}}),cE=W0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,UG.init($,Y);let z=$._zod.parse;T1($._zod,"propValues",()=>{let I={};for(let Q of Y.options){let J=Q._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(Q)}"`);for(let[K,G]of Object.entries(J)){if(!I[K])I[K]=new Set;for(let W of G)I[K].add(W)}}return I});let U=fU(()=>{let I=Y.options,Q=new Map;for(let J of I){let K=J._zod.propValues?.[Y.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(J)}"`);for(let G of K){if(Q.has(G))throw Error(`Duplicatediscriminatorvalue"${String(G)}"`);Q.set(G,J)}}return Q});$._zod.parse=(I,Q)=>{let J=I.value;if(!BY(J))return I.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),I;let K=U.value.get(J?.[Y.discriminator]);if(K)return K._zod.run(I,Q);if(Y.unionFallback||Q.direction==="backward")return z(I,Q);return I.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(U.value.keys()),input:J,path:[Y.discriminator],inst:$}),I}}),nE=W0("$ZodIntersection",($,Y)=>{q1.init($,Y),$._zod.parse=(z,U)=>{let I=z.value,Q=Y.left._zod.run({value:I,issues:[]},U),J=Y.right._zod.run({value:I,issues:[]},U);if(Q instanceof Promise||J instanceof Promise)return Promise.all([Q,J]).then(([G,W])=>{return no(z,G,W)});return no(z,Q,J)}});WV=W0("$ZodTuple",($,Y)=>{q1.init($,Y);let z=Y.items;$._zod.parse=(U,I)=>{let Q=U.value;if(!Array.isArray(Q))return U.issues.push({input:Q,inst:$,expected:"tuple",code:"invalid_type"}),U;U.value=[];let J=[],K=po(z,"optin"),G=po(z,"optout");if(!Y.rest){if(Q.length<K)return U.issues.push({code:"too_small",minimum:K,inclusive:!0,input:Q,inst:$,origin:"array"}),U;if(Q.length>z.length)U.issues.push({code:"too_big",maximum:z.length,inclusive:!0,input:Q,inst:$,origin:"array"})}let W=Array(z.length);for(let H=0;H<z.length;H++){let X=z[H]._zod.run({value:Q[H],issues:[]},I);if(X instanceof Promise)J.push(X.then((Z)=>{W[H]=Z}));else W[H]=X}if(Y.rest){let H=z.length-1,X=Q.slice(z.length);for(let Z of X){H++;let q=Y.rest._zod.run({value:Z,issues:[]},I);if(q instanceof Promise)J.push(q.then((V)=>mo(V,U,H)));else mo(q,U,H)}}if(J.length)return Promise.all(J).then(()=>lo(W,U,z,Q,G));return lo(W,U,z,Q,G)}});pE=W0("$ZodRecord",($,Y)=>{q1.init($,Y),$._zod.parse=(z,U)=>{let I=z.value;if(!J7(I))return z.issues.push({expected:"record",code:"invalid_type",input:I,inst:$}),z;let Q=[],J=Y.keyType._zod.values;if(J){z.value={};let K=new Set;for(let W of J)if(typeof W==="string"||typeof W==="number"||typeof W==="symbol"){K.add(typeof W==="number"?W.toString():W);let H=Y.keyType._zod.run({value:W,issues:[]},U);if(H instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(H.issues.length){z.issues.push({code:"invalid_key",origin:"record",issues:H.issues.map((q)=>P8(q,U,a4())),input:W,path:[W],inst:$});continue}let X=H.value,Z=Y.valueType._zod.run({value:I[W],issues:[]},U);if(Z instanceof Promise)Q.push(Z.then((q)=>{if(q.issues.length)z.issues.push(...f8(W,q.issues));z.value[X]=q.value}));else{if(Z.issues.length)z.issues.push(...f8(W,Z.issues));z.value[X]=Z.value}}let G;for(let W in I)if(!K.has(W))G=G??[],G.push(W);if(G&&G.length>0)z.issues.push({code:"unrec
Line truncated
`)}q.write("payload.value = newResult;"),q.write("return payload;");let O=q.compile();return(D,N)=>O(Z,D,N)},Q,J=TY,K=!AY.jitless,H=K&&eT.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=U.value);let V=Z.value;if(!J(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(K&&H&&q?.async===!1&&q.jitless!==!0){if(!Q)Q=I(Y.shape);if(Z=Q(Z,q),!W)return Z;return Mr([],V,Z,q,X,$)}return z(Z,q)}});JG=H0("$ZodUnion",($,Y)=>{q1.init($,Y),T1($._zod,"optin",()=>Y.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),T1($._zod,"optout",()=>Y.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),T1($._zod,"values",()=>{if(Y.options.every((U)=>U._zod.values))return new Set(Y.options.flatMap((U)=>Array.from(U._zod.values)));return}),T1($._zod,"pattern",()=>{if(Y.options.every((U)=>U._zod.pattern)){let U=Y.options.map((I)=>I._zod.pattern);return new RegExp(`^(${U.map((I)=>rK(I.source)).join("|")})$`)}return});let z=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(U,I)=>{if(z)return z(U,I);let Q=!1,J=[];for(let K of Y.options){let G=K._zod.run({value:U.value,issues:[]},I);if(G instanceof Promise)J.push(G),Q=!0;else{if(G.issues.length===0)return G;J.push(G)}}if(!Q)return zr(J,U,$,I);return Promise.all(J).then((K)=>{return zr(K,U,$,I)})}});mE=H0("$ZodXor",($,Y)=>{JG.init($,Y),Y.inclusive=!1;let z=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(U,I)=>{if(z)return z(U,I);let Q=!1,J=[];for(let K of Y.options){let G=K._zod.run({value:U.value,issues:[]},I);if(G instanceof Promise)J.push(G),Q=!0;else J.push(G)}if(!Q)return Ur(J,U,$,I);return Promise.all(J).then((K)=>{return Ur(K,U,$,I)})}}),lE=H0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,JG.init($,Y);let z=$._zod.parse;T1($._zod,"propValues",()=>{let I={};for(let Q of Y.options){let J=Q._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(Q)}"`);for(let[K,G]of Object.entries(J)){if(!I[K])I[K]=new Set;for(let H of G)I[K].add(H)}}return I});let U=bU(()=>{let I=Y.options,Q=new Map;for(let J of I){let K=J._zod.propValues?.[Y.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(J)}"`);for(let G of K){if(Q.has(G))throw Error(`Duplicatediscriminatorvalue"${String(G)}"`);Q.set(G,J)}}return Q});$._zod.parse=(I,Q)=>{let J=I.value;if(!TY(J))return I.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),I;let K=U.value.get(J?.[Y.discriminator]);if(K)return K._zod.run(I,Q);if(Y.unionFallback||Q.direction==="backward")return z(I,Q);return I.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(U.value.keys()),input:J,path:[Y.discriminator],inst:$}),I}}),oE=H0("$ZodIntersection",($,Y)=>{q1.init($,Y),$._zod.parse=(z,U)=>{let I=z.value,Q=Y.left._zod.run({value:I,issues:[]},U),J=Y.right._zod.run({value:I,issues:[]},U);if(Q instanceof Promise||J instanceof Promise)return Promise.all([Q,J]).then(([G,H])=>{return Ir(z,G,H)});return Ir(z,Q,J)}});VV=H0("$ZodTuple",($,Y)=>{q1.init($,Y);let z=Y.items;$._zod.parse=(U,I)=>{let Q=U.value;if(!Array.isArray(Q))return U.issues.push({input:Q,inst:$,expected:"tuple",code:"invalid_type"}),U;U.value=[];let J=[],K=Qr(z,"optin"),G=Qr(z,"optout");if(!Y.rest){if(Q.length<K)return U.issues.push({code:"too_small",minimum:K,inclusive:!0,input:Q,inst:$,origin:"array"}),U;if(Q.length>z.length)U.issues.push({code:"too_big",maximum:z.length,inclusive:!0,input:Q,inst:$,origin:"array"})}let H=Array(z.length);for(let W=0;W<z.length;W++){let X=z[W]._zod.run({value:Q[W],issues:[]},I);if(X instanceof Promise)J.push(X.then((Z)=>{H[W]=Z}));else H[W]=X}if(Y.rest){let W=z.length-1,X=Q.slice(z.length);for(let Z of X){W++;let q=Y.rest._zod.run({value:Z,issues:[]},I);if(q instanceof Promise)J.push(q.then((V)=>Jr(V,U,W)));else Jr(q,U,W)}}if(J.length)return Promise.all(J).then(()=>Kr(H,U,z,Q,G));return Kr(H,U,z,Q,G)}});rE=H0("$ZodRecord",($,Y)=>{q1.init($,Y),$._zod.parse=(z,U)=>{let I=z.value;if(!J7(I))return z.issues.push({expected:"record",code:"invalid_type",input:I,inst:$}),z;let Q=[],J=Y.keyType._zod.values;if(J){z.value={};let K=new Set;for(let H of J)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){K.add(typeof H==="number"?H.toString():H);let W=Y.keyType._zod.run({value:H,issues:[]},U);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){z.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((q)=>A8(q,U,a4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:I[H],issues:[]},U);if(Z instanceof Promise)Q.push(Z.then((q)=>{if(q.issues.length)z.issues.push(...f8(H,q.issues));z.value[X]=q.value}));else{if(Z.issues.length)z.issues.push(...f8(H,Z.issues));z.value[X]=Z.value}}let G;for(let H in I)if(!K.has(H))G=G??[],G.push(H);if(G&&G.length>0)z.issues.push({code:"unrec
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letJof$.seen.entries()){letK=J[1];if(Y===J[0]){Q(J);continue}if($.external){letW=$.external.registry.get(J[0])?.id;if(Y!==J[0]&&W){Q(J);continue}}if($.metadataRegistry.get(J[0])?.id){Q(J);continue}if(K.cycle){Q(J);continue}if(K.count>1){if($.reused==="ref"){Q(J);continue}}}}functionZ7($,Y){letz=$.seen.get(Y);if(!z)throwError("Unprocessed schema. This is a bug in Zod.");letU=(K)=>{letG=$.seen.get(K);if(G.ref===null)return;letW=G.def??G.schema,H={...W},X=G.ref;if(G.ref=null,X){U(X);letq=$.seen.get(X),V=q.schema;if(V.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))W.allOf=W.allOf??[],W.allOf.push(V);elseObject.assign(W,V);if(Object.assign(W,H),K._zod.parent===X)for(letMinW){if(M==="$ref"||M==="allOf")continue;if(!(MinH))deleteW[M]}if(V.$ref&&q.def)for(letMinW){if(M==="$ref"||M==="allOf")continue;if(Minq.def&&JSON.stringify(W[M])===JSON.stringify(q.def[M]))deleteW[M]}}letZ=K._zod.parent;if(Z&&Z!==X){U(Z);letq=$.seen.get(Z);if(q?.schema.$ref){if(W.$ref=q.schema.$ref,q.def)for(letVinW){if(V==="$ref"||V==="allOf")continue;if(Vinq.def&&JSON.stringify(W[V])===JSON.stringify(q.def[V]))deleteW[V]}}}$.override({zodSchema:K,jsonSchema:W,path:G.path??[]})};for(letKof[...$.seen.entries()].reverse())U(K[0]);letI={};if($.target==="draft-2020-12")I.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")I.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")I.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letK=$.external.registry.get(Y)?.id;if(!K)throwError("Schema is missing an `id` property");I.$id=$.external.uri(K)}Object.assign(I,z.def??z.schema);letQ=$.metadataRegistry.get(Y)?.id;if(Q!==void0&&I.id===Q)deleteI.id;letJ=$.external?.defs??{};for(letKof$.seen.entries()){letG=K[1];if(G.def&&G.defId){if(G.def.id===G.defId)deleteG.def.id;J[G.defId]=G.def}}if($.external);elseif(Object.keys(J).length>0)if($.target==="draft-2020-12")I.$defs=J;elseI.definitions=J;try{letK=JSON.parse(JSON.stringify(I));returnObject.defineProperty(K,"~standard",{value:{...Y["~standard"],jsonSchema:{input:QI(Y,"input",$.processors),output:QI(Y,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functionA8($,Y){letz=Y??{seen:newSet};if(z.seen.has($))return!1;z.seen.add($);letU=$._zod.def;if(U.type==="transform")return!0;if(U.type==="array")returnA8(U.element,z);if(U.type==="set")returnA8(U.valueType,z);if(U.type==="lazy")returnA8(U.getter(),z);if(U.type==="promise"||U.type==="optional"||U.type==="nonoptional"||U.type==="nullable"||U.type==="readonly"||U.type==="default"||U.type==="prefault")returnA8(U.innerType,z);if(U.type==="intersection")returnA8(U.left,z)||A8(U.right,z);if(U.type==="record"||U.type==="map")returnA8(U.keyType,z)||A8(U.valueType,z);if(U.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnA8(U.in,z)||A8(U.out,z)}if(U.type==="object"){for(letIinU.shape)if(A8(U.shape[I],z))return!0;return!1}if(U.type==="union"){for(letIofU.options)if(A8(I,z))return!0;return!1}if(U.type==="tuple"){for(letIofU.items)if(A8(I,z))return!0;if(U.rest&&A8(U.rest,z))return!0;return!1}return!1}var$_=($,Y={})=>(z)=>{letU=H7({...z,processors:Y});returnJ4($,U),X7(U,$),Z7(U,$)},QI=($,Y,z={})=>(U)=>{let{libraryOptions:I,target:Q}=U??{},J=H7({...I??{},target:Q,io:Y,processors:z});returnJ4($,J),X7(J,$),Z7(J,$)};varqG=o(()=>{HG()});functionRY($,Y){if("_idmap"in$){letU=$,I=H7({...Y,processors:fV}),Q={};for(letGofU._idmap.entries()){let[W,H]=G;J4(H,I)}letJ={},K={registry:U,uri:Y?.uri,defs:Q};I.external=K;for(letGofU._idmap.entries()){let[W,H]=G;X7(I,H),J[W]=Z7(I,H)}if(Object.keys(Q).length>0){letG=I.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[G]:Q}}return{schemas:J}}letz=H7({...Y,processors:fV});returnJ4($,z),X7(z,$),Z7(z,$)}varTx0,Y_=($,Y,z,U)=>{letI=z;I.type="string";let{minimum:Q,maximum:J,format:K,patterns:G,contentEncoding:W}=$._zod.bag;if(typeofQ==="number")I.minLength=Q;if(typeofJ==="number")I.maxLength=J;if(K){if(I.format=Tx0[K]??K,I.format==="")deleteI.format;if(K==="time")deleteI.format}if(W)I.contentEncoding=W;if(G&&G.size>0){letH=[...G];if(H.length===1)I.pattern=H[0].source;elseif(H.length>1)I.allOf=[...H.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},z_=($,Y,z,U)=>{letI=z,{minimum:Q,maximum:J,format:K,multipleOf:G,exclusiveMaximum:W,exclusiveMinimum:H}=$._zod.bag;if(typeofK==="string"&&K.includes("int"))I.type="integer";elseI.type="number";letX=typeofH==="number"&&H>=(Q??Number.NEGATIVE_INFINITY),Z=typeofW==="number"&&W<=(J??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)I.minimum=H,I.exclusiveMinimum=!0;elseI.exclusiveMinimuLine truncated
`}function Qu0($){let Y=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Toolnameexceedsmaximumlengthof128characters(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(!Iu0.test($)){let z=[...$].filter((U)=>!/[A-Za-z0-9._-]/.test(U)).filter((U,I,Q)=>Q.indexOf(U)===I);return Y.push(`Toolnamecontainsinvalidcharacters:${z.map((U)=>`"${U}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function Ju0($,Y){if(Y.length>0){console.warn(`Toolnamevalidationwarningfor"${$}":`);for(let z of Y)console.warn(`-${z}`);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 ah($){let Y=Qu0($);return Ju0($,Y.warnings),Y.isValid}function Ku0($){return typeof $==="object"&&$!==null&&"_zod"in $}function Gu0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function Wu0($){if(typeof $!=="object"||$===null)return!1;if(CI($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((z)=>Ku0(z))}function Aw($){if($===void 0)return;if(Wu0($))return z0($);if(typeof $==="object"&&$!==null&&!CI($)&&Object.values($).some((Y)=>Gu0(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(!CI($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var Th,ix0,P1,V1,cx0,ta="2026-07-28",T7,Yt,dx0,mx0,lx0,It,Qt,rx0,Gw,Qf1,Jf1,ba,Sh,Yf0,zf0,jI,n0,Q1,ww,Gt,_I,Mw,Qf0=0,Jf0="private",Kf0,Lf0,Hw,xh,Xt,Kf1,Gf1,Df0,Pf0,fh,Xw,GW="2026-07-28",Vt,Tf0,D$=($)=>gG.safeParse($).success,j7=($)=>yG.safeParse($).success,JW=($)=>LI.safeParse($).success,Pw=($)=>FI.safeParse($).success,r9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",da="x-mcp-header",jf0,Ef0,Cf0,Rf0,Vw=-32020,Wf1,_f0,ma=!1,Eh="draft-2020-12",Sf0,ff0,uf0,la,bf0,mf0,wt=250,lf0,of0,Dt,Pt,rf0,sf0,At=60000,tf0,ef0,$u0,Tt,lh,Uu0,Hf1,jt=10485760,rh=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??jt}append($){if((this._buffer?.length??0)+$.length>this._maxBufferSize)throw this.clear(),Error(`ReadBufferexceededmaximumsizeof${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 Et(Y)}catch(z){if(z instanceof SyntaxError)continue;throw z}}return null}clear(){this._buffer=void 0}},Iu0;var Tw=o(()=>{cT();nT();xa();pv();Th=Symbol.for("mcp.sdk.errorBrands");ix0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return EI(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 EI(this,Y)}constructor(Y,z,U){super(z);this.code=Y,this.errorUri=U,this.name="OAuthError",Rh(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)}},P1=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",$}({}),V1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance]($){return EI(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 EI(this,$)}constructor($,Y,z){super(Y);this.code=$,this.data=z,this.name="SdkError",Rh(this,new.target)}},cx0=class extends V1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,Y,z){super($,Y,z);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};T7=[ta];Yt=["task","inputRequests","requestState"];mx0=new Set(["const","enum","default","examples"]),lx0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);It={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},Qt={"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},rx0={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};Qf1=Object.keys(It),Jf1=Object.keys(Qt);ba={ok:!1,reason:"not-in-era"};Sh={era:"2025-11-25",hasRequestMethod:Jt,hasNotificationMethod:Kt,validateRequest:($,Y)=>Ww(tx0($),Y),validateResult:($,Y)=>Ww(ax0($),Y),validateNotification:($,Y)=>Ww(ex0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>ba,validateInputResponse:()=>ba,samplingResultVariant:($,Y)=>{let z=zt();return Ww($?z.CreateMessageResultWithToolsSchema:z.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let z=$t($),U=z.structuredContent;if(U===void 0)return z;let I=typeof U!=="object"||U===null||Array.isArray(U),Q=Y!==void 0&&Ut(Y);if(!I&&!Q)return z;return{...z,structuredContent:{result:U}}},decodeResult($,Y){if(jh(Y)&&"resultType"in Y){let z={...Y};return delete z.resultType,{kind:"complete",result:ca(z)}}return{kind:"complete",result:ca(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;l
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letJof$.seen.entries()){letK=J[1];if(Y===J[0]){Q(J);continue}if($.external){letH=$.external.registry.get(J[0])?.id;if(Y!==J[0]&&H){Q(J);continue}}if($.metadataRegistry.get(J[0])?.id){Q(J);continue}if(K.cycle){Q(J);continue}if(K.count>1){if($.reused==="ref"){Q(J);continue}}}}functionZ7($,Y){letz=$.seen.get(Y);if(!z)throwError("Unprocessed schema. This is a bug in Zod.");letU=(K)=>{letG=$.seen.get(K);if(G.ref===null)return;letH=G.def??G.schema,W={...H},X=G.ref;if(G.ref=null,X){U(X);letq=$.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);elseObject.assign(H,V);if(Object.assign(H,W),K._zod.parent===X)for(letMinH){if(M==="$ref"||M==="allOf")continue;if(!(MinW))deleteH[M]}if(V.$ref&&q.def)for(letMinH){if(M==="$ref"||M==="allOf")continue;if(Minq.def&&JSON.stringify(H[M])===JSON.stringify(q.def[M]))deleteH[M]}}letZ=K._zod.parent;if(Z&&Z!==X){U(Z);letq=$.seen.get(Z);if(q?.schema.$ref){if(H.$ref=q.schema.$ref,q.def)for(letVinH){if(V==="$ref"||V==="allOf")continue;if(Vinq.def&&JSON.stringify(H[V])===JSON.stringify(q.def[V]))deleteH[V]}}}$.override({zodSchema:K,jsonSchema:H,path:G.path??[]})};for(letKof[...$.seen.entries()].reverse())U(K[0]);letI={};if($.target==="draft-2020-12")I.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")I.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")I.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letK=$.external.registry.get(Y)?.id;if(!K)throwError("Schema is missing an `id` property");I.$id=$.external.uri(K)}Object.assign(I,z.def??z.schema);letQ=$.metadataRegistry.get(Y)?.id;if(Q!==void0&&I.id===Q)deleteI.id;letJ=$.external?.defs??{};for(letKof$.seen.entries()){letG=K[1];if(G.def&&G.defId){if(G.def.id===G.defId)deleteG.def.id;J[G.defId]=G.def}}if($.external);elseif(Object.keys(J).length>0)if($.target==="draft-2020-12")I.$defs=J;elseI.definitions=J;try{letK=JSON.parse(JSON.stringify(I));returnObject.defineProperty(K,"~standard",{value:{...Y["~standard"],jsonSchema:{input:KI(Y,"input",$.processors),output:KI(Y,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functionB8($,Y){letz=Y??{seen:newSet};if(z.seen.has($))return!1;z.seen.add($);letU=$._zod.def;if(U.type==="transform")return!0;if(U.type==="array")returnB8(U.element,z);if(U.type==="set")returnB8(U.valueType,z);if(U.type==="lazy")returnB8(U.getter(),z);if(U.type==="promise"||U.type==="optional"||U.type==="nonoptional"||U.type==="nullable"||U.type==="readonly"||U.type==="default"||U.type==="prefault")returnB8(U.innerType,z);if(U.type==="intersection")returnB8(U.left,z)||B8(U.right,z);if(U.type==="record"||U.type==="map")returnB8(U.keyType,z)||B8(U.valueType,z);if(U.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnB8(U.in,z)||B8(U.out,z)}if(U.type==="object"){for(letIinU.shape)if(B8(U.shape[I],z))return!0;return!1}if(U.type==="union"){for(letIofU.options)if(B8(I,z))return!0;return!1}if(U.type==="tuple"){for(letIofU.items)if(B8(I,z))return!0;if(U.rest&&B8(U.rest,z))return!0;return!1}return!1}varQ_=($,Y={})=>(z)=>{letU=W7({...z,processors:Y});returnJ4($,U),X7(U,$),Z7(U,$)},KI=($,Y,z={})=>(U)=>{let{libraryOptions:I,target:Q}=U??{},J=W7({...I??{},target:Q,io:Y,processors:z});returnJ4($,J),X7(J,$),Z7(J,$)};varFG=o(()=>{qG()});functionvY($,Y){if("_idmap"in$){letU=$,I=W7({...Y,processors:nV}),Q={};for(letGofU._idmap.entries()){let[H,W]=G;J4(W,I)}letJ={},K={registry:U,uri:Y?.uri,defs:Q};I.external=K;for(letGofU._idmap.entries()){let[H,W]=G;X7(I,W),J[H]=Z7(I,W)}if(Object.keys(Q).length>0){letG=I.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[G]:Q}}return{schemas:J}}letz=W7({...Y,processors:nV});returnJ4($,z),X7(z,$),Z7(z,$)}varox0,J_=($,Y,z,U)=>{letI=z;I.type="string";let{minimum:Q,maximum:J,format:K,patterns:G,contentEncoding:H}=$._zod.bag;if(typeofQ==="number")I.minLength=Q;if(typeofJ==="number")I.maxLength=J;if(K){if(I.format=ox0[K]??K,I.format==="")deleteI.format;if(K==="time")deleteI.format}if(H)I.contentEncoding=H;if(G&&G.size>0){letW=[...G];if(W.length===1)I.pattern=W[0].source;elseif(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}))]}},K_=($,Y,z,U)=>{letI=z,{minimum:Q,maximum:J,format:K,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeofK==="string"&&K.includes("int"))I.type="integer";elseI.type="number";letX=typeofW==="number"&&W>=(Q??Number.NEGATIVE_INFINITY),Z=typeofH==="number"&&H<=(J??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)I.minimum=W,I.exclusiveMinimum=!0;elseI.exclusiveMinimuLine truncated
`}function Cu0($){let Y=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Toolnameexceedsmaximumlengthof128characters(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(!Eu0.test($)){let z=[...$].filter((U)=>!/[A-Za-z0-9._-]/.test(U)).filter((U,I,Q)=>Q.indexOf(U)===I);return Y.push(`Toolnamecontainsinvalidcharacters:${z.map((U)=>`"${U}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function Ru0($,Y){if(Y.length>0){console.warn(`Toolnamevalidationwarningfor"${$}":`);for(let z of Y)console.warn(`-${z}`);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 zS($){let Y=Cu0($);return Ru0($,Y.warnings),Y.isValid}function _u0($){return typeof $==="object"&&$!==null&&"_zod"in $}function vu0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function hu0($){if(typeof $!=="object"||$===null)return!1;if(_I($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((z)=>_u0(z))}function Rw($){if($===void 0)return;if(hu0($))return z0($);if(typeof $==="object"&&$!==null&&!_I($)&&Object.values($).some((Y)=>vu0(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(!_I($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var _h,Wf0,A1,V1,Xf0,Zt="2026-07-28",T7,Lt,Vf0,Lf0,Ff0,Mt,Ot,Mf0,qw,kf1,xf1,$t,fh,Bf0,Tf0,CI,n0,Q1,Aw,At,hI,Pw,Cf0=0,Rf0="private",_f0,ff0,Lw,ch,Tt,ff1,uf1,pf0,df0,nh,Fw,XH="2026-07-28",Ct,of0,D$=($)=>xG.safeParse($).success,j7=($)=>fG.safeParse($).success,HH=($)=>wI.safeParse($).success,Ew=($)=>MI.safeParse($).success,r9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",Qt="x-mcp-header",rf0,sf0,af0,tf0,Ow=-32020,bf1,ef0,Jt=!1,hh="draft-2020-12",zu0,Ku0,Gu0,Kt,Hu0,Lu0,vt=250,Fu0,wu0,yt,kt,Mu0,Ou0,ft=60000,Du0,Au0,Pu0,ut,th,ju0,if1,bt=10485760,$S=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??bt}append($){if((this._buffer?.length??0)+$.length>this._maxBufferSize)throw this.clear(),Error(`ReadBufferexceededmaximumsizeof${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 it(Y)}catch(z){if(z instanceof SyntaxError)continue;throw z}}return null}clear(){this._buffer=void 0}},Eu0;var _w=o(()=>{lT();oT();aa();rv();_h=Symbol.for("mcp.sdk.errorBrands");Wf0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return RI(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 RI(this,Y)}constructor(Y,z,U){super(z);this.code=Y,this.errorUri=U,this.name="OAuthError",gh(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)}},A1=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",$}({}),V1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance]($){return RI(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 RI(this,$)}constructor($,Y,z){super(Y);this.code=$,this.data=z,this.name="SdkError",gh(this,new.target)}},Xf0=class extends V1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,Y,z){super($,Y,z);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};T7=[Zt];Lt=["task","inputRequests","requestState"];Lf0=new Set(["const","enum","default","examples"]),Ff0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);Mt={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},Ot={"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},Mf0={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};kf1=Object.keys(Mt),xf1=Object.keys(Ot);$t={ok:!1,reason:"not-in-era"};fh={era:"2025-11-25",hasRequestMethod:Nt,hasNotificationMethod:Dt,validateRequest:($,Y)=>Vw(Df0($),Y),validateResult:($,Y)=>Vw(Nf0($),Y),validateNotification:($,Y)=>Vw(Af0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>$t,validateInputResponse:()=>$t,samplingResultVariant:($,Y)=>{let z=Ft();return Vw($?z.CreateMessageResultWithToolsSchema:z.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let z=Vt($),U=z.structuredContent;if(U===void 0)return z;let I=typeof U!=="object"||U===null||Array.isArray(U),Q=Y!==void 0&&wt(Y);if(!I&&!Q)return z;return{...z,structuredContent:{result:U}}},decodeResult($,Y){if(vh(Y)&&"resultType"in Y){let z={...Y};return delete z.resultType,{kind:"complete",result:zt(z)}}return{kind:"complete",result:zt(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;l
Line truncated
*content-type
*Copyright(c)2015DouglasChristopherWilson
*MITLicensed
*/Uu0=R0(($)=>{var Y=/;*([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,z=/\\([\u000b\u0020-\u00ff])/g,U=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;$.parse=I;function I(K){if(!K)throw TypeError("argument string is required");var G=typeof K==="object"?Q(K):K;if(typeof G!=="string")throw TypeError("argument string is required to be a string");var W=G.indexOf(";"),H=W!==-1?G.slice(0,W).trim():G.trim();if(!U.test(H))throw TypeError("invalid media type");var X=new J(H.toLowerCase());if(W!==-1){var Z,q,V;Y.lastIndex=W;while(q=Y.exec(G)){if(q.index!==W)throw TypeError("invalid parameter format");if(W+=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(z,"$1")}X.parameters[Z]=V}if(W!==G.length)throw TypeError("invalid parameter format")}return X}function Q(K){var G;if(typeof K.getHeader==="function")G=K.getHeader("content-type");else if(typeof K.headers==="object")G=K.headers&&K.headers["content-type"];if(typeof G!=="string")throw TypeError("content-type header is missing from object");return G}function J(K){this.parameters=Object.create(null),this.type=K}}),Hf1=fq(Uu0(),1);Iu0=/^[A-Za-z0-9._-]{1,128}$/});function th($){let Y=new $({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Tb0(Y),Y}var jw,Ct,L1,v1,U5,Cw,Hu0,Rt,_t,Ew,Xu0,I5,Zu0,qu0,vt,Vu0,Rw,vI,HW,hI,_w,Lu0,ht,Fu0,wu0,Mu0,eh,Ou0,$S,St,Nu0,Du0,Pu0,Bu0,Au0,Tu0,ju0,Eu0,YS,Cu0,Ru0,_u0,gt,yt,kt,vu0,hu0,Su0,zS,gu0,xt,yu0,ku0,xu0,fu0,uu0,bu0,iu0,cu0,ft,nu0,ut,bt,it,pu0,US,du0,ct,nt,pt,mu0,lu0,dt,ou0,ru0,su0,mt,au0,tu0,lt,eu0,$b0,Yb0,zb0,Ub0,Ib0,Qb0,Jb0,Kb0,Gb0,Wb0,Hb0,Xb0,Zb0,qb0,Vb0,Lb0,Fb0,wb0,Mb0,Ob0,Nb0,Db0,ot,Pb0,Bb0,Ab0,Tb0,vw=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor($){this._userAjv=$!==void 0,this._ajv=$}get ajv(){return this._ajv??=th(Bb0.Ajv2020)}_engineFor($){if(this._userAjv)return this.ajv;let Y=jo($,"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??=th(Pb0.Ajv2019);return this._ajvDraft7??=th(ot.Ajv)}getValidator($){let Y=this._engineFor($),z="$id"in $&&typeof $.$id==="string"?Y.getSchema($.$id)??Y.compile($):Y.compile($);return(U)=>{return z(U)?{valid:!0,data:U,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Y.errorsText(z.errors)}}}},Pf1;var rt=o(()=>{cT();nT();jw=R0(($)=>{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 z=class extends Y{constructor(w){super();if(!$.IDENTIFIER.test(w))throw Error("CodeGen: name must be a valid identifier");this.str=w}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};$.Name=z;var U=class extends Y{constructor(w){super();this._items=typeof w==="string"?[w]:w}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let w=this._items[0];return w===""||w==='""'}get str(){var w;return(w=this._str)!==null&&w!==void 0?w:this._str=this._items.reduce((O,D)=>`${O}${D}`,"")}get names(){var w;return(w=this._names)!==null&&w!==void 0?w:this._names=this._items.reduce((O,D)=>{if(D instanceof z)O[D.str]=(O[D.str]||0)+1;return O},{})}};$._Code=U,$.nil=new U("");function I(w,...O){let D=[w[0]],N=0;while(N<O.length)K(D,O[N]),D.push(w[++N]);return new U(D)}$._=I;let Q=new U("+");function J(w,...O){let D=[q(w[0])],N=0;while(N<O.length)D.push(Q),K(D,O[N]),D.push(Q,q(w[++N]));return G(D),new U(D)}$.str=J;function K(w,O){if(O instanceof U)w.push(...O._items);else if(O instanceof z)w.push(O);else w.push(X(O))}$.addCodeArg=K;function G(w){let O=1;while(O<w.length-1){if(w[O]===Q){let D=W(w[O-1],w[O+1]);if(D!==void 0){w.splice(O-1,3,D);continue}w[O++]="+"}O++}}function W(w,O){if(O==='""')return w;if(w==='""')return O;if(typeof w=="string"){if(O instanceof z||w[w.length-1]!=='"')return;if(typeof O!="string")return`${w.slice(0,-1)}${O}"`;if(O[0]==='"')return w.slice(0,-1)+O.slice(1);return}if(typeof O=="string"&&O[0]==='"'&&!(w instanceof z))return`"${w}${O.slice(1)}`}function H(w,O){return O.emptyStr()?w:w.emptyStr()?O:J`${w}${O}`}$.strConcat=H;function X(w){return typeof w=="number"||typeof w=="boolean"||w===null?w:q(Array.isArray(w)?w.join(","):w)}function Z(w){return new U(q(w))}$.stringify=Z;function q(w){return JSON.stringify(w).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}$.safeStringify=q;function V(w){return typeof w=="string"&&$.IDENTIFIER.test(w)?new U(`.${w}`):I`[${w}]`}$.getProperty=V;function F(w){if(typeof w=="string"&&$.IDENTIFIER.test(w))returnnewU(`${w}`);throwError(`CodeGen: invalid export name: ${w}, use explicit $id name mapping`)}$.getEsmExportName=F;functionM(w){returnnewU(w.toStringLine truncated
deps:${H}}`};let I={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[W,H]=Q(G);J(G,W),K(G,H)}};function Q({schema:G}){let W={},H={};for(let X in G){if(X==="__proto__")continue;let Z=Array.isArray(G[X])?W:H;Z[X]=G[X]}return[W,H]}function J(G,W=G.schema){let{gen:H,data:X,it:Z}=G;if(Object.keys(W).length===0)return;let q=H.let("missing");for(let V in W){let F=W[V];if(F.length===0)continue;let M=(0,U.propertyInData)(H,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:F.length,deps:F.join(", ")}),Z.allErrors)H.if(M,()=>{for(let w of F)(0,U.checkReportMissingProp)(G,w)});else H.if(Y._`${M}&&(${(0,U.checkMissingProp)(G,F,q)})`),(0,U.reportMissingProp)(G,q),H.else()}}$.validatePropertyDeps=J;function K(G,W=G.schema){let{gen:H,data:X,keyword:Z,it:q}=G,V=H.name("valid");for(let F in W){if((0,z.alwaysValidSchema)(q,W[F]))continue;H.if((0,U.propertyInData)(H,X,F,q.opts.ownProperties),()=>{let M=G.subschema({keyword:Z,schemaProp:F},V);G.mergeValidEvaluated(M,V)},()=>H.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=K,$.default=I}),gu0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=L1(),z=v1(),U={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:Q,schema:J,data:K,it:G}=I;if((0,z.alwaysValidSchema)(G,J))return;let W=Q.name("valid");Q.forIn("key",K,(H)=>{I.setParams({propertyName:H}),I.subschema({keyword:"propertyNames",data:H,dataTypes:["string"],propertyName:H,compositeRule:!0},W),Q.if((0,Y.not)(W),()=>{if(I.error(!0),!G.allErrors)Q.break()})}),I.ok(W)}};$.default=U}),xt=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=I5(),z=L1(),U=U5(),I=v1(),Q={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:J})=>z._`{additionalProperty:${J.additionalProperty}}`},code(J){let{gen:K,schema:G,parentSchema:W,data:H,errsCount:X,it:Z}=J;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 F=(0,Y.allSchemaProperties)(W.properties),M=(0,Y.allSchemaProperties)(W.patternProperties);w(),J.ok(z._`${X}===${U.default.errors}`);function w(){K.forIn("key",H,(T)=>{if(!F.length&&!M.length)N(T);else K.if(O(T),()=>N(T))})}function O(T){let P;if(F.length>8){let j=(0,I.schemaRefOrVal)(Z,W.properties,"properties");P=(0,Y.isOwnProperty)(K,j,T)}else if(F.length)P=(0,z.or)(...F.map((j)=>z._`${T}===${j}`));else P=z.nil;if(M.length)P=(0,z.or)(P,...M.map((j)=>z._`${(0,Y.usePattern)(J,j)}.test(${T})`));return(0,z.not)(P)}function D(T){K.code(z._`delete${H}[${T}]`)}function N(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){D(T);return}if(G===!1){if(J.setParams({additionalProperty:T}),J.error(),!q)K.break();return}if(typeof G=="object"&&!(0,I.alwaysValidSchema)(Z,G)){let P=K.name("valid");if(V.removeAdditional==="failing")A(T,P,!1),K.if((0,z.not)(P),()=>{J.reset(),D(T)});else if(A(T,P),!q)K.if((0,z.not)(P),()=>K.break())}}function A(T,P,j){let C={keyword:"additionalProperties",dataProp:T,dataPropType:I.Type.Str};if(j===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});J.subschema(C,P)}}};$.default=Q}),yu0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=vI(),z=I5(),U=v1(),I=xt(),Q={keyword:"properties",type:"object",schemaType:"object",code(J){let{gen:K,schema:G,parentSchema:W,data:H,it:X}=J;if(X.opts.removeAdditional==="all"&&W.additionalProperties===void 0)I.default.code(new Y.KeywordCxt(X,I.default,"additionalProperties"));let Z=(0,z.allSchemaProperties)(G);for(let w of Z)X.definedProperties.add(w);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=U.mergeEvaluated.props(K,(0,U.toHash)(Z),X.props);let q=Z.filter((w)=>!(0,U.alwaysValidSchema)(X,G[w]));if(q.length===0)return;let V=K.name("valid");for(let w of q){if(F(w))M(w);else{if(K.if((0,z.propertyInData)(K,H,w,X.opts.ownProperties)),M(w),!X.allErrors)K.else().var(V,!0);K.endIf()}J.it.definedProperties.add(w),J.ok(V)}function F(w){return X.opts.useDefaults&&!X.compositeRule&&G[w].default!==void 0}function M(w){J.subschema({keyword:"properties",schemaProp:w,dataProp:w},V)}}};$.default=Q}),ku0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=I5(),z=L1(),U=v1(),I=v1(),Q={keyword:"patternProperties",type:"object",schemaType:"object",code(J){let{gen:K,schema:G,data:W,parentSchema:H,it:X}=J,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((A)=>(0,U.alwaysValidSchema)(X,G[A]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let F=Z.strictSchema&&!Z.allowMatchingProperties&&H.properties,M=K.name("valid");if(X.props!==!0&&!(X.props instanceof z.Name))X.props=(0,I.evaluatedPropsToName)(K,X.props);let{props:w}=X;O();function O(){for(let A of q){if(F)D(A);if(X.allErrors)
Line truncated
`)}openNode($,Y){let z=this.tos,U=this._xml;if(z&&this.open)U.push(">");this._stack.push($),U.push("<"),U.push($),Fk(U,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)D30(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");Fk(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(N30.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,z){if(this.openNode($,Y),z!==void 0)this.writeText(z);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("")}}wk.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};P30.exports=wk});var Mk=E((ca0)=>{var B30=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ia0($){if(typeof $==="string")return $;if(B30)return B30.decode($);return $.toString()}ca0.bufferToString=ia0});var C30=E((T30)=>{Object.defineProperty(T30,"__esModule",{value:!0});T30.CHAR=`
`;g30.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";g30.NAME_CHAR="-"+g30.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";g30.CHAR_RE=new RegExp("^["+g30.CHAR+"]$","u");g30.RESTRICTED_CHAR_RE=new RegExp("^["+g30.RESTRICTED_CHAR+"]$","u");g30.S_RE=new RegExp("^["+g30.S+"]+$","u");g30.NAME_START_CHAR_RE=new RegExp("^["+g30.NAME_START_CHAR+"]$","u");g30.NAME_CHAR_RE=new RegExp("^["+g30.NAME_CHAR+"]$","u");g30.NAME_RE=new RegExp("^["+g30.NAME_START_CHAR+"]["+g30.NAME_CHAR+"]*$","u");g30.NMTOKEN_RE=new RegExp("^["+g30.NAME_CHAR+"]+$","u");var R30=9,_30=10,v30=13,h30=32;g30.S_LIST=[h30,_30,v30,R30];function It0($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}g30.isChar=It0;function Qt0($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}g30.isRestrictedChar=Qt0;function Jt0($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}g30.isCharAndNotRestricted=Jt0;function Kt0($){return $===h30||$===_30||$===v30||$===R30}g30.isS=Kt0;function S30($){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}g30.isNameStartChar=S30;function Gt0($){return S30($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}g30.isNameChar=Gt0});var i30=E((b30)=>{Object.defineProperty(b30,"__esModule",{value:!0});b30.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";b30.NC_NAME_CHAR="-"+b30.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";b30.NC_NAME_START_CHAR_RE=new RegExp("^["+b30.NC_NAME_START_CHAR+"]$","u");b30.NC_NAME_CHAR_RE=new RegExp("^["+b30.NC_NAME_CHAR+"]$","u");b30.NC_NAME_RE=new RegExp("^["+b30.NC_NAME_START_CHAR+"]["+b30.NC_NAME_CHAR+"]*$","u");function u30($){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}b30.isNCNameStartChar=u30;function Bt0($){return u30($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}b30.isNCNameChar=Bt0});var W70=E((G70)=>{Object.defineProperty(G70,"__esModule",{value:!0});var TQ=C30(),Rt0=f30(),kk=i30(),p8=TQ.isS,_t0=TQ.isChar,CH=TQ.isNameStartChar,c30=TQ.isNameChar,z70=TQ.S_LIST,vt0=TQ.NAME_RE,ht0=Rt0.isChar,St0=kk.isNCNameStartChar,gt0=kk.isNCNameChar,yt0=kk.NC_NAME_RE,nO="http://www.w3.org/XML/1998/namespace",AQ="http://www.w3.org/2000/xmlns/",kt0={__proto__:null,xml:nO,xmlns:AQ},xt0={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},k4=-1,Q9=-2,n30=0,ft0=1,Ak=2,ut0=3,DQ=4,bt0=5,it0=6,ct0=7,Tk=8,nt0=9,pt0=10,dt0=11,mt0=12,C8=13,fO=14,jk=15,lt0=16,Ek=17,ot0=18,rt0=19,Ck=20,st0=21,at0=22,tt0=23,p30=24,Rk=25,uO=26,d30=27,et0=28,$e0=29,m30=30,Ye0=31,ze0=32,Jz=33,Ue0=34,_k=35,RH=36,vk=37,Ie0=38,l30=39,o30=40,Qe0=41,r30=42,Je0=43,Ke0=44,hk=9,q5=10,Sk=13,s30=32,a30=33,U70=34,_H=38,I70=39,bO=45,iO=47,Ge0=59,r7=60,PQ=61,A6=62,o6=63,Q70=91,BQ=93,t30=133,e30=8232,cO=($)=>$===U70||$===I70,J70=[U70,I70],We0=[...J70,Q70,A6],He0=[...J70,r7,BQ],Xe0=[PQ,o6,...z70],Ze0=[...z70,A6,_H,r7];function yk($,Y,z){switch(Y){case"xml":if(z!==nO)$.fail(`xmlprefixmustbeboundto${nO}.`);break;case"xmlns":if(z!==AQ)$.fail(`xmlnsprefixmustbeboundto${AQ}.`);break;default:}switch(z){case AQ:$.fail(Y===""?`thedefaultnamespacemaynotbesetto${z}.`:`maynotassignaprefix(even"xmlns")totheURI${AQ}.`);break;case nO:switch(Y){case"xml":break;case"":$.fail(`thedefaultnamespacemaynotbesetto${z}.`);break;default:$.fail("may not assign the xml namespace to another prefix.")}break;default:}}function qe0($,Y){for(let z of Object.keys(Y))yk($,z,Y[z])}var Ve0=($)=>yt0.test($),Le0=($)=>vt0.test($),Kz=0,$70=1,gk=2;G70.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var Y70={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 K70{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=St0,this.nameCheck=gt0,this.isName=Ve0,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},kt0);let z=this.opt.additionalNamesp
Line truncated
depsCount:${H},
deps:${W}}`};let I={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[H,W]=Q(G);J(G,H),K(G,W)}};function Q({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 J(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 F=H[V];if(F.length===0)continue;let M=(0,U.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:F.length,deps:F.join(", ")}),Z.allErrors)W.if(M,()=>{for(let w of F)(0,U.checkReportMissingProp)(G,w)});else W.if(Y._`${M}&&(${(0,U.checkMissingProp)(G,F,q)})`),(0,U.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=J;function K(G,H=G.schema){let{gen:W,data:X,keyword:Z,it:q}=G,V=W.name("valid");for(let F in H){if((0,z.alwaysValidSchema)(q,H[F]))continue;W.if((0,U.propertyInData)(W,X,F,q.opts.ownProperties),()=>{let M=G.subschema({keyword:Z,schemaProp:F},V);G.mergeValidEvaluated(M,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=K,$.default=I}),Ub0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=L1(),z=v1(),U={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:Q,schema:J,data:K,it:G}=I;if((0,z.alwaysValidSchema)(G,J))return;let H=Q.name("valid");Q.forIn("key",K,(W)=>{I.setParams({propertyName:W}),I.subschema({keyword:"propertyNames",data:W,dataTypes:["string"],propertyName:W,compositeRule:!0},H),Q.if((0,Y.not)(H),()=>{if(I.error(!0),!G.allErrors)Q.break()})}),I.ok(H)}};$.default=U}),at=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=I5(),z=L1(),U=U5(),I=v1(),Q={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:J})=>z._`{additionalProperty:${J.additionalProperty}}`},code(J){let{gen:K,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=J;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 F=(0,Y.allSchemaProperties)(H.properties),M=(0,Y.allSchemaProperties)(H.patternProperties);w(),J.ok(z._`${X}===${U.default.errors}`);function w(){K.forIn("key",W,(T)=>{if(!F.length&&!M.length)N(T);else K.if(O(T),()=>N(T))})}function O(T){let A;if(F.length>8){let j=(0,I.schemaRefOrVal)(Z,H.properties,"properties");A=(0,Y.isOwnProperty)(K,j,T)}else if(F.length)A=(0,z.or)(...F.map((j)=>z._`${T}===${j}`));else A=z.nil;if(M.length)A=(0,z.or)(A,...M.map((j)=>z._`${(0,Y.usePattern)(J,j)}.test(${T})`));return(0,z.not)(A)}function D(T){K.code(z._`delete${W}[${T}]`)}function N(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){D(T);return}if(G===!1){if(J.setParams({additionalProperty:T}),J.error(),!q)K.break();return}if(typeof G=="object"&&!(0,I.alwaysValidSchema)(Z,G)){let A=K.name("valid");if(V.removeAdditional==="failing")B(T,A,!1),K.if((0,z.not)(A),()=>{J.reset(),D(T)});else if(B(T,A),!q)K.if((0,z.not)(A),()=>K.break())}}function B(T,A,j){let C={keyword:"additionalProperties",dataProp:T,dataPropType:I.Type.Str};if(j===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});J.subschema(C,A)}}};$.default=Q}),Ib0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=SI(),z=I5(),U=v1(),I=at(),Q={keyword:"properties",type:"object",schemaType:"object",code(J){let{gen:K,schema:G,parentSchema:H,data:W,it:X}=J;if(X.opts.removeAdditional==="all"&&H.additionalProperties===void 0)I.default.code(new Y.KeywordCxt(X,I.default,"additionalProperties"));let Z=(0,z.allSchemaProperties)(G);for(let w of Z)X.definedProperties.add(w);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=U.mergeEvaluated.props(K,(0,U.toHash)(Z),X.props);let q=Z.filter((w)=>!(0,U.alwaysValidSchema)(X,G[w]));if(q.length===0)return;let V=K.name("valid");for(let w of q){if(F(w))M(w);else{if(K.if((0,z.propertyInData)(K,W,w,X.opts.ownProperties)),M(w),!X.allErrors)K.else().var(V,!0);K.endIf()}J.it.definedProperties.add(w),J.ok(V)}function F(w){return X.opts.useDefaults&&!X.compositeRule&&G[w].default!==void 0}function M(w){J.subschema({keyword:"properties",schemaProp:w,dataProp:w},V)}}};$.default=Q}),Qb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=I5(),z=L1(),U=v1(),I=v1(),Q={keyword:"patternProperties",type:"object",schemaType:"object",code(J){let{gen:K,schema:G,data:H,parentSchema:W,it:X}=J,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((B)=>(0,U.alwaysValidSchema)(X,G[B]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let F=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,M=K.name("valid");if(X.props!==!0&&!(X.props instanceof z.Name))X.props=(0,I.evaluatedPropsToName)(K,X.props);let{props:w}=X;O();function O(){for(let B of q){if(F)D(B);if(X.allErrors)
Line truncated
`)}openNode($,Y){let z=this.tos,U=this._xml;if(z&&this.open)U.push(">");this._stack.push($),U.push("<"),U.push($),Dk(U,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)y30(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");Dk(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(g30.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,z){if(this.openNode($,Y),z!==void 0)this.writeText(z);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("")}}Ak.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};k30.exports=Ak});var Pk=E((Xt0)=>{var x30=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Wt0($){if(typeof $==="string")return $;if(x30)return x30.decode($);return $.toString()}Xt0.bufferToString=Wt0});var c30=E((u30)=>{Object.defineProperty(u30,"__esModule",{value:!0});u30.CHAR=`
`,$=this.i;break;case Ge0:{let{entityReturnState:z}=this,U=this.entity+Y.slice($,this.prevI);this.state=z;let I;if(U==="")this.fail("empty entity name."),I="&;";else I=this.parseEntity(U),this.entity="";if(z!==C8||this.textHandler!==void 0)this.text+=I;break $}case k4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(CH($))this.state=Ue0,this.unget(),this.xmlDeclPossible=!1;else switch($){case iO:this.state=Je0,this.xmlDeclPossible=!1;break;case a30:this.state=lt0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case o6:this.state=tt0;break;default:this.fail("disallowed character in tag name"),this.state=C8,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=Ck,this.openWakaBang="";break;case"--":this.state=Ek,this.openWakaBang="";break;case"DOCTYPE":if(this.state=Ak,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(bO))this.state=ot0}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===bO)this.state=rt0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=Ek}sCommentEnded(){let $=this.getCodeNorm();if($!==A6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=Ek;else this.state=C8}sCData(){if(this.captureToChar(BQ))this.state=st0}sCDataEnding(){let $=this.getCodeNorm();if($===BQ)this.state=at0;else this.text+=`]${String.fromCodePoint($)}`,this.state=Ck}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case A6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C8;break}case BQ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=Ck}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=p30;else if($===o6||p8($))this.fail("processing instruction without a target."),this.state=$===o6?uO:Rk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=p30}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let z=this.getCodeNorm();if(z===k4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(z)){this.piTarget+=$.slice(Y,this.prevI);let U=z===o6;if(U||p8(z))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=U?Jz:d30}else this.state=U?uO:Rk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(z);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===o6)this.state=uO;else if(!p8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(o6))this.state=uO}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===A6){let{piTarget:z}=this;if(z.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:z,body:this.text}),this.piTarget=this.text="",this.state=C8}else if(Y===o6)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=Rk;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===o6){this.state=Jz;return}if($!==k4)this.state=et0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(Xe0);if($===o6){this.state=Jz,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p8($)||$===PQ))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(`expectedthename${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expectedoneof${this.xmlDeclExpects.join(", ")}`)}this.state=$===PQ?m30:$e0}sXMLDeclEq(){let $=this.getCodeNorm();if($===o6){this.state=Jz,this.fail("XML declaration is incomplete.");return}if(p8($))return;if($!==PQ)this.fail("value required.");this.state=m30}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===o6){this.state=Jz,this.fail("XML declaration is incomplete.");return}if(p8($))return;if(!cO($))this.fail("value must be quoted."),this.q=s30;else this.q=$;this.state=Ye0}sXMLDeclValue(){let $=this.captureTo([this.q,o6]);if($===o6){this.state=Jz,this.text="",this.fail("XML declaration is incomplete.");return}if($===k4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let z=Y;if(this.xmlDecl.version=z,!/^1\.[0-9]+$/.test(z))this.fail("ver
Line truncated
`,$=this.i;break;case ve0:{let{entityReturnState:z}=this,U=this.entity+Y.slice($,this.prevI);this.state=z;let I;if(U==="")this.fail("empty entity name."),I="&;";else I=this.parseEntity(U),this.entity="";if(z!==C8||this.textHandler!==void 0)this.text+=I;break $}case k4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(vW($))this.state=je0,this.unget(),this.xmlDeclPossible=!1;else switch($){case mO:this.state=Re0,this.xmlDeclPossible=!1;break;case X70:this.state=Fe0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case o6:this.state=De0;break;default:this.fail("disallowed character in tag name"),this.state=C8,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=Sk,this.openWakaBang="";break;case"--":this.state=hk,this.openWakaBang="";break;case"DOCTYPE":if(this.state=Rk,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(dO))this.state=we0}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===dO)this.state=Me0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=hk}sCommentEnded(){let $=this.getCodeNorm();if($!==B6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=hk;else this.state=C8}sCData(){if(this.captureToChar(TQ))this.state=Oe0}sCDataEnding(){let $=this.getCodeNorm();if($===TQ)this.state=Ne0;else this.text+=`]${String.fromCodePoint($)}`,this.state=Sk}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case B6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C8;break}case TQ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=Sk}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=I70;else if($===o6||p8($))this.fail("processing instruction without a target."),this.state=$===o6?pO:gk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=I70}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let z=this.getCodeNorm();if(z===k4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(z)){this.piTarget+=$.slice(Y,this.prevI);let U=z===o6;if(U||p8(z))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=U?Gz:Q70}else this.state=U?pO:gk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(z);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===o6)this.state=pO;else if(!p8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(o6))this.state=pO}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===B6){let{piTarget:z}=this;if(z.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:z,body:this.text}),this.piTarget=this.text="",this.state=C8}else if(Y===o6)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=gk;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===o6){this.state=Gz;return}if($!==k4)this.state=Ae0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(ge0);if($===o6){this.state=Gz,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p8($)||$===BQ))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(`expectedthename${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expectedoneof${this.xmlDeclExpects.join(", ")}`)}this.state=$===BQ?J70:Pe0}sXMLDeclEq(){let $=this.getCodeNorm();if($===o6){this.state=Gz,this.fail("XML declaration is incomplete.");return}if(p8($))return;if($!==BQ)this.fail("value required.");this.state=J70}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===o6){this.state=Gz,this.fail("XML declaration is incomplete.");return}if(p8($))return;if(!lO($))this.fail("value must be quoted."),this.q=W70;else this.q=$;this.state=Be0}sXMLDeclValue(){let $=this.captureTo([this.q,o6]);if($===o6){this.state=Gz,this.text="",this.fail("XML declaration is incomplete.");return}if($===k4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let z=Y;if(this.xmlDecl.version=z,!/^1\.[0-9]+$/.test(z))this.fail("ver
Line truncated
See:https://github.com/isaacs/node-glob/issues/167`);return new T6($,Y).found}function T6($,Y){if(!$)throw Error("must provide pattern");if(typeof Y==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`+Z0[B0-1];break}}}var N1="a promise was created in a "+v+"handler "+X0+"but was not returned from it, see http://goo.gl/rRqMUw"+Q0;u._warn(N1,!0,B)}}function y(I0,B){var v=I0+" is deprecated and will be removed in a future version.";if(B)v+=" Use "+B+" instead.";return s(v)}function s(I0,B,v){if(!P0.warnings)return;var u=new I(I0),r;if(B)v._attachExtraTrace(u);else if(P0.longStackTraces&&(r=$._peekContext()))r.attachExtraTrace(u);else{var X0=b0(u);u.stack=X0.message+`
`+Z0[P0-1];break}}}var N1="a promise was created in a "+v+"handler "+X0+"but was not returned from it, see http://goo.gl/rRqMUw"+Q0;u._warn(N1,!0,P)}}function y(I0,P){var v=I0+" is deprecated and will be removed in a future version.";if(P)v+=" Use "+P+" instead.";return s(v)}function s(I0,P,v){if(!A0.warnings)return;var u=new I(I0),r;if(P)v._attachExtraTrace(u);else if(A0.longStackTraces&&(r=$._peekContext()))r.attachExtraTrace(u);else{var X0=b0(u);u.stack=X0.message+`
`)));return}}w=w._target();var O=w._bitField;if((O&50397184)===0)this._yieldedPromise=w,w._proxy(this,null);else if((O&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,w._value());else if((O&16777216)!==0)$._async.invoke(this._promiseRejected,this,w._reason());else this._promiseCancelled()}},$.coroutine=function(V,F){if(typeof V!=="function")throw new K(`generatorFunctionmustbeafunction
Seehttp://goo.gl/MqrFmX
`);var M=Object(F).yieldHandler,w=q,O=Error().stack;return function(){var D=V.apply(this,arguments),N=new w(void 0,void 0,M,O),A=N.promise();return N._generator=D,N._promiseFulfilled(void 0),A}},$.coroutine.addYieldHandler=function(V){if(typeof V!=="function")throw new K("expecting a function but got "+G.classString(V));X.push(V)},$.spawn=function(V){if(Q.deprecated("Promise.spawn()","Promise.coroutine()"),typeof V!=="function")return Y(`generatorFunctionmustbeafunction
`);var M=Object(F).yieldHandler,w=q,O=Error().stack;return function(){var D=V.apply(this,arguments),N=new w(void 0,void 0,M,O),B=N.promise();return N._generator=D,N._promiseFulfilled(void 0),B}},$.coroutine.addYieldHandler=function(V){if(typeof V!=="function")throw new K("expecting a function but got "+G.classString(V));X.push(V)},$.spawn=function(V){if(Q.deprecated("Promise.spawn()","Promise.coroutine()"),typeof V!=="function")return Y(`generatorFunctionmustbeafunction
`)},Y=function(){return new h.PromiseInspection(this._target())},z=function(x){return h.reject(new X(x))};function U(){}var I={},Q=F4(),J;if(Q.isNode)J=function(){var x=process.domain;if(x===void 0)x=null;return x};else J=function(){return null};Q.notEnumerableProp(h,"_getDomain",J);var K=pz(),G=XF0(),W=new G;K.defineProperty(h,"_async",{value:W});var H=T3(),X=h.TypeError=H.TypeError;h.RangeError=H.RangeError;var Z=h.CancellationError=H.CancellationError;h.TimeoutError=H.TimeoutError,h.OperationalError=H.OperationalError,h.RejectionError=H.OperationalError,h.AggregateError=H.AggregateError;var q=function(){},V={},F={},M=FF0()(h,q),w=MF0()(h,q,M,z,U),O=NF0()(h),D=O.create,N=PF0()(h,O),A=N.CapturedTrace,T=AF0()(h,M),P=jF0()(F),j=Yc(),C=Q.errorObj,b=Q.tryCatch;function k(x,d){if(typeof d!=="function")throw new X("expecting a function but got "+Q.classString(d));if(x.constructor!==h)throw new X(`thepromiseconstructorcannotbeinvokeddirectly
`)},Y=function(){return new h.PromiseInspection(this._target())},z=function(x){return h.reject(new X(x))};function U(){}var I={},Q=F4(),J;if(Q.isNode)J=function(){var x=process.domain;if(x===void 0)x=null;return x};else J=function(){return null};Q.notEnumerableProp(h,"_getDomain",J);var K=mz(),G=TF0(),H=new G;K.defineProperty(h,"_async",{value:H});var W=T3(),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={},F={},M=_F0()(h,q),w=hF0()(h,q,M,z,U),O=gF0()(h),D=O.create,N=kF0()(h,O),B=N.CapturedTrace,T=fF0()(h,M),A=bF0()(F),j=Jc(),C=Q.errorObj,b=Q.tryCatch;function k(x,d){if(typeof d!=="function")throw new X("expecting a function but got "+Q.classString(d));if(x.constructor!==h)throw new X(`thepromiseconstructorcannotbeinvokeddirectly
Seehttp://goo.gl/MqrFmX
`)}function h(x){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,x!==q)k(this,x),this._resolveFromExecutor(x);this._promiseCreated(),this._fireEvent("promiseCreated",this)}h.prototype.toString=function(){return"[object Promise]"},h.prototype.caught=h.prototype.catch=function(x){var d=arguments.length;if(d>1){var t=Array(d-1),$0=0,g;for(g=0;g<d-1;++g){var p=arguments[g];if(Q.isObject(p))t[$0++]=p;else return z("expecting an object but got A catch statement predicate "+Q.classString(p))}return t.length=$0,x=arguments[g],this.then(void 0,P(t,x,this))}return this.then(void 0,x)},h.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},h.prototype.then=function(x,d){if(N.warnings()&&arguments.length>0&&typeof x!=="function"&&typeof d!=="function"){var t=".then() only accepts functions but was passed: "+Q.classString(x);if(arguments.length>1)t+=", "+Q.classString(d);this._warn(t)}return this._then(x,d,void 0,void 0,void 0)},h.prototype.done=function(x,d){var t=this._then(x,d,void 0,void 0,void 0);t._setIsFinal()},h.prototype.spread=function(x){if(typeof x!=="function")return z("expecting a function but got "+Q.classString(x));return this.all()._then(x,void 0,void 0,V,void 0)},h.prototype.toJSON=function(){var x={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())x.fulfillmentValue=this.value(),x.isFulfilled=!0;else if(this.isRejected())x.rejectionReason=this.reason(),x.isRejected=!0;return x},h.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new w(this).promise()},h.prototype.error=function(x){return this.caught(Q.originatesFromRejection,x)},h.getNewLibraryCopy=Uc.exports,h.is=function(x){return x instanceof h},h.fromNode=h.fromCallback=function(x){var d=new h(q);d._captureStackTrace();var t=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=b(x)(j(d,t));if($0===C)d._rejectCallback($0.e,!0);if(!d._isFateSealed())d._setAsyncGuaranteed();return d},h.all=function(x){return new w(x).promise()},h.cast=function(x){var d=M(x);if(!(d instanceof h))d=new h(q),d._captureStackTrace(),d._setFulfilled(),d._rejectionHandler0=x;return d},h.resolve=h.fulfilled=h.cast,h.reject=h.rejected=function(x){var d=new h(q);return d._captureStackTrace(),d._rejectCallback(x,!0),d},h.setScheduler=function(x){if(typeof x!=="function")throw new X("expecting a function but got "+Q.classString(x));return W.setScheduler(x)},h.prototype._then=function(x,d,t,$0,g){var p=g!==void 0,e=p?g:new h(q),y=this._target(),s=y._bitField;if(!p){if(e._propagateFrom(this,3),e._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((s&50397184)!==0)$0=this._boundValue();else $0=y===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,e)}var Y0=J();if((s&50397184)!==0){var M0,E0,G0=y._settlePromiseCtx;if((s&33554432)!==0)E0=y._rejectionHandler0,M0=x;else if((s&16777216)!==0)E0=y._fulfillmentHandler0,M0=d,y._unsetRejectionIsUnhandled();else G0=y._settlePromiseLateCancellationObserver,E0=new Z("late cancellation observer"),y._attachExtraTrace(E0),M0=d;W.invoke(G0,y,{handler:Y0===null?M0:typeof M0==="function"&&Q.domainBind(Y0,M0),promise:e,receiver:$0,value:E0})}else y._addCallbacks(x,d,e,$0,Y0);return e},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(x){this._bitField=this._bitField&-65536|x&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(W.hasCustomScheduler())return;this._bitField=this._bitField|134217728},h.prototype._receiverAt=function(x){var d=x===0?this._receiver0:this[x*4-4+3];if(d===I)return;else if(d===void 0&&this._isBound())return this._boundValue();return d},h.prototype._promiseAt=function(x){return this[x*4-4+2]},h.prototype._fulfillmentHandlerAt=function(x){return this[x*4-4+0]},h.prototype._rejectionHandlerAt=function(x){return this[x*4-4+1]},h.prototype._boundValue=function(){},h.prototype._migrateCallback0=function(x){var{_bitField:d,_fulfillmentHandler
Line truncated
`)}function h(x){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,x!==q)k(this,x),this._resolveFromExecutor(x);this._promiseCreated(),this._fireEvent("promiseCreated",this)}h.prototype.toString=function(){return"[object Promise]"},h.prototype.caught=h.prototype.catch=function(x){var d=arguments.length;if(d>1){var t=Array(d-1),$0=0,g;for(g=0;g<d-1;++g){var p=arguments[g];if(Q.isObject(p))t[$0++]=p;else return z("expecting an object but got A catch statement predicate "+Q.classString(p))}return t.length=$0,x=arguments[g],this.then(void 0,A(t,x,this))}return this.then(void 0,x)},h.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},h.prototype.then=function(x,d){if(N.warnings()&&arguments.length>0&&typeof x!=="function"&&typeof d!=="function"){var t=".then() only accepts functions but was passed: "+Q.classString(x);if(arguments.length>1)t+=", "+Q.classString(d);this._warn(t)}return this._then(x,d,void 0,void 0,void 0)},h.prototype.done=function(x,d){var t=this._then(x,d,void 0,void 0,void 0);t._setIsFinal()},h.prototype.spread=function(x){if(typeof x!=="function")return z("expecting a function but got "+Q.classString(x));return this.all()._then(x,void 0,void 0,V,void 0)},h.prototype.toJSON=function(){var x={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())x.fulfillmentValue=this.value(),x.isFulfilled=!0;else if(this.isRejected())x.rejectionReason=this.reason(),x.isRejected=!0;return x},h.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new w(this).promise()},h.prototype.error=function(x){return this.caught(Q.originatesFromRejection,x)},h.getNewLibraryCopy=Gc.exports,h.is=function(x){return x instanceof h},h.fromNode=h.fromCallback=function(x){var d=new h(q);d._captureStackTrace();var t=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=b(x)(j(d,t));if($0===C)d._rejectCallback($0.e,!0);if(!d._isFateSealed())d._setAsyncGuaranteed();return d},h.all=function(x){return new w(x).promise()},h.cast=function(x){var d=M(x);if(!(d instanceof h))d=new h(q),d._captureStackTrace(),d._setFulfilled(),d._rejectionHandler0=x;return d},h.resolve=h.fulfilled=h.cast,h.reject=h.rejected=function(x){var d=new h(q);return d._captureStackTrace(),d._rejectCallback(x,!0),d},h.setScheduler=function(x){if(typeof x!=="function")throw new X("expecting a function but got "+Q.classString(x));return H.setScheduler(x)},h.prototype._then=function(x,d,t,$0,g){var p=g!==void 0,e=p?g:new h(q),y=this._target(),s=y._bitField;if(!p){if(e._propagateFrom(this,3),e._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((s&50397184)!==0)$0=this._boundValue();else $0=y===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,e)}var Y0=J();if((s&50397184)!==0){var M0,E0,G0=y._settlePromiseCtx;if((s&33554432)!==0)E0=y._rejectionHandler0,M0=x;else if((s&16777216)!==0)E0=y._fulfillmentHandler0,M0=d,y._unsetRejectionIsUnhandled();else G0=y._settlePromiseLateCancellationObserver,E0=new Z("late cancellation observer"),y._attachExtraTrace(E0),M0=d;H.invoke(G0,y,{handler:Y0===null?M0:typeof M0==="function"&&Q.domainBind(Y0,M0),promise:e,receiver:$0,value:E0})}else y._addCallbacks(x,d,e,$0,Y0);return e},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(x){this._bitField=this._bitField&-65536|x&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(x){var d=x===0?this._receiver0:this[x*4-4+3];if(d===I)return;else if(d===void 0&&this._isBound())return this._boundValue();return d},h.prototype._promiseAt=function(x){return this[x*4-4+2]},h.prototype._fulfillmentHandlerAt=function(x){return this[x*4-4+0]},h.prototype._rejectionHandlerAt=function(x){return this[x*4-4+1]},h.prototype._boundValue=function(){},h.prototype._migrateCallback0=function(x){var{_bitField:d,_fulfillmentHandler
Line truncated
`,{mode:384}),Y}function sn($){let Y=rD0();for(let z of Y){if(!V$(z))continue;for(let U of vB(z).filter((I)=>I.endsWith(".json")).filter((I)=>!I.startsWith("example."))){let I=N9(z,U);try{let Q=SB(I,"utf-8"),J=JSON.parse(Q);if(J&&typeof J==="object"&&J.id===$)return I}catch{}}}return}function x2($,Y){let z=sn($);if(!z)throw Error(`Enterpriseconfignotfound:${$}`);let I={...JSON.parse(SB(z,"utf-8")),...Y};for(let J of Object.keys(Y))if(Y[J]===void 0)delete I[J];let Q=mn.parse(I);return nD0(z,`${JSON.stringify(Q,null,2)}
`,"utf-8"),Q}var on="SEAL_USE_ENTERPRISES_DIR",pD0="SEAL_HOME_ENTERPRISES_DIR",dD0="SEAL_USE_USER_ENTERPRISES_DIR",mD0="SEAL_HOME_USER_ENTERPRISES_DIR",lD0="SEAL_USE_CONFIG_FILE",oD0="SEAL_HOME_CONFIG_FILE",lJ,hB,_B,iD0;var S3=o(()=>{ln();lJ=N9(gB(),".config","seal-use","enterprises"),hB=N9(gB(),".config","seal-home","enterprises"),_B=N9(gB(),".config","seal-use","config.json"),iD0=N9(gB(),".config","seal-home","config.json")});function f2($,Y,z=[]){let U=Y.corpId?.trim()||void 0,I=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,Q=U??I;if(Q){let K=$.find((H)=>H.id===Q);if(K)return K;let G=$.find((H)=>H.id.toLowerCase()===Q.toLowerCase());if(G)return G;let W=$.find((H)=>H.name.toLowerCase()===Q.toLowerCase());if(W)return W;throw Error(`Noenterpriseconfigfoundfor${Q}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-homeconfigmodestateful` to enable a default enterprise.");let J=$[0];if(J)return J;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(z.length?z.join(", "):"the configured enterprise directories"))}import{existsSync as an,mkdirSync as XN1,readFileSync as ZN1,renameSync as qN1,unlinkSync as VN1,writeFileSync as LN1}from"node:fs";import{homedir as FN1}from"node:os";import{dirname as wN1,join as MN1}from"node:path";function EZ(){let $=process.env[ON1]?.trim();if($)return $;return NN1}function sD0($=new Date){return $.toISOString().slice(0,10)}function aD0($=tn,Y=new Date){let z=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(z).toISOString().slice(0,10)}function tD0($=EZ()){if(!an($))return{};try{let Y=ZN1($,"utf-8"),z=JSON.parse(Y);if(z&&typeof z==="object"&&!Array.isArray(z))return z;return{}}catch{return{}}}function DN1($,Y){let z={};for(let[U,I]of Object.entries($)){if(!I||typeof I!=="object")continue;let Q={},J=!1;for(let[K,G]of Object.entries(I))if(typeof G==="number"&&G>0&&K>=Y)Q[K]=G,J=!0;if(J)z[U]=Q}return z}function PN1($,Y=EZ()){let z=wN1(Y);if(!an(z))XN1(z,{recursive:!0,mode:448});let U=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{LN1(U,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),qN1(U,Y)}catch(I){try{if(an(U))VN1(U)}catch{}throw I}}function eD0($,Y=new Date){if(!$||typeof $!=="string")return;try{let z=EZ(),U=tD0(z),I=sD0(Y),Q=aD0(tn,Y),J=DN1(U,Q);J[$]=J[$]||{},J[$][I]=(J[$][I]??0)+1,PN1(J,z)}catch{}}function BN1($,Y=tn,z=new Date){let U=new Map;try{let I=tD0(),Q=aD0(Y,z),J=sD0(z),K=$??Object.keys(I);for(let G of K){let W=I[G];if(!W){U.set(G,0);continue}let H=0;for(let[X,Z]of Object.entries(W))if(X>=Q&&X<=J&&typeof Z==="number")H+=Z;U.set(G,H)}}catch{if($)for(let I of $)U.set(I,0)}return U}function $P0($,Y,z){let U=z??BN1($.map((I)=>I.id));return[...$].sort((I,Q)=>{if(Y){if(I.id===Y&&Q.id!==Y)return-1;if(Q.id===Y&&I.id!==Y)return 1}let J=U.get(I.id)??0,K=U.get(Q.id)??0;if(J!==K)return K-J;let G=I.name??I.id,W=Q.name??Q.id,H=G.localeCompare(W,"zh-CN");if(H!==0)return H;return I.id.localeCompare(Q.id)})}var ON1="SEAL_USE_USAGE_FILE",NN1,tn=7;var yB=o(()=>{NN1=MN1(FN1(),".config","seal-use","usage.json")});function AN1($,Y){return $.map((z)=>z.trim()).filter(Boolean).map((z)=>Y?z:z.toLowerCase())}function TN1($,Y){return Y?$:$.toLowerCase()}function jN1($,Y,z,U){let I=TN1($,U),Q=Y.filter((J)=>I.includes(J));if(z==="all"&&Q.length!==Y.length)return[];return Q}function EN1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function CN1($,Y){if(Y.fields&&!Y.fields.has($.field))return[];let z=EN1($.value),U=[];return z.forEach((I,Q)=>{let J=jN1(I,Y.keywords,Y.matchMode,Y.caseSensitive);if(J.length===0)return;let K=Math.max(0,Q-Y.contextLines),G=Math.min(z.length,Q+Y.contextLines+1),W={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:Q+1,matchedKeywords:J,matchedText:kB(I,Y.maxChars),context:{before:Y.snippetOnly?[]:z.slice(K,Q).map((H)=>kB(H,Y.maxChars)),line:kB(I,Y.maxChars),after:Y.snippetOnly?[]:z.slice(Q+1,G).map((H)=>kB(H,Y.maxChars))},metadata:$.metadata};if(Y.snippetOnly)W.context={before:[],line:W.context.line,after:[]};U.push(W)}),U}function kB($,Y){if(!Y||$.length<=Y)return $;return`${$.slice(0,Math.max(0,Y))}...`}function RN1($){return[{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"description",value:$.description,metadata:{scope:$.scope,strictness:$.strictness,status:$.status}},{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"scope",value:$.scope,metadata:{strictness:$.strictness,status:$.status}}]}function zP0($){return $.rules.flatMap((Y,z)=>{let U=`${$.id}:${Y.description.slice(0,32)}`,I={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:Y.scope,strictness:Y.strictness,code:"code"in Y?Y.code:void 0,index:z};return[{area:"rules",entityType:"rule",entityId:U,title:`${$.versionName}/${Y.scope}`,field:"h
Line truncated
`,{mode:384}),Y}function Yp($){let Y=HA0();for(let z of Y){if(!V$(z))continue;for(let U of kP(z).filter((I)=>I.endsWith(".json")).filter((I)=>!I.startsWith("example."))){let I=N9(z,U);try{let Q=fP(I,"utf-8"),J=JSON.parse(Q);if(J&&typeof J==="object"&&J.id===$)return I}catch{}}}return}function x2($,Y){let z=Yp($);if(!z)throw Error(`Enterpriseconfignotfound:${$}`);let I={...JSON.parse(fP(z,"utf-8")),...Y};for(let J of Object.keys(Y))if(Y[J]===void 0)delete I[J];let Q=an.parse(I);return UA0(z,`${JSON.stringify(Q,null,2)}
`,"utf-8"),Q}var en="SEAL_USE_ENTERPRISES_DIR",IA0="SEAL_HOME_ENTERPRISES_DIR",QA0="SEAL_USE_USER_ENTERPRISES_DIR",JA0="SEAL_HOME_USER_ENTERPRISES_DIR",KA0="SEAL_USE_CONFIG_FILE",GA0="SEAL_HOME_CONFIG_FILE",rJ,xP,yP,YA0;var S3=o(()=>{tn();rJ=N9(uP(),".config","seal-use","enterprises"),xP=N9(uP(),".config","seal-home","enterprises"),yP=N9(uP(),".config","seal-use","config.json"),YA0=N9(uP(),".config","seal-home","config.json")});function f2($,Y,z=[]){let U=Y.corpId?.trim()||void 0,I=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,Q=U??I;if(Q){let K=$.find((W)=>W.id===Q);if(K)return K;let G=$.find((W)=>W.id.toLowerCase()===Q.toLowerCase());if(G)return G;let H=$.find((W)=>W.name.toLowerCase()===Q.toLowerCase());if(H)return H;throw Error(`Noenterpriseconfigfoundfor${Q}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-homeconfigmodestateful` to enable a default enterprise.");let J=$[0];if(J)return J;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(z.length?z.join(", "):"the configured enterprise directories"))}import{existsSync as zp,mkdirSync as gN1,readFileSync as yN1,renameSync as kN1,unlinkSync as xN1,writeFileSync as fN1}from"node:fs";import{homedir as uN1}from"node:os";import{dirname as bN1,join as iN1}from"node:path";function _Z(){let $=process.env[cN1]?.trim();if($)return $;return nN1}function WA0($=new Date){return $.toISOString().slice(0,10)}function XA0($=Up,Y=new Date){let z=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(z).toISOString().slice(0,10)}function ZA0($=_Z()){if(!zp($))return{};try{let Y=yN1($,"utf-8"),z=JSON.parse(Y);if(z&&typeof z==="object"&&!Array.isArray(z))return z;return{}}catch{return{}}}function pN1($,Y){let z={};for(let[U,I]of Object.entries($)){if(!I||typeof I!=="object")continue;let Q={},J=!1;for(let[K,G]of Object.entries(I))if(typeof G==="number"&&G>0&&K>=Y)Q[K]=G,J=!0;if(J)z[U]=Q}return z}function dN1($,Y=_Z()){let z=bN1(Y);if(!zp(z))gN1(z,{recursive:!0,mode:448});let U=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{fN1(U,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),kN1(U,Y)}catch(I){try{if(zp(U))xN1(U)}catch{}throw I}}function qA0($,Y=new Date){if(!$||typeof $!=="string")return;try{let z=_Z(),U=ZA0(z),I=WA0(Y),Q=XA0(Up,Y),J=pN1(U,Q);J[$]=J[$]||{},J[$][I]=(J[$][I]??0)+1,dN1(J,z)}catch{}}function mN1($,Y=Up,z=new Date){let U=new Map;try{let I=ZA0(),Q=XA0(Y,z),J=WA0(z),K=$??Object.keys(I);for(let G of K){let H=I[G];if(!H){U.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=Q&&X<=J&&typeof Z==="number")W+=Z;U.set(G,W)}}catch{if($)for(let I of $)U.set(I,0)}return U}function VA0($,Y,z){let U=z??mN1($.map((I)=>I.id));return[...$].sort((I,Q)=>{if(Y){if(I.id===Y&&Q.id!==Y)return-1;if(Q.id===Y&&I.id!==Y)return 1}let J=U.get(I.id)??0,K=U.get(Q.id)??0;if(J!==K)return K-J;let G=I.name??I.id,H=Q.name??Q.id,W=G.localeCompare(H,"zh-CN");if(W!==0)return W;return I.id.localeCompare(Q.id)})}var cN1="SEAL_USE_USAGE_FILE",nN1,Up=7;var bP=o(()=>{nN1=iN1(uN1(),".config","seal-use","usage.json")});function lN1($,Y){return $.map((z)=>z.trim()).filter(Boolean).map((z)=>Y?z:z.toLowerCase())}function oN1($,Y){return Y?$:$.toLowerCase()}function rN1($,Y,z,U){let I=oN1($,U),Q=Y.filter((J)=>I.includes(J));if(z==="all"&&Q.length!==Y.length)return[];return Q}function sN1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function aN1($,Y){if(Y.fields&&!Y.fields.has($.field))return[];let z=sN1($.value),U=[];return z.forEach((I,Q)=>{let J=rN1(I,Y.keywords,Y.matchMode,Y.caseSensitive);if(J.length===0)return;let K=Math.max(0,Q-Y.contextLines),G=Math.min(z.length,Q+Y.contextLines+1),H={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:Q+1,matchedKeywords:J,matchedText:iP(I,Y.maxChars),context:{before:Y.snippetOnly?[]:z.slice(K,Q).map((W)=>iP(W,Y.maxChars)),line:iP(I,Y.maxChars),after:Y.snippetOnly?[]:z.slice(Q+1,G).map((W)=>iP(W,Y.maxChars))},metadata:$.metadata};if(Y.snippetOnly)H.context={before:[],line:H.context.line,after:[]};U.push(H)}),U}function iP($,Y){if(!Y||$.length<=Y)return $;return`${$.slice(0,Math.max(0,Y))}...`}function tN1($){return[{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"description",value:$.description,metadata:{scope:$.scope,strictness:$.strictness,status:$.status}},{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"scope",value:$.scope,metadata:{strictness:$.strictness,status:$.status}}]}function FA0($){return $.rules.flatMap((Y,z)=>{let U=`${$.id}:${Y.description.slice(0,32)}`,I={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:Y.scope,strictness:Y.strictness,code:"code"in Y?Y.code:void 0,index:z};return[{area:"rules",entityType:"rule",entityId:U,title:`${$.versionName}/${Y.scope}`,field:"h
Line truncated
@@ -876,62 +876,62 @@ export function lintRule(rule: RuleLintTarget): RuleLintResult {
}
exportdefaultlintRule;
`}});import{existsSync as KU,mkdirSync as YD1,readFileSync as zD1,readdirSync as VP0,rmSync as UD1,unlinkSync as ID1,writeFileSync as QD1}from"node:fs";import{homedir as JD1}from"node:os";import{isAbsolute as KD1,join as f6,resolve as GD1}from"node:path";import{pathToFileURL as ZP0}from"node:url";function LP0($=i$){let Y=[],z=[];try{if(!KU($))YD1($,{recursive:!0});let U=Object.keys(Qp);for(let[Q,J]of Object.entries(Qp)){let K=f6($,Q),G=!0;if(KU(K))try{if(zD1(K,"utf8")===J)G=!1}catch{G=!0}if(G)QD1(K,J,"utf8");Y.push(Q)}let I=VP0($,{withFileTypes:!0});for(let Q of I)if(!U.includes(Q.name)){let J=f6($,Q.name);try{if(Q.isDirectory())UD1(J,{recursive:!0,force:!0});else ID1(J);z.push(Q.name)}catch{}}}catch{}return{synced:Y,pruned:z}}function FP0($={syncOfficial:!0}){if($.syncOfficial!==!1)LP0();let Y=[{name:"builtin",type:"builtin",path:f6(i$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:f6(i$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:f6(i$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],z=[b$,bB];for(let U of z)if(KU(U))try{let I=VP0(U,{withFileTypes:!0});for(let Q of I){if(Q.isDirectory())continue;let J=Q.name;if(J.endsWith(".ts")||J.endsWith(".js")||J.endsWith(".mjs")){let K=J.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===K))Y.push({name:K,type:"custom",path:f6(U,J),description:`用户自定义规则校验器(${J})`})}}}catch{}return Y}function HD1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:f6(i$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:f6(i$,"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:f6(i$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(KD1(Y)||Y.startsWith("./")||Y.startsWith("../")){let U=GD1(Y);if(KU(U))return{path:U};for(let I of[".ts",".js",".mjs"])if(KU(`${U}${I}`))return{path:`${U}${I}`}}let z=[f6(b$,`${Y}.ts`),f6(b$,`${Y}.js`),f6(b$,`${Y}.mjs`),f6(bB,`${Y}.ts`),f6(bB,`${Y}.js`),f6(bB,`${Y}.mjs`)];for(let U of z)if(KU(U))return{path:U};return{}}async function Kp($){LP0();let Y=HD1($??"builtin");if(Y.isOfficial){let U=Y.officialKind==="strict"?HP0:Y.officialKind==="hlab"?XP0:rJ,I=Y.officialKind==="builtin"?"builtin":"official",Q=Y.path;if(Q&&KU(Q))try{let K=await import(ZP0(Q).href),G=K.default??K.lintRule??K.linter??K.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:I,filePath:Q,linter:qP0(G,U)}}catch{}return{name:Y.officialKind??"builtin",type:I,filePath:Q,linter:U}}let z=Y.path;if(!z)return console.error(`⚠️[linter]未找到自定义校验器"${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:rJ};try{let I=await import(ZP0(z).href),Q=I.default??I.lintRule??I.linter??I.lint;if(typeof Q!=="function")return console.error(`⚠️[linter]自定义校验器"${z}"未导出标准函数(default/lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:rJ};return{name:$??"custom",type:"custom",filePath:z,linter:qP0(Q,rJ)}}catch(U){returnconsole.error(`⚠️[linter]加载自定义校验器脚本"${z}"失败(语法错误或依赖缺失:${U?.message??U}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:rJ}}}functionqP0($,Y){returnasync(z,U)=>{try{letI=await$(z,U);if(I&&typeofI==="object"&&typeofI.score==="number"&&Array.isArray(I.issues))returnI;returnconsole.error("⚠️[linter]自定义校验器返回值格式不符合RuleLintResult契约,已回退至内置结果。"),Y(z,U)}catch(I){returnconsole.error("⚠️[linter]自定义校验器执行异常:",I),Y(z,U)}}}varb$,WD1="official",i$,bB;varGp=o(()=>{zp();Ip();Jp();Up();b$=f6(JD1(),".config","seal-use","linters"),i$=f6(b$,WD1),bB=f6(process.cwd(),"linters")});asyncfunctionWp($,Y,z){letU=awaitY.linter($,z);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:U.score,passed:U.passed,issues:U.issues,description:$.description}}asyncfunctionwP0($,Y,z,U){letI=U?.minScore??0,Q=U?.level??"all",J=[],K=0;for(letqof$){letV=awaitWp(q,Y,z);K+=V.score;letF=V.issues;if(Q==="error")F=V.issues.filter((w)=>w.level==="error");elseif(Q==="warning")F=V.issues.filter((w)=>w.level==="warning"||w.level==="error");letM=F.every((w)=>w.level!=="error");if(U?.summary){if(F.length>0)J.push({...V,passed:M,issues:F})}elseJ.push({...V,passed:M,issues:F})}letG=$.length,W=G===0?100:Math.round(K/G),H=J.filter((q)=>q.issues.length>0).length,X=G-Line truncated
`}});import{existsSync as HU,mkdirSync as BD1,readFileSync as TD1,readdirSync as CA0,rmSync as jD1,unlinkSync as ED1,writeFileSync as CD1}from"node:fs";import{homedir as RD1}from"node:os";import{isAbsolute as _D1,join as f6,resolve as vD1}from"node:path";import{pathToFileURL as jA0}from"node:url";function RA0($=i$){let Y=[],z=[];try{if(!HU($))BD1($,{recursive:!0});let U=Object.keys(Wp);for(let[Q,J]of Object.entries(Wp)){let K=f6($,Q),G=!0;if(HU(K))try{if(TD1(K,"utf8")===J)G=!1}catch{G=!0}if(G)CD1(K,J,"utf8");Y.push(Q)}let I=CA0($,{withFileTypes:!0});for(let Q of I)if(!U.includes(Q.name)){let J=f6($,Q.name);try{if(Q.isDirectory())jD1(J,{recursive:!0,force:!0});else ED1(J);z.push(Q.name)}catch{}}}catch{}return{synced:Y,pruned:z}}function _A0($={syncOfficial:!0}){if($.syncOfficial!==!1)RA0();let Y=[{name:"builtin",type:"builtin",path:f6(i$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:f6(i$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:f6(i$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],z=[b$,dP];for(let U of z)if(HU(U))try{let I=CA0(U,{withFileTypes:!0});for(let Q of I){if(Q.isDirectory())continue;let J=Q.name;if(J.endsWith(".ts")||J.endsWith(".js")||J.endsWith(".mjs")){let K=J.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===K))Y.push({name:K,type:"custom",path:f6(U,J),description:`用户自定义规则校验器(${J})`})}}}catch{}return Y}function SD1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:f6(i$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:f6(i$,"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:f6(i$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(_D1(Y)||Y.startsWith("./")||Y.startsWith("../")){let U=vD1(Y);if(HU(U))return{path:U};for(let I of[".ts",".js",".mjs"])if(HU(`${U}${I}`))return{path:`${U}${I}`}}let z=[f6(b$,`${Y}.ts`),f6(b$,`${Y}.js`),f6(b$,`${Y}.mjs`),f6(dP,`${Y}.ts`),f6(dP,`${Y}.js`),f6(dP,`${Y}.mjs`)];for(let U of z)if(HU(U))return{path:U};return{}}async function Zp($){RA0();let Y=SD1($??"builtin");if(Y.isOfficial){let U=Y.officialKind==="strict"?BA0:Y.officialKind==="hlab"?TA0:aJ,I=Y.officialKind==="builtin"?"builtin":"official",Q=Y.path;if(Q&&HU(Q))try{let K=await import(jA0(Q).href),G=K.default??K.lintRule??K.linter??K.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:I,filePath:Q,linter:EA0(G,U)}}catch{}return{name:Y.officialKind??"builtin",type:I,filePath:Q,linter:U}}let z=Y.path;if(!z)return console.error(`⚠️[linter]未找到自定义校验器"${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:aJ};try{let I=await import(jA0(z).href),Q=I.default??I.lintRule??I.linter??I.lint;if(typeof Q!=="function")return console.error(`⚠️[linter]自定义校验器"${z}"未导出标准函数(default/lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:aJ};return{name:$??"custom",type:"custom",filePath:z,linter:EA0(Q,aJ)}}catch(U){returnconsole.error(`⚠️[linter]加载自定义校验器脚本"${z}"失败(语法错误或依赖缺失:${U?.message??U}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:aJ}}}functionEA0($,Y){returnasync(z,U)=>{try{letI=await$(z,U);if(I&&typeofI==="object"&&typeofI.score==="number"&&Array.isArray(I.issues))returnI;returnconsole.error("⚠️[linter]自定义校验器返回值格式不符合RuleLintResult契约,已回退至内置结果。"),Y(z,U)}catch(I){returnconsole.error("⚠️[linter]自定义校验器执行异常:",I),Y(z,U)}}}varb$,hD1="official",i$,dP;varqp=o(()=>{Kp();Hp();Xp();Gp();b$=f6(RD1(),".config","seal-use","linters"),i$=f6(b$,hD1),dP=f6(process.cwd(),"linters")});asyncfunctionVp($,Y,z){letU=awaitY.linter($,z);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:U.score,passed:U.passed,issues:U.issues,description:$.description}}asyncfunctionvA0($,Y,z,U){letI=U?.minScore??0,Q=U?.level??"all",J=[],K=0;for(letqof$){letV=awaitVp(q,Y,z);K+=V.score;letF=V.issues;if(Q==="error")F=V.issues.filter((w)=>w.level==="error");elseif(Q==="warning")F=V.issues.filter((w)=>w.level==="warning"||w.level==="error");letM=F.every((w)=>w.level!=="error");if(U?.summary){if(F.length>0)J.push({...V,passed:M,issues:F})}elseJ.push({...V,passed:M,issues:F})}letG=$.length,H=G===0?100:Math.round(K/G),W=J.filter((q)=>q.issues.length>0).length,X=G-Line truncated
`),U=await Promise.all(D.map((N)=>G4($,N.id)))}let I=new Map,Q=0;for(let w of U){let O=w.document,D=w.sourceDocumentId??(typeof O?.id==="string"?O.id:void 0)??(typeof O?.sourceDocumentId==="string"?O.sourceDocumentId:void 0)??w.documentId??w.id,N=`${z.docIdPrefix??""}${D}${z.docIdSuffix??""}`,A=[];if(z.includeAttachments!==!1){let P=k2(w,{summary:!1}).attachments,j=new Set;for(let C of P){let b=C.ossSignedUrl??C.url;if(!b)continue;let k=C.fileName??C.fileId??"attachment",h=nn(k),i=h,c=h.lastIndexOf("."),U0=c>0?h.slice(0,c):h,x=c>0?h.slice(c):"",d=1;while(j.has(i.toLowerCase()))i=`${U0}_${d}${x}`,d++;j.add(i.toLowerCase());try{process.stderr.write(`⬇下载单据「${N}」附件:${k}...
`),await new Promise((w,O)=>{let D=uv1(V),N=new Yl({zlib:{level:9}});D.on("close",()=>w()),N.on("error",(A)=>O(A)),N.pipe(D),N.append(Buffer.from(F),{name:"信息表.xlsx"});for(let A of I.values())for(let T of A)N.append(T.buffer,{name:T.zipPath});N.finalize()});let M=iv1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:U.length,attachmentCount:Q,fileSizeBytes:M.size,exportedAt:new Date().toISOString(),nextAction:`seal-usewebhookresource-packpush${V}--corp<targetCorpId>`}}var PR0;var zl=o(()=>{NR0();X6();CB();PR0=Q6(AZ(),1)});import{readFileSync as mv1}from"node:fs";function lv1($){let Y=new URL($),z=Y.pathname.match(/\/webhook\/([^/]+)/);if(!z)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${Y.protocol}//${Y.host}`,webhookId:z[1]}}function ov1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function rv1($,Y){if(!$.length)return;let z=new Set($.map((Q)=>{let J=Q.fileName.split("/")[0],K=J.indexOf("@");return K>=0?J.slice(0,K):J}).filter((Q)=>Q!=="信息表.xlsx")),U=[];for(let Q of Y){let J=Q.document.documentId;if((Q.documentAttachments.length>0||Object.values(Q.expenseAttachments).some((G)=>G.length>0)||Object.values(Q.personAttachments).some((G)=>G.length>0))&&!z.has(J))U.push(`Excel 会议编号「${J}」声明了附件,但在 ZIP 中找不到对应的根目录「${J}/」或「${J}@.../」。`)}let I=new Set(Y.map((Q)=>Q.document.documentId));for(let Q of z)if(!I.has(Q))U.push(`ZIP 根目录对应的编号「${Q}」在信息表中找不到对应的会议编号。`);if(U.length)throw new D5(U)}async function BR0($,Y,z){let U=[],I=$;if(ov1($,Y)){U=await SB0($),yB0(U,z);let G=U.find((W)=>W.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");I=await zd($,G)}let Q=await cB0(I);rv1(U,Q);let J=nB0(U,Q),K=Q.map((G)=>G.document);return{entries:U,parsed:Q,plans:J,documents:K,fileBuffer:$}}async function CU($,Y,z){let U=await BR0($,Y,z),I=U.parsed.map((Q,J)=>Gd(Q.document,U.plans[J],new Map));return{warnings:[],documents:I,attachmentPlan:U.plans}}async function aA($,Y,z){let U=await BR0($,Y,z.materialPackFilePolicy),{baseUrl:I,webhookId:Q}=lv1(z.webhookUrl),J=[];for(let K=0;K<U.parsed.length;K+=1){let G=U.parsed[K],W=U.plans[K],H=new Map,X=[...W.categoryFields,...Object.values(W.personAttachments).flat(),...Object.values(W.expenseAttachments).flat()];for(let V of X)for(let F of V.paths){if(H.has(F))continue;let M=U.entries.find((T)=>T.fileName===F);if(!M)continue;process.stderr.write(`⬆ 上传附件: ${F}
`),U=await Promise.all(D.map((N)=>H4($,N.id)))}let I=new Map,Q=0;for(let w of U){let O=w.document,D=w.sourceDocumentId??(typeof O?.id==="string"?O.id:void 0)??(typeof O?.sourceDocumentId==="string"?O.sourceDocumentId:void 0)??w.documentId??w.id,N=`${z.docIdPrefix??""}${D}${z.docIdSuffix??""}`,B=[];if(z.includeAttachments!==!1){let A=k2(w,{summary:!1}).attachments,j=new Set;for(let C of A){let b=C.ossSignedUrl??C.url;if(!b)continue;let k=C.fileName??C.fileId??"attachment",h=on(k),i=h,c=h.lastIndexOf("."),U0=c>0?h.slice(0,c):h,x=c>0?h.slice(c):"",d=1;while(j.has(i.toLowerCase()))i=`${U0}_${d}${x}`,d++;j.add(i.toLowerCase());try{process.stderr.write(`⬇下载单据「${N}」附件:${k}...
`),await new Promise((w,O)=>{let D=Gh1(V),N=new Jl({zlib:{level:9}});D.on("close",()=>w()),N.on("error",(B)=>O(B)),N.pipe(D),N.append(Buffer.from(F),{name:"信息表.xlsx"});for(let B of I.values())for(let T of B)N.append(T.buffer,{name:T.zipPath});N.finalize()});let M=Wh1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:U.length,attachmentCount:Q,fileSizeBytes:M.size,exportedAt:new Date().toISOString(),nextAction:`seal-usewebhookresource-packpush${V}--corp<targetCorpId>`}}var kR0;var Kl=o(()=>{gR0();X6();SP();kR0=Q6(EZ(),1)});import{readFileSync as Lh1}from"node:fs";function Fh1($){let Y=new URL($),z=Y.pathname.match(/\/webhook\/([^/]+)/);if(!z)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${Y.protocol}//${Y.host}`,webhookId:z[1]}}function wh1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function Mh1($,Y){if(!$.length)return;let z=new Set($.map((Q)=>{let J=Q.fileName.split("/")[0],K=J.indexOf("@");return K>=0?J.slice(0,K):J}).filter((Q)=>Q!=="信息表.xlsx")),U=[];for(let Q of Y){let J=Q.document.documentId;if((Q.documentAttachments.length>0||Object.values(Q.expenseAttachments).some((G)=>G.length>0)||Object.values(Q.personAttachments).some((G)=>G.length>0))&&!z.has(J))U.push(`Excel 会议编号「${J}」声明了附件,但在 ZIP 中找不到对应的根目录「${J}/」或「${J}@.../」。`)}let I=new Set(Y.map((Q)=>Q.document.documentId));for(let Q of z)if(!I.has(Q))U.push(`ZIP 根目录对应的编号「${Q}」在信息表中找不到对应的会议编号。`);if(U.length)throw new D5(U)}async function xR0($,Y,z){let U=[],I=$;if(wh1($,Y)){U=await lP0($),rP0(U,z);let G=U.find((H)=>H.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");I=await Kd($,G)}let Q=await zB0(I);Mh1(U,Q);let J=UB0(U,Q),K=Q.map((G)=>G.document);return{entries:U,parsed:Q,plans:J,documents:K,fileBuffer:$}}async function _U($,Y,z){let U=await xR0($,Y,z),I=U.parsed.map((Q,J)=>qd(Q.document,U.plans[J],new Map));return{warnings:[],documents:I,attachmentPlan:U.plans}}async function zT($,Y,z){let U=await xR0($,Y,z.materialPackFilePolicy),{baseUrl:I,webhookId:Q}=Fh1(z.webhookUrl),J=[];for(let K=0;K<U.parsed.length;K+=1){let G=U.parsed[K],H=U.plans[K],W=new Map,X=[...H.categoryFields,...Object.values(H.personAttachments).flat(),...Object.values(H.expenseAttachments).flat()];for(let V of X)for(let F of V.paths){if(W.has(F))continue;let M=U.entries.find((T)=>T.fileName===F);if(!M)continue;process.stderr.write(`⬆ 上传附件: ${F}
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:Y.sso?H:W,sealResultUrl:W,ssoUrl:H,type:Y.sso?"sso_link":"deep_link",expiresIn:Y.sso?q:void 0,identity:X,warning:Z,enterpriseAssistUrl:J,enterpriseUrl:J,hoseDomain:Q.type==="hose"?Th1(Q.domain):void 0,documentUrl:K,recordId:I?.id,sourceDocumentSN:I?.sourceDocumentSN,sourceDocumentId:I?.sourceDocumentId,sourceSystem:I?.sourceSystem,missing:{enterpriseAssistUrl:J?void 0:"Current enterprise source is not Hose, so no Hose enterprise assist URL is configured.",documentUrl:U&&!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)=>{let z=Y.sn??Y.query;if(!z)throw Error("query or sn is required");let U=await jh1($,{query:z,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),I=await Promise.all(U.records.map((K)=>G4($,K.id))),Q=RR0(Y.fields),J=I.map((K)=>Ph1(K,Q));return{query:z,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:U.total,scanned:U.scanned,matched:J.length,records:J,next:{getSummary:"seal-home approval-runs get <recordId> --summary",getRuleVersion:"seal-home rules version <ruleSetVersionNumber>",searchRuleVersion:`seal-hometoolseal_approval_search--json'{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","ruleVersionNumber":14}'`,getVersionContext:`seal-hometoolseal_approval_context_get--json'{"ruleVersionNumber":14}'`},...Y.includeBridge?{bridge:UT(I)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:L.object({batchId:L.string().describe("simulation batch ID"),query:L.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async($,Y)=>{let z=Vl(await mS($,Y.batchId),Y.query);return{batchId:Y.batchId,count:z.length,records:z.map(_U),bridge:UT(z)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:L.object({mode:L.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:L.array(L.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:L.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:L.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:L.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:L.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:L.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:L.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:L.array(L.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:L.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:L.record(L.string(),L.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),noWait:L.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),rawParams:L.record(L.string(),L.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async($,Y)=>{let z=Y.mode??"hosecloud",U=Y.signKey;if(z==="hosecloud"&&!U){if(U=(await oS($)).find((K)=>K.signKey)?.signKey,!U)throw Error("未找到合思集成 signKey, 请通过 signKey
Line truncated
`)}function kh1($){let Y=[];if(Y.push(`seal-use${$.area}-${$.title}`),$.description)Y.push($.description);Y.push(""),Y.push("Usage:");for(let z of $.commands)for(let U of z.usage)Y.push(`${U}`);if($.commands.some((z)=>z.name))Y.push(""),Y.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return Y.join(`
`)}function rR0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of sR0)for(let z of Y.commands)for(let U of z.usage)$.push(`${U}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var sR0;var Nl=o(()=>{L$();sR0=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",commands:[{name:"list",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"],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"],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",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",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:"bind-test",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",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",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 version on the test enterprise. Production rules remain safe in draft state."},{name:"replay-test",summary:"Replay approval records from production enterprise to bound test enterprise via Webhook",usage:["seal-use corps replay-test [<prodCorpId>] [--record-id <id>] [--sn <sn>] [--limit <n>] [--webhook <idOrName>] [--dry-run]"],options:[{flag:"<prodCorpId>",description:"Production enterprise ID (default: active enterprise)"},{flag:"--record-id <id>",description:"Replay a specific approval run ID"},{flag:"--sn <sn>",description:"Replay a specific document SN"},{flag:"--limit <n>",description:"Batch replay latest N records from production (default: 1)"},{flag:"--status <status>",descripti
Line truncated
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:Y.sso?W:H,sealResultUrl:H,ssoUrl:W,type:Y.sso?"sso_link":"deep_link",expiresIn:Y.sso?q:void 0,identity:X,warning:Z,enterpriseAssistUrl:J,enterpriseUrl:J,hoseDomain:Q.type==="hose"?oh1(Q.domain):void 0,documentUrl:K,recordId:I?.id,sourceDocumentSN:I?.sourceDocumentSN,sourceDocumentId:I?.sourceDocumentId,sourceSystem:I?.sourceSystem,missing:{enterpriseAssistUrl:J?void 0:"Current enterprise source is not Hose, so no Hose enterprise assist URL is configured.",documentUrl:U&&!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)=>{let z=Y.sn??Y.query;if(!z)throw Error("query or sn is required");let U=await rh1($,{query:z,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),I=await Promise.all(U.records.map((K)=>H4($,K.id))),Q=nR0(Y.fields),J=I.map((K)=>dh1(K,Q));return{query:z,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:U.total,scanned:U.scanned,matched:J.length,records:J,next:{getSummary:"seal-home approval-runs get <recordId> --summary",getRuleVersion:"seal-home rules version <ruleSetVersionNumber>",searchRuleVersion:`seal-hometoolseal_approval_search--json'{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","ruleVersionNumber":14}'`,getVersionContext:`seal-hometoolseal_approval_context_get--json'{"ruleVersionNumber":14}'`},...Y.includeBridge?{bridge:GT(I)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:L.object({batchId:L.string().describe("simulation batch ID"),query:L.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async($,Y)=>{let z=Ol(await aS($,Y.batchId),Y.query);return{batchId:Y.batchId,count:z.length,records:z.map(hU),bridge:GT(z)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:L.object({mode:L.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:L.array(L.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:L.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:L.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:L.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:L.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:L.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:L.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:L.array(L.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:L.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:L.record(L.string(),L.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),noWait:L.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),rawParams:L.record(L.string(),L.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async($,Y)=>{let z=Y.mode??"hosecloud",U=Y.signKey;if(z==="hosecloud"&&!U){if(U=(await eS($)).find((K)=>K.signKey)?.signKey,!U)throw Error("未找到合思集成 signKey, 请通过 signKey
Line truncated
`)}function QS1($){let Y=[];if(Y.push(`seal-use${$.area}-${$.title}`),$.description)Y.push($.description);Y.push(""),Y.push("Usage:");for(let z of $.commands)for(let U of z.usage)Y.push(`${U}`);if($.commands.some((z)=>z.name))Y.push(""),Y.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return Y.join(`
`)}function H_0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of W_0)for(let z of Y.commands)for(let U of z.usage)$.push(`${U}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var W_0;var Tl=o(()=>{L$();W_0=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",commands:[{name:"list",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"],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"],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",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",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:"bind-test",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",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",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 version on the test enterprise. Production rules remain safe in draft state."},{name:"replay-test",summary:"Replay approval records from production enterprise to bound test enterprise via Webhook",usage:["seal-use corps replay-test [<prodCorpId>] [--record-id <id>] [--sn <sn>] [--limit <n>] [--webhook <idOrName>] [--dry-run]"],options:[{flag:"<prodCorpId>",description:"Production enterprise ID (default: active enterprise)"},{flag:"--record-id <id>",description:"Replay a specific approval run ID"},{flag:"--sn <sn>",description:"Replay a specific document SN"},{flag:"--limit <n>",description:"Batch replay latest N records from production (default: 1)"},{flag:"--status <status>",descripti
Line truncated
`);c0({provider:"hose",capability:"privilege-elevation",corpId:z.corpId,corpName:z.corpName??z.corpId,baseUrl:z.baseUrl,staffId:z.staffId,keyCount:z.keys.length,keys:z.keys.map((I)=>({id:I.id,name:I.name||"-",appKey:I.appKey,appSecurity:U?I.appSecurity:CS(I.appSecurity),active:I.active,createTime:I.createTime,updateTime:I.updateTime}))})}async function xl($,Y){let z=E1($),U=Y.reveal===!0;if(z.source.type!=="hose")throw new w4(`【合思子域专享能力】当前企业「${z.name}」(id:${z.id})为原生Seal(${z.source.type})租户,非合思(Hose/合思云/易快报)渠道企业。
`);c0({provider:"hose",capability:"privilege-elevation",corpId:z.corpId,corpName:z.corpName??z.corpId,baseUrl:z.baseUrl,staffId:z.staffId,keyCount:z.keys.length,keys:z.keys.map((I)=>({id:I.id,name:I.name||"-",appKey:I.appKey,appSecurity:U?I.appSecurity:SS(I.appSecurity),active:I.active,createTime:I.createTime,updateTime:I.updateTime}))})}async function cl($,Y){let z=E1($),U=Y.reveal===!0;if(z.source.type!=="hose")throw new w4(`【合思子域专享能力】当前企业「${z.name}」(id:${z.id})为原生Seal(${z.source.type})租户,非合思(Hose/合思云/易快报)渠道企业。
`);c0({provider:"hose",capability:"privilege-elevation",corpId:z.id,corpName:z.name,domain:z.source.domain,staffId:z.source.staffId,appKey:I??"-",appSecurity:Q?U?Q:CS(Q):"-",active:!0})}function bv0($,Y){let{token:z,sealUrl:U,expiresIn:I,verify:Q,remote:J}=Y,K=Y.custom??fv0($),G=J?.user,W=J?.tenant,H=H4($,"tenantSlug")??s2(W?.tenantSlug),X=H4($,"tenantId")??s2(W?.id),Z=H4($,"tenantName")??s2(W?.name),q=H4($,"id")??H??X;if(!q)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let V=H4($,"staffId")??s2(G?.providerUserId)??s2(G?.id)??"seal",F=H4($,"provider")??s2(G?.provider)??s2(W?.providerConfig?.provider),M=H4($,"corpId")??H??X??q,w={id:q,name:H4($,"name")??Z??q,environment:"production",seal:{url:U,tenantSlug:H,headers:K.headers,cookies:K.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:z,sealUrl:U,expiresIn:I,staffId:V,corpId:M,tenantId:X,tenantSlug:H,tenantName:Z,providerUserId:s2(G?.providerUserId),provider:F},auth:{refreshTtl:300}},O=rn();Sv0(O,{recursive:!0,mode:448});let D=yv0(O,`${WT(q)}.json`);if(hv0(D)&&$.overwrite!==!0)throw Error(`Enterpriseconfigalreadyexists:${D}.Pass"overwrite":truetoreplaceit.`);gv0(D,`${JSON.stringify(w,null,2)}
`,{mode:384}),c0({id:q,name:w.name,tenantId:X,tenantSlug:H,verified:Q,path:D})}async function BS1($,Y,z={}){let U=T8($,Y,z),I=await H8(U);return{user:I.user??{},tenant:I.tenant??{}}}function s2($){return typeof $==="string"&&$?$:void 0}var fl=o(()=>{a9();DW();i8();S3();Av0();yB();ln();X6();X6();gl();_Z();PT();o4();L$();D4();Q4()});async function cv0($,Y){let z=$??S(Y.options.link)??S(Y.options.url);if(!z)throw Error("Usage: seal-use auth extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let U=V0(Y.options.reveal)===!0||V0(Y.options.r)===!0||V0(Y.options.plain)===!0,I=V0(Y.options.save)===!0||V0(Y.options.add)===!0;await BT(z,{reveal:U,save:I,name:S(Y.options.name),overwrite:V0(Y.options.overwrite)===!0,force:V0(Y.options.force)===!0,appKey:S(Y.options["app-key"])??S(Y.options.appKey),keyId:S(Y.options["key-id"])??S(Y.options.keyId)})}async function nv0($,Y,z){if($==="diagnose"){c0(await AS1(Y));return}if($==="hose-link"){let U=z.options.expire,I=U!==void 0?s0(U):7200;if(I===void 0||I<=0)throw Error(`Invalid--expire:${String(U)}.Mustbeapositivenumberofseconds(e.g.--expire7200or--expire86400).`);let Q=V0(z.options.force)===!0||V0(z.options.refresh)===!0||V0(z.options.f)===!0;c0(await W00(Y,I,{force:Q}));return}if($==="keys"){let U=V0(z.options.reveal)===!0||V0(z.options.r)===!0||V0(z.options.plain)===!0;await xl(Y.id,{reveal:U});return}throw Error(`Unknownauthcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function AS1($){if($.source.type!=="hose"){let F=await j1($),M=await H8(F);return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!0,stages:[{name:"seal.whoami",ok:!0,user:M.user,tenant:M.tenant}]}}mw($.id);let Y=$.source,z=Y.appKey??Y.key,U=Y.appSecurity??Y.password,I=($.seal.url??Y.sealUrl??`https://${Y.corpId.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),Q=Y.staffId.includes(":")?Y.staffId:`${Y.corpId}:${Y.staffId}`,J=[];if(!z||!U)return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!1,stages:[{name:"hose.openapi",ok:!1,error:"Hose source requires appKey/key and appSecurity/password"}]};let K=await AT("hose.openapi",async()=>{let F=await iv0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1/auth/getAccessToken`,{appKey:z,appSecurity:U}),M=d3(F.value),w=b6(M.accessToken)??b6(F.accessToken)??b6(F.token);if(!w)throw Error("Hose login did not return an access token");return{token:w,public:{corporationId:b6(M.corporationId)??b6(d3(M.corporation).id),expireTime:Dq(M.expireTime)}}});J.push(K.public);let G=K.private?.token,W=G?await AT("hose.provisional",async()=>{let F=await iv0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=${encodeURIComponent(G)}`,{uid:Q,pageType:"home",expireDate:7200}),M=b6(d3(F.value).message);if(!M)throw Error("Hose CloseAPI did not return a provisional auth URL");let w=new URL(M).searchParams.get("accessToken");if(!w)throw Error("Hose provisional auth URL did not include accessToken");return{token:w,public:{uid:Q,enterpriseUrl:Fq(M)}}}):ul("hose.provisional");J.push(W.public);let H=P6($.seal),X=W.private?.token,Z=X?await AT("seal.sso",async()=>{let M=await T8(I,void 0,H).get(`api/auth/oauth2/session/oem-hosecloud?token=${encodeURIComponent(X)}&returnToken=1`).json(),w=d3(M.data),O=b6(M.token)??b6(M.accessToken)??b6(w.token)??b6(w.accessToken);if(!O)throw Error("Seal SSO did not return a bearer token");return{token:O,public:{sealUrl:I,expiresIn:Dq(M.expiresIn)??Dq(M.expires_in)??Dq(w.expiresIn)??Dq(w.expires_in)}}}):ul("seal.sso");J.push(Z.public);let q=Z.private?.token,V=q?await AT("seal.whoami",async()=>{let M=await T8(I,q,H).get("api/v1/auth/me").json(),w=d3(M.data),O=d3(w.user??M.user),D=d3(w.tenant??M.tenant);return{public:{user:{id:b6(O.id),name:b6(O.name),isAdmin:jS1(O.isAdmin),providerUserId:b6(O.providerUserId)},tenant:{id:b6(D.id),name:b6(D.name),tenantSlug:b6(D.tenantSlug),hoseCorpConfig:ES1(D.hoseCorpConfig)}}}}):ul("seal.whoami");return J.push(V.public),{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:J.every((F)=>F.ok===!0),stages:J}}async function AT($,Y){try{let z=await Y();return{public:{name:$,ok:!0,...pv0(z.public)},private:z.token?{token:z.token}:void 0}}catch(z){return{public:{name:$,ok:!1,error:Fq(z instanceof Error?z.message:String(z))}}}}function ul($){return{public:{name:$,ok:!1,skipped:!0}}}async function iv0($,Y){let z=await fetch($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Y)});return TS1(z)}async function TS1($){let Y=await $.text();if(!$.ok)throw Error(`${$.status} ${Y}`);let z=JSON.parse(Y);return d3(z)}function d3($){return $&&typeof $==="object"&&!Array.isArray($)?$:{}}function b6($){return typeof $==="string"&&$?$:void 0}function Dq($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function jS1($){return typeof $==="boolean"?$:void 0}function ES1($){let Y=d3($);return pv0({corporationId:b6(Y.corporationId),corporationName:b6(Y.corporationName)})}f
Line truncated
`);c0({provider:"hose",capability:"privilege-elevation",corpId:z.id,corpName:z.name,domain:z.source.domain,staffId:z.source.staffId,appKey:I??"-",appSecurity:Q?U?Q:SS(Q):"-",active:!0})}function $h0($,Y){let{token:z,sealUrl:U,expiresIn:I,verify:Q,remote:J}=Y,K=Y.custom??tv0($),G=J?.user,H=J?.tenant,W=X4($,"tenantSlug")??s2(H?.tenantSlug),X=X4($,"tenantId")??s2(H?.id),Z=X4($,"tenantName")??s2(H?.name),q=X4($,"id")??W??X;if(!q)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let V=X4($,"staffId")??s2(G?.providerUserId)??s2(G?.id)??"seal",F=X4($,"provider")??s2(G?.provider)??s2(H?.providerConfig?.provider),M=X4($,"corpId")??W??X??q,w={id:q,name:X4($,"name")??Z??q,environment:"production",seal:{url:U,tenantSlug:W,headers:K.headers,cookies:K.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:z,sealUrl:U,expiresIn:I,staffId:V,corpId:M,tenantId:X,tenantSlug:W,tenantName:Z,providerUserId:s2(G?.providerUserId),provider:F},auth:{refreshTtl:300}},O=$p();lv0(O,{recursive:!0,mode:448});let D=rv0(O,`${VT(q)}.json`);if(mv0(D)&&$.overwrite!==!0)throw Error(`Enterpriseconfigalreadyexists:${D}.Pass"overwrite":truetoreplaceit.`);ov0(D,`${JSON.stringify(w,null,2)}
`,{mode:384}),c0({id:q,name:w.name,tenantId:X,tenantSlug:W,verified:Q,path:D})}async function mS1($,Y,z={}){let U=T8($,Y,z),I=await W8(U);return{user:I.user??{},tenant:I.tenant??{}}}function s2($){return typeof $==="string"&&$?$:void 0}var nl=o(()=>{a9();BH();i8();S3();fv0();bP();tn();X6();X6();ul();SZ();ET();o4();L$();D4();Q4()});async function zh0($,Y){let z=$??S(Y.options.link)??S(Y.options.url);if(!z)throw Error("Usage: seal-use auth extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let U=V0(Y.options.reveal)===!0||V0(Y.options.r)===!0||V0(Y.options.plain)===!0,I=V0(Y.options.save)===!0||V0(Y.options.add)===!0;await CT(z,{reveal:U,save:I,name:S(Y.options.name),overwrite:V0(Y.options.overwrite)===!0,force:V0(Y.options.force)===!0,appKey:S(Y.options["app-key"])??S(Y.options.appKey),keyId:S(Y.options["key-id"])??S(Y.options.keyId)})}async function Uh0($,Y,z){if($==="diagnose"){c0(await lS1(Y));return}if($==="hose-link"){let U=z.options.expire,I=U!==void 0?s0(U):7200;if(I===void 0||I<=0)throw Error(`Invalid--expire:${String(U)}.Mustbeapositivenumberofseconds(e.g.--expire7200or--expire86400).`);let Q=V0(z.options.force)===!0||V0(z.options.refresh)===!0||V0(z.options.f)===!0;c0(await P00(Y,I,{force:Q}));return}if($==="keys"){let U=V0(z.options.reveal)===!0||V0(z.options.r)===!0||V0(z.options.plain)===!0;await cl(Y.id,{reveal:U});return}throw Error(`Unknownauthcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function lS1($){if($.source.type!=="hose"){let F=await j1($),M=await W8(F);return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!0,stages:[{name:"seal.whoami",ok:!0,user:M.user,tenant:M.tenant}]}}aw($.id);let Y=$.source,z=Y.appKey??Y.key,U=Y.appSecurity??Y.password,I=($.seal.url??Y.sealUrl??`https://${Y.corpId.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),Q=Y.staffId.includes(":")?Y.staffId:`${Y.corpId}:${Y.staffId}`,J=[];if(!z||!U)return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!1,stages:[{name:"hose.openapi",ok:!1,error:"Hose source requires appKey/key and appSecurity/password"}]};let K=await RT("hose.openapi",async()=>{let F=await Yh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1/auth/getAccessToken`,{appKey:z,appSecurity:U}),M=d3(F.value),w=b6(M.accessToken)??b6(F.accessToken)??b6(F.token);if(!w)throw Error("Hose login did not return an access token");return{token:w,public:{corporationId:b6(M.corporationId)??b6(d3(M.corporation).id),expireTime:Bq(M.expireTime)}}});J.push(K.public);let G=K.private?.token,H=G?await RT("hose.provisional",async()=>{let F=await Yh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=${encodeURIComponent(G)}`,{uid:Q,pageType:"home",expireDate:7200}),M=b6(d3(F.value).message);if(!M)throw Error("Hose CloseAPI did not return a provisional auth URL");let w=new URL(M).searchParams.get("accessToken");if(!w)throw Error("Hose provisional auth URL did not include accessToken");return{token:w,public:{uid:Q,enterpriseUrl:Oq(M)}}}):pl("hose.provisional");J.push(H.public);let W=A6($.seal),X=H.private?.token,Z=X?await RT("seal.sso",async()=>{let M=await T8(I,void 0,W).get(`api/auth/oauth2/session/oem-hosecloud?token=${encodeURIComponent(X)}&returnToken=1`).json(),w=d3(M.data),O=b6(M.token)??b6(M.accessToken)??b6(w.token)??b6(w.accessToken);if(!O)throw Error("Seal SSO did not return a bearer token");return{token:O,public:{sealUrl:I,expiresIn:Bq(M.expiresIn)??Bq(M.expires_in)??Bq(w.expiresIn)??Bq(w.expires_in)}}}):pl("seal.sso");J.push(Z.public);let q=Z.private?.token,V=q?await RT("seal.whoami",async()=>{let M=await T8(I,q,W).get("api/v1/auth/me").json(),w=d3(M.data),O=d3(w.user??M.user),D=d3(w.tenant??M.tenant);return{public:{user:{id:b6(O.id),name:b6(O.name),isAdmin:rS1(O.isAdmin),providerUserId:b6(O.providerUserId)},tenant:{id:b6(D.id),name:b6(D.name),tenantSlug:b6(D.tenantSlug),hoseCorpConfig:sS1(D.hoseCorpConfig)}}}}):pl("seal.whoami");return J.push(V.public),{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:J.every((F)=>F.ok===!0),stages:J}}async function RT($,Y){try{let z=await Y();return{public:{name:$,ok:!0,...Ih0(z.public)},private:z.token?{token:z.token}:void 0}}catch(z){return{public:{name:$,ok:!1,error:Oq(z instanceof Error?z.message:String(z))}}}}function pl($){return{public:{name:$,ok:!1,skipped:!0}}}async function Yh0($,Y){let z=await fetch($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Y)});return oS1(z)}async function oS1($){let Y=await $.text();if(!$.ok)throw Error(`${$.status} ${Y}`);let z=JSON.parse(Y);return d3(z)}function d3($){return $&&typeof $==="object"&&!Array.isArray($)?$:{}}function b6($){return typeof $==="string"&&$?$:void 0}function Bq($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function rS1($){return typeof $==="boolean"?$:void 0}function sS1($){let Y=d3($);return Ih0({corporationId:b6(Y.corporationId),corporationName:b6(Y.corporationName)})}f
Line truncated
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let Z of X){let q=Z.outboundName??"SealAI 审批",V=Z.signKey,F=Z.apiOrigin??"production";console.error(`•"${q}"(signKey:${V},环境:${F})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${V}--corp${I.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of Z){let F=V.outboundName??"SealAI 审批",M=V.signKey,w=V.apiOrigin??"production";console.error(`•"${F}"(signKey:${M},环境:${w})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${M}--corp${I.id}
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 Xh0=()=>{};var Vh0="# 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-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--batch<batchId>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest--fieldsrecordId,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-useapproval-runsget<recordId>--corp<corpId>--summary\n```\n\nUse `--fields` when the user needs a particular slice.\n\n```bash\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsmetadata\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.fields,result.summary\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsresult.summary,result.decision,result.riskPoints\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.keyFields,result,manualApprovalRecord,ruleSetVersionNumber\n```\n\nAvoid full `approval-runsget<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-useapproval-runsdocument-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-useapproval-runscited-rules<recordId>--corp<corpId>\n```\n\nReturn and discuss `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule, use `rulesget--record-id<recordId>--runtime-idrule-205` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\n#查看附件列表摘要(包含文件名、类型、大小及直链可用性)\nseal-useapproval-runsattachments<recordId>--corp<corpId>--summary\n\n#下载全部附件到本地目录(优先使用ossSignedUrl签名直链)\nseal-useapproval-runsattachmentsdownload<recordId>--all--out-dir./downloads--corp<corpId>\n\n#按名称或fileId过滤下载单个附件\nseal-useapproval-runsattachmentsdownload<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-useapproval-runsresult<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 & SSO 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#默认推荐:生成干净的深度链接(无凭证、无越权风险,用户在已有登录状态的浏览器中直接打开)\nseal-useapproval-runsurl<recordId>--corp<corpId>\nseal-useapproval-runsurl--sn<sourceDocumentSN>--corp<corpId>\n\n#仅当用户明确要求免密/跨浏览器/无登录直达且确认知晓安全风险时:生成携带单次临时票据的SSO直登链接\nseal-useapproval-runsurl<recordId>--sso[--expire7200]--corp<corpId>\n```\n\n### SSO 链接安全与声明规范\n当向用户返回 `--sso` 链接时,Agent **必须**在回答中明确说明以下 4 点:\n1. **身份主体**:该链接代表哪个具体员工身份(如管理员姓名)登录。\n2. **权限范围**:该身份在 Seal AI 平台的全部权限范围(如完全操作权限)。\n3. **时效性**:临时 Ticket 换票时效(默认 2 小时,换票登录后会话有效 30 天)。\n4. **安全与防扩散边界**:该链接仅在 Seal AI 租户内生效,不代表合思主系统权限;严禁在公开或外部群聊中传播。\n\n>
Line truncated
`;var Th0=()=>{};var Ch0="# 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-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--batch<batchId>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest--fieldsrecordId,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-useapproval-runsget<recordId>--corp<corpId>--summary\n```\n\nUse `--fields` when the user needs a particular slice.\n\n```bash\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsmetadata\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.fields,result.summary\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsresult.summary,result.decision,result.riskPoints\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.keyFields,result,manualApprovalRecord,ruleSetVersionNumber\n```\n\nAvoid full `approval-runsget<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-useapproval-runsdocument-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-useapproval-runscited-rules<recordId>--corp<corpId>\n```\n\nReturn and discuss `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule, use `rulesget--record-id<recordId>--runtime-idrule-205` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\n#查看附件列表摘要(包含文件名、类型、大小及直链可用性)\nseal-useapproval-runsattachments<recordId>--corp<corpId>--summary\n\n#下载全部附件到本地目录(优先使用ossSignedUrl签名直链)\nseal-useapproval-runsattachmentsdownload<recordId>--all--out-dir./downloads--corp<corpId>\n\n#按名称或fileId过滤下载单个附件\nseal-useapproval-runsattachmentsdownload<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-useapproval-runsresult<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 & SSO 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#默认推荐:生成干净的深度链接(无凭证、无越权风险,用户在已有登录状态的浏览器中直接打开)\nseal-useapproval-runsurl<recordId>--corp<corpId>\nseal-useapproval-runsurl--sn<sourceDocumentSN>--corp<corpId>\n\n#仅当用户明确要求免密/跨浏览器/无登录直达且确认知晓安全风险时:生成携带单次临时票据的SSO直登链接\nseal-useapproval-runsurl<recordId>--sso[--expire7200]--corp<corpId>\n```\n\n### SSO 链接安全与声明规范\n当向用户返回 `--sso` 链接时,Agent **必须**在回答中明确说明以下 4 点:\n1. **身份主体**:该链接代表哪个具体员工身份(如管理员姓名)登录。\n2. **权限范围**:该身份在 Seal AI 平台的全部权限范围(如完全操作权限)。\n3. **时效性**:临时 Ticket 换票时效(默认 2 小时,换票登录后会话有效 30 天)。\n4. **安全与防扩散边界**:该链接仅在 Seal AI 租户内生效,不代表合思主系统权限;严禁在公开或外部群聊中传播。\n\n>
Line truncated
-**FormattingRequirement**:WhenreturningaHoseauthorizationlinktotheuser,ALWAYSprovideBOTHacodeblock(\`\`\`\`text ... \`\`\`\`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
-**DedicatedCLICommand**: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). Note: this link cannot be listed via \`seal-use delegation list\` (the latter only tracks Seal audit platform delegations).
@@ -2145,7 +2145,7 @@ Use current search only when the question is about current draft/current knowled
##OutputDiscipline
Ifarulecommandwouldreturnmanydescriptionsormorethanabout20rules,use\`rules count\`, \`rules list --summary\`, \`fields\`, \`snippetOnly\`, or \`--output-file\`. Use \`--full\` only for deliberate exports.
`;var Rh0=()=>{};var hh0="# 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-usedoctor` audits the rule linter configuration state and active linter name in its health checks, and surfaces a one-click hint (`seal-useconfiglintenable`) when disabled.\n- **Explicit Triggering**: `seal-useruleslint` always runs regardless of global configuration.\n- **Draft Hook**: When `seal-useconfiglintenable` is set, `seal_approval_rule_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-useruleslint--corp<corpId>\n```\n\n### 2. Lint Specific Historical Version or Single Rule\n\n```bash\n#Lintrulesinpublishedversion16\nseal-useruleslint--version16--corp<corpId>\n\n#Lintaspecificrulebycode(#0038)\nseal-useruleslint--code'#0038'--corp<corpId>\n\n#Summarymode(onlyshowruleswithissues)\nseal-useruleslint--summary--corp<corpId>\n```\n\n### 3. Quality Gate for CI / Release\n\n```bash\n#Ifoverallscoreisbelow85,terminateswithexitcode1\nseal-useruleslint--min-score85--levelerror--corp<corpId>\n```\n\n### 4. Configure Global Linter Settings\n\n```bash\n#Checkstatus\nseal-useconfiglintstatus\n\n#Enableautolintonruleupdates\nseal-useconfiglintenable--linterbuiltin--min-score80\n\n#Disableautolint\nseal-useconfiglintdisable\n```\n\n## Official Linters\n\n| Linter Name | Scope & Purpose | Aliases |\n| :--- | :--- | :--- |\n| `builtin` | Seal 官方标准校验器:拦截过短描述、主观模糊词与悬空例外条款。 | `default`, `official/builtin` |\n| `strict` | Seal 官方严格风控校验器:强校验字数、刚性定量约束、凭证依据与具体审批人角色。 | `official/strict` |\n| `hlab` | 合思实验室 (HLab) 结构化规则校验器:SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判。 | `hlab-sop`, `hlab-rules`, `hlab-standard`, `official/hlab` |\n\n```bash\n#Inspectavailablelinters\nseal-useruleslinters\n\n#LintrulesusingHLabSOPstandard\nseal-useruleslint--linterhlab--corp<corpId>\n\n#LintlocalruleworkspaceofflinewithHLabstandard\nseal-useruleslint--linterhlab--file./rules.local.json\n```\n\n## Built-In Detection Rules (`builtin`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `TOO_SHORT` | `error` | Rule description is under 5 characters. | Add concrete conditions and criteria. |\n| `VAGUE_WORD` | `error` | Contains subjective/fuzziness words (`原则上`, `尽量`, `适当`, `酌情`, `一般情况下`, `合理控制`). | Replace with rigid thresholds, enums, or criteria. |\n| `HANGING_EXCEPTION` | `warning` | Exception trigger found (`除非`, `特殊情况`, `经批准`) without verifiable evidence keyword (`备注`, `附件`, `证明`, `邮件`, `截图`). | Specify exact evidence source in invoice/document. |\n\n## HLab SOP Detection Rules (`hlab`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `MISSING_CHECK_METHOD` | `error` | Missing `**检查方法**` section in rule description. | Add `**检查方法**:` specifying fields, vouchers, and normalization logic. |\n| `MISSING_EVAL_STANDARD` | `error` | Missing `**判定标准**` section in rule description. | Add `**判定标准**:` with standard branches. |\n| `INCOMPLETE_TERNARY_BRANCH` | `error` | Incomplete ternary branch under evaluation criteria (missing `PASS`, `FAIL`, or `证据不足`). | Provide complete ternary closure: `-PASS:`, `-FAIL:`, `-证据不足:`. |\n| `INSUFFICIENT_WITHOUT_MANUAL_REVIEW` | `warning` | `证据不足` branch does not specify escalating to `人工复核`. | Add `转人工复核` at the end of `证据不足` branch. |\n| `DISPOSAL_ACTION_LEAK` | `warning` | Contains whole-bill workflow disposal actions (`驳回单据`, `直接驳回`, `进行提醒`, `退回单据`). | Decouple disposal actions from rule text; rely on rule strictness or platform workflow. |\n| `SCOPE_FALSE_SKIP_PRONE` | `warning` | Scope contains material upload conditions (`若上传了`, `若提供了`, `附件需上传`). | Keep scope pure to business triggers; handle missing materials explicitly in FAIL branch to prevent silent SKIP. |\n| `RISK_SUPPRESSION` | `erroLine truncated
`;var nh0=()=>{};var mh0="# 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-usedoctor` audits the rule linter configuration state and active linter name in its health checks, and surfaces a one-click hint (`seal-useconfiglintenable`) when disabled.\n- **Explicit Triggering**: `seal-useruleslint` always runs regardless of global configuration.\n- **Draft Hook**: When `seal-useconfiglintenable` is set, `seal_approval_rule_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-useruleslint--corp<corpId>\n```\n\n### 2. Lint Specific Historical Version or Single Rule\n\n```bash\n#Lintrulesinpublishedversion16\nseal-useruleslint--version16--corp<corpId>\n\n#Lintaspecificrulebycode(#0038)\nseal-useruleslint--code'#0038'--corp<corpId>\n\n#Summarymode(onlyshowruleswithissues)\nseal-useruleslint--summary--corp<corpId>\n```\n\n### 3. Quality Gate for CI / Release\n\n```bash\n#Ifoverallscoreisbelow85,terminateswithexitcode1\nseal-useruleslint--min-score85--levelerror--corp<corpId>\n```\n\n### 4. Configure Global Linter Settings\n\n```bash\n#Checkstatus\nseal-useconfiglintstatus\n\n#Enableautolintonruleupdates\nseal-useconfiglintenable--linterbuiltin--min-score80\n\n#Disableautolint\nseal-useconfiglintdisable\n```\n\n## Official Linters\n\n| Linter Name | Scope & Purpose | Aliases |\n| :--- | :--- | :--- |\n| `builtin` | Seal 官方标准校验器:拦截过短描述、主观模糊词与悬空例外条款。 | `default`, `official/builtin` |\n| `strict` | Seal 官方严格风控校验器:强校验字数、刚性定量约束、凭证依据与具体审批人角色。 | `official/strict` |\n| `hlab` | 合思实验室 (HLab) 结构化规则校验器:SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判。 | `hlab-sop`, `hlab-rules`, `hlab-standard`, `official/hlab` |\n\n```bash\n#Inspectavailablelinters\nseal-useruleslinters\n\n#LintrulesusingHLabSOPstandard\nseal-useruleslint--linterhlab--corp<corpId>\n\n#LintlocalruleworkspaceofflinewithHLabstandard\nseal-useruleslint--linterhlab--file./rules.local.json\n```\n\n## Built-In Detection Rules (`builtin`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `TOO_SHORT` | `error` | Rule description is under 5 characters. | Add concrete conditions and criteria. |\n| `VAGUE_WORD` | `error` | Contains subjective/fuzziness words (`原则上`, `尽量`, `适当`, `酌情`, `一般情况下`, `合理控制`). | Replace with rigid thresholds, enums, or criteria. |\n| `HANGING_EXCEPTION` | `warning` | Exception trigger found (`除非`, `特殊情况`, `经批准`) without verifiable evidence keyword (`备注`, `附件`, `证明`, `邮件`, `截图`). | Specify exact evidence source in invoice/document. |\n\n## HLab SOP Detection Rules (`hlab`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `MISSING_CHECK_METHOD` | `error` | Missing `**检查方法**` section in rule description. | Add `**检查方法**:` specifying fields, vouchers, and normalization logic. |\n| `MISSING_EVAL_STANDARD` | `error` | Missing `**判定标准**` section in rule description. | Add `**判定标准**:` with standard branches. |\n| `INCOMPLETE_TERNARY_BRANCH` | `error` | Incomplete ternary branch under evaluation criteria (missing `PASS`, `FAIL`, or `证据不足`). | Provide complete ternary closure: `-PASS:`, `-FAIL:`, `-证据不足:`. |\n| `INSUFFICIENT_WITHOUT_MANUAL_REVIEW` | `warning` | `证据不足` branch does not specify escalating to `人工复核`. | Add `转人工复核` at the end of `证据不足` branch. |\n| `DISPOSAL_ACTION_LEAK` | `warning` | Contains whole-bill workflow disposal actions (`驳回单据`, `直接驳回`, `进行提醒`, `退回单据`). | Decouple disposal actions from rule text; rely on rule strictness or platform workflow. |\n| `SCOPE_FALSE_SKIP_PRONE` | `warning` | Scope contains material upload conditions (`若上传了`, `若提供了`, `附件需上传`). | Keep scope pure to business triggers; handle missing materials explicitly in FAIL branch to prevent silent SKIP. |\n| `RISK_SUPPRESSION` | `erroLine truncated
description:"v0.10.29: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
Rule,document,stylepreference,andpublishactionsmutateSealconfiguration.Makethetargetenterpriseexplicit,showtheintendedpayload,andverifyafterthewrite.Neversendreal\`enterprises/*.json\` files, tokens, signed URLs, or full raw documents to GitHub, tickets, logs, or chat unless the user explicitly requests a safe export.
`;var yh0=()=>{};var pS1="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
`;var rh0=()=>{};var qg1="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:U,configured:!0,configPath:z,targetDir:Y,action:"prepended"}}function rl($){let Y=$?.targetSkillsDir??$S0(),z=$?.configFile??YS0(),U=zS0(),I=!1;if(Tq(z))try{let Q=JSON.parse(eh0(z,"utf8"));if(Array.isArray(Q?.entries))I=Q.entries.some((J)=>J?.path===Y)}catch{}return{detected:U,configured:I,configPath:z,targetDir:Y}}var sl=()=>{};import{cpSync as Dg1,existsSync as kK,lstatSync as IS0,mkdirSync as Ag1,realpathSync as a2,rmSync as Pg1,symlinkSync as Bg1,unlinkSync as US0}from"node:fs";import{homedir as QS0}from"node:os";import{dirname as JS0,join as t2}from"node:path";function Tg1($,Y){let z=Y?.baseHomeDir??QS0(),U=t2(z,$.rootDirName),I=Y?.sourceSkillDir??t2(z,".agents","skills","seal-use"),Q=JS0(I),J=t2(U,"skills"),K=t2(J,"seal-use");if(!kK(U))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(kK(J)&&kK(Q))try{if(a2(J)===a2(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:J}}catch{}Ag1(J,{recursive:!0});let G;try{G=IS0(K)}catch{G=void 0}let H=!1;if(G)if(G.isSymbolicLink()){try{if(a2(K)===a2(I))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:K}}catch{}try{US0(K)}catch{}}else if(G.isDirectory())Pg1(K,{recursive:!0,force:!0}),H=!0;else US0(K);let W=process.platform==="win32"?"junction":"dir";try{return Bg1(I,K,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:H?"replaced_real_dir":"linked",targetPath:K}}catch{try{return Dg1(I,K,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:K}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:K,error:X?.message||String(X)}}}}function jg1($,Y){let z=Y?.baseHomeDir??QS0(),U=t2(z,$.rootDirName),I=Y?.sourceSkillDir??t2(z,".agents","skills","seal-use"),Q=JS0(I),J=t2(U,"skills"),K=t2(J,"seal-use");if(!kK(U))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(kK(J)&&kK(Q))try{if(a2(J)===a2(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:J}}catch{}let G;try{G=IS0(K)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if(a2(K)===a2(I))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:K}}catch{}else if(G.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:K}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:K}}function al($){return KS0.map((Y)=>Tg1(Y,$))}function tl($){return KS0.map((Y)=>jg1(Y,$))}var KS0;var el=o(()=>{KS0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var $o=o(()=>{sl();el();sl();el()});import{existsSync as Eg1,mkdirSync as Yo,readFileSync as Cg1,rmSync as Rg1,writeFileSync as GS0}from"node:fs";import{homedir as WS0}from"node:os";import{dirname as HS0,join as Eq}from"node:path";function zo(){return XS0["SKILL.md"]||""}function ZS0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function qS0($=Eq(gU(),"SKILL.md")){try{return ZS0(Cg1($,"utf8"))}catch{return}}function gU(){return Eq(WS0(),".agents","skills","seal-use")}function vg1(){return Eq(WS0(),".agents","skills","seal-home")}function hg1(){let $=vg1();if(Eg1($))try{return Rg1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function VS0($=gU()){hg1(),Yo($,{recursive:!0});let Y=[];for(let[z,U]of Object.entries(XS0)){let I=Eq($,z);Yo(HS0(I),{recursive:!0}),GS0(I,U,"utf8"),Y.push(z)}for(let[z,U]of Object.entries(_g1)){let I=Eq($,z);Yo(HS0(I),{recursive:!0}),GS0(I,U),Y.push(z)}return{targetDir:$,files:Y}}var XS0,_g1,D24;var Cq=o(()=>{dl();dl();$o();XS0=ah0,_g1=Object.fromEntries(Object.entries(th0).map(([$,Y])=>[$,Buffer.from(Y,"base64")]));D24=ZS0(zo())});function LS0(){return`#SealUse系统架构与运行规范白皮书
`)}var eh0=o(()=>{X6()});async function $S0($,Y,z){let U=($??Y??"").toLowerCase();if(U==="guide"||U==="doc"||U==="knowledge"||U==="book"){console.error(`\uD83D\uDCD6[SealUseDoctor]正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(mh0());return}if(U==="paths"||U==="dirs"||U==="directories"){let J=ll();c0(J.directories);return}if(U==="tenant"||U==="corp"||U==="enterprise"){let{selectCorp:J}=await Promise.resolve().then(() => (o4(),z_0)),{createSealClient:K}=await Promise.resolve().then(() => (i8(),L00)),{stringOption:G}=await Promise.resolve().then(() => (D4(),oR0)),{diagnoseTenantContract:W,formatTenantDoctorDashboard:H}=await Promise.resolve().then(() => (eh0(),th0)),X=G(z.options.corp)??(Y&&Y!==U?Y:void 0)??(z.command[2]&&z.command[2]!==U?z.command[2]:void 0),Z=J(X),q=await K(Z),V=await W(q,Z);if(!(V0(z.options.quiet)||V0(z.options.silent)))console.error(H(V));c0(V);return}let I=ll();if(!(V0(z.options.quiet)||V0(z.options.silent)))console.error(sh0(I));c0(I)}var YS0=o(()=>{ah0();ml();D4();Q4()});var US0;var zS0=o(()=>{US0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.29",description:"HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-usehttp`, or the `seal-useservicestart` daemon; default http://127.0.0.1:8787).\n\nThese endpoints describe the stable wrapped API for frontend developers and agents. They are\nnot the raw downstream Seal endpoints: seal-use is responsible for enterprise selection,\nsource authentication, response compaction, and diagnostics-friendly fields.\n\nEvery operation declares `x-implementation-status`, so a caller can tell what the running\nadapter actually serves:\n\n- `implemented` — routed by `src/http/routes.ts` today. `src/http/openapi-implementation.test.ts`\n fails when an `implemented` operation has no matching route.\n- `planned` — contract-only, designed but not routed yet. Calling it returns 404.\n\nThe same capabilities are reachable through the CLI, and through the optional MCP server when\nit is enabled.\n"},servers:[{url:"http://localhost:8787",description:"Local HTTP adapter (`seal-usehttp`, or the `seal-useservicestart` daemon). Loopback-only by default."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps","x-implementation-status":"implemented",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp","x-implementation-status":"planned",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp","x-implementation-status":"planned",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig","x-implementation-status":"planned",summary:"Resolve source-derived Seal enterprise config",parameters:[{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."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local
Line truncated
`)}var AS0=o(()=>{X6()});async function PS0($,Y,z){let U=($??Y??"").toLowerCase();if(U==="guide"||U==="doc"||U==="knowledge"||U==="book"){console.error(`\uD83D\uDCD6[SealUseDoctor]正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(LS0());return}if(U==="paths"||U==="dirs"||U==="directories"){let J=Ko();c0(J.directories);return}if(U==="tenant"||U==="corp"||U==="enterprise"){let{selectCorp:J}=await Promise.resolve().then(() => (o4(),F_0)),{createSealClient:K}=await Promise.resolve().then(() => (i8(),R00)),{stringOption:G}=await Promise.resolve().then(() => (D4(),G_0)),{diagnoseTenantContract:H,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (AS0(),DS0)),X=G(z.options.corp)??(Y&&Y!==U?Y:void 0)??(z.command[2]&&z.command[2]!==U?z.command[2]:void 0),Z=J(X),q=await K(Z),V=await H(q,Z);if(!(V0(z.options.quiet)||V0(z.options.silent)))console.error(W(V));c0(V);return}let I=Ko();if(!(V0(z.options.quiet)||V0(z.options.silent)))console.error(OS0(I));c0(I)}var BS0=o(()=>{NS0();Jo();D4();Q4()});var jS0;var TS0=o(()=>{jS0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.29",description:"HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-usehttp`, or the `seal-useservicestart` daemon; default http://127.0.0.1:8787).\n\nThese endpoints describe the stable wrapped API for frontend developers and agents. They are\nnot the raw downstream Seal endpoints: seal-use is responsible for enterprise selection,\nsource authentication, response compaction, and diagnostics-friendly fields.\n\nEvery operation declares `x-implementation-status`, so a caller can tell what the running\nadapter actually serves:\n\n- `implemented` — routed by `src/http/routes.ts` today. `src/http/openapi-implementation.test.ts`\n fails when an `implemented` operation has no matching route.\n- `planned` — contract-only, designed but not routed yet. Calling it returns 404.\n\nThe same capabilities are reachable through the CLI, and through the optional MCP server when\nit is enabled.\n"},servers:[{url:"http://localhost:8787",description:"Local HTTP adapter (`seal-usehttp`, or the `seal-useservicestart` daemon). Loopback-only by default."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps","x-implementation-status":"implemented",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp","x-implementation-status":"planned",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp","x-implementation-status":"planned",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig","x-implementation-status":"planned",summary:"Resolve source-derived Seal enterprise config",parameters:[{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."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local
Line truncated
toloopback(\`--host 127.0.0.1\`) and do not expose the port to a network or an origin you
donotcontrol.
`}},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","direct","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"},t
Line truncated
`}},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","direct","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"},t
Line truncated
`);I(U)})})}var RT=8787,_T="127.0.0.1";var sl=o(()=>{GS0();t9()});async function WS0($){let Y=s0($.options.port)??s0($.options.p),z=S($.options.host)??S($.options.h),U=await vT({port:Y,host:z}),I=()=>{U.close(()=>{process.exit(0)})};process.on("SIGINT",I),process.on("SIGTERM",I),await new Promise(()=>{})}var HS0=o(()=>{D4();sl()});async function XS0($,Y,z,U){if($==="config"||$==="get"){await k0("seal_llm_config_get",Y,z,{},C0(U.options));return}if($==="providers"||$==="list"){await k0("seal_llm_providers_list",Y,z,{},C0(U.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var ZS0=o(()=>{o4();Q4()});async function qS0($,Y){if($==="config"||$==="json"){al();return}let{startServer:z}=await FS0().then(() => LS0);z()}function al(){c0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var VS0=o(()=>{Q4()});function wS0($){let Y=jT();c0(Y,{...C0($.options),allowFull:!0})}var MS0=o(()=>{ol();Q4()});async function OS0($,Y,z,U){if($==="available"){await k0("seal_permissions_available_list",Y,z,{},C0(U.options));return}if($==="configs"||$==="list"){await k0("seal_permissions_configs_list",Y,z,{},C0(U.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var NS0=o(()=>{o4();Q4()});import{readFileSync as DS0}from"node:fs";async function PS0($,Y,z,U,I,Q,J){if(!$||$==="get"){await k0("seal_preference_get",I,Q,{},C0(J.options));return}if($==="decision"){if(Y==="update"||!Y){let K=S(J.options.input),G=K?JSON.parse(DS0(K,"utf8")):y8(J.json);if(!G||Object.keys(G).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await k0("seal_preference_decision_update",I,Q,{...G,dryRun:V0(J.options.dryRun)??V0(J.options["dry-run"])},C0(J.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let K=S(J.options.default)??S(J.options.level)??U;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await k0("seal_preference_thinking_depth_set",I,Q,{defaultLevel:K,dryRun:V0(J.options.dryRun)??V0(J.options["dry-run"])},C0(J.options));return}if(Y==="policies"){if(z==="list"||!z){await k0("seal_preference_thinking_depth_policies_list",I,Q,{},C0(J.options));return}if(z==="upsert"){let K=S(J.options.input),G=K?JSON.parse(DS0(K,"utf8")):y8(J.json);if(!G||!G.id||!G.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await k0("seal_preference_thinking_depth_policies_upsert",I,Q,{...G,dryRun:V0(J.options.dryRun)??V0(J.options["dry-run"])},C0(J.options));return}if(z==="remove"||z==="delete"){let K=U??S(J.options.id)??S(J.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await k0("seal_preference_thinking_depth_policies_remove",I,Q,{policyId:K,dryRun:V0(J.options.dryRun)??V0(J.options["dry-run"])},C0(J.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}var BS0=o(()=>{o4();D4();Q4()});async function AS0($={}){let Y=s8(),z=_4(),U=f2(Y,{stateful:z.stateful,defaultCorpId:z.defaultCorpId,corpId:$.corpId},h3());console.log(`[probe]corp=${U.id}source=${U.source.type}`);let I=await SK(U);console.log("[probe] seal enterprise"),console.log(JSON.stringify(I,null,2));let Q=await j1(U),J=await qM(Q,{documentLimit:20,stylePreferencesEndpoint:U.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:J.rules.rules.length,hasPendingRuleDeletes:J.rules.hasPendingDeletes,documents:J.documents.articles.length,documentsTotal:J.documents.total,stylePreferences:J.stylePreferences.ok?"ok":`error:${J.stylePreferences.error}`},null,2))}var TS0=o(()=>{S3();i8();PT();X6()});async function jS0($,Y,z){let U=Y??S(z.options.corp)??($&&$!=="--corp"?$:void 0);await AS0({corpId:U})}var ES0=o(()=>{TS0();D4()});async function tl($,Y,z,U,I){if($==="count"){await k0("seal_approval_rules_list",z,U,{countOnly:!0},C0(I.options));return}if($==="list"){if(V0(I.options.count)){await k0("seal_approval_rules_list",z,U,{countOnly:!0},C0(I.options));return}let Q=s0(I.options.limit),J=s0(I.options.offset);if(V0(I.options.summary)){await k0("seal_approval_rules_list",z,U,{fields:eR0,limit:Q,offset:J},C0(I.options));return}let K=await o2("seal_approval_rules_list",z,U,{limit:Q,offset:J});$_0(K,V0(I.options.full)===!0),c0(K);return}if($==="clear"){let Q=V0(I.options.yes)===!0,J=V0(I.options.dryRun)??V0(I.options["dry-run"])??!Q;if(!Q&&!J)throw D9("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${U.id}--dry-run`);let K=await o2("seal_approval_rules_clear",z,U,{dryRun:J,recode:V0(I.options.recode)});if(!Q&&J&&K&&typeof K==="object"){c0({...K,
Line truncated
`).filter(Boolean),Q=I.slice(-Y);return{logFile:z,lines:Q,totalLines:I.length}}async function Mg1($){let Y=yT($),z=Yo($),U=jq($);hS0($.stateDir);let I=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):RT),Q=$.host??(process.env.HOST?process.env.HOST:_T);ST(Y,`${process.pid}
`,{mode:384}),ST(z,JSON.stringify({pid:process.pid,port:I,host:Q,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),gK(U,`servicestartingonhttp://${Q}:${I} pid=${process.pid}`);let J=null;try{J=await vT({port:I,host:Q,silent:!0}),gK(U,`service listening pid=${process.pid}`)}catch(G){if(gK(U,`service failed to bind port ${I}: ${G instanceof Error?G.message:String(G)}`),gT(Y)===process.pid)v9(Y,{force:!0}),v9(z,{force:!0});throw G}let K=()=>{if(J)J.close(),J=null;if(gT(Y)===process.pid)v9(Y,{force:!0}),v9(z,{force:!0});gK(U,`stopped pid=${process.pid}`)};await new Promise((G)=>{let W=!1,H=()=>{if(W)return;W=!0,K(),process.off("SIGTERM",H),process.off("SIGINT",H),G()};process.once("SIGTERM",H),process.once("SIGINT",H)})}function RS0($){hS0($.stateDir);let Y=yK($);if(Y.running)return Y;let z=$.launcher??{command:process.execPath,args:[$.entryFile]},U=[...z.args??[],"service","run"];if($.port)U.push("--port",String($.port));if($.host)U.push("--host",String($.host));let I=Vg1(z.command,U,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});I.unref();let Q=yT($);return ST(Q,`${I.pid}
`,{flag:"a",mode:384})}var zo=o(()=>{sl()});import{homedir as Ng1}from"node:os";import{join as Dg1}from"node:path";async function Io($,Y,z){let U=z?s0(z.options.port)??s0(z.options.p):void 0,I=z?S(z.options.host)??S(z.options.h):void 0,Q=z?s0(z.options.lines)??s0(z.options.n):void 0,J=await SU($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:Uo,version:B1,launcher:Y.launcher,port:U,host:I},{maxLines:Q});if(J!==void 0)c0(J)}var Uo;var Qo=o(()=>{t9();zo();Q4();D4();Uo=Dg1(Ng1(),".config","seal-use")});import{existsSync as Pg1,readFileSync as SS0}from"node:fs";async function gS0($,Y,z,U,I){if($==="batch-records"||$==="records"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation batch-records <batchId>");await k0("seal_simulation_batch_records_get",z,U,{batchId:Q,query:S(I.options.query)},C0(I.options));return}if($==="create"||$==="run"){let Q=S(I.options.mode)??S(I.options.sourceSystem)??S(I.options["source-system"])??"hosecloud",J=Q==="material-pack"?"material_pack":Q,K=S(I.options.schemaConfig)??S(I.options["schema-config"]),G=K?JSON.parse(SS0(K,"utf8")):void 0,W=S(I.options.input),H=W?JSON.parse(SS0(W,"utf8")):y8(I.json),X=S(I.options.packageId)??S(I.options["package-id"]),Z=u6(I.options.packageIds)??u6(I.options["package-ids"])??(X?[X]:void 0),q=u6(I.options.flowIds)??u6(I.options["flow-ids"])??u6(I.options.documentSn)??u6(I.options["document-sn"]),V=S(I.options.signKey)??S(I.options["sign-key"])??S(I.options.integration),F=V0(I.options.noWait)??V0(I.options["no-wait"]);await k0("seal_simulation_batch_create",z,U,{mode:J,sourceSystem:J,flowIds:q,documentSn:q,rejectNodeName:S(I.options.rejectNode)??S(I.options["reject-node"])??null,thinkingDepthOverride:S(I.options.thinkingDepth)??S(I.options["thinking-depth"]),skipInvoiceGeneration:V0(I.options.skipInvoiceGeneration)??V0(I.options["skip-invoice-generation"]),skipExpenseExtraction:V0(I.options.skipExpenseExtraction)??V0(I.options["skip-expense-extraction"]),disableAttachmentCache:V0(I.options.disableAttachmentCache)??V0(I.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:S(I.options.templateId)??S(I.options["template-id"]),schemaConfig:G,requestIds:u6(I.options.requestIds)??u6(I.options["request-ids"]),workflowTypeId:S(I.options.workflowTypeId)??S(I.options["workflow-type-id"]),flowStatusList:u6(I.options.flowStatusList)?.map(Number)??u6(I.options["flow-status-list"])?.map(Number),businessCodes:u6(I.options.businessCodes)??u6(I.options["business-codes"]),documentType:S(I.options.documentType)??S(I.options["document-type"]),startTime:s0(I.options.startTime)??s0(I.options["start-time"]),endTime:s0(I.options.endTime)??s0(I.options["end-time"]),status:u6(I.options.status),limit:s0(I.options.limit),noWait:F,rawParams:H},C0(I.options));return}if($==="wait"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await k0("seal_simulation_batch_wait",z,U,{batchId:Q,timeout:S(I.options.timeout),pollInterval:S(I.options.pollInterval)??S(I.options["poll-interval"])},C0(I.options));return}if($==="status"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation status <batchId>");await k0("seal_simulation_batch_status",z,U,{batchId:Q},C0(I.options));return}if($==="clean"||$==="delete"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation clean <batchId>");await k0("seal_simulation_batch_clean",z,U,{batchId:Q},C0(I.options));return}if($==="specifications"){let Q=Y??S(I.options.integration)??S(I.options.signKey)??S(I.options["sign-key"]);await k0("seal_simulation_specifications_list",z,U,{signKey:Q},C0(I.options));return}if($==="approval-definitions"||$==="definitions"){await k0("seal_simulation_feishu_approval_definitions_list",z,U,{},C0(I.options));return}if($==="list"){await k0("seal_simulation_batches_list",z,U,{limit:s0(I.options.limit)},C0(I.options));return}if($==="get"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation get <batchId>");await k0("seal_simulation_batch_get",z,U,{batchId:Q},C0(I.options));return}if($==="templates"){await k0("seal_simulation_templates_get",z,U,{},C0(I.options));return}if($==="integrations"){await k0("seal_simulation_integrations_get",z,U,{},C0(I.options));return}if($==="package-upload"){let Q=Y??S(I.options.file);if(!Q)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!Pg1(Q))throw Error(`Filenotfound:${Q}`);await k0("seal_simulation_material_package_upload",z,U,{filePath:Q},C0(I.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var yS0=o(()=>{o4();D4();Q4()});import{existsSync as kS0}from"node:fs";import{join as kT}from"node:path";function xS0($,Y,z){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${clLine truncated
`);return}if($==="install"||$==="init"||$==="sync"){let U=V0(z.options.local)||V0(z.options.workspace),I=S(z.options.dir)??S(z.options.target)??Y,Q=I?I:U?kT(process.cwd(),".agents","skills","seal-use"):hU(),J=dh0(Q);c0({installed:!0,targetDir:J.targetDir,fileCount:J.files.length,files:J.files});return}if($==="status"||$==="get"||!$){let U=hU(),I=kT(process.cwd(),".agents","skills","seal-use");c0({global:{dir:U,installed:kS0(kT(U,"SKILL.md"))},local:{dir:I,installed:kS0(kT(I,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}var fS0=o(()=>{Bq();D4();Q4()});async function uS0($,Y){if($==="config"){c0(await SK(Y));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var bS0=o(()=>{PT();Q4()});function Jo($){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 iS0($){let{sourceCorp:Y,targetCorp:z,sourceClient:U,targetClient:I,samples:Q=10,dryRun:J=!1,pollIntervalMs:K=2000,timeoutMs:G=45000,snPrefix:W="REG_",fetchFn:H=fetch}=$;if(z.environment!=="test")throw new w4(`重放目标企业「${z.name}」(${z.id})的环境为「${z.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${Y.id}<testCorpId>`);let X=await bY(I),q=(Array.isArray(X.features)?X.features:[]).find((d)=>d?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,F=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,M=Q*F;if(V<M)throw new w4(`测试企业「${z.name}」AI审批额度不足:当前剩余${V}点,本次回归抽样${Q}笔需要约${M}点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${z.id}」充值AI审批额度,或降低抽样笔数(--samples${Math.max(1,Math.floor(V/F))})`);let w=await b4(U,{limit:Q,status:"completed"}),O=Array.isArray(w.records)?w.records:[];if(O.length===0){let d=await b4(U,{limit:Q});O=Array.isArray(d.records)?d.records:[]}if(O.length===0)throw new w4(`在母企业「${Y.name}」(${Y.id})中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(O=O.slice(0,Q),J){let d=O.map((t)=>{let $0=t.sourceDocumentSN??t.id,g=t?.result?.decision??t.aiDecision??t?.decision,p=Jo(g),e=t?.result?.summary??t.aiSummary;return{sn:$0,sourceRecordId:t.id,prodDecision:p,prodSummary:e,status:"DRY_RUN"}});return{ok:!0,verdict:"DRY_RUN",safeToPublish:!0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:z.id,name:z.name,environment:z.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:M},metrics:{sampleCount:d.length,successCount:d.length,failureCount:0,matchCount:d.length,flipCount:0,concordanceRate:1},flips:[],records:d}}let D=await Yp(I,z),N=[];for(let d of O){let t=Date.now(),$0=d.sourceDocumentSN??d.id,g=Jo(d?.result?.decision??d.aiDecision??d?.decision),p=d?.result?.summary??d.aiSummary;try{let e=await G4(U,d.id),y=`${W}${$0}`,s=en(e,{snPrefix:W,docIdPrefix:W});await $p(D.incomingDocumentWebhook.url,D.secret,s,H,P6(z.seal));let Y0=null,M0=Date.now();while(Date.now()-M0<G){await new Promise((H0)=>setTimeout(H0,K));let a=await b4(I,{sourceDocumentSN:y,limit:1});if(a.records&&a.records.length>0){let H0=a.records[0];if(H0.status==="completed"||H0.status==="failed"){Y0=H0;break}}}if(!Y0){N.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:`测试租户单据审核超时(${Math.round(G/1000)}s未完成)`,durationMs:Date.now()-t});continue}let E0=Jo(Y0?.result?.decision??Y0.aiDecision??Y0?.decision??(Y0.status==="completed"?"APPROVE":"ERROR")),G0=Y0?.result?.summary??Y0.aiSummary,T0=g===E0,b0=T0?"MATCHED":"FLIPPED",Y1={sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,testRecordId:Y0.id,testDecision:E0,testSummary:G0,status:b0,durationMs:Date.now()-t};if(!T0)Y1.diff={from:g,to:E0,reasonDiff:G0&&p&&G0!==p?`生产:${p.slice(0,60)}...->测试:${G0.slice(0,60)}...`:void 0};N.push(Y1)}catch(e){N.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:e instanceof Error?e.message:String(e),durationMs:Date.now()-t})}}let A=N.filter((d)=>d.status==="MATCHED"||d.status==="FLIPPED"),T=N.filter((d)=>d.status==="MATCHED"),P=N.filter((d)=>d.status==="FLIPPED"),j=N.filter((d)=>d.status==="FAILED").length,C=T.length,b=P.length,k=C+b,h=k>0?C/k:0,i=b>0,c=i?"REGRESSIONS_DETECTED":"CLEAN",U0=!i&&j===0,x;try{let d=await bY(I),$0=(Array.isArray(d.features)?d.features:[]).find((g)=>g?.code==="ai-approval");if(typeof $0?.balance==="number")x=$0.balance}catch{}return{ok:!i&&j===0,verdict:c,safeToPublish:U0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:z.id,name:z.name,environment:z.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:M,balanceAfter:x},metrics:{sampleCount:N.length,successCount:A.length,failureCount:j,matchCount:C,flipCount:b,concordanceRate:Number(h.toFixed(4))},flips:P,records:N}}function cS0($){let{sourceCorp:Y,targetCorp:z,verdict:U,safeToPublish:I,metrics:Q,quota:J,flips:K,records:G}=$,W=U==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":U==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",H=["",`\uD83E\uDDEA[SealUseTest]规则回归测试矩阵:生产「${Y.name}」->测试靶场「${z.name}」`,`判定:${W}·准许发布:${I?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),`样本总数:${Q.sampleCount}|一致通过:${Q.matchCount}|决策翻转:${Q.flipCount}|异常失败:${Q.failureCount}`,`一致率:${(Q.concordanceRate*100).toFixed(1)}%|消耗预估:${J.estimatedRequired}点(余量:${J.balanceBefore}${J.balanceAfter!==void0?` -> ${J.balanceAfter}`:""})`," "+"─".repeat(65)];if(K.length>0){H.push(`⚠️决策翻转清单(${K.length}笔单据在新规则下结果改变):`);for(let X of K)if(H.push(`•单据[${X.sn}]:原生产判定「${X.prodDecision}」➔测试新判定「${X.testDecision}」`),X.diff?.reasonDiff)H.push(`理由差异:${X.diff.reasonDiff}`);H.push(" "+"─".repeat(65)),H.push(" \uD83D\uDC49 建议: 请检查上述翻转单据是否符合预期修正。若为意外误杀,请调整测试环境规则后再次回归。")}else if(U==="CLEAN")H.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100% 吻合,无任
Line truncated
`)}var nS0=o(()=>{L$();X6();_Z()});async function Ko($,Y,z){let U=($??Y??"regression").toLowerCase();if(U==="regression"||U==="regress"||U==="matrix"){let I=S(z.options.corp)??(Y&&Y!==U?Y:void 0),Q=E1(I),J=Q,K=Q;if(Q.environment==="test"){K=Q;let O=S(z.options["prod-corp"])??S(z.options.prod)??Q.prodCorpId;if(!O)throw new w4(`测试企业「${Q.name}」(${Q.id})未绑定生产母企业,无法拉取历史样本。
`);I(U)})})}var gT=8787,yT="127.0.0.1";var Wo=o(()=>{vS0();t9()});async function hS0($){let Y=s0($.options.port)??s0($.options.p),z=S($.options.host)??S($.options.h),U=await kT({port:Y,host:z}),I=()=>{U.close(()=>{process.exit(0)})};process.on("SIGINT",I),process.on("SIGTERM",I),await new Promise(()=>{})}var SS0=o(()=>{D4();Wo()});async function gS0($,Y,z,U){if($==="config"||$==="get"){await k0("seal_llm_config_get",Y,z,{},C0(U.options));return}if($==="providers"||$==="list"){await k0("seal_llm_providers_list",Y,z,{},C0(U.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var yS0=o(()=>{o4();Q4()});async function kS0($,Y){if($==="config"||$==="json"){Xo();return}let{startServer:z}=await uS0().then(() => fS0);z()}function Xo(){c0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var xS0=o(()=>{Q4()});function bS0($){let Y=vT();c0(Y,{...C0($.options),allowFull:!0})}var iS0=o(()=>{Go();Q4()});async function cS0($,Y,z,U){if($==="available"){await k0("seal_permissions_available_list",Y,z,{},C0(U.options));return}if($==="configs"||$==="list"){await k0("seal_permissions_configs_list",Y,z,{},C0(U.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var nS0=o(()=>{o4();Q4()});import{readFileSync as pS0}from"node:fs";async function dS0($,Y,z,U,I,Q,J){if(!$||$==="get"){await k0("seal_preference_get",I,Q,{},C0(J.options));return}if($==="decision"){if(Y==="update"||!Y){let K=S(J.options.input),G=K?JSON.parse(pS0(K,"utf8")):y8(J.json);if(!G||Object.keys(G).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await k0("seal_preference_decision_update",I,Q,{...G,dryRun:V0(J.options.dryRun)??V0(J.options["dry-run"])},C0(J.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let K=S(J.options.default)??S(J.options.level)??U;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await k0("seal_preference_thinking_depth_set",I,Q,{defaultLevel:K,dryRun:V0(J.options.dryRun)??V0(J.options["dry-run"])},C0(J.options));return}if(Y==="policies"){if(z==="list"||!z){await k0("seal_preference_thinking_depth_policies_list",I,Q,{},C0(J.options));return}if(z==="upsert"){let K=S(J.options.input),G=K?JSON.parse(pS0(K,"utf8")):y8(J.json);if(!G||!G.id||!G.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await k0("seal_preference_thinking_depth_policies_upsert",I,Q,{...G,dryRun:V0(J.options.dryRun)??V0(J.options["dry-run"])},C0(J.options));return}if(z==="remove"||z==="delete"){let K=U??S(J.options.id)??S(J.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await k0("seal_preference_thinking_depth_policies_remove",I,Q,{policyId:K,dryRun:V0(J.options.dryRun)??V0(J.options["dry-run"])},C0(J.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}var mS0=o(()=>{o4();D4();Q4()});async function lS0($={}){let Y=s8(),z=_4(),U=f2(Y,{stateful:z.stateful,defaultCorpId:z.defaultCorpId,corpId:$.corpId},h3());console.log(`[probe]corp=${U.id}source=${U.source.type}`);let I=await yK(U);console.log("[probe] seal enterprise"),console.log(JSON.stringify(I,null,2));let Q=await j1(U),J=await MM(Q,{documentLimit:20,stylePreferencesEndpoint:U.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:J.rules.rules.length,hasPendingRuleDeletes:J.rules.hasPendingDeletes,documents:J.documents.articles.length,documentsTotal:J.documents.total,stylePreferences:J.stylePreferences.ok?"ok":`error:${J.stylePreferences.error}`},null,2))}var oS0=o(()=>{S3();i8();ET();X6()});async function rS0($,Y,z){let U=Y??S(z.options.corp)??($&&$!=="--corp"?$:void 0);await lS0({corpId:U})}var sS0=o(()=>{oS0();D4()});async function Zo($,Y,z,U,I){if($==="count"){await k0("seal_approval_rules_list",z,U,{countOnly:!0},C0(I.options));return}if($==="list"){if(V0(I.options.count)){await k0("seal_approval_rules_list",z,U,{countOnly:!0},C0(I.options));return}let Q=s0(I.options.limit),J=s0(I.options.offset);if(V0(I.options.summary)){await k0("seal_approval_rules_list",z,U,{fields:q_0,limit:Q,offset:J},C0(I.options));return}let K=await o2("seal_approval_rules_list",z,U,{limit:Q,offset:J});V_0(K,V0(I.options.full)===!0),c0(K);return}if($==="clear"){let Q=V0(I.options.yes)===!0,J=V0(I.options.dryRun)??V0(I.options["dry-run"])??!Q;if(!Q&&!J)throw D9("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${U.id}--dry-run`);let K=await o2("seal_approval_rules_clear",z,U,{dryRun:J,recode:V0(I.options.recode)});if(!Q&&J&&K&&typeof K==="object"){c0({...K,
Line truncated
`).filter(Boolean),Q=I.slice(-Y);return{logFile:z,lines:Q,totalLines:I.length}}async function rg1($){let Y=bT($),z=Lo($),U=vq($);Yg0($.stateDir);let I=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):gT),Q=$.host??(process.env.HOST?process.env.HOST:yT);fT(Y,`${process.pid}
`,{mode:384}),fT(z,JSON.stringify({pid:process.pid,port:I,host:Q,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),xK(U,`servicestartingonhttp://${Q}:${I} pid=${process.pid}`);let J=null;try{J=await kT({port:I,host:Q,silent:!0}),xK(U,`service listening pid=${process.pid}`)}catch(G){if(xK(U,`service failed to bind port ${I}: ${G instanceof Error?G.message:String(G)}`),uT(Y)===process.pid)v9(Y,{force:!0}),v9(z,{force:!0});throw G}let K=()=>{if(J)J.close(),J=null;if(uT(Y)===process.pid)v9(Y,{force:!0}),v9(z,{force:!0});xK(U,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,K(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function tS0($){Yg0($.stateDir);let Y=fK($);if(Y.running)return Y;let z=$.launcher??{command:process.execPath,args:[$.entryFile]},U=[...z.args??[],"service","run"];if($.port)U.push("--port",String($.port));if($.host)U.push("--host",String($.host));let I=dg1(z.command,U,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});I.unref();let Q=bT($);return fT(Q,`${I.pid}
`,{flag:"a",mode:384})}var Fo=o(()=>{Wo()});import{homedir as ag1}from"node:os";import{join as tg1}from"node:path";async function Mo($,Y,z){let U=z?s0(z.options.port)??s0(z.options.p):void 0,I=z?S(z.options.host)??S(z.options.h):void 0,Q=z?s0(z.options.lines)??s0(z.options.n):void 0,J=await yU($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:wo,version:P1,launcher:Y.launcher,port:U,host:I},{maxLines:Q});if(J!==void 0)c0(J)}var wo;var Oo=o(()=>{t9();Fo();Q4();D4();wo=tg1(ag1(),".config","seal-use")});import{existsSync as eg1,readFileSync as zg0}from"node:fs";async function Ug0($,Y,z,U,I){if($==="batch-records"||$==="records"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation batch-records <batchId>");await k0("seal_simulation_batch_records_get",z,U,{batchId:Q,query:S(I.options.query)},C0(I.options));return}if($==="create"||$==="run"){let Q=S(I.options.mode)??S(I.options.sourceSystem)??S(I.options["source-system"])??"hosecloud",J=Q==="material-pack"?"material_pack":Q,K=S(I.options.schemaConfig)??S(I.options["schema-config"]),G=K?JSON.parse(zg0(K,"utf8")):void 0,H=S(I.options.input),W=H?JSON.parse(zg0(H,"utf8")):y8(I.json),X=S(I.options.packageId)??S(I.options["package-id"]),Z=u6(I.options.packageIds)??u6(I.options["package-ids"])??(X?[X]:void 0),q=u6(I.options.flowIds)??u6(I.options["flow-ids"])??u6(I.options.documentSn)??u6(I.options["document-sn"]),V=S(I.options.signKey)??S(I.options["sign-key"])??S(I.options.integration),F=V0(I.options.noWait)??V0(I.options["no-wait"]);await k0("seal_simulation_batch_create",z,U,{mode:J,sourceSystem:J,flowIds:q,documentSn:q,rejectNodeName:S(I.options.rejectNode)??S(I.options["reject-node"])??null,thinkingDepthOverride:S(I.options.thinkingDepth)??S(I.options["thinking-depth"]),skipInvoiceGeneration:V0(I.options.skipInvoiceGeneration)??V0(I.options["skip-invoice-generation"]),skipExpenseExtraction:V0(I.options.skipExpenseExtraction)??V0(I.options["skip-expense-extraction"]),disableAttachmentCache:V0(I.options.disableAttachmentCache)??V0(I.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:S(I.options.templateId)??S(I.options["template-id"]),schemaConfig:G,requestIds:u6(I.options.requestIds)??u6(I.options["request-ids"]),workflowTypeId:S(I.options.workflowTypeId)??S(I.options["workflow-type-id"]),flowStatusList:u6(I.options.flowStatusList)?.map(Number)??u6(I.options["flow-status-list"])?.map(Number),businessCodes:u6(I.options.businessCodes)??u6(I.options["business-codes"]),documentType:S(I.options.documentType)??S(I.options["document-type"]),startTime:s0(I.options.startTime)??s0(I.options["start-time"]),endTime:s0(I.options.endTime)??s0(I.options["end-time"]),status:u6(I.options.status),limit:s0(I.options.limit),noWait:F,rawParams:W},C0(I.options));return}if($==="wait"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await k0("seal_simulation_batch_wait",z,U,{batchId:Q,timeout:S(I.options.timeout),pollInterval:S(I.options.pollInterval)??S(I.options["poll-interval"])},C0(I.options));return}if($==="status"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation status <batchId>");await k0("seal_simulation_batch_status",z,U,{batchId:Q},C0(I.options));return}if($==="clean"||$==="delete"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation clean <batchId>");await k0("seal_simulation_batch_clean",z,U,{batchId:Q},C0(I.options));return}if($==="specifications"){let Q=Y??S(I.options.integration)??S(I.options.signKey)??S(I.options["sign-key"]);await k0("seal_simulation_specifications_list",z,U,{signKey:Q},C0(I.options));return}if($==="approval-definitions"||$==="definitions"){await k0("seal_simulation_feishu_approval_definitions_list",z,U,{},C0(I.options));return}if($==="list"){await k0("seal_simulation_batches_list",z,U,{limit:s0(I.options.limit)},C0(I.options));return}if($==="get"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation get <batchId>");await k0("seal_simulation_batch_get",z,U,{batchId:Q},C0(I.options));return}if($==="templates"){await k0("seal_simulation_templates_get",z,U,{},C0(I.options));return}if($==="integrations"){await k0("seal_simulation_integrations_get",z,U,{},C0(I.options));return}if($==="package-upload"){let Q=Y??S(I.options.file);if(!Q)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!eg1(Q))throw Error(`Filenotfound:${Q}`);await k0("seal_simulation_material_package_upload",z,U,{filePath:Q},C0(I.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Ig0=o(()=>{o4();D4();Q4()});import{existsSync as Qg0}from"node:fs";import{join as iT}from"node:path";function Jg0($,Y,z){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${zoLine truncated
`);return}if($==="install"||$==="init"||$==="sync"){let U=V0(z.options.local)||V0(z.options.workspace),I=S(z.options.dir)??S(z.options.target)??Y,Q=I?I:U?iT(process.cwd(),".agents","skills","seal-use"):gU(),J=VS0(Q),K=!U&&!I,G=K?ol():void 0,H=K?al():void 0;c0({installed:!0,targetDir:J.targetDir,fileCount:J.files.length,files:J.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let U=gU(),I=iT(process.cwd(),".agents","skills","seal-use"),Q=rl(),J=tl();c0({global:{dir:U,installed:Qg0(iT(U,"SKILL.md"))},local:{dir:I,installed:Qg0(iT(I,"SKILL.md"))},antigravity:Q,hosts:J});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}var Kg0=o(()=>{$o();Cq();D4();Q4()});async function Gg0($,Y){if($==="config"){c0(await yK(Y));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Hg0=o(()=>{ET();Q4()});function No($){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 Wg0($){let{sourceCorp:Y,targetCorp:z,sourceClient:U,targetClient:I,samples:Q=10,dryRun:J=!1,pollIntervalMs:K=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(z.environment!=="test")throw new w4(`重放目标企业「${z.name}」(${z.id})的环境为「${z.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${Y.id}<testCorpId>`);let X=await cY(I),q=(Array.isArray(X.features)?X.features:[]).find((d)=>d?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,F=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,M=Q*F;if(V<M)throw new w4(`测试企业「${z.name}」AI审批额度不足:当前剩余${V}点,本次回归抽样${Q}笔需要约${M}点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${z.id}」充值AI审批额度,或降低抽样笔数(--samples${Math.max(1,Math.floor(V/F))})`);let w=await b4(U,{limit:Q,status:"completed"}),O=Array.isArray(w.records)?w.records:[];if(O.length===0){let d=await b4(U,{limit:Q});O=Array.isArray(d.records)?d.records:[]}if(O.length===0)throw new w4(`在母企业「${Y.name}」(${Y.id})中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(O=O.slice(0,Q),J){let d=O.map((t)=>{let $0=t.sourceDocumentSN??t.id,g=t?.result?.decision??t.aiDecision??t?.decision,p=No(g),e=t?.result?.summary??t.aiSummary;return{sn:$0,sourceRecordId:t.id,prodDecision:p,prodSummary:e,status:"DRY_RUN"}});return{ok:!0,verdict:"DRY_RUN",safeToPublish:!0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:z.id,name:z.name,environment:z.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:M},metrics:{sampleCount:d.length,successCount:d.length,failureCount:0,matchCount:d.length,flipCount:0,concordanceRate:1},flips:[],records:d}}let D=await Jp(I,z),N=[];for(let d of O){let t=Date.now(),$0=d.sourceDocumentSN??d.id,g=No(d?.result?.decision??d.aiDecision??d?.decision),p=d?.result?.summary??d.aiSummary;try{let e=await H4(U,d.id),y=`${H}${$0}`,s=Ip(e,{snPrefix:H,docIdPrefix:H});await Qp(D.incomingDocumentWebhook.url,D.secret,s,W,A6(z.seal));let Y0=null,M0=Date.now();while(Date.now()-M0<G){await new Promise((W0)=>setTimeout(W0,K));let a=await b4(I,{sourceDocumentSN:y,limit:1});if(a.records&&a.records.length>0){let W0=a.records[0];if(W0.status==="completed"||W0.status==="failed"){Y0=W0;break}}}if(!Y0){N.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:`测试租户单据审核超时(${Math.round(G/1000)}s未完成)`,durationMs:Date.now()-t});continue}let E0=No(Y0?.result?.decision??Y0.aiDecision??Y0?.decision??(Y0.status==="completed"?"APPROVE":"ERROR")),G0=Y0?.result?.summary??Y0.aiSummary,T0=g===E0,b0=T0?"MATCHED":"FLIPPED",Y1={sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,testRecordId:Y0.id,testDecision:E0,testSummary:G0,status:b0,durationMs:Date.now()-t};if(!T0)Y1.diff={from:g,to:E0,reasonDiff:G0&&p&&G0!==p?`生产:${p.slice(0,60)}...->测试:${G0.slice(0,60)}...`:void 0};N.push(Y1)}catch(e){N.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:e instanceof Error?e.message:String(e),durationMs:Date.now()-t})}}let B=N.filter((d)=>d.status==="MATCHED"||d.status==="FLIPPED"),T=N.filter((d)=>d.status==="MATCHED"),A=N.filter((d)=>d.status==="FLIPPED"),j=N.filter((d)=>d.status==="FAILED").length,C=T.length,b=A.length,k=C+b,h=k>0?C/k:0,i=b>0,c=i?"REGRESSIONS_DETECTED":"CLEAN",U0=!i&&j===0,x;try{let d=await cY(I),$0=(Array.isArray(d.features)?d.features:[]).find((g)=>g?.code==="ai-approval");if(typeof $0?.balance==="number")x=$0.balance}catch{}return{ok:!i&&j===0,verdict:c,safeToPublish:U0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:z.id,name:z.name,environment:z.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:M,balanceAfter:x},metrics:{sampleCount:N.length,successCount:B.length,failureCount:j,matchCount:C,flipCount:b,concordanceRate:Number(h.toFixed(4))},flips:A,records:N}}function Xg0($){let{sourceCorp:Y,targetCorp:z,verdict:U,safeToPublish:I,metrics:Q,quota:J,flips:K,records:G}=$,H=U==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":U==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",W=["",`\uD83E\uDDEA[SealUseTest]规则回归测试矩阵:生产「${Y.name}」->测试靶场「${z.name}」`,`判定:${H}·准许发布:${I?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),`样本总数:${Q.sampleCount}|一致通过:${Q.matchCount}|决策翻转:${Q.flipCount}|异常失败:${Q.failureCount}`,`一致率:${(Q.concordanceRate*100).toFixed(1)}%|消耗预估:${J.estimatedRequired}点(余量:${J.balanceBefore}${J.balanceAfter!==void0?` -> ${J.balanceAfter}`:""})`," "+"─".repeat(65)];if(K.length>0){W.push(`⚠️决策翻转清单(${K.length}笔单据在新规则下结果改变):`);for(let X of K)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(U==="CLEAN")W.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100% 吻合,无任
Line truncated
`)}var Zg0=o(()=>{L$();X6();SZ()});async function Do($,Y,z){let U=($??Y??"regression").toLowerCase();if(U==="regression"||U==="regress"||U==="matrix"){let I=S(z.options.corp)??(Y&&Y!==U?Y:void 0),Q=E1(I),J=Q,K=Q;if(Q.environment==="test"){K=Q;let O=S(z.options["prod-corp"])??S(z.options.prod)??Q.prodCorpId;if(!O)throw new w4(`测试企业「${Q.name}」(${Q.id})未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-usecorpsbind-test<prodCorpId>${Q.id}`);J=E1(O)}else{J=Q;let O=S(z.options["test-corp"])??S(z.options.test)??Q.testCorpId;if(!O)throw new w4(`生产企业「${Q.name}」(${Q.id})未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${Q.id}<testCorpId>`);K=E1(O)}let G=await j1(J),W=await j1(K),H=s0(z.options.samples)??s0(z.options.limit)??s0(z.options.n)??10,X=V0(z.options["dry-run"]),Z=V0(z.options["fail-on-flips"]),q=s0(z.options["poll-interval"])??2000,V=s0(z.options.timeout)??45000,F=S(z.options["sn-prefix"])??"REG_",M=await iS0({sourceCorp:J,targetCorp:K,sourceClient:G,targetClient:W,samples:H,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:F,failOnFlips:Z});if(!(V0(z.options.quiet)||V0(z.options.silent)))console.error(cS0(M));if(c0(M),Z&&!M.ok)throw new w4(`回归测试发现${M.metrics.flipCount}笔单据决策翻转,已按--fail-on-flips策略非零终止。`,1);return}throw new w4(`未知的test子命令:"${U}"。
可用子命令:seal-usetestregression[--corp<id>][--samples<N>][--dry-run]`,2,"seal-use test regression --help")}var pS0=o(()=>{L$();o4();D4();Q4();i8();nS0()});async function dS0($,Y,z,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await k0($,Y,z,y8(U.json),C0(U.options))}var mS0=o(()=>{o4();D4();Q4()});function lS0(){c0(Xq.map(($)=>({name:$.name,description:$.description})))}var oS0=o(()=>{qq();Q4()});function xT($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.includes("\\$bunfs\\"))return!0;let z=$.toLowerCase().replace(/\\/g,"/");return!z.endsWith("/bun")&&!z.endsWith("/bun.exe")&&!z.endsWith("/node")&&!z.endsWith("/node.exe")}var rS0=o(()=>{Bq()});import{chmodSync as Bg1,mkdirSync as Ag1,readdirSync as Tg1,renameSync as Go,rmSync as jg1,unlinkSync as eS0,writeFileSync as sS0}from"node:fs";import{basename as Eg1,dirname as Cg1,join as uT}from"node:path";import{spawnSync as kK}from"node:child_process";async function Yg0($,Y={}){let z={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Uo,version:B1,launcher:$.launcher},U=Y.repo||process.env[Rg1]?.trim()||process.env[_g1]?.trim()||$g0,I=Y.targetVersion?.trim(),Q=I&&I.toLowerCase()!=="latest"?I:void 0;if(Q){let N=Q.replace(/^v/,""),A=Qg0(N,B1);if(A<0)if(!hS&&Y.force);else{c0({updated:!1,currentVersion:B1,targetVersion:N,mode:xT()?"binary":"source",message:!hS?`Cannotdowngradeseal-usefromdevbuildv${B1}toreleasev${N}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${B1}toolderversionv${N}.Updatesmustbeforward-only.`});return}if(A===0&&!Y.force){c0({updated:!1,currentVersion:B1,targetVersion:N,mode:xT()?"binary":"source",message:`seal-useisalreadyatversionv${B1}.Use--forcetoreinstall.`});return}}if(Y.changelogOnly){let N=await Wo(U,Y.limit??10);c0({currentVersion:B1,totalQueried:N.length,releases:N.map((A)=>({version:A.version,tagName:A.tagName,publishedAt:A.publishedAt,author:A.author,releaseNotes:A.notes,releaseUrl:A.htmlUrl,isCurrent:A.version===B1,isNewer:Eq(A.version,B1)}))});return}if(!xT()){if(Y.checkOnly){let A=await Wo(U,30),T=A[0],P=T?.version??B1,j=A.find((k)=>k.version===B1),C=Eq(P,B1),b=A.filter((k)=>Eq(k.version,B1));c0({updated:!1,updateAvailable:C,currentVersion:B1,currentVersionPublishedAt:j?.publishedAt,latestVersion:P,latestVersionPublishedAt:T?.publishedAt,behindCount:b.length,pendingReleases:b.map((k)=>({version:k.version,tagName:k.tagName,publishedAt:k.publishedAt,author:k.author,releaseNotes:k.notes,releaseUrl:k.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let N=yK(z).running;if(N)await SU("stop",z);try{tS0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(A){console.error(`gitpullskipped:${AinstanceofError?A.message:String(A)}`)}if(tS0("bun",["install"],{cwd:$.appRoot}),N)await SU("start",z);c0({updated:!0,serviceRestarted:N,version:B1,mode:"source"});return}let J=hg1(),K=Sg1(),G=await Wo(U,30),W=Q?G.find((N)=>N.version===Q||N.tagName===Q||N.tagName===`v${Q}`)??await aS0(U,Q):G[0]??await aS0(U);if(!W){c0({updated:!1,currentVersion:B1,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${U}'`});return}let H=W.version,X=G.find((N)=>N.version===B1),Z=Eq(H,B1),q=Z||Boolean(Y.force),V=G.filter((N)=>Eq(N.version,B1));if(Y.checkOnly){c0({updated:!1,updateAvailable:Z,currentVersion:B1,currentVersionPublishedAt:X?.publishedAt,latestVersion:H,latestVersionPublishedAt:W.publishedAt,behindCount:V.length,pendingReleases:V.map((N)=>({version:N.version,tagName:N.tagName,publishedAt:N.publishedAt,author:N.author,releaseNotes:N.notes,releaseUrl:N.htmlUrl})),releaseNotes:W.notes,releaseUrl:W.htmlUrl,mode:"binary"});return}if(!q){c0({updated:!1,currentVersion:B1,currentVersionPublishedAt:X?.publishedAt,latestVersion:H,latestVersionPublishedAt:W.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${B1})`});return}let F=yg1(W.assets,J,K);if(!F)throw Error(`Nocompatiblebinaryfoundfor${J}-${K}inreleasev${H}.Availableassets:${W.assets.map((N)=>N.name).join(", ")}`);let M=yK(z).running;if(M)await SU("stop",z);let w=process.execPath,O=Cg1(w),D=uT(O,`.tmp-update-${Date.now()}`);Ag1(D,{recursive:!0});try{let N=uT(D,F.name);await kg1(F.downloadUrl,N,W.tagName,F.name);let A=N;if(F.name.endsWith(".tar.gz")||F.name.endsWith(".tgz"))A=xg1(N,D,J);else if(F.name.endsWith(".zip"))A=fg1(N,D,J);if(Bg1(A,493),process.platform==="darwin")try{kK("/usr/bin/codesign",["--remove-signature",A],{stdio:"ignore"}),kK("/usr/bin/codesign",["--force","--sign","-",A],{stdio:"ignore"})}catch{}if(process.platform==="win32"){let P=`${w}.old.${Date.now()}`;try{Go(w,P)}catch{}Go(A,w)}else Go(A,w);if(M)await SU("start",z);let T=vg1(w,H);c0({updated:!0,fromVersion:B1,toVersion:H,serviceRestarted:M,skillSynced:T.targetDir??!1,skillVersion:T.version??!1,mode:"binary"})}finally{try{jg1(D,{recursive:!0,force:!0})}catch{}}}function
Line truncated
`)}catch{}}async function kg1($,Y,z,U){let I=Ho(),Q=[],J=z?z.startsWith("v")?z:`v${z}`:void 0,K=U||$.split("/").pop()||"";if(I!=="github"){if(J&&K)Q.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${J}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${J}/${K}`);if($.startsWith("https://git.ying-qing.cn"))Q.push($)}if(I!=="gitea")if(J&&K){let F=`https://github.com/${$g0}/releases/download/${J}/${K}`;if(!process.env.CI)Q.push(`https://ghfast.top/${F}`,`https://gh.ddlc.top/${F}`);Q.push(F)}else if($.includes("github.com")){if(!process.env.CI)Q.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);Q.push($)}else Q.push($);let G=Array.from(new Set(Q)),W,H=6000,X=6000,Z=307200,q=1e4,V=180000;for(let F=0;F<G.length;F++){let M=G[F],w=new AbortController,O="",D=(P)=>{O=P;try{w.abort()}catch{}},N=setTimeout(()=>{D("Connection timed out (no response headers within 6s)")},H),A,T;try{fT(`==> [${F+1}/${G.length}] Downloading via: ${M}`);let P=await fetch(M,{signal:w.signal});if(N)clearTimeout(N),N=void 0;if(!P.ok)throw Error(`HTTP ${P.status} ${P.statusText}`);A=setTimeout(()=>{D("Overall download time exceeded 3 minutes")},V);let j=Number(P.headers.get("content-length"))||0,C=P.body?.getReader();if(!C){let c=Buffer.from(await P.arrayBuffer());if(c.length<1000)throw Error(`Downloaded content is suspiciously small (${c.length} bytes)`);sS0(Y,c),fT(`✓ Download succeeded (${(c.length/1024/1024).toFixed(1)} MB)`);return}let b=[],k=0,h=0;T=setTimeout(()=>{if(k<Z){let c=(k/1024).toFixed(1);D(`Initial transfer too slow (${c} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let c=C.read(),U0,x=new Promise((g,p)=>{U0=setTimeout(()=>{p(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),d;try{d=await Promise.race([c,x])}finally{if(U0)clearTimeout(U0)}let{done:t,value:$0}=d;if(t)break;if($0){if(b.push($0),k+=$0.length,T&&k>=Z)clearTimeout(T),T=void 0;let g=Date.now();if(g-h>200){h=g;let p=j?Math.round(k/j*100):0,e=(k/1048576).toFixed(1),y=j?(j/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${p}% (${e} / ${y} MB)...`)}catch{}}}}try{process.stderr.write(`
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${Q.id}<testCorpId>`);K=E1(O)}let G=await j1(J),H=await j1(K),W=s0(z.options.samples)??s0(z.options.limit)??s0(z.options.n)??10,X=V0(z.options["dry-run"]),Z=V0(z.options["fail-on-flips"]),q=s0(z.options["poll-interval"])??2000,V=s0(z.options.timeout)??45000,F=S(z.options["sn-prefix"])??"REG_",M=await Wg0({sourceCorp:J,targetCorp:K,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:F,failOnFlips:Z});if(!(V0(z.options.quiet)||V0(z.options.silent)))console.error(Xg0(M));if(c0(M),Z&&!M.ok)throw new w4(`回归测试发现${M.metrics.flipCount}笔单据决策翻转,已按--fail-on-flips策略非零终止。`,1);return}throw new w4(`未知的test子命令:"${U}"。
可用子命令:seal-usetestregression[--corp<id>][--samples<N>][--dry-run]`,2,"seal-use test regression --help")}var qg0=o(()=>{L$();o4();D4();Q4();i8();Zg0()});async function Vg0($,Y,z,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await k0($,Y,z,y8(U.json),C0(U.options))}var Lg0=o(()=>{o4();D4();Q4()});function Fg0(){c0(Vq.map(($)=>({name:$.name,description:$.description})))}var wg0=o(()=>{Fq();Q4()});function cT($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.includes("\\$bunfs\\"))return!0;let z=$.toLowerCase().replace(/\\/g,"/");return!z.endsWith("/bun")&&!z.endsWith("/bun.exe")&&!z.endsWith("/node")&&!z.endsWith("/node.exe")}var Mg0=o(()=>{Cq()});import{chmodSync as $y1,mkdirSync as Yy1,readdirSync as zy1,renameSync as Ao,rmSync as Uy1,unlinkSync as Ag0,writeFileSync as Og0}from"node:fs";import{basename as Iy1,dirname as Qy1,join as pT}from"node:path";import{spawnSync as uK}from"node:child_process";async function Bg0($,Y={}){let z={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:wo,version:P1,launcher:$.launcher},U=Y.repo||process.env[Jy1]?.trim()||process.env[Ky1]?.trim()||Pg0,I=Y.targetVersion?.trim(),Q=I&&I.toLowerCase()!=="latest"?I:void 0;if(Q){let N=Q.replace(/^v/,""),B=Cg0(N,P1);if(B<0)if(!xS&&Y.force);else{c0({updated:!1,currentVersion:P1,targetVersion:N,mode:cT()?"binary":"source",message:!xS?`Cannotdowngradeseal-usefromdevbuildv${P1}toreleasev${N}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${P1}toolderversionv${N}.Updatesmustbeforward-only.`});return}if(B===0&&!Y.force){c0({updated:!1,currentVersion:P1,targetVersion:N,mode:cT()?"binary":"source",message:`seal-useisalreadyatversionv${P1}.Use--forcetoreinstall.`});return}}if(Y.changelogOnly){let N=await Po(U,Y.limit??10);c0({currentVersion:P1,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===P1,isNewer:hq(B.version,P1)}))});return}if(!cT()){if(Y.checkOnly){let B=await Po(U,30),T=B[0],A=T?.version??P1,j=B.find((k)=>k.version===P1),C=hq(A,P1),b=B.filter((k)=>hq(k.version,P1));c0({updated:!1,updateAvailable:C,currentVersion:P1,currentVersionPublishedAt:j?.publishedAt,latestVersion:A,latestVersionPublishedAt:T?.publishedAt,behindCount:b.length,pendingReleases:b.map((k)=>({version:k.version,tagName:k.tagName,publishedAt:k.publishedAt,author:k.author,releaseNotes:k.notes,releaseUrl:k.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let N=fK(z).running;if(N)await yU("stop",z);try{Dg0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(Dg0("bun",["install"],{cwd:$.appRoot}),N)await yU("start",z);c0({updated:!0,serviceRestarted:N,version:P1,mode:"source"});return}let J=Hy1(),K=Wy1(),G=await Po(U,30),H=Q?G.find((N)=>N.version===Q||N.tagName===Q||N.tagName===`v${Q}`)??await Ng0(U,Q):G[0]??await Ng0(U);if(!H){c0({updated:!1,currentVersion:P1,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${U}'`});return}let W=H.version,X=G.find((N)=>N.version===P1),Z=hq(W,P1),q=Z||Boolean(Y.force),V=G.filter((N)=>hq(N.version,P1));if(Y.checkOnly){c0({updated:!1,updateAvailable:Z,currentVersion:P1,currentVersionPublishedAt:X?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,behindCount:V.length,pendingReleases:V.map((N)=>({version:N.version,tagName:N.tagName,publishedAt:N.publishedAt,author:N.author,releaseNotes:N.notes,releaseUrl:N.htmlUrl})),releaseNotes:H.notes,releaseUrl:H.htmlUrl,mode:"binary"});return}if(!q){c0({updated:!1,currentVersion:P1,currentVersionPublishedAt:X?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${P1})`});return}let F=Zy1(H.assets,J,K);if(!F)throw Error(`Nocompatiblebinaryfoundfor${J}-${K}inreleasev${W}.Availableassets:${H.assets.map((N)=>N.name).join(", ")}`);let M=fK(z).running;if(M)await yU("stop",z);let w=process.execPath,O=Qy1(w),D=pT(O,`.tmp-update-${Date.now()}`);Yy1(D,{recursive:!0});try{let N=pT(D,F.name);await qy1(F.downloadUrl,N,H.tagName,F.name);let B=N;if(F.name.endsWith(".tar.gz")||F.name.endsWith(".tgz"))B=Vy1(N,D,J);else if(F.name.endsWith(".zip"))B=Ly1(N,D,J);if($y1(B,493),process.platform==="darwin")try{uK("/usr/bin/codesign",["--remove-signature",B],{stdio:"ignore"}),uK("/usr/bin/codesign",["--force","--sign","-",B],{stdio:"ignore"})}catch{}if(process.platform==="win32"){let A=`${w}.old.${Date.now()}`;try{Ao(w,A)}catch{}Ao(B,w)}else Ao(B,w);if(M)await yU("start",z);let T=Gy1(w,W);c0({updated:!0,fromVersion:P1,toVersion:W,serviceRestarted:M,skillSynced:T.targetDir??!1,skillVersion:T.version??!1,mode:"binary"})}finally{try{Uy1(D,{recursive:!0,force:!0})}catch{}}}function
Line truncated
`)}catch{}}async function qy1($,Y,z,U){let I=Bo(),Q=[],J=z?z.startsWith("v")?z:`v${z}`:void 0,K=U||$.split("/").pop()||"";if(I!=="github"){if(J&&K)Q.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${J}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${J}/${K}`);if($.startsWith("https://git.ying-qing.cn"))Q.push($)}if(I!=="gitea")if(J&&K){let F=`https://github.com/${Pg0}/releases/download/${J}/${K}`;if(!process.env.CI)Q.push(`https://ghfast.top/${F}`,`https://gh.ddlc.top/${F}`);Q.push(F)}else if($.includes("github.com")){if(!process.env.CI)Q.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);Q.push($)}else Q.push($);let G=Array.from(new Set(Q)),H,W=6000,X=6000,Z=307200,q=1e4,V=180000;for(let F=0;F<G.length;F++){let M=G[F],w=new AbortController,O="",D=(A)=>{O=A;try{w.abort()}catch{}},N=setTimeout(()=>{D("Connection timed out (no response headers within 6s)")},W),B,T;try{nT(`==> [${F+1}/${G.length}] Downloading via: ${M}`);let A=await fetch(M,{signal:w.signal});if(N)clearTimeout(N),N=void 0;if(!A.ok)throw Error(`HTTP ${A.status} ${A.statusText}`);B=setTimeout(()=>{D("Overall download time exceeded 3 minutes")},V);let j=Number(A.headers.get("content-length"))||0,C=A.body?.getReader();if(!C){let c=Buffer.from(await A.arrayBuffer());if(c.length<1000)throw Error(`Downloaded content is suspiciously small (${c.length} bytes)`);Og0(Y,c),nT(`✓ Download succeeded (${(c.length/1024/1024).toFixed(1)} MB)`);return}let b=[],k=0,h=0;T=setTimeout(()=>{if(k<Z){let c=(k/1024).toFixed(1);D(`Initial transfer too slow (${c} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let c=C.read(),U0,x=new Promise((g,p)=>{U0=setTimeout(()=>{p(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),d;try{d=await Promise.race([c,x])}finally{if(U0)clearTimeout(U0)}let{done:t,value:$0}=d;if(t)break;if($0){if(b.push($0),k+=$0.length,T&&k>=Z)clearTimeout(T),T=void 0;let g=Date.now();if(g-h>200){h=g;let p=j?Math.round(k/j*100):0,e=(k/1048576).toFixed(1),y=j?(j/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${p}% (${e} / ${y} MB)...`)}catch{}}}}try{process.stderr.write(`
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.