@jutge.org/toolkit 4.4.42 → 4.4.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -216,7 +216,7 @@ Expecting `+J_.join(", ")+", got '"+(this.terminals_[E]||E)+"'";else k_="Parse e
|
|
|
216
216
|
return undefined
|
|
217
217
|
}
|
|
218
218
|
`.trim()},blockValue:function($){var w=this.aliasable("container.hooks.blockHelperMissing"),f=[this.contextName(0)];this.setupHelperArgs($,0,f);var K=this.popStack();f.splice(1,0,K),this.push(this.source.functionCall(w,"call",f))},ambiguousBlockValue:function(){var $=this.aliasable("container.hooks.blockHelperMissing"),w=[this.contextName(0)];this.setupHelperArgs("",0,w,!0),this.flushInline();var f=this.topStack();w.splice(1,0,f),this.pushSource(["if (!",this.lastHelper,") { ",f," = ",this.source.functionCall($,"call",w),"}"])},appendContent:function($){if(this.pendingContent)$=this.pendingContent+$;else this.pendingLocation=this.source.currentLocation;this.pendingContent=$},append:function(){if(this.isInline())this.replaceStack(function(w){return[" != null ? ",w,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var $=this.popStack();if(this.pushSource(["if (",$," != null) { ",this.appendToBuffer($,void 0,!0)," }"]),this.environment.isSimple)this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function($){this.lastContext=$},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function($,w,f,K){var z=0;if(!K&&this.options.compat&&!this.lastContext)this.push(this.depthedLookup($[z++]));else this.pushContext();this.resolvePath("context",$,z,w,f)},lookupBlockParam:function($,w){this.useBlockParams=!0,this.push(["blockParams[",$[0],"][",$[1],"]"]),this.resolvePath("context",w,1)},lookupData:function($,w,f){if(!$)this.pushStackLiteral("data");else this.pushStackLiteral("container.data(data, "+$+")");this.resolvePath("data",w,0,!0,f)},resolvePath:function($,w,f,K,z){var P=this;if(this.options.strict||this.options.assumeObjects){this.push(VN6(this.options.strict&&z,this,w,f,$));return}var D=w.length;for(;f<D;f++)this.replaceStack(function(Y){var J=P.nameLookup(Y,w[f],$);if(!K)return[" != null ? ",J," : ",Y];else return[" && ",J]})},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function($,w){if(this.pushContext(),this.pushString(w),w!=="SubExpression")if(typeof $==="string")this.pushString($);else this.pushStackLiteral($)},emptyHash:function($){if(this.trackIds)this.push("{}");if(this.stringParams)this.push("{}"),this.push("{}");this.pushStackLiteral($?"undefined":"{}")},pushHash:function(){if(this.hash)this.hashes.push(this.hash);this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var $=this.hash;if(this.hash=this.hashes.pop(),this.trackIds)this.push(this.objectLiteral($.ids));if(this.stringParams)this.push(this.objectLiteral($.contexts)),this.push(this.objectLiteral($.types));this.push(this.objectLiteral($.values))},pushString:function($){this.pushStackLiteral(this.quotedString($))},pushLiteral:function($){this.pushStackLiteral($)},pushProgram:function($){if($!=null)this.pushStackLiteral(this.programExpression($));else this.pushStackLiteral(null)},registerDecorator:function($,w){var f=this.nameLookup("decorators",w,"decorator"),K=this.setupHelperArgs(w,$);this.decorators.push(["fn = ",this.decorators.functionCall(f,"",["fn","props","container",K])," || fn;"])},invokeHelper:function($,w,f){var K=this.popStack(),z=this.setupHelper($,w),P=[];if(f)P.push(z.name);if(P.push(K),!this.options.strict)P.push(this.aliasable("container.hooks.helperMissing"));var D=["(",this.itemsSeparatedBy(P,"||"),")"],Y=this.source.functionCall(D,"call",z.callParams);this.push(Y)},itemsSeparatedBy:function($,w){var f=[];f.push($[0]);for(var K=1;K<$.length;K++)f.push(w,$[K]);return f},invokeKnownHelper:function($,w){var f=this.setupHelper($,w);this.push(this.source.functionCall(f.name,"call",f.callParams))},invokeAmbiguous:function($,w){this.useRegister("helper");var f=this.popStack();this.emptyHash();var K=this.setupHelper(0,$,w),z=this.lastHelper=this.nameLookup("helpers",$,"helper"),P=["(","(helper = ",z," || ",f,")"];if(!this.options.strict)P[0]="(helper = ",P.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"));this.push(["(",P,K.paramsInit?["),(",K.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",K.callParams)," : helper))"])},invokePartial:function($,w,f){var K=[],z=this.setupParams(w,1,K);if($)w=this.popStack(),delete z.name;if(f)z.indent=JSON.stringify(f);if(z.helpers="helpers",z.partials="partials",z.decorators="container.decorators",!$)K.unshift(this.nameLookup("partials",w,"partial"));else K.unshift(w);if(this.options.compat)z.depths="depths";z=this.objectLiteral(z),K.push(z),this.push(this.source.functionCall("container.invokePartial","",K))},assignToHash:function($){var w=this.popStack(),f=void 0,K=void 0,z=void 0;if(this.trackIds)z=this.popStack();if(this.stringParams)K=this.popStack(),f=this.popStack();var P=this.hash;if(f)P.contexts[$]=f;if(K)P.types[$]=K;if(z)P.ids[$]=z;P.values[$]=w},pushId:function($,w,f){if($==="BlockParam")this.pushStackLiteral("blockParams["+w[0]+"].path["+w[1]+"]"+(f?" + "+JSON.stringify("."+f):""));else if($==="PathExpression")this.pushString(w);else if($==="SubExpression")this.pushStackLiteral("true");else this.pushStackLiteral("null")},compiler:YD,compileChildren:function($,w){var f=$.children,K=void 0,z=void 0;for(var P=0,D=f.length;P<D;P++){K=f[P],z=new this.compiler;var Y=this.matchExistingProgram(K);if(Y==null){this.context.programs.push("");var J=this.context.programs.length;K.index=J,K.name="program"+J,this.context.programs[J]=z.compile(K,w,this.context,!this.precompile),this.context.decorators[J]=z.decorators,this.context.environments[J]=K,this.useDepths=this.useDepths||z.useDepths,this.useBlockParams=this.useBlockParams||z.useBlockParams,K.useDepths=this.useDepths,K.useBlockParams=this.useBlockParams}else K.index=Y.index,K.name="program"+Y.index,this.useDepths=this.useDepths||Y.useDepths,this.useBlockParams=this.useBlockParams||Y.useBlockParams}},matchExistingProgram:function($){for(var w=0,f=this.context.environments.length;w<f;w++){var K=this.context.environments[w];if(K&&K.equals($))return K}},programExpression:function($){var w=this.environment.children[$],f=[w.index,"data",w.blockParams];if(this.useBlockParams||this.useDepths)f.push("blockParams");if(this.useDepths)f.push("depths");return"container.program("+f.join(", ")+")"},useRegister:function($){if(!this.registers[$])this.registers[$]=!0,this.registers.list.push($)},push:function($){if(!($ instanceof DD))$=this.source.wrap($);return this.inlineStack.push($),$},pushStackLiteral:function($){this.push(new DD($))},pushSource:function($){if(this.pendingContent)this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0;if($)this.source.push($)},replaceStack:function($){var w=["("],f=void 0,K=void 0,z=void 0;if(!this.isInline())throw new kd.default("replaceStack on non-inline");var P=this.popStack(!0);if(P instanceof DD)f=[P.value],w=["(",f],z=!0;else{K=!0;var D=this.incrStack();w=["((",this.push(D)," = ",P,")"],f=this.topStack()}var Y=$.call(this,f);if(!z)this.popStack();if(K)this.stackSlot--;this.push(w.concat(Y,")"))},incrStack:function(){if(this.stackSlot++,this.stackSlot>this.stackVars.length)this.stackVars.push("stack"+this.stackSlot);return this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var $=this.inlineStack;this.inlineStack=[];for(var w=0,f=$.length;w<f;w++){var K=$[w];if(K instanceof DD)this.compileStack.push(K);else{var z=this.incrStack();this.pushSource([z," = ",K,";"]),this.compileStack.push(z)}}},isInline:function(){return this.inlineStack.length},popStack:function($){var w=this.isInline(),f=(w?this.inlineStack:this.compileStack).pop();if(!$&&f instanceof DD)return f.value;else{if(!w){if(!this.stackSlot)throw new kd.default("Invalid stack pop");this.stackSlot--}return f}},topStack:function(){var $=this.isInline()?this.inlineStack:this.compileStack,w=$[$.length-1];if(w instanceof DD)return w.value;else return w},contextName:function($){if(this.useDepths&&$)return"depths["+$+"]";else return"depth"+$},quotedString:function($){return this.source.quotedString($)},objectLiteral:function($){return this.source.objectLiteral($)},aliasable:function($){var w=this.aliases[$];if(w)return w.referenceCount++,w;return w=this.aliases[$]=this.source.wrap($),w.aliasable=!0,w.referenceCount=1,w},setupHelper:function($,w,f){var K=[],z=this.setupHelperArgs(w,$,K,f),P=this.nameLookup("helpers",w,"helper"),D=this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})");return{params:K,paramsInit:z,name:P,callParams:[D].concat(K)}},setupParams:function($,w,f){var K={},z=[],P=[],D=[],Y=!f,J=void 0;if(Y)f=[];if(K.name=this.quotedString($),K.hash=this.popStack(),this.trackIds)K.hashIds=this.popStack();if(this.stringParams)K.hashTypes=this.popStack(),K.hashContexts=this.popStack();var Z=this.popStack(),k=this.popStack();if(k||Z)K.fn=k||"container.noop",K.inverse=Z||"container.noop";var W=w;while(W--){if(J=this.popStack(),f[W]=J,this.trackIds)D[W]=this.popStack();if(this.stringParams)P[W]=this.popStack(),z[W]=this.popStack()}if(Y)K.args=this.source.generateArray(f);if(this.trackIds)K.ids=this.source.generateArray(D);if(this.stringParams)K.types=this.source.generateArray(P),K.contexts=this.source.generateArray(z);if(this.options.data)K.data="data";if(this.useBlockParams)K.blockParams="blockParams";return K},setupHelperArgs:function($,w,f,K){var z=this.setupParams($,w,f);if(z.loc=JSON.stringify(this.source.currentLocation),z=this.objectLiteral(z),K)return this.useRegister("options"),f.push("options"),["options=",z];else if(f)return f.push(z),"";else return z}};(function(){var q="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),$=YD.RESERVED_WORDS={};for(var w=0,f=q.length;w<f;w++)$[q[w]]=!0})();YD.isValidJavaScriptVariableName=function(q){return!YD.RESERVED_WORDS[q]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(q)};function VN6(q,$,w,f,K){var z=$.popStack(),P=w.length;if(q)P--;for(;f<P;f++)z=$.nameLookup(z,w[f],K);if(q)return[$.aliasable("container.strict"),"(",z,", ",$.quotedString(w[f]),", ",JSON.stringify($.source.currentLocation)," )"];else return z}xO_.default=YD;dO_.exports=xO_.default});var nO_=G((pO_,iO_)=>{pO_.__esModule=!0;function Yk(q){return q&&q.__esModule?q:{default:q}}var hN6=ik_(),EN6=Yk(hN6),gN6=nx(),RN6=Yk(gN6),Od=zO_(),Wd=JO_(),bN6=lO_(),IN6=Yk(bN6),yN6=EG(),SN6=Yk(yN6),mN6=lx(),LN6=Yk(mN6),cN6=EN6.default.create;function rO_(){var q=cN6();return q.compile=function($,w){return Wd.compile($,w,q)},q.precompile=function($,w){return Wd.precompile($,w,q)},q.AST=RN6.default,q.Compiler=Wd.Compiler,q.JavaScriptCompiler=IN6.default,q.Parser=Od.parser,q.parse=Od.parse,q.parseWithoutProcessing=Od.parseWithoutProcessing,q}var JD=rO_();JD.create=rO_;LN6.default(JD);JD.Visitor=SN6.default;JD.default=JD;pO_.default=JD;iO_.exports=pO_.default});var aO_=G((nN6)=>{nN6.__esModule=!0;nN6.print=iN6;nN6.PrintVisitor=C4;function lN6(q){return q&&q.__esModule?q:{default:q}}var rN6=EG(),pN6=lN6(rN6);function iN6(q){return new C4().accept(q)}function C4(){this.padding=0}C4.prototype=new pN6.default;C4.prototype.pad=function(q){var $="";for(var w=0,f=this.padding;w<f;w++)$+=" ";return $+=q+`
|
|
219
|
-
`,$};C4.prototype.Program=function(q){var $="",w=q.body,f=void 0,K=void 0;if(q.blockParams){var z="BLOCK PARAMS: [";for(f=0,K=q.blockParams.length;f<K;f++)z+=" "+q.blockParams[f];z+=" ]",$+=this.pad(z)}for(f=0,K=w.length;f<K;f++)$+=this.accept(w[f]);return this.padding--,$};C4.prototype.MustacheStatement=function(q){return this.pad("{{ "+this.SubExpression(q)+" }}")};C4.prototype.Decorator=function(q){return this.pad("{{ DIRECTIVE "+this.SubExpression(q)+" }}")};C4.prototype.BlockStatement=C4.prototype.DecoratorBlock=function(q){var $="";if($+=this.pad((q.type==="DecoratorBlock"?"DIRECTIVE ":"")+"BLOCK:"),this.padding++,$+=this.pad(this.SubExpression(q)),q.program)$+=this.pad("PROGRAM:"),this.padding++,$+=this.accept(q.program),this.padding--;if(q.inverse){if(q.program)this.padding++;if($+=this.pad("{{^}}"),this.padding++,$+=this.accept(q.inverse),this.padding--,q.program)this.padding--}return this.padding--,$};C4.prototype.PartialStatement=function(q){var $="PARTIAL:"+q.name.original;if(q.params[0])$+=" "+this.accept(q.params[0]);if(q.hash)$+=" "+this.accept(q.hash);return this.pad("{{> "+$+" }}")};C4.prototype.PartialBlockStatement=function(q){var $="PARTIAL BLOCK:"+q.name.original;if(q.params[0])$+=" "+this.accept(q.params[0]);if(q.hash)$+=" "+this.accept(q.hash);return $+=" "+this.pad("PROGRAM:"),this.padding++,$+=this.accept(q.program),this.padding--,this.pad("{{> "+$+" }}")};C4.prototype.ContentStatement=function(q){return this.pad("CONTENT[ '"+q.value+"' ]")};C4.prototype.CommentStatement=function(q){return this.pad("{{! '"+q.value+"' }}")};C4.prototype.SubExpression=function(q){var $=q.params,w=[],f=void 0;for(var K=0,z=$.length;K<z;K++)w.push(this.accept($[K]));return $="["+w.join(", ")+"]",f=q.hash?" "+this.accept(q.hash):"",this.accept(q.path)+" "+$+f};C4.prototype.PathExpression=function(q){var $=q.parts.join("/");return(q.data?"@":"")+"PATH:"+$};C4.prototype.StringLiteral=function(q){return'"'+q.value+'"'};C4.prototype.NumberLiteral=function(q){return"NUMBER{"+q.value+"}"};C4.prototype.BooleanLiteral=function(q){return"BOOLEAN{"+q.value+"}"};C4.prototype.UndefinedLiteral=function(){return"UNDEFINED"};C4.prototype.NullLiteral=function(){return"NULL"};C4.prototype.Hash=function(q){var $=q.pairs,w=[];for(var f=0,K=$.length;f<K;f++)w.push(this.accept($[f]));return"HASH{"+w.join(", ")+"}"};C4.prototype.HashPair=function(q){return q.key+"="+this.accept(q.value)}});var Jk=G((PN8,oO_)=>{var yG=nO_().default,FO_=aO_();yG.PrintVisitor=FO_.PrintVisitor;yG.print=FO_.print;oO_.exports=yG;function BO_(q,$){var w=H_("fs"),f=w.readFileSync($,"utf8");q.exports=yG.compile(f)}if(H_.extensions)H_.extensions[".handlebars"]=BO_,H_.extensions[".hbs"]=BO_});var Ed;var _v_=e9(()=>{Ed=Array.isArray});async function kD(q){let $=Ed(q)?q.map((K)=>[null,K]):Object.entries(q),w=await Promise.all($.map(([K,z])=>z.then((P)=>({result:P,exc:null,key:K})).catch((P)=>({result:null,exc:P,key:K})))),f=w.filter((K)=>K.exc);if(f.length>0)throw new qv_(f.map((K)=>K.exc));if(Ed(q))return w.map((K)=>K.result);return w.reduce((K,z)=>({...K,[z.key]:z.result}),{})}var qv_,Ok=(q)=>{return new Promise(($)=>setTimeout($,q))};var $v_=e9(()=>{_v_();qv_=class qv_ extends Error{constructor(q=[]){super();let $=q.find((w)=>w.name)?.name??"";this.name=`AggregateError(${$}...)`,this.message=`AggregateError with ${q.length} errors`,this.stack=q.find((w)=>w.stack)?.stack??this.stack,this.errors=q}}});var QE6=(q,$,w,f)=>{return function(...z){let P=w?w(...z):JSON.stringify({args:z}),D=q[P];if(D!==void 0){if(!D.exp)return D.value;if(D.exp>new Date().getTime())return D.value}let Y=$(...z);return q[P]={exp:f?new Date().getTime()+f:null,value:Y},Y}},Wk=(q,$={})=>{return QE6({},q,$.key??null,$.ttl??null)};var wv_=()=>{};var vk=(q)=>{if(!q)return{};return Object.keys(q).reduce((w,f)=>{return w[q[f]]=f,w},{})};var fv_=()=>{};var Tk=(q,$)=>{return Math.floor(Math.random()*($-q+1)+q)},tf=(q)=>{return q.map(($)=>({rand:Math.random(),value:$})).sort(($,w)=>$.rand-w.rand).map(($)=>$.value)};var Kv_=()=>{};var zv_=(q)=>{if(!q||q.length===0)return"";let $=q.toLowerCase();return $.substring(0,1).toUpperCase()+$.substring(1,$.length)},gd=(q)=>{if(!q)return"";return q.split(/(?=[A-Z])|[\.\-\s_]/).map(($)=>$.trim()).filter(($)=>!!$).map(($)=>zv_($.toLowerCase())).join(" ")};var Pv_=()=>{};var sq=e9(()=>{$v_();wv_();fv_();Kv_();Pv_()});var _A={};E1(_A,{proglangNames:()=>P4,proglangKeys:()=>p$,proglangExtensions:()=>Rd,languageNames:()=>l6,languageKeys:()=>J9});var l6,J9,P4,Rd,p$;var Yq=e9(()=>{sq();l6={en:"English",ca:"Catalan",es:"Spanish",fr:"French",de:"German"},J9=Object.keys(l6),P4={c:"C",cc:"C++",py:"Python3",hs:"GHC",clj:"Clojure",java:"Java",rs:"Rust",v:"Verilog",R:"R",tar:"MakePRO2"},Rd=vk(P4),p$=Object.keys(P4)});var Av_=G((Pb8,Gv_)=>{var Dg6=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],Yg6=["B","kiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],Jg6=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],Hg6=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],jv_=(q,$,w)=>{let f=q;if(typeof $==="string"||Array.isArray($))f=q.toLocaleString($,w);else if($===!0||w!==void 0)f=q.toLocaleString(void 0,w);return f};Gv_.exports=(q,$)=>{if(!Number.isFinite(q))throw TypeError(`Expected a finite number, got ${typeof q}: ${q}`);$=Object.assign({bits:!1,binary:!1},$);let w=$.bits?$.binary?Hg6:Jg6:$.binary?Yg6:Dg6;if($.signed&&q===0)return` 0 ${w[0]}`;let f=q<0,K=f?"-":$.signed?"+":"";if(f)q=-q;let z;if($.minimumFractionDigits!==void 0)z={minimumFractionDigits:$.minimumFractionDigits};if($.maximumFractionDigits!==void 0)z=Object.assign({maximumFractionDigits:$.maximumFractionDigits},z);if(q<1){let J=jv_(q,$.locale,z);return K+J+" "+w[0]}let P=Math.min(Math.floor($.binary?Math.log(q)/Math.log(1024):Math.log10(q)/3),w.length-1);if(q/=Math.pow($.binary?1024:1000,P),!z)q=q.toPrecision(3);let D=jv_(Number(q),$.locale,z),Y=w[P];return K+D+" "+Y}});var Cv_=G((Db8,uv_)=>{var __dirname="/
|
|
219
|
+
`,$};C4.prototype.Program=function(q){var $="",w=q.body,f=void 0,K=void 0;if(q.blockParams){var z="BLOCK PARAMS: [";for(f=0,K=q.blockParams.length;f<K;f++)z+=" "+q.blockParams[f];z+=" ]",$+=this.pad(z)}for(f=0,K=w.length;f<K;f++)$+=this.accept(w[f]);return this.padding--,$};C4.prototype.MustacheStatement=function(q){return this.pad("{{ "+this.SubExpression(q)+" }}")};C4.prototype.Decorator=function(q){return this.pad("{{ DIRECTIVE "+this.SubExpression(q)+" }}")};C4.prototype.BlockStatement=C4.prototype.DecoratorBlock=function(q){var $="";if($+=this.pad((q.type==="DecoratorBlock"?"DIRECTIVE ":"")+"BLOCK:"),this.padding++,$+=this.pad(this.SubExpression(q)),q.program)$+=this.pad("PROGRAM:"),this.padding++,$+=this.accept(q.program),this.padding--;if(q.inverse){if(q.program)this.padding++;if($+=this.pad("{{^}}"),this.padding++,$+=this.accept(q.inverse),this.padding--,q.program)this.padding--}return this.padding--,$};C4.prototype.PartialStatement=function(q){var $="PARTIAL:"+q.name.original;if(q.params[0])$+=" "+this.accept(q.params[0]);if(q.hash)$+=" "+this.accept(q.hash);return this.pad("{{> "+$+" }}")};C4.prototype.PartialBlockStatement=function(q){var $="PARTIAL BLOCK:"+q.name.original;if(q.params[0])$+=" "+this.accept(q.params[0]);if(q.hash)$+=" "+this.accept(q.hash);return $+=" "+this.pad("PROGRAM:"),this.padding++,$+=this.accept(q.program),this.padding--,this.pad("{{> "+$+" }}")};C4.prototype.ContentStatement=function(q){return this.pad("CONTENT[ '"+q.value+"' ]")};C4.prototype.CommentStatement=function(q){return this.pad("{{! '"+q.value+"' }}")};C4.prototype.SubExpression=function(q){var $=q.params,w=[],f=void 0;for(var K=0,z=$.length;K<z;K++)w.push(this.accept($[K]));return $="["+w.join(", ")+"]",f=q.hash?" "+this.accept(q.hash):"",this.accept(q.path)+" "+$+f};C4.prototype.PathExpression=function(q){var $=q.parts.join("/");return(q.data?"@":"")+"PATH:"+$};C4.prototype.StringLiteral=function(q){return'"'+q.value+'"'};C4.prototype.NumberLiteral=function(q){return"NUMBER{"+q.value+"}"};C4.prototype.BooleanLiteral=function(q){return"BOOLEAN{"+q.value+"}"};C4.prototype.UndefinedLiteral=function(){return"UNDEFINED"};C4.prototype.NullLiteral=function(){return"NULL"};C4.prototype.Hash=function(q){var $=q.pairs,w=[];for(var f=0,K=$.length;f<K;f++)w.push(this.accept($[f]));return"HASH{"+w.join(", ")+"}"};C4.prototype.HashPair=function(q){return q.key+"="+this.accept(q.value)}});var Jk=G((PN8,oO_)=>{var yG=nO_().default,FO_=aO_();yG.PrintVisitor=FO_.PrintVisitor;yG.print=FO_.print;oO_.exports=yG;function BO_(q,$){var w=H_("fs"),f=w.readFileSync($,"utf8");q.exports=yG.compile(f)}if(H_.extensions)H_.extensions[".handlebars"]=BO_,H_.extensions[".hbs"]=BO_});var Ed;var _v_=e9(()=>{Ed=Array.isArray});async function kD(q){let $=Ed(q)?q.map((K)=>[null,K]):Object.entries(q),w=await Promise.all($.map(([K,z])=>z.then((P)=>({result:P,exc:null,key:K})).catch((P)=>({result:null,exc:P,key:K})))),f=w.filter((K)=>K.exc);if(f.length>0)throw new qv_(f.map((K)=>K.exc));if(Ed(q))return w.map((K)=>K.result);return w.reduce((K,z)=>({...K,[z.key]:z.result}),{})}var qv_,Ok=(q)=>{return new Promise(($)=>setTimeout($,q))};var $v_=e9(()=>{_v_();qv_=class qv_ extends Error{constructor(q=[]){super();let $=q.find((w)=>w.name)?.name??"";this.name=`AggregateError(${$}...)`,this.message=`AggregateError with ${q.length} errors`,this.stack=q.find((w)=>w.stack)?.stack??this.stack,this.errors=q}}});var QE6=(q,$,w,f)=>{return function(...z){let P=w?w(...z):JSON.stringify({args:z}),D=q[P];if(D!==void 0){if(!D.exp)return D.value;if(D.exp>new Date().getTime())return D.value}let Y=$(...z);return q[P]={exp:f?new Date().getTime()+f:null,value:Y},Y}},Wk=(q,$={})=>{return QE6({},q,$.key??null,$.ttl??null)};var wv_=()=>{};var vk=(q)=>{if(!q)return{};return Object.keys(q).reduce((w,f)=>{return w[q[f]]=f,w},{})};var fv_=()=>{};var Tk=(q,$)=>{return Math.floor(Math.random()*($-q+1)+q)},tf=(q)=>{return q.map(($)=>({rand:Math.random(),value:$})).sort(($,w)=>$.rand-w.rand).map(($)=>$.value)};var Kv_=()=>{};var zv_=(q)=>{if(!q||q.length===0)return"";let $=q.toLowerCase();return $.substring(0,1).toUpperCase()+$.substring(1,$.length)},gd=(q)=>{if(!q)return"";return q.split(/(?=[A-Z])|[\.\-\s_]/).map(($)=>$.trim()).filter(($)=>!!$).map(($)=>zv_($.toLowerCase())).join(" ")};var Pv_=()=>{};var sq=e9(()=>{$v_();wv_();fv_();Kv_();Pv_()});var _A={};E1(_A,{proglangNames:()=>P4,proglangKeys:()=>p$,proglangExtensions:()=>Rd,languageNames:()=>l6,languageKeys:()=>J9});var l6,J9,P4,Rd,p$;var Yq=e9(()=>{sq();l6={en:"English",ca:"Catalan",es:"Spanish",fr:"French",de:"German"},J9=Object.keys(l6),P4={c:"C",cc:"C++",py:"Python3",hs:"GHC",clj:"Clojure",java:"Java",rs:"Rust",v:"Verilog",R:"R",tar:"MakePRO2"},Rd=vk(P4),p$=Object.keys(P4)});var Av_=G((Pb8,Gv_)=>{var Dg6=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],Yg6=["B","kiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],Jg6=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],Hg6=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],jv_=(q,$,w)=>{let f=q;if(typeof $==="string"||Array.isArray($))f=q.toLocaleString($,w);else if($===!0||w!==void 0)f=q.toLocaleString(void 0,w);return f};Gv_.exports=(q,$)=>{if(!Number.isFinite(q))throw TypeError(`Expected a finite number, got ${typeof q}: ${q}`);$=Object.assign({bits:!1,binary:!1},$);let w=$.bits?$.binary?Hg6:Jg6:$.binary?Yg6:Dg6;if($.signed&&q===0)return` 0 ${w[0]}`;let f=q<0,K=f?"-":$.signed?"+":"";if(f)q=-q;let z;if($.minimumFractionDigits!==void 0)z={minimumFractionDigits:$.minimumFractionDigits};if($.maximumFractionDigits!==void 0)z=Object.assign({maximumFractionDigits:$.maximumFractionDigits},z);if(q<1){let J=jv_(q,$.locale,z);return K+J+" "+w[0]}let P=Math.min(Math.floor($.binary?Math.log(q)/Math.log(1024):Math.log10(q)/3),w.length-1);if(q/=Math.pow($.binary?1024:1000,P),!z)q=q.toPrecision(3);let D=jv_(Number(q),$.locale,z),Y=w[P];return K+D+" "+Y}});var Cv_=G((Db8,uv_)=>{var __dirname="/Users/jpetit/Projectes/jutge-toolkit/node_modules/fast-folder-size",Zg6=H_("path"),kg6={win32:`"${Zg6.join(__dirname,"bin","du.exe")}" -nobanner -accepteula -q -c .`,darwin:"du -sk .",linux:"du -sb ."},Og6={win32(q){return+q.split(`
|
|
220
220
|
`)[1].split(",").slice(-2)[0]},darwin(q){let $=/^(\d+)/.exec(q);return Number($[1])*1024},linux(q){let $=/^(\d+)/.exec(q);return Number($[1])}};uv_.exports={commands:kg6,processOutput:Og6}});var hv_=G((Yb8,Nv_)=>{var{execSync:Wg6}=H_("child_process"),{commands:Vv_,processOutput:Mv_}=Cv_();function vg6(q){let $=Vv_[process.platform]||Vv_.linux,w=Wg6($,{cwd:q}).toString();return(Mv_[process.platform]||Mv_.linux)(w)}Nv_.exports=vg6});var XD=G((Jb8,Rv_)=>{var vD=H_("fs"),TD=H_("path"),Tg6=Av_(),Xg6=hv_(),jg6={allFiles:!1,dirsFirst:!1,dirsOnly:!1,sizes:!1,exclude:[],maxDepth:Number.POSITIVE_INFINITY,reverse:!1,trailingSlash:!1,ascii:!1},Gg6={BRANCH:"\u251C\u2500\u2500 ",EMPTY:"",INDENT:" ",LAST_BRANCH:"\u2514\u2500\u2500 ",VERTICAL:"\u2502 "},Ag6={BRANCH:"|-- ",EMPTY:"",INDENT:" ",LAST_BRANCH:"`-- ",VERTICAL:"| "},Ev_=[/\.DS_Store/];function ug6(q){return q[0]==="."}function gv_(q,$,w,f,K,z){let P=vD.lstatSync($).isDirectory(),D=!P,Y=[],J=K.ascii?Ag6:Gg6;for(let W=0;W<Ev_.length;W++)if(Ev_[W].test($))return Y;if(D&&K.dirsOnly)return Y;for(let W=0;W<K.exclude.length;W++)if(K.exclude[W].test($))return Y;if(w>K.maxDepth)return Y;let Z=[f];if(w>=1)Z.push(z?J.LAST_BRANCH:J.BRANCH);if(K.sizes){let W=P?Xg6($):vD.statSync($).size,v=Tg6(W);Z.push(v.replace(" ","")),Z.push(" ")}if(Z.push(q),P&&K.trailingSlash)Z.push("/");if(Y.push(Z.join("")),D)return Y;let k=vD.readdirSync($);if(k.sort(),K.reverse)k.reverse();if(!K.allFiles)k=k.filter((W)=>!ug6(W));if(K.dirsOnly)k=k.filter((W)=>vD.lstatSync(TD.join($,W)).isDirectory());if(K.dirsFirst){let W=k.filter((X)=>vD.lstatSync(TD.join($,X)).isDirectory()),v=k.filter((X)=>!vD.lstatSync(TD.join($,X)).isDirectory());k=[].concat(W,v)}return k.forEach((W,v)=>{let X=v===k.length-1,j=gv_(W,TD.join($,W),w+1,f+(w>=1?z?J.INDENT:J.VERTICAL:J.EMPTY),K,X);Y.push.apply(Y,j)}),Y}function Cg6(q,$){let w=Object.assign({},jg6,$);return gv_(TD.basename(TD.join(process.cwd(),q)),q,0,"",w).join(`
|
|
221
221
|
`)}Rv_.exports=Cg6});var cd=G((Ab8,mv_)=>{mv_.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var KA=G((cv_)=>{var Lv_={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function Ng6(q){return function(...$){if($.length)q=q.replace(/\{(\d)\}/g,(w,f)=>$[f]||"");return Error("ADM-ZIP: "+q)}}for(let q of Object.keys(Lv_))cv_[q]=Ng6(Lv_[q])});var pv_=G((Cb8,rv_)=>{var hg6=H_("fs"),_3=H_("path"),xv_=cd(),Eg6=KA(),gg6=typeof process==="object"&&process.platform==="win32",dv_=(q)=>typeof q==="object"&&q!==null,lv_=new Uint32Array(256).map((q,$)=>{for(let w=0;w<8;w++)if(($&1)!==0)$=3988292384^$>>>1;else $>>>=1;return $>>>0});function V4(q){if(this.sep=_3.sep,this.fs=hg6,dv_(q)){if(dv_(q.fs)&&typeof q.fs.statSync==="function")this.fs=q.fs}}rv_.exports=V4;V4.prototype.makeDir=function(q){let $=this;function w(f){let K=f.split($.sep)[0];f.split($.sep).forEach(function(z){if(!z||z.substr(-1,1)===":")return;K+=$.sep+z;var P;try{P=$.fs.statSync(K)}catch(D){$.fs.mkdirSync(K)}if(P&&P.isFile())throw Eg6.FILE_IN_THE_WAY(`"${K}"`)})}w(q)};V4.prototype.writeFileTo=function(q,$,w,f){let K=this;if(K.fs.existsSync(q)){if(!w)return!1;var z=K.fs.statSync(q);if(z.isDirectory())return!1}var P=_3.dirname(q);if(!K.fs.existsSync(P))K.makeDir(P);var D;try{D=K.fs.openSync(q,"w",438)}catch(Y){K.fs.chmodSync(q,438),D=K.fs.openSync(q,"w",438)}if(D)try{K.fs.writeSync(D,$,0,$.length,0)}finally{K.fs.closeSync(D)}return K.fs.chmodSync(q,f||438),!0};V4.prototype.writeFileToAsync=function(q,$,w,f,K){if(typeof f==="function")K=f,f=void 0;let z=this;z.fs.exists(q,function(P){if(P&&!w)return K(!1);z.fs.stat(q,function(D,Y){if(P&&Y.isDirectory())return K(!1);var J=_3.dirname(q);z.fs.exists(J,function(Z){if(!Z)z.makeDir(J);z.fs.open(q,"w",438,function(k,W){if(k)z.fs.chmod(q,438,function(){z.fs.open(q,"w",438,function(v,X){z.fs.write(X,$,0,$.length,0,function(){z.fs.close(X,function(){z.fs.chmod(q,f||438,function(){K(!0)})})})})});else if(W)z.fs.write(W,$,0,$.length,0,function(){z.fs.close(W,function(){z.fs.chmod(q,f||438,function(){K(!0)})})});else z.fs.chmod(q,f||438,function(){K(!0)})})})})})};V4.prototype.findFiles=function(q){let $=this;function w(f,K,z){if(typeof K==="boolean")z=K,K=void 0;let P=[];return $.fs.readdirSync(f).forEach(function(D){let Y=_3.join(f,D),J=$.fs.statSync(Y);if(!K||K.test(Y))P.push(_3.normalize(Y)+(J.isDirectory()?$.sep:""));if(J.isDirectory()&&z)P=P.concat(w(Y,K,z))}),P}return w(q,void 0,!0)};V4.prototype.findFilesAsync=function(q,$){let w=this,f=[];w.fs.readdir(q,function(K,z){if(K)return $(K);let P=z.length;if(!P)return $(null,f);z.forEach(function(D){D=_3.join(q,D),w.fs.stat(D,function(Y,J){if(Y)return $(Y);if(J){if(f.push(_3.normalize(D)+(J.isDirectory()?w.sep:"")),J.isDirectory())w.findFilesAsync(D,function(Z,k){if(Z)return $(Z);if(f=f.concat(k),!--P)$(null,f)});else if(!--P)$(null,f)}})})})};V4.prototype.getAttributes=function(){};V4.prototype.setAttributes=function(){};V4.crc32update=function(q,$){return lv_[(q^$)&255]^q>>>8};V4.crc32=function(q){if(typeof q==="string")q=Buffer.from(q,"utf8");let $=q.length,w=-1;for(let f=0;f<$;)w=V4.crc32update(w,q[f++]);return~w>>>0};V4.methodToString=function(q){switch(q){case xv_.STORED:return"STORED ("+q+")";case xv_.DEFLATED:return"DEFLATED ("+q+")";default:return"UNSUPPORTED ("+q+")"}};V4.canonical=function(q){if(!q)return"";let $=_3.posix.normalize("/"+q.split("\\").join("/"));return _3.join(".",$)};V4.zipnamefix=function(q){if(!q)return"";let $=_3.posix.normalize("/"+q.split("\\").join("/"));return _3.posix.join(".",$)};V4.findLast=function(q,$){if(!Array.isArray(q))throw TypeError("arr is not array");let w=q.length>>>0;for(let f=w-1;f>=0;f--)if($(q[f],f,q))return q[f];return};V4.sanitize=function(q,$){q=_3.resolve(_3.normalize(q));var w=$.split("/");for(var f=0,K=w.length;f<K;f++){var z=_3.normalize(_3.join(q,w.slice(f,K).join(_3.sep)));if(z.indexOf(q)===0)return z}return _3.normalize(_3.join(q,_3.basename($)))};V4.toBuffer=function($,w){if(Buffer.isBuffer($))return $;else if($ instanceof Uint8Array)return Buffer.from($);else return typeof $==="string"?w($):Buffer.alloc(0)};V4.readBigUInt64LE=function(q,$){var w=Buffer.from(q.slice($,$+8));return w.swap64(),parseInt(`0x${w.toString("hex")}`)};V4.fromDOS2Date=function(q){return new Date((q>>25&127)+1980,Math.max((q>>21&15)-1,0),Math.max(q>>16&31,1),q>>11&31,q>>5&63,(q&31)<<1)};V4.fromDate2DOS=function(q){let $=0,w=0;if(q.getFullYear()>1979)$=(q.getFullYear()-1980&127)<<9|q.getMonth()+1<<5|q.getDate(),w=q.getHours()<<11|q.getMinutes()<<5|q.getSeconds()>>1;return $<<16|w};V4.isWin=gg6;V4.crcTable=lv_});var nv_=G((Vb8,iv_)=>{var Rg6=H_("path");iv_.exports=function(q,{fs:$}){var w=q||"",f=z(),K=null;function z(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}if(w&&$.existsSync(w))K=$.statSync(w),f.directory=K.isDirectory(),f.mtime=K.mtime,f.atime=K.atime,f.executable=(73&K.mode)!==0,f.readonly=(128&K.mode)===0,f.hidden=Rg6.basename(w)[0]===".";else console.warn("Invalid path: "+w);return{get directory(){return f.directory},get readOnly(){return f.readonly},get hidden(){return f.hidden},get mtime(){return f.mtime},get atime(){return f.atime},get executable(){return f.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:w,isDirectory:f.directory,isReadOnly:f.readonly,isHidden:f.hidden,isExecutable:f.executable,mTime:f.mtime,aTime:f.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var Bv_=G((Mb8,av_)=>{av_.exports={efs:!0,encode:(q)=>Buffer.from(q,"utf8"),decode:(q)=>q.toString("utf8")}});var GD=G((Nb8,jD)=>{jD.exports=pv_();jD.exports.Constants=cd();jD.exports.Errors=KA();jD.exports.FileAttr=nv_();jD.exports.decoder=Bv_()});var ov_=G((hb8,Fv_)=>{var p5=GD(),l_=p5.Constants;Fv_.exports=function(){var q=20,$=10,w=0,f=0,K=0,z=0,P=0,D=0,Y=0,J=0,Z=0,k=0,W=0,v=0,X=0;q|=p5.isWin?2560:768,w|=l_.FLG_EFS;let j={extraLen:0},A=(V)=>Math.max(0,V)>>>0,C=(V)=>Math.max(0,V)&65535,N=(V)=>Math.max(0,V)&255;return K=p5.fromDate2DOS(new Date),{get made(){return q},set made(V){q=V},get version(){return $},set version(V){$=V},get flags(){return w},set flags(V){w=V},get flags_efs(){return(w&l_.FLG_EFS)>0},set flags_efs(V){if(V)w|=l_.FLG_EFS;else w&=~l_.FLG_EFS},get flags_desc(){return(w&l_.FLG_DESC)>0},set flags_desc(V){if(V)w|=l_.FLG_DESC;else w&=~l_.FLG_DESC},get method(){return f},set method(V){switch(V){case l_.STORED:this.version=10;case l_.DEFLATED:default:this.version=20}f=V},get time(){return p5.fromDOS2Date(this.timeval)},set time(V){this.timeval=p5.fromDate2DOS(V)},get timeval(){return K},set timeval(V){K=A(V)},get timeHighByte(){return N(K>>>8)},get crc(){return z},set crc(V){z=A(V)},get compressedSize(){return P},set compressedSize(V){P=A(V)},get size(){return D},set size(V){D=A(V)},get fileNameLength(){return Y},set fileNameLength(V){Y=V},get extraLength(){return J},set extraLength(V){J=V},get extraLocalLength(){return j.extraLen},set extraLocalLength(V){j.extraLen=V},get commentLength(){return Z},set commentLength(V){Z=V},get diskNumStart(){return k},set diskNumStart(V){k=A(V)},get inAttr(){return W},set inAttr(V){W=A(V)},get attr(){return v},set attr(V){v=A(V)},get fileAttr(){return(v||0)>>16&4095},get offset(){return X},set offset(V){X=A(V)},get encrypted(){return(w&l_.FLG_ENC)===l_.FLG_ENC},get centralHeaderSize(){return l_.CENHDR+Y+J+Z},get realDataOffset(){return X+l_.LOCHDR+j.fnameLen+j.extraLen},get localHeader(){return j},loadLocalHeaderFromBinary:function(V){var E=V.slice(X,X+l_.LOCHDR);if(E.readUInt32LE(0)!==l_.LOCSIG)throw p5.Errors.INVALID_LOC();j.version=E.readUInt16LE(l_.LOCVER),j.flags=E.readUInt16LE(l_.LOCFLG),j.method=E.readUInt16LE(l_.LOCHOW),j.time=E.readUInt32LE(l_.LOCTIM),j.crc=E.readUInt32LE(l_.LOCCRC),j.compressedSize=E.readUInt32LE(l_.LOCSIZ),j.size=E.readUInt32LE(l_.LOCLEN),j.fnameLen=E.readUInt16LE(l_.LOCNAM),j.extraLen=E.readUInt16LE(l_.LOCEXT);let R=X+l_.LOCHDR+j.fnameLen,b=R+j.extraLen;return V.slice(R,b)},loadFromBinary:function(V){if(V.length!==l_.CENHDR||V.readUInt32LE(0)!==l_.CENSIG)throw p5.Errors.INVALID_CEN();q=V.readUInt16LE(l_.CENVEM),$=V.readUInt16LE(l_.CENVER),w=V.readUInt16LE(l_.CENFLG),f=V.readUInt16LE(l_.CENHOW),K=V.readUInt32LE(l_.CENTIM),z=V.readUInt32LE(l_.CENCRC),P=V.readUInt32LE(l_.CENSIZ),D=V.readUInt32LE(l_.CENLEN),Y=V.readUInt16LE(l_.CENNAM),J=V.readUInt16LE(l_.CENEXT),Z=V.readUInt16LE(l_.CENCOM),k=V.readUInt16LE(l_.CENDSK),W=V.readUInt16LE(l_.CENATT),v=V.readUInt32LE(l_.CENATX),X=V.readUInt32LE(l_.CENOFF)},localHeaderToBinary:function(){var V=Buffer.alloc(l_.LOCHDR);return V.writeUInt32LE(l_.LOCSIG,0),V.writeUInt16LE($,l_.LOCVER),V.writeUInt16LE(w,l_.LOCFLG),V.writeUInt16LE(f,l_.LOCHOW),V.writeUInt32LE(K,l_.LOCTIM),V.writeUInt32LE(z,l_.LOCCRC),V.writeUInt32LE(P,l_.LOCSIZ),V.writeUInt32LE(D,l_.LOCLEN),V.writeUInt16LE(Y,l_.LOCNAM),V.writeUInt16LE(j.extraLen,l_.LOCEXT),V},centralHeaderToBinary:function(){var V=Buffer.alloc(l_.CENHDR+Y+J+Z);return V.writeUInt32LE(l_.CENSIG,0),V.writeUInt16LE(q,l_.CENVEM),V.writeUInt16LE($,l_.CENVER),V.writeUInt16LE(w,l_.CENFLG),V.writeUInt16LE(f,l_.CENHOW),V.writeUInt32LE(K,l_.CENTIM),V.writeUInt32LE(z,l_.CENCRC),V.writeUInt32LE(P,l_.CENSIZ),V.writeUInt32LE(D,l_.CENLEN),V.writeUInt16LE(Y,l_.CENNAM),V.writeUInt16LE(J,l_.CENEXT),V.writeUInt16LE(Z,l_.CENCOM),V.writeUInt16LE(k,l_.CENDSK),V.writeUInt16LE(W,l_.CENATT),V.writeUInt32LE(v,l_.CENATX),V.writeUInt32LE(X,l_.CENOFF),V},toJSON:function(){let V=function(E){return E+" bytes"};return{made:q,version:$,flags:w,method:p5.methodToString(f),time:this.time,crc:"0x"+z.toString(16).toUpperCase(),compressedSize:V(P),size:V(D),fileNameLength:V(Y),extraLength:V(J),commentLength:V(Z),diskNumStart:k,inAttr:W,attr:v,offset:X,centralHeaderSize:V(l_.CENHDR+Y+J+Z)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var Qv_=G((Eb8,Uv_)=>{var AD=GD(),W4=AD.Constants;Uv_.exports=function(){var q=0,$=0,w=0,f=0,K=0;return{get diskEntries(){return q},set diskEntries(z){q=$=z},get totalEntries(){return $},set totalEntries(z){$=q=z},get size(){return w},set size(z){w=z},get offset(){return f},set offset(z){f=z},get commentLength(){return K},set commentLength(z){K=z},get mainHeaderSize(){return W4.ENDHDR+K},loadFromBinary:function(z){if((z.length!==W4.ENDHDR||z.readUInt32LE(0)!==W4.ENDSIG)&&(z.length<W4.ZIP64HDR||z.readUInt32LE(0)!==W4.ZIP64SIG))throw AD.Errors.INVALID_END();if(z.readUInt32LE(0)===W4.ENDSIG)q=z.readUInt16LE(W4.ENDSUB),$=z.readUInt16LE(W4.ENDTOT),w=z.readUInt32LE(W4.ENDSIZ),f=z.readUInt32LE(W4.ENDOFF),K=z.readUInt16LE(W4.ENDCOM);else q=AD.readBigUInt64LE(z,W4.ZIP64SUB),$=AD.readBigUInt64LE(z,W4.ZIP64TOT),w=AD.readBigUInt64LE(z,W4.ZIP64SIZE),f=AD.readBigUInt64LE(z,W4.ZIP64OFF),K=0},toBinary:function(){var z=Buffer.alloc(W4.ENDHDR+K);return z.writeUInt32LE(W4.ENDSIG,0),z.writeUInt32LE(0,4),z.writeUInt16LE(q,W4.ENDSUB),z.writeUInt16LE($,W4.ENDTOT),z.writeUInt32LE(w,W4.ENDSIZ),z.writeUInt32LE(f,W4.ENDOFF),z.writeUInt16LE(K,W4.ENDCOM),z.fill(" ",W4.ENDHDR),z},toJSON:function(){let z=function(P,D){let Y=P.toString(16).toUpperCase();while(Y.length<D)Y="0"+Y;return"0x"+Y};return{diskEntries:q,totalEntries:$,size:w+" bytes",offset:z(f,4),commentLength:K}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var xd=G((bg6)=>{bg6.EntryHeader=ov_();bg6.MainHeader=Qv_()});var ev_=G((Rb8,tv_)=>{tv_.exports=function(q){var $=H_("zlib"),w={chunkSize:(parseInt(q.length/1024)+1)*1024};return{deflate:function(){return $.deflateRawSync(q,w)},deflateAsync:function(f){var K=$.createDeflateRaw(w),z=[],P=0;K.on("data",function(D){z.push(D),P+=D.length}),K.on("end",function(){var D=Buffer.alloc(P),Y=0;D.fill(0);for(var J=0;J<z.length;J++){var Z=z[J];Z.copy(D,Y),Y+=Z.length}f&&f(D)}),K.end(q)}}}});var _0_=G((bb8,sv_)=>{var Sg6=+(process.versions?process.versions.node:"").split(".")[0]||0;sv_.exports=function(q,$){var w=H_("zlib");let f=Sg6>=15&&$>0?{maxOutputLength:$}:{};return{inflate:function(){return w.inflateRawSync(q,f)},inflateAsync:function(K){var z=w.createInflateRaw(f),P=[],D=0;z.on("data",function(Y){P.push(Y),D+=Y.length}),z.on("end",function(){var Y=Buffer.alloc(D),J=0;Y.fill(0);for(var Z=0;Z<P.length;Z++){var k=P[Z];k.copy(Y,J),J+=k.length}K&&K(Y)}),z.end(q)}}}});var K0_=G((Ib8,f0_)=>{var{randomFillSync:q0_}=H_("crypto"),mg6=KA(),Lg6=new Uint32Array(256).map((q,$)=>{for(let w=0;w<8;w++)if(($&1)!==0)$=$>>>1^3988292384;else $>>>=1;return $>>>0}),w0_=(q,$)=>Math.imul(q,$)>>>0,$0_=(q,$)=>{return Lg6[(q^$)&255]^q>>>8},uk=()=>{if(typeof q0_==="function")return q0_(Buffer.alloc(12));else return uk.node()};uk.node=()=>{let q=Buffer.alloc(12),$=q.length;for(let w=0;w<$;w++)q[w]=Math.random()*256&255;return q};var zA={genSalt:uk};function PA(q){let $=Buffer.isBuffer(q)?q:Buffer.from(q);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let w=0;w<$.length;w++)this.updateKeys($[w])}PA.prototype.updateKeys=function(q){let $=this.keys;return $[0]=$0_($[0],q),$[1]+=$[0]&255,$[1]=w0_($[1],134775813)+1,$[2]=$0_($[2],$[1]>>>24),q};PA.prototype.next=function(){let q=(this.keys[2]|2)>>>0;return w0_(q,q^1)>>8&255};function cg6(q){let $=new PA(q);return function(w){let f=Buffer.alloc(w.length),K=0;for(let z of w)f[K++]=$.updateKeys(z^$.next());return f}}function xg6(q){let $=new PA(q);return function(w,f,K=0){if(!f)f=Buffer.alloc(w.length);for(let z of w){let P=$.next();f[K++]=z^P,$.updateKeys(z)}return f}}function dg6(q,$,w){if(!q||!Buffer.isBuffer(q)||q.length<12)return Buffer.alloc(0);let f=cg6(w),K=f(q.slice(0,12)),z=($.flags&8)===8?$.timeHighByte:$.crc>>>24;if(K[11]!==z)throw mg6.WRONG_PASSWORD();return f(q.slice(12))}function lg6(q){if(Buffer.isBuffer(q)&&q.length>=12)zA.genSalt=function(){return q.slice(0,12)};else if(q==="node")zA.genSalt=uk.node;else zA.genSalt=uk}function rg6(q,$,w,f=!1){if(q==null)q=Buffer.alloc(0);if(!Buffer.isBuffer(q))q=Buffer.from(q.toString());let K=xg6(w),z=zA.genSalt();if(z[11]=$.crc>>>24&255,f)z[10]=$.crc>>>16&255;let P=Buffer.alloc(q.length+12);return K(z,P),K(q,P,12)}f0_.exports={decrypt:dg6,encrypt:rg6,_salter:lg6}});var z0_=G((pg6)=>{pg6.Deflater=ev_();pg6.Inflater=_0_();pg6.ZipCrypto=K0_()});var ld=G((Sb8,P0_)=>{var h8=GD(),Bg6=xd(),M4=h8.Constants,dd=z0_();P0_.exports=function(q,$){var w=new Bg6.EntryHeader,f=Buffer.alloc(0),K=Buffer.alloc(0),z=!1,P=null,D=Buffer.alloc(0),Y=Buffer.alloc(0),J=!0;let Z=q,k=typeof Z.decoder==="object"?Z.decoder:h8.decoder;J=k.hasOwnProperty("efs")?k.efs:!1;function W(){if(!$||!($ instanceof Uint8Array))return Buffer.alloc(0);return Y=w.loadLocalHeaderFromBinary($),$.slice(w.realDataOffset,w.realDataOffset+w.compressedSize)}function v(V){if(!w.flags_desc){if(h8.crc32(V)!==w.localHeader.crc)return!1}else{let E={},R=w.realDataOffset+w.compressedSize;if($.readUInt32LE(R)==M4.LOCSIG||$.readUInt32LE(R)==M4.CENSIG)throw h8.Errors.DESCRIPTOR_NOT_EXIST();if($.readUInt32LE(R)==M4.EXTSIG)E.crc=$.readUInt32LE(R+M4.EXTCRC),E.compressedSize=$.readUInt32LE(R+M4.EXTSIZ),E.size=$.readUInt32LE(R+M4.EXTLEN);else if($.readUInt16LE(R+12)===19280)E.crc=$.readUInt32LE(R+M4.EXTCRC-4),E.compressedSize=$.readUInt32LE(R+M4.EXTSIZ-4),E.size=$.readUInt32LE(R+M4.EXTLEN-4);else throw h8.Errors.DESCRIPTOR_UNKNOWN();if(E.compressedSize!==w.compressedSize||E.size!==w.size||E.crc!==w.crc)throw h8.Errors.DESCRIPTOR_FAULTY();if(h8.crc32(V)!==E.crc)return!1}return!0}function X(V,E,R){if(typeof E>"u"&&typeof V==="string")R=V,V=void 0;if(z){if(V&&E)E(Buffer.alloc(0),h8.Errors.DIRECTORY_CONTENT_ERROR());return Buffer.alloc(0)}var b=W();if(b.length===0){if(V&&E)E(b);return b}if(w.encrypted){if(typeof R!=="string"&&!Buffer.isBuffer(R))throw h8.Errors.INVALID_PASS_PARAM();b=dd.ZipCrypto.decrypt(b,w,R)}var S=Buffer.alloc(w.size);switch(w.method){case h8.Constants.STORED:if(b.copy(S),!v(S)){if(V&&E)E(S,h8.Errors.BAD_CRC());throw h8.Errors.BAD_CRC()}else{if(V&&E)E(S);return S}case h8.Constants.DEFLATED:var i=new dd.Inflater(b,w.size);if(!V){if(i.inflate(S).copy(S,0),!v(S))throw h8.Errors.BAD_CRC(`"${k.decode(f)}"`);return S}else i.inflateAsync(function(y){if(y.copy(y,0),E)if(!v(y))E(y,h8.Errors.BAD_CRC());else E(y)});break;default:if(V&&E)E(Buffer.alloc(0),h8.Errors.UNKNOWN_METHOD());throw h8.Errors.UNKNOWN_METHOD()}}function j(V,E){if((!P||!P.length)&&Buffer.isBuffer($)){if(V&&E)E(W());return W()}if(P.length&&!z){var R;switch(w.method){case h8.Constants.STORED:if(w.compressedSize=w.size,R=Buffer.alloc(P.length),P.copy(R),V&&E)E(R);return R;default:case h8.Constants.DEFLATED:var b=new dd.Deflater(P);if(!V){var S=b.deflate();return w.compressedSize=S.length,S}else b.deflateAsync(function(i){R=Buffer.alloc(i.length),w.compressedSize=i.length,i.copy(R),E&&E(R)});b=null;break}}else if(V&&E)E(Buffer.alloc(0));else return Buffer.alloc(0)}function A(V,E){return(V.readUInt32LE(E+4)<<4)+V.readUInt32LE(E)}function C(V){try{var E=0,R,b,S;while(E+4<V.length)if(R=V.readUInt16LE(E),E+=2,b=V.readUInt16LE(E),E+=2,S=V.slice(E,E+b),E+=b,M4.ID_ZIP64===R)N(S)}catch(i){throw h8.Errors.EXTRA_FIELD_PARSE_ERROR()}}function N(V){var E,R,b,S;if(V.length>=M4.EF_ZIP64_SCOMP){if(E=A(V,M4.EF_ZIP64_SUNCOMP),w.size===M4.EF_ZIP64_OR_32)w.size=E}if(V.length>=M4.EF_ZIP64_RHO){if(R=A(V,M4.EF_ZIP64_SCOMP),w.compressedSize===M4.EF_ZIP64_OR_32)w.compressedSize=R}if(V.length>=M4.EF_ZIP64_DSN){if(b=A(V,M4.EF_ZIP64_RHO),w.offset===M4.EF_ZIP64_OR_32)w.offset=b}if(V.length>=M4.EF_ZIP64_DSN+4){if(S=V.readUInt32LE(M4.EF_ZIP64_DSN),w.diskNumStart===M4.EF_ZIP64_OR_16)w.diskNumStart=S}}return{get entryName(){return k.decode(f)},get rawEntryName(){return f},set entryName(V){f=h8.toBuffer(V,k.encode);var E=f[f.length-1];z=E===47||E===92,w.fileNameLength=f.length},get efs(){if(typeof J==="function")return J(this.entryName);else return J},get extra(){return D},set extra(V){D=V,w.extraLength=V.length,C(V)},get comment(){return k.decode(K)},set comment(V){if(K=h8.toBuffer(V,k.encode),w.commentLength=K.length,K.length>65535)throw h8.Errors.COMMENT_TOO_LONG()},get name(){var V=k.decode(f);return z?V.substr(V.length-1).split("/").pop():V.split("/").pop()},get isDirectory(){return z},getCompressedData:function(){return j(!1,null)},getCompressedDataAsync:function(V){j(!0,V)},setData:function(V){if(P=h8.toBuffer(V,h8.decoder.encode),!z&&P.length)w.size=P.length,w.method=h8.Constants.DEFLATED,w.crc=h8.crc32(V),w.changed=!0;else w.method=h8.Constants.STORED},getData:function(V){if(w.changed)return P;else return X(!1,null,V)},getDataAsync:function(V,E){if(w.changed)V(P);else X(!0,V,E)},set attr(V){w.attr=V},get attr(){return w.attr},set header(V){w.loadFromBinary(V)},get header(){return w},packCentralHeader:function(){w.flags_efs=this.efs,w.extraLength=D.length;var V=w.centralHeaderToBinary(),E=h8.Constants.CENHDR;return f.copy(V,E),E+=f.length,D.copy(V,E),E+=w.extraLength,K.copy(V,E),V},packLocalHeader:function(){let V=0;w.flags_efs=this.efs,w.extraLocalLength=Y.length;let E=w.localHeaderToBinary(),R=Buffer.alloc(E.length+f.length+w.extraLocalLength);return E.copy(R,V),V+=E.length,f.copy(R,V),V+=f.length,Y.copy(R,V),V+=Y.length,R},toJSON:function(){let V=function(E){return"<"+(E&&E.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:w.toJSON(),compressedData:V($),data:V(P)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var J0_=G((mb8,Y0_)=>{var D0_=ld(),Fg6=xd(),M3=GD();Y0_.exports=function(q,$){var w=[],f={},K=Buffer.alloc(0),z=new Fg6.MainHeader,P=!1,D=null;let Y=new Set,J=$,{noSort:Z,decoder:k}=J;if(q)X(J.readEntries);else P=!0;function W(){let A=new Set;for(let C of Object.keys(f)){let N=C.split("/");if(N.pop(),!N.length)continue;for(let V=0;V<N.length;V++){let E=N.slice(0,V+1).join("/")+"/";A.add(E)}}for(let C of A)if(!(C in f)){let N=new D0_(J);N.entryName=C,N.attr=16,N.temporary=!0,w.push(N),f[N.entryName]=N,Y.add(N)}}function v(){if(P=!0,f={},z.diskEntries>(q.length-z.offset)/M3.Constants.CENHDR)throw M3.Errors.DISK_ENTRY_TOO_LARGE();w=Array(z.diskEntries);var A=z.offset;for(var C=0;C<w.length;C++){var N=A,V=new D0_(J,q);if(V.header=q.slice(N,N+=M3.Constants.CENHDR),V.entryName=q.slice(N,N+=V.header.fileNameLength),V.header.extraLength)V.extra=q.slice(N,N+=V.header.extraLength);if(V.header.commentLength)V.comment=q.slice(N,N+V.header.commentLength);A+=V.header.centralHeaderSize,w[C]=V,f[V.entryName]=V}Y.clear(),W()}function X(A){var C=q.length-M3.Constants.ENDHDR,N=Math.max(0,C-65535),V=N,E=q.length,R=-1,b=0;if(typeof J.trailingSpace==="boolean"?J.trailingSpace:!1)N=0;for(C;C>=V;C--){if(q[C]!==80)continue;if(q.readUInt32LE(C)===M3.Constants.ENDSIG){R=C,b=C,E=C+M3.Constants.ENDHDR,V=C-M3.Constants.END64HDR;continue}if(q.readUInt32LE(C)===M3.Constants.END64SIG){V=N;continue}if(q.readUInt32LE(C)===M3.Constants.ZIP64SIG){R=C,E=C+M3.readBigUInt64LE(q,C+M3.Constants.ZIP64SIZE)+M3.Constants.ZIP64LEAD;break}}if(R==-1)throw M3.Errors.INVALID_FORMAT();if(z.loadFromBinary(q.slice(R,E)),z.commentLength)K=q.slice(b+M3.Constants.ENDHDR);if(A)v()}function j(){if(w.length>1&&!Z)w.sort((A,C)=>A.entryName.toLowerCase().localeCompare(C.entryName.toLowerCase()))}return{get entries(){if(!P)v();return w.filter((A)=>!Y.has(A))},get comment(){return k.decode(K)},set comment(A){K=M3.toBuffer(A,k.encode),z.commentLength=K.length},getEntryCount:function(){if(!P)return z.diskEntries;return w.length},forEach:function(A){this.entries.forEach(A)},getEntry:function(A){if(!P)v();return f[A]||null},setEntry:function(A){if(!P)v();w.push(A),f[A.entryName]=A,z.totalEntries=w.length},deleteFile:function(A,C=!0){if(!P)v();let N=f[A];this.getEntryChildren(N,C).map((E)=>E.entryName).forEach(this.deleteEntry)},deleteEntry:function(A){if(!P)v();let C=f[A],N=w.indexOf(C);if(N>=0)w.splice(N,1),delete f[A],z.totalEntries=w.length},getEntryChildren:function(A,C=!0){if(!P)v();if(typeof A==="object")if(A.isDirectory&&C){let N=[],V=A.entryName;for(let E of w)if(E.entryName.startsWith(V))N.push(E);return N}else return[A];return[]},getChildCount:function(A){if(A&&A.isDirectory){let C=this.getEntryChildren(A);return C.includes(A)?C.length-1:C.length}return 0},compressToBuffer:function(){if(!P)v();j();let A=[],C=[],N=0,V=0;z.size=0,z.offset=0;let E=0;for(let S of this.entries){let i=S.getCompressedData();S.header.offset=V;let y=S.packLocalHeader(),a=y.length+i.length;V+=a,A.push(y),A.push(i);let e=S.packCentralHeader();C.push(e),z.size+=e.length,N+=a+e.length,E++}N+=z.mainHeaderSize,z.offset=V,z.totalEntries=E,V=0;let R=Buffer.alloc(N);for(let S of A)S.copy(R,V),V+=S.length;for(let S of C)S.copy(R,V),V+=S.length;let b=z.toBinary();if(K)K.copy(b,M3.Constants.ENDHDR);return b.copy(R,V),q=R,P=!1,R},toAsyncBuffer:function(A,C,N,V){try{if(!P)v();j();let E=[],R=[],b=0,S=0,i=0;z.size=0,z.offset=0;let y=function(a){if(a.length>0){let e=a.shift(),Q=e.entryName+e.extra.toString();if(N)N(Q);e.getCompressedDataAsync(function(w_){if(V)V(Q);e.header.offset=S;let J_=e.packLocalHeader(),k_=J_.length+w_.length;S+=k_,E.push(J_),E.push(w_);let P_=e.packCentralHeader();R.push(P_),z.size+=P_.length,b+=k_+P_.length,i++,y(a)})}else{b+=z.mainHeaderSize,z.offset=S,z.totalEntries=i,S=0;let e=Buffer.alloc(b);E.forEach(function(w_){w_.copy(e,S),S+=w_.length}),R.forEach(function(w_){w_.copy(e,S),S+=w_.length});let Q=z.toBinary();if(K)K.copy(Q,M3.Constants.ENDHDR);Q.copy(e,S),q=e,P=!1,A(e)}};y(Array.from(this.entries))}catch(E){C(E)}}}}});var k0_=G((Lb8,Z0_)=>{var v4=GD(),N4=H_("path"),og6=ld(),Ug6=J0_(),sf=(...q)=>v4.findLast(q,($)=>typeof $==="boolean"),H0_=(...q)=>v4.findLast(q,($)=>typeof $==="string"),Qg6=(...q)=>v4.findLast(q,($)=>typeof $==="function"),tg6={noSort:!1,readEntries:!1,method:v4.Constants.NONE,fs:null};Z0_.exports=function(q,$){let w=null,f=Object.assign(Object.create(null),tg6);if(q&&typeof q==="object"){if(!(q instanceof Uint8Array)){if(Object.assign(f,q),q=f.input?f.input:void 0,f.input)delete f.input}if(Buffer.isBuffer(q))w=q,f.method=v4.Constants.BUFFER,q=void 0}Object.assign(f,$);let K=new v4(f);if(typeof f.decoder!=="object"||typeof f.decoder.encode!=="function"||typeof f.decoder.decode!=="function")f.decoder=v4.decoder;if(q&&typeof q==="string")if(K.fs.existsSync(q))f.method=v4.Constants.FILE,f.filename=q,w=K.fs.readFileSync(q);else throw v4.Errors.INVALID_FILENAME();let z=new Ug6(w,f),{canonical:P,sanitize:D,zipnamefix:Y}=v4;function J(v){if(v&&z){var X;if(typeof v==="string")X=z.getEntry(N4.posix.normalize(v));if(typeof v==="object"&&typeof v.entryName<"u"&&typeof v.header<"u")X=z.getEntry(v.entryName);if(X)return X}return null}function Z(v){let{join:X,normalize:j,sep:A}=N4.posix;return X(".",j(A+v.split("\\").join(A)+A))}function k(v){if(v instanceof RegExp)return function(X){return function(j){return X.test(j)}}(v);else if(typeof v!=="function")return()=>!0;return v}let W=(v,X)=>{let j=X.slice(-1);return j=j===K.sep?K.sep:"",N4.relative(v,X)+j};return{readFile:function(v,X){var j=J(v);return j&&j.getData(X)||null},childCount:function(v){let X=J(v);if(X)return z.getChildCount(X)},readFileAsync:function(v,X){var j=J(v);if(j)j.getDataAsync(X);else X(null,"getEntry failed for:"+v)},readAsText:function(v,X){var j=J(v);if(j){var A=j.getData();if(A&&A.length)return A.toString(X||"utf8")}return""},readAsTextAsync:function(v,X,j){var A=J(v);if(A)A.getDataAsync(function(C,N){if(N){X(C,N);return}if(C&&C.length)X(C.toString(j||"utf8"));else X("")});else X("")},deleteFile:function(v,X=!0){var j=J(v);if(j)z.deleteFile(j.entryName,X)},deleteEntry:function(v){var X=J(v);if(X)z.deleteEntry(X.entryName)},addZipComment:function(v){z.comment=v},getZipComment:function(){return z.comment||""},addZipEntryComment:function(v,X){var j=J(v);if(j)j.comment=X},getZipEntryComment:function(v){var X=J(v);if(X)return X.comment||"";return""},updateFile:function(v,X){var j=J(v);if(j)j.setData(X)},addLocalFile:function(v,X,j,A){if(K.fs.existsSync(v)){X=X?Z(X):"";let C=N4.win32.basename(N4.win32.normalize(v));X+=j?j:C;let N=K.fs.statSync(v),V=N.isFile()?K.fs.readFileSync(v):Buffer.alloc(0);if(N.isDirectory())X+=K.sep;this.addFile(X,V,A,N)}else throw v4.Errors.FILE_NOT_FOUND(v)},addLocalFileAsync:function(v,X){v=typeof v==="object"?v:{localPath:v};let j=N4.resolve(v.localPath),{comment:A}=v,{zipPath:C,zipName:N}=v,V=this;K.fs.stat(j,function(E,R){if(E)return X(E,!1);C=C?Z(C):"";let b=N4.win32.basename(N4.win32.normalize(j));if(C+=N?N:b,R.isFile())K.fs.readFile(j,function(S,i){if(S)return X(S,!1);return V.addFile(C,i,A,R),setImmediate(X,void 0,!0)});else if(R.isDirectory())return C+=K.sep,V.addFile(C,Buffer.alloc(0),A,R),setImmediate(X,void 0,!0)})},addLocalFolder:function(v,X,j){if(j=k(j),X=X?Z(X):"",v=N4.normalize(v),K.fs.existsSync(v)){let A=K.findFiles(v),C=this;if(A.length)for(let N of A){let V=N4.join(X,W(v,N));if(j(V))C.addLocalFile(N,N4.dirname(V))}}else throw v4.Errors.FILE_NOT_FOUND(v)},addLocalFolderAsync:function(v,X,j,A){A=k(A),j=j?Z(j):"",v=N4.normalize(v);var C=this;K.fs.open(v,"r",function(N){if(N&&N.code==="ENOENT")X(void 0,v4.Errors.FILE_NOT_FOUND(v));else if(N)X(void 0,N);else{var V=K.findFiles(v),E=-1,R=function(){if(E+=1,E<V.length){var b=V[E],S=W(v,b).split("\\").join("/");if(S=S.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),A(S))K.fs.stat(b,function(i,y){if(i)X(void 0,i);if(y.isFile())K.fs.readFile(b,function(a,e){if(a)X(void 0,a);else C.addFile(j+S,e,"",y),R()});else C.addFile(j+S+"/",Buffer.alloc(0),"",y),R()});else process.nextTick(()=>{R()})}else X(!0,void 0)};R()}})},addLocalFolderAsync2:function(v,X){let j=this;v=typeof v==="object"?v:{localPath:v},localPath=N4.resolve(Z(v.localPath));let{zipPath:A,filter:C,namefix:N}=v;if(C instanceof RegExp)C=function(R){return function(b){return R.test(b)}}(C);else if(typeof C!=="function")C=function(){return!0};if(A=A?Z(A):"",N=="latin1")N=(R)=>R.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"");if(typeof N!=="function")N=(R)=>R;let V=(R)=>N4.join(A,N(W(localPath,R))),E=(R)=>N4.win32.basename(N4.win32.normalize(N(R)));K.fs.open(localPath,"r",function(R){if(R&&R.code==="ENOENT")X(void 0,v4.Errors.FILE_NOT_FOUND(localPath));else if(R)X(void 0,R);else K.findFilesAsync(localPath,function(b,S){if(b)return X(b);if(S=S.filter((i)=>C(V(i))),!S.length)X(void 0,!1);setImmediate(S.reverse().reduce(function(i,y){return function(a,e){if(a||e===!1)return setImmediate(i,a,!1);j.addLocalFileAsync({localPath:y,zipPath:N4.dirname(V(y)),zipName:E(y)},i)}},X))})})},addLocalFolderPromise:function(v,X){return new Promise((j,A)=>{this.addLocalFolderAsync2(Object.assign({localPath:v},X),(C,N)=>{if(C)A(C);if(N)j(this)})})},addFile:function(v,X,j,A){v=Y(v);let C=J(v),N=C!=null;if(!N)C=new og6(f),C.entryName=v;C.comment=j||"";let V=typeof A==="object"&&A instanceof K.fs.Stats;if(V)C.header.time=A.mtime;var E=C.isDirectory?16:0;let R=C.isDirectory?16384:32768;if(V)R|=4095&A.mode;else if(typeof A==="number")R|=4095&A;else R|=C.isDirectory?493:420;if(E=(E|R<<16)>>>0,C.attr=E,C.setData(X),!N)z.setEntry(C);return C},getEntries:function(v){return z.password=v,z?z.entries:[]},getEntry:function(v){return J(v)},getEntryCount:function(){return z.getEntryCount()},forEach:function(v){return z.forEach(v)},extractEntryTo:function(v,X,j,A,C,N){A=sf(!1,A),C=sf(!1,C),j=sf(!0,j),N=H0_(C,N);var V=J(v);if(!V)throw v4.Errors.NO_ENTRY();var E=P(V.entryName),R=D(X,N&&!V.isDirectory?N:j?E:N4.basename(E));if(V.isDirectory){var b=z.getEntryChildren(V);return b.forEach(function(y){if(y.isDirectory)return;var a=y.getData();if(!a)throw v4.Errors.CANT_EXTRACT_FILE();var e=P(y.entryName),Q=D(X,j?e:N4.basename(e));let w_=C?y.header.fileAttr:void 0;K.writeFileTo(Q,a,A,w_)}),!0}var S=V.getData(z.password);if(!S)throw v4.Errors.CANT_EXTRACT_FILE();if(K.fs.existsSync(R)&&!A)throw v4.Errors.CANT_OVERRIDE();let i=C?v.header.fileAttr:void 0;return K.writeFileTo(R,S,A,i),!0},test:function(v){if(!z)return!1;for(var X in z.entries)try{if(X.isDirectory)continue;var j=z.entries[X].getData(v);if(!j)return!1}catch(A){return!1}return!0},extractAllTo:function(v,X,j,A){if(j=sf(!1,j),A=H0_(j,A),X=sf(!1,X),!z)throw v4.Errors.NO_ZIP();z.entries.forEach(function(C){var N=D(v,P(C.entryName));if(C.isDirectory){K.makeDir(N);return}var V=C.getData(A);if(!V)throw v4.Errors.CANT_EXTRACT_FILE();let E=j?C.header.fileAttr:void 0;K.writeFileTo(N,V,X,E);try{K.fs.utimesSync(N,C.header.time,C.header.time)}catch(R){throw v4.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(v,X,j,A){if(A=Qg6(X,j,A),j=sf(!1,j),X=sf(!1,X),!A)return new Promise((R,b)=>{this.extractAllToAsync(v,X,j,function(S){if(S)b(S);else R(this)})});if(!z){A(v4.Errors.NO_ZIP());return}v=N4.resolve(v);let C=(R)=>D(v,N4.normalize(P(R.entryName))),N=(R,b)=>Error(R+': "'+b+'"'),V=[],E=[];z.entries.forEach((R)=>{if(R.isDirectory)V.push(R);else E.push(R)});for(let R of V){let b=C(R),S=j?R.header.fileAttr:void 0;try{if(K.makeDir(b),S)K.fs.chmodSync(b,S);K.fs.utimesSync(b,R.header.time,R.header.time)}catch(i){A(N("Unable to create folder",b))}}E.reverse().reduce(function(R,b){return function(S){if(S)R(S);else{let i=N4.normalize(P(b.entryName)),y=D(v,i);b.getDataAsync(function(a,e){if(e)R(e);else if(!a)R(v4.Errors.CANT_EXTRACT_FILE());else{let Q=j?b.header.fileAttr:void 0;K.writeFileToAsync(y,a,X,Q,function(w_){if(!w_)R(N("Unable to write file",y));K.fs.utimes(y,b.header.time,b.header.time,function(J_){if(J_)R(N("Unable to set times",y));else R()})})}})}}},A)()},writeZip:function(v,X){if(arguments.length===1){if(typeof v==="function")X=v,v=""}if(!v&&f.filename)v=f.filename;if(!v)return;var j=z.compressToBuffer();if(j){var A=K.writeFileTo(v,j,!0);if(typeof X==="function")X(!A?Error("failed"):null,"")}},writeZipPromise:function(v,X){let{overwrite:j,perm:A}=Object.assign({overwrite:!0},X);return new Promise((C,N)=>{if(!v&&f.filename)v=f.filename;if(!v)N("ADM-ZIP: ZIP File Name Missing");this.toBufferPromise().then((V)=>{let E=(R)=>R?C(R):N("ADM-ZIP: Wasn't able to write zip file");K.writeFileToAsync(v,V,j,A,E)},N)})},toBufferPromise:function(){return new Promise((v,X)=>{z.toAsyncBuffer(v,X)})},toBuffer:function(v,X,j,A){if(typeof v==="function")return z.toAsyncBuffer(v,X,j,A),null;return z.compressToBuffer()}}}});var n$=G((Wy8,hT_)=>{/*!
|
|
222
222
|
Copyright 2013 Lovell Fuller and others.
|
|
@@ -617,7 +617,7 @@ main = do
|
|
|
617
617
|
\\SampleTwoColInputOutput[${Y}]{${D}}{}
|
|
618
618
|
`);P++}return[f.join(`
|
|
619
619
|
`),K.join(`
|
|
620
|
-
`)]}async makePdfStatement(q,$){let w=Z6(q,$);await Xk(w);let f=new Date().toISOString(),K=new Date().getFullYear(),z=this.problem.problemLangYmls[this.problem.originalLanguage].author||"Unknown",P=this.problem.problemLangYmls[this.problem.originalLanguage].author_email||"unknown email",D=this.problem.problemLangYmls[$].translator||"",Y=this.problem.problemLangYmls[$].event||this.problem.problemLangYmls[this.problem.originalLanguage].event,J=this.problem.problemLangYmls[$].date||this.problem.problemLangYmls[this.problem.originalLanguage].date,[Z,k]=await this.makeSamples(w,$),W=await j6(Z6(Zv_,"root-pdf.tpl.tex"));jk.default.registerHelper("curly",function(A){return"{"+A+"}"});let v=jk.default.compile(W)({language:$,jutgeLanguage:`jutge.${$}`,id:`${this.problem_nm}\\_${$}`,samples1c:Z,samples2c:k,author:z,translator:D,date:f,year:K,event:Y,eventDate:J});for await(let A of bd("*",{cwd:this.problem.directory})){if(A.startsWith(u8())||A.endsWith(".exe")||A.endsWith(".html")||A.endsWith(".md")||A.endsWith(".txt")||await Ly(this.problem.directory,A))continue;await Jq(Z6(this.problem.directory,A),Z6(w,A))}if(await qA(Z6(w,`original.${$}.pdf`))){u.warning(`Found original.${$}.pdf`),await Jq(Z6(w,`original.${$}.pdf`),Z6(this.problem.directory,`problem.${$}.pdf`));return}await G4(Z6(w,"root.tex"),v);let j=(await j6(Z6(w,`problem.${$}.tex`))).replace(/\\begin{htmlonly}[\s\S]*?\\end{htmlonly}/g,"").replace(/\\begin{latexonly}/g,"").replace(/\\end{latexonly}/g,"").replace(/\.eps}/g,"}");if(await G4(Z6(w,`problem.${$}.tex`),j),await this.copyStyleFiles(w,$),!await cW_()){u.error("xelatex not found");return}try{u.command("xelatex -no-shell-escape -interaction=nonstopmode -file-line-error root.tex"),await p_({stderr:"inherit",cwd:w,env:{max_print_line:"100000"}})`xelatex -no-shell-escape -interaction=nonstopmode -file-line-error root.tex`,await Jq(Z6(w,"root.pdf"),Z6(this.problem.directory,`problem.${$}.pdf`)),u.success(`Generated ${u.hyperlink(this.problem.directory,`problem.${$}.pdf`)} see ${u.hyperlink(w,"root.log")}`)}catch(A){u.error(`Error in LaTeX: ${u.hyperlink(w,"root.log")}`)}}async copyStyleFiles(q,$){let w=async(f)=>{let K=Z6(H8(),"assets","sty",f);await Jq(K,Z6(q,f))};if(await w("picins.sty"),await w("jutge.sty"),$==="ca")await w("jutge.ca.sty");if($==="es")await w("jutge.es.sty");if($==="en")await w("jutge.en.sty");if($==="fr")await w("jutge.fr.sty");if($==="de")await w("jutge.de.sty")}async makeFullTextualStatements(q=["txt","html","md"]){await this.makeTextualStatements(q,"full")}async makeShortTextualStatements(q=["txt","html","md"]){await this.makeTextualStatements(q,"short")}async makeTextualStatements(q=["txt","html","md"],$){await u.section(`Making textual statements (${$})`,async()=>{let w=Z6(this.problem.directory,u8()+"-text",$q());await Xk(w,{recursive:!0}),await u.section("Creating working directory",async()=>{await a6(),u.directory(w)});try{for(let f of this.problem.languages)if(this.problem.structure==="multi"||this.problem.structure==="single"&&f===this.problem.language)await u.section(`Making ${$} textual statements for ${l6[f]}`,async()=>{await this.makeTextualStatement(w,f,q,$)})}finally{}})}async makeTextualStatement(q,$,w,f){let K=Z6(q,$);await Xk(K);let z=new Date().toISOString(),P=new Date().getFullYear(),D=this.problem.problemLangYmls[$].author||"Unknown",Y=this.problem.problemLangYmls[$].author_email||"unknown email",J=this.problem.problemLangYmls[$].translator||"",Z=this.problem.problemLangYmls[$].event||this.problem.problemLangYmls[this.problem.originalLanguage].event,k=this.problem.problemLangYmls[$].date||this.problem.problemLangYmls[this.problem.originalLanguage].date,W=await j6(Z6(Zv_,`root-text-${f}.tpl.tex`));jk.default.registerHelper("curly",function(N){return"{"+N+"}"});let v=jk.default.compile(W)({language:$,jutgeLanguage:`jutge.${$}`,id:`${this.problem_nm}\\_${$}`,year:P,author:D,translator:J,date:z,event:Z,eventDate:k});for await(let N of bd("*",{cwd:this.problem.directory})){if(N.startsWith(u8())||N.endsWith(".exe")||N.endsWith(".html")||N.endsWith(".md")||N.endsWith(".txt")||await Ly(this.problem.directory,N))continue;await Jq(Z6(this.problem.directory,N),Z6(K,N))}if(await qA(Z6(K,`original.${$}.pdf`))){u.warning(`Found original.${$}.pdf`);return}let X=f==="full"?`problem.${$}`:`problem.${$}.short`;await G4(Z6(K,"root.tex"),v);let A=(await j6(Z6(K,`problem.${$}.tex`))).replace(/\\begin{latexonly}[\s\S]*?\\end{latexonly}/g,"").replace(/\\begin{htmlonly}/g,"").replace(/\\end{htmlonly}/g,"").replace(/\\begin{minipage}/g,"").replace(/\\end{minipage}/g,"");if(await G4(Z6(K,`problem.${$}.tex`),A),await this.copyStyleFiles(K,$),!await dW_()){u.error("pandoc with lua support not found");return}let C=Z6(H8(),"assets","lua","fixCodeBlocks.lua");if(await Jq(C,Z6(K,"fixCodeBlocks.lua")),w.includes("txt"))try{u.command("pandoc --quiet root.tex --to plain --output root.txt"),await p_({cwd:K})`pandoc --quiet root.tex --to plain --output root.txt`,await Jq(Z6(K,"root.txt"),Z6(this.problem.directory,`${X}.txt`)),u.success("Generated "+u.hyperlink(this.problem.directory,`${X}.txt`))}catch(N){u.error(`pandoc error: ${N instanceof Error?N.message:"unknown error"}`)}if(w.includes("md"))try{u.command("pandoc --quiet root.tex --to markdown --to markdown-header_attributes --lua-filter=fixCodeBlocks.lua --output root.md"),await p_({cwd:K})`pandoc --quiet root.tex --to markdown --to markdown-header_attributes --lua-filter=fixCodeBlocks.lua --output root.md`,await Jq(Z6(K,"root.md"),Z6(this.problem.directory,`${X}.md`)),u.success("Generated "+u.hyperlink(this.problem.directory,`${X}.md`))}catch(N){u.error(`pandoc error: ${N instanceof Error?N.message:"unknown error"}`)}if(w.includes("html"))try{u.command("pandoc --quiet root.tex --to html --mathml --embed-resources --output root.html"),await p_({cwd:K})`pandoc --quiet root.tex --to html --mathml --embed-resources --output root.html`,await Jq(Z6(K,"root.html"),Z6(this.problem.directory,`${X}.html`)),u.success("Generated "+u.hyperlink(this.problem.directory,`${X}.html`))}catch(N){u.error(`pandoc error: ${N instanceof Error?N.message:"unknown error"}`)}}async verifyCandidate(q,$,w){let f=$??this.problem.testcases,K=w?.skipCompile??!1;await u.section(`Verifying ${q}`,async()=>{let z=q.split(".").pop(),P=hd[z];if(!P)throw Error(`No compiler found for .${z} files`);if(!await P()){u.warning(`Compiler for .${z} files is not available, skipping verification of ${q}`);return}let D=kk(z),Y=`${u8()}-${q}`;if(!K)await u.section(`Copying ${u.hyperlink(this.problem.directory,q)} to ${u.hyperlink(this.problem.directory,Y)}`,async()=>{await Jq(Z6(this.problem.directory,q),Z6(this.problem.directory,Y))}),await u.section(`Using compiler ${D.name()} to compile ${u.hyperlink(this.problem.directory,Y)}`,async()=>{try{let Z;if(this.problem.handler.source_modifier==="none")Z=await D.compileNormal(this.problem.handler,this.problem.directory,Y);else if(this.problem.handler.source_modifier==="no_main")Z=await D.compileWithMain(this.problem.handler,this.problem.directory,Y);else throw Error(`Unknown source modifier: ${this.problem.handler.source_modifier}`);if(!await qA(Z6(this.problem.directory,Z)))throw Error(`Compilation failed for ${Y}`);u.success(`Compiled ${Y} to ${Z}`)}catch(Z){throw Error("Compilation failed",{cause:Z})}});let J=[];await u.section("Executing testcases",async()=>{for(let k of f)J.push(await this.runTestcase(k,`${k}.inp`,`${u8()}-${k}.${z}.out`,D,Y));u.print(),u.print("testcase time status");let Z=0;for(let k of J){let W=k.error?"EE":await N8_(Z6(this.problem.directory,`${k.testcase}.cor`),Z6(this.problem.directory,`${u8()}-${k.testcase}.${z}.out`))?"OK":"WA",v=Bw(k.time);if(u.print((W!=="OK"?y_.red:y_.green)(`${k.testcase.padEnd(12)} ${v.padStart(10)} ${W.padStart(10)}`)),W!=="OK")Z++}if(u.print(),Z)u.error(`${Z} errors found for ${q}`);else if(f.length===this.problem.testcases.length)u.success(`All testcases passed successfully for ${q}`)})})}async makeTarFiles(){let{handler:q,directory:$}=this.problem,{compilers:w}=q;if(w==="PRO2"||w==="MakePRO2")await u.section("Making `.tar` files",async()=>{for(let f of["public","private","solution"])if(await l8($,f)){let{exitCode:K}=await p_({reject:!1,stderr:"inherit",stdout:"inherit",cwd:Z6($,f)})`tar cf ../${f}.tar .`;if(K!==0)throw console.log(K),Error(`Error making ${f}.tar`);u.success(`Created ${u.hyperlink($,`${f}.tar`)}`)}})}}var Ov_=new G6("verify").description("Verify programs against golden solution").argument("<programs...>","source programs to verify").option("-d, --directory <path>","problem directory",".").action(async(q,{directory:$})=>{let w=await $A($);for(let f of q)await w.verifyCandidate(f)});import fg6 from"path";import{readdir as Kg6,rm as zg6}from"fs/promises";async function Wv_(q,$,w){let f=[`^${u8()}-`,"\\.exe$","\\.dSYM$","\\.out$","\\.pyc$","\\.tar$","\\.class$","\\.o$","\\.hi$","\\.bak$","~$","^a\\.out$","^__pycache__$"],K=["\\.cor$","^problem\\.[a-z][a-z]\\.ps$","^problem\\.[a-z][a-z]\\.pdf$","^problem\\.[a-z][a-z]\\.md$","^problem\\.[a-z][a-z]\\.txt$","^problem\\.[a-z][a-z]\\.html$","^problem\\.[a-z][a-z]\\.short\\.md$","^problem\\.[a-z][a-z]\\.short\\.txt$","^problem\\.[a-z][a-z]\\.short\\.html$"];if($)f.push(...K);let z=new RegExp(f.join("|")),P=await Kg6(w,{withFileTypes:!0}),D=[];for(let J of P){let Z=fg6.join(w,J.name);if(z.test(J.name))D.push(Z)}if(D.length===0){u.success("No entries to remove");return}u.warning(`The following ${D.length} entries will be removed:`);for(let J of D.sort())u.print(u.hyperlink(w,J));if(!q){if(u.print(),!await G3({message:`Remove ${D.length} entries?`,default:!1}))return}let Y=0;for(let J of D)try{await zg6(J,{recursive:!0,force:!0}),Y++}catch(Z){u.error(`Could not remove entry ${J}`)}if(u.success(`Removed ${Y} entries`),!$)u.warning("You can use the --all option to remove generated statement and correct files as well")}import{exists as Id}from"fs/promises";Yq();import{join as yd}from"path";import{normalize as vv_,resolve as Tv_}from"path";function WD(q){let $=/\\Problem\{(.*?)\}/,w=q.match($);if(w)return w[1].trim();return null}async function Sd(q){let $=yd(H8(),"assets","prompts","io","proglangs",`io-${q}.md`);if(await Id($))return await j6($);else return u.warning(`Prompt for ${q} not found at ${$}`),""}async function i$(q){let $=[];for(let w of q){if(w===".")w=vv_(Tv_(process.cwd()));if(await Id(yd(w,"handler.yml")))$.push(w);else for(let f of Object.keys(l6).sort()){let K=yd(w,f,"handler.yml");if(await Id(K))$.push(Tv_(w,f))}}return $.map((w)=>vv_(w)).sort()}var Gk="No problem directories found: did not find handler.yml under the path(s) you used. A problem folder must contain handler.yml at its root, or use <language>/handler.yml under each language subfolder.";function ef(q){if(q.length===0)return"<none>";return q.map(($)=>`- ${$}`).join(`
|
|
620
|
+
`)]}async makePdfStatement(q,$){let w=Z6(q,$);await Xk(w);let f=new Date().toISOString(),K=new Date().getFullYear(),z=this.problem.problemLangYmls[this.problem.originalLanguage].author||"Unknown",P=this.problem.problemLangYmls[this.problem.originalLanguage].author_email||"unknown email",D=this.problem.problemLangYmls[$].translator||"",Y=this.problem.problemLangYmls[$].event||this.problem.problemLangYmls[this.problem.originalLanguage].event,J=this.problem.problemLangYmls[$].date||this.problem.problemLangYmls[this.problem.originalLanguage].date,[Z,k]=await this.makeSamples(w,$),W=await j6(Z6(Zv_,"root-pdf.tpl.tex"));jk.default.registerHelper("curly",function(A){return"{"+A+"}"});let v=jk.default.compile(W,{noEscape:!0})({language:$,jutgeLanguage:`jutge.${$}`,id:`${this.problem_nm}\\_${$}`,samples1c:Z,samples2c:k,author:z,translator:D,date:f,year:K,event:Y,eventDate:J});for await(let A of bd("*",{cwd:this.problem.directory})){if(A.startsWith(u8())||A.endsWith(".exe")||A.endsWith(".html")||A.endsWith(".md")||A.endsWith(".txt")||await Ly(this.problem.directory,A))continue;await Jq(Z6(this.problem.directory,A),Z6(w,A))}if(await qA(Z6(w,`original.${$}.pdf`))){u.warning(`Found original.${$}.pdf`),await Jq(Z6(w,`original.${$}.pdf`),Z6(this.problem.directory,`problem.${$}.pdf`));return}await G4(Z6(w,"root.tex"),v);let j=(await j6(Z6(w,`problem.${$}.tex`))).replace(/\\begin{htmlonly}[\s\S]*?\\end{htmlonly}/g,"").replace(/\\begin{latexonly}/g,"").replace(/\\end{latexonly}/g,"").replace(/\.eps}/g,"}");if(await G4(Z6(w,`problem.${$}.tex`),j),await this.copyStyleFiles(w,$),!await cW_()){u.error("xelatex not found");return}try{u.command("xelatex -no-shell-escape -interaction=nonstopmode -file-line-error root.tex"),await p_({stderr:"inherit",cwd:w,env:{max_print_line:"100000"}})`xelatex -no-shell-escape -interaction=nonstopmode -file-line-error root.tex`,await Jq(Z6(w,"root.pdf"),Z6(this.problem.directory,`problem.${$}.pdf`)),u.success(`Generated ${u.hyperlink(this.problem.directory,`problem.${$}.pdf`)} see ${u.hyperlink(w,"root.log")}`)}catch(A){u.error(`Error in LaTeX: ${u.hyperlink(w,"root.log")}`)}}async copyStyleFiles(q,$){let w=async(f)=>{let K=Z6(H8(),"assets","sty",f);await Jq(K,Z6(q,f))};if(await w("picins.sty"),await w("jutge.sty"),$==="ca")await w("jutge.ca.sty");if($==="es")await w("jutge.es.sty");if($==="en")await w("jutge.en.sty");if($==="fr")await w("jutge.fr.sty");if($==="de")await w("jutge.de.sty")}async makeFullTextualStatements(q=["txt","html","md"]){await this.makeTextualStatements(q,"full")}async makeShortTextualStatements(q=["txt","html","md"]){await this.makeTextualStatements(q,"short")}async makeTextualStatements(q=["txt","html","md"],$){await u.section(`Making textual statements (${$})`,async()=>{let w=Z6(this.problem.directory,u8()+"-text",$q());await Xk(w,{recursive:!0}),await u.section("Creating working directory",async()=>{await a6(),u.directory(w)});try{for(let f of this.problem.languages)if(this.problem.structure==="multi"||this.problem.structure==="single"&&f===this.problem.language)await u.section(`Making ${$} textual statements for ${l6[f]}`,async()=>{await this.makeTextualStatement(w,f,q,$)})}finally{}})}async makeTextualStatement(q,$,w,f){let K=Z6(q,$);await Xk(K);let z=new Date().toISOString(),P=new Date().getFullYear(),D=this.problem.problemLangYmls[$].author||"Unknown",Y=this.problem.problemLangYmls[$].author_email||"unknown email",J=this.problem.problemLangYmls[$].translator||"",Z=this.problem.problemLangYmls[$].event||this.problem.problemLangYmls[this.problem.originalLanguage].event,k=this.problem.problemLangYmls[$].date||this.problem.problemLangYmls[this.problem.originalLanguage].date,W=await j6(Z6(Zv_,`root-text-${f}.tpl.tex`));jk.default.registerHelper("curly",function(N){return"{"+N+"}"});let v=jk.default.compile(W,{noEscape:!0})({language:$,jutgeLanguage:`jutge.${$}`,id:`${this.problem_nm}\\_${$}`,year:P,author:D,translator:J,date:z,event:Z,eventDate:k});for await(let N of bd("*",{cwd:this.problem.directory})){if(N.startsWith(u8())||N.endsWith(".exe")||N.endsWith(".html")||N.endsWith(".md")||N.endsWith(".txt")||await Ly(this.problem.directory,N))continue;await Jq(Z6(this.problem.directory,N),Z6(K,N))}if(await qA(Z6(K,`original.${$}.pdf`))){u.warning(`Found original.${$}.pdf`);return}let X=f==="full"?`problem.${$}`:`problem.${$}.short`;await G4(Z6(K,"root.tex"),v);let A=(await j6(Z6(K,`problem.${$}.tex`))).replace(/\\begin{latexonly}[\s\S]*?\\end{latexonly}/g,"").replace(/\\begin{htmlonly}/g,"").replace(/\\end{htmlonly}/g,"").replace(/\\begin{minipage}/g,"").replace(/\\end{minipage}/g,"");if(await G4(Z6(K,`problem.${$}.tex`),A),await this.copyStyleFiles(K,$),!await dW_()){u.error("pandoc with lua support not found");return}let C=Z6(H8(),"assets","lua","fixCodeBlocks.lua");if(await Jq(C,Z6(K,"fixCodeBlocks.lua")),w.includes("txt"))try{u.command("pandoc --quiet root.tex --to plain --output root.txt"),await p_({cwd:K})`pandoc --quiet root.tex --to plain --output root.txt`,await Jq(Z6(K,"root.txt"),Z6(this.problem.directory,`${X}.txt`)),u.success("Generated "+u.hyperlink(this.problem.directory,`${X}.txt`))}catch(N){u.error(`pandoc error: ${N instanceof Error?N.message:"unknown error"}`)}if(w.includes("md"))try{u.command("pandoc --quiet root.tex --to markdown --to markdown-header_attributes --lua-filter=fixCodeBlocks.lua --output root.md"),await p_({cwd:K})`pandoc --quiet root.tex --to markdown --to markdown-header_attributes --lua-filter=fixCodeBlocks.lua --output root.md`,await Jq(Z6(K,"root.md"),Z6(this.problem.directory,`${X}.md`)),u.success("Generated "+u.hyperlink(this.problem.directory,`${X}.md`))}catch(N){u.error(`pandoc error: ${N instanceof Error?N.message:"unknown error"}`)}if(w.includes("html"))try{u.command("pandoc --quiet root.tex --to html --mathml --embed-resources --output root.html"),await p_({cwd:K})`pandoc --quiet root.tex --to html --mathml --embed-resources --output root.html`,await Jq(Z6(K,"root.html"),Z6(this.problem.directory,`${X}.html`)),u.success("Generated "+u.hyperlink(this.problem.directory,`${X}.html`))}catch(N){u.error(`pandoc error: ${N instanceof Error?N.message:"unknown error"}`)}}async verifyCandidate(q,$,w){let f=$??this.problem.testcases,K=w?.skipCompile??!1;await u.section(`Verifying ${q}`,async()=>{let z=q.split(".").pop(),P=hd[z];if(!P)throw Error(`No compiler found for .${z} files`);if(!await P()){u.warning(`Compiler for .${z} files is not available, skipping verification of ${q}`);return}let D=kk(z),Y=`${u8()}-${q}`;if(!K)await u.section(`Copying ${u.hyperlink(this.problem.directory,q)} to ${u.hyperlink(this.problem.directory,Y)}`,async()=>{await Jq(Z6(this.problem.directory,q),Z6(this.problem.directory,Y))}),await u.section(`Using compiler ${D.name()} to compile ${u.hyperlink(this.problem.directory,Y)}`,async()=>{try{let Z;if(this.problem.handler.source_modifier==="none")Z=await D.compileNormal(this.problem.handler,this.problem.directory,Y);else if(this.problem.handler.source_modifier==="no_main")Z=await D.compileWithMain(this.problem.handler,this.problem.directory,Y);else throw Error(`Unknown source modifier: ${this.problem.handler.source_modifier}`);if(!await qA(Z6(this.problem.directory,Z)))throw Error(`Compilation failed for ${Y}`);u.success(`Compiled ${Y} to ${Z}`)}catch(Z){throw Error("Compilation failed",{cause:Z})}});let J=[];await u.section("Executing testcases",async()=>{for(let k of f)J.push(await this.runTestcase(k,`${k}.inp`,`${u8()}-${k}.${z}.out`,D,Y));u.print(),u.print("testcase time status");let Z=0;for(let k of J){let W=k.error?"EE":await N8_(Z6(this.problem.directory,`${k.testcase}.cor`),Z6(this.problem.directory,`${u8()}-${k.testcase}.${z}.out`))?"OK":"WA",v=Bw(k.time);if(u.print((W!=="OK"?y_.red:y_.green)(`${k.testcase.padEnd(12)} ${v.padStart(10)} ${W.padStart(10)}`)),W!=="OK")Z++}if(u.print(),Z)u.error(`${Z} errors found for ${q}`);else if(f.length===this.problem.testcases.length)u.success(`All testcases passed successfully for ${q}`)})})}async makeTarFiles(){let{handler:q,directory:$}=this.problem,{compilers:w}=q;if(w==="PRO2"||w==="MakePRO2")await u.section("Making `.tar` files",async()=>{for(let f of["public","private","solution"])if(await l8($,f)){let{exitCode:K}=await p_({reject:!1,stderr:"inherit",stdout:"inherit",cwd:Z6($,f)})`tar cf ../${f}.tar .`;if(K!==0)throw console.log(K),Error(`Error making ${f}.tar`);u.success(`Created ${u.hyperlink($,`${f}.tar`)}`)}})}}var Ov_=new G6("verify").description("Verify programs against golden solution").argument("<programs...>","source programs to verify").option("-d, --directory <path>","problem directory",".").action(async(q,{directory:$})=>{let w=await $A($);for(let f of q)await w.verifyCandidate(f)});import fg6 from"path";import{readdir as Kg6,rm as zg6}from"fs/promises";async function Wv_(q,$,w){let f=[`^${u8()}-`,"\\.exe$","\\.dSYM$","\\.out$","\\.pyc$","\\.tar$","\\.class$","\\.o$","\\.hi$","\\.bak$","~$","^a\\.out$","^__pycache__$"],K=["\\.cor$","^problem\\.[a-z][a-z]\\.ps$","^problem\\.[a-z][a-z]\\.pdf$","^problem\\.[a-z][a-z]\\.md$","^problem\\.[a-z][a-z]\\.txt$","^problem\\.[a-z][a-z]\\.html$","^problem\\.[a-z][a-z]\\.short\\.md$","^problem\\.[a-z][a-z]\\.short\\.txt$","^problem\\.[a-z][a-z]\\.short\\.html$"];if($)f.push(...K);let z=new RegExp(f.join("|")),P=await Kg6(w,{withFileTypes:!0}),D=[];for(let J of P){let Z=fg6.join(w,J.name);if(z.test(J.name))D.push(Z)}if(D.length===0){u.success("No entries to remove");return}u.warning(`The following ${D.length} entries will be removed:`);for(let J of D.sort())u.print(u.hyperlink(w,J));if(!q){if(u.print(),!await G3({message:`Remove ${D.length} entries?`,default:!1}))return}let Y=0;for(let J of D)try{await zg6(J,{recursive:!0,force:!0}),Y++}catch(Z){u.error(`Could not remove entry ${J}`)}if(u.success(`Removed ${Y} entries`),!$)u.warning("You can use the --all option to remove generated statement and correct files as well")}import{exists as Id}from"fs/promises";Yq();import{join as yd}from"path";import{normalize as vv_,resolve as Tv_}from"path";function WD(q){let $=/\\Problem\{(.*?)\}/,w=q.match($);if(w)return w[1].trim();return null}async function Sd(q){let $=yd(H8(),"assets","prompts","io","proglangs",`io-${q}.md`);if(await Id($))return await j6($);else return u.warning(`Prompt for ${q} not found at ${$}`),""}async function i$(q){let $=[];for(let w of q){if(w===".")w=vv_(Tv_(process.cwd()));if(await Id(yd(w,"handler.yml")))$.push(w);else for(let f of Object.keys(l6).sort()){let K=yd(w,f,"handler.yml");if(await Id(K))$.push(Tv_(w,f))}}return $.map((w)=>vv_(w)).sort()}var Gk="No problem directories found: did not find handler.yml under the path(s) you used. A problem folder must contain handler.yml at its root, or use <language>/handler.yml under each language subfolder.";function ef(q){if(q.length===0)return"<none>";return q.map(($)=>`- ${$}`).join(`
|
|
621
621
|
`)}import{resolve as Pg6}from"path";var Xv_=new G6("clean").description("Clean disposable files").option("-d, --directory <directory>","problem directory",".").option("-a, --all","clean all disposable files (including generated statement and correct files",!1).addOption(new WJ("-f, --force","force removal").conflicts("dryRun")).addOption(new WJ("-n, --dry-run","show but do not remove files").conflicts("force")).action(async({directory:q,all:$,force:w,dryRun:f})=>{let K=w||!1;await u.section(`Cleaning disposable files in ${u.hyperlink(Pg6(q))}`,async()=>{let z=await i$([q]);for(let P of z)await u.section(`Cleaning directory ${u.hyperlink(P)}`,async()=>{await Wv_(K,$,P)})})});var wA=new G6("compilers").description("Query compiler information").action(async()=>{let q=await sW_();console.dir(q)});wA.command("list-defined").description("List all defined compiler names").action(async()=>{let q=await sG();console.dir(q)});wA.command("list-available").description("List all available compiler names").action(async()=>{let q=await eW_();console.dir(q)});var md=z6(vP(),1);var r5=new G6("config").summary("Manage configuration").description(`Manage configuration
|
|
622
622
|
|
|
623
623
|
The actual configuration file is stored at ${dH()}`).action(()=>{r5.help()});r5.command("show").alias("list").description("Show configuration options").action(async()=>{let q=await xy();u.yaml(q)});r5.command("get <key>").description("Get the value of a configuration option").action((q)=>{if(!(q in z8))throw Error(`Configuration key ${q} does not exist`);console.log(z8[q])});r5.command("set <key> <value>").description("Set the value of a configuration option").action(async(q,$)=>{if(!(q in z8))throw Error(`Configuration key ${q} does not exist`);let w=b8_($),f=C$.parse({...z8,[q]:w});await lH(f),u.success(`Configuration key ${q} updated successfully`)});r5.command("edit").description("Open an editor (uses $EDITOR or $VISUAL) to modify the configuration options").action(async()=>{let q=md.default.stringify(z8,null,4);while(!0){let $=await M5({message:"Edit configuration",default:q,postfix:".yml",waitForUserInput:!1});try{let w=C$.parse(md.default.parse($));await lH(w),u.success("Configuration options updated successfully");return}catch(w){if(w instanceof d7)console.error(D5(w).toString());else console.error(w);if(!await G3({message:"Edit again?",default:!0})){u.warning("No changes made to the configuration options");return}q=$}}});r5.command("reset").description("Reset configuration to default values").option("-f, --force","force reset without confirmation",!1).action(async({force:q})=>{if(!q){if(!await G3({message:"Are you sure you want to reset the configuration to default values?",default:!1})){u.warning("Reset cancelled");return}}let $=C$.parse({});await lH($),u.success("Configuration reset to default values successfully")});sq();var Ld=z6(XD(),1);import{cp as Vg6,exists as bv_,glob as Iv_}from"fs/promises";import Ak from"path";var fA=Ak.join(H8(),"assets","problems");async function Mg6(q){let $=[],w=await Array.fromAsync(Iv_("*",{cwd:fA}));w.sort();for(let K of w){$.push(new S1(gd(K)));let z=await Array.fromAsync(Iv_("*.pbm",{cwd:Ak.join(fA,K)}));z.sort();for(let P of z)$.push({name:P,value:Ak.join(K,P)})}let f=void 0;while(!0){f=await x4({message:"Select a template to clone:",choices:$,default:f});let K=Ak.join(fA,f),z=await F8(K,"README.md"),P=Ld.default(K,{allFiles:!0,dirsFirst:!1});if(console.log(),await u.markdown(z),console.log(P),await G3({message:`Clone template ${f} to ${q}?`,default:!0}))return f}}async function yv_(q,$){if(await bv_(q))throw Error(`Directory ${q} already exists`);if(!q.endsWith(".pbm"))throw Error("The output directory must end with .pbm");if(!$)$=await Mg6(q);let w=Ak.join(fA,$);if(!await bv_(w))throw Error(`Template ${$} does not exist`);await Vg6(w,q,{recursive:!0}),await XP(q),u.success(`Created problem ${u.hyperlink(q)} from template ${$}`);let f=Ld.default(q,{allFiles:!0,dirsFirst:!1});console.log(f)}var Sv_=new G6("clone").description("Clone a template into a new problem").argument("[template]","template to use (empty to interactive selection)").option("-d, --directory <path>","output directory","new-problem.pbm").action(async(q,{directory:$})=>{await yv_($,q)});var GT_=z6(k0_(),1);import{cp as jT_,exists as FR6,mkdir as oR6,readdir as AT_,rm as UR6,stat as QR6}from"fs/promises";import sd from"process";import b0_ from"path";import{fileURLToPath as gR6}from"url";import RR6 from"child_process";import bR6,{constants as IR6}from"fs/promises";import{promisify as DR6}from"util";import YR6 from"child_process";import ad,{constants as G0_}from"fs/promises";import v0_ from"process";import $R6 from"os";import wR6 from"fs";import _R6 from"fs";import O0_ from"fs";var rd;function eg6(){try{return O0_.statSync("/.dockerenv"),!0}catch{return!1}}function sg6(){try{return O0_.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function pd(){if(rd===void 0)rd=eg6()||sg6();return rd}var id,qR6=()=>{try{return _R6.statSync("/run/.containerenv"),!0}catch{return!1}};function uD(){if(id===void 0)id=qR6()||pd();return id}var W0_=()=>{if(v0_.platform!=="linux")return!1;if($R6.release().toLowerCase().includes("microsoft")){if(uD())return!1;return!0}try{return wR6.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!uD():!1}catch{return!1}},H9=v0_.env.__IS_WSL_TEST__?W0_:W0_();import T0_ from"process";import{Buffer as fR6}from"buffer";import{promisify as KR6}from"util";import zR6 from"child_process";var PR6=KR6(zR6.execFile),nd=()=>`${T0_.env.SYSTEMROOT||T0_.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var Hq=async(q,$={})=>{let{powerShellPath:w,...f}=$,K=Hq.encodeCommand(q);return PR6(w??nd(),[...Hq.argumentsPrefix,K],{encoding:"utf8",...f})};Hq.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];Hq.encodeCommand=(q)=>fR6.from(q,"utf16le").toString("base64");Hq.escapeArgument=(q)=>`'${String(q).replaceAll("'","''")}'`;function X0_(q){for(let $ of q.split(`
|