var fk=Object.create;var Fm=Object.defineProperty;var dk=Object.getOwnPropertyDescriptor;var hk=Object.getOwnPropertyNames;var mk=Object.getPrototypeOf,gk=Object.prototype.hasOwnProperty;var ke=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var xk=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of hk(t))!gk.call(e,i)&&i!==r&&Fm(e,i,{get:()=>t[i],enumerable:!(n=dk(t,i))||n.enumerable});return e};var Bm=(e,t,r)=>(r=e!=null?fk(mk(e)):{},xk(t||!e||!e.__esModule?Fm(r,"default",{value:e,enumerable:!0}):r,e));var Um=ke(jl=>{(function(){"use strict";var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(s){return n(a(s),arguments)}function r(s,o){return t.apply(null,[s].concat(o||[]))}function n(s,o){var l=1,u=s.length,c,p="",d,f,h,m,g,x,y,b;for(d=0;d=0),h.type){case"b":c=parseInt(c,10).toString(2);break;case"c":c=String.fromCharCode(parseInt(c,10));break;case"d":case"i":c=parseInt(c,10);break;case"j":c=JSON.stringify(c,null,h.width?parseInt(h.width):0);break;case"e":c=h.precision?parseFloat(c).toExponential(h.precision):parseFloat(c).toExponential();break;case"f":c=h.precision?parseFloat(c).toFixed(h.precision):parseFloat(c);break;case"g":c=h.precision?String(Number(c.toPrecision(h.precision))):parseFloat(c);break;case"o":c=(parseInt(c,10)>>>0).toString(8);break;case"s":c=String(c),c=h.precision?c.substring(0,h.precision):c;break;case"t":c=String(!!c),c=h.precision?c.substring(0,h.precision):c;break;case"T":c=Object.prototype.toString.call(c).slice(8,-1).toLowerCase(),c=h.precision?c.substring(0,h.precision):c;break;case"u":c=parseInt(c,10)>>>0;break;case"v":c=c.valueOf(),c=h.precision?c.substring(0,h.precision):c;break;case"x":c=(parseInt(c,10)>>>0).toString(16);break;case"X":c=(parseInt(c,10)>>>0).toString(16).toUpperCase();break}e.json.test(h.type)?p+=c:(e.number.test(h.type)&&(!y||h.sign)?(b=y?"+":"-",c=c.toString().replace(e.sign,"")):b="",g=h.pad_char?h.pad_char==="0"?"0":h.pad_char.charAt(1):" ",x=h.width-(b+c).length,m=h.width&&x>0?g.repeat(x):"",p+=h.align?b+c+m:g==="0"?b+m+c:m+b+c)}return p}var i=Object.create(null);function a(s){if(i[s])return i[s];for(var o=s,l,u=[],c=0;o;){if((l=e.text.exec(o))!==null)u.push(l[0]);else if((l=e.modulo.exec(o))!==null)u.push("%");else if((l=e.placeholder.exec(o))!==null){if(l[2]){c|=1;var p=[],d=l[2],f=[];if((f=e.key.exec(d))!==null)for(p.push(f[1]);(d=d.substring(f[0].length))!=="";)if((f=e.key_access.exec(d))!==null)p.push(f[1]);else if((f=e.index_access.exec(d))!==null)p.push(f[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");l[2]=p}else c|=2;if(c===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");u.push({placeholder:l[0],param_no:l[1],keys:l[2],sign:l[3],pad_char:l[4],align:l[5],width:l[6],precision:l[7],type:l[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");o=o.substring(l[0].length)}return i[s]=u}typeof jl<"u"&&(jl.sprintf=t,jl.vsprintf=r),typeof window<"u"&&(window.sprintf=t,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:r}}))})()});var ns=ke((vj,qm)=>{"use strict";qm.exports=ca;ca.CAPTURING_PHASE=1;ca.AT_TARGET=2;ca.BUBBLING_PHASE=3;function ca(e,t){if(this.type="",this.target=null,this.currentTarget=null,this.eventPhase=ca.AT_TARGET,this.bubbles=!1,this.cancelable=!1,this.isTrusted=!1,this.defaultPrevented=!1,this.timeStamp=Date.now(),this._propagationStopped=!1,this._immediatePropagationStopped=!1,this._initialized=!0,this._dispatching=!1,e&&(this.type=e),t)for(var r in t)this[r]=t[r]}ca.prototype=Object.create(Object.prototype,{constructor:{value:ca},stopPropagation:{value:function(){this._propagationStopped=!0}},stopImmediatePropagation:{value:function(){this._propagationStopped=!0,this._immediatePropagationStopped=!0}},preventDefault:{value:function(){this.cancelable&&(this.defaultPrevented=!0)}},initEvent:{value:function(t,r,n){this._initialized=!0,!this._dispatching&&(this._propagationStopped=!1,this._immediatePropagationStopped=!1,this.defaultPrevented=!1,this.isTrusted=!1,this.target=null,this.type=t,this.bubbles=r,this.cancelable=n)}}})});var Hp=ke((Ej,Wm)=>{"use strict";var Hm=ns();Wm.exports=qp;function qp(){Hm.call(this),this.view=null,this.detail=0}qp.prototype=Object.create(Hm.prototype,{constructor:{value:qp},initUIEvent:{value:function(e,t,r,n,i){this.initEvent(e,t,r),this.view=n,this.detail=i}}})});var jp=ke((Sj,Gm)=>{"use strict";var jm=Hp();Gm.exports=Wp;function Wp(){jm.call(this),this.screenX=this.screenY=this.clientX=this.clientY=0,this.ctrlKey=this.altKey=this.shiftKey=this.metaKey=!1,this.button=0,this.buttons=1,this.relatedTarget=null}Wp.prototype=Object.create(jm.prototype,{constructor:{value:Wp},initMouseEvent:{value:function(e,t,r,n,i,a,s,o,l,u,c,p,d,f,h){switch(this.initEvent(e,t,r,n,i),this.screenX=a,this.screenY=s,this.clientX=o,this.clientY=l,this.ctrlKey=u,this.altKey=c,this.shiftKey=p,this.metaKey=d,this.button=f,f){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2;break;default:this.buttons=0;break}this.relatedTarget=h}},getModifierState:{value:function(e){switch(e){case"Alt":return this.altKey;case"Control":return this.ctrlKey;case"Shift":return this.shiftKey;case"Meta":return this.metaKey;default:return!1}}}})});var Zl=ke((Aj,Zm)=>{"use strict";Zm.exports=Vl;var bk=1,wk=3,vk=4,Ek=5,Sk=7,Ak=8,Ck=9,kk=11,Nk=12,Tk=13,_k=14,Ok=15,Ik=17,$k=18,Dk=19,Rk=20,Lk=21,Mk=22,Pk=23,Fk=24,Bk=25,Uk=[null,"INDEX_SIZE_ERR",null,"HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","INVALID_CHARACTER_ERR",null,"NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INUSE_ATTRIBUTE_ERR","INVALID_STATE_ERR","SYNTAX_ERR","INVALID_MODIFICATION_ERR","NAMESPACE_ERR","INVALID_ACCESS_ERR",null,"TYPE_MISMATCH_ERR","SECURITY_ERR","NETWORK_ERR","ABORT_ERR","URL_MISMATCH_ERR","QUOTA_EXCEEDED_ERR","TIMEOUT_ERR","INVALID_NODE_TYPE_ERR","DATA_CLONE_ERR"],zk=[null,"INDEX_SIZE_ERR (1): the index is not in the allowed range",null,"HIERARCHY_REQUEST_ERR (3): the operation would yield an incorrect nodes model","WRONG_DOCUMENT_ERR (4): the object is in the wrong Document, a call to importNode is required","INVALID_CHARACTER_ERR (5): the string contains invalid characters",null,"NO_MODIFICATION_ALLOWED_ERR (7): the object can not be modified","NOT_FOUND_ERR (8): the object can not be found here","NOT_SUPPORTED_ERR (9): this operation is not supported","INUSE_ATTRIBUTE_ERR (10): setAttributeNode called on owned Attribute","INVALID_STATE_ERR (11): the object is in an invalid state","SYNTAX_ERR (12): the string did not match the expected pattern","INVALID_MODIFICATION_ERR (13): the object can not be modified in this way","NAMESPACE_ERR (14): the operation is not allowed by Namespaces in XML","INVALID_ACCESS_ERR (15): the object does not support the operation or argument",null,"TYPE_MISMATCH_ERR (17): the type of the object does not match the expected type","SECURITY_ERR (18): the operation is insecure","NETWORK_ERR (19): a network error occurred","ABORT_ERR (20): the user aborted an operation","URL_MISMATCH_ERR (21): the given URL does not match another URL","QUOTA_EXCEEDED_ERR (22): the quota has been exceeded","TIMEOUT_ERR (23): a timeout occurred","INVALID_NODE_TYPE_ERR (24): the supplied node is invalid or has an invalid ancestor for this operation","DATA_CLONE_ERR (25): the object can not be cloned."],Vm={INDEX_SIZE_ERR:bk,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:wk,WRONG_DOCUMENT_ERR:vk,INVALID_CHARACTER_ERR:Ek,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:Sk,NOT_FOUND_ERR:Ak,NOT_SUPPORTED_ERR:Ck,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:kk,SYNTAX_ERR:Nk,INVALID_MODIFICATION_ERR:Tk,NAMESPACE_ERR:_k,INVALID_ACCESS_ERR:Ok,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:Ik,SECURITY_ERR:$k,NETWORK_ERR:Dk,ABORT_ERR:Rk,URL_MISMATCH_ERR:Lk,QUOTA_EXCEEDED_ERR:Mk,TIMEOUT_ERR:Pk,INVALID_NODE_TYPE_ERR:Fk,DATA_CLONE_ERR:Bk};function Vl(e){Error.call(this),Error.captureStackTrace(this,this.constructor),this.code=e,this.message=zk[e],this.name=Uk[e]}Vl.prototype.__proto__=Error.prototype;for(Gl in Vm)Gp={value:Vm[Gl]},Object.defineProperty(Vl,Gl,Gp),Object.defineProperty(Vl.prototype,Gl,Gp);var Gp,Gl});var Xl=ke(Xm=>{Xm.isApiWritable=!globalThis.__domino_frozen__});var Wt=ke(ct=>{"use strict";var Ht=Zl(),tr=Ht,qk=Xl().isApiWritable;ct.NAMESPACE={HTML:"http://www.w3.org/1999/xhtml",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink"};ct.IndexSizeError=function(){throw new Ht(tr.INDEX_SIZE_ERR)};ct.HierarchyRequestError=function(){throw new Ht(tr.HIERARCHY_REQUEST_ERR)};ct.WrongDocumentError=function(){throw new Ht(tr.WRONG_DOCUMENT_ERR)};ct.InvalidCharacterError=function(){throw new Ht(tr.INVALID_CHARACTER_ERR)};ct.NoModificationAllowedError=function(){throw new Ht(tr.NO_MODIFICATION_ALLOWED_ERR)};ct.NotFoundError=function(){throw new Ht(tr.NOT_FOUND_ERR)};ct.NotSupportedError=function(){throw new Ht(tr.NOT_SUPPORTED_ERR)};ct.InvalidStateError=function(){throw new Ht(tr.INVALID_STATE_ERR)};ct.SyntaxError=function(){throw new Ht(tr.SYNTAX_ERR)};ct.InvalidModificationError=function(){throw new Ht(tr.INVALID_MODIFICATION_ERR)};ct.NamespaceError=function(){throw new Ht(tr.NAMESPACE_ERR)};ct.InvalidAccessError=function(){throw new Ht(tr.INVALID_ACCESS_ERR)};ct.TypeMismatchError=function(){throw new Ht(tr.TYPE_MISMATCH_ERR)};ct.SecurityError=function(){throw new Ht(tr.SECURITY_ERR)};ct.NetworkError=function(){throw new Ht(tr.NETWORK_ERR)};ct.AbortError=function(){throw new Ht(tr.ABORT_ERR)};ct.UrlMismatchError=function(){throw new Ht(tr.URL_MISMATCH_ERR)};ct.QuotaExceededError=function(){throw new Ht(tr.QUOTA_EXCEEDED_ERR)};ct.TimeoutError=function(){throw new Ht(tr.TIMEOUT_ERR)};ct.InvalidNodeTypeError=function(){throw new Ht(tr.INVALID_NODE_TYPE_ERR)};ct.DataCloneError=function(){throw new Ht(tr.DATA_CLONE_ERR)};ct.nyi=function(){throw new Error("NotYetImplemented")};ct.shouldOverride=function(){throw new Error("Abstract function; should be overriding in subclass.")};ct.assert=function(e,t){if(!e)throw new Error("Assertion failed: "+(t||"")+` `+new Error().stack)};ct.expose=function(e,t){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],writable:qk})};ct.merge=function(e,t){for(var r in t)e[r]=t[r]};ct.documentOrder=function(e,t){return 3-(e.compareDocumentPosition(t)&6)};ct.toASCIILowerCase=function(e){return e.replace(/[A-Z]+/g,function(t){return t.toLowerCase()})};ct.toASCIIUpperCase=function(e){return e.replace(/[a-z]+/g,function(t){return t.toUpperCase()})}});var Vp=ke((Nj,Km)=>{"use strict";var pa=ns(),Hk=jp(),Wk=Wt();Km.exports=Qm;function Qm(){}Qm.prototype={addEventListener:function(t,r,n){if(r){n===void 0&&(n=!1),this._listeners||(this._listeners=Object.create(null)),this._listeners[t]||(this._listeners[t]=[]);for(var i=this._listeners[t],a=0,s=i.length;a=0&&(n(i[s],t),!t._propagationStopped);s--);if(t._propagationStopped||(t.eventPhase=pa.AT_TARGET,n(this,t)),t.bubbles&&!t._propagationStopped){t.eventPhase=pa.BUBBLING_PHASE;for(var o=0,l=i.length;o{"use strict";var xi=Wt(),dn=Ym.exports={valid:function(e){return xi.assert(e,"list falsy"),xi.assert(e._previousSibling,"previous falsy"),xi.assert(e._nextSibling,"next falsy"),!0},insertBefore:function(e,t){xi.assert(dn.valid(e)&&dn.valid(t));var r=e,n=e._previousSibling,i=t,a=t._previousSibling;r._previousSibling=a,n._nextSibling=i,a._nextSibling=r,i._previousSibling=n,xi.assert(dn.valid(e)&&dn.valid(t))},replace:function(e,t){xi.assert(dn.valid(e)&&(t===null||dn.valid(t))),t!==null&&dn.insertBefore(t,e),dn.remove(e),xi.assert(dn.valid(e)&&(t===null||dn.valid(t)))},remove:function(e){xi.assert(dn.valid(e));var t=e._previousSibling;if(t!==e){var r=e._nextSibling;t._nextSibling=r,r._previousSibling=t,e._previousSibling=e._nextSibling=e,xi.assert(dn.valid(e))}}}});var Xp=ke((_j,sg)=>{"use strict";sg.exports={serializeOne:Kk,\u0275escapeMatchingClosingTag:ng,\u0275escapeClosingCommentTag:ig,\u0275escapeProcessingInstructionContent:ag};var rg=Wt(),fa=rg.NAMESPACE,Jm={STYLE:!0,SCRIPT:!0,XMP:!0,IFRAME:!0,NOEMBED:!0,NOFRAMES:!0,PLAINTEXT:!0},jk={area:!0,base:!0,basefont:!0,bgsound:!0,br:!0,col:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Gk={},eg=/[&<>\u00A0]/g,tg=/[&"<>\u00A0]/g;function Vk(e){return eg.test(e)?e.replace(eg,t=>{switch(t){case"&":return"&";case"<":return"<";case">":return">";case"\xA0":return" "}}):e}function Zk(e){return tg.test(e)?e.replace(tg,t=>{switch(t){case"<":return"<";case">":return">";case"&":return"&";case'"':return""";case"\xA0":return" "}}):e}function Xk(e){var t=e.namespaceURI;return t?t===fa.XML?"xml:"+e.localName:t===fa.XLINK?"xlink:"+e.localName:t===fa.XMLNS?e.localName==="xmlns"?"xmlns":"xmlns:"+e.localName:e.name:e.localName}function ng(e,t){let r="/;function ig(e){return Qk.test(e)?e.replace(/(--\!?)>/g,"$1>"):e}function ag(e){return e.includes(">")?e.replaceAll(">",">"):e}function Kk(e,t){var r="";switch(e.nodeType){case 1:var n=e.namespaceURI,i=n===fa.HTML,a=i||n===fa.SVG||n===fa.MATHML?e.localName:e.tagName;r+="<"+a;for(var s=0,o=e._numattrs;s"}break;case 3:case 4:var c;t.nodeType===1&&t.namespaceURI===fa.HTML?c=t.tagName:c="",Jm[c]||c==="NOSCRIPT"&&t.ownerDocument._scripting_enabled?r+=e.data:r+=Vk(e.data);break;case 8:r+="";break;case 7:let p=ag(e.data);r+="";break;case 10:r+="";break;default:rg.InvalidStateError()}return r}});var xr=ke((Oj,fg)=>{"use strict";fg.exports=Rt;var pg=Vp(),Ql=Zp(),og=Xp(),pt=Wt();function Rt(){pg.call(this),this.parentNode=null,this._nextSibling=this._previousSibling=this,this._index=void 0}var qr=Rt.ELEMENT_NODE=1,Qp=Rt.ATTRIBUTE_NODE=2,Kl=Rt.TEXT_NODE=3,Yk=Rt.CDATA_SECTION_NODE=4,Jk=Rt.ENTITY_REFERENCE_NODE=5,Kp=Rt.ENTITY_NODE=6,lg=Rt.PROCESSING_INSTRUCTION_NODE=7,ug=Rt.COMMENT_NODE=8,xo=Rt.DOCUMENT_NODE=9,hn=Rt.DOCUMENT_TYPE_NODE=10,ji=Rt.DOCUMENT_FRAGMENT_NODE=11,Yp=Rt.NOTATION_NODE=12,Jp=Rt.DOCUMENT_POSITION_DISCONNECTED=1,ef=Rt.DOCUMENT_POSITION_PRECEDING=2,tf=Rt.DOCUMENT_POSITION_FOLLOWING=4,cg=Rt.DOCUMENT_POSITION_CONTAINS=8,rf=Rt.DOCUMENT_POSITION_CONTAINED_BY=16,nf=Rt.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;Rt.prototype=Object.create(pg.prototype,{baseURI:{get:pt.nyi},parentElement:{get:function(){return this.parentNode&&this.parentNode.nodeType===qr?this.parentNode:null}},hasChildNodes:{value:pt.shouldOverride},firstChild:{get:pt.shouldOverride},lastChild:{get:pt.shouldOverride},isConnected:{get:function(){let e=this;for(;e!=null;){if(e.nodeType===Rt.DOCUMENT_NODE)return!0;e=e.parentNode,e!=null&&e.nodeType===Rt.DOCUMENT_FRAGMENT_NODE&&(e=e.host)}return!1}},previousSibling:{get:function(){var e=this.parentNode;return!e||this===e.firstChild?null:this._previousSibling}},nextSibling:{get:function(){var e=this.parentNode,t=this._nextSibling;return!e||t===e.firstChild?null:t}},textContent:{get:function(){return null},set:function(e){}},innerText:{get:function(){return null},set:function(e){}},_countChildrenOfType:{value:function(e){for(var t=0,r=this.firstChild;r!==null;r=r.nextSibling)r.nodeType===e&&t++;return t}},_ensureInsertValid:{value:function(t,r,n){var i=this,a,s;if(!t.nodeType)throw new TypeError("not a node");switch(i.nodeType){case xo:case ji:case qr:break;default:pt.HierarchyRequestError()}switch(t.isAncestor(i)&&pt.HierarchyRequestError(),(r!==null||!n)&&r.parentNode!==i&&pt.NotFoundError(),t.nodeType){case ji:case hn:case qr:case Kl:case lg:case ug:break;default:pt.HierarchyRequestError()}if(i.nodeType===xo)switch(t.nodeType){case Kl:pt.HierarchyRequestError();break;case ji:switch(t._countChildrenOfType(Kl)>0&&pt.HierarchyRequestError(),t._countChildrenOfType(qr)){case 0:break;case 1:if(r!==null)for(n&&r.nodeType===hn&&pt.HierarchyRequestError(),s=r.nextSibling;s!==null;s=s.nextSibling)s.nodeType===hn&&pt.HierarchyRequestError();a=i._countChildrenOfType(qr),n?a>0&&pt.HierarchyRequestError():(a>1||a===1&&r.nodeType!==qr)&&pt.HierarchyRequestError();break;default:pt.HierarchyRequestError()}break;case qr:if(r!==null)for(n&&r.nodeType===hn&&pt.HierarchyRequestError(),s=r.nextSibling;s!==null;s=s.nextSibling)s.nodeType===hn&&pt.HierarchyRequestError();a=i._countChildrenOfType(qr),n?a>0&&pt.HierarchyRequestError():(a>1||a===1&&r.nodeType!==qr)&&pt.HierarchyRequestError();break;case hn:if(r===null)i._countChildrenOfType(qr)&&pt.HierarchyRequestError();else for(s=i.firstChild;s!==null&&s!==r;s=s.nextSibling)s.nodeType===qr&&pt.HierarchyRequestError();a=i._countChildrenOfType(hn),n?a>0&&pt.HierarchyRequestError():(a>1||a===1&&r.nodeType!==hn)&&pt.HierarchyRequestError();break}else t.nodeType===hn&&pt.HierarchyRequestError()}},insertBefore:{value:function(t,r){var n=this;n._ensureInsertValid(t,r,!0);var i=r;return i===t&&(i=t.nextSibling),n.doc.adoptNode(t),t._insertOrReplace(n,i,!1),t}},appendChild:{value:function(e){return this.insertBefore(e,null)}},_appendChild:{value:function(e){e._insertOrReplace(this,null,!1)}},removeChild:{value:function(t){var r=this;if(!t.nodeType)throw new TypeError("not a node");return t.parentNode!==r&&pt.NotFoundError(),t.remove(),t}},replaceChild:{value:function(t,r){var n=this;return n._ensureInsertValid(t,r,!1),t.doc!==n.doc&&n.doc.adoptNode(t),t._insertOrReplace(n,r,!0),r}},contains:{value:function(t){return t===null?!1:this===t?!0:(this.compareDocumentPosition(t)&rf)!==0}},compareDocumentPosition:{value:function(t){if(this===t)return 0;if(this.doc!==t.doc||this.rooted!==t.rooted)return Jp+nf;for(var r=[],n=[],i=this;i!==null;i=i.parentNode)r.push(i);for(i=t;i!==null;i=i.parentNode)n.push(i);if(r.reverse(),n.reverse(),r[0]!==n[0])return Jp+nf;i=Math.min(r.length,n.length);for(var a=1;a2?c[2]:null):f>2&&l!==null&&Ql.insertBefore(c[2],l),t._childNodes)for(c[0]=r===null?t._childNodes.length:r._index,t._childNodes.splice.apply(t._childNodes,c),s=2;s2?t._firstChild=c[2]:n&&(t._firstChild=null));if(i._childNodes?i._childNodes.length=0:i._firstChild=null,t.rooted)for(t.modify(),s=2;s{"use strict";dg.exports=class extends Array{constructor(t){if(super(t&&t.length||0),t)for(var r in t)this[r]=t[r]}item(t){return this[t]||null}}});var gg=ke((Dj,mg)=>{"use strict";function eN(e){return this[e]||null}function tN(e){return e||(e=[]),e.item=eN,e}mg.exports=tN});var da=ke((Rj,xg)=>{"use strict";var af;try{af=hg()}catch{af=gg()}xg.exports=af});var Yl=ke((Lj,wg)=>{"use strict";wg.exports=bg;var yg=xr(),rN=da();function bg(){yg.call(this),this._firstChild=this._childNodes=null}bg.prototype=Object.create(yg.prototype,{hasChildNodes:{value:function(){return this._childNodes?this._childNodes.length>0:this._firstChild!==null}},childNodes:{get:function(){return this._ensureChildNodes(),this._childNodes}},firstChild:{get:function(){return this._childNodes?this._childNodes.length===0?null:this._childNodes[0]:this._firstChild}},lastChild:{get:function(){var e=this._childNodes,t;return e?e.length===0?null:e[e.length-1]:(t=this._firstChild,t===null?null:t._previousSibling)}},_ensureChildNodes:{value:function(){if(!this._childNodes){var e=this._firstChild,t=e,r=this._childNodes=new rN;if(e)do r.push(t),t=t._nextSibling;while(t!==e);this._firstChild=null}}},removeChildren:{value:function(){for(var t=this.rooted?this.ownerDocument:null,r=this.firstChild,n;r!==null;)n=r,r=n.nextSibling,t&&t.mutateRemove(n),n.parentNode=null;this._childNodes?this._childNodes.length=0:this._firstChild=null,this.modify()}}})});var Jl=ke(lf=>{"use strict";lf.isValidName=uN;lf.isValidQName=cN;var nN=/^[_:A-Za-z][-.:\w]+$/,iN=/^([_A-Za-z][-.\w]+|[_A-Za-z][-.\w]+:[_A-Za-z][-.\w]+)$/,yo="_A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",bo="-._A-Za-z0-9\xB7\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0300-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",ha="["+yo+"]["+bo+"]*",sf=yo+":",of=bo+":",aN=new RegExp("^["+sf+"]["+of+"]*$"),sN=new RegExp("^("+ha+"|"+ha+":"+ha+")$"),vg=/[\uD800-\uDB7F\uDC00-\uDFFF]/,Eg=/[\uD800-\uDB7F\uDC00-\uDFFF]/g,Sg=/[\uD800-\uDB7F][\uDC00-\uDFFF]/g;yo+="\uD800-\u{EFC00}-\uDFFF";bo+="\uD800-\u{EFC00}-\uDFFF";ha="["+yo+"]["+bo+"]*";sf=yo+":";of=bo+":";var oN=new RegExp("^["+sf+"]["+of+"]*$"),lN=new RegExp("^("+ha+"|"+ha+":"+ha+")$");function uN(e){if(nN.test(e)||aN.test(e))return!0;if(!vg.test(e)||!oN.test(e))return!1;var t=e.match(Eg),r=e.match(Sg);return r!==null&&2*r.length===t.length}function cN(e){if(iN.test(e)||sN.test(e))return!0;if(!vg.test(e)||!lN.test(e))return!1;var t=e.match(Eg),r=e.match(Sg);return r!==null&&2*r.length===t.length}});var cf=ke(uf=>{"use strict";var Ag=Wt();uf.property=function(e){if(Array.isArray(e.type)){var t=Object.create(null);e.type.forEach(function(i){t[i.value||i]=i.alias||i});var r=e.missing;r===void 0&&(r=null);var n=e.invalid;return n===void 0&&(n=r),{get:function(){var i=this._getattr(e.name);return i===null?r:(i=t[i.toLowerCase()],i!==void 0?i:n!==null?n:i)},set:function(i){this._setattr(e.name,i)}}}else{if(e.type===Boolean)return{get:function(){return this.hasAttribute(e.name)},set:function(i){i?this._setattr(e.name,""):this.removeAttribute(e.name)}};if(e.type===Number||e.type==="long"||e.type==="unsigned long"||e.type==="limited unsigned long with fallback")return pN(e);if(!e.type||e.type===String)return{get:function(){return this._getattr(e.name)||""},set:function(i){e.treatNullAsEmptyString&&i===null&&(i=""),this._setattr(e.name,i)}};if(typeof e.type=="function")return e.type(e.name,e)}throw new Error("Invalid attribute definition")};function pN(e){var t;typeof e.default=="function"?t=e.default:typeof e.default=="number"?t=function(){return e.default}:t=function(){Ag.assert(!1,typeof e.default)};var r=e.type==="unsigned long",n=e.type==="long",i=e.type==="limited unsigned long with fallback",a=e.min,s=e.max,o=e.setmin;return a===void 0&&(r&&(a=0),n&&(a=-2147483648),i&&(a=1)),s===void 0&&(r||n||i)&&(s=2147483647),{get:function(){var l=this._getattr(e.name),u=e.float?parseFloat(l):parseInt(l,10);if(l===null||!isFinite(u)||a!==void 0&&us)return t.call(this);if(r||n||i){if(!/^[ \t\n\f\r]*[-+]?[0-9]/.test(l))return t.call(this);u=u|0}return u},set:function(l){e.float||(l=Math.floor(l)),o!==void 0&&l2147483647?t.call(this):l|0:i?l=l<1||l>2147483647?t.call(this):l|0:n&&(l=l<-2147483648||l>2147483647?t.call(this):l|0),this._setattr(e.name,String(l))}}}uf.registerChangeHandler=function(e,t,r){var n=e.prototype;Object.prototype.hasOwnProperty.call(n,"_attributeChangeHandlers")||(n._attributeChangeHandlers=Object.create(n._attributeChangeHandlers||null)),n._attributeChangeHandlers[t]=r}});var Ng=ke((Fj,kg)=>{"use strict";kg.exports=Cg;var fN=xr();function Cg(e,t){this.root=e,this.filter=t,this.lastModTime=e.lastModTime,this.done=!1,this.cache=[],this.traverse()}Cg.prototype=Object.create(Object.prototype,{length:{get:function(){return this.checkcache(),this.done||this.traverse(),this.cache.length}},item:{value:function(e){return this.checkcache(),!this.done&&e>=this.cache.length&&this.traverse(),this.cache[e]}},checkcache:{value:function(){if(this.lastModTime!==this.root.lastModTime){for(var e=this.cache.length-1;e>=0;e--)this[e]=void 0;this.cache.length=0,this.done=!1,this.lastModTime=this.root.lastModTime}}},traverse:{value:function(e){e!==void 0&&e++;for(var t;(t=this.next())!==null;)if(this[this.cache.length]=t,this.cache.push(t),e&&this.cache.length===e)return;this.done=!0}},next:{value:function(){var e=this.cache.length===0?this.root:this.cache[this.cache.length-1],t;for(e.nodeType===fN.DOCUMENT_NODE?t=e.documentElement:t=e.nextElement(this.root);t;){if(this.filter(t))return t;t=t.nextElement(this.root)}return null}}})});var ff=ke((Bj,Og)=>{"use strict";var pf=Wt();Og.exports=_g;function _g(e,t){this._getString=e,this._setString=t,this._length=0,this._lastStringValue="",this._update()}Object.defineProperties(_g.prototype,{length:{get:function(){return this._length}},item:{value:function(e){var t=is(this);return e<0||e>=t.length?null:t[e]}},contains:{value:function(e){e=String(e);var t=is(this);return t.indexOf(e)>-1}},add:{value:function(){for(var e=is(this),t=0,r=arguments.length;t-1&&e.splice(i,1)}this._update(e)}},toggle:{value:function(t,r){return t=wo(t),this.contains(t)?r===void 0||r===!1?(this.remove(t),!1):!0:r===void 0||r===!0?(this.add(t),!0):!1}},replace:{value:function(t,r){String(r)===""&&pf.SyntaxError(),t=wo(t),r=wo(r);var n=is(this),i=n.indexOf(t);if(i<0)return!1;var a=n.indexOf(r);return a<0?n[i]=r:i{"use strict";var eu=Object.create(null,{location:{get:function(){throw new Error("window.location is not supported.")}}}),hN=function(e,t){return e.compareDocumentPosition(t)},mN=function(e,t){return hN(e,t)&2?1:-1},ru=function(e){for(;(e=e.nextSibling)&&e.nodeType!==1;);return e},ss=function(e){for(;(e=e.previousSibling)&&e.nodeType!==1;);return e},gN=function(e){if(e=e.firstChild)for(;e.nodeType!==1&&(e=e.nextSibling););return e},xN=function(e){if(e=e.lastChild)for(;e.nodeType!==1&&(e=e.previousSibling););return e},as=function(e){if(!e.parentNode)return!1;var t=e.parentNode.nodeType;return t===1||t===9},Ig=function(e){if(!e)return e;var t=e[0];return t==='"'||t==="'"?(e[e.length-1]===t?e=e.slice(1,-1):e=e.slice(1),e.replace($e.str_escape,function(r){var n=/^\\(?:([0-9A-Fa-f]+)|([\r\n\f]+))/.exec(r);if(!n)return r.slice(1);if(n[2])return"";var i=parseInt(n[1],16);return String.fromCodePoint?String.fromCodePoint(i):String.fromCharCode(i)})):$e.ident.test(e)?Gi(e):e},Gi=function(e){return e.replace($e.escape,function(t){var r=/^\\([0-9A-Fa-f]+)/.exec(t);if(!r)return t[1];var n=parseInt(r[1],16);return String.fromCodePoint?String.fromCodePoint(n):String.fromCharCode(n)})},yN=(function(){return Array.prototype.indexOf?Array.prototype.indexOf:function(e,t){for(var r=this.length;r--;)if(this[r]===t)return r;return-1}})(),Dg=function(e,t){var r=$e.inside.source.replace(//g,t);return new RegExp(r)},Hr=function(e,t,r){return e=e.source,e=e.replace(t,r.source||r),new RegExp(e)},$g=function(e,t){return e.replace(/^(?:\w+:\/\/|\/+)/,"").replace(/(?:\/+|\/*#.*?)$/,"").split("/",t).join("/")},bN=function(e,t){var r=e.replace(/\s+/g,""),n;return r==="even"?r="2n+0":r==="odd"?r="2n+1":r.indexOf("n")===-1&&(r="0n"+r),n=/^([+-])?(\d+)?n([+-])?(\d+)?$/.exec(r),{group:n[1]==="-"?-(n[2]||1):+(n[2]||1),offset:n[4]?n[3]==="-"?-n[4]:+n[4]:0}},df=function(e,t,r){var n=bN(e),i=n.group,a=n.offset,s=r?xN:gN,o=r?ss:ru;return function(l){if(as(l))for(var u=s(l.parentNode),c=0;u;){if(t(u,l)&&c++,u===l)return c-=a,i&&c?c%i===0&&c<0==i<0:!c;u=o(u)}}},pr={"*":(function(){return function(){return!0}})(),type:function(e){return e=e.toLowerCase(),function(t){return t.nodeName.toLowerCase()===e}},attr:function(e,t,r,n){return t=Rg[t],function(i){var a;switch(e){case"for":a=i.htmlFor;break;case"class":a=i.className,a===""&&i.getAttribute("class")==null&&(a=null);break;case"href":case"src":a=i.getAttribute(e,2);break;case"title":a=i.getAttribute("title")||null;break;case"id":case"lang":case"dir":case"accessKey":case"hidden":case"tabIndex":case"style":if(i.getAttribute){a=i.getAttribute(e);break}default:if(i.hasAttribute&&!i.hasAttribute(e))break;a=i[e]!=null?i[e]:i.getAttribute&&i.getAttribute(e);break}if(a!=null)return a=a+"",n&&(a=a.toLowerCase(),r=r.toLowerCase()),t(a,r)}},":first-child":function(e){return!ss(e)&&as(e)},":last-child":function(e){return!ru(e)&&as(e)},":only-child":function(e){return!ss(e)&&!ru(e)&&as(e)},":nth-child":function(e,t){return df(e,function(){return!0},t)},":nth-last-child":function(e){return pr[":nth-child"](e,!0)},":root":function(e){return e.ownerDocument.documentElement===e},":empty":function(e){return!e.firstChild},":not":function(e){var t=mf(e);return function(r){return!t(r)}},":first-of-type":function(e){if(as(e)){for(var t=e.nodeName;e=ss(e);)if(e.nodeName===t)return;return!0}},":last-of-type":function(e){if(as(e)){for(var t=e.nodeName;e=ru(e);)if(e.nodeName===t)return;return!0}},":only-of-type":function(e){return pr[":first-of-type"](e)&&pr[":last-of-type"](e)},":nth-of-type":function(e,t){return df(e,function(r,n){return r.nodeName===n.nodeName},t)},":nth-last-of-type":function(e){return pr[":nth-of-type"](e,!0)},":checked":function(e){return!!(e.checked||e.selected)},":indeterminate":function(e){return!pr[":checked"](e)},":enabled":function(e){return!e.disabled&&e.type!=="hidden"},":disabled":function(e){return!!e.disabled},":target":function(e){return e.id===eu.location.hash.substring(1)},":focus":function(e){return e===e.ownerDocument.activeElement},":is":function(e){return mf(e)},":matches":function(e){return pr[":is"](e)},":nth-match":function(e,t){var r=e.split(/\s*,\s*/),n=r.shift(),i=mf(r.join(","));return df(n,i,t)},":nth-last-match":function(e){return pr[":nth-match"](e,!0)},":links-here":function(e){return e+""==eu.location+""},":lang":function(e){return function(t){for(;t;){if(t.lang)return t.lang.indexOf(e)===0;t=t.parentNode}}},":dir":function(e){return function(t){for(;t;){if(t.dir)return t.dir===e;t=t.parentNode}}},":scope":function(e,t){var r=t||e.ownerDocument;return r.nodeType===9?e===r.documentElement:e===r},":any-link":function(e){return typeof e.href=="string"},":local-link":function(e){if(e.nodeName)return e.href&&e.host===eu.location.host;var t=+e+1;return function(r){if(r.href){var n=eu.location+"",i=r+"";return $g(n,t)===$g(i,t)}}},":default":function(e){return!!e.defaultSelected},":valid":function(e){return e.willValidate||e.validity&&e.validity.valid},":invalid":function(e){return!pr[":valid"](e)},":in-range":function(e){return e.value>e.min&&e.value<=e.max},":out-of-range":function(e){return!pr[":in-range"](e)},":required":function(e){return!!e.required},":optional":function(e){return!e.required},":read-only":function(e){if(e.readOnly)return!0;var t=e.getAttribute("contenteditable"),r=e.contentEditable,n=e.nodeName.toLowerCase();return n=n!=="input"&&n!=="textarea",(n||e.disabled)&&t==null&&r!=="true"},":read-write":function(e){return!pr[":read-only"](e)},":hover":function(){throw new Error(":hover is not supported.")},":active":function(){throw new Error(":active is not supported.")},":link":function(){throw new Error(":link is not supported.")},":visited":function(){throw new Error(":visited is not supported.")},":column":function(){throw new Error(":column is not supported.")},":nth-column":function(){throw new Error(":nth-column is not supported.")},":nth-last-column":function(){throw new Error(":nth-last-column is not supported.")},":current":function(){throw new Error(":current is not supported.")},":past":function(){throw new Error(":past is not supported.")},":future":function(){throw new Error(":future is not supported.")},":contains":function(e){return function(t){var r=t.innerText||t.textContent||t.value||"";return r.indexOf(e)!==-1}},":has":function(e){return function(t){return Lg(e,t).length>0}}},Rg={"-":function(){return!0},"=":function(e,t){return e===t},"*=":function(e,t){return e.indexOf(t)!==-1},"~=":function(e,t){var r,n,i,a;for(n=0;;n=r+1){if(r=e.indexOf(t,n),r===-1)return!1;if(i=e[r-1],a=e[r+t.length],(!i||i===" ")&&(!a||a===" "))return!0}},"|=":function(e,t){var r=e.indexOf(t),n;if(r===0)return n=e[r+t.length],n==="-"||!n},"^=":function(e,t){return e.indexOf(t)===0},"$=":function(e,t){var r=e.lastIndexOf(t);return r!==-1&&r+t.length===e.length},"!=":function(e,t){return e!==t}},vo={" ":function(e){return function(t){for(;t=t.parentNode;)if(e(t))return t}},">":function(e){return function(t){if(t=t.parentNode)return e(t)&&t}},"+":function(e){return function(t){if(t=ss(t))return e(t)&&t}},"~":function(e){return function(t){for(;t=ss(t);)if(e(t))return t}},noop:function(e){return function(t){return e(t)&&t}},ref:function(e,t){var r;function n(i){for(var a=i.ownerDocument,s=a.getElementsByTagName("*"),o=s.length;o--;)if(r=s[o],n.test(i))return r=null,!0;r=null}return n.combinator=function(i){if(!(!r||!r.getAttribute)){var a=r.getAttribute(t)||"";if(a[0]==="#"&&(a=a.substring(1)),a===i.id&&e(r))return r}},n}},$e={escape:/\\(?:[^0-9A-Fa-f\r\n]|[0-9A-Fa-f]{1,6}[\r\n\t ]?)/g,str_escape:/(escape)|\\(\n|\r\n?|\f)/g,nonascii:/[\u00A0-\uFFFF]/,cssid:/(?:(?!-?[0-9])(?:escape|nonascii|[-_a-zA-Z0-9])+)/,qname:/^ *(cssid|\*)/,simple:/^(?:([.#]cssid)|pseudo|attr)/,ref:/^ *\/(cssid)\/ */,combinator:/^(?: +([^ \w*.#\\]) +|( )+|([^ \w*.#\\]))(?! *$)/,attr:/^\[(cssid)(?:([^\w]?=)(inside))?\]/,pseudo:/^(:cssid)(?:\((inside)\))?/,inside:/(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|<[^"'>]*>|\\["'>]|[^"'>])*/,ident:/^(cssid)$/};$e.cssid=Hr($e.cssid,"nonascii",$e.nonascii);$e.cssid=Hr($e.cssid,"escape",$e.escape);$e.qname=Hr($e.qname,"cssid",$e.cssid);$e.simple=Hr($e.simple,"cssid",$e.cssid);$e.ref=Hr($e.ref,"cssid",$e.cssid);$e.attr=Hr($e.attr,"cssid",$e.cssid);$e.pseudo=Hr($e.pseudo,"cssid",$e.cssid);$e.inside=Hr($e.inside,`[^"'>]*`,$e.inside);$e.attr=Hr($e.attr,"inside",Dg("\\[","\\]"));$e.pseudo=Hr($e.pseudo,"inside",Dg("\\(","\\)"));$e.simple=Hr($e.simple,"pseudo",$e.pseudo);$e.simple=Hr($e.simple,"attr",$e.attr);$e.ident=Hr($e.ident,"cssid",$e.cssid);$e.str_escape=Hr($e.str_escape,"escape",$e.escape);var Eo=function(e){for(var t=e.replace(/^\s+|\s+$/g,""),r,n=[],i=[],a,s,o,l,u;t;){if(o=$e.qname.exec(t))t=t.substring(o[0].length),s=Gi(o[1]),i.push(tu(s,!0));else if(o=$e.simple.exec(t))t=t.substring(o[0].length),s="*",i.push(tu(s,!0)),i.push(tu(o));else throw new SyntaxError("Invalid selector.");for(;o=$e.simple.exec(t);)t=t.substring(o[0].length),i.push(tu(o));if(t[0]==="!"&&(t=t.substring(1),a=vN(),a.qname=s,i.push(a.simple)),o=$e.ref.exec(t)){t=t.substring(o[0].length),u=vo.ref(hf(i),Gi(o[1])),n.push(u.combinator),i=[];continue}if(o=$e.combinator.exec(t)){if(t=t.substring(o[0].length),l=o[1]||o[2]||o[3],l===","){n.push(vo.noop(hf(i)));break}}else l="noop";if(!vo[l])throw new SyntaxError("Bad combinator.");n.push(vo[l](hf(i))),i=[]}return r=wN(n),r.qname=s,r.sel=t,a&&(a.lname=r.qname,a.test=r,a.qname=a.qname,a.sel=r.sel,r=a),u&&(u.test=r,u.qname=r.qname,u.sel=r.sel,r=u),r},tu=function(e,t){if(t)return e==="*"?pr["*"]:pr.type(e);if(e[1])return e[1][0]==="."?pr.attr("class","~=",Gi(e[1].substring(1)),!1):pr.attr("id","=",Gi(e[1].substring(1)),!1);if(e[2])return e[3]?pr[Gi(e[2])](Ig(e[3])):pr[Gi(e[2])];if(e[4]){var r=e[6],n=/["'\s]\s*I$/i.test(r);return n&&(r=r.replace(/\s*I$/i,"")),pr.attr(Gi(e[4]),e[5]||"-",Ig(r),n)}throw new SyntaxError("Unknown Selector.")},hf=function(e){var t=e.length,r;return t<2?e[0]:function(n){if(n){for(r=0;r{"use strict";var EN=xr(),SN=Zp(),gf=function(e,t){for(var r=e.createDocumentFragment(),n=0;n{"use strict";var Fg=xr(),CN={nextElementSibling:{get:function(){if(this.parentNode){for(var e=this.nextSibling;e!==null;e=e.nextSibling)if(e.nodeType===Fg.ELEMENT_NODE)return e}return null}},previousElementSibling:{get:function(){if(this.parentNode){for(var e=this.previousSibling;e!==null;e=e.previousSibling)if(e.nodeType===Fg.ELEMENT_NODE)return e}return null}}};Bg.exports=CN});var yf=ke((qj,zg)=>{"use strict";zg.exports=Ug;var ls=Wt();function Ug(e){this.element=e}Object.defineProperties(Ug.prototype,{length:{get:ls.shouldOverride},item:{value:ls.shouldOverride},getNamedItem:{value:function(t){return this.element.getAttributeNode(t)}},getNamedItemNS:{value:function(t,r){return this.element.getAttributeNodeNS(t,r)}},setNamedItem:{value:ls.nyi},setNamedItemNS:{value:ls.nyi},removeNamedItem:{value:function(t){var r=this.element.getAttributeNode(t);if(r)return this.element.removeAttribute(t),r;ls.NotFoundError()}},removeNamedItemNS:{value:function(t,r){var n=this.element.getAttributeNodeNS(t,r);if(n)return this.element.removeAttributeNS(t,r),n;ls.NotFoundError()}}})});var cs=ke((Hj,Gg)=>{"use strict";Gg.exports=Vi;var bf=Jl(),Bt=Wt(),Yn=Bt.NAMESPACE,su=cf(),On=xr(),wf=da(),kN=Xp(),au=Ng(),us=Zl(),NN=ff(),vf=nu(),Hg=Yl(),TN=iu(),_N=xf(),Wg=yf(),qg=Object.create(null);function Vi(e,t,r,n){Hg.call(this),this.nodeType=On.ELEMENT_NODE,this.ownerDocument=e,this.localName=t,this.namespaceURI=r,this.prefix=n,this._tagName=void 0,this._attrsByQName=Object.create(null),this._attrsByLName=Object.create(null),this._attrKeys=[]}function Ef(e,t){if(e.nodeType===On.TEXT_NODE)t.push(e._data);else for(var r=0,n=e.childNodes.length;r0}},toggleAttribute:{value:function(t,r){t=String(t),bf.isValidName(t)||Bt.InvalidCharacterError(),/[A-Z]/.test(t)&&this.isHTML&&(t=Bt.toASCIILowerCase(t));var n=this._attrsByQName[t];return n===void 0?r===void 0||r===!0?(this._setAttribute(t,""),!0):!1:r===void 0||r===!1?(this.removeAttribute(t),!1):!0}},_setAttribute:{value:function(t,r){var n=this._attrsByQName[t],i;n?Array.isArray(n)&&(n=n[0]):(n=this._newattr(t),i=!0),n.value=r,this._attributes&&(this._attributes[t]=n),i&&this._newattrhook&&this._newattrhook(t,r)}},setAttribute:{value:function(t,r){t=String(t),bf.isValidName(t)||Bt.InvalidCharacterError(),/[A-Z]/.test(t)&&this.isHTML&&(t=Bt.toASCIILowerCase(t)),this._setAttribute(t,String(r))}},_setAttributeNS:{value:function(t,r,n){var i=r.indexOf(":"),a,s;i<0?(a=null,s=r):(a=r.substring(0,i),s=r.substring(i+1)),(t===""||t===void 0)&&(t=null);var o=(t===null?"":t)+"|"+s,l=this._attrsByLName[o],u;l||(l=new So(this,s,a,t),u=!0,this._attrsByLName[o]=l,this._attributes&&(this._attributes[this._attrKeys.length]=l),this._attrKeys.push(o),this._addQName(l)),l.value=n,u&&this._newattrhook&&this._newattrhook(r,n)}},setAttributeNS:{value:function(t,r,n){t=t==null||t===""?null:String(t),r=String(r),bf.isValidQName(r)||Bt.InvalidCharacterError();var i=r.indexOf(":"),a=i<0?null:r.substring(0,i);(a!==null&&t===null||a==="xml"&&t!==Yn.XML||(r==="xmlns"||a==="xmlns")&&t!==Yn.XMLNS||t===Yn.XMLNS&&!(r==="xmlns"||a==="xmlns"))&&Bt.NamespaceError(),this._setAttributeNS(t,r,String(n))}},setAttributeNode:{value:function(t){if(t.ownerElement!==null&&t.ownerElement!==this)throw new us(us.INUSE_ATTRIBUTE_ERR);var r=null,n=this._attrsByQName[t.name];if(n){if(Array.isArray(n)||(n=[n]),n.some(function(i){return i===t}))return t;if(t.ownerElement!==null)throw new us(us.INUSE_ATTRIBUTE_ERR);n.forEach(function(i){this.removeAttributeNode(i)},this),r=n[0]}return this.setAttributeNodeNS(t),r}},setAttributeNodeNS:{value:function(t){if(t.ownerElement!==null)throw new us(us.INUSE_ATTRIBUTE_ERR);var r=t.namespaceURI,n=(r===null?"":r)+"|"+t.localName,i=this._attrsByLName[n];return i&&this.removeAttributeNode(i),t._setOwnerElement(this),this._attrsByLName[n]=t,this._attributes&&(this._attributes[this._attrKeys.length]=t),this._attrKeys.push(n),this._addQName(t),this._newattrhook&&this._newattrhook(t.name,t.value),i||null}},removeAttribute:{value:function(t){t=String(t),/[A-Z]/.test(t)&&this.isHTML&&(t=Bt.toASCIILowerCase(t));var r=this._attrsByQName[t];if(r){Array.isArray(r)?r.length>2?r=r.shift():(this._attrsByQName[t]=r[1],r=r[0]):this._attrsByQName[t]=void 0;var n=r.namespaceURI,i=(n===null?"":n)+"|"+r.localName;this._attrsByLName[i]=void 0;var a=this._attrKeys.indexOf(i);this._attributes&&(Array.prototype.splice.call(this._attributes,a,1),this._attributes[t]=void 0),this._attrKeys.splice(a,1);var s=r.onchange;r._setOwnerElement(null),s&&s.call(r,this,r.localName,r.value,null),this.rooted&&this.ownerDocument.mutateRemoveAttr(r)}}},removeAttributeNS:{value:function(t,r){t=t==null?"":String(t),r=String(r);var n=t+"|"+r,i=this._attrsByLName[n];if(i){this._attrsByLName[n]=void 0;var a=this._attrKeys.indexOf(n);this._attributes&&Array.prototype.splice.call(this._attributes,a,1),this._attrKeys.splice(a,1),this._removeQName(i);var s=i.onchange;i._setOwnerElement(null),s&&s.call(i,this,i.localName,i.value,null),this.rooted&&this.ownerDocument.mutateRemoveAttr(i)}}},removeAttributeNode:{value:function(t){var r=t.namespaceURI,n=(r===null?"":r)+"|"+t.localName;return this._attrsByLName[n]!==t&&Bt.NotFoundError(),this.removeAttributeNS(r,t.localName),t}},getAttributeNames:{value:function(){var t=this;return this._attrKeys.map(function(r){return t._attrsByLName[r].name})}},_getattr:{value:function(t){var r=this._attrsByQName[t];return r?r.value:null}},_setattr:{value:function(t,r){var n=this._attrsByQName[t],i;n||(n=this._newattr(t),i=!0),n.value=String(r),this._attributes&&(this._attributes[t]=n),i&&this._newattrhook&&this._newattrhook(t,r)}},_newattr:{value:function(t){var r=new So(this,t,null,null),n="|"+t;return this._attrsByQName[t]=r,this._attrsByLName[n]=r,this._attributes&&(this._attributes[this._attrKeys.length]=r),this._attrKeys.push(n),r}},_addQName:{value:function(e){var t=e.name,r=this._attrsByQName[t];r?Array.isArray(r)?r.push(e):this._attrsByQName[t]=[r,e]:this._attrsByQName[t]=e,this._attributes&&(this._attributes[t]=e)}},_removeQName:{value:function(e){var t=e.name,r=this._attrsByQName[t];if(Array.isArray(r)){var n=r.indexOf(e);Bt.assert(n!==-1),r.length===2?(this._attrsByQName[t]=r[1-n],this._attributes&&(this._attributes[t]=this._attrsByQName[t])):(r.splice(n,1),this._attributes&&this._attributes[t]===e&&(this._attributes[t]=r[0]))}else Bt.assert(r===e),this._attrsByQName[t]=void 0,this._attributes&&(this._attributes[t]=void 0)}},_numattrs:{get:function(){return this._attrKeys.length}},_attr:{value:function(e){return this._attrsByLName[this._attrKeys[e]]}},id:su.property({name:"id"}),className:su.property({name:"class"}),classList:{get:function(){var e=this;if(this._classList)return this._classList;var t=new NN(function(){return e.className||""},function(r){e.className=r});return this._classList=t,t},set:function(e){this.className=e}},matches:{value:function(e){return vf.matches(this,e)}},closest:{value:function(e){var t=this;do{if(t.matches&&t.matches(e))return t;t=t.parentElement||t.parentNode}while(t!==null&&t.nodeType===On.ELEMENT_NODE);return null}},querySelector:{value:function(e){return vf(e,this)[0]}},querySelectorAll:{value:function(e){var t=vf(e,this);return t.item?t:new wf(t)}}});Object.defineProperties(Vi.prototype,TN);Object.defineProperties(Vi.prototype,_N);su.registerChangeHandler(Vi,"id",function(e,t,r,n){e.rooted&&(r&&e.ownerDocument.delId(r,e),n&&e.ownerDocument.addId(n,e))});su.registerChangeHandler(Vi,"class",function(e,t,r,n){e._classList&&e._classList._update()});function So(e,t,r,n,i){this.localName=t,this.prefix=r===null||r===""?null:""+r,this.namespaceURI=n===null||n===""?null:""+n,this.data=i,this._setOwnerElement(e)}So.prototype=Object.create(Object.prototype,{ownerElement:{get:function(){return this._ownerElement}},_setOwnerElement:{value:function(t){this._ownerElement=t,this.prefix===null&&this.namespaceURI===null&&t?this.onchange=t._attributeChangeHandlers[this.localName]:this.onchange=null}},name:{get:function(){return this.prefix?this.prefix+":"+this.localName:this.localName}},specified:{get:function(){return!0}},value:{get:function(){return this.data},set:function(e){var t=this.data;e=e===void 0?"":e+"",e!==t&&(this.data=e,this.ownerElement&&(this.onchange&&this.onchange(this.ownerElement,this.localName,t,e),this.ownerElement.rooted&&this.ownerElement.ownerDocument.mutateAttr(this,t)))}},cloneNode:{value:function(t){return new So(null,this.localName,this.prefix,this.namespaceURI,this.data)}},nodeType:{get:function(){return On.ATTRIBUTE_NODE}},nodeName:{get:function(){return this.name}},nodeValue:{get:function(){return this.value},set:function(e){this.value=e}},textContent:{get:function(){return this.value},set:function(e){e==null&&(e=""),this.value=e}},innerText:{get:function(){return this.value},set:function(e){e==null&&(e=""),this.value=e}}});Vi._Attr=So;function Af(e){Wg.call(this,e);for(var t in e._attrsByQName)this[t]=e._attrsByQName[t];for(var r=0;r>>0,e>=this.length?null:this.element._attrsByLName[this.element._attrKeys[e]]}}});globalThis.Symbol?.iterator&&(Af.prototype[globalThis.Symbol.iterator]=function(){var e=0,t=this.length,r=this;return{next:function(){return e{"use strict";Kg.exports=Qg;var Zg=xr(),LN=da(),Xg=Wt(),Vg=Xg.HierarchyRequestError,MN=Xg.NotFoundError;function Qg(){Zg.call(this)}Qg.prototype=Object.create(Zg.prototype,{hasChildNodes:{value:function(){return!1}},firstChild:{value:null},lastChild:{value:null},insertBefore:{value:function(e,t){if(!e.nodeType)throw new TypeError("not a node");Vg()}},replaceChild:{value:function(e,t){if(!e.nodeType)throw new TypeError("not a node");Vg()}},removeChild:{value:function(e){if(!e.nodeType)throw new TypeError("not a node");MN()}},removeChildren:{value:function(){}},childNodes:{get:function(){return this._childNodes||(this._childNodes=new LN),this._childNodes}}})});var Ao=ke((jj,e2)=>{"use strict";e2.exports=ou;var Jg=Cf(),Yg=Wt(),PN=iu(),FN=xf();function ou(){Jg.call(this)}ou.prototype=Object.create(Jg.prototype,{substringData:{value:function(t,r){if(arguments.length<2)throw new TypeError("Not enough arguments");return t=t>>>0,r=r>>>0,(t>this.data.length||t<0||r<0)&&Yg.IndexSizeError(),this.data.substring(t,t+r)}},appendData:{value:function(t){if(arguments.length<1)throw new TypeError("Not enough arguments");this.data+=String(t)}},insertData:{value:function(t,r){return this.replaceData(t,0,r)}},deleteData:{value:function(t,r){return this.replaceData(t,r,"")}},replaceData:{value:function(t,r,n){var i=this.data,a=i.length;t=t>>>0,r=r>>>0,n=String(n),(t>a||t<0)&&Yg.IndexSizeError(),t+r>a&&(r=a-t);var s=i.substring(0,t),o=i.substring(t+r);this.data=s+n+o}},isEqual:{value:function(t){return this._data===t._data}},length:{get:function(){return this.data.length}}});Object.defineProperties(ou.prototype,PN);Object.defineProperties(ou.prototype,FN)});var Nf=ke((Gj,i2)=>{"use strict";i2.exports=kf;var t2=Wt(),r2=xr(),n2=Ao();function kf(e,t){n2.call(this),this.nodeType=r2.TEXT_NODE,this.ownerDocument=e,this._data=t,this._index=void 0}var Co={get:function(){return this._data},set:function(e){e==null?e="":e=String(e),e!==this._data&&(this._data=e,this.rooted&&this.ownerDocument.mutateValue(this),this.parentNode&&this.parentNode._textchangehook&&this.parentNode._textchangehook(this))}};kf.prototype=Object.create(n2.prototype,{nodeName:{value:"#text"},nodeValue:Co,textContent:Co,innerText:Co,data:{get:Co.get,set:function(e){Co.set.call(this,e===null?"":String(e))}},splitText:{value:function(t){(t>this._data.length||t<0)&&t2.IndexSizeError();var r=this._data.substring(t),n=this.ownerDocument.createTextNode(r);this.data=this.data.substring(0,t);var i=this.parentNode;return i!==null&&i.insertBefore(n,this.nextSibling),n}},wholeText:{get:function(){for(var t=this.textContent,r=this.nextSibling;r&&r.nodeType===r2.TEXT_NODE;r=r.nextSibling)t+=r.textContent;return t}},replaceWholeText:{value:t2.nyi},clone:{value:function(){return new kf(this.ownerDocument,this._data)}}})});var _f=ke((Vj,s2)=>{"use strict";s2.exports=Tf;var BN=xr(),a2=Ao();function Tf(e,t){a2.call(this),this.nodeType=BN.COMMENT_NODE,this.ownerDocument=e,this._data=t}var ko={get:function(){return this._data},set:function(e){e==null?e="":e=String(e),this._data=e,this.rooted&&this.ownerDocument.mutateValue(this)}};Tf.prototype=Object.create(a2.prototype,{nodeName:{value:"#comment"},nodeValue:ko,textContent:ko,innerText:ko,data:{get:ko.get,set:function(e){ko.set.call(this,e===null?"":String(e))}},clone:{value:function(){return new Tf(this.ownerDocument,this._data)}}})});var If=ke((Zj,u2)=>{"use strict";u2.exports=Of;var UN=xr(),zN=da(),l2=Yl(),lu=cs(),qN=nu(),o2=Wt();function Of(e){l2.call(this),this.nodeType=UN.DOCUMENT_FRAGMENT_NODE,this.ownerDocument=e}Of.prototype=Object.create(l2.prototype,{nodeName:{value:"#document-fragment"},nodeValue:{get:function(){return null},set:function(){}},textContent:Object.getOwnPropertyDescriptor(lu.prototype,"textContent"),innerText:Object.getOwnPropertyDescriptor(lu.prototype,"innerText"),querySelector:{value:function(e){var t=this.querySelectorAll(e);return t.length?t[0]:null}},querySelectorAll:{value:function(e){var t=Object.create(this);t.isHTML=!0,t.getElementsByTagName=lu.prototype.getElementsByTagName,t.nextElement=Object.getOwnPropertyDescriptor(lu.prototype,"firstElementChild").get;var r=qN(e,t);return r.item?r:new zN(r)}},clone:{value:function(){return new Of(this.ownerDocument)}},isEqual:{value:function(t){return!0}},innerHTML:{get:function(){return this.serialize()},set:o2.nyi},outerHTML:{get:function(){return this.serialize()},set:o2.nyi}})});var Df=ke((Xj,p2)=>{"use strict";p2.exports=$f;var HN=xr(),c2=Ao();function $f(e,t,r){c2.call(this),this.nodeType=HN.PROCESSING_INSTRUCTION_NODE,this.ownerDocument=e,this.target=t,this._data=r}var No={get:function(){return this._data},set:function(e){e==null?e="":e=String(e),this._data=e,this.rooted&&this.ownerDocument.mutateValue(this)}};$f.prototype=Object.create(c2.prototype,{nodeName:{get:function(){return this.target}},nodeValue:No,textContent:No,innerText:No,data:{get:No.get,set:function(e){No.set.call(this,e===null?"":String(e))}},clone:{value:function(){return new $f(this.ownerDocument,this.target,this._data)}},isEqual:{value:function(t){return this.target===t.target&&this._data===t._data}}})});var To=ke((Qj,f2)=>{"use strict";var Rf={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3,SHOW_ALL:4294967295,SHOW_ELEMENT:1,SHOW_ATTRIBUTE:2,SHOW_TEXT:4,SHOW_CDATA_SECTION:8,SHOW_ENTITY_REFERENCE:16,SHOW_ENTITY:32,SHOW_PROCESSING_INSTRUCTION:64,SHOW_COMMENT:128,SHOW_DOCUMENT:256,SHOW_DOCUMENT_TYPE:512,SHOW_DOCUMENT_FRAGMENT:1024,SHOW_NOTATION:2048};f2.exports=Rf.constructor=Rf.prototype=Rf});var Mf=ke((Yj,h2)=>{"use strict";var Kj=h2.exports={nextSkippingChildren:WN,nextAncestorSibling:Lf,next:jN,previous:GN,deepLastChild:d2};function WN(e,t){return e===t?null:e.nextSibling!==null?e.nextSibling:Lf(e,t)}function Lf(e,t){for(e=e.parentNode;e!==null;e=e.parentNode){if(e===t)return null;if(e.nextSibling!==null)return e.nextSibling}return null}function jN(e,t){var r;return r=e.firstChild,r!==null?r:e===t?null:(r=e.nextSibling,r!==null?r:Lf(e,t))}function d2(e){for(;e.lastChild;)e=e.lastChild;return e}function GN(e,t){var r;return r=e.previousSibling,r!==null?d2(r):(r=e.parentNode,r===t?null:r)}});var v2=ke((Jj,w2)=>{"use strict";w2.exports=b2;var VN=xr(),yr=To(),m2=Mf(),y2=Wt(),Pf={first:"firstChild",last:"lastChild",next:"firstChild",previous:"lastChild"},Ff={first:"nextSibling",last:"previousSibling",next:"nextSibling",previous:"previousSibling"};function g2(e,t){var r,n,i,a,s;for(n=e._currentNode[Pf[t]];n!==null;){if(a=e._internalFilter(n),a===yr.FILTER_ACCEPT)return e._currentNode=n,n;if(a===yr.FILTER_SKIP&&(r=n[Pf[t]],r!==null)){n=r;continue}for(;n!==null;){if(s=n[Ff[t]],s!==null){n=s;break}if(i=n.parentNode,i===null||i===e.root||i===e._currentNode)return null;n=i}}return null}function x2(e,t){var r,n,i;if(r=e._currentNode,r===e.root)return null;for(;;){for(i=r[Ff[t]];i!==null;){if(r=i,n=e._internalFilter(r),n===yr.FILTER_ACCEPT)return e._currentNode=r,r;i=r[Pf[t]],(n===yr.FILTER_REJECT||i===null)&&(i=r[Ff[t]])}if(r=r.parentNode,r===null||r===e.root||e._internalFilter(r)===yr.FILTER_ACCEPT)return null}}function b2(e,t,r){(!e||!e.nodeType)&&y2.NotSupportedError(),this._root=e,this._whatToShow=Number(t)||0,this._filter=r||null,this._active=!1,this._currentNode=e}Object.defineProperties(b2.prototype,{root:{get:function(){return this._root}},whatToShow:{get:function(){return this._whatToShow}},filter:{get:function(){return this._filter}},currentNode:{get:function(){return this._currentNode},set:function(t){if(!(t instanceof VN))throw new TypeError("Not a Node");this._currentNode=t}},_internalFilter:{value:function(t){var r,n;if(this._active&&y2.InvalidStateError(),!(1<{"use strict";k2.exports=C2;var Bf=To(),Uf=Mf(),A2=Wt();function ZN(e,t,r){return r?Uf.next(e,t):e===t?null:Uf.previous(e,null)}function E2(e,t){for(;t;t=t.parentNode)if(e===t)return!0;return!1}function S2(e,t){var r,n;for(r=e._referenceNode,n=e._pointerBeforeReferenceNode;;){if(n===t)n=!n;else if(r=ZN(r,e._root,t),r===null)return null;var i=e._internalFilter(r);if(i===Bf.FILTER_ACCEPT)break}return e._referenceNode=r,e._pointerBeforeReferenceNode=n,r}function C2(e,t,r){(!e||!e.nodeType)&&A2.NotSupportedError(),this._root=e,this._referenceNode=e,this._pointerBeforeReferenceNode=!0,this._whatToShow=Number(t)||0,this._filter=r||null,this._active=!1,e.doc._attachNodeIterator(this)}Object.defineProperties(C2.prototype,{root:{get:function(){return this._root}},referenceNode:{get:function(){return this._referenceNode}},pointerBeforeReferenceNode:{get:function(){return this._pointerBeforeReferenceNode}},whatToShow:{get:function(){return this._whatToShow}},filter:{get:function(){return this._filter}},_internalFilter:{value:function(t){var r,n;if(this._active&&A2.InvalidStateError(),!(1<{"use strict";T2.exports=br;function br(e){if(!e)return Object.create(br.prototype);this.url=e.replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g,"");var t=br.pattern.exec(this.url);if(t){if(t[2]&&(this.scheme=t[2]),t[4]){var r=t[4].match(br.userinfoPattern);if(r&&(this.username=r[1],this.password=r[3],t[4]=t[4].substring(r[0].length)),t[4].match(br.portPattern)){var n=t[4].lastIndexOf(":");this.host=t[4].substring(0,n),this.port=t[4].substring(n+1)}else this.host=t[4]}t[5]&&(this.path=t[5]),t[6]&&(this.query=t[7]),t[8]&&(this.fragment=t[9])}}br.pattern=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/;br.userinfoPattern=/^([^@:]*)(:([^@]*))?@/;br.portPattern=/:\d+$/;br.authorityPattern=/^[^:\/?#]+:\/\//;br.hierarchyPattern=/^[^:\/?#]+:\//;br.percentEncode=function(t){var r=t.charCodeAt(0);if(r<256)return"%"+r.toString(16);throw Error("can't percent-encode codepoints > 255 yet")};br.prototype={constructor:br,isAbsolute:function(){return!!this.scheme},isAuthorityBased:function(){return br.authorityPattern.test(this.url)},isHierarchical:function(){return br.hierarchyPattern.test(this.url)},toString:function(){var e="";return this.scheme!==void 0&&(e+=this.scheme+":"),this.isAbsolute()&&(e+="//",(this.username||this.password)&&(e+=this.username||"",this.password&&(e+=":"+this.password),e+="@"),this.host&&(e+=this.host)),this.port!==void 0&&(e+=":"+this.port),this.path!==void 0&&(e+=this.path),this.query!==void 0&&(e+="?"+this.query),this.fragment!==void 0&&(e+="#"+this.fragment),e},resolve:function(e){var t=this,r=new br(e),n=new br;return r.scheme!==void 0?(n.scheme=r.scheme,n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=a(r.path),n.query=r.query):(n.scheme=t.scheme,r.host!==void 0?(n.username=r.username,n.password=r.password,n.host=r.host,n.port=r.port,n.path=a(r.path),n.query=r.query):(n.username=t.username,n.password=t.password,n.host=t.host,n.port=t.port,r.path?(r.path.charAt(0)==="/"?n.path=a(r.path):(n.path=i(t.path,r.path),n.path=a(n.path)),n.query=r.query):(n.path=t.path,r.query!==void 0?n.query=r.query:n.query=t.query))),n.fragment=r.fragment,n.toString();function i(s,o){if(t.host!==void 0&&!t.path)return"/"+o;var l=s.lastIndexOf("/");return l===-1?o:s.substring(0,l+1)+o}function a(s){if(!s)return s;for(var o="";s.length>0;){if(s==="."||s===".."){s="";break}var l=s.substring(0,2),u=s.substring(0,3),c=s.substring(0,4);if(u==="../")s=s.substring(3);else if(l==="./")s=s.substring(2);else if(u==="/./")s="/"+s.substring(3);else if(l==="/."&&s.length===2)s="/";else if(c==="/../"||u==="/.."&&s.length===3)s="/"+s.substring(4),o=o.replace(/\/?[^\/]*$/,"");else{var p=s.match(/(\/?([^\/]*))/)[0];o+=p,s=s.substring(p.length)}}return o}}}});var I2=ke((rG,O2)=>{"use strict";O2.exports=zf;var _2=ns();function zf(e,t){_2.call(this,e,t)}zf.prototype=Object.create(_2.prototype,{constructor:{value:zf}})});var qf=ke((nG,$2)=>{"use strict";$2.exports={Event:ns(),UIEvent:Hp(),MouseEvent:jp(),CustomEvent:I2()}});var R2=ke(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.hyphenate=ps.parse=void 0;function XN(e){let t=[],r=0,n=0,i=0,a=0,s=0,o=null;for(;r0&&n===0&&i===0){let u=e.substring(a,r-1).trim();t.push(o,u),s=r,a=0,o=null}break}if(o&&a){let l=e.slice(a).trim();t.push(o,l)}return t}ps.parse=XN;function D2(e){return e.replace(/[a-z][A-Z]/g,t=>t.charAt(0)+"-"+t.charAt(1)).toLowerCase()}ps.hyphenate=D2});var cu=ke((aG,B2)=>{"use strict";var{parse:QN}=R2();B2.exports=function(e){let t=new F2(e),r={get:function(n,i){return i in n?n[i]:n.getPropertyValue(L2(i))},has:function(n,i){return!0},set:function(n,i,a){return i in n?n[i]=a:n.setProperty(L2(i),a??void 0),!0}};return new Proxy(t,r)};function L2(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function F2(e){this._element=e}var M2="!important";function P2(e){let t={property:{},priority:{}};if(!e)return t;let r=QN(e);if(r.length<2)return t;for(let n=0;n{"use strict";var fr=uu();U2.exports=_o;function _o(){}_o.prototype=Object.create(Object.prototype,{_url:{get:function(){return new fr(this.href)}},protocol:{get:function(){var e=this._url;return e&&e.scheme?e.scheme+":":":"},set:function(e){var t=this.href,r=new fr(t);r.isAbsolute()&&(e=e.replace(/:+$/,""),e=e.replace(/[^-+\.a-zA-Z0-9]/g,fr.percentEncode),e.length>0&&(r.scheme=e,t=r.toString())),this.href=t}},host:{get:function(){var e=this._url;return e.isAbsolute()&&e.isAuthorityBased()?e.host+(e.port?":"+e.port:""):""},set:function(e){var t=this.href,r=new fr(t);r.isAbsolute()&&r.isAuthorityBased()&&(e=e.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g,fr.percentEncode),e.length>0&&(r.host=e,delete r.port,t=r.toString())),this.href=t}},hostname:{get:function(){var e=this._url;return e.isAbsolute()&&e.isAuthorityBased()?e.host:""},set:function(e){var t=this.href,r=new fr(t);r.isAbsolute()&&r.isAuthorityBased()&&(e=e.replace(/^\/+/,""),e=e.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g,fr.percentEncode),e.length>0&&(r.host=e,t=r.toString())),this.href=t}},port:{get:function(){var e=this._url;return e.isAbsolute()&&e.isAuthorityBased()&&e.port!==void 0?e.port:""},set:function(e){var t=this.href,r=new fr(t);r.isAbsolute()&&r.isAuthorityBased()&&(e=""+e,e=e.replace(/[^0-9].*$/,""),e=e.replace(/^0+/,""),e.length===0&&(e="0"),parseInt(e,10)<=65535&&(r.port=e,t=r.toString())),this.href=t}},pathname:{get:function(){var e=this._url;return e.isAbsolute()&&e.isHierarchical()?e.path:""},set:function(e){var t=this.href,r=new fr(t);r.isAbsolute()&&r.isHierarchical()&&(e.charAt(0)!=="/"&&(e="/"+e),e=e.replace(/[^-+\._~!$&'()*,;:=@\/a-zA-Z0-9]/g,fr.percentEncode),r.path=e,t=r.toString()),this.href=t}},search:{get:function(){var e=this._url;return e.isAbsolute()&&e.isHierarchical()&&e.query!==void 0?"?"+e.query:""},set:function(e){var t=this.href,r=new fr(t);r.isAbsolute()&&r.isHierarchical()&&(e.charAt(0)==="?"&&(e=e.substring(1)),e=e.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g,fr.percentEncode),r.query=e,t=r.toString()),this.href=t}},hash:{get:function(){var e=this._url;return e==null||e.fragment==null||e.fragment===""?"":"#"+e.fragment},set:function(e){var t=this.href,r=new fr(t);e.charAt(0)==="#"&&(e=e.substring(1)),e=e.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g,fr.percentEncode),r.fragment=e,t=r.toString(),this.href=t}},username:{get:function(){var e=this._url;return e.username||""},set:function(e){var t=this.href,r=new fr(t);r.isAbsolute()&&(e=e.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\:]/g,fr.percentEncode),r.username=e,t=r.toString()),this.href=t}},password:{get:function(){var e=this._url;return e.password||""},set:function(e){var t=this.href,r=new fr(t);r.isAbsolute()&&(e===""?r.password=null:(e=e.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\]/g,fr.percentEncode),r.password=e),t=r.toString()),this.href=t}},origin:{get:function(){var e=this._url;if(e==null)return"";var t=function(r){var n=[e.scheme,e.host,+e.port||r];return n[0]+"://"+n[1]+(n[2]===r?"":":"+n[2])};switch(e.scheme){case"ftp":return t(21);case"gopher":return t(70);case"http":case"ws":return t(80);case"https":case"wss":return t(443);default:return e.scheme+"://"}}}});_o._inherit=function(e){Object.getOwnPropertyNames(_o.prototype).forEach(function(t){if(!(t==="constructor"||t==="href")){var r=Object.getOwnPropertyDescriptor(_o.prototype,t);Object.defineProperty(e,t,r)}})}});var Wf=ke((oG,H2)=>{"use strict";var z2=cf(),KN=Xl().isApiWritable;H2.exports=function(e,t,r,n){var i=e.ctor;if(i){var a=e.props||{};if(e.attributes)for(var s in e.attributes){var o=e.attributes[s];(typeof o!="object"||Array.isArray(o))&&(o={type:o}),o.name||(o.name=s.toLowerCase()),a[s]=z2.property(o)}a.constructor={value:i,writable:KN},i.prototype=Object.create((e.superclass||t).prototype,a),e.events&&JN(i,e.events),r[e.name]=i}else i=t;return(e.tags||e.tag&&[e.tag]||[]).forEach(function(l){n[l]=i}),i};function q2(e,t,r,n){this.body=e,this.document=t,this.form=r,this.element=n}q2.prototype.build=function(){return()=>{}};function YN(e,t,r,n){var i=e.ownerDocument||Object.create(null),a=e.form||Object.create(null);e[t]=new q2(n,i,a,e).build()}function JN(e,t){var r=e.prototype;t.forEach(function(n){Object.defineProperty(r,"on"+n,{get:function(){return this._getEventHandler(n)},set:function(i){this._setEventHandler(n,i)}}),z2.registerChangeHandler(e,"on"+n,YN)})}});var du=ke(fu=>{"use strict";var jf=xr(),W2=cs(),eT=cu(),en=Wt(),j2=Hf(),tT=Wf(),yi=fu.elements={},Oo=Object.create(null);fu.createElement=function(e,t,r){var n=Oo[t]||nT;return new n(e,t,r)};function fe(e){return tT(e,Ee,yi,Oo)}function jt(e){return{get:function(){var t=this._getattr(e);if(t===null)return"";var r=this.doc._resolve(t);return r===null?t:r},set:function(t){this._setattr(e,t)}}}function pu(e){return{get:function(){var t=this._getattr(e);return t===null?null:t.toLowerCase()==="use-credentials"?"use-credentials":"anonymous"},set:function(t){t==null?this.removeAttribute(e):this._setattr(e,t)}}}var ds={type:["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"],missing:""},rT={A:!0,LINK:!0,BUTTON:!0,INPUT:!0,SELECT:!0,TEXTAREA:!0,COMMAND:!0},In=function(e,t,r){Ee.call(this,e,t,r),this._form=null},Ee=fu.HTMLElement=fe({superclass:W2,name:"HTMLElement",ctor:function(t,r,n){W2.call(this,t,r,en.NAMESPACE.HTML,n)},props:{dangerouslySetInnerHTML:{set:function(e){this._innerHTML=e}},innerHTML:{get:function(){return this.serialize()},set:function(e){var t=this.ownerDocument.implementation.mozHTMLParser(this.ownerDocument._address,this);t.parse(e===null?"":String(e),!0);for(var r=this instanceof Oo.template?this.content:this;r.hasChildNodes();)r.removeChild(r.firstChild);r.appendChild(t._asDocumentFragment())}},style:{get:function(){return this._style||(this._style=new eT(this)),this._style},set:function(e){e==null&&(e=""),this._setattr("style",String(e))}},blur:{value:function(){}},focus:{value:function(){}},forceSpellCheck:{value:function(){}},click:{value:function(){if(!this._click_in_progress){this._click_in_progress=!0;try{this._pre_click_activation_steps&&this._pre_click_activation_steps();var e=this.ownerDocument.createEvent("MouseEvent");e.initMouseEvent("click",!0,!0,this.ownerDocument.defaultView,1,0,0,0,0,!1,!1,!1,!1,0,null);var t=this.dispatchEvent(e);t?this._post_click_activation_steps&&this._post_click_activation_steps(e):this._cancelled_activation_steps&&this._cancelled_activation_steps()}finally{this._click_in_progress=!1}}}},submit:{value:en.nyi}},attributes:{title:String,lang:String,dir:{type:["ltr","rtl","auto"],missing:""},draggable:{type:["true","false"],treatNullAsEmptyString:!0},spellcheck:{type:["true","false"],missing:""},enterKeyHint:{type:["enter","done","go","next","previous","search","send"],missing:""},autoCapitalize:{type:["off","on","none","sentences","words","characters"],missing:""},autoFocus:Boolean,accessKey:String,nonce:String,hidden:Boolean,translate:{type:["no","yes"],missing:""},tabIndex:{type:"long",default:function(){return this.tagName in rT||this.contentEditable?0:-1}}},events:["abort","canplay","canplaythrough","change","click","contextmenu","cuechange","dblclick","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","input","invalid","keydown","keypress","keyup","loadeddata","loadedmetadata","loadstart","mousedown","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","progress","ratechange","readystatechange","reset","seeked","seeking","select","show","stalled","submit","suspend","timeupdate","volumechange","waiting","blur","error","focus","load","scroll"]}),nT=fe({name:"HTMLUnknownElement",ctor:function(t,r,n){Ee.call(this,t,r,n)}}),$n={form:{get:function(){return this._form}}};fe({tag:"a",name:"HTMLAnchorElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},props:{_post_click_activation_steps:{value:function(e){this.href&&(this.ownerDocument.defaultView.location=this.href)}}},attributes:{href:jt,ping:String,download:String,target:String,rel:String,media:String,hreflang:String,type:String,referrerPolicy:ds,coords:String,charset:String,name:String,rev:String,shape:String}});j2._inherit(Oo.a.prototype);fe({tag:"area",name:"HTMLAreaElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{alt:String,target:String,download:String,rel:String,media:String,href:jt,hreflang:String,type:String,shape:String,coords:String,ping:String,referrerPolicy:ds,noHref:Boolean}});j2._inherit(Oo.area.prototype);fe({tag:"br",name:"HTMLBRElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{clear:String}});fe({tag:"base",name:"HTMLBaseElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{target:String}});fe({tag:"body",name:"HTMLBodyElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},events:["afterprint","beforeprint","beforeunload","blur","error","focus","hashchange","load","message","offline","online","pagehide","pageshow","popstate","resize","scroll","storage","unload"],attributes:{text:{type:String,treatNullAsEmptyString:!0},link:{type:String,treatNullAsEmptyString:!0},vLink:{type:String,treatNullAsEmptyString:!0},aLink:{type:String,treatNullAsEmptyString:!0},bgColor:{type:String,treatNullAsEmptyString:!0},background:String}});fe({tag:"button",name:"HTMLButtonElement",ctor:function(t,r,n){In.call(this,t,r,n)},props:$n,attributes:{name:String,value:String,disabled:Boolean,autofocus:Boolean,type:{type:["submit","reset","button","menu"],missing:"submit"},formTarget:String,formAction:jt,formNoValidate:Boolean,formMethod:{type:["get","post","dialog"],invalid:"get",missing:""},formEnctype:{type:["application/x-www-form-urlencoded","multipart/form-data","text/plain"],invalid:"application/x-www-form-urlencoded",missing:""}}});fe({tag:"dl",name:"HTMLDListElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{compact:Boolean}});fe({tag:"data",name:"HTMLDataElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{value:String}});fe({tag:"datalist",name:"HTMLDataListElement",ctor:function(t,r,n){Ee.call(this,t,r,n)}});fe({tag:"details",name:"HTMLDetailsElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{open:Boolean}});fe({tag:"div",name:"HTMLDivElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{align:String}});fe({tag:"embed",name:"HTMLEmbedElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{src:jt,type:String,width:String,height:String,align:String,name:String}});fe({tag:"fieldset",name:"HTMLFieldSetElement",ctor:function(t,r,n){In.call(this,t,r,n)},props:$n,attributes:{disabled:Boolean,name:String}});fe({tag:"form",name:"HTMLFormElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{action:String,autocomplete:{type:["on","off"],missing:"on"},name:String,acceptCharset:{name:"accept-charset"},target:String,noValidate:Boolean,method:{type:["get","post","dialog"],invalid:"get",missing:"get"},enctype:{type:["application/x-www-form-urlencoded","multipart/form-data","text/plain"],invalid:"application/x-www-form-urlencoded",missing:"application/x-www-form-urlencoded"},encoding:{name:"enctype",type:["application/x-www-form-urlencoded","multipart/form-data","text/plain"],invalid:"application/x-www-form-urlencoded",missing:"application/x-www-form-urlencoded"}}});fe({tag:"hr",name:"HTMLHRElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{align:String,color:String,noShade:Boolean,size:String,width:String}});fe({tag:"head",name:"HTMLHeadElement",ctor:function(t,r,n){Ee.call(this,t,r,n)}});fe({tags:["h1","h2","h3","h4","h5","h6"],name:"HTMLHeadingElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{align:String}});fe({tag:"html",name:"HTMLHtmlElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{xmlns:jt,version:String}});fe({tag:"iframe",name:"HTMLIFrameElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{src:jt,srcdoc:String,name:String,width:String,height:String,seamless:Boolean,allow:Boolean,allowFullscreen:Boolean,allowUserMedia:Boolean,allowPaymentRequest:Boolean,referrerPolicy:ds,loading:{type:["eager","lazy"],treatNullAsEmptyString:!0},align:String,scrolling:String,frameBorder:String,longDesc:jt,marginHeight:{type:String,treatNullAsEmptyString:!0},marginWidth:{type:String,treatNullAsEmptyString:!0}}});fe({tag:"img",name:"HTMLImageElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{alt:String,src:jt,srcset:String,crossOrigin:pu,useMap:String,isMap:Boolean,sizes:String,height:{type:"unsigned long",default:0},width:{type:"unsigned long",default:0},referrerPolicy:ds,loading:{type:["eager","lazy"],missing:""},name:String,lowsrc:jt,align:String,hspace:{type:"unsigned long",default:0},vspace:{type:"unsigned long",default:0},longDesc:jt,border:{type:String,treatNullAsEmptyString:!0}}});fe({tag:"input",name:"HTMLInputElement",ctor:function(t,r,n){In.call(this,t,r,n)},props:{form:$n.form,_post_click_activation_steps:{value:function(e){if(this.type==="checkbox")this.checked=!this.checked;else if(this.type==="radio")for(var t=this.form.getElementsByName(this.name),r=t.length-1;r>=0;r--){var n=t[r];n.checked=n===this}}}},attributes:{name:String,disabled:Boolean,autofocus:Boolean,accept:String,alt:String,max:String,min:String,pattern:String,placeholder:String,step:String,dirName:String,defaultValue:{name:"value"},multiple:Boolean,required:Boolean,readOnly:Boolean,checked:Boolean,value:String,src:jt,defaultChecked:{name:"checked",type:Boolean},size:{type:"unsigned long",default:20,min:1,setmin:1},width:{type:"unsigned long",min:0,setmin:0,default:0},height:{type:"unsigned long",min:0,setmin:0,default:0},minLength:{type:"unsigned long",min:0,setmin:0,default:-1},maxLength:{type:"unsigned long",min:0,setmin:0,default:-1},autocomplete:String,type:{type:["text","hidden","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"],missing:"text"},formTarget:String,formNoValidate:Boolean,formMethod:{type:["get","post"],invalid:"get",missing:""},formEnctype:{type:["application/x-www-form-urlencoded","multipart/form-data","text/plain"],invalid:"application/x-www-form-urlencoded",missing:""},inputMode:{type:["verbatim","latin","latin-name","latin-prose","full-width-latin","kana","kana-name","katakana","numeric","tel","email","url"],missing:""},align:String,useMap:String}});fe({tag:"keygen",name:"HTMLKeygenElement",ctor:function(t,r,n){In.call(this,t,r,n)},props:$n,attributes:{name:String,disabled:Boolean,autofocus:Boolean,challenge:String,keytype:{type:["rsa"],missing:""}}});fe({tag:"li",name:"HTMLLIElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{value:{type:"long",default:0},type:String}});fe({tag:"label",name:"HTMLLabelElement",ctor:function(t,r,n){In.call(this,t,r,n)},props:$n,attributes:{htmlFor:{name:"for",type:String}}});fe({tag:"legend",name:"HTMLLegendElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{align:String}});fe({tag:"link",name:"HTMLLinkElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{href:jt,rel:String,media:String,hreflang:String,type:String,crossOrigin:pu,nonce:String,integrity:String,referrerPolicy:ds,imageSizes:String,imageSrcset:String,charset:String,rev:String,target:String}});fe({tag:"map",name:"HTMLMapElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{name:String}});fe({tag:"menu",name:"HTMLMenuElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{type:{type:["context","popup","toolbar"],missing:"toolbar"},label:String,compact:Boolean}});fe({tag:"meta",name:"HTMLMetaElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{name:String,content:String,httpEquiv:{name:"http-equiv",type:String},scheme:String}});fe({tag:"meter",name:"HTMLMeterElement",ctor:function(t,r,n){In.call(this,t,r,n)},props:$n});fe({tags:["ins","del"],name:"HTMLModElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{cite:jt,dateTime:String}});fe({tag:"ol",name:"HTMLOListElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},props:{_numitems:{get:function(){var e=0;return this.childNodes.forEach(function(t){t.nodeType===jf.ELEMENT_NODE&&t.tagName==="LI"&&e++}),e}}},attributes:{type:String,reversed:Boolean,start:{type:"long",default:function(){return this.reversed?this._numitems:1}},compact:Boolean}});fe({tag:"object",name:"HTMLObjectElement",ctor:function(t,r,n){In.call(this,t,r,n)},props:$n,attributes:{data:jt,type:String,name:String,useMap:String,typeMustMatch:Boolean,width:String,height:String,align:String,archive:String,code:String,declare:Boolean,hspace:{type:"unsigned long",default:0},standby:String,vspace:{type:"unsigned long",default:0},codeBase:jt,codeType:String,border:{type:String,treatNullAsEmptyString:!0}}});fe({tag:"optgroup",name:"HTMLOptGroupElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{disabled:Boolean,label:String}});fe({tag:"option",name:"HTMLOptionElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},props:{form:{get:function(){for(var e=this.parentNode;e&&e.nodeType===jf.ELEMENT_NODE;){if(e.localName==="select")return e.form;e=e.parentNode}}},value:{get:function(){return this._getattr("value")||this.text},set:function(e){this._setattr("value",e)}},text:{get:function(){return this.textContent.replace(/[ \t\n\f\r]+/g," ").trim()},set:function(e){this.textContent=e}}},attributes:{disabled:Boolean,defaultSelected:{name:"selected",type:Boolean},label:String}});fe({tag:"output",name:"HTMLOutputElement",ctor:function(t,r,n){In.call(this,t,r,n)},props:$n,attributes:{name:String}});fe({tag:"p",name:"HTMLParagraphElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{align:String}});fe({tag:"param",name:"HTMLParamElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{name:String,value:String,type:String,valueType:String}});fe({tags:["pre","listing","xmp"],name:"HTMLPreElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{width:{type:"long",default:0}}});fe({tag:"progress",name:"HTMLProgressElement",ctor:function(t,r,n){In.call(this,t,r,n)},props:$n,attributes:{max:{type:Number,float:!0,default:1,min:0}}});fe({tags:["q","blockquote"],name:"HTMLQuoteElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},attributes:{cite:jt}});fe({tag:"script",name:"HTMLScriptElement",ctor:function(t,r,n){Ee.call(this,t,r,n)},props:{text:{get:function(){for(var e="",t=0,r=this.childNodes.length;t{"use strict";var G2=cs(),iT=Wf(),aT=Wt(),sT=cu(),oT=hu.elements={},V2=Object.create(null);hu.createElement=function(e,t,r){var n=V2[t]||Vf;return new n(e,t,r)};function Gf(e){return iT(e,Vf,oT,V2)}var Vf=Gf({superclass:G2,name:"SVGElement",ctor:function(t,r,n){G2.call(this,t,r,aT.NAMESPACE.SVG,n)},props:{style:{get:function(){return this._style||(this._style=new sT(this)),this._style}}}});Gf({name:"SVGSVGElement",ctor:function(t,r,n){Vf.call(this,t,r,n)},tag:"svg",props:{createSVGRect:{value:function(){return hu.createElement(this.ownerDocument,"rect",null)}}}});Gf({tags:["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"]})});var X2=ke((cG,Z2)=>{"use strict";Z2.exports={VALUE:1,ATTR:2,REMOVE_ATTR:3,REMOVE:4,MOVE:5,INSERT:6}});var gu=ke((pG,ax)=>{"use strict";ax.exports=$o;var Cr=xr(),lT=da(),tx=Yl(),Zi=cs(),uT=Nf(),cT=_f(),Io=ns(),pT=If(),fT=Df(),dT=Do(),hT=v2(),mT=N2(),Q2=To(),K2=uu(),Y2=nu(),gT=qf(),mu=Jl(),Xf=du(),xT=Zf(),st=Wt(),hs=X2(),gs=st.NAMESPACE,Qf=Xl().isApiWritable;function $o(e,t){tx.call(this),this.nodeType=Cr.DOCUMENT_NODE,this.isHTML=e,this._address=t||"about:blank",this.readyState="loading",this.implementation=new dT(this),this.ownerDocument=null,this._contentType=e?"text/html":"application/xml",this.doctype=null,this.documentElement=null,this._templateDocCache=null,this._nodeIterators=null,this._nid=1,this._nextnid=2,this._nodes=[null,this],this.byId=Object.create(null),this.modclock=0}var yT={event:"Event",customevent:"CustomEvent",uievent:"UIEvent",mouseevent:"MouseEvent"},bT={events:"event",htmlevents:"event",mouseevents:"mouseevent",mutationevents:"mutationevent",uievents:"uievent"},ms=function(e,t,r){return{get:function(){var n=e.call(this);return n?n[t]:r},set:function(n){var i=e.call(this);i&&(i[t]=n)}}};function J2(e,t){var r,n,i;return e===""&&(e=null),mu.isValidQName(t)||st.InvalidCharacterError(),r=null,n=t,i=t.indexOf(":"),i>=0&&(r=t.substring(0,i),n=t.substring(i+1)),r!==null&&e===null&&st.NamespaceError(),r==="xml"&&e!==gs.XML&&st.NamespaceError(),(r==="xmlns"||t==="xmlns")&&e!==gs.XMLNS&&st.NamespaceError(),e===gs.XMLNS&&!(r==="xmlns"||t==="xmlns")&&st.NamespaceError(),{namespace:e,prefix:r,localName:n}}$o.prototype=Object.create(tx.prototype,{_setMutationHandler:{value:function(e){this.mutationHandler=e}},_dispatchRendererEvent:{value:function(e,t,r){var n=this._nodes[e];n&&n._dispatchEvent(new Io(t,r),!0)}},nodeName:{value:"#document"},nodeValue:{get:function(){return null},set:function(){}},documentURI:{get:function(){return this._address},set:st.nyi},compatMode:{get:function(){return this._quirks?"BackCompat":"CSS1Compat"}},createTextNode:{value:function(e){return new uT(this,String(e))}},createComment:{value:function(e){return new cT(this,e)}},createDocumentFragment:{value:function(){return new pT(this)}},createProcessingInstruction:{value:function(e,t){return(!mu.isValidName(e)||t.indexOf("?>")!==-1)&&st.InvalidCharacterError(),new fT(this,e,t)}},createAttribute:{value:function(e){return e=String(e),mu.isValidName(e)||st.InvalidCharacterError(),this.isHTML&&(e=st.toASCIILowerCase(e)),new Zi._Attr(null,e,null,null,"")}},createAttributeNS:{value:function(e,t){e=e==null||e===""?null:String(e),t=String(t);var r=J2(e,t);return new Zi._Attr(null,r.localName,r.prefix,r.namespace,"")}},createElement:{value:function(e){return e=String(e),mu.isValidName(e)||st.InvalidCharacterError(),this.isHTML?(/[A-Z]/.test(e)&&(e=st.toASCIILowerCase(e)),Xf.createElement(this,e,null)):this.contentType==="application/xhtml+xml"?Xf.createElement(this,e,null):new Zi(this,e,null,null)},writable:Qf},createElementNS:{value:function(e,t){e=e==null||e===""?null:String(e),t=String(t);var r=J2(e,t);return this._createElementNS(r.localName,r.namespace,r.prefix)},writable:Qf},_createElementNS:{value:function(e,t,r){return t===gs.HTML?Xf.createElement(this,e,r):t===gs.SVG?xT.createElement(this,e,r):new Zi(this,e,t,r)}},createEvent:{value:function(t){t=t.toLowerCase();var r=bT[t]||t,n=gT[yT[r]];if(n){var i=new n;return i._initialized=!1,i}else st.NotSupportedError()}},createTreeWalker:{value:function(e,t,r){if(!e)throw new TypeError("root argument is required");if(!(e instanceof Cr))throw new TypeError("root not a node");return t=t===void 0?Q2.SHOW_ALL:+t,r=r===void 0?null:r,new hT(e,t,r)}},createNodeIterator:{value:function(e,t,r){if(!e)throw new TypeError("root argument is required");if(!(e instanceof Cr))throw new TypeError("root not a node");return t=t===void 0?Q2.SHOW_ALL:+t,r=r===void 0?null:r,new mT(e,t,r)}},_attachNodeIterator:{value:function(e){this._nodeIterators||(this._nodeIterators=[]),this._nodeIterators.push(e)}},_detachNodeIterator:{value:function(e){var t=this._nodeIterators.indexOf(e);this._nodeIterators.splice(t,1)}},_preremoveNodeIterators:{value:function(e){this._nodeIterators&&this._nodeIterators.forEach(function(t){t._preremove(e)})}},_updateDocTypeElement:{value:function(){this.doctype=this.documentElement=null;for(var t=this.firstChild;t!==null;t=t.nextSibling)t.nodeType===Cr.DOCUMENT_TYPE_NODE?this.doctype=t:t.nodeType===Cr.ELEMENT_NODE&&(this.documentElement=t)}},insertBefore:{value:function(t,r){return Cr.prototype.insertBefore.call(this,t,r),this._updateDocTypeElement(),t}},replaceChild:{value:function(t,r){return Cr.prototype.replaceChild.call(this,t,r),this._updateDocTypeElement(),r}},removeChild:{value:function(t){return Cr.prototype.removeChild.call(this,t),this._updateDocTypeElement(),t}},getElementById:{value:function(e){var t=this.byId[e];return t?t instanceof bi?t.getFirst():t:null}},_hasMultipleElementsWithId:{value:function(e){return this.byId[e]instanceof bi}},getElementsByName:{value:Zi.prototype.getElementsByName},getElementsByTagName:{value:Zi.prototype.getElementsByTagName},getElementsByTagNameNS:{value:Zi.prototype.getElementsByTagNameNS},getElementsByClassName:{value:Zi.prototype.getElementsByClassName},adoptNode:{value:function(t){return t.nodeType===Cr.DOCUMENT_NODE&&st.NotSupportedError(),t.nodeType===Cr.ATTRIBUTE_NODE||(t.parentNode&&t.parentNode.removeChild(t),t.ownerDocument!==this&&ix(t,this)),t}},importNode:{value:function(t,r){return this.adoptNode(t.cloneNode(r))},writable:Qf},origin:{get:function(){return null}},characterSet:{get:function(){return"UTF-8"}},contentType:{get:function(){return this._contentType}},URL:{get:function(){return this._address}},domain:{get:st.nyi,set:st.nyi},referrer:{get:st.nyi},cookie:{get:st.nyi,set:st.nyi},lastModified:{get:st.nyi},location:{get:function(){return this.defaultView?this.defaultView.location:null},set:st.nyi},_titleElement:{get:function(){return this.getElementsByTagName("title").item(0)||null}},title:{get:function(){var e=this._titleElement,t=e?e.textContent:"";return t.replace(/[ \t\n\r\f]+/g," ").replace(/(^ )|( $)/g,"")},set:function(e){var t=this._titleElement,r=this.head;!t&&!r||(t||(t=this.createElement("title"),r.appendChild(t)),t.textContent=e)}},dir:ms(function(){var e=this.documentElement;if(e&&e.tagName==="HTML")return e},"dir",""),fgColor:ms(function(){return this.body},"text",""),linkColor:ms(function(){return this.body},"link",""),vlinkColor:ms(function(){return this.body},"vLink",""),alinkColor:ms(function(){return this.body},"aLink",""),bgColor:ms(function(){return this.body},"bgColor",""),charset:{get:function(){return this.characterSet}},inputEncoding:{get:function(){return this.characterSet}},scrollingElement:{get:function(){return this._quirks?this.body:this.documentElement}},body:{get:function(){return ex(this.documentElement,"body")},set:st.nyi},head:{get:function(){return ex(this.documentElement,"head")}},images:{get:st.nyi},embeds:{get:st.nyi},plugins:{get:st.nyi},links:{get:st.nyi},forms:{get:st.nyi},scripts:{get:st.nyi},applets:{get:function(){return[]}},activeElement:{get:function(){return null}},innerHTML:{get:function(){return this.serialize()},set:st.nyi},outerHTML:{get:function(){return this.serialize()},set:st.nyi},write:{value:function(e){if(this.isHTML||st.InvalidStateError(),!!this._parser){this._parser;var t=arguments.join("");this._parser.parse(t)}}},writeln:{value:function(t){this.write(Array.prototype.join.call(arguments,"")+` `)}},open:{value:function(){this.documentElement=null}},close:{value:function(){this.readyState="interactive",this._dispatchEvent(new Io("readystatechange"),!0),this._dispatchEvent(new Io("DOMContentLoaded"),!0),this.readyState="complete",this._dispatchEvent(new Io("readystatechange"),!0),this.defaultView&&this.defaultView._dispatchEvent(new Io("load"),!0)}},clone:{value:function(){var t=new $o(this.isHTML,this._address);return t._quirks=this._quirks,t._contentType=this._contentType,t}},cloneNode:{value:function(t){var r=Cr.prototype.cloneNode.call(this,!1);if(t)for(var n=this.firstChild;n!==null;n=n.nextSibling)r._appendChild(r.importNode(n,!0));return r._updateDocTypeElement(),r}},isEqual:{value:function(t){return!0}},mutateValue:{value:function(e){this.mutationHandler&&this.mutationHandler({type:hs.VALUE,target:e,data:e.data})}},mutateAttr:{value:function(e,t){this.mutationHandler&&this.mutationHandler({type:hs.ATTR,target:e.ownerElement,attr:e})}},mutateRemoveAttr:{value:function(e){this.mutationHandler&&this.mutationHandler({type:hs.REMOVE_ATTR,target:e.ownerElement,attr:e})}},mutateRemove:{value:function(e){this.mutationHandler&&this.mutationHandler({type:hs.REMOVE,target:e.parentNode,node:e}),nx(e)}},mutateInsert:{value:function(e){rx(e),this.mutationHandler&&this.mutationHandler({type:hs.INSERT,target:e.parentNode,node:e})}},mutateMove:{value:function(e){this.mutationHandler&&this.mutationHandler({type:hs.MOVE,target:e})}},addId:{value:function(t,r){var n=this.byId[t];n?(n instanceof bi||(n=new bi(n),this.byId[t]=n),n.add(r)):this.byId[t]=r}},delId:{value:function(t,r){var n=this.byId[t];st.assert(n),n instanceof bi?(n.del(r),n.length===1&&(this.byId[t]=n.downgrade())):this.byId[t]=void 0}},_resolve:{value:function(e){return new K2(this._documentBaseURL).resolve(e)}},_documentBaseURL:{get:function(){var e=this._address;e==="about:blank"&&(e="/");var t=this.querySelector("base[href]");return t?new K2(e).resolve(t.getAttribute("href")):e}},_templateDoc:{get:function(){if(!this._templateDocCache){var e=new $o(this.isHTML,this._address);this._templateDocCache=e._templateDocCache=e}return this._templateDocCache}},querySelector:{value:function(e){return Y2(e,this)[0]}},querySelectorAll:{value:function(e){var t=Y2(e,this);return t.item?t:new lT(t)}}});var wT=["abort","canplay","canplaythrough","change","click","contextmenu","cuechange","dblclick","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","input","invalid","keydown","keypress","keyup","loadeddata","loadedmetadata","loadstart","mousedown","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","progress","ratechange","readystatechange","reset","seeked","seeking","select","show","stalled","submit","suspend","timeupdate","volumechange","waiting","blur","error","focus","load","scroll"];wT.forEach(function(e){Object.defineProperty($o.prototype,"on"+e,{get:function(){return this._getEventHandler(e)},set:function(t){this._setEventHandler(e,t)}})});function ex(e,t){if(e&&e.isHTML){for(var r=e.firstChild;r!==null;r=r.nextSibling)if(r.nodeType===Cr.ELEMENT_NODE&&r.localName===t&&r.namespaceURI===gs.HTML)return r}return null}function vT(e){if(e._nid=e.ownerDocument._nextnid++,e.ownerDocument._nodes[e._nid]=e,e.nodeType===Cr.ELEMENT_NODE){var t=e.getAttribute("id");t&&e.ownerDocument.addId(t,e),e._roothook&&e._roothook()}}function ET(e){if(e.nodeType===Cr.ELEMENT_NODE){var t=e.getAttribute("id");t&&e.ownerDocument.delId(t,e)}e.ownerDocument._nodes[e._nid]=void 0,e._nid=void 0}function rx(e){if(vT(e),e.nodeType===Cr.ELEMENT_NODE)for(var t=e.firstChild;t!==null;t=t.nextSibling)rx(t)}function nx(e){ET(e);for(var t=e.firstChild;t!==null;t=t.nextSibling)nx(t)}function ix(e,t){e.ownerDocument=t,e._lastModTime=void 0,Object.prototype.hasOwnProperty.call(e,"_tagName")&&(e._tagName=void 0);for(var r=e.firstChild;r!==null;r=r.nextSibling)ix(r,t)}function bi(e){this.nodes=Object.create(null),this.nodes[e._nid]=e,this.length=1,this.firstNode=void 0}bi.prototype.add=function(e){this.nodes[e._nid]||(this.nodes[e._nid]=e,this.length++,this.firstNode=void 0)};bi.prototype.del=function(e){this.nodes[e._nid]&&(delete this.nodes[e._nid],this.length--,this.firstNode=void 0)};bi.prototype.getFirst=function(){if(!this.firstNode){var e;for(e in this.nodes)(this.firstNode===void 0||this.firstNode.compareDocumentPosition(this.nodes[e])&Cr.DOCUMENT_POSITION_PRECEDING)&&(this.firstNode=this.nodes[e])}return this.firstNode};bi.prototype.downgrade=function(){if(this.length===1){var e;for(e in this.nodes)return this.nodes[e]}return this}});var yu=ke((fG,ox)=>{"use strict";ox.exports=xu;var ST=xr(),sx=Cf(),AT=iu();function xu(e,t,r,n){sx.call(this),this.nodeType=ST.DOCUMENT_TYPE_NODE,this.ownerDocument=e||null,this.name=t,this.publicId=r||"",this.systemId=n||""}xu.prototype=Object.create(sx.prototype,{nodeName:{get:function(){return this.name}},nodeValue:{get:function(){return null},set:function(){}},clone:{value:function(){return new xu(this.ownerDocument,this.name,this.publicId,this.systemId)}},isEqual:{value:function(t){return this.name===t.name&&this.publicId===t.publicId&&this.systemId===t.systemId}}});Object.defineProperties(xu.prototype,AT)});var Cu=ke((dG,Ox)=>{"use strict";Ox.exports=nt;var CT=gu(),kT=yu(),Kf=xr(),Ne=Wt().NAMESPACE,Ex=du(),dt=Ex.elements,ma=Function.prototype.apply.bind(Array.prototype.push),bu=-1,xs=1,kr=2,Qe=3,Jn=4,NT=5,TT=[],_T=/^HTML$|^-\/\/W3O\/\/DTD W3 HTML Strict 3\.0\/\/EN\/\/$|^-\/W3C\/DTD HTML 4\.0 Transitional\/EN$|^\+\/\/Silmaril\/\/dtd html Pro v0r11 19970101\/\/|^-\/\/AdvaSoft Ltd\/\/DTD HTML 3\.0 asWedit \+ extensions\/\/|^-\/\/AS\/\/DTD HTML 3\.0 asWedit \+ extensions\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Level 1\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Level 2\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict Level 1\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict Level 2\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict\/\/|^-\/\/IETF\/\/DTD HTML 2\.0\/\/|^-\/\/IETF\/\/DTD HTML 2\.1E\/\/|^-\/\/IETF\/\/DTD HTML 3\.0\/\/|^-\/\/IETF\/\/DTD HTML 3\.2 Final\/\/|^-\/\/IETF\/\/DTD HTML 3\.2\/\/|^-\/\/IETF\/\/DTD HTML 3\/\/|^-\/\/IETF\/\/DTD HTML Level 0\/\/|^-\/\/IETF\/\/DTD HTML Level 1\/\/|^-\/\/IETF\/\/DTD HTML Level 2\/\/|^-\/\/IETF\/\/DTD HTML Level 3\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 0\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 1\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 2\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 3\/\/|^-\/\/IETF\/\/DTD HTML Strict\/\/|^-\/\/IETF\/\/DTD HTML\/\/|^-\/\/Metrius\/\/DTD Metrius Presentational\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 HTML Strict\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 HTML\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 Tables\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 HTML Strict\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 HTML\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 Tables\/\/|^-\/\/Netscape Comm\. Corp\.\/\/DTD HTML\/\/|^-\/\/Netscape Comm\. Corp\.\/\/DTD Strict HTML\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML 2\.0\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML Extended 1\.0\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML Extended Relaxed 1\.0\/\/|^-\/\/SoftQuad Software\/\/DTD HoTMetaL PRO 6\.0::19990601::extensions to HTML 4\.0\/\/|^-\/\/SoftQuad\/\/DTD HoTMetaL PRO 4\.0::19971010::extensions to HTML 4\.0\/\/|^-\/\/Spyglass\/\/DTD HTML 2\.0 Extended\/\/|^-\/\/SQ\/\/DTD HTML 2\.0 HoTMetaL \+ extensions\/\/|^-\/\/Sun Microsystems Corp\.\/\/DTD HotJava HTML\/\/|^-\/\/Sun Microsystems Corp\.\/\/DTD HotJava Strict HTML\/\/|^-\/\/W3C\/\/DTD HTML 3 1995-03-24\/\/|^-\/\/W3C\/\/DTD HTML 3\.2 Draft\/\/|^-\/\/W3C\/\/DTD HTML 3\.2 Final\/\/|^-\/\/W3C\/\/DTD HTML 3\.2\/\/|^-\/\/W3C\/\/DTD HTML 3\.2S Draft\/\/|^-\/\/W3C\/\/DTD HTML 4\.0 Frameset\/\/|^-\/\/W3C\/\/DTD HTML 4\.0 Transitional\/\/|^-\/\/W3C\/\/DTD HTML Experimental 19960712\/\/|^-\/\/W3C\/\/DTD HTML Experimental 970421\/\/|^-\/\/W3C\/\/DTD W3 HTML\/\/|^-\/\/W3O\/\/DTD W3 HTML 3\.0\/\/|^-\/\/WebTechs\/\/DTD Mozilla HTML 2\.0\/\/|^-\/\/WebTechs\/\/DTD Mozilla HTML\/\//i,OT="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",lx=/^-\/\/W3C\/\/DTD HTML 4\.01 Frameset\/\/|^-\/\/W3C\/\/DTD HTML 4\.01 Transitional\/\//i,IT=/^-\/\/W3C\/\/DTD XHTML 1\.0 Frameset\/\/|^-\/\/W3C\/\/DTD XHTML 1\.0 Transitional\/\//i,xa=Object.create(null);xa[Ne.HTML]={__proto__:null,address:!0,applet:!0,area:!0,article:!0,aside:!0,base:!0,basefont:!0,bgsound:!0,blockquote:!0,body:!0,br:!0,button:!0,caption:!0,center:!0,col:!0,colgroup:!0,dd:!0,details:!0,dir:!0,div:!0,dl:!0,dt:!0,embed:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,frame:!0,frameset:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,head:!0,header:!0,hgroup:!0,hr:!0,html:!0,iframe:!0,img:!0,input:!0,li:!0,link:!0,listing:!0,main:!0,marquee:!0,menu:!0,meta:!0,nav:!0,noembed:!0,noframes:!0,noscript:!0,object:!0,ol:!0,p:!0,param:!0,plaintext:!0,pre:!0,script:!0,section:!0,select:!0,source:!0,style:!0,summary:!0,table:!0,tbody:!0,td:!0,template:!0,textarea:!0,tfoot:!0,th:!0,thead:!0,title:!0,tr:!0,track:!0,ul:!0,wbr:!0,xmp:!0};xa[Ne.SVG]={__proto__:null,foreignObject:!0,desc:!0,title:!0};xa[Ne.MATHML]={__proto__:null,mi:!0,mo:!0,mn:!0,ms:!0,mtext:!0,"annotation-xml":!0};var ed=Object.create(null);ed[Ne.HTML]={__proto__:null,address:!0,div:!0,p:!0};var Sx=Object.create(null);Sx[Ne.HTML]={__proto__:null,dd:!0,dt:!0};var ys=Object.create(null);ys[Ne.HTML]={__proto__:null,table:!0,thead:!0,tbody:!0,tfoot:!0,tr:!0};var Ax=Object.create(null);Ax[Ne.HTML]={__proto__:null,dd:!0,dt:!0,li:!0,menuitem:!0,optgroup:!0,option:!0,p:!0,rb:!0,rp:!0,rt:!0,rtc:!0};var Cx=Object.create(null);Cx[Ne.HTML]={__proto__:null,caption:!0,colgroup:!0,dd:!0,dt:!0,li:!0,optgroup:!0,option:!0,p:!0,rb:!0,rp:!0,rt:!0,rtc:!0,tbody:!0,td:!0,tfoot:!0,th:!0,thead:!0,tr:!0};var Eu=Object.create(null);Eu[Ne.HTML]={__proto__:null,table:!0,template:!0,html:!0};var Su=Object.create(null);Su[Ne.HTML]={__proto__:null,tbody:!0,tfoot:!0,thead:!0,template:!0,html:!0};var td=Object.create(null);td[Ne.HTML]={__proto__:null,tr:!0,template:!0,html:!0};var kx=Object.create(null);kx[Ne.HTML]={__proto__:null,button:!0,fieldset:!0,input:!0,keygen:!0,object:!0,output:!0,select:!0,textarea:!0,img:!0};var ei=Object.create(null);ei[Ne.HTML]={__proto__:null,applet:!0,caption:!0,html:!0,table:!0,td:!0,th:!0,marquee:!0,object:!0,template:!0};ei[Ne.MATHML]={__proto__:null,mi:!0,mo:!0,mn:!0,ms:!0,mtext:!0,"annotation-xml":!0};ei[Ne.SVG]={__proto__:null,foreignObject:!0,desc:!0,title:!0};var Au=Object.create(ei);Au[Ne.HTML]=Object.create(ei[Ne.HTML]);Au[Ne.HTML].ol=!0;Au[Ne.HTML].ul=!0;var rd=Object.create(ei);rd[Ne.HTML]=Object.create(ei[Ne.HTML]);rd[Ne.HTML].button=!0;var Nx=Object.create(null);Nx[Ne.HTML]={__proto__:null,html:!0,table:!0,template:!0};var $T=Object.create(null);$T[Ne.HTML]={__proto__:null,optgroup:!0,option:!0};var Tx=Object.create(null);Tx[Ne.MATHML]={__proto__:null,mi:!0,mo:!0,mn:!0,ms:!0,mtext:!0};var _x=Object.create(null);_x[Ne.SVG]={__proto__:null,foreignObject:!0,desc:!0,title:!0};var ux={__proto__:null,"xlink:actuate":Ne.XLINK,"xlink:arcrole":Ne.XLINK,"xlink:href":Ne.XLINK,"xlink:role":Ne.XLINK,"xlink:show":Ne.XLINK,"xlink:title":Ne.XLINK,"xlink:type":Ne.XLINK,"xml:base":Ne.XML,"xml:lang":Ne.XML,"xml:space":Ne.XML,xmlns:Ne.XMLNS,"xmlns:xlink":Ne.XMLNS},cx={__proto__:null,attributename:"attributeName",attributetype:"attributeType",basefrequency:"baseFrequency",baseprofile:"baseProfile",calcmode:"calcMode",clippathunits:"clipPathUnits",diffuseconstant:"diffuseConstant",edgemode:"edgeMode",filterunits:"filterUnits",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",limitingconeangle:"limitingConeAngle",markerheight:"markerHeight",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textlength:"textLength",viewbox:"viewBox",viewtarget:"viewTarget",xchannelselector:"xChannelSelector",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan"},px={__proto__:null,altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath"},fx={__proto__:null,0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},DT={__proto__:null,AElig:198,"AElig;":198,AMP:38,"AMP;":38,Aacute:193,"Aacute;":193,"Abreve;":258,Acirc:194,"Acirc;":194,"Acy;":1040,"Afr;":[55349,56580],Agrave:192,"Agrave;":192,"Alpha;":913,"Amacr;":256,"And;":10835,"Aogon;":260,"Aopf;":[55349,56632],"ApplyFunction;":8289,Aring:197,"Aring;":197,"Ascr;":[55349,56476],"Assign;":8788,Atilde:195,"Atilde;":195,Auml:196,"Auml;":196,"Backslash;":8726,"Barv;":10983,"Barwed;":8966,"Bcy;":1041,"Because;":8757,"Bernoullis;":8492,"Beta;":914,"Bfr;":[55349,56581],"Bopf;":[55349,56633],"Breve;":728,"Bscr;":8492,"Bumpeq;":8782,"CHcy;":1063,COPY:169,"COPY;":169,"Cacute;":262,"Cap;":8914,"CapitalDifferentialD;":8517,"Cayleys;":8493,"Ccaron;":268,Ccedil:199,"Ccedil;":199,"Ccirc;":264,"Cconint;":8752,"Cdot;":266,"Cedilla;":184,"CenterDot;":183,"Cfr;":8493,"Chi;":935,"CircleDot;":8857,"CircleMinus;":8854,"CirclePlus;":8853,"CircleTimes;":8855,"ClockwiseContourIntegral;":8754,"CloseCurlyDoubleQuote;":8221,"CloseCurlyQuote;":8217,"Colon;":8759,"Colone;":10868,"Congruent;":8801,"Conint;":8751,"ContourIntegral;":8750,"Copf;":8450,"Coproduct;":8720,"CounterClockwiseContourIntegral;":8755,"Cross;":10799,"Cscr;":[55349,56478],"Cup;":8915,"CupCap;":8781,"DD;":8517,"DDotrahd;":10513,"DJcy;":1026,"DScy;":1029,"DZcy;":1039,"Dagger;":8225,"Darr;":8609,"Dashv;":10980,"Dcaron;":270,"Dcy;":1044,"Del;":8711,"Delta;":916,"Dfr;":[55349,56583],"DiacriticalAcute;":180,"DiacriticalDot;":729,"DiacriticalDoubleAcute;":733,"DiacriticalGrave;":96,"DiacriticalTilde;":732,"Diamond;":8900,"DifferentialD;":8518,"Dopf;":[55349,56635],"Dot;":168,"DotDot;":8412,"DotEqual;":8784,"DoubleContourIntegral;":8751,"DoubleDot;":168,"DoubleDownArrow;":8659,"DoubleLeftArrow;":8656,"DoubleLeftRightArrow;":8660,"DoubleLeftTee;":10980,"DoubleLongLeftArrow;":10232,"DoubleLongLeftRightArrow;":10234,"DoubleLongRightArrow;":10233,"DoubleRightArrow;":8658,"DoubleRightTee;":8872,"DoubleUpArrow;":8657,"DoubleUpDownArrow;":8661,"DoubleVerticalBar;":8741,"DownArrow;":8595,"DownArrowBar;":10515,"DownArrowUpArrow;":8693,"DownBreve;":785,"DownLeftRightVector;":10576,"DownLeftTeeVector;":10590,"DownLeftVector;":8637,"DownLeftVectorBar;":10582,"DownRightTeeVector;":10591,"DownRightVector;":8641,"DownRightVectorBar;":10583,"DownTee;":8868,"DownTeeArrow;":8615,"Downarrow;":8659,"Dscr;":[55349,56479],"Dstrok;":272,"ENG;":330,ETH:208,"ETH;":208,Eacute:201,"Eacute;":201,"Ecaron;":282,Ecirc:202,"Ecirc;":202,"Ecy;":1069,"Edot;":278,"Efr;":[55349,56584],Egrave:200,"Egrave;":200,"Element;":8712,"Emacr;":274,"EmptySmallSquare;":9723,"EmptyVerySmallSquare;":9643,"Eogon;":280,"Eopf;":[55349,56636],"Epsilon;":917,"Equal;":10869,"EqualTilde;":8770,"Equilibrium;":8652,"Escr;":8496,"Esim;":10867,"Eta;":919,Euml:203,"Euml;":203,"Exists;":8707,"ExponentialE;":8519,"Fcy;":1060,"Ffr;":[55349,56585],"FilledSmallSquare;":9724,"FilledVerySmallSquare;":9642,"Fopf;":[55349,56637],"ForAll;":8704,"Fouriertrf;":8497,"Fscr;":8497,"GJcy;":1027,GT:62,"GT;":62,"Gamma;":915,"Gammad;":988,"Gbreve;":286,"Gcedil;":290,"Gcirc;":284,"Gcy;":1043,"Gdot;":288,"Gfr;":[55349,56586],"Gg;":8921,"Gopf;":[55349,56638],"GreaterEqual;":8805,"GreaterEqualLess;":8923,"GreaterFullEqual;":8807,"GreaterGreater;":10914,"GreaterLess;":8823,"GreaterSlantEqual;":10878,"GreaterTilde;":8819,"Gscr;":[55349,56482],"Gt;":8811,"HARDcy;":1066,"Hacek;":711,"Hat;":94,"Hcirc;":292,"Hfr;":8460,"HilbertSpace;":8459,"Hopf;":8461,"HorizontalLine;":9472,"Hscr;":8459,"Hstrok;":294,"HumpDownHump;":8782,"HumpEqual;":8783,"IEcy;":1045,"IJlig;":306,"IOcy;":1025,Iacute:205,"Iacute;":205,Icirc:206,"Icirc;":206,"Icy;":1048,"Idot;":304,"Ifr;":8465,Igrave:204,"Igrave;":204,"Im;":8465,"Imacr;":298,"ImaginaryI;":8520,"Implies;":8658,"Int;":8748,"Integral;":8747,"Intersection;":8898,"InvisibleComma;":8291,"InvisibleTimes;":8290,"Iogon;":302,"Iopf;":[55349,56640],"Iota;":921,"Iscr;":8464,"Itilde;":296,"Iukcy;":1030,Iuml:207,"Iuml;":207,"Jcirc;":308,"Jcy;":1049,"Jfr;":[55349,56589],"Jopf;":[55349,56641],"Jscr;":[55349,56485],"Jsercy;":1032,"Jukcy;":1028,"KHcy;":1061,"KJcy;":1036,"Kappa;":922,"Kcedil;":310,"Kcy;":1050,"Kfr;":[55349,56590],"Kopf;":[55349,56642],"Kscr;":[55349,56486],"LJcy;":1033,LT:60,"LT;":60,"Lacute;":313,"Lambda;":923,"Lang;":10218,"Laplacetrf;":8466,"Larr;":8606,"Lcaron;":317,"Lcedil;":315,"Lcy;":1051,"LeftAngleBracket;":10216,"LeftArrow;":8592,"LeftArrowBar;":8676,"LeftArrowRightArrow;":8646,"LeftCeiling;":8968,"LeftDoubleBracket;":10214,"LeftDownTeeVector;":10593,"LeftDownVector;":8643,"LeftDownVectorBar;":10585,"LeftFloor;":8970,"LeftRightArrow;":8596,"LeftRightVector;":10574,"LeftTee;":8867,"LeftTeeArrow;":8612,"LeftTeeVector;":10586,"LeftTriangle;":8882,"LeftTriangleBar;":10703,"LeftTriangleEqual;":8884,"LeftUpDownVector;":10577,"LeftUpTeeVector;":10592,"LeftUpVector;":8639,"LeftUpVectorBar;":10584,"LeftVector;":8636,"LeftVectorBar;":10578,"Leftarrow;":8656,"Leftrightarrow;":8660,"LessEqualGreater;":8922,"LessFullEqual;":8806,"LessGreater;":8822,"LessLess;":10913,"LessSlantEqual;":10877,"LessTilde;":8818,"Lfr;":[55349,56591],"Ll;":8920,"Lleftarrow;":8666,"Lmidot;":319,"LongLeftArrow;":10229,"LongLeftRightArrow;":10231,"LongRightArrow;":10230,"Longleftarrow;":10232,"Longleftrightarrow;":10234,"Longrightarrow;":10233,"Lopf;":[55349,56643],"LowerLeftArrow;":8601,"LowerRightArrow;":8600,"Lscr;":8466,"Lsh;":8624,"Lstrok;":321,"Lt;":8810,"Map;":10501,"Mcy;":1052,"MediumSpace;":8287,"Mellintrf;":8499,"Mfr;":[55349,56592],"MinusPlus;":8723,"Mopf;":[55349,56644],"Mscr;":8499,"Mu;":924,"NJcy;":1034,"Nacute;":323,"Ncaron;":327,"Ncedil;":325,"Ncy;":1053,"NegativeMediumSpace;":8203,"NegativeThickSpace;":8203,"NegativeThinSpace;":8203,"NegativeVeryThinSpace;":8203,"NestedGreaterGreater;":8811,"NestedLessLess;":8810,"NewLine;":10,"Nfr;":[55349,56593],"NoBreak;":8288,"NonBreakingSpace;":160,"Nopf;":8469,"Not;":10988,"NotCongruent;":8802,"NotCupCap;":8813,"NotDoubleVerticalBar;":8742,"NotElement;":8713,"NotEqual;":8800,"NotEqualTilde;":[8770,824],"NotExists;":8708,"NotGreater;":8815,"NotGreaterEqual;":8817,"NotGreaterFullEqual;":[8807,824],"NotGreaterGreater;":[8811,824],"NotGreaterLess;":8825,"NotGreaterSlantEqual;":[10878,824],"NotGreaterTilde;":8821,"NotHumpDownHump;":[8782,824],"NotHumpEqual;":[8783,824],"NotLeftTriangle;":8938,"NotLeftTriangleBar;":[10703,824],"NotLeftTriangleEqual;":8940,"NotLess;":8814,"NotLessEqual;":8816,"NotLessGreater;":8824,"NotLessLess;":[8810,824],"NotLessSlantEqual;":[10877,824],"NotLessTilde;":8820,"NotNestedGreaterGreater;":[10914,824],"NotNestedLessLess;":[10913,824],"NotPrecedes;":8832,"NotPrecedesEqual;":[10927,824],"NotPrecedesSlantEqual;":8928,"NotReverseElement;":8716,"NotRightTriangle;":8939,"NotRightTriangleBar;":[10704,824],"NotRightTriangleEqual;":8941,"NotSquareSubset;":[8847,824],"NotSquareSubsetEqual;":8930,"NotSquareSuperset;":[8848,824],"NotSquareSupersetEqual;":8931,"NotSubset;":[8834,8402],"NotSubsetEqual;":8840,"NotSucceeds;":8833,"NotSucceedsEqual;":[10928,824],"NotSucceedsSlantEqual;":8929,"NotSucceedsTilde;":[8831,824],"NotSuperset;":[8835,8402],"NotSupersetEqual;":8841,"NotTilde;":8769,"NotTildeEqual;":8772,"NotTildeFullEqual;":8775,"NotTildeTilde;":8777,"NotVerticalBar;":8740,"Nscr;":[55349,56489],Ntilde:209,"Ntilde;":209,"Nu;":925,"OElig;":338,Oacute:211,"Oacute;":211,Ocirc:212,"Ocirc;":212,"Ocy;":1054,"Odblac;":336,"Ofr;":[55349,56594],Ograve:210,"Ograve;":210,"Omacr;":332,"Omega;":937,"Omicron;":927,"Oopf;":[55349,56646],"OpenCurlyDoubleQuote;":8220,"OpenCurlyQuote;":8216,"Or;":10836,"Oscr;":[55349,56490],Oslash:216,"Oslash;":216,Otilde:213,"Otilde;":213,"Otimes;":10807,Ouml:214,"Ouml;":214,"OverBar;":8254,"OverBrace;":9182,"OverBracket;":9140,"OverParenthesis;":9180,"PartialD;":8706,"Pcy;":1055,"Pfr;":[55349,56595],"Phi;":934,"Pi;":928,"PlusMinus;":177,"Poincareplane;":8460,"Popf;":8473,"Pr;":10939,"Precedes;":8826,"PrecedesEqual;":10927,"PrecedesSlantEqual;":8828,"PrecedesTilde;":8830,"Prime;":8243,"Product;":8719,"Proportion;":8759,"Proportional;":8733,"Pscr;":[55349,56491],"Psi;":936,QUOT:34,"QUOT;":34,"Qfr;":[55349,56596],"Qopf;":8474,"Qscr;":[55349,56492],"RBarr;":10512,REG:174,"REG;":174,"Racute;":340,"Rang;":10219,"Rarr;":8608,"Rarrtl;":10518,"Rcaron;":344,"Rcedil;":342,"Rcy;":1056,"Re;":8476,"ReverseElement;":8715,"ReverseEquilibrium;":8651,"ReverseUpEquilibrium;":10607,"Rfr;":8476,"Rho;":929,"RightAngleBracket;":10217,"RightArrow;":8594,"RightArrowBar;":8677,"RightArrowLeftArrow;":8644,"RightCeiling;":8969,"RightDoubleBracket;":10215,"RightDownTeeVector;":10589,"RightDownVector;":8642,"RightDownVectorBar;":10581,"RightFloor;":8971,"RightTee;":8866,"RightTeeArrow;":8614,"RightTeeVector;":10587,"RightTriangle;":8883,"RightTriangleBar;":10704,"RightTriangleEqual;":8885,"RightUpDownVector;":10575,"RightUpTeeVector;":10588,"RightUpVector;":8638,"RightUpVectorBar;":10580,"RightVector;":8640,"RightVectorBar;":10579,"Rightarrow;":8658,"Ropf;":8477,"RoundImplies;":10608,"Rrightarrow;":8667,"Rscr;":8475,"Rsh;":8625,"RuleDelayed;":10740,"SHCHcy;":1065,"SHcy;":1064,"SOFTcy;":1068,"Sacute;":346,"Sc;":10940,"Scaron;":352,"Scedil;":350,"Scirc;":348,"Scy;":1057,"Sfr;":[55349,56598],"ShortDownArrow;":8595,"ShortLeftArrow;":8592,"ShortRightArrow;":8594,"ShortUpArrow;":8593,"Sigma;":931,"SmallCircle;":8728,"Sopf;":[55349,56650],"Sqrt;":8730,"Square;":9633,"SquareIntersection;":8851,"SquareSubset;":8847,"SquareSubsetEqual;":8849,"SquareSuperset;":8848,"SquareSupersetEqual;":8850,"SquareUnion;":8852,"Sscr;":[55349,56494],"Star;":8902,"Sub;":8912,"Subset;":8912,"SubsetEqual;":8838,"Succeeds;":8827,"SucceedsEqual;":10928,"SucceedsSlantEqual;":8829,"SucceedsTilde;":8831,"SuchThat;":8715,"Sum;":8721,"Sup;":8913,"Superset;":8835,"SupersetEqual;":8839,"Supset;":8913,THORN:222,"THORN;":222,"TRADE;":8482,"TSHcy;":1035,"TScy;":1062,"Tab;":9,"Tau;":932,"Tcaron;":356,"Tcedil;":354,"Tcy;":1058,"Tfr;":[55349,56599],"Therefore;":8756,"Theta;":920,"ThickSpace;":[8287,8202],"ThinSpace;":8201,"Tilde;":8764,"TildeEqual;":8771,"TildeFullEqual;":8773,"TildeTilde;":8776,"Topf;":[55349,56651],"TripleDot;":8411,"Tscr;":[55349,56495],"Tstrok;":358,Uacute:218,"Uacute;":218,"Uarr;":8607,"Uarrocir;":10569,"Ubrcy;":1038,"Ubreve;":364,Ucirc:219,"Ucirc;":219,"Ucy;":1059,"Udblac;":368,"Ufr;":[55349,56600],Ugrave:217,"Ugrave;":217,"Umacr;":362,"UnderBar;":95,"UnderBrace;":9183,"UnderBracket;":9141,"UnderParenthesis;":9181,"Union;":8899,"UnionPlus;":8846,"Uogon;":370,"Uopf;":[55349,56652],"UpArrow;":8593,"UpArrowBar;":10514,"UpArrowDownArrow;":8645,"UpDownArrow;":8597,"UpEquilibrium;":10606,"UpTee;":8869,"UpTeeArrow;":8613,"Uparrow;":8657,"Updownarrow;":8661,"UpperLeftArrow;":8598,"UpperRightArrow;":8599,"Upsi;":978,"Upsilon;":933,"Uring;":366,"Uscr;":[55349,56496],"Utilde;":360,Uuml:220,"Uuml;":220,"VDash;":8875,"Vbar;":10987,"Vcy;":1042,"Vdash;":8873,"Vdashl;":10982,"Vee;":8897,"Verbar;":8214,"Vert;":8214,"VerticalBar;":8739,"VerticalLine;":124,"VerticalSeparator;":10072,"VerticalTilde;":8768,"VeryThinSpace;":8202,"Vfr;":[55349,56601],"Vopf;":[55349,56653],"Vscr;":[55349,56497],"Vvdash;":8874,"Wcirc;":372,"Wedge;":8896,"Wfr;":[55349,56602],"Wopf;":[55349,56654],"Wscr;":[55349,56498],"Xfr;":[55349,56603],"Xi;":926,"Xopf;":[55349,56655],"Xscr;":[55349,56499],"YAcy;":1071,"YIcy;":1031,"YUcy;":1070,Yacute:221,"Yacute;":221,"Ycirc;":374,"Ycy;":1067,"Yfr;":[55349,56604],"Yopf;":[55349,56656],"Yscr;":[55349,56500],"Yuml;":376,"ZHcy;":1046,"Zacute;":377,"Zcaron;":381,"Zcy;":1047,"Zdot;":379,"ZeroWidthSpace;":8203,"Zeta;":918,"Zfr;":8488,"Zopf;":8484,"Zscr;":[55349,56501],aacute:225,"aacute;":225,"abreve;":259,"ac;":8766,"acE;":[8766,819],"acd;":8767,acirc:226,"acirc;":226,acute:180,"acute;":180,"acy;":1072,aelig:230,"aelig;":230,"af;":8289,"afr;":[55349,56606],agrave:224,"agrave;":224,"alefsym;":8501,"aleph;":8501,"alpha;":945,"amacr;":257,"amalg;":10815,amp:38,"amp;":38,"and;":8743,"andand;":10837,"andd;":10844,"andslope;":10840,"andv;":10842,"ang;":8736,"ange;":10660,"angle;":8736,"angmsd;":8737,"angmsdaa;":10664,"angmsdab;":10665,"angmsdac;":10666,"angmsdad;":10667,"angmsdae;":10668,"angmsdaf;":10669,"angmsdag;":10670,"angmsdah;":10671,"angrt;":8735,"angrtvb;":8894,"angrtvbd;":10653,"angsph;":8738,"angst;":197,"angzarr;":9084,"aogon;":261,"aopf;":[55349,56658],"ap;":8776,"apE;":10864,"apacir;":10863,"ape;":8778,"apid;":8779,"apos;":39,"approx;":8776,"approxeq;":8778,aring:229,"aring;":229,"ascr;":[55349,56502],"ast;":42,"asymp;":8776,"asympeq;":8781,atilde:227,"atilde;":227,auml:228,"auml;":228,"awconint;":8755,"awint;":10769,"bNot;":10989,"backcong;":8780,"backepsilon;":1014,"backprime;":8245,"backsim;":8765,"backsimeq;":8909,"barvee;":8893,"barwed;":8965,"barwedge;":8965,"bbrk;":9141,"bbrktbrk;":9142,"bcong;":8780,"bcy;":1073,"bdquo;":8222,"becaus;":8757,"because;":8757,"bemptyv;":10672,"bepsi;":1014,"bernou;":8492,"beta;":946,"beth;":8502,"between;":8812,"bfr;":[55349,56607],"bigcap;":8898,"bigcirc;":9711,"bigcup;":8899,"bigodot;":10752,"bigoplus;":10753,"bigotimes;":10754,"bigsqcup;":10758,"bigstar;":9733,"bigtriangledown;":9661,"bigtriangleup;":9651,"biguplus;":10756,"bigvee;":8897,"bigwedge;":8896,"bkarow;":10509,"blacklozenge;":10731,"blacksquare;":9642,"blacktriangle;":9652,"blacktriangledown;":9662,"blacktriangleleft;":9666,"blacktriangleright;":9656,"blank;":9251,"blk12;":9618,"blk14;":9617,"blk34;":9619,"block;":9608,"bne;":[61,8421],"bnequiv;":[8801,8421],"bnot;":8976,"bopf;":[55349,56659],"bot;":8869,"bottom;":8869,"bowtie;":8904,"boxDL;":9559,"boxDR;":9556,"boxDl;":9558,"boxDr;":9555,"boxH;":9552,"boxHD;":9574,"boxHU;":9577,"boxHd;":9572,"boxHu;":9575,"boxUL;":9565,"boxUR;":9562,"boxUl;":9564,"boxUr;":9561,"boxV;":9553,"boxVH;":9580,"boxVL;":9571,"boxVR;":9568,"boxVh;":9579,"boxVl;":9570,"boxVr;":9567,"boxbox;":10697,"boxdL;":9557,"boxdR;":9554,"boxdl;":9488,"boxdr;":9484,"boxh;":9472,"boxhD;":9573,"boxhU;":9576,"boxhd;":9516,"boxhu;":9524,"boxminus;":8863,"boxplus;":8862,"boxtimes;":8864,"boxuL;":9563,"boxuR;":9560,"boxul;":9496,"boxur;":9492,"boxv;":9474,"boxvH;":9578,"boxvL;":9569,"boxvR;":9566,"boxvh;":9532,"boxvl;":9508,"boxvr;":9500,"bprime;":8245,"breve;":728,brvbar:166,"brvbar;":166,"bscr;":[55349,56503],"bsemi;":8271,"bsim;":8765,"bsime;":8909,"bsol;":92,"bsolb;":10693,"bsolhsub;":10184,"bull;":8226,"bullet;":8226,"bump;":8782,"bumpE;":10926,"bumpe;":8783,"bumpeq;":8783,"cacute;":263,"cap;":8745,"capand;":10820,"capbrcup;":10825,"capcap;":10827,"capcup;":10823,"capdot;":10816,"caps;":[8745,65024],"caret;":8257,"caron;":711,"ccaps;":10829,"ccaron;":269,ccedil:231,"ccedil;":231,"ccirc;":265,"ccups;":10828,"ccupssm;":10832,"cdot;":267,cedil:184,"cedil;":184,"cemptyv;":10674,cent:162,"cent;":162,"centerdot;":183,"cfr;":[55349,56608],"chcy;":1095,"check;":10003,"checkmark;":10003,"chi;":967,"cir;":9675,"cirE;":10691,"circ;":710,"circeq;":8791,"circlearrowleft;":8634,"circlearrowright;":8635,"circledR;":174,"circledS;":9416,"circledast;":8859,"circledcirc;":8858,"circleddash;":8861,"cire;":8791,"cirfnint;":10768,"cirmid;":10991,"cirscir;":10690,"clubs;":9827,"clubsuit;":9827,"colon;":58,"colone;":8788,"coloneq;":8788,"comma;":44,"commat;":64,"comp;":8705,"compfn;":8728,"complement;":8705,"complexes;":8450,"cong;":8773,"congdot;":10861,"conint;":8750,"copf;":[55349,56660],"coprod;":8720,copy:169,"copy;":169,"copysr;":8471,"crarr;":8629,"cross;":10007,"cscr;":[55349,56504],"csub;":10959,"csube;":10961,"csup;":10960,"csupe;":10962,"ctdot;":8943,"cudarrl;":10552,"cudarrr;":10549,"cuepr;":8926,"cuesc;":8927,"cularr;":8630,"cularrp;":10557,"cup;":8746,"cupbrcap;":10824,"cupcap;":10822,"cupcup;":10826,"cupdot;":8845,"cupor;":10821,"cups;":[8746,65024],"curarr;":8631,"curarrm;":10556,"curlyeqprec;":8926,"curlyeqsucc;":8927,"curlyvee;":8910,"curlywedge;":8911,curren:164,"curren;":164,"curvearrowleft;":8630,"curvearrowright;":8631,"cuvee;":8910,"cuwed;":8911,"cwconint;":8754,"cwint;":8753,"cylcty;":9005,"dArr;":8659,"dHar;":10597,"dagger;":8224,"daleth;":8504,"darr;":8595,"dash;":8208,"dashv;":8867,"dbkarow;":10511,"dblac;":733,"dcaron;":271,"dcy;":1076,"dd;":8518,"ddagger;":8225,"ddarr;":8650,"ddotseq;":10871,deg:176,"deg;":176,"delta;":948,"demptyv;":10673,"dfisht;":10623,"dfr;":[55349,56609],"dharl;":8643,"dharr;":8642,"diam;":8900,"diamond;":8900,"diamondsuit;":9830,"diams;":9830,"die;":168,"digamma;":989,"disin;":8946,"div;":247,divide:247,"divide;":247,"divideontimes;":8903,"divonx;":8903,"djcy;":1106,"dlcorn;":8990,"dlcrop;":8973,"dollar;":36,"dopf;":[55349,56661],"dot;":729,"doteq;":8784,"doteqdot;":8785,"dotminus;":8760,"dotplus;":8724,"dotsquare;":8865,"doublebarwedge;":8966,"downarrow;":8595,"downdownarrows;":8650,"downharpoonleft;":8643,"downharpoonright;":8642,"drbkarow;":10512,"drcorn;":8991,"drcrop;":8972,"dscr;":[55349,56505],"dscy;":1109,"dsol;":10742,"dstrok;":273,"dtdot;":8945,"dtri;":9663,"dtrif;":9662,"duarr;":8693,"duhar;":10607,"dwangle;":10662,"dzcy;":1119,"dzigrarr;":10239,"eDDot;":10871,"eDot;":8785,eacute:233,"eacute;":233,"easter;":10862,"ecaron;":283,"ecir;":8790,ecirc:234,"ecirc;":234,"ecolon;":8789,"ecy;":1101,"edot;":279,"ee;":8519,"efDot;":8786,"efr;":[55349,56610],"eg;":10906,egrave:232,"egrave;":232,"egs;":10902,"egsdot;":10904,"el;":10905,"elinters;":9191,"ell;":8467,"els;":10901,"elsdot;":10903,"emacr;":275,"empty;":8709,"emptyset;":8709,"emptyv;":8709,"emsp13;":8196,"emsp14;":8197,"emsp;":8195,"eng;":331,"ensp;":8194,"eogon;":281,"eopf;":[55349,56662],"epar;":8917,"eparsl;":10723,"eplus;":10865,"epsi;":949,"epsilon;":949,"epsiv;":1013,"eqcirc;":8790,"eqcolon;":8789,"eqsim;":8770,"eqslantgtr;":10902,"eqslantless;":10901,"equals;":61,"equest;":8799,"equiv;":8801,"equivDD;":10872,"eqvparsl;":10725,"erDot;":8787,"erarr;":10609,"escr;":8495,"esdot;":8784,"esim;":8770,"eta;":951,eth:240,"eth;":240,euml:235,"euml;":235,"euro;":8364,"excl;":33,"exist;":8707,"expectation;":8496,"exponentiale;":8519,"fallingdotseq;":8786,"fcy;":1092,"female;":9792,"ffilig;":64259,"fflig;":64256,"ffllig;":64260,"ffr;":[55349,56611],"filig;":64257,"fjlig;":[102,106],"flat;":9837,"fllig;":64258,"fltns;":9649,"fnof;":402,"fopf;":[55349,56663],"forall;":8704,"fork;":8916,"forkv;":10969,"fpartint;":10765,frac12:189,"frac12;":189,"frac13;":8531,frac14:188,"frac14;":188,"frac15;":8533,"frac16;":8537,"frac18;":8539,"frac23;":8532,"frac25;":8534,frac34:190,"frac34;":190,"frac35;":8535,"frac38;":8540,"frac45;":8536,"frac56;":8538,"frac58;":8541,"frac78;":8542,"frasl;":8260,"frown;":8994,"fscr;":[55349,56507],"gE;":8807,"gEl;":10892,"gacute;":501,"gamma;":947,"gammad;":989,"gap;":10886,"gbreve;":287,"gcirc;":285,"gcy;":1075,"gdot;":289,"ge;":8805,"gel;":8923,"geq;":8805,"geqq;":8807,"geqslant;":10878,"ges;":10878,"gescc;":10921,"gesdot;":10880,"gesdoto;":10882,"gesdotol;":10884,"gesl;":[8923,65024],"gesles;":10900,"gfr;":[55349,56612],"gg;":8811,"ggg;":8921,"gimel;":8503,"gjcy;":1107,"gl;":8823,"glE;":10898,"gla;":10917,"glj;":10916,"gnE;":8809,"gnap;":10890,"gnapprox;":10890,"gne;":10888,"gneq;":10888,"gneqq;":8809,"gnsim;":8935,"gopf;":[55349,56664],"grave;":96,"gscr;":8458,"gsim;":8819,"gsime;":10894,"gsiml;":10896,gt:62,"gt;":62,"gtcc;":10919,"gtcir;":10874,"gtdot;":8919,"gtlPar;":10645,"gtquest;":10876,"gtrapprox;":10886,"gtrarr;":10616,"gtrdot;":8919,"gtreqless;":8923,"gtreqqless;":10892,"gtrless;":8823,"gtrsim;":8819,"gvertneqq;":[8809,65024],"gvnE;":[8809,65024],"hArr;":8660,"hairsp;":8202,"half;":189,"hamilt;":8459,"hardcy;":1098,"harr;":8596,"harrcir;":10568,"harrw;":8621,"hbar;":8463,"hcirc;":293,"hearts;":9829,"heartsuit;":9829,"hellip;":8230,"hercon;":8889,"hfr;":[55349,56613],"hksearow;":10533,"hkswarow;":10534,"hoarr;":8703,"homtht;":8763,"hookleftarrow;":8617,"hookrightarrow;":8618,"hopf;":[55349,56665],"horbar;":8213,"hscr;":[55349,56509],"hslash;":8463,"hstrok;":295,"hybull;":8259,"hyphen;":8208,iacute:237,"iacute;":237,"ic;":8291,icirc:238,"icirc;":238,"icy;":1080,"iecy;":1077,iexcl:161,"iexcl;":161,"iff;":8660,"ifr;":[55349,56614],igrave:236,"igrave;":236,"ii;":8520,"iiiint;":10764,"iiint;":8749,"iinfin;":10716,"iiota;":8489,"ijlig;":307,"imacr;":299,"image;":8465,"imagline;":8464,"imagpart;":8465,"imath;":305,"imof;":8887,"imped;":437,"in;":8712,"incare;":8453,"infin;":8734,"infintie;":10717,"inodot;":305,"int;":8747,"intcal;":8890,"integers;":8484,"intercal;":8890,"intlarhk;":10775,"intprod;":10812,"iocy;":1105,"iogon;":303,"iopf;":[55349,56666],"iota;":953,"iprod;":10812,iquest:191,"iquest;":191,"iscr;":[55349,56510],"isin;":8712,"isinE;":8953,"isindot;":8949,"isins;":8948,"isinsv;":8947,"isinv;":8712,"it;":8290,"itilde;":297,"iukcy;":1110,iuml:239,"iuml;":239,"jcirc;":309,"jcy;":1081,"jfr;":[55349,56615],"jmath;":567,"jopf;":[55349,56667],"jscr;":[55349,56511],"jsercy;":1112,"jukcy;":1108,"kappa;":954,"kappav;":1008,"kcedil;":311,"kcy;":1082,"kfr;":[55349,56616],"kgreen;":312,"khcy;":1093,"kjcy;":1116,"kopf;":[55349,56668],"kscr;":[55349,56512],"lAarr;":8666,"lArr;":8656,"lAtail;":10523,"lBarr;":10510,"lE;":8806,"lEg;":10891,"lHar;":10594,"lacute;":314,"laemptyv;":10676,"lagran;":8466,"lambda;":955,"lang;":10216,"langd;":10641,"langle;":10216,"lap;":10885,laquo:171,"laquo;":171,"larr;":8592,"larrb;":8676,"larrbfs;":10527,"larrfs;":10525,"larrhk;":8617,"larrlp;":8619,"larrpl;":10553,"larrsim;":10611,"larrtl;":8610,"lat;":10923,"latail;":10521,"late;":10925,"lates;":[10925,65024],"lbarr;":10508,"lbbrk;":10098,"lbrace;":123,"lbrack;":91,"lbrke;":10635,"lbrksld;":10639,"lbrkslu;":10637,"lcaron;":318,"lcedil;":316,"lceil;":8968,"lcub;":123,"lcy;":1083,"ldca;":10550,"ldquo;":8220,"ldquor;":8222,"ldrdhar;":10599,"ldrushar;":10571,"ldsh;":8626,"le;":8804,"leftarrow;":8592,"leftarrowtail;":8610,"leftharpoondown;":8637,"leftharpoonup;":8636,"leftleftarrows;":8647,"leftrightarrow;":8596,"leftrightarrows;":8646,"leftrightharpoons;":8651,"leftrightsquigarrow;":8621,"leftthreetimes;":8907,"leg;":8922,"leq;":8804,"leqq;":8806,"leqslant;":10877,"les;":10877,"lescc;":10920,"lesdot;":10879,"lesdoto;":10881,"lesdotor;":10883,"lesg;":[8922,65024],"lesges;":10899,"lessapprox;":10885,"lessdot;":8918,"lesseqgtr;":8922,"lesseqqgtr;":10891,"lessgtr;":8822,"lesssim;":8818,"lfisht;":10620,"lfloor;":8970,"lfr;":[55349,56617],"lg;":8822,"lgE;":10897,"lhard;":8637,"lharu;":8636,"lharul;":10602,"lhblk;":9604,"ljcy;":1113,"ll;":8810,"llarr;":8647,"llcorner;":8990,"llhard;":10603,"lltri;":9722,"lmidot;":320,"lmoust;":9136,"lmoustache;":9136,"lnE;":8808,"lnap;":10889,"lnapprox;":10889,"lne;":10887,"lneq;":10887,"lneqq;":8808,"lnsim;":8934,"loang;":10220,"loarr;":8701,"lobrk;":10214,"longleftarrow;":10229,"longleftrightarrow;":10231,"longmapsto;":10236,"longrightarrow;":10230,"looparrowleft;":8619,"looparrowright;":8620,"lopar;":10629,"lopf;":[55349,56669],"loplus;":10797,"lotimes;":10804,"lowast;":8727,"lowbar;":95,"loz;":9674,"lozenge;":9674,"lozf;":10731,"lpar;":40,"lparlt;":10643,"lrarr;":8646,"lrcorner;":8991,"lrhar;":8651,"lrhard;":10605,"lrm;":8206,"lrtri;":8895,"lsaquo;":8249,"lscr;":[55349,56513],"lsh;":8624,"lsim;":8818,"lsime;":10893,"lsimg;":10895,"lsqb;":91,"lsquo;":8216,"lsquor;":8218,"lstrok;":322,lt:60,"lt;":60,"ltcc;":10918,"ltcir;":10873,"ltdot;":8918,"lthree;":8907,"ltimes;":8905,"ltlarr;":10614,"ltquest;":10875,"ltrPar;":10646,"ltri;":9667,"ltrie;":8884,"ltrif;":9666,"lurdshar;":10570,"luruhar;":10598,"lvertneqq;":[8808,65024],"lvnE;":[8808,65024],"mDDot;":8762,macr:175,"macr;":175,"male;":9794,"malt;":10016,"maltese;":10016,"map;":8614,"mapsto;":8614,"mapstodown;":8615,"mapstoleft;":8612,"mapstoup;":8613,"marker;":9646,"mcomma;":10793,"mcy;":1084,"mdash;":8212,"measuredangle;":8737,"mfr;":[55349,56618],"mho;":8487,micro:181,"micro;":181,"mid;":8739,"midast;":42,"midcir;":10992,middot:183,"middot;":183,"minus;":8722,"minusb;":8863,"minusd;":8760,"minusdu;":10794,"mlcp;":10971,"mldr;":8230,"mnplus;":8723,"models;":8871,"mopf;":[55349,56670],"mp;":8723,"mscr;":[55349,56514],"mstpos;":8766,"mu;":956,"multimap;":8888,"mumap;":8888,"nGg;":[8921,824],"nGt;":[8811,8402],"nGtv;":[8811,824],"nLeftarrow;":8653,"nLeftrightarrow;":8654,"nLl;":[8920,824],"nLt;":[8810,8402],"nLtv;":[8810,824],"nRightarrow;":8655,"nVDash;":8879,"nVdash;":8878,"nabla;":8711,"nacute;":324,"nang;":[8736,8402],"nap;":8777,"napE;":[10864,824],"napid;":[8779,824],"napos;":329,"napprox;":8777,"natur;":9838,"natural;":9838,"naturals;":8469,nbsp:160,"nbsp;":160,"nbump;":[8782,824],"nbumpe;":[8783,824],"ncap;":10819,"ncaron;":328,"ncedil;":326,"ncong;":8775,"ncongdot;":[10861,824],"ncup;":10818,"ncy;":1085,"ndash;":8211,"ne;":8800,"neArr;":8663,"nearhk;":10532,"nearr;":8599,"nearrow;":8599,"nedot;":[8784,824],"nequiv;":8802,"nesear;":10536,"nesim;":[8770,824],"nexist;":8708,"nexists;":8708,"nfr;":[55349,56619],"ngE;":[8807,824],"nge;":8817,"ngeq;":8817,"ngeqq;":[8807,824],"ngeqslant;":[10878,824],"nges;":[10878,824],"ngsim;":8821,"ngt;":8815,"ngtr;":8815,"nhArr;":8654,"nharr;":8622,"nhpar;":10994,"ni;":8715,"nis;":8956,"nisd;":8954,"niv;":8715,"njcy;":1114,"nlArr;":8653,"nlE;":[8806,824],"nlarr;":8602,"nldr;":8229,"nle;":8816,"nleftarrow;":8602,"nleftrightarrow;":8622,"nleq;":8816,"nleqq;":[8806,824],"nleqslant;":[10877,824],"nles;":[10877,824],"nless;":8814,"nlsim;":8820,"nlt;":8814,"nltri;":8938,"nltrie;":8940,"nmid;":8740,"nopf;":[55349,56671],not:172,"not;":172,"notin;":8713,"notinE;":[8953,824],"notindot;":[8949,824],"notinva;":8713,"notinvb;":8951,"notinvc;":8950,"notni;":8716,"notniva;":8716,"notnivb;":8958,"notnivc;":8957,"npar;":8742,"nparallel;":8742,"nparsl;":[11005,8421],"npart;":[8706,824],"npolint;":10772,"npr;":8832,"nprcue;":8928,"npre;":[10927,824],"nprec;":8832,"npreceq;":[10927,824],"nrArr;":8655,"nrarr;":8603,"nrarrc;":[10547,824],"nrarrw;":[8605,824],"nrightarrow;":8603,"nrtri;":8939,"nrtrie;":8941,"nsc;":8833,"nsccue;":8929,"nsce;":[10928,824],"nscr;":[55349,56515],"nshortmid;":8740,"nshortparallel;":8742,"nsim;":8769,"nsime;":8772,"nsimeq;":8772,"nsmid;":8740,"nspar;":8742,"nsqsube;":8930,"nsqsupe;":8931,"nsub;":8836,"nsubE;":[10949,824],"nsube;":8840,"nsubset;":[8834,8402],"nsubseteq;":8840,"nsubseteqq;":[10949,824],"nsucc;":8833,"nsucceq;":[10928,824],"nsup;":8837,"nsupE;":[10950,824],"nsupe;":8841,"nsupset;":[8835,8402],"nsupseteq;":8841,"nsupseteqq;":[10950,824],"ntgl;":8825,ntilde:241,"ntilde;":241,"ntlg;":8824,"ntriangleleft;":8938,"ntrianglelefteq;":8940,"ntriangleright;":8939,"ntrianglerighteq;":8941,"nu;":957,"num;":35,"numero;":8470,"numsp;":8199,"nvDash;":8877,"nvHarr;":10500,"nvap;":[8781,8402],"nvdash;":8876,"nvge;":[8805,8402],"nvgt;":[62,8402],"nvinfin;":10718,"nvlArr;":10498,"nvle;":[8804,8402],"nvlt;":[60,8402],"nvltrie;":[8884,8402],"nvrArr;":10499,"nvrtrie;":[8885,8402],"nvsim;":[8764,8402],"nwArr;":8662,"nwarhk;":10531,"nwarr;":8598,"nwarrow;":8598,"nwnear;":10535,"oS;":9416,oacute:243,"oacute;":243,"oast;":8859,"ocir;":8858,ocirc:244,"ocirc;":244,"ocy;":1086,"odash;":8861,"odblac;":337,"odiv;":10808,"odot;":8857,"odsold;":10684,"oelig;":339,"ofcir;":10687,"ofr;":[55349,56620],"ogon;":731,ograve:242,"ograve;":242,"ogt;":10689,"ohbar;":10677,"ohm;":937,"oint;":8750,"olarr;":8634,"olcir;":10686,"olcross;":10683,"oline;":8254,"olt;":10688,"omacr;":333,"omega;":969,"omicron;":959,"omid;":10678,"ominus;":8854,"oopf;":[55349,56672],"opar;":10679,"operp;":10681,"oplus;":8853,"or;":8744,"orarr;":8635,"ord;":10845,"order;":8500,"orderof;":8500,ordf:170,"ordf;":170,ordm:186,"ordm;":186,"origof;":8886,"oror;":10838,"orslope;":10839,"orv;":10843,"oscr;":8500,oslash:248,"oslash;":248,"osol;":8856,otilde:245,"otilde;":245,"otimes;":8855,"otimesas;":10806,ouml:246,"ouml;":246,"ovbar;":9021,"par;":8741,para:182,"para;":182,"parallel;":8741,"parsim;":10995,"parsl;":11005,"part;":8706,"pcy;":1087,"percnt;":37,"period;":46,"permil;":8240,"perp;":8869,"pertenk;":8241,"pfr;":[55349,56621],"phi;":966,"phiv;":981,"phmmat;":8499,"phone;":9742,"pi;":960,"pitchfork;":8916,"piv;":982,"planck;":8463,"planckh;":8462,"plankv;":8463,"plus;":43,"plusacir;":10787,"plusb;":8862,"pluscir;":10786,"plusdo;":8724,"plusdu;":10789,"pluse;":10866,plusmn:177,"plusmn;":177,"plussim;":10790,"plustwo;":10791,"pm;":177,"pointint;":10773,"popf;":[55349,56673],pound:163,"pound;":163,"pr;":8826,"prE;":10931,"prap;":10935,"prcue;":8828,"pre;":10927,"prec;":8826,"precapprox;":10935,"preccurlyeq;":8828,"preceq;":10927,"precnapprox;":10937,"precneqq;":10933,"precnsim;":8936,"precsim;":8830,"prime;":8242,"primes;":8473,"prnE;":10933,"prnap;":10937,"prnsim;":8936,"prod;":8719,"profalar;":9006,"profline;":8978,"profsurf;":8979,"prop;":8733,"propto;":8733,"prsim;":8830,"prurel;":8880,"pscr;":[55349,56517],"psi;":968,"puncsp;":8200,"qfr;":[55349,56622],"qint;":10764,"qopf;":[55349,56674],"qprime;":8279,"qscr;":[55349,56518],"quaternions;":8461,"quatint;":10774,"quest;":63,"questeq;":8799,quot:34,"quot;":34,"rAarr;":8667,"rArr;":8658,"rAtail;":10524,"rBarr;":10511,"rHar;":10596,"race;":[8765,817],"racute;":341,"radic;":8730,"raemptyv;":10675,"rang;":10217,"rangd;":10642,"range;":10661,"rangle;":10217,raquo:187,"raquo;":187,"rarr;":8594,"rarrap;":10613,"rarrb;":8677,"rarrbfs;":10528,"rarrc;":10547,"rarrfs;":10526,"rarrhk;":8618,"rarrlp;":8620,"rarrpl;":10565,"rarrsim;":10612,"rarrtl;":8611,"rarrw;":8605,"ratail;":10522,"ratio;":8758,"rationals;":8474,"rbarr;":10509,"rbbrk;":10099,"rbrace;":125,"rbrack;":93,"rbrke;":10636,"rbrksld;":10638,"rbrkslu;":10640,"rcaron;":345,"rcedil;":343,"rceil;":8969,"rcub;":125,"rcy;":1088,"rdca;":10551,"rdldhar;":10601,"rdquo;":8221,"rdquor;":8221,"rdsh;":8627,"real;":8476,"realine;":8475,"realpart;":8476,"reals;":8477,"rect;":9645,reg:174,"reg;":174,"rfisht;":10621,"rfloor;":8971,"rfr;":[55349,56623],"rhard;":8641,"rharu;":8640,"rharul;":10604,"rho;":961,"rhov;":1009,"rightarrow;":8594,"rightarrowtail;":8611,"rightharpoondown;":8641,"rightharpoonup;":8640,"rightleftarrows;":8644,"rightleftharpoons;":8652,"rightrightarrows;":8649,"rightsquigarrow;":8605,"rightthreetimes;":8908,"ring;":730,"risingdotseq;":8787,"rlarr;":8644,"rlhar;":8652,"rlm;":8207,"rmoust;":9137,"rmoustache;":9137,"rnmid;":10990,"roang;":10221,"roarr;":8702,"robrk;":10215,"ropar;":10630,"ropf;":[55349,56675],"roplus;":10798,"rotimes;":10805,"rpar;":41,"rpargt;":10644,"rppolint;":10770,"rrarr;":8649,"rsaquo;":8250,"rscr;":[55349,56519],"rsh;":8625,"rsqb;":93,"rsquo;":8217,"rsquor;":8217,"rthree;":8908,"rtimes;":8906,"rtri;":9657,"rtrie;":8885,"rtrif;":9656,"rtriltri;":10702,"ruluhar;":10600,"rx;":8478,"sacute;":347,"sbquo;":8218,"sc;":8827,"scE;":10932,"scap;":10936,"scaron;":353,"sccue;":8829,"sce;":10928,"scedil;":351,"scirc;":349,"scnE;":10934,"scnap;":10938,"scnsim;":8937,"scpolint;":10771,"scsim;":8831,"scy;":1089,"sdot;":8901,"sdotb;":8865,"sdote;":10854,"seArr;":8664,"searhk;":10533,"searr;":8600,"searrow;":8600,sect:167,"sect;":167,"semi;":59,"seswar;":10537,"setminus;":8726,"setmn;":8726,"sext;":10038,"sfr;":[55349,56624],"sfrown;":8994,"sharp;":9839,"shchcy;":1097,"shcy;":1096,"shortmid;":8739,"shortparallel;":8741,shy:173,"shy;":173,"sigma;":963,"sigmaf;":962,"sigmav;":962,"sim;":8764,"simdot;":10858,"sime;":8771,"simeq;":8771,"simg;":10910,"simgE;":10912,"siml;":10909,"simlE;":10911,"simne;":8774,"simplus;":10788,"simrarr;":10610,"slarr;":8592,"smallsetminus;":8726,"smashp;":10803,"smeparsl;":10724,"smid;":8739,"smile;":8995,"smt;":10922,"smte;":10924,"smtes;":[10924,65024],"softcy;":1100,"sol;":47,"solb;":10692,"solbar;":9023,"sopf;":[55349,56676],"spades;":9824,"spadesuit;":9824,"spar;":8741,"sqcap;":8851,"sqcaps;":[8851,65024],"sqcup;":8852,"sqcups;":[8852,65024],"sqsub;":8847,"sqsube;":8849,"sqsubset;":8847,"sqsubseteq;":8849,"sqsup;":8848,"sqsupe;":8850,"sqsupset;":8848,"sqsupseteq;":8850,"squ;":9633,"square;":9633,"squarf;":9642,"squf;":9642,"srarr;":8594,"sscr;":[55349,56520],"ssetmn;":8726,"ssmile;":8995,"sstarf;":8902,"star;":9734,"starf;":9733,"straightepsilon;":1013,"straightphi;":981,"strns;":175,"sub;":8834,"subE;":10949,"subdot;":10941,"sube;":8838,"subedot;":10947,"submult;":10945,"subnE;":10955,"subne;":8842,"subplus;":10943,"subrarr;":10617,"subset;":8834,"subseteq;":8838,"subseteqq;":10949,"subsetneq;":8842,"subsetneqq;":10955,"subsim;":10951,"subsub;":10965,"subsup;":10963,"succ;":8827,"succapprox;":10936,"succcurlyeq;":8829,"succeq;":10928,"succnapprox;":10938,"succneqq;":10934,"succnsim;":8937,"succsim;":8831,"sum;":8721,"sung;":9834,sup1:185,"sup1;":185,sup2:178,"sup2;":178,sup3:179,"sup3;":179,"sup;":8835,"supE;":10950,"supdot;":10942,"supdsub;":10968,"supe;":8839,"supedot;":10948,"suphsol;":10185,"suphsub;":10967,"suplarr;":10619,"supmult;":10946,"supnE;":10956,"supne;":8843,"supplus;":10944,"supset;":8835,"supseteq;":8839,"supseteqq;":10950,"supsetneq;":8843,"supsetneqq;":10956,"supsim;":10952,"supsub;":10964,"supsup;":10966,"swArr;":8665,"swarhk;":10534,"swarr;":8601,"swarrow;":8601,"swnwar;":10538,szlig:223,"szlig;":223,"target;":8982,"tau;":964,"tbrk;":9140,"tcaron;":357,"tcedil;":355,"tcy;":1090,"tdot;":8411,"telrec;":8981,"tfr;":[55349,56625],"there4;":8756,"therefore;":8756,"theta;":952,"thetasym;":977,"thetav;":977,"thickapprox;":8776,"thicksim;":8764,"thinsp;":8201,"thkap;":8776,"thksim;":8764,thorn:254,"thorn;":254,"tilde;":732,times:215,"times;":215,"timesb;":8864,"timesbar;":10801,"timesd;":10800,"tint;":8749,"toea;":10536,"top;":8868,"topbot;":9014,"topcir;":10993,"topf;":[55349,56677],"topfork;":10970,"tosa;":10537,"tprime;":8244,"trade;":8482,"triangle;":9653,"triangledown;":9663,"triangleleft;":9667,"trianglelefteq;":8884,"triangleq;":8796,"triangleright;":9657,"trianglerighteq;":8885,"tridot;":9708,"trie;":8796,"triminus;":10810,"triplus;":10809,"trisb;":10701,"tritime;":10811,"trpezium;":9186,"tscr;":[55349,56521],"tscy;":1094,"tshcy;":1115,"tstrok;":359,"twixt;":8812,"twoheadleftarrow;":8606,"twoheadrightarrow;":8608,"uArr;":8657,"uHar;":10595,uacute:250,"uacute;":250,"uarr;":8593,"ubrcy;":1118,"ubreve;":365,ucirc:251,"ucirc;":251,"ucy;":1091,"udarr;":8645,"udblac;":369,"udhar;":10606,"ufisht;":10622,"ufr;":[55349,56626],ugrave:249,"ugrave;":249,"uharl;":8639,"uharr;":8638,"uhblk;":9600,"ulcorn;":8988,"ulcorner;":8988,"ulcrop;":8975,"ultri;":9720,"umacr;":363,uml:168,"uml;":168,"uogon;":371,"uopf;":[55349,56678],"uparrow;":8593,"updownarrow;":8597,"upharpoonleft;":8639,"upharpoonright;":8638,"uplus;":8846,"upsi;":965,"upsih;":978,"upsilon;":965,"upuparrows;":8648,"urcorn;":8989,"urcorner;":8989,"urcrop;":8974,"uring;":367,"urtri;":9721,"uscr;":[55349,56522],"utdot;":8944,"utilde;":361,"utri;":9653,"utrif;":9652,"uuarr;":8648,uuml:252,"uuml;":252,"uwangle;":10663,"vArr;":8661,"vBar;":10984,"vBarv;":10985,"vDash;":8872,"vangrt;":10652,"varepsilon;":1013,"varkappa;":1008,"varnothing;":8709,"varphi;":981,"varpi;":982,"varpropto;":8733,"varr;":8597,"varrho;":1009,"varsigma;":962,"varsubsetneq;":[8842,65024],"varsubsetneqq;":[10955,65024],"varsupsetneq;":[8843,65024],"varsupsetneqq;":[10956,65024],"vartheta;":977,"vartriangleleft;":8882,"vartriangleright;":8883,"vcy;":1074,"vdash;":8866,"vee;":8744,"veebar;":8891,"veeeq;":8794,"vellip;":8942,"verbar;":124,"vert;":124,"vfr;":[55349,56627],"vltri;":8882,"vnsub;":[8834,8402],"vnsup;":[8835,8402],"vopf;":[55349,56679],"vprop;":8733,"vrtri;":8883,"vscr;":[55349,56523],"vsubnE;":[10955,65024],"vsubne;":[8842,65024],"vsupnE;":[10956,65024],"vsupne;":[8843,65024],"vzigzag;":10650,"wcirc;":373,"wedbar;":10847,"wedge;":8743,"wedgeq;":8793,"weierp;":8472,"wfr;":[55349,56628],"wopf;":[55349,56680],"wp;":8472,"wr;":8768,"wreath;":8768,"wscr;":[55349,56524],"xcap;":8898,"xcirc;":9711,"xcup;":8899,"xdtri;":9661,"xfr;":[55349,56629],"xhArr;":10234,"xharr;":10231,"xi;":958,"xlArr;":10232,"xlarr;":10229,"xmap;":10236,"xnis;":8955,"xodot;":10752,"xopf;":[55349,56681],"xoplus;":10753,"xotime;":10754,"xrArr;":10233,"xrarr;":10230,"xscr;":[55349,56525],"xsqcup;":10758,"xuplus;":10756,"xutri;":9651,"xvee;":8897,"xwedge;":8896,yacute:253,"yacute;":253,"yacy;":1103,"ycirc;":375,"ycy;":1099,yen:165,"yen;":165,"yfr;":[55349,56630],"yicy;":1111,"yopf;":[55349,56682],"yscr;":[55349,56526],"yucy;":1102,yuml:255,"yuml;":255,"zacute;":378,"zcaron;":382,"zcy;":1079,"zdot;":380,"zeetrf;":8488,"zeta;":950,"zfr;":[55349,56631],"zhcy;":1078,"zigrarr;":8669,"zopf;":[55349,56683],"zscr;":[55349,56527],"zwj;":8205,"zwnj;":8204},dx=/(A(?:Elig;?|MP;?|acute;?|breve;|c(?:irc;?|y;)|fr;|grave;?|lpha;|macr;|nd;|o(?:gon;|pf;)|pplyFunction;|ring;?|s(?:cr;|sign;)|tilde;?|uml;?)|B(?:a(?:ckslash;|r(?:v;|wed;))|cy;|e(?:cause;|rnoullis;|ta;)|fr;|opf;|reve;|scr;|umpeq;)|C(?:Hcy;|OPY;?|a(?:cute;|p(?:;|italDifferentialD;)|yleys;)|c(?:aron;|edil;?|irc;|onint;)|dot;|e(?:dilla;|nterDot;)|fr;|hi;|ircle(?:Dot;|Minus;|Plus;|Times;)|lo(?:ckwiseContourIntegral;|seCurly(?:DoubleQuote;|Quote;))|o(?:lon(?:;|e;)|n(?:gruent;|int;|tourIntegral;)|p(?:f;|roduct;)|unterClockwiseContourIntegral;)|ross;|scr;|up(?:;|Cap;))|D(?:D(?:;|otrahd;)|Jcy;|Scy;|Zcy;|a(?:gger;|rr;|shv;)|c(?:aron;|y;)|el(?:;|ta;)|fr;|i(?:a(?:critical(?:Acute;|Do(?:t;|ubleAcute;)|Grave;|Tilde;)|mond;)|fferentialD;)|o(?:pf;|t(?:;|Dot;|Equal;)|uble(?:ContourIntegral;|Do(?:t;|wnArrow;)|L(?:eft(?:Arrow;|RightArrow;|Tee;)|ong(?:Left(?:Arrow;|RightArrow;)|RightArrow;))|Right(?:Arrow;|Tee;)|Up(?:Arrow;|DownArrow;)|VerticalBar;)|wn(?:Arrow(?:;|Bar;|UpArrow;)|Breve;|Left(?:RightVector;|TeeVector;|Vector(?:;|Bar;))|Right(?:TeeVector;|Vector(?:;|Bar;))|Tee(?:;|Arrow;)|arrow;))|s(?:cr;|trok;))|E(?:NG;|TH;?|acute;?|c(?:aron;|irc;?|y;)|dot;|fr;|grave;?|lement;|m(?:acr;|pty(?:SmallSquare;|VerySmallSquare;))|o(?:gon;|pf;)|psilon;|qu(?:al(?:;|Tilde;)|ilibrium;)|s(?:cr;|im;)|ta;|uml;?|x(?:ists;|ponentialE;))|F(?:cy;|fr;|illed(?:SmallSquare;|VerySmallSquare;)|o(?:pf;|rAll;|uriertrf;)|scr;)|G(?:Jcy;|T;?|amma(?:;|d;)|breve;|c(?:edil;|irc;|y;)|dot;|fr;|g;|opf;|reater(?:Equal(?:;|Less;)|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|scr;|t;)|H(?:ARDcy;|a(?:cek;|t;)|circ;|fr;|ilbertSpace;|o(?:pf;|rizontalLine;)|s(?:cr;|trok;)|ump(?:DownHump;|Equal;))|I(?:Ecy;|Jlig;|Ocy;|acute;?|c(?:irc;?|y;)|dot;|fr;|grave;?|m(?:;|a(?:cr;|ginaryI;)|plies;)|n(?:t(?:;|e(?:gral;|rsection;))|visible(?:Comma;|Times;))|o(?:gon;|pf;|ta;)|scr;|tilde;|u(?:kcy;|ml;?))|J(?:c(?:irc;|y;)|fr;|opf;|s(?:cr;|ercy;)|ukcy;)|K(?:Hcy;|Jcy;|appa;|c(?:edil;|y;)|fr;|opf;|scr;)|L(?:Jcy;|T;?|a(?:cute;|mbda;|ng;|placetrf;|rr;)|c(?:aron;|edil;|y;)|e(?:ft(?:A(?:ngleBracket;|rrow(?:;|Bar;|RightArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|Right(?:Arrow;|Vector;)|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;|rightarrow;)|ss(?:EqualGreater;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;))|fr;|l(?:;|eftarrow;)|midot;|o(?:ng(?:Left(?:Arrow;|RightArrow;)|RightArrow;|left(?:arrow;|rightarrow;)|rightarrow;)|pf;|wer(?:LeftArrow;|RightArrow;))|s(?:cr;|h;|trok;)|t;)|M(?:ap;|cy;|e(?:diumSpace;|llintrf;)|fr;|inusPlus;|opf;|scr;|u;)|N(?:Jcy;|acute;|c(?:aron;|edil;|y;)|e(?:gative(?:MediumSpace;|Thi(?:ckSpace;|nSpace;)|VeryThinSpace;)|sted(?:GreaterGreater;|LessLess;)|wLine;)|fr;|o(?:Break;|nBreakingSpace;|pf;|t(?:;|C(?:ongruent;|upCap;)|DoubleVerticalBar;|E(?:lement;|qual(?:;|Tilde;)|xists;)|Greater(?:;|Equal;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|Hump(?:DownHump;|Equal;)|Le(?:ftTriangle(?:;|Bar;|Equal;)|ss(?:;|Equal;|Greater;|Less;|SlantEqual;|Tilde;))|Nested(?:GreaterGreater;|LessLess;)|Precedes(?:;|Equal;|SlantEqual;)|R(?:everseElement;|ightTriangle(?:;|Bar;|Equal;))|S(?:quareSu(?:bset(?:;|Equal;)|perset(?:;|Equal;))|u(?:bset(?:;|Equal;)|cceeds(?:;|Equal;|SlantEqual;|Tilde;)|perset(?:;|Equal;)))|Tilde(?:;|Equal;|FullEqual;|Tilde;)|VerticalBar;))|scr;|tilde;?|u;)|O(?:Elig;|acute;?|c(?:irc;?|y;)|dblac;|fr;|grave;?|m(?:acr;|ega;|icron;)|opf;|penCurly(?:DoubleQuote;|Quote;)|r;|s(?:cr;|lash;?)|ti(?:lde;?|mes;)|uml;?|ver(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;))|P(?:artialD;|cy;|fr;|hi;|i;|lusMinus;|o(?:incareplane;|pf;)|r(?:;|ecedes(?:;|Equal;|SlantEqual;|Tilde;)|ime;|o(?:duct;|portion(?:;|al;)))|s(?:cr;|i;))|Q(?:UOT;?|fr;|opf;|scr;)|R(?:Barr;|EG;?|a(?:cute;|ng;|rr(?:;|tl;))|c(?:aron;|edil;|y;)|e(?:;|verse(?:E(?:lement;|quilibrium;)|UpEquilibrium;))|fr;|ho;|ight(?:A(?:ngleBracket;|rrow(?:;|Bar;|LeftArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;)|o(?:pf;|undImplies;)|rightarrow;|s(?:cr;|h;)|uleDelayed;)|S(?:H(?:CHcy;|cy;)|OFTcy;|acute;|c(?:;|aron;|edil;|irc;|y;)|fr;|hort(?:DownArrow;|LeftArrow;|RightArrow;|UpArrow;)|igma;|mallCircle;|opf;|q(?:rt;|uare(?:;|Intersection;|Su(?:bset(?:;|Equal;)|perset(?:;|Equal;))|Union;))|scr;|tar;|u(?:b(?:;|set(?:;|Equal;))|c(?:ceeds(?:;|Equal;|SlantEqual;|Tilde;)|hThat;)|m;|p(?:;|erset(?:;|Equal;)|set;)))|T(?:HORN;?|RADE;|S(?:Hcy;|cy;)|a(?:b;|u;)|c(?:aron;|edil;|y;)|fr;|h(?:e(?:refore;|ta;)|i(?:ckSpace;|nSpace;))|ilde(?:;|Equal;|FullEqual;|Tilde;)|opf;|ripleDot;|s(?:cr;|trok;))|U(?:a(?:cute;?|rr(?:;|ocir;))|br(?:cy;|eve;)|c(?:irc;?|y;)|dblac;|fr;|grave;?|macr;|n(?:der(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;)|ion(?:;|Plus;))|o(?:gon;|pf;)|p(?:Arrow(?:;|Bar;|DownArrow;)|DownArrow;|Equilibrium;|Tee(?:;|Arrow;)|arrow;|downarrow;|per(?:LeftArrow;|RightArrow;)|si(?:;|lon;))|ring;|scr;|tilde;|uml;?)|V(?:Dash;|bar;|cy;|dash(?:;|l;)|e(?:e;|r(?:bar;|t(?:;|ical(?:Bar;|Line;|Separator;|Tilde;))|yThinSpace;))|fr;|opf;|scr;|vdash;)|W(?:circ;|edge;|fr;|opf;|scr;)|X(?:fr;|i;|opf;|scr;)|Y(?:Acy;|Icy;|Ucy;|acute;?|c(?:irc;|y;)|fr;|opf;|scr;|uml;)|Z(?:Hcy;|acute;|c(?:aron;|y;)|dot;|e(?:roWidthSpace;|ta;)|fr;|opf;|scr;)|a(?:acute;?|breve;|c(?:;|E;|d;|irc;?|ute;?|y;)|elig;?|f(?:;|r;)|grave;?|l(?:e(?:fsym;|ph;)|pha;)|m(?:a(?:cr;|lg;)|p;?)|n(?:d(?:;|and;|d;|slope;|v;)|g(?:;|e;|le;|msd(?:;|a(?:a;|b;|c;|d;|e;|f;|g;|h;))|rt(?:;|vb(?:;|d;))|s(?:ph;|t;)|zarr;))|o(?:gon;|pf;)|p(?:;|E;|acir;|e;|id;|os;|prox(?:;|eq;))|ring;?|s(?:cr;|t;|ymp(?:;|eq;))|tilde;?|uml;?|w(?:conint;|int;))|b(?:Not;|a(?:ck(?:cong;|epsilon;|prime;|sim(?:;|eq;))|r(?:vee;|wed(?:;|ge;)))|brk(?:;|tbrk;)|c(?:ong;|y;)|dquo;|e(?:caus(?:;|e;)|mptyv;|psi;|rnou;|t(?:a;|h;|ween;))|fr;|ig(?:c(?:ap;|irc;|up;)|o(?:dot;|plus;|times;)|s(?:qcup;|tar;)|triangle(?:down;|up;)|uplus;|vee;|wedge;)|karow;|l(?:a(?:ck(?:lozenge;|square;|triangle(?:;|down;|left;|right;))|nk;)|k(?:1(?:2;|4;)|34;)|ock;)|n(?:e(?:;|quiv;)|ot;)|o(?:pf;|t(?:;|tom;)|wtie;|x(?:D(?:L;|R;|l;|r;)|H(?:;|D;|U;|d;|u;)|U(?:L;|R;|l;|r;)|V(?:;|H;|L;|R;|h;|l;|r;)|box;|d(?:L;|R;|l;|r;)|h(?:;|D;|U;|d;|u;)|minus;|plus;|times;|u(?:L;|R;|l;|r;)|v(?:;|H;|L;|R;|h;|l;|r;)))|prime;|r(?:eve;|vbar;?)|s(?:cr;|emi;|im(?:;|e;)|ol(?:;|b;|hsub;))|u(?:ll(?:;|et;)|mp(?:;|E;|e(?:;|q;))))|c(?:a(?:cute;|p(?:;|and;|brcup;|c(?:ap;|up;)|dot;|s;)|r(?:et;|on;))|c(?:a(?:ps;|ron;)|edil;?|irc;|ups(?:;|sm;))|dot;|e(?:dil;?|mptyv;|nt(?:;|erdot;|))|fr;|h(?:cy;|eck(?:;|mark;)|i;)|ir(?:;|E;|c(?:;|eq;|le(?:arrow(?:left;|right;)|d(?:R;|S;|ast;|circ;|dash;)))|e;|fnint;|mid;|scir;)|lubs(?:;|uit;)|o(?:lon(?:;|e(?:;|q;))|m(?:ma(?:;|t;)|p(?:;|fn;|le(?:ment;|xes;)))|n(?:g(?:;|dot;)|int;)|p(?:f;|rod;|y(?:;|sr;|)))|r(?:arr;|oss;)|s(?:cr;|u(?:b(?:;|e;)|p(?:;|e;)))|tdot;|u(?:darr(?:l;|r;)|e(?:pr;|sc;)|larr(?:;|p;)|p(?:;|brcap;|c(?:ap;|up;)|dot;|or;|s;)|r(?:arr(?:;|m;)|ly(?:eq(?:prec;|succ;)|vee;|wedge;)|ren;?|vearrow(?:left;|right;))|vee;|wed;)|w(?:conint;|int;)|ylcty;)|d(?:Arr;|Har;|a(?:gger;|leth;|rr;|sh(?:;|v;))|b(?:karow;|lac;)|c(?:aron;|y;)|d(?:;|a(?:gger;|rr;)|otseq;)|e(?:g;?|lta;|mptyv;)|f(?:isht;|r;)|har(?:l;|r;)|i(?:am(?:;|ond(?:;|suit;)|s;)|e;|gamma;|sin;|v(?:;|ide(?:;|ontimes;|)|onx;))|jcy;|lc(?:orn;|rop;)|o(?:llar;|pf;|t(?:;|eq(?:;|dot;)|minus;|plus;|square;)|ublebarwedge;|wn(?:arrow;|downarrows;|harpoon(?:left;|right;)))|r(?:bkarow;|c(?:orn;|rop;))|s(?:c(?:r;|y;)|ol;|trok;)|t(?:dot;|ri(?:;|f;))|u(?:arr;|har;)|wangle;|z(?:cy;|igrarr;))|e(?:D(?:Dot;|ot;)|a(?:cute;?|ster;)|c(?:aron;|ir(?:;|c;?)|olon;|y;)|dot;|e;|f(?:Dot;|r;)|g(?:;|rave;?|s(?:;|dot;))|l(?:;|inters;|l;|s(?:;|dot;))|m(?:acr;|pty(?:;|set;|v;)|sp(?:1(?:3;|4;)|;))|n(?:g;|sp;)|o(?:gon;|pf;)|p(?:ar(?:;|sl;)|lus;|si(?:;|lon;|v;))|q(?:c(?:irc;|olon;)|s(?:im;|lant(?:gtr;|less;))|u(?:als;|est;|iv(?:;|DD;))|vparsl;)|r(?:Dot;|arr;)|s(?:cr;|dot;|im;)|t(?:a;|h;?)|u(?:ml;?|ro;)|x(?:cl;|ist;|p(?:ectation;|onentiale;)))|f(?:allingdotseq;|cy;|emale;|f(?:ilig;|l(?:ig;|lig;)|r;)|ilig;|jlig;|l(?:at;|lig;|tns;)|nof;|o(?:pf;|r(?:all;|k(?:;|v;)))|partint;|r(?:a(?:c(?:1(?:2;?|3;|4;?|5;|6;|8;)|2(?:3;|5;)|3(?:4;?|5;|8;)|45;|5(?:6;|8;)|78;)|sl;)|own;)|scr;)|g(?:E(?:;|l;)|a(?:cute;|mma(?:;|d;)|p;)|breve;|c(?:irc;|y;)|dot;|e(?:;|l;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|l;))|l(?:;|es;)))|fr;|g(?:;|g;)|imel;|jcy;|l(?:;|E;|a;|j;)|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|opf;|rave;|s(?:cr;|im(?:;|e;|l;))|t(?:;|c(?:c;|ir;)|dot;|lPar;|quest;|r(?:a(?:pprox;|rr;)|dot;|eq(?:less;|qless;)|less;|sim;)|)|v(?:ertneqq;|nE;))|h(?:Arr;|a(?:irsp;|lf;|milt;|r(?:dcy;|r(?:;|cir;|w;)))|bar;|circ;|e(?:arts(?:;|uit;)|llip;|rcon;)|fr;|ks(?:earow;|warow;)|o(?:arr;|mtht;|ok(?:leftarrow;|rightarrow;)|pf;|rbar;)|s(?:cr;|lash;|trok;)|y(?:bull;|phen;))|i(?:acute;?|c(?:;|irc;?|y;)|e(?:cy;|xcl;?)|f(?:f;|r;)|grave;?|i(?:;|i(?:int;|nt;)|nfin;|ota;)|jlig;|m(?:a(?:cr;|g(?:e;|line;|part;)|th;)|of;|ped;)|n(?:;|care;|fin(?:;|tie;)|odot;|t(?:;|cal;|e(?:gers;|rcal;)|larhk;|prod;))|o(?:cy;|gon;|pf;|ta;)|prod;|quest;?|s(?:cr;|in(?:;|E;|dot;|s(?:;|v;)|v;))|t(?:;|ilde;)|u(?:kcy;|ml;?))|j(?:c(?:irc;|y;)|fr;|math;|opf;|s(?:cr;|ercy;)|ukcy;)|k(?:appa(?:;|v;)|c(?:edil;|y;)|fr;|green;|hcy;|jcy;|opf;|scr;)|l(?:A(?:arr;|rr;|tail;)|Barr;|E(?:;|g;)|Har;|a(?:cute;|emptyv;|gran;|mbda;|ng(?:;|d;|le;)|p;|quo;?|rr(?:;|b(?:;|fs;)|fs;|hk;|lp;|pl;|sim;|tl;)|t(?:;|ail;|e(?:;|s;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|quo(?:;|r;)|r(?:dhar;|ushar;)|sh;)|e(?:;|ft(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|leftarrows;|right(?:arrow(?:;|s;)|harpoons;|squigarrow;)|threetimes;)|g;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|r;))|g(?:;|es;)|s(?:approx;|dot;|eq(?:gtr;|qgtr;)|gtr;|sim;)))|f(?:isht;|loor;|r;)|g(?:;|E;)|h(?:ar(?:d;|u(?:;|l;))|blk;)|jcy;|l(?:;|arr;|corner;|hard;|tri;)|m(?:idot;|oust(?:;|ache;))|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|o(?:a(?:ng;|rr;)|brk;|ng(?:left(?:arrow;|rightarrow;)|mapsto;|rightarrow;)|oparrow(?:left;|right;)|p(?:ar;|f;|lus;)|times;|w(?:ast;|bar;)|z(?:;|enge;|f;))|par(?:;|lt;)|r(?:arr;|corner;|har(?:;|d;)|m;|tri;)|s(?:aquo;|cr;|h;|im(?:;|e;|g;)|q(?:b;|uo(?:;|r;))|trok;)|t(?:;|c(?:c;|ir;)|dot;|hree;|imes;|larr;|quest;|r(?:Par;|i(?:;|e;|f;))|)|ur(?:dshar;|uhar;)|v(?:ertneqq;|nE;))|m(?:DDot;|a(?:cr;?|l(?:e;|t(?:;|ese;))|p(?:;|sto(?:;|down;|left;|up;))|rker;)|c(?:omma;|y;)|dash;|easuredangle;|fr;|ho;|i(?:cro;?|d(?:;|ast;|cir;|dot;?)|nus(?:;|b;|d(?:;|u;)))|l(?:cp;|dr;)|nplus;|o(?:dels;|pf;)|p;|s(?:cr;|tpos;)|u(?:;|ltimap;|map;))|n(?:G(?:g;|t(?:;|v;))|L(?:eft(?:arrow;|rightarrow;)|l;|t(?:;|v;))|Rightarrow;|V(?:Dash;|dash;)|a(?:bla;|cute;|ng;|p(?:;|E;|id;|os;|prox;)|tur(?:;|al(?:;|s;)))|b(?:sp;?|ump(?:;|e;))|c(?:a(?:p;|ron;)|edil;|ong(?:;|dot;)|up;|y;)|dash;|e(?:;|Arr;|ar(?:hk;|r(?:;|ow;))|dot;|quiv;|s(?:ear;|im;)|xist(?:;|s;))|fr;|g(?:E;|e(?:;|q(?:;|q;|slant;)|s;)|sim;|t(?:;|r;))|h(?:Arr;|arr;|par;)|i(?:;|s(?:;|d;)|v;)|jcy;|l(?:Arr;|E;|arr;|dr;|e(?:;|ft(?:arrow;|rightarrow;)|q(?:;|q;|slant;)|s(?:;|s;))|sim;|t(?:;|ri(?:;|e;)))|mid;|o(?:pf;|t(?:;|in(?:;|E;|dot;|v(?:a;|b;|c;))|ni(?:;|v(?:a;|b;|c;))|))|p(?:ar(?:;|allel;|sl;|t;)|olint;|r(?:;|cue;|e(?:;|c(?:;|eq;))))|r(?:Arr;|arr(?:;|c;|w;)|ightarrow;|tri(?:;|e;))|s(?:c(?:;|cue;|e;|r;)|hort(?:mid;|parallel;)|im(?:;|e(?:;|q;))|mid;|par;|qsu(?:be;|pe;)|u(?:b(?:;|E;|e;|set(?:;|eq(?:;|q;)))|cc(?:;|eq;)|p(?:;|E;|e;|set(?:;|eq(?:;|q;)))))|t(?:gl;|ilde;?|lg;|riangle(?:left(?:;|eq;)|right(?:;|eq;)))|u(?:;|m(?:;|ero;|sp;))|v(?:Dash;|Harr;|ap;|dash;|g(?:e;|t;)|infin;|l(?:Arr;|e;|t(?:;|rie;))|r(?:Arr;|trie;)|sim;)|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|near;))|o(?:S;|a(?:cute;?|st;)|c(?:ir(?:;|c;?)|y;)|d(?:ash;|blac;|iv;|ot;|sold;)|elig;|f(?:cir;|r;)|g(?:on;|rave;?|t;)|h(?:bar;|m;)|int;|l(?:arr;|c(?:ir;|ross;)|ine;|t;)|m(?:acr;|ega;|i(?:cron;|d;|nus;))|opf;|p(?:ar;|erp;|lus;)|r(?:;|arr;|d(?:;|er(?:;|of;)|f;?|m;?)|igof;|or;|slope;|v;)|s(?:cr;|lash;?|ol;)|ti(?:lde;?|mes(?:;|as;))|uml;?|vbar;)|p(?:ar(?:;|a(?:;|llel;|)|s(?:im;|l;)|t;)|cy;|er(?:cnt;|iod;|mil;|p;|tenk;)|fr;|h(?:i(?:;|v;)|mmat;|one;)|i(?:;|tchfork;|v;)|l(?:an(?:ck(?:;|h;)|kv;)|us(?:;|acir;|b;|cir;|d(?:o;|u;)|e;|mn;?|sim;|two;))|m;|o(?:intint;|pf;|und;?)|r(?:;|E;|ap;|cue;|e(?:;|c(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;))|ime(?:;|s;)|n(?:E;|ap;|sim;)|o(?:d;|f(?:alar;|line;|surf;)|p(?:;|to;))|sim;|urel;)|s(?:cr;|i;)|uncsp;)|q(?:fr;|int;|opf;|prime;|scr;|u(?:at(?:ernions;|int;)|est(?:;|eq;)|ot;?))|r(?:A(?:arr;|rr;|tail;)|Barr;|Har;|a(?:c(?:e;|ute;)|dic;|emptyv;|ng(?:;|d;|e;|le;)|quo;?|rr(?:;|ap;|b(?:;|fs;)|c;|fs;|hk;|lp;|pl;|sim;|tl;|w;)|t(?:ail;|io(?:;|nals;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|ldhar;|quo(?:;|r;)|sh;)|e(?:al(?:;|ine;|part;|s;)|ct;|g;?)|f(?:isht;|loor;|r;)|h(?:ar(?:d;|u(?:;|l;))|o(?:;|v;))|i(?:ght(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|left(?:arrows;|harpoons;)|rightarrows;|squigarrow;|threetimes;)|ng;|singdotseq;)|l(?:arr;|har;|m;)|moust(?:;|ache;)|nmid;|o(?:a(?:ng;|rr;)|brk;|p(?:ar;|f;|lus;)|times;)|p(?:ar(?:;|gt;)|polint;)|rarr;|s(?:aquo;|cr;|h;|q(?:b;|uo(?:;|r;)))|t(?:hree;|imes;|ri(?:;|e;|f;|ltri;))|uluhar;|x;)|s(?:acute;|bquo;|c(?:;|E;|a(?:p;|ron;)|cue;|e(?:;|dil;)|irc;|n(?:E;|ap;|sim;)|polint;|sim;|y;)|dot(?:;|b;|e;)|e(?:Arr;|ar(?:hk;|r(?:;|ow;))|ct;?|mi;|swar;|tm(?:inus;|n;)|xt;)|fr(?:;|own;)|h(?:arp;|c(?:hcy;|y;)|ort(?:mid;|parallel;)|y;?)|i(?:gma(?:;|f;|v;)|m(?:;|dot;|e(?:;|q;)|g(?:;|E;)|l(?:;|E;)|ne;|plus;|rarr;))|larr;|m(?:a(?:llsetminus;|shp;)|eparsl;|i(?:d;|le;)|t(?:;|e(?:;|s;)))|o(?:ftcy;|l(?:;|b(?:;|ar;))|pf;)|pa(?:des(?:;|uit;)|r;)|q(?:c(?:ap(?:;|s;)|up(?:;|s;))|su(?:b(?:;|e;|set(?:;|eq;))|p(?:;|e;|set(?:;|eq;)))|u(?:;|ar(?:e;|f;)|f;))|rarr;|s(?:cr;|etmn;|mile;|tarf;)|t(?:ar(?:;|f;)|r(?:aight(?:epsilon;|phi;)|ns;))|u(?:b(?:;|E;|dot;|e(?:;|dot;)|mult;|n(?:E;|e;)|plus;|rarr;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;)))|cc(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;)|m;|ng;|p(?:1;?|2;?|3;?|;|E;|d(?:ot;|sub;)|e(?:;|dot;)|hs(?:ol;|ub;)|larr;|mult;|n(?:E;|e;)|plus;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;))))|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|nwar;)|zlig;?)|t(?:a(?:rget;|u;)|brk;|c(?:aron;|edil;|y;)|dot;|elrec;|fr;|h(?:e(?:re(?:4;|fore;)|ta(?:;|sym;|v;))|i(?:ck(?:approx;|sim;)|nsp;)|k(?:ap;|sim;)|orn;?)|i(?:lde;|mes(?:;|b(?:;|ar;)|d;|)|nt;)|o(?:ea;|p(?:;|bot;|cir;|f(?:;|ork;))|sa;)|prime;|r(?:ade;|i(?:angle(?:;|down;|left(?:;|eq;)|q;|right(?:;|eq;))|dot;|e;|minus;|plus;|sb;|time;)|pezium;)|s(?:c(?:r;|y;)|hcy;|trok;)|w(?:ixt;|ohead(?:leftarrow;|rightarrow;)))|u(?:Arr;|Har;|a(?:cute;?|rr;)|br(?:cy;|eve;)|c(?:irc;?|y;)|d(?:arr;|blac;|har;)|f(?:isht;|r;)|grave;?|h(?:ar(?:l;|r;)|blk;)|l(?:c(?:orn(?:;|er;)|rop;)|tri;)|m(?:acr;|l;?)|o(?:gon;|pf;)|p(?:arrow;|downarrow;|harpoon(?:left;|right;)|lus;|si(?:;|h;|lon;)|uparrows;)|r(?:c(?:orn(?:;|er;)|rop;)|ing;|tri;)|scr;|t(?:dot;|ilde;|ri(?:;|f;))|u(?:arr;|ml;?)|wangle;)|v(?:Arr;|Bar(?:;|v;)|Dash;|a(?:ngrt;|r(?:epsilon;|kappa;|nothing;|p(?:hi;|i;|ropto;)|r(?:;|ho;)|s(?:igma;|u(?:bsetneq(?:;|q;)|psetneq(?:;|q;)))|t(?:heta;|riangle(?:left;|right;))))|cy;|dash;|e(?:e(?:;|bar;|eq;)|llip;|r(?:bar;|t;))|fr;|ltri;|nsu(?:b;|p;)|opf;|prop;|rtri;|s(?:cr;|u(?:bn(?:E;|e;)|pn(?:E;|e;)))|zigzag;)|w(?:circ;|e(?:d(?:bar;|ge(?:;|q;))|ierp;)|fr;|opf;|p;|r(?:;|eath;)|scr;)|x(?:c(?:ap;|irc;|up;)|dtri;|fr;|h(?:Arr;|arr;)|i;|l(?:Arr;|arr;)|map;|nis;|o(?:dot;|p(?:f;|lus;)|time;)|r(?:Arr;|arr;)|s(?:cr;|qcup;)|u(?:plus;|tri;)|vee;|wedge;)|y(?:ac(?:ute;?|y;)|c(?:irc;|y;)|en;?|fr;|icy;|opf;|scr;|u(?:cy;|ml;?))|z(?:acute;|c(?:aron;|y;)|dot;|e(?:etrf;|ta;)|fr;|hcy;|igrarr;|opf;|scr;|w(?:j;|nj;)))|[\s\S]/g,RT=32,LT=/[^\r"&\u0000]+/g,MT=/[^\r'&\u0000]+/g,PT=/[^\r\t\n\f &>\u0000]+/g,FT=/[^\r\t\n\f \/>A-Z\u0000]+/g,BT=/[^\r\t\n\f \/=>A-Z\u0000]+/g,UT=/[^\]\r\u0000\uffff]*/g,zT=/[^&<\r\u0000\uffff]*/g,hx=/[^<\r\u0000\uffff]*/g,qT=/[^\r\u0000\uffff]*/g,mx=/(?:(\/)?([a-z]+)>)|[\s\S]/g,gx=/(?:([-a-z]+)[ \t\n\f]*=[ \t\n\f]*('[^'&\r\u0000]*'|"[^"&\r\u0000]*"|[^\t\n\r\f "&'\u0000>][^&> \t\n\r\f\u0000]*[ \t\n\f]))|[\s\S]/g,wu=/[^\x09\x0A\x0C\x0D\x20]/,Yf=/[^\x09\x0A\x0C\x0D\x20]/g,HT=/[^\x00\x09\x0A\x0C\x0D\x20]/,ga=/^[\x09\x0A\x0C\x0D\x20]+/,vu=/\x00/g;function Nr(e){var t=16384;if(e.length0;t--){var r=this.elements[t];if(ht(r,e))break}this.elements.length=t,this.top=this.elements[t-1]};nt.ElementStack.prototype.popElementType=function(e){for(var t=this.elements.length-1;t>0&&!(this.elements[t]instanceof e);t--);this.elements.length=t,this.top=this.elements[t-1]};nt.ElementStack.prototype.popElement=function(e){for(var t=this.elements.length-1;t>0&&this.elements[t]!==e;t--);this.elements.length=t,this.top=this.elements[t-1]};nt.ElementStack.prototype.removeElement=function(e){if(this.top===e)this.pop();else{var t=this.elements.lastIndexOf(e);t!==-1&&this.elements.splice(t,1)}};nt.ElementStack.prototype.clearToContext=function(e){for(var t=this.elements.length-1;t>0&&!ht(this.elements[t],e);t--);this.elements.length=t+1,this.top=this.elements[t]};nt.ElementStack.prototype.contains=function(e){return this.inSpecificScope(e,Object.create(null))};nt.ElementStack.prototype.inSpecificScope=function(e,t){for(var r=this.elements.length-1;r>=0;r--){var n=this.elements[r];if(ht(n,e))return!0;if(ht(n,t))return!1}return!1};nt.ElementStack.prototype.elementInSpecificScope=function(e,t){for(var r=this.elements.length-1;r>=0;r--){var n=this.elements[r];if(n===e)return!0;if(ht(n,t))return!1}return!1};nt.ElementStack.prototype.elementTypeInSpecificScope=function(e,t){for(var r=this.elements.length-1;r>=0;r--){var n=this.elements[r];if(n instanceof e)return!0;if(ht(n,t))return!1}return!1};nt.ElementStack.prototype.inScope=function(e){return this.inSpecificScope(e,ei)};nt.ElementStack.prototype.elementInScope=function(e){return this.elementInSpecificScope(e,ei)};nt.ElementStack.prototype.elementTypeInScope=function(e){return this.elementTypeInSpecificScope(e,ei)};nt.ElementStack.prototype.inButtonScope=function(e){return this.inSpecificScope(e,rd)};nt.ElementStack.prototype.inListItemScope=function(e){return this.inSpecificScope(e,Au)};nt.ElementStack.prototype.inTableScope=function(e){return this.inSpecificScope(e,Nx)};nt.ElementStack.prototype.inSelectScope=function(e){for(var t=this.elements.length-1;t>=0;t--){var r=this.elements[t];if(r.namespaceURI!==Ne.HTML)return!1;var n=r.localName;if(n===e)return!0;if(n!=="optgroup"&&n!=="option")return!1}return!1};nt.ElementStack.prototype.generateImpliedEndTags=function(e,t){for(var r=t?Cx:Ax,n=this.elements.length-1;n>=0;n--){var i=this.elements[n];if(e&&ht(i,e)||!ht(this.elements[n],r))break}this.elements.length=n+1,this.top=this.elements[n]};nt.ActiveFormattingElements=function(){this.list=[],this.attrs=[]};nt.ActiveFormattingElements.prototype.MARKER={localName:"|"};nt.ActiveFormattingElements.prototype.insertMarker=function(){this.list.push(this.MARKER),this.attrs.push(this.MARKER)};nt.ActiveFormattingElements.prototype.push=function(e,t){for(var r=0,n=this.list.length-1;n>=0&&this.list[n]!==this.MARKER;n--)if(s(e,this.list[n],this.attrs[n])&&(r++,r===3)){this.list.splice(n,1),this.attrs.splice(n,1);break}this.list.push(e);for(var i=[],a=0;a=0&&this.list[e]!==this.MARKER;e--);e<0&&(e=0),this.list.length=e,this.attrs.length=e};nt.ActiveFormattingElements.prototype.findElementByTag=function(e){for(var t=this.list.length-1;t>=0;t--){var r=this.list[t];if(r===this.MARKER)break;if(r.localName===e)return r}return null};nt.ActiveFormattingElements.prototype.indexOf=function(e){return this.list.lastIndexOf(e)};nt.ActiveFormattingElements.prototype.remove=function(e){var t=this.list.lastIndexOf(e);t!==-1&&(this.list.splice(t,1),this.attrs.splice(t,1))};nt.ActiveFormattingElements.prototype.replace=function(e,t,r){var n=this.list.lastIndexOf(e);n!==-1&&(this.list[n]=t,this.attrs[n]=r)};nt.ActiveFormattingElements.prototype.insertAfter=function(e,t){var r=this.list.lastIndexOf(e);r!==-1&&(this.list.splice(r,0,t),this.attrs.splice(r,0,t))};function nt(e,t,r){var n=null,i=0,a=0,s=!1,o=!1,l=0,u=[],c="",p=!0,d=0,f=Ze,h,m,g="",x="",y=[],b="",k="",w=[],v=[],A=[],R=[],I=[],$=!1,_=sk,M=null,P=[],S=new nt.ElementStack,D=new nt.ActiveFormattingElements,W=t!==void 0,j=null,U=null,H=!0;t&&(H=t.ownerDocument._scripting_enabled),r&&r.scripting_enabled===!1&&(H=!1);var z=!0,ee=!1,Y,ne,Z=[],ve=!1,de=!1,xe={document:function(){return ie},_asDocumentFragment:function(){for(var E=ie.createDocumentFragment(),C=ie.firstChild;C.hasChildNodes();)E.appendChild(C.firstChild);return E},pause:function(){d++},resume:function(){d--,this.parse("")},parse:function(E,C,L){var G;return d>0?(c+=E,!0):(l===0?(c&&(E=c+E,c=""),C&&(E+="\uFFFF",s=!0),n=E,i=E.length,a=0,p&&(p=!1,n.charCodeAt(0)===65279&&(a=1)),l++,G=he(L),c=n.substring(a,i),l--):(l++,u.push(n,i,a),n=E,i=E.length,a=0,he(),G=!1,c=n.substring(a,i),a=u.pop(),i=u.pop(),n=u.pop(),c&&(n=c+n.substring(a),i=n.length,a=0,c=""),l--),G)}},ie=new CT(!0,e);if(ie._parser=xe,ie._scripting_enabled=H,t){if(t.ownerDocument._quirks&&(ie._quirks=!0),t.ownerDocument._limitedQuirks&&(ie._limitedQuirks=!0),t.namespaceURI===Ne.HTML)switch(t.localName){case"title":case"textarea":f=Bi;break;case"style":case"xmp":case"iframe":case"noembed":case"noframes":case"script":case"plaintext":f=Tp;break}var Fe=ie.createElement("html");ie._appendChild(Fe),S.push(Fe),t instanceof dt.HTMLTemplateElement&&P.push(Fp),co();for(var te=t;te!==null;te=te.parentElement)if(te instanceof dt.HTMLFormElement){U=te;break}}function he(E){for(var C,L,G,Q;a0||E&&E())return!0;switch(typeof f.lookahead){case"undefined":if(C=n.charCodeAt(a++),o&&(o=!1,C===10)){a++;continue}switch(C){case 13:a0){var E=Nr(Z);if(Z.length=0,de&&(de=!1,E[0]===` `&&(E=E.substring(1)),E.length===0))return;er(xs,E),ve=!1}de=!1}function oo(E){E.lastIndex=a-1;var C=E.exec(n);if(C&&C.index===a-1)return C=C[0],a+=C.length-1,s&&a===i&&(C=C.slice(0,-1),a--),C;throw new Error("should never happen")}function lo(E){E.lastIndex=a-1;var C=E.exec(n)[0];return C?(dC(C),a+=C.length-1,!0):!1}function dC(E){Z.length>0&&ts(),!(de&&(de=!1,E[0]===` `&&(E=E.substring(1)),E.length===0))&&er(xs,E)}function mi(){if($)er(Qe,g);else{var E=g;g="",x=E,er(kr,E,I)}}function hC(){if(a===i)return!1;mx.lastIndex=a;var E=mx.exec(n);if(!E)throw new Error("should never happen");var C=E[2];if(!C)return!1;var L=E[1];return L?(a+=C.length+2,er(Qe,C)):(a+=C.length+1,x=C,er(kr,C,TT)),!0}function mC(){$?er(Qe,g,null,!0):er(kr,g,I,!0)}function ut(){er(NT,Nr(v),A?Nr(A):void 0,R?Nr(R):void 0)}function We(){ts(),_(bu),ie.modclock=1}var er=xe.insertToken=function(C,L,G,Q){ts();var pe=S.top;!pe||pe.namespaceURI===Ne.HTML?_(C,L,G,Q):C!==kr&&C!==xs?Pm(C,L,G,Q):xx(pe)&&(C===xs||C===kr&&L!=="mglyph"&&L!=="malignmark")||C===kr&&L==="svg"&&pe.namespaceURI===Ne.MATHML&&pe.localName==="annotation-xml"||yx(pe)?(ne=!0,_(C,L,G,Q),ne=!1):Pm(C,L,G,Q)};function Zn(E){var C=S.top;Fi&&ht(C,ys)?Ol(function(L){return L.createComment(E)}):(C instanceof dt.HTMLTemplateElement&&(C=C.content),C._appendChild(C.ownerDocument.createComment(E)))}function Xn(E){var C=S.top;if(Fi&&ht(C,ys))Ol(function(G){return G.createTextNode(E)});else{C instanceof dt.HTMLTemplateElement&&(C=C.content);var L=C.lastChild;L&&L.nodeType===Kf.TEXT_NODE?L.appendData(E):C._appendChild(C.ownerDocument.createTextNode(E))}}function uo(E,C,L){var G=Ex.createElement(E,C,null);if(L)for(var Q=0,pe=L.length;Q=0;C--)if(S.elements[C]instanceof E)return C;return-1}function Ol(E){var C,L,G=-1,Q=-1,pe;if(G=Em(dt.HTMLTableElement),Q=Em(dt.HTMLTemplateElement),Q>=0&&(G<0||Q>G)?C=S.elements[Q]:G>=0&&(C=S.elements[G].parentNode,C?L=S.elements[G]:C=S.elements[G-1]),C||(C=S.elements[0]),C instanceof dt.HTMLTemplateElement&&(C=C.content),pe=E(C.ownerDocument),pe.nodeType===Kf.TEXT_NODE){var Oe;if(L?Oe=L.previousSibling:Oe=C.lastChild,Oe&&Oe.nodeType===Kf.TEXT_NODE)return Oe.appendData(pe.data),pe}return L?C.insertBefore(pe,L):C._appendChild(pe),pe}function co(){for(var E=!1,C=S.elements.length-1;C>=0;C--){var L=S.elements[C];if(C===0&&(E=!0,W&&(L=t)),L.namespaceURI===Ne.HTML){var G=L.localName;switch(G){case"select":for(var Q=C;Q>0;){var pe=S.elements[--Q];if(pe instanceof dt.HTMLTemplateElement)break;if(pe instanceof dt.HTMLTableElement){_=Wl;return}}_=gi;return;case"tr":_=ho;return;case"tbody":case"tfoot":case"thead":_=la;return;case"caption":_=Pp;return;case"colgroup":_=Hl;return;case"table":_=pn;return;case"template":_=P[P.length-1];return;case"body":_=_e;return;case"frameset":_=Bp;return;case"html":j===null?_=zl:_=Mp;return;default:if(!E){if(G==="head"){_=qt;return}if(G==="td"||G==="th"){_=rs;return}}}}if(E){_=_e;return}}}function Il(E,C){ze(E,C),f=po,M=_,_=ql}function gC(E,C){ze(E,C),f=Bi,M=_,_=ql}function Np(E,C){return{elt:uo(E,D.list[C].localName,D.attrs[C]),attrs:D.attrs[C]}}function Dr(){if(D.list.length!==0){var E=D.list[D.list.length-1];if(E!==D.MARKER&&S.elements.lastIndexOf(E)===-1){for(var C=D.list.length-2;C>=0&&(E=D.list[C],!(E===D.MARKER||S.elements.lastIndexOf(E)!==-1));C--);for(C=C+1;C3&&_n!==-1&&(D.remove(Ft),_n=-1),_n===-1){S.removeElement(Ft);continue}var Wi=Np(Xe.ownerDocument,_n);D.replace(Ft,Wi.elt,Wi.attrs),S.elements[fn]=Wi.elt,Ft=Wi.elt,gr===Q&&(D.remove($l),D.insertAfter(Wi.elt,$l)),Ft._appendChild(gr),gr=Ft}Fi&&ht(Xe,ys)?Ol(function(){return gr}):Xe instanceof dt.HTMLTemplateElement?Xe.content._appendChild(gr):Xe._appendChild(gr);for(var mo=Np(Q.ownerDocument,D.indexOf(L));Q.hasChildNodes();)mo.elt._appendChild(Q.firstChild);Q._appendChild(mo.elt),D.remove(L),D.replace($l,mo.elt,mo.attrs),S.removeElement(L);var pk=S.elements.lastIndexOf(Q);S.elements.splice(pk+1,0,mo.elt)}else return S.popElement(L),D.remove(L),!0}return!0}function yC(){S.pop(),_=M}function aa(){delete ie._parser,S.elements.length=0,ie.defaultView&&ie.defaultView.dispatchEvent(new dt.Event("load",{}))}function Se(E,C){f=C,a--}function Ze(E){switch(E){case 38:h=Ze,f=fo;break;case 60:if(hC())break;f=bC;break;case 0:Z.push(E),ve=!0;break;case-1:We();break;default:lo(zT)||Z.push(E);break}}function Bi(E){switch(E){case 38:h=Bi,f=fo;break;case 60:f=vC;break;case 0:Z.push(65533),ve=!0;break;case-1:We();break;default:Z.push(E);break}}function po(E){switch(E){case 60:f=AC;break;case 0:Z.push(65533);break;case-1:We();break;default:lo(hx)||Z.push(E);break}}function Ui(E){switch(E){case 60:f=NC;break;case 0:Z.push(65533);break;case-1:We();break;default:lo(hx)||Z.push(E);break}}function Tp(E){switch(E){case 0:Z.push(65533);break;case-1:We();break;default:lo(qT)||Z.push(E);break}}function bC(E){switch(E){case 33:f=km;break;case 47:f=wC;break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Je(),Se(E,Sm);break;case 63:Se(E,Ml);break;default:Z.push(60),Se(E,Ze);break}}function wC(E){switch(E){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Ue(),Se(E,Sm);break;case 62:f=Ze;break;case-1:Z.push(60),Z.push(47),We();break;default:Se(E,Ml);break}}function Sm(E){switch(E){case 9:case 10:case 12:case 32:f=Kn;break;case 47:f=qi;break;case 62:f=Ze,mi();break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:g+=String.fromCharCode(E+32);break;case 0:g+="\uFFFD";break;case-1:We();break;default:g+=oo(FT);break}}function vC(E){E===47?(ye(),f=EC):(Z.push(60),Se(E,Bi))}function EC(E){switch(E){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Ue(),Se(E,SC);break;default:Z.push(60),Z.push(47),Se(E,Bi);break}}function SC(E){switch(E){case 9:case 10:case 12:case 32:if(cn(g)){f=Kn;return}break;case 47:if(cn(g)){f=qi;return}break;case 62:if(cn(g)){f=Ze,mi();return}break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:g+=String.fromCharCode(E+32),y.push(E);return;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:g+=String.fromCharCode(E),y.push(E);return;default:break}Z.push(60),Z.push(47),ma(Z,y),Se(E,Bi)}function AC(E){E===47?(ye(),f=CC):(Z.push(60),Se(E,po))}function CC(E){switch(E){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Ue(),Se(E,kC);break;default:Z.push(60),Z.push(47),Se(E,po);break}}function kC(E){switch(E){case 9:case 10:case 12:case 32:if(cn(g)){f=Kn;return}break;case 47:if(cn(g)){f=qi;return}break;case 62:if(cn(g)){f=Ze,mi();return}break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:g+=String.fromCharCode(E+32),y.push(E);return;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:g+=String.fromCharCode(E),y.push(E);return;default:break}Z.push(60),Z.push(47),ma(Z,y),Se(E,po)}function NC(E){switch(E){case 47:ye(),f=TC;break;case 33:f=OC,Z.push(60),Z.push(33);break;default:Z.push(60),Se(E,Ui);break}}function TC(E){switch(E){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Ue(),Se(E,_C);break;default:Z.push(60),Z.push(47),Se(E,Ui);break}}function _C(E){switch(E){case 9:case 10:case 12:case 32:if(cn(g)){f=Kn;return}break;case 47:if(cn(g)){f=qi;return}break;case 62:if(cn(g)){f=Ze,mi();return}break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:g+=String.fromCharCode(E+32),y.push(E);return;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:g+=String.fromCharCode(E),y.push(E);return;default:break}Z.push(60),Z.push(47),ma(Z,y),Se(E,Ui)}function OC(E){E===45?(f=IC,Z.push(45)):Se(E,Ui)}function IC(E){E===45?(f=Am,Z.push(45)):Se(E,Ui)}function Qn(E){switch(E){case 45:f=$C,Z.push(45);break;case 60:f=_p;break;case 0:Z.push(65533);break;case-1:We();break;default:Z.push(E);break}}function $C(E){switch(E){case 45:f=Am,Z.push(45);break;case 60:f=_p;break;case 0:f=Qn,Z.push(65533);break;case-1:We();break;default:f=Qn,Z.push(E);break}}function Am(E){switch(E){case 45:Z.push(45);break;case 60:f=_p;break;case 62:f=Ui,Z.push(62);break;case 0:f=Qn,Z.push(65533);break;case-1:We();break;default:f=Qn,Z.push(E);break}}function _p(E){switch(E){case 47:ye(),f=DC;break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:ye(),Z.push(60),Se(E,LC);break;default:Z.push(60),Se(E,Qn);break}}function DC(E){switch(E){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Ue(),Se(E,RC);break;default:Z.push(60),Z.push(47),Se(E,Qn);break}}function RC(E){switch(E){case 9:case 10:case 12:case 32:if(cn(g)){f=Kn;return}break;case 47:if(cn(g)){f=qi;return}break;case 62:if(cn(g)){f=Ze,mi();return}break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:g+=String.fromCharCode(E+32),y.push(E);return;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:g+=String.fromCharCode(E),y.push(E);return;default:break}Z.push(60),Z.push(47),ma(Z,y),Se(E,Qn)}function LC(E){switch(E){case 9:case 10:case 12:case 32:case 47:case 62:Nr(y)==="script"?f=zi:f=Qn,Z.push(E);break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:y.push(E+32),Z.push(E);break;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:y.push(E),Z.push(E);break;default:Se(E,Qn);break}}function zi(E){switch(E){case 45:f=MC,Z.push(45);break;case 60:f=Op,Z.push(60);break;case 0:Z.push(65533);break;case-1:We();break;default:Z.push(E);break}}function MC(E){switch(E){case 45:f=PC,Z.push(45);break;case 60:f=Op,Z.push(60);break;case 0:f=zi,Z.push(65533);break;case-1:We();break;default:f=zi,Z.push(E);break}}function PC(E){switch(E){case 45:Z.push(45);break;case 60:f=Op,Z.push(60);break;case 62:f=Ui,Z.push(62);break;case 0:f=zi,Z.push(65533);break;case-1:We();break;default:f=zi,Z.push(E);break}}function Op(E){E===47?(ye(),f=FC,Z.push(47)):Se(E,zi)}function FC(E){switch(E){case 9:case 10:case 12:case 32:case 47:case 62:Nr(y)==="script"?f=Qn:f=zi,Z.push(E);break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:y.push(E+32),Z.push(E);break;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:y.push(E),Z.push(E);break;default:Se(E,zi);break}}function Kn(E){switch(E){case 9:case 10:case 12:case 32:break;case 47:f=qi;break;case 62:f=Ze,mi();break;case-1:We();break;case 61:Ur(),b+=String.fromCharCode(E),f=Ip;break;default:if(Te())break;Ur(),Se(E,Ip);break}}function Ip(E){switch(E){case 9:case 10:case 12:case 32:case 47:case 62:case-1:Se(E,BC);break;case 61:f=Cm;break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:b+=String.fromCharCode(E+32);break;case 0:b+="\uFFFD";break;default:b+=oo(BT);break}}function BC(E){switch(E){case 9:case 10:case 12:case 32:break;case 47:qe(b),f=qi;break;case 61:f=Cm;break;case 62:f=Ze,qe(b),mi();break;case-1:qe(b),We();break;default:qe(b),Ur(),Se(E,Ip);break}}function Cm(E){switch(E){case 9:case 10:case 12:case 32:break;case 34:Jr(),f=Dl;break;case 39:Jr(),f=Rl;break;default:Jr(),Se(E,Ll);break}}function Dl(E){switch(E){case 34:qe(b,k),f=$p;break;case 38:h=Dl,f=fo;break;case 0:k+="\uFFFD";break;case-1:We();break;case 10:k+=String.fromCharCode(E);break;default:k+=oo(LT);break}}function Rl(E){switch(E){case 39:qe(b,k),f=$p;break;case 38:h=Rl,f=fo;break;case 0:k+="\uFFFD";break;case-1:We();break;case 10:k+=String.fromCharCode(E);break;default:k+=oo(MT);break}}function Ll(E){switch(E){case 9:case 10:case 12:case 32:qe(b,k),f=Kn;break;case 38:h=Ll,f=fo;break;case 62:qe(b,k),f=Ze,mi();break;case 0:k+="\uFFFD";break;case-1:a--,f=Ze;break;default:k+=oo(PT);break}}function $p(E){switch(E){case 9:case 10:case 12:case 32:f=Kn;break;case 47:f=qi;break;case 62:f=Ze,mi();break;case-1:We();break;default:Se(E,Kn);break}}function qi(E){switch(E){case 62:f=Ze,mC(!0);break;case-1:We();break;default:Se(E,Kn);break}}function Ml(E,C,L){var G=C.length;L?a+=G-1:a+=G;var Q=C.substring(0,G-1);Q=Q.replace(/\u0000/g,"\uFFFD"),Q=Q.replace(/\u000D\u000A/g,` `),Q=Q.replace(/\u000D/g,` `),er(Jn,Q),f=Ze}Ml.lookahead=">";function km(E,C,L){if(C[0]==="-"&&C[1]==="-"){a+=2,mr(),f=UC;return}C.toUpperCase()==="DOCTYPE"?(a+=7,f=VC):C==="[CDATA["&&fC()?(a+=7,f=Lp):f=Ml}km.lookahead=7;function UC(E){switch(mr(),E){case 45:f=zC;break;case 62:f=Ze,er(Jn,Nr(w));break;default:Se(E,sa);break}}function zC(E){switch(E){case 45:f=Pl;break;case 62:f=Ze,er(Jn,Nr(w));break;case-1:er(Jn,Nr(w)),We();break;default:w.push(45),Se(E,sa);break}}function sa(E){switch(E){case 60:w.push(E),f=qC;break;case 45:f=Dp;break;case 0:w.push(65533);break;case-1:er(Jn,Nr(w)),We();break;default:w.push(E);break}}function qC(E){switch(E){case 33:w.push(E),f=HC;break;case 60:w.push(E);break;default:Se(E,sa);break}}function HC(E){E===45?f=WC:Se(E,sa)}function WC(E){E===45?f=jC:Se(E,Dp)}function jC(E){switch(E){case 62:case-1:Se(E,Pl);break;default:Se(E,Pl);break}}function Dp(E){switch(E){case 45:f=Pl;break;case-1:er(Jn,Nr(w)),We();break;default:w.push(45),Se(E,sa);break}}function Pl(E){switch(E){case 62:f=Ze,er(Jn,Nr(w));break;case 33:f=GC;break;case 45:w.push(45);break;case-1:er(Jn,Nr(w)),We();break;default:w.push(45),w.push(45),Se(E,sa);break}}function GC(E){switch(E){case 45:w.push(45),w.push(45),w.push(33),f=Dp;break;case 62:f=Ze,er(Jn,Nr(w));break;case-1:er(Jn,Nr(w)),We();break;default:w.push(45),w.push(45),w.push(33),Se(E,sa);break}}function VC(E){switch(E){case 9:case 10:case 12:case 32:f=Nm;break;case-1:zr(),lt(),ut(),We();break;default:Se(E,Nm);break}}function Nm(E){switch(E){case 9:case 10:case 12:case 32:break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:zr(),v.push(E+32),f=Rp;break;case 0:zr(),v.push(65533),f=Rp;break;case 62:zr(),lt(),f=Ze,ut();break;case-1:zr(),lt(),ut(),We();break;default:zr(),v.push(E),f=Rp;break}}function Rp(E){switch(E){case 9:case 10:case 12:case 32:f=Tm;break;case 62:f=Ze,ut();break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:v.push(E+32);break;case 0:v.push(65533);break;case-1:lt(),ut(),We();break;default:v.push(E);break}}function Tm(E,C,L){switch(E){case 9:case 10:case 12:case 32:a+=1;break;case 62:f=Ze,a+=1,ut();break;case-1:lt(),ut(),We();break;default:C=C.toUpperCase(),C==="PUBLIC"?(a+=6,f=ZC):C==="SYSTEM"?(a+=6,f=KC):(lt(),f=Hi);break}}Tm.lookahead=6;function ZC(E){switch(E){case 9:case 10:case 12:case 32:f=XC;break;case 34:Jt(),f=_m;break;case 39:Jt(),f=Om;break;case 62:lt(),f=Ze,ut();break;case-1:lt(),ut(),We();break;default:lt(),f=Hi;break}}function XC(E){switch(E){case 9:case 10:case 12:case 32:break;case 34:Jt(),f=_m;break;case 39:Jt(),f=Om;break;case 62:lt(),f=Ze,ut();break;case-1:lt(),ut(),We();break;default:lt(),f=Hi;break}}function _m(E){switch(E){case 34:f=Im;break;case 0:A.push(65533);break;case 62:lt(),f=Ze,ut();break;case-1:lt(),ut(),We();break;default:A.push(E);break}}function Om(E){switch(E){case 39:f=Im;break;case 0:A.push(65533);break;case 62:lt(),f=Ze,ut();break;case-1:lt(),ut(),We();break;default:A.push(E);break}}function Im(E){switch(E){case 9:case 10:case 12:case 32:f=QC;break;case 62:f=Ze,ut();break;case 34:lr(),f=Fl;break;case 39:lr(),f=Bl;break;case-1:lt(),ut(),We();break;default:lt(),f=Hi;break}}function QC(E){switch(E){case 9:case 10:case 12:case 32:break;case 62:f=Ze,ut();break;case 34:lr(),f=Fl;break;case 39:lr(),f=Bl;break;case-1:lt(),ut(),We();break;default:lt(),f=Hi;break}}function KC(E){switch(E){case 9:case 10:case 12:case 32:f=YC;break;case 34:lr(),f=Fl;break;case 39:lr(),f=Bl;break;case 62:lt(),f=Ze,ut();break;case-1:lt(),ut(),We();break;default:lt(),f=Hi;break}}function YC(E){switch(E){case 9:case 10:case 12:case 32:break;case 34:lr(),f=Fl;break;case 39:lr(),f=Bl;break;case 62:lt(),f=Ze,ut();break;case-1:lt(),ut(),We();break;default:lt(),f=Hi;break}}function Fl(E){switch(E){case 34:f=$m;break;case 0:R.push(65533);break;case 62:lt(),f=Ze,ut();break;case-1:lt(),ut(),We();break;default:R.push(E);break}}function Bl(E){switch(E){case 39:f=$m;break;case 0:R.push(65533);break;case 62:lt(),f=Ze,ut();break;case-1:lt(),ut(),We();break;default:R.push(E);break}}function $m(E){switch(E){case 9:case 10:case 12:case 32:break;case 62:f=Ze,ut();break;case-1:lt(),ut(),We();break;default:f=Hi;break}}function Hi(E){switch(E){case 62:f=Ze,ut();break;case-1:ut(),We();break;default:break}}function Lp(E){switch(E){case 93:f=JC;break;case-1:We();break;case 0:ve=!0;default:lo(UT)||Z.push(E);break}}function JC(E){E===93?f=ek:(Z.push(93),Se(E,Lp))}function ek(E){switch(E){case 93:Z.push(93);break;case 62:ts(),f=Ze;break;default:Z.push(93),Z.push(93),Se(E,Lp);break}}function fo(E){switch(ye(),y.push(38),E){case 9:case 10:case 12:case 32:case 60:case 38:case-1:Se(E,oa);break;case 35:y.push(E),f=tk;break;default:Se(E,Dm);break}}function Dm(E){dx.lastIndex=a;var C=dx.exec(n);if(!C)throw new Error("should never happen");var L=C[1];if(!L){f=oa;return}switch(a+=L.length,ma(y,WT(L)),h){case Dl:case Rl:case Ll:if(L[L.length-1]!==";"&&/[=A-Za-z0-9]/.test(n[a])){f=oa;return}break;default:break}ye();var G=DT[L];typeof G=="number"?y.push(G):ma(y,G),f=oa}Dm.lookahead=-RT;function tk(E){switch(m=0,E){case 120:case 88:y.push(E),f=rk;break;default:Se(E,nk);break}}function rk(E){switch(E){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 65:case 66:case 67:case 68:case 69:case 70:case 97:case 98:case 99:case 100:case 101:case 102:Se(E,ik);break;default:Se(E,oa);break}}function nk(E){switch(E){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:Se(E,ak);break;default:Se(E,oa);break}}function ik(E){switch(E){case 65:case 66:case 67:case 68:case 69:case 70:m*=16,m+=E-55;break;case 97:case 98:case 99:case 100:case 101:case 102:m*=16,m+=E-87;break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:m*=16,m+=E-48;break;case 59:f=Ul;break;default:Se(E,Ul);break}}function ak(E){switch(E){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:m*=10,m+=E-48;break;case 59:f=Ul;break;default:Se(E,Ul);break}}function Ul(E){m in fx?m=fx[m]:(m>1114111||m>=55296&&m<57344)&&(m=65533),ye(),m<=65535?y.push(m):(m=m-65536,y.push(55296+(m>>10)),y.push(56320+(m&1023))),Se(E,oa)}function oa(E){switch(h){case Dl:case Rl:case Ll:k+=Nr(y);break;default:ma(Z,y);break}Se(E,h)}function sk(E,C,L,G){switch(E){case 1:if(C=C.replace(ga,""),C.length===0)return;break;case 4:ie._appendChild(ie.createComment(C));return;case 5:var Q=C,pe=L,Oe=G;ie.appendChild(new kT(ie,Q,pe,Oe)),ee||Q.toLowerCase()!=="html"||_T.test(pe)||Oe&&Oe.toLowerCase()===OT||Oe===void 0&&lx.test(pe)?ie._quirks=!0:(IT.test(pe)||Oe!==void 0&&lx.test(pe))&&(ie._limitedQuirks=!0),_=Rm;return}ie._quirks=!0,_=Rm,_(E,C,L,G)}function Rm(E,C,L,G){var Q;switch(E){case 1:if(C=C.replace(ga,""),C.length===0)return;break;case 5:return;case 4:ie._appendChild(ie.createComment(C));return;case 2:if(C==="html"){Q=uo(ie,C,L),S.push(Q),ie.appendChild(Q),_=zl;return}break;case 3:switch(C){case"html":case"head":case"body":case"br":break;default:return}}Q=uo(ie,"html",null),S.push(Q),ie.appendChild(Q),_=zl,_(E,C,L,G)}function zl(E,C,L,G){switch(E){case 1:if(C=C.replace(ga,""),C.length===0)return;break;case 5:return;case 4:Zn(C);return;case 2:switch(C){case"html":_e(E,C,L,G);return;case"head":var Q=ze(C,L);j=Q,_=qt;return}break;case 3:switch(C){case"html":case"head":case"body":case"br":break;default:return}}zl(kr,"head",null),_(E,C,L,G)}function qt(E,C,L,G){switch(E){case 1:var Q=C.match(ga);if(Q&&(Xn(Q[0]),C=C.substring(Q[0].length)),C.length===0)return;break;case 4:Zn(C);return;case 5:return;case 2:switch(C){case"html":_e(E,C,L,G);return;case"meta":case"base":case"basefont":case"bgsound":case"link":ze(C,L),S.pop();return;case"title":gC(C,L);return;case"noscript":if(!H){ze(C,L),_=Lm;return}case"noframes":case"style":Il(C,L);return;case"script":_l(function(pe){var Oe=uo(pe,C,L);return Oe._parser_inserted=!0,Oe._force_async=!1,W&&(Oe._already_started=!0),ts(),Oe}),f=Ui,M=_,_=ql;return;case"template":ze(C,L),D.insertMarker(),z=!1,_=Fp,P.push(_);return;case"head":return}break;case 3:switch(C){case"head":S.pop(),_=Mp;return;case"body":case"html":case"br":break;case"template":if(!S.contains("template"))return;S.generateImpliedEndTags(null,"thorough"),S.popTag("template"),D.clearToMarker(),P.pop(),co();return;default:return}break}qt(Qe,"head",null),_(E,C,L,G)}function Lm(E,C,L,G){switch(E){case 5:return;case 4:qt(E,C);return;case 1:var Q=C.match(ga);if(Q&&(qt(E,Q[0]),C=C.substring(Q[0].length)),C.length===0)return;break;case 2:switch(C){case"html":_e(E,C,L,G);return;case"basefont":case"bgsound":case"link":case"meta":case"noframes":case"style":qt(E,C,L);return;case"head":case"noscript":return}break;case 3:switch(C){case"noscript":S.pop(),_=qt;return;case"br":break;default:return}break}Lm(Qe,"noscript",null),_(E,C,L,G)}function Mp(E,C,L,G){switch(E){case 1:var Q=C.match(ga);if(Q&&(Xn(Q[0]),C=C.substring(Q[0].length)),C.length===0)return;break;case 4:Zn(C);return;case 5:return;case 2:switch(C){case"html":_e(E,C,L,G);return;case"body":ze(C,L),z=!1,_=_e;return;case"frameset":ze(C,L),_=Bp;return;case"base":case"basefont":case"bgsound":case"link":case"meta":case"noframes":case"script":case"style":case"template":case"title":S.push(j),qt(kr,C,L),S.removeElement(j);return;case"head":return}break;case 3:switch(C){case"template":return qt(E,C,L,G);case"body":case"html":case"br":break;default:return}break}Mp(kr,"body",null),z=!0,_(E,C,L,G)}function _e(E,C,L,G){var Q,pe,Oe,Xe;switch(E){case 1:if(ve&&(C=C.replace(vu,""),C.length===0))return;z&&wu.test(C)&&(z=!1),Dr(),Xn(C);return;case 5:return;case 4:Zn(C);return;case-1:if(P.length)return Fp(E);aa();return;case 2:switch(C){case"html":if(S.contains("template"))return;vx(L,S.elements[0]);return;case"base":case"basefont":case"bgsound":case"link":case"meta":case"noframes":case"script":case"style":case"template":case"title":qt(kr,C,L);return;case"body":if(Q=S.elements[1],!Q||!(Q instanceof dt.HTMLBodyElement)||S.contains("template"))return;z=!1,vx(L,Q);return;case"frameset":if(!z||(Q=S.elements[1],!Q||!(Q instanceof dt.HTMLBodyElement)))return;for(Q.parentNode&&Q.parentNode.removeChild(Q);!(S.top instanceof dt.HTMLHtmlElement);)S.pop();ze(C,L),_=Bp;return;case"address":case"article":case"aside":case"blockquote":case"center":case"details":case"dialog":case"dir":case"div":case"dl":case"fieldset":case"figcaption":case"figure":case"footer":case"header":case"hgroup":case"main":case"nav":case"ol":case"p":case"section":case"summary":case"ul":S.inButtonScope("p")&&_e(Qe,"p"),ze(C,L);return;case"menu":S.inButtonScope("p")&&_e(Qe,"p"),ht(S.top,"menuitem")&&S.pop(),ze(C,L);return;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":S.inButtonScope("p")&&_e(Qe,"p"),S.top instanceof dt.HTMLHeadingElement&&S.pop(),ze(C,L);return;case"pre":case"listing":S.inButtonScope("p")&&_e(Qe,"p"),ze(C,L),de=!0,z=!1;return;case"form":if(U&&!S.contains("template"))return;S.inButtonScope("p")&&_e(Qe,"p"),Xe=ze(C,L),S.contains("template")||(U=Xe);return;case"li":for(z=!1,pe=S.elements.length-1;pe>=0;pe--){if(Oe=S.elements[pe],Oe instanceof dt.HTMLLIElement){_e(Qe,"li");break}if(ht(Oe,xa)&&!ht(Oe,ed))break}S.inButtonScope("p")&&_e(Qe,"p"),ze(C,L);return;case"dd":case"dt":for(z=!1,pe=S.elements.length-1;pe>=0;pe--){if(Oe=S.elements[pe],ht(Oe,Sx)){_e(Qe,Oe.localName);break}if(ht(Oe,xa)&&!ht(Oe,ed))break}S.inButtonScope("p")&&_e(Qe,"p"),ze(C,L);return;case"plaintext":S.inButtonScope("p")&&_e(Qe,"p"),ze(C,L),f=Tp;return;case"button":S.inScope("button")?(_e(Qe,"button"),_(E,C,L,G)):(Dr(),ze(C,L),z=!1);return;case"a":var Ft=D.findElementByTag("a");Ft&&(_e(Qe,C),D.remove(Ft),S.removeElement(Ft));case"b":case"big":case"code":case"em":case"font":case"i":case"s":case"small":case"strike":case"strong":case"tt":case"u":Dr(),D.push(ze(C,L),L);return;case"nobr":Dr(),S.inScope(C)&&(_e(Qe,C),Dr()),D.push(ze(C,L),L);return;case"applet":case"marquee":case"object":Dr(),ze(C,L),D.insertMarker(),z=!1;return;case"table":!ie._quirks&&S.inButtonScope("p")&&_e(Qe,"p"),ze(C,L),z=!1,_=pn;return;case"area":case"br":case"embed":case"img":case"keygen":case"wbr":Dr(),ze(C,L),S.pop(),z=!1;return;case"input":Dr(),Xe=ze(C,L),S.pop();var gr=Xe.getAttribute("type");(!gr||gr.toLowerCase()!=="hidden")&&(z=!1);return;case"param":case"source":case"track":ze(C,L),S.pop();return;case"hr":S.inButtonScope("p")&&_e(Qe,"p"),ht(S.top,"menuitem")&&S.pop(),ze(C,L),S.pop(),z=!1;return;case"image":_e(kr,"img",L,G);return;case"textarea":ze(C,L),de=!0,z=!1,f=Bi,M=_,_=ql;return;case"xmp":S.inButtonScope("p")&&_e(Qe,"p"),Dr(),z=!1,Il(C,L);return;case"iframe":z=!1,Il(C,L);return;case"noembed":Il(C,L);return;case"select":Dr(),ze(C,L),z=!1,_===pn||_===Pp||_===la||_===ho||_===rs?_=Wl:_=gi;return;case"optgroup":case"option":S.top instanceof dt.HTMLOptionElement&&_e(Qe,"option"),Dr(),ze(C,L);return;case"menuitem":ht(S.top,"menuitem")&&S.pop(),Dr(),ze(C,L);return;case"rb":case"rtc":S.inScope("ruby")&&S.generateImpliedEndTags(),ze(C,L);return;case"rp":case"rt":S.inScope("ruby")&&S.generateImpliedEndTags("rtc"),ze(C,L);return;case"math":Dr(),wx(L),Jf(L),kp(C,L,Ne.MATHML),G&&S.pop();return;case"svg":Dr(),bx(L),Jf(L),kp(C,L,Ne.SVG),G&&S.pop();return;case"caption":case"col":case"colgroup":case"frame":case"head":case"tbody":case"td":case"tfoot":case"th":case"thead":case"tr":return}Dr(),ze(C,L);return;case 3:switch(C){case"template":qt(Qe,C,L);return;case"body":if(!S.inScope("body"))return;_=Mm;return;case"html":if(!S.inScope("body"))return;_=Mm,_(E,C,L);return;case"address":case"article":case"aside":case"blockquote":case"button":case"center":case"details":case"dialog":case"dir":case"div":case"dl":case"fieldset":case"figcaption":case"figure":case"footer":case"header":case"hgroup":case"listing":case"main":case"menu":case"nav":case"ol":case"pre":case"section":case"summary":case"ul":if(!S.inScope(C))return;S.generateImpliedEndTags(),S.popTag(C);return;case"form":if(S.contains("template")){if(!S.inScope("form"))return;S.generateImpliedEndTags(),S.popTag("form")}else{var fn=U;if(U=null,!fn||!S.elementInScope(fn))return;S.generateImpliedEndTags(),S.removeElement(fn)}return;case"p":S.inButtonScope(C)?(S.generateImpliedEndTags(C),S.popTag(C)):(_e(kr,C,null),_(E,C,L,G));return;case"li":if(!S.inListItemScope(C))return;S.generateImpliedEndTags(C),S.popTag(C);return;case"dd":case"dt":if(!S.inScope(C))return;S.generateImpliedEndTags(C),S.popTag(C);return;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":if(!S.elementTypeInScope(dt.HTMLHeadingElement))return;S.generateImpliedEndTags(),S.popElementType(dt.HTMLHeadingElement);return;case"sarcasm":break;case"a":case"b":case"big":case"code":case"em":case"font":case"i":case"nobr":case"s":case"small":case"strike":case"strong":case"tt":case"u":var _n=xC(C);if(_n)return;break;case"applet":case"marquee":case"object":if(!S.inScope(C))return;S.generateImpliedEndTags(),S.popTag(C),D.clearToMarker();return;case"br":_e(kr,C,null);return}for(pe=S.elements.length-1;pe>=0;pe--)if(Oe=S.elements[pe],ht(Oe,C)){S.generateImpliedEndTags(C),S.popElement(Oe);break}else if(ht(Oe,xa))return;return}}function ql(E,C,L,G){switch(E){case 1:Xn(C);return;case-1:S.top instanceof dt.HTMLScriptElement&&(S.top._already_started=!0),S.pop(),_=M,_(E);return;case 3:C==="script"?yC():(S.pop(),_=M);return;default:return}}function pn(E,C,L,G){function Q(Oe){for(var Xe=0,Ft=Oe.length;Xe0&&Xn(C);return;case 4:Zn(C);return;case 5:return;case-1:aa();return;case 2:switch(C){case"html":_e(E,C,L,G);return;case"frameset":ze(C,L);return;case"frame":ze(C,L),S.pop();return;case"noframes":qt(E,C,L,G);return}break;case 3:if(C==="frameset"){if(W&&S.top instanceof dt.HTMLHtmlElement)return;S.pop(),!W&&!(S.top instanceof dt.HTMLFrameSetElement)&&(_=lk);return}break}}function lk(E,C,L,G){switch(E){case 1:C=C.replace(Yf,""),C.length>0&&Xn(C);return;case 4:Zn(C);return;case 5:return;case-1:aa();return;case 2:switch(C){case"html":_e(E,C,L,G);return;case"noframes":qt(E,C,L,G);return}break;case 3:if(C==="html"){_=ck;return}break}}function uk(E,C,L,G){switch(E){case 1:if(wu.test(C))break;_e(E,C,L,G);return;case 4:ie._appendChild(ie.createComment(C));return;case 5:_e(E,C,L,G);return;case-1:aa();return;case 2:if(C==="html"){_e(E,C,L,G);return}break}_=_e,_(E,C,L,G)}function ck(E,C,L,G){switch(E){case 1:C=C.replace(Yf,""),C.length>0&&_e(E,C,L,G);return;case 4:ie._appendChild(ie.createComment(C));return;case 5:_e(E,C,L,G);return;case-1:aa();return;case 2:switch(C){case"html":_e(E,C,L,G);return;case"noframes":qt(E,C,L,G);return}break}}function Pm(E,C,L,G){function Q(Ft){for(var gr=0,fn=Ft.length;gr0&&Q[Q.length-1][0]==="Character"?Q[Q.length-1][1]+=Xe:Q.push(["Character",Xe]);break;case 4:Q.push(["Comment",Xe]);break;case 5:Q.push(["DOCTYPE",Xe,Ft===void 0?null:Ft,gr===void 0?null:gr,!ee]);break;case 2:for(var fn=Object.create(null),_n=0;_n{"use strict";Rx.exports=Dx;var Ix=gu(),$x=yu(),GT=Cu(),ku=Wt(),VT=Jl();function Dx(e){this.contextObject=e}var ZT={xml:{"":!0,"1.0":!0,"2.0":!0},core:{"":!0,"2.0":!0},html:{"":!0,"1.0":!0,"2.0":!0},xhtml:{"":!0,"1.0":!0,"2.0":!0}};Dx.prototype={hasFeature:function(t,r){var n=ZT[(t||"").toLowerCase()];return n&&n[r||""]||!1},createDocumentType:function(t,r,n){return VT.isValidQName(t)||ku.InvalidCharacterError(),new $x(this.contextObject,t,r,n)},createDocument:function(t,r,n){var i=new Ix(!1,null),a;return r?a=i.createElementNS(t,r):a=null,n&&i.appendChild(n),a&&i.appendChild(a),t===ku.NAMESPACE.HTML?i._contentType="application/xhtml+xml":t===ku.NAMESPACE.SVG?i._contentType="image/svg+xml":i._contentType="application/xml",i},createHTMLDocument:function(t){var r=new Ix(!0,null);r.appendChild(new $x(r,"html"));var n=r.createElement("html");r.appendChild(n);var i=r.createElement("head");if(n.appendChild(i),t!==void 0){var a=r.createElement("title");i.appendChild(a),a.appendChild(r.createTextNode(t))}return n.appendChild(r.createElement("body")),r.modclock=1,r},mozSetOutputMutationHandler:function(e,t){e.mutationHandler=t},mozGetInputMutationHandler:function(e){ku.nyi()},mozHTMLParser:GT}});var Mx=ke((mG,Lx)=>{"use strict";var XT=uu(),QT=Hf();Lx.exports=nd;function nd(e,t){this._window=e,this._href=t}nd.prototype=Object.create(QT.prototype,{constructor:{value:nd},href:{get:function(){return this._href},set:function(e){this.assign(e)}},assign:{value:function(e){var t=new XT(this._href),r=t.resolve(e);this._href=r}},replace:{value:function(e){this.assign(e)}},reload:{value:function(){this.assign(this.href)}},toString:{value:function(){return this.href}}})});var Fx=ke((gG,Px)=>{"use strict";var KT=Object.create(null,{appCodeName:{value:"Mozilla"},appName:{value:"Netscape"},appVersion:{value:"4.0"},platform:{value:""},product:{value:"Gecko"},productSub:{value:"20100101"},userAgent:{value:""},vendor:{value:""},vendorSub:{value:""},taintEnabled:{value:function(){return!1}}});Px.exports=KT});var Ux=ke((xG,Bx)=>{"use strict";var YT={setTimeout,clearTimeout,setInterval,clearInterval};Bx.exports=YT});var ad=ke((Ro,zx)=>{"use strict";var id=Wt();Ro=zx.exports={CSSStyleDeclaration:cu(),CharacterData:Ao(),Comment:_f(),DOMException:Zl(),DOMImplementation:Do(),DOMTokenList:ff(),Document:gu(),DocumentFragment:If(),DocumentType:yu(),Element:cs(),HTMLParser:Cu(),NamedNodeMap:yf(),Node:xr(),NodeList:da(),NodeFilter:To(),ProcessingInstruction:Df(),Text:Nf(),Window:sd()};id.merge(Ro,qf());id.merge(Ro,du().elements);id.merge(Ro,Zf().elements)});var sd=ke((yG,qx)=>{"use strict";var JT=Do(),e_=Vp(),t_=Mx(),Lo=Wt();qx.exports=Nu;function Nu(e){this.document=e||new JT(null).createHTMLDocument(""),this.document._scripting_enabled=!0,this.document.defaultView=this,this.location=new t_(this,this.document._address||"about:blank")}Nu.prototype=Object.create(e_.prototype,{console:{value:console},history:{value:{back:Lo.nyi,forward:Lo.nyi,go:Lo.nyi}},navigator:{value:Fx()},window:{get:function(){return this}},self:{get:function(){return this}},frames:{get:function(){return this}},parent:{get:function(){return this}},top:{get:function(){return this}},length:{value:0},frameElement:{value:null},opener:{value:null},onload:{get:function(){return this._getEventHandler("load")},set:function(e){this._setEventHandler("load",e)}},getComputedStyle:{value:function(t){return t.style}}});Lo.expose(Ux(),Nu);Lo.expose(ad(),Nu)});var Gx=ke(ya=>{"use strict";var Hx=Do(),Wx=Cu(),bG=sd(),jx=ad();ya.createDOMImplementation=function(){return new Hx(null)};ya.createDocument=function(e,t){if(e||t){var r=new Wx;return r.parse(e||"",!0),r.document()}return new Hx(null).createHTMLDocument("")};ya.createIncrementalHTMLParser=function(){var e=new Wx;return{write:function(t){t.length>0&&e.parse(t,!1,function(){return!0})},end:function(t){e.parse(t||"",!0,function(){return!0})},process:function(t){return e.parse("",!1,t)},document:function(){return e.document()}}};ya.createWindow=function(e,t){var r=ya.createDocument(e);return t!==void 0&&(r._address=t),new jx.Window(r)};ya.impl=jx});var ly=ke((vG,oy)=>{"use strict";function r_(e){for(var t=1;t0&&e[t-1]===` `;)t--;return e.substring(0,t)}function Kx(e){return Qx(Xx(e))}var n_=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function pd(e){return fd(e,n_)}var Yx=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Jx(e){return fd(e,Yx)}function i_(e){return ty(e,Yx)}var ey=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function a_(e){return fd(e,ey)}function s_(e){return ty(e,ey)}function fd(e,t){return t.indexOf(e.nodeName)>=0}function ty(e,t){return e.getElementsByTagName&&t.some(function(r){return e.getElementsByTagName(r).length})}var o_=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function ry(e){return o_.reduce(function(t,r){return t.replace(r[0],r[1])},e)}var Tr={};Tr.paragraph={filter:"p",replacement:function(e){return` `+e+` `}};Tr.lineBreak={filter:"br",replacement:function(e,t,r){return r.br+` `}};Tr.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,r){var n=Number(t.nodeName.charAt(1));if(r.headingStyle==="setext"&&n<3){var i=cd(n===1?"=":"-",e.length);return` `+e+` `+i+` `}else return` `+cd("#",n)+" "+e+` `}};Tr.blockquote={filter:"blockquote",replacement:function(e){return e=Kx(e).replace(/^/gm,"> "),` `+e+` `}};Tr.list={filter:["ul","ol"],replacement:function(e,t){var r=t.parentNode;return r.nodeName==="LI"&&r.lastElementChild===t?` `+e:` `+e+` `}};Tr.listItem={filter:"li",replacement:function(e,t,r){var n=r.bulletListMarker+" ",i=t.parentNode;if(i.nodeName==="OL"){var a=i.getAttribute("start"),s=Array.prototype.indexOf.call(i.children,t);n=(a?Number(a)+s:s+1)+". "}var o=/\n$/.test(e);return e=Kx(e)+(o?` `:""),e=e.replace(/\n/gm,` `+" ".repeat(n.length)),n+e+(t.nextSibling?` `:"")}};Tr.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,r){return` `+t.firstChild.textContent.replace(/\n/g,` `)+` `}};Tr.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,r){for(var n=t.firstChild.getAttribute("class")||"",i=(n.match(/language-(\S+)/)||[null,""])[1],a=t.firstChild.textContent,s=r.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(a);)u[0].length>=o&&(o=u[0].length+1);var c=cd(s,o);return` `+c+i+` `+a.replace(/\n$/,"")+` `+c+` `}};Tr.horizontalRule={filter:"hr",replacement:function(e,t,r){return` `+r.hr+` `}};Tr.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var r=dd(t.getAttribute("href")),n=hd(Tu(t.getAttribute("title"))),i=n?' "'+n+'"':"";return"["+e+"]("+r+i+")"}};Tr.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,r){var n=dd(t.getAttribute("href")),i=Tu(t.getAttribute("title"));i&&(i=' "'+hd(i)+'"');var a,s;switch(r.linkReferenceStyle){case"collapsed":a="["+e+"][]",s="["+e+"]: "+n+i;break;case"shortcut":a="["+e+"]",s="["+e+"]: "+n+i;break;default:var o=this.references.length+1;a="["+e+"]["+o+"]",s="["+o+"]: "+n+i}return this.references.push(s),a},references:[],append:function(e){var t="";return this.references.length&&(t=` `+this.references.join(` `)+` `,this.references=[]),t}};Tr.emphasis={filter:["em","i"],replacement:function(e,t,r){return e.trim()?r.emDelimiter+e+r.emDelimiter:""}};Tr.strong={filter:["strong","b"],replacement:function(e,t,r){return e.trim()?r.strongDelimiter+e+r.strongDelimiter:""}};Tr.code={filter:function(e){var t=e.previousSibling||e.nextSibling,r=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!r},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",r="`",n=e.match(/`+/gm)||[];n.indexOf(r)!==-1;)r=r+"`";return r+t+e+t+r}};Tr.image={filter:"img",replacement:function(e,t){var r=ry(Tu(t.getAttribute("alt"))),n=dd(t.getAttribute("src")||""),i=Tu(t.getAttribute("title")),a=i?' "'+hd(i)+'"':"";return n?"!["+r+"]("+n+a+")":""}};function Tu(e){return e?e.replace(/(\n+\s*)+/g,` `):""}function dd(e){var t=e.replace(/([<>()])/g,"\\$1");return t.indexOf(" ")>=0?"<"+t+">":t}function hd(e){return e.replace(/"/g,'\\"')}function ny(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}ny.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=od(this.array,e,this.options))||(t=od(this._keep,e,this.options))||(t=od(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t-1)return!0}else if(typeof n=="function"){if(n.call(e,t,r))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function u_(e){var t=e.element,r=e.isBlock,n=e.isVoid,i=e.isPre||function(p){return p.nodeName==="PRE"};if(!(!t.firstChild||i(t))){for(var a=null,s=!1,o=null,l=Vx(o,t,i);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!a||/ $/.test(a.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=ld(l);continue}l.data=u,a=l}else if(l.nodeType===1)r(l)||l.nodeName==="BR"?(a&&(a.data=a.data.replace(/ $/,"")),a=null,s=!1):n(l)||i(l)?(a=null,s=!0):a&&(s=!1);else{l=ld(l);continue}var c=Vx(o,l,i);o=l,l=c}a&&(a.data=a.data.replace(/ $/,""),a.data||ld(a))}}function ld(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Vx(e,t,r){return e&&e.parentNode===t||r(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var iy=typeof window<"u"?window:{};function c_(){var e=iy.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function p_(){var e=function(){};{var t=Gx();e.prototype.parseFromString=function(r){return t.createDocument(r)}}return e}var f_=c_()?iy.DOMParser:p_();function d_(e,t){var r;if(typeof e=="string"){var n=h_().parseFromString(''+e+"","text/html");r=n.getElementById("turndown-root")}else r=e.cloneNode(!0);return u_({element:r,isBlock:pd,isVoid:Jx,isPre:t.preformattedCode?m_:null}),r}var ud;function h_(){return ud=ud||new f_,ud}function m_(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function g_(e,t){return e.isBlock=pd(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=x_(e),e.flankingWhitespace=y_(e,t),e}function x_(e){return!Jx(e)&&!a_(e)&&/^\s*$/i.test(e.textContent)&&!i_(e)&&!s_(e)}function y_(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var r=b_(e.textContent);return r.leadingAscii&&Zx("left",e,t)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&Zx("right",e,t)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}function b_(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function Zx(e,t,r){var n,i,a;return e==="left"?(n=t.previousSibling,i=/ $/):(n=t.nextSibling,i=/^ /),n&&(n.nodeType===3?a=i.test(n.nodeValue):r.preformattedCode&&n.nodeName==="CODE"?a=!1:n.nodeType===1&&!pd(n)&&(a=i.test(n.textContent))),a}var w_=Array.prototype.reduce;function _u(e){if(!(this instanceof _u))return new _u(e);var t={rules:Tr,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(r,n){return n.isBlock?` `:""},keepReplacement:function(r,n){return n.isBlock?` `+n.outerHTML+` `:n.outerHTML},defaultReplacement:function(r,n){return n.isBlock?` `+r+` `:r}};this.options=r_({},t,e),this.rules=new ny(this.options)}_u.prototype={turndown:function(e){if(!S_(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=ay.call(this,new d_(e,this.options));return v_.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t{if(y=this.postProcess(y,n),i){setTimeout(function(){i(y)},0);return}else return y},o=r.length,l=t.length,u=1,c=o+l;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let p=(a=n.timeout)!==null&&a!==void 0?a:1/0,d=Date.now()+p,f=[{oldPos:-1,lastComponent:void 0}],h=this.extractCommon(f[0],r,t,0,n);if(f[0].oldPos+1>=l&&h+1>=o)return s(this.buildValues(f[0].lastComponent,r,t));let m=-1/0,g=1/0,x=()=>{for(let y=Math.max(m,-u);y<=Math.min(g,u);y+=2){let b,k=f[y-1],w=f[y+1];k&&(f[y-1]=void 0);let v=!1;if(w){let R=w.oldPos-y;v=w&&0<=R&&R=l&&h+1>=o)return s(this.buildValues(b.lastComponent,r,t))||!0;f[y]=b,b.oldPos+1>=l&&(g=Math.min(g,y-1)),h+1>=o&&(m=Math.max(m,y+1))}u++};if(i)(function y(){setTimeout(function(){if(u>c||Date.now()>d)return i(void 0);x()||y()},0)})();else for(;u<=c&&Date.now()<=d;){let y=x();if(y)return y}}addToPath(t,r,n,i,a){let s=t.lastComponent;return s&&!a.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:t.oldPos+i,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}}extractCommon(t,r,n,i,a){let s=r.length,o=n.length,l=t.oldPos,u=l-i,c=0;for(;u+1d.length?h:d}),c.value=this.join(p)}else c.value=this.join(r.slice(l,l+c.count));l+=c.count,c.added||(u+=c.count)}}return i}};var Up=class extends go{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}},zm=new Up;function zp(e,t,r){return zm.diff(e,t,r)}var WE=Bm(ly(),1);import{constants as mh,gunzipSync as _P,gzipSync as OP}from"node:zlib";var A_=Object.create,o0=Object.defineProperty,C_=Object.getOwnPropertyDescriptor,k_=Object.getOwnPropertyNames,N_=Object.getPrototypeOf,T_=Object.prototype.hasOwnProperty,q=(e,t)=>()=>(e&&(t=e(e=0)),t),Vc=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ce=(e,t)=>{for(var r in t)o0(e,r,{get:t[r],enumerable:!0})},__=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of k_(t))!T_.call(e,i)&&i!==r&&o0(e,i,{get:()=>t[i],enumerable:!(n=C_(t,i))||n.enumerable});return e},E4=(e,t,r)=>(r=e!=null?A_(N_(e)):{},__(t||!e||!e.__esModule?o0(r,"default",{value:e,enumerable:!0}):r,e)),S4={};ce(S4,{AsyncLocalStorage:()=>A4,Module:()=>C4,lookup:()=>O_});function O_(){throw new Error("node:dns is not available in browser environments")}var A4,C4,uy=q(()=>{"use strict";A4=void 0,C4=void 0});function I_(){return Mh||k4(),Mh}function k4(){let e=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables",allowedKeys:new Set(["NODE_V8_COVERAGE","NODE_DEBUG","NODE_DEBUG_NATIVE","NODE_COMPILE_CACHE","NODE_ENV","WATCH_REPORT_DEPENDENCIES","FORCE_COLOR","DEBUG","UNDICI_NO_FG","JEST_WORKER_ID","__MINIMATCH_TESTING_PLATFORM__","LOG_TOKENS","LOG_STREAM"])},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"getBuiltinModule",target:process,violationType:"process_get_builtin_module",strategy:"throw",reason:"process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"seteuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.seteuid could escalate effective user privileges"},{prop:"setegid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setegid could escalate effective group privileges"},{prop:"initgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.initgroups could modify supplementary group IDs"},{prop:"setgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgroups could modify supplementary group IDs"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"cwd",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.cwd could disclose real host working directory path"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"report",target:process,violationType:"process_report",strategy:"throw",reason:"process.report could disclose full environment, host paths, and system info"},{prop:"loadEnvFile",target:process,violationType:"process_env",strategy:"throw",reason:"process.loadEnvFile could load env files bypassing env proxy"},{prop:"setUncaughtExceptionCaptureCallback",target:process,violationType:"process_exception_handler",strategy:"throw",reason:"setUncaughtExceptionCaptureCallback could intercept security errors"},...["on","once","addListener","prependListener","prependOnceListener"].map(r=>({prop:r,target:process,violationType:"process_exception_handler",strategy:"throw",reason:"process-global listeners can outlive the sandbox and lose its security context"})),{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"},{prop:"performance",target:globalThis,violationType:"performance_timing",strategy:"throw",reason:"performance.now() provides sub-millisecond timing for side-channel attacks"},{prop:"stdout",target:process,violationType:"process_stdout",strategy:"throw",reason:"process.stdout could bypass interpreter output to write to host stdout"},{prop:"stderr",target:process,violationType:"process_stderr",strategy:"throw",reason:"process.stderr could bypass interpreter output to write to host stderr"},{prop:"__defineGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineGetter__ allows prototype pollution via getter injection"},{prop:"__defineSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineSetter__ allows prototype pollution via setter injection"},{prop:"__lookupGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupGetter__ enables introspection for prototype pollution attacks"},{prop:"__lookupSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupSetter__ enables introspection for prototype pollution attacks"},{prop:"JSON",target:globalThis,violationType:"json_mutation",strategy:"freeze",reason:"Freeze JSON to prevent mutation of parsing/serialization"},{prop:"Math",target:globalThis,violationType:"math_mutation",strategy:"freeze",reason:"Freeze Math to prevent mutation of math utilities"}];try{let r=Object.getPrototypeOf(async()=>{}).constructor;r&&r!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let r=Object.getPrototypeOf(function*(){}).constructor;r&&r!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let r=Object.getPrototypeOf(async function*(){}).constructor;r&&r!==Function&&r!==Object.getPrototypeOf(async()=>{}).constructor&&e.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}let t=e.filter(r=>{try{return r.target[r.prop]!==void 0}catch{return!1}});return Mh??=new Set(t.map(({violationType:r})=>r)),t}var Mh,$_=q(()=>{"use strict"});function D_(){return Math.floor(N4+T4())}var N4,T4,R_=q(()=>{"use strict";N4=performance.timeOrigin,T4=performance.now.bind(performance)});function L_(e){let t=e?.find(r=>l0.has(r));if(t)throw new RangeError(`defenseInDepth.excludeViolationTypes cannot disable the non-excludable "${t}" protection`)}function M_(e,t,r){let n=r&&!l0.has(t)?` If this access is required by trusted host-runtime code, add "${t}" to defenseInDepth.excludeViolationTypes.`:"";return e+_4+n}var l0,_4,P_=q(()=>{"use strict";l0=new Set(["function_constructor","async_function_constructor","generator_function_constructor","async_generator_function_constructor"]),_4=` This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`});function cy(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function F_(e,t,...r){return gt.run(e,()=>t(...r))}function py(){return!ii&&typeof Ts?.registerHooks=="function"}function fy(e){let t=typeof e=="boolean"?{enabled:e}:e??{};if(L_(t.excludeViolationTypes),t.enabled!==void 0&&t.enabled!==!0&&t.enabled!==!1&&t.enabled!=="auto")throw new RangeError('defenseInDepth.enabled must be true, false, or "auto"');let r={...O4,...t},n=r.enabled==="auto"?"auto":r.enabled?"enabled":"disabled",i={...r,enabled:n!=="disabled",requested:n};return i.excludeViolationTypes&&(i.excludeViolationTypes=[...new Set(i.excludeViolationTypes)].sort()),i}function B_(e,t){if(e.enabled!==t.enabled||e.auditMode!==t.auditMode||e.processLifetimeIntrinsicHardening!==t.processLifetimeIntrinsicHardening||e.onViolation!==t.onViolation)return!1;let r=e.excludeViolationTypes??[],n=t.excludeViolationTypes??[];return r.length===n.length&&r.every((i,a)=>i===n[a])}var ii,Ou,Ts,md,He,gt,dy,O4,rn,ln=q(()=>{"use strict";if(uy(),uy(),$_(),R_(),P_(),ii=!0,Ou=null,Ts=null,md=null,!ii)try{Ou=void 0,Ts=S4,md=Ts.Module??Ts.default??null}catch{}He=class extends Error{violation;constructor(e,t){super(M_(e,t.type,t.type==="error_prepare_stack_trace"||I_().has(t.type))),this.violation=t,this.name="SecurityViolationError"}},gt=!ii&&Ou?new Ou:null,dy=1e3,O4={enabled:!0,auditMode:!1,processLifetimeIntrinsicHardening:!1},rn=class ot{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];moduleAccessorResets=[];temporaryIntrinsicDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(t){this.config=t}static getInstance(t){let r=fy(t);if(!ot.instance)ot.instance=new ot(r);else{let n=ot.instance.config;if(!B_(r,n))throw new Error("DefenseInDepthBox config conflict: all resolved defense options, including exclusions and the violation callback, must match across Bash instances. Call DefenseInDepthBox.resetInstance() between incompatible configurations.")}return ot.instance}static resetInstance(){ot.instance&&(ot.instance.forceDeactivate(),ot.instance=null),ot.trustedExecutionDepth.clear()}static isInSandboxedContext(){return gt?gt?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(gt)return gt?.getStore()?.executionId}static enterTrustedScope(t){let r=ot.trustedExecutionDepth.get(t)??0;ot.trustedExecutionDepth.set(t,r+1)}static leaveTrustedScope(t){let r=ot.trustedExecutionDepth.get(t);if(r){if(r===1){ot.trustedExecutionDepth.delete(t);return}ot.trustedExecutionDepth.set(t,r-1)}}static isTrustedScopeActive(t){return t?(ot.trustedExecutionDepth.get(t)??0)>0:!1}static isTrustedContext(t){return!t||t.forceUntrusted?!1:t.trusted===!0||ot.isTrustedScopeActive(t.executionId)}isExecutionIdActive(t){return this.activeExecutionIds.has(t)}getCachedContext(t){let r=this.contextCache.get(t);return r||(r={sandboxActive:!0,executionId:t},this.contextCache.set(t,r)),r}static bindCurrentContext(t){if(!gt)return t;let r=gt.getStore(),n=r?.sandboxActive===!0?r.executionId:void 0;if(!n)return t;let i=ot.instance?.getCachedContext(n)??{sandboxActive:!0,executionId:n},a=r?.forceUntrusted?{...i,forceUntrusted:!0}:i;return((...s)=>{let o=ot.instance;if(!(o&&!o.isExecutionIdActive(n)&&(o.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!o.config.auditMode)))return F_(a,t,...s)})}isEnabled(){return this.getStatus().state==="enabled"}getStatus(){let t=py();return this.config.requested==="disabled"?{requested:"disabled",state:"disabled",level:"none",contextualDynamicImportProtection:t,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort"}:!gt||ii?{requested:this.config.requested,state:"unsupported",level:"none",contextualDynamicImportProtection:!1,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:"context-aware ESM loader hooks (node:module.registerHooks) are unavailable"}:{requested:this.config.requested,state:"enabled",level:this.config.auditMode?"none":t?"full":"best-effort",contextualDynamicImportProtection:t,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:this.config.auditMode?"audit mode records violations but does not block them":t?void 0:"best-effort protection; context-aware ESM loader hooks are unavailable"}}updateConfig(t){if(this.refCount>0)throw new Error("DefenseInDepthBox configuration cannot change while protection is active");this.config=fy({...this.config,...t})}activate(){if(!ii&&this.config.enabled&&!gt)throw new Error("DefenseInDepthBox: enabled protection requires node:async_hooks and node:module");if(ii||!this.config.enabled){let n=cy(),i=!1;return{run:a=>i?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):a(),deactivate:()=>{i=!0},executionId:n}}if(this.refCount++,this.refCount===1){try{this.applyPatches()}catch(n){throw this.restorePatches(),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0,n}this.activationTime=Date.now()}let t=cy(),r=!1;return{run:n=>r?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(t),gt.run({sandboxActive:!0,executionId:t},n)),deactivate:()=>{r||(r=!0,this.activeExecutionIds.delete(t),this.contextCache.delete(t),ot.trustedExecutionDepth.delete(t),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:t}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(t,r){return t===globalThis?`globalThis.${r}`:t===process?`process.${r}`:t===Error?`Error.${r}`:t===Function.prototype?`Function.prototype.${r}`:t===Object.prototype?`Object.prototype.${r}`:`.${r}`}static runTrusted(t){if(!gt)return t();let r=gt.getStore();if(!r)return t();let{executionId:n}=r;return gt.run({...r,trusted:!0,forceUntrusted:!1},()=>{ot.enterTrustedScope(n);try{let i=t();return typeof i=="object"&&i!==null&&"finally"in i&&typeof i.finally=="function"?i.finally(()=>{ot.leaveTrustedScope(n)}):(ot.leaveTrustedScope(n),i)}catch(i){throw ot.leaveTrustedScope(n),i}})}static async runTrustedAsync(t){if(!gt)return t();let r=gt.getStore();if(!r)return t();let{executionId:n}=r;return await gt.run({...r,trusted:!0,forceUntrusted:!1},async()=>{ot.enterTrustedScope(n);try{return await t()}finally{ot.leaveTrustedScope(n)}})}static async runUntrustedAsync(t){if(!gt)return t();let r=gt.getStore();return r?gt.run({...r,trusted:!1,forceUntrusted:!0},t):t()}shouldBlock(){if(ii||this.config.auditMode||!gt)return!1;let t=gt?.getStore();return!(t?.sandboxActive!==!0||ot.isTrustedContext(t))}shouldAudit(){if(!this.config.auditMode||!gt)return!1;let t=gt.getStore();return t?.sandboxActive===!0&&!ot.isTrustedContext(t)}recordViolation(t,r,n){let i={timestamp:D_(),type:t,message:n,path:r,stack:new Error().stack,executionId:gt?.getStore()?.executionId};if(this.violations.length{let o=`${r} ${s} is blocked during script execution`,l=i.recordViolation(n,r,o);throw new He(o,l)};return new Proxy(t,{set(s,o,l,u){return i.shouldBlock()&&a("modification"),Reflect.set(s,o,l,u)},defineProperty(s,o,l){return i.shouldBlock()&&a("defineProperty"),Reflect.defineProperty(s,o,l)},deleteProperty(s,o){return i.shouldBlock()&&a("deletion"),Reflect.deleteProperty(s,o)},setPrototypeOf(s,o){return i.shouldBlock()&&a("setPrototypeOf"),Reflect.setPrototypeOf(s,o)},preventExtensions(s){return i.shouldBlock()&&a("preventExtensions"),Reflect.preventExtensions(s)}})}applyPatches(){this.patchFailures=[];let t=k4(),r=new Set(this.config.excludeViolationTypes??[]),n=new Set(["process_send","process_channel","process_stdout","process_stderr"]),i=[];for(let o of t)if(!r.has(o.violationType)&&!n.has(o.violationType)){if(o.strategy==="freeze"){i.push(o);continue}this.applyPatch(o)}this.protectConstructorChain(),r.has("error_prepare_stack_trace")||this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),py()&&this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.protectProxyRevocable();let a=["Function.prototype.constructor","Module._load","Module._resolveFilename"],s=this.patchFailures.filter(o=>a.includes(o));if(s.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${s.join(", ")}`);this.config.processLifetimeIntrinsicHardening||this.protectReversibleIntrinsics(i);for(let o of i)this.applyPatch(o,this.config.processLifetimeIntrinsicHardening===!0);this.config.processLifetimeIntrinsicHardening&&this.lockWellKnownSymbols()}protectReversibleIntrinsics(t){let r=new Set,n=(s,o)=>{let l=Object.getOwnPropertyDescriptor(s,o);!l||!("value"in l)||l.writable!==!0||l.configurable!==!0||(this.temporaryIntrinsicDescriptors.push({target:s,prop:o,descriptor:l}),Object.defineProperty(s,o,{...l,writable:!1}))};for(let{target:s,prop:o}of t){let l=s[o];if(!(typeof l!="object"||l===null)){r.add(l);for(let u of Reflect.ownKeys(l))n(l,u)}}let i=[];for(let s of[Array,Map,Set,RegExp,Promise])i.push([s,Symbol.species]);for(let s of[Array.prototype,String.prototype,Map.prototype,Set.prototype])i.push([s,Symbol.iterator]);i.push([Symbol.prototype,Symbol.toPrimitive],[Date.prototype,Symbol.toPrimitive],[Function.prototype,Symbol.hasInstance],[Array.prototype,Symbol.unscopables]);for(let s of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])i.push([RegExp.prototype,s]);for(let s of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])i.push([s,Symbol.toStringTag]);for(let[s,o]of i)r.add(s),n(s,o);let a=(s,o,l)=>{let u=Object.getOwnPropertyDescriptor(s,o);if(!u||!("value"in u)||typeof u.value!="function"||u.configurable!==!0)return;let c=u.value,p=this,d=function(...f){let h=f[0];if(p.shouldBlock()&&typeof h=="object"&&h!==null&&r.has(h)){let m=`${l}.${o}`,g=`${m} is blocked for protected intrinsics during script execution`,x=p.recordViolation("prototype_mutation",m,g);throw new He(g,x)}return Reflect.apply(c,this,f)};this.temporaryIntrinsicDescriptors.push({target:s,prop:o,descriptor:u}),Object.defineProperty(s,o,{...u,value:d,writable:!1})};for(let s of["assign","defineProperties","defineProperty","freeze","preventExtensions","seal","setPrototypeOf"])a(Object,s,"Object");for(let s of["defineProperty","deleteProperty","preventExtensions","set","setPrototypeOf"])a(Reflect,s,"Reflect")}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(t){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(t){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(async function*(){}).constructor,r=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&t!==r&&this.patchPrototypeConstructor(t.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(t){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}}protectErrorPrepareStackTrace(){let t=this;try{let r=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:r});let n=r?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return n},set(i){if(t.shouldBlock()){let a="Error.prepareStackTrace modification is blocked during script execution",s=t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",a);throw new He(a,s)}t.shouldAudit()&&t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),n=i},configurable:!0})}catch(r){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",r instanceof Error?r.message:r)}}protectPromiseThen(){let t=this;try{let n=function(...s){return gt.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,s);if(this.kind==="fulfilled")return s[0];throw s[0]}return Reflect.apply(this.cb,void 0,s)})};var r=n;let i=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:i});let a=i?.value;if(typeof a!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(s,o){if(!gt)return Reflect.apply(a,this,[s,o]);let l=gt.getStore(),u=l?.sandboxActive===!0&&l.trusted!==!0?l.executionId:void 0;if(!u)return Reflect.apply(a,this,[s,o]);let c=t.getCachedContext(u),p=l?.forceUntrusted?{...c,forceUntrusted:!0}:c,d=(f,h)=>typeof f!="function"?f:n.bind({box:t,executionId:u,captured:p,cb:f,kind:h});return Reflect.apply(a,this,[d(s,"fulfilled"),d(o,"rejected")])},writable:!0,configurable:!0})}catch(n){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",n instanceof Error?n.message:n)}}patchPrototypeConstructor(t,r,n){let i=this;try{let a=Object.getOwnPropertyDescriptor(t,"constructor");this.originalDescriptors.push({target:t,prop:"constructor",descriptor:a});let s=a?.value;Object.defineProperty(t,"constructor",{get(){if(i.shouldBlock()){let o=`${r} access is blocked during script execution`,l=i.recordViolation(n,r,o);throw new He(o,l)}return i.shouldAudit()&&i.recordViolation(n,r,`${r} accessed (audit mode)`),s},set(o){if(i.shouldBlock()){let l=`${r} modification is blocked during script execution`,u=i.recordViolation(n,r,l);throw new He(l,u)}Object.defineProperty(this,"constructor",{value:o,writable:!0,configurable:!0})},configurable:!0})}catch(a){this.patchFailures.push(r),console.debug(`[DefenseInDepthBox] Could not patch ${r}:`,a instanceof Error?a.message:a)}}protectProcessMainModule(){if(typeof process>"u")return;let t=this;try{let r=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:r});let n=r?.value;n!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(t.shouldBlock()){let i="process.mainModule access is blocked during script execution",a=t.recordViolation("process_main_module","process.mainModule",i);throw new He(i,a)}return t.shouldAudit()&&t.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),n},set(i){if(t.shouldBlock()){let a="process.mainModule modification is blocked during script execution",s=t.recordViolation("process_main_module","process.mainModule",a);throw new He(a,s)}Object.defineProperty(process,"mainModule",{value:i,writable:!0,configurable:!0})},configurable:!0})}catch(r){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",r instanceof Error?r.message:r)}}protectProcessExecPath(){if(typeof process>"u")return;let t=this;try{let r=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:r});let n=r?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(t.shouldBlock()){let i="process.execPath access is blocked during script execution",a=t.recordViolation("process_exec_path","process.execPath",i);throw new He(i,a)}return t.shouldAudit()&&t.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),n},set(i){if(t.shouldBlock()){let a="process.execPath modification is blocked during script execution",s=t.recordViolation("process_exec_path","process.execPath",a);throw new He(a,s)}Object.defineProperty(process,"execPath",{value:i,writable:!0,configurable:!0})},configurable:!0})}catch(r){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",r instanceof Error?r.message:r)}}lockWellKnownSymbols(){let t=(r,n)=>{try{let i=Object.getOwnPropertyDescriptor(r,n);if(i?.configurable){if("value"in i){Object.defineProperty(r,n,{...i,configurable:!1,writable:!1});return}Object.defineProperty(r,n,{...i,configurable:!1})}}catch{}};for(let r of[Array,Map,Set,RegExp,Promise])t(r,Symbol.species);for(let r of[Array.prototype,String.prototype,Map.prototype,Set.prototype])t(r,Symbol.iterator);t(Symbol.prototype,Symbol.toPrimitive),t(Date.prototype,Symbol.toPrimitive);for(let r of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])t(RegExp.prototype,r);t(Function.prototype,Symbol.hasInstance),t(Array.prototype,Symbol.unscopables);for(let r of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])t(r,Symbol.toStringTag)}protectProxyRevocable(){let t=this;try{let r=Proxy.revocable;if(typeof r!="function")return;let n=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:n}),Object.defineProperty(Proxy,"revocable",{value:function(i,a){if(t.shouldBlock()){let s="Proxy.revocable is blocked during script execution",o=t.recordViolation("proxy","Proxy.revocable",s);throw new He(s,o)}return t.shouldAudit()&&t.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),r(i,a)},writable:!1,configurable:!0})}catch(r){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",r instanceof Error?r.message:r)}}protectDynamicImport(){if(!(ii||ot.importHooksRegistered))try{let t=Ts;if(!t)throw new Error("node:module is unavailable");let r=new Set;for(let a of t.builtinModules??[]){let s=a.startsWith("node:")?a.slice(5):a;r.add(s);let o=s.indexOf("/");o>0&&r.add(s.slice(0,o))}let n=a=>{if(a.startsWith("./")||a.startsWith("../")||a.startsWith("/")||a.startsWith("file:")||a.startsWith("data:")||a.startsWith("blob:")||a.startsWith("http:")||a.startsWith("https:"))return!1;let s=a.startsWith("node:")?a.slice(5):a;if(!s)return!1;if(typeof t.isBuiltin=="function"&&t.isBuiltin(s)||r.has(s))return!0;let o=s.indexOf("/");return o>0&&r.has(s.slice(0,o))},i=a=>{let s=gt?.getStore();return a.config.auditMode===!0&&s?.sandboxActive===!0&&!ot.isTrustedContext(s)};if(typeof t.registerHooks=="function"){t.registerHooks({resolve(a,s,o){let l=ot.instance;if(!l)return o(a,s);if((a.startsWith("data:")||a.startsWith("blob:"))&&l.shouldBlock()){let u=`import(${a.startsWith("data:")?"data:":"blob:"})`,c=`dynamic import of ${a.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`,p=l.recordViolation("dynamic_import_builtin",u,c);throw new He(c,p)}if(n(a)){let u=`import(${a})`,c=`dynamic import of Node.js builtin '${a}' is blocked during script execution`;if(l.shouldBlock()){let p=l.recordViolation("dynamic_import_builtin",u,c);throw new He(c,p)}i(l)&&l.recordViolation("dynamic_import_builtin",u,`dynamic import of Node.js builtin '${a}' called (audit mode)`)}return o(a,s)}}),ot.importHooksRegistered=!0;return}throw new Error("context-aware ESM loader hooks (node:module.registerHooks) are unavailable")}catch(t){throw new Error(`DefenseInDepthBox: could not register dynamic-import hooks: ${t instanceof Error?t.message:String(t)}`,{cause:t})}}protectModuleLoad(){this.protectModuleMethod("_load","module_load")}protectModuleResolveFilename(){this.protectModuleMethod("_resolveFilename","module_resolve_filename")}protectModuleMethod(t,r){if(ii)return;let n=`Module.${t}`;try{let i=md,a=i?.[t];if(!i||typeof a!="function")throw new Error("node:module Module class or method is unavailable");let s=Object.getOwnPropertyDescriptor(i,t);if(!s)throw new Error("method has no own property descriptor");if(s.configurable===!1&&s.writable===!1)throw new Error("method is non-configurable and non-writable");let o=u=>this.createBlockingProxy(u,n,r),l=o(a);if(this.originalDescriptors.push({target:i,prop:t,descriptor:s}),"value"in s){Object.defineProperty(i,t,{...s,value:l});let u=Object.getOwnPropertyDescriptor(i,t);if(i[t]!==l||u?.value!==l)throw new Error("installed patch failed verification")}else{let u=s.get,c=s.set;if(typeof c!="function")throw new Error("accessor has no setter to install protection through");this.moduleAccessorResets.push(()=>{c.call(i,a)});let p={configurable:s.configurable,enumerable:s.enumerable,get:u,set:f=>{if(this.shouldBlock()){let g=`${n} modification is blocked during script execution`,x=this.recordViolation(r,n,g);throw new He(g,x)}this.shouldAudit()&&this.recordViolation(r,n,`${n} modified (audit mode)`);let h=typeof f=="function"?o(f):f,m=u?.call(i);try{d(h)}catch(g){throw d(m),g}}},d=f=>{try{c.call(i,f)}finally{Object.defineProperty(i,t,p)}let h=Object.getOwnPropertyDescriptor(i,t);if(h?.get!==p.get||h?.set!==p.set||u?.call(i)!==f||i[t]!==f)throw new Error("installed patch failed accessor verification")};d(l)}}catch{this.patchFailures.push(n)}}applyPatch(t,r=!1){let{target:n,prop:i,violationType:a,strategy:s}=t;try{let o=n[i];if(o===void 0)return;let l=Object.getOwnPropertyDescriptor(n,i);if(this.originalDescriptors.push({target:n,prop:i,descriptor:l}),s==="freeze"){if(typeof o=="object"&&o!==null){r&&Object.freeze(o);let u=this.getPathForTarget(n,i),c=this.createReadonlyObjectProxy(o,u,a);Object.defineProperty(n,i,{...l,value:c})}}else{let u=this.getPathForTarget(n,i),c=typeof o=="function"?this.createBlockingProxy(o,u,a):this.createBlockingObjectProxy(o,u,a,t.allowedKeys);Object.defineProperty(n,i,{value:c,writable:!0,configurable:!0})}}catch(o){let l=this.getPathForTarget(n,i);this.patchFailures.push(l),console.debug(`[DefenseInDepthBox] Could not patch ${l}:`,o instanceof Error?o.message:o)}}restorePatches(){for(let t=this.moduleAccessorResets.length-1;t>=0;t--)try{this.moduleAccessorResets[t]()}catch(r){console.debug("[DefenseInDepthBox] Could not reset module accessor override slot:",r instanceof Error?r.message:r)}this.moduleAccessorResets=[];for(let t=this.temporaryIntrinsicDescriptors.length-1;t>=0;t--){let{target:r,prop:n,descriptor:i}=this.temporaryIntrinsicDescriptors[t];try{Object.defineProperty(r,n,i)}catch(a){console.debug(`[DefenseInDepthBox] Could not restore temporary intrinsic ${String(n)}:`,a instanceof Error?a.message:a)}}this.temporaryIntrinsicDescriptors=[];for(let t=this.originalDescriptors.length-1;t>=0;t--){let{target:r,prop:n,descriptor:i}=this.originalDescriptors[t];try{i?Object.defineProperty(r,n,i):delete r[n]}catch(a){let s=this.getPathForTarget(r,n);console.debug(`[DefenseInDepthBox] Could not restore ${s}:`,a instanceof Error?a.message:a)}}this.originalDescriptors=[]}}});function I4(e){return typeof e!="function"?e:rn.bindCurrentContext(e)}function Ph(e,t){if(t===Number.POSITIVE_INFINITY)return;let r=I4(e),n={cleared:!1,remainingMs:Math.max(0,t),timer:void 0},i=()=>{if(n.cleared)return;let a=Math.min(n.remainingMs,$4);n.timer=Bh(()=>{n.cleared||(n.remainingMs-=a,n.remainingMs>0?i():r())},a)};return i(),n}function Fh(e){e&&(e.cleared=!0,e.timer!==void 0&&Uh(e.timer))}var Bh,Uh,U_,z_,al,Zc,$4,Xs=q(()=>{"use strict";ln(),Bh=globalThis.setTimeout.bind(globalThis),Uh=globalThis.clearTimeout.bind(globalThis),U_=globalThis.setInterval.bind(globalThis),z_=globalThis.clearInterval.bind(globalThis),al=((e,t,...r)=>Bh(I4(e),t,...r)),Zc=Uh,$4=2147483647});function u0(e,t,r){if(!Number.isSafeInteger(e)||e<0||!Number.isSafeInteger(t)||t<0||e>t)throw new RangeError(`${r}: byte conversion limit exceeded (${t} bytes)`)}function K(e){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8");let t=0;for(let r=0;r=55296&&n<=56319&&r+1=56320&&i<=57343?(t+=4,r++):t+=3}else t+=3}return t}function Ve(e,t=Xc){let r=e;if(!r)return r;u0(r.length,t,"UTF-8 decode");let n=!1;for(let a=0;a255)return r;s>127&&(n=!0)}if(!n)return r;let i=new Uint8Array(r.length);for(let a=0;a{"use strict";L4=new TextDecoder("utf-8",{fatal:!0}),M4=new TextEncoder,Xc=512*1024*1024,yc="",zh=8192});function P4(e){return e instanceof Oi||e instanceof Ii||e instanceof di}var ur,Oi,Ii,di,$i,gn,at,Mt,Ti,yl,c0,T,zt,bl,Ci,J=q(()=>{"use strict";ge(),ur=class extends Error{stdout;stderr;internalOutputAccounting={stdout:0,stderr:0};constructor(e,t="",r=""){super(e),this.stdout=t,this.stderr=r}prependOutput(e,t){this.stdout=e+this.stdout,this.stderr=t+this.stderr,this.internalOutputAccounting.stdout+=K(e),this.internalOutputAccounting.stderr+=K(t)}},Oi=class extends ur{levels;name="BreakError";constructor(e=1,t="",r=""){super("break",t,r),this.levels=e}},Ii=class extends ur{levels;name="ContinueError";constructor(e=1,t="",r=""){super("continue",t,r),this.levels=e}},di=class extends ur{exitCode;name="ReturnError";constructor(e=0,t="",r=""){super("return",t,r),this.exitCode=e}},$i=class extends ur{exitCode;name="ErrexitError";constructor(e,t="",r=""){super(`errexit: command exited with status ${e}`,t,r),this.exitCode=e}},gn=class extends ur{varName;name="NounsetError";constructor(e,t=""){super(`${e}: unbound variable`,t,`bash: ${e}: unbound variable `),this.varName=e}},at=class extends ur{exitCode;name="ExitError";constructor(e,t="",r=""){super("exit",t,r),this.exitCode=e}},Mt=class extends ur{name="ArithmeticError";fatal;constructor(e,t="",r="",n=!1){super(e,t,r),this.stderr=r||`bash: ${e} `,this.fatal=n}},Ti=class extends ur{name="BadSubstitutionError";constructor(e,t="",r=""){super(e,t,r),this.stderr=r||`bash: ${e}: bad substitution `}},yl=class extends ur{name="GlobError";constructor(e,t="",r=""){super(`no match: ${e}`,t,r),this.stderr=r||`bash: no match: ${e} `}},c0=class extends ur{name="BraceExpansionError";constructor(e,t="",r=""){super(e,t,r),this.stderr=r||`bash: ${e} `}},T=class extends ur{limitType;name="ExecutionLimitError";static EXIT_CODE=126;constructor(e,t,r="",n=""){super(e,r,n),this.limitType=t,this.stderr=n||`bash: ${e} `}},zt=class extends ur{name="ExecutionAbortedError";constructor(e="",t=""){super("execution aborted",e,t)}},bl=class extends ur{name="SubshellExitError";constructor(e="",t=""){super("subshell exit",e,t)}},Ci=class extends ur{exitCode;name="PosixFatalError";constructor(e,t="",r=""){super("posix fatal error",t,r),this.exitCode=e}}});function p0(...e){let t=[...new Set(e.filter(i=>i!==void 0))];if(t.length===0)return{signal:void 0,cleanup(){}};if(t.length===1)return{signal:t[0],cleanup(){}};let r=new AbortController,n=[];for(let i of t){if(i.aborted){r.abort(i.reason);break}let a=()=>r.abort(i.reason);i.addEventListener("abort",a,{once:!0}),n.push([i,a])}return{signal:r.signal,cleanup(){for(let[i,a]of n)i.removeEventListener("abort",a)}}}async function F4(e,t,r){if(!t)return e;if(t.aborted)throw e.catch(()=>{}),new zt("",r);let n;try{return await Promise.race([e,new Promise((i,a)=>{n=()=>a(new zt("",r)),t.addEventListener("abort",n,{once:!0})})])}finally{n&&t.removeEventListener("abort",n)}}var wl=q(()=>{"use strict";J()});function Pn(e,t,r){let n=r==="width"?Math.abs(e):e;if(!Number.isFinite(e)||!Number.isSafeInteger(e)||n<0||n>t)throw new T(`format ${r} limit exceeded (${t} bytes)`,"string_length")}function Qc(e,t,r,n=Kc){Pn(t,n,"width"),r!==-1&&Pn(r,n,"precision");let i=e;r>=0&&i.length>r&&(i=i.slice(0,r));let a=Math.abs(t);if(a>i.length){if(K(i)+a-i.length>n)throw new T(`formatted value size limit exceeded (${n} bytes)`,"string_length");t<0?i=i.padEnd(a," "):i=i.padStart(a," ")}if(K(i)>n)throw new T(`formatted value size limit exceeded (${n} bytes)`,"string_length");return i}function H_(e,t,r=Kc){let n=t,i=0,a=-1,s=!1;for(n0&&(i=-i),Pn(i,r,"width"),a!==-1&&Pn(a,r,"precision"),[i,a,n-t]}function B4(e,t=Kc){if(K(e)>t)throw new T(`escaped string size limit exceeded (${t} bytes)`,"string_length");let r="",n=0;for(;n0){try{let s=new TextDecoder("utf-8",{fatal:!0});r+=s.decode(new Uint8Array(i))}catch{for(let s of i)r+=String.fromCharCode(s)}n=a}else r+=e[n],n++;break}case"u":{let i="",a=n+2;for(;a{"use strict";ge(),J(),ge(),Kc=10*1024*1024}),U4={};ce(U4,{echoCommand:()=>z4,flagsForFuzzing:()=>q4});function W_(e){let t="",r=0;for(;r=e.length){t+="\\";break}let n=e[r+1];switch(n){case"\\":t+="\\",r+=2;break;case"n":t+=` `,r+=2;break;case"t":t+=" ",r+=2;break;case"r":t+="\r",r+=2;break;case"a":t+="\x07",r+=2;break;case"b":t+="\b",r+=2;break;case"f":t+="\f",r+=2;break;case"v":t+="\v",r+=2;break;case"e":case"E":t+="\x1B",r+=2;break;case"c":return{output:t,stop:!0};case"0":{let i="",a=r+2;for(;a{"use strict";z4={name:"echo",async execute(e,t){let r=!1,n=t.xpgEcho??!1,i=0;for(;i{"use strict";J(),ln()});function we(e){let t=`${e.name} - ${e.summary} `;if(t+=`Usage: ${e.usage} `,e.description){if(t+=` Description: `,typeof e.description=="string")for(let r of e.description.split(` `))t+=r?` ${r} `:` `;else if(e.description.length>0)for(let r of e.description)t+=r?` ${r} `:` `}if(e.options&&e.options.length>0){t+=` Options: `;for(let r of e.options)t+=` ${r} `}if(e.examples&&e.examples.length>0){t+=` Examples: `;for(let r of e.examples)t+=` ${r} `}if(e.notes&&e.notes.length>0){t+=` Notes: `;for(let r of e.notes)t+=` ${r} `}return{stdout:t,stderr:"",exitCode:0}}function Ce(e){return e.includes("--help")}function Le(e,t){return{stdout:"",stderr:t.startsWith("--")?`${e}: unrecognized option '${t}' `:`${e}: invalid option -- '${t.replace(/^-/,"")}' `,exitCode:1}}var be=q(()=>{"use strict"});function ar(e,t,r){let n=new Map,i=new Map;for(let[l,u]of Object.entries(r)){let c={name:l,type:u.type};u.short&&n.set(u.short,c),u.long&&i.set(u.long,c)}let a=Object.create(null);for(let[l,u]of Object.entries(r))u.default!==void 0?a[l]=u.default:u.type==="boolean"&&(a[l]=!1);let s=[],o=!1;for(let l=0;l=t.length)return{ok:!1,error:{stdout:"",stderr:`${e}: option '--${p}' requires an argument `,exitCode:1}};d=t[++l]}a[h]=m==="number"?parseInt(d,10):d}}else{let c=u.slice(1);for(let p=0;p{"use strict";be()}),Yc=q(()=>{"use strict"});function H4(e,t,r){if(!Number.isSafeInteger(t)||t<0||t>e.limits.maxInputBytes)throw new T(`${r}: input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");e.executionScope?.consumeInput(t,r)}async function bc(e,t,r){let{cmdName:n,allowStdinMarker:i=!0,stopOnError:a=!1,batchSize:s=100}=r;if(t.length===0)return{files:[{filename:"",content:e.stdin}],stderr:"",exitCode:0};let o=[],l="",u=0;for(let c=0;c{if(i&&f==="-")return{filename:"-",content:e.stdin,error:null};try{let h=e.fs.resolvePath(e.cwd,f),m=await Mi(e.fs,h);return{filename:f,content:m,error:null}}catch{return{filename:f,content:yc,error:`${n}: ${f}: No such file or directory `}}}));for(let f of d)if(f.error){if(l+=f.error,u=1,a)return{files:o,stderr:l,exitCode:u}}else o.push({filename:f.filename,content:f.content})}return{files:o,stderr:l,exitCode:u}}async function f0(e,t,r){let n=await bc(e,t,{...r,stopOnError:!0});return n.exitCode!==0?{ok:!1,error:{stdout:"",stderr:n.stderr,exitCode:n.exitCode}}:{ok:!0,content:n.files.map(i=>i.content).join("")}}var Ja=q(()=>{"use strict";ge(),J(),Yc()}),W4={};ce(W4,{catCommand:()=>j4,flagsForFuzzing:()=>G4});function G_(e){if(e>=32){if(e<127)return String.fromCharCode(e);if(e===127)return"^?";let t=e-128;return t>=32?t===127?"M-^?":`M-${String.fromCharCode(t)}`:`M-^${String.fromCharCode(t+64)}`}return`^${String.fromCharCode(e+64)}`}function V_(e,t,r){if(!t.showNonprinting&&!t.showTabs)return e;let n="",i=a=>{if(a.length>r-n.length)throw new T("cat: output size limit exceeded","output_size");n+=a};for(let a=0;an)throw new T(`cat: array element limit exceeded (${n})`,"array_elements");let a=e.split(` `),s="",o=1,l=!1,u=c=>{if(c.length>r-s.length)throw new T(`cat: output size limit exceeded (${r} bytes)`,"output_size");s+=c};for(let c=0;c{"use strict";ge(),Ar(),J(),sr(),Ja(),be(),my={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-A, --show-all equivalent to -vET","-b, --number-nonblank number nonempty output lines, overrides -n","-e equivalent to -vE","-E, --show-ends display $ at end of each line","-n, --number number all output lines","-s, --squeeze-blank suppress repeated empty output lines","-t equivalent to -vT","-T, --show-tabs display TAB characters as ^I","-u (ignored)","-v, --show-nonprinting use ^ and M- notation, except for LFD and TAB"," --help display this help and exit"]},gy={number:{short:"n",long:"number",type:"boolean"},numberNonblank:{short:"b",long:"number-nonblank",type:"boolean"},showEnds:{short:"E",long:"show-ends",type:"boolean"},showTabs:{short:"T",long:"show-tabs",type:"boolean"},showNonprinting:{short:"v",long:"show-nonprinting",type:"boolean"},showAll:{short:"A",long:"show-all",type:"boolean"},squeeze:{short:"s",long:"squeeze-blank",type:"boolean"},vE:{short:"e",type:"boolean"},vT:{short:"t",type:"boolean"},ignored:{short:"u",type:"boolean"}},j4={name:"cat",async execute(e,t){if(Ce(e))return we(my);let r=ar("cat",e,gy);if(!r.ok)return r.error;let n=r.result.flags,i=n.showEnds||n.showAll||n.vE,a=n.showTabs||n.showAll||n.vT,s=n.showNonprinting||n.showAll||n.vE||n.vT,o=n.squeeze,l=n.numberNonblank,u=n.number&&!l,c={numberAll:u,numberNonblank:l,showEnds:i,showTabs:a,showNonprinting:s,squeeze:o},p=r.result.positional,d=t.limits.maxStringLength,f=Math.min(d,t.limits.maxOutputSize),h=p.length===0?["-"]:p,m="",g=0,x=0,y,b=i||a||s||o||u||l,k="";for(let w of h)try{let v=w==="-"?t.stdin:await Mi(t.fs,t.fs.resolvePath(t.cwd,w)),A=v,R=A.length,I=Math.min(b?d:f,t.limits.maxInputBytes);if(R>I-x)throw new T(`cat: ${b?"input":"output"} size limit exceeded (${I} bytes)`,b?"string_length":"output_size");w!=="-"&&H4(t,R,"cat"),x+=R,k+=A}catch(v){Ge(v),m+=`cat: ${w}: No such file or directory `,g=1}return b?y=Z_(k,c,f,t.limits.maxArrayElements):y=k,{stdout:y,stderr:m,exitCode:g,stdoutEncoding:"binary"}}},G4={name:"cat",flags:[{flag:"-n",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-t",type:"boolean"}],stdinType:"text",needsFiles:!0}});function Fr(e){return e instanceof Error?e.message:String(e)}function V4(e){return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"?e.code:e instanceof Error?/^(E[A-Z]+)\b/.exec(e.message)?.[1]:void 0}var Br=q(()=>{"use strict"});function Xo(e,t,r,n={}){let i=new Date(t*1e3),a=Q_(i,r),s="",o=0,l=0,u=0,c=new Map,p=d=>{let f=K(d);if(n.maxOutputBytes!==void 0&&f>n.maxOutputBytes-o)throw new T(`strftime: output size limit exceeded (${n.maxOutputBytes} bytes)`,"output_size");s+=d,o+=f};for(;ln.maxOperations)throw new T(`strftime: iteration limit exceeded (${n.maxOperations})`,"iterations");if(e[l]==="%"&&l+1n.find(u=>u.type===l)?.value??"",a=new Map([["Sun",0],["Mon",1],["Tue",2],["Wed",3],["Thu",4],["Fri",5],["Sat",6]]),s=i("weekday"),o=(l,u)=>{let c=Number.parseInt(l,10);return Number.isNaN(c)?u:c};return{year:o(i("year"),e.getFullYear()),month:o(i("month"),e.getMonth()+1),day:o(i("day"),e.getDate()),hour:o(i("hour"),e.getHours())%24,minute:o(i("minute"),e.getMinutes()),second:o(i("second"),e.getSeconds()),weekday:a.get(s)??e.getDay()}}catch{return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),weekday:e.getDay()}}}function K_(e,t,r,n){let i=(l,u=2)=>String(l).padStart(u,"0"),a=Z4(t.year,t.month,t.day),s=xy(t.year,t.month,t.day,t.weekday,0),o=xy(t.year,t.month,t.day,t.weekday,1);switch(r){case"a":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.weekday];case"A":return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][t.weekday];case"b":case"h":return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.month-1];case"B":return["January","February","March","April","May","June","July","August","September","October","November","December"][t.month-1];case"c":return`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.weekday]} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.month-1]} ${String(t.day).padStart(2," ")} ${i(t.hour)}:${i(t.minute)}:${i(t.second)} ${t.year}`;case"C":return i(Math.floor(t.year/100));case"d":return i(t.day);case"D":return`${i(t.month)}/${i(t.day)}/${i(t.year%100)}`;case"e":return String(t.day).padStart(2," ");case"F":return`${t.year}-${i(t.month)}-${i(t.day)}`;case"g":return i(yy(t.year,t.month,t.day)%100);case"G":return String(yy(t.year,t.month,t.day));case"H":return i(t.hour);case"I":return i(t.hour%12||12);case"j":return String(a).padStart(3,"0");case"k":return String(t.hour).padStart(2," ");case"l":return String(t.hour%12||12).padStart(2," ");case"m":return i(t.month);case"M":return i(t.minute);case"n":return` `;case"N":return"000000000";case"p":return t.hour<12?"AM":"PM";case"P":return t.hour<12?"am":"pm";case"r":return`${i(t.hour%12||12)}:${i(t.minute)}:${i(t.second)} ${t.hour<12?"AM":"PM"}`;case"R":return`${i(t.hour)}:${i(t.minute)}`;case"s":return String(Math.floor(e.getTime()/1e3));case"S":return i(t.second);case"t":return" ";case"T":return`${i(t.hour)}:${i(t.minute)}:${i(t.second)}`;case"u":return String(t.weekday===0?7:t.weekday);case"U":return i(s);case"V":return i(eO(t.year,t.month,t.day));case"w":return String(t.weekday);case"W":return i(o);case"x":return`${i(t.month)}/${i(t.day)}/${i(t.year%100)}`;case"X":return`${i(t.hour)}:${i(t.minute)}:${i(t.second)}`;case"y":return i(t.year%100);case"Y":return String(t.year);case"z":return Y_(e,n);case"Z":return J_(e,n);case"%":return"%";default:return null}}function Y_(e,t){if(!t){let s=-e.getTimezoneOffset(),o=s>=0?"+":"-",l=Math.floor(Math.abs(s)/60),u=Math.abs(s)%60;return`${o}${String(l).padStart(2,"0")}${String(u).padStart(2,"0")}`}try{let s=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).formatToParts(e).find(o=>o.type==="timeZoneName");if(s){let o=s.value.match(/GMT([+-])(\d{2}):(\d{2})/);if(o)return`${o[1]}${o[2]}${o[3]}`;if(s.value==="GMT"||s.value==="UTC")return"+0000"}}catch{}let r=-e.getTimezoneOffset(),n=r>=0?"+":"-",i=Math.floor(Math.abs(r)/60),a=Math.abs(r)%60;return`${n}${String(i).padStart(2,"0")}${String(a).padStart(2,"0")}`}function J_(e,t){try{return new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(e).find(r=>r.type==="timeZoneName")?.value??"UTC"}catch{return"UTC"}}function Z4(e,t,r){let n=[31,28,31,30,31,30,31,31,30,31,30,31];(e%4===0&&e%100!==0||e%400===0)&&(n[1]=29);let i=r;for(let a=0;a{"use strict";J(),ir()}),Q4={};ce(Q4,{flagsForFuzzing:()=>Y4,printfCommand:()=>K4});function tO(e){let t="",r=0;for(;r=194){let i=(n&31)<<6|e[r+1]&63;t+=String.fromCharCode(i),r+=2;continue}t+=String.fromCharCode(n),r++;continue}if((n&240)===224){if(r+2=55296&&i<=57343){t+=String.fromCharCode(n),r++;continue}t+=String.fromCharCode(i),r+=3;continue}t+=String.fromCharCode(n),r++;continue}if((n&248)===240&&n<=244){if(r+31114111){t+=String.fromCharCode(n),r++;continue}t+=String.fromCodePoint(i),r+=4;continue}t+=String.fromCharCode(n),r++;continue}t+=String.fromCharCode(n),r++}return t}function rO(e,t,r,n,i=10*1024*1024){let a="",s=0,o=0,l=!1,u="",c=0,p=d=>{let f=K(d);if(f>i-c)throw new T(`printf: output size limit exceeded (${i} bytes)`,"string_length");a+=d,c+=f};for(;s=0?Pn(A,i-c,"precision"):Number.isSafeInteger(A)||Pn(A,i-c,"precision"),o++,x=x.replace(".*",`.${A}`)}iO(x,i-c);let y=t[r+o]||"";o++;let{value:b,parseError:k,parseErrMsg:w,stopped:v}=nO(x,g,y,i-c);if(p(b),k&&(l=!0,w&&(u=w)),v)return{result:a,argsConsumed:o,error:l,errMsg:u,stopped:!0}}else p(e[s]),s++;return{result:a,argsConsumed:o,error:l,errMsg:u,stopped:!1}}function nO(e,t,r,n){let i=!1,a="";switch(t){case"d":case"i":{let s=Iu(r);return i=wn,i&&(a=`printf: ${r}: invalid number `),{value:by(e,s),parseError:i,parseErrMsg:a}}case"o":{let s=Iu(r);return i=wn,i&&(a=`printf: ${r}: invalid number `),{value:aO(e,s),parseError:i,parseErrMsg:a}}case"u":{let s=Iu(r);i=wn,i&&(a=`printf: ${r}: invalid number `);let o=s<0?s>>>0:s;return{value:by(e.replace("u","d"),o),parseError:i,parseErrMsg:a}}case"x":case"X":{let s=Iu(r);return i=wn,i&&(a=`printf: ${r}: invalid number `),{value:sO(e,s),parseError:i,parseErrMsg:a}}case"e":case"E":case"f":case"F":case"g":case"G":{let s=parseFloat(r)||0;return{value:cO(e,t,s),parseError:!1,parseErrMsg:""}}case"c":{if(r==="")return{value:"",parseError:!1,parseErrMsg:""};let s=new TextEncoder().encode(r)[0];return{value:String.fromCharCode(s),parseError:!1,parseErrMsg:""}}case"s":return{value:lO(e,r,n),parseError:!1,parseErrMsg:""};case"q":return{value:uO(e,r,n),parseError:!1,parseErrMsg:""};case"b":{let s=pO(r,n);return{value:s.value,parseError:!1,parseErrMsg:"",stopped:s.stopped}}default:try{return{value:(0,es.sprintf)(e,r),parseError:!1,parseErrMsg:""}}catch{return{value:"",parseError:!0,parseErrMsg:`printf: [sprintf] unexpected placeholder `}}}}function iO(e,t){let r=e.match(/^%[-+0 #' ]*(\d*)(?:\.(\d*))?/);if(!r)return;let n=r[1]?Number(r[1]):0,i=r[2]!==void 0?Number(r[2]):-1;Pn(n,t,"width"),i!==-1&&Pn(i,t,"precision")}function Iu(e){wn=!1;let t=e.trimStart(),r=t!==t.trimEnd();if(e=t.trimEnd(),e.startsWith("'")&&e.length>=2||e.startsWith('"')&&e.length>=2)return e.charCodeAt(1);if(e.startsWith("\\'")&&e.length>=3||e.startsWith('\\"')&&e.length>=3)return e.charCodeAt(2);if(e.startsWith("+")&&(e=e.slice(1)),e.startsWith("0x")||e.startsWith("0X")){let n=parseInt(e,16);return Number.isNaN(n)?(wn=!0,0):(r&&(wn=!0),n)}if(e.startsWith("0")&&e.length>1&&/^-?0[0-7]+$/.test(e))return r&&(wn=!0),parseInt(e,8)||0;if(/^\d+#/.test(e)){wn=!0;let n=e.match(/^(\d+)#/);return n?parseInt(n[1],10):0}if(e!==""&&!/^-?\d+$/.test(e)){wn=!0;let n=parseInt(e,10);return Number.isNaN(n)?0:n}return r&&(wn=!0),parseInt(e,10)||0}function by(e,t){let r=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[diu]$/);if(!r)return(0,es.sprintf)(e.replace(/\.\d*/,""),t);let n=r[1]||"",i=r[2]?parseInt(r[2],10):0,a=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,s=t<0,o=Math.abs(t),l=String(o);a>=0&&(l=l.padStart(a,"0"));let u="";s?u="-":n.includes("+")?u="+":n.includes(" ")&&(u=" ");let c=u+l;return i>c.length&&(n.includes("-")?c=c.padEnd(i," "):n.includes("0")&&a<0?c=u+l.padStart(i-u.length,"0"):c=c.padStart(i," ")),c}function aO(e,t){let r=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?o$/);if(!r)return(0,es.sprintf)(e,t);let n=r[1]||"",i=r[2]?parseInt(r[2],10):0,a=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,s=Math.abs(t).toString(8);a>=0&&(s=s.padStart(a,"0")),n.includes("#")&&!s.startsWith("0")&&(s=`0${s}`);let o=s;return i>o.length&&(n.includes("-")?o=o.padEnd(i," "):n.includes("0")&&a<0?o=o.padStart(i,"0"):o=o.padStart(i," ")),o}function sO(e,t){let r=e.includes("X"),n=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[xX]$/);if(!n)return(0,es.sprintf)(e,t);let i=n[1]||"",a=n[2]?parseInt(n[2],10):0,s=n[3]!==void 0?n[4]?parseInt(n[4],10):0:-1,o=Math.abs(t).toString(16);r&&(o=o.toUpperCase()),s>=0&&(o=o.padStart(s,"0"));let l="";i.includes("#")&&t!==0&&(l=r?"0X":"0x");let u=l+o;return a>u.length&&(i.includes("-")?u=u.padEnd(a," "):i.includes("0")&&s<0?u=l+o.padStart(a-l.length,"0"):u=u.padStart(a," ")),u}function oO(e,t){if(e===""){if(t<2)throw new T(`printf: output size limit exceeded (${t} bytes)`,"string_length");return"''"}if(/^[a-zA-Z0-9_./-]+$/.test(e)){if(K(e)>t)throw new T(`printf: output size limit exceeded (${t} bytes)`,"string_length");return e}let r=/[\x00-\x1f\x7f-\xff]/.test(e),n=r?3:0;for(let a of e){let s=a.charCodeAt(0);if(r?a==="'"||a==="\\"||a===` `||a===" "||a==="\r"||a==="\x07"||a==="\b"||a==="\f"||a==="\v"||a==="\x1B"||a==='"'?n+=2:s<32||s>=127&&s<=255?n+=4:n+=K(a):n+=K(a)+(" |&;<>()$`\\\"'*?[#~=%!{}".includes(a)?1:0),n>t)throw new T(`printf: output size limit exceeded (${t} bytes)`,"string_length")}if(r){let a="$'";for(let s of e){let o=s.charCodeAt(0);s==="'"?a+="\\'":s==="\\"?a+="\\\\":s===` `?a+="\\n":s===" "?a+="\\t":s==="\r"?a+="\\r":s==="\x07"?a+="\\a":s==="\b"?a+="\\b":s==="\f"?a+="\\f":s==="\v"?a+="\\v":s==="\x1B"?a+="\\E":o<32||o>=127&&o<=255?a+=`\\${o.toString(8).padStart(3,"0")}`:s==='"'?a+='\\"':a+=s}return a+="'",a}let i="";for(let a of e)" |&;<>()$`\\\"'*?[#~=%!{}".includes(a)?i+=`\\${a}`:i+=a;return i}function lO(e,t,r){let n=e.match(/^%(-?)(\d*)(\.(\d*))?s$/);if(!n)return(0,es.sprintf)(e.replace(/0+(?=\d)/,""),t);let i=n[1]==="-",a=n[2]?parseInt(n[2],10):0,s=n[3]!==void 0?n[4]?parseInt(n[4],10):0:-1,o=i?-a:a;return Qc(t,o,s,r)}function uO(e,t,r){let n=oO(t,r),i=e.match(/^%(-?)(\d*)q$/);if(!i)return n;let a=i[1]==="-",s=i[2]?parseInt(i[2],10):0;return Qc(n,a?-s:s,-1,r)}function cO(e,t,r){let n=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[eEfFgG]$/);if(!n)return(0,es.sprintf)(e,r);let i=n[1]||"",a=n[2]?parseInt(n[2],10):0,s=n[3]!==void 0?n[4]?parseInt(n[4],10):0:6,o,l=t.toLowerCase();if(l==="e"?(o=r.toExponential(s),o=o.replace(/e([+-])(\d)$/,"e$10$2"),t==="E"&&(o=o.toUpperCase())):l==="f"?(o=r.toFixed(s),i.includes("#")&&s===0&&!o.includes(".")&&(o+=".")):l==="g"?(o=r.toPrecision(s||1),i.includes("#")||(o=o.replace(/\.?0+$/,""),o=o.replace(/\.?0+e/,"e")),o=o.replace(/e([+-])(\d)$/,"e$10$2"),t==="G"&&(o=o.toUpperCase())):o=r.toString(),r>=0&&(i.includes("+")?o=`+${o}`:i.includes(" ")&&(o=` ${o}`)),a>o.length)if(i.includes("-"))o=o.padEnd(a," ");else if(i.includes("0")){let u=o.match(/^[+ -]/)?.[0]||"",c=u?o.slice(1):o;o=u+c.padStart(a-u.length,"0")}else o=o.padStart(a," ");return o}function pO(e,t){if(K(e)>t)throw new T(`printf: output size limit exceeded (${t} bytes)`,"string_length");let r="",n=0;for(;n0?(r+=tO(i),n=a):(r+="\\x",n+=2);break}case"u":{let i="",a=n+2;for(;a{"use strict";J(),Br(),be(),ir(),X4(),wy={name:"printf",summary:"format and print data",usage:"printf [-v var] FORMAT [ARGUMENT...]",options:[" -v var assign the output to shell variable VAR rather than display it"," --help display this help and exit"],notes:["FORMAT controls the output like in C printf.","Escape sequences: \\n (newline), \\t (tab), \\\\ (backslash)","Format specifiers: %s (string), %d (integer), %f (float), %x (hex), %o (octal), %% (literal %)","Width and precision: %10s (width 10), %.2f (2 decimal places), %010d (zero-padded)","Flags: %- (left-justify), %+ (show sign), %0 (zero-pad)"]},K4={name:"printf",async execute(e,t){if(Ce(e))return we(wy);if(e.length===0)return{stdout:"",stderr:`printf: usage: printf format [arguments] `,exitCode:2,internalStdinConsumed:0};let r=null,n=0;for(;n=e.length)return{stdout:"",stderr:`printf: -v: option requires an argument `,exitCode:1,internalStdinConsumed:0};if(r=e[n+1],!/^[a-zA-Z_][a-zA-Z0-9_]*(?:\[[^\]\n]+\])?$/.test(r)||/[;\r\\]/.test(r)||r.includes(".."))return{stdout:"",stderr:`printf: \`${r}': not a valid identifier `,exitCode:2,internalStdinConsumed:0};n+=2}else{if(s.startsWith("-")&&s!=="-")break;break}}if(n>=e.length)return{stdout:"",stderr:`printf: usage: printf format [arguments] `,exitCode:1,internalStdinConsumed:0};let i=e[n],a=e.slice(n+1);try{let s=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),o=B4(i,s),l="",u=0,c=0,p=!1,d="",f=t.env.get("TZ");do{let{result:h,argsConsumed:m,error:g,errMsg:x,stopped:y}=rO(o,a,c,f,s-u),b=K(h);if(b>s-u)throw new T(`printf: output size limit exceeded (${s} bytes)`,"string_length");if(l+=h,u+=b,c+=m,g&&(p=!0,x&&(d=x)),y)break}while(c0);if(c===0&&a.length>0,r){let h=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(['"]?)(.+?)\2\]$/);if(h){let m=h[1],g=h[3];if(g=g.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(x,y)=>t.env.get(y)??""),t.assignShellVariable)await t.assignShellVariable(m,l,g);else throw new Error("printf -v array assignment requires an interpreter assignment gateway")}else if(t.assignShellVariable)await t.assignShellVariable(r,l);else{if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))throw new Error(`${r}: not a valid identifier`);t.env.set(r,l)}return{stdout:"",stderr:d,exitCode:p?1:0,internalStdinConsumed:0}}return{stdout:l,stderr:d,exitCode:p?1:0,internalStdinConsumed:0}}catch(s){if(s instanceof T||typeof s=="object"&&s!==null&&"name"in s&&s.name==="ExitError")throw s;return{stdout:"",stderr:`printf: ${Fr(s)} `,exitCode:1,internalStdinConsumed:0}}}},wn=!1,Y4={name:"printf",flags:[{flag:"-v",type:"value",valueHint:"string"}],stdinType:"none",needsArgs:!0}});function Ji(e,t){if(!Number.isSafeInteger(e)||e<0)throw new T(`${t}: invalid bounded allocation count`,"array_elements")}function J4(e){return new T(`${e}: invalid bounded allocation count`,"array_elements")}function bs(e,t,r){Ji(e,r),Ji(t,r);let n=e+t;if(!Number.isSafeInteger(n))throw J4(r);return n}function dO(e,t,r){if(Ji(e,r),Ji(t,r),e!==0&&t>Math.floor(Number.MAX_SAFE_INTEGER/e))throw J4(r);return e*t}function hO(e,t,r,n){let i=new St(r,n);return i.repeat(e,t),i.build()}function Wa(e,t,r,n){let i=new St(r,n);for(let a=0;a0&&i.append(t),i.append(e[a]);return i.build()}var St,Yt=q(()=>{"use strict";ge(),J(),St=class{maxBytes;label;createLimitError;reservedBytes;chunks=[];usedBytes=0;constructor(e,t,r=void 0,n=0){this.maxBytes=e,this.label=t,this.createLimitError=r,this.reservedBytes=n,Ji(e,t),Ji(n,t),n>e&&this.fail()}fail(){throw this.createLimitError?.()??new T(`${this.label}: output size limit exceeded (${this.maxBytes} bytes)`,"output_size")}get byteLength(){return this.usedBytes}get remainingBytes(){return this.maxBytes-this.reservedBytes-this.usedBytes}reserve(e){Ji(e,this.label),e>this.remainingBytes&&this.fail()}append(e){let t=K(e);return this.reserve(t),e&&this.chunks.push(e),this.usedBytes+=t,this}repeat(e,t){Ji(t,this.label);let r=K(e);return r!==0&&t>Math.floor(this.remainingBytes/r)&&this.fail(),this.append(e.repeat(t))}reset(){this.chunks.length=0,this.usedBytes=0}build(){return this.chunks.join("")}}});function Be(e){if(!e||e==="/")return"/";let t=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;t.startsWith("/")||(t=`/${t}`);let r=t.split("/").filter(i=>i&&i!=="."),n=[];for(let i of r)i===".."?n.pop():n.push(i);return`/${n.join("/")}`||"/"}function ja(e,t){let r=Be(e),n=Be(t);return n===r||r==="/"||n.startsWith(`${r}/`)}function Gt(e,t){if(e.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${t} '${e}'`)}function Ua(e){let t=Be(e);if(t==="/")return"/";let r=t.lastIndexOf("/");return r===0?"/":t.slice(0,r)}function ew(e,t){if(t.startsWith("/"))return Be(t);let r=e==="/"?`/${t}`:`${e}/${t}`;return Be(r)}function Mn(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function gd(e,t){if(t.startsWith("/"))return Be(t);let r=Ua(e);return Be(Mn(r,t))}var vl=q(()=>{"use strict"});function mO(e,t,r){if(!e)return e;let n=e.replace(/\n\s+at\s.*/g,"");return r&&(n=n.replace(/\bfile:\/\/\/?[^\s'",)}\]:]+/g,"")),n=n.replace(t?/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap|workspace|root|srv|mnt|app))\b[^\s'",)}\]:]*/g:/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap))\b[^\s'",)}\]:]*/g,""),n=n.replace(/node:internal\/[^\s'",)}\]:]+/g,""),n=n.replace(/[A-Z]:\\[^\s'",)}\]:]+/g,""),r&&(n=n.replace(/\\\\[^\s\\]+\\[^\s'",)}\]:]+/g,"")),n}function Xt(e){return mO(e,!1,!1)}var Nn=q(()=>{"use strict"});function tw(e){if(e.identity!==void 0)return`identity:${e.identity}`;if(e.dev!==void 0&&e.ino!==void 0)return`inode:${String(e.dev)}:${String(e.ino)}`}function vy(e){let t=e instanceof Error?e.message:String(e);return t.includes("ENOENT")||t.includes("no such file")}async function li(e,t,r){let n=Be(t),i;try{i=await e.stat(n)}catch(o){if(!vy(o))return{existence:"unknown"}}if(i!==void 0){let o=tw(i);try{return{existence:"existing",canonicalPath:Be(await e.realpath(n)),stableIdentity:o}}catch{return o===void 0?{existence:"unknown"}:{existence:"existing",stableIdentity:o}}}let a=[],s=n;for(;;){r?.checkpoint();let o=Ua(s);if(o===s)return{existence:"unknown"};a.unshift(s.slice(o==="/"?1:o.length+1)),s=o;try{let l=Be(await e.realpath(s));return{existence:"missing",canonicalPath:a.reduce((u,c)=>Mn(u,c),l)}}catch(l){if(!vy(l))return{existence:"missing"}}}}async function rw(e,t,r){let[n,i]=await Promise.all([li(e,t),li(e,r)]);return n.existence==="unknown"||i.existence==="unknown"?"unknown":n.existence==="missing"||i.existence==="missing"?n.existence!==i.existence?"different":n.canonicalPath!==void 0&&n.canonicalPath===i.canonicalPath?"same":"unknown":n.stableIdentity!==void 0&&i.stableIdentity!==void 0?n.stableIdentity===i.stableIdentity?"same":"different":n.canonicalPath!==void 0&&n.canonicalPath===i.canonicalPath?"same":"unknown"}async function nw(e,t,r,n){let[i,a]=await Promise.all([li(e,t,n),li(e,r,n)]);return i.existence!=="existing"||i.canonicalPath===void 0||a.existence==="unknown"||a.canonicalPath===void 0?"unknown":ja(i.canonicalPath,a.canonicalPath)?"inside":"outside"}async function El(e,t){let r=e.budget??new Wn(e),n=[{kind:"enter",path:Be(e.root),depth:0}],i=new Set;for(;n.length>0;){r.checkpoint(0);let a=n.pop();if(!a)break;if(a.kind==="leave"){e.includeLeave&&await t({path:a.path,depth:a.depth,stat:a.stat,isSymlink:a.isSymlink,phase:"leave"}),a.identity&&i.delete(a.identity);continue}r.visit(a.depth);let s=await e.fs.lstat(a.path),o=s.isSymbolicLink,l=o&&e.symlinks==="follow"?await e.fs.stat(a.path):s;if(await t({path:a.path,depth:a.depth,stat:l,isSymlink:o,phase:"enter"}),!l.isDirectory||o&&e.symlinks!=="follow")continue;let u=tw(l)??await e.fs.realpath(a.path).then(Be).catch(()=>{});if(u!==void 0){if(i.has(u))throw new iw(e.site,a.path,"symbolic-link directory cycle detected");i.add(u)}n.push({kind:"leave",path:a.path,depth:a.depth,stat:l,isSymlink:o,identity:u});let c=await e.fs.readdir(a.path);r.checkpoint(),c.sort((p,d)=>p.localeCompare(d));for(let p=c.length-1;p>=0;p--)n.push({kind:"enter",path:Mn(a.path,c[p]),depth:a.depth+1})}}var iw,Wn,jn=q(()=>{"use strict";J(),vl(),Nn(),iw=class extends Error{operation;virtualPath;name="FileSystemPolicyError";constructor(e,t,r){super(`${e}: ${Xt(r)}`),this.operation=e,this.virtualPath=t}},Wn=class{options;entries=0;discoveredEntries=1;work=0;constructor(e){this.options=e}checkpoint(e=1){if(this.options.signal?.aborted)throw new zt;if(this.options.executionScope?.throwIfAborted(this.options.site),!Number.isSafeInteger(e)||e<0||e>this.options.limits.maxTraversalWork-this.work)throw new T(`${this.options.site}: ${this.options.label??"filesystem traversal work"} limit exceeded (${this.options.limits.maxTraversalWork})`,"iterations");this.work+=e,this.options.executionScope?.consumeWork(e,`${this.options.site} filesystem traversal`)}visit(e){if(this.checkpoint(),e>this.options.limits.maxTraversalDepth)throw new T(`${this.options.site}: ${this.options.label??"filesystem traversal"} depth limit exceeded (${this.options.limits.maxTraversalDepth})`,"recursion");if(++this.entries>this.options.limits.maxTraversalEntries)throw new T(`${this.options.site}: ${this.options.label??"filesystem traversal"} entry limit exceeded (${this.options.limits.maxTraversalEntries})`,"iterations")}reserve(e){if(!Number.isSafeInteger(e)||e<0||e>this.options.limits.maxTraversalEntries-this.discoveredEntries)throw new T(`${this.options.site}: ${this.options.label??"filesystem traversal"} entry limit exceeded (${this.options.limits.maxTraversalEntries})`,"iterations");this.discoveredEntries+=e}discover(e){this.reserve(e),this.checkpoint(e)}}}),aw={};ce(aw,{flagsForFuzzing:()=>uw,lsCommand:()=>lw});function Ir(e,t,r){if(K(r)>e.limits.maxOutputSize-K(t))throw new T(`ls: output size limit exceeded (${e.limits.maxOutputSize} bytes)`,"output_size");return t+r}function sw(e,t){if(t>e.limits.maxArrayElements)throw new T(`ls: array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements")}function gO(e,t,r){sw(e,r),t.reserve(r)}function Ey(e,t){let r=new St(e.limits.maxOutputSize,"ls");for(let n=0;n0&&r.append(` `),r.append(t[n]);return t.length>0&&r.append(` `),r.build()}function qh(e){if(e<1024)return String(e);if(e<1024*1024){let r=e/1024;return r<10?`${r.toFixed(1)}K`:`${Math.round(r)}K`}if(e<1024*1024*1024){let r=e/1048576;return r<10?`${r.toFixed(1)}M`:`${Math.round(r)}M`}let t=e/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function Hh(e){let t=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=String(e.getDate()).padStart(2," "),n=new Date,i=new Date(n.getTime()-4320*60*60*1e3);if(e>i){let s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");return`${t} ${r} ${s}:${o}`}let a=e.getFullYear();return`${t} ${r} ${a}`}function Yo(e){return e.isDirectory?"/":e.isSymbolicLink?"@":(e.mode&73)!==0?"*":""}function xO(e,t,r){if(!t&&!r)return"name";if(t!==r)return t?"size":"time";let n="name";for(let i of e){if(i==="--")break;if(!(!i.startsWith("-")||i.startsWith("--")))for(let a of i.slice(1))a==="S"?n="size":a==="t"&&(n="time")}return n}async function xd(e,t,r,n,i){return await Wh(e,a=>t.fs.resolvePath(t.cwd,a),t,r,n,i)}async function Wh(e,t,r,n,i,a){let s=[...e];if(n==="name")s.sort();else{a?.checkpoint(s.length);let o=new Map;for(let l of s)try{let u=await r.fs.lstat(t(l));o.set(l,n==="size"?u.size??0:(u.mtime??new Date(0)).getTime())}catch{o.set(l,0)}s.sort((l,u)=>{let c=(o.get(u)??0)-(o.get(l)??0);return c!==0?c:lu?1:0})}return i&&s.reverse(),s}async function ow(e,t,r,n,i,a,s,o=!1,l=!1,u="name",c=!1,p=!1,d=new Wn({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"ls"}),f=0,h=new Set,m=!1){let g=r||n,x=t.fs.resolvePath(t.cwd,e);try{m||d.visit(f);let y=await t.fs.stat(x);if(!y.isDirectory){let I=c?Yo(await t.fs.lstat(x)):"";if(i){let $=y.size??0,_=l?qh($).padStart(5):String($).padStart(5),M=y.mtime??new Date(0),P=Hh(M);return{stdout:`-rw-r--r-- 1 user user ${_} ${P} ${e}${I} `,stderr:"",exitCode:0}}return{stdout:`${e}${I} `,stderr:"",exitCode:0}}let b=y.identity??(y.dev!==void 0&&y.ino!==void 0?`${String(y.dev)}:${String(y.ino)}`:await t.fs.realpath(x).catch(()=>{}));if(b!==void 0&&h.has(b))return{stdout:"",stderr:`ls: ${e}: symbolic link cycle detected `,exitCode:2};let k=new Set(h);b!==void 0&&k.add(b);let w=await t.fs.readdir(x);d.checkpoint(),gO(t,d,w.length+(r?2:0)),g||(w=w.filter(I=>!I.startsWith("."))),w=await Wh(w,I=>x==="/"?`/${I}`:`${x}/${I}`,t,u,!1,d),r&&(w=[".","..",...w]),o&&w.reverse();let v="",A="",R=0;if((a||s)&&(v=Ir(t,v,`${e}: `)),i){v=Ir(t,v,`total ${w.length} `);let I=w.filter(P=>P==="."||P===".."),$=w.filter(P=>P!=="."&&P!=="..");for(let P of I)v=Ir(t,v,`drwxr-xr-x 1 user user 0 Jan 1 00:00 ${P} `);let _=[];for(let P=0;P<$.length;P+=100){let S=$.slice(P,P+100),D=await Promise.all(S.map(async W=>{let j=x==="/"?`/${W}`:`${x}/${W}`;try{let U=await t.fs.stat(j),H=U.isDirectory?"drwxr-xr-x":"-rw-r--r--",z=c?Yo(await t.fs.lstat(j)):"",ee=U.size??0,Y=l?qh(ee).padStart(5):String(ee).padStart(5),ne=U.mtime??new Date(0),Z=Hh(ne);return{name:W,line:`${H} 1 user user ${Y} ${Z} ${W}${z} `}}catch{return{name:W,line:`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${W} `}}}));_.push(...D)}let M=new Map($.map((P,S)=>[P,S]));_.sort((P,S)=>(M.get(P.name)??0)-(M.get(S.name)??0));for(let{line:P}of _)v=Ir(t,v,P)}else if(c){let I=[],$=w.filter(M=>M!=="."&&M!==".."),_=w.filter(M=>M==="."||M==="..");for(let M of _)I.push(`${M}/`);for(let M=0;M<$.length;M+=100){let P=$.slice(M,M+100),S=await Promise.all(P.map(async D=>{let W=x==="/"?`/${D}`:`${x}/${D}`;try{let j=await t.fs.lstat(W);return`${D}${Yo(j)}`}catch{return D}}));I.push(...S)}v=Ir(t,v,Ey(t,I))}else v=Ir(t,v,Ey(t,w));if(a){let I=w.filter(D=>D!=="."&&D!==".."),$=new Set(I),_=[];if(t.fs.readdirWithFileTypes){let D=await t.fs.readdirWithFileTypes(x);d.checkpoint(),sw(t,D.length),_=D.filter(W=>W.isDirectory&&$.has(W.name)).map(W=>({name:W.name,isDirectory:!0}))}else for(let D=0;D{let H=x==="/"?`/${U}`:`${x}/${U}`;try{let z=await t.fs.stat(H);return{name:U,isDirectory:z.isDirectory}}catch{return{name:U,isDirectory:!1}}}));_.push(...j.filter(U=>U.isDirectory))}let M=await Wh(_.map(D=>D.name),D=>x==="/"?`/${D}`:`${x}/${D}`,t,u,o,d),P=new Map(M.map((D,W)=>[D,W]));_.sort((D,W)=>(P.get(D.name)??0)-(P.get(W.name)??0));let S=[];for(let D of _){let W=e==="."?`./${D.name}`:`${e}/${D.name}`,j=await ow(W,t,r,n,i,a,!1,o,l,u,c,!0,d,f+1,k);S.push({name:D.name,result:j})}S.sort((D,W)=>(P.get(D.name)??0)-(P.get(W.name)??0));for(let{result:D}of S)v=Ir(t,v,` `),v=Ir(t,v,D.stdout),A=Ir(t,A,D.stderr),D.exitCode!==0&&(R=D.exitCode)}return{stdout:v,stderr:A,exitCode:R}}catch(y){if(y instanceof T||y instanceof zt)throw y;return{stdout:"",stderr:`ls: ${e}: No such file or directory `,exitCode:2}}}var Sy,Ay,lw,uw,yO=q(()=>{"use strict";Yt(),ge(),jn(),J(),sr(),Yc(),be(),Sy={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-F, --classify append indicator (one of */=>@) to entries","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},Ay={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},classifyFiles:{short:"F",long:"classify",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},lw={name:"ls",async execute(e,t){if(Ce(e))return we(Sy);let r=ar("ls",e,Ay);if(!r.ok)return r.error;let n=r.result.flags.showAll,i=r.result.flags.showAlmostAll,a=r.result.flags.longFormat,s=r.result.flags.humanReadable,o=r.result.flags.recursive,l=r.result.flags.reverse,u=r.result.flags.classifyFiles,c=r.result.flags.directoryOnly,p=xO(e,r.result.flags.sortBySize,r.result.flags.sortByTime);r.result.flags.onePerLine;let d=r.result.positional;d.length===0&&d.push(".");let f="",h="",m=0,g=new Wn({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"ls"});if(c){for(let w of await xd(d,t,p,l,g)){g.visit(0);let v=t.fs.resolvePath(t.cwd,w);try{let A=await t.fs.stat(v);if(a){let R=A.isDirectory?"drwxr-xr-x":"-rw-r--r--",I=u?Yo(await t.fs.lstat(v)):"",$=A.size??0,_=s?qh($).padStart(5):String($).padStart(5),M=A.mtime??new Date(0),P=Hh(M);f=Ir(t,f,`${R} 1 user user ${_} ${P} ${w}${I} `)}else{let R=u?Yo(await t.fs.lstat(v)):"";f=Ir(t,f,`${w}${R} `)}}catch{h=Ir(t,h,`ls: cannot access '${w}': No such file or directory `),m=2}}return{stdout:f,stderr:h,exitCode:m}}let x=[],y=[];for(let w of d){g.visit(0);try{(await t.fs.stat(t.fs.resolvePath(t.cwd,w))).isDirectory?(y.length>0&&g.reserve(1),y.push(w)):x.push(w)}catch{h=Ir(t,h,`ls: ${w}: No such file or directory `),m=2}}let b=async(w,v)=>{let A=await ow(w,t,n,i,a,o,v,l,s,p,u,!1,g,0,new Set,!0);f=Ir(t,f,A.stdout),h=Ir(t,h,A.stderr),A.exitCode!==0&&(m=A.exitCode)};for(let w of await xd(x,t,p,l,g))await b(w,!1);let k=d.length>1;for(let w of await xd(y,t,p,l,g))f&&(f=Ir(t,f,` `)),await b(w,k);return{stdout:f,stderr:h,exitCode:m}}},uw={name:"ls",flags:[{flag:"-a",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-1",type:"boolean"}],needsFiles:!0}}),cw={};ce(cw,{flagsForFuzzing:()=>fw,mkdirCommand:()=>pw});var Cy,pw,fw,bO=q(()=>{"use strict";Nn(),Br(),sr(),Cy={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},pw={name:"mkdir",async execute(e,t){let r=ar("mkdir",e,Cy);if(!r.ok)return r.error;let n=r.result.flags.recursive,i=r.result.flags.verbose,a=r.result.positional;if(a.length===0)return{stdout:"",stderr:`mkdir: missing operand `,exitCode:1};let s="",o="",l=0;for(let u of a)try{let c=t.fs.resolvePath(t.cwd,u);await t.fs.mkdir(c,{recursive:n}),i&&(s+=`mkdir: created directory '${u}' `)}catch(c){let p=Fr(c);p.includes("ENOENT")||p.includes("no such file")?o+=`mkdir: cannot create directory '${u}': No such file or directory `:p.includes("EEXIST")||p.includes("already exists")?o+=`mkdir: cannot create directory '${u}': File exists `:o+=`mkdir: cannot create directory '${u}': ${Xt(p)} `,l=1}return{stdout:s,stderr:o,exitCode:l}}},fw={name:"mkdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}});async function wO(e,t,r){if(!e.createExclusive)throw new d0(t,r.directory?"mkdir":"open");await e.createExclusive(t,r)}var d0,dw=q(()=>{"use strict";d0=class extends Error{code="ENOSYS";constructor(e,t){super(`ENOSYS: filesystem cannot create entries atomically, ${t} '${e}'`),this.name="ExclusiveCreateUnsupportedError"}}}),hw={};ce(hw,{flagsForFuzzing:()=>vw,mktempCommand:()=>ww});function mw(e,t){let r=!1,n=!1;for(let i of e){if(n||r){t(i,!1),r=!1;continue}if(i==="--"){n=!0,t(i,!1);continue}if(!i.startsWith("-")||i==="-"){t(i,!1);continue}(i==="--suffix"||i==="--tmpdir"||/^-[a-z]*p$/.test(i))&&(r=i!=="--tmpdir"),t(i,!0)}}function vO(e){let t=new Set,r=new Set,n=new Set;for(let s of Object.values(jh))s.long&&t.add(s.long),s.short&&(r.add(s.short),s.type!=="boolean"&&n.add(s.short));let i=null,a=!1;return mw(e,(s,o)=>{if(!(a||i||!o)){if(s.startsWith("--")){let l=s.indexOf("="),u=l===-1?s.slice(2):s.slice(2,l);u==="help"||u==="version"?i=l===-1?u:`no-arg:${u}`:t.has(u)||(a=!0);return}for(let l of s.slice(1)){if(l==="h"){i="help";return}if(!r.has(l)){a=!0;return}if(n.has(l))return}}}),i}function EO(e){let t=[];return mw(e,(r,n)=>{t.push(n&&r==="--tmpdir"?"--tmpdir=":r)}),t}function SO(e){let t=new Uint8Array(Math.min(e,bw)),r="";for(;r.length=yw)&&(r+=wc[n%wc.length],r.length===e))break}return r}function AO(e,t){return e.endsWith("/")?`${e}${t}`:`${e}/${t}`}function La(e){return{stdout:"",stderr:`mktemp: ${e} `,exitCode:1}}function CO(e,t){let r=e,n=t??"";if(t===void 0){let a=e.lastIndexOf("X");a!==-1&&(r=e.slice(0,a+1),n=e.slice(a+1))}else if(!e.endsWith("X"))return La(`with --suffix, template '${e}' must end in X`);if(n.includes("/"))return La(`invalid suffix '${n}', contains directory separator`);let i=0;for(;i{"use strict";dw(),Nn(),Br(),sr(),be(),ky=`mktemp (just-bash) 9.4 `,Ny="tmp.XXXXXXXXXX",xw=3,Ty=100,wc="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",yw=256-256%wc.length,_y=384,Oy=448,Iy={name:"mktemp",summary:"create a temporary file or directory and print its name",usage:"mktemp [OPTION]... [TEMPLATE]",description:["Create a uniquely named temporary file (or directory with -d) and write","its name to standard output. TEMPLATE must end in at least three 'X's,","which are replaced with random characters; it defaults to tmp.XXXXXXXXXX.","Without -p/-t/--tmpdir a bare TEMPLATE is relative to the current","directory, while the default template is placed in $TMPDIR (or /tmp).","Files are created with mode 0600 and directories with mode 0700."],options:["-d, --directory create a directory, not a file","-u, --dry-run do not create anything, merely print a name","-q, --quiet suppress diagnostics about creation failure"," --suffix=SUFF append SUFF to TEMPLATE (must not contain a slash)","-p DIR, --tmpdir[=DIR] interpret TEMPLATE relative to DIR"," (defaults to $TMPDIR, or /tmp when unset)","-t interpret TEMPLATE as a single file name"," component, relative to the temporary directory","-h, --help display this help and exit"," --version output version information and exit"],examples:["mktemp","mktemp -d","mktemp /tmp/build-XXXXXX","mktemp --suffix=.txt fileXXXXXX"]},jh={directory:{short:"d",long:"directory",type:"boolean"},dryRun:{short:"u",long:"dry-run",type:"boolean"},quiet:{short:"q",long:"quiet",type:"boolean"},tmpdir:{short:"p",long:"tmpdir",type:"string"},legacyT:{short:"t",type:"boolean"},suffix:{long:"suffix",type:"string"}},bw=65536,ww={name:"mktemp",async execute(e,t){let r=vO(e);if(r==="help")return we(Iy);if(r==="version")return{stdout:ky,stderr:"",exitCode:0};if(r?.startsWith("no-arg:"))return La(`option '--${r.slice(7)}' doesn't allow an argument`);let n=ar("mktemp",EO(e),jh);if(!n.ok)return n.error;let{flags:i,positional:a}=n.result;if(a.length>1)return La("too many templates");let s=a.length===1?a[0]:Ny,o=CO(s,i.suffix);if(NO(o))return o;let l=t.env.get("TMPDIR"),u=l||"/tmp",c=null;if(i.legacyT){if(s.includes("/"))return La(`invalid template, '${s}', contains directory separator`);c=l||(i.tmpdir?i.tmpdir:"/tmp")}else if(i.tmpdir!==void 0||a.length===0){if(s.startsWith("/"))return La(`invalid template, '${s}'; with --tmpdir, it may not be absolute`);c=i.tmpdir?i.tmpdir:u}let p=i.directory?"directory":"file",d=c===null?o.stem:AO(c,o.stem),f=d.slice(0,d.length-o.xCount),h=m=>({stdout:"",stderr:i.quiet?"":`mktemp: failed to create ${p} via template '${s}': ${m} `,exitCode:1});if(!i.dryRun){let m=d.lastIndexOf("/"),g=t.fs.resolvePath(t.cwd,m===-1?".":d.slice(0,m)||"/");try{if(!(await t.fs.stat(g)).isDirectory)return h("Not a directory")}catch{return h("No such file or directory")}}for(let m=0;mAw,rmdirCommand:()=>Sw});async function _O(e,t,r,n,i){let a="",s="",o=e.fs.resolvePath(e.cwd,t),l=await $y(e,o,t,n);if(a+=l.stdout,s+=l.stderr,l.exitCode!==0)return{stdout:a,stderr:s,exitCode:l.exitCode};if(r){let u=o,c=t;for(;;){i.visit(0);let p=Dy(u),d=Dy(c);if(p===u||p==="/"||p==="."||d==="."||d==="")break;let f=await $y(e,p,d,n);if(a+=f.stdout,f.exitCode!==0)break;u=p,c=d}}return{stdout:a,stderr:s,exitCode:0}}async function $y(e,t,r,n){try{if(!await e.fs.exists(t))return{stdout:"",stderr:`rmdir: failed to remove '${r}': No such file or directory `,exitCode:1};if(!(await e.fs.stat(t)).isDirectory)return{stdout:"",stderr:`rmdir: failed to remove '${r}': Not a directory `,exitCode:1};if((await e.fs.readdir(t)).length>0)return{stdout:"",stderr:`rmdir: failed to remove '${r}': Directory not empty `,exitCode:1};await e.fs.rm(t,{recursive:!1,force:!1});let i="";return n&&(i=`rmdir: removing directory, '${r}' `),{stdout:i,stderr:"",exitCode:0}}catch(i){let a=Fr(i);return{stdout:"",stderr:`rmdir: failed to remove '${r}': ${a} `,exitCode:1}}}function Dy(e){let t=e.replace(/\/+$/,""),r=t.lastIndexOf("/");return r===-1?".":r===0?"/":t.substring(0,r)}var Ry,Ly,Sw,Aw,OO=q(()=>{"use strict";jn(),Br(),sr(),Ry=`Usage: rmdir [-pv] DIRECTORY... Remove empty directories. Options: -p, --parents Remove DIRECTORY and its ancestors -v, --verbose Output a diagnostic for every directory processed`,Ly={parents:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},help:{long:"help",type:"boolean"}},Sw={name:"rmdir",async execute(e,t){let r=ar("rmdir",e,Ly);if(!r.ok)return r.error;if(r.result.flags.help)return{stdout:`${Ry} `,stderr:"",exitCode:0};let n=r.result.flags.parents,i=r.result.flags.verbose,a=r.result.positional;if(a.length===0)return{stdout:"",stderr:`rmdir: missing operand `,exitCode:1};let s="",o="",l=0,u=new Wn({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"rmdir",label:"parent traversal"});for(let c of a){let p=await _O(t,c,n,i,u);s+=p.stdout,o+=p.stderr,p.exitCode!==0&&(l=p.exitCode)}return{stdout:s,stderr:o,exitCode:l}}},Aw={name:"rmdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}}),Cw={};ce(Cw,{flagsForFuzzing:()=>Nw,touchCommand:()=>kw});function IO(e){let t=e.replace(/\//g,"-"),r=new Date(t);if(!Number.isNaN(r.getTime()))return r;let n=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(n){let[,a,s,o]=n;if(r=new Date(Number.parseInt(a,10),Number.parseInt(s,10)-1,Number.parseInt(o,10)),!Number.isNaN(r.getTime()))return r}let i=t.match(/^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})$/);if(i){let[,a,s,o,l,u,c]=i;if(r=new Date(Number.parseInt(a,10),Number.parseInt(s,10)-1,Number.parseInt(o,10),Number.parseInt(l,10),Number.parseInt(u,10),Number.parseInt(c,10)),!Number.isNaN(r.getTime()))return r}return null}var kw,Nw,$O=q(()=>{"use strict";Br(),be(),kw={name:"touch",async execute(e,t){let r=[],n=null,i=!1;for(let l=0;l=e.length)return{stdout:"",stderr:`touch: option requires an argument -- 'd' `,exitCode:1};n=e[++l]}else if(u.startsWith("--date="))n=u.slice(7);else if(u==="-c"||u==="--no-create")i=!0;else if(u==="-a"||u==="-m"||u==="-r"||u==="-t")(u==="-r"||u==="-t")&&l++;else{if(u.startsWith("--"))return Le("touch",u);if(u.startsWith("-")&&u.length>1){let c=!1;for(let p of u.slice(1))if(p==="c")i=!0;else if(!(p==="a"||p==="m"))if(p==="d"){if(l+1>=e.length)return{stdout:"",stderr:`touch: option requires an argument -- 'd' `,exitCode:1};n=e[++l],c=!0;break}else if(p==="r"||p==="t"){l++,c=!0;break}else return Le("touch",`-${p}`);if(c)continue}else r.push(u)}}if(r.length===0)return{stdout:"",stderr:`touch: missing file operand `,exitCode:1};let a=null;if(n!==null&&(a=IO(n),a===null))return{stdout:"",stderr:`touch: invalid date format '${n}' `,exitCode:1};let s="",o=0;for(let l of r)try{let u=t.fs.resolvePath(t.cwd,l);if(!await t.fs.exists(u)){if(i)continue;await t.fs.writeFile(u,"")}let c=a??new Date;await t.fs.utimes(u,c,c)}catch(u){s+=`touch: cannot touch '${l}': ${Fr(u)} `,o=1}return{stdout:"",stderr:s,exitCode:o}}},Nw={name:"touch",flags:[{flag:"-c",type:"boolean"},{flag:"-a",type:"boolean"},{flag:"-m",type:"boolean"},{flag:"-d",type:"value",valueHint:"string"}],needsArgs:!0}}),Tw={};ce(Tw,{flagsForFuzzing:()=>Ow,rmCommand:()=>_w});var My,_w,Ow,DO=q(()=>{"use strict";Nn(),Br(),sr(),My={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},_w={name:"rm",async execute(e,t){let r=ar("rm",e,My);if(!r.ok)return r.error;let n=r.result.flags.recursive||r.result.flags.recursiveUpper,i=r.result.flags.force,a=r.result.flags.verbose,s=r.result.positional;if(s.length===0)return i?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand `,exitCode:1};let o="",l="",u=0;for(let c of s)try{let p=t.fs.resolvePath(t.cwd,c);if((await t.fs.stat(p)).isDirectory&&!n){l+=`rm: cannot remove '${c}': Is a directory `,u=1;continue}await t.fs.rm(p,{recursive:n,force:i}),a&&(o+=`removed '${c}' `)}catch(p){if(!i){let d=Fr(p);d.includes("ENOENT")||d.includes("no such file")?l+=`rm: cannot remove '${c}': No such file or directory `:d.includes("ENOTEMPTY")||d.includes("not empty")?l+=`rm: cannot remove '${c}': Directory not empty `:l+=`rm: cannot remove '${c}': ${Xt(d)} `,u=1}}return{stdout:o,stderr:l,exitCode:u}}},Ow={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}}),Iw={};ce(Iw,{cpCommand:()=>$w,flagsForFuzzing:()=>Dw});var Py,Fy,$w,Dw,RO=q(()=>{"use strict";vl(),jn(),J(),Br(),sr(),be(),Py={name:"cp",summary:"copy files and directories",usage:"cp [OPTION]... SOURCE... DEST",options:["-r, -R, --recursive copy directories recursively","-n, --no-clobber do not overwrite an existing file","-p, --preserve preserve file attributes","-v, --verbose explain what is being done"," --help display this help and exit"]},Fy={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},preserve:{short:"p",long:"preserve",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},$w={name:"cp",async execute(e,t){if(Ce(e))return we(Py);let r=ar("cp",e,Fy);if(!r.ok)return r.error;let n=r.result.flags.recursive||r.result.flags.recursiveUpper,i=r.result.flags.noClobber,a=r.result.flags.preserve,s=r.result.flags.verbose,o=r.result.positional;if(o.length<2)return{stdout:"",stderr:`cp: missing destination file operand `,exitCode:1};let l=o.pop()??"",u=o,c=t.fs.resolvePath(t.cwd,l),p="",d="",f=0,h=new Wn({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"cp"}),m=!1;try{m=(await t.fs.stat(c)).isDirectory}catch{}if(u.length>1&&!m)return{stdout:"",stderr:`cp: target '${l}' is not a directory `,exitCode:1};for(let g of u)try{let x=t.fs.resolvePath(t.cwd,g),y=await t.fs.stat(x),b=c;if(m){let w=g.split("/").pop()||g;b=c==="/"?`/${w}`:`${c}/${w}`}if(y.isDirectory&&!n){d+=`cp: -r not specified; omitting directory '${g}' `,f=1;continue}if(y.isDirectory){let w=await nw(t.fs,x,b,h);if(ja(x,b)||w==="inside"){d+=`cp: cannot copy '${g}' into itself, '${b}' `,f=1;continue}if(w==="unknown"){d+=`cp: cannot safely determine whether '${b}' is inside '${g}' `,f=1;continue}}if(i)try{await t.fs.stat(b);continue}catch{}let k=await rw(t.fs,x,b);if(k==="same"){d+=`cp: '${g}' and '${b}' are the same file `,f=1;continue}if(k==="unknown"){d+=`cp: cannot safely determine whether '${g}' and '${b}' are the same file `,f=1;continue}y.isDirectory&&await El({fs:t.fs,root:x,limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"cp",symlinks:"never",budget:h},()=>{}),await t.fs.cp(x,b,{recursive:n}),s&&(p+=`'${g}' -> '${b}' `)}catch(x){if(x instanceof T||x instanceof zt)throw x;let y=Fr(x);y.includes("ENOENT")||y.includes("no such file")?d+=`cp: cannot stat '${g}': No such file or directory `:d+=`cp: cannot copy '${g}': ${y} `,f=1}return{stdout:p,stderr:d,exitCode:f}}},Dw={name:"cp",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}}),Rw={};ce(Rw,{flagsForFuzzing:()=>Mw,mvCommand:()=>Lw});var By,Uy,Lw,Mw,LO=q(()=>{"use strict";vl(),jn(),J(),Br(),sr(),be(),By={name:"mv",summary:"move (rename) files",usage:"mv [OPTION]... SOURCE... DEST",options:["-f, --force do not prompt before overwriting","-n, --no-clobber do not overwrite an existing file","-v, --verbose explain what is being done"," --help display this help and exit"]},Uy={force:{short:"f",long:"force",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},Lw={name:"mv",async execute(e,t){if(Ce(e))return we(By);let r=ar("mv",e,Uy);if(!r.ok)return r.error;let n=r.result.flags.force,i=r.result.flags.noClobber,a=r.result.flags.verbose,s=r.result.positional;if(i&&(n=!1),s.length<2)return{stdout:"",stderr:`mv: missing destination file operand `,exitCode:1};let o=s.pop()??"",l=s,u=t.fs.resolvePath(t.cwd,o),c="",p="",d=0,f=new Wn({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"mv"}),h=!1;try{h=(await t.fs.stat(u)).isDirectory}catch{}if(l.length>1&&!h)return{stdout:"",stderr:`mv: target '${o}' is not a directory `,exitCode:1};for(let m of l)try{let g=t.fs.resolvePath(t.cwd,m),x=await t.fs.stat(g),y=u;if(h){let k=m.split("/").pop()||m;y=u==="/"?`/${k}`:`${u}/${k}`}if(x.isDirectory){let k=await nw(t.fs,g,y,f);if(ja(g,y)||k==="inside"){p+=`mv: cannot move '${m}' into itself, '${y}' `,d=1;continue}if(k==="unknown"){p+=`mv: cannot safely determine whether '${y}' is inside '${m}' `,d=1;continue}}if(i)try{await t.fs.stat(y);continue}catch{}let b=await rw(t.fs,g,y);if(b==="same")continue;if(b==="unknown"){p+=`mv: cannot safely determine whether '${m}' and '${y}' are the same file `,d=1;continue}if(x.isDirectory&&await El({fs:t.fs,root:g,limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"mv",symlinks:"never",budget:f},()=>{}),await t.fs.mv(g,y),a){let k=h?`${o}/${m.split("/").pop()||m}`:o;c+=`renamed '${m}' -> '${k}' `}}catch(g){if(g instanceof T||g instanceof zt)throw g;let x=Fr(g);x.includes("ENOENT")||x.includes("no such file")?p+=`mv: cannot stat '${m}': No such file or directory `:p+=`mv: cannot move '${m}': ${x} `,d=1}return{stdout:c,stderr:p,exitCode:d}}},Mw={name:"mv",flags:[{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}}),Pw={};ce(Pw,{flagsForFuzzing:()=>Bw,lnCommand:()=>Fw});var zy,Fw,Bw,MO=q(()=>{"use strict";Nn(),be(),zy={name:"ln",summary:"make links between files",usage:"ln [OPTIONS] TARGET LINK_NAME",options:["-s create a symbolic link instead of a hard link","-f remove existing destination files","-n treat LINK_NAME as a normal file if it is a symbolic link to a directory","-v print name of each linked file"," --help display this help and exit"]},Fw={name:"ln",async execute(e,t){if(Ce(e))return we(zy);let r=!1,n=!1,i=!1,a=0;for(;a2)return{stdout:"",stderr:`ln: extra operand '${s[2]}' `,exitCode:1};let o=s[0],l=s[1],u=t.fs.resolvePath(t.cwd,l);if(await t.fs.exists(u))if(n)try{await t.fs.rm(u,{force:!0})}catch{return{stdout:"",stderr:`ln: cannot remove '${l}': Permission denied `,exitCode:1}}else return{stdout:"",stderr:`ln: failed to create ${r?"symbolic ":""}link '${l}': File exists `,exitCode:1};try{if(r)await t.fs.symlink(o,u);else{let p=t.fs.resolvePath(t.cwd,o);if(!await t.fs.exists(p))return{stdout:"",stderr:`ln: failed to access '${o}': No such file or directory `,exitCode:1};await t.fs.link(p,u)}}catch(p){let d=p;return d.message.includes("EPERM")?{stdout:"",stderr:r?`ln: failed to create symbolic link '${l}': Operation not permitted `:`ln: '${o}': hard link not allowed for directory `,exitCode:1}:{stdout:"",stderr:`ln: ${Xt(d.message)} `,exitCode:1}}let c="";return i&&(c=`'${l}' -> '${o}' `),{stdout:c,stderr:"",exitCode:0}}},Bw={name:"ln",flags:[{flag:"-s",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}}),Uw={};ce(Uw,{chmodCommand:()=>zw,flagsForFuzzing:()=>qw});async function PO(e,t,r,n,i,a){let s=new Wn({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"chmod"});await El({fs:e.fs,root:t,symlinks:"never",budget:s,limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"chmod"},async o=>{if(o.depth===0||o.phase!=="enter")return;let l=r!==void 0?r:n!==void 0?Gh(n,o.stat.mode):420;await e.fs.chmod(o.path,l),i&&a.append(`mode of '${o.path}' changed to ${l.toString(8).padStart(4,"0")} `)})}function Gh(e,t=420){if(/^[0-7]+$/.test(e))return parseInt(e,8);let r=t&4095,n=e.split(",");for(let i of n){let a=i.match(/^([ugoa]*)([+\-=])([rwxXst]*)$/);if(!a)throw new Error(`Invalid mode: ${e}`);let s=a[1]||"a",o=a[2],l=a[3];(s==="a"||s==="")&&(s="ugo");let u=0;l.includes("r")&&(u|=4),l.includes("w")&&(u|=2),(l.includes("x")||l.includes("X"))&&(u|=1);let c=0;l.includes("s")&&(s.includes("u")&&(c|=2048),s.includes("g")&&(c|=1024)),l.includes("t")&&(c|=512);for(let p of s){let d=0;p==="u"?d=6:p==="g"?d=3:p==="o"&&(d=0);let f=u<{"use strict";Yt(),Ar(),jn(),be(),qy={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},zw={name:"chmod",async execute(e,t){if(Ce(e))return we(qy);if(e.length<2)return{stdout:"",stderr:`chmod: missing operand `,exitCode:1};let r=!1,n=!1,i=0;for(;ijw,pwdCommand:()=>Ww});var Ww,jw,BO=q(()=>{"use strict";Ww={name:"pwd",async execute(e,t){let r=!1;for(let i of e)if(i==="-P")r=!0;else if(i==="-L")r=!1;else{if(i==="--")break;i.startsWith("-")}let n=t.cwd;if(r)try{n=await t.fs.realpath(t.cwd)}catch{}return{stdout:`${n} `,stderr:"",exitCode:0}}},jw={name:"pwd",flags:[{flag:"-P",type:"boolean"},{flag:"-L",type:"boolean"}]}}),Gw={};ce(Gw,{flagsForFuzzing:()=>Zw,readlinkCommand:()=>Vw});var Hy,Vw,Zw,UO=q(()=>{"use strict";jn(),J(),be(),Hy={name:"readlink",summary:"print resolved symbolic links or canonical file names",usage:"readlink [OPTIONS] FILE...",options:["-f canonicalize by following every symlink in every component of the given name recursively"," --help display this help and exit"]},Vw={name:"readlink",async execute(e,t){if(Ce(e))return we(Hy);let r=!1,n=0;for(;ne.limits.maxArrayElements)throw new T(`${r}: file operand limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(s.length===0)return{stdout:n(e.stdin),stderr:"",exitCode:0,stdoutEncoding:"binary"};let o=Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),l=new St(o,r),u=new St(o,r),c=0,p=0,d=a||!i&&s.length>1,f=0;for(let h=0;he.limits.maxInputBytes-p)throw new T(`${r}: aggregate input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");let x=await Mi(e.fs,g);if(x.length>e.limits.maxInputBytes-p)throw new T(`${r}: aggregate input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");p+=x.length,e.executionScope?.consumeInput(x.length,r),d&&(f>0&&l.append(` `),l.append(Ha(`==> ${m} <== `))),l.append(n(x)),f++}catch(g){Ge(g),u.append(`${r}: ${m}: No such file or directory `),c=1}}return{stdout:l.build(),stderr:u.build(),exitCode:c,stdoutEncoding:"binary"}}function zO(e,t,r){if(r!==null)return e.slice(0,r);if(t===0)return"";let n=0,i=0,a=e.length;for(;n0?e.slice(0,n):""}function qO(e,t,r,n){if(r!==null)return r===0?"":e.slice(-r);let i=e.length;if(i===0)return"";if(n){let o=0,l=1;for(;o=0&&s{"use strict";Yt(),ge(),Ar(),J(),be()}),Yw={};ce(Yw,{flagsForFuzzing:()=>ev,headCommand:()=>Jw});var Wy,Jw,ev,HO=q(()=>{"use strict";be(),Kw(),Wy={name:"head",summary:"output the first part of files",usage:"head [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the first NUM bytes","-n, --lines=NUM print the first NUM lines (default 10)","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},Jw={name:"head",async execute(e,t){if(Ce(e))return we(Wy);let r=Xw(e,"head");if(!r.ok)return r.error;let{lines:n,bytes:i}=r.options;return Qw(t,r.options,"head",a=>zO(a,n,i))}},ev={name:"head",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"text",needsFiles:!0}}),tv={};ce(tv,{flagsForFuzzing:()=>nv,tailCommand:()=>rv});var jy,rv,nv,WO=q(()=>{"use strict";Kw(),be(),jy={name:"tail",summary:"output the last part of files",usage:"tail [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the last NUM bytes","-n, --lines=NUM print the last NUM lines (default 10)","-n +NUM print starting from line NUM","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},rv={name:"tail",async execute(e,t){if(Ce(e))return we(jy);let r=Xw(e,"tail");if(!r.ok)return r.error;let{lines:n,bytes:i,fromLine:a}=r.options;return Qw(t,r.options,"tail",s=>qO(s,n,i,a??!1))}},nv={name:"tail",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"text",needsFiles:!0}}),iv={};ce(iv,{flagsForFuzzing:()=>sv,wcCommand:()=>av});function Gy(e,t){let r=e,n=r.length,i=t?Array.from(Ve(e)).length:n,a=0,s=0,o=!1;for(let l=0;l{"use strict";ge(),sr(),Ja(),be(),Vy={name:"wc",summary:"print newline, word, and byte counts for each file",usage:"wc [OPTION]... [FILE]...",options:["-c, --bytes print the byte counts","-m, --chars print the character counts","-l, --lines print the newline counts","-w, --words print the word counts"," --help display this help and exit"]},Zy={lines:{short:"l",long:"lines",type:"boolean"},words:{short:"w",long:"words",type:"boolean"},bytes:{short:"c",long:"bytes",type:"boolean"},chars:{short:"m",long:"chars",type:"boolean"}},av={name:"wc",async execute(e,t){if(Ce(e))return we(Vy);let r=ar("wc",e,Zy);if(!r.ok)return r.error;let{lines:n,words:i}=r.result.flags,a=r.result.flags.bytes,s=r.result.flags.chars,o=r.result.positional;!n&&!i&&!a&&!s&&(n=i=a=!0);let l=a||s,u=await bc(t,o,{cmdName:"wc",stopOnError:!1});if(o.length===0){let b=Gy(u.files[0].content,s);return{stdout:`${yd(b,n,i,l,"",0)} `,stderr:"",exitCode:0}}let c=[],p=0,d=0,f=0;for(let{filename:b,content:k}of u.files){let w=Gy(k,s);p+=w.lines,d+=w.words,f+=w.third,c.push({filename:b,stats:w})}let h=o.length>1?p:Math.max(...c.map(b=>b.stats.lines)),m=o.length>1?d:Math.max(...c.map(b=>b.stats.words)),g=o.length>1?f:Math.max(...c.map(b=>b.stats.third)),x=o.length>1?3:0;n&&(x=Math.max(x,String(h).length)),i&&(x=Math.max(x,String(m).length)),l&&(x=Math.max(x,String(g).length));let y="";for(let{filename:b,stats:k}of c)y+=`${yd(k,n,i,l,b,x)} `;return o.length>1&&(y+=`${yd({lines:p,words:d,third:f},n,i,l,"total",x)} `),{stdout:y,stderr:u.stderr,exitCode:u.exitCode}}},sv={name:"wc",flags:[{flag:"-l",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-m",type:"boolean"}],stdinType:"text",needsFiles:!0}});function Vh(e,t){let r=t?"d":"-",n=[e&256?"r":"-",e&128?"w":"-",e&64?"x":"-",e&32?"r":"-",e&16?"w":"-",e&8?"x":"-",e&4?"r":"-",e&2?"w":"-",e&1?"x":"-"];return r+n.join("")}var ov=q(()=>{"use strict"}),lv={};ce(lv,{flagsForFuzzing:()=>cv,statCommand:()=>uv});var Xy,Qy,uv,cv,GO=q(()=>{"use strict";ge(),Ar(),J(),sr(),ov(),be(),Xy={name:"stat",summary:"display file or file system status",usage:"stat [OPTION]... FILE...",options:["-c FORMAT use the specified FORMAT instead of the default"," --help display this help and exit"]},Qy={format:{short:"c",type:"string"}},uv={name:"stat",async execute(e,t){if(Ce(e))return we(Xy);let r=ar("stat",e,Qy);if(!r.ok)return r.error;let n=r.result.flags.format??null,i=r.result.positional;if(i.length===0)return{stdout:"",stderr:`stat: missing operand `,exitCode:1};let a="",s="",o=!1,l=0,u=Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),c=p=>{let d=K(p);if(d>u-l)throw new T(`stat: output size limit exceeded (${u} bytes)`,"output_size");a+=p,l+=d};for(let p of i){let d=t.fs.resolvePath(t.cwd,p);try{let f=await t.fs.stat(d);if(n){let h=f.mode.toString(8),m=Vh(f.mode,f.isDirectory),g=new Map([["%n",p],["%N",`'${p}'`],["%s",String(f.size)],["%F",f.isDirectory?"directory":"regular file"],["%a",h],["%A",m],["%u","1000"],["%U","user"],["%g","1000"],["%G","group"]]),x=n.replace(/%[nNsFaAuUgG]/g,y=>g.get(y)??y);c(`${x} `)}else{let h=f.mode.toString(8).padStart(4,"0"),m=Vh(f.mode,f.isDirectory);c(` File: ${p} Size: ${f.size} Blocks: ${Math.ceil(f.size/512)} Access: (${h}/${m}) Modify: ${f.mtime.toISOString()} `)}}catch(f){Ge(f),s+=`stat: cannot stat '${p}': No such file or directory `,o=!0}}return{stdout:a,stderr:s,exitCode:o?1:0}}},cv={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0}}),oe,V,F,Dn,De,et,bd,ba,wd,Ky,Mo,wi,Yy,Jy,Lt,Po,Ct,e6,ti,t6,r6,Me,n6,vd,$u,i6,a6,s6,o6,X,l6,Fo,u6,c6,tt,Ed,Sd,Ad,Cd,kd,Nd,Td,_d,Od,Id,$d,Dd,Rd,Ld,Md,Pd,Fd,Bd,Ud,vi,Du,p6,f6,d6,h6,m6,za,VO=q(()=>{oe=class ka{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=ka.CLASS_NL|ka.DOT_NL;static PERL=ka.CLASS_NL|ka.ONE_LINE|ka.PERL_X|ka.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2},V=class{static CODES=new Map([["\x07",7],["\b",8],[" ",9],[` `,10],["\v",11],["\f",12],["\r",13],[" ",32],['"',34],["$",36],["&",38],["(",40],[")",41],["*",42],["+",43],["-",45],[".",46],["0",48],["1",49],["2",50],["3",51],["4",52],["5",53],["6",54],["7",55],["8",56],["9",57],[":",58],["<",60],[">",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]);static toUpperCase(e){let t=String.fromCodePoint(e).toUpperCase();if(t.length>1)return e;let r=String.fromCodePoint(t.codePointAt(0)).toLowerCase();return r.length>1||r.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){let t=String.fromCodePoint(e).toLowerCase();if(t.length>1)return e;let r=String.fromCodePoint(t.codePointAt(0)).toUpperCase();return r.length>1||r.codePointAt(0)!==e?e:t.codePointAt(0)}},F=class{SIZE=3;constructor(e){this.data=e}getLo(e){return this.data[e*this.SIZE]}getHi(e){return this.data[e*this.SIZE+1]}getStride(e){return this.data[e*this.SIZE+2]}get(e){let t=e*this.SIZE;return[this.data[t],this.data[t+1],this.data[t+2]]}get length(){return this.data.length/this.SIZE}},Dn=class B{static CASE_ORBIT=new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[68944,68976],[68976,68944],[68945,68977],[68977,68945],[68946,68978],[68978,68946],[68947,68979],[68979,68947],[68948,68980],[68980,68948],[68949,68981],[68981,68949],[68950,68982],[68982,68950],[68951,68983],[68983,68951],[68952,68984],[68984,68952],[68953,68985],[68985,68953],[68954,68986],[68986,68954],[68955,68987],[68987,68955],[68956,68988],[68988,68956],[68957,68989],[68989,68957],[68958,68990],[68990,68958],[68959,68991],[68991,68959],[68960,68992],[68992,68960],[68961,68993],[68993,68961],[68962,68994],[68994,68962],[68963,68995],[68995,68963],[68964,68996],[68996,68964],[68965,68997],[68997,68965],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]);static C=new F(new Uint32Array([0,31,1,127,159,1,173,888,715,889,896,7,897,899,1,907,909,2,930,1328,398,1367,1368,1,1419,1420,1,1424,1480,56,1481,1487,1,1515,1518,1,1525,1541,1,1564,1757,193,1806,1807,1,1867,1868,1,1970,1983,1,2043,2044,1,2094,2095,1,2111,2140,29,2141,2143,2,2155,2159,1,2191,2198,1,2274,2436,162,2445,2446,1,2449,2450,1,2473,2481,8,2483,2485,1,2490,2491,1,2501,2502,1,2505,2506,1,2511,2518,1,2520,2523,1,2526,2532,6,2533,2559,26,2560,2564,4,2571,2574,1,2577,2578,1,2601,2609,8,2612,2618,3,2619,2621,2,2627,2630,1,2633,2634,1,2638,2640,1,2642,2648,1,2653,2655,2,2656,2661,1,2679,2688,1,2692,2702,10,2706,2729,23,2737,2740,3,2746,2747,1,2758,2766,4,2767,2769,2,2770,2783,1,2788,2789,1,2802,2808,1,2816,2820,4,2829,2830,1,2833,2834,1,2857,2865,8,2868,2874,6,2875,2885,10,2886,2889,3,2890,2894,4,2895,2900,1,2904,2907,1,2910,2916,6,2917,2936,19,2937,2945,1,2948,2955,7,2956,2957,1,2961,2966,5,2967,2968,1,2971,2973,2,2976,2978,1,2981,2983,1,2987,2989,1,3002,3005,1,3011,3013,1,3017,3022,5,3023,3025,2,3026,3030,1,3032,3045,1,3067,3071,1,3085,3089,4,3113,3130,17,3131,3141,10,3145,3150,5,3151,3156,1,3159,3163,4,3164,3166,2,3167,3172,5,3173,3184,11,3185,3190,1,3213,3217,4,3241,3252,11,3258,3259,1,3269,3273,4,3278,3284,1,3287,3292,1,3295,3300,5,3301,3312,11,3316,3327,1,3341,3345,4,3397,3401,4,3408,3411,1,3428,3429,1,3456,3460,4,3479,3481,1,3506,3516,10,3518,3519,1,3527,3529,1,3531,3534,1,3541,3543,2,3552,3557,1,3568,3569,1,3573,3584,1,3643,3646,1,3676,3712,1,3715,3717,2,3723,3748,25,3750,3774,24,3775,3781,6,3783,3791,8,3802,3803,1,3808,3839,1,3912,3949,37,3950,3952,1,3992,4029,37,4045,4059,14,4060,4095,1,4294,4296,2,4297,4300,1,4302,4303,1,4681,4686,5,4687,4695,8,4697,4702,5,4703,4745,42,4750,4751,1,4785,4790,5,4791,4799,8,4801,4806,5,4807,4823,16,4881,4886,5,4887,4955,68,4956,4989,33,4990,4991,1,5018,5023,1,5110,5111,1,5118,5119,1,5789,5791,1,5881,5887,1,5910,5918,1,5943,5951,1,5972,5983,1,5997,6001,4,6004,6015,1,6110,6111,1,6122,6127,1,6138,6143,1,6158,6170,12,6171,6175,1,6265,6271,1,6315,6319,1,6390,6399,1,6431,6444,13,6445,6447,1,6460,6463,1,6465,6467,1,6510,6511,1,6517,6527,1,6572,6575,1,6602,6607,1,6619,6621,1,6684,6685,1,6751,6781,30,6782,6794,12,6795,6799,1,6810,6815,1,6830,6831,1,6863,6911,1,6989,7156,167,7157,7163,1,7224,7226,1,7242,7244,1,7307,7311,1,7355,7356,1,7368,7375,1,7419,7423,1,7958,7959,1,7966,7967,1,8006,8007,1,8014,8015,1,8024,8030,2,8062,8063,1,8117,8133,16,8148,8149,1,8156,8176,20,8177,8181,4,8191,8203,12,8204,8207,1,8234,8238,1,8288,8303,1,8306,8307,1,8335,8349,14,8350,8351,1,8385,8399,1,8433,8447,1,8588,8591,1,9258,9279,1,9291,9311,1,11124,11125,1,11158,11508,350,11509,11512,1,11558,11560,2,11561,11564,1,11566,11567,1,11624,11630,1,11633,11646,1,11671,11679,1,11687,11743,8,11870,11903,1,11930,12020,90,12021,12031,1,12246,12271,1,12352,12439,87,12440,12544,104,12545,12548,1,12592,12687,95,12774,12782,1,12831,42125,29294,42126,42127,1,42183,42191,1,42540,42559,1,42744,42751,1,42958,42959,1,42962,42964,2,42973,42993,1,43053,43055,1,43066,43071,1,43128,43135,1,43206,43213,1,43226,43231,1,43348,43358,1,43389,43391,1,43470,43482,12,43483,43485,1,43519,43575,56,43576,43583,1,43598,43599,1,43610,43611,1,43715,43738,1,43767,43776,1,43783,43784,1,43791,43792,1,43799,43807,1,43815,43823,8,43884,43887,1,44014,44015,1,44026,44031,1,55204,55215,1,55239,55242,1,55292,63743,1,64110,64111,1,64218,64255,1,64263,64274,1,64280,64284,1,64311,64317,6,64319,64325,3,64451,64466,1,64912,64913,1,64968,64974,1,64976,65007,1,65050,65055,1,65107,65127,20,65132,65135,1,65141,65277,136,65278,65280,1,65471,65473,1,65480,65481,1,65488,65489,1,65496,65497,1,65501,65503,1,65511,65519,8,65520,65531,1,65534,65535,1,65548,65575,27,65595,65598,3,65614,65615,1,65630,65663,1,65787,65791,1,65795,65798,1,65844,65846,1,65935,65949,14,65950,65951,1,65953,65999,1,66046,66175,1,66205,66207,1,66257,66271,1,66300,66303,1,66340,66348,1,66379,66383,1,66427,66431,1,66462,66500,38,66501,66503,1,66518,66559,1,66718,66719,1,66730,66735,1,66772,66775,1,66812,66815,1,66856,66863,1,66916,66926,1,66939,66955,16,66963,66966,3,66978,66994,16,67002,67005,3,67006,67007,1,67060,67071,1,67383,67391,1,67414,67423,1,67432,67455,1,67462,67505,43,67515,67583,1,67590,67591,1,67593,67638,45,67641,67643,1,67645,67646,1,67670,67743,73,67744,67750,1,67760,67807,1,67827,67830,3,67831,67834,1,67868,67870,1,67898,67902,1,67904,67967,1,68024,68027,1,68048,68049,1,68100,68103,3,68104,68107,1,68116,68120,4,68150,68151,1,68155,68158,1,68169,68175,1,68185,68191,1,68256,68287,1,68327,68330,1,68343,68351,1,68406,68408,1,68438,68439,1,68467,68471,1,68498,68504,1,68509,68520,1,68528,68607,1,68681,68735,1,68787,68799,1,68851,68857,1,68904,68911,1,68922,68927,1,68966,68968,1,68998,69005,1,69008,69215,1,69247,69290,43,69294,69295,1,69298,69313,1,69317,69371,1,69416,69423,1,69466,69487,1,69514,69551,1,69580,69599,1,69623,69631,1,69710,69713,1,69750,69758,1,69821,69827,6,69828,69839,1,69865,69871,1,69882,69887,1,69941,69960,19,69961,69967,1,70007,70015,1,70112,70133,21,70134,70143,1,70162,70210,48,70211,70271,1,70279,70281,2,70286,70302,16,70314,70319,1,70379,70383,1,70394,70399,1,70404,70413,9,70414,70417,3,70418,70441,23,70449,70452,3,70458,70469,11,70470,70473,3,70474,70478,4,70479,70481,2,70482,70486,1,70488,70492,1,70500,70501,1,70509,70511,1,70517,70527,1,70538,70540,2,70541,70543,2,70582,70593,11,70595,70596,1,70598,70603,5,70614,70617,3,70618,70624,1,70627,70655,1,70748,70754,6,70755,70783,1,70856,70863,1,70874,71039,1,71094,71095,1,71134,71167,1,71237,71247,1,71258,71263,1,71277,71295,1,71354,71359,1,71370,71375,1,71396,71423,1,71451,71452,1,71468,71471,1,71495,71679,1,71740,71839,1,71923,71934,1,71943,71944,1,71946,71947,1,71956,71959,3,71990,71993,3,71994,72007,13,72008,72015,1,72026,72095,1,72104,72105,1,72152,72153,1,72165,72191,1,72264,72271,1,72355,72367,1,72441,72447,1,72458,72639,1,72674,72687,1,72698,72703,1,72713,72759,46,72774,72783,1,72813,72815,1,72848,72849,1,72872,72887,15,72888,72959,1,72967,72970,3,73015,73017,1,73019,73022,3,73032,73039,1,73050,73055,1,73062,73065,3,73103,73106,3,73113,73119,1,73130,73439,1,73465,73471,1,73489,73531,42,73532,73533,1,73563,73647,1,73649,73663,1,73714,73726,1,74650,74751,1,74863,74869,6,74870,74879,1,75076,77711,1,77811,77823,1,78896,78911,1,78934,78943,1,82939,82943,1,83527,90367,1,90426,92159,1,92729,92735,1,92767,92778,11,92779,92781,1,92863,92874,11,92875,92879,1,92910,92911,1,92918,92927,1,92998,93007,1,93018,93026,8,93048,93052,1,93072,93503,1,93562,93759,1,93851,93951,1,94027,94030,1,94088,94094,1,94112,94175,1,94181,94191,1,94194,94207,1,100344,100351,1,101590,101630,1,101641,110575,1,110580,110588,8,110591,110883,292,110884,110897,1,110899,110927,1,110931,110932,1,110934,110947,1,110952,110959,1,111356,113663,1,113771,113775,1,113789,113791,1,113801,113807,1,113818,113819,1,113824,117759,1,118010,118015,1,118452,118527,1,118574,118575,1,118599,118607,1,118724,118783,1,119030,119039,1,119079,119080,1,119155,119162,1,119275,119295,1,119366,119487,1,119508,119519,1,119540,119551,1,119639,119647,1,119673,119807,1,119893,119965,72,119968,119969,1,119971,119972,1,119975,119976,1,119981,119994,13,119996,120004,8,120070,120075,5,120076,120085,9,120093,120122,29,120127,120133,6,120135,120137,1,120145,120486,341,120487,120780,293,120781,121484,703,121485,121498,1,121504,121520,16,121521,122623,1,122655,122660,1,122667,122879,1,122887,122905,18,122906,122914,8,122917,122923,6,122924,122927,1,122990,123022,1,123024,123135,1,123181,123183,1,123198,123199,1,123210,123213,1,123216,123535,1,123567,123583,1,123642,123646,1,123648,124111,1,124154,124367,1,124411,124414,1,124416,124895,1,124903,124908,5,124911,124927,16,125125,125126,1,125143,125183,1,125260,125263,1,125274,125277,1,125280,126064,1,126133,126208,1,126270,126463,1,126468,126496,28,126499,126501,2,126502,126504,2,126515,126520,5,126522,126524,2,126525,126529,1,126531,126534,1,126536,126540,2,126544,126547,3,126549,126550,1,126552,126560,2,126563,126565,2,126566,126571,5,126579,126589,5,126591,126602,11,126620,126624,1,126628,126634,6,126652,126703,1,126706,126975,1,127020,127023,1,127124,127135,1,127151,127152,1,127168,127184,16,127222,127231,1,127406,127461,1,127491,127503,1,127548,127551,1,127561,127567,1,127570,127583,1,127590,127743,1,128728,128731,1,128749,128751,1,128765,128767,1,128887,128890,1,128986,128991,1,129004,129007,1,129009,129023,1,129036,129039,1,129096,129103,1,129114,129119,1,129160,129167,1,129198,129199,1,129212,129215,1,129218,129279,1,129620,129631,1,129646,129647,1,129661,129663,1,129674,129678,1,129735,129741,1,129757,129758,1,129770,129775,1,129785,129791,1,129939,130042,103,130043,131071,1,173792,173823,1,177978,177983,1,178206,178207,1,183970,183983,1,191457,191471,1,192094,194559,1,195102,196607,1,201547,201551,1,205744,917759,1,918e3,1114111,1]));static Cc=new F(new Uint32Array([0,31,1,127,159,1]));static Cf=new F(new Uint32Array([173,1536,1363,1537,1541,1,1564,1757,193,1807,2192,385,2193,2274,81,6158,8203,2045,8204,8207,1,8234,8238,1,8288,8292,1,8294,8303,1,65279,65529,250,65530,65531,1,69821,69837,16,78896,78911,1,113824,113827,1,119155,119162,1,917505,917536,31,917537,917631,1]));static Co=new F(new Uint32Array([57344,63743,1,983040,1048573,1,1048576,1114109,1]));static Cs=new F(new Uint32Array([55296,57343,1]));static L=new F(new Uint32Array([65,90,1,97,122,1,170,181,11,186,192,6,193,214,1,216,246,1,248,705,1,710,721,1,736,740,1,748,750,2,880,884,1,886,887,1,890,893,1,895,902,7,904,906,1,908,910,2,911,929,1,931,1013,1,1015,1153,1,1162,1327,1,1329,1366,1,1369,1376,7,1377,1416,1,1488,1514,1,1519,1522,1,1568,1610,1,1646,1647,1,1649,1747,1,1749,1765,16,1766,1774,8,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2036,2037,1,2042,2048,6,2049,2069,1,2074,2084,10,2088,2112,24,2113,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2249,1,2308,2361,1,2365,2384,19,2392,2401,1,2417,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3654,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3782,3804,22,3805,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4256,18,4257,4293,1,4295,4301,6,4304,4346,1,4348,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5024,5109,1,5112,5117,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6103,6108,5,6176,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6823,6917,94,6918,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7293,1,7296,7306,1,7312,7354,1,7357,7359,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,7424,6,7425,7615,1,7680,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8124,1,8126,8130,4,8131,8132,1,8134,8140,1,8144,8147,1,8150,8155,1,8160,8172,1,8178,8180,1,8182,8188,1,8305,8319,14,8336,8348,1,8450,8455,5,8458,8467,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8495,8505,1,8508,8511,1,8517,8521,1,8526,8579,53,8580,11264,2684,11265,11492,1,11499,11502,1,11506,11507,1,11520,11557,1,11559,11565,6,11568,11623,1,11631,11648,17,11649,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11823,12293,470,12294,12337,43,12338,12341,1,12347,12348,1,12353,12438,1,12445,12447,1,12449,12538,1,12540,12543,1,12549,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,42124,1,42192,42237,1,42240,42508,1,42512,42527,1,42538,42539,1,42560,42606,1,42623,42653,1,42656,42725,1,42775,42783,1,42786,42888,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43471,43488,17,43489,43492,1,43494,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43741,1,43744,43754,1,43762,43764,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43866,1,43868,43881,1,43888,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65313,65338,1,65345,65370,1,65382,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66560,66717,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68736,68786,1,68800,68850,1,68864,68899,1,68938,68965,1,68975,68997,1,69248,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71840,71903,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,92992,92995,1,93027,93047,1,93053,93071,1,93504,93548,1,93760,93823,1,93952,94026,1,94032,94099,67,94100,94111,1,94176,94177,1,94179,94208,29,94209,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120512,1,120514,120538,1,120540,120570,1,120572,120596,1,120598,120628,1,120630,120654,1,120656,120686,1,120688,120712,1,120714,120744,1,120746,120770,1,120772,120779,1,122624,122654,1,122661,122666,1,122928,122989,1,123136,123180,1,123191,123197,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124139,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125184,125251,1,125259,126464,1205,126465,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static foldL=new F(new Uint32Array([837,837,1]));static Ll=new F(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,311,2,312,328,2,329,375,2,378,382,2,383,384,1,387,389,2,392,396,4,397,402,5,405,409,4,410,411,1,414,417,3,419,421,2,424,426,2,427,429,2,432,436,4,438,441,3,442,445,3,446,447,1,454,460,3,462,476,2,477,495,2,496,499,3,501,505,4,507,563,2,564,569,1,572,575,3,576,578,2,583,591,2,592,659,1,661,687,1,881,883,2,887,891,4,892,893,1,912,940,28,941,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1020,1072,52,1073,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1376,1416,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7424,118,7425,7467,1,7531,7543,1,7545,7578,1,7681,7829,2,7830,7837,1,7839,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8016,8023,1,8032,8039,1,8048,8061,1,8064,8071,1,8080,8087,1,8096,8103,1,8112,8116,1,8118,8119,1,8126,8130,4,8131,8132,1,8134,8135,1,8144,8147,1,8150,8151,1,8160,8167,1,8178,8180,1,8182,8183,1,8458,8462,4,8463,8467,4,8495,8505,5,8508,8509,1,8518,8521,1,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11377,11379,2,11380,11382,2,11383,11387,1,11393,11491,2,11492,11500,8,11502,11507,5,11520,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42800,42801,1,42803,42865,2,42866,42872,1,42874,42876,2,42879,42887,2,42892,42894,2,42897,42899,2,42900,42901,1,42903,42921,2,42927,42933,6,42935,42947,2,42952,42954,2,42957,42961,4,42963,42971,2,42998,43002,4,43824,43866,1,43872,43880,1,43888,43967,1,64256,64262,1,64275,64279,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,119834,119859,1,119886,119892,1,119894,119911,1,119938,119963,1,119990,119993,1,119995,119997,2,119998,120003,1,120005,120015,1,120042,120067,1,120094,120119,1,120146,120171,1,120198,120223,1,120250,120275,1,120302,120327,1,120354,120379,1,120406,120431,1,120458,120485,1,120514,120538,1,120540,120545,1,120572,120596,1,120598,120603,1,120630,120654,1,120656,120661,1,120688,120712,1,120714,120719,1,120746,120770,1,120772,120777,1,120779,122624,1845,122625,122633,1,122635,122654,1,122661,122666,1,125218,125251,1]));static foldLl=new F(new Uint32Array([65,90,1,192,214,1,216,222,1,256,302,2,306,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,453,1,455,456,1,458,459,1,461,475,2,478,494,2,497,498,1,500,502,2,503,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,837,880,43,882,886,4,895,902,7,904,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,984,9,986,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8072,8079,1,8088,8095,1,8104,8111,1,8120,8124,1,8136,8140,1,8152,8155,1,8168,8172,1,8184,8188,1,8486,8490,4,8491,8498,7,8579,11264,2685,11265,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,125184,125217,1]));static Lm=new F(new Uint32Array([688,705,1,710,721,1,736,740,1,748,750,2,884,890,6,1369,1600,231,1765,1766,1,2036,2037,1,2042,2074,32,2084,2088,4,2249,2417,168,3654,3782,128,4348,6103,1755,6211,6823,612,7288,7293,1,7468,7530,1,7544,7579,35,7580,7615,1,8305,8319,14,8336,8348,1,11388,11389,1,11631,11823,192,12293,12337,44,12338,12341,1,12347,12445,98,12446,12540,94,12541,12542,1,40981,42232,1251,42233,42237,1,42508,42623,115,42652,42653,1,42775,42783,1,42864,42888,24,42994,42996,1,43e3,43001,1,43471,43494,23,43632,43741,109,43763,43764,1,43868,43871,1,43881,65392,21511,65438,65439,1,67456,67461,1,67463,67504,1,67506,67514,1,68942,68975,33,92992,92995,1,93504,93506,1,93547,93548,1,94099,94111,1,94176,94177,1,94179,110576,16397,110577,110579,1,110581,110587,1,110589,110590,1,122928,122989,1,123191,123197,1,124139,125259,1120]));static Lo=new F(new Uint32Array([170,186,16,443,448,5,449,451,1,660,1488,828,1489,1514,1,1519,1522,1,1568,1599,1,1601,1610,1,1646,1647,1,1649,1747,1,1749,1774,25,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2048,2069,1,2112,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2248,1,2308,2361,1,2365,2384,19,2392,2401,1,2418,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3653,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3804,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4352,114,4353,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6108,6176,68,6177,6210,1,6212,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6917,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7287,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,8501,1083,8502,8504,1,11568,11623,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,12294,12348,54,12353,12438,1,12447,12449,2,12450,12538,1,12543,12549,6,12550,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,40980,1,40982,42124,1,42192,42231,1,42240,42507,1,42512,42527,1,42538,42539,1,42606,42656,50,42657,42725,1,42895,42999,104,43003,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43488,43492,1,43495,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43631,1,43633,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43740,1,43744,43754,1,43762,43777,15,43778,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43968,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65382,65391,1,65393,65437,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66640,66717,1,66816,66855,1,66864,66915,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68864,68899,1,68938,68941,1,68943,69248,305,69249,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,93027,93047,1,93053,93071,1,93507,93546,1,93952,94026,1,94032,94208,176,94209,100343,1,100352,101589,1,101631,101640,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,122634,123136,502,123137,123180,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124138,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Lt=new F(new Uint32Array([453,459,3,498,8072,7574,8073,8079,1,8088,8095,1,8104,8111,1,8124,8140,16,8188,8188,1]));static foldLt=new F(new Uint32Array([452,454,2,455,457,2,458,460,2,497,499,2,8064,8071,1,8080,8087,1,8096,8103,1,8115,8131,16,8179,8179,1]));static Lu=new F(new Uint32Array([65,90,1,192,214,1,216,222,1,256,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,461,3,463,475,2,478,494,2,497,500,3,502,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,880,882,2,886,895,9,902,904,2,905,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,978,3,979,980,1,984,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8120,8123,1,8136,8139,1,8152,8155,1,8168,8172,1,8184,8187,1,8450,8455,5,8459,8461,1,8464,8466,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8496,8499,1,8510,8511,1,8517,8579,62,11264,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,119808,119833,1,119860,119885,1,119912,119937,1,119964,119966,2,119967,119973,3,119974,119977,3,119978,119980,1,119982,119989,1,120016,120041,1,120068,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120120,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120172,120197,1,120224,120249,1,120276,120301,1,120328,120353,1,120380,120405,1,120432,120457,1,120488,120512,1,120546,120570,1,120604,120628,1,120662,120686,1,120720,120744,1,120778,125184,4406,125185,125217,1]));static Upper=this.Lu;static foldLu=new F(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,303,2,307,311,2,314,328,2,331,375,2,378,382,2,383,384,1,387,389,2,392,396,4,402,405,3,409,411,1,414,417,3,419,421,2,424,429,5,432,436,4,438,441,3,445,447,2,453,454,1,456,457,1,459,460,1,462,476,2,477,495,2,498,499,1,501,505,4,507,543,2,547,563,2,572,575,3,576,578,2,583,591,2,592,596,1,598,599,1,601,603,2,604,608,4,609,611,2,612,614,1,616,620,1,623,625,2,626,629,3,637,640,3,642,643,1,647,652,1,658,669,11,670,837,167,881,883,2,887,891,4,892,893,1,940,943,1,945,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1072,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1377,1414,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7545,239,7549,7566,17,7681,7829,2,7835,7841,6,7843,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8017,8023,2,8032,8039,1,8048,8061,1,8112,8113,1,8126,8144,18,8145,8160,15,8161,8165,4,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11379,11382,3,11393,11491,2,11500,11502,2,11507,11520,13,11521,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42803,42863,2,42874,42876,2,42879,42887,2,42892,42897,5,42899,42900,1,42903,42921,2,42933,42947,2,42952,42954,2,42957,42961,4,42967,42971,2,42998,43859,861,43888,43967,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,125218,125251,1]));static M=new F(new Uint32Array([768,879,1,1155,1161,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2307,1,2362,2364,1,2366,2383,1,2385,2391,1,2402,2403,1,2433,2435,1,2492,2494,2,2495,2500,1,2503,2504,1,2507,2509,1,2519,2530,11,2531,2558,27,2561,2563,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2672,31,2673,2677,4,2689,2691,1,2748,2750,2,2751,2757,1,2759,2761,1,2763,2765,1,2786,2787,1,2810,2815,1,2817,2819,1,2876,2878,2,2879,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2914,2915,1,2946,3006,60,3007,3010,1,3014,3016,1,3018,3021,1,3031,3072,41,3073,3076,1,3132,3134,2,3135,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3203,1,3260,3262,2,3263,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3298,3299,1,3315,3328,13,3329,3331,1,3387,3388,1,3390,3396,1,3398,3400,1,3402,3405,1,3415,3426,11,3427,3457,30,3458,3459,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3570,3571,1,3633,3636,3,3637,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3902,3903,1,3953,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4139,101,4140,4158,1,4182,4185,1,4190,4192,1,4194,4196,1,4199,4205,1,4209,4212,1,4226,4237,1,4239,4250,11,4251,4253,1,4957,4959,1,5906,5909,1,5938,5940,1,5970,5971,1,6002,6003,1,6068,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6443,1,6448,6459,1,6679,6683,1,6741,6750,1,6752,6780,1,6783,6832,49,6833,6862,1,6912,6916,1,6964,6980,1,7019,7027,1,7040,7042,1,7073,7085,1,7142,7155,1,7204,7223,1,7376,7378,1,7380,7400,1,7405,7412,7,7415,7417,1,7616,7679,1,8400,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12335,1,12441,12442,1,42607,42610,1,42612,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43043,24,43044,43047,1,43052,43136,84,43137,43188,51,43189,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43347,1,43392,43395,1,43443,43456,1,43493,43561,68,43562,43574,1,43587,43596,9,43597,43643,46,43644,43645,1,43696,43698,2,43699,43700,1,43703,43704,1,43710,43711,1,43713,43755,42,43756,43759,1,43765,43766,1,44003,44010,1,44012,44013,1,64286,65024,738,65025,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69632,69634,1,69688,69702,1,69744,69747,3,69748,69759,11,69760,69762,1,69808,69818,1,69826,69888,62,69889,69890,1,69927,69940,1,69957,69958,1,70003,70016,13,70017,70018,1,70067,70080,1,70089,70092,1,70094,70095,1,70188,70199,1,70206,70209,3,70367,70378,1,70400,70403,1,70459,70460,1,70462,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70502,3,70503,70508,1,70512,70516,1,70584,70592,1,70594,70597,3,70599,70602,1,70604,70608,1,70610,70625,15,70626,70709,83,70710,70726,1,70750,70832,82,70833,70851,1,71087,71093,1,71096,71104,1,71132,71133,1,71216,71232,1,71339,71351,1,71453,71467,1,71724,71738,1,71984,71989,1,71991,71992,1,71995,71998,1,72e3,72002,2,72003,72145,142,72146,72151,1,72154,72160,1,72164,72193,29,72194,72202,1,72243,72249,1,72251,72254,1,72263,72273,10,72274,72283,1,72330,72345,1,72751,72758,1,72760,72767,1,72850,72871,1,72873,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73098,67,73099,73102,1,73104,73105,1,73107,73111,1,73459,73462,1,73472,73473,1,73475,73524,49,73525,73530,1,73534,73538,1,73562,78912,5350,78919,78933,1,90398,90415,1,92912,92916,1,92976,92982,1,94031,94033,2,94034,94087,1,94095,94098,1,94180,94192,12,94193,113821,19628,113822,118528,4706,118529,118573,1,118576,118598,1,119141,119145,1,119149,119154,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldM=new F(new Uint32Array([921,953,32,8126,8126,1]));static Mc=new F(new Uint32Array([2307,2363,56,2366,2368,1,2377,2380,1,2382,2383,1,2434,2435,1,2494,2496,1,2503,2504,1,2507,2508,1,2519,2563,44,2622,2624,1,2691,2750,59,2751,2752,1,2761,2763,2,2764,2818,54,2819,2878,59,2880,2887,7,2888,2891,3,2892,2903,11,3006,3007,1,3009,3010,1,3014,3016,1,3018,3020,1,3031,3073,42,3074,3075,1,3137,3140,1,3202,3203,1,3262,3264,2,3265,3268,1,3271,3272,1,3274,3275,1,3285,3286,1,3315,3330,15,3331,3390,59,3391,3392,1,3398,3400,1,3402,3404,1,3415,3458,43,3459,3535,76,3536,3537,1,3544,3551,1,3570,3571,1,3902,3903,1,3967,4139,172,4140,4145,5,4152,4155,3,4156,4182,26,4183,4194,11,4195,4196,1,4199,4205,1,4227,4228,1,4231,4236,1,4239,4250,11,4251,4252,1,5909,5940,31,6070,6078,8,6079,6085,1,6087,6088,1,6435,6438,1,6441,6443,1,6448,6449,1,6451,6456,1,6681,6682,1,6741,6743,2,6753,6755,2,6756,6765,9,6766,6770,1,6916,6965,49,6971,6973,2,6974,6977,1,6979,6980,1,7042,7073,31,7078,7079,1,7082,7143,61,7146,7148,1,7150,7154,4,7155,7204,49,7205,7211,1,7220,7221,1,7393,7415,22,12334,12335,1,43043,43044,1,43047,43136,89,43137,43188,51,43189,43203,1,43346,43347,1,43395,43444,49,43445,43450,5,43451,43454,3,43455,43456,1,43567,43568,1,43571,43572,1,43597,43643,46,43645,43755,110,43758,43759,1,43765,44003,238,44004,44006,2,44007,44009,2,44010,44012,2,69632,69634,2,69762,69808,46,69809,69810,1,69815,69816,1,69932,69957,25,69958,70018,60,70067,70069,1,70079,70080,1,70094,70188,94,70189,70190,1,70194,70195,1,70197,70368,171,70369,70370,1,70402,70403,1,70462,70463,1,70465,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70584,85,70585,70586,1,70594,70597,3,70599,70602,1,70604,70605,1,70607,70709,102,70710,70711,1,70720,70721,1,70725,70832,107,70833,70834,1,70841,70843,2,70844,70846,1,70849,71087,238,71088,71089,1,71096,71099,1,71102,71216,114,71217,71218,1,71227,71228,1,71230,71340,110,71342,71343,1,71350,71454,104,71456,71457,1,71462,71724,262,71725,71726,1,71736,71984,248,71985,71989,1,71991,71992,1,71997,72e3,3,72002,72145,143,72146,72147,1,72156,72159,1,72164,72249,85,72279,72280,1,72343,72751,408,72766,72873,107,72881,72884,3,73098,73102,1,73107,73108,1,73110,73461,351,73462,73475,13,73524,73525,1,73534,73535,1,73537,90410,16873,90411,90412,1,94033,94087,1,94192,94193,1,119141,119142,1,119149,119154,1]));static Me=new F(new Uint32Array([1160,1161,1,6846,8413,1567,8414,8416,1,8418,8420,1,42608,42610,1]));static Mn=new F(new Uint32Array([768,879,1,1155,1159,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2306,1,2362,2364,2,2369,2376,1,2381,2385,4,2386,2391,1,2402,2403,1,2433,2492,59,2497,2500,1,2509,2530,21,2531,2558,27,2561,2562,1,2620,2625,5,2626,2631,5,2632,2635,3,2636,2637,1,2641,2672,31,2673,2677,4,2689,2690,1,2748,2753,5,2754,2757,1,2759,2760,1,2765,2786,21,2787,2810,23,2811,2815,1,2817,2876,59,2879,2881,2,2882,2884,1,2893,2901,8,2902,2914,12,2915,2946,31,3008,3021,13,3072,3076,4,3132,3134,2,3135,3136,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3260,59,3263,3270,7,3276,3277,1,3298,3299,1,3328,3329,1,3387,3388,1,3393,3396,1,3405,3426,21,3427,3457,30,3530,3538,8,3539,3540,1,3542,3633,91,3636,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3953,3966,1,3968,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4141,103,4142,4144,1,4146,4151,1,4153,4154,1,4157,4158,1,4184,4185,1,4190,4192,1,4209,4212,1,4226,4229,3,4230,4237,7,4253,4957,704,4958,4959,1,5906,5908,1,5938,5939,1,5970,5971,1,6002,6003,1,6068,6069,1,6071,6077,1,6086,6089,3,6090,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6434,1,6439,6440,1,6450,6457,7,6458,6459,1,6679,6680,1,6683,6742,59,6744,6750,1,6752,6754,2,6757,6764,1,6771,6780,1,6783,6832,49,6833,6845,1,6847,6862,1,6912,6915,1,6964,6966,2,6967,6970,1,6972,6978,6,7019,7027,1,7040,7041,1,7074,7077,1,7080,7081,1,7083,7085,1,7142,7144,2,7145,7149,4,7151,7153,1,7212,7219,1,7222,7223,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8400,8412,1,8417,8421,4,8422,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12333,1,12441,12442,1,42607,42612,5,42613,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43045,26,43046,43052,6,43204,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43345,1,43392,43394,1,43443,43446,3,43447,43449,1,43452,43453,1,43493,43561,68,43562,43566,1,43569,43570,1,43573,43574,1,43587,43596,9,43644,43696,52,43698,43700,1,43703,43704,1,43710,43711,1,43713,43756,43,43757,43766,9,44005,44008,3,44013,64286,20273,65024,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69633,69688,55,69689,69702,1,69744,69747,3,69748,69759,11,69760,69761,1,69811,69814,1,69817,69818,1,69826,69888,62,69889,69890,1,69927,69931,1,69933,69940,1,70003,70016,13,70017,70070,53,70071,70078,1,70089,70092,1,70095,70191,96,70192,70193,1,70196,70198,2,70199,70206,7,70209,70367,158,70371,70378,1,70400,70401,1,70459,70460,1,70464,70502,38,70503,70508,1,70512,70516,1,70587,70592,1,70606,70610,2,70625,70626,1,70712,70719,1,70722,70724,1,70726,70750,24,70835,70840,1,70842,70847,5,70848,70850,2,70851,71090,239,71091,71093,1,71100,71101,1,71103,71104,1,71132,71133,1,71219,71226,1,71229,71231,2,71232,71339,107,71341,71344,3,71345,71349,1,71351,71453,102,71455,71458,3,71459,71461,1,71463,71467,1,71727,71735,1,71737,71738,1,71995,71996,1,71998,72003,5,72148,72151,1,72154,72155,1,72160,72193,33,72194,72202,1,72243,72248,1,72251,72254,1,72263,72273,10,72274,72278,1,72281,72283,1,72330,72342,1,72344,72345,1,72752,72758,1,72760,72765,1,72767,72850,83,72851,72871,1,72874,72880,1,72882,72883,1,72885,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73104,73,73105,73109,4,73111,73459,348,73460,73472,12,73473,73526,53,73527,73530,1,73536,73538,2,73562,78912,5350,78919,78933,1,90398,90409,1,90413,90415,1,92912,92916,1,92976,92982,1,94031,94095,64,94096,94098,1,94180,113821,19641,113822,118528,4706,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldMn=new F(new Uint32Array([921,953,32,8126,8126,1]));static N=new F(new Uint32Array([48,57,1,178,179,1,185,188,3,189,190,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2548,2553,1,2662,2671,1,2790,2799,1,2918,2927,1,2930,2935,1,3046,3058,1,3174,3183,1,3192,3198,1,3302,3311,1,3416,3422,1,3430,3448,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3891,1,4160,4169,1,4240,4249,1,4969,4988,1,5870,5872,1,6112,6121,1,6128,6137,1,6160,6169,1,6470,6479,1,6608,6618,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,8304,8308,4,8309,8313,1,8320,8329,1,8528,8578,1,8581,8585,1,9312,9371,1,9450,9471,1,10102,10131,1,11517,12295,778,12321,12329,1,12344,12346,1,12690,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,42528,42537,1,42726,42735,1,43056,43061,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,65799,65843,1,65856,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,66369,66378,9,66513,66517,1,66720,66729,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,68912,68921,1,68928,68937,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70113,70132,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71483,1,71904,71922,1,72016,72025,1,72688,72697,1,72784,72812,1,73040,73049,1,73120,73129,1,73552,73561,1,73664,73684,1,74752,74862,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93019,93025,1,93552,93561,1,93824,93846,1,118e3,118009,1,119488,119507,1,119520,119539,1,119648,119672,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125127,125135,1,125264,125273,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1,130032,130041,1]));static Nd=new F(new Uint32Array([48,57,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2662,2671,1,2790,2799,1,2918,2927,1,3046,3055,1,3174,3183,1,3302,3311,1,3430,3439,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3881,1,4160,4169,1,4240,4249,1,6112,6121,1,6160,6169,1,6470,6479,1,6608,6617,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,42528,42537,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,66720,66729,1,68912,68921,1,68928,68937,1,69734,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71481,1,71904,71913,1,72016,72025,1,72688,72697,1,72784,72793,1,73040,73049,1,73120,73129,1,73552,73561,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93552,93561,1,118e3,118009,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125264,125273,1,130032,130041,1]));static Nl=new F(new Uint32Array([5870,5872,1,8544,8578,1,8581,8584,1,12295,12321,26,12322,12329,1,12344,12346,1,42726,42735,1,65856,65908,1,66369,66378,9,66513,66517,1,74752,74862,1]));static No=new F(new Uint32Array([178,179,1,185,188,3,189,190,1,2548,2553,1,2930,2935,1,3056,3058,1,3192,3198,1,3416,3422,1,3440,3448,1,3882,3891,1,4969,4988,1,6128,6137,1,6618,8304,1686,8308,8313,1,8320,8329,1,8528,8543,1,8585,9312,727,9313,9371,1,9450,9471,1,10102,10131,1,11517,12690,1173,12691,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,43056,43061,1,65799,65843,1,65909,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69733,1,70113,70132,1,71482,71483,1,71914,71922,1,72794,72812,1,73664,73684,1,93019,93025,1,93824,93846,1,119488,119507,1,119520,119539,1,119648,119672,1,125127,125135,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1]));static P=new F(new Uint32Array([33,35,1,37,42,1,44,47,1,58,59,1,63,64,1,91,93,1,95,123,28,125,161,36,167,171,4,182,183,1,187,191,4,894,903,9,1370,1375,1,1417,1418,1,1470,1472,2,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3898,38,3899,3901,1,3973,4048,75,4049,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5120,5742,622,5787,5788,1,5867,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8208,829,8209,8231,1,8240,8259,1,8261,8273,1,8275,8286,1,8317,8318,1,8333,8334,1,8968,8971,1,9001,9002,1,10088,10101,1,10181,10182,1,10214,10223,1,10627,10648,1,10712,10715,1,10748,10749,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11822,1,11824,11855,1,11858,11869,1,12289,12291,1,12296,12305,1,12308,12319,1,12336,12349,13,12448,12539,91,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,64830,20819,64831,65040,209,65041,65049,1,65072,65106,1,65108,65121,1,65123,65128,5,65130,65131,1,65281,65283,1,65285,65290,1,65292,65295,1,65306,65307,1,65311,65312,1,65339,65341,1,65343,65371,28,65373,65375,2,65376,65381,1,65792,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,68974,69293,319,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Pc=new F(new Uint32Array([95,8255,8160,8256,8276,20,65075,65076,1,65101,65103,1,65343,65343,1]));static Pd=new F(new Uint32Array([45,1418,1373,1470,5120,3650,6150,8208,2058,8209,8213,1,11799,11802,3,11834,11835,1,11840,11869,29,12316,12336,20,12448,65073,52625,65074,65112,38,65123,65293,170,68974,69293,319]));static Pe=new F(new Uint32Array([41,93,52,125,3899,3774,3901,5788,1887,8262,8318,56,8334,8969,635,8971,9002,31,10089,10101,2,10182,10215,33,10217,10223,2,10628,10648,2,10713,10715,2,10749,11811,1062,11813,11817,2,11862,11868,2,12297,12305,2,12309,12315,2,12318,12319,1,64830,65048,218,65078,65092,2,65096,65114,18,65116,65118,2,65289,65341,52,65373,65379,3]));static Pf=new F(new Uint32Array([187,8217,8030,8221,8250,29,11779,11781,2,11786,11789,3,11805,11809,4]));static Pi=new F(new Uint32Array([171,8216,8045,8219,8220,1,8223,8249,26,11778,11780,2,11785,11788,3,11804,11808,4]));static Po=new F(new Uint32Array([33,35,1,37,39,1,42,46,2,47,58,11,59,63,4,64,92,28,161,167,6,182,183,1,191,894,703,903,1370,467,1371,1375,1,1417,1472,55,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3973,113,4048,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5742,5867,125,5868,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6149,1,6151,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8214,835,8215,8224,9,8225,8231,1,8240,8248,1,8251,8254,1,8257,8259,1,8263,8273,1,8275,8277,2,8278,8286,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11782,5,11783,11784,1,11787,11790,3,11791,11798,1,11800,11801,1,11803,11806,3,11807,11818,11,11819,11822,1,11824,11833,1,11836,11839,1,11841,11843,2,11844,11855,1,11858,11860,1,12289,12291,1,12349,12539,190,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,65040,21029,65041,65046,1,65049,65072,23,65093,65094,1,65097,65100,1,65104,65106,1,65108,65111,1,65119,65121,1,65128,65130,2,65131,65281,150,65282,65283,1,65285,65287,1,65290,65294,2,65295,65306,11,65307,65311,4,65312,65340,28,65377,65380,3,65381,65792,411,65793,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Ps=new F(new Uint32Array([40,91,51,123,3898,3775,3900,5787,1887,8218,8222,4,8261,8317,56,8333,8968,635,8970,9001,31,10088,10100,2,10181,10214,33,10216,10222,2,10627,10647,2,10712,10714,2,10748,11810,1062,11812,11816,2,11842,11861,19,11863,11867,2,12296,12304,2,12308,12314,2,12317,64831,52514,65047,65077,30,65079,65091,2,65095,65113,18,65115,65117,2,65288,65339,51,65371,65375,4,65378,65378,1]));static S=new F(new Uint32Array([36,43,7,60,62,1,94,96,2,124,126,2,162,166,1,168,169,1,172,174,2,175,177,1,180,184,4,215,247,32,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,1014,113,1154,1421,267,1422,1423,1,1542,1544,1,1547,1550,3,1551,1758,207,1769,1789,20,1790,2038,248,2046,2047,1,2184,2546,362,2547,2554,7,2555,2801,246,2928,3059,131,3060,3066,1,3199,3407,208,3449,3647,198,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6107,366,6464,6622,158,6623,6655,1,7009,7018,1,7028,7036,1,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,8260,8274,14,8314,8316,1,8330,8332,1,8352,8384,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8472,1,8478,8483,1,8485,8489,2,8494,8506,12,8507,8512,5,8513,8516,1,8522,8525,1,8527,8586,59,8587,8592,5,8593,8967,1,8972,9e3,1,9003,9257,1,9280,9290,1,9372,9449,1,9472,10087,1,10132,10180,1,10183,10213,1,10224,10626,1,10649,10711,1,10716,10747,1,10750,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12443,12444,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,42752,42774,1,42784,42785,1,42889,42890,1,43048,43051,1,43062,43065,1,43639,43641,1,43867,43882,15,43883,64297,20414,64434,64450,1,64832,64847,1,64975,65020,45,65021,65023,1,65122,65124,2,65125,65126,1,65129,65284,155,65291,65308,17,65309,65310,1,65342,65344,2,65372,65374,2,65504,65510,1,65512,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,69006,710,69007,71487,2480,73685,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,123647,432,126124,126128,4,126254,126704,450,126705,126976,271,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Sc=new F(new Uint32Array([36,162,126,163,165,1,1423,1547,124,2046,2047,1,2546,2547,1,2555,2801,246,3065,3647,582,6107,8352,2245,8353,8384,1,43064,65020,21956,65129,65284,155,65504,65505,1,65509,65510,1,73693,73696,1,123647,126128,2481]));static Sk=new F(new Uint32Array([94,96,2,168,175,7,180,184,4,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,2184,1283,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,12443,12444,1,42752,42774,1,42784,42785,1,42889,42890,1,43867,43882,15,43883,64434,20551,64435,64450,1,65342,65344,2,65507,127995,62488,127996,127999,1]));static Sm=new F(new Uint32Array([43,60,17,61,62,1,124,126,2,172,177,5,215,247,32,1014,1542,528,1543,1544,1,8260,8274,14,8314,8316,1,8330,8332,1,8472,8512,40,8513,8516,1,8523,8592,69,8593,8596,1,8602,8603,1,8608,8614,3,8622,8654,32,8655,8658,3,8660,8692,32,8693,8959,1,8992,8993,1,9084,9115,31,9116,9139,1,9180,9185,1,9655,9665,10,9720,9727,1,9839,10176,337,10177,10180,1,10183,10213,1,10224,10239,1,10496,10626,1,10649,10711,1,10716,10747,1,10750,11007,1,11056,11076,1,11079,11084,1,64297,65122,825,65124,65126,1,65291,65308,17,65309,65310,1,65372,65374,2,65506,65513,7,65514,65516,1,69006,69007,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,126704,126705,1]));static So=new F(new Uint32Array([166,169,3,174,176,2,1154,1421,267,1422,1550,128,1551,1758,207,1769,1789,20,1790,2038,248,2554,2928,374,3059,3064,1,3066,3199,133,3407,3449,42,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6464,723,6622,6655,1,7009,7018,1,7028,7036,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8478,7,8479,8483,1,8485,8489,2,8494,8506,12,8507,8522,15,8524,8525,1,8527,8586,59,8587,8597,10,8598,8601,1,8604,8607,1,8609,8610,1,8612,8613,1,8615,8621,1,8623,8653,1,8656,8657,1,8659,8661,2,8662,8691,1,8960,8967,1,8972,8991,1,8994,9e3,1,9003,9083,1,9085,9114,1,9140,9179,1,9186,9257,1,9280,9290,1,9372,9449,1,9472,9654,1,9656,9664,1,9666,9719,1,9728,9838,1,9840,10087,1,10132,10175,1,10240,10495,1,11008,11055,1,11077,11078,1,11085,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,43048,43051,1,43062,43063,1,43065,43639,574,43640,43641,1,64832,64847,1,64975,65021,46,65022,65023,1,65508,65512,4,65517,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,71487,3191,73685,73692,1,73697,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,126124,2909,126254,126976,722,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,127994,1,128e3,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Z=new F(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8232,8233,1,8239,8287,48,12288,12288,1]));static Zl=new F(new Uint32Array([8232,8232,1]));static Zp=new F(new Uint32Array([8233,8233,1]));static Zs=new F(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8239,8287,48,12288,12288,1]));static Adlam=new F(new Uint32Array([125184,125259,1,125264,125273,1,125278,125279,1]));static Ahom=new F(new Uint32Array([71424,71450,1,71453,71467,1,71472,71494,1]));static Anatolian_Hieroglyphs=new F(new Uint32Array([82944,83526,1]));static Arabic=new F(new Uint32Array([1536,1540,1,1542,1547,1,1549,1562,1,1564,1566,1,1568,1599,1,1601,1610,1,1622,1647,1,1649,1756,1,1758,1791,1,1872,1919,1,2160,2190,1,2192,2193,1,2199,2273,1,2275,2303,1,64336,64450,1,64467,64829,1,64832,64911,1,64914,64967,1,64975,65008,33,65009,65023,1,65136,65140,1,65142,65276,1,69216,69246,1,69314,69316,1,69372,69375,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1]));static Armenian=new F(new Uint32Array([1329,1366,1,1369,1418,1,1421,1423,1,64275,64279,1]));static Avestan=new F(new Uint32Array([68352,68405,1,68409,68415,1]));static Balinese=new F(new Uint32Array([6912,6988,1,6990,7039,1]));static Bamum=new F(new Uint32Array([42656,42743,1,92160,92728,1]));static Bassa_Vah=new F(new Uint32Array([92880,92909,1,92912,92917,1]));static Batak=new F(new Uint32Array([7104,7155,1,7164,7167,1]));static Bengali=new F(new Uint32Array([2432,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1]));static Bhaiksuki=new F(new Uint32Array([72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1]));static Bopomofo=new F(new Uint32Array([746,747,1,12549,12591,1,12704,12735,1]));static Brahmi=new F(new Uint32Array([69632,69709,1,69714,69749,1,69759,69759,1]));static Braille=new F(new Uint32Array([10240,10495,1]));static Buginese=new F(new Uint32Array([6656,6683,1,6686,6687,1]));static Buhid=new F(new Uint32Array([5952,5971,1]));static Canadian_Aboriginal=new F(new Uint32Array([5120,5759,1,6320,6389,1,72368,72383,1]));static Carian=new F(new Uint32Array([66208,66256,1]));static Caucasian_Albanian=new F(new Uint32Array([66864,66915,1,66927,66927,1]));static Chakma=new F(new Uint32Array([69888,69940,1,69942,69959,1]));static Cham=new F(new Uint32Array([43520,43574,1,43584,43597,1,43600,43609,1,43612,43615,1]));static Cherokee=new F(new Uint32Array([5024,5109,1,5112,5117,1,43888,43967,1]));static Chorasmian=new F(new Uint32Array([69552,69579,1]));static Common=new F(new Uint32Array([0,64,1,91,96,1,123,169,1,171,185,1,187,191,1,215,247,32,697,735,1,741,745,1,748,767,1,884,894,10,901,903,2,1541,1548,7,1563,1567,4,1600,1757,157,2274,2404,130,2405,3647,1242,4053,4056,1,4347,5867,1520,5868,5869,1,5941,5942,1,6146,6147,1,6149,7379,1230,7393,7401,8,7402,7404,1,7406,7411,1,7413,7415,1,7418,8192,774,8193,8203,1,8206,8292,1,8294,8304,1,8308,8318,1,8320,8334,1,8352,8384,1,8448,8485,1,8487,8489,1,8492,8497,1,8499,8525,1,8527,8543,1,8585,8587,1,8592,9257,1,9280,9290,1,9312,10239,1,10496,11123,1,11126,11157,1,11159,11263,1,11776,11869,1,12272,12292,1,12294,12296,2,12297,12320,1,12336,12343,1,12348,12351,1,12443,12444,1,12448,12539,91,12540,12688,148,12689,12703,1,12736,12773,1,12783,12832,49,12833,12895,1,12927,13007,1,13055,13144,89,13145,13311,1,19904,19967,1,42752,42785,1,42888,42890,1,43056,43065,1,43310,43471,161,43867,43882,15,43883,64830,20947,64831,65040,209,65041,65049,1,65072,65106,1,65108,65126,1,65128,65131,1,65279,65281,2,65282,65312,1,65339,65344,1,65371,65381,1,65392,65438,46,65439,65504,65,65505,65510,1,65512,65518,1,65529,65533,1,65792,65794,1,65799,65843,1,65847,65855,1,65936,65948,1,66e3,66044,1,66273,66299,1,113824,113827,1,117760,118009,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119142,1,119146,119162,1,119171,119172,1,119180,119209,1,119214,119274,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,120831,1,126065,126132,1,126209,126269,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127487,1,127489,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,917505,917536,31,917537,917631,1]));static foldCommon=new F(new Uint32Array([924,956,32]));static Coptic=new F(new Uint32Array([994,1007,1,11392,11507,1,11513,11519,1]));static Cuneiform=new F(new Uint32Array([73728,74649,1,74752,74862,1,74864,74868,1,74880,75075,1]));static Cypriot=new F(new Uint32Array([67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3]));static Cypro_Minoan=new F(new Uint32Array([77712,77810,1]));static Cyrillic=new F(new Uint32Array([1024,1156,1,1159,1327,1,7296,7306,1,7467,7544,77,11744,11775,1,42560,42655,1,65070,65071,1,122928,122989,1,123023,123023,1]));static Deseret=new F(new Uint32Array([66560,66639,1]));static Devanagari=new F(new Uint32Array([2304,2384,1,2389,2403,1,2406,2431,1,43232,43263,1,72448,72457,1]));static Dives_Akuru=new F(new Uint32Array([71936,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1]));static Dogra=new F(new Uint32Array([71680,71739,1]));static Duployan=new F(new Uint32Array([113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1]));static Egyptian_Hieroglyphs=new F(new Uint32Array([77824,78933,1,78944,82938,1]));static Elbasan=new F(new Uint32Array([66816,66855,1]));static Elymaic=new F(new Uint32Array([69600,69622,1]));static Ethiopic=new F(new Uint32Array([4608,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,124896,124902,1,124904,124907,1,124909,124910,1,124912,124926,1]));static Garay=new F(new Uint32Array([68928,68965,1,68969,68997,1,69006,69007,1]));static Georgian=new F(new Uint32Array([4256,4293,1,4295,4301,6,4304,4346,1,4348,4351,1,7312,7354,1,7357,7359,1,11520,11557,1,11559,11565,6]));static Glagolitic=new F(new Uint32Array([11264,11359,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1]));static Gothic=new F(new Uint32Array([66352,66378,1]));static Grantha=new F(new Uint32Array([70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70460,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1]));static Greek=new F(new Uint32Array([880,883,1,885,887,1,890,893,1,895,900,5,902,904,2,905,906,1,908,910,2,911,929,1,931,993,1,1008,1023,1,7462,7466,1,7517,7521,1,7526,7530,1,7615,7936,321,7937,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8486,43877,35391,65856,65934,1,65952,119296,53344,119297,119365,1]));static foldGreek=new F(new Uint32Array([181,837,656]));static Gujarati=new F(new Uint32Array([2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1]));static Gunjala_Gondi=new F(new Uint32Array([73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1]));static Gurmukhi=new F(new Uint32Array([2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1]));static Gurung_Khema=new F(new Uint32Array([90368,90425,1]));static Han=new F(new Uint32Array([11904,11929,1,11931,12019,1,12032,12245,1,12293,12295,2,12321,12329,1,12344,12347,1,13312,19903,1,19968,40959,1,63744,64109,1,64112,64217,1,94178,94179,1,94192,94193,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Hangul=new F(new Uint32Array([4352,4607,1,12334,12335,1,12593,12686,1,12800,12830,1,12896,12926,1,43360,43388,1,44032,55203,1,55216,55238,1,55243,55291,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1]));static Hanifi_Rohingya=new F(new Uint32Array([68864,68903,1,68912,68921,1]));static Hanunoo=new F(new Uint32Array([5920,5940,1]));static Hatran=new F(new Uint32Array([67808,67826,1,67828,67829,1,67835,67839,1]));static Hebrew=new F(new Uint32Array([1425,1479,1,1488,1514,1,1519,1524,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64335,1]));static Hiragana=new F(new Uint32Array([12353,12438,1,12445,12447,1,110593,110879,1,110898,110928,30,110929,110930,1,127488,127488,1]));static Imperial_Aramaic=new F(new Uint32Array([67648,67669,1,67671,67679,1]));static Inherited=new F(new Uint32Array([768,879,1,1157,1158,1,1611,1621,1,1648,2385,737,2386,2388,1,6832,6862,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8204,8205,1,8400,8432,1,12330,12333,1,12441,12442,1,65024,65039,1,65056,65069,1,66045,66272,227,70459,118528,48069,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,917760,917999,1]));static foldInherited=new F(new Uint32Array([921,953,32,8126,8126,1]));static Inscriptional_Pahlavi=new F(new Uint32Array([68448,68466,1,68472,68479,1]));static Inscriptional_Parthian=new F(new Uint32Array([68416,68437,1,68440,68447,1]));static Javanese=new F(new Uint32Array([43392,43469,1,43472,43481,1,43486,43487,1]));static Kaithi=new F(new Uint32Array([69760,69826,1,69837,69837,1]));static Kannada=new F(new Uint32Array([3200,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1]));static Katakana=new F(new Uint32Array([12449,12538,1,12541,12543,1,12784,12799,1,13008,13054,1,13056,13143,1,65382,65391,1,65393,65437,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110880,288,110881,110882,1,110933,110948,15,110949,110951,1]));static Kawi=new F(new Uint32Array([73472,73488,1,73490,73530,1,73534,73562,1]));static Kayah_Li=new F(new Uint32Array([43264,43309,1,43311,43311,1]));static Kharoshthi=new F(new Uint32Array([68096,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1]));static Khitan_Small_Script=new F(new Uint32Array([94180,101120,6940,101121,101589,1,101631,101631,1]));static Khmer=new F(new Uint32Array([6016,6109,1,6112,6121,1,6128,6137,1,6624,6655,1]));static Khojki=new F(new Uint32Array([70144,70161,1,70163,70209,1]));static Khudawadi=new F(new Uint32Array([70320,70378,1,70384,70393,1]));static Kirat_Rai=new F(new Uint32Array([93504,93561,1]));static Lao=new F(new Uint32Array([3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1]));static Latin=new F(new Uint32Array([65,90,1,97,122,1,170,186,16,192,214,1,216,246,1,248,696,1,736,740,1,7424,7461,1,7468,7516,1,7522,7525,1,7531,7543,1,7545,7614,1,7680,7935,1,8305,8319,14,8336,8348,1,8490,8491,1,8498,8526,28,8544,8584,1,11360,11391,1,42786,42887,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43007,1,43824,43866,1,43868,43876,1,43878,43881,1,64256,64262,1,65313,65338,1,65345,65370,1,67456,67461,1,67463,67504,1,67506,67514,1,122624,122654,1,122661,122666,1]));static Lepcha=new F(new Uint32Array([7168,7223,1,7227,7241,1,7245,7247,1]));static Limbu=new F(new Uint32Array([6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6479,1]));static Linear_A=new F(new Uint32Array([67072,67382,1,67392,67413,1,67424,67431,1]));static Linear_B=new F(new Uint32Array([65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1]));static Lisu=new F(new Uint32Array([42192,42239,1,73648,73648,1]));static Lycian=new F(new Uint32Array([66176,66204,1]));static Lydian=new F(new Uint32Array([67872,67897,1,67903,67903,1]));static Mahajani=new F(new Uint32Array([69968,70006,1]));static Makasar=new F(new Uint32Array([73440,73464,1]));static Malayalam=new F(new Uint32Array([3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1]));static Mandaic=new F(new Uint32Array([2112,2139,1,2142,2142,1]));static Manichaean=new F(new Uint32Array([68288,68326,1,68331,68342,1]));static Marchen=new F(new Uint32Array([72816,72847,1,72850,72871,1,72873,72886,1]));static Masaram_Gondi=new F(new Uint32Array([72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1]));static Medefaidrin=new F(new Uint32Array([93760,93850,1]));static Meetei_Mayek=new F(new Uint32Array([43744,43766,1,43968,44013,1,44016,44025,1]));static Mende_Kikakui=new F(new Uint32Array([124928,125124,1,125127,125142,1]));static Meroitic_Cursive=new F(new Uint32Array([68e3,68023,1,68028,68047,1,68050,68095,1]));static Meroitic_Hieroglyphs=new F(new Uint32Array([67968,67999,1]));static Miao=new F(new Uint32Array([93952,94026,1,94031,94087,1,94095,94111,1]));static Modi=new F(new Uint32Array([71168,71236,1,71248,71257,1]));static Mongolian=new F(new Uint32Array([6144,6145,1,6148,6150,2,6151,6169,1,6176,6264,1,6272,6314,1,71264,71276,1]));static Mro=new F(new Uint32Array([92736,92766,1,92768,92777,1,92782,92783,1]));static Multani=new F(new Uint32Array([70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1]));static Myanmar=new F(new Uint32Array([4096,4255,1,43488,43518,1,43616,43647,1,71376,71395,1]));static Nabataean=new F(new Uint32Array([67712,67742,1,67751,67759,1]));static Nag_Mundari=new F(new Uint32Array([124112,124153,1]));static Nandinagari=new F(new Uint32Array([72096,72103,1,72106,72151,1,72154,72164,1]));static New_Tai_Lue=new F(new Uint32Array([6528,6571,1,6576,6601,1,6608,6618,1,6622,6623,1]));static Newa=new F(new Uint32Array([70656,70747,1,70749,70753,1]));static Nko=new F(new Uint32Array([1984,2042,1,2045,2047,1]));static Nushu=new F(new Uint32Array([94177,110960,16783,110961,111355,1]));static Nyiakeng_Puachue_Hmong=new F(new Uint32Array([123136,123180,1,123184,123197,1,123200,123209,1,123214,123215,1]));static Ogham=new F(new Uint32Array([5760,5788,1]));static Ol_Chiki=new F(new Uint32Array([7248,7295,1]));static Ol_Onal=new F(new Uint32Array([124368,124410,1,124415,124415,1]));static Old_Hungarian=new F(new Uint32Array([68736,68786,1,68800,68850,1,68858,68863,1]));static Old_Italic=new F(new Uint32Array([66304,66339,1,66349,66351,1]));static Old_North_Arabian=new F(new Uint32Array([68224,68255,1]));static Old_Permic=new F(new Uint32Array([66384,66426,1]));static Old_Persian=new F(new Uint32Array([66464,66499,1,66504,66517,1]));static Old_Sogdian=new F(new Uint32Array([69376,69415,1]));static Old_South_Arabian=new F(new Uint32Array([68192,68223,1]));static Old_Turkic=new F(new Uint32Array([68608,68680,1]));static Old_Uyghur=new F(new Uint32Array([69488,69513,1]));static Oriya=new F(new Uint32Array([2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1]));static Osage=new F(new Uint32Array([66736,66771,1,66776,66811,1]));static Osmanya=new F(new Uint32Array([66688,66717,1,66720,66729,1]));static Pahawh_Hmong=new F(new Uint32Array([92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1]));static Palmyrene=new F(new Uint32Array([67680,67711,1]));static Pau_Cin_Hau=new F(new Uint32Array([72384,72440,1]));static Phags_Pa=new F(new Uint32Array([43072,43127,1]));static Phoenician=new F(new Uint32Array([67840,67867,1,67871,67871,1]));static Psalter_Pahlavi=new F(new Uint32Array([68480,68497,1,68505,68508,1,68521,68527,1]));static Rejang=new F(new Uint32Array([43312,43347,1,43359,43359,1]));static Runic=new F(new Uint32Array([5792,5866,1,5870,5880,1]));static Samaritan=new F(new Uint32Array([2048,2093,1,2096,2110,1]));static Saurashtra=new F(new Uint32Array([43136,43205,1,43214,43225,1]));static Sharada=new F(new Uint32Array([70016,70111,1]));static Shavian=new F(new Uint32Array([66640,66687,1]));static Siddham=new F(new Uint32Array([71040,71093,1,71096,71133,1]));static SignWriting=new F(new Uint32Array([120832,121483,1,121499,121503,1,121505,121519,1]));static Sinhala=new F(new Uint32Array([3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,70113,70132,1]));static Sogdian=new F(new Uint32Array([69424,69465,1]));static Sora_Sompeng=new F(new Uint32Array([69840,69864,1,69872,69881,1]));static Soyombo=new F(new Uint32Array([72272,72354,1]));static Sundanese=new F(new Uint32Array([7040,7103,1,7360,7367,1]));static Sunuwar=new F(new Uint32Array([72640,72673,1,72688,72697,1]));static Syloti_Nagri=new F(new Uint32Array([43008,43052,1]));static Syriac=new F(new Uint32Array([1792,1805,1,1807,1866,1,1869,1871,1,2144,2154,1]));static Tagalog=new F(new Uint32Array([5888,5909,1,5919,5919,1]));static Tagbanwa=new F(new Uint32Array([5984,5996,1,5998,6e3,1,6002,6003,1]));static Tai_Le=new F(new Uint32Array([6480,6509,1,6512,6516,1]));static Tai_Tham=new F(new Uint32Array([6688,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1]));static Tai_Viet=new F(new Uint32Array([43648,43714,1,43739,43743,1]));static Takri=new F(new Uint32Array([71296,71353,1,71360,71369,1]));static Tamil=new F(new Uint32Array([2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,73664,73713,1,73727,73727,1]));static Tangsa=new F(new Uint32Array([92784,92862,1,92864,92873,1]));static Tangut=new F(new Uint32Array([94176,94208,32,94209,100343,1,100352,101119,1,101632,101640,1]));static Telugu=new F(new Uint32Array([3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3199,1]));static Thaana=new F(new Uint32Array([1920,1969,1]));static Thai=new F(new Uint32Array([3585,3642,1,3648,3675,1]));static Tibetan=new F(new Uint32Array([3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4052,1,4057,4058,1]));static Tifinagh=new F(new Uint32Array([11568,11623,1,11631,11632,1,11647,11647,1]));static Tirhuta=new F(new Uint32Array([70784,70855,1,70864,70873,1]));static Todhri=new F(new Uint32Array([67008,67059,1]));static Toto=new F(new Uint32Array([123536,123566,1]));static Tulu_Tigalari=new F(new Uint32Array([70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1]));static Ugaritic=new F(new Uint32Array([66432,66461,1,66463,66463,1]));static Vai=new F(new Uint32Array([42240,42539,1]));static Vithkuqi=new F(new Uint32Array([66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1]));static Wancho=new F(new Uint32Array([123584,123641,1,123647,123647,1]));static Warang_Citi=new F(new Uint32Array([71840,71922,1,71935,71935,1]));static Yezidi=new F(new Uint32Array([69248,69289,1,69291,69293,1,69296,69297,1]));static Yi=new F(new Uint32Array([40960,42124,1,42128,42182,1]));static Zanabazar_Square=new F(new Uint32Array([72192,72263,1]));static CATEGORIES=new Map([["C",B.C],["Cc",B.Cc],["Cf",B.Cf],["Co",B.Co],["Cs",B.Cs],["L",B.L],["Ll",B.Ll],["Lm",B.Lm],["Lo",B.Lo],["Lt",B.Lt],["Lu",B.Lu],["M",B.M],["Mc",B.Mc],["Me",B.Me],["Mn",B.Mn],["N",B.N],["Nd",B.Nd],["Nl",B.Nl],["No",B.No],["P",B.P],["Pc",B.Pc],["Pd",B.Pd],["Pe",B.Pe],["Pf",B.Pf],["Pi",B.Pi],["Po",B.Po],["Ps",B.Ps],["S",B.S],["Sc",B.Sc],["Sk",B.Sk],["Sm",B.Sm],["So",B.So],["Z",B.Z],["Zl",B.Zl],["Zp",B.Zp],["Zs",B.Zs]]);static SCRIPTS=new Map([["Adlam",B.Adlam],["Ahom",B.Ahom],["Anatolian_Hieroglyphs",B.Anatolian_Hieroglyphs],["Arabic",B.Arabic],["Armenian",B.Armenian],["Avestan",B.Avestan],["Balinese",B.Balinese],["Bamum",B.Bamum],["Bassa_Vah",B.Bassa_Vah],["Batak",B.Batak],["Bengali",B.Bengali],["Bhaiksuki",B.Bhaiksuki],["Bopomofo",B.Bopomofo],["Brahmi",B.Brahmi],["Braille",B.Braille],["Buginese",B.Buginese],["Buhid",B.Buhid],["Canadian_Aboriginal",B.Canadian_Aboriginal],["Carian",B.Carian],["Caucasian_Albanian",B.Caucasian_Albanian],["Chakma",B.Chakma],["Cham",B.Cham],["Cherokee",B.Cherokee],["Chorasmian",B.Chorasmian],["Common",B.Common],["Coptic",B.Coptic],["Cuneiform",B.Cuneiform],["Cypriot",B.Cypriot],["Cypro_Minoan",B.Cypro_Minoan],["Cyrillic",B.Cyrillic],["Deseret",B.Deseret],["Devanagari",B.Devanagari],["Dives_Akuru",B.Dives_Akuru],["Dogra",B.Dogra],["Duployan",B.Duployan],["Egyptian_Hieroglyphs",B.Egyptian_Hieroglyphs],["Elbasan",B.Elbasan],["Elymaic",B.Elymaic],["Ethiopic",B.Ethiopic],["Garay",B.Garay],["Georgian",B.Georgian],["Glagolitic",B.Glagolitic],["Gothic",B.Gothic],["Grantha",B.Grantha],["Greek",B.Greek],["Gujarati",B.Gujarati],["Gunjala_Gondi",B.Gunjala_Gondi],["Gurmukhi",B.Gurmukhi],["Gurung_Khema",B.Gurung_Khema],["Han",B.Han],["Hangul",B.Hangul],["Hanifi_Rohingya",B.Hanifi_Rohingya],["Hanunoo",B.Hanunoo],["Hatran",B.Hatran],["Hebrew",B.Hebrew],["Hiragana",B.Hiragana],["Imperial_Aramaic",B.Imperial_Aramaic],["Inherited",B.Inherited],["Inscriptional_Pahlavi",B.Inscriptional_Pahlavi],["Inscriptional_Parthian",B.Inscriptional_Parthian],["Javanese",B.Javanese],["Kaithi",B.Kaithi],["Kannada",B.Kannada],["Katakana",B.Katakana],["Kawi",B.Kawi],["Kayah_Li",B.Kayah_Li],["Kharoshthi",B.Kharoshthi],["Khitan_Small_Script",B.Khitan_Small_Script],["Khmer",B.Khmer],["Khojki",B.Khojki],["Khudawadi",B.Khudawadi],["Kirat_Rai",B.Kirat_Rai],["Lao",B.Lao],["Latin",B.Latin],["Lepcha",B.Lepcha],["Limbu",B.Limbu],["Linear_A",B.Linear_A],["Linear_B",B.Linear_B],["Lisu",B.Lisu],["Lycian",B.Lycian],["Lydian",B.Lydian],["Mahajani",B.Mahajani],["Makasar",B.Makasar],["Malayalam",B.Malayalam],["Mandaic",B.Mandaic],["Manichaean",B.Manichaean],["Marchen",B.Marchen],["Masaram_Gondi",B.Masaram_Gondi],["Medefaidrin",B.Medefaidrin],["Meetei_Mayek",B.Meetei_Mayek],["Mende_Kikakui",B.Mende_Kikakui],["Meroitic_Cursive",B.Meroitic_Cursive],["Meroitic_Hieroglyphs",B.Meroitic_Hieroglyphs],["Miao",B.Miao],["Modi",B.Modi],["Mongolian",B.Mongolian],["Mro",B.Mro],["Multani",B.Multani],["Myanmar",B.Myanmar],["Nabataean",B.Nabataean],["Nag_Mundari",B.Nag_Mundari],["Nandinagari",B.Nandinagari],["New_Tai_Lue",B.New_Tai_Lue],["Newa",B.Newa],["Nko",B.Nko],["Nushu",B.Nushu],["Nyiakeng_Puachue_Hmong",B.Nyiakeng_Puachue_Hmong],["Ogham",B.Ogham],["Ol_Chiki",B.Ol_Chiki],["Ol_Onal",B.Ol_Onal],["Old_Hungarian",B.Old_Hungarian],["Old_Italic",B.Old_Italic],["Old_North_Arabian",B.Old_North_Arabian],["Old_Permic",B.Old_Permic],["Old_Persian",B.Old_Persian],["Old_Sogdian",B.Old_Sogdian],["Old_South_Arabian",B.Old_South_Arabian],["Old_Turkic",B.Old_Turkic],["Old_Uyghur",B.Old_Uyghur],["Oriya",B.Oriya],["Osage",B.Osage],["Osmanya",B.Osmanya],["Pahawh_Hmong",B.Pahawh_Hmong],["Palmyrene",B.Palmyrene],["Pau_Cin_Hau",B.Pau_Cin_Hau],["Phags_Pa",B.Phags_Pa],["Phoenician",B.Phoenician],["Psalter_Pahlavi",B.Psalter_Pahlavi],["Rejang",B.Rejang],["Runic",B.Runic],["Samaritan",B.Samaritan],["Saurashtra",B.Saurashtra],["Sharada",B.Sharada],["Shavian",B.Shavian],["Siddham",B.Siddham],["SignWriting",B.SignWriting],["Sinhala",B.Sinhala],["Sogdian",B.Sogdian],["Sora_Sompeng",B.Sora_Sompeng],["Soyombo",B.Soyombo],["Sundanese",B.Sundanese],["Sunuwar",B.Sunuwar],["Syloti_Nagri",B.Syloti_Nagri],["Syriac",B.Syriac],["Tagalog",B.Tagalog],["Tagbanwa",B.Tagbanwa],["Tai_Le",B.Tai_Le],["Tai_Tham",B.Tai_Tham],["Tai_Viet",B.Tai_Viet],["Takri",B.Takri],["Tamil",B.Tamil],["Tangsa",B.Tangsa],["Tangut",B.Tangut],["Telugu",B.Telugu],["Thaana",B.Thaana],["Thai",B.Thai],["Tibetan",B.Tibetan],["Tifinagh",B.Tifinagh],["Tirhuta",B.Tirhuta],["Todhri",B.Todhri],["Toto",B.Toto],["Tulu_Tigalari",B.Tulu_Tigalari],["Ugaritic",B.Ugaritic],["Vai",B.Vai],["Vithkuqi",B.Vithkuqi],["Wancho",B.Wancho],["Warang_Citi",B.Warang_Citi],["Yezidi",B.Yezidi],["Yi",B.Yi],["Zanabazar_Square",B.Zanabazar_Square]]);static FOLD_CATEGORIES=new Map([["L",B.foldL],["Ll",B.foldLl],["Lt",B.foldLt],["Lu",B.foldLu],["M",B.foldM],["Mn",B.foldMn]]);static FOLD_SCRIPT=new Map([["Common",B.foldCommon],["Greek",B.foldGreek],["Inherited",B.foldInherited]]);static Print=new F(new Uint32Array([33,126,1,161,172,1,174,887,1,890,895,1,900,906,1,908,910,2,911,929,1,931,1327,1,1329,1366,1,1369,1418,1,1421,1423,1,1425,1479,1,1488,1514,1,1519,1524,1,1542,1563,1,1565,1756,1,1758,1805,1,1808,1866,1,1869,1969,1,1984,2042,1,2045,2093,1,2096,2110,1,2112,2139,1,2142,2144,2,2145,2154,1,2160,2190,1,2199,2273,1,2275,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1,2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1,2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1,2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1,2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1,3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1,3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,3585,3642,1,3647,3675,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1,3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4058,1,4096,4293,1,4295,4301,6,4304,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,5024,5109,1,5112,5117,1,5120,5759,1,5761,5788,1,5792,5880,1,5888,5909,1,5919,5942,1,5952,5971,1,5984,5996,1,5998,6e3,1,6002,6003,1,6016,6109,1,6112,6121,1,6128,6137,1,6144,6157,1,6159,6169,1,6176,6264,1,6272,6314,1,6320,6389,1,6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6608,6618,1,6622,6683,1,6686,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1,6832,6862,1,6912,6988,1,6990,7155,1,7164,7223,1,7227,7241,1,7245,7306,1,7312,7354,1,7357,7367,1,7376,7418,1,7424,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8208,8231,1,8240,8286,1,8304,8305,1,8308,8334,1,8336,8348,1,8352,8384,1,8400,8432,1,8448,8587,1,8592,9257,1,9280,9290,1,9312,11123,1,11126,11157,1,11159,11507,1,11513,11557,1,11559,11565,6,11568,11623,1,11631,11632,1,11647,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11744,11869,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12289,12351,1,12353,12438,1,12441,12543,1,12549,12591,1,12593,12686,1,12688,12773,1,12783,12830,1,12832,42124,1,42128,42182,1,42192,42539,1,42560,42743,1,42752,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43052,1,43056,43065,1,43072,43127,1,43136,43205,1,43214,43225,1,43232,43347,1,43359,43388,1,43392,43469,1,43471,43481,1,43486,43518,1,43520,43574,1,43584,43597,1,43600,43609,1,43612,43714,1,43739,43766,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43883,1,43888,44013,1,44016,44025,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64450,1,64467,64911,1,64914,64967,1,64975,65008,33,65009,65049,1,65056,65106,1,65108,65126,1,65128,65131,1,65136,65140,1,65142,65276,1,65281,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65504,65510,1,65512,65518,1,65532,65533,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,65792,65794,1,65799,65843,1,65847,65934,1,65936,65948,1,65952,66e3,48,66001,66045,1,66176,66204,1,66208,66256,1,66272,66299,1,66304,66339,1,66349,66378,1,66384,66426,1,66432,66461,1,66463,66499,1,66504,66517,1,66560,66717,1,66720,66729,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66927,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67671,67742,1,67751,67759,1,67808,67826,1,67828,67829,1,67835,67867,1,67871,67897,1,67903,67968,65,67969,68023,1,68028,68047,1,68050,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1,68192,68255,1,68288,68326,1,68331,68342,1,68352,68405,1,68409,68437,1,68440,68466,1,68472,68497,1,68505,68508,1,68521,68527,1,68608,68680,1,68736,68786,1,68800,68850,1,68858,68903,1,68912,68921,1,68928,68965,1,68969,68997,1,69006,69007,1,69216,69246,1,69248,69289,1,69291,69293,1,69296,69297,1,69314,69316,1,69372,69415,1,69424,69465,1,69488,69513,1,69552,69579,1,69600,69622,1,69632,69709,1,69714,69749,1,69759,69820,1,69822,69826,1,69840,69864,1,69872,69881,1,69888,69940,1,69942,69959,1,69968,70006,1,70016,70111,1,70113,70132,1,70144,70161,1,70163,70209,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1,70320,70378,1,70384,70393,1,70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70459,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1,70656,70747,1,70749,70753,1,70784,70855,1,70864,70873,1,71040,71093,1,71096,71133,1,71168,71236,1,71248,71257,1,71264,71276,1,71296,71353,1,71360,71369,1,71376,71395,1,71424,71450,1,71453,71467,1,71472,71494,1,71680,71739,1,71840,71922,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1,72096,72103,1,72106,72151,1,72154,72164,1,72192,72263,1,72272,72354,1,72368,72440,1,72448,72457,1,72640,72673,1,72688,72697,1,72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1,72816,72847,1,72850,72871,1,72873,72886,1,72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1,73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1,73440,73464,1,73472,73488,1,73490,73530,1,73534,73562,1,73648,73664,16,73665,73713,1,73727,74649,1,74752,74862,1,74864,74868,1,74880,75075,1,77712,77810,1,77824,78895,1,78912,78933,1,78944,82938,1,82944,83526,1,90368,90425,1,92160,92728,1,92736,92766,1,92768,92777,1,92782,92862,1,92864,92873,1,92880,92909,1,92912,92917,1,92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1,93504,93561,1,93760,93850,1,93952,94026,1,94031,94087,1,94095,94111,1,94176,94180,1,94192,94193,1,94208,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1,117760,118009,1,118016,118451,1,118528,118573,1,118576,118598,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119154,1,119163,119274,1,119296,119365,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,121483,1,121499,121503,1,121505,121519,1,122624,122654,1,122661,122666,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,122928,122989,1,123023,123136,113,123137,123180,1,123184,123197,1,123200,123209,1,123214,123215,1,123536,123566,1,123584,123641,1,123647,124112,465,124113,124153,1,124368,124410,1,124415,124896,481,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125127,125142,1,125184,125259,1,125264,125273,1,125278,125279,1,126065,126132,1,126209,126269,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1,917760,917999,1]))},De=class{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(e,t){let r=0,n=e.length;for(;rn)continue;let i=e.getLo(r);if(t0&&t>=e.getLo(0)&&this.is32(e,t)}static isUpper(e){if(e<=this.MAX_LATIN1){let t=String.fromCodePoint(e);return t.toUpperCase()===t&&t.toLowerCase()!==t}return this.is(Dn.Upper,e)}static isPrint(e){return e<=this.MAX_LATIN1?e>=32&&e=161&&e!==173:this.is(Dn.Print,e)}static simpleFold(e){if(Dn.CASE_ORBIT.has(e))return Dn.CASE_ORBIT.get(e);let t=V.toLowerCase(e);return t!==e?t:V.toUpperCase(e)}static equalsIgnoreCase(e,t){if(e<0||t<0||e===t)return!0;if(e<=this.MAX_ASCII&&t<=this.MAX_ASCII)return V.CODES.get("A")<=e&&e<=V.CODES.get("Z")&&(e|=32),V.CODES.get("A")<=t&&t<=V.CODES.get("Z")&&(t|=32),e===t;for(let r=this.simpleFold(e);r!==e;r=this.simpleFold(r))if(r===t)return!0;return!1}},et=class{static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(e){return V.CODES.get("0")<=e&&e<=V.CODES.get("9")||V.CODES.get("a")<=e&&e<=V.CODES.get("z")||V.CODES.get("A")<=e&&e<=V.CODES.get("Z")}static unhex(e){return V.CODES.get("0")<=e&&e<=V.CODES.get("9")?e-V.CODES.get("0"):V.CODES.get("a")<=e&&e<=V.CODES.get("f")?e-V.CODES.get("a")+10:V.CODES.get("A")<=e&&e<=V.CODES.get("F")?e-V.CODES.get("A")+10:-1}static escapeRune(e){let t="";if(De.isPrint(e))this.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(t+="\\"),t+=String.fromCodePoint(e);else switch(e){case V.CODES.get('"'):t+='\\"';break;case V.CODES.get("\\"):t+="\\\\";break;case V.CODES.get(" "):t+="\\t";break;case V.CODES.get(` `):t+="\\n";break;case V.CODES.get("\r"):t+="\\r";break;case V.CODES.get("\b"):t+="\\b";break;case V.CODES.get("\f"):t+="\\f";break;default:{let r=e.toString(16);e<256?(t+="\\x",r.length===1&&(t+="0"),t+=r):t+=`\\x{${r}}`;break}}return t}static stringToRunes(e){return String(e).split("").map(t=>t.codePointAt(0))}static runeToString(e){return String.fromCodePoint(e)}static isWordRune(e){return V.CODES.get("a")<=e&&e<=V.CODES.get("z")||V.CODES.get("A")<=e&&e<=V.CODES.get("Z")||V.CODES.get("0")<=e&&e<=V.CODES.get("9")||e===V.CODES.get("_")}static emptyOpContext(e,t){let r=0;return e<0&&(r|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),e===V.CODES.get(` `)&&(r|=this.EMPTY_BEGIN_LINE),t<0&&(r|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),t===V.CODES.get(` `)&&(r|=this.EMPTY_END_LINE),this.isWordRune(e)!==this.isWordRune(t)?r|=this.EMPTY_WORD_BOUNDARY:r|=this.EMPTY_NO_WORD_BOUNDARY,r}static quoteMeta(e){return e.split("").map(t=>this.METACHARACTERS.indexOf(t)>=0?`\\${t}`:t).join("")}static charCount(e){return e>De.MAX_BMP?2:1}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(e));{let t=[],r=0;for(let n=0;n>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(e));{let t=[],r=0,n=0;for(;r191&&i<224){let a=e[r++];t[n++]=String.fromCharCode((i&31)<<6|a&63)}else if(i>239&&i<365){let a=e[r++],s=e[r++],o=e[r++],l=((i&7)<<18|(a&63)<<12|(s&63)<<6|o&63)-65536;t[n++]=String.fromCharCode(55296+(l>>10)),t[n++]=String.fromCharCode(56320+(l&1023))}else{let a=e[r++],s=e[r++];t[n++]=String.fromCharCode((i&15)<<12|(a&63)<<6|s&63)}}return t.join("")}}},bd=(e=[],t=0)=>{let r={};for(let n=0;ne.codePointAt(0))}length(){return this.charSequence.length}},Mo=class{static utf16(e){return new Ky(e)}static utf8(e){return Array.isArray(e)?new wd(e):new wd(et.stringToUtf8ByteArray(e))}},wi=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},Yy=class extends wi{constructor(e,t=0,r=e.length){super(),this.bytes=e,this.start=t,this.end=r}step(e){if(e+=this.start,e>=this.end)return wi.EOF();let t=this.bytes[e++]&255;return(t&128)===0?t<<3|1:(t&224)===192?(t=t&31,e>=this.end?wi.EOF():(t=t<<6|this.bytes[e++]&63,t<<3|2)):(t&240)===224?(t=t&15,e+1>=this.end?wi.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|3)):(t=t&7,e+2>=this.end?wi.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|4))}index(e,t){t+=this.start;let r=this.indexOf(this.bytes,e.prefixUTF8,t);return r<0?r:r-t}context(e){e+=this.start;let t=-1;if(e>this.start&&e<=this.end){let n=e-1;if(t=this.bytes[n--],t>=128){let i=e-4;for(i=i&&(this.bytes[n]&192)===128;)n--;n>3}}let r=e>3:-1;return et.emptyOpContext(t,r)}indexOf(e,t,r=0){let n=t.length;if(n===0)return-1;let i=e.length;for(let a=r;a<=i-n;a++)for(let s=0;s0&&e<=this.charSequence.length?this.charSequence.codePointAt(e-1):-1,r=e{let r=t.codePointAt(0);return r===V.CODES.get("\\")||r===V.CODES.get("$")?`\\${t}`:t}).join("")}constructor(e,t){if(e===null)throw new Error("pattern is null");this.patternInput=e;let r=this.patternInput.re2();this.patternGroupCount=r.numberOfCapturingGroups(),this.groups=[],this.namedGroups=r.namedGroups,this.numberOfInstructions=r.numberOfInstructions(),t instanceof ba?this.resetMatcherInput(t):Array.isArray(t)?this.resetMatcherInput(Mo.utf8(t)):this.resetMatcherInput(Mo.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(e===null)throw new Error("input is null");return this.matcherInput=e,this.reset(),this}start(e=0){if(typeof e=="string"){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new ti(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if(typeof e=="string"){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new ti(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}programSize(){return this.numberOfInstructions}group(e=0){if(typeof e=="string"){let n=this.namedGroups[e];if(!Number.isFinite(n))throw new ti(`group '${e}' not found`);e=n}let t=this.start(e),r=this.end(e);return t<0&&r<0?null:this.substring(t,r)}groupCount(){return this.patternGroupCount}loadGroup(e){if(e<0||e>this.patternGroupCount)throw new ti(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new ti("perhaps no match attempted");if(e===0||this.hasGroups)return;let t=this.groups[1]+1;t>this.matcherInputLength&&(t=this.matcherInputLength);let r=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount);if(!r[0])throw new ti("inconsistency in matching group data");this.groups=r[1],this.hasGroups=!0}matches(){return this.genMatch(0,oe.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,oe.ANCHOR_START)}find(e=null){if(e!==null){if(e<0||e>this.matcherInputLength)throw new ti(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}return e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1]&&e++),this.genMatch(e,oe.UNANCHORED)}genMatch(e,t){let r=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1);return r[0]?(this.groups=r[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=t,!0):!1}substring(e,t){return this.matcherInput.isUTF8Encoding()?et.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let r="",n=this.start(),i=this.end();return this.appendPosV.CODES.get("9")||s*10+a-V.CODES.get("0")>this.patternGroupCount));i++)s=s*10+a-V.CODES.get("0");if(s>this.patternGroupCount)throw new ti(`n > number of groups: ${s}`);let o=this.group(s);o!==null&&(t+=o),r=i,i--;continue}else if(a===V.CODES.get("{")){rV.CODES.get("9")||s*10+a-V.CODES.get("0")>this.patternGroupCount));i++)s=s*10+a-V.CODES.get("0");if(s>this.patternGroupCount){t+=`$${s}`,r=i,i--;continue}let o=this.group(s);o!==null&&(t+=o),r=i,i--;continue}else if(a===V.CODES.get("<")){r")&&e.codePointAt(s)!==V.CODES.get(" ");)s++;if(s===e.length||e.codePointAt(s)!==V.CODES.get(">")){t+=e.substring(i-1,s+1),r=s+1;continue}let o=e.substring(i+1,s);Object.prototype.hasOwnProperty.call(this.namedGroups,o)?t+=this.group(o):t+=`$<${o}>`,r=s+1}}return r ${this.out}, ${this.arg}`;case _r.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case _r.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case _r.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case _r.MATCH:return"match";case _r.FAIL:return"fail";case _r.NOP:return`nop -> ${this.out}`;case _r.RUNE:return this.runes===null?"rune ":["rune ",_r.escapeRunes(this.runes),(this.arg&oe.FOLD_CASE)!==0?"/i":""," -> ",this.out].join("");case _r.RUNE1:return`rune1 ${_r.escapeRunes(this.runes)} -> ${this.out}`;case _r.RUNE_ANY:return`any -> ${this.out}`;case _r.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},n6=class{constructor(){this.inst=null,this.cap=[]}},vd=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(e){let t=this.sparse[e];return tthis.matchcap.length?this.initNewCap(t):this.resetCap(t)}resetCap(t){for(let r=0;r0?(this.poolSize--,r=this.pool[this.poolSize]):r=new n6,r.inst=t,r}freeQueue(t,r=0){let n=t.size-r,i=this.poolSize+n;this.pool.length>3,u=o&7,c=-1,p=0;o!==wi.EOF()&&(o=t.step(r+u),c=o>>3,p=o&7);let d;for(r===0?d=et.emptyOpContext(-1,l):d=t.context(r);;){if(a.isEmpty()){if((i&et.EMPTY_BEGIN_TEXT)!==0&&r!==0||this.matched)break;if(this.re2.prefix.length!==0&&c!==this.re2.prefixRune&&t.canCheckPrefix()){let m=t.index(this.re2,r);if(m<0)break;r+=m,o=t.step(r),l=o>>3,u=o&7,o=t.step(r+u),c=o>>3,p=o&7}}!this.matched&&(r===0||n===oe.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=r),this.add(a,this.prog.start,r,this.matchcap,d,null));let f=r+u;if(d=t.context(f),this.step(a,s,r,f,l,d,n,r===t.endPos()),u===0||this.ncap===0&&this.matched)break;r+=u,l=c,u=p,l!==-1&&(o=t.step(r+u),c=o>>3,p=o&7);let h=a;a=s,s=h}return this.freeQueue(s),this.matched}step(t,r,n,i,a,s,o,l){let u=this.re2.longest;for(let c=0;c0&&this.matchcap[0]0&&(!u||!this.matched||this.matchcap[1]0&&s.cap!==i&&(s.cap=i.slice(0,this.ncap)),t.denseThreads[o]=s,s=null;break;default:throw new Error("unhandled")}return s}},i6=e=>{let t=-2128831035;for(let r=0;r{if(e.length!==t.length)return!1;for(let r=0;r0;){let i=r.pop();if(t.has(i))continue;t.add(i);let a=this.prog.getInst(i);switch(a.op){case Me.MATCH:n=!0;break;case Me.ALT:case Me.ALT_MATCH:r.push(a.out),r.push(a.arg);break;case Me.NOP:case Me.CAPTURE:r.push(a.out);break;case Me.EMPTY_WIDTH:return null}}return{pcs:Int32Array.from(t).sort(),isMatch:n}}getState(e){let t=this.computeClosure(e);if(!t)return null;let r=t.pcs,n=i6(r),i=this.stateCache.get(n);if(i)for(let s=0;s=this.stateLimit)return this.stateCache.clear(),this.stateCount=0,this.startState=null,null;let a=new s6(r,t.isMatch);return i.push(a),this.stateCount++,a}step(e,t,r){if(r===oe.UNANCHORED&&t<=De.MAX_ASCII){let a=e.nextAscii[t];if(a!==null)return a}else{let a=t+(r===oe.UNANCHORED?0:De.MAX_RUNE+1);if(e.nextMap.has(a))return e.nextMap.get(a)}let n=[];for(let a=0;a>3,l=s&7;if(l===0)break;if(i=this.step(i,o,r),i===null)return null;if(i.isMatch)if(r===oe.ANCHOR_BOTH){if(a+l===n)return!0}else return!0;if(i.nfaStates.length===0&&r!==oe.UNANCHORED)return!1;a+=l}return!1}},X=class Re{static Op=bd(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]);static isPseudoOp(t){return t>=Re.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(t){return t===V.CODES.get("-")?"\\":""}static fromRegexp(t){let r=new Re(t.op);return r.flags=t.flags,r.subs=t.subs,r.runes=t.runes,r.cap=t.cap,r.min=t.min,r.max=t.max,r.name=t.name,r.namedGroups=t.namedGroups,r}constructor(t){this.op=t,this.flags=0,this.subs=Re.emptySubs(),this.runes=[],this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=Re.emptySubs(),this.runes=[],this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let t="";switch(this.op){case Re.Op.NO_MATCH:t+="[^\\x00-\\x{10FFFF}]";break;case Re.Op.EMPTY_MATCH:t+="(?:)";break;case Re.Op.STAR:case Re.Op.PLUS:case Re.Op.QUEST:case Re.Op.REPEAT:{let r=this.subs[0];switch(r.op>Re.Op.CAPTURE||r.op===Re.Op.LITERAL&&r.runes.length>1?t+=`(?:${r.appendTo()})`:t+=r.appendTo(),this.op){case Re.Op.STAR:t+="*";break;case Re.Op.PLUS:t+="+";break;case Re.Op.QUEST:t+="?";break;case Re.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=",",this.max>=0&&(t+=this.max)),t+="}";break}(this.flags&oe.NON_GREEDY)!==0&&(t+="?");break}case Re.Op.CONCAT:{for(let r of this.subs)r.op===Re.Op.ALTERNATE?t+=`(?:${r.appendTo()})`:t+=r.appendTo();break}case Re.Op.ALTERNATE:{let r="";for(let n of this.subs)t+=r,r="|",t+=n.appendTo();break}case Re.Op.LITERAL:(this.flags&oe.FOLD_CASE)!==0&&(t+="(?i:");for(let r of this.runes)t+=et.escapeRune(r);(this.flags&oe.FOLD_CASE)!==0&&(t+=")");break;case Re.Op.ANY_CHAR_NOT_NL:t+="(?-s:.)";break;case Re.Op.ANY_CHAR:t+="(?s:.)";break;case Re.Op.CAPTURE:this.name===null||this.name.length===0?t+="(":t+=`(?P<${this.name}>`,this.subs[0].op!==Re.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=")";break;case Re.Op.BEGIN_TEXT:t+="\\A";break;case Re.Op.END_TEXT:(this.flags&oe.WAS_DOLLAR)!==0?t+="(?-m:$)":t+="\\z";break;case Re.Op.BEGIN_LINE:t+="^";break;case Re.Op.END_LINE:t+="$";break;case Re.Op.WORD_BOUNDARY:t+="\\b";break;case Re.Op.NO_WORD_BOUNDARY:t+="\\B";break;case Re.Op.CHAR_CLASS:if(this.runes.length%2!==0){t+="[invalid char class]";break}if(t+="[",this.runes.length===0)t+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===De.MAX_RUNE){t+="^";for(let r=1;r>1];return(e&1)===0?t.out:t.arg}patch(e,t){for(;e!==0;){let r=this.inst[e>>1];(e&1)===0?(e=r.out,r.out=t):(e=r.arg,r.arg=t)}}append(e,t){if(e===0)return t;if(t===0)return e;let r=e;for(;;){let i=this.next(r);if(i===0)break;r=i}let n=this.inst[r>>1];return(r&1)===0?n.out=t:n.arg=t,e}toString(){let e="";for(let t=0;t0){n=[];for(let i=0;it.min){let i=ai.simplify1(X.Op.QUEST,t.flags,r,null);for(let a=t.min+1;a0&&(n+=" ");let a=t[i],s=t[i+1];a===s?n+=`0x${a.toString(16)}`:n+=`0x${a.toString(16)}-0x${s.toString(16)}`}return n+="]",n}static cmp(t,r,n,i){let a=t[r]-n;return a!==0?a:i-t[r+1]}static qsortIntPair(t,r,n){let i=((r+n)/2|0)&-2,a=t[i],s=t[i+1],o=r,l=n;for(;o<=l;){for(;or&&Qi.cmp(t,l,a,s)>0;)l-=2;if(o<=l){if(o!==l){let u=t[o];t[o]=t[l],t[l]=u,u=t[o+1],t[o+1]=t[l+1],t[l+1]=u}o+=2,l-=2}}rthis.r[t-1]&&(this.r[t-1]=i);continue}this.r[t]=n,this.r[t+1]=i,t+=2}return this.len=t,this}appendLiteral(t,r){return(r&oe.FOLD_CASE)!==0?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,r){if(this.len>0){for(let n=2;n<=4;n+=2)if(this.len>=n){let i=this.r[this.len-n],a=this.r[this.len-n+1];if(t<=a+1&&i<=r+1)return ta&&(this.r[this.len-n+1]=r),this}}return this.r[this.len++]=t,this.r[this.len++]=r,this}appendFoldedRange(t,r){if(t<=De.MIN_FOLD&&r>=De.MAX_FOLD)return this.appendRange(t,r);if(rDe.MAX_FOLD)return this.appendRange(t,r);tDe.MAX_FOLD&&(this.appendRange(De.MAX_FOLD+1,r),r=De.MAX_FOLD);for(let n=t;n<=r;n++){this.appendRange(n,n);for(let i=De.simpleFold(n);i!==n;i=De.simpleFold(i))this.appendRange(i,i)}return this}appendClass(t){for(let r=0;rDe.MAX_FOLD)return t;let r=t,n=t;for(t=De.simpleFold(t);t!==n;t=De.simpleFold(t))r>t&&(r=t);return r}static leadingRegexp(t){if(t.op===X.Op.EMPTY_MATCH)return null;if(t.op===X.Op.CONCAT&&t.subs.length>0){let r=t.subs[0];return r.op===X.Op.EMPTY_MATCH?null:r}return t}static literalRegexp(t,r){let n=new X(X.Op.LITERAL);return n.flags=r,n.runes=et.stringToRunes(t),n}static parse(t,r){return new Ae(t,r).parseInternal()}static parseRepeat(t){let r=t.pos();if(!t.more()||!t.lookingAt("{"))return-1;t.skip(1);let n=Ae.parseInt(t);if(n===-1||!t.more())return-1;let i;if(!t.lookingAt(","))i=n;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt("}"))i=-1;else if((i=Ae.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt("}"))return-1;if(t.skip(1),n<0||n>1e3||i===-2||i>1e3||i>=0&&n>i)throw new Ct(Ae.ERR_INVALID_REPEAT_SIZE,t.from(r));return n<<16|i&De.MAX_BMP}static isValidCaptureName(t){if(t.length===0)return!1;for(let r=0;r=V.CODES.get("0")&&t.peek()<=V.CODES.get("9");)t.skip(1);let n=t.from(r);return n.length===0||n.length>1&&n.codePointAt(0)===V.CODES.get("0")?-1:n.length>8?-2:parseFloat(n,10)}static isCharClass(t){return t.op===X.Op.LITERAL&&t.runes.length===1||t.op===X.Op.CHAR_CLASS||t.op===X.Op.ANY_CHAR_NOT_NL||t.op===X.Op.ANY_CHAR}static matchRune(t,r){switch(t.op){case X.Op.LITERAL:return t.runes.length===1&&t.runes[0]===r;case X.Op.CHAR_CLASS:for(let n=0;nV.CODES.get("7"))break;case V.CODES.get("0"):{let i=n-V.CODES.get("0");for(let a=1;a<3&&!(!t.more()||t.peek()V.CODES.get("7"));a++)i=i*8+t.peek()-V.CODES.get("0"),t.skip(1);return i}case V.CODES.get("x"):{if(!t.more())break;if(n=t.pop(),n===V.CODES.get("{")){let s=0,o=0;for(;;){if(!t.more())break e;if(n=t.pop(),n===V.CODES.get("}"))break;let l=et.unhex(n);if(l<0||(o=o*16+l,o>De.MAX_RUNE))break e;s++}if(s===0)break e;return o}let i=et.unhex(n);if(!t.more())break;n=t.pop();let a=et.unhex(n);if(i<0||a<0)break;return i*16+a}case V.CODES.get("a"):return V.CODES.get("\x07");case V.CODES.get("f"):return V.CODES.get("\f");case V.CODES.get("n"):return V.CODES.get(` `);case V.CODES.get("r"):return V.CODES.get("\r");case V.CODES.get("t"):return V.CODES.get(" ");case V.CODES.get("v"):return V.CODES.get("\v");default:if(n<=De.MAX_ASCII&&!et.isalnum(n))return n;break}throw new Ct(Ae.ERR_INVALID_ESCAPE,t.from(r))}static parseClassChar(t,r){if(!t.more())throw new Ct(Ae.ERR_MISSING_BRACKET,t.from(r));return t.lookingAt("\\")?Ae.parseEscape(t):t.pop()}static concatRunes(t,r){return[...t,...r]}constructor(t,r=0){this.wholeRegexp=t,this.flags=r,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null}newRegexp(t){let r=this.free;return r!==null&&r.subs!==null&&r.subs.length>0?(this.free=r.subs[0],r.reinit(),r.op=t):(r=new X(t),this.numRegexp+=1),r}reuse(t){this.height!==null&&Object.prototype.hasOwnProperty.call(this.height,t)&&delete this.height[t],t.subs!==null&&t.subs.length>0&&(t.subs[0]=this.free),this.free=t}checkLimits(t){if(this.numRunes>Ae.MAX_RUNES)throw new Ct(Ae.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===X.Op.REPEAT){let r=t.max;r===-1&&(r=t.min),r<=0&&(r=1),r>Ae.MAX_SIZE/this.repeats?this.repeats=Ae.MAX_SIZE:this.repeats*=r}if(this.numRegexpAe.MAX_SIZE)throw new Ct(Ae.ERR_LARGE)}calcSize(t,r=!1){if(!r&&Object.prototype.hasOwnProperty.call(this.size,t))return this.size[t];let n=0;switch(t.op){case X.Op.LITERAL:{n=t.runes.length;break}case X.Op.CAPTURE:case X.Op.STAR:{n=2+this.calcSize(t.subs[0]);break}case X.Op.PLUS:case X.Op.QUEST:{n=1+this.calcSize(t.subs[0]);break}case X.Op.CONCAT:{for(let i of t.subs)n=n+this.calcSize(i);break}case X.Op.ALTERNATE:{for(let i of t.subs)n=n+this.calcSize(i);t.subs.length>1&&(n=n+t.subs.length-1);break}case X.Op.REPEAT:{let i=this.calcSize(t.subs[0]);if(t.max===-1){t.min===0?n=2+i:n=1+t.min*i;break}n=t.max*i+(t.max-t.min);break}}return n=Math.max(1,n),this.size[t]=n,n}checkHeight(t){if(!(this.numRegexpAe.MAX_HEIGHT)throw new Ct(Ae.ERR_NESTING_DEPTH)}}calcHeight(t,r=!1){if(!r&&Object.prototype.hasOwnProperty.call(this.height,t))return this.height[t];let n=1;for(let i of t.subs){let a=this.calcHeight(i);n<1+a&&(n=1+a)}return this.height[t]=n,n}pop(){return this.stack.pop()}popToPseudo(){let t=this.stack.length,r=t;for(;r>0&&!X.isPseudoOp(this.stack[r-1].op);)r--;let n=this.stack.slice(r,t);return this.stack=this.stack.slice(0,r),n}push(t){if(this.numRunes+=t.runes.length,t.op===X.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]===t.runes[1]){if(this.maybeConcat(t.runes[0],this.flags&-2))return null;t.op=X.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags&-2}else if(t.op===X.Op.CHAR_CLASS&&t.runes.length===4&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&De.simpleFold(t.runes[0])===t.runes[2]&&De.simpleFold(t.runes[2])===t.runes[0]||t.op===X.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]+1===t.runes[1]&&De.simpleFold(t.runes[0])===t.runes[1]&&De.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|oe.FOLD_CASE))return null;t.op=X.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|oe.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(t),this.checkLimits(t),t}maybeConcat(t,r){let n=this.stack.length;if(n<2)return!1;let i=this.stack[n-1],a=this.stack[n-2];return i.op!==X.Op.LITERAL||a.op!==X.Op.LITERAL||(i.flags&oe.FOLD_CASE)!==(a.flags&oe.FOLD_CASE)?!1:(a.runes=Ae.concatRunes(a.runes,i.runes),t>=0?(i.runes=[t],i.flags=r,!0):(this.pop(),this.reuse(i),!1))}newLiteral(t,r){let n=this.newRegexp(X.Op.LITERAL);return n.flags=r,(r&oe.FOLD_CASE)!==0&&(t=Ae.minFoldRune(t)),n.runes=[t],n}literal(t){this.push(this.newLiteral(t,this.flags))}op(t){let r=this.newRegexp(t);return r.flags=this.flags,this.push(r)}repeat(t,r,n,i,a,s){let o=this.flags;if((o&oe.PERL_X)!==0&&(a.more()&&a.lookingAt("?")&&(a.skip(1),o^=oe.NON_GREEDY),s!==-1))throw new Ct(Ae.ERR_INVALID_REPEAT_OP,a.from(s));let l=this.stack.length;if(l===0)throw new Ct(Ae.ERR_MISSING_REPEAT_ARGUMENT,a.from(i));let u=this.stack[l-1];if(X.isPseudoOp(u.op))throw new Ct(Ae.ERR_MISSING_REPEAT_ARGUMENT,a.from(i));let c=this.newRegexp(t);if(c.min=r,c.max=n,c.flags=o,c.subs=[u],this.stack[l-1]=c,this.checkLimits(c),t===X.Op.REPEAT&&(r>=2||n>=2)&&!this.repeatIsValid(c,1e3))throw new Ct(Ae.ERR_INVALID_REPEAT_SIZE,a.from(i))}repeatIsValid(t,r){if(t.op===X.Op.REPEAT){let n=t.max;if(n===0)return!0;if(n<0&&(n=t.min),n>r)return!1;n>0&&(r=Math.trunc(r/n))}for(let n of t.subs)if(!this.repeatIsValid(n,r))return!1;return!0}concat(){this.maybeConcat(-1,0);let t=this.popToPseudo();return t.length===0?this.push(this.newRegexp(X.Op.EMPTY_MATCH)):this.push(this.collapse(t,X.Op.CONCAT))}alternate(){let t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),t.length===0?this.push(this.newRegexp(X.Op.NO_MATCH)):this.push(this.collapse(t,X.Op.ALTERNATE))}cleanAlt(t){t.op===X.Op.CHAR_CLASS&&(t.runes=new vi(t.runes).cleanClass().toArray(),t.runes.length===2&&t.runes[0]===0&&t.runes[1]===De.MAX_RUNE?(t.runes=[],t.op=X.Op.ANY_CHAR):t.runes.length===4&&t.runes[0]===0&&t.runes[1]===V.CODES.get(` `)-1&&t.runes[2]===V.CODES.get(` `)+1&&t.runes[3]===De.MAX_RUNE&&(t.runes=[],t.op=X.Op.ANY_CHAR_NOT_NL))}collapse(t,r){if(t.length===1)return t[0];let n=0;for(let o of t)n+=o.op===r?o.subs.length:1;let i=new Array(n).fill(null),a=0;for(let o of t)o.op===r?(i.splice(a,o.subs.length,...o.subs),a+=o.subs.length,this.reuse(o)):i[a++]=o;let s=this.newRegexp(r);if(s.subs=i,r===X.Op.ALTERNATE&&(s.subs=this.factor(s.subs),s.subs.length===1)){let o=s;s=s.subs[0],this.reuse(o)}return s}factor(t){if(t.length<2)return t;let r=0,n=t.length,i=0,a=null,s=0,o=0,l=0;for(let c=0;c<=n;c++){let p=null,d=0,f=0;if(c0&&(h=h.subs[0]),h.op===X.Op.LITERAL&&(p=h.runes,d=h.runes.length,f=h.flags&oe.FOLD_CASE),f===o){let m=0;for(;m0){s=m;continue}}}if(c!==l)if(c===l+1)t[i++]=t[r+l];else{let h=this.newRegexp(X.Op.LITERAL);h.flags=o,h.runes=a.slice(0,s);for(let x=l;x0){let n=this.removeLeadingString(t.subs[0],r);if(t.subs[0]=n,n.op===X.Op.EMPTY_MATCH)switch(this.reuse(n),t.subs.length){case 0:case 1:t.op=X.Op.EMPTY_MATCH,t.subs=null;break;case 2:{let i=t;t=t.subs[1],this.reuse(i);break}default:t.subs=t.subs.slice(1,t.subs.length);break}return t}return t.op===X.Op.LITERAL&&(t.runes=t.runes.slice(r,t.runes.length),t.runes.length===0&&(t.op=X.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,r){if(t.op===X.Op.CONCAT&&t.subs.length>0){switch(r&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:{t.op=X.Op.EMPTY_MATCH,t.subs=X.emptySubs();break}case 1:{let n=t;t=t.subs[0],this.reuse(n);break}}return t}return r&&this.reuse(t),this.newRegexp(X.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&oe.LITERAL)!==0)return Ae.literalRegexp(this.wholeRegexp,this.flags);let t=-1,r=-1,n=-1,i=new p6(this.wholeRegexp);for(;i.more();){let a=-1;e:switch(i.peek()){case V.CODES.get("("):if((this.flags&oe.PERL_X)!==0&&i.lookingAt("(?")){this.parsePerlFlags(i);break}this.op(X.Op.LEFT_PAREN).cap=++this.numCap,i.skip(1);break;case V.CODES.get("|"):this.parseVerticalBar(),i.skip(1);break;case V.CODES.get(")"):this.parseRightParen(),i.skip(1);break;case V.CODES.get("^"):(this.flags&oe.ONE_LINE)!==0?this.op(X.Op.BEGIN_TEXT):this.op(X.Op.BEGIN_LINE),i.skip(1);break;case V.CODES.get("$"):(this.flags&oe.ONE_LINE)!==0?this.op(X.Op.END_TEXT).flags|=oe.WAS_DOLLAR:this.op(X.Op.END_LINE),i.skip(1);break;case V.CODES.get("."):(this.flags&oe.DOT_NL)!==0?this.op(X.Op.ANY_CHAR):this.op(X.Op.ANY_CHAR_NOT_NL),i.skip(1);break;case V.CODES.get("["):this.parseClass(i);break;case V.CODES.get("*"):case V.CODES.get("+"):case V.CODES.get("?"):{a=i.pos();let s=null;switch(i.pop()){case V.CODES.get("*"):s=X.Op.STAR;break;case V.CODES.get("+"):s=X.Op.PLUS;break;case V.CODES.get("?"):s=X.Op.QUEST;break}this.repeat(s,r,n,a,i,t);break}case V.CODES.get("{"):{a=i.pos();let s=Ae.parseRepeat(i);if(s<0){i.rewindTo(a),this.literal(i.pop());break}r=s>>16,n=(s&De.MAX_BMP)<<16>>16,this.repeat(X.Op.REPEAT,r,n,a,i,t);break}case V.CODES.get("\\"):{let s=i.pos();if(i.skip(1),(this.flags&oe.PERL_X)!==0&&i.more())switch(i.pop()){case V.CODES.get("A"):this.op(X.Op.BEGIN_TEXT);break e;case V.CODES.get("b"):this.op(X.Op.WORD_BOUNDARY);break e;case V.CODES.get("B"):this.op(X.Op.NO_WORD_BOUNDARY);break e;case V.CODES.get("C"):throw new Ct(Ae.ERR_INVALID_ESCAPE,"\\C");case V.CODES.get("Q"):{let u=i.rest(),c=u.indexOf("\\E");c>=0&&(u=u.substring(0,c)),i.skipString(u),i.skipString("\\E");let p=0;for(;p");if(l<0)throw new Ct(Ae.ERR_INVALID_NAMED_CAPTURE,n);let u=n.substring(o,l);if(t.skipString(u),t.skip(o+1),!Ae.isValidCaptureName(u))throw new Ct(Ae.ERR_INVALID_NAMED_CAPTURE,n.substring(0,l+1));let c=this.op(X.Op.LEFT_PAREN);if(c.cap=++this.numCap,this.namedGroups[u])throw new Ct(Ae.ERR_DUPLICATE_NAMED_CAPTURE,u);this.namedGroups[u]=this.numCap,c.name=u;return}t.skip(2);let i=this.flags,a=1,s=!1;e:for(;t.more();){let o=t.pop();switch(o){case V.CODES.get("i"):i|=oe.FOLD_CASE,s=!0;break;case V.CODES.get("m"):i&=-17,s=!0;break;case V.CODES.get("s"):i|=oe.DOT_NL,s=!0;break;case V.CODES.get("U"):i|=oe.NON_GREEDY,s=!0;break;case V.CODES.get("-"):if(a<0)break e;a=-1,i=~i,s=!1;break;case V.CODES.get(":"):case V.CODES.get(")"):if(a<0){if(!s)break e;i=~i}o===V.CODES.get(":")&&this.op(X.Op.LEFT_PAREN),this.flags=i;return;default:break e}}throw new Ct(Ae.ERR_INVALID_PERL_OP,t.from(r))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(X.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===X.Op.VERTICAL_BAR&&Ae.isCharClass(this.stack[t-1])&&Ae.isCharClass(this.stack[t-3])){let r=this.stack[t-1],n=this.stack[t-3];if(r.op>n.op){let i=n;n=r,r=i,this.stack[t-3]=n}return Ae.mergeCharClass(n,r),this.reuse(r),this.pop(),!0}if(t>=2){let r=this.stack[t-1],n=this.stack[t-2];if(n.op===X.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=r,this.stack[t-1]=n,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new Ct(Ae.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let t=this.pop(),r=this.pop();if(r.op!==X.Op.LEFT_PAREN)throw new Ct(Ae.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=r.flags,r.cap===0?this.push(t):(r.op=X.Op.CAPTURE,r.subs=[t],this.push(r))}parsePerlClassEscape(t,r){let n=t.pos();if((this.flags&oe.PERL_X)===0||!t.more()||t.pop()!==V.CODES.get("\\")||!t.more())return!1;t.pop();let i=t.from(n),a=Cd.has(i)?Cd.get(i):null;return a===null?!1:(r.appendGroup(a,(this.flags&oe.FOLD_CASE)!==0),!0)}parseNamedClass(t,r){let n=t.rest(),i=n.indexOf(":]");if(i<0)return!1;let a=n.substring(0,i+2);t.skipString(a);let s=Ud.has(a)?Ud.get(a):null;if(s===null)throw new Ct(Ae.ERR_INVALID_CHAR_RANGE,a);return r.appendGroup(s,(this.flags&oe.FOLD_CASE)!==0),!0}parseUnicodeClass(t,r){let n=t.pos();if((this.flags&oe.UNICODE_GROUPS)===0||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let i=1,a=t.pop();if(a===V.CODES.get("P")&&(i=-1),!t.more())throw t.rewindTo(n),new Ct(Ae.ERR_INVALID_CHAR_RANGE,t.rest());a=t.pop();let s;if(a!==V.CODES.get("{"))s=et.runeToString(a);else{let c=t.rest(),p=c.indexOf("}");if(p<0)throw t.rewindTo(n),new Ct(Ae.ERR_INVALID_CHAR_RANGE,t.rest());s=c.substring(0,p),t.skipString(s),t.skip(1)}s.length!==0&&s.codePointAt(0)===V.CODES.get("^")&&(i=0-i,s=s.substring(1));let o=Ae.unicodeTable(s);if(o===null)throw new Ct(Ae.ERR_INVALID_CHAR_RANGE,t.from(n));let l=o.first,u=o.second;if((this.flags&oe.FOLD_CASE)===0||u===null)r.appendTableWithSign(l,i);else{let c=new vi().appendTable(l).appendTable(u).cleanClass().toArray();r.appendClassWithSign(c,i)}return!0}parseClass(t){let r=t.pos();t.skip(1);let n=this.newRegexp(X.Op.CHAR_CLASS);n.flags=this.flags;let i=new vi,a=1;t.more()&&t.lookingAt("^")&&(a=-1,t.skip(1),(this.flags&oe.CLASS_NL)===0&&i.appendRange(V.CODES.get(` `),V.CODES.get(` `)));let s=!0;for(;!t.more()||t.peek()!==V.CODES.get("]")||s;){if(t.more()&&t.lookingAt("-")&&(this.flags&oe.PERL_X)===0&&!s){let c=t.rest();if(c==="-"||!c.startsWith("-]"))throw t.rewindTo(r),new Ct(Ae.ERR_INVALID_CHAR_RANGE,t.rest())}s=!1;let o=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,i))continue;t.rewindTo(o)}if(this.parseUnicodeClass(t,i)||this.parsePerlClassEscape(t,i))continue;t.rewindTo(o);let l=Ae.parseClassChar(t,r),u=l;if(t.more()&&t.lookingAt("-")){if(t.skip(1),t.more()&&t.lookingAt("]"))t.skip(-1);else if(u=Ae.parseClassChar(t,r),u0&&(o.prefixRune=o.prefix.codePointAt(0)),o.namedGroups=i.namedGroups,o}static match(t,r){return Na.compile(t).match(r)}constructor(t,r,n=0,i=0){this.expr=t,this.prog=r,this.numSubexp=n,this.longest=i,this.cond=r.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new d6,this.dfa=new o6(r)}executeEngine(t,r,n,i){if(i>0)return this.doExecuteNFA(t,r,n,i);let a=this.dfa.match(t,r,n);return a!==null?a?[]:null:this.doExecuteNFA(t,r,n,i)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let t;do t=this.pooled.get();while(t&&!this.pooled.compareAndSet(t,t.next));return t}reset(){this.pooled.set(null)}put(t,r){let n=this.pooled.get();do n=this.pooled.get(),!r&&n&&(t=$u.fromMachine(t),r=!0),t.next!==n&&(t.next=n);while(!this.pooled.compareAndSet(n,t))}toString(){return this.expr}doExecuteNFA(t,r,n,i){let a=this.get(),s=!1;a?a.next!==null&&(a=$u.fromMachine(a),s=!0):(a=$u.fromRE2(this),s=!0),a.init(i);let o=a.match(t,r,n)?a.submatches():null;return this.put(a,s),o}match(t){return this.executeEngine(Lt.fromUTF16(t),0,oe.UNANCHORED,0)!==null}matchWithGroup(t,r,n,i,a){return t instanceof ba||(t=Mo.utf16(t)),this.matchMachineInput(t,r,n,i,a)}matchMachineInput(t,r,n,i,a){if(r>n)return[!1,null];let s=t.isUTF16Encoding()?Lt.fromUTF16(t.asCharSequence(),0,n):Lt.fromUTF8(t.asBytes(),0,n),o=this.executeEngine(s,r,i,2*a);return o===null?[!1,null]:[!0,o]}matchUTF8(t){return this.executeEngine(Lt.fromUTF8(t),0,oe.UNANCHORED,0)!==null}replaceAll(t,r){return this.replaceAllFunc(t,()=>r,2*t.length+1)}replaceFirst(t,r){return this.replaceAllFunc(t,()=>r,1)}replaceAllFunc(t,r,n){let i=0,a=0,s="",o=Lt.fromUTF16(t),l=0;for(;a<=t.length;){let u=this.executeEngine(o,a,oe.UNANCHORED,2);if(u===null||u.length===0)break;s+=t.substring(i,u[0]),(u[1]>i||u[0]===0)&&(s+=r(t.substring(u[0],u[1])),l++),i=u[1];let c=o.step(a)&7;if(a+c>u[1]?a+=c:a+1>u[1]?a++:a=u[1],l>=n)break}return s+=t.substring(i),s}pad(t){if(t===null)return null;let r=(1+this.numSubexp)*2;if(t.lengthi){let i=[],a=t.endPos();r<0&&(r=a+1);let s=0,o=0,l=-1;for(;o=0&&(n[i]=t.slice(r[2*i],r[2*i+1]));return n}findUTF8SubmatchIndex(t){return this.pad(this.executeEngine(Lt.fromUTF8(t),0,oe.UNANCHORED,this.prog.numCap))}findSubmatch(t){let r=this.executeEngine(Lt.fromUTF16(t),0,oe.UNANCHORED,this.prog.numCap);if(r===null)return null;let n=new Array(1+this.numSubexp).fill(null);for(let i=0;i=0&&(n[i]=t.substring(r[2*i],r[2*i+1]));return n}findSubmatchIndex(t){return this.pad(this.executeEngine(Lt.fromUTF16(t),0,oe.UNANCHORED,this.prog.numCap))}findAllUTF8(t,r){let n=this.allMatches(Lt.fromUTF8(t),r,i=>t.slice(i[0],i[1]));return n.length===0?null:n}findAllUTF8Index(t,r){let n=this.allMatches(Lt.fromUTF8(t),r,i=>i.slice(0,2));return n.length===0?null:n}findAll(t,r){let n=this.allMatches(Lt.fromUTF16(t),r,i=>t.substring(i[0],i[1]));return n.length===0?null:n}findAllIndex(t,r){let n=this.allMatches(Lt.fromUTF16(t),r,i=>i.slice(0,2));return n.length===0?null:n}findAllUTF8Submatch(t,r){let n=this.allMatches(Lt.fromUTF8(t),r,i=>{let a=new Array(i.length/2|0).fill(null);for(let s=0;s=0&&(a[s]=t.slice(i[2*s],i[2*s+1]));return a});return n.length===0?null:n}findAllUTF8SubmatchIndex(t,r){let n=this.allMatches(Lt.fromUTF8(t),r);return n.length===0?null:n}findAllSubmatch(t,r){let n=this.allMatches(Lt.fromUTF16(t),r,i=>{let a=new Array(i.length/2|0).fill(null);for(let s=0;s=0&&(a[s]=t.substring(i[2*s],i[2*s+1]));return a});return n.length===0?null:n}findAllSubmatchIndex(t,r){let n=this.allMatches(Lt.fromUTF16(t),r);return n.length===0?null:n}},m6=class _s{static isUpperCaseAlpha(t){return"A"<=t&&t<="Z"}static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static getUtf8CharSize(t){let r=t.charCodeAt(0);return r<128?1:r<2048?2:r<65536?3:4}static translate(t){if(typeof t!="string")return t;let r="",n=!1,i=t.length;i===0&&(r="(?:)",n=!0);let a=0;for(;a>4).toString(16).toUpperCase(),r+=(l.charCodeAt(0)-64&15).toString(16).toUpperCase(),a+=3,n=!0;continue}}r+="\\c",a+=2;continue}case"u":{if(a+2=i||t[a+3]!=="="&&t[a+3]!=="!")){r+="(?P<",a+=3,n=!0;continue}let o=_s.getUtf8CharSize(s);r+=t.substring(a,a+o),a+=o}return n?r:t}},za=class jr{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(t){return et.quoteMeta(t)}static translateRegExp(t){return m6.translate(t)}static compile(t,r=0){let n=t;if((r&jr.CASE_INSENSITIVE)!==0&&(n=`(?i)${n}`),(r&jr.DOTALL)!==0&&(n=`(?s)${n}`),(r&jr.MULTILINE)!==0&&(n=`(?m)${n}`),(r&~(jr.MULTILINE|jr.DOTALL|jr.CASE_INSENSITIVE|jr.DISABLE_UNICODE_GROUPS|jr.LONGEST_MATCH))!==0)throw new t6("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let i=oe.PERL;(r&jr.DISABLE_UNICODE_GROUPS)!==0&&(i&=-129);let a=new jr(t,r);return a.re2Input=h6.compileImpl(n,i,(r&jr.LONGEST_MATCH)!==0),a}static matches(t,r){return jr.compile(t).testExact(r)}static initTest(t,r,n){if(t==null)throw new Error("pattern is null");if(n==null)throw new Error("re2 is null");let i=new jr(t,r);return i.re2Input=n,i}constructor(t,r){this.patternInput=t,this.flagsInput=r}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.testExact(t)}matcher(t){return Array.isArray(t)&&(t=Mo.utf8(t)),new r6(this,t)}test(t){return Array.isArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){let r=Array.isArray(t)?Lt.fromUTF8(t):Lt.fromUTF16(t);return this.re2Input.executeEngine(r,0,oe.ANCHOR_BOTH,0)!==null}split(t,r=0){let n=this.matcher(t),i=[],a=0,s=0;for(;n.find();){if(s===0&&n.end()===0){s=n.end();continue}if(r>0&&i.length===r-1)break;if(s===n.start()){if(r===0){a+=1,s=n.end();continue}}else for(;a>0;)i.push(""),a-=1;i.push(n.substring(s,n.start())),s=n.end()}if(r===0&&s!==n.inputLength()){for(;a>0;)i.push(""),a-=1;i.push(n.substring(s,n.inputLength()))}return(r!==0||i.length===0)&&i.push(n.substring(s,n.inputLength())),i}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t?!0:t===null||this.constructor!==t.constructor?!1:this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput}}});function ZO(e){let t=0;return e.includes("i")&&(t|=za.CASE_INSENSITIVE),e.includes("m")&&(t|=za.MULTILINE),e.includes("s")&&(t|=za.DOTALL),t}function g6(e){return za.translateRegExp(e)}function XO(e,t){let r=ZO(t);if(e.length>dv)return za.compile(g6(e),r);let n=`${r} ${e}`,i=Os.get(n);if(i!==void 0)return i;let a=za.compile(g6(e),r);if(Os.size>=fv){let s=Os.keys().next().value;s!==void 0&&Os.delete(s)}return Os.set(n,a),a}function Ie(e,t="",r={}){return new hv(e,t,r)}var x6,y6,fv,dv,Os,hv,Jc,QO=q(()=>{"use strict";VO(),Yt(),J(),x6=1e6,y6=64*1024*1024,fv=256,dv=1024,Os=new Map,hv=class{_re2;_pattern;_flags;_global;_ignoreCase;_multiline;_lastIndex=0;_nativeRegex=null;_matcher=null;_matcherInput=null;maxResults;maxOutputBytes;signal;assertResultCount(e){if(this.signal?.aborted)throw new Error("regular expression aborted");if(e>this.maxResults)throw new T(`regular expression result limit exceeded (${this.maxResults})`,"array_elements")}expandReplacement(e,t){let r=new St(this.maxOutputBytes,"regular expression replacement"),n=this._re2.groupCount(),i=this._re2.namedGroups();for(let a=0;a=t.length){r.append(s);continue}if(t[a+1]==="{"){let o=t.indexOf("}",a+2);if(o!==-1){let l=t.slice(a+2,o),u=i?.[l];if(u!==void 0){r.append(e.group(u)??""),a=o;continue}}}if(/\d/.test(t[a+1])){let o=a+1,l=0;for(;on)break;l=u,o++}r.append(e.group(l)??""),a=o-1;continue}r.append(s)}return r.build()}acquireMatcher(e){return this._matcher===null?(this._matcher=this._re2.matcher(e),this._matcherInput=e,this._matcher):(this._matcherInput!==e&&(this._matcher.matcherInput.charSequence=e,this._matcherInput=e),this._matcher.reset(),this._matcher)}constructor(e,t="",r={}){if(this._pattern=e,this._flags=t,this._global=t.includes("g"),this._ignoreCase=t.includes("i"),this._multiline=t.includes("m"),this.maxResults=r.maxResults??x6,this.maxOutputBytes=r.maxOutputBytes??y6,this.signal=r.signal,!Number.isSafeInteger(this.maxResults)||this.maxResults<0||!Number.isSafeInteger(this.maxOutputBytes)||this.maxOutputBytes<0)throw new Error("invalid regular expression limits");try{this._re2=XO(e,t)}catch(n){if(n instanceof Ct){let i=n.message||"",a="";throw i.includes("(?=")||i.includes("(?!")||i.includes("(?<")||i.includes("(?0){let o=Object.create(null);for(let[l,u]of Object.entries(s)){let c=t.group(u);c!==null&&(o[l]=c)}a.groups=o}return this._global&&(this._lastIndex=t.end(0),t.start(0)===t.end(0)&&this._lastIndex++),a}match(e){if(this._global&&(this._lastIndex=0),!this._global)return this.exec(e);let t=[],r=this.acquireMatcher(e),n=0;for(;r.find(n);){let i=r.group(0)??"";if(this.assertResultCount(t.length+1),t.push(i),n=r.end(0),r.start(0)===r.end(0)&&n++,n>e.length)break}return t.length>0?t:null}replace(e,t){if(this._global&&(this._lastIndex=0),typeof t=="string"){let u=this._re2.matcher(e),c=new St(this.maxOutputBytes,"regular expression replacement"),p=0,d=0,f=0;for(;u.find(d);){this.assertResultCount(++f);let h=u.start(0),m=u.end(0);if(c.append(e.slice(p,h)),c.append(this.expandReplacement(u,t)),p=m,d=m>h?m:m+1,!this._global||d>e.length)break}return c.append(e.slice(p)),c.build()}let r=new St(this.maxOutputBytes,"regular expression replacement"),n=this._re2.matcher(e),i=0,a=0,s=0,o=this._re2.groupCount(),l=this._re2.namedGroups();for(;n.find(a);){this.assertResultCount(++s),r.append(e.slice(i,n.start(0)));let u=[],c=n.group(0)??"";for(let f=1;f<=o;f++)u.push(n.group(f));if(u.push(n.start(0)),u.push(e),l&&Object.keys(l).length>0){let f=Object.create(null);for(let[h,m]of Object.entries(l))f[h]=n.group(m)??"";u.push(f)}let p=n.start(0),d=n.end(0);if(r.append(t(c,...u)),i=d,a=i,p===d&&a++,!this._global||a>e.length)break}return r.append(e.slice(i)),r.build()}split(e,t){if(t===0)return[];let r=t===void 0||t<0?this.maxResults:Math.min(t,this.maxResults),n=[],i=this._re2.matcher(e),a=0,s=0;for(;n.lengthi.start(0)?i.end(0):i.end(0)+1;return n.length0){let l=Object.create(null);for(let[u,c]of Object.entries(n)){let p=t.group(c);p!==null&&(l[u]=p)}o.groups=l}if(yield o,i=t.end(0),t.start(0)===t.end(0)&&i++,i>e.length)break}}get native(){if(!this._nativeRegex)try{this._nativeRegex=new RegExp(this._pattern,this._flags)}catch{this._nativeRegex=new RegExp("",this._flags),Object.defineProperty(this._nativeRegex,"source",{value:this._pattern,writable:!1})}return this._nativeRegex}get source(){return this._pattern}get flags(){return this._flags}get global(){return this._global}get ignoreCase(){return this._ignoreCase}get multiline(){return this._multiline}get lastIndex(){return this._lastIndex}set lastIndex(e){this._lastIndex=e}},Jc=class{_regex;constructor(e){this._regex=e}test(e){return this._regex.global&&(this._regex.lastIndex=0),this._regex.test(e)}exec(e){return this._regex.exec(e)}match(e){return this._regex.global&&(this._regex.lastIndex=0),e.match(this._regex)}replace(e,t){return this._regex.global&&(this._regex.lastIndex=0),e.replace(this._regex,t)}split(e,t){return e.split(this._regex,t)}search(e){return e.search(this._regex)}*matchAll(e){if(!this._regex.global)throw new Error("matchAll requires global flag");this._regex.lastIndex=0;let t=this._regex.exec(e);for(;t!==null;)yield t,t[0].length===0&&this._regex.lastIndex++,t=this._regex.exec(e)}get native(){return this._regex}get source(){return this._regex.source}get flags(){return this._regex.flags}get global(){return this._regex.global}get ignoreCase(){return this._regex.ignoreCase}get multiline(){return this._regex.multiline}get lastIndex(){return this._regex.lastIndex}set lastIndex(e){this._regex.lastIndex=e}}}),Dt=q(()=>{"use strict";QO()});function nn(e,t,r){let n=typeof r=="boolean"?{ignoreCase:r}:r??{},i=t;n.stripQuotes&&(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1));let a=n.ignoreCase?`i:${i}`:i,s=Is.get(a);if(!s){if(s=KO(i,n.ignoreCase),Is.size>=mv){let o=Is.keys().next().value;o!==void 0&&Is.delete(o)}Is.set(a,s)}return s.test(e)}function KO(e,t){let r="^";for(let n=0;n{"use strict";Dt(),mv=2048,Is=new Map});function Qo(e,t){let r=e.ignoreCase?t.toLowerCase():t,n=e.needles;for(let i=0;i]+)>)/g,(r,n,i)=>{if(n==="&")return t[0];if(i!==void 0)return t.groups?.[i]??"";let a=parseInt(n,10);return t[a]??""})}function vc(e,t,r={}){let{invertMatch:n=!1,showLineNumbers:i=!1,countOnly:a=!1,countMatches:s=!1,filename:o="",onlyMatching:l=!1,beforeContext:u=0,afterContext:c=0,maxCount:p=0,matchBeyondMaxCount:d=!0,contextSeparator:f="--",showColumn:h=!1,vimgrep:m=!1,showByteOffset:g=!1,replace:x=null,passthru:y=!1,multiline:b=!1,kResetGroup:k,preFilter:w,maxWork:v,maxMatches:A,signal:R}=r;if(b)return YO(e,t,{invertMatch:n,showLineNumbers:i,countOnly:a,countMatches:s,filename:o,onlyMatching:l,beforeContext:u,afterContext:c,maxCount:p,contextSeparator:f,showColumn:h,showByteOffset:g,replace:x,kResetGroup:k,preFilter:w,maxWork:v,maxMatches:A,signal:R});let I=0,$=(z=1)=>{if(R?.aborted)throw new zt;if(I+=z,v!==void 0&&I>v)throw new T(`search: matching work limit exceeded (${v})`,"iterations")},_=(z,ee)=>{if(A!==void 0&&z.length>=A)throw new T(`search: result limit exceeded (${A})`,"array_elements");z.push(ee)},M=1;for(let z=0;zA))throw new T(`search: line limit exceeded (${A})`,"array_elements");let P=e.split(` `),S=P.length,D=S>0&&P[S-1]===""?S-1:S;if(a||s){let z=0,ee=0,Y=(s||l)&&!n;for(let ne=0;ne0&&ee>=p));ne++){let Z=z,ve=P[ne];if(!(w&&!n&&!Qo(w,ve))){if(t.lastIndex=0,Y)for(let de=t.exec(ve);de!==null;de=t.exec(ve))$(),z++,de[0].length===0&&t.lastIndex++;else t.test(ve)!==n&&z++;z>Z&&ee++}}return{output:`${o?`${o}:${z}`:String(z)} `,matched:z>0,matchCount:z}}if(u===0&&c===0&&!y){let z=[],ee=!1,Y=0,ne=0;for(let Z=0;Z0&&Y>=p));Z++){let ve=P[Z],de=null;if(w&&!Qo(w,ve)||(t.lastIndex=0,de=t.exec(ve)),de!==null!==n)if(ee=!0,Y++,l)for(let xe=de;xe!==null;xe=t.exec(ve)){$();let ie=k!==void 0?xe[k]??"":xe[0],Fe=x!==null?b6(x,xe):ie,te=o?`${o}:`:"";g&&(te+=`${ne+xe.index}:`),i&&(te+=`${Z+1}:`),h&&(te+=`${xe.index+1}:`),_(z,te+Fe),xe[0].length===0&&t.lastIndex++}else if(m)for(let xe=de;xe!==null;xe=t.exec(ve)){$();let ie=o?`${o}:`:"";g&&(ie+=`${ne+xe.index}:`),i&&(ie+=`${Z+1}:`),h&&(ie+=`${xe.index+1}:`),_(z,ie+ve),xe[0].length===0&&t.lastIndex++}else{let xe=de?de.index+1:1,ie=ve;x!==null&&(t.lastIndex=0,ie=t.replace(ve,(...te)=>{if(te[0].length===0)return"";let he=te,qe=te[te.length-1];return typeof qe=="object"&&qe!==null?(he.groups=qe,he.input=te[te.length-2],he.index=te[te.length-3]):(he.input=te[te.length-1],he.index=te[te.length-2]),b6(x,he)}));let Fe=o?`${o}:`:"";g&&(Fe+=`${ne+(de?de.index:0)}:`),i&&(Fe+=`${Z+1}:`),h&&(Fe+=`${xe}:`),_(z,Fe+ie)}ne+=ve.length+1}return{output:z.length>0?`${z.join(` `)} `:"",matched:ee,matchCount:Y}}if(y){let z=[],ee=!1,Y=0;for(let ne=0;ne0?`${z.join(` `)} `:"",matched:ee,matchCount:Y}}let W=[],j=0,U=-1,H=[];for(let z=0;z0&&j>=p));z++){let ee=P[z],Y;if(w&&!Qo(w,ee)?Y=!1:(t.lastIndex=0,Y=t.test(ee)),Y!==n){if(A!==void 0&&H.length>=A)throw new T(`search: match limit exceeded (${A})`,"array_elements");H.push(z),j++}}for(let z of H){$();let ee=Math.max(0,z-u);U>=0&&ee>U+1&&_(W,f);let Y=Math.min(D-1,z+c);for(let ne=Math.max(ee,U+1);ne<=Y;ne++){$(),U=ne;let Z=P[ne];t.lastIndex=0;let ve=(d||ne<=H[H.length-1])&&t.test(Z)!==n;if(ve&&l){t.lastIndex=0;for(let de=t.exec(Z);de!==null;de=t.exec(Z)){$();let xe=k!==void 0?de[k]??"":de[0],ie=x!==null?x:xe,Fe=o?`${o}:`:"";i&&(Fe+=`${ne+1}:`),h&&(Fe+=`${de.index+1}:`),_(W,Fe+ie),de[0].length===0&&t.lastIndex++}}else{let de=Z,xe=ve?":":"-";i&&(de=`${ne+1}${xe}${de}`),o&&(de=`${o}${xe}${de}`),_(W,de)}}}return{output:W.length>0?`${W.join(` `)} `:"",matched:j>0,matchCount:j}}function YO(e,t,r){let{invertMatch:n,showLineNumbers:i,countOnly:a,countMatches:s,filename:o,onlyMatching:l,beforeContext:u,afterContext:c,maxCount:p,contextSeparator:d,showColumn:f,showByteOffset:h,replace:m,kResetGroup:g,preFilter:x,maxWork:y,maxMatches:b,signal:k}=r,w=0,v=(j=1)=>{if(k?.aborted)throw new zt;if(w+=j,y!==void 0&&w>y)throw new T(`search: matching work limit exceeded (${y})`,"iterations")};if(x&&!n&&!Qo(x,e))return a||s?{output:`${o?`${o}:0`:"0"} `,matched:!1,matchCount:0}:{output:"",matched:!1,matchCount:0};let A=[0];for(let j=0;j=b)throw new T(`search: line index limit exceeded (${b})`,"array_elements");A.push(j+1)}let R=e.split(` `),I=R.length,$=I>0&&R[I-1]===""?I-1:I,_=j=>{let U=0,H=A.length;for(;U{let U=_(j);return j-A[U]+1};if(a||s){let j=0,U=0,H=-1;t.lastIndex=0;for(let ee=t.exec(e);ee!==null&&(v(),!(p>0&&j>=p));ee=t.exec(e)){if(j++,!s){let Y=_(ee.index),ne=_(ee.index+Math.max(0,ee[0].length-1)),Z=Math.max(Y,H+1);Z<=ne&&(U+=ne-Z+1,H=ne)}ee[0].length===0&&t.lastIndex++}let z=s?n?0:j:n?$-U:U;return{output:`${o?`${o}:${z}`:String(z)} `,matched:z>0,matchCount:z}}let P=[];t.lastIndex=0;for(let j=t.exec(e);j!==null&&(v(),!(p>0&&P.length>=p));j=t.exec(e)){if(b!==void 0&&P.length>=b)throw new T(`search: match limit exceeded (${b})`,"array_elements");let U=_(j.index),H=_(j.index+Math.max(0,j[0].length-1)),z=g!==void 0?j[g]??"":j[0];P.push({startLine:U,endLine:H,byteOffset:j.index,column:M(j.index),matchText:z}),j[0].length===0&&t.lastIndex++}if(n){let j=new Set;for(let H of P)for(let z=H.startLine;z<=H.endLine;z++)v(),j.add(z);let U=[];for(let H=0;H<$;H++)if(v(),!j.has(H)){let z=R[H];i&&(z=`${H+1}:${z}`),o&&(z=`${o}:${z}`),U.push(z)}return{output:U.length>0?`${U.join(` `)} `:"",matched:U.length>0,matchCount:U.length}}if(P.length===0)return{output:"",matched:!1,matchCount:0};let S=new Set,D=-1,W=[];for(let j of P){v();let U=Math.max(0,j.startLine-u),H=Math.min($-1,j.endLine+c);D>=0&&U>D+1&&W.push(d);for(let z=U;z0?`${W.join(` `)} `:"",matched:!0,matchCount:P.length}}var JO=q(()=>{"use strict";J()});function w6(e){let t="",r=0;for(;r:]]"){t+="\\b",r+=7;continue}if(e[r]==="["){let n="[";for(r++,r]+)>/g,"(?<$1>"),t.mode==="perl"){r=nI(r),r=iI(r),r=aI(r);let o=uI(r);r=o.pattern,n=o.kResetGroup}break}default:r=w6(e),r=fI(r);break}t.wholeWord&&(r=`\\b(?:${r})\\b`),t.lineRegexp&&(r=`^(?:${r})$`);let i=/\\u\{[0-9A-Fa-f]+\}/.test(r),a="g"+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.multilineDotall?"s":"")+(i?"u":""),s=eI(r,t.ignoreCase??!1);return{regex:Ie(r,a),kResetGroup:n,preFilter:s??void 0}}function eI(e,t){let r=e;if(r.startsWith("\\b(?:")&&r.endsWith(")\\b")?r=r.slice(5,r.length-3):r.startsWith("\\b")&&r.endsWith("\\b")&&r.length>=4&&(r=r.slice(2,r.length-2)),r.length===0)return null;let n=tI(r);if(n===null)return null;let i=[];for(let a of n){let s=rI(a);if(s===null||s.length===0)return null;i.push(s)}return i.length===0?null:{needles:t?i.map(a=>a.toLowerCase()):i,ignoreCase:t}}function tI(e){let t=[],r=0,n=!1,i=0;for(let a=0;a=0&&t[i]==="\\";i--)n++;n%2===0&&(t=t.slice(0,-1))}if(t.length===0)return null;let r="";for(let n=0;n0&&r+1=0&&e[n]==="\\";)r++,n--;if(r%2===0)return t}t+=2}else t++;return-1}function pI(e){let t=0,r=0;for(;r"),t=t.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)(?![>0-9])/g,"$$<$1>"),t}function fI(e){let t="",r=0,n=!0,i=0;for(;r{"use strict";Dt(),yv=new Map([["alpha","a-zA-Z"],["digit","0-9"],["alnum","a-zA-Z0-9"],["lower","a-z"],["upper","A-Z"],["xdigit","0-9A-Fa-f"],["space"," \\t\\n\\r\\f\\v"],["blank"," \\t"],["punct","!-/:-@\\[-`{-~"],["graph","!-~"],["print"," -~"],["cntrl","\\x00-\\x1F\\x7F"],["ascii","\\x00-\\x7F"],["word","a-zA-Z0-9_"]])}),bv=q(()=>{"use strict";JO(),dI()}),Zu={};ce(Zu,{egrepCommand:()=>Ev,egrepFlagsForFuzzing:()=>Cv,fgrepCommand:()=>vv,fgrepFlagsForFuzzing:()=>Av,flagsForFuzzing:()=>Sv,grepCommand:()=>Xu});function v6(e){let t=e.limits.maxLoopIterations,r=e.limits.maxArrayElements;return Math.max(t,Math.min(r,t*10))}function En(e){if(++e.operations>e.maxOperations)throw new T(`grep: glob operation limit exceeded (${e.maxOperations})`,"glob_operations")}function ol(e){if(e.results>=e.maxResults)throw new T(`grep: array element limit exceeded (${e.maxResults})`,"array_elements");e.results++}function hI(e){return e.split(` `)}function mI(e){if(e==="")return[];let t=e.split(` `);return t[t.length-1]===""&&t.pop(),t}function gI(e,t){return e.length===1?{pattern:e[0],mode:t}:t==="fixed"?{pattern:e.map(r=>`(?:${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`).join("|"),mode:"extended"}:t==="basic"?{pattern:e.join("\\|"),mode:t}:{pattern:e.map(r=>`(?:${r})`).join("|"),mode:t}}async function wv(e,t,r,n,i,a=0){if(a>=h0)return;let s=r.fs.resolvePath(r.cwd,e);try{if(En(i),!(await r.fs.stat(s)).isDirectory){let l=e.split("/").pop()||"";if(t){let u=t.replace(/^\//,"");nn(l,u,{stripQuotes:!0})&&(ol(i),n.push(e))}return}En(i);let o=await r.fs.readdir(s);for(let l of o){let u=e==="."?l:`${e}/${l}`,c=r.fs.resolvePath(r.cwd,u);if(En(i),(await r.fs.stat(c)).isDirectory)await wv(u,t,r,n,i,a+1);else if(t){let p=t.replace(/^\//,"");nn(l,p,{stripQuotes:!0})&&(ol(i),n.push(u))}}}catch(o){Ge(o)}}async function xI(e,t,r){let n=[],i=e.lastIndexOf("/"),a,s;if(i===-1?(a=t.cwd,s=e):(a=e.slice(0,i)||"/",s=e.slice(i+1)),e.includes("**")){let l=[],u=e.split("**"),c=u[0].replace(/\/$/,"")||".",p=u[1]||"";return await wv(c,p,t,l,r),l.map(d=>({path:d}))}let o=t.fs.resolvePath(t.cwd,a);try{if(t.fs.readdirWithFileTypes){En(r);let l=await t.fs.readdirWithFileTypes(o);for(let u of l)if(En(r),nn(u.name,s,{stripQuotes:!0})){let c=i===-1?u.name:`${a}/${u.name}`;ol(r),n.push({path:c,isFile:u.isFile})}}else{En(r);let l=await t.fs.readdir(o);for(let u of l)if(En(r),nn(u,s,{stripQuotes:!0})){let c=i===-1?u:`${a}/${u}`;ol(r),n.push({path:c})}}}catch(l){Ge(l)}return n.sort((l,u)=>l.path.localeCompare(u.path))}async function Ec(e,t,r=[],n=[],i=[],a,s={operations:0,results:0,maxOperations:t.limits.maxGlobOperations,maxResults:t.limits.maxArrayElements},o=[],l=0){if(l>=h0)return o;let u=t.fs.resolvePath(t.cwd,e);try{let c,p;if(a!==void 0)c=a,p=!a;else{En(s);let f=await t.fs.stat(u);c=f.isFile,p=f.isDirectory}if(c){let f=e.split("/").pop()||e;return n.length>0&&n.some(h=>nn(f,h,{stripQuotes:!0}))||r.length>0&&!r.some(h=>nn(f,h,{stripQuotes:!0}))||(ol(s),o.push({path:e,isFile:!0})),o}if(!p)return o;let d=e.split("/").pop()||e;if(i.length>0&&i.some(f=>nn(d,f,{stripQuotes:!0})))return o;if(t.fs.readdirWithFileTypes){En(s);let f=await t.fs.readdirWithFileTypes(u);for(let h of f){if(En(s),h.name.startsWith("."))continue;let m=e==="."?h.name:`${e}/${h.name}`;await Ec(m,t,r,n,i,h.isFile,s,o,l+1)}}else{En(s);let f=await t.fs.readdir(u);for(let h of f){if(En(s),h.startsWith("."))continue;let m=e==="."?h:`${e}/${h}`;await Ec(m,t,r,n,i,void 0,s,o,l+1)}}}catch(c){Ge(c)}return o}var E6,S6,A6,Xu,h0,vv,Ev,Sv,Av,Cv,zd=q(()=>{"use strict";ge(),Ar(),J(),gv(),be(),bv(),E6="(standard input)",S6="[^\\s\\S]",A6={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",description:["Search for PATTERN in each FILE.","With no FILE, or when FILE is -, read standard input."],options:["-E, --extended-regexp PATTERN is an extended regular expression","-P, --perl-regexp PATTERN is a Perl regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-x, --line-regexp match only whole lines","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-m NUM, --max-count=NUM stop after NUM matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching","-f FILE, --file=FILE obtain patterns from FILE, one per line"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},Xu={name:"grep",async execute(e,t){let r=!1,n=!1,i=!1,a=!1,s=!1,o=!1,l=!1,u=!1,c=!1,p=!1,d=!1,f=!1,h=!1,m=!1,g=!1,x=0,y=0,b=0,k=[],w=[],v=[],A=[],R=[],I=[],$=!0;for(let te=0;te0)R.push(Ur);else if(te+1t.limits.maxArrayElements)throw new T(`grep: array element limit exceeded (${t.limits.maxArrayElements})`,"array_elements");A.push(...qe)}if(A.length===0&&!i&&!o)return{stdout:"",stderr:"",exitCode:1};let M=I,P=f?"fixed":p?"extended":d?"perl":"basic";if(P==="perl"&&new Set(A).size>1)return{stdout:"",stderr:`grep: the -P option only supports a single pattern `,exitCode:2};if(A.length>1&&P!=="fixed")for(let te of A)try{Qh(te,{mode:P})}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${te} `,exitCode:2}}let S=A.length===0?{pattern:S6,mode:"extended"}:gI(A,P),D,W,j;try{let te=Qh(S.pattern,{mode:S.mode,ignoreCase:r,wholeWord:u,lineRegexp:c});D=te.regex,W=te.kResetGroup,j=te.preFilter}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${A.join(` `)} `,exitCode:2}}if(M.length===0&&t.stdin!==void 0){let te=_?"":Ve(t.stdin),he=vc(te,D,{invertMatch:i,showLineNumbers:n,countOnly:a,filename:"",onlyMatching:h,beforeContext:y,afterContext:b,maxCount:x,matchBeyondMaxCount:!1,kResetGroup:W,preFilter:j,maxWork:v6(t),maxMatches:t.limits.maxArrayElements,signal:t.signal});return g?{stdout:"",stderr:"",exitCode:he.matched?0:1}:{stdout:he.output,stderr:"",exitCode:he.matched?0:1}}if(M.length===0)return{stdout:"",stderr:`grep: no input files `,exitCode:2};let U="",H="",z=!1,ee=!1,Y=[],ne={operations:0,results:0,maxOperations:t.limits.maxGlobOperations,maxResults:t.limits.maxArrayElements},Z=te=>{if(te.length>ne.maxResults-Y.length)throw new T(`grep: array element limit exceeded (${ne.maxResults})`,"array_elements");Y.push(...te)},ve=!1,de=!1;for(let te of M){if(te==="-"){if(Y.length>=ne.maxResults)throw new T(`grep: array element limit exceeded (${ne.maxResults})`,"array_elements");Y.push({path:E6,isFile:!0,isStdin:!0,stdinAtEof:ve}),ve=!0;continue}if(de=!0,te.includes("*")||te.includes("?")||te.includes("[")){let he=await xI(te,t,ne);if(l)for(let qe of he){let Te=await Ec(qe.path,t,k,w,v,qe.isFile,ne);Z(Te)}else Z(he)}else if(l){let he=await Ec(te,t,k,w,v,void 0,ne);Z(he)}else{if(Y.length>=ne.maxResults)throw new T(`grep: array element limit exceeded (${ne.maxResults})`,"array_elements");Y.push({path:te})}}let xe=(Y.length>1||l&&de)&&!m,ie=50;for(let te=0;te{let Je=Te.path,Ue=Je.split("/").pop()||Je;if(w.length>0&&!l&&!Te.isStdin&&w.some(ye=>nn(Ue,ye,{stripQuotes:!0}))||k.length>0&&!l&&!Te.isStdin&&!k.some(ye=>nn(Ue,ye,{stripQuotes:!0})))return null;try{let ye;if(Te.isStdin)ye=Te.stdinAtEof||t.stdin===void 0?"":Ve(t.stdin);else{let Jr=t.fs.resolvePath(t.cwd,Je),mr=!1;if(Te.isFile===void 0?mr=(await t.fs.stat(Jr)).isDirectory:mr=!Te.isFile,mr)return l?null:{error:`grep: ${Je}: Is a directory `};ye=await t.fs.readFile(Jr)}if(j&&!i){let Jr=j.ignoreCase?ye.toLowerCase():ye;if(!j.needles.some(mr=>Jr.includes(mr))){if(a){let mr=xe?`${Je}:0`:"0";return{file:Je,result:{output:`${mr} `,matched:!1,matchCount:0}}}return{file:Je,result:{output:"",matched:!1,matchCount:0}}}}let Ur=vc(ye,D,{invertMatch:i,showLineNumbers:n,countOnly:a,filename:xe?Je:"",onlyMatching:h,beforeContext:y,afterContext:b,maxCount:x,matchBeyondMaxCount:!1,kResetGroup:W,preFilter:j,maxWork:v6(t),maxMatches:t.limits.maxArrayElements,signal:t.signal});return{file:Je,result:Ur}}catch(ye){return Ge(ye),{error:`grep: ${Je}: No such file or directory `}}}));for(let Te of qe){if(Te===null)continue;if("error"in Te&&Te.error){H+=Te.error,Te.error.includes("Is a directory")||(ee=!0);continue}if(!("file"in Te)||!Te.result)continue;let{file:Je,result:Ue}=Te;if(Ue.matched){if(z=!0,g)return{stdout:"",stderr:"",exitCode:0};s?U+=`${Je} `:o||(U+=Ue.output)}else o?U+=`${Je} `:a&&!s&&(U+=Ue.output)}}let Fe;return ee?Fe=2:Fe=z?0:1,g?{stdout:"",stderr:"",exitCode:Fe}:{stdout:U,stderr:H,exitCode:Fe}}},h0=256,vv={name:"fgrep",async execute(e,t){return Xu.execute(["-F",...e],t)}},Ev={name:"egrep",async execute(e,t){return Xu.execute(["-E",...e],t)}},Sv={name:"grep",flags:[{flag:"-E",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-P",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-L",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-e",type:"value",valueHint:"pattern"},{flag:"-f",type:"value",valueHint:"path"}],stdinType:"text",needsArgs:!0},Av={name:"fgrep",flags:[],stdinType:"text",needsArgs:!0},Cv={name:"egrep",flags:[],stdinType:"text",needsArgs:!0}});function kv(e,t){if(Array.isArray(e))throw new TypeError(`${t}: expected object, got array`);if(Object.getPrototypeOf(e)!==null)throw new TypeError(`${t}: expected null-prototype object, got prototypal object`)}function kt(e){return!Kh.has(e)}function $t(e,t,r){kv(e,"safeSet"),kt(t)&&(e[t]=r)}function ep(e,t){return kv(e,"safeHasOwn"),Object.hasOwn(e,t)}function Qu(e,t={}){let r=t.maxDepth??2e3,n=t.maxElements??1e6,i=new WeakMap,a=t.elementBudget??{used:0};if(!Number.isSafeInteger(a.used)||a.used<0||a.used>n)throw new T(`query input element limit exceeded (${n})`,"array_elements");let s=()=>{if(++a.used>n)throw new T(`query input element limit exceeded (${n})`,"array_elements")},o=(c,p,d)=>{if(c===null||typeof c!="object"||c instanceof Date)return c;let f=i.get(c);if(f!==void 0)return f;if(p>r)throw new T(`query depth limit exceeded (${r})`,"recursion");let h=Array.isArray(c)?[]:Object.create(null);return i.set(c,h),d.push({source:c,target:h,depth:p}),h},l=[],u=o(e,0,l);for(;l.length>0;){let c=l.pop();if(!c)break;let{source:p,target:d,depth:f}=c;if(Array.isArray(p)&&Array.isArray(d)){if(p.length>n-a.used)throw new T(`query input element limit exceeded (${n})`,"array_elements");d.length=p.length;for(let x=p.length-1;x>=0;x--)s(),d[x]=o(p[x],f+1,l);continue}let h=p,m=d,g=Object.keys(h);if(g.length>n-a.used)throw new T(`query input element limit exceeded (${n})`,"array_elements");for(let x=0;x{"use strict";J(),Kh=new Set(["__proto__","constructor","prototype"]),bI=new Set([...Kh,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])});function wI(){let e=[];for(let[t,r]of Object.entries(Yh).sort()){let n=[];for(let i of r.extensions)n.push(`*${i}`);for(let i of r.globs)n.push(i);e.push(`${t}: ${n.join(", ")}`)}return`${e.join(` `)} `}var Yh,Tv,_v=q(()=>{"use strict";Dt(),hi(),Yh=yI({js:{extensions:[".js",".mjs",".cjs",".jsx"],globs:[]},ts:{extensions:[".ts",".tsx",".mts",".cts"],globs:[]},html:{extensions:[".html",".htm",".xhtml"],globs:[]},css:{extensions:[".css",".scss",".sass",".less"],globs:[]},json:{extensions:[".json",".jsonc",".json5"],globs:[]},xml:{extensions:[".xml",".xsl",".xslt"],globs:[]},c:{extensions:[".c",".h"],globs:[]},cpp:{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx",".h"],globs:[]},rust:{extensions:[".rs"],globs:[]},go:{extensions:[".go"],globs:[]},zig:{extensions:[".zig"],globs:[]},java:{extensions:[".java"],globs:[]},kotlin:{extensions:[".kt",".kts"],globs:[]},scala:{extensions:[".scala",".sc"],globs:[]},clojure:{extensions:[".clj",".cljc",".cljs",".edn"],globs:[]},py:{extensions:[".py",".pyi",".pyw"],globs:[]},rb:{extensions:[".rb",".rake",".gemspec"],globs:["Rakefile","Gemfile"]},php:{extensions:[".php",".phtml",".php3",".php4",".php5"],globs:[]},perl:{extensions:[".pl",".pm",".pod",".t"],globs:[]},lua:{extensions:[".lua"],globs:[]},sh:{extensions:[".sh",".bash",".zsh",".fish"],globs:[".bashrc",".zshrc",".profile"]},bat:{extensions:[".bat",".cmd"],globs:[]},ps:{extensions:[".ps1",".psm1",".psd1"],globs:[]},yaml:{extensions:[".yaml",".yml"],globs:[]},toml:{extensions:[".toml"],globs:["Cargo.toml","pyproject.toml"]},ini:{extensions:[".ini",".cfg",".conf"],globs:[]},csv:{extensions:[".csv",".tsv"],globs:[]},md:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},markdown:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},rst:{extensions:[".rst"],globs:[]},txt:{extensions:[".txt",".text"],globs:[]},tex:{extensions:[".tex",".ltx",".sty",".cls"],globs:[]},sql:{extensions:[".sql"],globs:[]},graphql:{extensions:[".graphql",".gql"],globs:[]},proto:{extensions:[".proto"],globs:[]},make:{extensions:[".mk",".mak"],globs:["Makefile","GNUmakefile","makefile"]},docker:{extensions:[],globs:["Dockerfile","Dockerfile.*","*.dockerfile"]},tf:{extensions:[".tf",".tfvars"],globs:[]}}),Tv=class{types;constructor(){this.types=new Map(Object.entries(Yh).map(([e,t])=>[e,{extensions:[...t.extensions],globs:[...t.globs]}]))}addType(e){let t=e.indexOf(":");if(t===-1)return;let r=e.slice(0,t),n=e.slice(t+1);if(n.startsWith("include:")){let i=n.slice(8),a=this.types.get(i);if(a){let s=this.types.get(r)||{extensions:[],globs:[]};s.extensions.push(...a.extensions),s.globs.push(...a.globs),this.types.set(r,s)}}else{let i=this.types.get(r)||{extensions:[],globs:[]};if(n.startsWith("*.")&&!n.slice(2).includes("*")){let a=n.slice(1);i.extensions.includes(a)||i.extensions.push(a)}else i.globs.includes(n)||i.globs.push(n);this.types.set(r,i)}}clearType(e){let t=this.types.get(e);t&&(t.extensions=[],t.globs=[])}getType(e){return this.types.get(e)}getAllTypes(){return this.types}matchesType(e,t){let r=e.toLowerCase();for(let n of t){if(n==="all"){if(this.matchesAnyType(e))return!0;continue}let i=this.types.get(n);if(i){for(let a of i.extensions)if(r.endsWith(a))return!0;for(let a of i.globs)if(a.includes("*")){let s=a.replace(/\./g,"\\.").replace(/\*/g,".*");if(Ie(`^${s}$`,"i").test(e))return!0}else if(r===a.toLowerCase())return!0}}return!1}matchesAnyType(e){let t=e.toLowerCase();for(let r of this.types.values()){for(let n of r.extensions)if(t.endsWith(n))return!0;for(let n of r.globs)if(n.includes("*")){let i=n.replace(/\./g,"\\.").replace(/\*/g,".*");if(Ie(`^${i}$`,"i").test(e))return!0}else if(t===n.toLowerCase())return!0}return!1}}});function vI(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:1/0,help:!1,typeList:!1,lineNumber:!0,noFilename:!1,withFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:"--",quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:"path",json:!1,globs:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:256,maxFilesize:512*1024*1024,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}var EI=q(()=>{"use strict"});function qd(e){return{...Le("rg",e),exitCode:2}}function SI(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let r=parseInt(t[1],10);switch((t[2]||"").toUpperCase()){case"K":return r*1024;case"M":return r*1024*1024;case"G":return r*1024*1024*1024;default:return r}}function AI(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e} `,exitCode:2}}function Jh(e,t){return!/^\+?\d+$/.test(t)||!Number.isSafeInteger(Number(t))?{stdout:"",stderr:`rg: invalid ${e.startsWith("-")?e:`--${e}`} value: ${t} `,exitCode:2}:null}function CI(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function kI(e,t,r){let n=e[t];for(let i of m0){if(n.startsWith(`--${i.long}=`)){let a=n.slice(`--${i.long}=`.length),s=Ku(r,i,a);return s?{newIndex:t,error:s}:{newIndex:t}}if(i.short&&n.startsWith(`-${i.short}`)&&n.length>2){let a=n.slice(2),s=Ku(r,i,a);return s?{newIndex:t,error:s}:{newIndex:t}}if(i.short&&n===`-${i.short}`||n===`--${i.long}`){if(t+1>=e.length)return null;let a=e[t+1],s=Ku(r,i,a);return s?{newIndex:t+1,error:s}:{newIndex:t+1}}}return null}function NI(e){return m0.find(t=>t.short===e)}function Ku(e,t,r){if(t.validate){let i=t.validate(r);if(i)return i}if(t.ignored||!t.target)return;let n=t.parse?t.parse(r):r;t.multi?e[t.target].push(n):e[t.target]=n}function TI(e,t){let r=e[t];if(r==="--sort"&&t+1=e.length)return{success:!1,error:qd(`-${m}`)};let k=b||e[++u];if(y){let w=Jh(`-${m}`,k);if(w)return{success:!1,error:w};let v=Number(k);m==="A"?i=Math.max(i,v):m==="B"?a=Math.max(a,v):s=v}else if(x){let w=Ku(t,x,k);if(w)return{success:!1,error:w}}break}}let g=Ov.get(m);if(g){g(t);continue}if(m.startsWith("--"))return{success:!1,error:qd(m)};if(m.length===1)return{success:!1,error:qd(`-${m}`)}}}else r===null&&t.patterns.length===0&&t.patternFiles.length===0?r=c:n.push(c)}return(i>=0||s>=0)&&(t.afterContext=Math.max(i>=0?i:0,s>=0?s:0)),(a>=0||s>=0)&&(t.beforeContext=Math.max(a>=0?a:0,s>=0?s:0)),r!==null&&t.patterns.push(r),(t.column||t.vimgrep)&&(o=!0),{success:!0,options:t,paths:n,explicitLineNumbers:o}}var m0,Ov,Iv,OI=q(()=>{"use strict";be(),EI(),m0=[{short:"g",long:"glob",target:"globs",multi:!0},{long:"iglob",target:"iglobs",multi:!0},{short:"t",long:"type",target:"types",multi:!0},{short:"T",long:"type-not",target:"typesNot",multi:!0},{long:"type-add",target:"typeAdd",multi:!0},{long:"type-clear",target:"typeClear",multi:!0},{short:"m",long:"max-count",target:"maxCount",parse:Number,validate:e=>Jh("max-count",e)},{long:"color",ignored:!0,validate:e=>["never","auto","always","ansi"].includes(e)?null:{stdout:"",stderr:`rg: invalid --color value: ${e} `,exitCode:2}},{short:"e",long:"regexp",target:"patterns",multi:!0},{short:"f",long:"file",target:"patternFiles",multi:!0},{short:"r",long:"replace",target:"replace"},{short:"d",long:"max-depth",target:"maxDepth",parse:e=>Number(e),validate:e=>Jh("max-depth",e)},{long:"max-filesize",target:"maxFilesize",parse:SI,validate:AI},{long:"context-separator",target:"contextSeparator"},{short:"j",long:"threads",ignored:!0},{long:"ignore-file",target:"ignoreFiles",multi:!0},{long:"pre",target:"preprocessor"},{long:"pre-glob",target:"preprocessorGlobs",multi:!0}],Ov=new Map([["--help",e=>{e.help=!0}],["--type-list",e=>{e.typeList=!0}],["i",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["--ignore-case",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["s",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["--case-sensitive",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["S",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["--smart-case",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["F",e=>{e.fixedStrings=!0}],["--fixed-strings",e=>{e.fixedStrings=!0}],["w",e=>{e.wordRegexp=!0}],["--word-regexp",e=>{e.wordRegexp=!0}],["x",e=>{e.lineRegexp=!0}],["--line-regexp",e=>{e.lineRegexp=!0}],["v",e=>{e.invertMatch=!0}],["--invert-match",e=>{e.invertMatch=!0}],["U",e=>{e.multiline=!0}],["--multiline",e=>{e.multiline=!0}],["--multiline-dotall",e=>{e.multilineDotall=!0,e.multiline=!0}],["c",e=>{e.count=!0}],["--count",e=>{e.count=!0}],["--count-matches",e=>{e.countMatches=!0}],["l",e=>{e.filesWithMatches=!0}],["--files",e=>{e.files=!0}],["--files-with-matches",e=>{e.filesWithMatches=!0}],["--files-without-match",e=>{e.filesWithoutMatch=!0}],["--stats",e=>{e.stats=!0}],["o",e=>{e.onlyMatching=!0}],["--only-matching",e=>{e.onlyMatching=!0}],["q",e=>{e.quiet=!0}],["--quiet",e=>{e.quiet=!0}],["N",e=>{e.lineNumber=!1}],["--no-line-number",e=>{e.lineNumber=!1}],["H",e=>{e.withFilename=!0}],["--with-filename",e=>{e.withFilename=!0}],["I",e=>{e.noFilename=!0}],["--no-filename",e=>{e.noFilename=!0}],["0",e=>{e.nullSeparator=!0}],["--null",e=>{e.nullSeparator=!0}],["b",e=>{e.byteOffset=!0}],["--byte-offset",e=>{e.byteOffset=!0}],["--column",e=>{e.column=!0,e.lineNumber=!0}],["--no-column",e=>{e.column=!1}],["--vimgrep",e=>{e.vimgrep=!0,e.column=!0,e.lineNumber=!0}],["--json",e=>{e.json=!0}],["--hidden",e=>{e.hidden=!0}],["--no-ignore",e=>{e.noIgnore=!0}],["--no-ignore-dot",e=>{e.noIgnoreDot=!0}],["--no-ignore-vcs",e=>{e.noIgnoreVcs=!0}],["L",e=>{e.followSymlinks=!0}],["--follow",e=>{e.followSymlinks=!0}],["z",e=>{e.searchZip=!0}],["--search-zip",e=>{e.searchZip=!0}],["a",e=>{e.searchBinary=!0}],["--text",e=>{e.searchBinary=!0}],["--heading",e=>{e.heading=!0}],["--passthru",e=>{e.passthru=!0}],["--include-zero",e=>{e.includeZero=!0}],["--glob-case-insensitive",e=>{e.globCaseInsensitive=!0}]]),Iv=new Set(["n","--line-number"])});function II(e){return`'${e.replace(/'/g,"'\\''")}'`}function Ga(e){return e.map(II).join(" ")}var Qs=q(()=>{"use strict"});async function $v(e,t,r=!1,n=!1,i=[]){let a=new g0(e,t,r,n);await a.load(t);for(let s of i)try{let o=e.resolvePath(t,s),l=await e.readFile(o);a.addPatternsFromContent(l,t)}catch{}return a}var Ru,g0,$I=q(()=>{"use strict";Dt(),Ru=class{patterns=[];basePath;constructor(e="/"){this.basePath=e}parse(e){let t=e.split(` `);for(let r of t){let n=r.replace(/\s+$/,"");if(!n||n.startsWith("#"))continue;let i=!1;n.startsWith("!")&&(i=!0,n=n.slice(1));let a=!1;n.endsWith("/")&&(a=!0,n=n.slice(0,-1));let s=!1;n.startsWith("/")?(s=!0,n=n.slice(1)):n.includes("/")&&!n.startsWith("**/")&&(s=!0);let o=this.patternToRegex(n,s);this.patterns.push({pattern:r,regex:o,negated:i,directoryOnly:a,rooted:s})}}patternToRegex(e,t){let r="";t?r="^":r="(?:^|/)";let n=0;for(;n=e.length,r+=".*",n+=2):(r+="[^/]*",n++);else if(i==="?")r+="[^/]",n++;else if(i==="["){let a=n+1;for(a=2&&e[0]===31&&e[1]===139}function LI(e){let t=!1;for(let r=0;re.limits.maxStringLength||t>Math.floor(e.limits.maxLiveBytes/3))throw new T(t>e.limits.maxStringLength?`rg: pattern file exceeds string limit (${e.limits.maxStringLength} bytes)`:`rg: live byte limit exceeded (${e.limits.maxLiveBytes} bytes)`,"string_length");return e.executionScope?.reserveBytes("rg pattern files",t*3,"rg")??{release:()=>{}}}function MI(e,t,r){let n=0;for(let i=0;i<=t.length;i++)if(!(in){if(e.length>=r.limits.maxArrayElements)throw new T(`rg: pattern limit exceeded (${r.limits.maxArrayElements})`,"iterations");r.executionScope?.consumeWork(1,"rg pattern insertion"),e.push(t.slice(n,i))}n=i+1}}function k6(e,t,r){if(t>e.limits.maxInputBytes-r)throw new T(`rg: aggregate input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");return e.executionScope?.consumeInput(t,"rg pattern files"),r+t}async function PI(e){let{ctx:t,options:r,paths:n,explicitLineNumbers:i}=e;for(let k of[...r.globs,...r.iglobs]){let w=k.startsWith("!")?k.slice(1):k,v=LI(w);if(v)return{stdout:"",stderr:`${v} `,exitCode:2}}let a=new Tv;for(let k of r.typeClear)a.clearType(k);for(let k of r.typeAdd)a.addType(k);for(let k of[...r.types,...r.typesNot])if(k!=="all"&&!a.getType(k))return{stdout:"",stderr:`rg: unrecognized file type: ${k} `,exitCode:2};if(r.files){let k=[...r.patterns,...n];return zI(t,k,r,a)}if(r.patterns.length>t.limits.maxArrayElements)throw new T(`rg: pattern limit exceeded (${t.limits.maxArrayElements})`,"iterations");let s=r.patterns.slice(),o=[],l=0,u,c;try{for(let w of r.patternFiles)try{let v,A;if(w==="-")v=t.stdin,A=t.stdin.length,l=k6(t,A,l);else{let I=t.fs.resolvePath(t.cwd,w);A=(await t.fs.stat(I)).size,l=k6(t,A,l);let $=C6(t,A);o.push($),v=await Mi(t.fs,I);let _=v.length;if(_>A)throw new T("rg: pattern file grew while being read","string_length");A=_}w==="-"&&o.push(C6(t,A));let R=Ve(v,t.limits.maxStringLength);t.executionScope?.consumeWork(R.length,"rg pattern file parsing"),MI(s,R,t)}catch(v){return Ge(v),{stdout:"",stderr:`rg: ${w}: No such file or directory `,exitCode:2}}if(s.length===0)return r.patternFiles.length>0?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`rg: no pattern given `,exitCode:2};if(r.maxCount===0)return{stdout:"",stderr:"",exitCode:1};let k=FI(r,s);try{let w=BI(s,r,k);u=w.regex,c=w.kResetGroup}catch{return{stdout:"",stderr:`rg: invalid regex: ${s.join(", ")} `,exitCode:2}}}finally{for(let k of o)k.release()}let p=r.patternFiles.includes("-"),d=Ve(t.stdin);if(n.length===0&&(t.stdinProvided||d.length>0)&&!t.stdinUnavailable&&!p){let k=vc(d,u,{invertMatch:r.invertMatch,showLineNumbers:r.lineNumber,countOnly:r.count,countMatches:r.countMatches,filename:"",onlyMatching:r.onlyMatching,beforeContext:r.beforeContext,afterContext:r.afterContext,maxCount:r.maxCount,contextSeparator:r.contextSeparator,showColumn:r.column,vimgrep:r.vimgrep,showByteOffset:r.byteOffset,replace:r.replace!==null?xv(r.replace):null,passthru:r.passthru,multiline:r.multiline,kResetGroup:c,maxWork:t.limits.maxLoopIterations,maxMatches:t.limits.maxArrayElements,signal:t.signal});return r.quiet?{stdout:"",stderr:"",exitCode:k.matched?0:1}:r.filesWithMatches?{stdout:k.matched?`(standard input) `:"",stderr:"",exitCode:k.matched?0:1}:r.filesWithoutMatch?{stdout:k.matched?"":`(standard input) `,stderr:"",exitCode:k.matched?1:0}:{stdout:k.output,stderr:"",exitCode:k.matched?0:1}}let f=n.length===0?["."]:n.map(k=>k==="."?"./":k),h=null;r.noIgnore||(h=await $v(t.fs,t.cwd,r.noIgnoreDot,r.noIgnoreVcs,r.ignoreFiles));let{files:m,singleExplicitFile:g,stderr:x}=await Dv(t,f,r,h,a);if(m.length===0)return{stdout:"",stderr:x,exitCode:x?2:1};let y=!r.noFilename&&(r.withFilename||!g||m.length>1),b=r.lineNumber;return i||(g&&m.length===1&&(b=!1),r.onlyMatching&&(b=!1)),jI(t,m,u,r,y,b,x,c)}function FI(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(r=>/[A-Z]/.test(r)):!1}function BI(e,t,r){let n;return e.length===1?n=e[0]:n=e.map(i=>t.fixedStrings?i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${i})`).join("|"),Qh(n,{mode:t.fixedStrings&&e.length===1?"fixed":"perl",ignoreCase:r,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function Dv(e,t,r,n,i){let a=[],s=new St(Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),"rg"),o=new Wn({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"rg"}),l=0,u=0;for(let c of t){o.checkpoint();let p=e.fs.resolvePath(e.cwd,c);try{let d=await e.fs.stat(p);if(d.isFile){if(l++,r.maxFilesize>0&&d.size>r.maxFilesize)continue;if(a.length>=e.limits.maxArrayElements)throw new T(`rg: file collection limit exceeded (${e.limits.maxArrayElements})`,"array_elements");a.push(c)}else d.isDirectory&&(u++,await Rv(e,c,p,0,r,n,i,a,s,o,new Set))}catch(d){Ge(d),s.append(`rg: ${c}: Unable to access path `)}}return{files:r.sort==="path"?a.sort():a,singleExplicitFile:t.length===1&&l===1&&u===0,stderr:s.build()}}async function Rv(e,t,r,n,i,a,s,o,l,u,c){if(n>=i.maxDepth)return;u.visit(n);let p;if(i.followSymlinks)try{let d=await e.fs.stat(r);if(p=d.identity!==void 0?`identity:${d.identity}`:d.dev!==void 0&&d.ino!==void 0?`inode:${String(d.dev)}:${String(d.ino)}`:`path:${await e.fs.realpath(r)}`,c.has(p))return;c.add(p)}catch(d){Ge(d);return}a&&await a.loadForDirectory(r);try{let d=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(r):(await e.fs.readdir(r)).map(f=>({name:f,isFile:void 0}));for(let f of d){u.checkpoint();let h=f.name;if(!i.noIgnore&&g0.isCommonIgnored(h))continue;let m=h.startsWith("."),g=t==="."?h:t==="./"?`./${h}`:t.endsWith("/")?`${t}${h}`:`${t}/${h}`,x=e.fs.resolvePath(r,h),y,b,k=!1;if(f.isFile!==void 0&&"isDirectory"in f){let v=f;if(k=v.isSymbolicLink===!0,k&&!i.followSymlinks)continue;if(k&&i.followSymlinks)try{let A=await e.fs.stat(x);y=A.isFile,b=A.isDirectory}catch(A){Ge(A);continue}else y=v.isFile,b=v.isDirectory}else try{let v=e.fs.lstat?await e.fs.lstat(x):await e.fs.stat(x);if(k=v.isSymbolicLink===!0,k&&!i.followSymlinks)continue;let A=k&&i.followSymlinks?await e.fs.stat(x):v;y=A.isFile,b=A.isDirectory}catch(v){Ge(v),k||l.append(`rg: ${g}: Unable to access path `);continue}let w=Lv(g,i);if(!(w===!1||a?.matches(x,b)&&w!==!0)&&!(m&&!i.hidden&&w!==!0&&!a?.isWhitelisted(x,b))){if(b)await Rv(e,g,x,n+1,i,a,s,o,l,u,c);else if(y){if(u.visit(n+1),i.maxFilesize>0)try{if((await e.fs.stat(x)).size>i.maxFilesize)continue}catch(v){Ge(v),l.append(`rg: ${g}: Unable to access path `);continue}if(UI(g,i,a,x,s)){if(o.length>=e.limits.maxArrayElements)throw new T(`rg: file collection limit exceeded (${e.limits.maxArrayElements})`,"array_elements");o.push(g)}}}}}catch(d){Ge(d),l.append(`rg: ${t}: Unable to read directory `)}finally{p!==void 0&&c.delete(p)}}function UI(e,t,r,n,i){let a=e.split("/").pop()||e,s=Lv(e,t);return s!==void 0?s:!(t.globs.some(o=>!o.startsWith("!"))||t.iglobs.some(o=>!o.startsWith("!"))||r?.matches(n,!1)||t.types.length>0&&!i.matchesType(a,t.types)||t.typesNot.length>0&&i.matchesType(a,t.typesNot))}function Lv(e,t){let r=e.replace(/^\.\//,""),n=r.split("/").pop()||r;for(let i=t.globs.length+t.iglobs.length-1;i>=0;i--){let a=i>=t.globs.length,s=a?t.iglobs[i-t.globs.length]:t.globs[i],o=a||t.globCaseInsensitive,l=s.startsWith("!"),u=l?s.slice(1):s;if(u.startsWith("/")?Yu(r,u.slice(1),o):Yu(n,u,o)||Yu(r,u,o))return!l}}function Yu(e,t,r=!1){let n="^";for(let i=0;ip.size)throw d?.release(),new T("rg: file grew while being read","string_length");if(e.executionScope?.consumeInput(f.byteLength,"rg"),RI(f)){let h;try{let m=Math.min(e.limits.maxStringLength,e.limits.maxOutputSize,Math.floor((e.executionScope?.remainingLiveBytes??e.limits.maxLiveBytes)/2));h=e.executionScope?.reserveBytes("rg decompressed text",m*2,"rg");let g=DI(f,{maxOutputLength:m}),x=new TextDecoder().decode(g),y=x.slice(0,8192);return{content:x,isBinary:y.includes("\0"),lease:WI(d,h)}}catch(m){return h?.release(),d?.release(),Ge(m),null}}d?.release()}let s=await e.fs.stat(t);a=e.executionScope?.reserveBytes("rg file text",s.size*2,"rg");let o=await Mi(e.fs,t),l=o.length;if(l>s.size)throw new T("rg: file grew while being read","string_length");e.executionScope?.consumeInput(l,"rg");let u=Ve(o,e.limits.maxStringLength),c=u.slice(0,8192);return{content:u,isBinary:c.includes("\0"),lease:a}}catch(s){return a?.release(),Ge(s),i.append(`rg: ${r}: Unable to read file `),null}}function WI(...e){let t=e.filter(r=>r!==void 0);if(t.length!==0)return{release:()=>{for(let r of t)r.release()}}}async function jI(e,t,r,n,i,a,s,o){let l="",u=!1,c=new St(Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),"rg");c.append(s);let p=[],d=0,f=0,h=0,m=n.searchZip?2:50;e:for(let b=0;b{let A=e.fs.resolvePath(e.cwd,v),R=await HI(e,A,v,n,c);if(!R)return null;let{content:I,isBinary:$,lease:_}=R;if(h+=I.length,$&&!n.searchBinary)return _?.release(),null;let M=i&&(!n.heading||n.count||n.countMatches)?v:"";try{let P=vc(I,r,{invertMatch:n.invertMatch,showLineNumbers:a,countOnly:n.count,countMatches:n.countMatches,filename:M,onlyMatching:n.onlyMatching,beforeContext:n.beforeContext,afterContext:n.afterContext,maxCount:n.maxCount,contextSeparator:n.contextSeparator,showColumn:n.column,vimgrep:n.vimgrep,showByteOffset:n.byteOffset,replace:n.replace!==null?xv(n.replace):null,passthru:n.passthru,multiline:n.multiline,kResetGroup:o,maxWork:e.limits.maxLoopIterations,maxMatches:e.limits.maxArrayElements,signal:e.signal});return n.json&&P.matched?{file:v,result:P,content:I,isBinary:!1,lease:_}:(_?.release(),{file:v,result:P})}catch(P){throw _?.release(),P}}));for(let v of w){if(!v)continue;let{file:A,result:R}=v;if(R.matched){if(u=!0,f++,d+=R.matchCount,n.quiet&&!n.json)break e;if(n.json&&!n.quiet){let I=v.content||"";p.push(JSON.stringify({type:"begin",data:{path:{text:A}}}));let $=I.split(` `);r.lastIndex=0;let _=0;for(let M=0;M<$.length;M++){let P=$[M];r.lastIndex=0;let S=[];for(let D=r.exec(P);D!==null;D=r.exec(P)){let W={match:{text:D[0]},start:D.index,end:D.index+D[0].length};n.replace!==null&&(W.replacement={text:n.replace}),S.push(W),D[0].length===0&&r.lastIndex++}if(S.length>0){let D={type:"match",data:{path:{text:A},lines:{text:`${P} `},line_number:M+1,absolute_offset:_,submatches:S}};p.push(JSON.stringify(D))}_+=P.length+1}p.push(JSON.stringify({type:"end",data:{path:{text:A},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:I.length,bytes_printed:0,matched_lines:R.matchCount,matches:R.matchCount}}}))}else if(n.filesWithMatches){let I=n.nullSeparator?"\0":` `;l+=`${A}${I}`}else n.filesWithoutMatch||(n.heading&&!n.count&&!n.countMatches&&(l&&(l+=` `),i&&(l+=`${A} `)),l+=R.output)}else if(n.filesWithoutMatch){let I=n.nullSeparator?"\0":` `;l+=`${A}${I}`}else n.includeZero&&(n.count||n.countMatches)&&(l+=R.output);v.lease?.release()}}n.json&&(p.push(JSON.stringify({type:"summary",data:{elapsed_total:{secs:0,nanos:0,human:"0s"},stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:t.length,searches_with_match:f,bytes_searched:h,bytes_printed:0,matched_lines:d,matches:d}}})),l=`${p.join(` `)} `);let g=n.quiet&&!n.json?"":l;if(n.stats&&!n.json){let b=["",`${d} matches`,`${d} matched lines`,`${f} files contained matches`,`${t.length} files searched`,`${h} bytes searched`].join(` `);g+=`${b} `}let x;n.filesWithoutMatch?x=l.length>0?0:1:x=u?0:1;let y=c.build();return y&&!(n.quiet&&u)&&(x=2),{stdout:g,stderr:y,exitCode:x}}var GI=q(()=>{"use strict";Yt(),ge(),Ar(),jn(),Qs(),J(),Dt(),bv(),_v(),$I()}),Mv={};ce(Mv,{flagsForFuzzing:()=>Fv,rgCommand:()=>Pv});var N6,Pv,Fv,VI=q(()=>{"use strict";be(),_v(),OI(),GI(),N6={name:"rg",summary:"recursively search for a pattern",usage:"rg [OPTIONS] PATTERN [PATH ...]",description:`rg (ripgrep) recursively searches directories for a regex pattern. Unlike grep, rg is recursive by default and respects .gitignore files. EXAMPLES: rg foo Search for 'foo' in current directory rg foo src/ Search in src/ directory rg -i foo Case-insensitive search rg -w foo Match whole words only rg -t js foo Search only JavaScript files rg -g '*.ts' foo Search files matching glob rg --hidden foo Include hidden files rg -l foo List files with matches only`,options:["-e, --regexp PATTERN search for PATTERN (can be used multiple times)","-f, --file FILE read patterns from FILE, one per line","-i, --ignore-case case-insensitive search","-s, --case-sensitive case-sensitive search (overrides smart-case)","-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)","-F, --fixed-strings treat pattern as literal string","-w, --word-regexp match whole words only","-x, --line-regexp match whole lines only","-v, --invert-match select non-matching lines","-r, --replace TEXT replace matches with TEXT","-c, --count print count of matching lines per file"," --count-matches print count of individual matches per file","-l, --files-with-matches print only file names with matches"," --files-without-match print file names without matches"," --files list files that would be searched","-o, --only-matching print only matching parts","-m, --max-count NUM limit matching lines per file (0: no matches)"," --color WHEN never, auto, always, ansi (plain text output only)","-q, --quiet suppress output, exit 0 on match"," --stats print search statistics","-n, --line-number print line numbers (default: on)","-N, --no-line-number do not print line numbers","-I, --no-filename suppress the prefixing of file names","-0, --null use NUL as filename separator","-b, --byte-offset show byte offset of each match"," --column show column number of first match"," --vimgrep show results in vimgrep format"," --json show results in JSON Lines format","-A NUM print NUM lines after each match","-B NUM print NUM lines before each match","-C NUM print NUM lines before and after each match"," --context-separator SEP separator for context groups (default: --)","-U, --multiline match patterns across lines","-z, --search-zip search in compressed files (gzip only)","-g, --glob GLOB include files matching GLOB","-t, --type TYPE only search files of TYPE (e.g., js, py, ts)","-T, --type-not TYPE exclude files of TYPE","-L, --follow follow symbolic links","-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)","-a, --text search binary files as text"," --hidden search hidden files and directories"," --no-ignore don't respect .gitignore/.ignore files","-d, --max-depth NUM maximum search depth"," --sort TYPE sort files (path, none)"," --heading group matches by file; no heading for one explicit file"," -- end options; remaining arguments are pattern and paths"," --passthru print all lines (non-matches use - separator)"," --include-zero include files with 0 matches in count output"," --type-list list all available file types"," --help display this help and exit"]},Pv={name:"rg",async execute(e,t){let r=_I(e);return r.success?r.options.help?we(N6):r.options.typeList?{stdout:wI(),stderr:"",exitCode:0}:PI({ctx:t,options:r.options,paths:r.paths,explicitLineNumbers:r.explicitLineNumbers}):r.error}},Fv={name:"rg",flags:[{flag:"-i",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-N",type:"boolean"},{flag:"--hidden",type:"boolean"},{flag:"--no-ignore",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-g",type:"value",valueHint:"pattern"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-T",type:"value",valueHint:"string"}],needsArgs:!0}});function Gr(e,t,r){if(!e||rn.isInSandboxedContext())return;let n=`${t} ${r} attempted outside defense context`;throw new He(n,{timestamp:Date.now(),type:"missing_defense_context",message:n,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:rn.getCurrentExecutionId()})}async function na(e,t,r,n){Gr(e,t,`${r} (pre-await)`);let i=await n();return Gr(e,t,`${r} (post-await)`),i}var Pi=q(()=>{"use strict";ln()});function Bv(e=0){let t=[],r=[],n=0,i=e>0?"":void 0,a=0;return{append(s){if(i!==void 0){if(a++0&&(t.push(r.join("")),n=0,r.length=0),t.length===1?t[0]:t.join("")))}}}var Uv=q(()=>{"use strict"});function zv(e){let t="",r=0,n=!1;for(;r=127?t+=`\\${i.toString(8).padStart(3,"0")}`:t+=n}return`${t}$`}var Ju,XI=q(()=>{"use strict";Ju=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]])});function QI(e,t,r){return{patternSpace:"",holdSpace:"",lineNumber:0,totalLines:e,deleted:!1,printed:!1,quit:!1,quitSilent:!1,exitCode:void 0,errorMessage:void 0,appendBuffer:[],substitutionMade:!1,lineNumberOutput:[],nCommandOutput:[],restartCycle:!1,inDRestartedCycle:!1,currentFilename:t,pendingFileReads:[],pendingFileWrites:[],rangeStates:r||new Map,linesConsumedInCycle:0}}function KI(e){return typeof e=="object"&&"first"in e&&"step"in e}function YI(e){return typeof e=="object"&&"offset"in e}function ws(e,t,r,n,i){if(e==="$")return t===r;if(typeof e=="number")return t===e;if(KI(e)){let{first:a,step:s}=e;return s===0?t===a:(t-a)%s===0&&t>=a}if(typeof e=="object"&&"pattern"in e)try{let a=e.pattern;a===""&&i?.lastPattern?a=i.lastPattern:a!==""&&i&&(i.lastPattern=a);let s=qv(zv(a));return Ie(s).test(n)}catch{return!1}return!1}function Hd(e){let t=r=>r===void 0?"undefined":r==="$"?"$":typeof r=="number"?String(r):"pattern"in r?`/${r.pattern}/`:"first"in r?`${r.first}~${r.step}`:"unknown";return`${t(e.start)},${t(e.end)}`}function JI(e,t,r,n,i,a){if(!e||!e.start&&!e.end)return!0;let s=e.start,o=e.end;if(s!==void 0&&o===void 0)return ws(s,t,r,n,a);if(s!==void 0&&o!==void 0){let l=typeof s=="object"&&"pattern"in s,u=typeof o=="object"&&"pattern"in o,c=YI(o);if(c&&i){let p=Hd(e),d=i.get(p);if(d||(d={active:!1},i.set(p,d)),d.active){let f=d.startLine||t;return t>=f+o.offset&&(d.active=!1,i.set(p,d)),!0}else return ws(s,t,r,n,a)?(d.active=!0,d.startLine=t,i.set(p,d),o.offset===0&&(d.active=!1,i.set(p,d)),!0):!1}if(!l&&!u&&!c){let p=typeof s=="number"?s:s==="$"?r:1,d=typeof o=="number"?o:r;if(p<=d)return t>=p&&t<=d;if(i){let f=Hd(e),h=i.get(f);return h||(h={active:!1},i.set(f,h)),!h.completed&&t>=p?(h.completed=!0,i.set(f,h),!0):!1}return!1}if(i){let p=Hd(e),d=i.get(p);if(d||(d={active:!1},i.set(p,d)),d.active)return ws(o,t,r,n,a)&&(d.active=!1,typeof s=="number"&&(d.completed=!0),i.set(p,d)),!0;{if(d.completed)return!1;let f=!1;return typeof s=="number"?f=t>=s:f=ws(s,t,r,n,a),f?(d.active=!0,d.startLine=t,i.set(p,d),ws(o,t,r,n,a)&&(d.active=!1,typeof s=="number"&&(d.completed=!0),i.set(p,d)),!0):!1}}return ws(s,t,r,n,a)}return!0}function Ta(e,t,r,n,i,a){let s=JI(e,t,r,n,i,a);return e?.negated?!s:s}function e$(e,t,r,n){let i=Bv(),a=0,s=!1;for(;a<=e.length;){t.lastIndex=a;let o=t.exec(e);if(!o){i.append(e.slice(a));break}o.index!==a&&(i.append(e.slice(a,o.index)),a=o.index,s=!1);let l=o[0],u=o.slice(1);if(s&&l.length===0){if(a=1&&s<=9){n+=r[s-1]||"",i+=2;continue}n+=a,i+=2;continue}if(e[i]==="&"){n+=t,i++;continue}n+=e[i],i++}return n}function T6(e,t,r){if(t>0&&e.length>t)throw new T(`sed: ${r} size limit exceeded (${t} bytes)`,"string_length")}function t$(e,t,r){let{lineNumber:n,totalLines:i,patternSpace:a}=t;if(e.type==="label"){t.coverage?.hit(`sed:cmd:${e.type}`);return}if(Ta(e.address,n,i,a,t.rangeStates,t))switch(t.coverage?.hit(`sed:cmd:${e.type}`),e.type){case"substitute":{let s=e,o="";s.global&&(o+="g"),s.ignoreCase&&(o+="i");let l=s.pattern;l===""&&t.lastPattern?l=t.lastPattern:l!==""&&(t.lastPattern=l);let u=qv(s.extendedRegex?l:zv(l));try{let c=Ie(u,o),p=c.test(t.patternSpace);if(c.lastIndex=0,p){if(t.substitutionMade=!0,s.nthOccurrence&&s.nthOccurrence>0&&!s.global){let d=0,f=s.nthOccurrence,h=Ie(u,`g${s.ignoreCase?"i":""}`);t.patternSpace=h.replace(t.patternSpace,(m,...g)=>{if(d++,d===f){let x=g.slice(0,-2);return Wd(s.replacement,m,x)}return m})}else s.global?t.patternSpace=e$(t.patternSpace,c,s.replacement,(d,f)=>Wd(s.replacement,d,f)):t.patternSpace=c.replace(t.patternSpace,(d,...f)=>{let h=f.slice(0,-2);return Wd(s.replacement,d,h)});s.printOnMatch&&t.lineNumberOutput.push(t.patternSpace)}}catch{}break}case"print":t.lineNumberOutput.push(t.patternSpace);break;case"printFirstLine":{let s=t.patternSpace.indexOf(` `);s!==-1?t.lineNumberOutput.push(t.patternSpace.slice(0,s)):t.lineNumberOutput.push(t.patternSpace);break}case"delete":t.deleted=!0;break;case"deleteFirstLine":{let s=t.patternSpace.indexOf(` `);s!==-1?(t.patternSpace=t.patternSpace.slice(s+1),t.restartCycle=!0,t.inDRestartedCycle=!0):t.deleted=!0;break}case"zap":t.patternSpace="";break;case"append":t.appendBuffer.push(e.text);break;case"insert":t.appendBuffer.unshift(`__INSERT__${e.text}`);break;case"change":t.deleted=!0,t.changedText=e.text;break;case"hold":t.holdSpace=t.patternSpace;break;case"holdAppend":t.holdSpace?t.holdSpace+=` ${t.patternSpace}`:t.holdSpace=t.patternSpace,T6(t.holdSpace,r?.maxStringLength??0,"hold space");break;case"get":t.patternSpace=t.holdSpace;break;case"getAppend":t.patternSpace+=` ${t.holdSpace}`,T6(t.patternSpace,r?.maxStringLength??0,"pattern space");break;case"exchange":{let s=t.patternSpace;t.patternSpace=t.holdSpace,t.holdSpace=s;break}case"next":t.printed=!0;break;case"quit":t.quit=!0,e.exitCode!==void 0&&(t.exitCode=e.exitCode);break;case"quitSilent":t.quit=!0,t.quitSilent=!0,e.exitCode!==void 0&&(t.exitCode=e.exitCode);break;case"list":{let s=ZI(t.patternSpace);t.lineNumberOutput.push(s);break}case"printFilename":t.currentFilename&&t.lineNumberOutput.push(t.currentFilename);break;case"version":{let s=[4,8,0];if(e.minVersion){let o=e.minVersion.split("."),l=[],u=!1;for(let c of o){let p=parseInt(c,10);if(Number.isNaN(p)||p<0){t.quit=!0,t.exitCode=1,t.errorMessage=`sed: invalid version string: ${e.minVersion}`,u=!0;break}l.push(p)}if(!u){for(;l.length<3;)l.push(0);for(let c=0;c<3;c++){if(l[c]>s[c]){t.quit=!0,t.exitCode=1,t.errorMessage=`sed: this is not GNU sed version ${e.minVersion}`;break}if(l[c]a)throw new T(`sed: command execution exceeded maximum iterations (${a})`,"iterations");if(t.deleted||t.quit||t.quitSilent||t.restartCycle)break;let l=e[o];if(l.type==="next"){if(Ta(l.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t))if(t.coverage?.hit("sed:cmd:next"),t.nCommandOutput.push(t.patternSpace),r&&r.currentLineIndex+t.linesConsumedInCycle+1{"use strict";J(),Dt(),Uv(),XI(),Wv=1e4}),me,jv,i$=q(()=>{"use strict";J(),(function(e){e.NUMBER="NUMBER",e.DOLLAR="DOLLAR",e.PATTERN="PATTERN",e.STEP="STEP",e.RELATIVE_OFFSET="RELATIVE_OFFSET",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.COMMA="COMMA",e.NEGATION="NEGATION",e.COMMAND="COMMAND",e.SUBSTITUTE="SUBSTITUTE",e.TRANSLITERATE="TRANSLITERATE",e.LABEL_DEF="LABEL_DEF",e.BRANCH="BRANCH",e.BRANCH_ON_SUBST="BRANCH_ON_SUBST",e.BRANCH_ON_NO_SUBST="BRANCH_ON_NO_SUBST",e.TEXT_CMD="TEXT_CMD",e.FILE_READ="FILE_READ",e.FILE_READ_LINE="FILE_READ_LINE",e.FILE_WRITE="FILE_WRITE",e.FILE_WRITE_LINE="FILE_WRITE_LINE",e.EXECUTE="EXECUTE",e.VERSION="VERSION",e.EOF="EOF",e.ERROR="ERROR"})(me||(me={})),jv=class{maxInputLength;maxTokens;input;pos=0;line=1;column=1;constructor(e,t=1024*1024,r=1e5){this.maxInputLength=t,this.maxTokens=r,this.input=e}tokenize(){if(this.input.length>this.maxInputLength)throw new T(`sed: script size limit exceeded (${this.maxInputLength} bytes)`,"string_length");let e=[];for(;this.pos=this.maxTokens-1)throw new T(`sed: token limit exceeded (${this.maxTokens})`,"array_elements");e.push(t)}}return e.push(this.makeToken(me.EOF,"")),e}makeToken(e,t,r){return{type:e,value:t,line:this.line,column:this.column,...r}}peek(e=0){return this.input[this.pos+e]||""}advance(){let e=this.input[this.pos++]||"";return e===` `?(this.line++,this.column=1):this.column++,e}readEscapedString(e){let t="";for(;this.pos=this.input.length)return null;let e=this.line,t=this.column,r=this.peek();return r===` `?(this.advance(),{type:me.NEWLINE,value:` `,line:e,column:t}):r===";"?(this.advance(),{type:me.SEMICOLON,value:";",line:e,column:t}):r==="{"?(this.advance(),{type:me.LBRACE,value:"{",line:e,column:t}):r==="}"?(this.advance(),{type:me.RBRACE,value:"}",line:e,column:t}):r===","?(this.advance(),{type:me.COMMA,value:",",line:e,column:t}):r==="!"?(this.advance(),{type:me.NEGATION,value:"!",line:e,column:t}):r==="$"?(this.advance(),{type:me.DOLLAR,value:"$",line:e,column:t}):this.isDigit(r)?this.readNumber():r==="+"&&this.isDigit(this.input[this.pos+1]||"")?this.readRelativeOffset():r==="/"?this.readPattern():r===":"?this.readLabelDef():this.readCommand()}readNumber(){let e=this.line,t=this.column,r="";for(;this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="~"){this.advance();let n="";for(;this.isDigit(this.peek());)n+=this.advance();let i=parseInt(r,10),a=parseInt(n,10)||0;return{type:me.STEP,value:`${i}~${a}`,first:i,step:a,line:e,column:t}}return{type:me.NUMBER,value:parseInt(r,10),line:e,column:t}}readRelativeOffset(){let e=this.line,t=this.column;this.advance();let r="";for(;this.isDigit(this.peek());)r+=this.advance();let n=parseInt(r,10)||0;return{type:me.RELATIVE_OFFSET,value:`+${n}`,offset:n,line:e,column:t}}readPattern(){let e=this.line,t=this.column;this.advance();let r="",n=!1;for(;this.pos="0"&&e<="9"}}});function a$(e,t=!1,r){if(r){if(e.length>r.maxArrayElements)throw new T(`sed: script count limit exceeded (${r.maxArrayElements})`,"array_elements");let l=Math.max(0,e.length-1);for(let u of e)if(l+=K(u),l>r.maxStringLength)throw new T(`sed: script size limit exceeded (${r.maxStringLength} bytes)`,"string_length")}let n=!1,i=!1,a=[];for(let l=0;l0&&a[a.length-1].endsWith("\\")){let c=a[a.length-1];a[a.length-1]=`${c} ${u}`}else a.push(u)}let s=a.join(` `),o=new Zv([s],t||i,r).parse();if(!o.error&&o.commands.length>0){let l=s$(o.commands);if(l)return{commands:[],error:l,silentMode:n,extendedRegexMode:i}}return{...o,silentMode:n,extendedRegexMode:i}}function s$(e){let t=new Set;Gv(e,t);let r=Vv(e,t);if(r)return`undefined label '${r}'`}function Gv(e,t){for(let r of e)r.type==="label"?t.add(r.name):r.type==="group"&&Gv(r.commands,t)}function Vv(e,t){for(let r of e){if((r.type==="branch"||r.type==="branchOnSubst"||r.type==="branchOnNoSubst")&&r.label&&!t.has(r.label))return r.label;if(r.type==="group"){let n=Vv(r.commands,t);if(n)return n}}}var Zv,o$=q(()=>{"use strict";J(),ir(),i$(),Zv=class{scripts;limits;tokens=[];pos=0;extendedRegex=!1;constructor(e,t=!1,r){this.scripts=e,this.limits=r,this.extendedRegex=t}parse(){let e=[];for(let t of this.scripts){let r=new jv(t,this.limits?.maxStringLength,this.limits?.maxArrayElements);for(this.tokens=r.tokenize(),this.pos=0;!this.isAtEnd();){if(this.check(me.NEWLINE)||this.check(me.SEMICOLON)){this.advance();continue}let n=this.pos,i=this.parseCommand();if(i.error)return{commands:[],error:i.error};if(i.command&&e.push(i.command),this.pos===n&&!this.isAtEnd())return{commands:[],error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}}return{commands:e}}parseCommand(){let e=this.parseAddressRange();if(e?.error)return{command:null,error:e.error};let t=e?.address;for(this.check(me.NEGATION)&&(this.advance(),t&&(t.negated=!0));this.check(me.NEWLINE)||this.check(me.SEMICOLON);)this.advance();if(this.isAtEnd())return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:"command expected"}:{command:null};let r=this.peek();switch(r.type){case me.COMMAND:return this.parseSimpleCommand(r,t);case me.SUBSTITUTE:return this.parseSubstituteFromToken(r,t);case me.TRANSLITERATE:return this.parseTransliterateFromToken(r,t);case me.LABEL_DEF:return this.advance(),{command:{type:"label",name:r.label||""}};case me.BRANCH:return this.advance(),{command:{type:"branch",address:t,label:r.label}};case me.BRANCH_ON_SUBST:return this.advance(),{command:{type:"branchOnSubst",address:t,label:r.label}};case me.BRANCH_ON_NO_SUBST:return this.advance(),{command:{type:"branchOnNoSubst",address:t,label:r.label}};case me.TEXT_CMD:return this.advance(),this.parseTextCommand(r,t);case me.FILE_READ:return this.advance(),{command:{type:"readFile",address:t,filename:r.filename||""}};case me.FILE_READ_LINE:return this.advance(),{command:{type:"readFileLine",address:t,filename:r.filename||""}};case me.FILE_WRITE:return this.advance(),{command:{type:"writeFile",address:t,filename:r.filename||""}};case me.FILE_WRITE_LINE:return this.advance(),{command:{type:"writeFirstLine",address:t,filename:r.filename||""}};case me.EXECUTE:return this.advance(),{command:{type:"execute",address:t,command:r.command}};case me.VERSION:return this.advance(),{command:{type:"version",address:t,minVersion:r.label}};case me.LBRACE:return this.parseGroup(t);case me.RBRACE:return{command:null};case me.ERROR:return{command:null,error:`invalid command: ${r.value}`};default:return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:"command expected"}:{command:null}}}parseSimpleCommand(e,t){this.advance();let r=e.value;switch(r){case"p":return{command:{type:"print",address:t}};case"P":return{command:{type:"printFirstLine",address:t}};case"d":return{command:{type:"delete",address:t}};case"D":return{command:{type:"deleteFirstLine",address:t}};case"h":return{command:{type:"hold",address:t}};case"H":return{command:{type:"holdAppend",address:t}};case"g":return{command:{type:"get",address:t}};case"G":return{command:{type:"getAppend",address:t}};case"x":return{command:{type:"exchange",address:t}};case"n":return{command:{type:"next",address:t}};case"N":return{command:{type:"nextAppend",address:t}};case"q":return{command:{type:"quit",address:t}};case"Q":return{command:{type:"quitSilent",address:t}};case"z":return{command:{type:"zap",address:t}};case"=":return{command:{type:"lineNumber",address:t}};case"l":return{command:{type:"list",address:t}};case"F":return{command:{type:"printFilename",address:t}};default:return{command:null,error:`unknown command: ${r}`}}}parseSubstituteFromToken(e,t){this.advance();let r=e.flags||"",n,i=r.match(/(\d+)/);return i&&(n=parseInt(i[1],10)),{command:{type:"substitute",address:t,pattern:e.pattern||"",replacement:e.replacement||"",global:r.includes("g"),ignoreCase:r.includes("i")||r.includes("I"),printOnMatch:r.includes("p"),nthOccurrence:n,extendedRegex:this.extendedRegex}}}parseTransliterateFromToken(e,t){this.advance();let r=e.source||"",n=e.dest||"";return r.length!==n.length?{command:null,error:"transliteration sets must have same length"}:{command:{type:"transliterate",address:t,source:r,dest:n}}}parseTextCommand(e,t){let r=e.value,n=e.text||"";switch(r){case"a":return{command:{type:"append",address:t,text:n}};case"i":return{command:{type:"insert",address:t,text:n}};case"c":return{command:{type:"change",address:t,text:n}};default:return{command:null,error:`unknown text command: ${r}`}}}parseGroup(e){this.advance();let t=[];for(;!this.isAtEnd()&&!this.check(me.RBRACE);){if(this.check(me.NEWLINE)||this.check(me.SEMICOLON)){this.advance();continue}let r=this.pos,n=this.parseCommand();if(n.error)return{command:null,error:n.error};if(n.command&&t.push(n.command),this.pos===r&&!this.isAtEnd())return{command:null,error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}return this.check(me.RBRACE)?(this.advance(),{command:{type:"group",address:e,commands:t}}):{command:null,error:"unmatched brace in grouped commands"}}parseAddressRange(){if(this.check(me.COMMA))return{error:"expected context address"};let e=this.parseAddress();if(e===void 0)return;let t;if(this.check(me.RELATIVE_OFFSET))t={offset:this.advance().offset||0};else if(this.check(me.COMMA)&&(this.advance(),t=this.parseAddress(),t===void 0))return{error:"expected context address"};return{address:{start:e,end:t}}}parseAddress(){let e=this.peek();switch(e.type){case me.NUMBER:return this.advance(),e.value;case me.DOLLAR:return this.advance(),"$";case me.PATTERN:return this.advance(),{pattern:e.pattern||e.value};case me.STEP:return this.advance(),{first:e.first||0,step:e.step||0};case me.RELATIVE_OFFSET:return this.advance(),{offset:e.offset||0};default:return}}peek(){return this.tokens[this.pos]||{type:me.EOF,value:"",line:0,column:0}}advance(){return this.isAtEnd()||this.pos++,this.tokens[this.pos-1]}check(e){return this.peek().type===e}isAtEnd(){return this.peek().type===me.EOF}}}),Xv={};ce(Xv,{flagsForFuzzing:()=>Kv,sedCommand:()=>Qv});async function jd(e,t,r,n={}){let{limits:i,filename:a,fs:s,cwd:o,coverage:l,requireDefenseContext:u}=n;Gr(u,"sed","processing entry");let c=($,_)=>na(u,"sed",$,_),p=e.endsWith(` `),d=e.split(` `);d.length>0&&d[d.length-1]===""&&d.pop();let f=d.length,h="",m,g=!1,x=i?.maxStringLength??0,y=$=>{if(h+=$,x>0&&h.length>x)throw new T(`sed: output size limit exceeded (${x} bytes)`,"string_length")},b="",k,w=new Map,v=new Map,A=new Map,R=new Map,I=i?{maxIterations:i.maxSedIterations,maxStringLength:x}:void 0;for(let $=0;$S)break;if(_.restartCycle=!1,_.pendingFileReads=[],_.pendingFileWrites=[],Hv(t,_,M,I),s&&o){for(let H of _.pendingFileReads){let z=s.resolvePath(o,H.filename);try{if(H.wholeFile){let ee=await c("read command file",()=>s.readFile(z));_.appendBuffer.push(ee.replace(/\n$/,""))}else{if(!v.has(z)){let ne=await c("read command file line cache",()=>s.readFile(z));v.set(z,ne.split(` `)),A.set(z,0)}let ee=v.get(z),Y=A.get(z);ee&&Y!==void 0&&Y0;for(let H of _.lineNumberOutput)y(`${H} `);let W=[],j=[];for(let H of _.appendBuffer)H.startsWith("__INSERT__")?W.push(H.slice(10)):j.push(H);for(let H of W)y(`${H} `);let U=!1;!_.deleted&&!_.quitSilent?r?_.printed&&(y(`${_.patternSpace} `),U=!0):(y(`${_.patternSpace} `),U=!0):_.changedText!==void 0&&(y(`${_.changedText} `),U=!0);for(let H of j)y(`${H} `);if(g=(D||U)&&j.length===0,_.quit||_.quitSilent){if(_.exitCode!==void 0&&(m=_.exitCode),_.errorMessage)return{output:"",exitCode:m||1,errorMessage:_.errorMessage};break}}if(s&&o)for(let[$,_]of R)try{await c("flush pending file writes",()=>s.writeFile($,_))}catch(M){if(M instanceof He)throw M}return!p&&g&&h.endsWith(` `)&&(h=h.slice(0,-1)),{output:h,exitCode:m}}var _6,Qv,Kv,l$=q(()=>{"use strict";ge(),Nn(),J(),Pi(),ln(),be(),n$(),o$(),_6={name:"sed",summary:"stream editor for filtering and transforming text",usage:"sed [OPTION]... {script} [input-file]...",options:["-n, --quiet, --silent suppress automatic printing of pattern space","-e script add the script to commands to be executed","-f script-file read script from file","-i, --in-place edit files in place","-E, -r, --regexp-extended use extended regular expressions"," --help display this help and exit"],description:`Commands: s/regexp/replacement/[flags] substitute d delete pattern space p print pattern space a\\ text append text after line i\\ text insert text before line c\\ text change (replace) line with text h copy pattern space to hold space H append pattern space to hold space g copy hold space to pattern space G append hold space to pattern space x exchange pattern and hold spaces n read next line into pattern space N append next line to pattern space y/source/dest/ transliterate characters = print line number l list pattern space (escape special chars) b [label] branch to label t [label] branch on substitution T [label] branch if no substitution :label define label q quit Q quit without printing Addresses: N line number $ last line /regexp/ lines matching regexp N,M range from line N to M first~step every step-th line starting at first`},Qv={name:"sed",async execute(e,t){Gr(t.requireDefenseContext,"sed","execution entry");let r=(m,g)=>na(t.requireDefenseContext,"sed",m,g);if(Ce(e))return we(_6);let n=[],i=[],a=!1,s=!1,o=!1,l=[];for(let m=0;m1){for(let x of g.slice(1))if(x!=="n"&&x!=="e"&&x!=="f"&&x!=="i"&&x!=="E"&&x!=="r")return Le("sed",`-${x}`);g.includes("n")&&(a=!0),g.includes("i")&&(s=!0),(g.includes("E")||g.includes("r"))&&(o=!0),g.includes("e")&&!g.includes("n")&&!g.includes("i")&&m+1t.fs.readFile(g));for(let y of x.split(` `)){let b=y.trim();b&&!b.startsWith("#")&&n.push(b)}}catch(x){if(x instanceof He)throw x;return{stdout:"",stderr:`sed: couldn't open file ${m}: No such file or directory `,exitCode:1}}}if(n.length===0)return{stdout:"",stderr:`sed: no script specified `,exitCode:1};let{commands:u,error:c,silentMode:p}=a$(n,o,t.limits);if(c)return{stdout:"",stderr:`sed: ${c} `,exitCode:1};let d=!!(a||p);if(s){if(l.length===0)return{stdout:"",stderr:`sed: -i requires at least one file argument `,exitCode:1};for(let m of l){if(m==="-")continue;let g=t.fs.resolvePath(t.cwd,m);try{let x=await r("in-place input read",()=>t.fs.readFile(g)),y=await r("in-place processing",()=>jd(x,u,d,{limits:t.limits,filename:m,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));if(y.errorMessage)return{stdout:"",stderr:`${y.errorMessage} `,exitCode:y.exitCode??1};await r("in-place output write",()=>t.fs.writeFile(g,y.output))}catch(x){if(x instanceof He)throw x;return x instanceof T?{stdout:"",stderr:`sed: ${Xt(x.message)} `,exitCode:T.EXIT_CODE}:{stdout:"",stderr:`sed: ${m}: No such file or directory `,exitCode:1}}}return{stdout:"",stderr:"",exitCode:0}}let f="";if(l.length===0){f=Ve(t.stdin);try{let m=await r("stdin processing",()=>jd(f,u,d,{limits:t.limits,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:m.output,stderr:m.errorMessage?`${m.errorMessage} `:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof He)throw m;if(m instanceof T)return{stdout:"",stderr:`sed: ${Xt(m.message)} `,exitCode:T.EXIT_CODE};throw m}}let h=!1;for(let m of l){let g;if(m==="-")h?g="":(g=Ve(t.stdin),h=!0);else{let x=t.fs.resolvePath(t.cwd,m);try{g=await r("input file read",()=>t.fs.readFile(x))}catch(y){if(y instanceof He)throw y;return y instanceof T?{stdout:"",stderr:`sed: ${Xt(y.message)} `,exitCode:T.EXIT_CODE}:{stdout:"",stderr:`sed: ${m}: No such file or directory `,exitCode:1}}}f.length>0&&g.length>0&&!f.endsWith(` `)&&(f+=` `),f+=g}try{let m=await r("final processing",()=>jd(f,u,d,{limits:t.limits,filename:l.length===1?l[0]:void 0,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:m.output,stderr:m.errorMessage?`${m.errorMessage} `:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof He)throw m;if(m instanceof T)return{stdout:"",stderr:`sed: ${Xt(m.message)} `,exitCode:T.EXIT_CODE};throw m}}},Kv={name:"sed",flags:[{flag:"-n",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-E",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0}});function Fn(e){return Object.assign(Object.create(null),Object.fromEntries(e))}function mn(e,t){return Object.assign(Object.create(null),Object.fromEntries(e),t)}function Sc(...e){return Object.assign(Object.create(null),...e)}var ia=q(()=>{"use strict"});function u$(e={}){let{fieldSep:t=e8,maxIterations:r=Yv,maxRecursionDepth:n=Jv,maxOutputSize:i=0,maxArrayElements:a=1e5,fs:s,cwd:o,exec:l,coverage:u,requireDefenseContext:c}=e;return{FS:" ",OFS:" ",ORS:` `,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,getlineCommandStreams:new Map,getlineFileStreams:new Map,fieldSep:t,maxIterations:r,maxRecursionDepth:n,maxOutputSize:i,maxArrayElements:a,arrayElementCount:0,recordsProcessed:0,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:s,cwd:o,exec:l,coverage:u,requireDefenseContext:c}}var Yv,Jv,e8,c$=q(()=>{"use strict";Dt(),Yv=1e4,Jv=100,e8=new Jc(/\s+/)});function p$(e,t,r){switch(r){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}var f$=q(()=>{"use strict"});function An(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function nr(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function vt(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function O6(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function e1(e,t){try{return Ie(e).test(t)}catch{return!1}}var Sl=q(()=>{"use strict";Dt()});function x0(e,t){if(t==="")return[];let r=e.maxArrayElements,n=r<4294967294?r+1:void 0,i=e.FS===" "?t.trim().split(/\s+/,n).filter(Boolean):e.fieldSep.split(t,n);if(i.length>r)throw new T(`field count limit exceeded (${r})`,"array_elements");return i}function Ac(e,t){if(!(Number.isFinite(t)&&t<=e.fields.length)){if(!Number.isFinite(t)||t>e.maxArrayElements)throw new T(`field count limit exceeded (${e.maxArrayElements})`,"array_elements");if(e.maxOutputSize>0&&(t-1)*K(e.OFS)>e.maxOutputSize)throw t8(e);for(;e.fields.length0){let t=Math.max(0,e.fields.length-1)*K(e.OFS);for(let r of e.fields)if(t+=K(r),t>e.maxOutputSize)break;if(t>e.maxOutputSize)throw t8(e)}e.line=e.fields.join(e.OFS)}function y0(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function r8(e,t,r){t===0?(e.line=vt(r),e.fields=x0(e,e.line),e.NF=e.fields.length):t>0&&(Ac(e,t),e.fields[t-1]=vt(r),e.NF=e.fields.length,Cc(e))}function tp(e,t){e.line=t,e.fields=x0(e,t),e.NF=e.fields.length}function d$(e,t){if(e.FS=t,t===" ")e.fieldSep=new Jc(/\s+/);else try{e.fieldSep=Ie(t)}catch{e.fieldSep=Ie(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}var rp=q(()=>{"use strict";ge(),J(),Dt(),Sl()});function kn(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function Sr(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function b0(e){return new St(e,"awk string",()=>new T(`string size limit exceeded (${e} bytes)`,"string_length"))}function ki(e){return e.maxOutputSize>0?e.maxOutputSize:v0}function kc(e,t,r,n,i){let a=b0(i),s=0,o=0,l=0;for(let u of t.matchAll(e)){let c=u.index??0;o++,a.append(e.slice(s,c)),r(o)?(a.append(n(u)),l++):a.append(u[0]),s=c+u[0].length}return a.append(e.slice(s)),{value:a.build(),replacements:l}}async function np(e,t){if(e.type==="regex")return e.pattern;let r=Sr(await t.evalExpr(e));return r.startsWith("/")&&r.endsWith("/")&&(r=r.slice(1,-1)),r}async function n8(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(kn(await t.evalExpr(e.index)))}`:"$0":"$0"}function i8(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let r=Number(e.slice(1))-1;return t.fields[r]||""}return Sr(t.vars[e]??"")}function a8(e,t,r){if(e==="$0")r.line=t,r.fields=x0(r,t),r.NF=r.fields.length;else if(e.startsWith("$")){let n=Number(e.slice(1))-1;Ac(r,n+1),r.fields[n]=t,r.NF=r.fields.length,Cc(r)}else r.vars[e]=t}async function h$(e,t,r){return e.length===0?t.line.length:Sr(await r.evalExpr(e[0])).length}async function m$(e,t,r){if(e.length<2)return"";let n=Sr(await r.evalExpr(e[0])),i=Math.floor(kn(await r.evalExpr(e[1])))-1;if(e.length>=3){let a=Math.floor(kn(await r.evalExpr(e[2])));return n.substr(Math.max(0,i),a)}return n.substr(Math.max(0,i))}async function g$(e,t,r){if(e.length<2)return 0;let n=Sr(await r.evalExpr(e[0])),i=Sr(await r.evalExpr(e[1])),a=n.indexOf(i);return a===-1?0:a+1}async function x$(e,t,r){if(e.length<2)return 0;let n=Sr(await r.evalExpr(e[0])),i=e[1];if(i.type!=="variable")return 0;let a=i.name,s=t.FS;if(e.length>=3){let c=e[2];if(c.type==="regex")s=Ie(c.pattern);else{let p=Sr(await r.evalExpr(c));s=p===" "?Ie("\\s+"):p}}else t.FS===" "&&(s=Ie("\\s+"));let o=Object.keys(t.arrays[a]??{}).length,l=t.maxArrayElements-t.arrayElementCount+o,u=typeof s=="string"?n.split(s,l+1):s.split(n,l+1);if(u.length>l)throw new T(`array element limit exceeded (${t.maxArrayElements})`,"array_elements");t.arrays[a]=Object.create(null);for(let c=0;cu===1,u=>s8(i,u[0],ki(t)),ki(t));return a8(a,l.value,t),l.replacements}catch(o){return Ge(o),0}}async function b$(e,t,r){if(e.length<2)return 0;let n=await np(e[0],r),i=Sr(await r.evalExpr(e[1])),a=await n8(e[2],r),s=i8(a,t);try{let o=Ie(n,"g"),l=kc(s,o,()=>!0,u=>s8(i,u[0],ki(t)),ki(t));return a8(a,l.value,t),l.replacements}catch(o){return Ge(o),0}}function s8(e,t,r){let n=b0(r),i=0;for(;i=4?Sr(await r.evalExpr(e[3])):t.line;try{let o=a.toLowerCase()==="g",l=o?0:parseInt(a,10)||1;if(o){let u=Ie(n,"g");return kc(s,u,()=>!0,c=>I6(i,c[0],c.slice(1),ki(t)),ki(t)).value}else{let u=Ie(n,"g");return kc(s,u,c=>c===l,c=>I6(i,c[0],c.slice(1),ki(t)),ki(t)).value}}catch(o){return Ge(o),s}}function I6(e,t,r,n){let i=b0(n),a=0;for(;a="1"&&s<="9"){let o=parseInt(s,10)-1;i.append(r[o]||""),a+=2}else s==="n"?(i.append(` `),a+=2):s==="t"?(i.append(" "),a+=2):(i.append(s),a+=2)}else e[a]==="&"?(i.append(t),a++):(i.append(e[a]),a++);return i.build()}async function E$(e,t,r){return e.length===0?"":Sr(await r.evalExpr(e[0])).toLowerCase()}async function S$(e,t,r){return e.length===0?"":Sr(await r.evalExpr(e[0])).toUpperCase()}async function A$(e,t,r){if(e.length===0)return"";let n=Sr(await r.evalExpr(e[0])),i=[];for(let a=1;a0?kn(await r.evalExpr(e[0])):0,i=e.length>1?kn(await r.evalExpr(e[1])):0;return Math.atan2(n,i)}async function O$(e,t,r){return e.length===0?0:Math.log(kn(await r.evalExpr(e[0])))}async function I$(e,t,r){return e.length===0?1:Math.exp(kn(await r.evalExpr(e[0])))}function $$(e,t,r){return t.random?t.random():Math.random()}async function D$(e,t,r){let n=e.length>0?kn(await r.evalExpr(e[0])):Date.now();return t.vars._srand_seed=n,n}function R$(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function Gd(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}function w0(e,t,r=v0){let n=0,i="",a=0,s=0,o=Math.min(o8,r),l=u=>{let c=K(u);if(c>r-a)throw new T(`formatted string size limit exceeded (${r} bytes)`,"string_length");i+=u,a+=c};for(;sh&&e[u]==="$"?(f=parseInt(e.substring(h,u),10)-1,u++):u=h;let m=()=>{if(uo)throw new T(`printf width limit exceeded (${o} bytes)`,"string_length");if(e[u]==="."){if(u++,e[u]==="*"){let y=t[n++],b=y!==void 0?Math.floor(Number(y)):0;if(!Number.isFinite(b)||!Number.isSafeInteger(b))throw new T(`printf precision limit exceeded (${o} bytes)`,"string_length");d=b<0?"":String(b),u++}else for(;uo)throw new T(`printf precision limit exceeded (${o} bytes)`,"string_length")}m();let g=e[u],x=t[f!==void 0?f:n];switch(g){case"s":{let y=x!==void 0?String(x):"";if(d&&(y=y.substring(0,parseInt(d,10))),p){let b=parseInt(p,10);c.includes("-")?y=y.padEnd(b):y=y.padStart(b)}l(y),f===void 0&&n++;break}case"d":case"i":{let y=x!==void 0?Math.floor(Number(x)):0;Number.isNaN(y)&&(y=0);let b=y<0,k=Math.abs(y).toString();if(d){let A=parseInt(d,10);k=k.padStart(A,"0")}let w="";b?w="-":c.includes("+")?w="+":c.includes(" ")&&(w=" ");let v=w+k;if(p){let A=parseInt(p,10);c.includes("-")?v=v.padEnd(A):c.includes("0")&&!d?v=w+k.padStart(A-w.length,"0"):v=v.padStart(A)}l(v),f===void 0&&n++;break}case"f":{let y=x!==void 0?Number(x):0;Number.isNaN(y)&&(y=0);let b=d?parseInt(d,10):6;if(b>100)throw new T("printf floating-point precision limit exceeded (100 digits)","string_length");let k=y.toFixed(b);if(p){let w=parseInt(p,10);c.includes("-")?k=k.padEnd(w):k=k.padStart(w)}l(k),f===void 0&&n++;break}case"e":case"E":{let y=x!==void 0?Number(x):0;Number.isNaN(y)&&(y=0);let b=d?parseInt(d,10):6;if(b>100)throw new T("printf floating-point precision limit exceeded (100 digits)","string_length");let k=y.toExponential(b);if(g==="E"&&(k=k.toUpperCase()),p){let w=parseInt(p,10);c.includes("-")?k=k.padEnd(w):k=k.padStart(w)}l(k),f===void 0&&n++;break}case"g":case"G":{let y=x!==void 0?Number(x):0;Number.isNaN(y)&&(y=0);let b=d?parseInt(d,10):6;if(b>100)throw new T("printf floating-point precision limit exceeded (100 digits)","string_length");let k=y!==0?Math.floor(Math.log10(Math.abs(y))):0,w;if(y===0?w="0":k<-4||k>=b?(w=y.toExponential(b-1),g==="G"&&(w=w.toUpperCase())):w=y.toPrecision(b),w.includes(".")&&(w=w.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),w.includes("e")&&(w=w.replace(/\.?0+e/,"e")),p){let v=parseInt(p,10);c.includes("-")?w=w.padEnd(v):w=w.padStart(v)}l(w),f===void 0&&n++;break}case"x":case"X":{let y=x!==void 0?Math.floor(Number(x)):0;Number.isNaN(y)&&(y=0);let b=Math.abs(y).toString(16);if(g==="X"&&(b=b.toUpperCase()),d){let v=parseInt(d,10);b=b.padStart(v,"0")}let k=y<0?"-":"",w=k+b;if(p){let v=parseInt(p,10);c.includes("-")?w=w.padEnd(v):c.includes("0")&&!d?w=k+b.padStart(v-k.length,"0"):w=w.padStart(v)}l(w),f===void 0&&n++;break}case"o":{let y=x!==void 0?Math.floor(Number(x)):0;Number.isNaN(y)&&(y=0);let b=Math.abs(y).toString(8);if(d){let v=parseInt(d,10);b=b.padStart(v,"0")}let k=y<0?"-":"",w=k+b;if(p){let v=parseInt(p,10);c.includes("-")?w=w.padEnd(v):c.includes("0")&&!d?w=k+b.padStart(v-k.length,"0"):w=w.padStart(v)}l(w),f===void 0&&n++;break}case"c":{l(typeof x=="number"?String.fromCharCode(x):String(x??"").charAt(0)||""),f===void 0&&n++;break}case"%":l("%");break;default:l(e.substring(s,u+1))}s=u+1}else if(e[s]==="\\"&&s+1{"use strict";Yt(),ge(),Ar(),J(),Dt(),rp(),v0=10*1024*1024,o8=1e4,l8=new Map([["length",h$],["substr",m$],["index",g$],["split",x$],["sub",y$],["gsub",b$],["match",w$],["gensub",v$],["tolower",E$],["toupper",S$],["sprintf",A$],["int",C$],["sqrt",k$],["sin",N$],["cos",T$],["atan2",_$],["log",O$],["exp",I$],["rand",$$],["srand",D$],["system",R$("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",Gd("systime")],["mktime",Gd("mktime")],["strftime",Gd("strftime")]])});function E0(e,t){switch(t){case"FS":return e.FS;case"OFS":return e.OFS;case"ORS":return e.ORS;case"OFMT":return e.OFMT;case"NR":return e.NR;case"NF":return e.NF;case"FNR":return e.FNR;case"FILENAME":return e.FILENAME;case"RSTART":return e.RSTART;case"RLENGTH":return e.RLENGTH;case"SUBSEP":return e.SUBSEP;case"ARGC":return e.ARGC}return e.vars[t]??""}function Al(e,t,r){switch(t){case"FS":d$(e,vt(r));return;case"OFS":e.OFS=vt(r);return;case"ORS":e.ORS=vt(r);return;case"OFMT":e.OFMT=vt(r);return;case"NR":e.NR=Math.floor(nr(r));return;case"NF":{let n=Math.floor(nr(r));if(!Number.isFinite(n))Ac(e,n);else{if(n<0)throw new Error("NF set to negative value");n=e.maxArrayElements)throw new T(`array element limit exceeded (${e.maxArrayElements})`,"array_elements");e.arrayElementCount++}e.arrays[i][r]=n}function L$(e,t,r){if(t==="ARGV")return e.ARGV[r]!==void 0;if(t==="ENVIRON")return e.ENVIRON[r]!==void 0;let n=Cl(e,t);return e.arrays[n]?.[r]!==void 0}function M$(e,t,r){let n=Cl(e,t);e.arrays[n]&&(r in e.arrays[n]&&e.arrayElementCount--,delete e.arrays[n][r])}function P$(e,t){let r=Cl(e,t);e.arrayElementCount-=Object.keys(e.arrays[r]??{}).length,delete e.arrays[r]}var p8=q(()=>{"use strict";J(),rp(),Sl()});function F$(e){A0=e}function Yr(e,t){Gr(e.requireDefenseContext,"awk",t)}function it(e,t,r){return na(e.requireDefenseContext,"awk",t,r)}async function Pe(e,t){switch(Yr(e,"expression evaluation"),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return e1(t.pattern,e.line)?1:0;case"field":return B$(e,t);case"variable":return E0(e,t.name);case"array_access":return U$(e,t);case"binary":return z$(e,t);case"unary":return W$(e,t);case"ternary":return An(await it(e,"ternary condition evaluation",()=>Pe(e,t.condition)))?await it(e,"ternary consequent evaluation",()=>Pe(e,t.consequent)):await it(e,"ternary alternate evaluation",()=>Pe(e,t.alternate));case"call":return j$(e,t.name,t.args);case"assignment":return V$(e,t);case"pre_increment":return Z$(e,t.operand);case"pre_decrement":return X$(e,t.operand);case"post_increment":return Q$(e,t.operand);case"post_decrement":return K$(e,t.operand);case"in":return Y$(e,t.key,t.array);case"getline":return J$(e,t.variable,t.file,t.command);case"tuple":return rD(e,t.elements);default:return""}}async function B$(e,t){Yr(e,"field reference evaluation");let r=Math.floor(nr(await it(e,"field index evaluation",()=>Pe(e,t.index))));return y0(e,r)}async function U$(e,t){Yr(e,"array access evaluation");let r=vt(await it(e,"array key evaluation",()=>Pe(e,t.key)));return S0(e,t.array,r)}async function z$(e,t){Yr(e,"binary expression evaluation");let r=t.operator;if(r==="||")return An(await it(e,"logical-or left evaluation",()=>Pe(e,t.left)))||An(await it(e,"logical-or right evaluation",()=>Pe(e,t.right)))?1:0;if(r==="&&")return An(await it(e,"logical-and left evaluation",()=>Pe(e,t.left)))&&An(await it(e,"logical-and right evaluation",()=>Pe(e,t.right)))?1:0;if(r==="~"){let o=await it(e,"regex left evaluation",()=>Pe(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:vt(await it(e,"regex right evaluation",()=>Pe(e,t.right)));try{return Ie(l).test(vt(o))?1:0}catch{return 0}}if(r==="!~"){let o=await it(e,"negated-regex left evaluation",()=>Pe(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:vt(await it(e,"negated-regex right evaluation",()=>Pe(e,t.right)));try{return Ie(l).test(vt(o))?0:1}catch{return 1}}let n=await it(e,"binary left evaluation",()=>Pe(e,t.left)),i=await it(e,"binary right evaluation",()=>Pe(e,t.right));if(r===" "){let o=vt(n)+vt(i);if(e.maxOutputSize>0&&o.length>e.maxOutputSize)throw new T(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return o}if(q$(r))return H$(n,i,r);let a=nr(n),s=nr(i);return p$(a,s,r)}function q$(e){return["<","<=",">",">=","==","!="].includes(e)}function H$(e,t,r){let n=O6(e),i=O6(t);if(n&&i){let o=nr(e),l=nr(t);switch(r){case"<":return o":return o>l?1:0;case">=":return o>=l?1:0;case"==":return o===l?1:0;case"!=":return o!==l?1:0}}let a=vt(e),s=vt(t);switch(r){case"<":return a":return a>s?1:0;case">=":return a>=s?1:0;case"==":return a===s?1:0;case"!=":return a!==s?1:0}return 0}async function W$(e,t){Yr(e,"unary expression evaluation");let r=await it(e,"unary operand evaluation",()=>Pe(e,t.operand));switch(t.operator){case"!":return An(r)?0:1;case"-":return-nr(r);case"+":return+nr(r);default:return r}}async function j$(e,t,r){Yr(e,"function call evaluation");let n=l8.get(t);if(n)return n(r,e,{evalExpr:a=>Pe(e,a)});let i=e.functions.get(t);return i?G$(e,i,r):""}async function G$(e,t,r){if(Yr(e,"user function call"),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new T(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let n=Object.create(null);for(let o of t.params)n[o]=e.vars[o];let i=[];for(let o=0;oPe(e,u));e.vars[l]=c}else e.vars[l]=""}e.hasReturn=!1,e.returnValue=void 0;let a=A0;a&&await it(e,"user function body execution",()=>a(e,t.body.statements));let s=e.returnValue??"";for(let o of t.params)n[o]!==void 0?e.vars[o]=n[o]:delete e.vars[o];for(let o of i)e.arrayAliases.delete(o);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,s}async function V$(e,t){Yr(e,"assignment evaluation");let r=await it(e,"assignment value evaluation",()=>Pe(e,t.value)),n=t.target,i=t.operator,a;if(i==="=")a=r;else{let s;if(n.type==="field"){let u=Math.floor(nr(await it(e,"assignment field index",()=>Pe(e,n.index))));s=y0(e,u)}else if(n.type==="variable")s=E0(e,n.name);else{let u=vt(await it(e,"assignment array key",()=>Pe(e,n.key)));s=S0(e,n.array,u)}let o=nr(s),l=nr(r);switch(i){case"+=":a=o+l;break;case"-=":a=o-l;break;case"*=":a=o*l;break;case"/=":a=l!==0?o/l:0;break;case"%=":a=l!==0?o%l:0;break;case"^=":a=o**l;break;default:a=r}}if(n.type==="field"){let s=Math.floor(nr(await it(e,"assignment target field index",()=>Pe(e,n.index))));r8(e,s,a)}else if(n.type==="variable")Al(e,n.name,a);else{let s=vt(await it(e,"assignment target array key",()=>Pe(e,n.key)));c8(e,n.array,s,a)}return a}async function ip(e,t,r,n){Yr(e,"inc/dec evaluation");let i;if(t.type==="field"){let a=Math.floor(nr(await it(e,"inc/dec field index",()=>Pe(e,t.index))));i=nr(y0(e,a)),r8(e,a,i+r)}else if(t.type==="variable")i=nr(E0(e,t.name)),Al(e,t.name,i+r);else{let a=vt(await it(e,"inc/dec array key",()=>Pe(e,t.key)));i=nr(S0(e,t.array,a)),c8(e,t.array,a,i+r)}return n?i+r:i}async function Z$(e,t){return ip(e,t,1,!0)}async function X$(e,t){return ip(e,t,-1,!0)}async function Q$(e,t){return ip(e,t,1,!1)}async function K$(e,t){return ip(e,t,-1,!1)}async function Y$(e,t,r){Yr(e,"in-expression evaluation");let n;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let i=[];for(let a of t.elements)i.push(vt(await it(e,"tuple key element evaluation",()=>Pe(e,a))));n=i.join(e.SUBSEP)}else n=vt(await it(e,"in-expression key evaluation",()=>Pe(e,t)));return L$(e,r,n)?1:0}async function J$(e,t,r,n){if(Yr(e,"getline evaluation"),n)return eD(e,t,n);if(r)return tD(e,t,r);if(!e.lines||e.lineIndex===void 0)return-1;let i=e.lineIndex+1;if(i>=e.lines.length)return 0;let a=e.lines[i];return t?Al(e,t,a):tp(e,a),e.NR++,e.lineIndex=i,1}async function eD(e,t,r){let n=e.exec;if(!n)return-1;Yr(e,"getline command source");let i=vt(await it(e,"getline command expression",()=>Pe(e,r))),a=e.getlineCommandStreams.get(i);if(!a)try{let l=await it(e,"getline command exec",()=>n(i)),u=Ve(l.stdout).split(` `);u.length>0&&u[u.length-1]===""&&u.pop(),a={lines:u,index:-1},e.getlineCommandStreams.set(i,a)}catch(l){if(l instanceof He)throw l;return-1}let s=a.index+1;if(s>=a.lines.length)return 0;let o=a.lines[s];return a.index=s,t?Al(e,t,o):tp(e,o),1}async function tD(e,t,r){let n=e.fs;if(!n||!e.cwd)return-1;Yr(e,"getline file source");let i=vt(await it(e,"getline filename evaluation",()=>Pe(e,r)));if(i==="/dev/null")return 0;let a=n.resolvePath(e.cwd,i),s=e.getlineFileStreams.get(a);if(!s)try{let u=(await it(e,"getline file read",()=>n.readFile(a))).split(` `);u.length>0&&u[u.length-1]===""&&u.pop(),s={lines:u,index:-1},e.getlineFileStreams.set(a,s)}catch(u){if(u instanceof He)throw u;return-1}let o=s.index+1;if(o>=s.lines.length)return 0;let l=s.lines[o];return s.index=o,t?Al(e,t,l):tp(e,l),1}async function rD(e,t){if(Yr(e,"tuple evaluation"),t.length===0)return"";for(let r=0;rPe(e,t[r]));return it(e,"tuple final element",()=>Pe(e,t[t.length-1]))}var A0,f8=q(()=>{"use strict";ge(),J(),Dt(),Pi(),ln(),f$(),u8(),rp(),Sl(),p8(),A0=null});function C0(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new T(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}function Gn(e,t){Gr(e.requireDefenseContext,"awk",t)}function rt(e,t,r){return na(e.requireDefenseContext,"awk",t,r)}async function Jo(e,t){Gn(e,"block execution");for(let r of t)if(await rt(e,"statement execution",()=>Va(e,r)),nD(e))break}function nD(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Va(e,t){switch(Gn(e,"single statement execution"),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await rt(e,"nested block statement",()=>Jo(e,t.statements));break;case"expr_stmt":await rt(e,"expression statement",()=>Pe(e,t.expression));break;case"print":await rt(e,"print statement",()=>iD(e,t.args,t.output));break;case"printf":await rt(e,"printf statement",()=>aD(e,t.format,t.args,t.output));break;case"if":await rt(e,"if statement",()=>sD(e,t));break;case"while":await rt(e,"while statement",()=>oD(e,t));break;case"do_while":await rt(e,"do-while statement",()=>lD(e,t));break;case"for":await rt(e,"for statement",()=>uD(e,t));break;case"for_in":await rt(e,"for-in statement",()=>cD(e,t));break;case"break":e.loopBreak=!0;break;case"continue":e.loopContinue=!0;break;case"next":e.shouldNext=!0;break;case"nextfile":e.shouldNextFile=!0;break;case"exit":e.shouldExit=!0;{let r=t.code;e.exitCode=r?Math.floor(nr(await rt(e,"exit code expression",()=>Pe(e,r)))):0}break;case"return":e.hasReturn=!0;{let r=t.value;e.returnValue=r?await rt(e,"return expression",()=>Pe(e,r)):""}break;case"delete":await rt(e,"delete statement",()=>pD(e,t.target));break}}async function iD(e,t,r){Gn(e,"print execution");let n=[];for(let a of t){let s=await rt(e,"print argument evaluation",()=>Pe(e,a));typeof s=="number"?Number.isInteger(s)&&Math.abs(s)d8(e,r.redirect,r.file,i)):(e.output+=i,C0(e))}async function aD(e,t,r,n){Gn(e,"printf execution");let i=vt(await rt(e,"printf format evaluation",()=>Pe(e,t))),a=[];for(let l of r)a.push(await rt(e,"printf argument evaluation",()=>Pe(e,l)));let s=e.maxOutputSize>0?Math.max(0,e.maxOutputSize-K(e.output)):void 0,o=w0(i,a,s);n?await rt(e,"printf redirection write",()=>d8(e,n.redirect,n.file,o)):(e.output+=o,C0(e))}async function d8(e,t,r,n){Gn(e,"file write execution");let i=e.fs;if(!i||!e.cwd){e.output+=n,C0(e);return}let a=vt(await rt(e,"redirection filename evaluation",()=>Pe(e,r))),s=i.resolvePath(e.cwd,a);t===">"?e.openedFiles.has(s)?await rt(e,"redirection append write",()=>i.appendFile(s,n)):(await rt(e,"redirection overwrite write",()=>i.writeFile(s,n)),e.openedFiles.add(s)):(e.openedFiles.has(s)||e.openedFiles.add(s),await rt(e,"redirection append mode write",()=>i.appendFile(s,n)))}async function sD(e,t){if(Gn(e,"if execution"),An(await rt(e,"if condition evaluation",()=>Pe(e,t.condition))))await rt(e,"if consequent execution",()=>Va(e,t.consequent));else if(t.alternate){let r=t.alternate;await rt(e,"if alternate execution",()=>Va(e,r))}}async function oD(e,t){Gn(e,"while execution");let r=0;for(;An(await rt(e,"while condition evaluation",()=>Pe(e,t.condition)));){if(r++,r>e.maxIterations)throw new T(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await rt(e,"while body execution",()=>Va(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function lD(e,t){Gn(e,"do-while execution");let r=0;do{if(r++,r>e.maxIterations)throw new T(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await rt(e,"do-while body execution",()=>Va(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(An(await rt(e,"do-while condition evaluation",()=>Pe(e,t.condition))))}async function uD(e,t){Gn(e,"for execution");let r=t.init,n=t.condition,i=t.update;r&&await rt(e,"for init evaluation",()=>Pe(e,r));let a=0;for(;!n||An(await rt(e,"for condition evaluation",()=>Pe(e,n)));){if(a++,a>e.maxIterations)throw new T(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await rt(e,"for body execution",()=>Va(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;i&&await rt(e,"for update evaluation",()=>Pe(e,i))}}async function cD(e,t){Gn(e,"for-in execution");let r=e.arrays[t.array];if(r)for(let n of Object.keys(r)){if(e.vars[t.variable]=n,e.loopContinue=!1,await rt(e,"for-in body execution",()=>Va(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function pD(e,t){if(Gn(e,"delete execution"),t.type==="array_access"){let r=vt(await rt(e,"delete key evaluation",()=>Pe(e,t.key)));M$(e,t.array,r)}else t.type==="variable"&&P$(e,t.name)}var fD=q(()=>{"use strict";J(),Pi(),ir(),u8(),f8(),Sl(),p8(),F$(Jo)}),h8,dD=q(()=>{"use strict";J(),Pi(),f8(),rp(),fD(),Sl(),h8=class{ctx;program=null;rangeStates=[];constructor(e){this.ctx=e}assertDefenseContext(e){Gr(this.ctx.requireDefenseContext,"awk",e)}withDefenseContext(e,t){return na(this.ctx.requireDefenseContext,"awk",e,t)}execute(e){this.assertDefenseContext("program initialization"),this.program=e,this.ctx.output="";for(let t of e.functions)this.ctx.functions.set(t.name,t);this.rangeStates=e.rules.map(()=>!1)}async executeBegin(){if(this.assertDefenseContext("BEGIN execution entry"),!!this.program){for(let e of this.program.rules)if(e.pattern?.type==="begin"&&(await this.withDefenseContext("BEGIN block execution",()=>Jo(this.ctx,e.action.statements)),this.ctx.shouldExit))break}}async executeLine(e){if(this.assertDefenseContext("line execution entry"),!(!this.program||this.ctx.shouldExit)){if(this.ctx.recordsProcessed++,this.ctx.recordsProcessed>this.ctx.maxIterations)throw new T(`record limit exceeded (${this.ctx.maxIterations})`,"iterations");tp(this.ctx,e),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let t=0;tthis.matchesRule(r,t))&&await this.withDefenseContext("rule block execution",()=>Jo(this.ctx,r.action.statements))}}}async executeEnd(){if(this.assertDefenseContext("END execution entry"),!!this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let e of this.program.rules)if(e.pattern?.type==="end"&&(await this.withDefenseContext("END block execution",()=>Jo(this.ctx,e.action.statements)),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(e,t){this.assertDefenseContext("rule matching");let r=e.pattern;if(!r)return!0;switch(r.type){case"begin":case"end":return!1;case"regex_pattern":return e1(r.pattern,this.ctx.line);case"expr_pattern":return An(await this.withDefenseContext("expression pattern evaluation",()=>Pe(this.ctx,r.expression)));case"range":{let n=await this.withDefenseContext("range start pattern",()=>this.matchPattern(r.start)),i=await this.withDefenseContext("range end pattern",()=>this.matchPattern(r.end));return this.rangeStates[t]?(i&&(this.rangeStates[t]=!1),!0):n?(this.rangeStates[t]=!0,i&&(this.rangeStates[t]=!1),!0):!1}default:return!1}}async matchPattern(e){switch(this.assertDefenseContext("pattern matching"),e.type){case"regex_pattern":return e1(e.pattern,this.ctx.line);case"expr_pattern":return An(await this.withDefenseContext("nested expression pattern",()=>Pe(this.ctx,e.expression)));default:return!1}}}}),hD=q(()=>{"use strict";c$(),dD()});function mD(e){return e.replace(/\[\[:space:\]\]/g,"[ \\t\\n\\r\\f\\v]").replace(/\[\[:blank:\]\]/g,"[ \\t]").replace(/\[\[:alpha:\]\]/g,"[a-zA-Z]").replace(/\[\[:digit:\]\]/g,"[0-9]").replace(/\[\[:alnum:\]\]/g,"[a-zA-Z0-9]").replace(/\[\[:upper:\]\]/g,"[A-Z]").replace(/\[\[:lower:\]\]/g,"[a-z]").replace(/\[\[:punct:\]\]/g,"[!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~]").replace(/\[\[:xdigit:\]\]/g,"[0-9A-Fa-f]").replace(/\[\[:graph:\]\]/g,"[!-~]").replace(/\[\[:print:\]\]/g,"[ -~]").replace(/\[\[:cntrl:\]\]/g,"[\\x00-\\x1f\\x7f]")}var O,$6,D6,m8,gD=q(()=>{"use strict";J(),(function(e){e.NUMBER="NUMBER",e.STRING="STRING",e.REGEX="REGEX",e.IDENT="IDENT",e.BEGIN="BEGIN",e.END="END",e.IF="IF",e.ELSE="ELSE",e.WHILE="WHILE",e.DO="DO",e.FOR="FOR",e.IN="IN",e.BREAK="BREAK",e.CONTINUE="CONTINUE",e.NEXT="NEXT",e.NEXTFILE="NEXTFILE",e.EXIT="EXIT",e.RETURN="RETURN",e.DELETE="DELETE",e.FUNCTION="FUNCTION",e.PRINT="PRINT",e.PRINTF="PRINTF",e.GETLINE="GETLINE",e.PLUS="PLUS",e.MINUS="MINUS",e.STAR="STAR",e.SLASH="SLASH",e.PERCENT="PERCENT",e.CARET="CARET",e.EQ="EQ",e.NE="NE",e.LT="LT",e.GT="GT",e.LE="LE",e.GE="GE",e.MATCH="MATCH",e.NOT_MATCH="NOT_MATCH",e.AND="AND",e.OR="OR",e.NOT="NOT",e.ASSIGN="ASSIGN",e.PLUS_ASSIGN="PLUS_ASSIGN",e.MINUS_ASSIGN="MINUS_ASSIGN",e.STAR_ASSIGN="STAR_ASSIGN",e.SLASH_ASSIGN="SLASH_ASSIGN",e.PERCENT_ASSIGN="PERCENT_ASSIGN",e.CARET_ASSIGN="CARET_ASSIGN",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT",e.QUESTION="QUESTION",e.COLON="COLON",e.COMMA="COMMA",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.LBRACKET="LBRACKET",e.RBRACKET="RBRACKET",e.DOLLAR="DOLLAR",e.APPEND="APPEND",e.PIPE="PIPE",e.EOF="EOF"})(O||(O={})),$6=new Map([["BEGIN",O.BEGIN],["END",O.END],["if",O.IF],["else",O.ELSE],["while",O.WHILE],["do",O.DO],["for",O.FOR],["in",O.IN],["break",O.BREAK],["continue",O.CONTINUE],["next",O.NEXT],["nextfile",O.NEXTFILE],["exit",O.EXIT],["return",O.RETURN],["delete",O.DELETE],["function",O.FUNCTION],["print",O.PRINT],["printf",O.PRINTF],["getline",O.GETLINE]]),D6=new Set([O.COMMA,O.LBRACE,O.AND,O.OR,O.QUESTION,O.COLON,O.DO,O.ELSE,O.IF,O.WHILE]),m8=class{maxTokens;input;pos=0;line=1;column=1;lastTokenType=null;constructor(e,t=1e5){this.maxTokens=t,this.input=e}tokenize(){let e=[];for(;this.pos=this.maxTokens)throw new T(`awk: token limit exceeded (${this.maxTokens})`,"array_elements");e.push(t),this.lastTokenType=t.type}}if(e.length>=this.maxTokens)throw new T(`awk: token limit exceeded (${this.maxTokens})`,"array_elements");return e.push(this.makeToken(O.EOF,"")),e}makeToken(e,t){return{type:e,value:t,line:this.line,column:this.column}}peek(e=0){return this.input[this.pos+e]||""}advance(){let e=this.input[this.pos++]||"";return e===` `?(this.line++,this.column=1):this.column++,e}skipWhitespace(){for(;this.pos=this.input.length)return null;let e=this.line,t=this.column,r=this.peek();return r===` `?(this.advance(),{type:O.NEWLINE,value:` `,line:e,column:t}):r==='"'?this.readString():r==="/"&&this.canBeRegex()?this.readRegex():this.isDigit(r)||r==="."&&this.isDigit(this.peek(1))?this.readNumber():this.isAlpha(r)||r==="_"?this.readIdentifier():this.readOperator()}canBeRegex(){return new Set([null,O.NEWLINE,O.SEMICOLON,O.LBRACE,O.RBRACE,O.LPAREN,O.LBRACKET,O.COMMA,O.ASSIGN,O.PLUS_ASSIGN,O.MINUS_ASSIGN,O.STAR_ASSIGN,O.SLASH_ASSIGN,O.PERCENT_ASSIGN,O.CARET_ASSIGN,O.AND,O.OR,O.NOT,O.MATCH,O.NOT_MATCH,O.QUESTION,O.COLON,O.LT,O.GT,O.LE,O.GE,O.EQ,O.NE,O.PLUS,O.MINUS,O.STAR,O.PERCENT,O.CARET,O.PRINT,O.PRINTF,O.IF,O.WHILE,O.DO,O.FOR,O.RETURN]).has(this.lastTokenType)}readString(){let e=this.line,t=this.column;this.advance();let r="";for(;this.pos0?r+=String.fromCharCode(parseInt(i,16)):r+="x";break}default:if(/[0-7]/.test(n)){let i=n;for(;i.length<3&&/[0-7]/.test(this.peek());)i+=this.advance();r+=String.fromCharCode(parseInt(i,8))}else r+=n}}else r+=this.advance();return this.peek()==='"'&&this.advance(),{type:O.STRING,value:r,line:e,column:t}}readRegex(){let e=this.line,t=this.column;this.advance();let r="";for(;this.pos":return n==="="?(this.advance(),{type:O.GE,value:">=",line:e,column:t}):n===">"?(this.advance(),{type:O.APPEND,value:">>",line:e,column:t}):{type:O.GT,value:">",line:e,column:t};case"&":return n==="&"?(this.advance(),{type:O.AND,value:"&&",line:e,column:t}):{type:O.IDENT,value:"&",line:e,column:t};case"|":return n==="|"?(this.advance(),{type:O.OR,value:"||",line:e,column:t}):{type:O.PIPE,value:"|",line:e,column:t};case"~":return{type:O.MATCH,value:"~",line:e,column:t};case"?":return{type:O.QUESTION,value:"?",line:e,column:t};case":":return{type:O.COLON,value:":",line:e,column:t};case",":return{type:O.COMMA,value:",",line:e,column:t};case";":return{type:O.SEMICOLON,value:";",line:e,column:t};case"(":return{type:O.LPAREN,value:"(",line:e,column:t};case")":return{type:O.RPAREN,value:")",line:e,column:t};case"{":return{type:O.LBRACE,value:"{",line:e,column:t};case"}":return{type:O.RBRACE,value:"}",line:e,column:t};case"[":return{type:O.LBRACKET,value:"[",line:e,column:t};case"]":return{type:O.RBRACKET,value:"]",line:e,column:t};case"$":return{type:O.DOLLAR,value:"$",line:e,column:t};default:return{type:O.IDENT,value:r,line:e,column:t}}}isDigit(e){return e>="0"&&e<="9"}isAlpha(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}isAlphaNumeric(e){return this.isDigit(e)||this.isAlpha(e)}}});function xD(e){e.expect(ue.PRINT);let t=[];if(e.check(ue.NEWLINE)||e.check(ue.SEMICOLON)||e.check(ue.RBRACE)||e.check(ue.PIPE)||e.check(ue.GT)||e.check(ue.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(e.assertArrayLength(t.length),t.push(Nc(e));e.check(ue.COMMA);)e.advance(),e.assertArrayLength(t.length),t.push(Nc(e));let r;return e.check(ue.GT)?(e.advance(),r={redirect:">",file:e.parsePrimary()}):e.check(ue.APPEND)&&(e.advance(),r={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:r}}function Nc(e){return yD(e)?t1(e,!0):t1(e,!1)}function t1(e,t){let r=t?e.parseTernary():bD(e);if(e.match(ue.ASSIGN,ue.PLUS_ASSIGN,ue.MINUS_ASSIGN,ue.STAR_ASSIGN,ue.SLASH_ASSIGN,ue.PERCENT_ASSIGN,ue.CARET_ASSIGN)){let n=e.advance(),i=e.withDepth(()=>t1(e,t));if(r.type!=="variable"&&r.type!=="field"&&r.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:new Map([["=","="],["+=","+="],["-=","-="],["*=","*="],["/=","/="],["%=","%="],["^=","^="]]).get(n.value)??"=",target:r,value:i}}return r}function yD(e){let t=0,r=e.pos;for(;r=",">="],["==","=="],["!=","!="]]).get(r.value)??"==",left:t,right:n}}return t}function vD(e){return e.match(ue.NUMBER,ue.STRING,ue.IDENT,ue.DOLLAR,ue.LPAREN,ue.NOT,ue.MINUS,ue.PLUS,ue.INCREMENT,ue.DECREMENT)}function ED(e){return e.match(ue.AND,ue.OR,ue.QUESTION,ue.ASSIGN,ue.PLUS_ASSIGN,ue.MINUS_ASSIGN,ue.STAR_ASSIGN,ue.SLASH_ASSIGN,ue.PERCENT_ASSIGN,ue.CARET_ASSIGN,ue.COMMA,ue.SEMICOLON,ue.NEWLINE,ue.RBRACE,ue.RPAREN,ue.RBRACKET,ue.COLON,ue.PIPE,ue.APPEND,ue.GT,ue.IN)}function SD(e){e.expect(ue.PRINTF);let t=e.check(ue.LPAREN);t&&(e.advance(),e.skipNewlines());let r=t?e.parseExpression():Nc(e),n=[];for(;e.check(ue.COMMA);)e.advance(),t&&e.skipNewlines(),e.assertArrayLength(n.length),n.push(t?e.parseExpression():Nc(e));t&&(e.skipNewlines(),e.expect(ue.RPAREN));let i;return e.check(ue.GT)?(e.advance(),i={redirect:">",file:e.parsePrimary()}):e.check(ue.APPEND)&&(e.advance(),i={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:r,args:n,output:i}}var ue,AD=q(()=>{"use strict";ue={LPAREN:"LPAREN",RPAREN:"RPAREN",QUESTION:"QUESTION",NEWLINE:"NEWLINE",SEMICOLON:"SEMICOLON",RBRACE:"RBRACE",COMMA:"COMMA",PIPE:"PIPE",GT:"GT",APPEND:"APPEND",AND:"AND",OR:"OR",ASSIGN:"ASSIGN",PLUS_ASSIGN:"PLUS_ASSIGN",MINUS_ASSIGN:"MINUS_ASSIGN",STAR_ASSIGN:"STAR_ASSIGN",SLASH_ASSIGN:"SLASH_ASSIGN",PERCENT_ASSIGN:"PERCENT_ASSIGN",CARET_ASSIGN:"CARET_ASSIGN",RBRACKET:"RBRACKET",COLON:"COLON",IN:"IN",PRINT:"PRINT",PRINTF:"PRINTF",IDENT:"IDENT",LT:"LT",LE:"LE",GE:"GE",EQ:"EQ",NE:"NE",MATCH:"MATCH",NOT_MATCH:"NOT_MATCH",NUMBER:"NUMBER",STRING:"STRING",DOLLAR:"DOLLAR",NOT:"NOT",MINUS:"MINUS",PLUS:"PLUS",INCREMENT:"INCREMENT",DECREMENT:"DECREMENT"}}),g8,CD=q(()=>{"use strict";J(),gD(),AD(),g8=class{tokens=[];pos=0;depth=0;operations=0;limits;constructor(e={}){this.limits={maxSourceLength:e.maxSourceLength??10*1024*1024,maxTokens:e.maxTokens??1e5,maxDepth:e.maxDepth??100,maxOperations:e.maxOperations??1e5}}parse(e){if(e.length>this.limits.maxSourceLength)throw new T(`awk: source length limit exceeded (${this.limits.maxSourceLength})`,"string_length");let t=new m8(e,this.limits.maxTokens);this.tokens=t.tokenize(),this.pos=0,this.depth=0,this.operations=0;let r=0;for(let n of this.tokens)if(this.useOperation(),n.type===O.LPAREN||n.type===O.LBRACKET||n.type===O.LBRACE){if(r++,r>this.limits.maxDepth)throw new T(`awk: parser depth limit exceeded (${this.limits.maxDepth})`,"recursion")}else(n.type===O.RPAREN||n.type===O.RBRACKET||n.type===O.RBRACE)&&(r=Math.max(0,r-1));return this.parseProgram()}setPos(e){this.pos=e}current(){return this.tokens[this.pos]||{type:O.EOF,value:"",line:0,column:0}}advance(){this.useOperation();let e=this.current();return this.posthis.limits.maxOperations-this.operations)throw new T(`awk: parser operation limit exceeded (${this.limits.maxOperations})`,"iterations");this.operations+=e}withDepth(e){if(this.depth>=this.limits.maxDepth)throw new T(`awk: parser depth limit exceeded (${this.limits.maxDepth})`,"recursion");this.depth++;try{return e()}finally{this.depth--}}assertArrayLength(e){if(e>=this.limits.maxTokens)throw new T(`awk: AST array limit exceeded (${this.limits.maxTokens})`,"array_elements")}match(...e){return e.includes(this.current().type)}check(e){return this.current().type===e}expect(e,t){if(!this.check(e)){let r=this.current();throw new Error(t||`Expected ${e}, got ${r.type} at line ${r.line}:${r.column}`)}return this.advance()}skipNewlines(){for(;this.check(O.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(O.NEWLINE)||this.check(O.SEMICOLON);)this.advance()}parseProgram(){let e=[],t=[];for(this.skipNewlines();!this.check(O.EOF)&&(this.skipNewlines(),!this.check(O.EOF));)this.check(O.FUNCTION)?e.push(this.parseFunction()):t.push(this.parseRule()),this.skipTerminators();return{functions:e,rules:t}}parseFunction(){this.expect(O.FUNCTION);let e=this.expect(O.IDENT).value;this.expect(O.LPAREN);let t=[];if(!this.check(O.RPAREN))for(t.push(this.expect(O.IDENT).value);this.check(O.COMMA);)this.advance(),t.push(this.expect(O.IDENT).value);this.expect(O.RPAREN),this.skipNewlines();let r=this.parseBlock();return{name:e,params:t,body:r}}parseRule(){let e;if(this.check(O.BEGIN))this.advance(),e={type:"begin"};else if(this.check(O.END))this.advance(),e={type:"end"};else if(this.check(O.LBRACE))e=void 0;else if(this.check(O.REGEX)){let r=this.advance();if(this.check(O.AND)||this.check(O.OR)){let n={type:"binary",operator:"~",left:{type:"field",index:{type:"number",value:0}},right:{type:"regex",pattern:r.value}};e={type:"expr_pattern",expression:this.parseLogicalOrRest(n)}}else{let n={type:"regex_pattern",pattern:r.value};if(this.check(O.COMMA)){this.advance();let i;this.check(O.REGEX)?i={type:"regex_pattern",pattern:this.advance().value}:i={type:"expr_pattern",expression:this.parseExpression()},e={type:"range",start:n,end:i}}else e=n}}else{let r={type:"expr_pattern",expression:this.parseExpression()};if(this.check(O.COMMA)){this.advance();let n;this.check(O.REGEX)?n={type:"regex_pattern",pattern:this.advance().value}:n={type:"expr_pattern",expression:this.parseExpression()},e={type:"range",start:r,end:n}}else e=r}this.skipNewlines();let t;return this.check(O.LBRACE)?t=this.parseBlock():t={type:"block",statements:[{type:"print",args:[{type:"field",index:{type:"number",value:0}}]}]},{pattern:e,action:t}}parseBlock(){this.expect(O.LBRACE),this.skipNewlines();let e=[];for(;!this.check(O.RBRACE)&&!this.check(O.EOF);)e.push(this.parseStatement()),this.skipTerminators();return this.expect(O.RBRACE),{type:"block",statements:e}}parseStatement(){return this.withDepth(()=>this.parseStatementAtDepth())}parseStatementAtDepth(){if(this.check(O.SEMICOLON)||this.check(O.NEWLINE))return this.advance(),{type:"block",statements:[]};if(this.check(O.LBRACE))return this.parseBlock();if(this.check(O.IF))return this.parseIf();if(this.check(O.WHILE))return this.parseWhile();if(this.check(O.DO))return this.parseDoWhile();if(this.check(O.FOR))return this.parseFor();if(this.check(O.BREAK))return this.advance(),{type:"break"};if(this.check(O.CONTINUE))return this.advance(),{type:"continue"};if(this.check(O.NEXT))return this.advance(),{type:"next"};if(this.check(O.NEXTFILE))return this.advance(),{type:"nextfile"};if(this.check(O.EXIT)){this.advance();let e;return!this.check(O.NEWLINE)&&!this.check(O.SEMICOLON)&&!this.check(O.RBRACE)&&!this.check(O.EOF)&&(e=this.parseExpression()),{type:"exit",code:e}}if(this.check(O.RETURN)){this.advance();let e;return!this.check(O.NEWLINE)&&!this.check(O.SEMICOLON)&&!this.check(O.RBRACE)&&!this.check(O.EOF)&&(e=this.parseExpression()),{type:"return",value:e}}if(this.check(O.DELETE)){this.advance();let e=this.parsePrimary();if(e.type!=="array_access"&&e.type!=="variable")throw new Error("delete requires array element or array");return{type:"delete",target:e}}return this.check(O.PRINT)?xD(this):this.check(O.PRINTF)?SD(this):{type:"expr_stmt",expression:this.parseExpression()}}parseIf(){this.expect(O.IF),this.expect(O.LPAREN);let e=this.parseExpression();this.expect(O.RPAREN),this.skipNewlines();let t=this.parseStatement();this.skipTerminators();let r;return this.check(O.ELSE)&&(this.advance(),this.skipNewlines(),r=this.parseStatement()),{type:"if",condition:e,consequent:t,alternate:r}}parseWhile(){this.expect(O.WHILE),this.expect(O.LPAREN);let e=this.parseExpression();this.expect(O.RPAREN),this.skipNewlines();let t=this.parseStatement();return{type:"while",condition:e,body:t}}parseDoWhile(){this.expect(O.DO),this.skipNewlines();let e=this.parseStatement();this.skipNewlines(),this.expect(O.WHILE),this.expect(O.LPAREN);let t=this.parseExpression();return this.expect(O.RPAREN),{type:"do_while",body:e,condition:t}}parseFor(){if(this.expect(O.FOR),this.expect(O.LPAREN),this.check(O.IDENT)){let i=this.advance();if(this.check(O.IN)){this.advance();let a=this.expect(O.IDENT).value;this.expect(O.RPAREN),this.skipNewlines();let s=this.parseStatement();return{type:"for_in",variable:i.value,array:a,body:s}}this.pos--}let e;this.check(O.SEMICOLON)||(e=this.parseExpression()),this.expect(O.SEMICOLON);let t;this.check(O.SEMICOLON)||(t=this.parseExpression()),this.expect(O.SEMICOLON);let r;this.check(O.RPAREN)||(r=this.parseExpression()),this.expect(O.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:"for",init:e,condition:t,update:r,body:n}}parseExpression(){return this.withDepth(()=>this.parseAssignment())}parseAssignment(){let e=this.parseTernary();if(this.match(O.ASSIGN,O.PLUS_ASSIGN,O.MINUS_ASSIGN,O.STAR_ASSIGN,O.SLASH_ASSIGN,O.PERCENT_ASSIGN,O.CARET_ASSIGN)){let t=this.advance(),r=this.parseExpression();if(e.type!=="variable"&&e.type!=="field"&&e.type!=="array_access")throw new Error("Invalid assignment target");let n=new Set(["=","+=","-=","*=","/=","%=","^="]),i=t.value;if(!n.has(i))throw new Error(`Unknown assignment operator: ${i}`);return{type:"assignment",operator:i,target:e,value:r}}return e}parseTernary(){let e=this.parsePipeGetline();if(this.check(O.QUESTION)){this.advance();let t=this.parseExpression();this.expect(O.COLON);let r=this.parseExpression();e={type:"ternary",condition:e,consequent:t,alternate:r}}return e}parsePipeGetline(){let e=this.parseOr();if(this.check(O.PIPE)){if(this.advance(),!this.check(O.GETLINE))throw new Error("Expected 'getline' after '|' in expression context");this.advance();let t;return this.check(O.IDENT)&&(t=this.advance().value),{type:"getline",command:e,variable:t}}return e}parseOr(){let e=this.parseAnd();for(;this.check(O.OR);){this.advance();let t=this.parseAnd();e={type:"binary",operator:"||",left:e,right:t}}return e}parseLogicalOrRest(e){for(e=this.parseLogicalAndRest(e);this.check(O.OR);){this.advance();let t=this.parseAnd();e={type:"binary",operator:"||",left:e,right:t}}return e}parseLogicalAndRest(e){for(;this.check(O.AND);){this.advance();let t=this.parseIn();e={type:"binary",operator:"&&",left:e,right:t}}return e}parseAnd(){let e=this.parseIn();for(;this.check(O.AND);){this.advance();let t=this.parseIn();e={type:"binary",operator:"&&",left:e,right:t}}return e}parseIn(){let e=this.parseConcatenation();if(this.check(O.IN)){this.advance();let t=this.expect(O.IDENT).value;return{type:"in",key:e,array:t}}return e}parseConcatenation(){let e=this.parseMatch();for(;this.canStartExpression()&&!this.isConcatTerminator();){let t=this.parseMatch();e={type:"binary",operator:" ",left:e,right:t}}return e}parseMatch(){let e=this.parseComparison();for(;this.match(O.MATCH,O.NOT_MATCH);){let t=this.advance().type===O.MATCH?"~":"!~",r=this.parseComparison();e={type:"binary",operator:t,left:e,right:r}}return e}parseComparison(){let e=this.parseAddSub();for(;this.match(O.LT,O.LE,O.GT,O.GE,O.EQ,O.NE);){let t=this.advance(),r=this.parseAddSub();e={type:"binary",operator:new Map([["<","<"],["<=","<="],[">",">"],[">=",">="],["==","=="],["!=","!="]]).get(t.value)??"==",left:e,right:r}}return e}canStartExpression(){return this.match(O.NUMBER,O.STRING,O.IDENT,O.DOLLAR,O.LPAREN,O.NOT,O.MINUS,O.PLUS,O.INCREMENT,O.DECREMENT)}isConcatTerminator(){return this.match(O.AND,O.OR,O.QUESTION,O.ASSIGN,O.PLUS_ASSIGN,O.MINUS_ASSIGN,O.STAR_ASSIGN,O.SLASH_ASSIGN,O.PERCENT_ASSIGN,O.CARET_ASSIGN,O.COMMA,O.SEMICOLON,O.NEWLINE,O.RBRACE,O.RPAREN,O.RBRACKET,O.COLON,O.PIPE,O.APPEND,O.IN)}parseAddSub(){let e=this.parseMulDiv();for(;this.match(O.PLUS,O.MINUS);){let t=this.advance().value,r=this.parseMulDiv();e={type:"binary",operator:t,left:e,right:r}}return e}parseMulDiv(){let e=this.parseUnary();for(;this.match(O.STAR,O.SLASH,O.PERCENT);){let t=this.advance(),r=this.parseUnary();e={type:"binary",operator:new Map([["*","*"],["/","/"],["%","%"]]).get(t.value)??"*",left:e,right:r}}return e}parseUnary(){if(this.check(O.INCREMENT)){this.advance();let e=this.withDepth(()=>this.parseUnary());return e.type!=="variable"&&e.type!=="field"&&e.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:e}}:{type:"pre_increment",operand:e}}if(this.check(O.DECREMENT)){this.advance();let e=this.withDepth(()=>this.parseUnary());return e.type!=="variable"&&e.type!=="field"&&e.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:e}}:{type:"pre_decrement",operand:e}}if(this.match(O.NOT,O.MINUS,O.PLUS)){let e=this.advance().value,t=this.withDepth(()=>this.parseUnary());return{type:"unary",operator:e,operand:t}}return this.parsePower()}parsePower(){let e=this.parsePostfix();if(this.check(O.CARET)){this.advance();let t=this.withDepth(()=>this.parsePower());e={type:"binary",operator:"^",left:e,right:t}}return e}parsePostfix(){let e=this.parsePrimary();if(this.check(O.INCREMENT)){if(this.advance(),e.type!=="variable"&&e.type!=="field"&&e.type!=="array_access")throw new Error("Invalid increment operand");return{type:"post_increment",operand:e}}if(this.check(O.DECREMENT)){if(this.advance(),e.type!=="variable"&&e.type!=="field"&&e.type!=="array_access")throw new Error("Invalid decrement operand");return{type:"post_decrement",operand:e}}return e}parseFieldIndex(){if(this.check(O.INCREMENT)){this.advance();let e=this.withDepth(()=>this.parseFieldIndex());return e.type!=="variable"&&e.type!=="field"&&e.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:e}}:{type:"pre_increment",operand:e}}if(this.check(O.DECREMENT)){this.advance();let e=this.withDepth(()=>this.parseFieldIndex());return e.type!=="variable"&&e.type!=="field"&&e.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:e}}:{type:"pre_decrement",operand:e}}if(this.match(O.NOT,O.MINUS,O.PLUS)){let e=this.advance().value,t=this.withDepth(()=>this.parseFieldIndex());return{type:"unary",operator:e,operand:t}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let e=this.parseFieldIndexPrimary();if(this.check(O.CARET)){this.advance();let t=this.withDepth(()=>this.parseFieldIndexPower());e={type:"binary",operator:"^",left:e,right:t}}return e}parseFieldIndexPrimary(){if(this.check(O.NUMBER))return{type:"number",value:this.advance().value};if(this.check(O.STRING))return{type:"string",value:this.advance().value};if(this.check(O.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(O.LPAREN)){this.advance();let e=this.parseExpression();return this.expect(O.RPAREN),e}if(this.check(O.IDENT)){let e=this.advance().value;if(this.check(O.LPAREN)){this.advance();let t=[];if(!this.check(O.RPAREN))for(t.push(this.parseExpression());this.check(O.COMMA);)this.advance(),t.push(this.parseExpression());return this.expect(O.RPAREN),{type:"call",name:e,args:t}}if(this.check(O.LBRACKET)){this.advance();let t=this.parseExpression();if(this.check(O.COMMA)){let r=[t];for(;this.check(O.COMMA);)this.advance(),r.push(this.parseExpression());this.expect(O.RBRACKET);let n=r.reduce((i,a)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:i,right:{type:"variable",name:"SUBSEP"}},right:a}));return{type:"array_access",array:e,key:n}}return this.expect(O.RBRACKET),{type:"array_access",array:e,key:t}}return{type:"variable",name:e}}throw new Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(O.NUMBER))return{type:"number",value:this.advance().value};if(this.check(O.STRING))return{type:"string",value:this.advance().value};if(this.check(O.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(O.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(O.LPAREN)){this.advance();let e=this.parseExpression();if(this.check(O.COMMA)){let t=[e];for(;this.check(O.COMMA);)this.advance(),t.push(this.parseExpression());return this.expect(O.RPAREN),{type:"tuple",elements:t}}return this.expect(O.RPAREN),e}if(this.check(O.GETLINE)){this.advance();let e,t;return this.check(O.IDENT)&&(e=this.advance().value),this.check(O.LT)&&(this.advance(),t=this.parsePrimary()),{type:"getline",variable:e,file:t}}if(this.check(O.IDENT)){let e=this.advance().value;if(this.check(O.LPAREN)){this.advance();let t=[];if(this.skipNewlines(),!this.check(O.RPAREN))for(t.push(this.parseExpression());this.check(O.COMMA);)this.advance(),this.skipNewlines(),t.push(this.parseExpression());return this.skipNewlines(),this.expect(O.RPAREN),{type:"call",name:e,args:t}}if(this.check(O.LBRACKET)){this.advance();let t=[this.parseExpression()];for(;this.check(O.COMMA);)this.advance(),t.push(this.parseExpression());this.expect(O.RBRACKET);let r;if(t.length===1)r=t[0];else{r=t[0];for(let n=1;ny8,flagsForFuzzing:()=>b8});function Vd(e){return e.replace(/\\t/g," ").replace(/\\n/g,` `).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function F6(e){if(e===" ")return Ie("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return Ie(e)}catch{return Ie(B6(e))}return Ie(B6(e))}function B6(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var U6,y8,b8,kD=q(()=>{"use strict";ge(),Ar(),ia(),J(),Dt(),Pi(),ln(),be(),ir(),hD(),CD(),U6={name:"awk",summary:"pattern scanning and text processing language",usage:"awk [OPTIONS] 'PROGRAM' [FILE...]",options:["-F FS use FS as field separator","-v VAR=VAL assign VAL to variable VAR"," --help display this help and exit"]},y8={name:"awk",async execute(e,t){Gr(t.requireDefenseContext,"awk","execution entry");let r=(x,y)=>na(t.requireDefenseContext,"awk",x,y);if(Ce(e))return we(U6);let n=new Jc(/\s+/),i=" ",a=Object.create(null),s=0;for(let x=0;x0){let w=b.slice(0,k),v=Vd(b.slice(k+1));a[w]=v}s=x+1}else{if(y.startsWith("--"))return Le("awk",y);if(y.startsWith("-")&&y.length>1){let b=y[1];if(b!=="F"&&b!=="v")return Le("awk",`-${b}`);s=x+1}else if(!y.startsWith("-")){s=x;break}}}if(s>=e.length)return{stdout:"",stderr:`awk: missing program `,exitCode:1};let o=e[s],l=e.slice(s+1),u=new g8({maxSourceLength:t.limits.maxStringLength,maxTokens:t.limits.maxAwkParserTokens,maxDepth:t.limits.maxAwkParserDepth,maxOperations:t.limits.maxAwkParserOperations}),c;try{c=u.parse(o)}catch(x){return Ge(x),{stdout:"",stderr:`awk: ${x instanceof Error?x.message:String(x)} `,exitCode:1}}let p={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(x,y)=>{try{let b=await r("appendFile read",()=>t.fs.readFile(x));await r("appendFile write",()=>t.fs.writeFile(x,b+y))}catch(b){if(b instanceof He)throw b;await r("appendFile create",()=>t.fs.writeFile(x,y))}},resolvePath:t.fs.resolvePath.bind(t.fs)},d=t.exec,f=u$({fieldSep:n,maxIterations:t.limits.maxAwkIterations,maxOutputSize:Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),maxArrayElements:t.limits.maxArrayElements,fs:p,cwd:t.cwd,exec:d?x=>r("command pipe exec",()=>d(x,{cwd:t.cwd,signal:t.signal})):void 0,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext});f.FS=i,f.vars=Object.assign(Object.create(null),a),f.ARGC=l.length+1,f.ARGV=Object.create(null),f.ARGV[0]="awk";for(let x=0;xx.pattern?.type!=="begin"&&x.pattern?.type!=="end"),g=c.rules.some(x=>x.pattern?.type==="end");try{if(await r("BEGIN execution",()=>h.executeBegin()),f.shouldExit)return await r("END execution after BEGIN exit",()=>h.executeEnd()),{stdout:h.getOutput(),stderr:"",exitCode:h.getExitCode()};if(!m&&!g)return{stdout:h.getOutput(),stderr:"",exitCode:h.getExitCode()};let x=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),y=t.limits.maxArrayElements,b=0,k=async(w,v)=>{let A=K(v);if(A>x-b)throw new T(`aggregate input size limit exceeded (${x} bytes)`,"string_length");b+=A;let R=v.length>0?1:0;for(let $=0;$y+1)throw new T(`record array limit exceeded (${y})`,"array_elements");let I=v.split(` `);if(I.length>0&&I[I.length-1]===""&&I.pop(),I.length>y)throw new T(`record array limit exceeded (${y})`,"array_elements");for(f.FILENAME=w,f.FNR=0,f.lines=I,f.lineIndex=-1,f.shouldNextFile=!1;f.lineIndexh.executeLine(I[$])),f.shouldExit||f.shouldNextFile)break}};if(l.length>0)for(let w of l){let v;try{let A=t.fs.resolvePath(t.cwd,w);if((await r("input file stat",()=>t.fs.stat(A))).size>x-b)throw new T(`aggregate input size limit exceeded (${x} bytes)`,"string_length");v=await r("input file read",()=>t.fs.readFile(A))}catch(A){if(A instanceof He||A instanceof T)throw A;return{stdout:"",stderr:`awk: ${w}: No such file or directory `,exitCode:1}}if(await r("input processing",()=>k(w,v)),f.shouldExit)break}else await r("stdin processing",()=>k("",Ve(t.stdin)));return await r("END execution",()=>h.executeEnd()),{stdout:h.getOutput(),stderr:"",exitCode:h.getExitCode()}}catch(x){if(x instanceof He)throw x;let y=x instanceof Error?x.message:String(x),b=x instanceof T?T.EXIT_CODE:2;return{stdout:h.getOutput(),stderr:`awk: ${y} `,exitCode:b}}}},b8={name:"awk",flags:[{flag:"-F",type:"value",valueHint:"delimiter"},{flag:"-v",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0}});function z6(e){let t=e.trim(),r=t.match(/^([+-]?\d*\.?\d+)\s*([kmgtpeKMGTPE])?[iI]?[bB]?$/);if(!r){let s=parseFloat(t);return Number.isNaN(s)?0:s}let n=parseFloat(r[1]),i=(r[2]||"").toLowerCase(),a=w8.get(i)??1;return n*a}function q6(e){let t=e.trim().toLowerCase().slice(0,3);return v8.get(t)??0}function ND(e,t){let r=e.split(/(\d+)/),n=t.split(/(\d+)/),i=Math.max(r.length,n.length);for(let a=0;a=i.length)return"";if(t.endField===void 0){let l=i[a]||"";return t.startChar!==void 0&&(l=l.slice(t.startChar-1)),t.ignoreLeading&&(l=l.trimStart()),l}let s=Math.min(t.endField-1,i.length-1),o="";for(let l=a;l<=s&&la&&(o+=r||" "),o+=u}return t.ignoreLeading&&(o=o.trimStart()),o}function W6(e,t,r){let n=e,i=t;if(r.dictionaryOrder&&(n=H6(n),i=H6(i)),r.ignoreCase&&(n=n.toLowerCase(),i=i.toLowerCase()),r.monthSort){let a=q6(n),s=q6(i);return a-s}if(r.humanNumeric){let a=z6(n),s=z6(i);return a-s}if(r.versionSort)return ND(n,i);if(r.numeric){let a=parseFloat(n)||0,s=parseFloat(i)||0;return a-s}return n.localeCompare(i)}function TD(e){let{keys:t,fieldDelimiter:r,numeric:n,ignoreCase:i,reverse:a,humanNumeric:s,versionSort:o,dictionaryOrder:l,monthSort:u,ignoreLeadingBlanks:c,stable:p}=e;return(d,f)=>{let h=d,m=f;if(c&&(h=h.trimStart(),m=m.trimStart()),t.length===0){let g=W6(h,m,{numeric:n,ignoreCase:i,humanNumeric:s,versionSort:o,dictionaryOrder:l,monthSort:u});if(g!==0)return a?-g:g;if(!p){let x=d.localeCompare(f);return a?-x:x}return 0}for(let g of t){let x=r1(h,g,r),y=r1(m,g,r);g.ignoreLeading&&(x=x.trimStart(),y=y.trimStart());let b={numeric:g.numeric??n,ignoreCase:g.ignoreCase??i,humanNumeric:g.humanNumeric??s,versionSort:g.versionSort??o,dictionaryOrder:g.dictionaryOrder??l,monthSort:g.monthSort??u},k=g.reverse??a,w=W6(x,y,b);if(w!==0)return k?-w:w}if(!p){let g=d.localeCompare(f);return a?-g:g}return 0}}function _D(e,t){if(t.keys.length===0){if(t.ignoreCase){let i=new Set;return e.filter(a=>{let s=a.toLowerCase();return i.has(s)?!1:(i.add(s),!0)})}return[...new Set(e)]}let r=t.keys[0],n=new Set;return e.filter(i=>{let a=r1(i,r,t.fieldDelimiter);return(r.ignoreCase??t.ignoreCase)&&(a=a.toLowerCase()),n.has(a)?!1:(n.add(a),!0)})}var w8,v8,OD=q(()=>{"use strict";w8=new Map([["",1],["k",1024],["m",1048576],["g",1073741824],["t",1099511627776],["p",0x4000000000000],["e",1152921504606847e3]]),v8=new Map([["jan",1],["feb",2],["mar",3],["apr",4],["may",5],["jun",6],["jul",7],["aug",8],["sep",9],["oct",10],["nov",11],["dec",12]])});function Zd(e){let t={startField:1},r="",n=e,i=n.match(/([bdfhMnrV]+)$/);i&&(r=i[1],n=n.slice(0,-r.length)),r.includes("n")&&(t.numeric=!0),r.includes("r")&&(t.reverse=!0),r.includes("f")&&(t.ignoreCase=!0),r.includes("b")&&(t.ignoreLeading=!0),r.includes("h")&&(t.humanNumeric=!0),r.includes("V")&&(t.versionSort=!0),r.includes("d")&&(t.dictionaryOrder=!0),r.includes("M")&&(t.monthSort=!0);let a=n.split(",");if(a.length===0||a[0]==="")return null;let s=a[0].split("."),o=parseInt(s[0],10);if(Number.isNaN(o)||o<1)return null;if(t.startField=o,s.length>1&&s[1]){let l=parseInt(s[1],10);!Number.isNaN(l)&&l>=1&&(t.startChar=l)}if(a.length>1&&a[1]){let l=a[1],u=l.match(/([bdfhMnrV]+)$/);if(u){let p=u[1];p.includes("n")&&(t.numeric=!0),p.includes("r")&&(t.reverse=!0),p.includes("f")&&(t.ignoreCase=!0),p.includes("b")&&(t.ignoreLeading=!0),p.includes("h")&&(t.humanNumeric=!0),p.includes("V")&&(t.versionSort=!0),p.includes("d")&&(t.dictionaryOrder=!0),p.includes("M")&&(t.monthSort=!0),l=l.slice(0,-p.length)}let c=l.split(".");if(c[0]){let p=parseInt(c[0],10);if(!Number.isNaN(p)&&p>=1&&(t.endField=p),c.length>1&&c[1]){let d=parseInt(c[1],10);!Number.isNaN(d)&&d>=1&&(t.endChar=d)}}}return t}var ID=q(()=>{"use strict"}),E8={};ce(E8,{flagsForFuzzing:()=>A8,sortCommand:()=>S8});var j6,S8,A8,$D=q(()=>{"use strict";ge(),Ja(),be(),OD(),ID(),j6={name:"sort",summary:"sort lines of text files",usage:"sort [OPTION]... [FILE]...",options:["-b, --ignore-leading-blanks ignore leading blanks","-d, --dictionary-order consider only blanks and alphanumeric characters","-f, --ignore-case fold lower case to upper case characters","-h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G)","-M, --month-sort compare (unknown) < 'JAN' < ... < 'DEC'","-n, --numeric-sort compare according to string numerical value","-r, --reverse reverse the result of comparisons","-V, --version-sort natural sort of (version) numbers within text","-c, --check check for sorted input; do not sort","-o, --output=FILE write result to FILE instead of stdout","-s, --stable stabilize sort by disabling last-resort comparison","-u, --unique output only unique lines","-k, --key=KEYDEF sort via a key; KEYDEF gives location and type","-t, --field-separator=SEP use SEP as field separator"," --help display this help and exit"],description:`KEYDEF is F[.C][OPTS][,F[.C][OPTS]] F is a field number (1-indexed) C is a character position within the field (1-indexed) OPTS can be: b d f h M n r V (per-key modifiers) Examples: -k1 sort by first field -k2,2 sort by second field only -k1.3 sort by first field starting at 3rd character -k1,2n sort by fields 1-2 numerically -k2 -k1 sort by field 2, then by field 1`},S8={name:"sort",async execute(e,t){if(Ce(e))return we(j6);let r={reverse:!1,numeric:!1,unique:!1,ignoreCase:!1,humanNumeric:!1,versionSort:!1,dictionaryOrder:!1,monthSort:!1,ignoreLeadingBlanks:!1,stable:!1,checkOnly:!1,outputFile:null,keys:[],fieldDelimiter:null},n=[];for(let l=0;l0&&a[a.length-1]===""&&a.pop();let s=TD(r);if(r.checkOnly){let l=n.length>0?n[0]:"-";for(let u=1;u0)return{stdout:"",stderr:`sort: ${l}:${u+1}: disorder: ${a[u]} `,exitCode:1};return{stdout:"",stderr:"",exitCode:0}}a.sort(s),r.unique&&(a=_D(a,r));let o=a.length>0?`${a.join(` `)} `:"";if(r.outputFile){let l=t.fs.resolvePath(t.cwd,r.outputFile);return await t.fs.writeFile(l,o),{stdout:"",stderr:"",exitCode:0}}return{stdout:o,stderr:"",exitCode:0}}},A8={name:"sort",flags:[{flag:"-r",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-V",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-M",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-k",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"delimiter"},{flag:"-o",type:"value",valueHint:"path"}],stdinType:"text",needsFiles:!0}}),C8={};ce(C8,{flagsForFuzzing:()=>N8,uniqCommand:()=>k8});var G6,V6,k8,N8,DD=q(()=>{"use strict";ge(),sr(),Ja(),be(),G6={name:"uniq",summary:"report or omit repeated lines",usage:"uniq [OPTION]... [INPUT [OUTPUT]]",options:["-c, --count prefix lines by the number of occurrences","-d, --repeated only print duplicate lines","-i, --ignore-case ignore case when comparing","-u, --unique only print unique lines"," --help display this help and exit"]},V6={count:{short:"c",long:"count",type:"boolean"},duplicatesOnly:{short:"d",long:"repeated",type:"boolean"},uniqueOnly:{short:"u",long:"unique",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},k8={name:"uniq",async execute(e,t){if(Ce(e))return we(G6);let r=ar("uniq",e,V6);if(!r.ok)return r.error;let{count:n,duplicatesOnly:i,uniqueOnly:a,ignoreCase:s}=r.result.flags,o=r.result.positional,l=await f0(t,o,{cmdName:"uniq"});if(!l.ok)return l.error;let u=(s?Ve(l.content):l.content).split(` `);if(u.length>0&&u[u.length-1]===""&&u.pop(),u.length===0)return{stdout:"",stderr:"",exitCode:0};let c=[],p=u[0],d=1,f=(g,x)=>s?g.toLowerCase()===x.toLowerCase():g===x;for(let g=1;gg.count>1):a&&(h=c.filter(g=>g.count===1));let m="";for(let{line:g,count:x}of h)n?m+=`${String(x).padStart(4)} ${g} `:m+=`${g} `;return s?{stdout:m,stderr:"",exitCode:0}:{stdout:m,stderr:"",exitCode:0,stdoutKind:"bytes",stdoutEncoding:"binary"}}},N8={name:"uniq",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0}}),T8={};ce(T8,{commCommand:()=>_8,flagsForFuzzing:()=>O8});var Z6,_8,O8,RD=q(()=>{"use strict";ge(),be(),Z6={name:"comm",summary:"compare two sorted files line by line",usage:"comm [OPTION]... FILE1 FILE2",options:["-1 suppress column 1 (lines unique to FILE1)","-2 suppress column 2 (lines unique to FILE2)","-3 suppress column 3 (lines that appear in both files)"," --help display this help and exit"]},_8={name:"comm",async execute(e,t){if(Ce(e))return we(Z6);let r=!1,n=!1,i=!1,a=[];for(let g of e)if(g==="-1")r=!0;else if(g==="-2")n=!0;else if(g==="-3")i=!0;else if(g==="-12"||g==="-21")r=!0,n=!0;else if(g==="-13"||g==="-31")r=!0,i=!0;else if(g==="-23"||g==="-32")n=!0,i=!0;else if(g==="-123"||g==="-132"||g==="-213"||g==="-231"||g==="-312"||g==="-321")r=!0,n=!0,i=!0;else{if(g.startsWith("-")&&g!=="-")return Le("comm",g);a.push(g)}if(a.length!==2)return{stdout:"",stderr:`comm: missing operand Try 'comm --help' for more information. `,exitCode:1};let s=async g=>{if(g==="-")return Ve(t.stdin);try{let x=t.fs.resolvePath(t.cwd,g);return await t.fs.readFile(x)}catch{return null}},o=await s(a[0]);if(o===null)return{stdout:"",stderr:`comm: ${a[0]}: No such file or directory `,exitCode:1};let l=await s(a[1]);if(l===null)return{stdout:"",stderr:`comm: ${a[1]}: No such file or directory `,exitCode:1};let u=o.split(` `),c=l.split(` `);u.length>0&&u[u.length-1]===""&&u.pop(),c.length>0&&c[c.length-1]===""&&c.pop();let p=0,d=0,f="",h=r?"":" ",m=(r?"":" ")+(n?"":" ");for(;p=u.length?(n||(f+=`${h}${c[d]} `),d++):d>=c.length?(r||(f+=`${u[p]} `),p++):u[p]c[d]?(n||(f+=`${h}${c[d]} `),d++):(i||(f+=`${m}${u[p]} `),p++,d++);return{stdout:f,stderr:"",exitCode:0}}},O8={name:"comm",flags:[{flag:"-1",type:"boolean"},{flag:"-2",type:"boolean"},{flag:"-3",type:"boolean"}],needsArgs:!0,minArgs:2}}),I8={};ce(I8,{cutCommand:()=>$8,flagsForFuzzing:()=>D8});function LD(e,t){let r=[],n=e.split(",");if(n.length>t)throw new T(`cut: range count limit exceeded (${t})`,"array_elements");for(let i of n)if(i.includes("-")){let[a,s]=i.split("-"),o=a?Number(a):1,l=s?Number(s):null;if(!Number.isSafeInteger(o)||o<1||l!==null&&(!Number.isSafeInteger(l)||l=0&&!n.has(o)&&(n.add(o),r.push(e[o]))}return r}var X6,$8,D8,PD=q(()=>{"use strict";Yt(),ge(),J(),Ja(),be(),X6={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]},$8={name:"cut",async execute(e,t){if(Ce(e))return we(X6);let r=" ",n=null,i=null,a=!1,s=[];for(let f=0;f0&&l[l.length-1]===""&&l.pop();let u=LD(n||i||"1",t.limits.maxArrayElements),c=new St(Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),"cut"),p=0,d=f=>{if(!Number.isSafeInteger(f)||f<0||f>t.limits.maxLoopIterations-p)throw new T(`cut: range expansion limit exceeded (${t.limits.maxLoopIterations})`,"iterations");p+=f,t.executionScope?.consumeWork(f,"cut range expansion")};for(let f of l)if(i){let h=Array.from(f),m=[];for(let g of u){let x=g.start-1,y=g.end===null?h.length:g.end;d(Math.max(0,Math.min(y,h.length)-x));for(let b=x;b=0&&m.push(h[b])}c.append(`${m.join("")} `)}else{if(a&&!f.includes(r))continue;let h=f.split(r);for(let g of u){let x=g.start-1,y=g.end===null?h.length:g.end;d(Math.max(0,Math.min(y,h.length)-x))}let m=MD(h,u);c.append(`${m.join(r)} `)}return i?{stdout:c.build(),stderr:"",exitCode:0}:{stdout:c.build(),stderr:"",exitCode:0,stdoutKind:"bytes",stdoutEncoding:"binary"}}},D8={name:"cut",flags:[{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-f",type:"value",valueHint:"string"},{flag:"-c",type:"value",valueHint:"string"},{flag:"-s",type:"boolean"}],stdinType:"text",needsFiles:!0}}),R8={};ce(R8,{flagsForFuzzing:()=>M8,pasteCommand:()=>L8});function Q6(e,t){if(e.length===0)return"";if(e.length===1)return e[0];if(t.length===0)return e.join("");let r=e[0];for(let n=1;n{"use strict";Yt(),ge(),Ar(),J(),sr(),be(),K6={name:"paste",summary:"merge lines of files",usage:"paste [OPTION]... [FILE]...",description:["Write lines consisting of the sequentially corresponding lines from","each FILE, separated by TABs, to standard output.","","With no FILE, or when FILE is -, read standard input."],options:["-d, --delimiters=LIST reuse characters from LIST instead of TABs","-s, --serial paste one file at a time instead of in parallel"," --help display this help and exit"],examples:["paste file1 file2 Merge file1 and file2 side by side","paste -d, file1 file2 Use comma as delimiter","paste -s file1 Paste all lines of file1 on one line","paste - - < file Paste pairs of lines from file"]},Y6={delimiter:{short:"d",long:"delimiters",type:"string",default:" "},serial:{short:"s",long:"serial",type:"boolean"}},L8={name:"paste",async execute(e,t){if(Ce(e))return we(K6);let r=ar("paste",e,Y6);if(!r.ok)return r.error;let n=r.result.flags.delimiter,i=r.result.flags.serial,a=r.result.positional;if(a.length>t.limits.maxArrayElements)throw new T(`paste: file operand limit exceeded (${t.limits.maxArrayElements})`,"array_elements");if(K(n)>t.limits.maxStringLength)throw new T(`paste: delimiter size limit exceeded (${t.limits.maxStringLength} bytes)`,"string_length");if(a.length===0)return{stdout:"",stderr:`usage: paste [-s] [-d delimiters] file ... `,exitCode:1};let s=Ve(t.stdin),o=s?s.split(` `):[""];o.length>0&&o[o.length-1]===""&&o.pop();let l=a.filter(m=>m==="-").length,u=[],c=0,p=K(s),d=m=>{if(m.length>t.limits.maxArrayElements-c)throw new T(`paste: line limit exceeded (${t.limits.maxArrayElements})`,"array_elements");c+=m.length,t.executionScope?.consumeWork(m.length,"paste lines")},f=0;for(let m of a)if(m==="-"){let g=[];for(let x=f;xt.limits.maxInputBytes-p)throw new T(`paste: aggregate input size limit exceeded (${t.limits.maxInputBytes} bytes)`,"string_length");p+=y,t.executionScope?.consumeInput(y,"paste");let b=x.split(` `);b.length>0&&b[b.length-1]===""&&b.pop(),d(b),u.push(b)}catch(x){return Ge(x),{stdout:"",stderr:`paste: ${m}: No such file or directory `,exitCode:1}}}let h=new St(Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),"paste");if(i)for(let m of u)m&&h.append(`${Q6(m,n)} `);else{let m=0;for(let g of u)m=Math.max(m,g?.length??0);for(let g=0;gU8,trCommand:()=>B8});function J6(e,t,r,n){let i="",a=0,s=l=>{if(l.length>t-i.length)throw new T(`tr: expanded SET exceeds string length limit (${t})`,"string_length");i+=l},o=(l=1)=>{if(l>r-n.iterations)throw new T(`tr: SET expansion iteration limit exceeded (${r})`,"iterations");n.iterations+=l};for(;a=l?u-l+1:0;if(o(c),c>t-i.length)throw new T(`tr: expanded SET exceeds string length limit (${t})`,"string_length");for(let p=l;p<=u;p++)i+=String.fromCharCode(p);a+=3;continue}s(e[a]),a++}return i}var eb,F8,tb,B8,U8,BD=q(()=>{"use strict";ge(),Ar(),Nn(),J(),sr(),Uv(),be(),eb={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax: a-z character range [:alnum:] all letters and digits [:alpha:] all letters [:digit:] all digits [:lower:] all lowercase letters [:upper:] all uppercase letters [:space:] all whitespace [:blank:] horizontal whitespace [:punct:] all punctuation [:print:] all printable characters [:graph:] all printable characters except space [:cntrl:] all control characters [:xdigit:] all hexadecimal digits \\n, \\t, \\r escape sequences`},F8=new Map([["[:alnum:]","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],["[:alpha:]","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"],["[:blank:]"," "],["[:cntrl:]",Array.from({length:32},(e,t)=>String.fromCharCode(t)).join("").concat("\x7F")],["[:digit:]","0123456789"],["[:graph:]",Array.from({length:94},(e,t)=>String.fromCharCode(33+t)).join("")],["[:lower:]","abcdefghijklmnopqrstuvwxyz"],["[:print:]",Array.from({length:95},(e,t)=>String.fromCharCode(32+t)).join("")],["[:punct:]","!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"],["[:space:]",` \r\f\v`],["[:upper:]","ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["[:xdigit:]","0123456789ABCDEFabcdef"]]),tb={complement:{short:"c",long:"complement",type:"boolean"},complementUpper:{short:"C",type:"boolean"},delete:{short:"d",long:"delete",type:"boolean"},squeeze:{short:"s",long:"squeeze-repeats",type:"boolean"}},B8={name:"tr",async execute(e,t){if(Ce(e))return we(eb);let r=ar("tr",e,tb);if(!r.ok)return r.error;let n=r.result.flags.complement||r.result.flags.complementUpper,i=r.result.flags.delete,a=r.result.flags.squeeze,s=r.result.positional;if(s.length<1)return{stdout:"",stderr:`tr: missing operand `,exitCode:1};if(!i&&!a&&s.length<2)return{stdout:"",stderr:`tr: missing operand after SET1 `,exitCode:1};let o,l,u=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),c=t.limits.maxLoopIterations,p=t.limits.maxArrayElements,d=Math.min(t.limits.maxOutputSize,t.limits.maxStringLength);try{let k={iterations:0};o=J6(s[0],u,c,k),l=s.length>1?J6(s[1],u,c,k):""}catch(k){return Ge(k),{stdout:"",stderr:`${Xt(k.message)} `,exitCode:1}}if(t.stdin.length>u)throw new T(`tr: input size limit exceeded (${u} bytes)`,"string_length");let f=Ve(t.stdin);if(o.length>p||l.length>p)throw new T(`tr: array element limit exceeded (${p})`,"array_elements");let h=new Set(o),m=new Set(l),g=k=>{let w=h.has(k);return n?!w:w},x=Bv(f.length<=32768?32768:32),y=0,b=k=>{let w=0;if(k.length===2)w=4;else if(k.length===1){let v=k.charCodeAt(0);w=v<=127?1:v<=2047?2:3}if(w>d-y)throw new T(`tr: output size limit exceeded (${d} bytes)`,"output_size");x.append(k),y+=w};if(i)for(let k=0;k65535?f.slice(k,k+2):f[k];k+=w.length,g(w)||b(w)}else if(a&&s.length===1){let k="";for(let w=0;w65535?f.slice(w,w+2):f[w];w+=v.length,!(g(v)&&v===k)&&(b(v),k=v)}}else{let k="",w=v=>{a&&m.has(v)&&v===k||(b(v),k=v)};if(n){let v=l.length>0?l[l.length-1]:"";for(let A=0;A65535?f.slice(A,A+2):f[A];A+=R.length,h.has(R)?w(R):w(v)}}else{let v=new Map;for(let A=0;A65535?f.slice(A,A+2):f[A];A+=R.length,w(v.get(R)??R)}}}return{stdout:x.finish(),stderr:"",exitCode:0}}},U8={name:"tr",flags:[{flag:"-c",type:"boolean"},{flag:"-C",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-s",type:"boolean"}],stdinType:"text",needsArgs:!0}}),z8={};ce(z8,{flagsForFuzzing:()=>H8,rev:()=>q8});function UD(e){return Array.from(e).reverse().join("")}var rb,q8,H8,zD=q(()=>{"use strict";ge(),be(),rb={name:"rev",summary:"reverse lines characterwise",usage:"rev [file ...]",description:"Copies the specified files to standard output, reversing the order of characters in every line. If no files are specified, standard input is read.",examples:["echo 'hello' | rev # Output: olleh","rev file.txt # Reverse each line in file"]},q8={name:"rev",execute:async(e,t)=>{if(Ce(e))return we(rb);let r=[];for(let a of e)if(a==="--"){let s=e.indexOf(a);r.push(...e.slice(s+1));break}else{if(a.startsWith("-")&&a!=="-")return Le("rev",a);r.push(a)}let n="",i=a=>{let s=a.split(` `),o=a.endsWith(` `)&&s[s.length-1]==="";return o&&s.pop(),s.map(UD).join(` `)+(o?` `:"")};if(r.length===0){let a=Ve(t.stdin)??"";n=i(a)}else for(let a of r)if(a==="-"){let s=Ve(t.stdin)??"";n+=i(s)}else{let s=t.fs.resolvePath(t.cwd,a),o=await t.fs.readFile(s);if(o===null)return{exitCode:1,stdout:n,stderr:`rev: ${a}: No such file or directory `};n+=i(o)}return{exitCode:0,stdout:n,stderr:""}}},H8={name:"rev",flags:[],stdinType:"text",needsFiles:!0}}),W8={};ce(W8,{flagsForFuzzing:()=>G8,nl:()=>j8});function qD(e,t,r){let n=String(e);switch(t){case"ln":return n.padEnd(r);case"rn":return n.padStart(r);case"rz":return n.padStart(r,"0");default:return t}}function HD(e,t){switch(t){case"a":return!0;case"t":return e.trim().length>0;case"n":return!1;default:return t}}function nb(e,t,r,n){if(e==="")return{output:"",nextNumber:r};let i=e.split(` `),a=[],s=0,o=r,l=e.endsWith(` `)&&i[i.length-1]==="";l&&i.pop();for(let u of i){let c=a.length>0?1:0,p=K(t.separator)+K(u);if(HD(u,t.bodyStyle)){let d=Math.max(String(o).length,t.width)+p+c;if(d>n-s)throw new T(`nl: output size limit exceeded (${n} bytes)`,"output_size");let f=`${qD(o,t.numberFormat,t.width)}${t.separator}${u}`;a.push(f),s+=d,o+=t.increment}else{let d=t.width+p+c;if(d>n-s)throw new T(`nl: output size limit exceeded (${n} bytes)`,"output_size");let f=`${" ".repeat(t.width)}${t.separator}${u}`;a.push(f),s+=d}}if(l&&s+1>n)throw new T(`nl: output size limit exceeded (${n} bytes)`,"output_size");return{output:a.join(` `)+(l?` `:""),nextNumber:o}}var ib,j8,G8,WD=q(()=>{"use strict";ge(),J(),be(),ib={name:"nl",summary:"number lines of files",usage:"nl [OPTION]... [FILE]...",description:"Write each FILE to standard output, with line numbers added. If no FILE is specified, standard input is read.",options:["-b STYLE Body numbering style: a (all), t (non-empty), n (none)","-n FORMAT Number format: ln (left), rn (right), rz (right zeros)","-w WIDTH Number width (default: 6)","-s SEP Separator after number (default: TAB)","-v START Starting line number (default: 1)","-i INCR Line number increment (default: 1)"],examples:["nl file.txt # Number non-empty lines","nl -ba file.txt # Number all lines","nl -n rz -w 3 file.txt # Right-justified with zeros","nl -s ': ' file.txt # Use ': ' as separator"]},j8={name:"nl",execute:async(e,t)=>{if(Ce(e))return we(ib);let r={bodyStyle:"t",numberFormat:"rn",width:6,separator:" ",startNumber:1,increment:1},n=[],i=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),a=i,s=0;for(;si)return{exitCode:1,stdout:"",stderr:`nl: invalid line number field width: '${e[s+1]}' `};r.width=c,s+=2}else if(u.startsWith("-w")){let c=/^\d+$/.test(u.slice(2))?Number(u.slice(2)):NaN;if(!Number.isSafeInteger(c)||c<1||c>i)return{exitCode:1,stdout:"",stderr:`nl: invalid line number field width: '${u.slice(2)}' `};r.width=c,s++}else if(u==="-s"&&s+1X8,fold:()=>Z8});function jD(e,t,r){return r?K(e):e===" "?8-t%8:e==="\b"?-1:1}function GD(e,t){if(e.length===0)return e;let{width:r,breakAtSpaces:n,countBytes:i}=t,a=[],s="",o=0,l=-1,u=0;for(let c of e){let p=jD(c,o,i);o+p>r&&s.length>0?n&&l>=0?(a.push(s.slice(0,l+1)),s=s.slice(l+1)+c,o=o-u-1+p,l=-1,u=0):(a.push(s),s=c,o=p,l=-1,u=0):(s+=c,o+=p,(c===" "||c===" ")&&(l=s.length-1,u=o-p))}return s.length>0&&a.push(s),a.join(` `)}function ab(e,t){if(e==="")return"";let r=e.split(` `),n=e.endsWith(` `)&&r[r.length-1]==="";return n&&r.pop(),r.map(i=>GD(i,t)).join(` `)+(n?` `:"")}var sb,Z8,X8,VD=q(()=>{"use strict";ge(),be(),sb={name:"fold",summary:"wrap each input line to fit in specified width",usage:"fold [OPTION]... [FILE]...",description:"Wrap input lines in each FILE, writing to standard output. If no FILE is specified, standard input is read.",options:["-w WIDTH Use WIDTH columns instead of 80","-s Break at spaces","-b Count bytes rather than columns"],examples:["fold -w 40 file.txt # Wrap at 40 columns","fold -sw 40 file.txt # Word wrap at 40 columns","echo 'long line' | fold -w 5 # Force wrap at 5"]},Z8={name:"fold",execute:async(e,t)=>{if(Ce(e))return we(sb);let r={width:80,breakAtSpaces:!1,countBytes:!1},n=[],i=0;for(;i2){let o=parseInt(s.slice(2),10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${s.slice(2)}' `};r.width=o,i++}else if(s==="-s")r.breakAtSpaces=!0,i++;else if(s==="-b")r.countBytes=!0,i++;else if(s==="-bs"||s==="-sb")r.breakAtSpaces=!0,r.countBytes=!0,i++;else if(s.match(/^-[sb]+w\d+$/)){s.includes("s")&&(r.breakAtSpaces=!0),s.includes("b")&&(r.countBytes=!0);let o=s.replace(/^-[sb]+w/,""),l=parseInt(o,10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${o}' `};r.width=l,i++}else if(s.match(/^-[sb]+w$/)&&i+1K8,flagsForFuzzing:()=>Y8});function Lu(e,t,r){let n=e.split(",").map(a=>a.trim());if(n.length>r)return null;let i=[];for(let a of n){let s=/^\d+$/.test(a)?Number(a):NaN;if(!Number.isSafeInteger(s)||s<1||s>t)return null;i.push(s)}for(let a=1;ae)return r-e;if(t.length>=2){let r=t[t.length-1]-t[t.length-2],n=t[t.length-1],i=Math.floor((e-n)/r)+1;return n+i*r-e}return 1}function XD(e,t,r){let{tabStops:n,leadingOnly:i}=t,a="",s=0,o=!0,l=0;for(let u of e)if(u===" ")if(i&&!o){if(l+1>r)throw new T(`expand: output size limit exceeded (${r} bytes)`,"output_size");a+=u,l++,s++}else{let c=ZD(s,n);if(c>r-l)throw new T(`expand: output size limit exceeded (${r} bytes)`,"output_size");a+=" ".repeat(c),l+=c,s+=c}else{u!==" "&&u!==" "&&(o=!1);let c=K(u);if(c>r-l)throw new T(`expand: output size limit exceeded (${r} bytes)`,"output_size");a+=u,l+=c,s++}return a}function ob(e,t,r){if(e==="")return"";let n=e.split(` `),i=e.endsWith(` `)&&n[n.length-1]==="";i&&n.pop();let a=[],s=0;for(let o of n){let l=a.length>0?1:0,u=XD(o,t,r-s-l);s+=l+K(u),a.push(u)}if(i&&s+1>r)throw new T(`expand: output size limit exceeded (${r} bytes)`,"output_size");return a.join(` `)+(i?` `:"")}var lb,K8,Y8,QD=q(()=>{"use strict";ge(),J(),be(),ir(),lb={name:"expand",summary:"convert tabs to spaces",usage:"expand [OPTION]... [FILE]...",description:"Convert TABs in each FILE to spaces, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-i Only convert leading tabs on each line"],examples:["expand file.txt # Convert all tabs to 8 spaces","expand -t 4 file.txt # Use 4-space tabs","expand -t 4,8,12 file.txt # Custom tab stops"]},K8={name:"expand",execute:async(e,t)=>{if(Ce(e))return we(lb);let r={tabStops:[8],leadingOnly:!1},n=[],i=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),a=t.limits.maxArrayElements,s=0;for(;s2){let u=Lu(l.slice(2),i,a);if(!u)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${l.slice(2)}' `};r.tabStops=u,s++}else if(l==="--tabs"&&s+1t9,unexpand:()=>e9});function Mu(e){let t=e.split(",").map(n=>n.trim()),r=[];for(let n of t){let i=parseInt(n,10);if(Number.isNaN(i)||i<1)return null;r.push(i)}for(let n=1;ne)return r;if(t.length>=2){let r=t[t.length-1]-t[t.length-2],n=t[t.length-1],i=Math.floor((e-n)/r)+1;return n+i*r}return-1}function KD(e,t){let{tabStops:r,allBlanks:n}=t,i="",a=0,s="",o=0,l=!0,u=()=>{if(s.length===0)return;let c=o+s.length;if(!n&&!l){i+=s,s="";return}let p=o,d="";for(;pp)d+=" ",p=h;else break}let f=c-p;f>0&&(d+=" ".repeat(f)),i+=d,s=""};for(let c of e)c===" "?(s.length===0&&(o=a),s+=c,a++):c===" "?(u(),i+=c,a=ub(a,r)):(u(),i+=c,a++,l=!1);return u(),i}function cb(e,t){if(e==="")return"";let r=e.split(` `),n=e.endsWith(` `)&&r[r.length-1]==="";return n&&r.pop(),r.map(i=>KD(i,t)).join(` `)+(n?` `:"")}var pb,e9,t9,YD=q(()=>{"use strict";ge(),be(),pb={name:"unexpand",summary:"convert spaces to tabs",usage:"unexpand [OPTION]... [FILE]...",description:"Convert blanks in each FILE to TABs, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-a Convert all sequences of blanks (not just leading)"],examples:["unexpand file.txt # Convert leading spaces to tabs","unexpand -a file.txt # Convert all space sequences","unexpand -t 4 file.txt # Use 4-space tabs"]},e9={name:"unexpand",execute:async(e,t)=>{if(Ce(e))return we(pb);let r={tabStops:[8],allBlanks:!1},n=[],i=0;for(;i2){let o=Mu(s.slice(2));if(!o)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${s.slice(2)}' `};r.tabStops=o,i++}else if(s==="--tabs"&&i+1i9,strings:()=>n9});function JD(e){return e>=32&&e<=126||e===9}function fb(e,t){if(t===null)return"";switch(t){case"o":return`${e.toString(8).padStart(7," ")} `;case"x":return`${e.toString(16).padStart(7," ")} `;case"d":return`${e.toString(10).padStart(7," ")} `;default:return t}}function db(e,t,r,n=!1,i){let a=[],s=0,o=0,l=typeof e=="string"&&!n?new TextEncoder().encode(e):e;if(l.length>r.maxStringLength-r.inputBytes)throw new T(`strings: aggregate input size limit exceeded (${r.maxStringLength} bytes)`,"string_length");r.inputBytes+=l.length;let u=new TextDecoder,c=(d,f)=>typeof l=="string"?l.slice(d,f):u.decode(l.subarray(d,f)),p=d=>{if(++r.iterations>r.maxIterations)throw new T(`strings: iteration limit exceeded (${r.maxIterations})`,"iterations");if(r.resultCount>=r.maxArrayElements)throw new T(`strings: array element limit exceeded (${r.maxArrayElements})`,"array_elements");let f=d.length+1;if(f>r.maxOutputSize-r.outputBytes)throw new T(`strings: output size limit exceeded (${r.maxOutputSize} bytes)`,"output_size");a.push(d),r.resultCount++,r.outputBytes+=f};for(let d=0;d=r.maxStringLength)throw new T(`strings: string length limit exceeded (${r.maxStringLength} bytes)`,"string_length");s++}else{if(s>=t.minLength){let h=fb(o,t.offsetFormat);p(`${h}${c(o,d)}`)}s=0}}if(s>=t.minLength){let d=fb(o,t.offsetFormat);p(`${d}${c(o,l.length)}`)}return a}var hb,n9,i9,eR=q(()=>{"use strict";J(),be(),hb={name:"strings",summary:"print the sequences of printable characters in files",usage:"strings [OPTION]... [FILE]...",description:"For each FILE, print the printable character sequences that are at least MIN characters long. If no FILE is specified, standard input is read.",options:["-n MIN Print sequences of at least MIN characters (default: 4)","-t FORMAT Print offset before each string (o=octal, x=hex, d=decimal)","-a Scan the entire file (default behavior)","-e ENCODING Select character encoding (s=7-bit, S=8-bit)"],examples:["strings file.bin # Extract strings (min 4 chars)","strings -n 8 file.bin # Extract strings (min 8 chars)","strings -t x file.bin # Show hex offset","echo 'hello' | strings # Read from stdin"]},n9={name:"strings",execute:async(e,t)=>{if(Ce(e))return we(hb);let r={minLength:4,offsetFormat:null},n=[],i=0;for(;it.stdin;if(n.length===0){let l=db(o(),r,s,!0,t.signal);a=l.length>0?`${l.join(` `)} `:""}else for(let l of n){let u;if(l==="-")u=o();else{let p=t.fs.resolvePath(t.cwd,l);try{u=await t.fs.readFileBuffer(p)}catch{return{exitCode:1,stdout:a,stderr:`strings: ${l}: No such file or directory `}}}let c=db(u,r,s,typeof u=="string",t.signal);c.length>0&&(a+=`${c.join(` `)} `)}return{exitCode:0,stdout:a,stderr:""}}},i9={name:"strings",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-a",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsFiles:!0}}),a9={};ce(a9,{flagsForFuzzing:()=>l9,split:()=>o9});function tR(e){return Uint8Array.from(e,t=>t.charCodeAt(0))}function mb(e){let t=e.match(/^(\d+)([KMGTPEZY]?)([B]?)$/i);if(!t)return null;let r=Number(t[1]);if(!Number.isSafeInteger(r)||r<1)return null;let n=(t[2]||"").toUpperCase(),i=new Map([["",1],["K",1024],["M",1024*1024],["G",1024*1024*1024],["T",1024*1024*1024*1024],["P",1024*1024*1024*1024*1024]]).get(n);return i===void 0||r>Math.floor(Number.MAX_SAFE_INTEGER/i)?null:r*i}function vs(e){if(!/^[0-9]+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}function rR(e,t,r){if(t)return e.toString().padStart(r,"0");let n="abcdefghijklmnopqrstuvwxyz",i=new Array(r),a=e;for(let s=r-1;s>=0;s--)i[s]=n[a%26],a=Math.floor(a/26);return i.join("")}function nR(e,t){let r=[],n=0,i=0;for(let a=0;a{"use strict";ge(),Ar(),jn(),J(),be(),xb={name:"split",summary:"split a file into pieces",usage:"split [OPTION]... [FILE [PREFIX]]",description:"Output pieces of FILE to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is 'x'.",options:["-l N Put N lines per output file","-b SIZE Put SIZE bytes per output file (K, M, G suffixes)","-n CHUNKS Split into CHUNKS equal-sized files","-d Use numeric suffixes (00, 01, ...) instead of alphabetic","-a LENGTH Use suffixes of length LENGTH (default: 2)","--additional-suffix=SUFFIX Append SUFFIX to file names"],examples:["split -l 100 file.txt # Split into 100-line chunks","split -b 1M file.bin # Split into 1MB chunks","split -n 5 file.txt # Split into 5 equal parts","split -d file.txt part_ # part_00, part_01, ...","split -a 3 -d file.txt x # x000, x001, ..."]},Bo=1e5,s9=0,o9={name:"split",execute:async(e,t)=>{if(Ce(e))return we(xb);let r={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},n=[],i=0;for(;iMath.min(t.limits.maxStringLength,t.limits.maxArrayElements))return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${e[i+1]}' `};r.suffixLength=p,i+=2}else if(c.match(/^-a\d+$/)){let p=vs(c.slice(2));if(p===null||p>Math.min(t.limits.maxStringLength,t.limits.maxArrayElements))return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${c.slice(2)}' `};r.suffixLength=p,i++}else if(c==="-d"||c==="--numeric-suffixes")r.useNumericSuffix=!0,i++;else if(c.startsWith("--additional-suffix="))r.additionalSuffix=c.slice(20),i++;else if(c==="--additional-suffix"&&i+1=1&&(a=n[0]),n.length>=2&&(s=n[1]),n.length>2)return{exitCode:1,stdout:"",stderr:`split: extra operand '${n[2]}' `};if(K(s)>t.limits.maxStringLength||K(r.additionalSuffix)>t.limits.maxStringLength||r.suffixLength>t.limits.maxStringLength-Math.min(t.limits.maxStringLength,K(s))-Math.min(t.limits.maxStringLength,K(r.additionalSuffix)))return{exitCode:1,stdout:"",stderr:`split: output filename exceeds configured string limit `};let o,l=null,u;if(a==="-"){let c=t.stdin.length;u=t.executionScope?.reserveBytes("split transaction",c*2,"split"),o=tR(t.stdin)}else{l=t.fs.resolvePath(t.cwd,a);try{let c=await t.fs.stat(l);if(u=t.executionScope?.reserveBytes("split transaction",c.size*2,"split"),o=await t.fs.readFileBuffer(l),o.byteLength>c.size)throw new T("split: input grew while being read","string_length");t.executionScope?.consumeInput(o.byteLength,"split")}catch(c){return u?.release(),Ge(c),{exitCode:1,stdout:"",stderr:`split: ${a}: No such file or directory `}}}try{if(o.length===0)return{exitCode:0,stdout:"",stderr:""};if(r.mode==="chunks"&&r.chunks>Bo)return{exitCode:1,stdout:"",stderr:`split: too many output files (${r.chunks}), limit is ${Bo} `};let c;switch(r.mode){case"lines":c=nR(o,r.lines);break;case"bytes":c=iR(o,r.bytes);break;case"chunks":c=aR(o,r.chunks);break;default:return r.mode}if(c.length>Bo)return{exitCode:1,stdout:"",stderr:`split: too many output files (${c.length}), limit is ${Bo} `};let p=sR(r.useNumericSuffix,r.suffixLength);if(c.length>p)return{exitCode:1,stdout:"",stderr:`split: output file suffixes exhausted at ${p} files `};t.executionScope?.consumeWork(c.length*r.suffixLength,"split suffix generation");let d=[],f=new Set,h=l?await li(t.fs,l):null;if(h?.existence==="unknown")return{exitCode:1,stdout:"",stderr:`split: cannot safely identify input file `};for(let m=0;m{}),m.backupPath=void 0)}catch{for(let m of[...d].reverse())m.committed&&await t.fs.rm(m.path,{force:!0,recursive:!0}).catch(()=>{}),m.backupPath&&await t.fs.mv(m.backupPath,m.path).catch(()=>{}),m.stagePath&&await t.fs.rm(m.stagePath,{force:!0,recursive:!0}).catch(()=>{});return{exitCode:1,stdout:"",stderr:`split: failed to write output `}}return{exitCode:0,stdout:"",stderr:""}}finally{u?.release()}}},l9={name:"split",flags:[{flag:"-l",type:"value",valueHint:"number"},{flag:"-b",type:"value",valueHint:"string"},{flag:"-n",type:"value",valueHint:"number"},{flag:"-d",type:"boolean"},{flag:"-a",type:"value",valueHint:"number"}],needsFiles:!0}}),u9={};ce(u9,{column:()=>c9,flagsForFuzzing:()=>p9});function yb(e,t,r,n){return t?r?e.split(t,n):e.split(t,n).filter(i=>i.length>0):r?e.split(/[ \t]/,n):e.split(/[ \t]+/,n).filter(i=>i.length>0)}function uR(e){let t=[];for(let r of e)for(let n=0;nt[n])&&(t[n]=i)}return t}function cR(e,t,r){if(e.length===0)return"";let n=uR(e),i=new St(r,"column",void 0,1);for(let a=0;a0&&i.append(` `);for(let o=0;o0&&i.append(t),i.append(s[o]),o0&&u.append(` `);let p=!1;for(let d=0;d=e.length?(p&&u.append(r),u.append(e[f])):(p&&u.append(r),u.append(e[f]),u.repeat(" ",i-e[f].length)),p=!0)}}return u.build()}var bb,wb,c9,p9,fR=q(()=>{"use strict";Yt(),ge(),J(),sr(),be(),bb={name:"column",summary:"columnate lists",usage:"column [OPTION]... [FILE]...",description:"Format input into multiple columns. By default, fills rows first. Use -t to create a table based on whitespace-delimited input.",options:["-t Create a table (determine columns from input)","-s SEP Input field delimiter (default: whitespace)","-o SEP Output field delimiter (default: two spaces)","-c WIDTH Output width for fill mode (default: 80)","-n Don't merge multiple adjacent delimiters"],examples:["ls | column # Fill columns with ls output","cat data | column -t # Format as table","column -t -s ',' file # Format CSV as table","column -c 40 file # Fill 40-char wide columns"]},wb={table:{short:"t",long:"table",type:"boolean"},separator:{short:"s",type:"string"},outputSep:{short:"o",type:"string"},width:{short:"c",type:"number",default:80},noMerge:{short:"n",type:"boolean"}},c9={name:"column",execute:async(e,t)=>{if(Ce(e))return we(bb);let r=ar("column",e,wb);if(!r.ok)return r.error;let{table:n,separator:i,outputSep:a,width:s,noMerge:o}=r.result.flags,l=r.result.positional,u=a??" ",c=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),p=t.limits.maxArrayElements,d=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize);if(!Number.isFinite(s)||!Number.isSafeInteger(s)||s<=0||s>10*1024*1024)return{exitCode:1,stdout:"",stderr:`column: invalid width: ${s} `};let f;if(l.length===0)f=Ve(t.stdin)??"";else{let x=[],y=0;for(let b of l)if(b==="-"){let k=Ve(t.stdin)??"";if(y+=K(k),y>c)throw new T(`column: input size limit exceeded (${c} bytes)`,"string_length");x.push(k)}else{let k=t.fs.resolvePath(t.cwd,b),w=await t.fs.readFile(k);if(w===null)return{exitCode:1,stdout:"",stderr:`column: ${b}: No such file or directory `};if(y+=K(w),y>c)throw new T(`column: input size limit exceeded (${c} bytes)`,"string_length");x.push(w)}f=x.join("")}if(K(f)>c)throw new T(`column: input size limit exceeded (${c} bytes)`,"string_length");if(f===""||f.trim()==="")return{exitCode:0,stdout:"",stderr:""};let h=f.split(` `,p+1);if(h.length>p)throw new T(`column: field limit exceeded (${p})`,"array_elements");f.endsWith(` `)&&h[h.length-1]===""&&h.pop();let m=h.filter(x=>x.trim().length>0),g;if(n){let x=[],y=0;for(let b of m){let k=p-y,w=yb(b,i,o,k+1);if(y+=w.length,y>p)throw new T(`column: field limit exceeded (${p})`,"array_elements");x.push(w)}g=cR(x,u,d)}else{let x=[];for(let y of m){let b=p-x.length,k=yb(y,i,o,b+1);if(k.length>b)throw new T(`column: field limit exceeded (${p})`,"array_elements");for(let w of k)x.push(w)}g=pR(x,s,u,d)}return g.length>0&&(g+=` `),{exitCode:0,stdout:g,stderr:""}}},p9={name:"column",flags:[{flag:"-t",type:"boolean"},{flag:"-s",type:"value",valueHint:"delimiter"},{flag:"-o",type:"value",valueHint:"string"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-n",type:"boolean"}],stdinType:"text",needsFiles:!0}}),f9={};ce(f9,{flagsForFuzzing:()=>h9,join:()=>d9});function dR(e,t){return t?e.split(t):e.split(/[ \t]+/).filter(r=>r.length>0)}function hR(e,t,r,n){let i=dR(e,t),a=i[r-1]??"";return n&&(a=a.toLowerCase()),{fields:i,joinKey:a,original:e}}function Qd(e,t,r){let n=r.separator??" ";if(r.outputFormat){let s=[];for(let{file:o,field:l}of r.outputFormat){let u=o===1?e:t;u&&l===0?s.push(u.joinKey):u&&u.fields[l-1]!==void 0?s.push(u.fields[l-1]):s.push(r.emptyString)}return s.join(n)}let i=[],a=e?.joinKey??t?.joinKey??"";if(i.push(a),e)for(let s=0;s{"use strict";ge(),J(),be(),ir(),vb={name:"join",summary:"join lines of two files on a common field",usage:"join [OPTION]... FILE1 FILE2",description:"For each pair of input lines with identical join fields, write a line to standard output. The default join field is the first, delimited by blanks.",options:["-1 FIELD Join on this FIELD of file 1 (default: 1)","-2 FIELD Join on this FIELD of file 2 (default: 1)","-t CHAR Use CHAR as input and output field separator","-a FILENUM Also print unpairable lines from file FILENUM (1 or 2)","-v FILENUM Like -a but only output unpairable lines","-e STRING Replace missing fields with STRING","-o FORMAT Output format (comma-separated list of FILENUM.FIELD)","-i Ignore case when comparing fields"],examples:["join file1 file2 # Join on first field","join -1 2 -2 1 file1 file2 # Join file1 col 2 with file2 col 1","join -t ',' file1.csv file2.csv # Join CSV files","join -a 1 file1 file2 # Left outer join"]},d9={name:"join",execute:async(e,t)=>{if(Ce(e))return we(vb);let r={field1:1,field2:1,separator:null,printUnpairable:new Set,onlyUnpairable:new Set,emptyString:"",outputFormat:null,ignoreCase:!1},n=[],i=0;for(;i2)r.separator=w.slice(2),i++;else if(w==="-a"&&i+1w+K(v),0)>l)throw new T(`join: aggregate input size limit exceeded (${l} bytes)`,"string_length");let c=0,p=0,d=()=>{if(++p>o)throw new T(`join: iteration limit exceeded (${o})`,"iterations")},f=(w,v)=>{let A=w.length>0?1:0;for(let I=0;Is-c)throw new T(`join: array element limit exceeded (${s})`,"array_elements");c+=A;let R=w.split(` `);return w.endsWith(` `)&&R[R.length-1]===""&&R.pop(),R.filter(I=>I.length>0).map(I=>hR(I,r.separator,v,r.ignoreCase))},h=f(a[0],r.field1),m=f(a[1],r.field2),g=new Map;for(let w of m){let v=g.get(w.joinKey);v?v.push(w):g.set(w.joinKey,[w])}let x=[],y=0,b=w=>{if(d(),x.length>=s)throw new T(`join: array element limit exceeded (${s})`,"array_elements");let v=K(w)+1;if(v>u-y)throw new T(`join: output size limit exceeded (${u} bytes)`,"output_size");x.push(w),y+=v},k=new Set;for(let w of h){let v=g.get(w.joinKey);if(v&&v.length>0){if(k.add(w.joinKey),r.onlyUnpairable.size===0)for(let A of v)b(Qd(w,A,r))}else(r.printUnpairable.has(1)||r.onlyUnpairable.has(1))&&b(Qd(w,null,r))}if(r.printUnpairable.has(2)||r.onlyUnpairable.has(2))for(let w of m)k.has(w.joinKey)||b(Qd(null,w,r));return{exitCode:0,stdout:Ha(x.length>0?`${x.join(` `)} `:""),stderr:"",stdoutEncoding:"binary"}}},h9={name:"join",flags:[{flag:"-1",type:"value",valueHint:"number"},{flag:"-2",type:"value",valueHint:"number"},{flag:"-t",type:"value",valueHint:"delimiter"},{flag:"-a",type:"value",valueHint:"number"},{flag:"-v",type:"value",valueHint:"number"},{flag:"-e",type:"value",valueHint:"string"},{flag:"-o",type:"value",valueHint:"format"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2}}),m9={};ce(m9,{flagsForFuzzing:()=>x9,teeCommand:()=>g9});var Eb,Sb,g9,x9,xR=q(()=>{"use strict";ge(),sr(),be(),Eb={name:"tee",summary:"read from stdin and write to stdout and files",usage:"tee [OPTION]... [FILE]...",options:["-a, --append append to the given FILEs, do not overwrite"," --help display this help and exit"]},Sb={append:{short:"a",long:"append",type:"boolean"}},g9={name:"tee",async execute(e,t){if(Ce(e))return we(Eb);let r=ar("tee",e,Sb);if(!r.ok)return r.error;let{append:n}=r.result.flags,i=r.result.positional,a=t.stdin,s="",o=0;for(let l of i)try{let u=t.fs.resolvePath(t.cwd,l);n?await t.fs.appendFile(u,a,"binary"):await t.fs.writeFile(u,a,"binary")}catch{s+=`tee: ${l}: No such file or directory `,o=1}return{stdout:a,stderr:s,exitCode:o,stdoutEncoding:"binary"}}},x9={name:"tee",flags:[{flag:"-a",type:"boolean"}],stdinType:"text",needsArgs:!0}}),ra,kl=q(()=>{"use strict";ge(),J(),ra=class{scope;site;stdoutChunks=[];stderrChunks=[];stdoutBytes=0;stderrBytes=0;attachedErrors=new WeakSet;constructor(e,t){this.scope=e,this.site=t}append(e,t,r=0,n="text"){let i;try{i=this.scope.appendOutput(e,t,this.site,r,n)}catch(a){throw this.prependTo(a),a}t&&(e==="stdout"?this.stdoutChunks:this.stderrChunks).push(t),e==="stdout"?this.stdoutBytes+=i:this.stderrBytes+=i}prependTo(e){e instanceof ur&&(this.attachedErrors.has(e)||(this.attachedErrors.add(e),e.prependOutput(this.stdout,this.stderr)))}appendResult(e,t=e.stdout){let r=e.stdoutKind==="bytes"||e.stdoutEncoding==="binary"?"bytes":"text",n=r==="bytes"?t.length:K(t);this.append("stdout",t,Math.min(e.internalOutputAccounting?.stdout??0,n),r),this.append("stderr",e.stderr,e.internalOutputAccounting?.stderr??0)}build(e,t){return{stdout:this.stdoutChunks.join(""),stderr:this.stderrChunks.join(""),exitCode:e,...t,internalOutputAccounting:{stdout:this.stdoutBytes,stderr:this.stderrBytes}}}get stdout(){return this.stdoutChunks.join("")}get stderr(){return this.stderrChunks.join("")}}});function Bn(e,t){switch(e.type){case"name":{let r=e.pattern,n=r.match(/^\*(\.[a-zA-Z0-9]+)$/);if(n){let i=n[1],a=t.name;if(e.ignoreCase){if(!a.toLowerCase().endsWith(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!a.endsWith(i))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:nn(t.name,r,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let r=e.pattern,n=t.relativePath,i=r.split("/");for(let s=0;se.days:e.comparison==="less"?n=rr,pruned:!1,printed:!1}}case"size":{let r=e.value;switch(e.unit){case"c":r=e.value;break;case"k":r=e.value*1024;break;case"M":r=e.value*1024*1024;break;case"G":r=e.value*1024*1024*1024;break;case"b":r=e.value*512;break}let n;return e.comparison==="more"?n=t.size>r:e.comparison==="less"?n=t.size{n&&(n.type==="newer"?t.push(n.refPath):n.type==="not"?r(n.expr):(n.type==="and"||n.type==="or")&&(r(n.left),r(n.right)))};return r(e),t}function rc(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!0;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return rc(e.expr);case"and":case"or":return rc(e.left)&&rc(e.right)}}function $s(e,t,r,n,i){switch(e.type){case"name":{let a=e.pattern,s=a.match(/^\*(\.[a-zA-Z0-9]+)$/);if(s){let o=s[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(o.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(o))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:nn(t,a,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let a=e.pattern,s=a.split("/");for(let l=0;l{"use strict";Dt(),gv()});function vR(e,t){let r=[],n=t,i=o=>({expr:null,pathIndex:n,error:`find: missing argument to \`${o}' `}),a=(o,l)=>({expr:null,pathIndex:n,error:`find: invalid argument \`${l}' to \`${o}' `});for(;n=e.length)return i(o);r.push({type:"expr",expr:{type:"name",pattern:e[++n]}})}else if(o==="-iname"){if(n+1>=e.length)return i(o);r.push({type:"expr",expr:{type:"name",pattern:e[++n],ignoreCase:!0}})}else if(o==="-path"){if(n+1>=e.length)return i(o);r.push({type:"expr",expr:{type:"path",pattern:e[++n]}})}else if(o==="-ipath"){if(n+1>=e.length)return i(o);r.push({type:"expr",expr:{type:"path",pattern:e[++n],ignoreCase:!0}})}else if(o==="-regex"){if(n+1>=e.length)return i(o);r.push({type:"expr",expr:{type:"regex",pattern:e[++n]}})}else if(o==="-iregex"){if(n+1>=e.length)return i(o);r.push({type:"expr",expr:{type:"regex",pattern:e[++n],ignoreCase:!0}})}else if(o==="-type"){if(n+1>=e.length)return i(o);let l=e[++n];if(l==="f"||l==="d")r.push({type:"expr",expr:{type:"type",fileType:l}});else return{expr:null,pathIndex:n,error:`find: Unknown argument to -type: ${l} `}}else if(o==="-empty")r.push({type:"expr",expr:{type:"empty"}});else if(o==="-mtime"){if(n+1>=e.length)return i(o);let l=e[++n],u="exact",c=l;if(l.startsWith("+")?(u="more",c=l.slice(1)):l.startsWith("-")&&(u="less",c=l.slice(1)),!/^\d+$/.test(c))return a(o,l);let p=Number(c);if(!Number.isSafeInteger(p))return a(o,l);r.push({type:"expr",expr:{type:"mtime",days:p,comparison:u}})}else if(o==="-newer"){if(n+1>=e.length)return i(o);let l=e[++n];r.push({type:"expr",expr:{type:"newer",refPath:l}})}else if(o==="-size"){if(n+1>=e.length)return i(o);let l=e[++n],u="exact",c=l;l.startsWith("+")?(u="more",c=l.slice(1)):l.startsWith("-")&&(u="less",c=l.slice(1));let p=c.match(/^(\d+)([ckMGb])?$/);if(!p)return a(o,l);let d=Number(p[1]);if(!Number.isSafeInteger(d))return a(o,l);let f=p[2]||"b",h=f==="G"?1024**3:f==="M"?1024**2:f==="k"?1024:f==="b"?512:1;if(!Number.isSafeInteger(d*h))return a(o,l);r.push({type:"expr",expr:{type:"size",value:d,unit:f,comparison:u}})}else if(o==="-perm"){if(n+1>=e.length)return i(o);let l=e[++n],u="exact",c=l;if(l.startsWith("-")?(u="all",c=l.slice(1)):l.startsWith("/")&&(u="any",c=l.slice(1)),!/^[0-7]{1,4}$/.test(c))return a(o,l);let p=Number.parseInt(c,8);r.push({type:"expr",expr:{type:"perm",mode:p,matchType:u}})}else if(o==="-prune")r.push({type:"expr",expr:{type:"prune"}});else if(o==="-not"||o==="!")r.push({type:"not"});else if(o==="-o"||o==="-or")r.push({type:"op",op:"or"});else if(o==="-a"||o==="-and")r.push({type:"op",op:"and"});else if(o==="-maxdepth"||o==="-mindepth"){if(n+1>=e.length)return i(o);n++}else if(o!=="-depth")if(o==="-exec"){let l=[];for(n++;n=e.length)return{expr:null,pathIndex:n,error:"find: missing argument to `-exec'\n"};if(l.length===0)return i("-exec");let u=e[n]==="+";if(u&&(l.at(-1)!=="{}"||l.filter(c=>c==="{}").length!==1))return a("-exec","+");r.push({type:"expr",expr:{type:"action",action:{type:"exec",command:l,batchMode:u}}})}else if(o==="-print")r.push({type:"expr",expr:{type:"action",action:{type:"print"}}});else if(o==="-print0")r.push({type:"expr",expr:{type:"action",action:{type:"print0"}}});else if(o==="-printf"){if(n+1>=e.length)return i(o);let l=e[++n];r.push({type:"expr",expr:{type:"action",action:{type:"printf",format:l}}})}else if(o==="-delete")r.push({type:"expr",expr:{type:"action",action:{type:"delete"}}});else return o.startsWith("-")?{expr:null,pathIndex:n,error:`find: unknown predicate '${o}' `}:{expr:null,pathIndex:n,error:`find: paths must precede expression: \`${o}' `};n++}if(r.length===0)return{expr:null,pathIndex:n};let s=ER(r);return s.error?{expr:null,pathIndex:n,error:s.error}:{expr:s.expr,pathIndex:n}}function ER(e){let t=0,r;function n(){let l=i();if(!l)return null;for(;t=e.length)return null;let l=e[t];if(l.type==="lparen"){t++;let u=n();return!u||t>=e.length||e[t].type!=="rparen"?(r="find: missing closing `)'\n",null):(t++,u)}return l.type==="expr"?(t++,l.expr):(l.type,null)}let o=n();return!r&&t{"use strict"}),y9={};ce(y9,{findCommand:()=>b9,flagsForFuzzing:()=>v9});function AR(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function CR(e,t,r){e({category:"find",name:"summary",durationMs:r,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:r-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}function ac(e){return e?e.type==="action"?[e.action]:e.type==="not"?ac(e.expr):e.type==="and"||e.type==="or"?[...ac(e.left),...ac(e.right)]:[]:[]}function kR(e,t){let r=B4(e),n="",i=0;for(;i=r.length){n+="%";break}let l=r[i],u;switch(l){case"f":u=t.name,i++;break;case"h":{let c=t.path.lastIndexOf("/");u=c>0?t.path.slice(0,c):".",i++;break}case"p":u=t.path,i++;break;case"P":{let c=t.startingPoint;t.path===c?u="":t.path.startsWith(`${c}/`)?u=t.path.slice(c.length+1):c==="."&&t.path.startsWith("./")?u=t.path.slice(2):u=t.path,i++;break}case"s":u=String(t.size),i++;break;case"d":u=String(t.depth),i++;break;case"m":u=(t.mode&511).toString(8),i++;break;case"M":u=Vh(t.mode,t.isDirectory),i++;break;case"t":{let c=new Date(t.mtime);u=NR(c),i++;break}case"T":{if(i+1{"use strict";ge(),kl(),jn(),Qs(),J(),Br(),ov(),be(),ir(),wR(),SR(),Kd=500,Ab={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},b9={name:"find",async execute(e,t){if(Ce(e))return we(Ab);let r=[],n=null,i=null,a=!1,s=e.length;for(let S=0;S0;u.some(S=>S.type==="delete")&&(a=!0);let p=[],d=0,f=t.executionScope?new ra(t.executionScope,"find"):void 0,h=[],m=[],g=0,x=new Wn({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"find"}),y=S=>{if(f)f.append("stdout",S);else{let D=K(S);if(D>t.limits.maxOutputSize-g)throw new T(`find: output size limit exceeded (${t.limits.maxOutputSize} bytes)`,"output_size");S&&h.push(S),g+=D}},b=S=>{if(f)f.append("stderr",S);else{let D=K(S);if(D>t.limits.maxOutputSize-g)throw new T(`find: output size limit exceeded (${t.limits.maxOutputSize} bytes)`,"output_size");S&&m.push(S),g+=D}},k=yR(o),w=new Map;for(let S of k){let D=t.fs.resolvePath(t.cwd,S);try{let W=await t.fs.stat(D);w.set(S,W.mtime?.getTime()??Date.now())}catch{}}let v=u.some(S=>{if(S.type!=="printf")return!1;let D=S.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(D)}),A=ec(o)||v,R=tc(o),I=nc(o),$=rc(o),_=typeof t.fs.readdirWithFileTypes=="function";for(let S of r){let D=function(Y){let ne={path:Y.relativePath,name:Y.name,size:Y.stat?.size??0,mtime:Y.stat?.mtime?.getTime()??Date.now(),mode:Y.stat?.mode??420,isDirectory:Y.isDirectory,depth:Y.depth,startingPoint:S},Z=Y.unreadable===void 0?[]:[{action:{type:"diagnostic",message:`find: ${Y.relativePath}: ${Y.unreadable} `},path:Y.relativePath,printfData:ne}],ve=Fe=>a?[...Z,...Fe]:[...Fe,...Z];if(!(i===null||Y.depth>=i))return Z;let de=!0,xe=[];if(o!==null){let Fe=Date.now(),te;if($)te=$s(o,Y.name,Y.relativePath,Y.isFile,Y.isDirectory);else{let he={name:Y.name,relativePath:Y.relativePath,isFile:Y.isFile,isDirectory:Y.isDirectory,isEmpty:Y.isEmpty,mtime:Y.stat?.mtime?.getTime()??Date.now(),size:Y.stat?.size??0,mode:Y.stat?.mode??420,newerRefTimes:w};te=Bn(o,he)}de=te.matches,xe=te.actions??[],j.evalCalls++,j.evalTime+=Date.now()-Fe}if(!c&&de&&(xe=[{type:"print"}]),xe.length===0)return Z;x.checkpoint(xe.length);let ie=[];for(let Fe of xe)ie.push({action:Fe,path:Y.relativePath,printfData:ne});return ve(ie)};var M=D;S.length>1&&S.endsWith("/")&&(S=S.slice(0,-1));let W=t.fs.resolvePath(t.cwd,S);try{await t.fs.stat(W)}catch{b(`find: ${S}: No such file or directory `),d=1;continue}let j=AR(),U=Date.now();async function H(Y){let{path:ne,depth:Z,typeInfo:ve}=Y;if(x.visit(Z),j.nodeCount++,Z>(n??t.limits.maxTraversalDepth))return null;let de,xe,ie;if(ve&&!A)de=ve.isFile,xe=ve.isDirectory;else{try{let zr=Date.now();ie=await t.fs.lstat(ne),j.statCalls++,j.statTime+=Date.now()-zr}catch{return null}if(!ie)return null;de=ie.isFile,xe=ie.isDirectory}let Fe;ne===W?Fe=S.split("/").pop()||S:Fe=ne.split("/").pop()||"";let te=ne===W?S:S==="."?`./${ne.slice(W==="/"?W.length:W.length+1)}`:S+ne.slice(W.length),he=[],qe=null,Te=null,Je=!1;xe&&I&&!a&&(Je=bR(o,{name:Fe,relativePath:te,isFile:de,isDirectory:xe}).shouldPrune,Je&&j.earlyPrunes++);let Ue=!(Z>=(n??t.limits.maxTraversalDepth))&&!Je,ye=(Ue||R)&&!Je,Ur;if(xe&&ye){let zr=Date.now();try{_&&t.fs.readdirWithFileTypes?qe=await t.fs.readdirWithFileTypes(ne):Te=await t.fs.readdir(ne)}catch(Jt){let lr=TR(Jt);if(lr===null)throw Jt;Ur=lr,j.readdirCalls++,j.readdirTime+=Date.now()-zr}if(qe!==null){x.checkpoint(),x.discover(qe.length),Te=[];for(let Jt of qe)Te.push(Jt.name);if(j.readdirCalls++,j.readdirTime+=Date.now()-zr,Ue)for(let Jt=0;JtH(he.item)));j.batchCount++,j.batchTime+=Date.now()-xe;for(let he=0;he=0){let Ue=ve.get(Te.parentIndex)||[];Ue.push(Je),ve.set(Te.parentIndex,Ue)}ne.push({node:qe,parentIndex:Te.parentIndex,childIndices:[]});for(let Ue=0;Ue=0&&xe0){let xe=[{index:0,visited:!1}];for(;xe.length>0;){x.checkpoint();let ie=xe.pop();if(!ie)break;let Fe=ne[ie.index];if(Fe){if(ie.visited){for(let te of D(Fe.node))Y.effects.push(te);continue}xe.push({index:ie.index,visited:!0});for(let te=Fe.childIndices.length-1;te>=0;te--)xe.push({index:Fe.childIndices[te],visited:!1})}}}}else{let ne=new Map,Z=0,ve=[{item:{path:W,depth:0,resultIndex:0},orderIndex:Z++}],de=new Map,xe=0;for(;xe{let Ue=await H(Te);return Ue?{node:Ue,orderIndex:Je}:null}));j.batchCount++,j.batchTime+=Date.now()-Fe;for(let Te of qe){if(!Te)continue;let{node:Je,orderIndex:Ue}=Te,ye=D(Je);if(ye.length>0&&ne.set(Ue,ye),Je.children.length>0){let Ur=[];for(let Jr of Je.children){let mr=Z++;Ur.push(mr),ve.push({item:Jr,orderIndex:mr})}de.set(Ue,Ur)}}}let ie=[0];for(;ie.length>0;){x.checkpoint();let Fe=ie.pop();if(Fe===void 0)break;let te=ne.get(Fe);if(te)for(let qe of te)Y.effects.push(qe);let he=de.get(Fe);if(he)for(let qe=he.length-1;qe>=0;qe--)ie.push(he[qe])}}return Y}let ee=await z();for(let Y of ee.effects)p.push(Y);if(t.trace){let Y=Date.now()-U;CR(t.trace,j,Y),t.trace({category:"find",name:"searchPath",durationMs:Y,details:{path:S,resultsFound:ee.effects.filter(ne=>ne.action.type!=="diagnostic").length}})}}let P=new Map;for(let S of p){let{action:D,path:W}=S;switch(D.type){case"diagnostic":b(D.message),d=1;break;case"print":y(`${W} `);break;case"print0":y(`${W}\0`);break;case"printf":y(kR(D.format,S.printfData));break;case"delete":{let j=t.fs.resolvePath(t.cwd,W);try{await t.fs.rm(j,{recursive:!1})}catch(U){let H=U instanceof Error?U.message:String(U);b(`find: cannot delete '${W}': ${H} `),d=1}break}case"exec":{if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context `,exitCode:1};if(D.batchMode){let H=P.get(D)??[];H.push(W),P.set(D,H);break}let j=D.command.map(H=>H==="{}"?W:H),U=await t.exec(Ga([j[0]]),{cwd:t.cwd,signal:t.signal,args:j.slice(1)});f?f.appendResult(U):(y(U.stdout),b(U.stderr)),U.exitCode!==0&&(d=U.exitCode);break}}}for(let[S,D]of P){if(S.type!=="exec"||!t.exec||D.length===0)continue;let W=[];for(let U of S.command)U==="{}"?W.push(...D):W.push(U);let j=await t.exec(Ga([W[0]]),{cwd:t.cwd,signal:t.signal,args:W.slice(1)});f?f.appendResult(j):(y(j.stdout),b(j.stderr)),j.exitCode!==0&&(d=j.exitCode)}return f?.build(d)??{stdout:h.join(""),stderr:m.join(""),exitCode:d}}},w9=new Map([["EACCES","Permission denied"],["EIO","Input/output error"],["ELOOP","Too many levels of symbolic links"],["ENAMETOOLONG","File name too long"],["ENOENT","No such file or directory"],["ENOTDIR","Not a directory"],["EPERM","Permission denied"]]),v9={name:"find",flags:[{flag:"-name",type:"value",valueHint:"pattern"},{flag:"-iname",type:"value",valueHint:"pattern"},{flag:"-type",type:"value",valueHint:"string"},{flag:"-maxdepth",type:"value",valueHint:"number"},{flag:"-mindepth",type:"value",valueHint:"number"},{flag:"-empty",type:"boolean"},{flag:"-print",type:"boolean"},{flag:"-print0",type:"boolean"}],needsFiles:!0}}),E9={};ce(E9,{basenameCommand:()=>S9,flagsForFuzzing:()=>A9});var Cb,S9,A9,IR=q(()=>{"use strict";be(),Cb={name:"basename",summary:"strip directory and suffix from filenames",usage:`basename NAME [SUFFIX] basename OPTION... NAME...`,options:["-a, --multiple support multiple arguments","-s, --suffix=SUFFIX remove a trailing SUFFIX"," --help display this help and exit"]},S9={name:"basename",async execute(e,t){if(Ce(e))return we(Cb);let r=!1,n="",i=[];for(let s=0;s=2&&(n=i.pop()??"");let a=[];for(let s of i){let o=s.replace(/\/+$/,""),l=o.split("/").pop()||o;n&&l.endsWith(n)&&(l=l.slice(0,-n.length)),a.push(l)}return{stdout:`${a.join(` `)} `,stderr:"",exitCode:0}}},A9={name:"basename",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"value",valueHint:"string"}],needsArgs:!0}}),C9={};ce(C9,{dirnameCommand:()=>k9,flagsForFuzzing:()=>N9});var kb,k9,N9,$R=q(()=>{"use strict";be(),kb={name:"dirname",summary:"strip last component from file name",usage:"dirname [OPTION] NAME...",options:[" --help display this help and exit"]},k9={name:"dirname",async execute(e,t){if(Ce(e))return we(kb);let r=e.filter(i=>!i.startsWith("-"));if(r.length===0)return{stdout:"",stderr:`dirname: missing operand `,exitCode:1};let n=[];for(let i of r){let a=i.replace(/\/+$/,""),s=a.lastIndexOf("/");s===-1?n.push("."):s===0?n.push("/"):n.push(a.slice(0,s))}return{stdout:`${n.join(` `)} `,stderr:"",exitCode:0}}},N9={name:"dirname",flags:[],needsArgs:!0}}),T9={};ce(T9,{flagsForFuzzing:()=>I9,treeCommand:()=>O9});async function DR(e,t,r,n,i){let a={output:"",stderr:"",dirCount:0,fileCount:0},s=e.fs.resolvePath(e.cwd,t);try{if(!(await e.fs.stat(s)).isDirectory)return a.output=`${t} `,a.fileCount=1,a}catch{return a.stderr=`tree: ${t}: No such file or directory `,a}if(a.output=`${t} `,r.maxDepth!==null&&i>=r.maxDepth)return a;try{let o=[];if(e.fs.readdirWithFileTypes)o=(await e.fs.readdirWithFileTypes(s)).map(u=>({name:u.name,isDirectory:u.isDirectory}));else{let u=await e.fs.readdir(s);for(let c=0;c{let h=s==="/"?`/${f}`:`${s}/${f}`;try{let m=await e.fs.stat(h);return{name:f,isDirectory:m.isDirectory}}catch{return null}}));o.push(...d.filter(f=>f!==null))}}let l=o.filter(u=>!(!r.showHidden&&u.name.startsWith(".")||r.directoriesOnly&&!u.isDirectory));l.sort((u,c)=>u.name.localeCompare(c.name));for(let u=0;u=r.maxDepth)return a;try{let s=[];if(e.fs.readdirWithFileTypes)s=(await e.fs.readdirWithFileTypes(t)).map(l=>({name:l.name,isDirectory:l.isDirectory}));else{let l=await e.fs.readdir(t);for(let u=0;u{let f=t==="/"?`/${d}`:`${t}/${d}`;try{let h=await e.fs.stat(f);return{name:d,isDirectory:h.isDirectory}}catch{return null}}));s.push(...p.filter(d=>d!==null))}}let o=s.filter(l=>!(!r.showHidden&&l.name.startsWith(".")||r.directoriesOnly&&!l.isDirectory));o.sort((l,u)=>l.name.localeCompare(u.name));for(let l=0;l{"use strict";sr(),Yc(),be(),Nb={name:"tree",summary:"list contents of directories in a tree-like format",usage:"tree [OPTION]... [DIRECTORY]...",options:["-a include hidden files","-d list directories only","-L LEVEL limit depth of directory tree","-f print full path prefix for each file"," --help display this help and exit"]},Tb={showHidden:{short:"a",type:"boolean"},directoriesOnly:{short:"d",type:"boolean"},fullPath:{short:"f",type:"boolean"},maxDepth:{short:"L",type:"number"}},O9={name:"tree",async execute(e,t){if(Ce(e))return we(Nb);let r=ar("tree",e,Tb);if(!r.ok)return r.error;let n={showHidden:r.result.flags.showHidden,directoriesOnly:r.result.flags.directoriesOnly,maxDepth:r.result.flags.maxDepth??null,fullPath:r.result.flags.fullPath},i=r.result.positional;i.length===0&&i.push(".");let a="",s="",o=0,l=0;for(let u of i){let c=await DR(t,u,n,"",0);a+=c.output,s+=c.stderr,o+=c.dirCount,l+=c.fileCount}return a+=` ${o} director${o===1?"y":"ies"}`,n.directoriesOnly||(a+=`, ${l} file${l===1?"":"s"}`),a+=` `,{stdout:a,stderr:s,exitCode:s?1:0}}},I9={name:"tree",flags:[{flag:"-a",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-L",type:"value",valueHint:"number"}],needsFiles:!0}}),$9={};ce($9,{duCommand:()=>D9,flagsForFuzzing:()=>R9});async function LR(e,t,r,n,i){let a={output:"",totalSize:0,stderr:""},s=new Map;return await El({fs:e.fs,root:t,limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"du",symlinks:"never",includeLeave:!0},o=>{let l=o.path.slice(t.length).replace(/^\//,""),u=l?r==="."?l:`${r}/${l}`:r,c=o.path==="/"?"/":o.path.slice(0,o.path.lastIndexOf("/"))||"/";if(o.phase==="enter"){if(o.stat.isDirectory){s.set(o.path,0);return}s.set(c,(s.get(c)??0)+o.stat.size),(n.allFiles||o.depth===i)&&!n.summarize&&(a.output+=`${i1(o.stat.size,n.humanReadable)} ${u} `),o.depth===i&&(a.totalSize=o.stat.size);return}let p=s.get(o.path)??0;o.depth>i?s.set(c,(s.get(c)??0)+p):a.totalSize=p;let d=o.depth-i;(n.summarize&&d===0||!n.summarize&&(n.maxDepth===null||d<=n.maxDepth))&&(a.output+=`${i1(p,n.humanReadable)} ${u} `)}),a}function i1(e,t){return t?e<1024?`${e}`:e<1024*1024?`${(e/1024).toFixed(1)}K`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)}M`:`${(e/(1024*1024*1024)).toFixed(1)}G`:String(Math.ceil(e/1024)||1)}var _b,Ob,D9,R9,MR=q(()=>{"use strict";jn(),J(),sr(),be(),_b={name:"du",summary:"estimate file space usage",usage:"du [OPTION]... [FILE]...",options:["-a write counts for all files, not just directories","-h print sizes in human readable format","-s display only a total for each argument","-c produce a grand total","--max-depth=N print total for directory only if N or fewer levels deep"," --help display this help and exit"]},Ob={allFiles:{short:"a",type:"boolean"},humanReadable:{short:"h",type:"boolean"},summarize:{short:"s",type:"boolean"},grandTotal:{short:"c",type:"boolean"},maxDepth:{long:"max-depth",type:"number"}},D9={name:"du",async execute(e,t){if(Ce(e))return we(_b);let r=ar("du",e,Ob);if(!r.ok)return r.error;let n={allFiles:r.result.flags.allFiles,humanReadable:r.result.flags.humanReadable,summarize:r.result.flags.summarize,grandTotal:r.result.flags.grandTotal,maxDepth:r.result.flags.maxDepth??null},i=r.result.positional;i.length===0&&i.push(".");let a="",s="",o=0;for(let l of i){let u=t.fs.resolvePath(t.cwd,l);try{await t.fs.stat(u);let c=await LR(t,u,l,n,0);a+=c.output,o+=c.totalSize,s+=c.stderr}catch(c){if(c instanceof T||c instanceof zt)throw c;s+=`du: cannot access '${l}': No such file or directory `}}return n.grandTotal&&i.length>0&&(a+=`${i1(o,n.humanReadable)} total `),{stdout:a,stderr:s,exitCode:s?1:0}}},R9={name:"du",flags:[{flag:"-a",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"--max-depth",type:"value",valueHint:"number"}],needsFiles:!0}}),a1={};ce(a1,{envCommand:()=>L9,flagsForFuzzing:()=>P9,printenvCommand:()=>M9,printenvFlagsForFuzzing:()=>F9});var Ib,L9,$b,M9,P9,F9,Db=q(()=>{"use strict";ge(),ia(),be(),Ib={name:"env",summary:"run a program in a modified environment",usage:"env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]",options:["-i, --ignore-environment start with an empty environment","-u NAME, --unset=NAME remove NAME from the environment"," --help display this help and exit"]},L9={name:"env",async execute(e,t){if(Ce(e))return we(Ib);let r=!1,n=[],i=new Map,a=-1;for(let l=0;l0?` `:""),stderr:"",exitCode:0}}if(!t.exec)return{stdout:"",stderr:`env: command execution not supported in this context `,exitCode:1};let o=e.slice(a);return t.exec("command",{cwd:t.cwd,env:Fn(s),replaceEnv:!0,stdin:t.stdin,stdinKind:"bytes",signal:t.signal,args:o})}},$b={name:"printenv",summary:"print all or part of environment",usage:"printenv [OPTION]... [VARIABLE]...",options:[" --help display this help and exit"]},M9={name:"printenv",async execute(e,t){if(Ce(e))return we($b);let r=e.filter(a=>!a.startsWith("-"));if(r.length===0){let a=[];for(let[s,o]of t.env)a.push(`${s}=${o}`);return{stdout:a.join(` `)+(a.length>0?` `:""),stderr:"",exitCode:0}}let n=[],i=0;for(let a of r){let s=t.env.get(a);s!==void 0?n.push(s):i=1}return{stdout:n.join(` `)+(n.length>0?` `:""),stderr:"",exitCode:i}}},P9={name:"env",flags:[{flag:"-i",type:"boolean"},{flag:"-u",type:"value",valueHint:"string"}]},F9={name:"printenv",flags:[]}}),s1={};ce(s1,{aliasCommand:()=>B9,flagsForFuzzing:()=>z9,unaliasCommand:()=>U9,unaliasFlagsForFuzzing:()=>q9});var Rb,wa,B9,U9,z9,q9,Lb=q(()=>{"use strict";be(),Rb={name:"alias",summary:"define or display aliases",usage:"alias [name[=value] ...]",options:[" --help display this help and exit"]},wa="BASH_ALIAS_",B9={name:"alias",async execute(e,t){if(Ce(e))return we(Rb);if(e.length===0){let n="";for(let[i,a]of t.env)if(i.startsWith(wa)){let s=i.slice(wa.length);n+=`alias ${s}='${a}' `}return{stdout:n,stderr:"",exitCode:0}}let r=e[0]==="--"?e.slice(1):e;for(let n of r){let i=n.indexOf("=");if(i===-1){let a=wa+n;return t.env.get(a)?{stdout:`alias ${n}='${t.env.get(a)}' `,stderr:"",exitCode:0}:{stdout:"",stderr:`alias: ${n}: not found `,exitCode:1}}else{let a=n.slice(0,i),s=n.slice(i+1);(s.startsWith("'")&&s.endsWith("'")||s.startsWith('"')&&s.endsWith('"'))&&(s=s.slice(1,-1)),t.env.set(wa+a,s)}}return{stdout:"",stderr:"",exitCode:0}}},U9={name:"unalias",async execute(e,t){if(Ce(e))return we({name:"unalias",summary:"remove alias definitions",usage:"unalias name [name ...]",options:["-a remove all aliases"," --help display this help and exit"]});if(e.length===0)return{stdout:"",stderr:`unalias: usage: unalias [-a] name [name ...] `,exitCode:1};if(e[0]==="-a"){for(let a of t.env.keys())a.startsWith(wa)&&t.env.delete(a);return{stdout:"",stderr:"",exitCode:0}}let r=e[0]==="--"?e.slice(1):e,n=!1,i="";for(let a of r){let s=wa+a;t.env.get(s)?t.env.delete(s):(i+=`unalias: ${a}: not found `,n=!0)}return{stdout:"",stderr:i,exitCode:n?1:0}}},z9={name:"alias",flags:[]},q9={name:"unalias",flags:[{flag:"-a",type:"boolean"}]}}),H9={};ce(H9,{flagsForFuzzing:()=>j9,historyCommand:()=>W9});var Mb,Yd,W9,j9,PR=q(()=>{"use strict";be(),Mb={name:"history",summary:"display command history",usage:"history [n]",options:["-c clear the history list"," --help display this help and exit"]},Yd="BASH_HISTORY",W9={name:"history",async execute(e,t){if(Ce(e))return we(Mb);let r=t.env.get(Yd)||"[]",n;try{n=JSON.parse(r)}catch{n=[]}if(e[0]==="-c")return t.env.set(Yd,"[]"),{stdout:"",stderr:"",exitCode:0};let i=n.length;e[0]&&/^\d+$/.test(e[0])&&(i=Math.min(parseInt(e[0],10),n.length));let a=n.length-i,s="";for(let o=a;oZ9,xargsCommand:()=>V9});function Pb(e,t,r){if(t.length===0)throw new Error("xargs: delimiter must not be empty");let n=[],i=0;for(;i<=e.length;){let a=e.indexOf(t,i),s=e.slice(i,a===-1?e.length:a);if(s.length>0){if(n.length>=r)throw new T(`xargs: array element limit exceeded (${r})`,"array_elements");n.push(s)}if(a===-1)break;i=a+t.length}return n}function FR(e,t){let r=[],n=-1;for(let i=0;i<=e.length;i++){let a=i===e.length||/\s/.test(e[i]);if(!a&&n===-1&&(n=i),a&&n!==-1){if(r.length>=t)throw new T(`xargs: array element limit exceeded (${t})`,"array_elements");r.push(e.slice(n,i)),n=-1}}return r}var Fb,V9,Z9,BR=q(()=>{"use strict";ge(),kl(),Qs(),J(),be(),ir(),Fb={name:"xargs",summary:"build and execute command lines from standard input",usage:"xargs [OPTION]... [COMMAND [INITIAL-ARGS]]",options:["-I REPLACE replace occurrences of REPLACE with input","-d DELIM use DELIM as input delimiter (e.g., -d '\\n' for newline)","-n NUM use at most NUM arguments per command line","-P NUM run at most NUM processes at a time","-0, --null items are separated by null, not whitespace","-t, --verbose print commands before executing","-r, --no-run-if-empty do not run command if input is empty"," --help display this help and exit"]},V9={name:"xargs",async execute(e,t){if(Ce(e))return we(Fb);let r=null,n=null,i=null,a=null,s=!1,o=!1,l=!1,u=0;for(let M=0;M1){for(let S of P.slice(1))if(!"0tr".includes(S))return Le("xargs",`-${S}`);P.includes("0")&&(s=!0),P.includes("t")&&(o=!0),P.includes("r")&&(l=!0),u=M+1}else if(!P.startsWith("-")){u=M;break}}}let c=e.slice(u);c.length===0&&c.push("echo");let p=Ve(t.stdin),d=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),f=t.limits.maxArrayElements,h=t.limits.maxLoopIterations,m=t.limits.maxOutputSize;if(K(p)>d)throw new T(`xargs: input size limit exceeded (${d} bytes)`,"string_length");if(a!==null&&a>f)throw new T(`xargs: array element limit exceeded (${f})`,"array_elements");let g;if(s)g=Pb(p,"\0",f);else if(n!==null){let M=p.replace(/\n$/,"");try{g=Pb(M,n,f)}catch(P){if(P instanceof T)throw P;return{stdout:"",stderr:`xargs: delimiter must not be empty `,exitCode:1}}}else g=FR(p,f);if(g.length===0)return l?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let x=[],y=[],b=0,k=0,w=0,v=t.executionScope?new ra(t.executionScope,"xargs"):void 0,A=M=>{if(v){v.appendResult(M);return}let P=K(M.stdout)+K(M.stderr);if(P>m-k)throw new T(`xargs: output size limit exceeded (${m} bytes)`,"output_size");M.stdout&&x.push(M.stdout),M.stderr&&y.push(M.stderr),k+=P},R=M=>{if(v){v.append("stderr",M);return}let P=K(M);if(P>m-k)throw new T(`xargs: output size limit exceeded (${m} bytes)`,"output_size");M&&y.push(M),k+=P},I=M=>/[\s"'\\$`!*?[\]{}();&|<>#]/.test(M)?`"${M.replace(/([\\"`$])/g,"\\$1")}"`:M,$=async M=>{if(++w>h)throw new T(`xargs: iteration limit exceeded (${h})`,"iterations");if(M.length>f)throw new T(`xargs: array element limit exceeded (${f})`,"array_elements");for(let P of M)if(K(P)>d)throw new T(`xargs: string length limit exceeded (${d} bytes)`,"string_length");if(o){let P=M.map(I).join(" ");R(`${P} `)}return t.exec?t.exec(Ga([M[0]]),{cwd:t.cwd,signal:t.signal,args:M.slice(1)}):{stdout:`${M.map(I).join(" ")} `,stderr:"",exitCode:0}},_=async M=>{if(a!==null&&a>1)for(let P=0;Ph)throw new T(`xargs: iteration limit exceeded (${h})`,"iterations");if(r.length===0)return{stdout:"",stderr:`xargs: replacement string must not be empty `,exitCode:1};if(c.length>0&&g.length>Math.floor(f/c.length))throw new T(`xargs: array element limit exceeded (${f})`,"array_elements");let M=(S,D)=>{let W=0,j=0;for(;j=S.indexOf(r,j),j!==-1;)W++,j+=r.length;if(K(S)+W*(K(D)-K(r))>d)throw new T(`xargs: string length limit exceeded (${d} bytes)`,"string_length");return S.replaceAll(r,D)},P=g.map(S=>c.map(D=>M(D,S)));await _(P)}else if(i!==null){let M=[],P=Math.ceil(g.length/i);if(P>Math.min(f,h))throw new T(`xargs: iteration limit exceeded (${h})`,"iterations");if(g.length+P*c.length>f)throw new T(`xargs: array element limit exceeded (${f})`,"array_elements");for(let S=0;SQ9,falseFlagsForFuzzing:()=>Y9,flagsForFuzzing:()=>K9,trueCommand:()=>X9});var X9,Q9,K9,Y9,Bb=q(()=>{"use strict";X9={name:"true",async execute(){return{stdout:"",stderr:"",exitCode:0}}},Q9={name:"false",async execute(){return{stdout:"",stderr:"",exitCode:1}}},K9={name:"true",flags:[]},Y9={name:"false",flags:[]}}),J9={};ce(J9,{flagsForFuzzing:()=>t5,yesCommand:()=>e5});var Ub,e5,t5,UR=q(()=>{"use strict";Yt(),ge(),be(),Ub={name:"yes",summary:"output a string repeatedly",usage:"yes [STRING]...",description:["Repeatedly output a line with all specified STRING(s), or 'y'."],options:[" --help display this help and exit"],notes:["Real yes writes until its reader goes away. Pipelines here are not","streaming \u2014 a stage runs to completion before the next one starts \u2014 so","yes stops on its own after executionLimits.maxLoopIterations lines, or","earlier if the repeated line would exceed the output size limit.","`yes | head -3` therefore behaves as expected; an unbounded consumer","sees a finite stream."]},e5={name:"yes",async execute(e,t){let r=[],n=!1;for(let l of e){if(n){r.push(l);continue}if(l==="--"){n=!0;continue}if(l==="--help")return we(Ub);if(l.startsWith("--"))return Le("yes",l);if(l.startsWith("-")&&l!=="-")return Le("yes",`-${l[1]}`);r.push(l)}let i=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),a=r.length>0?`${Wa(r," ",i,"yes")} `:`y `,s=Math.floor(i/K(a)),o=Math.min(t.limits.maxLoopIterations,Math.max(1,s));return{stdout:hO(a,o,i,"yes"),stderr:"",exitCode:0}}},t5={name:"yes",flags:[]}}),r5={};ce(r5,{clearCommand:()=>n5,flagsForFuzzing:()=>i5});var zb,n5,i5,zR=q(()=>{"use strict";be(),zb={name:"clear",summary:"clear the terminal screen",usage:"clear [OPTIONS]",options:[" --help display this help and exit"]},n5={name:"clear",async execute(e,t){return Ce(e)?we(zb):{stdout:"\x1B[2J\x1B[H",stderr:"",exitCode:0}}},i5={name:"clear",flags:[]}}),l1={};ce(l1,{bashCommand:()=>a5,flagsForFuzzing:()=>o5,shCommand:()=>s5,shFlagsForFuzzing:()=>l5});async function Es(e,t,r,n){if(!n.exec)return{stdout:"",stderr:`bash: internal error: exec function not available `,exitCode:1};let i=Sc(n.exportedEnv??Object.create(null),{0:t,"#":String(r.length),"@":r.join(" "),"*":r.join(" ")});r.forEach((o,l)=>{i[String(l+1)]=o});let a=e;if(a.startsWith("#!")){let o=a.indexOf(` `);o!==-1&&(a=a.slice(o+1))}let s=n.execWithInheritedStdin;return s?await s(a,{env:i,newShell:!0,cwd:n.cwd,signal:n.signal}):await n.exec(a,{env:i,newShell:!0,cwd:n.cwd,stdin:n.stdin,stdinKind:"bytes",signal:n.signal})}var Jd,a5,s5,o5,l5,qb=q(()=>{"use strict";ge(),ia(),be(),Jd={name:"bash",summary:"execute shell commands or scripts",usage:"bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]",options:["-c COMMAND execute COMMAND string"," --help display this help and exit"],notes:["Without -c, reads and executes commands from SCRIPT_FILE.","Arguments are passed as $1, $2, etc. to the script.",'$0 is set to the script name (or "bash" with -c).']},a5={name:"bash",async execute(e,t){if(Ce(e))return we(Jd);if(e[0]==="-c"&&e.length>=2){let i=e[1],a=e[2]||"bash",s=e.slice(3);return Es(i,a,s,t)}if(e.length===0){let i=Ve(t.stdin);return i.trim()?Es(i,"bash",[],t):{stdout:"",stderr:"",exitCode:0}}let r=e[0],n=e.slice(1);try{let i=t.fs.resolvePath(t.cwd,r),a=await t.fs.readFile(i);return Es(a,r,n,t)}catch{return{stdout:"",stderr:`bash: ${r}: No such file or directory `,exitCode:127}}}},s5={name:"sh",async execute(e,t){if(Ce(e))return we({...Jd,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(e[0]==="-c"&&e.length>=2){let i=e[1],a=e[2]||"sh",s=e.slice(3);return Es(i,a,s,t)}if(e.length===0){let i=Ve(t.stdin);return i.trim()?Es(i,"sh",[],t):{stdout:"",stderr:"",exitCode:0}}let r=e[0],n=e.slice(1);try{let i=t.fs.resolvePath(t.cwd,r),a=await t.fs.readFile(i);return Es(a,r,n,t)}catch{return{stdout:"",stderr:`sh: ${r}: No such file or directory `,exitCode:127}}}},o5={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},l5={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"}});function Uo(e,t,r=1){let n=e.limits.maxArrayElements;if(r<0||t>n-r)throw new T(`query result element limit exceeded (${n})`,"array_elements")}function qR(e,t,r,n,i,a,s,o,l,u){switch(t){case"sort":return Array.isArray(e)?[[...e].sort(s)]:[null];case"sort_by":return!Array.isArray(e)||r.length===0?[null]:[[...e].sort((c,p)=>{let d=i(c,r[0],n)[0],f=i(p,r[0],n)[0];return s(d,f)})];case"bsearch":{if(!Array.isArray(e)){let c=e===null?"null":typeof e=="object"?"object":typeof e;throw new Error(`${c} (${JSON.stringify(e)}) cannot be searched from`)}return r.length===0?[null]:i(e,r[0],n).map(c=>{let p=0,d=e.length;for(;p>>1;s(e[f],c)<0?p=f+1:d=f}return ps(d.key,f.key)),[p.map(d=>d.item)]}case"group_by":{if(!Array.isArray(e)||r.length===0)return[null];let c=new Map;for(let p of e){let d=JSON.stringify(i(p,r[0],n)[0]);c.has(d)||c.set(d,[]),c.get(d)?.push(p)}return[[...c.values()]]}case"max":return Array.isArray(e)&&e.length>0?[e.reduce((c,p)=>s(c,p)>0?c:p)]:[null];case"max_by":return!Array.isArray(e)||e.length===0||r.length===0?[null]:[e.reduce((c,p)=>{let d=i(c,r[0],n)[0],f=i(p,r[0],n)[0];return s(d,f)>0?c:p})];case"min":return Array.isArray(e)&&e.length>0?[e.reduce((c,p)=>s(c,p)<0?c:p)]:[null];case"min_by":return!Array.isArray(e)||e.length===0||r.length===0?[null]:[e.reduce((c,p)=>{let d=i(c,r[0],n)[0],f=i(p,r[0],n)[0];return s(d,f)<0?c:p})];case"add":{let c=p=>{let d=p.filter(f=>f!==null);return d.length===0?null:d.every(f=>typeof f=="number")?d.reduce((f,h)=>f+h,0):d.every(f=>typeof f=="string")?d.join(""):d.every(f=>Array.isArray(f))?d.flat():d.every(f=>f&&typeof f=="object"&&!Array.isArray(f))?Sc(...d):null};if(r.length>=1){let p=i(e,r[0],n);return[c(p)]}return Array.isArray(e)?[c(e)]:[null]}case"any":{if(r.length>=2){try{let c=a(e,r[0],n);for(let p of c)if(i(p,r[1],n).some(o))return[!0]}catch(c){if(c instanceof u)throw c}return[!1]}return r.length===1?Array.isArray(e)?[e.some(c=>o(i(c,r[0],n)[0]))]:[!1]:Array.isArray(e)?[e.some(o)]:[!1]}case"all":{if(r.length>=2){try{let c=a(e,r[0],n);for(let p of c)if(!i(p,r[1],n).some(o))return[!1]}catch(c){if(c instanceof u)throw c}return[!0]}return r.length===1?Array.isArray(e)?[e.every(c=>o(i(c,r[0],n)[0]))]:[!0]:Array.isArray(e)?[e.every(o)]:[!0]}case"select":return r.length===0?[e]:i(e,r[0],n).some(o)?[e]:[];case"map":{if(r.length===0||!Array.isArray(e))return[null];Uo(n,0,e.length);let c=[];for(let p of e){let d=i(p,r[0],n);Uo(n,c.length,d.length);for(let f of d)c.push(f)}return[c]}case"map_values":{if(r.length===0)return[null];if(Array.isArray(e)){Uo(n,0,e.length);let c=[];for(let p of e){let d=i(p,r[0],n);Uo(n,c.length,d.length);for(let f of d)c.push(f)}return[c]}if(e&&typeof e=="object"){let c=Object.create(null),p=Object.keys(e);Uo(n,0,p.length);for(let d of p){if(!kt(d))continue;let f=e[d],h=i(f,r[0],n);h.length>0&&$t(c,d,h[0])}return[c]}return[null]}case"has":{if(r.length===0)return[!1];let c=i(e,r[0],n)[0];return Array.isArray(e)&&typeof c=="number"?[c>=0&&c=0&&e{"use strict";ia(),J(),hi()});function WR(e,t,r,n,i,a,s,o){switch(t){case"first":if(r.length>0)try{let l=a(e,r[0],n);return l.length>0?[l[0]]:[]}catch(l){if(l instanceof o)throw l;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case"last":if(r.length>0){let l=i(e,r[0],n);return l.length>0?[l[l.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case"nth":{if(r.length<1)return[null];let l=i(e,r[0],n);if(r.length>1){for(let c of l)if(c<0)throw new Error("nth doesn't support negative indices");let u;try{u=a(e,r[1],n)}catch(c){if(c instanceof o)throw c;u=[]}return l.flatMap(c=>{let p=c;return p{let c=u;if(c<0)throw new Error("nth doesn't support negative indices");return c{if(h.length>=l)throw new o(`query result element limit exceeded (${l})`,"array_elements");h.push(m)},c=i(e,r[0],n);if(r.length===1){let h=[];for(let m of c){let g=m;for(let x=0;x0)for(let k=x;ky;k+=b)u(f,k)}return f}case"limit":return r.length<2?[]:i(e,r[0],n).flatMap(l=>{let u=l;if(u<0)throw new Error("limit doesn't support negative count");if(u===0)return[];let c;try{c=a(e,r[1],n)}catch(p){if(p instanceof o)throw p;c=[]}return c.slice(0,u)});case"isempty":{if(r.length<1)return[!0];try{return[a(e,r[0],n).length===0]}catch(l){if(l instanceof o)throw l;return[!0]}}case"isvalid":{if(r.length<1)return[!0];try{return[i(e,r[0],n).length>0]}catch(l){if(l instanceof o)throw l;return[!1]}}case"skip":return r.length<2?[]:i(e,r[0],n).flatMap(l=>{let u=l;if(u<0)throw new Error("skip doesn't support negative count");return i(e,r[1],n).slice(u)});case"until":{if(r.length<2)return[e];let l=e,u=n.limits.maxIterations;for(let c=0;c=c)throw new o(`jq while: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations");return l}case"repeat":{if(r.length===0)return[e];let l=[],u=e,c=n.limits.maxIterations;for(let p=0;p=c)throw new o(`jq repeat: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations");return l}default:return null}}var jR=q(()=>{"use strict"});function eh(e,t){if(!Number.isFinite(e)||Math.abs(e)>864e10)throw new Error(`${t} timestamp is outside the supported range`);return new Date(e*1e3)}function Hb(e){let t=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(!t)return null;let[,r,n,i,a,s,o]=t.map(Number),l=Date.UTC(r,n-1,i,a,s,o);if(!Number.isFinite(l))return null;let u=new Date(l);return u.getUTCFullYear()!==r||u.getUTCMonth()!==n-1||u.getUTCDate()!==i||u.getUTCHours()!==a||u.getUTCMinutes()!==s||u.getUTCSeconds()!==o?null:u}function GR(e,t,r,n,i){switch(t){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof e!="number")return[null];let a=eh(e,"gmtime"),s=a.getUTCFullYear(),o=a.getUTCMonth(),l=a.getUTCDate(),u=a.getUTCHours(),c=a.getUTCMinutes(),p=a.getUTCSeconds(),d=a.getUTCDay(),f=Date.UTC(s,0,1),h=Math.floor((a.getTime()-f)/(1440*60*1e3));return[[s,o,l,u,c,p,d,h]]}case"mktime":{if(!Array.isArray(e))throw new Error("mktime requires parsed datetime inputs");let[a,s,o,l=0,u=0,c=0]=e;if(typeof a!="number"||typeof s!="number")throw new Error("mktime requires parsed datetime inputs");let p=Date.UTC(a,s,o??1,l??0,u??0,c??0);return[Math.floor(p/1e3)]}case"strftime":{if(r.length===0)return[null];let a=i(e,r[0],n)[0];if(typeof a!="string")throw new Error("strftime/1 requires a string format");let s;if(typeof e=="number")s=eh(e,"strftime");else if(Array.isArray(e)){let[c,p,d,f=0,h=0,m=0]=e;if(typeof c!="number"||typeof p!="number")throw new Error("strftime/1 requires parsed datetime inputs");s=new Date(Date.UTC(c,p,d??1,f??0,h??0,m??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let o=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["January","February","March","April","May","June","July","August","September","October","November","December"],u=(c,p=2)=>String(c).padStart(p,"0");return[a.replace(/%Y/g,String(s.getUTCFullYear())).replace(/%m/g,u(s.getUTCMonth()+1)).replace(/%d/g,u(s.getUTCDate())).replace(/%H/g,u(s.getUTCHours())).replace(/%M/g,u(s.getUTCMinutes())).replace(/%S/g,u(s.getUTCSeconds())).replace(/%A/g,o[s.getUTCDay()]).replace(/%B/g,l[s.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(r.length===0)return[null];if(typeof e!="string")throw new Error("strptime/1 requires a string input");let a=i(e,r[0],n)[0];if(typeof a!="string")throw new Error("strptime/1 requires a string format");if(a!==u1)throw new Error(`strptime format is not supported: ${a}`);let s=Hb(e);if(s){let o=s.getUTCFullYear(),l=s.getUTCMonth(),u=s.getUTCDate(),c=s.getUTCHours(),p=s.getUTCMinutes(),d=s.getUTCSeconds(),f=s.getUTCDay(),h=Date.UTC(o,0,1),m=Math.floor((s.getTime()-h)/(1440*60*1e3));return[[o,l,u,c,p,d,f,m]]}throw new Error(`Cannot parse date: ${e}`)}case"fromdate":{if(typeof e!="string")throw new Error("fromdate requires a string input");let a=Hb(e);if(!a)throw new Error(`date "${e}" does not match format "${u1}"`);return[Math.floor(a.getTime()/1e3)]}case"todate":{if(typeof e!="number")throw new Error("todate requires a number input");return[eh(e,"todate").toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}var u1,VR=q(()=>{"use strict";u1="%Y-%m-%dT%H:%M:%SZ"});function zn(e){return e!==!1&&e!==null}function ll(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Pu(e,t){return typeof e=="number"&&typeof t=="number"?e-t:typeof e=="string"&&typeof t=="string"?e.localeCompare(t):0}function ZR(e,t,r={}){let n=r.maxDepth??2e3,i=Er(e),a=[{target:i,source:t,depth:0}];for(;a.length>0;){let s=a.pop();if(!s)break;if(s.depth>n)throw new T(`query depth limit exceeded (${n})`,"recursion");for(let o of Object.keys(s.source)){if(r.visit?.(),!kt(o))continue;let l=ep(s.target,o)?It(s.target[o]):null,u=It(s.source[o]);if(l&&u){let c=Er(l);$t(s.target,o,c),a.push({target:c,source:u,depth:s.depth+1})}else $t(s.target,o,s.source[o])}}return i}function ul(e,t=3e3){if(e===null||typeof e!="object")return 0;if(t<=1)return t;let r=(u,c)=>({value:u,keys:Array.isArray(u)?void 0:Object.keys(u),nextChild:0,pathDepth:c,maxChildDepth:0}),n=u=>u.keys!==void 0?u.keys.length:u.value.length,i=u=>{if(u.keys){let c=u.keys[u.nextChild++];return u.value[c]}return u.value[u.nextChild++]},a=new WeakMap,s=new WeakMap,o=e,l=[r(o,1)];for(a.set(o,"visiting");l.length>0;){let u=l[l.length-1];if(u.nextChild=t)return t;u.maxChildDepth=Math.max(u.maxChildDepth,g);continue}let h=u.pathDepth+1;if(h>=t)return t;let m=d;a.set(d,"visiting"),l.push(r(m,h));continue}let c=u.maxChildDepth+1;s.set(u.value,c),a.set(u.value,"done"),l.pop();let p=l.at(-1);if(p)p.maxChildDepth=Math.max(p.maxChildDepth,c);else return c}return 0}function c1(e,t){let r=o=>o===null?0:typeof o=="boolean"?1:typeof o=="number"?2:typeof o=="string"?3:Array.isArray(o)?4:typeof o=="object"?5:6,n=r(e),i=r(t);if(n!==i)return n-i;if(typeof e=="number"&&typeof t=="number")return e-t;if(typeof e=="string"&&typeof t=="string")return e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return(e?1:0)-(t?1:0);if(Array.isArray(e)&&Array.isArray(t)){for(let o=0;oe.some(a=>p1(a,i)));let r=It(e),n=It(t);return r&&n?Object.keys(n).every(i=>ep(r,i)&&p1(r[i],n[i])):!1}var ap=q(()=>{"use strict";J(),hi()});function XR(e){let t=[];for(let r=0;r{if(n===null)return"";if(typeof n=="boolean")return n?"true":"false";if(typeof n=="number")return String(n);let i=String(n);return i.includes(",")||i.includes('"')||i.includes(` `)||i.includes("\r")?`"${i.replace(/"/g,'""')}"`:i}).join(",")]:[null];case"@tsv":return Array.isArray(e)?[e.map(n=>String(n??"").replace(/\t/g,"\\t").replace(/\n/g,"\\n")).join(" ")]:[null];case"@json":{let n=r??u5;return ul(e,n+1)>n?[null]:[JSON.stringify(e)]}case"@html":return typeof e=="string"?[e.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")]:[null];case"@sh":return typeof e=="string"?[`'${e.replace(/'/g,"'\\''")}'`]:[null];case"@text":return typeof e=="string"?[e]:e==null?[""]:[String(e)];default:return null}}var u5,YR=q(()=>{"use strict";ap(),u5=2e3});function JR(e,t,r,n,i,a){switch(t){case"index":return r.length===0?[null]:i(e,r[0],n).map(s=>{if(typeof e=="string"&&typeof s=="string"){if(s===""&&e==="")return null;let o=e.indexOf(s);return o>=0?o:null}if(Array.isArray(e)){if(Array.isArray(s)){for(let l=0;l<=e.length-s.length;l++){let u=!0;for(let c=0;ca(l,s));return o>=0?o:null}return null});case"rindex":return r.length===0?[null]:i(e,r[0],n).map(s=>{if(typeof e=="string"&&typeof s=="string"){let o=e.lastIndexOf(s);return o>=0?o:null}if(Array.isArray(e)){if(Array.isArray(s)){for(let o=e.length-s.length;o>=0;o--){let l=!0;for(let u=0;u=0;o--)if(a(e[o],s))return o;return null}return null});case"indices":return r.length===0?[[]]:i(e,r[0],n).map(s=>{let o=[];if(typeof e=="string"&&typeof s=="string"){let l=e.indexOf(s);for(;l!==-1;)o.push(l),l=e.indexOf(s,l+1)}else if(Array.isArray(e))if(Array.isArray(s)){let l=s.length;if(l===0)for(let u=0;u<=e.length;u++)o.push(u);else for(let u=0;u<=e.length-l;u++){let c=!0;for(let p=0;p{"use strict"});function tL(e,t,r,n,i){switch(t){case"fabs":case"abs":return typeof e=="number"?[Math.abs(e)]:typeof e=="string"?[e]:[null];case"exp10":return typeof e=="number"?[10**e]:[null];case"exp2":return typeof e=="number"?[2**e]:[null];case"pow":{if(r.length<2)return[null];let a=i(e,r[0],n),s=i(e,r[1],n),o=a[0],l=s[0];return typeof o!="number"||typeof l!="number"?[null]:[o**l]}case"atan2":{if(r.length<2)return[null];let a=i(e,r[0],n),s=i(e,r[1],n),o=a[0],l=s[0];return typeof o!="number"||typeof l!="number"?[null]:[Math.atan2(o,l)]}case"hypot":{if(typeof e!="number"||r.length===0)return[null];let a=i(e,r[0],n)[0];return[Math.hypot(e,a)]}case"fma":{if(typeof e!="number"||r.length<2)return[null];let a=i(e,r[0],n)[0],s=i(e,r[1],n)[0];return[e*a+s]}case"copysign":{if(typeof e!="number"||r.length===0)return[null];let a=i(e,r[0],n)[0];return[Math.sign(a)*Math.abs(e)]}case"drem":case"remainder":{if(typeof e!="number"||r.length===0)return[null];let a=i(e,r[0],n)[0];return[e-Math.round(e/a)*a]}case"fdim":{if(typeof e!="number"||r.length===0)return[null];let a=i(e,r[0],n)[0];return[Math.max(0,e-a)]}case"fmax":{if(typeof e!="number"||r.length===0)return[null];let a=i(e,r[0],n)[0];return[Math.max(e,a)]}case"fmin":{if(typeof e!="number"||r.length===0)return[null];let a=i(e,r[0],n)[0];return[Math.min(e,a)]}case"ldexp":{if(typeof e!="number"||r.length===0)return[null];let a=i(e,r[0],n)[0];return[e*2**a]}case"scalbn":case"scalbln":{if(typeof e!="number"||r.length===0)return[null];let a=i(e,r[0],n)[0];return[e*2**a]}case"nearbyint":return typeof e=="number"?[Math.round(e)]:[null];case"logb":return typeof e=="number"?[Math.floor(Math.log2(Math.abs(e)))]:[null];case"significand":if(typeof e=="number"){let a=Math.floor(Math.log2(Math.abs(e)));return[e/2**a]}return[null];case"frexp":if(typeof e=="number"){if(e===0)return[[0,0]];let a=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**a,a]]}return[null];case"modf":if(typeof e=="number"){let a=Math.trunc(e);return[[e-a,a]]}return[null];default:return null}}var rL=q(()=>{"use strict"});function Ss(e){let t=e.limits.maxIterations;return{maxDepth:e.limits.maxDepth,maxResults:e.limits.maxArrayElements,maxIterations:t}}function Ds(e){throw new T(e,"array_elements")}function th(e,t){let r=1;for(let n of e){if(!Number.isSafeInteger(n)||n<0)throw new Error("combinations requires finite array lengths");n!==0&&r>Math.floor(t/n)&&Ds(`query combination limit exceeded (${t})`),r*=n}return r}function nL(e,t,r,n,i,a,s,o){switch(t){case"recurse":{let l=[],u=Ss(n),c=r.length>=2?r[1]:null,p=[{value:e,depth:0}],d=0;for(;p.length>0;){let f=p.pop();if(!f)break;if(++d>u.maxIterations)throw new T(`query iteration limit exceeded (${u.maxIterations})`,"iterations");if(f.depth>u.maxDepth)throw new T(`query depth limit exceeded (${u.maxDepth})`,"recursion");if(c&&!i(f.value,c,n).some(a))continue;l.length>=u.maxResults&&Ds(`query result element limit exceeded (${u.maxResults})`),l.push(f.value);let h=[];r.length===0?Array.isArray(f.value)?h=f.value:f.value&&typeof f.value=="object"&&(h=Object.keys(f.value).map(m=>f.value[m])):h=i(f.value,r[0],n).filter(m=>m!=null),p.length>u.maxResults-h.length&&Ds(`query traversal queue limit exceeded (${u.maxResults})`);for(let m=h.length-1;m>=0;m--)p.push({value:h[m],depth:f.depth+1})}return l}case"recurse_down":return o(e,"recurse",r,n);case"walk":{if(r.length===0)return[e];let l=Ss(n),u=new WeakSet,c=new WeakMap,p=[{value:e,depth:0,expanded:!1}],d=e,f=0;for(;p.length>0;){let h=p.pop();if(!h)break;if(++f>l.maxIterations)throw new T(`query iteration limit exceeded (${l.maxIterations})`,"iterations");if(h.depth>l.maxDepth)throw new T(`query depth limit exceeded (${l.maxDepth})`,"recursion");let m=h.value!==null&&typeof h.value=="object"?h.value:null;if(!h.expanded&&m){if(u.has(m))continue;u.add(m),p.push({...h,expanded:!0});let y=It(h.value),b=Array.isArray(h.value)?h.value:Object.keys(y??{}).map(k=>y?.[k]);p.length>l.maxResults-b.length&&Ds(`query traversal queue limit exceeded (${l.maxResults})`);for(let k=b.length-1;k>=0;k--)p.push({value:b[k],depth:h.depth+1,expanded:!1});continue}let g=h.value;if(Array.isArray(h.value))g=h.value.map(y=>y!==null&&typeof y=="object"?c.get(y)??y:y);else if(m){let y=Object.create(null),b=It(h.value);for(let k of Object.keys(b??{})){if(!kt(k))continue;let w=b?.[k];$t(y,k,w!==null&&typeof w=="object"?c.get(w)??w:w)}g=y}let x=i(g,r[0],n)[0];m&&c.set(m,x),h.depth===0&&(d=x)}return[d]}case"transpose":{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let l=Ss(n),u=0;for(let p of e)Array.isArray(p)&&(u=Math.max(u,p.length));th([e.length,u],l.maxResults);let c=[];for(let p=0;pArray.isArray(d)?d[p]:null));return[c]}case"combinations":{if(r.length>0){let f=i(e,r[0],n)[0];if(!Array.isArray(e))return[];if(!Number.isFinite(f)||!Number.isSafeInteger(f)||f<0)throw new Error("combinations length must be a finite non-negative integer");let h=Ss(n);if(f>h.maxDepth||f>h.maxResults)throw new T(`query depth limit exceeded (${h.maxDepth})`,"recursion");if(f===0)return h.maxResults<1&&Ds("query combination limit exceeded (0)"),[[]];let m=th(Array.from({length:f},()=>e.length),h.maxResults);if(m===0)return[];let g=[],x=new Array(f).fill(0);for(let y=0;ye[b]));for(let b=f-1;b>=0&&(x[b]++,!(x[b]l.maxDepth)throw new T(`query depth limit exceeded (${l.maxDepth})`,"recursion");let c=th(u.map(f=>f.length),l.maxResults);if(c===0)return[];let p=[],d=new Array(u.length).fill(0);for(let f=0;fu[m][h]));for(let h=u.length-1;h>=0&&(d[h]++,!(d[h]0?i(e,r[0],n)[0]:1;if(u>=0){if(u>l.length)return[];let c=l.slice(0,l.length-u);return[s(n.root,c)]}else{let c=-u-1;if(c>=l.length)return[e];let p=l.slice(0,c);return[s(n.root,p)]}}case"parents":{if(n.root===void 0||n.currentPath===void 0)return[[]];let l=n.currentPath,u=[];for(let c=l.length-1;c>=0;c--)u.push(s(n.root,l.slice(0,c)));return[u]}case"root":return n.root!==void 0?[n.root]:[];default:return null}}var iL=q(()=>{"use strict";J(),hi()});function Rr(e){return e.limits.maxArrayElements}function rh(e,t){let r=Object.create(null);return $t(r,"key",e),$t(r,"value",t),r}function Fu(e,t){let r=Rr(e);if(t>=r)throw new T(`query result element limit exceeded (${r})`,"array_elements")}function aL(e,t){let r=t.limits.maxDepth??Tc;if(e.length>r)throw new T(`query depth limit exceeded (${r})`,"recursion");let n=t.limits.maxArrayElements;for(let i of e)if(typeof i=="number"){if(!Number.isSafeInteger(i)||i<0||i>=n)throw new T(`query array index limit exceeded (${n})`,"array_elements")}else if(typeof i!="string")throw new Error("stream path components must be strings or integers")}function sL(e,t,r,n,i){switch(t){case"keys":return Array.isArray(e)?[e.map((a,s)=>s)]:e&&typeof e=="object"?[Object.keys(e).sort()]:[null];case"keys_unsorted":return Array.isArray(e)?[e.map((a,s)=>s)]:e&&typeof e=="object"?[Object.keys(e)]:[null];case"length":return typeof e=="string"?[e.length]:Array.isArray(e)?[e.length]:e&&typeof e=="object"?[Object.keys(e).length]:e===null?[0]:typeof e=="number"?[Math.abs(e)]:[null];case"utf8bytelength":{if(typeof e=="string")return[K(e)];let a=e===null?"null":Array.isArray(e)?"array":typeof e,s=a==="array"||a==="object"?JSON.stringify(e):String(e);throw new Error(`${a} (${s}) only strings have UTF-8 byte length`)}case"to_entries":{if(Array.isArray(e)){if(e.length>Rr(n))throw new T(`query result element limit exceeded (${Rr(n)})`,"array_elements");return[e.map((s,o)=>rh(o,s))]}let a=It(e);if(a){let s=Object.keys(a);if(s.length>Rr(n))throw new T(`query result element limit exceeded (${Rr(n)})`,"array_elements");return[s.map(o=>rh(o,a[o]))]}return[null]}case"from_entries":if(Array.isArray(e)){let a=Object.create(null);for(let s of e){let o=It(s);if(o){let l=o.key??o.Key??o.name??o.Name??o.k,u=o.value??o.Value??o.v;if(l!==void 0){let c=String(l);kt(c)&&$t(a,c,u)}}}return[a]}return[null];case"with_entries":{if(r.length===0)return[e];let a=It(e);if(a){let s=Object.keys(a);if(s.length>Rr(n))throw new T(`query result element limit exceeded (${Rr(n)})`,"array_elements");let o=[];for(let u of s){let c=rh(u,a[u]),p=i(c,r[0],n);if(o.length>Rr(n)-p.length)throw new T(`query result element limit exceeded (${Rr(n)})`,"array_elements");for(let d of p)o.push(d)}let l=Object.create(null);for(let u of o){let c=It(u);if(c){let p=c.key??c.name??c.k,d=c.value??c.v;if(p!==void 0){let f=String(p);kt(f)&&$t(l,f,d)}}}return[l]}return[null]}case"reverse":return Array.isArray(e)?[[...e].reverse()]:typeof e=="string"?[e.split("").reverse().join("")]:[null];case"flatten":return Array.isArray(e)?(r.length>0?i(e,r[0],n):[Number.POSITIVE_INFINITY]).map(a=>{let s=a;if(s<0)throw new Error("flatten depth must not be negative");return e.flat(s)}):[null];case"unique":if(Array.isArray(e)){let a=new Set,s=[];for(let o of e){let l=JSON.stringify(o);a.has(l)||(a.add(l),s.push(o))}return[s]}return[null];case"tojson":case"tojsonstream":{let a=n.limits.maxDepth??Tc;return ul(e,a+1)>a?[null]:[JSON.stringify(e)]}case"fromjson":{if(typeof e=="string"){let a=e.trim().toLowerCase();if(a==="nan")return[Number.NaN];if(a==="inf"||a==="infinity")return[Number.POSITIVE_INFINITY];if(a==="-inf"||a==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[Qu(JSON.parse(e),{maxDepth:n.limits.maxDepth,maxElements:n.limits.maxArrayElements})]}catch(s){throw s instanceof T?s:new Error(`Invalid JSON: ${e}`)}}return[e]}case"tostring":return typeof e=="string"?[e]:[JSON.stringify(e)];case"tonumber":if(typeof e=="number")return[e];if(typeof e=="string"){let a=e.trim()===""?Number.NaN:Number(e);if(Number.isNaN(a))throw new Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[a]}throw new Error(`${typeof e} cannot be parsed as a number`);case"toboolean":{if(typeof e=="boolean")return[e];if(typeof e=="string"){if(e==="true")return[!0];if(e==="false")return[!1];throw new Error(`string (${JSON.stringify(e)}) cannot be parsed as a boolean`)}let a=e===null?"null":Array.isArray(e)?"array":typeof e,s=a==="array"||a==="object"?JSON.stringify(e):String(e);throw new Error(`${a} (${s}) cannot be parsed as a boolean`)}case"tostream":{let a=[],s=n.limits.maxDepth??Tc,o=[{value:e,path:[]}],l=new WeakSet,u=0;for(;o.length>0;){let c=o.pop();if(!c)break;if(++u>n.limits.maxIterations)throw new T(`query iteration limit exceeded (${n.limits.maxIterations})`,"iterations");if(c.path.length>s)throw new T(`query depth limit exceeded (${s})`,"recursion");let p=c.value;if(p===null||typeof p!="object")Fu(n,a.length),a.push([c.path,p]);else if(Array.isArray(p)){if(l.has(p))throw new T("cyclic value cannot be converted to a stream","recursion");if(l.add(p),p.length===0)Fu(n,a.length),a.push([c.path,[]]);else{if(o.length>Rr(n)-p.length)throw new T(`query traversal queue limit exceeded (${Rr(n)})`,"array_elements");for(let d=p.length-1;d>=0;d--)o.push({value:p[d],path:[...c.path,d]})}}else{if(l.has(p))throw new T("cyclic value cannot be converted to a stream","recursion");l.add(p);let d=Object.keys(p);if(d.length===0)Fu(n,a.length),a.push([c.path,Object.create(null)]);else{if(o.length>Rr(n)-d.length)throw new T(`query traversal queue limit exceeded (${Rr(n)})`,"array_elements");for(let f=d.length-1;f>=0;f--){let h=d[f];o.push({value:p[h],path:[...c.path,h]})}}}}return Fu(n,a.length),a.push([[]]),a}case"fromstream":{if(r.length===0)return[e];let a=i(e,r[0],n);if(a.length>Rr(n))throw new T(`query stream item limit exceeded (${Rr(n)})`,"array_elements");let s=null,o=0;for(let l of a){if(!Array.isArray(l)||l.length===1&&Array.isArray(l[0])&&l[0].length===0||l.length!==2)continue;let[u,c]=l;if(!Array.isArray(u))continue;if(aL(u,n),u.length===0){s=c;continue}s===null&&(s=typeof u[0]=="number"?[]:Object.create(null));let p=s;for(let f=0;fn.limits.maxIterations-o)throw new T(`query iteration limit exceeded (${n.limits.maxIterations})`,"iterations");for(o+=Math.max(0,g);p.length<=h;)p.push(null);p[h]===null&&(p[h]=typeof m=="number"?[]:Object.create(null)),p=p[h]}else{let g=It(p);if(g){let x=String(h);if(!kt(x))continue;(g[x]===null||g[x]===void 0)&&$t(g,x,typeof m=="number"?[]:Object.create(null)),p=g[x]}}}let d=u[u.length-1];if(Array.isArray(p)&&typeof d=="number"){let f=d+1-p.length;if(f>n.limits.maxIterations-o)throw new T(`query iteration limit exceeded (${n.limits.maxIterations})`,"iterations");for(o+=Math.max(0,f);p.length<=d;)p.push(null);p[d]=c}else{let f=It(p);if(f){let h=String(d);kt(h)&&$t(f,h,c)}}}return[s]}case"truncate_stream":{let a=typeof e=="number"?Math.floor(e):0;if(r.length===0)return[];let s=[],o=i(e,r[0],n);for(let l of o)if(Array.isArray(l)){if(l.length===1&&Array.isArray(l[0])){let u=l[0];u.length>a&&s.push([u.slice(a)]);continue}if(l.length===2&&Array.isArray(l[0])){let u=l[0],c=l[1];u.length>a&&s.push([u.slice(a),c])}}return s}default:return null}}var Tc,oL=q(()=>{"use strict";ge(),J(),hi(),ap(),Tc=2e3});function Wb(e,t){if(!Array.isArray(e))throw new Error("path must be an array");let r=t.limits.maxDepth;if(e.length>r)throw new T(`query depth limit exceeded (${r})`,"recursion");let n=t.limits.maxArrayElements,i=0;for(let a of e)if(typeof a=="number"){if(!Number.isSafeInteger(a)||a<0||a>=n)throw new T(`query array index limit exceeded (${n})`,"array_elements");let s=a+1;if(i>n-s)throw new T(`query cumulative array allocation limit exceeded (${n})`,"array_elements");i+=s}else if(typeof a!="string")throw new Error("path components must be strings or integers");return Pr(t,i+e.length),e}function jb(e,t,r){let n=[],i=[{value:e,path:[],isRoot:!0}];for(;i.length>0;){let a=i.pop();if(!a)break;if(Pr(t),a.path.length>t.limits.maxDepth)throw new T(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");if(!(a.value!==null&&typeof a.value=="object")){(r||!a.isRoot)&&(cr(t,n.length),n.push(a.path));continue}!r&&!a.isRoot&&(cr(t,n.length),n.push(a.path));let s=Array.isArray(a.value)?a.value.map((o,l)=>[l,o]):Object.keys(a.value).map(o=>[o,a.value[o]]);cr(t,n.length,i.length+s.length);for(let o=s.length-1;o>=0;o--){let[l,u]=s[o],c=[...a.path,l];i.push({value:u,path:c,isRoot:!1})}}return n}function lL(e,t,r,n,i,a,s,o,l,u){switch(t){case"getpath":{if(r.length===0)return[null];let c=i(e,r[0],n),p=[];for(let d of c){let f=d,h=e;for(let m of f){if(h==null){h=null;break}if(Array.isArray(h)&&typeof m=="number")h=h[m];else if(typeof m=="string"){let g=It(h);if(!g||!Object.hasOwn(g,m)){h=null;break}h=g[m]}else{h=null;break}}p.push(h)}return p}case"setpath":{if(r.length<2)return[null];let c=i(e,r[0],n),p=Wb(c[0],n),d=i(e,r[1],n)[0];return[s(e,p,d)]}case"delpaths":{if(r.length===0)return[e];let c=i(e,r[0],n)[0],p=e;for(let d of c.sort((f,h)=>h.length-f.length))p=o(p,d);return[p]}case"path":{if(r.length===0)return[[]];let c=[];return u(e,r[0],n,[],c),c}case"del":return r.length===0?[e]:[l(e,r[0],n)];case"pick":{if(r.length===0)return[null];let c=[];for(let d of r)u(e,d,n,[],c);let p=null;for(let d of c){for(let h of d)if(typeof h=="number"&&h<0)throw new Error("Out of bounds negative array index");Wb(d,n);let f=e;for(let h of d){if(f==null)break;if(Array.isArray(f)&&typeof h=="number")f=f[h];else if(typeof h=="string"){let m=It(f);if(!m||!Object.hasOwn(m,h)){f=null;break}f=m[h]}else{f=null;break}}p=s(p,d,f)}return[p]}case"paths":{let c=jb(e,n,!1);return r.length>0?c.filter(p=>{let d=e;for(let f of p)if(Array.isArray(d)&&typeof f=="number")d=d[f];else if(typeof f=="string"){let h=It(d);if(!h||!Object.hasOwn(h,f))return!1;d=h[f]}else return!1;return i(d,r[0],n).some(a)}):c}case"leaf_paths":return jb(e,n,!0);default:return null}}var uL=q(()=>{"use strict";J(),m5(),hi()});function cL(e,t,r,n,i,a){switch(t){case"IN":{if(r.length===0)return[!1];if(r.length===1){let u=i(e,r[0],n);for(let c of u)if(a(e,c))return[!0];return[!1]}let s=i(e,r[0],n),o=i(e,r[1],n),l=new Set(o.map(u=>JSON.stringify(u)));for(let u of s)if(l.has(JSON.stringify(u)))return[!0];return[!1]}case"INDEX":{if(r.length===0)return[Object.create(null)];if(r.length===1){let l=i(e,r[0],n),u=Object.create(null);for(let c of l){let p=String(c);kt(p)&&$t(u,p,c)}return[u]}if(r.length===2){let l=i(e,r[0],n),u=Object.create(null);for(let c of l){let p=i(c,r[1],n);if(p.length>0){let d=String(p[0]);kt(d)&&$t(u,d,c)}}return[u]}let s=i(e,r[0],n),o=Object.create(null);for(let l of s){let u=i(l,r[1],n),c=i(l,r[2],n);if(u.length>0&&c.length>0){let p=String(u[0]);kt(p)&&$t(o,p,c[0])}}return[o]}case"JOIN":{if(r.length<2)return[null];let s=It(i(e,r[0],n)[0]);if(!s)return[null];if(!Array.isArray(e))return[null];let o=[];for(let l of e){let u=i(l,r[1],n),c=u.length>0?String(u[0]):"",p=ep(s,c)?s[c]:null;o.push([l,p])}return[o]}default:return null}}var pL=q(()=>{"use strict";hi()});function c5(e){return e.limits.maxArrayElements}function Gb(e){return Math.min(e.limits.maxStringLength,e.limits.maxOutputSize)}function va(e,t){let r=c5(e);if(!Number.isSafeInteger(t)||t<0||t>r)throw new T(`query result element limit exceeded (${r})`,"array_elements")}function fL(e,t,r){if(e==="")return t===""?0:1;if(t==="")return e.length;let n=1,i=0;for(;;){let a=e.indexOf(t,i);if(a<0||(n++,n>r))return n;i=a+t.length}}function dL(e,t,r,n,i){switch(t){case"join":{if(!Array.isArray(e))return[null];let a=r.length>0?i(e,r[0],n):[""];for(let s of e)if(Array.isArray(s)||s!==null&&typeof s=="object")throw new Error("cannot join: contains arrays or objects");return va(n,a.length),a.map(s=>{let o=String(s),l=0;for(let u=0;u0&&(l+=K(o)),l>Gb(n))throw new T(`query string size limit exceeded (${Gb(n)} bytes)`,"string_length")}return e.map(u=>u===null?"":typeof u=="string"?u:String(u)).join(o)})}case"split":{if(typeof e!="string"||r.length===0)return[null];let a=i(e,r[0],n),s=String(a[0]);return va(n,fL(e,s,c5(n))),[e.split(s)]}case"splits":{if(typeof e!="string"||r.length===0)return[];let a=i(e,r[0],n),s=String(a[0]);try{let o=r.length>1?String(i(e,r[1],n)[0]):"g",l=Ie(s,o.includes("g")?o:`${o}g`),u=1;for(let p of l.matchAll(e))u+=Math.max(1,p.length),va(n,u);let c=l.split(e);return va(n,c.length),c}catch(o){if(o instanceof T)throw o;return[]}}case"scan":{if(typeof e!="string"||r.length===0)return[];let a=i(e,r[0],n),s=String(a[0]);try{let o=r.length>1?String(i(e,r[1],n)[0]):"",l=Ie(s,o.includes("g")?o:`${o}g`),u=[];for(let c of l.matchAll(e))va(n,u.length+1),c.length>1?(va(n,c.length-1),u.push(c.slice(1))):u.push(c[0]);return u}catch(o){if(o instanceof T)throw o;return[]}}case"test":{if(typeof e!="string"||r.length===0)return[!1];let a=i(e,r[0],n),s=String(a[0]);try{let o=r.length>1?String(i(e,r[1],n)[0]):"";return[Ie(s,o).test(e)]}catch{return[!1]}}case"match":{if(typeof e!="string"||r.length===0)return[null];let a=i(e,r[0],n),s=String(a[0]);try{let o=r.length>1?String(i(e,r[1],n)[0]):"",l=Ie(s,`${o}d`).exec(e);if(!l)return[];let u=l.indices;return[{offset:l.index,length:l[0].length,string:l[0],captures:l.slice(1).map((c,p)=>({offset:u?.[p+1]?.[0]??null,length:c?.length??0,string:c??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof e!="string"||r.length===0)return[null];let a=i(e,r[0],n),s=String(a[0]);try{let o=r.length>1?String(i(e,r[1],n)[0]):"",l=Ie(s,o).match(e);return!l||!l.groups?[Object.create(null)]:[l.groups]}catch{return[null]}}case"sub":{if(typeof e!="string"||r.length<2)return[null];let a=i(e,r[0],n),s=i(e,r[1],n),o=String(a[0]),l=String(s[0]);try{let u=r.length>2?String(i(e,r[2],n)[0]):"";return[Ie(o,u).replace(e,l)]}catch{return[e]}}case"gsub":{if(typeof e!="string"||r.length<2)return[null];let a=i(e,r[0],n),s=i(e,r[1],n),o=String(a[0]),l=String(s[0]);try{let u=r.length>2?String(i(e,r[2],n)[0]):"g",c=u.includes("g")?u:`${u}g`;return[Ie(o,c).replace(e,l)]}catch{return[e]}}case"ascii_downcase":return typeof e=="string"?[e.replace(/[A-Z]/g,a=>String.fromCharCode(a.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof e=="string"?[e.replace(/[a-z]/g,a=>String.fromCharCode(a.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof e!="string"||r.length===0)return[e];let a=i(e,r[0],n),s=String(a[0]);return[e.startsWith(s)?e.slice(s.length):e]}case"rtrimstr":{if(typeof e!="string"||r.length===0)return[e];let a=i(e,r[0],n),s=String(a[0]);return s===""?[e]:[e.endsWith(s)?e.slice(0,-s.length):e]}case"trimstr":{if(typeof e!="string"||r.length===0)return[e];let a=i(e,r[0],n),s=String(a[0]);if(s==="")return[e];let o=e;return o.startsWith(s)&&(o=o.slice(s.length)),o.endsWith(s)&&(o=o.slice(0,-s.length)),[o]}case"trim":if(typeof e=="string")return[e.trim()];throw new Error("trim input must be a string");case"ltrim":if(typeof e=="string")return[e.trimStart()];throw new Error("trim input must be a string");case"rtrim":if(typeof e=="string")return[e.trimEnd()];throw new Error("trim input must be a string");case"startswith":{if(typeof e!="string"||r.length===0)return[!1];let a=i(e,r[0],n);return[e.startsWith(String(a[0]))]}case"endswith":{if(typeof e!="string"||r.length===0)return[!1];let a=i(e,r[0],n);return[e.endsWith(String(a[0]))]}case"ascii":return typeof e=="string"&&e.length>0?[e.charCodeAt(0)]:[null];case"explode":if(typeof e=="string"){let a=0;for(let s of e)a++,va(n,a);return[Array.from(e).map(s=>s.codePointAt(0))]}return[null];case"implode":if(!Array.isArray(e))throw new Error("implode input must be an array");return[e.map(a=>{if(typeof a=="string")throw new Error(`string (${JSON.stringify(a)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof a!="number"||Number.isNaN(a))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let s=Math.trunc(a);return s<0||s>1114111||s>=55296&&s<=57343?String.fromCodePoint(65533):String.fromCodePoint(s)}).join("")];default:return null}}var hL=q(()=>{"use strict";J(),Dt(),ir()});function mL(e,t){switch(t){case"type":return e===null?["null"]:Array.isArray(e)?["array"]:typeof e=="boolean"?["boolean"]:typeof e=="number"?["number"]:typeof e=="string"?["string"]:typeof e=="object"?["object"]:["null"];case"infinite":return[Number.POSITIVE_INFINITY];case"nan":return[Number.NaN];case"isinfinite":return[typeof e=="number"&&!Number.isFinite(e)];case"isnan":return[typeof e=="number"&&Number.isNaN(e)];case"isnormal":return[typeof e=="number"&&Number.isFinite(e)&&e!==0];case"isfinite":return[typeof e=="number"&&Number.isFinite(e)];case"numbers":return typeof e=="number"?[e]:[];case"strings":return typeof e=="string"?[e]:[];case"booleans":return typeof e=="boolean"?[e]:[];case"nulls":return e===null?[e]:[];case"arrays":return Array.isArray(e)?[e]:[];case"objects":return e&&typeof e=="object"&&!Array.isArray(e)?[e]:[];case"iterables":return Array.isArray(e)||e&&typeof e=="object"&&!Array.isArray(e)?[e]:[];case"scalars":return!Array.isArray(e)&&!(e&&typeof e=="object")?[e]:[];case"values":return e===null?[]:[e];case"not":return e===!1||e===null?[!0]:[!1];case"null":return[null];case"true":return[!0];case"false":return[!1];case"empty":return[];default:return null}}var gL=q(()=>{"use strict"}),xL=q(()=>{"use strict";HR(),jR(),VR(),YR(),eL(),rL(),iL(),oL(),uL(),pL(),hL(),gL()});function f1(e,t,r){if(t.length===0)return r;let[n,...i]=t;if(typeof n=="number"){if(e&&typeof e=="object"&&!Array.isArray(e))throw new Error("Cannot index object with number");if(n>536870911)throw new Error("Array index too large");if(n<0)throw new Error("Out of bounds negative array index");let l=Array.isArray(e)?[...e]:[];for(;l.length<=n;)l.push(null);return l[n]=f1(l[n],i,r),l}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!kt(n))return e??Object.create(null);let a=It(e),s=a?Er(a):Object.create(null),o=Object.hasOwn(s,n)?s[n]:void 0;return $t(s,n,f1(o,i,r)),s}function d1(e,t){if(t.length===0)return null;if(t.length===1){let i=t[0];if(Array.isArray(e)&&typeof i=="number"){let a=[...e];return a.splice(i,1),a}if(e&&typeof e=="object"&&!Array.isArray(e)){let a=String(i);if(!kt(a))return e;let s=Er(e);return delete s[a],s}return e}let[r,...n]=t;if(Array.isArray(e)&&typeof r=="number"){let i=[...e];return i[r]=d1(i[r],n),i}if(e&&typeof e=="object"&&!Array.isArray(e)){let i=String(r);if(!kt(i))return e;let a=Er(e);return Object.hasOwn(a,i)&&$t(a,i,d1(a[i],n)),a}return e}var yL=q(()=>{"use strict";hi()});function Za(e,t){return new T(e,t)}function Pr(e,t=1){if(!Number.isSafeInteger(t)||t<0||e.budget.operations>e.limits.maxIterations-t)throw Za(`query evaluation: too many iterations (${e.limits.maxIterations})`,"iterations");e.budget.operations+=t}function cr(e,t,r=1){let n=e.limits.maxArrayElements;if(!Number.isSafeInteger(t)||!Number.isSafeInteger(r)||t<0||r<0||t>n-r)throw Za(`query result element limit exceeded (${n})`,"array_elements")}function Ma(e,t,r){cr(e,t.length,r.length);for(let n of r)t.push(n)}function xn(e,t,r){let n=[];for(let i of t){Pr(e);let a=r(i);Ma(e,n,a)}return n}function bL(e){let t=new Map;if(e?.namedArgs)for(let[r,n]of e.namedArgs)t.set(`$${r}`,n);return{vars:t,limits:{maxIterations:e?.limits?.maxIterations??d5,maxDepth:e?.limits?.maxDepth??N0,maxStringLength:e?.limits?.maxStringLength??m1,maxOutputSize:e?.limits?.maxOutputSize??m1,maxArrayElements:e?.limits?.maxArrayElements??1e5},env:e?.env,namedArgs:e?.namedArgs,positionalArgs:e?.positionalArgs,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1,budget:e?.budget??{operations:0,callDepth:0}}}function _c(e,t,r){let n=new Map(e.vars);return n.set(t,r),{vars:n,limits:e.limits,env:e.env,namedArgs:e.namedArgs,positionalArgs:e.positionalArgs,requireDefenseContext:e.requireDefenseContext,defenseContextChecked:e.defenseContextChecked,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage,budget:e.budget}}function el(e,t,r){switch(t.type){case"var":return _c(e,t.name,r);case"array":{if(!Array.isArray(r))return null;let n=e;for(let i=0;i0&&t.args[0].type==="Literal"){let n=t.args[0].value;typeof n=="number"&&(r=n)}if(r>=0)return e.slice(0,Math.max(0,e.length-r));{let n=-r-1;return e.slice(0,Math.min(n,e.length))}}if(t.name==="root")return[]}if(t.type==="Field"){let r=_i(t);if(r!==null)return[...e,...r]}if(t.type==="Index"&&t.index.type==="Literal"){let r=_i(t);if(r!==null)return[...e,...r]}if(t.type==="Pipe"){let r=h1(e,t.left);return r===null?null:h1(r,t.right)}return t.type==="Identity"?e:null}function Vb(e,t,r){if(t.type==="Comma"){let n=[];try{let i=se(e,t.left,r);Ma(r,n,i)}catch(i){if(i instanceof T)throw i;if(n.length>0)return n;throw new Error("evaluation failed")}try{let i=se(e,t.right,r);Ma(r,n,i)}catch(i){if(i instanceof T)throw i;return n}return n}return se(e,t,r)}function se(e,t,r){let n=r&&"vars"in r?r:bL(r);if(n.defenseContextChecked||(Gr(n.requireDefenseContext,"query-engine","evaluation"),n={...n,defenseContextChecked:!0}),n.root===void 0&&(n={...n,root:e,currentPath:[]}),Pr(n),n.budget.callDepth++,n.budget.callDepth>n.limits.maxDepth)throw n.budget.callDepth--,Za(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");try{let i=vL(e,t,n);return cr(n,0,i.length),i}finally{n.budget.callDepth--}}function vL(e,t,r){switch(r.coverage?.hit(`jq:node:${t.type}`),t.type){case"Identity":return[e];case"Field":{let n=t.base?se(e,t.base,r):[e];return xn(r,n,i=>{let a=It(i);if(a){if(!Object.hasOwn(a,t.name))return[null];let o=a[t.name];return[o===void 0?null:o]}if(i===null)return[null];let s=Array.isArray(i)?"array":typeof i;throw new Error(`Cannot index ${s} with string "${t.name}"`)})}case"Index":{let n=se(e,t.index,r);if(n.length===0)return[];let i=t.base?se(e,t.base,r):[e];return xn(r,n,a=>xn(r,i,s=>{if(typeof a=="number"&&Array.isArray(s)){if(Number.isNaN(a))return[null];let o=Math.trunc(a),l=o<0?s.length+o:o;return l>=0&&l{if(i===null)return[null];if(!Array.isArray(i)&&typeof i!="string")throw new Error(`Cannot slice ${typeof i} (${JSON.stringify(i)})`);let a=i.length,s=t.start?se(e,t.start,r):[0],o=t.end?se(e,t.end,r):[a];return cr(r,0,s.length*o.length),xn(r,s,l=>o.map(u=>{let c=l,p=u,d=Number.isNaN(c)?0:Number.isInteger(c)?c:Math.floor(c),f=Number.isNaN(p)?a:Number.isInteger(p)?p:Math.ceil(p),h=Zb(d,a),m=Zb(f,a);return Array.isArray(i),i.slice(h,m)}))})}case"Iterate":{let n=t.base?se(e,t.base,r):[e];return xn(r,n,i=>Array.isArray(i)?i:i&&typeof i=="object"?Object.values(i):[])}case"Pipe":{let n=se(e,t.left,r),i=_i(t.left),a=[];for(let s of n)try{if(i!==null){let o={...r,currentPath:[...r.currentPath??[],...i]},l=se(s,t.right,o);Ma(r,a,l)}else{let o=se(s,t.right,r);Ma(r,a,o)}}catch(o){throw o instanceof Ko?o.withPrependedResults(a):o}return a}case"Comma":{let n=se(e,t.left,r),i=se(e,t.right,r);return cr(r,n.length,i.length),[...n,...i]}case"Literal":return[t.value];case"Array":return t.elements?[se(e,t.elements,r)]:[[]];case"Object":{let n=[Object.create(null)];for(let i of t.entries){let a=typeof i.key=="string"?[i.key]:se(e,i.key,r),s=se(e,i.value,r),o=[],l=a.filter(p=>typeof p=="string"&&kt(p)).length,u=l+(a.length-l),c=n.length*u*s.length;cr(r,0,c);for(let p of n)for(let d of a){if(typeof d!="string"){let f=d===null?"null":Array.isArray(d)?"array":typeof d;throw new Error(`Cannot use ${f} (${JSON.stringify(d)}) as object key`)}if(!kt(d)){for(let f of s)o.push(Er(p));continue}for(let f of s){let h=Er(p);$t(h,d,f),o.push(h)}}n.length=0,Ma(r,n,o)}return n}case"Paren":return se(e,t.expr,r);case"BinaryOp":return SL(e,t.op,t.left,t.right,r);case"UnaryOp":return se(e,t.operand,r).map(n=>{if(t.op==="-"){if(typeof n=="number")return-n;if(typeof n=="string"){let i=a=>a.length>5?`"${a.slice(0,3)}...`:JSON.stringify(a);throw new Error(`string (${i(n)}) cannot be negated`)}return null}return t.op==="not"?!zn(n):null});case"Cond":{let n=se(e,t.cond,r);return xn(r,n,i=>{if(zn(i))return se(e,t.then,r);for(let a of t.elifs)if(se(e,a.cond,r).some(zn))return se(e,a.then,r);return t.else?se(e,t.else,r):[e]})}case"Try":try{return se(e,t.body,r)}catch(n){if(n instanceof T)throw n;if(t.catch){let i=n instanceof k0?n.value:n instanceof Error?n.message:String(n);return se(i,t.catch,r)}return[]}case"Call":return f5(e,t.name,t.args,r);case"VarBind":{let n=se(e,t.value,r);return xn(r,n,i=>{let a=null,s=[];if(t.pattern?s.push(t.pattern):t.name&&s.push({type:"var",name:t.name}),t.alternatives)for(let o of t.alternatives)s.push(o);for(let o of s)if(a=el(r,o,i),a!==null)break;return a===null?[]:se(e,t.body,a)})}case"VarRef":{if(t.name==="$ENV")return[r.env?Fn(r.env):Object.create(null)];if(t.name==="$ARGS"){let i=Object.create(null);if(r.namedArgs)for(let[s,o]of r.namedArgs)Object.defineProperty(i,s,{value:o,enumerable:!0,writable:!0,configurable:!0});let a=Object.create(null);return a.positional=r.positionalArgs?[...r.positionalArgs]:[],a.named=i,[a]}let n=r.vars.get(t.name);return n!==void 0?[n]:[null]}case"Recurse":{let n=[],i=new WeakSet,a=[{val:e,depth:0}];for(;a.length>0;){let s=a.pop();if(!s)break;let{val:o,depth:l}=s;if(Pr(r),l>r.limits.maxDepth)throw Za(`query depth limit exceeded (${r.limits.maxDepth})`,"recursion");if(o&&typeof o=="object"){if(i.has(o))continue;i.add(o)}if(cr(r,n.length),n.push(o),Array.isArray(o))for(let u=o.length-1;u>=0;u--)a.push({val:o[u],depth:l+1});else if(o&&typeof o=="object"){let u=Object.keys(o);for(let c=u.length-1;c>=0;c--)a.push({val:o[u[c]],depth:l+1})}}return n}case"Optional":try{return se(e,t.expr,r)}catch(n){if(n instanceof T)throw n;return[]}case"StringInterp":{let n=new St(r.limits.maxStringLength,"query string interpolation",()=>new T(`string size limit exceeded (${r.limits.maxStringLength} bytes)`,"string_length"));for(let i of t.parts){if(typeof i=="string"){n.append(i);continue}let a=se(e,i,r);for(let s of a){if(Pr(r),ul(s,r.limits.maxDepth+1)>r.limits.maxDepth)throw Za(`query depth limit exceeded (${r.limits.maxDepth})`,"recursion");n.append(typeof s=="string"?s:JSON.stringify(s))}}return[n.build()]}case"UpdateOp":return[EL(e,t.path,t.op,t.value,r)];case"Reduce":{let n=se(e,t.expr,r),i=se(e,t.init,r)[0],a=r.limits.maxDepth??N0;for(let s of n){let o;if(t.pattern){if(o=el(r,t.pattern,s),o===null)continue}else o=_c(r,t.varName,s);if(i=se(i,t.update,o)[0],ul(i,a+1)>a)return[null]}return[i]}case"Foreach":{let n=se(e,t.expr,r),i=se(e,t.init,r)[0],a=[];for(let s of n)try{let o;if(t.pattern){if(o=el(r,t.pattern,s),o===null)continue}else o=_c(r,t.varName,s);if(i=se(i,t.update,o)[0],t.extract){let l=se(i,t.extract,o);Ma(r,a,l)}else cr(r,a.length),a.push(i)}catch(o){throw o instanceof Ko?o.withPrependedResults(a):o}return a}case"Label":try{return se(e,t.body,{...r,labels:new Set([...r.labels??[],t.name])})}catch(n){if(n instanceof Ko&&n.label===t.name)return n.partialResults;throw n}case"Break":throw new Ko(t.name);case"Def":{let n=new Map(r.funcs??[]),i=`${t.name}/${t.params.length}`;n.set(i,{params:t.params,body:t.funcBody,closure:new Map(r.funcs??[])});let a={...r,funcs:n};return se(e,t.body,a)}default:{let n=t;throw new Error(`Unknown AST node type: ${n.type}`)}}}function Zb(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function EL(e,t,r,n,i){function a(o,l){switch(r){case"=":return l;case"|=":return se(o,n,i)[0]??null;case"+=":return typeof o=="number"&&typeof l=="number"||typeof o=="string"&&typeof l=="string"?o+l:Array.isArray(o)&&Array.isArray(l)?(cr(i,o.length,l.length),[...o,...l]):o&&l&&typeof o=="object"&&typeof l=="object"?Nv(o,l):l;case"-=":return typeof o=="number"&&typeof l=="number"?o-l:o;case"*=":return typeof o=="number"&&typeof l=="number"?o*l:o;case"/=":return typeof o=="number"&&typeof l=="number"?o/l:o;case"%=":return typeof o=="number"&&typeof l=="number"?o%l:o;case"//=":return o===null||o===!1?l:o;default:return l}}function s(o,l,u){switch(l.type){case"Identity":return u(o);case"Field":{if(!kt(l.name))return o;if(l.base)return s(o,l.base,c=>{if(c&&typeof c=="object"&&!Array.isArray(c)){let p=Er(c),d=Object.hasOwn(p,l.name)?p[l.name]:void 0;return $t(p,l.name,u(d)),p}return c});if(o&&typeof o=="object"&&!Array.isArray(o)){let c=Er(o),p=Object.hasOwn(c,l.name)?c[l.name]:void 0;return $t(c,l.name,u(p)),c}return o}case"Index":{let c=se(e,l.index,i)[0];if(typeof c=="number"&&Number.isNaN(c))throw new Error("Cannot set array element at NaN index");if(typeof c=="number"&&!Number.isFinite(c))throw new Error("array index must be finite");if(typeof c=="number"&&!Number.isInteger(c)&&(c=Math.trunc(c)),l.base)return s(o,l.base,p=>{if(typeof c=="number"&&Array.isArray(p)){let d=[...p],f=c<0?d.length+c:c;if(f>=0){cr(i,0,f+1),d.length<=f&&(d.length=f+1);for(let h=p.length;h536870911)throw new Error("Array index too large");if(c<0&&(!o||!Array.isArray(o)))throw new Error("Out of bounds negative array index");if(Array.isArray(o)){let p=[...o],d=c<0?p.length+c:c;if(d>=0){cr(i,0,d+1),p.length<=d&&(p.length=d+1);for(let f=o.length;f{if(Array.isArray(p)){cr(i,0,p.length);let d=[];for(let f of p)Pr(i),d.push(u(f));return d}if(p&&typeof p=="object"){let d=Object.create(null);for(let[f,h]of Object.entries(p))kt(f)&&$t(d,f,u(h));return d}return p};return l.base?s(o,l.base,c):c(o)}case"Pipe":{let c=s(o,l.left,p=>p);return s(c,l.right,u)}default:return u(o)}}return s(e,t,o=>{if(r==="|=")return a(o,o);let l=se(e,n,i);return a(o,l[0]??null)})}function p5(e,t,r){function n(a,s,o){switch(s.type){case"Identity":return o;case"Field":{if(!kt(s.name))return a;if(s.base){let l=se(a,s.base,r)[0],u=n(l,{type:"Field",name:s.name},o);return n(a,s.base,u)}if(a&&typeof a=="object"&&!Array.isArray(a)){let l=Er(a);return $t(l,s.name,o),l}return a}case"Index":{if(s.base){let u=se(a,s.base,r)[0],c=n(u,{type:"Index",index:s.index},o);return n(a,s.base,c)}let l=se(e,s.index,r)[0];if(typeof l=="number"&&Array.isArray(a)){let u=[...a],c=l<0?u.length+l:l;return c>=0&&c=0&&c=0&&y{if(!zn(u))return[!1];let c=se(e,n,i);return xn(i,c,p=>[zn(p)])})}if(t==="or"){let l=se(e,r,i);return xn(i,l,u=>{if(zn(u))return[!0];let c=se(e,n,i);return xn(i,c,p=>[zn(p)])})}if(t==="//"){let l=se(e,r,i).filter(u=>u!=null&&u!==!1);return l.length>0?l:se(e,n,i)}let a=se(e,r,i),s=se(e,n,i),o=a.length*s.length;return cr(i,0,o),Pr(i,o),a.flatMap(l=>s.map(u=>{switch(t){case"+":if(l===null)return u;if(u===null)return l;if(typeof l=="number"&&typeof u=="number")return l+u;if(typeof l=="string"&&typeof u=="string"){let c=i.limits.maxStringLength;if(K(l)+K(u)>c)throw new T(`string size limit exceeded (${c} bytes)`,"string_length");return l+u}return Array.isArray(l)&&Array.isArray(u)?(cr(i,l.length,u.length),[...l,...u]):l&&u&&typeof l=="object"&&typeof u=="object"&&!Array.isArray(l)&&!Array.isArray(u)?Nv(l,u):null;case"-":if(typeof l=="number"&&typeof u=="number")return l-u;if(Array.isArray(l)&&Array.isArray(u)){let c=new Set(u.map(p=>JSON.stringify(p)));return l.filter(p=>!c.has(JSON.stringify(p)))}if(typeof l=="string"&&typeof u=="string"){let c=p=>p.length>10?`"${p.slice(0,10)}...`:JSON.stringify(p);throw new Error(`string (${c(l)}) and string (${c(u)}) cannot be subtracted`)}return null;case"*":if(typeof l=="number"&&typeof u=="number")return l*u;if(typeof l=="string"&&typeof u=="number"){if(!Number.isFinite(u))throw new Error(`invalid string repetition count: ${u}`);let c=Math.trunc(u);if(c<0)return null;let p=K(l),d=i.limits.maxStringLength;if(p>0&&c>Math.floor(d/p))throw new T(`string size limit exceeded (${d} bytes)`,"string_length");return l.repeat(c)}{let c=It(l),p=It(u);if(c&&p)return ZR(c,p,{maxDepth:i.limits.maxDepth,visit:()=>Pr(i)})}return null;case"/":if(typeof l=="number"&&typeof u=="number"){if(u===0)throw new Error(`number (${l}) and number (${u}) cannot be divided because the divisor is zero`);return l/u}return typeof l=="string"&&typeof u=="string"?l.split(u):null;case"%":if(typeof l=="number"&&typeof u=="number"){if(u===0)throw new Error(`number (${l}) and number (${u}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(l)&&!Number.isNaN(l)?!Number.isFinite(u)&&!Number.isNaN(u)&&l<0&&u>0?-1:0:l%u}return null;case"==":return ll(l,u);case"!=":return!ll(l,u);case"<":return Pu(l,u)<0;case"<=":return Pu(l,u)<=0;case">":return Pu(l,u)>0;case">=":return Pu(l,u)>=0;default:return null}}))}function f5(e,t,r,n){let i=h5.get(t);if(i)return typeof e=="number"?[i(e)]:[null];let a=tL(e,t,r,n,se);if(a!==null)return a;let s=dL(e,t,r,n,se);if(s!==null)return s;let o=GR(e,t,r,n,se);if(o!==null)return o;let l=KR(e,t,n.limits.maxDepth);if(l!==null)return l;let u=mL(e,t);if(u!==null)return u;let c=sL(e,t,r,n,se);if(c!==null)return c;let p=qR(e,t,r,n,se,Vb,c1,zn,p1,T);if(p!==null)return p;let d=lL(e,t,r,n,se,zn,f1,d1,p5,sc);if(d!==null)return d;let f=JR(e,t,r,n,se,ll);if(f!==null)return f;let h=WR(e,t,r,n,se,Vb,zn,T);if(h!==null)return h;let m=nL(e,t,r,n,se,zn,wL,f5);if(m!==null)return m;let g=cL(e,t,r,n,se,ll);if(g!==null)return g;switch(t){case"builtins":return[["add/0","all/0","all/1","all/2","any/0","any/1","any/2","arrays/0","ascii/0","ascii_downcase/0","ascii_upcase/0","booleans/0","bsearch/1","builtins/0","combinations/0","combinations/1","contains/1","debug/0","del/1","delpaths/1","empty/0","env/0","error/0","error/1","explode/0","first/0","first/1","flatten/0","flatten/1","floor/0","from_entries/0","fromdate/0","fromjson/0","getpath/1","gmtime/0","group_by/1","gsub/2","gsub/3","has/1","implode/0","IN/1","IN/2","INDEX/1","INDEX/2","index/1","indices/1","infinite/0","inside/1","isempty/1","isnan/0","isnormal/0","isvalid/1","iterables/0","join/1","keys/0","keys_unsorted/0","last/0","last/1","length/0","limit/2","ltrimstr/1","map/1","map_values/1","match/1","match/2","max/0","max_by/1","min/0","min_by/1","mktime/0","modulemeta/1","nan/0","not/0","nth/1","nth/2","null/0","nulls/0","numbers/0","objects/0","path/1","paths/0","paths/1","pick/1","range/1","range/2","range/3","recurse/0","recurse/1","recurse_down/0","repeat/1","reverse/0","rindex/1","rtrimstr/1","scalars/0","scan/1","scan/2","select/1","setpath/2","skip/2","sort/0","sort_by/1","split/1","splits/1","splits/2","sqrt/0","startswith/1","strftime/1","strings/0","strptime/1","sub/2","sub/3","test/1","test/2","to_entries/0","toboolean/0","todate/0","tojson/0","tostream/0","fromstream/1","truncate_stream/1","tonumber/0","tostring/0","transpose/0","trim/0","ltrim/0","rtrim/0","type/0","unique/0","unique_by/1","until/2","utf8bytelength/0","values/0","walk/1","while/2","with_entries/1"]];case"error":{let x=r.length>0?se(e,r[0],n)[0]:e;throw new k0(x)}case"env":return[n.env?Fn(n.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let x=`${t}/${r.length}`,y=n.funcs?.get(x);if(y){let b=y.closure??n.funcs??new Map,k=new Map(b);k.set(x,y);for(let v=0;v=0;_--)$={type:"Comma",left:{type:"Literal",value:I[_]},right:$}}k.set(`${A}/0`,{params:[],body:$})}}let w={...n,funcs:k};return se(e,y.body,w)}throw new Error(`Unknown function: ${t}`)}}}function sc(e,t,r,n,i){if(Pr(r),n.length>r.limits.maxDepth)throw Za(`query depth limit exceeded (${r.limits.maxDepth})`,"recursion");let a=(o,l)=>{let u=n.length+o.length+(l===void 0?0:1);if(u>r.limits.maxDepth)throw Za(`query depth limit exceeded (${r.limits.maxDepth})`,"recursion");cr(r,i.length),Pr(r,u);let c=[...n,...o];l!==void 0&&c.push(l),i.push(c)};if(t.type==="Comma"){let o=t;sc(e,o.left,r,n,i),sc(e,o.right,r,n,i);return}let s=_i(t);if(s!==null){a(s);return}if(t.type==="Index"){let o=t.base?_i(t.base):[],l=o?se(e,t.index,r):[];if(o&&l.every(u=>typeof u=="string"||typeof u=="number")){if(l.length===0)return;let u=t.base?se(e,t.base,r):[e];for(let c of l)for(let p of u){if(Pr(r),p!==null&&(typeof c=="string"?typeof p!="object"||Array.isArray(p):!Array.isArray(p))){let d=Array.isArray(p)?"array":typeof p;throw new Error(`Cannot index ${d} with ${typeof c=="string"?`string "${c}"`:"number"}`)}a(o,c)}return}}if(t.type==="Iterate"){if(Array.isArray(e))for(let o=0;o0;){let l=o.pop();if(!l)break;if(Pr(r),a(l.path),l.value&&typeof l.value=="object"){let u=Array.isArray(l.value)?l.value.map((c,p)=>[p,c]):Object.keys(l.value).map(c=>[c,l.value[c]]);cr(r,0,o.length+u.length);for(let c=u.length-1;c>=0;c--){let[p,d]=u[c];o.push({value:d,path:[...l.path,p]})}}}return}if(t.type==="Pipe"){let o=_i(t.left);if(o!==null){let l=se(e,t.left,r);for(let u of l)sc(u,t.right,r,[...n,...o],i);return}}se(e,t,r).length>0&&a([])}var Ko,k0,d5,m1,N0,h5,m5=q(()=>{"use strict";Yt(),ia(),J(),Pi(),ir(),xL(),yL(),hi(),ap(),Ko=class g5 extends Error{label;partialResults;constructor(t,r=[]){super(`break ${t}`),this.label=t,this.partialResults=r,this.name="BreakError"}withPrependedResults(t){return new g5(this.label,[...t,...this.partialResults])}},k0=class extends Error{value;constructor(e){super(typeof e=="string"?e:JSON.stringify(e)),this.value=e,this.name="JqError"}},d5=1e4,m1=10*1024*1024,N0=2e3,h5=new Map([["floor",Math.floor],["ceil",Math.ceil],["round",Math.round],["sqrt",Math.sqrt],["log",Math.log],["log10",Math.log10],["log2",Math.log2],["exp",Math.exp],["sin",Math.sin],["cos",Math.cos],["tan",Math.tan],["asin",Math.asin],["acos",Math.acos],["atan",Math.atan],["sinh",Math.sinh],["cosh",Math.cosh],["tanh",Math.tanh],["asinh",Math.asinh],["acosh",Math.acosh],["atanh",Math.atanh],["cbrt",Math.cbrt],["expm1",Math.expm1],["log1p",Math.log1p],["trunc",Math.trunc]])});function x5(e){let t=[],r=0,n=(u=0)=>e[r+u],i=()=>e[r++],a=()=>r>=e.length,s=u=>u>="0"&&u<="9",o=u=>u>="a"&&u<="z"||u>="A"&&u<="Z"||u==="_",l=u=>o(u)||s(u);for(;!a();){let u=r,c=i();if(!(c===" "||c===" "||c===` `||c==="\r")){if(c==="#"){for(;!a()&&n()!==` `;)i();continue}if(c==="."&&n()==="."){i(),t.push({type:"DOTDOT",pos:u});continue}if(c==="="&&n()==="="){i(),t.push({type:"EQ",pos:u});continue}if(c==="!"&&n()==="="){i(),t.push({type:"NE",pos:u});continue}if(c==="<"&&n()==="="){i(),t.push({type:"LE",pos:u});continue}if(c===">"&&n()==="="){i(),t.push({type:"GE",pos:u});continue}if(c==="/"&&n()==="/"){i(),n()==="="?(i(),t.push({type:"UPDATE_ALT",pos:u})):t.push({type:"ALT",pos:u});continue}if(c==="+"&&n()==="="){i(),t.push({type:"UPDATE_ADD",pos:u});continue}if(c==="-"&&n()==="="){i(),t.push({type:"UPDATE_SUB",pos:u});continue}if(c==="*"&&n()==="="){i(),t.push({type:"UPDATE_MUL",pos:u});continue}if(c==="/"&&n()==="="){i(),t.push({type:"UPDATE_DIV",pos:u});continue}if(c==="%"&&n()==="="){i(),t.push({type:"UPDATE_MOD",pos:u});continue}if(c==="="&&n()!=="="){t.push({type:"ASSIGN",pos:u});continue}if(c==="."){t.push({type:"DOT",pos:u});continue}if(c==="|"){n()==="="?(i(),t.push({type:"UPDATE_PIPE",pos:u})):t.push({type:"PIPE",pos:u});continue}if(c===","){t.push({type:"COMMA",pos:u});continue}if(c===":"){t.push({type:"COLON",pos:u});continue}if(c===";"){t.push({type:"SEMICOLON",pos:u});continue}if(c==="("){t.push({type:"LPAREN",pos:u});continue}if(c===")"){t.push({type:"RPAREN",pos:u});continue}if(c==="["){t.push({type:"LBRACKET",pos:u});continue}if(c==="]"){t.push({type:"RBRACKET",pos:u});continue}if(c==="{"){t.push({type:"LBRACE",pos:u});continue}if(c==="}"){t.push({type:"RBRACE",pos:u});continue}if(c==="?"){t.push({type:"QUESTION",pos:u});continue}if(c==="+"){t.push({type:"PLUS",pos:u});continue}if(c==="-"){t.push({type:"MINUS",pos:u});continue}if(c==="*"){t.push({type:"STAR",pos:u});continue}if(c==="/"){t.push({type:"SLASH",pos:u});continue}if(c==="%"){t.push({type:"PERCENT",pos:u});continue}if(c==="<"){t.push({type:"LT",pos:u});continue}if(c===">"){t.push({type:"GT",pos:u});continue}if(s(c)){let p=c;for(;!a()&&(s(n())||n()==="."||n()==="e"||n()==="E");)(n()==="e"||n()==="E")&&(e[r+1]==="+"||e[r+1]==="-")&&(p+=i()),p+=i();t.push({type:"NUMBER",value:Number(p),pos:u});continue}if(c==='"'){let p="",d=0;for(;!a();){let f=n();if(d===0&&f==='"')break;if(d===0&&f==="\\"){if(i(),a())break;let h=i();switch(h){case"n":p+=` `;break;case"r":p+="\r";break;case"t":p+=" ";break;case"\\":p+="\\";break;case'"':p+='"';break;case"(":p+="\\(",d=1;break;default:p+=h}continue}if(d>0){if(f==='"'){for(p+=i();!a();){let h=n();if(h==="\\"){p+=i(),a()||(p+=i());continue}if(p+=i(),h==='"')break}continue}f==="("?d++:f===")"&&d--,p+=i();continue}p+=i()}a()||i(),t.push({type:"STRING",value:p,pos:u});continue}if(o(c)||c==="$"||c==="@"){let p=c;for(;!a()&&l(n());)p+=i();let d=g1.get(p);d?t.push({type:d,value:p,pos:u}):t.push({type:"IDENT",value:p,pos:u});continue}throw new Error(`Unexpected character '${c}' at position ${u}`)}}return t.push({type:"EOF",pos:r}),t}function AL(e,t={}){let r=t.maxDepth??256,n=t.maxTokens??1e5,i=t.maxSourceLength??1048576;if(e.length>i)throw new Error(`query source length limit exceeded (${i} characters)`);if(e.length+1>n)throw new Error(`query token limit exceeded (${n})`);let a=x5(e);return new y5(a,r).parse()}var g1,zo,y5,CL=q(()=>{"use strict";g1=new Map([["and","AND"],["or","OR"],["not","NOT"],["if","IF"],["then","THEN"],["elif","ELIF"],["else","ELSE"],["end","END"],["as","AS"],["try","TRY"],["catch","CATCH"],["true","TRUE"],["false","FALSE"],["null","NULL"],["reduce","REDUCE"],["foreach","FOREACH"],["label","LABEL"],["break","BREAK"],["def","DEF"]]),zo=new Set(g1.values()),y5=class b5{maxDepth;tokens;pos=0;depth;constructor(t,r,n=0){this.maxDepth=r,this.tokens=t,this.depth=n}peek(t=0){return this.tokens[this.pos+t]??{type:"EOF",pos:-1}}advance(){return this.tokens[this.pos++]}check(t){return this.peek().type===t}match(...t){for(let r of t)if(this.check(r))return this.advance();return null}expect(t,r){if(!this.check(t))throw new Error(`${r} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}withDepth(t){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return t()}finally{this.depth--}}isFieldNameAfterDot(t=0){let r=this.peek(t),n=this.peek(t+1);return n.type==="STRING"?!0:n.type==="IDENT"||zo.has(n.type)?n.pos===r.pos+1:!1}isIdentLike(){let t=this.peek().type;return t==="IDENT"||zo.has(t)}consumeFieldNameAfterDot(t){let r=this.peek();return r.type==="STRING"?this.advance().value:(r.type==="IDENT"||zo.has(r.type))&&r.pos===t.pos+1?this.advance().value:null}parse(){let t=this.parseExpr();if(!this.check("EOF"))throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return t}parseExpr(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parsePipe()}finally{this.depth--}}parsePattern(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parsePatternInner()}finally{this.depth--}}parsePatternInner(){if(this.match("LBRACKET")){let n=[];if(!this.check("RBRACKET"))for(n.push(this.parsePattern());this.match("COMMA")&&!this.check("RBRACKET");)n.push(this.parsePattern());return this.expect("RBRACKET","Expected ']' after array pattern"),{type:"array",elements:n}}if(this.match("LBRACE")){let n=[];if(!this.check("RBRACE"))for(n.push(this.parsePatternField());this.match("COMMA")&&!this.check("RBRACE");)n.push(this.parsePatternField());return this.expect("RBRACE","Expected '}' after object pattern"),{type:"object",fields:n}}let t=this.expect("IDENT","Expected variable name in pattern"),r=t.value;if(!r.startsWith("$"))throw new Error(`Variable name must start with $ at position ${t.pos}`);return{type:"var",name:r}}parsePatternField(){if(this.match("LPAREN")){let r=this.parseExpr();this.expect("RPAREN","Expected ')' after computed key"),this.expect("COLON","Expected ':' after computed key");let n=this.parsePattern();return{key:r,pattern:n}}let t=this.peek();if(t.type==="IDENT"||zo.has(t.type)){let r=t.value;if(r.startsWith("$")){if(this.advance(),this.match("COLON")){let n=this.parsePattern();return{key:r.slice(1),pattern:n,keyVar:r}}return{key:r.slice(1),pattern:{type:"var",name:r}}}if(this.advance(),this.match("COLON")){let n=this.parsePattern();return{key:r,pattern:n}}return{key:r,pattern:{type:"var",name:`$${r}`}}}throw new Error(`Expected field name in object pattern at position ${t.pos}`)}parsePipe(){let t=this.parseComma();for(;this.match("PIPE");){let r=this.parseComma();t={type:"Pipe",left:t,right:r}}return t}parseComma(){let t=this.parseVarBind();for(;this.match("COMMA");){let r=this.parseVarBind();t={type:"Comma",left:t,right:r}}return t}parseVarBind(){let t=this.parseUpdate();if(this.match("AS")){let r=this.parsePattern(),n=[];for(;this.check("QUESTION")&&this.peekAhead(1)?.type==="ALT";)this.advance(),this.advance(),n.push(this.parsePattern());this.expect("PIPE","Expected '|' after variable binding");let i=this.parseExpr();return r.type==="var"&&n.length===0?{type:"VarBind",name:r.name,value:t,body:i}:{type:"VarBind",name:r.type==="var"?r.name:"",value:t,body:i,pattern:r.type!=="var"?r:void 0,alternatives:n.length>0?n:void 0}}return t}peekAhead(t){let r=this.pos+t;return rthis.parseVarBind()),a=r.get(n.type);if(a)return{type:"UpdateOp",op:a,path:t,value:i}}return t}parseAlt(){let t=this.parseOr();for(;this.match("ALT");){let r=this.parseOr();t={type:"BinaryOp",op:"//",left:t,right:r}}return t}parseOr(){let t=this.parseAnd();for(;this.match("OR");){let r=this.parseAnd();t={type:"BinaryOp",op:"or",left:t,right:r}}return t}parseAnd(){let t=this.parseNot();for(;this.match("AND");){let r=this.parseNot();t={type:"BinaryOp",op:"and",left:t,right:r}}return t}parseNot(){return this.parseComparison()}parseComparison(){let t=this.parseAddSub(),r=new Map([["EQ","=="],["NE","!="],["LT","<"],["LE","<="],["GT",">"],["GE",">="]]),n=this.match("EQ","NE","LT","LE","GT","GE");if(n){let i=r.get(n.type);if(i){let a=this.parseAddSub();t={type:"BinaryOp",op:i,left:t,right:a}}}return t}parseAddSub(){let t=this.parseMulDiv();for(;;)if(this.match("PLUS")){let r=this.parseMulDiv();t={type:"BinaryOp",op:"+",left:t,right:r}}else if(this.match("MINUS")){let r=this.parseMulDiv();t={type:"BinaryOp",op:"-",left:t,right:r}}else break;return t}parseMulDiv(){let t=this.parseUnary();for(;;)if(this.match("STAR")){let r=this.parseUnary();t={type:"BinaryOp",op:"*",left:t,right:r}}else if(this.match("SLASH")){let r=this.parseUnary();t={type:"BinaryOp",op:"/",left:t,right:r}}else if(this.match("PERCENT")){let r=this.parseUnary();t={type:"BinaryOp",op:"%",left:t,right:r}}else break;return t}parseUnary(){let t=0;for(;this.match("MINUS");)if(t++,this.depth+t>this.maxDepth)throw new Error(`query parse depth limit exceeded (${this.maxDepth})`);let r=this.parsePostfix();for(;t-- >0;)r={type:"UnaryOp",op:"-",operand:r};return r}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match("QUESTION"))t={type:"Optional",expr:t};else if(this.check("DOT")&&this.isFieldNameAfterDot())this.advance(),t={type:"Field",name:this.advance().value,base:t};else if(this.check("LBRACKET"))if(this.advance(),this.match("RBRACKET"))t={type:"Iterate",base:t};else if(this.check("COLON")){this.advance();let r=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),t={type:"Slice",end:r,base:t}}else{let r=this.parseExpr();if(this.match("COLON")){let n=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),t={type:"Slice",start:r,end:n,base:t}}else this.expect("RBRACKET","Expected ']'"),t={type:"Index",index:r,base:t}}else break;return t}parsePrimary(){if(this.match("DOTDOT"))return{type:"Recurse"};if(this.check("DOT")){let t=this.advance();if(this.check("LBRACKET")){if(this.advance(),this.match("RBRACKET"))return{type:"Iterate"};if(this.check("COLON")){this.advance();let i=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",end:i}}let n=this.parseExpr();if(this.match("COLON")){let i=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",start:n,end:i}}return this.expect("RBRACKET","Expected ']'"),{type:"Index",index:n}}let r=this.consumeFieldNameAfterDot(t);return r!==null?{type:"Field",name:r}:{type:"Identity"}}if(this.match("TRUE"))return{type:"Literal",value:!0};if(this.match("FALSE"))return{type:"Literal",value:!1};if(this.match("NULL"))return{type:"Literal",value:null};if(this.check("NUMBER"))return{type:"Literal",value:this.advance().value};if(this.check("STRING")){let t=this.advance().value;return t.includes("\\(")?this.parseStringInterpolation(t):{type:"Literal",value:t}}if(this.match("LBRACKET")){if(this.match("RBRACKET"))return{type:"Array"};let t=this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Array",elements:t}}if(this.match("LBRACE"))return this.parseObjectConstruction();if(this.match("LPAREN")){let t=this.parseExpr();return this.expect("RPAREN","Expected ')'"),{type:"Paren",expr:t}}if(this.match("IF"))return this.parseIf();if(this.match("TRY")){let t=this.withDepth(()=>this.parsePostfix()),r;return this.match("CATCH")&&(r=this.withDepth(()=>this.parsePostfix())),{type:"Try",body:t,catch:r}}if(this.match("REDUCE")){let t=this.parseAddSub();this.expect("AS","Expected 'as' after reduce expression");let r=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let n=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let i=this.parseExpr();this.expect("RPAREN","Expected ')' after update expression");let a=r.type==="var"?r.name:"";return{type:"Reduce",expr:t,varName:a,init:n,update:i,pattern:r.type!=="var"?r:void 0}}if(this.match("FOREACH")){let t=this.parseAddSub();this.expect("AS","Expected 'as' after foreach expression");let r=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let n=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let i=this.parseExpr(),a;this.match("SEMICOLON")&&(a=this.parseExpr()),this.expect("RPAREN","Expected ')' after expressions");let s=r.type==="var"?r.name:"";return{type:"Foreach",expr:t,varName:s,init:n,update:i,extract:a,pattern:r.type!=="var"?r:void 0}}if(this.match("LABEL")){let t=this.expect("IDENT","Expected label name (e.g., $out)"),r=t.value;if(!r.startsWith("$"))throw new Error(`Label name must start with $ at position ${t.pos}`);this.expect("PIPE","Expected '|' after label name");let n=this.parseExpr();return{type:"Label",name:r,body:n}}if(this.match("BREAK")){let t=this.expect("IDENT","Expected label name to break to"),r=t.value;if(!r.startsWith("$"))throw new Error(`Break label must start with $ at position ${t.pos}`);return{type:"Break",name:r}}if(this.match("DEF")){let t=this.expect("IDENT","Expected function name after def").value,r=[];if(this.match("LPAREN")){if(!this.check("RPAREN")){let a=this.expect("IDENT","Expected parameter name");for(r.push(a.value);this.match("SEMICOLON");){let s=this.expect("IDENT","Expected parameter name");r.push(s.value)}}this.expect("RPAREN","Expected ')' after parameters")}this.expect("COLON","Expected ':' after function name");let n=this.parseExpr();this.expect("SEMICOLON","Expected ';' after function body");let i=this.parseExpr();return{type:"Def",name:t,params:r,funcBody:n,body:i}}if(this.match("NOT"))return{type:"Call",name:"not",args:[]};if(this.check("IDENT")){let t=this.advance().value;if(t.startsWith("$"))return{type:"VarRef",name:t};if(this.match("LPAREN")){let r=[];if(!this.check("RPAREN"))for(r.push(this.parseExpr());this.match("SEMICOLON");)r.push(this.parseExpr());return this.expect("RPAREN","Expected ')'"),{type:"Call",name:t,args:r}}return{type:"Call",name:t,args:[]}}throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parseObjectConstructionInner()}finally{this.depth--}}parseObjectConstructionInner(){let t=[];if(!this.check("RBRACE"))do{let r,n;if(this.match("LPAREN"))r=this.parseExpr(),this.expect("RPAREN","Expected ')'"),this.expect("COLON","Expected ':'"),n=this.parseObjectValue();else if(this.isIdentLike()){let i=this.advance().value;this.match("COLON")?(r=i,n=this.parseObjectValue()):(r=i,n={type:"Field",name:i})}else if(this.check("STRING"))r=this.advance().value,this.expect("COLON","Expected ':'"),n=this.parseObjectValue();else throw new Error(`Expected object key at position ${this.peek().pos}`);t.push({key:r,value:n})}while(this.match("COMMA"));return this.expect("RBRACE","Expected '}'"),{type:"Object",entries:t}}parseObjectValue(){let t=this.parseVarBind();for(;this.match("PIPE");){let r=this.parseVarBind();t={type:"Pipe",left:t,right:r}}return t}parseIf(){let t=this.parseExpr();this.expect("THEN","Expected 'then'");let r=this.parseExpr(),n=[];for(;this.match("ELIF");){let a=this.parseExpr();this.expect("THEN","Expected 'then' after elif");let s=this.parseExpr();n.push({cond:a,then:s})}let i;return this.match("ELSE")&&(i=this.parseExpr()),this.expect("END","Expected 'end'"),{type:"Cond",cond:t,then:r,elifs:n,else:i}}parseStringInterpolation(t){let r=[],n="",i=0;for(;i0;){let u=t[i];if(u==='"'){for(s+=u,i++;i0&&(s+=u),i++}let o=x5(s),l=new b5(o,this.maxDepth,this.depth);r.push(l.parse())}else n+=t[i],i++;return n&&r.push(n),{type:"StringInterp",parts:r}}}}),kL=q(()=>{"use strict";m5(),CL()});function NL(e,t,r={}){let n=new St(t,"query JSON output",()=>new T(`output size limit exceeded (${t} bytes)`,r.limitKind??"output_size"));return x1(n,e,r,0),n.build()}function x1(e,t,r,n){if(t==null){e.append("null");return}if(typeof t=="boolean"){e.append(String(t));return}if(typeof t=="number"){e.append(Number.isFinite(t)?String(t):"null");return}if(typeof t=="string"){r.raw&&n===0?e.append(t):Xb(e,t);return}let i=r.compact??!1,a=r.indent??2,s=r.useTab?" ":" ".repeat(a);if(Array.isArray(t)){e.append("[");for(let l=0;l0&&e.append(` `).repeat(s,n),e.append("]");return}let o=Object.keys(t);r.sortKeys&&(o=o.sort()),e.append("{");for(let l=0;l0&&e.append(` `).repeat(s,n),e.append("}")}function Xb(e,t){e.append('"');let r=0;for(let n=0;n{"use strict";Yt(),J()}),w5={};ce(w5,{flagsForFuzzing:()=>E5,jqCommand:()=>v5});function _L(e){switch(e){case"\b":return"\\b";case"\f":return"\\f";case` `:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`}}function OL(e){let t="",r=!1,n=!1;for(let i=0;i{if(r.length>=t.maxElements)throw new T(`query result element limit exceeded (${t.maxElements})`,"array_elements");r.push(s)},i=0,a=e.length;for(;i=a)break;let s=i,o=e[i];if(o==="{"||o==="["){let l=[o==="{"?"}":"]"],u=!1,c=!1;for(i++;i0;){let p=e[i];if(c)c=!1;else if(p==="\\")c=!0;else if(p==='"')u=!u;else if(!u){if(p==="{"||p==="["){if(l.push(p==="{"?"}":"]"),l.length>t.maxDepth)throw new T(`query depth limit exceeded (${t.maxDepth})`,"recursion")}else if((p==="}"||p==="]")&&l.pop()!==p)throw new Error(`Mismatched JSON delimiter at position ${i}`)}i++}if(l.length!==0)throw new Error(`Unexpected end of JSON input at position ${i} (unclosed ${o})`);n(Qu(nh(e,s,i),{maxDepth:t.maxDepth,maxElements:t.maxElements}))}else if(o==='"'){let l=!1;for(i++;i="0"&&o<="9"){for(;i{"use strict";ge(),Nn(),J(),Pi(),ln(),Ja(),be(),ir(),kL(),TL(),hi(),ap(),Qb={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE...]",options:["-R, --raw-input read each line as string instead of JSON","-r, --raw-output output strings without quotes","-c, --compact-output compact instead of pretty-printed output","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-a, --ascii force ASCII output","-S, --sort-keys sort object keys","-C, --color colorize output (ignored)","-M, --monochrome monochrome output (ignored)"," --tab use tabs for indentation"," --arg NAME VALUE bind $NAME to the string VALUE"," --argjson NAME JSON bind $NAME to the JSON-decoded value JSON"," --rawfile NAME FILE bind $NAME to the raw contents of FILE"," --slurpfile NAME FILE bind $NAME to the array of JSON values in FILE"," --args remaining arguments are string positional args ($ARGS.positional)"," --jsonargs remaining arguments are JSON positional args ($ARGS.positional)"," --help display this help and exit"]},v5={name:"jq",async execute(e,t){Gr(t.requireDefenseContext,"jq","execution entry");let r=(w,v)=>na(t.requireDefenseContext,"jq",w,v);if(Ce(e))return we(Qb);let n=!1,i=!1,a=!1,s=!1,o=!1,l=!1,u=!1,c=!1,p=!1,d=".",f=!1,h="none",m=[],g=new Map,x=[],y=[],b={maxDepth:t.limits.maxQueryDepth,maxElements:t.limits.maxQueryElements};for(let w=0;w0){let w=await r("arg file read",()=>bc(t,y.map(v=>v.file),{cmdName:"jq",stopOnError:!0}));if(w.exitCode!==0)return{stdout:"",stderr:w.stderr,exitCode:2};for(let v=0;vbc(t,m,{cmdName:"jq",stopOnError:!0}));if(w.exitCode!==0)return{stdout:"",stderr:w.stderr,exitCode:2};k=w.files.map(v=>({source:v.filename||"stdin",content:Ve(v.content)}))}try{let w=AL(d,{maxDepth:t.limits.maxQueryDepth,maxTokens:t.limits.maxQueryTokens,maxSourceLength:t.limits.maxStringLength}),v=[],A={limits:t.limits?{maxIterations:t.limits.maxJqIterations,maxStringLength:t.limits.maxStringLength,maxOutputSize:t.limits.maxOutputSize,maxArrayElements:t.limits.maxQueryElements,maxDepth:t.limits.maxQueryDepth}:void 0,env:t.env,namedArgs:g,positionalArgs:x,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext,budget:{operations:0,callDepth:0}},R=(D,W)=>{if(W.length>t.limits.maxQueryElements-D.length)throw new T(`query result element limit exceeded (${t.limits.maxQueryElements})`,"array_elements");for(let j of W)D.push(j)};if(l)v=se(null,w,A);else if(i&&o){let D=k.map(({content:W})=>W).join("");v=se(D,w,A)}else if(i){let D="";for(let{content:W}of k){let j=D+W,U=0,H=j.indexOf(` `,U);for(;H!==-1;)R(v,se(j.slice(U,H),w,A)),U=H+1,H=j.indexOf(` `,U);D=j.slice(U)}D!==""&&R(v,se(D,w,A))}else if(o){let D=[];for(let{content:W}of k){let j=W.trim();j&&R(D,qo(j,b))}v=se(D,w,A)}else for(let{content:D}of k){let W=D.trim();if(!W)continue;let j=qo(W,b);for(let U of j)R(v,se(U,w,A))}let I=u?"":` `,$=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),_=[],M=0;for(let D of v){let W=_.length>0?I.length:0,j=u?0:1,U=$-M-W-j;if(U<0)throw new T(`output size limit exceeded (${$} bytes)`,"string_length");if(ul(D,t.limits.maxQueryDepth+1)>t.limits.maxQueryDepth)throw new T(`query depth limit exceeded (${t.limits.maxQueryDepth})`,"recursion");let H=NL(D,U,{compact:a,raw:n,sortKeys:c,useTab:p,limitKind:"string_length"}),z=K(H);if(M+W+z+j>$)throw new T(`output size limit exceeded (${$} bytes)`,"string_length");M+=W+z,_.push(H)}let P=_.join(I),S=s&&(v.length===0||v.every(D=>D==null||D===!1))?1:0;return{stdout:P?u?P:`${P} `:"",stderr:"",exitCode:S}}catch(w){if(w instanceof He)throw w;if(w instanceof T)return{stdout:"",stderr:`jq: ${Xt(w.message)} `,exitCode:T.EXIT_CODE};let v=Xt(w.message);return v.includes("Unknown function")?{stdout:"",stderr:`jq: error: ${v} `,exitCode:3}:{stdout:"",stderr:`jq: parse error: ${v} `,exitCode:5}}}},E5={name:"jq",flags:[{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-j",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"--tab",type:"boolean"}],stdinType:"json",needsArgs:!0}}),S5={};ce(S5,{base64Command:()=>A5,flagsForFuzzing:()=>C5});function yn(e,t,r,n){if(e>t)throw new T(`base64: ${r} limit exceeded (${t} bytes)`,n)}function Kb(e){let t=[];for(let r=0;ru.charCodeAt(0))};let a=[],s=0;for(let u of t){if(u==="-"){yn(s+i.length,n,"input size","string_length"),a.push(Uint8Array.from(i,c=>c.charCodeAt(0))),s+=i.length;continue}try{let c=e.fs.resolvePath(e.cwd,u),p=await e.fs.stat(c);yn(s+p.size,n,"input size","string_length");let d=await e.fs.readFileBuffer(c);yn(s+d.length,n,"input size","string_length"),H4(e,d.length,r),a.push(d),s+=d.length}catch(c){return Ge(c),{ok:!1,error:{stdout:"",stderr:`${r}: ${u}: No such file or directory `,exitCode:1}}}}let o=new Uint8Array(s),l=0;for(let u of a)o.set(u,l),l+=u.length;return{ok:!0,data:o}}var e3,t3,A5,C5,$L=q(()=>{"use strict";ge(),Ar(),J(),sr(),Ja(),be(),e3={name:"base64",summary:"base64 encode/decode data and print to standard output",usage:"base64 [OPTION]... [FILE]",options:["-d, --decode decode data","-w, --wrap=COLS wrap encoded lines after COLS character (default 76, 0 to disable)"," --help display this help and exit"]},t3={decode:{short:"d",long:"decode",type:"boolean"},wrap:{short:"w",long:"wrap",type:"number",default:76}},A5={name:"base64",async execute(e,t){if(Ce(e))return we(e3);let r=ar("base64",e,t3);if(!r.ok)return r.error;let n=r.result.flags.decode,i=r.result.flags.wrap,a=r.result.positional;if(!Number.isSafeInteger(i)||i<0)return{stdout:"",stderr:`base64: invalid wrap size `,exitCode:1};try{if(n){let c=await Jb(t,a,"base64");if(!c.ok)return c.error;if(typeof Buffer<"u"){let h=Buffer.from(c.data).toString("utf8").replace(/\s/g,""),m=Yb(h);yn(m,t.limits.maxStringLength,"decoded size","string_length"),yn(m,t.limits.maxOutputSize,"output size","output_size");let g=Buffer.from(h,"base64");return yn(g.length,t.limits.maxOutputSize,"output size","output_size"),{stdout:g.toString("latin1"),stderr:"",exitCode:0,stdoutEncoding:"binary"}}let p=Kb(c.data).replace(/\s/g,""),d=Yb(p);yn(d,t.limits.maxStringLength,"decoded size","string_length"),yn(d,t.limits.maxOutputSize,"output size","output_size");let f=atob(p);return yn(f.length,t.limits.maxOutputSize,"output size","output_size"),{stdout:f,stderr:"",exitCode:0,stdoutEncoding:"binary"}}let s=await Jb(t,a,"base64");if(!s.ok)return s.error;let o=Math.ceil(s.data.length/3)*4,l=i>0&&o>0?Math.ceil(o/i):0;if(l>t.limits.maxArrayElements)throw new T(`base64: wrapped line limit exceeded (${t.limits.maxArrayElements})`,"array_elements");yn(o,t.limits.maxStringLength,"encoded size","string_length"),yn(o+l,t.limits.maxOutputSize,"output size","output_size");let u;if(typeof Buffer<"u"?u=Buffer.from(s.data).toString("base64"):u=btoa(Kb(s.data)),i>0){let c=[];for(let p=0;p0?` `:"")}return{stdout:u,stderr:"",exitCode:0}}catch(s){return Ge(s),{stdout:"",stderr:`base64: invalid input `,exitCode:1}}}},C5={name:"base64",flags:[{flag:"-d",type:"boolean"},{flag:"-w",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0}});function r3(e){if(e==="")return{lines:[],noEol:!1};let t=!e.endsWith(` `),r=e.split(` `);return t||r.pop(),{lines:r,noEol:t}}function n3(e,t){let r=e.lines.length-1;return e.lines.map((n,i)=>{let a=i===r&&e.noEol?n:`${n} `;return t?a.toLowerCase():a})}function DL(e,t,r){let n=zp(n3(e,r),n3(t,r)),i=[],a=0,s=0,o=0;for(;o ")}return n.join("")}function k5(e,t){let r=[],n=[];for(let i of e){let a=n[n.length-1];a&&i.oldStart-(a.oldStart+a.oldCount)>2*t&&(r.push(n),n=[]),n.push(i)}return n.length>0&&r.push(n),r}function N5(e,t,r,n){let i=e[0],a=e[e.length-1];return{oldFrom:Math.max(0,i.oldStart-n),oldTo:Math.min(t.lines.length,a.oldStart+a.oldCount+n),newFrom:Math.max(0,i.newStart-n),newTo:Math.min(r.lines.length,a.newStart+a.newCount+n)}}function a3(e,t){let r=t-e;return r===0?`${e},0`:r===1?String(e+1):`${e+1},${r}`}function LL(e,t,r,n,i,a){let s=[`--- ${Oc(e)} `,`+++ ${Oc(t)} `];for(let o of k5(i,a)){let l=N5(o,r,n,a);s.push(`@@ -${a3(l.oldFrom,l.oldTo)} +${a3(l.newFrom,l.newTo)} @@ `);let u=l.oldFrom;for(let c of o){for(;u(a?o.oldCount:o.newCount)>0))return;let s=n;for(let o of r){let l=a?o.oldStart:o.newStart,u=a?o.oldCount:o.newCount;for(;s0&&o.newCount>0?"! ":a?"- ":"+ ";for(let p=0;p{"use strict";T5=`\\ No newline at end of file `,y1=3}),_5={};ce(_5,{diffCommand:()=>O5,flagsForFuzzing:()=>I5});var l3,u3,O5,I5,FL=q(()=>{"use strict";ge(),sr(),be(),PL(),l3={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:[" --normal output a normal diff (default)","-u, --unified output a unified diff","-c, --context output a context diff","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --version output version information and exit"," --help display this help and exit"]},u3={normal:{long:"normal",type:"boolean"},unified:{short:"u",long:"unified",type:"boolean"},context:{short:"c",long:"context",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"},version:{long:"version",type:"boolean"}},O5={name:"diff",async execute(e,t){if(Ce(e))return we(l3);let r=ar("diff",e,u3);if(!r.ok)return r.error;let n=r.result.flags;if(n.version)return{stdout:`diff (just-bash) `,stderr:"",exitCode:0};if(Number(n.normal)+Number(n.unified)+Number(n.context)>1)return{stdout:"",stderr:`diff: conflicting output style options diff: Try 'diff --help' for more information. `,exitCode:2};let i=n.brief,a=n.reportSame,s=n.ignoreCase,o=r.result.positional;if(o.length<2)return{stdout:"",stderr:`diff: missing operand `,exitCode:2};let l,u,[c,p]=o;try{l=c==="-"?Ve(t.stdin):await t.fs.readFile(t.fs.resolvePath(t.cwd,c))}catch{return{stdout:"",stderr:`diff: ${c}: No such file or directory `,exitCode:2}}try{u=p==="-"?Ve(t.stdin):await t.fs.readFile(t.fs.resolvePath(t.cwd,p))}catch{return{stdout:"",stderr:`diff: ${p}: No such file or directory `,exitCode:2}}let d=l,f=u;if(s&&(d=d.toLowerCase(),f=f.toLowerCase()),d===f)return a?{stdout:`Files ${c} and ${p} are identical `,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};if(i)return{stdout:`Files ${c} and ${p} differ `,stderr:"",exitCode:1};let h=r3(l),m=r3(u),g=DL(h,m,s),x;return n.unified?x=LL(c,p,h,m,g,y1):n.context?x=ML(c,p,h,m,g,y1):x=RL(h,m,g),{stdout:x,stderr:"",exitCode:1}}},I5={name:"diff",flags:[{flag:"--normal",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2}}),$5={};ce($5,{dateCommand:()=>D5,flagsForFuzzing:()=>R5});function BL(e){try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),!0}catch{return!1}}function UL(e,t){let r=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(e),n=s=>r.find(o=>o.type===s)?.value??"00",i=Number.parseInt(n("hour"),10)%24,a=new Date(`${n("year")}-${n("month")}-${n("day")}T${String(i).padStart(2,"0")}:${n("minute")}:${n("second")}Z`);return Number.isNaN(a.getTime())?null:a}function zL(e,t){let r=e.match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?$/);if(!r)return null;let[,n,i,a,s="00",o="00",l="00"]=r,u=new Date(`${n}-${i}-${a}T${s}:${o}:${l}Z`);if(Number.isNaN(u.getTime()))return null;try{let c=u;for(let p=0;p<3;p++){let d=UL(c,t);if(d===null)return null;let f=d.getTime()-u.getTime();if(f===0)return c;c=new Date(c.getTime()-f)}return c}catch{return null}}function qL(e,t){if(e.startsWith("@")){let i=e.slice(1);if(!/^-?\d+$/.test(i))return null;let a=Number(i);if(!Number.isSafeInteger(a))return null;let s=new Date(a*1e3);return Number.isNaN(s.getTime())?null:s}let r=e.toLowerCase().trim();if(r==="now"||r==="today")return new Date;if(r==="yesterday")return new Date(Date.now()-864e5);if(r==="tomorrow")return new Date(Date.now()+864e5);if(t&&!/Z$/i.test(e)&&!/[+-]\d{2}:?\d{2}$/.test(e)){let i=zL(e,t);if(i)return i}let n=new Date(e);return Number.isNaN(n.getTime())?null:n}var c3,D5,R5,HL=q(()=>{"use strict";be(),X4(),c3={name:"date",summary:"display the current time in the given FORMAT",usage:"date [OPTION]... [+FORMAT]",options:["-d, --date=STRING display time described by STRING, not 'now'","-u, --utc print Coordinated Universal Time (UTC)","-I, --iso-8601 output date/time in ISO 8601 format","-R, --rfc-email output RFC 5322 date format"," --help display this help and exit"]},D5={name:"date",async execute(e,t){if(Ce(e))return we(c3);let r=!1,n=null,i=null,a=!1,s=!1;for(let f=0;f{"use strict"}),P5={};ce(P5,{flagsForFuzzing:()=>B5,sleepCommand:()=>F5});var p3,ih,F5,B5,WL=q(()=>{"use strict";Xs(),M5(),be(),p3={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be: s - seconds (default) m - minutes h - hours d - days NUMBER may be a decimal number.`,options:[" --help display this help and exit"]},ih=36e5,F5={name:"sleep",async execute(e,t){if(Ce(e))return we(p3);if(e.length===0)return{stdout:"",stderr:`sleep: missing operand `,exitCode:1};let r=0;for(let n of e){let i=L5(n);if(i===null)return{stdout:"",stderr:`sleep: invalid time interval '${n}' `,exitCode:1};r+=i}if(r>ih&&(r=ih),t.signal?.aborted)return{stdout:"",stderr:"",exitCode:0};if(t.sleep){let n=Promise.resolve(t.sleep(r));if(t.signal){let i,a=new Promise(s=>{i=s,t.signal?.addEventListener("abort",i,{once:!0}),t.signal?.aborted&&s()});try{await Promise.race([n,a])}finally{i&&t.signal.removeEventListener("abort",i)}}else await n}else t.signal?await new Promise(n=>{let i=()=>{Zc(a),n()},a=al(()=>{t.signal?.removeEventListener("abort",i),n()},r);t.signal?.addEventListener("abort",i,{once:!0})}):await new Promise(n=>al(n,r));return{stdout:"",stderr:"",exitCode:0}}},B5={name:"sleep",flags:[],needsArgs:!0}}),U5={};ce(U5,{flagsForFuzzing:()=>q5,timeoutCommand:()=>z5});var f3,z5,q5,jL=q(()=>{"use strict";wl(),ge(),Qs(),Xs(),M5(),be(),f3={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION. DURATION is a number with optional suffix: s - seconds (default) m - minutes h - hours d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]},z5={name:"timeout",async execute(e,t){if(Ce(e))return we(f3);let r=0;for(let p=0;p1&&d!=="--")if(d.startsWith("-k"))r=p+1;else if(d.startsWith("-s"))r=p+1;else return Le("timeout",d);else{r=p;break}}}let n=e.slice(r);if(n.length===0)return{stdout:"",stderr:`timeout: missing operand `,exitCode:1};let i=n[0],a=L5(i);if(a===null)return{stdout:"",stderr:`timeout: invalid time interval '${i}' `,exitCode:1};let s=n.slice(1);if(s.length===0)return{stdout:"",stderr:`timeout: missing operand `,exitCode:1};if(!t.exec)return{stdout:"",stderr:`timeout: exec not available `,exitCode:1};let o=new AbortController,l=p0(t.signal,o.signal),u,c;try{let p=new Promise(h=>{c=()=>h({timedOut:!0}),l.signal?.addEventListener("abort",c,{once:!0}),u=al(()=>{o.abort()},a)}),d=t.exec(Ga([s[0]]),{cwd:t.cwd,signal:l.signal,stdin:t.stdin,stdinKind:"bytes",args:s.slice(1)}).then(h=>({timedOut:!1,result:h})),f=await Promise.race([p,d]);return f.timedOut?(await d.catch(()=>{}),{stdout:"",stderr:"",exitCode:124}):f.result}finally{u!==void 0&&Zc(u),c&&l.signal?.removeEventListener("abort",c),l.cleanup()}}},q5={name:"timeout",flags:[{flag:"-k",type:"value",valueHint:"string"},{flag:"-s",type:"value",valueHint:"string"},{flag:"--preserve-status",type:"boolean"},{flag:"--foreground",type:"boolean"}],needsArgs:!0,minArgs:2}}),GL,VL,cl,T0,H5,W5,Ks=q(()=>{"use strict";GL=globalThis.SharedArrayBuffer,VL=globalThis.Atomics,cl=performance.now.bind(performance),T0=globalThis.Headers,H5=globalThis.Proxy,W5=Promise.prototype.then}),j5={};ce(j5,{flagsForFuzzing:()=>V5,timeCommand:()=>G5});function ZL(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=e%60;return t>0?`${t}:${r.toString().padStart(2,"0")}:${n.toFixed(2).padStart(5,"0")}`:`${r}:${n.toFixed(2).padStart(5,"0")}`}var G5,V5,XL=q(()=>{"use strict";ge(),Nn(),ia(),Qs(),Ks(),G5={name:"time",async execute(e,t){let r="%e %M",n=null,i=!1,a=!1,s=0;for(;s=e.length)return{stdout:"",stderr:`time: missing argument to '-f' `,exitCode:1};r=e[s],s++}else if(f==="-o"||f==="--output"){if(s++,s>=e.length)return{stdout:"",stderr:`time: missing argument to '-o' `,exitCode:1};n=e[s],s++}else if(f==="-a"||f==="--append")i=!0,s++;else if(f==="-v"||f==="--verbose")r=`Command being timed: %C Elapsed (wall clock) time: %e seconds Maximum resident set size (kbytes): %M`,s++;else if(f==="-p"||f==="--portability")a=!0,s++;else if(f==="--"){s++;break}else if(f.startsWith("-"))s++;else break}let o=e.slice(s);if(o.length===0)return{stdout:"",stderr:"",exitCode:0};let l=cl(),u=o.join(" "),c;try{if(!t.exec)return{stdout:"",stderr:`time: exec not available `,exitCode:1};c=await t.exec(Ga([o[0]]),{env:Fn(t.env),cwd:t.cwd,stdin:t.stdin,stdinKind:"bytes",signal:t.signal,args:o.slice(1)})}catch(f){c={stdout:"",stderr:`time: ${Xt(f.message)} `,exitCode:127}}let p=(cl()-l)/1e3,d;if(a?d=`real ${p.toFixed(2)} user 0.00 sys 0.00 `:(d=r.replace(/%e/g,p.toFixed(2)).replace(/%E/g,ZL(p)).replace(/%M/g,"0").replace(/%S/g,"0.00").replace(/%U/g,"0.00").replace(/%P/g,"0%").replace(/%C/g,u),d.endsWith(` `)||(d+=` `)),n)try{let f=t.fs.resolvePath(t.cwd,n);if(i&&await t.fs.exists(f)){let h=await t.fs.readFile(f);await t.fs.writeFile(f,h+d)}else await t.fs.writeFile(f,d)}catch(f){let h=Xt(f.message);return{stdout:c.stdout,stderr:c.stderr+`time: cannot write to '${n}': ${h} `,exitCode:c.exitCode}}else c={...c,stderr:c.stderr+d};return c}},V5={name:"time",flags:[{flag:"-p",type:"boolean"}],needsArgs:!0}}),Z5={};ce(Z5,{flagsForFuzzing:()=>Q5,seqCommand:()=>X5});var X5,Q5,QL=q(()=>{"use strict";Yt(),ge(),J(),X5={name:"seq",async execute(e,t){let r=` `,n=!1,i=[],a=0;for(;a2){r=b.slice(2),a++;continue}if((b==="-ws"||b==="-sw")&&(n=!0,a+1!Number.isFinite(parseFloat(b)))}' `,exitCode:1};if(o===0)return{stdout:"",stderr:`seq: invalid Zero increment value: '0' `,exitCode:1};let u=[],c=b=>{let k=String(b),w=k.indexOf(".");return w===-1?0:k.length-w-1},p=Math.max(c(s),c(o),c(l)),d=Math.min(t.limits.maxLoopIterations,t.limits.maxArrayElements),f=Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),h=K(r),m=0,g=0,x=b=>{if(g>=d)throw new T(`seq: iteration limit exceeded (${d})`,"iterations");let k=bs(bs(m,u.length>0?h:0,"seq"),bs(K(b),1,"seq"),"seq");if(k>f)throw new T(`seq: output size limit exceeded (${f} bytes)`,"output_size");m=k-1,u.push(b),g++};if(o>0)for(let b=s;b<=l+1e-10;b+=o)x(p>0?b.toFixed(p):String(Math.round(b)));else for(let b=s;b>=l-1e-10;b+=o)x(p>0?b.toFixed(p):String(Math.round(b)));if(n&&u.length>0){let b=0;for(let w of u)b=Math.max(b,w.startsWith("-")?w.length-1:w.length);let k=u.reduce((w,v)=>bs(w,b+(v.startsWith("-")?1:0),"seq"),0);if(bs(bs(k,dO(h,Math.max(0,u.length-1),"seq"),"seq"),1,"seq")>f)throw new T(`seq: output size limit exceeded (${f} bytes)`,"output_size");for(let w=0;wY5,flagsForFuzzing:()=>J5});function KL(e,t){if(e.length===1)return e[0];let r=0;function n(){let p=i();for(;r","<=",">="].includes(d)){r++;let f=s(),h=parseInt(p,10),m=parseInt(f,10),g=!Number.isNaN(h)&&!Number.isNaN(m),x;d==="="?x=g?h===m:p===f:d==="!="?x=g?h!==m:p!==f:d==="<"?x=g?h"?x=g?h>m:p>f:d==="<="?x=g?h<=m:p<=f:x=g?h>=m:p>=f,p=x?"1":"0"}else break}return p}function s(){let p=o();for(;r=e.length)throw new Error("syntax error");let p=e[r];if(p==="match"){r++;let d=u(),f=u(),h=Ie(f).match(d);return h?h[1]!==void 0?h[1]:String(h[0].length):"0"}if(p==="substr"){r++;let d=u(),f=parseInt(u(),10),h=parseInt(u(),10);if(Number.isNaN(f)||Number.isNaN(h))throw new Error("non-integer argument");return d.substring(f-1,f-1+h)}if(p==="index"){r++;let d=u(),f=u();t(f.length+d.length);let h=new Set;for(let m=0;m=e.length||e[r]!==")")throw new Error("syntax error");return r++,d}return r++,p}let c=n();if(r!==e.length)throw new Error("syntax error");return c}var Y5,J5,YL=q(()=>{"use strict";Ar(),Nn(),Dt(),Y5={name:"expr",async execute(e,t){if(e.length===0)return{stdout:"",stderr:`expr: missing operand `,exitCode:2};try{let r=KL(e,i=>t.executionScope?.consumeWork(i,"expr index")),n=r==="0"||r===""?1:0;return{stdout:`${r} `,stderr:"",exitCode:n}}catch(r){return Ge(r),{stdout:"",stderr:`expr: ${Xt(r.message)} `,exitCode:2}}}},J5={name:"expr",flags:[],needsArgs:!0}});function JL(e){function t(f,h){return f<>>32-h}let r=new Uint32Array([3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745]),n=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],i=e.length*8,a=(e.length%64<56?56:120)-e.length%64,s=new Uint8Array(e.length+a+8);s.set(e),s[e.length]=128;let o=new DataView(s.buffer);o.setUint32(s.length-8,i>>>0,!0),o.setUint32(s.length-4,Math.floor(i/4294967296),!0);let l=1732584193,u=4023233417,c=2562383102,p=271733878;for(let f=0;f>>0,m=y,y=x,x=g,g=g+t(k,n[b])>>>0}l=l+m>>>0,u=u+g>>>0,c=c+x>>>0,p=p+y>>>0}let d=new Uint8Array(16);return new DataView(d.buffer).setUint32(0,l,!0),new DataView(d.buffer).setUint32(4,u,!0),new DataView(d.buffer).setUint32(8,c,!0),new DataView(d.buffer).setUint32(12,p,!0),Array.from(d).map(f=>f.toString(16).padStart(2,"0")).join("")}async function d3(e,t){if(e==="md5")return JL(t);let r=eE.get(e);if(!r)throw new Error(`Unknown algorithm: ${e}`);let n=await globalThis.crypto.subtle.digest(r,new Uint8Array(t).buffer);return Array.from(new Uint8Array(n)).map(i=>i.toString(16).padStart(2,"0")).join("")}function _0(e,t,r){let n={name:e,summary:r,usage:`${e} [OPTION]... [FILE]...`,options:["-c, --check read checksums from FILEs and check them"," --help display this help and exit"]};return{name:e,async execute(i,a){if(Ce(i))return we(n);let s=!1,o=[];for(let p of i)if(p==="-c"||p==="--check")s=!0;else if(!(p==="-b"||p==="-t"||p==="--binary"||p==="--text")){if(p.startsWith("-")&&p!=="-")return Le(e,p);o.push(p)}o.length===0&&o.push("-");let l=async p=>{if(p==="-")return Uint8Array.from(a.stdin,d=>d.charCodeAt(0));try{return await a.fs.readFileBuffer(a.fs.resolvePath(a.cwd,p))}catch{return null}};if(s){let p=0,d="";for(let f of o){let h=f==="-"?Ve(a.stdin):await a.fs.readFile(a.fs.resolvePath(a.cwd,f)).catch(()=>null);if(h===null)return{stdout:"",stderr:`${e}: ${f}: No such file or directory `,exitCode:1};for(let m of h.split(` `)){let g=m.match(/^([a-fA-F0-9]+)\s+[* ]?(.+)$/);if(!g)continue;let[,x,y]=g,b=await l(y);if(b===null){d+=`${y}: FAILED open or read `,p++;continue}let k=await d3(t,b)===x.toLowerCase();d+=`${y}: ${k?"OK":"FAILED"} `,k||p++}}return p>0&&(d+=`${e}: WARNING: ${p} computed checksum${p>1?"s":""} did NOT match `),{stdout:d,stderr:"",exitCode:p>0?1:0}}let u="",c=0;for(let p of o){let d=await l(p);if(d===null){u+=`${e}: ${p}: No such file or directory `,c=1;continue}u+=`${await d3(t,d)} ${p} `}return{stdout:u,stderr:"",exitCode:c}}}}var eE,O0=q(()=>{"use strict";ge(),be(),eE=new Map([["sha1","SHA-1"],["sha256","SHA-256"]])}),tE={};ce(tE,{flagsForFuzzing:()=>nE,md5sumCommand:()=>rE});var rE,nE,eM=q(()=>{"use strict";O0(),rE=_0("md5sum","md5","compute MD5 message digest"),nE={name:"md5sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}}),iE={};ce(iE,{flagsForFuzzing:()=>sE,sha1sumCommand:()=>aE});var aE,sE,tM=q(()=>{"use strict";O0(),aE=_0("sha1sum","sha1","compute SHA1 message digest"),sE={name:"sha1sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}}),oE={};ce(oE,{flagsForFuzzing:()=>uE,sha256sumCommand:()=>lE});var lE,uE,rM=q(()=>{"use strict";O0(),lE=_0("sha256sum","sha256","compute SHA256 message digest"),uE={name:"sha256sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}}),nM=Vc(e=>{e.read=function(t,r,n,i,a){var s,o,l=a*8-i-1,u=(1<>1,p=-7,d=n?a-1:0,f=n?-1:1,h=t[r+d];for(d+=f,s=h&(1<<-p)-1,h>>=-p,p+=l;p>0;s=s*256+t[r+d],d+=f,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=i;p>0;o=o*256+t[r+d],d+=f,p-=8);if(s===0)s=1-c;else{if(s===u)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-c}return(h?-1:1)*o*Math.pow(2,s-i)},e.write=function(t,r,n,i,a,s){var o,l,u,c=s*8-a-1,p=(1<>1,f=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,m=i?1:-1,g=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(l=isNaN(r)?1:0,o=p):(o=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?r+=f/u:r+=f*Math.pow(2,1-d),r*u>=2&&(o++,u/=2),o+d>=p?(l=0,o=p):o+d>=1?(l=(r*u-1)*Math.pow(2,a),o=o+d):(l=r*Math.pow(2,d-1)*Math.pow(2,a),o=0));a>=8;t[n+h]=l&255,h+=m,l/=256,a-=8);for(o=o<0;t[n+h]=o&255,h+=m,o/=256,c-=8);t[n+h-m]|=g*128}});function iM(){if(!(typeof globalThis.TextDecoder>"u"))return m3??(m3=new globalThis.TextDecoder("utf-8"))}function aM(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let r=iM();return r?r.decode(e):oM(e)}case"utf-16le":return lM(e);case"us-ascii":case"ascii":return uM(e);case"latin1":case"iso-8859-1":return cM(e);case"windows-1252":return pM(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function I0(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function or(e,t,r){t.push(r),t.length>=Xa&&I0(e,t)}function sM(e,t,r){if(r<=65535){or(e,t,r);return}r-=65536,or(e,t,55296+(r>>10)),or(e,t,56320+(r&1023))}function oM(e){let t=[],r=[],n=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(n=3);n244){or(t,r,vn),n++;continue}if(i<=223){if(n+1>=e.length){or(t,r,vn),n++;continue}let u=e[n+1];if((u&192)!==128){or(t,r,vn),n++;continue}let c=(i&31)<<6|u&63;or(t,r,c),n+=2;continue}if(i<=239){if(n+2>=e.length){or(t,r,vn),n++;continue}let u=e[n+1],c=e[n+2];if(!((u&192)===128&&(c&192)===128&&!(i===224&&u<160)&&!(i===237&&u>=160))){or(t,r,vn),n++;continue}let p=(i&15)<<12|(u&63)<<6|c&63;or(t,r,p),n+=3;continue}if(n+3>=e.length){or(t,r,vn),n++;continue}let a=e[n+1],s=e[n+2],o=e[n+3];if(!((a&192)===128&&(s&192)===128&&(o&192)===128&&!(i===240&&a<144)&&!(i===244&&a>143))){or(t,r,vn),n++;continue}let l=(i&7)<<18|(a&63)<<12|(s&63)<<6|o&63;sM(t,r,l),n+=4}return I0(t,r),t.join("")}function lM(e){let t=[],r=[],n=e.length,i=0;for(;i+1=55296&&a<=56319){if(i+1=56320&&s<=57343?(or(t,r,a),or(t,r,s),i+=2):or(t,r,vn)}else or(t,r,vn);continue}if(a>=56320&&a<=57343){or(t,r,vn);continue}or(t,r,a)}return i=128&&i<=159?b1[i]:void 0;r+=a??String.fromCharCode(i),r.length>=Xa&&(t.push(r),r="")}return r&&t.push(r),t.join("")}var b1,h3,m3,Xa,vn,fM=q(()=>{b1={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},h3={};for(let[e,t]of Object.entries(b1))h3[t]=Number.parseInt(e,10);Xa=32*1024,vn=65533});function Wr(e){return new DataView(e.buffer,e.byteOffset)}var dM,cE,Vt,_a,Zt,w1,pE,fE,oi,sp=q(()=>{dM=E4(nM(),1),fM(),cE={len:1,get(e,t){return Wr(e).getUint8(t)},put(e,t,r){return Wr(e).setUint8(t,r),t+1}},Vt={len:2,get(e,t){return Wr(e).getUint16(t,!0)},put(e,t,r){return Wr(e).setUint16(t,r,!0),t+2}},_a={len:2,get(e,t){return Wr(e).getUint16(t)},put(e,t,r){return Wr(e).setUint16(t,r),t+2}},Zt={len:4,get(e,t){return Wr(e).getUint32(t,!0)},put(e,t,r){return Wr(e).setUint32(t,r,!0),t+4}},w1={len:4,get(e,t){return Wr(e).getUint32(t)},put(e,t,r){return Wr(e).setUint32(t,r),t+4}},pE={len:4,get(e,t){return Wr(e).getInt32(t)},put(e,t,r){return Wr(e).setInt32(t,r),t+4}},fE={len:8,get(e,t){return Wr(e).getBigUint64(t,!0)},put(e,t,r){return Wr(e).setBigUint64(t,r,!0),t+8}},oi=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t=0){let r=e.subarray(t,t+this.len);return aM(r,this.encoding)}}}),g3,rr,dE,op=q(()=>{g3="End-Of-Stream",rr=class extends Error{constructor(){super(g3),this.name="EndOfStreamError"}},dE=class extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}}}),hM=q(()=>{}),$0,D0=q(()=>{op(),$0=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){let r=await this.read(e,t);return this.peekQueue.push(e.subarray(0,r)),r}async read(e,t=!1){if(e.length===0)return 0;let r=this.readFromPeekBuffer(e);if(this.endOfStream||(r+=await this.readRemainderFromStream(e.subarray(r),t)),r===0&&!t)throw new rr;return r}readFromPeekBuffer(e){let t=e.length,r=0;for(;this.peekQueue.length>0&&t>0;){let n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");let i=Math.min(n.length,t);e.set(n.subarray(0,i),r),r+=i,t-=i,i{op(),hM(),D0()}),hE,gM=q(()=>{D0(),hE=class extends $0{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}}}),mE,gE=q(()=>{gM(),mE=class extends hE{async readFromStream(e,t){if(e.length===0)return 0;let r=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return r.done&&(this.endOfStream=r.done),r.value?(e.set(r.value),r.value.length):0}}}),v1,xE=q(()=>{op(),D0(),v1=class extends $0{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){let r=Math.min(t.length,e.length);return e.set(t.subarray(0,r)),r{gE(),xE()}),qs=q(()=>{op(),mM(),gE(),xE(),yM()}),lp,up=q(()=>{qs(),lp=class{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e?.onClose,e?.abortSignal&&e.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.readBuffer(r,{position:t})t)return this.position+=t,t}return this.position+=e,e}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(e,t){if(!this.supportsRandomAccess()&&t&&t.position!==void 0&&t.position{up(),qs(),x3=256e3,yE=class extends lp{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=t?.fileInfo??{}}async readBuffer(e,t){let r=this.normalizeOptions(e,t),n=r.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;let i=await this.streamReader.read(e.subarray(0,r.length),r.mayBeLess);if(this.position+=i,(!t||!t.mayBeLess)&&i0){let a=new Uint8Array(r.length+i);return n=await this.peekBuffer(a,{mayBeLess:r.mayBeLess}),e.set(a.subarray(i)),n-i}if(i<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{n=await this.streamReader.peek(e.subarray(0,r.length),r.mayBeLess)}catch(i){if(t?.mayBeLess&&i instanceof rr)return 0;throw i}if(!r.mayBeLess&&n{qs(),up(),bE=class extends lp{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo={...t?.fileInfo??{},size:e.length}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&n{qs(),up(),wE=class extends lp{constructor(e,t){super(t),this.blob=e,this.fileInfo={...t?.fileInfo??{},size:e.size,mimeType:e.type}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&n{if(await r.close(),i)return i()},new yE(r,n)}function SM(e,t){return new bE(e,t)}function AM(e,t){return new wE(e,t)}var CM=q(()=>{qs(),bM(),wM(),vM(),qs(),up()}),kM=Vc((e,t)=>{var r=1e3,n=r*60,i=n*60,a=i*24,s=a*7,o=a*365.25;t.exports=function(d,f){f=f||{};var h=typeof d;if(h==="string"&&d.length>0)return l(d);if(h==="number"&&isFinite(d))return f.long?c(d):u(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))};function l(d){if(d=String(d),!(d.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(f){var h=parseFloat(f[1]),m=(f[2]||"ms").toLowerCase();switch(m){case"years":case"year":case"yrs":case"yr":case"y":return h*o;case"weeks":case"week":case"w":return h*s;case"days":case"day":case"d":return h*a;case"hours":case"hour":case"hrs":case"hr":case"h":return h*i;case"minutes":case"minute":case"mins":case"min":case"m":return h*n;case"seconds":case"second":case"secs":case"sec":case"s":return h*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function u(d){var f=Math.abs(d);return f>=a?Math.round(d/a)+"d":f>=i?Math.round(d/i)+"h":f>=n?Math.round(d/n)+"m":f>=r?Math.round(d/r)+"s":d+"ms"}function c(d){var f=Math.abs(d);return f>=a?p(d,f,a,"day"):f>=i?p(d,f,i,"hour"):f>=n?p(d,f,n,"minute"):f>=r?p(d,f,r,"second"):d+" ms"}function p(d,f,h,m){var g=f>=h*1.5;return Math.round(d/h)+" "+m+(g?"s":"")}}),NM=Vc((e,t)=>{function r(n){a.debug=a,a.default=a,a.coerce=p,a.disable=u,a.enable=o,a.enabled=c,a.humanize=kM(),a.destroy=d,Object.keys(n).forEach(f=>{a[f]=n[f]}),a.names=[],a.skips=[],a.formatters={};function i(f){let h=0;for(let m=0;m{if(R==="%%")return"%";A++;let $=a.formatters[I];if(typeof $=="function"){let _=b[A];R=$.call(k,_),b.splice(A,1),A--}return R}),a.formatArgs.call(k,b),(k.log||a.log).apply(k,b)}return y.namespace=f,y.useColors=a.useColors(),y.color=a.selectColor(f),y.extend=s,y.destroy=a.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>m!==null?m:(g!==a.namespaces&&(g=a.namespaces,x=a.enabled(f)),x),set:b=>{m=b}}),typeof a.init=="function"&&a.init(y),y}function s(f,h){let m=a(this.namespace+(typeof h>"u"?":":h)+f);return m.log=this.log,m}function o(f){a.save(f),a.namespaces=f,a.names=[],a.skips=[];let h=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let m of h)m[0]==="-"?a.skips.push(m.slice(1)):a.names.push(m)}function l(f,h){let m=0,g=0,x=-1,y=0;for(;m"-"+h)].join(",");return a.enable(""),f}function c(f){for(let h of a.skips)if(l(f,h))return!1;for(let h of a.names)if(l(f,h))return!0;return!1}function p(f){return f instanceof Error?f.stack||f.message:f}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return a.enable(a.load()),a}t.exports=r}),TM=Vc((e,t)=>{e.formatArgs=n,e.save=i,e.load=a,e.useColors=r,e.storage=s(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let l;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;let u="color: "+this.color;l.splice(1,0,u,"color: inherit");let c=0,p=0;l[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(c++,d==="%c"&&(p=c))}),l.splice(p,0,u)}e.log=console.debug||console.log||(()=>{});function i(l){try{l?e.storage.setItem("debug",l):e.storage.removeItem("debug")}catch{}}function a(){let l;try{l=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=process.env.DEBUG),l}function s(){try{return localStorage}catch{}}t.exports=NM()(e);var{formatters:o}=t.exports;o.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}),Oa,E1,vE,EE,SE,_M=q(()=>{sp(),Oa={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},E1={get(e){return{signature:Zt.get(e,0),compressedSize:Zt.get(e,8),uncompressedSize:Zt.get(e,12)}},len:16},vE={get(e){let t=Vt.get(e,6);return{signature:Zt.get(e,0),minVersion:Vt.get(e,4),dataDescriptor:!!(t&8),compressedMethod:Vt.get(e,8),compressedSize:Zt.get(e,18),uncompressedSize:Zt.get(e,22),filenameLength:Vt.get(e,26),extraFieldLength:Vt.get(e,28),filename:null}},len:30},EE={get(e){return{signature:Zt.get(e,0),nrOfThisDisk:Vt.get(e,4),nrOfThisDiskWithTheStart:Vt.get(e,6),nrOfEntriesOnThisDisk:Vt.get(e,8),nrOfEntriesOfSize:Vt.get(e,10),sizeOfCd:Zt.get(e,12),offsetOfStartOfCd:Zt.get(e,16),zipFileCommentLength:Vt.get(e,20)}},len:22},SE={get(e){let t=Vt.get(e,8);return{signature:Zt.get(e,0),minVersion:Vt.get(e,6),dataDescriptor:!!(t&8),compressedMethod:Vt.get(e,10),compressedSize:Zt.get(e,20),uncompressedSize:Zt.get(e,24),filenameLength:Vt.get(e,28),extraFieldLength:Vt.get(e,30),fileCommentLength:Vt.get(e,32),relativeOffsetOfLocalHeader:Zt.get(e,42),filename:null}},len:46}});function y3(e){let t=new Uint8Array(Zt.len);return Zt.put(t,0,e),t}function OM(e,t){let r=e.length,n=t.length;if(n>r)return-1;for(let i=0;i<=r-n;i++){let a=!0;for(let s=0;si+a.length,0),r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}var b3,Rn,Bu,w3,Ho,oc,$M=q(()=>{sp(),b3=E4(TM(),1),_M(),Rn=(0,b3.default)("tokenizer:inflate"),Bu=256*1024,w3=y3(Oa.DataDescriptor),Ho=y3(Oa.EndOfCentralDirectory),oc=class AE{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Bu)}async isZip(){return await this.peekSignature()===Oa.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Zt)}async findEndOfCentralDirectoryLocator(){let t=this.tokenizer,r=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,r);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-r});for(let i=n.length-4;i>=0;i--)if(n[i]===Ho[0]&&n[i+1]===Ho[1]&&n[i+2]===Ho[2]&&n[i+3]===Ho[3])return t.fileInfo.size-r+i;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){Rn("Cannot reading central-directory without random-read support");return}Rn("Reading central-directory...");let t=this.tokenizer.position,r=await this.findEndOfCentralDirectoryLocator();if(r>0){Rn("Central-directory 32-bit signature found");let n=await this.tokenizer.readToken(EE,r),i=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let a=0;a=0?u:l;if(a.handler){let p=new Uint8Array(c);await this.tokenizer.readBuffer(p),o.push(p)}else await this.tokenizer.ignore(c)}Rn(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),a.handler&&await this.inflate(i,IM(o),a.handler)}else a.handler?(Rn(`Reading compressed-file-data: ${i.compressedSize} bytes`),s=new Uint8Array(i.compressedSize),await this.tokenizer.readBuffer(s),await this.inflate(i,s,a.handler)):(Rn(`Ignoring compressed-file-data: ${i.compressedSize} bytes`),await this.tokenizer.ignore(i.compressedSize));if(Rn(`Reading data-descriptor at pos=${this.tokenizer.position}`),i.dataDescriptor&&(await this.tokenizer.readToken(E1)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-E1.len}`)}while(!n)}async iterateOverCentralDirectory(t,r){for(let n of t){let i=r(n);if(i.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);let a=await this.readLocalFileHeader();if(a){await this.tokenizer.ignore(a.extraFieldLength);let s=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(s),await this.inflate(a,s,i.handler)}}if(i.stop)break}}async inflate(t,r,n){if(t.compressedMethod===0)return n(r);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);Rn(`Decompress filename=${t.filename}, compressed-size=${r.length}`);let i=await AE.decompressDeflateRaw(r);return n(i)}static async decompressDeflateRaw(t){let r=new ReadableStream({start(a){a.enqueue(t),a.close()}}),n=new DecompressionStream("deflate-raw"),i=r.pipeThrough(n);try{let a=await new Response(i).arrayBuffer();return new Uint8Array(a)}catch(a){let s=a instanceof Error?`Failed to deflate ZIP entry: ${a.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(s)}}async readLocalFileHeader(){let t=await this.tokenizer.peekToken(Zt);if(t===Oa.LocalFileHeader){let r=await this.tokenizer.readToken(vE);return r.filename=await this.tokenizer.readToken(new oi(r.filenameLength,"utf-8")),r}if(t===Oa.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}}),CE,DM=q(()=>{CE=class{constructor(e){this.tokenizer=e}inflate(){let e=this.tokenizer;return new ReadableStream({async pull(t){let r=new Uint8Array(1024),n=await e.readBuffer(r,{mayBeLess:!0});if(n===0){t.close();return}t.enqueue(r.subarray(0,n))}}).pipeThrough(new DecompressionStream("gzip"))}}}),RM=q(()=>{$M(),DM()});function v3(e){let{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}var LM,MM,PM,FM=q(()=>{LM={utf8:new globalThis.TextDecoder("utf8")},MM=new globalThis.TextEncoder,PM=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"))});function BM(e,t){if(t==="utf-16le"){let r=[];for(let n=0;n>8&255)}return r}if(t==="utf-16be"){let r=[];for(let n=0;n>8&255,i&255)}return r}return[...e].map(r=>r.charCodeAt(0))}function UM(e,t=0){let r=Number.parseInt(new oi(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let n=256;for(let i=t;i{sp(),kE={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4}}),NE,TE,qM=q(()=>{NE=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],TE=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"]});function HM(e){let t=e?.streamReader;if(t?.constructor?.name!=="WebStreamByobReader")return e;let{reader:r}=t,n=async()=>{await r.cancel(),r.releaseLock()};return t.close=n,t.abort=async()=>{t.interrupted=!0,await n()},e}function R0(e,t,r){if(!Number.isFinite(e)||e<0||e>t)throw new Yi(`${r} has invalid size ${e} (maximum ${t} bytes)`);return e}async function Ki(e,t,{maximumLength:r=tn,reason:n="skip"}={}){let i=R0(t,r,n);await e.ignore(i)}async function ah(e,t,r,{maximumLength:n=t.length,reason:i="read"}={}){let a=r?.length??t.length,s=R0(a,n,i);return e.readBuffer(t,{...r,length:s})}async function WM(e,{maximumLength:t=Un}={}){let r=new ReadableStream({start(o){o.enqueue(e),o.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),n=[],i=0;try{for(;;){let{done:o,value:l}=await r.read();if(o)break;if(i+=l.length,i>t)throw await r.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);n.push(l)}}finally{r.releaseLock()}let a=new Uint8Array(i),s=0;for(let o of n)a.set(o,s),s+=o.length;return a}function jM(e,t){if(e.length=0?0:o===i?Math.min(RE,o-1):0,c=l>=0?l:o-u;if(c===0)break;if(s+=c,s>r)throw new Error(`ZIP entry compressed data exceeds ${r} bytes`);if(t){let p=new Uint8Array(c);await e.tokenizer.readBuffer(p),a.push(p)}else await e.tokenizer.ignore(c);if(l>=0)break}if(Lr(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=s),!!t)return VM(a,s)}function XM(e,t){return Lr(e.tokenizer)?Math.max(0,tn-(e.tokenizer.position-t)):Math.max(0,Un-e.knownSizeDescriptorScannedBytes)}async function QM(e,t,{shouldBuffer:r,maximumDescriptorLength:n=Un}={}){if(t.dataDescriptor&&t.compressedSize===0)return ZM(e,{shouldBuffer:r,maximumLength:n});if(!r){await Ki(e.tokenizer,t.compressedSize,{maximumLength:Lr(e.tokenizer)?Un:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let i=nP(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>i)throw new Error(`ZIP entry compressed data exceeds ${i} bytes`);let a=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(a),a}function KM(e,t){let r=e.getReader(),n=0,i=!1,a=!1,s=async o=>{i||a||(a=!0,await r.cancel(o))};return new ReadableStream({async pull(o){if(n>=t){o.close(),await s();return}let{done:l,value:u}=await r.read();if(l||!u){i=!0,o.close();return}let c=t-n;if(u.length>c){o.enqueue(u.subarray(0,c)),n+=c,o.close(),await s();return}o.enqueue(u),n+=u.length},async cancel(o){await s(o)}})}async function YM(e,t){return new LE(t).fromBuffer(e)}function E3(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function ri(e,t,r){r={offset:0,...r};for(let[n,i]of t.entries())if(r.mask){if(i!==(r.mask[n]&e[n+r.offset]))return!1}else if(i!==e[n+r.offset])return!1;return!0}function JM(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):Rs}function eP(e,t,r){return r===void 0?e.read(t):(r.throwIfAborted(),new Promise((n,i)=>{let a=()=>{r.removeEventListener("abort",s)},s=()=>{let o=r.reason;a(),(async()=>{try{await e.cancel(o)}catch{}})(),i(o)};r.addEventListener("abort",s,{once:!0}),(async()=>{try{let o=await e.read(t);a(),n(o)}catch(o){a(),i(o)}})()}))}function tP(e){return Number.isFinite(e)?Math.max(0,Math.min(_E,Math.trunc(e))):0}function rP(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function Lr(e){let t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Wo(e,t,r){return Lr(e)&&e.position-t>r}function nP(e){let t=e.fileInfo.size,r=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(r,OE)}function iP(e){if(e instanceof rr||e instanceof Yi)return!0;if(!(e instanceof Error))return!1;if(IE.has(e.message)||DE.has(e.code))return!0;for(let t of $E)if(e.message.startsWith(t))return!0;return!1}function S3(e,t=Un){let r=[e.compressedSize,e.uncompressedSize];for(let n of r)if(!Number.isFinite(n)||n<0||n>t)return!1;return!0}function aP(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function sP(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function A3(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function oP(e){let t=e.indexOf('.main+xml"');if(t===-1){let i="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${i}"`)?i:void 0}let r=e.slice(0,t),n=r.lastIndexOf('"');return r.slice(n+1)}var Rs,_E,Un,sh,OE,tn,jo,oh,C3,k3,lh,Uu,uh,ch,N3,T3,_3,O3,I3,ph,fh,dh,$3,hh,IE,$E,DE,Yi,S1,tl,RE,LE,lP,uP,cP=q(()=>{sp(),CM(),RM(),FM(),zM(),qM(),Rs=4100,_E=Rs-2,Un=1024*1024,sh=1024,OE=2**31-1,tn=16*1024*1024,jo=Un,oh=Un,C3=tn,k3=1,lh=100,Uu=tn,uh=64,ch=jo,N3=256,T3=512,_3=tn,O3=512,I3=512,ph=256,fh=jo,dh=jo,$3=jo,hh=tn,IE=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),$E=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],DE=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]),Yi=class extends Error{},S1=134695760,tl=16,RE=tl-1,oc.prototype.inflate=async function(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);let n=await WM(t,{maximumLength:Un});return r(n)},oc.prototype.unzip=async function(e){let t=!1,r=0,n=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Wo(this.tokenizer,n,tn))throw new Yi(`ZIP stream probing exceeds ${tn} bytes`);let i=await this.readLocalFileHeader();if(!i)break;if(r++,r>sh)throw new Error(`ZIP entry count exceeds ${sh}`);let a=e(i);t=!!a.stop,await this.tokenizer.ignore(i.extraFieldLength);let s=await QM(this,i,{shouldBuffer:!!a.handler,maximumDescriptorLength:Math.min(Un,XM(this,n))});if(a.handler&&await this.inflate(i,s,a.handler),i.dataDescriptor){let o=new Uint8Array(tl);if(await this.tokenizer.readBuffer(o),Zt.get(o,0)!==S1)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-o.length}`)}if(Wo(this.tokenizer,n,tn))throw new Yi(`ZIP stream probing exceeds ${tn} bytes`)}while(!t)},LE=class ME{constructor(t){let r=tP(t?.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:r},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return HM(EM(t,this.getTokenizerOptions()))}async parseTokenizer(t,r=0){this.detectionReentryCount=r;let n=t.position;for(let i of this.detectors){let a;try{a=await i.detect(t)}catch(s){if(s instanceof rr||s instanceof Yi)return;throw s}if(a)return a;if(n!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);let r=t instanceof Uint8Array?t:new Uint8Array(t);if(r?.length>1)return this.fromTokenizer(SM(r,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let r=AM(t,this.getTokenizerOptions());return this.fromTokenizer(r)}async fromStream(t){this.options.signal?.throwIfAborted();let r=this.createTokenizerFromWebStream(t);return this.fromTokenizer(r)}async toDetectionStream(t,r){let n=JM(r?.sampleSize??Rs),i,a,s=t.getReader({mode:"byob"});try{let{value:u,done:c}=await eP(s,new Uint8Array(n),this.options.signal);if(a=u,!c&&u)try{i=await this.fromBuffer(u.subarray(0,n))}catch(p){if(!(p instanceof rr))throw p;i=void 0}a=u}finally{s.releaseLock()}let o=new TransformStream({async start(u){u.enqueue(a)},transform(u,c){c.enqueue(u)}}),l=t.pipeThrough(o);return l.fileType=i,l}async detectGzip(t){if(this.gzipProbeDepth>=k3)return{ext:"gz",mime:"application/gzip"};let r=new CE(t),n=KM(r.inflate(),C3),i=Lr(t),a,s,o,l;if(i){let u=new AbortController;a=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${lh} ms`,"TimeoutError"))},lh),s=this.options.signal===void 0?u.signal:AbortSignal.any([this.options.signal,u.signal]),o=new ME({...this.options,signal:s}),o.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{l=await(o??this).fromStream(n)}catch(u){if(u?.name==="AbortError"&&s?.reason?.name!=="TimeoutError")throw u}finally{clearTimeout(a),i||this.gzipProbeDepth--}return l?.ext==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,r){return ri(this.buffer,t,r)}checkString(t,r){return this.check(BM(t,r?.encoding),r)}detectConfident=async t=>{if(this.buffer=new Uint8Array(Rs),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,Lr(t)&&(await t.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(t);if(await t.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await t.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=ph?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(t));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(t);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await Ki(t,6,{maximumLength:6,reason:"ID3 header prefix"});let r=await t.readToken(kE),n=Lr(t);if(!Number.isFinite(r)||r<0||n&&(r>Uu||t.position+r>Uu))return;if(t.position+r>t.fileInfo.size)return n?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await Ki(t,r,{maximumLength:n?Uu:t.fileInfo.size,reason:"ID3 payload"})}catch(i){if(i instanceof rr)return;throw i}return this.detectionReentryCount>=ph?void 0:(this.detectionReentryCount++,this.parseTokenizer(t,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let r,n=aP();try{await new oc(t).unzip(i=>{sP(n,i.filename);let a=i.filename==="[Content_Types].xml",s=A3(n);if(!a&&s)return r=s,{stop:!0};switch(i.filename){case"META-INF/mozilla.rsa":return r={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return r={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return S3(i,oh)?{async handler(o){let l=new TextDecoder("utf-8").decode(o).trim();r=E3(l)},stop:!0}:{};case"[Content_Types].xml":return n.hasContentTypesEntry=!0,S3(i,oh)?(n.isParsingContentTypes=!0,{async handler(o){let l=new TextDecoder("utf-8").decode(o),u=oP(l);u&&(r=E3(u)),n.hasParsedContentTypesEntry=!0,n.isParsingContentTypes=!1},stop:!0}):(n.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(i.filename)?(r={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(i){if(!iP(i))throw i;n.isParsingContentTypes&&(n.isParsingContentTypes=!1,n.hasUnparseableContentTypes=!0)}return r??A3(n)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await t.ignore(28);let r=new Uint8Array(8);return await t.readBuffer(r),ri(r,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:ri(r,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:ri(r,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:ri(r,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:ri(r,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:ri(r,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let r=await this.readTiffHeader(!1);if(r)return r}if(this.check([77,77])){let r=await this.readTiffHeader(!0);if(r)return r}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function r(){let o=await t.peekNumber(cE),l=128,u=0;for(;(o&l)===0&&l!==0;)++u,l>>=1;let c=new Uint8Array(u+1);return await ah(t,c,void 0,{maximumLength:c.length,reason:"EBML field"}),c}async function n(){let o=await r(),l=await r();l[0]^=128>>l.length-1;let u=Math.min(6,l.length),c=new DataView(o.buffer),p=new DataView(l.buffer,l.length-u,u);return{id:v3(c),len:v3(p)}}async function i(o){let l=0;for(;o>0;){if(l++,l>N3||Wo(t,s,tn))return;let u=t.position,c=await n();if(c.id===17026){if(c.len>uh)return;let p=R0(c.len,uh,"EBML DocType");return(await t.readToken(new oi(p))).replaceAll(/\00.*$/g,"")}if(Lr(t)&&(!Number.isFinite(c.len)||c.len<0||c.len>ch)||(await Ki(t,c.len,{maximumLength:Lr(t)?ch:t.fileInfo.size,reason:"EBML payload"}),--o,t.position<=u))return}}let a=await n(),s=t.position;switch(await i(a.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){let r=w1.get(this.buffer,4),n=_a.get(this.buffer,6);if(r>0&&r<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(n>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("=1e3&&r<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!"))return await t.ignore(8),await t.readToken(new oi(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[` `,"\r"," "," ","\0"].some(r=>this.checkString(r,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){let r={ext:"png",mime:"image/png"},n={ext:"apng",mime:"image/apng"};await t.ignore(8);async function i(){return{length:await t.readToken(pE),type:await t.readToken(new oi(4,"latin1"))}}let a=Lr(t),s=t.position,o=0,l=!1;do{if(o++,o>T3||Wo(t,s,_3))break;let u=t.position,c=await i();if(c.length<0)return;if(c.type==="IHDR"){if(c.length!==13)return;l=!0}switch(c.type){case"IDAT":return r;case"acTL":return n;default:if(!l&&c.type!=="CgBI")return;if(a&&c.length>fh)return l&&GM(c.type)?r:void 0;try{await Ki(t,c.length+4,{maximumLength:a?fh+4:t.fileInfo.size,reason:"PNG chunk payload"})}catch(p){if(!a&&(p instanceof Yi||p instanceof rr))return r;throw p}}if(t.position<=u)break}while(t.position+8O3||Wo(t,a,tn)));){let o=t.position,l=await n(),u=l.size-24;if(!Number.isFinite(u)||u<0){r=!0;break}if(ri(l.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let c=new Uint8Array(16);if(u-=await ah(t,c,void 0,{maximumLength:c.length,reason:"ASF stream type GUID"}),ri(c,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(ri(c,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(i&&u>dh){r=!0;break}if(await Ki(t,u,{maximumLength:i?dh:t.fileInfo.size,reason:"ASF header payload"}),t.position<=o){r=!0;break}}}catch(n){if(n instanceof rr||n instanceof Yi)Lr(t)&&(r=!0);else throw n}return r?void 0:{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await t.ignore(20),await t.readToken(new oi(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("=16){let r=new DataView(this.buffer.buffer).getUint32(12,!0);if(r>12&&this.buffer.length>=r+16)try{let n=new TextDecoder().decode(this.buffer.subarray(16,r+16));if(JSON.parse(n).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await t.peekBuffer(this.buffer,{length:Math.min(512,t.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&UM(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let r="utf-16le";return this.checkString("{this.buffer=new Uint8Array(Rs);let r=rP(t.fileInfo.size);if(await t.peekBuffer(this.buffer,{length:Math.min(8,r),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await t.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,r),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let n=0;n<=this.options.mpegOffsetTolerance;++n){let i=this.scanMpeg(n);if(i)return i}};async readTiffTag(t){let r=await this.tokenizer.readToken(t?_a:Vt);switch(await this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(t){let r=await this.tokenizer.readToken(t?_a:Vt);if(!(r>I3)&&!(Lr(this.tokenizer)&&2+r*12>hh))for(let n=0;n=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(i>=8){let o=(t?_a:Vt).get(this.buffer,8),l=(t?_a:Vt).get(this.buffer,10);if(o===28&&l===254||o===31&&l===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(Lr(this.tokenizer)&&i>$3)return r;let a=Lr(this.tokenizer)?hh:this.tokenizer.fileInfo.size;try{await Ki(this.tokenizer,i,{maximumLength:a,reason:"TIFF IFD offset"})}catch(o){if(o instanceof rr)return;throw o}let s;try{s=await this.readTiffIFD(t)}catch(o){if(o instanceof rr)return;throw o}return s??r}if(n===43)return r}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},lP=new Set(NE),uP=new Set(TE)}),PE={};ce(PE,{fileCommand:()=>zE,flagsForFuzzing:()=>qE});function D3(e,t){let r=BE.get(e);if(r)return r;let[n,i]=t.split("/"),a=i?.split("+")[0]?.replace(/-/g," ")||e;switch(n){case"image":return`${a.toUpperCase()} image data`;case"audio":return`${a.toUpperCase()} audio`;case"video":return`${a.toUpperCase()} video`;case"font":return`${a} font`;case"model":return`${a} 3D model`;case"application":return i?.includes("zip")||i?.includes("compressed")?`${a} archive data`:i?.includes("executable")?`${a} executable`:`${e.toUpperCase()} data`;default:return`${e.toUpperCase()} data`}}function pP(e){let t=e.split("/").pop()||e;if(t.startsWith(".")&&!t.includes(".",1))return t;let r=t.lastIndexOf(".");return r===-1||r===0?"":t.slice(r).toLowerCase()}function fP(e,t){if(e.startsWith("#!")){let u=e.split(` `)[0];return u.includes("python")?{description:"Python script, ASCII text executable",mime:"text/x-python"}:u.includes("node")||u.includes("bun")||u.includes("deno")?{description:"JavaScript script, ASCII text executable",mime:"text/javascript"}:u.includes("bash")?{description:"Bourne-Again shell script, ASCII text executable",mime:"text/x-shellscript"}:u.includes("sh")?{description:"POSIX shell script, ASCII text executable",mime:"text/x-shellscript"}:u.includes("ruby")?{description:"Ruby script, ASCII text executable",mime:"text/x-ruby"}:u.includes("perl")?{description:"Perl script, ASCII text executable",mime:"text/x-perl"}:{description:"script, ASCII text executable",mime:"text/plain"}}let r=e.trimStart();if(r.startsWith("127){l=!0;break}return l?{description:`UTF-8 Unicode text${a}`,mime:"text/plain; charset=utf-8"}:{description:`ASCII text${a}`,mime:"text/plain"}}function dP(e){return UE.every((t,r)=>e[r]===t)}async function hP(e,t){if(t.length===0)return{description:"empty",mime:"inode/x-empty"};if(dP(t))return{description:D3("gz","application/gzip"),mime:"application/gzip"};let r=await YM(t);if(r)return{description:D3(r.ext,r.mime),mime:r.mime};let n=new TextDecoder("utf-8",{fatal:!1}).decode(t);return fP(n,e)}var R3,FE,BE,UE,zE,qE,mP=q(()=>{"use strict";cP(),Yt(),Ar(),be(),R3={name:"file",summary:"determine file type",usage:"file [OPTION]... FILE...",options:["-b, --brief do not prepend filenames to output","-i, --mime output MIME type strings","-L, --dereference follow symlinks"," --help display this help and exit"]},FE=new Map([[".js",{description:"JavaScript source",mime:"text/javascript"}],[".mjs",{description:"JavaScript module",mime:"text/javascript"}],[".cjs",{description:"CommonJS module",mime:"text/javascript"}],[".ts",{description:"TypeScript source",mime:"text/typescript"}],[".tsx",{description:"TypeScript JSX source",mime:"text/typescript"}],[".jsx",{description:"JavaScript JSX source",mime:"text/javascript"}],[".py",{description:"Python script",mime:"text/x-python"}],[".rb",{description:"Ruby script",mime:"text/x-ruby"}],[".go",{description:"Go source",mime:"text/x-go"}],[".rs",{description:"Rust source",mime:"text/x-rust"}],[".c",{description:"C source",mime:"text/x-c"}],[".h",{description:"C header",mime:"text/x-c"}],[".cpp",{description:"C++ source",mime:"text/x-c++"}],[".hpp",{description:"C++ header",mime:"text/x-c++"}],[".java",{description:"Java source",mime:"text/x-java"}],[".sh",{description:"Bourne-Again shell script",mime:"text/x-shellscript"}],[".bash",{description:"Bourne-Again shell script",mime:"text/x-shellscript"}],[".zsh",{description:"Zsh shell script",mime:"text/x-shellscript"}],[".json",{description:"JSON data",mime:"application/json"}],[".yaml",{description:"YAML data",mime:"text/yaml"}],[".yml",{description:"YAML data",mime:"text/yaml"}],[".xml",{description:"XML document",mime:"application/xml"}],[".csv",{description:"CSV text",mime:"text/csv"}],[".toml",{description:"TOML data",mime:"text/toml"}],[".html",{description:"HTML document",mime:"text/html"}],[".htm",{description:"HTML document",mime:"text/html"}],[".css",{description:"CSS stylesheet",mime:"text/css"}],[".svg",{description:"SVG image",mime:"image/svg+xml"}],[".md",{description:"Markdown document",mime:"text/markdown"}],[".markdown",{description:"Markdown document",mime:"text/markdown"}],[".txt",{description:"ASCII text",mime:"text/plain"}],[".rst",{description:"reStructuredText",mime:"text/x-rst"}],[".env",{description:"ASCII text",mime:"text/plain"}],[".gitignore",{description:"ASCII text",mime:"text/plain"}],[".dockerignore",{description:"ASCII text",mime:"text/plain"}]]),BE=new Map([["jpg","JPEG image data"],["jpeg","JPEG image data"],["png","PNG image data"],["gif","GIF image data"],["webp","WebP image data"],["bmp","PC bitmap"],["ico","MS Windows icon resource"],["tif","TIFF image data"],["tiff","TIFF image data"],["psd","Adobe Photoshop Document"],["avif","AVIF image"],["heic","HEIC image"],["heif","HEIF image"],["jxl","JPEG XL image"],["icns","Mac OS X icon"],["svg","SVG Scalable Vector Graphics image"],["pdf","PDF document"],["epub","EPUB document"],["mobi","Mobipocket E-book"],["djvu","DjVu document"],["zip","Zip archive data"],["gz","gzip compressed data"],["gzip","gzip compressed data"],["bz2","bzip2 compressed data"],["xz","XZ compressed data"],["tar","POSIX tar archive"],["rar","RAR archive data"],["7z","7-zip archive data"],["lz","lzip compressed data"],["lzma","LZMA compressed data"],["zst","Zstandard compressed data"],["cab","Microsoft Cabinet archive"],["ar","Unix ar archive"],["rpm","RPM package"],["deb","Debian binary package"],["apk","Android Package"],["dmg","Apple disk image"],["iso","ISO 9660 CD-ROM filesystem data"],["vhd","Microsoft Virtual Hard Disk"],["vhdx","Microsoft Virtual Hard Disk (new format)"],["qcow2","QEMU QCOW Image"],["mp3","Audio file with ID3"],["m4a","MPEG-4 audio"],["aac","AAC audio"],["wav","RIFF (little-endian) data, WAVE audio"],["flac","FLAC audio bitstream data"],["ogg","Ogg data"],["oga","Ogg audio"],["opus","Ogg Opus audio"],["aiff","AIFF audio"],["wma","Windows Media Audio"],["amr","AMR audio"],["mid","MIDI audio"],["midi","MIDI audio"],["ape","Monkey's Audio"],["mp4","ISO Media, MPEG-4"],["m4v","MPEG-4 video"],["webm","WebM"],["avi","RIFF (little-endian) data, AVI"],["mov","ISO Media, Apple QuickTime movie"],["mkv","Matroska data"],["wmv","Windows Media Video"],["flv","Flash Video"],["3gp","3GPP multimedia"],["3g2","3GPP2 multimedia"],["ogv","Ogg video"],["mts","MPEG transport stream"],["m2ts","MPEG transport stream"],["ts","MPEG transport stream"],["mpg","MPEG video"],["mpeg","MPEG video"],["exe","PE32 executable"],["dll","PE32 DLL"],["elf","ELF executable"],["mach","Mach-O executable"],["wasm","WebAssembly (wasm) binary module"],["dex","Android Dalvik executable"],["class","Java class file"],["swf","Adobe Flash"],["doc","Microsoft Word Document"],["docx","Microsoft Word 2007+ Document"],["xls","Microsoft Excel Spreadsheet"],["xlsx","Microsoft Excel 2007+ Spreadsheet"],["ppt","Microsoft PowerPoint Presentation"],["pptx","Microsoft PowerPoint 2007+ Presentation"],["odt","OpenDocument Text"],["ods","OpenDocument Spreadsheet"],["odp","OpenDocument Presentation"],["ttf","TrueType Font"],["otf","OpenType Font"],["woff","Web Open Font Format"],["woff2","Web Open Font Format 2"],["eot","Embedded OpenType font"],["stl","Stereolithography CAD"],["obj","Wavefront 3D Object"],["gltf","GL Transmission Format"],["glb","GL Transmission Format (binary)"],["sqlite","SQLite 3.x database"],["mdb","Microsoft Access Database"],["xml","XML document"],["json","JSON data"],["macho","Mach-O binary"],["ics","iCalendar data"],["vcf","vCard data"],["msi","Microsoft Installer"],["ps","PostScript"],["ai","Adobe Illustrator"],["indd","Adobe InDesign"],["sketch","Sketch design file"],["fig","Figma design file"],["xd","Adobe XD"],["blend","Blender"],["fbx","Autodesk FBX"],["lnk","MS Windows shortcut"],["alias","Mac OS alias"],["torrent","BitTorrent file"],["pcap","pcap capture file"],["arrow","Apache Arrow"],["parquet","Apache Parquet"]]),UE=[31,139,8],zE={name:"file",async execute(e,t){if(Ce(e))return we(R3);let r=!1,n=!1,i=!1,a=[];for(let l of e)if(l.startsWith("--"))if(l==="--brief")r=!0;else if(l==="--mime"||l==="--mime-type")n=!0;else if(l==="--dereference")i=!0;else return Le("file",l);else if(l.startsWith("-")&&l!=="-")for(let u of l.slice(1))if(u==="b")r=!0;else if(u==="i")n=!0;else if(u==="L")i=!0;else return Le("file",`-${u}`);else a.push(l);if(a.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE... `,exitCode:1};let s=new St(Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),"file"),o=0;for(let l of a){t.executionScope?.consumeLimited("file-operands",1,t.limits.maxArrayElements,"file");try{let u=t.fs.resolvePath(t.cwd,l),c=i?await t.fs.stat(u):await t.fs.lstat(u);if(c.isSymbolicLink){let h=await t.fs.readlink(u),m=n?"inode/symlink":`symbolic link to ${h}`;s.append(r?`${m} `:`${l}: ${m} `);continue}if(c.isDirectory){let h=n?"inode/directory":"directory";s.append(r?`${h} `:`${l}: ${h} `);continue}let p=await t.fs.readFileBuffer(u);t.executionScope?.consumeInput(p.byteLength,"file");let d=await hP(l,p),f=n?d.mime:d.description;s.append(r?`${f} `:`${l}: ${f} `)}catch(u){Ge(u),s.append(r?`cannot open `:`${l}: cannot open (No such file or directory) `),o=1}}return{stdout:s.build(),stderr:"",exitCode:o}}},qE={name:"file",flags:[{flag:"-b",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-L",type:"boolean"}],needsArgs:!0}}),HE={};ce(HE,{flagsForFuzzing:()=>GE,htmlToMarkdownCommand:()=>jE});var L3,jE,GE,gP=q(()=>{"use strict";ge(),Ar(),J(),be(),L3={name:"html-to-markdown",summary:"convert HTML to Markdown (BashEnv extension)",usage:"html-to-markdown [OPTION]... [FILE]",description:["Convert HTML content to Markdown format using the turndown library.","This is a non-standard BashEnv extension command, not available in regular bash.","","Read HTML from FILE or standard input and output Markdown to standard output.","Commonly used with curl to convert web pages:"," curl -s https://example.com | html-to-markdown","","Supported HTML elements:"," - Headings (h1-h6) \u2192 # Markdown headings"," - Paragraphs (p) \u2192 Plain text with blank lines"," - Links (a) \u2192 [text](url)"," - Images (img) \u2192 ![alt](src)"," - Bold/Strong \u2192 **text**"," - Italic/Em \u2192 _text_"," - Code (code, pre) \u2192 `inline` or fenced blocks"," - Lists (ul, ol, li) \u2192 - or 1. items"," - Blockquotes \u2192 > quoted text"," - Horizontal rules (hr) \u2192 ---"],options:["-b, --bullet=CHAR bullet character for unordered lists (-, +, or *)","-c, --code=FENCE fence style for code blocks (``` or ~~~)","-r, --hr=STRING string for horizontal rules (default: ---)"," --heading-style=STYLE"," heading style: 'atx' for # headings (default),"," 'setext' for underlined headings (h1/h2 only)"," --help display this help and exit"],examples:["echo '

Hello

World

' | html-to-markdown","html-to-markdown page.html","curl -s https://example.com | html-to-markdown > page.md"]},jE={name:"html-to-markdown",async execute(e,t){if(Ce(e))return we(L3);let r="-",n="```",i="---",a="atx",s=[];for(let x=0;xl)throw new T(`html-to-markdown: input size limit exceeded (${l} bytes)`,"string_length");o=Ve(t.stdin)}else try{let x=t.fs.resolvePath(t.cwd,s[0]);if((await t.fs.stat(x)).size>l)throw new T(`html-to-markdown: input size limit exceeded (${l} bytes)`,"string_length");if(o=await t.fs.readFile(x),K(o)>l)throw new T(`html-to-markdown: input size limit exceeded (${l} bytes)`,"string_length")}catch(x){return Ge(x),{stdout:"",stderr:`html-to-markdown: ${s[0]}: No such file or directory `,exitCode:1}}if(!o.trim())return{stdout:"",stderr:"",exitCode:0};if(!["-","+","*"].includes(r))return{stdout:"",stderr:`html-to-markdown: invalid bullet marker `,exitCode:1};if(n!=="```"&&n!=="~~~")return{stdout:"",stderr:`html-to-markdown: invalid code fence `,exitCode:1};let u=0,c=t.limits.maxLoopIterations;for(let x=0;xc)throw new T(`html-to-markdown: complexity limit exceeded (${c} tags)`,"iterations");t.executionScope?.consumeWork(u,"html-to-markdown tags");let p=K(o),d=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),f=4;if(p>Math.floor((d-1)/f))throw new T(`html-to-markdown: prospective output size limit exceeded (${d} bytes)`,"output_size");let h=p*f+1,m=t.executionScope?.reserveBytes("html input",p,"html-to-markdown"),g=t.executionScope?.reserveBytes("html prospective output",h,"html-to-markdown");try{let x=new WE.default({bulletListMarker:r,codeBlockStyle:"fenced",fence:n,hr:i,headingStyle:a});x.remove(["script","style","footer"]);let y=x.turndown(o).trim();if(K(y)+1>d)throw new T(`html-to-markdown: output size limit exceeded (${d} bytes)`,"output_size");return{stdout:`${y} `,stderr:"",exitCode:0}}catch(x){return Ge(x),{stdout:"",stderr:`html-to-markdown: conversion error: ${x.message} `,exitCode:1}}finally{g?.release(),m?.release()}}},GE={name:"html-to-markdown",flags:[],stdinType:"text"}}),VE={};ce(VE,{flagsForFuzzing:()=>QE,helpCommand:()=>XE});function xP(e){let t=[],r=new Set(e);t.push(`Available commands: `);let n=[];for(let[i,a]of ZE){let s=a.filter(o=>r.has(o));if(s.length>0){t.push(` ${i}:`),t.push(` ${s.join(", ")} `);for(let o of s)r.delete(o)}}for(let i of r)n.push(i);return n.length>0&&(t.push(" Other:"),t.push(` ${n.sort().join(", ")} `)),t.push("Use ' --help' for details on a specific command."),`${t.join(` `)} `}var ZE,XE,QE,yP=q(()=>{"use strict";Qs(),ZE=new Map([["File operations",["ls","cat","head","tail","wc","touch","mkdir","mktemp","rm","cp","mv","ln","chmod","stat","readlink"]],["Text processing",["grep","sed","awk","sort","uniq","cut","tr","tee","diff"]],["Search",["find"]],["Navigation & paths",["pwd","basename","dirname","tree","du"]],["Environment & shell",["echo","printf","env","printenv","export","alias","unalias","history","clear","true","false","yes","bash","sh"]],["Data processing",["xargs","jq","base64","date"]],["Network",["curl","html-to-markdown"]]]),XE={name:"help",async execute(e,t){if(e.includes("--help")||e.includes("-h"))return{stdout:`help - display available commands Usage: help [command] Options: -h, --help Show this help message If a command name is provided, shows help for that command. Otherwise, lists all available commands. `,stderr:"",exitCode:0};if(e.length>0&&t.exec){let n=e[0];return t.exec(Ga([n]),{cwd:t.cwd,signal:t.signal,args:["--help"]})}let r=t.getRegisteredCommands?.()??[];return{stdout:xP(r),stderr:"",exitCode:0}}},QE={name:"help",flags:[]}}),KE={};ce(KE,{flagsForFuzzing:()=>JE,whichCommand:()=>YE});var M3,P3,YE,JE,bP=q(()=>{"use strict";sr(),be(),M3={name:"which",summary:"locate a command",usage:"which [-as] program ...",options:["-a List all instances of executables found","-s No output, just return 0 if found, 1 if not","--help display this help and exit"]},P3={showAll:{short:"a",type:"boolean"},silent:{short:"s",type:"boolean"}},YE={name:"which",async execute(e,t){if(Ce(e))return we(M3);let r=ar("which",e,P3);if(!r.ok)return r.error;let n=r.result.flags.showAll,i=r.result.flags.silent,a=r.result.positional;if(a.length===0)return{stdout:"",stderr:"",exitCode:1};let s=(t.env.get("PATH")||"/usr/bin:/bin").split(":"),o="",l=!0;for(let u of a){let c=!1;for(let p of s){if(!p)continue;let d=t.fs.resolvePath(p,u);if(await t.fs.exists(d)&&(c=!0,i||(o+=`${d} `),!n))break}c||(l=!1)}return{stdout:o,stderr:"",exitCode:l?0:1}}},JE={name:"which",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"boolean"}],needsArgs:!0}}),eS={};ce(eS,{flagsForFuzzing:()=>rS,tac:()=>tS});async function wP(e,t){if(e.length>0&&e[0]!=="-"){let i=t.fs.resolvePath(t.cwd,e[0]);try{let a=(await t.fs.readFile(i)).split(` `);a[a.length-1]===""&&a.pop();let s=a.reverse();return{stdout:s.length>0?`${s.join(` `)} `:"",stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`tac: ${e[0]}: No such file or directory `,exitCode:1}}}let r=t.stdin.split(` `);r[r.length-1]===""&&r.pop();let n=r.reverse();return{stdout:n.length>0?`${n.join(` `)} `:"",stderr:"",exitCode:0,stdoutKind:"bytes"}}var tS,rS,vP=q(()=>{"use strict";ge(),tS={name:"tac",execute:wP},rS={name:"tac",flags:[],stdinType:"text",needsFiles:!0}}),nS={};ce(nS,{flagsForFuzzing:()=>aS,hostname:()=>iS});async function EP(e,t){return{stdout:`localhost `,stderr:"",exitCode:0}}var iS,aS,SP=q(()=>{"use strict";iS={name:"hostname",execute:EP},aS={name:"hostname",flags:[]}}),sS={};ce(sS,{flagsForFuzzing:()=>lS,whoami:()=>oS});async function AP(e,t){return{stdout:`user `,stderr:"",exitCode:0}}var oS,lS,CP=q(()=>{"use strict";oS={name:"whoami",execute:AP},lS={name:"whoami",flags:[]}}),uS={};ce(uS,{flagsForFuzzing:()=>pS,od:()=>cS});async function kP(e,t){let r="octal",n=[],i=[];for(let m=0;m=32&&m<127?` ${String.fromCharCode(m)}`:` ${m.toString(8).padStart(3,"0")}`}function u(m){return o?` ${m.toString(16).padStart(2,"0")}`:` ${m.toString(16).padStart(2,"0")}`}function c(m){return` ${m.toString(8).padStart(3,"0")}`}let p=a.build(),d=16,f=new St(Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),"od"),h=n.length;if(h>0&&p.length>Math.floor(t.limits.maxLoopIterations/h))throw new T(`od: format work limit exceeded (${t.limits.maxLoopIterations})`,"iterations");t.executionScope?.consumeWork(p.length*h,"od formatting");for(let m=0;ml(k.charCodeAt(0))):x==="hex"?y=Array.from(p.slice(m,m+d),k=>u(k.charCodeAt(0))):y=Array.from(p.slice(m,m+d),k=>c(k.charCodeAt(0)));let b="";g===0&&r!=="none"?b=`${m.toString(8).padStart(7,"0")} `:(g>0||r==="none")&&(b=r==="none"?"":" "),f.append(b+y.join("")).append(` `)}return r!=="none"&&p.length>0&&f.append(p.length.toString(8).padStart(7,"0")).append(` `),{stdout:f.build(),stderr:"",exitCode:0}}var cS,pS,NP=q(()=>{"use strict";Yt(),ge(),Ar(),J(),cS={name:"od",execute:kP},pS={name:"od",flags:[{flag:"-c",type:"boolean"},{flag:"-A",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-N",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0}}),L0,TP=q(()=>{"use strict";L0=class{options;inputBytes=0;outputBytes=0;workBytes=0;label;constructor(e){this.options=e,this.label=e.label??"codec";for(let[t,r]of[["maxInputBytes",e.maxInputBytes],["maxOutputBytes",e.maxOutputBytes],["maxExpansionRatio",e.maxExpansionRatio],["ratioGraceBytes",e.ratioGraceBytes],["maxWorkBytes",e.maxWorkBytes]])if(r!==void 0&&(!Number.isSafeInteger(r)||r<0))throw new Error(`${this.label}: invalid ${t}`)}checkpoint(){if(this.options.signal?.aborted)throw new Error(`${this.label}: operation aborted`)}acceptInput(e){this.checkpoint(),this.inputBytes=this.addWithinLimit(this.inputBytes,e,this.options.maxInputBytes,"input"),this.chargeWork(e)}acceptOutput(e){this.checkpoint();let t=this.addWithinLimit(this.outputBytes,e,this.options.maxOutputBytes,"output"),r=this.options.ratioGraceBytes??1024*1024,n=this.options.maxExpansionRatio;if(n!==void 0&&t>r&&(this.inputBytes===0||t>this.inputBytes*n))throw new Error(`${this.label}: expansion ratio exceeds limit (${n}:1)`);this.outputBytes=t,this.chargeWork(e)}get inputLength(){return this.inputBytes}get outputLength(){return this.outputBytes}chargeWork(e){let t=this.options.maxWorkBytes??this.options.maxInputBytes+this.options.maxOutputBytes;this.workBytes=this.addWithinLimit(this.workBytes,e,t,"work")}addWithinLimit(e,t,r,n){if(!Number.isSafeInteger(t)||t<0||t>r-e)throw new Error(`${this.label}: ${n} exceeds limit (${r} bytes)`);return e+t}}}),lc={};ce(lc,{flagsForFuzzing:()=>CS,gunzipCommand:()=>SS,gunzipFlagsForFuzzing:()=>kS,gzipCommand:()=>ES,zcatCommand:()=>AS,zcatFlagsForFuzzing:()=>NS});function F3(e){return e.best?mh.Z_BEST_COMPRESSION:e.level8?8:e.level7?7:e.level6?6:e.level5?5:e.level4?4:e.level3?3:e.level2?2:e.fast?mh.Z_BEST_SPEED:mh.Z_DEFAULT_COMPRESSION}function fS(e){if(e.length<10)return{originalName:null,mtime:null,headerSize:0};if(e[0]!==31||e[1]!==139)return{originalName:null,mtime:null,headerSize:0};let t=e[3],r=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n=10;if(t&4){if(n+2>e.length)return{originalName:null,mtime:null,headerSize:0};let a=e[n]|e[n+1]<<8;n+=2+a}let i=null;if(t&8){let a=n;for(;n0?new Date(r*1e3):null,headerSize:n}}function IP(e){return e.length===0||e==="."||e===".."||e.includes("/")||e.includes("\\")||/[\0-\x1f\x7f]/.test(e)?null:e}function dS(e){if(e.length<4)return 0;let t=e.length;return e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24}function Ic(e){return e.length>=2&&e[0]===31&&e[1]===139}function zu(e){return Buffer.from(e).toString("latin1")}function hS(e){return e.limits.maxOutputSize}function A1(e,t,r,n,i){if(t<=0)throw new Error("decompressed data exceeds limit (0 bytes)");let a=new L0({maxInputBytes:r,maxOutputBytes:t,maxExpansionRatio:1e4,signal:n,label:"gzip"});if(a.acceptInput(e.length),dS(e)>t)throw new Error(`decompressed data exceeds limit (${t} bytes)`);let s;try{let o=Math.min(t,Math.floor((i?.executionScope?.remainingLiveBytes??t*2)/2));if(o<=0)throw new Error("gzip: live byte limit exceeded");s=i?.executionScope?.reserveBytes("gzip output",o*2,"gzip");let l=_P(e,{maxOutputLength:o});return a.acceptOutput(l.length),{data:l,lease:s}}catch(o){throw s?.release(),o}}function B3(e,t,r){let n=new L0({maxInputBytes:r.limits.maxInputBytes,maxOutputBytes:r.limits.maxOutputSize,signal:r.signal,label:"gzip"});n.acceptInput(e.length);let i;try{let a=Math.min(r.limits.maxOutputSize,Math.floor((r.executionScope?.remainingLiveBytes??r.limits.maxOutputSize*2)/2));if(a<=0)throw new Error("gzip: live byte limit exceeded");i=r.executionScope?.reserveBytes("gzip output",a*2,"gzip");let s=OP(e,{level:t,maxOutputLength:a});return n.acceptOutput(s.length),{data:s,lease:i}}catch(a){throw i?.release(),a}}async function mS(e,t,r){let n=await e.fs.stat(t);if(n.size>e.limits.maxInputBytes)throw new T(`input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");let i=e.executionScope?.reserveBytes("gzip input",n.size,r);try{let a=await e.fs.readFileBuffer(t);if(a.byteLength>n.size)throw new T("gzip: input grew while being read","string_length");return e.executionScope?.consumeInput(a.byteLength,r),{data:a,lease:i}}catch(a){throw i?.release(),a}}async function gS(e,t,r){if(t!=="-"&&t!=="")return mS(e,e.fs.resolvePath(e.cwd,t),r);let n=e.stdin,i=e.executionScope?.reserveBytes("gzip input",n.length,r);try{return{data:Uint8Array.from(n,a=>a.charCodeAt(0)),lease:i}}catch(a){throw i?.release(),a}}async function xS(e,t,r,n,i,a){let s=r.suffix,o,l,u,c=hS(e);if(t==="-"||t===""){let f=e.stdin,h=e.executionScope?.reserveBytes("gzip input",f.length,n),m;try{if(u=Uint8Array.from(f,g=>g.charCodeAt(0)),i){if(!Ic(u))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${n}: stdin: not in gzip format `,exitCode:1};try{let g=A1(u,c,e.limits.maxInputBytes,e.signal,e);return m=g.lease,{stdout:zu(g.data),stderr:"",exitCode:0}}catch(g){Ge(g);let x=g instanceof Error?g.message:"unknown error";return{stdout:"",stderr:`${n}: stdin: ${x} `,exitCode:1}}}else{let g=B3(u,F3(r),e);return m=g.lease,{stdout:zu(g.data),stderr:"",exitCode:0}}}finally{m?.release(),h?.release()}}o=e.fs.resolvePath(e.cwd,t);try{let f=await e.fs.stat(o);if(f.size>e.limits.maxInputBytes)return{stdout:"",stderr:`${n}: ${t}: input size limit exceeded (${e.limits.maxInputBytes} bytes) `,exitCode:1};if(f.isDirectory)return r.recursive?await $P(e,o,r,n,i,a):r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${n}: ${t}: is a directory -- ignored `,exitCode:1}}catch{return{stdout:"",stderr:`${n}: ${t}: No such file or directory `,exitCode:1}}let p,d;try{let f=await mS(e,o,n);u=f.data,p=f.lease}catch(f){return Ge(f),{stdout:"",stderr:`${n}: ${t}: No such file or directory `,exitCode:1}}try{if(i){if(!t.endsWith(s))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${n}: ${t}: unknown suffix -- ignored `,exitCode:1};if(!Ic(u))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${n}: ${t}: not in gzip format `,exitCode:1};let f;try{let h=A1(u,c,e.limits.maxInputBytes,e.signal,e);f=h.data,d=h.lease}catch(h){Ge(h);let m=h instanceof Error?h.message:"unknown error";return{stdout:"",stderr:`${n}: ${t}: ${m} `,exitCode:1}}if(a)return{stdout:zu(f),stderr:"",exitCode:0};if(r.name){let h=fS(u),m=h.originalName?IP(h.originalName):null;m?l=e.fs.resolvePath(e.cwd,m):l=o.slice(0,-s.length)}else l=o.slice(0,-s.length);if(!r.force)try{return await e.fs.stat(l),{stdout:"",stderr:`${n}: ${l} already exists; not overwritten `,exitCode:1}}catch{}if(await e.fs.writeFile(l,f),!r.keep&&!a&&await e.fs.rm(o),r.verbose){let h=u.length>0?((1-u.length/f.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${h}% -- replaced with ${l.split("/").pop()} `,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}else{if(t.endsWith(s))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${n}: ${t} already has ${s} suffix -- unchanged `,exitCode:1};let f=F3(r),h;try{let m=B3(u,f,e);h=m.data,d=m.lease}catch(m){Ge(m);let g=m instanceof Error?m.message:"unknown error";return{stdout:"",stderr:`${n}: ${t}: ${g} `,exitCode:1}}if(a)return{stdout:zu(h),stderr:"",exitCode:0};if(l=o+s,!r.force)try{return await e.fs.stat(l),{stdout:"",stderr:`${n}: ${l} already exists; not overwritten `,exitCode:1}}catch{}if(await e.fs.writeFile(l,h),!r.keep&&!a&&await e.fs.rm(o),r.verbose){let m=u.length>0?((1-h.length/u.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${m}% -- replaced with ${l.split("/").pop()} `,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}}finally{d?.release(),p?.release()}}async function $P(e,t,r,n,i,a){let s=Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),o=new St(s,n),l=new St(s,n),u=0;return await El({fs:e.fs,root:t,symlinks:"never",limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:n},async c=>{if(c.depth===0||c.phase!=="enter"||!c.stat.isFile)return;let p=r.suffix;if(i&&!c.path.endsWith(p)||!i&&c.path.endsWith(p))return;let d=c.path.startsWith(`${e.cwd}/`)?c.path.slice(e.cwd.length+1):c.path,f=await xS(e,d,r,n,i,a);o.append(f.stdout),l.append(f.stderr),f.exitCode!==0&&(u=f.exitCode)}),{stdout:o.build(),stderr:l.build(),exitCode:u}}async function DP(e,t,r,n){let i,a;try{let s=await gS(e,t,n);i=s.data,a=s.lease}catch(s){return Ge(s),{stdout:"",stderr:`${n}: ${t}: No such file or directory `,exitCode:1}}try{if(!Ic(i))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${n}: ${t}: not in gzip format `,exitCode:1};let s=i.length,o=dS(i),l=o>0?((1-s/o)*100).toFixed(1):"0.0",u=fS(i).originalName||(t==="-"?"":t.replace(/\.gz$/,""));return{stdout:`${s.toString().padStart(10)} ${o.toString().padStart(10)} ${l.padStart(5)}% ${u} `,stderr:"",exitCode:0}}finally{a?.release()}}async function RP(e,t,r,n){let i,a;try{let s=await gS(e,t,n);i=s.data,a=s.lease}catch(s){return Ge(s),{stdout:"",stderr:`${n}: ${t}: No such file or directory `,exitCode:1}}try{if(!Ic(i))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${n}: ${t}: not in gzip format `,exitCode:1};try{return A1(i,hS(e),e.limits.maxInputBytes,e.signal,e).lease?.release(),r.verbose?{stdout:"",stderr:`${t}: OK `,exitCode:0}:{stdout:"",stderr:"",exitCode:0}}catch(s){Ge(s);let o=s instanceof Error?s.message:"invalid";return{stdout:"",stderr:`${n}: ${t}: ${o} `,exitCode:1}}}finally{a?.release()}}async function gh(e,t,r){let n=r==="zcat"?wS:r==="gunzip"?bS:yS;if(Ce(e))return we(n);let i=ar(r,e,vS);if(!i.ok)return i.error.stderr.includes("unrecognized option"),i.error;let a=i.result.flags,s=i.result.positional,o=r==="gunzip"||r==="zcat"||a.decompress||a.uncompress,l=r==="zcat"||a.stdout||a.toStdout;if(a.list){s.length===0&&(s=["-"]);let d=` compressed uncompressed ratio uncompressed_name `,f="",h=0;for(let m of s){let g=await DP(t,m,a,r);d+=g.stdout,f+=g.stderr,g.exitCode!==0&&(h=g.exitCode)}return{stdout:d,stderr:f,exitCode:h}}if(a.test){s.length===0&&(s=["-"]);let d="",f="",h=0;for(let m of s){let g=await RP(t,m,a,r);d+=g.stdout,f+=g.stderr,g.exitCode!==0&&(h=g.exitCode)}return{stdout:d,stderr:f,exitCode:h}}s.length===0&&(s=["-"]);let u="",c="",p=0;for(let d of s){let f=await xS(t,d,a,r,o,l);u+=f.stdout,c+=f.stderr,f.exitCode!==0&&(p=f.exitCode)}return{stdout:u,stderr:c,exitCode:p}}var yS,bS,wS,vS,ES,SS,AS,CS,kS,NS,xh=q(()=>{"use strict";Yt(),ge(),Ar(),jn(),J(),sr(),TP(),be(),yS={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place). When no FILE is given, or when FILE is -, read from standard input. With -d, decompress instead.`,options:["-c, --stdout write to standard output, keep original files","-d, --decompress decompress","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not save or restore the original name and timestamp","-N, --name save or restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode","-1, --fast compress faster","-9, --best compress better"," --help display this help and exit"]},bS={name:"gunzip",summary:"decompress files",usage:"gunzip [OPTION]... [FILE]...",description:`Decompress FILEs (by default, in-place). When no FILE is given, or when FILE is -, read from standard input.`,options:["-c, --stdout write to standard output, keep original files","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not restore the original name and timestamp","-N, --name restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},wS={name:"zcat",summary:"decompress files to stdout",usage:"zcat [OPTION]... [FILE]...",description:`Decompress FILEs to standard output. When no FILE is given, or when FILE is -, read from standard input.`,options:["-f, --force force; read compressed data even from a terminal","-l, --list list compressed file contents","-q, --quiet suppress all warnings","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},vS={stdout:{short:"c",long:"stdout",type:"boolean"},toStdout:{long:"to-stdout",type:"boolean"},decompress:{short:"d",long:"decompress",type:"boolean"},uncompress:{long:"uncompress",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},keep:{short:"k",long:"keep",type:"boolean"},list:{short:"l",long:"list",type:"boolean"},noName:{short:"n",long:"no-name",type:"boolean"},name:{short:"N",long:"name",type:"boolean"},quiet:{short:"q",long:"quiet",type:"boolean"},recursive:{short:"r",long:"recursive",type:"boolean"},suffix:{short:"S",long:"suffix",type:"string",default:".gz"},test:{short:"t",long:"test",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},fast:{short:"1",long:"fast",type:"boolean"},level2:{short:"2",type:"boolean"},level3:{short:"3",type:"boolean"},level4:{short:"4",type:"boolean"},level5:{short:"5",type:"boolean"},level6:{short:"6",type:"boolean"},level7:{short:"7",type:"boolean"},level8:{short:"8",type:"boolean"},best:{short:"9",long:"best",type:"boolean"}},ES={name:"gzip",async execute(e,t){return{...await gh(e,t,"gzip"),stdoutEncoding:"binary"}}},SS={name:"gunzip",async execute(e,t){return{...await gh(e,t,"gunzip"),stdoutEncoding:"binary"}}},AS={name:"zcat",async execute(e,t){return{...await gh(e,t,"zcat"),stdoutEncoding:"binary"}}},CS={name:"gzip",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-1",type:"boolean"},{flag:"-9",type:"boolean"}],stdinType:"binary",needsFiles:!0},kS={name:"gunzip",flags:[{flag:"-c",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0},NS={name:"zcat",flags:[{flag:"-f",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0}});function C1(e,t){if(e instanceof Uint8Array)return e;if(t==="base64")return Uint8Array.from(atob(e),r=>r.charCodeAt(0));if(t==="hex"){let r=new Uint8Array(e.length/2);for(let n=0;nn.charCodeAt(0));let r=new Uint8Array(e.length);for(let n=0;nr.toString(16).padStart(2,"0")).join("");if(t==="binary"||t==="latin1"){if(typeof Buffer<"u")return Buffer.from(e).toString(t);let r=8192;if(e.length<=r)return String.fromCharCode(...e);let n="";for(let i=0;i{"use strict";TS=new TextEncoder,_S=new TextDecoder});function N1(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16)}`).replace(/%20/g,"+").replace(/%[0-9A-F]{2}/g,t=>t.toLowerCase())}function LP(e){let t=e.indexOf("=");if(t>=0){let r=e.slice(0,t),n=e.slice(t+1),i=N1(n);return r?`${r}=${i}`:i}return N1(e)}function U3(e){let t=e.indexOf("=");if(t<0)return null;let r=e.slice(0,t),n=e.slice(t+1),i,a,s=n.match(/;type=([^;]+)$/);s&&(a=s[1],n=n.slice(0,-s[0].length));let o=n.match(/;filename=([^;]+)/);return o&&(i=o[1],n=n.replace(o[0],"")),(n.startsWith("@")||n.startsWith("<"))&&(i=i??n.slice(1).split("/").pop()),{name:r,value:n,filename:i,contentType:a}}function MP(e,t){let r=`----CurlFormBoundary${Date.now().toString(36)}`,n=[];for(let i of e){let a=i.value;if(a.startsWith("@")||a.startsWith("<")){let o=a.slice(1);a=t.get(o)??""}let s=`--${r}\r `;i.filename?(s+=`Content-Disposition: form-data; name="${i.name}"; filename="${i.filename}"\r `,i.contentType&&(s+=`Content-Type: ${i.contentType}\r `)):s+=`Content-Disposition: form-data; name="${i.name}"\r `,s+=`\r ${a}\r `,n.push(s)}return n.push(`--${r}--\r `),{body:n.join(""),boundary:r}}var IS=q(()=>{"use strict"}),$S,PP=q(()=>{"use strict";$S={name:"curl",summary:"transfer a URL",usage:"curl [OPTIONS] URL",options:["-X, --request METHOD HTTP method (GET, POST, PUT, DELETE, etc.)","-H, --header HEADER Add header (can be used multiple times)","-d, --data DATA HTTP POST data (DATA=@file reads from file, strips newlines)","-G, --get Append data payloads to URL query string"," --data-raw DATA HTTP POST data (no @ interpretation)"," --data-binary DATA HTTP POST binary data (DATA=@file reads file verbatim)"," --data-urlencode DATA URL-encode and POST data (supports @file and name@file)","-F, --form NAME=VALUE Multipart form data","-u, --user USER:PASS HTTP authentication","-A, --user-agent STR Set User-Agent header","-e, --referer URL Set Referer header","-b, --cookie DATA Send cookies (name=value or @file)","-c, --cookie-jar FILE Save cookies to file","-T, --upload-file FILE Upload file (PUT)","-o, --output FILE Write output to file","-O, --remote-name Write to file named from URL","-D, --dump-header FILE Write response headers to FILE (`-` for stdout)","-I, --head Show headers only (HEAD request)","-i, --include Include response headers in output","-s, --silent Silent mode (no progress)","-S, --show-error Show errors even when silent","-f, --fail Fail silently on HTTP errors (no output)","-L, --location Follow redirects (default)"," --max-redirs NUM Maximum redirects (default: 20)","-m, --max-time SECS Maximum time for request"," --connect-timeout SECS Connection timeout","-w, --write-out FMT Output format after completion","-v, --verbose Verbose output"," --help Display this help and exit","","Note: Network access must be configured via BashEnv network option."," curl is not available by default for security reasons."]}});function Ea(e,t,r){r.allowFile&&t.startsWith("@")?e.dataParts.push({file:{path:t.slice(1),mode:r.binary?"binary":"ascii"}}):e.dataParts.push({value:t}),r.binary&&(e.dataBinary=!0)}function z3(e,t){if(t.startsWith("@")){e.dataParts.push({file:{path:t.slice(1),mode:"urlencode"}});return}let r=t.indexOf("@"),n=t.indexOf("=");if(r>0&&(n<0||r0){let l=s.slice(0,o).trim(),u=s.slice(o+1).trim();t.headers.append(l,u)}}}else if(a.startsWith("--header=")){let s=a.slice(9),o=s.indexOf(":");if(o>0){let l=s.slice(0,o).trim(),u=s.slice(o+1).trim();t.headers.append(l,u)}}else if(a==="-G"||a==="--get")t.getMode=!0,n||(t.method="GET");else if(a==="-d"||a==="--data")Ea(t,e[++i]??"",{binary:!1,allowFile:!0}),r=!0;else if(a==="--data-raw")Ea(t,e[++i]??"",{binary:!1,allowFile:!1}),r=!0;else if(a.startsWith("-d"))Ea(t,a.slice(2),{binary:!1,allowFile:!0}),r=!0;else if(a.startsWith("--data="))Ea(t,a.slice(7),{binary:!1,allowFile:!0}),r=!0;else if(a.startsWith("--data-raw="))Ea(t,a.slice(11),{binary:!1,allowFile:!1}),r=!0;else if(a==="--data-binary")Ea(t,e[++i]??"",{binary:!0,allowFile:!0}),r=!0;else if(a.startsWith("--data-binary="))Ea(t,a.slice(14),{binary:!0,allowFile:!0}),r=!0;else if(a==="--data-urlencode")z3(t,e[++i]??""),r=!0;else if(a.startsWith("--data-urlencode="))z3(t,a.slice(17)),r=!0;else if(a==="-F"||a==="--form"){let s=e[++i]??"",o=U3(s);o&&t.formFields.push(o),r=!0}else if(a.startsWith("--form=")){let s=a.slice(7),o=U3(s);o&&t.formFields.push(o),r=!0}else if(a==="-u"||a==="--user")t.user=e[++i];else if(a.startsWith("-u"))t.user=a.slice(2);else if(a.startsWith("--user="))t.user=a.slice(7);else if(a==="-A"||a==="--user-agent")t.headers.set("User-Agent",e[++i]??"");else if(a.startsWith("-A"))t.headers.set("User-Agent",a.slice(2));else if(a.startsWith("--user-agent="))t.headers.set("User-Agent",a.slice(13));else if(a==="-e"||a==="--referer")t.headers.set("Referer",e[++i]??"");else if(a.startsWith("-e"))t.headers.set("Referer",a.slice(2));else if(a.startsWith("--referer="))t.headers.set("Referer",a.slice(10));else if(a==="-b"||a==="--cookie")t.headers.set("Cookie",e[++i]??"");else if(a.startsWith("-b"))t.headers.set("Cookie",a.slice(2));else if(a.startsWith("--cookie="))t.headers.set("Cookie",a.slice(9));else if(a==="-c"||a==="--cookie-jar")t.cookieJar=e[++i];else if(a.startsWith("--cookie-jar="))t.cookieJar=a.slice(13);else if(a==="-T"||a==="--upload-file")t.uploadFile=e[++i],t.method==="GET"&&(t.method="PUT");else if(a.startsWith("--upload-file="))t.uploadFile=a.slice(14),t.method==="GET"&&(t.method="PUT");else if(a==="-m"||a==="--max-time"){let s=parseFloat(e[++i]??"0");!Number.isNaN(s)&&s>0&&(t.timeoutMs=s*1e3)}else if(a.startsWith("--max-time=")){let s=parseFloat(a.slice(11));!Number.isNaN(s)&&s>0&&(t.timeoutMs=s*1e3)}else if(a==="--connect-timeout"){let s=parseFloat(e[++i]??"0");!Number.isNaN(s)&&s>0&&t.timeoutMs===void 0&&(t.timeoutMs=s*1e3)}else if(a.startsWith("--connect-timeout=")){let s=parseFloat(a.slice(18));!Number.isNaN(s)&&s>0&&t.timeoutMs===void 0&&(t.timeoutMs=s*1e3)}else if(a==="-o"||a==="--output")t.outputFile=e[++i];else if(a.startsWith("--output="))t.outputFile=a.slice(9);else if(a==="-D"||a==="--dump-header"){let s=e[++i];if(s===void 0)return{stdout:"",stderr:`curl: option ${a}: requires parameter `,exitCode:1};if(s==="")return{stdout:"",stderr:`curl: option ${a}: blank argument where content is expected `,exitCode:1};t.dumpHeader=s}else if(a.startsWith("--dump-header=")){let s=a.slice(14);if(s==="")return{stdout:"",stderr:`curl: option --dump-header: blank argument where content is expected `,exitCode:1};t.dumpHeader=s}else if(a.startsWith("-D")&&a.length>2)t.dumpHeader=a.slice(2);else if(a==="-O"||a==="--remote-name")t.useRemoteName=!0;else if(a==="-I"||a==="--head")t.headOnly=!0,t.method="HEAD",n=!0;else if(a==="-i"||a==="--include")t.includeHeaders=!0;else if(a==="-s"||a==="--silent")t.silent=!0;else if(a==="-S"||a==="--show-error")t.showError=!0;else if(a==="-f"||a==="--fail")t.failSilently=!0;else if(a==="-L"||a==="--location")t.followRedirects=!0;else if(a==="--max-redirs"){let s=e[++i];if(s===void 0||!/^\d+$/.test(s))return{stdout:"",stderr:`curl: option --max-redirs: expected a non-negative integer `,exitCode:2};let o=Number(s);if(!Number.isSafeInteger(o))return{stdout:"",stderr:`curl: option --max-redirs: value is out of range `,exitCode:2};t.maxRedirects=o}else if(a.startsWith("--max-redirs=")){let s=a.slice(13);if(!/^\d+$/.test(s)||!Number.isSafeInteger(Number(s)))return{stdout:"",stderr:`curl: option --max-redirs: expected a non-negative integer `,exitCode:2};t.maxRedirects=Number(s)}else if(a==="-w"||a==="--write-out")t.writeOut=e[++i];else if(a.startsWith("--write-out="))t.writeOut=a.slice(12);else if(a==="-v"||a==="--verbose")t.verbose=!0;else{if(a.startsWith("--")&&a!=="--")return Le("curl",a);if(a.startsWith("-")&&a!=="-")for(let s of a.slice(1))switch(s){case"s":t.silent=!0;break;case"S":t.showError=!0;break;case"f":t.failSilently=!0;break;case"L":t.followRedirects=!0;break;case"I":t.headOnly=!0,t.method="HEAD",n=!0;break;case"i":t.includeHeaders=!0;break;case"O":t.useRemoteName=!0;break;case"v":t.verbose=!0;break;case"G":t.getMode=!0,n||(t.method="GET");break;default:return Le("curl",`-${s}`)}else a.startsWith("-")||(t.url=a)}}return r&&!n&&!t.getMode&&(t.method="POST"),t}var BP=q(()=>{"use strict";Ks(),be(),IS()});function UP(e){return Object.entries(e).map(([t,r])=>`${t}: ${r}`).join(`\r `)}function $c(e,t,r){return`HTTP/1.1 ${e} ${t}\r ${UP(r)}\r \r `}function zP(e){try{return new URL(e).pathname.split("/").pop()||"index.html"}catch{return"index.html"}}function DS(e,t){let r=e;return r=r.replace(/%\{http_code\}/g,String(t.status)),r=r.replace(/%\{content_type\}/g,t.headers["content-type"]||""),r=r.replace(/%\{url_effective\}/g,t.url),r=r.replace(/%\{size_download\}/g,String(t.bodyLength)),r=r.replace(/\\n/g,` `),r}var qP=q(()=>{"use strict"}),RS={};ce(RS,{curlCommand:()=>MS});async function HP(e,t){if(e.dataParts.length===0)return;let r=[],n=!1,i=!1;for(let l of e.dataParts)if(l.file){if(l.file.mode==="binary"){i=!0,l.file.path==="-"?(r.push(C1(n?yc:t.stdin,"binary")),n=!0):r.push(await t.fs.readFileBuffer(t.fs.resolvePath(t.cwd,l.file.path)));continue}let u=l.file.path==="-"?Ve(n?yc:t.stdin):await t.fs.readFile(t.fs.resolvePath(t.cwd,l.file.path));if(l.file.path==="-"&&(n=!0),l.file.mode==="ascii")r.push(u.replace(/[\x00\r\n]/g,""));else{let c=N1(u);r.push(l.file.name?`${l.file.name}=${c}`:c)}}else r.push(l.value??"");if(!i)return r.join("&");let a=r.length-1;for(let l of r)a+=typeof l=="string"?K(l):l.byteLength;let s=new Uint8Array(a),o=0;for(let l=0;l0&&(s[o]=38,o+=1);let u=r[l];typeof u=="string"?o+=LS.encodeInto(u,s.subarray(o)).written:(s.set(u,o),o+=u.byteLength)}return s}async function WP(e,t,r){if(e.uploadFile){let n=t.fs.resolvePath(t.cwd,e.uploadFile);return{body:await t.fs.readFile(n)}}if(e.formFields.length>0){let n=new Map;for(let s of e.formFields)if(s.value.startsWith("@")||s.value.startsWith("<")){let o=t.fs.resolvePath(t.cwd,s.value.slice(1));try{let l=await t.fs.readFile(o);n.set(s.value.slice(1),l)}catch{n.set(s.value.slice(1),"")}}let{body:i,boundary:a}=MP(e.formFields,n);return{body:i,contentType:`multipart/form-data; boundary=${a}`}}return r!==void 0&&!e.getMode?{body:r,contentType:"application/x-www-form-urlencoded"}:{}}function jP(e,t){if(!t)return e;let r=e.indexOf("#"),n=r===-1?e:e.slice(0,r),i=r===-1?"":e.slice(r),a=n.endsWith("?")||n.endsWith("&")?"":n.includes("?")?"&":"?";return`${n}${a}${t}${i}`}function GP(e,t){let r=new T0(e.headers);if(e.user){let n=Buffer.from(e.user).toString("base64");r.set("Authorization",`Basic ${n}`)}return t&&!r.has("Content-Type")&&r.set("Content-Type",t),r}async function VP(e,t,r){if(!e.cookieJar)return;let n=t["set-cookie"];if(!n)return;let i=r.fs.resolvePath(r.cwd,e.cookieJar);await r.fs.writeFile(i,n)}function ZP(e){return k1(e,"binary")}function XP(e,t,r){let n="";if(e.verbose){n+=`> ${e.method} ${r} `;for(let[i,a]of e.headers)n+=`> ${i}: ${a} `;n+=`> `,n+=`< HTTP/1.1 ${t.status} ${t.statusText} `;for(let[i,a]of Object.entries(t.headers))n+=`< ${i}: ${a} `;n+=`< `}return e.includeHeaders&&!e.verbose&&(n+=$c(t.status,t.statusText,t.headers)),e.headOnly?e.includeHeaders||e.verbose||(n+=$c(t.status,t.statusText,t.headers)):n+=ZP(t.body),e.writeOut&&(n+=DS(e.writeOut,{status:t.status,headers:t.headers,url:t.url,bodyLength:t.body.byteLength})),n}var LS,q3,MS,QP=q(()=>{"use strict";ge(),OS(),Br(),Ks(),be(),IS(),PP(),BP(),qP(),LS=new TextEncoder,q3=new TextDecoder("utf8",{ignoreBOM:!0}),MS={name:"curl",async execute(e,t){if(Ce(e))return we($S);let r=FP(e);if("exitCode"in r)return r;let n=r;if(!n.url)return{stdout:"",stderr:`curl: no URL specified `,exitCode:2};if(!t.fetch)return{stdout:"",stderr:`curl: internal error: fetch not available `,exitCode:1};let i=n.url;i.match(/^https?:\/\//)||(i=`https://${i}`);try{let a=await HP(n,t);n.getMode&&(i=jP(i,a instanceof Uint8Array?q3.decode(a):a));let{body:s,contentType:o}=await WP(n,t,a),l=GP(n,o);if(n.dumpHeader!==void 0&&n.dumpHeader!=="-"){let h=t.fs.resolvePath(t.cwd,n.dumpHeader);await t.fs.writeFile(h,"")}let u=await t.fetch(i,{method:n.method,headers:l,body:s,followRedirects:n.followRedirects,timeoutMs:n.timeoutMs,maxRedirects:n.maxRedirects,signal:t.signal});await VP(n,u.headers,t);let c=$c(u.status,u.statusText,u.headers),p="";if(u.redirectChain)for(let h of u.redirectChain)p+=$c(h.status,h.statusText,h.headers);if(p+=c,n.dumpHeader!==void 0&&n.dumpHeader!=="-"){let h=t.fs.resolvePath(t.cwd,n.dumpHeader);await t.fs.writeFile(h,p)}if(n.failSilently&&u.status>=400){let h=n.showError||!n.silent?`curl: (22) The requested URL returned error: ${u.status} `:"",m=n.dumpHeader==="-"?p:"";return{stdout:m,stderr:h,exitCode:22,stdoutKind:m?"bytes":void 0}}let d=!!(n.outputFile||n.useRemoteName),f=d&&!n.verbose?"":XP(n,u,i);if(d){let h=n.outputFile||zP(i),m=t.fs.resolvePath(t.cwd,h);if(await t.fs.writeFile(m,n.headOnly?"":u.body),n.verbose?f=(n.dumpHeader==="-"?p:"")+f:n.dumpHeader==="-"?f=p:f="",n.writeOut){let g=DS(n.writeOut,{status:u.status,headers:u.headers,url:u.url,bodyLength:u.body.byteLength});n.verbose?f+=g:n.dumpHeader==="-"?f=p+g:f=g}}else n.dumpHeader==="-"&&(f=p+f);return{stdout:f,stderr:"",exitCode:0,stdoutKind:"bytes"}}catch(a){let s=Fr(a),o=1;return s.includes("Network access denied")?o=7:s.includes("HTTP method")&&s.includes("not allowed")?o=3:s.includes("Redirect target not in allow-list")||s.includes("Too many redirects")?o=47:s.includes("aborted")&&(o=28),{stdout:"",stderr:!n.silent||n.showError?`curl: (${o}) ${s} `:"",exitCode:o}}}}});Xs();wl();ir();wl();ln();var H3=[{name:"echo",load:async()=>(await Promise.resolve().then(()=>(j_(),U4))).echoCommand},{name:"cat",load:async()=>(await Promise.resolve().then(()=>(X_(),W4))).catCommand},{name:"printf",load:async()=>(await Promise.resolve().then(()=>(fO(),Q4))).printfCommand},{name:"ls",load:async()=>(await Promise.resolve().then(()=>(yO(),aw))).lsCommand},{name:"mkdir",load:async()=>(await Promise.resolve().then(()=>(bO(),cw))).mkdirCommand},{name:"mktemp",load:async()=>(await Promise.resolve().then(()=>(TO(),hw))).mktempCommand},{name:"rmdir",load:async()=>(await Promise.resolve().then(()=>(OO(),Ew))).rmdirCommand},{name:"touch",load:async()=>(await Promise.resolve().then(()=>($O(),Cw))).touchCommand},{name:"rm",load:async()=>(await Promise.resolve().then(()=>(DO(),Tw))).rmCommand},{name:"cp",load:async()=>(await Promise.resolve().then(()=>(RO(),Iw))).cpCommand},{name:"mv",load:async()=>(await Promise.resolve().then(()=>(LO(),Rw))).mvCommand},{name:"ln",load:async()=>(await Promise.resolve().then(()=>(MO(),Pw))).lnCommand},{name:"chmod",load:async()=>(await Promise.resolve().then(()=>(FO(),Uw))).chmodCommand},{name:"pwd",load:async()=>(await Promise.resolve().then(()=>(BO(),Hw))).pwdCommand},{name:"readlink",load:async()=>(await Promise.resolve().then(()=>(UO(),Gw))).readlinkCommand},{name:"head",load:async()=>(await Promise.resolve().then(()=>(HO(),Yw))).headCommand},{name:"tail",load:async()=>(await Promise.resolve().then(()=>(WO(),tv))).tailCommand},{name:"wc",load:async()=>(await Promise.resolve().then(()=>(jO(),iv))).wcCommand},{name:"stat",load:async()=>(await Promise.resolve().then(()=>(GO(),lv))).statCommand},{name:"grep",load:async()=>(await Promise.resolve().then(()=>(zd(),Zu))).grepCommand},{name:"fgrep",load:async()=>(await Promise.resolve().then(()=>(zd(),Zu))).fgrepCommand},{name:"egrep",load:async()=>(await Promise.resolve().then(()=>(zd(),Zu))).egrepCommand},{name:"rg",load:async()=>(await Promise.resolve().then(()=>(VI(),Mv))).rgCommand},{name:"sed",load:async()=>(await Promise.resolve().then(()=>(l$(),Xv))).sedCommand},{name:"awk",load:async()=>(await Promise.resolve().then(()=>(kD(),x8))).awkCommand2},{name:"sort",load:async()=>(await Promise.resolve().then(()=>($D(),E8))).sortCommand},{name:"uniq",load:async()=>(await Promise.resolve().then(()=>(DD(),C8))).uniqCommand},{name:"comm",load:async()=>(await Promise.resolve().then(()=>(RD(),T8))).commCommand},{name:"cut",load:async()=>(await Promise.resolve().then(()=>(PD(),I8))).cutCommand},{name:"paste",load:async()=>(await Promise.resolve().then(()=>(FD(),R8))).pasteCommand},{name:"tr",load:async()=>(await Promise.resolve().then(()=>(BD(),P8))).trCommand},{name:"rev",load:async()=>(await Promise.resolve().then(()=>(zD(),z8))).rev},{name:"nl",load:async()=>(await Promise.resolve().then(()=>(WD(),W8))).nl},{name:"fold",load:async()=>(await Promise.resolve().then(()=>(VD(),V8))).fold},{name:"expand",load:async()=>(await Promise.resolve().then(()=>(QD(),Q8))).expand},{name:"unexpand",load:async()=>(await Promise.resolve().then(()=>(YD(),J8))).unexpand},{name:"strings",load:async()=>(await Promise.resolve().then(()=>(eR(),r9))).strings},{name:"split",load:async()=>(await Promise.resolve().then(()=>(lR(),a9))).split},{name:"column",load:async()=>(await Promise.resolve().then(()=>(fR(),u9))).column},{name:"join",load:async()=>(await Promise.resolve().then(()=>(gR(),f9))).join},{name:"tee",load:async()=>(await Promise.resolve().then(()=>(xR(),m9))).teeCommand},{name:"find",load:async()=>(await Promise.resolve().then(()=>(OR(),y9))).findCommand},{name:"basename",load:async()=>(await Promise.resolve().then(()=>(IR(),E9))).basenameCommand},{name:"dirname",load:async()=>(await Promise.resolve().then(()=>($R(),C9))).dirnameCommand},{name:"tree",load:async()=>(await Promise.resolve().then(()=>(RR(),T9))).treeCommand},{name:"du",load:async()=>(await Promise.resolve().then(()=>(MR(),$9))).duCommand},{name:"env",load:async()=>(await Promise.resolve().then(()=>(Db(),a1))).envCommand},{name:"printenv",load:async()=>(await Promise.resolve().then(()=>(Db(),a1))).printenvCommand},{name:"alias",load:async()=>(await Promise.resolve().then(()=>(Lb(),s1))).aliasCommand},{name:"unalias",load:async()=>(await Promise.resolve().then(()=>(Lb(),s1))).unaliasCommand},{name:"history",load:async()=>(await Promise.resolve().then(()=>(PR(),H9))).historyCommand},{name:"xargs",load:async()=>(await Promise.resolve().then(()=>(BR(),G9))).xargsCommand},{name:"true",load:async()=>(await Promise.resolve().then(()=>(Bb(),o1))).trueCommand},{name:"false",load:async()=>(await Promise.resolve().then(()=>(Bb(),o1))).falseCommand},{name:"yes",load:async()=>(await Promise.resolve().then(()=>(UR(),J9))).yesCommand},{name:"clear",load:async()=>(await Promise.resolve().then(()=>(zR(),r5))).clearCommand},{name:"bash",load:async()=>(await Promise.resolve().then(()=>(qb(),l1))).bashCommand},{name:"sh",load:async()=>(await Promise.resolve().then(()=>(qb(),l1))).shCommand},{name:"jq",load:async()=>(await Promise.resolve().then(()=>(IL(),w5))).jqCommand},{name:"base64",load:async()=>(await Promise.resolve().then(()=>($L(),S5))).base64Command},{name:"diff",load:async()=>(await Promise.resolve().then(()=>(FL(),_5))).diffCommand},{name:"date",load:async()=>(await Promise.resolve().then(()=>(HL(),$5))).dateCommand},{name:"sleep",load:async()=>(await Promise.resolve().then(()=>(WL(),P5))).sleepCommand},{name:"timeout",load:async()=>(await Promise.resolve().then(()=>(jL(),U5))).timeoutCommand},{name:"time",load:async()=>(await Promise.resolve().then(()=>(XL(),j5))).timeCommand},{name:"seq",load:async()=>(await Promise.resolve().then(()=>(QL(),Z5))).seqCommand},{name:"expr",load:async()=>(await Promise.resolve().then(()=>(YL(),K5))).exprCommand},{name:"md5sum",load:async()=>(await Promise.resolve().then(()=>(eM(),tE))).md5sumCommand},{name:"sha1sum",load:async()=>(await Promise.resolve().then(()=>(tM(),iE))).sha1sumCommand},{name:"sha256sum",load:async()=>(await Promise.resolve().then(()=>(rM(),oE))).sha256sumCommand},{name:"file",load:async()=>(await Promise.resolve().then(()=>(mP(),PE))).fileCommand},{name:"html-to-markdown",load:async()=>(await Promise.resolve().then(()=>(gP(),HE))).htmlToMarkdownCommand},{name:"help",load:async()=>(await Promise.resolve().then(()=>(yP(),VE))).helpCommand},{name:"which",load:async()=>(await Promise.resolve().then(()=>(bP(),KE))).whichCommand},{name:"tac",load:async()=>(await Promise.resolve().then(()=>(vP(),eS))).tac},{name:"hostname",load:async()=>(await Promise.resolve().then(()=>(SP(),nS))).hostname},{name:"whoami",load:async()=>(await Promise.resolve().then(()=>(CP(),sS))).whoami},{name:"od",load:async()=>(await Promise.resolve().then(()=>(NP(),uS))).od},{name:"gzip",load:async()=>(await Promise.resolve().then(()=>(xh(),lc))).gzipCommand},{name:"gunzip",load:async()=>(await Promise.resolve().then(()=>(xh(),lc))).gunzipCommand},{name:"zcat",load:async()=>(await Promise.resolve().then(()=>(xh(),lc))).zcatCommand}],KP=[],YP=[],JP=[{name:"curl",load:async()=>(await Promise.resolve().then(()=>(QP(),RS))).curlCommand}],W3=new Map;function cp(e){return{name:e.name,async execute(t,r){let n=W3.get(e.name);return n||(n=await rn.runTrustedAsync(()=>F4(e.load(),r.signal,`bash: ${e.name} was cancelled before it started `)),W3.set(e.name,n)),r.coverage,n.execute(t,r)}}}function eF(e){return(e?H3.filter(t=>e.includes(t.name)):H3).map(cp)}function tF(){return JP.map(cp)}function rF(){return KP.map(cp)}function nF(){return YP.map(cp)}wl();ge();var j3=new WeakMap,PS=new WeakSet;function iF(e){let t=j3.get(e);return t===void 0&&(t=Object.freeze(Object.create(null)),j3.set(e,t),PS.add(t)),t}function aF(e){return PS.has(e)}var FS={maxSourceBytes:67108864,maxExecDepth:64,maxCallDepth:100,maxCommandCount:1e5,maxLoopIterations:1e5,maxAwkIterations:1e5,maxSedIterations:1e5,maxJqIterations:1e7,maxQueryTokens:1e5,maxQueryDepth:1e3,maxQueryElements:1e6,maxAwkParserTokens:1e5,maxAwkParserDepth:256,maxAwkParserOperations:1e6,maxCsvRows:1e6,maxCsvCells:1e7,maxWorkUnits:1e8,maxTraversalEntries:1e6,maxTraversalDepth:1e3,maxTraversalWork:1e6,maxLiveBytes:536870912,maxInputBytes:536870912,maxFileSystemBytes:1073741824,maxDatabaseBytes:1073741824,maxDatabaseResultBytes:268435456,maxArchiveBytes:1073741824,maxArchiveCompressedBytes:536870912,maxArchiveEntryBytes:536870912,maxArchiveEntries:1e6,maxWorkerMessageBytes:67108864,maxExecutionTimeMs:36e5,maxExtensionCleanupTimeMs:100,maxSqliteTimeoutMs:3e4,maxPythonTimeoutMs:3e4,maxJsTimeoutMs:3e4,maxJsBridgeRequests:1e6,maxGlobOperations:1e6,maxStringLength:67108864,maxArrayElements:1e6,maxHeredocSize:67108864,maxSubstitutionDepth:50,maxBraceExpansionResults:1e5,maxOutputSize:268435456,maxFileDescriptors:4096,maxSourceDepth:100},sF={...FS,maxSourceBytes:8*1024*1024,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:1e4,maxJsTimeoutMs:1e4,maxJsBridgeRequests:1e5,maxExtensionCleanupTimeMs:25,maxGlobOperations:1e5,maxStringLength:10*1024*1024,maxArrayElements:1e5,maxHeredocSize:10*1024*1024,maxBraceExpansionResults:1e4,maxOutputSize:10*1024*1024,maxFileDescriptors:1024,maxQueryTokens:25e3,maxQueryDepth:256,maxQueryElements:1e5,maxAwkParserTokens:25e3,maxAwkParserDepth:128,maxAwkParserOperations:1e5,maxCsvRows:1e5,maxCsvCells:1e6,maxWorkUnits:1e5,maxTraversalEntries:1e5,maxTraversalDepth:256,maxTraversalWork:1e5,maxLiveBytes:64*1024*1024,maxInputBytes:32*1024*1024,maxFileSystemBytes:128*1024*1024,maxDatabaseBytes:64*1024*1024,maxDatabaseResultBytes:16*1024*1024,maxArchiveBytes:128*1024*1024,maxArchiveCompressedBytes:64*1024*1024,maxArchiveEntryBytes:64*1024*1024,maxArchiveEntries:1e5,maxWorkerMessageBytes:16*1024*1024,maxExecutionTimeMs:3e4};function oF(e,t="normal"){if(t!=="normal"&&t!=="hardened")throw new RangeError('executionLimitProfile must be "normal" or "hardened"');let r=t==="hardened"?sF:FS;if(!e)return{...r};let n={maxSourceBytes:e.maxSourceBytes??r.maxSourceBytes,maxExecDepth:e.maxExecDepth??r.maxExecDepth,maxCallDepth:e.maxCallDepth??r.maxCallDepth,maxCommandCount:e.maxCommandCount??r.maxCommandCount,maxLoopIterations:e.maxLoopIterations??r.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??r.maxAwkIterations,maxSedIterations:e.maxSedIterations??r.maxSedIterations,maxJqIterations:e.maxJqIterations??r.maxJqIterations,maxQueryTokens:e.maxQueryTokens??r.maxQueryTokens,maxQueryDepth:e.maxQueryDepth??r.maxQueryDepth,maxQueryElements:e.maxQueryElements??r.maxQueryElements,maxAwkParserTokens:e.maxAwkParserTokens??r.maxAwkParserTokens,maxAwkParserDepth:e.maxAwkParserDepth??r.maxAwkParserDepth,maxAwkParserOperations:e.maxAwkParserOperations??r.maxAwkParserOperations,maxCsvRows:e.maxCsvRows??r.maxCsvRows,maxCsvCells:e.maxCsvCells??r.maxCsvCells,maxWorkUnits:e.maxWorkUnits??r.maxWorkUnits,maxTraversalEntries:e.maxTraversalEntries??r.maxTraversalEntries,maxTraversalDepth:e.maxTraversalDepth??r.maxTraversalDepth,maxTraversalWork:e.maxTraversalWork??r.maxTraversalWork,maxLiveBytes:e.maxLiveBytes??r.maxLiveBytes,maxInputBytes:e.maxInputBytes??r.maxInputBytes,maxFileSystemBytes:e.maxFileSystemBytes??r.maxFileSystemBytes,maxDatabaseBytes:e.maxDatabaseBytes??r.maxDatabaseBytes,maxDatabaseResultBytes:e.maxDatabaseResultBytes??r.maxDatabaseResultBytes,maxArchiveBytes:e.maxArchiveBytes??r.maxArchiveBytes,maxArchiveCompressedBytes:e.maxArchiveCompressedBytes??r.maxArchiveCompressedBytes,maxArchiveEntryBytes:e.maxArchiveEntryBytes??r.maxArchiveEntryBytes,maxArchiveEntries:e.maxArchiveEntries??r.maxArchiveEntries,maxWorkerMessageBytes:e.maxWorkerMessageBytes??r.maxWorkerMessageBytes,maxExecutionTimeMs:e.maxExecutionTimeMs??r.maxExecutionTimeMs,maxExtensionCleanupTimeMs:e.maxExtensionCleanupTimeMs??r.maxExtensionCleanupTimeMs,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??r.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??r.maxPythonTimeoutMs,maxJsTimeoutMs:e.maxJsTimeoutMs??r.maxJsTimeoutMs,maxJsBridgeRequests:e.maxJsBridgeRequests??r.maxJsBridgeRequests,maxGlobOperations:e.maxGlobOperations??r.maxGlobOperations,maxStringLength:e.maxStringLength??r.maxStringLength,maxArrayElements:e.maxArrayElements??r.maxArrayElements,maxHeredocSize:e.maxHeredocSize??r.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??r.maxSubstitutionDepth,maxBraceExpansionResults:e.maxBraceExpansionResults??r.maxBraceExpansionResults,maxOutputSize:e.maxOutputSize??r.maxOutputSize,maxFileDescriptors:e.maxFileDescriptors??r.maxFileDescriptors,maxSourceDepth:e.maxSourceDepth??r.maxSourceDepth};for(let i of Object.keys(n)){let a=n[i];if(a!==Number.POSITIVE_INFINITY&&(!Number.isSafeInteger(a)||a<0))throw new RangeError(`${i} must be a non-negative safe integer or positive Infinity`)}return n}Ks();function lF(e){return"load"in e&&typeof e.load=="function"}function pp(e,t,r={}){return{name:e,trusted:r.trusted!==!1,execute:t}}function uF(e){let t=null,r=!1,n=new Set,i=o=>{t=o;for(let l of n)l.resolve(o);n.clear()},a=o=>{r=!1;for(let l of n)l.reject(o);n.clear()},s=()=>{r=!0;let o;try{o=Promise.resolve(e.load())}catch(l){a(l);return}W5.call(o,i,a)};return{name:e.name,trusted:e.trusted!==!1,async execute(o,l){if(!t){let c,p=new Promise((d,f)=>{c={resolve:d,reject:f},n.add(c)});r||s();try{t=await F4(p,l.signal,`bash: ${e.name} was cancelled before it started `)}finally{c&&n.delete(c)}}let u=t;if(!u)throw new Error(`Failed to load command: ${e.name}`);return u.execute(o,l)}}}ge();ge();J();Xs();var BS=Object.freeze(Object.create(null)),cF=class{limits;signal;commandCount=0;workUnits=0;liveBytes=0;inputBytes=0;outputBytes=0;countersByKind=new Map;bytesByKind=new Map;depthByKind=new Map;cleanupCallbacks=[];poisoned;closed=!1;startedAt=Date.now();get remainingLiveBytes(){return Math.max(0,this.limits.maxLiveBytes-this.liveBytes)}get outputBytesUsed(){return this.outputBytes}constructor(e,t=void 0){this.limits=e,this.signal=t}fail(e){throw this.poisoned??=e,this.poisoned}poisonAfterAbort(e){this.poisoned??=e}assertUsable(){if(this.poisoned)throw this.poisoned;if(this.closed)throw new Error("execution budget is already closed");this.throwIfAborted()}chargeCommand(){return this.consume("commands",1,"execution")}consumeWork(e=1,t="execution"){return this.consume("work",e,t)}consumeLimited(e,t,r,n=e){this.assertUsable();let i=this.countersByKind.get(e)??0;return(!Number.isSafeInteger(t)||t<0||!Number.isSafeInteger(r)||r<0||t>r-i)&&this.fail(new T(`${n}: ${e} work limit exceeded (${r})`,"iterations")),t>this.limits.maxWorkUnits-this.workUnits&&this.fail(new T(`${n}: aggregate work limit exceeded (${this.limits.maxWorkUnits})`,"iterations")),this.countersByKind.set(e,i+t),this.workUnits+=t,i+t}consumeInput(e,t="execution"){return this.assertUsable(),(!Number.isSafeInteger(e)||e<0||e>this.limits.maxInputBytes-this.inputBytes)&&this.fail(new T(`${t}: aggregate input size limit exceeded (${this.limits.maxInputBytes} bytes)`,"string_length")),this.inputBytes+=e,this.inputBytes}consume(e,t=1,r=e){this.assertUsable();let n=this.countersByKind.get(e)??0,i=e==="commands"?this.commandCount:this.workUnits,a=e==="commands"?this.limits.maxCommandCount:this.limits.maxWorkUnits;(!Number.isSafeInteger(t)||t<0||t>a-i)&&this.fail(new T(e==="commands"?`too many commands executed (>${a}), increase executionLimits.maxCommandCount`:`${r}: ${e} work limit exceeded (${a})`,e==="commands"?"commands":"iterations"));let s=i+t;return e==="commands"?this.commandCount=s:this.workUnits=s,this.countersByKind.set(e,n+t),s}reserveBytes(e,t,r){this.assertUsable();let n=typeof e=="string"?e:"live",i=typeof e=="string"?t:e,a=typeof e=="string"?r??n:t??"execution";(!Number.isSafeInteger(i)||i<0||i>this.limits.maxLiveBytes-this.liveBytes)&&this.fail(new T(`${a}: live byte limit exceeded (${this.limits.maxLiveBytes} bytes)`,"string_length")),this.liveBytes+=i,this.bytesByKind.set(n,(this.bytesByKind.get(n)??0)+i);let s=!1;return{release:()=>{if(s)return;s=!0,this.liveBytes-=i;let o=(this.bytesByKind.get(n)??i)-i;o<=0?this.bytesByKind.delete(n):this.bytesByKind.set(n,o)}}}appendOutput(e,t,r="execution",n=0,i="text"){this.assertUsable();let a=i==="bytes"?t.length:K(t);(!Number.isSafeInteger(n)||n<0||n>a)&&this.fail(new T(`${r}: invalid ${e} accounting`,"output_size"));let s=a-n;return s>this.limits.maxOutputSize-this.outputBytes&&this.fail(new T(`${r}: total output size exceeded (>${this.limits.maxOutputSize} bytes), increase executionLimits.maxOutputSize`,"output_size")),this.outputBytes+=s,a}accountResult(e,t="execution",r=Number.POSITIVE_INFINITY){let n=e.internalOutputAccounting,i=Math.min(n?.stdout??0,r),a=Math.min(n?.stderr??0,Math.max(0,r-i)),s=this.appendOutput("stdout",e.stdout,t,i,e.stdoutKind==="bytes"||e.stdoutEncoding==="binary"?"bytes":"text"),o=this.appendOutput("stderr",e.stderr,t,a);return Object.isExtensible(e)?(e.internalOutputAccounting={stdout:s,stderr:o},e):s===0&&o===0?e:{...e,internalOutputAccounting:{stdout:s,stderr:o}}}relinquishOutput(e,t,r){this.assertUsable(),r!==BS&&this.fail(new T(`${t}: unauthorized output accounting release`,"output_size")),(!Number.isSafeInteger(e)||e<0||e>this.outputBytes)&&this.fail(new T(`${t}: invalid output accounting release`,"output_size")),this.outputBytes-=e}enterDepth(e,t=this.limits.maxCallDepth,r){this.assertUsable();let n=typeof t=="number"?t:this.limits.maxCallDepth,i=typeof t=="string"?t:r??e,a=this.depthByKind.get(e)??0;a>=n&&this.fail(new T(`${i}: maximum depth (${n}) exceeded`,"recursion")),this.depthByKind.set(e,a+1);let s=!1;return{release:()=>{if(s)return;s=!0;let o=(this.depthByKind.get(e)??1)-1;o<=0?this.depthByKind.delete(e):this.depthByKind.set(e,o)}}}throwIfAborted(e="execution"){this.signal?.aborted&&this.fail(new zt("",`bash: ${e} aborted `)),Date.now()-this.startedAt>this.limits.maxExecutionTimeMs&&this.fail(new zt("",`bash: ${e} exceeded execution deadline (${this.limits.maxExecutionTimeMs}ms) `))}remainingTimeMs(){return Math.max(0,this.limits.maxExecutionTimeMs-(Date.now()-this.startedAt))}registerCleanup(e){this.assertUsable(),this.cleanupCallbacks.push(e);let t=!0;return()=>{if(!t)return;t=!1;let r=this.cleanupCallbacks.indexOf(e);r>=0&&this.cleanupCallbacks.splice(r,1)}}async close(){if(this.closed)return;this.closed=!0;let e=[],t=Date.now()+this.limits.maxExtensionCleanupTimeMs;for(let r=this.cleanupCallbacks.length-1;r>=0;r--)try{let n=t-Date.now();if(n<=0){e.push(new Error("execution cleanup grace period exceeded"));break}let i,a=await Promise.race([Promise.resolve().then(this.cleanupCallbacks[r]).then(()=>({ok:!0}),s=>({ok:!1,error:s})),new Promise(s=>{i=Ph(()=>s({ok:!1,error:new Error("execution cleanup grace period exceeded")}),n)})]);if(Fh(i),!a.ok&&(e.push(a.error),Date.now()>=t))break}catch(n){e.push(n)}if(this.cleanupCallbacks.length=0,this.depthByKind.clear(),this.bytesByKind.clear(),this.liveBytes=0,e.length>0)throw new AggregateError(e,"execution cleanup failed")}assertExecDepth(e){this.assertUsable(),e>this.limits.maxExecDepth&&this.fail(new T(`maximum nested execution depth (${this.limits.maxExecDepth}) exceeded`,"recursion"))}};function pF(e){let t=Object.create(null);return Object.defineProperties(t,{remainingLiveBytes:{enumerable:!0,get:()=>e.remainingLiveBytes},consumeWork:{enumerable:!0,value:e.consumeWork.bind(e)},consumeLimited:{enumerable:!0,value:e.consumeLimited.bind(e)},consumeInput:{enumerable:!0,value:e.consumeInput.bind(e)},reserveBytes:{enumerable:!0,value:e.reserveBytes.bind(e)},enterDepth:{enumerable:!0,value:e.enterDepth.bind(e)},throwIfAborted:{enumerable:!0,value:e.throwIfAborted.bind(e)},remainingTimeMs:{enumerable:!0,value:e.remainingTimeMs.bind(e)},registerCleanup:{enumerable:!0,value:e.registerCleanup.bind(e)}}),Object.freeze(t)}function fF(e,t,r="pipeline"){e.relinquishOutput(t,r,BS)}ge();ln();OS();vl();var Sa=new TextEncoder;function dF(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var Hs=class{data=new Map;entryIdentities=new WeakMap;nextEntryIdentity=1;maxTotalBytes;retainedBytes=0;contentReferences=new WeakMap;materializedContent(e){return e?.type==="file"&&"content"in e?e.content:null}storedByteLength(e){return e===null?0:e instanceof Uint8Array?e.byteLength:K(e)}wouldReleaseBytes(e){let t=this.materializedContent(e);return t===null?0:t instanceof Uint8Array?this.contentReferences.get(t)===1?t.byteLength:0:this.storedByteLength(t)}assertCanAllocate(e,t){let r=this.wouldReleaseBytes(this.data.get(e));if(!Number.isSafeInteger(t)||t<0||t>this.maxTotalBytes-this.retainedBytes+r)throw new Error(`ENOSPC: in-memory filesystem byte limit exceeded (${this.maxTotalBytes} bytes)`)}setEntry(e,t){let r=this.data.get(e),n=this.materializedContent(r),i=this.materializedContent(t);if(n===i){this.data.set(e,t);return}let a=this.wouldReleaseBytes(r),s=i instanceof Uint8Array?this.contentReferences.has(i)?0:i.byteLength:this.storedByteLength(i);if(s>this.maxTotalBytes-this.retainedBytes+a)throw new Error(`ENOSPC: in-memory filesystem byte limit exceeded (${this.maxTotalBytes} bytes)`);if(n instanceof Uint8Array){let o=this.contentReferences.get(n)??0;o<=1?this.contentReferences.delete(n):this.contentReferences.set(n,o-1)}i instanceof Uint8Array&&this.contentReferences.set(i,(this.contentReferences.get(i)??0)+1),this.retainedBytes+=s-a,this.data.set(e,t)}deleteEntry(e){let t=this.data.get(e);if(!t)return!1;let r=this.materializedContent(t),n=this.wouldReleaseBytes(t);if(r instanceof Uint8Array){let i=this.contentReferences.get(r)??0;i<=1?this.contentReferences.delete(r):this.contentReferences.set(r,i-1)}return this.retainedBytes-=n,this.data.delete(e)}contentByteLength(e,t){if(e instanceof Uint8Array)return e.byteLength;if(t==="hex")return Math.floor(e.length/2);if(t==="base64"){let r=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.max(0,Math.floor(e.length*3/4)-r)}return t==="binary"||t==="latin1"?e.length:K(e)}identityFor(e){let t=this.entryIdentities.get(e);return t||(t=`memfs:${this.nextEntryIdentity++}`,this.entryIdentities.set(e,t)),t}constructor(e,t={}){if(this.maxTotalBytes=t.maxTotalBytes??1024*1024*1024,!Number.isSafeInteger(this.maxTotalBytes)||this.maxTotalBytes<0)throw new Error("InMemoryFs: invalid maxTotalBytes");if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),e)for(let[r,n]of Object.entries(e))typeof n=="function"?this.writeFileLazy(r,n):dF(n)?this.writeFileSync(r,n.content,void 0,{mode:n.mode,mtime:n.mtime}):this.writeFileSync(r,n)}ensureParentDirs(e){let t=Ua(e);t!=="/"&&(this.data.has(t)||(this.ensureParentDirs(t),this.data.set(t,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(e,t,r,n){Gt(e,"write");let i=Be(e);this.ensureParentDirs(i);let a=yh(r);this.assertCanAllocate(i,this.contentByteLength(t,a));let s=C1(t,a);this.setEntry(i,{type:"file",content:s,mode:n?.mode??420,mtime:n?.mtime??new Date})}writeFileLazy(e,t,r){Gt(e,"write");let n=Be(e);this.ensureParentDirs(n),this.setEntry(n,{type:"file",lazy:t,mode:r?.mode??420,mtime:r?.mtime??new Date})}async materializeLazy(e,t){let r=await rn.runTrustedAsync(async()=>t.lazy()),n=typeof r=="string"?Sa.encode(r):r,i={type:"file",content:n,mode:t.mode,mtime:t.mtime};return this.assertCanAllocate(e,n.byteLength),this.setEntry(e,i),i}async readFile(e,t){let r=await this.readFileBuffer(e),n=yh(t);return k1(r,n)}async readFileBytes(e){let t=await this.readFileBuffer(e);return k1(t,"binary")}async readFileBuffer(e){Gt(e,"open");let t=this.resolvePathWithSymlinks(e),r=this.data.get(t);if(!r)throw new Error(`ENOENT: no such file or directory, open '${e}'`);if(r.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${e}'`);if("lazy"in r){let n=await this.materializeLazy(t,r);return n.content instanceof Uint8Array?n.content:Sa.encode(n.content)}return r.content instanceof Uint8Array?r.content:Sa.encode(r.content)}async writeFile(e,t,r){this.writeFileSync(e,t,r)}async appendFile(e,t,r){Gt(e,"append");let n=Be(e),i=this.data.get(n);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${e}'`);let a=yh(r),s=this.contentByteLength(t,a);if(i?.type==="file"){let o=i;"lazy"in o&&(o=await this.materializeLazy(n,o));let l="content"in o&&o.content instanceof Uint8Array?o.content:Sa.encode("content"in o?o.content:"");this.assertCanAllocate(n,l.byteLength+s);let u=C1(t,a),c=new Uint8Array(l.length+u.length);c.set(l),c.set(u,l.length),this.setEntry(n,{type:"file",content:c,mode:o.mode,mtime:new Date})}else this.writeFileSync(e,t,r)}async exists(e){if(e.includes("\0"))return!1;try{let t=this.resolvePathWithSymlinks(e);return this.data.has(t)}catch{return!1}}async stat(e){Gt(e,"stat");let t=this.resolvePathWithSymlinks(e),r=this.data.get(t);if(!r)throw new Error(`ENOENT: no such file or directory, stat '${e}'`);r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(t,r));let n=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?n=r.content.length:n=Sa.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:n,mtime:r.mtime||new Date,identity:this.identityFor(r)}}async lstat(e){Gt(e,"lstat");let t=this.resolveIntermediateSymlinks(e),r=this.data.get(t);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${e}'`);if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime||new Date};r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(t,r));let n=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?n=r.content.length:n=Sa.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:n,mtime:r.mtime||new Date,identity:this.identityFor(r)}}resolveIntermediateSymlinks(e){let t=Be(e);if(t==="/")return"/";let r=t.slice(1).split("/");if(r.length<=1)return t;let n="",i=new Set;for(let a=0;a=u)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${e}'`)}return`${n}/${r[r.length-1]}`}resolvePathWithSymlinks(e){let t=Be(e);if(t==="/")return"/";let r=t.slice(1).split("/"),n="",i=new Set;for(let a of r){n=`${n}/${a}`;let s=this.data.get(n),o=0,l=40;for(;s&&s.type==="symlink"&&o=l)throw new Error(`ELOOP: too many levels of symbolic links, open '${e}'`)}return n}async mkdir(e,t){this.mkdirSync(e,t)}async createExclusive(e,t){let r=t.directory?"mkdir":"open";Gt(e,t.directory?"mkdir":"write");let n=Be(e),i=Ua(n),a=i==="/"?"/":this.resolvePathWithSymlinks(i),s=Mn(a,n.slice(n.lastIndexOf("/")+1));if(this.data.has(s))throw new Error(`EEXIST: file already exists, ${r} '${e}'`);if(a!=="/"){let o=this.data.get(a);if(!o)throw new Error(`ENOENT: no such file or directory, ${r} '${e}'`);if(o.type!=="directory")throw new Error(`ENOTDIR: not a directory, ${r} '${e}'`)}if(t.directory){this.setEntry(s,{type:"directory",mode:t.mode,mtime:new Date});return}this.assertCanAllocate(s,0),this.setEntry(s,{type:"file",content:new Uint8Array(0),mode:t.mode,mtime:new Date})}mkdirSync(e,t){Gt(e,"mkdir");let r=Be(e);if(this.data.has(r)){if(this.data.get(r)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${e}'`);if(!t?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${e}'`);return}let n=Ua(r);if(n!=="/"&&!this.data.has(n))if(t?.recursive)this.mkdirSync(n,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${e}'`);this.data.set(r,{type:"directory",mode:493,mtime:new Date})}async readdir(e){return(await this.readdirWithFileTypes(e)).map(t=>t.name)}async readdirWithFileTypes(e){Gt(e,"scandir");let t=Be(e),r=this.data.get(t);if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${e}'`);let n=new Set;for(;r&&r.type==="symlink";){if(n.has(t))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${e}'`);n.add(t),t=gd(t,r.target),r=this.data.get(t)}if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${e}'`);if(r.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${e}'`);let i=t==="/"?"/":`${t}/`,a=new Map;for(let[s,o]of this.data.entries())if(s!==t&&s.startsWith(i)){let l=s.slice(i.length),u=l.split("/")[0];u&&!l.includes("/",u.length)&&!a.has(u)&&a.set(u,{name:u,isFile:o.type==="file",isDirectory:o.type==="directory",isSymbolicLink:o.type==="symlink"})}return Array.from(a.values()).sort((s,o)=>s.nameo.name?1:0)}async rm(e,t){Gt(e,"rm");let r=Be(e),n=this.data.get(r);if(!n){if(t?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${e}'`)}if(n.type==="directory"){let i=await this.readdir(r);if(i.length>0){if(!t?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${e}'`);for(let a of i){let s=Mn(r,a);await this.rm(s,t)}}}this.deleteEntry(r)}async cp(e,t,r){Gt(e,"cp"),Gt(t,"cp");let n=Be(e),i=Be(t),a=this.data.get(n);if(!a)throw new Error(`ENOENT: no such file or directory, cp '${e}'`);if(a.type==="file")if(this.ensureParentDirs(i),"content"in a){let s=a.content instanceof Uint8Array?a.content.byteLength:Sa.encode(a.content).byteLength;this.assertCanAllocate(i,s);let o=a.content instanceof Uint8Array?new Uint8Array(a.content):a.content;this.setEntry(i,{...a,content:o})}else this.setEntry(i,{...a});else if(a.type==="symlink")this.ensureParentDirs(i),this.data.set(i,{...a});else if(a.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${e}'`);if(ja(n,i))throw new Error(`EINVAL: cannot copy '${e}' into itself, '${t}'`);await this.mkdir(i,{recursive:!0});let s=await this.readdir(n);for(let o of s){let l=Mn(n,o),u=Mn(i,o);await this.cp(l,u,r)}}}async mv(e,t){Gt(e,"mv"),Gt(t,"mv");let r=Be(e),n=Be(t);if(r===n)return;let i=this.data.get(r);if(!i)throw new Error(`ENOENT: no such file or directory, mv '${e}'`);if(i.type==="directory"&&ja(r,n))throw new Error(`EINVAL: cannot move '${e}' into itself, '${t}'`);if(i.type==="directory"){await this.mkdir(n,{recursive:!0});let a=await this.readdir(r);for(let s of a)await this.mv(Mn(r,s),Mn(n,s));this.deleteEntry(r);return}this.ensureParentDirs(n),this.setEntry(n,i),this.deleteEntry(r)}getAllPaths(){return Array.from(this.data.keys())}resolvePath(e,t){return ew(e,t)}async chmod(e,t){Gt(e,"chmod");let r=Be(e),n=this.data.get(r);if(!n)throw new Error(`ENOENT: no such file or directory, chmod '${e}'`);n.mode=t}async symlink(e,t){Gt(t,"symlink");let r=Be(t);if(this.data.has(r))throw new Error(`EEXIST: file already exists, symlink '${t}'`);this.ensureParentDirs(r),this.data.set(r,{type:"symlink",target:e,mode:511,mtime:new Date})}async link(e,t){Gt(e,"link"),Gt(t,"link");let r=Be(e),n=Be(t),i=this.data.get(r);if(!i)throw new Error(`ENOENT: no such file or directory, link '${e}'`);if(i.type!=="file")throw new Error(`EPERM: operation not permitted, link '${e}'`);if(this.data.has(n))throw new Error(`EEXIST: file already exists, link '${t}'`);let a=i;"lazy"in a&&(a=await this.materializeLazy(r,a)),this.ensureParentDirs(n);let s={type:"file",content:a.content,mode:a.mode,mtime:a.mtime};this.entryIdentities.set(s,this.identityFor(a)),this.setEntry(n,s)}async readlink(e){Gt(e,"readlink");let t=Be(e),r=this.data.get(t);if(!r)throw new Error(`ENOENT: no such file or directory, readlink '${e}'`);if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${e}'`);return r.target}async realpath(e){Gt(e,"realpath");let t=this.resolvePathWithSymlinks(e);if(!this.data.has(t))throw new Error(`ENOENT: no such file or directory, realpath '${e}'`);return t}async utimes(e,t,r){Gt(e,"utimes");let n=Be(e),i=this.resolvePathWithSymlinks(n),a=this.data.get(i);if(!a)throw new Error(`ENOENT: no such file or directory, utimes '${e}'`);a.mtime=r}},hF="5.1.0(1)-release",mF="Linux version 5.15.0-generic (just-bash) #1 SMP PREEMPT";function G3(e){let{pid:t,ppid:r,uid:n,gid:i}=e;return`Name: bash State: R (running) Pid: ${t} PPid: ${r} Uid: ${n} ${n} ${n} ${n} Gid: ${i} ${i} ${i} ${i} `}function gF(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function xF(e,t){e.mkdirSync("/bin",{recursive:!0}),e.mkdirSync("/usr/bin",{recursive:!0}),t&&(e.mkdirSync("/home/user",{recursive:!0}),e.mkdirSync("/tmp",{recursive:!0}))}function yF(e){e.mkdirSync("/dev",{recursive:!0}),e.mkdirSync("/dev/fd",{recursive:!0}),e.writeFileSync("/dev/null",""),e.writeFileSync("/dev/zero",new Uint8Array(0)),e.writeFileSync("/dev/stdin",""),e.writeFileSync("/dev/stdout",""),e.writeFileSync("/dev/stderr","")}function bF(e,t){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${mF} `),e.writeFileSync("/proc/self/exe","/bin/bash"),e.writeFileSync("/proc/self/cmdline","bash\0"),e.writeFileSync("/proc/self/comm",`bash `),e.writeFileLazy?e.writeFileLazy("/proc/self/status",()=>G3(t)):e.writeFileSync("/proc/self/status",G3(t)),e.writeFileSync("/proc/self/fd/0","/dev/stdin"),e.writeFileSync("/proc/self/fd/1","/dev/stdout"),e.writeFileSync("/proc/self/fd/2","/dev/stderr")}function wF(e,t,r={pid:1,ppid:0,uid:1e3,gid:1e3}){if(gF(e)){let n=vF(e);xF(n,t),yF(n),bF(n,r)}}function vF(e){let t=n=>{try{n()}catch(i){if(!(i instanceof Error&&i.message.startsWith("ENOSYS")))throw i}},r={mkdirSync:(n,i)=>t(()=>e.mkdirSync(n,i)),writeFileSync:(n,i)=>t(()=>e.writeFileSync(n,i))};return e.writeFileLazy&&(r.writeFileLazy=(n,i)=>t(()=>e.writeFileLazy?.(n,i))),r}ge();dw();vl();var US=class{baseFs;mounts=new Map;constructor(e){if(this.baseFs=e?.base??new Hs,e?.mounts)for(let{mountPoint:t,filesystem:r}of e.mounts)this.mount(t,r)}mount(e,t){this.validateMountPath(e);let r=Be(e);this.validateMount(r),this.mounts.set(r,t)}unmount(e){let t=Be(e);if(!this.mounts.has(t))throw new Error(`No filesystem mounted at '${e}'`);this.mounts.delete(t)}getMounts(){return Array.from(this.mounts,([e,t])=>({mountPoint:e,filesystem:t}))}isMountPoint(e){let t=Be(e);return this.mounts.has(t)}validateMountPath(e){let t=e.split("/");for(let r of t)if(r==="."||r==="..")throw new Error(`Invalid mount point '${e}': contains '.' or '..' segments`)}validateMount(e){if(e==="/")throw new Error("Cannot mount at root '/'");for(let t of this.mounts.keys())if(t!==e){if(e.startsWith(`${t}/`))throw new Error(`Cannot mount at '${e}': inside existing mount '${t}'`);if(t.startsWith(`${e}/`))throw new Error(`Cannot mount at '${e}': would contain existing mount '${t}'`)}}routePath(e){Gt(e,"access");let t=Be(e);for(let[r,n]of this.mounts){if(t===r)return{fs:n,relativePath:"/"};if(t.startsWith(`${r}/`))return{fs:n,relativePath:t.slice(r.length)}}return{fs:this.baseFs,relativePath:t}}getChildMountPoints(e){let t=Be(e),r=t==="/"?"/":`${t}/`,n=[];for(let i of this.mounts.keys())if(i.startsWith(r)){let a=i.slice(r.length).split("/")[0];a&&!n.includes(a)&&n.push(a)}return n}async readFile(e,t){let{fs:r,relativePath:n}=this.routePath(e);return r.readFile(n,t)}async readFileBytes(e){let{fs:t,relativePath:r}=this.routePath(e);return Mi(t,r)}async readFileBuffer(e){let{fs:t,relativePath:r}=this.routePath(e);return t.readFileBuffer(r)}async writeFile(e,t,r){let{fs:n,relativePath:i}=this.routePath(e);return n.writeFile(i,t,r)}async appendFile(e,t,r){let{fs:n,relativePath:i}=this.routePath(e);return n.appendFile(i,t,r)}async exists(e){let t=Be(e);if(this.mounts.has(t)||this.getChildMountPoints(t).length>0)return!0;let{fs:r,relativePath:n}=this.routePath(e);return r.exists(n)}async stat(e){let t=Be(e),r=this.mounts.get(t);if(r)try{return await r.stat("/")}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}if(this.getChildMountPoints(t).length>0)try{return await this.baseFs.stat(t)}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}let{fs:n,relativePath:i}=this.routePath(e);return n.stat(i)}async lstat(e){let t=Be(e),r=this.mounts.get(t);if(r)try{return await r.lstat("/")}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}if(this.getChildMountPoints(t).length>0)try{return await this.baseFs.lstat(t)}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}let{fs:n,relativePath:i}=this.routePath(e);return n.lstat(i)}async mkdir(e,t){let r=Be(e);if(this.mounts.has(r)){if(t?.recursive)return;throw new Error(`EEXIST: directory already exists, mkdir '${e}'`)}if(this.getChildMountPoints(r).length>0&&t?.recursive)return;let{fs:n,relativePath:i}=this.routePath(e);return n.mkdir(i,t)}async createExclusive(e,t){let r=Be(e),n=t.directory?"mkdir":"open";if(this.mounts.has(r))throw new Error(`EEXIST: file already exists, ${n} '${e}'`);let{fs:i,relativePath:a}=this.routePath(e);if(!i.createExclusive)throw new d0(e,n);let s=Ua(a);return s!=="/"&&this.getChildMountPoints(Ua(r)).length>0&&!await i.exists(s)&&await i.mkdir(s,{recursive:!0}),i.createExclusive(a,t)}mkdirSync(e,t){let{fs:r,relativePath:n}=this.routePath(e),i=r;if(!i.mkdirSync)throw new Error(`ENOSYS: function not implemented, mkdir '${e}'`);i.mkdirSync(n,t)}writeFileSync(e,t){let{fs:r,relativePath:n}=this.routePath(e),i=r;if(!i.writeFileSync)throw new Error(`ENOSYS: function not implemented, write '${e}'`);i.writeFileSync(n,t)}async readdir(e){let t=Be(e),r=new Set,n=null,{fs:i,relativePath:a}=this.routePath(e);try{let o=await i.readdir(a);for(let l of o)r.add(l)}catch(o){let l=o.code,u=o.message||"";if(l!=="ENOENT"&&!u.includes("ENOENT"))throw o;n=o}let s=this.getChildMountPoints(t);for(let o of s)r.add(o);if(r.size===0&&n&&!this.mounts.has(t))throw n;return Array.from(r).sort()}async rm(e,t){let r=Be(e);if(this.mounts.has(r))throw new Error(`EBUSY: mount point, cannot remove '${e}'`);if(this.getChildMountPoints(r).length>0)throw new Error(`EBUSY: contains mount points, cannot remove '${e}'`);let{fs:n,relativePath:i}=this.routePath(e);return n.rm(i,t)}async cp(e,t,r){if((await this.stat(e)).isDirectory&&ja(e,t))throw new Error(`EINVAL: cannot copy '${e}' into itself, '${t}'`);let n=this.routePath(e),i=this.routePath(t);return n.fs===i.fs?n.fs.cp(n.relativePath,i.relativePath,r):this.crossMountCopy(e,t,r)}async mv(e,t){let r=Be(e);if((await this.stat(e)).isDirectory&&ja(e,t))throw new Error(`EINVAL: cannot move '${e}' into itself, '${t}'`);if(this.mounts.has(r))throw new Error(`EBUSY: mount point, cannot move '${e}'`);let n=this.routePath(e),i=this.routePath(t);if(n.fs===i.fs)return n.fs.mv(n.relativePath,i.relativePath);await this.cp(e,t,{recursive:!0}),await this.rm(e,{recursive:!0})}resolvePath(e,t){return ew(e,t)}getAllPaths(){let e=new Set;for(let t of this.baseFs.getAllPaths())e.add(t);for(let[t,r]of this.mounts){let n=t.split("/").filter(Boolean),i="";for(let a of n)i=`${i}/${a}`,e.add(i);for(let a of r.getAllPaths())a==="/"?e.add(t):e.add(`${t}${a}`)}return Array.from(e).sort()}async chmod(e,t){let r=Be(e),n=this.mounts.get(r);if(n)return n.chmod("/",t);let{fs:i,relativePath:a}=this.routePath(e);return i.chmod(a,t)}async symlink(e,t){let{fs:r,relativePath:n}=this.routePath(t);return r.symlink(e,n)}async link(e,t){let r=this.routePath(e),n=this.routePath(t);if(r.fs!==n.fs)throw new Error(`EXDEV: cross-device link not permitted, link '${e}' -> '${t}'`);return r.fs.link(r.relativePath,n.relativePath)}async readlink(e){let{fs:t,relativePath:r}=this.routePath(e);return t.readlink(r)}async realpath(e){let t=Be(e);if(this.mounts.has(t))return t;let{fs:r,relativePath:n}=this.routePath(e),i=await r.realpath(n);for(let a of this.mounts.keys())if(t===a||t.startsWith(`${a}/`))return i==="/"?a:`${a}${i}`;return i}async crossMountCopy(e,t,r){let n=await this.lstat(e);if(n.isFile){let i=await this.readFileBuffer(e);await this.writeFile(t,i),await this.chmod(t,n.mode)}else if(n.isDirectory){if(!r?.recursive)throw new Error(`cp: ${e} is a directory (not copied)`);await this.mkdir(t,{recursive:!0});let i=await this.readdir(e);for(let a of i){let s=Mn(e,a),o=Mn(t,a);await this.crossMountCopy(s,o,r)}}else if(n.isSymbolicLink){let i=await this.readlink(e);await this.symlink(i,t)}}async utimes(e,t,r){let{fs:n,relativePath:i}=this.routePath(e);return n.utimes(i,t,r)}};Nn();ia();J();ge();J();function Di(e){return{kind:e.kind,elements:new Map(e.elements)}}function Ys(e){return new Map(Array.from(e??[],([t,r])=>[t,Di(r)]))}function sn(e,t){return e.state.arrays?.get(t)}function fp(e,t,r="indexed"){e.state.arrays??=new Map;let n=e.state.arrays.get(t);return n||(n={kind:r,elements:new Map},e.state.arrays.set(t,n)),n}function Ps(e,t,r){let n=fp(e,t,r);return n.kind=r,n}function Hn(e,t){return e.state.arrays?.has(t)??!1}function Nt(e,t,r){return sn(e,t)?.elements.get(String(r))}function Fs(e,t,r){return sn(e,t)?.elements.has(String(r))??!1}function je(e,t,r,n,i){let a=fp(e,t,i),s=String(r);if(!a.elements.has(s)&&a.elements.size>=e.limits.maxArrayElements)throw new T(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(K(n)>e.limits.maxStringLength)throw new T(`array value string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");a.elements.set(s,n)}function pl(e,t,r,n=!1){let i=new Set(n?[]:sn(e,t)?.elements.keys()??[]);for(let a of r)if(i.add(String(a)),i.size>e.limits.maxArrayElements)throw new T(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements")}function As(e,t,r){return sn(e,t)?.elements.delete(String(r))??!1}function qu(e,t){e.state.arrays?.delete(t),e.state.associativeArrays?.delete(t)}function Vr(e,t){return Array.from(sn(e,t)?.elements.keys()??[]).filter(r=>/^(0|[1-9]\d*)$/.test(r)).map(Number).sort((r,n)=>r-n)}function an(e,t){fp(e,t,e.state.associativeArrays?.has(t)?"associative":"indexed").elements.clear()}function Js(e,t){return Array.from(sn(e,t)?.elements.keys()??[]).sort()}function M0(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function zS(e){if(e.parts.length<2)return null;let t=e.parts[0],r=e.parts[1];if(t.type!=="Glob"||!t.pattern.startsWith("["))return null;let n,i=r,a=1;if(r.type==="Literal"&&r.value.startsWith("]")){let p=r.value.slice(1);if(p.startsWith("+=")||p.startsWith("="))n=t.pattern.slice(1);else if(p===""){if(e.parts.length<3)return null;let d=e.parts[2];if(d.type!=="Literal"||!d.value.startsWith("=")&&!d.value.startsWith("+="))return null;n=t.pattern.slice(1),i=d,a=2}else return null}else if(t.pattern==="["&&(r.type==="DoubleQuoted"||r.type==="SingleQuoted")){if(e.parts.length<3)return null;let p=e.parts[2];if(p.type!=="Literal"||!p.value.startsWith("]=")&&!p.value.startsWith("]+="))return null;if(r.type==="SingleQuoted")n=r.value;else{n="";for(let d of r.parts)(d.type==="Literal"||d.type==="Escaped")&&(n+=d.value)}i=p,a=2}else if(t.pattern.endsWith("]")){if(r.type!=="Literal"||!r.value.startsWith("=")&&!r.value.startsWith("+="))return null;n=t.pattern.slice(1,-1)}else return null;n=M0(n);let s;if(i.type!=="Literal")return null;i.value.startsWith("]=")||i.value.startsWith("]+=")?s=i.value.slice(1):s=i.value;let o=s.startsWith("+=");if(!o&&!s.startsWith("="))return null;let l=[],u=o?2:1,c=s.slice(u);c&&l.push({type:"Literal",value:c});for(let p=a+1;p{if(t.type==="Range"){let r=t.startStr??String(t.start),n=t.endStr??String(t.end),i=`${r}..${n}`;return t.step&&(i+=`..${t.step}`),i}return dp(t.word)}).join(",")}}`}function dp(e){let t="";for(let r of e.parts)switch(r.type){case"Literal":t+=r.value;break;case"Glob":t+=r.pattern;break;case"SingleQuoted":t+=r.value;break;case"DoubleQuoted":for(let n of r.parts)(n.type==="Literal"||n.type==="Escaped")&&(t+=n.value);break;case"Escaped":t+=r.value;break;case"BraceExpansion":t+="{",t+=r.items.map(n=>n.type==="Range"?`${n.startStr}..${n.endStr}${n.step?`..${n.step}`:""}`:dp(n.word)).join(","),t+="}";break;case"TildeExpansion":t+="~",r.user&&(t+=r.user);break}return t}var SF=["allexport","errexit","noglob","noclobber","noexec","nounset","pipefail","posix","verbose","xtrace"],AF=["braceexpand","hashall","interactive-comments"];function T1(e){let t=[],r=[...AF.map(n=>({name:n,enabled:!0})),...SF.map(n=>({name:n,enabled:e[n]}))].sort((n,i)=>n.name.localeCompare(i.name));for(let n of r)n.enabled&&t.push(n.name);return t.join(":")}function Dc(e){e.state.env.set("SHELLOPTS",T1(e.state.options))}var CF=["dotglob","expand_aliases","extglob","failglob","globskipdots","globstar","lastpipe","nocaseglob","nocasematch","nullglob","xpg_echo"];function _1(e){let t=[];for(let r of CF)e[r]&&t.push(r);return t.join(":")}function V3(e){e.state.env.set("BASHOPTS",_1(e.state.shoptOptions))}ge();kl();ia();var le={script(e){return{type:"Script",statements:e}},statement(e,t=[],r=!1,n,i){let a={type:"Statement",pipelines:e,operators:t,background:r};return n&&(a.deferredError=n),i!==void 0&&(a.sourceText=i),a},pipeline(e,t=!1,r=!1,n=!1,i){return{type:"Pipeline",commands:e,negated:t,timed:r,timePosix:n,pipeStderr:i}},simpleCommand(e,t=[],r=[],n=[]){return{type:"SimpleCommand",name:e,args:t,assignments:r,redirections:n}},word(e){return{type:"Word",parts:e}},literal(e){return{type:"Literal",value:e}},singleQuoted(e){return{type:"SingleQuoted",value:e}},doubleQuoted(e){return{type:"DoubleQuoted",parts:e}},escaped(e){return{type:"Escaped",value:e}},parameterExpansion(e,t=null){return{type:"ParameterExpansion",parameter:e,operation:t}},commandSubstitution(e,t=!1){return{type:"CommandSubstitution",body:e,legacy:t}},arithmeticExpansion(e){return{type:"ArithmeticExpansion",expression:e}},processSubstitution(e,t){return{type:"ProcessSubstitution",body:e,direction:t}},assignment(e,t,r=!1,n=null){return{type:"Assignment",name:e,value:t,append:r,array:n}},redirection(e,t,r=null,n){let i={type:"Redirection",fd:r,operator:e,target:t};return n&&(i.fdVariable=n),i},hereDoc(e,t,r=!1,n=!1,i){let a={type:"HereDoc",delimiter:e,content:t,stripTabs:r,quoted:n};return i!==void 0&&(a.terminated=i),a},ifNode(e,t=null,r=[]){return{type:"If",clauses:e,elseBody:t,redirections:r}},forNode(e,t,r,n=[]){return{type:"For",variable:e,words:t,body:r,redirections:n}},whileNode(e,t,r=[]){return{type:"While",condition:e,body:t,redirections:r}},untilNode(e,t,r=[]){return{type:"Until",condition:e,body:t,redirections:r}},caseNode(e,t,r=[]){return{type:"Case",word:e,items:t,redirections:r}},caseItem(e,t,r=";;"){return{type:"CaseItem",patterns:e,body:t,terminator:r}},subshell(e,t=[]){return{type:"Subshell",body:e,redirections:t}},group(e,t=[]){return{type:"Group",body:e,redirections:t}},functionDef(e,t,r=[],n){return{type:"FunctionDef",name:e,body:t,redirections:r,sourceFile:n}},conditionalCommand(e,t=[],r){return{type:"ConditionalCommand",expression:e,redirections:t,line:r}},arithmeticCommand(e,t=[],r){return{type:"ArithmeticCommand",expression:e,redirections:t,line:r}}};function kF(e,t){let r=e.length,n=t+3,i=2,a=!1,s=!1;for(;n0;){let o=e[n];if(a){o==="'"&&(a=!1),n++;continue}if(s){if(o==="\\"){n+=2;continue}o==='"'&&(s=!1),n++;continue}if(o==="'"){a=!0,n++;continue}if(o==='"'){s=!0,n++;continue}if(o==="\\"){n+=2;continue}if(o==="("){i++,n++;continue}if(o===")"){if(i--,i===1){let l=n+1;return!(ll===" "||l===" "||l===` `||l===";"||l==="&"||l==="|"||l==="<"||l===">"||l==="("||l===")";for(;n0;for(u||(a=!0),u&&(r+=l),n++;n0;for(u||(a=!0),u&&(r+=l),n++;n0){r+=e.slice(n,n+2),n+=2;continue}a=!0;let u=e[n+1];u!==` `&&(r+=u),n+=2;continue}if(i===0&&(l==="$"||l==="<"||l===">")&&e[n+1]==="("){r+=`${l}(`,i=1,n+=2;continue}if(i===0&&o(l))break;i>0&&(l==="("?i++:l===")"&&i--),r+=l,n++}return{delim:r,endPos:n,quoted:a,unclosedQuote:s,unclosedSubstitution:i>0}}function NF(e,t,r){let n=t+1;for(let{delim:i,stripTabs:a}of r)for(;;){if(n>=e.length)return e.length;let s=e.indexOf(` `,n);s===-1&&(s=e.length);let o=e.slice(n,s);if(a&&(o=o.replace(/^\t+/,"")),o===i){n=s+1;break}if(s>=e.length)return e.length;n=s+1}return Math.min(n,e.length)}function qS(e,t,r){let n=1,i=t,a=!1,s=!1,o=0,l=!1,u="",c=[],p=0;for(;i0;){let d=e[i];if(a)d==="'"&&(a=!1);else if(s)d==="\\"&&i+10&&p--,p===0&&d==="<"&&e[i+1]==="<"&&e[i+2]!=="<"){let f=i+2,h=!1;for(e[f]==="-"&&(h=!0,f++);e[f]===" "||e[f]===" ";)f++;let{delim:m,endPos:g,unclosedQuote:x,unclosedSubstitution:y}=O1(e,f);if(x&&r(`unexpected EOF while looking for matching \`${x}'`),y&&r("unexpected EOF while looking for matching `)'"),m.length>0){c.push({delim:m,stripTabs:h}),u="",i=g;continue}}if(d===` `&&c.length>0){let f=NF(e,i,c);c.length=0,u="",i=f;continue}d==="'"?(a=!0,u=""):d==='"'?(s=!0,u=""):d==="\\"&&i+10?l=!0:u==="esac"&&o>0&&(o--,l=!1),u="",d==="("?i>0&&e[i-1]==="$"?n++:l||n++:d===")"?l?l=!1:n--:d===";"&&o>0&&i+10&&i++}return n>0&&r("unexpected EOF while looking for matching `)'"),i}function TF(e,t,r,n){let i=t+2,a=qS(e,i,n),s=e.slice(i,a),o=r().parse(s);return{part:le.commandSubstitution(o,!1),endIndex:a+1}}function _F(e,t,r,n){let i=e[t]==="<"?"input":"output",a=t+2,s=qS(e,a,n),o=r().parse(e.slice(a,s));return{part:le.processSubstitution(o,i),endIndex:s+1}}function OF(e,t,r,n,i){let a=t+1,s="";for(;a=e.length&&i("unexpected EOF while looking for matching ``'");let o=n().parse(s);return{part:le.commandSubstitution(o,!0),endIndex:a+1}}var IF=10485760,N;(function(e){e.EOF="EOF",e.NEWLINE="NEWLINE",e.SEMICOLON="SEMICOLON",e.AMP="AMP",e.PIPE="PIPE",e.PIPE_AMP="PIPE_AMP",e.AND_AND="AND_AND",e.OR_OR="OR_OR",e.BANG="BANG",e.LESS="LESS",e.GREAT="GREAT",e.DLESS="DLESS",e.DGREAT="DGREAT",e.LESSAND="LESSAND",e.GREATAND="GREATAND",e.LESSGREAT="LESSGREAT",e.DLESSDASH="DLESSDASH",e.CLOBBER="CLOBBER",e.TLESS="TLESS",e.AND_GREAT="AND_GREAT",e.AND_DGREAT="AND_DGREAT",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.DSEMI="DSEMI",e.SEMI_AND="SEMI_AND",e.SEMI_SEMI_AND="SEMI_SEMI_AND",e.DBRACK_START="DBRACK_START",e.DBRACK_END="DBRACK_END",e.DPAREN_START="DPAREN_START",e.DPAREN_END="DPAREN_END",e.IF="IF",e.THEN="THEN",e.ELSE="ELSE",e.ELIF="ELIF",e.FI="FI",e.FOR="FOR",e.WHILE="WHILE",e.UNTIL="UNTIL",e.DO="DO",e.DONE="DONE",e.CASE="CASE",e.ESAC="ESAC",e.IN="IN",e.FUNCTION="FUNCTION",e.SELECT="SELECT",e.TIME="TIME",e.COPROC="COPROC",e.WORD="WORD",e.NAME="NAME",e.NUMBER="NUMBER",e.ASSIGNMENT_WORD="ASSIGNMENT_WORD",e.FD_VARIABLE="FD_VARIABLE",e.COMMENT="COMMENT",e.HEREDOC_CONTENT="HEREDOC_CONTENT"})(N||(N={}));var si=class extends Error{line;column;constructor(e,t,r){super(`line ${t}: ${e}`),this.line=t,this.column=r,this.name="LexerError"}},I1=new Map([["if",N.IF],["then",N.THEN],["else",N.ELSE],["elif",N.ELIF],["fi",N.FI],["for",N.FOR],["while",N.WHILE],["until",N.UNTIL],["do",N.DO],["done",N.DONE],["case",N.CASE],["esac",N.ESAC],["in",N.IN],["function",N.FUNCTION],["select",N.SELECT],["time",N.TIME],["coproc",N.COPROC]]),$F=new Set(I1.values());function Z3(e){return $F.has(e)}function X3(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return!1;let r=e.slice(t[0].length);if(r===""||r==="+")return!0;if(r[0]==="["){let n=0,i=0;for(;i=r.length)return!1;let a=r.slice(i+1);return a===""||a==="+"}return!1}function Q3(e){let t=0;for(let r=0;r",">",N.AND_DGREAT]],RF=[["[","[",N.DBRACK_START],["]","]",N.DBRACK_END],["(","(",N.DPAREN_START],[")",")",N.DPAREN_END],["&","&",N.AND_AND],["|","|",N.OR_OR],[";",";",N.DSEMI],[";","&",N.SEMI_AND],["|","&",N.PIPE_AMP],[">",">",N.DGREAT],["<","&",N.LESSAND],[">","&",N.GREATAND],["<",">",N.LESSGREAT],[">","|",N.CLOBBER],["&",">",N.AND_GREAT]],LF=new Map([["|",N.PIPE],["&",N.AMP],[";",N.SEMICOLON],["(",N.LPAREN],[")",N.RPAREN],["<",N.LESS],[">",N.GREAT]]);function MF(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function K3(e){return e===" "||e===" "||e===` `||e===";"||e==="&"||e==="|"||e==="("||e===")"||e==="<"||e===">"}var PF=class{input;pos=0;line=1;column=1;tokens=[];pendingHeredocs=[];pendingHeredocDelimiterMode;dparenDepth=0;maxHeredocSize;constructor(e,t){this.input=e,this.maxHeredocSize=t?.maxHeredocSize??IF}tokenize(){let e=this.input.length,t=this.tokens,r=this.pendingHeredocs;for(;this.pos0&&t.length>0&&t[t.length-1].type===N.NEWLINE){this.readHeredocContent();continue}if(this.skipWhitespace(),this.pos>=e)break;let n=this.nextToken();n&&t.push(n)}return r.length>0&&this.readHeredocContent(),t.push({type:N.EOF,value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),t}skipWhitespace(){let e=this.input,t=e.length,r=this.pos,n=this.column,i=this.line;for(;r0?(this.pos=t+1,this.column=n+1,this.dparenDepth++,this.makeToken(N.LPAREN,"(",t,r,n)):this.looksLikeNestedSubshells(t+2)||this.dparenClosesWithSpacedParens(t+2)?(this.pos=t+1,this.column=n+1,this.makeToken(N.LPAREN,"(",t,r,n)):(this.pos=t+2,this.column=n+2,this.dparenDepth=1,this.makeToken(N.DPAREN_START,"((",t,r,n))}if(i===")"&&a===")")return this.dparenDepth===1?(this.pos=t+2,this.column=n+2,this.dparenDepth=0,this.makeToken(N.DPAREN_END,"))",t,r,n)):this.dparenDepth>1?(this.pos=t+1,this.column=n+1,this.dparenDepth--,this.makeToken(N.RPAREN,")",t,r,n)):(this.pos=t+1,this.column=n+1,this.makeToken(N.RPAREN,")",t,r,n));for(let[u,c,p]of RF)if(!(u==="("&&c==="("||u===")"&&c===")")&&!(this.dparenDepth>0&&u===";"&&(p===N.DSEMI||p===N.SEMI_AND||p===N.SEMI_SEMI_AND))&&i===u&&a===c){if(p===N.DBRACK_START||p===N.DBRACK_END){let d=e[t+2];if(d!==void 0&&d!==" "&&d!==" "&&d!==` `&&d!==";"&&d!=="&"&&d!=="|"&&d!=="("&&d!==")"&&d!=="<"&&d!==">")break}return this.pos=t+2,this.column=n+2,this.makeToken(p,u+c,t,r,n)}if(i==="("&&this.dparenDepth>0)return this.pos=t+1,this.column=n+1,this.dparenDepth++,this.makeToken(N.LPAREN,"(",t,r,n);if(i===")"&&this.dparenDepth>1)return this.pos=t+1,this.column=n+1,this.dparenDepth--,this.makeToken(N.RPAREN,")",t,r,n);let l=LF.get(i);if(l!==void 0)return this.pos=t+1,this.column=n+1,this.makeToken(l,i,t,r,n);if(i==="{"){let u=this.scanFdVariable(t);return u!==null?(this.pos=u.end,this.column=n+(u.end-t),{type:N.FD_VARIABLE,value:u.varname,start:t,end:u.end,line:r,column:n}):a==="}"?(this.pos=t+2,this.column=n+2,{type:N.WORD,value:"{}",start:t,end:t+2,line:r,column:n,quoted:!1,singleQuoted:!1}):this.scanBraceExpansion(t)!==null?this.readWordWithBraceExpansion(t,r,n):this.scanLiteralBraceWord(t)!==null?this.readWordWithBraceExpansion(t,r,n):a!==void 0&&a!==" "&&a!==" "&&a!==` `?this.readWord(t,r,n):(this.pos=t+1,this.column=n+1,this.makeToken(N.LBRACE,"{",t,r,n))}return i==="}"?this.isWordCharFollowing(t+1)?this.readWord(t,r,n):(this.pos=t+1,this.column=n+1,this.makeToken(N.RBRACE,"}",t,r,n)):i==="!"?a==="="?(this.pos=t+2,this.column=n+2,this.makeToken(N.WORD,"!=",t,r,n)):(this.pos=t+1,this.column=n+1,this.makeToken(N.BANG,"!",t,r,n)):this.readWord(t,r,n)}looksLikeNestedSubshells(e){let t=this.input,r=t.length,n=e;for(;n=r)return!1;let i=t[n];if(i==="(")return this.looksLikeNestedSubshells(n+1);let a=/[a-zA-Z_]/.test(i),s=i==="!"||i==="[";if(!a&&!s)return!1;let o=n;for(;o=r)return!1;let u=t[l];if(u==="="&&t[l+1]!=="="||u===` `||o===l&&/[+\-*/%<>&|^!~?:]/.test(u)&&u!=="-"||u===")"&&t[l+1]===")")return!1;if(l>o&&(u==="-"||u==='"'||u==="'"||u==="$"||/[a-zA-Z_/.]/.test(u))){let c=l;for(;c"||y==="'"||y==='"'||y==="\\"||y==="$"||y==="`"||y==="{"||y==="}"||y==="~"||y==="*"||y==="?"||y==="[")break;a++}if(a>s){let y=n[a];if(!(y==="("&&a>s&&"@*+?!".includes(n[a-1]))&&(a>=i||y===" "||y===" "||y===` `||y===";"||y==="&"||y==="|"||y==="("||y===")"||y==="<"||y===">")){let b=n.slice(s,a);this.pos=a,this.column=r+(a-s);let k=I1.get(b);if(k!==void 0)return{type:k,value:b,start:e,end:a,line:t,column:r};let w=Q3(b);return w>0&&X3(b.slice(0,w))?{type:N.ASSIGNMENT_WORD,value:b,start:e,end:a,line:t,column:r}:/^[0-9]+$/.test(b)?{type:N.NUMBER,value:b,start:e,end:a,line:t,column:r}:/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(b)?{type:N.NAME,value:b,start:e,end:a,line:t,column:r,quoted:!1,singleQuoted:!1}:{type:N.WORD,value:b,start:e,end:a,line:t,column:r,quoted:!1,singleQuoted:!1}}}a=this.pos;let o=this.column,l=this.line,u="",c=!1,p=!1,d=!1,f=!1,h=n[a]==='"'||n[a]==="'",m=!1,g=0;for(;a0&&"@*+?!".includes(u[u.length-1])){let b=this.scanExtglobPattern(a);if(b!==null){u+=b.content,a=b.end,o+=b.content.length;continue}}if(y==="["&&g===0){if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){let b=a+10){u.length>0&&u[u.length-1]!=="\\"&&g++,u+=y,a++,o++;continue}else if(y==="]"&&g>0){u.length>0&&u[u.length-1]!=="\\"&&g--,u+=y,a++,o++;continue}if(g>0){if(y===` `)break;u+=y,a++,o++;continue}if(y===" "||y===" "||y===` `||y===";"||y==="&"||y==="|"||y==="("||y===")"||y==="<"||y===">")break}if(y==="$"&&a+10&&a0&&_--,_===0&&M==="<"&&n[a+1]==="<"&&n[a+2]!=="<"){let P=a+2,S=!1;for(n[P]==="-"&&(S=!0,P++);n[P]===" "||n[P]===" ";)P++;let{delim:D,endPos:W,unclosedQuote:j,unclosedSubstitution:U}=O1(n,P);if(j)throw new si(`unexpected EOF while looking for matching \`${j}'`,l,o);if(U)throw new si("unexpected EOF while looking for matching `)'",l,o);if(D.length>0){u+=n.slice(a+1,W),o+=W-a,I.push({delim:D,stripTabs:S}),a=W;continue}}if(M===` `&&I.length>0){l++,o=0;let P=a+1;for(let{delim:S,stripTabs:D}of I)for(;!(P>=i);){let W=n.indexOf(` `,P);W===-1&&(W=i);let j=n.slice(P,W),U=D?j.replace(/^\t+/,""):j;u+=n.slice(P,Math.min(W+1,i)),W=i;if(P=W+1,U===S||H)break}I.length=0,o=0,a=Math.min(P,i);continue}if(M==="'")k=!0,R="";else if(M==='"')w=!0,R="";else if(M==="\\"&&a+10&&a0?A=!0:R==="esac"&&v>0&&(v--,A=!1),R="",M==="("?a>0&&n[a-1]==="$"?b++:A||b++:M===")"?A?A=!1:b--:M===";"&&v>0&&(a+10&&a0&&a="0"&&b<="9"){u+=y+b,a+=2,o+=2;continue}}if(y==="`"&&!d){for(u+=y,a++,o++;a=2){if(u[0]==="'"&&u[u.length-1]==="'"){let y=u.slice(1,-1);!y.includes("'")&&!y.includes('"')&&(u=y,c=!0,p=!0)}else if(u[0]==='"'&&u[u.length-1]==='"'){let y=u.slice(1,-1),b=!1;for(let k=0;k0&&X3(u.slice(0,y)))return{type:N.ASSIGNMENT_WORD,value:u,start:e,end:a,line:t,column:r,quoted:c,singleQuoted:p}}return/^[0-9]+$/.test(u)?{type:N.NUMBER,value:u,start:e,end:a,line:t,column:r}:MF(u)?{type:N.NAME,value:u,start:e,end:a,line:t,column:r,quoted:c,singleQuoted:p}:{type:N.WORD,value:u,start:e,end:a,line:t,column:r,quoted:c,singleQuoted:p}}readHeredocContent(){for(;this.pendingHeredocs.length>0;){let e=this.pendingHeredocs.shift();if(!e)break;let t=this.pos,r=this.line,n=this.column,i="",a=!1;for(;this.pos=this.input.length)break;l=l.slice(0,-1),o+=`${s} `,this.pos++,this.line++,this.column=1}if((e.stripTabs?l.replace(/^\t+/,""):l)===e.delimiter){a=!0,this.pos0&&(i+=` `),i.length>this.maxHeredocSize)throw new si(`Heredoc size limit exceeded (${this.maxHeredocSize} bytes)`,r,n)}this.tokens.push({type:N.HEREDOC_CONTENT,value:i,start:t,end:this.pos,line:r,column:n,heredocTerminated:a})}}readHeredocDelimiterToken(e,t,r,n){let i=this.input,{delim:a,endPos:s,quoted:o,unclosedQuote:l,unclosedSubstitution:u}=O1(i,e);if(l)throw new si(`unexpected EOF while looking for matching \`${l}'`,t,r);if(u)throw new si("unexpected EOF while looking for matching `)'",t,r);if(s===e)throw new si("Expected here-document delimiter",t,r);let c=t,p=r;for(let d=e;d=this.input.length)return!1;let t=this.input[e];return!(t===" "||t===" "||t===` `||t===";"||t==="&"||t==="|"||t==="("||t===")"||t==="<"||t===">")}readWordWithBraceExpansion(e,t,r){let n=this.input,i=n.length,a=e,s=r;for(;a")break;if(l==="{"){if(this.scanBraceExpansion(a)!==null){let u=1;for(a++,s++;a0;)n[a]==="{"?u++:n[a]==="}"&&u--,a++,s++;continue}a++,s++;continue}if(l==="}"){a++,s++;continue}if(l==="$"&&a+10&&a0&&a0;){let o=t[n];if(o==="{")i++,n++;else if(o==="}")i--,n++;else if(o===","&&i===1)a=!0,n++;else if(o==="."&&n+10;){let a=t[n];if(a==="{")i++,n++;else if(a==="}"){if(i--,i===0)return t.slice(e,n+1);n++}else{if(a===" "||a===" "||a===` `||a===";"||a==="&"||a==="|")return null;n++}}return null}scanExtglobPattern(e){let t=this.input,r=t.length,n=e+1,i=1;for(;n0;){let a=t[n];if(a==="\\"&&n+1="a"&&l<="z"||l>="A"&&l<="Z"||l==="_"))return null}else if(!(l>="a"&&l<="z"||l>="A"&&l<="Z"||l>="0"&&l<="9"||l==="_"))break;n++}if(n===i)return null;let a=t.slice(i,n);if(n>=r||t[n]!=="}"||(n++,n>=r))return null;let s=t[n],o=n+1"||s==="<"||s==="&"&&(o===">"||o==="<")?{varname:a,end:n}:null}dollarDparenIsSubshell(e){let t=this.input,r=t.length,n=e+1,i=2,a=!1,s=!1,o=!1;for(;n0;){let l=t[n];if(a){l==="'"&&(a=!1),l===` `&&(o=!0),n++;continue}if(s){if(l==="\\"){n+=2;continue}l==='"'&&(s=!1),l===` `&&(o=!0),n++;continue}if(l==="'"){a=!0,n++;continue}if(l==='"'){s=!0,n++;continue}if(l==="\\"){n+=2;continue}if(l===` `&&(o=!0),l==="("){i++,n++;continue}if(l===")"){if(i--,i===1){let u=n+1;if(u0;){let o=t[n];if(a){o==="'"&&(a=!1),n++;continue}if(s){if(o==="\\"){n+=2;continue}o==='"'&&(s=!1),n++;continue}if(o==="'"){a=!0,n++;continue}if(o==='"'){s=!0,n++;continue}if(o==="\\"){n+=2;continue}if(o==="("){i++,n++;continue}if(o===")"){if(i--,i===1){let l=n+1;if(lFF)throw new Sn("Maximum parse iterations exceeded (possible infinite loop)",e,t)}chargeTokens(e,t=1,r=1){if(this.tokens+=e,this.tokens>Rc)throw new Sn(`Too many tokens: cumulative count exceeds limit of ${Rc}`,t,r)}enter(e,t){if(this.depth++,this.depth>J3)throw this.depth--,new Sn(`Maximum parser nesting depth exceeded (${J3})`,e,t);let r=!0;return()=>{r&&(r=!1,this.depth--)}}};ln();ir();J();function Pt(e,t){for(;t>=","&=","|=","^="];function D1(e){if(e.includes("#")){let r=e.split("#");if(r.length!==2)return Number.NaN;let[n,i]=r;if(!/^\d+$/.test(n)||i.length===0)return Number.NaN;let a=Number.parseInt(n,10);if(a<2||a>64)return Number.NaN;let s=0;for(let o of i){let l;if(/[0-9]/.test(o))l=o.charCodeAt(0)-48;else if(/[a-z]/.test(o))l=o.charCodeAt(0)-97+10;else if(/[A-Z]/.test(o))l=o.charCodeAt(0)-65+(a<=36?10:36);else if(o==="@")l=62;else if(o==="_")l=63;else return Number.NaN;if(l>=a)return Number.NaN;if(s=s*a+l,s>Number.MAX_SAFE_INTEGER)return Number.MAX_SAFE_INTEGER}return s}if(e.startsWith("0x")||e.startsWith("0X")){let r=Number.parseInt(e.slice(2),16);return r>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:r}if(e.startsWith("0")&&e.length>1&&/^[0-9]+$/.test(e)){if(/[89]/.test(e))return Number.NaN;let r=Number.parseInt(e,8);return r>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:r}let t=Number.parseInt(e,10);return t>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t}function HF(e,t,r,n){if(r.slice(n,n+3)!=="$((")return null;let i=n+3,a=1,s=i;for(;i0;)r[i]==="("&&r[i+1]==="("?(a++,i+=2):r[i]===")"&&r[i+1]===")"?(a--,a>0&&(i+=2)):i++;let o=r.slice(s,i),{expr:l}=e(t,o,0);return i+=2,{expr:{type:"ArithNested",expression:l},pos:i}}function WF(e,t){if(e.slice(t,t+2)!=="$'")return null;let r=t+2,n="";for(;r=e.length}function Nl(e,t,r){return VF(e,t,r)}function Pa(e,t,r){return e.withDepth(()=>Nl(e,t,r))}function VF(e,t,r){let{expr:n,pos:i}=fl(e,t,r);for(i=Pt(t,i);t[i]===",";){if(i++,Xr(t,i))return Zr(",",i);let{expr:a,pos:s}=fl(e,t,i);n={type:"ArithBinary",operator:",",left:n,right:a},i=Pt(t,s)}return{expr:n,pos:i}}function fl(e,t,r){let{expr:n,pos:i}=ZF(e,t,r);if(i=Pt(t,i),t[i]==="?"){i++;let{expr:a,pos:s}=Pa(e,t,i);if(i=Pt(t,s),t[i]===":"){i++;let{expr:o,pos:l}=Pa(e,t,i);return{expr:{type:"ArithTernary",condition:n,consequent:a,alternate:o},pos:l}}}return{expr:n,pos:i}}function ZF(e,t,r){let{expr:n,pos:i}=e7(e,t,r);for(;i=Pt(t,i),t.slice(i,i+2)==="||";){if(i+=2,Xr(t,i))return Zr("||",i);let{expr:a,pos:s}=e7(e,t,i);n={type:"ArithBinary",operator:"||",left:n,right:a},i=s}return{expr:n,pos:i}}function e7(e,t,r){let{expr:n,pos:i}=t7(e,t,r);for(;i=Pt(t,i),t.slice(i,i+2)==="&&";){if(i+=2,Xr(t,i))return Zr("&&",i);let{expr:a,pos:s}=t7(e,t,i);n={type:"ArithBinary",operator:"&&",left:n,right:a},i=s}return{expr:n,pos:i}}function t7(e,t,r){let{expr:n,pos:i}=r7(e,t,r);for(;i=Pt(t,i),t[i]==="|"&&t[i+1]!=="|";){if(i++,Xr(t,i))return Zr("|",i);let{expr:a,pos:s}=r7(e,t,i);n={type:"ArithBinary",operator:"|",left:n,right:a},i=s}return{expr:n,pos:i}}function r7(e,t,r){let{expr:n,pos:i}=n7(e,t,r);for(;i=Pt(t,i),t[i]==="^";){if(i++,Xr(t,i))return Zr("^",i);let{expr:a,pos:s}=n7(e,t,i);n={type:"ArithBinary",operator:"^",left:n,right:a},i=s}return{expr:n,pos:i}}function n7(e,t,r){let{expr:n,pos:i}=i7(e,t,r);for(;i=Pt(t,i),t[i]==="&"&&t[i+1]!=="&";){if(i++,Xr(t,i))return Zr("&",i);let{expr:a,pos:s}=i7(e,t,i);n={type:"ArithBinary",operator:"&",left:n,right:a},i=s}return{expr:n,pos:i}}function i7(e,t,r){let{expr:n,pos:i}=a7(e,t,r);for(;i=Pt(t,i),t.slice(i,i+2)==="=="||t.slice(i,i+2)==="!=";){let a=t.slice(i,i+2);if(i+=2,Xr(t,i))return Zr(a,i);let{expr:s,pos:o}=a7(e,t,i);n={type:"ArithBinary",operator:a,left:n,right:s},i=o}return{expr:n,pos:i}}function a7(e,t,r){let{expr:n,pos:i}=bh(e,t,r);for(;;)if(i=Pt(t,i),t.slice(i,i+2)==="<="||t.slice(i,i+2)===">="){let a=t.slice(i,i+2);if(i+=2,Xr(t,i))return Zr(a,i);let{expr:s,pos:o}=bh(e,t,i);n={type:"ArithBinary",operator:a,left:n,right:s},i=o}else if(t[i]==="<"||t[i]===">"){let a=t[i];if(i++,Xr(t,i))return Zr(a,i);let{expr:s,pos:o}=bh(e,t,i);n={type:"ArithBinary",operator:a,left:n,right:s},i=o}else break;return{expr:n,pos:i}}function bh(e,t,r){let{expr:n,pos:i}=s7(e,t,r);for(;i=Pt(t,i),t.slice(i,i+2)==="<<"||t.slice(i,i+2)===">>";){let a=t.slice(i,i+2);if(i+=2,Xr(t,i))return Zr(a,i);let{expr:s,pos:o}=s7(e,t,i);n={type:"ArithBinary",operator:a,left:n,right:s},i=o}return{expr:n,pos:i}}function s7(e,t,r){let{expr:n,pos:i}=o7(e,t,r);for(;i=Pt(t,i),(t[i]==="+"||t[i]==="-")&&t[i+1]!==t[i];){let a=t[i];if(i++,Xr(t,i))return Zr(a,i);let{expr:s,pos:o}=o7(e,t,i);n={type:"ArithBinary",operator:a,left:n,right:s},i=o}return{expr:n,pos:i}}function o7(e,t,r){let{expr:n,pos:i}=uc(e,t,r);for(;;)if(i=Pt(t,i),t[i]==="*"&&t[i+1]!=="*"){if(i++,Xr(t,i))return Zr("*",i);let{expr:a,pos:s}=uc(e,t,i);n={type:"ArithBinary",operator:"*",left:n,right:a},i=s}else if(t[i]==="/"||t[i]==="%"){let a=t[i];if(i++,Xr(t,i))return Zr(a,i);let{expr:s,pos:o}=uc(e,t,i);n={type:"ArithBinary",operator:a,left:n,right:s},i=o}else break;return{expr:n,pos:i}}function uc(e,t,r){let{expr:n,pos:i}=R1(e,t,r),a=Pt(t,i);if(t.slice(a,a+2)==="**"){if(a+=2,Xr(t,a))return Zr("**",a);let{expr:s,pos:o}=e.withDepth(()=>uc(e,t,a));return{expr:{type:"ArithBinary",operator:"**",left:n,right:s},pos:o}}return{expr:n,pos:i}}function R1(e,t,r){let n=Pt(t,r);if(t.slice(n,n+2)==="++"||t.slice(n,n+2)==="--"){let i=t.slice(n,n+2);n+=2;let{expr:a,pos:s}=e.withDepth(()=>R1(e,t,n));return{expr:{type:"ArithUnary",operator:i,operand:a,prefix:!0},pos:s}}if(t[n]==="+"||t[n]==="-"||t[n]==="!"||t[n]==="~"){let i=t[n];n++;let{expr:a,pos:s}=e.withDepth(()=>R1(e,t,n));return{expr:{type:"ArithUnary",operator:i,operand:a,prefix:!0},pos:s}}return QF(e,t,n)}function XF(e,t){let r=e[t];return r==="$"||r==="`"}function QF(e,t,r){let{expr:n,pos:i}=l7(e,t,r,!1),a=[n];for(;XF(t,i);){let{expr:o,pos:l}=l7(e,t,i,!0);a.push(o),i=l}a.length>1&&(n={type:"ArithConcat",parts:a});let s;if(t[i]==="["&&n.type==="ArithConcat"){i++;let{expr:o,pos:l}=Pa(e,t,i);s=o,i=l,t[i]==="]"&&i++}if(s&&n.type==="ArithConcat"&&(n={type:"ArithDynamicElement",nameExpr:n,subscript:s},s=void 0),i=Pt(t,i),n.type==="ArithConcat"||n.type==="ArithVariable"||n.type==="ArithDynamicElement"){for(let o of $1)if(t.slice(i,i+o.length)===o&&t.slice(i,i+o.length+1)!=="=="){i+=o.length;let{expr:l,pos:u}=e.withDepth(()=>fl(e,t,i));return n.type==="ArithDynamicElement"?{expr:{type:"ArithDynamicAssignment",operator:o,target:n.nameExpr,subscript:n.subscript,value:l},pos:u}:n.type==="ArithConcat"?{expr:{type:"ArithDynamicAssignment",operator:o,target:n,value:l},pos:u}:{expr:{type:"ArithAssignment",operator:o,variable:n.name,value:l},pos:u}}}if(t.slice(i,i+2)==="++"||t.slice(i,i+2)==="--"){let o=t.slice(i,i+2);return i+=2,{expr:{type:"ArithUnary",operator:o,operand:n,prefix:!1},pos:i}}return{expr:n,pos:i}}function l7(e,t,r,n=!1){let i=Pt(t,r),a=HF(Pa,e,t,i);if(a)return a;let s=WF(t,i);if(s)return s;let o=jF(t,i);if(o)return o;if(t.slice(i,i+2)==="$("&&t[i+2]!=="("){i+=2;let u=1,c=i;for(;i0;)t[i]==="("?u++:t[i]===")"&&u--,u>0&&i++;let p=t.slice(c,i);return i++,{expr:{type:"ArithCommandSubst",command:p},pos:i}}if(t[i]==="`"){i++;let u=i;for(;i0;)t[p]==="{"?c++:t[p]==="}"&&c--,c>0&&p++;let d=t.slice(u,p),f=p+1;if(t[f]==="#"){let h=f+1;for(;hfl(e,t,i));return{expr:{type:"ArithAssignment",operator:d,variable:u,subscript:p,stringKey:c,value:f},pos:h}}}return{expr:{type:"ArithArrayElement",array:u,index:p,stringKey:c},pos:i}}if(i=Pt(t,i),!n){for(let c of $1)if(t.slice(i,i+c.length)===c&&t.slice(i,i+c.length+1)!=="=="){i+=c.length;let{expr:p,pos:d}=e.withDepth(()=>fl(e,t,i));return{expr:{type:"ArithAssignment",operator:c,variable:u,value:p},pos:d}}}return{expr:{type:"ArithVariable",name:u,hasDollarPrefix:l},pos:i}}if(t[i]==="#"){let u=i+1;for(;u{let t,r="";for(let n=0;n=194){let i=(n&31)<<6|e[r+1]&63;t+=String.fromCharCode(i),r+=2;continue}t+=String.fromCharCode(n),r++;continue}if((n&240)===224){if(r+2=55296&&i<=57343){t+=String.fromCharCode(n),r++;continue}t+=String.fromCharCode(i),r+=3;continue}t+=String.fromCharCode(n),r++;continue}if((n&248)===240&&n<=244){if(r+31114111){t+=String.fromCharCode(n),r++;continue}t+=String.fromCodePoint(i),r+=4;continue}t+=String.fromCharCode(n),r++;continue}t+=String.fromCharCode(n),r++}return t}function YF(e,t,r){let n=r+1;for(;n0;)t[s]===n?a++:t[s]===i&&a--,a>0&&s++;return a===0?s:-1}function Cs(e,t,r){let n=r,i=1;for(;n0;){let a=t[n];if(a==="\\"&&n+10&&n++}return n}function JF(e,t,r){let n=r,i=!1;for(;n0)s.push(u),o+=2+l.length;else break}s.length>0?(n+=KF(s),i=o):(n+="\\x",i+=2);break}case"u":{let s=t.slice(i+2,i+6),o=parseInt(s,16);Number.isNaN(o)?(n+="\\u",i+=2):(n+=String.fromCharCode(o),i+=6);break}case"c":{if(i+2e.withDepth(()=>({type:"Word",word:le.word(n(e,l,!1,!1,!1))})))},endIndex:i+1}:a.includes(",")?{part:{type:"BraceExpansion",items:c7(a).map(l=>({type:"Word",word:le.word([le.literal(l)])}))},endIndex:i+1}:null}function jS(e,t){let r="";for(let n of t.parts)switch(n.type){case"Literal":r+=n.value;break;case"SingleQuoted":r+=`'${n.value}'`;break;case"Escaped":r+=n.value;break;case"DoubleQuoted":r+='"';for(let i of n.parts)i.type==="Literal"||i.type==="Escaped"?r+=i.value:i.type==="ParameterExpansion"&&(r+=`\${${i.parameter}}`);r+='"';break;case"ParameterExpansion":r+=`\${${n.parameter}}`;break;case"Glob":r+=n.pattern;break;case"TildeExpansion":r+="~",n.user&&(r+=n.user);break;case"BraceExpansion":{r+="{";let i=[];for(let a of n.items)if(a.type==="Range"){let s=a.startStr??String(a.start),o=a.endStr??String(a.end);a.step!==void 0?i.push(`${s}..${o}..${a.step}`):i.push(`${s}..${o}`)}else i.push(jS(e,a.word));i.length===1&&n.items[0].type==="Range"?r+=i[0]:r+=i.join(","),r+="}";break}default:r+=n.type}return r}function iB(e,t){return{[N.LESS]:"<",[N.GREAT]:">",[N.DGREAT]:">>",[N.LESSAND]:"<&",[N.GREATAND]:">&",[N.LESSGREAT]:"<>",[N.CLOBBER]:">|",[N.TLESS]:"<<<",[N.AND_GREAT]:"&>",[N.AND_DGREAT]:"&>>",[N.DLESS]:"<",[N.DLESSDASH]:"<"}[t]||">"}function Lc(e){let t=e.current(),r=t.type;if(r===N.NUMBER){let n=e.peek(1);return t.end!==n.start||e.isProcessSubstitutionStart(1)?!1:UF.has(n.type)}if(r===N.FD_VARIABLE){let n=e.peek(1);return t.end!==n.start||e.isProcessSubstitutionStart(1)?!1:zF.has(n.type)}return!e.isProcessSubstitutionStart()&&BF.has(r)}function L1(e){let t=null,r;e.check(N.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(N.FD_VARIABLE)&&(r=e.advance().value);let n=e.advance(),i=iB(e,n.type);if(n.type===N.DLESS||n.type===N.DLESSDASH)return aB(e,t,r,n.type===N.DLESSDASH);e.isWord()||e.error("Expected redirection target");let a=e.parseWord();return le.redirection(i,a,t,r)}function aB(e,t,r,n){e.isWord()||e.error("Expected here-document delimiter");let i=e.advance(),a=i.heredocDelimiter??i.value,s=i.quoted||!1,o=le.redirection(n?"<<-":"<<",le.hereDoc(a,le.word([]),n,s),t,r);return e.addPendingHeredoc(o,a,n,s),o}function p7(e){let t=e.getSourceLine(),r=[],n=null,i=[],a=[];for(;e.check(N.ASSIGNMENT_WORD)||Lc(e);)e.checkIterationLimit(),e.check(N.ASSIGNMENT_WORD)?r.push(sB(e)):a.push(L1(e));if(e.isWord())n=e.parseWord();else if(r.length>0&&(e.check(N.DBRACK_START)||e.check(N.DPAREN_START))){let o=e.advance();n=le.word([le.literal(o.value)])}for(;(!e.isStatementEnd()||e.check(N.RBRACE))&&!e.check(N.PIPE,N.PIPE_AMP);)if(e.checkIterationLimit(),Lc(e))a.push(L1(e));else if(e.check(N.ASSIGNMENT_WORD)){let o=e.advance(),l=o.value,u=l.endsWith("="),c=l.endsWith("=(");if((u||c)&&(c||e.check(N.LPAREN))){let p=c?l.slice(0,-2):l.slice(0,-1);c||e.expect(N.LPAREN);let d=M1(e);e.expect(N.RPAREN);let f=d.map(m=>jS(e,m)),h=`${p}=(${f.join(" ")})`;i.push(e.parseWordFromString(h,!1,!1,!0))}else{let p=e.parseWordFromString(l,o.quoted,o.singleQuoted,!0);i.push(e.parseAdjacentWordParts(p.parts,o.end,Mr.Assignment))}}else if(e.isWord())i.push(e.parseWord());else if(e.check(N.RBRACE)){let o=e.advance();i.push(e.parseWordFromString(o.value,!1,!1))}else if(e.check(N.LBRACE)){let o=e.advance();i.push(e.parseWordFromString(o.value,!1,!1))}else if(e.check(N.DBRACK_END)){let o=e.advance();i.push(e.parseWordFromString(o.value,!1,!1))}else if(e.check(N.LPAREN))e.error("syntax error near unexpected token `('");else break;let s=le.simpleCommand(n,i,r,a);return s.line=t,s}function sB(e){let t=e.expect(N.ASSIGNMENT_WORD),r=t.value,n=r.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);n||e.error(`Invalid assignment: ${r}`);let i=n[0],a,s=i.length;if(r[s]==="["){let p=0,d=s+1;for(;s2)break}else p.value==="("&&l++,p.value===")"&&l--,s[o]+=p.value}e.expect(N.DPAREN_END),s[0].trim()&&(n=Ut(e,s[0].trim())),s[1].trim()&&(i=Ut(e,s[1].trim())),s[2].trim()&&(a=Ut(e,s[2].trim())),e.skipNewlines(),e.check(N.SEMICOLON)&&e.advance(),e.skipNewlines();let u;e.check(N.LBRACE)?(e.advance(),u=e.parseCompoundList(),e.expect(N.RBRACE)):(e.expect(N.DO),u=e.parseCompoundList(),e.expect(N.DONE));let c=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:"CStyleFor",init:n,condition:i,update:a,body:u,redirections:c,line:r}}function h7(e,t){e.expect(N.WHILE);let r=e.parseCompoundList();e.expect(N.DO);let n=e.parseCompoundList();n.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(N.DONE);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return le.whileNode(r,n,i)}function m7(e,t){e.expect(N.UNTIL);let r=e.parseCompoundList();e.expect(N.DO);let n=e.parseCompoundList();n.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(N.DONE);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return le.untilNode(r,n,i)}function g7(e,t){e.expect(N.CASE),e.isWord()||e.error("Expected word after 'case'");let r=e.parseWord();e.skipNewlines(),e.expect(N.IN),e.skipNewlines();let n=[];for(;!e.check(N.ESAC,N.EOF);){e.checkIterationLimit();let a=e.getPos(),s=uB(e);if(s&&n.push(s),e.skipNewlines(),e.getPos()===a&&!s)break}e.expect(N.ESAC);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return le.caseNode(r,n,i)}function uB(e){e.check(N.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(N.PIPE));)e.advance();if(t.length===0)return null;e.expect(N.RPAREN),e.skipNewlines();let r=[];for(;!e.check(N.DSEMI,N.SEMI_AND,N.SEMI_SEMI_AND,N.ESAC,N.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===N.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(N.LPAREN)&&e.peek(1).type===N.WORD&&e.error(`syntax error near unexpected token \`${e.peek(1).value}'`);let i=e.getPos(),a=e.parseStatement();if(a&&r.push(a),e.skipSeparators(!1),e.getPos()===i&&!a)break}let n=";;";return e.check(N.DSEMI)?(e.advance(),n=";;"):e.check(N.SEMI_AND)?(e.advance(),n=";&"):e.check(N.SEMI_SEMI_AND)&&(e.advance(),n=";;&"),le.caseItem(t,r,n)}function x7(e,t){e.expect(N.LPAREN);let r=e.parseCompoundList();e.expect(N.RPAREN);let n=t?.skipRedirections?[]:e.parseOptionalRedirections();return le.subshell(r,n)}function y7(e,t){e.expect(N.LBRACE);let r=e.parseCompoundList();e.expect(N.RBRACE);let n=t?.skipRedirections?[]:e.parseOptionalRedirections();return le.group(r,n)}var cB=["-a","-b","-c","-d","-e","-f","-g","-h","-k","-p","-r","-s","-t","-u","-w","-x","-G","-L","-N","-O","-S","-z","-n","-o","-v","-R"],pB=["==","!=","=~","<",">","-eq","-ne","-lt","-le","-gt","-ge","-nt","-ot","-ef"];function b7(e){return e.isWord()||e.check(N.LBRACE)||e.check(N.RBRACE)||e.check(N.ASSIGNMENT_WORD)}function w7(e){if(e.check(N.BANG)&&e.peek(1).type===N.LPAREN){e.advance(),e.advance();let t=1,r="!(";for(;t>0&&!e.check(N.EOF);)if(e.check(N.LPAREN))t++,r+="(",e.advance();else if(e.check(N.RPAREN))t--,t>0&&(r+=")"),e.advance();else if(e.isWord())r+=e.advance().value;else if(e.check(N.PIPE))r+="|",e.advance();else break;return r+=")",e.parseWordFromString(r,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function GS(e){return e.skipNewlines(),fB(e)}function fB(e){let t=v7(e);for(e.skipNewlines();e.check(N.OR_OR);){e.advance(),e.skipNewlines();let r=v7(e);t={type:"CondOr",left:t,right:r},e.skipNewlines()}return t}function v7(e){let t=P1(e);for(e.skipNewlines();e.check(N.AND_AND);){e.advance(),e.skipNewlines();let r=P1(e);t={type:"CondAnd",left:t,right:r},e.skipNewlines()}return t}function P1(e){return e.skipNewlines(),e.check(N.BANG)?(e.advance(),e.skipNewlines(),{type:"CondNot",operand:e.withDepth(()=>P1(e))}):dB(e)}function dB(e){if(e.check(N.LPAREN)){e.advance();let t=e.withDepth(()=>GS(e));return e.expect(N.RPAREN),{type:"CondGroup",expression:t}}if(b7(e)){let t=e.current(),r=t.value;if(cB.includes(r)&&!t.quoted){if(e.advance(),e.check(N.DBRACK_END)&&e.error(`Expected operand after ${r}`),b7(e)){let a=e.parseWordNoBraceExpansion();return{type:"CondUnary",operator:r,operand:a}}let i=e.current();e.error(`unexpected argument \`${i.value}' to conditional unary operator`)}let n=e.parseWordNoBraceExpansion();if(e.isWord()&&pB.includes(e.current().value)){let i=e.advance().value,a;return i==="=~"?a=hB(e):i==="=="||i==="!="?a=w7(e):a=e.parseWordNoBraceExpansion(),{type:"CondBinary",operator:i,left:n,right:a}}if(e.check(N.LESS)){e.advance();let i=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:"<",left:n,right:i}}if(e.check(N.GREAT)){e.advance();let i=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:">",left:n,right:i}}if(e.isWord()&&e.current().value==="="){e.advance();let i=w7(e);return{type:"CondBinary",operator:"==",left:n,right:i}}return{type:"CondWord",word:n}}e.error("Expected conditional expression")}function hB(e){let t=[],r=0,n=-1,i=e.getInput(),a=()=>e.check(N.DBRACK_END)||e.check(N.AND_AND)||e.check(N.OR_OR)||e.check(N.NEWLINE)||e.check(N.EOF);for(;!a();){let s=e.current(),o=n>=0&&s.start>n;if(r===0&&o)break;if(r>0&&o){let l=i.slice(n,s.start);t.push({type:"Literal",value:l})}if(e.isWord()||e.check(N.ASSIGNMENT_WORD)){let l=e.parseWordForRegex();t.push(...l.parts),n=e.peek(-1).end}else if(e.check(N.LPAREN)){let l=e.advance();t.push({type:"Literal",value:"("}),r++,n=l.end}else if(e.check(N.DPAREN_START)){let l=e.advance();t.push({type:"Literal",value:"(("}),r+=2,n=l.end}else if(e.check(N.DPAREN_END))if(r>=2){let l=e.advance();t.push({type:"Literal",value:"))"}),r-=2,n=l.end}else{if(r===1)break;break}else if(e.check(N.RPAREN))if(r>0){let l=e.advance();t.push({type:"Literal",value:")"}),r--,n=l.end}else break;else if(e.check(N.PIPE)){let l=e.advance();t.push({type:"Literal",value:"|"}),n=l.end}else if(e.check(N.SEMICOLON))if(r>0){let l=e.advance();t.push({type:"Literal",value:";"}),n=l.end}else break;else if(r>0&&e.check(N.LESS)){let l=e.advance();t.push({type:"Literal",value:"<"}),n=l.end}else if(r>0&&e.check(N.GREAT)){let l=e.advance();t.push({type:"Literal",value:">"}),n=l.end}else if(r>0&&e.check(N.DGREAT)){let l=e.advance();t.push({type:"Literal",value:">>"}),n=l.end}else if(r>0&&e.check(N.DLESS)){let l=e.advance();t.push({type:"Literal",value:"<<"}),n=l.end}else if(r>0&&e.check(N.LESSAND)){let l=e.advance();t.push({type:"Literal",value:"<&"}),n=l.end}else if(r>0&&e.check(N.GREATAND)){let l=e.advance();t.push({type:"Literal",value:">&"}),n=l.end}else if(r>0&&e.check(N.LESSGREAT)){let l=e.advance();t.push({type:"Literal",value:"<>"}),n=l.end}else if(r>0&&e.check(N.CLOBBER)){let l=e.advance();t.push({type:"Literal",value:">|"}),n=l.end}else if(r>0&&e.check(N.TLESS)){let l=e.advance();t.push({type:"Literal",value:"<<<"}),n=l.end}else if(r>0&&e.check(N.AMP)){let l=e.advance();t.push({type:"Literal",value:"&"}),n=l.end}else if(r>0&&e.check(N.LBRACE)){let l=e.advance();t.push({type:"Literal",value:"{"}),n=l.end}else if(r>0&&e.check(N.RBRACE)){let l=e.advance();t.push({type:"Literal",value:"}"}),n=l.end}else break}return t.length===0&&e.error("Expected regex pattern after =~"),{type:"Word",parts:t}}function mB(e){let t="";for(let r=0;r0?e:[le.literal("")]}function gB(e,t){let r=1,n=t+1;for(;n0;){let i=e[n];if(i==="\\"){n+=2;continue}if("@*+?!".includes(i)&&n+10;)t[d]==="{"?p++:t[d]==="}"&&p--,p>0&&d++;let f=t.slice(r+2,d);return{part:le.parameterExpansion("",{type:"BadSubstitution",text:f}),endIndex:d+1}}}if(o===""&&!a&&!s&&t[i]!=="}"){let c=1,p=i;for(;p0;)t[p]==="{"?c++:t[p]==="}"&&c--,c>0&&p++;if(c>0)throw new Sn("unexpected EOF while looking for matching '}'",0,0);let d=t.slice(r+2,p);return{part:le.parameterExpansion("",{type:"BadSubstitution",text:d}),endIndex:p+1}}let u=null;if(a){let c=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(c)if(i=t.length)throw new Sn("unexpected EOF while looking for matching '}'",0,0);return{part:le.parameterExpansion(o,u),endIndex:i+1}}function wh(e,t,r,n,i=!1){let a=r,s=t[a],o=t[a+1]||"";if(s===":"){let l=o;if("-=?+".includes(l)){a+=2;let g=Cs(e,t,a),x=t.slice(a,g),y=e.withDepth(()=>Da(e,x,!1,!1,!0,!1,i,!1,!1,!0)),b=le.word(Go(y));if(l==="-")return{operation:{type:"DefaultValue",word:b,checkEmpty:!0},endIndex:g};if(l==="=")return{operation:{type:"AssignDefault",word:b,checkEmpty:!0},endIndex:g};if(l==="?")return{operation:{type:"ErrorIfUnset",word:b,checkEmpty:!0},endIndex:g};if(l==="+")return{operation:{type:"UseAlternative",word:b,checkEmpty:!0},endIndex:g}}a++;let u=Cs(e,t,a),c=t.slice(a,u),p=-1,d=0,f=0;for(let g=0;g0)f--;else{p=g;break}}let h=p>=0?c.slice(0,p):c,m=p>=0?c.slice(p+1):null;return{operation:{type:"Substring",offset:u7(e,h),length:m!==null?u7(e,m):null},endIndex:u}}if("-=?+".includes(s)){a++;let l=Cs(e,t,a),u=t.slice(a,l),c=e.withDepth(()=>Da(e,u,!1,!1,!0,!1,i,!1,!1,!0)),p=le.word(Go(c));if(s==="-")return{operation:{type:"DefaultValue",word:p,checkEmpty:!1},endIndex:l};if(s==="=")return{operation:{type:"AssignDefault",word:p,checkEmpty:!1},endIndex:l};if(s==="?")return{operation:{type:"ErrorIfUnset",word:u?p:null,checkEmpty:!1},endIndex:l};if(s==="+")return{operation:{type:"UseAlternative",word:p,checkEmpty:!1},endIndex:l}}if(s==="#"||s==="%"){let l=o===s,u=s==="#"?"prefix":"suffix";a+=l?2:1;let c=Cs(e,t,a),p=t.slice(a,c),d=e.withDepth(()=>Da(e,p,!1,!1,!1));return{operation:{type:"PatternRemoval",pattern:le.word(Go(d)),side:u,greedy:l},endIndex:c}}if(s==="/"){let l=o==="/";a+=l?2:1;let u=null;t[a]==="#"?(u="start",a++):t[a]==="%"&&(u="end",a++);let c;u!==null&&(t[a]==="/"||t[a]==="}")?c=a:c=JF(e,t,a);let p=t.slice(a,c),d=e.withDepth(()=>Da(e,p,!1,!1,!1)),f=le.word(Go(d)),h=null,m=c;if(t[c]==="/"){let g=c+1,x=Cs(e,t,g),y=t.slice(g,x),b=e.withDepth(()=>Da(e,y,!1,!1,!1));h=le.word(Go(b)),m=x}return{operation:{type:"PatternReplacement",pattern:f,replacement:h,all:l,anchor:u},endIndex:m}}if(s==="^"||s===","){let l=o===s,u=s==="^"?"upper":"lower";a+=l?2:1;let c=Cs(e,t,a),p=t.slice(a,c),d=p?le.word([le.literal(p)]):null;return{operation:{type:"CaseModification",direction:u,all:l,pattern:d},endIndex:c}}return s==="@"&&/[QPaAEKkuUL]/.test(o)?{operation:{type:"Transform",operator:o},endIndex:a+2}:{operation:null,endIndex:a}}function P0(e,t,r,n=!1){let i=r+1;if(i>=t.length)return{part:le.literal("$"),endIndex:i};let a=t[i];if(a==="("&&t[i+1]==="(")return e.isDollarDparenSubshell(t,r)?e.parseCommandSubstitution(t,r):e.parseArithmeticExpansion(t,r);if(a==="["){let s=1,o=i+1;for(;o0;)t[o]==="["?s++:t[o]==="]"&&s--,s>0&&o++;if(s===0){let l=t.slice(i+1,o),u=Ut(e,l);return{part:le.arithmeticExpansion(u),endIndex:o+1}}}return a==="("?e.parseCommandSubstitution(t,r):a==="{"?yB(e,t,r,n):/[a-zA-Z_0-9@*#?$!-]/.test(a)?xB(e,t,r):{part:le.literal("$"),endIndex:i}}function E7(e,t){let r=[],n=0,i="",a=()=>{i&&(r.push(le.literal(i)),i="")};for(;n{a&&(n.push(le.literal(a)),a="")};for(;i=2&&t[0]==='"'&&t[t.length-1]==='"'){let m=t.slice(1,-1),g=!1;for(let x=0;x{f&&(p.push(le.literal(f)),f="")};for(;d")&&t[d+1]==="("&&!a&&!s){h();let{part:g,endIndex:x}=e.parseProcessSubstitutionFromString(t,d);p.push(g),d=x;continue}if(m==="~"){let g=d>0?t[d-1]:"";if(d===0&&c||g==="="||i&&g===":"){let x=YF(e,t,d),y=t[x];if(y===void 0||y==="/"||y===":"){h();let b=t.slice(d+1,x)||null;p.push({type:"TildeExpansion",user:b}),d=x;continue}}}if("@*+?!".includes(m)&&d+1Y3)throw new Sn(`Input too large: ${t.length} bytes exceeds limit of ${Y3}`,1,1);this._input=t,this.processLineState=void 0;let i=new PF(t,r);if(this.tokens=i.tokenize(),this.tokens.length>Rc)throw new Sn(`Too many tokens: ${this.tokens.length} exceeds limit of ${Rc}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseBudget.chargeTokens(this.tokens.length),this.parseScript()}finally{n?.()}}parseTokens(t){this.ownsParseBudget&&this.parseBudget.reset();let r=this.ownsParseBudget?void 0:this.enterDepth();try{return this.tokens=t,this.pos=0,this.pendingHeredocs=[],this.processLineState=void 0,this.parseBudget.chargeTokens(t.length),this.parseScript()}finally{r?.()}}current(){return this.tokens[this.pos]||this.tokens[this.tokens.length-1]}peek(t=0){return this.tokens[this.pos+t]||this.tokens[this.tokens.length-1]}advance(){let t=this.current();return this.posr.currentPhysicalLine&&(r.currentPhysicalLine=t.line,r.currentLogicalLine+=1),r.currentLogicalLine):t.line}check(t,r,n,i,...a){let s=this.tokens[this.pos]?.type;return s===t||r!==void 0&&s===r||n!==void 0&&s===n||i!==void 0&&s===i?!0:a.length>0?a.includes(s):!1}expect(t,r){if(this.check(t))return this.advance();let n=this.current();throw new Sn(r||`Expected ${t}, got ${n.type}`,n.line,n.column,n)}error(t){let r=this.current();throw new Sn(t,r.line,r.column,r)}skipNewlines(){for(;this.check(N.NEWLINE,N.COMMENT);)this.check(N.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(t=!0){for(;;){if(this.check(N.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(N.SEMICOLON,N.COMMENT)){this.advance();continue}if(t&&this.check(N.DSEMI,N.SEMI_AND,N.SEMI_SEMI_AND)){this.advance();continue}break}}addPendingHeredoc(t,r,n,i){this.pendingHeredocs.push({redirect:t,delimiter:r,stripTabs:n,quoted:i})}processHeredocs(){for(let t of this.pendingHeredocs)if(this.check(N.HEREDOC_CONTENT)){let r=this.advance(),n;t.quoted?n=le.word([le.literal(r.value)]):n=this.parseWordFromString(r.value,!1,!1,!1,!0),t.redirect.target=le.hereDoc(t.delimiter,n,t.stripTabs,t.quoted,r.heredocTerminated??!1)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(N.EOF,N.NEWLINE,N.SEMICOLON,N.AMP,N.AND_AND,N.OR_OR,N.RPAREN,N.RBRACE,N.DSEMI,N.SEMI_AND,N.SEMI_SEMI_AND)}isCommandStart(){let t=this.current().type;return this.isWord()||t===N.ASSIGNMENT_WORD||t===N.FD_VARIABLE||t===N.LPAREN||t===N.LBRACE||t===N.DPAREN_START||t===N.DBRACK_START||Lc(this)}parseScript(){let t=[],r=0;for(this.skipNewlines();!this.check(N.EOF);){r++,r>1e4&&this.error("Parser stuck: too many iterations (>10000)");let n=this.checkUnexpectedToken();if(n){t.push(n),this.skipSeparators(!1);continue}let i=this.pos,a=this.parseStatement();a&&t.push(a),this.check(N.HEREDOC_CONTENT)&&this.processHeredocs(),this.skipSeparators(!1),this.check(N.DSEMI,N.SEMI_AND,N.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===i&&!this.check(N.EOF)&&this.error(`syntax error near unexpected token \`${this.current().value}'`)}return le.script(t)}checkUnexpectedToken(){let t=this.current().type,r=this.current().value;if(this.currentTokenJoinsProcessSubstitution())return null;if((t===N.DO||t===N.DONE||t===N.THEN||t===N.ELSE||t===N.ELIF||t===N.FI||t===N.ESAC)&&this.error(`syntax error near unexpected token \`${r}'`),t===N.RBRACE||t===N.RPAREN){let n=`syntax error near unexpected token \`${r}'`;return this.advance(),le.statement([le.pipeline([le.simpleCommand(null,[],[],[])])],[],!1,{message:n,token:r})}return(t===N.DSEMI||t===N.SEMI_AND||t===N.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${r}'`),t===N.SEMICOLON&&this.error(`syntax error near unexpected token \`${r}'`),(t===N.AMP||t===N.AND_AND||t===N.OR_OR||t===N.PIPE||t===N.PIPE_AMP)&&this.error(`syntax error near unexpected token \`${r}'`),null}parseStatement(){if(this.skipNewlines(),!this.isCommandStart())return null;let t=this.current().start,r=[],n=[],i=!1,a=this.parsePipeline();for(r.push(a);this.check(N.AND_AND,N.OR_OR);){let l=this.advance();n.push(l.type===N.AND_AND?"&&":"||"),this.skipNewlines();let u=this.parsePipeline();r.push(u)}this.check(N.AMP)&&(this.advance(),i=!0);let s=this.pos>0?this.tokens[this.pos-1].end:t,o=this._input.slice(t,s);return le.statement(r,n,i,void 0,o)}parseTimePrefix(){if(!this.check(N.TIME)||this.currentTokenJoinsProcessSubstitution())return;this.advance();let t=!1;return this.check(N.WORD,N.NAME)&&this.current().value==="-p"&&(this.advance(),t=!0),t}parsePipeline(){let t=!1,r=!1,n=0;for(;this.check(N.BANG)&&!this.currentTokenJoinsProcessSubstitution();)this.advance(),n++;if(n===0){let l=this.parseTimePrefix();if(l!==void 0)for(t=!0,r=l;this.check(N.BANG)&&!this.currentTokenJoinsProcessSubstitution();)this.advance(),n++}let i=n%2===1,a=[],s=[],o=this.parseCommand();for(a.push(o);this.check(N.PIPE,N.PIPE_AMP);){let l=this.advance();this.skipNewlines(),s.push(l.type===N.PIPE_AMP);let u=this.parseCommand();a.push(u)}return le.pipeline(a,i,t,r,s.length>0?s:void 0)}parseCommand(){if(this.currentTokenJoinsProcessSubstitution())return p7(this);let t=this.current();switch(t.type){case N.IF:return f7(this);case N.FOR:return d7(this);case N.WHILE:return h7(this);case N.UNTIL:return m7(this);case N.CASE:return g7(this);case N.LPAREN:return x7(this);case N.LBRACE:return y7(this);case N.DPAREN_START:return this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand();case N.DBRACK_START:return this.parseConditionalCommand();case N.FUNCTION:return this.parseFunctionDef();case N.TIME:break;case N.BANG:this.error(`syntax error near unexpected token \`${t.value}'`);break;default:Z3(t.type)&&this.error(`syntax error near unexpected token \`${t.value}'`)}return this.check(N.NAME,N.WORD)&&this.peek(1).type===N.LPAREN&&this.peek(2).type===N.RPAREN?this.parseFunctionDef():p7(this)}dparenClosesWithSpacedParens(){let t=1,r=1;for(;rnew cc(this.parseBudget),n=>this.error(n))}parseProcessSubstitutionFromString(t,r){return _F(t,r,()=>new cc(this.parseBudget),n=>this.error(n))}parseProcessSubstitution(){let t=this.advance();this.expect(N.LPAREN);let r=this.processLineState,n=this.getSourceLine(t);this.processLineState={currentLogicalLine:n};let i;try{i=le.script(this.parseCompoundList())}finally{this.processLineState=r}return this.check(N.EOF)&&this.error("unexpected EOF while looking for matching `)'"),this.expect(N.RPAREN),le.processSubstitution(i,t.type===N.LESS?"input":"output")}parseBacktickSubstitution(t,r,n=!1){return OF(t,r,n,()=>new cc(this.parseBudget),i=>this.error(i))}isDollarDparenSubshell(t,r){return kF(t,r)}parseArithmeticExpansion(t,r){let n=r+3,i=1,a=0,s=n;for(;s0;)t[s]==="$"&&t[s+1]==="("?t[s+2]==="("?(i++,s+=3):(a++,s+=2):t[s]==="("&&t[s+1]==="("?(i++,s+=2):t[s]===")"&&t[s+1]===")"?a>0?(a--,s++):(i--,i>0&&(s+=2)):t[s]==="("?(a++,s++):(t[s]===")"&&a>0&&a--,s++);let o=t.slice(n,s),l=this.parseArithmeticExpression(o);return{part:le.arithmeticExpansion(l),endIndex:s+2}}parseArithmeticCommand(){let t=this.expect(N.DPAREN_START),r="",n=1,i=0,a=!1,s=!1;for(;n>0&&!this.check(N.EOF);){if(a){if(a=!1,i>0){i--,r+=")";continue}if(this.check(N.RPAREN)){n--,s=!0,this.advance();continue}if(this.check(N.DPAREN_END)){n--,s=!0;continue}r+=")";continue}if(this.check(N.DPAREN_START))n++,r+="((",this.advance();else if(this.check(N.DPAREN_END))i>=2?(i-=2,r+="))",this.advance()):i===1?(i--,r+=")",a=!0,this.advance()):(n--,s=!0,n>0&&(r+="))"),this.advance());else if(this.check(N.LPAREN))i++,r+="(",this.advance();else if(this.check(N.RPAREN))i>0&&i--,r+=")",this.advance();else{let u=this.current().value,c=r.length>0?r[r.length-1]:"";r.length>0&&!r.endsWith(" ")&&!(u==="="&&/[|&^+\-*/%<>]$/.test(r))&&!(u==="<"&&c==="<")&&!(u===">"&&c===">")&&(r+=" "),r+=u,this.advance()}}s||this.expect(N.DPAREN_END);let o=this.parseArithmeticExpression(r.trim()),l=this.parseOptionalRedirections();return le.arithmeticCommand(o,l,this.getSourceLine(t))}parseConditionalCommand(){let t=this.expect(N.DBRACK_START),r=GS(this);this.expect(N.DBRACK_END);let n=this.parseOptionalRedirections();return le.conditionalCommand(r,n,this.getSourceLine(t))}parseFunctionDef(){let t;if(this.check(N.FUNCTION)){if(this.advance(),this.check(N.NAME)||this.check(N.WORD))t=this.advance().value;else{let i=this.current();throw new Sn("Expected function name",i.line,i.column,i)}this.check(N.LPAREN)&&(this.advance(),this.expect(N.RPAREN))}else t=this.advance().value,t.includes("$")&&this.error(`\`${t}': not a valid identifier`),this.expect(N.LPAREN),this.expect(N.RPAREN);this.skipNewlines();let r=this.parseCompoundCommandBody({forFunctionBody:!0}),n=this.parseOptionalRedirections();return le.functionDef(t,r,n)}parseCompoundCommandBody(t){let r=t?.forFunctionBody;if(this.check(N.LBRACE))return y7(this,{skipRedirections:r});if(this.check(N.LPAREN))return x7(this,{skipRedirections:r});if(this.check(N.IF))return f7(this,{skipRedirections:r});if(this.check(N.FOR))return d7(this,{skipRedirections:r});if(this.check(N.WHILE))return h7(this,{skipRedirections:r});if(this.check(N.UNTIL))return m7(this,{skipRedirections:r});if(this.check(N.CASE))return g7(this,{skipRedirections:r});this.error("Expected compound command for function body")}parseCompoundList(){let t=this.enterDepth();try{let r=[];for(this.skipNewlines();(this.currentTokenJoinsProcessSubstitution()||!this.check(N.EOF,N.FI,N.ELSE,N.ELIF,N.THEN,N.DO,N.DONE,N.ESAC,N.RPAREN,N.RBRACE,N.DSEMI,N.SEMI_AND,N.SEMI_SEMI_AND))&&this.isCommandStart();){this.checkIterationLimit();let n=this.pos,i=this.parseStatement();if(i&&r.push(i),this.skipSeparators(),this.pos===n&&!i)break}return r}finally{t()}}parseOptionalRedirections(){let t=[];for(;Lc(this);){this.checkIterationLimit();let r=this.pos;if(t.push(L1(this)),this.pos===r)break}return t}parseArithmeticExpression(t){return Ut(this,t)}};function Ws(e,t){return new ft().parse(e,t)}function wB(e){return Fa(e)}function Fa(e){return e.statements.map(VS).join(` `)}function VS(e){let t=[];for(let n=0;n0?`${t.join(" ")} `:"")+r.join(" ")}function ZS(e){switch(e.type){case"SimpleCommand":return EB(e);case"If":return IB(e);case"For":return $B(e);case"CStyleFor":return DB(e);case"While":return RB(e);case"Until":return LB(e);case"Case":return MB(e);case"Subshell":return FB(e);case"Group":return BB(e);case"ArithmeticCommand":return UB(e);case"ConditionalCommand":return zB(e);case"FunctionDef":return qB(e);default:{let t=e;throw new Error(`Unsupported command type: ${t.type}`)}}}function EB(e){let t=[];for(let r of e.assignments)t.push(SB(r));e.name&&t.push(hr(e.name));for(let r of e.args)t.push(hr(r));for(let r of e.redirections)t.push(KS(r));return t.join(" ")}function SB(e){let t=e.append?"+=":"=";if(e.array){let r=e.array.map(hr).join(" ");return`${e.name}${t}(${r})`}return e.value?`${e.name}${t}${hr(e.value)}`:`${e.name}${t}`}function hr(e){return e.parts.map(t=>hp(t,!1)).join("")}function Xi(e){return e.parts.map(t=>hp(t,!0)).join("")}function hp(e,t){switch(e.type){case"Literal":return t?CB(e.value):AB(e.value);case"SingleQuoted":return`'${e.value}'`;case"DoubleQuoted":return`"${e.parts.map(r=>hp(r,!0)).join("")}"`;case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return XS(e);case"CommandSubstitution":return e.legacy?`\`${Fa(e.body)}\``:`$(${Fa(e.body)})`;case"ArithmeticExpansion":return`$((${bt(e.expression.expression)}))`;case"ProcessSubstitution":return e.direction==="input"?`<(${Fa(e.body)})`:`>(${Fa(e.body)})`;case"BraceExpansion":return _B(e);case"TildeExpansion":return e.user!==null?`~${e.user}`:"~";case"Glob":return e.pattern;default:{let r=e;throw new Error(`Unsupported word part type: ${r.type}`)}}}function AB(e){return e.replace(/[\s\\'"`!|&;()<>{}[\]*?~#]/g,"\\$&")}function CB(e){return e.replace(/[$`"\\]/g,"\\$&")}function kB(e,t){return e.parts.map(r=>NB(r,t)).join("")}function NB(e,t){switch(e.type){case"Literal":return t?e.value:e.value.replace(/[$`]/g,"\\$&");case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return XS(e);case"CommandSubstitution":return e.legacy?`\`${Fa(e.body)}\``:`$(${Fa(e.body)})`;case"ArithmeticExpansion":return`$((${bt(e.expression.expression)}))`;default:return hp(e,!1)}}function XS(e){return e.operation?`\${${QS(e.parameter,e.operation)}}`:TB(e.parameter)?`\${${e.parameter}}`:`$${e.parameter}`}function TB(e){return!(/^[?#@*$!\-0-9]$/.test(e)||/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))}function QS(e,t){switch(t.type){case"Length":return`#${e}`;case"LengthSliceError":return`#${e}:`;case"BadSubstitution":return t.text;case"DefaultValue":return`${e}${t.checkEmpty?":":""}-${Xi(t.word)}`;case"AssignDefault":return`${e}${t.checkEmpty?":":""}=${Xi(t.word)}`;case"ErrorIfUnset":return`${e}${t.checkEmpty?":":""}?${t.word?Xi(t.word):""}`;case"UseAlternative":return`${e}${t.checkEmpty?":":""}+${Xi(t.word)}`;case"Substring":{let r=bt(t.offset.expression);return t.length?`${e}:${r}:${bt(t.length.expression)}`:`${e}:${r}`}case"PatternRemoval":{let r=t.side==="prefix"?"#":"%",n=t.greedy?`${r}${r}`:r;return`${e}${n}${Xi(t.pattern)}`}case"PatternReplacement":{let r="/";t.all?r="//":t.anchor==="start"?r="/#":t.anchor==="end"&&(r="/%");let n=t.replacement?`/${Xi(t.replacement)}`:"";return`${e}${r}${Xi(t.pattern)}${n}`}case"CaseModification":{let r=t.direction==="upper"?"^":",",n=t.all?`${r}${r}`:r,i=t.pattern?Xi(t.pattern):"";return`${e}${n}${i}`}case"Transform":return`${e}@${t.operator}`;case"Indirection":return t.innerOp?`!${QS(e,t.innerOp)}`:`!${e}`;case"ArrayKeys":return`!${t.array}[${t.star?"*":"@"}]`;case"VarNamePrefix":return`!${t.prefix}${t.star?"*":"@"}`;default:{let r=t;throw new Error(`Unsupported parameter operation type: ${r.type}`)}}}function _B(e){return`{${e.items.map(OB).join(",")}}`}function OB(e){if(e.type==="Word")return hr(e.word);let t=e.startStr??String(e.start),r=e.endStr??String(e.end);return e.step!==void 0?`${t}..${r}..${e.step}`:`${t}..${r}`}function KS(e){let t=e.fdVariable?`{${e.fdVariable}}`:e.fd!==null?String(e.fd):"";if(e.operator==="<<"||e.operator==="<<-"){let r=e.target;if(r.terminated===!1)throw new Error("Cannot serialize an unterminated here-document");let n=r.quoted?`'${r.delimiter}'`:r.delimiter,i=kB(r.content,r.quoted);return`${t}${e.operator}${n} ${i}${r.delimiter}`}return e.operator==="<<<"?`${t}<<< ${hr(e.target)}`:e.operator==="&>"||e.operator==="&>>"?`${e.operator} ${hr(e.target)}`:`${t}${e.operator} ${hr(e.target)}`}function Vn(e){return e.length===0?"":` ${e.map(KS).join(" ")}`}function Cn(e){return e.map(VS).join(` `)}function IB(e){let t=[];for(let r=0;rr-n.value)throw new T(`alias expansion exceeds string length limit (${r} bytes)`,"string_length");return n.value+=i,e+t}function S7(e){return e.parts.length!==1?!1:e.parts[0].type==="Literal"}function A7(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type==="Literal"?t.value:null}function C7(e,t){return e.env.get(`${HB}${t}`)}function WB(e,t,r){return YS(e,t,r)}function YS(e,t,r,n=!0){if(!t.name||!S7(t.name))return t;let i=A7(t.name);if(!i)return t;let a=C7(e,i);if(!a||r.has(i))return t;try{r.add(i);let s=new ft,o={value:0},l=Mc("",a,e.limits.maxStringLength,o),u=a.endsWith(" ");if(!u)for(let f of t.args){let h=hr(f);l=Mc(l,` ${h}`,e.limits.maxStringLength,o)}let c;try{c=s.parse(l)}catch(f){if(f instanceof Sn)throw f;return t}if(c.statements.length!==1||c.statements[0].pipelines.length!==1||c.statements[0].pipelines[0].commands.length!==1)return k7(e,t,a);let p=c.statements[0].pipelines[0].commands[0];if(p.type!=="SimpleCommand")return k7(e,t,a);let d={...p,assignments:[...t.assignments,...p.assignments],redirections:[...p.redirections,...t.redirections],line:t.line};if(u&&t.args.length>0){d={...d,args:[...d.args,...t.args]};let f=1;for(;n&&d.args.length>0;){let h=d.args[0];if(!S7(h))break;let m=A7(h),g=m?C7(e,m):null;if(!g)break;if(f>=e.limits.maxCallDepth)throw new T(`alias expansion depth limit exceeded (${e.limits.maxCallDepth})`,"recursion");f++;let x={type:"SimpleCommand",name:h,args:d.args.slice(1),assignments:[],redirections:[]},y=YS(e,x,r,!1);if(y===x||(d={...d,name:y.name,args:[...y.args]},!g.endsWith(" ")))break}}return d}catch(s){throw r.delete(i),s}}function k7(e,t,r){let n={value:0},i=Mc("",r,e.limits.maxStringLength,n);for(let u of t.args){let c=hr(u);i=Mc(i,` ${c}`,e.limits.maxStringLength,n)}let a=new ft,s=a.parseWordFromString("eval",!1,!1),o=0;for(let u of i)u==="'"&&o++;if(n.value+2+o*3>e.limits.maxStringLength)throw new T(`alias expansion exceeds string length limit (${e.limits.maxStringLength} bytes)`,"string_length");let l=a.parseWordFromString(`'${i.replace(/'/g,"'\\''")}'`,!1,!1);return{type:"SimpleCommand",name:s,args:[l],assignments:t.assignments,redirections:t.redirections,line:t.line}}J();ge();J();Dt();Yc();Dt();var jB=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9a-fA-F"]]);function JS(e){return jB.get(e)??""}function GB(e){let t=[],r="",n=0;for(;n0;){let i=e[n];if(i==="\\"){n+=2;continue}if(i==="(")r++;else if(i===")"&&(r--,r===0))return n;n++}return-1}function T7(e){let t=[],r="",n=0,i=!1,a=0;for(;athis.maxOps)throw new T(`Glob operation limit exceeded (${this.maxOps})`,"glob_operations");this.consumeOperation?.()}hasNullglob(){return this.nullglob}hasFailglob(){return this.failglob}filterGlobignore(e){return!this.hasGlobignore&&!this.globskipdots?e:e.filter(t=>{let r=t.split("/").pop()||t;if((this.hasGlobignore||this.globskipdots)&&(r==="."||r===".."))return!1;if(this.hasGlobignore){for(let n of this.globignorePatterns)if(this.matchGlobignorePattern(t,n))return!1}return!0})}matchGlobignorePattern(e,t){return VB(t).test(e)}isGlobPattern(e){return!!(e.includes("*")||e.includes("?")||/\[.*\]/.test(e)||this.extglob&&/[@*+?!]\(/.test(e))}async expandArgs(e,t){let r=e.map((a,s)=>(t?.[s]??!1)||!this.isGlobPattern(a)?null:this.expand(a)),n=await Promise.all(r.map(a=>a||Promise.resolve(null))),i=[];for(let a=0;a0?i.push(...s):i.push(e[a])}return i}async expand(e){if(this.globstar){let r=e.split("/"),n=0;for(let i of r)if(i==="**"&&(n++,n>_7))throw new T(`Glob pattern has too many ** segments (max ${_7})`,"glob_operations")}let t;if(e.includes("**")&&this.globstar&&this.isGlobstarValid(e))t=await this.expandRecursive(e);else{let r=e.replace(/\*\*+/g,"*");t=await this.expandSimple(r)}return this.filterGlobignore(t)}isGlobstarValid(e){let t=e.split("/");for(let r of t)if(r.includes("**")&&r!=="**")return!1;return!0}hasGlobChars(e){return!!(e.includes("*")||e.includes("?")||/\[.*\]/.test(e)||this.extglob&&/[@*+?!]\(/.test(e))}async expandSimple(e){let t=e.startsWith("/"),r=e.split("/").filter(o=>o!==""),n=-1;for(let o=0;of.name==="."),d=s.some(f=>f.name==="..");p||l.push({name:".",isFile:!1,isDirectory:!0,isSymbolicLink:!1}),d||l.push({name:"..",isFile:!1,isDirectory:!0,isSymbolicLink:!1})}for(let p of l)if(!(p.name.startsWith(".")&&!n.startsWith(".")&&!u)&&this.matchPattern(p.name,n)){let d=e==="/"?`/${p.name}`:`${e}/${p.name}`,f;t===""?f=p.name:t==="/"?f=`/${p.name}`:f=`${t}/${p.name}`,i.length===0?o.push(Promise.resolve([f])):p.isDirectory&&o.push(this.expandSegments(d,f,i))}let c=await Promise.all(o);for(let p of c)a.push(...p)}else{this.checkOpsLimit();let s=await this.fs.readdir(e),o=[],l=[...s],u=this.dotglob||this.hasGlobignore;(n.startsWith(".")||this.dotglob)&&(s.includes(".")||l.push("."),s.includes("..")||l.push(".."));for(let p of l)if(!(p.startsWith(".")&&!n.startsWith(".")&&!u)&&this.matchPattern(p,n)){let d=e==="/"?`/${p}`:`${e}/${p}`,f;t===""?f=p:t==="/"?f=`/${p}`:f=`${t}/${p}`,i.length===0?o.push(Promise.resolve([f])):o.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(d)).isDirectory)return this.expandSegments(d,f,i)}catch(h){if(h instanceof T)throw h}return[]})())}let c=await Promise.all(o);for(let p of c)a.push(...p)}}catch(s){if(s instanceof T)throw s}return a}async expandRecursive(e){let t=[],r=e.indexOf("**"),n=e.slice(0,r).replace(/\/$/,"")||".",i=e.slice(r+2).replace(/^\//,"");return i.includes("**")&&this.isGlobstarValid(i)?(await this.walkDirectoryMultiGlobstar(n,i,t),[...new Set(t)].sort()):(await this.walkDirectory(n,i,t),t.sort())}async walkDirectoryMultiGlobstar(e,t,r){this.checkOpsLimit();let n=this.fs.resolvePath(this.cwd,e);try{this.checkOpsLimit();let i=this.fs.readdirWithFileTypes?await this.fs.readdirWithFileTypes(n):null;if(i){let a=[];for(let l of i){let u=e==="."?l.name:`${e}/${l.name}`;l.isDirectory&&a.push(u)}let s=e==="."?t:`${e}/${t}`,o=await this.expandRecursive(s);r.push(...o);for(let l=0;lthis.walkDirectoryMultiGlobstar(c,t,r)))}}else{this.checkOpsLimit();let a=await this.fs.readdir(n),s=[];for(let u of a){let c=e==="."?u:`${e}/${u}`,p=this.fs.resolvePath(this.cwd,c);try{this.checkOpsLimit(),(await this.fs.stat(p)).isDirectory&&s.push(c)}catch(d){if(d instanceof T)throw d}}let o=e==="."?t:`${e}/${t}`,l=await this.expandRecursive(o);r.push(...l);for(let u=0;uthis.walkDirectoryMultiGlobstar(p,t,r)))}}}catch(i){if(i instanceof T)throw i}}async walkDirectory(e,t,r){this.checkOpsLimit();let n=this.fs.resolvePath(this.cwd,e);try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let i=await this.fs.readdirWithFileTypes(n),a=[],s=[];for(let o of i){let l=e==="."?o.name:`${e}/${o.name}`;o.isDirectory?s.push(l):t&&this.matchPattern(o.name,t)&&a.push(l)}r.push(...a);for(let o=0;othis.walkDirectory(u,t,r)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(n),a=[];for(let o=0;o{let p=e==="."?c:`${e}/${c}`,d=this.fs.resolvePath(this.cwd,p);try{this.checkOpsLimit();let f=await this.fs.stat(d);return{name:c,path:p,isDirectory:f.isDirectory}}catch(f){if(f instanceof T)throw f;return null}}));a.push(...u.filter(c=>c!==null))}for(let o of a)!o.isDirectory&&t&&this.matchPattern(o.name,t)&&r.push(o.path);let s=a.filter(o=>o.isDirectory);for(let o=0;othis.walkDirectory(u.path,t,r)))}}}catch(i){if(i instanceof T)throw i}}matchPattern(e,t){return this.patternToRegex(t).test(e)}patternToRegex(e){let t=this.patternToRegexStr(e);return Ie(`^${t}$`)}patternToRegexStr(e){let t="",r=!1;for(let n=0;nthis.patternToRegexStr(c)),u=l.length>0?l.join("|"):"(?:)";if(i==="@")t+=`(?:${u})`;else if(i==="*")t+=`(?:${u})*`;else if(i==="+")t+=`(?:${u})+`;else if(i==="?")t+=`(?:${u})?`;else if(i==="!")if(athis.computePatternLength(p));if(c.every(p=>p!==null)&&c.every(p=>p===c[0])&&c[0]!==null){let p=c[0];if(p===0)t+="(?:.+)";else{let d=[];p>0&&d.push(`.{0,${p-1}}`),d.push(`.{${p+1},}`),d.push(`(?!(?:${u})).{${p}}`),t+=`(?:${d.join("|")})`}}else t+=`(?:(?!(?:${u})).)*?`}else t+=`(?!(?:${u})$).*`;n=a;continue}}if(i==="*")t+=".*";else if(i==="?")t+=".";else if(i==="["){let a=n+1,s="[";athis.computePatternLength(l));if(o.every(l=>l!==null)&&o.every(l=>l===o[0])){t+=o[0],r=a+1;continue}return null}return null}}if(i==="*")return null;if(i==="?"){t+=1,r++;continue}if(i==="["){let a=e.indexOf("]",r+1);if(a!==-1){t+=1,r=a+1;continue}t+=1,r++;continue}if(i==="\\"){t+=1,r+=2;continue}t+=1,r++}return t}};J();function eA(e){for(let t=0;t=t)throw new T(`array element limit exceeded (${t})`,"array_elements")}function vh(e,t,r,n,i){Ba(e.length,i),Ba(t.length,i),e.push(r),t.push(n)}function $r(e){return e.get("IFS")??QB}function Qr(e){return e.get("IFS")===""}function B0(e){let t=$r(e);if(t==="")return!0;for(let r of t)if(r!==" "&&r!==" "&&r!==` `)return!1;return!0}function KB(e){let t=!1,r=[];for(let n of e.split(""))n==="-"?t=!0:/[\\^$.*+?()[\]{}|]/.test(n)?r.push(`\\${n}`):n===" "?r.push("\\t"):n===` `?r.push("\\n"):r.push(n);return t&&r.push("\\-"),r.join("")}function Ke(e){let t=e.get("IFS");if(t===void 0)return" ";let r=t.codePointAt(0);return r===void 0?"":String.fromCodePoint(r)}var YB=` `;function JB(e){return YB.includes(e)}function U0(e){let t=new Set,r=new Set;for(let n of e)JB(n)?t.add(n):r.add(n);return{whitespace:t,nonWhitespace:r}}function O7(e,t,r,n,i){if(t==="")return e===""?{words:[],wordStarts:[]}:(Ba(0,r),{words:[e],wordStarts:[0]});let{whitespace:a,nonWhitespace:s}=U0(t),o=[],l=[],u=0;for(;u=e.length)return{words:[],wordStarts:[]};if(s.has(e[u]))for(vh(o,l,"",u,r),u++;u=n);){let c=u;for(;u=e.length)break;for(;u=n);)for(vh(o,l,"",u,r),u++;uu&&(o=!0),s>=e.length)return{words:[],hadLeadingDelimiter:!0,hadTrailingDelimiter:!0};if(i.has(e[s]))for(Ba(a.length,r),a.push(""),s++;s=e.length){l=!1;break}let p=s;for(;s=e.length&&s>p&&(l=!0)}return{words:a,hadLeadingDelimiter:o,hadTrailingDelimiter:l}}function _t(e,t,r){return z0(e,t,r).words}function eU(e,t){for(let r of e)if(t.has(r))return!0;return!1}function tU(e,t,r){if(t==="")return e;let{whitespace:n,nonWhitespace:i}=U0(t),a=e.length;for(;a>0&&n.has(e[a-1]);){if(!r&&a>=2){let o=0,l=a-2;for(;l>=0&&e[l]==="\\";)o++,l--;if(o%2===1)break}a--}let s=e.substring(0,a);if(s.length>=1&&i.has(s[s.length-1])){if(!r&&s.length>=2){let l=0,u=s.length-2;for(;u>=0&&s[u]==="\\";)l++,u--;if(l%2===1)return s}let o=s.substring(0,s.length-1);if(!eU(o,i))return o}return s}function Kt(e,t){return e.state.namerefs?.has(t)??!1}function Ra(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function rU(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function nU(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function tA(e,t){return e.state.invalidNamerefs?.has(t)??!1}function I7(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function B1(e,t){let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(r){let n=r[1],i=Hn(e,n),a=e.state.associativeArrays?.has(n)??!1;return i||a}return Hn(e,t)?!0:e.state.env.has(t)}function pi(e,t,r=100){if(!Kt(e,t)||tA(e,t))return t;let n=new Set,i=t;for(;r-- >0;){if(n.has(i))return;if(n.add(i),!Kt(e,i))return i;let a=e.state.env.get(i);if(a===void 0||a===""||!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(a))return i;i=a}}function mp(e,t){if(Kt(e,t))return e.state.env.get(t)}function rA(e,t,r,n=100){if(!Kt(e,t)||tA(e,t))return t;let i=new Set,a=t;for(;n-- >0;){if(i.has(a))return;if(i.add(a),!Kt(e,a))return a;let s=e.state.env.get(a);if(s===void 0||s==="")return r!==void 0?/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&B1(e,r)?a:null:a;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(s))return a;a=s}}function nA(e,t){let r=t.replace(/\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g,(n,i)=>e.state.env.get(i)??"");return r=r.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(n,i)=>e.state.env.get(i)??""),r}function Ye(e,t){return t==="FUNCNAME"?(e.state.funcNameStack??[]).map((r,n)=>[n,r]):t==="BASH_LINENO"?(e.state.callLineStack??[]).map((r,n)=>[n,String(r)]):t==="BASH_SOURCE"?(e.state.sourceStack??[]).map((r,n)=>[n,r]):e.state.associativeArrays?.has(t)?Js(e,t).map(r=>[r,Nt(e,t,r)??""]):Vr(e,t).map(r=>[r,Nt(e,t,r)??""])}function Qa(e,t){return t==="FUNCNAME"?(e.state.funcNameStack?.length??0)>0:t==="BASH_LINENO"?(e.state.callLineStack?.length??0)>0:t==="BASH_SOURCE"?(e.state.sourceStack?.length??0)>0:(e.state.associativeArrays?.has(t),Hn(e,t))}async function wt(e,t,r=!0){switch(t){case"?":return String(e.state.lastExitCode);case"$":return String(e.state.virtualPid);case"#":return e.state.env.get("#")||"0";case"@":return e.state.env.get("@")||"";case"_":return e.state.lastArg;case"-":{let a="";return a+="h",e.state.options.errexit&&(a+="e"),e.state.options.noglob&&(a+="f"),e.state.options.nounset&&(a+="u"),e.state.options.verbose&&(a+="v"),e.state.options.xtrace&&(a+="x"),a+="B",e.state.options.noclobber&&(a+="C"),a+="s",a}case"*":{let a=Number.parseInt(e.state.env.get("#")||"0",10);if(a===0)return"";let s=[];for(let o=1;o<=a;o++)s.push(e.state.env.get(String(o))||"");return s.join(Ke(e.state.env))}case"0":return e.state.env.get("0")||"bash";case"PWD":return e.state.env.get("PWD")??"";case"OLDPWD":return e.state.env.get("OLDPWD")??"";case"PPID":return String(e.state.virtualPpid);case"UID":return String(e.state.virtualUid);case"EUID":return String(e.state.virtualUid);case"RANDOM":return String(Math.floor(Math.random()*32768));case"SECONDS":return String(Math.floor((Date.now()-e.state.startTime)/1e3));case"BASH_VERSION":return hF;case"!":return String(e.state.lastBackgroundPid);case"BASHPID":return String(e.state.bashPid);case"LINENO":return String(e.state.currentLine);case"FUNCNAME":{let a=e.state.funcNameStack?.[0];if(a!==void 0)return a;if(r&&e.state.options.nounset)throw new gn("FUNCNAME");return""}case"BASH_LINENO":{let a=e.state.callLineStack?.[0];if(a!==void 0)return String(a);if(r&&e.state.options.nounset)throw new gn("BASH_LINENO");return""}case"BASH_SOURCE":{let a=e.state.sourceStack?.[0];if(a!==void 0)return a;if(r&&e.state.options.nounset)throw new gn("BASH_SOURCE");return""}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new Ti(`\${${t}}`);let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let a=n[1],s=n[2];if(Kt(e,a)){let u=pi(e,a);if(u&&u!==a){if(u.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return"";a=u}}if(s==="@"||s==="*"){let u=Ye(e,a);if(u.length>0){let p=s==="*"?Ke(e.state.env):" ",d=K(p)*(u.length-1);for(let[,f]of u)if(d+=K(f),d>e.limits.maxStringLength)throw new T(`array expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return u.map(([,f])=>f).join(p)}let c=e.state.env.get(a);return c!==void 0?c:""}if(a==="FUNCNAME"){let u=Number.parseInt(s,10);return!Number.isNaN(u)&&u>=0?e.state.funcNameStack?.[u]??"":""}if(a==="BASH_LINENO"){let u=Number.parseInt(s,10);if(!Number.isNaN(u)&&u>=0){let c=e.state.callLineStack?.[u];return c!==void 0?String(c):""}return""}if(a==="BASH_SOURCE"){let u=Number.parseInt(s,10);return!Number.isNaN(u)&&u>=0?e.state.sourceStack?.[u]??"":""}if(e.state.associativeArrays?.has(a)){let u=M0(s);u=nA(e,u);let c=Nt(e,a,u);if(c===void 0&&r&&e.state.options.nounset)throw new gn(`${a}[${s}]`);return c||""}let o;if(/^-?\d+$/.test(s))o=Number.parseInt(s,10);else try{let u=new ft,c=Ut(u,s);o=await xt(e,c.expression)}catch{let u=e.state.env.get(s);o=u?Number.parseInt(u,10):0,Number.isNaN(o)&&(o=0)}if(o<0){let u=Ye(e,a),c=e.state.currentLine;if(u.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${c}: ${a}: bad array subscript `,"";let p=Math.max(...u.map(([d])=>typeof d=="number"?d:0))+1+o;return p<0?(e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${c}: ${a}: bad array subscript `,""):Nt(e,a,p)||""}let l=Nt(e,a,o);if(l!==void 0)return l;if(o===0){let u=e.state.env.get(a);if(u!==void 0)return u}if(r&&e.state.options.nounset)throw new gn(`${a}[${o}]`);return""}if(/^[1-9][0-9]*$/.test(t)){let a=e.state.env.get(t);if(a===void 0&&r&&e.state.options.nounset)throw new gn(t);return a||""}if(Kt(e,t)){let a=pi(e,t);if(a===void 0)return"";if(a!==t)return await wt(e,a,r);let s=e.state.env.get(t);if((s===void 0||s==="")&&r&&e.state.options.nounset)throw new gn(t);return s||""}let i=e.state.env.get(t);if(i!==void 0)return e.state.tempEnvBindings?.some(a=>a.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),i;if(Qa(e,t)){let a=Nt(e,t,0);if(a!==void 0)return a;if(r&&e.state.options.nounset)throw new gn(t);return""}if(r&&e.state.options.nounset)throw new gn(t);return""}async function eo(e,t){if(new Set(["?","$","#","_","-","0","PPID","UID","EUID","RANDOM","SECONDS","BASH_VERSION","!","BASHPID","LINENO"]).has(t))return!0;if(t==="@"||t==="*")return Number.parseInt(e.state.env.get("#")||"0",10)>0;if(t==="PWD"||t==="OLDPWD")return e.state.env.has(t);let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(r){let n=r[1],i=r[2];if(Kt(e,n)){let s=pi(e,n);if(s&&s!==n){if(s.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;n=s}}if(i==="@"||i==="*")return Ye(e,n).length>0?!0:e.state.env.has(n);if(e.state.associativeArrays?.has(n)){let s=nA(e,M0(i));return Fs(e,n,s)}let a;if(/^-?\d+$/.test(i))a=Number.parseInt(i,10);else try{let s=new ft,o=Ut(s,i);a=await xt(e,o.expression)}catch{let s=e.state.env.get(i);a=s?Number.parseInt(s,10):0,Number.isNaN(a)&&(a=0)}if(a<0){let s=Ye(e,n);if(s.length===0)return!1;let o=Math.max(...s.map(([l])=>typeof l=="number"?l:0))+1+a;return o<0?!1:Fs(e,n,o)}return Fs(e,n,a)}if(Kt(e,t)){let n=pi(e,t);return n===void 0||n===t?e.state.env.has(t):eo(e,n)}return e.state.env.has(t)?!0:Qa(e,t)?Fs(e,t,0):!1}async function iU(e,t){let r="",n=0;for(;n0;)t[a]==="{"?i++:t[a]==="}"&&i--,a++;r+=t.slice(n,a),n=a;continue}if(t[n+1]==="("){let i=1,a=n+2;for(;a0;)t[a]==="("?i++:t[a]===")"&&i--,a++;r+=t.slice(n,a),n=a;continue}if(/[a-zA-Z_]/.test(t[n+1]||"")){let i=n+1;for(;i0;)r[l]==="("&&r[l-1]==="$"||r[l]==="("?o++:r[l]===")"&&o--,l++;let u=r.slice(s+2,l-1);if(e.execFn){let c=await e.execFn(u,{signal:e.state.signal});a+=c.stdout.replace(/\n+$/,""),c.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+c.stderr)}s=l}else if(r[s+1]==="{"){let o=1,l=s+2;for(;l0;)r[l]==="{"?o++:r[l]==="}"&&o--,l++;let u=r.slice(s+2,l-1),c=await wt(e,u);a+=c,s=l}else if(/[a-zA-Z_]/.test(r[s+1]||"")){let o=s+1;for(;o=r.maxResults)return!1;let i=K(t);if(i>r.maxStringBytes-n.value)throw new T(`brace expansion string limit exceeded (${r.maxStringBytes} bytes)`,"string_length");return e.push(t),n.value+=i,!0}function aU(e,t,r,n,i,a=q0){let s=r??1;s===0&&(s=1);let o=Math.abs(s),l=[],u=0;if(n?.match(/^-?0\d/)&&(u=Math.max(u,n.replace(/^-/,"").length)),i?.match(/^-?0\d/)&&(u=Math.max(u,i.replace(/^-/,"").length)),u>a.maxStringBytes)throw new T(`brace expansion padding limit exceeded (${a.maxStringBytes} bytes)`,"string_length");let c={value:0},p=d=>{if(u>0){let f=d<0,h=String(Math.abs(d)).padStart(u,"0");return f?`-${h}`:h}return String(d)};if(e<=t)for(let d=e,f=0;d<=t&&f=t&&f="A"&&e<="Z",u=e>="a"&&e<="z",c=t>="A"&&t<="Z",p=t>="a"&&t<="z";if(l&&p||u&&c){let h=r!==void 0?`..${r}`:"";throw new c0(`{${e}..${t}${h}}: invalid sequence`)}let d=[],f={value:0};if(a<=s)for(let h=a,m=0;h<=s&&m=s&&mAt(c,t,r)),u=l.length>0?l.join("|"):"(?:)";a==="@"?n+=`(?:${u})`:a==="*"?n+=`(?:${u})*`:a==="+"?n+=`(?:${u})+`:a==="?"?n+=`(?:${u})?`:a==="!"&&(n+=`(?!(?:${u})$).*`),i=s+1;continue}}if(a==="\\")if(i+10;){let i=e[n];if(i==="\\"){n+=2;continue}if(i==="(")r++;else if(i===")"&&(r--,r===0))return n;n++}return-1}function uU(e){let t=[],r="",n=0,i=0;for(;i0&&rnew T(`pattern replacement: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length"));r.lastIndex=0;let s=0,o=r.exec(t);for(;o!==null&&(e.executionScope.consumeLimited("pattern_operations",1,e.limits.maxGlobOperations,"pattern replacement"),!(i&&o[0].length===0&&o.index===t.length||(a.append(t.slice(s,o.index)),a.append(n),s=o.index+o[0].length,!i)));)o[0].length===0&&(s++,r.lastIndex<=o.index&&(r.lastIndex=o.index+1)),o=r.exec(t);return a.append(t.slice(s)),r.lastIndex=0,a.build()}ir();J();function sA(e){let t=[],r=0;return{append(n){let i=K(n);if(i>e-r)throw new T(`prompt expansion exceeds string length limit (${e} bytes)`,"string_length");n&&t.push(n),r+=i},build:()=>t.join("")}}function hU(e,t,r){let n=(s,o=2)=>String(s).padStart(o,"0");if(e===""){let s=n(t.getHours()),o=n(t.getMinutes()),l=n(t.getSeconds());return`${s}:${o}:${l}`}let i=sA(r),a=0;for(;a=e.length){i.append("%"),a++;continue}let s=e[a+1];switch(s){case"H":i.append(n(t.getHours()));break;case"M":i.append(n(t.getMinutes()));break;case"S":i.append(n(t.getSeconds()));break;case"d":i.append(n(t.getDate()));break;case"m":i.append(n(t.getMonth()+1));break;case"Y":i.append(String(t.getFullYear()));break;case"y":i.append(n(t.getFullYear()%100));break;case"I":{let o=t.getHours()%12;o===0&&(o=12),i.append(n(o));break}case"p":i.append(t.getHours()<12?"AM":"PM");break;case"P":i.append(t.getHours()<12?"am":"pm");break;case"%":i.append("%");break;case"a":{let o=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];i.append(o[t.getDay()]);break}case"b":{let o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];i.append(o[t.getMonth()]);break}default:i.append(`%${s}`)}a+=2}else i.append(e[a]),a++;return i.build()}function z1(e,t){let r=sA(e.limits.maxStringLength),n=0,i=e.state.env.get("USER")||e.state.env.get("LOGNAME")||"user",a=e.state.env.get("HOSTNAME")||"localhost",s=a.split(".")[0],o=e.state.env.get("PWD")||"/",l=e.state.env.get("HOME")||"/",u=o.startsWith(l)?`~${o.slice(l.length)}`:o,c=o.split("/").pop()||o,p=new Date,d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],f=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],h=e.state.env.get("__COMMAND_NUMBER")||"1";for(;n=t.length){r.append("\\"),n++;continue}let g=t[n+1];if(g>="0"&&g<="7"){let x="",y=n+1;for(;y="0"&&t[y]<="7";)x+=t[y],y++;let b=Number.parseInt(x,8)%256;r.append(String.fromCharCode(b)),n=y;continue}switch(g){case"\\":r.append("\\"),n+=2;break;case"a":r.append("\x07"),n+=2;break;case"e":r.append("\x1B"),n+=2;break;case"n":r.append(` `),n+=2;break;case"r":r.append("\r"),n+=2;break;case"$":r.append("$"),n+=2;break;case"[":case"]":n+=2;break;case"u":r.append(i),n+=2;break;case"h":r.append(s),n+=2;break;case"H":r.append(a),n+=2;break;case"w":r.append(u),n+=2;break;case"W":r.append(c),n+=2;break;case"d":{let x=String(p.getDate()).padStart(2," ");r.append(`${d[p.getDay()]} ${f[p.getMonth()]} ${x}`),n+=2;break}case"t":{let x=String(p.getHours()).padStart(2,"0"),y=String(p.getMinutes()).padStart(2,"0"),b=String(p.getSeconds()).padStart(2,"0");r.append(`${x}:${y}:${b}`),n+=2;break}case"T":{let x=p.getHours()%12;x===0&&(x=12);let y=String(x).padStart(2,"0"),b=String(p.getMinutes()).padStart(2,"0"),k=String(p.getSeconds()).padStart(2,"0");r.append(`${y}:${b}:${k}`),n+=2;break}case"@":{let x=p.getHours()%12;x===0&&(x=12);let y=String(x).padStart(2,"0"),b=String(p.getMinutes()).padStart(2,"0"),k=p.getHours()<12?"AM":"PM";r.append(`${y}:${b} ${k}`),n+=2;break}case"A":{let x=String(p.getHours()).padStart(2,"0"),y=String(p.getMinutes()).padStart(2,"0");r.append(`${x}:${y}`),n+=2;break}case"D":if(n+20&&e.state.localScopes[e.state.localScopes.length-1].has(t)&&!r){for(e.state.localExportedVars||(e.state.localExportedVars=[]);e.state.localExportedVars.length0?String(a.length):e.state.env.get(i)!==void 0?"1":"0"}if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)&&Qa(e,t)){if(t==="FUNCNAME"){let a=e.state.funcNameStack?.[0]||"";return String([...a].length)}if(t==="BASH_LINENO"){let a=e.state.callLineStack?.[0];return String(a!==void 0?[...String(a)].length:0)}let i=Nt(e,t,0)||"";return String([...i].length)}return String([...r].length)}async function vU(e,t,r,n){e.coverage?.hit("bash:expansion:substring");let i=await xt(e,n.offset.expression),a=n.length?await xt(e,n.length.expression):void 0;if(t==="@"||t==="*"){let u=Number.parseInt(e.state.env.get("#")||"0",10),c=[];for(let h=1;h<=u;h++)c.push(e.state.env.get(String(h))||"");let p=e.state.env.get("0")||"bash",d,f;if(i<=0)if(d=[p,...c],i<0){if(f=d.length+i,f<0)return""}else f=0;else d=c,f=i-1;if(f<0||f>=d.length)return"";if(a!==void 0){let h=a<0?d.length+a:f+a;return d.slice(f,Math.max(f,h)).join(" ")}return d.slice(f).join(" ")}let s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(s){let u=s[1];if(e.state.associativeArrays?.has(u))throw new at(1,"",`bash: \${${u}[@]: 0: 3}: bad substitution `);let c=Ye(e,u),p=0;if(i<0){if(c.length>0){let d=c[c.length-1][0],f=(typeof d=="number"?d:0)+1+i;if(f<0||(p=c.findIndex(([h])=>typeof h=="number"&&h>=f),p<0))return""}}else if(p=c.findIndex(([d])=>typeof d=="number"&&d>=i),p<0)return"";if(a!==void 0){if(a<0)throw new Mt(`${s[1]}[@]: substring expression < 0`);return c.slice(p,p+a).map(([,d])=>d).join(" ")}return c.slice(p).map(([,d])=>d).join(" ")}let o=[...r],l=i;if(l<0&&(l=Math.max(0,o.length+l)),a!==void 0){if(a<0){let u=o.length+a;return o.slice(l,Math.max(l,u)).join("")}return o.slice(l,l+a).join("")}return o.slice(l).join("")}async function EU(e,t,r,n,i){if(e.coverage?.hit("bash:expansion:case_modification"),r.pattern){let a=e.state.shoptOptions.extglob,s="";for(let p of r.pattern.parts)if(p.type==="Glob")s+=At(p.pattern,!0,a);else if(p.type==="Literal")s+=At(p.value,!0,a);else if(p.type==="SingleQuoted"||p.type==="Escaped")s+=Ot(p.value);else if(p.type==="DoubleQuoted"){let d=await n(e,p.parts);s+=Ot(d)}else if(p.type==="ParameterExpansion"){let d=await i(e,p);s+=At(d,!0,a)}let o=Ie(`^(?:${s})$`),l=r.direction==="upper"?p=>p.toUpperCase():p=>p.toLowerCase(),u="",c=!1;for(let p of t)!r.all&&c?u+=p:o.test(p)?(u+=l(p),c=!0):u+=p;return u}return r.direction==="upper"?r.all?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1):r.all?t.toLowerCase():t.charAt(0).toLowerCase()+t.slice(1)}function SU(e,t,r,n,i){e.coverage?.hit("bash:expansion:transform");let a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(a&&i.operator==="Q")return Ye(e,a[1]).map(([,o])=>Bs(o)).join(" ");if(a&&i.operator==="a")return rl(e,a[1]);let s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[.+\]$/);if(s&&i.operator==="a")return rl(e,s[1]);switch(i.operator){case"Q":return n?"":Bs(r);case"P":return z1(e,r);case"a":return rl(e,t);case"A":return n?"":`${t}=${Bs(r)}`;case"E":return r.replace(/\\([\\abefnrtv'"?])/g,(o,l)=>{switch(l){case"\\":return"\\";case"a":return"\x07";case"b":return"\b";case"e":return"\x1B";case"f":return"\f";case"n":return` `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"'":return"'";case'"':return'"';case"?":return"?";default:return l}});case"K":case"k":return n?"":Bs(r);case"u":return r.charAt(0).toUpperCase()+r.slice(1);case"U":return r.toUpperCase();case"L":return r.toLowerCase();default:return r}}async function AU(e,t,r,n,i,a,s=!1){if(e.coverage?.hit("bash:expansion:indirection"),Kt(e,t))return mp(e,t)||"";let o=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(n){if(i.innerOp?.type==="UseAlternative")return"";throw new Ti(`\${!${t}}`)}let l=r;if(o&&(l===""||l.includes(" ")))throw new Ti(`\${!${t}}`);let u=l.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(u&&u[1].includes("~"))throw new Ti(`\${!${t}}`);if(i.innerOp){let c={type:"ParameterExpansion",parameter:l,operation:i.innerOp};return a(e,c,s)}return await wt(e,l)}function CU(e,t){e.coverage?.hit("bash:expansion:array_keys");let r=Ye(e,t.array).map(([n])=>String(n));return t.star?r.join(Ke(e.state.env)):r.join(" ")}function kU(e,t){e.coverage?.hit("bash:expansion:var_name_prefix");let r=H0(e,t.prefix);return t.star?r.join(Ke(e.state.env)):r.join(" ")}function NU(e,t,r,n){let i=Number.parseInt(e.state.env.get("#")||"0",10),a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t==="*")return{isEmpty:i===0,effectiveValue:r};if(t==="@")return{isEmpty:i===0||i===1&&e.state.env.get("1")==="",effectiveValue:r};if(a){let[,s,o]=a,l=Ye(e,s);return l.length===0?{isEmpty:!0,effectiveValue:""}:o==="*"?{isEmpty:n?r==="":!1,effectiveValue:r}:{isEmpty:l.length===1&&l.every(([,u])=>u===""),effectiveValue:r}}return{isEmpty:r==="",effectiveValue:r}}J();function Us(e,t){e.lastExitCode=t,e.env.set("?",String(t)),e.lastSubstitutionExitCode=t}function TU(e){switch(e.operator){case"<":case"<&":case"<<":case"<<-":case"<<<":case"<>":return e.fd===null||e.fd===0;default:return!1}}function Eh(e,t){return t.some(TU)?0:e.lastSubstitutionExitCode??0}function _U(e){let t=0;for(;t0;){let s=e[n];if(s==="\\"&&!i&&n+1pA(e,r)).join(":")}J();J();function Kr(e,t,r,n){if(e.length>r-t.length)throw new T(`${n} element limit exceeded (${r})`,"array_elements");for(let i of t)e.push(i)}Dt();async function DU(e,t,r,n){let i="";for(let a of t.parts)if(a.type==="Glob")i+=At(a.pattern,!0,e.state.shoptOptions.extglob);else if(a.type==="Literal")i+=At(a.value,!0,e.state.shoptOptions.extglob);else if(a.type==="SingleQuoted"||a.type==="Escaped")i+=Ot(a.value);else if(a.type==="DoubleQuoted"){let s=await r(e,a.parts);i+=Ot(s)}else if(a.type==="ParameterExpansion"){let s=await n(e,a);i+=At(s,!0,e.state.shoptOptions.extglob)}else{let s=await n(e,a);i+=Ot(s)}return i}async function RU(e,t,r,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="PatternReplacement")return null;let a=i.parts[0],s=a.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let o=s[1],l=s[2]==="*",u=a.operation,c=Ye(e,o),p=c.map(([,g])=>g);if(c.length===0){let g=e.state.env.get(o);g!==void 0&&p.push(g)}if(p.length===0)return{values:[],quoted:!0};let d="";u.pattern&&(d=await DU(e,u.pattern,r,n));let f=u.replacement?await r(e,u.replacement.parts):"",h=d;u.anchor==="start"?h=`^${d}`:u.anchor==="end"&&(h=`${d}$`);let m=[];try{let g=Ie(h,u.all?"g":"");for(let x of p)m.push(g.replace(x,f))}catch{m.push(...p)}if(l){let g=Ke(e.state.env);return{values:[m.join(g)],quoted:!0}}return{values:m,quoted:!0}}async function LU(e,t,r,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="PatternRemoval")return null;let a=i.parts[0],s=a.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let o=s[1],l=s[2]==="*",u=a.operation,c=Ye(e,o),p=c.map(([,h])=>h);if(c.length===0){let h=e.state.env.get(o);h!==void 0&&p.push(h)}if(p.length===0)return{values:[],quoted:!0};let d=u.pattern?await gp(e,u.pattern,u.greedy,r,n):"",f=[];for(let h of p)f.push(to(e,h,d,u.side,u.greedy));if(l){let h=Ke(e.state.env);return{values:[f.join(h)],quoted:!0}}return{values:f,quoted:!0}}Dt();async function MU(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!=="ParameterExpansion"||r.parts[0].operation?.type!=="DefaultValue"&&r.parts[0].operation?.type!=="UseAlternative"&&r.parts[0].operation?.type!=="AssignDefault")return null;let n=r.parts[0];if(n.operation?.type==="AssignDefault"&&/^(?:\d+|[@*#?$!-])$/.test(n.parameter))return null;let i=n.operation,a=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(i.type==="AssignDefault"&&(!a||a[2]==="*"))return null;let s,o=!1;if(a){let l=a[1];o=a[2]==="*";let u=Ye(e,l),c=u.length>0||e.state.env.has(l),p=u.length===0||u.length===1&&u.every(([,f])=>f===""),d=i.checkEmpty??!1;if(i.type==="UseAlternative"?s=c&&!(d&&p):s=!c||d&&p,!s){if(u.length>0){let h=u.map(([,m])=>m);if(o){let m=Ke(e.state.env);return{values:[h.join(m)],quoted:!0}}return{values:h,quoted:!0}}let f=e.state.env.get(l);return f!==void 0?{values:[f],quoted:!0}:{values:[],quoted:!0}}}else{let l=n.parameter,u=await eo(e,l),c=await wt(e,l,!1),p=c==="",d=i.checkEmpty??!1;if(i.type==="UseAlternative"?s=u&&!(d&&p):s=!u||d&&p,!s)return{values:[c],quoted:!0}}if(i.type==="AssignDefault")return null;if(s&&i.word){let l=i.word.parts,u=null,c=!1;for(let p of l)if(p.type==="ParameterExpansion"&&!p.operation){let d=p.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(d){u=d[1],c=d[2]==="*";break}}if(u){let p=Ye(e,u);if(p.length>0){let f=p.map(([,h])=>h);if(c||o){let h=Ke(e.state.env);return{values:[f.join(h)],quoted:!0}}return{values:f,quoted:!0}}let d=e.state.env.get(u);return d!==void 0?{values:[d],quoted:!0}:{values:[],quoted:!0}}}return null}async function PU(e,t,r,n,i){if(!r||t.length!==1||t[0].type!=="DoubleQuoted")return null;let a=t[0],s=-1,o="",l=!1,u=null;for(let h=0;hh);if(d.length===0){let h=e.state.env.get(o);if(h!==void 0)f=[h];else{if(l)return{values:[c+p],quoted:!0};let m=c+p;return{values:m?[m]:[],quoted:!0}}}if(u?.type==="PatternRemoval"){let h=u,m=h.pattern?await gp(e,h.pattern,h.greedy,i,n):"";f=f.map(g=>to(e,g,m,h.side,h.greedy))}else if(u?.type==="PatternReplacement"){let h=u,m="";if(h.pattern)for(let y of h.pattern.parts)if(y.type==="Glob")m+=At(y.pattern,!0,e.state.shoptOptions.extglob);else if(y.type==="Literal")m+=At(y.value,!0,e.state.shoptOptions.extglob);else if(y.type==="SingleQuoted"||y.type==="Escaped")m+=Ot(y.value);else if(y.type==="DoubleQuoted"){let b=await i(e,y.parts);m+=Ot(b)}else if(y.type==="ParameterExpansion"){let b=await n(e,y);m+=At(b,!0,e.state.shoptOptions.extglob)}else{let b=await n(e,y);m+=Ot(b)}let g=h.replacement?await i(e,h.replacement.parts):"",x=m;h.anchor==="start"?x=`^${m}`:h.anchor==="end"&&(x=`${m}$`);try{let y=Ie(x,h.all?"g":"");f=f.map(b=>y.replace(b,g))}catch{}}if(l){let h=Ke(e.state.env);return{values:[c+f.join(h)+p],quoted:!0}}return f.length===1?{values:[c+f[0]+p],quoted:!0}:{values:[c+f[0],...f.slice(1,-1),f[f.length-1]+p],quoted:!0}}async function FU(e,t,r,n){if(!r||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0],a=-1,s="",o=!1;for(let d=0;dd);if(c.length===0){let d=e.state.env.get(s);if(d!==void 0)return{values:[l+d+u],quoted:!0};if(o)return{values:[l+u],quoted:!0};let f=l+u;return{values:f?[f]:[],quoted:!0}}if(o){let d=Ke(e.state.env);return{values:[l+p.join(d)+u],quoted:!0}}return p.length===1?{values:[l+p[0]+u],quoted:!0}:{values:[l+p[0],...p.slice(1,-1),p[p.length-1]+u],quoted:!0}}ir();J();async function BU(e,t,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation?.type!=="Substring")return null;let i=n.parts[0],a=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!a)return null;let s=a[1],o=a[2]==="*",l=i.operation;if(e.state.associativeArrays?.has(s))throw new at(1,"",`bash: \${${s}[@]: 0: 3}: bad substitution `);let u=l.offset?await r(e,l.offset.expression):0,c=l.length?await r(e,l.length.expression):void 0,p=Ye(e,s);if(p.length>e.limits.maxArrayElements)throw new T(`array transform element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let d=0;if(u<0){if(p.length>0){let h=p[p.length-1][0],m=(typeof h=="number"?h:0)+1+u;if(m<0)return{values:[],quoted:!0};d=p.findIndex(([g])=>typeof g=="number"&&g>=m),d<0&&(d=p.length)}}else d=p.findIndex(([h])=>typeof h=="number"&&h>=u),d<0&&(d=p.length);let f;if(c!==void 0){if(c<0)throw new Mt(`${s}[@]: substring expression < 0`);f=p.slice(d,d+c).map(([,h])=>h)}else f=p.slice(d).map(([,h])=>h);if(f.length===0)return{values:[],quoted:!0};if(o){let h=Ke(e.state.env);return{values:[f.join(h)],quoted:!0}}return{values:f,quoted:!0}}function UU(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!=="ParameterExpansion"||r.parts[0].operation?.type!=="Transform")return null;let n=r.parts[0],i=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!i)return null;let a=i[1],s=i[2]==="*",o=n.operation,l=Ye(e,a);if(l.length===0){let d=e.state.env.get(a);if(d!==void 0){let f;switch(o.operator){case"a":f="";break;case"P":f=z1(e,d);break;case"Q":f=Bs(d);break;default:f=d}if(K(f)>e.limits.maxStringLength)throw new T(`array transform string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[f],quoted:!0}}return s?{values:[""],quoted:!0}:{values:[],quoted:!0}}let u=rl(e,a),c=[],p=0;for(let[,d]of l){let f;switch(o.operator){case"a":f=u;break;case"P":f=z1(e,d);break;case"Q":f=Bs(d);break;case"u":f=d.charAt(0).toUpperCase()+d.slice(1);break;case"U":f=d.toUpperCase();break;case"L":f=d.toLowerCase();break;default:f=d}let h=K(f);if(h>e.limits.maxStringLength-p)throw new T(`array transform string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");c.push(f),p+=h}if(s){let d=Ke(e.state.env);if(Math.max(0,c.length-1)*K(d)>e.limits.maxStringLength-p)throw new T(`array transform string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[c.join(d)],quoted:!0}}return{values:c,quoted:!0}}function zU(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!=="ParameterExpansion")return null;let n=r.parts[0];if(n.operation)return null;let i=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!i)return null;let a=i[1];if(Kt(e,a)){let l=mp(e,a);if(l?.endsWith("[@]")||l?.endsWith("[*]"))return{values:[],quoted:!0}}let s=Ye(e,a);if(s.length>0)return{values:s.map(([,l])=>l),quoted:!0};let o=e.state.env.get(a);return o!==void 0?{values:[o],quoted:!0}:{values:[],quoted:!0}}function qU(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!=="ParameterExpansion"||r.parts[0].operation)return null;let n=r.parts[0].parameter;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)||!Kt(e,n))return null;let i=mp(e,n);if(!i)return null;let a=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!a)return null;let s=a[1],o=Ye(e,s);if(o.length>0)return{values:o.map(([,u])=>u),quoted:!0};let l=e.state.env.get(s);return l!==void 0?{values:[l],quoted:!0}:{values:[],quoted:!0}}J();async function HU(e,t,r,n,i){if(!r||t.length!==1||t[0].type!=="DoubleQuoted")return null;let a=t[0];if(a.parts.length!==1||a.parts[0].type!=="ParameterExpansion"||a.parts[0].operation?.type!=="Indirection")return null;let s=a.parts[0],o=s.operation,l=await wt(e,s.parameter),u=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!u){if(!o.innerOp&&(l==="@"||l==="*")){let h=Number.parseInt(e.state.env.get("#")||"0",10),m=[];for(let g=1;g<=h;g++)m.push(e.state.env.get(String(g))||"");return l==="*"?{values:[m.join(Ke(e.state.env))],quoted:!0}:{values:m,quoted:!0}}return null}let c=u[1],p=u[2]==="*",d=Ye(e,c);if(o.innerOp){if(o.innerOp.type==="Substring")return WU(e,d,c,p,o.innerOp);if(o.innerOp.type==="DefaultValue"||o.innerOp.type==="UseAlternative"||o.innerOp.type==="AssignDefault"||o.innerOp.type==="ErrorIfUnset")return jU(e,d,c,p,o.innerOp,i);if(o.innerOp.type==="Transform"&&o.innerOp.operator==="a"){let m=rl(e,c),g=d.map(()=>m);return p?{values:[g.join(Ke(e.state.env))],quoted:!0}:{values:g,quoted:!0}}let h=[];for(let[,m]of d){let g={type:"ParameterExpansion",parameter:"_indirect_elem_",operation:o.innerOp},x=e.state.env.get("_indirect_elem_");e.state.env.set("_indirect_elem_",m);try{let y=await n(e,g,!0);h.push(y)}finally{x!==void 0?e.state.env.set("_indirect_elem_",x):e.state.env.delete("_indirect_elem_")}}return p?{values:[h.join(Ke(e.state.env))],quoted:!0}:{values:h,quoted:!0}}if(d.length>0){let h=d.map(([,m])=>m);return p?{values:[h.join(Ke(e.state.env))],quoted:!0}:{values:h,quoted:!0}}let f=e.state.env.get(c);return f!==void 0?{values:[f],quoted:!0}:{values:[],quoted:!0}}async function WU(e,t,r,n,i){let a=i.offset?await xt(e,i.offset.expression):0,s=i.length?await xt(e,i.length.expression):void 0,o=0;if(a<0){if(t.length>0){let c=t[t.length-1][0],p=(typeof c=="number"?c:0)+1+a;if(p<0)return{values:[],quoted:!0};if(o=t.findIndex(([d])=>typeof d=="number"&&d>=p),o<0)return{values:[],quoted:!0}}}else if(o=t.findIndex(([c])=>typeof c=="number"&&c>=a),o<0)return{values:[],quoted:!0};let l;if(s!==void 0){if(s<0)throw new Mt(`${r}[@]: substring expression < 0`);l=t.slice(o,o+s)}else l=t.slice(o);let u=l.map(([,c])=>c);return n?{values:[u.join(Ke(e.state.env))],quoted:!0}:{values:u,quoted:!0}}async function jU(e,t,r,n,i,a){let s=i.checkEmpty??!1,o=t.map(([,c])=>c),l=t.length===0,u=t.length===0;if(i.type==="UseAlternative")return!u&&!(s&&l)&&i.word?{values:[await a(e,i.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(i.type==="DefaultValue")return(u||s&&l)&&i.word?{values:[await a(e,i.word.parts,!0)],quoted:!0}:n?{values:[o.join(Ke(e.state.env))],quoted:!0}:{values:o,quoted:!0};if(i.type==="AssignDefault"){if((u||s&&l)&&i.word){let c=await a(e,i.word.parts,!0);return je(e,r,0,c),{values:[c],quoted:!0}}return n?{values:[o.join(Ke(e.state.env))],quoted:!0}:{values:o,quoted:!0}}return n?{values:[o.join(Ke(e.state.env))],quoted:!0}:{values:o,quoted:!0}}async function GU(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="UseAlternative"&&t[0].operation?.type!=="DefaultValue")return null;let r=t[0],n=r.operation,i=n?.word;if(!i||i.parts.length!==1||i.parts[0].type!=="DoubleQuoted")return null;let a=i.parts[0];if(a.parts.length!==1||a.parts[0].type!=="ParameterExpansion"||a.parts[0].operation?.type!=="Indirection")return null;let s=a.parts[0],o=(await wt(e,s.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let l=await eo(e,r.parameter),u=await wt(e,r.parameter)==="",c=n.checkEmpty??!1,p;if(n.type==="UseAlternative"?p=l&&!(c&&u):p=!l||c&&u,p){let d=o[1],f=o[2]==="*",h=Ye(e,d);if(h.length>0){let g=h.map(([,x])=>x);return f?{values:[g.join(Ke(e.state.env))],quoted:!0}:{values:g,quoted:!0}}let m=e.state.env.get(d);return m!==void 0?{values:[m],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}async function VU(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="Indirection")return null;let r=t[0],n=r.operation.innerOp;if(!n||n.type!=="UseAlternative"&&n.type!=="DefaultValue")return null;let i=n.word;if(!i||i.parts.length!==1||i.parts[0].type!=="DoubleQuoted")return null;let a=i.parts[0];if(a.parts.length!==1||a.parts[0].type!=="ParameterExpansion"||a.parts[0].operation?.type!=="Indirection")return null;let s=a.parts[0],o=(await wt(e,s.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let l=await wt(e,r.parameter),u=await eo(e,r.parameter),c=l==="",p=n.checkEmpty??!1,d;if(n.type==="UseAlternative"?d=u&&!(p&&c):d=!u||p&&c,d){let f=o[1],h=o[2]==="*",m=Ye(e,f);if(m.length>0){let x=m.map(([,y])=>y);return h?{values:[x.join(Ke(e.state.env))],quoted:!0}:{values:x,quoted:!0}}let g=e.state.env.get(f);return g!==void 0?{values:[g],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}ir();Dt();J();function fA(e){let t=Number.parseInt(e.state.env.get("#")||"0",10);if(t>e.limits.maxArrayElements)throw new T(`positional parameter element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let r=[],n=0;for(let i=1;i<=t;i++){let a=e.state.env.get(String(i))||"",s=K(a);if(s>e.limits.maxStringLength-n)throw new T(`positional parameter string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");r.push(a),n+=s}return r}function Bc(e,t,r){if(K(t)>r-K(e))throw new T(`positional expansion string limit exceeded (${r} bytes)`,"string_length");return e+t}function q1(e,t,r,n){if(e.length>=n.limits.maxArrayElements)throw new T(`positional expansion element limit exceeded (${n.limits.maxArrayElements})`,"array_elements");let i=K(t);if(i>n.limits.maxStringLength-r.value)throw new T(`positional expansion string limit exceeded (${n.limits.maxStringLength} bytes)`,"string_length");e.push(t),r.value+=i}async function ZU(e,t,r,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0],a=-1,s=!1;for(let g=0;g=p.length)f=[];else if(u!==void 0){let x=u<0?p.length+u:g+u;f=p.slice(g,Math.max(g,x))}else f=p.slice(g)}let h="";for(let g=0;g]+>|`|')/g;for(;v.exec(d)!==null;)w++;if(b+y*k+y*w*b>e.limits.maxStringLength-m.value)throw new T(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");q1(h,g.replace(x,d),m,e)}}catch(g){if(g instanceof T)throw g;for(let x of l)q1(h,x,m,e)}if(s){let g=Ke(e.state.env);if(m.value+Math.max(0,h.length-1)*K(g)+K(u)+K(c)>e.limits.maxStringLength)throw new T(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[u+h.join(g)+c],quoted:!0}}if(K(u)+m.value+K(c)>e.limits.maxStringLength)throw new T(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return h.length===1?{values:[u+h[0]+c],quoted:!0}:{values:[u+h[0],...h.slice(1,-1),h[h.length-1]+c],quoted:!0}}async function QU(e,t,r,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0],a=-1,s=!1;for(let m=0;me.limits.maxStringLength)throw new T(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[u+f.join(m)+c],quoted:!0}}if(K(u)+h.value+K(c)>e.limits.maxStringLength)throw new T(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return f.length===1?{values:[u+f[0]+c],quoted:!0}:{values:[u+f[0],...f.slice(1,-1),f[f.length-1]+c],quoted:!0}}async function KU(e,t,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0],i=-1,a=!1;for(let p=0;p=e.limits.maxArrayElements)throw new T(`unquoted expansion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let i=K(r);if(i>e.limits.maxStringLength-n.value)throw new T(`unquoted expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");t.push(r),n.value+=i}function W0(e,t,r,n){let i=K(r),a=Math.max(0,t.length-1);if(i>0&&a>Math.floor((e.limits.maxStringLength-n)/i))throw new T(`unquoted expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return t.join(r)}function YU(e){return new F0(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations,consumeOperation:()=>e.executionScope.consumeLimited("glob_operations",1,e.limits.maxGlobOperations,"glob expansion")})}async function xp(e,t){if(e.state.options.noglob)return t;let r=YU(e),n=[];for(let i of t)if(qa(i,e.state.shoptOptions.extglob)){let a=await r.expand(i);if(a.length>0)Kr(n,a,e.limits.maxArrayElements,"unquoted glob expansion");else{if(r.hasFailglob())throw new yl(i);r.hasNullglob()||n.push(i)}}else n.push(i);return n}async function JU(e,t,r,n){let i=-1,a="",s=!1;for(let b=0;bb);if(l.length===0){let b=e.state.env.get(a);b!==void 0&&(u=[b])}if(u.length===0)return{values:[],quoted:!1};let c="";if(o.pattern)for(let b of o.pattern.parts)if(b.type==="Glob")c+=At(b.pattern,!0,e.state.shoptOptions.extglob);else if(b.type==="Literal")c+=At(b.value,!0,e.state.shoptOptions.extglob);else if(b.type==="SingleQuoted"||b.type==="Escaped")c+=Ot(b.value);else if(b.type==="DoubleQuoted"){let k=await r(e,b.parts);c+=Ot(k)}else if(b.type==="ParameterExpansion"){let k=await n(e,b);c+=At(k,!0,e.state.shoptOptions.extglob)}else{let k=await n(e,b);c+=Ot(k)}let p=o.replacement?await r(e,o.replacement.parts):"",d=c;o.anchor==="start"?d=`^${c}`:o.anchor==="end"&&(d=`${c}$`);let f=[],h={value:0};try{let b=Ie(d,o.all?"g":"");for(let k of u)ci(e,f,aA(e,k,b,p,o.all),h)}catch(b){if(b instanceof T)throw b;for(let k of u)ci(e,f,k,h)}let m=$r(e.state.env),g=Qr(e.state.env);if(s){let b=Ke(e.state.env),k=W0(e,f,b,h.value);return g?{values:k?[k]:[],quoted:!1}:{values:_t(k,m,e.limits.maxArrayElements),quoted:!1}}if(g)return{values:f,quoted:!1};let x=[],y={value:0};for(let b of f)if(b==="")ci(e,x,"",y);else for(let k of _t(b,m,e.limits.maxArrayElements))ci(e,x,k,y);return{values:x,quoted:!1}}async function ez(e,t,r,n){let i=-1,a="",s=!1;for(let x=0;xx);if(l.length===0){let x=e.state.env.get(a);x!==void 0&&(u=[x])}if(u.length===0)return{values:[],quoted:!1};let c=o.pattern?await gp(e,o.pattern,o.greedy,r,n):"",p=[],d={value:0};for(let x of u)ci(e,p,to(e,x,c,o.side,o.greedy),d);let f=$r(e.state.env),h=Qr(e.state.env);if(s){let x=Ke(e.state.env),y=W0(e,p,x,d.value);return h?{values:y?[y]:[],quoted:!1}:{values:_t(y,f,e.limits.maxArrayElements),quoted:!1}}if(h)return{values:p,quoted:!1};let m=[],g={value:0};for(let x of p)if(x==="")ci(e,m,"",g);else for(let y of _t(x,f,e.limits.maxArrayElements))ci(e,m,y,g);return{values:m,quoted:!1}}async function tz(e,t,r,n){let i=-1,a=!1;for(let x=0;x=c.length)d=[];else if(l!==void 0){let b=l<0?c.length+l:y+l;d=c.slice(y,Math.max(y,b))}else d=c.slice(y)}let f="";for(let y=0;yu!=="");else{let u=Ke(e.state.env),c=i.join(u);l=_t(c,a,e.limits.maxArrayElements)}else if(s)l=i.filter(u=>u!=="");else if(o){l=[];for(let u of i){if(u==="")continue;let c=_t(u,a,e.limits.maxArrayElements);Kr(l,c,e.limits.maxArrayElements,"unquoted expansion")}}else{l=[];for(let u of i)if(u==="")l.push("");else{let c=_t(u,a,e.limits.maxArrayElements);Kr(l,c,e.limits.maxArrayElements,"unquoted expansion")}for(;l.length>0&&l[l.length-1]==="";)l.pop()}return{values:await xp(e,l),quoted:!1}}async function iz(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation)return null;let r=t[0].parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!r)return null;let n=r[1],i=r[2]==="*",a=Ye(e,n),s;if(a.length===0){let p=e.state.env.get(n);if(p!==void 0)s=[p];else return{values:[],quoted:!1}}else s=a.map(([,p])=>p);let o=$r(e.state.env),l=Qr(e.state.env),u=B0(e.state.env),c;if(i)if(l)c=s.filter(p=>p!=="");else{let p=Ke(e.state.env),d=s.join(p);c=_t(d,o,e.limits.maxArrayElements)}else if(l)c=s.filter(p=>p!=="");else if(u){c=[];for(let p of s){if(p==="")continue;let d=_t(p,o,e.limits.maxArrayElements);Kr(c,d,e.limits.maxArrayElements,"unquoted expansion")}}else{c=[];for(let p of s)if(p==="")c.push("");else{let d=_t(p,o,e.limits.maxArrayElements);Kr(c,d,e.limits.maxArrayElements,"unquoted expansion")}for(;c.length>0&&c[c.length-1]==="";)c.pop()}return{values:await xp(e,c),quoted:!1}}function az(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="VarNamePrefix")return null;let r=t[0].operation,n=H0(e,r.prefix);if(n.length===0)return{values:[],quoted:!1};let i=$r(e.state.env),a=Qr(e.state.env),s;if(r.star)if(a)s=n;else{let o=Ke(e.state.env),l=n.join(o);s=_t(l,i,e.limits.maxArrayElements)}else if(a)s=n;else{s=[];for(let o of n){let l=_t(o,i,e.limits.maxArrayElements);Kr(s,l,e.limits.maxArrayElements,"unquoted expansion")}}return{values:s,quoted:!1}}function sz(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="ArrayKeys")return null;let r=t[0].operation,n=Ye(e,r.array).map(([o])=>String(o));if(n.length===0)return{values:[],quoted:!1};let i=$r(e.state.env),a=Qr(e.state.env),s;if(r.star)if(a)s=n;else{let o=Ke(e.state.env),l=n.join(o);s=_t(l,i,e.limits.maxArrayElements)}else if(a)s=n;else{s=[];for(let o of n){let l=_t(o,i,e.limits.maxArrayElements);Kr(s,l,e.limits.maxArrayElements,"unquoted expansion")}}return{values:s,quoted:!1}}async function oz(e,t,r){let n=-1;for(let d=0;df!=="");else if(c){p=[];for(let f of d){if(f==="")continue;let h=_t(f,l,e.limits.maxArrayElements);Kr(p,h,e.limits.maxArrayElements,"unquoted expansion")}}else{p=[];for(let f of d)if(f==="")p.push("");else{let h=_t(f,l,e.limits.maxArrayElements);Kr(p,h,e.limits.maxArrayElements,"unquoted expansion")}for(;p.length>0&&p[p.length-1]==="";)p.pop()}}return p.length===0?{values:[],quoted:!1}:{values:await xp(e,p),quoted:!1}}async function lz(e,t,r){e.coverage?.hit("bash:expansion:word_glob");let n=t.parts,{hasQuoted:i,hasCommandSub:a,hasArrayVar:s,hasArrayAtExpansion:o,hasParamExpansion:l,hasVarNamePrefixExpansion:u,hasIndirection:c}=F1(n),p=r.hasBraceExpansion(n)?await r.expandWordWithBracesAsync(e,t):null;if(p&&p.length>1)return uz(e,p,i);let d=await cz(e,n,o,u,c,r);if(d!==null)return d;let f=await fz(e,n,r);if(f!==null)return f;let h=await dz(e,n,r);if(h!==null)return h;let m=await mz(e,n,r.expandPart);if(m!==null)return M7(e,m);if((a||s||l)&&!Qr(e.state.env)){let x=$r(e.state.env),y=r.buildIfsCharClassPattern(x),b=await r.smartWordSplit(e,n,x,y,r.expandPart);return M7(e,b)}let g=await r.expandWordAsync(e,t);return gz(e,t,n,g,i,r.expandWordForGlobbing)}async function uz(e,t,r){let n=[];for(let i of t)if(!(!r&&i===""))if(!r&&!e.state.options.noglob&&qa(i,e.state.shoptOptions.extglob)){let a=await Uc(e,i);Kr(n,a,e.limits.maxArrayElements,"brace/glob expansion")}else n.push(i);return{values:n,quoted:!1}}async function cz(e,t,r,n,i,a){if(r){let s=zU(e,t);if(s!==null)return s}{let s=qU(e,t);if(s!==null)return s}{let s=await MU(e,t);if(s!==null)return s}{let s=await PU(e,t,r,a.expandPart,a.expandWordPartsAsync);if(s!==null)return s}{let s=await FU(e,t,r,a.expandPart);if(s!==null)return s}{let s=await BU(e,t,a.evaluateArithmetic);if(s!==null)return s}{let s=UU(e,t);if(s!==null)return s}{let s=await RU(e,t,a.expandWordPartsAsync,a.expandPart);if(s!==null)return s}{let s=await LU(e,t,a.expandWordPartsAsync,a.expandPart);if(s!==null)return s}if(n&&t.length===1&&t[0].type==="DoubleQuoted"){let s=pz(e,t);if(s!==null)return s}{let s=await HU(e,t,i,a.expandParameterAsync,a.expandWordPartsAsync);if(s!==null)return s}{let s=await GU(e,t);if(s!==null)return s}{let s=await VU(e,t);if(s!==null)return s}return null}function pz(e,t){let r=t[0];if(r.type!=="DoubleQuoted")return null;if(r.parts.length===1&&r.parts[0].type==="ParameterExpansion"&&r.parts[0].operation?.type==="VarNamePrefix"){let n=r.parts[0].operation,i=H0(e,n.prefix);return n.star?{values:[i.join(Ke(e.state.env))],quoted:!0}:{values:i,quoted:!0}}if(r.parts.length===1&&r.parts[0].type==="ParameterExpansion"&&r.parts[0].operation?.type==="ArrayKeys"){let n=r.parts[0].operation,i=Ye(e,n.array).map(([a])=>String(a));return n.star?{values:[i.join(Ke(e.state.env))],quoted:!0}:{values:i,quoted:!0}}return null}async function fz(e,t,r){{let n=await ZU(e,t,r.evaluateArithmetic,r.expandPart);if(n!==null)return n}{let n=await XU(e,t,r.expandPart,r.expandWordPartsAsync);if(n!==null)return n}{let n=await QU(e,t,r.expandPart,r.expandWordPartsAsync);if(n!==null)return n}{let n=await KU(e,t,r.expandPart);if(n!==null)return n}return null}async function dz(e,t,r){{let n=await JU(e,t,r.expandWordPartsAsync,r.expandPart);if(n!==null)return n}{let n=await ez(e,t,r.expandWordPartsAsync,r.expandPart);if(n!==null)return n}{let n=await tz(e,t,r.expandWordPartsAsync,r.expandPart);if(n!==null)return n}{let n=await rz(e,t,r.evaluateArithmetic,r.expandPart);if(n!==null)return n}{let n=await nz(e,t);if(n!==null)return n}{let n=await iz(e,t);if(n!==null)return n}{let n=az(e,t);if(n!==null)return n}{let n=sz(e,t);if(n!==null)return n}{let n=await oz(e,t,r.expandPart);if(n!==null)return n}return null}function L7(e){if(e.type!=="DoubleQuoted")return null;for(let t=0;to),s.length===0){let o=e.state.env.get(r.name);o!==void 0&&(s=[o])}}else{let o=Number.parseInt(e.state.env.get("#")||"0",10);s=[];for(let l=1;l<=o;l++)s.push(e.state.env.get(String(l))||"")}if(r.isStar){let o=Ke(e.state.env),l=s.join(o);return[i+l+a]}if(s.length===0){let o=i+a;return o?[o]:[]}return s.length===1?[i+s[0]+a]:[i+s[0],...s.slice(1,-1),s[s.length-1]+a]}async function mz(e,t,r){if(t.length<2)return null;let n=!1;for(let l of t)if(L7(l)){n=!0;break}if(!n)return null;let i=$r(e.state.env),a=Qr(e.state.env),s=[];for(let l of t){let u=L7(l);if(u&&l.type==="DoubleQuoted"){let c=await hz(e,l,u,r);s.push(c)}else if(l.type==="DoubleQuoted"||l.type==="SingleQuoted"){let c=await r(e,l);s.push([c])}else if(l.type==="Literal")s.push([l.value]);else if(l.type==="ParameterExpansion"){let c=await r(e,l);if(a)s.push(c?[c]:[]);else{let p=_t(c,i,e.limits.maxArrayElements);s.push(p)}}else{let c=await r(e,l);if(a)s.push(c?[c]:[]);else{let p=_t(c,i,e.limits.maxArrayElements);s.push(p)}}}let o=[];for(let l of s)if(l.length!==0)if(o.length===0)Kr(o,l,e.limits.maxArrayElements,"word expansion");else{let u=o.length-1;o[u]=o[u]+l[0];for(let c=1;ce.executionScope.consumeLimited("glob_operations",1,e.limits.maxGlobOperations,"glob expansion")}),n=await r.expand(t);if(n.length>0)return n;if(r.hasFailglob())throw new yl(t);return r.hasNullglob()?[]:[t]}async function gz(e,t,r,n,i,a){let s=r.some(o=>o.type==="Glob");if(!e.state.options.noglob&&s){let o=await a(e,t);if(qa(o,e.state.shoptOptions.extglob)){let u=await Uc(e,o);if(u.length>0&&u[0]!==o)return{values:u,quoted:!1};if(u.length===0)return{values:[],quoted:!1}}let l=D7(n);if(!Qr(e.state.env)){let u=$r(e.state.env);return{values:_t(l,u,e.limits.maxArrayElements),quoted:!1}}return{values:[l],quoted:!1}}if(!i&&!e.state.options.noglob&&qa(n,e.state.shoptOptions.extglob)){let o=await a(e,t);if(qa(o,e.state.shoptOptions.extglob)){let l=await Uc(e,o);if(l.length>0&&l[0]!==o)return{values:l,quoted:!1}}}if(n===""&&!i)return{values:[],quoted:!1};if(s&&!i){let o=D7(n);if(!Qr(e.state.env)){let l=$r(e.state.env);return{values:_t(o,l,e.limits.maxArrayElements),quoted:!1}}return{values:[o],quoted:!1}}return{values:[n],quoted:i}}J();function Or(e,t,r){if(t.length>=e.limits.maxArrayElements)throw new T(`word splitting element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");t.push(r)}async function dA(e,t){let r=t.operation;if(!r||r.type!=="DefaultValue"&&r.type!=="AssignDefault"&&r.type!=="UseAlternative")return null;let n=r.word;if(!n||n.parts.length===0)return null;let i=await eo(e,t.parameter),a=await wt(e,t.parameter,!1)==="",s=r.checkEmpty??!1,o;return r.type==="UseAlternative"?o=i&&!(s&&a):o=!i||s&&a,o?(r.type==="AssignDefault"&&lA(t.parameter),n.parts):null}function xz(e){return e.type==="SingleQuoted"?!0:e.type==="DoubleQuoted"?e.parts.every(t=>t.type==="Literal"):!1}async function yz(e,t){if(t.type!=="ParameterExpansion")return null;let r=await dA(e,t);if(!r||r.length<=1)return null;let n=r.some(a=>xz(a)),i=r.some(a=>a.type==="Literal"||a.type==="ParameterExpansion"||a.type==="CommandSubstitution"||a.type==="ArithmeticExpansion");return n&&i?r:null}function bz(e){return e.type==="DoubleQuoted"||e.type==="SingleQuoted"||e.type==="Literal"?!1:e.type==="Glob"?eA(e.pattern):!(!(e.type==="ParameterExpansion"||e.type==="CommandSubstitution"||e.type==="ArithmeticExpansion")||e.type==="ParameterExpansion"&&XB(e))}async function wz(e,t,r,n,i){if(e.coverage?.hit("bash:expansion:word_split"),t.length===1&&t[0].type==="ParameterExpansion"){let d=t[0],f=await dA(e,d);if(f&&f.length>0&&f.length>1&&f.some(h=>h.type==="DoubleQuoted"||h.type==="SingleQuoted")&&f.some(h=>h.type==="Literal"||h.type==="ParameterExpansion"||h.type==="CommandSubstitution"||h.type==="ArithmeticExpansion"))return P7(e,f,r,n,i)}let a=[],s=!1;for(let d of t){let f=bz(d),h=d.type==="DoubleQuoted"||d.type==="SingleQuoted",m=f?await yz(e,d):null,g=await i(e,d);a.push({value:g,isSplittable:f,isQuoted:h,mixedDefaultParts:m??void 0}),f&&(s=!0)}if(!s){let d=a.map(f=>f.value).join("");return d?[d]:[]}let o=[],l="",u=!1,c=!1,p=!1;for(let d of a)if(!d.isSplittable)c?d.isQuoted&&d.value===""?(l!==""&&Or(e,o,l),Or(e,o,""),u=!0,l="",c=!1,p=!0):d.value!==""?(l!==""&&Or(e,o,l),l=d.value,c=!1,p=!1):(l+=d.value,p=!1):(l+=d.value,p=d.isQuoted&&d.value==="");else if(d.mixedDefaultParts){let f=await P7(e,d.mixedDefaultParts,r,n,i);if(f.length!==0)if(f.length===1)l+=f[0],u=!0;else{l+=f[0],Or(e,o,l),u=!0;for(let h=1;h0&&t.includes(e[0])}async function P7(e,t,r,n,i){let a=[];for(let c of t){let p=!(c.type==="DoubleQuoted"||c.type==="SingleQuoted"),d=await i(e,c);a.push({value:d,isSplittable:p})}let s=[],o="",l=!1,u=!1;for(let c of a)if(!c.isSplittable)u&&c.value!==""?(o!==""&&Or(e,s,o),o=c.value,u=!1):o+=c.value;else{vz(c.value,r)&&o!==""&&(Or(e,s,o),o="",l=!0);let{words:p,hadTrailingDelimiter:d}=z0(c.value,r,e.limits.maxArrayElements);if(p.length===0)d&&(u=!0);else if(p.length===1)o+=p[0],l=!0,u=d;else{o+=p[0],Or(e,s,o),l=!0;for(let f=1;fmA(e).some(n=>n.path===`${zc}${r}`));e.fs=new US({base:e.fs,mounts:[{mountPoint:zc,filesystem:t}]}),e.state.processSubstitutionFsMounted=!0}async function Nz(e,t,r){try{await e.fs.writeFile(t,r,"binary");return}catch(n){if(e.state.processSubstitutionFsMounted)throw n;kz(e)}await e.fs.writeFile(t,r,"binary")}async function Tz(e,t){try{await e.fs.rm(t,{force:!0})}catch{}}function mA(e){let t=e.state.processSubstitutions;if(t)return t;let r=[];return e.state.processSubstitutions=r,r}async function gA(e,t,r){let n=e.substitutionDepth??0,i=e.limits.maxSubstitutionDepth;if(n>=i)throw new T(`Process substitution nesting limit exceeded (${i})`,"substitution_depth");let a=e.substitutionDepth,s=new Map(e.state.env),o=Ys(e.state.arrays),l=e.state.cwd,u=e.state.bashPid,c=e.state.suppressVerbose,p=e.state.groupStdin,d=e.state.lastExitCode,f=e.state.env.get("?"),h=e.state.lastSubstitutionExitCode;e.substitutionDepth=n+1,e.state.bashPid=e.state.nextVirtualPid++,e.state.suppressVerbose=!0,r!==void 0&&(e.state.groupStdin=r);let m;try{m=await e.executeScript(t)}catch(g){if(g instanceof T)throw g;if(g instanceof at)return{stdout:g.stdout,stderr:g.stderr,exitCode:g.exitCode};throw g}finally{e.substitutionDepth=a,e.state.env=s,e.state.arrays=o,e.state.cwd=l,e.state.bashPid=u,e.state.suppressVerbose=c,e.state.groupStdin=p,e.state.lastExitCode=d,e.state.lastSubstitutionExitCode=h,f!==void 0?e.state.env.set("?",f):e.state.env.delete("?")}return m}async function _z(e,t){let r=mA(e);if(r.length>=F7)throw new T(`Process substitution limit exceeded (${F7} concurrent)`,"file_descriptors");let n="";if(t.direction==="input"){let s=await gA(e,t.body,void 0);if(s.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+s.stderr),n=sl(s),n.length>e.limits.maxStringLength)throw new T(`process substitution: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length")}let i=hA-r.length,a=`${zc}/${i}`;r.push({fd:i,path:a,direction:t.direction,body:t.body});try{await Nz(e,a,n)}catch(s){throw r.pop(),s}return a}function Oz(e){return e.state.processSubstitutions?.length??0}var Iz={stdout:"",stderr:""};async function B7(e,t){let r=e.state.processSubstitutions;if(!r||r.length<=t)return Iz;let n="",i="";for(;r.length>t;){let a=r[r.length-1],s="";if(a.direction==="output")try{s=await Mi(e.fs,a.path)}catch{}if(await Tz(e,a.path),r.pop(),a.direction==="output"){let o=await gA(e,a.body,s);n+=sl(o),i+=o.stderr}}return{stdout:n,stderr:i}}function ta(e,t,r){if(e.length>t)throw new T(`${r}: string length limit exceeded (${t} bytes)`,"string_length")}async function Ln(e,t,r=!1){let n=[],i=0;for(let a of t){let s=await on(e,a,r);if(i+=K(s),i>e.limits.maxStringLength)throw new T(`parameter word string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");n.push(s)}return n.join("")}function $z(e){return Sz(e)}function Dz(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!$z(t))return!1;return!0}function Rz(e,t,r=!1){let n=Ez(t);if(n!==null)return n;switch(t.type){case"TildeExpansion":return r?t.user===null?"~":`~${t.user}`:(e.coverage?.hit("bash:expansion:tilde"),t.user===null?e.state.env.get("HOME")??"/home/user":t.user==="root"?"/root":`~${t.user}`);case"Glob":return cA(e,t.pattern);default:return null}}async function Et(e,t){return j0(e,t)}async function Lz(e,t){let r=[];for(let n of t.parts)if(n.type==="Escaped")r.push(U1(n.value));else if(n.type==="SingleQuoted")r.push(n.value);else if(n.type==="DoubleQuoted"){let i=await Ln(e,n.parts);r.push(i)}else if(n.type==="TildeExpansion"){let i=await on(e,n);r.push(U1(i))}else r.push(await on(e,n));return r.join("")}async function Mz(e,t){let r=[];for(let n of t.parts)if(n.type==="Escaped"){let i=n.value;"()|*?[]".includes(i)?r.push(`\\${i}`):r.push(i)}else if(n.type==="SingleQuoted")r.push(Ri(n.value));else if(n.type==="DoubleQuoted"){let i=await Ln(e,n.parts);r.push(Ri(i))}else r.push(await on(e,n));return r.join("")}async function xA(e,t){let r=[];for(let n of t.parts)if(n.type==="SingleQuoted")r.push(Ri(n.value));else if(n.type==="Escaped"){let i=n.value;"*?[]\\()|".includes(i)?r.push(`\\${i}`):r.push(i)}else if(n.type==="DoubleQuoted"){let i=await Ln(e,n.parts);r.push(Ri(i))}else n.type==="Glob"?_U(n.pattern)?r.push(await IU(e,n.pattern)):r.push(cA(e,n.pattern)):n.type==="Literal"?r.push(n.value):r.push(await on(e,n));return r.join("")}function yp(e){for(let t of e)if(t.type==="BraceExpansion"||t.type==="DoubleQuoted"&&yp(t.parts))return!0;return!1}var U7=1e5;async function yA(e,t,r={count:0}){let n=()=>{r.count++,e.executionScope.consumeLimited("brace_operations",1,Math.min(U7,e.limits.maxBraceExpansionResults),"brace expansion")},i=(s,o)=>{if(s.length>=e.limits.maxBraceExpansionResults)throw new T(`brace expansion result limit exceeded (${e.limits.maxBraceExpansionResults})`,"array_elements");n(),s.push(o)},a=[[]];for(let s of t)if(s.type==="BraceExpansion"){let o=[],l=!1,u="";for(let p of s.items)if(p.type==="Range"){let d=iA(p.start,p.end,p.step,p.startStr,p.endStr,{maxResults:e.limits.maxBraceExpansionResults,maxStringBytes:e.limits.maxStringLength});if(d.expanded)for(let f of d.expanded)i(o,f);else{l=!0,u=d.literal;break}}else{let d=await yA(e,p.word.parts,r);for(let f of d){let h=[];for(let m of f)typeof m=="string"?h.push(m):h.push(await on(e,m));i(o,h.join(""))}}if(l){for(let p of a)n(),p.push(u);continue}if(a.length*o.length>e.limits.maxBraceExpansionResults||r.count>U7)throw new T(`brace expansion result limit exceeded (${e.limits.maxBraceExpansionResults})`,"array_elements");let c=[];for(let p of a)for(let d of o){if(c.length>=e.limits.maxBraceExpansionResults)throw new T(`brace expansion result limit exceeded (${e.limits.maxBraceExpansionResults})`,"array_elements");n(),c.push([...p,d])}a=c}else for(let o of a)n(),o.push(s);return a}async function bA(e,t){let r=t.parts;if(!yp(r))return[await Et(e,t)];let n=await yA(e,r),i=[];for(let a of n){let s=[];for(let o of a)typeof o=="string"?s.push(o):s.push(await on(e,o));i.push(pA(e,s.join("")))}return i}function Pz(){return{expandWordAsync:j0,expandWordForGlobbing:xA,expandWordWithBracesAsync:bA,expandWordPartsAsync:Ln,expandPart:on,expandParameterAsync:qc,hasBraceExpansion:yp,evaluateArithmetic:xt,buildIfsCharClassPattern:KB,smartWordSplit:wz}}async function Ka(e,t){return lz(e,t,Pz())}function Fz(e){for(let t of e){if(t.type==="ParameterExpansion")return t.parameter;if(t.type==="Literal")return t.value}return""}function wA(e,t){if(Number.parseInt(e.state.env.get("#")||"0",10)<2)return!1;function r(n){for(let i of n)if(i.type==="DoubleQuoted"){for(let a of i.parts)if(a.type==="ParameterExpansion"&&a.parameter==="@"&&!a.operation)return!0}return!1}return r(t.parts)}async function Bz(e,t){if(wA(e,t))return{error:`bash: $@: ambiguous redirect `};let r=t.parts,{hasQuoted:n}=F1(r);if(yp(r)&&(await bA(e,t)).length>1)return{error:`bash: ${r.map(c=>c.type==="Literal"?c.value:c.type==="BraceExpansion"?`{${c.items.map(p=>{if(p.type==="Range"){let d=p.step?`..${p.step}`:"";return`${p.startStr??p.start}..${p.endStr??p.end}${d}`}return p.word.parts.map(d=>d.type==="Literal"?d.value:"").join("")}).join(",")}}`:"").join("")}: ambiguous redirect `};let i=await j0(e,t),{hasParamExpansion:a,hasCommandSub:s}=F1(r);if((a||s)&&!n&&!Qr(e.state.env)){let c=$r(e.state.env);if(_t(i,c,e.limits.maxArrayElements).length>1)return{error:`bash: $${Fz(r)}: ambiguous redirect `}}if(n||e.state.options.noglob||r.some(c=>c.type==="ProcessSubstitution"))return{target:i};let o=await xA(e,t);if(!qa(o,e.state.shoptOptions.extglob))return{target:i};let l=new F0(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations,consumeOperation:()=>e.executionScope.consumeLimited("glob_operations",1,e.limits.maxGlobOperations,"glob expansion")}),u=await l.expand(o);return u.length===0?l.hasFailglob()?{error:`bash: no match: ${i} `}:{target:i}:u.length===1?{target:u[0]}:{error:`bash: ${i}: ambiguous redirect `}}async function j0(e,t){let r=t.parts,n=r.length;if(n===1){let s=await on(e,r[0]);return ta(s,e.limits.maxStringLength,"word expansion"),s}let i=[];for(let s=0;s=s)throw new T(`Command substitution nesting limit exceeded (${s})`,"substitution_depth");let o=e.substitutionDepth;e.substitutionDepth=a+1;let l=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let u=new Map(e.state.env),c=Ys(e.state.arrays),p=e.state.cwd,d=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let f=await e.executeScript(t.body),h=f.exitCode;e.state.env=u,e.state.arrays=c,e.state.cwd=p,e.state.suppressVerbose=d,Us(e.state,h),f.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+f.stderr),e.state.bashPid=l,e.substitutionDepth=o;let m=f.stdout.replace(/\n+$/,"");return ta(m,e.limits.maxStringLength,"command substitution"),m}catch(f){if(e.state.env=u,e.state.arrays=c,e.state.cwd=p,e.state.bashPid=l,e.substitutionDepth=o,e.state.suppressVerbose=d,f instanceof T)throw f;if(f instanceof at){Us(e.state,f.exitCode),f.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+f.stderr);let h=f.stdout.replace(/\n+$/,"");return ta(h,e.limits.maxStringLength,"command substitution"),h}throw f}}case"ProcessSubstitution":return _z(e,t);case"ArithmeticExpansion":{let i=t.expression.originalText;if(i&&/\$[a-zA-Z_][a-zA-Z0-9_]*(?![{[(])/.test(i)){let a=await iU(e,i),s=new ft,o=Ut(s,a);return String(await xt(e,o.expression,!0))}return String(await xt(e,t.expression.expression,!0))}case"BraceExpansion":{let i=[];for(let a of t.items)if(a.type==="Range"){let s=iA(a.start,a.end,a.step,a.startStr,a.endStr,{maxResults:e.limits.maxBraceExpansionResults,maxStringBytes:e.limits.maxStringLength});if(s.expanded)i.push(...s.expanded);else return s.literal}else i.push(await Et(e,a.word));return i.join(" ")}default:return""}}async function qc(e,t,r=!1){let{parameter:n}=t,{operation:i}=t,a=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(a){let[,d,f]=a;if(e.state.associativeArrays?.has(d)||f.includes("$(")||f.includes("`")||f.includes("${")){let h=await $7(e,f);n=`${d}[${h}]`}}else if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)&&Kt(e,n)){let d=pi(e,n);if(d&&d!==n){let f=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(f){let[,h,m]=f;if(e.state.associativeArrays?.has(h)||m.includes("$(")||m.includes("`")||m.includes("${")){let g=await $7(e,m);n=`${h}[${g}]`}}}}if(i?.type==="Length"&&/^[a-zA-Z_][a-zA-Z0-9_]*\[[@*]\]$/.test(n))return R7(e,n,"");let s=i&&(i.type==="DefaultValue"||i.type==="AssignDefault"||i.type==="UseAlternative"||i.type==="ErrorIfUnset"),o=await wt(e,n,!s);if(!i)return o;let l=!await eo(e,n),{isEmpty:u,effectiveValue:c}=NU(e,n,o,r),p={value:o,isUnset:l,isEmpty:u,effectiveValue:c,inDoubleQuotes:r};switch(i.type){case"DefaultValue":return mU(e,i,p,Ln);case"AssignDefault":return gU(e,n,i,p,Ln);case"ErrorIfUnset":return xU(e,n,i,p,Ln);case"UseAlternative":return yU(e,i,p,Ln);case"PatternRemoval":{let d=await bU(e,o,i,Ln,on);return ta(d,e.limits.maxStringLength,"pattern removal"),d}case"PatternReplacement":{let d=await wU(e,o,i,Ln,on);return ta(d,e.limits.maxStringLength,"pattern replacement"),d}case"Length":return R7(e,n,o);case"LengthSliceError":throw new Ti(n);case"BadSubstitution":throw new Ti(i.text);case"Substring":return vU(e,n,o,i);case"CaseModification":{let d=await EU(e,o,i,Ln,qc);return ta(d,e.limits.maxStringLength,"case modification"),d}case"Transform":return SU(e,n,o,l,i);case"Indirection":return AU(e,n,o,l,i,qc,r);case"ArrayKeys":return CU(e,i);case"VarNamePrefix":return kU(e,i);default:return o}}function vA(){return{visited:new Set,depth:0}}function Uz(e,t,r){switch(r){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":if(t===0)throw new Mt("division by 0");return Math.trunc(e/t);case"%":if(t===0)throw new Mt("division by 0");return e%t;case"**":if(t<0)throw new Mt("exponent less than 0");return e**t;case"<<":return e<>":return e>>t;case"<":return e":return e>t?1:0;case">=":return e>=t?1:0;case"==":return e===t?1:0;case"!=":return e!==t?1:0;case"&":return e&t;case"|":return e|t;case"^":return e^t;case",":return t;default:return 0}}function z7(e,t,r){switch(r){case"=":return t;case"+=":return e+t;case"-=":return e-t;case"*=":return e*t;case"/=":return t!==0?Math.trunc(e/t):0;case"%=":return t!==0?e%t:0;case"<<=":return e<>=":return e>>t;case"&=":return e&t;case"|=":return e|t;case"^=":return e^t;default:return t}}function zz(e,t){switch(t){case"-":return-e;case"+":return+e;case"!":return e===0?1:0;case"~":return~e;default:return e}}async function qz(e,t){let r=e.state.env.get(t);if(r!==void 0)return r;let n=Nt(e,t,0);return n!==void 0?n:await wt(e,t)}async function Hz(e,t,r){if(!t)return 0;let n=Number.parseInt(t,10);if(!Number.isNaN(n)&&/^-?\d+$/.test(t.trim()))return n;let i=t.trim();if(!i)return 0;let a=new ft,{expr:s,pos:o}=Nl(a,i,0);if(o100)throw new Mt("maximum variable indirection depth exceeded");if(n.visited.has(t))throw new Mt(`arithmetic variable cycle detected at ${t}`);n.visited.add(t),n.depth++;try{return await Hz(e,r,n)}finally{n.depth--,n.visited.delete(t)}}async function H1(e,t,r){if(r.depth>100)throw new Mt("maximum variable indirection depth exceeded");if(r.visited.has(t))throw new Mt(`arithmetic variable cycle detected at ${t}`);r.visited.add(t),r.depth++;try{let n=await qz(e,t);if(!n)return 0;let i=Number.parseInt(n,10);if(!Number.isNaN(i)&&/^-?\d+$/.test(n.trim()))return i;let a=n.trim();if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a))return await H1(e,a,r);let s=new ft,{expr:o,pos:l}=Nl(s,a,0);if(l0&&(n===-1||djs(e,a,s,n);switch(t.type){case"ArithNumber":if(Number.isNaN(t.value))throw new Mt("value too great for base");return t.value;case"ArithVariable":return await H1(e,t.name,n);case"ArithSpecialVar":{let a=(await wt(e,t.name)).trim();if(!a)return 0;let s=Number.parseInt(a,10);if(!Number.isNaN(s)&&/^-?\d+$/.test(a))return s;let o=new ft,{expr:l}=Nl(o,a,0);return await i(l)}case"ArithNested":return await i(t.expression);case"ArithCommandSubst":{if(e.execFn){let a=await e.execFn(t.command,{signal:e.state.signal});a.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+a.stderr);let s=a.stdout.trim();return Number.parseInt(s,10)||0}return 0}case"ArithBracedExpansion":{let a=await pc(e,t.content);return Number.parseInt(a,10)||0}case"ArithDynamicBase":{let a=await pc(e,t.baseExpr),s=Number.parseInt(a,10);if(s<2||s>64)return 0;let o=`${s}#${t.value}`;return D1(o)}case"ArithDynamicNumber":{let a=await pc(e,t.prefix)+t.suffix;return D1(a)}case"ArithArrayElement":{let a=e.state.associativeArrays?.has(t.array),s=async o=>{let l=Nt(e,t.array,o);return l!==void 0?await Hu(e,`${t.array}[${o}]`,l,n):0};if(t.stringKey!==void 0)return await s(t.stringKey);if(a&&t.index?.type==="ArithVariable"&&!t.index.hasDollarPrefix)return await s(t.index.name);if(a&&t.index?.type==="ArithVariable"&&t.index.hasDollarPrefix){let o=await wt(e,t.index.name);return await s(o)}if(t.index){let o=await i(t.index);if(o<0){let c=Ye(e,t.array),p=e.state.currentLine;if(c.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${p}: ${t.array}: bad array subscript `,0;let d=Math.max(...c.map(([f])=>typeof f=="number"?f:0))+1+o;if(d<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${p}: ${t.array}: bad array subscript `,0;o=d}let l=`${t.array}[${o}]`,u=Nt(e,t.array,o);if(u!==void 0)return Hu(e,l,u,n);if(o===0){let c=e.state.env.get(t.array);if(c!==void 0)return Hu(e,t.array,c,n)}if(e.state.options.nounset&&!(e.state.env.has(t.array)||Hn(e,t.array)))throw new gn(`${t.array}[${o}]`);return 0}return 0}case"ArithDoubleSubscript":throw new Mt("double subscript","","");case"ArithNumberSubscript":throw new Mt(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case"ArithSyntaxError":throw new Mt(t.message,"","",!0);case"ArithSingleQuote":{if(r)throw new Mt(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value}case"ArithBinary":{if(t.operator==="||")return await i(t.left)||await i(t.right)?1:0;if(t.operator==="&&")return await i(t.left)&&await i(t.right)?1:0;let a=await i(t.left),s=await i(t.right);return Uz(a,s,t.operator)}case"ArithUnary":{let a=await i(t.operand);if(t.operator==="++"||t.operator==="--"){if(t.operand.type==="ArithVariable"){let s=t.operand.name,o=Number.parseInt(await wt(e,s),10)||0,l=t.operator==="++"?o+1:o-1;return e.state.env.set(s,String(l)),t.prefix?l:o}if(t.operand.type==="ArithArrayElement"){let s=t.operand.array,o=e.state.associativeArrays?.has(s),l;if(t.operand.stringKey!==void 0)l=t.operand.stringKey;else if(o&&t.operand.index?.type==="ArithVariable"&&!t.operand.index.hasDollarPrefix)l=t.operand.index.name;else if(o&&t.operand.index?.type==="ArithVariable"&&t.operand.index.hasDollarPrefix)l=await wt(e,t.operand.index.name);else if(t.operand.index){let p=await i(t.operand.index);l=String(p)}else return a;let u=Number.parseInt(Nt(e,s,l)||"0",10)||0,c=t.operator==="++"?u+1:u-1;return je(e,s,l,String(c),o?"associative":"indexed"),t.prefix?c:u}if(t.operand.type==="ArithConcat"){let s="";for(let o of t.operand.parts)s+=await Ls(e,o,r,n);if(s&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let o=Number.parseInt(e.state.env.get(s)||"0",10)||0,l=t.operator==="++"?o+1:o-1;return e.state.env.set(s,String(l)),t.prefix?l:o}}if(t.operand.type==="ArithDynamicElement"){let s="";if(t.operand.nameExpr.type==="ArithConcat")for(let o of t.operand.nameExpr.parts)s+=await Ls(e,o,r,n);else t.operand.nameExpr.type==="ArithVariable"&&(s=t.operand.nameExpr.hasDollarPrefix?await wt(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(s&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let o=await i(t.operand.subscript),l=Number.parseInt(Nt(e,s,o)||"0",10)||0,u=t.operator==="++"?l+1:l-1;return je(e,s,o,String(u)),t.prefix?u:l}}return a}return zz(a,t.operator)}case"ArithTernary":return await i(t.condition)?await i(t.consequent):await i(t.alternate);case"ArithAssignment":{let a=t.variable,s=a,o;if(t.stringKey!==void 0)o=t.stringKey;else if(t.subscript){let d=e.state.associativeArrays?.has(a);if(d&&t.subscript.type==="ArithVariable"&&!t.subscript.hasDollarPrefix)o=t.subscript.name;else if(d&&t.subscript.type==="ArithVariable"&&t.subscript.hasDollarPrefix)o=await wt(e,t.subscript.name)||"\\";else if(d){let f=await i(t.subscript);o=String(f)}else{let f=await i(t.subscript);if(f<0){let h=Ye(e,a);h.length>0&&(f=Math.max(...h.map(([m])=>typeof m=="number"?m:0))+1+f)}o=String(f)}}let l=o===void 0?e.state.env.get(s):Nt(e,a,o),u=Number.parseInt(l||"0",10)||0,c=await i(t.value),p=z7(u,c,t.operator);return o===void 0?e.state.env.set(s,String(p)):je(e,a,o,String(p),e.state.associativeArrays?.has(a)?"associative":"indexed"),p}case"ArithGroup":return await i(t.expression);case"ArithConcat":{let a="";for(let s of t.parts)a+=await Ls(e,s,r,n);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a)?await H1(e,a,n):Number.parseInt(a,10)||0}case"ArithDynamicAssignment":{let a="";if(t.target.type==="ArithConcat")for(let c of t.target.parts)a+=await Ls(e,c,r,n);else t.target.type==="ArithVariable"&&(a=t.target.hasDollarPrefix?await wt(e,t.target.name):t.target.name);if(!a||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a))return 0;let s=a;if(t.subscript){let c=await i(t.subscript);s=`${a}_${c}`}let o=Number.parseInt(e.state.env.get(s)||"0",10)||0,l=await i(t.value),u=z7(o,l,t.operator);return e.state.env.set(s,String(u)),u}case"ArithDynamicElement":{let a="";if(t.nameExpr.type==="ArithConcat")for(let u of t.nameExpr.parts)a+=await Ls(e,u,r,n);else t.nameExpr.type==="ArithVariable"&&(a=t.nameExpr.hasDollarPrefix?await wt(e,t.nameExpr.name):t.nameExpr.name);if(!a||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a))return 0;let s=await i(t.subscript),o=`${a}_${s}`,l=e.state.env.get(o);return l!==void 0?Hu(e,o,l,n):0}default:return 0}}async function Ls(e,t,r=!1,n=vA()){switch(t.type){case"ArithNumber":return String(t.value);case"ArithSingleQuote":return String(await js(e,t,r,n));case"ArithVariable":return t.hasDollarPrefix?await wt(e,t.name):t.name;case"ArithSpecialVar":return await wt(e,t.name);case"ArithBracedExpansion":return await pc(e,t.content);case"ArithCommandSubst":return e.execFn?(await e.execFn(t.command,{signal:e.state.signal})).stdout.trim():"0";case"ArithConcat":{let i="";for(let a of t.parts)i+=await Ls(e,a,r,n);return i}default:return String(await js(e,t,r,n))}}ir();J();async function Wz(e,t){let r="",n=0;for(let v of t.parts){let A=v.type==="Literal"?v.value:"\0",R=K(A);if(R>e.limits.maxStringLength-n)throw new T(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");r+=A,n+=R}let i=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(\+?=)\(/);if(!i||!r.endsWith(")"))return null;let a=i[1],s=i[2],o=[],l=[],u=!1,c="",p=0,d=0,f=!1,h=!0,m=v=>{let A=K(v);if(A>e.limits.maxStringLength-d-p)throw new T(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");c+=v,p+=A},g=(v,A=!1)=>{if(o.length>=e.limits.maxArrayElements)throw new T(`array assignment element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let R=K(v);if(R>e.limits.maxStringLength-d)throw new T(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");o.push(v),l.push(A),d+=R},x=()=>{g(c,h),c="",p=0,f=!1,h=!0};for(let v of t.parts)if(v.type==="Literal"){let A=v.value;if(!u){let R=A.indexOf("=(");R!==-1&&(u=!0,A=A.slice(R+2))}if(u){A.endsWith(")")&&(A=A.slice(0,-1));for(let R of A)/\s/.test(R)?(c||f)&&x():m(R)}}else if(u)if(v.type==="BraceExpansion")if(/^\[.+\]=/.test(c))m(dp({type:"Word",parts:[v]}));else{(c||f)&&x();let A=await Ka(e,{type:"Word",parts:[v]});for(let R of A.values)g(R)}else{(v.type==="SingleQuoted"||v.type==="DoubleQuoted"||v.type==="Escaped")&&(f=!0),h=!1;let A=await Et(e,{type:"Word",parts:[v]});m(A)}(c||f)&&x();let y=o.splice(0),b=l.splice(0);d=0;for(let v=0;v$.type==="BraceExpansion")){let $=await Ka(e,I);for(let _ of $.values)g(_);continue}}g(A)}let k=[`${a}${s}(`],w=K(k[0]);for(let v=0;v()]/.test(A)&&!A.startsWith("'")&&!A.startsWith('"')?R=`'${A.replace(/'/g,"'\\''")}'`:R=A;let $=`${v>0?" ":""}${R}`,_=K($);if(_+1>e.limits.maxStringLength-w)throw new T(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");k.push($),w+=_}return k.push(")"),k.join("")}async function jz(e,t){let r=-1,n=-1,i=!1;for(let h=0;h0?await Et(e,d):"";return`${p}${i?"+=":"="}${f}`}var Gz=["tar","yq","xan","sqlite3","python3","python"];function Vz(e){return Gz.includes(e)}ge();Nn();Pi();ln();Ks();Xs();J();J();var Tt=Object.freeze({stdout:"",stderr:"",exitCode:0,internalStdinConsumed:0});function mt(e=""){return{stdout:e,stderr:"",exitCode:0}}function re(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function ae(e,t,r){return{stdout:e,stderr:t,exitCode:r}}function dr(e){return{stdout:"",stderr:"",exitCode:e?0:1,internalStdinConsumed:0}}function ro(e,t,r="",n=""){throw new T(e,t,r,n)}function Zz(e){let t=e.state.fileDescriptors;if(t&&t.size>=e.limits.maxFileDescriptors)throw new T(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors")}function Xz(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new bl;return Tt}if(t.length>1)throw new at(1,"",`bash: break: too many arguments `);let r=1;if(t.length>0){let n=Number.parseInt(t[0],10);if(Number.isNaN(n)||n<1)throw new at(128,"",`bash: break: ${t[0]}: numeric argument required `);r=n}throw new Oi(r)}async function Qz(e,t){let r,n=!1,i=!1,a=0;for(;ad);for(let d of p){let f=d.startsWith("/")?`${d}/${r}`:`${e.state.cwd}/${d}/${r}`;try{if((await e.fs.stat(f)).isDirectory){r=f,n=!0;break}}catch{}}}}let o=(r.startsWith("/")?r:`${e.state.cwd}/${r}`).split("/").filter(c=>c&&c!=="."),l="";for(let c of o)if(c==="..")l=l.split("/").slice(0,-1).join("/")||"/";else{l=l?`${l}/${c}`:`/${c}`;try{if(!(await e.fs.stat(l)).isDirectory)return re(`bash: cd: ${r}: Not a directory `)}catch{return re(`bash: cd: ${r}: No such file or directory `)}}let u=l||"/";if(i)try{u=await e.fs.realpath(u)}catch{}return e.state.previousDir=e.state.cwd,e.state.cwd=u,e.state.env.set("PWD",e.state.cwd),e.state.env.set("OLDPWD",e.state.previousDir),mt(n?`${r===""?"":u} `:"")}Yt();ge();Dt();J();function W1(e,t){return e.fs.resolvePath(e.state.cwd,t)}var Kz=["-e","-a","-f","-d","-r","-w","-x","-s","-L","-h","-k","-g","-u","-G","-O","-b","-c","-p","-S","-t","-N"];function G0(e){return Kz.includes(e)}async function V0(e,t,r){let n=W1(e,r);switch(t){case"-e":case"-a":return e.fs.exists(n);case"-f":return await e.fs.exists(n)?(await e.fs.stat(n)).isFile:!1;case"-d":return await e.fs.exists(n)?(await e.fs.stat(n)).isDirectory:!1;case"-r":return await e.fs.exists(n)?((await e.fs.stat(n)).mode&256)!==0:!1;case"-w":return await e.fs.exists(n)?((await e.fs.stat(n)).mode&128)!==0:!1;case"-x":return await e.fs.exists(n)?((await e.fs.stat(n)).mode&64)!==0:!1;case"-s":return await e.fs.exists(n)?(await e.fs.stat(n)).size>0:!1;case"-L":case"-h":try{return(await e.fs.lstat(n)).isSymbolicLink}catch{return!1}case"-k":return await e.fs.exists(n)?((await e.fs.stat(n)).mode&512)!==0:!1;case"-g":return await e.fs.exists(n)?((await e.fs.stat(n)).mode&1024)!==0:!1;case"-u":return await e.fs.exists(n)?((await e.fs.stat(n)).mode&2048)!==0:!1;case"-G":case"-O":return e.fs.exists(n);case"-b":return!1;case"-c":return["/dev/null","/dev/zero","/dev/random","/dev/urandom","/dev/tty","/dev/stdin","/dev/stdout","/dev/stderr"].includes(n);case"-p":return!1;case"-S":return!1;case"-t":return!1;case"-N":return e.fs.exists(n);default:return!1}}var Yz=["-nt","-ot","-ef"];function Z0(e){return Yz.includes(e)}async function X0(e,t,r,n){let i=W1(e,r),a=W1(e,n);switch(t){case"-nt":{let[s,o]=await Promise.all([e.fs.stat(i).catch(()=>null),e.fs.stat(a).catch(()=>null)]);return s!==null&&(o===null||s.mtime>o.mtime)}case"-ot":{let[s,o]=await Promise.all([e.fs.stat(i).catch(()=>null),e.fs.stat(a).catch(()=>null)]);return o!==null&&(s===null||s.mtimer;case"-ge":return t>=r}}function Hc(e){return e==="="||e==="=="||e==="!="}function Y0(e,t,r,n=!1,i=!1,a=!1,s=256){if(n){let l=rm(t,r,i,a,s);return e==="!="?!l:l}if(i){let l=t.toLowerCase()===r.toLowerCase();return e==="!="?!l:l}let o=t===r;return e==="!="?!o:o}var eq=new Set(["-z","-n"]);function J0(e){return eq.has(e)}function em(e,t){switch(e){case"-z":return t==="";case"-n":return t!==""}}async function tm(e,t){let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(r){let n=r[1],i=r[2];if(e.state.associativeArrays?.has(n)){let s=i;return(s.startsWith("'")&&s.endsWith("'")||s.startsWith('"')&&s.endsWith('"'))&&(s=s.slice(1,-1)),s=s.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(o,l)=>e.state.env.get(l)||""),Fs(e,n,s)}let a;try{let s=new ft,o=Ut(s,i);a=await xt(e,o.expression)}catch{if(/^-?\d+$/.test(i))a=Number.parseInt(i,10);else{let s=e.state.env.get(i);a=s?Number.parseInt(s,10):0}}if(a<0){let s=Vr(e,n),o=e.state.currentLine;if(s.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${o}: ${n}: bad array subscript `,!1;if(a=Math.max(...s)+1+a,a<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${o}: ${n}: bad array subscript `,!1}return Fs(e,n,a)}return e.state.env.has(t)?!0:e.state.associativeArrays?.has(t)?Js(e,t).length>0:Vr(e,t).length>0}async function $a(e,t){switch(t.type){case"CondBinary":{let r=await Et(e,t.left),n=t.right.parts.length>0&&t.right.parts.every(a=>a.type==="SingleQuoted"||a.type==="DoubleQuoted"||a.type==="Escaped"&&t.operator!=="=~"),i;if(t.operator==="=~")if(n){let a=await Et(e,t.right);i=U1(a)}else i=await Lz(e,t.right);else Hc(t.operator)&&!n?i=await Mz(e,t.right):i=await Et(e,t.right);if(Hc(t.operator)){let a=e.state.shoptOptions.nocasematch;return Y0(t.operator,r,i,!n,a,!0,e.limits.maxCallDepth)}if(Q0(t.operator))return K0(t.operator,await H7(e,r),await H7(e,i));if(Z0(t.operator))return X0(e,t.operator,r,i);switch(t.operator){case"=~":try{let a=e.state.shoptOptions.nocasematch,s=aq(i),o=Ie(s,a?"i":"").match(r);if(an(e,"BASH_REMATCH"),o)for(let l=0;l":return r>i;default:return!1}}case"CondUnary":{let r=await Et(e,t.operand);return G0(t.operator)?V0(e,t.operator,r):J0(t.operator)?em(t.operator,r):t.operator==="-v"?await tm(e,r):t.operator==="-o"?nm(e,r):!1}case"CondNot":return e.state.shoptOptions.extglob&&t.operand.type==="CondGroup"&&t.operand.expression.type==="CondWord"?`!(${await Et(e,t.operand.expression.word)})`!="":!await $a(e,t.operand);case"CondAnd":return await $a(e,t.left)?await $a(e,t.right):!1;case"CondOr":return await $a(e,t.left)?!0:await $a(e,t.right);case"CondGroup":return await $a(e,t.expression);case"CondWord":return await Et(e,t.word)!=="";default:return!1}}async function fc(e,t){if(t.length===0)return ae("","",1);if(t.length===1)return dr(!!t[0]);if(t.length===2){let n=t[0],i=t[1];return n==="("?re(`test: '(' without matching ')' `,2):G0(n)?dr(await V0(e,n,i)):J0(n)?dr(em(n,i)):n==="!"?dr(!i):n==="-v"?dr(await tm(e,i)):n==="-o"?dr(nm(e,i)):n==="="||n==="=="||n==="!="||n==="<"||n===">"||n==="-eq"||n==="-ne"||n==="-lt"||n==="-le"||n==="-gt"||n==="-ge"||n==="-nt"||n==="-ot"||n==="-ef"?re(`test: ${n}: unary operator expected `,2):ae("","",1)}if(t.length===3){let n=t[0],i=t[1],a=t[2];if(Hc(i))return dr(Y0(i,n,a));if(Q0(i)){let s=Wc(n),o=Wc(a);return!s.valid||!o.valid?ae("","",2):dr(K0(i,s.value,o.value))}if(Z0(i))return dr(await X0(e,i,n,a));switch(i){case"-a":return dr(n!==""&&a!=="");case"-o":return dr(n!==""||a!=="");case">":return dr(n>a);case"<":return dr(n0&&"@*+?!".includes(e[i-1]);if(n.push(a),a&&r++,r>t)throw new T(`extglob maximum depth (${t}) exceeded`,"recursion")}else e[i]===")"&&n.length>0&&n.pop()&&r--}}function SA(e,t){let r="";for(let n=0;nSA(c,t)),u=l.length>0?l.join("|"):"(?:)";if(i==="@")r+=`(?:${u})`;else if(i==="*")r+=`(?:${u})*`;else if(i==="+")r+=`(?:${u})+`;else if(i==="?")r+=`(?:${u})?`;else if(i==="!")if(akA(p,t));if(c.every(p=>p!==null)&&c.every(p=>p===c[0])&&c[0]!==null){let p=c[0];if(p===0)r+="(?:.+)";else{let d=[];p>0&&d.push(`.{0,${p-1}}`),d.push(`.{${p+1},}`),d.push(`(?!(?:${u})).{${p}}`),r+=`(?:${d.join("|")})`}}else r+=`(?:(?!(?:${u})).)*?`}else r+=`(?!(?:${u})$).*`;n=a;continue}}if(i==="\\")if(n+10;){let i=e[n];if(i==="\\"){n+=2;continue}if(i==="(")r++;else if(i===")"&&(r--,r===0))return n;n++}return-1}function CA(e){let t=[],r="",n=0,i=0;for(;ikA(l,t));if(o.every(l=>l!==null)&&o.every(l=>l===o[0])){r+=o[0],n=a+1;continue}return null}return null}}if(i==="*")return null;if(i==="?"){r+=1,n++;continue}if(i==="["){let a=e.indexOf("]",n+1);if(a!==-1){r+=1,n=a+1;continue}r+=1,n++;continue}if(i==="\\"){r+=1,n+=2;continue}r+=1,n++}return r}function nm(e,t){let r=new Map([["errexit",()=>e.state.options.errexit===!0],["nounset",()=>e.state.options.nounset===!0],["pipefail",()=>e.state.options.pipefail===!0],["xtrace",()=>e.state.options.xtrace===!0],["e",()=>e.state.options.errexit===!0],["u",()=>e.state.options.nounset===!0],["x",()=>e.state.options.xtrace===!0]]).get(t);return r?r():!1}async function H7(e,t){if(t=t.trim(),t==="")return 0;if(/^[+-]?(\d+#[a-zA-Z0-9@_]+|0[xX][0-9a-fA-F]+|0[0-7]+|\d+)$/.test(t))return W7(t);try{let r=new ft,n=Ut(r,t);return await xt(e,n.expression)}catch{return W7(t)}}function iq(e,t){let r=0;for(let n of e){let i;if(n>="0"&&n<="9")i=n.charCodeAt(0)-48;else if(n>="a"&&n<="z")i=n.charCodeAt(0)-97+10;else if(n>="A"&&n<="Z")i=n.charCodeAt(0)-65+36;else if(n==="@")i=62;else if(n==="_")i=63;else return Number.NaN;if(i>=t)return Number.NaN;r=r*t+i}return r}function W7(e){if(e=e.trim(),e==="")return 0;let t=!1;e.startsWith("-")?(t=!0,e=e.slice(1)):e.startsWith("+")&&(e=e.slice(1));let r,n=e.match(/^(\d+)#([a-zA-Z0-9@_]+)$/);if(n){let i=Number.parseInt(n[1],10);i>=2&&i<=64?r=iq(n[2],i):r=0}else/^0[xX][0-9a-fA-F]+$/.test(e)?r=Number.parseInt(e,16):/^0[0-7]+$/.test(e)?r=Number.parseInt(e,8):r=Number.parseInt(e,10);return Number.isNaN(r)&&(r=0),t?-r:r}function Wc(e){if(e=e.trim(),e==="")return{value:0,valid:!0};let t=!1;if(e.startsWith("-")?(t=!0,e=e.slice(1)):e.startsWith("+")&&(e=e.slice(1)),!/^\d+$/.test(e))return{value:0,valid:!1};let r=Number.parseInt(e,10);return Number.isNaN(r)?{value:0,valid:!1}:{value:t?-r:r,valid:!0}}function aq(e){let t="",r=0;for(;r=r.maxElements)throw new T(`array element limit exceeded (${r.maxElements})`,"array_elements");e.push(t)}function Gs(e,t){if(t&&K(e)>t.maxStringBytes)throw new T(`array assignment string limit exceeded (${t.maxStringBytes} bytes)`,"string_length");let r=[],n="",i=!1,a=!1,s=!1,o=!1;for(let l of e){if(s){n+=l,s=!1,o=!0;continue}if(l==="\\"){s=!0;continue}if(l==="'"&&!a){i||(o=!0),i=!i;continue}if(l==='"'&&!i){a||(o=!0),a=!a;continue}if((l===" "||l===" "||l===` `)&&!i&&!a){o&&(G1(r,n,t),n="",o=!1);continue}n+=l,o=!0}return o&&G1(r,n,t),r}function V1(e,t){if(t&&K(e)>t.maxStringBytes)throw new T(`array assignment string limit exceeded (${t.maxStringBytes} bytes)`,"string_length");let r=[],n=0;for(;n=e.length)break;if(e[n]!=="["){n++;continue}n++;let i="";if(e[n]==="'"||e[n]==='"'){let s=e[n];for(n++;n0&&n[n.length-1].scopeIndex===t;)n.pop();n.length===0&&e.state.localVarStack.delete(r)}}J();var NA=new Set([":",".","break","continue","eval","exec","exit","export","readonly","return","set","shift","trap","unset"]);function dq(e){return NA.has(e)}var TA=new Set(["if","then","else","elif","fi","case","esac","for","select","while","until","do","done","in","function","{","}","time","[[","]]","!"]),bp=new Set([":","true","false","cd","export","unset","exit","local","set","break","continue","return","eval","shift","getopts","compgen","complete","compopt","pushd","popd","dirs","source",".","read","mapfile","readarray","declare","typeset","readonly","let","command","shopt","exec","test","[","echo","printf","pwd","alias","unalias","type","hash","ulimit","umask","trap","times","wait","kill","jobs","fg","bg","disown","suspend","fc","history","help","enable","builtin","caller"]);ge();J();var X1="__file__:",Q1="__file_append__:",im="__rw__:",K1="__dupout__:",Y1="__dupin__:",wr=3;function hq(e){let t=e.slice(im.length),r=t.indexOf(":");if(r===-1)return null;let n=Number.parseInt(t.slice(0,r),10);if(Number.isNaN(n)||n<0)return null;let i=r+1,a=t.slice(i,i+n),s=t.slice(i+n+1),o=s.indexOf(":");if(o===-1)return null;let l=Number.parseInt(s.slice(0,o),10);return Number.isNaN(l)||l<0?null:{path:a,position:l,content:s.slice(o+1)}}function G7(e,t){let r=Number.parseInt(e.slice(t.length),10);return Number.isNaN(r)?null:r}function mq(e){if(e.startsWith(X1))return{kind:"output",path:e.slice(X1.length),append:!1};if(e.startsWith(Q1))return{kind:"output",path:e.slice(Q1.length),append:!0};if(e.startsWith(im)){let t=hq(e);if(t)return{kind:"readwrite",...t}}if(e.startsWith(K1)){let t=G7(e,K1);if(t!==null)return{kind:"dup-out",sourceFd:t}}if(e.startsWith(Y1)){let t=G7(e,Y1);if(t!==null)return{kind:"dup-in",sourceFd:t}}return{kind:"input",content:e}}function am(e){switch(e.kind){case"input":return e.content;case"output":return`${e.append?Q1:X1}${e.path}`;case"readwrite":return`${im}${e.path.length}:${e.path}:${e.position}:${e.content}`;case"dup-out":return`${K1}${e.sourceFd}`;case"dup-in":return`${Y1}${e.sourceFd}`;case"closed":throw new Error("Closed descriptors have no table encoding")}}function gq(e){return e.state.fileDescriptors??=new Map,e.state.fileDescriptors}function xq(e,t,r){r?(e.state.inputFds??=new Set,e.state.inputFds.add(t)):e.state.inputFds?.delete(t)}function no(e,t){return e.state.fdAliases?.get(t)}function zs(e,t){return[...no(e,t)??[t]]}function _A(e,t){let r=no(e,t);if(r&&(r.delete(t),e.state.fdAliases?.delete(t),r.size<2))for(let n of r)e.state.fdAliases?.delete(n)}function sm(e,t,r){if(t===r)return;e.state.fdAliases??=new Map;let n=no(e,r)??new Set([r]);n.add(t);for(let i of n)e.state.fdAliases.set(i,n)}function wp(e,t){return e.state.fileDescriptors?.get(t)}function Li(e,t){let r=wp(e,t);if(r===void 0)return;let n=e.state.inputFds?.has(t)?{kind:"input",content:r}:mq(r);return e.state.deviceFds?.has(t)&&(n.kind==="input"||n.kind==="readwrite")?{...n,device:!0}:n}function Vs(e,t){return e.state.fileDescriptors?.has(t)===!0}function om(e,t,r,n,i=!1){let a=gq(e);a.has(t)||Zz(e),a.set(t,r),xq(e,t,n),i?(e.state.deviceFds??=new Set,e.state.deviceFds.add(t)):e.state.deviceFds?.delete(t)}function vp(e,t,r,n=!1,i=!1){_A(e,t),om(e,t,r,n,i)}function ni(e,t,r){vp(e,t,am(r),r.kind==="input",(r.kind==="input"||r.kind==="readwrite")&&r.device===!0)}function Ai(e,t){e.state.fileDescriptors?.delete(t),e.state.inputFds?.delete(t),e.state.deviceFds?.delete(t),_A(e,t)}function Ah(e,t,r){let n=wp(e,r);return n===void 0?!1:(vp(e,t,n,e.state.inputFds?.has(r)===!0,e.state.deviceFds?.has(r)===!0),sm(e,t,r),!0)}function V7(e,t,r){let n=wp(e,r);if(n===void 0)return!1;if(t===r)return!0;let i=e.state.inputFds?.has(r)===!0,a=e.state.deviceFds?.has(r)===!0,s=[...no(e,r)??[]].filter(l=>l!==r);Ai(e,r),vp(e,t,n,i,a);let o=s.find(l=>Vs(e,l));return o!==void 0&&sm(e,t,o),!0}function OA(e,t){let r=Li(e,t);if(r===void 0)return{error:"not-open"};switch(r.kind){case"input":return{content:r.content};case"readwrite":return{content:r.content.slice(r.position)};case"output":case"dup-out":return{error:"write-only"};case"dup-in":return{error:"not-open"};case"closed":return{error:"not-open"}}}function nl(e,t,r){let n=Li(e,t);if(n===void 0)return;let i;if(n.kind==="input")i={...n,content:n.content.slice(r)};else if(n.kind==="readwrite")i={...n,position:n.position+r};else return;let a=am(i),s=i.kind==="input";for(let o of no(e,t)??[t])om(e,o,a,s,i.device===!0)}async function Z7(e,t,r,n,i){if(t.kind==="output")return await e.fs.appendFile(t.path,n,i),!0;let a=r.map(u=>Li(e,u)).find(u=>u?.kind==="readwrite")??t;if(a.kind!=="readwrite")return!1;let s=a.content.slice(0,a.position)+n+a.content.slice(a.position+n.length),o={...a,position:a.position+n.length,content:s};await e.fs.writeFile(a.path,s,i);let l=am(o);for(let u of r)Vs(e,u)&&om(e,u,l,!1,o.device===!0);return!0}function Aa(e,t,r){if(t.has(r))return;let n=no(e,r);t.set(r,{raw:wp(e,r),isInput:e.state.inputFds?.has(r)===!0,isDevice:e.state.deviceFds?.has(r)===!0,aliases:n?[...n].filter(i=>i!==r):[]})}function Ch(e,t){let r=e.state.fileDescriptors;if(r)for(let[n,{raw:i,isInput:a,isDevice:s,aliases:o}]of t){if(i===void 0){Ai(e,n);continue}vp(e,n,i,a,s);let l=o.find(u=>r.has(u));l!==void 0&&sm(e,n,l)}}Br();function IA(e){switch(e.operator){case"<":case"<>":case"<<":case"<<-":case"<<<":case"<&":return e.fd??0;case">":case">>":case">|":case">&":return e.fd??1;default:return null}}function yq(e){if(e.fdVariable)return!1;let t=IA(e);return t!==null&&t>=wr}async function bq(e,t,r,n){try{if(!await e.fs.exists(t))return null;if((await e.fs.stat(t)).isDirectory)return`bash: ${r}: Is a directory `;if(n.checkNoclobber&&e.state.options.noclobber&&!n.isClobber&&r!=="/dev/null")return`bash: ${r}: cannot overwrite existing file `}catch{return`bash: ${r}: cannot open redirect target `}return null}var Ya="/dev/null",dc=new Set([Ya,"/dev/zero","/dev/random","/dev/urandom"]);function X7(e){let t=Math.min(e.length,8192);for(let r=0;r127)return"utf8";return"binary"}function Vo(e,t){let{entry:r}=e;if(r.kind==="dup-out"){if(r.sourceFd===1)return{kind:"live-stdout"};if(r.sourceFd===2)return{kind:"live-stderr"}}return r.kind==="output"||r.kind==="readwrite"?r.path===Ya?{kind:"discard"}:{kind:"descriptor",source:e}:{kind:"invalid-output",fd:t}}var lm="scoped",wq="bare",vq="persistent",Eq=e=>new T(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors"),Sq=(e,t)=>Vs(e,t)||(e.state.fileDescriptors?.size??0){let t=Math.max(e.state.nextFd??10,10);for(;Vs(e,t);)t+=1;return t},kh=e=>{let t=e.endsWith("-"),r=t?e.slice(0,-1):e;return/^\d+$/.test(r)?{sourceFd:Number.parseInt(r,10),move:t}:null},Aq=(e,t,r)=>{let n=Li(e,t);return n?r?n.kind==="input"||n.kind==="readwrite"||n.kind==="dup-in"?{kind:"entry",entry:n,descriptors:zs(e,t)}:null:n.kind==="output"||n.kind==="readwrite"||n.kind==="dup-out"?{kind:"entry",entry:n,descriptors:zs(e,t)}:null:null},Cq=new Map([["ENOENT","No such file or directory"],["ENOTDIR","Not a directory"]]);async function ks(e,t,r,n,i=!0){let a=e.fs.resolvePath(e.state.cwd,t);if(a===Ya)return{entry:{kind:"output",path:Ya,append:r}};let s=await bq(e,a,t,{checkNoclobber:!r,isClobber:n});if(s)return{error:ae("",s,1)};if(t==="/dev/full")return{error:ae("",`bash: /dev/full: No space left on device `,1)};if(t==="/dev/stdout")return{entry:{kind:"dup-out",sourceFd:1}};if(t==="/dev/stderr")return{entry:{kind:"dup-out",sourceFd:2}};try{r?await e.fs.appendFile(a,"","binary"):await e.fs.writeFile(a,"","binary")}catch(o){let l=V4(o),u=l&&Cq.get(l);if(u)return{error:ae("",`bash: ${t}: ${u} `,1)};if(!i)throw o;return{error:ae("",`bash: ${t}: cannot open redirect target `,1)}}return{entry:{kind:"output",path:a,append:r}}}async function Nh(e,t,r){let n=e.fs.resolvePath(e.state.cwd,t);try{let i=n===Ya?"":await e.fs.readFile(n);return r?{entry:{kind:"readwrite",path:n,position:0,content:i,device:dc.has(n)}}:{entry:{kind:"input",content:i,device:dc.has(n)}}}catch{if(!r)return{error:ae("",`bash: ${t}: No such file or directory `,1)};try{return await e.fs.writeFile(n,"","binary"),{entry:{kind:"readwrite",path:n,position:0,content:"",device:dc.has(n)}}}catch{return{error:ae("",`bash: ${t}: No such file or directory `,1)}}}}var kq=async(e,t)=>{let r=await Et(e,t.content);return t.stripTabs?r.split(` `).map(n=>n.replace(/^\t+/,"")).join(` `):r};async function Nq(e,t,r,n){let i=(w,v)=>e.state.closedStandardFds?.has(w)?{kind:"closed"}:Li(e,w)??v,a=new Map([[0,i(0,{kind:"dup-in",sourceFd:0})],[1,i(1,{kind:"dup-out",sourceFd:1})],[2,i(2,{kind:"dup-out",sourceFd:2})]]),s={stdout:Vo({kind:"entry",entry:a.get(1),descriptors:zs(e,1)},1),stderr:Vo({kind:"entry",entry:a.get(2),descriptors:zs(e,2)},2)},o=(w,v)=>{w===1?s.stdout=v:w===2&&(s.stderr=v)},l=w=>w.kind==="dup-out"?w.sourceFd===1?s.stdout:s.stderr:w.path===Ya?{kind:"discard"}:{kind:"file",path:w.path,append:w.append},u=n.numericSnapshot,c,p=-1,d=!1,f=!1,h=a.get(0);h?.kind==="input"?(c=h.content,p=0,f=h.device===!0):h?.kind==="readwrite"?(c=h.content.slice(h.position),p=0,f=h.device===!0):h?.kind==="closed"&&(c="",f=!0);let m=()=>({outputRoutes:s,stdin:c,stdinSourceFd:p,stdinReplaced:d,stdinUnavailable:f,error:null}),g=async(w,v,A)=>{let R={...m(),error:await Zs(e,w,v>0,s)};return A?{...R,errorCause:A}:R},x=async(w,v)=>{if(Sq(e,w))return null;let A=Eq(e);return g(ae("",A.stderr,T.EXIT_CODE),v,A)},y=(w,v,A)=>{w!==null&&w{a.set(w,v),(w===1||w===2)&&o(w,Vo({kind:"entry",entry:v,descriptors:[]},w)),Aa(e,n.standardSnapshot,w),n.standardClosedSnapshot.has(w)||n.standardClosedSnapshot.set(w,e.state.closedStandardFds?.has(w)===!0),e.state.closedStandardFds?.delete(w),ni(e,w,v)},k=(w,v)=>{if(w=wr){let _=await x(A,w);if(_)return _;Aa(e,u,A),ni(e,A,{kind:"input",content:$})}else if(A===0||A===null)c=Ha($),p=-1,y(A,{kind:"input",content:c}),d=!0,f=!1;else{let _={kind:"input",content:$};n.policy==="persistent"?y(A,_):b(A,_)}continue}let R,I=v.operator===">&"||v.operator==="<&";if(I){if(wA(e,v.target))return g(ae("",`bash: $@: ambiguous redirect `,1),w);R=await Et(e,v.target)}else if(v.operator==="<<<")R=await Et(e,v.target);else{let $=await Bz(e,v.target);if("error"in $)return g(ae("",$.error,1),w);R=$.target}if(R.includes("\0"))return g(ae("",`bash: ${R.replace(/\0/g,"")}: No such file or directory `,1),w);if(v.fdVariable){try{Qt(e,v.fdVariable)}catch(S){if(!(S instanceof at))throw S;return g(ae(S.stdout,S.stderr,S.exitCode),w,S)}if(I&&R==="-"){let S=Number.parseInt(e.state.env.get(v.fdVariable)??"",10);Number.isNaN(S)||(Aa(e,n.fdVariableSnapshot,S),Ai(e,S));continue}let $=Q7(e),_=I?kh(R):null;if(_&&!k(_.sourceFd,v.operator==="<&"))return g(ae("",`bash: ${_.sourceFd}: Bad file descriptor `,1),w);if(!(_?.move===!0&&_.sourceFd>=wr)){let S=await x($,w);if(S)return S}Aa(e,n.fdVariableSnapshot,$),n.fdVariableEnv.has(v.fdVariable)||n.fdVariableEnv.set(v.fdVariable,e.state.env.get(v.fdVariable));let M,P;if(I){let S=_;if(S){let D=k(S.sourceFd,v.operator==="<&");if(!D)return g(ae("",`bash: ${S.sourceFd}: Bad file descriptor `,1),w);P=S,S.sourceFd"||v.operator===">|"||v.operator===">>"||v.operator==="&>"||v.operator==="&>>"){let S=v.operator===">>"||v.operator==="&>>",D=await ks(e,R,S,v.operator===">|");if(D.error)return g(D.error,w);M=D.entry}else if(v.operator==="<<<")M={kind:"input",content:`${R} `};else if(v.operator==="<"||v.operator==="<>"){let S=await Nh(e,R,v.operator==="<>");if(S.error)return g(S.error,w);M=S.entry}if(P&&P.sourceFd>=wr){if(!(P.move?V7(e,$,P.sourceFd):Ah(e,$,P.sourceFd)))return g(ae("",`bash: ${P.sourceFd}: Bad file descriptor `,1),w)}else M&&ni(e,$,M);P?.move&&P.sourceFd!==$&&P.sourceFd=wr)){let M=await x($,w);if(M)return M}if(Aa(e,u,$),I){let M=_;if(!M){if(v.operator==="<&")return g(ae("",`bash: ${R}: ambiguous redirect `,1),w);let S=await ks(e,R,!1,!1);if(S.error)return g(S.error,w);ni(e,$,S.entry);continue}let P=k(M.sourceFd,v.operator==="<&");if(!P)return g(ae("",`bash: ${M.sourceFd}: Bad file descriptor `,1),w);if(M.sourceFd"||v.operator===">|"||v.operator===">>"){let M=await ks(e,R,v.operator===">>",v.operator===">|");if(M.error)return g(M.error,w);ni(e,$,M.entry)}else if(v.operator==="<<<")ni(e,$,{kind:"input",content:`${R} `});else if(v.operator==="<"||v.operator==="<>"){let M=await Nh(e,R,v.operator==="<>");if(M.error)return g(M.error,w);ni(e,$,M.entry)}continue}if(I){if(R==="-"){A===0&&(c="",p=-1,d=!0,f=!0),A!==null&&A=wr){if(!Ah(e,A,$.sourceFd))return g(ae("",`bash: ${$.sourceFd}: Bad file descriptor `,1),w);a.set(A,Li(e,A)),e.state.closedStandardFds?.delete(A),o(A,M)}else y(A,_.entry,M);if(v.operator==="<&"&&A===0)if(_.entry.kind==="input"||_.entry.kind==="readwrite"){let P=$.sourceFd=wr?Ai(e,$.sourceFd):(a.set($.sourceFd,{kind:"closed"}),($.sourceFd===1||$.sourceFd===2)&&o($.sourceFd,{kind:"invalid-output",fd:$.sourceFd}),n.policy==="persistent"&&(Ai(e,$.sourceFd),e.state.closedStandardFds??=new Set,e.state.closedStandardFds.add($.sourceFd))));continue}if(v.operator===">"||v.operator===">|"||v.operator===">>"||v.operator==="&>"||v.operator==="&>>"){let $=await ks(e,R,v.operator===">>"||v.operator==="&>>",v.operator===">|",!1);if($.error)return g($.error,w);let _=$.entry,M=l(_);v.operator==="&>"||v.operator==="&>>"?(y(1,_,M),y(2,_,M)):y(A,_,M);continue}if(v.operator==="<<<"){let $=Ha(`${R} `);y(A,{kind:"input",content:$}),A===0&&(c=$,p=-1,d=!0,f=!1)}else if(v.operator==="<"){let $=e.fs.resolvePath(e.state.cwd,R);try{let _=$===Ya?"":await Mi(e.fs,$),M=dc.has($);y(A,{kind:"input",content:_,device:M}),A===0&&(c=_,p=-1,d=!0,f=M)}catch{return g(ae("",`bash: ${R}: No such file or directory `,1),w)}}else if(v.operator==="<>"){let $=await Nh(e,R,!0);if($.error)return g($.error,w);let _=$.entry;y(A,_),A===0&&_.kind==="readwrite"&&(c=_.content,p=-1,d=!0,f=_.device===!0)}}return m()}function jc(e,t,r){let n={numericSnapshot:new Map,fdVariableSnapshot:new Map,standardSnapshot:new Map,standardClosedSnapshot:new Map,fdVariableEnv:new Map,nextFd:e.state.nextFd,policy:r},i=!1;return{prepare:(a="")=>Nq(e,t,a,n),finish:()=>{if(!i){if(i=!0,r!=="persistent"&&Ch(e,n.numericSnapshot),r!=="persistent"){Ch(e,n.standardSnapshot);for(let[a,s]of n.standardClosedSnapshot)s?(e.state.closedStandardFds??=new Set,e.state.closedStandardFds.add(a)):e.state.closedStandardFds?.delete(a)}if(r==="bare"){Ch(e,n.fdVariableSnapshot);for(let[a,s]of n.fdVariableEnv)s===void 0?e.state.env.delete(a):e.state.env.set(a,s);e.state.nextFd=n.nextFd}}}}}function Gc(e){if(!e.error)throw new Error("Expected a redirection error");if(e.errorCause)throw e.errorCause.stdout=e.error.stdout,e.errorCause.stderr=e.error.stderr,e.errorCause;return e.error}async function $A(e,t,r,n){let i=t instanceof at||t instanceof di||t instanceof $i?t.exitCode:t instanceof T?T.EXIT_CODE:0,a=await Zs(e,ae(t.stdout,t.stderr,i),r.length>0,n.outputRoutes);t.stdout=a.stdout,t.stderr=a.stderr,t.internalOutputAccounting=a.internalOutputAccounting??{stdout:K(a.stdout),stderr:K(a.stderr)}}async function fi(e,t,r,n){let i=jc(e,t,lm),a;try{if(a=await i.prepare(r),a.error)return Gc(a);let s=e.state.groupStdin,o=e.state.groupStdinSourceFd;a.stdin!==void 0&&(e.state.groupStdin=a.stdin,e.state.groupStdinSourceFd=a.stdinSourceFd);try{let l=await n(a);return await Zs(e,l,t.length>0,a.outputRoutes)}finally{a.stdin!==void 0&&(e.state.groupStdin=s,e.state.groupStdinSourceFd=o)}}catch(s){throw!(s instanceof ur)||!a||await $A(e,s,t,a),s}finally{i.finish()}}async function Zs(e,t,r,n,i="bash",a=!1){r&&(t=e.executionScope.accountResult(t,"redirection"));let{stdout:s,stderr:o,exitCode:l}=t,u=t.stdoutKind==="bytes"||t.stdoutKind===void 0&&t.stdoutEncoding==="binary"?"binary":"utf8",c=h=>u,{stdout:p,stderr:d}=n;if(s!==""||o!==""){let h=s,m=o;s="",o="",p.kind==="invalid-output"&&h!==""&&(h="",m+=`${a?"":"bash: "}${i}: write error: Bad file descriptor `,l=1),d.kind==="invalid-output"&&m!==""&&(m="",l===0&&(l=1));let g=async(x,y,b)=>{x.append?await e.fs.appendFile(x.path,y,b):await e.fs.writeFile(x.path,y,b)};if(p===d&&(p.kind==="file"||p.kind==="descriptor")){let x=h+m;x!==""&&(p.kind==="file"?await g(p,x,c(x)):await Z7(e,p.source.entry,p.source.descriptors,x,c(x)))}else for(let[x,y,b]of[[h,p,!0],[m,d,!1]])if(x!=="")switch(y.kind){case"live-stdout":s+=x;break;case"live-stderr":o+=x;break;case"file":await g(y,x,b?c(x):X7(x));break;case"descriptor":await Z7(e,y.source.entry,y.source.descriptors,x,b?c(x):X7(x));break;case"invalid-output":break;case"discard":break}}let f=ae(s,o,l);if(t.stdoutKind&&(f.stdoutKind=t.stdoutKind),t.stdoutEncoding==="binary"&&(f.stdoutEncoding="binary"),t.internalPipeStatusOverride&&(f.internalPipeStatusOverride=t.internalPipeStatusOverride),r||e.state.fileDescriptors?.has(1)===!0||e.state.fileDescriptors?.has(2)===!0){let h=(t.internalOutputAccounting?.stdout??0)+(t.internalOutputAccounting?.stderr??0),m=K(f.stdout),g=K(f.stderr),x=Math.min(m,h);f.internalOutputAccounting={stdout:x,stderr:Math.min(g,h-x)},e.executionScope.accountResult(f,"redirection")}else t.internalOutputAccounting&&(f.internalOutputAccounting=t.internalOutputAccounting);return f}function Tq(e,t){if(e.state.options.posix&&NA.has(t.name)){let n=`bash: line ${e.state.currentLine}: \`${t.name}': is a special builtin `;throw new at(2,"",n)}let r={...t,sourceFile:t.sourceFile??e.state.currentSource??"main"};return e.state.functions.set(t.name,r),Tt}async function DA(e,t,r,n="",i,a=!1){e.state.callDepth++,e.state.callDepth>e.limits.maxCallDepth&&(e.state.callDepth--,ro(`${t.name}: maximum recursion depth (${e.limits.maxCallDepth}) exceeded, increase executionLimits.maxCallDepth`,"recursion")),e.state.funcNameStack||(e.state.funcNameStack=[]),e.state.callLineStack||(e.state.callLineStack=[]),e.state.sourceStack||(e.state.sourceStack=[]),e.state.funcNameStack.unshift(t.name),e.state.callLineStack.unshift(i??e.state.currentLine),e.state.sourceStack.unshift(t.sourceFile??"main"),e.state.localScopes.push(new Map),e.state.localArrayScopes??=[],e.state.localArrayScopes.push(new Map),e.state.localExportedVars||(e.state.localExportedVars=[]),e.state.localExportedVars.push(new Set);let s=new Map,o=Number.parseInt(e.state.env.get("#")??"0",10),l=Math.max(r.length,o);for(let f=0;f{if(u)return;u=!0;let f=e.state.localScopes.length-1,h=e.state.localScopes.pop(),m=e.state.localArrayScopes?.pop();if(h)for(let[g,x]of h)x===void 0?e.state.env.delete(g):e.state.env.set(g,x);if(m){e.state.arrays??=new Map;for(let[g,x]of m)x===void 0?(e.state.arrays.delete(g),e.state.associativeArrays?.delete(g)):(e.state.arrays.set(g,Di(x)),e.state.associativeArrays??=new Set,x.kind==="associative"?e.state.associativeArrays.add(g):e.state.associativeArrays.delete(g))}if(fq(e,f),e.state.fullyUnsetLocals)for(let[g,x]of e.state.fullyUnsetLocals.entries())x===f&&e.state.fullyUnsetLocals.delete(g);if(e.state.localExportedVars&&e.state.localExportedVars.length>0){let g=e.state.localExportedVars.pop();if(g)for(let x of g)e.state.exportedVars?.delete(x)}for(let[g,x]of s)x===void 0?e.state.env.delete(g):e.state.env.set(g,x);e.state.funcNameStack?.shift(),e.state.callLineStack?.shift(),e.state.sourceStack?.shift(),e.state.callDepth--},p=null,d=jc(e,t.redirections,lm);try{if(p=await d.prepare(n),p.error)return Gc(p);let f=p.stdin??n,h=a||p.stdin!==void 0||n!=="",m=await e.executeCommand(t.body,f,h);return Zs(e,m,t.redirections.length>0,p.outputRoutes)}catch(f){if(f instanceof ur&&p&&(await $A(e,f,t.redirections,p),f instanceof di))return ae(f.stdout,f.stderr,f.exitCode);throw f}finally{d.finish(),c()}}var RA=e=>e.type==="Escaped"?le.literal(`\\${e.value}`):e.type==="DoubleQuoted"?{...e,parts:e.parts.map(RA)}:e,LA=["!","[[","]]","case","do","done","elif","else","esac","fi","for","function","if","in","then","time","until","while","{","}"],um=[".",":","[","alias","bg","bind","break","builtin","caller","cd","command","compgen","complete","compopt","continue","declare","dirs","disown","echo","enable","eval","exec","exit","export","false","fc","fg","getopts","hash","help","history","jobs","kill","let","local","logout","mapfile","popd","printf","pushd","pwd","read","readarray","readonly","return","set","shift","shopt","source","suspend","test","times","trap","true","type","typeset","ulimit","umask","unalias","unset","wait"],_q=["autocd","assoc_expand_once","cdable_vars","cdspell","checkhash","checkjobs","checkwinsize","cmdhist","compat31","compat32","compat40","compat41","compat42","compat43","compat44","complete_fullquote","direxpand","dirspell","dotglob","execfail","expand_aliases","extdebug","extglob","extquote","failglob","force_fignore","globasciiranges","globstar","gnu_errfmt","histappend","histreedit","histverify","hostcomplete","huponexit","inherit_errexit","interactive_comments","lastpipe","lithist","localvar_inherit","localvar_unset","login_shell","mailwarn","no_empty_cmd_completion","nocaseglob","nocasematch","nullglob","progcomp","progcomp_alias","promptvars","restricted_shell","shift_verbose","sourcepath","xpg_echo"],Oq=um;async function Iq(e,t){let r=[],n=null,i="",a="",s=null,o=!1,l=!1,u=!1,c=null,p=null,d=null,f=[],h=["alias","arrayvar","binding","builtin","command","directory","disabled","enabled","export","file","function","group","helptopic","hostname","job","keyword","running","service","setopt","shopt","signal","stopped","user","variable"];for(let v=0;v=t.length)return re(`compgen: -A: option requires an argument `,2);let R=t[v];if(!h.includes(R))return re(`compgen: ${R}: invalid action name `,2);r.push(R)}else if(A==="-W"){if(v++,v>=t.length)return re(`compgen: -W: option requires an argument `,2);n=t[v]}else if(A==="-P"){if(v++,v>=t.length)return re(`compgen: -P: option requires an argument `,2);i=t[v]}else if(A==="-S"){if(v++,v>=t.length)return re(`compgen: -S: option requires an argument `,2);a=t[v]}else if(A==="-o"){if(v++,v>=t.length)return re(`compgen: -o: option requires an argument `,2);let R=t[v];if(R==="plusdirs")o=!0;else if(R==="dirnames")l=!0;else if(R==="default")u=!0;else if(!(R==="filenames"||R==="nospace"||R==="bashdefault"||R==="noquote"))return re(`compgen: ${R}: invalid option name `,2)}else if(A==="-F"){if(v++,v>=t.length)return re(`compgen: -F: option requires an argument `,2);p=t[v]}else if(A==="-C"){if(v++,v>=t.length)return re(`compgen: -C: option requires an argument `,2);d=t[v]}else if(A==="-X"){if(v++,v>=t.length)return re(`compgen: -X: option requires an argument `,2);c=t[v]}else if(A==="-G"){if(v++,v>=t.length)return re(`compgen: -G: option requires an argument `,2)}else if(A==="--"){f.push(...t.slice(v+1));break}else A.startsWith("-")||f.push(A)}s=f[0]??null;let m=[],g=new Set,x=()=>e.limits.maxArrayElements-m.length,y=v=>{for(let A of v){if(m.length>=e.limits.maxArrayElements)throw new T(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(K(A)>e.limits.maxStringLength)throw new T(`compgen: completion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");e.executionScope.consumeWork(1,"compgen completion"),m.push(A),g.add(A)}};if(l){let v=await Th(e,s,x());y(v)}if(u){let v=await K7(e,s,x());y(v)}for(let v of r)if(v==="variable"){let A=$q(e,s,x());y(A)}else if(v==="export"){let A=Dq(e,s,x());y(A)}else if(v==="function"){let A=Rq(e,s,x());y(A)}else if(v==="builtin"){let A=Lq(e,s,x());y(A)}else if(v==="keyword"){let A=Mq(e,s,x());y(A)}else if(v==="alias"){let A=Pq(e,s,x());y(A)}else if(v==="shopt"){let A=Fq(e,s,x());y(A)}else if(v==="helptopic"){let A=Bq(e,s,x());y(A)}else if(v==="directory"){let A=await Th(e,s,x());y(A)}else if(v==="file"){let A=await K7(e,s,x());y(A)}else if(v==="user"){let A=Uq(e,s,x());y(A)}else if(v==="command"){let A=await zq(e,s,x());y(A)}if(n!==null)try{let v=await qq(e,n),A=Hq(e,v,x(),s);for(let R of A)y([R])}catch(v){if(v instanceof T)throw v;return ae("","",1)}if(o){let v=await Th(e,s,x(),g);for(let A of v)g.has(A)||y([A])}let b="";if(p!==null){let v=e.state.functions.get(p);if(v){let A=new Map,R=sn(e,"COMP_WORDS"),I=R?Di(R):void 0;an(e,"COMP_WORDS"),fp(e,"COMP_WORDS"),A.set("COMP_CWORD",e.state.env.get("COMP_CWORD")),e.state.env.set("COMP_CWORD","-1"),A.set("COMP_LINE",e.state.env.get("COMP_LINE")),e.state.env.set("COMP_LINE",""),A.set("COMP_POINT",e.state.env.get("COMP_POINT")),e.state.env.set("COMP_POINT","0");let $=sn(e,"COMPREPLY"),_=$?Di($):void 0,M=e.state.env.get("COMPREPLY");an(e,"COMPREPLY"),e.state.env.delete("COMPREPLY");let P=["compgen",f[0]??"",""];try{let S=await DA(e,v,P,"");if(S.exitCode!==0)return _h(e,A),Ns(e,"COMP_WORDS",I),Ns(e,"COMPREPLY",_),M!==void 0&&e.state.env.set("COMPREPLY",M),ae("",S.stderr,1);b=S.stdout;let D=Wq(e,x());y(D)}catch(S){if(S instanceof T)throw S;return _h(e,A),Ns(e,"COMP_WORDS",I),Ns(e,"COMPREPLY",_),M!==void 0&&e.state.env.set("COMPREPLY",M),ae("","",1)}_h(e,A),Ns(e,"COMP_WORDS",I),Ns(e,"COMPREPLY",_),M!==void 0&&e.state.env.set("COMPREPLY",M)}}if(d!==null)try{let v=Ws(d),A=await e.executeScript(v);if(A.exitCode!==0)return ae("",A.stderr,A.exitCode);if(A.stdout)for(let R of jq(A.stdout))R.length>0&&y([R])}catch(v){if(v.name==="ParseException")return re(`compgen: -C: ${v.message} `,2);throw v}let k=m;if(c!==null){let v=c.startsWith("!"),A=v?c.slice(1):c;k=m.filter(R=>{let I=rm(R,A,!1,!0,e.limits.maxCallDepth);return v?I:!I})}if(k.length===0&&s!==null)return ae(b,"",1);let w=new St(e.limits.maxOutputSize,"compgen");w.append(b);for(let v of k)w.append(i).append(v).append(a).append(` `);return mt(w.build())}function $q(e,t,r){let n=Tn(e,t,r);for(let i of e.state.env.keys())/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i)&&n.add(i);for(let i of e.state.arrays?.keys()??[])n.add(i);return n.build()}function Dq(e,t,r){let n=Tn(e,t,r),i=e.state.exportedVars??new Set;for(let a of i)e.state.env.has(a)&&n.add(a);return n.build()}function Rq(e,t,r){let n=Tn(e,t,r);for(let i of e.state.functions.keys())n.add(i);return n.build()}function Lq(e,t,r){let n=Tn(e,t,r);for(let i of um)n.add(i);return n.build()}function Mq(e,t,r){let n=Tn(e,t,r);for(let i of LA)n.add(i);return n.build()}function Pq(e,t,r){let n=Tn(e,t,r);for(let i of e.state.env.keys())if(i.startsWith("BASH_ALIAS_")){let a=i.slice(11);n.add(a)}return n.build()}function Fq(e,t,r){let n=Tn(e,t,r);for(let i of _q)n.add(i);return n.build()}function Bq(e,t,r){let n=Tn(e,t,r);for(let i of Oq)n.add(i);return n.build()}async function Th(e,t,r=e.limits.maxArrayElements,n){let i=Tn(e,null,r,n);try{let a=e.state.cwd,s=t??"";if(t){let l=t.lastIndexOf("/");if(l!==-1){let u=t.slice(0,l)||"/";s=t.slice(l+1),u.startsWith("/")?a=u:a=`${e.state.cwd}/${u}`}}let o=await e.fs.readdir(a);for(let l of o){e.executionScope.consumeWork(1,"compgen directory scan");let u=`${a}/${l}`;try{if((await e.fs.stat(u)).isDirectory&&(!s||l.startsWith(s)))if(t?.includes("/")){let c=t.lastIndexOf("/"),p=t.slice(0,c+1);i.add(p+l)}else i.add(l)}catch(c){if(c instanceof T)throw c}}}catch(a){if(a instanceof T)throw a}return i.build()}async function K7(e,t,r=e.limits.maxArrayElements){let n=Tn(e,null,r);try{let i=e.state.cwd,a=t??"";if(t){let o=t.lastIndexOf("/");if(o!==-1){let l=t.slice(0,o)||"/";a=t.slice(o+1),l.startsWith("/")?i=l:i=`${e.state.cwd}/${l}`}}let s=await e.fs.readdir(i);for(let o of s)if(e.executionScope.consumeWork(1,"compgen file scan"),!a||o.startsWith(a))if(t?.includes("/")){let l=t.lastIndexOf("/"),u=t.slice(0,l+1);n.add(u+o)}else n.add(o)}catch(i){if(i instanceof T)throw i}return n.build()}function Uq(e,t,r){let n=Tn(e,t,r);return n.add("root"),n.add("nobody"),n.build()}async function zq(e,t,r){let n=Tn(e,t,r);for(let a of um)n.add(a);for(let a of e.state.functions.keys())n.add(a);for(let a of e.state.env.keys())a.startsWith("BASH_ALIAS_")&&n.add(a.slice(11));for(let a of LA)n.add(a);let i=e.state.env.get("PATH")??"/usr/bin:/bin";for(let a of i.split(":"))if(a)try{let s=await e.fs.readdir(a);for(let o of s)n.add(o)}catch(s){if(s instanceof T)throw s}return n.build()}function Tn(e,t,r,n){let i=new Set;return{add(a){if(e.executionScope.consumeWork(1,"compgen candidate collection"),!(t!==null&&!a.startsWith(t))&&!n?.has(a)&&!i.has(a)){if(i.size>=r)throw new T(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(K(a)>e.limits.maxStringLength)throw new T(`compgen: completion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");i.add(a)}},build(){return Array.from(i).sort()}}}async function qq(e,t){let r=new ft().parseWordFromString(t,!1,!1);return await Et(e,le.word(r.parts.map(RA)))}function Hq(e,t,r,n){let i=e.state.env.get("IFS")??` `;if(i.length===0){if(n!==null&&!t.startsWith(n))return[];if(r===0)throw new T(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");return[t]}let a=new Set(i.split("")),s=[],o=c=>{if(!(n!==null&&!c.startsWith(n))){if(s.length>=r)throw new T(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");s.push(c)}},l="",u=0;for(;u0&&(o(l),l=""),u++):(l+=c,u++)}return l.length>0&&o(l),s}function _h(e,t){for(let[r,n]of t)n===void 0?e.state.env.delete(r):e.state.env.set(r,n)}function Ns(e,t,r){e.state.arrays??=new Map,r?e.state.arrays.set(t,Di(r)):e.state.arrays.delete(t)}function Wq(e,t){let r=[],n=i=>{if(r.length>=t)throw new T(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");r.push(i)};if(Hn(e,"COMPREPLY")){let i=Ye(e,"COMPREPLY");for(let[,a]of i)n(a)}else{let i=e.state.env.get("COMPREPLY");i!==void 0&&n(i)}return r}function*jq(e){let t=0;for(;t<=e.length;){let r=e.indexOf(` `,t),n=r===-1?e.length:r;if(n>t&&(yield e.slice(t,n)),r===-1)return;t=r+1}}ge();function Tl(e){for(let t=0;t=t.length)return re(`complete: -W: option requires an argument `,2);a=t[p]}else if(d==="-F"){if(p++,p>=t.length)return re(`complete: -F: option requires an argument `,2);s=t[p]}else if(d==="-o"){if(p++,p>=t.length)return re(`complete: -o: option requires an argument `,2);let f=t[p];if(!Vq.includes(f))return re(`complete: ${f}: invalid option name `,2);l.push(f)}else if(d==="-A"){if(p++,p>=t.length)return re(`complete: -A: option requires an argument `,2);u.push(t[p])}else if(d==="-C"){if(p++,p>=t.length)return re(`complete: -C: option requires an argument `,2);o=t[p]}else if(d==="-G"){if(p++,p>=t.length)return re(`complete: -G: option requires an argument `,2)}else if(d==="-P"){if(p++,p>=t.length)return re(`complete: -P: option requires an argument `,2)}else if(d==="-S"){if(p++,p>=t.length)return re(`complete: -S: option requires an argument `,2)}else if(d==="-X"){if(p++,p>=t.length)return re(`complete: -X: option requires an argument `,2)}else if(d==="--"){c.push(...t.slice(p+1));break}else d.startsWith("-")||c.push(d)}if(n){if(c.length===0)return e.state.completionSpecs.clear(),e.state.defaultCompletionSpec=void 0,e.state.emptyCompletionSpec=void 0,mt("");for(let p of c)e.state.completionSpecs.delete(p);return mt("")}if(r)return c.length===0?Oh(e):Oh(e,c);if(t.length===0||c.length===0&&!a&&!s&&!o&&l.length===0&&u.length===0&&!i)return Oh(e);if(s&&c.length===0&&!i)return re(`complete: -F: option requires a command name `,2);if(i){let p={isDefault:!0};return a!==void 0&&(p.wordlist=a),s!==void 0&&(p.function=s),o!==void 0&&(p.command=o),l.length>0&&(p.options=l),u.length>0&&(p.actions=u),e.state.defaultCompletionSpec=p,mt("")}for(let p of c){let d=Object.create(null);a!==void 0&&(d.wordlist=a),s!==void 0&&(d.function=s),o!==void 0&&(d.command=o),l.length>0&&(d.options=l),u.length>0&&(d.actions=u),e.state.completionSpecs.set(p,d)}return mt("")}function Oh(e,t){let r=e.state.completionSpecs??new Map;if(r.size===0&&!e.state.defaultCompletionSpec){if(t&&t.length>0){let a="";for(let s of t)a+=`complete: ${s}: no completion specification `;return ae("",a,1)}return mt("")}let n=[],i=t||Array.from(r.keys());for(let a of i){let s=r.get(a);if(!s){if(t)return ae(n.join(` `)+(n.length>0?` `:""),`complete: ${a}: no completion specification `,1);continue}let o="complete";if(s.options)for(let l of s.options)o+=` -o ${vr(l)}`;if(s.actions)for(let l of s.actions)o+=` -A ${vr(l)}`;s.wordlist!==void 0&&(s.wordlist.includes(" ")||s.wordlist.includes("'")?o+=` -W ${vr(s.wordlist)}`:o+=` -W ${vr(s.wordlist)}`),s.function!==void 0&&(o+=` -F ${vr(s.function)}`),s.command!==void 0&&(o+=` -C ${vr(s.command)}`),s.isDefault&&(o+=" -D"),o+=`${a.startsWith("-")?" -- ":" "}${vr(a)}`,n.push(o)}if(!t&&e.state.defaultCompletionSpec){let a=e.state.defaultCompletionSpec,s="complete";for(let o of a.options??[])s+=` -o ${vr(o)}`;for(let o of a.actions??[])s+=` -A ${vr(o)}`;a.wordlist!==void 0&&(s+=` -W ${vr(a.wordlist)}`),a.function!==void 0&&(s+=` -F ${vr(a.function)}`),a.command!==void 0&&(s+=` -C ${vr(a.command)}`),s+=" -D",n.push(s)}return n.length===0?mt(""):mt(`${n.join(` `)} `)}var Y7=["bashdefault","default","dirnames","filenames","noquote","nosort","nospace","plusdirs"];function Xq(e,t){e.state.completionSpecs||(e.state.completionSpecs=new Map);let r=!1,n=!1,i=[],a=[],s=[];for(let o=0;o=t.length)return re(`compopt: -o: option requires an argument `,2);let u=t[o];if(!Y7.includes(u))return re(`compopt: ${u}: invalid option name `,2);i.push(u)}else if(l==="+o"){if(o++,o>=t.length)return re(`compopt: +o: option requires an argument `,2);let u=t[o];if(!Y7.includes(u))return re(`compopt: ${u}: invalid option name `,2);a.push(u)}else if(l==="--"){s.push(...t.slice(o+1));break}else!l.startsWith("-")&&!l.startsWith("+")&&s.push(l)}if(r){let o=e.state.defaultCompletionSpec??{isDefault:!0},l=new Set(o.options??[]);for(let u of i)l.add(u);for(let u of a)l.delete(u);return o.options=l.size>0?Array.from(l):void 0,e.state.defaultCompletionSpec=o,mt("")}if(n){let o=e.state.emptyCompletionSpec??Object.create(null),l=new Set(o.options??[]);for(let u of i)l.add(u);for(let u of a)l.delete(u);return o.options=l.size>0?Array.from(l):void 0,e.state.emptyCompletionSpec=o,mt("")}if(s.length>0){for(let o of s){let l=e.state.completionSpecs.get(o)??{},u=new Set(l.options??[]);for(let c of i)u.add(c);for(let c of a)u.delete(c);l.options=u.size>0?Array.from(u):void 0,e.state.completionSpecs.set(o,l)}return mt("")}return re(`compopt: not currently executing completion function `,1)}J();function Qq(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new bl;return Tt}if(t.length>1)throw new at(1,"",`bash: continue: too many arguments `);let r=1;if(t.length>0){let n=Number.parseInt(t[0],10);if(Number.isNaN(n)||n<1)throw new at(1,"",`bash: continue: ${t[0]}: numeric argument required `);r=n}throw new Ii(r)}Yt();function PA(e,t){let r="";return e.state.integerVars?.has(t)&&(r+="i"),e.state.lowercaseVars?.has(t)&&(r+="l"),Kt(e,t)&&(r+="n"),e.state.readonlyVars?.has(t)&&(r+="r"),e.state.uppercaseVars?.has(t)&&(r+="u"),e.state.exportedVars?.has(t)&&(r+="x"),r===""?"--":`-${r}`}function dm(e){return vr(e)}function hm(e){return`'${e.replace(/'/g,"'\\''")}'`}function Kq(e,t){let r="",n="",i=!1;for(let a of t){let s=PA(e,a);if(e.state.associativeArrays?.has(a)){let u=Js(e,a);if(u.length===0)r+=`declare -A ${a}=() `;else{let c=u.map(p=>{let d=Nt(e,a,p)??"",f=dm(d);return`[${hm(p)}]=${f}`});r+=`declare -A ${a}=(${c.join(" ")}) `}continue}let o=Vr(e,a);if(o.length>0){let u=o.map(c=>{let p=Nt(e,a,c)??"";return`[${c}]=${io(p)}`});r+=`declare -a ${a}=(${u.join(" ")}) `;continue}if(Hn(e,a)){r+=`declare -a ${a}=() `;continue}let l=e.state.env.get(a);if(l!==void 0)r+=`declare ${s} ${a}=${fm(l)} `;else{let u=e.state.declaredVars?.has(a),c=e.state.localVarDepth?.has(a);u||c?r+=`declare ${s} ${a} `:(n+=`bash: declare: ${a}: not found `,i=!0)}}return ae(r,n,i?1:0)}function Yq(e,t){let{filterExport:r,filterReadonly:n,filterNameref:i,filterIndexedArray:a,filterAssocArray:s}=t,o=r||n||i||a||s,l="",u=new Set;for(let p of e.state.env.keys())p.startsWith("BASH_")||u.add(p);for(let p of e.state.arrays?.keys()??[])u.add(p);if(e.state.localVarDepth)for(let p of e.state.localVarDepth.keys())u.add(p);if(e.state.associativeArrays)for(let p of e.state.associativeArrays)u.add(p);let c=Array.from(u).sort();for(let p of c){let d=PA(e,p),f=e.state.associativeArrays?.has(p),h=Vr(e,p),m=!f&&Hn(e,p);if(o&&(s&&!f||a&&!m||r&&!e.state.exportedVars?.has(p)||n&&!e.state.readonlyVars?.has(p)||i&&!Kt(e,p)))continue;if(f){let x=Js(e,p);if(x.length===0)l+=`declare -A ${p}=() `;else{let y=x.map(b=>{let k=Nt(e,p,b)??"",w=dm(k);return`[${hm(b)}]=${w}`});l+=`declare -A ${p}=(${y.join(" ")}) `}continue}if(h.length>0){let x=h.map(y=>{let b=Nt(e,p,y)??"";return`[${y}]=${io(b)}`});l+=`declare -a ${p}=(${x.join(" ")}) `;continue}if(Hn(e,p)){l+=`declare -a ${p}=() `;continue}let g=e.state.env.get(p);g!==void 0&&(l+=`declare ${d} ${p}=${fm(g)} `)}return mt(l)}function Jq(e){let t="",r=Array.from(e.state.associativeArrays??[]).sort();for(let n of r){let i=Js(e,n);if(i.length===0)t+=`declare -A ${n}=() `;else{let a=i.map(s=>{let o=Nt(e,n,s)??"",l=dm(o);return`[${hm(s)}]=${l}`});t+=`declare -A ${n}=(${a.join(" ")}) `}}return mt(t)}function eH(e){let t="",r=new Set(Array.from(e.state.arrays??[]).filter(([,i])=>i.kind==="indexed").map(([i])=>i)),n=Array.from(r).sort();for(let i of n){let a=Vr(e,i);if(a.length===0)t+=`declare -a ${i}=() `;else{let s=a.map(o=>{let l=Nt(e,i,o)??"";return`[${o}]=${io(l)}`});t+=`declare -a ${i}=(${s.join(" ")}) `}}return mt(t)}function tH(e){let t="",r=new Set;for(let i of e.state.env.keys())i.startsWith("BASH_")||r.add(i);let n=Array.from(r).sort();for(let i of n){if(e.state.associativeArrays?.has(i)||Vr(e,i).length>0||Hn(e,i))continue;let a=e.state.env.get(i);a!==void 0&&(t+=`${i}=${vr(a)} `)}return mt(t)}function Ih(e,t){e.state.integerVars??=new Set,e.state.integerVars.add(t)}function J1(e,t){return e.state.integerVars?.has(t)??!1}function $h(e,t){e.state.lowercaseVars??=new Set,e.state.lowercaseVars.add(t),e.state.uppercaseVars?.delete(t)}function rH(e,t){return e.state.lowercaseVars?.has(t)??!1}function Dh(e,t){e.state.uppercaseVars??=new Set,e.state.uppercaseVars.add(t),e.state.lowercaseVars?.delete(t)}function nH(e,t){return e.state.uppercaseVars?.has(t)??!1}function hc(e,t,r){return rH(e,t)?r.toLowerCase():nH(e,t)?r.toUpperCase():r}async function J7(e,t){try{let r=new ft,n=Ut(r,t),i=await xt(e,n.expression);return String(i)}catch{return"0"}}function iH(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return null;let r=t[0],n=r.length;if(e[n]!=="[")return null;let i=0,a=n+1;for(;n0&&!x,k=I=>{if(!b)return;let $=e.state.localScopes[e.state.localScopes.length-1];$.has(I)||$.set(I,e.state.env.get(I))},w=I=>{if(!b)return;let $=e.state.localScopes[e.state.localScopes.length-1];for($.has(I)||$.set(I,e.state.env.get(I)),e.state.localArrayScopes??=[];e.state.localArrayScopes.length{b&&Ms(e,I)};if(g){if(y.length===0){let _=Array.from(e.state.functions.keys()).sort(),M="";for(let P of _)M+=`declare -f ${P} `;return mt(M)}let I=!0,$="";for(let _ of y)e.state.functions.has(_)?$+=`${_} `:I=!1;return ae($,"",I?0:1)}if(m){if(y.length===0){let $="",_=Array.from(e.state.functions.keys()).sort();for(let M of _)$+=`${M} () { # function body } `;return mt($)}let I=!0;for(let $ of y)e.state.functions.has($)||(I=!1);return ae("","",I?0:1)}if(o&&y.length>0)return Kq(e,y);if(o&&y.length===0)return Yq(e,{filterExport:s,filterReadonly:a,filterNameref:l,filterIndexedArray:n,filterAssocArray:i});if(y.length===0&&i&&!o)return Jq(e);if(y.length===0&&n&&!o)return eH(e);if(y.length===0&&!o)return tH(e);let A="",R=0;for(let I of y){let $=I.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if($&&!c){let S=$[1],D=$[2],W=Qt(e,S);if(W)return W;if(i&&Vr(e,S).length>0){A+=`bash: declare: ${S}: cannot convert indexed to associative array `,R=1;continue}if((n||!i&&!n)&&e.state.associativeArrays?.has(S)){A+=`bash: declare: ${S}: cannot convert associative to indexed array `,R=1;continue}let j=i&&D.includes("[")?V1(D,r):void 0,U=j===void 0?Gs(D,{...r,maxElements:i?r.maxElements*2:r.maxElements}):void 0;if(e.executionScope.consumeWork(j?.length??U?.length??0,"declare array assignment"),w(S),i?(e.state.associativeArrays??=new Set,e.state.associativeArrays.add(S),Ps(e,S,"associative")):Ps(e,S,"indexed"),an(e,S),e.state.env.delete(S),i&&D.includes("["))for(let[H,z]of j??[])je(e,S,H,hl(e,z),"associative");else if(i){let H=U??[];for(let z=0;z/^\[[^\]]+\]=/.test(z))){let z=0;for(let ee of H){let Y=ee.match(/^\[([^\]]+)\]=(.*)$/);if(Y){let ne=Y[1],Z=Y[2],ve;if(/^-?\d+$/.test(ne))ve=Number.parseInt(ne,10);else try{let de=new ft,xe=Ut(de,ne);ve=await xt(e,xe.expression)}catch{ve=0}je(e,S,ve,hl(e,Z)),z=ve+1}else je(e,S,z,ee),z++}}else for(let z=0;zH));for(let[H,z]of U)je(e,S,H,z,"associative")}else{e.executionScope.consumeWork(j.length,"declare array append");let U=Vr(e,S),H=0,z=e.state.env.get(S);U.length===0&&z!==void 0?(je(e,S,0,z),e.state.env.delete(S),H=1):U.length>0&&(H=Math.max(...U)+1),pl(e,S,Array.from({length:j.length},(ee,Y)=>H+Y));for(let ee=0;ee0||e.state.associativeArrays?.has(S);if(J1(e,S)){let U=e.state.env.get(S)??"0",H=parseInt(U,10)||0,z=parseInt(await J7(e,D),10)||0;D=String(H+z),e.state.env.set(S,D)}else if(j){D=hc(e,S,D);let U=Nt(e,S,0)??"";je(e,S,0,Wa([U,D],"",e.limits.maxStringLength,"declare append"))}else{D=hc(e,S,D);let U=e.state.env.get(S)??"";e.state.env.set(S,Wa([U,D],"",e.limits.maxStringLength,"declare append"))}v(S),a&&bn(e,S),s&&Si(e,S),e.state.options.allexport&&!p&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(S));continue}if(I.includes("=")){let S=I.indexOf("="),D=I.slice(0,S),W=I.slice(S+1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(D)){A+=`bash: typeset: \`${D}': not a valid identifier `,R=1;continue}let j=Qt(e,D);if(j)return j;if(k(D),l){if(W!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(W)){A+=`bash: declare: \`${W}': invalid variable name for name reference `,R=1;continue}e.state.env.set(D,W),Ra(e,D),W!==""&&B1(e,W)&&I7(e,D),v(D),a&&bn(e,D),s&&Si(e,D);continue}if(d&&Ih(e,D),f&&$h(e,D),h&&Dh(e,D),J1(e,D)&&(W=await J7(e,W)),W=hc(e,D,W),Kt(e,D)){let U=pi(e,D);U&&U!==D?e.state.env.set(U,W):e.state.env.set(D,W)}else e.state.env.set(D,W);v(D),a&&bn(e,D),s&&Si(e,D),e.state.options.allexport&&!p&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(D))}else{let S=I;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(S)){A+=`bash: typeset: \`${S}': not a valid identifier `,R=1;continue}if(n||i?w(S):k(S),l){Ra(e,S);let W=e.state.env.get(S);W!==void 0&&W!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(W)?nU(e,S):W&&B1(e,W)&&I7(e,S),v(S),a&&bn(e,S),s&&Si(e,S);continue}if(d&&Ih(e,S),f&&$h(e,S),h&&Dh(e,S),i){if(Vr(e,S).length>0){A+=`bash: declare: ${S}: cannot convert indexed to associative array `,R=1;continue}e.state.associativeArrays??=new Set,e.state.associativeArrays.add(S),Ps(e,S,"associative")}let D=Hn(e,S);!e.state.env.has(S)&&!D&&(n||i?Ps(e,S,i?"associative":"indexed"):(e.state.declaredVars??=new Set,e.state.declaredVars.add(S))),v(S),a&&bn(e,S),s&&Si(e,S)}}return ae("",A,R)}async function sH(e,t){let r={maxElements:e.limits.maxArrayElements,maxStringBytes:e.limits.maxStringLength},n=!1,i=!1,a=!1,s=[];for(let o=0;ox));for(let[x,y]of g)je(e,d,x,y,"associative")}else{e.executionScope.consumeWork(m.length,"readonly array append");let g=Vr(e,d),x=0,y=e.state.env.get(d);g.length===0&&y!==void 0?(je(e,d,0,y),e.state.env.delete(d),x=1):g.length>0&&(x=Math.max(...g)+1),pl(e,d,Array.from({length:m.length},(b,k)=>x+k));for(let b=0;bn&&n!=="."),r=[];for(let n of t)n===".."?r.pop():r.push(n);return`/${r.join("/")}`}async function lH(e,t){let r=mm(e),n;for(let o=0;ol);o.pop(),i=`/${o.join("/")}`}else n==="."?i=e.state.cwd:n.startsWith("~")?i=(e.state.env.get("HOME")||"/")+n.slice(1):i=`${e.state.cwd}/${n}`;i=oH(i);try{if(!(await e.fs.stat(i)).isDirectory)return re(`bash: pushd: ${n}: Not a directory `,1)}catch{return re(`bash: pushd: ${n}: No such file or directory `,1)}r.unshift(e.state.cwd),e.state.previousDir=e.state.cwd,e.state.cwd=i,e.state.env.set("PWD",i),e.state.env.set("OLDPWD",e.state.previousDir);let a=e.state.env.get("HOME")||"",s=`${[i,...r].map(o=>il(o,a)).join(" ")} `;return mt(s)}function uH(e,t){let r=mm(e);for(let s of t)if(s!=="--")return s.startsWith("-")&&s!=="-"?re(`bash: popd: ${s}: invalid option `,2):re(`bash: popd: too many arguments `,2);if(r.length===0)return re(`bash: popd: directory stack empty `,1);let n=r.shift();if(!n)return re(`bash: popd: directory stack empty `,1);e.state.previousDir=e.state.cwd,e.state.cwd=n,e.state.env.set("PWD",n),e.state.env.set("OLDPWD",e.state.previousDir);let i=e.state.env.get("HOME")||"",a=`${[n,...r].map(s=>il(s,i)).join(" ")} `;return mt(a)}function cH(e,t){let r=mm(e),n=!1,i=!1,a=!1,s=!1;for(let c of t)if(c!=="--")if(c.startsWith("-"))for(let p of c.slice(1))if(p==="c")n=!0;else if(p==="l")i=!0;else if(p==="p")a=!0;else if(p==="v")a=!0,s=!0;else return re(`bash: dirs: -${p}: invalid option `,2);else return re(`bash: dirs: too many arguments `,1);if(n)return e.state.directoryStack=[],Tt;let o=[e.state.cwd,...r],l=e.state.env.get("HOME")||"",u;return s?(u=o.map((c,p)=>{let d=i?c:il(c,l);return` ${p} ${d}`}).join(` `),u+=` `):a?u=o.map(c=>i?c:il(c,l)).join(` `)+` `:u=o.map(c=>i?c:il(c,l)).join(" ")+` `,mt(u)}J();async function e4(e,t,r,n=!1){let i=t;if(i.length>0){let l=i[0];if(l==="--")i=i.slice(1);else if(l.startsWith("-")&&l!=="-"&&l.length>1)return re(`bash: eval: ${l}: invalid option eval: usage: eval [arg ...] `,2)}if(i.length===0)return Tt;let a=i.join(" ");if(a.trim()==="")return Tt;let s=e.state.groupStdin,o=n||r!==void 0&&r!=="";o&&(e.state.groupStdin=r??"");try{let l=Ws(a);return await e.executeScript(l)}catch(l){if(l instanceof Oi||l instanceof Ii||l instanceof di||l instanceof at)throw l;if(l.name==="ParseException")return re(`bash: eval: ${l.message} `);throw l}finally{(o||s!==void 0&&e.state.groupStdin===void 0)&&(e.state.groupStdin=s)}}J();function pH(e,t){let r,n="";if(t.length===0)r=e.state.lastExitCode;else{let i=t[0];if(i===""||!/^-?\d+$/.test(i))n=`bash: exit: ${i}: numeric argument required `,r=2;else{let a=BigInt(i);r=Number((a%256n+256n)%256n)}}throw new at(r,"",n)}function fH(e,t){let r=!1,n=[];for(let s of t)s==="-n"?r=!0:s==="-p"||s==="--"||n.push(s);if(n.length===0&&!r){let s="",o=e.state.exportedVars??new Set,l=Array.from(o).sort();for(let u of l){let c=e.state.env.get(u);c!==void 0&&(s+=`declare -x ${u}=${fm(c)} `)}return mt(s)}if(r){for(let s of n){let o,l;if(s.includes("=")){let u=s.indexOf("=");o=s.slice(0,u),l=s.slice(u+1)}else o=s;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o))return ae("",`bash: export: \`${s}': not a valid identifier `,1);l!==void 0&&(Qt(e,o),e.state.env.set(o,l)),oA(e,o)}return Tt}let i="",a=0;for(let s of n){let o,l,u=!1,c=s.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(c)o=c[1],l=c[2],u=!0;else if(s.includes("=")){let p=s.indexOf("=");o=s.slice(0,p),l=s.slice(p+1)}else o=s;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o)){i+=`bash: export: \`${s}': not a valid identifier `,a=1;continue}if(l!==void 0)if(Qt(e,o),u){let p=e.state.env.get(o)??"";e.state.env.set(o,p+l)}else e.state.env.set(o,l);else e.state.env.has(o)||e.state.env.set(o,"");Si(e,o)}return ae("",i,a)}function FA(e,t){if(t.length<2)return re(`bash: getopts: usage: getopts optstring name [arg ...] `);let r=t[0],n=t[1],i=!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n),a=r.startsWith(":"),s=a?r.slice(1):r,o;if(t.length>2)o=t.slice(2);else{let h=Number.parseInt(e.state.env.get("#")||"0",10);o=[];for(let m=1;m<=h;m++)o.push(e.state.env.get(String(m))||"")}let l=Number.parseInt(e.state.env.get("OPTIND")||"1",10);l<1&&(l=1);let u=Number.parseInt(e.state.env.get("__GETOPTS_CHARINDEX")||"0",10);if(e.state.env.set("OPTARG",""),l>o.length)return i||e.state.env.set(n,"?"),e.state.env.set("OPTIND",String(o.length+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),{exitCode:i?2:1,stdout:"",stderr:""};let c=o[l-1];if(!c||c==="-"||!c.startsWith("-"))return i||e.state.env.set(n,"?"),{exitCode:i?2:1,stdout:"",stderr:""};if(c==="--")return e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),i||e.state.env.set(n,"?"),{exitCode:i?2:1,stdout:"",stderr:""};let p=u===0?1:u,d=c[p];if(!d)return e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),FA(e,t);let f=s.indexOf(d);if(f===-1){let h="";return a?e.state.env.set("OPTARG",d):h=`bash: illegal option -- ${d} `,i||e.state.env.set(n,"?"),p+1=o.length){let h="";return a?(e.state.env.set("OPTARG",d),i||e.state.env.set(n,":")):(h=`bash: option requires an argument -- ${d} `,i||e.state.env.set(n,"?")),e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),{exitCode:i?2:0,stdout:"",stderr:h}}e.state.env.set("OPTARG",o[l]),e.state.env.set("OPTIND",String(l+2)),e.state.env.set("__GETOPTS_CHARINDEX","0")}else p+1=t.length)return re(`bash: hash: -p: option requires an argument `,1);o=t[u],u++}else if(f.startsWith("-")&&f.length>1){for(let h of f.slice(1))if(h==="r")r=!0;else if(h==="d")n=!0;else if(h==="l")i=!0;else if(h==="t")s=!0;else return re(h==="p"?`bash: hash: -p: option requires an argument `:`bash: hash: -${h}: invalid option `,1);u++}else l.push(f),u++}if(r)return e.state.hashTable.clear(),Tt;if(n){if(l.length===0)return re(`bash: hash: -d: option requires an argument `,1);let f=!1,h="";for(let m of l)e.state.hashTable.has(m)?e.state.hashTable.delete(m):(h+=`bash: hash: ${m}: not found `,f=!0);return f?re(h,1):Tt}if(s){if(l.length===0)return re(`bash: hash: -t: option requires an argument `,1);let f="",h=!1,m="";for(let g of l){let x=e.state.hashTable.get(g);x?l.length>1?f+=`${g} ${x} `:f+=`${x} `:(m+=`bash: hash: ${g}: not found `,h=!0)}return h?{exitCode:1,stdout:f,stderr:m}:mt(f)}if(a){if(l.length===0)return re(`bash: hash: usage: hash [-lr] [-p pathname] [-dt] [name ...] `,1);let f=l[0];return e.state.hashTable.set(f,o),Tt}if(l.length===0){if(e.state.hashTable.size===0)return mt(`hash: hash table empty `);let f="";if(i)for(let[h,m]of e.state.hashTable){let g=h.startsWith("-")?" --":"";f+=`builtin hash -p ${vr(m)}${g} ${vr(h)} `}else{f=`hits command `;for(let[,h]of e.state.hashTable)f+=` 1 ${h} `}return mt(f)}let c=!1,p="",d=(e.state.env.get("PATH")||"/usr/bin:/bin").split(":");for(let f of l){if(f.includes("/")){p+=`bash: hash: ${f}: cannot use / in name `,c=!0;continue}let h=!1;for(let m of d){if(!m)continue;let g=`${m}/${f}`;if(await e.fs.exists(g)){e.state.hashTable.set(f,g),h=!0;break}}h||(p+=`bash: hash: ${f}: not found `,c=!0)}return c?re(p,1):Tt}Dt();var BA=new Map([[":",[": [arguments]",`Null command. No effect; the command does nothing. Exit Status: Always succeeds.`]],[".",[". filename [arguments]",`Execute commands from a file in the current shell. Read and execute commands from FILENAME in the current shell. The entries in $PATH are used to find the directory containing FILENAME. Exit Status: Returns the status of the last command executed in FILENAME.`]],["[",["[ arg... ]",`Evaluate conditional expression. This is a synonym for the "test" builtin, but the last argument must be a literal \`]', to match the opening \`['.`]],["alias",["alias [-p] [name[=value] ... ]",`Define or display aliases. Without arguments, \`alias' prints the list of aliases in the reusable form \`alias NAME=VALUE' on standard output. Exit Status: alias returns true unless a NAME is supplied for which no alias has been defined.`]],["bg",["bg [job_spec ...]",`Move jobs to the background. Place the jobs identified by each JOB_SPEC in the background, as if they had been started with \`&'.`]],["break",["break [n]",`Exit for, while, or until loops. Exit a FOR, WHILE or UNTIL loop. If N is specified, break N enclosing loops. Exit Status: The exit status is 0 unless N is not greater than or equal to 1.`]],["builtin",["builtin [shell-builtin [arg ...]]",`Execute shell builtins. Execute SHELL-BUILTIN with arguments ARGs without performing command lookup. This is useful when you wish to reimplement a shell builtin as a shell function, but need to execute the builtin within the function. Exit Status: Returns the exit status of SHELL-BUILTIN, or false if SHELL-BUILTIN is not a shell builtin.`]],["caller",["caller [expr]",`Return the context of the current subroutine call. Without EXPR, returns "$line $filename". With EXPR, returns "$line $subroutine $filename"; this extra information can be used to provide a stack trace. Exit Status: Returns 0 unless the shell is not executing a subroutine call or EXPR is invalid.`]],["cd",["cd [-L|-P] [dir]",`Change the shell working directory. Change the current directory to DIR. The default DIR is the value of the HOME shell variable. The variable CDPATH defines the search path for the directory containing DIR. Alternative directory names in CDPATH are separated by a colon (:). A null directory name is the same as the current directory. If DIR begins with a slash (/), then CDPATH is not used. If the directory is not found, and the shell option \`cdable_vars' is set, the word is assumed to be a variable name. If that variable has a value, its value is used for DIR. Options: -L force symbolic links to be followed -P use the physical directory structure without following symbolic links The default is to follow symbolic links, as if \`-L' were specified. Exit Status: Returns 0 if the directory is changed; non-zero otherwise.`]],["command",["command [-pVv] command [arg ...]",`Execute a simple command or display information about commands. Runs COMMAND with ARGS suppressing shell function lookup, or display information about the specified COMMANDs. Options: -p use a default value for PATH that is guaranteed to find all of the standard utilities -v print a description of COMMAND similar to the \`type' builtin -V print a more verbose description of each COMMAND Exit Status: Returns exit status of COMMAND, or failure if COMMAND is not found.`]],["compgen",["compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [word]",`Display possible completions depending on the options. Intended to be used from within a shell function generating possible completions. If the optional WORD argument is supplied, matches against WORD are generated. Exit Status: Returns success unless an invalid option is supplied or an error occurs.`]],["complete",["complete [-abcdefgjksuv] [-pr] [-DEI] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...]",`Specify how arguments are to be completed. For each NAME, specify how arguments are to be completed. Exit Status: Returns success unless an invalid option is supplied or an error occurs.`]],["continue",["continue [n]",`Resume for, while, or until loops. Resumes the next iteration of the enclosing FOR, WHILE or UNTIL loop. If N is specified, resumes the Nth enclosing loop. Exit Status: The exit status is 0 unless N is not greater than or equal to 1.`]],["declare",["declare [-aAfFgilnrtux] [-p] [name[=value] ...]",`Set variable values and attributes. Declare variables and give them attributes. If no NAMEs are given, display the attributes and values of all variables. Options: -a to make NAMEs indexed arrays (if supported) -A to make NAMEs associative arrays (if supported) -i to make NAMEs have the \`integer' attribute -l to convert the value of each NAME to lower case on assignment -n make NAME a reference to the variable named by its value -r to make NAMEs readonly -t to make NAMEs have the \`trace' attribute -u to convert the value of each NAME to upper case on assignment -x to make NAMEs export Exit Status: Returns success unless an invalid option is supplied or a variable assignment error occurs.`]],["dirs",["dirs [-clpv] [+N] [-N]",`Display directory stack. Display the list of currently remembered directories. Directories find their way onto the list with the \`pushd' command; you can get back up through the list with the \`popd' command. Exit Status: Returns success unless an invalid option is supplied or an error occurs.`]],["disown",["disown [-h] [-ar] [jobspec ...]",`Remove jobs from current shell. Without any JOBSPECs, remove the current job.`]],["echo",["echo [-neE] [arg ...]",`Write arguments to the standard output. Display the ARGs, separated by a single space character and followed by a newline, on the standard output. Options: -n do not append a newline -e enable interpretation of the following backslash escapes -E explicitly suppress interpretation of backslash escapes Exit Status: Returns success unless a write error occurs.`]],["enable",["enable [-a] [-dnps] [-f filename] [name ...]",`Enable and disable shell builtins. Enables and disables builtin shell commands. Exit Status: Returns success unless NAME is not a shell builtin or an error occurs.`]],["eval",["eval [arg ...]",`Execute arguments as a shell command. Combine ARGs into a single string, use the result as input to the shell, and execute the resulting commands. Exit Status: Returns exit status of command or success if command is null.`]],["exec",["exec [-cl] [-a name] [command [arguments ...]] [redirection ...]",`Replace the shell with the given command. Execute COMMAND, replacing this shell with the specified program. ARGUMENTS become the arguments to COMMAND. If COMMAND is not specified, any redirections take effect in the current shell. Exit Status: Returns success unless COMMAND is not found or a redirection error occurs.`]],["exit",["exit [n]",`Exit the shell. Exits the shell with a status of N. If N is omitted, the exit status is that of the last command executed.`]],["export",["export [-fn] [name[=value] ...] or export -p",`Set export attribute for shell variables. Marks each NAME for automatic export to the environment of subsequently executed commands. If VALUE is supplied, assign VALUE before exporting. Options: -f refer to shell functions -n remove the export property from each NAME -p display a list of all exported variables and functions Exit Status: Returns success unless an invalid option is given or NAME is invalid.`]],["false",["false",`Return an unsuccessful result. Exit Status: Always fails.`]],["fc",["fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]",`Display or execute commands from the history list. Exit Status: Returns success or status of executed command.`]],["fg",["fg [job_spec]",`Move job to the foreground. Place the job identified by JOB_SPEC in the foreground, making it the current job.`]],["getopts",["getopts optstring name [arg]",`Parse option arguments. Getopts is used by shell procedures to parse positional parameters as options. OPTSTRING contains the option letters to be recognized; if a letter is followed by a colon, the option is expected to have an argument, which should be separated from it by white space. Exit Status: Returns success if an option is found; fails if the end of options is encountered or an error occurs.`]],["hash",["hash [-lr] [-p pathname] [-dt] [name ...]",`Remember or display program locations. Determine and remember the full pathname of each command NAME. Exit Status: Returns success unless NAME is not found or an invalid option is given.`]],["help",["help [-s] [pattern ...]",`Display information about builtin commands. Displays brief summaries of builtin commands. If PATTERN is specified, gives detailed help on all commands matching PATTERN, otherwise the list of help topics is printed. Options: -s output only a short usage synopsis for each topic matching PATTERN Exit Status: Returns success unless PATTERN is not found.`]],["history",["history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]",`Display or manipulate the history list. Display the history list with line numbers, prefixing each modified entry with a \`*'. Exit Status: Returns success unless an invalid option is given or an error occurs.`]],["jobs",["jobs [-lnprs] [jobspec ...] or jobs -x command [args]",`Display status of jobs. Lists the active jobs. Exit Status: Returns success unless an invalid option is given or an error occurs.`]],["kill",["kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]",`Send a signal to a job. Send the processes identified by PID or JOBSPEC the signal named by SIGSPEC or SIGNUM. Exit Status: Returns success unless an invalid option is given or an error occurs.`]],["let",["let arg [arg ...]",`Evaluate arithmetic expressions. Evaluate each ARG as an arithmetic expression. Evaluation is done in fixed-width integers with no check for overflow, though division by 0 is trapped and flagged as an error. Exit Status: If the last ARG evaluates to 0, let returns 1; 0 is returned otherwise.`]],["local",["local [option] name[=value] ...",`Define local variables. Create a local variable called NAME, and give it VALUE. OPTION can be any option accepted by \`declare'. Local can only be used within a function; it makes the variable NAME have a visible scope restricted to that function and its children. Exit Status: Returns success unless an invalid option is supplied, a variable assignment error occurs, or the shell is not executing a function.`]],["logout",["logout [n]",`Exit a login shell. Exits a login shell with exit status N. Returns an error if not executed in a login shell.`]],["mapfile",["mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]",`Read lines from the standard input into an indexed array variable. Read lines from the standard input into the indexed array variable ARRAY, or from file descriptor FD if the -u option is supplied. Options: -d delim Use DELIM to terminate lines, instead of newline -n count Copy at most COUNT lines -O origin Begin assigning to ARRAY at index ORIGIN -s count Discard the first COUNT lines read -t Remove a trailing DELIM from each line read (default newline) -u fd Read lines from file descriptor FD instead of standard input Exit Status: Returns success unless an invalid option is given or ARRAY is readonly.`]],["popd",["popd [-n] [+N | -N]",`Remove directories from stack. Removes entries from the directory stack. Exit Status: Returns success unless an invalid argument is supplied or the directory change fails.`]],["printf",["printf [-v var] format [arguments]",`Formats and prints ARGUMENTS under control of the FORMAT. Options: -v var assign the output to shell variable VAR rather than display it on the standard output FORMAT is a character string which contains three types of objects: plain characters, which are simply copied to standard output; character escape sequences, which are converted and copied to the standard output; and format specifications, each of which causes printing of the next successive argument. Exit Status: Returns success unless an invalid option is given or a write or assignment error occurs.`]],["pushd",["pushd [-n] [+N | -N | dir]",`Add directories to stack. Adds a directory to the top of the directory stack, or rotates the stack, making the new top of the stack the current working directory. Exit Status: Returns success unless an invalid argument is supplied or the directory change fails.`]],["pwd",["pwd [-LP]",`Print the name of the current working directory. Options: -L print the value of $PWD if it names the current working directory -P print the physical directory, without any symbolic links By default, \`pwd' behaves as if \`-L' were specified. Exit Status: Returns 0 unless an invalid option is given or the current directory cannot be read.`]],["read",["read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]",`Read a line from the standard input and split it into fields. Reads a single line from the standard input, or from file descriptor FD if the -u option is supplied. The line is split into fields as with word splitting, and the first word is assigned to the first NAME, the second word to the second NAME, and so on, with any leftover words assigned to the last NAME. Exit Status: The return code is zero, unless end-of-file is encountered, read times out, or an invalid file descriptor is supplied as the argument to -u.`]],["readarray",["readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]","Read lines from a file into an array variable.\n A synonym for `mapfile'."]],["readonly",["readonly [-aAf] [name[=value] ...] or readonly -p",`Mark shell variables as unchangeable. Mark each NAME as read-only; the values of these NAMEs may not be changed by subsequent assignment. Exit Status: Returns success unless an invalid option is given or NAME is invalid.`]],["return",["return [n]",`Return from a shell function. Causes a function or sourced script to exit with the return value specified by N. If N is omitted, the return status is that of the last command executed within the function or script. Exit Status: Returns N, or failure if the shell is not executing a function or script.`]],["set",["set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]",`Set or unset values of shell options and positional parameters. Change the value of shell attributes and positional parameters, or display the names and values of shell variables. Options: -e Exit immediately if a command exits with a non-zero status. -u Treat unset variables as an error when substituting. -x Print commands and their arguments as they are executed. -o option-name Set the variable corresponding to option-name Exit Status: Returns success unless an invalid option is given.`]],["shift",["shift [n]",`Shift positional parameters. Rename the positional parameters $N+1,$N+2 ... to $1,$2 ... If N is not given, it is assumed to be 1. Exit Status: Returns success unless N is negative or greater than $#.`]],["shopt",["shopt [-pqsu] [-o] [optname ...]",`Set and unset shell options. Change the setting of each shell option OPTNAME. Without any option arguments, list each supplied OPTNAME, or all shell options if no OPTNAMEs are given, with an indication of whether or not each is set. Options: -o restrict OPTNAMEs to those defined for use with \`set -o' -p print each shell option with an indication of its status -q suppress output -s enable (set) each OPTNAME -u disable (unset) each OPTNAME Exit Status: Returns success if OPTNAME is enabled; fails if an invalid option is given or OPTNAME is disabled.`]],["source",["source filename [arguments]",`Execute commands from a file in the current shell. Read and execute commands from FILENAME in the current shell. The entries in $PATH are used to find the directory containing FILENAME. Exit Status: Returns the status of the last command executed in FILENAME.`]],["suspend",["suspend [-f]",`Suspend shell execution. Suspend the execution of this shell until it receives a SIGCONT signal.`]],["test",["test [expr]",`Evaluate conditional expression. Exits with a status of 0 (true) or 1 (false) depending on the evaluation of EXPR. Expressions may be unary or binary. Exit Status: Returns success if EXPR evaluates to true; fails if EXPR evaluates to false or an invalid argument is given.`]],["times",["times",`Display process times. Prints the accumulated user and system times for the shell and all of its child processes. Exit Status: Always succeeds.`]],["trap",["trap [-lp] [[arg] signal_spec ...]",`Trap signals and other events. Defines and activates handlers to be run when the shell receives signals or other conditions. Exit Status: Returns success unless a SIGSPEC is invalid or an invalid option is given.`]],["true",["true",`Return a successful result. Exit Status: Always succeeds.`]],["type",["type [-afptP] name [name ...]",`Display information about command type. For each NAME, indicate how it would be interpreted if used as a command name. Options: -a display all locations containing an executable named NAME -f suppress shell function lookup -P force a PATH search for each NAME, even if it is an alias, builtin, or function, and returns the name of the disk file that would be executed -p returns either the name of the disk file that would be executed, or nothing if \`type -t NAME' would not return \`file' -t output a single word which is one of \`alias', \`keyword', \`function', \`builtin', \`file' or \`', if NAME is an alias, shell reserved word, shell function, shell builtin, disk file, or not found, respectively Exit Status: Returns success if all of the NAMEs are found; fails if any are not found.`]],["typeset",["typeset [-aAfFgilnrtux] [-p] name[=value] ...","Set variable values and attributes.\n A synonym for `declare'."]],["ulimit",["ulimit [-SHabcdefiklmnpqrstuvxPT] [limit]",`Modify shell resource limits. Provides control over the resources available to the shell and processes it creates, on systems that allow such control. Exit Status: Returns success unless an invalid option is supplied or an error occurs.`]],["umask",["umask [-p] [-S] [mode]",`Display or set file mode mask. Sets the user file-creation mask to MODE. If MODE is omitted, prints the current value of the mask. Exit Status: Returns success unless MODE is invalid or an invalid option is given.`]],["unalias",["unalias [-a] name [name ...]",`Remove each NAME from the list of defined aliases. Exit Status: Returns success unless a NAME is not an existing alias.`]],["unset",["unset [-f] [-v] [-n] [name ...]",`Unset values and attributes of shell variables and functions. For each NAME, remove the corresponding variable or function. Options: -f treat each NAME as a shell function -v treat each NAME as a shell variable -n treat each NAME as a name reference and unset the variable itself rather than the variable it references Without options, unset first tries to unset a variable, and if that fails, tries to unset a function. Exit Status: Returns success unless an invalid option is given or a NAME is read-only.`]],["wait",["wait [-fn] [id ...]",`Wait for job completion and return exit status. Waits for each process identified by an ID, which may be a process ID or a job specification, and reports its termination status. Exit Status: Returns the status of the last ID; fails if ID is invalid or an invalid option is given.`]]]),UA=[...BA.keys()].sort();function hH(e,t){let r=!1,n=[],i=0;for(;i1){for(let u=1;ur.test(n))}function gH(){let e=[];e.push("just-bash shell builtins"),e.push("These shell commands are defined internally. Type `help' to see this list."),e.push("Type `help name' to find out more about the function `name'."),e.push("");let t=36,r=UA.slice(),n=Math.ceil(r.length/2);for(let i=0;i0&&a.pipelines[0].commands.length>0){let s=a.pipelines[0].commands[0];s.type==="ArithmeticCommand"&&(n=await xt(e,s.expression.expression))}}catch(a){return re(`bash: let: ${i}: ${a.message} `)}return ae("","",n===0?1:0)}Yt();async function bH(e,t){let r={maxElements:e.limits.maxArrayElements,maxStringBytes:e.limits.maxStringLength};if(e.state.localScopes.length===0)return re(`bash: local: can only be used in a function `);let n=e.state.localScopes[e.state.localScopes.length-1];for(e.state.localArrayScopes??=[];e.state.localArrayScopes.length{if(n.has(d)||n.set(d,e.state.env.get(d)),i&&!i.has(d)){let f=sn(e,d);i.set(d,f?Di(f):void 0)}},s="",o=0,l=!1,u=!1,c=!1,p=[];for(let d of t)if(d==="-n")l=!0;else if(d==="-a")u=!0;else if(d==="-p")c=!0;else if(d.startsWith("-")&&!d.includes("="))for(let f of d.slice(1))f==="n"?l=!0:f==="a"?u=!0:f==="p"&&(c=!0);else p.push(d);if(p.length===0){let d="",f=Array.from(n.keys()).sort();for(let h of f){let m=e.state.env.get(h);m!==void 0&&(d+=`${h}=${m} `)}return ae(d,"",0)}for(let d of p){let f,h,m=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(m){f=m[1];let k=m[2];if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(f)){s+=`bash: local: \`${d}': not a valid identifier `,o=1;continue}Qt(e,f,"bash");let w=Gs(k,r);e.executionScope.consumeWork(w.length,"local array assignment"),a(f),an(e,f),Ps(e,f,"indexed");for(let v=0;v0&&(A=Math.max(...v)+1),pl(e,f,Array.from({length:w.length},(I,$)=>A+$));for(let I=0;I=0;A--){let R=e.state.tempEnvBindings[A];if(R.has(f)){k=R.get(f);break}}}pq(e,f,k)}if(!b){let k=e.state.env.get(f);if(e.state.tempEnvBindings)for(let w=e.state.tempEnvBindings.length-1;w>=0;w--){let v=e.state.tempEnvBindings[w];if(v.has(f)){k=v.get(f);break}}n.set(f,k),u&&a(f)}if(u&&h===void 0)an(e,f),Ps(e,f,"indexed");else if(h!==void 0){if(Qt(e,f,"bash"),l&&h!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(h)){s+=`bash: local: \`${h}': invalid variable name for name reference `,o=1;continue}e.state.env.set(f,h),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(f))}else{let k=e.state.tempEnvBindings?.some(w=>w.has(f));!b&&!k&&e.state.env.delete(f)}Ms(e,f),l&&Ra(e,f)}return ae("",s,o)}ge();J();function wH(e,t,r){let n=` `,i=0,a=0,s=0,o=!1,l="MAPFILE",u=0;for(;u{if(K(y)>e.limits.maxStringLength)throw new T(`mapfile: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");p.push(y)};for(;d=m)return ae("",`mapfile: array element limit exceeded (${m}) `,1);g(w),f++}}break}let b=c.slice(d,y),k=b.indexOf("\0");if(k!==-1&&(b=b.substring(0,k)),!o&&n!=="\0"&&(b+=n),d=y+n.length,h0&&f>=i)break;if(p.length>=m)return ae("",`mapfile: array element limit exceeded (${m}) `,1);g(b),f++}let x=new Set(a===0?[]:e.state.arrays?.get(l)?.elements.keys()??[]);for(let y=0;ym)return ae("",`mapfile: array element limit exceeded (${m}) `,1);a===0&&an(e,l);for(let y=0;y{let z=1;for(;z1&&U!=="--"){let H=m(U,f);if(H.nextArgIndex===-1)return{stdout:"",stderr:"",exitCode:2};if(H.nextArgIndex===-2)return{stdout:"",stderr:"",exitCode:1};f=H.nextArgIndex}else if(U==="--")for(f++;f=0&&d.length===0&&g.add("REPLY");for(let U of g){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(U))return ae("",`bash: read: \`${U}': not a valid identifier `,1);Qt(e,U,"bash")}if(p===0){if(u)an(e,u);else{for(let U of d)e.state.env.set(U,"");d.length===0&&e.state.env.set("REPLY","")}return ae("","",0)}if(p<0&&p!==-1)return ae("","",1);let x=r,y=Li(e,c),b=c>0&&!(y?.kind==="dup-in"&&y.sourceFd===0);if(b){let U=OA(e,c);if("error"in U){let H=U.error==="write-only"||c===1||c===2?`bash: read: read error: ${c}: Bad file descriptor `:`bash: read: ${c}: invalid file descriptor: Bad file descriptor `;return ae("",H,1)}x=U.content}else!x&&e.state.groupStdin!==void 0&&(x=e.state.groupStdin);let k=a===""?"\0":a,w="",v=0,A=U=>{let H=K(U);if(H>e.limits.maxStringLength-v)throw new T(`read: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");w+=U,v+=H},R=U=>{if(K(U)>e.limits.maxStringLength)throw new T(`read: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length")},I=0,$=!0,_=U=>{b?nl(e,c,U):n>=0?nl(e,n,U):e.state.groupStdin!==void 0&&!r&&(e.state.groupStdin=x.substring(U),e.state.groupStdinSourceFd!==void 0&&nl(e,e.state.groupStdinSourceFd,U))};if(l>=0){let U=Math.min(l,x.length);w=x.substring(0,U),R(w),I=U,$=U>=l,_(I);let H=d[0]||"REPLY";e.state.env.set(H,w);for(let z=1;z=0){let U=0,H=0,z=!1;for(;H=o||z,_(I)}else{I=0;let U=0;for(;U=x.length&&($=!1,I=U,w.length===0&&x.length===0)){for(let H of d)e.state.env.set(H,"");return u&&an(e,u),ae("","",1)}_(I)}k===` `&&w.endsWith(` `)&&(w=w.slice(0,-1));let M=U=>i?U:U.replace(/\\(.)/g,"$1");if(d.length===1&&d[0]==="REPLY")return e.state.env.set("REPLY",M(w)),ae("","",$?0:1);let P=$r(e.state.env),S=e.limits.maxArrayElements;if(u){let{words:U}=O7(w,P,S,void 0,i);an(e,u);for(let H=0;H0){let n=t[0],i=Number.parseInt(n,10);if(n===""||Number.isNaN(i)||!/^-?\d+$/.test(n))return re(`bash: return: ${n}: numeric argument required `,2);r=(i%256+256)%256}throw new di(r)}Yt();J();var Zo=`set: usage: set [-eux] [+eux] [-o option] [+o option] Options: -e Exit immediately if a command exits with non-zero status +e Disable -e -u Treat unset variables as an error when substituting +u Disable -u -x Print commands and their arguments as they are executed +x Disable -x -o errexit Same as -e +o errexit Disable errexit -o nounset Same as -u +o nounset Disable nounset -o pipefail Return status of last failing command in pipeline +o pipefail Disable pipefail -o xtrace Same as -x +o xtrace Disable xtrace `,t4=new Map([["e","errexit"],["u","nounset"],["x","xtrace"],["v","verbose"],["f","noglob"],["C","noclobber"],["a","allexport"],["n","noexec"],["h",null],["b",null],["m",null],["B",null],["H",null],["P",null],["T",null],["E",null],["p",null]]),Wu=new Map([["errexit","errexit"],["pipefail","pipefail"],["nounset","nounset"],["xtrace","xtrace"],["verbose","verbose"],["noclobber","noclobber"],["noglob","noglob"],["allexport","allexport"],["noexec","noexec"],["posix","posix"],["vi","vi"],["emacs","emacs"],["notify",null],["monitor",null],["braceexpand",null],["histexpand",null],["physical",null],["functrace",null],["errtrace",null],["privileged",null],["hashall",null],["ignoreeof",null],["interactive-comments",null],["keyword",null],["onecmd",null]]),zA=["errexit","nounset","pipefail","verbose","xtrace","posix","allexport","noclobber","noglob","noexec","vi","emacs"],qA=["braceexpand","errtrace","functrace","hashall","histexpand","history","ignoreeof","interactive-comments","keyword","monitor","nolog","notify","onecmd","physical","privileged"];function Rh(e,t,r){t!==null&&(r&&(t==="vi"?e.state.options.emacs=!1:t==="emacs"&&(e.state.options.vi=!1)),e.state.options[t]=r,Dc(e))}function SH(e,t){return t+10&&t.append(" "),t.append(`[${a}]=`),t.reserve(pm(s)),t.append(io(s))}t.append(")")}function CH(e,t){if(/^[a-zA-Z0-9_]+$/.test(t)){e.append(t);return}e.reserve(pm(t)),e.append(io(t))}function kH(e,t,r){let n=Js(e,r);if(n.length===0){t.append(r).append("=()");return}t.append(r).append("=(");for(let i=0;i0&&t.append(" "),t.append("["),CH(t,a),t.append("]="),t.reserve(pm(s)),t.append(io(s))}t.append(" )")}function NH(e){let t=new Set,r=e.state.associativeArrays??new Set;for(let[n,i]of e.state.arrays??[])i.kind==="indexed"&&!r.has(n)&&t.add(n);return t}function TH(e){return e.state.associativeArrays??new Set}function r4(e){let t=zA.map(n=>`${n.padEnd(16)}${e.state.options[n]?"on":"off"}`),r=qA.map(n=>`${n.padEnd(16)}off`);return`${[...t,...r].sort().join(` `)} `}function n4(e){let t=zA.map(n=>`set ${e.state.options[n]?"-o":"+o"} ${n}`),r=qA.map(n=>`set +o ${n}`);return`${[...t,...r].sort().join(` `)} `}function _H(e,t){if(t.includes("--help"))return mt(Zo);if(t.length===0){let a=NH(e),s=TH(e),o=[];for(let[c,p]of e.state.env)/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(c)&&(a.has(c)||s.has(c)||o.push([c,p]));let l=[...o.map(([c,p])=>({kind:"scalar",name:c,value:p})),...Array.from(a,c=>({kind:"indexed",name:c})),...Array.from(s,c=>({kind:"associative",name:c}))];l.sort((c,p)=>c.namep.name?1:0);let u=new St(e.limits.maxOutputSize,"set");for(let c of l)e.executionScope.consumeWork(1,"set variable listing"),c.kind==="scalar"?(u.append(c.name).append("="),u.reserve(Gq(c.value)),u.append(vr(c.value))):c.kind==="indexed"?AH(e,u,c.name):kH(e,u,c.name),u.append(` `);return mt(u.build())}let r=[],n=()=>r.length>0?mt(r.join("")):Tt,i=0;for(;i1&&(a[0]==="-"||a[0]==="+")&&a[1]!=="-"){let s=a[0]==="-",o=0;for(let l=1;l0){let s=Number.parseInt(t[0],10);if(Number.isNaN(s)||s<0){let o=`bash: shift: ${t[0]}: numeric argument required `;if(e.state.options.posix)throw new Ci(1,"",o);return re(o)}r=s}let n=Number.parseInt(e.state.env.get("#")||"0",10);if(r>n){let s=`bash: shift: shift count out of range `;if(e.state.options.posix)throw new Ci(1,"",s);return re(s)}if(r===0)return Tt;let i=[];for(let s=1;s<=n;s++)i.push(e.state.env.get(String(s))||"");let a=i.slice(r);for(let s=1;s<=n;s++)e.state.env.delete(String(s));for(let s=0;s0&&r[0]==="--"&&(r=r.slice(1)),r.length===0)return ae("",`bash: source: filename argument required `,2);let n=r[0],i=null,a=null;if(n.includes("/")){let u=e.fs.resolvePath(e.state.cwd,n);try{a=await e.fs.readFile(u),i=u}catch{}}else{let u=(e.state.env.get("PATH")||"").split(":").filter(c=>c);for(let c of u){let p=e.fs.resolvePath(e.state.cwd,`${c}/${n}`);try{if((await e.fs.stat(p)).isDirectory)continue;a=await e.fs.readFile(p),i=p;break}catch{}}if(a===null){let c=e.fs.resolvePath(e.state.cwd,n);try{a=await e.fs.readFile(c),i=c}catch{}}}if(a===null)return re(`bash: ${n}: No such file or directory `);let s=new Map;if(r.length>1){for(let c=1;c<=9;c++)s.set(String(c),e.state.env.get(String(c)));s.set("#",e.state.env.get("#")),s.set("@",e.state.env.get("@"));let u=r.slice(1);e.state.env.set("#",String(u.length)),e.state.env.set("@",u.join(" "));for(let c=0;c{if(e.state.sourceDepth--,e.state.currentSource=o,r.length>1)for(let[u,c]of s)c===void 0?e.state.env.delete(u):e.state.env.set(u,c)};if(e.state.sourceDepth++,e.state.sourceDepth>e.limits.maxSourceDepth)throw e.state.sourceDepth--,new T(`source: maximum nesting depth (${e.limits.maxSourceDepth}) exceeded, increase executionLimits.maxSourceDepth`,"recursion");e.state.currentSource=n;try{let u=Ws(a),c=await e.executeScript(u);return l(),c}catch(u){if(l(),u instanceof at)throw u;if(u instanceof di)return ae(u.stdout,u.stderr,u.exitCode);if(u.name==="ParseException")return re(`bash: ${n}: ${u.message} `);throw u}}function i4(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function $H(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')}async function a4(e,t){if($H(t))return null;try{let r=new ft,n=Ut(r,t);return await xt(e,n.expression)}catch{let r=parseInt(t,10);return Number.isNaN(r)?0:r}}function s4(e,t){if(e.state.localVarStack?.has(t)){let r=Z1(e,t);if(r){r.value===void 0?e.state.env.delete(t):e.state.env.set(t,r.value);let n=e.state.localVarStack?.get(t);if(!n||n.length===0)Sh(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,r.scopeIndex),e0(e,t);else{let i=n[n.length-1];e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,i.scopeIndex+1)}return!0}return e.state.env.delete(t),Sh(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,0),!0}for(let r=e.state.localScopes.length-1;r>=0;r--){let n=e.state.localScopes[r];if(n.has(t)){let i=n.get(t);i===void 0?e.state.env.delete(t):e.state.env.set(t,i),n.delete(t);let a=!1;for(let s=r-1;s>=0;s--)if(e.state.localScopes[s].has(t)){e.state.localVarDepth&&e.state.localVarDepth.set(t,s+1),a=!0;break}return a||Sh(e,t),!0}}return!1}function e0(e,t){if(!e.state.tempEnvBindings||e.state.tempEnvBindings.length===0)return!1;for(let r=e.state.tempEnvBindings.length-1;r>=0;r--){let n=e.state.tempEnvBindings[r];if(n.has(t)){let i=n.get(t);return i===void 0?e.state.env.delete(t):e.state.env.set(t,i),n.delete(t),!0}}return!1}async function o4(e,t){if(t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t.startsWith('"')&&t.endsWith('"')){let r=t.slice(1,-1),n=new ft().parseWordFromString(r,!0,!1);return Et(e,n)}if(t.includes("$")){let r=new ft().parseWordFromString(t,!1,!1);return Et(e,r)}return t}async function DH(e,t){let r="both",n="",i=0;for(let a of t){if(a==="-v"){r="variable";continue}if(a==="-f"){r="function";continue}if(r==="function"){e.state.functions.delete(a);continue}if(r==="variable"){let u=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(u){let d=u[1],f=u[2];if(qn(e,d)){n+=`bash: unset: ${d}: cannot unset: readonly variable `,i=1;continue}if(f==="@"||f==="*"){qu(e,d),e.state.env.delete(d);continue}let h=e.state.associativeArrays?.has(d);if(h){let y=await o4(e,f);As(e,d,y);continue}let m=Qa(e,d),g=e.state.declaredVars?.has(d);if((e.state.env.has(d)||g)&&!m&&!h){n+=`bash: unset: ${d}: not an array variable `,i=1;continue}let x=await a4(e,f);if(x===null&&m){n+=`bash: unset: ${f}: not a valid identifier `,i=1;continue}if(x===null)continue;if(x<0){let y=Ye(e,d),b=y.length,k=e.state.currentLine;if(b===0){n+=`bash: line ${k}: unset: [${x}]: bad array subscript `,i=1;continue}let w=b+x;if(w<0){n+=`bash: line ${k}: unset: [${x}]: bad array subscript `,i=1;continue}let v=y[w][0];As(e,d,v);continue}As(e,d,x);continue}if(!i4(a)){n+=`bash: unset: \`${a}': not a valid identifier `,i=1;continue}let c=a;if(Kt(e,a)){let d=pi(e,a);d&&d!==a&&(c=d)}if(qn(e,c)){n+=`bash: unset: ${c}: cannot unset: readonly variable `,i=1;continue}qu(e,c);let p=j7(e,c);if(p!==void 0&&p!==e.state.callDepth)s4(e,c);else if(e.state.fullyUnsetLocals?.has(c))e.state.env.delete(c);else if(p!==void 0){let d=e.state.accessedTempEnvVars?.has(c),f=e.state.mutatedTempEnvVars?.has(c);if((d||f)&&e.state.localVarStack?.has(c)){let h=Z1(e,c);h?h.value===void 0?e.state.env.delete(c):e.state.env.set(c,h.value):e.state.env.delete(c)}else e.state.env.delete(c)}else e0(e,c)||e.state.env.delete(c);e.state.exportedVars?.delete(c);continue}let s=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(s){let u=s[1],c=s[2];if(qn(e,u)){n+=`bash: unset: ${u}: cannot unset: readonly variable `,i=1;continue}if(c==="@"||c==="*"){qu(e,u),e.state.env.delete(u);continue}let p=e.state.associativeArrays?.has(u);if(p){let h=await o4(e,c);As(e,u,h);continue}let d=Qa(e,u);if(e.state.env.has(u)&&!d&&!p){n+=`bash: unset: ${u}: not an array variable `,i=1;continue}let f=await a4(e,c);if(f===null&&d){n+=`bash: unset: ${c}: not a valid identifier `,i=1;continue}if(f===null)continue;if(f<0){let h=Ye(e,u),m=h.length,g=e.state.currentLine;if(m===0){n+=`bash: line ${g}: unset: [${f}]: bad array subscript `,i=1;continue}let x=m+f;if(x<0){n+=`bash: line ${g}: unset: [${f}]: bad array subscript `,i=1;continue}let y=h[x][0];As(e,u,y);continue}As(e,u,f);continue}if(!i4(a)){n+=`bash: unset: \`${a}': not a valid identifier `,i=1;continue}let o=a;if(Kt(e,a)){let u=pi(e,a);u&&u!==a&&(o=u)}if(qn(e,o)){n+=`bash: unset: ${o}: cannot unset: readonly variable `,i=1;continue}qu(e,o);let l=j7(e,o);if(l!==void 0&&l!==e.state.callDepth)s4(e,o);else if(e.state.fullyUnsetLocals?.has(o))e.state.env.delete(o);else if(l!==void 0){let u=e.state.accessedTempEnvVars?.has(o),c=e.state.mutatedTempEnvVars?.has(o);if((u||c)&&e.state.localVarStack?.has(o)){let p=Z1(e,o);p?p.value===void 0?e.state.env.delete(o):e.state.env.set(o,p.value):e.state.env.delete(o)}else e.state.env.delete(o)}else e0(e,o)||e.state.env.delete(o);e.state.exportedVars?.delete(o),e.state.functions.delete(a)}return ae("",n,i)}ir();J();function ui(e,t,r,n){let i=r+K(t)+1;if(i>n)throw new T(`shopt: output size limit exceeded (${n} bytes)`,"output_size");return e.push(t),i}var t0=["extglob","dotglob","nullglob","failglob","globstar","globskipdots","nocaseglob","nocasematch","expand_aliases","lastpipe","xpg_echo"],RH=["autocd","cdable_vars","cdspell","checkhash","checkjobs","checkwinsize","cmdhist","compat31","compat32","compat40","compat41","compat42","compat43","compat44","complete_fullquote","direxpand","dirspell","execfail","extdebug","extquote","force_fignore","globasciiranges","gnu_errfmt","histappend","histreedit","histverify","hostcomplete","huponexit","inherit_errexit","interactive_comments","lithist","localvar_inherit","localvar_unset","login_shell","mailwarn","no_empty_cmd_completion","progcomp","progcomp_alias","promptvars","restricted_shell","shift_verbose","sourcepath"];function ju(e){return t0.includes(e)}function LH(e){return RH.includes(e)}function MH(e,t){let r=e.limits.maxArrayElements;if(t.length>r)throw new T(`shopt: argument limit exceeded (${r})`,"array_elements");let n=Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),i=!1,a=!1,s=!1,o=!1,l=!1,u=[],c=0;for(;c1){for(let x=1;x0?`${x.join(` `)} `:"",stderr:""}}let g=[];for(let x of t0){let y=e.state.shoptOptions[x];g.push(s?`shopt ${y?"-s":"-u"} ${x}`:`${x} ${y?"on":"off"}`)}return{exitCode:0,stdout:`${g.join(` `)} `,stderr:""}}let p=!1,d=[],f=0,h=[],m=0;for(let g of u){if(!ju(g)&&!LH(g)){f=ui(d,`shopt: ${g}: invalid shell option name`,f,n),p=!0;continue}if(i)ju(g)&&(e.state.shoptOptions[g]=!0,V3(e));else if(a)ju(g)&&(e.state.shoptOptions[g]=!1,V3(e));else if(ju(g)){let x=e.state.shoptOptions[g];o?x||(p=!0):s?(m=ui(h,`shopt ${x?"-s":"-u"} ${g}`,m,n),x||(p=!0)):(m=ui(h,`${g} ${x?"on":"off"}`,m,n),x||(p=!0))}else o?p=!0:s?(m=ui(h,`shopt -u ${g}`,m,n),p=!0):(m=ui(h,`${g} off`,m,n),p=!0)}return{exitCode:p?1:0,stdout:h.length>0?`${h.join(` `)} `:"",stderr:d.length>0?`${d.join(` `)} `:""}}function PH(e,t,r,n,i,a){let s=Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),o=new Map([["errexit","errexit"],["pipefail","pipefail"],["nounset","nounset"],["xtrace","xtrace"],["verbose","verbose"],["posix","posix"],["allexport","allexport"],["noclobber","noclobber"],["noglob","noglob"],["noexec","noexec"],["vi","vi"],["emacs","emacs"]]),l=["braceexpand","errtrace","functrace","hashall","histexpand","history","ignoreeof","interactive-comments","keyword","monitor","nolog","notify","onecmd","physical","privileged"],u=[...o.keys(),...l].sort();if(t.length===0){let m=[];for(let g of u){let x=l.includes(g),y=o.get(g),b=x||!y?!1:e.state.options[y];r&&!b||n&&b||m.push(i?`set ${b?"-o":"+o"} ${g}`:`${g} ${b?"on":"off"}`)}return{exitCode:0,stdout:m.length>0?`${m.join(` `)} `:"",stderr:""}}let c=!1,p=[],d=0,f=[],h=0;for(let m of t){let g=o.has(m),x=l.includes(m);if(!g&&!x){d=ui(p,`shopt: ${m}: invalid option name`,d,s),c=!0;continue}if(x){r||n||(a?c=!0:i?(h=ui(f,`set +o ${m}`,h,s),c=!0):(h=ui(f,`${m} off`,h,s),c=!0));continue}let y=o.get(m);if(y)if(r)y==="vi"?e.state.options.emacs=!1:y==="emacs"&&(e.state.options.vi=!1),e.state.options[y]=!0,Dc(e);else if(n)e.state.options[y]=!1,Dc(e);else{let b=e.state.options[y];a?b||(c=!0):i?(h=ui(f,`set ${b?"-o":"+o"} ${m}`,h,s),b||(c=!0)):(h=ui(f,`${m} ${b?"on":"off"}`,h,s),b||(c=!0))}}return{exitCode:c?1:0,stdout:f.length>0?`${f.join(` `)} `:"",stderr:p.length>0?`${p.join(` `)} `:""}}function mc(e,t){return e===`/bin/${t}`||e===`/usr/bin/${t}`}async function FH(e,t,r){if(t.includes("/")){let i=e.fs.resolvePath(e.state.cwd,t);if(!await e.fs.exists(i))return{error:"not_found",path:i};try{let a=await e.fs.stat(i);if(a.isDirectory)return{error:"permission_denied",path:i};let s=i.split("/").pop()||t,o=e.commands.get(s);return o&&mc(i,s)?{cmd:o,path:i}:(a.mode&73)!==0?{script:!0,path:i}:{error:"permission_denied",path:i}}catch{return{error:"not_found",path:i}}}if(!r&&e.state.hashTable){let i=e.state.hashTable.get(t);if(i){try{let a=await e.fs.stat(i);if(!a.isDirectory){let s=e.commands.get(t);if(s&&mc(i,t))return{cmd:s,path:i};if((a.mode&73)!==0)return{script:!0,path:i}}}catch{}e.state.hashTable.delete(t)}}let n=(r??e.state.env.get("PATH")??"/usr/bin:/bin").split(":");for(let i of n){if(!i)continue;let a=`${i.startsWith("/")?i:e.fs.resolvePath(e.state.cwd,i)}/${t}`;if(await e.fs.exists(a))try{let s=await e.fs.stat(a);if(s.isDirectory)continue;let o=(s.mode&73)!==0,l=e.commands.get(t),u=mc(a,t);if(l&&u)return{cmd:l,path:a};if(o){if(l&&!u)return{script:!0,path:a};if(!l)return{script:!0,path:a}}}catch{}}if(!await e.fs.exists("/usr/bin")){let i=e.commands.get(t);if(i)return{cmd:i,path:`/usr/bin/${t}`}}return null}async function HA(e,t){let r=[];if(t.includes("/")){let i=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(i))try{let a=await e.fs.stat(i);a.isDirectory||(a.mode&73)!==0&&r.push(t)}catch{}return r}let n=(e.state.env.get("PATH")||"/usr/bin:/bin").split(":");for(let i of n){if(!i)continue;let a=`${i.startsWith("/")?i:e.fs.resolvePath(e.state.cwd,i)}/${t}`;if(mc(a,t)&&e.commands.has(t)){r.push(a);continue}if(await e.fs.exists(a)){try{let s=await e.fs.stat(a);if(s.isDirectory||(s.mode&73)===0)continue}catch{continue}r.push(i.startsWith("/")?a:`${i}/${t}`)}}return r}Pi();function BH(e){return e!==null&&typeof e=="object"&&"then"in e&&typeof e.then=="function"}function yt(e,t,r,n){return((...i)=>{Gr(t,r,`${n} call`);let a=e(...i);return BH(a)?a.then(s=>(Gr(t,r,`${n} post-await`),s),s=>{throw Gr(t,r,`${n} post-await`),s}):(Gr(t,r,`${n} return`),a)})}function UH(e,t,r){let n={readFile:yt(e.readFile.bind(e),t,r,"fs.readFile"),...typeof e.readFileBytes=="function"?{readFileBytes:yt(e.readFileBytes.bind(e),t,r,"fs.readFileBytes")}:Object.create(null),readFileBuffer:yt(e.readFileBuffer.bind(e),t,r,"fs.readFileBuffer"),writeFile:yt(e.writeFile.bind(e),t,r,"fs.writeFile"),appendFile:yt(e.appendFile.bind(e),t,r,"fs.appendFile"),exists:yt(e.exists.bind(e),t,r,"fs.exists"),stat:yt(e.stat.bind(e),t,r,"fs.stat"),mkdir:yt(e.mkdir.bind(e),t,r,"fs.mkdir"),readdir:yt(e.readdir.bind(e),t,r,"fs.readdir"),rm:yt(e.rm.bind(e),t,r,"fs.rm"),cp:yt(e.cp.bind(e),t,r,"fs.cp"),mv:yt(e.mv.bind(e),t,r,"fs.mv"),resolvePath:yt(e.resolvePath.bind(e),t,r,"fs.resolvePath"),getAllPaths:yt(e.getAllPaths.bind(e),t,r,"fs.getAllPaths"),chmod:yt(e.chmod.bind(e),t,r,"fs.chmod"),symlink:yt(e.symlink.bind(e),t,r,"fs.symlink"),link:yt(e.link.bind(e),t,r,"fs.link"),readlink:yt(e.readlink.bind(e),t,r,"fs.readlink"),lstat:yt(e.lstat.bind(e),t,r,"fs.lstat"),realpath:yt(e.realpath.bind(e),t,r,"fs.realpath"),utimes:yt(e.utimes.bind(e),t,r,"fs.utimes")};return e.readdirWithFileTypes&&(n.readdirWithFileTypes=yt(e.readdirWithFileTypes.bind(e),t,r,"fs.readdirWithFileTypes")),e.createExclusive&&(n.createExclusive=yt(e.createExclusive.bind(e),t,r,"fs.createExclusive")),n}function l4(e,t){if(!e.requireDefenseContext)return e;let r=`command:${t}`,n=Object.getOwnPropertyDescriptors(e);n.fs={value:UH(e.fs,e.requireDefenseContext,r),enumerable:!0,configurable:!0,writable:!0};let i=Object.defineProperties(Object.create(Object.getPrototypeOf(e)),n);return e.exec&&(i.exec=yt(e.exec,e.requireDefenseContext,r,"exec")),e.origCommand&&(i.origCommand=yt(e.origCommand,e.requireDefenseContext,r,"origCommand")),e.fetch&&(i.fetch=yt(e.fetch,e.requireDefenseContext,r,"fetch")),e.sleep&&(i.sleep=yt(e.sleep,e.requireDefenseContext,r,"sleep")),e.getRegisteredCommands&&(i.getRegisteredCommands=yt(e.getRegisteredCommands,e.requireDefenseContext,r,"getRegisteredCommands")),i}J();Br();Yt();J();J();var u4="+ ";async function WA(e){let t=e.state.env.get("PS4");if(t===void 0)return u4;if(t==="")return"";let r=e.state.options.xtrace;e.state.options.xtrace=!1;let n=e.state.lastExitCode,i=e.state.env.get("?"),a=e.state.lastSubstitutionExitCode;try{let s=new ft().parseWordFromString(t,!1,!1);return await Et(e,s)}catch(s){if(s instanceof Mt&&!s.fatal)return t;if(s instanceof ur||s instanceof Error&&s.name==="AbortError")throw s;return e.state.expansionStderr=`${e.state.expansionStderr||""}bash: ${t}: bad substitution `,t||u4}finally{e.state.options.xtrace=r,e.state.lastExitCode=n,e.state.lastSubstitutionExitCode=a,i===void 0?e.state.env.delete("?"):e.state.env.set("?",i)}}function zH(e){return e.map(t=>qH(t)).join(" ")}function qH(e){if(e==="")return"''";if(!/[\s'"\\$`!*?[\]{}|&;<>()~#\n\t]/.test(e))return e;let t=/[\x00-\x1f\x7f]/.test(e),r=e.includes(` `),n=e.includes(" "),i=e.includes("\\"),a=e.includes("'");if(t||r||n||i){let s="";for(let o of e){let l=o.charCodeAt(0);o===` `?s+="\\n":o===" "?s+="\\t":o==="\\"?s+="\\\\":o==="'"?s+="'":o==='"'?s+='"':l<32||l===127?l<256?s+=`\\x${l.toString(16).padStart(2,"0")}`:s+=`\\u${l.toString(16).padStart(4,"0")}`:s+=o}return`$'${s}'`}return a?`"${e.replace(/([\\$`"])/g,"\\$1")}"`:`'${e}'`}async function HH(e,t,r){if(!e.state.options.xtrace)return"";let n=await WA(e),i=[t,...r],a=zH(i);return`${n}${a} `}async function WH(e,t,r){return e.state.options.xtrace?`${await WA(e)}${t}=${r} `:""}function Ep(e,t,r){return Wa([t,r],"",e.limits.maxStringLength,"array assignment")}async function jH(e,t){let r=new Map,n="";for(let i of t.assignments){let a=i.name;if(i.array){let u=await GH(e,t,a,i.array,i.append,r);if(u.error)return{continueToNext:!1,xtraceOutput:n,tempAssignments:r,error:u.error};if(n+=u.xtraceOutput,u.continueToNext)continue}let s=i.value?await Et(e,i.value):"";if(a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\]$/))return{continueToNext:!1,xtraceOutput:n,tempAssignments:r,error:ae("",`bash: ${a}: bad array subscript `,1)};let o=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(o){let u=await KH(e,t,o[1],o[2],s,i.append,r);if(u.error)return{continueToNext:!1,xtraceOutput:n,tempAssignments:r,error:u.error};if(u.continueToNext)continue}let l=await YH(e,t,a,s,i.append,r);if(l.error)return{continueToNext:!1,xtraceOutput:n,tempAssignments:r,error:l.error};n+=l.xtraceOutput,l.continueToNext}return{continueToNext:!1,xtraceOutput:n,tempAssignments:r}}async function GH(e,t,r,n,i,a){let s="";if(/\[.+\]$/.test(r))return{continueToNext:!1,xtraceOutput:"",error:ae("",`bash: ${r}: cannot assign list to array member `,1)};if(Kt(e,r)){let h=mp(e,r);if(h===void 0||h==="")throw new at(1,"","");let m=pi(e,r);if(m&&/^[a-zA-Z_][a-zA-Z0-9_]*\[@\]$/.test(m))return{continueToNext:!1,xtraceOutput:"",error:ae("",`bash: ${r}: cannot assign list to array member `,1)}}if(qn(e,r)){if(t.name)return s+=`bash: ${r}: readonly variable `,{continueToNext:!0,xtraceOutput:s};let h=Qt(e,r);if(h)return{continueToNext:!1,xtraceOutput:"",error:h}}let o=e.state.associativeArrays?.has(r),l=sn(e,r),u=l?Di(l):void 0,c=e.state.env.get(r),p=()=>{e.state.arrays??=new Map,u?e.state.arrays.set(r,u):e.state.arrays.delete(r),c===void 0?e.state.env.delete(r):e.state.env.set(r,c)},d=VH(n),f=()=>{an(e,r),e.state.env.delete(r)};try{o&&d?await ZH(e,t,r,n,i,f,h=>{s+=h}):d?await XH(e,r,n,i,f):await QH(e,r,n,i,f)}catch(h){throw p(),h}if(t.name){a.set(r,e.state.env.get(r));let h=`(${n.map(m=>dp(m)).join(" ")})`;e.state.env.set(r,h)}return{continueToNext:!0,xtraceOutput:s}}function VH(e){return e.some(t=>{if(t.parts.length>=2){let r=t.parts[0],n=t.parts[1];if(r.type!=="Glob"||!r.pattern.startsWith("["))return!1;if(r.pattern==="["&&(n.type==="DoubleQuoted"||n.type==="SingleQuoted")){if(t.parts.length<3)return!1;let i=t.parts[2];return i.type!=="Literal"?!1:i.value.startsWith("]=")||i.value.startsWith("]+=")}return n.type!=="Literal"?!1:n.value.startsWith("]")?n.value.startsWith("]=")||n.value.startsWith("]+="):r.pattern.endsWith("]")?n.value.startsWith("=")||n.value.startsWith("+="):!1}return!1})}async function ZH(e,t,r,n,i,a,s){let o=[];for(let l of n){if(o.length>=e.limits.maxArrayElements)throw new T(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let u=zS(l);if(u){let{key:c,valueParts:p,append:d}=u,f;p.length>0?(f=await Et(e,{type:"Word",parts:p}),p.every(h=>h.type==="Literal"||h.type==="TildeExpansion")&&(f=hl(e,f))):f="",o.push({type:"keyed",key:c,value:f,append:d})}else{let c=await Et(e,l);o.push({type:"invalid",expandedValue:c})}}e.executionScope.consumeWork(o.length,"associative array assignment"),i||a();for(let l of o)if(l.type==="keyed")if(l.append){let u=Nt(e,r,l.key)??"";je(e,r,l.key,Ep(e,u,l.value),"associative")}else je(e,r,l.key,l.value,"associative");else{let u=t.line??e.state.currentLine??1;s(`bash: line ${u}: ${r}: ${l.expandedValue}: must use subscript when assigning associative array `)}}async function XH(e,t,r,n,i){let a=[],s=0;for(let l of r){let u=zS(l);if(u){if(s>=e.limits.maxArrayElements)throw new T(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let{key:c,valueParts:p,append:d}=u,f;p.length>0?(f=await Et(e,{type:"Word",parts:p}),p.every(h=>h.type==="Literal"||h.type==="TildeExpansion")&&(f=hl(e,f))):f="",a.push({type:"keyed",indexExpr:c,value:f,append:d}),s++}else{let c=await Ka(e,l);if(c.values.length>e.limits.maxArrayElements-s)throw new T(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");a.push({type:"non-keyed",values:c.values}),s+=c.values.length}}e.executionScope.consumeWork(s,"indexed array assignment"),n||i();let o=0;for(let l of a)if(l.type==="keyed"){let u;try{let c=new ft,p=Ut(c,l.indexExpr);u=await xt(e,p.expression,!1)}catch{if(/^-?\d+$/.test(l.indexExpr))u=Number.parseInt(l.indexExpr,10);else{let c=e.state.env.get(l.indexExpr);u=c?Number.parseInt(c,10):0,Number.isNaN(u)&&(u=0)}}if(l.append){let c=Nt(e,t,u)??"";je(e,t,u,Ep(e,c,l.value))}else je(e,t,u,l.value);o=u+1}else for(let u of l.values)je(e,t,o++,u)}async function QH(e,t,r,n,i){let a=[];for(let o of r){let l=await Ka(e,o);for(let u of l.values){if(a.length>=e.limits.maxArrayElements)throw new T(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");a.push(u)}}let s=0;if(e.executionScope.consumeWork(a.length,"indexed array assignment"),n){let o=Ye(e,t);if(o.length>0)s=Math.max(...o.map(([l])=>typeof l=="number"?l:0))+1;else{let l=e.state.env.get(t);l!==void 0&&(je(e,t,0,l),e.state.env.delete(t),s=1)}}else i();for(let o=0;o=2&&(n=r.slice(1,-1));let i;if(/^-?\d+$/.test(n))i=Number.parseInt(n,10);else{try{let a=new ft,s=Ut(a,n);i=await xt(e,s.expression,!1)}catch(a){if(a instanceof at)throw a;if(a instanceof Mt){let o=`bash: line ${e.state.currentLine}: ${r}: ${a.message} `;if(a.fatal)throw new at(1,"",o);return{index:0,error:ae("",o,1)}}let s=e.state.currentLine;return{index:0,error:ae("",`bash: line ${s}: ${t}[${r}]: bad array subscript `,1)}}Number.isNaN(i)&&(i=0)}if(i<0){let a=Ye(e,t);if(a.length===0){let s=e.state.currentLine;return{index:0,error:ae("",`bash: line ${s}: ${t}[${r}]: bad array subscript `,1)}}if(i=Math.max(...a.map(([s])=>typeof s=="number"?s:0))+1+i,i<0){let s=e.state.currentLine;return{index:0,error:ae("",`bash: line ${s}: ${t}[${r}]: bad array subscript `,1)}}}return{index:i}}async function YH(e,t,r,n,i,a){let s="",o=r,l=null;if(Kt(e,r)){let p=rA(e,r,n);if(p===void 0)return{continueToNext:!1,xtraceOutput:"",error:ae("",`bash: ${r}: circular name reference `,1)};if(p===null)return{continueToNext:!0,xtraceOutput:""};o=p;let d=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);d&&(l={arrayName:d[1],subscriptExpr:d[2]},o=d[1])}if(qn(e,o)){if(t.name)return s+=`bash: ${o}: readonly variable `,{continueToNext:!0,xtraceOutput:s};let p=Qt(e,o);if(p)return{continueToNext:!1,xtraceOutput:"",error:p}}let u;if(J1(e,o))try{let p=new ft;if(i){let d=`(${e.state.env.get(o)||"0"}) + (${n})`,f=Ut(p,d);u=String(await xt(e,f.expression))}else{let d=Ut(p,n);u=String(await xt(e,d.expression))}}catch{u="0"}else{let p=Qa(e,o)?Nt(e,o,0):e.state.env.get(o);u=i?Ep(e,p||"",n):n}u=hc(e,o,u),s+=await WH(e,o,u);let c;return l?c=await JH(e,l):Qa(e,o)&&(c="0"),t.name?c===void 0&&(a.set(o,e.state.env.get(o)),e.state.env.set(o,u)):(c===void 0?e.state.env.set(o,u):je(e,o,c,u),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(o)),e.state.tempEnvBindings?.some(p=>p.has(o))&&(e.state.mutatedTempEnvVars=e.state.mutatedTempEnvVars||new Set,e.state.mutatedTempEnvVars.add(o))),{continueToNext:!1,xtraceOutput:s}}async function JH(e,t){let{arrayName:r,subscriptExpr:n}=t;if(e.state.associativeArrays?.has(r))return jA(e,n);let i;if(/^-?\d+$/.test(n))i=Number.parseInt(n,10);else{try{let a=new ft,s=Ut(a,n);i=await xt(e,s.expression,!1)}catch{let a=e.state.env.get(n);i=a?Number.parseInt(a,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let a=Ye(e,r);a.length>0&&(i=Math.max(...a.map(s=>s[0]))+1+i)}return String(i)}async function eW(e,t,r,n){let i=!1,a=!1,s=!1,o=!1,l=!1,u=[];for(let m of t)if(m.startsWith("-")&&m.length>1)for(let g of m.slice(1))g==="t"?i=!0:g==="p"?a=!0:g==="P"?s=!0:g==="a"?o=!0:g==="f"&&(l=!0);else u.push(m);let c="",p="",d=0,f=!1,h=!1;for(let m of u){let g=!1;if(s){if(o){let b=await n(m);if(b.length>0){for(let k of b)c+=`${k} `;f=!0,g=!0}}else{let b=await r(m);b&&(c+=`${b} `,f=!0,g=!0)}g||(h=!0);continue}let x=!l&&e.state.functions.has(m);if(o&&x){if(!a)if(i)c+=`function `;else{let b=e.state.functions.get(m),k=b?c4(m,b):`${m} is a function `;c+=k}g=!0}let y=e.state.env.get(`BASH_ALIAS_${m}`);if(!(y!==void 0&&(o||!g)&&(a||(i?c+=`alias `:c+=`${m} is aliased to \`${y}' `),g=!0,!o)||TA.has(m)&&(o||!g)&&(a||(i?c+=`keyword `:c+=`${m} is a shell keyword `),g=!0,!o))){if(!o&&x&&!g){if(!a)if(i)c+=`function `;else{let b=e.state.functions.get(m),k=b?c4(m,b):`${m} is a function `;c+=k}g=!0;continue}if(!(bp.has(m)&&(o||!g)&&(a||(i?c+=`builtin `:c+=`${m} is a shell builtin `),g=!0,!o))){if(o){let b=await n(m);for(let k of b)a?c+=`${k} `:i?c+=`file `:c+=`${m} is ${k} `,f=!0,g=!0}else if(!g){let b=await r(m);b&&(a?c+=`${b} `:i?c+=`file `:c+=`${m} is ${b} `,f=!0,g=!0)}if(!g&&(h=!0,!i&&!a)){let b=!0;if(m.includes("/")){let k=e.fs.resolvePath(e.state.cwd,m);await e.fs.exists(k)&&(b=!1)}b&&(p+=`bash: type: ${m}: not found `)}}}}return a?d=h&&!f?1:0:d=h?1:0,ae(c,p,d)}function c4(e,t){let r;return t.body.type==="Group"?r=t.body.body.map(n=>ml(n)).join("; "):r=ml(t.body),`${e} is a function ${e} () { ${r} } `}function ml(e){if(Array.isArray(e))return e.map(t=>ml(t)).join("; ");if(e.type==="Statement"){let t=[];for(let r=0;rml(t)).join("; ")}; }`:"..."}function p4(e){return e.parts.map(VA).join("")}function VA(e){switch(e.type){case"Literal":return e.value;case"Escaped":return`\\${e.value}`;case"SingleQuoted":return`'${e.value}'`;case"DoubleQuoted":return`"${e.parts.map(VA).join("")}"`;default:return hr(le.word([e]))}}function tW(e){let t=e.commands.map(r=>ml(r));return(e.negated?"! ":"")+t.join(" | ")}async function rW(e,t,r,n){let i="",a="",s=0;for(let o of t){if(!o){s=1;continue}let l=e.state.env.get(`BASH_ALIAS_${o}`);if(l!==void 0)n?i+=`${o} is an alias for "${l}" `:i+=`alias ${o}='${l}' `;else if(TA.has(o))n?i+=`${o} is a shell keyword `:i+=`${o} `;else if(bp.has(o))n?i+=`${o} is a shell builtin `:i+=`${o} `;else if(e.state.functions.has(o))n?i+=`${o} is a function `:i+=`${o} `;else if(o.includes("/")){let u=e.fs.resolvePath(e.state.cwd,o),c=!1;if(await e.fs.exists(u))try{let p=await e.fs.stat(u);p.isDirectory||(p.mode&73)!==0&&(n?i+=`${o} is ${o} `:i+=`${o} `,c=!0)}catch{}c||(n&&(a+=`${o}: not found `),s=1)}else if(e.commands.has(o)){let u=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":"),c=null;for(let p of u){if(!p)continue;let d=`${p}/${o}`;try{let f=await e.fs.stat(d);if(!f.isDirectory&&(f.mode&73)!==0){c=d;break}}catch{}}c||(c=`/usr/bin/${o}`),n?i+=`${o} is ${c} `:i+=`${c} `}else n&&(a+=`${o}: not found `),s=1}return ae(i,a,s)}async function nW(e,t){if(t.includes("/")){let n=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(n)){try{let i=await e.fs.stat(n);if(i.isDirectory||(i.mode&73)===0)return null}catch{return null}return t}return null}let r=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":");for(let n of r){if(!n)continue;let i=`${n.startsWith("/")?n:e.fs.resolvePath(e.state.cwd,n)}/${t}`;if(await e.fs.exists(i)){try{let a=await e.fs.stat(i);if(a.isDirectory||(a.mode&73)===0)continue}catch{continue}return`${n}/${t}`}}if(e.commands.has(t)){for(let n of r)if(n==="/usr/bin"||n==="/bin")return`${n}/${t}`;return`/usr/bin/${t}`}return null}function f4(e,t){let r=!0,n=e.signal?new AbortController:void 0,i=new WeakMap,a=()=>{if(!r)throw new zt("",`bash: ${t} used its context after cancellation `)},s=p=>{if(p===null||typeof p!="object"&&typeof p!="function")return p;let d=i.get(p);if(d!==void 0)return d;if(typeof p=="object"&&aF(p))return p;if(p instanceof Uint8Array){let g=new Uint8Array(p);return i.set(p,g),g}if(p instanceof ArrayBuffer){let g=p.slice(0);return i.set(p,g),g}if(p instanceof Promise){let g=p.then(x=>(a(),s(x)));return i.set(p,g),g}if(typeof p=="function"){let g=function(...x){return a(),s(Reflect.apply(p,this,x))};return i.set(p,g),g}let f=Object.getPrototypeOf(p);if(Array.isArray(p)||f===Object.prototype||f===null){let g=Array.isArray(p)?[]:Object.create(f);i.set(p,g);let x=Object.getOwnPropertyDescriptors(p);for(let y of Object.values(x)){if("value"in y){let b=y.value;y.value=typeof b=="function"?(...k)=>(a(),s(Reflect.apply(b,p,k))):s(b)}if(y.get){let b=y.get;y.get=()=>(a(),s(Reflect.apply(b,p,[])))}if(y.set){let b=y.set;y.set=k=>{a(),Reflect.apply(b,p,[k])}}}return Object.defineProperties(g,x),g}let h=new Map,m=new H5(p,{get(g,x){if(a(),x==="constructor"||x==="prototype"||x==="__proto__")throw new Error(`${t}: unsafe context property access`);let y=Reflect.get(g,x,g);if(typeof y!="function")return s(y);if(h.has(x))return h.get(x);let b=(...k)=>(a(),s(Reflect.apply(y,g,k)));return h.set(x,b),b},set(g,x,y){if(a(),x==="constructor"||x==="prototype"||x==="__proto__")throw new Error(`${t}: unsafe context property access`);return Reflect.set(g,x,y,g)}});return i.set(p,m),m},o=p=>s(p),l=p=>p&&((...d)=>(a(),s(p(...d)))),u=p=>({value:p,enumerable:!0,configurable:!0,writable:!0}),c=Object.getOwnPropertyDescriptors(e);return Object.assign(c,{fs:u(o(e.fs)),env:u(o(e.env)),limits:u(Object.freeze({...e.limits})),exportedEnv:u(e.exportedEnv?Object.freeze({...e.exportedEnv}):void 0),executionScope:u(e.executionScope?o(e.executionScope):void 0),fileDescriptors:u(e.fileDescriptors?o(e.fileDescriptors):void 0),coverage:u(e.coverage?o(e.coverage):void 0),assignShellVariable:u(l(e.assignShellVariable)),exec:u(l(e.exec)),origCommand:u(l(e.origCommand)),execWithInheritedStdin:u(l(e.execWithInheritedStdin)),fetch:u(l(e.fetch)),getRegisteredCommands:u(l(e.getRegisteredCommands)),sleep:u(l(e.sleep)),trace:u(l(e.trace)),invokeTool:u(l(e.invokeTool)),signal:u(n?.signal)}),{context:Object.defineProperties(Object.create(Object.getPrototypeOf(e)),c),revoke(){r=!1,n?.signal.aborted||n?.abort(new zt("",`bash: ${t} context revoked `))}}}async function iW(e,t,r,n,i,a){let s=i.remainingTimeMs()??t.limits.maxExecutionTimeMs,o=t.limits.maxExtensionCleanupTimeMs,l,u,c,p=Promise.resolve().then(e).then(f=>({kind:"result",result:f}),f=>({kind:"error",error:f})),d=new Promise(f=>{let h=()=>{r(),f({kind:"abort"})};u=h,a?.addEventListener("abort",h,{once:!0}),a?.aborted&&h(),l=Ph(()=>{r(),f({kind:"deadline"})},s)});try{let f=await Promise.race([p,d]);if(f.kind==="result")return f.result;if(f.kind==="error")throw f.error;r();let h=await Promise.race([p.then(()=>!0),new Promise(g=>{c=Ph(()=>g(!1),o)})]),m=f.kind==="deadline"?new zt("",`bash: ${n} exceeded its execution deadline `):new zt("",`bash: execution aborted `);throw h||i.poisonAfterAbort(m),m}finally{r(),Fh(l),Fh(c),u&&a?.removeEventListener("abort",u)}}async function aW(e,t,r,n,i,a,s,o,l=!1,u=!1,c=!1){let{ctx:p,runCommand:d}=e;if(p.coverage&&bp.has(t)&&p.coverage.hit(`bash:builtin:${t}`),t==="export")return fH(p,r);if(t==="unset")return DH(p,r);if(t==="exit")return pH(p,r);if(t==="local")return bH(p,r);if(t==="set")return _H(p,r);if(t==="break")return Xz(p,r);if(t==="continue")return Qq(p,r);if(t==="return")return EH(p,r);if(t==="eval"&&p.state.options.posix)return e4(p,r,i,l);if(t==="shift")return OH(p,r);if(t==="getopts")return FA(p,r);if(t==="compgen")return Iq(p,r);if(t==="complete")return Zq(p,r);if(t==="compopt")return Xq(p,r);if(t==="pushd")return await lH(p,r);if(t==="popd")return uH(p,r);if(t==="dirs")return cH(p,r);if(t==="source"||t===".")return IH(p,r);if(t==="read")return vH(p,r,i,o);if(t==="mapfile"||t==="readarray")return wH(p,r,i);if(t==="declare"||t==="typeset")return aH(p,r);if(t==="readonly")return sH(p,r);if(!a){let f=p.state.functions.get(t);if(f)return DA(p,f,r,i,void 0,l)}if(t==="__just_bash_tee_restore"){if(r.length===0||r.length>p.limits.maxArrayElements)return re(`bash: invalid internal pipeline status restore `,2);let f=[];for(let g of r){if(!/^(?:0|[1-9][0-9]{0,2})$/.test(g))return re(`bash: invalid internal pipeline status restore `,2);let x=Number(g);if(!Number.isSafeInteger(x)||x>255)return re(`bash: invalid internal pipeline status restore `,2);f.push(x)}let h=f[f.length-1]??0,m=[...f].reverse().find(g=>g!==0);return{stdout:"",stderr:"",exitCode:p.state.options.pipefail&&m!==void 0?m:h,internalPipeStatusOverride:f}}if(t==="eval")return e4(p,r,i,l);if(t==="cd")return await Qz(p,r);if(t===":"||t==="true")return Tt;if(t==="false")return dr(!1);if(t==="let")return yH(p,r);if(t==="command")return sW(e,r,i,l,u,c);if(t==="builtin")return oW(e,r,i,l,u,c);if(t==="shopt")return MH(p,r);if(t==="exec"){if(r.length===0)return Tt;let[f,...h]=r;return{...await d(f,h,[],i,!1,!1,-1,l,u,c),internalProducerOmitsShellPrefix:!0}}if(t==="wait")return Tt;if(t==="type")return await eW(p,r,f=>nW(p,f),f=>HA(p,f));if(t==="hash")return dH(p,r);if(t==="help")return hH(p,r);if(t==="["||t==="test"){let f=r;if(t==="["){if(r[r.length-1]!=="]")return re("[: missing `]'\n",2);f=r.slice(0,-1)}return fc(p,f)}return null}async function sW(e,t,r,n=!1,i=!1,a=!1){let{ctx:s,runCommand:o}=e;if(t.length===0)return Tt;let l=!1,u=!1,c=!1,p=t;for(;p.length>0&&p[0].startsWith("-");){let h=p[0];if(h==="--"){p=p.slice(1);break}for(let m of h.slice(1))m==="p"?l=!0:m==="V"?u=!0:m==="v"&&(c=!0);p=p.slice(1)}if(p.length===0)return Tt;if(c||u)return await rW(s,p,c,u);let[d,...f]=p;return o(d,f,[],r,!0,l,-1,n,i,a)}async function oW(e,t,r,n=!1,i=!1,a=!1){let{runCommand:s}=e;if(t.length===0)return Tt;let o=t;if(o[0]==="--"&&(o=o.slice(1),o.length===0))return Tt;let l=o[0];if(l!=="__just_bash_tee_restore"&&!bp.has(l))return re(`bash: builtin: ${l}: not a shell builtin `);let[,...u]=o;return s(l,u,[],r,!0,!1,-1,n,i,a)}async function lW(e,t,r,n,i,a=!1,s=!1){let{ctx:o,buildExportedEnv:l,executeUserScript:u}=e,c=await FH(o,t,i?"/usr/bin:/bin":void 0);if(!c)return Vz(t)?re(`bash: ${t}: command not available in browser environments. Exclude '${t}' from your commands or use the Node.js bundle. `,127):re(`bash: ${t}: command not found `,127);if("error"in c)return c.error==="permission_denied"?re(`bash: ${t}: Permission denied `,126):re(`bash: ${t}: No such file or directory `,127);if("script"in c)return t.includes("/")||(o.state.hashTable||(o.state.hashTable=new Map),o.state.hashTable.set(t,c.path)),await u(c.path,r,n);let{cmd:p,path:d}=c;t.includes("/")||(o.state.hashTable||(o.state.hashTable=new Map),o.state.hashTable.set(t,d));let f=a||s||n.length>0,h=f?n:o.state.groupStdin||"",m=!1,g=l();o.state.fileDescriptors??=new Map;let x={fs:o.fs,fsIdentity:iF(o.fs),cwd:o.state.cwd,env:o.state.env,assignShellVariable:async(A,R,I)=>{if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(A))throw new Error(`${A}: not a valid identifier`);let $=I===void 0?A:`${A}[${I}]`,_=rA(o,A,R);if(_===void 0)throw new Error(`${A}: circular name reference`);if(_===null)return;let M=_.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(?:\[(.*)\])?$/);if(!M)throw new Error(`${$}: not a valid identifier`);let P=M[1],S=M[2]??I;if(qn(o,A)||qn(o,P))throw new Error(`${P}: readonly variable`);if(S===void 0)o.state.env.set(P,R);else{let D=o.state.associativeArrays?.has(P)?"associative":"indexed";if(D==="associative"){je(o,P,S,R,D);return}let W=await GA(o,P,S);if(W.error)throw new at(W.error.exitCode,W.error.stdout,W.error.stderr);je(o,P,W.index,R,D)}},exportedEnv:g,get stdin(){return m=!0,h},stdinProvided:f,stdinUnavailable:s,limits:o.limits,executionScope:p.internalIsExtension?pF(o.executionScope):o.executionScope,exec:(A,R)=>o.execFn(A,R,!1),execWithInheritedStdin:(A,R)=>o.execFn(A,{...R,stdin:h,stdinKind:"bytes"},!0),fetch:o.fetch,getRegisteredCommands:()=>Array.from(o.commands.keys()),sleep:o.sleep,trace:o.trace,fileDescriptors:o.state.fileDescriptors,xpgEcho:o.state.shoptOptions.xpg_echo,coverage:o.coverage,signal:o.state.signal,requireDefenseContext:o.requireDefenseContext,jsBootstrapCode:o.jsBootstrapCode,invokeTool:o.invokeTool},y=p.internalOriginalCommand,b=()=>{};if(y){let A=Object.getOwnPropertyDescriptors(x);A.executionScope={value:o.executionScope,enumerable:!0,configurable:!0,writable:!0};let R=Object.defineProperties(Object.create(Object.getPrototypeOf(x)),A),I=f4(R,y.name),$=l4(I.context,y.name);b=I.revoke,x.origCommand=_=>{let M=()=>y.execute(_,$);return y.trusted?rn.runTrustedAsync(M):rn.runUntrustedAsync(M)}}let k=f4(x,t),w=l4(k.context,t),v=()=>{k.revoke(),b()};try{let A=()=>na(o.requireDefenseContext,"command",`${t} execution`,()=>p.execute(r,w)),R=()=>iW(A,w,v,t,o.executionScope,o.state.signal),I=p.trusted?await rn.runTrustedAsync(R):await R();return{...I,internalStdinConsumed:I.internalStdinConsumed??(m?n.length:0)}}catch(A){if(A instanceof T||A instanceof zt||A instanceof He)throw A;return re(`${t}: ${Xt(Fr(A))} `)}}ge();J();kl();async function ZA(e,t){let r=e.state.inCondition;e.state.inCondition=!0;let n=new ra(e.executionScope,"condition"),i=0;try{for(let a of t){let s=await e.executeStatement(a);n.appendResult(s),i=s.exitCode}}catch(a){throw n.prependTo(a),a}finally{e.state.inCondition=r}return n.build(i)}Br();J();Br();var r0=0;function gl(e,t){return e.state.lastExitCode=t,e.state.env.set("?",String(t)),t}function Sp(e,t,r,n){if(e instanceof Oi)return t+=e.stdout,r+=e.stderr,e.levels>1&&n>1?(e.levels--,e.stdout=t,e.stderr=r,{action:"rethrow",stdout:t,stderr:r,error:e}):{action:"break",stdout:t,stderr:r,exitCode:r0};if(e instanceof Ii)return t+=e.stdout,r+=e.stderr,e.levels>1&&n>1?(e.levels--,e.stdout=t,e.stderr=r,{action:"rethrow",stdout:t,stderr:r,error:e}):{action:"continue",stdout:t,stderr:r,exitCode:r0};if(e instanceof di||e instanceof $i||e instanceof at||e instanceof T)return e.prependOutput(t,r),{action:"rethrow",stdout:t,stderr:r,error:e};let i=Fr(e);return{action:"error",stdout:t,stderr:`${r}${i} `,exitCode:1}}function XA(e,t){return e!==void 0?{owns:!0,stdin:e}:t!==""?{owns:!0,stdin:t}:{owns:!1}}var ao=class{ctx;stdoutChunks=[];stderrChunks=[];totalBytes=0;constructor(e){this.ctx=e}append(e,t){let r=K(e)+K(t);r>this.ctx.limits.maxOutputSize-this.totalBytes&&ro(`total output size exceeded (>${this.ctx.limits.maxOutputSize} bytes), increase executionLimits.maxOutputSize`,"output_size"),e&&this.stdoutChunks.push(e),t&&this.stderrChunks.push(t),this.totalBytes+=r}appendUnaccounted(e,t){this.ctx.executionScope.appendOutput("stdout",e,"control-flow"),this.ctx.executionScope.appendOutput("stderr",t,"control-flow"),this.append(e,t)}replace(e,t){this.stdoutChunks=[],this.stderrChunks=[],this.totalBytes=0,this.append(e,t)}get stdout(){return this.stdoutChunks.join("")}get stderr(){return this.stderrChunks.join("")}build(e){let t=this.stdout,r=this.stderr;return{stdout:t,stderr:r,exitCode:e,internalOutputAccounting:{stdout:K(t),stderr:K(r)}}}};async function n0(e,t,r){let n=0;try{for(let i of t){let a=await e.executeStatement(i);r.append(a.stdout,a.stderr),n=a.exitCode}}catch(i){if(P4(i)||i instanceof $i||i instanceof at||i instanceof T||i instanceof bl)throw i.prependOutput(r.stdout,r.stderr),i;return r.appendUnaccounted("",`${Fr(i)} `),r.build(1)}return r.build(n)}async function uW(e,t){return fi(e,t.redirections,"",()=>cW(e,t))}async function cW(e,t){let r=new ao(e);for(let n of t.clauses){let i=await ZA(e,n.condition);if(r.append(i.stdout,i.stderr),i.exitCode===0)return n0(e,n.body,r)}return t.elseBody?n0(e,t.elseBody,r):r.build(0)}async function pW(e,t){return fi(e,t.redirections,"",()=>fW(e,t))}async function fW(e,t){let r=new ao(e),n=0,i=0;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t.variable))return re(`bash: \`${t.variable}': not a valid identifier `);let a=[];if(t.words===null)a=(e.state.env.get("@")||"").split(" ").filter(Boolean);else if(t.words.length===0)a=[];else try{for(let s of t.words){let o=await Ka(e,s);Kr(a,o.values,e.limits.maxArrayElements,"for-loop expansion")}}catch(s){if(s instanceof yl)return{stdout:"",stderr:s.stderr,exitCode:1};throw s}e.state.loopDepth++;try{for(let s of a){i++,i>e.limits.maxLoopIterations&&ro(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",r.stdout,r.stderr),e.state.env.set(t.variable,s);try{for(let o of t.body){let l=await e.executeStatement(o);r.append(l.stdout,l.stderr),n=l.exitCode}}catch(o){let l=Sp(o,r.stdout,r.stderr,e.state.loopDepth);if(r.replace(l.stdout,l.stderr),l.exitCode!==void 0&&(n=gl(e,l.exitCode)),l.action==="break")break;if(l.action==="continue")continue;if(l.action==="error")return r.build(l.exitCode??1);throw l.error}}}finally{e.state.loopDepth--}return r.build(n)}async function dW(e,t){return fi(e,t.redirections,"",()=>hW(e,t))}async function hW(e,t){let r=t.line;r!==void 0&&(e.state.currentLine=r);let n=new ao(e),i=0,a=0;t.init&&await xt(e,t.init.expression),e.state.loopDepth++;try{for(;a++,a>e.limits.maxLoopIterations&&ro(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",n.stdout,n.stderr),!(t.condition&&(r!==void 0&&(e.state.currentLine=r),await xt(e,t.condition.expression)===0));){try{for(let s of t.body){let o=await e.executeStatement(s);n.append(o.stdout,o.stderr),i=o.exitCode}}catch(s){let o=Sp(s,n.stdout,n.stderr,e.state.loopDepth);if(n.replace(o.stdout,o.stderr),o.exitCode!==void 0&&(i=gl(e,o.exitCode)),o.action==="break")break;if(o.action==="continue"){t.update&&await xt(e,t.update.expression);continue}if(o.action==="error")return n.build(o.exitCode??1);throw o.error}t.update&&await xt(e,t.update.expression)}}finally{e.state.loopDepth--}return n.build(i)}async function mW(e,t,r=""){return fi(e,t.redirections,r,n=>gW(e,t,r,n))}async function gW(e,t,r,n){let i=new ao(e),a=0,s=0,o=XA(n.stdin,r),l=e.state.groupStdin;o.owns&&(e.state.groupStdin=o.stdin),e.state.loopDepth++;try{for(;;){s++,s>e.limits.maxLoopIterations&&ro(`while loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",i.stdout,i.stderr);let u=0,c=!1,p=!1,d=e.state.inCondition;e.state.inCondition=!0;try{for(let f of t.condition){let h=await e.executeStatement(f);i.append(h.stdout,h.stderr),u=h.exitCode}}catch(f){if(f instanceof Oi){if(i.append(f.stdout,f.stderr),f.levels>1&&e.state.loopDepth>1)throw f.levels--,f.stdout=i.stdout,f.stderr=i.stderr,e.state.inCondition=d,f;c=!0}else if(f instanceof Ii){if(i.append(f.stdout,f.stderr),f.levels>1&&e.state.loopDepth>1)throw f.levels--,f.stdout=i.stdout,f.stderr=i.stderr,e.state.inCondition=d,f;p=!0}else throw e.state.inCondition=d,f}finally{e.state.inCondition=d}if((c||p)&&(a=gl(e,r0)),c)break;if(!p){if(u!==0)break;try{for(let f of t.body){let h=await e.executeStatement(f);i.append(h.stdout,h.stderr),a=h.exitCode}}catch(f){let h=Sp(f,i.stdout,i.stderr,e.state.loopDepth);if(i.replace(h.stdout,h.stderr),h.exitCode!==void 0&&(a=gl(e,h.exitCode)),h.action==="break")break;if(h.action==="continue")continue;if(h.action==="error")return i.build(h.exitCode??1);throw h.error}}}}finally{e.state.loopDepth--,o.owns&&(e.state.groupStdin=l)}return i.build(a)}async function xW(e,t,r=""){return fi(e,t.redirections,r,n=>yW(e,t,r,n))}async function yW(e,t,r,n){let i=new ao(e),a=0,s=0,o=XA(n.stdin,r),l=e.state.groupStdin;o.owns&&(e.state.groupStdin=o.stdin),e.state.loopDepth++;try{for(;;){s++,s>e.limits.maxLoopIterations&&ro(`until loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",i.stdout,i.stderr);let u=await ZA(e,t.condition);if(i.append(u.stdout,u.stderr),u.exitCode===0)break;try{for(let c of t.body){let p=await e.executeStatement(c);i.append(p.stdout,p.stderr),a=p.exitCode}}catch(c){let p=Sp(c,i.stdout,i.stderr,e.state.loopDepth);if(i.replace(p.stdout,p.stderr),p.exitCode!==void 0&&(a=gl(e,p.exitCode)),p.action==="break")break;if(p.action==="continue")continue;if(p.action==="error")return i.build(p.exitCode??1);throw p.error}}}finally{e.state.loopDepth--,o.owns&&(e.state.groupStdin=l)}return i.build(a)}async function bW(e,t){return fi(e,t.redirections,"",()=>wW(e,t))}async function wW(e,t){let r=new ao(e),n=0,i=await Et(e,t.word),a=!1;for(let s=0;s1,p=e.state.lastArg,d=e.state.groupStdin,f=e.state.groupStdinSourceFd;for(let y=0;y1)I={stdout:_.stdout,stderr:_.stderr,exitCode:_.exitCode};else if(_ instanceof $i&&t.commands.length>1)I={stdout:_.stdout,stderr:_.stderr,exitCode:_.exitCode};else throw A&&(e.state.env=A,e.state.arrays=R??new Map),_}finally{c&&(w&&(d=e.state.groupStdin,f=e.state.groupStdinSourceFd),e.state.groupStdin=d,e.state.groupStdinSourceFd=f)}if(A&&(e.state.env=A,e.state.arrays=R??new Map),I=e.executionScope.accountResult(I,"pipeline",e.executionScope.outputBytesUsed-$),!k){let _=t.pipeStderr?.[y]??!1,M=I.internalOutputAccounting?.stdout??0,P=_?I.internalOutputAccounting?.stderr??0:0;fF(e.executionScope,M+P,"pipeline"),I={...I,internalOutputAccounting:{stdout:0,stderr:_?0:I.internalOutputAccounting?.stderr??0}}}o.push(I.exitCode),I.exitCode!==0&&(s=I.exitCode),k?a=I:(t.pipeStderr?.[y]??!1?i=Ha(I.stderr)+sl(I):(i=sl(I),l+=I.stderr,u+=I.internalOutputAccounting?.stderr??0),a={stdout:"",stderr:"",exitCode:I.exitCode})}l&&(a={...a,stderr:l+a.stderr,internalOutputAccounting:{stdout:a.internalOutputAccounting?.stdout??0,stderr:u+(a.internalOutputAccounting?.stderr??0)}});let h=t.commands.length>1||t.commands.length===1&&t.commands[0].type==="SimpleCommand",m=a.internalPipeStatusOverride??o;if(h){an(e,"PIPESTATUS");for(let y=0;y[t,i0(r)])):void 0}function SW(e){if(!e)return;let t=new Map,r=new Map;for(let[n,i]of e){let a=t.get(i);a||(a=new Set(i),t.set(i,a)),r.set(n,a)}return r}function AW(e){return e?.map(t=>new Map(Array.from(t,([r,n])=>[r,n?{kind:n.kind,elements:new Map(n.elements)}:void 0])))}function CW(e){return e?new Map(Array.from(e,([t,r])=>[t,r.map(n=>({...n}))])):void 0}function QA(e){let t={env:e.env,arrays:e.arrays,cwd:e.cwd,previousDir:e.previousDir,lastExitCode:e.lastExitCode,lastArg:e.lastArg,currentLine:e.currentLine,options:e.options,shoptOptions:e.shoptOptions,fileDescriptors:e.fileDescriptors,inputFds:e.inputFds,deviceFds:e.deviceFds,fdAliases:e.fdAliases,closedStandardFds:e.closedStandardFds,nextFd:e.nextFd,readonlyVars:e.readonlyVars,associativeArrays:e.associativeArrays,namerefs:e.namerefs,boundNamerefs:e.boundNamerefs,invalidNamerefs:e.invalidNamerefs,integerVars:e.integerVars,lowercaseVars:e.lowercaseVars,uppercaseVars:e.uppercaseVars,exportedVars:e.exportedVars,tempExportedVars:e.tempExportedVars,localExportedVars:e.localExportedVars,declaredVars:e.declaredVars,localScopes:e.localScopes,localArrayScopes:e.localArrayScopes,localVarDepth:e.localVarDepth,localVarStack:e.localVarStack,fullyUnsetLocals:e.fullyUnsetLocals,tempEnvBindings:e.tempEnvBindings,mutatedTempEnvVars:e.mutatedTempEnvVars,accessedTempEnvVars:e.accessedTempEnvVars,functions:e.functions,callDepth:e.callDepth,sourceDepth:e.sourceDepth,callLineStack:e.callLineStack,funcNameStack:e.funcNameStack,sourceStack:e.sourceStack,currentSource:e.currentSource,inCondition:e.inCondition,loopDepth:e.loopDepth,parentHasLoopContext:e.parentHasLoopContext,errexitSafe:e.errexitSafe,directoryStack:e.directoryStack,hashTable:e.hashTable,completionSpecs:e.completionSpecs,defaultCompletionSpec:e.defaultCompletionSpec,emptyCompletionSpec:e.emptyCompletionSpec,groupStdin:e.groupStdin,groupStdinSourceFd:e.groupStdinSourceFd,bashPid:e.bashPid,expansionExitCode:e.expansionExitCode,expansionStderr:e.expansionStderr};e.env=new Map(e.env),e.arrays=Ys(e.arrays),e.options={...e.options},e.shoptOptions={...e.shoptOptions},e.fileDescriptors=e.fileDescriptors?new Map(e.fileDescriptors):void 0,e.inputFds=e.inputFds?new Set(e.inputFds):void 0,e.deviceFds=e.deviceFds?new Set(e.deviceFds):void 0,e.fdAliases=SW(e.fdAliases),e.closedStandardFds=e.closedStandardFds?new Set(e.closedStandardFds):void 0,e.readonlyVars=new Set(e.readonlyVars),e.associativeArrays=new Set(e.associativeArrays),e.namerefs=new Set(e.namerefs),e.boundNamerefs=new Set(e.boundNamerefs),e.invalidNamerefs=new Set(e.invalidNamerefs),e.integerVars=new Set(e.integerVars),e.lowercaseVars=new Set(e.lowercaseVars),e.uppercaseVars=new Set(e.uppercaseVars),e.exportedVars=new Set(e.exportedVars),e.tempExportedVars=new Set(e.tempExportedVars),e.localExportedVars=e.localExportedVars?.map(n=>new Set(n)),e.declaredVars=new Set(e.declaredVars),e.localScopes=e.localScopes.map(n=>new Map(n)),e.localArrayScopes=AW(e.localArrayScopes),e.localVarDepth=e.localVarDepth?new Map(e.localVarDepth):void 0,e.localVarStack=CW(e.localVarStack),e.fullyUnsetLocals=e.fullyUnsetLocals?new Map(e.fullyUnsetLocals):void 0,e.tempEnvBindings=e.tempEnvBindings?.map(n=>new Map(n)),e.mutatedTempEnvVars=e.mutatedTempEnvVars?new Set(e.mutatedTempEnvVars):void 0,e.accessedTempEnvVars=e.accessedTempEnvVars?new Set(e.accessedTempEnvVars):void 0,e.functions=new Map(e.functions),e.callLineStack=e.callLineStack?[...e.callLineStack]:void 0,e.funcNameStack=e.funcNameStack?[...e.funcNameStack]:void 0,e.sourceStack=e.sourceStack?[...e.sourceStack]:void 0,e.directoryStack=e.directoryStack?[...e.directoryStack]:void 0,e.hashTable=e.hashTable?new Map(e.hashTable):void 0,e.completionSpecs=EW(e.completionSpecs),e.defaultCompletionSpec=i0(e.defaultCompletionSpec),e.emptyCompletionSpec=i0(e.emptyCompletionSpec);let r=!1;return()=>{r||(r=!0,Object.assign(e,t))}}async function kW(e,t,r,n,i=!1){let a=e.state.loopDepth,s=new Map;for(let l of e.state.fileDescriptors?.keys()??[]){let u=Li(e,l);u&&s.set(l,u)}let o=QA(e.state);e.state.parentHasLoopContext=a>0,e.state.loopDepth=0,e.state.bashPid=e.state.nextVirtualPid++;try{return await fi(e,t.redirections,r,l=>NW(e,t,l.stdin??r,n,i||l.stdin!==void 0))}finally{let l=new Map;for(let[u,c]of s){let p=Li(e,u),d=c.kind==="input"&&p?.kind==="input"?c.content.length-p.content.length:c.kind==="readwrite"&&p?.kind==="readwrite"&&c.path===p.path?p.position-c.position:0;if(d<=0)continue;let f=Math.min(...zs(e,u));l.set(f,Math.max(l.get(f)??0,d))}o();for(let[u,c]of l)nl(e,u,c)}}async function NW(e,t,r,n,i){(i||r)&&(e.state.groupStdin=r);let a=new ra(e.executionScope,"subshell"),s=0;try{for(let o of t.body){let l=await n(o);a.appendResult(l),s=l.exitCode}}catch(o){if(o instanceof T)throw a.prependTo(o),o;return o instanceof bl||o instanceof Oi||o instanceof Ii?(a.append("stdout",o.stdout,o.internalOutputAccounting.stdout),a.append("stderr",o.stderr,o.internalOutputAccounting.stderr),a.build(0)):o instanceof at||o instanceof di||o instanceof $i?(a.append("stdout",o.stdout,o.internalOutputAccounting.stdout),a.append("stderr",o.stderr,o.internalOutputAccounting.stderr),a.build(o.exitCode)):(a.append("stderr",`${Fr(o)} `),a.build(1))}return a.build(s)}async function TW(e,t,r,n,i=!1){return fi(e,t.redirections,r,a=>_W(e,t,r,n,i,a))}async function _W(e,t,r,n,i,a){let s=new ra(e.executionScope,"group"),o=0,l=a.stdin??r,u=i||r!==""||a.stdin!==void 0,c=e.state.groupStdin;u&&(e.state.groupStdin=l);let p=()=>{(u||c!==void 0&&e.state.groupStdin===void 0)&&(e.state.groupStdin=c)};try{for(let d of t.body){let f=await n(d);s.appendResult(f),o=f.exitCode}}catch(d){if(p(),d instanceof T)throw s.prependTo(d),d;if(P4(d)||d instanceof $i||d instanceof at)throw d.prependOutput(s.stdout,s.stderr),d;return s.append("stderr",`${Fr(d)} `),s.build(1)}return p(),s.build(o)}async function OW(e,t,r,n,i){let a;try{a=await e.fs.readFile(t)}catch{return re(`bash: ${t}: No such file or directory `,127)}if(a.startsWith("#!")){let l=a.indexOf(` `);l!==-1&&(a=a.slice(l+1))}let s=e.state.loopDepth,o=QA(e.state);e.state.parentHasLoopContext=s>0,e.state.loopDepth=0,e.state.bashPid=e.state.nextVirtualPid++,n&&(e.state.groupStdin=n),e.state.currentSource=t,e.state.env.set("0",t),e.state.env.set("#",String(r.length)),e.state.env.set("@",r.join(" ")),e.state.env.set("*",r.join(" "));for(let l=0;l0)throw i.prependOutput(r.stdout,r.stderr),i;r.append("stdout",i.stdout),r.append("stderr",i.stderr);continue}throw i instanceof di&&i.prependOutput(r.stdout,r.stderr),i}return{...r.build(t),env:Fn(this.ctx.state.env)}}async executeUserScript(e,t,r=""){return OW(this.ctx,e,t,r,n=>this.executeScript(n))}async executeStatement(e){if(this.assertDefenseContext("statement"),this.ctx.state.signal?.aborted)throw new zt;if(e.deferredError)throw new Sn(e.deferredError.message,e.line??1,1);if(this.ctx.state.options.noexec)return Tt;this.ctx.state.errexitSafe=!1;let t=new ra(this.ctx.executionScope,"statement");this.ctx.state.options.verbose&&!this.ctx.state.suppressVerbose&&e.sourceText&&t.append("stderr",`${e.sourceText} `);let r=0,n=-1,i=!1;try{for(let o=0;o0?e.operators[o-1]:null;if(u==="&&"&&r!==0||u==="||"&&r===0)continue;let c=await this.executePipeline(l);t.appendResult(c,hy(c)),r=c.exitCode,n=o,i=l.negated,this.ctx.state.lastExitCode=r,this.ctx.state.env.set("?",String(r))}}catch(o){throw t.prependTo(o),o}let a=nthis.executeCommand(t,r,n))}async executeCommand(e,t,r=!1){let n=Oz(this.ctx),i;try{i=await this.executeCommandInner(e,t,r)}catch(s){throw await B7(this.ctx,n).catch(()=>{}),s}let a=await B7(this.ctx,n);return!a.stdout&&!a.stderr?i:{...i,stdout:a.stdout?sl(i)+a.stdout:i.stdout,stdoutKind:a.stdout?"bytes":i.stdoutKind,stderr:i.stderr+a.stderr}}async executeCommandInner(e,t,r){switch(this.assertDefenseContext("command"),this.ctx.coverage?.hit(`bash:cmd:${e.type}`),e.type){case"SimpleCommand":return this.executeSimpleCommand(e,t,r);case"If":return uW(this.ctx,e);case"For":return pW(this.ctx,e);case"CStyleFor":return dW(this.ctx,e);case"While":return mW(this.ctx,e,t);case"Until":return xW(this.ctx,e,t);case"Case":return bW(this.ctx,e);case"Subshell":return this.executeSubshell(e,t,r);case"Group":return this.executeGroup(e,t,r);case"FunctionDef":return Tq(this.ctx,e);case"ArithmeticCommand":return this.executeArithmeticCommand(e);case"ConditionalCommand":return this.executeConditionalCommand(e);default:return IW(e)}}async executeSimpleCommand(e,t,r){let n;try{return await this.executeSimpleCommandInner(e,t,r,i=>{n=i})}catch(i){if(n?.finish(),i instanceof yl)return re(i.stderr);throw i}}async executeSimpleCommandInner(e,t,r,n){if(e.line!==void 0&&(this.ctx.state.currentLine=e.line),this.ctx.state.shoptOptions.expand_aliases&&e.name){let I=e,$=0;for(;;){let _=this.expandAlias(I);if(_===I)break;if($>=this.ctx.limits.maxCallDepth)throw new T(`alias expansion depth limit exceeded (${this.ctx.limits.maxCallDepth})`,"recursion");$++,I=_}this.aliasExpansionStack.clear(),I!==e&&(e=I)}this.ctx.state.expansionStderr="",this.ctx.state.lastSubstitutionExitCode=null;let i=await jH(this.ctx,e);if(i.error)return i.error;let a=i.tempAssignments,s=i.xtraceOutput,o=()=>{for(let[I,$]of a)$===void 0?this.ctx.state.env.delete(I):this.ctx.state.env.set(I,$)};if(!e.name){if(e.redirections.length>0){let $=jc(this.ctx,e.redirections,wq);n($);let _=await $.prepare(t);if(_.error){if(o(),!_.errorCause)return $.finish(),_.error;try{return Gc(_)}finally{$.finish()}}let M=ae("",s,Eh(this.ctx.state,e.redirections)),P=await Zs(this.ctx,M,e.redirections.length>0,_.outputRoutes);return $.finish(),P}this.ctx.state.lastArg="";let I=(this.ctx.state.expansionStderr||"")+s;return this.ctx.state.expansionStderr="",ae("",I,Eh(this.ctx.state,[]))}let l=e.name&&d4(e.name,["local","declare","typeset","export","readonly"]),u=Array.from(a.keys());if(u.length>0&&!l){this.ctx.state.tempExportedVars=this.ctx.state.tempExportedVars||new Set;for(let I of u)this.ctx.state.tempExportedVars.add(I)}let c=await Et(this.ctx,e.name),p=[],d=[],f=(I,$)=>{if(p.length>=this.ctx.limits.maxArrayElements)throw new T(`expanded argument element limit exceeded (${this.ctx.limits.maxArrayElements})`,"array_elements");p.push(I),d.push($)};if(d4(e.name,["local","declare","typeset","export","readonly"])&&(c==="local"||c==="declare"||c==="typeset"||c==="export"||c==="readonly"))for(let I of e.args){let $=await Wz(this.ctx,I);if($)f($,!0);else{let _=await jz(this.ctx,I);if(_!==null)f(_,!0);else{let M=await Ka(this.ctx,I);for(let P of M.values)f(P,M.quoted)}}}else for(let I of e.args){let $=await Ka(this.ctx,I);for(let _ of $.values)f(_,$.quoted)}let h=e.name.parts.every(I=>I.type==="CommandSubstitution"||I.type==="ParameterExpansion"||I.type==="ArithmeticExpansion");!c&&h&&p.length>0&&(c=p.shift(),d.shift());let m=jc(this.ctx,e.redirections,c==="exec"?vq:lm);n(m);let g=await m.prepare(t);if(g.error)return o(),g.errorCause?Gc(g):(m.finish(),g.error);let x=g.stdinSourceFd,y=g.stdin!==void 0,b=r||g.stdinReplaced;if(g.stdin!==void 0&&(t=g.stdin),!c)return h?(m.finish(),ae("","",Eh(this.ctx.state,e.redirections))):(m.finish(),re(`bash: : command not found `,127));if(c==="exec"&&(p.length===0||p[0]==="--")){for(let[I,$]of a)$===void 0?this.ctx.state.env.delete(I):this.ctx.state.env.set(I,$);if(this.ctx.state.tempExportedVars)for(let I of a.keys())this.ctx.state.tempExportedVars.delete(I);return m.finish(),Tt}if(this.ctx.state.extraArgs){let I=this.ctx.state.extraArgs;this.ctx.state.extraArgs=void 0;for(let $ of I)f($,!0)}let k=await HH(this.ctx,c,p);a.size>0&&(this.ctx.state.tempEnvBindings=this.ctx.state.tempEnvBindings||[],this.ctx.state.tempEnvBindings.push(new Map(a)));let w,v=null;try{w=await this.runCommand(c,p,d,t,!1,!1,x,y,b,g.stdinUnavailable)}catch(I){if(I instanceof Oi||I instanceof Ii)v=I,w=Tt;else throw I}x>=0&&c!=="read"&&nl(this.ctx,x,w.internalStdinConsumed??0);let A=s+k;if(A&&(w={...w,stderr:A+w.stderr}),w=await Zs(this.ctx,w,e.redirections.length>0,g.outputRoutes,w.internalProducerCommand??c,w.internalProducerOmitsShellPrefix),m.finish(),v)throw v;if(p.length>0){let I=p[p.length-1];if((c==="declare"||c==="local"||c==="typeset")&&/^[a-zA-Z_][a-zA-Z0-9_]*=\(/.test(I)){let $=I.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);$&&(I=$[1])}this.ctx.state.lastArg=I}else this.ctx.state.lastArg=c;let R=dq(c)&&c!=="unset"&&c!=="eval";if(!this.ctx.state.options.posix||!R)for(let[I,$]of a)this.ctx.state.fullyUnsetLocals?.has(I)||($===void 0?this.ctx.state.env.delete(I):this.ctx.state.env.set(I,$));if(this.ctx.state.tempExportedVars)for(let I of a.keys())this.ctx.state.tempExportedVars.delete(I);return a.size>0&&this.ctx.state.tempEnvBindings&&this.ctx.state.tempEnvBindings.pop(),this.ctx.state.expansionStderr&&(w={...w,stderr:this.ctx.state.expansionStderr+w.stderr},this.ctx.state.expansionStderr=""),w}async runCommand(e,t,r,n,i=!1,a=!1,s=-1,o=!1,l=!1,u=!1){let c={ctx:this.ctx,runCommand:(d,f,h,m,g,x,y,b,k,w)=>this.runCommand(d,f,h,m,g,x,y,b,k,w),buildExportedEnv:()=>this.buildExportedEnv(),executeUserScript:(d,f,h)=>this.executeUserScript(d,f,h)},p=await aW(c,e,t,r,n,i,a,s,o,l,u);return p!==null?p.internalProducerCommand===void 0?{...p,internalProducerCommand:e}:p:{...await lW(c,e,t,n,a,l,u),internalProducerCommand:e}}aliasExpansionStack=new Set;expandAlias(e){return WB({env:this.ctx.state.env,limits:this.ctx.limits},e,this.aliasExpansionStack)}async findCommandInPath(e){return HA(this.ctx,e)}async executeSubshell(e,t="",r=!1){return kW(this.ctx,e,t,n=>this.executeStatement(n),r)}async executeGroup(e,t="",r=!1){return TW(this.ctx,e,t,n=>this.executeStatement(n),r)}async executeArithmeticCommand(e){return e.line!==void 0&&(this.ctx.state.currentLine=e.line),fi(this.ctx,e.redirections,"",async()=>{try{let t=await xt(this.ctx,e.expression.expression),r=dr(t!==0);return this.ctx.state.expansionStderr&&(r={...r,stderr:this.ctx.state.expansionStderr+r.stderr},this.ctx.state.expansionStderr=""),r}catch(t){return re(`bash: arithmetic expression: ${t.message} `)}})}async executeConditionalCommand(e){return e.line!==void 0&&(this.ctx.state.currentLine=e.line),fi(this.ctx,e.redirections,"",async()=>{try{let t=await $a(this.ctx,e.expression),r=dr(t);return this.ctx.state.expansionStderr&&(r={...r,stderr:this.ctx.state.expansionStderr+r.stderr},this.ctx.state.expansionStderr=""),r}catch(t){let r=t instanceof Mt?1:2;return re(`bash: conditional expression: ${t.message} `,r)}})}};wl();ln();Xs();function gm(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function DW(e){let t=gm(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}var RW=3;function KA(e){let t=e;for(let r=0;rYA(e,JA(r)))}function h4(e){let t=PW(e);if(t==="localhost"||t.endsWith(".localhost"))return!0;let r=eC(t);if(r)return gc(r);let n=BW(t);return n?UW(n):!1}function PW(e){let t=e.trim().toLowerCase();return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):t}function FW(e){if(!e)return null;let t=10,r=e;if(r.startsWith("0x")||r.startsWith("0X")?(t=16,r=r.slice(2)):r.length>1&&r.startsWith("0")&&(t=8),!r||t===16&&!/^[0-9a-fA-F]+$/.test(r)||t===10&&!/^\d+$/.test(r)||t===8&&!/^[0-7]+$/.test(r))return null;let n=Number.parseInt(r,t);return!Number.isFinite(n)||n<0?null:n}function eC(e){let t=e.split(".");if(t.length===0||t.length>4)return null;let r=t.map(l=>FW(l));if(r.some(l=>l===null))return null;let n=r;if(t.length===1){let l=n[0];return l>4294967295?null:[l>>>24&255,l>>>16&255,l>>>8&255,l&255]}if(t.length===2){let[l,u]=n;return l>255||u>16777215?null:[l,u>>>16&255,u>>>8&255,u&255]}if(t.length===3){let[l,u,c]=n;return l>255||u>255||c>65535?null:[l,u,c>>>8&255,c&255]}let[i,a,s,o]=n;return i>255||a>255||s>255||o>255?null:[i,a,s,o]}function BW(e){let t=e,r=null;if(t.includes(".")){let m=t.lastIndexOf(":");if(m<0)return null;let g=t.slice(m+1),x=eC(g);if(!x)return null;r=x,t=t.slice(0,m)}let n=t.includes("::")?t.split("::").length-1:0;if(n>1)return null;let[i,a]=t.split("::"),s=i?i.split(":").filter(Boolean):[],o=a?a.split(":").filter(Boolean):[],l=m=>/^[0-9a-f]{1,4}$/i.test(m)?Number.parseInt(m,16):null,u=s.map(l),c=o.map(l);if(u.some(m=>m===null)||c.some(m=>m===null))return null;let p=r?2:0,d=u.length+c.length+p,f=0;if(n===1){if(f=8-d,f<0)return null}else if(d!==8)return null;let h=[...u,...new Array(f).fill(0),...c];return r&&(h.push(r[0]<<8|r[1]),h.push(r[2]<<8|r[3])),h.length===8?h:null}function gc(e){let[t,r]=e;return t===127||t===10||t===172&&r>=16&&r<=31||t===192&&r===168||t===169&&r===254||t===0||t===100&&r>=64&&r<=127||t===198&&(r===18||r===19)||t===192&&r===0&&e[2]===0||t===192&&r===0&&e[2]===2||t===198&&r===51&&e[2]===100||t===203&&r===0&&e[2]===113||t>=240}function UW(e){if(e.every(t=>t===0)||e.slice(0,7).every(t=>t===0)&&e[7]===1||(e[0]&65472)===65152||(e[0]&65024)===64512)return!0;if(e[0]===0&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===65535){let t=[e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255];return gc(t)}if(e[0]===8193&&e[1]===3512)return!0;if(e[0]===100&&e[1]===65435&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===0){let t=[e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255];return gc(t)}if(e[0]===100&&e[1]===65435&&e[2]===1)return!0;if(e[0]===8194){let t=[e[1]>>>8&255,e[1]&255,e[2]>>>8&255,e[2]&255];return gc(t)}return!1}function zW(e){let t=[];for(let r of e){if(typeof r!="string"&&(r===null||typeof r!="object"||!("url"in r)||typeof r.url!="string")){t.push('Invalid allow-list entry: must be a string URL or an object with a "url" string property');continue}let n=JA(r);if(!gm(n)){t.push(`Invalid URL in allow-list: "${n}" - must be a valid URL with scheme and host (e.g., "https://example.com")`);continue}let i=new URL(n);if(i.protocol!=="http:"&&i.protocol!=="https:"){t.push(`Only http and https URLs are allowed in allow-list: "${n}"`);continue}if(!i.hostname){t.push(`Allow-list entry must include a hostname: "${n}"`);continue}if(i.pathname!=="/"&&i.pathname!==""&&KA(i.pathname)){t.push(`Allow-list entry contains ambiguous path separators: "${n}"`);continue}(i.search||i.hash)&&t.push(`Query strings and fragments are ignored in allow-list entries: "${n}"`)}return t}var Ca=class extends Error{constructor(e,t){let r=t??"URL not in allow-list";super(`Network access denied: ${r}: ${e}`),this.name="NetworkAccessDeniedError"}},m4=class extends Error{constructor(e){super(`Too many redirects (max: ${e})`),this.name="TooManyRedirectsError"}},Gu=class extends Error{constructor(e){super(`Redirect target not in allow-list: ${e}`),this.name="RedirectNotAllowedError"}},qW=class extends Error{constructor(e,t){super(`HTTP method '${e}' not allowed. Allowed methods: ${t.join(", ")}`),this.name="MethodNotAllowedError"}},xc=class extends Error{constructor(e){super(`Response body too large (max: ${e} bytes)`),this.name="ResponseTooLargeError"}},HW=20,WW=3e4,jW=10485760,GW=["GET","HEAD"],a0;a0=null;var VW=new Set(["GET","HEAD","OPTIONS"]),ZW=new Set([301,302,303,307,308]);function xl(e){return e.reason instanceof Error?e.reason:new DOMException("The operation was aborted","AbortError")}function XW(e){if(e?.aborted)throw xl(e)}function QW(e){let t=e.allowedUrlPrefixes??[];if(e._dnsResolve)throw new Error("NetworkConfig._dnsResolve is no longer supported: DNS resolution is performed by guarded-fetch and cannot be overridden");if(e._createConnectionOwner)throw new Error("NetworkConfig._createConnectionOwner is no longer supported: connect-time IP pinning is performed by guarded-fetch and cannot be overridden");let r=e._fetch;if(!e.dangerouslyAllowFullInternetAccess){let k=zW(t);if(k.length>0)throw new Error(`Invalid network allow-list: ${k.join(` `)}`)}let n=[];for(let k of t)typeof k=="object"&&k.transform&&k.transform.length>0&&n.push(k);function i(k){if(n.length===0)return null;let w=null;for(let v of n)if(YA(k,v.url)&&v.transform){w||(w=new Headers);for(let A of v.transform)for(let[R,I]of Object.entries(A.headers))w.set(R,I)}return w}if(e.maxRedirects!==void 0&&(!Number.isSafeInteger(e.maxRedirects)||e.maxRedirects<0))throw new RangeError("maxRedirects must be a non-negative safe integer");let a=e.maxRedirects??HW,s=e.timeoutMs??WW,o=e.maxResponseSize??jW,l=e.dangerouslyAllowFullInternetAccess?["GET","HEAD","POST","PUT","DELETE","PATCH","OPTIONS"]:e.allowedMethods??GW,u=e.denyPrivateRanges??(typeof process<"u"&&!0),c=[];for(let k of t){let w=typeof k=="string"?k:k.url;try{c.push(new URL(w).hostname)}catch{}}function p(k){try{return new URL(k).hostname||"localhost.invalid"}catch{return"localhost.invalid"}}function d(k){return e.dangerouslyAllowFullInternetAccess?u?{allowedHosts:void 0,skipSsrfCheckForAllowedHosts:void 0}:{allowedHosts:[p(k)],skipSsrfCheckForAllowedHosts:!0}:{allowedHosts:c,skipSsrfCheckForAllowedHosts:!u}}function f(k){try{return h4(new URL(k).hostname)}catch{return!1}}async function h(k,w){let v={method:w.method,headers:w.headers,signal:w.signal,redirect:"manual"};return w.body!==void 0&&(v.body=w.body),await(r??globalThis.fetch)(k,v)}function m(k){if(!e.dangerouslyAllowFullInternetAccess&&!MW(k,t))throw new Ca(k)}function g(k){if(!u)return;let w;try{w=new URL(k)}catch{throw new Ca(k,"invalid URL")}if(h4(w.hostname))throw new Ca(k,"private/loopback IP address blocked")}function x(k){if(e.dangerouslyAllowFullInternetAccess)return;let w=k.toUpperCase();if(!l.includes(w))throw new qW(w,l)}function y(k,w,v,A){if(!v.isGuardedFetchError(k))return k;let R=k,{onRedirectHop:I,subReason:$}=A;switch(R.code){case"host_not_allowed":case"protocol_not_allowed":return I?new Gu(w):new Ca(w);case"hostname_unsafe":return I?new Gu(w):new Ca(w,$==="dns_resolution_failed"?"DNS resolution failed for private IP check":"hostname resolves to private/loopback IP address");case"redirect_to_unsafe_host":return new Gu(w);case"too_many_redirects":return new m4(a);case"response_too_large":return new xc(o);default:return k}}async function b(k,w={}){let v=w.method?.toUpperCase()??"GET",A=w.followRedirects??!0;if(w.maxRedirects!==void 0&&(!Number.isSafeInteger(w.maxRedirects)||w.maxRedirects<0))throw new RangeError("maxRedirects must be a non-negative safe integer");let R=w.maxRedirects??a,I=Math.min(a,R),$=w.timeoutMs!==void 0?Math.min(w.timeoutMs,s):s,_=new AbortController,M=al(()=>_.abort(new DOMException("The operation was aborted","AbortError")),$),P=p0(w.signal,_.signal);try{m(k),g(k),x(v);let S=a0?await a0:null,D=k,W=0,j=[],U=v,H=w.body,z=w.headers,ee=!1;for(;;){XW(P.signal);let Y=await rn.runTrustedAsync(async()=>{let ne=z;if(ee&&ne){let ie=ne instanceof Headers?new Headers(ne):new Headers(ne);ie.delete("authorization"),ie.delete("cookie"),ne=ie}let Z=i(D),ve=YW(ne,Z),de={method:U,headers:ve,signal:P.signal,followRedirects:!1,timeoutMs:$,sanitizeHeaders:!1};if(H&&!VW.has(U)&&(de.body=H),Object.assign(de,d(D)),!S||f(D)){if(u)throw new Ca(D,"DNS pinning unavailable for private IP enforcement");return await h(D,de)}u?r&&(de.fetch=r):(de.fetch=r??globalThis.fetch,de.dispatcher=null);let xe;de.onUrlBlocked=ie=>{xe=ie.subReason};try{return await S.guardedFetch(D,de)}catch(ie){throw y(ie,D,S,{onRedirectHop:W>0,subReason:xe})}});if(ZW.has(Y.status)&&A){let ne=Y.headers.get("location");if(!ne)return await g4(Y,D,o,P.signal,j);j.push({status:Y.status,statusText:Y.statusText,headers:tC(Y.headers)});let Z=new URL(ne,D).href;await s0(KW(Y),P.signal);try{m(Z),g(Z)}catch(de){throw P.signal?.aborted?xl(P.signal):de instanceof Ca?new Gu(Z):de}let ve=Y.status;if(((ve===301||ve===302)&&U==="POST"||ve===303&&U!=="GET"&&U!=="HEAD")&&(U="GET",H=void 0,x(U)),new URL(Z).origin!==new URL(D).origin&&(ee=!0),W++,W>I)throw new m4(I);D=Z;continue}return await g4(Y,D,o,P.signal,j)}}finally{Zc(M),P.cleanup()}}return b}async function s0(e,t){if(!t)return e;if(t.aborted)throw e.catch(()=>{}),xl(t);let r,n=new Promise((i,a)=>{r=()=>a(xl(t)),t.addEventListener("abort",r,{once:!0})});try{return await Promise.race([e,n])}finally{r&&t.removeEventListener("abort",r)}}async function KW(e){e.body&&!e.body.locked&&await e.body.cancel()}function YW(e,t){if(!e&&!t)return;if(!t)return e;let r=e instanceof Headers?new Headers(e):new Headers(e);for(let[n,i]of t)r.set(n,i);return r}function tC(e){let t=Object.create(null);return e.forEach((r,n)=>{t[n.toLowerCase()]=r}),t}async function g4(e,t,r,n,i){let a=tC(e.headers);if(r>0){let l=e.headers.get("content-length");if(l){let u=parseInt(l,10);if(!Number.isNaN(u)&&u>r)throw new xc(r)}}let s;if(r>0&&e.body){let l=e.body.getReader(),u=[],c=0;try{for(;;){let{done:d,value:f}=await s0(l.read(),n);if(d)break;if(f){if(c+=f.byteLength,c>r)throw await l.cancel(),new xc(r);u.push(f)}}}catch(d){throw n?.aborted&&await l.cancel(xl(n)).catch(()=>{}),d}s=new Uint8Array(c);let p=0;for(let d of u)s.set(d,p),p+=d.byteLength}else{let l=await s0(e.arrayBuffer(),n);if(r>0&&l.byteLength>r)throw new xc(r);s=new Uint8Array(l)}let o={status:e.status,statusText:e.statusText,headers:a,body:s,url:t};return i&&i.length>0&&(o.redirectChain=i),o}ln();ir();J();function x4(e,t){if(e.length>t||K(e)>t)throw new T(`script input size limit exceeded (${t} bytes)`,"string_length")}var y4="/usr/bin:/bin",b4=[["OSTYPE","linux-gnu"],["MACHTYPE","x86_64-pc-linux-gnu"],["HOSTTYPE","x86_64"],["HOSTNAME","localhost"]],xm=class{fs;commands=new Map;useDefaultLayout=!1;limits;secureFetch;sleepFn;traceFn;logger;defenseInDepthConfig;coverageWriter;jsBootstrapCode;invokeToolFn;transformPlugins=[];state;constructor(e={}){this.limits=oF({...e.executionLimits,...e.maxCallDepth!==void 0&&{maxCallDepth:e.maxCallDepth},...e.maxCommandCount!==void 0&&{maxCommandCount:e.maxCommandCount},...e.maxLoopIterations!==void 0&&{maxLoopIterations:e.maxLoopIterations}},e.executionLimitProfile);let t=e.fs??new Hs(e.files,{maxTotalBytes:this.limits.maxFileSystemBytes});this.fs=t,this.useDefaultLayout=!e.cwd&&!e.files;let r=e.cwd||(this.useDefaultLayout?"/home/user":"/"),n=new Map([["HOME",this.useDefaultLayout?"/home/user":"/"],["PATH",y4],["IFS",` `],...b4,["PWD",r],["OLDPWD",r],["OPTIND","1"],...Object.entries(e.env??{})]);if(e.fetch?this.secureFetch=e.fetch:e.network&&(this.secureFetch=QW(e.network)),this.sleepFn=e.sleep,this.traceFn=e.trace,this.logger=e.logger,this.defenseInDepthConfig=e.defenseInDepth??!0,this.coverageWriter=e.coverage,this.state={env:n,arrays:new Map,cwd:r,previousDir:"/home/user",functions:new Map,localScopes:[],callDepth:0,sourceDepth:0,commandCount:0,lastExitCode:0,lastSubstitutionExitCode:null,lastArg:"",startTime:Date.now(),lastBackgroundPid:0,virtualPid:e.processInfo?.pid??1,virtualPpid:e.processInfo?.ppid??0,virtualUid:e.processInfo?.uid??1e3,virtualGid:e.processInfo?.gid??1e3,bashPid:e.processInfo?.pid??1,nextVirtualPid:(e.processInfo?.pid??1)+1,currentLine:1,options:{errexit:!1,pipefail:!1,nounset:!1,xtrace:!1,verbose:!1,posix:!1,allexport:!1,noclobber:!1,noglob:!1,noexec:!1,vi:!1,emacs:!1},shoptOptions:{extglob:!1,dotglob:!1,nullglob:!1,failglob:!1,globstar:!1,globskipdots:!0,nocaseglob:!1,nocasematch:!1,expand_aliases:!1,lastpipe:!1,xpg_echo:!1},inCondition:!1,loopDepth:0,exportedVars:new Set(["HOME","PATH","PWD","OLDPWD",...Object.keys(e.env||{})]),readonlyVars:new Set(["SHELLOPTS","BASHOPTS"]),hashTable:new Map},this.state.env.set("SHELLOPTS",T1(this.state.options)),this.state.env.set("BASHOPTS",_1(this.state.shoptOptions)),wF(t,this.useDefaultLayout,{pid:this.state.virtualPid,ppid:this.state.virtualPpid,uid:this.state.virtualUid,gid:this.state.virtualGid}),r!=="/"&&(t instanceof Hs||t instanceof US))try{t.mkdirSync(r,{recursive:!0})}catch{}for(let a of eF(e.commands))this.registerBundledCommand(a);if(e.fetch||e.network)for(let a of tF())this.registerBundledCommand(a);if(e.python)for(let a of rF())this.registerBundledCommand(a);let i=typeof e.javascript=="object"?e.javascript:Object.create(null);if(e.javascript||i.invokeTool){for(let a of nF())this.registerBundledCommand(a);i.bootstrap&&(this.jsBootstrapCode=i.bootstrap),i.invokeTool&&(this.invokeToolFn=i.invokeTool)}if(e.customCommands)for(let a of e.customCommands)if(lF(a)){let s=uF(a);this.registerCommandInternal(s,!0)}else this.registerCommandInternal(a,!0)}registerCommand(e){this.registerCommandInternal(e,!0)}registerBundledCommand(e){this.registerCommandInternal(e,!1)}registerCommandInternal(e,t,r=t?e.trusted??!0:e.trusted){let n=this.commands.get(e.name),i=t?n?.internalOriginalCommand??(n&&!n.internalIsExtension?n:void 0):void 0,a={name:e.name,trusted:r,internalIsExtension:t,internalOriginalCommand:i,execute:(o,l)=>e.execute(o,l)};this.commands.set(e.name,a);let s=this.fs;if(typeof s.writeFileSync=="function"){let o=`#!/bin/bash # Built-in command: ${e.name} `;try{s.writeFileSync(`/bin/${e.name}`,o)}catch{}try{s.writeFileSync(`/usr/bin/${e.name}`,o)}catch{}}}logResult(e){return this.logger&&(e.stdout&&this.logger.debug("stdout",{output:e.stdout}),e.stderr&&this.logger.info("stderr",{output:e.stderr}),this.logger.info("exit",{exitCode:e.exitCode})),e.stdout=v4(e.stdout),e.stderr=v4(e.stderr),e}async exec(e,t){let r=new cF(this.limits,t?.signal),n;try{n=await this.execInScope(e,t,r,0,t?.signal,!1,!1)}catch(a){try{await r.close()}catch{}throw a}let i=n;try{await r.close()}catch{i={...n,stderr:`${n.stderr}bash: execution cleanup failed `,exitCode:126}}return e.trim()?this.logResult(i):i}async execInScope(e,t,r,n,i,a=!1,s=!0,o){let l=p=>s?this.logResult(p):p,u=p0(i,t?.signal),c=t?{...t,signal:u.signal}:{signal:u.signal};try{if(r.assertExecDepth(n),x4(e,this.limits.maxSourceBytes),!e.trim())return{stdout:"",stderr:"",exitCode:0,env:mn(this.state.env,c.env)};this.logger?.info("exec",{command:e});let p=c.cwd??this.state.cwd,d,f=p;if(c.cwd)if(c.env&&"PWD"in c.env)d=c.env.PWD;else if(c.env&&!("PWD"in c.env))try{d=await this.fs.realpath(p),f=d}catch{d=p}else d=p;let h=c.replaceEnv||c.newShell,m=h?new Map:new Map((o??this.state).env);if(c.env)for(let[A,R]of Object.entries(c.env))m.set(A,R);d!==void 0&&m.set("PWD",d);let g=!o||c.newShell,x=h&&g?new Set:o?new Set([...o.exportedVars??[],...o.tempExportedVars??[]]):new Set(this.state.exportedVars);if(g){for(let A of Object.keys(c.env??{}))/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(A)&&x.add(A);d!==void 0&&x.add("PWD")}if(c.newShell){m.has("PATH")||m.set("PATH",y4);for(let[A,R]of b4)m.has(A)||m.set(A,R);m.set("IFS",` `),m.set("OPTIND","1"),m.set("SHELLOPTS",T1(this.state.options)),m.set("BASHOPTS",_1(this.state.shoptOptions))}let y=o&&!c.newShell?o:this.state,b={...this.state,env:m,exportedVars:x,arrays:h?new Map:Ys(this.state.arrays),cwd:f,previousDir:c.env?.OLDPWD??(h?"":this.state.previousDir),functions:new Map(this.state.functions),localScopes:[...this.state.localScopes],options:{...this.state.options},shoptOptions:{...y.shoptOptions},readonlyVars:new Set(y.readonlyVars),hashTable:new Map(y.hashTable),groupStdin:tj(c.stdin,c.stdinKind,this.limits.maxInputBytes,this.limits.maxStringLength,r,a),signal:c.signal,extraArgs:c.args},k=e;c.rawScript||(k=w4(e));let w=this.defenseInDepthConfig?rn.getInstance(this.defenseInDepthConfig):null,v=w?.activate();try{let A=async()=>{let R=Ws(k,{maxHeredocSize:this.limits.maxHeredocSize}),I;if(this.transformPlugins.length>0){let M=Object.create(null);for(let P of this.transformPlugins){let S=P.transform({ast:R,metadata:M});R=S.ast,S.metadata&&(M=Sc(M,S.metadata))}I=M}let $={fs:this.fs,commands:this.commands,limits:this.limits,executionScope:r,exec:(M,P,S=!1)=>this.execInScope(M,P,r,n+1,c.signal,S,!0,b),fetch:this.secureFetch,sleep:this.sleepFn,trace:this.traceFn,coverage:this.coverageWriter,requireDefenseContext:w?.isEnabled()===!0,jsBootstrapCode:this.jsBootstrapCode,invokeTool:this.invokeToolFn},_=await new $W($,b).executeScript(R);return I&&(_.metadata=I),l(_)};return v?await v.run(A):await A()}catch(A){if(A instanceof at)return l({stdout:A.stdout,stderr:A.stderr,exitCode:A.exitCode,internalOutputAccounting:A.internalOutputAccounting,env:mn(this.state.env,c.env)});if(A instanceof Ci)return l({stdout:A.stdout,stderr:A.stderr,exitCode:A.exitCode,env:mn(this.state.env,c.env)});if(A instanceof Mt)return l({stdout:A.stdout,stderr:A.stderr,exitCode:1,env:mn(this.state.env,c.env)});if(A instanceof zt)return l({stdout:A.stdout,stderr:A.stderr,exitCode:124,env:mn(this.state.env,c.env)});if(A instanceof T)return l({stdout:A.stdout,stderr:Xt(A.stderr),exitCode:T.EXIT_CODE,internalOutputAccounting:A.internalOutputAccounting,env:mn(this.state.env,c.env)});if(A instanceof He)return l({stdout:"",stderr:`bash: security violation: ${Xt(A.message)} `,exitCode:1,env:mn(this.state.env,c.env)});if(A.name==="ParseException")return l({stdout:"",stderr:`bash: syntax error: ${Xt(A.message)} `,exitCode:2,env:mn(this.state.env,c.env)});if(A instanceof si)return l({stdout:"",stderr:`bash: ${Xt(A.message)} `,exitCode:2,env:mn(this.state.env,c.env)});if(A instanceof RangeError)return l({stdout:"",stderr:`bash: ${Xt(A.message)} `,exitCode:1,env:mn(this.state.env,c.env)});throw A}finally{v?.deactivate()}}catch(p){if(p instanceof zt)return l({stdout:p.stdout,stderr:p.stderr,exitCode:124,env:mn(this.state.env,c.env)});if(p instanceof T)return l({stdout:p.stdout,stderr:Xt(p.stderr),exitCode:T.EXIT_CODE,internalOutputAccounting:p.internalOutputAccounting,env:mn(this.state.env,c.env)});throw p}finally{u.cleanup()}}async readFile(e){return this.fs.readFile(this.fs.resolvePath(this.state.cwd,e))}async writeFile(e,t){return this.fs.writeFile(this.fs.resolvePath(this.state.cwd,e),t)}getCwd(){return this.state.cwd}getEnv(){return Fn(this.state.env)}registerTransformPlugin(e){this.transformPlugins.push(e)}transform(e){x4(e,this.limits.maxSourceBytes);let t=w4(e),r=Ws(t,{maxHeredocSize:this.limits.maxHeredocSize}),n=Object.create(null);for(let i of this.transformPlugins){let a=i.transform({ast:r,metadata:n});r=a.ast,a.metadata&&(n=Sc(n,a.metadata))}return{script:wB(r),ast:r,metadata:n}}};function JW(e,t){let r=t;for(let n=0;n0){let c=n[n.length-1];if((c.stripTabs?s.replace(/^\t+/,""):s)===c.delimiter){r.push(s.trimStart()),n.pop();continue}r.push(s);continue}let o=i,l=o==="none"?s.trimStart():s;if(r.push(l),i=JW(s,o),o!=="none")continue;let u=/<<(-?)\s*(['"]?)([\w-]+)\2/g;for(let c of l.matchAll(u)){let p=c[1]==="-",d=c[3];n.push({delimiter:d,stripTabs:p})}}return r.join(` `)}var ej=new TextDecoder("utf-8",{fatal:!0});function v4(e){if(!e)return e;let t=!1;for(let n=0;n255)return e;i>127&&(t=!0)}if(!t)return e;let r=new Uint8Array(e.length);for(let n=0;nr||s>n)throw new T(`stdin size limit exceeded (${Math.min(r,n)} bytes)`,"string_length");return a||i.consumeInput(s,"stdin"),t==="bytes"?e:Ha(e)}function rj(e){return(e.isDirectory?"d":e.isSymbolicLink?"l":"-")+Array.from("rwxrwxrwx",(r,n)=>e.mode&256>>n?r:"-").join("")}function Ap(e){return e==="/usr"||/^\/(?:usr\/)?bin(?:\/|$)/.test(e)}function ym(e){return Ap(e)||e==="/workspace/api-key.txt"?"root":"guest"}async function rC(e,t,r,n){let i=t.filter(l=>!l.startsWith("-")),a=t.some(l=>/^-[^-]*d/.test(l)||l==="--directory"),s=r;if(i.length===1&&!a){let l=n.resolvePath(r,i[0]);(await n.stat(l).catch(()=>null))?.isDirectory&&(s=l)}let o=e.split(` `);for(let[l,u]of o.entries()){let c=/^[d-][rwx-]{9} 1 user user(\s+\S+\s+\S+\s+\d+\s+\S+ )(.*)$/.exec(u);if(!c){u.endsWith(":")&&(s=n.resolvePath(r,u.slice(0,-1)));continue}let[,p,d]=c,f=n.resolvePath(s,d),h=await n.lstat(f).catch(()=>null);!h&&/[*@/]$/.test(d)&&(f=n.resolvePath(s,d.slice(0,-1)),h=await n.lstat(f).catch(()=>null)),h&&(o[l]=`${rj(h)} 1 ${ym(f)} ${ym(f)}${p}${d}`)}return o.join(` `)}async function nC(e,t,r){let n={cwd:t.cwd,signal:t.signal},i=e[0]==="-c"?e[1]:e[0]?.match(/^-c(.+)/)?.[1];if(!i||!/%[uUgG]/.test(i))return r.exec("stat",{...n,args:e});let a=e.slice(e[0]==="-c"?2:1);if(a[0]==="--"&&a.shift(),!a.length)return r.exec("stat",{...n,args:e});let s={stdout:"",stderr:"",exitCode:0};for(let o of a){let l=ym(t.fs.resolvePath(t.cwd,o)),u=i.replace(/%[uUgG]/g,p=>p==="%U"||p==="%G"?l:l==="root"?"0":"1000"),c=await r.exec("stat",{...n,args:["-c",u,"--",o]});if(s.stdout+=c.stdout,s.stderr+=c.stderr,s.exitCode||=c.exitCode,s.stdout.length+s.stderr.length>t.limits.maxOutputSize)throw new Error("stat: output size limit exceeded")}return s}var bm="/workspace/",so=bm+"api-key.txt",wm=256*1024,{command:ij,entries:aj,createdMs:sj}=await nj(process.stdin),un=new Hs({[so]:()=>{throw new Error("EACCES: permission denied, open '/workspace/api-key.txt'")}},{maxTotalBytes:wm}),oj={isFile:!0,isDirectory:!1,isSymbolicLink:!1,mode:256,size:80,mtime:new Date(sj)},Cp=e=>un.resolvePath("/",e)===so,lj=new Set(["readFile","readFileBytes","readFileBuffer"]),iC=new Set(["writeFile","appendFile","chmod","utimes","createExclusive","mkdir","rm","mv","cp","link","symlink"]),uj=new Set(["mv","cp","link","symlink"]);function aC(e){let t=new Error("Permission denied: "+e);return Promise.reject(Object.assign(t,{code:"EACCES",path:e}))}var lC=new Proxy(un,{get(e,t){let r=e[t];return typeof r!="function"?r:(...n)=>{if((t==="stat"||t==="lstat")&&Cp(n[0]))return Promise.resolve(oj);if(t==="exists"&&Cp(n[0]))return Promise.resolve(!0);if(lj.has(t)||iC.has(t)){let i=uj.has(t)?n.slice(0,2):[n[0]];if(iC.has(t)){let s=(t==="cp"?[n[1]]:i).find(o=>Ap(un.resolvePath("/",o)));if(s)return aC(s)}if(i.some(Cp))return aC(so)}return r.apply(e,n)}}});for(let e of aj){if(e.path===so||!e.path.startsWith(bm))throw Error("Invalid workspace entry");e.directory?await un.mkdir(e.path,{recursive:!0}):await un.writeFile(e.path,Buffer.from(e.data,"base64")),await un.chmod(e.path,e.mode)}var vm={fs:lC,cwd:"/workspace",env:{HOME:"/workspace",USER:"guest"},commands:["bash","sh","ls","cat","printf","echo","pwd","wc","grep","rg","sed","awk","head","tail","sort","uniq","tr","cut","tee","find","tree","mkdir","rmdir","touch","cp","mv","rm","chmod","stat","file","diff","basename","dirname","true","false","seq","expr"],executionLimitProfile:"hardened",executionLimits:{maxCommandCount:512,maxLoopIterations:2e3,maxSourceBytes:16384,maxOutputSize:16384,maxFileSystemBytes:wm}},uC=new xm(vm),cj=e=>pp(e,async(t,r)=>{let n=await uC.exec(e,{args:t,cwd:r.cwd,stdin:r.stdin,signal:r.signal}),i=a=>un.resolvePath(r.cwd,a);return e==="cat"?n.stderr=n.stderr.replace(/^cat: (.+): No such file or directory$/gm,(a,s)=>i(s)===so?"cat: "+s+": Permission denied":a):e==="chmod"?n.stderr=n.stderr.replace(/^chmod: cannot access '(.+)': No such file or directory$/gm,(a,s)=>un.getAllPaths().includes(i(s))&&(Ap(i(s))||Cp(i(s)))?`chmod: changing permissions of '${s}': Operation not permitted`:a):n.stdout=await rC(n.stdout,t,r.cwd,lC),n}),pj=new xm({...vm,customCommands:[...["ls","cat","chmod"].map(cj),pp("stat",(e,t)=>nC(e,t,uC)),pp("sudo",async()=>({stdout:"",stderr:`sudo: permission denied for guest in this workspace `,exitCode:1}))]});for(let e of[...vm.commands,"sudo"])for(let t of["/bin","/usr/bin"]){let r=t+"/"+e;await un.writeFile(r,`#!/bin/bash # The guest shell dispatches this name to its built-in implementation. command ${e} "$@" `),await un.chmod(r,493)}var{stdout:fj,stderr:dj,exitCode:hj}=await pj.exec(ij).catch(e=>{if(e.code!=="EACCES")throw e;return{stdout:"",stderr:`bash: ${e.path??"guest filesystem"}: Permission denied `,exitCode:1}}),cC=un.getAllPaths().filter(e=>e.startsWith(bm)&&e!==so).sort();if(cC.length>128)throw Error("Workspace entry limit exceeded");var pC=[],sC=0;for(let e of cC){let t=await un.lstat(e);if(!t.isDirectory&&!t.isFile)throw Error("Unsupported workspace entry");let r={path:e,directory:t.isDirectory,mode:t.mode};if(t.isFile){let n=await un.readFileBuffer(e);if(sC+=n.length,sC>wm)throw Error("Workspace size limit exceeded");r.data=Buffer.from(n).toString("base64")}pC.push(r)}var oC=e=>e.length<=3e3?e:e.slice(0,3e3).toWellFormed()+` [output truncated]`;process.stdout.write(JSON.stringify({stdout:oC(fj),stderr:oC(dj),exit_code:hj,entries:pC})); /*! Bundled license information: @mixmark-io/domino/lib/style_parser.js: (** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license *) just-bash/dist/bundle/browser.js: (*! Bundled license information: re2js/build/index.esm.js: (*! * re2js * RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching * * @version v1.3.3 * @author Alexey Vasiliev * @homepage https://github.com/le0pard/re2js#readme * @repository github:le0pard/re2js * @license MIT *) ieee754/index.js: (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) *) */