@zuplo/runtime 7.15.48 → 7.15.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/esm/{chunk-4F6BLF4T.js → chunk-B7GJXWVX.js} +2 -2
- package/out/esm/{chunk-4F6BLF4T.js.map → chunk-B7GJXWVX.js.map} +1 -1
- package/out/esm/index.js +1 -1
- package/out/esm/mcp-gateway/index.js +1 -1
- package/out/esm/mocks/index.js +1 -1
- package/out/types/index.d.ts +3 -2
- package/package.json +1 -1
- /package/out/esm/{chunk-4F6BLF4T.js.LEGAL.txt → chunk-B7GJXWVX.js.LEGAL.txt} +0 -0
|
@@ -270,5 +270,5 @@ Signature verification is impossible without access to the original signed mater
|
|
|
270
270
|
`);let R=new v("!xml"),I=R,x="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let q=new A(this.options.processEntities);for(let _=0;_<y.length;_++)if(y[_]==="<")if(y[_+1]==="/"){let ee=bn(y,">",_,"Closing Tag is not closed."),B=y.substring(_+2,ee).trim();if(this.options.removeNSPrefix){let Ee=B.indexOf(":");Ee!==-1&&(B=B.substr(Ee+1))}B=Gn(this.options.transformTagName,B,"",this.options).tagName,I&&(x=this.saveTextToParentTag(x,I,this.matcher));let Se=this.matcher.getCurrentTag();if(B&&this.options.unpairedTags.indexOf(B)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${B}>`);Se&&this.options.unpairedTags.indexOf(Se)!==-1&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,I=this.tagsNodeStack.pop(),x="",_=ee}else if(y[_+1]==="?"){let ee=kn(y,_,!1,"?>");if(!ee)throw new Error("Pi Tag is not closed.");if(x=this.saveTextToParentTag(x,I,this.matcher),!(this.options.ignoreDeclaration&&ee.tagName==="?xml"||this.options.ignorePiTags)){let B=new v(ee.tagName);B.add(this.options.textNodeName,""),ee.tagName!==ee.tagExp&&ee.attrExpPresent&&(B[":@"]=this.buildAttributesMap(ee.tagExp,this.matcher,ee.tagName)),this.addChild(I,B,this.matcher,_)}_=ee.closeIndex+1}else if(y.substr(_+1,3)==="!--"){let ee=bn(y,"-->",_+4,"Comment is not closed.");if(this.options.commentPropName){let B=y.substring(_+4,ee-2);x=this.saveTextToParentTag(x,I,this.matcher),I.add(this.options.commentPropName,[{[this.options.textNodeName]:B}])}_=ee}else if(y.substr(_+1,2)==="!D"){let ee=q.readDocType(y,_);this.docTypeEntities=ee.entities,_=ee.i}else if(y.substr(_+1,2)==="!["){let ee=bn(y,"]]>",_,"CDATA is not closed.")-2,B=y.substring(_+9,ee);x=this.saveTextToParentTag(x,I,this.matcher);let Se=this.parseTextData(B,I.tagname,this.matcher,!0,!1,!0,!0);Se==null&&(Se=""),this.options.cdataPropName?I.add(this.options.cdataPropName,[{[this.options.textNodeName]:B}]):I.add(this.options.textNodeName,Se),_=ee+2}else{let ee=kn(y,_,this.options.removeNSPrefix);if(!ee){let nn=y.substring(Math.max(0,_-50),Math.min(y.length,_+50));throw new Error(`readTagExp returned undefined at position ${_}. Context: "${nn}"`)}let B=ee.tagName,Se=ee.rawTagName,Ee=ee.tagExp,je=ee.attrExpPresent,Rt=ee.closeIndex;if({tagName:B,tagExp:Ee}=Gn(this.options.transformTagName,B,Ee,this.options),this.options.strictReservedNames&&(B===this.options.commentPropName||B===this.options.cdataPropName||B===this.options.textNodeName||B===this.options.attributesGroupName))throw new Error(`Invalid tag name: ${B}`);I&&x&&I.tagname!=="!xml"&&(x=this.saveTextToParentTag(x,I,this.matcher,!1));let pn=I;pn&&this.options.unpairedTags.indexOf(pn.tagname)!==-1&&(I=this.tagsNodeStack.pop(),this.matcher.pop());let ci=!1;Ee.length>0&&Ee.lastIndexOf("/")===Ee.length-1&&(ci=!0,B[B.length-1]==="/"?(B=B.substr(0,B.length-1),Ee=B):Ee=Ee.substr(0,Ee.length-1),je=B!==Ee);let wt=null,xn={},ui;ui=se(Se),B!==R.tagname&&this.matcher.push(B,{},ui),B!==Ee&&je&&(wt=this.buildAttributesMap(Ee,this.matcher,B),wt&&(xn=ce(wt,this.options))),B!==R.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));let wn=_;if(this.isCurrentNodeStopNode){let nn="";if(ci)_=ee.closeIndex;else if(this.options.unpairedTags.indexOf(B)!==-1)_=ee.closeIndex;else{let di=this.readStopNodeData(y,Se,Rt+1);if(!di)throw new Error(`Unexpected end of ${Se}`);_=di.i,nn=di.tagContent}let li=new v(B);wt&&(li[":@"]=wt),li.add(this.options.textNodeName,nn),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(I,li,this.matcher,wn)}else{if(ci){({tagName:B,tagExp:Ee}=Gn(this.options.transformTagName,B,Ee,this.options));let nn=new v(B);wt&&(nn[":@"]=wt),this.addChild(I,nn,this.matcher,wn),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(this.options.unpairedTags.indexOf(B)!==-1){let nn=new v(B);wt&&(nn[":@"]=wt),this.addChild(I,nn,this.matcher,wn),this.matcher.pop(),this.isCurrentNodeStopNode=!1,_=ee.closeIndex;continue}else{let nn=new v(B);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(I),wt&&(nn[":@"]=wt),this.addChild(I,nn,this.matcher,wn),I=nn}x="",_=Rt}}else x+=y[_];return R.child},"parseXml");function de(y,R,I,x){this.options.captureMetaData||(x=void 0);let q=this.options.jPath?I.toString():I,_=this.options.updateTag(R.tagname,q,R[":@"]);_===!1||(typeof _=="string"&&(R.tagname=_),y.addChild(R,x))}i(de,"addChild"),n(de,"addChild");function pe(y,R,I){let x=this.options.processEntities;if(!x||!x.enabled)return y;if(x.allowedTags){let q=this.options.jPath?I.toString():I;if(!(Array.isArray(x.allowedTags)?x.allowedTags.includes(R):x.allowedTags(R,q)))return y}if(x.tagFilter){let q=this.options.jPath?I.toString():I;if(!x.tagFilter(R,q))return y}for(let q of Object.keys(this.docTypeEntities)){let _=this.docTypeEntities[q],re=y.match(_.regx);if(re){if(this.entityExpansionCount+=re.length,x.maxTotalExpansions&&this.entityExpansionCount>x.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${x.maxTotalExpansions}`);let ee=y.length;if(y=y.replace(_.regx,_.val),x.maxExpandedLength&&(this.currentExpandedLength+=y.length-ee,this.currentExpandedLength>x.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${x.maxExpandedLength}`)}}for(let q of Object.keys(this.lastEntities)){let _=this.lastEntities[q],re=y.match(_.regex);if(re&&(this.entityExpansionCount+=re.length,x.maxTotalExpansions&&this.entityExpansionCount>x.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${x.maxTotalExpansions}`);y=y.replace(_.regex,_.val)}if(y.indexOf("&")===-1)return y;if(this.options.htmlEntities)for(let q of Object.keys(this.htmlEntities)){let _=this.htmlEntities[q],re=y.match(_.regex);if(re&&(this.entityExpansionCount+=re.length,x.maxTotalExpansions&&this.entityExpansionCount>x.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${x.maxTotalExpansions}`);y=y.replace(_.regex,_.val)}return y=y.replace(this.ampEntity.regex,this.ampEntity.val),y}i(pe,"replaceEntitiesValue"),n(pe,"replaceEntitiesValue");function Pe(y,R,I,x){return y&&(x===void 0&&(x=R.child.length===0),y=this.parseTextData(y,R.tagname,I,!1,R[":@"]?Object.keys(R[":@"]).length!==0:!1,x),y!==void 0&&y!==""&&R.add(this.options.textNodeName,y),y=""),y}i(Pe,"saveTextToParentTag"),n(Pe,"saveTextToParentTag");function xe(y,R){if(!y||y.length===0)return!1;for(let I=0;I<y.length;I++)if(R.matches(y[I]))return!0;return!1}i(xe,"isItStopNode"),n(xe,"isItStopNode");function j(y,R,I=">"){let x,q="";for(let _=R;_<y.length;_++){let re=y[_];if(x)re===x&&(x="");else if(re==='"'||re==="'")x=re;else if(re===I[0])if(I[1]){if(y[_+1]===I[1])return{data:q,index:_}}else return{data:q,index:_};else re===" "&&(re=" ");q+=re}}i(j,"tagExpWithClosingIndex"),n(j,"tagExpWithClosingIndex");function bn(y,R,I,x){let q=y.indexOf(R,I);if(q===-1)throw new Error(x);return q+R.length-1}i(bn,"findClosingIndex"),n(bn,"findClosingIndex");function kn(y,R,I,x=">"){let q=j(y,R+1,x);if(!q)return;let _=q.data,re=q.index,ee=_.search(/\s/),B=_,Se=!0;ee!==-1&&(B=_.substring(0,ee),_=_.substring(ee+1).trimStart());let Ee=B;if(I){let je=B.indexOf(":");je!==-1&&(B=B.substr(je+1),Se=B!==q.data.substr(je+1))}return{tagName:B,tagExp:_,closeIndex:re,attrExpPresent:Se,rawTagName:Ee}}i(kn,"readTagExp"),n(kn,"readTagExp");function jo(y,R,I){let x=I,q=1;for(;I<y.length;I++)if(y[I]==="<")if(y[I+1]==="/"){let _=bn(y,">",I,`${R} is not closed`);if(y.substring(I+2,_).trim()===R&&(q--,q===0))return{tagContent:y.substring(x,I),i:_};I=_}else if(y[I+1]==="?")I=bn(y,"?>",I+1,"StopNode is not closed.");else if(y.substr(I+1,3)==="!--")I=bn(y,"-->",I+3,"StopNode is not closed.");else if(y.substr(I+1,2)==="![")I=bn(y,"]]>",I,"StopNode is not closed.")-2;else{let _=kn(y,I,">");_&&((_&&_.tagName)===R&&_.tagExp[_.tagExp.length-1]!=="/"&&q++,I=_.closeIndex)}}i(jo,"readStopNodeData"),n(jo,"readStopNodeData");function ro(y,R,I){if(R&&typeof y=="string"){let x=y.trim();return x==="true"?!0:x==="false"?!1:vt(y,I)}else return l(y)?y:""}i(ro,"parseValue"),n(ro,"parseValue");function yr(y,R,I){let x=Number.parseInt(y,R);return x>=0&&x<=1114111?String.fromCodePoint(x):I+y+";"}i(yr,"fromCodePoint"),n(yr,"fromCodePoint");function Gn(y,R,I,x){if(y){let q=y(R);I===R&&(I=q),R=q}return R=br(R,x),{tagName:R,tagExp:I}}i(Gn,"transformTagName"),n(Gn,"transformTagName");function br(y,R){if(p.includes(y))throw new Error(`[SECURITY] Invalid name: "${y}" is a reserved JavaScript keyword that could cause prototype pollution`);return d.includes(y)?R.onDangerousProperty(y):y}i(br,"sanitizeName"),n(br,"sanitizeName");var Rn=v.getMetaDataSymbol();function Rr(y,R){if(!y||typeof y!="object")return{};if(!R)return y;let I={};for(let x in y)if(x.startsWith(R)){let q=x.substring(R.length);I[q]=y[x]}else I[x]=y[x];return I}i(Rr,"stripAttributePrefix"),n(Rr,"stripAttributePrefix");function wr(y,R,I){return Co(y,R,I)}i(wr,"prettify"),n(wr,"prettify");function Co(y,R,I){let x,q={};for(let _=0;_<y.length;_++){let re=y[_],ee=ti(re);if(ee!==void 0&&ee!==R.textNodeName){let B=Rr(re[":@"]||{},R.attributeNamePrefix);I.push(ee,B)}if(ee===R.textNodeName)x===void 0?x=re[ee]:x+=""+re[ee];else{if(ee===void 0)continue;if(re[ee]){let B=Co(re[ee],R,I),Se=Ho(B,R);if(re[":@"]?Sr(B,re[":@"],I,R):Object.keys(B).length===1&&B[R.textNodeName]!==void 0&&!R.alwaysCreateTextNode?B=B[R.textNodeName]:Object.keys(B).length===0&&(R.alwaysCreateTextNode?B[R.textNodeName]="":B=""),re[Rn]!==void 0&&typeof B=="object"&&B!==null&&(B[Rn]=re[Rn]),q[ee]!==void 0&&Object.prototype.hasOwnProperty.call(q,ee))Array.isArray(q[ee])||(q[ee]=[q[ee]]),q[ee].push(B);else{let Ee=R.jPath?I.toString():I;R.isArray(ee,Ee,Se)?q[ee]=[B]:q[ee]=B}ee!==void 0&&ee!==R.textNodeName&&I.pop()}}}return typeof x=="string"?x.length>0&&(q[R.textNodeName]=x):x!==void 0&&(q[R.textNodeName]=x),q}i(Co,"compress"),n(Co,"compress");function ti(y){let R=Object.keys(y);for(let I=0;I<R.length;I++){let x=R[I];if(x!==":@")return x}}i(ti,"propName"),n(ti,"propName");function Sr(y,R,I,x){if(R){let q=Object.keys(R),_=q.length;for(let re=0;re<_;re++){let ee=q[re],B=ee.startsWith(x.attributeNamePrefix)?ee.substring(x.attributeNamePrefix.length):ee,Se=x.jPath?I.toString()+"."+B:I;x.isArray(ee,Se,!0,!0)?y[ee]=[R[ee]]:y[ee]=R[ee]}}}i(Sr,"assignAttributes"),n(Sr,"assignAttributes");function Ho(y,R){let{textNodeName:I}=R,x=Object.keys(y).length;return!!(x===0||x===1&&(y[I]||typeof y[I]=="boolean"||y[I]===0))}i(Ho,"isLeafTag"),n(Ho,"isLeafTag");var ni={allowBooleanAttributes:!1,unpairedTags:[]};function Cr(y,R){R=Object.assign({},ni,R);let I=[],x=!1,q=!1;y[0]==="\uFEFF"&&(y=y.substr(1));for(let _=0;_<y.length;_++)if(y[_]==="<"&&y[_+1]==="?"){if(_+=2,_=Kt(y,_),_.err)return _}else if(y[_]==="<"){let re=_;if(_++,y[_]==="!"){_=vr(y,_);continue}else{let ee=!1;y[_]==="/"&&(ee=!0,_++);let B="";for(;_<y.length&&y[_]!==">"&&y[_]!==" "&&y[_]!==" "&&y[_]!==`
|
|
271
271
|
`&&y[_]!=="\r";_++)B+=y[_];if(B=B.trim(),B[B.length-1]==="/"&&(B=B.substring(0,B.length-1),_--),!Qi(B)){let je;return B.trim().length===0?je="Invalid space after '<'.":je="Tag '"+B+"' is an invalid name.",at("InvalidTag",je,qt(y,_))}let Se=ri(y,_);if(Se===!1)return at("InvalidAttr","Attributes for '"+B+"' have open quote.",qt(y,_));let Ee=Se.value;if(_=Se.index,Ee[Ee.length-1]==="/"){let je=_-Ee.length;Ee=Ee.substring(0,Ee.length-1);let Rt=Tr(Ee,R);if(Rt===!0)x=!0;else return at(Rt.err.code,Rt.err.msg,qt(y,je+Rt.err.line))}else if(ee)if(Se.tagClosed){if(Ee.trim().length>0)return at("InvalidTag","Closing tag '"+B+"' can't have attributes or invalid starting.",qt(y,re));if(I.length===0)return at("InvalidTag","Closing tag '"+B+"' has not been opened.",qt(y,re));{let je=I.pop();if(B!==je.tagName){let Rt=qt(y,je.tagStartPos);return at("InvalidTag","Expected closing tag '"+je.tagName+"' (opened in line "+Rt.line+", col "+Rt.col+") instead of closing tag '"+B+"'.",qt(y,re))}I.length==0&&(q=!0)}}else return at("InvalidTag","Closing tag '"+B+"' doesn't have proper closing.",qt(y,_));else{let je=Tr(Ee,R);if(je!==!0)return at(je.err.code,je.err.msg,qt(y,_-Ee.length+je.err.line));if(q===!0)return at("InvalidXml","Multiple possible root nodes found.",qt(y,_));R.unpairedTags.indexOf(B)!==-1||I.push({tagName:B,tagStartPos:re}),x=!0}for(_++;_<y.length;_++)if(y[_]==="<")if(y[_+1]==="!"){_++,_=vr(y,_);continue}else if(y[_+1]==="?"){if(_=Kt(y,++_),_.err)return _}else break;else if(y[_]==="&"){let je=si(y,_);if(je==-1)return at("InvalidChar","char '&' is not expected.",qt(y,_));_=je}else if(q===!0&&!Go(y[_]))return at("InvalidXml","Extra text at the end",qt(y,_));y[_]==="<"&&_--}}else{if(Go(y[_]))continue;return at("InvalidChar","char '"+y[_]+"' is not expected.",qt(y,_))}if(x){if(I.length==1)return at("InvalidTag","Unclosed tag '"+I[0].tagName+"'.",qt(y,I[0].tagStartPos));if(I.length>0)return at("InvalidXml","Invalid '"+JSON.stringify(I.map(_=>_.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return at("InvalidXml","Start tag expected.",1);return!0}i(Cr,"validate"),n(Cr,"validate");function Go(y){return y===" "||y===" "||y===`
|
|
272
272
|
`||y==="\r"}i(Go,"isWhiteSpace"),n(Go,"isWhiteSpace");function Kt(y,R){let I=R;for(;R<y.length;R++)if(y[R]=="?"||y[R]==" "){let x=y.substr(I,R-I);if(R>5&&x==="xml")return at("InvalidXml","XML declaration allowed only at the start of the document.",qt(y,R));if(y[R]=="?"&&y[R+1]==">"){R++;break}else continue}return R}i(Kt,"readPI"),n(Kt,"readPI");function vr(y,R){if(y.length>R+5&&y[R+1]==="-"&&y[R+2]==="-"){for(R+=3;R<y.length;R++)if(y[R]==="-"&&y[R+1]==="-"&&y[R+2]===">"){R+=2;break}}else if(y.length>R+8&&y[R+1]==="D"&&y[R+2]==="O"&&y[R+3]==="C"&&y[R+4]==="T"&&y[R+5]==="Y"&&y[R+6]==="P"&&y[R+7]==="E"){let I=1;for(R+=8;R<y.length;R++)if(y[R]==="<")I++;else if(y[R]===">"&&(I--,I===0))break}else if(y.length>R+9&&y[R+1]==="["&&y[R+2]==="C"&&y[R+3]==="D"&&y[R+4]==="A"&&y[R+5]==="T"&&y[R+6]==="A"&&y[R+7]==="["){for(R+=8;R<y.length;R++)if(y[R]==="]"&&y[R+1]==="]"&&y[R+2]===">"){R+=2;break}}return R}i(vr,"readCommentAndCDATA"),n(vr,"readCommentAndCDATA");var ya='"',oi="'";function ri(y,R){let I="",x="",q=!1;for(;R<y.length;R++){if(y[R]===ya||y[R]===oi)x===""?x=y[R]:x!==y[R]||(x="");else if(y[R]===">"&&x===""){q=!0;break}I+=y[R]}return x!==""?!1:{value:I,index:R,tagClosed:q}}i(ri,"readAttributeStr"),n(ri,"readAttributeStr");var Yi=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Tr(y,R){let I=c(y,Yi),x={};for(let q=0;q<I.length;q++){if(I[q][1].length===0)return at("InvalidAttr","Attribute '"+I[q][2]+"' has no space in starting.",_n(I[q]));if(I[q][3]!==void 0&&I[q][4]===void 0)return at("InvalidAttr","Attribute '"+I[q][2]+"' is without value.",_n(I[q]));if(I[q][3]===void 0&&!R.allowBooleanAttributes)return at("InvalidAttr","boolean attribute '"+I[q][2]+"' is not allowed.",_n(I[q]));let _=I[q][2];if(!ai(_))return at("InvalidAttr","Attribute '"+_+"' is an invalid name.",_n(I[q]));if(!Object.prototype.hasOwnProperty.call(x,_))x[_]=1;else return at("InvalidAttr","Attribute '"+_+"' is repeated.",_n(I[q]))}return!0}i(Tr,"validateAttributeString"),n(Tr,"validateAttributeString");function ii(y,R){let I=/\d/;for(y[R]==="x"&&(R++,I=/[\da-fA-F]/);R<y.length;R++){if(y[R]===";")return R;if(!y[R].match(I))break}return-1}i(ii,"validateNumberAmpersand"),n(ii,"validateNumberAmpersand");function si(y,R){if(R++,y[R]===";")return-1;if(y[R]==="#")return R++,ii(y,R);let I=0;for(;R<y.length;R++,I++)if(!(y[R].match(/\w/)&&I<20)){if(y[R]===";")break;return-1}return R}i(si,"validateAmpersand"),n(si,"validateAmpersand");function at(y,R,I){return{err:{code:y,msg:R,line:I.line||I,col:I.col}}}i(at,"getErrorObject"),n(at,"getErrorObject");function ai(y){return u(y)}i(ai,"validateAttrName"),n(ai,"validateAttrName");function Qi(y){return u(y)}i(Qi,"validateTagName"),n(Qi,"validateTagName");function qt(y,R){let I=y.substring(0,R).split(/\r?\n/);return{line:I.length,col:I[I.length-1].length+1}}i(qt,"getLineNumberForPosition"),n(qt,"getLineNumberForPosition");function _n(y){return y.startIndex+y[1].length}i(_n,"getPositionFromMatch"),n(_n,"getPositionFromMatch");var Xi=class{static{i(this,"XMLParser")}static{n(this,"XMLParser")}constructor(y){this.externalEntities={},this.options=b(y)}parse(y,R){if(typeof y!="string"&&y.toString)y=y.toString();else if(typeof y!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(R){R===!0&&(R={});let q=Cr(y,R);if(q!==!0)throw Error(`${q.err.msg}:${q.err.line}:${q.err.col}`)}let I=new we(this.options);I.addExternalEntities(this.externalEntities);let x=I.parseXml(y);return this.options.preserveOrder||x===void 0?x:wr(x,this.options,I.matcher)}addEntity(y,R){if(R.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(y.indexOf("&")!==-1||y.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(R==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[y]=R}static getMetaDataSymbol(){return v.getMetaDataSymbol()}};return new Xi(t)},"getXmlParser");var XE=class extends To{static{i(this,"XmlToJsonOutboundPolicy")}static policyType="xml-to-json";parser;parseOnStatusCodes;constructor(e,n){let o=Ro(e,["textNodeName"]);super(o,n),Ke(this.options,this.policyName).optional("removeNSPrefix","boolean").optional("ignoreProcessingInstructions","boolean").optional("ignoreDeclarations","boolean").optional("ignoreAttributes","boolean").optional("stopNodes","array").optional("attributeNamePrefix","string").optional("textNodeName","string").optional("trimValues","boolean"),this.parseOnStatusCodes=o.parseOnStatusCodes?Yo(o.parseOnStatusCodes):void 0,this.parser=bB({removeNSPrefix:o?.removeNSPrefix??!0,ignorePiTags:o?.ignoreProcessingInstructions??!0,ignoreDeclaration:o?.ignoreDeclarations??!0,ignoreAttributes:o?.ignoreAttributes??!0,stopNodes:o?.stopNodes??[],attributeNamePrefix:o?.attributeNamePrefix??"@_",textNodeName:o?.textNodeName??"#text",trimValues:o?.trimValues??!0,processEntities:{enabled:!0,maxTotalExpansions:1/0,maxEntityCount:1e3}})}async handler(e,n,o){if(this.parseOnStatusCodes&&!this.parseOnStatusCodes.includes(e.status))return e;let r;try{let c=await e.text();r=this.parser.parse(c)}catch(c){let u=`XmlToJsonOutboundPolicy - Error parsing XML contents in policy '${this.policyName}'.`;throw o.log.error(u,c),new Z(u)}let s=new Headers(e.headers);return s.set("content-type","application/json"),new Response(JSON.stringify(r),{status:e.status,statusText:e.statusText,headers:s})}};var Qb=/(?:^|[?&;])([^=&#;?\s"'<>]+)=/g,RB=/[&#\s"'<>]/g;function dae(t,e,n){let o="",r=0;Qb.lastIndex=0;for(let s=Qb.exec(t);s!==null;s=Qb.exec(t)){if(!e.has(pae(s[1]).toLowerCase()))continue;let a=s.index+s[0].length;RB.lastIndex=a;let c=RB.exec(t)?.index??t.length;o+=t.slice(r,a)+n,r=c,Qb.lastIndex=c}return r===0?t:o+t.slice(r)}i(dae,"redactQueryParameters");function pae(t){let e=t.replaceAll("+"," ");try{return decodeURIComponent(e)}catch{return e}}i(pae,"decodeQueryName");var mae=.5;function fae(t){let e=t.replacement??"[REDACTED]";if(typeof e!="string")throw new T("createRedactor: 'replacement' must be a string.");let n=t.minConfidence??mae;if(typeof n!="number"||!(n>=0&&n<=1))throw new T("createRedactor: 'minConfidence' must be a number from 0 to 1.");let o=t.entities??[],{unknown:r}=mm(o);if(r.length>0)throw new T(`createRedactor: unknown entities ${JSON.stringify(r)}. Use a Data Loss Prevention recognizer id, group or id prefix.`);let s=[],a=Wy({entities:o,customPatterns:t.customPatterns},{warn:i(p=>{s.push(String(p?.name))},"warn")});if(s.length>0)throw new T(`createRedactor: custom patterns ${JSON.stringify(s)} are not valid regular expressions.`);let c=t.allowValues,u=new Set((t.fieldNames??[]).map(p=>p.toLowerCase())),l=new Set((t.queryParameters??[]).map(p=>p.toLowerCase())),d=encodeURIComponent(e);return(p,f)=>{if(u.size>0&&f.keys.some(g=>u.has(g.toLowerCase())))return e;let h=p;if(l.size>0&&h.includes("=")&&(h=dae(h,l,d)),a.length>0){let{matches:g}=ur(h,a,n,c);h=Yy(h,g,e)}return h}}i(fae,"createRedactor");var eP=class{static{i(this,"ServiceProviderImpl")}services=new Map;addService(e,n){if(this.services.get(e))throw new $e(`A service with the name ${e} already exists -- you cannot have duplicate services`);this.services.set(e,n)}getService(e){return this.services.get(e)}};var tP=class{static{i(this,"ApiKeyConsumerClient")}bucketId;cacheDurationSeconds;cacheNamePromise;constructor(e){this.bucketId=e?.bucketId,this.cacheDurationSeconds=e?.cacheDurationSeconds??60}getCacheName(e){return this.cacheNamePromise||(this.cacheNamePromise=Qe("zuplo-get-consumer",{bucketId:e})),this.cacheNamePromise}async get(e){me("utility.get-consumer");let n=ws(),o=this.bucketId??Xe.ZUPLO_SERVICE_BUCKET_ID;if(!o)throw new T("ApiKeyConsumerClient - no bucketId provided and no default bucket is configured for this environment. Pass `bucketId` explicitly (find it in the Zuplo portal under Settings > API Key Buckets).");if(!o.startsWith("bckt_"))throw new T(`ApiKeyConsumerClient - bucketId "${o}" is not a valid bucket id. Bucket ids start with "bckt_" (e.g. "bckt_..."); a bucket name (e.g. "zprj-...-working-copy") is not accepted here. Find the bucket id in the Zuplo portal under Settings > API Key Buckets.`);if(!e||e.trim()==="")throw new T("ApiKeyConsumerClient.get - consumerId is required and cannot be empty");let r=await this.getCacheName(o),s=new et(r,n);if(this.cacheDurationSeconds>0){let l=await s.get(e);if(l)return l}let a=`/v2/key-auth/${encodeURIComponent(o)}/consumers/${encodeURIComponent(e)}`,c=await DR(a),u={id:c.id,name:c.name,createdOn:c.createdOn,updatedOn:c.updatedOn};return c.description!==void 0&&(u.description=c.description),c.metadata!==void 0&&(u.metadata=c.metadata),this.cacheDurationSeconds>0&&s.put(e,u,this.cacheDurationSeconds),u}};var wB=10,SB=3e4,om=class{static{i(this,"BackgroundLoader")}#e=new Map;#t;#o;#n;#r;#i;#s={};constructor(e,n){if(typeof n=="number"){let o=n;this.#o=o*1e3,this.#r=SB,this.#n=wB,this.#i=Number.POSITIVE_INFINITY}else{let o=n;this.#o=o.ttlSeconds*1e3,this.#r=o.loaderTimeoutSeconds?o.loaderTimeoutSeconds*1e3:SB,this.#n=wB,this.#i=o.staleIfErrorSeconds===void 0?Number.POSITIVE_INFINITY:o.staleIfErrorSeconds*1e3}this.#t=e}#a(e){return e.expiry<=new Date}#c(e){let n=this.#s[e];return!(n===void 0||n===0)}#u(e){let n=this.#e.get(e);if(n&&!this.#a(n))return n.data}async get(e){let n=this.#u(e);if(n)return this.#d(e),n;if(this.#c(e))try{await hae(()=>this.#u(e)!==void 0||!this.#c(e),this.#r+this.#n+1,this.#n);let o=this.#u(e);if(o)return o}catch{}try{return await this.#l(e)}catch(o){let r=this.#e.get(e);if(r&&!this.#p(r))return r.data;throw o}}#p(e){return this.#i===Number.POSITIVE_INFINITY?!1:this.#i<=0?!0:Date.now()>e.expiry.getTime()+this.#i}#d(e){if(!this.#c(e)){let n=this.#l(e);fi().waitUntil(n)}}async#l(e){try{this.#s[e]===void 0&&(this.#s[e]=0),this.#s[e]++;let n=await Promise.race([this.#t(e),scheduler.wait(this.#r)]);if(n===void 0)throw new T(`BackgroundLoader: Loader timed out after ${this.#r} ms.`);return this.#e.set(e,{data:n,expiry:new Date(Date.now()+this.#o)}),n}finally{this.#s[e]--}}};async function hae(t,e,n){let o=Date.now();for(;!t();){let r=Date.now()-o;if(r>e)throw new T(`BackgroundLoader: Timeout waiting for an on-going loader after ${r} ms.`);await scheduler.wait(n)}}i(hae,"waitUntilTrue");import{trace as gae}from"@opentelemetry/api";var CB,vB=i(()=>(CB??=gae.getTracer("pipeline"),CB),"tracer"),TB=i(async(t,e,n)=>{let o=tt.instance.routeData.policies,r=Ja([t],o);if(r.length===0)throw new Z(`Invalid 'invokeInboundPolicy call' - no policy '${t}' found.`);let s=r[0],a;try{a=nt.getContextExtensions(n)}catch{a=void 0}let c=a?.currentPolicyName;a&&(a.currentPolicyName=s.policyName);try{return await vB().startActiveSpan(`policy:${s.policyName}`,async l=>{try{Va(l,s);let d=await s.handler(e,n);if(d instanceof Request||d instanceof Ge||d instanceof Response)return d instanceof Response||d instanceof Ge?d:new Ge(d);throw new T(`Invalid state - invalid handler on policy '${s.policyName}' invoked via 'invokeInboundPolicy' on route '${n.route.path}'. The result of an inbound policy must be a Response or Request.`)}catch(d){throw Wo(l,d),d}finally{l.end()}})}finally{a&&a.currentPolicyName===s.policyName&&(a.currentPolicyName=c)}},"invokeInboundPolicy"),AB=i(async(t,e,n,o)=>{let r=tt.instance.routeData.policies,s=ml([t],r);if(s.length===0)throw new Z(`Invalid 'invokeOutboundPolicy call' - no policy '${t}' found.`);let a=s[0];return await vB().startActiveSpan(`policy:${a.policyName}`,async u=>{try{Va(u,a);let l=await a.handler(e,n,o);if(l instanceof Response)return l;throw new T(`Invalid state - invalid handler on policy '${a.policyName}' invoked via 'invokeOutboundPolicy' on route '${o.route.path}. The result of an outbound policy must be a Response.`)}catch(l){throw Wo(u,l),l}finally{u.end()}})},"invokeOutboundPolicy");var gt=class{static{i(this,"BaseAnalyticsEvent")}eventId;requestId;timestamp;accountName;projectName;deploymentName;unit;value;constructor(e){this.eventId=e.eventId,this.requestId=e.requestId,this.timestamp=e.timestamp??new Date,this.accountName=e.accountName,this.projectName=e.projectName,this.deploymentName=e.deploymentName,this.unit=e.unit,this.value=e.value}};var Xb=class extends gt{static{i(this,"AiGatewayBlockedCountEvent")}eventType=$.AI_GATEWAY_BLOCKED_COUNT;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.type||!this.metadata.type.trim())&&(this.metadata.type="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var eR=class extends gt{static{i(this,"AiGatewayCostSumEvent")}eventType=$.AI_GATEWAY_COST_SUM;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.model||!this.metadata.model.trim())&&(this.metadata.model="unknown"),(!this.metadata.provider||!this.metadata.provider.trim())&&(this.metadata.provider="unknown"),(!this.metadata.label||!this.metadata.label.trim())&&(this.metadata.label="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown"),(!this.metadata.costSource||!this.metadata.costSource.trim())&&(this.metadata.costSource="unknown"),(!this.metadata.costAccuracy||!this.metadata.costAccuracy.trim())&&(this.metadata.costAccuracy="unknown")}};var tR=class extends gt{static{i(this,"AiGatewayFallbackCountEvent")}eventType=$.AI_GATEWAY_FALLBACK_COUNT;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.type||!this.metadata.type.trim())&&(this.metadata.type="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var nR=class extends gt{static{i(this,"AiGatewayLatencyHistogramEvent")}eventType=$.AI_GATEWAY_LATENCY_HISTOGRAM;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.model||!this.metadata.model.trim())&&(this.metadata.model="unknown"),(!this.metadata.provider||!this.metadata.provider.trim())&&(this.metadata.provider="unknown"),(!this.metadata.label||!this.metadata.label.trim())&&(this.metadata.label="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var oR=class extends gt{static{i(this,"AiGatewayRequestCountEvent")}eventType=$.AI_GATEWAY_REQUEST_COUNT;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.model||!this.metadata.model.trim())&&(this.metadata.model="unknown"),(!this.metadata.provider||!this.metadata.provider.trim())&&(this.metadata.provider="unknown"),(!this.metadata.label||!this.metadata.label.trim())&&(this.metadata.label="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var rR=class extends gt{static{i(this,"AiGatewayTokenSumEvent")}eventType=$.AI_GATEWAY_TOKEN_SUM;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.model||!this.metadata.model.trim())&&(this.metadata.model="unknown"),(!this.metadata.provider||!this.metadata.provider.trim())&&(this.metadata.provider="unknown"),(!this.metadata.label||!this.metadata.label.trim())&&(this.metadata.label="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var iR=class extends gt{static{i(this,"AiGatewayWarningCountEvent")}eventType=$.AI_GATEWAY_WARNING_COUNT;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.type||!this.metadata.type.trim())&&(this.metadata.type="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var sR=class extends gt{static{i(this,"CacheOperationEvent")}eventType=$.CACHE_OPERATION;metadata;constructor(e){super(e),this.metadata=e.metadata}};var aR=class extends gt{static{i(this,"GraphqlOperationEvent")}eventType=$.GRAPHQL_OPERATION;metadata;constructor(e){super(e),this.metadata=e.metadata}};var cR=class extends gt{static{i(this,"HandlerExecutionEvent")}eventType=$.HANDLER_EXECUTION;metadata;constructor(e){super(e),this.metadata=e.metadata}};var uR=class extends gt{static{i(this,"McpEvent")}eventType;metadata;constructor(e){super(e),this.eventType=e.eventType,this.metadata=e.metadata}};var lR=class extends gt{static{i(this,"RateLimitServiceCallEvent")}eventType=$.RATE_LIMIT_SERVICE_CALL;metadata;constructor(e){super(e),this.metadata=e.metadata}};var yt=i(t=>e=>new uR({...e,eventType:t}),"buildMcpEvent"),yae={[$.AI_GATEWAY_COST_SUM]:t=>new eR(t),[$.AI_GATEWAY_REQUEST_COUNT]:t=>new oR(t),[$.AI_GATEWAY_TOKEN_SUM]:t=>new rR(t),[$.AI_GATEWAY_LATENCY_HISTOGRAM]:t=>new nR(t),[$.AI_GATEWAY_WARNING_COUNT]:t=>new iR(t),[$.AI_GATEWAY_BLOCKED_COUNT]:t=>new Xb(t),[$.AI_GATEWAY_FALLBACK_COUNT]:t=>new tR(t),[$.MCP_REQUEST_RECEIVED]:yt($.MCP_REQUEST_RECEIVED),[$.MCP_REQUEST_COMPLETED]:yt($.MCP_REQUEST_COMPLETED),[$.MCP_REQUEST_REJECTED]:yt($.MCP_REQUEST_REJECTED),[$.MCP_INITIALIZE_NEGOTIATED]:yt($.MCP_INITIALIZE_NEGOTIATED),[$.MCP_CLIENT_UNSUPPORTED_BEHAVIOR]:yt($.MCP_CLIENT_UNSUPPORTED_BEHAVIOR),[$.MCP_CAPABILITY_LISTED]:yt($.MCP_CAPABILITY_LISTED),[$.MCP_CAPABILITY_INVOKED]:yt($.MCP_CAPABILITY_INVOKED),[$.MCP_CAPABILITY_COMPLETED]:yt($.MCP_CAPABILITY_COMPLETED),[$.MCP_CAPABILITY_FAILED]:yt($.MCP_CAPABILITY_FAILED),[$.MCP_CAPABILITY_CONNECT_REQUIRED]:yt($.MCP_CAPABILITY_CONNECT_REQUIRED),[$.MCP_AUTH_DOWNSTREAM_TOKEN_VALIDATED]:yt($.MCP_AUTH_DOWNSTREAM_TOKEN_VALIDATED),[$.MCP_AUTH_DOWNSTREAM_TOKEN_REJECTED]:yt($.MCP_AUTH_DOWNSTREAM_TOKEN_REJECTED),[$.MCP_OAUTH_CLIENT_REGISTERED]:yt($.MCP_OAUTH_CLIENT_REGISTERED),[$.MCP_OAUTH_AUTHORIZE_STARTED]:yt($.MCP_OAUTH_AUTHORIZE_STARTED),[$.MCP_OAUTH_AUTHORIZE_AWAITING_SETUP]:yt($.MCP_OAUTH_AUTHORIZE_AWAITING_SETUP),[$.MCP_OAUTH_TOKEN_ISSUED]:yt($.MCP_OAUTH_TOKEN_ISSUED),[$.MCP_OAUTH_TOKEN_REFRESH_ROTATED]:yt($.MCP_OAUTH_TOKEN_REFRESH_ROTATED),[$.MCP_OAUTH_TOKEN_REVOKED]:yt($.MCP_OAUTH_TOKEN_REVOKED),[$.MCP_AUTH_UPSTREAM_CONNECT_REQUIRED]:yt($.MCP_AUTH_UPSTREAM_CONNECT_REQUIRED),[$.MCP_AUTH_UPSTREAM_CONNECT_STARTED]:yt($.MCP_AUTH_UPSTREAM_CONNECT_STARTED),[$.MCP_AUTH_UPSTREAM_CALLBACK_RECEIVED]:yt($.MCP_AUTH_UPSTREAM_CALLBACK_RECEIVED),[$.MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_SUCCEEDED]:yt($.MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_SUCCEEDED),[$.MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_FAILED]:yt($.MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_FAILED),[$.MCP_AUTH_UPSTREAM_CREDENTIAL_RESOLVED]:yt($.MCP_AUTH_UPSTREAM_CREDENTIAL_RESOLVED),[$.MCP_AUTH_UPSTREAM_CREDENTIAL_MISSING]:yt($.MCP_AUTH_UPSTREAM_CREDENTIAL_MISSING),[$.MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED]:yt($.MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED),[$.GRAPHQL_OPERATION]:t=>new aR(t),[$.CACHE_OPERATION]:t=>new sR(t),[$.HANDLER_EXECUTION]:t=>new cR(t),[$.RATE_LIMIT_SERVICE_CALL]:t=>new lR(t)};function IB(t,e){let n=yae[t];return n(e)}i(IB,"createAnalyticsEvent");var dR=class{static{i(this,"ZuploGatewayAnalyticsContext")}#e;#t;constructor(e){this.#e=[],this.#t=e}addAnalyticsEvent(e,n,o,r,s){let a=this.createAnalyticsEvent(e,n,o,r,s);this.#e.push(a)}flushAnalyticsEvents(){let e=[...this.#e];return this.#e.length=0,e}getAnalyticsEvents(){return[...this.#e]}createAnalyticsEvent(e,n,o,r,s){return IB(n,{eventId:s??crypto.randomUUID(),requestId:this.#t,accountName:k.instance.accountName??"unknown",projectName:k.instance.projectName??"unknown",deploymentName:k.instance.deploymentName??"unknown",metadata:o,unit:r,value:e})}};var bae="127.0.0.1";function EB(t){let e=k.instance,n=t.get(e.trustedIpHeader)?.trim();return n||(e.isLocalDevelopment?bae:void 0)}i(EB,"resolveClientIp");function Rae(t){let e={};if(!t)return e;try{let n=t.split(","),o={};return n.forEach(r=>{let[s,a]=r.split("=");s&&a&&(o[s.trim()]=a.trim())}),o.asnum&&(e[nf]=o.asnum),o.zip&&(e[of]=o.zip.split("+")[0]),o.dma&&(e[rf]=o.dma),o.region_code&&(e[sf]=o.region_code),o.timezone&&(e[af]=o.timezone),o.city&&(e[Ym]=o.city),o.continent&&(e[Qm]=o.continent),o.country_code&&(e[Xm]=o.country_code),o.long&&(e[ef]=o.long),o.lat&&(e[tf]=o.lat),e}catch{return{}}}i(Rae,"parseEdgeScapeHeader");function PB(t,e){let n=Rae(e);for(let[o,r]of Object.entries(n))t.has(o)||t.set(o,r)}i(PB,"setZpHeadersFromAkamaiEdgeScapeHeader");var Ka=class{static{i(this,"HeaderIncomingRequestProperties")}#e;constructor(e){this.#e=e;let n=e.get(MP);if(n){let o=new Headers(e);PB(o,n),this.#e=o}}detachFromRequest(){this.#e=Ti(this.#e)}get ip(){return EB(this.#e)}get asn(){try{let e=this.#e.get(nf);if(typeof e=="string")return parseInt(e,10)}catch{}}get asOrganization(){return this.#e.get(EP)??void 0}get city(){return this.#e.get(cP)??this.#e.get(Ym)??void 0}get continent(){return this.#e.get(uP)??this.#e.get(Qm)??void 0}get country(){return this.#e.get(lP)??this.#e.get(Xm)??void 0}get latitude(){return this.#e.get(pP)??this.#e.get(tf)??void 0}get longitude(){return this.#e.get(dP)??this.#e.get(ef)??void 0}get colo(){return this.#e.get(PP)??void 0}get postalCode(){return this.#e.get(gP)??this.#e.get(of)??void 0}get metroCode(){return this.#e.get(hP)??this.#e.get(rf)??void 0}get region(){return this.#e.get(mP)??this.#e.get(kP)??void 0}get regionCode(){return this.#e.get(fP)??this.#e.get(sf)??void 0}get timezone(){return this.#e.get(yP)??this.#e.get(af)??void 0}get httpProtocol(){return this.#e.get(_P)??void 0}get clientCert(){return this.#e.get(RP)??void 0}get clientMtlsVerificationStatus(){return this.#e.get(wP)??void 0}get clientMtlsVerificationReason(){return this.#e.get(SP)??void 0}get clientCertFingerprintSha256(){return this.#e.get(CP)??void 0}get clientCertNotBefore(){return this.#e.get(vP)??void 0}get clientCertNotAfter(){return this.#e.get(TP)??void 0}get clientCertIssuerDn(){return this.#e.get(AP)??void 0}get clientCertSubjectDn(){return this.#e.get(IP)??void 0}toJSON(){return{ip:this.ip,asn:this.asn,asOrganization:this.asOrganization,city:this.city,continent:this.continent,country:this.country,latitude:this.latitude,longitude:this.longitude,colo:this.colo,postalCode:this.postalCode,metroCode:this.metroCode,region:this.region,regionCode:this.regionCode,timezone:this.timezone,httpProtocol:this.httpProtocol,clientCert:this.clientCert,clientMtlsVerificationStatus:this.clientMtlsVerificationStatus,clientMtlsVerificationReason:this.clientMtlsVerificationReason,clientCertFingerprintSha256:this.clientCertFingerprintSha256,clientCertNotBefore:this.clientCertNotBefore,clientCertNotAfter:this.clientCertNotAfter,clientCertIssuerDn:this.clientCertIssuerDn,clientCertSubjectDn:this.clientCertSubjectDn}}};function su(t){return{contextId:t.contextId,incomingRequestProperties:t.incomingRequestProperties,requestId:t.requestId,route:t.route,custom:t.custom,parentContext:t.parentContext,analyticsContext:t.analyticsContext}}i(su,"createRewriteContext");var ol=class extends Event{static{i(this,"ResponseSendingEvent")}constructor(e,n){super("responseSending"),this.request=e,this.mutableResponse=n}request;mutableResponse},rl=class extends Event{static{i(this,"ResponseSentEvent")}constructor(e,n){super("responseSent"),this.request=e,this.response=n}request;response},wae=Object.freeze([]),nt=class t{static{i(this,"ZuploContextExtensions")}static#e=new WeakMap;static initialize(e,n,o=n.url){if(!t.#e.has(e)){let r=new t(n,o);return t.#e.set(e,r),r}throw new Error(`ZuploContextExtensions already initialized for context with requestId '${e.requestId}'`)}static findContextExtensions(e){return t.#e.get(e)}static getContextExtensions(e){let n=t.#e.get(e);if(!n)throw new Z(`Invalid state, could not get ZuploContext extensions for context with requestId '${e.requestId}'`);return n}latestRequest;originalRequest;receivedUrl;requestLogProperties=new Map;systemRequestLogProperties=new Map;#t;startDeferringMetrics(){return this.#t?!1:(this.#t=[],!0)}deferMetrics(e){return this.#t?(this.#t.push(e),!0):!1}flushDeferredMetrics(){let e=this.#t??[];this.#t=void 0;let n=[];for(let o of e)try{o()}catch(r){n.push(r)}return n}#o;#n=!1;addPipelineExitHook(e){if(this.#n){try{e(void 0)}catch(n){W.console.error("Error running a late pipeline exit hook",n)}return}this.#o??=[],this.#o.push(e)}runPipelineExitHooks(e){this.#n=!0;let n=this.#o;if(!n)return wae;this.#o=void 0;let o=[];for(let r of n)try{r(e)}catch(s){o.push(s)}return o}auditLogEventId="";preRequestState;currentPolicyName;preRequestPhase;#r;#i;#s;constructor(e,n){this.latestRequest=e,this.originalRequest=e.originalRequest,this.receivedUrl=n,this.preRequestState=void 0,this.currentPolicyName=void 0,this.preRequestPhase=void 0,this.#r=[],this.#i=[],this.#s=[]}addResponseSendingHook(e){this.#i.push(e)}addResponseSendingFinalHook(e){this.#r.push(e)}addHandlerResponseHook(e){this.#s.push(e)}onResponseSendingFinal=i(async(e,n,o)=>{for(let r of this.#r)await r(e,n,o)},"onResponseSendingFinal");onResponseSending=i(async(e,n,o)=>{let r=e,s=k.instance.build.COMPATIBILITY_FLAGS.chainResponseSendingHooks;for(let a of this.#i)r=await a(s?r:e,n,o);return r},"onResponseSending");onHandlerResponse=i(async(e,n,o)=>{for(let r of this.#s)await r(e,n,o)},"onHandlerResponse")},ph=class extends EventTarget{static{i(this,"SystemZuploContext")}constructor({logger:e,route:n,requestId:o,event:r,custom:s,incomingRequestProperties:a,parentContext:c}){super(),this.log=Object.freeze(e),this.route=n,this.requestId=o,this.custom=s,this.incomingRequestProperties=a,this.parentContext=c,this.#e=r,this.invokeInboundPolicy=(u,l)=>TB(u,l,this),this.contextId=crypto.randomUUID(),this.invokeOutboundPolicy=(u,l,d)=>AB(u,l,d,this),this.invokeRoute=async(u,l)=>{let d=u;typeof u=="string"&&u.startsWith("/")&&(d=new URL(u,"http://localhost"));let p=new Ge(d,l);return tt.instance.handleRequest(p,this,{parentContext:this,routeBinding:fO(l)})},this.waitUntil=u=>{this.#e.waitUntil(u)},this.addResponseSendingHook=u=>{nt.getContextExtensions(this).addResponseSendingHook(u)},this.addResponseSendingFinalHook=u=>{nt.getContextExtensions(this).addResponseSendingFinalHook(u)},this.addPreRequestHandler=(u,l)=>{kx(this,nt.getContextExtensions(this),u,l)},this.analyticsContext=new dR(o),Object.freeze(this)}#e;#t=new EventTarget;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;invokeInboundPolicy;invokeOutboundPolicy;invokeRoute;waitUntil;addResponseSendingHook;addResponseSendingFinalHook;addPreRequestHandler;addEventListener(e,n,o){me("context.addEventListener");let r=i(s=>{try{typeof n=="function"?n(s):n.handleEvent(s)}catch(a){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),a}},"wrapped");this.#t.addEventListener(e,r,o)}removeEventListener(e,n,o){me("context.removeEventListener"),this.#t.removeEventListener(e,n,o)}dispatchEvent(e){return this.#t.dispatchEvent(e)}};export{Xe as a,le as b,NR as c,Cn as d,Wt as e,Bu as f,pZ as g,qR as h,ut as i,Ma as j,mZ as k,ms as l,$R as m,DR as n,jR as o,_f as p,y_ as q,ile as r,sle as s,xf as t,lle as u,dle as v,ple as w,QZ as x,mle as y,Ln as z,Er as A,Na as B,fs as C,V as D,Dt as E,hs as F,$ as G,HR as H,GR as I,vf as J,Be as K,Dn as L,bi as M,he as N,To as O,kx as P,Bx as Q,VR as R,QR as S,$Z as T,wi as U,dR as V,su as W,ol as X,rl as Y,nt as Z,Yw as _,Kn as $,MM as aa,b0 as ba,v0 as ca,$W as da,k0 as ea,$S as fa,VW as ga,Os as ha,zn as ia,mo as ja,Ms as ka,nr as la,or as ma,Ui as na,Ns as oa,Mr as pa,Ot as qa,hg as ra,bc as sa,Rc as ta,Gl as ua,Fl as va,wc as wa,ln as xa,qi as ya,Mt as za,Tn as Aa,fn as Ba,Sc as Ca,Lt as Da,Lr as Ea,Cc as Fa,vc as Ga,Us as Ha,qs as Ia,$i as Ja,gg as Ka,Tc as La,Bl as Ma,Ac as Na,Zl as Oa,Nr as Pa,tr as Qa,ko as Ra,yg as Sa,bg as Ta,Vl as Ua,Jl as Va,Ic as Wa,Ec as Xa,Kl as Ya,Wl as Za,Yl as _a,Ql as $a,Pc as ab,Xl as bb,ed as cb,kc as db,td as eb,Ur as fb,qr as gb,_c as hb,xc as ib,Oc as jb,$r as kb,fo as lb,Mc as mb,nd as nb,od as ob,rd as pb,id as qb,sd as rb,$s as sb,ad as tb,cd as ub,ud as vb,ld as wb,dd as xb,pd as yb,md as zb,fd as Ab,Lc as Bb,hd as Cb,gd as Db,yd as Eb,bd as Fb,Rd as Gb,wd as Hb,Sd as Ib,Cd as Jb,vd as Kb,Td as Lb,Ad as Mb,Id as Nb,Ed as Ob,Pd as Pb,_o as Qb,xo as Rb,Oo as Sb,kd as Tb,Dr as Ub,zr as Vb,Ds as Wb,_d as Xb,xd as Yb,Od as Zb,Md as _b,Ld as $b,Nc as ac,Nd as bc,Ud as cc,Uc as dc,Rg as ec,qd as fc,$d as gc,Dd as hc,jS as ic,jr as jc,zd as kc,jd as lc,Hd as mc,Gd as nc,Fd as oc,Bd as pc,Zd as qc,Vd as rc,Jd as sc,Ni as tc,Kd as uc,Wd as vc,Yd as wc,Qd as xc,Xd as yc,qc as zc,zs as Ac,js as Bc,$c as Cc,Dc,zc as Ec,ep as Fc,jc as Gc,Hc,tp as Ic,np as Jc,Gc as Kc,Hs as Lc,op as Mc,rp as Nc,ip as Oc,sp as Pc,ap as Qc,cp as Rc,up as Sc,lp as Tc,dp as Uc,pp as Vc,mp as Wc,fp as Xc,hp as Yc,gp as Zc,yp as _c,wg as $c,bp as ad,Hr as bd,Sg as cd,Rp as dd,Cg as ed,vg as fd,Tg as gd,Ag as hd,Ig as id,Eg as jd,Pg as kd,kg as ld,_g as md,xg as nd,Og as od,Mg as pd,Lg as qd,Ng as rd,Ug as sd,qg as td,wp as ud,Sp as vd,$g as wd,Dg as xd,zg as yd,jg as zd,Cp as Ad,vp as Bd,Hg as Cd,Gg as Dd,Fg as Ed,Xg as Fd,Np as Gd,oy as Hd,ji as Id,wN as Jd,Vr as Kd,dy as Ld,TN as Md,Fp as Nd,C5 as Od,mU as Pd,x5 as Qd,L5 as Rd,ZC as Sd,gEe as Td,Ry as Ud,yEe as Vd,XC as Wd,W5 as Xd,ev as Yd,ov as Zd,UEe as _d,qEe as $d,YU as ae,Lq as be,Nq as ce,Uq as de,qq as ee,$q as fe,Dq as ge,t9 as he,vv as ie,d9 as je,Tv as ke,Iv as le,Pv as me,xv as ne,Mv as oe,Nv as pe,qv as qe,Dv as re,Hv as se,Bv as te,Jv as ue,Yv as ve,na as we,It as xe,ar as ye,Xv as ze,eT as Ae,Xp as Be,em as Ce,tm as De,sT as Ee,rm as Fe,uT as Ge,lT as He,K9 as Ie,dT as Je,pT as Ke,AT as Le,lu as Me,Fy as Ne,By as Oe,ED as Pe,tb as Qe,yA as Re,SA as Se,cb as Te,IA as Ue,kA as Ve,dz as We,qA as Xe,Uz as Ye,jz as Ze,Hz as _e,GA as $e,Bz as af,mb as bf,Cee as cf,FA as df,In as ef,ej as ff,KA as gf,WA as hf,nj as if,XA as jf,rj as kf,mj as lf,fj as mf,hj as nf,gj as of,yj as pf,bj as qf,sI as rf,Sj as sf,Cj as tf,vj as uf,Tj as vf,Aj as wf,Ij as xf,Ej as yf,Pj as zf,kj as Af,Tb as Bf,_te as Cf,Mj as Df,Nj as Ef,mI as Ff,Fte as Gf,gI as Hf,Bj as If,Ji as Jf,Cu as Kf,it as Lf,kt as Mf,BZe as Nf,pr as Of,t2e as Pf,Em as Qf,i2e as Rf,s2e as Sf,to as Tf,u2e as Uf,l2e as Vf,d2e as Wf,p2e as Xf,m2e as Yf,f2e as Zf,h2e as _f,g2e as $f,Pm as ag,y2e as bg,la as cg,C2e as dg,kb as eg,da as fg,Tu as gg,wI as hg,L2e as ig,SI as jg,CI as kg,vI as lg,TI as mg,AI as ng,II as og,EI as pg,PI as qg,kI as rg,_I as sg,LH as tg,So as ug,no as vg,jt as wg,$H as xg,soe as yg,aoe as zg,xI as Ag,t4e as Bg,n4e as Cg,o4e as Dg,n1 as Eg,o1 as Fg,E4e as Gg,P4e as Hg,OI as Ig,_m as Jg,Ub as Kg,k4e as Lg,s1 as Mg,M4e as Ng,xm as Og,a1 as Pg,c1 as Qg,D4e as Rg,z4e as Sg,j4e as Tg,H4e as Ug,u1 as Vg,l1 as Wg,p1 as Xg,mr as Yg,ei as Zg,Noe as _g,Uoe as $g,W4e as ah,Y4e as bh,Q4e as ch,X4e as dh,fr as eh,NI as fh,zoe as gh,pKe as hh,h1 as ih,CKe as jh,UI as kh,Hoe as lh,Woe as mh,Qoe as nh,b1 as oh,NKe as ph,UKe as qh,qKe as rh,C1 as sh,jKe as th,HKe as uh,GKe as vh,HI as wh,zb as xh,GI as yh,A1 as zh,QKe as Ah,XKe as Bh,eWe as Ch,tWe as Dh,SG as Eh,oo as Fh,kWe as Gh,iE as Hh,qWe as Ih,CG as Jh,$We as Kh,Cie as Lh,vie as Mh,o3e as Nh,r3e as Oh,Tie as Ph,u3e as Qh,UG as Rh,p3e as Sh,pE as Th,mE as Uh,GG as Vh,Zie as Wh,VG as Xh,RE as Yh,oF as Zh,SE as _h,pF as $h,CE as ai,TE as bi,fF as ci,hF as di,gF as ei,EE as fi,kE as gi,vF as hi,TF as ii,AF as ji,IF as ki,EF as li,kF as mi,OE as ni,bse as oi,LF as pi,UE as qi,zF as ri,jF as si,HF as ti,xse as ui,GF as vi,FF as wi,BF as xi,ZF as yi,VF as zi,zE as Ai,KF as Bi,WF as Ci,jE as Di,HE as Ei,XF as Fi,tB as Gi,nB as Hi,BE as Ii,rB as Ji,lB as Ki,WE as Li,YE as Mi,dB as Ni,yB as Oi,XE as Pi,fae as Qi,eP as Ri,tP as Si,om as Ti};
|
|
273
|
-
/*! For license information please see chunk-
|
|
274
|
-
//# sourceMappingURL=chunk-
|
|
273
|
+
/*! For license information please see chunk-B7GJXWVX.js.LEGAL.txt */
|
|
274
|
+
//# sourceMappingURL=chunk-B7GJXWVX.js.map
|