import{createRequireasqO0}from"node:module";varlD0=Object.create;var{getPrototypeOf:oD0,defineProperty:DO,getOwnPropertyNames:rD0}=Object;vartD0=Object.prototype.hasOwnProperty;functionaD0($){returnthis[$]}varsD0,eD0,TI=($,I,q)=>{varz=$!=null&&typeof$==="object";if(z){varU=I?sD0??=newWeakMap:eD0??=newWeakMap,Y=U.get($);if(Y)returnY}q=$!=null?lD0(oD0($)):{};letJ=I||!$||!$.__esModule?DO(q,"default",{value:$,enumerable:!0}):q;for(letQofrD0($))if(!tD0.call(J,Q))DO(J,Q,{get:aD0.bind($,Q),enumerable:!0});if(z)U.set($,J);returnJ};varO=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);var$O0=($)=>$;functionIO0($,I){this[$]=$O0.bind(null,I)}varz5=($,I)=>{for(varqinI)DO($,q,{get:I[q],enumerable:!0,configurable:!0,set:IO0.bind(I,q)})};vart=qO0(import.meta.url);varlY=O((yn)=>{Object.defineProperty(yn,"__esModule",{value:!0});yn.regexpCode=yn.getEsmExportName=yn.getProperty=yn.safeStringify=yn.stringify=yn.strConcat=yn.addCodeArg=yn.str=yn._=yn.nil=yn._Code=yn.Name=yn.IDENTIFIER=yn._CodeOrName=void0;classaH{}yn._CodeOrName=aH;yn.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classwqextendsaH{constructor($){super();if(!yn.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}yn.Name=wq;classr$extendsaH{constructor($){super();this._items=typeof$==="string"?[$]:$}toString(){returnthis.str}emptyStr(){if(this._items.length>1)return!1;let$=this._items[0];return$===""||$==='""'}getstr(){var$;return($=this._str)!==null&&$!==void0?$:this._str=this._items.reduce((I,q)=>`${I}${q}`,"")}getnames(){var$;return($=this._names)!==null&&$!==void0?$:this._names=this._items.reduce((I,q)=>{if(qinstanceofwq)I[q.str]=(I[q.str]||0)+1;returnI},{})}}yn._Code=r$;yn.nil=newr$("");functionSn($,...I){letq=[$[0]],z=0;while(z<I.length)RT(q,I[z]),q.push($[++z]);returnnewr$(q)}yn._=Sn;varvT=newr$("+");functionun($,...I){letq=[mY($[0])],z=0;while(z<I.length)q.push(vT),RT(q,I[z]),q.push(vT,mY($[++z]));returnPA0(q),newr$(q)}yn.str=un;functionRT($,I){if(Iinstanceofr$)$.push(...I._items);elseif(Iinstanceofwq)$.push(I);else$.push(jA0(I))}yn.addCodeArg=RT;functionPA0($){letI=1;while(I<$.length-1){if($[I]===vT){letq=TA0($[I-1],$[I+1]);if(q!==void0){$.splice(I-1,3,q);continue}$[I++]="+"}I++}}functionTA0($,I){if(I==='""')return$;if($==='""')returnI;if(typeof$=="string"){if(Iinstanceofwq||$[$.length-1]!=='"')return;if(typeofI!="string")return`${$.slice(0,-1)}${I}"`;if(I[0]==='"')return$.slice(0,-1)+I.slice(1);return}if(typeofI=="string"&&I[0]==='"'&&!($instanceofwq))return`"${$}${I.slice(1)}`;return}functionEA0($,I){returnI.emptyStr()?$:$.emptyStr()?I:un`${$}${I}`}yn.strConcat=EA0;functionjA0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:mY(Array.isArray($)?$.join(","):$)}functionBA0($){returnnewr$(mY($))}yn.stringify=BA0;functionmY($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}yn.safeStringify=mY;functiongA0($){returntypeof$=="string"&&yn.IDENTIFIER.test($)?newr$(`.${$}`):Sn`[${$}]`}yn.getProperty=gA0;functionvA0($){if(typeof$=="string"&&yn.IDENTIFIER.test($))returnnewr$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}yn.getEsmExportName=vA0;functionRA0($){returnnewr$($.toString())}yn.regexpCode=RA0});varST=O((nn)=>{Object.defineProperty(nn,"__esModule",{value:!0});nn.ValueScope=nn.ValueScopeName=nn.Scope=nn.varKinds=nn.UsedValueState=void0;vard6=lY();classknextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}vareH;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(eH||(nn.UsedValueState=eH={}));nn.varKinds={const:newd6.Name("const"),let:newd6.Name("let"),var:newd6.Name("var")};class_T{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return$instanceofd6.Name?$:this.name($)}name($){returnnewd6.Name(this._newName($))}_newName($){letI=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){varI,q;if(((q=(I=this._parent)===null||I===void0?void0:I._prefixes)===null||q===void0?void0:q.has($))||this._prefixes&&!this._prefixes.has($))throwError(`CodeGen: prefix "${$}" is not allowed in this scope`);returnthis._names[$]={prefix:$,index:0}}}nn.Scope=_T;classhTextendsd6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:q}){this.value=$,this.scopePath=d6._`.${newd6.Name(I)}[${q}]`}}nn.ValueScopeName=hT;varpA0=d6._`\n`;classfnextends_T{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?pA0:d6.nil}}get(){returnthis._scope}name($){returnnewhT($,this._newName($))}value($,I){varq;if(I.ref===void0)throwError("CodeGen: ref must be passed in value");letz=this.toName($),{prefix:U}=z,Y=(q=I.key)!==null&&q!==void0?q:I.ref,J=this._values[U];if(J){letK=J.get(Y);if(Line truncated
import{createRequireasVO0}from"node:module";varUO0=Object.create;var{getPrototypeOf:YO0,defineProperty:FO,getOwnPropertyNames:JO0}=Object;varQO0=Object.prototype.hasOwnProperty;functionwO0($){returnthis[$]}varKO0,HO0,jI=($,I,q)=>{varz=$!=null&&typeof$==="object";if(z){varU=I?KO0??=newWeakMap:HO0??=newWeakMap,Y=U.get($);if(Y)returnY}q=$!=null?UO0(YO0($)):{};letJ=I||!$||!$.__esModule?FO(q,"default",{value:$,enumerable:!0}):q;for(letQofJO0($))if(!QO0.call(J,Q))FO(J,Q,{get:wO0.bind($,Q),enumerable:!0});if(z)U.set($,J);returnJ};varF=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);varGO0=($)=>$;functionWO0($,I){this[$]=GO0.bind(null,I)}varU5=($,I)=>{for(varqinI)FO($,q,{get:I[q],enumerable:!0,configurable:!0,set:WO0.bind(I,q)})};vart=VO0(import.meta.url);vartY=F((cn)=>{Object.defineProperty(cn,"__esModule",{value:!0});cn.regexpCode=cn.getEsmExportName=cn.getProperty=cn.safeStringify=cn.stringify=cn.strConcat=cn.addCodeArg=cn.str=cn._=cn.nil=cn._Code=cn.Name=cn.IDENTIFIER=cn._CodeOrName=void0;classeH{}cn._CodeOrName=eH;cn.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classGqextendseH{constructor($){super();if(!cn.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}cn.Name=Gq;classa$extendseH{constructor($){super();this._items=typeof$==="string"?[$]:$}toString(){returnthis.str}emptyStr(){if(this._items.length>1)return!1;let$=this._items[0];return$===""||$==='""'}getstr(){var$;return($=this._str)!==null&&$!==void0?$:this._str=this._items.reduce((I,q)=>`${I}${q}`,"")}getnames(){var$;return($=this._names)!==null&&$!==void0?$:this._names=this._items.reduce((I,q)=>{if(qinstanceofGq)I[q.str]=(I[q.str]||0)+1;returnI},{})}}cn._Code=a$;cn.nil=newa$("");functionbn($,...I){letq=[$[0]],z=0;while(z<I.length)_T(q,I[z]),q.push($[++z]);returnnewa$(q)}cn._=bn;varCT=newa$("+");functionpn($,...I){letq=[rY($[0])],z=0;while(z<I.length)q.push(CT),_T(q,I[z]),q.push(CT,rY($[++z]));returnSA0(q),newa$(q)}cn.str=pn;function_T($,I){if(Iinstanceofa$)$.push(...I._items);elseif(IinstanceofGq)$.push(I);else$.push(xA0(I))}cn.addCodeArg=_T;functionSA0($){letI=1;while(I<$.length-1){if($[I]===CT){letq=uA0($[I-1],$[I+1]);if(q!==void0){$.splice(I-1,3,q);continue}$[I++]="+"}I++}}functionuA0($,I){if(I==='""')return$;if($==='""')returnI;if(typeof$=="string"){if(IinstanceofGq||$[$.length-1]!=='"')return;if(typeofI!="string")return`${$.slice(0,-1)}${I}"`;if(I[0]==='"')return$.slice(0,-1)+I.slice(1);return}if(typeofI=="string"&&I[0]==='"'&&!($instanceofGq))return`"${$}${I.slice(1)}`;return}functionyA0($,I){returnI.emptyStr()?$:$.emptyStr()?I:pn`${$}${I}`}cn.strConcat=yA0;functionxA0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:rY(Array.isArray($)?$.join(","):$)}functionkA0($){returnnewa$(rY($))}cn.stringify=kA0;functionrY($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}cn.safeStringify=rY;functionfA0($){returntypeof$=="string"&&cn.IDENTIFIER.test($)?newa$(`.${$}`):bn`[${$}]`}cn.getProperty=fA0;functionnA0($){if(typeof$=="string"&&cn.IDENTIFIER.test($))returnnewa$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}cn.getEsmExportName=nA0;functionbA0($){returnnewa$($.toString())}cn.regexpCode=bA0});varyT=F((on)=>{Object.defineProperty(on,"__esModule",{value:!0});on.ValueScope=on.ValueScopeName=on.Scope=on.varKinds=on.UsedValueState=void0;vard6=tY();classmnextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varIG;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(IG||(on.UsedValueState=IG={}));on.varKinds={const:newd6.Name("const"),let:newd6.Name("let"),var:newd6.Name("var")};classST{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return$instanceofd6.Name?$:this.name($)}name($){returnnewd6.Name(this._newName($))}_newName($){letI=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){varI,q;if(((q=(I=this._parent)===null||I===void0?void0:I._prefixes)===null||q===void0?void0:q.has($))||this._prefixes&&!this._prefixes.has($))throwError(`CodeGen: prefix "${$}" is not allowed in this scope`);returnthis._names[$]={prefix:$,index:0}}}on.Scope=ST;classuTextendsd6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:q}){this.value=$,this.scopePath=d6._`.${newd6.Name(I)}[${q}]`}}on.ValueScopeName=uT;var$P0=d6._`\n`;classlnextendsST{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?$P0:d6.nil}}get(){returnthis._scope}name($){returnnewuT($,this._newName($))}value($,I){varq;if(I.ref===void0)throwError("CodeGen: ref must be passed in value");letz=this.toName($),{prefix:U}=z,Y=(q=I.key)!==null&&q!==void0?q:I.ref,J=this._values[U];if(J){letK=J.get(Y);if(Line truncated
deps:${q}}`};var tg0={keyword:"dependencies",type:"object",schemaType:"object",error:qc.error,code($){let[I,q]=ag0($);$c($,I),Ic($,q)}};function ag0({schema:$}){let I={},q={};for(let z in $){if(z==="__proto__")continue;let U=Array.isArray($[z])?I:q;U[z]=$[z]}return[I,q]}function $c($,I=$.schema){let{gen:q,data:z,it:U}=$;if(Object.keys(I).length===0)return;let Y=q.let("missing");for(let J in I){let Q=I[J];if(Q.length===0)continue;let w=(0,WJ.propertyInData)(q,z,J,U.opts.ownProperties);if($.setParams({property:J,depsCount:Q.length,deps:Q.join(", ")}),U.allErrors)q.if(w,()=>{for(let K of Q)(0,WJ.checkReportMissingProp)($,K)});else q.if(OE._`${w}&&(${(0,WJ.checkMissingProp)($,Q,Y)})`),(0,WJ.reportMissingProp)($,Y),q.else()}}qc.validatePropertyDeps=$c;function Ic($,I=$.schema){let{gen:q,data:z,keyword:U,it:Y}=$,J=q.name("valid");for(let Q in I){if((0,rg0.alwaysValidSchema)(Y,I[Q]))continue;q.if((0,WJ.propertyInData)(q,z,Q,Y.opts.ownProperties),()=>{let w=$.subschema({keyword:U,schemaProp:Q},J);$.mergeValidEvaluated(w,J)},()=>q.var(J,!0)),$.ok(J)}}qc.validateSchemaDeps=Ic;qc.default=tg0});var wc=O((Qc)=>{Object.defineProperty(Qc,"__esModule",{value:!0});var Jc=a0(),$v0=Z1(),Iv0={message:"property name must be valid",params:({params:$})=>Jc._`{propertyName:${$.propertyName}}`},qv0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Iv0,code($){let{gen:I,schema:q,data:z,it:U}=$;if((0,$v0.alwaysValidSchema)(U,q))return;let Y=I.name("valid");I.forIn("key",z,(J)=>{$.setParams({propertyName:J}),$.subschema({keyword:"propertyNames",data:J,dataTypes:["string"],propertyName:J,compositeRule:!0},Y),I.if((0,Jc.not)(Y),()=>{if($.error(!0),!U.allErrors)I.break()})}),$.ok(Y)}};Qc.default=qv0});var FE=O((Kc)=>{Object.defineProperty(Kc,"__esModule",{value:!0});var jG=g$(),e$=a0(),Uv0=K5(),BG=Z1(),Yv0={message:"must NOT have additional properties",params:({params:$})=>e$._`{additionalProperty:${$.additionalProperty}}`},Jv0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Yv0,code($){let{gen:I,schema:q,parentSchema:z,data:U,errsCount:Y,it:J}=$;if(!Y)throw Error("ajv implementation error");let{allErrors:Q,opts:w}=J;if(J.props=!0,w.removeAdditional!=="all"&&(0,BG.alwaysValidSchema)(J,q))return;let K=(0,jG.allSchemaProperties)(z.properties),H=(0,jG.allSchemaProperties)(z.patternProperties);G(),$.ok(e$._`${Y}===${Uv0.default.errors}`);function G(){I.forIn("key",U,(D)=>{if(!K.length&&!H.length)X(D);else I.if(W(D),()=>X(D))})}function W(D){let F;if(K.length>8){let P=(0,BG.schemaRefOrVal)(J,z.properties,"properties");F=(0,jG.isOwnProperty)(I,P,D)}else if(K.length)F=(0,e$.or)(...K.map((P)=>e$._`${D}===${P}`));else F=e$.nil;if(H.length)F=(0,e$.or)(F,...H.map((P)=>e$._`${(0,jG.usePattern)($,P)}.test(${D})`));return(0,e$.not)(F)}function V(D){I.code(e$._`delete${U}[${D}]`)}function X(D){if(w.removeAdditional==="all"||w.removeAdditional&&q===!1){V(D);return}if(q===!1){if($.setParams({additionalProperty:D}),$.error(),!Q)I.break();return}if(typeof q=="object"&&!(0,BG.alwaysValidSchema)(J,q)){let F=I.name("valid");if(w.removeAdditional==="failing")L(D,F,!1),I.if((0,e$.not)(F),()=>{$.reset(),V(D)});else if(L(D,F),!Q)I.if((0,e$.not)(F),()=>I.break())}}function L(D,F,P){let T={keyword:"additionalProperties",dataProp:D,dataPropType:BG.Type.Str};if(P===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(T,F)}}};Kc.default=Jv0});var Vc=O((Wc)=>{Object.defineProperty(Wc,"__esModule",{value:!0});var wv0=$J(),Hc=g$(),NE=Z1(),Gc=FE(),Kv0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:I,schema:q,parentSchema:z,data:U,it:Y}=$;if(Y.opts.removeAdditional==="all"&&z.additionalProperties===void 0)Gc.default.code(new wv0.KeywordCxt(Y,Gc.default,"additionalProperties"));let J=(0,Hc.allSchemaProperties)(q);for(let G of J)Y.definedProperties.add(G);if(Y.opts.unevaluated&&J.length&&Y.props!==!0)Y.props=NE.mergeEvaluated.props(I,(0,NE.toHash)(J),Y.props);let Q=J.filter((G)=>!(0,NE.alwaysValidSchema)(Y,q[G]));if(Q.length===0)return;let w=I.name("valid");for(let G of Q){if(K(G))H(G);else{if(I.if((0,Hc.propertyInData)(I,U,G,Y.opts.ownProperties)),H(G),!Y.allErrors)I.else().var(w,!0);I.endIf()}$.it.definedProperties.add(G),$.ok(w)}function K(G){return Y.opts.useDefaults&&!Y.compositeRule&&q[G].default!==void 0}function H(G){$.subschema({keyword:"properties",schemaProp:G,dataProp:G},w)}}};Wc.default=Kv0});var Oc=O((Dc)=>{Object.defineProperty(Dc,"__esModule",{value:!0});var Zc=g$(),gG=a0(),Xc=Z1(),Lc=Z1(),Gv0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:q,data:z,parentSchema:U,it:Y}=$,{opts:J}=Y,Q=(0,Zc.allSchemaProperties)(q),w=Q.filter((L)=>(0,Xc.alwaysValidSchema)(Y,q[L]));if(Q.length===0||w.length===Q.length&&(!Y.opts.unevaluated||Y.props===!0))return;let K=J.strictSchema&&!J.allowMatchingProperties&&U.properties,H=I.name("valid");if(Y.props!==!0&&!(Y.props instanceo
Line truncated
`)}openNode($,I){let q=this.tos,z=this._xml;if(q&&this.open)z.push(">");this._stack.push($),z.push("<"),z.push($),kg(z,I),this.leaf=!0,this.open=!0}addAttribute($,I){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(I!==void 0)Z00(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");kg(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(V00.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),I=this._xml;if(this.leaf)I.push("/>");else I.push("</"),I.push($),I.push(">");this.open=!1,this.leaf=!1}leafNode($,I,q){if(this.openNode($,I),q!==void 0)this.writeText(q);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("")}}fg.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};X00.exports=fg});var ng=O((di0)=>{var L00=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ci0($){if(typeof $==="string")return $;if(L00)return L00.decode($);return $.toString()}di0.bufferToString=ci0});var M00=O((O00)=>{Object.defineProperty(O00,"__esModule",{value:!0});O00.CHAR=`
`,$=this.i;break;case Gp0:{let{entityReturnState:q}=this,z=this.entity+I.slice($,this.prevI);this.state=q;let U;if(z==="")this.fail("empty entity name."),U="&;";else U=this.parseEntity(z),this.entity="";if(q!==S6||this.textHandler!==void 0)this.text+=U;break $}case w4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(BQ($))this.state=Jp0,this.unget(),this.xmlDeclPossible=!1;else switch($){case uV:this.state=Kp0,this.xmlDeclPossible=!1;break;case c00:this.state=tb0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case U6:this.state=Ip0;break;default:this.fail("disallowed character in tag name"),this.state=S6,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=tg,this.openWakaBang="";break;case"--":this.state=rg,this.openWakaBang="";break;case"DOCTYPE":if(this.state=mg,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(SV))this.state=ab0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===SV)this.state=sb0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=rg}sCommentEnded(){let $=this.getCodeNorm();if($!==y4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=rg;else this.state=S6}sCData(){if(this.captureToChar(wz))this.state=eb0}sCDataEnding(){let $=this.getCodeNorm();if($===wz)this.state=$p0;else this.text+=`]${String.fromCodePoint($)}`,this.state=tg}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case y4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=S6;break}case wz:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=tg}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=x00;else if($===U6||t6($))this.fail("processing instruction without a target."),this.state=$===U6?hV:ag;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=x00}sPIRest(){let{chunk:$,i:I}=this;while(!0){let q=this.getCodeNorm();if(q===w4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(q)){this.piTarget+=$.slice(I,this.prevI);let z=q===U6;if(z||t6(q))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=z?X3:k00}else this.state=z?hV:ag;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(q);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===U6)this.state=hV;else if(!t6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(U6))this.state=hV}sPIEnding(){var $;let I=this.getCodeNorm();if(I===y4){let{piTarget:q}=this;if(q.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:q,body:this.text}),this.piTarget=this.text="",this.state=S6}else if(I===U6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=ag;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===U6){this.state=X3;return}if($!==w4)this.state=qp0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(Zp0);if($===U6){this.state=X3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(t6($)||$===Qz))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=$===Qz?f00:zp0}sXMLDeclEq(){let $=this.getCodeNorm();if($===U6){this.state=X3,this.fail("XML declaration is incomplete.");return}if(t6($))return;if($!==Qz)this.fail("value required.");this.state=f00}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===U6){this.state=X3,this.fail("XML declaration is incomplete.");return}if(t6($))return;if(!yV($))this.fail("value must be quoted."),this.q=p00;else this.q=$;this.state=Up0}sXMLDeclValue(){let $=this.captureTo([this.q,U6]);if($===U6){this.state=X3,this.text="",this.fail("XML declaration is incomplete.");return}if($===w4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let q=I;if(this.xmlDecl.version=q,!/^1\.[0-9]+$/.test(q))this.fail("ver
Line truncated
`;$=this.i;break;case w4:if(q!==void 0)this.text+=I.slice($);break $;default:if(!t6(U))z=!0}}if(!z)return;if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0}pushAttribNS($,I){var q;let{prefix:z,local:U}=this.qname($),Y={name:$,prefix:z,local:U,value:I};if(this.attribList.push(Y),(q=this.attributeHandler)===null||q===void 0||q.call(this,Y),z==="xmlns"){let J=I.trim();if(this.currentXMLVersion==="1.0"&&J==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[U]=J,zv(this,U,J)}else if($==="xmlns"){let J=I.trim();this.topNS[""]=J,zv(this,"",J)}}pushAttribPlain($,I){var q;let z={name:$,value:I};this.attribList.push(z),(q=this.attributeHandler)===null||q===void 0||q.call(this,z)}end(){var $,I;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:q}=this;while(q.length>0){let U=q.pop();this.fail(`unclosedtag:${U.name}`)}if(this.state!==y00&&this.state!==S6)this.fail("unexpected end.");let{text:z}=this;if(z.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,z),this.text="";return this._closed=!0,(I=this.endHandler)===null||I===void 0||I.call(this),this._init(),this}resolve($){var I,q;let z=this.topNS[$];if(z!==void 0)return z;let{tags:U}=this;for(let Y=U.length-1;Y>=0;Y--)if(z=U[Y].ns[$],z!==void 0)return z;if(z=this.ns[$],z!==void 0)return z;return(q=(I=this.opt).resolvePrefix)===null||q===void 0?void 0:q.call(I,$)}qname($){let I=$.indexOf(":");if(I===-1)return{prefix:"",local:$};let q=$.slice(I+1),z=$.slice(0,I);if(z===""||q===""||q.includes(":"))this.fail(`malformedname:${$}.`);return{prefix:z,local:q}}processAttribsNS(){var $;let{attribList:I}=this,q=this.tag;{let{prefix:Y,local:J}=this.qname(q.name);q.prefix=Y,q.local=J;let Q=q.uri=($=this.resolve(Y))!==null&&$!==void 0?$:"";if(Y!==""){if(Y==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(Q==="")this.fail(`unboundnamespaceprefix:${JSON.stringify(Y)}.`),q.uri=Y}}if(I.length===0)return;let{attributes:z}=q,U=new Set;for(let Y of I){let{name:J,prefix:Q,local:w}=Y,K,H;if(Q==="")K=J==="xmlns"?Kz:"",H=J;else{if(K=this.resolve(Q),K===void 0)this.fail(`unboundnamespaceprefix:${JSON.stringify(Q)}.`),K=Q;H=`{${K}}${w}`}if(U.has(H))this.fail(`duplicateattribute:${H}.`);U.add(H),Y.uri=K,z[J]=Y}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,I=this.tag.attributes;for(let{name:q,value:z}of $){if(I[q]!==void 0)this.fail(`duplicateattribute:${q}.`);I[q]=z}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:I}=this,q=this.tag;q.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,q),I.push(q),this.state=S6,this.name=""}openSelfClosingTag(){var $,I,q;this.processAttribs();let{tags:z}=this,U=this.tag;if(U.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,U),(I=this.closeTagHandler)===null||I===void 0||I.call(this,U),(this.tag=(q=z[z.length-1])!==null&&q!==void 0?q:null)===null)this.closedRoot=!0;this.state=S6,this.name=""}closeTag(){let{tags:$,name:I}=this;if(this.state=S6,this.name="",I===""){this.fail("weird empty close tag."),this.text+="</>";return}let q=this.closeTagHandler,z=$.length;while(z-- >0){let U=this.tag=$.pop();if(this.topNS=U.ns,q===null||q===void 0||q(U),U.name===I)break;this.fail("unexpected close tag.")}if(z===0)this.closedRoot=!0;else if(z<0)this.fail(`unmatchedclosingtag:${I}.`),this.text+=`</${I}>`}parseEntity($){if($[0]!=="#"){let q=this.ENTITIES[$];if(q!==void 0)return q;return this.fail(this.isName($)?"undefined entity.":"disallowed character in entity name."),`&${$};`}let I=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))I=parseInt($.slice(2),16);elseif(/^#[0-9]+$/.test($))I=parseInt($.slice(1),10);if(!this.isChar(I))returnthis.fail("malformed character entity."),`&${$};`;returnString.fromCodePoint(I)}}I10.SaxesParser=$10});varRQ=O((Hj1,z10)=>{var{SaxesParser:Mp0}=q10(),{PassThrough:Ap0}=O6(),{bufferToString:Pp0}=ng();z10.exports=asyncfunction*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(newAp0);letI=newMp0,q;I.on("error",(U)=>{q=U});letz=[];I.on("opentag",(U)=>z.push({eventType:"opentag",value:U})),I.on("text",(U)=>z.push({eventType:"text",value:U})),I.on("closetag",(U)=>z.push({eventType:"closetag",value:U}));forawait(letUof$){if(I.write(Pp0(U)),q)throwq;yieldz,z=[]}}});varL0=O((Gj1,U10)=>{varTp0=RQ(),Ep0=z6();classGz{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,I){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($instanceofGz)$.reset();elseif($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}asyncparse($){forawait(letIof$)for(let{eventType:q,value:z}ofI)if(q==="opentag")this.parseOpen(z);elseif(q==="text")this.parseText(z);elseif(q==="closetag"){if(!this.parseClose(z.name))returnthLine truncated
]`;this.ESCAPE_REGEXP=new RegExp(I)}set headers($){this._headers=$}shouldQuote($,I){let q=I?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(da0.default(q))return q;if(Array.isArray(q))return q[$];if(this._headers!==null)return q[this._headers[$]];return!1}format($,I,q){let z=`${ma0.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:U}=this;if(U.quote!==""){if(z.indexOf(U.quote)!==-1)return this.quoteField(z.replace(this.REPLACE_REGEXP,U.escapedQuote))}if(z.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(I,q))return this.quoteField(z);return z}quoteField($){let{quote:I}=this.formatterOptions;return`${I}${$}${I}`}}Pz.FieldFormatter=v70});var _R=O((R70)=>{Object.defineProperty(R70,"__esModule",{value:!0});R70.isSyncTransform=void 0;R70.isSyncTransform=($)=>$.length===1});var h70=O((Tz)=>{var _70=Tz&&Tz.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(Tz,"__esModule",{value:!0});Tz.RowFormatter=void 0;var oa0=_70(LZ()),ra0=_70(N70()),ta0=CR(),aa0=_R();class g3{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new ta0.FieldFormatter($),this.headers=$.headers,this.shouldWriteHeaders=$.shouldWriteHeaders,this.hasWrittenHeaders=!1,this.headers!==null)this.fieldFormatter.headers=this.headers;if($.transform)this.rowTransform=$.transform}static isRowHashArray($){if(Array.isArray($))return Array.isArray($[0])&&$[0].length===2;return!1}static isRowArray($){return Array.isArray($)&&!this.isRowHashArray($)}static gatherHeaders($){if(g3.isRowHashArray($))return $.map((I)=>I[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(aa0.isSyncTransform($))return(I,q)=>{let z=null;try{z=$(I)}catch(U){return q(U)}return q(null,z)};return(I,q)=>{$(I,q)}}set rowTransform($){if(!oa0.default($))throw TypeError("The transform should be a function");this._rowTransform=g3.createTransform($)}format($,I){this.callTransformer($,(q,z)=>{if(q)return I(q);if(!$)return I(null);let U=[];if(z){let{shouldFormatColumns:Y,headers:J}=this.checkHeaders(z);if(this.shouldWriteHeaders&&J&&!this.hasWrittenHeaders)U.push(this.formatColumns(J,!0)),this.hasWrittenHeaders=!0;if(Y){let Q=this.gatherColumns(z);U.push(this.formatColumns(Q,!1))}}return I(null,U)})}finish($){let I=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));I.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)I.push(this.formatterOptions.rowDelimiter);return $(null,I)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let I=g3.gatherHeaders($);if(this.headers=I,this.fieldFormatter.headers=I,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!ra0.default(I,$),headers:I}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((I)=>$[I]);if(g3.isRowHashArray($))return this.headers.map((I,q)=>{let z=$[q];if(z)return z[1];return""});if(g3.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((I,q)=>$[q])}callTransformer($,I){if(!this._rowTransform)return I(null,$);return this._rowTransform($,I)}formatColumns($,I){let q=$.map((U,Y)=>this.fieldFormatter.format(U,Y,I)).join(this.formatterOptions.delimiter),{rowCount:z}=this;if(this.rowCount+=1,z)return[this.formatterOptions.rowDelimiter,q].join("");return q}}Tz.RowFormatter=g3});var S70=O((vZ)=>{Object.defineProperty(vZ,"__esModule",{value:!0});vZ.FieldFormatter=vZ.RowFormatter=void 0;var sa0=h70();Object.defineProperty(vZ,"RowFormatter",{enumerable:!0,get:function(){return sa0.RowFormatter}});var ea0=CR();Object.defineProperty(vZ,"FieldFormatter",{enumerable:!0,get:function(){return ea0.FieldFormatter}})});var hR=O((y70)=>{Object.defineProperty(y70,"__esModule",{value:!0});y70.CsvFormatterStream=void 0;var Is0=t("stream"),qs0=S70();class u70 extends Is0.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new qs0.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,I,q){let z=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(U,Y)=>{if(U)return z=!0,q(U);if(Y)Y.forEach((J)=>{this.push(Buffer.from(J,"utf8"))});return z=!0,q()})}catch(U){if(z)throw U;q(U)}}_flush($){this.rowFormatter.finish((I,q)=>{if(I)return $(I);if(q)q.forEach((z)=>{this.push(Buffer.from(z,"utf8"))});return $()})}}y70.CsvFormatterStream=u70});var f70=O((P1)=>{var k70=P1&&P1.__createBinding||(Object.create?function($,I,q,z){if(z===void 0)z=q;Object.defineProperty($,z,{enumerable:!0,get:function(){return I[q]}})}:function($,I,q,z){if(z===void 0)z=q;$[z]=I[q]}),zs0=P1&&P1.__setModuleDefault||(Object.create?function($,I){Ob
Line truncated
deps:${q}}`};var Qv0={keyword:"dependencies",type:"object",schemaType:"object",error:Kc.error,code($){let[I,q]=wv0($);Qc($,I),wc($,q)}};function wv0({schema:$}){let I={},q={};for(let z in $){if(z==="__proto__")continue;let U=Array.isArray($[z])?I:q;U[z]=$[z]}return[I,q]}function Qc($,I=$.schema){let{gen:q,data:z,it:U}=$;if(Object.keys(I).length===0)return;let Y=q.let("missing");for(let J in I){let Q=I[J];if(Q.length===0)continue;let w=(0,XJ.propertyInData)(q,z,J,U.opts.ownProperties);if($.setParams({property:J,depsCount:Q.length,deps:Q.join(", ")}),U.allErrors)q.if(w,()=>{for(let K of Q)(0,XJ.checkReportMissingProp)($,K)});else q.if(NE._`${w}&&(${(0,XJ.checkMissingProp)($,Q,Y)})`),(0,XJ.reportMissingProp)($,Y),q.else()}}Kc.validatePropertyDeps=Qc;function wc($,I=$.schema){let{gen:q,data:z,keyword:U,it:Y}=$,J=q.name("valid");for(let Q in I){if((0,Jv0.alwaysValidSchema)(Y,I[Q]))continue;q.if((0,XJ.propertyInData)(q,z,Q,Y.opts.ownProperties),()=>{let w=$.subschema({keyword:U,schemaProp:Q},J);$.mergeValidEvaluated(w,J)},()=>q.var(J,!0)),$.ok(J)}}Kc.validateSchemaDeps=wc;Kc.default=Qv0});var Xc=F((Zc)=>{Object.defineProperty(Zc,"__esModule",{value:!0});var Vc=a0(),Gv0=Z1(),Wv0={message:"property name must be valid",params:({params:$})=>Vc._`{propertyName:${$.propertyName}}`},Vv0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Wv0,code($){let{gen:I,schema:q,data:z,it:U}=$;if((0,Gv0.alwaysValidSchema)(U,q))return;let Y=I.name("valid");I.forIn("key",z,(J)=>{$.setParams({propertyName:J}),$.subschema({keyword:"propertyNames",data:J,dataTypes:["string"],propertyName:J,compositeRule:!0},Y),I.if((0,Vc.not)(Y),()=>{if($.error(!0),!U.allErrors)I.break()})}),$.ok(Y)}};Zc.default=Vv0});var ME=F((Lc)=>{Object.defineProperty(Lc,"__esModule",{value:!0});var gG=v$(),I8=a0(),Xv0=H5(),vG=Z1(),Lv0={message:"must NOT have additional properties",params:({params:$})=>I8._`{additionalProperty:${$.additionalProperty}}`},Dv0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Lv0,code($){let{gen:I,schema:q,parentSchema:z,data:U,errsCount:Y,it:J}=$;if(!Y)throw Error("ajv implementation error");let{allErrors:Q,opts:w}=J;if(J.props=!0,w.removeAdditional!=="all"&&(0,vG.alwaysValidSchema)(J,q))return;let K=(0,gG.allSchemaProperties)(z.properties),H=(0,gG.allSchemaProperties)(z.patternProperties);G(),$.ok(I8._`${Y}===${Xv0.default.errors}`);function G(){I.forIn("key",U,(D)=>{if(!K.length&&!H.length)X(D);else I.if(W(D),()=>X(D))})}function W(D){let O;if(K.length>8){let P=(0,vG.schemaRefOrVal)(J,z.properties,"properties");O=(0,gG.isOwnProperty)(I,P,D)}else if(K.length)O=(0,I8.or)(...K.map((P)=>I8._`${D}===${P}`));else O=I8.nil;if(H.length)O=(0,I8.or)(O,...H.map((P)=>I8._`${(0,gG.usePattern)($,P)}.test(${D})`));return(0,I8.not)(O)}function V(D){I.code(I8._`delete${U}[${D}]`)}function X(D){if(w.removeAdditional==="all"||w.removeAdditional&&q===!1){V(D);return}if(q===!1){if($.setParams({additionalProperty:D}),$.error(),!Q)I.break();return}if(typeof q=="object"&&!(0,vG.alwaysValidSchema)(J,q)){let O=I.name("valid");if(w.removeAdditional==="failing")L(D,O,!1),I.if((0,I8.not)(O),()=>{$.reset(),V(D)});else if(L(D,O),!Q)I.if((0,I8.not)(O),()=>I.break())}}function L(D,O,P){let T={keyword:"additionalProperties",dataProp:D,dataPropType:vG.Type.Str};if(P===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(T,O)}}};Lc.default=Dv0});var Nc=F((Fc)=>{Object.defineProperty(Fc,"__esModule",{value:!0});var Fv0=zJ(),Dc=v$(),AE=Z1(),Oc=ME(),Nv0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:I,schema:q,parentSchema:z,data:U,it:Y}=$;if(Y.opts.removeAdditional==="all"&&z.additionalProperties===void 0)Oc.default.code(new Fv0.KeywordCxt(Y,Oc.default,"additionalProperties"));let J=(0,Dc.allSchemaProperties)(q);for(let G of J)Y.definedProperties.add(G);if(Y.opts.unevaluated&&J.length&&Y.props!==!0)Y.props=AE.mergeEvaluated.props(I,(0,AE.toHash)(J),Y.props);let Q=J.filter((G)=>!(0,AE.alwaysValidSchema)(Y,q[G]));if(Q.length===0)return;let w=I.name("valid");for(let G of Q){if(K(G))H(G);else{if(I.if((0,Dc.propertyInData)(I,U,G,Y.opts.ownProperties)),H(G),!Y.allErrors)I.else().var(w,!0);I.endIf()}$.it.definedProperties.add(G),$.ok(w)}function K(G){return Y.opts.useDefaults&&!Y.compositeRule&&q[G].default!==void 0}function H(G){$.subschema({keyword:"properties",schemaProp:G,dataProp:G},w)}}};Fc.default=Nv0});var Ec=F((Tc)=>{Object.defineProperty(Tc,"__esModule",{value:!0});var Mc=v$(),RG=a0(),Ac=Z1(),Pc=Z1(),Av0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:q,data:z,parentSchema:U,it:Y}=$,{opts:J}=Y,Q=(0,Mc.allSchemaProperties)(q),w=Q.filter((L)=>(0,Ac.alwaysValidSchema)(Y,q[L]));if(Q.length===0||w.length===Q.length&&(!Y.opts.unevaluated||Y.props===!0))return;let K=J.strictSchema&&!J.allowMatchingProperties&&U.properties,H=I.name("valid");if(Y.props!==!0&&!(Y.props instanceo
Line truncated
`)}openNode($,I){let q=this.tos,z=this._xml;if(q&&this.open)z.push(">");this._stack.push($),z.push("<"),z.push($),ng(z,I),this.leaf=!0,this.open=!0}addAttribute($,I){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(I!==void 0)M00(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");ng(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(N00.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),I=this._xml;if(this.leaf)I.push("/>");else I.push("</"),I.push($),I.push(">");this.open=!1,this.leaf=!1}leafNode($,I,q){if(this.openNode($,I),q!==void 0)this.writeText(q);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("")}}bg.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};A00.exports=bg});var ig=F((qi0)=>{var P00=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Ii0($){if(typeof $==="string")return $;if(P00)return P00.decode($);return $.toString()}qi0.bufferToString=Ii0});var g00=F((E00)=>{Object.defineProperty(E00,"__esModule",{value:!0});E00.CHAR=`
`,$=this.i;break;case Ap0:{let{entityReturnState:q}=this,z=this.entity+I.slice($,this.prevI);this.state=q;let U;if(z==="")this.fail("empty entity name."),U="&;";else U=this.parseEntity(z),this.entity="";if(q!==S6||this.textHandler!==void 0)this.text+=U;break $}case w4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(RQ($))this.state=Dp0,this.unget(),this.xmlDeclPossible=!1;else switch($){case xV:this.state=Np0,this.xmlDeclPossible=!1;break;case a00:this.state=Qp0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case U6:this.state=Wp0;break;default:this.fail("disallowed character in tag name"),this.state=S6,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=sg,this.openWakaBang="";break;case"--":this.state=ag,this.openWakaBang="";break;case"DOCTYPE":if(this.state=og,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(yV))this.state=wp0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===yV)this.state=Kp0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=ag}sCommentEnded(){let $=this.getCodeNorm();if($!==y4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=ag;else this.state=S6}sCData(){if(this.captureToChar(Gz))this.state=Hp0}sCDataEnding(){let $=this.getCodeNorm();if($===Gz)this.state=Gp0;else this.text+=`]${String.fromCodePoint($)}`,this.state=sg}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case y4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=S6;break}case Gz:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=sg}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=c00;else if($===U6||t6($))this.fail("processing instruction without a target."),this.state=$===U6?uV:eg;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=c00}sPIRest(){let{chunk:$,i:I}=this;while(!0){let q=this.getCodeNorm();if(q===w4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(q)){this.piTarget+=$.slice(I,this.prevI);let z=q===U6;if(z||t6(q))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=z?D3:d00}else this.state=z?uV:eg;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(q);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===U6)this.state=uV;else if(!t6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(U6))this.state=uV}sPIEnding(){var $;let I=this.getCodeNorm();if(I===y4){let{piTarget:q}=this;if(q.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:q,body:this.text}),this.piTarget=this.text="",this.state=S6}else if(I===U6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=eg;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===U6){this.state=D3;return}if($!==w4)this.state=Vp0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(Ep0);if($===U6){this.state=D3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(t6($)||$===Hz))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=$===Hz?m00:Zp0}sXMLDeclEq(){let $=this.getCodeNorm();if($===U6){this.state=D3,this.fail("XML declaration is incomplete.");return}if(t6($))return;if($!==Hz)this.fail("value required.");this.state=m00}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===U6){this.state=D3,this.fail("XML declaration is incomplete.");return}if(t6($))return;if(!kV($))this.fail("value must be quoted."),this.q=t00;else this.q=$;this.state=Xp0}sXMLDeclValue(){let $=this.captureTo([this.q,U6]);if($===U6){this.state=D3,this.text="",this.fail("XML declaration is incomplete.");return}if($===w4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let q=I;if(this.xmlDecl.version=q,!/^1\.[0-9]+$/.test(q))this.fail("ver
Line truncated
`;$=this.i;break;case w4:if(q!==void 0)this.text+=I.slice($);break $;default:if(!t6(U))z=!0}}if(!z)return;if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0}pushAttribNS($,I){var q;let{prefix:z,local:U}=this.qname($),Y={name:$,prefix:z,local:U,value:I};if(this.attribList.push(Y),(q=this.attributeHandler)===null||q===void 0||q.call(this,Y),z==="xmlns"){let J=I.trim();if(this.currentXMLVersion==="1.0"&&J==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[U]=J,Yv(this,U,J)}else if($==="xmlns"){let J=I.trim();this.topNS[""]=J,Yv(this,"",J)}}pushAttribPlain($,I){var q;let z={name:$,value:I};this.attribList.push(z),(q=this.attributeHandler)===null||q===void 0||q.call(this,z)}end(){var $,I;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:q}=this;while(q.length>0){let U=q.pop();this.fail(`unclosedtag:${U.name}`)}if(this.state!==p00&&this.state!==S6)this.fail("unexpected end.");let{text:z}=this;if(z.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,z),this.text="";return this._closed=!0,(I=this.endHandler)===null||I===void 0||I.call(this),this._init(),this}resolve($){var I,q;let z=this.topNS[$];if(z!==void 0)return z;let{tags:U}=this;for(let Y=U.length-1;Y>=0;Y--)if(z=U[Y].ns[$],z!==void 0)return z;if(z=this.ns[$],z!==void 0)return z;return(q=(I=this.opt).resolvePrefix)===null||q===void 0?void 0:q.call(I,$)}qname($){let I=$.indexOf(":");if(I===-1)return{prefix:"",local:$};let q=$.slice(I+1),z=$.slice(0,I);if(z===""||q===""||q.includes(":"))this.fail(`malformedname:${$}.`);return{prefix:z,local:q}}processAttribsNS(){var $;let{attribList:I}=this,q=this.tag;{let{prefix:Y,local:J}=this.qname(q.name);q.prefix=Y,q.local=J;let Q=q.uri=($=this.resolve(Y))!==null&&$!==void 0?$:"";if(Y!==""){if(Y==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(Q==="")this.fail(`unboundnamespaceprefix:${JSON.stringify(Y)}.`),q.uri=Y}}if(I.length===0)return;let{attributes:z}=q,U=new Set;for(let Y of I){let{name:J,prefix:Q,local:w}=Y,K,H;if(Q==="")K=J==="xmlns"?Wz:"",H=J;else{if(K=this.resolve(Q),K===void 0)this.fail(`unboundnamespaceprefix:${JSON.stringify(Q)}.`),K=Q;H=`{${K}}${w}`}if(U.has(H))this.fail(`duplicateattribute:${H}.`);U.add(H),Y.uri=K,z[J]=Y}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,I=this.tag.attributes;for(let{name:q,value:z}of $){if(I[q]!==void 0)this.fail(`duplicateattribute:${q}.`);I[q]=z}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:I}=this,q=this.tag;q.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,q),I.push(q),this.state=S6,this.name=""}openSelfClosingTag(){var $,I,q;this.processAttribs();let{tags:z}=this,U=this.tag;if(U.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,U),(I=this.closeTagHandler)===null||I===void 0||I.call(this,U),(this.tag=(q=z[z.length-1])!==null&&q!==void 0?q:null)===null)this.closedRoot=!0;this.state=S6,this.name=""}closeTag(){let{tags:$,name:I}=this;if(this.state=S6,this.name="",I===""){this.fail("weird empty close tag."),this.text+="</>";return}let q=this.closeTagHandler,z=$.length;while(z-- >0){let U=this.tag=$.pop();if(this.topNS=U.ns,q===null||q===void 0||q(U),U.name===I)break;this.fail("unexpected close tag.")}if(z===0)this.closedRoot=!0;else if(z<0)this.fail(`unmatchedclosingtag:${I}.`),this.text+=`</${I}>`}parseEntity($){if($[0]!=="#"){let q=this.ENTITIES[$];if(q!==void 0)return q;return this.fail(this.isName($)?"undefined entity.":"disallowed character in entity name."),`&${$};`}let I=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))I=parseInt($.slice(2),16);elseif(/^#[0-9]+$/.test($))I=parseInt($.slice(1),10);if(!this.isChar(I))returnthis.fail("malformed character entity."),`&${$};`;returnString.fromCodePoint(I)}}w10.SaxesParser=Q10});varhQ=F((EB1,H10)=>{var{SaxesParser:_p0}=K10(),{PassThrough:hp0}=O6(),{bufferToString:Sp0}=ig();H10.exports=asyncfunction*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(newhp0);letI=new_p0,q;I.on("error",(U)=>{q=U});letz=[];I.on("opentag",(U)=>z.push({eventType:"opentag",value:U})),I.on("text",(U)=>z.push({eventType:"text",value:U})),I.on("closetag",(U)=>z.push({eventType:"closetag",value:U}));forawait(letUof$){if(I.write(Sp0(U)),q)throwq;yieldz,z=[]}}});varL0=F((BB1,G10)=>{varup0=hQ(),yp0=z6();classZz{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,I){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($instanceofZz)$.reset();elseif($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}asyncparse($){forawait(letIof$)for(let{eventType:q,value:z}ofI)if(q==="opentag")this.parseOpen(z);elseif(q==="text")this.parseText(z);elseif(q==="closetag"){if(!this.parseClose(z.name))returnthLine truncated
See:https://github.com/isaacs/node-glob/issues/167`);return new x4($,I).found}function x4($,I){if(!$)throw Error("must provide pattern");if(typeof I==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`+e[H0-1];break}}}var w1="a promise was created in a "+M+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+m;R._warn(w1,!0,N)}}function v0(a,N){var M=a+" is deprecated and will be removed in a future version.";if(N)M+=" Use "+N+" instead.";return Q1(M)}function Q1(a,N,M){if(!B0.warnings)return;var R=new U(a),y;if(N)M._attachExtraTrace(R);else if(B0.longStackTraces&&(y=$._peekContext()))y.attachExtraTrace(R);else{var s=q1(R);R.stack=s.message+`
`+e[H0-1];break}}}var w1="a promise was created in a "+M+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+m;R._warn(w1,!0,N)}}function v0(a,N){var M=a+" is deprecated and will be removed in a future version.";if(N)M+=" Use "+N+" instead.";return Q1(M)}function Q1(a,N,M){if(!j0.warnings)return;var R=new U(a),y;if(N)M._attachExtraTrace(R);else if(j0.longStackTraces&&(y=$._peekContext()))y.attachExtraTrace(R);else{var s=z1(R);R.stack=s.message+`
`)));return}}F=F._target();var P=F._bitField;if((P&50397184)===0)this._yieldedPromise=F,F._proxy(this,null);else if((P&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,F._value());else if((P&16777216)!==0)$._async.invoke(this._promiseRejected,this,F._reason());else this._promiseCancelled()}},$.coroutine=function(X,L){if(typeof X!=="function")throw new Q(`generatorFunctionmustbeafunction
`)));return}}O=O._target();var P=O._bitField;if((P&50397184)===0)this._yieldedPromise=O,O._proxy(this,null);else if((P&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,O._value());else if((P&16777216)!==0)$._async.invoke(this._promiseRejected,this,O._reason());else this._promiseCancelled()}},$.coroutine=function(X,L){if(typeof X!=="function")throw new Q(`generatorFunctionmustbeafunction
Seehttp://goo.gl/MqrFmX
`);var D=Object(L).yieldHandler,F=V,P=Error().stack;return function(){var T=X.apply(this,arguments),A=new F(void 0,void 0,D,P),g=A.promise();return A._generator=T,A._promiseFulfilled(void 0),g}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new Q("expecting a function but got "+w.classString(X));G.push(X)},$.spawn=function(X){if(Y.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return I(`generatorFunctionmustbeafunction
`);var D=Object(L).yieldHandler,O=V,P=Error().stack;return function(){var T=X.apply(this,arguments),A=new O(void 0,void 0,D,P),g=A.promise();return A._generator=T,A._promiseFulfilled(void 0),g}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new Q("expecting a function but got "+w.classString(X));G.push(X)},$.spawn=function(X){if(Y.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return I(`generatorFunctionmustbeafunction
`)},I=function(){return new h.PromiseInspection(this._target())},q=function(j){return h.reject(new G(j))};function z(){}var U={},Y=d1(),J;if(Y.isNode)J=function(){var j=process.domain;if(j===void 0)j=null;return j};else J=function(){return null};Y.notEnumerableProp(h,"_getDomain",J);var Q=o3(),w=z20(),K=new w;Q.defineProperty(h,"_async",{value:K});var H=n5(),G=h.TypeError=H.TypeError;h.RangeError=H.RangeError;var W=h.CancellationError=H.CancellationError;h.TimeoutError=H.TimeoutError,h.OperationalError=H.OperationalError,h.RejectionError=H.OperationalError,h.AggregateError=H.AggregateError;var V=function(){},X={},L={},D=w20()(h,V),F=H20()(h,V,D,q,z),P=W20()(h),T=P.create,A=Z20()(h,P),g=A.CapturedTrace,k=L20()(h,D),S=O20()(L),f=zS(),v=Y.errorObj,p=Y.tryCatch;function b(j,x){if(typeof x!=="function")throw new G("expecting a function but got "+Y.classString(x));if(j.constructor!==h)throw new G(`thepromiseconstructorcannotbeinvokeddirectly
`)},I=function(){return new h.PromiseInspection(this._target())},q=function(B){return h.reject(new G(B))};function z(){}var U={},Y=d1(),J;if(Y.isNode)J=function(){var B=process.domain;if(B===void 0)B=null;return B};else J=function(){return null};Y.notEnumerableProp(h,"_getDomain",J);var Q=t3(),w=H20(),K=new w;Q.defineProperty(h,"_async",{value:K});var H=b5(),G=h.TypeError=H.TypeError;h.RangeError=H.RangeError;var W=h.CancellationError=H.CancellationError;h.TimeoutError=H.TimeoutError,h.OperationalError=H.OperationalError,h.RejectionError=H.OperationalError,h.AggregateError=H.AggregateError;var V=function(){},X={},L={},D=X20()(h,V),O=D20()(h,V,D,q,z),P=F20()(h),T=P.create,A=M20()(h,P),g=A.CapturedTrace,k=P20()(h,D),S=E20()(L),f=YS(),v=Y.errorObj,p=Y.tryCatch;function i(B,x){if(typeof x!=="function")throw new G("expecting a function but got "+Y.classString(x));if(B.constructor!==h)throw new G(`thepromiseconstructorcannotbeinvokeddirectly
Seehttp://goo.gl/MqrFmX
`)}function h(j){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,j!==V)b(this,j),this._resolveFromExecutor(j);this._promiseCreated(),this._fireEvent("promiseCreated",this)}h.prototype.toString=function(){return"[object Promise]"},h.prototype.caught=h.prototype.catch=function(j){var x=arguments.length;if(x>1){var c=Array(x-1),r=0,U0;for(U0=0;U0<x-1;++U0){var G0=arguments[U0];if(Y.isObject(G0))c[r++]=G0;else return q("expecting an object but got A catch statement predicate "+Y.classString(G0))}return c.length=r,j=arguments[U0],this.then(void 0,S(c,j,this))}return this.then(void 0,j)},h.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},h.prototype.then=function(j,x){if(A.warnings()&&arguments.length>0&&typeof j!=="function"&&typeof x!=="function"){var c=".then() only accepts functions but was passed: "+Y.classString(j);if(arguments.length>1)c+=", "+Y.classString(x);this._warn(c)}return this._then(j,x,void 0,void 0,void 0)},h.prototype.done=function(j,x){var c=this._then(j,x,void 0,void 0,void 0);c._setIsFinal()},h.prototype.spread=function(j){if(typeof j!=="function")return q("expecting a function but got "+Y.classString(j));return this.all()._then(j,void 0,void 0,X,void 0)},h.prototype.toJSON=function(){var j={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())j.fulfillmentValue=this.value(),j.isFulfilled=!0;else if(this.isRejected())j.rejectionReason=this.reason(),j.isRejected=!0;return j},h.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new F(this).promise()},h.prototype.error=function(j){return this.caught(Y.originatesFromRejection,j)},h.getNewLibraryCopy=YS.exports,h.is=function(j){return j instanceof h},h.fromNode=h.fromCallback=function(j){var x=new h(V);x._captureStackTrace();var c=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=p(j)(f(x,c));if(r===v)x._rejectCallback(r.e,!0);if(!x._isFateSealed())x._setAsyncGuaranteed();return x},h.all=function(j){return new F(j).promise()},h.cast=function(j){var x=D(j);if(!(x instanceof h))x=new h(V),x._captureStackTrace(),x._setFulfilled(),x._rejectionHandler0=j;return x},h.resolve=h.fulfilled=h.cast,h.reject=h.rejected=function(j){var x=new h(V);return x._captureStackTrace(),x._rejectCallback(j,!0),x},h.setScheduler=function(j){if(typeof j!=="function")throw new G("expecting a function but got "+Y.classString(j));return K.setScheduler(j)},h.prototype._then=function(j,x,c,r,U0){var G0=U0!==void 0,A0=G0?U0:new h(V),v0=this._target(),Q1=v0._bitField;if(!G0){if(A0._propagateFrom(this,3),A0._captureStackTrace(),r===void 0&&(this._bitField&2097152)!==0)if((Q1&50397184)!==0)r=this._boundValue();else r=v0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,A0)}var k0=J();if((Q1&50397184)!==0){var I1,M0,Y0=v0._settlePromiseCtx;if((Q1&33554432)!==0)M0=v0._rejectionHandler0,I1=j;else if((Q1&16777216)!==0)M0=v0._fulfillmentHandler0,I1=x,v0._unsetRejectionIsUnhandled();else Y0=v0._settlePromiseLateCancellationObserver,M0=new W("late cancellation observer"),v0._attachExtraTrace(M0),I1=x;K.invoke(Y0,v0,{handler:k0===null?I1:typeof I1==="function"&&Y.domainBind(k0,I1),promise:A0,receiver:r,value:M0})}else v0._addCallbacks(j,x,A0,r,k0);return A0},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(j){this._bitField=this._bitField&-65536|j&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(K.hasCustomScheduler())return;this._bitField=this._bitField|134217728},h.prototype._receiverAt=function(j){var x=j===0?this._receiver0:this[j*4-4+3];if(x===U)return;else if(x===void 0&&this._isBound())return this._boundValue();return x},h.prototype._promiseAt=function(j){return this[j*4-4+2]},h.prototype._fulfillmentHandlerAt=function(j){return this[j*4-4+0]},h.prototype._rejectionHandlerAt=function(j){return this[j*4-4+1]},h.prototype._boundValue=function(){},h.prototype._migrateCallback0=function(j){var{_bit
Line truncated
`)}function h(B){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,B!==V)i(this,B),this._resolveFromExecutor(B);this._promiseCreated(),this._fireEvent("promiseCreated",this)}h.prototype.toString=function(){return"[object Promise]"},h.prototype.caught=h.prototype.catch=function(B){var x=arguments.length;if(x>1){var c=Array(x-1),r=0,U0;for(U0=0;U0<x-1;++U0){var G0=arguments[U0];if(Y.isObject(G0))c[r++]=G0;else return q("expecting an object but got A catch statement predicate "+Y.classString(G0))}return c.length=r,B=arguments[U0],this.then(void 0,S(c,B,this))}return this.then(void 0,B)},h.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},h.prototype.then=function(B,x){if(A.warnings()&&arguments.length>0&&typeof B!=="function"&&typeof x!=="function"){var c=".then() only accepts functions but was passed: "+Y.classString(B);if(arguments.length>1)c+=", "+Y.classString(x);this._warn(c)}return this._then(B,x,void 0,void 0,void 0)},h.prototype.done=function(B,x){var c=this._then(B,x,void 0,void 0,void 0);c._setIsFinal()},h.prototype.spread=function(B){if(typeof B!=="function")return q("expecting a function but got "+Y.classString(B));return this.all()._then(B,void 0,void 0,X,void 0)},h.prototype.toJSON=function(){var B={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())B.fulfillmentValue=this.value(),B.isFulfilled=!0;else if(this.isRejected())B.rejectionReason=this.reason(),B.isRejected=!0;return B},h.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new O(this).promise()},h.prototype.error=function(B){return this.caught(Y.originatesFromRejection,B)},h.getNewLibraryCopy=QS.exports,h.is=function(B){return B instanceof h},h.fromNode=h.fromCallback=function(B){var x=new h(V);x._captureStackTrace();var c=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=p(B)(f(x,c));if(r===v)x._rejectCallback(r.e,!0);if(!x._isFateSealed())x._setAsyncGuaranteed();return x},h.all=function(B){return new O(B).promise()},h.cast=function(B){var x=D(B);if(!(x instanceof h))x=new h(V),x._captureStackTrace(),x._setFulfilled(),x._rejectionHandler0=B;return x},h.resolve=h.fulfilled=h.cast,h.reject=h.rejected=function(B){var x=new h(V);return x._captureStackTrace(),x._rejectCallback(B,!0),x},h.setScheduler=function(B){if(typeof B!=="function")throw new G("expecting a function but got "+Y.classString(B));return K.setScheduler(B)},h.prototype._then=function(B,x,c,r,U0){var G0=U0!==void 0,A0=G0?U0:new h(V),v0=this._target(),Q1=v0._bitField;if(!G0){if(A0._propagateFrom(this,3),A0._captureStackTrace(),r===void 0&&(this._bitField&2097152)!==0)if((Q1&50397184)!==0)r=this._boundValue();else r=v0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,A0)}var k0=J();if((Q1&50397184)!==0){var q1,M0,Y0=v0._settlePromiseCtx;if((Q1&33554432)!==0)M0=v0._rejectionHandler0,q1=B;else if((Q1&16777216)!==0)M0=v0._fulfillmentHandler0,q1=x,v0._unsetRejectionIsUnhandled();else Y0=v0._settlePromiseLateCancellationObserver,M0=new W("late cancellation observer"),v0._attachExtraTrace(M0),q1=x;K.invoke(Y0,v0,{handler:k0===null?q1:typeof q1==="function"&&Y.domainBind(k0,q1),promise:A0,receiver:r,value:M0})}else v0._addCallbacks(B,x,A0,r,k0);return A0},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(B){this._bitField=this._bitField&-65536|B&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(K.hasCustomScheduler())return;this._bitField=this._bitField|134217728},h.prototype._receiverAt=function(B){var x=B===0?this._receiver0:this[B*4-4+3];if(x===U)return;else if(x===void 0&&this._isBound())return this._boundValue();return x},h.prototype._promiseAt=function(B){return this[B*4-4+2]},h.prototype._fulfillmentHandlerAt=function(B){return this[B*4-4+0]},h.prototype._rejectionHandlerAt=function(B){return this[B*4-4+1]},h.prototype._boundValue=function(){},h.prototype._migrateCallback0=function(B){var{_bit
Line truncated
`).filter((Y)=>Y),z=Math.min(...q.map((Y)=>Y.length-Y.trimStart().length)),U=q.map((Y)=>Y.slice(z)).map((Y)=>" ".repeat(this.indent*2)+Y);for(let Y of U)this.content.push(Y)}compile(){let $=Function,I=this?.args,z=[...(this?.content??[""]).map((U)=>`${U}`)];return new $(...I,z.join(`
`))}}var EF={major:4,minor:4,patch:3};var p0=o("$ZodType",($,I)=>{var q;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=EF;let z=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))z.unshift($);for(let U of z)for(let Y of U._zod.onattach)Y($);if(z.length===0)(q=$._zod).deferred??(q.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let U=(J,Q,w)=>{let K=Y9(J),H;for(let G of Q){if(G._zod.def.when){if(vO(J))continue;if(!G._zod.def.when(J))continue}else if(K)continue;let W=J.issues.length,V=G._zod.check(J);if(V instanceof Promise&&w?.async===!1)throw new L8;if(H||V instanceof Promise)H=(H??Promise.resolve()).then(async()=>{if(await V,J.issues.length===W)return;if(!K)K=Y9(J,W)});else{if(J.issues.length===W)continue;if(!K)K=Y9(J,W)}}if(H)return H.then(()=>{return J});return J},Y=(J,Q,w)=>{if(Y9(J))return J.aborted=!0,J;let K=U(Q,z,w);if(K instanceof Promise){if(w.async===!1)throw new L8;return K.then((H)=>$._zod.parse(H,w))}return $._zod.parse(K,w)};$._zod.run=(J,Q)=>{if(Q.skipChecks)return $._zod.parse(J,Q);if(Q.direction==="backward"){let K=$._zod.parse({value:J.value,issues:[]},{...Q,skipChecks:!0});if(K instanceof Promise)return K.then((H)=>{return Y(H,J,Q)});return Y(K,J,Q)}let w=$._zod.parse(J,Q);if(w instanceof Promise){if(Q.async===!1)throw new L8;return w.then((K)=>U(K,z,Q))}return U(w,z,Q)}}e0($,"~standard",()=>({validate:(U)=>{try{let Y=CI($,U);return Y.success?{value:Y.data}:{issues:Y.error?.issues}}catch(Y){return JY($,U).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),y7=o("$ZodString",($,I)=>{p0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??eO($._zod.bag),$._zod.parse=(q,z)=>{if(I.coerce)try{q.value=String(q.value)}catch(U){}if(typeof q.value==="string")return q;return q.issues.push({expected:"string",code:"invalid_type",input:q.value,inst:$}),q}}),x1=o("$ZodStringFormat",($,I)=>{hI.init($,I),y7.init($,I)}),BF=o("$ZodGUID",($,I)=>{I.pattern??(I.pattern=fO),x1.init($,I)}),gF=o("$ZodUUID",($,I)=>{if(I.version){let z={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(z===void 0)throw Error(`InvalidUUIDversion:"${I.version}"`);I.pattern??(I.pattern=u7(z))}else I.pattern??(I.pattern=u7());x1.init($,I)}),vF=o("$ZodEmail",($,I)=>{I.pattern??(I.pattern=nO),x1.init($,I)}),RF=o("$ZodURL",($,I)=>{x1.init($,I),$._zod.check=(q)=>{try{let z=q.value.trim();if(!I.normalize&&I.protocol?.source===oO.source){if(!/^https?:\/\//i.test(z)){q.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:q.value,inst:$,continue:!I.abort});return}}let U=new URL(z);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(U.hostname))q.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:q.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(U.protocol.endsWith(":")?U.protocol.slice(0,-1):U.protocol))q.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:q.value,inst:$,continue:!I.abort})}if(I.normalize)q.value=U.href;else q.value=z;return}catch(z){q.issues.push({code:"invalid_format",format:"url",input:q.value,inst:$,continue:!I.abort})}}}),CF=o("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=iO()),x1.init($,I)}),_F=o("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=xO),x1.init($,I)}),hF=o("$ZodCUID",($,I)=>{I.pattern??(I.pattern=_O),x1.init($,I)}),SF=o("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=hO),x1.init($,I)}),uF=o("$ZodULID",($,I)=>{I.pattern??(I.pattern=SO),x1.init($,I)}),yF=o("$ZodXID",($,I)=>{I.pattern??(I.pattern=uO),x1.init($,I)}),xF=o("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=yO),x1.init($,I)}),kF=o("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=sO(I)),x1.init($,I)}),fF=o("$ZodISODate",($,I)=>{I.pattern??(I.pattern=tO),x1.init($,I)}),nF=o("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=aO(I)),x1.init($,I)}),iF=o("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=kO),x1.init($,I)}),bF=o("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=bO),x1.init($,I),$._zod.bag.format="ipv4"}),pF=o("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=pO),x1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(q)=>{try{new URL(`http://[${q.value}]`)}catch{q.issues.push({code:"invalid_format",format:"ipv6",input:q.value,inst:$,continue:!I.abort})}}}),cF=o("$ZodMAC",($,I)=>{I.pattern??(I.pattern=cO(I.delimiter)),x1.init($,I),$._zod.bag.format="mac"}),dF=o("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=dO),x1.init($,I)}),mF=o("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=mO),x1.init($,I),$._zod.check=(q)=>{let z=q.value.split("/");try{if(z.length!==2)throw Error();let[U,Y]=z;if(!Y)throw Error();let J=Number(Y);if(`${J}`!==Y)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${U}]`)}catch{q.issues.push({code:"invalid_format",format:"cidrv6",input:q.value,inst:$,continue:!I.abort})}}});function lF($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}
Line truncated
`))}}var jF={major:4,minor:4,patch:3};var p0=o("$ZodType",($,I)=>{var q;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=jF;let z=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))z.unshift($);for(let U of z)for(let Y of U._zod.onattach)Y($);if(z.length===0)(q=$._zod).deferred??(q.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let U=(J,Q,w)=>{let K=Q9(J),H;for(let G of Q){if(G._zod.def.when){if(CO(J))continue;if(!G._zod.def.when(J))continue}else if(K)continue;let W=J.issues.length,V=G._zod.check(J);if(V instanceof Promise&&w?.async===!1)throw new O8;if(H||V instanceof Promise)H=(H??Promise.resolve()).then(async()=>{if(await V,J.issues.length===W)return;if(!K)K=Q9(J,W)});else{if(J.issues.length===W)continue;if(!K)K=Q9(J,W)}}if(H)return H.then(()=>{return J});return J},Y=(J,Q,w)=>{if(Q9(J))return J.aborted=!0,J;let K=U(Q,z,w);if(K instanceof Promise){if(w.async===!1)throw new O8;return K.then((H)=>$._zod.parse(H,w))}return $._zod.parse(K,w)};$._zod.run=(J,Q)=>{if(Q.skipChecks)return $._zod.parse(J,Q);if(Q.direction==="backward"){let K=$._zod.parse({value:J.value,issues:[]},{...Q,skipChecks:!0});if(K instanceof Promise)return K.then((H)=>{return Y(H,J,Q)});return Y(K,J,Q)}let w=$._zod.parse(J,Q);if(w instanceof Promise){if(Q.async===!1)throw new O8;return w.then((K)=>U(K,z,Q))}return U(w,z,Q)}}$1($,"~standard",()=>({validate:(U)=>{try{let Y=SI($,U);return Y.success?{value:Y.data}:{issues:Y.error?.issues}}catch(Y){return KY($,U).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),k7=o("$ZodString",($,I)=>{p0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??IF($._zod.bag),$._zod.parse=(q,z)=>{if(I.coerce)try{q.value=String(q.value)}catch(U){}if(typeof q.value==="string")return q;return q.issues.push({expected:"string",code:"invalid_type",input:q.value,inst:$}),q}}),x1=o("$ZodStringFormat",($,I)=>{yI.init($,I),k7.init($,I)}),vF=o("$ZodGUID",($,I)=>{I.pattern??(I.pattern=bO),x1.init($,I)}),RF=o("$ZodUUID",($,I)=>{if(I.version){let z={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(z===void 0)throw Error(`InvalidUUIDversion:"${I.version}"`);I.pattern??(I.pattern=x7(z))}else I.pattern??(I.pattern=x7());x1.init($,I)}),CF=o("$ZodEmail",($,I)=>{I.pattern??(I.pattern=iO),x1.init($,I)}),_F=o("$ZodURL",($,I)=>{x1.init($,I),$._zod.check=(q)=>{try{let z=q.value.trim();if(!I.normalize&&I.protocol?.source===tO.source){if(!/^https?:\/\//i.test(z)){q.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:q.value,inst:$,continue:!I.abort});return}}let U=new URL(z);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(U.hostname))q.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:q.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(U.protocol.endsWith(":")?U.protocol.slice(0,-1):U.protocol))q.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:q.value,inst:$,continue:!I.abort})}if(I.normalize)q.value=U.href;else q.value=z;return}catch(z){q.issues.push({code:"invalid_format",format:"url",input:q.value,inst:$,continue:!I.abort})}}}),hF=o("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=pO()),x1.init($,I)}),SF=o("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=fO),x1.init($,I)}),uF=o("$ZodCUID",($,I)=>{I.pattern??(I.pattern=SO),x1.init($,I)}),yF=o("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=uO),x1.init($,I)}),xF=o("$ZodULID",($,I)=>{I.pattern??(I.pattern=yO),x1.init($,I)}),kF=o("$ZodXID",($,I)=>{I.pattern??(I.pattern=xO),x1.init($,I)}),fF=o("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=kO),x1.init($,I)}),nF=o("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=$F(I)),x1.init($,I)}),bF=o("$ZodISODate",($,I)=>{I.pattern??(I.pattern=sO),x1.init($,I)}),iF=o("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=eO(I)),x1.init($,I)}),pF=o("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=nO),x1.init($,I)}),cF=o("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=cO),x1.init($,I),$._zod.bag.format="ipv4"}),dF=o("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=dO),x1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(q)=>{try{new URL(`http://[${q.value}]`)}catch{q.issues.push({code:"invalid_format",format:"ipv6",input:q.value,inst:$,continue:!I.abort})}}}),mF=o("$ZodMAC",($,I)=>{I.pattern??(I.pattern=mO(I.delimiter)),x1.init($,I),$._zod.bag.format="mac"}),lF=o("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=lO),x1.init($,I)}),oF=o("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=oO),x1.init($,I),$._zod.check=(q)=>{let z=q.value.split("/");try{if(z.length!==2)throw Error();let[U,Y]=z;if(!Y)throw Error();let J=Number(Y);if(`${J}`!==Y)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${U}]`)}catch{q.issues.push({code:"invalid_format",format:"cidrv6",input:q.value,inst:$,continue:!I.abort})}}});function rF($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}
Line truncated
`)}V.write("payload.value = newResult;"),V.write("return payload;");let P=V.compile();return(T,A)=>P(W,T,A)},Y,J=S7,Q=!_7.jitless,K=Q&&PO.value,H=I.catchall,G;$._zod.parse=(W,V)=>{G??(G=z.value);let X=W.value;if(!J(X))return W.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),W;if(Q&&K&&V?.async===!1&&V.jitless!==!0){if(!Y)Y=U(I.shape);if(W=Y(W,V),!H)return W;return dk([],X,W,V,G,$)}return q(W,V)}});function vk($,I,q,z){for(let Y of $)if(Y.issues.length===0)return I.value=Y.value,I;let U=$.filter((Y)=>!Y9(Y));if(U.length===1)return I.value=U[0].value,U[0];return I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:$.map((Y)=>Y.issues.map((J)=>j6(J,z,X4())))}),I}var GY=o("$ZodUnion",($,I)=>{p0.init($,I),e0($._zod,"optin",()=>I.options.some((z)=>z._zod.optin==="optional")?"optional":void 0),e0($._zod,"optout",()=>I.options.some((z)=>z._zod.optout==="optional")?"optional":void 0),e0($._zod,"values",()=>{if(I.options.every((z)=>z._zod.values))return new Set(I.options.flatMap((z)=>Array.from(z._zod.values)));return}),e0($._zod,"pattern",()=>{if(I.options.every((z)=>z._zod.pattern)){let z=I.options.map((U)=>U._zod.pattern);return new RegExp(`^(${z.map((U)=>aU(U.source)).join("|")})$`)}return});let q=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(z,U)=>{if(q)return q(z,U);let Y=!1,J=[];for(let Q of I.options){let w=Q._zod.run({value:z.value,issues:[]},U);if(w instanceof Promise)J.push(w),Y=!0;else{if(w.issues.length===0)return w;J.push(w)}}if(!Y)return vk(J,z,$,U);return Promise.all(J).then((Q)=>{return vk(Q,z,$,U)})}});function Rk($,I,q,z){let U=$.filter((Y)=>Y.issues.length===0);if(U.length===1)return I.value=U[0].value,I;if(U.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:$.map((Y)=>Y.issues.map((J)=>j6(J,z,X4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:[],inclusive:!1});return I}var GN=o("$ZodXor",($,I)=>{GY.init($,I),I.inclusive=!1;let q=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(z,U)=>{if(q)return q(z,U);let Y=!1,J=[];for(let Q of I.options){let w=Q._zod.run({value:z.value,issues:[]},U);if(w instanceof Promise)J.push(w),Y=!0;else J.push(w)}if(!Y)return Rk(J,z,$,U);return Promise.all(J).then((Q)=>{return Rk(Q,z,$,U)})}}),WN=o("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,GY.init($,I);let q=$._zod.parse;e0($._zod,"propValues",()=>{let U={};for(let Y of I.options){let J=Y._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(Y)}"`);for(let[Q,w]of Object.entries(J)){if(!U[Q])U[Q]=new Set;for(let K of w)U[Q].add(K)}}return U});let z=jI(()=>{let U=I.options,Y=new Map;for(let J of U){let Q=J._zod.propValues?.[I.discriminator];if(!Q||Q.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(J)}"`);for(let w of Q){if(Y.has(w))throw Error(`Duplicatediscriminatorvalue"${String(w)}"`);Y.set(w,J)}}return Y});$._zod.parse=(U,Y)=>{let J=U.value;if(!S7(J))return U.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),U;let Q=z.value.get(J?.[I.discriminator]);if(Q)return Q._zod.run(U,Y);if(I.unionFallback||Y.direction==="backward")return q(U,Y);return U.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(z.value.keys()),input:J,path:[I.discriminator],inst:$}),U}}),VN=o("$ZodIntersection",($,I)=>{p0.init($,I),$._zod.parse=(q,z)=>{let U=q.value,Y=I.left._zod.run({value:U,issues:[]},z),J=I.right._zod.run({value:U,issues:[]},z);if(Y instanceof Promise||J instanceof Promise)return Promise.all([Y,J]).then(([w,K])=>{return Ck(q,w,K)});return Ck(q,Y,J)}});function jF($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if(U9($)&&U9(I)){let q=Object.keys(I),z=Object.keys($).filter((Y)=>q.indexOf(Y)!==-1),U={...$,...I};for(let Y of z){let J=jF($[Y],I[Y]);if(!J.valid)return{valid:!1,mergeErrorPath:[Y,...J.mergeErrorPath]};U[Y]=J.data}return{valid:!0,data:U}}if(Array.isArray($)&&Array.isArray(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let q=[];for(let z=0;z<$.length;z++){let U=$[z],Y=I[z],J=jF(U,Y);if(!J.valid)return{valid:!1,mergeErrorPath:[z,...J.mergeErrorPath]};q.push(J.data)}return{valid:!0,data:q}}return{valid:!1,mergeErrorPath:[]}}function Ck($,I,q){let z=new Map,U;for(let Q of I.issues)if(Q.code==="unrecognized_keys"){U??(U=Q);for(let w of Q.keys){if(!z.has(w))z.set(w,{});z.get(w).l=!0}}else $.issues.push(Q);for(let Q of q.issues)if(Q.code==="unrecognized_keys")for(let w of Q.keys){if(!z.has(w))z.set(w,{});z.get(w).r=!0}else $.issues.push(Q);let Y=[...z].filter(([,Q])=>Q.l&&Q.r).map(([Q])=>Q);if(Y.length&&U)$.issues.push({...U,keys:Y});if(Y9($))return $;let J=jF(I.value,q.value);if(!J.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}var BK=o("$ZodTuple",($,I)=>{p0.
Line truncated
`)}V.write("payload.value = newResult;"),V.write("return payload;");let P=V.compile();return(T,A)=>P(W,T,A)},Y,J=y7,Q=!S7.jitless,K=Q&&EO.value,H=I.catchall,G;$._zod.parse=(W,V)=>{G??(G=z.value);let X=W.value;if(!J(X))return W.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),W;if(Q&&K&&V?.async===!1&&V.jitless!==!0){if(!Y)Y=U(I.shape);if(W=Y(W,V),!H)return W;return sk([],X,W,V,G,$)}return q(W,V)}});function yk($,I,q,z){for(let Y of $)if(Y.issues.length===0)return I.value=Y.value,I;let U=$.filter((Y)=>!Q9(Y));if(U.length===1)return I.value=U[0].value,U[0];return I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:$.map((Y)=>Y.issues.map((J)=>B6(J,z,L4())))}),I}var ZY=o("$ZodUnion",($,I)=>{p0.init($,I),$1($._zod,"optin",()=>I.options.some((z)=>z._zod.optin==="optional")?"optional":void 0),$1($._zod,"optout",()=>I.options.some((z)=>z._zod.optout==="optional")?"optional":void 0),$1($._zod,"values",()=>{if(I.options.every((z)=>z._zod.values))return new Set(I.options.flatMap((z)=>Array.from(z._zod.values)));return}),$1($._zod,"pattern",()=>{if(I.options.every((z)=>z._zod.pattern)){let z=I.options.map((U)=>U._zod.pattern);return new RegExp(`^(${z.map((U)=>$Y(U.source)).join("|")})$`)}return});let q=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(z,U)=>{if(q)return q(z,U);let Y=!1,J=[];for(let Q of I.options){let w=Q._zod.run({value:z.value,issues:[]},U);if(w instanceof Promise)J.push(w),Y=!0;else{if(w.issues.length===0)return w;J.push(w)}}if(!Y)return yk(J,z,$,U);return Promise.all(J).then((Q)=>{return yk(Q,z,$,U)})}});function xk($,I,q,z){let U=$.filter((Y)=>Y.issues.length===0);if(U.length===1)return I.value=U[0].value,I;if(U.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:$.map((Y)=>Y.issues.map((J)=>B6(J,z,L4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:[],inclusive:!1});return I}var VN=o("$ZodXor",($,I)=>{ZY.init($,I),I.inclusive=!1;let q=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(z,U)=>{if(q)return q(z,U);let Y=!1,J=[];for(let Q of I.options){let w=Q._zod.run({value:z.value,issues:[]},U);if(w instanceof Promise)J.push(w),Y=!0;else J.push(w)}if(!Y)return xk(J,z,$,U);return Promise.all(J).then((Q)=>{return xk(Q,z,$,U)})}}),ZN=o("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,ZY.init($,I);let q=$._zod.parse;$1($._zod,"propValues",()=>{let U={};for(let Y of I.options){let J=Y._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(Y)}"`);for(let[Q,w]of Object.entries(J)){if(!U[Q])U[Q]=new Set;for(let K of w)U[Q].add(K)}}return U});let z=vI(()=>{let U=I.options,Y=new Map;for(let J of U){let Q=J._zod.propValues?.[I.discriminator];if(!Q||Q.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(J)}"`);for(let w of Q){if(Y.has(w))throw Error(`Duplicatediscriminatorvalue"${String(w)}"`);Y.set(w,J)}}return Y});$._zod.parse=(U,Y)=>{let J=U.value;if(!y7(J))return U.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),U;let Q=z.value.get(J?.[I.discriminator]);if(Q)return Q._zod.run(U,Y);if(I.unionFallback||Y.direction==="backward")return q(U,Y);return U.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(z.value.keys()),input:J,path:[I.discriminator],inst:$}),U}}),XN=o("$ZodIntersection",($,I)=>{p0.init($,I),$._zod.parse=(q,z)=>{let U=q.value,Y=I.left._zod.run({value:U,issues:[]},z),J=I.right._zod.run({value:U,issues:[]},z);if(Y instanceof Promise||J instanceof Promise)return Promise.all([Y,J]).then(([w,K])=>{return kk(q,w,K)});return kk(q,Y,J)}});function gF($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if(J9($)&&J9(I)){let q=Object.keys(I),z=Object.keys($).filter((Y)=>q.indexOf(Y)!==-1),U={...$,...I};for(let Y of z){let J=gF($[Y],I[Y]);if(!J.valid)return{valid:!1,mergeErrorPath:[Y,...J.mergeErrorPath]};U[Y]=J.data}return{valid:!0,data:U}}if(Array.isArray($)&&Array.isArray(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let q=[];for(let z=0;z<$.length;z++){let U=$[z],Y=I[z],J=gF(U,Y);if(!J.valid)return{valid:!1,mergeErrorPath:[z,...J.mergeErrorPath]};q.push(J.data)}return{valid:!0,data:q}}return{valid:!1,mergeErrorPath:[]}}function kk($,I,q){let z=new Map,U;for(let Q of I.issues)if(Q.code==="unrecognized_keys"){U??(U=Q);for(let w of Q.keys){if(!z.has(w))z.set(w,{});z.get(w).l=!0}}else $.issues.push(Q);for(let Q of q.issues)if(Q.code==="unrecognized_keys")for(let w of Q.keys){if(!z.has(w))z.set(w,{});z.get(w).r=!0}else $.issues.push(Q);let Y=[...z].filter(([,Q])=>Q.l&&Q.r).map(([Q])=>Q);if(Y.length&&U)$.issues.push({...U,keys:Y});if(Q9($))return $;let J=gF(I.value,q.value);if(!J.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}var vK=o("$ZodTuple",($,I)=>{p0.
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letJof$.seen.entries()){letQ=J[1];if(I===J[0]){Y(J);continue}if($.external){letK=$.external.registry.get(J[0])?.id;if(I!==J[0]&&K){Y(J);continue}}if($.metadataRegistry.get(J[0])?.id){Y(J);continue}if(Q.cycle){Y(J);continue}if(Q.count>1){if($.reused==="ref"){Y(J);continue}}}}functionH9($,I){letq=$.seen.get(I);if(!q)throwError("Unprocessed schema. This is a bug in Zod.");letz=(Q)=>{letw=$.seen.get(Q);if(w.ref===null)return;letK=w.def??w.schema,H={...K},G=w.ref;if(w.ref=null,G){z(G);letV=$.seen.get(G),X=V.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))K.allOf=K.allOf??[],K.allOf.push(X);elseObject.assign(K,X);if(Object.assign(K,H),Q._zod.parent===G)for(letDinK){if(D==="$ref"||D==="allOf")continue;if(!(DinH))deleteK[D]}if(X.$ref&&V.def)for(letDinK){if(D==="$ref"||D==="allOf")continue;if(DinV.def&&JSON.stringify(K[D])===JSON.stringify(V.def[D]))deleteK[D]}}letW=Q._zod.parent;if(W&&W!==G){z(W);letV=$.seen.get(W);if(V?.schema.$ref){if(K.$ref=V.schema.$ref,V.def)for(letXinK){if(X==="$ref"||X==="allOf")continue;if(XinV.def&&JSON.stringify(K[X])===JSON.stringify(V.def[X]))deleteK[X]}}}$.override({zodSchema:Q,jsonSchema:K,path:w.path??[]})};for(letQof[...$.seen.entries()].reverse())z(Q[0]);letU={};if($.target==="draft-2020-12")U.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")U.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")U.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letQ=$.external.registry.get(I)?.id;if(!Q)throwError("Schema is missing an `id` property");U.$id=$.external.uri(Q)}Object.assign(U,q.def??q.schema);letY=$.metadataRegistry.get(I)?.id;if(Y!==void0&&U.id===Y)deleteU.id;letJ=$.external?.defs??{};for(letQof$.seen.entries()){letw=Q[1];if(w.def&&w.defId){if(w.def.id===w.defId)deletew.def.id;J[w.defId]=w.def}}if($.external);elseif(Object.keys(J).length>0)if($.target==="draft-2020-12")U.$defs=J;elseU.definitions=J;try{letQ=JSON.parse(JSON.stringify(U));returnObject.defineProperty(Q,"~standard",{value:{...I["~standard"],jsonSchema:{input:oI(I,"input",$.processors),output:oI(I,"output",$.processors)}},enumerable:!1,writable:!1}),Q}catch(Q){throwError("Error converting schema to JSON.")}}functiong6($,I){letq=I??{seen:newSet};if(q.seen.has($))return!1;q.seen.add($);letz=$._zod.def;if(z.type==="transform")return!0;if(z.type==="array")returng6(z.element,q);if(z.type==="set")returng6(z.valueType,q);if(z.type==="lazy")returng6(z.getter(),q);if(z.type==="promise"||z.type==="optional"||z.type==="nonoptional"||z.type==="nullable"||z.type==="readonly"||z.type==="default"||z.type==="prefault")returng6(z.innerType,q);if(z.type==="intersection")returng6(z.left,q)||g6(z.right,q);if(z.type==="record"||z.type==="map")returng6(z.keyType,q)||g6(z.valueType,q);if(z.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returng6(z.in,q)||g6(z.out,q)}if(z.type==="object"){for(letUinz.shape)if(g6(z.shape[U],q))return!0;return!1}if(z.type==="union"){for(letUofz.options)if(g6(U,q))return!0;return!1}if(z.type==="tuple"){for(letUofz.items)if(g6(U,q))return!0;if(z.rest&&g6(z.rest,q))return!0;return!1}return!1}varFA=($,I={})=>(q)=>{letz=w9({...q,processors:I});returnh1($,z),K9(z,$),H9(z,$)},oI=($,I,q={})=>(z)=>{let{libraryOptions:U,target:Y}=z??{},J=w9({...U??{},target:Y,io:I,processors:q});returnh1($,J),K9(J,$),H9(J,$)};varPN0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},NA=($,I,q,z)=>{letU=q;U.type="string";let{minimum:Y,maximum:J,format:Q,patterns:w,contentEncoding:K}=$._zod.bag;if(typeofY==="number")U.minLength=Y;if(typeofJ==="number")U.maxLength=J;if(Q){if(U.format=PN0[Q]??Q,U.format==="")deleteU.format;if(Q==="time")deleteU.format}if(K)U.contentEncoding=K;if(w&&w.size>0){letH=[...w];if(H.length===1)U.pattern=H[0].source;elseif(H.length>1)U.allOf=[...H.map((G)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:G.source}))]}},MA=($,I,q,z)=>{letU=q,{minimum:Y,maximum:J,format:Q,multipleOf:w,exclusiveMaximum:K,exclusiveMinimum:H}=$._zod.bag;if(typeofQ==="string"&&Q.includes("int"))U.type="integer";elseU.type="number";letG=typeofH==="number"&&H>=(Y??Number.NEGATIVE_INFINITY),W=typeofK==="number"&&K<=(J??Number.POSITIVE_INFINITY),V=I.target==="draft-04"||I.target==="openapi-3.0";if(G)if(V)U.minimum=H,U.exclusiveMinimum=!0;elseU.exclusiveMinimum=H;elseif(typeofY==="number")U.minimum=Y;if(W)if(V)U.maximum=K,U.exclusiveMaximum=!0;elseU.exclusiveMaximum=K;elseif(typeofJ==="number")U.maximum=J;if(typeofw==="number")U.multipleOf=w},AA=($,I,q,z)=>{q.type="boolean"},PA=($,I,q,z)=>{if(I.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},TA=($,I,q,z)=>{if(I.unrepresentable==Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letJof$.seen.entries()){letQ=J[1];if(I===J[0]){Y(J);continue}if($.external){letK=$.external.registry.get(J[0])?.id;if(I!==J[0]&&K){Y(J);continue}}if($.metadataRegistry.get(J[0])?.id){Y(J);continue}if(Q.cycle){Y(J);continue}if(Q.count>1){if($.reused==="ref"){Y(J);continue}}}}functionW9($,I){letq=$.seen.get(I);if(!q)throwError("Unprocessed schema. This is a bug in Zod.");letz=(Q)=>{letw=$.seen.get(Q);if(w.ref===null)return;letK=w.def??w.schema,H={...K},G=w.ref;if(w.ref=null,G){z(G);letV=$.seen.get(G),X=V.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))K.allOf=K.allOf??[],K.allOf.push(X);elseObject.assign(K,X);if(Object.assign(K,H),Q._zod.parent===G)for(letDinK){if(D==="$ref"||D==="allOf")continue;if(!(DinH))deleteK[D]}if(X.$ref&&V.def)for(letDinK){if(D==="$ref"||D==="allOf")continue;if(DinV.def&&JSON.stringify(K[D])===JSON.stringify(V.def[D]))deleteK[D]}}letW=Q._zod.parent;if(W&&W!==G){z(W);letV=$.seen.get(W);if(V?.schema.$ref){if(K.$ref=V.schema.$ref,V.def)for(letXinK){if(X==="$ref"||X==="allOf")continue;if(XinV.def&&JSON.stringify(K[X])===JSON.stringify(V.def[X]))deleteK[X]}}}$.override({zodSchema:Q,jsonSchema:K,path:w.path??[]})};for(letQof[...$.seen.entries()].reverse())z(Q[0]);letU={};if($.target==="draft-2020-12")U.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")U.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")U.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letQ=$.external.registry.get(I)?.id;if(!Q)throwError("Schema is missing an `id` property");U.$id=$.external.uri(Q)}Object.assign(U,q.def??q.schema);letY=$.metadataRegistry.get(I)?.id;if(Y!==void0&&U.id===Y)deleteU.id;letJ=$.external?.defs??{};for(letQof$.seen.entries()){letw=Q[1];if(w.def&&w.defId){if(w.def.id===w.defId)deletew.def.id;J[w.defId]=w.def}}if($.external);elseif(Object.keys(J).length>0)if($.target==="draft-2020-12")U.$defs=J;elseU.definitions=J;try{letQ=JSON.parse(JSON.stringify(U));returnObject.defineProperty(Q,"~standard",{value:{...I["~standard"],jsonSchema:{input:aI(I,"input",$.processors),output:aI(I,"output",$.processors)}},enumerable:!1,writable:!1}),Q}catch(Q){throwError("Error converting schema to JSON.")}}functiong6($,I){letq=I??{seen:newSet};if(q.seen.has($))return!1;q.seen.add($);letz=$._zod.def;if(z.type==="transform")return!0;if(z.type==="array")returng6(z.element,q);if(z.type==="set")returng6(z.valueType,q);if(z.type==="lazy")returng6(z.getter(),q);if(z.type==="promise"||z.type==="optional"||z.type==="nonoptional"||z.type==="nullable"||z.type==="readonly"||z.type==="default"||z.type==="prefault")returng6(z.innerType,q);if(z.type==="intersection")returng6(z.left,q)||g6(z.right,q);if(z.type==="record"||z.type==="map")returng6(z.keyType,q)||g6(z.valueType,q);if(z.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returng6(z.in,q)||g6(z.out,q)}if(z.type==="object"){for(letUinz.shape)if(g6(z.shape[U],q))return!0;return!1}if(z.type==="union"){for(letUofz.options)if(g6(U,q))return!0;return!1}if(z.type==="tuple"){for(letUofz.items)if(g6(U,q))return!0;if(z.rest&&g6(z.rest,q))return!0;return!1}return!1}varMA=($,I={})=>(q)=>{letz=H9({...q,processors:I});returnh1($,z),G9(z,$),W9(z,$)},aI=($,I,q={})=>(z)=>{let{libraryOptions:U,target:Y}=z??{},J=H9({...U??{},target:Y,io:I,processors:q});returnh1($,J),G9(J,$),W9(J,$)};varSN0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},AA=($,I,q,z)=>{letU=q;U.type="string";let{minimum:Y,maximum:J,format:Q,patterns:w,contentEncoding:K}=$._zod.bag;if(typeofY==="number")U.minLength=Y;if(typeofJ==="number")U.maxLength=J;if(Q){if(U.format=SN0[Q]??Q,U.format==="")deleteU.format;if(Q==="time")deleteU.format}if(K)U.contentEncoding=K;if(w&&w.size>0){letH=[...w];if(H.length===1)U.pattern=H[0].source;elseif(H.length>1)U.allOf=[...H.map((G)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:G.source}))]}},PA=($,I,q,z)=>{letU=q,{minimum:Y,maximum:J,format:Q,multipleOf:w,exclusiveMaximum:K,exclusiveMinimum:H}=$._zod.bag;if(typeofQ==="string"&&Q.includes("int"))U.type="integer";elseU.type="number";letG=typeofH==="number"&&H>=(Y??Number.NEGATIVE_INFINITY),W=typeofK==="number"&&K<=(J??Number.POSITIVE_INFINITY),V=I.target==="draft-04"||I.target==="openapi-3.0";if(G)if(V)U.minimum=H,U.exclusiveMinimum=!0;elseU.exclusiveMinimum=H;elseif(typeofY==="number")U.minimum=Y;if(W)if(V)U.maximum=K,U.exclusiveMaximum=!0;elseU.exclusiveMaximum=K;elseif(typeofJ==="number")U.maximum=J;if(typeofw==="number")U.multipleOf=w},TA=($,I,q,z)=>{q.type="boolean"},EA=($,I,q,z)=>{if(I.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},BA=($,I,q,z)=>{if(I.unrepresentable==Line truncated
`)}return{warnings:[],results:J}}function XI($){return{fileBuffer:$H1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}import{existsSync as UH1}from"node:fs";async function _D($,I,q={}){let U=F4().stateful?"stateful":"stateless",Y="ok",J,Q,w;try{let A=await H$($);w={id:A.user.id,name:A.user.name,isAdmin:A.user.isAdmin},Q={id:A.tenant.id,name:A.tenant.name,tenantSlug:A.tenant.tenantSlug,corporationName:A.tenant.hoseCorpConfig?.corporationName}}catch(A){Y="error",J=A instanceof Error?A.message:String(A)}let K=[];if(Y==="ok")try{K=await Z5($,I.seal.endpoints.approvalStylePreferences)}catch(A){Y="error",J=`读取Webhook配置失败:${AinstanceofError?A.message:String(A)}`}let H=K.length===1,G=K.map((A)=>({id:A.id,name:A.name,mode:A.mode,incomingDocumentWebhookUrl:A.incomingDocumentWebhook.url,outgoingResultWebhookUrl:A.outgoingResultWebhook,autoApprovalRate:A.autoApprovalRate,...H?{isDefault:!0}:{}})),W=H?{id:K[0].id,name:K[0].name,mode:K[0].mode}:null,V=q.webhook?E9(K,q.webhook):H?K[0]:void 0,X;if(q.filePath)if(!UH1(q.filePath))X={valid:!1,filePath:q.filePath,fileName:q.filePath.split(/[\\/]/).pop()??q.filePath,documentCount:0,errors:[`文件不存在:${q.filePath}`]};else try{let A=XI(q.filePath),g=await ZI(A.fileBuffer,A.fileName,V?.materialPackFilePolicy);X={valid:!0,filePath:q.filePath,fileName:A.fileName,documentCount:g.documents.length,warnings:g.warnings}}catch(A){X={valid:!1,filePath:q.filePath,fileName:q.filePath.split(/[\\/]/).pop()??q.filePath,documentCount:0,errors:[A instanceof Error?A.message:String(A)]}}let L=X?X.valid:!0,D=Y==="ok"&&G.length>0&&L,F=U==="stateful"?"":`--corp${I.id}`,P="",T="";if(Y!=="ok")T=`凭证鉴权异常:${J}`,P=`seal-useauthdiagnose${F}`;else if(G.length===0)T="当前企业尚未配置任何 Webhook 集成通道",P=`seal-usewebhookadd--name"默认入站通道"--result-url"https://your-domain.com/callback"${F}`;else if(X&&!X.valid)T=`材料包预检失败:${X.errors?.join("; ")}`,P=`seal-usewebhookmaterial-packpreview${X.filePath}${F}`;else{T=H?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到${G.length}个Webhook通道,等待载入`;let A=X?.filePath??"<材料包.zip>",g=H?"":`--webhook${W?W.id:"<webhookIdOrName>"}`;P=`seal-usewebhookmaterial-packpush${A}${g}${F}`}return{ready:D,corp:{id:I.id,name:I.name,sourceType:I.source.type,tenant:Q,user:w},stateMode:U,authStatus:Y,authError:J,activeWebhooks:G,defaultWebhook:W,materialPack:X,statusMessage:T,nextAction:P}}var Tw=[{name:"seal_whoami",description:"查询当前 Seal 用户身份及租户信息",parameters:Z.object({}),handler:async($)=>H$($)},{name:"seal_session_get",description:"查询当前 Seal Bearer session、用户和过期时间",parameters:Z.object({}),handler:async($)=>om($)},{name:"seal_delegation_list",description:"查询当前 Seal 租户下的授权链接 (Delegation) 列表",parameters:Z.object({}),handler:async($)=>Dl($)},{name:"seal_delegation_create",description:"创建新的 Seal 授权链接 (Delegation)",parameters:Z.object({note:Z.string().optional().describe("授权链接的备注或说明信息")}),handler:async($,I)=>vq($,I)},{name:"seal_delegation_revoke",description:"撤销/废除指定的 Seal 授权链接 (Delegation)",parameters:Z.object({tokenId:Z.string().describe("授权链接 ID (delegation record ID)")}),handler:async($,I)=>Ol($,I.tokenId)},{name:"seal_user_create",description:"创建本地 Seal 用户,生成并返回初始随机密码",parameters:Z.object({name:Z.string().describe("用户姓名"),phone:Z.string().describe("手机号码 (例如 13300001111 或 +8613300001111)"),permissions:Z.array(Z.string()).optional().describe("权限列表,默认为 []"),departmentIds:Z.array(Z.string()).optional().describe("关联部门 ID 数组")}),handler:async($,I)=>Fl($,I)},{name:"seal_user_reset_password",description:"重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>Dj($,I.userId)},{name:"seal_user_get",description:"获取指定 Seal 用户的详细信息",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>IW($,I.userId)},{name:"seal_user_search",description:"按姓名、手机号或邮箱搜索 Seal 成员用户列表",parameters:Z.object({keyword:Z.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")}),handler:async($,I)=>qW($,I.keyword??"")},{name:"seal_user_delete",description:"删除指定 Seal 本地用户",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>Rl($,I.userId)},{name:"seal_user_activate",description:"启用/激活已离职的 Seal 用户账号",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>Oj($,I.userId)},{name:"seal_user_delegation_create",description:"为指定 S
Line truncated
`)}return{warnings:[],results:J}}function DI($){return{fileBuffer:GH1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}import{existsSync as XH1}from"node:fs";async function SD($,I,q={}){let U=K4().stateful?"stateful":"stateless",Y="ok",J,Q,w;try{let A=await H$($);w={id:A.user.id,name:A.user.name,isAdmin:A.user.isAdmin},Q={id:A.tenant.id,name:A.tenant.name,tenantSlug:A.tenant.tenantSlug,corporationName:A.tenant.hoseCorpConfig?.corporationName}}catch(A){Y="error",J=A instanceof Error?A.message:String(A)}let K=[];if(Y==="ok")try{K=await X5($,I.seal.endpoints.approvalStylePreferences)}catch(A){Y="error",J=`读取Webhook配置失败:${AinstanceofError?A.message:String(A)}`}let H=K.length===1,G=K.map((A)=>({id:A.id,name:A.name,mode:A.mode,incomingDocumentWebhookUrl:A.incomingDocumentWebhook.url,outgoingResultWebhookUrl:A.outgoingResultWebhook,autoApprovalRate:A.autoApprovalRate,...H?{isDefault:!0}:{}})),W=H?{id:K[0].id,name:K[0].name,mode:K[0].mode}:null,V=q.webhook?j9(K,q.webhook):H?K[0]:void 0,X;if(q.filePath)if(!XH1(q.filePath))X={valid:!1,filePath:q.filePath,fileName:q.filePath.split(/[\\/]/).pop()??q.filePath,documentCount:0,errors:[`文件不存在:${q.filePath}`]};else try{let A=DI(q.filePath),g=await LI(A.fileBuffer,A.fileName,V?.materialPackFilePolicy);X={valid:!0,filePath:q.filePath,fileName:A.fileName,documentCount:g.documents.length,warnings:g.warnings}}catch(A){X={valid:!1,filePath:q.filePath,fileName:q.filePath.split(/[\\/]/).pop()??q.filePath,documentCount:0,errors:[A instanceof Error?A.message:String(A)]}}let L=X?X.valid:!0,D=Y==="ok"&&G.length>0&&L,O=U==="stateful"?"":`--corp${I.id}`,P="",T="";if(Y!=="ok")T=`凭证鉴权异常:${J}`,P=`seal-useauthdiagnose${O}`;else if(G.length===0)T="当前企业尚未配置任何 Webhook 集成通道",P=`seal-usewebhookadd--name"默认入站通道"--result-url"https://your-domain.com/callback"${O}`;else if(X&&!X.valid)T=`材料包预检失败:${X.errors?.join("; ")}`,P=`seal-usewebhookmaterial-packpreview${X.filePath}${O}`;else{T=H?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到${G.length}个Webhook通道,等待载入`;let A=X?.filePath??"<材料包.zip>",g=H?"":`--webhook${W?W.id:"<webhookIdOrName>"}`;P=`seal-usewebhookmaterial-packpush${A}${g}${O}`}return{ready:D,corp:{id:I.id,name:I.name,sourceType:I.source.type,tenant:Q,user:w},stateMode:U,authStatus:Y,authError:J,activeWebhooks:G,defaultWebhook:W,materialPack:X,statusMessage:T,nextAction:P}}var jw=[{name:"seal_whoami",description:"查询当前 Seal 用户身份及租户信息",parameters:Z.object({}),handler:async($)=>H$($)},{name:"seal_session_get",description:"查询当前 Seal Bearer session、用户和过期时间",parameters:Z.object({}),handler:async($)=>Il($)},{name:"seal_delegation_list",description:"查询当前 Seal 租户下的授权链接 (Delegation) 列表",parameters:Z.object({}),handler:async($)=>Tl($)},{name:"seal_delegation_create",description:"创建新的 Seal 授权链接 (Delegation)",parameters:Z.object({note:Z.string().optional().describe("授权链接的备注或说明信息")}),handler:async($,I)=>_q($,I)},{name:"seal_delegation_revoke",description:"撤销/废除指定的 Seal 授权链接 (Delegation)",parameters:Z.object({tokenId:Z.string().describe("授权链接 ID (delegation record ID)")}),handler:async($,I)=>El($,I.tokenId)},{name:"seal_user_create",description:"创建本地 Seal 用户,生成并返回初始随机密码",parameters:Z.object({name:Z.string().describe("用户姓名"),phone:Z.string().describe("手机号码 (例如 13300001111 或 +8613300001111)"),permissions:Z.array(Z.string()).optional().describe("权限列表,默认为 []"),departmentIds:Z.array(Z.string()).optional().describe("关联部门 ID 数组")}),handler:async($,I)=>Bl($,I)},{name:"seal_user_reset_password",description:"重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>FB($,I.userId)},{name:"seal_user_get",description:"获取指定 Seal 用户的详细信息",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>zW($,I.userId)},{name:"seal_user_search",description:"按姓名、手机号或邮箱搜索 Seal 成员用户列表",parameters:Z.object({keyword:Z.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")}),handler:async($,I)=>UW($,I.keyword??"")},{name:"seal_user_delete",description:"删除指定 Seal 本地用户",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>xl($,I.userId)},{name:"seal_user_activate",description:"启用/激活已离职的 Seal 用户账号",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>NB($,I.userId)},{name:"seal_user_delegation_create",description:"为指定 S
Line truncated
`)}function kH1($){let I=[];if(I.push(`seal-use${$.area}-${$.title}`),$.description)I.push($.description);I.push(""),I.push("Usage:");for(let q of $.commands)for(let z of q.usage)I.push(`${z}`);if($.commands.some((q)=>q.name))I.push(""),I.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return I.join(`
`)}function BZ0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let I of gZ0)for(let q of I.commands)for(let z of q.usage)$.push(`${z}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}function rH1($){let I=[];if(I.push(`seal-use${$.area}-${$.title}`),$.description)I.push($.description);I.push(""),I.push("Usage:");for(let q of $.commands)for(let z of q.usage)I.push(`${z}`);if($.commands.some((q)=>q.name))I.push(""),I.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return I.join(`
`)}function SZ0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let I of uZ0)for(let q of I.commands)for(let z of q.usage)$.push(`${z}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let W of G){let V=W.outboundName??"SealAI 审批",X=W.signKey,L=W.apiOrigin??"production";console.error(`•"${V}"(signKey:${X},环境:${L})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${X}--corp${U.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of W){let L=X.outboundName??"SealAI 审批",D=X.signKey,F=X.apiOrigin??"production";console.error(`•"${L}"(signKey:${D},环境:${F})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${D}--corp${U.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of W){let L=X.outboundName??"SealAI 审批",D=X.signKey,O=X.apiOrigin??"production";console.error(`•"${L}"(signKey:${D},环境:${O})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${D}--corp${U.id}
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],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",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",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",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",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 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:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",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:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",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:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{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:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",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:{"2
Line truncated
`);U(z)})})}async function FL0($){let I=b0($.options.port)??b0($.options.p),q=C($.options.host)??C($.options.h),z=await zO({port:I,host:q}),U=()=>{z.close(()=>{process.exit(0)})};process.on("SIGINT",U),process.on("SIGTERM",U),await new Promise(()=>{})}async function NL0($,I,q,z){if($==="config"||$==="get"){await F0("seal_llm_config_get",I,q,{},W0(z.options));return}if($==="providers"||$==="list"){await F0("seal_llm_providers_list",I,q,{},W0(z.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function ML0($,I){if($==="config"||$==="json"){Kx();return}await Hx()}function Kx(){E0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function AL0($){let I=sD();E0(I,{...W0($.options),allowFull:!0})}async function PL0($,I,q,z){if($==="available"){await F0("seal_permissions_available_list",I,q,{},W0(z.options));return}if($==="configs"||$==="list"){await F0("seal_permissions_configs_list",I,q,{},W0(z.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as TL0}from"node:fs";async function EL0($,I,q,z,U,Y,J){if(!$||$==="get"){await F0("seal_preference_get",U,Y,{},W0(J.options));return}if($==="decision"){if(I==="update"||!I){let Q=C(J.options.input),w=Q?JSON.parse(TL0(Q,"utf8")):z$(J.json);if(!w||Object.keys(w).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await F0("seal_preference_decision_update",U,Y,{...w,dryRun:O0(J.options.dryRun)??O0(J.options["dry-run"])},W0(J.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(I==="set"){let Q=C(J.options.default)??C(J.options.level)??z;if(Q!=="medium"&&Q!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await F0("seal_preference_thinking_depth_set",U,Y,{defaultLevel:Q,dryRun:O0(J.options.dryRun)??O0(J.options["dry-run"])},W0(J.options));return}if(I==="policies"){if(q==="list"||!q){await F0("seal_preference_thinking_depth_policies_list",U,Y,{},W0(J.options));return}if(q==="upsert"){let Q=C(J.options.input),w=Q?JSON.parse(TL0(Q,"utf8")):z$(J.json);if(!w||!w.id||!w.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await F0("seal_preference_thinking_depth_policies_upsert",U,Y,{...w,dryRun:O0(J.options.dryRun)??O0(J.options["dry-run"])},W0(J.options));return}if(q==="remove"||q==="delete"){let Q=z??C(J.options.id)??C(J.options.policyId);if(!Q)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await F0("seal_preference_thinking_depth_policies_remove",U,Y,{policyId:Q,dryRun:O0(J.options.dryRun)??O0(J.options["dry-run"])},W0(J.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function jL0($={}){let I=a8(),q=F4(),z=jU(I,{stateful:q.stateful,defaultCorpId:q.defaultCorpId,corpId:$.corpId},wI());console.log(`[probe]corp=${z.id}source=${z.source.type}`);let U=await fU(z);console.log("[probe] seal enterprise"),console.log(JSON.stringify(U,null,2));let Y=await y1(z),J=await HW(Y,{documentLimit:20,stylePreferencesEndpoint:z.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))}async function BL0($,I,q){let z=I??C(q.options.corp)??($&&$!=="--corp"?$:void 0);await jL0({corpId:z})}async function Gx($,I,q,z,U){if($==="count"){await F0("seal_approval_rules_list",q,z,{countOnly:!0},W0(U.options));return}if($==="list"){if(O0(U.options.count)){await F0("seal_approval_rules_list",q,z,{countOnly:!0},W0(U.options));return}let Y=b0(U.options.limit),J=b0(U.options.offset);if(O0(U.options.summary)){await F0("seal_approval_rules_list",q,z,{fields:CZ0,limit:Y,offset:J},W0(U.options));return}let Q=await FI("seal_approval_rules_list",q,z,{limit:Y,offset:J});_Z0(Q,O0(U.options.full)===!0),E0(Q);return}if($==="clear"){let Y=O0(U.options.yes)===!0,J=O0(U.options.dryRun)??O0(U.options["dry-run"])??!Y;if(!Y&&!J)throw I5("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${z.id}--dry-run`);let Q=await FI("seal_approval_rules_clear",q,z,{dryRun:J,recode:O0(U.options.recode)});if(!Y&&J&&Q&&typeof Q==="object"){E0({...Q,nextCommand:`seal-userulesclear--corp${z.id}--yes`},W0(U.options));return}E0(Q,W0(U.options));return}if($==="versions"){await F0("seal_approval_rule_versions_list",q,z,{},W0(U.options));return}if($==="version"){let Y=I??C(U.options.version);if(!Y)throw Error("Usage: seal-use rules version <versionId|versionNumber|l
Line truncated
`).filter(Boolean),Y=U.slice(-I);return{logFile:q,lines:Y,totalLines:U.length}}async function bG1($){let I=QO($),q=Zx($),z=yw($);CL0($.stateDir);let U=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):IO),Y=$.host??(process.env.HOST?process.env.HOST:qO);YO(I,`${process.pid}
`,{mode:384}),YO(q,JSON.stringify({pid:process.pid,port:U,host:Y,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),nU(z,`servicestartingonhttp://${Y}:${U} pid=${process.pid}`);let J=null;try{J=await zO({port:U,host:Y,silent:!0}),nU(z,`service listening pid=${process.pid}`)}catch(w){if(nU(z,`service failed to bind port ${U}: ${w instanceof Error?w.message:String(w)}`),JO(I)===process.pid)q5(I,{force:!0}),q5(q,{force:!0});throw w}let Q=()=>{if(J)J.close(),J=null;if(JO(I)===process.pid)q5(I,{force:!0}),q5(q,{force:!0});nU(z,`stopped pid=${process.pid}`)};await new Promise((w)=>{let K=!1,H=()=>{if(K)return;K=!0,Q(),process.off("SIGTERM",H),process.off("SIGINT",H),w()};process.once("SIGTERM",H),process.once("SIGINT",H)})}function gL0($){CL0($.stateDir);let I=iU($);if(I.running)return I;let q=$.launcher??{command:process.execPath,args:[$.entryFile]},z=[...q.args??[],"service","run"];if($.port)z.push("--port",String($.port));if($.host)z.push("--host",String($.host));let U=kG1(q.command,z,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});U.unref();let Y=QO($);return YO(Y,`${U.pid}
`,{flag:"a",mode:384})}var Xx=dG1(cG1(),".config","seal-use");async function Lx($,I,q){let z=q?b0(q.options.port)??b0(q.options.p):void 0,U=q?C(q.options.host)??C(q.options.h):void 0,Y=q?b0(q.options.lines)??b0(q.options.n):void 0,J=await NI($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:Xx,version:z1,launcher:I.launcher,port:z,host:U},{maxLines:Y});if(J!==void 0)E0(J)}import{existsSync as mG1,readFileSync as _L0}from"node:fs";async function hL0($,I,q,z,U){if($==="batch-records"||$==="records"){let Y=I??C(U.options.batchId)??C(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation batch-records <batchId>");await F0("seal_simulation_batch_records_get",q,z,{batchId:Y,query:C(U.options.query)},W0(U.options));return}if($==="create"||$==="run"){let Y=C(U.options.mode)??C(U.options.sourceSystem)??C(U.options["source-system"])??"hosecloud",J=Y==="material-pack"?"material_pack":Y,Q=C(U.options.schemaConfig)??C(U.options["schema-config"]),w=Q?JSON.parse(_L0(Q,"utf8")):void 0,K=C(U.options.input),H=K?JSON.parse(_L0(K,"utf8")):z$(U.json),G=C(U.options.packageId)??C(U.options["package-id"]),W=V6(U.options.packageIds)??V6(U.options["package-ids"])??(G?[G]:void 0),V=V6(U.options.flowIds)??V6(U.options["flow-ids"])??V6(U.options.documentSn)??V6(U.options["document-sn"]),X=C(U.options.signKey)??C(U.options["sign-key"])??C(U.options.integration),L=O0(U.options.noWait)??O0(U.options["no-wait"]);await F0("seal_simulation_batch_create",q,z,{mode:J,sourceSystem:J,flowIds:V,documentSn:V,rejectNodeName:C(U.options.rejectNode)??C(U.options["reject-node"])??null,thinkingDepthOverride:C(U.options.thinkingDepth)??C(U.options["thinking-depth"]),skipInvoiceGeneration:O0(U.options.skipInvoiceGeneration)??O0(U.options["skip-invoice-generation"]),skipExpenseExtraction:O0(U.options.skipExpenseExtraction)??O0(U.options["skip-expense-extraction"]),disableAttachmentCache:O0(U.options.disableAttachmentCache)??O0(U.options["disable-attachment-cache"]),signKey:X,packageIds:W,packageId:G,templateId:C(U.options.templateId)??C(U.options["template-id"]),schemaConfig:w,requestIds:V6(U.options.requestIds)??V6(U.options["request-ids"]),workflowTypeId:C(U.options.workflowTypeId)??C(U.options["workflow-type-id"]),flowStatusList:V6(U.options.flowStatusList)?.map(Number)??V6(U.options["flow-status-list"])?.map(Number),businessCodes:V6(U.options.businessCodes)??V6(U.options["business-codes"]),documentType:C(U.options.documentType)??C(U.options["document-type"]),startTime:b0(U.options.startTime)??b0(U.options["start-time"]),endTime:b0(U.options.endTime)??b0(U.options["end-time"]),status:V6(U.options.status),limit:b0(U.options.limit),noWait:L,rawParams:H},W0(U.options));return}if($==="wait"){let Y=I??C(U.options.batchId)??C(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await F0("seal_simulation_batch_wait",q,z,{batchId:Y,timeout:C(U.options.timeout),pollInterval:C(U.options.pollInterval)??C(U.options["poll-interval"])},W0(U.options));return}if($==="status"){let Y=I??C(U.options.batchId)??C(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation status <batchId>");await F0("seal_simulation_batch_status",q,z,{batchId:Y},W0(U.options));return}if($==="clean"||$==="delete"){let Y=I??C(U.options.batchId)??C(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation clean <batchId>");await F0("seal_simulation_batch_clean",q,z,{batchId:Y},W0(U.options));return}if($==="specifications"){let Y=I??C(U.options.integration)??C(U.options.signKey)??C(U.options["sign-key"]);await F0("seal_simulation_specifications_list",q,z,{signKey:Y},W0(U.options));return}if($==="approval-definitions"||$==="definitions"){await F0("seal_simulation_feishu_approval_definitions_list",q,z,{},W0(U.options));return}if($==="list"){await F0("seal_simulation_batches_list",q,z,{limit:b0(U.options.limit)},W0(U.options));return}if($==="get"){let Y=I??C(U.options.batchId)??C(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation get <batchId>");await F0("seal_simulation_batch_get",q,z,{batchId:Y},W0(U.options));return}if($==="templates"){await F0("seal_simulation_templates_get",q,z,{},W0(U.options));return}if($==="integrations"){await F0("seal_simulation_integrations_get",q,z,{},W0(U.options));return}if($==="package-upload"){let Y=I??C(U.options.file);if(!Y)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!mG1(Y))throw Error(`Filenotfound:${Y}`);await F0("seal_simulation_material_package_upload",q,z,{filePath:Y},W0(U.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{existsSync as aL0}from"node:fs";import{join as wO}from"node:path";import{existsSync as Dx,mkdirSync as dL0,rmSync as UW1,writeFileSync as YW1}from"node:fs";import{homedir as mL0}from"node:os";import{dirname as JW1,join as Ox}from"node:path";var SL0=`---
`);throw new r$("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,W.length===1?`seal-usedeployhosecloudsync${W[0].signKey}--corp${U.id}`:void 0)}await F0("seal_deploy_hosecloud_sync",z,U,{signKey:K},W0(Y.options));return}throw Error(`Unknowndeployhosecloudaction:${Q??""}.Available:requirements,list,get,status,configure,sync.`)}import{accessSync as UW1,constants as YW1,existsSync as M$,readdirSync as JW1}from"node:fs";import{homedir as QW1}from"node:os";import{join as $9}from"node:path";import{existsSync as Hx,mkdirSync as SL0,rmSync as IW1,writeFileSync as qW1}from"node:fs";import{homedir as uL0}from"node:os";import{dirname as zW1,join as Gx}from"node:path";var PL0=`---
name:seal-use
description:"v0.10.17: 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 uL0=`interface:
`;var TL0=`interface:
display_name:"Seal Use"
short_description:"Diagnose approval feedback and publish minimal rule fixes"
default_prompt:"Use $seal-use to resolve a customer feedback package to the correct tenant, diagnose the approval run, propose a minimal rule diff, and publish only after explicit confirmation."
@@ -686,7 +653,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 kL0="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use<command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise the user-level `~/.config/seal-use/enterprises`directoryisloaded.Aconfigured\n`testEnterprisesDir`isloadedfirstfortest-tenantworkflows.Thecurrentworkingdirectory's\n`./enterprises`directoryisnotloadedimplicitly.\n-Set`SEAL_USE_ENTERPRISES_DIR`touseoneexplicitdirectoryinstead.Legacy\n`~/.config/seal-home/enterprises`filesaremigratedtotheprimarydirectorywhenpossible.\n\nEnterpriseselectionisstatelessbydefault.Commandsthataccessanenterpriserequire\n`--corp<corpId>`unlessstatefulmodeisexplicitlyenabled:\n\n```bash\nseal-useconfigmodestateful--corp<corpId>\nseal-usecorpsswitch<corpId>\nseal-useconfigmodestateless\n```\n\nTheglobalmodeisstoredin`~/.config/seal-use/config.json`;set`SEAL_USE_CONFIG_FILE`to\noverridethatpath.Thelegacy`current-corp`fileisnotread.\n\n##Stream&ExitCodeContract\n\n-**`stdout`**:Pure,deterministicJSONformachine/Agentparsing.\n-**`stderr`**:Diagnostics,probinglogs,and**Next-StepCommandSuggestions**withthestableprefix`👉Nextaction:seal-use...`.\n-**`ExitCode`**:`0`onsuccess;`1`runtime/upstreamfailure,`2`usage/argumenterror,`10`explicitdestructive-operationconfirmationrequired,`11`missing/invalidauthentication,and`12`outputprotectionrequiringacompact/file/queryalternative.\n\n##Top-LevelCommands\n\n```bash\nseal-useversion\nseal-useconfigpaths\nseal-useconfigget\nseal-useconfigmode<stateful|stateless>[--corp<corpId>]\nseal-useconfigtest-dir[<path>|--clear]\nseal-useconfiglint<enable|disable|status>[--linter<name>][--min-score<score>]\nseal-userulescount[--corp<corpId>]\nseal-useruleslist[--summary][--count][--limit20][--offset0][--corp<corpId>]\nseal-userulesclear[--corp<corpId>][--dry-run|--yes]\nseal-userulesversions[--corp<corpId>]\nseal-userulesversion<versionId|versionNumber|latest>[--corp<corpId>]\nseal-userulesget--corp<corpId>--version<number|latest>--code'#0038'\nseal-userulesget--corp<corpId>--record-id<recordId>--runtime-idrule-205\nseal-userulessearch<keyword>[--version<versionId|versionNumber|latest>][--maxResults20][--corp<corpId>]\nseal-userulespull[--corp<corpId>][--version<id|num|latest>][--out<file>]\nseal-useruleslint[--file<path>][--corp<corpId>][--linter<name|path>][--version<num>][--code<code>][--min-score<score>][--summary]\nseal-userulespush[--file<path>][--corp<corpId>][--publish][--version-name<name>][--dry-run|--yes]\nseal-userulesmap[--corp<corpId>][--version<id|num|latest>][--code<code>]\nseal-useservice<start|stop|restart|status|logs>[--port8787][--host127.0.0.1][--lines50]\nseal-usehttp[--port8787][--host127.0.0.1]\nseal-useserve[--port8787]\nseal-useupdate[--check][--force][--version<v>]\nseal-useupdatecheck\nseal-useupdatechangelog[--limit<n>]\nseal-usechangelog[--limit<n>]\nseal-usemcp\nseal-usemcpconfig\nseal-usemcp-config\nseal-useskilldump\nseal-useskillinstall[--dir<path>|--local]\nseal-useskillstatus\nseal-useopenapi\nseal-useprobe[<corpId>]\nseal-usetoolslist\nseal-usecorpslist[query][--env<production|test>][--strict][--corp<corpId>]\nseal-usecorpssearch<query>[--env<production|test>][--strict]\nseal-usecorpsget<corpId>\nseal-usecorpscurrent[--corp<corpId>]\nseal-usecorpsswitch<corpId>\nseal-usecorpsmark<corpId>--env<production|test>[--confirm]\nseal-usecorpsbind-test<prodCorpId><testCorpId>[--confirm][--force]\nseal-usecorpsunbind-test[<corpId>][--confirm]\nseal-usecorpssync-test[<prodCorpId>][--dry-run][--yes][--version-name<name>]\nseal-usecorpsadd-hose--json'{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-usecorpsadd-seal--json'{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-usecorpsadd-link<https://.../web/thirdparty.html?...>[--name<customName>][--overwrite]\nseal-useauthdiagnose[--corp<corpId>]\nseal-useauthhose-link[--corp<corpId>][--expire7200]\nseal-usedelegationlist[--corp<corpId>]\nseal-usedelegationcreate[--note<note>][--from-link<url>][--corp<corpId>]\nseal-usedelegationrevoke<tokenId>[--corp<corpId>]\nseal-useuserscreate--name<name>--phone<phone>[--dept<deptId>][--corp<corpId>]\nseal-useuserssearch<keyword>[--corp<corpId>]\nseal-useusersdelegation<userIdOrPhone|name>[--note<note>][--corp<corpId>]\nseal-useusersactivate<userId>[--corp<corpId>]\nseal-useusersreset-password<userId>[--corp<corpId>]\nseal-useusersget<userId>[--corLine truncated
`;var jL0="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use<command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise the user-level `~/.config/seal-use/enterprises`directoryisloaded.Aconfigured\n`testEnterprisesDir`isloadedfirstfortest-tenantworkflows.Thecurrentworkingdirectory's\n`./enterprises`directoryisnotloadedimplicitly.\n-Set`SEAL_USE_ENTERPRISES_DIR`touseoneexplicitdirectoryinstead.Legacy\n`~/.config/seal-home/enterprises`filesaremigratedtotheprimarydirectorywhenpossible.\n\nEnterpriseselectionisstatelessbydefault.Commandsthataccessanenterpriserequire\n`--corp<corpId>`unlessstatefulmodeisexplicitlyenabled:\n\n```bash\nseal-useconfigmodestateful--corp<corpId>\nseal-usecorpsswitch<corpId>\nseal-useconfigmodestateless\n```\n\nTheglobalmodeisstoredin`~/.config/seal-use/config.json`;set`SEAL_USE_CONFIG_FILE`to\noverridethatpath.Thelegacy`current-corp`fileisnotread.\n\n##Stream&ExitCodeContract\n\n-**`stdout`**:Pure,deterministicJSONformachine/Agentparsing.\n-**`stderr`**:Diagnostics,probinglogs,and**Next-StepCommandSuggestions**withthestableprefix`👉Nextaction:seal-use...`.\n-**`ExitCode`**:`0`onsuccess;`1`runtime/upstreamfailure,`2`usage/argumenterror,`10`explicitdestructive-operationconfirmationrequired,`11`missing/invalidauthentication,and`12`outputprotectionrequiringacompact/file/queryalternative.\n\n##Top-LevelCommands\n\n```bash\nseal-useversion\nseal-useconfigpaths\nseal-useconfigget\nseal-useconfigmode<stateful|stateless>[--corp<corpId>]\nseal-useconfigtest-dir[<path>|--clear]\nseal-useconfiglint<enable|disable|status>[--linter<name>][--min-score<score>]\nseal-userulescount[--corp<corpId>]\nseal-useruleslist[--summary][--count][--limit20][--offset0][--corp<corpId>]\nseal-userulesclear[--corp<corpId>][--dry-run|--yes]\nseal-userulesversions[--corp<corpId>]\nseal-userulesversion<versionId|versionNumber|latest>[--corp<corpId>]\nseal-userulesget--corp<corpId>--version<number|latest>--code'#0038'\nseal-userulesget--corp<corpId>--record-id<recordId>--runtime-idrule-205\nseal-userulessearch<keyword>[--version<versionId|versionNumber|latest>][--maxResults20][--corp<corpId>]\nseal-userulespull[--corp<corpId>][--version<id|num|latest>][--out<file>]\nseal-useruleslint[--file<path>][--corp<corpId>][--linter<name|path>][--version<num>][--code<code>][--min-score<score>][--summary]\nseal-userulespush[--file<path>][--corp<corpId>][--publish][--version-name<name>][--dry-run|--yes]\nseal-userulesmap[--corp<corpId>][--version<id|num|latest>][--code<code>]\nseal-useservice<start|stop|restart|status|logs>[--port8787][--host127.0.0.1][--lines50]\nseal-usehttp[--port8787][--host127.0.0.1]\nseal-useserve[--port8787]\nseal-useupdate[--check][--force][--version<v>]\nseal-useupdatecheck\nseal-useupdatechangelog[--limit<n>]\nseal-usechangelog[--limit<n>]\nseal-usemcp\nseal-usemcpconfig\nseal-usemcp-config\nseal-useskilldump\nseal-useskillinstall[--dir<path>|--local]\nseal-useskillstatus\nseal-useopenapi\nseal-usedoctor[--quiet]\nseal-usedoctorguide\nseal-usedoctorpaths\nseal-useprobe[<corpId>]\nseal-usetoolslist\nseal-usecorpslist[query][--env<production|test>][--strict][--corp<corpId>]\nseal-usecorpssearch<query>[--env<production|test>][--strict]\nseal-usecorpsget<corpId>\nseal-usecorpscurrent[--corp<corpId>]\nseal-usecorpsswitch<corpId>\nseal-usecorpsmark<corpId>--env<production|test>[--confirm]\nseal-usecorpsbind-test<prodCorpId><testCorpId>[--confirm][--force]\nseal-usecorpsunbind-test[<corpId>][--confirm]\nseal-usecorpssync-test[<prodCorpId>][--dry-run][--yes][--version-name<name>]\nseal-usecorpsadd-hose--json'{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-usecorpsadd-seal--json'{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-usecorpsadd-link<https://.../web/thirdparty.html?...>[--name<customName>][--overwrite]\nseal-useauthdiagnose[--corp<corpId>]\nseal-useauthhose-link[--corp<corpId>][--expire7200]\nseal-usedelegationlist[--corp<corpId>]\nseal-usedelegationcreate[--note<note>][--from-link<url>][--corp<corpId>]\nseal-usedelegationrevoke<tokenId>[--corp<corpId>]\nseal-useuserscreate--name<name>--phone<phone>[--dept<deptId>][--corp<corpId>]\nseal-useuserssearch<keyword>[--corp<corpId>]\nseal-useusersdelegation<userIdOrPhone|name>[--note<note>][--corp<corpId>]\nseal-useusersactivate<userId>[--corp<corpId>]\nseal-useusersreseLine truncated
-\`seal-use auth diagnose\` proves this stage works but redacts the token, so it is not enough when the user needs the actual clickable Hose link.
-**FormattingRequirement**:WhenreturningaHoseauthorizationlinktotheuser,ALWAYSprovideBOTHacodeblock(\`\`\`\`text ... \`\`\`\`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
`);return}if($==="install"||$==="init"||$==="sync"){let z=O0(q.options.local)||O0(q.options.workspace),U=C(q.options.dir)??C(q.options.target)??I,Y=U?U:z?wO(process.cwd(),".agents","skills","seal-use"):xw(),J=Fx(Y);E0({installed:!0,targetDir:J.targetDir,fileCount:J.files.length,files:J.files});return}if($==="status"||$==="get"||!$){let z=xw(),U=wO(process.cwd(),".agents","skills","seal-use");E0({global:{dir:z,installed:aL0(wO(z,"SKILL.md"))},local:{dir:U,installed:aL0(wO(U,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function eL0($,I){if($==="config"){E0(await fU(I));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function $D0($,I,q,z){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await F0($,I,q,z$(z.json),W0(z.options))}function ID0(){E0(Tw.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as QW1,mkdirSync as wW1,renameSync as Mx,rmSync as KW1,unlinkSync as JD0,writeFileSync as qD0}from"node:fs";import{dirname as HW1,join as zD0}from"node:path";import{spawnSync as MI}from"node:child_process";function KO($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.includes("\\$bunfs\\"))return!0;let q=$.toLowerCase().replace(/\\/g,"/");return!q.endsWith("/bun")&&!q.endsWith("/bun.exe")&&!q.endsWith("/node")&&!q.endsWith("/node.exe")}var QD0="yunyingk/seal-use",fw="yunyingk/seal-home";var GW1="SEAL_USE_GITHUB_REPO",WW1="SEAL_HOME_GITHUB_REPO";async function wD0($,I={}){let q={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Xx,version:z1,launcher:$.launcher},z=I.repo||process.env[GW1]?.trim()||process.env[WW1]?.trim()||QD0,U=I.targetVersion?.trim(),Y=U&&U.toLowerCase()!=="latest"?U:void 0;if(Y){let A=Y.replace(/^v/,""),g=KD0(A,z1);if(g<0)if(!Ij&&I.force);else{E0({updated:!1,currentVersion:z1,targetVersion:A,mode:KO()?"binary":"source",message:!Ij?`Cannotdowngradeseal-usefromdevbuildv${z1}toreleasev${A}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${z1}toolderversionv${A}.Updatesmustbeforward-only.`});return}if(g===0&&!I.force){E0({updated:!1,currentVersion:z1,targetVersion:A,mode:KO()?"binary":"source",message:`seal-useisalreadyatversionv${z1}.Use--forcetoreinstall.`});return}}if(I.changelogOnly){let A=await Ax(z,I.limit??10);E0({currentVersion:z1,totalQueried:A.length,releases:A.map((g)=>({version:g.version,tagName:g.tagName,publishedAt:g.publishedAt,author:g.author,releaseNotes:g.notes,releaseUrl:g.htmlUrl,isCurrent:g.version===z1,isNewer:kw(g.version,z1)}))});return}if(!KO()){if(I.checkOnly){let g=await Ax(z,30),k=g[0],S=k?.version??z1,f=g.find((b)=>b.version===z1),v=kw(S,z1),p=g.filter((b)=>kw(b.version,z1));E0({updated:!1,updateAvailable:v,currentVersion:z1,currentVersionPublishedAt:f?.publishedAt,latestVersion:S,latestVersionPublishedAt:k?.publishedAt,behindCount:p.length,pendingReleases:p.map((b)=>({version:b.version,tagName:b.tagName,publishedAt:b.publishedAt,author:b.author,releaseNotes:b.notes,releaseUrl:b.htmlUrl})),releaseNotes:k?.notes??"",releaseUrl:k?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let A=iU(q).running;if(A)await NI("stop",q);try{YD0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(g){console.error(`gitpullskipped:${ginstanceofError?g.message:String(g)}`)}if(YD0("bun",["install"],{cwd:$.appRoot}),A)await NI("start",q);E0({updated:!0,serviceRestarted:A,version:z1,mode:"source"});return}let J=VW1(),Q=ZW1(),w=await Ax(z,30),K=Y?w.find((A)=>A.version===Y||A.tagName===Y||A.tagName===`v${Y}`)??await UD0(z,Y):w[0]??await UD0(z);if(!K){E0({updated:!1,currentVersion:z1,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${z}'`});return}let H=K.version,G=w.find((A)=>A.version===z1),W=kw(H,z1),V=W||Boolean(I.force),X=w.filter((A)=>kw(A.version,z1));if(I.checkOnly){E0({updated:!1,updateAvailable:W,currentVersion:z1,currentVersionPublishedAt:G?.publishedAt,latestVersion:H,latestVersionPublishedAt:K.publishedAt,behindCount:X.length,pendingReleases:X.map((A)=>({version:A.version,tagName:A.tagName,publishedAt:A.publishedAt,author:A.author,releaseNotes:A.notes,releaseUrl:A.htmlUrl})),releaseNotes:K.notes,releaseUrl:K.htmlUrl,mode:"binary"});return}if(!V){E0({updated:!1,currentVersion:z1,currentVersionPublishedAt:G?.publishedAt,latestVersion:H,latestVersionPublishedAt:K.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${z1})`});return}let L=XW1(K.assets,J,Q);if(!L)throw Error(`Nocompatiblebinaryfoundfor${J}-${Q}inreleasev${H}.Availableassets:${K.assets.map((A)=>A.name).join(", ")}`);let D=iU(q).running;if(D)await NI("stop",q);let F=process.execPath,P=HW1(F),T=zD0(P,`.tmp-update-${Date.now()}`);wW1(T,{recursive:!0});try{let A=zD0(T,L.name);await LW1(L.downloadUrl,A,K.tagName,L.name);let g=A;if(L.name.endsWith(".tar.gz")||L.name.endsWith(".tgz"))g=DW1
Line truncated
`)}catch{}}async function LW1($,I,q,z){let U=Px(),Y=[],J=q?q.startsWith("v")?q:`v${q}`:void 0,Q=z||$.split("/").pop()||"";if(U!=="github"){if(J&&Q)Y.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${J}/${Q}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${J}/${Q}`);if($.startsWith("https://git.ying-qing.cn"))Y.push($)}if(U!=="gitea")if(J&&Q){let L=`https://github.com/${QD0}/releases/download/${J}/${Q}`;if(!process.env.CI)Y.push(`https://ghfast.top/${L}`,`https://gh.ddlc.top/${L}`);Y.push(L)}else if($.includes("github.com")){if(!process.env.CI)Y.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);Y.push($)}else Y.push($);let w=Array.from(new Set(Y)),K,H=6000,G=6000,W=307200,V=1e4,X=180000;for(let L=0;L<w.length;L++){let D=w[L],F=new AbortController,P="",T=(S)=>{P=S;try{F.abort()}catch{}},A=setTimeout(()=>{T("Connection timed out (no response headers within 6s)")},H),g,k;try{HO(`==> [${L+1}/${w.length}] Downloading via: ${D}`);let S=await fetch(D,{signal:F.signal});if(A)clearTimeout(A),A=void 0;if(!S.ok)throw Error(`HTTP ${S.status} ${S.statusText}`);g=setTimeout(()=>{T("Overall download time exceeded 3 minutes")},X);let f=Number(S.headers.get("content-length"))||0,v=S.body?.getReader();if(!v){let i=Buffer.from(await S.arrayBuffer());if(i.length<1000)throw Error(`Downloaded content is suspiciously small (${i.length} bytes)`);qD0(I,i),HO(`✓ Download succeeded (${(i.length/1024/1024).toFixed(1)} MB)`);return}let p=[],b=0,h=0;k=setTimeout(()=>{if(b<W){let i=(b/1024).toFixed(1);T(`Initial transfer too slow (${i} KB < 300 KB in 6s), switching mirror...`)}},G);while(!0){let i=v.read(),q0,j=new Promise((U0,G0)=>{q0=setTimeout(()=>{G0(Error("Data transfer stalled (no chunk received for 10s)"))},V)}),x;try{x=await Promise.race([i,j])}finally{if(q0)clearTimeout(q0)}let{done:c,value:r}=x;if(c)break;if(r){if(p.push(r),b+=r.length,k&&b>=W)clearTimeout(k),k=void 0;let U0=Date.now();if(U0-h>200){h=U0;let G0=f?Math.round(b/f*100):0,A0=(b/1048576).toFixed(1),v0=f?(f/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${G0}% (${A0} / ${v0} MB)...`)}catch{}}}}try{process.stderr.write(`
`)}async function pL0($,I,q){let z=($??I??"").toLowerCase();if(z==="guide"||z==="doc"||z==="knowledge"||z==="book"){console.error(`\uD83D\uDCD6[SealUseDoctor]正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(nL0());return}if(z==="paths"||z==="dirs"||z==="directories"){let J=Ox();E0(J.directories);return}let U=Ox();if(!(O0(q.options.quiet)||O0(q.options.silent)))console.error(iL0(U));E0(U)}import{createServer as WW1}from"node:http";import{URL as KW1}from"node:url";var cL0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.17",description:`PlannedHTTPcontractfortheseal-usewrappedbackendAPI.
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],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",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",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",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",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 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:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",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:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",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:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{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:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",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:{"2
Line truncated
`);U(z)})})}async function lL0($){let I=i0($.options.port)??i0($.options.p),q=C($.options.host)??C($.options.h),z=await YO({port:I,host:q}),U=()=>{z.close(()=>{process.exit(0)})};process.on("SIGINT",U),process.on("SIGTERM",U),await new Promise(()=>{})}async function oL0($,I,q,z){if($==="config"||$==="get"){await F0("seal_llm_config_get",I,q,{},W0(z.options));return}if($==="providers"||$==="list"){await F0("seal_llm_providers_list",I,q,{},W0(z.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function rL0($,I){if($==="config"||$==="json"){Nx();return}await Mx()}function Nx(){E0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function tL0($){let I=$O();E0(I,{...W0($.options),allowFull:!0})}async function aL0($,I,q,z){if($==="available"){await F0("seal_permissions_available_list",I,q,{},W0(z.options));return}if($==="configs"||$==="list"){await F0("seal_permissions_configs_list",I,q,{},W0(z.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as sL0}from"node:fs";async function eL0($,I,q,z,U,Y,J){if(!$||$==="get"){await F0("seal_preference_get",U,Y,{},W0(J.options));return}if($==="decision"){if(I==="update"||!I){let Q=C(J.options.input),w=Q?JSON.parse(sL0(Q,"utf8")):z$(J.json);if(!w||Object.keys(w).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await F0("seal_preference_decision_update",U,Y,{...w,dryRun:O0(J.options.dryRun)??O0(J.options["dry-run"])},W0(J.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(I==="set"){let Q=C(J.options.default)??C(J.options.level)??z;if(Q!=="medium"&&Q!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await F0("seal_preference_thinking_depth_set",U,Y,{defaultLevel:Q,dryRun:O0(J.options.dryRun)??O0(J.options["dry-run"])},W0(J.options));return}if(I==="policies"){if(q==="list"||!q){await F0("seal_preference_thinking_depth_policies_list",U,Y,{},W0(J.options));return}if(q==="upsert"){let Q=C(J.options.input),w=Q?JSON.parse(sL0(Q,"utf8")):z$(J.json);if(!w||!w.id||!w.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await F0("seal_preference_thinking_depth_policies_upsert",U,Y,{...w,dryRun:O0(J.options.dryRun)??O0(J.options["dry-run"])},W0(J.options));return}if(q==="remove"||q==="delete"){let Q=z??C(J.options.id)??C(J.options.policyId);if(!Q)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await F0("seal_preference_thinking_depth_policies_remove",U,Y,{policyId:Q,dryRun:O0(J.options.dryRun)??O0(J.options["dry-run"])},W0(J.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function $D0($={}){let I=c$(),q=K4(),z=vU(I,{stateful:q.stateful,defaultCorpId:q.defaultCorpId,corpId:$.corpId},HI());console.log(`[probe]corp=${z.id}source=${z.source.type}`);let U=await iU(z);console.log("[probe] seal enterprise"),console.log(JSON.stringify(U,null,2));let Y=await y1(z),J=await WW(Y,{documentLimit:20,stylePreferencesEndpoint:z.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))}async function ID0($,I,q){let z=I??C(q.options.corp)??($&&$!=="--corp"?$:void 0);await $D0({corpId:z})}async function Ax($,I,q,z,U){if($==="count"){await F0("seal_approval_rules_list",q,z,{countOnly:!0},W0(U.options));return}if($==="list"){if(O0(U.options.count)){await F0("seal_approval_rules_list",q,z,{countOnly:!0},W0(U.options));return}let Y=i0(U.options.limit),J=i0(U.options.offset);if(O0(U.options.summary)){await F0("seal_approval_rules_list",q,z,{fields:kZ0,limit:Y,offset:J},W0(U.options));return}let Q=await MI("seal_approval_rules_list",q,z,{limit:Y,offset:J});fZ0(Q,O0(U.options.full)===!0),E0(Q);return}if($==="clear"){let Y=O0(U.options.yes)===!0,J=O0(U.options.dryRun)??O0(U.options["dry-run"])??!Y;if(!Y&&!J)throw q5("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${z.id}--dry-run`);let Q=await MI("seal_approval_rules_clear",q,z,{dryRun:J,recode:O0(U.options.recode)});if(!Y&&J&&Q&&typeof Q==="object"){E0({...Q,nextCommand:`seal-userulesclear--corp${z.id}--yes`},W0(U.options));return}E0(Q,W0(U.options));return}if($==="versions"){await F0("seal_approval_rule_versions_list",q,z,{},W0(U.options));return}if($==="version"){let Y=I??C(U.options.version);if(!Y)throw Error("Usage: seal-use rules version <versionId|versionNumber|l
Line truncated
`).filter(Boolean),Y=U.slice(-I);return{logFile:q,lines:Y,totalLines:U.length}}async function DW1($){let I=KO($),q=Ex($),z=fw($);YD0($.stateDir);let U=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):zO),Y=$.host??(process.env.HOST?process.env.HOST:UO);QO(I,`${process.pid}
`,{mode:384}),QO(q,JSON.stringify({pid:process.pid,port:U,host:Y,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),pU(z,`servicestartingonhttp://${Y}:${U} pid=${process.pid}`);let J=null;try{J=await YO({port:U,host:Y,silent:!0}),pU(z,`service listening pid=${process.pid}`)}catch(w){if(pU(z,`service failed to bind port ${U}: ${w instanceof Error?w.message:String(w)}`),wO(I)===process.pid)z5(I,{force:!0}),z5(q,{force:!0});throw w}let Q=()=>{if(J)J.close(),J=null;if(wO(I)===process.pid)z5(I,{force:!0}),z5(q,{force:!0});pU(z,`stopped pid=${process.pid}`)};await new Promise((w)=>{let K=!1,H=()=>{if(K)return;K=!0,Q(),process.off("SIGTERM",H),process.off("SIGINT",H),w()};process.once("SIGTERM",H),process.once("SIGINT",H)})}function qD0($){YD0($.stateDir);let I=cU($);if(I.running)return I;let q=$.launcher??{command:process.execPath,args:[$.entryFile]},z=[...q.args??[],"service","run"];if($.port)z.push("--port",String($.port));if($.host)z.push("--host",String($.host));let U=VW1(q.command,z,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});U.unref();let Y=KO($);return QO(Y,`${U.pid}
`,{flag:"a",mode:384})}var Bx=NW1(FW1(),".config","seal-use");async function jx($,I,q){let z=q?i0(q.options.port)??i0(q.options.p):void 0,U=q?C(q.options.host)??C(q.options.h):void 0,Y=q?i0(q.options.lines)??i0(q.options.n):void 0,J=await PI($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:Bx,version:s0,launcher:I.launcher,port:z,host:U},{maxLines:Y});if(J!==void 0)E0(J)}import{existsSync as MW1,readFileSync as JD0}from"node:fs";async function QD0($,I,q,z,U){if($==="batch-records"||$==="records"){let Y=I??C(U.options.batchId)??C(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation batch-records <batchId>");await F0("seal_simulation_batch_records_get",q,z,{batchId:Y,query:C(U.options.query)},W0(U.options));return}if($==="create"||$==="run"){let Y=C(U.options.mode)??C(U.options.sourceSystem)??C(U.options["source-system"])??"hosecloud",J=Y==="material-pack"?"material_pack":Y,Q=C(U.options.schemaConfig)??C(U.options["schema-config"]),w=Q?JSON.parse(JD0(Q,"utf8")):void 0,K=C(U.options.input),H=K?JSON.parse(JD0(K,"utf8")):z$(U.json),G=C(U.options.packageId)??C(U.options["package-id"]),W=V6(U.options.packageIds)??V6(U.options["package-ids"])??(G?[G]:void 0),V=V6(U.options.flowIds)??V6(U.options["flow-ids"])??V6(U.options.documentSn)??V6(U.options["document-sn"]),X=C(U.options.signKey)??C(U.options["sign-key"])??C(U.options.integration),L=O0(U.options.noWait)??O0(U.options["no-wait"]);await F0("seal_simulation_batch_create",q,z,{mode:J,sourceSystem:J,flowIds:V,documentSn:V,rejectNodeName:C(U.options.rejectNode)??C(U.options["reject-node"])??null,thinkingDepthOverride:C(U.options.thinkingDepth)??C(U.options["thinking-depth"]),skipInvoiceGeneration:O0(U.options.skipInvoiceGeneration)??O0(U.options["skip-invoice-generation"]),skipExpenseExtraction:O0(U.options.skipExpenseExtraction)??O0(U.options["skip-expense-extraction"]),disableAttachmentCache:O0(U.options.disableAttachmentCache)??O0(U.options["disable-attachment-cache"]),signKey:X,packageIds:W,packageId:G,templateId:C(U.options.templateId)??C(U.options["template-id"]),schemaConfig:w,requestIds:V6(U.options.requestIds)??V6(U.options["request-ids"]),workflowTypeId:C(U.options.workflowTypeId)??C(U.options["workflow-type-id"]),flowStatusList:V6(U.options.flowStatusList)?.map(Number)??V6(U.options["flow-status-list"])?.map(Number),businessCodes:V6(U.options.businessCodes)??V6(U.options["business-codes"]),documentType:C(U.options.documentType)??C(U.options["document-type"]),startTime:i0(U.options.startTime)??i0(U.options["start-time"]),endTime:i0(U.options.endTime)??i0(U.options["end-time"]),status:V6(U.options.status),limit:i0(U.options.limit),noWait:L,rawParams:H},W0(U.options));return}if($==="wait"){let Y=I??C(U.options.batchId)??C(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await F0("seal_simulation_batch_wait",q,z,{batchId:Y,timeout:C(U.options.timeout),pollInterval:C(U.options.pollInterval)??C(U.options["poll-interval"])},W0(U.options));return}if($==="status"){let Y=I??C(U.options.batchId)??C(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation status <batchId>");await F0("seal_simulation_batch_status",q,z,{batchId:Y},W0(U.options));return}if($==="clean"||$==="delete"){let Y=I??C(U.options.batchId)??C(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation clean <batchId>");await F0("seal_simulation_batch_clean",q,z,{batchId:Y},W0(U.options));return}if($==="specifications"){let Y=I??C(U.options.integration)??C(U.options.signKey)??C(U.options["sign-key"]);await F0("seal_simulation_specifications_list",q,z,{signKey:Y},W0(U.options));return}if($==="approval-definitions"||$==="definitions"){await F0("seal_simulation_feishu_approval_definitions_list",q,z,{},W0(U.options));return}if($==="list"){await F0("seal_simulation_batches_list",q,z,{limit:i0(U.options.limit)},W0(U.options));return}if($==="get"){let Y=I??C(U.options.batchId)??C(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation get <batchId>");await F0("seal_simulation_batch_get",q,z,{batchId:Y},W0(U.options));return}if($==="templates"){await F0("seal_simulation_templates_get",q,z,{},W0(U.options));return}if($==="integrations"){await F0("seal_simulation_integrations_get",q,z,{},W0(U.options));return}if($==="package-upload"){let Y=I??C(U.options.file);if(!Y)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!MW1(Y))throw Error(`Filenotfound:${Y}`);await F0("seal_simulation_material_package_upload",q,z,{filePath:Y},W0(U.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{existsSync as wD0}from"node:fs";import{join as HO}from"node:path";function KD0($,I,q){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${xL0()}
`);return}if($==="install"||$==="init"||$==="sync"){let z=O0(q.options.local)||O0(q.options.workspace),U=C(q.options.dir)??C(q.options.target)??I,Y=U?U:z?HO(process.cwd(),".agents","skills","seal-use"):AI(),J=Wx(Y);E0({installed:!0,targetDir:J.targetDir,fileCount:J.files.length,files:J.files});return}if($==="status"||$==="get"||!$){let z=AI(),U=HO(process.cwd(),".agents","skills","seal-use");E0({global:{dir:z,installed:wD0(HO(z,"SKILL.md"))},local:{dir:U,installed:wD0(HO(U,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function HD0($,I){if($==="config"){E0(await iU(I));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function GD0($,I,q,z){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await F0($,I,q,z$(z.json),W0(z.options))}function WD0(){E0(jw.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as AW1,mkdirSync as PW1,renameSync as gx,rmSync as TW1,unlinkSync as DD0,writeFileSync as VD0}from"node:fs";import{dirname as EW1,join as ZD0}from"node:path";import{spawnSync as TI}from"node:child_process";function GO($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.includes("\\$bunfs\\"))return!0;let q=$.toLowerCase().replace(/\\/g,"/");return!q.endsWith("/bun")&&!q.endsWith("/bun.exe")&&!q.endsWith("/node")&&!q.endsWith("/node.exe")}var OD0="yunyingk/seal-use",bw="yunyingk/seal-home";var BW1="SEAL_USE_GITHUB_REPO",jW1="SEAL_HOME_GITHUB_REPO";async function FD0($,I={}){let q={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Bx,version:s0,launcher:$.launcher},z=I.repo||process.env[BW1]?.trim()||process.env[jW1]?.trim()||OD0,U=I.targetVersion?.trim(),Y=U&&U.toLowerCase()!=="latest"?U:void 0;if(Y){let A=Y.replace(/^v/,""),g=ND0(A,s0);if(g<0)if(!zB&&I.force);else{E0({updated:!1,currentVersion:s0,targetVersion:A,mode:GO()?"binary":"source",message:!zB?`Cannotdowngradeseal-usefromdevbuildv${s0}toreleasev${A}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${s0}toolderversionv${A}.Updatesmustbeforward-only.`});return}if(g===0&&!I.force){E0({updated:!1,currentVersion:s0,targetVersion:A,mode:GO()?"binary":"source",message:`seal-useisalreadyatversionv${s0}.Use--forcetoreinstall.`});return}}if(I.changelogOnly){let A=await vx(z,I.limit??10);E0({currentVersion:s0,totalQueried:A.length,releases:A.map((g)=>({version:g.version,tagName:g.tagName,publishedAt:g.publishedAt,author:g.author,releaseNotes:g.notes,releaseUrl:g.htmlUrl,isCurrent:g.version===s0,isNewer:nw(g.version,s0)}))});return}if(!GO()){if(I.checkOnly){let g=await vx(z,30),k=g[0],S=k?.version??s0,f=g.find((i)=>i.version===s0),v=nw(S,s0),p=g.filter((i)=>nw(i.version,s0));E0({updated:!1,updateAvailable:v,currentVersion:s0,currentVersionPublishedAt:f?.publishedAt,latestVersion:S,latestVersionPublishedAt:k?.publishedAt,behindCount:p.length,pendingReleases:p.map((i)=>({version:i.version,tagName:i.tagName,publishedAt:i.publishedAt,author:i.author,releaseNotes:i.notes,releaseUrl:i.htmlUrl})),releaseNotes:k?.notes??"",releaseUrl:k?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let A=cU(q).running;if(A)await PI("stop",q);try{LD0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(g){console.error(`gitpullskipped:${ginstanceofError?g.message:String(g)}`)}if(LD0("bun",["install"],{cwd:$.appRoot}),A)await PI("start",q);E0({updated:!0,serviceRestarted:A,version:s0,mode:"source"});return}let J=gW1(),Q=vW1(),w=await vx(z,30),K=Y?w.find((A)=>A.version===Y||A.tagName===Y||A.tagName===`v${Y}`)??await XD0(z,Y):w[0]??await XD0(z);if(!K){E0({updated:!1,currentVersion:s0,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${z}'`});return}let H=K.version,G=w.find((A)=>A.version===s0),W=nw(H,s0),V=W||Boolean(I.force),X=w.filter((A)=>nw(A.version,s0));if(I.checkOnly){E0({updated:!1,updateAvailable:W,currentVersion:s0,currentVersionPublishedAt:G?.publishedAt,latestVersion:H,latestVersionPublishedAt:K.publishedAt,behindCount:X.length,pendingReleases:X.map((A)=>({version:A.version,tagName:A.tagName,publishedAt:A.publishedAt,author:A.author,releaseNotes:A.notes,releaseUrl:A.htmlUrl})),releaseNotes:K.notes,releaseUrl:K.htmlUrl,mode:"binary"});return}if(!V){E0({updated:!1,currentVersion:s0,currentVersionPublishedAt:G?.publishedAt,latestVersion:H,latestVersionPublishedAt:K.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${s0})`});return}let L=RW1(K.assets,J,Q);if(!L)throw Error(`Nocompatiblebinaryfoundfor${J}-${Q}inreleasev${H}.Availableassets:${K.assets.map((A)=>A.name).join(", ")}`);let D=cU(q).running;if(D)await PI("stop",q);let O=process.execPath,P=EW1(O),T=ZD0(P,`.tmp-update-${Date.now()}`);PW1(T,{recursive:!0});try{let A=ZD0(T,L.name);await CW1(L.downloadUrl,A,K.tagName,L.name);let g=A;if(L.name.endsWith(".tar.gz")||L.name.endsWith(".tgz"))g=_W1
Line truncated
`)}catch{}}async function CW1($,I,q,z){let U=Rx(),Y=[],J=q?q.startsWith("v")?q:`v${q}`:void 0,Q=z||$.split("/").pop()||"";if(U!=="github"){if(J&&Q)Y.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${J}/${Q}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${J}/${Q}`);if($.startsWith("https://git.ying-qing.cn"))Y.push($)}if(U!=="gitea")if(J&&Q){let L=`https://github.com/${OD0}/releases/download/${J}/${Q}`;if(!process.env.CI)Y.push(`https://ghfast.top/${L}`,`https://gh.ddlc.top/${L}`);Y.push(L)}else if($.includes("github.com")){if(!process.env.CI)Y.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);Y.push($)}else Y.push($);let w=Array.from(new Set(Y)),K,H=6000,G=6000,W=307200,V=1e4,X=180000;for(let L=0;L<w.length;L++){let D=w[L],O=new AbortController,P="",T=(S)=>{P=S;try{O.abort()}catch{}},A=setTimeout(()=>{T("Connection timed out (no response headers within 6s)")},H),g,k;try{WO(`==> [${L+1}/${w.length}] Downloading via: ${D}`);let S=await fetch(D,{signal:O.signal});if(A)clearTimeout(A),A=void 0;if(!S.ok)throw Error(`HTTP ${S.status} ${S.statusText}`);g=setTimeout(()=>{T("Overall download time exceeded 3 minutes")},X);let f=Number(S.headers.get("content-length"))||0,v=S.body?.getReader();if(!v){let b=Buffer.from(await S.arrayBuffer());if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);VD0(I,b),WO(`✓ Download succeeded (${(b.length/1024/1024).toFixed(1)} MB)`);return}let p=[],i=0,h=0;k=setTimeout(()=>{if(i<W){let b=(i/1024).toFixed(1);T(`Initial transfer too slow (${b} KB < 300 KB in 6s), switching mirror...`)}},G);while(!0){let b=v.read(),q0,B=new Promise((U0,G0)=>{q0=setTimeout(()=>{G0(Error("Data transfer stalled (no chunk received for 10s)"))},V)}),x;try{x=await Promise.race([b,B])}finally{if(q0)clearTimeout(q0)}let{done:c,value:r}=x;if(c)break;if(r){if(p.push(r),i+=r.length,k&&i>=W)clearTimeout(k),k=void 0;let U0=Date.now();if(U0-h>200){h=U0;let G0=f?Math.round(i/f*100):0,A0=(i/1048576).toFixed(1),v0=f?(f/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${G0}% (${A0} / ${v0} MB)...`)}catch{}}}}try{process.stderr.write(`
`seal-use update` updates the git checkout, runs `bun install`, and restarts the local service if it was running.
System diagnostic & embedded architecture specifications:
-`seal-use doctor [--quiet]` executes a comprehensive read-only environment diagnostic health check (runtime executable, filesystem paths health, enterprise assets summary, daemon status) with zero disk footprint.
-`seal-use doctor guide` reads the complete embedded system architecture & directory specification whitepaper directly from binary memory without touching disk.
-`seal-use doctor paths` outputs compact JSON audit of all filesystem paths touched by the CLI.
Enterprise and tenant management:
-`seal-use corps list [query] [--env <production|test>] [--strict] [--corp <corpId>]`
- **查看企业配置源文件**:运行 \`seal-use corps get <corpId>\`,可直接查看指定企业的本地 JSON 存储绝对路径。
- **查阅完整操作手册**:运行 \`seal-use doctor guide\` 随时在离线状态下查看本文档。
`;
}
Reference in new issue
Block a user
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.