@tomato414941/foundation 29.0.3 → 29.0.4

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +14 -14
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as foundationCreateRequire } from 'node:module'; const require = foundationCreateRequire(import.meta.url);
3
- var hle=Object.create;var tb=Object.defineProperty;var gle=Object.getOwnPropertyDescriptor;var yle=Object.getOwnPropertyNames;var vle=Object.getPrototypeOf,wle=Object.prototype.hasOwnProperty;var xn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var v=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(o){throw r=[o],o}};var R=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},yt=(t,e)=>{for(var r in e)tb(t,r,{get:e[r],enumerable:!0})},hF=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of yle(e))!wle.call(t,n)&&n!==r&&tb(t,n,{get:()=>e[n],enumerable:!(o=gle(e,n))||o.enumerable});return t};var St=(t,e,r)=>(r=t!=null?hle(vle(t)):{},hF(e||!t||!t.__esModule?tb(r,"default",{value:t,enumerable:!0}):r,t)),se=t=>hF(tb({},"__esModule",{value:!0}),t);var Iq=R(kq=>{"use strict";Object.defineProperty(kq,"__esModule",{value:!0})});var $q=R(kg=>{"use strict";Object.defineProperty(kg,"__esModule",{value:!0});kg.types=void 0;var jge;(function(t){t[t.ROOT=0]="ROOT",t[t.GROUP=1]="GROUP",t[t.POSITION=2]="POSITION",t[t.SET=3]="SET",t[t.RANGE=4]="RANGE",t[t.REPETITION=5]="REPETITION",t[t.REFERENCE=6]="REFERENCE",t[t.CHAR=7]="CHAR"})(jge=kg.types||(kg.types={}))});var Tq=R(Aq=>{"use strict";Object.defineProperty(Aq,"__esModule",{value:!0})});var pa=R(da=>{"use strict";var Mge=da&&da.__createBinding||(Object.create?(function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]})),PN=da&&da.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Mge(e,t,r)};Object.defineProperty(da,"__esModule",{value:!0});PN(Iq(),da);PN($q(),da);PN(Tq(),da)});var l0=R(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.anyChar=Kr.notWhitespace=Kr.whitespace=Kr.notInts=Kr.ints=Kr.notWords=Kr.words=void 0;var Ge=pa(),Pq=()=>[{type:Ge.types.RANGE,from:48,to:57}],Rq=()=>[{type:Ge.types.CHAR,value:95},{type:Ge.types.RANGE,from:97,to:122},{type:Ge.types.RANGE,from:65,to:90},{type:Ge.types.RANGE,from:48,to:57}],Cq=()=>[{type:Ge.types.CHAR,value:9},{type:Ge.types.CHAR,value:10},{type:Ge.types.CHAR,value:11},{type:Ge.types.CHAR,value:12},{type:Ge.types.CHAR,value:13},{type:Ge.types.CHAR,value:32},{type:Ge.types.CHAR,value:160},{type:Ge.types.CHAR,value:5760},{type:Ge.types.RANGE,from:8192,to:8202},{type:Ge.types.CHAR,value:8232},{type:Ge.types.CHAR,value:8233},{type:Ge.types.CHAR,value:8239},{type:Ge.types.CHAR,value:8287},{type:Ge.types.CHAR,value:12288},{type:Ge.types.CHAR,value:65279}],Uge=()=>[{type:Ge.types.CHAR,value:10},{type:Ge.types.CHAR,value:13},{type:Ge.types.CHAR,value:8232},{type:Ge.types.CHAR,value:8233}];Kr.words=()=>({type:Ge.types.SET,set:Rq(),not:!1});Kr.notWords=()=>({type:Ge.types.SET,set:Rq(),not:!0});Kr.ints=()=>({type:Ge.types.SET,set:Pq(),not:!1});Kr.notInts=()=>({type:Ge.types.SET,set:Pq(),not:!0});Kr.whitespace=()=>({type:Ge.types.SET,set:Cq(),not:!1});Kr.notWhitespace=()=>({type:Ge.types.SET,set:Cq(),not:!0});Kr.anyChar=()=>({type:Ge.types.SET,set:Uge(),not:!0})});var Nq=R(_o=>{"use strict";var Lge=_o&&_o.__createBinding||(Object.create?(function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]})),Fge=_o&&_o.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Vge=_o&&_o.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lge(e,t,r);return Fge(e,t),e};Object.defineProperty(_o,"__esModule",{value:!0});_o.tokenizeClass=_o.strToChars=void 0;var Oq=pa(),_p=Vge(l0()),Hge="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?";_o.strToChars=t=>{let e=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return t.replace(e,(r,o,n,i,s,a,c)=>{if(n)return r;let u=o?8:i?parseInt(i,16):s?parseInt(s,16):a?Hge.indexOf(a):{0:0,t:9,n:10,v:11,f:12,r:13}[c],l=String.fromCharCode(u);return/[[\]{}^$.|?*+()]/.test(l)?`\\${l}`:l})};_o.tokenizeClass=(t,e)=>{var r,o,n,i,s,a,c;let u=[],l,d,f=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(((?:\\)])|(((?:\\)?([^\]])))))|(\])|(?:\\)?([^])/g;for(;(l=f.exec(t))!==null;){let p=(c=(a=(s=(i=(n=(o=(r=l[1]&&_p.words())!==null&&r!==void 0?r:l[2]&&_p.ints())!==null&&o!==void 0?o:l[3]&&_p.whitespace())!==null&&n!==void 0?n:l[4]&&_p.notWords())!==null&&i!==void 0?i:l[5]&&_p.notInts())!==null&&s!==void 0?s:l[6]&&_p.notWhitespace())!==null&&a!==void 0?a:l[7]&&{type:Oq.types.RANGE,from:(l[8]||l[9]).charCodeAt(0),to:(d=l[10]).charCodeAt(d.length-1)})!==null&&c!==void 0?c:(d=l[16])&&{type:Oq.types.CHAR,value:d.charCodeAt(0)};if(p)u.push(p);else return[u,f.lastIndex]}throw new SyntaxError(`Invalid regular expression: /${e}/: Unterminated character class`)}});var RN=R(ts=>{"use strict";var Bge=ts&&ts.__createBinding||(Object.create?(function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]})),Kge=ts&&ts.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),jq=ts&&ts.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Bge(e,t,r);return Kge(e,t),e};Object.defineProperty(ts,"__esModule",{value:!0});ts.tokenizer=void 0;var Dq=jq(Nq()),kr=pa(),nl=jq(l0()),qge=/^[a-zA-Z_$]$/i,Zge=/^[a-zA-Z0-9_$]$/i,zq=/\d/;ts.tokenizer=t=>{let e=0,r,o={type:kr.types.ROOT,stack:[]},n=o,i=o.stack,s=[],a=[],c=0,u=d=>{throw new SyntaxError(`Invalid regular expression: /${t}/: Nothing to repeat at column ${d-1}`)},l=Dq.strToChars(t);for(;e<l.length;)switch(r=l[e++]){case"\\":if(e===l.length)throw new SyntaxError(`Invalid regular expression: /${t}/: \\ at end of pattern`);switch(r=l[e++]){case"b":i.push({type:kr.types.POSITION,value:"b"});break;case"B":i.push({type:kr.types.POSITION,value:"B"});break;case"w":i.push(nl.words());break;case"W":i.push(nl.notWords());break;case"d":i.push(nl.ints());break;case"D":i.push(nl.notInts());break;case"s":i.push(nl.whitespace());break;case"S":i.push(nl.notWhitespace());break;default:if(zq.test(r)){let d=r;for(;e<l.length&&zq.test(l[e]);)d+=l[e++];let f=parseInt(d,10),p={type:kr.types.REFERENCE,value:f};i.push(p),a.push({reference:p,stack:i,index:i.length-1})}else i.push({type:kr.types.CHAR,value:r.charCodeAt(0)})}break;case"^":i.push({type:kr.types.POSITION,value:"^"});break;case"$":i.push({type:kr.types.POSITION,value:"$"});break;case"[":{let d;l[e]==="^"?(d=!0,e++):d=!1;let f=Dq.tokenizeClass(l.slice(e),t);e+=f[1],i.push({type:kr.types.SET,set:f[0],not:d});break}case".":i.push(nl.anyChar());break;case"(":{let d={type:kr.types.GROUP,stack:[],remember:!0};if(l[e]==="?")if(r=l[e+1],e+=2,r==="=")d.followedBy=!0,d.remember=!1;else if(r==="!")d.notFollowedBy=!0,d.remember=!1;else if(r==="<"){let f="";if(qge.test(l[e]))f+=l[e],e++;else throw new SyntaxError(`Invalid regular expression: /${t}/: Invalid capture group name, character '${l[e]}' after '<' at column ${e+1}`);for(;e<l.length&&Zge.test(l[e]);)f+=l[e],e++;if(!f)throw new SyntaxError(`Invalid regular expression: /${t}/: Invalid capture group name, character '${l[e]}' after '<' at column ${e+1}`);if(l[e]!==">")throw new SyntaxError(`Invalid regular expression: /${t}/: Unclosed capture group name, expected '>', found '${l[e]}' at column ${e+1}`);d.name=f,e++}else if(r===":")d.remember=!1;else throw new SyntaxError(`Invalid regular expression: /${t}/: Invalid group, character '${r}' after '?' at column ${e-1}`);else c+=1;i.push(d),s.push(n),n=d,i=d.stack;break}case")":if(s.length===0)throw new SyntaxError(`Invalid regular expression: /${t}/: Unmatched ) at column ${e-1}`);n=s.pop(),i=n.options?n.options[n.options.length-1]:n.stack;break;case"|":{n.options||(n.options=[n.stack],delete n.stack);let d=[];n.options.push(d),i=d;break}case"{":{let d=/^(\d+)(,(\d+)?)?\}/.exec(l.slice(e)),f,p;d!==null?(i.length===0&&u(e),f=parseInt(d[1],10),p=d[2]?d[3]?parseInt(d[3],10):1/0:f,e+=d[0].length,i.push({type:kr.types.REPETITION,min:f,max:p,value:i.pop()})):i.push({type:kr.types.CHAR,value:123});break}case"?":i.length===0&&u(e),i.push({type:kr.types.REPETITION,min:0,max:1,value:i.pop()});break;case"+":i.length===0&&u(e),i.push({type:kr.types.REPETITION,min:1,max:1/0,value:i.pop()});break;case"*":i.length===0&&u(e),i.push({type:kr.types.REPETITION,min:0,max:1/0,value:i.pop()});break;default:i.push({type:kr.types.CHAR,value:r.charCodeAt(0)})}if(s.length!==0)throw new SyntaxError(`Invalid regular expression: /${t}/: Unterminated group`);return Wge(a,c),o};function Wge(t,e){for(let r of t.reverse())if(e<r.reference.value){r.reference.type=kr.types.CHAR;let o=r.reference.value.toString();if(r.reference.value=parseInt(o,8),!/^[0-7]+$/.test(o)){let n=0;for(;o[n]!=="8"&&o[n]!=="9";)n+=1;if(n===0?(r.reference.value=o.charCodeAt(0),n+=1):r.reference.value=parseInt(o.slice(0,n),8),o.length>n){let i=r.stack.splice(r.index+1);for(let s of o.slice(n))r.stack.push({type:kr.types.CHAR,value:s.charCodeAt(0)});r.stack.push(...i)}}}}});var Uq=R(qr=>{"use strict";var Jge=qr&&qr.__createBinding||(Object.create?(function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]})),Gge=qr&&qr.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Xge=qr&&qr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jge(e,t,r);return Gge(e,t),e};Object.defineProperty(qr,"__esModule",{value:!0});qr.NOTANYCHAR=qr.WHITESPACE=qr.WORDS=qr.INTS=void 0;var d0=Xge(l0()),Mq=pa();function p0(t){let e={},r=0;for(let o of t)o.type===Mq.types.CHAR&&(e[o.value]=!0),o.type===Mq.types.RANGE&&(e[`${o.from}-${o.to}`]=!0),r+=1;return{lookup:()=>Object.assign({},e),len:r}}qr.INTS=p0(d0.ints().set);qr.WORDS=p0(d0.words().set);qr.WHITESPACE=p0(d0.whitespace().set);qr.NOTANYCHAR=p0(d0.anyChar().set)});var Fq=R(So=>{"use strict";var Yge=So&&So.__createBinding||(Object.create?(function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]})),Qge=So&&So.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),eye=So&&So.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Yge(e,t,r);return Qge(e,t),e};Object.defineProperty(So,"__esModule",{value:!0});So.writeSetTokens=So.setChar=void 0;var g0=pa(),f0=eye(Uq());function h0(t){return t===94?"\\^":t===92?"\\\\":t===93?"\\]":t===45?"\\-":String.fromCharCode(t)}So.setChar=h0;function m0(t,{lookup:e,len:r}){if(r!==t.length)return!1;let o=e();for(let n of t){if(n.type===g0.types.SET)return!1;let i=n.type===g0.types.CHAR?n.value:`${n.from}-${n.to}`;if(o[i])o[i]=!1;else return!1}return!0}function Lq(t,e=!1){if(m0(t.set,f0.INTS))return t.not?"\\D":"\\d";if(m0(t.set,f0.WORDS))return t.not?"\\W":"\\w";if(t.not&&m0(t.set,f0.NOTANYCHAR))return".";if(m0(t.set,f0.WHITESPACE))return t.not?"\\S":"\\s";let r="";for(let n=0;n<t.set.length;n++){let i=t.set[n];r+=tye(i)}let o=`${t.not?"^":""}${r}`;return e?o:`[${o}]`}So.writeSetTokens=Lq;function tye(t){return t.type===g0.types.CHAR?h0(t.value):t.type===g0.types.RANGE?`${h0(t.from)}-${h0(t.to)}`:Lq(t,!0)}});var ON=R(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});Sp.reconstruct=void 0;var dc=pa(),CN=Fq(),Vq=t=>t.map(Sp.reconstruct).join(""),Hq=t=>{if("options"in t)return t.options.map(Vq).join("|");if("stack"in t)return Vq(t.stack);throw new Error("options or stack must be Root or Group token")};Sp.reconstruct=t=>{switch(t.type){case dc.types.ROOT:return Hq(t);case dc.types.CHAR:{let e=String.fromCharCode(t.value);return(/[[\\{}$^.|?*+()]/.test(e)?"\\":"")+e}case dc.types.POSITION:return t.value==="^"||t.value==="$"?t.value:`\\${t.value}`;case dc.types.REFERENCE:return`\\${t.value}`;case dc.types.SET:return CN.writeSetTokens(t);case dc.types.GROUP:return`(${t.name?`?<${t.name}>`:t.remember?"":t.followedBy?"?=":t.notFollowedBy?"?!":"?:"}${Hq(t)})`;case dc.types.REPETITION:{let{min:e,max:r}=t,o;return e===0&&r===1?o="?":e===1&&r===1/0?o="+":e===0&&r===1/0?o="*":r===1/0?o=`{${e},}`:e===r?o=`{${e}}`:o=`{${e},${r}}`,`${Sp.reconstruct(t.value)}${o}`}case dc.types.RANGE:return`${CN.setChar(t.from)}-${CN.setChar(t.to)}`;default:throw new Error(`Invalid token type ${t}`)}}});var DN=R((xo,y0)=>{"use strict";var rye=xo&&xo.__createBinding||(Object.create?(function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]})),NN=xo&&xo.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rye(e,t,r)};Object.defineProperty(xo,"__esModule",{value:!0});xo.types=void 0;var Bq=pa();Object.defineProperty(xo,"types",{enumerable:!0,get:function(){return Bq.types}});NN(RN(),xo);NN(ON(),xo);var Kq=RN(),nye=ON();NN(pa(),xo);xo.default=Kq.tokenizer;y0.exports=Kq.tokenizer;y0.exports.types=Bq.types;y0.exports.reconstruct=nye.reconstruct});var qq=R((iKe,v0)=>{"use strict";var oye=DN(),{types:iye}=DN();function zN(t,e,r){let o,n,i;if(t.type===iye.REPETITION&&(r++,e.reps++,r>1||e.reps>e.limit))return!1;let s=t.options||t.value?.options;if(s){for(o=0,i=s.length;o<i;o++)if(n=zN({stack:s[o]},e,r),!n)return!1}let a=t.stack||t.value?.stack;if(!a)return!0;for(o=0,i=a.length;o<i;o++)if(n=zN(a[o],e,r),!n)return!1;return!0}function jN(t,e){let r={reps:0,limit:e?.limit??25};sye(t)?t=t.source:typeof t!="string"&&(t=String(t));try{return zN(oye(t),r,0)}catch{return!1}}function sye(t){return Object.prototype.toString.call(t)==="[object RegExp]"}v0.exports=jN;v0.exports.default=jN;v0.exports.safeRegex=jN});var jg,os,_Z=v(()=>{jg={warningEmitted:!1},os=t=>{if(t&&!jg.warningEmitted){if(process.env.AWS_SDK_JS_NODE_VERSION_SUPPORT_WARNING_DISABLED==="true"){jg.warningEmitted=!0;return}let e=parseInt(t.substring(1,t.indexOf("."))),r=22;e<r&&(jg.warningEmitted=!0,process.emitWarning(`NodeVersionSupportWarning: The AWS SDK for JavaScript (v3)
3
+ var hle=Object.create;var tb=Object.defineProperty;var gle=Object.getOwnPropertyDescriptor;var yle=Object.getOwnPropertyNames;var vle=Object.getPrototypeOf,wle=Object.prototype.hasOwnProperty;var xn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var v=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(o){throw r=[o],o}};var R=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},yt=(t,e)=>{for(var r in e)tb(t,r,{get:e[r],enumerable:!0})},hF=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of yle(e))!wle.call(t,n)&&n!==r&&tb(t,n,{get:()=>e[n],enumerable:!(o=gle(e,n))||o.enumerable});return t};var St=(t,e,r)=>(r=t!=null?hle(vle(t)):{},hF(e||!t||!t.__esModule?tb(r,"default",{value:t,enumerable:!0}):r,t)),se=t=>hF(tb({},"__esModule",{value:!0}),t);var Iq=R(kq=>{"use strict";Object.defineProperty(kq,"__esModule",{value:!0})});var $q=R(kg=>{"use strict";Object.defineProperty(kg,"__esModule",{value:!0});kg.types=void 0;var jge;(function(t){t[t.ROOT=0]="ROOT",t[t.GROUP=1]="GROUP",t[t.POSITION=2]="POSITION",t[t.SET=3]="SET",t[t.RANGE=4]="RANGE",t[t.REPETITION=5]="REPETITION",t[t.REFERENCE=6]="REFERENCE",t[t.CHAR=7]="CHAR"})(jge=kg.types||(kg.types={}))});var Tq=R(Aq=>{"use strict";Object.defineProperty(Aq,"__esModule",{value:!0})});var pa=R(da=>{"use strict";var Mge=da&&da.__createBinding||(Object.create?(function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]})),PN=da&&da.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Mge(e,t,r)};Object.defineProperty(da,"__esModule",{value:!0});PN(Iq(),da);PN($q(),da);PN(Tq(),da)});var l0=R(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.anyChar=Kr.notWhitespace=Kr.whitespace=Kr.notInts=Kr.ints=Kr.notWords=Kr.words=void 0;var Ge=pa(),Pq=()=>[{type:Ge.types.RANGE,from:48,to:57}],Rq=()=>[{type:Ge.types.CHAR,value:95},{type:Ge.types.RANGE,from:97,to:122},{type:Ge.types.RANGE,from:65,to:90},{type:Ge.types.RANGE,from:48,to:57}],Cq=()=>[{type:Ge.types.CHAR,value:9},{type:Ge.types.CHAR,value:10},{type:Ge.types.CHAR,value:11},{type:Ge.types.CHAR,value:12},{type:Ge.types.CHAR,value:13},{type:Ge.types.CHAR,value:32},{type:Ge.types.CHAR,value:160},{type:Ge.types.CHAR,value:5760},{type:Ge.types.RANGE,from:8192,to:8202},{type:Ge.types.CHAR,value:8232},{type:Ge.types.CHAR,value:8233},{type:Ge.types.CHAR,value:8239},{type:Ge.types.CHAR,value:8287},{type:Ge.types.CHAR,value:12288},{type:Ge.types.CHAR,value:65279}],Uge=()=>[{type:Ge.types.CHAR,value:10},{type:Ge.types.CHAR,value:13},{type:Ge.types.CHAR,value:8232},{type:Ge.types.CHAR,value:8233}];Kr.words=()=>({type:Ge.types.SET,set:Rq(),not:!1});Kr.notWords=()=>({type:Ge.types.SET,set:Rq(),not:!0});Kr.ints=()=>({type:Ge.types.SET,set:Pq(),not:!1});Kr.notInts=()=>({type:Ge.types.SET,set:Pq(),not:!0});Kr.whitespace=()=>({type:Ge.types.SET,set:Cq(),not:!1});Kr.notWhitespace=()=>({type:Ge.types.SET,set:Cq(),not:!0});Kr.anyChar=()=>({type:Ge.types.SET,set:Uge(),not:!0})});var Nq=R(_o=>{"use strict";var Lge=_o&&_o.__createBinding||(Object.create?(function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]})),Fge=_o&&_o.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Vge=_o&&_o.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lge(e,t,r);return Fge(e,t),e};Object.defineProperty(_o,"__esModule",{value:!0});_o.tokenizeClass=_o.strToChars=void 0;var Oq=pa(),_p=Vge(l0()),Hge="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?";_o.strToChars=t=>{let e=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return t.replace(e,(r,o,n,i,s,a,c)=>{if(n)return r;let u=o?8:i?parseInt(i,16):s?parseInt(s,16):a?Hge.indexOf(a):{0:0,t:9,n:10,v:11,f:12,r:13}[c],l=String.fromCharCode(u);return/[[\]{}^$.|?*+()]/.test(l)?`\\${l}`:l})};_o.tokenizeClass=(t,e)=>{var r,o,n,i,s,a,c;let u=[],l,d,f=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(((?:\\)])|(((?:\\)?([^\]])))))|(\])|(?:\\)?([^])/g;for(;(l=f.exec(t))!==null;){let p=(c=(a=(s=(i=(n=(o=(r=l[1]&&_p.words())!==null&&r!==void 0?r:l[2]&&_p.ints())!==null&&o!==void 0?o:l[3]&&_p.whitespace())!==null&&n!==void 0?n:l[4]&&_p.notWords())!==null&&i!==void 0?i:l[5]&&_p.notInts())!==null&&s!==void 0?s:l[6]&&_p.notWhitespace())!==null&&a!==void 0?a:l[7]&&{type:Oq.types.RANGE,from:(l[8]||l[9]).charCodeAt(0),to:(d=l[10]).charCodeAt(d.length-1)})!==null&&c!==void 0?c:(d=l[16])&&{type:Oq.types.CHAR,value:d.charCodeAt(0)};if(p)u.push(p);else return[u,f.lastIndex]}throw new SyntaxError(`Invalid regular expression: /${e}/: Unterminated character class`)}});var RN=R(ts=>{"use strict";var Bge=ts&&ts.__createBinding||(Object.create?(function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]})),Kge=ts&&ts.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),jq=ts&&ts.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Bge(e,t,r);return Kge(e,t),e};Object.defineProperty(ts,"__esModule",{value:!0});ts.tokenizer=void 0;var Dq=jq(Nq()),kr=pa(),nl=jq(l0()),qge=/^[a-zA-Z_$]$/i,Zge=/^[a-zA-Z0-9_$]$/i,zq=/\d/;ts.tokenizer=t=>{let e=0,r,o={type:kr.types.ROOT,stack:[]},n=o,i=o.stack,s=[],a=[],c=0,u=d=>{throw new SyntaxError(`Invalid regular expression: /${t}/: Nothing to repeat at column ${d-1}`)},l=Dq.strToChars(t);for(;e<l.length;)switch(r=l[e++]){case"\\":if(e===l.length)throw new SyntaxError(`Invalid regular expression: /${t}/: \\ at end of pattern`);switch(r=l[e++]){case"b":i.push({type:kr.types.POSITION,value:"b"});break;case"B":i.push({type:kr.types.POSITION,value:"B"});break;case"w":i.push(nl.words());break;case"W":i.push(nl.notWords());break;case"d":i.push(nl.ints());break;case"D":i.push(nl.notInts());break;case"s":i.push(nl.whitespace());break;case"S":i.push(nl.notWhitespace());break;default:if(zq.test(r)){let d=r;for(;e<l.length&&zq.test(l[e]);)d+=l[e++];let f=parseInt(d,10),p={type:kr.types.REFERENCE,value:f};i.push(p),a.push({reference:p,stack:i,index:i.length-1})}else i.push({type:kr.types.CHAR,value:r.charCodeAt(0)})}break;case"^":i.push({type:kr.types.POSITION,value:"^"});break;case"$":i.push({type:kr.types.POSITION,value:"$"});break;case"[":{let d;l[e]==="^"?(d=!0,e++):d=!1;let f=Dq.tokenizeClass(l.slice(e),t);e+=f[1],i.push({type:kr.types.SET,set:f[0],not:d});break}case".":i.push(nl.anyChar());break;case"(":{let d={type:kr.types.GROUP,stack:[],remember:!0};if(l[e]==="?")if(r=l[e+1],e+=2,r==="=")d.followedBy=!0,d.remember=!1;else if(r==="!")d.notFollowedBy=!0,d.remember=!1;else if(r==="<"){let f="";if(qge.test(l[e]))f+=l[e],e++;else throw new SyntaxError(`Invalid regular expression: /${t}/: Invalid capture group name, character '${l[e]}' after '<' at column ${e+1}`);for(;e<l.length&&Zge.test(l[e]);)f+=l[e],e++;if(!f)throw new SyntaxError(`Invalid regular expression: /${t}/: Invalid capture group name, character '${l[e]}' after '<' at column ${e+1}`);if(l[e]!==">")throw new SyntaxError(`Invalid regular expression: /${t}/: Unclosed capture group name, expected '>', found '${l[e]}' at column ${e+1}`);d.name=f,e++}else if(r===":")d.remember=!1;else throw new SyntaxError(`Invalid regular expression: /${t}/: Invalid group, character '${r}' after '?' at column ${e-1}`);else c+=1;i.push(d),s.push(n),n=d,i=d.stack;break}case")":if(s.length===0)throw new SyntaxError(`Invalid regular expression: /${t}/: Unmatched ) at column ${e-1}`);n=s.pop(),i=n.options?n.options[n.options.length-1]:n.stack;break;case"|":{n.options||(n.options=[n.stack],delete n.stack);let d=[];n.options.push(d),i=d;break}case"{":{let d=/^(\d+)(,(\d+)?)?\}/.exec(l.slice(e)),f,p;d!==null?(i.length===0&&u(e),f=parseInt(d[1],10),p=d[2]?d[3]?parseInt(d[3],10):1/0:f,e+=d[0].length,i.push({type:kr.types.REPETITION,min:f,max:p,value:i.pop()})):i.push({type:kr.types.CHAR,value:123});break}case"?":i.length===0&&u(e),i.push({type:kr.types.REPETITION,min:0,max:1,value:i.pop()});break;case"+":i.length===0&&u(e),i.push({type:kr.types.REPETITION,min:1,max:1/0,value:i.pop()});break;case"*":i.length===0&&u(e),i.push({type:kr.types.REPETITION,min:0,max:1/0,value:i.pop()});break;default:i.push({type:kr.types.CHAR,value:r.charCodeAt(0)})}if(s.length!==0)throw new SyntaxError(`Invalid regular expression: /${t}/: Unterminated group`);return Wge(a,c),o};function Wge(t,e){for(let r of t.reverse())if(e<r.reference.value){r.reference.type=kr.types.CHAR;let o=r.reference.value.toString();if(r.reference.value=parseInt(o,8),!/^[0-7]+$/.test(o)){let n=0;for(;o[n]!=="8"&&o[n]!=="9";)n+=1;if(n===0?(r.reference.value=o.charCodeAt(0),n+=1):r.reference.value=parseInt(o.slice(0,n),8),o.length>n){let i=r.stack.splice(r.index+1);for(let s of o.slice(n))r.stack.push({type:kr.types.CHAR,value:s.charCodeAt(0)});r.stack.push(...i)}}}}});var Uq=R(qr=>{"use strict";var Jge=qr&&qr.__createBinding||(Object.create?(function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]})),Gge=qr&&qr.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Xge=qr&&qr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jge(e,t,r);return Gge(e,t),e};Object.defineProperty(qr,"__esModule",{value:!0});qr.NOTANYCHAR=qr.WHITESPACE=qr.WORDS=qr.INTS=void 0;var d0=Xge(l0()),Mq=pa();function p0(t){let e={},r=0;for(let o of t)o.type===Mq.types.CHAR&&(e[o.value]=!0),o.type===Mq.types.RANGE&&(e[`${o.from}-${o.to}`]=!0),r+=1;return{lookup:()=>Object.assign({},e),len:r}}qr.INTS=p0(d0.ints().set);qr.WORDS=p0(d0.words().set);qr.WHITESPACE=p0(d0.whitespace().set);qr.NOTANYCHAR=p0(d0.anyChar().set)});var Fq=R(So=>{"use strict";var Yge=So&&So.__createBinding||(Object.create?(function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]})),Qge=So&&So.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),eye=So&&So.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Yge(e,t,r);return Qge(e,t),e};Object.defineProperty(So,"__esModule",{value:!0});So.writeSetTokens=So.setChar=void 0;var g0=pa(),f0=eye(Uq());function h0(t){return t===94?"\\^":t===92?"\\\\":t===93?"\\]":t===45?"\\-":String.fromCharCode(t)}So.setChar=h0;function m0(t,{lookup:e,len:r}){if(r!==t.length)return!1;let o=e();for(let n of t){if(n.type===g0.types.SET)return!1;let i=n.type===g0.types.CHAR?n.value:`${n.from}-${n.to}`;if(o[i])o[i]=!1;else return!1}return!0}function Lq(t,e=!1){if(m0(t.set,f0.INTS))return t.not?"\\D":"\\d";if(m0(t.set,f0.WORDS))return t.not?"\\W":"\\w";if(t.not&&m0(t.set,f0.NOTANYCHAR))return".";if(m0(t.set,f0.WHITESPACE))return t.not?"\\S":"\\s";let r="";for(let n=0;n<t.set.length;n++){let i=t.set[n];r+=tye(i)}let o=`${t.not?"^":""}${r}`;return e?o:`[${o}]`}So.writeSetTokens=Lq;function tye(t){return t.type===g0.types.CHAR?h0(t.value):t.type===g0.types.RANGE?`${h0(t.from)}-${h0(t.to)}`:Lq(t,!0)}});var ON=R(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});Sp.reconstruct=void 0;var dc=pa(),CN=Fq(),Vq=t=>t.map(Sp.reconstruct).join(""),Hq=t=>{if("options"in t)return t.options.map(Vq).join("|");if("stack"in t)return Vq(t.stack);throw new Error("options or stack must be Root or Group token")};Sp.reconstruct=t=>{switch(t.type){case dc.types.ROOT:return Hq(t);case dc.types.CHAR:{let e=String.fromCharCode(t.value);return(/[[\\{}$^.|?*+()]/.test(e)?"\\":"")+e}case dc.types.POSITION:return t.value==="^"||t.value==="$"?t.value:`\\${t.value}`;case dc.types.REFERENCE:return`\\${t.value}`;case dc.types.SET:return CN.writeSetTokens(t);case dc.types.GROUP:return`(${t.name?`?<${t.name}>`:t.remember?"":t.followedBy?"?=":t.notFollowedBy?"?!":"?:"}${Hq(t)})`;case dc.types.REPETITION:{let{min:e,max:r}=t,o;return e===0&&r===1?o="?":e===1&&r===1/0?o="+":e===0&&r===1/0?o="*":r===1/0?o=`{${e},}`:e===r?o=`{${e}}`:o=`{${e},${r}}`,`${Sp.reconstruct(t.value)}${o}`}case dc.types.RANGE:return`${CN.setChar(t.from)}-${CN.setChar(t.to)}`;default:throw new Error(`Invalid token type ${t}`)}}});var DN=R((xo,y0)=>{"use strict";var rye=xo&&xo.__createBinding||(Object.create?(function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]})),NN=xo&&xo.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rye(e,t,r)};Object.defineProperty(xo,"__esModule",{value:!0});xo.types=void 0;var Bq=pa();Object.defineProperty(xo,"types",{enumerable:!0,get:function(){return Bq.types}});NN(RN(),xo);NN(ON(),xo);var Kq=RN(),nye=ON();NN(pa(),xo);xo.default=Kq.tokenizer;y0.exports=Kq.tokenizer;y0.exports.types=Bq.types;y0.exports.reconstruct=nye.reconstruct});var qq=R((oKe,v0)=>{"use strict";var oye=DN(),{types:iye}=DN();function zN(t,e,r){let o,n,i;if(t.type===iye.REPETITION&&(r++,e.reps++,r>1||e.reps>e.limit))return!1;let s=t.options||t.value?.options;if(s){for(o=0,i=s.length;o<i;o++)if(n=zN({stack:s[o]},e,r),!n)return!1}let a=t.stack||t.value?.stack;if(!a)return!0;for(o=0,i=a.length;o<i;o++)if(n=zN(a[o],e,r),!n)return!1;return!0}function jN(t,e){let r={reps:0,limit:e?.limit??25};sye(t)?t=t.source:typeof t!="string"&&(t=String(t));try{return zN(oye(t),r,0)}catch{return!1}}function sye(t){return Object.prototype.toString.call(t)==="[object RegExp]"}v0.exports=jN;v0.exports.default=jN;v0.exports.safeRegex=jN});var jg,os,_Z=v(()=>{jg={warningEmitted:!1},os=t=>{if(t&&!jg.warningEmitted){if(process.env.AWS_SDK_JS_NODE_VERSION_SUPPORT_WARNING_DISABLED==="true"){jg.warningEmitted=!0;return}let e=parseInt(t.substring(1,t.indexOf("."))),r=22;e<r&&(jg.warningEmitted=!0,process.emitWarning(`NodeVersionSupportWarning: The AWS SDK for JavaScript (v3)
4
4
  versions published after the first week of January 2027
5
5
  will require node >=${r}. You are running node ${t}.
6
6
 
@@ -11,7 +11,7 @@ More information can be found at: https://a.co/c895JFp`))}}});var Pve,Rve,SZ,xZ=
11
11
  `+f}catch{!r.logger||r.logger?.constructor?.name==="NoOpLogger"?console.warn(f):r.logger?.warn?.(f)}typeof d.$responseBodyText<"u"&&d.$response&&(d.$response.body=d.$responseBodyText);try{if(ur.isInstance(n)){let{headers:p={},statusCode:m}=n,g=Object.entries(p);d.$metadata={httpStatusCode:m,requestId:uD(/^x-[\w-]+-request-?id$/,g),extendedRequestId:uD(/^x-[\w-]+-id-2$/,g),cfId:uD(/^x-[\w-]+-cf-id$/,g)}}}catch{}}throw d}},uD=(t,e)=>(e.find(([r])=>r.match(t))||[void 0,void 0])[1]});var YZ,QZ=v(()=>{he();O0();YZ=t=>(e,r)=>async o=>{let{operationSchema:n}=wt(r),[,i,s,a,c,u]=n??[],l=r.endpointV2?async()=>Xn(r.endpointV2):t.endpoint,d=await t.protocol.serializeRequest($p(i,s,a,c,u),o.input,{...t,...r,endpoint:l});return e({...o,request:d})}});function ss(t){return{applyToStack:e=>{e.add(YZ(t),dD),e.add(GZ(t),lD),t.protocol.setSerdeContext(t)}}}var lD,dD,e3=v(()=>{XZ();QZ();lD={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},dD={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var jt,wc=v(()=>{jt=class{name;namespace;traits;static assign(e,r){return Object.assign(e,r)}static[Symbol.hasInstance](e){let r=this.prototype.isPrototypeOf(e);return!r&&typeof e=="object"&&e!==null?e.symbol===this.symbol:r}getName(){return this.namespace+"#"+this.name}}});var Fg,t3,r3=v(()=>{wc();Fg=class t extends jt{static symbol=Symbol.for("@smithy/lis");valueSchema;symbol=t.symbol},t3=(t,e,r,o)=>jt.assign(new Fg,{name:e,namespace:t,traits:r,valueSchema:o})});var Vg,n3,o3=v(()=>{wc();Vg=class t extends jt{static symbol=Symbol.for("@smithy/map");keySchema;valueSchema;symbol=t.symbol},n3=(t,e,r,o,n)=>jt.assign(new Vg,{name:e,namespace:t,traits:r,keySchema:o,valueSchema:n})});var Hg,i3,s3=v(()=>{wc();Hg=class t extends jt{static symbol=Symbol.for("@smithy/ope");input;output;symbol=t.symbol},i3=(t,e,r,o,n)=>jt.assign(new Hg,{name:e,namespace:t,traits:r,input:o,output:n})});var sl,a3,pD=v(()=>{wc();sl=class t extends jt{static symbol=Symbol.for("@smithy/str");memberNames;memberList;symbol=t.symbol},a3=(t,e,r,o,n)=>jt.assign(new sl,{name:e,namespace:t,traits:r,memberNames:o,memberList:n})});var Bg,c3,u3=v(()=>{wc();pD();Bg=class t extends sl{static symbol=Symbol.for("@smithy/err");ctor;symbol=t.symbol},c3=(t,e,r,o,n,i)=>jt.assign(new Bg,{name:e,namespace:t,traits:r,memberNames:o,memberList:n,ctor:null})});function pi(t){if(typeof t=="object")return t;if(t=t|0,Kg[t])return Kg[t];let e={},r=0;for(let o of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(t>>r++&1)===1&&(e[o]=1);return Kg[t]=e}var Kg,fD=v(()=>{Kg=[]});function Zg(t,e){if(t instanceof L)return Object.assign(t,{memberName:e,_isMemberSchema:!0});let r=L;return new r(t,e)}var qg,Wg,Jg,L,mD,hD,l3=v(()=>{cD();fD();qg={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},Wg=[],Jg={},L=class t{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=t.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,r){this.ref=e,this.memberName=r;let o=[],n=e,i=e;for(this._isMemberSchema=!1;mD(n);)o.push(n[1]),n=n[0],i=ko(n),this._isMemberSchema=!0;if(o.length>0){this.memberTraits={};for(let s=o.length-1;s>=0;--s){let a=o[s];Object.assign(this.memberTraits,pi(a))}}else this.memberTraits=0;if(i instanceof t){let s=this.memberTraits;Object.assign(this,i),this.memberTraits=Object.assign({},s,i.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=r??i.memberName;return}if(this.schema=ko(i),hD(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(i),this.traits=0),this._isMemberSchema&&!r)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){let r=this.prototype.isPrototypeOf(e);return!r&&typeof e=="object"&&e!==null?e.symbol===this.symbol:r}static of(e){let r=typeof e=="function"||typeof e=="object"&&e!==null;if(typeof e=="number"){if(Wg[e])return Wg[e]}else if(typeof e=="string"){if(Jg[e])return Jg[e]}else if(r&&e[qg.ns])return e[qg.ns];let o=ko(e);if(o instanceof t)return o;if(mD(o)){let[i,s]=o;if(i instanceof t)return Object.assign(i.getMergedTraits(),pi(s)),i;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}let n=new t(o);return r?e[qg.ns]=n:typeof o=="string"?Jg[o]=n:typeof o=="number"?Wg[o]=n:n}getSchema(){let e=this.schema;return Array.isArray(e)&&e[0]===0?e[4]:e}getName(e=!1){let{name:r}=this;return!e&&r&&r.includes("#")?r.split("#")[1]:r||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){let e=this.getSchema();return typeof e=="number"?e>=64&&e<128:e[0]===1}isMapSchema(){let e=this.getSchema();return typeof e=="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){let e=this.getSchema();if(typeof e!="object")return!1;let r=e[0];return r===3||r===-3||r===4}isUnionSchema(){let e=this.getSchema();return typeof e!="object"?!1:e[0]===4}isBlobSchema(){let e=this.getSchema();return e===21||e===42}isTimestampSchema(){let e=this.getSchema();return typeof e=="number"&&e>=4&&e<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){let{streaming:e}=this.getMergedTraits();return!!e||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return pi(this.memberTraits)}getOwnTraits(){return pi(this.traits)}getKeySchema(){let[e,r]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!r)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);let o=this.getSchema(),n=e?15:o[4]??0;return Zg([n,0],"key")}getValueSchema(){let e=this.getSchema(),[r,o,n]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],i=typeof e=="number"?63&e:e&&typeof e=="object"&&(o||n)?e[3+e[0]]:r?15:void 0;if(i!=null)return Zg([i,0],o?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){let r=this.getSchema();if(this.isStructSchema()&&r[4].includes(e)){let o=r[4].indexOf(e),n=r[5][o];return Zg(mD(n)?n:[n,0],e)}if(this.isDocumentSchema())return Zg([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){let e={};try{for(let[r,o]of this.structIterator())e[r]=o}catch{}return e}getEventStreamMember(){if(this.isStructSchema()){for(let[e,r]of this.structIterator())if(r.isStreaming()&&r.isStructSchema())return e}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");let e=this.getSchema(),r=e[4].length,o=e[qg.it];if(o&&r===o.length){yield*o;return}o=Array(r);for(let n=0;n<r;++n){let i=e[4][n],s=Zg([e[5][n],0],i);yield o[n]=[i,s]}e[qg.it]=o}};mD=t=>Array.isArray(t)&&t.length===2,hD=t=>Array.isArray(t)&&t.length>=5});var Ap,d3,p3,f3=v(()=>{wc();Ap=class t extends jt{static symbol=Symbol.for("@smithy/sim");schemaRef;symbol=t.symbol},d3=(t,e,r,o)=>jt.assign(new Ap,{name:e,namespace:t,traits:o,schemaRef:r}),p3=(t,e,r,o)=>jt.assign(new Ap,{name:e,namespace:t,traits:r,schemaRef:o})});var m3,h3=v(()=>{m3={BLOB:21,STREAMING_BLOB:42,BOOLEAN:2,STRING:0,NUMERIC:1,BIG_INTEGER:17,BIG_DECIMAL:19,DOCUMENT:15,TIMESTAMP_DEFAULT:4,TIMESTAMP_DATE_TIME:5,TIMESTAMP_HTTP_DATE:6,TIMESTAMP_EPOCH_SECONDS:7,LIST_MODIFIER:64,MAP_MODIFIER:128}});var bt,g3=v(()=>{bt=class t{namespace;schemas;exceptions;static registries=new Map;constructor(e,r=new Map,o=new Map){this.namespace=e,this.schemas=r,this.exceptions=o,t.registries.has(e)||t.registries.set(e,this)}static for(e){return t.registries.get(e)??new t(e)}copyFrom(e){let{schemas:r,exceptions:o}=this;for(let[n,i]of e.schemas)r.has(n)||r.set(n,i);for(let[n,i]of e.exceptions)o.has(n)||o.set(n,i)}register(e,r){let o=this.normalizeShapeId(e);for(let n of[this,t.for(o.split("#")[0])])n.schemas.has(o)||n.schemas.set(o,r)}getSchema(e){let r=this.normalizeShapeId(e);if(!this.schemas.has(r)){if(!e.includes("#")){let o="#"+e,n=[];for(let[i,s]of this.schemas.entries())i.endsWith(o)&&n.push(s);if(n.length===1)return n[0]}throw new Error(`@smithy/core/schema - schema not found for ${r}`)}return this.schemas.get(r)}registerError(e,r){let o=e,n=o[1],i=n+"#"+o[2];r.hasOwnProperty?.("shapeId")||(r.shapeId=i);for(let s of[this,t.for(n)])!s.schemas.has(i)&&!s.exceptions.has(o)&&(s.schemas.set(i,o),s.exceptions.set(o,r))}getErrorCtor(e){let r=e;return this.exceptions.has(r)?this.exceptions.get(r):t.for(r[1]).exceptions.get(r)}getBaseException(){for(let e of this.exceptions.keys())if(Array.isArray(e)){let[,r,o]=e,n=r+"#"+o;if(n.startsWith("smithy.ts.sdk.synthetic.")&&n.endsWith("ServiceException"))return e}}find(e){for(let r of this.schemas.values())if(e(r))return r}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}}});var y3={};yt(y3,{ErrorSchema:()=>Bg,ListSchema:()=>Fg,MapSchema:()=>Vg,NormalizedSchema:()=>L,OperationSchema:()=>Hg,SCHEMA:()=>m3,Schema:()=>jt,SimpleSchema:()=>Ap,StructureSchema:()=>sl,TypeRegistry:()=>bt,deref:()=>ko,deserializerMiddlewareOption:()=>lD,error:()=>c3,getSchemaSerdePlugin:()=>ss,isStaticSchema:()=>hD,list:()=>t3,map:()=>n3,op:()=>i3,operation:()=>$p,serializerMiddlewareOption:()=>dD,sim:()=>d3,simAdapter:()=>p3,simpleSchemaCacheN:()=>Wg,simpleSchemaCacheS:()=>Jg,struct:()=>a3,traitsCache:()=>Kg,translateTraits:()=>pi});var De=v(()=>{cD();e3();r3();o3();s3();O0();u3();l3();wc();f3();pD();h3();fD();g3()});function Tp(t,e){if(e==null)return e;let r=L.of(t);if(r.getMergedTraits().sensitive)return gD;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return gD}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return gD}else if(r.isStructSchema()&&typeof e=="object"){let o=e,n={};for(let[i,s]of r.structIterator())o[i]!=null&&(n[i]=Tp(s,o[i]));return n}return e}var gD,yD=v(()=>{De();gD="***SensitiveInformation***"});var vD,mn,wD,bD=v(()=>{vD=St(is());P0();yD();mn=class{middlewareStack=vc();schema;static classBuilder(){return new wD}resolveMiddlewareWithContext(e,r,o,{middlewareFn:n,clientName:i,commandName:s,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,smithyContext:u,additionalContext:l,CommandCtor:d}){for(let b of n.bind(this)(d,e,r,o))this.middlewareStack.use(b);let f=e.concat(this.middlewareStack),{logger:p}=r,m=l[vD.SMITHY_CONTEXT_KEY],g={logger:p,clientName:i,commandName:s,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,...l,[vD.SMITHY_CONTEXT_KEY]:{...m,commandInstance:this,...u,...o?.metricsRecorder===void 0?{}:{metricsRecorder:o.metricsRecorder}}},{requestHandler:y}=r,w=o??{};return w.metricsRecorder&&(w={...w},delete w.metricsRecorder),u.eventStream&&(w={isEventStream:!0,...w}),f.resolve(b=>y.handle(b.request,w),g)}},wD=class{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,r,o={}){return this._smithyContext={service:e,operation:r,...o},this}c(e={}){return this._additionalContext=e,this}n(e,r){return this._clientName=e,this._commandName=r,this}f(e=o=>o,r=o=>o){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=r,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){let e=this,r;return r=class extends mn{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[o]){super(),this.input=o??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(o,n,i){let s=e._operationSchema,a=s?.[4]??s?.input,c=s?.[5]??s?.output;return this.resolveMiddlewareWithContext(o,n,i,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(s?Tp.bind(null,a):u=>u),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(s?Tp.bind(null,c):u=>u),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}}});var v3,w3=v(()=>{v3="***SensitiveInformation***"});var as,b3=v(()=>{as=(t,e,r)=>{for(let[i,s]of Object.entries(t)){let a=async function(u,l,d){let f=new s(u);if(typeof l=="function")this.send(f,l);else if(typeof d=="function"){if(typeof l!="object")throw new Error(`Expected http options but got ${typeof l}`);this.send(f,l||{},d)}else return this.send(f,l)},c=(i[0].toLowerCase()+i.slice(1)).replace(/Command$/,"");e.prototype[c]=a}let{paginators:o={},waiters:n={}}=r??{};for(let[i,s]of Object.entries(o))e.prototype[i]===void 0&&(e.prototype[i]=function(a={},c,...u){return s({...c,client:this},a,...u)});for(let[i,s]of Object.entries(n))e.prototype[i]===void 0&&(e.prototype[i]=async function(a={},c,...u){let l=c;return typeof c=="number"&&(l={maxWaitTime:c}),s({...l,client:this},a,...u)})}});var Io,al,_D=v(()=>{Io=class t extends Error{static shapeId="smithy.ts.sdk.synthetic.nonamespace.client#ServiceException";$fault;$response;$retryable;$metadata;constructor(e){super(e.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;let r=e;return t.prototype.isPrototypeOf(r)||!!r.$fault&&!!r.$metadata&&(r.$fault==="client"||r.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;let r=e;if(this===t)return t.isInstance(e);if(t.isInstance(e)){if(this.prototype.isPrototypeOf(e))return!0;let o=Object.prototype.hasOwnProperty.call(this,"shapeId")?this.shapeId:void 0,n=!1;if(o){let s=Object.getPrototypeOf(r);for(;s&&s!==Object.prototype;){let a=s.constructor,c=a!==t&&Object.prototype.hasOwnProperty.call(a,"shapeId")?a?.shapeId:void 0;if(c&&(n=!0,c===o))return!0;s=Object.getPrototypeOf(s)}}if(o&&n)return!1;let i=this.name;if(i&&i.length>=6){if(r.name===i)return!0;let s=Object.getPrototypeOf(r);for(;s&&s!==Object.prototype;){let a=s.constructor?.name;if(a&&a!=="Error"&&a===i)return!0;s=Object.getPrototypeOf(s)}}}return!1}},al=(t,e={})=>{Object.entries(e).filter(([,o])=>o!==void 0).forEach(([o,n])=>{(t[o]==null||t[o]==="")&&(t[o]=n)});let r=t.message||t.Message||"UnknownError";return t.message=r,delete t.Message,t}});var SD,_3,Bve,S3=v(()=>{_D();SD=({output:t,parsedBody:e,exceptionCtor:r,errorCode:o})=>{let n=Bve(t),i=n.httpStatusCode?n.httpStatusCode+"":void 0,s=new r({name:e?.code||e?.Code||o||i||"UnknownError",$fault:"client",$metadata:n});throw al(s,e)},_3=t=>({output:e,parsedBody:r,errorCode:o})=>{SD({output:e,parsedBody:r,exceptionCtor:t,errorCode:o})},Bve=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]})});var cs,x3=v(()=>{cs=t=>{switch(t){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}}});var E3,us,k3=v(()=>{E3=!1,us=t=>{t&&!E3&&parseInt(t.substring(1,t.indexOf(".")))<16&&(E3=!0)}});var cl,I3,N0,D0,xD=v(()=>{he();cl=St(is()),I3=Object.values(cl.AlgorithmId),N0=t=>{let e=[];for(let r in cl.AlgorithmId){if(!ce(cl.AlgorithmId,r))continue;let o=cl.AlgorithmId[r];t[o]!==void 0&&e.push({algorithmId:()=>o,checksumConstructor:()=>t[o]})}for(let[r,o]of Object.entries(t.checksumAlgorithms??{}))e.push({algorithmId:()=>r,checksumConstructor:()=>o});return{addChecksumAlgorithm(r){t.checksumAlgorithms=t.checksumAlgorithms??{};let o=r.algorithmId(),n=r.checksumConstructor();I3.includes(o)?t.checksumAlgorithms[o.toUpperCase()]=n:t.checksumAlgorithms[o]=n,e.push(r)},checksumAlgorithms(){return e}}},D0=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{let o=r.algorithmId();I3.includes(o)&&(e[o]=r.checksumConstructor())}),e}});var z0,j0,ED=v(()=>{z0=t=>({setRetryStrategy(e){t.retryStrategy=e},retryStrategy(){return t.retryStrategy}}),j0=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var fi,$3,ls,A3=v(()=>{xD();ED();fi=t=>Object.assign(N0(t),z0(t)),$3=fi,ls=t=>Object.assign(D0(t),j0(t))});var T3,P3=v(()=>{T3=t=>Array.isArray(t)?t:[t]});var ul,R3=v(()=>{he();ul=t=>{let e="#text";for(let r in t)ce(t,r)&&(t[r][e]!==void 0?t[r]=t[r][e]:typeof t[r]=="object"&&t[r]!==null&&(t[r]=ul(t[r])));return t}});var C3,O3=v(()=>{C3=t=>t!=null});var Cn,N3=v(()=>{Cn=class{trace(){}debug(){}info(){}warn(){}error(){}}});function kD(t,e,r){let o,n,i;if(typeof e>"u"&&typeof r>"u")o={},i=t;else{if(o=t,typeof e=="function")return n=e,i=r,Kve(o,n,i);i=e}for(let s in i)if(ce(i,s)){if(!Array.isArray(i[s])){o[s]=i[s];continue}j3(o,null,i,s)}return o}var D3,z3,Kve,j3,qve,Zve,M3=v(()=>{he();D3=t=>{let e={};for(let[r,o]of Object.entries(t||{}))e[r]=[,o];return e},z3=(t,e)=>{let r={};for(let o in e)ce(e,o)&&j3(r,t,e,o);return r},Kve=(t,e,r)=>kD(t,Object.entries(r).reduce((o,[n,i])=>(Array.isArray(i)?o[n]=i:typeof i=="function"?o[n]=[e,i()]:o[n]=[e,i],o),{})),j3=(t,e,r,o)=>{if(e!==null){let s=r[o];typeof s=="function"&&(s=[,s]);let[a=qve,c=Zve,u=o]=s;(typeof a=="function"&&a(e[u])||typeof a!="function"&&a)&&(t[o]=c(e[u]));return}let[n,i]=r[o];if(typeof i=="function"){let s,a=n===void 0&&(s=i())!=null,c=typeof n=="function"&&!!n(void 0)||typeof n!="function"&&!!n;a?t[o]=s:c&&(t[o]=i())}else{let s=n===void 0&&i!=null,a=typeof n=="function"&&!!n(i)||typeof n!="function"&&!!n;(s||a)&&(t[o]=i)}},qve=t=>t!=null,Zve=t=>t});var U3,L3,F3=v(()=>{U3=t=>{if(t!==t)return"NaN";switch(t){case 1/0:return"Infinity";case-1/0:return"-Infinity";default:return t}},L3=t=>t.toISOString().replace(".000Z","Z")});var M0,V3=v(()=>{he();M0=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(M0);if(typeof t=="object"){let e={};for(let r in t)ce(t,r)&&t[r]!=null&&(e[r]=M0(t[r]));return e}return t}});function ds(t,e,r,o){return function(i,s,a,c,u={}){let l=Object.assign({},t,i);return mn.classBuilder().ep(l).m(function(d,f,p,m){let g=s.call(this,d,f,p,m);return g.unshift(o(p,d.getEndpointParameterInstructions())),g}).s(e,a,u).n(r,a.charAt(0).toUpperCase()+a.slice(1)+"Command").sc(c).build()}}var H3=v(()=>{bD()});var U0={};yt(U0,{AlgorithmId:()=>cl.AlgorithmId,Client:()=>Jr,Command:()=>mn,NoOpLogger:()=>Cn,SENSITIVE_STRING:()=>v3,ServiceException:()=>Io,WaiterState:()=>Yn,_json:()=>M0,checkExceptions:()=>FZ,constructStack:()=>vc,convertMap:()=>D3,createAggregatedClient:()=>as,createWaiter:()=>ZZ,decorateServiceException:()=>al,emitWarningIfUnsupportedVersion:()=>us,getArrayIfSingleItem:()=>T3,getChecksumConfiguration:()=>N0,getDefaultClientConfiguration:()=>$3,getDefaultExtensionConfiguration:()=>fi,getRetryConfiguration:()=>z0,getSmithyContext:()=>wt,getValueFromTextNode:()=>ul,invalidFunction:()=>DZ,invalidProvider:()=>jZ,isSerializableHeaderValue:()=>C3,loadConfigsForDefaultMode:()=>cs,makeBuilder:()=>ds,map:()=>kD,normalizeProvider:()=>lt,resolveChecksumRuntimeConfig:()=>D0,resolveDefaultRuntimeConfig:()=>ls,resolveRetryRuntimeConfig:()=>j0,schemaLogFilter:()=>Tp,serializeDateTime:()=>L3,serializeFloat:()=>U3,take:()=>z3,throwDefaultError:()=>SD,waiterServiceDefaults:()=>R0,withBaseException:()=>_3});var le=v(()=>{P0();he();he();zZ();MZ();WZ();C0();JZ();bD();w3();b3();S3();x3();k3();_D();A3();xD();ED();P3();R3();O3();N3();M3();yD();F3();V3();H3()});var L0,ID=v(()=>{L0=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var mi,bc,_c=v(()=>{ID();mi=(t,e=0,r=t.byteLength-e)=>{if(!L0(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return Buffer.from(t,e,r)},bc=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?Buffer.from(t,e):Buffer.from(t)}});var Wve,Mt,B3=v(()=>{_c();Wve=/^[A-Za-z0-9+/]*={0,2}$/,Mt=t=>{if(t.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!Wve.exec(t))throw new TypeError("Invalid base64 string.");let e=bc(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}});var or,F0=v(()=>{_c();or=t=>{let e=bc(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)}});var _t,$D=v(()=>{_c();F0();_t=t=>{let e;if(typeof t=="string"?e=or(t):e=t,typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return mi(e.buffer,e.byteOffset,e.byteLength).toString("base64")}});function K3(t,e,r,o){return class V0 extends Uint8Array{static fromString(i,s="utf-8"){if(typeof i=="string")return s==="base64"?V0.mutate(o(i)):V0.mutate(e(i));throw new Error(`Unsupported conversion from ${typeof i} to Uint8ArrayBlobAdapter.`)}static mutate(i){return Object.setPrototypeOf(i,V0.prototype),i}transformToString(i="utf-8"){return i==="base64"?r(this):t(this)}}}var q3=v(()=>{});var Dt,Z3=v(()=>{_c();Dt=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return mi(t.buffer,t.byteOffset,t.byteLength).toString("utf8")}});function W3(t){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?()=>crypto.randomUUID():()=>{let e=new Uint8Array(16);return t(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,Gr[e[0]]+Gr[e[1]]+Gr[e[2]]+Gr[e[3]]+"-"+Gr[e[4]]+Gr[e[5]]+"-"+Gr[e[6]]+Gr[e[7]]+"-"+Gr[e[8]]+Gr[e[9]]+"-"+Gr[e[10]]+Gr[e[11]]+Gr[e[12]]+Gr[e[13]]+Gr[e[14]]+Gr[e[15]]}}var Gr,J3=v(()=>{Gr=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"))});var G3,X3=v(()=>{G3=(t,e,r=o=>o)=>t});var Y3,Q3,Pp,Jve,Gg,Rp,eW,H0,B0,K0,AD,Gve,tW,TD,rW,Z0,Xg,nW,W0,Xve,Op,J0,oW,iW,sW,aW,PD,cW,uW,Sc,G0,q0,Cp,RD=v(()=>{he();Y3=t=>{switch(t){case"true":return!0;case"false":return!1;default:throw new Error(`Unable to parse boolean value "${t}"`)}},Q3=t=>{if(t!=null){if(typeof t=="number"){if((t===0||t===1)&&Cp.warn(q0(`Expected boolean, got ${typeof t}: ${t}`)),t===0)return!1;if(t===1)return!0}if(typeof t=="string"){let e=t.toLowerCase();if((e==="false"||e==="true")&&Cp.warn(q0(`Expected boolean, got ${typeof t}: ${t}`)),e==="false")return!1;if(e==="true")return!0}if(typeof t=="boolean")return t;throw new TypeError(`Expected boolean, got ${typeof t}: ${t}`)}},Pp=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&Cp.warn(q0(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},Jve=Math.ceil(2**127*(2-2**-23)),Gg=t=>{let e=Pp(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>Jve)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},Rp=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},eW=Rp,H0=t=>AD(t,32),B0=t=>AD(t,16),K0=t=>AD(t,8),AD=(t,e)=>{let r=Rp(t);if(r!==void 0&&Gve(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},Gve=(t,e)=>{switch(e){case 32:return Int32Array.of(t)[0];case 16:return Int16Array.of(t)[0];case 8:return Int8Array.of(t)[0]}},tW=(t,e)=>{if(t==null)throw e?new TypeError(`Expected a non-null value for ${e}`):new TypeError("Expected a non-null value");return t},TD=t=>{if(t==null)return;if(typeof t=="object"&&!Array.isArray(t))return t;let e=Array.isArray(t)?"array":typeof t;throw new TypeError(`Expected object, got ${e}: ${t}`)},rW=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return Cp.warn(q0(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},Z0=t=>{if(t==null)return;let e=TD(t),r=[];for(let o in e)ce(e,o)&&e[o]!=null&&r.push(o);if(r.length===0)throw new TypeError("Unions must have exactly one non-null member. None were found.");if(r.length>1)throw new TypeError(`Unions must have exactly one non-null member. Keys ${r} were not null.`);return e},Xg=t=>Pp(typeof t=="string"?Op(t):t),nW=Xg,W0=t=>Gg(typeof t=="string"?Op(t):t),Xve=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Op=t=>{let e=t.match(Xve);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},J0=t=>typeof t=="string"?aW(t):Pp(t),oW=J0,iW=J0,sW=t=>typeof t=="string"?aW(t):Gg(t),aW=t=>{switch(t){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw new Error(`Unable to parse float value: ${t}`)}},PD=t=>Rp(typeof t=="string"?Op(t):t),cW=PD,uW=t=>H0(typeof t=="string"?Op(t):t),Sc=t=>B0(typeof t=="string"?Op(t):t),G0=t=>K0(typeof t=="string"?Op(t):t),q0=t=>String(new TypeError(t).stack||t).split(`
12
12
  `).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
13
13
  `),Cp={warn:console.warn}});function Qn(t){let e=t.getUTCFullYear(),r=t.getUTCMonth(),o=t.getUTCDay(),n=t.getUTCDate(),i=t.getUTCHours(),s=t.getUTCMinutes(),a=t.getUTCSeconds(),c=n<10?`0${n}`:`${n}`,u=i<10?`0${i}`:`${i}`,l=s<10?`0${s}`:`${s}`,d=a<10?`0${a}`:`${a}`;return`${Yve[o]}, ${c} ${OD[r]} ${e} ${u}:${l}:${d} GMT`}var Yve,OD,Qve,lW,ewe,Dp,twe,rwe,nwe,xc,zp,Yg,owe,iwe,swe,CD,awe,cwe,uwe,ps,lwe,dwe,Np,dW=v(()=>{RD();Yve=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],OD=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Qve=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),lW=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Qve.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,o,n,i,s,a,c,u]=e,l=Sc(Np(o)),d=ps(n,"month",1,12),f=ps(i,"day",1,31);return Yg(l,d,f,{hours:s,minutes:a,seconds:c,fractionalMilliseconds:u})},ewe=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}:\d{2})|[zZ])$/),Dp=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=ewe.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,o,n,i,s,a,c,u,l]=e,d=Sc(Np(o)),f=ps(n,"month",1,12),p=ps(i,"day",1,31),m=Yg(d,f,p,{hours:s,minutes:a,seconds:c,fractionalMilliseconds:u});return l.toUpperCase()!="Z"&&m.setTime(m.getTime()-dwe(l)),m},twe=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),rwe=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),nwe=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),xc=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let e=twe.exec(t);if(e){let[r,o,n,i,s,a,c,u]=e;return Yg(Sc(Np(i)),CD(n),ps(o,"day",1,31),{hours:s,minutes:a,seconds:c,fractionalMilliseconds:u})}if(e=rwe.exec(t),e){let[r,o,n,i,s,a,c,u]=e;return swe(Yg(owe(i),CD(n),ps(o,"day",1,31),{hours:s,minutes:a,seconds:c,fractionalMilliseconds:u}))}if(e=nwe.exec(t),e){let[r,o,n,i,s,a,c,u]=e;return Yg(Sc(Np(u)),CD(o),ps(n.trimLeft(),"day",1,31),{hours:i,minutes:s,seconds:a,fractionalMilliseconds:c})}throw new TypeError("Invalid RFC-7231 date-time value")},zp=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=Xg(t);else if(typeof t=="object"&&t.tag===1)e=t.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(e)||e===1/0||e===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(e*1e3))},Yg=(t,e,r,o)=>{let n=e-1;return cwe(t,n,r),new Date(Date.UTC(t,n,r,ps(o.hours,"hour",0,23),ps(o.minutes,"minute",0,59),ps(o.seconds,"seconds",0,60),lwe(o.fractionalMilliseconds)))},owe=t=>{let e=new Date().getUTCFullYear(),r=Math.floor(e/100)*100+Sc(Np(t));return r<e?r+100:r},iwe=50*365*24*60*60*1e3,swe=t=>t.getTime()-new Date().getTime()>iwe?new Date(Date.UTC(t.getUTCFullYear()-100,t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds())):t,CD=t=>{let e=OD.indexOf(t);if(e<0)throw new TypeError(`Invalid month: ${t}`);return e+1},awe=[31,28,31,30,31,30,31,31,30,31,30,31],cwe=(t,e,r)=>{let o=awe[e];if(e===1&&uwe(t)&&(o=29),r>o)throw new TypeError(`Invalid day for ${OD[e]} in ${t}: ${r}`)},uwe=t=>t%4===0&&(t%100!==0||t%400===0),ps=(t,e,r,o)=>{let n=G0(Np(t));if(n<r||n>o)throw new TypeError(`${e} must be between ${r} and ${o}, inclusive`);return n},lwe=t=>t==null?0:W0("0."+t)*1e3,dwe=t=>{let e=t[0],r=1;if(e=="+")r=1;else if(e=="-")r=-1;else throw new TypeError(`Offset direction, ${e}, must be "+" or "-"`);let o=Number(t.substring(1,3)),n=Number(t.substring(4,6));return r*(o*60+n)*60*1e3},Np=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var Zt,pW=v(()=>{Zt=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};Zt.from=t=>t&&typeof t=="object"&&(t instanceof Zt||"deserializeJSON"in t)?t:typeof t=="string"||Object.getPrototypeOf(t)===String.prototype?Zt(String(t)):Zt(JSON.stringify(t));Zt.fromObject=Zt.from});function X0(t){return(t.includes(",")||t.includes('"'))&&(t=`"${t.replace(/"/g,'\\"')}"`),t}var fW=v(()=>{});function ga(t,e,r){let o=Number(t);if(o<e||o>r)throw new Error(`Value ${o} out of range [${e}, ${r}]`)}var ND,DD,zD,mW,hW,pwe,fwe,mwe,hwe,gwe,Ec,Y0,Q0,gW=v(()=>{ND="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",DD="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",zD="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",mW="(\\d?\\d)",hW="(\\d{4})",pwe=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),fwe=new RegExp(`^${ND}, ${mW} ${DD} ${hW} ${zD} GMT$`),mwe=new RegExp(`^${ND}, ${mW}-${DD}-(\\d\\d) ${zD} GMT$`),hwe=new RegExp(`^${ND} ${DD} ( [1-9]|\\d\\d) ${zD} ${hW}$`),gwe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ec=t=>{if(t==null)return;let e=NaN;if(typeof t=="number")e=t;else if(typeof t=="string"){if(!/^-?\d*\.?\d+$/.test(t))throw new TypeError("parseEpochTimestamp - numeric string invalid.");e=Number.parseFloat(t)}else typeof t=="object"&&t.tag===1&&(e=t.value);if(isNaN(e)||Math.abs(e)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(e*1e3))},Y0=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC3339 timestamps must be strings");let e=pwe.exec(t);if(!e)throw new TypeError(`Invalid RFC3339 timestamp format ${t}`);let[,r,o,n,i,s,a,,c,u]=e;ga(o,1,12),ga(n,1,31),ga(i,0,23),ga(s,0,59),ga(a,0,60);let l=new Date(Date.UTC(Number(r),Number(o)-1,Number(n),Number(i),Number(s),Number(a),Number(c)?Math.round(parseFloat(`0.${c}`)*1e3):0));if(l.setUTCFullYear(Number(r)),u.toUpperCase()!="Z"){let[,d,f,p]=/([+-])(\d\d):(\d\d)/.exec(u)||[void 0,"+",0,0],m=d==="-"?1:-1;l.setTime(l.getTime()+m*(Number(f)*60*60*1e3+Number(p)*60*1e3))}return l},Q0=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC7231 timestamps must be strings.");let e,r,o,n,i,s,a,c;if((c=fwe.exec(t))?[,e,r,o,n,i,s,a]=c:(c=mwe.exec(t))?([,e,r,o,n,i,s,a]=c,o=(Number(o)+1900).toString()):(c=hwe.exec(t))&&([,r,e,n,i,s,a,o]=c),o&&s){let u=Date.UTC(Number(o),gwe.indexOf(r),Number(e),Number(n),Number(i),Number(s),a?Math.round(parseFloat(`0.${a}`)*1e3):0);ga(e,1,31),ga(n,0,23),ga(i,0,59),ga(s,0,60);let l=new Date(u);return l.setUTCFullYear(Number(o)),l}throw new TypeError(`Invalid RFC7231 date-time value ${t}.`)}});function eE(t,e,r){if(r<=0||!Number.isInteger(r))throw new Error("Invalid number of delimiters ("+r+") for splitEvery.");let o=t.split(e);if(r===1)return o;let n=[],i="";for(let s=0;s<o.length;s++)i===""?i=o[s]:i+=e+o[s],(s+1)%r===0&&(n.push(i),i="");return i!==""&&n.push(i),n}var yW=v(()=>{});var jp,vW=v(()=>{jp=t=>{let e=t.length,r=[],o=!1,n,i=0;for(let s=0;s<e;++s){let a=t[s];switch(a){case'"':n!=="\\"&&(o=!o);break;case",":o||(r.push(t.slice(i,s)),i=s+1);break;default:}n=a}return r.push(t.slice(i)),r.map(s=>{s=s.trim();let a=s.length;return a<2?s:(s[0]==='"'&&s[a-1]==='"'&&(s=s.slice(1,a-1)),s.replace(/\\"/g,'"'))})}});function tE(t){return new Ne(String(t),"bigDecimal")}var wW,Ne,bW=v(()=>{wW=/^-?((0|[1-9]\d*)(\.\d+)?|\.\d+)([eE][+-]?\d+)?$/,Ne=class t{string;type;constructor(e,r){if(this.string=e,this.type=r,!wW.test(e))throw new Error(`@smithy/core/serde - NumericValue string must conform to the Smithy bigDecimal format. Received: "${e}"`)}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||typeof e!="object")return!1;let r=e;return t.prototype.isPrototypeOf(e)||r.type==="bigDecimal"&&wW.test(r.string)}}});function rE(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2){let o=t.slice(r,r+2).toLowerCase();if(o in jD)e[r/2]=jD[o];else throw new Error(`Cannot decode unrecognized sequence ${o} as hexadecimal`)}return e}function $o(t){let e="";for(let r=0;r<t.byteLength;r++)e+=_W[t[r]];return e}var _W,jD,MD=v(()=>{_W={},jD={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),_W[t]=e,jD[e]=t}});import{ReadStream as ywe,fstatSync as vwe,lstatSync as wwe}from"node:fs";var fs,SW=v(()=>{fs=t=>{if(!t)return 0;if(typeof t=="string")return Buffer.byteLength(t);if(typeof t.byteLength=="number")return t.byteLength;if(typeof t.size=="number")return t.size;if(typeof t.start=="number"&&typeof t.end=="number")return t.end+1-t.start;if(t instanceof ywe){if(t.path!=null)return wwe(t.path).size;if(typeof t.fd=="number")return vwe(t.fd).size}throw new Error(`Body Length computation failed for ${t}`)}});var hn,UD=v(()=>{F0();hn=t=>t instanceof Uint8Array?t:typeof t=="string"?or(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});function ms(t,e){if(e===void 0){e=0;for(let n of t)e+=n.byteLength}let r=new Uint8Array(e),o=0;for(let n of t)r.set(n,o),o+=n.byteLength;return r}var Qg=v(()=>{});var nE,LD,FD=v(()=>{he();nE=(t,e)=>(r,o)=>async n=>{let{response:i}=await r(n);try{let s=await e(i,t);return{response:i,output:s}}catch(s){if(Object.defineProperty(s,"$response",{value:i,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in s)){let a="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{s.message+=`
14
- `+a}catch{!o.logger||o.logger?.constructor?.name==="NoOpLogger"?console.warn(a):o.logger?.warn?.(a)}typeof s.$responseBodyText<"u"&&s.$response&&(s.$response.body=s.$responseBodyText);try{if(ur.isInstance(i)){let{headers:c={}}=i,u=Object.entries(c);s.$metadata={httpStatusCode:i.statusCode,requestId:LD(/^x-[\w-]+-request-?id$/,u),extendedRequestId:LD(/^x-[\w-]+-id-2$/,u),cfId:LD(/^x-[\w-]+-cf-id$/,u)}}}catch{}}throw s}},LD=(t,e)=>(e.find(([r])=>r.match(t))||[void 0,void 0])[1]});var eo,ey=v(()=>{eo=class t extends Error{name="ProviderError";tryNextLink;constructor(e,r=!0){let o,n=!0;typeof r=="boolean"?(o=void 0,n=r):r!=null&&typeof r=="object"&&(o=r.logger,n=r.tryNextLink??!0),super(e),this.tryNextLink=n,Object.setPrototypeOf(this,t.prototype),o?.debug?.(`@smithy/property-provider ${n?"->":"(!)"} ${e}`)}static from(e,r=!0){return Object.assign(new this(e.message,r),e)}}});var kc,oE=v(()=>{ey();kc=class t extends eo{name="CredentialsProviderError";constructor(e,r=!0){super(e,r),Object.setPrototypeOf(this,t.prototype)}}});var iE,xW=v(()=>{ey();iE=class t extends eo{name="TokenProviderError";constructor(e,r=!0){super(e,r),Object.setPrototypeOf(this,t.prototype)}}});var sE,VD=v(()=>{ey();sE=(...t)=>async()=>{if(t.length===0)throw new eo("No providers in chain");let e;for(let r of t)try{return await r()}catch(o){if(e=o,o?.tryNextLink)continue;throw o}throw e}});var aE,HD=v(()=>{aE=t=>()=>Promise.resolve(t)});var Mp,cE=v(()=>{Mp=(t,e,r)=>{let o,n,i,s=!1,a=async()=>{n||(n=t());try{o=await n,i=!0,s=!1}finally{n=void 0}return o};return e===void 0?async c=>((!i||c?.forceRefresh)&&(o=await a()),o):async c=>((!i||c?.forceRefresh)&&(o=await a()),s?o:r&&!r(o)?(s=!0,o):(e(o)&&await a(),o))}});var lr,uE=v(()=>{lr=(t,e,r)=>{if(e in t){if(t[e]==="true")return!0;if(t[e]==="false")return!1;throw new Error(`Cannot load ${r} "${e}". Expected "true" or "false", got ${t[e]}.`)}}});var EW,kW=v(()=>{EW=(t,e,r)=>{if(!(e in t))return;let o=parseInt(t[e],10);if(Number.isNaN(o))throw new TypeError(`Cannot load ${r} '${e}'. Expected number, got '${t[e]}'.`);return o}});var Wt,lE=v(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(Wt||(Wt={}))});import{homedir as bwe}from"node:os";import{sep as _we}from"node:path";var BD,Swe,hs,Up=v(()=>{BD={},Swe=()=>process&&process.geteuid?`${process.geteuid()}`:"DEFAULT",hs=()=>{let{HOME:t,USERPROFILE:e,HOMEPATH:r,HOMEDRIVE:o=`C:${_we}`}=process.env;if(t)return t;if(e)return e;if(r)return`${o}${r}`;let n=Swe();return BD[n]||(BD[n]=bwe()),BD[n]}});var KD,qD,dE,ZD=v(()=>{KD="AWS_PROFILE",qD="default",dE=t=>t.profile||process.env[KD]||qD});import{createHash as xwe}from"node:crypto";import{join as Ewe}from"node:path";var pE,WD=v(()=>{Up();pE=t=>{let r=xwe("sha1").update(t).digest("hex");return Ewe(hs(),".aws","sso","cache",`${r}.json`)}});import{readFile as kwe}from"node:fs/promises";var ty,IW,JD=v(()=>{WD();ty={},IW=async t=>{if(ty[t])return ty[t];let e=pE(t),r=await kwe(e,"utf8");return JSON.parse(r)}});var gs,$W=v(()=>{gs="."});var GD,AW,TW=v(()=>{GD=St(is()),AW=t=>Object.entries(t).filter(([e])=>{let r=e.indexOf(".");return r===-1?!1:Object.values(GD.IniSectionType).includes(e.substring(0,r))}).reduce((e,[r,o])=>{let n=r.indexOf("."),i=r.substring(0,n)===GD.IniSectionType.PROFILE?r.substring(n+1):r;return e[i]=o,e},{...t.default&&{default:t.default}})});import{join as Iwe}from"node:path";var $we,fE,XD=v(()=>{Up();$we="AWS_CONFIG_FILE",fE=()=>process.env[$we]||Iwe(hs(),".aws","config")});import{join as Awe}from"node:path";var Twe,PW,RW=v(()=>{Up();Twe="AWS_SHARED_CREDENTIALS_FILE",PW=()=>process.env[Twe]||Awe(hs(),".aws","credentials")});var CW,Pwe,Rwe,ry,YD=v(()=>{CW=St(is()),Pwe=/^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/,Rwe=["__proto__","profile __proto__"],ry=t=>{let e={},r,o;for(let n of t.split(/\r?\n/)){let i=n.split(/(^|\s)[;#]/)[0].trim();if(i[0]==="["&&i[i.length-1]==="]"){r=void 0,o=void 0;let a=i.substring(1,i.length-1),c=Pwe.exec(a);if(c){let[,u,,l]=c;Object.values(CW.IniSectionType).includes(u)&&(r=[u,l].join("."))}else r=a;if(Rwe.includes(a))throw new Error(`Found invalid profile name "${a}"`)}else if(r){let a=i.indexOf("=");if(![0,-1].includes(a)){let[c,u]=[i.substring(0,a).trim(),i.substring(a+1).trim()];if(u==="")o=c;else{o&&n.trimStart()===n&&(o=void 0),e[r]=e[r]||{};let l=o?[o,c].join("."):c;e[r][l]=u}}}}return e}});import{readFile as Cwe}from"node:fs/promises";var QD,ny,ll,oy=v(()=>{QD={},ny={},ll=(t,e)=>ny[t]!==void 0?ny[t]:((!QD[t]||e?.ignoreCache)&&(QD[t]=Cwe(t,"utf8")),QD[t])});import{join as OW}from"node:path";var NW,Lp,mE=v(()=>{TW();XD();RW();Up();YD();oy();NW=()=>({}),Lp=async(t={})=>{let{filepath:e=PW(),configFilepath:r=fE()}=t,o=hs(),n="~/",i=e;e.startsWith(n)&&(i=OW(o,e.slice(2)));let s=r;r.startsWith(n)&&(s=OW(o,r.slice(2)));let a=await Promise.all([ll(s,{ignoreCache:t.ignoreCache}).then(ry).then(AW).catch(NW),ll(i,{ignoreCache:t.ignoreCache}).then(ry).catch(NW)]);return{configFile:a[0],credentialsFile:a[1]}}});var DW,zW,jW=v(()=>{DW=St(is()),zW=t=>Object.entries(t).filter(([e])=>e.startsWith(DW.IniSectionType.SSO_SESSION+".")).reduce((e,[r,o])=>({...e,[r.substring(r.indexOf(".")+1)]:o}),{})});var Owe,MW,UW=v(()=>{XD();jW();YD();oy();Owe=()=>({}),MW=async(t={})=>ll(t.configFilepath??fE()).then(ry).then(zW).catch(Owe)});var LW,FW=v(()=>{LW=(...t)=>{let e={};for(let r of t)for(let[o,n]of Object.entries(r))e[o]!==void 0?Object.assign(e[o],n):e[o]=n;return e}});var VW,HW=v(()=>{mE();FW();VW=async t=>{let e=await Lp(t);return LW(e.configFile,e.credentialsFile)}});var BW,KW=v(()=>{JD();oy();BW={getFileRecord(){return ny},interceptFile(t,e){ny[t]=Promise.resolve(e)},getTokenRecord(){return ty},interceptToken(t,e){ty[t]=e}}});function hE(t){try{let e=new Set(Array.from(t.match(/([A-Z_]){3,}/g)??[]));return e.delete("CONFIG"),e.delete("CONFIG_PREFIX_SEPARATOR"),e.delete("ENV"),[...e].join(", ")}catch{return t}}var ez=v(()=>{});var qW,ZW=v(()=>{oE();ez();qW=(t,e)=>async()=>{try{let r=t(process.env,e);if(r===void 0)throw new Error;return r}catch(r){throw new kc(r.message||`Not found in ENV: ${hE(t.toString())}`,{logger:e?.logger})}}});var WW,JW=v(()=>{oE();ZD();mE();ez();WW=(t,{preferredFile:e="config",...r}={})=>async()=>{let o=dE(r),{configFile:n,credentialsFile:i}=await Lp(r),s=i[o]||{},a=n[o]||{},c=e==="config"?{...s,...a}:{...a,...s};try{let l=t(c,e==="config"?n:i);if(l===void 0)throw new Error;return l}catch(u){throw new kc(u.message||`Not found in config files w/ profile [${o}]: ${hE(t.toString())}`,{logger:r.logger})}}});var Nwe,gE,tz=v(()=>{HD();Nwe=t=>typeof t=="function",gE=t=>Nwe(t)?async()=>await t():aE(t)});var fe,rz=v(()=>{VD();cE();ZW();JW();tz();fe=({environmentVariableSelector:t,configFileSelector:e,default:r},o={})=>{let{signingName:n,logger:i}=o;return Mp(sE(qW(t,{signingName:n,logger:i}),WW(e,o),gE(r)))}});var yE,vE,GW,ys,XW,YW=v(()=>{uE();lE();yE="AWS_USE_DUALSTACK_ENDPOINT",vE="use_dualstack_endpoint",GW=!1,ys={environmentVariableSelector:t=>lr(t,yE,Wt.ENV),configFileSelector:t=>lr(t,vE,Wt.CONFIG),default:!1},XW={environmentVariableSelector:t=>lr(t,yE,Wt.ENV),configFileSelector:t=>lr(t,vE,Wt.CONFIG),default:void 0}});var wE,bE,QW,vs,e9,t9=v(()=>{uE();lE();wE="AWS_USE_FIPS_ENDPOINT",bE="use_fips_endpoint",QW=!1,vs={environmentVariableSelector:t=>lr(t,wE,Wt.ENV),configFileSelector:t=>lr(t,bE,Wt.CONFIG),default:!1},e9={environmentVariableSelector:t=>lr(t,wE,Wt.ENV),configFileSelector:t=>lr(t,bE,Wt.CONFIG),default:void 0}});var r9,n9=v(()=>{le();r9=t=>{let{tls:e,endpoint:r,urlParser:o,useDualstackEndpoint:n}=t;return Object.assign(t,{tls:e??!0,endpoint:lt(typeof r=="string"?o(r):r),isCustomEndpoint:!0,useDualstackEndpoint:lt(n??!1)})}});var o9,i9=v(()=>{o9=async t=>{let{tls:e=!0}=t,r=await t.region();if(!new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/).test(r))throw new Error("Invalid region in client config");let n=await t.useDualstackEndpoint(),i=await t.useFipsEndpoint(),{hostname:s}=await t.regionInfoProvider(r,{useDualstackEndpoint:n,useFipsEndpoint:i})??{};if(!s)throw new Error("Cannot resolve hostname from client config");return t.urlParser(`${e?"https:":"http:"}//${s}`)}});var s9,a9=v(()=>{le();i9();s9=t=>{let e=lt(t.useDualstackEndpoint??!1),{endpoint:r,useFipsEndpoint:o,urlParser:n,tls:i}=t;return Object.assign(t,{tls:i??!0,endpoint:r?lt(typeof r=="string"?n(r):r):()=>o9({...t,useDualstackEndpoint:e,useFipsEndpoint:o}),isCustomEndpoint:!!r,useDualstackEndpoint:e})}});var c9,nz,oz,u9,l9,d9,p9,f9,m9,iz=v(()=>{c9="AWS_EXECUTION_ENV",nz="AWS_REGION",oz="AWS_DEFAULT_REGION",u9="AWS_EC2_METADATA_DISABLED",l9=["in-region","cross-region","mobile","standard","legacy"],d9="/latest/meta-data/placement/region",p9="/latest/api/token",f9="x-aws-ec2-metadata-token",m9="x-aws-ec2-metadata-token-ttl-seconds"});var h9,Dwe,v9,_E,g9,zwe,y9,sz=v(()=>{iz();h9=1e3,Dwe=6e4,v9=0,_E=async()=>{if(!process.env[u9]&&!(Date.now()<v9))try{let t=zwe(),e=(await y9({...t,path:p9,method:"PUT",headers:{[m9]:"21600"}})).toString();return(await y9({...t,path:d9,method:"GET",headers:{[f9]:e}})).toString().trim()||g9()}catch{return g9()}},g9=()=>{v9=Date.now()+Dwe},zwe=()=>{let t=process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT;if(t){let e=new URL(t);return{hostname:e.hostname.replace(/^\[(.+)]$/,"$1"),port:e.port?Number(e.port):void 0}}return process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE==="IPv6"?{hostname:"fd00:ec2::254"}:{hostname:"169.254.169.254"}},y9=async t=>{let{request:e}=await import("node:http");return new Promise((r,o)=>{let n=e({hostname:t.hostname,port:t.port,path:t.path,method:t.method,headers:t.headers,timeout:h9,signal:AbortSignal.timeout(h9)});n.on("error",i=>{o(i),n.destroy()}),n.on("timeout",()=>{o(new Error("TimeoutError from instance metadata service")),n.destroy()}),n.on("response",i=>{let{statusCode:s=400}=i;if(s<200||s>=300){o(Object.assign(new Error("Error response received from instance metadata service"),{statusCode:s})),n.destroy();return}let a=[];i.on("data",c=>a.push(c)),i.on("end",()=>{r(Buffer.concat(a)),n.destroy()})}),n.end()})}});var Fp,Vp,$r,gn,az=v(()=>{sz();Fp="AWS_REGION",Vp="region",$r={environmentVariableSelector:t=>t[Fp],configFileSelector:t=>t[Vp],default:async()=>{let t=await _E();if(t)return t;throw new Error("Region is missing")}},gn={preferredFile:"credentials"}});var w9,b9,_9=v(()=>{he();w9=new Set,b9=(t,e=di)=>{if(!w9.has(t)&&!e(t))if(t==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${t}" is not a valid hostname component.`);else w9.add(t)}});var SE,cz=v(()=>{SE=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var S9,x9=v(()=>{cz();S9=t=>SE(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var to,E9=v(()=>{_9();x9();cz();to=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return Object.assign(t,{region:async()=>{let o=typeof e=="function"?await e():e,n=S9(o);return b9(n),n},useFipsEndpoint:async()=>{let o=typeof e=="string"?e:await e();return SE(o)?!0:typeof r!="function"?Promise.resolve(!!r):r()}})}});var uz,k9=v(()=>{uz=(t=[],{useFipsEndpoint:e,useDualstackEndpoint:r})=>t.find(({tags:o})=>e===o.includes("fips")&&r===o.includes("dualstack"))?.hostname});var I9,$9=v(()=>{I9=(t,{regionHostname:e,partitionHostname:r})=>e||(r?r.replace("{region}",t):void 0)});var A9,T9=v(()=>{A9=(t,{partitionHash:e})=>Object.keys(e||{}).find(r=>e[r].regions.includes(t))??"aws"});var P9,R9=v(()=>{P9=(t,{signingRegion:e,regionRegex:r,useFipsEndpoint:o})=>{if(e)return e;if(o){let n=r.replace("\\\\","\\").replace(/^\^/g,"\\.").replace(/\$$/g,"\\."),i=t.match(n);if(i)return i[0].slice(1,-1)}}});var C9,O9=v(()=>{k9();$9();T9();R9();C9=(t,{useFipsEndpoint:e=!1,useDualstackEndpoint:r=!1,signingService:o,regionHash:n,partitionHash:i})=>{let s=A9(t,{partitionHash:i}),a=t in n?t:i[s]?.endpoint??t,c={useFipsEndpoint:e,useDualstackEndpoint:r},u=uz(n[a]?.variants,c),l=uz(i[s]?.variants,c),d=I9(a,{regionHostname:u,partitionHostname:l});if(d===void 0)throw new Error(`Endpoint resolution failed for: ${{resolvedRegion:a,useFipsEndpoint:e,useDualstackEndpoint:r}}`);let f=P9(d,{signingRegion:n[a]?.signingRegion,regionRegex:i[s].regionRegex,useFipsEndpoint:e});return{partition:s,signingService:o,hostname:d,...f&&{signingRegion:f},...n[a]?.signingService&&{signingService:n[a].signingService}}}});var jwe,Mwe,N9,D9=v(()=>{jwe="AWS_DEFAULTS_MODE",Mwe="defaults_mode",N9={environmentVariableSelector:t=>t[jwe],configFileSelector:t=>t[Mwe],default:"legacy"}});var ws,Uwe,Lwe,z9=v(()=>{az();sz();rz();cE();iz();D9();ws=({region:t=fe($r),defaultsMode:e=fe(N9)}={})=>Mp(async()=>{let r=typeof e=="function"?await e():e;switch(r?.toLowerCase()){case"auto":return Uwe(t);case"in-region":case"cross-region":case"mobile":case"standard":case"legacy":return Promise.resolve(r?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${l9.join(", ")}, got ${r}`)}}),Uwe=async t=>{if(t){let e=typeof t=="function"?await t():t,r=await Lwe();return r?e===r?"in-region":"cross-region":"standard"}return"standard"},Lwe=async()=>process.env[c9]&&(process.env[nz]||process.env[oz])?process.env[nz]??process.env[oz]:_E()});var Ao={};yt(Ao,{CONFIG_PREFIX_SEPARATOR:()=>gs,CONFIG_USE_DUALSTACK_ENDPOINT:()=>vE,CONFIG_USE_FIPS_ENDPOINT:()=>bE,CredentialsProviderError:()=>kc,DEFAULT_PROFILE:()=>qD,DEFAULT_USE_DUALSTACK_ENDPOINT:()=>GW,DEFAULT_USE_FIPS_ENDPOINT:()=>QW,ENV_PROFILE:()=>KD,ENV_USE_DUALSTACK_ENDPOINT:()=>yE,ENV_USE_FIPS_ENDPOINT:()=>wE,NODE_REGION_CONFIG_FILE_OPTIONS:()=>gn,NODE_REGION_CONFIG_OPTIONS:()=>$r,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:()=>ys,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:()=>vs,ProviderError:()=>eo,REGION_ENV_NAME:()=>Fp,REGION_INI_NAME:()=>Vp,SelectorType:()=>Wt,TokenProviderError:()=>iE,booleanSelector:()=>lr,chain:()=>sE,externalDataInterceptor:()=>BW,fromStatic:()=>gE,fromValue:()=>aE,getHomeDir:()=>hs,getProfileName:()=>dE,getRegionInfo:()=>C9,getSSOTokenFilepath:()=>pE,getSSOTokenFromFile:()=>IW,loadConfig:()=>fe,loadSharedConfigFiles:()=>Lp,loadSsoSessionData:()=>MW,memoize:()=>Mp,nodeDualstackConfigSelectors:()=>XW,nodeFipsConfigSelectors:()=>e9,numberSelector:()=>EW,parseKnownFiles:()=>VW,readFile:()=>ll,resolveCustomEndpointsConfig:()=>r9,resolveDefaultsModeConfig:()=>ws,resolveEndpointsConfig:()=>s9,resolveRegionConfig:()=>to});var dt=v(()=>{ey();oE();xW();VD();HD();cE();uE();kW();lE();Up();ZD();WD();JD();$W();mE();UW();HW();KW();oy();rz();tz();YW();t9();n9();a9();az();E9();O9();z9()});var j9,M9,U9,L9=v(()=>{j9="AWS_ENDPOINT_URL",M9="endpoint_url",U9=t=>({environmentVariableSelector:e=>{let r=t.split(" ").map(i=>i.toUpperCase()),o=e[[j9,...r].join("_")];if(o)return o;let n=e[j9];if(n)return n},configFileSelector:(e,r)=>{if(e.services){let n=["services",e.services].join(".");if(!r||!r[n])throw new Error(`The services section "${e.services}" specified in the profile is not present in the shared configuration file.`);let i=r[n],s=t.split(" ").map(c=>c.toLowerCase()),a=i[[s.join("_"),M9].join(".")];if(a)return a}let o=e[M9];if(o)return o},default:void 0})});var Fwe,Vwe,F9,V9=v(()=>{dt();Fwe="AWS_IGNORE_CONFIGURED_ENDPOINT_URLS",Vwe="ignore_configured_endpoint_urls",F9={environmentVariableSelector:t=>lr(t,Fwe,Wt.ENV),configFileSelector:t=>lr(t,Vwe,Wt.CONFIG),default:!1}});var iy,H9=v(()=>{dt();L9();V9();iy=async t=>{if(!await fe(F9)())return fe(U9(t??""))()}});var lz,Hwe,Bwe,Kwe,B9,K9,q9=v(()=>{lz=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),K9(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!B9(e)||e.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(t.ForcePathStyle=!0);return t.DisableMultiRegionAccessPoints&&(t.disableMultiRegionAccessPoints=!0,t.DisableMRAP=!0),t},Hwe=/^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/,Bwe=/(\d+\.){3}\d+/,Kwe=/\.\./,B9=t=>Hwe.test(t)&&!Bwe.test(t)&&!Kwe.test(t),K9=t=>{let[e,r,o,,,n]=t.split(":"),i=e==="arn"&&t.split(":").length>=6,s=!!(i&&r&&o&&n);if(i&&!s)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return s}});var Z9=v(()=>{q9()});var W9,J9=v(()=>{W9=(t,e,r,o=!1)=>{let n=async()=>{let i;return o?i=r.clientContextParams?.[t]??r[t]??r[e]:i=r[t]??r[e],typeof i=="function"?i():i};return t==="credentialScope"||e==="CredentialScope"?async()=>{let i=typeof r.credentials=="function"?await r.credentials():r.credentials;return i?.credentialScope??i?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let i=typeof r.credentials=="function"?await r.credentials():r.credentials;return i?.accountId??i?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let i=await n();if(i&&typeof i=="object"){if("url"in i)return i.url.href;if("hostname"in i){let{protocol:s,hostname:a,port:c,path:u}=i;return`${s}//${a}${c?":"+c:""}${u}`}}return i}:n}});var xE=v(()=>{he()});function EE(t){return async(e,r,o,n)=>{if(!o.isCustomEndpoint&&!o.ignoreConfiguredEndpointUrls){let a;o.serviceConfiguredEndpoint?a=await o.serviceConfiguredEndpoint():a=await t(o.serviceId),a&&(o.endpoint=()=>Promise.resolve(Xn(a)),o.isCustomEndpoint=!0,n?.logger?.debug?.(`@smithy/core/endpoints - resolved endpoint from config: ${a}`))}let i=await sy(e,r,o);if(typeof o.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");let s=o.endpointProvider(i,n);if(o.isCustomEndpoint&&o.endpoint){let a=await o.endpoint();if(a?.headers){s.headers??={};for(let[c,u]of Object.entries(a.headers))s.headers[c]=Array.isArray(u)?u:[u]}}return s}}var sy,kE=v(()=>{Z9();J9();xE();sy=async(t,e,r)=>{let o={},n=e?.getEndpointParameterInstructions?.()||{};for(let[i,s]of Object.entries(n))switch(s.type){case"staticContextParams":o[i]=s.value;break;case"contextParams":o[i]=t[s.name];break;case"clientContextParams":case"builtInParams":o[i]=await W9(s.name,i,r,s.type!=="builtInParams")();break;case"operationContextParams":o[i]=s.get(t);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(s))}return Object.keys(n).length===0&&Object.assign(o,r),String(r.serviceId).toLowerCase()==="s3"&&await lz(o),o}});function qwe(t,e,r){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=r}function IE(t){let e=EE(t);return({config:r,instructions:o})=>(n,i)=>async s=>{r.isCustomEndpoint&&qwe(i,"ENDPOINT_OVERRIDE","N");let a=await e(s.input,{getEndpointParameterInstructions(){return o}},{...r},i);i.endpointV2=a,i.authSchemes=a.properties?.authSchemes;let c=i.authSchemes?.[0];if(c){i.signing_region=c.signingRegion,i.signing_service=c.signingName;let l=wt(i)?.selectedHttpAuthScheme?.httpAuthOption;l&&(l.signingProperties=Object.assign(l.signingProperties||{},{signing_region:c.signingRegion,signingRegion:c.signingRegion,signing_service:c.signingName,signingName:c.signingName,signingRegionSet:c.signingRegionSet},c.properties))}return n({...s})}}var dz=v(()=>{he();kE()});function G9(t){let e=IE(t);return(r,o)=>({applyToStack:n=>{n.addRelativeTo(e({config:r,instructions:o}),pz)}})}var Zwe,pz,fz=v(()=>{dz();Zwe={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0},pz={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Zwe.name}});function X9(t){return e=>{let r=e.tls??!0,{endpoint:o,useDualstackEndpoint:n,useFipsEndpoint:i}=e,s=o!=null?async()=>Xn(await lt(o)()):void 0,c=Object.assign(e,{endpoint:s,tls:r,isCustomEndpoint:!!o,useDualstackEndpoint:lt(n??!1),useFipsEndpoint:lt(i??!1),ignoreConfiguredEndpointUrls:!!e.ignoreConfiguredEndpointUrls}),u;return c.serviceConfiguredEndpoint=async()=>(e.serviceId&&!u&&(u=t(e.serviceId)),u),c}}var Y9=v(()=>{he();xE()});var To,Q9=v(()=>{To=class t{nodes;root;conditions;results;constructor(e,r,o,n){this.nodes=e,this.root=r,this.conditions=o,this.results=n}static from(e,r,o,n){return new t(e,r,o,n)}}});var Po,e5=v(()=>{Po=class{capacity;data=new Map;parameters=[];constructor({size:e,params:r}){this.capacity=e??50,r&&(this.parameters=r)}get(e,r){let o=this.hash(e);if(o===!1)return r();if(!this.data.has(o)){if(this.data.size>this.capacity+10){let n=this.data.keys(),i=0;for(;;){let{value:s,done:a}=n.next();if(this.data.delete(s),a||++i>10)break}}this.data.set(o,r())}return this.data.get(o)}size(){return this.data.size}hash(e){let r="",{parameters:o}=this;if(o.length===0)return!1;for(let n of o){let i=e[n],s=i==null?"\0":String(i);if(s.includes("|;"))return!1;r+=s+"|;"}return r}}});var He,t5=v(()=>{He=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var ro=v(()=>{t5()});var bs,r5=v(()=>{bs="endpoints"});function no(t){return typeof t!="object"||t==null?t:"ref"in t?`$${no(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(no).join(", ")})`:JSON.stringify(t,null,2)}var n5=v(()=>{});var ay=v(()=>{r5();n5()});var On,mz=v(()=>{On={}});var hz,o5=v(()=>{hz=(t,e)=>t===e});function gz(...t){for(let e of t)if(e!=null)return e}var i5=v(()=>{});var s5,a5=v(()=>{ro();s5=t=>{let e=t.split("."),r=[];for(let o of e){let n=o.indexOf("[");if(n!==-1){if(o.indexOf("]")!==o.length-1)throw new He(`Path: '${t}' does not end with ']'`);let i=o.slice(n+1,-1);if(Number.isNaN(parseInt(i)))throw new He(`Invalid array index: '${i}' in path: '${t}'`);n!==0&&r.push(o.slice(0,n)),r.push(i)}else r.push(o)}return r}});var cy,c5=v(()=>{ro();a5();cy=(t,e)=>s5(e).reduce((r,o)=>{if(typeof r!="object")throw new He(`Index '${o}' in '${e}' not found in '${JSON.stringify(t)}'`);if(Array.isArray(r)){let n=parseInt(o);return r[n<0?r.length+n:n]}return r[o]},t)});var yz,u5=v(()=>{yz=t=>t!=null});function vz(t,e,r){return t?e:r}var l5=v(()=>{});var wz,d5=v(()=>{wz=t=>!t});var Wwe,ya,bz=v(()=>{Wwe=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),ya=t=>Wwe.test(t)||t.startsWith("[")&&t.endsWith("]")});var $E,_z,Sz,p5=v(()=>{$E=St(is());bz();_z={[$E.EndpointURLScheme.HTTP]:80,[$E.EndpointURLScheme.HTTPS]:443},Sz=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:f,port:p,protocol:m="",path:g="",query:y={}}=t,w=new URL(`${m}//${f}${p?`:${p}`:""}${g}`);return w.search=Object.entries(y).map(([b,_])=>`${b}=${_}`).join("&"),w}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;let r=e.href,{host:o,hostname:n,pathname:i,protocol:s,search:a}=e;if(a)return null;let c=s.slice(0,-1);if(!Object.values($E.EndpointURLScheme).includes(c))return null;let u=ya(n),l=r.includes(`${o}:${_z[c]}`)||typeof t=="string"&&t.includes(`${o}:${_z[c]}`),d=`${o}${l?`:${_z[c]}`:""}`;return{scheme:c,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:u}}});function xz(t,e,r){if(r===1)return[t];if(t==="")return[""];let o=t.split(e);return r===0?o:o.slice(0,r-1).concat(o.slice(1).join(e))}var f5=v(()=>{});var Ez,m5=v(()=>{Ez=(t,e)=>t===e});var kz,h5=v(()=>{kz=(t,e,r,o)=>t==null||e>=r||t.length<r||/[^\u0000-\u007f]/.test(t)?null:o?t.substring(t.length-r,t.length-e):t.substring(e,r)});var Iz,g5=v(()=>{Iz=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var $z=v(()=>{o5();i5();c5();u5();he();l5();d5();p5();f5();m5();h5();g5()});var y5,v5=v(()=>{$z();y5={booleanEquals:hz,coalesce:gz,getAttr:cy,isSet:yz,isValidHostLabel:di,ite:vz,not:wz,parseURL:Sz,split:xz,stringEquals:Ez,substring:kz,uriEncode:Iz}});var AE,Az=v(()=>{$z();AE=(t,e)=>{let r=[],{referenceRecord:o,endpointParams:n}=e,i=0;for(;i<t.length;){let s=t.indexOf("{",i);if(s===-1){r.push(t.slice(i));break}r.push(t.slice(i,s));let a=t.indexOf("}",s);if(a===-1){r.push(t.slice(s));break}t[s+1]==="{"&&t[a+1]==="}"&&(r.push(t.slice(s+1,a)),i=a+2);let c=t.substring(s+1,a);if(c.includes("#")){let[u,l]=c.split("#");r.push(cy(o[u]??n[u],l))}else r.push(o[c]??n[c]);i=a+1}return r.join("")}});var w5,b5=v(()=>{w5=({ref:t},e)=>e.referenceRecord[t]??e.endpointParams[t]});var va,TE,_5,Hp=v(()=>{ro();mz();v5();Az();b5();va=(t,e,r)=>{if(typeof t=="string")return AE(t,r);if(t.fn)return _5.callFunction(t,r);if(t.ref)return w5(t,r);throw new He(`'${e}': ${String(t)} is not a string, function or reference.`)},TE=({fn:t,argv:e},r)=>{let o=Array(e.length);for(let s=0;s<o.length;++s){let a=e[s];typeof a=="boolean"||typeof a=="number"?o[s]=a:o[s]=_5.evaluateExpression(a,"arg",r)}let n=t.indexOf(".");if(n!==-1){let a=On[t.slice(0,n)]?.[t.slice(n+1)];if(typeof a=="function")return a(...o)}let i=y5[t];if(typeof i=="function")return i(...o);throw new Error(`function ${t} not loaded in endpointFunctions.`)},_5={evaluateExpression:va,callFunction:TE}});var S5=v(()=>{Hp()});var PE,Tz=v(()=>{ay();ro();S5();PE=(t,e)=>{let{assign:r}=t;if(r&&r in e.referenceRecord)throw new He(`'${r}' is already defined in Reference Record.`);let o=TE(t,e);e.logger?.debug?.(`${bs} evaluateCondition: ${no(t)} = ${no(o)}`);let n=o===""?!0:!!o;return r!=null?{result:n,toAssign:{name:r,value:o}}:{result:n}}});var RE,Pz=v(()=>{ro();Hp();RE=(t,e)=>Object.entries(t??{}).reduce((r,[o,n])=>(r[o]=n.map(i=>{let s=va(i,"Header value entry",e);if(typeof s!="string")throw new He(`Header '${o}' value '${s}' is not a string`);return s}),r),{})});var uy,x5,E5,Rz=v(()=>{ro();Az();uy=(t,e)=>Object.entries(t).reduce((r,[o,n])=>(r[o]=E5.getEndpointProperty(n,e),r),{}),x5=(t,e)=>{if(Array.isArray(t))return t.map(r=>x5(r,e));switch(typeof t){case"string":return AE(t,e);case"object":if(t===null)throw new He(`Unexpected endpoint property: ${t}`);return E5.getEndpointProperties(t,e);case"boolean":return t;default:throw new He(`Unexpected endpoint property type: ${typeof t}`)}},E5={getEndpointProperty:x5,getEndpointProperties:uy}});var CE,Cz=v(()=>{ro();Hp();CE=(t,e)=>{let r=va(t,"Endpoint URL",e);if(typeof r=="string")try{return new URL(r)}catch(o){throw console.error(`Failed to construct URL with ${r}`,o),o}throw new He(`Endpoint URL must be a string, got ${typeof r}`)}});var Oz,_s,k5=v(()=>{ro();Tz();Hp();Pz();Rz();Cz();Oz=1e8,_s=(t,e)=>{let{nodes:r,root:o,results:n,conditions:i}=t,s=o,a={},c={referenceRecord:a,endpointParams:e.endpointParams,logger:e.logger};for(;s!==1&&s!==-1&&s<Oz;){let u=3*(Math.abs(s)-1),[l,d,f]=[r[u],r[u+1],r[u+2]],[p,m,g]=i[l],y=PE({fn:p,assign:g,argv:m},c);if(y.toAssign){let{name:w,value:b}=y.toAssign;a[w]=b}s=s>=0===y.result?d:f}if(s>=Oz){let u=n[s-Oz];if(u[0]===-1){let[,p]=u;throw new He(va(p,"Error",c))}let[l,d,f]=u;return{url:CE(l,c),properties:uy(d,c),headers:RE(f??{},c)}}throw new He("No matching endpoint.")}});var Bp,OE=v(()=>{ay();Tz();Bp=(t=[],e)=>{let r={},o={...e,referenceRecord:{...e.referenceRecord}},n=!1;for(let i of t){let{result:s,toAssign:a}=PE(i,o);if(!s)return{result:s};a&&(n=!0,r[a.name]=a.value,o.referenceRecord[a.name]=a.value,e.logger?.debug?.(`${bs} assign: ${a.name} := ${no(a.value)}`))}return n?{result:!0,referenceRecord:r}:{result:!0}}});var I5,$5=v(()=>{ay();OE();Pz();Rz();Cz();I5=(t,e)=>{let{conditions:r,endpoint:o}=t,{result:n,referenceRecord:i}=Bp(r,e);if(!n)return;let s=i?{...e,referenceRecord:{...e.referenceRecord,...i}}:e,{url:a,properties:c,headers:u}=o;e.logger?.debug?.(`${bs} Resolving endpoint from template: ${no(o)}`);let l={url:CE(a,s)};return u!=null&&(l.headers=RE(u,s)),c!=null&&(l.properties=uy(c,s)),l}});var A5,T5=v(()=>{ro();OE();Hp();A5=(t,e)=>{let{conditions:r,error:o}=t,{result:n,referenceRecord:i}=Bp(r,e);if(!n)return;let s=i?{...e,referenceRecord:{...e.referenceRecord,...i}}:e;throw new He(va(o,"Error",s))}});var NE,P5,Nz,R5=v(()=>{ro();OE();$5();T5();NE=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let o=I5(r,e);if(o)return o}else if(r.type==="error")A5(r,e);else if(r.type==="tree"){let o=Nz.evaluateTreeRule(r,e);if(o)return o}else throw new He(`Unknown endpoint rule: ${r}`);throw new He("Rules evaluation failed")},P5=(t,e)=>{let{conditions:r,rules:o}=t,{result:n,referenceRecord:i}=Bp(r,e);if(!n)return;let s=i?{...e,referenceRecord:{...e.referenceRecord,...i}}:e;return Nz.evaluateRules(o,s)},Nz={evaluateRules:NE,evaluateTreeRule:P5}});var C5=v(()=>{R5()});var ly,O5=v(()=>{he();ay();ro();C5();ly=(t,e)=>{let{endpointParams:r,logger:o}=e,{parameters:n,rules:i}=t;e.logger?.debug?.(`${bs} Initial EndpointParams: ${no(r)}`);for(let a in n){if(!ce(n,a))continue;let c=n[a],u=r[a];if(u==null&&c.default!=null){r[a]=c.default;continue}if(c.required&&u==null)throw new He(`Missing required parameter: '${a}'`)}let s=NE(i,{endpointParams:r,logger:o,referenceRecord:{}});return e.logger?.debug?.(`${bs} Resolved endpoint: ${no(s)}`),s}});var N5,D5=v(()=>{N5=t=>{let{endpoint:e}=t;return e===void 0&&(t.endpoint=async()=>{throw new Error("@smithy/middleware-endpoint: (default endpointRuleSet) endpoint is not set - you must configure an endpoint.")}),t}});var z5={};yt(z5,{BinaryDecisionDiagram:()=>To,EndpointCache:()=>Po,EndpointError:()=>He,customEndpointFunctions:()=>On,decideEndpoint:()=>_s,endpointMiddleware:()=>Gwe,endpointMiddlewareOptions:()=>pz,getEndpointFromInstructions:()=>Jwe,getEndpointPlugin:()=>ba,isIpAddress:()=>ya,isValidHostLabel:()=>di,middlewareEndpointToEndpointV1:()=>Xn,resolveEndpoint:()=>ly,resolveEndpointConfig:()=>wa,resolveEndpointRequiredConfig:()=>N5,resolveParams:()=>sy,toEndpointV1:()=>Xn});var Jwe,wa,Gwe,ba,It=v(()=>{H9();kE();dz();fz();Y9();he();Q9();e5();k5();bz();he();mz();O5();ro();kE();xE();fz();D5();Jwe=EE(iy),wa=X9(iy),Gwe=IE(iy),ba=G9(iy)});var DE,Dz=v(()=>{It();DE=(t,e)=>(r,o)=>async n=>{let i=t,s=o.endpointV2?async()=>Xn(o.endpointV2):i.endpoint;if(!s)throw new Error("No valid endpoint provider available.");let a=await e(n.input,{...t,endpoint:s});return r({...n,request:a})}});function j5(t,e,r){return{applyToStack:o=>{o.add(nE(t,r),zz),o.add(DE(t,e),jz)}}}var zz,jz,M5=v(()=>{FD();Dz();zz={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},jz={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});import{createHash as Xwe,createHmac as Ywe}from"node:crypto";function U5(t,e){return Buffer.isBuffer(t)?t:typeof t=="string"?bc(t,e):ArrayBuffer.isView(t)?mi(t.buffer,t.byteOffset,t.byteLength):mi(t)}var zE,L5=v(()=>{_c();UD();zE=class{algorithmIdentifier;secret;hash;constructor(e,r){this.algorithmIdentifier=e,this.secret=r,this.reset()}update(e,r){this.hash.update(hn(U5(e,r)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?Ywe(this.algorithmIdentifier,U5(this.secret)):Xwe(this.algorithmIdentifier)}}});import{Readable as Qwe}from"node:stream";var Kp,Mz=v(()=>{$D();Kp=class extends Qwe{expectedChecksum;checksumSourceLocation;checksum;source;base64Encoder;constructor({expectedChecksum:e,checksum:r,source:o,checksumSourceLocation:n,base64Encoder:i}){if(super(),typeof o.pipe!="function")throw new Error(`@smithy/util-stream: unsupported source type ${o?.constructor?.name??o} in ChecksumStream.`);this.source=o,this.base64Encoder=i??_t,this.expectedChecksum=e,this.checksum=r,this.checksumSourceLocation=n,this.source.on("data",this.onSourceData),this.source.on("end",this.onSourceEnd),this.source.on("error",this.onSourceError),this.source.on("close",this.onSourceClose),this.source.pause()}onSourceData=e=>{if(!this.destroyed){try{this.checksum.update(e)}catch(r){this.destroy(r);return}this.push(e)||this.source.pause()}};onSourceEnd=async()=>{if(!this.destroyed){try{let e=await this.checksum.digest(),r=this.base64Encoder(e);if(this.expectedChecksum!==r){this.destroy(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${r}" in response header "${this.checksumSourceLocation}".`));return}}catch(e){this.destroy(e);return}this.push(null)}};onSourceError=e=>{this.destroy(e)};onSourceClose=()=>{!this.destroyed&&!this.source.readableEnded&&this.destroy(new Error("Connection lost or stream closed before all data was received."))};_read(e){this.source.resume()}_destroy(e,r){this.source?.removeListener("data",this.onSourceData),this.source?.removeListener("end",this.onSourceEnd),this.source?.removeListener("error",this.onSourceError),this.source?.removeListener("close",this.onSourceClose),this.source?.destroy(),r(e)}}});var ir,Ic,hi=v(()=>{ir=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream),Ic=t=>typeof Blob=="function"&&(t?.constructor?.name===Blob.name||t instanceof Blob)});var F5,V5=v(()=>{F5=t=>new TextEncoder().encode(t)});var H5,A7e,B5,jE,Uz,K5,q5=v(()=>{H5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A7e=Object.entries(H5).reduce((t,[e,r])=>(t[r]=Number(e),t),{}),B5=H5.split(""),jE=6,Uz=8,K5=63});function ME(t){let e;typeof t=="string"?e=F5(t):e=t;let r=typeof e=="object"&&typeof e.length=="number",o=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!r&&!o)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let n="";for(let i=0;i<e.length;i+=3){let s=0,a=0;for(let u=i,l=Math.min(i+3,e.length);u<l;u++)s|=e[u]<<(l-u-1)*Uz,a+=Uz;let c=Math.ceil(a/jE);s<<=c*jE-a;for(let u=1;u<=c;u++){let l=(c-u)*jE;n+=B5[(s&K5<<l)>>l]}n+="==".slice(0,4-c)}return n}var Lz=v(()=>{V5();q5()});var ebe,UE,Z5=v(()=>{ebe=typeof ReadableStream=="function"?ReadableStream:function(){},UE=class extends ebe{}});var W5,J5=v(()=>{Lz();hi();Z5();W5=({expectedChecksum:t,checksum:e,source:r,checksumSourceLocation:o,base64Encoder:n})=>{if(!ir(r))throw new Error(`@smithy/util-stream: unsupported source type ${r?.constructor?.name??r} in ChecksumStream.`);let i=n??ME;if(typeof TransformStream!="function")throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");let s=new TransformStream({start(){},async transform(c,u){e.update(c),u.enqueue(c)},async flush(c){let u=await e.digest(),l=i(u);if(t!==l){let d=new Error(`Checksum mismatch: expected "${t}" but received "${l}" in response header "${o}".`);c.error(d)}else c.terminate()}});r.pipeThrough(s);let a=s.readable;return Object.setPrototypeOf(a,UE.prototype),a}});function G5(t){return typeof ReadableStream=="function"&&ir(t.source)?W5(t):new Kp(t)}var X5=v(()=>{hi();Mz();J5()});var dl,Fz=v(()=>{dl=class{allocByteArray;byteLength=0;byteArrays=[];constructor(e){this.allocByteArray=e}push(e){this.byteArrays.push(e),this.byteLength+=e.byteLength}flush(){if(this.byteArrays.length===1){let o=this.byteArrays[0];return this.reset(),o}let e=this.allocByteArray(this.byteLength),r=0;for(let o=0;o<this.byteArrays.length;++o){let n=this.byteArrays[o];e.set(n,r),r+=n.byteLength}return this.reset(),e}reset(){this.byteArrays=[],this.byteLength=0}}});function Y5(t,e,r){let o=t.getReader(),n=!1,i=0,s=["",new dl(u=>new Uint8Array(u))],a=-1,c=async u=>{let{value:l,done:d}=await o.read(),f=l;if(d){if(a!==-1){let p=pl(s,a);_a(p)>0&&u.enqueue(p)}u.close()}else{let p=Hz(f,!1);if(a!==p&&(a>=0&&u.enqueue(pl(s,a)),a=p),a===-1){u.enqueue(f);return}let m=_a(f);i+=m;let g=_a(s[a]);if(m>=e&&g===0)u.enqueue(f);else{let y=Vz(s,a,f);!n&&i>e*2&&(n=!0,r?.warn(`@smithy/util-stream - stream chunk size ${m} is below threshold of ${e}, automatically buffering.`)),y>=e?u.enqueue(pl(s,a)):await c(u)}}};return new ReadableStream({pull:c})}function Vz(t,e,r){switch(e){case 0:return t[0]+=r,_a(t[0]);case 1:case 2:return t[e].push(r),_a(t[e])}}function pl(t,e){switch(e){case 0:let r=t[0];return t[0]="",r;case 1:case 2:return t[e].flush()}throw new Error(`@smithy/util-stream - invalid index ${e} given to flush()`)}function _a(t){return t?.byteLength??t?.length??0}function Hz(t,e=!0){return e&&typeof Buffer<"u"&&t instanceof Buffer?2:t instanceof Uint8Array?1:typeof t=="string"?0:-1}var Q5=v(()=>{Fz()});import{Readable as tbe}from"node:stream";function e8(t,e,r){if(ir(t))return Y5(t,e,r);let o=new tbe({read(){}}),n=!1,i=0,s=["",new dl(c=>new Uint8Array(c)),new dl(c=>Buffer.from(new Uint8Array(c)))],a=-1;return t.on("data",c=>{let u=Hz(c,!0);if(a!==u&&(a>=0&&o.push(pl(s,a)),a=u),a===-1){o.push(c);return}let l=_a(c);i+=l;let d=_a(s[a]);if(l>=e&&d===0)o.push(c);else{let f=Vz(s,a,c);!n&&i>e*2&&(n=!0,r?.warn(`@smithy/util-stream - stream chunk size ${l} is below threshold of ${e}, automatically buffering.`)),f>=e&&o.push(pl(s,a))}}),t.on("end",()=>{if(a!==-1){let c=pl(s,a);_a(c)>0&&o.push(c)}o.push(null)}),o}var t8=v(()=>{Fz();Q5();hi()});var r8,n8=v(()=>{r8=(t,e)=>{let{base64Encoder:r,bodyLengthChecker:o,checksumAlgorithmFn:n,checksumLocationName:i,streamHasher:s}=e,a=r!==void 0&&o!==void 0&&n!==void 0&&i!==void 0&&s!==void 0,c=a?s(n,t):void 0;Promise.resolve(c).catch(()=>{});let u=t.getReader();return new ReadableStream({async pull(l){let{value:d,done:f}=await u.read();if(f){if(l.enqueue(`0\r
14
+ `+a}catch{!o.logger||o.logger?.constructor?.name==="NoOpLogger"?console.warn(a):o.logger?.warn?.(a)}typeof s.$responseBodyText<"u"&&s.$response&&(s.$response.body=s.$responseBodyText);try{if(ur.isInstance(i)){let{headers:c={}}=i,u=Object.entries(c);s.$metadata={httpStatusCode:i.statusCode,requestId:LD(/^x-[\w-]+-request-?id$/,u),extendedRequestId:LD(/^x-[\w-]+-id-2$/,u),cfId:LD(/^x-[\w-]+-cf-id$/,u)}}}catch{}}throw s}},LD=(t,e)=>(e.find(([r])=>r.match(t))||[void 0,void 0])[1]});var eo,ey=v(()=>{eo=class t extends Error{name="ProviderError";tryNextLink;constructor(e,r=!0){let o,n=!0;typeof r=="boolean"?(o=void 0,n=r):r!=null&&typeof r=="object"&&(o=r.logger,n=r.tryNextLink??!0),super(e),this.tryNextLink=n,Object.setPrototypeOf(this,t.prototype),o?.debug?.(`@smithy/property-provider ${n?"->":"(!)"} ${e}`)}static from(e,r=!0){return Object.assign(new this(e.message,r),e)}}});var kc,oE=v(()=>{ey();kc=class t extends eo{name="CredentialsProviderError";constructor(e,r=!0){super(e,r),Object.setPrototypeOf(this,t.prototype)}}});var iE,xW=v(()=>{ey();iE=class t extends eo{name="TokenProviderError";constructor(e,r=!0){super(e,r),Object.setPrototypeOf(this,t.prototype)}}});var sE,VD=v(()=>{ey();sE=(...t)=>async()=>{if(t.length===0)throw new eo("No providers in chain");let e;for(let r of t)try{return await r()}catch(o){if(e=o,o?.tryNextLink)continue;throw o}throw e}});var aE,HD=v(()=>{aE=t=>()=>Promise.resolve(t)});var Mp,cE=v(()=>{Mp=(t,e,r)=>{let o,n,i,s=!1,a=async()=>{n||(n=t());try{o=await n,i=!0,s=!1}finally{n=void 0}return o};return e===void 0?async c=>((!i||c?.forceRefresh)&&(o=await a()),o):async c=>((!i||c?.forceRefresh)&&(o=await a()),s?o:r&&!r(o)?(s=!0,o):(e(o)&&await a(),o))}});var lr,uE=v(()=>{lr=(t,e,r)=>{if(e in t){if(t[e]==="true")return!0;if(t[e]==="false")return!1;throw new Error(`Cannot load ${r} "${e}". Expected "true" or "false", got ${t[e]}.`)}}});var EW,kW=v(()=>{EW=(t,e,r)=>{if(!(e in t))return;let o=parseInt(t[e],10);if(Number.isNaN(o))throw new TypeError(`Cannot load ${r} '${e}'. Expected number, got '${t[e]}'.`);return o}});var Wt,lE=v(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(Wt||(Wt={}))});import{homedir as bwe}from"node:os";import{sep as _we}from"node:path";var BD,Swe,hs,Up=v(()=>{BD={},Swe=()=>process&&process.geteuid?`${process.geteuid()}`:"DEFAULT",hs=()=>{let{HOME:t,USERPROFILE:e,HOMEPATH:r,HOMEDRIVE:o=`C:${_we}`}=process.env;if(t)return t;if(e)return e;if(r)return`${o}${r}`;let n=Swe();return BD[n]||(BD[n]=bwe()),BD[n]}});var KD,qD,dE,ZD=v(()=>{KD="AWS_PROFILE",qD="default",dE=t=>t.profile||process.env[KD]||qD});import{createHash as xwe}from"node:crypto";import{join as Ewe}from"node:path";var pE,WD=v(()=>{Up();pE=t=>{let r=xwe("sha1").update(t).digest("hex");return Ewe(hs(),".aws","sso","cache",`${r}.json`)}});import{readFile as kwe}from"node:fs/promises";var ty,IW,JD=v(()=>{WD();ty={},IW=async t=>{if(ty[t])return ty[t];let e=pE(t),r=await kwe(e,"utf8");return JSON.parse(r)}});var gs,$W=v(()=>{gs="."});var GD,AW,TW=v(()=>{GD=St(is()),AW=t=>Object.entries(t).filter(([e])=>{let r=e.indexOf(".");return r===-1?!1:Object.values(GD.IniSectionType).includes(e.substring(0,r))}).reduce((e,[r,o])=>{let n=r.indexOf("."),i=r.substring(0,n)===GD.IniSectionType.PROFILE?r.substring(n+1):r;return e[i]=o,e},{...t.default&&{default:t.default}})});import{join as Iwe}from"node:path";var $we,fE,XD=v(()=>{Up();$we="AWS_CONFIG_FILE",fE=()=>process.env[$we]||Iwe(hs(),".aws","config")});import{join as Awe}from"node:path";var Twe,PW,RW=v(()=>{Up();Twe="AWS_SHARED_CREDENTIALS_FILE",PW=()=>process.env[Twe]||Awe(hs(),".aws","credentials")});var CW,Pwe,Rwe,ry,YD=v(()=>{CW=St(is()),Pwe=/^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/,Rwe=["__proto__","profile __proto__"],ry=t=>{let e={},r,o;for(let n of t.split(/\r?\n/)){let i=n.split(/(^|\s)[;#]/)[0].trim();if(i[0]==="["&&i[i.length-1]==="]"){r=void 0,o=void 0;let a=i.substring(1,i.length-1),c=Pwe.exec(a);if(c){let[,u,,l]=c;Object.values(CW.IniSectionType).includes(u)&&(r=[u,l].join("."))}else r=a;if(Rwe.includes(a))throw new Error(`Found invalid profile name "${a}"`)}else if(r){let a=i.indexOf("=");if(![0,-1].includes(a)){let[c,u]=[i.substring(0,a).trim(),i.substring(a+1).trim()];if(u==="")o=c;else{o&&n.trimStart()===n&&(o=void 0),e[r]=e[r]||{};let l=o?[o,c].join("."):c;e[r][l]=u}}}}return e}});import{readFile as Cwe}from"node:fs/promises";var QD,ny,ll,oy=v(()=>{QD={},ny={},ll=(t,e)=>ny[t]!==void 0?ny[t]:((!QD[t]||e?.ignoreCache)&&(QD[t]=Cwe(t,"utf8")),QD[t])});import{join as OW}from"node:path";var NW,Lp,mE=v(()=>{TW();XD();RW();Up();YD();oy();NW=()=>({}),Lp=async(t={})=>{let{filepath:e=PW(),configFilepath:r=fE()}=t,o=hs(),n="~/",i=e;e.startsWith(n)&&(i=OW(o,e.slice(2)));let s=r;r.startsWith(n)&&(s=OW(o,r.slice(2)));let a=await Promise.all([ll(s,{ignoreCache:t.ignoreCache}).then(ry).then(AW).catch(NW),ll(i,{ignoreCache:t.ignoreCache}).then(ry).catch(NW)]);return{configFile:a[0],credentialsFile:a[1]}}});var DW,zW,jW=v(()=>{DW=St(is()),zW=t=>Object.entries(t).filter(([e])=>e.startsWith(DW.IniSectionType.SSO_SESSION+".")).reduce((e,[r,o])=>({...e,[r.substring(r.indexOf(".")+1)]:o}),{})});var Owe,MW,UW=v(()=>{XD();jW();YD();oy();Owe=()=>({}),MW=async(t={})=>ll(t.configFilepath??fE()).then(ry).then(zW).catch(Owe)});var LW,FW=v(()=>{LW=(...t)=>{let e={};for(let r of t)for(let[o,n]of Object.entries(r))e[o]!==void 0?Object.assign(e[o],n):e[o]=n;return e}});var VW,HW=v(()=>{mE();FW();VW=async t=>{let e=await Lp(t);return LW(e.configFile,e.credentialsFile)}});var BW,KW=v(()=>{JD();oy();BW={getFileRecord(){return ny},interceptFile(t,e){ny[t]=Promise.resolve(e)},getTokenRecord(){return ty},interceptToken(t,e){ty[t]=e}}});function hE(t){try{let e=new Set(Array.from(t.match(/([A-Z_]){3,}/g)??[]));return e.delete("CONFIG"),e.delete("CONFIG_PREFIX_SEPARATOR"),e.delete("ENV"),[...e].join(", ")}catch{return t}}var e1=v(()=>{});var qW,ZW=v(()=>{oE();e1();qW=(t,e)=>async()=>{try{let r=t(process.env,e);if(r===void 0)throw new Error;return r}catch(r){throw new kc(r.message||`Not found in ENV: ${hE(t.toString())}`,{logger:e?.logger})}}});var WW,JW=v(()=>{oE();ZD();mE();e1();WW=(t,{preferredFile:e="config",...r}={})=>async()=>{let o=dE(r),{configFile:n,credentialsFile:i}=await Lp(r),s=i[o]||{},a=n[o]||{},c=e==="config"?{...s,...a}:{...a,...s};try{let l=t(c,e==="config"?n:i);if(l===void 0)throw new Error;return l}catch(u){throw new kc(u.message||`Not found in config files w/ profile [${o}]: ${hE(t.toString())}`,{logger:r.logger})}}});var Nwe,gE,t1=v(()=>{HD();Nwe=t=>typeof t=="function",gE=t=>Nwe(t)?async()=>await t():aE(t)});var fe,r1=v(()=>{VD();cE();ZW();JW();t1();fe=({environmentVariableSelector:t,configFileSelector:e,default:r},o={})=>{let{signingName:n,logger:i}=o;return Mp(sE(qW(t,{signingName:n,logger:i}),WW(e,o),gE(r)))}});var yE,vE,GW,ys,XW,YW=v(()=>{uE();lE();yE="AWS_USE_DUALSTACK_ENDPOINT",vE="use_dualstack_endpoint",GW=!1,ys={environmentVariableSelector:t=>lr(t,yE,Wt.ENV),configFileSelector:t=>lr(t,vE,Wt.CONFIG),default:!1},XW={environmentVariableSelector:t=>lr(t,yE,Wt.ENV),configFileSelector:t=>lr(t,vE,Wt.CONFIG),default:void 0}});var wE,bE,QW,vs,e9,t9=v(()=>{uE();lE();wE="AWS_USE_FIPS_ENDPOINT",bE="use_fips_endpoint",QW=!1,vs={environmentVariableSelector:t=>lr(t,wE,Wt.ENV),configFileSelector:t=>lr(t,bE,Wt.CONFIG),default:!1},e9={environmentVariableSelector:t=>lr(t,wE,Wt.ENV),configFileSelector:t=>lr(t,bE,Wt.CONFIG),default:void 0}});var r9,n9=v(()=>{le();r9=t=>{let{tls:e,endpoint:r,urlParser:o,useDualstackEndpoint:n}=t;return Object.assign(t,{tls:e??!0,endpoint:lt(typeof r=="string"?o(r):r),isCustomEndpoint:!0,useDualstackEndpoint:lt(n??!1)})}});var o9,i9=v(()=>{o9=async t=>{let{tls:e=!0}=t,r=await t.region();if(!new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/).test(r))throw new Error("Invalid region in client config");let n=await t.useDualstackEndpoint(),i=await t.useFipsEndpoint(),{hostname:s}=await t.regionInfoProvider(r,{useDualstackEndpoint:n,useFipsEndpoint:i})??{};if(!s)throw new Error("Cannot resolve hostname from client config");return t.urlParser(`${e?"https:":"http:"}//${s}`)}});var s9,a9=v(()=>{le();i9();s9=t=>{let e=lt(t.useDualstackEndpoint??!1),{endpoint:r,useFipsEndpoint:o,urlParser:n,tls:i}=t;return Object.assign(t,{tls:i??!0,endpoint:r?lt(typeof r=="string"?n(r):r):()=>o9({...t,useDualstackEndpoint:e,useFipsEndpoint:o}),isCustomEndpoint:!!r,useDualstackEndpoint:e})}});var c9,n1,o1,u9,l9,d9,p9,f9,m9,i1=v(()=>{c9="AWS_EXECUTION_ENV",n1="AWS_REGION",o1="AWS_DEFAULT_REGION",u9="AWS_EC2_METADATA_DISABLED",l9=["in-region","cross-region","mobile","standard","legacy"],d9="/latest/meta-data/placement/region",p9="/latest/api/token",f9="x-aws-ec2-metadata-token",m9="x-aws-ec2-metadata-token-ttl-seconds"});var h9,Dwe,v9,_E,g9,zwe,y9,s1=v(()=>{i1();h9=1e3,Dwe=6e4,v9=0,_E=async()=>{if(!process.env[u9]&&!(Date.now()<v9))try{let t=zwe(),e=(await y9({...t,path:p9,method:"PUT",headers:{[m9]:"21600"}})).toString();return(await y9({...t,path:d9,method:"GET",headers:{[f9]:e}})).toString().trim()||g9()}catch{return g9()}},g9=()=>{v9=Date.now()+Dwe},zwe=()=>{let t=process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT;if(t){let e=new URL(t);return{hostname:e.hostname.replace(/^\[(.+)]$/,"$1"),port:e.port?Number(e.port):void 0}}return process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE==="IPv6"?{hostname:"fd00:ec2::254"}:{hostname:"169.254.169.254"}},y9=async t=>{let{request:e}=await import("node:http");return new Promise((r,o)=>{let n=e({hostname:t.hostname,port:t.port,path:t.path,method:t.method,headers:t.headers,timeout:h9,signal:AbortSignal.timeout(h9)});n.on("error",i=>{o(i),n.destroy()}),n.on("timeout",()=>{o(new Error("TimeoutError from instance metadata service")),n.destroy()}),n.on("response",i=>{let{statusCode:s=400}=i;if(s<200||s>=300){o(Object.assign(new Error("Error response received from instance metadata service"),{statusCode:s})),n.destroy();return}let a=[];i.on("data",c=>a.push(c)),i.on("end",()=>{r(Buffer.concat(a)),n.destroy()})}),n.end()})}});var Fp,Vp,$r,gn,a1=v(()=>{s1();Fp="AWS_REGION",Vp="region",$r={environmentVariableSelector:t=>t[Fp],configFileSelector:t=>t[Vp],default:async()=>{let t=await _E();if(t)return t;throw new Error("Region is missing")}},gn={preferredFile:"credentials"}});var w9,b9,_9=v(()=>{he();w9=new Set,b9=(t,e=di)=>{if(!w9.has(t)&&!e(t))if(t==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${t}" is not a valid hostname component.`);else w9.add(t)}});var SE,c1=v(()=>{SE=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var S9,x9=v(()=>{c1();S9=t=>SE(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var to,E9=v(()=>{_9();x9();c1();to=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return Object.assign(t,{region:async()=>{let o=typeof e=="function"?await e():e,n=S9(o);return b9(n),n},useFipsEndpoint:async()=>{let o=typeof e=="string"?e:await e();return SE(o)?!0:typeof r!="function"?Promise.resolve(!!r):r()}})}});var u1,k9=v(()=>{u1=(t=[],{useFipsEndpoint:e,useDualstackEndpoint:r})=>t.find(({tags:o})=>e===o.includes("fips")&&r===o.includes("dualstack"))?.hostname});var I9,$9=v(()=>{I9=(t,{regionHostname:e,partitionHostname:r})=>e||(r?r.replace("{region}",t):void 0)});var A9,T9=v(()=>{A9=(t,{partitionHash:e})=>Object.keys(e||{}).find(r=>e[r].regions.includes(t))??"aws"});var P9,R9=v(()=>{P9=(t,{signingRegion:e,regionRegex:r,useFipsEndpoint:o})=>{if(e)return e;if(o){let n=r.replace("\\\\","\\").replace(/^\^/g,"\\.").replace(/\$$/g,"\\."),i=t.match(n);if(i)return i[0].slice(1,-1)}}});var C9,O9=v(()=>{k9();$9();T9();R9();C9=(t,{useFipsEndpoint:e=!1,useDualstackEndpoint:r=!1,signingService:o,regionHash:n,partitionHash:i})=>{let s=A9(t,{partitionHash:i}),a=t in n?t:i[s]?.endpoint??t,c={useFipsEndpoint:e,useDualstackEndpoint:r},u=u1(n[a]?.variants,c),l=u1(i[s]?.variants,c),d=I9(a,{regionHostname:u,partitionHostname:l});if(d===void 0)throw new Error(`Endpoint resolution failed for: ${{resolvedRegion:a,useFipsEndpoint:e,useDualstackEndpoint:r}}`);let f=P9(d,{signingRegion:n[a]?.signingRegion,regionRegex:i[s].regionRegex,useFipsEndpoint:e});return{partition:s,signingService:o,hostname:d,...f&&{signingRegion:f},...n[a]?.signingService&&{signingService:n[a].signingService}}}});var jwe,Mwe,N9,D9=v(()=>{jwe="AWS_DEFAULTS_MODE",Mwe="defaults_mode",N9={environmentVariableSelector:t=>t[jwe],configFileSelector:t=>t[Mwe],default:"legacy"}});var ws,Uwe,Lwe,z9=v(()=>{a1();s1();r1();cE();i1();D9();ws=({region:t=fe($r),defaultsMode:e=fe(N9)}={})=>Mp(async()=>{let r=typeof e=="function"?await e():e;switch(r?.toLowerCase()){case"auto":return Uwe(t);case"in-region":case"cross-region":case"mobile":case"standard":case"legacy":return Promise.resolve(r?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${l9.join(", ")}, got ${r}`)}}),Uwe=async t=>{if(t){let e=typeof t=="function"?await t():t,r=await Lwe();return r?e===r?"in-region":"cross-region":"standard"}return"standard"},Lwe=async()=>process.env[c9]&&(process.env[n1]||process.env[o1])?process.env[n1]??process.env[o1]:_E()});var Ao={};yt(Ao,{CONFIG_PREFIX_SEPARATOR:()=>gs,CONFIG_USE_DUALSTACK_ENDPOINT:()=>vE,CONFIG_USE_FIPS_ENDPOINT:()=>bE,CredentialsProviderError:()=>kc,DEFAULT_PROFILE:()=>qD,DEFAULT_USE_DUALSTACK_ENDPOINT:()=>GW,DEFAULT_USE_FIPS_ENDPOINT:()=>QW,ENV_PROFILE:()=>KD,ENV_USE_DUALSTACK_ENDPOINT:()=>yE,ENV_USE_FIPS_ENDPOINT:()=>wE,NODE_REGION_CONFIG_FILE_OPTIONS:()=>gn,NODE_REGION_CONFIG_OPTIONS:()=>$r,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:()=>ys,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:()=>vs,ProviderError:()=>eo,REGION_ENV_NAME:()=>Fp,REGION_INI_NAME:()=>Vp,SelectorType:()=>Wt,TokenProviderError:()=>iE,booleanSelector:()=>lr,chain:()=>sE,externalDataInterceptor:()=>BW,fromStatic:()=>gE,fromValue:()=>aE,getHomeDir:()=>hs,getProfileName:()=>dE,getRegionInfo:()=>C9,getSSOTokenFilepath:()=>pE,getSSOTokenFromFile:()=>IW,loadConfig:()=>fe,loadSharedConfigFiles:()=>Lp,loadSsoSessionData:()=>MW,memoize:()=>Mp,nodeDualstackConfigSelectors:()=>XW,nodeFipsConfigSelectors:()=>e9,numberSelector:()=>EW,parseKnownFiles:()=>VW,readFile:()=>ll,resolveCustomEndpointsConfig:()=>r9,resolveDefaultsModeConfig:()=>ws,resolveEndpointsConfig:()=>s9,resolveRegionConfig:()=>to});var dt=v(()=>{ey();oE();xW();VD();HD();cE();uE();kW();lE();Up();ZD();WD();JD();$W();mE();UW();HW();KW();oy();r1();t1();YW();t9();n9();a9();a1();E9();O9();z9()});var j9,M9,U9,L9=v(()=>{j9="AWS_ENDPOINT_URL",M9="endpoint_url",U9=t=>({environmentVariableSelector:e=>{let r=t.split(" ").map(i=>i.toUpperCase()),o=e[[j9,...r].join("_")];if(o)return o;let n=e[j9];if(n)return n},configFileSelector:(e,r)=>{if(e.services){let n=["services",e.services].join(".");if(!r||!r[n])throw new Error(`The services section "${e.services}" specified in the profile is not present in the shared configuration file.`);let i=r[n],s=t.split(" ").map(c=>c.toLowerCase()),a=i[[s.join("_"),M9].join(".")];if(a)return a}let o=e[M9];if(o)return o},default:void 0})});var Fwe,Vwe,F9,V9=v(()=>{dt();Fwe="AWS_IGNORE_CONFIGURED_ENDPOINT_URLS",Vwe="ignore_configured_endpoint_urls",F9={environmentVariableSelector:t=>lr(t,Fwe,Wt.ENV),configFileSelector:t=>lr(t,Vwe,Wt.CONFIG),default:!1}});var iy,H9=v(()=>{dt();L9();V9();iy=async t=>{if(!await fe(F9)())return fe(U9(t??""))()}});var l1,Hwe,Bwe,Kwe,B9,K9,q9=v(()=>{l1=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),K9(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!B9(e)||e.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(t.ForcePathStyle=!0);return t.DisableMultiRegionAccessPoints&&(t.disableMultiRegionAccessPoints=!0,t.DisableMRAP=!0),t},Hwe=/^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/,Bwe=/(\d+\.){3}\d+/,Kwe=/\.\./,B9=t=>Hwe.test(t)&&!Bwe.test(t)&&!Kwe.test(t),K9=t=>{let[e,r,o,,,n]=t.split(":"),i=e==="arn"&&t.split(":").length>=6,s=!!(i&&r&&o&&n);if(i&&!s)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return s}});var Z9=v(()=>{q9()});var W9,J9=v(()=>{W9=(t,e,r,o=!1)=>{let n=async()=>{let i;return o?i=r.clientContextParams?.[t]??r[t]??r[e]:i=r[t]??r[e],typeof i=="function"?i():i};return t==="credentialScope"||e==="CredentialScope"?async()=>{let i=typeof r.credentials=="function"?await r.credentials():r.credentials;return i?.credentialScope??i?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let i=typeof r.credentials=="function"?await r.credentials():r.credentials;return i?.accountId??i?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let i=await n();if(i&&typeof i=="object"){if("url"in i)return i.url.href;if("hostname"in i){let{protocol:s,hostname:a,port:c,path:u}=i;return`${s}//${a}${c?":"+c:""}${u}`}}return i}:n}});var xE=v(()=>{he()});function EE(t){return async(e,r,o,n)=>{if(!o.isCustomEndpoint&&!o.ignoreConfiguredEndpointUrls){let a;o.serviceConfiguredEndpoint?a=await o.serviceConfiguredEndpoint():a=await t(o.serviceId),a&&(o.endpoint=()=>Promise.resolve(Xn(a)),o.isCustomEndpoint=!0,n?.logger?.debug?.(`@smithy/core/endpoints - resolved endpoint from config: ${a}`))}let i=await sy(e,r,o);if(typeof o.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");let s=o.endpointProvider(i,n);if(o.isCustomEndpoint&&o.endpoint){let a=await o.endpoint();if(a?.headers){s.headers??={};for(let[c,u]of Object.entries(a.headers))s.headers[c]=Array.isArray(u)?u:[u]}}return s}}var sy,kE=v(()=>{Z9();J9();xE();sy=async(t,e,r)=>{let o={},n=e?.getEndpointParameterInstructions?.()||{};for(let[i,s]of Object.entries(n))switch(s.type){case"staticContextParams":o[i]=s.value;break;case"contextParams":o[i]=t[s.name];break;case"clientContextParams":case"builtInParams":o[i]=await W9(s.name,i,r,s.type!=="builtInParams")();break;case"operationContextParams":o[i]=s.get(t);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(s))}return Object.keys(n).length===0&&Object.assign(o,r),String(r.serviceId).toLowerCase()==="s3"&&await l1(o),o}});function qwe(t,e,r){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=r}function IE(t){let e=EE(t);return({config:r,instructions:o})=>(n,i)=>async s=>{r.isCustomEndpoint&&qwe(i,"ENDPOINT_OVERRIDE","N");let a=await e(s.input,{getEndpointParameterInstructions(){return o}},{...r},i);i.endpointV2=a,i.authSchemes=a.properties?.authSchemes;let c=i.authSchemes?.[0];if(c){i.signing_region=c.signingRegion,i.signing_service=c.signingName;let l=wt(i)?.selectedHttpAuthScheme?.httpAuthOption;l&&(l.signingProperties=Object.assign(l.signingProperties||{},{signing_region:c.signingRegion,signingRegion:c.signingRegion,signing_service:c.signingName,signingName:c.signingName,signingRegionSet:c.signingRegionSet},c.properties))}return n({...s})}}var d1=v(()=>{he();kE()});function G9(t){let e=IE(t);return(r,o)=>({applyToStack:n=>{n.addRelativeTo(e({config:r,instructions:o}),p1)}})}var Zwe,p1,f1=v(()=>{d1();Zwe={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0},p1={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Zwe.name}});function X9(t){return e=>{let r=e.tls??!0,{endpoint:o,useDualstackEndpoint:n,useFipsEndpoint:i}=e,s=o!=null?async()=>Xn(await lt(o)()):void 0,c=Object.assign(e,{endpoint:s,tls:r,isCustomEndpoint:!!o,useDualstackEndpoint:lt(n??!1),useFipsEndpoint:lt(i??!1),ignoreConfiguredEndpointUrls:!!e.ignoreConfiguredEndpointUrls}),u;return c.serviceConfiguredEndpoint=async()=>(e.serviceId&&!u&&(u=t(e.serviceId)),u),c}}var Y9=v(()=>{he();xE()});var To,Q9=v(()=>{To=class t{nodes;root;conditions;results;constructor(e,r,o,n){this.nodes=e,this.root=r,this.conditions=o,this.results=n}static from(e,r,o,n){return new t(e,r,o,n)}}});var Po,e5=v(()=>{Po=class{capacity;data=new Map;parameters=[];constructor({size:e,params:r}){this.capacity=e??50,r&&(this.parameters=r)}get(e,r){let o=this.hash(e);if(o===!1)return r();if(!this.data.has(o)){if(this.data.size>this.capacity+10){let n=this.data.keys(),i=0;for(;;){let{value:s,done:a}=n.next();if(this.data.delete(s),a||++i>10)break}}this.data.set(o,r())}return this.data.get(o)}size(){return this.data.size}hash(e){let r="",{parameters:o}=this;if(o.length===0)return!1;for(let n of o){let i=e[n],s=i==null?"\0":String(i);if(s.includes("|;"))return!1;r+=s+"|;"}return r}}});var He,t5=v(()=>{He=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var ro=v(()=>{t5()});var bs,r5=v(()=>{bs="endpoints"});function no(t){return typeof t!="object"||t==null?t:"ref"in t?`$${no(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(no).join(", ")})`:JSON.stringify(t,null,2)}var n5=v(()=>{});var ay=v(()=>{r5();n5()});var On,m1=v(()=>{On={}});var h1,o5=v(()=>{h1=(t,e)=>t===e});function g1(...t){for(let e of t)if(e!=null)return e}var i5=v(()=>{});var s5,a5=v(()=>{ro();s5=t=>{let e=t.split("."),r=[];for(let o of e){let n=o.indexOf("[");if(n!==-1){if(o.indexOf("]")!==o.length-1)throw new He(`Path: '${t}' does not end with ']'`);let i=o.slice(n+1,-1);if(Number.isNaN(parseInt(i)))throw new He(`Invalid array index: '${i}' in path: '${t}'`);n!==0&&r.push(o.slice(0,n)),r.push(i)}else r.push(o)}return r}});var cy,c5=v(()=>{ro();a5();cy=(t,e)=>s5(e).reduce((r,o)=>{if(typeof r!="object")throw new He(`Index '${o}' in '${e}' not found in '${JSON.stringify(t)}'`);if(Array.isArray(r)){let n=parseInt(o);return r[n<0?r.length+n:n]}return r[o]},t)});var y1,u5=v(()=>{y1=t=>t!=null});function v1(t,e,r){return t?e:r}var l5=v(()=>{});var w1,d5=v(()=>{w1=t=>!t});var Wwe,ya,b1=v(()=>{Wwe=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),ya=t=>Wwe.test(t)||t.startsWith("[")&&t.endsWith("]")});var $E,_1,S1,p5=v(()=>{$E=St(is());b1();_1={[$E.EndpointURLScheme.HTTP]:80,[$E.EndpointURLScheme.HTTPS]:443},S1=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:f,port:p,protocol:m="",path:g="",query:y={}}=t,w=new URL(`${m}//${f}${p?`:${p}`:""}${g}`);return w.search=Object.entries(y).map(([b,_])=>`${b}=${_}`).join("&"),w}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;let r=e.href,{host:o,hostname:n,pathname:i,protocol:s,search:a}=e;if(a)return null;let c=s.slice(0,-1);if(!Object.values($E.EndpointURLScheme).includes(c))return null;let u=ya(n),l=r.includes(`${o}:${_1[c]}`)||typeof t=="string"&&t.includes(`${o}:${_1[c]}`),d=`${o}${l?`:${_1[c]}`:""}`;return{scheme:c,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:u}}});function x1(t,e,r){if(r===1)return[t];if(t==="")return[""];let o=t.split(e);return r===0?o:o.slice(0,r-1).concat(o.slice(1).join(e))}var f5=v(()=>{});var E1,m5=v(()=>{E1=(t,e)=>t===e});var k1,h5=v(()=>{k1=(t,e,r,o)=>t==null||e>=r||t.length<r||/[^\u0000-\u007f]/.test(t)?null:o?t.substring(t.length-r,t.length-e):t.substring(e,r)});var I1,g5=v(()=>{I1=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var $1=v(()=>{o5();i5();c5();u5();he();l5();d5();p5();f5();m5();h5();g5()});var y5,v5=v(()=>{$1();y5={booleanEquals:h1,coalesce:g1,getAttr:cy,isSet:y1,isValidHostLabel:di,ite:v1,not:w1,parseURL:S1,split:x1,stringEquals:E1,substring:k1,uriEncode:I1}});var AE,A1=v(()=>{$1();AE=(t,e)=>{let r=[],{referenceRecord:o,endpointParams:n}=e,i=0;for(;i<t.length;){let s=t.indexOf("{",i);if(s===-1){r.push(t.slice(i));break}r.push(t.slice(i,s));let a=t.indexOf("}",s);if(a===-1){r.push(t.slice(s));break}t[s+1]==="{"&&t[a+1]==="}"&&(r.push(t.slice(s+1,a)),i=a+2);let c=t.substring(s+1,a);if(c.includes("#")){let[u,l]=c.split("#");r.push(cy(o[u]??n[u],l))}else r.push(o[c]??n[c]);i=a+1}return r.join("")}});var w5,b5=v(()=>{w5=({ref:t},e)=>e.referenceRecord[t]??e.endpointParams[t]});var va,TE,_5,Hp=v(()=>{ro();m1();v5();A1();b5();va=(t,e,r)=>{if(typeof t=="string")return AE(t,r);if(t.fn)return _5.callFunction(t,r);if(t.ref)return w5(t,r);throw new He(`'${e}': ${String(t)} is not a string, function or reference.`)},TE=({fn:t,argv:e},r)=>{let o=Array(e.length);for(let s=0;s<o.length;++s){let a=e[s];typeof a=="boolean"||typeof a=="number"?o[s]=a:o[s]=_5.evaluateExpression(a,"arg",r)}let n=t.indexOf(".");if(n!==-1){let a=On[t.slice(0,n)]?.[t.slice(n+1)];if(typeof a=="function")return a(...o)}let i=y5[t];if(typeof i=="function")return i(...o);throw new Error(`function ${t} not loaded in endpointFunctions.`)},_5={evaluateExpression:va,callFunction:TE}});var S5=v(()=>{Hp()});var PE,T1=v(()=>{ay();ro();S5();PE=(t,e)=>{let{assign:r}=t;if(r&&r in e.referenceRecord)throw new He(`'${r}' is already defined in Reference Record.`);let o=TE(t,e);e.logger?.debug?.(`${bs} evaluateCondition: ${no(t)} = ${no(o)}`);let n=o===""?!0:!!o;return r!=null?{result:n,toAssign:{name:r,value:o}}:{result:n}}});var RE,P1=v(()=>{ro();Hp();RE=(t,e)=>Object.entries(t??{}).reduce((r,[o,n])=>(r[o]=n.map(i=>{let s=va(i,"Header value entry",e);if(typeof s!="string")throw new He(`Header '${o}' value '${s}' is not a string`);return s}),r),{})});var uy,x5,E5,R1=v(()=>{ro();A1();uy=(t,e)=>Object.entries(t).reduce((r,[o,n])=>(r[o]=E5.getEndpointProperty(n,e),r),{}),x5=(t,e)=>{if(Array.isArray(t))return t.map(r=>x5(r,e));switch(typeof t){case"string":return AE(t,e);case"object":if(t===null)throw new He(`Unexpected endpoint property: ${t}`);return E5.getEndpointProperties(t,e);case"boolean":return t;default:throw new He(`Unexpected endpoint property type: ${typeof t}`)}},E5={getEndpointProperty:x5,getEndpointProperties:uy}});var CE,C1=v(()=>{ro();Hp();CE=(t,e)=>{let r=va(t,"Endpoint URL",e);if(typeof r=="string")try{return new URL(r)}catch(o){throw console.error(`Failed to construct URL with ${r}`,o),o}throw new He(`Endpoint URL must be a string, got ${typeof r}`)}});var O1,_s,k5=v(()=>{ro();T1();Hp();P1();R1();C1();O1=1e8,_s=(t,e)=>{let{nodes:r,root:o,results:n,conditions:i}=t,s=o,a={},c={referenceRecord:a,endpointParams:e.endpointParams,logger:e.logger};for(;s!==1&&s!==-1&&s<O1;){let u=3*(Math.abs(s)-1),[l,d,f]=[r[u],r[u+1],r[u+2]],[p,m,g]=i[l],y=PE({fn:p,assign:g,argv:m},c);if(y.toAssign){let{name:w,value:b}=y.toAssign;a[w]=b}s=s>=0===y.result?d:f}if(s>=O1){let u=n[s-O1];if(u[0]===-1){let[,p]=u;throw new He(va(p,"Error",c))}let[l,d,f]=u;return{url:CE(l,c),properties:uy(d,c),headers:RE(f??{},c)}}throw new He("No matching endpoint.")}});var Bp,OE=v(()=>{ay();T1();Bp=(t=[],e)=>{let r={},o={...e,referenceRecord:{...e.referenceRecord}},n=!1;for(let i of t){let{result:s,toAssign:a}=PE(i,o);if(!s)return{result:s};a&&(n=!0,r[a.name]=a.value,o.referenceRecord[a.name]=a.value,e.logger?.debug?.(`${bs} assign: ${a.name} := ${no(a.value)}`))}return n?{result:!0,referenceRecord:r}:{result:!0}}});var I5,$5=v(()=>{ay();OE();P1();R1();C1();I5=(t,e)=>{let{conditions:r,endpoint:o}=t,{result:n,referenceRecord:i}=Bp(r,e);if(!n)return;let s=i?{...e,referenceRecord:{...e.referenceRecord,...i}}:e,{url:a,properties:c,headers:u}=o;e.logger?.debug?.(`${bs} Resolving endpoint from template: ${no(o)}`);let l={url:CE(a,s)};return u!=null&&(l.headers=RE(u,s)),c!=null&&(l.properties=uy(c,s)),l}});var A5,T5=v(()=>{ro();OE();Hp();A5=(t,e)=>{let{conditions:r,error:o}=t,{result:n,referenceRecord:i}=Bp(r,e);if(!n)return;let s=i?{...e,referenceRecord:{...e.referenceRecord,...i}}:e;throw new He(va(o,"Error",s))}});var NE,P5,N1,R5=v(()=>{ro();OE();$5();T5();NE=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let o=I5(r,e);if(o)return o}else if(r.type==="error")A5(r,e);else if(r.type==="tree"){let o=N1.evaluateTreeRule(r,e);if(o)return o}else throw new He(`Unknown endpoint rule: ${r}`);throw new He("Rules evaluation failed")},P5=(t,e)=>{let{conditions:r,rules:o}=t,{result:n,referenceRecord:i}=Bp(r,e);if(!n)return;let s=i?{...e,referenceRecord:{...e.referenceRecord,...i}}:e;return N1.evaluateRules(o,s)},N1={evaluateRules:NE,evaluateTreeRule:P5}});var C5=v(()=>{R5()});var ly,O5=v(()=>{he();ay();ro();C5();ly=(t,e)=>{let{endpointParams:r,logger:o}=e,{parameters:n,rules:i}=t;e.logger?.debug?.(`${bs} Initial EndpointParams: ${no(r)}`);for(let a in n){if(!ce(n,a))continue;let c=n[a],u=r[a];if(u==null&&c.default!=null){r[a]=c.default;continue}if(c.required&&u==null)throw new He(`Missing required parameter: '${a}'`)}let s=NE(i,{endpointParams:r,logger:o,referenceRecord:{}});return e.logger?.debug?.(`${bs} Resolved endpoint: ${no(s)}`),s}});var N5,D5=v(()=>{N5=t=>{let{endpoint:e}=t;return e===void 0&&(t.endpoint=async()=>{throw new Error("@smithy/middleware-endpoint: (default endpointRuleSet) endpoint is not set - you must configure an endpoint.")}),t}});var z5={};yt(z5,{BinaryDecisionDiagram:()=>To,EndpointCache:()=>Po,EndpointError:()=>He,customEndpointFunctions:()=>On,decideEndpoint:()=>_s,endpointMiddleware:()=>Gwe,endpointMiddlewareOptions:()=>p1,getEndpointFromInstructions:()=>Jwe,getEndpointPlugin:()=>ba,isIpAddress:()=>ya,isValidHostLabel:()=>di,middlewareEndpointToEndpointV1:()=>Xn,resolveEndpoint:()=>ly,resolveEndpointConfig:()=>wa,resolveEndpointRequiredConfig:()=>N5,resolveParams:()=>sy,toEndpointV1:()=>Xn});var Jwe,wa,Gwe,ba,It=v(()=>{H9();kE();d1();f1();Y9();he();Q9();e5();k5();b1();he();m1();O5();ro();kE();xE();f1();D5();Jwe=EE(iy),wa=X9(iy),Gwe=IE(iy),ba=G9(iy)});var DE,D1=v(()=>{It();DE=(t,e)=>(r,o)=>async n=>{let i=t,s=o.endpointV2?async()=>Xn(o.endpointV2):i.endpoint;if(!s)throw new Error("No valid endpoint provider available.");let a=await e(n.input,{...t,endpoint:s});return r({...n,request:a})}});function j5(t,e,r){return{applyToStack:o=>{o.add(nE(t,r),z1),o.add(DE(t,e),j1)}}}var z1,j1,M5=v(()=>{FD();D1();z1={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},j1={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});import{createHash as Xwe,createHmac as Ywe}from"node:crypto";function U5(t,e){return Buffer.isBuffer(t)?t:typeof t=="string"?bc(t,e):ArrayBuffer.isView(t)?mi(t.buffer,t.byteOffset,t.byteLength):mi(t)}var zE,L5=v(()=>{_c();UD();zE=class{algorithmIdentifier;secret;hash;constructor(e,r){this.algorithmIdentifier=e,this.secret=r,this.reset()}update(e,r){this.hash.update(hn(U5(e,r)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?Ywe(this.algorithmIdentifier,U5(this.secret)):Xwe(this.algorithmIdentifier)}}});import{Readable as Qwe}from"node:stream";var Kp,M1=v(()=>{$D();Kp=class extends Qwe{expectedChecksum;checksumSourceLocation;checksum;source;base64Encoder;constructor({expectedChecksum:e,checksum:r,source:o,checksumSourceLocation:n,base64Encoder:i}){if(super(),typeof o.pipe!="function")throw new Error(`@smithy/util-stream: unsupported source type ${o?.constructor?.name??o} in ChecksumStream.`);this.source=o,this.base64Encoder=i??_t,this.expectedChecksum=e,this.checksum=r,this.checksumSourceLocation=n,this.source.on("data",this.onSourceData),this.source.on("end",this.onSourceEnd),this.source.on("error",this.onSourceError),this.source.on("close",this.onSourceClose),this.source.pause()}onSourceData=e=>{if(!this.destroyed){try{this.checksum.update(e)}catch(r){this.destroy(r);return}this.push(e)||this.source.pause()}};onSourceEnd=async()=>{if(!this.destroyed){try{let e=await this.checksum.digest(),r=this.base64Encoder(e);if(this.expectedChecksum!==r){this.destroy(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${r}" in response header "${this.checksumSourceLocation}".`));return}}catch(e){this.destroy(e);return}this.push(null)}};onSourceError=e=>{this.destroy(e)};onSourceClose=()=>{!this.destroyed&&!this.source.readableEnded&&this.destroy(new Error("Connection lost or stream closed before all data was received."))};_read(e){this.source.resume()}_destroy(e,r){this.source?.removeListener("data",this.onSourceData),this.source?.removeListener("end",this.onSourceEnd),this.source?.removeListener("error",this.onSourceError),this.source?.removeListener("close",this.onSourceClose),this.source?.destroy(),r(e)}}});var ir,Ic,hi=v(()=>{ir=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream),Ic=t=>typeof Blob=="function"&&(t?.constructor?.name===Blob.name||t instanceof Blob)});var F5,V5=v(()=>{F5=t=>new TextEncoder().encode(t)});var H5,$7e,B5,jE,U1,K5,q5=v(()=>{H5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$7e=Object.entries(H5).reduce((t,[e,r])=>(t[r]=Number(e),t),{}),B5=H5.split(""),jE=6,U1=8,K5=63});function ME(t){let e;typeof t=="string"?e=F5(t):e=t;let r=typeof e=="object"&&typeof e.length=="number",o=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!r&&!o)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let n="";for(let i=0;i<e.length;i+=3){let s=0,a=0;for(let u=i,l=Math.min(i+3,e.length);u<l;u++)s|=e[u]<<(l-u-1)*U1,a+=U1;let c=Math.ceil(a/jE);s<<=c*jE-a;for(let u=1;u<=c;u++){let l=(c-u)*jE;n+=B5[(s&K5<<l)>>l]}n+="==".slice(0,4-c)}return n}var L1=v(()=>{V5();q5()});var ebe,UE,Z5=v(()=>{ebe=typeof ReadableStream=="function"?ReadableStream:function(){},UE=class extends ebe{}});var W5,J5=v(()=>{L1();hi();Z5();W5=({expectedChecksum:t,checksum:e,source:r,checksumSourceLocation:o,base64Encoder:n})=>{if(!ir(r))throw new Error(`@smithy/util-stream: unsupported source type ${r?.constructor?.name??r} in ChecksumStream.`);let i=n??ME;if(typeof TransformStream!="function")throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");let s=new TransformStream({start(){},async transform(c,u){e.update(c),u.enqueue(c)},async flush(c){let u=await e.digest(),l=i(u);if(t!==l){let d=new Error(`Checksum mismatch: expected "${t}" but received "${l}" in response header "${o}".`);c.error(d)}else c.terminate()}});r.pipeThrough(s);let a=s.readable;return Object.setPrototypeOf(a,UE.prototype),a}});function G5(t){return typeof ReadableStream=="function"&&ir(t.source)?W5(t):new Kp(t)}var X5=v(()=>{hi();M1();J5()});var dl,F1=v(()=>{dl=class{allocByteArray;byteLength=0;byteArrays=[];constructor(e){this.allocByteArray=e}push(e){this.byteArrays.push(e),this.byteLength+=e.byteLength}flush(){if(this.byteArrays.length===1){let o=this.byteArrays[0];return this.reset(),o}let e=this.allocByteArray(this.byteLength),r=0;for(let o=0;o<this.byteArrays.length;++o){let n=this.byteArrays[o];e.set(n,r),r+=n.byteLength}return this.reset(),e}reset(){this.byteArrays=[],this.byteLength=0}}});function Y5(t,e,r){let o=t.getReader(),n=!1,i=0,s=["",new dl(u=>new Uint8Array(u))],a=-1,c=async u=>{let{value:l,done:d}=await o.read(),f=l;if(d){if(a!==-1){let p=pl(s,a);_a(p)>0&&u.enqueue(p)}u.close()}else{let p=H1(f,!1);if(a!==p&&(a>=0&&u.enqueue(pl(s,a)),a=p),a===-1){u.enqueue(f);return}let m=_a(f);i+=m;let g=_a(s[a]);if(m>=e&&g===0)u.enqueue(f);else{let y=V1(s,a,f);!n&&i>e*2&&(n=!0,r?.warn(`@smithy/util-stream - stream chunk size ${m} is below threshold of ${e}, automatically buffering.`)),y>=e?u.enqueue(pl(s,a)):await c(u)}}};return new ReadableStream({pull:c})}function V1(t,e,r){switch(e){case 0:return t[0]+=r,_a(t[0]);case 1:case 2:return t[e].push(r),_a(t[e])}}function pl(t,e){switch(e){case 0:let r=t[0];return t[0]="",r;case 1:case 2:return t[e].flush()}throw new Error(`@smithy/util-stream - invalid index ${e} given to flush()`)}function _a(t){return t?.byteLength??t?.length??0}function H1(t,e=!0){return e&&typeof Buffer<"u"&&t instanceof Buffer?2:t instanceof Uint8Array?1:typeof t=="string"?0:-1}var Q5=v(()=>{F1()});import{Readable as tbe}from"node:stream";function e8(t,e,r){if(ir(t))return Y5(t,e,r);let o=new tbe({read(){}}),n=!1,i=0,s=["",new dl(c=>new Uint8Array(c)),new dl(c=>Buffer.from(new Uint8Array(c)))],a=-1;return t.on("data",c=>{let u=H1(c,!0);if(a!==u&&(a>=0&&o.push(pl(s,a)),a=u),a===-1){o.push(c);return}let l=_a(c);i+=l;let d=_a(s[a]);if(l>=e&&d===0)o.push(c);else{let f=V1(s,a,c);!n&&i>e*2&&(n=!0,r?.warn(`@smithy/util-stream - stream chunk size ${l} is below threshold of ${e}, automatically buffering.`)),f>=e&&o.push(pl(s,a))}}),t.on("end",()=>{if(a!==-1){let c=pl(s,a);_a(c)>0&&o.push(c)}o.push(null)}),o}var t8=v(()=>{F1();Q5();hi()});var r8,n8=v(()=>{r8=(t,e)=>{let{base64Encoder:r,bodyLengthChecker:o,checksumAlgorithmFn:n,checksumLocationName:i,streamHasher:s}=e,a=r!==void 0&&o!==void 0&&n!==void 0&&i!==void 0&&s!==void 0,c=a?s(n,t):void 0;Promise.resolve(c).catch(()=>{});let u=t.getReader();return new ReadableStream({async pull(l){let{value:d,done:f}=await u.read();if(f){if(l.enqueue(`0\r
15
15
  `),a){let p=r(await c);l.enqueue(`${i}:${p}\r
16
16
  `),l.enqueue(`\r
17
17
  `)}l.close()}else l.enqueue(`${(o(d)||0).toString(16)}\r
@@ -21,9 +21,9 @@ ${d}\r
21
21
  `)||r.pause())}),r.on("error",f=>{d.destroy(f)}),r.pause(),r.on("end",async()=>{try{if(d.push(`0\r
22
22
  `),u){let f=n(await l);d.push(`${a}:${f}\r
23
23
  `),d.push(`\r
24
- `)}d.push(null)}catch(f){d.destroy(f)}}),d}var i8=v(()=>{n8();hi()});async function s8(t,e){let r=0,o=[],n=t.getReader(),i=!1;for(;!i;){let{done:c,value:u}=await n.read();if(u&&(o.push(u),r+=u?.byteLength??0),r>=e)break;i=c}n.releaseLock();let s=new Uint8Array(Math.min(e,r)),a=0;for(let c of o){if(c.byteLength>s.byteLength-a){s.set(c.subarray(0,s.byteLength-a),a);break}else s.set(c,a);a+=c.length}return s}var a8=v(()=>{});import{Writable as nbe}from"node:stream";var c8,Bz,u8=v(()=>{Qg();a8();hi();c8=(t,e)=>ir(t)?s8(t,e):new Promise((r,o)=>{let n=new Bz;n.limit=e,t.pipe(n),t.on("error",i=>{n.end(),o(i)}),n.on("error",o),n.on("finish",function(){let i=ms(this.buffers);r(i)})}),Bz=class extends nbe{buffers=[];limit=1/0;bytesBuffered=0;_write(e,r,o){if(this.buffers.push(e),this.bytesBuffered+=e.byteLength??0,this.bytesBuffered>=this.limit){let n=this.bytesBuffered-this.limit,i=this.buffers[this.buffers.length-1];this.buffers[this.buffers.length-1]=i.subarray(0,i.byteLength-n),this.emit("finish")}o()}}});var l8,d8=v(()=>{l8=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});async function Kz(t){return t.arrayBuffer().then(e=>new Uint8Array(e))}async function qz(t){let e=[],r=t.getReader(),o=0;for(;;){let{done:n,value:i}=await r.read();if(i&&(e.push(i),o+=i.length),n)break}return ms(e,o)}var p8,Zz=v(()=>{Qg();hi();p8=async t=>Ic(t)?Kz(t):qz(t)});var f8,h8,m8,g8=v(()=>{Lz();MD();d8();Zz();hi();f8="The stream has already been transformed.",h8=t=>{if(!m8(t)&&!ir(t)){let n=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${n}`)}let e=!1,r=async()=>{if(e)throw new Error(f8);return e=!0,await p8(t)},o=n=>{if(typeof n.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
25
- If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return n.stream()};return Object.assign(t,{transformToByteArray:r,transformToString:async n=>{let i=await r();if(n==="base64")return ME(i);if(n==="hex")return $o(i);if(n===void 0||n==="utf8"||n==="utf-8")return l8(i);if(typeof TextDecoder=="function")return new TextDecoder(n).decode(i);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(e)throw new Error(f8);if(e=!0,m8(t))return o(t);if(ir(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},m8=t=>typeof Blob=="function"&&t instanceof Blob});import{Writable as obe}from"node:stream";var LE,Wz,Jz=v(()=>{Qg();Zz();hi();LE=t=>Ic(t)?Kz(t):ir(t)?qz(t):new Promise((e,r)=>{let o=new Wz,n=t;n.pipe(o),n.on("error",i=>{o.end(),r(i)}),o.on("error",r),o.on("finish",function(){let i=ms(this.bufferedBytes);e(i)})}),Wz=class extends obe{bufferedBytes=[];_write(e,r,o){this.bufferedBytes.push(e),o()}}});import{Readable as Gz}from"node:stream";var y8,FE,v8=v(()=>{_c();g8();Jz();y8="The stream has already been transformed.",FE=t=>{if(!(t instanceof Gz))try{return h8(t)}catch{let n=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${n}`)}let e=!1,r=async()=>{if(e)throw new Error(y8);return e=!0,await LE(t)};return Object.assign(t,{transformToByteArray:r,transformToString:async o=>{let n=await r();return o===void 0||Buffer.isEncoding(o)?mi(n.buffer,n.byteOffset,n.byteLength).toString(o):new TextDecoder(o).decode(n)},transformToWebStream:()=>{if(e)throw new Error(y8);if(t.readableFlowing!==null)throw new Error("The stream has been consumed by other callbacks.");if(typeof Gz.toWeb!="function")throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return e=!0,Gz.toWeb(t)}})}});async function w8(t){return typeof t.stream=="function"&&(t=t.stream()),t.tee()}var b8=v(()=>{});import{PassThrough as _8}from"node:stream";async function S8(t){if(ir(t)||Ic(t))return w8(t);let e=new _8,r=new _8;return t.pipe(e),t.pipe(r),[e,r]}var x8=v(()=>{b8();hi()});var Zp={};yt(Zp,{ChecksumStream:()=>Kp,Hash:()=>zE,LazyJsonString:()=>Zt,NumericValue:()=>Ne,Uint8ArrayBlobAdapter:()=>fl,_parseEpochTimestamp:()=>Ec,_parseRfc3339DateTimeWithOffset:()=>Y0,_parseRfc7231DateTime:()=>Q0,calculateBodyLength:()=>fs,concatBytes:()=>ms,copyDocumentWithTransform:()=>G3,createBufferedReadable:()=>e8,createChecksumStream:()=>G5,dateToUtcString:()=>Qn,deserializerMiddleware:()=>nE,deserializerMiddlewareOption:()=>zz,expectBoolean:()=>Q3,expectByte:()=>K0,expectFloat32:()=>Gg,expectInt:()=>eW,expectInt32:()=>H0,expectLong:()=>Rp,expectNonNull:()=>tW,expectNumber:()=>Pp,expectObject:()=>TD,expectShort:()=>B0,expectString:()=>rW,expectUnion:()=>Z0,fromArrayBuffer:()=>mi,fromBase64:()=>Mt,fromHex:()=>rE,fromString:()=>bc,fromUtf8:()=>or,generateIdempotencyToken:()=>oo,getAwsChunkedEncodingStream:()=>o8,getSerdePlugin:()=>j5,handleFloat:()=>oW,hasOwn:()=>ce,headStream:()=>c8,isArrayBuffer:()=>L0,isBlob:()=>Ic,isReadableStream:()=>ir,limitedParseDouble:()=>J0,limitedParseFloat:()=>iW,limitedParseFloat32:()=>sW,logger:()=>Cp,nv:()=>tE,parseBoolean:()=>Y3,parseEpochTimestamp:()=>zp,parseRfc3339DateTime:()=>lW,parseRfc3339DateTimeWithOffset:()=>Dp,parseRfc7231DateTime:()=>xc,quoteHeader:()=>X0,sdkStreamMixin:()=>FE,serializerMiddleware:()=>DE,serializerMiddlewareOption:()=>jz,splitEvery:()=>eE,splitHeader:()=>jp,splitStream:()=>S8,streamCollector:()=>LE,strictParseByte:()=>G0,strictParseDouble:()=>Xg,strictParseFloat:()=>nW,strictParseFloat32:()=>W0,strictParseInt:()=>cW,strictParseInt32:()=>uW,strictParseLong:()=>PD,strictParseShort:()=>Sc,toBase64:()=>_t,toHex:()=>$o,toUint8Array:()=>hn,toUtf8:()=>Dt,v4:()=>qp});import{getRandomValues as ibe}from"node:crypto";var fl,sbe,qp,oo,de=v(()=>{B3();$D();q3();F0();Z3();J3();X3();dW();pW();RD();fW();gW();yW();vW();bW();MD();SW();UD();Qg();_c();ID();FD();M5();Dz();L5();Mz();X5();t8();i8();u8();v8();x8();hi();Jz();he();fl=class extends K3(Dt,or,_t,Mt){},sbe=ibe,qp=W3(sbe),oo=qp});var Ar,VE=v(()=>{de();Ar=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return fl.mutate(t);if(!t)return fl.mutate(new Uint8Array);let r=e.streamCollector(t);return fl.mutate(await r)}});function gi(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var HE=v(()=>{});var dr,Wp=v(()=>{dr=class{serdeContext;setSerdeContext(e){this.serdeContext=e}}});async function BE(t,e,r=1024*1024){let o=t.size,n=0;for(;n<o;){let i=t.slice(n,Math.min(o,n+r));e(new Uint8Array(await i.arrayBuffer())),n+=i.size}}var Xz=v(()=>{});var E8,k8=v(()=>{Xz();E8=async function(e,r){let o=new e;return await BE(r,n=>{o.update(n)}),o.digest()}});import{Writable as abe}from"node:stream";var Jp,Yz=v(()=>{de();Jp=class extends abe{hash;constructor(e,r){super(r),this.hash=e}_write(e,r,o){try{this.hash.update(hn(e))}catch(n){return o(n)}o()}}});import{createReadStream as cbe}from"node:fs";var I8,ube,$8=v(()=>{Yz();I8=(t,e)=>new Promise((r,o)=>{if(!ube(e)){o(new Error("Unable to calculate hash for non-file streams."));return}let n=cbe(e.path,{start:e.start,end:e.end}),i=new t,s=new Jp(i);n.pipe(s),n.on("error",a=>{s.end(),o(a)}),s.on("error",o),s.on("finish",function(){i.digest().then(r).catch(o)})}),ube=t=>typeof t.path=="string"});var A8,T8=v(()=>{Yz();A8=(t,e)=>{if(e.readableFlowing!==null)throw new Error("Unable to calculate hash for flowing readable stream");let r=new t,o=new Jp(r);return e.pipe(o),new Promise((n,i)=>{e.on("error",s=>{o.end(),i(s)}),o.on("error",i),o.on("finish",()=>{r.digest().then(n).catch(i)})})}});function Qz(t,e){let r=t[0],o=t[1],n=t[2],i=t[3];for(let s=0;s<64;++s){let a,c;s<16?(a=o&n|~o&i,c=s):s<32?(a=i&o|n&~i,c=(5*s+1)%16):s<48?(a=o^n^i,c=(3*s+5)%16):(a=n^(o|~i),c=7*s%16);let u=e.getUint32(c*4,!0),l=i;i=n,n=o;let d=lbe[(s>>4)*4+(s&3)],f=(r+a&$c)+(u+dbe[s]&$c)&$c;o=o+((f<<d|f>>>32-d)>>>0)&$c,r=l}t[0]=t[0]+r&$c,t[1]=t[1]+o&$c,t[2]=t[2]+n&$c,t[3]=t[3]+i&$c}var Gp,P8,$c,lbe,dbe,e1=v(()=>{de();Gp=class{digestLength=16;state=Uint32Array.from(P8);writeBuffer=new DataView(new ArrayBuffer(64));bufferLength=0;bytesHashed=0;update(e){let r=hn(e),o=0,n=r.byteLength;for(this.bytesHashed+=n;n>0;)this.writeBuffer.setUint8(this.bufferLength++,r[o++]),--n,this.bufferLength===64&&(Qz(this.state,this.writeBuffer),this.bufferLength=0)}async digest(){let e=Uint32Array.from(this.state),r=new DataView(this.writeBuffer.buffer.slice(0)),o=this.bufferLength,n=this.bytesHashed*8;if(r.setUint8(o++,128),this.bufferLength%64>=56){for(let a=o;a<64;++a)r.setUint8(a,0);Qz(e,r),o=0}for(let a=o;a<56;++a)r.setUint8(a,0);r.setUint32(56,n>>>0,!0),r.setUint32(60,Math.floor(n/2**32),!0),Qz(e,r);let i=new Uint8Array(16),s=new DataView(i.buffer);for(let a=0;a<4;++a)s.setUint32(a*4,e[a],!0);return i}reset(){this.state.set(P8),this.writeBuffer=new DataView(new ArrayBuffer(64)),this.bufferLength=0,this.bytesHashed=0}},P8=[1732584193,4023233417,2562383102,271733878],$c=4294967295,lbe=Uint8Array.of(7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21),dbe=Array.from({length:64},(t,e)=>Math.abs(Math.sin(e+1))*2**32>>>0)});import{createHash as t1}from"node:crypto";function fbe(){return class{digestLength=16;hash=t1("md5");update(e){this.hash.update(hn(e))}async digest(){let e=this.hash.copy().digest();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=t1("md5")}}}var pbe,r1,R8=v(()=>{de();e1();pbe=(()=>{try{return t1("md5"),!0}catch{return!1}})(),r1=pbe?fbe():Gp});var C8,n1,Xp,o1=v(()=>{C8=new Uint32Array(256);for(let t=0;t<256;++t){let e=t;for(let r=0;r<8;++r)e=e&1?3988292384^e>>>1:e>>>1;C8[t]=e>>>0}n1=4294967295,Xp=class{digestLength=4;checksum=n1;update(e){for(let r=0;r<e.length;++r)this.checksum=this.checksum>>>8^C8[(this.checksum^e[r])&255]}digestSync(){return(this.checksum^n1)>>>0}async digest(){let e=this.digestSync(),r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e,!1),r}reset(){this.checksum=n1}}});import*as i1 from"node:zlib";function mbe(t){return class{digestLength=4;value=0;update(r){this.value=t(r,this.value)}digestSync(){return this.value>>>0}async digest(){let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,this.digestSync(),!1),r}reset(){this.value=0}}}var O8,ml,N8=v(()=>{o1();O8=typeof i1.crc32=="function"?i1.crc32:void 0,ml=O8?mbe(O8):Xp});var Tr,D8,hbe,Sa,z8,gbe,KE=v(()=>{de();Tr=64,D8=32,hbe=2**53-1,Sa=class t{digestLength=D8;state=Int32Array.from(z8);w;buffer=new Uint8Array(64);bufferLength=0;bytesHashed=0;finished=!1;inner;outer;constructor(e){if(e){let r=t.normalizeKey(e);this.inner=new t,this.outer=new t;let{inner:o,outer:n}=this,i=new Uint8Array(Tr*2);for(let s=0;s<Tr;++s)i[s]=54^r[s],i[s+Tr]=92^r[s];o.update(i.subarray(0,Tr)),n.update(i.subarray(Tr))}}update(e){if(this.finished)throw new Error("Attempted to update an already finished HMAC.");if(this.inner){this.inner.update(e);return}let r=hn(e),o=0,{byteLength:n}=r;if(this.bytesHashed+=n,this.bytesHashed*8>hbe)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=r[o++],n--,this.bufferLength===Tr&&(this.hashBuffer(),this.bufferLength=0)}async digest(){let{inner:e,outer:r}=this;if(e&&r){if(this.finished)throw new Error("Attempted to digest an already finished HMAC.");this.finished=!0;let o=e.digestSync();return r.update(o),r.digestSync()}return this.digestSync()}reset(){this.state=Int32Array.from(z8),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0}digestSync(){let e=this.state.slice(),r=this.buffer.slice(),o=this.bufferLength,n=this.bytesHashed*8,i=new DataView(r.buffer,r.byteOffset,r.byteLength);if(i.setUint8(o++,128),(o-1)%Tr>=Tr-8){for(let a=o;a<Tr;++a)i.setUint8(a,0);this.hashBufferWith(e,r),o=0}for(let a=o;a<Tr-8;++a)i.setUint8(a,0);i.setUint32(Tr-8,Math.floor(n/4294967296),!1),i.setUint32(Tr-4,n,!1),this.hashBufferWith(e,r);let s=new Uint8Array(D8);for(let a=0;a<8;++a)s[a*4]=e[a]>>>24&255,s[a*4+1]=e[a]>>>16&255,s[a*4+2]=e[a]>>>8&255,s[a*4+3]=e[a]>>>0&255;return s}static normalizeKey(e){let r=hn(e);if(r.byteLength>Tr){let o=new t;o.update(r);let n=o.digestSync(),i=new Uint8Array(Tr);return i.set(n),i}if(r.byteLength<Tr){let o=new Uint8Array(Tr);return o.set(r),o}return r}hashBuffer(){this.hashBufferWith(this.state,this.buffer)}hashBufferWith(e,r){let o=this.w??=new Int32Array(64),n=e[0],i=e[1],s=e[2],a=e[3],c=e[4],u=e[5],l=e[6],d=e[7];for(let f=0;f<Tr;++f){if(f<16)o[f]=(r[f*4]&255)<<24|(r[f*4+1]&255)<<16|(r[f*4+2]&255)<<8|r[f*4+3]&255;else{let g=o[f-2],y=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10;g=o[f-15];let w=(g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3;o[f]=(y+o[f-7]|0)+(w+o[f-16]|0)}let p=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&u^~c&l)|0)+(d+(gbe[f]+o[f]|0)|0)|0,m=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&s^i&s)|0;d=l,l=u,u=c,c=a+p|0,a=s,s=i,i=n,n=p+m|0}e[0]+=n,e[1]+=i,e[2]+=s,e[3]+=a,e[4]+=c,e[5]+=u,e[6]+=l,e[7]+=d}},z8=new Int32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),gbe=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298])});import{createHash as j8,createHmac as ybe}from"node:crypto";function wbe(){return class{digestLength=32;secret;hash;isHmac;finished=!1;constructor(e){this.secret=e,this.isHmac=!!e,this.hash=this.createHash()}update(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");this.hash.update(e)}async digest(){let e;return this.isHmac?(this.finished=!0,e=this.hash.digest()):e=this.hash.copy().digest(),new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=this.createHash(),this.finished=!1}createHash(){return this.secret?ybe("sha256",bbe(this.secret)):j8("sha256")}}}function bbe(t){return typeof t=="string"?t:ArrayBuffer.isView(t)?Buffer.from(t.buffer,t.byteOffset,t.byteLength):Buffer.from(t)}var vbe,yi,M8=v(()=>{KE();vbe=(()=>{try{return j8("sha256"),!0}catch{return!1}})(),yi=vbe?wbe():Sa});var _be,Sbe,xbe,qE,Ebe,ZE,U8=v(()=>{de();KE();({digest:_be,sign:Sbe,importKey:xbe}=globalThis?.crypto?.subtle??{}),qE=typeof _be=="function"&&typeof Sbe=="function"&&typeof xbe=="function"?globalThis.crypto.subtle:void 0,Ebe=8*1024*1024,ZE=class{digestLength=32;secret;pending=[];pendingBytes=0;fallback;finished=!1;constructor(e){e&&(this.secret=hn(e))}update(e){if(this.finished)throw new Error("Attempted to update an already finished HMAC.");if(this.fallback){this.fallback.update(e);return}this.pending.push(e.slice()),this.pendingBytes+=e.byteLength,this.pendingBytes>=Ebe&&this.switchToFallback()}async digest(){if(this.fallback)return this.fallback.digest();if(this.secret&&this.finished)throw new Error("Attempted to digest an already finished HMAC.");let e=ms(this.pending);if(qE){if(this.secret){this.finished=!0;let n=await qE.importKey("raw",this.secret,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),i=await qE.sign("HMAC",n,e);return new Uint8Array(i)}let o=await qE.digest("SHA-256",e);return new Uint8Array(o)}let r=new Sa(this.secret);return r.update(e),r.digest()}reset(){this.pending=[],this.pendingBytes=0,this.fallback=void 0,this.finished=!1}switchToFallback(){let e=new Sa(this.secret);for(let r of this.pending)e.update(r);this.fallback=e,this.pending=[],this.pendingBytes=0}}});var L8={};yt(L8,{Crc32:()=>ml,Crc32Js:()=>Xp,Crc32Node:()=>ml,Md5:()=>r1,Md5Js:()=>Gp,Md5Node:()=>r1,Sha256:()=>yi,Sha256Js:()=>Sa,Sha256Node:()=>yi,Sha256WebCrypto:()=>ZE,blobHasher:()=>E8,blobReader:()=>BE,fileStreamHasher:()=>I8,readableStreamHasher:()=>A8});var Ac=v(()=>{k8();$8();T8();e1();R8();o1();N8();KE();M8();U8();Xz()});function F8(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var Tc,s1=v(()=>{de();Tc=class t{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let o=7,n=Math.abs(Math.round(e));o>-1&&n>0;o--,n/=256)r[o]=n;return e<0&&F8(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&F8(e),parseInt($o(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var Yp,V8,H8,kbe,Ibe,$be,Abe,Tbe,Pbe,Rbe,Cbe,Obe,a1=v(()=>{he();de();s1();Yp=class{toUtf8;fromUtf8;constructor(e,r){this.toUtf8=e,this.fromUtf8=r}format(e){let r=[];for(let i in e){if(!ce(e,i))continue;let s=this.fromUtf8(i);r.push(Uint8Array.from([s.byteLength]),s,this.formatHeaderValue(e[i]))}let o=new Uint8Array(r.reduce((i,s)=>i+s.byteLength,0)),n=0;for(let i of r)o.set(i,n),n+=i.byteLength;return o}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let o=new DataView(new ArrayBuffer(5));return o.setUint8(0,4),o.setInt32(1,e.value,!1),new Uint8Array(o.buffer);case"long":let n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let s=new Uint8Array(i.buffer);return s.set(e.value,3),s;case"string":let a=this.fromUtf8(e.value),c=new DataView(new ArrayBuffer(3+a.byteLength));c.setUint8(0,7),c.setUint16(1,a.byteLength,!1);let u=new Uint8Array(c.buffer);return u.set(a,3),u;case"timestamp":let l=new Uint8Array(9);return l[0]=8,l.set(Tc.fromNumber(e.value.valueOf()).bytes,1),l;case"uuid":if(!Obe.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(rE(e.value.replace(/-/g,"")),1),d}}parse(e){let r={},o=0;for(;o<e.byteLength;){let n=e.getUint8(o++),i=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+o,n));switch(o+=n,e.getUint8(o++)){case 0:r[i]={type:H8,value:!0};break;case 1:r[i]={type:H8,value:!1};break;case 2:r[i]={type:kbe,value:e.getInt8(o++)};break;case 3:r[i]={type:Ibe,value:e.getInt16(o,!1)},o+=2;break;case 4:r[i]={type:$be,value:e.getInt32(o,!1)},o+=4;break;case 5:r[i]={type:Abe,value:new Tc(new Uint8Array(e.buffer,e.byteOffset+o,8))},o+=8;break;case 6:let s=e.getUint16(o,!1);o+=2,r[i]={type:Tbe,value:new Uint8Array(e.buffer,e.byteOffset+o,s)},o+=s;break;case 7:let a=e.getUint16(o,!1);o+=2,r[i]={type:Pbe,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+o,a))},o+=a;break;case 8:r[i]={type:Rbe,value:new Date(new Tc(new Uint8Array(e.buffer,e.byteOffset+o,8)).valueOf())},o+=8;break;case 9:let c=new Uint8Array(e.buffer,e.byteOffset+o,16);o+=16,r[i]={type:Cbe,value:`${$o(c.subarray(0,4))}-${$o(c.subarray(4,6))}-${$o(c.subarray(6,8))}-${$o(c.subarray(8,10))}-${$o(c.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(V8||(V8={}));H8="boolean",kbe="byte",Ibe="short",$be="integer",Abe="long",Tbe="binary",Pbe="string",Rbe="timestamp",Cbe="uuid",Obe=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});function K8({byteLength:t,byteOffset:e,buffer:r}){if(t<Nbe)throw new Error("Provided message too short to accommodate event stream message overhead");let o=new DataView(r,e,t),n=o.getUint32(0,!1);if(t!==n)throw new Error("Reported message length does not match received message length");let i=o.getUint32(B8,!1),s=o.getUint32(Pc,!1),a=o.getUint32(t-hl,!1),c=new ml;if(c.update(new Uint8Array(r,e,Pc)),s!==c.digestSync())throw new Error(`The prelude checksum specified in the message (${s}) does not match the calculated CRC32 checksum (${c.digestSync()})`);if(c.update(new Uint8Array(r,e+Pc,t-(Pc+hl))),a!==c.digestSync())throw new Error(`The message checksum (${c.digestSync()}) did not match the expected value of ${a}`);return{headers:new DataView(r,e+Pc+hl,i),body:new Uint8Array(r,e+Pc+hl+i,n-i-(Pc+hl+hl))}}var B8,Pc,hl,Nbe,q8=v(()=>{Ac();B8=4,Pc=B8*2,hl=4,Nbe=Pc+hl*2});var Qp,c1=v(()=>{Ac();a1();q8();Qp=class{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,r){this.headerMarshaller=new Yp(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){let o=this.headerMarshaller.format(e),n=o.byteLength+r.byteLength+16,i=new Uint8Array(n),s=new DataView(i.buffer,i.byteOffset,i.byteLength),a=new ml;return s.setUint32(0,n,!1),s.setUint32(4,o.byteLength,!1),a.update(i.subarray(0,8)),s.setUint32(8,a.digestSync(),!1),i.set(o,12),i.set(r,o.byteLength+12),a.update(i.subarray(8,n-4)),s.setUint32(n-4,a.digestSync(),!1),i}decode(e){let{headers:r,body:o}=K8(e);return{headers:this.headerMarshaller.parse(r),body:o}}formatHeaders(e){return this.headerMarshaller.format(e)}}});var ef,u1=v(()=>{ef=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}}});var tf,l1=v(()=>{tf=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}}});var rf,d1=v(()=>{rf=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let r=await this.options.deserializer(e);r!==void 0&&(yield r)}}}});var nf,p1=v(()=>{nf=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}}});function WE(t){let e=0,r=0,o=null,n=null,i=a=>{if(typeof a!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+a);e=a,r=4,o=new Uint8Array(a),new DataView(o.buffer).setUint32(0,a,!1)},s=async function*(){let a=t[Symbol.asyncIterator]();for(;;){let{value:c,done:u}=await a.next();if(u){if(e)if(e===r)yield o;else throw new Error("Truncated event message received.");else return;return}let l=c.length,d=0;for(;d<l;){if(!o){let p=l-d;n||(n=new Uint8Array(4));let m=Math.min(4-r,p);if(n.set(c.slice(d,d+m),r),r+=m,d+=m,r<4)break;i(new DataView(n.buffer).getUint32(0,!1)),n=null}let f=Math.min(e-r,l-d);o.set(c.slice(d,d+f),r),r+=f,d+=f,e&&e===r&&(yield o,o=null,e=0,r=0)}}};return{[Symbol.asyncIterator]:s}}var f1=v(()=>{});function Z8(t,e){let r=dy(e.deserializer,e.toUtf8);return{[Symbol.asyncIterator]:async function*(){for await(let o of t){let n=e.eventStreamCodec.decode(o),i=await r(n);i!==void 0&&(yield i)}}}}function dy(t,e){return async function(r){let{value:o}=r.headers[":message-type"];if(o==="error"){let n=new Error(r.headers[":error-message"].value||"UnknownError");throw n.name=r.headers[":error-code"].value,n}else if(o==="exception"){let n=r.headers[":exception-type"].value,i={[n]:r},s=await t(i);if(s.$unknown){let a=new Error(e(r.body));throw a.name=n,a}throw s[n]}else if(o==="event"){let n={[r.headers[":event-type"].value]:r},i=await t(n);return i.$unknown?void 0:i}else throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}var m1=v(()=>{});var gl,W8,h1=v(()=>{c1();u1();l1();d1();p1();f1();m1();gl=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:r}){this.eventStreamCodec=new Qp(e,r),this.utfEncoder=e}deserialize(e,r){let o=WE(e);return new rf({messageStream:new ef({inputStream:o,decoder:this.eventStreamCodec}),deserializer:dy(r,this.utfEncoder)})}serialize(e,r){return new tf({messageStream:new nf({inputStream:e,serializer:r}),encoder:this.eventStreamCodec,includeEndFrame:!0})}},W8=t=>new gl(t)});import{Readable as Dbe}from"node:stream";async function*zbe(t){let e=!1,r=!1,o=new Array;for(t.on("error",n=>{if(e||(e=!0),n)throw n}),t.on("data",n=>{o.push(n)}),t.on("end",()=>{e=!0});!r;){let n=await new Promise(i=>setTimeout(()=>i(o.shift()),0));n&&(yield n),r=e&&o.length===0}}var py,J8,G8=v(()=>{h1();py=class{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:r}){this.universalMarshaller=new gl({utf8Decoder:r,utf8Encoder:e})}deserialize(e,r){let o=typeof e[Symbol.asyncIterator]=="function"?e:zbe(e);return this.universalMarshaller.deserialize(o,r)}serialize(e,r){return Dbe.from(this.universalMarshaller.serialize(e,r))}},J8=t=>new py(t)});var X8,Y8,Q8=v(()=>{X8=t=>({[Symbol.asyncIterator]:async function*(){let e=t.getReader();try{for(;;){let{done:r,value:o}=await e.read();if(r)return;yield o}}finally{e.releaseLock()}}}),Y8=t=>{let e=t[Symbol.asyncIterator]();return new ReadableStream({async pull(r){let{done:o,value:n}=await e.next();if(o)return r.close();r.enqueue(n)}})}});var eJ,tJ=v(()=>{eJ=t=>Object.assign(t,{eventStreamMarshaller:t.eventStreamSerdeProvider(t)})});var JE,rJ=v(()=>{he();De();de();JE=class{marshaller;serializer;deserializer;serdeContext;defaultContentType;compositeErrorRegistry;constructor({marshaller:e,serializer:r,deserializer:o,serdeContext:n,defaultContentType:i,compositeErrorRegistry:s}){this.marshaller=e,this.serializer=r,this.deserializer=o,this.serdeContext=n,this.defaultContentType=i,this.compositeErrorRegistry=s}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o,initialMessageType:n}){let i=this.marshaller,s=r.getEventStreamMember(),a=r.getMemberSchema(s),c=this.serializer,u=this.defaultContentType,l=Symbol("initialRequestMarker"),d={async*[Symbol.asyncIterator](){if(o){let f={":event-type":{type:"string",value:n??"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:u}};c.write(r,o);let p=c.flush();yield{[l]:!0,headers:f,body:p}}for await(let f of e)yield f}};return i.serialize(d,f=>{if(f[l])return{headers:f.headers,body:f.body};let p="";for(let _ in f)if(ce(f,_)&&_!=="__type"){p=_;break}let{additionalHeaders:m,body:g,eventType:y,explicitPayloadContentType:w}=this.writeEventBody(p,a,f);return{headers:{":event-type":{type:"string",value:y},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:w??u},...m},body:g}})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o,initialMessageType:n}){let i=this.marshaller,s=r.getEventStreamMember(),c=r.getMemberSchema(s).getMemberSchemas(),u=Symbol("initialResponseMarker"),l=i.deserialize(e.body,async p=>{let m="";for(let y in p)if(ce(p,y)&&y!=="__type"){m=y;break}let g=p[m].body;if(m===(n??"initial-response")){let y=await this.deserializer.read(r,g);return delete y[s],{[u]:!0,...y}}else if(m in c){let y=c[m];if(y.isStructSchema()){let w={},b=!1;for(let[_,k]of y.structIterator()){let{eventHeader:$,eventPayload:D}=k.getMergedTraits();if(b=b||!!($||D),D)k.isBlobSchema()?w[_]=g:k.isStringSchema()?w[_]=(this.serdeContext?.utf8Encoder??Dt)(g):k.isStructSchema()&&(w[_]=await this.deserializer.read(k,g));else if($){let K=p[m].headers[_]?.value;K!=null&&(k.isNumericSchema()?K&&typeof K=="object"&&"bytes"in K?w[_]=BigInt(K.toString()):w[_]=Number(K):w[_]=K)}}return{[m]:await this.readEventMember(y,g,b,w)}}return{[m]:await this.deserializer.read(y,g)}}else return{$unknown:p}}),d=l[Symbol.asyncIterator](),f=await d.next();if(f.done)return l;if(f.value?.[u]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let p in f.value)ce(f.value,p)&&(o[p]=f.value[p])}return{async*[Symbol.asyncIterator](){for(f?.value?.[u]||(yield f.value);;){let{done:p,value:m}=await d.next();if(p)break;yield m}}}}async readEventMember(e,r,o,n){let i,s=e.getSchema();if(Array.isArray(s)&&s[0]===-3){let c=s[1],u=bt.for(c);this.compositeErrorRegistry?.copyFrom(u),i=(this.compositeErrorRegistry??u)?.getErrorCtor(s)}let a=o?n:r.byteLength===0?{}:await this.deserializer.read(e,r);if(i){let c=a.message??a.Message??"Unknown",u={},l=e.getMergedTraits().error;return l&&(u.$fault=l),Object.assign(new i({}),u,{message:c},a)}return a}writeEventBody(e,r,o){let n=this.serializer,i=e,s=null,a,c=r.getSchema()[4].includes(e),u={};if(c){let f=r.getMemberSchema(e);if(f.isStructSchema()){for(let[p,m]of f.structIterator()){let{eventHeader:g,eventPayload:y}=m.getMergedTraits();if(y)s=p;else if(g){let w=o[e][p],b="binary";m.isNumericSchema()?(-2)**31<=w&&w<=2**31-1?b="integer":b="long":m.isTimestampSchema()?b="timestamp":m.isStringSchema()?b="string":m.isBooleanSchema()&&(b="boolean"),w!=null&&(u[p]={type:b,value:w},delete o[e][p])}}if(s!==null){let p=f.getMemberSchema(s);p.isBlobSchema()?a="application/octet-stream":p.isStringSchema()&&(a="text/plain"),n.write(p,o[e][s])}else n.write(f,o[e])}else if(f.isUnitSchema())n.write(f,{});else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else{let[f,p]=o[e];i=f,n.write(15,p)}let l=n.flush()??new Uint8Array;return{body:typeof l=="string"?(this.serdeContext?.utf8Decoder??or)(l):l,eventType:i,explicitPayloadContentType:a,additionalHeaders:u}}}});var nJ={};yt(nJ,{EventStreamCodec:()=>Qp,EventStreamMarshaller:()=>py,EventStreamSerde:()=>JE,HeaderMarshaller:()=>Yp,Int64:()=>Tc,MessageDecoderStream:()=>ef,MessageEncoderStream:()=>tf,SmithyMessageDecoderStream:()=>rf,SmithyMessageEncoderStream:()=>nf,UniversalEventStreamMarshaller:()=>gl,eventStreamSerdeProvider:()=>J8,getChunkedStream:()=>WE,getMessageUnmarshaller:()=>dy,getUnmarshalledStream:()=>Z8,iterableToReadableStream:()=>Y8,readableStreamToIterable:()=>X8,resolveEventStreamSerdeConfig:()=>eJ,universalEventStreamSerdeProvider:()=>W8});var oJ=v(()=>{c1();a1();s1();u1();l1();d1();p1();G8();Q8();h1();f1();m1();tJ();rJ()});var Rc,GE=v(()=>{he();De();he();Wp();Rc=class extends dr{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=new bt(e.defaultNamespace);for(let r of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(r)}getRequestType(){return Ce}getResponseType(){return ur}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,r){if("url"in r){e.protocol=r.url.protocol,e.hostname=r.url.hostname,e.port=r.url.port?Number(r.url.port):void 0,e.path=r.url.pathname,e.fragment=r.url.hash||void 0,e.username=r.url.username||void 0,e.password=r.url.password||void 0,e.query||(e.query={});for(let[o,n]of r.url.searchParams.entries())e.query[o]=n;if(r.headers)for(let o in r.headers)ce(r.headers,o)&&(e.headers[o]=r.headers[o].join(", "));return e}else{if(e.protocol=r.protocol,e.hostname=r.hostname,e.port=r.port?Number(r.port):void 0,e.path=r.path,e.query={...r.query},r.headers)for(let o in r.headers)ce(r.headers,o)&&(e.headers[o]=r.headers[o]);return e}}setHostPrefix(e,r,o){if(this.serdeContext?.disableHostPrefix)return;let n=L.of(r.input),i=pi(r.traits??{});if(i.endpoint){let s=i.endpoint?.[0];if(typeof s=="string"){for(let[a,c]of n.structIterator()){if(!c.getMergedTraits().hostLabel)continue;let u=o[a];if(typeof u!="string")throw new Error(`@smithy/core/schema - ${a} in input must be a string as hostLabel.`);s=s.replace(`{${a}}`,u)}if(e.hostname=s+e.hostname,!Ug(e.hostname))throw new Error(`[${e.hostname}] is not a valid hostname.`)}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}resolveError(e,r,o){let n=[-3,"","Error",0,[],[],0],i;for(let s of o)for(let a of r)try{a==="*"?i=s.getSchema(e):i=s.getSchema(a+"#"+e);let c=s.getErrorCtor(i);if(c)return[i,c,"modeled"];{let u=s.getBaseException();if(u){let l=s.getErrorCtor(u);if(l)return[i,l,"synthetic"]}}}catch{}for(let s of o){let a=s.getBaseException();if(a){let c=s.getErrorCtor(a);if(c)return[a,c,"synthetic"]}}return[n,Error,"native"]}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o})}async loadEventStreamCapability(){let{EventStreamSerde:e,eventStreamSerdeProvider:r}=await Promise.resolve().then(()=>(oJ(),nJ)),o=this.resolveEventStreamMarshaller(r);return new e({marshaller:o,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType(),compositeErrorRegistry:this.compositeErrorRegistry})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,r,o,n,i){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}resolveEventStreamMarshaller(e){let r=this.serdeContext;return r.eventStreamMarshaller?r.eventStreamMarshaller:e(this.serdeContext)}}});var Cc,iJ=v(()=>{he();De();de();he();GE();VE();HE();Cc=class extends Rc{async serializeRequest(e,r,o){let n=r&&typeof r=="object"?r:{},i=this.serializer,s={},a={},c=await o.endpoint(),u=L.of(e?.input),l=[],d=[],f=!1,p,m=new Ce({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:s,headers:a,body:void 0});if(c){this.updateServiceEndpoint(m,c),this.setHostPrefix(m,e,n);let g=pi(e.traits);if(g.http){m.method=g.http[0];let[y,w]=g.http[1].split("?");m.path=="/"?m.path=y:m.path+=y;let b=new URLSearchParams(w??"");for(let[_,k]of b)s[_]=k}}for(let[g,y]of u.structIterator()){let w=y.getMergedTraits()??{},b=n[g];if(b==null&&!y.isIdempotencyToken()){if(w.httpLabel&&(m.path.includes(`{${g}+}`)||m.path.includes(`{${g}}`)))throw new Error(`No value provided for input HTTP label: ${g}.`);continue}if(w.httpPayload)y.isStreaming()?y.isStructSchema()?n[g]&&(p=await this.serializeEventStream({eventStream:n[g],requestSchema:u})):p=b:(i.write(y,b),p=i.flush());else if(w.httpLabel){i.write(y,b);let _=i.flush();m.path.includes(`{${g}+}`)?m.path=m.path.replace(`{${g}+}`,_.split("/").map(gi).join("/")):m.path.includes(`{${g}}`)&&(m.path=m.path.replace(`{${g}}`,gi(_)))}else if(w.httpHeader)i.write(y,b),a[w.httpHeader.toLowerCase()]=String(i.flush());else if(typeof w.httpPrefixHeaders=="string")for(let _ in b){if(!ce(b,_))continue;let k=b[_],$=w.httpPrefixHeaders+_;i.write([y.getValueSchema(),{httpHeader:$}],k),a[$.toLowerCase()]=i.flush()}else w.httpQuery||w.httpQueryParams?this.serializeQuery(y,b,s):(f=!0,l.push(g),d.push(y))}if(f&&n){let[g,y]=(u.getName(!0)??"#Unknown").split("#"),w=u.getSchema()[6],b=[3,g,y,u.getMergedTraits(),l,d,void 0];w?b[6]=w:b.pop(),i.write(b,n),p=i.flush()}return m.headers=a,m.query=s,m.body=p,m}serializeQuery(e,r,o){let n=this.serializer,i=e.getMergedTraits();if(i.httpQueryParams){for(let s in r)if(ce(r,s)&&!(s in o)){let a=r[s],c=e.getValueSchema();Object.assign(c.getMergedTraits(),{...i,httpQuery:s,httpQueryParams:void 0}),this.serializeQuery(c,a,o)}return}if(e.isListSchema()){let s=!!e.getMergedTraits().sparse,a=[];for(let c of r){n.write([e.getValueSchema(),i],c);let u=n.flush();(s||u!==void 0)&&a.push(u)}o[i.httpQuery]=a}else n.write([e,i],r),o[i.httpQuery]=n.flush()}async deserializeResponse(e,r,o){let n=this.deserializer,i=L.of(e.output),s={};if(o.statusCode>=300){let c=await Ar(o.body,r);throw c.byteLength>0&&Object.assign(s,await n.read(15,c)),await this.handleError(e,r,o,s,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let c in o.headers){if(!ce(o.headers,c))continue;let u=o.headers[c];delete o.headers[c],o.headers[c.toLowerCase()]=u}let a=await this.deserializeHttpMessage(i,r,o,s);if(a.length){let c=await Ar(o.body,r);if(c.byteLength>0){let u=await n.read(i,c);for(let l of a)u[l]!=null&&(s[l]=u[l])}}else a.discardResponseBody&&await Ar(o.body,r);return s.$metadata=this.deserializeMetadata(o),s}async deserializeHttpMessage(e,r,o,n,i){let s;n instanceof Set?s=i:s=n;let a=!0,c=this.deserializer,u=L.of(e),l=[];for(let[d,f]of u.structIterator()){let p=f.getMemberTraits();if(p.httpPayload){if(a=!1,f.isStreaming())f.isStructSchema()?s[d]=await this.deserializeEventStream({response:o,responseSchema:u}):s[d]=FE(o.body);else if(o.body){let g=await Ar(o.body,r);g.byteLength>0&&(s[d]=await c.read(f,g))}}else if(p.httpHeader){let m=String(p.httpHeader).toLowerCase(),g=o.headers[m];if(g!=null)if(f.isListSchema()){let y=f.getValueSchema();y.getMergedTraits().httpHeader=m;let w;y.isTimestampSchema()&&y.getSchema()===4?w=eE(g,",",2):w=jp(g);let b=[];for(let _ of w)b.push(await c.read(y,_.trim()));s[d]=b}else s[d]=await c.read(f,g)}else if(p.httpPrefixHeaders!==void 0){s[d]={};for(let m in o.headers)if(ce(o.headers,m)&&m.startsWith(p.httpPrefixHeaders)){let g=o.headers[m],y=f.getValueSchema();y.getMergedTraits().httpHeader=m,s[d][m.slice(p.httpPrefixHeaders.length)]=await c.read(y,g)}}else p.httpResponseCode?s[d]=o.statusCode:l.push(d)}return l.discardResponseBody=a,l}}});var Ss,sJ=v(()=>{he();De();he();GE();VE();Ss=class extends Rc{async serializeRequest(e,r,o){let n=this.serializer,i={},s={},a=await o.endpoint(),c=L.of(e?.input),u=c.getSchema(),l,d=r&&typeof r=="object"?r:{},f=new Ce({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:i,headers:s,body:void 0});if(a&&(this.updateServiceEndpoint(f,a),this.setHostPrefix(f,e,d)),d){let p=c.getEventStreamMember();if(p){if(d[p]){let m={};for(let[g]of c.structIterator())g!==p&&d[g]!=null&&(m[g]=d[g]);l=await this.serializeEventStream({eventStream:d[p],requestSchema:c,initialRequest:m})}}else n.write(u,d),l=n.flush()}return f.headers=Object.assign(f.headers,s),f.query=i,f.body=l,f.method="POST",f}async deserializeResponse(e,r,o){let n=this.deserializer,i=L.of(e.output),s={};if(o.statusCode>=300){let c=await Ar(o.body,r);throw c.byteLength>0&&Object.assign(s,await n.read(15,c)),await this.handleError(e,r,o,s,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let c in o.headers){if(!ce(o.headers,c))continue;let u=o.headers[c];delete o.headers[c],o.headers[c.toLowerCase()]=u}let a=i.getEventStreamMember();if(a)s[a]=await this.deserializeEventStream({response:o,responseSchema:i,initialResponseContainer:s});else{let c=await Ar(o.body,r);c.byteLength>0&&Object.assign(s,await n.read(i,c))}return s.$metadata=this.deserializeMetadata(o),s}}});var XE,g1=v(()=>{HE();XE=(t,e,r,o,n,i)=>{if(e!=null&&e[r]!==void 0){let s=o();if(s==null||s.length<=0)throw new Error("Empty value provided for input HTTP label: "+r+".");t=t.replace(n,i?s.split("/").map(a=>gi(a)).join("/"):gi(s))}else throw new Error("No value provided for input HTTP label: "+r+".");return t}});function YE(t,e){return new fy(t,e)}var fy,aJ=v(()=>{he();g1();fy=class{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(e,r){this.input=e,this.context=r}async build(){let{hostname:e,protocol:r="https",port:o,path:n}=await this.context.endpoint();this.path=n;for(let i of this.resolvePathStack)i(this.path);return new Ce({protocol:r,hostname:this.hostname||e,port:o,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push(r=>{this.path=`${r?.endsWith("/")?r.slice(0,-1):r||""}`+e}),this}p(e,r,o,n){return this.resolvePathStack.push(i=>{this.path=XE(i,this.input,e,r,o,n)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}}});function pr(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();let{httpLabel:r,httpPrefixHeaders:o,httpHeader:n,httpQuery:i}=t.getMergedTraits();return(e.httpBindings?typeof o=="string"||n?6:i||r?5:void 0:void 0)??e.timestampFormat.default}var QE=v(()=>{});var Oc,y1=v(()=>{De();de();Wp();QE();Oc=class extends dr{settings;constructor(e){super(),this.settings=e}read(e,r){let o=L.of(e);if(o.isListSchema())return jp(r).map(n=>this.read(o.getValueSchema(),n));if(o.isBlobSchema())return(this.serdeContext?.base64Decoder??Mt)(r);if(o.isTimestampSchema())switch(pr(o,this.settings)){case 5:return Y0(r);case 6:return Q0(r);case 7:return Ec(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(o.isStringSchema()){let n=o.getMergedTraits().mediaType,i=r;if(n)return o.getMergedTraits().httpHeader&&(i=this.base64ToUtf8(i)),(n==="application/json"||n.endsWith("+json"))&&(i=Zt.from(i)),i}return o.isNumericSchema()?Number(r):o.isBigIntegerSchema()?BigInt(r):o.isBigDecimalSchema()?new Ne(r,"bigDecimal"):o.isBooleanSchema()?String(r).toLowerCase()==="true":r}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??Dt)((this.serdeContext?.base64Decoder??Mt)(e))}}});var Nc,cJ=v(()=>{De();de();Wp();y1();Nc=class extends dr{codecDeserializer;stringDeserializer;constructor(e,r){super(),this.codecDeserializer=e,this.stringDeserializer=new Oc(r)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,r){let o=L.of(e),n=o.getMergedTraits(),i=this.serdeContext?.utf8Encoder??Dt;if(n.httpHeader||n.httpResponseCode)return this.stringDeserializer.read(o,i(r));if(n.httpPayload){if(o.isBlobSchema()){let s=this.serdeContext?.utf8Decoder??or;return typeof r=="string"?s(r):r}else if(o.isStringSchema())return"byteLength"in r?i(r):r}return this.codecDeserializer.read(o,r)}}});var of,v1=v(()=>{De();de();Wp();QE();of=class extends dr{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,r){let o=L.of(e);switch(typeof r){case"object":if(r===null){this.stringBuffer="null";return}if(o.isTimestampSchema()){if(!(r instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${r} when schema expected Date in ${o.getName(!0)}`);switch(pr(o,this.settings)){case 5:this.stringBuffer=r.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=Qn(r);break;case 7:this.stringBuffer=String(r.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",r),this.stringBuffer=String(r.getTime()/1e3)}return}if(o.isBlobSchema()&&"byteLength"in r){this.stringBuffer=(this.serdeContext?.base64Encoder??_t)(r);return}if(o.isListSchema()&&Array.isArray(r)){let s="";for(let a of r){this.write([o.getValueSchema(),o.getMergedTraits()],a);let c=this.flush(),u=o.getValueSchema().isTimestampSchema()?c:X0(c);s!==""&&(s+=", "),s+=u}this.stringBuffer=s;return}this.stringBuffer=JSON.stringify(r,null,2);break;case"string":let n=o.getMergedTraits().mediaType,i=r;if(n&&((n==="application/json"||n.endsWith("+json"))&&(i=Zt.from(i)),o.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??_t)(i.toString());return}this.stringBuffer=r;break;default:o.isIdempotencyToken()?this.stringBuffer=oo():this.stringBuffer=String(r)}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}}});var Dc,uJ=v(()=>{De();v1();Dc=class{codecSerializer;stringSerializer;buffer;constructor(e,r,o=new of(r)){this.codecSerializer=e,this.stringSerializer=o}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,r){let o=L.of(e),n=o.getMergedTraits();if(n.httpHeader||n.httpLabel||n.httpQuery){this.stringSerializer.write(o,r),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(o,r)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}});var lJ,ek,dJ=v(()=>{lJ=St(is()),ek=class{name;kind;values;constructor({name:e,kind:r=lJ.FieldPosition.HEADER,values:o=[]}){this.name=e,this.kind=r,this.values=o}add(e){this.values.push(e)}set(e){this.values=e}remove(e){this.values=this.values.filter(r=>r!==e)}toString(){return this.values.map(e=>e.includes(",")||e.includes(" ")?`"${e}"`:e).join(", ")}get(){return this.values}}});var tk,pJ=v(()=>{tk=class{entries={};encoding;constructor({fields:e=[],encoding:r="utf-8"}){e.forEach(this.setField.bind(this)),this.encoding=r}setField(e){this.entries[e.name.toLowerCase()]=e}getField(e){return this.entries[e.toLowerCase()]}removeField(e){delete this.entries[e.toLowerCase()]}getByType(e){return Object.values(this.entries).filter(r=>r.kind===e)}}});var xs,Es,fJ=v(()=>{xs=t=>(t.logger&&t.logger.constructor?.name!=="NoOpLogger"&&t.requestHandler?.updateHttpClientConfig?.(Symbol.for("logger"),t.logger),{setHttpHandler(e){t.requestHandler=e},httpHandler(){return t.requestHandler},updateHttpClientConfig(e,r){t.requestHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.requestHandler.httpHandlerConfigs()}}),Es=t=>({requestHandler:t.httpHandler()})});function w1(t){return e=>async r=>{let o=r.request;if(Ce.isInstance(o)){let{body:n,headers:i}=o;if(n&&Object.keys(i).map(s=>s.toLowerCase()).indexOf(mJ)===-1)try{let s=t(n);s!=null&&(o.headers={...o.headers,[mJ]:String(s)})}catch{}}return e({...r,request:o})}}var mJ,b1,ks,hJ=v(()=>{he();mJ="content-length";b1={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},ks=t=>({applyToStack:e=>{e.add(w1(t.bodyLengthChecker),b1)}})});var zc,jbe,rk=v(()=>{zc=t=>encodeURIComponent(t).replace(/[!'()*]/g,jbe),jbe=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var gJ,yJ=v(()=>{rk();gJ=t=>t.split("/").map(zc).join("/")});function vJ(t){let e=[];for(let r of Object.keys(t).sort()){let o=t[r];if(r=zc(r),Array.isArray(o))for(let n=0,i=o.length;n<i;n++)e.push(`${r}=${zc(o[n])}`);else{let n=r;(o||typeof o=="string")&&(n+=`=${zc(o)}`),e.push(n)}}return e.join("&")}var wJ=v(()=>{rk()});var yl={};yt(yl,{Field:()=>ek,Fields:()=>tk,FromStringShapeDeserializer:()=>Oc,HttpBindingProtocol:()=>Cc,HttpInterceptingShapeDeserializer:()=>Nc,HttpInterceptingShapeSerializer:()=>Dc,HttpProtocol:()=>Rc,HttpRequest:()=>Ce,HttpResponse:()=>ur,RequestBuilder:()=>fy,RpcProtocol:()=>Ss,SerdeContext:()=>dr,ToStringShapeSerializer:()=>of,buildQueryString:()=>vJ,collectBody:()=>Ar,contentLengthMiddleware:()=>w1,contentLengthMiddlewareOptions:()=>b1,determineTimestampFormat:()=>pr,escapeUri:()=>zc,escapeUriPath:()=>gJ,extendedEncodeURIComponent:()=>gi,getContentLengthPlugin:()=>ks,getHttpHandlerExtensionConfiguration:()=>xs,isValidHostname:()=>Ug,parseQueryString:()=>Lg,parseUrl:()=>Ir,requestBuilder:()=>YE,resolveHttpHandlerRuntimeConfig:()=>Es,resolvedPath:()=>XE});var re=v(()=>{VE();HE();iJ();GE();sJ();aJ();g1();y1();cJ();uJ();v1();QE();Wp();dJ();pJ();he();he();he();fJ();hJ();rk();yJ();wJ();he();he()});var bJ,_J,SJ,xJ,EJ,kJ,IJ=v(()=>{bJ=["AccessDeniedException","AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],_J=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],SJ=["TimeoutError","RequestTimeout","RequestTimeoutException"],xJ=[500,502,503,504],EJ=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],kJ=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND","EAI_AGAIN"]});function x1(t){return t.code==="ERR_HTTP2_STREAM_ERROR"&&t.message.includes("NGHTTP2_REFUSED_STREAM")}var my,nk,_1,S1,Is,jc,ok,sf=v(()=>{IJ();my=t=>t?.$retryable!==void 0,nk=t=>bJ.includes(t.name),_1=t=>t.$metadata?.clockSkewCorrected,S1=t=>{let e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return t&&t instanceof TypeError?e.has(t.message):!1},Is=t=>t.$metadata?.httpStatusCode===429||_J.includes(t.name)||t.$retryable?.throttling==!0,jc=(t,e=0)=>t?.name!=="AbortError"&&(my(t)||_1(t)||t.name==="InvalidSignatureException"&&t.message?.includes("Signature expired")||SJ.includes(t.name)||EJ.includes(t?.code||"")||kJ.includes(t?.code||"")||xJ.includes(t.$metadata?.httpStatusCode||0)||S1(t)||x1(t)||t.cause!==void 0&&e<=10&&jc(t.cause,e+1)),ok=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!jc(t)}return!1}});var ik,hy,sk,af,E1,k1,ak,Mc,Uc,gy=v(()=>{ik=100,hy=2e4,sk=500,af=500,E1=5,k1=10,ak=1,Mc="amz-sdk-invocation-id",Uc="amz-sdk-request"});function I1(t,e){if(ur.isInstance(t))for(let r in t.headers){if(!ce(t.headers,r))continue;let o=r.toLowerCase();if(o==="retry-after"){let n=t.headers[r],i=NaN;if(n.endsWith("GMT"))try{i=(xc(n).getTime()-Date.now())/1e3}catch(s){e?.trace?.("Failed to parse retry-after header"),e?.trace?.(s)}else n.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?i=Number(n.match(/ GMT, ([\d.]+)$/)?.[1]):n.match(/^((\d+)|(\d+\.\d+))$/)?i=Number(n):Date.parse(n)>=Date.now()&&(i=(Date.parse(n)-Date.now())/1e3);return isNaN(i)?void 0:new Date(Date.now()+i*1e3)}else if(o==="x-amz-retry-after"){let n=t.headers[r],i=Number(n);if(isNaN(i)){e?.trace?.(`Failed to parse x-amz-retry-after=${n}`);return}return new Date(Date.now()+i)}}}function $J(t,e){return I1(t,e)}var $1=v(()=>{he();re();de()});var ck,A1=v(()=>{ck=t=>t instanceof Error?t:t instanceof Object?Object.assign(new Error,t):typeof t=="string"?new Error(t):new Error(`AWS SDK error wrapper for ${t}`)});function T1(t){return e=>(r,o)=>async n=>{let i=await e.retryStrategy(),s=await e.maxAttempts();if(Ube(i)){i=i;let a=await i.acquireInitialRetryToken((o.partition_id??"")+(o.__retryLongPoll?":longpoll":"")),c=new Error,u=0,l=0,{request:d}=n,f=Ce.isInstance(d);for(f&&(d.headers[Mc]=qp());;)try{f&&(d.headers[Uc]=`attempt=${u+1}; max=${s}`);let{response:p,output:m}=await r(n);return i.recordSuccess(a),m.$metadata.attempts=u+1,m.$metadata.totalRetryDelay=l,{response:p,output:m}}catch(p){let m=Lbe(p,e.logger);if(c=ck(p),f&&t(d))throw(o.logger instanceof Cn?console:o.logger)?.warn("An error was encountered in a non-retryable streaming request."),c;try{a=await i.refreshRetryTokenForRetry(a,m)}catch{throw c.$metadata||(c.$metadata={}),c.$metadata.attempts=u+1,c.$metadata.totalRetryDelay=l,c}u=a.getRetryCount();let g=a.getRetryDelay();l+=(a?.$retryLog?.acquisitionDelay??0)+g,g>0&&await Mbe(g)}}else return i=i,i?.mode&&(o.userAgent=[...o.userAgent||[],["cfg/retry-mode",i.mode]]),i.retry(r,n)}}function AJ(t){let e=T1(t);return r=>({applyToStack:o=>{o.add(e(r),P1)}})}var Mbe,Ube,Lbe,Fbe,P1,R1=v(()=>{le();re();de();sf();gy();$1();A1();Mbe=t=>new Promise(e=>setTimeout(e,t)),Ube=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",Lbe=(t,e)=>{let r={error:t,errorType:Fbe(t)},o=I1(t.$response,e);return o&&(r.retryAfterHint=o),r},Fbe=t=>Is(t)?"THROTTLING":jc(t)?"TRANSIENT":ok(t)?"SERVER_ERROR":"CLIENT_ERROR",P1={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0}});var Lc,uk=v(()=>{sf();Lc=class t{static setTimeoutFn=(e,r)=>setTimeout(e,r);beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=!1;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let r;this.updateMeasuredRate();let o=e;if(o?.errorType==="THROTTLING"||Is(o?.error??e)){let s=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=s,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(s),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());let i=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(i)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(e){if(this.enabled){for(this.refillTokenBucket();e>this.availableTokens;){let r=(e-this.availableTokens)/this.fillRate*1e3;await new Promise(o=>t.setTimeoutFn(o,r)),this.refillTokenBucket()}this.availableTokens=this.availableTokens-e}}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let r=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+r),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){let e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){let o=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(o*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}}});var Ht,cf=v(()=>{Ht=class t{static v2026=typeof process<"u"&&process.env?.SMITHY_NEW_RETRIES_2026==="true";static delay(){return t.v2026?50:100}static throttlingDelay(){return t.v2026?1e3:500}static cost(){return t.v2026?14:5}static throttlingCost(){return t.v2026?5:10}static modifiedCostType(){return t.v2026?"THROTTLING":"TRANSIENT"}}});var lk,TJ=v(()=>{cf();lk=class{x=Ht.delay();computeNextBackoffDelay(e){let n=Math.random()*Math.min(this.x*2**e,2e4);return Math.floor(n)}setDelayBase(e){this.x=e}}});var yy,PJ=v(()=>{yy=class{delay;count;cost;longPoll;$retryLog={acquisitionDelay:0};constructor(e,r,o,n){this.delay=e,this.count=r,this.cost=o,this.longPoll=n}getRetryCount(){return this.count}getRetryDelay(){return Math.min(2e4,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}});var fr,vi,Ro,vl=v(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(fr||(fr={}));vi=3,Ro=fr.STANDARD});var dk,wi,vy=v(()=>{TJ();PJ();vl();cf();dk={incompatible:1,attempts:2,capacity:3},wi=class{mode=fr.STANDARD;retryBackoffStrategy;capacity=500;maxAttemptsProvider;baseDelay;constructor(e){typeof e=="number"?this.maxAttemptsProvider=async()=>e:typeof e=="function"?this.maxAttemptsProvider=e:e&&typeof e=="object"&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),this.maxAttemptsProvider??=async()=>vi,this.baseDelay??=Ht.delay(),this.retryBackoffStrategy??=new lk}async acquireInitialRetryToken(e){return new yy(Ht.delay(),0,void 0,Ht.v2026&&e.includes(":longpoll"))}async refreshRetryTokenForRetry(e,r){let o=await this.getMaxAttempts(),n=this.retryCode(e,r,o),i=n===0,s=e.isLongPoll?.();if(i||s){let a=r.errorType;this.retryBackoffStrategy.setDelayBase(a==="THROTTLING"?Ht.throttlingDelay():this.baseDelay);let c=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),u=c;if(r.retryAfterHint instanceof Date&&(u=Math.max(c,Math.min(r.retryAfterHint.getTime()-Date.now(),c+5e3))),i){let l=this.getCapacityCost(a);this.capacity-=l;let d=new yy(0,e.getRetryCount()+1,l,e.isLongPoll?.()??!1);return await new Promise(f=>setTimeout(f,u)),d.$retryLog.acquisitionDelay=u,d}else{let l=Ht.v2026&&n===dk.capacity&&s?u:0;l>0&&await new Promise(d=>setTimeout(d,l))}}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.min(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${vi}`),vi}}retryCode(e,r,o){let n=e.getRetryCount()+1,i=this.isRetryableError(r.errorType)?0:dk.incompatible,s=n<o?0:dk.attempts,a=this.capacity>=this.getCapacityCost(r.errorType)?0:dk.capacity;return i||s||a}getCapacityCost(e){return e===Ht.modifiedCostType()?Ht.throttlingCost():Ht.cost()}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}});var uf,C1=v(()=>{uk();vy();vl();uf=class{mode=fr.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(e,r){let{rateLimiter:o}=r??{};this.rateLimiter=o??new Lc,this.standardRetryStrategy=r?new wi({maxAttempts:typeof e=="number"?e:3,...r}):new wi(e)}async acquireInitialRetryToken(e){let r=await this.standardRetryStrategy.acquireInitialRetryToken(e);return await this.rateLimiter.getSendToken(),r}async refreshRetryTokenForRetry(e,r){this.rateLimiter.updateClientSendingRate(r);let o=await this.standardRetryStrategy.refreshRetryTokenForRetry(e,r);return await this.rateLimiter.getSendToken(),o}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}}});var pk,RJ=v(()=>{vy();cf();pk=class extends wi{computeNextBackoffDelay;constructor(e,r=Ht.delay()){super(typeof e=="function"?e:async()=>e),typeof r=="number"?this.computeNextBackoffDelay=()=>r:this.computeNextBackoffDelay=r,this.retryBackoffStrategy.computeNextBackoffDelay=o=>{let n=o+1;return this.computeNextBackoffDelay(n)}}}});var CJ,OJ=v(()=>{CJ=(t,e)=>{let r=t,o=e?.noRetryIncrement??1,n=e?.retryCost??5,i=e?.timeoutRetryCost??10,s=t,a=d=>d.name==="TimeoutError"?i:n,c=d=>a(d)<=s;return Object.freeze({hasRetryTokens:c,retrieveRetryTokens:d=>{if(!c(d))throw new Error("No retry token available");let f=a(d);return s-=f,f},releaseRetryTokens:d=>{s+=d??o,s=Math.min(s,r)}})}});var fk,O1=v(()=>{fk=(t,e)=>Math.floor(Math.min(2e4,Math.random()*2**e*t))});var mk,N1=v(()=>{sf();mk=t=>t?my(t)||nk(t)||Is(t)||jc(t):!1});var lf,Vbe,D1=v(()=>{re();de();sf();vl();gy();A1();OJ();O1();N1();lf=class{maxAttemptsProvider;retryDecider;delayDecider;retryQuota;mode=fr.STANDARD;constructor(e,r){this.maxAttemptsProvider=e,this.retryDecider=r?.retryDecider??mk,this.delayDecider=r?.delayDecider??fk,this.retryQuota=r?.retryQuota??CJ(500)}shouldRetry(e,r,o){return r<o&&this.retryDecider(e)&&this.retryQuota.hasRetryTokens(e)}async getMaxAttempts(){let e;try{e=await this.maxAttemptsProvider()}catch{e=vi}return e}async retry(e,r,o){let n,i=0,s=0,a=await this.getMaxAttempts(),{request:c}=r;for(Ce.isInstance(c)&&(c.headers[Mc]=qp());;)try{Ce.isInstance(c)&&(c.headers[Uc]=`attempt=${i+1}; max=${a}`),o?.beforeRequest&&await o.beforeRequest();let{response:u,output:l}=await e(r);return o?.afterRequest&&o.afterRequest(u),this.retryQuota.releaseRetryTokens(n),l.$metadata.attempts=i+1,l.$metadata.totalRetryDelay=s,{response:u,output:l}}catch(u){let l=ck(u);if(i++,this.shouldRetry(l,i,a)){n=this.retryQuota.retrieveRetryTokens(l);let d=this.delayDecider(Is(l)?500:100,i),f=Vbe(l.$response),p=Math.max(f||0,d);s+=p,await new Promise(m=>setTimeout(m,p));continue}throw l.$metadata||(l.$metadata={}),l.$metadata.attempts=i,l.$metadata.totalRetryDelay=s,l}}},Vbe=t=>{if(!ur.isInstance(t))return;let e=Object.keys(t.headers).find(i=>i.toLowerCase()==="retry-after");if(!e)return;let r=t.headers[e],o=Number(r);if(!Number.isNaN(o))return Math.min(o*1e3,2e4);let n=new Date(r);return Math.min(n.getTime()-Date.now(),2e4)}});var hk,NJ=v(()=>{uk();vl();D1();hk=class extends lf{rateLimiter;constructor(e,r){let{rateLimiter:o,...n}=r??{};super(e,n),this.rateLimiter=o??new Lc,this.mode=fr.ADAPTIVE}async retry(e,r){return super.retry(e,r,{beforeRequest:async()=>this.rateLimiter.getSendToken(),afterRequest:o=>{this.rateLimiter.updateClientSendingRate(o)}})}}});var gk,yk,$s,As,z1,j1,Ts,DJ=v(()=>{le();C1();vy();vl();cf();gk="AWS_MAX_ATTEMPTS",yk="max_attempts",$s={environmentVariableSelector:t=>{let e=t[gk];if(!e)return;let r=parseInt(e);if(Number.isNaN(r))throw new Error(`Environment variable ${gk} mast be a number, got "${e}"`);return r},configFileSelector:t=>{let e=t[yk];if(!e)return;let r=parseInt(e);if(Number.isNaN(r))throw new Error(`Shared config file entry ${yk} mast be a number, got "${e}"`);return r},default:vi},As=(t,e)=>{let{retryStrategy:r,retryMode:o}=t,{defaultMaxAttempts:n=vi,defaultBaseDelay:i=Ht.delay()}=e??{},s=lt(t.maxAttempts??n),a=r?Promise.resolve(r):void 0,c=async()=>{let u=await s();return await lt(o)()===fr.ADAPTIVE?new uf(s,{maxAttempts:u,baseDelay:i}):new wi({maxAttempts:u,baseDelay:i})};return Object.assign(t,{maxAttempts:s,retryStrategy:()=>a??=c()})},z1="AWS_RETRY_MODE",j1="retry_mode",Ts={environmentVariableSelector:t=>t[z1],configFileSelector:t=>t[j1],default:Ro}});var M1,U1,zJ,jJ=v(()=>{re();gy();M1=()=>t=>async e=>{let{request:r}=e;return Ce.isInstance(r)&&(delete r.headers[Mc],delete r.headers[Uc]),t(e)},U1={name:"omitRetryHeadersMiddleware",tags:["RETRY","HEADERS","OMIT_RETRY_HEADERS"],relation:"before",toMiddleware:"awsAuthMiddleware",override:!0},zJ=t=>({applyToStack:e=>{e.addRelativeTo(M1(),U1)}})});var MJ={};yt(MJ,{AdaptiveRetryStrategy:()=>uf,CONFIG_MAX_ATTEMPTS:()=>yk,CONFIG_RETRY_MODE:()=>j1,ConfiguredRetryStrategy:()=>pk,DEFAULT_MAX_ATTEMPTS:()=>vi,DEFAULT_RETRY_DELAY_BASE:()=>ik,DEFAULT_RETRY_MODE:()=>Ro,DefaultRateLimiter:()=>Lc,DeprecatedAdaptiveRetryStrategy:()=>hk,DeprecatedStandardRetryStrategy:()=>lf,ENV_MAX_ATTEMPTS:()=>gk,ENV_RETRY_MODE:()=>z1,INITIAL_RETRY_TOKENS:()=>af,INVOCATION_ID_HEADER:()=>Mc,MAXIMUM_RETRY_DELAY:()=>hy,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:()=>$s,NODE_RETRY_MODE_CONFIG_OPTIONS:()=>Ts,NO_RETRY_INCREMENT:()=>ak,REQUEST_HEADER:()=>Uc,RETRY_COST:()=>E1,RETRY_MODES:()=>fr,Retry:()=>Ht,StandardRetryStrategy:()=>wi,THROTTLING_RETRY_DELAY_BASE:()=>sk,TIMEOUT_RETRY_COST:()=>k1,defaultDelayDecider:()=>fk,defaultRetryDecider:()=>mk,getOmitRetryHeadersPlugin:()=>zJ,getRetryAfterHint:()=>$J,getRetryPlugin:()=>xa,isBrowserNetworkError:()=>S1,isClockSkewCorrectedError:()=>_1,isClockSkewError:()=>nk,isNodeJsHttp2TransientError:()=>x1,isRetryableByTrait:()=>my,isServerError:()=>ok,isThrottlingError:()=>Is,isTransientError:()=>jc,omitRetryHeadersMiddleware:()=>M1,omitRetryHeadersMiddlewareOptions:()=>U1,resolveRetryConfig:()=>As,retryMiddleware:()=>Hbe,retryMiddlewareOptions:()=>P1});var Hbe,xa,Co=v(()=>{kZ();R1();sf();C1();RJ();uk();vy();vl();gy();cf();NJ();D1();O1();N1();DJ();jJ();R1();$1();Hbe=T1(GN),xa=AJ(GN)});function Oo(t,e,r){t.__aws_sdk_context?t.__aws_sdk_context.features||(t.__aws_sdk_context.features={}):t.__aws_sdk_context={features:{}},t.__aws_sdk_context.features[e]=r}var L1=v(()=>{Co();Ht.v2026||=typeof process=="object"&&process.env?.AWS_NEW_RETRIES_2026==="true"});function UJ(t,e,r){return t.$source||(t.$source={}),t.$source[e]=r,t}var LJ=v(()=>{});function df(t){return t}var F1,V1,Ps,FJ=v(()=>{re();F1=t=>e=>async r=>{if(!Ce.isInstance(r.request))return e(r);let{request:o}=r,{handlerProtocol:n=""}=t.requestHandler.metadata||{};if(n.indexOf("h2")>=0&&!o.headers[":authority"])delete o.headers.host,o.headers[":authority"]=o.hostname+(o.port?":"+o.port:"");else if(!o.headers.host){let i=o.hostname;o.port!=null&&(i+=`:${o.port}`),o.headers.host=i}return e(r)},V1={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},Ps=t=>({applyToStack:e=>{e.add(F1(t),V1)}})});var H1,B1,Rs,VJ=v(()=>{H1=()=>(t,e)=>async r=>{try{let o=await t(r),{clientName:n,commandName:i,logger:s,dynamoDbDocumentClientOptions:a={}}=e,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:u}=a,l=c??e.inputFilterSensitiveLog,d=u??e.outputFilterSensitiveLog,{$metadata:f,...p}=o.output;return s?.info?.({clientName:n,commandName:i,input:l(r.input),output:d(p),metadata:f}),o}catch(o){let{clientName:n,commandName:i,logger:s,dynamoDbDocumentClientOptions:a={}}=e,{overrideInputFilterSensitiveLog:c}=a,u=c??e.inputFilterSensitiveLog;throw s?.error?.({clientName:n,commandName:i,input:u(r.input),error:o,metadata:o.$metadata}),o}},B1={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},Rs=t=>({applyToStack:e=>{e.add(H1(),B1)}})});var vk,K1=v(()=>{vk={step:"build",tags:["RECURSION_DETECTION","TRACE_CONTEXT_PROPAGATION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"}});var Fc,q1,wk,Z1,W1,wy,HJ=v(()=>{Fc={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID"),TRACEPARENT:Symbol.for("_AWS_LAMBDA_TRACEPARENT"),TRACESTATE:Symbol.for("_AWS_LAMBDA_TRACESTATE"),BAGGAGE:Symbol.for("_AWS_LAMBDA_BAGGAGE")},q1=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");q1||(globalThis.awslambda=globalThis.awslambda||{});wk=class{static PROTECTED_KEYS=Fc;isProtectedKey(e){return Object.values(Fc).includes(e)}getRequestId(){return this.get(Fc.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(Fc.X_RAY_TRACE_ID)}getTenantId(){return this.get(Fc.TENANT_ID)}getTraceparent(){return this.get(Fc.TRACEPARENT)}getTracestate(){return this.get(Fc.TRACESTATE)}getBaggage(){return this.get(Fc.BAGGAGE)}},Z1=class extends wk{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=r}run(e,r){return this.currentContext=e,r()}},W1=class t extends wk{als;static async create(){let e=new t,r=await import("node:async_hooks");return e.als=new r.AsyncLocalStorage,e}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);let o=this.als.getStore();if(!o)throw new Error("No context available");o[e]=r}run(e,r){return this.als.run(e,r)}};(function(t){let e=null;async function r(o){return e||(e=(async()=>{let i=o===!0||"AWS_LAMBDA_MAX_CONCURRENCY"in process.env?await W1.create():new Z1;return!q1&&globalThis.awslambda?.InvokeStore?globalThis.awslambda.InvokeStore:(!q1&&globalThis.awslambda&&(globalThis.awslambda.InvokeStore=i),i)})()),e}t.getInstanceAsync=r,t._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{e=null,globalThis.awslambda?.InvokeStore&&delete globalThis.awslambda.InvokeStore,globalThis.awslambda={InvokeStore:void 0}}}:void 0})(wy||(wy={}))});function qbe(t){for(let e of Object.keys(t)){let r=e.toLowerCase();e!==r&&(r===G1||r===BJ||r===KJ)&&(t[r]=t[e],delete t[e])}}var Bbe,Kbe,J1,G1,BJ,KJ,bk,X1=v(()=>{HJ();re();Bbe="AWS_LAMBDA_FUNCTION_NAME",Kbe="_X_AMZN_TRACE_ID",J1="X-Amzn-Trace-Id",G1="traceparent",BJ="tracestate",KJ="baggage",bk=()=>t=>async e=>{let{request:r}=e;if(!Ce.isInstance(r))return t(e);let o;{let n=Object.keys(r.headers??{}).find(i=>i.toLowerCase()===J1.toLowerCase())??J1;if(!r.headers.hasOwnProperty(n)){let i=process.env[Bbe],s=process.env[Kbe];o??=await wy.getInstanceAsync();let c=o?.getXRayTraceId()??s,u=l=>typeof l=="string"&&l.length>0;u(i)&&u(c)&&(r.headers[J1]=c)}}if(qbe(r.headers),!r.headers[G1]){let i=(o??=await wy.getInstanceAsync())?.getTraceparent?.();if(i){r.headers[G1]=i;let s=o?.getTracestate?.();s&&(r.headers[BJ]=s);let a=o?.getBaggage?.();a&&(r.headers[KJ]=a)}}return t(e)}});var Cs,qJ=v(()=>{K1();X1();Cs=t=>({applyToStack:e=>{e.add(bk(),vk)}})});var ZJ,WJ=v(()=>{ZJ=(t,e)=>{if(!e||e.length===0)return t;let r=[];for(let o of e)for(let n of t)n.schemeId.split("#")[1]===o&&r.push(n);for(let o of t)r.find(({schemeId:n})=>n===o.schemeId)||r.push(o);return r}});function Zbe(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var wl,_k=v(()=>{he();WJ();wl=(t,e)=>(r,o)=>async n=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,o,n.input)),s=t.authSchemePreference?await t.authSchemePreference():[],a=ZJ(i,s),c=Zbe(t.httpAuthSchemes),u=wt(o),l=[];for(let d of a){let f=c.get(d.schemeId);if(!f){l.push(`HttpAuthScheme \`${d.schemeId}\` was not enabled for this service.`);continue}let p=f.identityProvider(await e.identityProviderConfigProvider(t));if(!p){l.push(`HttpAuthScheme \`${d.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:m={},signingProperties:g={}}=d.propertiesExtractor?.(t,o)||{};d.identityProperties=Object.assign(d.identityProperties||{},m),d.signingProperties=Object.assign(d.signingProperties||{},g),u.selectedHttpAuthScheme={httpAuthOption:d,identity:await p(d.identityProperties),signer:f.signer};break}if(!u.selectedHttpAuthScheme)throw new Error(l.join(`
26
- `));return r(n)}});var Sk,bi,JJ=v(()=>{_k();Sk={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},bi=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:o=>{o.addRelativeTo(wl(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),Sk)}})});var xk,Y1,GJ=v(()=>{_k();xk={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"serializerMiddleware"},Y1=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:o=>{o.addRelativeTo(wl(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),xk)}})});var XJ=v(()=>{_k();JJ();GJ()});var Wbe,Jbe,by,Q1=v(()=>{re();he();Wbe=t=>e=>{throw e},Jbe=(t,e)=>{},by=t=>(e,r)=>async o=>{if(!Ce.isInstance(o.request))return e(o);let i=wt(r).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:s={}},identity:a,signer:c}=i,u=await e({...o,request:await c.sign(o.request,a,s)}).catch((c.errorHandler||Wbe)(s));return(c.successHandler||Jbe)(u.response,s),u}});var Ek,_i,YJ=v(()=>{Q1();Ek={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},_i=t=>({applyToStack:e=>{e.addRelativeTo(by(t),Ek)}})});var QJ=v(()=>{Q1();YJ()});var No,eG=v(()=>{No=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});function tG(t,e,r,o,n){return async function*(s,a,...c){let u=a,l=s.startingToken??u[r],d=!0,f;for(;d;){if(u[r]=l,n&&(u[n]=u[n]??s.pageSize),s.client instanceof t)f=await Gbe(e,s.client,a,s.withCommand,...c);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield f;let p=l;l=Xbe(f,o),d=!!(l&&(!s.stopOnSameToken||l!==p))}return void 0}}var Gbe,Xbe,rG=v(()=>{Gbe=async(t,e,r,o=i=>i,...n)=>{let i=new t(r);return i=o(i)??i,await e.send(i,...n)};Xbe=(t,e)=>{let r=t,o=e.split(".");for(let n of o){if(!r||typeof r!="object")return;r=r[n]}return r}});function nG(t,e,r){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=r}var oG=v(()=>{});var io,iG=v(()=>{he();io=class{authSchemes=new Map;constructor(e){for(let r in e){if(!ce(e,r))continue;let o=e[r];o!==void 0&&this.authSchemes.set(r,o)}}getIdentityProvider(e){return this.authSchemes.get(e)}}});var ej,pf,sG=v(()=>{re();ej=St(is()),pf=class{async sign(e,r,o){if(!o)throw new Error("request could not be signed with `apiKey` since the `name` and `in` signer properties are missing");if(!o.name)throw new Error("request could not be signed with `apiKey` since the `name` signer property is missing");if(!o.in)throw new Error("request could not be signed with `apiKey` since the `in` signer property is missing");if(!r.apiKey)throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined");let n=Ce.clone(e);if(o.in===ej.HttpApiKeyAuthLocation.QUERY)n.query[o.name]=r.apiKey;else if(o.in===ej.HttpApiKeyAuthLocation.HEADER)n.headers[o.name]=o.scheme?`${o.scheme} ${r.apiKey}`:r.apiKey;else throw new Error("request can only be signed with `apiKey` locations `query` or `header`, but found: `"+o.in+"`");return n}}});var ff,aG=v(()=>{re();ff=class{async sign(e,r,o){let n=Ce.clone(e);if(!r.token)throw new Error("request could not be signed with `token` since the `token` is not defined");return n.headers.Authorization=`Bearer ${r.token}`,n}}});var Xr,cG=v(()=>{Xr=class{async sign(e,r,o){return e}}});var uG=v(()=>{sG();aG();cG()});var kk,tj,_y,mf,Sy,lG=v(()=>{kk=t=>function(r){return mf(r)&&r.expiration.getTime()-Date.now()<t},tj=3e5,_y=kk(3e5),mf=t=>t.expiration!==void 0,Sy=(t,e,r)=>{if(t===void 0)return;let o=typeof t!="function"?async()=>Promise.resolve(t):t,n,i,s,a=!1,c=async u=>{i||(i=o(u));try{n=await i,s=!0,a=!1}finally{i=void 0}return n};return e===void 0?async u=>((!s||u?.forceRefresh)&&(n=await c(u)),n):async u=>((!s||u?.forceRefresh)&&(n=await c(u)),a?n:r(n)?(e(n)&&await c(u),n):(a=!0,n))}});var dG=v(()=>{iG();uG();lG()});var pG={};yt(pG,{DefaultIdentityProviderConfig:()=>io,EXPIRATION_MS:()=>tj,HttpApiKeyAuthSigner:()=>pf,HttpBearerAuthSigner:()=>ff,NoAuthSigner:()=>Xr,createIsIdentityExpiredFunction:()=>kk,createPaginator:()=>tG,doesIdentityRequireRefresh:()=>mf,getHttpAuthSchemeEndpointRuleSetPlugin:()=>bi,getHttpAuthSchemePlugin:()=>Y1,getHttpSigningPlugin:()=>_i,getSmithyContext:()=>wt,httpAuthSchemeEndpointRuleSetMiddlewareOptions:()=>Sk,httpAuthSchemeMiddleware:()=>wl,httpAuthSchemeMiddlewareOptions:()=>xk,httpSigningMiddleware:()=>by,httpSigningMiddlewareOptions:()=>Ek,isIdentityExpired:()=>_y,memoizeIdentityProvider:()=>Sy,normalizeProvider:()=>No,requestBuilder:()=>YE,setFeature:()=>nG});var Nn=v(()=>{he();XJ();QJ();eG();rG();re();oG();dG()});function Ybe(t){return t===void 0?!0:typeof t=="string"&&t.length<=50}function Os(t){let e=No(t.userAgentAppId??xy),{customUserAgent:r}=t;return Object.assign(t,{customUserAgent:typeof r=="string"?[[r]]:r,userAgentAppId:async()=>{let o=await e();if(!Ybe(o)){let n=t.logger?.constructor?.name==="NoOpLogger"||!t.logger?console:t.logger;typeof o!="string"?n?.warn("userAgentAppId must be a string or undefined."):o.length>50&&n?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return o}})}var xy,rj=v(()=>{Nn();xy=void 0});var nj,fG=v(()=>{nj={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-east-2":{description:"Asia Pacific (Taipei)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"aws-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"AWS European Sovereign Cloud (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"aws-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}],version:"1.1"}});var mG,hG,Ik,oj,gG,$k,Ak=v(()=>{fG();mG=nj,hG="",Ik=t=>{let{partitions:e}=mG;for(let o of e){let{regions:n,outputs:i}=o;for(let[s,a]of Object.entries(n))if(s===t)return{...i,...a}}for(let o of e){let{regionRegex:n,outputs:i}=o;if(new RegExp(n).test(t))return{...i}}let r=e.find(o=>o.id==="aws");if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}},oj=(t,e="")=>{mG=t,hG=e},gG=()=>{oj(nj,"")},$k=()=>hG});async function yG(t,e,r){if(r.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&Oo(t,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){let i=await e.retryStrategy();if(typeof i.mode=="string")switch(i.mode){case fr.ADAPTIVE:Oo(t,"RETRY_MODE_ADAPTIVE","F");break;case fr.STANDARD:Oo(t,"RETRY_MODE_STANDARD","E");break}}if(typeof e.accountIdEndpointMode=="function"){let i=t.endpointV2;switch(String(i?.url?.hostname).match(Qbe)&&Oo(t,"ACCOUNT_ID_ENDPOINT","O"),await e.accountIdEndpointMode?.()){case"disabled":Oo(t,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":Oo(t,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":Oo(t,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let n=t.__smithy_context?.selectedHttpAuthScheme?.identity;if(n?.$source){let i=n;i.accountId&&Oo(t,"RESOLVED_ACCOUNT_ID","T");for(let[s,a]of Object.entries(i.$source??{}))Oo(t,s,a)}}var Qbe,vG=v(()=>{Co();L1();Qbe=/\d{12}\.ddb/});var ij,Tk,wG,bG,_G=v(()=>{ij="user-agent",Tk="x-amz-user-agent",wG=/[^!$%&'*+\-.^_`|~\w]/g,bG=/[^!$%&'*+\-.^_`|~\w#]/g});function SG(t){let e="";for(let r in t){let o=t[r];if(e.length+o.length+1<=1024){e.length?e+=","+o:e+=o;continue}break}return e}var xG=v(()=>{});var aj,Pk,cj,Ns,IG=v(()=>{re();Ak();vG();_G();xG();aj=t=>(e,r)=>async o=>{let{request:n}=o;if(!Ce.isInstance(n))return e(o);let{headers:i}=n,s=r?.userAgent?.map(Pk)||[],a=(await t.defaultUserAgentProvider()).map(Pk);await yG(r,t,o);let c=r;a.push(`m/${SG(Object.assign({},r.__smithy_context?.features,c.__aws_sdk_context?.features))}`);let u=t?.customUserAgent?.map(Pk)||[],l=await t.userAgentAppId();l&&a.push(Pk(["app",`${l}`]));let d=$k(),f=(d?[d]:[]).concat([...a,...s,...u]).join(" "),p=[...a.filter(m=>m.startsWith("aws-sdk-")),...u].join(" ");return t.runtime!=="browser"?(p&&(i[Tk]=i[Tk]?`${i[ij]} ${p}`:p),i[ij]=f):i[Tk]=f,e({...o,request:n})},Pk=t=>{let e=t[0].split("/").map(s=>s.replace(wG,"-")).join("/"),r=t[1]?.replace(bG,"-"),o=e.indexOf("/"),n=e.substring(0,o),i=e.substring(o+1);return n==="api"&&(i=i.toLowerCase()),[n,i,r].filter(s=>s&&s.length>0).reduce((s,a,c)=>{switch(c){case 0:return a;case 1:return`${s}/${a}`;default:return`${s}#${a}`}},"")},cj={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Ns=t=>({applyToStack:e=>{e.add(aj(t),cj)}})});import{versions as uj}from"node:process";var $G,AG=v(()=>{$G=()=>{let t=["deno","bun","llrt"];for(let e of t)if(uj[e])return[`md/${e}`,uj[e]];return["md/nodejs",uj.node]}});var Ey,lj=v(()=>{Ey={isCrtAvailable:!1}});var TG,PG=v(()=>{lj();TG=()=>Ey.isCrtAvailable?["md/crt-avail"]:null});import{platform as e_e,release as t_e}from"node:os";import{env as RG}from"node:process";var Si,CG,OG=v(()=>{AG();PG();lj();Si=({serviceId:t,clientVersion:e})=>{let r=$G();return async o=>{let n=[["aws-sdk-js",e],["ua","2.1"],[`os/${e_e()}`,t_e()],["lang/js"],r],i=TG();i&&n.push(i),t&&n.push([`api/${t}`,e]),RG.AWS_EXECUTION_ENV&&n.push([`exec-env/${RG.AWS_EXECUTION_ENV}`]);let s=await o?.userAgentAppId?.();return s?[...n,[`app/${s}`]]:[...n]}},CG=Si});var dj,pj,r_e,Ds,NG=v(()=>{rj();dj="AWS_SDK_UA_APP_ID",pj="sdk_ua_app_id",r_e="sdk-ua-app-id",Ds={environmentVariableSelector:t=>t[dj],configFileSelector:t=>t[pj]??t[r_e],default:xy}});var DG=R((ky,fj)=>{(function(t,e){typeof ky=="object"&&typeof fj=="object"?fj.exports=e():typeof define=="function"&&define.amd?define([],e):typeof ky=="object"?ky.bowser=e():t.bowser=e()})(ky,(function(){return(function(t){var e={};function r(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(o,n,i){r.o(o,n)||Object.defineProperty(o,n,{enumerable:!0,get:i})},r.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},r.t=function(o,n){if(1&n&&(o=r(o)),8&n||4&n&&typeof o=="object"&&o&&o.__esModule)return o;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:o}),2&n&&typeof o!="string")for(var s in o)r.d(i,s,function(a){return o[a]}.bind(null,s));return i},r.n=function(o){var n=o&&o.__esModule?function(){return o.default}:function(){return o};return r.d(n,"a",n),n},r.o=function(o,n){return Object.prototype.hasOwnProperty.call(o,n)},r.p="",r(r.s=90)})({17:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o=r(18),n=(function(){function i(){}return i.getFirstMatch=function(s,a){var c=a.match(s);return c&&c.length>0&&c[1]||""},i.getSecondMatch=function(s,a){var c=a.match(s);return c&&c.length>1&&c[2]||""},i.matchAndReturnConst=function(s,a,c){if(s.test(a))return c},i.getWindowsVersionName=function(s){switch(s){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(s){var a=s.split(".").splice(0,2).map((function(l){return parseInt(l,10)||0}));a.push(0);var c=a[0],u=a[1];if(c===10)switch(u){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}switch(c){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";default:return}},i.getAndroidVersionName=function(s){var a=s.split(".").splice(0,2).map((function(c){return parseInt(c,10)||0}));if(a.push(0),!(a[0]===1&&a[1]<5))return a[0]===1&&a[1]<6?"Cupcake":a[0]===1&&a[1]>=6?"Donut":a[0]===2&&a[1]<2?"Eclair":a[0]===2&&a[1]===2?"Froyo":a[0]===2&&a[1]>2?"Gingerbread":a[0]===3?"Honeycomb":a[0]===4&&a[1]<1?"Ice Cream Sandwich":a[0]===4&&a[1]<4?"Jelly Bean":a[0]===4&&a[1]>=4?"KitKat":a[0]===5?"Lollipop":a[0]===6?"Marshmallow":a[0]===7?"Nougat":a[0]===8?"Oreo":a[0]===9?"Pie":void 0},i.getVersionPrecision=function(s){return s.split(".").length},i.compareVersions=function(s,a,c){c===void 0&&(c=!1);var u=i.getVersionPrecision(s),l=i.getVersionPrecision(a),d=Math.max(u,l),f=0,p=i.map([s,a],(function(m){var g=d-i.getVersionPrecision(m),y=m+new Array(g+1).join(".0");return i.map(y.split("."),(function(w){return new Array(20-w.length).join("0")+w})).reverse()}));for(c&&(f=d-Math.min(u,l)),d-=1;d>=f;){if(p[0][d]>p[1][d])return 1;if(p[0][d]===p[1][d]){if(d===f)return 0;d-=1}else if(p[0][d]<p[1][d])return-1}},i.map=function(s,a){var c,u=[];if(Array.prototype.map)return Array.prototype.map.call(s,a);for(c=0;c<s.length;c+=1)u.push(a(s[c]));return u},i.find=function(s,a){var c,u;if(Array.prototype.find)return Array.prototype.find.call(s,a);for(c=0,u=s.length;c<u;c+=1){var l=s[c];if(a(l,c))return l}},i.assign=function(s){for(var a,c,u=s,l=arguments.length,d=new Array(l>1?l-1:0),f=1;f<l;f++)d[f-1]=arguments[f];if(Object.assign)return Object.assign.apply(Object,[s].concat(d));var p=function(){var m=d[a];typeof m=="object"&&m!==null&&Object.keys(m).forEach((function(g){u[g]=m[g]}))};for(a=0,c=d.length;a<c;a+=1)p();return s},i.getBrowserAlias=function(s){return o.BROWSER_ALIASES_MAP[s]},i.getBrowserTypeByAlias=function(s){return o.BROWSER_MAP[s]||""},i})();e.default=n,t.exports=e.default},18:function(t,e,r){"use strict";e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",Brave:"brave",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",DuckDuckGo:"duckduckgo",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Linespider:"linespider",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SlackBot:"slackbot",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},e.BROWSER_MAP={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",brave:"Brave",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",duckduckgo:"DuckDuckGo",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",linespider:"Linespider",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",slackbot:"SlackBot",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},e.PLATFORMS_MAP={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},e.OS_MAP={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},e.ENGINE_MAP={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"}},90:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o,n=(o=r(91))&&o.__esModule?o:{default:o},i=r(18);function s(c,u){for(var l=0;l<u.length;l++){var d=u[l];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(c,d.key,d)}}var a=(function(){function c(){}var u,l,d;return c.getParser=function(f,p,m){if(p===void 0&&(p=!1),m===void 0&&(m=null),typeof f!="string")throw new Error("UserAgent should be a string");return new n.default(f,p,m)},c.parse=function(f,p){return p===void 0&&(p=null),new n.default(f,p).getResult()},u=c,d=[{key:"BROWSER_MAP",get:function(){return i.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return i.ENGINE_MAP}},{key:"OS_MAP",get:function(){return i.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return i.PLATFORMS_MAP}}],(l=null)&&s(u.prototype,l),d&&s(u,d),c})();e.default=a,t.exports=e.default},91:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o=c(r(92)),n=c(r(93)),i=c(r(94)),s=c(r(95)),a=c(r(17));function c(l){return l&&l.__esModule?l:{default:l}}var u=(function(){function l(f,p,m){if(p===void 0&&(p=!1),m===void 0&&(m=null),f==null||f==="")throw new Error("UserAgent parameter can't be empty");this._ua=f;var g=!1;typeof p=="boolean"?(g=p,this._hints=m):this._hints=p!=null&&typeof p=="object"?p:null,this.parsedResult={},g!==!0&&this.parse()}var d=l.prototype;return d.getHints=function(){return this._hints},d.hasBrand=function(f){if(!this._hints||!Array.isArray(this._hints.brands))return!1;var p=f.toLowerCase();return this._hints.brands.some((function(m){return m.brand&&m.brand.toLowerCase()===p}))},d.getBrandVersion=function(f){if(this._hints&&Array.isArray(this._hints.brands)){var p=f.toLowerCase(),m=this._hints.brands.find((function(g){return g.brand&&g.brand.toLowerCase()===p}));return m?m.version:void 0}},d.getUA=function(){return this._ua},d.test=function(f){return f.test(this._ua)},d.parseBrowser=function(){var f=this;this.parsedResult.browser={};var p=a.default.find(o.default,(function(m){if(typeof m.test=="function")return m.test(f);if(Array.isArray(m.test))return m.test.some((function(g){return f.test(g)}));throw new Error("Browser's test function is not valid")}));return p&&(this.parsedResult.browser=p.describe(this.getUA(),this)),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(f){return f?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var f=this;this.parsedResult.os={};var p=a.default.find(n.default,(function(m){if(typeof m.test=="function")return m.test(f);if(Array.isArray(m.test))return m.test.some((function(g){return f.test(g)}));throw new Error("Browser's test function is not valid")}));return p&&(this.parsedResult.os=p.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(f){var p=this.getOS().name;return f?String(p).toLowerCase()||"":p||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(f){f===void 0&&(f=!1);var p=this.getPlatform().type;return f?String(p).toLowerCase()||"":p||""},d.parsePlatform=function(){var f=this;this.parsedResult.platform={};var p=a.default.find(i.default,(function(m){if(typeof m.test=="function")return m.test(f);if(Array.isArray(m.test))return m.test.some((function(g){return f.test(g)}));throw new Error("Browser's test function is not valid")}));return p&&(this.parsedResult.platform=p.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(f){return f?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var f=this;this.parsedResult.engine={};var p=a.default.find(s.default,(function(m){if(typeof m.test=="function")return m.test(f);if(Array.isArray(m.test))return m.test.some((function(g){return f.test(g)}));throw new Error("Browser's test function is not valid")}));return p&&(this.parsedResult.engine=p.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return a.default.assign({},this.parsedResult)},d.satisfies=function(f){var p=this,m={},g=0,y={},w=0;if(Object.keys(f).forEach((function(Ie){var xe=f[Ie];typeof xe=="string"?(y[Ie]=xe,w+=1):typeof xe=="object"&&(m[Ie]=xe,g+=1)})),g>0){var b=Object.keys(m),_=a.default.find(b,(function(Ie){return p.isOS(Ie)}));if(_){var k=this.satisfies(m[_]);if(k!==void 0)return k}var $=a.default.find(b,(function(Ie){return p.isPlatform(Ie)}));if($){var D=this.satisfies(m[$]);if(D!==void 0)return D}}if(w>0){var K=Object.keys(y),te=a.default.find(K,(function(Ie){return p.isBrowser(Ie,!0)}));if(te!==void 0)return this.compareVersion(y[te])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var m=this.getBrowserName().toLowerCase(),g=f.toLowerCase(),y=a.default.getBrowserTypeByAlias(g);return p&&y&&(g=y.toLowerCase()),g===m},d.compareVersion=function(f){var p=[0],m=f,g=!1,y=this.getBrowserVersion();if(typeof y=="string")return f[0]===">"||f[0]==="<"?(m=f.substr(1),f[1]==="="?(g=!0,m=f.substr(2)):p=[],f[0]===">"?p.push(1):p.push(-1)):f[0]==="="?m=f.substr(1):f[0]==="~"&&(g=!0,m=f.substr(1)),p.indexOf(a.default.compareVersions(y,m,g))>-1},d.isOS=function(f){return this.getOSName(!0)===String(f).toLowerCase()},d.isPlatform=function(f){return this.getPlatformType(!0)===String(f).toLowerCase()},d.isEngine=function(f){return this.getEngineName(!0)===String(f).toLowerCase()},d.is=function(f,p){return p===void 0&&(p=!1),this.isBrowser(f,p)||this.isOS(f)||this.isPlatform(f)},d.some=function(f){var p=this;return f===void 0&&(f=[]),f.some((function(m){return p.is(m)}))},l})();e.default=u,t.exports=e.default},92:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o,n=(o=r(17))&&o.__esModule?o:{default:o},i=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/gptbot/i],describe:function(a){var c={name:"GPTBot"},u=n.default.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/chatgpt-user/i],describe:function(a){var c={name:"ChatGPT-User"},u=n.default.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/oai-searchbot/i],describe:function(a){var c={name:"OAI-SearchBot"},u=n.default.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(a){var c={name:"ClaudeBot"},u=n.default.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(a){var c={name:"Omgilibot"},u=n.default.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/diffbot/i],describe:function(a){var c={name:"Diffbot"},u=n.default.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/perplexitybot/i],describe:function(a){var c={name:"PerplexityBot"},u=n.default.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/perplexity-user/i],describe:function(a){var c={name:"Perplexity-User"},u=n.default.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/youbot/i],describe:function(a){var c={name:"YouBot"},u=n.default.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/meta-webindexer/i],describe:function(a){var c={name:"Meta-WebIndexer"},u=n.default.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/meta-externalads/i],describe:function(a){var c={name:"Meta-ExternalAds"},u=n.default.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/meta-externalagent/i],describe:function(a){var c={name:"Meta-ExternalAgent"},u=n.default.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/meta-externalfetcher/i],describe:function(a){var c={name:"Meta-ExternalFetcher"},u=n.default.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/googlebot/i],describe:function(a){var c={name:"Googlebot"},u=n.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/linespider/i],describe:function(a){var c={name:"Linespider"},u=n.default.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/amazonbot/i],describe:function(a){var c={name:"AmazonBot"},u=n.default.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/bingbot/i],describe:function(a){var c={name:"BingCrawler"},u=n.default.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/baiduspider/i],describe:function(a){var c={name:"BaiduSpider"},u=n.default.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/duckduckbot/i],describe:function(a){var c={name:"DuckDuckBot"},u=n.default.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/ia_archiver/i],describe:function(a){var c={name:"InternetArchiveCrawler"},u=n.default.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe:function(a){var c={name:"SlackBot"},u=n.default.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/yahoo!?[\s/]*slurp/i],describe:function(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe:function(){return{name:"PingdomBot"}}},{test:[/opera/i],describe:function(a){var c={name:"Opera"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/opr\/|opios/i],describe:function(a){var c={name:"Opera"},u=n.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/SamsungBrowser/i],describe:function(a){var c={name:"Samsung Internet for Android"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/Whale/i],describe:function(a){var c={name:"NAVER Whale Browser"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/PaleMoon/i],describe:function(a){var c={name:"Pale Moon"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/MZBrowser/i],describe:function(a){var c={name:"MZ Browser"},u=n.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/focus/i],describe:function(a){var c={name:"Focus"},u=n.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/swing/i],describe:function(a){var c={name:"Swing"},u=n.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/coast/i],describe:function(a){var c={name:"Opera Coast"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(a){var c={name:"Opera Touch"},u=n.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/yabrowser/i],describe:function(a){var c={name:"Yandex Browser"},u=n.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/ucbrowser/i],describe:function(a){var c={name:"UC Browser"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/Maxthon|mxios/i],describe:function(a){var c={name:"Maxthon"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/epiphany/i],describe:function(a){var c={name:"Epiphany"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/puffin/i],describe:function(a){var c={name:"Puffin"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/sleipnir/i],describe:function(a){var c={name:"Sleipnir"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/k-meleon/i],describe:function(a){var c={name:"K-Meleon"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/micromessenger/i],describe:function(a){var c={name:"WeChat"},u=n.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/qqbrowser/i],describe:function(a){var c={name:/qqbrowserlite/i.test(a)?"QQ Browser Lite":"QQ Browser"},u=n.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/msie|trident/i],describe:function(a){var c={name:"Internet Explorer"},u=n.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/\sedg\//i],describe:function(a){var c={name:"Microsoft Edge"},u=n.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/edg([ea]|ios)/i],describe:function(a){var c={name:"Microsoft Edge"},u=n.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/vivaldi/i],describe:function(a){var c={name:"Vivaldi"},u=n.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/seamonkey/i],describe:function(a){var c={name:"SeaMonkey"},u=n.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/sailfish/i],describe:function(a){var c={name:"Sailfish"},u=n.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,a);return u&&(c.version=u),c}},{test:[/silk/i],describe:function(a){var c={name:"Amazon Silk"},u=n.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/phantom/i],describe:function(a){var c={name:"PhantomJS"},u=n.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/slimerjs/i],describe:function(a){var c={name:"SlimerJS"},u=n.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(a){var c={name:"BlackBerry"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/(web|hpw)[o0]s/i],describe:function(a){var c={name:"WebOS Browser"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/bada/i],describe:function(a){var c={name:"Bada"},u=n.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/tizen/i],describe:function(a){var c={name:"Tizen"},u=n.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/qupzilla/i],describe:function(a){var c={name:"QupZilla"},u=n.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/librewolf/i],describe:function(a){var c={name:"LibreWolf"},u=n.default.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/firefox|iceweasel|fxios/i],describe:function(a){var c={name:"Firefox"},u=n.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/electron/i],describe:function(a){var c={name:"Electron"},u=n.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe:function(a){var c={name:"Sogou Browser"},u=n.default.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,a),l=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,a),d=n.default.getFirstMatch(/se ([\d.]+)x/i,a),f=u||l||d;return f&&(c.version=f),c}},{test:[/MiuiBrowser/i],describe:function(a){var c={name:"Miui"},u=n.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:function(a){return!!a.hasBrand("DuckDuckGo")||a.test(/\sDdg\/[\d.]+$/i)},describe:function(a,c){var u={name:"DuckDuckGo"};if(c){var l=c.getBrandVersion("DuckDuckGo");if(l)return u.version=l,u}var d=n.default.getFirstMatch(/\sDdg\/([\d.]+)$/i,a);return d&&(u.version=d),u}},{test:function(a){return a.hasBrand("Brave")},describe:function(a,c){var u={name:"Brave"};if(c){var l=c.getBrandVersion("Brave");if(l)return u.version=l,u}return u}},{test:[/chromium/i],describe:function(a){var c={name:"Chromium"},u=n.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/chrome|crios|crmo/i],describe:function(a){var c={name:"Chrome"},u=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/GSA/i],describe:function(a){var c={name:"Google Search"},u=n.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:function(a){var c=!a.test(/like android/i),u=a.test(/android/i);return c&&u},describe:function(a){var c={name:"Android Browser"},u=n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/playstation 4/i],describe:function(a){var c={name:"PlayStation 4"},u=n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/safari|applewebkit/i],describe:function(a){var c={name:"Safari"},u=n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/.*/i],describe:function(a){var c=a.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:n.default.getFirstMatch(c,a),version:n.default.getSecondMatch(c,a)}}}];e.default=s,t.exports=e.default},93:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o,n=(o=r(17))&&o.__esModule?o:{default:o},i=r(18),s=[{test:[/Roku\/DVP/],describe:function(a){var c=n.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,a);return{name:i.OS_MAP.Roku,version:c}}},{test:[/windows phone/i],describe:function(a){var c=n.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,a);return{name:i.OS_MAP.WindowsPhone,version:c}}},{test:[/windows /i],describe:function(a){var c=n.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,a),u=n.default.getWindowsVersionName(c);return{name:i.OS_MAP.Windows,version:c,versionName:u}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(a){var c={name:i.OS_MAP.iOS},u=n.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,a);return u&&(c.version=u),c}},{test:[/macintosh/i],describe:function(a){var c=n.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,a).replace(/[_\s]/g,"."),u=n.default.getMacOSVersionName(c),l={name:i.OS_MAP.MacOS,version:c};return u&&(l.versionName=u),l}},{test:[/(ipod|iphone|ipad)/i],describe:function(a){var c=n.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,a).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:c}}},{test:[/OpenHarmony/i],describe:function(a){var c=n.default.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,a);return{name:i.OS_MAP.HarmonyOS,version:c}}},{test:function(a){var c=!a.test(/like android/i),u=a.test(/android/i);return c&&u},describe:function(a){var c=n.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,a),u=n.default.getAndroidVersionName(c),l={name:i.OS_MAP.Android,version:c};return u&&(l.versionName=u),l}},{test:[/(web|hpw)[o0]s/i],describe:function(a){var c=n.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,a),u={name:i.OS_MAP.WebOS};return c&&c.length&&(u.version=c),u}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(a){var c=n.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,a)||n.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,a)||n.default.getFirstMatch(/\bbb(\d+)/i,a);return{name:i.OS_MAP.BlackBerry,version:c}}},{test:[/bada/i],describe:function(a){var c=n.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,a);return{name:i.OS_MAP.Bada,version:c}}},{test:[/tizen/i],describe:function(a){var c=n.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,a);return{name:i.OS_MAP.Tizen,version:c}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(a){var c=n.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,a);return{name:i.OS_MAP.PlayStation4,version:c}}}];e.default=s,t.exports=e.default},94:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o,n=(o=r(17))&&o.__esModule?o:{default:o},i=r(18),s=[{test:[/googlebot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/linespider/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe:function(a){var c=n.default.getFirstMatch(/(can-l01)/i,a)&&"Nova",u={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return c&&(u.model=c),u}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(a){var c=a.test(/ipod|iphone/i),u=a.test(/like (ipod|iphone)/i);return c&&!u},describe:function(a){var c=n.default.getFirstMatch(/(ipod|iphone)/i,a);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:c}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe:function(a){var c=n.default.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,a),u={type:i.PLATFORMS_MAP.mobile,vendor:"Nokia"};return c&&(u.model=c),u}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(a){return a.getBrowserName(!0)==="blackberry"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(a){return a.getBrowserName(!0)==="bada"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(a){return a.getBrowserName()==="windows phone"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(a){var c=Number(String(a.getOSVersion()).split(".")[0]);return a.getOSName(!0)==="android"&&c>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(a){return a.getOSName(!0)==="android"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:[/smart-?tv|smarttv/i],describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:[/netcast/i],describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(a){return a.getOSName(!0)==="macos"},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(a){return a.getOSName(!0)==="windows"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(a){return a.getOSName(!0)==="linux"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(a){return a.getOSName(!0)==="playstation 4"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(a){return a.getOSName(!0)==="roku"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];e.default=s,t.exports=e.default},95:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o,n=(o=r(17))&&o.__esModule?o:{default:o},i=r(18),s=[{test:function(a){return a.getBrowserName(!0)==="microsoft edge"},describe:function(a){if(/\sedg\//i.test(a))return{name:i.ENGINE_MAP.Blink};var c=n.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,a);return{name:i.ENGINE_MAP.EdgeHTML,version:c}}},{test:[/trident/i],describe:function(a){var c={name:i.ENGINE_MAP.Trident},u=n.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:function(a){return a.test(/presto/i)},describe:function(a){var c={name:i.ENGINE_MAP.Presto},u=n.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:function(a){var c=a.test(/gecko/i),u=a.test(/like gecko/i);return c&&!u},describe:function(a){var c={name:i.ENGINE_MAP.Gecko},u=n.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(a){var c={name:i.ENGINE_MAP.WebKit},u=n.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}}];e.default=s,t.exports=e.default}})}))});var zG,jG=v(()=>{zG=({serviceId:t,clientVersion:e})=>async r=>{let o=await Promise.resolve().then(()=>St(DG())),n=o.parse??o.default.parse??(()=>""),i=typeof window<"u"&&window?.navigator?.userAgent?n(window.navigator.userAgent):void 0,s=[["aws-sdk-js",e],["ua","2.1"],[`os/${i?.os?.name||"other"}`,i?.os?.version],["lang/js"],["md/browser",`${i?.browser?.name??"unknown"}_${i?.browser?.version??"unknown"}`]];t&&s.push([`api/${t}`,e]);let a=await r?.userAgentAppId?.();return a&&s.push([`app/${a}`]),s}});var MG,UG=v(()=>{MG={os(t){if(/iPhone|iPad|iPod/.test(t))return"iOS";if(/Macintosh|Mac OS X/.test(t))return"macOS";if(/Windows NT/.test(t))return"Windows";if(/Android/.test(t))return"Android";if(/Linux/.test(t))return"Linux"},browser(t){if(/EdgiOS|EdgA|Edg\//.test(t))return"Microsoft Edge";if(/Firefox\//.test(t))return"Firefox";if(/Chrome\//.test(t))return"Chrome";if(/Safari\//.test(t))return"Safari"}}});var mj=v(()=>{It()});var Iy,hj=v(()=>{It();mj();Iy=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!Iy(r))return!1;return!0}return!(!di(t)||t.length<3||t.length>63||t!==t.toLowerCase()||ya(t))}});var Rk,gj=v(()=>{Rk=t=>{let e=t.split(":");if(e.length<6)return null;let[r,o,n,i,s,...a]=e;if(r!=="arn"||o===""||n===""||a.join(":")==="")return null;let c=a.map(u=>u.split("/")).flat();return{partition:o,service:n,region:i,accountId:s,resourceId:c}}});var xi,LG=v(()=>{It();hj();gj();Ak();xi={isVirtualHostableS3Bucket:Iy,parseArn:Rk,partition:Ik};On.aws=xi});var FG=v(()=>{It()});var VG,yj,HG=v(()=>{re();VG=t=>{if(typeof t.endpointProvider!="function")throw new Error("@aws-sdk/util-endpoint - endpointProvider and endpoint missing in config for this client.");let{endpoint:e}=t;return e===void 0&&(t.endpoint=async()=>yj(t.endpointProvider({Region:typeof t.region=="function"?await t.region():t.region,UseDualStack:typeof t.useDualstackEndpoint=="function"?await t.useDualstackEndpoint():t.useDualstackEndpoint,UseFIPS:typeof t.useFipsEndpoint=="function"?await t.useFipsEndpoint():t.useFipsEndpoint,Endpoint:void 0},{logger:t.logger}))),t},yj=t=>Ir(t.url)});var BG=v(()=>{It()});var KG=v(()=>{dt();dt()});function Ck(t={}){return fe({...$r,async default(){return vj.silence||console.warn("@aws-sdk - WARN - default STS region of us-east-1 used. See @aws-sdk/credential-providers README and set a region explicitly."),"us-east-1"}},{...gn,...t})}var vj,qG=v(()=>{dt();vj={silence:!1}});var zs,js,ZG=v(()=>{zs=t=>({setRegion(e){t.region=e},region(){return t.region}}),js=t=>({region:t.region()})});var Ms={};yt(Ms,{DEFAULT_UA_APP_ID:()=>xy,EndpointError:()=>He,NODE_APP_ID_CONFIG_OPTIONS:()=>Ds,NODE_REGION_CONFIG_FILE_OPTIONS:()=>gn,NODE_REGION_CONFIG_OPTIONS:()=>$r,REGION_ENV_NAME:()=>Fp,REGION_INI_NAME:()=>Vp,UA_APP_ID_ENV_NAME:()=>dj,UA_APP_ID_INI_NAME:()=>pj,awsEndpointFunctions:()=>xi,createDefaultUserAgentProvider:()=>Si,createUserAgentStringParsingProvider:()=>zG,crtAvailability:()=>Ey,defaultUserAgent:()=>CG,emitWarningIfUnsupportedVersion:()=>os,fallback:()=>MG,getAwsRegionExtensionConfiguration:()=>zs,getHostHeaderPlugin:()=>Ps,getLoggerPlugin:()=>Rs,getLongPollPlugin:()=>SZ,getRecursionDetectionPlugin:()=>Cs,getUserAgentMiddlewareOptions:()=>cj,getUserAgentPlugin:()=>Ns,getUserAgentPrefix:()=>$k,hostHeaderMiddleware:()=>F1,hostHeaderMiddlewareOptions:()=>V1,isIpAddress:()=>ya,isVirtualHostableS3Bucket:()=>Iy,loggerMiddleware:()=>H1,loggerMiddlewareOptions:()=>B1,parseArn:()=>Rk,partition:()=>Ik,recursionDetectionMiddleware:()=>bk,recursionDetectionMiddlewareOptions:()=>vk,resolveAwsRegionExtensionConfiguration:()=>js,resolveDefaultAwsRegionalEndpointsConfig:()=>VG,resolveEndpoint:()=>ly,resolveHostHeaderConfig:()=>df,resolveRegionConfig:()=>to,resolveUserAgentConfig:()=>Os,setCredentialFeature:()=>gc,setFeature:()=>Oo,setPartitionInfo:()=>oj,setTokenFeature:()=>UJ,state:()=>jg,stsRegionDefaultResolver:()=>Ck,stsRegionWarning:()=>vj,toEndpointV1:()=>yj,useDefaultPartitionInfo:()=>gG,userAgentMiddleware:()=>aj});var pt=v(()=>{_Z();xZ();EZ();L1();LJ();FJ();VJ();K1();qJ();X1();rj();IG();OG();NG();UG();jG();LG();FG();HG();mj();hj();gj();Ak();BG();KG();qG();ZG()});var Ok,Nk,WG=v(()=>{re();Ok=t=>ur.isInstance(t)?t.headers?.date??t.headers?.Date:void 0,Nk=t=>ur.isInstance(t)?t.headers?.age??t.headers?.Age:void 0});var $y,JG=v(()=>{$y=t=>new Date(Date.now()+t)});var Dk,GG=v(()=>{Dk=(t,e,r,o)=>{if(o!==void 0)return e;let n=Date.parse(t),i=Date.now();return r!==void 0&&i-r>9e5?e:r!==void 0?n-(r+i)/2:n-i}});var wj=v(()=>{WG();JG();GG()});var Ay,hf,mr,bj,_j=v(()=>{re();wj();Ay=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},hf=async t=>{let e=Ay("context",t.context),r=Ay("config",t.config),o=e.endpointV2?.properties?.authSchemes?.[0],i=await Ay("signer",r.signer)(o),s=t?.signingRegion,a=t?.signingRegionSet,c=t?.signingName;return{config:r,signer:i,signingRegion:s,signingRegionSet:a,signingName:c}},mr=class{async sign(e,r,o){if(!Ce.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let n=await hf(o),{config:i,signer:s}=n,{signingRegion:a,signingName:c}=n,u=o.context;if(u?.authSchemes?.length??!1){let[f,p]=u.authSchemes;f?.name==="sigv4a"&&p?.name==="sigv4"&&(a=p?.signingRegion??a,c=p?.signingName??c)}let l=await i.disableClockSkewCorrection?.()===!0;return o._disableClockSkewCorrection=l,l||(o._preRequestSystemClockOffset=i.systemClockOffset,o._requestSentAt=Date.now()),await s.sign(e,{signingDate:l?new Date:$y(i.systemClockOffset),signingRegion:a,signingService:c})}errorHandler(e){return r=>{let o=r;if(!e._disableClockSkewCorrection){let n=o.ServerTime??Ok(o.$response);if(n){let i=Ay("config",e.config),s=e._preRequestSystemClockOffset,a=e._requestSentAt,c=Nk(o.$response),u=Dk(n,i.systemClockOffset,a,c);i.systemClockOffset=u,Math.abs(u)>=24e4&&(u!==s||s!==void 0&&s!==u)&&o.$metadata&&(o.$metadata.clockSkewCorrected=!0)}}throw r}}successHandler(e,r){if(r._disableClockSkewCorrection)return;let o=Ok(e);if(o){let n=Ay("config",r.config),i=r._requestSentAt,s=Nk(e);n.systemClockOffset=Dk(o,n.systemClockOffset,i,s)}}},bj=mr});var Ea,XG=v(()=>{re();wj();_j();Ea=class extends mr{async sign(e,r,o){if(!Ce.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let{config:n,signer:i,signingRegion:s,signingRegionSet:a,signingName:c}=await hf(o),l=(await n.sigv4aSigningRegionSet?.()??a??[s]).join(","),d=await n.disableClockSkewCorrection?.()===!0;return o._disableClockSkewCorrection=d,d||(o._preRequestSystemClockOffset=n.systemClockOffset,o._requestSentAt=Date.now()),await i.sign(e,{signingDate:d?new Date:$y(n.systemClockOffset),signingRegion:l,signingService:c})}}});var Sj,YG=v(()=>{Sj=t=>typeof t=="string"&&t.length>0?t.split(",").map(e=>e.trim()):[]});var zk,xj=v(()=>{zk=t=>`AWS_BEARER_TOKEN_${t.replace(/[\s-]/g,"_").toUpperCase()}`});var QG,e7,Ei,t7=v(()=>{YG();xj();QG="AWS_AUTH_SCHEME_PREFERENCE",e7="auth_scheme_preference",Ei={environmentVariableSelector:(t,e)=>{if(e?.signingName&&zk(e.signingName)in t)return["httpBearerAuth"];if(QG in t)return Sj(t[QG])},configFileSelector:t=>{if(e7 in t)return Sj(t[e7])},default:[]}});var Ty,Py,r7=v(()=>{Nn();dt();Ty=t=>(t.sigv4aSigningRegionSet=No(t.sigv4aSigningRegionSet),t),Py={environmentVariableSelector(t){if(t.AWS_SIGV4A_SIGNING_REGION_SET)return t.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map(e=>e.trim());throw new eo("AWS_SIGV4A_SIGNING_REGION_SET not set in env.",{tryNextLink:!0})},configFileSelector(t){if(t.sigv4a_signing_region_set)return(t.sigv4a_signing_region_set??"").split(",").map(e=>e.trim());throw new eo("sigv4a_signing_region_set not set in profile.",{tryNextLink:!0})},default:void 0}});var Dj=R(Ee=>{var{hasOwn:yf,fromUtf8:n7,fromHex:n_e,toHex:bl,toUint8Array:Ry,isArrayBuffer:o_e}=(de(),se(Zp)),{normalizeProvider:o7}=(le(),se(U0)),{escapeUri:jk,HttpRequest:c7}=(re(),se(yl)),Ej=class{format(e){let r=[];for(let i in e){if(!yf(e,i))continue;let s=n7(i);r.push(Uint8Array.from([s.byteLength]),s,this.formatHeaderValue(e[i]))}let o=new Uint8Array(r.reduce((i,s)=>i+s.byteLength,0)),n=0;for(let i of r)o.set(i,n),n+=i.byteLength;return o}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let o=new DataView(new ArrayBuffer(5));return o.setUint8(0,4),o.setInt32(1,e.value,!1),new Uint8Array(o.buffer);case"long":let n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let s=new Uint8Array(i.buffer);return s.set(e.value,3),s;case"string":let a=n7(e.value),c=new DataView(new ArrayBuffer(3+a.byteLength));c.setUint8(0,7),c.setUint16(1,a.byteLength,!1);let u=new Uint8Array(c.buffer);return u.set(a,3),u;case"timestamp":let l=new Uint8Array(9);return l[0]=8,l.set(kj.fromNumber(e.value.valueOf()).bytes,1),l;case"uuid":if(!i_e.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(n_e(e.value.replace(/-/g,"")),1),d}}},i7;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(i7||(i7={}));var i_e=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,kj=class t{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let o=7,n=Math.abs(Math.round(e));o>-1&&n>0;o--,n/=256)r[o]=n;return e<0&&s7(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&s7(e),parseInt(bl(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function s7(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var u7="X-Amz-Algorithm",l7="X-Amz-Credential",Tj="X-Amz-Date",d7="X-Amz-SignedHeaders",p7="X-Amz-Expires",Pj="X-Amz-Signature",Rj="X-Amz-Security-Token",s_e="X-Amz-Region-Set",Cj="authorization",Oj=Tj.toLowerCase(),f7="date",m7=[Cj,Oj,f7],h7=Pj.toLowerCase(),Vk="x-amz-content-sha256",g7=Rj.toLowerCase(),a_e="host",y7={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},v7=/^proxy-/,w7=/^sec-/,c_e=[/^proxy-/i,/^sec-/i],Mk="AWS4-HMAC-SHA256",u_e="AWS4-ECDSA-P256-SHA256",b7="AWS4-HMAC-SHA256-PAYLOAD",_7="UNSIGNED-PAYLOAD",S7=50,Nj="aws4_request",x7=3600*24*7,E7=({query:t={}})=>{let e=[],r={};for(let o in t){if(!yf(t,o)||o.toLowerCase()===h7)continue;let n=jk(o);e.push(n);let i=t[o];typeof i=="string"?r[n]=`${n}=${jk(i)}`:Array.isArray(i)&&(r[n]=i.slice(0).reduce((s,a)=>s.concat([`${n}=${jk(a)}`]),[]).sort().join("&"))}return e.sort().map(o=>r[o]).filter(o=>o).join("&")},l_e=t=>d_e(t).toISOString().replace(/\.\d{3}Z$/,"Z"),d_e=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t,Hk=class{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:r,region:o,service:n,sha256:i,uriEscapePath:s=!0}){this.service=n,this.sha256=i,this.uriEscapePath=s,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=o7(o),this.credentialProvider=o7(r)}createCanonicalRequest(e,r,o){let n=Object.keys(r).sort();return`${e.method}
24
+ `)}d.push(null)}catch(f){d.destroy(f)}}),d}var i8=v(()=>{n8();hi()});async function s8(t,e){let r=0,o=[],n=t.getReader(),i=!1;for(;!i;){let{done:c,value:u}=await n.read();if(u&&(o.push(u),r+=u?.byteLength??0),r>=e)break;i=c}n.releaseLock();let s=new Uint8Array(Math.min(e,r)),a=0;for(let c of o){if(c.byteLength>s.byteLength-a){s.set(c.subarray(0,s.byteLength-a),a);break}else s.set(c,a);a+=c.length}return s}var a8=v(()=>{});import{Writable as nbe}from"node:stream";var c8,B1,u8=v(()=>{Qg();a8();hi();c8=(t,e)=>ir(t)?s8(t,e):new Promise((r,o)=>{let n=new B1;n.limit=e,t.pipe(n),t.on("error",i=>{n.end(),o(i)}),n.on("error",o),n.on("finish",function(){let i=ms(this.buffers);r(i)})}),B1=class extends nbe{buffers=[];limit=1/0;bytesBuffered=0;_write(e,r,o){if(this.buffers.push(e),this.bytesBuffered+=e.byteLength??0,this.bytesBuffered>=this.limit){let n=this.bytesBuffered-this.limit,i=this.buffers[this.buffers.length-1];this.buffers[this.buffers.length-1]=i.subarray(0,i.byteLength-n),this.emit("finish")}o()}}});var l8,d8=v(()=>{l8=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});async function K1(t){return t.arrayBuffer().then(e=>new Uint8Array(e))}async function q1(t){let e=[],r=t.getReader(),o=0;for(;;){let{done:n,value:i}=await r.read();if(i&&(e.push(i),o+=i.length),n)break}return ms(e,o)}var p8,Z1=v(()=>{Qg();hi();p8=async t=>Ic(t)?K1(t):q1(t)});var f8,h8,m8,g8=v(()=>{L1();MD();d8();Z1();hi();f8="The stream has already been transformed.",h8=t=>{if(!m8(t)&&!ir(t)){let n=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${n}`)}let e=!1,r=async()=>{if(e)throw new Error(f8);return e=!0,await p8(t)},o=n=>{if(typeof n.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
25
+ If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return n.stream()};return Object.assign(t,{transformToByteArray:r,transformToString:async n=>{let i=await r();if(n==="base64")return ME(i);if(n==="hex")return $o(i);if(n===void 0||n==="utf8"||n==="utf-8")return l8(i);if(typeof TextDecoder=="function")return new TextDecoder(n).decode(i);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(e)throw new Error(f8);if(e=!0,m8(t))return o(t);if(ir(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},m8=t=>typeof Blob=="function"&&t instanceof Blob});import{Writable as obe}from"node:stream";var LE,W1,J1=v(()=>{Qg();Z1();hi();LE=t=>Ic(t)?K1(t):ir(t)?q1(t):new Promise((e,r)=>{let o=new W1,n=t;n.pipe(o),n.on("error",i=>{o.end(),r(i)}),o.on("error",r),o.on("finish",function(){let i=ms(this.bufferedBytes);e(i)})}),W1=class extends obe{bufferedBytes=[];_write(e,r,o){this.bufferedBytes.push(e),o()}}});import{Readable as G1}from"node:stream";var y8,FE,v8=v(()=>{_c();g8();J1();y8="The stream has already been transformed.",FE=t=>{if(!(t instanceof G1))try{return h8(t)}catch{let n=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${n}`)}let e=!1,r=async()=>{if(e)throw new Error(y8);return e=!0,await LE(t)};return Object.assign(t,{transformToByteArray:r,transformToString:async o=>{let n=await r();return o===void 0||Buffer.isEncoding(o)?mi(n.buffer,n.byteOffset,n.byteLength).toString(o):new TextDecoder(o).decode(n)},transformToWebStream:()=>{if(e)throw new Error(y8);if(t.readableFlowing!==null)throw new Error("The stream has been consumed by other callbacks.");if(typeof G1.toWeb!="function")throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return e=!0,G1.toWeb(t)}})}});async function w8(t){return typeof t.stream=="function"&&(t=t.stream()),t.tee()}var b8=v(()=>{});import{PassThrough as _8}from"node:stream";async function S8(t){if(ir(t)||Ic(t))return w8(t);let e=new _8,r=new _8;return t.pipe(e),t.pipe(r),[e,r]}var x8=v(()=>{b8();hi()});var Zp={};yt(Zp,{ChecksumStream:()=>Kp,Hash:()=>zE,LazyJsonString:()=>Zt,NumericValue:()=>Ne,Uint8ArrayBlobAdapter:()=>fl,_parseEpochTimestamp:()=>Ec,_parseRfc3339DateTimeWithOffset:()=>Y0,_parseRfc7231DateTime:()=>Q0,calculateBodyLength:()=>fs,concatBytes:()=>ms,copyDocumentWithTransform:()=>G3,createBufferedReadable:()=>e8,createChecksumStream:()=>G5,dateToUtcString:()=>Qn,deserializerMiddleware:()=>nE,deserializerMiddlewareOption:()=>z1,expectBoolean:()=>Q3,expectByte:()=>K0,expectFloat32:()=>Gg,expectInt:()=>eW,expectInt32:()=>H0,expectLong:()=>Rp,expectNonNull:()=>tW,expectNumber:()=>Pp,expectObject:()=>TD,expectShort:()=>B0,expectString:()=>rW,expectUnion:()=>Z0,fromArrayBuffer:()=>mi,fromBase64:()=>Mt,fromHex:()=>rE,fromString:()=>bc,fromUtf8:()=>or,generateIdempotencyToken:()=>oo,getAwsChunkedEncodingStream:()=>o8,getSerdePlugin:()=>j5,handleFloat:()=>oW,hasOwn:()=>ce,headStream:()=>c8,isArrayBuffer:()=>L0,isBlob:()=>Ic,isReadableStream:()=>ir,limitedParseDouble:()=>J0,limitedParseFloat:()=>iW,limitedParseFloat32:()=>sW,logger:()=>Cp,nv:()=>tE,parseBoolean:()=>Y3,parseEpochTimestamp:()=>zp,parseRfc3339DateTime:()=>lW,parseRfc3339DateTimeWithOffset:()=>Dp,parseRfc7231DateTime:()=>xc,quoteHeader:()=>X0,sdkStreamMixin:()=>FE,serializerMiddleware:()=>DE,serializerMiddlewareOption:()=>j1,splitEvery:()=>eE,splitHeader:()=>jp,splitStream:()=>S8,streamCollector:()=>LE,strictParseByte:()=>G0,strictParseDouble:()=>Xg,strictParseFloat:()=>nW,strictParseFloat32:()=>W0,strictParseInt:()=>cW,strictParseInt32:()=>uW,strictParseLong:()=>PD,strictParseShort:()=>Sc,toBase64:()=>_t,toHex:()=>$o,toUint8Array:()=>hn,toUtf8:()=>Dt,v4:()=>qp});import{getRandomValues as ibe}from"node:crypto";var fl,sbe,qp,oo,de=v(()=>{B3();$D();q3();F0();Z3();J3();X3();dW();pW();RD();fW();gW();yW();vW();bW();MD();SW();UD();Qg();_c();ID();FD();M5();D1();L5();M1();X5();t8();i8();u8();v8();x8();hi();J1();he();fl=class extends K3(Dt,or,_t,Mt){},sbe=ibe,qp=W3(sbe),oo=qp});var Ar,VE=v(()=>{de();Ar=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return fl.mutate(t);if(!t)return fl.mutate(new Uint8Array);let r=e.streamCollector(t);return fl.mutate(await r)}});function gi(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var HE=v(()=>{});var dr,Wp=v(()=>{dr=class{serdeContext;setSerdeContext(e){this.serdeContext=e}}});async function BE(t,e,r=1024*1024){let o=t.size,n=0;for(;n<o;){let i=t.slice(n,Math.min(o,n+r));e(new Uint8Array(await i.arrayBuffer())),n+=i.size}}var X1=v(()=>{});var E8,k8=v(()=>{X1();E8=async function(e,r){let o=new e;return await BE(r,n=>{o.update(n)}),o.digest()}});import{Writable as abe}from"node:stream";var Jp,Y1=v(()=>{de();Jp=class extends abe{hash;constructor(e,r){super(r),this.hash=e}_write(e,r,o){try{this.hash.update(hn(e))}catch(n){return o(n)}o()}}});import{createReadStream as cbe}from"node:fs";var I8,ube,$8=v(()=>{Y1();I8=(t,e)=>new Promise((r,o)=>{if(!ube(e)){o(new Error("Unable to calculate hash for non-file streams."));return}let n=cbe(e.path,{start:e.start,end:e.end}),i=new t,s=new Jp(i);n.pipe(s),n.on("error",a=>{s.end(),o(a)}),s.on("error",o),s.on("finish",function(){i.digest().then(r).catch(o)})}),ube=t=>typeof t.path=="string"});var A8,T8=v(()=>{Y1();A8=(t,e)=>{if(e.readableFlowing!==null)throw new Error("Unable to calculate hash for flowing readable stream");let r=new t,o=new Jp(r);return e.pipe(o),new Promise((n,i)=>{e.on("error",s=>{o.end(),i(s)}),o.on("error",i),o.on("finish",()=>{r.digest().then(n).catch(i)})})}});function Q1(t,e){let r=t[0],o=t[1],n=t[2],i=t[3];for(let s=0;s<64;++s){let a,c;s<16?(a=o&n|~o&i,c=s):s<32?(a=i&o|n&~i,c=(5*s+1)%16):s<48?(a=o^n^i,c=(3*s+5)%16):(a=n^(o|~i),c=7*s%16);let u=e.getUint32(c*4,!0),l=i;i=n,n=o;let d=lbe[(s>>4)*4+(s&3)],f=(r+a&$c)+(u+dbe[s]&$c)&$c;o=o+((f<<d|f>>>32-d)>>>0)&$c,r=l}t[0]=t[0]+r&$c,t[1]=t[1]+o&$c,t[2]=t[2]+n&$c,t[3]=t[3]+i&$c}var Gp,P8,$c,lbe,dbe,ez=v(()=>{de();Gp=class{digestLength=16;state=Uint32Array.from(P8);writeBuffer=new DataView(new ArrayBuffer(64));bufferLength=0;bytesHashed=0;update(e){let r=hn(e),o=0,n=r.byteLength;for(this.bytesHashed+=n;n>0;)this.writeBuffer.setUint8(this.bufferLength++,r[o++]),--n,this.bufferLength===64&&(Q1(this.state,this.writeBuffer),this.bufferLength=0)}async digest(){let e=Uint32Array.from(this.state),r=new DataView(this.writeBuffer.buffer.slice(0)),o=this.bufferLength,n=this.bytesHashed*8;if(r.setUint8(o++,128),this.bufferLength%64>=56){for(let a=o;a<64;++a)r.setUint8(a,0);Q1(e,r),o=0}for(let a=o;a<56;++a)r.setUint8(a,0);r.setUint32(56,n>>>0,!0),r.setUint32(60,Math.floor(n/2**32),!0),Q1(e,r);let i=new Uint8Array(16),s=new DataView(i.buffer);for(let a=0;a<4;++a)s.setUint32(a*4,e[a],!0);return i}reset(){this.state.set(P8),this.writeBuffer=new DataView(new ArrayBuffer(64)),this.bufferLength=0,this.bytesHashed=0}},P8=[1732584193,4023233417,2562383102,271733878],$c=4294967295,lbe=Uint8Array.of(7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21),dbe=Array.from({length:64},(t,e)=>Math.abs(Math.sin(e+1))*2**32>>>0)});import{createHash as tz}from"node:crypto";function fbe(){return class{digestLength=16;hash=tz("md5");update(e){this.hash.update(hn(e))}async digest(){let e=this.hash.copy().digest();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=tz("md5")}}}var pbe,rz,R8=v(()=>{de();ez();pbe=(()=>{try{return tz("md5"),!0}catch{return!1}})(),rz=pbe?fbe():Gp});var C8,nz,Xp,oz=v(()=>{C8=new Uint32Array(256);for(let t=0;t<256;++t){let e=t;for(let r=0;r<8;++r)e=e&1?3988292384^e>>>1:e>>>1;C8[t]=e>>>0}nz=4294967295,Xp=class{digestLength=4;checksum=nz;update(e){for(let r=0;r<e.length;++r)this.checksum=this.checksum>>>8^C8[(this.checksum^e[r])&255]}digestSync(){return(this.checksum^nz)>>>0}async digest(){let e=this.digestSync(),r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e,!1),r}reset(){this.checksum=nz}}});import*as iz from"node:zlib";function mbe(t){return class{digestLength=4;value=0;update(r){this.value=t(r,this.value)}digestSync(){return this.value>>>0}async digest(){let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,this.digestSync(),!1),r}reset(){this.value=0}}}var O8,ml,N8=v(()=>{oz();O8=typeof iz.crc32=="function"?iz.crc32:void 0,ml=O8?mbe(O8):Xp});var Tr,D8,hbe,Sa,z8,gbe,KE=v(()=>{de();Tr=64,D8=32,hbe=2**53-1,Sa=class t{digestLength=D8;state=Int32Array.from(z8);w;buffer=new Uint8Array(64);bufferLength=0;bytesHashed=0;finished=!1;inner;outer;constructor(e){if(e){let r=t.normalizeKey(e);this.inner=new t,this.outer=new t;let{inner:o,outer:n}=this,i=new Uint8Array(Tr*2);for(let s=0;s<Tr;++s)i[s]=54^r[s],i[s+Tr]=92^r[s];o.update(i.subarray(0,Tr)),n.update(i.subarray(Tr))}}update(e){if(this.finished)throw new Error("Attempted to update an already finished HMAC.");if(this.inner){this.inner.update(e);return}let r=hn(e),o=0,{byteLength:n}=r;if(this.bytesHashed+=n,this.bytesHashed*8>hbe)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=r[o++],n--,this.bufferLength===Tr&&(this.hashBuffer(),this.bufferLength=0)}async digest(){let{inner:e,outer:r}=this;if(e&&r){if(this.finished)throw new Error("Attempted to digest an already finished HMAC.");this.finished=!0;let o=e.digestSync();return r.update(o),r.digestSync()}return this.digestSync()}reset(){this.state=Int32Array.from(z8),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0}digestSync(){let e=this.state.slice(),r=this.buffer.slice(),o=this.bufferLength,n=this.bytesHashed*8,i=new DataView(r.buffer,r.byteOffset,r.byteLength);if(i.setUint8(o++,128),(o-1)%Tr>=Tr-8){for(let a=o;a<Tr;++a)i.setUint8(a,0);this.hashBufferWith(e,r),o=0}for(let a=o;a<Tr-8;++a)i.setUint8(a,0);i.setUint32(Tr-8,Math.floor(n/4294967296),!1),i.setUint32(Tr-4,n,!1),this.hashBufferWith(e,r);let s=new Uint8Array(D8);for(let a=0;a<8;++a)s[a*4]=e[a]>>>24&255,s[a*4+1]=e[a]>>>16&255,s[a*4+2]=e[a]>>>8&255,s[a*4+3]=e[a]>>>0&255;return s}static normalizeKey(e){let r=hn(e);if(r.byteLength>Tr){let o=new t;o.update(r);let n=o.digestSync(),i=new Uint8Array(Tr);return i.set(n),i}if(r.byteLength<Tr){let o=new Uint8Array(Tr);return o.set(r),o}return r}hashBuffer(){this.hashBufferWith(this.state,this.buffer)}hashBufferWith(e,r){let o=this.w??=new Int32Array(64),n=e[0],i=e[1],s=e[2],a=e[3],c=e[4],u=e[5],l=e[6],d=e[7];for(let f=0;f<Tr;++f){if(f<16)o[f]=(r[f*4]&255)<<24|(r[f*4+1]&255)<<16|(r[f*4+2]&255)<<8|r[f*4+3]&255;else{let g=o[f-2],y=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10;g=o[f-15];let w=(g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3;o[f]=(y+o[f-7]|0)+(w+o[f-16]|0)}let p=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&u^~c&l)|0)+(d+(gbe[f]+o[f]|0)|0)|0,m=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&s^i&s)|0;d=l,l=u,u=c,c=a+p|0,a=s,s=i,i=n,n=p+m|0}e[0]+=n,e[1]+=i,e[2]+=s,e[3]+=a,e[4]+=c,e[5]+=u,e[6]+=l,e[7]+=d}},z8=new Int32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),gbe=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298])});import{createHash as j8,createHmac as ybe}from"node:crypto";function wbe(){return class{digestLength=32;secret;hash;isHmac;finished=!1;constructor(e){this.secret=e,this.isHmac=!!e,this.hash=this.createHash()}update(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");this.hash.update(e)}async digest(){let e;return this.isHmac?(this.finished=!0,e=this.hash.digest()):e=this.hash.copy().digest(),new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=this.createHash(),this.finished=!1}createHash(){return this.secret?ybe("sha256",bbe(this.secret)):j8("sha256")}}}function bbe(t){return typeof t=="string"?t:ArrayBuffer.isView(t)?Buffer.from(t.buffer,t.byteOffset,t.byteLength):Buffer.from(t)}var vbe,yi,M8=v(()=>{KE();vbe=(()=>{try{return j8("sha256"),!0}catch{return!1}})(),yi=vbe?wbe():Sa});var _be,Sbe,xbe,qE,Ebe,ZE,U8=v(()=>{de();KE();({digest:_be,sign:Sbe,importKey:xbe}=globalThis?.crypto?.subtle??{}),qE=typeof _be=="function"&&typeof Sbe=="function"&&typeof xbe=="function"?globalThis.crypto.subtle:void 0,Ebe=8*1024*1024,ZE=class{digestLength=32;secret;pending=[];pendingBytes=0;fallback;finished=!1;constructor(e){e&&(this.secret=hn(e))}update(e){if(this.finished)throw new Error("Attempted to update an already finished HMAC.");if(this.fallback){this.fallback.update(e);return}this.pending.push(e.slice()),this.pendingBytes+=e.byteLength,this.pendingBytes>=Ebe&&this.switchToFallback()}async digest(){if(this.fallback)return this.fallback.digest();if(this.secret&&this.finished)throw new Error("Attempted to digest an already finished HMAC.");let e=ms(this.pending);if(qE){if(this.secret){this.finished=!0;let n=await qE.importKey("raw",this.secret,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),i=await qE.sign("HMAC",n,e);return new Uint8Array(i)}let o=await qE.digest("SHA-256",e);return new Uint8Array(o)}let r=new Sa(this.secret);return r.update(e),r.digest()}reset(){this.pending=[],this.pendingBytes=0,this.fallback=void 0,this.finished=!1}switchToFallback(){let e=new Sa(this.secret);for(let r of this.pending)e.update(r);this.fallback=e,this.pending=[],this.pendingBytes=0}}});var L8={};yt(L8,{Crc32:()=>ml,Crc32Js:()=>Xp,Crc32Node:()=>ml,Md5:()=>rz,Md5Js:()=>Gp,Md5Node:()=>rz,Sha256:()=>yi,Sha256Js:()=>Sa,Sha256Node:()=>yi,Sha256WebCrypto:()=>ZE,blobHasher:()=>E8,blobReader:()=>BE,fileStreamHasher:()=>I8,readableStreamHasher:()=>A8});var Ac=v(()=>{k8();$8();T8();ez();R8();oz();N8();KE();M8();U8();X1()});function F8(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var Tc,sz=v(()=>{de();Tc=class t{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let o=7,n=Math.abs(Math.round(e));o>-1&&n>0;o--,n/=256)r[o]=n;return e<0&&F8(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&F8(e),parseInt($o(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var Yp,V8,H8,kbe,Ibe,$be,Abe,Tbe,Pbe,Rbe,Cbe,Obe,az=v(()=>{he();de();sz();Yp=class{toUtf8;fromUtf8;constructor(e,r){this.toUtf8=e,this.fromUtf8=r}format(e){let r=[];for(let i in e){if(!ce(e,i))continue;let s=this.fromUtf8(i);r.push(Uint8Array.from([s.byteLength]),s,this.formatHeaderValue(e[i]))}let o=new Uint8Array(r.reduce((i,s)=>i+s.byteLength,0)),n=0;for(let i of r)o.set(i,n),n+=i.byteLength;return o}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let o=new DataView(new ArrayBuffer(5));return o.setUint8(0,4),o.setInt32(1,e.value,!1),new Uint8Array(o.buffer);case"long":let n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let s=new Uint8Array(i.buffer);return s.set(e.value,3),s;case"string":let a=this.fromUtf8(e.value),c=new DataView(new ArrayBuffer(3+a.byteLength));c.setUint8(0,7),c.setUint16(1,a.byteLength,!1);let u=new Uint8Array(c.buffer);return u.set(a,3),u;case"timestamp":let l=new Uint8Array(9);return l[0]=8,l.set(Tc.fromNumber(e.value.valueOf()).bytes,1),l;case"uuid":if(!Obe.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(rE(e.value.replace(/-/g,"")),1),d}}parse(e){let r={},o=0;for(;o<e.byteLength;){let n=e.getUint8(o++),i=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+o,n));switch(o+=n,e.getUint8(o++)){case 0:r[i]={type:H8,value:!0};break;case 1:r[i]={type:H8,value:!1};break;case 2:r[i]={type:kbe,value:e.getInt8(o++)};break;case 3:r[i]={type:Ibe,value:e.getInt16(o,!1)},o+=2;break;case 4:r[i]={type:$be,value:e.getInt32(o,!1)},o+=4;break;case 5:r[i]={type:Abe,value:new Tc(new Uint8Array(e.buffer,e.byteOffset+o,8))},o+=8;break;case 6:let s=e.getUint16(o,!1);o+=2,r[i]={type:Tbe,value:new Uint8Array(e.buffer,e.byteOffset+o,s)},o+=s;break;case 7:let a=e.getUint16(o,!1);o+=2,r[i]={type:Pbe,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+o,a))},o+=a;break;case 8:r[i]={type:Rbe,value:new Date(new Tc(new Uint8Array(e.buffer,e.byteOffset+o,8)).valueOf())},o+=8;break;case 9:let c=new Uint8Array(e.buffer,e.byteOffset+o,16);o+=16,r[i]={type:Cbe,value:`${$o(c.subarray(0,4))}-${$o(c.subarray(4,6))}-${$o(c.subarray(6,8))}-${$o(c.subarray(8,10))}-${$o(c.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(V8||(V8={}));H8="boolean",kbe="byte",Ibe="short",$be="integer",Abe="long",Tbe="binary",Pbe="string",Rbe="timestamp",Cbe="uuid",Obe=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});function K8({byteLength:t,byteOffset:e,buffer:r}){if(t<Nbe)throw new Error("Provided message too short to accommodate event stream message overhead");let o=new DataView(r,e,t),n=o.getUint32(0,!1);if(t!==n)throw new Error("Reported message length does not match received message length");let i=o.getUint32(B8,!1),s=o.getUint32(Pc,!1),a=o.getUint32(t-hl,!1),c=new ml;if(c.update(new Uint8Array(r,e,Pc)),s!==c.digestSync())throw new Error(`The prelude checksum specified in the message (${s}) does not match the calculated CRC32 checksum (${c.digestSync()})`);if(c.update(new Uint8Array(r,e+Pc,t-(Pc+hl))),a!==c.digestSync())throw new Error(`The message checksum (${c.digestSync()}) did not match the expected value of ${a}`);return{headers:new DataView(r,e+Pc+hl,i),body:new Uint8Array(r,e+Pc+hl+i,n-i-(Pc+hl+hl))}}var B8,Pc,hl,Nbe,q8=v(()=>{Ac();B8=4,Pc=B8*2,hl=4,Nbe=Pc+hl*2});var Qp,cz=v(()=>{Ac();az();q8();Qp=class{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,r){this.headerMarshaller=new Yp(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){let o=this.headerMarshaller.format(e),n=o.byteLength+r.byteLength+16,i=new Uint8Array(n),s=new DataView(i.buffer,i.byteOffset,i.byteLength),a=new ml;return s.setUint32(0,n,!1),s.setUint32(4,o.byteLength,!1),a.update(i.subarray(0,8)),s.setUint32(8,a.digestSync(),!1),i.set(o,12),i.set(r,o.byteLength+12),a.update(i.subarray(8,n-4)),s.setUint32(n-4,a.digestSync(),!1),i}decode(e){let{headers:r,body:o}=K8(e);return{headers:this.headerMarshaller.parse(r),body:o}}formatHeaders(e){return this.headerMarshaller.format(e)}}});var ef,uz=v(()=>{ef=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}}});var tf,lz=v(()=>{tf=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}}});var rf,dz=v(()=>{rf=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let r=await this.options.deserializer(e);r!==void 0&&(yield r)}}}});var nf,pz=v(()=>{nf=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}}});function WE(t){let e=0,r=0,o=null,n=null,i=a=>{if(typeof a!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+a);e=a,r=4,o=new Uint8Array(a),new DataView(o.buffer).setUint32(0,a,!1)},s=async function*(){let a=t[Symbol.asyncIterator]();for(;;){let{value:c,done:u}=await a.next();if(u){if(e)if(e===r)yield o;else throw new Error("Truncated event message received.");else return;return}let l=c.length,d=0;for(;d<l;){if(!o){let p=l-d;n||(n=new Uint8Array(4));let m=Math.min(4-r,p);if(n.set(c.slice(d,d+m),r),r+=m,d+=m,r<4)break;i(new DataView(n.buffer).getUint32(0,!1)),n=null}let f=Math.min(e-r,l-d);o.set(c.slice(d,d+f),r),r+=f,d+=f,e&&e===r&&(yield o,o=null,e=0,r=0)}}};return{[Symbol.asyncIterator]:s}}var fz=v(()=>{});function Z8(t,e){let r=dy(e.deserializer,e.toUtf8);return{[Symbol.asyncIterator]:async function*(){for await(let o of t){let n=e.eventStreamCodec.decode(o),i=await r(n);i!==void 0&&(yield i)}}}}function dy(t,e){return async function(r){let{value:o}=r.headers[":message-type"];if(o==="error"){let n=new Error(r.headers[":error-message"].value||"UnknownError");throw n.name=r.headers[":error-code"].value,n}else if(o==="exception"){let n=r.headers[":exception-type"].value,i={[n]:r},s=await t(i);if(s.$unknown){let a=new Error(e(r.body));throw a.name=n,a}throw s[n]}else if(o==="event"){let n={[r.headers[":event-type"].value]:r},i=await t(n);return i.$unknown?void 0:i}else throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}var mz=v(()=>{});var gl,W8,hz=v(()=>{cz();uz();lz();dz();pz();fz();mz();gl=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:r}){this.eventStreamCodec=new Qp(e,r),this.utfEncoder=e}deserialize(e,r){let o=WE(e);return new rf({messageStream:new ef({inputStream:o,decoder:this.eventStreamCodec}),deserializer:dy(r,this.utfEncoder)})}serialize(e,r){return new tf({messageStream:new nf({inputStream:e,serializer:r}),encoder:this.eventStreamCodec,includeEndFrame:!0})}},W8=t=>new gl(t)});import{Readable as Dbe}from"node:stream";async function*zbe(t){let e=!1,r=!1,o=new Array;for(t.on("error",n=>{if(e||(e=!0),n)throw n}),t.on("data",n=>{o.push(n)}),t.on("end",()=>{e=!0});!r;){let n=await new Promise(i=>setTimeout(()=>i(o.shift()),0));n&&(yield n),r=e&&o.length===0}}var py,J8,G8=v(()=>{hz();py=class{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:r}){this.universalMarshaller=new gl({utf8Decoder:r,utf8Encoder:e})}deserialize(e,r){let o=typeof e[Symbol.asyncIterator]=="function"?e:zbe(e);return this.universalMarshaller.deserialize(o,r)}serialize(e,r){return Dbe.from(this.universalMarshaller.serialize(e,r))}},J8=t=>new py(t)});var X8,Y8,Q8=v(()=>{X8=t=>({[Symbol.asyncIterator]:async function*(){let e=t.getReader();try{for(;;){let{done:r,value:o}=await e.read();if(r)return;yield o}}finally{e.releaseLock()}}}),Y8=t=>{let e=t[Symbol.asyncIterator]();return new ReadableStream({async pull(r){let{done:o,value:n}=await e.next();if(o)return r.close();r.enqueue(n)}})}});var eJ,tJ=v(()=>{eJ=t=>Object.assign(t,{eventStreamMarshaller:t.eventStreamSerdeProvider(t)})});var JE,rJ=v(()=>{he();De();de();JE=class{marshaller;serializer;deserializer;serdeContext;defaultContentType;compositeErrorRegistry;constructor({marshaller:e,serializer:r,deserializer:o,serdeContext:n,defaultContentType:i,compositeErrorRegistry:s}){this.marshaller=e,this.serializer=r,this.deserializer=o,this.serdeContext=n,this.defaultContentType=i,this.compositeErrorRegistry=s}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o,initialMessageType:n}){let i=this.marshaller,s=r.getEventStreamMember(),a=r.getMemberSchema(s),c=this.serializer,u=this.defaultContentType,l=Symbol("initialRequestMarker"),d={async*[Symbol.asyncIterator](){if(o){let f={":event-type":{type:"string",value:n??"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:u}};c.write(r,o);let p=c.flush();yield{[l]:!0,headers:f,body:p}}for await(let f of e)yield f}};return i.serialize(d,f=>{if(f[l])return{headers:f.headers,body:f.body};let p="";for(let _ in f)if(ce(f,_)&&_!=="__type"){p=_;break}let{additionalHeaders:m,body:g,eventType:y,explicitPayloadContentType:w}=this.writeEventBody(p,a,f);return{headers:{":event-type":{type:"string",value:y},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:w??u},...m},body:g}})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o,initialMessageType:n}){let i=this.marshaller,s=r.getEventStreamMember(),c=r.getMemberSchema(s).getMemberSchemas(),u=Symbol("initialResponseMarker"),l=i.deserialize(e.body,async p=>{let m="";for(let y in p)if(ce(p,y)&&y!=="__type"){m=y;break}let g=p[m].body;if(m===(n??"initial-response")){let y=await this.deserializer.read(r,g);return delete y[s],{[u]:!0,...y}}else if(m in c){let y=c[m];if(y.isStructSchema()){let w={},b=!1;for(let[_,k]of y.structIterator()){let{eventHeader:$,eventPayload:D}=k.getMergedTraits();if(b=b||!!($||D),D)k.isBlobSchema()?w[_]=g:k.isStringSchema()?w[_]=(this.serdeContext?.utf8Encoder??Dt)(g):k.isStructSchema()&&(w[_]=await this.deserializer.read(k,g));else if($){let K=p[m].headers[_]?.value;K!=null&&(k.isNumericSchema()?K&&typeof K=="object"&&"bytes"in K?w[_]=BigInt(K.toString()):w[_]=Number(K):w[_]=K)}}return{[m]:await this.readEventMember(y,g,b,w)}}return{[m]:await this.deserializer.read(y,g)}}else return{$unknown:p}}),d=l[Symbol.asyncIterator](),f=await d.next();if(f.done)return l;if(f.value?.[u]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let p in f.value)ce(f.value,p)&&(o[p]=f.value[p])}return{async*[Symbol.asyncIterator](){for(f?.value?.[u]||(yield f.value);;){let{done:p,value:m}=await d.next();if(p)break;yield m}}}}async readEventMember(e,r,o,n){let i,s=e.getSchema();if(Array.isArray(s)&&s[0]===-3){let c=s[1],u=bt.for(c);this.compositeErrorRegistry?.copyFrom(u),i=(this.compositeErrorRegistry??u)?.getErrorCtor(s)}let a=o?n:r.byteLength===0?{}:await this.deserializer.read(e,r);if(i){let c=a.message??a.Message??"Unknown",u={},l=e.getMergedTraits().error;return l&&(u.$fault=l),Object.assign(new i({}),u,{message:c},a)}return a}writeEventBody(e,r,o){let n=this.serializer,i=e,s=null,a,c=r.getSchema()[4].includes(e),u={};if(c){let f=r.getMemberSchema(e);if(f.isStructSchema()){for(let[p,m]of f.structIterator()){let{eventHeader:g,eventPayload:y}=m.getMergedTraits();if(y)s=p;else if(g){let w=o[e][p],b="binary";m.isNumericSchema()?(-2)**31<=w&&w<=2**31-1?b="integer":b="long":m.isTimestampSchema()?b="timestamp":m.isStringSchema()?b="string":m.isBooleanSchema()&&(b="boolean"),w!=null&&(u[p]={type:b,value:w},delete o[e][p])}}if(s!==null){let p=f.getMemberSchema(s);p.isBlobSchema()?a="application/octet-stream":p.isStringSchema()&&(a="text/plain"),n.write(p,o[e][s])}else n.write(f,o[e])}else if(f.isUnitSchema())n.write(f,{});else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else{let[f,p]=o[e];i=f,n.write(15,p)}let l=n.flush()??new Uint8Array;return{body:typeof l=="string"?(this.serdeContext?.utf8Decoder??or)(l):l,eventType:i,explicitPayloadContentType:a,additionalHeaders:u}}}});var nJ={};yt(nJ,{EventStreamCodec:()=>Qp,EventStreamMarshaller:()=>py,EventStreamSerde:()=>JE,HeaderMarshaller:()=>Yp,Int64:()=>Tc,MessageDecoderStream:()=>ef,MessageEncoderStream:()=>tf,SmithyMessageDecoderStream:()=>rf,SmithyMessageEncoderStream:()=>nf,UniversalEventStreamMarshaller:()=>gl,eventStreamSerdeProvider:()=>J8,getChunkedStream:()=>WE,getMessageUnmarshaller:()=>dy,getUnmarshalledStream:()=>Z8,iterableToReadableStream:()=>Y8,readableStreamToIterable:()=>X8,resolveEventStreamSerdeConfig:()=>eJ,universalEventStreamSerdeProvider:()=>W8});var oJ=v(()=>{cz();az();sz();uz();lz();dz();pz();G8();Q8();hz();fz();mz();tJ();rJ()});var Rc,GE=v(()=>{he();De();he();Wp();Rc=class extends dr{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=new bt(e.defaultNamespace);for(let r of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(r)}getRequestType(){return Ce}getResponseType(){return ur}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,r){if("url"in r){e.protocol=r.url.protocol,e.hostname=r.url.hostname,e.port=r.url.port?Number(r.url.port):void 0,e.path=r.url.pathname,e.fragment=r.url.hash||void 0,e.username=r.url.username||void 0,e.password=r.url.password||void 0,e.query||(e.query={});for(let[o,n]of r.url.searchParams.entries())e.query[o]=n;if(r.headers)for(let o in r.headers)ce(r.headers,o)&&(e.headers[o]=r.headers[o].join(", "));return e}else{if(e.protocol=r.protocol,e.hostname=r.hostname,e.port=r.port?Number(r.port):void 0,e.path=r.path,e.query={...r.query},r.headers)for(let o in r.headers)ce(r.headers,o)&&(e.headers[o]=r.headers[o]);return e}}setHostPrefix(e,r,o){if(this.serdeContext?.disableHostPrefix)return;let n=L.of(r.input),i=pi(r.traits??{});if(i.endpoint){let s=i.endpoint?.[0];if(typeof s=="string"){for(let[a,c]of n.structIterator()){if(!c.getMergedTraits().hostLabel)continue;let u=o[a];if(typeof u!="string")throw new Error(`@smithy/core/schema - ${a} in input must be a string as hostLabel.`);s=s.replace(`{${a}}`,u)}if(e.hostname=s+e.hostname,!Ug(e.hostname))throw new Error(`[${e.hostname}] is not a valid hostname.`)}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}resolveError(e,r,o){let n=[-3,"","Error",0,[],[],0],i;for(let s of o)for(let a of r)try{a==="*"?i=s.getSchema(e):i=s.getSchema(a+"#"+e);let c=s.getErrorCtor(i);if(c)return[i,c,"modeled"];{let u=s.getBaseException();if(u){let l=s.getErrorCtor(u);if(l)return[i,l,"synthetic"]}}}catch{}for(let s of o){let a=s.getBaseException();if(a){let c=s.getErrorCtor(a);if(c)return[a,c,"synthetic"]}}return[n,Error,"native"]}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o})}async loadEventStreamCapability(){let{EventStreamSerde:e,eventStreamSerdeProvider:r}=await Promise.resolve().then(()=>(oJ(),nJ)),o=this.resolveEventStreamMarshaller(r);return new e({marshaller:o,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType(),compositeErrorRegistry:this.compositeErrorRegistry})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,r,o,n,i){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}resolveEventStreamMarshaller(e){let r=this.serdeContext;return r.eventStreamMarshaller?r.eventStreamMarshaller:e(this.serdeContext)}}});var Cc,iJ=v(()=>{he();De();de();he();GE();VE();HE();Cc=class extends Rc{async serializeRequest(e,r,o){let n=r&&typeof r=="object"?r:{},i=this.serializer,s={},a={},c=await o.endpoint(),u=L.of(e?.input),l=[],d=[],f=!1,p,m=new Ce({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:s,headers:a,body:void 0});if(c){this.updateServiceEndpoint(m,c),this.setHostPrefix(m,e,n);let g=pi(e.traits);if(g.http){m.method=g.http[0];let[y,w]=g.http[1].split("?");m.path=="/"?m.path=y:m.path+=y;let b=new URLSearchParams(w??"");for(let[_,k]of b)s[_]=k}}for(let[g,y]of u.structIterator()){let w=y.getMergedTraits()??{},b=n[g];if(b==null&&!y.isIdempotencyToken()){if(w.httpLabel&&(m.path.includes(`{${g}+}`)||m.path.includes(`{${g}}`)))throw new Error(`No value provided for input HTTP label: ${g}.`);continue}if(w.httpPayload)y.isStreaming()?y.isStructSchema()?n[g]&&(p=await this.serializeEventStream({eventStream:n[g],requestSchema:u})):p=b:(i.write(y,b),p=i.flush());else if(w.httpLabel){i.write(y,b);let _=i.flush();m.path.includes(`{${g}+}`)?m.path=m.path.replace(`{${g}+}`,_.split("/").map(gi).join("/")):m.path.includes(`{${g}}`)&&(m.path=m.path.replace(`{${g}}`,gi(_)))}else if(w.httpHeader)i.write(y,b),a[w.httpHeader.toLowerCase()]=String(i.flush());else if(typeof w.httpPrefixHeaders=="string")for(let _ in b){if(!ce(b,_))continue;let k=b[_],$=w.httpPrefixHeaders+_;i.write([y.getValueSchema(),{httpHeader:$}],k),a[$.toLowerCase()]=i.flush()}else w.httpQuery||w.httpQueryParams?this.serializeQuery(y,b,s):(f=!0,l.push(g),d.push(y))}if(f&&n){let[g,y]=(u.getName(!0)??"#Unknown").split("#"),w=u.getSchema()[6],b=[3,g,y,u.getMergedTraits(),l,d,void 0];w?b[6]=w:b.pop(),i.write(b,n),p=i.flush()}return m.headers=a,m.query=s,m.body=p,m}serializeQuery(e,r,o){let n=this.serializer,i=e.getMergedTraits();if(i.httpQueryParams){for(let s in r)if(ce(r,s)&&!(s in o)){let a=r[s],c=e.getValueSchema();Object.assign(c.getMergedTraits(),{...i,httpQuery:s,httpQueryParams:void 0}),this.serializeQuery(c,a,o)}return}if(e.isListSchema()){let s=!!e.getMergedTraits().sparse,a=[];for(let c of r){n.write([e.getValueSchema(),i],c);let u=n.flush();(s||u!==void 0)&&a.push(u)}o[i.httpQuery]=a}else n.write([e,i],r),o[i.httpQuery]=n.flush()}async deserializeResponse(e,r,o){let n=this.deserializer,i=L.of(e.output),s={};if(o.statusCode>=300){let c=await Ar(o.body,r);throw c.byteLength>0&&Object.assign(s,await n.read(15,c)),await this.handleError(e,r,o,s,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let c in o.headers){if(!ce(o.headers,c))continue;let u=o.headers[c];delete o.headers[c],o.headers[c.toLowerCase()]=u}let a=await this.deserializeHttpMessage(i,r,o,s);if(a.length){let c=await Ar(o.body,r);if(c.byteLength>0){let u=await n.read(i,c);for(let l of a)u[l]!=null&&(s[l]=u[l])}}else a.discardResponseBody&&await Ar(o.body,r);return s.$metadata=this.deserializeMetadata(o),s}async deserializeHttpMessage(e,r,o,n,i){let s;n instanceof Set?s=i:s=n;let a=!0,c=this.deserializer,u=L.of(e),l=[];for(let[d,f]of u.structIterator()){let p=f.getMemberTraits();if(p.httpPayload){if(a=!1,f.isStreaming())f.isStructSchema()?s[d]=await this.deserializeEventStream({response:o,responseSchema:u}):s[d]=FE(o.body);else if(o.body){let g=await Ar(o.body,r);g.byteLength>0&&(s[d]=await c.read(f,g))}}else if(p.httpHeader){let m=String(p.httpHeader).toLowerCase(),g=o.headers[m];if(g!=null)if(f.isListSchema()){let y=f.getValueSchema();y.getMergedTraits().httpHeader=m;let w;y.isTimestampSchema()&&y.getSchema()===4?w=eE(g,",",2):w=jp(g);let b=[];for(let _ of w)b.push(await c.read(y,_.trim()));s[d]=b}else s[d]=await c.read(f,g)}else if(p.httpPrefixHeaders!==void 0){s[d]={};for(let m in o.headers)if(ce(o.headers,m)&&m.startsWith(p.httpPrefixHeaders)){let g=o.headers[m],y=f.getValueSchema();y.getMergedTraits().httpHeader=m,s[d][m.slice(p.httpPrefixHeaders.length)]=await c.read(y,g)}}else p.httpResponseCode?s[d]=o.statusCode:l.push(d)}return l.discardResponseBody=a,l}}});var Ss,sJ=v(()=>{he();De();he();GE();VE();Ss=class extends Rc{async serializeRequest(e,r,o){let n=this.serializer,i={},s={},a=await o.endpoint(),c=L.of(e?.input),u=c.getSchema(),l,d=r&&typeof r=="object"?r:{},f=new Ce({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:i,headers:s,body:void 0});if(a&&(this.updateServiceEndpoint(f,a),this.setHostPrefix(f,e,d)),d){let p=c.getEventStreamMember();if(p){if(d[p]){let m={};for(let[g]of c.structIterator())g!==p&&d[g]!=null&&(m[g]=d[g]);l=await this.serializeEventStream({eventStream:d[p],requestSchema:c,initialRequest:m})}}else n.write(u,d),l=n.flush()}return f.headers=Object.assign(f.headers,s),f.query=i,f.body=l,f.method="POST",f}async deserializeResponse(e,r,o){let n=this.deserializer,i=L.of(e.output),s={};if(o.statusCode>=300){let c=await Ar(o.body,r);throw c.byteLength>0&&Object.assign(s,await n.read(15,c)),await this.handleError(e,r,o,s,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let c in o.headers){if(!ce(o.headers,c))continue;let u=o.headers[c];delete o.headers[c],o.headers[c.toLowerCase()]=u}let a=i.getEventStreamMember();if(a)s[a]=await this.deserializeEventStream({response:o,responseSchema:i,initialResponseContainer:s});else{let c=await Ar(o.body,r);c.byteLength>0&&Object.assign(s,await n.read(i,c))}return s.$metadata=this.deserializeMetadata(o),s}}});var XE,gz=v(()=>{HE();XE=(t,e,r,o,n,i)=>{if(e!=null&&e[r]!==void 0){let s=o();if(s==null||s.length<=0)throw new Error("Empty value provided for input HTTP label: "+r+".");t=t.replace(n,i?s.split("/").map(a=>gi(a)).join("/"):gi(s))}else throw new Error("No value provided for input HTTP label: "+r+".");return t}});function YE(t,e){return new fy(t,e)}var fy,aJ=v(()=>{he();gz();fy=class{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(e,r){this.input=e,this.context=r}async build(){let{hostname:e,protocol:r="https",port:o,path:n}=await this.context.endpoint();this.path=n;for(let i of this.resolvePathStack)i(this.path);return new Ce({protocol:r,hostname:this.hostname||e,port:o,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push(r=>{this.path=`${r?.endsWith("/")?r.slice(0,-1):r||""}`+e}),this}p(e,r,o,n){return this.resolvePathStack.push(i=>{this.path=XE(i,this.input,e,r,o,n)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}}});function pr(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();let{httpLabel:r,httpPrefixHeaders:o,httpHeader:n,httpQuery:i}=t.getMergedTraits();return(e.httpBindings?typeof o=="string"||n?6:i||r?5:void 0:void 0)??e.timestampFormat.default}var QE=v(()=>{});var Oc,yz=v(()=>{De();de();Wp();QE();Oc=class extends dr{settings;constructor(e){super(),this.settings=e}read(e,r){let o=L.of(e);if(o.isListSchema())return jp(r).map(n=>this.read(o.getValueSchema(),n));if(o.isBlobSchema())return(this.serdeContext?.base64Decoder??Mt)(r);if(o.isTimestampSchema())switch(pr(o,this.settings)){case 5:return Y0(r);case 6:return Q0(r);case 7:return Ec(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(o.isStringSchema()){let n=o.getMergedTraits().mediaType,i=r;if(n)return o.getMergedTraits().httpHeader&&(i=this.base64ToUtf8(i)),(n==="application/json"||n.endsWith("+json"))&&(i=Zt.from(i)),i}return o.isNumericSchema()?Number(r):o.isBigIntegerSchema()?BigInt(r):o.isBigDecimalSchema()?new Ne(r,"bigDecimal"):o.isBooleanSchema()?String(r).toLowerCase()==="true":r}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??Dt)((this.serdeContext?.base64Decoder??Mt)(e))}}});var Nc,cJ=v(()=>{De();de();Wp();yz();Nc=class extends dr{codecDeserializer;stringDeserializer;constructor(e,r){super(),this.codecDeserializer=e,this.stringDeserializer=new Oc(r)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,r){let o=L.of(e),n=o.getMergedTraits(),i=this.serdeContext?.utf8Encoder??Dt;if(n.httpHeader||n.httpResponseCode)return this.stringDeserializer.read(o,i(r));if(n.httpPayload){if(o.isBlobSchema()){let s=this.serdeContext?.utf8Decoder??or;return typeof r=="string"?s(r):r}else if(o.isStringSchema())return"byteLength"in r?i(r):r}return this.codecDeserializer.read(o,r)}}});var of,vz=v(()=>{De();de();Wp();QE();of=class extends dr{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,r){let o=L.of(e);switch(typeof r){case"object":if(r===null){this.stringBuffer="null";return}if(o.isTimestampSchema()){if(!(r instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${r} when schema expected Date in ${o.getName(!0)}`);switch(pr(o,this.settings)){case 5:this.stringBuffer=r.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=Qn(r);break;case 7:this.stringBuffer=String(r.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",r),this.stringBuffer=String(r.getTime()/1e3)}return}if(o.isBlobSchema()&&"byteLength"in r){this.stringBuffer=(this.serdeContext?.base64Encoder??_t)(r);return}if(o.isListSchema()&&Array.isArray(r)){let s="";for(let a of r){this.write([o.getValueSchema(),o.getMergedTraits()],a);let c=this.flush(),u=o.getValueSchema().isTimestampSchema()?c:X0(c);s!==""&&(s+=", "),s+=u}this.stringBuffer=s;return}this.stringBuffer=JSON.stringify(r,null,2);break;case"string":let n=o.getMergedTraits().mediaType,i=r;if(n&&((n==="application/json"||n.endsWith("+json"))&&(i=Zt.from(i)),o.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??_t)(i.toString());return}this.stringBuffer=r;break;default:o.isIdempotencyToken()?this.stringBuffer=oo():this.stringBuffer=String(r)}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}}});var Dc,uJ=v(()=>{De();vz();Dc=class{codecSerializer;stringSerializer;buffer;constructor(e,r,o=new of(r)){this.codecSerializer=e,this.stringSerializer=o}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,r){let o=L.of(e),n=o.getMergedTraits();if(n.httpHeader||n.httpLabel||n.httpQuery){this.stringSerializer.write(o,r),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(o,r)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}});var lJ,ek,dJ=v(()=>{lJ=St(is()),ek=class{name;kind;values;constructor({name:e,kind:r=lJ.FieldPosition.HEADER,values:o=[]}){this.name=e,this.kind=r,this.values=o}add(e){this.values.push(e)}set(e){this.values=e}remove(e){this.values=this.values.filter(r=>r!==e)}toString(){return this.values.map(e=>e.includes(",")||e.includes(" ")?`"${e}"`:e).join(", ")}get(){return this.values}}});var tk,pJ=v(()=>{tk=class{entries={};encoding;constructor({fields:e=[],encoding:r="utf-8"}){e.forEach(this.setField.bind(this)),this.encoding=r}setField(e){this.entries[e.name.toLowerCase()]=e}getField(e){return this.entries[e.toLowerCase()]}removeField(e){delete this.entries[e.toLowerCase()]}getByType(e){return Object.values(this.entries).filter(r=>r.kind===e)}}});var xs,Es,fJ=v(()=>{xs=t=>(t.logger&&t.logger.constructor?.name!=="NoOpLogger"&&t.requestHandler?.updateHttpClientConfig?.(Symbol.for("logger"),t.logger),{setHttpHandler(e){t.requestHandler=e},httpHandler(){return t.requestHandler},updateHttpClientConfig(e,r){t.requestHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.requestHandler.httpHandlerConfigs()}}),Es=t=>({requestHandler:t.httpHandler()})});function wz(t){return e=>async r=>{let o=r.request;if(Ce.isInstance(o)){let{body:n,headers:i}=o;if(n&&Object.keys(i).map(s=>s.toLowerCase()).indexOf(mJ)===-1)try{let s=t(n);s!=null&&(o.headers={...o.headers,[mJ]:String(s)})}catch{}}return e({...r,request:o})}}var mJ,bz,ks,hJ=v(()=>{he();mJ="content-length";bz={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},ks=t=>({applyToStack:e=>{e.add(wz(t.bodyLengthChecker),bz)}})});var zc,jbe,rk=v(()=>{zc=t=>encodeURIComponent(t).replace(/[!'()*]/g,jbe),jbe=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var gJ,yJ=v(()=>{rk();gJ=t=>t.split("/").map(zc).join("/")});function vJ(t){let e=[];for(let r of Object.keys(t).sort()){let o=t[r];if(r=zc(r),Array.isArray(o))for(let n=0,i=o.length;n<i;n++)e.push(`${r}=${zc(o[n])}`);else{let n=r;(o||typeof o=="string")&&(n+=`=${zc(o)}`),e.push(n)}}return e.join("&")}var wJ=v(()=>{rk()});var yl={};yt(yl,{Field:()=>ek,Fields:()=>tk,FromStringShapeDeserializer:()=>Oc,HttpBindingProtocol:()=>Cc,HttpInterceptingShapeDeserializer:()=>Nc,HttpInterceptingShapeSerializer:()=>Dc,HttpProtocol:()=>Rc,HttpRequest:()=>Ce,HttpResponse:()=>ur,RequestBuilder:()=>fy,RpcProtocol:()=>Ss,SerdeContext:()=>dr,ToStringShapeSerializer:()=>of,buildQueryString:()=>vJ,collectBody:()=>Ar,contentLengthMiddleware:()=>wz,contentLengthMiddlewareOptions:()=>bz,determineTimestampFormat:()=>pr,escapeUri:()=>zc,escapeUriPath:()=>gJ,extendedEncodeURIComponent:()=>gi,getContentLengthPlugin:()=>ks,getHttpHandlerExtensionConfiguration:()=>xs,isValidHostname:()=>Ug,parseQueryString:()=>Lg,parseUrl:()=>Ir,requestBuilder:()=>YE,resolveHttpHandlerRuntimeConfig:()=>Es,resolvedPath:()=>XE});var re=v(()=>{VE();HE();iJ();GE();sJ();aJ();gz();yz();cJ();uJ();vz();QE();Wp();dJ();pJ();he();he();he();fJ();hJ();rk();yJ();wJ();he();he()});var bJ,_J,SJ,xJ,EJ,kJ,IJ=v(()=>{bJ=["AccessDeniedException","AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],_J=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],SJ=["TimeoutError","RequestTimeout","RequestTimeoutException"],xJ=[500,502,503,504],EJ=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],kJ=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND","EAI_AGAIN"]});function xz(t){return t.code==="ERR_HTTP2_STREAM_ERROR"&&t.message.includes("NGHTTP2_REFUSED_STREAM")}var my,nk,_z,Sz,Is,jc,ok,sf=v(()=>{IJ();my=t=>t?.$retryable!==void 0,nk=t=>bJ.includes(t.name),_z=t=>t.$metadata?.clockSkewCorrected,Sz=t=>{let e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return t&&t instanceof TypeError?e.has(t.message):!1},Is=t=>t.$metadata?.httpStatusCode===429||_J.includes(t.name)||t.$retryable?.throttling==!0,jc=(t,e=0)=>t?.name!=="AbortError"&&(my(t)||_z(t)||t.name==="InvalidSignatureException"&&t.message?.includes("Signature expired")||SJ.includes(t.name)||EJ.includes(t?.code||"")||kJ.includes(t?.code||"")||xJ.includes(t.$metadata?.httpStatusCode||0)||Sz(t)||xz(t)||t.cause!==void 0&&e<=10&&jc(t.cause,e+1)),ok=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!jc(t)}return!1}});var ik,hy,sk,af,Ez,kz,ak,Mc,Uc,gy=v(()=>{ik=100,hy=2e4,sk=500,af=500,Ez=5,kz=10,ak=1,Mc="amz-sdk-invocation-id",Uc="amz-sdk-request"});function Iz(t,e){if(ur.isInstance(t))for(let r in t.headers){if(!ce(t.headers,r))continue;let o=r.toLowerCase();if(o==="retry-after"){let n=t.headers[r],i=NaN;if(n.endsWith("GMT"))try{i=(xc(n).getTime()-Date.now())/1e3}catch(s){e?.trace?.("Failed to parse retry-after header"),e?.trace?.(s)}else n.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?i=Number(n.match(/ GMT, ([\d.]+)$/)?.[1]):n.match(/^((\d+)|(\d+\.\d+))$/)?i=Number(n):Date.parse(n)>=Date.now()&&(i=(Date.parse(n)-Date.now())/1e3);return isNaN(i)?void 0:new Date(Date.now()+i*1e3)}else if(o==="x-amz-retry-after"){let n=t.headers[r],i=Number(n);if(isNaN(i)){e?.trace?.(`Failed to parse x-amz-retry-after=${n}`);return}return new Date(Date.now()+i)}}}function $J(t,e){return Iz(t,e)}var $z=v(()=>{he();re();de()});var ck,Az=v(()=>{ck=t=>t instanceof Error?t:t instanceof Object?Object.assign(new Error,t):typeof t=="string"?new Error(t):new Error(`AWS SDK error wrapper for ${t}`)});function Tz(t){return e=>(r,o)=>async n=>{let i=await e.retryStrategy(),s=await e.maxAttempts();if(Ube(i)){i=i;let a=await i.acquireInitialRetryToken((o.partition_id??"")+(o.__retryLongPoll?":longpoll":"")),c=new Error,u=0,l=0,{request:d}=n,f=Ce.isInstance(d);for(f&&(d.headers[Mc]=qp());;)try{f&&(d.headers[Uc]=`attempt=${u+1}; max=${s}`);let{response:p,output:m}=await r(n);return i.recordSuccess(a),m.$metadata.attempts=u+1,m.$metadata.totalRetryDelay=l,{response:p,output:m}}catch(p){let m=Lbe(p,e.logger);if(c=ck(p),f&&t(d))throw(o.logger instanceof Cn?console:o.logger)?.warn("An error was encountered in a non-retryable streaming request."),c;try{a=await i.refreshRetryTokenForRetry(a,m)}catch{throw c.$metadata||(c.$metadata={}),c.$metadata.attempts=u+1,c.$metadata.totalRetryDelay=l,c}u=a.getRetryCount();let g=a.getRetryDelay();l+=(a?.$retryLog?.acquisitionDelay??0)+g,g>0&&await Mbe(g)}}else return i=i,i?.mode&&(o.userAgent=[...o.userAgent||[],["cfg/retry-mode",i.mode]]),i.retry(r,n)}}function AJ(t){let e=Tz(t);return r=>({applyToStack:o=>{o.add(e(r),Pz)}})}var Mbe,Ube,Lbe,Fbe,Pz,Rz=v(()=>{le();re();de();sf();gy();$z();Az();Mbe=t=>new Promise(e=>setTimeout(e,t)),Ube=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",Lbe=(t,e)=>{let r={error:t,errorType:Fbe(t)},o=Iz(t.$response,e);return o&&(r.retryAfterHint=o),r},Fbe=t=>Is(t)?"THROTTLING":jc(t)?"TRANSIENT":ok(t)?"SERVER_ERROR":"CLIENT_ERROR",Pz={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0}});var Lc,uk=v(()=>{sf();Lc=class t{static setTimeoutFn=(e,r)=>setTimeout(e,r);beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=!1;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let r;this.updateMeasuredRate();let o=e;if(o?.errorType==="THROTTLING"||Is(o?.error??e)){let s=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=s,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(s),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());let i=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(i)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(e){if(this.enabled){for(this.refillTokenBucket();e>this.availableTokens;){let r=(e-this.availableTokens)/this.fillRate*1e3;await new Promise(o=>t.setTimeoutFn(o,r)),this.refillTokenBucket()}this.availableTokens=this.availableTokens-e}}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let r=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+r),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){let e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){let o=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(o*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}}});var Ht,cf=v(()=>{Ht=class t{static v2026=typeof process<"u"&&process.env?.SMITHY_NEW_RETRIES_2026==="true";static delay(){return t.v2026?50:100}static throttlingDelay(){return t.v2026?1e3:500}static cost(){return t.v2026?14:5}static throttlingCost(){return t.v2026?5:10}static modifiedCostType(){return t.v2026?"THROTTLING":"TRANSIENT"}}});var lk,TJ=v(()=>{cf();lk=class{x=Ht.delay();computeNextBackoffDelay(e){let n=Math.random()*Math.min(this.x*2**e,2e4);return Math.floor(n)}setDelayBase(e){this.x=e}}});var yy,PJ=v(()=>{yy=class{delay;count;cost;longPoll;$retryLog={acquisitionDelay:0};constructor(e,r,o,n){this.delay=e,this.count=r,this.cost=o,this.longPoll=n}getRetryCount(){return this.count}getRetryDelay(){return Math.min(2e4,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}});var fr,vi,Ro,vl=v(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(fr||(fr={}));vi=3,Ro=fr.STANDARD});var dk,wi,vy=v(()=>{TJ();PJ();vl();cf();dk={incompatible:1,attempts:2,capacity:3},wi=class{mode=fr.STANDARD;retryBackoffStrategy;capacity=500;maxAttemptsProvider;baseDelay;constructor(e){typeof e=="number"?this.maxAttemptsProvider=async()=>e:typeof e=="function"?this.maxAttemptsProvider=e:e&&typeof e=="object"&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),this.maxAttemptsProvider??=async()=>vi,this.baseDelay??=Ht.delay(),this.retryBackoffStrategy??=new lk}async acquireInitialRetryToken(e){return new yy(Ht.delay(),0,void 0,Ht.v2026&&e.includes(":longpoll"))}async refreshRetryTokenForRetry(e,r){let o=await this.getMaxAttempts(),n=this.retryCode(e,r,o),i=n===0,s=e.isLongPoll?.();if(i||s){let a=r.errorType;this.retryBackoffStrategy.setDelayBase(a==="THROTTLING"?Ht.throttlingDelay():this.baseDelay);let c=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),u=c;if(r.retryAfterHint instanceof Date&&(u=Math.max(c,Math.min(r.retryAfterHint.getTime()-Date.now(),c+5e3))),i){let l=this.getCapacityCost(a);this.capacity-=l;let d=new yy(0,e.getRetryCount()+1,l,e.isLongPoll?.()??!1);return await new Promise(f=>setTimeout(f,u)),d.$retryLog.acquisitionDelay=u,d}else{let l=Ht.v2026&&n===dk.capacity&&s?u:0;l>0&&await new Promise(d=>setTimeout(d,l))}}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.min(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${vi}`),vi}}retryCode(e,r,o){let n=e.getRetryCount()+1,i=this.isRetryableError(r.errorType)?0:dk.incompatible,s=n<o?0:dk.attempts,a=this.capacity>=this.getCapacityCost(r.errorType)?0:dk.capacity;return i||s||a}getCapacityCost(e){return e===Ht.modifiedCostType()?Ht.throttlingCost():Ht.cost()}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}});var uf,Cz=v(()=>{uk();vy();vl();uf=class{mode=fr.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(e,r){let{rateLimiter:o}=r??{};this.rateLimiter=o??new Lc,this.standardRetryStrategy=r?new wi({maxAttempts:typeof e=="number"?e:3,...r}):new wi(e)}async acquireInitialRetryToken(e){let r=await this.standardRetryStrategy.acquireInitialRetryToken(e);return await this.rateLimiter.getSendToken(),r}async refreshRetryTokenForRetry(e,r){this.rateLimiter.updateClientSendingRate(r);let o=await this.standardRetryStrategy.refreshRetryTokenForRetry(e,r);return await this.rateLimiter.getSendToken(),o}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}}});var pk,RJ=v(()=>{vy();cf();pk=class extends wi{computeNextBackoffDelay;constructor(e,r=Ht.delay()){super(typeof e=="function"?e:async()=>e),typeof r=="number"?this.computeNextBackoffDelay=()=>r:this.computeNextBackoffDelay=r,this.retryBackoffStrategy.computeNextBackoffDelay=o=>{let n=o+1;return this.computeNextBackoffDelay(n)}}}});var CJ,OJ=v(()=>{CJ=(t,e)=>{let r=t,o=e?.noRetryIncrement??1,n=e?.retryCost??5,i=e?.timeoutRetryCost??10,s=t,a=d=>d.name==="TimeoutError"?i:n,c=d=>a(d)<=s;return Object.freeze({hasRetryTokens:c,retrieveRetryTokens:d=>{if(!c(d))throw new Error("No retry token available");let f=a(d);return s-=f,f},releaseRetryTokens:d=>{s+=d??o,s=Math.min(s,r)}})}});var fk,Oz=v(()=>{fk=(t,e)=>Math.floor(Math.min(2e4,Math.random()*2**e*t))});var mk,Nz=v(()=>{sf();mk=t=>t?my(t)||nk(t)||Is(t)||jc(t):!1});var lf,Vbe,Dz=v(()=>{re();de();sf();vl();gy();Az();OJ();Oz();Nz();lf=class{maxAttemptsProvider;retryDecider;delayDecider;retryQuota;mode=fr.STANDARD;constructor(e,r){this.maxAttemptsProvider=e,this.retryDecider=r?.retryDecider??mk,this.delayDecider=r?.delayDecider??fk,this.retryQuota=r?.retryQuota??CJ(500)}shouldRetry(e,r,o){return r<o&&this.retryDecider(e)&&this.retryQuota.hasRetryTokens(e)}async getMaxAttempts(){let e;try{e=await this.maxAttemptsProvider()}catch{e=vi}return e}async retry(e,r,o){let n,i=0,s=0,a=await this.getMaxAttempts(),{request:c}=r;for(Ce.isInstance(c)&&(c.headers[Mc]=qp());;)try{Ce.isInstance(c)&&(c.headers[Uc]=`attempt=${i+1}; max=${a}`),o?.beforeRequest&&await o.beforeRequest();let{response:u,output:l}=await e(r);return o?.afterRequest&&o.afterRequest(u),this.retryQuota.releaseRetryTokens(n),l.$metadata.attempts=i+1,l.$metadata.totalRetryDelay=s,{response:u,output:l}}catch(u){let l=ck(u);if(i++,this.shouldRetry(l,i,a)){n=this.retryQuota.retrieveRetryTokens(l);let d=this.delayDecider(Is(l)?500:100,i),f=Vbe(l.$response),p=Math.max(f||0,d);s+=p,await new Promise(m=>setTimeout(m,p));continue}throw l.$metadata||(l.$metadata={}),l.$metadata.attempts=i,l.$metadata.totalRetryDelay=s,l}}},Vbe=t=>{if(!ur.isInstance(t))return;let e=Object.keys(t.headers).find(i=>i.toLowerCase()==="retry-after");if(!e)return;let r=t.headers[e],o=Number(r);if(!Number.isNaN(o))return Math.min(o*1e3,2e4);let n=new Date(r);return Math.min(n.getTime()-Date.now(),2e4)}});var hk,NJ=v(()=>{uk();vl();Dz();hk=class extends lf{rateLimiter;constructor(e,r){let{rateLimiter:o,...n}=r??{};super(e,n),this.rateLimiter=o??new Lc,this.mode=fr.ADAPTIVE}async retry(e,r){return super.retry(e,r,{beforeRequest:async()=>this.rateLimiter.getSendToken(),afterRequest:o=>{this.rateLimiter.updateClientSendingRate(o)}})}}});var gk,yk,$s,As,zz,jz,Ts,DJ=v(()=>{le();Cz();vy();vl();cf();gk="AWS_MAX_ATTEMPTS",yk="max_attempts",$s={environmentVariableSelector:t=>{let e=t[gk];if(!e)return;let r=parseInt(e);if(Number.isNaN(r))throw new Error(`Environment variable ${gk} mast be a number, got "${e}"`);return r},configFileSelector:t=>{let e=t[yk];if(!e)return;let r=parseInt(e);if(Number.isNaN(r))throw new Error(`Shared config file entry ${yk} mast be a number, got "${e}"`);return r},default:vi},As=(t,e)=>{let{retryStrategy:r,retryMode:o}=t,{defaultMaxAttempts:n=vi,defaultBaseDelay:i=Ht.delay()}=e??{},s=lt(t.maxAttempts??n),a=r?Promise.resolve(r):void 0,c=async()=>{let u=await s();return await lt(o)()===fr.ADAPTIVE?new uf(s,{maxAttempts:u,baseDelay:i}):new wi({maxAttempts:u,baseDelay:i})};return Object.assign(t,{maxAttempts:s,retryStrategy:()=>a??=c()})},zz="AWS_RETRY_MODE",jz="retry_mode",Ts={environmentVariableSelector:t=>t[zz],configFileSelector:t=>t[jz],default:Ro}});var Mz,Uz,zJ,jJ=v(()=>{re();gy();Mz=()=>t=>async e=>{let{request:r}=e;return Ce.isInstance(r)&&(delete r.headers[Mc],delete r.headers[Uc]),t(e)},Uz={name:"omitRetryHeadersMiddleware",tags:["RETRY","HEADERS","OMIT_RETRY_HEADERS"],relation:"before",toMiddleware:"awsAuthMiddleware",override:!0},zJ=t=>({applyToStack:e=>{e.addRelativeTo(Mz(),Uz)}})});var MJ={};yt(MJ,{AdaptiveRetryStrategy:()=>uf,CONFIG_MAX_ATTEMPTS:()=>yk,CONFIG_RETRY_MODE:()=>jz,ConfiguredRetryStrategy:()=>pk,DEFAULT_MAX_ATTEMPTS:()=>vi,DEFAULT_RETRY_DELAY_BASE:()=>ik,DEFAULT_RETRY_MODE:()=>Ro,DefaultRateLimiter:()=>Lc,DeprecatedAdaptiveRetryStrategy:()=>hk,DeprecatedStandardRetryStrategy:()=>lf,ENV_MAX_ATTEMPTS:()=>gk,ENV_RETRY_MODE:()=>zz,INITIAL_RETRY_TOKENS:()=>af,INVOCATION_ID_HEADER:()=>Mc,MAXIMUM_RETRY_DELAY:()=>hy,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:()=>$s,NODE_RETRY_MODE_CONFIG_OPTIONS:()=>Ts,NO_RETRY_INCREMENT:()=>ak,REQUEST_HEADER:()=>Uc,RETRY_COST:()=>Ez,RETRY_MODES:()=>fr,Retry:()=>Ht,StandardRetryStrategy:()=>wi,THROTTLING_RETRY_DELAY_BASE:()=>sk,TIMEOUT_RETRY_COST:()=>kz,defaultDelayDecider:()=>fk,defaultRetryDecider:()=>mk,getOmitRetryHeadersPlugin:()=>zJ,getRetryAfterHint:()=>$J,getRetryPlugin:()=>xa,isBrowserNetworkError:()=>Sz,isClockSkewCorrectedError:()=>_z,isClockSkewError:()=>nk,isNodeJsHttp2TransientError:()=>xz,isRetryableByTrait:()=>my,isServerError:()=>ok,isThrottlingError:()=>Is,isTransientError:()=>jc,omitRetryHeadersMiddleware:()=>Mz,omitRetryHeadersMiddlewareOptions:()=>Uz,resolveRetryConfig:()=>As,retryMiddleware:()=>Hbe,retryMiddlewareOptions:()=>Pz});var Hbe,xa,Co=v(()=>{kZ();Rz();sf();Cz();RJ();uk();vy();vl();gy();cf();NJ();Dz();Oz();Nz();DJ();jJ();Rz();$z();Hbe=Tz(GN),xa=AJ(GN)});function Oo(t,e,r){t.__aws_sdk_context?t.__aws_sdk_context.features||(t.__aws_sdk_context.features={}):t.__aws_sdk_context={features:{}},t.__aws_sdk_context.features[e]=r}var Lz=v(()=>{Co();Ht.v2026||=typeof process=="object"&&process.env?.AWS_NEW_RETRIES_2026==="true"});function UJ(t,e,r){return t.$source||(t.$source={}),t.$source[e]=r,t}var LJ=v(()=>{});function df(t){return t}var Fz,Vz,Ps,FJ=v(()=>{re();Fz=t=>e=>async r=>{if(!Ce.isInstance(r.request))return e(r);let{request:o}=r,{handlerProtocol:n=""}=t.requestHandler.metadata||{};if(n.indexOf("h2")>=0&&!o.headers[":authority"])delete o.headers.host,o.headers[":authority"]=o.hostname+(o.port?":"+o.port:"");else if(!o.headers.host){let i=o.hostname;o.port!=null&&(i+=`:${o.port}`),o.headers.host=i}return e(r)},Vz={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},Ps=t=>({applyToStack:e=>{e.add(Fz(t),Vz)}})});var Hz,Bz,Rs,VJ=v(()=>{Hz=()=>(t,e)=>async r=>{try{let o=await t(r),{clientName:n,commandName:i,logger:s,dynamoDbDocumentClientOptions:a={}}=e,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:u}=a,l=c??e.inputFilterSensitiveLog,d=u??e.outputFilterSensitiveLog,{$metadata:f,...p}=o.output;return s?.info?.({clientName:n,commandName:i,input:l(r.input),output:d(p),metadata:f}),o}catch(o){let{clientName:n,commandName:i,logger:s,dynamoDbDocumentClientOptions:a={}}=e,{overrideInputFilterSensitiveLog:c}=a,u=c??e.inputFilterSensitiveLog;throw s?.error?.({clientName:n,commandName:i,input:u(r.input),error:o,metadata:o.$metadata}),o}},Bz={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},Rs=t=>({applyToStack:e=>{e.add(Hz(),Bz)}})});var vk,Kz=v(()=>{vk={step:"build",tags:["RECURSION_DETECTION","TRACE_CONTEXT_PROPAGATION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"}});var Fc,qz,wk,Zz,Wz,wy,HJ=v(()=>{Fc={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID"),TRACEPARENT:Symbol.for("_AWS_LAMBDA_TRACEPARENT"),TRACESTATE:Symbol.for("_AWS_LAMBDA_TRACESTATE"),BAGGAGE:Symbol.for("_AWS_LAMBDA_BAGGAGE")},qz=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");qz||(globalThis.awslambda=globalThis.awslambda||{});wk=class{static PROTECTED_KEYS=Fc;isProtectedKey(e){return Object.values(Fc).includes(e)}getRequestId(){return this.get(Fc.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(Fc.X_RAY_TRACE_ID)}getTenantId(){return this.get(Fc.TENANT_ID)}getTraceparent(){return this.get(Fc.TRACEPARENT)}getTracestate(){return this.get(Fc.TRACESTATE)}getBaggage(){return this.get(Fc.BAGGAGE)}},Zz=class extends wk{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=r}run(e,r){return this.currentContext=e,r()}},Wz=class t extends wk{als;static async create(){let e=new t,r=await import("node:async_hooks");return e.als=new r.AsyncLocalStorage,e}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);let o=this.als.getStore();if(!o)throw new Error("No context available");o[e]=r}run(e,r){return this.als.run(e,r)}};(function(t){let e=null;async function r(o){return e||(e=(async()=>{let i=o===!0||"AWS_LAMBDA_MAX_CONCURRENCY"in process.env?await Wz.create():new Zz;return!qz&&globalThis.awslambda?.InvokeStore?globalThis.awslambda.InvokeStore:(!qz&&globalThis.awslambda&&(globalThis.awslambda.InvokeStore=i),i)})()),e}t.getInstanceAsync=r,t._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{e=null,globalThis.awslambda?.InvokeStore&&delete globalThis.awslambda.InvokeStore,globalThis.awslambda={InvokeStore:void 0}}}:void 0})(wy||(wy={}))});function qbe(t){for(let e of Object.keys(t)){let r=e.toLowerCase();e!==r&&(r===Gz||r===BJ||r===KJ)&&(t[r]=t[e],delete t[e])}}var Bbe,Kbe,Jz,Gz,BJ,KJ,bk,Xz=v(()=>{HJ();re();Bbe="AWS_LAMBDA_FUNCTION_NAME",Kbe="_X_AMZN_TRACE_ID",Jz="X-Amzn-Trace-Id",Gz="traceparent",BJ="tracestate",KJ="baggage",bk=()=>t=>async e=>{let{request:r}=e;if(!Ce.isInstance(r))return t(e);let o;{let n=Object.keys(r.headers??{}).find(i=>i.toLowerCase()===Jz.toLowerCase())??Jz;if(!r.headers.hasOwnProperty(n)){let i=process.env[Bbe],s=process.env[Kbe];o??=await wy.getInstanceAsync();let c=o?.getXRayTraceId()??s,u=l=>typeof l=="string"&&l.length>0;u(i)&&u(c)&&(r.headers[Jz]=c)}}if(qbe(r.headers),!r.headers[Gz]){let i=(o??=await wy.getInstanceAsync())?.getTraceparent?.();if(i){r.headers[Gz]=i;let s=o?.getTracestate?.();s&&(r.headers[BJ]=s);let a=o?.getBaggage?.();a&&(r.headers[KJ]=a)}}return t(e)}});var Cs,qJ=v(()=>{Kz();Xz();Cs=t=>({applyToStack:e=>{e.add(bk(),vk)}})});var ZJ,WJ=v(()=>{ZJ=(t,e)=>{if(!e||e.length===0)return t;let r=[];for(let o of e)for(let n of t)n.schemeId.split("#")[1]===o&&r.push(n);for(let o of t)r.find(({schemeId:n})=>n===o.schemeId)||r.push(o);return r}});function Zbe(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var wl,_k=v(()=>{he();WJ();wl=(t,e)=>(r,o)=>async n=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,o,n.input)),s=t.authSchemePreference?await t.authSchemePreference():[],a=ZJ(i,s),c=Zbe(t.httpAuthSchemes),u=wt(o),l=[];for(let d of a){let f=c.get(d.schemeId);if(!f){l.push(`HttpAuthScheme \`${d.schemeId}\` was not enabled for this service.`);continue}let p=f.identityProvider(await e.identityProviderConfigProvider(t));if(!p){l.push(`HttpAuthScheme \`${d.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:m={},signingProperties:g={}}=d.propertiesExtractor?.(t,o)||{};d.identityProperties=Object.assign(d.identityProperties||{},m),d.signingProperties=Object.assign(d.signingProperties||{},g),u.selectedHttpAuthScheme={httpAuthOption:d,identity:await p(d.identityProperties),signer:f.signer};break}if(!u.selectedHttpAuthScheme)throw new Error(l.join(`
26
+ `));return r(n)}});var Sk,bi,JJ=v(()=>{_k();Sk={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},bi=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:o=>{o.addRelativeTo(wl(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),Sk)}})});var xk,Yz,GJ=v(()=>{_k();xk={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"serializerMiddleware"},Yz=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:o=>{o.addRelativeTo(wl(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),xk)}})});var XJ=v(()=>{_k();JJ();GJ()});var Wbe,Jbe,by,Qz=v(()=>{re();he();Wbe=t=>e=>{throw e},Jbe=(t,e)=>{},by=t=>(e,r)=>async o=>{if(!Ce.isInstance(o.request))return e(o);let i=wt(r).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:s={}},identity:a,signer:c}=i,u=await e({...o,request:await c.sign(o.request,a,s)}).catch((c.errorHandler||Wbe)(s));return(c.successHandler||Jbe)(u.response,s),u}});var Ek,_i,YJ=v(()=>{Qz();Ek={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},_i=t=>({applyToStack:e=>{e.addRelativeTo(by(t),Ek)}})});var QJ=v(()=>{Qz();YJ()});var No,eG=v(()=>{No=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});function tG(t,e,r,o,n){return async function*(s,a,...c){let u=a,l=s.startingToken??u[r],d=!0,f;for(;d;){if(u[r]=l,n&&(u[n]=u[n]??s.pageSize),s.client instanceof t)f=await Gbe(e,s.client,a,s.withCommand,...c);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield f;let p=l;l=Xbe(f,o),d=!!(l&&(!s.stopOnSameToken||l!==p))}return void 0}}var Gbe,Xbe,rG=v(()=>{Gbe=async(t,e,r,o=i=>i,...n)=>{let i=new t(r);return i=o(i)??i,await e.send(i,...n)};Xbe=(t,e)=>{let r=t,o=e.split(".");for(let n of o){if(!r||typeof r!="object")return;r=r[n]}return r}});function nG(t,e,r){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=r}var oG=v(()=>{});var io,iG=v(()=>{he();io=class{authSchemes=new Map;constructor(e){for(let r in e){if(!ce(e,r))continue;let o=e[r];o!==void 0&&this.authSchemes.set(r,o)}}getIdentityProvider(e){return this.authSchemes.get(e)}}});var ej,pf,sG=v(()=>{re();ej=St(is()),pf=class{async sign(e,r,o){if(!o)throw new Error("request could not be signed with `apiKey` since the `name` and `in` signer properties are missing");if(!o.name)throw new Error("request could not be signed with `apiKey` since the `name` signer property is missing");if(!o.in)throw new Error("request could not be signed with `apiKey` since the `in` signer property is missing");if(!r.apiKey)throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined");let n=Ce.clone(e);if(o.in===ej.HttpApiKeyAuthLocation.QUERY)n.query[o.name]=r.apiKey;else if(o.in===ej.HttpApiKeyAuthLocation.HEADER)n.headers[o.name]=o.scheme?`${o.scheme} ${r.apiKey}`:r.apiKey;else throw new Error("request can only be signed with `apiKey` locations `query` or `header`, but found: `"+o.in+"`");return n}}});var ff,aG=v(()=>{re();ff=class{async sign(e,r,o){let n=Ce.clone(e);if(!r.token)throw new Error("request could not be signed with `token` since the `token` is not defined");return n.headers.Authorization=`Bearer ${r.token}`,n}}});var Xr,cG=v(()=>{Xr=class{async sign(e,r,o){return e}}});var uG=v(()=>{sG();aG();cG()});var kk,tj,_y,mf,Sy,lG=v(()=>{kk=t=>function(r){return mf(r)&&r.expiration.getTime()-Date.now()<t},tj=3e5,_y=kk(3e5),mf=t=>t.expiration!==void 0,Sy=(t,e,r)=>{if(t===void 0)return;let o=typeof t!="function"?async()=>Promise.resolve(t):t,n,i,s,a=!1,c=async u=>{i||(i=o(u));try{n=await i,s=!0,a=!1}finally{i=void 0}return n};return e===void 0?async u=>((!s||u?.forceRefresh)&&(n=await c(u)),n):async u=>((!s||u?.forceRefresh)&&(n=await c(u)),a?n:r(n)?(e(n)&&await c(u),n):(a=!0,n))}});var dG=v(()=>{iG();uG();lG()});var pG={};yt(pG,{DefaultIdentityProviderConfig:()=>io,EXPIRATION_MS:()=>tj,HttpApiKeyAuthSigner:()=>pf,HttpBearerAuthSigner:()=>ff,NoAuthSigner:()=>Xr,createIsIdentityExpiredFunction:()=>kk,createPaginator:()=>tG,doesIdentityRequireRefresh:()=>mf,getHttpAuthSchemeEndpointRuleSetPlugin:()=>bi,getHttpAuthSchemePlugin:()=>Yz,getHttpSigningPlugin:()=>_i,getSmithyContext:()=>wt,httpAuthSchemeEndpointRuleSetMiddlewareOptions:()=>Sk,httpAuthSchemeMiddleware:()=>wl,httpAuthSchemeMiddlewareOptions:()=>xk,httpSigningMiddleware:()=>by,httpSigningMiddlewareOptions:()=>Ek,isIdentityExpired:()=>_y,memoizeIdentityProvider:()=>Sy,normalizeProvider:()=>No,requestBuilder:()=>YE,setFeature:()=>nG});var Nn=v(()=>{he();XJ();QJ();eG();rG();re();oG();dG()});function Ybe(t){return t===void 0?!0:typeof t=="string"&&t.length<=50}function Os(t){let e=No(t.userAgentAppId??xy),{customUserAgent:r}=t;return Object.assign(t,{customUserAgent:typeof r=="string"?[[r]]:r,userAgentAppId:async()=>{let o=await e();if(!Ybe(o)){let n=t.logger?.constructor?.name==="NoOpLogger"||!t.logger?console:t.logger;typeof o!="string"?n?.warn("userAgentAppId must be a string or undefined."):o.length>50&&n?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return o}})}var xy,rj=v(()=>{Nn();xy=void 0});var nj,fG=v(()=>{nj={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-east-2":{description:"Asia Pacific (Taipei)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"aws-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"AWS European Sovereign Cloud (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"aws-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}],version:"1.1"}});var mG,hG,Ik,oj,gG,$k,Ak=v(()=>{fG();mG=nj,hG="",Ik=t=>{let{partitions:e}=mG;for(let o of e){let{regions:n,outputs:i}=o;for(let[s,a]of Object.entries(n))if(s===t)return{...i,...a}}for(let o of e){let{regionRegex:n,outputs:i}=o;if(new RegExp(n).test(t))return{...i}}let r=e.find(o=>o.id==="aws");if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}},oj=(t,e="")=>{mG=t,hG=e},gG=()=>{oj(nj,"")},$k=()=>hG});async function yG(t,e,r){if(r.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&Oo(t,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){let i=await e.retryStrategy();if(typeof i.mode=="string")switch(i.mode){case fr.ADAPTIVE:Oo(t,"RETRY_MODE_ADAPTIVE","F");break;case fr.STANDARD:Oo(t,"RETRY_MODE_STANDARD","E");break}}if(typeof e.accountIdEndpointMode=="function"){let i=t.endpointV2;switch(String(i?.url?.hostname).match(Qbe)&&Oo(t,"ACCOUNT_ID_ENDPOINT","O"),await e.accountIdEndpointMode?.()){case"disabled":Oo(t,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":Oo(t,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":Oo(t,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let n=t.__smithy_context?.selectedHttpAuthScheme?.identity;if(n?.$source){let i=n;i.accountId&&Oo(t,"RESOLVED_ACCOUNT_ID","T");for(let[s,a]of Object.entries(i.$source??{}))Oo(t,s,a)}}var Qbe,vG=v(()=>{Co();Lz();Qbe=/\d{12}\.ddb/});var ij,Tk,wG,bG,_G=v(()=>{ij="user-agent",Tk="x-amz-user-agent",wG=/[^!$%&'*+\-.^_`|~\w]/g,bG=/[^!$%&'*+\-.^_`|~\w#]/g});function SG(t){let e="";for(let r in t){let o=t[r];if(e.length+o.length+1<=1024){e.length?e+=","+o:e+=o;continue}break}return e}var xG=v(()=>{});var aj,Pk,cj,Ns,IG=v(()=>{re();Ak();vG();_G();xG();aj=t=>(e,r)=>async o=>{let{request:n}=o;if(!Ce.isInstance(n))return e(o);let{headers:i}=n,s=r?.userAgent?.map(Pk)||[],a=(await t.defaultUserAgentProvider()).map(Pk);await yG(r,t,o);let c=r;a.push(`m/${SG(Object.assign({},r.__smithy_context?.features,c.__aws_sdk_context?.features))}`);let u=t?.customUserAgent?.map(Pk)||[],l=await t.userAgentAppId();l&&a.push(Pk(["app",`${l}`]));let d=$k(),f=(d?[d]:[]).concat([...a,...s,...u]).join(" "),p=[...a.filter(m=>m.startsWith("aws-sdk-")),...u].join(" ");return t.runtime!=="browser"?(p&&(i[Tk]=i[Tk]?`${i[ij]} ${p}`:p),i[ij]=f):i[Tk]=f,e({...o,request:n})},Pk=t=>{let e=t[0].split("/").map(s=>s.replace(wG,"-")).join("/"),r=t[1]?.replace(bG,"-"),o=e.indexOf("/"),n=e.substring(0,o),i=e.substring(o+1);return n==="api"&&(i=i.toLowerCase()),[n,i,r].filter(s=>s&&s.length>0).reduce((s,a,c)=>{switch(c){case 0:return a;case 1:return`${s}/${a}`;default:return`${s}#${a}`}},"")},cj={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Ns=t=>({applyToStack:e=>{e.add(aj(t),cj)}})});import{versions as uj}from"node:process";var $G,AG=v(()=>{$G=()=>{let t=["deno","bun","llrt"];for(let e of t)if(uj[e])return[`md/${e}`,uj[e]];return["md/nodejs",uj.node]}});var Ey,lj=v(()=>{Ey={isCrtAvailable:!1}});var TG,PG=v(()=>{lj();TG=()=>Ey.isCrtAvailable?["md/crt-avail"]:null});import{platform as e_e,release as t_e}from"node:os";import{env as RG}from"node:process";var Si,CG,OG=v(()=>{AG();PG();lj();Si=({serviceId:t,clientVersion:e})=>{let r=$G();return async o=>{let n=[["aws-sdk-js",e],["ua","2.1"],[`os/${e_e()}`,t_e()],["lang/js"],r],i=TG();i&&n.push(i),t&&n.push([`api/${t}`,e]),RG.AWS_EXECUTION_ENV&&n.push([`exec-env/${RG.AWS_EXECUTION_ENV}`]);let s=await o?.userAgentAppId?.();return s?[...n,[`app/${s}`]]:[...n]}},CG=Si});var dj,pj,r_e,Ds,NG=v(()=>{rj();dj="AWS_SDK_UA_APP_ID",pj="sdk_ua_app_id",r_e="sdk-ua-app-id",Ds={environmentVariableSelector:t=>t[dj],configFileSelector:t=>t[pj]??t[r_e],default:xy}});var DG=R((ky,fj)=>{(function(t,e){typeof ky=="object"&&typeof fj=="object"?fj.exports=e():typeof define=="function"&&define.amd?define([],e):typeof ky=="object"?ky.bowser=e():t.bowser=e()})(ky,(function(){return(function(t){var e={};function r(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(o,n,i){r.o(o,n)||Object.defineProperty(o,n,{enumerable:!0,get:i})},r.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},r.t=function(o,n){if(1&n&&(o=r(o)),8&n||4&n&&typeof o=="object"&&o&&o.__esModule)return o;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:o}),2&n&&typeof o!="string")for(var s in o)r.d(i,s,function(a){return o[a]}.bind(null,s));return i},r.n=function(o){var n=o&&o.__esModule?function(){return o.default}:function(){return o};return r.d(n,"a",n),n},r.o=function(o,n){return Object.prototype.hasOwnProperty.call(o,n)},r.p="",r(r.s=90)})({17:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o=r(18),n=(function(){function i(){}return i.getFirstMatch=function(s,a){var c=a.match(s);return c&&c.length>0&&c[1]||""},i.getSecondMatch=function(s,a){var c=a.match(s);return c&&c.length>1&&c[2]||""},i.matchAndReturnConst=function(s,a,c){if(s.test(a))return c},i.getWindowsVersionName=function(s){switch(s){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(s){var a=s.split(".").splice(0,2).map((function(l){return parseInt(l,10)||0}));a.push(0);var c=a[0],u=a[1];if(c===10)switch(u){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}switch(c){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";default:return}},i.getAndroidVersionName=function(s){var a=s.split(".").splice(0,2).map((function(c){return parseInt(c,10)||0}));if(a.push(0),!(a[0]===1&&a[1]<5))return a[0]===1&&a[1]<6?"Cupcake":a[0]===1&&a[1]>=6?"Donut":a[0]===2&&a[1]<2?"Eclair":a[0]===2&&a[1]===2?"Froyo":a[0]===2&&a[1]>2?"Gingerbread":a[0]===3?"Honeycomb":a[0]===4&&a[1]<1?"Ice Cream Sandwich":a[0]===4&&a[1]<4?"Jelly Bean":a[0]===4&&a[1]>=4?"KitKat":a[0]===5?"Lollipop":a[0]===6?"Marshmallow":a[0]===7?"Nougat":a[0]===8?"Oreo":a[0]===9?"Pie":void 0},i.getVersionPrecision=function(s){return s.split(".").length},i.compareVersions=function(s,a,c){c===void 0&&(c=!1);var u=i.getVersionPrecision(s),l=i.getVersionPrecision(a),d=Math.max(u,l),f=0,p=i.map([s,a],(function(m){var g=d-i.getVersionPrecision(m),y=m+new Array(g+1).join(".0");return i.map(y.split("."),(function(w){return new Array(20-w.length).join("0")+w})).reverse()}));for(c&&(f=d-Math.min(u,l)),d-=1;d>=f;){if(p[0][d]>p[1][d])return 1;if(p[0][d]===p[1][d]){if(d===f)return 0;d-=1}else if(p[0][d]<p[1][d])return-1}},i.map=function(s,a){var c,u=[];if(Array.prototype.map)return Array.prototype.map.call(s,a);for(c=0;c<s.length;c+=1)u.push(a(s[c]));return u},i.find=function(s,a){var c,u;if(Array.prototype.find)return Array.prototype.find.call(s,a);for(c=0,u=s.length;c<u;c+=1){var l=s[c];if(a(l,c))return l}},i.assign=function(s){for(var a,c,u=s,l=arguments.length,d=new Array(l>1?l-1:0),f=1;f<l;f++)d[f-1]=arguments[f];if(Object.assign)return Object.assign.apply(Object,[s].concat(d));var p=function(){var m=d[a];typeof m=="object"&&m!==null&&Object.keys(m).forEach((function(g){u[g]=m[g]}))};for(a=0,c=d.length;a<c;a+=1)p();return s},i.getBrowserAlias=function(s){return o.BROWSER_ALIASES_MAP[s]},i.getBrowserTypeByAlias=function(s){return o.BROWSER_MAP[s]||""},i})();e.default=n,t.exports=e.default},18:function(t,e,r){"use strict";e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",Brave:"brave",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",DuckDuckGo:"duckduckgo",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Linespider:"linespider",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SlackBot:"slackbot",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},e.BROWSER_MAP={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",brave:"Brave",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",duckduckgo:"DuckDuckGo",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",linespider:"Linespider",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",slackbot:"SlackBot",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},e.PLATFORMS_MAP={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},e.OS_MAP={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},e.ENGINE_MAP={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"}},90:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o,n=(o=r(91))&&o.__esModule?o:{default:o},i=r(18);function s(c,u){for(var l=0;l<u.length;l++){var d=u[l];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(c,d.key,d)}}var a=(function(){function c(){}var u,l,d;return c.getParser=function(f,p,m){if(p===void 0&&(p=!1),m===void 0&&(m=null),typeof f!="string")throw new Error("UserAgent should be a string");return new n.default(f,p,m)},c.parse=function(f,p){return p===void 0&&(p=null),new n.default(f,p).getResult()},u=c,d=[{key:"BROWSER_MAP",get:function(){return i.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return i.ENGINE_MAP}},{key:"OS_MAP",get:function(){return i.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return i.PLATFORMS_MAP}}],(l=null)&&s(u.prototype,l),d&&s(u,d),c})();e.default=a,t.exports=e.default},91:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o=c(r(92)),n=c(r(93)),i=c(r(94)),s=c(r(95)),a=c(r(17));function c(l){return l&&l.__esModule?l:{default:l}}var u=(function(){function l(f,p,m){if(p===void 0&&(p=!1),m===void 0&&(m=null),f==null||f==="")throw new Error("UserAgent parameter can't be empty");this._ua=f;var g=!1;typeof p=="boolean"?(g=p,this._hints=m):this._hints=p!=null&&typeof p=="object"?p:null,this.parsedResult={},g!==!0&&this.parse()}var d=l.prototype;return d.getHints=function(){return this._hints},d.hasBrand=function(f){if(!this._hints||!Array.isArray(this._hints.brands))return!1;var p=f.toLowerCase();return this._hints.brands.some((function(m){return m.brand&&m.brand.toLowerCase()===p}))},d.getBrandVersion=function(f){if(this._hints&&Array.isArray(this._hints.brands)){var p=f.toLowerCase(),m=this._hints.brands.find((function(g){return g.brand&&g.brand.toLowerCase()===p}));return m?m.version:void 0}},d.getUA=function(){return this._ua},d.test=function(f){return f.test(this._ua)},d.parseBrowser=function(){var f=this;this.parsedResult.browser={};var p=a.default.find(o.default,(function(m){if(typeof m.test=="function")return m.test(f);if(Array.isArray(m.test))return m.test.some((function(g){return f.test(g)}));throw new Error("Browser's test function is not valid")}));return p&&(this.parsedResult.browser=p.describe(this.getUA(),this)),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(f){return f?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var f=this;this.parsedResult.os={};var p=a.default.find(n.default,(function(m){if(typeof m.test=="function")return m.test(f);if(Array.isArray(m.test))return m.test.some((function(g){return f.test(g)}));throw new Error("Browser's test function is not valid")}));return p&&(this.parsedResult.os=p.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(f){var p=this.getOS().name;return f?String(p).toLowerCase()||"":p||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(f){f===void 0&&(f=!1);var p=this.getPlatform().type;return f?String(p).toLowerCase()||"":p||""},d.parsePlatform=function(){var f=this;this.parsedResult.platform={};var p=a.default.find(i.default,(function(m){if(typeof m.test=="function")return m.test(f);if(Array.isArray(m.test))return m.test.some((function(g){return f.test(g)}));throw new Error("Browser's test function is not valid")}));return p&&(this.parsedResult.platform=p.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(f){return f?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var f=this;this.parsedResult.engine={};var p=a.default.find(s.default,(function(m){if(typeof m.test=="function")return m.test(f);if(Array.isArray(m.test))return m.test.some((function(g){return f.test(g)}));throw new Error("Browser's test function is not valid")}));return p&&(this.parsedResult.engine=p.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return a.default.assign({},this.parsedResult)},d.satisfies=function(f){var p=this,m={},g=0,y={},w=0;if(Object.keys(f).forEach((function(Ie){var xe=f[Ie];typeof xe=="string"?(y[Ie]=xe,w+=1):typeof xe=="object"&&(m[Ie]=xe,g+=1)})),g>0){var b=Object.keys(m),_=a.default.find(b,(function(Ie){return p.isOS(Ie)}));if(_){var k=this.satisfies(m[_]);if(k!==void 0)return k}var $=a.default.find(b,(function(Ie){return p.isPlatform(Ie)}));if($){var D=this.satisfies(m[$]);if(D!==void 0)return D}}if(w>0){var K=Object.keys(y),te=a.default.find(K,(function(Ie){return p.isBrowser(Ie,!0)}));if(te!==void 0)return this.compareVersion(y[te])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var m=this.getBrowserName().toLowerCase(),g=f.toLowerCase(),y=a.default.getBrowserTypeByAlias(g);return p&&y&&(g=y.toLowerCase()),g===m},d.compareVersion=function(f){var p=[0],m=f,g=!1,y=this.getBrowserVersion();if(typeof y=="string")return f[0]===">"||f[0]==="<"?(m=f.substr(1),f[1]==="="?(g=!0,m=f.substr(2)):p=[],f[0]===">"?p.push(1):p.push(-1)):f[0]==="="?m=f.substr(1):f[0]==="~"&&(g=!0,m=f.substr(1)),p.indexOf(a.default.compareVersions(y,m,g))>-1},d.isOS=function(f){return this.getOSName(!0)===String(f).toLowerCase()},d.isPlatform=function(f){return this.getPlatformType(!0)===String(f).toLowerCase()},d.isEngine=function(f){return this.getEngineName(!0)===String(f).toLowerCase()},d.is=function(f,p){return p===void 0&&(p=!1),this.isBrowser(f,p)||this.isOS(f)||this.isPlatform(f)},d.some=function(f){var p=this;return f===void 0&&(f=[]),f.some((function(m){return p.is(m)}))},l})();e.default=u,t.exports=e.default},92:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o,n=(o=r(17))&&o.__esModule?o:{default:o},i=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/gptbot/i],describe:function(a){var c={name:"GPTBot"},u=n.default.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/chatgpt-user/i],describe:function(a){var c={name:"ChatGPT-User"},u=n.default.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/oai-searchbot/i],describe:function(a){var c={name:"OAI-SearchBot"},u=n.default.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(a){var c={name:"ClaudeBot"},u=n.default.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(a){var c={name:"Omgilibot"},u=n.default.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/diffbot/i],describe:function(a){var c={name:"Diffbot"},u=n.default.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/perplexitybot/i],describe:function(a){var c={name:"PerplexityBot"},u=n.default.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/perplexity-user/i],describe:function(a){var c={name:"Perplexity-User"},u=n.default.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/youbot/i],describe:function(a){var c={name:"YouBot"},u=n.default.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/meta-webindexer/i],describe:function(a){var c={name:"Meta-WebIndexer"},u=n.default.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/meta-externalads/i],describe:function(a){var c={name:"Meta-ExternalAds"},u=n.default.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/meta-externalagent/i],describe:function(a){var c={name:"Meta-ExternalAgent"},u=n.default.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/meta-externalfetcher/i],describe:function(a){var c={name:"Meta-ExternalFetcher"},u=n.default.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/googlebot/i],describe:function(a){var c={name:"Googlebot"},u=n.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/linespider/i],describe:function(a){var c={name:"Linespider"},u=n.default.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/amazonbot/i],describe:function(a){var c={name:"AmazonBot"},u=n.default.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/bingbot/i],describe:function(a){var c={name:"BingCrawler"},u=n.default.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/baiduspider/i],describe:function(a){var c={name:"BaiduSpider"},u=n.default.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/duckduckbot/i],describe:function(a){var c={name:"DuckDuckBot"},u=n.default.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/ia_archiver/i],describe:function(a){var c={name:"InternetArchiveCrawler"},u=n.default.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe:function(a){var c={name:"SlackBot"},u=n.default.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/yahoo!?[\s/]*slurp/i],describe:function(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe:function(){return{name:"PingdomBot"}}},{test:[/opera/i],describe:function(a){var c={name:"Opera"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/opr\/|opios/i],describe:function(a){var c={name:"Opera"},u=n.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/SamsungBrowser/i],describe:function(a){var c={name:"Samsung Internet for Android"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/Whale/i],describe:function(a){var c={name:"NAVER Whale Browser"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/PaleMoon/i],describe:function(a){var c={name:"Pale Moon"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/MZBrowser/i],describe:function(a){var c={name:"MZ Browser"},u=n.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/focus/i],describe:function(a){var c={name:"Focus"},u=n.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/swing/i],describe:function(a){var c={name:"Swing"},u=n.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/coast/i],describe:function(a){var c={name:"Opera Coast"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(a){var c={name:"Opera Touch"},u=n.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/yabrowser/i],describe:function(a){var c={name:"Yandex Browser"},u=n.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/ucbrowser/i],describe:function(a){var c={name:"UC Browser"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/Maxthon|mxios/i],describe:function(a){var c={name:"Maxthon"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/epiphany/i],describe:function(a){var c={name:"Epiphany"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/puffin/i],describe:function(a){var c={name:"Puffin"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/sleipnir/i],describe:function(a){var c={name:"Sleipnir"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/k-meleon/i],describe:function(a){var c={name:"K-Meleon"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/micromessenger/i],describe:function(a){var c={name:"WeChat"},u=n.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/qqbrowser/i],describe:function(a){var c={name:/qqbrowserlite/i.test(a)?"QQ Browser Lite":"QQ Browser"},u=n.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/msie|trident/i],describe:function(a){var c={name:"Internet Explorer"},u=n.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/\sedg\//i],describe:function(a){var c={name:"Microsoft Edge"},u=n.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/edg([ea]|ios)/i],describe:function(a){var c={name:"Microsoft Edge"},u=n.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/vivaldi/i],describe:function(a){var c={name:"Vivaldi"},u=n.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/seamonkey/i],describe:function(a){var c={name:"SeaMonkey"},u=n.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/sailfish/i],describe:function(a){var c={name:"Sailfish"},u=n.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,a);return u&&(c.version=u),c}},{test:[/silk/i],describe:function(a){var c={name:"Amazon Silk"},u=n.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/phantom/i],describe:function(a){var c={name:"PhantomJS"},u=n.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/slimerjs/i],describe:function(a){var c={name:"SlimerJS"},u=n.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(a){var c={name:"BlackBerry"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/(web|hpw)[o0]s/i],describe:function(a){var c={name:"WebOS Browser"},u=n.default.getFirstMatch(i,a)||n.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/bada/i],describe:function(a){var c={name:"Bada"},u=n.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/tizen/i],describe:function(a){var c={name:"Tizen"},u=n.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/qupzilla/i],describe:function(a){var c={name:"QupZilla"},u=n.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/librewolf/i],describe:function(a){var c={name:"LibreWolf"},u=n.default.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/firefox|iceweasel|fxios/i],describe:function(a){var c={name:"Firefox"},u=n.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/electron/i],describe:function(a){var c={name:"Electron"},u=n.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe:function(a){var c={name:"Sogou Browser"},u=n.default.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,a),l=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,a),d=n.default.getFirstMatch(/se ([\d.]+)x/i,a),f=u||l||d;return f&&(c.version=f),c}},{test:[/MiuiBrowser/i],describe:function(a){var c={name:"Miui"},u=n.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:function(a){return!!a.hasBrand("DuckDuckGo")||a.test(/\sDdg\/[\d.]+$/i)},describe:function(a,c){var u={name:"DuckDuckGo"};if(c){var l=c.getBrandVersion("DuckDuckGo");if(l)return u.version=l,u}var d=n.default.getFirstMatch(/\sDdg\/([\d.]+)$/i,a);return d&&(u.version=d),u}},{test:function(a){return a.hasBrand("Brave")},describe:function(a,c){var u={name:"Brave"};if(c){var l=c.getBrandVersion("Brave");if(l)return u.version=l,u}return u}},{test:[/chromium/i],describe:function(a){var c={name:"Chromium"},u=n.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,a)||n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/chrome|crios|crmo/i],describe:function(a){var c={name:"Chrome"},u=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/GSA/i],describe:function(a){var c={name:"Google Search"},u=n.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:function(a){var c=!a.test(/like android/i),u=a.test(/android/i);return c&&u},describe:function(a){var c={name:"Android Browser"},u=n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/playstation 4/i],describe:function(a){var c={name:"PlayStation 4"},u=n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/safari|applewebkit/i],describe:function(a){var c={name:"Safari"},u=n.default.getFirstMatch(i,a);return u&&(c.version=u),c}},{test:[/.*/i],describe:function(a){var c=a.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:n.default.getFirstMatch(c,a),version:n.default.getSecondMatch(c,a)}}}];e.default=s,t.exports=e.default},93:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o,n=(o=r(17))&&o.__esModule?o:{default:o},i=r(18),s=[{test:[/Roku\/DVP/],describe:function(a){var c=n.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,a);return{name:i.OS_MAP.Roku,version:c}}},{test:[/windows phone/i],describe:function(a){var c=n.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,a);return{name:i.OS_MAP.WindowsPhone,version:c}}},{test:[/windows /i],describe:function(a){var c=n.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,a),u=n.default.getWindowsVersionName(c);return{name:i.OS_MAP.Windows,version:c,versionName:u}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(a){var c={name:i.OS_MAP.iOS},u=n.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,a);return u&&(c.version=u),c}},{test:[/macintosh/i],describe:function(a){var c=n.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,a).replace(/[_\s]/g,"."),u=n.default.getMacOSVersionName(c),l={name:i.OS_MAP.MacOS,version:c};return u&&(l.versionName=u),l}},{test:[/(ipod|iphone|ipad)/i],describe:function(a){var c=n.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,a).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:c}}},{test:[/OpenHarmony/i],describe:function(a){var c=n.default.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,a);return{name:i.OS_MAP.HarmonyOS,version:c}}},{test:function(a){var c=!a.test(/like android/i),u=a.test(/android/i);return c&&u},describe:function(a){var c=n.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,a),u=n.default.getAndroidVersionName(c),l={name:i.OS_MAP.Android,version:c};return u&&(l.versionName=u),l}},{test:[/(web|hpw)[o0]s/i],describe:function(a){var c=n.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,a),u={name:i.OS_MAP.WebOS};return c&&c.length&&(u.version=c),u}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(a){var c=n.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,a)||n.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,a)||n.default.getFirstMatch(/\bbb(\d+)/i,a);return{name:i.OS_MAP.BlackBerry,version:c}}},{test:[/bada/i],describe:function(a){var c=n.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,a);return{name:i.OS_MAP.Bada,version:c}}},{test:[/tizen/i],describe:function(a){var c=n.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,a);return{name:i.OS_MAP.Tizen,version:c}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(a){var c=n.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,a);return{name:i.OS_MAP.PlayStation4,version:c}}}];e.default=s,t.exports=e.default},94:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o,n=(o=r(17))&&o.__esModule?o:{default:o},i=r(18),s=[{test:[/googlebot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/linespider/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe:function(){return{type:i.PLATFORMS_MAP.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe:function(a){var c=n.default.getFirstMatch(/(can-l01)/i,a)&&"Nova",u={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return c&&(u.model=c),u}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(a){var c=a.test(/ipod|iphone/i),u=a.test(/like (ipod|iphone)/i);return c&&!u},describe:function(a){var c=n.default.getFirstMatch(/(ipod|iphone)/i,a);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:c}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe:function(a){var c=n.default.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,a),u={type:i.PLATFORMS_MAP.mobile,vendor:"Nokia"};return c&&(u.model=c),u}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(a){return a.getBrowserName(!0)==="blackberry"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(a){return a.getBrowserName(!0)==="bada"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(a){return a.getBrowserName()==="windows phone"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(a){var c=Number(String(a.getOSVersion()).split(".")[0]);return a.getOSName(!0)==="android"&&c>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(a){return a.getOSName(!0)==="android"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:[/smart-?tv|smarttv/i],describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:[/netcast/i],describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(a){return a.getOSName(!0)==="macos"},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(a){return a.getOSName(!0)==="windows"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(a){return a.getOSName(!0)==="linux"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(a){return a.getOSName(!0)==="playstation 4"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(a){return a.getOSName(!0)==="roku"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];e.default=s,t.exports=e.default},95:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var o,n=(o=r(17))&&o.__esModule?o:{default:o},i=r(18),s=[{test:function(a){return a.getBrowserName(!0)==="microsoft edge"},describe:function(a){if(/\sedg\//i.test(a))return{name:i.ENGINE_MAP.Blink};var c=n.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,a);return{name:i.ENGINE_MAP.EdgeHTML,version:c}}},{test:[/trident/i],describe:function(a){var c={name:i.ENGINE_MAP.Trident},u=n.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:function(a){return a.test(/presto/i)},describe:function(a){var c={name:i.ENGINE_MAP.Presto},u=n.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:function(a){var c=a.test(/gecko/i),u=a.test(/like gecko/i);return c&&!u},describe:function(a){var c={name:i.ENGINE_MAP.Gecko},u=n.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(a){var c={name:i.ENGINE_MAP.WebKit},u=n.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,a);return u&&(c.version=u),c}}];e.default=s,t.exports=e.default}})}))});var zG,jG=v(()=>{zG=({serviceId:t,clientVersion:e})=>async r=>{let o=await Promise.resolve().then(()=>St(DG())),n=o.parse??o.default.parse??(()=>""),i=typeof window<"u"&&window?.navigator?.userAgent?n(window.navigator.userAgent):void 0,s=[["aws-sdk-js",e],["ua","2.1"],[`os/${i?.os?.name||"other"}`,i?.os?.version],["lang/js"],["md/browser",`${i?.browser?.name??"unknown"}_${i?.browser?.version??"unknown"}`]];t&&s.push([`api/${t}`,e]);let a=await r?.userAgentAppId?.();return a&&s.push([`app/${a}`]),s}});var MG,UG=v(()=>{MG={os(t){if(/iPhone|iPad|iPod/.test(t))return"iOS";if(/Macintosh|Mac OS X/.test(t))return"macOS";if(/Windows NT/.test(t))return"Windows";if(/Android/.test(t))return"Android";if(/Linux/.test(t))return"Linux"},browser(t){if(/EdgiOS|EdgA|Edg\//.test(t))return"Microsoft Edge";if(/Firefox\//.test(t))return"Firefox";if(/Chrome\//.test(t))return"Chrome";if(/Safari\//.test(t))return"Safari"}}});var mj=v(()=>{It()});var Iy,hj=v(()=>{It();mj();Iy=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!Iy(r))return!1;return!0}return!(!di(t)||t.length<3||t.length>63||t!==t.toLowerCase()||ya(t))}});var Rk,gj=v(()=>{Rk=t=>{let e=t.split(":");if(e.length<6)return null;let[r,o,n,i,s,...a]=e;if(r!=="arn"||o===""||n===""||a.join(":")==="")return null;let c=a.map(u=>u.split("/")).flat();return{partition:o,service:n,region:i,accountId:s,resourceId:c}}});var xi,LG=v(()=>{It();hj();gj();Ak();xi={isVirtualHostableS3Bucket:Iy,parseArn:Rk,partition:Ik};On.aws=xi});var FG=v(()=>{It()});var VG,yj,HG=v(()=>{re();VG=t=>{if(typeof t.endpointProvider!="function")throw new Error("@aws-sdk/util-endpoint - endpointProvider and endpoint missing in config for this client.");let{endpoint:e}=t;return e===void 0&&(t.endpoint=async()=>yj(t.endpointProvider({Region:typeof t.region=="function"?await t.region():t.region,UseDualStack:typeof t.useDualstackEndpoint=="function"?await t.useDualstackEndpoint():t.useDualstackEndpoint,UseFIPS:typeof t.useFipsEndpoint=="function"?await t.useFipsEndpoint():t.useFipsEndpoint,Endpoint:void 0},{logger:t.logger}))),t},yj=t=>Ir(t.url)});var BG=v(()=>{It()});var KG=v(()=>{dt();dt()});function Ck(t={}){return fe({...$r,async default(){return vj.silence||console.warn("@aws-sdk - WARN - default STS region of us-east-1 used. See @aws-sdk/credential-providers README and set a region explicitly."),"us-east-1"}},{...gn,...t})}var vj,qG=v(()=>{dt();vj={silence:!1}});var zs,js,ZG=v(()=>{zs=t=>({setRegion(e){t.region=e},region(){return t.region}}),js=t=>({region:t.region()})});var Ms={};yt(Ms,{DEFAULT_UA_APP_ID:()=>xy,EndpointError:()=>He,NODE_APP_ID_CONFIG_OPTIONS:()=>Ds,NODE_REGION_CONFIG_FILE_OPTIONS:()=>gn,NODE_REGION_CONFIG_OPTIONS:()=>$r,REGION_ENV_NAME:()=>Fp,REGION_INI_NAME:()=>Vp,UA_APP_ID_ENV_NAME:()=>dj,UA_APP_ID_INI_NAME:()=>pj,awsEndpointFunctions:()=>xi,createDefaultUserAgentProvider:()=>Si,createUserAgentStringParsingProvider:()=>zG,crtAvailability:()=>Ey,defaultUserAgent:()=>CG,emitWarningIfUnsupportedVersion:()=>os,fallback:()=>MG,getAwsRegionExtensionConfiguration:()=>zs,getHostHeaderPlugin:()=>Ps,getLoggerPlugin:()=>Rs,getLongPollPlugin:()=>SZ,getRecursionDetectionPlugin:()=>Cs,getUserAgentMiddlewareOptions:()=>cj,getUserAgentPlugin:()=>Ns,getUserAgentPrefix:()=>$k,hostHeaderMiddleware:()=>Fz,hostHeaderMiddlewareOptions:()=>Vz,isIpAddress:()=>ya,isVirtualHostableS3Bucket:()=>Iy,loggerMiddleware:()=>Hz,loggerMiddlewareOptions:()=>Bz,parseArn:()=>Rk,partition:()=>Ik,recursionDetectionMiddleware:()=>bk,recursionDetectionMiddlewareOptions:()=>vk,resolveAwsRegionExtensionConfiguration:()=>js,resolveDefaultAwsRegionalEndpointsConfig:()=>VG,resolveEndpoint:()=>ly,resolveHostHeaderConfig:()=>df,resolveRegionConfig:()=>to,resolveUserAgentConfig:()=>Os,setCredentialFeature:()=>gc,setFeature:()=>Oo,setPartitionInfo:()=>oj,setTokenFeature:()=>UJ,state:()=>jg,stsRegionDefaultResolver:()=>Ck,stsRegionWarning:()=>vj,toEndpointV1:()=>yj,useDefaultPartitionInfo:()=>gG,userAgentMiddleware:()=>aj});var pt=v(()=>{_Z();xZ();EZ();Lz();LJ();FJ();VJ();Kz();qJ();Xz();rj();IG();OG();NG();UG();jG();LG();FG();HG();mj();hj();gj();Ak();BG();KG();qG();ZG()});var Ok,Nk,WG=v(()=>{re();Ok=t=>ur.isInstance(t)?t.headers?.date??t.headers?.Date:void 0,Nk=t=>ur.isInstance(t)?t.headers?.age??t.headers?.Age:void 0});var $y,JG=v(()=>{$y=t=>new Date(Date.now()+t)});var Dk,GG=v(()=>{Dk=(t,e,r,o)=>{if(o!==void 0)return e;let n=Date.parse(t),i=Date.now();return r!==void 0&&i-r>9e5?e:r!==void 0?n-(r+i)/2:n-i}});var wj=v(()=>{WG();JG();GG()});var Ay,hf,mr,bj,_j=v(()=>{re();wj();Ay=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},hf=async t=>{let e=Ay("context",t.context),r=Ay("config",t.config),o=e.endpointV2?.properties?.authSchemes?.[0],i=await Ay("signer",r.signer)(o),s=t?.signingRegion,a=t?.signingRegionSet,c=t?.signingName;return{config:r,signer:i,signingRegion:s,signingRegionSet:a,signingName:c}},mr=class{async sign(e,r,o){if(!Ce.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let n=await hf(o),{config:i,signer:s}=n,{signingRegion:a,signingName:c}=n,u=o.context;if(u?.authSchemes?.length??!1){let[f,p]=u.authSchemes;f?.name==="sigv4a"&&p?.name==="sigv4"&&(a=p?.signingRegion??a,c=p?.signingName??c)}let l=await i.disableClockSkewCorrection?.()===!0;return o._disableClockSkewCorrection=l,l||(o._preRequestSystemClockOffset=i.systemClockOffset,o._requestSentAt=Date.now()),await s.sign(e,{signingDate:l?new Date:$y(i.systemClockOffset),signingRegion:a,signingService:c})}errorHandler(e){return r=>{let o=r;if(!e._disableClockSkewCorrection){let n=o.ServerTime??Ok(o.$response);if(n){let i=Ay("config",e.config),s=e._preRequestSystemClockOffset,a=e._requestSentAt,c=Nk(o.$response),u=Dk(n,i.systemClockOffset,a,c);i.systemClockOffset=u,Math.abs(u)>=24e4&&(u!==s||s!==void 0&&s!==u)&&o.$metadata&&(o.$metadata.clockSkewCorrected=!0)}}throw r}}successHandler(e,r){if(r._disableClockSkewCorrection)return;let o=Ok(e);if(o){let n=Ay("config",r.config),i=r._requestSentAt,s=Nk(e);n.systemClockOffset=Dk(o,n.systemClockOffset,i,s)}}},bj=mr});var Ea,XG=v(()=>{re();wj();_j();Ea=class extends mr{async sign(e,r,o){if(!Ce.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let{config:n,signer:i,signingRegion:s,signingRegionSet:a,signingName:c}=await hf(o),l=(await n.sigv4aSigningRegionSet?.()??a??[s]).join(","),d=await n.disableClockSkewCorrection?.()===!0;return o._disableClockSkewCorrection=d,d||(o._preRequestSystemClockOffset=n.systemClockOffset,o._requestSentAt=Date.now()),await i.sign(e,{signingDate:d?new Date:$y(n.systemClockOffset),signingRegion:l,signingService:c})}}});var Sj,YG=v(()=>{Sj=t=>typeof t=="string"&&t.length>0?t.split(",").map(e=>e.trim()):[]});var zk,xj=v(()=>{zk=t=>`AWS_BEARER_TOKEN_${t.replace(/[\s-]/g,"_").toUpperCase()}`});var QG,e7,Ei,t7=v(()=>{YG();xj();QG="AWS_AUTH_SCHEME_PREFERENCE",e7="auth_scheme_preference",Ei={environmentVariableSelector:(t,e)=>{if(e?.signingName&&zk(e.signingName)in t)return["httpBearerAuth"];if(QG in t)return Sj(t[QG])},configFileSelector:t=>{if(e7 in t)return Sj(t[e7])},default:[]}});var Ty,Py,r7=v(()=>{Nn();dt();Ty=t=>(t.sigv4aSigningRegionSet=No(t.sigv4aSigningRegionSet),t),Py={environmentVariableSelector(t){if(t.AWS_SIGV4A_SIGNING_REGION_SET)return t.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map(e=>e.trim());throw new eo("AWS_SIGV4A_SIGNING_REGION_SET not set in env.",{tryNextLink:!0})},configFileSelector(t){if(t.sigv4a_signing_region_set)return(t.sigv4a_signing_region_set??"").split(",").map(e=>e.trim());throw new eo("sigv4a_signing_region_set not set in profile.",{tryNextLink:!0})},default:void 0}});var Dj=R(Ee=>{var{hasOwn:yf,fromUtf8:n7,fromHex:n_e,toHex:bl,toUint8Array:Ry,isArrayBuffer:o_e}=(de(),se(Zp)),{normalizeProvider:o7}=(le(),se(U0)),{escapeUri:jk,HttpRequest:c7}=(re(),se(yl)),Ej=class{format(e){let r=[];for(let i in e){if(!yf(e,i))continue;let s=n7(i);r.push(Uint8Array.from([s.byteLength]),s,this.formatHeaderValue(e[i]))}let o=new Uint8Array(r.reduce((i,s)=>i+s.byteLength,0)),n=0;for(let i of r)o.set(i,n),n+=i.byteLength;return o}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let o=new DataView(new ArrayBuffer(5));return o.setUint8(0,4),o.setInt32(1,e.value,!1),new Uint8Array(o.buffer);case"long":let n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let s=new Uint8Array(i.buffer);return s.set(e.value,3),s;case"string":let a=n7(e.value),c=new DataView(new ArrayBuffer(3+a.byteLength));c.setUint8(0,7),c.setUint16(1,a.byteLength,!1);let u=new Uint8Array(c.buffer);return u.set(a,3),u;case"timestamp":let l=new Uint8Array(9);return l[0]=8,l.set(kj.fromNumber(e.value.valueOf()).bytes,1),l;case"uuid":if(!i_e.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(n_e(e.value.replace(/-/g,"")),1),d}}},i7;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(i7||(i7={}));var i_e=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,kj=class t{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let o=7,n=Math.abs(Math.round(e));o>-1&&n>0;o--,n/=256)r[o]=n;return e<0&&s7(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&s7(e),parseInt(bl(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function s7(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var u7="X-Amz-Algorithm",l7="X-Amz-Credential",Tj="X-Amz-Date",d7="X-Amz-SignedHeaders",p7="X-Amz-Expires",Pj="X-Amz-Signature",Rj="X-Amz-Security-Token",s_e="X-Amz-Region-Set",Cj="authorization",Oj=Tj.toLowerCase(),f7="date",m7=[Cj,Oj,f7],h7=Pj.toLowerCase(),Vk="x-amz-content-sha256",g7=Rj.toLowerCase(),a_e="host",y7={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},v7=/^proxy-/,w7=/^sec-/,c_e=[/^proxy-/i,/^sec-/i],Mk="AWS4-HMAC-SHA256",u_e="AWS4-ECDSA-P256-SHA256",b7="AWS4-HMAC-SHA256-PAYLOAD",_7="UNSIGNED-PAYLOAD",S7=50,Nj="aws4_request",x7=3600*24*7,E7=({query:t={}})=>{let e=[],r={};for(let o in t){if(!yf(t,o)||o.toLowerCase()===h7)continue;let n=jk(o);e.push(n);let i=t[o];typeof i=="string"?r[n]=`${n}=${jk(i)}`:Array.isArray(i)&&(r[n]=i.slice(0).reduce((s,a)=>s.concat([`${n}=${jk(a)}`]),[]).sort().join("&"))}return e.sort().map(o=>r[o]).filter(o=>o).join("&")},l_e=t=>d_e(t).toISOString().replace(/\.\d{3}Z$/,"Z"),d_e=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t,Hk=class{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:r,region:o,service:n,sha256:i,uriEscapePath:s=!0}){this.service=n,this.sha256=i,this.uriEscapePath=s,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=o7(o),this.credentialProvider=o7(r)}createCanonicalRequest(e,r,o){let n=Object.keys(r).sort();return`${e.method}
27
27
  ${this.getCanonicalPath(e)}
28
28
  ${E7(e)}
29
29
  ${n.map(i=>`${i}:${r[i]}`).join(`
@@ -61,10 +61,10 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
61
61
  `:""},this._extScope=e,this._scope=new Fi.Scope({parent:e}),this._nodes=[new mL]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let i=this._scope.toName(r);return o!==void 0&&n&&(this._constants[i.str]=o),this._leafNode(new cL(e,i,o)),i}const(e,r,o){return this._def(Fi.varKinds.const,e,r,o)}let(e,r,o){return this._def(Fi.varKinds.let,e,r,o)}var(e,r,o){return this._def(Fi.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new nT(e,r,o))}add(e,r){return this._leafNode(new uL(e,Pe.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Le.nil&&this._leafNode(new fL(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,Le.addCodeArg)(r,n));return r.push("}"),new Le._Code(r)}if(e,r,o){if(this._blockNode(new Kl(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Kl(e))}else(){return this._elseNode(new Sm)}endIf(){return this._endBlockNode(Kl,Sm)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new hL(e),r)}forRange(e,r,o,n,i=this.opts.es5?Fi.varKinds.var:Fi.varKinds.let){let s=this._scope.toName(e);return this._for(new gL(i,s,r,o),()=>n(s))}forOf(e,r,o,n=Fi.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let s=r instanceof Le.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Le._)`${s}.length`,a=>{this.var(i,(0,Le._)`${s}[${a}]`),o(i)})}return this._for(new oT("of",n,i,r),()=>o(i))}forIn(e,r,o,n=this.opts.es5?Fi.varKinds.var:Fi.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Le._)`Object.keys(${r})`,o);let i=this._scope.toName(e);return this._for(new oT("in",n,i,r),()=>o(i))}endFor(){return this._endBlockNode(ql)}label(e){return this._leafNode(new lL(e))}break(e){return this._leafNode(new dL(e))}return(e){let r=new xw;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(xw)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new yL;if(this._blockNode(n),this.code(e),r){let i=this.name("e");this._currNode=n.catch=new Ew(i),r(i)}return o&&(this._currNode=n.finally=new kw,this.code(o)),this._endBlockNode(Ew,kw)}throw(e){return this._leafNode(new pL(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Le.nil,o,n){return this._blockNode(new Sw(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Sw)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Kl))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Pe.CodeGen=vL;function Zl(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function iT(t,e){return e instanceof Le._CodeOrName?Zl(t,e.names):t}function xm(t,e,r){if(t instanceof Le.Name)return o(t);if(!n(t))return t;return new Le._Code(t._items.reduce((i,s)=>(s instanceof Le.Name&&(s=o(s)),s instanceof Le._Code?i.push(...s._items):i.push(s),i),[]));function o(i){let s=r[i.str];return s===void 0||e[i.str]!==1?i:(delete e[i.str],s)}function n(i){return i instanceof Le._Code&&i._items.some(s=>s instanceof Le.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function TOe(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Sse(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Le._)`!${wL(t)}`}Pe.not=Sse;var POe=xse(Pe.operators.AND);function ROe(...t){return t.reduce(POe)}Pe.and=ROe;var COe=xse(Pe.operators.OR);function OOe(...t){return t.reduce(COe)}Pe.or=OOe;function xse(t){return(e,r)=>e===Le.nil?r:r===Le.nil?e:(0,Le._)`${wL(e)} ${t} ${wL(r)}`}function wL(t){return t instanceof Le.Name?t:(0,Le._)`(${t})`}});var Be=R(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.checkStrictMode=Oe.getErrorPath=Oe.Type=Oe.useFunc=Oe.setEvaluated=Oe.evaluatedPropsToName=Oe.mergeEvaluated=Oe.eachItem=Oe.unescapeJsonPointer=Oe.escapeJsonPointer=Oe.escapeFragment=Oe.unescapeFragment=Oe.schemaRefOrVal=Oe.schemaHasRulesButRef=Oe.schemaHasRules=Oe.checkUnknownRules=Oe.alwaysValidSchema=Oe.toHash=void 0;var ht=ke(),NOe=bw();function DOe(t){let e={};for(let r of t)e[r]=!0;return e}Oe.toHash=DOe;function zOe(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Ise(t,e),!$se(e,t.self.RULES.all))}Oe.alwaysValidSchema=zOe;function Ise(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let i in e)n[i]||Pse(t,`unknown keyword: "${i}"`)}Oe.checkUnknownRules=Ise;function $se(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Oe.schemaHasRules=$se;function jOe(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Oe.schemaHasRulesButRef=jOe;function MOe({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ht._)`${r}`}return(0,ht._)`${t}${e}${(0,ht.getProperty)(o)}`}Oe.schemaRefOrVal=MOe;function UOe(t){return Ase(decodeURIComponent(t))}Oe.unescapeFragment=UOe;function LOe(t){return encodeURIComponent(_L(t))}Oe.escapeFragment=LOe;function _L(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Oe.escapeJsonPointer=_L;function Ase(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Oe.unescapeJsonPointer=Ase;function FOe(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Oe.eachItem=FOe;function Ese({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,i,s,a)=>{let c=s===void 0?i:s instanceof ht.Name?(i instanceof ht.Name?t(n,i,s):e(n,i,s),s):i instanceof ht.Name?(e(n,s,i),i):r(i,s);return a===ht.Name&&!(c instanceof ht.Name)?o(n,c):c}}Oe.mergeEvaluated={props:Ese({mergeNames:(t,e,r)=>t.if((0,ht._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ht._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ht._)`${r} || {}`).code((0,ht._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ht._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ht._)`${r} || {}`),SL(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Tse}),items:Ese({mergeNames:(t,e,r)=>t.if((0,ht._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ht._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ht._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ht._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Tse(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ht._)`{}`);return e!==void 0&&SL(t,r,e),r}Oe.evaluatedPropsToName=Tse;function SL(t,e,r){Object.keys(r).forEach(o=>t.assign((0,ht._)`${e}${(0,ht.getProperty)(o)}`,!0))}Oe.setEvaluated=SL;var kse={};function VOe(t,e){return t.scopeValue("func",{ref:e,code:kse[e.code]||(kse[e.code]=new NOe._Code(e.code))})}Oe.useFunc=VOe;var bL;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(bL||(Oe.Type=bL={}));function HOe(t,e,r){if(t instanceof ht.Name){let o=e===bL.Num;return r?o?(0,ht._)`"[" + ${t} + "]"`:(0,ht._)`"['" + ${t} + "']"`:o?(0,ht._)`"/" + ${t}`:(0,ht._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ht.getProperty)(t).toString():"/"+_L(t)}Oe.getErrorPath=HOe;function Pse(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Oe.checkStrictMode=Pse});var Ma=R(xL=>{"use strict";Object.defineProperty(xL,"__esModule",{value:!0});var rn=ke(),BOe={data:new rn.Name("data"),valCxt:new rn.Name("valCxt"),instancePath:new rn.Name("instancePath"),parentData:new rn.Name("parentData"),parentDataProperty:new rn.Name("parentDataProperty"),rootData:new rn.Name("rootData"),dynamicAnchors:new rn.Name("dynamicAnchors"),vErrors:new rn.Name("vErrors"),errors:new rn.Name("errors"),this:new rn.Name("this"),self:new rn.Name("self"),scope:new rn.Name("scope"),json:new rn.Name("json"),jsonPos:new rn.Name("jsonPos"),jsonLen:new rn.Name("jsonLen"),jsonPart:new rn.Name("jsonPart")};xL.default=BOe});var Iw=R(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.extendErrors=nn.resetErrorsCount=nn.reportExtraError=nn.reportError=nn.keyword$DataError=nn.keywordError=void 0;var Ke=ke(),aT=Be(),_n=Ma();nn.keywordError={message:({keyword:t})=>(0,Ke.str)`must pass "${t}" keyword validation`};nn.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ke.str)`"${t}" keyword must be ${e} ($data)`:(0,Ke.str)`"${t}" keyword is invalid ($data)`};function KOe(t,e=nn.keywordError,r,o){let{it:n}=t,{gen:i,compositeRule:s,allErrors:a}=n,c=Ose(t,e,r);o??(s||a)?Rse(i,c):Cse(n,(0,Ke._)`[${c}]`)}nn.reportError=KOe;function qOe(t,e=nn.keywordError,r){let{it:o}=t,{gen:n,compositeRule:i,allErrors:s}=o,a=Ose(t,e,r);Rse(n,a),i||s||Cse(o,_n.default.vErrors)}nn.reportExtraError=qOe;function ZOe(t,e){t.assign(_n.default.errors,e),t.if((0,Ke._)`${_n.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ke._)`${_n.default.vErrors}.length`,e),()=>t.assign(_n.default.vErrors,null)))}nn.resetErrorsCount=ZOe;function WOe({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:i}){if(n===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",n,_n.default.errors,a=>{t.const(s,(0,Ke._)`${_n.default.vErrors}[${a}]`),t.if((0,Ke._)`${s}.instancePath === undefined`,()=>t.assign((0,Ke._)`${s}.instancePath`,(0,Ke.strConcat)(_n.default.instancePath,i.errorPath))),t.assign((0,Ke._)`${s}.schemaPath`,(0,Ke.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,Ke._)`${s}.schema`,r),t.assign((0,Ke._)`${s}.data`,o))})}nn.extendErrors=WOe;function Rse(t,e){let r=t.const("err",e);t.if((0,Ke._)`${_n.default.vErrors} === null`,()=>t.assign(_n.default.vErrors,(0,Ke._)`[${r}]`),(0,Ke._)`${_n.default.vErrors}.push(${r})`),t.code((0,Ke._)`${_n.default.errors}++`)}function Cse(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,Ke._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ke._)`${o}.errors`,e),r.return(!1))}var Wl={keyword:new Ke.Name("keyword"),schemaPath:new Ke.Name("schemaPath"),params:new Ke.Name("params"),propertyName:new Ke.Name("propertyName"),message:new Ke.Name("message"),schema:new Ke.Name("schema"),parentSchema:new Ke.Name("parentSchema")};function Ose(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,Ke._)`{}`:JOe(t,e,r)}function JOe(t,e,r={}){let{gen:o,it:n}=t,i=[GOe(n,r),XOe(t,r)];return YOe(t,e,i),o.object(...i)}function GOe({errorPath:t},{instancePath:e}){let r=e?(0,Ke.str)`${t}${(0,aT.getErrorPath)(e,aT.Type.Str)}`:t;return[_n.default.instancePath,(0,Ke.strConcat)(_n.default.instancePath,r)]}function XOe({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,Ke.str)`${e}/${t}`;return r&&(n=(0,Ke.str)`${n}${(0,aT.getErrorPath)(r,aT.Type.Str)}`),[Wl.schemaPath,n]}function YOe(t,{params:e,message:r},o){let{keyword:n,data:i,schemaValue:s,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([Wl.keyword,n],[Wl.params,typeof e=="function"?e(t):e||(0,Ke._)`{}`]),c.messages&&o.push([Wl.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([Wl.schema,s],[Wl.parentSchema,(0,Ke._)`${l}${d}`],[_n.default.data,i]),u&&o.push([Wl.propertyName,u])}});var Dse=R(Em=>{"use strict";Object.defineProperty(Em,"__esModule",{value:!0});Em.boolOrEmptySchema=Em.topBoolOrEmptySchema=void 0;var QOe=Iw(),eNe=ke(),tNe=Ma(),rNe={message:"boolean schema is false"};function nNe(t){let{gen:e,schema:r,validateName:o}=t;r===!1?Nse(t,!1):typeof r=="object"&&r.$async===!0?e.return(tNe.default.data):(e.assign((0,eNe._)`${o}.errors`,null),e.return(!0))}Em.topBoolOrEmptySchema=nNe;function oNe(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),Nse(t)):r.var(e,!0)}Em.boolOrEmptySchema=oNe;function Nse(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,QOe.reportError)(n,rNe,void 0,e)}});var EL=R(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});km.getRules=km.isJSONType=void 0;var iNe=["string","number","integer","boolean","null","object","array"],sNe=new Set(iNe);function aNe(t){return typeof t=="string"&&sNe.has(t)}km.isJSONType=aNe;function cNe(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}km.getRules=cNe});var kL=R(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.shouldUseRule=wu.shouldUseGroup=wu.schemaHasRulesForType=void 0;function uNe({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&zse(t,o)}wu.schemaHasRulesForType=uNe;function zse(t,e){return e.rules.some(r=>jse(t,r))}wu.shouldUseGroup=zse;function jse(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}wu.shouldUseRule=jse});var $w=R(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.reportTypeError=on.checkDataTypes=on.checkDataType=on.coerceAndCheckDataType=on.getJSONTypes=on.getSchemaTypes=on.DataType=void 0;var lNe=EL(),dNe=kL(),pNe=Iw(),_e=ke(),Mse=Be(),Im;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Im||(on.DataType=Im={}));function fNe(t){let e=Use(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}on.getSchemaTypes=fNe;function Use(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(lNe.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}on.getJSONTypes=Use;function mNe(t,e){let{gen:r,data:o,opts:n}=t,i=hNe(e,n.coerceTypes),s=e.length>0&&!(i.length===0&&e.length===1&&(0,dNe.schemaHasRulesForType)(t,e[0]));if(s){let a=$L(e,o,n.strictNumbers,Im.Wrong);r.if(a,()=>{i.length?gNe(t,e,i):AL(t)})}return s}on.coerceAndCheckDataType=mNe;var Lse=new Set(["string","number","integer","boolean","null"]);function hNe(t,e){return e?t.filter(r=>Lse.has(r)||e==="array"&&r==="array"):[]}function gNe(t,e,r){let{gen:o,data:n,opts:i}=t,s=o.let("dataType",(0,_e._)`typeof ${n}`),a=o.let("coerced",(0,_e._)`undefined`);i.coerceTypes==="array"&&o.if((0,_e._)`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,_e._)`${n}[0]`).assign(s,(0,_e._)`typeof ${n}`).if($L(e,n,i.strictNumbers),()=>o.assign(a,n))),o.if((0,_e._)`${a} !== undefined`);for(let u of r)(Lse.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);o.else(),AL(t),o.endIf(),o.if((0,_e._)`${a} !== undefined`,()=>{o.assign(n,a),yNe(t,a)});function c(u){switch(u){case"string":o.elseIf((0,_e._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,_e._)`"" + ${n}`).elseIf((0,_e._)`${n} === null`).assign(a,(0,_e._)`""`);return;case"number":o.elseIf((0,_e._)`${s} == "boolean" || ${n} === null
62
62
  || (${s} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,_e._)`+${n}`);return;case"integer":o.elseIf((0,_e._)`${s} === "boolean" || ${n} === null
63
63
  || (${s} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,_e._)`+${n}`);return;case"boolean":o.elseIf((0,_e._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,_e._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,_e._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,_e._)`${s} === "string" || ${s} === "number"
64
- || ${s} === "boolean" || ${n} === null`).assign(a,(0,_e._)`[${n}]`)}}}function yNe({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,_e._)`${e} !== undefined`,()=>t.assign((0,_e._)`${e}[${r}]`,o))}function IL(t,e,r,o=Im.Correct){let n=o===Im.Correct?_e.operators.EQ:_e.operators.NEQ,i;switch(t){case"null":return(0,_e._)`${e} ${n} null`;case"array":i=(0,_e._)`Array.isArray(${e})`;break;case"object":i=(0,_e._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=s((0,_e._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=s();break;default:return(0,_e._)`typeof ${e} ${n} ${t}`}return o===Im.Correct?i:(0,_e.not)(i);function s(a=_e.nil){return(0,_e.and)((0,_e._)`typeof ${e} == "number"`,a,r?(0,_e._)`isFinite(${e})`:_e.nil)}}on.checkDataType=IL;function $L(t,e,r,o){if(t.length===1)return IL(t[0],e,r,o);let n,i=(0,Mse.toHash)(t);if(i.array&&i.object){let s=(0,_e._)`typeof ${e} != "object"`;n=i.null?s:(0,_e._)`!${e} || ${s}`,delete i.null,delete i.array,delete i.object}else n=_e.nil;i.number&&delete i.integer;for(let s in i)n=(0,_e.and)(n,IL(s,e,r,o));return n}on.checkDataTypes=$L;var vNe={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,_e._)`{type: ${t}}`:(0,_e._)`{type: ${e}}`};function AL(t){let e=wNe(t);(0,pNe.reportError)(e,vNe)}on.reportTypeError=AL;function wNe(t){let{gen:e,data:r,schema:o}=t,n=(0,Mse.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var Vse=R(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});cT.assignDefaults=void 0;var $m=ke(),bNe=Be();function _Ne(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)Fse(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,i)=>Fse(t,i,n.default))}cT.assignDefaults=_Ne;function Fse(t,e,r){let{gen:o,compositeRule:n,data:i,opts:s}=t;if(r===void 0)return;let a=(0,$m._)`${i}${(0,$m.getProperty)(e)}`;if(n){(0,bNe.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,$m._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,$m._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,$m._)`${a} = ${(0,$m.stringify)(r)}`)}});var Jo=R(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.validateUnion=ft.validateArray=ft.usePattern=ft.callValidateCode=ft.schemaProperties=ft.allSchemaProperties=ft.noPropertyInData=ft.propertyInData=ft.isOwnProperty=ft.hasPropFunc=ft.reportMissingProp=ft.checkMissingProp=ft.checkReportMissingProp=void 0;var $t=ke(),TL=Be(),bu=Ma(),SNe=Be();function xNe(t,e){let{gen:r,data:o,it:n}=t;r.if(RL(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,$t._)`${e}`},!0),t.error()})}ft.checkReportMissingProp=xNe;function ENe({gen:t,data:e,it:{opts:r}},o,n){return(0,$t.or)(...o.map(i=>(0,$t.and)(RL(t,e,i,r.ownProperties),(0,$t._)`${n} = ${i}`)))}ft.checkMissingProp=ENe;function kNe(t,e){t.setParams({missingProperty:e},!0),t.error()}ft.reportMissingProp=kNe;function Hse(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,$t._)`Object.prototype.hasOwnProperty`})}ft.hasPropFunc=Hse;function PL(t,e,r){return(0,$t._)`${Hse(t)}.call(${e}, ${r})`}ft.isOwnProperty=PL;function INe(t,e,r,o){let n=(0,$t._)`${e}${(0,$t.getProperty)(r)} !== undefined`;return o?(0,$t._)`${n} && ${PL(t,e,r)}`:n}ft.propertyInData=INe;function RL(t,e,r,o){let n=(0,$t._)`${e}${(0,$t.getProperty)(r)} === undefined`;return o?(0,$t.or)(n,(0,$t.not)(PL(t,e,r))):n}ft.noPropertyInData=RL;function Bse(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ft.allSchemaProperties=Bse;function $Ne(t,e){return Bse(e).filter(r=>!(0,TL.alwaysValidSchema)(t,e[r]))}ft.schemaProperties=$Ne;function ANe({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:i},it:s},a,c,u){let l=u?(0,$t._)`${t}, ${e}, ${o}${n}`:e,d=[[bu.default.instancePath,(0,$t.strConcat)(bu.default.instancePath,i)],[bu.default.parentData,s.parentData],[bu.default.parentDataProperty,s.parentDataProperty],[bu.default.rootData,bu.default.rootData]];s.opts.dynamicRef&&d.push([bu.default.dynamicAnchors,bu.default.dynamicAnchors]);let f=(0,$t._)`${l}, ${r.object(...d)}`;return c!==$t.nil?(0,$t._)`${a}.call(${c}, ${f})`:(0,$t._)`${a}(${f})`}ft.callValidateCode=ANe;var TNe=(0,$t._)`new RegExp`;function PNe({gen:t,it:{opts:e}},r){let o=e.unicodeRegExp?"u":"",{regExp:n}=e.code,i=n(r,o);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,$t._)`${n.code==="new RegExp"?TNe:(0,SNe.useFunc)(t,n)}(${r}, ${o})`})}ft.usePattern=PNe;function RNe(t){let{gen:e,data:r,keyword:o,it:n}=t,i=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(i,!0),s(()=>e.break()),i;function s(a){let c=e.const("len",(0,$t._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:TL.Type.Num},i),e.if((0,$t.not)(i),a)})}}ft.validateArray=RNe;function CNe(t){let{gen:e,schema:r,keyword:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,TL.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);e.assign(s,(0,$t._)`${s} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,$t.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}ft.validateUnion=CNe});var Zse=R(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.validateKeywordUsage=Ws.validSchemaType=Ws.funcKeywordCode=Ws.macroKeywordCode=void 0;var Sn=ke(),Jl=Ma(),ONe=Jo(),NNe=Iw();function DNe(t,e){let{gen:r,keyword:o,schema:n,parentSchema:i,it:s}=t,a=e.macro.call(s.self,n,i,s),c=qse(r,o,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:Sn.nil,errSchemaPath:`${s.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Ws.macroKeywordCode=DNe;function zNe(t,e){var r;let{gen:o,keyword:n,schema:i,parentSchema:s,$data:a,it:c}=t;MNe(c,e);let u=!a&&e.compile?e.compile.call(c.self,i,s,c):e.validate,l=qse(o,n,u),d=o.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)g(),e.modifying&&Kse(t),y(()=>t.error());else{let w=e.async?p():m();e.modifying&&Kse(t),y(()=>jNe(t,w))}}function p(){let w=o.let("ruleErrs",null);return o.try(()=>g((0,Sn._)`await `),b=>o.assign(d,!1).if((0,Sn._)`${b} instanceof ${c.ValidationError}`,()=>o.assign(w,(0,Sn._)`${b}.errors`),()=>o.throw(b))),w}function m(){let w=(0,Sn._)`${l}.errors`;return o.assign(w,null),g(Sn.nil),w}function g(w=e.async?(0,Sn._)`await `:Sn.nil){let b=c.opts.passContext?Jl.default.this:Jl.default.self,_=!("compile"in e&&!a||e.schema===!1);o.assign(d,(0,Sn._)`${w}${(0,ONe.callValidateCode)(t,l,b,_)}`,e.modifying)}function y(w){var b;o.if((0,Sn.not)((b=e.valid)!==null&&b!==void 0?b:d),w)}}Ws.funcKeywordCode=zNe;function Kse(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,Sn._)`${o.parentData}[${o.parentDataProperty}]`))}function jNe(t,e){let{gen:r}=t;r.if((0,Sn._)`Array.isArray(${e})`,()=>{r.assign(Jl.default.vErrors,(0,Sn._)`${Jl.default.vErrors} === null ? ${e} : ${Jl.default.vErrors}.concat(${e})`).assign(Jl.default.errors,(0,Sn._)`${Jl.default.vErrors}.length`),(0,NNe.extendErrors)(t)},()=>t.error())}function MNe({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function qse(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Sn.stringify)(r)})}function UNe(t,e,r=!1){return!e.length||e.some(o=>o==="array"?Array.isArray(t):o==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==o||r&&typeof t>"u")}Ws.validSchemaType=UNe;function LNe({schema:t,opts:e,self:r,errSchemaPath:o},n,i){if(Array.isArray(n.keyword)?!n.keyword.includes(i):n.keyword!==i)throw new Error("ajv implementation error");let s=n.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ws.validateKeywordUsage=LNe});var Jse=R(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.extendSubschemaMode=_u.extendSubschemaData=_u.getSubschema=void 0;var Js=ke(),Wse=Be();function FNe(t,{keyword:e,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:i,topSchemaRef:s}){if(e!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Js._)`${t.schemaPath}${(0,Js.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Js._)`${t.schemaPath}${(0,Js.getProperty)(e)}${(0,Js.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Wse.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||i===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}_u.getSubschema=FNe;function VNe(t,e,{dataProp:r,dataPropType:o,data:n,dataTypes:i,propertyName:s}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,f=a.let("data",(0,Js._)`${e.data}${(0,Js.getProperty)(r)}`,!0);c(f),t.errorPath=(0,Js.str)`${u}${(0,Wse.getErrorPath)(r,o,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Js._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Js.Name?n:a.let("data",n,!0);c(u),s!==void 0&&(t.propertyName=s)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}_u.extendSubschemaData=VNe;function HNe(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:i}){o!==void 0&&(t.compositeRule=o),n!==void 0&&(t.createErrors=n),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}_u.extendSubschemaMode=HNe});var CL=R((o0t,Gse)=>{"use strict";Gse.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var o,n,i;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),o=i.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[n]))return!1;for(n=o;n--!==0;){var s=i[n];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var Yse=R((i0t,Xse)=>{"use strict";var Su=Xse.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};uT(e,o,n,t,"",t)};Su.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Su.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Su.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Su.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function uT(t,e,r,o,n,i,s,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){e(o,n,i,s,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in Su.arrayKeywords)for(var f=0;f<d.length;f++)uT(t,e,r,d[f],n+"/"+l+"/"+f,i,n,l,o,f)}else if(l in Su.propsKeywords){if(d&&typeof d=="object")for(var p in d)uT(t,e,r,d[p],n+"/"+l+"/"+BNe(p),i,n,l,o,p)}else(l in Su.keywords||t.allKeys&&!(l in Su.skipKeywords))&&uT(t,e,r,d,n+"/"+l,i,n,l,o)}r(o,n,i,s,a,c,u)}}function BNe(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Aw=R(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.getSchemaRefs=Ln.resolveUrl=Ln.normalizeId=Ln._getFullPath=Ln.getFullPath=Ln.inlineRef=void 0;var KNe=Be(),qNe=CL(),ZNe=Yse(),WNe=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function JNe(t,e=!0){return typeof t=="boolean"?!0:e===!0?!OL(t):e?Qse(t)<=e:!1}Ln.inlineRef=JNe;var GNe=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function OL(t){for(let e in t){if(GNe.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(OL)||typeof r=="object"&&OL(r))return!0}return!1}function Qse(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!WNe.has(r)&&(typeof t[r]=="object"&&(0,KNe.eachItem)(t[r],o=>e+=Qse(o)),e===1/0))return 1/0}return e}function eae(t,e="",r){r!==!1&&(e=Am(e));let o=t.parse(e);return tae(t,o)}Ln.getFullPath=eae;function tae(t,e){return t.serialize(e).split("#")[0]+"#"}Ln._getFullPath=tae;var XNe=/#\/?$/;function Am(t){return t?t.replace(XNe,""):""}Ln.normalizeId=Am;function YNe(t,e,r){return r=Am(r),t.resolve(e,r)}Ln.resolveUrl=YNe;var QNe=/^[a-z_][-a-z0-9._]*$/i;function eDe(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Am(t[r]||e),i={"":n},s=eae(o,n,!1),a={},c=new Set;return ZNe(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let g=s+f,y=i[m];typeof d[r]=="string"&&(y=w.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),i[f]=y;function w(_){let k=this.opts.uriResolver.resolve;if(_=Am(y?k(y,_):_),c.has(_))throw l(_);c.add(_);let $=this.refs[_];return typeof $=="string"&&($=this.refs[$]),typeof $=="object"?u(d,$.schema,_):_!==Am(g)&&(_[0]==="#"?(u(d,a[_],_),a[_]=d):this.refs[_]=g),_}function b(_){if(typeof _=="string"){if(!QNe.test(_))throw new Error(`invalid anchor "${_}"`);w.call(this,`#${_}`)}}}),a;function u(d,f,p){if(f!==void 0&&!qNe(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ln.getSchemaRefs=eDe});var Rw=R(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.getData=xu.KeywordCxt=xu.validateFunctionCode=void 0;var sae=Dse(),rae=$w(),DL=kL(),lT=$w(),tDe=Vse(),Pw=Zse(),NL=Jse(),Q=ke(),pe=Ma(),rDe=Aw(),Ua=Be(),Tw=Iw();function nDe(t){if(uae(t)&&(lae(t),cae(t))){sDe(t);return}aae(t,()=>(0,sae.topBoolOrEmptySchema)(t))}xu.validateFunctionCode=nDe;function aae({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},i){n.code.es5?t.func(e,(0,Q._)`${pe.default.data}, ${pe.default.valCxt}`,o.$async,()=>{t.code((0,Q._)`"use strict"; ${nae(r,n)}`),iDe(t,n),t.code(i)}):t.func(e,(0,Q._)`${pe.default.data}, ${oDe(n)}`,o.$async,()=>t.code(nae(r,n)).code(i))}function oDe(t){return(0,Q._)`{${pe.default.instancePath}="", ${pe.default.parentData}, ${pe.default.parentDataProperty}, ${pe.default.rootData}=${pe.default.data}${t.dynamicRef?(0,Q._)`, ${pe.default.dynamicAnchors}={}`:Q.nil}}={}`}function iDe(t,e){t.if(pe.default.valCxt,()=>{t.var(pe.default.instancePath,(0,Q._)`${pe.default.valCxt}.${pe.default.instancePath}`),t.var(pe.default.parentData,(0,Q._)`${pe.default.valCxt}.${pe.default.parentData}`),t.var(pe.default.parentDataProperty,(0,Q._)`${pe.default.valCxt}.${pe.default.parentDataProperty}`),t.var(pe.default.rootData,(0,Q._)`${pe.default.valCxt}.${pe.default.rootData}`),e.dynamicRef&&t.var(pe.default.dynamicAnchors,(0,Q._)`${pe.default.valCxt}.${pe.default.dynamicAnchors}`)},()=>{t.var(pe.default.instancePath,(0,Q._)`""`),t.var(pe.default.parentData,(0,Q._)`undefined`),t.var(pe.default.parentDataProperty,(0,Q._)`undefined`),t.var(pe.default.rootData,pe.default.data),e.dynamicRef&&t.var(pe.default.dynamicAnchors,(0,Q._)`{}`)})}function sDe(t){let{schema:e,opts:r,gen:o}=t;aae(t,()=>{r.$comment&&e.$comment&&pae(t),dDe(t),o.let(pe.default.vErrors,null),o.let(pe.default.errors,0),r.unevaluated&&aDe(t),dae(t),mDe(t)})}function aDe(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,Q._)`${r}.evaluated`),e.if((0,Q._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,Q._)`${t.evaluated}.props`,(0,Q._)`undefined`)),e.if((0,Q._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,Q._)`${t.evaluated}.items`,(0,Q._)`undefined`))}function nae(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,Q._)`/*# sourceURL=${r} */`:Q.nil}function cDe(t,e){if(uae(t)&&(lae(t),cae(t))){uDe(t,e);return}(0,sae.boolOrEmptySchema)(t,e)}function cae({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function uae(t){return typeof t.schema!="boolean"}function uDe(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&pae(t),pDe(t),fDe(t);let i=o.const("_errs",pe.default.errors);dae(t,i),o.var(e,(0,Q._)`${i} === ${pe.default.errors}`)}function lae(t){(0,Ua.checkUnknownRules)(t),lDe(t)}function dae(t,e){if(t.opts.jtd)return oae(t,[],!1,e);let r=(0,rae.getSchemaTypes)(t.schema),o=(0,rae.coerceAndCheckDataType)(t,r);oae(t,r,!o,e)}function lDe(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,Ua.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function dDe(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ua.checkStrictMode)(t,"default is ignored in the schema root")}function pDe(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,rDe.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function fDe(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function pae({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let i=r.$comment;if(n.$comment===!0)t.code((0,Q._)`${pe.default.self}.logger.log(${i})`);else if(typeof n.$comment=="function"){let s=(0,Q.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,Q._)`${pe.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function mDe(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:i}=t;r.$async?e.if((0,Q._)`${pe.default.errors} === 0`,()=>e.return(pe.default.data),()=>e.throw((0,Q._)`new ${n}(${pe.default.vErrors})`)):(e.assign((0,Q._)`${o}.errors`,pe.default.vErrors),i.unevaluated&&hDe(t),e.return((0,Q._)`${pe.default.errors} === 0`))}function hDe({gen:t,evaluated:e,props:r,items:o}){r instanceof Q.Name&&t.assign((0,Q._)`${e}.props`,r),o instanceof Q.Name&&t.assign((0,Q._)`${e}.items`,o)}function oae(t,e,r,o){let{gen:n,schema:i,data:s,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Ua.schemaHasRulesButRef)(i,l))){n.block(()=>mae(t,"$ref",l.all.$ref.definition));return}c.jtd||gDe(t,e),n.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,DL.shouldUseGroup)(i,f)&&(f.type?(n.if((0,lT.checkDataType)(f.type,s,c.strictNumbers)),iae(t,f),e.length===1&&e[0]===f.type&&r&&(n.else(),(0,lT.reportTypeError)(t)),n.endIf()):iae(t,f),a||n.if((0,Q._)`${pe.default.errors} === ${o||0}`))}}function iae(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,tDe.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,DL.shouldUseRule)(o,i)&&mae(t,i.keyword,i.definition,e.type)})}function gDe(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(yDe(t,e),t.opts.allowUnionTypes||vDe(t,e),wDe(t,t.dataTypes))}function yDe(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{fae(t.dataTypes,r)||zL(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),_De(t,e)}}function vDe(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&zL(t,"use allowUnionTypes to allow union type keyword")}function wDe(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,DL.shouldUseRule)(t.schema,n)){let{type:i}=n.definition;i.length&&!i.some(s=>bDe(e,s))&&zL(t,`missing type "${i.join(",")}" for keyword "${o}"`)}}}function bDe(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function fae(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function _De(t,e){let r=[];for(let o of t.dataTypes)fae(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function zL(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Ua.checkStrictMode)(t,e,t.opts.strictTypes)}var dT=class{constructor(e,r,o){if((0,Pw.validateKeywordUsage)(e,r,o),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=o,this.data=e.data,this.schema=e.schema[o],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ua.schemaRefOrVal)(e,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",hae(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Pw.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",pe.default.errors))}result(e,r,o){this.failResult((0,Q.not)(e),r,o)}failResult(e,r,o){this.gen.if(e),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,Q.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,Q._)`${r} !== undefined && (${(0,Q.or)(this.invalid$data(),e)})`)}error(e,r,o){if(r){this.setParams(r),this._error(e,o),this.setParams({});return}this._error(e,o)}_error(e,r){(e?Tw.reportExtraError:Tw.reportError)(this,this.def.error,r)}$dataError(){(0,Tw.reportError)(this,this.def.$dataError||Tw.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Tw.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,o=Q.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=Q.nil,r=Q.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:i,def:s}=this;o.if((0,Q.or)((0,Q._)`${n} === undefined`,r)),e!==Q.nil&&o.assign(e,!0),(i.length||s.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==Q.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:i}=this;return(0,Q.or)(s(),a());function s(){if(o.length){if(!(r instanceof Q.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,Q._)`${(0,lT.checkDataTypes)(c,r,i.opts.strictNumbers,lT.DataType.Wrong)}`}return Q.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,Q._)`!${c}(${r})`}return Q.nil}}subschema(e,r){let o=(0,NL.getSubschema)(this.it,e);(0,NL.extendSubschemaData)(o,this.it,e),(0,NL.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return cDe(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=Ua.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=Ua.mergeEvaluated.items(n,e.items,o.items,r)))}mergeValidEvaluated(e,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,Q.Name)),!0}};xu.KeywordCxt=dT;function mae(t,e,r,o){let n=new dT(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Pw.funcKeywordCode)(n,r):"macro"in r?(0,Pw.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Pw.funcKeywordCode)(n,r)}var SDe=/^\/(?:[^~]|~0|~1)*$/,xDe=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function hae(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,i;if(t==="")return pe.default.rootData;if(t[0]==="/"){if(!SDe.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,i=pe.default.rootData}else{let u=xDe.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=e)throw new Error(c("property/index",l));return o[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!n)return i}let s=i,a=n.split("/");for(let u of a)u&&(i=(0,Q._)`${i}${(0,Q.getProperty)((0,Ua.unescapeJsonPointer)(u))}`,s=(0,Q._)`${s} && ${i}`);return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}xu.getData=hae});var pT=R(ML=>{"use strict";Object.defineProperty(ML,"__esModule",{value:!0});var jL=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};ML.default=jL});var Cw=R(FL=>{"use strict";Object.defineProperty(FL,"__esModule",{value:!0});var UL=Aw(),LL=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,UL.resolveUrl)(e,r,o),this.missingSchema=(0,UL.normalizeId)((0,UL.getFullPath)(e,this.missingRef))}};FL.default=LL});var mT=R(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.resolveSchema=Go.getCompilingSchema=Go.resolveRef=Go.compileSchema=Go.SchemaEnv=void 0;var Vi=ke(),EDe=pT(),Gl=Ma(),Hi=Aw(),gae=Be(),kDe=Rw(),Tm=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let o;typeof e.schema=="object"&&(o=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Hi.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};Go.SchemaEnv=Tm;function HL(t){let e=yae.call(this,t);if(e)return e;let r=(0,Hi.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:i}=this.opts,s=new Vi.CodeGen(this.scope,{es5:o,lines:n,ownProperties:i}),a;t.$async&&(a=s.scopeValue("Error",{ref:EDe.default,code:(0,Vi._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");t.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:Gl.default.data,parentData:Gl.default.parentData,parentDataProperty:Gl.default.parentDataProperty,dataNames:[Gl.default.data],dataPathArr:[Vi.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Vi.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Vi.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Vi._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,kDe.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();l=`${s.scopeRefs(Gl.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let p=new Function(`${Gl.default.self}`,`${Gl.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:g}=u;p.evaluated={props:m instanceof Vi.Name?void 0:m,items:g instanceof Vi.Name?void 0:g,dynamicProps:m instanceof Vi.Name,dynamicItems:g instanceof Vi.Name},p.source&&(p.source.evaluated=(0,Vi.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}Go.compileSchema=HL;function IDe(t,e,r){var o;r=(0,Hi.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let i=TDe.call(this,t,r);if(i===void 0){let s=(o=t.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;s&&(i=new Tm({schema:s,schemaId:a,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=$De.call(this,i)}Go.resolveRef=IDe;function $De(t){return(0,Hi.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:HL.call(this,t)}function yae(t){for(let e of this._compilations)if(ADe(e,t))return e}Go.getCompilingSchema=yae;function ADe(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function TDe(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||fT.call(this,t,e)}function fT(t,e){let r=this.opts.uriResolver.parse(e),o=(0,Hi._getFullPath)(this.opts.uriResolver,r),n=(0,Hi.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return VL.call(this,r,t);let i=(0,Hi.normalizeId)(o),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=fT.call(this,t,s);return typeof a?.schema!="object"?void 0:VL.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||HL.call(this,s),i===(0,Hi.normalizeId)(e)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,Hi.resolveUrl)(this.opts.uriResolver,n,u)),new Tm({schema:a,schemaId:c,root:t,baseId:n})}return VL.call(this,r,s)}}Go.resolveSchema=fT;var PDe=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function VL(t,{baseId:e,schema:r,root:o}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,gae.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!PDe.has(a)&&u&&(e=(0,Hi.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,gae.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Hi.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=fT.call(this,o,a)}let{schemaId:s}=this.opts;if(i=i||new Tm({schema:r,schemaId:s,root:o,baseId:e}),i.schema!==i.root.schema)return i}});var vae=R((d0t,RDe)=>{RDe.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var JL=R((p0t,kae)=>{"use strict";var CDe=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),KL=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),ODe=RegExp.prototype.test.bind(/^\d*$/u),Xl=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),qL=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),bae=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),ZL=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),NDe=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Fn=new Array(256);{let t="0123456789ABCDEF";for(let e=0;e<256;e++)Fn[e]="%"+t[e>>4]+t[e&15]}function sn(t){return t<2048?Fn[192|t>>6]+Fn[128|t&63]:t<65536?Fn[224|t>>12]+Fn[128|t>>6&63]+Fn[128|t&63]:Fn[240|t>>18]+Fn[128|t>>12&63]+Fn[128|t>>6&63]+Fn[128|t&63]}function DDe(t){let e="",r=0,o=0;for(o=0;o<t.length;o++)if(r=t[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o];break}for(o+=1;o<t.length;o++){if(r=t[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o]}return e}var zDe=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),jDe=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),MDe=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),UDe=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function LDe(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(!MDe(t[e])){if(t[e]==="%"&&e+2<t.length&&Xl(t.slice(e+1,e+3))){e+=2;continue}return!1}return!0}function wae(t){let e=-1,r=0,o=-1,n=0;for(let a=0;a<t.length;a++)t[a]==="0"?(o===-1&&(o=a),n++,n>r&&(r=n,e=o)):(o=-1,n=0);if(r<2)return t.join(":");let i=t.slice(0,e).join(":"),s=t.slice(e+r).join(":");return i+"::"+s}function FDe(t){let e=t.indexOf("::");if(e!==-1&&t.indexOf("::",e+1)!==-1)return;let r=e===-1?t.split(":"):t.slice(0,e).split(":"),o=e===-1?[]:t.slice(e+2).split(":");e!==-1&&(r.length===1&&r[0]===""&&(r.length=0),o.length===1&&o[0]===""&&(o.length=0));let n=r.concat(o),i=0;for(let a=0;a<n.length;a++){let c=n[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==n.length-1||e!==-1&&o.length===0||!KL(c))return;i+=2;continue}if(!zDe(c))return;n[a]=parseInt(c,16).toString(16),i++}if(e===-1)return i!==8?void 0:wae(n);if(i>=8)return;let s=n.slice(0,r.length);for(let a=i;a<8;a++)s.push("0");for(let a=r.length;a<n.length;a++)s.push(n[a]);return wae(s)}function BL(t){let e=t[0]==="["&&t[t.length-1]==="]";if((t[0]==="["||t[t.length-1]==="]")&&!e)return{host:t,isIPV6:!1,error:!0};let o=e?t.slice(1,-1):t;if(e&&jDe(o))return o=o.toLowerCase(),{host:`[${o}]`,escapedHost:o,isIPV6:!1,isIPVFuture:!0};if(VDe(o,":")<2)return{host:t,isIPV6:!1,error:e};let n="",i=o.indexOf("%");if(i!==-1){let a=o.slice(i,i+3).toLowerCase()==="%25"?3:1;if(n=o.slice(i+a),!LDe(n))return{host:t,isIPV6:!1,error:!0};o=o.slice(0,i)}let s=FDe(o);return s===void 0?{host:t,isIPV6:!1,error:!0}:{host:s+(n?"%"+n:""),escapedHost:s+(n?"%25"+n:""),isIPV6:!0}}function VDe(t,e){let r=0;for(let o=0;o<t.length;o++)t[o]===e&&r++;return r}function HDe(t){let e=t,r=[],o=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((o=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,o)),e=e.slice(o)}return r.join("")}var BDe={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},KDe=/[@/?#:]/g,qDe=/[@/?#]/g;function _ae(t,e){let r=e?qDe:KDe;return r.lastIndex=0,t.replace(r,o=>BDe[o])}function Sae(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let o=0;o<t.length;o++){if(t[o]==="%"&&o+2<t.length){let n=t.slice(o+1,o+3);if(Xl(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));e&&qL(s)?r+=s:r+="%"+i,o+=2;continue}}r+=t[o]}return r}function ZDe(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];if(o==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(Xl(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));s!=="."&&qL(s)?e+=s:e+="%"+i,r+=2;continue}}if(bae(o))e+=o;else{let n=t.charCodeAt(r);if(n<128)e+=Eae(n)?o:Fn[n];else if(n<55296||n>57343)e+=sn(n);else if(n<=56319&&r+1<t.length){let i=t.charCodeAt(r+1);i>=56320&&i<=57343?(e+=sn(65536+(n-55296<<10)+(i-56320)),r++):e+=sn(65533)}else e+=sn(65533)}}return e}function WDe(t,e=!1){let r="",o=e&&t[0]!=="/";for(let n=0;n<t.length;n++){let i=t[n];if(i==="%"&&n+2<t.length){let s=t.slice(n+1,n+3);if(Xl(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(i==="/"&&(o=!1),bae(i)&&(i!==":"||!o))r+=i;else{let s=t.charCodeAt(n);if(s<128)r+=Fn[s];else if(s<55296||s>57343)r+=sn(s);else if(s<=56319&&n+1<t.length){let a=t.charCodeAt(n+1);a>=56320&&a<=57343?(r+=sn(65536+(s-55296<<10)+(a-56320)),n++):r+=sn(65533)}else r+=sn(65533)}}return r}function WL(t,e){let r="";for(let o=0;o<t.length;o++){let n=t[o];if(n==="%"&&o+2<t.length){let i=t.slice(o+1,o+3);if(Xl(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(e(n))r+=n;else{let i=t.charCodeAt(o);if(i<128)r+=Fn[i];else if(i<55296||i>57343)r+=sn(i);else if(i<=56319&&o+1<t.length){let s=t.charCodeAt(o+1);s>=56320&&s<=57343?(r+=sn(65536+(i-55296<<10)+(s-56320)),o++):r+=sn(65533)}else r+=sn(65533)}}return r}function xae(t){return WL(t,NDe)}function JDe(t){return WL(t,ZL)}function GDe(t){return WL(t,ZL)}function Eae(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===42||t===43||t===45||t===46||t===47||t===64||t===95}function XDe(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];if(o==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(Xl(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));qL(s)?e+=s:e+="%"+i,r+=2;continue}}if(ZL(o))e+=o;else{let n=t.charCodeAt(r);if(n<128)e+=Eae(n)?o:Fn[n];else if(n<55296||n>57343)e+=sn(n);else if(n<=56319&&r+1<t.length){let i=t.charCodeAt(r+1);i>=56320&&i<=57343?(e+=sn(65536+(n-55296<<10)+(i-56320)),r++):e+=sn(65533)}else e+=sn(65533)}}return e}function YDe(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(Xl(o)){e+="%"+o.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function QDe(t){let e=[];if(t.userinfo!==void 0&&(e.push(xae(t.userinfo)),e.push("@")),t.host!==void 0){let r=t.host;if(!KL(r)){let o=BL(r);o.isIPV6!==!0&&o.isIPVFuture!==!0&&(r=Sae(r,!0),o=BL(r)),o.isIPV6===!0||o.isIPVFuture===!0?r=`[${o.escapedHost}]`:r=_ae(r,!1)}e.push(r)}if(typeof t.port=="number"||typeof t.port=="string"){let r=String(t.port);if(!ODe(r))throw new TypeError("URI port is malformed.");e.push(":"),e.push(r)}return e.length?e.join(""):void 0}kae.exports={nonSimpleDomain:UDe,recomposeAuthority:QDe,reescapeHostDelimiters:_ae,normalizePercentEncoding:Sae,normalizePathEncoding:ZDe,serializePathEncoding:WDe,normalizeQueryFragmentEncoding:XDe,encodeUserinfo:xae,encodeQuery:JDe,encodeFragment:GDe,escapePreservingEscapes:YDe,removeDotSegments:HDe,isIPv4:KL,isUUID:CDe,normalizeIPv6:BL,stringArrayToHexStripped:DDe}});var Pae=R((f0t,Tae)=>{"use strict";var{isUUID:eze}=JL(),tze=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,rze=["http","https","ws","wss","urn","urn:uuid"];function nze(t){return rze.indexOf(t)!==-1}function GL(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function Iae(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function $ae(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function oze(t){return t.secure=GL(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function ize(t){if((t.port===(GL(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let e=t.resourceName.indexOf("?"),r=e===-1?t.resourceName:t.resourceName.slice(0,e);t.path=r&&r!=="/"?r:void 0,t.query=e===-1?void 0:t.resourceName.slice(e+1),t.resourceName=void 0}return t.fragment=void 0,t}function sze(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(tze);if(r&&r[0]===t.path){let o=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${o}:${e.nid||t.nid}`,i=XL(n);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function aze(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),n=`${r}:${e.nid||o}`,i=XL(n);i&&(t=i.serialize(t,e));let s=t,a=t.nss;return s.path=`${o||e.nid}:${a}`,e.skipEscape=!0,s}function cze(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!eze(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function uze(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Aae={scheme:"http",domainHost:!0,parse:Iae,serialize:$ae},lze={scheme:"https",domainHost:Aae.domainHost,parse:Iae,serialize:$ae},hT={scheme:"ws",domainHost:!0,parse:oze,serialize:ize},dze={scheme:"wss",domainHost:hT.domainHost,parse:hT.parse,serialize:hT.serialize},pze={scheme:"urn",parse:sze,serialize:aze,skipNormalize:!0},fze={scheme:"urn:uuid",parse:cze,serialize:uze,skipNormalize:!0},gT={http:Aae,https:lze,ws:hT,wss:dze,urn:pze,"urn:uuid":fze};Object.setPrototypeOf(gT,null);function XL(t){return t&&(gT[t]||gT[t.toLowerCase()])||void 0}Tae.exports={wsIsSecure:GL,SCHEMES:gT,isValidSchemeName:nze,getSchemeHandler:XL}});var Hae=R((m0t,wT)=>{"use strict";var{normalizeIPv6:Dae,removeDotSegments:Nw,recomposeAuthority:mze,normalizePercentEncoding:YL,normalizePathEncoding:hze,serializePathEncoding:Rae,normalizeQueryFragmentEncoding:Cae,encodeQuery:gze,encodeFragment:yze,reescapeHostDelimiters:vze,isIPv4:zae,nonSimpleDomain:wze}=JL(),{SCHEMES:jae,getSchemeHandler:QL}=Pae(),Mae=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Uae="URI scheme is malformed.";function Oae(t){let e=unescape(String(t));if(!Mae.test(e))throw new TypeError(Uae);return e}function bze(t,e){return typeof t=="string"?t=Aze(t,e):typeof t=="object"&&(t=vT(Yl(t,e),e)),t}function _ze(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:i,malformedPercentEncoding:s,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=yT(t,o),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:m,malformedScheme:g}=yT(e,o);if(i||d||s||f||a||p||c||m||u||g)throw new Error(n.error||l.error||"URI is malformed.");let y=Lae(n,l,o,!0),w=QL(r&&r.scheme||y.scheme),b=y.host,_=b!==void 0&&b!==""&&(zae(b)||Dae(b).isIPV6);Fae(y,r||{},w,_);let k=b&&b.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(b);if(y.error&&!k)throw new Error(y.error);return o.skipEscape=!0,Yl(y,o)}function Lae(t,e,r,o){let n={};return o||(t=vT(Yl(t,r),r),e=vT(Yl(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Nw(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Nw(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=Nw(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=Nw(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function Sze(t,e,r){let o=Nae(t,r),n=Nae(e,r);return o!==void 0&&n!==void 0&&o===n}function Yl(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},e),n=[];r.scheme&&(r.scheme=Oae(r.scheme));let i=QL(o.scheme||r.scheme);i&&i.serialize&&i.serialize(r,o);let s=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!o.skipEscape&&r.scheme===void 0&&!s;r.path!==void 0&&(o.skipEscape?r.path=YL(r.path):r.path=Rae(r.path,a)),o.reference!=="suffix"&&r.scheme&&(r.scheme=Oae(r.scheme),n.push(r.scheme,":"));let c=mze(r);if(c!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(c),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let u=r.path;!o.absolutePath&&(!i||!i.absolutePath)&&(u=Nw(u)),a&&(u=Rae(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),n.push(u)}return r.query!==void 0&&n.push("?",gze(r.query)),r.fragment!==void 0&&n.push("#",yze(r.fragment)),n.join("")}var xze=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Eze=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,kze=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Ize(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function Ow(t){if(t===void 0)return!1;let e=t.indexOf("%");for(;e!==-1;){if(e+2>=t.length||!/^[\da-f]{2}$/iu.test(t.slice(e+1,e+3)))return!0;e=t.indexOf("%",e+3)}return!1}function e2(t){return t[0]==="["&&t[t.length-1]==="]"}function $ze(t){let e=t[4];return Ow(t[3])||e!==void 0&&!e2(e)&&Ow(e)||Ow(t[6])||Ow(t[7])||Ow(t[8])}function Fae(t,e,r,o){if(!e.unicodeSupport&&(!r||!r.unicodeSupport)&&t.host&&!e2(t.host)&&(e.domainHost||r&&r.domainHost)&&o===!1&&wze(t.host))try{t.host=new URL("http://"+t.host).hostname}catch(n){return t.error=t.error||"Host's domain name can not be converted to ASCII: "+n,!0}return!1}function yT(t,e){let r=Object.assign({},e),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,i=!1,s=!1,a=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let d=t.match(Eze);d!==null&&d[1].indexOf("\\")!==-1&&(o.error="URI authority must not contain a literal backslash.",n=!0);let f=t.match(kze);if(f!==null){let m=f[1],g=m.replace(/[\t\n\r]/g,"");g.length>=2&&(g.slice(0,2)!=="//"?(o.error=o.error||"URI authority must not contain a literal backslash.",n=!0):m.length!==g.length&&(o.error=o.error||"URI authority introducer must not contain whitespace.",n=!0))}let p=t.match(xze);if(p){if(o.scheme=p[1],o.userinfo=p[3],o.host=p[4],o.port=parseInt(p[5],10),o.path=p[6]||"",o.query=p[7],o.fragment=p[8],o.scheme!==void 0){let y=unescape(o.scheme);Mae.test(y)?o.scheme=y.toLowerCase():(o.error=o.error||Uae,u=!0)}i=$ze(p),i&&(o.error=o.error||"URI contains malformed percent-encoding."),isNaN(o.port)&&(o.port=p[5]);let m=Ize(o,p);if(m!==void 0&&(o.error=o.error||m,n=!0),o.host)if(zae(o.host)===!1){let w=e2(o.host),b=o.host.indexOf("[")!==-1||o.host.indexOf("]")!==-1,_=Dae(o.host);l=_.isIPV6||_.isIPVFuture===!0,c=b&&(!w||_.error===!0),o.host=l?_.host:_.host.toLowerCase(),c&&(o.error=o.error||"URI host is malformed.",n=!0)}else l=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let g=QL(r.scheme||o.scheme);if(c||(a=Fae(o,r,g,l)),t.indexOf("%")!==-1&&o.host!==void 0&&!c){let y=l?o.host:YL(o.host,!0);l||(y=YL(y.toLowerCase())),o.host=vze(y,l)}(!g||g&&!g.skipNormalize)&&(o.path&&(o.path=hze(o.path)),o.query&&(o.query=Cae(o.query)),o.fragment&&(o.fragment=Cae(o.fragment))),g&&g.parse&&(g.parse(o,r),g===jae.urn&&o.nid===void 0&&(s=!0))}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:s,malformedHost:a,malformedScheme:u}}function vT(t,e){return yT(t,e).parsed}function Aze(t,e){return Vae(t,e).normalized}function Vae(t,e){let{parsed:r,malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:i,malformedHost:s,malformedScheme:a}=yT(t,e);return{normalized:o||n||i||s||a?t:Yl(r,e),malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:i,malformedHost:s,malformedScheme:a}}function Nae(t,e){if(typeof t!="string"&&typeof t!="object")return;let r;try{r=typeof t=="string"?t:Yl(t,e)}catch{return}let{normalized:o,malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:s,malformedHost:a,malformedScheme:c}=Vae(r,e);return n||i||s||a||c?void 0:o}var t2={SCHEMES:jae,normalize:bze,resolve:_ze,resolveComponent:Lae,equal:Sze,serialize:Yl,parse:vT};wT.exports=t2;wT.exports.default=t2;wT.exports.fastUri=t2});var Kae=R(r2=>{"use strict";Object.defineProperty(r2,"__esModule",{value:!0});var Bae=Hae();Bae.code='require("ajv/dist/runtime/uri").default';r2.default=Bae});var Qae=R(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.CodeGen=Mr.Name=Mr.nil=Mr.stringify=Mr.str=Mr._=Mr.KeywordCxt=void 0;var Tze=Rw();Object.defineProperty(Mr,"KeywordCxt",{enumerable:!0,get:function(){return Tze.KeywordCxt}});var Pm=ke();Object.defineProperty(Mr,"_",{enumerable:!0,get:function(){return Pm._}});Object.defineProperty(Mr,"str",{enumerable:!0,get:function(){return Pm.str}});Object.defineProperty(Mr,"stringify",{enumerable:!0,get:function(){return Pm.stringify}});Object.defineProperty(Mr,"nil",{enumerable:!0,get:function(){return Pm.nil}});Object.defineProperty(Mr,"Name",{enumerable:!0,get:function(){return Pm.Name}});Object.defineProperty(Mr,"CodeGen",{enumerable:!0,get:function(){return Pm.CodeGen}});var Pze=pT(),Gae=Cw(),Rze=EL(),Dw=mT(),Cze=ke(),zw=Aw(),bT=$w(),o2=Be(),qae=vae(),Oze=Kae(),Xae=(t,e)=>new RegExp(t,e);Xae.code="new RegExp";var Nze=["removeAdditional","useDefaults","coerceTypes"],Dze=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),zze={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},jze={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Zae=200;function Mze(t){var e,r,o,n,i,s,a,c,u,l,d,f,p,m,g,y,w,b,_,k,$,D,K,te,Ie;let xe=t.strict,Qe=(e=t.code)===null||e===void 0?void 0:e.optimize,Fe=Qe===!0||Qe===void 0?1:Qe||0,$e=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:Xae,J=(n=t.uriResolver)!==null&&n!==void 0?n:Oze.default;return{strictSchema:(s=(i=t.strictSchema)!==null&&i!==void 0?i:xe)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:xe)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:xe)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:xe)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:xe)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Fe,regExp:$e}:{optimize:Fe,regExp:$e},loopRequired:(g=t.loopRequired)!==null&&g!==void 0?g:Zae,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:Zae,meta:(w=t.meta)!==null&&w!==void 0?w:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(_=t.inlineRefs)!==null&&_!==void 0?_:!0,schemaId:(k=t.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:($=t.addUsedSchema)!==null&&$!==void 0?$:!0,validateSchema:(D=t.validateSchema)!==null&&D!==void 0?D:!0,validateFormats:(K=t.validateFormats)!==null&&K!==void 0?K:!0,unicodeRegExp:(te=t.unicodeRegExp)!==null&&te!==void 0?te:!0,int32range:(Ie=t.int32range)!==null&&Ie!==void 0?Ie:!0,uriResolver:J}}var jw=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Mze(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new Cze.ValueScope({scope:{},prefixes:Dze,es5:r,lines:o}),this.logger=Bze(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Rze.getRules)(),Wae.call(this,zze,e,"NOT SUPPORTED"),Wae.call(this,jze,e,"DEPRECATED","warn"),this._metaOpts=Vze.call(this),e.formats&&Lze.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Fze.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Uze.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=qae;o==="id"&&(n={...qae},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let o;if(typeof e=="string"){if(o=this.getSchema(e),!o)throw new Error(`no schema with key or ref "${e}"`)}else o=this.compile(e);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(e,r){let o=this._addSchema(e,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,e,r);async function n(l,d){await i.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||s.call(this,f)}async function i(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Gae.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(e,r,o,n=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,o,n);return this}let i;if(typeof e=="object"){let{schemaId:s}=this.opts;if(i=e[s],i!==void 0&&typeof i!="string")throw new Error(`schema ${s} must be string`)}return r=(0,zw.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,o,r,n,!0),this}addMetaSchema(e,r,o=this.opts.validateSchema){return this.addSchema(e,r,!0,o),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let o;if(o=e.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,e);if(!n&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return n}getSchema(e){let r;for(;typeof(r=Jae.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new Dw.SchemaEnv({schema:{},schemaId:o});if(r=Dw.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Jae.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let o=e[this.opts.schemaId];return o&&(o=(0,zw.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let o;if(typeof e=="string")o=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof e=="object"&&r===void 0){if(r=e,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(qze.call(this,o,r),!r)return(0,o2.eachItem)(o,i=>n2.call(this,i)),this;Wze.call(this,r);let n={...r,type:(0,bT.getJSONTypes)(r.type),schemaType:(0,bT.getJSONTypes)(r.schemaType)};return(0,o2.eachItem)(o,n.type.length===0?i=>n2.call(this,i,n):i=>n.type.forEach(s=>n2.call(this,i,n,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let o of r.rules){let n=o.rules.findIndex(i=>i.keyword===e);n>=0&&o.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,i)=>n+r+i)}$dataMetaSchema(e,r){let o=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let i=n.split("/").slice(1),s=e;for(let a of i)s=s[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=s[a];u&&l&&(s[a]=Yae(l))}}return e}_removeAllSchemas(e,r){for(let o in e){let n=e[o];(!r||r.test(o))&&(typeof n=="string"?delete e[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[o]))}}_addSchema(e,r,o,n=this.opts.validateSchema,i=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;o=(0,zw.normalizeId)(s||o);let u=zw.getSchemaRefs.call(this,e,o);return c=new Dw.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),i&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Dw.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Dw.compileSchema.call(this,e)}finally{this.opts=r}}};jw.ValidationError=Pze.default;jw.MissingRefError=Gae.default;Mr.default=jw;function Wae(t,e,r,o="error"){for(let n in t){let i=n;i in e&&this.logger[o](`${r}: option ${n}. ${t[i]}`)}}function Jae(t){return t=(0,zw.normalizeId)(t),this.schemas[t]||this.refs[t]}function Uze(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function Lze(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Fze(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function Vze(){let t={...this.opts};for(let e of Nze)delete t[e];return t}var Hze={log(){},warn(){},error(){}};function Bze(t){if(t===!1)return Hze;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Kze=/^[a-z_$][a-z0-9_$:-]*$/i;function qze(t,e){let{RULES:r}=this;if((0,o2.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!Kze.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function n2(t,e,r){var o;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=n?i.post:i.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,bT.getJSONTypes)(e.type),schemaType:(0,bT.getJSONTypes)(e.schemaType)}};e.before?Zze.call(this,s,a,e.before):s.rules.push(a),i.all[t]=a,(o=e.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function Zze(t,e,r){let o=t.rules.findIndex(n=>n.keyword===r);o>=0?t.rules.splice(o,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Wze(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Yae(e)),t.validateSchema=this.compile(e,!0))}var Jze={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Yae(t){return{anyOf:[t,Jze]}}});var ece=R(i2=>{"use strict";Object.defineProperty(i2,"__esModule",{value:!0});var Gze={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};i2.default=Gze});var oce=R(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});Ql.callRef=Ql.getValidate=void 0;var Xze=Cw(),tce=Jo(),Vn=ke(),Rm=Ma(),rce=mT(),_T=Be(),Yze={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:o}=t,{baseId:n,schemaEnv:i,validateName:s,opts:a,self:c}=o,{root:u}=i;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=rce.resolveRef.call(c,u,n,r);if(l===void 0)throw new Xze.default(o.opts.uriResolver,n,r);if(l instanceof rce.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return ST(t,s,i,i.$async);let m=e.scopeValue("root",{ref:u});return ST(t,(0,Vn._)`${m}.validate`,u,u.$async)}function f(m){let g=nce(t,m);ST(t,g,m,m.$async)}function p(m){let g=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Vn.stringify)(m)}:{ref:m}),y=e.name("valid"),w=t.subschema({schema:m,dataTypes:[],schemaPath:Vn.nil,topSchemaRef:g,errSchemaPath:r},y);t.mergeEvaluated(w),t.ok(y)}}};function nce(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Vn._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Ql.getValidate=nce;function ST(t,e,r,o){let{gen:n,it:i}=t,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?Rm.default.this:Vn.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,Vn._)`await ${(0,tce.callValidateCode)(t,e,u)}`),p(e),s||n.assign(m,!0)},g=>{n.if((0,Vn._)`!(${g} instanceof ${i.ValidationError})`,()=>n.throw(g)),f(g),s||n.assign(m,!1)}),t.ok(m)}function d(){t.result((0,tce.callValidateCode)(t,e,u),()=>p(e),()=>f(e))}function f(m){let g=(0,Vn._)`${m}.errors`;n.assign(Rm.default.vErrors,(0,Vn._)`${Rm.default.vErrors} === null ? ${g} : ${Rm.default.vErrors}.concat(${g})`),n.assign(Rm.default.errors,(0,Vn._)`${Rm.default.vErrors}.length`)}function p(m){var g;if(!i.opts.unevaluated)return;let y=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(i.props=_T.mergeEvaluated.props(n,y.props,i.props));else{let w=n.var("props",(0,Vn._)`${m}.evaluated.props`);i.props=_T.mergeEvaluated.props(n,w,i.props,Vn.Name)}if(i.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(i.items=_T.mergeEvaluated.items(n,y.items,i.items));else{let w=n.var("items",(0,Vn._)`${m}.evaluated.items`);i.items=_T.mergeEvaluated.items(n,w,i.items,Vn.Name)}}}Ql.callRef=ST;Ql.default=Yze});var ice=R(s2=>{"use strict";Object.defineProperty(s2,"__esModule",{value:!0});var Qze=ece(),e1e=oce(),t1e=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Qze.default,e1e.default];s2.default=t1e});var sce=R(a2=>{"use strict";Object.defineProperty(a2,"__esModule",{value:!0});var xT=ke(),Eu=xT.operators,ET={maximum:{okStr:"<=",ok:Eu.LTE,fail:Eu.GT},minimum:{okStr:">=",ok:Eu.GTE,fail:Eu.LT},exclusiveMaximum:{okStr:"<",ok:Eu.LT,fail:Eu.GTE},exclusiveMinimum:{okStr:">",ok:Eu.GT,fail:Eu.LTE}},r1e={message:({keyword:t,schemaCode:e})=>(0,xT.str)`must be ${ET[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,xT._)`{comparison: ${ET[t].okStr}, limit: ${e}}`},n1e={keyword:Object.keys(ET),type:"number",schemaType:"number",$data:!0,error:r1e,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,xT._)`${r} ${ET[e].fail} ${o} || isNaN(${r})`)}};a2.default=n1e});var ace=R(c2=>{"use strict";Object.defineProperty(c2,"__esModule",{value:!0});var Mw=ke(),o1e={message:({schemaCode:t})=>(0,Mw.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Mw._)`{multipleOf: ${t}}`},i1e={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:o1e,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,i=n.opts.multipleOfPrecision,s=e.let("res"),a=i?(0,Mw._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,Mw._)`${s} !== parseInt(${s})`;t.fail$data((0,Mw._)`(${o} === 0 || (${s} = ${r}/${o}, ${a}))`)}};c2.default=i1e});var uce=R(u2=>{"use strict";Object.defineProperty(u2,"__esModule",{value:!0});function cce(t){let e=t.length,r=0,o=0,n;for(;o<e;)r++,n=t.charCodeAt(o++),n>=55296&&n<=56319&&o<e&&(n=t.charCodeAt(o),(n&64512)===56320&&o++);return r}u2.default=cce;cce.code='require("ajv/dist/runtime/ucs2length").default'});var lce=R(l2=>{"use strict";Object.defineProperty(l2,"__esModule",{value:!0});var ed=ke(),s1e=Be(),a1e=uce(),c1e={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,ed.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,ed._)`{limit: ${t}}`},u1e={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:c1e,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,i=e==="maxLength"?ed.operators.GT:ed.operators.LT,s=n.opts.unicode===!1?(0,ed._)`${r}.length`:(0,ed._)`${(0,s1e.useFunc)(t.gen,a1e.default)}(${r})`;t.fail$data((0,ed._)`${s} ${i} ${o}`)}};l2.default=u1e});var dce=R(d2=>{"use strict";Object.defineProperty(d2,"__esModule",{value:!0});var l1e=Jo(),d1e=Be(),Cm=ke(),p1e={message:({schemaCode:t})=>(0,Cm.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Cm._)`{pattern: ${t}}`},f1e={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:p1e,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:i,it:s}=t,a=s.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=s.opts.code,u=c.code==="new RegExp"?(0,Cm._)`new RegExp`:(0,d1e.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Cm._)`${u}(${i}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Cm._)`!${l}`)}else{let c=(0,l1e.usePattern)(t,n);t.fail$data((0,Cm._)`!${c}.test(${r})`)}}};d2.default=f1e});var pce=R(p2=>{"use strict";Object.defineProperty(p2,"__esModule",{value:!0});var Uw=ke(),m1e={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Uw.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Uw._)`{limit: ${t}}`},h1e={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:m1e,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?Uw.operators.GT:Uw.operators.LT;t.fail$data((0,Uw._)`Object.keys(${r}).length ${n} ${o}`)}};p2.default=h1e});var fce=R(f2=>{"use strict";Object.defineProperty(f2,"__esModule",{value:!0});var Lw=Jo(),Fw=ke(),g1e=Be(),y1e={message:({params:{missingProperty:t}})=>(0,Fw.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Fw._)`{missingProperty: ${t}}`},v1e={keyword:"required",type:"object",schemaType:"array",$data:!0,error:y1e,code(t){let{gen:e,schema:r,schemaCode:o,data:n,$data:i,it:s}=t,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():l(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let g of r)if(p?.[g]===void 0&&!m.has(g)){let y=s.schemaEnv.baseId+s.errSchemaPath,w=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,g1e.checkStrictMode)(s,w,s.opts.strictRequired)}}function u(){if(c||i)t.block$data(Fw.nil,d);else for(let p of r)(0,Lw.checkReportMissingProp)(t,p)}function l(){let p=e.let("missing");if(c||i){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Lw.checkMissingProp)(t,r,p)),(0,Lw.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",o,p=>{t.setParams({missingProperty:p}),e.if((0,Lw.noPropertyInData)(e,n,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,o,()=>{e.assign(m,(0,Lw.propertyInData)(e,n,p,a.ownProperties)),e.if((0,Fw.not)(m),()=>{t.error(),e.break()})},Fw.nil)}}};f2.default=v1e});var mce=R(m2=>{"use strict";Object.defineProperty(m2,"__esModule",{value:!0});var Vw=ke(),w1e={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Vw.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Vw._)`{limit: ${t}}`},b1e={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:w1e,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?Vw.operators.GT:Vw.operators.LT;t.fail$data((0,Vw._)`${r}.length ${n} ${o}`)}};m2.default=b1e});var kT=R(h2=>{"use strict";Object.defineProperty(h2,"__esModule",{value:!0});var hce=CL();hce.code='require("ajv/dist/runtime/equal").default';h2.default=hce});var gce=R(y2=>{"use strict";Object.defineProperty(y2,"__esModule",{value:!0});var g2=$w(),Ur=ke(),_1e=Be(),S1e=kT(),x1e={message:({params:{i:t,j:e}})=>(0,Ur.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Ur._)`{i: ${t}, j: ${e}}`},E1e={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:x1e,code(t){let{gen:e,data:r,$data:o,schema:n,parentSchema:i,schemaCode:s,it:a}=t;if(!o&&!n)return;let c=e.let("valid"),u=i.items?(0,g2.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Ur._)`${s} === false`),t.ok(c);function l(){let m=e.let("i",(0,Ur._)`${r}.length`),g=e.let("j");t.setParams({i:m,j:g}),e.assign(c,!0),e.if((0,Ur._)`${m} > 1`,()=>(d()?f:p)(m,g))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,g){let y=e.name("item"),w=(0,g2.checkDataTypes)(u,y,a.opts.strictNumbers,g2.DataType.Wrong),b=e.const("indices",(0,Ur._)`{}`);e.for((0,Ur._)`;${m}--;`,()=>{e.let(y,(0,Ur._)`${r}[${m}]`),e.if(w,(0,Ur._)`continue`),u.length>1&&e.if((0,Ur._)`typeof ${y} == "string"`,(0,Ur._)`${y} += "_"`),e.if((0,Ur._)`typeof ${b}[${y}] == "number"`,()=>{e.assign(g,(0,Ur._)`${b}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,Ur._)`${b}[${y}] = ${m}`)})}function p(m,g){let y=(0,_1e.useFunc)(e,S1e.default),w=e.name("outer");e.label(w).for((0,Ur._)`;${m}--;`,()=>e.for((0,Ur._)`${g} = ${m}; ${g}--;`,()=>e.if((0,Ur._)`${y}(${r}[${m}], ${r}[${g}])`,()=>{t.error(),e.assign(c,!1).break(w)})))}}};y2.default=E1e});var yce=R(w2=>{"use strict";Object.defineProperty(w2,"__esModule",{value:!0});var v2=ke(),k1e=Be(),I1e=kT(),$1e={message:"must be equal to constant",params:({schemaCode:t})=>(0,v2._)`{allowedValue: ${t}}`},A1e={keyword:"const",$data:!0,error:$1e,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:i}=t;o||i&&typeof i=="object"?t.fail$data((0,v2._)`!${(0,k1e.useFunc)(e,I1e.default)}(${r}, ${n})`):t.fail((0,v2._)`${i} !== ${r}`)}};w2.default=A1e});var vce=R(b2=>{"use strict";Object.defineProperty(b2,"__esModule",{value:!0});var Hw=ke(),T1e=Be(),P1e=kT(),R1e={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Hw._)`{allowedValues: ${t}}`},C1e={keyword:"enum",schemaType:"array",$data:!0,error:R1e,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:i,it:s}=t;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,T1e.useFunc)(e,P1e.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let p=e.const("vSchema",i);l=(0,Hw.or)(...n.map((m,g)=>f(p,g)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,p=>e.if((0,Hw._)`${u()}(${r}, ${p})`,()=>e.assign(l,!0).break()))}function f(p,m){let g=n[m];return typeof g=="object"&&g!==null?(0,Hw._)`${u()}(${r}, ${p}[${m}])`:(0,Hw._)`${r} === ${g}`}}};b2.default=C1e});var wce=R(_2=>{"use strict";Object.defineProperty(_2,"__esModule",{value:!0});var O1e=sce(),N1e=ace(),D1e=lce(),z1e=dce(),j1e=pce(),M1e=fce(),U1e=mce(),L1e=gce(),F1e=yce(),V1e=vce(),H1e=[O1e.default,N1e.default,D1e.default,z1e.default,j1e.default,M1e.default,U1e.default,L1e.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},F1e.default,V1e.default];_2.default=H1e});var x2=R(Bw=>{"use strict";Object.defineProperty(Bw,"__esModule",{value:!0});Bw.validateAdditionalItems=void 0;var td=ke(),S2=Be(),B1e={message:({params:{len:t}})=>(0,td.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,td._)`{limit: ${t}}`},K1e={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:B1e,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,S2.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}bce(t,o)}};function bce(t,e){let{gen:r,schema:o,data:n,keyword:i,it:s}=t;s.items=!0;let a=r.const("len",(0,td._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,td._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,S2.alwaysValidSchema)(s,o)){let u=r.var("valid",(0,td._)`${a} <= ${e.length}`);r.if((0,td.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:S2.Type.Num},u),s.allErrors||r.if((0,td.not)(u),()=>r.break())})}}Bw.validateAdditionalItems=bce;Bw.default=K1e});var E2=R(Kw=>{"use strict";Object.defineProperty(Kw,"__esModule",{value:!0});Kw.validateTuple=void 0;var _ce=ke(),IT=Be(),q1e=Jo(),Z1e={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Sce(t,"additionalItems",e);r.items=!0,!(0,IT.alwaysValidSchema)(r,e)&&t.ok((0,q1e.validateArray)(t))}};function Sce(t,e,r=t.schema){let{gen:o,parentSchema:n,data:i,keyword:s,it:a}=t;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=IT.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,_ce._)`${i}.length`);r.forEach((d,f)=>{(0,IT.alwaysValidSchema)(a,d)||(o.if((0,_ce._)`${u} > ${f}`,()=>t.subschema({keyword:s,schemaProp:f,dataProp:f},c)),t.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=a,m=r.length,g=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!g){let y=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,IT.checkStrictMode)(a,y,f.strictTuples)}}}Kw.validateTuple=Sce;Kw.default=Z1e});var xce=R(k2=>{"use strict";Object.defineProperty(k2,"__esModule",{value:!0});var W1e=E2(),J1e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,W1e.validateTuple)(t,"items")};k2.default=J1e});var kce=R(I2=>{"use strict";Object.defineProperty(I2,"__esModule",{value:!0});var Ece=ke(),G1e=Be(),X1e=Jo(),Y1e=x2(),Q1e={message:({params:{len:t}})=>(0,Ece.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ece._)`{limit: ${t}}`},eje={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Q1e,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,G1e.alwaysValidSchema)(o,e)&&(n?(0,Y1e.validateAdditionalItems)(t,n):t.ok((0,X1e.validateArray)(t)))}};I2.default=eje});var Ice=R($2=>{"use strict";Object.defineProperty($2,"__esModule",{value:!0});var Xo=ke(),$T=Be(),tje={message:({params:{min:t,max:e}})=>e===void 0?(0,Xo.str)`must contain at least ${t} valid item(s)`:(0,Xo.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Xo._)`{minContains: ${t}}`:(0,Xo._)`{minContains: ${t}, maxContains: ${e}}`},rje={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:tje,code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:i}=t,s,a,{minContains:c,maxContains:u}=o;i.opts.next?(s=c===void 0?1:c,a=u):s=1;let l=e.const("len",(0,Xo._)`${n}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,$T.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,$T.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,$T.alwaysValidSchema)(i,r)){let g=(0,Xo._)`${l} >= ${s}`;a!==void 0&&(g=(0,Xo._)`${g} && ${l} <= ${a}`),t.pass(g);return}i.items=!0;let d=e.name("valid");a===void 0&&s===1?p(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,Xo._)`${n}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let g=e.name("_valid"),y=e.let("count",0);p(g,()=>e.if(g,()=>m(y)))}function p(g,y){e.forRange("i",0,l,w=>{t.subschema({keyword:"contains",dataProp:w,dataPropType:$T.Type.Num,compositeRule:!0},g),y()})}function m(g){e.code((0,Xo._)`${g}++`),a===void 0?e.if((0,Xo._)`${g} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,Xo._)`${g} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,Xo._)`${g} >= ${s}`,()=>e.assign(d,!0)))}}};$2.default=rje});var Tce=R(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.validateSchemaDeps=Gs.validatePropertyDeps=Gs.error=void 0;var A2=ke(),nje=Be(),qw=Jo();Gs.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,A2.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,A2._)`{property: ${t},
64
+ || ${s} === "boolean" || ${n} === null`).assign(a,(0,_e._)`[${n}]`)}}}function yNe({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,_e._)`${e} !== undefined`,()=>t.assign((0,_e._)`${e}[${r}]`,o))}function IL(t,e,r,o=Im.Correct){let n=o===Im.Correct?_e.operators.EQ:_e.operators.NEQ,i;switch(t){case"null":return(0,_e._)`${e} ${n} null`;case"array":i=(0,_e._)`Array.isArray(${e})`;break;case"object":i=(0,_e._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=s((0,_e._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=s();break;default:return(0,_e._)`typeof ${e} ${n} ${t}`}return o===Im.Correct?i:(0,_e.not)(i);function s(a=_e.nil){return(0,_e.and)((0,_e._)`typeof ${e} == "number"`,a,r?(0,_e._)`isFinite(${e})`:_e.nil)}}on.checkDataType=IL;function $L(t,e,r,o){if(t.length===1)return IL(t[0],e,r,o);let n,i=(0,Mse.toHash)(t);if(i.array&&i.object){let s=(0,_e._)`typeof ${e} != "object"`;n=i.null?s:(0,_e._)`!${e} || ${s}`,delete i.null,delete i.array,delete i.object}else n=_e.nil;i.number&&delete i.integer;for(let s in i)n=(0,_e.and)(n,IL(s,e,r,o));return n}on.checkDataTypes=$L;var vNe={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,_e._)`{type: ${t}}`:(0,_e._)`{type: ${e}}`};function AL(t){let e=wNe(t);(0,pNe.reportError)(e,vNe)}on.reportTypeError=AL;function wNe(t){let{gen:e,data:r,schema:o}=t,n=(0,Mse.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var Vse=R(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});cT.assignDefaults=void 0;var $m=ke(),bNe=Be();function _Ne(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)Fse(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,i)=>Fse(t,i,n.default))}cT.assignDefaults=_Ne;function Fse(t,e,r){let{gen:o,compositeRule:n,data:i,opts:s}=t;if(r===void 0)return;let a=(0,$m._)`${i}${(0,$m.getProperty)(e)}`;if(n){(0,bNe.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,$m._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,$m._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,$m._)`${a} = ${(0,$m.stringify)(r)}`)}});var Jo=R(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.validateUnion=ft.validateArray=ft.usePattern=ft.callValidateCode=ft.schemaProperties=ft.allSchemaProperties=ft.noPropertyInData=ft.propertyInData=ft.isOwnProperty=ft.hasPropFunc=ft.reportMissingProp=ft.checkMissingProp=ft.checkReportMissingProp=void 0;var $t=ke(),TL=Be(),bu=Ma(),SNe=Be();function xNe(t,e){let{gen:r,data:o,it:n}=t;r.if(RL(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,$t._)`${e}`},!0),t.error()})}ft.checkReportMissingProp=xNe;function ENe({gen:t,data:e,it:{opts:r}},o,n){return(0,$t.or)(...o.map(i=>(0,$t.and)(RL(t,e,i,r.ownProperties),(0,$t._)`${n} = ${i}`)))}ft.checkMissingProp=ENe;function kNe(t,e){t.setParams({missingProperty:e},!0),t.error()}ft.reportMissingProp=kNe;function Hse(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,$t._)`Object.prototype.hasOwnProperty`})}ft.hasPropFunc=Hse;function PL(t,e,r){return(0,$t._)`${Hse(t)}.call(${e}, ${r})`}ft.isOwnProperty=PL;function INe(t,e,r,o){let n=(0,$t._)`${e}${(0,$t.getProperty)(r)} !== undefined`;return o?(0,$t._)`${n} && ${PL(t,e,r)}`:n}ft.propertyInData=INe;function RL(t,e,r,o){let n=(0,$t._)`${e}${(0,$t.getProperty)(r)} === undefined`;return o?(0,$t.or)(n,(0,$t.not)(PL(t,e,r))):n}ft.noPropertyInData=RL;function Bse(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ft.allSchemaProperties=Bse;function $Ne(t,e){return Bse(e).filter(r=>!(0,TL.alwaysValidSchema)(t,e[r]))}ft.schemaProperties=$Ne;function ANe({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:i},it:s},a,c,u){let l=u?(0,$t._)`${t}, ${e}, ${o}${n}`:e,d=[[bu.default.instancePath,(0,$t.strConcat)(bu.default.instancePath,i)],[bu.default.parentData,s.parentData],[bu.default.parentDataProperty,s.parentDataProperty],[bu.default.rootData,bu.default.rootData]];s.opts.dynamicRef&&d.push([bu.default.dynamicAnchors,bu.default.dynamicAnchors]);let f=(0,$t._)`${l}, ${r.object(...d)}`;return c!==$t.nil?(0,$t._)`${a}.call(${c}, ${f})`:(0,$t._)`${a}(${f})`}ft.callValidateCode=ANe;var TNe=(0,$t._)`new RegExp`;function PNe({gen:t,it:{opts:e}},r){let o=e.unicodeRegExp?"u":"",{regExp:n}=e.code,i=n(r,o);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,$t._)`${n.code==="new RegExp"?TNe:(0,SNe.useFunc)(t,n)}(${r}, ${o})`})}ft.usePattern=PNe;function RNe(t){let{gen:e,data:r,keyword:o,it:n}=t,i=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(i,!0),s(()=>e.break()),i;function s(a){let c=e.const("len",(0,$t._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:TL.Type.Num},i),e.if((0,$t.not)(i),a)})}}ft.validateArray=RNe;function CNe(t){let{gen:e,schema:r,keyword:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,TL.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);e.assign(s,(0,$t._)`${s} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,$t.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}ft.validateUnion=CNe});var Zse=R(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.validateKeywordUsage=Ws.validSchemaType=Ws.funcKeywordCode=Ws.macroKeywordCode=void 0;var Sn=ke(),Jl=Ma(),ONe=Jo(),NNe=Iw();function DNe(t,e){let{gen:r,keyword:o,schema:n,parentSchema:i,it:s}=t,a=e.macro.call(s.self,n,i,s),c=qse(r,o,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:Sn.nil,errSchemaPath:`${s.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Ws.macroKeywordCode=DNe;function zNe(t,e){var r;let{gen:o,keyword:n,schema:i,parentSchema:s,$data:a,it:c}=t;MNe(c,e);let u=!a&&e.compile?e.compile.call(c.self,i,s,c):e.validate,l=qse(o,n,u),d=o.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)g(),e.modifying&&Kse(t),y(()=>t.error());else{let w=e.async?p():m();e.modifying&&Kse(t),y(()=>jNe(t,w))}}function p(){let w=o.let("ruleErrs",null);return o.try(()=>g((0,Sn._)`await `),b=>o.assign(d,!1).if((0,Sn._)`${b} instanceof ${c.ValidationError}`,()=>o.assign(w,(0,Sn._)`${b}.errors`),()=>o.throw(b))),w}function m(){let w=(0,Sn._)`${l}.errors`;return o.assign(w,null),g(Sn.nil),w}function g(w=e.async?(0,Sn._)`await `:Sn.nil){let b=c.opts.passContext?Jl.default.this:Jl.default.self,_=!("compile"in e&&!a||e.schema===!1);o.assign(d,(0,Sn._)`${w}${(0,ONe.callValidateCode)(t,l,b,_)}`,e.modifying)}function y(w){var b;o.if((0,Sn.not)((b=e.valid)!==null&&b!==void 0?b:d),w)}}Ws.funcKeywordCode=zNe;function Kse(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,Sn._)`${o.parentData}[${o.parentDataProperty}]`))}function jNe(t,e){let{gen:r}=t;r.if((0,Sn._)`Array.isArray(${e})`,()=>{r.assign(Jl.default.vErrors,(0,Sn._)`${Jl.default.vErrors} === null ? ${e} : ${Jl.default.vErrors}.concat(${e})`).assign(Jl.default.errors,(0,Sn._)`${Jl.default.vErrors}.length`),(0,NNe.extendErrors)(t)},()=>t.error())}function MNe({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function qse(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Sn.stringify)(r)})}function UNe(t,e,r=!1){return!e.length||e.some(o=>o==="array"?Array.isArray(t):o==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==o||r&&typeof t>"u")}Ws.validSchemaType=UNe;function LNe({schema:t,opts:e,self:r,errSchemaPath:o},n,i){if(Array.isArray(n.keyword)?!n.keyword.includes(i):n.keyword!==i)throw new Error("ajv implementation error");let s=n.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ws.validateKeywordUsage=LNe});var Jse=R(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.extendSubschemaMode=_u.extendSubschemaData=_u.getSubschema=void 0;var Js=ke(),Wse=Be();function FNe(t,{keyword:e,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:i,topSchemaRef:s}){if(e!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Js._)`${t.schemaPath}${(0,Js.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Js._)`${t.schemaPath}${(0,Js.getProperty)(e)}${(0,Js.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Wse.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||i===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}_u.getSubschema=FNe;function VNe(t,e,{dataProp:r,dataPropType:o,data:n,dataTypes:i,propertyName:s}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,f=a.let("data",(0,Js._)`${e.data}${(0,Js.getProperty)(r)}`,!0);c(f),t.errorPath=(0,Js.str)`${u}${(0,Wse.getErrorPath)(r,o,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Js._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Js.Name?n:a.let("data",n,!0);c(u),s!==void 0&&(t.propertyName=s)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}_u.extendSubschemaData=VNe;function HNe(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:i}){o!==void 0&&(t.compositeRule=o),n!==void 0&&(t.createErrors=n),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}_u.extendSubschemaMode=HNe});var CL=R((n0t,Gse)=>{"use strict";Gse.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var o,n,i;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),o=i.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[n]))return!1;for(n=o;n--!==0;){var s=i[n];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var Yse=R((o0t,Xse)=>{"use strict";var Su=Xse.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};uT(e,o,n,t,"",t)};Su.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Su.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Su.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Su.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function uT(t,e,r,o,n,i,s,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){e(o,n,i,s,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in Su.arrayKeywords)for(var f=0;f<d.length;f++)uT(t,e,r,d[f],n+"/"+l+"/"+f,i,n,l,o,f)}else if(l in Su.propsKeywords){if(d&&typeof d=="object")for(var p in d)uT(t,e,r,d[p],n+"/"+l+"/"+BNe(p),i,n,l,o,p)}else(l in Su.keywords||t.allKeys&&!(l in Su.skipKeywords))&&uT(t,e,r,d,n+"/"+l,i,n,l,o)}r(o,n,i,s,a,c,u)}}function BNe(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Aw=R(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.getSchemaRefs=Ln.resolveUrl=Ln.normalizeId=Ln._getFullPath=Ln.getFullPath=Ln.inlineRef=void 0;var KNe=Be(),qNe=CL(),ZNe=Yse(),WNe=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function JNe(t,e=!0){return typeof t=="boolean"?!0:e===!0?!OL(t):e?Qse(t)<=e:!1}Ln.inlineRef=JNe;var GNe=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function OL(t){for(let e in t){if(GNe.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(OL)||typeof r=="object"&&OL(r))return!0}return!1}function Qse(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!WNe.has(r)&&(typeof t[r]=="object"&&(0,KNe.eachItem)(t[r],o=>e+=Qse(o)),e===1/0))return 1/0}return e}function eae(t,e="",r){r!==!1&&(e=Am(e));let o=t.parse(e);return tae(t,o)}Ln.getFullPath=eae;function tae(t,e){return t.serialize(e).split("#")[0]+"#"}Ln._getFullPath=tae;var XNe=/#\/?$/;function Am(t){return t?t.replace(XNe,""):""}Ln.normalizeId=Am;function YNe(t,e,r){return r=Am(r),t.resolve(e,r)}Ln.resolveUrl=YNe;var QNe=/^[a-z_][-a-z0-9._]*$/i;function eDe(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Am(t[r]||e),i={"":n},s=eae(o,n,!1),a={},c=new Set;return ZNe(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let g=s+f,y=i[m];typeof d[r]=="string"&&(y=w.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),i[f]=y;function w(_){let k=this.opts.uriResolver.resolve;if(_=Am(y?k(y,_):_),c.has(_))throw l(_);c.add(_);let $=this.refs[_];return typeof $=="string"&&($=this.refs[$]),typeof $=="object"?u(d,$.schema,_):_!==Am(g)&&(_[0]==="#"?(u(d,a[_],_),a[_]=d):this.refs[_]=g),_}function b(_){if(typeof _=="string"){if(!QNe.test(_))throw new Error(`invalid anchor "${_}"`);w.call(this,`#${_}`)}}}),a;function u(d,f,p){if(f!==void 0&&!qNe(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ln.getSchemaRefs=eDe});var Rw=R(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.getData=xu.KeywordCxt=xu.validateFunctionCode=void 0;var sae=Dse(),rae=$w(),DL=kL(),lT=$w(),tDe=Vse(),Pw=Zse(),NL=Jse(),Q=ke(),pe=Ma(),rDe=Aw(),Ua=Be(),Tw=Iw();function nDe(t){if(uae(t)&&(lae(t),cae(t))){sDe(t);return}aae(t,()=>(0,sae.topBoolOrEmptySchema)(t))}xu.validateFunctionCode=nDe;function aae({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},i){n.code.es5?t.func(e,(0,Q._)`${pe.default.data}, ${pe.default.valCxt}`,o.$async,()=>{t.code((0,Q._)`"use strict"; ${nae(r,n)}`),iDe(t,n),t.code(i)}):t.func(e,(0,Q._)`${pe.default.data}, ${oDe(n)}`,o.$async,()=>t.code(nae(r,n)).code(i))}function oDe(t){return(0,Q._)`{${pe.default.instancePath}="", ${pe.default.parentData}, ${pe.default.parentDataProperty}, ${pe.default.rootData}=${pe.default.data}${t.dynamicRef?(0,Q._)`, ${pe.default.dynamicAnchors}={}`:Q.nil}}={}`}function iDe(t,e){t.if(pe.default.valCxt,()=>{t.var(pe.default.instancePath,(0,Q._)`${pe.default.valCxt}.${pe.default.instancePath}`),t.var(pe.default.parentData,(0,Q._)`${pe.default.valCxt}.${pe.default.parentData}`),t.var(pe.default.parentDataProperty,(0,Q._)`${pe.default.valCxt}.${pe.default.parentDataProperty}`),t.var(pe.default.rootData,(0,Q._)`${pe.default.valCxt}.${pe.default.rootData}`),e.dynamicRef&&t.var(pe.default.dynamicAnchors,(0,Q._)`${pe.default.valCxt}.${pe.default.dynamicAnchors}`)},()=>{t.var(pe.default.instancePath,(0,Q._)`""`),t.var(pe.default.parentData,(0,Q._)`undefined`),t.var(pe.default.parentDataProperty,(0,Q._)`undefined`),t.var(pe.default.rootData,pe.default.data),e.dynamicRef&&t.var(pe.default.dynamicAnchors,(0,Q._)`{}`)})}function sDe(t){let{schema:e,opts:r,gen:o}=t;aae(t,()=>{r.$comment&&e.$comment&&pae(t),dDe(t),o.let(pe.default.vErrors,null),o.let(pe.default.errors,0),r.unevaluated&&aDe(t),dae(t),mDe(t)})}function aDe(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,Q._)`${r}.evaluated`),e.if((0,Q._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,Q._)`${t.evaluated}.props`,(0,Q._)`undefined`)),e.if((0,Q._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,Q._)`${t.evaluated}.items`,(0,Q._)`undefined`))}function nae(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,Q._)`/*# sourceURL=${r} */`:Q.nil}function cDe(t,e){if(uae(t)&&(lae(t),cae(t))){uDe(t,e);return}(0,sae.boolOrEmptySchema)(t,e)}function cae({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function uae(t){return typeof t.schema!="boolean"}function uDe(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&pae(t),pDe(t),fDe(t);let i=o.const("_errs",pe.default.errors);dae(t,i),o.var(e,(0,Q._)`${i} === ${pe.default.errors}`)}function lae(t){(0,Ua.checkUnknownRules)(t),lDe(t)}function dae(t,e){if(t.opts.jtd)return oae(t,[],!1,e);let r=(0,rae.getSchemaTypes)(t.schema),o=(0,rae.coerceAndCheckDataType)(t,r);oae(t,r,!o,e)}function lDe(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,Ua.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function dDe(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ua.checkStrictMode)(t,"default is ignored in the schema root")}function pDe(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,rDe.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function fDe(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function pae({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let i=r.$comment;if(n.$comment===!0)t.code((0,Q._)`${pe.default.self}.logger.log(${i})`);else if(typeof n.$comment=="function"){let s=(0,Q.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,Q._)`${pe.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function mDe(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:i}=t;r.$async?e.if((0,Q._)`${pe.default.errors} === 0`,()=>e.return(pe.default.data),()=>e.throw((0,Q._)`new ${n}(${pe.default.vErrors})`)):(e.assign((0,Q._)`${o}.errors`,pe.default.vErrors),i.unevaluated&&hDe(t),e.return((0,Q._)`${pe.default.errors} === 0`))}function hDe({gen:t,evaluated:e,props:r,items:o}){r instanceof Q.Name&&t.assign((0,Q._)`${e}.props`,r),o instanceof Q.Name&&t.assign((0,Q._)`${e}.items`,o)}function oae(t,e,r,o){let{gen:n,schema:i,data:s,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Ua.schemaHasRulesButRef)(i,l))){n.block(()=>mae(t,"$ref",l.all.$ref.definition));return}c.jtd||gDe(t,e),n.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,DL.shouldUseGroup)(i,f)&&(f.type?(n.if((0,lT.checkDataType)(f.type,s,c.strictNumbers)),iae(t,f),e.length===1&&e[0]===f.type&&r&&(n.else(),(0,lT.reportTypeError)(t)),n.endIf()):iae(t,f),a||n.if((0,Q._)`${pe.default.errors} === ${o||0}`))}}function iae(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,tDe.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,DL.shouldUseRule)(o,i)&&mae(t,i.keyword,i.definition,e.type)})}function gDe(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(yDe(t,e),t.opts.allowUnionTypes||vDe(t,e),wDe(t,t.dataTypes))}function yDe(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{fae(t.dataTypes,r)||zL(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),_De(t,e)}}function vDe(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&zL(t,"use allowUnionTypes to allow union type keyword")}function wDe(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,DL.shouldUseRule)(t.schema,n)){let{type:i}=n.definition;i.length&&!i.some(s=>bDe(e,s))&&zL(t,`missing type "${i.join(",")}" for keyword "${o}"`)}}}function bDe(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function fae(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function _De(t,e){let r=[];for(let o of t.dataTypes)fae(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function zL(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Ua.checkStrictMode)(t,e,t.opts.strictTypes)}var dT=class{constructor(e,r,o){if((0,Pw.validateKeywordUsage)(e,r,o),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=o,this.data=e.data,this.schema=e.schema[o],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ua.schemaRefOrVal)(e,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",hae(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Pw.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",pe.default.errors))}result(e,r,o){this.failResult((0,Q.not)(e),r,o)}failResult(e,r,o){this.gen.if(e),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,Q.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,Q._)`${r} !== undefined && (${(0,Q.or)(this.invalid$data(),e)})`)}error(e,r,o){if(r){this.setParams(r),this._error(e,o),this.setParams({});return}this._error(e,o)}_error(e,r){(e?Tw.reportExtraError:Tw.reportError)(this,this.def.error,r)}$dataError(){(0,Tw.reportError)(this,this.def.$dataError||Tw.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Tw.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,o=Q.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=Q.nil,r=Q.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:i,def:s}=this;o.if((0,Q.or)((0,Q._)`${n} === undefined`,r)),e!==Q.nil&&o.assign(e,!0),(i.length||s.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==Q.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:i}=this;return(0,Q.or)(s(),a());function s(){if(o.length){if(!(r instanceof Q.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,Q._)`${(0,lT.checkDataTypes)(c,r,i.opts.strictNumbers,lT.DataType.Wrong)}`}return Q.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,Q._)`!${c}(${r})`}return Q.nil}}subschema(e,r){let o=(0,NL.getSubschema)(this.it,e);(0,NL.extendSubschemaData)(o,this.it,e),(0,NL.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return cDe(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=Ua.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=Ua.mergeEvaluated.items(n,e.items,o.items,r)))}mergeValidEvaluated(e,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,Q.Name)),!0}};xu.KeywordCxt=dT;function mae(t,e,r,o){let n=new dT(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Pw.funcKeywordCode)(n,r):"macro"in r?(0,Pw.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Pw.funcKeywordCode)(n,r)}var SDe=/^\/(?:[^~]|~0|~1)*$/,xDe=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function hae(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,i;if(t==="")return pe.default.rootData;if(t[0]==="/"){if(!SDe.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,i=pe.default.rootData}else{let u=xDe.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=e)throw new Error(c("property/index",l));return o[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!n)return i}let s=i,a=n.split("/");for(let u of a)u&&(i=(0,Q._)`${i}${(0,Q.getProperty)((0,Ua.unescapeJsonPointer)(u))}`,s=(0,Q._)`${s} && ${i}`);return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}xu.getData=hae});var pT=R(ML=>{"use strict";Object.defineProperty(ML,"__esModule",{value:!0});var jL=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};ML.default=jL});var Cw=R(FL=>{"use strict";Object.defineProperty(FL,"__esModule",{value:!0});var UL=Aw(),LL=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,UL.resolveUrl)(e,r,o),this.missingSchema=(0,UL.normalizeId)((0,UL.getFullPath)(e,this.missingRef))}};FL.default=LL});var mT=R(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.resolveSchema=Go.getCompilingSchema=Go.resolveRef=Go.compileSchema=Go.SchemaEnv=void 0;var Vi=ke(),EDe=pT(),Gl=Ma(),Hi=Aw(),gae=Be(),kDe=Rw(),Tm=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let o;typeof e.schema=="object"&&(o=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Hi.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};Go.SchemaEnv=Tm;function HL(t){let e=yae.call(this,t);if(e)return e;let r=(0,Hi.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:i}=this.opts,s=new Vi.CodeGen(this.scope,{es5:o,lines:n,ownProperties:i}),a;t.$async&&(a=s.scopeValue("Error",{ref:EDe.default,code:(0,Vi._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");t.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:Gl.default.data,parentData:Gl.default.parentData,parentDataProperty:Gl.default.parentDataProperty,dataNames:[Gl.default.data],dataPathArr:[Vi.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Vi.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Vi.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Vi._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,kDe.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();l=`${s.scopeRefs(Gl.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let p=new Function(`${Gl.default.self}`,`${Gl.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:g}=u;p.evaluated={props:m instanceof Vi.Name?void 0:m,items:g instanceof Vi.Name?void 0:g,dynamicProps:m instanceof Vi.Name,dynamicItems:g instanceof Vi.Name},p.source&&(p.source.evaluated=(0,Vi.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}Go.compileSchema=HL;function IDe(t,e,r){var o;r=(0,Hi.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let i=TDe.call(this,t,r);if(i===void 0){let s=(o=t.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;s&&(i=new Tm({schema:s,schemaId:a,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=$De.call(this,i)}Go.resolveRef=IDe;function $De(t){return(0,Hi.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:HL.call(this,t)}function yae(t){for(let e of this._compilations)if(ADe(e,t))return e}Go.getCompilingSchema=yae;function ADe(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function TDe(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||fT.call(this,t,e)}function fT(t,e){let r=this.opts.uriResolver.parse(e),o=(0,Hi._getFullPath)(this.opts.uriResolver,r),n=(0,Hi.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return VL.call(this,r,t);let i=(0,Hi.normalizeId)(o),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=fT.call(this,t,s);return typeof a?.schema!="object"?void 0:VL.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||HL.call(this,s),i===(0,Hi.normalizeId)(e)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,Hi.resolveUrl)(this.opts.uriResolver,n,u)),new Tm({schema:a,schemaId:c,root:t,baseId:n})}return VL.call(this,r,s)}}Go.resolveSchema=fT;var PDe=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function VL(t,{baseId:e,schema:r,root:o}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,gae.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!PDe.has(a)&&u&&(e=(0,Hi.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,gae.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Hi.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=fT.call(this,o,a)}let{schemaId:s}=this.opts;if(i=i||new Tm({schema:r,schemaId:s,root:o,baseId:e}),i.schema!==i.root.schema)return i}});var vae=R((l0t,RDe)=>{RDe.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var JL=R((d0t,kae)=>{"use strict";var CDe=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),KL=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),ODe=RegExp.prototype.test.bind(/^\d*$/u),Xl=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),qL=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),bae=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),ZL=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),NDe=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Fn=new Array(256);{let t="0123456789ABCDEF";for(let e=0;e<256;e++)Fn[e]="%"+t[e>>4]+t[e&15]}function sn(t){return t<2048?Fn[192|t>>6]+Fn[128|t&63]:t<65536?Fn[224|t>>12]+Fn[128|t>>6&63]+Fn[128|t&63]:Fn[240|t>>18]+Fn[128|t>>12&63]+Fn[128|t>>6&63]+Fn[128|t&63]}function DDe(t){let e="",r=0,o=0;for(o=0;o<t.length;o++)if(r=t[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o];break}for(o+=1;o<t.length;o++){if(r=t[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o]}return e}var zDe=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),jDe=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),MDe=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),UDe=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function LDe(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(!MDe(t[e])){if(t[e]==="%"&&e+2<t.length&&Xl(t.slice(e+1,e+3))){e+=2;continue}return!1}return!0}function wae(t){let e=-1,r=0,o=-1,n=0;for(let a=0;a<t.length;a++)t[a]==="0"?(o===-1&&(o=a),n++,n>r&&(r=n,e=o)):(o=-1,n=0);if(r<2)return t.join(":");let i=t.slice(0,e).join(":"),s=t.slice(e+r).join(":");return i+"::"+s}function FDe(t){let e=t.indexOf("::");if(e!==-1&&t.indexOf("::",e+1)!==-1)return;let r=e===-1?t.split(":"):t.slice(0,e).split(":"),o=e===-1?[]:t.slice(e+2).split(":");e!==-1&&(r.length===1&&r[0]===""&&(r.length=0),o.length===1&&o[0]===""&&(o.length=0));let n=r.concat(o),i=0;for(let a=0;a<n.length;a++){let c=n[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==n.length-1||e!==-1&&o.length===0||!KL(c))return;i+=2;continue}if(!zDe(c))return;n[a]=parseInt(c,16).toString(16),i++}if(e===-1)return i!==8?void 0:wae(n);if(i>=8)return;let s=n.slice(0,r.length);for(let a=i;a<8;a++)s.push("0");for(let a=r.length;a<n.length;a++)s.push(n[a]);return wae(s)}function BL(t){let e=t[0]==="["&&t[t.length-1]==="]";if((t[0]==="["||t[t.length-1]==="]")&&!e)return{host:t,isIPV6:!1,error:!0};let o=e?t.slice(1,-1):t;if(e&&jDe(o))return o=o.toLowerCase(),{host:`[${o}]`,escapedHost:o,isIPV6:!1,isIPVFuture:!0};if(VDe(o,":")<2)return{host:t,isIPV6:!1,error:e};let n="",i=o.indexOf("%");if(i!==-1){let a=o.slice(i,i+3).toLowerCase()==="%25"?3:1;if(n=o.slice(i+a),!LDe(n))return{host:t,isIPV6:!1,error:!0};o=o.slice(0,i)}let s=FDe(o);return s===void 0?{host:t,isIPV6:!1,error:!0}:{host:s+(n?"%"+n:""),escapedHost:s+(n?"%25"+n:""),isIPV6:!0}}function VDe(t,e){let r=0;for(let o=0;o<t.length;o++)t[o]===e&&r++;return r}function HDe(t){let e=t,r=[],o=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((o=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,o)),e=e.slice(o)}return r.join("")}var BDe={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},KDe=/[@/?#:]/g,qDe=/[@/?#]/g;function _ae(t,e){let r=e?qDe:KDe;return r.lastIndex=0,t.replace(r,o=>BDe[o])}function Sae(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let o=0;o<t.length;o++){if(t[o]==="%"&&o+2<t.length){let n=t.slice(o+1,o+3);if(Xl(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));e&&qL(s)?r+=s:r+="%"+i,o+=2;continue}}r+=t[o]}return r}function ZDe(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];if(o==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(Xl(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));s!=="."&&qL(s)?e+=s:e+="%"+i,r+=2;continue}}if(bae(o))e+=o;else{let n=t.charCodeAt(r);if(n<128)e+=Eae(n)?o:Fn[n];else if(n<55296||n>57343)e+=sn(n);else if(n<=56319&&r+1<t.length){let i=t.charCodeAt(r+1);i>=56320&&i<=57343?(e+=sn(65536+(n-55296<<10)+(i-56320)),r++):e+=sn(65533)}else e+=sn(65533)}}return e}function WDe(t,e=!1){let r="",o=e&&t[0]!=="/";for(let n=0;n<t.length;n++){let i=t[n];if(i==="%"&&n+2<t.length){let s=t.slice(n+1,n+3);if(Xl(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(i==="/"&&(o=!1),bae(i)&&(i!==":"||!o))r+=i;else{let s=t.charCodeAt(n);if(s<128)r+=Fn[s];else if(s<55296||s>57343)r+=sn(s);else if(s<=56319&&n+1<t.length){let a=t.charCodeAt(n+1);a>=56320&&a<=57343?(r+=sn(65536+(s-55296<<10)+(a-56320)),n++):r+=sn(65533)}else r+=sn(65533)}}return r}function WL(t,e){let r="";for(let o=0;o<t.length;o++){let n=t[o];if(n==="%"&&o+2<t.length){let i=t.slice(o+1,o+3);if(Xl(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(e(n))r+=n;else{let i=t.charCodeAt(o);if(i<128)r+=Fn[i];else if(i<55296||i>57343)r+=sn(i);else if(i<=56319&&o+1<t.length){let s=t.charCodeAt(o+1);s>=56320&&s<=57343?(r+=sn(65536+(i-55296<<10)+(s-56320)),o++):r+=sn(65533)}else r+=sn(65533)}}return r}function xae(t){return WL(t,NDe)}function JDe(t){return WL(t,ZL)}function GDe(t){return WL(t,ZL)}function Eae(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===42||t===43||t===45||t===46||t===47||t===64||t===95}function XDe(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];if(o==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(Xl(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));qL(s)?e+=s:e+="%"+i,r+=2;continue}}if(ZL(o))e+=o;else{let n=t.charCodeAt(r);if(n<128)e+=Eae(n)?o:Fn[n];else if(n<55296||n>57343)e+=sn(n);else if(n<=56319&&r+1<t.length){let i=t.charCodeAt(r+1);i>=56320&&i<=57343?(e+=sn(65536+(n-55296<<10)+(i-56320)),r++):e+=sn(65533)}else e+=sn(65533)}}return e}function YDe(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(Xl(o)){e+="%"+o.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function QDe(t){let e=[];if(t.userinfo!==void 0&&(e.push(xae(t.userinfo)),e.push("@")),t.host!==void 0){let r=t.host;if(!KL(r)){let o=BL(r);o.isIPV6!==!0&&o.isIPVFuture!==!0&&(r=Sae(r,!0),o=BL(r)),o.isIPV6===!0||o.isIPVFuture===!0?r=`[${o.escapedHost}]`:r=_ae(r,!1)}e.push(r)}if(typeof t.port=="number"||typeof t.port=="string"){let r=String(t.port);if(!ODe(r))throw new TypeError("URI port is malformed.");e.push(":"),e.push(r)}return e.length?e.join(""):void 0}kae.exports={nonSimpleDomain:UDe,recomposeAuthority:QDe,reescapeHostDelimiters:_ae,normalizePercentEncoding:Sae,normalizePathEncoding:ZDe,serializePathEncoding:WDe,normalizeQueryFragmentEncoding:XDe,encodeUserinfo:xae,encodeQuery:JDe,encodeFragment:GDe,escapePreservingEscapes:YDe,removeDotSegments:HDe,isIPv4:KL,isUUID:CDe,normalizeIPv6:BL,stringArrayToHexStripped:DDe}});var Pae=R((p0t,Tae)=>{"use strict";var{isUUID:e1e}=JL(),t1e=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,r1e=["http","https","ws","wss","urn","urn:uuid"];function n1e(t){return r1e.indexOf(t)!==-1}function GL(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function Iae(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function $ae(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function o1e(t){return t.secure=GL(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function i1e(t){if((t.port===(GL(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let e=t.resourceName.indexOf("?"),r=e===-1?t.resourceName:t.resourceName.slice(0,e);t.path=r&&r!=="/"?r:void 0,t.query=e===-1?void 0:t.resourceName.slice(e+1),t.resourceName=void 0}return t.fragment=void 0,t}function s1e(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(t1e);if(r&&r[0]===t.path){let o=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${o}:${e.nid||t.nid}`,i=XL(n);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function a1e(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),n=`${r}:${e.nid||o}`,i=XL(n);i&&(t=i.serialize(t,e));let s=t,a=t.nss;return s.path=`${o||e.nid}:${a}`,e.skipEscape=!0,s}function c1e(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!e1e(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function u1e(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Aae={scheme:"http",domainHost:!0,parse:Iae,serialize:$ae},l1e={scheme:"https",domainHost:Aae.domainHost,parse:Iae,serialize:$ae},hT={scheme:"ws",domainHost:!0,parse:o1e,serialize:i1e},d1e={scheme:"wss",domainHost:hT.domainHost,parse:hT.parse,serialize:hT.serialize},p1e={scheme:"urn",parse:s1e,serialize:a1e,skipNormalize:!0},f1e={scheme:"urn:uuid",parse:c1e,serialize:u1e,skipNormalize:!0},gT={http:Aae,https:l1e,ws:hT,wss:d1e,urn:p1e,"urn:uuid":f1e};Object.setPrototypeOf(gT,null);function XL(t){return t&&(gT[t]||gT[t.toLowerCase()])||void 0}Tae.exports={wsIsSecure:GL,SCHEMES:gT,isValidSchemeName:n1e,getSchemeHandler:XL}});var Hae=R((f0t,wT)=>{"use strict";var{normalizeIPv6:Dae,removeDotSegments:Nw,recomposeAuthority:m1e,normalizePercentEncoding:YL,normalizePathEncoding:h1e,serializePathEncoding:Rae,normalizeQueryFragmentEncoding:Cae,encodeQuery:g1e,encodeFragment:y1e,reescapeHostDelimiters:v1e,isIPv4:zae,nonSimpleDomain:w1e}=JL(),{SCHEMES:jae,getSchemeHandler:QL}=Pae(),Mae=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Uae="URI scheme is malformed.";function Oae(t){let e=unescape(String(t));if(!Mae.test(e))throw new TypeError(Uae);return e}function b1e(t,e){return typeof t=="string"?t=A1e(t,e):typeof t=="object"&&(t=vT(Yl(t,e),e)),t}function _1e(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:i,malformedPercentEncoding:s,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=yT(t,o),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:m,malformedScheme:g}=yT(e,o);if(i||d||s||f||a||p||c||m||u||g)throw new Error(n.error||l.error||"URI is malformed.");let y=Lae(n,l,o,!0),w=QL(r&&r.scheme||y.scheme),b=y.host,_=b!==void 0&&b!==""&&(zae(b)||Dae(b).isIPV6);Fae(y,r||{},w,_);let k=b&&b.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(b);if(y.error&&!k)throw new Error(y.error);return o.skipEscape=!0,Yl(y,o)}function Lae(t,e,r,o){let n={};return o||(t=vT(Yl(t,r),r),e=vT(Yl(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Nw(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Nw(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=Nw(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=Nw(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function S1e(t,e,r){let o=Nae(t,r),n=Nae(e,r);return o!==void 0&&n!==void 0&&o===n}function Yl(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},e),n=[];r.scheme&&(r.scheme=Oae(r.scheme));let i=QL(o.scheme||r.scheme);i&&i.serialize&&i.serialize(r,o);let s=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!o.skipEscape&&r.scheme===void 0&&!s;r.path!==void 0&&(o.skipEscape?r.path=YL(r.path):r.path=Rae(r.path,a)),o.reference!=="suffix"&&r.scheme&&(r.scheme=Oae(r.scheme),n.push(r.scheme,":"));let c=m1e(r);if(c!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(c),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let u=r.path;!o.absolutePath&&(!i||!i.absolutePath)&&(u=Nw(u)),a&&(u=Rae(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),n.push(u)}return r.query!==void 0&&n.push("?",g1e(r.query)),r.fragment!==void 0&&n.push("#",y1e(r.fragment)),n.join("")}var x1e=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,E1e=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,k1e=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function I1e(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function Ow(t){if(t===void 0)return!1;let e=t.indexOf("%");for(;e!==-1;){if(e+2>=t.length||!/^[\da-f]{2}$/iu.test(t.slice(e+1,e+3)))return!0;e=t.indexOf("%",e+3)}return!1}function e2(t){return t[0]==="["&&t[t.length-1]==="]"}function $1e(t){let e=t[4];return Ow(t[3])||e!==void 0&&!e2(e)&&Ow(e)||Ow(t[6])||Ow(t[7])||Ow(t[8])}function Fae(t,e,r,o){if(!e.unicodeSupport&&(!r||!r.unicodeSupport)&&t.host&&!e2(t.host)&&(e.domainHost||r&&r.domainHost)&&o===!1&&w1e(t.host))try{t.host=new URL("http://"+t.host).hostname}catch(n){return t.error=t.error||"Host's domain name can not be converted to ASCII: "+n,!0}return!1}function yT(t,e){let r=Object.assign({},e),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,i=!1,s=!1,a=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let d=t.match(E1e);d!==null&&d[1].indexOf("\\")!==-1&&(o.error="URI authority must not contain a literal backslash.",n=!0);let f=t.match(k1e);if(f!==null){let m=f[1],g=m.replace(/[\t\n\r]/g,"");g.length>=2&&(g.slice(0,2)!=="//"?(o.error=o.error||"URI authority must not contain a literal backslash.",n=!0):m.length!==g.length&&(o.error=o.error||"URI authority introducer must not contain whitespace.",n=!0))}let p=t.match(x1e);if(p){if(o.scheme=p[1],o.userinfo=p[3],o.host=p[4],o.port=parseInt(p[5],10),o.path=p[6]||"",o.query=p[7],o.fragment=p[8],o.scheme!==void 0){let y=unescape(o.scheme);Mae.test(y)?o.scheme=y.toLowerCase():(o.error=o.error||Uae,u=!0)}i=$1e(p),i&&(o.error=o.error||"URI contains malformed percent-encoding."),isNaN(o.port)&&(o.port=p[5]);let m=I1e(o,p);if(m!==void 0&&(o.error=o.error||m,n=!0),o.host)if(zae(o.host)===!1){let w=e2(o.host),b=o.host.indexOf("[")!==-1||o.host.indexOf("]")!==-1,_=Dae(o.host);l=_.isIPV6||_.isIPVFuture===!0,c=b&&(!w||_.error===!0),o.host=l?_.host:_.host.toLowerCase(),c&&(o.error=o.error||"URI host is malformed.",n=!0)}else l=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let g=QL(r.scheme||o.scheme);if(c||(a=Fae(o,r,g,l)),t.indexOf("%")!==-1&&o.host!==void 0&&!c){let y=l?o.host:YL(o.host,!0);l||(y=YL(y.toLowerCase())),o.host=v1e(y,l)}(!g||g&&!g.skipNormalize)&&(o.path&&(o.path=h1e(o.path)),o.query&&(o.query=Cae(o.query)),o.fragment&&(o.fragment=Cae(o.fragment))),g&&g.parse&&(g.parse(o,r),g===jae.urn&&o.nid===void 0&&(s=!0))}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:s,malformedHost:a,malformedScheme:u}}function vT(t,e){return yT(t,e).parsed}function A1e(t,e){return Vae(t,e).normalized}function Vae(t,e){let{parsed:r,malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:i,malformedHost:s,malformedScheme:a}=yT(t,e);return{normalized:o||n||i||s||a?t:Yl(r,e),malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:i,malformedHost:s,malformedScheme:a}}function Nae(t,e){if(typeof t!="string"&&typeof t!="object")return;let r;try{r=typeof t=="string"?t:Yl(t,e)}catch{return}let{normalized:o,malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:s,malformedHost:a,malformedScheme:c}=Vae(r,e);return n||i||s||a||c?void 0:o}var t2={SCHEMES:jae,normalize:b1e,resolve:_1e,resolveComponent:Lae,equal:S1e,serialize:Yl,parse:vT};wT.exports=t2;wT.exports.default=t2;wT.exports.fastUri=t2});var Kae=R(r2=>{"use strict";Object.defineProperty(r2,"__esModule",{value:!0});var Bae=Hae();Bae.code='require("ajv/dist/runtime/uri").default';r2.default=Bae});var Qae=R(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.CodeGen=Mr.Name=Mr.nil=Mr.stringify=Mr.str=Mr._=Mr.KeywordCxt=void 0;var T1e=Rw();Object.defineProperty(Mr,"KeywordCxt",{enumerable:!0,get:function(){return T1e.KeywordCxt}});var Pm=ke();Object.defineProperty(Mr,"_",{enumerable:!0,get:function(){return Pm._}});Object.defineProperty(Mr,"str",{enumerable:!0,get:function(){return Pm.str}});Object.defineProperty(Mr,"stringify",{enumerable:!0,get:function(){return Pm.stringify}});Object.defineProperty(Mr,"nil",{enumerable:!0,get:function(){return Pm.nil}});Object.defineProperty(Mr,"Name",{enumerable:!0,get:function(){return Pm.Name}});Object.defineProperty(Mr,"CodeGen",{enumerable:!0,get:function(){return Pm.CodeGen}});var P1e=pT(),Gae=Cw(),R1e=EL(),Dw=mT(),C1e=ke(),zw=Aw(),bT=$w(),o2=Be(),qae=vae(),O1e=Kae(),Xae=(t,e)=>new RegExp(t,e);Xae.code="new RegExp";var N1e=["removeAdditional","useDefaults","coerceTypes"],D1e=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),z1e={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},j1e={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Zae=200;function M1e(t){var e,r,o,n,i,s,a,c,u,l,d,f,p,m,g,y,w,b,_,k,$,D,K,te,Ie;let xe=t.strict,Qe=(e=t.code)===null||e===void 0?void 0:e.optimize,Fe=Qe===!0||Qe===void 0?1:Qe||0,$e=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:Xae,J=(n=t.uriResolver)!==null&&n!==void 0?n:O1e.default;return{strictSchema:(s=(i=t.strictSchema)!==null&&i!==void 0?i:xe)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:xe)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:xe)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:xe)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:xe)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Fe,regExp:$e}:{optimize:Fe,regExp:$e},loopRequired:(g=t.loopRequired)!==null&&g!==void 0?g:Zae,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:Zae,meta:(w=t.meta)!==null&&w!==void 0?w:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(_=t.inlineRefs)!==null&&_!==void 0?_:!0,schemaId:(k=t.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:($=t.addUsedSchema)!==null&&$!==void 0?$:!0,validateSchema:(D=t.validateSchema)!==null&&D!==void 0?D:!0,validateFormats:(K=t.validateFormats)!==null&&K!==void 0?K:!0,unicodeRegExp:(te=t.unicodeRegExp)!==null&&te!==void 0?te:!0,int32range:(Ie=t.int32range)!==null&&Ie!==void 0?Ie:!0,uriResolver:J}}var jw=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...M1e(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new C1e.ValueScope({scope:{},prefixes:D1e,es5:r,lines:o}),this.logger=B1e(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,R1e.getRules)(),Wae.call(this,z1e,e,"NOT SUPPORTED"),Wae.call(this,j1e,e,"DEPRECATED","warn"),this._metaOpts=V1e.call(this),e.formats&&L1e.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&F1e.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),U1e.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=qae;o==="id"&&(n={...qae},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let o;if(typeof e=="string"){if(o=this.getSchema(e),!o)throw new Error(`no schema with key or ref "${e}"`)}else o=this.compile(e);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(e,r){let o=this._addSchema(e,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,e,r);async function n(l,d){await i.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||s.call(this,f)}async function i(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Gae.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(e,r,o,n=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,o,n);return this}let i;if(typeof e=="object"){let{schemaId:s}=this.opts;if(i=e[s],i!==void 0&&typeof i!="string")throw new Error(`schema ${s} must be string`)}return r=(0,zw.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,o,r,n,!0),this}addMetaSchema(e,r,o=this.opts.validateSchema){return this.addSchema(e,r,!0,o),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let o;if(o=e.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,e);if(!n&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return n}getSchema(e){let r;for(;typeof(r=Jae.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new Dw.SchemaEnv({schema:{},schemaId:o});if(r=Dw.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Jae.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let o=e[this.opts.schemaId];return o&&(o=(0,zw.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let o;if(typeof e=="string")o=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof e=="object"&&r===void 0){if(r=e,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(q1e.call(this,o,r),!r)return(0,o2.eachItem)(o,i=>n2.call(this,i)),this;W1e.call(this,r);let n={...r,type:(0,bT.getJSONTypes)(r.type),schemaType:(0,bT.getJSONTypes)(r.schemaType)};return(0,o2.eachItem)(o,n.type.length===0?i=>n2.call(this,i,n):i=>n.type.forEach(s=>n2.call(this,i,n,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let o of r.rules){let n=o.rules.findIndex(i=>i.keyword===e);n>=0&&o.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,i)=>n+r+i)}$dataMetaSchema(e,r){let o=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let i=n.split("/").slice(1),s=e;for(let a of i)s=s[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=s[a];u&&l&&(s[a]=Yae(l))}}return e}_removeAllSchemas(e,r){for(let o in e){let n=e[o];(!r||r.test(o))&&(typeof n=="string"?delete e[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[o]))}}_addSchema(e,r,o,n=this.opts.validateSchema,i=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;o=(0,zw.normalizeId)(s||o);let u=zw.getSchemaRefs.call(this,e,o);return c=new Dw.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),i&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Dw.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Dw.compileSchema.call(this,e)}finally{this.opts=r}}};jw.ValidationError=P1e.default;jw.MissingRefError=Gae.default;Mr.default=jw;function Wae(t,e,r,o="error"){for(let n in t){let i=n;i in e&&this.logger[o](`${r}: option ${n}. ${t[i]}`)}}function Jae(t){return t=(0,zw.normalizeId)(t),this.schemas[t]||this.refs[t]}function U1e(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function L1e(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function F1e(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function V1e(){let t={...this.opts};for(let e of N1e)delete t[e];return t}var H1e={log(){},warn(){},error(){}};function B1e(t){if(t===!1)return H1e;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var K1e=/^[a-z_$][a-z0-9_$:-]*$/i;function q1e(t,e){let{RULES:r}=this;if((0,o2.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!K1e.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function n2(t,e,r){var o;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=n?i.post:i.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,bT.getJSONTypes)(e.type),schemaType:(0,bT.getJSONTypes)(e.schemaType)}};e.before?Z1e.call(this,s,a,e.before):s.rules.push(a),i.all[t]=a,(o=e.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function Z1e(t,e,r){let o=t.rules.findIndex(n=>n.keyword===r);o>=0?t.rules.splice(o,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function W1e(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Yae(e)),t.validateSchema=this.compile(e,!0))}var J1e={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Yae(t){return{anyOf:[t,J1e]}}});var ece=R(i2=>{"use strict";Object.defineProperty(i2,"__esModule",{value:!0});var G1e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};i2.default=G1e});var oce=R(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});Ql.callRef=Ql.getValidate=void 0;var X1e=Cw(),tce=Jo(),Vn=ke(),Rm=Ma(),rce=mT(),_T=Be(),Y1e={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:o}=t,{baseId:n,schemaEnv:i,validateName:s,opts:a,self:c}=o,{root:u}=i;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=rce.resolveRef.call(c,u,n,r);if(l===void 0)throw new X1e.default(o.opts.uriResolver,n,r);if(l instanceof rce.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return ST(t,s,i,i.$async);let m=e.scopeValue("root",{ref:u});return ST(t,(0,Vn._)`${m}.validate`,u,u.$async)}function f(m){let g=nce(t,m);ST(t,g,m,m.$async)}function p(m){let g=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Vn.stringify)(m)}:{ref:m}),y=e.name("valid"),w=t.subschema({schema:m,dataTypes:[],schemaPath:Vn.nil,topSchemaRef:g,errSchemaPath:r},y);t.mergeEvaluated(w),t.ok(y)}}};function nce(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Vn._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Ql.getValidate=nce;function ST(t,e,r,o){let{gen:n,it:i}=t,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?Rm.default.this:Vn.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,Vn._)`await ${(0,tce.callValidateCode)(t,e,u)}`),p(e),s||n.assign(m,!0)},g=>{n.if((0,Vn._)`!(${g} instanceof ${i.ValidationError})`,()=>n.throw(g)),f(g),s||n.assign(m,!1)}),t.ok(m)}function d(){t.result((0,tce.callValidateCode)(t,e,u),()=>p(e),()=>f(e))}function f(m){let g=(0,Vn._)`${m}.errors`;n.assign(Rm.default.vErrors,(0,Vn._)`${Rm.default.vErrors} === null ? ${g} : ${Rm.default.vErrors}.concat(${g})`),n.assign(Rm.default.errors,(0,Vn._)`${Rm.default.vErrors}.length`)}function p(m){var g;if(!i.opts.unevaluated)return;let y=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(i.props=_T.mergeEvaluated.props(n,y.props,i.props));else{let w=n.var("props",(0,Vn._)`${m}.evaluated.props`);i.props=_T.mergeEvaluated.props(n,w,i.props,Vn.Name)}if(i.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(i.items=_T.mergeEvaluated.items(n,y.items,i.items));else{let w=n.var("items",(0,Vn._)`${m}.evaluated.items`);i.items=_T.mergeEvaluated.items(n,w,i.items,Vn.Name)}}}Ql.callRef=ST;Ql.default=Y1e});var ice=R(s2=>{"use strict";Object.defineProperty(s2,"__esModule",{value:!0});var Q1e=ece(),eze=oce(),tze=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Q1e.default,eze.default];s2.default=tze});var sce=R(a2=>{"use strict";Object.defineProperty(a2,"__esModule",{value:!0});var xT=ke(),Eu=xT.operators,ET={maximum:{okStr:"<=",ok:Eu.LTE,fail:Eu.GT},minimum:{okStr:">=",ok:Eu.GTE,fail:Eu.LT},exclusiveMaximum:{okStr:"<",ok:Eu.LT,fail:Eu.GTE},exclusiveMinimum:{okStr:">",ok:Eu.GT,fail:Eu.LTE}},rze={message:({keyword:t,schemaCode:e})=>(0,xT.str)`must be ${ET[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,xT._)`{comparison: ${ET[t].okStr}, limit: ${e}}`},nze={keyword:Object.keys(ET),type:"number",schemaType:"number",$data:!0,error:rze,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,xT._)`${r} ${ET[e].fail} ${o} || isNaN(${r})`)}};a2.default=nze});var ace=R(c2=>{"use strict";Object.defineProperty(c2,"__esModule",{value:!0});var Mw=ke(),oze={message:({schemaCode:t})=>(0,Mw.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Mw._)`{multipleOf: ${t}}`},ize={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:oze,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,i=n.opts.multipleOfPrecision,s=e.let("res"),a=i?(0,Mw._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,Mw._)`${s} !== parseInt(${s})`;t.fail$data((0,Mw._)`(${o} === 0 || (${s} = ${r}/${o}, ${a}))`)}};c2.default=ize});var uce=R(u2=>{"use strict";Object.defineProperty(u2,"__esModule",{value:!0});function cce(t){let e=t.length,r=0,o=0,n;for(;o<e;)r++,n=t.charCodeAt(o++),n>=55296&&n<=56319&&o<e&&(n=t.charCodeAt(o),(n&64512)===56320&&o++);return r}u2.default=cce;cce.code='require("ajv/dist/runtime/ucs2length").default'});var lce=R(l2=>{"use strict";Object.defineProperty(l2,"__esModule",{value:!0});var ed=ke(),sze=Be(),aze=uce(),cze={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,ed.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,ed._)`{limit: ${t}}`},uze={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:cze,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,i=e==="maxLength"?ed.operators.GT:ed.operators.LT,s=n.opts.unicode===!1?(0,ed._)`${r}.length`:(0,ed._)`${(0,sze.useFunc)(t.gen,aze.default)}(${r})`;t.fail$data((0,ed._)`${s} ${i} ${o}`)}};l2.default=uze});var dce=R(d2=>{"use strict";Object.defineProperty(d2,"__esModule",{value:!0});var lze=Jo(),dze=Be(),Cm=ke(),pze={message:({schemaCode:t})=>(0,Cm.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Cm._)`{pattern: ${t}}`},fze={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:pze,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:i,it:s}=t,a=s.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=s.opts.code,u=c.code==="new RegExp"?(0,Cm._)`new RegExp`:(0,dze.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Cm._)`${u}(${i}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Cm._)`!${l}`)}else{let c=(0,lze.usePattern)(t,n);t.fail$data((0,Cm._)`!${c}.test(${r})`)}}};d2.default=fze});var pce=R(p2=>{"use strict";Object.defineProperty(p2,"__esModule",{value:!0});var Uw=ke(),mze={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Uw.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Uw._)`{limit: ${t}}`},hze={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:mze,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?Uw.operators.GT:Uw.operators.LT;t.fail$data((0,Uw._)`Object.keys(${r}).length ${n} ${o}`)}};p2.default=hze});var fce=R(f2=>{"use strict";Object.defineProperty(f2,"__esModule",{value:!0});var Lw=Jo(),Fw=ke(),gze=Be(),yze={message:({params:{missingProperty:t}})=>(0,Fw.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Fw._)`{missingProperty: ${t}}`},vze={keyword:"required",type:"object",schemaType:"array",$data:!0,error:yze,code(t){let{gen:e,schema:r,schemaCode:o,data:n,$data:i,it:s}=t,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():l(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let g of r)if(p?.[g]===void 0&&!m.has(g)){let y=s.schemaEnv.baseId+s.errSchemaPath,w=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,gze.checkStrictMode)(s,w,s.opts.strictRequired)}}function u(){if(c||i)t.block$data(Fw.nil,d);else for(let p of r)(0,Lw.checkReportMissingProp)(t,p)}function l(){let p=e.let("missing");if(c||i){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Lw.checkMissingProp)(t,r,p)),(0,Lw.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",o,p=>{t.setParams({missingProperty:p}),e.if((0,Lw.noPropertyInData)(e,n,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,o,()=>{e.assign(m,(0,Lw.propertyInData)(e,n,p,a.ownProperties)),e.if((0,Fw.not)(m),()=>{t.error(),e.break()})},Fw.nil)}}};f2.default=vze});var mce=R(m2=>{"use strict";Object.defineProperty(m2,"__esModule",{value:!0});var Vw=ke(),wze={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Vw.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Vw._)`{limit: ${t}}`},bze={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:wze,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?Vw.operators.GT:Vw.operators.LT;t.fail$data((0,Vw._)`${r}.length ${n} ${o}`)}};m2.default=bze});var kT=R(h2=>{"use strict";Object.defineProperty(h2,"__esModule",{value:!0});var hce=CL();hce.code='require("ajv/dist/runtime/equal").default';h2.default=hce});var gce=R(y2=>{"use strict";Object.defineProperty(y2,"__esModule",{value:!0});var g2=$w(),Ur=ke(),_ze=Be(),Sze=kT(),xze={message:({params:{i:t,j:e}})=>(0,Ur.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Ur._)`{i: ${t}, j: ${e}}`},Eze={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:xze,code(t){let{gen:e,data:r,$data:o,schema:n,parentSchema:i,schemaCode:s,it:a}=t;if(!o&&!n)return;let c=e.let("valid"),u=i.items?(0,g2.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Ur._)`${s} === false`),t.ok(c);function l(){let m=e.let("i",(0,Ur._)`${r}.length`),g=e.let("j");t.setParams({i:m,j:g}),e.assign(c,!0),e.if((0,Ur._)`${m} > 1`,()=>(d()?f:p)(m,g))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,g){let y=e.name("item"),w=(0,g2.checkDataTypes)(u,y,a.opts.strictNumbers,g2.DataType.Wrong),b=e.const("indices",(0,Ur._)`{}`);e.for((0,Ur._)`;${m}--;`,()=>{e.let(y,(0,Ur._)`${r}[${m}]`),e.if(w,(0,Ur._)`continue`),u.length>1&&e.if((0,Ur._)`typeof ${y} == "string"`,(0,Ur._)`${y} += "_"`),e.if((0,Ur._)`typeof ${b}[${y}] == "number"`,()=>{e.assign(g,(0,Ur._)`${b}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,Ur._)`${b}[${y}] = ${m}`)})}function p(m,g){let y=(0,_ze.useFunc)(e,Sze.default),w=e.name("outer");e.label(w).for((0,Ur._)`;${m}--;`,()=>e.for((0,Ur._)`${g} = ${m}; ${g}--;`,()=>e.if((0,Ur._)`${y}(${r}[${m}], ${r}[${g}])`,()=>{t.error(),e.assign(c,!1).break(w)})))}}};y2.default=Eze});var yce=R(w2=>{"use strict";Object.defineProperty(w2,"__esModule",{value:!0});var v2=ke(),kze=Be(),Ize=kT(),$ze={message:"must be equal to constant",params:({schemaCode:t})=>(0,v2._)`{allowedValue: ${t}}`},Aze={keyword:"const",$data:!0,error:$ze,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:i}=t;o||i&&typeof i=="object"?t.fail$data((0,v2._)`!${(0,kze.useFunc)(e,Ize.default)}(${r}, ${n})`):t.fail((0,v2._)`${i} !== ${r}`)}};w2.default=Aze});var vce=R(b2=>{"use strict";Object.defineProperty(b2,"__esModule",{value:!0});var Hw=ke(),Tze=Be(),Pze=kT(),Rze={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Hw._)`{allowedValues: ${t}}`},Cze={keyword:"enum",schemaType:"array",$data:!0,error:Rze,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:i,it:s}=t;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,Tze.useFunc)(e,Pze.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let p=e.const("vSchema",i);l=(0,Hw.or)(...n.map((m,g)=>f(p,g)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,p=>e.if((0,Hw._)`${u()}(${r}, ${p})`,()=>e.assign(l,!0).break()))}function f(p,m){let g=n[m];return typeof g=="object"&&g!==null?(0,Hw._)`${u()}(${r}, ${p}[${m}])`:(0,Hw._)`${r} === ${g}`}}};b2.default=Cze});var wce=R(_2=>{"use strict";Object.defineProperty(_2,"__esModule",{value:!0});var Oze=sce(),Nze=ace(),Dze=lce(),zze=dce(),jze=pce(),Mze=fce(),Uze=mce(),Lze=gce(),Fze=yce(),Vze=vce(),Hze=[Oze.default,Nze.default,Dze.default,zze.default,jze.default,Mze.default,Uze.default,Lze.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Fze.default,Vze.default];_2.default=Hze});var x2=R(Bw=>{"use strict";Object.defineProperty(Bw,"__esModule",{value:!0});Bw.validateAdditionalItems=void 0;var td=ke(),S2=Be(),Bze={message:({params:{len:t}})=>(0,td.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,td._)`{limit: ${t}}`},Kze={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Bze,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,S2.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}bce(t,o)}};function bce(t,e){let{gen:r,schema:o,data:n,keyword:i,it:s}=t;s.items=!0;let a=r.const("len",(0,td._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,td._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,S2.alwaysValidSchema)(s,o)){let u=r.var("valid",(0,td._)`${a} <= ${e.length}`);r.if((0,td.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:S2.Type.Num},u),s.allErrors||r.if((0,td.not)(u),()=>r.break())})}}Bw.validateAdditionalItems=bce;Bw.default=Kze});var E2=R(Kw=>{"use strict";Object.defineProperty(Kw,"__esModule",{value:!0});Kw.validateTuple=void 0;var _ce=ke(),IT=Be(),qze=Jo(),Zze={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Sce(t,"additionalItems",e);r.items=!0,!(0,IT.alwaysValidSchema)(r,e)&&t.ok((0,qze.validateArray)(t))}};function Sce(t,e,r=t.schema){let{gen:o,parentSchema:n,data:i,keyword:s,it:a}=t;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=IT.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,_ce._)`${i}.length`);r.forEach((d,f)=>{(0,IT.alwaysValidSchema)(a,d)||(o.if((0,_ce._)`${u} > ${f}`,()=>t.subschema({keyword:s,schemaProp:f,dataProp:f},c)),t.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=a,m=r.length,g=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!g){let y=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,IT.checkStrictMode)(a,y,f.strictTuples)}}}Kw.validateTuple=Sce;Kw.default=Zze});var xce=R(k2=>{"use strict";Object.defineProperty(k2,"__esModule",{value:!0});var Wze=E2(),Jze={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Wze.validateTuple)(t,"items")};k2.default=Jze});var kce=R(I2=>{"use strict";Object.defineProperty(I2,"__esModule",{value:!0});var Ece=ke(),Gze=Be(),Xze=Jo(),Yze=x2(),Qze={message:({params:{len:t}})=>(0,Ece.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ece._)`{limit: ${t}}`},eje={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Qze,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,Gze.alwaysValidSchema)(o,e)&&(n?(0,Yze.validateAdditionalItems)(t,n):t.ok((0,Xze.validateArray)(t)))}};I2.default=eje});var Ice=R($2=>{"use strict";Object.defineProperty($2,"__esModule",{value:!0});var Xo=ke(),$T=Be(),tje={message:({params:{min:t,max:e}})=>e===void 0?(0,Xo.str)`must contain at least ${t} valid item(s)`:(0,Xo.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Xo._)`{minContains: ${t}}`:(0,Xo._)`{minContains: ${t}, maxContains: ${e}}`},rje={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:tje,code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:i}=t,s,a,{minContains:c,maxContains:u}=o;i.opts.next?(s=c===void 0?1:c,a=u):s=1;let l=e.const("len",(0,Xo._)`${n}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,$T.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,$T.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,$T.alwaysValidSchema)(i,r)){let g=(0,Xo._)`${l} >= ${s}`;a!==void 0&&(g=(0,Xo._)`${g} && ${l} <= ${a}`),t.pass(g);return}i.items=!0;let d=e.name("valid");a===void 0&&s===1?p(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,Xo._)`${n}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let g=e.name("_valid"),y=e.let("count",0);p(g,()=>e.if(g,()=>m(y)))}function p(g,y){e.forRange("i",0,l,w=>{t.subschema({keyword:"contains",dataProp:w,dataPropType:$T.Type.Num,compositeRule:!0},g),y()})}function m(g){e.code((0,Xo._)`${g}++`),a===void 0?e.if((0,Xo._)`${g} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,Xo._)`${g} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,Xo._)`${g} >= ${s}`,()=>e.assign(d,!0)))}}};$2.default=rje});var Tce=R(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.validateSchemaDeps=Gs.validatePropertyDeps=Gs.error=void 0;var A2=ke(),nje=Be(),qw=Jo();Gs.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,A2.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,A2._)`{property: ${t},
65
65
  missingProperty: ${o},
66
66
  depsCount: ${e},
67
- deps: ${r}}`};var oje={keyword:"dependencies",type:"object",schemaType:"object",error:Gs.error,code(t){let[e,r]=ije(t);$ce(t,e),Ace(t,r)}};function ije({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function $ce(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let c=(0,qw.propertyInData)(r,o,s,n.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,qw.checkReportMissingProp)(t,u)}):(r.if((0,A2._)`${c} && (${(0,qw.checkMissingProp)(t,a,i)})`),(0,qw.reportMissingProp)(t,i),r.else())}}Gs.validatePropertyDeps=$ce;function Ace(t,e=t.schema){let{gen:r,data:o,keyword:n,it:i}=t,s=r.name("valid");for(let a in e)(0,nje.alwaysValidSchema)(i,e[a])||(r.if((0,qw.propertyInData)(r,o,a,i.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},s);t.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),t.ok(s))}Gs.validateSchemaDeps=Ace;Gs.default=oje});var Rce=R(T2=>{"use strict";Object.defineProperty(T2,"__esModule",{value:!0});var Pce=ke(),sje=Be(),aje={message:"property name must be valid",params:({params:t})=>(0,Pce._)`{propertyName: ${t.propertyName}}`},cje={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:aje,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,sje.alwaysValidSchema)(n,r))return;let i=e.name("valid");e.forIn("key",o,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),e.if((0,Pce.not)(i),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(i)}};T2.default=cje});var R2=R(P2=>{"use strict";Object.defineProperty(P2,"__esModule",{value:!0});var AT=Jo(),Bi=ke(),uje=Ma(),TT=Be(),lje={message:"must NOT have additional properties",params:({params:t})=>(0,Bi._)`{additionalProperty: ${t.additionalProperty}}`},dje={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:lje,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,TT.alwaysValidSchema)(s,r))return;let u=(0,AT.allSchemaProperties)(o.properties),l=(0,AT.allSchemaProperties)(o.patternProperties);d(),t.ok((0,Bi._)`${i} === ${uje.default.errors}`);function d(){e.forIn("key",n,y=>{!u.length&&!l.length?m(y):e.if(f(y),()=>m(y))})}function f(y){let w;if(u.length>8){let b=(0,TT.schemaRefOrVal)(s,o.properties,"properties");w=(0,AT.isOwnProperty)(e,b,y)}else u.length?w=(0,Bi.or)(...u.map(b=>(0,Bi._)`${y} === ${b}`)):w=Bi.nil;return l.length&&(w=(0,Bi.or)(w,...l.map(b=>(0,Bi._)`${(0,AT.usePattern)(t,b)}.test(${y})`))),(0,Bi.not)(w)}function p(y){e.code((0,Bi._)`delete ${n}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,TT.alwaysValidSchema)(s,r)){let w=e.name("valid");c.removeAdditional==="failing"?(g(y,w,!1),e.if((0,Bi.not)(w),()=>{t.reset(),p(y)})):(g(y,w),a||e.if((0,Bi.not)(w),()=>e.break()))}}function g(y,w,b){let _={keyword:"additionalProperties",dataProp:y,dataPropType:TT.Type.Str};b===!1&&Object.assign(_,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(_,w)}}};P2.default=dje});var Nce=R(O2=>{"use strict";Object.defineProperty(O2,"__esModule",{value:!0});var pje=Rw(),Cce=Jo(),C2=Be(),Oce=R2(),fje={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:i}=t;i.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&Oce.default.code(new pje.KeywordCxt(i,Oce.default,"additionalProperties"));let s=(0,Cce.allSchemaProperties)(r);for(let d of s)i.definedProperties.add(d);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=C2.mergeEvaluated.props(e,(0,C2.toHash)(s),i.props));let a=s.filter(d=>!(0,C2.alwaysValidSchema)(i,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,Cce.propertyInData)(e,n,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};O2.default=fje});var Mce=R(N2=>{"use strict";Object.defineProperty(N2,"__esModule",{value:!0});var Dce=Jo(),PT=ke(),zce=Be(),jce=Be(),mje={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:i}=t,{opts:s}=i,a=(0,Dce.allSchemaProperties)(r),c=a.filter(g=>(0,zce.alwaysValidSchema)(i,r[g]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&n.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof PT.Name)&&(i.props=(0,jce.evaluatedPropsToName)(e,i.props));let{props:d}=i;f();function f(){for(let g of a)u&&p(g),i.allErrors?m(g):(e.var(l,!0),m(g),e.if(l))}function p(g){for(let y in u)new RegExp(g).test(y)&&(0,zce.checkStrictMode)(i,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function m(g){e.forIn("key",o,y=>{e.if((0,PT._)`${(0,Dce.usePattern)(t,g)}.test(${y})`,()=>{let w=c.includes(g);w||t.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:jce.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,PT._)`${d}[${y}]`,!0):!w&&!i.allErrors&&e.if((0,PT.not)(l),()=>e.break())})})}}};N2.default=mje});var Uce=R(D2=>{"use strict";Object.defineProperty(D2,"__esModule",{value:!0});var hje=Be(),gje={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,hje.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};D2.default=gje});var Lce=R(z2=>{"use strict";Object.defineProperty(z2,"__esModule",{value:!0});var yje=Jo(),vje={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:yje.validateUnion,error:{message:"must match a schema in anyOf"}};z2.default=vje});var Fce=R(j2=>{"use strict";Object.defineProperty(j2,"__esModule",{value:!0});var RT=ke(),wje=Be(),bje={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,RT._)`{passingSchemas: ${t.passing}}`},_je={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:bje,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let i=r,s=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(s,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let f;(0,wje.alwaysValidSchema)(n,l)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,RT._)`${c} && ${s}`).assign(s,!1).assign(a,(0,RT._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(s,!0),e.assign(a,d),f&&t.mergeEvaluated(f,RT.Name)})})}}};j2.default=_je});var Vce=R(M2=>{"use strict";Object.defineProperty(M2,"__esModule",{value:!0});var Sje=Be(),xje={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((i,s)=>{if((0,Sje.alwaysValidSchema)(o,i))return;let a=t.subschema({keyword:"allOf",schemaProp:s},n);t.ok(n),t.mergeEvaluated(a)})}};M2.default=xje});var Kce=R(U2=>{"use strict";Object.defineProperty(U2,"__esModule",{value:!0});var CT=ke(),Bce=Be(),Eje={message:({params:t})=>(0,CT.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,CT._)`{failingKeyword: ${t.ifClause}}`},kje={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Eje,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,Bce.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=Hce(o,"then"),i=Hce(o,"else");if(!n&&!i)return;let s=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else n?e.if(a,u("then")):e.if((0,CT.not)(a),u("else"));t.pass(s,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let f=t.subschema({keyword:l},a);e.assign(s,a),t.mergeValidEvaluated(f,s),d?e.assign(d,(0,CT._)`${l}`):t.setParams({ifClause:l})}}}};function Hce(t,e){let r=t.schema[e];return r!==void 0&&!(0,Bce.alwaysValidSchema)(t,r)}U2.default=kje});var qce=R(L2=>{"use strict";Object.defineProperty(L2,"__esModule",{value:!0});var Ije=Be(),$je={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Ije.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};L2.default=$je});var Zce=R(F2=>{"use strict";Object.defineProperty(F2,"__esModule",{value:!0});var Aje=x2(),Tje=xce(),Pje=E2(),Rje=kce(),Cje=Ice(),Oje=Tce(),Nje=Rce(),Dje=R2(),zje=Nce(),jje=Mce(),Mje=Uce(),Uje=Lce(),Lje=Fce(),Fje=Vce(),Vje=Kce(),Hje=qce();function Bje(t=!1){let e=[Mje.default,Uje.default,Lje.default,Fje.default,Vje.default,Hje.default,Nje.default,Dje.default,Oje.default,zje.default,jje.default];return t?e.push(Tje.default,Rje.default):e.push(Aje.default,Pje.default),e.push(Cje.default),e}F2.default=Bje});var Wce=R(V2=>{"use strict";Object.defineProperty(V2,"__esModule",{value:!0});var Bt=ke(),Kje={message:({schemaCode:t})=>(0,Bt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Bt._)`{format: ${t}}`},qje={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Kje,code(t,e){let{gen:r,data:o,$data:n,schema:i,schemaCode:s,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,Bt._)`${m}[${s}]`),y=r.let("fType"),w=r.let("format");r.if((0,Bt._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,(0,Bt._)`${g}.type || "string"`).assign(w,(0,Bt._)`${g}.validate`),()=>r.assign(y,(0,Bt._)`"string"`).assign(w,g)),t.fail$data((0,Bt.or)(b(),_()));function b(){return c.strictSchema===!1?Bt.nil:(0,Bt._)`${s} && !${w}`}function _(){let k=l.$async?(0,Bt._)`(${g}.async ? await ${w}(${o}) : ${w}(${o}))`:(0,Bt._)`${w}(${o})`,$=(0,Bt._)`(typeof ${w} == "function" ? ${k} : ${w}.test(${o}))`;return(0,Bt._)`${w} && ${w} !== true && ${y} === ${e} && !${$}`}}function p(){let m=d.formats[i];if(!m){b();return}if(m===!0)return;let[g,y,w]=_(m);g===e&&t.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn($());return}throw new Error($());function $(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function _($){let D=$ instanceof RegExp?(0,Bt.regexpCode)($):c.code.formats?(0,Bt._)`${c.code.formats}${(0,Bt.getProperty)(i)}`:void 0,K=r.scopeValue("formats",{key:i,ref:$,code:D});return typeof $=="object"&&!($ instanceof RegExp)?[$.type||"string",$.validate,(0,Bt._)`${K}.validate`]:["string",$,K]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,Bt._)`await ${w}(${o})`}return typeof y=="function"?(0,Bt._)`${w}(${o})`:(0,Bt._)`${w}.test(${o})`}}}};V2.default=qje});var Jce=R(H2=>{"use strict";Object.defineProperty(H2,"__esModule",{value:!0});var Zje=Wce(),Wje=[Zje.default];H2.default=Wje});var Gce=R(Om=>{"use strict";Object.defineProperty(Om,"__esModule",{value:!0});Om.contentVocabulary=Om.metadataVocabulary=void 0;Om.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Om.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Yce=R(B2=>{"use strict";Object.defineProperty(B2,"__esModule",{value:!0});var Jje=ice(),Gje=wce(),Xje=Zce(),Yje=Jce(),Xce=Gce(),Qje=[Jje.default,Gje.default,(0,Xje.default)(),Yje.default,Xce.metadataVocabulary,Xce.contentVocabulary];B2.default=Qje});var eue=R(OT=>{"use strict";Object.defineProperty(OT,"__esModule",{value:!0});OT.DiscrError=void 0;var Qce;(function(t){t.Tag="tag",t.Mapping="mapping"})(Qce||(OT.DiscrError=Qce={}))});var rue=R(q2=>{"use strict";Object.defineProperty(q2,"__esModule",{value:!0});var Nm=ke(),K2=eue(),tue=mT(),eMe=Cw(),tMe=Be(),rMe={message:({params:{discrError:t,tagName:e}})=>t===K2.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Nm._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},nMe={keyword:"discriminator",type:"object",schemaType:"object",error:rMe,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:i}=t,{oneOf:s}=n;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,Nm._)`${r}${(0,Nm.getProperty)(a)}`);e.if((0,Nm._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:K2.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,Nm._)`${u} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:K2.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),g=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(g,Nm.Name),m}function f(){var p;let m={},g=w(n),y=!0;for(let k=0;k<s.length;k++){let $=s[k];if($?.$ref&&!(0,tMe.schemaHasRulesButRef)($,i.self.RULES)){let K=$.$ref;if($=tue.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,K),$ instanceof tue.SchemaEnv&&($=$.schema),$===void 0)throw new eMe.default(i.opts.uriResolver,i.baseId,K)}let D=(p=$?.properties)===null||p===void 0?void 0:p[a];if(typeof D!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(g||w($)),b(D,k)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function w({required:k}){return Array.isArray(k)&&k.includes(a)}function b(k,$){if(k.const)_(k.const,$);else if(k.enum)for(let D of k.enum)_(D,$);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function _(k,$){if(typeof k!="string"||k in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[k]=$}}}};q2.default=nMe});var nue=R((rEt,oMe)=>{oMe.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var W2=R((At,Z2)=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.MissingRefError=At.ValidationError=At.CodeGen=At.Name=At.nil=At.stringify=At.str=At._=At.KeywordCxt=At.Ajv=void 0;var iMe=Qae(),sMe=Yce(),aMe=rue(),oue=nue(),cMe=["/properties"],NT="http://json-schema.org/draft-07/schema",Dm=class extends iMe.default{_addVocabularies(){super._addVocabularies(),sMe.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(aMe.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(oue,cMe):oue;this.addMetaSchema(e,NT,!1),this.refs["http://json-schema.org/schema"]=NT}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(NT)?NT:void 0)}};At.Ajv=Dm;Z2.exports=At=Dm;Z2.exports.Ajv=Dm;Object.defineProperty(At,"__esModule",{value:!0});At.default=Dm;var uMe=Rw();Object.defineProperty(At,"KeywordCxt",{enumerable:!0,get:function(){return uMe.KeywordCxt}});var zm=ke();Object.defineProperty(At,"_",{enumerable:!0,get:function(){return zm._}});Object.defineProperty(At,"str",{enumerable:!0,get:function(){return zm.str}});Object.defineProperty(At,"stringify",{enumerable:!0,get:function(){return zm.stringify}});Object.defineProperty(At,"nil",{enumerable:!0,get:function(){return zm.nil}});Object.defineProperty(At,"Name",{enumerable:!0,get:function(){return zm.Name}});Object.defineProperty(At,"CodeGen",{enumerable:!0,get:function(){return zm.CodeGen}});var lMe=pT();Object.defineProperty(At,"ValidationError",{enumerable:!0,get:function(){return lMe.default}});var dMe=Cw();Object.defineProperty(At,"MissingRefError",{enumerable:!0,get:function(){return dMe.default}})});var pue=R(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.formatNames=Ys.fastFormats=Ys.fullFormats=void 0;function Xs(t,e){return{validate:t,compare:e}}Ys.fullFormats={date:Xs(cue,Y2),time:Xs(G2(!0),Q2),"date-time":Xs(iue(!0),lue),"iso-time":Xs(G2(),uue),"iso-date-time":Xs(iue(),due),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:yMe,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:EMe,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:vMe,int32:{type:"number",validate:_Me},int64:{type:"number",validate:SMe},float:{type:"number",validate:aue},double:{type:"number",validate:aue},password:!0,binary:!0};Ys.fastFormats={...Ys.fullFormats,date:Xs(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Y2),time:Xs(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Q2),"date-time":Xs(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,lue),"iso-time":Xs(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,uue),"iso-date-time":Xs(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,due),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Ys.formatNames=Object.keys(Ys.fullFormats);function pMe(t){return t%4===0&&(t%100!==0||t%400===0)}var fMe=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,mMe=[0,31,28,31,30,31,30,31,31,30,31,30,31];function cue(t){let e=fMe.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&pMe(r)?29:mMe[o])}function Y2(t,e){if(t&&e)return t>e?1:t<e?-1:0}var J2=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function G2(t){return function(r){let o=J2.exec(r);if(!o)return!1;let n=+o[1],i=+o[2],s=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||t&&!a)return!1;if(n<=23&&i<=59&&s<60)return!0;let d=i-l*c,f=n-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&s<61}}function Q2(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function uue(t,e){if(!(t&&e))return;let r=J2.exec(t),o=J2.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t<e?-1:0}var X2=/t|\s/i;function iue(t){let e=G2(t);return function(o){let n=o.split(X2);return n.length===2&&cue(n[0])&&e(n[1])}}function lue(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function due(t,e){if(!(t&&e))return;let[r,o]=t.split(X2),[n,i]=e.split(X2),s=Y2(r,n);if(s!==void 0)return s||Q2(o,i)}var hMe=/\/|:/,gMe=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function yMe(t){return hMe.test(t)&&gMe.test(t)}var sue=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function vMe(t){return sue.lastIndex=0,sue.test(t)}var wMe=-(2**31),bMe=2**31-1;function _Me(t){return Number.isInteger(t)&&t<=bMe&&t>=wMe}function SMe(t){return Number.isInteger(t)}function aue(){return!0}var xMe=/[^\\]\\Z/;function EMe(t){if(xMe.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var fue=R(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});jm.formatLimitDefinition=void 0;var kMe=W2(),Ki=ke(),ku=Ki.operators,DT={formatMaximum:{okStr:"<=",ok:ku.LTE,fail:ku.GT},formatMinimum:{okStr:">=",ok:ku.GTE,fail:ku.LT},formatExclusiveMaximum:{okStr:"<",ok:ku.LT,fail:ku.GTE},formatExclusiveMinimum:{okStr:">",ok:ku.GT,fail:ku.LTE}},IMe={message:({keyword:t,schemaCode:e})=>(0,Ki.str)`should be ${DT[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ki._)`{comparison: ${DT[t].okStr}, limit: ${e}}`};jm.formatLimitDefinition={keyword:Object.keys(DT),type:"string",schemaType:"string",$data:!0,error:IMe,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:i}=t,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new kMe.KeywordCxt(i,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),p=e.const("fmt",(0,Ki._)`${f}[${c.schemaCode}]`);t.fail$data((0,Ki.or)((0,Ki._)`typeof ${p} != "object"`,(0,Ki._)`${p} instanceof RegExp`,(0,Ki._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${n}": format "${f}" does not define "compare" function`);let m=e.scopeValue("formats",{key:f,ref:p,code:s.code.formats?(0,Ki._)`${s.code.formats}${(0,Ki.getProperty)(f)}`:void 0});t.fail$data(d(m))}function d(f){return(0,Ki._)`${f}.compare(${r}, ${o}) ${DT[n].fail} 0`}},dependencies:["format"]};var $Me=t=>(t.addKeyword(jm.formatLimitDefinition),t);jm.default=$Me});var yue=R((Zw,gue)=>{"use strict";Object.defineProperty(Zw,"__esModule",{value:!0});var Mm=pue(),AMe=fue(),eF=ke(),mue=new eF.Name("fullFormats"),TMe=new eF.Name("fastFormats"),tF=(t,e={keywords:!0})=>{if(Array.isArray(e))return hue(t,e,Mm.fullFormats,mue),t;let[r,o]=e.mode==="fast"?[Mm.fastFormats,TMe]:[Mm.fullFormats,mue],n=e.formats||Mm.formatNames;return hue(t,n,r,o),e.keywords&&(0,AMe.default)(t),t};tF.get=(t,e="full")=>{let o=(e==="fast"?Mm.fastFormats:Mm.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function hue(t,e,r,o){var n,i;(n=(i=t.opts.code).formats)!==null&&n!==void 0||(i.formats=(0,eF._)`require("ajv-formats/dist/formats").${o}`);for(let s of e)t.addFormat(s,r[s])}gue.exports=Zw=tF;Object.defineProperty(Zw,"__esModule",{value:!0});Zw.default=tF});import{parseArgs as uUe}from"node:util";import{spawn as cle}from"node:child_process";import{hostname as fF}from"node:os";import{open as lUe,readFile as KT,rename as dUe,rm as ule}from"node:fs/promises";import{dirname as pUe,join as fUe,resolve as eb}from"node:path";import{randomUUID as lle}from"node:crypto";import{Readable as dle}from"node:stream";import{pipeline as ple}from"node:stream/promises";import{setTimeout as mF}from"node:timers/promises";var h={};yt(h,{$brand:()=>sP,$input:()=>TR,$output:()=>AR,INVALID:()=>un,NEVER:()=>iP,TimePrecision:()=>jR,ZodAny:()=>JC,ZodArray:()=>QC,ZodBase64:()=>rx,ZodBase64URL:()=>nx,ZodBigInt:()=>Xd,ZodBigIntFormat:()=>sx,ZodBoolean:()=>Gd,ZodCIDRv4:()=>ex,ZodCIDRv6:()=>tx,ZodCUID:()=>ZS,ZodCUID2:()=>WS,ZodCatch:()=>vO,ZodCodec:()=>Qh,ZodCompileAsyncError:()=>Yo,ZodCompileUnsupportedError:()=>Re,ZodCreditCard:()=>BC,ZodCustom:()=>eg,ZodCustomStringFormat:()=>Vu,ZodDate:()=>Wh,ZodDefault:()=>pO,ZodDiscriminatedUnion:()=>tO,ZodE164:()=>ox,ZodEmail:()=>HS,ZodEmoji:()=>KS,ZodEnum:()=>Zd,ZodError:()=>bme,ZodExactOptional:()=>ux,ZodFile:()=>cO,ZodFirstPartyTypeKind:()=>CO,ZodFunction:()=>AO,ZodGUID:()=>BS,ZodIBAN:()=>KC,ZodIPv4:()=>YS,ZodIPv6:()=>QS,ZodISODate:()=>Xa,ZodISODateTime:()=>Ga,ZodISODuration:()=>Qa,ZodISOTime:()=>Ya,ZodInstanceOf:()=>RO,ZodIntersection:()=>rO,ZodIssueCode:()=>xme,ZodJWT:()=>ix,ZodKSUID:()=>XS,ZodLazy:()=>kO,ZodLiteral:()=>aO,ZodMAC:()=>HC,ZodMap:()=>iO,ZodNaN:()=>bO,ZodNanoID:()=>qS,ZodNever:()=>XC,ZodNonOptional:()=>lx,ZodNull:()=>WC,ZodNullable:()=>dO,ZodNumber:()=>Jd,ZodNumberFormat:()=>Hu,ZodObject:()=>Jh,ZodOptional:()=>Bu,ZodPipe:()=>Yh,ZodPrefault:()=>mO,ZodPreprocess:()=>_O,ZodPromise:()=>$O,ZodReadonly:()=>SO,ZodRealError:()=>An,ZodRecord:()=>qd,ZodSet:()=>sO,ZodString:()=>Wd,ZodStringFormat:()=>it,ZodSuccess:()=>yO,ZodSymbol:()=>qC,ZodTemplateLiteral:()=>EO,ZodTransform:()=>uO,ZodTuple:()=>nO,ZodType:()=>ge,ZodULID:()=>JS,ZodURL:()=>qh,ZodUUID:()=>Xi,ZodUndefined:()=>ZC,ZodUnion:()=>Gh,ZodUnknown:()=>GC,ZodVoid:()=>YC,ZodXID:()=>GS,ZodXor:()=>eO,_ZodString:()=>VS,_default:()=>fO,_function:()=>iB,any:()=>LH,array:()=>Ae,base64:()=>bH,base64url:()=>_H,bigint:()=>DH,boolean:()=>Vt,catch:()=>wO,check:()=>sB,cidrv4:()=>vH,cidrv6:()=>wH,clone:()=>qe,codec:()=>tB,coerce:()=>NO,compile:()=>OR,config:()=>zt,core:()=>ei,creditCard:()=>xH,cuid:()=>lH,cuid2:()=>dH,currencyCode:()=>TH,custom:()=>dx,date:()=>VH,decode:()=>zC,decodeAsync:()=>MC,deepPartial:()=>vB,describe:()=>aB,discriminatedUnion:()=>Xh,e164:()=>SH,email:()=>eH,emoji:()=>cH,encode:()=>DC,encodeAsync:()=>jC,endsWith:()=>Dd,enum:()=>_r,exactOptional:()=>lO,file:()=>XH,flattenError:()=>Ym,float32:()=>RH,float64:()=>CH,formatError:()=>Qm,fromJSONSchema:()=>gB,function:()=>iB,getDiscriminatedOption:()=>ER,getErrorMap:()=>kme,globalRegistry:()=>wr,gt:()=>Ji,gte:()=>Kn,guid:()=>tH,hash:()=>PH,hex:()=>AH,hostname:()=>$H,httpUrl:()=>aH,iban:()=>EH,includes:()=>Od,input:()=>bB,instanceof:()=>uB,int:()=>LS,int32:()=>OH,int64:()=>zH,intersection:()=>Yd,invertCodec:()=>rB,ipv4:()=>hH,ipv6:()=>yH,iso:()=>Ku,json:()=>dB,jwt:()=>kH,keyof:()=>HH,ksuid:()=>mH,lazy:()=>IO,length:()=>Uu,literal:()=>G,locales:()=>$d,looseObject:()=>br,looseRecord:()=>ZH,lowercase:()=>Rd,lt:()=>Wi,lte:()=>Bn,mac:()=>gH,map:()=>WH,maxLength:()=>Mu,maxSize:()=>Ka,memoizer:()=>gh,meta:()=>cB,mime:()=>jd,minLength:()=>ra,minSize:()=>Gi,multipleOf:()=>Ba,nan:()=>eB,nanoid:()=>uH,nativeEnum:()=>GH,negative:()=>xS,never:()=>ax,nonnegative:()=>kS,nonoptional:()=>gO,nonpositive:()=>ES,normalize:()=>Md,null:()=>Zh,nullable:()=>Kh,nullish:()=>YH,number:()=>Ze,object:()=>H,optional:()=>ot,output:()=>_B,overwrite:()=>Qo,parse:()=>RC,parseAsync:()=>CC,partialRecord:()=>qH,pipe:()=>FS,positive:()=>SS,prefault:()=>hO,preprocess:()=>tg,prettifyError:()=>dP,promise:()=>oB,properties:()=>zd,property:()=>IS,readonly:()=>xO,record:()=>st,refine:()=>TO,regex:()=>Pd,regexes:()=>Hn,registry:()=>J_,safeDecode:()=>LC,safeDecodeAsync:()=>VC,safeEncode:()=>UC,safeEncodeAsync:()=>FC,safeParse:()=>OC,safeParseAsync:()=>NC,set:()=>JH,setErrorMap:()=>Eme,size:()=>ju,slugify:()=>Vd,startsWith:()=>Nd,strictObject:()=>BH,string:()=>I,stringFormat:()=>IH,stringbool:()=>lB,success:()=>QH,superRefine:()=>PO,symbol:()=>MH,templateLiteral:()=>nB,toJSONSchema:()=>Lu,toLowerCase:()=>Ld,toUpperCase:()=>Fd,toZod:()=>Hm,transform:()=>cx,treeifyError:()=>lP,trim:()=>Ud,tuple:()=>oO,uint32:()=>NH,uint64:()=>jH,ulid:()=>pH,undefined:()=>UH,union:()=>tt,unknown:()=>ut,uppercase:()=>Cd,url:()=>sH,util:()=>A,uuid:()=>rH,uuidv4:()=>nH,uuidv6:()=>oH,uuidv7:()=>iH,validate:()=>yd,validateAsync:()=>vd,void:()=>FH,withParser:()=>G_,xid:()=>fH,xor:()=>KH});var ei={};yt(ei,{$ZodAny:()=>u_,$ZodArray:()=>m_,$ZodAsyncError:()=>In,$ZodBase64:()=>Zb,$ZodBase64URL:()=>Jb,$ZodBigInt:()=>lh,$ZodBigIntFormat:()=>i_,$ZodBoolean:()=>_d,$ZodCIDRv4:()=>Hb,$ZodCIDRv6:()=>Kb,$ZodCUID:()=>Db,$ZodCUID2:()=>zb,$ZodCatch:()=>C_,$ZodCheck:()=>nt,$ZodCheckBigIntFormat:()=>XP,$ZodCheckEndsWith:()=>uR,$ZodCheckGreaterThan:()=>bb,$ZodCheckIncludes:()=>aR,$ZodCheckLengthEquals:()=>nR,$ZodCheckLessThan:()=>wb,$ZodCheckLowerCase:()=>iR,$ZodCheckMaxLength:()=>tR,$ZodCheckMaxSize:()=>YP,$ZodCheckMimeType:()=>pR,$ZodCheckMinLength:()=>rR,$ZodCheckMinSize:()=>QP,$ZodCheckMultipleOf:()=>JP,$ZodCheckNumberFormat:()=>GP,$ZodCheckOverwrite:()=>fR,$ZodCheckProperties:()=>dR,$ZodCheckProperty:()=>lR,$ZodCheckRegex:()=>oR,$ZodCheckSizeEquals:()=>eR,$ZodCheckStartsWith:()=>cR,$ZodCheckStringFormat:()=>wd,$ZodCheckUpperCase:()=>sR,$ZodCodec:()=>xd,$ZodCreditCard:()=>Yb,$ZodCustom:()=>M_,$ZodCustomStringFormat:()=>n_,$ZodCyclicError:()=>V_,$ZodDate:()=>f_,$ZodDefault:()=>A_,$ZodDiscriminatedUnion:()=>y_,$ZodE164:()=>Gb,$ZodEmail:()=>Ab,$ZodEmoji:()=>Ob,$ZodEncodeError:()=>Fa,$ZodEnum:()=>S_,$ZodError:()=>uP,$ZodExactOptional:()=>I_,$ZodFile:()=>E_,$ZodFunction:()=>z_,$ZodGUID:()=>Ib,$ZodIBAN:()=>e_,$ZodIPv4:()=>Lb,$ZodIPv6:()=>Fb,$ZodISODate:()=>wR,$ZodISODateTime:()=>vR,$ZodISODuration:()=>_R,$ZodISOTime:()=>bR,$ZodIntersection:()=>v_,$ZodJWT:()=>r_,$ZodKSUID:()=>Ub,$ZodLazy:()=>Ed,$ZodLiteral:()=>x_,$ZodMAC:()=>Vb,$ZodMap:()=>b_,$ZodNaN:()=>O_,$ZodNanoID:()=>Nb,$ZodNever:()=>d_,$ZodNonOptional:()=>P_,$ZodNull:()=>c_,$ZodNullable:()=>$_,$ZodNumber:()=>uh,$ZodNumberFormat:()=>o_,$ZodObject:()=>h_,$ZodObjectJIT:()=>xR,$ZodOptional:()=>ph,$ZodPipe:()=>fh,$ZodPrefault:()=>T_,$ZodPreprocess:()=>kR,$ZodPromise:()=>j_,$ZodReadonly:()=>N_,$ZodRealError:()=>$n,$ZodRecord:()=>w_,$ZodRegistry:()=>W_,$ZodSet:()=>__,$ZodString:()=>Va,$ZodStringFormat:()=>Je,$ZodSuccess:()=>R_,$ZodSymbol:()=>s_,$ZodTemplateLiteral:()=>D_,$ZodTransform:()=>k_,$ZodTuple:()=>dh,$ZodType:()=>ae,$ZodULID:()=>jb,$ZodURL:()=>Cb,$ZodUUID:()=>$b,$ZodUndefined:()=>a_,$ZodUnion:()=>Sd,$ZodUnknown:()=>l_,$ZodVoid:()=>p_,$ZodXID:()=>Mb,$ZodXor:()=>g_,$brand:()=>sP,$constructor:()=>S,$input:()=>TR,$output:()=>AR,Doc:()=>Ou,INVALID:()=>un,JSONSchema:()=>XV,JSONSchemaGenerator:()=>jS,NEVER:()=>iP,TimePrecision:()=>jR,URL_BAD_FORMAT:()=>gR,URL_UNPARSEABLE:()=>oh,ZodCompileAsyncError:()=>Yo,ZodCompileUnsupportedError:()=>Re,_any:()=>gS,_array:()=>VR,_base64:()=>Dh,_base64url:()=>zh,_bigint:()=>lS,_boolean:()=>uS,_catch:()=>cme,_check:()=>DV,_cidrv4:()=>Oh,_cidrv6:()=>Nh,_coercedBigint:()=>LR,_coercedBoolean:()=>UR,_coercedDate:()=>FR,_coercedNumber:()=>MR,_coercedString:()=>zR,_creditCard:()=>tS,_cuid:()=>Ih,_cuid2:()=>$h,_custom:()=>AS,_date:()=>bS,_decode:()=>cb,_decodeAsync:()=>lb,_default:()=>ime,_discriminatedUnion:()=>Zfe,_e164:()=>jh,_email:()=>vh,_emoji:()=>Eh,_encode:()=>ab,_encodeAsync:()=>ub,_endsWith:()=>Dd,_enum:()=>Qfe,_file:()=>$S,_float32:()=>iS,_float64:()=>sS,_gt:()=>Ji,_gte:()=>Kn,_guid:()=>wh,_iban:()=>rS,_includes:()=>Od,_int:()=>oS,_int32:()=>aS,_int64:()=>dS,_intersection:()=>Wfe,_ipv4:()=>Rh,_ipv6:()=>Ch,_isoDate:()=>Lh,_isoDateTime:()=>Uh,_isoDuration:()=>Vh,_isoTime:()=>Fh,_jwt:()=>Mh,_ksuid:()=>Ph,_lazy:()=>pme,_length:()=>Uu,_literal:()=>tme,_lowercase:()=>Rd,_lt:()=>Wi,_lte:()=>Bn,_mac:()=>eS,_map:()=>Xfe,_max:()=>Bn,_maxLength:()=>Mu,_maxSize:()=>Ka,_mime:()=>jd,_min:()=>Kn,_minLength:()=>ra,_minSize:()=>Gi,_multipleOf:()=>Ba,_nan:()=>_S,_nanoid:()=>kh,_nativeEnum:()=>eme,_negative:()=>xS,_never:()=>vS,_nonnegative:()=>kS,_nonoptional:()=>sme,_nonpositive:()=>ES,_normalize:()=>Md,_null:()=>hS,_nullable:()=>ome,_number:()=>nS,_optional:()=>nme,_overwrite:()=>Qo,_parse:()=>dd,_parseAsync:()=>pd,_pipe:()=>ume,_positive:()=>SS,_promise:()=>fme,_properties:()=>zd,_property:()=>IS,_readonly:()=>lme,_record:()=>Gfe,_refine:()=>TS,_regex:()=>Pd,_safeDecode:()=>pb,_safeDecodeAsync:()=>mb,_safeEncode:()=>db,_safeEncodeAsync:()=>fb,_safeParse:()=>fd,_safeParseAsync:()=>hd,_set:()=>Yfe,_size:()=>ju,_slugify:()=>Vd,_startsWith:()=>Nd,_string:()=>Q_,_stringFormat:()=>qa,_stringbool:()=>OS,_success:()=>ame,_superRefine:()=>PS,_symbol:()=>fS,_templateLiteral:()=>dme,_toLowerCase:()=>Ld,_toUpperCase:()=>Fd,_transform:()=>rme,_trim:()=>Ud,_tuple:()=>Jfe,_uint32:()=>cS,_uint64:()=>pS,_ulid:()=>Ah,_undefined:()=>mS,_union:()=>Kfe,_unknown:()=>yS,_uppercase:()=>Cd,_url:()=>Td,_uuid:()=>bh,_uuidv4:()=>_h,_uuidv6:()=>Sh,_uuidv7:()=>xh,_void:()=>wS,_xid:()=>Th,_xor:()=>qfe,base64Charset:()=>qb,base64urlCharset:()=>ch,canParseURL:()=>yR,clone:()=>qe,compile:()=>OR,compileFn:()=>X_,config:()=>zt,createStandardJSONSchemaMethod:()=>Hd,createToJSONSchemaMethod:()=>BR,decode:()=>zF,decodeAsync:()=>MF,describe:()=>RS,encode:()=>DF,encodeAsync:()=>jF,extractDefs:()=>Wa,finalize:()=>Ja,flattenError:()=>Ym,formatError:()=>Qm,getDiscriminatedOption:()=>ER,globalConfig:()=>cr,globalRegistry:()=>wr,handleUnrepresentable:()=>Xt,initializeContext:()=>Za,isBackEdge:()=>B_,isRecursiveSchema:()=>H_,isValidBase64:()=>ah,isValidBase64URL:()=>Wb,isValidCIDRv6:()=>Bb,isValidCreditCard:()=>Xb,isValidIBAN:()=>Qb,isValidIPv6:()=>sh,isValidJWT:()=>t_,locales:()=>$d,memoizer:()=>gh,mergeValues:()=>bd,meta:()=>CS,parse:()=>Pu,parseAsync:()=>Ru,parseURLObject:()=>c6,prettifyError:()=>dP,process:()=>et,processSchema:()=>et,regexes:()=>Hn,registry:()=>J_,safeDecode:()=>LF,safeDecodeAsync:()=>VF,safeEncode:()=>UF,safeEncodeAsync:()=>FF,safeParse:()=>md,safeParseAsync:()=>gd,standardProps:()=>kb,stripTabAndNewline:()=>ih,toDotPath:()=>OF,toJSONSchema:()=>Lu,toZod:()=>Hm,treeifyError:()=>lP,urlHostnameOk:()=>Pb,urlProtocolOk:()=>Rb,util:()=>A,validate:()=>yd,validateAsync:()=>vd,validateURL:()=>Tb,version:()=>mR,withParser:()=>G_});var A={};yt(A,{BIGINT_FORMAT_RANGES:()=>Zm,CONSTANT_CATCH:()=>ib,Class:()=>WT,NUMBER_FORMAT_RANGES:()=>qm,aborted:()=>cn,allowsEval:()=>XT,assert:()=>Ele,assertEqual:()=>ble,assertIs:()=>Sle,assertNever:()=>xle,assertNotEqual:()=>_le,assignProp:()=>vr,attachSchema:()=>Wm,base64ToUint8Array:()=>$F,base64urlToUint8Array:()=>zle,cached:()=>sd,captureStackTrace:()=>nb,cleanEnum:()=>Dle,cleanRegex:()=>ea,clone:()=>qe,cloneDef:()=>$le,codePointLength:()=>Tu,constantCatch:()=>nP,createTransparentProxy:()=>Ole,defineLazy:()=>JT,defineLazyInternal:()=>be,derived:()=>Lle,esc:()=>an,escapeRegex:()=>ho,explicitlyAborted:()=>eP,extend:()=>_F,finalizeIssue:()=>kn,floatSafeRemainder:()=>Bm,getElementAtPath:()=>Ale,getEnumValues:()=>od,getLengthableOrigin:()=>Gm,getParsedType:()=>Cle,getSizableOrigin:()=>Jm,hexToUint8Array:()=>Mle,hide:()=>Xm,installLazyProp:()=>rP,isObject:()=>Au,isPlainObject:()=>mo,issue:()=>ld,joinValues:()=>x,jsonStringifyReplacer:()=>id,members:()=>tP,merge:()=>EF,mergeDefs:()=>fo,normalizeParams:()=>N,nullish:()=>rb,numKeys:()=>Rle,objectClone:()=>kle,omit:()=>bF,optionalKeys:()=>QT,own:()=>Zi,parsedType:()=>P,partial:()=>kF,pick:()=>wF,prefixIssues:()=>En,primitiveTypes:()=>YT,promiseAllObject:()=>Tle,propertyKeyTypes:()=>Km,randomString:()=>Ple,rawShape:()=>ad,required:()=>IF,safeExtend:()=>xF,shallowClone:()=>cd,sizeCaps:()=>ud,slugify:()=>GT,stringifyPrimitive:()=>T,toZod:()=>Hm,uint8ArrayToBase64:()=>AF,uint8ArrayToBase64url:()=>jle,uint8ArrayToHex:()=>Ule,unwrapMessage:()=>nd});function ble(t){return t}function _le(t){return t}function Hm(){return t=>t}function Sle(t){}function xle(t){throw new Error("Unexpected value in exhaustive check")}function Ele(t){}function od(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,n])=>e.indexOf(+o)===-1).map(([o,n])=>n)}function x(t,e="|"){return t.map(r=>T(r)).join(e)}function id(t,e){return typeof e=="bigint"?e.toString():e}var ZT=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function sd(t){return new ZT(t)}function rb(t){return t==null}function ea(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Bm(t,e){let r=t/e,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var gF=Symbol("evaluating");function JT(t,e,r){let o;Object.defineProperty(t,e,{get(){if(o!==gF)return o===void 0&&(o=gF,o=r()),o},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function kle(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function vr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ad(t){let e=Object.getOwnPropertyDescriptor(t,"shape");return e?.get?e.get.raw:e?.value}function Qs(t){return ad(t._zod.def)??t._zod.def.shape}function yF(t,e,r){Object.defineProperty(t,e,{get(){let o=r();return vr(this,e,o),o},enumerable:!0,configurable:!0})}function vF(t,e,r){e in t?vr(t,e,r):t[e]=r}function $u(t,e,r,o){let n=Qs(e);for(let i of r){let s=Object.getOwnPropertyDescriptor(n,i);s.enumerable&&(s.get?yF(t,i,()=>{let a=e._zod.def.shape[i];return o?o(a,i):a}):vF(t,i,o?o(s.value,i):s.value))}}function Ile(t,e){for(let r of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,r);o.enumerable&&(o.get?yF(t,r,()=>e[r]):vF(t,r,o.value))}}function fo(...t){let e={};for(let r of t){let o=Object.getOwnPropertyDescriptors(r);Object.assign(e,o)}return Object.defineProperties({},e)}function $le(t){return fo(t._zod.def)}function Ale(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function Tle(t){let e=Object.keys(t),r=e.map(o=>t[o]);return Promise.all(r).then(o=>{let n={};for(let i=0;i<e.length;i++)n[e[i]]=o[i];return n})}function Ple(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<t;o++)r+=e[Math.floor(Math.random()*e.length)];return r}function an(t){return JSON.stringify(t)}function GT(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var nb="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Au(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var XT=sd(()=>{if(cr.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function mo(t){if(Au(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Au(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function cd(t){return mo(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function Rle(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var Cle=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Km=new Set(["string","number","symbol"]),YT=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ho(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qe(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function N(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Ole(t){let e;return new Proxy({},{get(r,o,n){return e??(e=t()),Reflect.get(e,o,n)},set(r,o,n,i){return e??(e=t()),Reflect.set(e,o,n,i)},has(r,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(r,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(r,o,n){return e??(e=t()),Reflect.defineProperty(e,o,n)}})}function T(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function QT(t){return Object.keys(t).filter(e=>t[e]._zod.optin!==void 0&&t[e]._zod.optout==="optional")}var qm={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Zm={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function wF(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return $u(i,t,ob(t,e)),qe(t,fo(r,{shape:i,checks:[]}))}function ob(t,e){let r=Qs(t),o=[];for(let n of Reflect.ownKeys(e)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw new Error(`Unrecognized key: "${String(n)}"`);e[n]&&o.push(n)}return o}function bF(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ob(t,e)),s={};return $u(s,t,Reflect.ownKeys(Qs(t)).filter(a=>!i.has(a))),qe(t,fo(r,{shape:s,checks:[]}))}function _F(t,e){if(!mo(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let n=Qs(t);for(let i of Reflect.ownKeys(e))if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return qe(t,fo(t._zod.def,{shape:SF(t,e)}))}function SF(t,e){let r={};return $u(r,t,Reflect.ownKeys(Qs(t))),Ile(r,e),r}function xF(t,e){if(!mo(e))throw new Error("Invalid input to safeExtend: expected a plain object");return qe(t,fo(t._zod.def,{shape:SF(t,e)}))}function EF(t,e){if(!e?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};$u(r,t,Reflect.ownKeys(Qs(t))),$u(r,e,Reflect.ownKeys(Qs(e)));let o=fo(t._zod.def,{shape:r,get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return qe(t,o)}function kF(t,e,r,o="partial"){let i=e._zod.def.checks;if(i&&i.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let a=r?new Set(ob(e,r)):void 0,c={};return $u(c,e,Reflect.ownKeys(Qs(e)),t&&((u,l)=>a&&!a.has(l)?u:new t({type:"optional",innerType:u}))),qe(e,fo(e._zod.def,{shape:c,checks:[]}))}function IF(t,e,r){let o=r?new Set(ob(e,r)):void 0,n={};return $u(n,e,Reflect.ownKeys(Qs(e)),(i,s)=>o&&!o.has(s)?i:new t({type:"nonoptional",innerType:i})),qe(e,fo(e._zod.def,{shape:n}))}function cn(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function eP(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function En(t,e){return e.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function nd(t){return typeof t=="string"?t:t?.message}function ud(t){let e=[];for(let r of t??[]){let o=r._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let n=o.maximum??o.length??o.size;n>=0&&e.push([n,r])}return e}function Wm(t,e,r){var o;for(let n=e;n<t.length;n++)(o=t[n]).schema??(o.schema=r)}function kn(t,e,r){var o;let n=t.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(o=t).schema??(o.schema=t.inst):t.schema=t.inst);let i=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,s=t.message?t.message:nd(t.inst?._zod.def?.error?.(t))??nd(i?.(t))??nd(e?.error?.(t))??nd(r.customError?.(t))??nd(r.localeError?.(t))??"Invalid input",a={};for(let c of Object.keys(t))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=t[c]);return a.path??(a.path=[]),a.message=s,e?.reportInput&&(a.input=t.input),a}function Jm(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}var Nle=/[\uD800-\uDBFF]/;function Tu(t){let e=t.length;if(!Nle.test(t))return e;let r=e;for(let o=0;o<e-1;o++)(t.charCodeAt(o)&64512)===55296&&(t.charCodeAt(o+1)&64512)===56320&&(r--,o++);return r}function Gm(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function P(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function ld(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function Dle(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function $F(t){let e=atob(t),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);return r}function AF(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function zle(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return $F(e+r)}function jle(t){return AF(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Mle(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)r[o/2]=Number.parseInt(e.slice(o,o+2),16);return r}function Ule(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var WT=class{constructor(...e){}};function tP(t,e){for(let r in e){let o=Object.getOwnPropertyDescriptor(e,r);o.get?Object.defineProperty(t,r,{...o,enumerable:!1}):Fle(t,r,o.value)}}function Zi(t,e,r,o=!0){return Object.defineProperty(t,e,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function Xm(t,e,r){return Zi(t,e,r,!1)}function Lle(t,e){for(let r in t){let o=t[r];Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){return Zi(this,r,o(this))},set(n){Zi(this,r,n)}})}return e}function Fle(t,e,r){Object.defineProperty(t,e,{configurable:!0,get(){return this==null?r:Zi(this,e,r.bind(this))},set(o){Zi(this,e,o)}})}function Vle(t,e){let r=Object.getPrototypeOf(t);return e in r?void 0:r}var qT,La=!1,Hle={configurable:!0,get(){La=!0}};function be(t,e,r){let o=Object.getPrototypeOf(t._zod);if(e in o&&qT!==t._zod){qT=void 0;return}qT=t._zod,Object.defineProperty(o,e,{configurable:!0,get(){Object.defineProperty(this,e,Hle);let n=La;La=!1;try{let i=r(this);return La?delete this[e]:Object.defineProperty(this,e,{configurable:!0,writable:!0,value:i}),La=La||n,i}catch(i){throw delete this[e],La=La||n,i}},set(n){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:n})}})}function rP(t,e,r,o){let n=Vle(t,e);n&&Object.defineProperty(n,e,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,e,i),i.value=r(this),Object.defineProperty(this,e,i),i.value},set(i){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:o,value:i})}})}var ib="~constantCatch";function nP(t){let e=()=>t;return e[ib]=!0,e}var TF,iP=Object.freeze({status:"aborted"}),oP={value:void 0,enumerable:!1},PF="captureStackTrace"in Error?Error:null;function Ble(t){let e=PF;if(e){let r=e.stackTraceLimit;if(typeof r=="number"){try{e.stackTraceLimit=0}catch{return PF=null,new t}try{return new t}finally{e.stackTraceLimit=r}}}return new t}function S(t,e,r,o){let n={};function i(f){this.def=f,this.constr=d,this.traits=new Set}i.prototype=n;let s=r,a=s&&new WeakSet;function c(f,p){if(f._zod){if(f._zod.traits.has(t))return}else{oP.value=new i(p);try{Object.defineProperty(f,"_zod",oP)}finally{oP.value=void 0}}if(f._zod.traits.add(t),e(f,p),a){let g=Object.getPrototypeOf(f),y=f._zod.constr.prototype,w=g;for(;w&&w!==y;)w=Object.getPrototypeOf(w);let b=w??g;a.has(b)||(a.add(b),tP(b,s))}let m=d.prototype;for(let g in m)Object.prototype.hasOwnProperty.call(m,g)&&(g in f||(f[g]=m[g].bind(f)))}let u=o?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:t});function d(f){let p=o?.Parent?Ble(l):this;c(p,f);let m=p._zod.deferred;if(m){for(let y of m)y();p._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;return g&&g(p),p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>o?.Parent&&f instanceof o.Parent?!0:f?._zod?.traits?.has(t)}),Object.defineProperty(d,"name",{value:t}),d}var sP=Symbol("zod_brand"),In=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Fa=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(TF=globalThis).__zod_globalConfig??(TF.__zod_globalConfig={});var cr=globalThis.__zod_globalConfig;function zt(t){return t&&Object.assign(cr,t),cr}function Kle(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,id,2)),t.message}function qle(t){this._zod.message=t}var Zle={get:Kle,set:qle,enumerable:!0,configurable:!0},cP={value:void 0,enumerable:!1},RF=new WeakSet([Object.prototype,Error.prototype]),CF=(t,e)=>{t.name="$ZodError",cP.value=e,Object.defineProperty(t,"issues",cP),cP.value=void 0,Object.defineProperty(t,"message",Zle);let r=Object.getPrototypeOf(t);RF.has(r)||(RF.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},uP=S("$ZodError",CF),$n=S("$ZodError",CF,void 0,{Parent:Error});function Wle(t,e,r){return Object.prototype.hasOwnProperty.call(t,e)||(e==="__proto__"?Object.defineProperty(t,e,{value:r(),writable:!0,enumerable:!0,configurable:!0}):t[e]=r()),t[e]}function Ym(t,e=r=>r.message){let r={},o=[];for(let n of t.issues)n.path.length>0?Wle(r,n.path[0],()=>[]).push(e(n)):o.push(e(n));return{formErrors:o,fieldErrors:r}}function Qm(t,e=r=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(e(s));else{let c=r,u=0;for(;u<a.length;){let l=a[u],d=u===a.length-1;if(l==="_errors"){d&&c._errors.push(e(s)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=c[l];d&&f._errors.push(e(s)),c=f,u++}}}};return o(t),r}function lP(t,e=r=>r.message){let r={errors:[]},o=(n,i=[])=>{var s;for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>o({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...i,...a.path]);else{let c=[...i,...a.path];if(c.length===0){r.errors.push(e(a));continue}let u=r,l=0;for(;l<c.length;){let d=c[l],f=l===c.length-1;typeof d=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,d)||Object.defineProperty(u.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[d]):(u.items??(u.items=[]),(s=u.items)[d]??(s[d]={errors:[]}),u=u.items[d]),f&&u.errors.push(e(a)),l++}}};return o(t),r}function OF(t){let e=[],r=t.map(o=>typeof o=="object"?o.key:o);for(let o of r)typeof o=="number"?e.push(`[${o}]`):typeof o=="symbol"?e.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?e.push(`[${JSON.stringify(o)}]`):(e.length&&e.push("."),e.push(o));return e.join("")}function dP(t){let e=[],r=[...t.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)e.push(`\u2716 ${o.message}`),o.path?.length&&e.push(` \u2192 at ${OF(o.path)}`);return e.join(`
67
+ deps: ${r}}`};var oje={keyword:"dependencies",type:"object",schemaType:"object",error:Gs.error,code(t){let[e,r]=ije(t);$ce(t,e),Ace(t,r)}};function ije({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function $ce(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let c=(0,qw.propertyInData)(r,o,s,n.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,qw.checkReportMissingProp)(t,u)}):(r.if((0,A2._)`${c} && (${(0,qw.checkMissingProp)(t,a,i)})`),(0,qw.reportMissingProp)(t,i),r.else())}}Gs.validatePropertyDeps=$ce;function Ace(t,e=t.schema){let{gen:r,data:o,keyword:n,it:i}=t,s=r.name("valid");for(let a in e)(0,nje.alwaysValidSchema)(i,e[a])||(r.if((0,qw.propertyInData)(r,o,a,i.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},s);t.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),t.ok(s))}Gs.validateSchemaDeps=Ace;Gs.default=oje});var Rce=R(T2=>{"use strict";Object.defineProperty(T2,"__esModule",{value:!0});var Pce=ke(),sje=Be(),aje={message:"property name must be valid",params:({params:t})=>(0,Pce._)`{propertyName: ${t.propertyName}}`},cje={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:aje,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,sje.alwaysValidSchema)(n,r))return;let i=e.name("valid");e.forIn("key",o,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),e.if((0,Pce.not)(i),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(i)}};T2.default=cje});var R2=R(P2=>{"use strict";Object.defineProperty(P2,"__esModule",{value:!0});var AT=Jo(),Bi=ke(),uje=Ma(),TT=Be(),lje={message:"must NOT have additional properties",params:({params:t})=>(0,Bi._)`{additionalProperty: ${t.additionalProperty}}`},dje={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:lje,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,TT.alwaysValidSchema)(s,r))return;let u=(0,AT.allSchemaProperties)(o.properties),l=(0,AT.allSchemaProperties)(o.patternProperties);d(),t.ok((0,Bi._)`${i} === ${uje.default.errors}`);function d(){e.forIn("key",n,y=>{!u.length&&!l.length?m(y):e.if(f(y),()=>m(y))})}function f(y){let w;if(u.length>8){let b=(0,TT.schemaRefOrVal)(s,o.properties,"properties");w=(0,AT.isOwnProperty)(e,b,y)}else u.length?w=(0,Bi.or)(...u.map(b=>(0,Bi._)`${y} === ${b}`)):w=Bi.nil;return l.length&&(w=(0,Bi.or)(w,...l.map(b=>(0,Bi._)`${(0,AT.usePattern)(t,b)}.test(${y})`))),(0,Bi.not)(w)}function p(y){e.code((0,Bi._)`delete ${n}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,TT.alwaysValidSchema)(s,r)){let w=e.name("valid");c.removeAdditional==="failing"?(g(y,w,!1),e.if((0,Bi.not)(w),()=>{t.reset(),p(y)})):(g(y,w),a||e.if((0,Bi.not)(w),()=>e.break()))}}function g(y,w,b){let _={keyword:"additionalProperties",dataProp:y,dataPropType:TT.Type.Str};b===!1&&Object.assign(_,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(_,w)}}};P2.default=dje});var Nce=R(O2=>{"use strict";Object.defineProperty(O2,"__esModule",{value:!0});var pje=Rw(),Cce=Jo(),C2=Be(),Oce=R2(),fje={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:i}=t;i.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&Oce.default.code(new pje.KeywordCxt(i,Oce.default,"additionalProperties"));let s=(0,Cce.allSchemaProperties)(r);for(let d of s)i.definedProperties.add(d);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=C2.mergeEvaluated.props(e,(0,C2.toHash)(s),i.props));let a=s.filter(d=>!(0,C2.alwaysValidSchema)(i,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,Cce.propertyInData)(e,n,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};O2.default=fje});var Mce=R(N2=>{"use strict";Object.defineProperty(N2,"__esModule",{value:!0});var Dce=Jo(),PT=ke(),zce=Be(),jce=Be(),mje={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:i}=t,{opts:s}=i,a=(0,Dce.allSchemaProperties)(r),c=a.filter(g=>(0,zce.alwaysValidSchema)(i,r[g]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&n.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof PT.Name)&&(i.props=(0,jce.evaluatedPropsToName)(e,i.props));let{props:d}=i;f();function f(){for(let g of a)u&&p(g),i.allErrors?m(g):(e.var(l,!0),m(g),e.if(l))}function p(g){for(let y in u)new RegExp(g).test(y)&&(0,zce.checkStrictMode)(i,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function m(g){e.forIn("key",o,y=>{e.if((0,PT._)`${(0,Dce.usePattern)(t,g)}.test(${y})`,()=>{let w=c.includes(g);w||t.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:jce.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,PT._)`${d}[${y}]`,!0):!w&&!i.allErrors&&e.if((0,PT.not)(l),()=>e.break())})})}}};N2.default=mje});var Uce=R(D2=>{"use strict";Object.defineProperty(D2,"__esModule",{value:!0});var hje=Be(),gje={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,hje.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};D2.default=gje});var Lce=R(z2=>{"use strict";Object.defineProperty(z2,"__esModule",{value:!0});var yje=Jo(),vje={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:yje.validateUnion,error:{message:"must match a schema in anyOf"}};z2.default=vje});var Fce=R(j2=>{"use strict";Object.defineProperty(j2,"__esModule",{value:!0});var RT=ke(),wje=Be(),bje={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,RT._)`{passingSchemas: ${t.passing}}`},_je={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:bje,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let i=r,s=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(s,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let f;(0,wje.alwaysValidSchema)(n,l)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,RT._)`${c} && ${s}`).assign(s,!1).assign(a,(0,RT._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(s,!0),e.assign(a,d),f&&t.mergeEvaluated(f,RT.Name)})})}}};j2.default=_je});var Vce=R(M2=>{"use strict";Object.defineProperty(M2,"__esModule",{value:!0});var Sje=Be(),xje={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((i,s)=>{if((0,Sje.alwaysValidSchema)(o,i))return;let a=t.subschema({keyword:"allOf",schemaProp:s},n);t.ok(n),t.mergeEvaluated(a)})}};M2.default=xje});var Kce=R(U2=>{"use strict";Object.defineProperty(U2,"__esModule",{value:!0});var CT=ke(),Bce=Be(),Eje={message:({params:t})=>(0,CT.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,CT._)`{failingKeyword: ${t.ifClause}}`},kje={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Eje,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,Bce.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=Hce(o,"then"),i=Hce(o,"else");if(!n&&!i)return;let s=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else n?e.if(a,u("then")):e.if((0,CT.not)(a),u("else"));t.pass(s,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let f=t.subschema({keyword:l},a);e.assign(s,a),t.mergeValidEvaluated(f,s),d?e.assign(d,(0,CT._)`${l}`):t.setParams({ifClause:l})}}}};function Hce(t,e){let r=t.schema[e];return r!==void 0&&!(0,Bce.alwaysValidSchema)(t,r)}U2.default=kje});var qce=R(L2=>{"use strict";Object.defineProperty(L2,"__esModule",{value:!0});var Ije=Be(),$je={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Ije.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};L2.default=$je});var Zce=R(F2=>{"use strict";Object.defineProperty(F2,"__esModule",{value:!0});var Aje=x2(),Tje=xce(),Pje=E2(),Rje=kce(),Cje=Ice(),Oje=Tce(),Nje=Rce(),Dje=R2(),zje=Nce(),jje=Mce(),Mje=Uce(),Uje=Lce(),Lje=Fce(),Fje=Vce(),Vje=Kce(),Hje=qce();function Bje(t=!1){let e=[Mje.default,Uje.default,Lje.default,Fje.default,Vje.default,Hje.default,Nje.default,Dje.default,Oje.default,zje.default,jje.default];return t?e.push(Tje.default,Rje.default):e.push(Aje.default,Pje.default),e.push(Cje.default),e}F2.default=Bje});var Wce=R(V2=>{"use strict";Object.defineProperty(V2,"__esModule",{value:!0});var Bt=ke(),Kje={message:({schemaCode:t})=>(0,Bt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Bt._)`{format: ${t}}`},qje={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Kje,code(t,e){let{gen:r,data:o,$data:n,schema:i,schemaCode:s,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,Bt._)`${m}[${s}]`),y=r.let("fType"),w=r.let("format");r.if((0,Bt._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,(0,Bt._)`${g}.type || "string"`).assign(w,(0,Bt._)`${g}.validate`),()=>r.assign(y,(0,Bt._)`"string"`).assign(w,g)),t.fail$data((0,Bt.or)(b(),_()));function b(){return c.strictSchema===!1?Bt.nil:(0,Bt._)`${s} && !${w}`}function _(){let k=l.$async?(0,Bt._)`(${g}.async ? await ${w}(${o}) : ${w}(${o}))`:(0,Bt._)`${w}(${o})`,$=(0,Bt._)`(typeof ${w} == "function" ? ${k} : ${w}.test(${o}))`;return(0,Bt._)`${w} && ${w} !== true && ${y} === ${e} && !${$}`}}function p(){let m=d.formats[i];if(!m){b();return}if(m===!0)return;let[g,y,w]=_(m);g===e&&t.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn($());return}throw new Error($());function $(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function _($){let D=$ instanceof RegExp?(0,Bt.regexpCode)($):c.code.formats?(0,Bt._)`${c.code.formats}${(0,Bt.getProperty)(i)}`:void 0,K=r.scopeValue("formats",{key:i,ref:$,code:D});return typeof $=="object"&&!($ instanceof RegExp)?[$.type||"string",$.validate,(0,Bt._)`${K}.validate`]:["string",$,K]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,Bt._)`await ${w}(${o})`}return typeof y=="function"?(0,Bt._)`${w}(${o})`:(0,Bt._)`${w}.test(${o})`}}}};V2.default=qje});var Jce=R(H2=>{"use strict";Object.defineProperty(H2,"__esModule",{value:!0});var Zje=Wce(),Wje=[Zje.default];H2.default=Wje});var Gce=R(Om=>{"use strict";Object.defineProperty(Om,"__esModule",{value:!0});Om.contentVocabulary=Om.metadataVocabulary=void 0;Om.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Om.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Yce=R(B2=>{"use strict";Object.defineProperty(B2,"__esModule",{value:!0});var Jje=ice(),Gje=wce(),Xje=Zce(),Yje=Jce(),Xce=Gce(),Qje=[Jje.default,Gje.default,(0,Xje.default)(),Yje.default,Xce.metadataVocabulary,Xce.contentVocabulary];B2.default=Qje});var eue=R(OT=>{"use strict";Object.defineProperty(OT,"__esModule",{value:!0});OT.DiscrError=void 0;var Qce;(function(t){t.Tag="tag",t.Mapping="mapping"})(Qce||(OT.DiscrError=Qce={}))});var rue=R(q2=>{"use strict";Object.defineProperty(q2,"__esModule",{value:!0});var Nm=ke(),K2=eue(),tue=mT(),eMe=Cw(),tMe=Be(),rMe={message:({params:{discrError:t,tagName:e}})=>t===K2.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Nm._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},nMe={keyword:"discriminator",type:"object",schemaType:"object",error:rMe,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:i}=t,{oneOf:s}=n;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,Nm._)`${r}${(0,Nm.getProperty)(a)}`);e.if((0,Nm._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:K2.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,Nm._)`${u} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:K2.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),g=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(g,Nm.Name),m}function f(){var p;let m={},g=w(n),y=!0;for(let k=0;k<s.length;k++){let $=s[k];if($?.$ref&&!(0,tMe.schemaHasRulesButRef)($,i.self.RULES)){let K=$.$ref;if($=tue.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,K),$ instanceof tue.SchemaEnv&&($=$.schema),$===void 0)throw new eMe.default(i.opts.uriResolver,i.baseId,K)}let D=(p=$?.properties)===null||p===void 0?void 0:p[a];if(typeof D!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(g||w($)),b(D,k)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function w({required:k}){return Array.isArray(k)&&k.includes(a)}function b(k,$){if(k.const)_(k.const,$);else if(k.enum)for(let D of k.enum)_(D,$);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function _(k,$){if(typeof k!="string"||k in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[k]=$}}}};q2.default=nMe});var nue=R((tEt,oMe)=>{oMe.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var W2=R((At,Z2)=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.MissingRefError=At.ValidationError=At.CodeGen=At.Name=At.nil=At.stringify=At.str=At._=At.KeywordCxt=At.Ajv=void 0;var iMe=Qae(),sMe=Yce(),aMe=rue(),oue=nue(),cMe=["/properties"],NT="http://json-schema.org/draft-07/schema",Dm=class extends iMe.default{_addVocabularies(){super._addVocabularies(),sMe.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(aMe.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(oue,cMe):oue;this.addMetaSchema(e,NT,!1),this.refs["http://json-schema.org/schema"]=NT}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(NT)?NT:void 0)}};At.Ajv=Dm;Z2.exports=At=Dm;Z2.exports.Ajv=Dm;Object.defineProperty(At,"__esModule",{value:!0});At.default=Dm;var uMe=Rw();Object.defineProperty(At,"KeywordCxt",{enumerable:!0,get:function(){return uMe.KeywordCxt}});var zm=ke();Object.defineProperty(At,"_",{enumerable:!0,get:function(){return zm._}});Object.defineProperty(At,"str",{enumerable:!0,get:function(){return zm.str}});Object.defineProperty(At,"stringify",{enumerable:!0,get:function(){return zm.stringify}});Object.defineProperty(At,"nil",{enumerable:!0,get:function(){return zm.nil}});Object.defineProperty(At,"Name",{enumerable:!0,get:function(){return zm.Name}});Object.defineProperty(At,"CodeGen",{enumerable:!0,get:function(){return zm.CodeGen}});var lMe=pT();Object.defineProperty(At,"ValidationError",{enumerable:!0,get:function(){return lMe.default}});var dMe=Cw();Object.defineProperty(At,"MissingRefError",{enumerable:!0,get:function(){return dMe.default}})});var pue=R(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.formatNames=Ys.fastFormats=Ys.fullFormats=void 0;function Xs(t,e){return{validate:t,compare:e}}Ys.fullFormats={date:Xs(cue,Y2),time:Xs(G2(!0),Q2),"date-time":Xs(iue(!0),lue),"iso-time":Xs(G2(),uue),"iso-date-time":Xs(iue(),due),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:yMe,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:EMe,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:vMe,int32:{type:"number",validate:_Me},int64:{type:"number",validate:SMe},float:{type:"number",validate:aue},double:{type:"number",validate:aue},password:!0,binary:!0};Ys.fastFormats={...Ys.fullFormats,date:Xs(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Y2),time:Xs(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Q2),"date-time":Xs(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,lue),"iso-time":Xs(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,uue),"iso-date-time":Xs(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,due),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Ys.formatNames=Object.keys(Ys.fullFormats);function pMe(t){return t%4===0&&(t%100!==0||t%400===0)}var fMe=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,mMe=[0,31,28,31,30,31,30,31,31,30,31,30,31];function cue(t){let e=fMe.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&pMe(r)?29:mMe[o])}function Y2(t,e){if(t&&e)return t>e?1:t<e?-1:0}var J2=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function G2(t){return function(r){let o=J2.exec(r);if(!o)return!1;let n=+o[1],i=+o[2],s=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||t&&!a)return!1;if(n<=23&&i<=59&&s<60)return!0;let d=i-l*c,f=n-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&s<61}}function Q2(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function uue(t,e){if(!(t&&e))return;let r=J2.exec(t),o=J2.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t<e?-1:0}var X2=/t|\s/i;function iue(t){let e=G2(t);return function(o){let n=o.split(X2);return n.length===2&&cue(n[0])&&e(n[1])}}function lue(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function due(t,e){if(!(t&&e))return;let[r,o]=t.split(X2),[n,i]=e.split(X2),s=Y2(r,n);if(s!==void 0)return s||Q2(o,i)}var hMe=/\/|:/,gMe=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function yMe(t){return hMe.test(t)&&gMe.test(t)}var sue=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function vMe(t){return sue.lastIndex=0,sue.test(t)}var wMe=-(2**31),bMe=2**31-1;function _Me(t){return Number.isInteger(t)&&t<=bMe&&t>=wMe}function SMe(t){return Number.isInteger(t)}function aue(){return!0}var xMe=/[^\\]\\Z/;function EMe(t){if(xMe.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var fue=R(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});jm.formatLimitDefinition=void 0;var kMe=W2(),Ki=ke(),ku=Ki.operators,DT={formatMaximum:{okStr:"<=",ok:ku.LTE,fail:ku.GT},formatMinimum:{okStr:">=",ok:ku.GTE,fail:ku.LT},formatExclusiveMaximum:{okStr:"<",ok:ku.LT,fail:ku.GTE},formatExclusiveMinimum:{okStr:">",ok:ku.GT,fail:ku.LTE}},IMe={message:({keyword:t,schemaCode:e})=>(0,Ki.str)`should be ${DT[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ki._)`{comparison: ${DT[t].okStr}, limit: ${e}}`};jm.formatLimitDefinition={keyword:Object.keys(DT),type:"string",schemaType:"string",$data:!0,error:IMe,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:i}=t,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new kMe.KeywordCxt(i,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),p=e.const("fmt",(0,Ki._)`${f}[${c.schemaCode}]`);t.fail$data((0,Ki.or)((0,Ki._)`typeof ${p} != "object"`,(0,Ki._)`${p} instanceof RegExp`,(0,Ki._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${n}": format "${f}" does not define "compare" function`);let m=e.scopeValue("formats",{key:f,ref:p,code:s.code.formats?(0,Ki._)`${s.code.formats}${(0,Ki.getProperty)(f)}`:void 0});t.fail$data(d(m))}function d(f){return(0,Ki._)`${f}.compare(${r}, ${o}) ${DT[n].fail} 0`}},dependencies:["format"]};var $Me=t=>(t.addKeyword(jm.formatLimitDefinition),t);jm.default=$Me});var yue=R((Zw,gue)=>{"use strict";Object.defineProperty(Zw,"__esModule",{value:!0});var Mm=pue(),AMe=fue(),eF=ke(),mue=new eF.Name("fullFormats"),TMe=new eF.Name("fastFormats"),tF=(t,e={keywords:!0})=>{if(Array.isArray(e))return hue(t,e,Mm.fullFormats,mue),t;let[r,o]=e.mode==="fast"?[Mm.fastFormats,TMe]:[Mm.fullFormats,mue],n=e.formats||Mm.formatNames;return hue(t,n,r,o),e.keywords&&(0,AMe.default)(t),t};tF.get=(t,e="full")=>{let o=(e==="fast"?Mm.fastFormats:Mm.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function hue(t,e,r,o){var n,i;(n=(i=t.opts.code).formats)!==null&&n!==void 0||(i.formats=(0,eF._)`require("ajv-formats/dist/formats").${o}`);for(let s of e)t.addFormat(s,r[s])}gue.exports=Zw=tF;Object.defineProperty(Zw,"__esModule",{value:!0});Zw.default=tF});import{parseArgs as uUe}from"node:util";import{spawn as cle}from"node:child_process";import{hostname as fF}from"node:os";import{open as lUe,readFile as KT,rename as dUe,rm as ule}from"node:fs/promises";import{dirname as pUe,join as fUe,resolve as eb}from"node:path";import{randomUUID as lle}from"node:crypto";import{Readable as dle}from"node:stream";import{pipeline as ple}from"node:stream/promises";import{setTimeout as mF}from"node:timers/promises";var h={};yt(h,{$brand:()=>sP,$input:()=>TR,$output:()=>AR,INVALID:()=>un,NEVER:()=>iP,TimePrecision:()=>jR,ZodAny:()=>JC,ZodArray:()=>QC,ZodBase64:()=>rx,ZodBase64URL:()=>nx,ZodBigInt:()=>Xd,ZodBigIntFormat:()=>sx,ZodBoolean:()=>Gd,ZodCIDRv4:()=>ex,ZodCIDRv6:()=>tx,ZodCUID:()=>ZS,ZodCUID2:()=>WS,ZodCatch:()=>vO,ZodCodec:()=>Qh,ZodCompileAsyncError:()=>Yo,ZodCompileUnsupportedError:()=>Re,ZodCreditCard:()=>BC,ZodCustom:()=>eg,ZodCustomStringFormat:()=>Vu,ZodDate:()=>Wh,ZodDefault:()=>pO,ZodDiscriminatedUnion:()=>tO,ZodE164:()=>ox,ZodEmail:()=>HS,ZodEmoji:()=>KS,ZodEnum:()=>Zd,ZodError:()=>bme,ZodExactOptional:()=>ux,ZodFile:()=>cO,ZodFirstPartyTypeKind:()=>CO,ZodFunction:()=>AO,ZodGUID:()=>BS,ZodIBAN:()=>KC,ZodIPv4:()=>YS,ZodIPv6:()=>QS,ZodISODate:()=>Xa,ZodISODateTime:()=>Ga,ZodISODuration:()=>Qa,ZodISOTime:()=>Ya,ZodInstanceOf:()=>RO,ZodIntersection:()=>rO,ZodIssueCode:()=>xme,ZodJWT:()=>ix,ZodKSUID:()=>XS,ZodLazy:()=>kO,ZodLiteral:()=>aO,ZodMAC:()=>HC,ZodMap:()=>iO,ZodNaN:()=>bO,ZodNanoID:()=>qS,ZodNever:()=>XC,ZodNonOptional:()=>lx,ZodNull:()=>WC,ZodNullable:()=>dO,ZodNumber:()=>Jd,ZodNumberFormat:()=>Hu,ZodObject:()=>Jh,ZodOptional:()=>Bu,ZodPipe:()=>Yh,ZodPrefault:()=>mO,ZodPreprocess:()=>_O,ZodPromise:()=>$O,ZodReadonly:()=>SO,ZodRealError:()=>An,ZodRecord:()=>qd,ZodSet:()=>sO,ZodString:()=>Wd,ZodStringFormat:()=>it,ZodSuccess:()=>yO,ZodSymbol:()=>qC,ZodTemplateLiteral:()=>EO,ZodTransform:()=>uO,ZodTuple:()=>nO,ZodType:()=>ge,ZodULID:()=>JS,ZodURL:()=>qh,ZodUUID:()=>Xi,ZodUndefined:()=>ZC,ZodUnion:()=>Gh,ZodUnknown:()=>GC,ZodVoid:()=>YC,ZodXID:()=>GS,ZodXor:()=>eO,_ZodString:()=>VS,_default:()=>fO,_function:()=>iB,any:()=>LH,array:()=>Ae,base64:()=>bH,base64url:()=>_H,bigint:()=>DH,boolean:()=>Vt,catch:()=>wO,check:()=>sB,cidrv4:()=>vH,cidrv6:()=>wH,clone:()=>qe,codec:()=>tB,coerce:()=>NO,compile:()=>OR,config:()=>zt,core:()=>ei,creditCard:()=>xH,cuid:()=>lH,cuid2:()=>dH,currencyCode:()=>TH,custom:()=>dx,date:()=>VH,decode:()=>zC,decodeAsync:()=>MC,deepPartial:()=>vB,describe:()=>aB,discriminatedUnion:()=>Xh,e164:()=>SH,email:()=>eH,emoji:()=>cH,encode:()=>DC,encodeAsync:()=>jC,endsWith:()=>Dd,enum:()=>_r,exactOptional:()=>lO,file:()=>XH,flattenError:()=>Ym,float32:()=>RH,float64:()=>CH,formatError:()=>Qm,fromJSONSchema:()=>gB,function:()=>iB,getDiscriminatedOption:()=>ER,getErrorMap:()=>kme,globalRegistry:()=>wr,gt:()=>Ji,gte:()=>Kn,guid:()=>tH,hash:()=>PH,hex:()=>AH,hostname:()=>$H,httpUrl:()=>aH,iban:()=>EH,includes:()=>Od,input:()=>bB,instanceof:()=>uB,int:()=>LS,int32:()=>OH,int64:()=>zH,intersection:()=>Yd,invertCodec:()=>rB,ipv4:()=>hH,ipv6:()=>yH,iso:()=>Ku,json:()=>dB,jwt:()=>kH,keyof:()=>HH,ksuid:()=>mH,lazy:()=>IO,length:()=>Uu,literal:()=>G,locales:()=>$d,looseObject:()=>br,looseRecord:()=>ZH,lowercase:()=>Rd,lt:()=>Wi,lte:()=>Bn,mac:()=>gH,map:()=>WH,maxLength:()=>Mu,maxSize:()=>Ka,memoizer:()=>gh,meta:()=>cB,mime:()=>jd,minLength:()=>ra,minSize:()=>Gi,multipleOf:()=>Ba,nan:()=>eB,nanoid:()=>uH,nativeEnum:()=>GH,negative:()=>xS,never:()=>ax,nonnegative:()=>kS,nonoptional:()=>gO,nonpositive:()=>ES,normalize:()=>Md,null:()=>Zh,nullable:()=>Kh,nullish:()=>YH,number:()=>Ze,object:()=>H,optional:()=>ot,output:()=>_B,overwrite:()=>Qo,parse:()=>RC,parseAsync:()=>CC,partialRecord:()=>qH,pipe:()=>FS,positive:()=>SS,prefault:()=>hO,preprocess:()=>tg,prettifyError:()=>dP,promise:()=>oB,properties:()=>zd,property:()=>IS,readonly:()=>xO,record:()=>st,refine:()=>TO,regex:()=>Pd,regexes:()=>Hn,registry:()=>J_,safeDecode:()=>LC,safeDecodeAsync:()=>VC,safeEncode:()=>UC,safeEncodeAsync:()=>FC,safeParse:()=>OC,safeParseAsync:()=>NC,set:()=>JH,setErrorMap:()=>Eme,size:()=>ju,slugify:()=>Vd,startsWith:()=>Nd,strictObject:()=>BH,string:()=>I,stringFormat:()=>IH,stringbool:()=>lB,success:()=>QH,superRefine:()=>PO,symbol:()=>MH,templateLiteral:()=>nB,toJSONSchema:()=>Lu,toLowerCase:()=>Ld,toUpperCase:()=>Fd,toZod:()=>Hm,transform:()=>cx,treeifyError:()=>lP,trim:()=>Ud,tuple:()=>oO,uint32:()=>NH,uint64:()=>jH,ulid:()=>pH,undefined:()=>UH,union:()=>tt,unknown:()=>ut,uppercase:()=>Cd,url:()=>sH,util:()=>A,uuid:()=>rH,uuidv4:()=>nH,uuidv6:()=>oH,uuidv7:()=>iH,validate:()=>yd,validateAsync:()=>vd,void:()=>FH,withParser:()=>G_,xid:()=>fH,xor:()=>KH});var ei={};yt(ei,{$ZodAny:()=>u_,$ZodArray:()=>m_,$ZodAsyncError:()=>In,$ZodBase64:()=>Zb,$ZodBase64URL:()=>Jb,$ZodBigInt:()=>lh,$ZodBigIntFormat:()=>i_,$ZodBoolean:()=>_d,$ZodCIDRv4:()=>Hb,$ZodCIDRv6:()=>Kb,$ZodCUID:()=>Db,$ZodCUID2:()=>zb,$ZodCatch:()=>C_,$ZodCheck:()=>nt,$ZodCheckBigIntFormat:()=>XP,$ZodCheckEndsWith:()=>uR,$ZodCheckGreaterThan:()=>bb,$ZodCheckIncludes:()=>aR,$ZodCheckLengthEquals:()=>nR,$ZodCheckLessThan:()=>wb,$ZodCheckLowerCase:()=>iR,$ZodCheckMaxLength:()=>tR,$ZodCheckMaxSize:()=>YP,$ZodCheckMimeType:()=>pR,$ZodCheckMinLength:()=>rR,$ZodCheckMinSize:()=>QP,$ZodCheckMultipleOf:()=>JP,$ZodCheckNumberFormat:()=>GP,$ZodCheckOverwrite:()=>fR,$ZodCheckProperties:()=>dR,$ZodCheckProperty:()=>lR,$ZodCheckRegex:()=>oR,$ZodCheckSizeEquals:()=>eR,$ZodCheckStartsWith:()=>cR,$ZodCheckStringFormat:()=>wd,$ZodCheckUpperCase:()=>sR,$ZodCodec:()=>xd,$ZodCreditCard:()=>Yb,$ZodCustom:()=>M_,$ZodCustomStringFormat:()=>n_,$ZodCyclicError:()=>V_,$ZodDate:()=>f_,$ZodDefault:()=>A_,$ZodDiscriminatedUnion:()=>y_,$ZodE164:()=>Gb,$ZodEmail:()=>Ab,$ZodEmoji:()=>Ob,$ZodEncodeError:()=>Fa,$ZodEnum:()=>S_,$ZodError:()=>uP,$ZodExactOptional:()=>I_,$ZodFile:()=>E_,$ZodFunction:()=>z_,$ZodGUID:()=>Ib,$ZodIBAN:()=>e_,$ZodIPv4:()=>Lb,$ZodIPv6:()=>Fb,$ZodISODate:()=>wR,$ZodISODateTime:()=>vR,$ZodISODuration:()=>_R,$ZodISOTime:()=>bR,$ZodIntersection:()=>v_,$ZodJWT:()=>r_,$ZodKSUID:()=>Ub,$ZodLazy:()=>Ed,$ZodLiteral:()=>x_,$ZodMAC:()=>Vb,$ZodMap:()=>b_,$ZodNaN:()=>O_,$ZodNanoID:()=>Nb,$ZodNever:()=>d_,$ZodNonOptional:()=>P_,$ZodNull:()=>c_,$ZodNullable:()=>$_,$ZodNumber:()=>uh,$ZodNumberFormat:()=>o_,$ZodObject:()=>h_,$ZodObjectJIT:()=>xR,$ZodOptional:()=>ph,$ZodPipe:()=>fh,$ZodPrefault:()=>T_,$ZodPreprocess:()=>kR,$ZodPromise:()=>j_,$ZodReadonly:()=>N_,$ZodRealError:()=>$n,$ZodRecord:()=>w_,$ZodRegistry:()=>W_,$ZodSet:()=>__,$ZodString:()=>Va,$ZodStringFormat:()=>Je,$ZodSuccess:()=>R_,$ZodSymbol:()=>s_,$ZodTemplateLiteral:()=>D_,$ZodTransform:()=>k_,$ZodTuple:()=>dh,$ZodType:()=>ae,$ZodULID:()=>jb,$ZodURL:()=>Cb,$ZodUUID:()=>$b,$ZodUndefined:()=>a_,$ZodUnion:()=>Sd,$ZodUnknown:()=>l_,$ZodVoid:()=>p_,$ZodXID:()=>Mb,$ZodXor:()=>g_,$brand:()=>sP,$constructor:()=>S,$input:()=>TR,$output:()=>AR,Doc:()=>Ou,INVALID:()=>un,JSONSchema:()=>XV,JSONSchemaGenerator:()=>jS,NEVER:()=>iP,TimePrecision:()=>jR,URL_BAD_FORMAT:()=>gR,URL_UNPARSEABLE:()=>oh,ZodCompileAsyncError:()=>Yo,ZodCompileUnsupportedError:()=>Re,_any:()=>gS,_array:()=>VR,_base64:()=>Dh,_base64url:()=>zh,_bigint:()=>lS,_boolean:()=>uS,_catch:()=>cme,_check:()=>DV,_cidrv4:()=>Oh,_cidrv6:()=>Nh,_coercedBigint:()=>LR,_coercedBoolean:()=>UR,_coercedDate:()=>FR,_coercedNumber:()=>MR,_coercedString:()=>zR,_creditCard:()=>tS,_cuid:()=>Ih,_cuid2:()=>$h,_custom:()=>AS,_date:()=>bS,_decode:()=>cb,_decodeAsync:()=>lb,_default:()=>ime,_discriminatedUnion:()=>Zfe,_e164:()=>jh,_email:()=>vh,_emoji:()=>Eh,_encode:()=>ab,_encodeAsync:()=>ub,_endsWith:()=>Dd,_enum:()=>Qfe,_file:()=>$S,_float32:()=>iS,_float64:()=>sS,_gt:()=>Ji,_gte:()=>Kn,_guid:()=>wh,_iban:()=>rS,_includes:()=>Od,_int:()=>oS,_int32:()=>aS,_int64:()=>dS,_intersection:()=>Wfe,_ipv4:()=>Rh,_ipv6:()=>Ch,_isoDate:()=>Lh,_isoDateTime:()=>Uh,_isoDuration:()=>Vh,_isoTime:()=>Fh,_jwt:()=>Mh,_ksuid:()=>Ph,_lazy:()=>pme,_length:()=>Uu,_literal:()=>tme,_lowercase:()=>Rd,_lt:()=>Wi,_lte:()=>Bn,_mac:()=>eS,_map:()=>Xfe,_max:()=>Bn,_maxLength:()=>Mu,_maxSize:()=>Ka,_mime:()=>jd,_min:()=>Kn,_minLength:()=>ra,_minSize:()=>Gi,_multipleOf:()=>Ba,_nan:()=>_S,_nanoid:()=>kh,_nativeEnum:()=>eme,_negative:()=>xS,_never:()=>vS,_nonnegative:()=>kS,_nonoptional:()=>sme,_nonpositive:()=>ES,_normalize:()=>Md,_null:()=>hS,_nullable:()=>ome,_number:()=>nS,_optional:()=>nme,_overwrite:()=>Qo,_parse:()=>dd,_parseAsync:()=>pd,_pipe:()=>ume,_positive:()=>SS,_promise:()=>fme,_properties:()=>zd,_property:()=>IS,_readonly:()=>lme,_record:()=>Gfe,_refine:()=>TS,_regex:()=>Pd,_safeDecode:()=>pb,_safeDecodeAsync:()=>mb,_safeEncode:()=>db,_safeEncodeAsync:()=>fb,_safeParse:()=>fd,_safeParseAsync:()=>hd,_set:()=>Yfe,_size:()=>ju,_slugify:()=>Vd,_startsWith:()=>Nd,_string:()=>Q_,_stringFormat:()=>qa,_stringbool:()=>OS,_success:()=>ame,_superRefine:()=>PS,_symbol:()=>fS,_templateLiteral:()=>dme,_toLowerCase:()=>Ld,_toUpperCase:()=>Fd,_transform:()=>rme,_trim:()=>Ud,_tuple:()=>Jfe,_uint32:()=>cS,_uint64:()=>pS,_ulid:()=>Ah,_undefined:()=>mS,_union:()=>Kfe,_unknown:()=>yS,_uppercase:()=>Cd,_url:()=>Td,_uuid:()=>bh,_uuidv4:()=>_h,_uuidv6:()=>Sh,_uuidv7:()=>xh,_void:()=>wS,_xid:()=>Th,_xor:()=>qfe,base64Charset:()=>qb,base64urlCharset:()=>ch,canParseURL:()=>yR,clone:()=>qe,compile:()=>OR,compileFn:()=>X_,config:()=>zt,createStandardJSONSchemaMethod:()=>Hd,createToJSONSchemaMethod:()=>BR,decode:()=>zF,decodeAsync:()=>MF,describe:()=>RS,encode:()=>DF,encodeAsync:()=>jF,extractDefs:()=>Wa,finalize:()=>Ja,flattenError:()=>Ym,formatError:()=>Qm,getDiscriminatedOption:()=>ER,globalConfig:()=>cr,globalRegistry:()=>wr,handleUnrepresentable:()=>Xt,initializeContext:()=>Za,isBackEdge:()=>B_,isRecursiveSchema:()=>H_,isValidBase64:()=>ah,isValidBase64URL:()=>Wb,isValidCIDRv6:()=>Bb,isValidCreditCard:()=>Xb,isValidIBAN:()=>Qb,isValidIPv6:()=>sh,isValidJWT:()=>t_,locales:()=>$d,memoizer:()=>gh,mergeValues:()=>bd,meta:()=>CS,parse:()=>Pu,parseAsync:()=>Ru,parseURLObject:()=>c6,prettifyError:()=>dP,process:()=>et,processSchema:()=>et,regexes:()=>Hn,registry:()=>J_,safeDecode:()=>LF,safeDecodeAsync:()=>VF,safeEncode:()=>UF,safeEncodeAsync:()=>FF,safeParse:()=>md,safeParseAsync:()=>gd,standardProps:()=>kb,stripTabAndNewline:()=>ih,toDotPath:()=>OF,toJSONSchema:()=>Lu,toZod:()=>Hm,treeifyError:()=>lP,urlHostnameOk:()=>Pb,urlProtocolOk:()=>Rb,util:()=>A,validate:()=>yd,validateAsync:()=>vd,validateURL:()=>Tb,version:()=>mR,withParser:()=>G_});var A={};yt(A,{BIGINT_FORMAT_RANGES:()=>Zm,CONSTANT_CATCH:()=>ib,Class:()=>WT,NUMBER_FORMAT_RANGES:()=>qm,aborted:()=>cn,allowsEval:()=>XT,assert:()=>Ele,assertEqual:()=>ble,assertIs:()=>Sle,assertNever:()=>xle,assertNotEqual:()=>_le,assignProp:()=>vr,attachSchema:()=>Wm,base64ToUint8Array:()=>$F,base64urlToUint8Array:()=>zle,cached:()=>sd,captureStackTrace:()=>nb,cleanEnum:()=>Dle,cleanRegex:()=>ea,clone:()=>qe,cloneDef:()=>$le,codePointLength:()=>Tu,constantCatch:()=>nP,createTransparentProxy:()=>Ole,defineLazy:()=>JT,defineLazyInternal:()=>be,derived:()=>Lle,esc:()=>an,escapeRegex:()=>ho,explicitlyAborted:()=>eP,extend:()=>_F,finalizeIssue:()=>kn,floatSafeRemainder:()=>Bm,getElementAtPath:()=>Ale,getEnumValues:()=>od,getLengthableOrigin:()=>Gm,getParsedType:()=>Cle,getSizableOrigin:()=>Jm,hexToUint8Array:()=>Mle,hide:()=>Xm,installLazyProp:()=>rP,isObject:()=>Au,isPlainObject:()=>mo,issue:()=>ld,joinValues:()=>x,jsonStringifyReplacer:()=>id,members:()=>tP,merge:()=>EF,mergeDefs:()=>fo,normalizeParams:()=>N,nullish:()=>rb,numKeys:()=>Rle,objectClone:()=>kle,omit:()=>bF,optionalKeys:()=>QT,own:()=>Zi,parsedType:()=>P,partial:()=>kF,pick:()=>wF,prefixIssues:()=>En,primitiveTypes:()=>YT,promiseAllObject:()=>Tle,propertyKeyTypes:()=>Km,randomString:()=>Ple,rawShape:()=>ad,required:()=>IF,safeExtend:()=>xF,shallowClone:()=>cd,sizeCaps:()=>ud,slugify:()=>GT,stringifyPrimitive:()=>T,toZod:()=>Hm,uint8ArrayToBase64:()=>AF,uint8ArrayToBase64url:()=>jle,uint8ArrayToHex:()=>Ule,unwrapMessage:()=>nd});function ble(t){return t}function _le(t){return t}function Hm(){return t=>t}function Sle(t){}function xle(t){throw new Error("Unexpected value in exhaustive check")}function Ele(t){}function od(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,n])=>e.indexOf(+o)===-1).map(([o,n])=>n)}function x(t,e="|"){return t.map(r=>T(r)).join(e)}function id(t,e){return typeof e=="bigint"?e.toString():e}var ZT=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function sd(t){return new ZT(t)}function rb(t){return t==null}function ea(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Bm(t,e){let r=t/e,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var gF=Symbol("evaluating");function JT(t,e,r){let o;Object.defineProperty(t,e,{get(){if(o!==gF)return o===void 0&&(o=gF,o=r()),o},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function kle(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function vr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ad(t){let e=Object.getOwnPropertyDescriptor(t,"shape");return e?.get?e.get.raw:e?.value}function Qs(t){return ad(t._zod.def)??t._zod.def.shape}function yF(t,e,r){Object.defineProperty(t,e,{get(){let o=r();return vr(this,e,o),o},enumerable:!0,configurable:!0})}function vF(t,e,r){e in t?vr(t,e,r):t[e]=r}function $u(t,e,r,o){let n=Qs(e);for(let i of r){let s=Object.getOwnPropertyDescriptor(n,i);s.enumerable&&(s.get?yF(t,i,()=>{let a=e._zod.def.shape[i];return o?o(a,i):a}):vF(t,i,o?o(s.value,i):s.value))}}function Ile(t,e){for(let r of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,r);o.enumerable&&(o.get?yF(t,r,()=>e[r]):vF(t,r,o.value))}}function fo(...t){let e={};for(let r of t){let o=Object.getOwnPropertyDescriptors(r);Object.assign(e,o)}return Object.defineProperties({},e)}function $le(t){return fo(t._zod.def)}function Ale(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function Tle(t){let e=Object.keys(t),r=e.map(o=>t[o]);return Promise.all(r).then(o=>{let n={};for(let i=0;i<e.length;i++)n[e[i]]=o[i];return n})}function Ple(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<t;o++)r+=e[Math.floor(Math.random()*e.length)];return r}function an(t){return JSON.stringify(t)}function GT(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var nb="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Au(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var XT=sd(()=>{if(cr.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function mo(t){if(Au(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Au(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function cd(t){return mo(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function Rle(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var Cle=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Km=new Set(["string","number","symbol"]),YT=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ho(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qe(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function N(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Ole(t){let e;return new Proxy({},{get(r,o,n){return e??(e=t()),Reflect.get(e,o,n)},set(r,o,n,i){return e??(e=t()),Reflect.set(e,o,n,i)},has(r,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(r,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(r,o,n){return e??(e=t()),Reflect.defineProperty(e,o,n)}})}function T(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function QT(t){return Object.keys(t).filter(e=>t[e]._zod.optin!==void 0&&t[e]._zod.optout==="optional")}var qm={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Zm={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function wF(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return $u(i,t,ob(t,e)),qe(t,fo(r,{shape:i,checks:[]}))}function ob(t,e){let r=Qs(t),o=[];for(let n of Reflect.ownKeys(e)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw new Error(`Unrecognized key: "${String(n)}"`);e[n]&&o.push(n)}return o}function bF(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ob(t,e)),s={};return $u(s,t,Reflect.ownKeys(Qs(t)).filter(a=>!i.has(a))),qe(t,fo(r,{shape:s,checks:[]}))}function _F(t,e){if(!mo(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let n=Qs(t);for(let i of Reflect.ownKeys(e))if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return qe(t,fo(t._zod.def,{shape:SF(t,e)}))}function SF(t,e){let r={};return $u(r,t,Reflect.ownKeys(Qs(t))),Ile(r,e),r}function xF(t,e){if(!mo(e))throw new Error("Invalid input to safeExtend: expected a plain object");return qe(t,fo(t._zod.def,{shape:SF(t,e)}))}function EF(t,e){if(!e?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};$u(r,t,Reflect.ownKeys(Qs(t))),$u(r,e,Reflect.ownKeys(Qs(e)));let o=fo(t._zod.def,{shape:r,get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return qe(t,o)}function kF(t,e,r,o="partial"){let i=e._zod.def.checks;if(i&&i.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let a=r?new Set(ob(e,r)):void 0,c={};return $u(c,e,Reflect.ownKeys(Qs(e)),t&&((u,l)=>a&&!a.has(l)?u:new t({type:"optional",innerType:u}))),qe(e,fo(e._zod.def,{shape:c,checks:[]}))}function IF(t,e,r){let o=r?new Set(ob(e,r)):void 0,n={};return $u(n,e,Reflect.ownKeys(Qs(e)),(i,s)=>o&&!o.has(s)?i:new t({type:"nonoptional",innerType:i})),qe(e,fo(e._zod.def,{shape:n}))}function cn(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function eP(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function En(t,e){return e.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function nd(t){return typeof t=="string"?t:t?.message}function ud(t){let e=[];for(let r of t??[]){let o=r._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let n=o.maximum??o.length??o.size;n>=0&&e.push([n,r])}return e}function Wm(t,e,r){var o;for(let n=e;n<t.length;n++)(o=t[n]).schema??(o.schema=r)}function kn(t,e,r){var o;let n=t.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(o=t).schema??(o.schema=t.inst):t.schema=t.inst);let i=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,s=t.message?t.message:nd(t.inst?._zod.def?.error?.(t))??nd(i?.(t))??nd(e?.error?.(t))??nd(r.customError?.(t))??nd(r.localeError?.(t))??"Invalid input",a={};for(let c of Object.keys(t))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=t[c]);return a.path??(a.path=[]),a.message=s,e?.reportInput&&(a.input=t.input),a}function Jm(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}var Nle=/[\uD800-\uDBFF]/;function Tu(t){let e=t.length;if(!Nle.test(t))return e;let r=e;for(let o=0;o<e-1;o++)(t.charCodeAt(o)&64512)===55296&&(t.charCodeAt(o+1)&64512)===56320&&(r--,o++);return r}function Gm(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function P(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function ld(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function Dle(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function $F(t){let e=atob(t),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);return r}function AF(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function zle(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return $F(e+r)}function jle(t){return AF(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Mle(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)r[o/2]=Number.parseInt(e.slice(o,o+2),16);return r}function Ule(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var WT=class{constructor(...e){}};function tP(t,e){for(let r in e){let o=Object.getOwnPropertyDescriptor(e,r);o.get?Object.defineProperty(t,r,{...o,enumerable:!1}):Fle(t,r,o.value)}}function Zi(t,e,r,o=!0){return Object.defineProperty(t,e,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function Xm(t,e,r){return Zi(t,e,r,!1)}function Lle(t,e){for(let r in t){let o=t[r];Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){return Zi(this,r,o(this))},set(n){Zi(this,r,n)}})}return e}function Fle(t,e,r){Object.defineProperty(t,e,{configurable:!0,get(){return this==null?r:Zi(this,e,r.bind(this))},set(o){Zi(this,e,o)}})}function Vle(t,e){let r=Object.getPrototypeOf(t);return e in r?void 0:r}var qT,La=!1,Hle={configurable:!0,get(){La=!0}};function be(t,e,r){let o=Object.getPrototypeOf(t._zod);if(e in o&&qT!==t._zod){qT=void 0;return}qT=t._zod,Object.defineProperty(o,e,{configurable:!0,get(){Object.defineProperty(this,e,Hle);let n=La;La=!1;try{let i=r(this);return La?delete this[e]:Object.defineProperty(this,e,{configurable:!0,writable:!0,value:i}),La=La||n,i}catch(i){throw delete this[e],La=La||n,i}},set(n){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:n})}})}function rP(t,e,r,o){let n=Vle(t,e);n&&Object.defineProperty(n,e,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,e,i),i.value=r(this),Object.defineProperty(this,e,i),i.value},set(i){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:o,value:i})}})}var ib="~constantCatch";function nP(t){let e=()=>t;return e[ib]=!0,e}var TF,iP=Object.freeze({status:"aborted"}),oP={value:void 0,enumerable:!1},PF="captureStackTrace"in Error?Error:null;function Ble(t){let e=PF;if(e){let r=e.stackTraceLimit;if(typeof r=="number"){try{e.stackTraceLimit=0}catch{return PF=null,new t}try{return new t}finally{e.stackTraceLimit=r}}}return new t}function S(t,e,r,o){let n={};function i(f){this.def=f,this.constr=d,this.traits=new Set}i.prototype=n;let s=r,a=s&&new WeakSet;function c(f,p){if(f._zod){if(f._zod.traits.has(t))return}else{oP.value=new i(p);try{Object.defineProperty(f,"_zod",oP)}finally{oP.value=void 0}}if(f._zod.traits.add(t),e(f,p),a){let g=Object.getPrototypeOf(f),y=f._zod.constr.prototype,w=g;for(;w&&w!==y;)w=Object.getPrototypeOf(w);let b=w??g;a.has(b)||(a.add(b),tP(b,s))}let m=d.prototype;for(let g in m)Object.prototype.hasOwnProperty.call(m,g)&&(g in f||(f[g]=m[g].bind(f)))}let u=o?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:t});function d(f){let p=o?.Parent?Ble(l):this;c(p,f);let m=p._zod.deferred;if(m){for(let y of m)y();p._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;return g&&g(p),p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>o?.Parent&&f instanceof o.Parent?!0:f?._zod?.traits?.has(t)}),Object.defineProperty(d,"name",{value:t}),d}var sP=Symbol("zod_brand"),In=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Fa=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(TF=globalThis).__zod_globalConfig??(TF.__zod_globalConfig={});var cr=globalThis.__zod_globalConfig;function zt(t){return t&&Object.assign(cr,t),cr}function Kle(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,id,2)),t.message}function qle(t){this._zod.message=t}var Zle={get:Kle,set:qle,enumerable:!0,configurable:!0},cP={value:void 0,enumerable:!1},RF=new WeakSet([Object.prototype,Error.prototype]),CF=(t,e)=>{t.name="$ZodError",cP.value=e,Object.defineProperty(t,"issues",cP),cP.value=void 0,Object.defineProperty(t,"message",Zle);let r=Object.getPrototypeOf(t);RF.has(r)||(RF.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},uP=S("$ZodError",CF),$n=S("$ZodError",CF,void 0,{Parent:Error});function Wle(t,e,r){return Object.prototype.hasOwnProperty.call(t,e)||(e==="__proto__"?Object.defineProperty(t,e,{value:r(),writable:!0,enumerable:!0,configurable:!0}):t[e]=r()),t[e]}function Ym(t,e=r=>r.message){let r={},o=[];for(let n of t.issues)n.path.length>0?Wle(r,n.path[0],()=>[]).push(e(n)):o.push(e(n));return{formErrors:o,fieldErrors:r}}function Qm(t,e=r=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(e(s));else{let c=r,u=0;for(;u<a.length;){let l=a[u],d=u===a.length-1;if(l==="_errors"){d&&c._errors.push(e(s)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=c[l];d&&f._errors.push(e(s)),c=f,u++}}}};return o(t),r}function lP(t,e=r=>r.message){let r={errors:[]},o=(n,i=[])=>{var s;for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>o({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...i,...a.path]);else{let c=[...i,...a.path];if(c.length===0){r.errors.push(e(a));continue}let u=r,l=0;for(;l<c.length;){let d=c[l],f=l===c.length-1;typeof d=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,d)||Object.defineProperty(u.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[d]):(u.items??(u.items=[]),(s=u.items)[d]??(s[d]={errors:[]}),u=u.items[d]),f&&u.errors.push(e(a)),l++}}};return o(t),r}function OF(t){let e=[],r=t.map(o=>typeof o=="object"?o.key:o);for(let o of r)typeof o=="number"?e.push(`[${o}]`):typeof o=="symbol"?e.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?e.push(`[${JSON.stringify(o)}]`):(e.length&&e.push("."),e.push(o));return e.join("")}function dP(t){let e=[],r=[...t.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)e.push(`\u2716 ${o.message}`),o.path?.length&&e.push(` \u2192 at ${OF(o.path)}`);return e.join(`
68
68
  `)}function sb(t,e){return{callee:e?.callee??t,Err:e?.Err}}var dd=t=>{let e=(r,o,n,i)=>{let s=n?{...n,async:!1}:{async:!1},a=r._zod.run({value:o,issues:[]},s);if(a instanceof Promise)throw new In;if(a.issues.length){let c=new(i?.Err??t)(a.issues.map(u=>kn(u,s,zt())));throw nb(c,i?.callee??e),c}return a.value};return e},Pu=dd($n),pd=t=>{let e=async(r,o,n,i)=>{let s=n?{...n,async:!0}:{async:!0},a=r._zod.run({value:o,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??t)(a.issues.map(u=>kn(u,s,zt())));throw nb(c,i?.callee??e),c}return a.value};return e},Ru=pd($n),fd=t=>(e,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new In;return i.issues.length?NF(t,i.issues,n):{success:!0,data:i.value}},md=fd($n);function NF(t,e,r){let o;return{success:!1,get error(){return o||(o=new t(e.map(n=>kn(n,r,zt()))),e=void 0,r=void 0),o},set error(n){o=n,e=void 0,r=void 0}}}var hd=t=>async(e,r,o)=>{let n=o?{...o,async:!0}:{async:!0},i=e._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),i.issues.length?NF(t,i.issues,n):{success:!0,data:i.value}},gd=hd($n),Gle=Symbol.for("zod.compile.invalid"),Xle=Symbol.for("zod.compile.fallback"),yd=((t,e,r)=>{let o=t._zod.bag.validator;if(o!==void 0){if(o(e)!==Gle)return!0;if(o.definite===!0&&r===void 0)return!1}return Yle(t,e,r)});function Yle(t,e,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=t._zod.bag.fallbackRun,i;if(n?(o[Xle]=!0,i=n({value:e,issues:[]},o)):i=t._zod.run({value:e,issues:[]},o),i instanceof Promise)throw new In;return i.issues.length===0}var vd=async(t,e,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=t._zod.run({value:e,issues:[]},o);return n instanceof Promise&&(n=await n),n.issues.length===0},ab=t=>{let e=dd(t),r=(o,n,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return e(o,n,a,sb(r,s))};return r},DF=ab($n),cb=t=>{let e=dd(t),r=(o,n,i,s)=>e(o,n,i,sb(r,s));return r},zF=cb($n),ub=t=>{let e=pd(t),r=async(o,n,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await e(o,n,a,sb(r,s))};return r},jF=ub($n),lb=t=>{let e=pd(t),r=async(o,n,i,s)=>await e(o,n,i,sb(r,s));return r},MF=lb($n),db=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return fd(t)(e,r,n)},UF=db($n),pb=t=>(e,r,o)=>fd(t)(e,r,o),LF=pb($n),fb=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return hd(t)(e,r,n)},FF=fb($n),mb=t=>async(e,r,o)=>hd(t)(e,r,o),VF=mb($n);var Hn={};yt(Hn,{anyString:()=>MP,base64:()=>TP,base64url:()=>PP,bigint:()=>LP,boolean:()=>FP,browserEmail:()=>sde,cidrv4:()=>$P,cidrv6:()=>AP,creditCard:()=>hb,cuid:()=>fP,cuid2:()=>mP,currencyCode:()=>NP,date:()=>DP,datetime:()=>jP,domain:()=>CP,duration:()=>bP,e164:()=>OP,email:()=>SP,emoji:()=>xP,extendedDuration:()=>Qle,guid:()=>_P,hex:()=>qP,hostname:()=>RP,html5Email:()=>nde,httpProtocol:()=>eh,iban:()=>gb,idnEmail:()=>ide,integer:()=>th,ipv4:()=>EP,ipv6:()=>kP,ksuid:()=>yP,lowercase:()=>BP,mac:()=>IP,md5_base64:()=>lde,md5_base64url:()=>dde,md5_hex:()=>ude,nanoid:()=>vP,nanoidOfLength:()=>wP,null:()=>VP,number:()=>ta,rfc5322Email:()=>ode,sha1_base64:()=>fde,sha1_base64url:()=>mde,sha1_hex:()=>pde,sha256_base64:()=>gde,sha256_base64url:()=>yde,sha256_hex:()=>hde,sha384_base64:()=>wde,sha384_base64url:()=>bde,sha384_hex:()=>vde,sha512_base64:()=>Sde,sha512_base64url:()=>xde,sha512_hex:()=>_de,string:()=>UP,time:()=>zP,ulid:()=>hP,undefined:()=>HP,unicodeEmail:()=>HF,uppercase:()=>KP,uuid:()=>Cu,uuid4:()=>ede,uuid6:()=>tde,uuid7:()=>rde,xid:()=>gP});var fP=/^[cC][0-9a-z]{6,}$/,mP=/^[0-9a-z]+$/,hP=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,gP=/^[0-9a-vA-V]{20}$/,yP=/^[A-Za-z0-9]{27}$/,vP=/^[a-zA-Z0-9_-]{21}$/;function wP(t){return new RegExp(`^[a-zA-Z0-9_-]{${t}}$`)}var bP=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Qle=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,_P=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Cu=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ede=Cu(4),tde=Cu(6),rde=Cu(7),SP=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,nde=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ode=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,HF=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,ide=HF,sde=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ade="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function xP(){return new RegExp(ade,"u")}var EP=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,kP=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,IP=t=>{let e=ho(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},$P=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,AP=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,TP=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,PP=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,RP=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,CP=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,eh=/^https?$/,OP=/^\+[1-9]\d{6,14}$/,hb=/^\d(?:[ -]?\d){11,18}$/,NP=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,gb=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,BF="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function cde(t){return new RegExp(`^${t}$`)}var DP=cde(BF);function pP(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${e}:[0-5]\\d(?:\\.\\d+)?`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function zP(t){return new RegExp(`^${pP(t)}$`)}function jP(t){let e=["Z"];t.offset&&e.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${pP({precision:t.precision,seconds:!0})}(?:${e.join("|")})`,o=t.local?`${r}|${pP({precision:t.precision})}`:r;return new RegExp(`^${BF}T(?:${o})$`)}var MP=/^[\s\S]{0,}$/,UP=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},LP=/^-?\d+n?$/,th=/^-?\d+$/,ta=/^-?\d+(?:\.\d+)?$/,FP=/^(?:true|false)$/i,VP=/^null$/i;var HP=/^undefined$/i;var BP=/^[^A-Z]*$/,KP=/^[^a-z]*$/,qP=/^[0-9a-fA-F]*$/;function rh(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function nh(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var ude=/^[0-9a-fA-F]{32}$/,lde=rh(22,"=="),dde=nh(22),pde=/^[0-9a-fA-F]{40}$/,fde=rh(27,"="),mde=nh(27),hde=/^[0-9a-fA-F]{64}$/,gde=rh(43,"="),yde=nh(43),vde=/^[0-9a-fA-F]{96}$/,wde=rh(64,""),bde=nh(64),_de=/^[0-9a-fA-F]{128}$/,Sde=rh(86,"=="),xde=nh(86);var nt=S("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),ZP=t=>{let e=t.value;return!rb(e)&&e.size!==void 0},WP=t=>{let e=t.value;return!rb(e)&&e.length!==void 0},yb={number:"number",bigint:"bigint",object:"date"},wb=S("$ZodCheckLessThan",(t,e)=>{nt.init(t,e);let r=yb[typeof e.value];t._zod.check=o=>{(e.inclusive?o.value<=e.value:o.value<e.value)||o.issues.push({origin:yb[typeof o.value]??r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),bb=S("$ZodCheckGreaterThan",(t,e)=>{nt.init(t,e);let r=yb[typeof e.value];t._zod.check=o=>{(e.inclusive?o.value>=e.value:o.value>e.value)||o.issues.push({origin:yb[typeof o.value]??r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),JP=S("$ZodCheckMultipleOf",(t,e)=>{nt.init(t,e),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?e.value!==BigInt(0)&&r.value%e.value===BigInt(0):Bm(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),GP=S("$ZodCheckNumberFormat",(t,e)=>{nt.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),o=r?"int":"number",[n,i]=qm[e.format];t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:o,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:!0,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:!0,continue:!e.abort});return}}a<n&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),XP=S("$ZodCheckBigIntFormat",(t,e)=>{nt.init(t,e);let[r,o]=Zm[e.format];t._zod.check=n=>{let i=n.value;i<r&&n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),i>o&&n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!e.abort})}}),YP=S("$ZodCheckMaxSize",(t,e)=>{var r;nt.init(t,e),(r=t._zod.def).when??(r.when=ZP),t._zod.check=o=>{let n=o.value;n.size<=e.maximum||o.issues.push({origin:Jm(n),code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),QP=S("$ZodCheckMinSize",(t,e)=>{var r;nt.init(t,e),(r=t._zod.def).when??(r.when=ZP),t._zod.check=o=>{let n=o.value;n.size>=e.minimum||o.issues.push({origin:Jm(n),code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),eR=S("$ZodCheckSizeEquals",(t,e)=>{var r;nt.init(t,e),(r=t._zod.def).when??(r.when=ZP),t._zod.check=o=>{let n=o.value,i=n.size;if(i===e.size)return;let s=i>e.size;o.issues.push({origin:Jm(n),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),tR=S("$ZodCheckMaxLength",(t,e)=>{var r;nt.init(t,e),(r=t._zod.def).when??(r.when=WP),t._zod.check=o=>{let n=o.value,i=n.length;if((typeof n=="string"&&i>e.maximum?Tu(n):i)<=e.maximum)return;let a=Gm(n);o.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),rR=S("$ZodCheckMinLength",(t,e)=>{var r;nt.init(t,e),(r=t._zod.def).when??(r.when=WP),t._zod.check=o=>{let n=o.value,i=n.length;if((typeof n=="string"&&i>=e.minimum&&i<e.minimum*2?Tu(n):i)>=e.minimum)return;let a=Gm(n);o.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),nR=S("$ZodCheckLengthEquals",(t,e)=>{var r;nt.init(t,e),(r=t._zod.def).when??(r.when=WP),t._zod.check=o=>{let n=o.value,i=n.length,s=typeof n=="string"&&i>=e.length&&i<=e.length*2?Tu(n):i;if(s===e.length)return;let a=Gm(n),c=s>e.length;o.issues.push({origin:a,...c?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),wd=S("$ZodCheckStringFormat",(t,e)=>{var r,o;nt.init(t,e),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(o=t._zod).check??(o.check=()=>{})}),oR=S("$ZodCheckRegex",(t,e)=>{wd.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),iR=S("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=BP),wd.init(t,e)}),sR=S("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=KP),wd.init(t,e)}),aR=S("$ZodCheckIncludes",(t,e)=>{nt.init(t,e);let r=ho(e.includes),o=new RegExp(typeof e.position=="number"?`^.{${e.position},}${r}`:r);e.pattern=o,t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),cR=S("$ZodCheckStartsWith",(t,e)=>{nt.init(t,e);let r=new RegExp(`^${ho(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.check=o=>{o.value.startsWith(e.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:o.value,inst:t,continue:!e.abort})}}),uR=S("$ZodCheckEndsWith",(t,e)=>{nt.init(t,e);let r=new RegExp(`.*${ho(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.check=o=>{o.value.endsWith(e.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:o.value,inst:t,continue:!e.abort})}});function vb(t,e,r){t.issues.length&&e.issues.push(...En(r,t.issues))}var lR=S("$ZodCheckProperty",(t,e)=>{nt.init(t,e),t._zod.check=r=>{let o=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(o instanceof Promise)return o.then(n=>vb(n,r,e.property));vb(o,r,e.property)}}),dR=S("$ZodCheckProperties",(t,e)=>{nt.init(t,e),Xm(t,Symbol.iterator,function*(){yield t});let r;t._zod.check=o=>{if(o.value==null){o.issues.push({expected:"object",code:"invalid_type",input:o.value,inst:t});return}r??(r=Reflect.ownKeys(e.shape).map(s=>[s,e.shape[s]]));let n=o.value,i;for(let[s,a]of r){let c=a._zod.run({value:n[s],issues:[]},{});c instanceof Promise?(i??(i=[]),i.push(c.then(u=>vb(u,o,s)))):vb(c,o,s)}if(i)return Promise.all(i).then(()=>{})}}),pR=S("$ZodCheckMimeType",(t,e)=>{nt.init(t,e);let r=new Set(e.mime);t._zod.check=o=>{r.has(o.value.type)||o.issues.push({code:"invalid_value",values:e.mime,input:o.value.type,inst:t,continue:!e.abort})}}),fR=S("$ZodCheckOverwrite",(t,e)=>{nt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var Ou=class{constructor(e=[],r={}){this.content=[],this.indent=0,this.args=e,this.closed=r}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(`
69
69
  `).filter(s=>s),n=Math.min(...o.map(s=>s.length-s.trimStart().length)),i=o.map(s=>s.slice(n)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let e=Function,r=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
70
70
  ${r.join(`
@@ -125,20 +125,20 @@ ${c}`:c:"",l=Function,d=`return (input) => {
125
125
  ${c}
126
126
  }`,f;try{f=new l(...s,d)(...a)}catch(p){throw new Re(`this schema (generated code failed to evaluate: ${p.message})`)}return e?.debug&&(f.code=u),f.definite=o.definite,f}function ne(t,e){for(let[o,n]of t.constants)if(n===e)return o;let r=`c${t.constantCounter++}`;return t.constants.set(r,e),r}function Du(t,e){return t.definite=!1,ne(t,e)}function ee(t){return`v${t.varCounter++}`}function Wpe(t,e){let r=t._zod.run({value:e,issues:[]},{});if(r&&typeof r.then=="function")return un;let o=r;return o.issues.length===0?o.value:un}function Lr(t,e,r,o,n=!0){let i=t.content.length,s=e.constants.size,a=e.constantCounter,c=e.varCounter;try{return Pt(t,e,r,o,n)}catch(u){if(!(u instanceof Re)||!u.islandable)throw u;if(t.content.length=i,e.constants.size>s){let l=Array.from(e.constants.keys()).slice(s);for(let d of l)e.constants.delete(d)}return e.constantCounter=a,e.varCounter=c,Jpe(t,e,r,o)}}function Jpe(t,e,r,o){e.definite=!1;let n=ne(e,r),i=ne(e,Wpe),s=ee(e);return t.write(`const ${s} = ${i}(${n}, ${o});`),t.write(`if (${s} === INVALID) return INVALID;`),s}var Gpe=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function Xpe(t,e,r,o){let n=r._zod.def.checks;if(!n||n.length===0)return o;let i=o;for(let s of n){let a=s._zod.def;if(a.when&&!Gpe.has(a.check))throw new Re('check with a custom "when" condition');switch(a.check){case"greater_than":Ype(t,e,a,i);break;case"less_than":Qpe(t,e,a,i);break;case"multiple_of":efe(t,e,a,i);break;case"number_format":OV(t,a,i);break;case"min_length":{let c=Ha(a.minimum,"min_length"),u=PR(t,e,i,`${i}.length >= ${c} && ${i}.length < ${a.minimum*2}`);t.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{let c=Ha(a.maximum,"max_length"),u=PR(t,e,i,`${i}.length > ${c}`);t.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{let c=Ha(a.length,"length_equals"),u=PR(t,e,i,`${i}.length >= ${c} && ${i}.length <= ${a.length*2}`);t.write(`if (${u} !== ${c}) return INVALID;`);break}case"min_size":t.write(`if (${i}.size < ${Ha(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":t.write(`if (${i}.size > ${Ha(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":t.write(`if (${i}.size !== ${Ha(a.size,"size_equals")}) return INVALID;`);break;case"string_format":i=NV(t,e,a,i);break;case"custom":i=sfe(t,e,s,i);break;case"bigint_format":tfe(t,a,i);break;case"mime_type":rfe(t,e,a,i);break;case"property":ofe(t,e,a,i);break;case"properties":nfe(t,e,a,i);break;case"overwrite":{let c=ee(e);ife(t,e,s,i,c),i=c;break}default:throw new Re(`check type ${a.check}`)}}return i}function PR(t,e,r,o){let n=ne(e,Tu),i=ee(e);return t.write(`const ${i} = typeof ${r} === "string" && ${o} ? ${n}(${r}) : ${r}.length;`),i}function Ha(t,e){if(typeof t!="number"||!Number.isFinite(t))throw new Re(`${e} bound of type ${typeof t}`);return`${t}`}function CV(t,e){if(typeof e=="bigint")return`${e}n`;if(typeof e=="number"){if(Number.isNaN(e))throw new Re("comparison check with NaN bound");return`${e}`}if(e instanceof Date){if(Number.isNaN(e.getTime()))throw new Re("comparison check with Invalid Date bound");return ne(t,e)}throw new Re(`comparison check bound of type ${typeof e}`)}function Ype(t,e,r,o){let n=r.inclusive?"<":"<=";t.write(`if (${o} ${n} ${CV(e,r.value)}) return INVALID;`)}function Qpe(t,e,r,o){let n=r.inclusive?">":">=";t.write(`if (${o} ${n} ${CV(e,r.value)}) return INVALID;`)}function efe(t,e,r,o){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new Re("multiple_of check with a zero divisor");t.write(`if (${o} % ${r.value}n !== 0n) return INVALID;`)}else{let n=ne(e,Bm);t.write(`if (${n}(${o}, ${Ha(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function OV(t,e,r){let o=e.format;switch(o){case"safeint":t.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":t.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":t.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":t.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":t.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new Re(`number format ${o}`)}}function tfe(t,e,r){let o=e.format;if(o)switch(o){case"int64":t.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":t.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new Re(`bigint format ${o}`)}}function rfe(t,e,r,o){let n=r.mime;if(n&&n.length>0){let i=ne(e,new Set(n));t.write(`if (!${i}.has(${o}.type)) return INVALID;`)}}function nfe(t,e,r,o){if(r.when)throw new Re('check with a custom "when" condition');t.write(`if (${o} == null) return INVALID;`);let n=r.shape;for(let i of Reflect.ownKeys(n)){let s=typeof i=="symbol"?ne(e,i):an(i),a=ee(e);t.write(`const ${a} = ${o}[${s}];`),Lr(t,e,n[i],a,!1)}}function ofe(t,e,r,o){let n=`${o}[${JSON.stringify(r.property)}]`;Pt(t,e,r.schema,n)}function ife(t,e,r,o,n){let i=r._zod.def.tx;if(!i)throw new Re("overwrite check without a transform function");if(zu(i))throw new Yo("z.compile: async overwrite transforms are not supported");let s=ne(e,i);t.write(`const ${n} = ${s}(${o});`)}function RR(){throw new In}function NR(t){this.issues.push(t)}function sfe(t,e,r,o){let n=r._zod.def;if(n.fn){if(zu(n.fn))throw new Yo("z.compile: async .refine() predicates are not supported");let i=Du(e,n.fn),s=ne(e,RR),a=ee(e);return t.write(`const ${a} = ${i}(${o});`),t.write(`if (${a} instanceof Promise) ${s}();`),t.write(`if (!${a}) return INVALID;`),o}if(r._zod.check){if(zu(r._zod.check))throw new Yo("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,a=Du(e,u=>{let l={value:u,issues:[],addIssue:NR};return i(l)instanceof Promise&&RR(),l.issues.length===0?l.value:un}),c=ee(e);return t.write(`const ${c} = ${a}(${o});`),t.write(`if (${c} === INVALID) return INVALID;`),c}throw new Re("custom check without a predicate or check function")}var afe=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function NV(t,e,r,o,n=!0){let i=r.format;if(i==="base64"){let u=ne(e,ah);return t.write(`if (!${u}(${o})) return INVALID;`),o}if(i==="base64url"){let u=ne(e,Wb);return t.write(`if (!${u}(${o})) return INVALID;`),o}if(i==="jwt"){let u=ne(e,t_),l=ne(e,r.alg??null);return t.write(`if (!${u}(${o}, ${l})) return INVALID;`),o}if(i==="ipv6"){let u=ne(e,sh);return t.write(`if (!${u}(${o})) return INVALID;`),o}if(i==="cidrv6"){let u=ne(e,Bb);return t.write(`if (!${u}(${o})) return INVALID;`),o}if(i==="credit_card"){let u=ne(e,Xb);return t.write(`if (!${u}(${o})) return INVALID;`),o}if(i==="iban"){let u=ne(e,Qb);return t.write(`if (!${u}(${o})) return INVALID;`),o}let s=r;if(i==="url"||i==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let u=ne(e,Tb),l=ne(e,r),d=ee(e),f=ee(e);if(t.write(`const ${d} = ${o}.trim();`),t.write(`const ${f} = ${u}(${d}, ${l});`),t.write(`if (typeof ${f} === "number") return INVALID;`),s.hostname!==void 0){let g=ne(e,Pb);t.write(`if (!${g}(${f}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let g=ne(e,Rb);t.write(`if (!${g}(${f}, ${l}.protocol)) return INVALID;`)}if(!n)return null;let p=ee(e),m=s.normalize?`${f}.href`:`${ne(e,ih)}(${d})`;return t.write(`const ${p} = ${m};`),p}let a=r.fn;if(a){if(zu(a))throw new Re(`async string format ${i}`);let u=ne(e,a);return t.write(`if (!${u}(${o})) return INVALID;`),o}if(afe.has(i)&&r.pattern){let u=ne(e,r.pattern);return t.write(`${u}.lastIndex = 0;`),t.write(`if (!${u}.test(${o})) return INVALID;`),o}let c=r.format;switch(c){case"regex":throw new Re("regex format without a pattern");case"lowercase":t.write(`if (${o} !== ${o}.toLowerCase()) return INVALID;`);break;case"uppercase":t.write(`if (${o} !== ${o}.toUpperCase()) return INVALID;`);break;case"includes":t.write(`if (!${o}.includes(${an(r.includes)})) return INVALID;`);break;case"starts_with":{let u=r.prefix;t.write(`if (${o}.slice(0, ${u.length}) !== ${an(u)}) return INVALID;`);break}case"ends_with":{let u=r.suffix;t.write(`if (${o}.slice(-${u.length}) !== ${an(u)}) return INVALID;`);break}default:throw new Re(`string format ${c}`)}return o}function Pt(t,e,r,o,n=!0){let i=r._zod.def,s=i.type;if(i.coerce)throw new Re(`coercion (z.coerce.${s}())`);let a=n||!!i.checks?.length,c;switch(s){case"string":c=cfe(t,e,r,o,a);break;case"number":c=ufe(t,r,o);break;case"boolean":c=lfe(t,o);break;case"bigint":c=dfe(t,r,o);break;case"symbol":c=pfe(t,o);break;case"undefined":c=ffe(t,o);break;case"null":c=mfe(t,o);break;case"any":case"unknown":c=o;break;case"never":t.write("return INVALID;"),c=o;break;case"void":c=hfe(t,o);break;case"nan":c=gfe(t,o);break;case"date":c=yfe(t,o);break;case"object":c=vfe(t,e,r,o,a);break;case"optional":c=wfe(t,e,r,o,a);break;case"nullable":c=Sfe(t,e,r,o,a);break;case"array":c=xfe(t,e,r,o,a);break;case"literal":c=Efe(t,e,r,o);break;case"enum":c=kfe(t,e,r,o);break;case"readonly":{let u=TV(t,e,r,o),l=ee(e);t.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":TV(t,e,r,o),c="true";break;case"default":case"prefault":c=Ife(t,e,r,o);break;case"nonoptional":c=$fe(t,e,r,o);break;case"tuple":c=Afe(t,e,r,o);break;case"union":c=Tfe(t,e,r,o);break;case"intersection":c=Cfe(t,e,r,o);break;case"record":c=Ofe(t,e,r,o);break;case"map":c=Dfe(t,e,r,o);break;case"set":c=zfe(t,e,r,o);break;case"file":c=jfe(t,o);break;case"template_literal":c=Mfe(t,e,r,o);break;case"lazy":c=Ufe(t,e,r,o);break;case"pipe":c=Lfe(t,e,r,o);break;case"custom":c=Ffe(t,e,r,o);break;case"transform":c=Bfe(t,e,r,o);break;case"catch":c=Hfe(t,e,r,o);break;default:throw new Re(`schema type ${s}`)}return c===null?null:Xpe(t,e,r,c)}function cfe(t,e,r,o,n=!0){t.write(`if (typeof ${o} !== "string") return INVALID;`);let i=r._zod.def;return i.format===void 0?o:NV(t,e,i,o,n)}function ufe(t,e,r){t.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let o=e._zod.def;return o.check==="number_format"&&o.format&&OV(t,{format:o.format},r),r}function lfe(t,e){return t.write(`if (typeof ${e} !== "boolean") return INVALID;`),e}function dfe(t,e,r){t.write(`if (typeof ${r} !== "bigint") return INVALID;`);let o=e._zod.def;if(o.format)switch(o.format){case"int64":t.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":t.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}function pfe(t,e){return t.write(`if (typeof ${e} !== "symbol") return INVALID;`),e}function ffe(t,e){return t.write(`if (${e} !== undefined) return INVALID;`),e}function mfe(t,e){return t.write(`if (${e} !== null) return INVALID;`),e}function hfe(t,e){return t.write(`if (${e} !== undefined) return INVALID;`),e}function gfe(t,e){return t.write(`if (typeof ${e} !== "number" || !Number.isNaN(${e})) return INVALID;`),e}function yfe(t,e){return t.write(`if (!(${e} instanceof Date) || Number.isNaN(${e}.getTime())) return INVALID;`),e}function vfe(t,e,r,o,n=!0){let i=r._zod.def;t.write(`if (typeof ${o} !== "object" || ${o} === null || Array.isArray(${o})) return INVALID;`);let s=i.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),u=c.length?[...a,...c]:a,l=b=>typeof b=="symbol"?ne(e,b):an(b),d=b=>typeof b=="symbol"?`[${l(b)}]`:an(b),f=s;if(a.includes("__proto__"))throw new Re('object shape key "__proto__"');let p=new Map;for(let b of u){let _=f[b],k=l(b),$=ee(e);if(t.write(`const ${$} = ${o}[${k}];`),_._zod.optin!==void 0){let D=ee(e);t.write(`let ${D} = (() => {`),t.indented(K=>{let te=Lr(K,e,_,$);K.write(`return ${te};`)}),t.write("})();"),_._zod.optout==="optional"?(t.write(`if (${D} === INVALID) {`),t.indented(K=>{K.write(`if (${k} in ${o}) return INVALID;`),K.write(`${D} = undefined;`)}),t.write("}")):t.write(`if (${D} === INVALID) return INVALID;`),p.set(b,D)}else{_fe(_)&&t.write(`if (!(${k} in ${o})) return INVALID;`);let D=Lr(t,e,_,$,n);D!==null&&p.set(b,D)}}let m=i.catchall,g="none";if(m){let b=m._zod.def.type;if(b==="never"){let _=a.map(k=>`k !== ${an(k)}`).join(" && ")||"true";t.write(`for (const k in ${o}) {`),t.indented(k=>{k.write(`if (${_}) return INVALID;`)}),t.write("}")}else(b==="unknown"||b==="any")&&!m._zod.def.checks?.length?g="passthrough":g="schema"}let y=ee(e),w=u.some(b=>AV(f[b])||CR(f[b]));if(!n){if(g==="schema"){let b=a.length>0?ne(e,new Set(a)):null;t.write(`for (const k in ${o}) {`),t.indented(_=>{_.write('if (k === "__proto__") continue;'),b&&_.write(`if (${b}.has(k)) continue;`);let k=ee(e);_.write(`const ${k} = ${o}[k];`),Lr(_,e,m,k,!1)}),t.write("}")}return null}if(w){t.write(`const ${y} = {};`);for(let b of u){let _=l(b),k=p.get(b);CR(f[b])?t.write(`if (${_} in ${o}) ${y}[${_}] = ${k};`):AV(f[b])?t.write(`if (${k} !== undefined || ${_} in ${o}) ${y}[${_}] = ${k};`):t.write(`${y}[${_}] = ${k};`)}}else{let b=u.map(_=>`${d(_)}: ${p.get(_)}`).join(", ");t.write(`const ${y} = { ${b} };`)}if(g!=="none"){let b=a.length>0?ne(e,new Set(a)):null;t.write(`for (const k in ${o}) {`),t.indented(_=>{if(_.write('if (k === "__proto__") continue;'),b&&_.write(`if (${b}.has(k)) continue;`),g==="passthrough")_.write(`${y}[k] = ${o}[k];`);else{let k=ee(e);_.write(`const ${k} = ${o}[k];`);let $=Lr(_,e,m,k);_.write(`${y}[k] = ${$};`)}}),t.write("}")}return y}function wfe(t,e,r,o,n=!0){let i=r._zod.def;if(bfe(r))return Pt(t,e,i.innerType,o,n);if(i.innerType._zod.optin==="defaulted"){let a=ee(e),c=ee(e);return t.write(`let ${a};`),t.write(`if (${o} === undefined) {`),t.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{let d=Pt(l,e,i.innerType,o);l.write(`return ${d};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${a} = ${c};`)}),t.write("} else {"),t.indented(u=>{let l=Pt(u,e,i.innerType,o);u.write(`${a} = ${l};`)}),t.write("}"),a}let s=n?ee(e):null;return s&&t.write(`let ${s};`),t.write(`if (${o} !== undefined) {`),t.indented(a=>{let c=Pt(a,e,i.innerType,o,n);s&&c!==null&&a.write(`${s} = ${c};`)}),t.write("}"),s}function bfe(t){return t._zod.traits?.has("$ZodExactOptional")===!0}function _fe(t){return t._zod.optin===void 0&&Nu(t)}function Nu(t){if(t._zod.def.coerce)return!0;let e=t._zod.def;switch(e.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return e.innerType?Nu(e.innerType):!1;case"literal":return!!e.values?.includes(void 0);case"enum":return!!t._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return e.innerType?Nu(e.innerType):!0;case"catch":return!0;case"union":return e.options?e.options.some(Nu):!0;case"intersection":return!e.left||!e.right?!0:Nu(e.left)&&Nu(e.right);case"pipe":return e.in?Nu(e.in):!0;default:return!0}}function CR(t){return t._zod.optin==="optional"&&t._zod.optout==="optional"}function AV(t){return(t._zod.optin!=="defaulted"||t._zod.optout==="optional")&&Ad(t)}function Ad(t){let e=t._zod.def;switch(e.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!e.values?.includes(void 0);case"enum":return!!t._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return e.innerType?Ad(e.innerType):!0;case"union":return e.options?e.options.some(Ad):!0;case"intersection":return!e.left||!e.right||Ad(e.left)||Ad(e.right);case"pipe":return e.out?Ad(e.out):!0;default:return!0}}function Sfe(t,e,r,o,n=!0){let i=r._zod.def,s=n?ee(e):null;return s&&t.write(`let ${s} = null;`),t.write(`if (${o} !== null) {`),t.indented(a=>{let c=Pt(a,e,i.innerType,o,n);s&&c!==null&&a.write(`${s} = ${c};`)}),t.write("}"),s}function DR(t,e,r){for(let[o,n]of ud(e._zod.def.checks))t.write(`if (${r} > ${Ha(o,n._zod.def.check)}) return INVALID;`)}function xfe(t,e,r,o,n=!0){let i=r._zod.def;t.write(`if (!Array.isArray(${o})) return INVALID;`),DR(t,r,`${o}.length`);let s=n?ee(e):null,a=ee(e),c=ee(e);return s&&t.write(`const ${s} = new Array(${o}.length);`),t.write(`for (let ${a} = 0; ${a} < ${o}.length; ${a}++) {`),t.indented(u=>{u.write(`const ${c} = ${o}[${a}];`);let l=Lr(u,e,i.element,c,n);s&&l!==null&&u.write(`${s}[${a}] = ${l};`)}),t.write("}"),s}function Efe(t,e,r,o){let i=r._zod.def.values;if(i.length!==1){let a=ne(e,new Set(i));return t.write(`if (!${a}.has(${o})) return INVALID;`),o}let s=i[0];if(typeof s=="number"&&Number.isNaN(s)){let a=ne(e,new Set(i));return t.write(`if (!${a}.has(${o})) return INVALID;`),o}if(typeof s=="string")t.write(`if (${o} !== ${an(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")t.write(`if (${o} !== ${s}) return INVALID;`);else if(s===null)t.write(`if (${o} !== null) return INVALID;`);else if(s===void 0)t.write(`if (${o} !== undefined) return INVALID;`);else if(typeof s=="bigint")t.write(`if (${o} !== ${s}n) return INVALID;`);else throw new Re(`literal type ${typeof s}`);return o}function kfe(t,e,r,o){let n=r._zod.values;if(!n)throw new Re("enum schema without enumerated values");let i=ne(e,n);return t.write(`if (!${i}.has(${o})) return INVALID;`),o}function TV(t,e,r,o){let n=r._zod.def;return Pt(t,e,n.innerType,o)}function Ife(t,e,r,o){let n=r._zod.def,s=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!s)return Pt(t,e,n.innerType,o);let c=ne(e,s),u=ee(e);return t.write(`let ${u} = ${o};`),t.write(`if (${o} === undefined) ${u} = ${c}();`),Pt(t,e,n.innerType,u)}let a=ee(e);if(s){let c=ne(e,s),u=ne(e,cd);t.write(`let ${a};`),t.write(`if (${o} === undefined) {`),t.indented(l=>{l.write(`${a} = ${u}(${c}());`)}),t.write("} else {"),t.indented(l=>{let d=Pt(l,e,n.innerType,o);l.write(`${a} = ${d} === undefined ? ${u}(${c}()) : ${d};`)}),t.write("}")}else t.write(`let ${a};`),t.write(`if (${o} !== undefined) {`),t.indented(c=>{let u=Pt(c,e,n.innerType,o);c.write(`${a} = ${u};`)}),t.write("}");return a}function $fe(t,e,r,o){let n=r._zod.def,i=Pt(t,e,n.innerType,o),s=ee(e);return t.write(`const ${s} = ${i};`),t.write(`if (${s} === undefined) return INVALID;`),s}function Afe(t,e,r,o){let n=r._zod.def,i=n.items,s=n.rest;t.write(`if (!Array.isArray(${o})) return INVALID;`);let a=PV(i,"optin"),c=PV(i,"optout");s?t.write(`if (${o}.length < ${a}) return INVALID;`):t.write(`if (${o}.length < ${a} || ${o}.length > ${i.length}) return INVALID;`);let u=ee(e);t.write(`const ${u} = [];`);for(let l=0;l<i.length;l++){let d=i[l];if(l>=c)t.write(`if (${u}.length === ${l}) {`),t.indented(f=>{f.write(`if (${l} < ${o}.length) {`),f.indented(p=>{let m=ee(e);p.write(`const ${m} = ${o}[${l}];`);let g=Lr(p,e,d,m);p.write(`${u}[${l}] = ${g};`)}),f.write("} else {"),f.indented(p=>{if(CR(d)){p.write(`${u}.length = ${l};`);return}let m=ee(e),g=ee(e);p.write(`const ${m} = undefined;`),p.write(`const ${g} = (() => {`),p.indented(y=>{let w=Lr(y,e,d,m);y.write(`return ${w};`)}),p.write("})();"),p.write(`if (${g} === INVALID || ${g} === undefined) ${u}.length = ${l};`),p.write(`else ${u}[${l}] = ${g};`)}),f.write("}")}),t.write("}");else{let f=ee(e);t.write(`const ${f} = ${o}[${l}];`);let p=Lr(t,e,d,f);t.write(`${u}[${l}] = ${p};`)}}if(s){let l=ee(e),d=ee(e);t.write(`for (let ${l} = ${i.length}; ${l} < ${o}.length; ${l}++) {`),t.indented(f=>{f.write(`const ${d} = ${o}[${l}];`);let p=Lr(f,e,s,d);f.write(`${u}[${l}] = ${p};`)}),t.write("}")}return u}function PV(t,e){for(let r=t.length-1;r>=0;r--)if(!(e==="optin"?t[r]._zod.optin!==void 0:t[r]._zod.optout==="optional"))return r+1;return 0}function Tfe(t,e,r,o){let n=r._zod.def,i=n.options;if(n.discriminator)return Pfe(t,e,n,o);if(n.inclusive===!1)throw new Re("exclusive unions (z.xor)");if(i.length===0)return t.write("return INVALID;"),o;if(i.length===1)return Pt(t,e,i[0],o);if(i.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(i.flatMap(l=>l._zod.def.values)),u=ne(e,c);return t.write(`if (!${u}.has(${o})) return INVALID;`),o}let a=ee(e);t.write(`let ${a};`);for(let c=0;c<i.length;c++){let u=i[c];c===0?t.write(`${a} = (() => {`):t.write(`if (${a} === INVALID) ${a} = (() => {`),t.indented(l=>{let d=Pt(l,e,u,o);l.write(`return ${d};`)}),t.write("})();")}return t.write(`if (${a} === INVALID) return INVALID;`),a}function Pfe(t,e,r,o){if(r.unionFallback)throw new Re("discriminated union with unionFallback");if(r.options.length===0)return t.write("return INVALID;"),o;let n=ee(e),i=ee(e);t.write(`const ${n} = ${o}?.[${an(r.discriminator)}];`),t.write(`let ${i};`);let s=!0,a=new Set;for(let c of r.options){let u=c._zod.propValues?.[r.discriminator];if(!u||u.size===0)throw new Re("discriminated union option without static discriminator values");for(let f of u){if(a.has(f))throw new Re(`duplicate discriminator value ${String(f)}`);a.add(f)}let l=Array.from(u,f=>Rfe(e,n,f)),d=s?"if":"else if";t.write(`${d} (${l.join(" || ")}) {`),t.indented(f=>{let p=Pt(f,e,c,o);f.write(`${i} = ${p};`)}),t.write("}"),s=!1}return t.write("else { return INVALID; }"),i}function Rfe(t,e,r){if(typeof r=="string")return`${e} === ${an(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${e})`:`${e} === ${r}`;if(typeof r=="boolean")return`${e} === ${r}`;if(r===null)return`${e} === null`;if(r===void 0)return`${e} === undefined`;if(typeof r=="bigint")return`${e} === ${r}n`;if(typeof r=="symbol"){let o=ne(t,r);return`${e} === ${o}`}throw new Re(`literal discriminator value ${String(r)}`)}function Cfe(t,e,r,o){let n=r._zod.def;e.definite=!1;let i=Lr(t,e,n.left,o),s=Lr(t,e,n.right,o),a=ne(e,bd),c=ee(e);return t.write(`const ${c} = ${a}(${i}, ${s});`),t.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function Ofe(t,e,r,o){let n=r._zod.def,i=ne(e,mo);t.write(`if (!${i}(${o})) return INVALID;`);let s=ee(e),a=ee(e),c=ee(e);t.write(`const ${s} = {};`);let u=n,l=u.partial?void 0:n.keyType._zod.values;if(l){let p=[];for(let g of l){if(!(typeof g=="string"||typeof g=="number"||typeof g=="symbol"))throw new Re(`record key value ${String(g)}`);let y=typeof g=="number"?g.toString():g;if(y==="__proto__")throw new Re('record key "__proto__"');p.push(y);let w=ne(e,g),b=Pt(t,e,n.keyType,w),_=ee(e);t.write(`const ${_} = ${o}[${Nfe(e,y)}];`);let k=Lr(t,e,n.valueType,_);t.write(`${s}[${b}] = ${k};`)}let m=ne(e,new Set(p));return t.write(`for (const ${a} in ${o}) {`),t.indented(g=>{g.write(`if (${m}.has(${a})) continue;`),u.mode==="loose"?g.write(`if (${a} !== "__proto__") ${s}[${a}] = ${o}[${a}];`):g.write("return INVALID;")}),t.write("}"),s}let d=n.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let p=n.mode==="loose",m=X_(n.keyType);m.definite===!1&&(e.definite=!1);let g=ne(e,m),y=ne(e,ta),w=ee(e);return RV(t,e,o,a,b=>{b.write(`let ${w} = ${g}(${a});`),b.write(`if (${w} === INVALID && typeof ${a} === "string" && ${y}.test(${a})) ${w} = ${g}(Number(${a}));`),p?b.write(`if (${w} === INVALID) { ${s}[${a}] = ${o}[${a}]; continue; }`):b.write(`if (${w} === INVALID) return INVALID;`),b.write(`if (${w} === "__proto__") continue;`);let _=ee(e);b.write(`const ${_} = ${o}[${a}];`);let k=Lr(b,e,n.valueType,_);b.write(`${s}[${w}] = ${k};`)}),s}return RV(t,e,o,a,p=>{p.write(`const ${c} = ${o}[${a}];`);let m=Lr(p,e,n.valueType,c);p.write(`${s}[${a}] = ${m};`)},"return INVALID;"),s}function RV(t,e,r,o,n,i){let s=ne(e,Object.prototype.propertyIsEnumerable),a=ee(e),c=ee(e),u=ee(e);t.write(`const ${a} = Object.getOwnPropertySymbols(${r});`),t.write(`const ${c} = Object.getOwnPropertyNames(${r});`),t.write(`for (let ${u} = 0; ${u} < ${c}.length; ${u}++) {`),t.indented(l=>{l.write(`const ${o} = ${c}[${u}];`),l.write(`if (${o} === "__proto__" || !${s}.call(${r}, ${o})) continue;`),n(l)}),t.write("}"),t.write(`for (let ${u} = 0; ${u} < ${a}.length; ${u}++) {`),t.indented(l=>{l.write(`const ${o} = ${a}[${u}];`),l.write(`if (!${s}.call(${r}, ${o})) continue;`),i?l.write(i):n(l)}),t.write("}")}function Nfe(t,e){return typeof e=="string"?an(e):ne(t,e)}function Dfe(t,e,r,o){let n=r._zod.def;t.write(`if (!(${o} instanceof Map)) return INVALID;`),DR(t,r,`${o}.size`);let i=ee(e),s=ee(e),a=ee(e);return t.write(`const ${i} = new Map();`),t.write(`for (const [${s}, ${a}] of ${o}) {`),t.indented(c=>{let u=Pt(c,e,n.keyType,s),l=Pt(c,e,n.valueType,a);c.write(`${i}.set(${u}, ${l});`)}),t.write("}"),i}function zfe(t,e,r,o){let n=r._zod.def;t.write(`if (!(${o} instanceof Set)) return INVALID;`),DR(t,r,`${o}.size`);let i=ee(e),s=ee(e);return t.write(`const ${i} = new Set();`),t.write(`for (const ${s} of ${o}) {`),t.indented(a=>{let c=Pt(a,e,n.valueType,s);a.write(`${i}.add(${c});`)}),t.write("}"),i}function jfe(t,e){return t.write(`if (!(${e} instanceof File)) return INVALID;`),e}function Mfe(t,e,r,o){t.write(`if (typeof ${o} !== "string") return INVALID;`);let n=r._zod.pattern;if(n){let i=ne(e,n);t.write(`${i}.lastIndex = 0;`),t.write(`if (!${i}.test(${o})) return INVALID;`)}return o}function Ufe(t,e,r,o){let n=r._zod.def,i=Du(e,n.getter),s=ne(e,{parser:null});t.write(`if (!${s}.parser) {`),t.indented(c=>{c.write(`const inner = ${i}();`),c.write(`${s}.parser = function(input) {`),c.indented(u=>{u.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),u.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),t.write("}");let a=ee(e);return t.write(`const ${a} = ${s}.parser(${o});`),t.write(`if (${a} === INVALID) return INVALID;`),a}function Lfe(t,e,r,o){let n=r._zod.def,i=Pt(t,e,n.in,o);if(n.transform){if(zu(n.transform))throw new Yo("z.compile: async transforms in pipes are not supported");let s=n.transform,c=Du(e,l=>{let d={value:l,issues:[],addIssue:NR},f=s(l,d);return f instanceof Promise?un:d.issues.length===0?f:un}),u=ee(e);return t.write(`const ${u} = ${c}(${i});`),t.write(`if (${u} === INVALID) return INVALID;`),Pt(t,e,n.out,u)}else return Pt(t,e,n.out,i)}function zu(t){return typeof t=="function"&&(t.constructor.name==="AsyncFunction"||t[Symbol.toStringTag]==="AsyncFunction")}function Ffe(t,e,r,o){let n=r._zod.def;if(n.fn){if(zu(n.fn))throw new Yo("z.compile: async custom predicates are not supported");let i=Du(e,n.fn),s=ne(e,RR),a=ee(e);t.write(`const ${a} = ${i}(${o});`),t.write(`if (${a} instanceof Promise) ${s}();`),t.write(`if (!${a}) return INVALID;`)}else throw new Re("custom schema without a predicate function");return o}function Vfe(t,e,r){let o=t._zod.run({value:r,issues:[]},{});if(o&&typeof o.then=="function")return un;let n=o;return n.issues.length===0?n.value:e()}function Hfe(t,e,r,o){let n=r._zod.def;if(!n.catchValue[ib])throw new Re("catch with a callback (only a constant catch value compiles)",!1);let i=ee(e);t.write(`let ${i} = (() => {`),t.indented(u=>{let l=Lr(u,e,n.innerType,o);u.write(`return ${l};`)}),t.write("})();");let s=ne(e,n.innerType),a=Du(e,n.catchValue),c=ne(e,Vfe);return t.write(`if (${i} === INVALID) {`),t.indented(u=>{u.write(`${i} = ${c}(${s}, ${a}, ${o});`),u.write(`if (${i} === INVALID) return INVALID;`)}),t.write("}"),i}function Bfe(t,e,r,o){let n=r._zod.def;if(n.transform){if(zu(n.transform))throw new Yo("z.compile: async transforms are not supported");let i=n.transform,a=Du(e,u=>{let l={value:u,issues:[],addIssue:NR},d=i(u,l);return d instanceof Promise?un:l.issues.length===0?d:un}),c=ee(e);return t.write(`const ${c} = ${a}(${o});`),t.write(`if (${c} === INVALID) return INVALID;`),c}return o}function Y_(t){return t.checks&&(t.checks=[...t.checks]),t}function Q_(t,e){return new t(Y_({type:"string",...N(e)}))}function zR(t,e){return new t(Y_({type:"string",coerce:!0,...N(e)}))}function vh(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...N(e)})}function wh(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...N(e)})}function bh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...N(e)})}function _h(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N(e)})}function Sh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N(e)})}function xh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N(e)})}function Td(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...N(e)})}function Eh(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...N(e)})}function kh(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...N(e)})}function Ih(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...N(e)})}function $h(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...N(e)})}function Ah(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...N(e)})}function Th(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...N(e)})}function Ph(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...N(e)})}function Rh(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...N(e)})}function Ch(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...N(e)})}function eS(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...N(e)})}function Oh(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N(e)})}function Nh(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N(e)})}function Dh(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...N(e)})}function zh(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...N(e)})}function jh(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...N(e)})}function tS(t,e){return new t({type:"string",format:"credit_card",check:"string_format",abort:!1,...N(e)})}function rS(t,e){return new t({type:"string",format:"iban",check:"string_format",abort:!1,...N(e)})}function Mh(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...N(e)})}var jR={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Uh(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N(e)})}function Lh(t,e){return new t({type:"string",format:"date",check:"string_format",...N(e)})}function Fh(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...N(e)})}function Vh(t,e){return new t({type:"string",format:"duration",check:"string_format",...N(e)})}function nS(t,e){return new t(Y_({type:"number",checks:[],...N(e)}))}function MR(t,e){return new t(Y_({type:"number",coerce:!0,checks:[],...N(e)}))}function oS(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...N(e)})}function iS(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...N(e)})}function sS(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...N(e)})}function aS(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...N(e)})}function cS(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...N(e)})}function uS(t,e){return new t({type:"boolean",...N(e)})}function UR(t,e){return new t({type:"boolean",coerce:!0,...N(e)})}function lS(t,e){return new t({type:"bigint",...N(e)})}function LR(t,e){return new t({type:"bigint",coerce:!0,...N(e)})}function dS(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...N(e)})}function pS(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...N(e)})}function fS(t,e){return new t({type:"symbol",...N(e)})}function mS(t,e){return new t({type:"undefined",...N(e)})}function hS(t,e){return new t({type:"null",...N(e)})}function gS(t){return new t({type:"any"})}function yS(t){return new t({type:"unknown"})}function vS(t,e){return new t({type:"never",...N(e)})}function wS(t,e){return new t({type:"void",...N(e)})}function bS(t,e){return new t({type:"date",...N(e)})}function FR(t,e){return new t({type:"date",coerce:!0,...N(e)})}function _S(t,e){return new t({type:"nan",...N(e)})}function Wi(t,e){return new wb({check:"less_than",...N(e),value:t,inclusive:!1})}function Bn(t,e){return new wb({check:"less_than",...N(e),value:t,inclusive:!0})}function Ji(t,e){return new bb({check:"greater_than",...N(e),value:t,inclusive:!1})}function Kn(t,e){return new bb({check:"greater_than",...N(e),value:t,inclusive:!0})}function SS(t){return Ji(0,t)}function xS(t){return Wi(0,t)}function ES(t){return Bn(0,t)}function kS(t){return Kn(0,t)}function Ba(t,e){return new JP({check:"multiple_of",...N(e),value:t})}function Ka(t,e){return new YP({check:"max_size",...N(e),maximum:t})}function Gi(t,e){return new QP({check:"min_size",...N(e),minimum:t})}function ju(t,e){return new eR({check:"size_equals",...N(e),size:t})}function Mu(t,e){return new tR({check:"max_length",...N(e),maximum:t})}function ra(t,e){return new rR({check:"min_length",...N(e),minimum:t})}function Uu(t,e){return new nR({check:"length_equals",...N(e),length:t})}function Pd(t,e){return new oR({check:"string_format",format:"regex",...N(e),pattern:t})}function Rd(t){return new iR({check:"string_format",format:"lowercase",...N(t)})}function Cd(t){return new sR({check:"string_format",format:"uppercase",...N(t)})}function Od(t,e){return new aR({check:"string_format",format:"includes",...N(e),includes:t})}function Nd(t,e){return new cR({check:"string_format",format:"starts_with",...N(e),prefix:t})}function Dd(t,e){return new uR({check:"string_format",format:"ends_with",...N(e),suffix:t})}function IS(t,e,r){return new lR({check:"property",property:t,schema:e,...N(r)})}function zd(t,e){return new dR({check:"properties",shape:t,...N(e)})}function jd(t,e){return new pR({check:"mime_type",mime:t,...N(e)})}function Qo(t){return new fR({check:"overwrite",tx:t})}function Md(t){return Qo(e=>e.normalize(t))}function Ud(){return Qo(t=>t.trim())}function Ld(){return Qo(t=>t.toLowerCase())}function Fd(){return Qo(t=>t.toUpperCase())}function Vd(){return Qo(t=>GT(t))}function VR(t,e,r){return new t({type:"array",element:e,...N(r)})}function Kfe(t,e,r){return new t({type:"union",options:e,...N(r)})}function qfe(t,e,r){return new t({type:"union",options:e,inclusive:!1,...N(r)})}function Zfe(t,e,r,o){return new t({type:"union",options:r,discriminator:e,...N(o)})}function Wfe(t,e,r){return new t({type:"intersection",left:e,right:r})}function Jfe(t,e,r,o){let n=r instanceof ae,i=n?o:r,s=n?r:null;return new t({type:"tuple",items:e,rest:s,...N(i)})}function Gfe(t,e,r,o){return new t({type:"record",keyType:e,valueType:r,...N(o)})}function Xfe(t,e,r,o){return new t({type:"map",keyType:e,valueType:r,...N(o)})}function Yfe(t,e,r){return new t({type:"set",valueType:e,...N(r)})}function Qfe(t,e,r){let o=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new t({type:"enum",entries:o,...N(r)})}function eme(t,e,r){return new t({type:"enum",entries:e,...N(r)})}function tme(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...N(r)})}function $S(t,e){return new t({type:"file",...N(e)})}function rme(t,e){return new t({type:"transform",transform:e})}function nme(t,e){return new t({type:"optional",innerType:e})}function ome(t,e){return new t({type:"nullable",innerType:e})}function ime(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():cd(r)}})}function sme(t,e,r){return new t({type:"nonoptional",innerType:e,...N(r)})}function ame(t,e){return new t({type:"success",innerType:e})}function cme(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:nP(r)})}function ume(t,e,r){return new t({type:"pipe",in:e,out:r})}function lme(t,e){return new t({type:"readonly",innerType:e})}function dme(t,e,r){return new t({type:"template_literal",parts:e,...N(r)})}function pme(t,e){return new t({type:"lazy",getter:e})}function fme(t,e){return new t({type:"promise",innerType:e})}function AS(t,e,r){let o=N(r);return o.abort??(o.abort=!0),new t({type:"custom",check:"custom",fn:e,...o})}function TS(t,e,r){return new t({type:"custom",check:"custom",fn:e,...N(r)})}function PS(t,e){let r=DV(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(ld(n,o.value,r._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(ld(i))}},t(o.value,o)),e);return r}function DV(t,e){let r=new nt({check:"custom",...N(e)});return r._zod.check=t,r}function RS(t){let e=new nt({check:"describe"});return e._zod.onattach=[r=>{let o=wr.get(r)??{};wr.add(r,{...o,description:t})}],e._zod.check=()=>{},e}function CS(t){let e=new nt({check:"meta"});return e._zod.onattach=[r=>{let o=wr.get(r)??{};wr.add(r,{...o,...t})}],e._zod.check=()=>{},e}function OS(t,e){let r=N(e),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(o=o.map(p=>typeof p=="string"?p.toLowerCase():p),n=n.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(o),s=new Set(n),a=t.Codec??xd,c=t.Boolean??_d,u=t.String??Va,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new a({type:"pipe",in:l,out:d,transform:((p,m)=>{let g=p;return r.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:s.has(g)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?o[0]||"true":n[0]||"false"),error:r.error});return f._zod.bag.truthy=o,f._zod.bag.falsy=n,f._zod.bag.case=r.case??"insensitive",f}function qa(t,e,r,o={}){let n=N(o),i={check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:a=>r.test(a),...n};return r instanceof RegExp&&(i.pattern=r),new t(i)}function Hh(t,...e){for(let r of e)for(let o of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,o)&&vr(t,o,r[o]);return t}function Za(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??wr,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:t?.cycles??"ref",reused:t?.reused??"inline",intersections:[],deferred:[],external:t?.external??void 0}}function Xt(t,e,r,o,n){let i=typeof e.unrepresentable=="function"?e.unrepresentable({zodSchema:t,path:o.path,message:n}):e.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(n);return Object.assign(r,i),!0}function et(t,e,r={path:[],schemaPath:[]}){var o;let n=t._zod.def,i=e.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,s),e.sharedDefsExtractedFor=void 0,e.sharedEmitDoneFor=void 0;let a=t._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,s.schema,l);else{let f=s.schema,p=e.processors[n.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);p(t,e,f,l)}let d=t._zod.parent;d&&(s.ref||(s.ref=d),et(d,e,l),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Hh(s.schema,c),e.io==="input"&&ln(t)&&(delete s.schema.examples,delete s.schema.default),e.io==="input"&&"_prefault"in s.schema&&((o=s.schema).default??(o.default=s.schema._prefault)),delete s.schema._prefault,e.seen.get(t).schema}function zV(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Wa(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;let o=new Map;for(let s of t.seen.entries()){let a=t.metadataRegistry.get(s[0])?.id;if(a){let c=o.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,s[0])}}let n=s=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(s[0])?.id,f=t.external.uri??(m=>m);if(d)return{ref:f(d)};let p=s[1].defId??s[1].schema.id??`schema${t.counter++}`;return s[1].defId=p,{defId:p,ref:`${f("__shared")}#/${a}/${zV(p)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===r&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+zV(l)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=n(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(t.cycles==="throw")for(let s of t.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
127
127
 
128
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of t.seen.entries()){let a=s[1];if(e===s[0]){i(s);continue}if(t.external){let u=t.external.registry.get(s[0])?.id;if(e!==s[0]&&u){i(s);continue}}if(t.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}a.count>1&&t.reused==="ref"&&i(s)}t.external&&(t.sharedDefsExtractedFor=t.external)}function UV(t){let e=t.anyOf;if(!Array.isArray(e)||e.length===0||t.type!==void 0)return;let r=[];for(let o of e){if(!o||typeof o!="object")return;UV(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let i=o.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete t.anyOf,t.type=r.length===1?r[0]:r}var LV=new Set(["type","properties","required","additionalProperties"]),jV=["oneOf","anyOf"];function MV(t){let e=t.additionalProperties;return e===void 0||e===!1||typeof e!="object"||e===null?null:Object.keys(e).length?e:null}function HR(t){let e=[];for(let i of t){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!LV.has(s))return null;e.push(i)}let r={},o=new Set;for(let i of e){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let a=[];for(let u of e){let l=u.properties?.[s]??MV(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:HR(a)??{allOf:a};vr(r,s,c)}for(let s of i.required??[])o.add(s)}let n={type:"object",properties:r};if(o.size&&(n.required=[...o]),e.every(i=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let s of e){let a=MV(s);a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a))&&i.push(a)}i.length===1?n.additionalProperties=i[0]:i.length>1&&(n.additionalProperties={allOf:i})}return n}function mme(t){let e=t.allOf;if(!Array.isArray(e)||e.length<2)return;for(let n of LV)if(n in t)return;let r=e.filter(n=>jV.some(i=>Array.isArray(n[i]))),o=null;if(!r.length)o=HR(e);else{let n=r[0],i=jV.find(c=>Array.isArray(n[c]));if(Object.keys(n).length!==1)return;let s=e.filter(c=>c!==n),a=n[i].map(c=>HR([...s,c]));if(a.some(c=>!c))return;o={[i]:a}}o&&(delete t.allOf,Hh(t,o))}function Ja(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=t.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let p=t.seen.get(d),m=p.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Hh(u,m),Hh(u,l),a._zod.parent===d)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(m.$ref&&p.def)for(let y in u)y==="$ref"||y==="allOf"||y in p.def&&JSON.stringify(u[y])===JSON.stringify(p.def[y])&&delete u[y]}let f=a._zod.parent;if(f&&f!==d){o(f);let p=t.seen.get(f);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(let m in u)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(u[m])===JSON.stringify(p.def[m])&&delete u[m]}t.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let a of[...t.seen.entries()].reverse())o(a[0]);if(t.target!=="openapi-3.0")for(let a of t.seen.entries())UV(a[1].def??a[1].schema);for(let a of t.deferred)a();if(t.intersections.length){let a=new Map;for(let c of t.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(u):a.set(l,[u])}for(let c of t.intersections)for(let u of a.get(c)??[])mme(u)}}let n={};if(t.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=t.external.uri(a)}Hh(n,r.defId?r.schema:r.def??r.schema);let i=t.metadataRegistry.get(e)?.id;i!==void 0&&n.id===i&&delete n.id;let s=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,vr(s,c.defId,c.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(s).length>0&&(t.target==="draft-2020-12"?n.$defs=s:n.definitions=s);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Hd(e,"input",t.processors),output:Hd(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ln(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ln(o.element,r);if(o.type==="set")return ln(o.valueType,r);if(o.type==="lazy")return ln(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return ln(o.innerType,r);if(o.type==="intersection")return ln(o.left,r)||ln(o.right,r);if(o.type==="record"||o.type==="map")return ln(o.keyType,r)||ln(o.valueType,r);if(o.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:ln(o.in,r)||ln(o.out,r);if(o.type==="object"){for(let n in o.shape)if(ln(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ln(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ln(n,r))return!0;return!!(o.rest&&ln(o.rest,r))}return!1}var BR=(t,e={})=>r=>{let o=Za({...r,processors:e});return et(t,o),Wa(o,t),Ja(o,t)},Hd=(t,e,r={})=>o=>{let{libraryOptions:n,target:i}=o??{},s=Za({...n??{},target:i,io:e,processors:r});return et(t,s),Wa(s,t),Ja(s,t)};var Bd=(t,e,r)=>{(t[e]===void 0||r>t[e])&&(t[e]=r)},Kd=(t,e,r)=>{(t[e]===void 0||r<t[e])&&(t[e]=r)},FV=(t,e)=>{Bd(t,"minimum",e),Kd(t,"maximum",e)},KV=(t,e)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(e)||t.multipleOf.push(e)},qV=(t,e)=>{t.patterns??(t.patterns=new Set),t.patterns.add(e)},ZV=(t,e)=>{t.mime=t.mime?t.mime.filter(r=>e.includes(r)):[...e]},WV=(t,e)=>{t.format=e,e.includes("int")&&(t.isInt=!0)},VV=(t,e)=>Bd(t,"minimum",e.minimum),HV=(t,e)=>Kd(t,"maximum",e.maximum),BV=t=>(e,r)=>{WV(e,r.format);let[o,n]=t[r.format];Bd(e,"minimum",o),Kd(e,"maximum",n)},hme={greater_than:(t,e)=>Bd(t,e.inclusive?"minimum":"exclusiveMinimum",e.value),less_than:(t,e)=>Kd(t,e.inclusive?"maximum":"exclusiveMaximum",e.value),multiple_of:(t,e)=>KV(t,e.value),number_format:BV(qm),bigint_format:BV(Zm),min_length:VV,max_length:HV,length_equals:(t,e)=>FV(t,e.length),min_size:VV,max_size:HV,size_equals:(t,e)=>FV(t,e.size),string_format:(t,e)=>{WV(t,e.format),e.pattern&&qV(t,e.pattern),(e.format==="base64"||e.format==="base64url")&&(t.contentEncoding=e.format),(e.local||e.precision===-1)&&(t.laxFormat=!0)},mime_type:(t,e)=>ZV(t,e.mime)};function Yt(t){let e={},r=t._zod.def,o=t._zod.traits.has("$ZodCheck")?[t,...r.checks??[]]:r.checks??[];for(let i of o)hme[i._zod.def.check]?.(e,i._zod.def);let n=t._zod.bag;n.minimum!==void 0&&Bd(e,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&Bd(e,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&Kd(e,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&Kd(e,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&KV(e,n.multipleOf),n.format!==void 0&&(e.format??(e.format=n.format),n.format.includes("int")&&(e.isInt=!0)),n.mime&&ZV(e,n.mime);for(let i of n.patterns??[])qV(e,i);return e}var gme={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yme=new Map([[qb,TP],[ch,PP]]),JV=t=>yme.get(t)??t,ZR=(t,e,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=Yt(t);if(typeof i=="number"&&(n.minLength=i),typeof s=="number"&&(n.maxLength=s),a&&(n.format=gme[a]??a,n.format===""&&delete n.format,(a==="time"||l)&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let d=[...c].map(JV);d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(f=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},WR=(t,e,r,o)=>{let n=r,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=Yt(t);n.type=l?"integer":"number";let d=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),p=e.target==="draft-04"||e.target==="openapi-3.0";if(d?p?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u:typeof i=="number"&&(n.minimum=i),f?p?(n.maximum=c,n.exclusiveMaximum=!0):n.exclusiveMaximum=c:typeof s=="number"&&(n.maximum=s),a){let m=new Set;for(let w of a)Number.isFinite(w)&&w!==0?m.add(Math.abs(w)):Xt(t,e,n,o,`A multipleOf divisor of ${w} cannot be represented in JSON Schema`);let[g,...y]=m;g!==void 0&&(n.multipleOf=g),y.length&&(n.allOf=[...n.allOf??[],...y.map(w=>({multipleOf:w}))])}},JR=(t,e,r,o)=>{r.type="boolean"},GR=(t,e,r,o)=>{Xt(t,e,r,o,"BigInt cannot be represented in JSON Schema")},XR=(t,e,r,o)=>{Xt(t,e,r,o,"Symbols cannot be represented in JSON Schema")},YR=(t,e,r,o)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},QR=(t,e,r,o)=>{Xt(t,e,r,o,"Undefined cannot be represented in JSON Schema")},eC=(t,e,r,o)=>{Xt(t,e,r,o,"Void cannot be represented in JSON Schema")},tC=(t,e,r,o)=>{r.not={}},rC=(t,e,r,o)=>{},nC=(t,e,r,o)=>{},oC=(t,e,r,o)=>{Xt(t,e,r,o,"Date cannot be represented in JSON Schema")},iC=(t,e,r,o)=>{let n=t._zod.def,i=od(n.entries);if(i.length===0){r.not={};return}i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},sC=(t,e,r,o)=>{let n=t._zod.def;if(n.values.length===0){r.not={};return}let i=[];for(let s of n.values)if(s===void 0){if(Xt(t,e,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(Xt(t,e,r,o,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];r.type=s===null?"null":typeof s,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},aC=(t,e,r,o)=>{Xt(t,e,r,o,"NaN cannot be represented in JSON Schema")},cC=(t,e,r,o)=>{let n=r,i=t._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},uC=(t,e,r,o)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=Yt(t);i!==void 0&&(n.minLength=i),s!==void 0&&(n.maxLength=s),a&&(a.length===0?n.not={}:a.length===1?n.contentMediaType=a[0]:n.anyOf=a.map(c=>({contentMediaType:c})))},lC=(t,e,r,o)=>{r.type="boolean"},dC=(t,e,r,o)=>{Xt(t,e,r,o,"Custom types cannot be represented in JSON Schema")},pC=(t,e,r,o)=>{Xt(t,e,r,o,"Function types cannot be represented in JSON Schema")},fC=(t,e,r,o)=>{Xt(t,e,r,o,"Transforms cannot be represented in JSON Schema")},mC=(t,e,r,o)=>{Xt(t,e,r,o,"Map cannot be represented in JSON Schema")},hC=(t,e,r,o)=>{Xt(t,e,r,o,"Set cannot be represented in JSON Schema")},gC=(t,e,r,o)=>{let n=r,i=t._zod.def,{minimum:s,maximum:a}=Yt(t);typeof s=="number"&&(n.minItems=s),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=et(i.element,e,{...o,path:[...o.path,"items"]})};function Bh(t){let e=t._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?Bh(e.out):e.type==="catch"?Bh(e.innerType):t._zod.optin}var yC=(t,e,r,o)=>{let n=r,i=t._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Xt(t,e,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in s)vr(n.properties,u,et(s[u],e,{...o,path:[...o.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];(e.io==="input"?Bh(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(n.required=c),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=et(i.catchall,e,{...o,path:[...o.path,"additionalProperties"]})):e.io==="output"&&(n.additionalProperties=!1)},DS=(t,e,r,o)=>{let n=t._zod.def,i=n.inclusive===!1,s=n.options.map((a,c)=>et(a,e,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=s:r.anyOf=s},vC=(t,e,r,o)=>{let n=t._zod.def,i=et(n.left,e,{...o,path:[...o.path,"allOf",0]}),s=et(n.right,e,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c,e.intersections.push(c)},wC=(t,e,r,o)=>{let n=r,i=t._zod.def;n.type="array";let s=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((g,y)=>et(g,e,{...o,path:[...o.path,s,y]})),u=i.rest?et(i.rest,e,{...o,path:[...o.path,a,...e.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let g=i.items[l-1];if(!(e.io==="input"?Bh(g)!==void 0:g._zod.optout==="optional"))break;l--}let d=i.items.length,f=!i.rest;e.target==="draft-2020-12"?(n.prefixItems=c,f?n.items=!1:u&&(n.items=u),l>0&&(n.minItems=l),f&&(n.maxItems=d)):e.target==="openapi-3.0"?(n.items={anyOf:c},u&&n.items.anyOf.push(u),l>0&&(n.minItems=l),f&&(n.maxItems=d)):(n.items=c,f?n.additionalItems=!1:u&&(n.additionalItems=u),l>0&&(n.minItems=l),f&&(n.maxItems=d));let{minimum:p,maximum:m}=Yt(t);typeof p=="number"&&(n.minItems=p),typeof m=="number"&&(n.maxItems=m)};function KR(t,e,r){if(e.$ref){if(r.has(e))return e;r.add(e);let m=t.get(e)?.def;if(!m)return e;let g=KR(t,m,r);return g===m?e:g}for(let m of["anyOf","oneOf"]){let g=e[m];if(!Array.isArray(g))continue;let y=g.map(w=>KR(t,w,r));y.some((w,b)=>w!==g[b])&&(e={...e,[m]:y})}let o=Array.isArray(e.type)?e.type:[e.type],n=!o.includes("string")&&o.some(m=>m==="number"||m==="integer"),i=e.enum??(e.const!==void 0?[e.const]:void 0);if(!n&&!i?.some(m=>typeof m=="number"))return e;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:f,...p}=e;return p.enum?p.enum=p.enum.map(m=>typeof m=="number"?String(m):m):typeof p.const=="number"&&(p.const=String(p.const)),n&&(p.type="string",i||(p.pattern=(o.includes("number")?ta:th).source)),p}var qR=new WeakMap;function vme(t){let e=new Map;for(let o of t.seen.values())o.def&&!e.has(o.schema)&&e.set(o.schema,o);let r=new Map;for(let o of qR.get(t)??[]){let n=t.seen.get(o),i=(n?.def??n?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=KR(e,i,new Set);s!==i&&r.set(i,s)}if(r.size)for(let o of t.seen.values())for(let n of[o.schema,o.def]){let i=n&&r.get(n.propertyNames);i&&(n.propertyNames=i)}}var bC=(t,e,r,o)=>{let n=r,i=t._zod.def;n.type="object";let s=i.keyType,a=Yt(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=et(i.valueType,e,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of a)vr(n.patternProperties,JV(d).source,l)}else{if(e.target==="draft-07"||e.target==="draft-2020-12"){n.propertyNames=et(i.keyType,e,{...o,path:[...o.path,"propertyNames"]});let l=qR.get(e);l||(l=[],qR.set(e,l),e.deferred.push(()=>vme(e))),l.push(t)}n.additionalProperties=et(i.valueType,e,{...o,path:[...o.path,"additionalProperties"]})}let c=s._zod.values,u=e.io==="input"&&Bh(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l.map(String))}},_C=(t,e,r,o)=>{let n=t._zod.def,i=et(n.innerType,e,o),s=e.seen.get(t);e.target==="openapi-3.0"?(s.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},SC=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType},xC=Symbol();function GV(t,e,r,o,n){let i=!1,s=JSON.stringify(t,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(Xt(e,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),xC):JSON.parse(s)}var EC=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType;let s=GV(n.defaultValue,t,e,r,o);s!==xC&&(r.default=s)},kC=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);if(i.ref=n.innerType,e.io!=="input")return;let s=GV(n.defaultValue,t,e,r,o);s!==xC&&(r._prefault=s)},IC=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{Xt(t,e,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},$C=(t,e,r,o)=>{let n=t._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=e.io==="input"?i?n.out:n.in:n.out;et(s,e,o);let a=e.seen.get(t);a.ref=s},AC=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType,r.readOnly=!0},TC=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType},zS=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType},PC=(t,e,r,o)=>{let n=t._zod.innerType;et(n,e,o);let i=e.seen.get(t);i.ref=n},NS={string:ZR,number:WR,boolean:JR,bigint:GR,symbol:XR,null:YR,undefined:QR,void:eC,never:tC,any:rC,unknown:nC,date:oC,enum:iC,literal:sC,nan:aC,template_literal:cC,file:uC,success:lC,custom:dC,function:pC,transform:fC,map:mC,set:hC,array:gC,object:yC,union:DS,intersection:vC,tuple:wC,record:bC,nullable:_C,nonoptional:SC,default:EC,prefault:kC,catch:IC,pipe:$C,readonly:AC,promise:TC,optional:zS,lazy:PC};function Lu(t,e){if("_idmap"in t){let o=t,n=Za({...e,processors:NS}),i={};for(let c of o._idmap.entries()){let[u,l]=c;et(l,n)}let s={},a={registry:o,uri:e?.uri,defs:i};n.external=a;for(let c of o._idmap.entries()){let[u,l]=c;Wa(n,l),vr(s,u,Ja(n,l))}if(Object.keys(i).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let r=Za({...e,processors:NS});return et(t,r),Wa(r,t),Ja(r,t)}var jS=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let r=e?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Za({processors:NS,target:r,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,r={path:[],schemaPath:[]}){return et(e,this.ctx,r)}emit(e,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Wa(this.ctx,e);let o=Ja(this.ctx,e),{"~standard":n,...i}=o;return i}};var XV={};var Qd={};yt(Qd,{ZodAny:()=>JC,ZodArray:()=>QC,ZodBase64:()=>rx,ZodBase64URL:()=>nx,ZodBigInt:()=>Xd,ZodBigIntFormat:()=>sx,ZodBoolean:()=>Gd,ZodCIDRv4:()=>ex,ZodCIDRv6:()=>tx,ZodCUID:()=>ZS,ZodCUID2:()=>WS,ZodCatch:()=>vO,ZodCodec:()=>Qh,ZodCreditCard:()=>BC,ZodCustom:()=>eg,ZodCustomStringFormat:()=>Vu,ZodDate:()=>Wh,ZodDefault:()=>pO,ZodDiscriminatedUnion:()=>tO,ZodE164:()=>ox,ZodEmail:()=>HS,ZodEmoji:()=>KS,ZodEnum:()=>Zd,ZodExactOptional:()=>ux,ZodFile:()=>cO,ZodFunction:()=>AO,ZodGUID:()=>BS,ZodIBAN:()=>KC,ZodIPv4:()=>YS,ZodIPv6:()=>QS,ZodISODate:()=>Xa,ZodISODateTime:()=>Ga,ZodISODuration:()=>Qa,ZodISOTime:()=>Ya,ZodInstanceOf:()=>RO,ZodIntersection:()=>rO,ZodJWT:()=>ix,ZodKSUID:()=>XS,ZodLazy:()=>kO,ZodLiteral:()=>aO,ZodMAC:()=>HC,ZodMap:()=>iO,ZodNaN:()=>bO,ZodNanoID:()=>qS,ZodNever:()=>XC,ZodNonOptional:()=>lx,ZodNull:()=>WC,ZodNullable:()=>dO,ZodNumber:()=>Jd,ZodNumberFormat:()=>Hu,ZodObject:()=>Jh,ZodOptional:()=>Bu,ZodPipe:()=>Yh,ZodPrefault:()=>mO,ZodPreprocess:()=>_O,ZodPromise:()=>$O,ZodReadonly:()=>SO,ZodRecord:()=>qd,ZodSet:()=>sO,ZodString:()=>Wd,ZodStringFormat:()=>it,ZodSuccess:()=>yO,ZodSymbol:()=>qC,ZodTemplateLiteral:()=>EO,ZodTransform:()=>uO,ZodTuple:()=>nO,ZodType:()=>ge,ZodULID:()=>JS,ZodURL:()=>qh,ZodUUID:()=>Xi,ZodUndefined:()=>ZC,ZodUnion:()=>Gh,ZodUnknown:()=>GC,ZodVoid:()=>YC,ZodXID:()=>GS,ZodXor:()=>eO,_ZodString:()=>VS,_default:()=>fO,_function:()=>iB,any:()=>LH,array:()=>Ae,base64:()=>bH,base64url:()=>_H,bigint:()=>DH,boolean:()=>Vt,catch:()=>wO,check:()=>sB,cidrv4:()=>vH,cidrv6:()=>wH,codec:()=>tB,creditCard:()=>xH,cuid:()=>lH,cuid2:()=>dH,currencyCode:()=>TH,custom:()=>dx,date:()=>VH,describe:()=>aB,discriminatedUnion:()=>Xh,e164:()=>SH,email:()=>eH,emoji:()=>cH,enum:()=>_r,exactOptional:()=>lO,file:()=>XH,float32:()=>RH,float64:()=>CH,function:()=>iB,guid:()=>tH,hash:()=>PH,hex:()=>AH,hostname:()=>$H,httpUrl:()=>aH,iban:()=>EH,instanceof:()=>uB,int:()=>LS,int32:()=>OH,int64:()=>zH,intersection:()=>Yd,invertCodec:()=>rB,ipv4:()=>hH,ipv6:()=>yH,json:()=>dB,jwt:()=>kH,keyof:()=>HH,ksuid:()=>mH,lazy:()=>IO,literal:()=>G,looseObject:()=>br,looseRecord:()=>ZH,mac:()=>gH,map:()=>WH,meta:()=>cB,nan:()=>eB,nanoid:()=>uH,nativeEnum:()=>GH,never:()=>ax,nonoptional:()=>gO,null:()=>Zh,nullable:()=>Kh,nullish:()=>YH,number:()=>Ze,object:()=>H,optional:()=>ot,partialRecord:()=>qH,pipe:()=>FS,prefault:()=>hO,preprocess:()=>tg,promise:()=>oB,readonly:()=>xO,record:()=>st,refine:()=>TO,set:()=>JH,strictObject:()=>BH,string:()=>I,stringFormat:()=>IH,stringbool:()=>lB,success:()=>QH,superRefine:()=>PO,symbol:()=>MH,templateLiteral:()=>nB,transform:()=>cx,tuple:()=>oO,uint32:()=>NH,uint64:()=>jH,ulid:()=>pH,undefined:()=>UH,union:()=>tt,unknown:()=>ut,url:()=>sH,uuid:()=>rH,uuidv4:()=>nH,uuidv6:()=>oH,uuidv7:()=>iH,void:()=>FH,xid:()=>fH,xor:()=>KH});var MS={};yt(MS,{endsWith:()=>Dd,gt:()=>Ji,gte:()=>Kn,includes:()=>Od,length:()=>Uu,lowercase:()=>Rd,lt:()=>Wi,lte:()=>Bn,maxLength:()=>Mu,maxSize:()=>Ka,mime:()=>jd,minLength:()=>ra,minSize:()=>Gi,multipleOf:()=>Ba,negative:()=>xS,nonnegative:()=>kS,nonpositive:()=>ES,normalize:()=>Md,overwrite:()=>Qo,positive:()=>SS,properties:()=>zd,property:()=>IS,regex:()=>Pd,size:()=>ju,slugify:()=>Vd,startsWith:()=>Nd,toLowerCase:()=>Ld,toUpperCase:()=>Fd,trim:()=>Ud,uppercase:()=>Cd});var YV=new WeakSet([Object.prototype,Error.prototype]);function US(t,e,r){Object.defineProperty(t,e,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,e,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,e,{value:o,configurable:!0,writable:!0})}})}var QV=(t,e)=>{uP.init(t,e),t.name="ZodError";let r=Object.getPrototypeOf(t);YV.has(r)||(YV.add(r),US(r,"format",o=>n=>Qm(o,n)),US(r,"flatten",o=>n=>Ym(o,n)),US(r,"addIssue",o=>n=>{o.issues.push(n),o.message=JSON.stringify(o.issues,id,2)}),US(r,"addIssues",o=>n=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,id,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},bme=S("ZodError",QV),An=S("ZodError",QV,void 0,{Parent:Error});var RC=dd(An),CC=pd(An),OC=fd(An),NC=hd(An),DC=ab(An),zC=cb(An),jC=ub(An),MC=lb(An),UC=db(An),LC=pb(An),FC=fb(An),VC=mb(An);function Sme(){cr.localeError||zt(K_())}function Fu(){cr.memoizer||zt({memoizer:gh()})}var ge=S("ZodType",(t,e)=>(Sme(),ae.init(t,e),t.def=e,t.type=e.type,t),{check(...t){let e=this.def;return this.clone(A.mergeDefs(e,{checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,e){return qe(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},refine(t,e){return this.check(TO(t,e))},superRefine(t,e){return this.check(PO(t,e))},overwrite(t){return this.check(Qo(t))},optional(){return ot(this)},exactOptional(){return lO(this)},nullable(){return Kh(this)},nullish(){return ot(Kh(this))},nonoptional(t){return gO(this,t)},array(){return Ae(this)},or(t){return tt([this,t])},and(t){return Yd(this,t)},transform(t){return FS(this,cx(t))},default(t){return fO(this,t)},prefault(t){return hO(this,t)},catch(t){return wO(this,t)},pipe(t){return FS(this,t)},readonly(){return xO(this)},describe(t){let e=this.clone();return wr.add(e,{description:t}),e},meta(...t){if(t.length===0)return wr.get(this);let e=this.clone();return wr.add(e,t[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...e){return e.length===0?t(this):t(this,...e)},get"~standard"(){return A.hide(this,"~standard",{...kb(this),jsonSchema:{input:Hd(this,"input"),output:Hd(this,"output")}})},set"~standard"(t){A.own(this,"~standard",t)},parse:function t(e,r){return RC(this,e,r,{callee:t})},parseAsync:async function t(e,r){return await CC(this,e,r,{callee:t})},safeParse(t,e){return OC(this,t,e)},async safeParseAsync(t,e){return NC(this,t,e)},get spa(){return this?.safeParseAsync},set spa(t){A.own(this,"spa",t)},validate(t,e){return yd(this,t,e)},validateAsync(t,e){return vd(this,t,e)},encode:function t(e,r){return DC(this,e,r,{callee:t})},decode:function t(e,r){return zC(this,e,r,{callee:t})},encodeAsync:async function t(e,r){return await jC(this,e,r,{callee:t})},decodeAsync:async function t(e,r){return await MC(this,e,r,{callee:t})},safeEncode(t,e){return UC(this,t,e)},safeDecode(t,e){return LC(this,t,e)},async safeEncodeAsync(t,e){return FC(this,t,e)},async safeDecodeAsync(t,e){return VC(this,t,e)},toJSONSchema(t){return BR(this,{})(t)},get description(){return wr.get(this)?.description},get _def(){return this._zod.def}}),VS=S("_ZodString",(t,e)=>{Va.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ZR(t,r,o,n)},A.derived({format:t=>Yt(t).format??null,minLength:t=>Yt(t).minimum??null,maxLength:t=>Yt(t).maximum??null},{regex(...t){return this.check(Pd(...t))},includes(...t){return this.check(Od(...t))},startsWith(...t){return this.check(Nd(...t))},endsWith(...t){return this.check(Dd(...t))},min(...t){return this.check(ra(...t))},max(...t){return this.check(Mu(...t))},length(...t){return this.check(Uu(...t))},nonempty(...t){return this.check(ra(1,...t))},lowercase(t){return this.check(Rd(t))},uppercase(t){return this.check(Cd(t))},trim(){return this.check(Ud())},normalize(...t){return this.check(Md(...t))},toLowerCase(){return this.check(Ld())},toUpperCase(){return this.check(Fd())},slugify(){return this.check(Vd())}})),Wd=S("ZodString",(t,e)=>{Va.init(t,e),VS.init(t,e)},{email(t){return this.check(vh(HS,t))},url(t){return this.check(Td(qh,t))},jwt(t){return this.check(Mh(ix,t))},emoji(t){return this.check(Eh(KS,t))},guid(t){return this.check(wh(BS,t))},uuid(t){return this.check(bh(Xi,t))},uuidv4(t){return this.check(_h(Xi,t))},uuidv6(t){return this.check(Sh(Xi,t))},uuidv7(t){return this.check(xh(Xi,t))},nanoid(t){return this.check(kh(qS,t))},cuid(t){return this.check(Ih(ZS,t))},cuid2(t){return this.check($h(WS,t))},ulid(t){return this.check(Ah(JS,t))},base64(t){return this.check(Dh(rx,t))},base64url(t){return this.check(zh(nx,t))},xid(t){return this.check(Th(GS,t))},ksuid(t){return this.check(Ph(XS,t))},ipv4(t){return this.check(Rh(YS,t))},ipv6(t){return this.check(Ch(QS,t))},cidrv4(t){return this.check(Oh(ex,t))},cidrv6(t){return this.check(Nh(tx,t))},e164(t){return this.check(jh(ox,t))},datetime(t){return this.check(Uh(Ga,t))},date(t){return this.check(Lh(Xa,t))},time(t){return this.check(Fh(Ya,t))},duration(t){return this.check(Vh(Qa,t))}});function I(t){return Q_(Wd,t)}var it=S("ZodStringFormat",(t,e)=>{Je.init(t,e),VS.init(t,e)}),Ga=S("ZodISODateTime",(t,e)=>{vR.init(t,e),it.init(t,e)}),Xa=S("ZodISODate",(t,e)=>{wR.init(t,e),it.init(t,e)}),Ya=S("ZodISOTime",(t,e)=>{bR.init(t,e),it.init(t,e)}),Qa=S("ZodISODuration",(t,e)=>{_R.init(t,e),it.init(t,e)}),HS=S("ZodEmail",(t,e)=>{Ab.init(t,e),it.init(t,e)});function eH(t){return vh(HS,t)}var BS=S("ZodGUID",(t,e)=>{Ib.init(t,e),it.init(t,e)});function tH(t){return wh(BS,t)}var Xi=S("ZodUUID",(t,e)=>{$b.init(t,e),it.init(t,e)});function rH(t){return bh(Xi,t)}function nH(t){return _h(Xi,t)}function oH(t){return Sh(Xi,t)}function iH(t){return xh(Xi,t)}var qh=S("ZodURL",(t,e)=>{Cb.init(t,e),it.init(t,e)});function sH(t){return Td(qh,t)}function aH(t){return Td(qh,{protocol:eh,hostname:CP,...A.normalizeParams(t)})}var KS=S("ZodEmoji",(t,e)=>{Ob.init(t,e),it.init(t,e)});function cH(t){return Eh(KS,t)}var qS=S("ZodNanoID",(t,e)=>{Nb.init(t,e),it.init(t,e)});function uH(t){return kh(qS,t)}var ZS=S("ZodCUID",(t,e)=>{Db.init(t,e),it.init(t,e)});function lH(t){return Ih(ZS,t)}var WS=S("ZodCUID2",(t,e)=>{zb.init(t,e),it.init(t,e)});function dH(t){return $h(WS,t)}var JS=S("ZodULID",(t,e)=>{jb.init(t,e),it.init(t,e)});function pH(t){return Ah(JS,t)}var GS=S("ZodXID",(t,e)=>{Mb.init(t,e),it.init(t,e)});function fH(t){return Th(GS,t)}var XS=S("ZodKSUID",(t,e)=>{Ub.init(t,e),it.init(t,e)});function mH(t){return Ph(XS,t)}var YS=S("ZodIPv4",(t,e)=>{Lb.init(t,e),it.init(t,e)});function hH(t){return Rh(YS,t)}var HC=S("ZodMAC",(t,e)=>{Vb.init(t,e),it.init(t,e)});function gH(t){return eS(HC,t)}var QS=S("ZodIPv6",(t,e)=>{Fb.init(t,e),it.init(t,e)});function yH(t){return Ch(QS,t)}var ex=S("ZodCIDRv4",(t,e)=>{Hb.init(t,e),it.init(t,e)});function vH(t){return Oh(ex,t)}var tx=S("ZodCIDRv6",(t,e)=>{Kb.init(t,e),it.init(t,e)});function wH(t){return Nh(tx,t)}var rx=S("ZodBase64",(t,e)=>{Zb.init(t,e),it.init(t,e)});function bH(t){return Dh(rx,t)}var nx=S("ZodBase64URL",(t,e)=>{Jb.init(t,e),it.init(t,e)});function _H(t){return zh(nx,t)}var ox=S("ZodE164",(t,e)=>{Gb.init(t,e),it.init(t,e)});function SH(t){return jh(ox,t)}var BC=S("ZodCreditCard",(t,e)=>{Yb.init(t,e),it.init(t,e)});function xH(t){return tS(BC,t)}var KC=S("ZodIBAN",(t,e)=>{e_.init(t,e),it.init(t,e)});function EH(t){return rS(KC,t)}var ix=S("ZodJWT",(t,e)=>{r_.init(t,e),it.init(t,e)});function kH(t){return Mh(ix,t)}var Vu=S("ZodCustomStringFormat",(t,e)=>{n_.init(t,e),it.init(t,e)});function IH(t,e,r={}){return qa(Vu,t,e,r)}function $H(t){return qa(Vu,"hostname",RP,t)}function AH(t){return qa(Vu,"hex",qP,t)}function TH(t){return qa(Vu,"currency_code",NP,t)}function PH(t,e){let r=e?.enc??"hex",o=`${t}_${r}`,n=Hn[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return qa(Vu,o,n,e)}var Jd=S("ZodNumber",(t,e)=>{uh.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>WR(t,r,o,n),t.isFinite=!0},A.derived({minValue:t=>{let{minimum:e,exclusiveMinimum:r}=Yt(t);return Math.max(e??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:t=>{let{maximum:e,exclusiveMaximum:r}=Yt(t);return Math.min(e??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:t=>{let{isInt:e,multipleOf:r}=Yt(t);return!!e||!!r?.some(Number.isSafeInteger)},format:t=>Yt(t).format??null},{gt(t,e){return this.check(Ji(t,e))},gte(t,e){return this.check(Kn(t,e))},min(t,e){return this.check(Kn(t,e))},lt(t,e){return this.check(Wi(t,e))},lte(t,e){return this.check(Bn(t,e))},max(t,e){return this.check(Bn(t,e))},int(t){return this.check(LS(t))},safe(t){return this.check(LS(t))},positive(t){return this.check(Ji(0,t))},nonnegative(t){return this.check(Kn(0,t))},negative(t){return this.check(Wi(0,t))},nonpositive(t){return this.check(Bn(0,t))},multipleOf(t,e){return this.check(Ba(t,e))},step(t,e){return this.check(Ba(t,e))},finite(){return this}}));function Ze(t){return nS(Jd,t)}var Hu=S("ZodNumberFormat",(t,e)=>{o_.init(t,e),Jd.init(t,e)});function LS(t){return oS(Hu,t)}function RH(t){return iS(Hu,t)}function CH(t){return sS(Hu,t)}function OH(t){return aS(Hu,t)}function NH(t){return cS(Hu,t)}var Gd=S("ZodBoolean",(t,e)=>{_d.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>JR(t,r,o,n)});function Vt(t){return uS(Gd,t)}var Xd=S("ZodBigInt",(t,e)=>{lh.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>GR(t,r,o,n)},A.derived({minValue:t=>Yt(t).minimum??null,maxValue:t=>Yt(t).maximum??null,format:t=>Yt(t).format??null},{gte(t,e){return this.check(Kn(t,e))},min(t,e){return this.check(Kn(t,e))},gt(t,e){return this.check(Ji(t,e))},lt(t,e){return this.check(Wi(t,e))},lte(t,e){return this.check(Bn(t,e))},max(t,e){return this.check(Bn(t,e))},positive(t){return this.check(Ji(BigInt(0),t))},negative(t){return this.check(Wi(BigInt(0),t))},nonpositive(t){return this.check(Bn(BigInt(0),t))},nonnegative(t){return this.check(Kn(BigInt(0),t))},multipleOf(t,e){return this.check(Ba(t,e))}}));function DH(t){return lS(Xd,t)}var sx=S("ZodBigIntFormat",(t,e)=>{i_.init(t,e),Xd.init(t,e)});function zH(t){return dS(sx,t)}function jH(t){return pS(sx,t)}var qC=S("ZodSymbol",(t,e)=>{s_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>XR(t,r,o,n)});function MH(t){return fS(qC,t)}var ZC=S("ZodUndefined",(t,e)=>{a_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>QR(t,r,o,n)});function UH(t){return mS(ZC,t)}var WC=S("ZodNull",(t,e)=>{c_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>YR(t,r,o,n)});function Zh(t){return hS(WC,t)}var JC=S("ZodAny",(t,e)=>{u_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>rC(t,r,o,n)});function LH(){return gS(JC)}var GC=S("ZodUnknown",(t,e)=>{l_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>nC(t,r,o,n)});function ut(){return yS(GC)}var XC=S("ZodNever",(t,e)=>{d_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>tC(t,r,o,n)});function ax(t){return vS(XC,t)}var YC=S("ZodVoid",(t,e)=>{p_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>eC(t,r,o,n)});function FH(t){return wS(YC,t)}var Wh=S("ZodDate",(t,e)=>{f_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>oC(t,r,o,n),t.min=(r,o)=>t.check(Kn(r,o)),t.max=(r,o)=>t.check(Bn(r,o))},A.derived({minDate:t=>{let{minimum:e}=Yt(t);return e?new Date(e):null},maxDate:t=>{let{maximum:e}=Yt(t);return e?new Date(e):null}},{}));function VH(t){return bS(Wh,t)}var QC=S("ZodArray",(t,e)=>{Fu(),m_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>gC(t,r,o,n),t.element=e.element},{min(t,e){return this.check(ra(t,e))},nonempty(t){return this.check(ra(1,t))},max(t,e){return this.check(Mu(t,e))},length(t,e){return this.check(Uu(t,e))},unwrap(){return this.element}});function Ae(t,e){return VR(QC,t,e)}function HH(t){let e=t._zod.def.shape;return _r(Object.keys(e))}var Jh=S("ZodObject",(t,e)=>{Fu(),xR.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>yC(t,r,o,n),A.installLazyProp(t,"shape",r=>r._zod.def.shape,!1)},{keyof(){return _r(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(A.mergeDefs(this._zod.def,{catchall:t}))},passthrough(){return this.clone(A.mergeDefs(this._zod.def,{catchall:ut()}))},loose(){return this.clone(A.mergeDefs(this._zod.def,{catchall:ut()}))},strict(){return this.clone(A.mergeDefs(this._zod.def,{catchall:ax()}))},strip(){return this.clone(A.mergeDefs(this._zod.def,{catchall:void 0}))},extend(t){return A.extend(this,t)},safeExtend(t){return A.safeExtend(this,t)},merge(t){return A.merge(this,t)},pick(t){return A.pick(this,t)},omit(t){return A.omit(this,t)},partial(...t){return A.partial(Bu,this,t[0])},exactPartial(...t){return A.partial(ux,this,t[0],"exactPartial")},required(...t){return A.required(lx,this,t[0])}});function H(t,e){let r={type:"object",shape:t??{},...A.normalizeParams(e)};return new Jh(r)}function BH(t,e){return new Jh({type:"object",shape:t,catchall:ax(),...A.normalizeParams(e)})}function br(t,e){return new Jh({type:"object",shape:t,catchall:ut(),...A.normalizeParams(e)})}var Gh=S("ZodUnion",(t,e)=>{Sd.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>DS(t,r,o,n),t.options=e.options});function tt(t,e){return new Gh({type:"union",options:t,...A.normalizeParams(e)})}var eO=S("ZodXor",(t,e)=>{Gh.init(t,e),g_.init(t,e),t._zod.processJSONSchema=(r,o,n)=>DS(t,r,o,n),t.options=e.options});function KH(t,e){return new eO({type:"union",options:t,inclusive:!1,...A.normalizeParams(e)})}var tO=S("ZodDiscriminatedUnion",(t,e)=>{Gh.init(t,e),y_.init(t,e)});function Xh(t,e,r){return new tO({type:"union",options:e,discriminator:t,...A.normalizeParams(r)})}var rO=S("ZodIntersection",(t,e)=>{v_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>vC(t,r,o,n)});function Yd(t,e){return new rO({type:"intersection",left:t,right:e})}var nO=S("ZodTuple",(t,e)=>{Fu(),dh.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>wC(t,r,o,n)},{rest(t){return this.clone({...this._zod.def,rest:t})},partial(){let t=this._zod.def;if(t.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...t,items:t.items.map(e=>new Bu({type:"optional",innerType:e}))})}});function oO(t,e,r){let o=e instanceof ae,n=o?r:e,i=o?e:null;return new nO({type:"tuple",items:t,rest:i,...A.normalizeParams(n)})}var qd=S("ZodRecord",(t,e)=>{Fu(),w_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>bC(t,r,o,n),t.keyType=e.keyType,t.valueType=e.valueType});function st(t,e,r){return!e||!e._zod?new qd({type:"record",keyType:I(),valueType:t,...A.normalizeParams(e)}):new qd({type:"record",keyType:t,valueType:e,...A.normalizeParams(r)})}function qH(t,e,r){return new qd({type:"record",keyType:t,valueType:e,...A.normalizeParams(r),partial:!0})}function ZH(t,e,r){return new qd({type:"record",keyType:t,valueType:e,mode:"loose",...A.normalizeParams(r)})}var iO=S("ZodMap",(t,e)=>{Fu(),b_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>mC(t,r,o,n),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(Gi(...r)),t.nonempty=r=>t.check(Gi(1,r)),t.max=(...r)=>t.check(Ka(...r)),t.size=(...r)=>t.check(ju(...r))});function WH(t,e,r){return new iO({type:"map",keyType:t,valueType:e,...A.normalizeParams(r)})}var sO=S("ZodSet",(t,e)=>{Fu(),__.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>hC(t,r,o,n),t.min=(...r)=>t.check(Gi(...r)),t.nonempty=r=>t.check(Gi(1,r)),t.max=(...r)=>t.check(Ka(...r)),t.size=(...r)=>t.check(ju(...r))});function JH(t,e){return new sO({type:"set",valueType:t,...A.normalizeParams(e)})}var Zd=S("ZodEnum",(t,e)=>{S_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(o,n,i)=>iC(t,o,n,i),t.enum=e.entries,t.options=[...t._zod.values];let r=new Set(Object.keys(e.entries));t.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Zd({...e,checks:[],...A.normalizeParams(n),entries:i})},t.exclude=(o,n)=>{let i={...e.entries};for(let s of o)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Zd({...e,checks:[],...A.normalizeParams(n),entries:i})}});function _r(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new Zd({type:"enum",entries:r,...A.normalizeParams(e)})}function GH(t,e){return new Zd({type:"enum",entries:t,...A.normalizeParams(e)})}var aO=S("ZodLiteral",(t,e)=>{x_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>sC(t,r,o,n),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function G(t,e){return new aO({type:"literal",values:Array.isArray(t)?t:[t],...A.normalizeParams(e)})}var cO=S("ZodFile",(t,e)=>{E_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>uC(t,r,o,n),t.min=(r,o)=>t.check(Gi(r,o)),t.max=(r,o)=>t.check(Ka(r,o)),t.mime=(r,o)=>t.check(jd(Array.isArray(r)?r:[r],o))});function XH(t){return $S(cO,t)}var uO=S("ZodTransform",(t,e)=>{Fu(),k_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>fC(t,r,o,n),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Fa(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(A.issue(i,r.value,e));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=t),r.issues.push(A.issue(s))}};let n=e.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r)):(r.value=n,r)}});function cx(t){return new uO({type:"transform",transform:t})}var Bu=S("ZodOptional",(t,e)=>{ph.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>zS(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function ot(t){return new Bu({type:"optional",innerType:t})}var ux=S("ZodExactOptional",(t,e)=>{I_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>zS(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function lO(t){return new ux({type:"optional",innerType:t})}var dO=S("ZodNullable",(t,e)=>{$_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>_C(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Kh(t){return new dO({type:"nullable",innerType:t})}function YH(t){return ot(Kh(t))}var pO=S("ZodDefault",(t,e)=>{A_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>EC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function fO(t,e){return new pO({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():A.shallowClone(e)}})}var mO=S("ZodPrefault",(t,e)=>{T_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>kC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function hO(t,e){return new mO({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():A.shallowClone(e)}})}var lx=S("ZodNonOptional",(t,e)=>{P_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>SC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function gO(t,e){return new lx({type:"nonoptional",innerType:t,...A.normalizeParams(e)})}var yO=S("ZodSuccess",(t,e)=>{R_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>lC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function QH(t){return new yO({type:"success",innerType:t})}var vO=S("ZodCatch",(t,e)=>{C_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>IC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function wO(t,e){return new vO({type:"catch",innerType:t,catchValue:typeof e=="function"?e:A.constantCatch(e)})}var bO=S("ZodNaN",(t,e)=>{O_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>aC(t,r,o,n)});function eB(t){return _S(bO,t)}var Yh=S("ZodPipe",(t,e)=>{fh.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>$C(t,r,o,n),t.in=e.in,t.out=e.out});function FS(t,e){return new Yh({type:"pipe",in:t,out:e})}var Qh=S("ZodCodec",(t,e)=>{Yh.init(t,e),xd.init(t,e)});function tB(t,e,r){return new Qh({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}function rB(t){let e=t._zod.def;return new Qh({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}var _O=S("ZodPreprocess",(t,e)=>{Yh.init(t,e),kR.init(t,e)}),SO=S("ZodReadonly",(t,e)=>{N_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>AC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function xO(t){return new SO({type:"readonly",innerType:t})}var EO=S("ZodTemplateLiteral",(t,e)=>{D_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>cC(t,r,o,n)});function nB(t,e){return new EO({type:"template_literal",parts:t,...A.normalizeParams(e)})}var kO=S("ZodLazy",(t,e)=>{Ed.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>PC(t,r,o,n),t.unwrap=()=>t._zod.def.getter()});function IO(t){return new kO({type:"lazy",getter:t})}var $O=S("ZodPromise",(t,e)=>{j_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>TC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function oB(t){return new $O({type:"promise",innerType:t})}var AO=S("ZodFunction",(t,e)=>{z_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>pC(t,r,o,n)});function iB(t){return new AO({type:"function",input:Array.isArray(t?.input)?oO(t?.input):t?.input??Ae(ut()),output:t?.output??ut()})}var eg=S("ZodCustom",(t,e)=>{M_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>dC(t,r,o,n)});function sB(t){let e=new nt({check:"custom"});return e._zod.check=t,e}function dx(t,e){return AS(eg,t??(()=>!0),e)}function TO(t,e={}){return TS(eg,t,e)}function PO(t,e){return PS(t,e)}var aB=RS,cB=CS,RO=S("ZodInstanceOf",(t,e)=>{eg.init(t,e)},{properties(t,e){return this.check(zd(t,e))}});function uB(t,e={}){let r=new RO({type:"custom",check:"custom",fn:o=>o instanceof t,abort:!0,...A.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=o=>{o.value instanceof t||o.issues.push({code:"invalid_type",expected:t.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}var lB=(...t)=>OS({Codec:Qh,Boolean:Gd,String:Wd},...t);function dB(t){let e=IO(()=>tt([I(t),Ze(),Vt(),Zh(),Ae(e),st(I(),e)]));return e}function tg(t,e){return new _O({type:"pipe",in:cx(t),out:e})}var xme={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Eme(t){zt({customError:t})}function kme(){return zt().customError}var CO;CO||(CO={});var Ku={};yt(Ku,{ZodISODate:()=>Xa,ZodISODateTime:()=>Ga,ZodISODuration:()=>Qa,ZodISOTime:()=>Ya,date:()=>$me,datetime:()=>Ime,duration:()=>Tme,time:()=>Ame});function Ime(t){return Uh(Ga,t)}function $me(t){return Lh(Xa,t)}function Ame(t){return Fh(Ya,t)}function Tme(t){return Vh(Qa,t)}var V={...Qd,...MS,iso:Ku},Pme=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Rme(t,e){let r=t.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function pB(t,e){return t.map((r,o)=>o<e?r:r.optional())}function Cme(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function Ome(t,e){if(!t.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=t.slice(1).split("/").filter(Boolean);if(r.length===0)return e.rootSchema;let o=e.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1]===void 0?void 0:Cme(r[1]);if(!n||!e.defs[n])throw new Error(`Reference not found: ${t}`);return e.defs[n]}throw new Error(`Reference not found: ${t}`)}function Nme(t,e){return V.transform(o=>o).check(o=>{let n=o.value;if(typeof n!="object"||n===null||Array.isArray(n))return;let i=Object.getOwnPropertyNames(n);if(e.minProperties!==void 0&&i.length<e.minProperties&&o.issues.push({origin:"object",code:"too_small",minimum:e.minProperties,inclusive:!0,message:`Too small: expected object to have >=${e.minProperties} properties`,input:n,inst:t,continue:!0}),e.maxProperties!==void 0&&i.length>e.maxProperties&&o.issues.push({origin:"object",code:"too_big",maximum:e.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${e.maxProperties} properties`,input:n,inst:t,continue:!0}),e.keySchema)for(let s of i){let a=e.keySchema.safeParse(s);a.success||o.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(t)}function OO(t,e){if(t===null)return"z";let r=typeof t;if(r!=="object"){if(r==="number"&&Number.isNaN(t))return null;let o=String(t);return`${r[0]}${o.length}:${o}`}if(e.has(t))return null;e.add(t);try{if(Array.isArray(t)){let i=[];for(let s of t){let a=OO(s,e);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let o=Object.keys(t).sort(),n=[];for(let i of o){let s=OO(t[i],e);if(s===null)return null;n.push(`${i.length}:${i}=${s}`)}return`o${n.length}:{${n.join(",")}}`}finally{e.delete(t)}}var Dme=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),zme=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function rg(t){return typeof t!="object"||t===null?!1:Array.isArray(t)?t.some(rg):typeof t.$ref=="string"?!0:Object.entries(t).some(([e,r])=>Dme.has(e)?rg(r):!zme.has(e)||typeof r!="object"||r===null?!1:Object.values(r).some(rg))}function fB(t){return t===1?"element":"elements"}function jme(t,e){return V.transform(o=>o).check(o=>{let n=o.value;if(Array.isArray(n)){if(e.uniqueItems===!0){let i=new Map;for(let s=0;s<n.length;s++){let a=OO(n[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}o.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:n,path:[s],continue:!0})}}if(e.containsSchema){let i=e.minContains??1,s=e.maxContains!==void 0?e.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of n)if(e.containsSchema.safeParse(c).success&&++a>=s)break;a<i&&o.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${fB(i)}; found ${a}`,input:n,continue:!0}),e.maxContains!==void 0&&a>e.maxContains&&o.issues.push({code:"custom",message:`Array must contain at most ${e.maxContains} matching ${fB(e.maxContains)}`,input:n,continue:!0})}}}).pipe(t)}function mB(t,e){if(t!==!1)return t===void 0||t===!0?V.any():dn(t,e)}var Mme=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function hB(t,e){if(t.not!==void 0){if(typeof t.not=="object"&&Object.keys(t.not).length===0)return V.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(t.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(t.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(t.if!==void 0||t.then!==void 0||t.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(t.dependentSchemas!==void 0||t.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(t.$ref){let n=t.$ref;if(e.refs.has(n))return e.refs.get(n);if(e.processing.has(n))return V.lazy(()=>{if(!e.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return e.refs.get(n)});e.processing.add(n);let i=Ome(n,e),s=dn(i,e);return e.refs.set(n,s),e.processing.delete(n),s}if(t.enum!==void 0){let n=t.enum;if(e.version==="openapi-3.0"&&t.nullable===!0&&n.length===1&&n[0]===null)return V.null();if(n.length===0)return V.never();if(n.length===1)return V.literal(n[0]);if(n.every(s=>typeof s=="string"))return V.enum(n);let i=n.map(s=>V.literal(s));return i.length<2?i[0]:V.union([i[0],i[1],...i.slice(2)])}if(t.const!==void 0)return V.literal(t.const);let r=t.type;if(Array.isArray(r)){let n=r.map(i=>{let s={...t,type:i};return hB(s,e)});return n.length===0?V.never():n.length===1?n[0]:V.union(n)}if(!r)return V.any();let o;switch(r){case"string":{let n=V.string();if(t.format){let i=t.format;i==="email"?n=n.check(V.email()):i==="uri"||i==="uri-reference"?n=n.check(V.url()):i==="uuid"||i==="guid"?n=n.check(V.uuid()):i==="date-time"?n=n.check(V.iso.datetime({offset:!0})):i==="date"?n=n.check(V.iso.date()):i==="time"?n=n.check(V.regex(Mme)):i==="duration"?n=n.check(V.iso.duration()):i==="hostname"?n=n.check(V.hostname()):i==="ipv4"?n=n.check(V.ipv4()):i==="ipv6"?n=n.check(V.ipv6()):i==="mac"?n=n.check(V.mac()):i==="cidr"?n=n.check(V.cidrv4()):i==="cidr-v6"?n=n.check(V.cidrv6()):i==="base64"?n=n.check(V.base64()):i==="base64url"?n=n.check(V.base64url()):i==="e164"?n=n.check(V.e164()):i==="credit_card"?n=n.check(V.creditCard()):i==="iban"?n=n.check(V.iban()):i==="jwt"?n=n.check(V.jwt()):i==="emoji"?n=n.check(V.emoji()):i==="nanoid"?n=n.check(V.nanoid()):i==="cuid"?n=n.check(V.cuid()):i==="cuid2"?n=n.check(V.cuid2()):i==="ulid"?n=n.check(V.ulid()):i==="xid"?n=n.check(V.xid()):i==="ksuid"&&(n=n.check(V.ksuid()))}typeof t.minLength=="number"&&(n=n.min(t.minLength)),typeof t.maxLength=="number"&&(n=n.max(t.maxLength)),t.pattern&&(n=n.regex(new RegExp(t.pattern))),o=n;break}case"number":case"integer":{let n=r==="integer"?V.number().int():V.number();typeof t.minimum=="number"&&t.exclusiveMinimum!==!0&&(n=n.min(t.minimum)),typeof t.maximum=="number"&&t.exclusiveMaximum!==!0&&(n=n.max(t.maximum)),typeof t.exclusiveMinimum=="number"?n=n.gt(t.exclusiveMinimum):t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(n=n.gt(t.minimum)),typeof t.exclusiveMaximum=="number"?n=n.lt(t.exclusiveMaximum):t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(n=n.lt(t.maximum)),typeof t.multipleOf=="number"&&(n=n.multipleOf(t.multipleOf)),o=n;break}case"boolean":{o=V.boolean();break}case"null":{o=V.null();break}case"object":{let n={},i=t.properties||{},s=new Set(t.required||[]),a=typeof t.additionalProperties=="object"?dn(t.additionalProperties,e):void 0;for(let[d,f]of Object.entries(i)){let p=dn(f,e);vr(n,d,s.has(d)?p:p.optional())}if(t.patternProperties){let d=t.patternProperties,f=Object.keys(d),p=[];for(let g of f){let y=dn(d[g],e),w=V.string().regex(new RegExp(g));p.push(V.looseRecord(w,y))}let m=[];if(Object.keys(n).length>0&&m.push(V.object(n).passthrough()),m.push(...p),m.length===0)o=V.object({}).passthrough();else if(m.length===1)o=m[0];else{let g=V.intersection(m[0],m[1]);for(let y=2;y<m.length;y++)g=V.intersection(g,m[y]);o=g}if(t.additionalProperties===!1){let g=Object.keys(n),y=f.map(b=>new RegExp(b)),w=o;o=o.check(b=>{if(!mo(b.value))return;let _=[];for(let k of Object.keys(b.value))g.includes(k)||y.some($=>$.test(k))||_.push(k);_.length&&b.issues.push({code:"unrecognized_keys",keys:_,input:b.value,inst:w})})}}else{let d=V.object(n);t.additionalProperties===!1?o=d.strict():a?o=d.catchall(a):o=d.passthrough()}let c=t.propertyNames!==void 0&&t.propertyNames!==!0,u=typeof t.minProperties=="number"?t.minProperties:void 0,l=typeof t.maxProperties=="number"?t.maxProperties:void 0;if(c||u!==void 0||l!==void 0){let d;if(c){let f=typeof t.propertyNames=="object"&&t.propertyNames.type===void 0?{type:"string",...t.propertyNames}:t.propertyNames;d=dn(f,e)}o=Nme(o,{keySchema:d,minProperties:u,maxProperties:l})}break}case"array":{let n=t.prefixItems,i=t.items;if(n&&Array.isArray(n)){let s=typeof t.minItems=="number"?t.minItems:0,a=n.map(d=>dn(d,e)),c=pB(a,s),u=Array.isArray(i)?void 0:mB(i,e),l=V.tuple(c);o=u?l.rest(u):l,typeof t.minItems=="number"&&(o=o.check(V.minLength(t.minItems))),typeof t.maxItems=="number"&&(o=o.check(V.maxLength(t.maxItems)))}else if(Array.isArray(i)){let s=typeof t.minItems=="number"?t.minItems:0,a=i.map(d=>dn(d,e)),c=pB(a,s),u=mB(t.additionalItems,e),l=V.tuple(c);o=u?l.rest(u):l,typeof t.minItems=="number"&&(o=o.check(V.minLength(t.minItems))),typeof t.maxItems=="number"&&(o=o.check(V.maxLength(t.maxItems)))}else if(i!==void 0){let s=dn(i,e),a=V.array(s);typeof t.minItems=="number"&&(a=a.min(t.minItems)),typeof t.maxItems=="number"&&(a=a.max(t.maxItems)),o=a}else o=V.array(V.any());(t.uniqueItems===!0||t.contains!==void 0)&&(o=jme(o,{uniqueItems:t.uniqueItems===!0,containsSchema:t.contains!==void 0?dn(t.contains,e):void 0,minContains:typeof t.minContains=="number"?t.minContains:void 0,maxContains:typeof t.maxContains=="number"?t.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return o}function dn(t,e){if(typeof t=="boolean")return t?V.any():V.never();let r=hB(t,e),o=t.type||t.enum!==void 0||t.const!==void 0;if(t.anyOf&&Array.isArray(t.anyOf)){let a=t.anyOf.map(u=>dn(u,e)),c=V.union(a);r=o?V.intersection(r,c):c}if(t.oneOf&&Array.isArray(t.oneOf)){let a=t.oneOf.map(u=>dn(u,e)),c=V.xor(a);r=o?V.intersection(r,c):c}if(t.allOf&&Array.isArray(t.allOf))if(t.allOf.length===0)r=o?r:V.any();else{let a=o?r:dn(t.allOf[0],e),c=o?0:1;for(let u=c;u<t.allOf.length;u++)a=V.intersection(a,dn(t.allOf[u],e));r=a}t.nullable===!0&&e.version==="openapi-3.0"&&(r=V.nullable(r)),t.readOnly===!0&&(r=V.readonly(r)),t.default!==void 0&&(r=r.default(t.default));let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in t&&(n[a]=t[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in t&&(n[a]=t[a]);if(t.type==="object"&&t.$ref===void 0){t.propertyNames!==void 0&&!rg(t.propertyNames)&&(n.propertyNames=t.propertyNames);for(let a of["minProperties","maxProperties"])t[a]!==void 0&&(n[a]=t[a])}if(t.type==="array"&&t.$ref===void 0){t.contains!==void 0&&!rg(t.contains)&&(n.contains=t.contains);for(let a of["uniqueItems","minContains","maxContains"])t[a]!==void 0&&(n[a]=t[a])}for(let a of Object.keys(t))Pme.has(a)||vr(n,a,t[a]);return Object.keys(n).length>0&&e.registry.add(r,n),t.description&&(r=r.describe(t.description)),r}function gB(t,e){if(typeof t=="boolean")return t?V.any():V.never();let r;try{r=JSON.parse(JSON.stringify(t))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=Rme(r,e?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:e?.registry??wr};return dn(r,i)}var yB=Symbol("z.visit/resolving");function ng(t,e){let r=typeof e=="function"?e:(s,a)=>{let c=e[s._zod.def.type];return c?c(s,a):s},o=new Map;function n(s){let a=o.get(s);if(a===yB)return new Ed({type:"lazy",getter:()=>o.get(s)});if(a!==void 0)return a;o.set(s,yB);let c=i(s),u=r(c,c!==s);return o.set(s,u),u}function i(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let u=a.shape,l=Object.keys(u),d=!1,f={};for(let m of l){let g=n(u[m]);g!==u[m]&&(d=!0),f[m]=g}let p=a.catchall;return a.catchall&&(p=n(a.catchall),p!==a.catchall&&(d=!0)),d?qe(s,{...a,shape:f,catchall:p}):s}case"array":{let u=n(a.element);return u===a.element?s:qe(s,{...a,element:u})}case"tuple":{let u=a.items,l=!1,d=[];for(let p of u){let m=n(p);m!==p&&(l=!0),d.push(m)}let f=a.rest;return a.rest&&(f=n(a.rest),f!==a.rest&&(l=!0)),l?qe(s,{...a,items:d,rest:f}):s}case"record":case"map":{let u=n(a.keyType),l=n(a.valueType);return u===a.keyType&&l===a.valueType?s:qe(s,{...a,keyType:u,valueType:l})}case"set":{let u=n(a.valueType);return u===a.valueType?s:qe(s,{...a,valueType:u})}case"union":{let u=a.options,l=!1,d=[];for(let f of u){let p=n(f);p!==f&&(l=!0),d.push(p)}return l?qe(s,{...a,options:d}):s}case"intersection":{let u=n(a.left),l=n(a.right);return u===a.left&&l===a.right?s:qe(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=n(a.innerType);return u===a.innerType?s:qe(s,{...a,innerType:u})}case"pipe":{let u=n(a.in),l=n(a.out);return u===a.in&&l===a.out?s:qe(s,{...a,in:u,out:l})}case"function":{let u=n(a.input),l=n(a.output);return u===a.input&&l===a.output?s:qe(s,{...a,input:u,output:l})}case"lazy":{let u=a.getter,{_cachedInner:l,...d}=a;return qe(s,{...d,getter:()=>n(u())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return s;default:return s}}return n(t)}function vB(t){return ng(t,{object:e=>e.partial(),union:e=>{let r=e._zod.def;return r.discriminator===void 0?e:tt(r.options)}})}function Ume(t,e){if(!e?.length)return t;let r=t._zod.def;return qe(t,fo(r,{checks:[...r.checks??[],...e]}),{parent:!0})}function wB(t){return Ume(t.out,t.checks)}function Lme(t){return t.in._zod.traits.has("$ZodTransform")?wB(t):t.in}function bB(t){return ng(t,{pipe:e=>Lme(e._zod.def),default:(e,r)=>r?ot(e._zod.def.innerType):e,catch:(e,r)=>r?e._zod.def.innerType:e})}function _B(t){return ng(t,{pipe:e=>wB(e._zod.def),prefault:(e,r)=>r?e._zod.def.innerType:e})}var NO={};yt(NO,{bigint:()=>Bme,boolean:()=>Hme,date:()=>Kme,number:()=>Vme,string:()=>Fme});function Fme(t){return zR(Wd,t)}function Vme(t){return MR(Jd,t)}function Hme(t){return UR(Gd,t)}function Bme(t){return LR(Xd,t)}function Kme(t){return FR(Wh,t)}var og={name:"@tomato414941/foundation",version:"29.0.3",description:"Manage Foundation resources and use them in local commands.",type:"module",engines:{node:">=24"},bin:{foundation:"dist/cli.mjs"},files:["dist/cli.mjs"],repository:{type:"git",url:"git+https://github.com/tomato414941/foundation.git",directory:"cli"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},license:"MIT"};typeof window<"u"&&h.config({jitless:!0});function SB(t){let e=/^(ssh-ed25519|ssh-rsa|ecdsa-sha2-nistp(?:256|384|521))[ \t]+([A-Za-z0-9+/]+={0,2})(?:[ \t]+[^\r\n\0]*)?$/.exec(t.trim());if(!e)return null;try{let r=Uint8Array.from(atob(e[2]),a=>a.charCodeAt(0)),o=new DataView(r.buffer),n=0,i=()=>{if(n+4>r.length)throw new Error("Invalid SSH key.");let a=o.getUint32(n);if(n+=4,n+a>r.length)throw new Error("Invalid SSH key.");let c=r.subarray(n,n+a);return n+=a,c},s=a=>new TextDecoder().decode(a);if(s(i())!==e[1])return null;if(e[1]==="ssh-ed25519"){if(i().length!==32)return null}else if(e[1]==="ssh-rsa"){let a=i(),c=i();if(!a.length||c.length<256||c.length>1025)return null}else{let a=s(i()),c=i(),u={nistp256:65,nistp384:97,nistp521:133};if(e[1]!=="ecdsa-sha2-"+a||c[0]!==4||c.length!==u[a])return null}return n===r.length?r:null}catch{return null}}var ig=h.string().trim().max(8192).refine(t=>SB(t)!==null,"Use an OpenSSH public key from a .pub file.");function DO(t){if(!SB(t))throw new Error("Use an OpenSSH public key from a .pub file.");let[e,r]=t.trim().split(/[ \t]+/);return{algorithm:e,key:r,publicKey:e+" "+r}}var ep=h.string().max(32).regex(/^[a-z_][a-z0-9_-]*$/,"Use a lowercase account name."),px=h.string().min(1).max(253).regex(/^[A-Za-z0-9_.:]+(?:-[A-Za-z0-9_.:]+)*$/,"Use a host name or IP address."),fx=h.string().min(1).max(1024).regex(/^[A-Za-z0-9._/%-]+$/).refine(t=>!t.split("/").includes("..")&&!/%(?!u)/.test(t)&&!t.endsWith("/"),"Use a file path, with %u for the account."),yFe=h.string().min(1).max(500).regex(/^[A-Za-z0-9.:*?/!_-]+(?:,[A-Za-z0-9.:*?/!_-]+)*$/,"Use comma-separated host or address patterns."),mx=h.string().regex(/^SHA256:[A-Za-z0-9+/]{43}$/);var tp=new TextEncoder,rp=new TextDecoder,xB=new TextDecoder("utf-8",{fatal:!0}),hx=2**32;function pn(...t){let e=t.reduce((n,{length:i})=>n+i,0),r=new Uint8Array(e),o=0;for(let n of t)r.set(n,o),o+=n.length;return r}function zO(t,e,r){if(e<0||e>=hx)throw new RangeError(`value must be >= 0 and <= ${hx-1}. Received ${e}`);t.set([e>>>24,e>>>16,e>>>8,e&255],r)}function jO(t){let e=Math.floor(t/hx),r=t%hx,o=new Uint8Array(8);return zO(o,e,0),zO(o,r,4),o}function gx(t){let e=new Uint8Array(4);return zO(e,t),e}var Zme=/[^\x00-\x7f]/;function Sr(t){if(typeof t=="string"&&t.length>=128){if(Zme.test(t))throw new TypeError("non-ASCII string encountered in encode()");return tp.encode(t)}let e=new Uint8Array(t.length);for(let r=0;r<t.length;r++){let o=t.charCodeAt(r);if(o>127)throw new TypeError("non-ASCII string encountered in encode()");e[r]=o}return e}function EB(t,e=!1){if(Uint8Array.prototype.toBase64)return t.toBase64({alphabet:e?"base64url":"base64",omitPadding:e});let r=32768,o=[];for(let i=0;i<t.length;i+=r)o.push(String.fromCharCode.apply(null,t.subarray(i,i+r)));let n=btoa(o.join(""));return e?n.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"):n}function kB(t,e=!1){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(t,{alphabet:e?"base64url":"base64"});if(e){if(t.includes("+")||t.includes("/"))throw new TypeError("Invalid base64url");t=t.replace(/-/g,"+").replace(/_/g,"/")}let r=atob(t),o=new Uint8Array(r.length);for(let n=0;n<r.length;n++)o[n]=r.charCodeAt(n);return o}async function yx(t,e){let r=`SHA-${t.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(r,e))}var na=class extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,r){super(e,r),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};var qu=class extends na{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"},at=class extends na{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"},ec=class extends na{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(e="decryption operation failed",r){super(e,r)}},U=class extends na{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"},xt=class extends na{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"};var sg=class extends na{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"};var vx=class extends na{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",r){super(e,r)}};var Wme="The input to be decoded is not correctly encoded.";function Zu(t){try{return kB(typeof t=="string"?t:rp.decode(t),!0)}catch(e){throw new TypeError(Wme,{cause:e})}}function Rt(t){return EB(typeof t=="string"?tp.encode(t):t,!0)}function qn(t,e){if(!(t instanceof Uint8Array))throw new TypeError(`${e} must be an instance of Uint8Array`)}function Kt(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||Object.getPrototypeOf(e)===null}function tc(...t){let e=new Set;for(let r of t)if(r)for(let o of Object.keys(r)){if(e.has(o))return!1;e.add(o)}return!0}function go(t,e){if(t!==void 0)throw new TypeError(`${e} can only be called once`)}function Tn(t,e,r){try{return Zu(t)}catch{throw new r(`Failed to base64url decode the ${e}`)}}function wx(t,e,r){try{return Sr(t)}catch{throw new r(`The ${e} is not a valid base64url string`)}}function np(t,e,r){let o;try{o=JSON.parse(xB.decode(Zu(t)))}catch{throw new e(r)}if(!Kt(o))throw new e(r);return o}var bx={__proto__:null,b64:!0},_x={__proto__:null};function ag(t,e){if(e!==void 0&&(!Array.isArray(e)||e.some(r=>typeof r!="string")))throw new TypeError(`"${t}" option must be an array of strings`);return e===void 0?void 0:new Set(e)}function Sx(t,e){let{crit:r}=e??{};if(Array.isArray(r)&&new Set(r).size!==r.length)throw new t('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}function rc(t,e,r,o,n){if(n.crit!==void 0&&o?.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||o.crit===void 0)return[];if(!Array.isArray(o.crit)||o.crit.length===0||o.crit.some(s=>typeof s!="string"||s.length===0))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i=r===void 0?e:{__proto__:null,...r,...e};for(let s of o.crit){if(!(s in i))throw new at(`Extension Header Parameter "${s}" is not recognized`);if(!Object.hasOwn(n,s)||n[s]===void 0)throw new t(`Extension Header Parameter "${s}" is missing`);if(i[s]&&(!Object.hasOwn(o,s)||o[s]===void 0))throw new t(`Extension Header Parameter "${s}" MUST be integrity protected`)}return o.crit}function xx(t,e){if(e.includes("b64")){let r=t.b64;if(typeof r!="boolean")throw new xt('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return r}return!0}function Wu(t,e){let r,o;try{r=JSON.stringify(e),o=JSON.parse(r)}catch(n){throw new t("JOSE Header is not valid JSON",{cause:n})}if(!Kt(o))throw new t("JOSE Header is not a JSON object");return[o,r]}var Jme=t=>t[Symbol.toStringTag],Gme=(t,e,r)=>{let{alg:o}=t;if(e.use!==void 0){let n=r==="sign"||r==="verify"?"sig":"enc";if(e.use!==n)throw new TypeError(`Invalid key for this operation, its "use" must be "${n}" when present`)}if(e.alg!==void 0&&e.alg!==o)throw new TypeError(`Invalid key for this operation, its "alg" must be "${o}" when present`);if(Array.isArray(e.key_ops)){let n=r==="encrypt"||r==="decrypt"?t.ops?.[r==="encrypt"?0:1]:r;if(n&&!e.key_ops.includes(n))throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${n}" when present`)}};async function ti(t,e,r){let{alg:o,secret:n}=t,i=r==="decrypt"||r==="sign";if(n&&e instanceof Uint8Array)return e;let s,a;if(Kt(e)){if(s=HO(e),typeof s.kty!="string")throw IB(o,e,n);if(!(n?s.kty==="oct"&&typeof s.k=="string":s.kty!=="oct"&&(i?s.kty==="AKP"&&typeof s.priv=="string"||typeof s.d=="string":s.d===void 0&&s.priv===void 0)))throw new TypeError(n?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${i?"private":"public"} JWK`);if(Gme(t,s,r),s.kty==="oct")return Zu(s.k);if(!Object.isFrozen(e)){let{key_ops:l}=e;Array.isArray(l)&&Object.freeze(l),Object.freeze(e)}}else{if(!LO(e))throw IB(o,e,n);let l=n?"secret":i?"private":"public";if(e.type!==l&&(n||["secret","public","private"].includes(e.type)))throw new TypeError(`${Jme(e)} instances must be of type "${l}" for the ${o} algorithm`);if(nc(e))return e;if(a=e,a.type==="secret")return a.export()}MO||=new WeakMap;let c=e,u=MO.get(c);if(u?.[o])return u[o];if(u||MO.set(c,u={}),a&&typeof a.toCryptoKey=="function"){let l=a.type==="public",d=Xme[a.asymmetricKeyDetails?.namedCurve],f=t.resolve?.({crv:d,asymmetricKeyType:a.asymmetricKeyType})??t.subtle;return u[o]=a.toCryptoKey(f,l,t.usages[l?0:1])}return s??=a.export({format:"jwk"}),s.alg=o,u[o]=await ip(t,s)}var MO,Xme={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function kx(t){if(!nc(t))throw new Error("CryptoKey instance expected")}var nc=t=>{if(t?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return t instanceof CryptoKey}catch{return!1}},UO=t=>t?.[Symbol.toStringTag]==="KeyObject",LO=t=>nc(t)||UO(t);function $B(t,e,...r){if(r.length>2){let o=r.pop();t+=`one of type ${r.join(", ")}, or ${o}.`}else r.length===2?t+=`one of type ${r[0]} or ${r[1]}.`:t+=`of type ${r[0]}.`;return e==null?t+=` Received ${e}`:typeof e=="function"&&e.name?t+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&e.constructor?.name&&(t+=` Received an instance of ${e.constructor.name}`),t}var oa=(t,...e)=>$B("Key must be ",t,...e);function IB(t,e,r){let o=["CryptoKey","KeyObject","JSON Web Key"];return r&&o.push("Uint8Array"),new TypeError($B(`Key for the ${t} algorithm must be `,e,...o))}var Ex=(t,e="algorithm.name")=>new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`);function FO(t,e){if(e&&!t.usages.includes(e))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${e}.`)}function op(t,e){let{modulusLength:r}=e.algorithm;if(typeof r!="number"||r<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}function VO(t,e,r){let o=t.algorithm;if(o.name!==e.name)throw Ex(e.name);if(e.hash&&o.hash?.name!==e.hash)throw Ex(e.hash,"algorithm.hash");if(e.namedCurve&&o.namedCurve!==e.namedCurve)throw Ex(e.namedCurve,"algorithm.namedCurve");if(e.length!==void 0&&o.length!==e.length)throw Ex(e.length,"algorithm.length");FO(t,r)}function Ix(t){return{__proto__:null,...t}}function HO(t){let e=Ix(t);if(e.ext!==void 0&&typeof e.ext!="boolean")throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(e.key_ops!==void 0){let r=e.key_ops,o=Array.isArray(r)?[...r]:void 0;if(!o||o.some(n=>typeof n!="string")||new Set(o).size!==o.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');e.key_ops=o}return e}function $x(t){if(t!==void 0&&typeof t!="boolean")throw new TypeError('"extractable" option must be a boolean');return t}async function ip(t,e,r){if(!t.kty.includes(e.kty))throw new at('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let o=t.resolve?.({kty:e.kty,crv:e.crv})??t.subtle,n=!!(e.d||e.priv),i={...e,ext:r??e.ext};return i.kty!=="AKP"&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,o,i.ext??!n,e.key_ops??t.usages[n?1:0])}async function ri(t,e,r,o=!1){return t instanceof Uint8Array&&(t=await crypto.subtle.importKey("raw",t,e,o,[r])),VO(t,e,r),t}var Ju=t=>crypto.getRandomValues(new Uint8Array(t.cekBits>>3));function Ax(t,e){let r=t.byteLength<<3;if(r!==e)throw new U(`Invalid Content Encryption Key length. Expected ${e} bits, got ${r} bits`)}var Yme=t=>crypto.getRandomValues(new Uint8Array(t.ivBits>>3));function AB(t,e){if(e.length<<3!==t.ivBits)throw new U("Invalid Initialization Vector length")}async function TB(t,e,r){if(!(e instanceof Uint8Array))throw new TypeError(oa(e,"Uint8Array"));let o=t.cekBits>>1,n=await crypto.subtle.importKey("raw",e.subarray(o>>3),"AES-CBC",!1,[r]),i=await crypto.subtle.importKey("raw",e.subarray(0,o>>3),{hash:`SHA-${o<<1}`,name:"HMAC"},!1,["sign"]);return[n,i,o]}async function PB(t,e,r){return new Uint8Array((await crypto.subtle.sign("HMAC",t,e)).slice(0,r>>3))}async function Qme(t,e,r,o,n){let[i,s,a]=await TB(t,r,"encrypt"),c=new Uint8Array(await crypto.subtle.encrypt({iv:o,name:"AES-CBC"},i,e)),u=pn(n,o,c,jO(n.length*8)),l=await PB(s,u,a);return{ciphertext:c,tag:l,iv:o}}async function ehe(t,e){let r={name:"HMAC",hash:"SHA-256"},o=await crypto.subtle.generateKey(r,!1,["sign","verify"]),n=await crypto.subtle.sign(r,o,t);return crypto.subtle.verify(r,o,n,e)}async function the(t,e,r,o,n,i){let[s,a,c]=await TB(t,e,"decrypt"),u=pn(i,o,r,jO(i.length*8)),l=await PB(a,u,c);try{if(await ehe(n,l))return new Uint8Array(await crypto.subtle.decrypt({iv:o,name:"AES-CBC"},s,r))}catch{}throw new ec}async function Tx(t,e,r,o,n){if(!nc(r)&&!(r instanceof Uint8Array))throw new TypeError(oa(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(o?AB(t,o):o=Yme(t),r instanceof Uint8Array&&Ax(r,t.cekBits),t.cbc)return Qme(t,e,r,o,n);let i=await ri(r,t.subtle,"encrypt"),s=new Uint8Array(await crypto.subtle.encrypt({additionalData:n,iv:o,name:"AES-GCM",tagLength:128},i,e));return{ciphertext:s.subarray(0,-16),tag:s.subarray(-16),iv:o}}async function Px(t,e,r,o,n,i){if(!nc(e)&&!(e instanceof Uint8Array))throw new TypeError(oa(e,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!o)throw new U("JWE Initialization Vector missing");if(!n)throw new U("JWE Authentication Tag missing");if(!t.cbc&&n.length!==16)throw new U("Invalid Authentication Tag length");if(AB(t,o),e instanceof Uint8Array&&Ax(e,t.cekBits),t.cbc)return the(t,e,r,o,n,i);let s=await ri(e,t.subtle,"decrypt");try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:i,iv:o,name:"AES-GCM",tagLength:128},s,pn(r,n)))}catch{throw new ec}}function cg(t){let e={__proto__:null};for(let r in t)e[r]={...t[r],alg:r};return e}var rhe=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],nhe=[[],["deriveBits"]],Ox=[[],[]];function Rx(t){return{kty:["RSA"],mode:"key-encryption",subtle:{name:"RSA-OAEP",hash:`SHA-${t}`},usages:rhe,ops:["wrapKey","unwrapKey"]}}function Cx(t){return{kty:["EC","OKP"],mode:t,subtle:{name:"ECDH"},resolve:({kty:e,crv:r,asymmetricKeyType:o})=>{if(r==="X25519"||o==="x25519")return{name:"X25519"};if(e==="OKP")throw new at('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:r}},usages:nhe,ops:[void 0,"deriveBits"]}}function sp(t,e=!1){return{kty:["oct"],mode:"key-wrapping",secret:!0,subtle:{name:e?"AES-GCM":"AES-KW",length:t},usages:Ox,ops:e?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function BO(){return{kty:["oct"],mode:"key-wrapping",secret:!0,subtle:{name:"PBKDF2"},usages:Ox,ops:["deriveBits","deriveBits"]}}var ia=cg({dir:{kty:["oct"],mode:"direct-encryption",secret:!0,subtle:{name:"AES-GCM"},usages:Ox,ops:["encrypt","decrypt"]},"RSA-OAEP":Rx(1),"RSA-OAEP-256":Rx(256),"RSA-OAEP-384":Rx(384),"RSA-OAEP-512":Rx(512),"ECDH-ES":Cx("direct-key-agreement"),"ECDH-ES+A128KW":Cx("key-agreement-with-key-wrapping"),"ECDH-ES+A192KW":Cx("key-agreement-with-key-wrapping"),"ECDH-ES+A256KW":Cx("key-agreement-with-key-wrapping"),A128KW:sp(128),A192KW:sp(192),A256KW:sp(256),A128GCMKW:sp(128,!0),A192GCMKW:sp(192,!0),A256GCMKW:sp(256,!0),"PBES2-HS256+A128KW":BO(),"PBES2-HS384+A192KW":BO(),"PBES2-HS512+A256KW":BO()}),ohe=["encrypt","decrypt"];function ap(t,e=!1){return{kty:["oct"],secret:!0,subtle:{name:e?"AES-CBC":"AES-GCM",length:t},usages:Ox,ops:ohe,cekBits:t,ivBits:e?128:96,cbc:e}}var ihe=cg({A128GCM:ap(128),A192GCM:ap(192),A256GCM:ap(256),"A128CBC-HS256":ap(256,!0),"A192CBC-HS384":ap(384,!0),"A256CBC-HS512":ap(512,!0)});function RB(t,e){throw new at(`Invalid or unsupported "${t}" (JWE ${e}) header value`)}function ni(t){return(typeof t=="string"?ia[t]:void 0)??RB("alg","Algorithm")}function oi(t){return t.mode==="key-wrapping"||t.mode==="key-encryption"||t.mode==="key-agreement-with-key-wrapping"}function Gu(t){return(typeof t=="string"?ihe[t]:void 0)??RB("enc","Encryption Algorithm")}function CB(t,e){if(t.algorithm.name!=="ECDH"&&t.algorithm.name!=="X25519")throw new TypeError("CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519");FO(t,e)}async function she(t,e,r){let o=await ri(e,ni(t).subtle,"wrapKey",!0),n=await crypto.subtle.importKey("raw",r,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",n,o,"AES-KW"))}async function ahe(t,e,r){let o=await ri(e,ni(t).subtle,"unwrapKey",!0),n=await crypto.subtle.unwrapKey("raw",r,o,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",n))}function NB(t,e,r){VO(e,ni(t).subtle,r),op(t,e)}async function DB(t,e,r,o){if(!(t instanceof Uint8Array)||t.length<8)throw new U("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(r)||Math.sign(r)!==1)throw new U("PBES2 Count Input must be a positive integer");let n=pn(Sr(e),Uint8Array.of(0),t),i=parseInt(e.slice(13,16),10),s={hash:`SHA-${e.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:n},a=await ri(o,ni(e).subtle,"deriveBits");return new Uint8Array(await crypto.subtle.deriveBits(s,a,i))}function KO(t){return pn(gx(t.length),t)}async function che(t,e,r){let o=e>>3,n=32,i=Math.ceil(o/n),s=new Uint8Array(i*n);for(let a=1;a<=i;a++){let c=await yx("sha256",pn(gx(a),t,r));s.set(c,(a-1)*n)}return s.slice(0,o)}async function zB(t,e,r,o,n=new Uint8Array,i=new Uint8Array){CB(t),CB(e,"deriveBits");let s=pn(KO(Sr(r)),KO(n),KO(i),gx(o)),a=new Uint8Array(await crypto.subtle.deriveBits({name:t.algorithm.name,public:t},e,t.algorithm.name==="X25519"?256:Math.ceil(parseInt(t.algorithm.namedCurve.slice(-3),10)/8)<<3));return che(a,o,s)}function jB(t){kx(t);let e=t.algorithm.namedCurve;if(e!=="P-256"&&e!=="P-384"&&e!=="P-521"&&t.algorithm.name!=="X25519")throw new at("ECDH with the provided key is not allowed or not supported by your javascript runtime")}function Nx(t,e){let r=t[e];if(r!==void 0){if(typeof r!="string")throw new U(`JOSE Header "${e}" (Agreement Party${e==="apu"?"U":"V"}Info) invalid`);return Tn(r,e,U)}}function MB(t,e){if(!(t===void 0||e===void 0||t.byteLength!==e.byteLength)){for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return;throw new U('JOSE Header "apu" and "apv" values must be distinct')}}function uhe(t){if(t===void 0)throw new U("JWE Encrypted Key missing")}function OB(t){if(t!==void 0)throw new U("Encountered unexpected JWE Encrypted Key")}function lhe(t){if(t!==void 0&&t!==1/0&&(!Number.isSafeInteger(t)||t<1))throw new TypeError("maxPBES2Count must be a positive safe integer or Infinity")}async function UB(t,e,r,o,n,i){let{alg:s}=t,a=t.mode;if(a==="direct-encryption")return OB(o),r;let c=a==="direct-key-agreement";switch(c?OB(o):uhe(o),t.subtle.name){case"ECDH":{let{epk:u}=n;if(!Kt(u)||["d","k","p","q","dp","dq","qi","oth","priv"].some(m=>Object.hasOwn(u,m)))throw new U('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');jB(r);let l=await ip(t,u),d=Nx(n,"apu"),f=Nx(n,"apv");MB(d,f);let p=await zB(l,r,c?e.alg:s,c?e.cekBits:parseInt(s.slice(-5,-2),10),d,f);if(c)return p;r=p;break}case"RSA-OAEP":return kx(r),NB(s,r,"decrypt"),new Uint8Array(await crypto.subtle.decrypt("RSA-OAEP",r,o));case"PBKDF2":{if(typeof n.p2c!="number")throw new U('JOSE Header "p2c" (PBES2 Count) missing or invalid');lhe(i);let u=i??1e4;if(n.p2c>u)throw new U('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof n.p2s!="string")throw new U('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let l=Tn(n.p2s,"p2s",U);r=await DB(l,s,n.p2c,r);break}case"AES-GCM":{if(typeof n.iv!="string")throw new U('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof n.tag!="string")throw new U('JOSE Header "tag" (Authentication Tag) missing or invalid');let u=Tn(n.iv,"iv",U),l=Tn(n.tag,"tag",U);if(u.byteLength!==12)throw new U("Invalid Initialization Vector length");if(l.byteLength!==16)throw new U("Invalid Authentication Tag length");return Px(Gu(s.slice(0,-2)),r,o,u,l,new Uint8Array)}}return ahe(s.slice(-6),r,o)}async function Dx(t,e,r,o,n,i={}){let{alg:s,mode:a}=t,c=oi(t);if(n!==void 0&&!c)throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${s}`);let u=await ti(a==="direct-encryption"?e:t,r,"encrypt");if(a==="direct-encryption")return[u,void 0,void 0];let l=c?n??Ju(e):void 0;l&&Ax(l,e.cekBits);let d,f;switch(t.subtle.name){case"ECDH":{jB(u);let{apu:p,apv:m}=i;p!==void 0&&qn(p,'"apu"'),m!==void 0&&qn(m,'"apv"');let g=p??Nx(o,"apu"),y=m??Nx(o,"apv");MB(g,y);let w;i.epk!==void 0?w=await ti(t,i.epk,"decrypt"):w=(await crypto.subtle.generateKey(u.algorithm,!0,["deriveBits"])).privateKey;let b=crypto.subtle,_=w;if(!_.extractable){if(typeof b.getPublicKey!="function")throw new TypeError('CryptoKey for "epk" must be extractable');_=await b.getPublicKey(w,[])}let{x:k,y:$,crv:D,kty:K}=await b.exportKey("jwk",_),te=a==="direct-key-agreement",Ie=await zB(u,w,te?e.alg:s,te?e.cekBits:parseInt(s.slice(-5,-2),10),g,y),xe={x:k,crv:D,kty:K};if(K==="EC"&&(xe.y=$),f={epk:xe},p!==void 0&&(f.apu=Rt(p)),m!==void 0&&(f.apv=Rt(m)),te)return[Ie,void 0,f];u=Ie;break}case"RSA-OAEP":{kx(u),NB(s,u,"encrypt"),d=new Uint8Array(await crypto.subtle.encrypt("RSA-OAEP",u,l));break}case"PBKDF2":{let{p2c:p=2048,p2s:m=crypto.getRandomValues(new Uint8Array(16))}=i;u=await DB(m,s,p,u),f={p2c:p,p2s:Rt(m)};break}case"AES-GCM":{let p=i.iv===void 0?crypto.getRandomValues(new Uint8Array(12)):i.iv;if(!(p instanceof Uint8Array))throw new TypeError('"iv" must be an instance of Uint8Array');let m=await Tx(Gu(s.slice(0,-2)),l,u,p,new Uint8Array);d=m.ciphertext,f={iv:Rt(m.iv),tag:Rt(m.tag)}}}if(d??=await she(s.slice(-6),u,l),!(d instanceof Uint8Array)||!d.byteLength)throw new TypeError("JWE key management algorithm did not produce an Encrypted Key");return[l,d,f]}function zx(t,e){if(t.zip!==void 0&&t.zip!=="DEF")throw new at('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(t.zip!==void 0&&!e?.zip)throw new U('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.')}function LB(t){if(typeof globalThis[t]>"u")throw new at(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${t} API.`)}async function FB(t,e,r=1/0){let o=t.writable.getWriter();o.write(e).catch(()=>{}),o.close().catch(()=>{});let n=[],i=0,s=t.readable.getReader();for(;;){let{value:a,done:c}=await s.read();if(c)break;if(n.push(a),i+=a.byteLength,r!==1/0&&i>r)throw new U("Decompressed plaintext exceeded the configured limit")}return pn(...n)}async function VB(t){return LB("CompressionStream"),FB(new CompressionStream("deflate-raw"),t)}async function HB(t,e){return LB("DecompressionStream"),FB(new DecompressionStream("deflate-raw"),t,e)}function BB(t){let{aad:e,ciphertext:r,iv:o,protected:n,tag:i,unprotected:s}=t;if(o!==void 0&&(typeof o!="string"||!o))throw new U("JWE Initialization Vector incorrect type");if(typeof r!="string")throw new U("JWE Ciphertext missing or incorrect type");if(i!==void 0&&(typeof i!="string"||!i))throw new U("JWE Authentication Tag incorrect type");if(n!==void 0&&typeof n!="string")throw new U("JWE Protected Header incorrect type");if(e!==void 0&&(typeof e!="string"||!e))throw new U("JWE AAD incorrect type");if(s!==void 0&&!Kt(s))throw new U("JWE Shared Unprotected Header incorrect type");return{aad:e,ciphertext:r,iv:o,protected:n,tag:i,unprotected:s===void 0?void 0:{...s}}}function KB(t){let e,r;try{let{header:o}=t;if(Kt(o)){r=o.alg;let i=Object.keys(o);i.includes("alg")||(r=void 0),e=Object.fromEntries(i.map(s=>[s,s==="alg"?r:o[s]]))}else e=o;let{encrypted_key:n}=t;return[{encrypted_key:n,header:e},r]}catch(o){return[void 0,r,o]}}function qB(t){let{encrypted_key:e,header:r}=t;if(e!==void 0&&typeof e!="string")throw new U("JWE Encrypted Key incorrect type");if(r!==void 0&&!Kt(r))throw new U("JWE Per-Recipient Unprotected Header incorrect type");if(t.protected===void 0&&r===void 0&&t.unprotected===void 0)throw new U("JOSE Header missing")}function qO(t){let{protected:e,ciphertext:r,iv:o,tag:n,aad:i}=t,s;return e!==void 0&&(s=np(e,U,"JWE Protected Header is invalid")),[s,Tn(r,"ciphertext",U),o!==void 0?Tn(o,"iv",U):void 0,n!==void 0?Tn(n,"tag",U):void 0,wx((e??"")+(i!==void 0?`.${i}`:""),"aad",U)]}function jx(t){return[t&&ag("keyManagementAlgorithms",t.keyManagementAlgorithms),t&&ag("contentEncryptionAlgorithms",t.contentEncryptionAlgorithms),t?.crit,t?.maxPBES2Count,t?.maxDecompressedLength]}async function ZO(t,e,r,o=qO(t)){let[n,i,s,a,c]=o,{header:u,unprotected:l,aad:d}=t,f;if(u!==void 0||l!==void 0){if(!tc(n,u,l))throw new U("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");f={...n,...u,...l}}else f=n??{};let[p,m,g,y,w]=e,{encrypted_key:b}=t;rc(U,_x,g,n,f),zx(f,n);let{alg:_,enc:k}=f;if(typeof _!="string"||!_)throw new U("missing JWE Algorithm (alg) in JWE Header");let $=ia[_];if(b===""&&(!$||!oi($)))throw new U("JWE Encrypted Key incorrect type");let D=$?.mode==="integrated-encryption";if(!D&&(typeof k!="string"||!k))throw new U("missing JWE Encryption Algorithm (enc) in JWE Header");if(p&&!p.has(_)||!p&&_.startsWith("PBES2"))throw new qu('"alg" (Algorithm) Header Parameter value not allowed');let K;if(D){if(k!==void 0)throw new U('JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption');if(s?.byteLength)throw new U("JWE Initialization Vector must be empty for integrated encryption");if(a?.byteLength)throw new U("JWE Authentication Tag must be empty for integrated encryption")}else{if(m&&!m.has(k))throw new qu('"enc" (Encryption Algorithm) Header Parameter value not allowed');K=Gu(k)}let te;if(b!==void 0)try{te=Tn(b,"encrypted_key",U)}catch($e){if(!$||!oi($))throw $e;te=new Uint8Array}let Ie=!1;typeof r=="function"&&(r=await r(n,t),Ie=!0);let xe=$??ni(_);oi(xe)&&te===void 0&&(te=new Uint8Array);let Qe=await ti(xe.mode==="direct-encryption"?K:xe,r,"decrypt"),Fe;if(xe.mode==="integrated-encryption")Fe=await xe.decrypt(Qe,te,i,c,n,f);else{let $e=K,J;try{J=await UB(xe,$e,Qe,te,f,y),oi(xe)&&J instanceof Uint8Array&&J.byteLength<<3!==$e.cekBits&&(J=Ju($e))}catch(Tt){if(Tt instanceof TypeError||Tt instanceof U||Tt instanceof at)throw Tt;J=Ju($e)}Fe=await Px($e,J,i,s,a,c)}if(f.zip==="DEF"){let $e=w??25e4;if($e===0)throw new at('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if($e!==1/0&&(!Number.isSafeInteger($e)||$e<1))throw new TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");Fe=await HB(Fe,$e).catch(J=>{throw J instanceof U?J:new U("Failed to decompress plaintext",{cause:J})})}return{plaintext:Fe,...n&&{protectedHeader:n},...d!==void 0&&{additionalAuthenticatedData:Tn(d,"aad",U)},...l&&{sharedUnprotectedHeader:l},...u&&{unprotectedHeader:u},...Ie&&{key:Qe}}}async function ZB(t,e,r){if(t instanceof Uint8Array&&(t=rp.decode(t)),typeof t!="string")throw new U("Compact JWE must be a string or Uint8Array");let{0:o,1:n,2:i,3:s,4:a,length:c}=t.split(".");if(c!==5)throw new U("Invalid Compact JWE");return ZO({ciphertext:s,iv:i||void 0,protected:o,tag:a||void 0,encrypted_key:n||void 0},e,r)}async function ug(t,e,r){return ZB(t,jx(r),e)}async function WO(t,e,r){if(!Kt(t))throw new U("General JWE must be an object");let o=t.recipients;if(!Array.isArray(o))throw new U("JWE Recipients missing or incorrect type");let n=Array.from(o);if(!n.every(Kt))throw new U("JWE Recipients missing or incorrect type");if(!n.length)throw new U("JWE Recipients has no members");let i,s,a;try{i=jx(r),s=BB(t),a=qO(s)}catch{throw new ec}let c=n.map(u=>KB(u));if(n.length>1)for(let[,u]of c){let l=a[0]?.alg??u??s.unprotected?.alg,d=typeof l=="string"?ia[l]:void 0;if(d&&!oi(d))throw new U(`"${l}" alg may only have a single recipient`)}for(let[u]of c)if(u)try{let l={...s,...u};return qB(l),await ZO(l,i,e,a)}catch{}throw new ec}function Mx(t,e,r){if(!tc(t,e,r))throw new U("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint")}function JO(t,e,r=!1){if(!t[1]&&!t[2]&&!t[3])throw new U("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");e!==void 0&&(t[8]=e?.crit);let[,o,n,i,s,a,c,u,l]=t;if(s!==void 0&&qn(s,"JWE Additional Authenticated Data"),a!==void 0&&qn(a,"JWE Content Encryption Key"),c!==void 0&&qn(c,"JWE Initialization Vector"),!r&&o!==void 0&&(o=Wu(U,o)[0],t[1]=o),n!==void 0&&(n=Wu(U,n)[0],t[2]=n),!r&&i!==void 0&&(i=Wu(U,i)[0],t[3]=i),u!==void 0&&!Kt(u))throw new TypeError("JWE Key Management Parameters must be an object");Mx(o,n,i);let d={...o,...n,...i};Sx(U,o),rc(U,_x,l,o,d),zx(d,o);let{alg:f,enc:p}=d;if(typeof f!="string"||!f)throw new U('JWE "alg" (Algorithm) Header Parameter missing or invalid');let m=ia[f];if(m?.mode==="integrated-encryption"){if(p!==void 0)throw new U('JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption');if(a!==void 0)throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${f}`);if(c!==void 0)throw new TypeError(`setInitializationVector cannot be called with JWE "alg" (Algorithm) Header ${f}`);return[d,void 0,m]}if(typeof p!="string"||!p)throw new U('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');return[d,Gu(p),m]}async function GO(t,e,r){let[o,n,i]=e,[s,a,c,u,l,d,f,p,,m]=t,g=a,y=c,w=i??ni(o.alg),b,_,k;w.mode==="integrated-encryption"?k=await ti(w,r,"encrypt"):[k,b,_]=await Dx(w,n,r,o,d,p),_&&(m?y=y?{...y,..._}:_:g=g?{...g,..._}:_,Mx(g,y,u));let $=g?Rt(JSON.stringify(g)):"",D=l?.byteLength?Rt(l):void 0,K=Sr(D?`${$}.${D}`:$),te=s;o.zip==="DEF"&&(te=await VB(te).catch($e=>{throw new U("Failed to compress plaintext",{cause:$e})}));let Ie,xe,Qe;w.mode==="integrated-encryption"?[b,Ie]=await w.encrypt(k,te,K,g,o,p):{ciphertext:Ie,tag:xe,iv:Qe}=await Tx(n,te,k,f,K);let Fe={ciphertext:Rt(Ie)};return Qe&&(Fe.iv=Rt(Qe)),xe&&(Fe.tag=Rt(xe)),b?.byteLength&&(Fe.encrypted_key=Rt(b)),D&&(Fe.aad=D),g&&(Fe.protected=$),u&&(Fe.unprotected=u),y&&(Fe.header=y),Fe}async function WB(t,e,r){return GO(t,JO(t,r),e)}function JB(t){return[t.protected,t.encrypted_key,t.iv,t.ciphertext,t.tag].join(".")}var XO=class{#e;state;constructor(e,r,o){this.#e=e,this.state=[void 0,void 0,r,o]}setUnprotectedHeader(e){return go(this.state[0],"setUnprotectedHeader"),this.state[0]=e,this}setKeyManagementParameters(e){return go(this.state[1],"setKeyManagementParameters"),this.state[1]=e,this}addRecipient(...e){return this.#e.addRecipient(...e)}encrypt(...e){return this.#e.encrypt(...e)}done(){return this.#e}},lg=class{#e;#t=[];#r;#n;#o;constructor(e){this.#e=e}addRecipient(e,r){let o=new XO(this,e,r?.crit);return this.#t.push(o),o}setProtectedHeader(e){return go(this.#r,"setProtectedHeader"),this.#r=e,this}setSharedUnprotectedHeader(e){return go(this.#n,"setSharedUnprotectedHeader"),this.#n=e,this}setAdditionalAuthenticatedData(e){return this.#o=e,this}async encrypt(){if(!this.#t.length)throw new U("at least one recipient must be added");qn(this.#e,"plaintext");let e=this.#t.length>1,r,o=this.#r,n=this.#n,i=[];for(let m of this.#t){let[g,y,w,b]=m.state,_=[this.#e,o,g,n,this.#o,void 0,void 0,y,b,e],k=JO(_,void 0,i.length>0);i.length||(o=_[1],n=_[3]),i.push([_,k,w]);let[{alg:$,enc:D},,K]=k;if(e&&K&&!oi(K))throw new U(`"${$}" alg may only have a single recipient`);if(!r)r=D;else if(r!==D)throw new U('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}for(let[,m]of i)m[2]??=ni(m[0].alg);let[s,a,c]=i[0],u=e?Ju(a[1]):void 0;s[5]=u;let{encrypted_key:l,header:d,...f}=await GO(s,a,c),p={...f,recipients:[{}]};l&&(p.recipients[0].encrypted_key=l),d&&(p.recipients[0].header=d);for(let m=1;m<i.length;m++){let[g,[y,w,b],_]=i[m],k=g[2],[,$,D]=await Dx(b,w,_,y,u,g[7]),K={encrypted_key:Rt($)};if(k||D){let te={...k,...D};D&&Mx(g[1],te,g[3]),K.header=te}p.recipients.push(K)}return p}};var dg=[["verify"],["sign"]];function YO(t){let e={name:"HMAC",hash:`SHA-${t}`};return{kty:["oct"],secret:!0,subtle:e,signing:e,usages:dg}}function cp(t,e){let r={name:e?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${t}`};return{kty:["RSA"],subtle:r,signing:e?{...r,saltLength:e}:r,usages:dg,minRsaBits:2048}}function QO(t,e){return{kty:["EC"],crv:t,subtle:{name:"ECDSA",namedCurve:t},signing:{name:"ECDSA",hash:`SHA-${e}`},usages:dg}}function GB(){let t={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:t,signing:t,usages:dg}}function eN(t){let e={name:`ML-DSA-${t}`};return{kty:["AKP"],subtle:e,signing:e,usages:dg}}var tN=cg({HS256:YO(256),HS384:YO(384),HS512:YO(512),RS256:cp(256),RS384:cp(384),RS512:cp(512),PS256:cp(256,32),PS384:cp(384,48),PS512:cp(512,64),ES256:QO("P-256",256),ES384:QO("P-384",384),ES512:QO("P-521",512),EdDSA:GB(),Ed25519:GB(),"ML-DSA-44":eN(44),"ML-DSA-65":eN(65),"ML-DSA-87":eN(87)});function Ux(t){let e=typeof t=="string"?tN[t]:void 0;if(!e)throw new at(`alg ${t} is not supported either by JOSE or your javascript runtime`);return e}function XB(t){return[t&&ag("algorithms",t.algorithms),t?.crit]}function dhe(t){return t===void 0?{}:np(t,xt,"JWS Protected Header is invalid")}function phe(t){try{return Sr(t)}catch{throw new xt("JWS Compact Serialization payload must use only ASCII characters")}}async function fhe(t,e,r,o,n){let{protected:i,header:s,payload:a}=t,c=n??dhe(i);if(!tc(c,s))throw new xt("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let u={...c,...s},l=xx(c,rc(xt,bx,e[1],c,u)),{alg:d}=u;if(typeof d!="string"||!d)throw new xt('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(e[0]&&!e[0].has(d))throw new qu('"alg" (Algorithm) Header Parameter value not allowed');if(l){if(typeof a!="string")throw new xt("JWS Payload must be a string")}else if(typeof a!="string"&&!(a instanceof Uint8Array))throw new xt("JWS Payload must be a string or an Uint8Array instance");let f=l||typeof a!="string"?a:o(a),p=!1;typeof r=="function"&&(r=await r(c,t),p=!0);let m=Ux(d),g=pn(i!==void 0?Sr(i):new Uint8Array,Sr("."),typeof f=="string"?e[2]??=wx(f,"payload",xt):f),y=Tn(t.signature,"signature",xt),w=await ti(m,r,"verify"),b=await ri(w,m.subtle,"verify");m.minRsaBits&&op(m.alg,b);let _=!1;try{_=await crypto.subtle.verify(m.signing,b,y,g)}catch{}if(!_)throw new vx;let k={payload:typeof f=="string"?Tn(f,"payload",xt):f};return i!==void 0&&(k.protectedHeader=c),s!==void 0&&(k.unprotectedHeader=s),p?[{...k,key:w},l]:[k,l]}async function YB(t,e,r){if(t instanceof Uint8Array&&(t=rp.decode(t)),typeof t!="string")throw new xt("Compact JWS must be a string or Uint8Array");let{0:o,1:n,2:i,length:s}=t.split(".");if(s!==3)throw new xt("Invalid Compact JWS");return fhe({payload:n,protected:o,signature:i},e,r,phe)}async function rN(t,e,r){let[o]=await YB(t,XB(r),e);return o}var up=class{#e;constructor(e){qn(e,"plaintext"),this.#e=[e]}setContentEncryptionKey(e){return go(this.#e[5],"setContentEncryptionKey"),this.#e[5]=e,this}setInitializationVector(e){return go(this.#e[6],"setInitializationVector"),this.#e[6]=e,this}setProtectedHeader(e){return go(this.#e[1],"setProtectedHeader"),this.#e[1]=e,this}setKeyManagementParameters(e){return go(this.#e[7],"setKeyManagementParameters"),this.#e[7]=e,this}async encrypt(e,r){return JB(await WB([...this.#e],e,r))}};async function mhe(t,e,r){let[o,n,i,s]=t,a="";if(n!==void 0){let w=Wu(xt,n);n=w[0],a=Rt(w[1])}if(i!==void 0&&(i=Wu(xt,i)[0]),!n&&!i)throw new xt("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!tc(n,i))throw new xt("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let c={...n,...i};Sx(xt,n);let u=xx(n,rc(xt,bx,s,n,c));u||r?.();let{alg:l}=c;if(typeof l!="string"||!l)throw new xt('JWS "alg" (Algorithm) Header Parameter missing or invalid');let d=Ux(l),f="",p=o,m;if(u){let w=t[4];w?(f=w[0]??=Rt(o),p=w[1]??=Sr(f)):(f=Rt(o),m=tp.encode(`${a}.${f}`))}m??=pn(Sr(a),Sr("."),p);let g=await ri(await ti(d,e,"sign"),d.subtle,"sign");d.minRsaBits&&op(d.alg,g);let y={signature:Rt(new Uint8Array(await crypto.subtle.sign(d.signing,g,m))),payload:f};return n&&(y.protected=a),i&&(y.header=i),[y,u]}async function QB(t,e,r,o,n){let[i]=await mhe([t,e,void 0,r],o,n);return`${i.protected}.${i.payload}.${i.signature}`}var pg=class{#e;#t;constructor(e){qn(e,"payload"),this.#e=e}setProtectedHeader(e){return go(this.#t,"setProtectedHeader"),this.#t=e,this}async sign(e,r){return QB(this.#e,this.#t,r?.crit,e,()=>{throw new TypeError("use the flattened module for creating JWS with b64: false")})}};var nN='"alg" (Algorithm)';function oN(t='JWK "alg" (Algorithm) Parameter'){throw new at(`Invalid or unsupported ${t} value`)}function fg(t,e){return(typeof t=="string"?tN[t]??ia[t]:void 0)??oN(e)}async function oc(t){if(UO(t))if(t.type==="secret")t=t.export();else return t.export({format:"jwk"});if(t instanceof Uint8Array)return{kty:"oct",k:Rt(t)};if(!nc(t))throw new TypeError(oa(t,"CryptoKey","KeyObject","Uint8Array"));if(!t.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");let e=await crypto.subtle.exportKey("jwk",t);delete e.ext,delete e.key_ops,delete e.use,e.kty!=="AKP"&&delete e.alg;for(let r of Object.keys(e))e[r]===void 0&&delete e[r];return e}var sa=(t,e)=>{if(typeof t!="string"||!t)throw new sg(`${e} missing or invalid`)};async function iN(t,e){let r;if(Kt(t)){if(r=Ix(t),typeof r.kty!="string")throw new TypeError(oa(t,"CryptoKey","KeyObject","JSON Web Key"))}else if(LO(t))r=Ix(await oc(t));else throw new TypeError(oa(t,"CryptoKey","KeyObject","JSON Web Key"));if(e??="sha256",e!=="sha256"&&e!=="sha384"&&e!=="sha512")throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let o;switch(r.kty){case"AKP":sa(r.alg,'"alg" (Algorithm) Parameter'),sa(r.pub,'"pub" (Public key) Parameter'),o={alg:r.alg,kty:r.kty,pub:r.pub};break;case"EC":sa(r.crv,'"crv" (Curve) Parameter'),sa(r.x,'"x" (X Coordinate) Parameter'),sa(r.y,'"y" (Y Coordinate) Parameter'),o={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":sa(r.crv,'"crv" (Subtype of Key Pair) Parameter'),sa(r.x,'"x" (Public Key) Parameter'),o={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":sa(r.e,'"e" (Exponent) Parameter'),sa(r.n,'"n" (Modulus) Parameter'),o={e:r.e,kty:r.kty,n:r.n};break;case"oct":if(typeof r.k!="string")throw new sg('"k" (Key Value) Parameter missing or invalid');o={k:r.k,kty:r.kty};break;default:throw new at('"kty" (Key Type) Parameter missing or unsupported')}let n=Sr(JSON.stringify(o));return Rt(await yx(e,n))}async function yo(t,e,r){if(!Kt(t))throw new TypeError("JWK must be an object");let o=HO(t),n=$x(r?.extractable),{alg:i}=o;if(e??=i,o.kty!=="oct"&&!e)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');switch(o.kty){case"oct":if(typeof o.k!="string")throw new TypeError('missing "k" (Key Value) Parameter value');return Zu(o.k);case"AKP":{if(typeof i!="string"||!i)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(e!==i)throw new TypeError("JWK alg and alg option value mismatch");return ip(fg(e),o,n)}case"RSA":case"EC":case"OKP":return ip(fg(e),o,n);default:throw new at('Unsupported "kty" (Key Type) Parameter value')}}function sN(t){let e;if(typeof t=="string"){let o=t.split(".");(o.length===3||o.length===5)&&([e]=o)}else if(typeof t=="object"&&t)if("protected"in t)e=t.protected;else throw new TypeError("Token does not contain a Protected Header");let r="Invalid Token or Protected Header formatting";if(typeof e!="string"||!e)throw new TypeError(r);return np(e,TypeError,r)}function hhe(t){let e=t?.modulusLength??2048;if(typeof e!="number"||!Number.isInteger(e)||e<2048)throw new at("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return e}async function mg(t,e){let r=$x(e?.extractable),o=fg(t,nN);o.secret&&oN(nN);let n;if(o.resolve){let i=e?.crv??"P-256";if(!["P-256","P-384","P-521","X25519"].includes(i))throw new at("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519");n=o.resolve({crv:i})}else{if(o.crv!==void 0&&e?.crv!==void 0&&e.crv!==o.crv)throw new at(`Invalid or unsupported crv option provided, the only supported value for ${t} is ${o.crv}`);n=o.kty[0]==="RSA"?{...o.subtle,publicExponent:Uint8Array.of(1,0,1),modulusLength:hhe(e)}:o.subtle}return crypto.subtle.generateKey(n,r??!1,[...o.usages[1],...o.usages[0]])}var nK=h.string().regex(/^[a-z]{2}(?:-gov)?-[a-z]+-\d$/),oK=h.string().max(2e3).regex(/^arn:aws(?:-us-gov|-cn)?:iam::\d{12}:role\/.+/),eK=h.string().min(1).max(128),tK=h.string().min(1).max(16384),ghe=h.discriminatedUnion("kind",[h.object({kind:h.literal("access_key"),accessKeyId:eK,secretAccessKey:tK}).strict(),h.object({kind:h.literal("session"),accessKeyId:eK,secretAccessKey:tK,sessionToken:h.string().min(1).max(16384),expiresAt:h.number().int().positive().max(Number.MAX_SAFE_INTEGER)}).strict(),h.object({kind:h.literal("environment")}).strict()]),yhe=h.object({arn:oK,externalId:h.string().min(2).max(1224).regex(/^[\w+=,.@:\/-]+$/).optional()}).strict(),aa=h.object({authentication:ghe,region:nK,role:yhe.optional()}).strict(),Lx=h.object({accountId:h.string().regex(/^\d{12}$/),principalId:h.string().min(1).max(256),arn:h.string().max(2e3).regex(/^arn:aws(?:-us-gov|-cn)?:(?:iam|sts)::\d{12}:.+/)}).strict(),Fx=aa.extend({sourceIdentity:Lx.optional(),identity:Lx.optional()}).strict();function lp(t){return t.includes(":assumed-role/")?t.slice(0,t.lastIndexOf("/")):t}function rK(t){return{...t,arn:lp(t.arn)}}function iK(t){return{authentication:t.authentication.kind,region:t.region,role:t.role??null,...t.sourceIdentity?{sourceIdentity:rK(t.sourceIdentity)}:{},...t.identity?{identity:rK(t.identity)}:{}}}var Vx=h.object({authentication:h.enum(["access_key","session","environment"]),region:nK,sourceAccountId:h.string().regex(/^\d{12}$/).optional(),sourceArn:h.string().max(2e3).optional(),roleArn:oK.optional(),expiresAt:h.number().int().positive().optional()}).strict();function sK(t){return{authentication:t.authentication.kind,region:t.region,...t.sourceIdentity?{sourceAccountId:t.sourceIdentity.accountId,sourceArn:t.sourceIdentity.arn}:{},...t.role?{roleArn:t.role.arn}:{},...t.authentication.kind==="session"?{expiresAt:t.authentication.expiresAt}:{}}}var aK=h.object({method:h.enum(["GET","POST","PUT","DELETE","PATCH"]),path:h.string().min(1).max(1e3).regex(/^\/[^\s\u0000]*$/)}).strict(),hg=h.object({account:h.string().min(1),identities:h.array(h.string()),user:h.string().nullable(),description:h.string().nullable(),roles:h.array(h.string()).nullable(),credentialId:h.number().int().positive(),rules:h.array(aK),allowedIPs:h.array(h.string()).nullable(),expiresAt:h.number().nullable()}).strict();function cK(t){return t.map(e=>{let r=e.match(/^(GET|POST|PUT|DELETE|PATCH) (\/[^\s\u0000]*)$/);if(!r)throw new Error("Use one HTTP method and API path for each OVH permission.");return aK.parse({method:r[1],path:r[2]})})}typeof window<"u"&&h.config({jitless:!0});var E=h.uuid(),me=h.string().trim().min(1).max(200).regex(/^[^\u0000-\u001f\u007f]+$/u),Ve=h.iso.datetime(),Zn=h.json(),xr=h.record(h.string(),Zn),uK=h.enum(["ja","en"]),lK=h.enum(["read","create","update","delete","share","transfer","reveal","use","manage_credentials","manage_billing","export"]);var dK=h.enum(["variable","connection","service","method","app","object","keyring","ssh_key","ssh_host"]),fn=h.object({kty:h.literal("EC"),crv:h.literal("P-256"),x:h.string().min(40).max(50),y:h.string().min(40).max(50)}).strict(),vhe=h.object({alg:h.literal("dir"),enc:h.literal("A256GCM"),sub:E}).strict(),vg=h.string().max(16384).regex(/^[A-Za-z0-9_-]+\.\.[A-Za-z0-9_-]{16}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]{22}$/).refine(t=>{try{return vhe.safeParse(sN(t)).success}catch{return!1}},"Use an A256GCM JWE for the wrapped encryption key.").brand(),Fr=h.object({protected:h.string().max(2048),iv:h.string().max(64),ciphertext:h.string().max(2e6),tag:h.string().max(64),aad:h.string().max(2048).optional(),recipients:h.array(h.object({encrypted_key:h.string().max(2048),header:h.object({kid:E,epk:fn.optional(),alg:h.string().optional()}).passthrough()})).min(1).max(100)}).strict(),QVe=h.object({id:E,name:me,publicKey:fn}),Yu=h.object({id:E,name:me,owner:h.object({id:E,name:me}).nullable(),createdAt:Ve,permissions:h.array(lK),createKinds:h.array(dK),publicKey:fn.nullable()}),pK=h.object({id:E,kind:h.enum(["passkey","email","key"]),name:h.string(),createdAt:Ve,lastUsedAt:Ve.nullable(),expiresAt:Ve.nullable(),canOpen:h.boolean()}),aN=h.string().regex(/^[a-z][a-z_]*[a-z]$/).max(64),whe=h.object({subjectId:E,relation:aN,objectId:E}).strict(),fK=h.enum(["principal",...dK.options]),mK=whe.extend({objectType:fK,subjectName:me,objectName:me,createdAt:Ve}),eHe=h.object({error:h.object({code:h.string(),message:h.string(),details:Zn.optional()})}),tHe=h.object({ok:h.literal(!0)}),bhe=h.object({value:h.string().min(1).max(200),label:h.string().min(1).max(200),values:h.record(h.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),h.string()).default({})}).strict(),Kx=h.object({name:h.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),label:h.string(),secret:h.boolean().optional(),inputType:h.enum(["text","password","file"]).optional(),required:h.boolean().optional(),placeholder:h.string().optional(),note:h.string().optional(),pattern:h.string().optional(),choices:h.array(bhe).min(1).max(100).optional(),defaultValue:h.string().max(1e3).optional(),when:h.object({field:h.string(),values:h.array(h.string()).min(1)}).strict().optional(),visibility:h.enum(["application","connection"]).optional()}).superRefine((t,e)=>{let r=t.choices??[];new Set(r.map(o=>o.value)).size!==r.length&&e.addIssue({code:"custom",path:["choices"],message:"Use a unique value for each choice."})}),cN=h.record(h.string().regex(/^[A-Z_][A-Z0-9_]*$/),h.string()),_he=h.record(h.string().regex(/^[A-Z_][A-Z0-9_]*$/),h.union([h.string(),h.array(h.union([h.string().max(8192),h.object({pointer:h.string().max(1e3)}).strict()])).min(1).max(32)])),uN=h.object({values:h.array(h.object({id:h.string(),name:h.string(),description:h.string().optional()})).optional(),default:h.array(h.string()).default([]),required:h.array(h.string()).optional(),separator:h.string().default(" "),docs:h.url().optional()}),Xu=h.string().min(1).max(4096),Bx=h.union([h.string(),h.array(h.string()).min(1)]),Pn="urn:ietf:params:oauth:grant-type:device_code",She=h.object({browserTokenExchange:h.enum(["available","unavailable","unknown"]).optional(),application:h.enum(["required","implicit"]).default("required"),grantType:h.enum(["authorization_code","client_credentials",Pn]).optional(),issuer:h.url().optional(),registrationUrl:h.url().optional(),authorizeUrl:Xu.optional(),deviceAuthorizationUrl:Xu.optional(),tokenUrl:Xu,identity:h.object({url:Xu.optional(),from:h.enum(["token","app"]).optional(),method:h.enum(["GET","POST"]).default("GET"),id:Bx.default("/id"),name:Bx.default("/name"),headers:h.record(h.string(),h.string()).default({})}).optional(),clientAuth:h.enum(["body","basic","none"]).default("body"),pkce:h.boolean().default(!0),tokenFormat:h.enum(["form","json"]).default("form"),okPointer:h.string().optional(),authorizeParams:h.record(h.string(),h.string()).default({}),tokenParams:h.record(h.string(),h.string()).default({}),defaults:h.record(h.string(),h.string()).default({}),scopes:uN.default({default:[],separator:" "}),fields:h.array(Kx).default([]),outputs:cN.default({ACCESS_TOKEN:"/accessToken"}),adapter:h.string().regex(/^[a-z][a-z0-9_-]{0,99}$/).optional(),keep:h.array(h.string()).default([]),hint:h.string().optional()}).refine(t=>t.grantType==="client_credentials"||t.grantType===Pn||!!t.authorizeUrl,{path:["authorizeUrl"],message:"An authorization code flow requires an authorization URL."}).refine(t=>t.grantType!==Pn||!!t.deviceAuthorizationUrl,{path:["deviceAuthorizationUrl"],message:"A device flow requires a device authorization URL."}),xhe=h.object({fields:h.array(Kx).min(1),outputs:_he,resolver:h.literal("vultr-role").optional(),bindFields:h.boolean().optional(),constants:h.record(h.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),h.string()).optional(),files:h.array(h.string().regex(/^[A-Z_][A-Z0-9_]*$/)).max(32).optional(),account:h.object({field:h.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),pointer:h.string().max(1e3)}).strict().optional(),identity:h.object({url:Xu,headers:h.record(h.string(),h.string()),id:Bx,name:Bx}).strict().optional(),console:h.url().optional(),instructions:h.string().optional(),hint:h.string().optional()}).superRefine((t,e)=>{t.files?.some(r=>!Object.hasOwn(t.outputs,r))&&e.addIssue({code:"custom",path:["files"],message:"Deliver only declared outputs as files."}),t.account&&!t.fields.some(r=>r.name===t.account.field)&&e.addIssue({code:"custom",path:["account"],message:"Read the account from a declared field."})}),lN=h.enum(["oauth","token","aws","ovh","approval"]),Ehe=h.object({hint:h.string().optional()}).strict(),khe=h.object({authorization:h.enum(["api_key","consumer_key"]),apiBaseUrl:Xu,fields:h.array(Kx).min(1),scopes:uN.default({default:[],separator:`
129
- `}),outputs:cN,hint:h.string().optional()}).strict(),wg={name:me,docs:h.url().optional(),console:Xu.optional(),preparation:h.object({scopeSelection:h.enum(["optional","required","hidden"]).default("optional"),instructions:h.array(h.union([h.string().max(2e3),h.object({ja:h.string().max(2e3),en:h.string().max(2e3)}).strict()])).max(10).default([]),docs:h.boolean().default(!1)}).strict().optional()},qx=h.object({...wg,kind:h.literal("oauth"),config:She}).strict(),Zx=h.object({...wg,kind:h.literal("token"),config:xhe}).strict(),Wx=h.object({...wg,kind:h.literal("aws"),config:Ehe}).strict(),Jx=h.object({...wg,kind:h.literal("ovh"),config:khe}).strict(),Gx=h.object({...wg,kind:h.literal("approval"),config:h.object({adapter:h.literal("runpod-flash"),fields:h.array(Kx).default([]),scopes:uN.default({default:[],separator:" "}),outputs:cN,hint:h.string().optional()}).strict()}).strict(),dp=h.discriminatedUnion("kind",[qx,Zx,Wx,Jx,Gx]),gg={id:h.string().min(1),builtin:h.boolean(),availability:h.enum(["ready","app-required","unavailable"]),defaultName:me,registration:h.object({kind:h.enum(["input","authorization"]),device:h.enum(["browser","cli"]),browserExchange:h.enum(["available","unavailable","unknown"]),tokenAlternatives:h.array(h.string())}).strict()},ii=h.discriminatedUnion("kind",[qx.extend(gg),Zx.extend(gg),Wx.extend(gg),Jx.extend(gg),Gx.extend(gg)]),yg=h.string().regex(/^[a-z][a-z0-9_-]{0,79}$/),dN=h.object({name:me,logo:h.string().regex(/^[a-z0-9-]+$/).optional(),api:h.url().optional(),docs:h.url().optional(),console:h.url().optional(),targets:h.array(h.object({id:yg,name:me,api:h.url().optional(),methods:h.array(yg).min(1)}).strict()).max(32).optional()}).strict(),Ihe=dN.extend({methods:h.record(yg,h.string().min(1))}).strict(),hK=dN.extend({methods:h.record(yg,h.union([h.string().min(1),dp]))}).strict(),gK=dN.extend({id:h.string(),builtin:h.boolean(),methods:h.record(yg,ii)}),$he=h.object({id:E,output:h.string().min(1).max(100).optional()}).strict(),yK=t=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)&&!/^(FOUNDATION_|LD_|DYLD_)|^(NODE_OPTIONS|BASH_ENV|ENV|PYTHONSTARTUP|GIT_CONFIG_COUNT|GIT_CONFIG_SYSTEM)$/u.test(t),vK=h.object({name:h.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/),source:$he,format:h.enum(["text","file","json"]).optional(),pointer:h.string().optional()}).strict(),ca={id:E,ownerId:E,name:me,createdAt:Ve,updatedAt:Ve,version:h.number().int().positive(),permissions:h.array(lK)},pN={recipients:h.array(E).default([]),custodyRevision:h.number().int().positive().nullable().default(null)},Ahe=h.object({...ca,kind:h.literal("variable"),data:h.object({...pN,bytes:h.number().int().nonnegative()})}),The=h.object({...ca,kind:h.literal("connection"),data:h.object({...pN,methodId:h.string(),fields:h.record(h.string(),h.string()).default({}),settings:h.array(h.object({name:h.string(),label:h.string(),value:h.string()})).default([]),methodName:h.string(),methodKind:lN,services:h.array(h.object({id:h.string(),name:me})).default([]),account:h.string(),accountId:h.string().nullable().default(null),accountVerified:h.boolean().default(!1),scopes:h.array(h.string()),scopesStatus:h.enum(["unknown","requested","reported"]).default("unknown"),outputs:h.array(h.string()),state:h.enum(["ready","reconnect","review","disconnecting","uncertain"]),appId:E.nullable(),generation:E.optional(),authorizationDigest:h.string().optional(),aws:Vx.optional(),ovh:hg.optional()})}),Phe=h.object({...ca,kind:h.literal("service"),data:Ihe}),Rhe=h.object({...ca,kind:h.literal("method"),data:dp}),Che=h.object({...ca,kind:h.literal("app"),data:h.object({...pN,methodId:h.string(),clientId:h.string(),fields:h.record(h.string(),h.string()).default({}),generation:E.optional()})}),Ohe=h.object({...ca,kind:h.literal("object"),data:h.object({size:h.number().int().nonnegative(),contentType:h.string()})}),Nhe=h.object({...ca,kind:h.literal("keyring"),data:h.object({revision:h.number().int().positive(),signature:h.string()})}),Dhe=h.object({publicKey:ig,algorithm:h.string(),fingerprint:mx,purpose:h.string().max(500),privateKeyId:E.nullable(),revokedAt:Ve.nullable()}),zhe=h.object({...ca,kind:h.literal("ssh_key"),data:Dhe}),jhe=h.object({address:px,port:h.number().int().min(1).max(65535),hostKeys:h.array(ig).min(1).max(16),authorizedKeysFile:fx}),Mhe=h.object({...ca,kind:h.literal("ssh_host"),data:jhe}),mt=h.discriminatedUnion("kind",[Ahe,The,Phe,Rhe,Che,Ohe,Nhe,zhe,Mhe]),rHe=h.discriminatedUnion("kind",[h.object({kind:h.literal("service"),name:me,definition:hK}).strict(),h.object({kind:h.literal("method"),name:me,definition:dp}).strict()]),nHe=h.object({version:h.number().int().positive(),name:me.optional(),definition:h.union([hK,dp]).optional()}).strict(),vo=h.object({name:h.string().regex(/^[a-z][a-z0-9]*(?:\.[a-z][a-z0-9]*)+$/),input:xr}).strict(),fN=vo.extend({inputs:h.array(h.object({pointer:h.string(),label:h.string().min(1).max(100),secret:h.boolean().default(!1),multiline:h.boolean().default(!1),site:h.url().optional()}).strict()).max(16).default([])}),Xx=h.object({ja:h.string(),en:h.string()}).strict(),Hx=h.object({id:E,name:me}),wK=h.discriminatedUnion("kind",[h.object({kind:h.literal("line"),subject:Hx,relation:aN,object:Hx}),h.object({kind:h.literal("transfer"),item:Hx,to:Hx})]),oHe=h.object({id:E,name:me,publicKey:fn,state:h.enum(["pending","approving","approved"]),principalId:E.nullable(),createdAt:Ve,expiresAt:Ve}),iHe=h.object({available:h.boolean(),required:h.boolean(),active:h.boolean(),payer:Yu.pick({id:!0,name:!0}).nullable()}),sHe=h.object({storageBytes:h.number().nonnegative(),storageLimit:h.number().positive(),month:h.string()}),aHe=h.object({id:h.string(),actorId:E.nullable(),action:h.string(),targetId:E.nullable(),createdAt:Ve,details:xr}),cHe=h.object({returnUrl:h.url().optional(),refreshUrl:h.url().optional()}).strict(),Qt=t=>h.object({items:h.array(t),next:h.string().nullable().default(null)}),uHe=h.object({id:E}),lHe=h.object({owner:E}),Uhe=h.object({limit:h.coerce.number().int().min(1).max(200).default(100),after:h.string().optional()}),dHe=Uhe.extend({object:E.optional(),subject:E.optional(),relation:aN.optional(),objectType:fK.optional()}).refine(t=>!!t.object!=!!t.subject,"Choose the object or the subject of the lines.");var Lhe=new TextEncoder,Fhe=new TextDecoder,bg="ECDH-ES+A256KW",mN="A256GCM",Et=t=>Lhe.encode(t),qt=t=>Fhe.decode(t);function Qu(t){let e="";for(let r=0;r<t.length;r+=8192)e+=String.fromCharCode(...t.subarray(r,r+8192));return btoa(e).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function Yx(t){return Uint8Array.from(atob(t.replaceAll("-","+").replaceAll("_","/")),e=>e.charCodeAt(0))}async function Qx(){let t=await mg(bg,{crv:"P-256",extractable:!0});return{publicKey:fn.parse(await oc(t.publicKey)),privateKey:await oc(t.privateKey)}}async function el(t,e,r){if(!e.length||new Set(e.map(n=>n.id)).size!==e.length)throw new Error("Recipients must be distinct and nonempty.");let o=new lg(t).setProtectedHeader({enc:mN}).setAdditionalAuthenticatedData(Et(r));for(let n of e)o.addRecipient(await yo(n.publicKey,bg)).setUnprotectedHeader({alg:bg,kid:n.id});return Fr.parse(await o.encrypt())}async function wo(t,e,r,o){if(t.aad!==Qu(Et(o)))throw new Error("The encrypted content belongs to a different item.");let n=t.recipients.find(a=>a.header.kid===r);if(!n)throw new Error("This principal cannot decrypt the content.");let i=e instanceof CryptoKey?e:await yo(e,bg);return(await WO({...t,recipients:[n]},i,{keyManagementAlgorithms:[bg],contentEncryptionAlgorithms:[mN]})).plaintext}async function Vhe(t){let e=await crypto.subtle.importKey("raw",new Uint8Array(t),"HKDF",!1,["deriveBits"]);return new Uint8Array(await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:Et("Foundation"),info:Et("passkey encryption key")},e,256))}async function bK(t,e,r){let o=await ug(t,await Vhe(e),{keyManagementAlgorithms:["dir"],contentEncryptionAlgorithms:[mN]});if(o.protectedHeader.sub!==r)throw new Error("The key belongs to a different principal.");return JSON.parse(qt(o.plaintext))}var Vr=h.string().regex(/^[A-Za-z0-9_-]{43}$/),tr=h.string().min(100).max(4e6),_K=fn.extend({d:h.string().regex(/^[A-Za-z0-9_-]{43}$/)}),tl=h.object({encryption:_K,signing:_K}).strict(),si=h.object({id:E,principalId:E,generation:h.number().int().positive(),previous:Vr.nullable(),encryption:fn,signing:fn}).strict();function M(t){if(t===null||typeof t=="boolean"||typeof t=="number"&&Number.isFinite(t)||typeof t=="string"&&!/[\uD800-\uDFFF]/u.test(t))return JSON.stringify(t);if(Array.isArray(t))return"["+Array.from(t,M).join(",")+"]";if(t&&typeof t=="object"&&Object.getPrototypeOf(t)===Object.prototype)return"{"+Object.keys(t).sort().map(e=>{if(/[\uD800-\uDFFF]/u.test(e))throw new Error("Use Unicode property names.");return JSON.stringify(e)+":"+M(t[e])}).join(",")+"}";throw new Error("Use finite numbers, Unicode strings, arrays, and plain JSON objects.")}async function bo(t){return iN(fn.parse({kty:t.kty,crv:t.crv,x:t.x,y:t.y}),"sha256")}async function vt(t){return Qu(new Uint8Array(await crypto.subtle.digest("SHA-256",Et(M(t)))))}async function ic(t){let e=new Uint8Array(await crypto.subtle.digest("SHA-256",Et(M(t))));return"sha256:"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}async function e0(){let[t,e]=await Promise.all([Qx(),mg("ES256",{crv:"P-256",extractable:!0})]),r=await oc(e.privateKey);return tl.parse({encryption:t.privateKey,signing:r})}function pp(t){return fn.parse({kty:t.kty,crv:t.crv,x:t.x,y:t.y})}function t0(t,e){return si.parse({id:crypto.randomUUID(),principalId:t,generation:1,previous:null,encryption:pp(e.encryption),signing:pp(e.signing)})}async function rr(t,e,r){let o=e instanceof CryptoKey?e:await yo(e,"ES256");return new pg(Et(M(t))).setProtectedHeader({alg:"ES256",typ:"foundation."+r+"+jws"}).sign(o)}async function Yi(t,e,r,o){if(M(await hN(e,r,o))!==M(t))throw new Error("The signature does not authorize this content.")}async function hN(t,e,r){let o=await rN(t,await yo(fn.parse(e),"ES256"),{algorithms:["ES256"]});if(o.protectedHeader.typ!=="foundation."+r+"+jws"||Object.keys(o.protectedHeader).some(s=>!["alg","typ"].includes(s)))throw new Error("The signature does not authorize this content.");let n=new TextDecoder("utf-8",{fatal:!0}).decode(o.payload),i=JSON.parse(n);if(M(i)!==n)throw new Error("Sign canonical JSON content.");return i}var er=h.object({binding:si,signature:tr}).strict(),r0=h.object({previous:er,replacement:er,previousSignature:tr}).strict();async function _g(t,e,r){let o=t;for(let n of[...r].sort((i,s)=>i.replacement.binding.generation-s.replacement.binding.generation)){if(M(n.previous.binding)!==M(o))continue;let i=n.replacement.binding;if(i.principalId!==o.principalId||i.id===o.id||i.generation!==o.generation+1||i.previous!==await vt(o))return!1;if(await fp(n.previous),await fp(n.replacement),await Yi(i,n.previousSignature,o.signing,"key-replacement"),o=i,M(o)===M(e))return!0}return!1}async function mp(t,e){if(await hp(t),await bo(e.encryption)!==await bo(t.encryption)||await bo(e.signing)!==await bo(t.signing))throw new Error("The private keys do not match this identity.");return{binding:t,signature:await rr(t,e.signing,"key-binding")}}async function hp(t){let e=si.parse(t);if(e.generation===1!=(e.previous===null))throw new Error("Link each replacement key to its preceding binding.");if(await bo(e.encryption)===await bo(e.signing))throw new Error("Use separate encryption and signing keys.");await yo(e.encryption,"ECDH-ES+A256KW"),await yo(e.signing,"ES256")}async function fp(t){let{binding:e,signature:r}=er.parse(t);return await hp(e),await Yi(e,r,e.signing,"key-binding"),e}var Hhe=h.object({requestedAt:Ve,readyAt:Ve}).strict(),Bhe=h.object({email:h.boolean(),storage:h.boolean(),payments:h.boolean()}),n0=h.object({principal:Yu.nullable(),credentialId:E.nullable(),wrappedKey:vg.nullable(),requestId:E.nullable(),keyReset:Hhe.nullable(),server:h.object({name:me}),features:Bhe,principals:h.array(Yu)}),EHe=h.object({email:h.email().max(254),returnTo:h.string().max(2048).optional(),locale:uK.default("ja"),principalId:E.optional()}).strict(),kHe=h.object({intent:h.enum(["register","authenticate"]),name:me.optional(),principalId:E.optional(),credentialId:E.optional(),returnTo:h.string().max(2048).optional()}).strict(),IHe=h.object({challengeId:E,credential:h.json(),binding:er.optional(),existingPublicKey:fn.optional(),wrappedKey:vg.optional()}).strict(),$He=h.object({binding:er,wrappedKey:vg}).strict();import{createInterface as qhe}from"node:readline/promises";var xK=h.object({action:h.string().regex(/^[a-z][a-zA-Z]*(\.[a-z][a-zA-Z]*)+$/).max(64),principalId:E}).catchall(Zn),EK=h.enum(["signature","decryption","email","passkey"]),Khe=h.object({confirmationId:E,principalId:E,credentialId:E,bindingId:E.nullable(),operation:h.string(),nonce:h.string()}).strict(),SK=h.object({id:E,operation:xK,methods:h.array(EK),state:h.enum(["pending","confirmed","held"]),expiresAt:Ve,challenge:Khe,sealed:Fr.nullable()}).strict(),CHe=h.discriminatedUnion("method",[h.object({method:h.literal("signature"),signature:tr}).strict(),h.object({method:h.literal("decryption"),secret:h.string().min(1).max(200)}).strict(),h.object({method:h.literal("email"),code:h.string().min(1).max(32)}).strict(),h.object({method:h.literal("passkey"),credential:h.json()}).strict()]),kK=h.object({operation:xK,methods:h.array(EK)}),IK="foundation-confirmation",$K=["confirmation_required","confirmation_invalid"],AK=(t,e)=>rr(t.challenge,e,"operation-confirmation"),TK=t=>"operation-confirmation:"+t;async function PK(t,e,r){let o=await t.json("/api/confirmations",{method:"POST",body:{operation:e.operation}},SK);return await t.json("/api/confirmations/"+o.id+"/proof",{method:"POST",body:await r(o,t)},SK),o.id}var ai=class extends Error{constructor(r,o,n,i){super(n);this.code=r;this.status=o;this.details=i}code;status;details},Qi=class{constructor(e){this.identity=e}identity;async response(e,r={}){if(!e.startsWith("/api/")||e.includes("\\")||/[\u0000-\u001f]/.test(e))throw new Error("Use a path beginning with /api/.");let o=new URL(e,this.identity.origin);if(o.origin!==this.identity.origin)throw new Error("Use a path on the configured Foundation origin.");let n;try{n=await fetch(o,{method:r.method??"GET",headers:{authorization:"Bearer "+this.identity.token,...r.confirmation?{[IK]:r.confirmation}:{},...r.raw?{"content-type":"application/octet-stream"}:r.body!==void 0?{"content-type":"application/json"}:{}},body:r.raw?new Uint8Array(r.raw):r.body!==void 0?JSON.stringify(r.body):void 0,redirect:"error",signal:AbortSignal.any([AbortSignal.timeout(9e4),...r.signal?[r.signal]:[]])})}catch{throw new Error("Could not reach Foundation. Check the origin and your network connection.")}if(!n.ok){let i;try{i=h.object({error:h.object({code:h.string(),message:h.string(),details:h.unknown().optional()})}).parse(await n.json())}catch{throw new ai("http_error",n.status,"Foundation returned HTTP "+n.status+".")}let s=kK.safeParse(i.error.details);if(!r.confirmation&&$K.includes(i.error.code)&&s.success)return this.response(e,{...r,confirmation:await this.confirm(s.data)});throw new ai(i.error.code,n.status,i.error.message,i.error.details)}return n}confirm(e){return PK(this,e,async r=>{let{keys:o,binding:n}=this.identity;if(r.methods.includes("signature")&&o&&n?.id===r.challenge.bindingId)return{method:"signature",signature:await AK(r,o.signing)};if(r.methods.includes("decryption")&&o&&r.sealed)return{method:"decryption",secret:qt(await wo(r.sealed,o.encryption,r.id,TK(r.id)))};if(r.methods.includes("email")&&process.stdin.isTTY&&process.stderr.isTTY){let{email:i}=await this.json("/api/confirmations/"+r.id+"/email",{method:"POST",body:{}}),s=qhe({input:process.stdin,output:process.stderr});try{return{method:"email",code:await s.question("Enter the confirmation code sent to "+i+": ")}}finally{s.close()}}throw new ai("confirmation_required",403,"Prove confirmation "+r.id+" with "+r.methods.join(" or ")+" through /api/confirmations/"+r.id+", then send the same request again with it (foundation api --confirmation "+r.id+").",{...e,confirmationId:r.id})})}async json(e,r={},o){let n=await this.response(e,r),i=n.status===204?null:await n.json();return o?o.parse(i):i}async session(){return this.json("/api/session",{},n0)}};import{rm as bge,stat as _ge}from"node:fs/promises";import{dirname as Sge,join as EN}from"node:path";import{chmod as Zhe,lstat as Whe,mkdir as Jhe,open as gN,readFile as CK,rename as Ghe,rm as Xhe}from"node:fs/promises";import{dirname as Yhe,join as yN,resolve as Qhe}from"node:path";import{homedir as ege}from"node:os";import{randomUUID as tge}from"node:crypto";var vN=h.object({origin:h.url(),principalId:h.uuid(),token:h.string().min(20),keys:tl.nullable(),binding:si.nullable()}).strict().refine(t=>!!t.keys==!!t.binding&&(!t.binding||t.binding.principalId===t.principalId),"Use the keys bound to this identity."),OK=h.object({current:h.uuid(),identities:h.array(vN).min(1)}).strict().refine(t=>t.identities.some(e=>e.principalId===t.current),"The current identity is missing.");function ci(){return yN(process.env.XDG_CONFIG_HOME||yN(ege(),".config"),"foundation","identity.json")}function gp(t=process.env.FOUNDATION_ORIGIN||"https://foundationsystems.app"){let e;try{e=new URL(t)}catch{throw new Error("Set FOUNDATION_ORIGIN to an HTTPS origin.")}if(e.username||e.password||e.pathname!=="/"||e.search||e.hash||e.protocol!=="https:"&&!(e.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(e.hostname)))throw new Error("Use an HTTPS origin, or HTTP on localhost.");return e.origin}async function wN(){try{let t=ci(),e=await Whe(t);if(!e.isFile()||e.isSymbolicLink())throw new Error("The identity must be a regular file.");return process.platform!=="win32"&&e.mode&63&&await Zhe(t,384),OK.parse(JSON.parse(await CK(t,"utf8")))}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return;throw new Error("The saved identity could not be read. Check its contents and permissions.")}}async function NK(){let t=await wN();return(t?.identities??[]).map(e=>({...e,current:e.principalId===t.current}))}async function DK(t){let e=await wN();if(!e?.identities.some(r=>r.principalId===t))throw new Error("No saved identity has principal "+t+". Run foundation identity list.");await ua(ci(),JSON.stringify({...e,current:t},null,2)+`
128
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of t.seen.entries()){let a=s[1];if(e===s[0]){i(s);continue}if(t.external){let u=t.external.registry.get(s[0])?.id;if(e!==s[0]&&u){i(s);continue}}if(t.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}a.count>1&&t.reused==="ref"&&i(s)}t.external&&(t.sharedDefsExtractedFor=t.external)}function UV(t){let e=t.anyOf;if(!Array.isArray(e)||e.length===0||t.type!==void 0)return;let r=[];for(let o of e){if(!o||typeof o!="object")return;UV(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let i=o.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete t.anyOf,t.type=r.length===1?r[0]:r}var LV=new Set(["type","properties","required","additionalProperties"]),jV=["oneOf","anyOf"];function MV(t){let e=t.additionalProperties;return e===void 0||e===!1||typeof e!="object"||e===null?null:Object.keys(e).length?e:null}function HR(t){let e=[];for(let i of t){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!LV.has(s))return null;e.push(i)}let r={},o=new Set;for(let i of e){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let a=[];for(let u of e){let l=u.properties?.[s]??MV(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:HR(a)??{allOf:a};vr(r,s,c)}for(let s of i.required??[])o.add(s)}let n={type:"object",properties:r};if(o.size&&(n.required=[...o]),e.every(i=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let s of e){let a=MV(s);a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a))&&i.push(a)}i.length===1?n.additionalProperties=i[0]:i.length>1&&(n.additionalProperties={allOf:i})}return n}function mme(t){let e=t.allOf;if(!Array.isArray(e)||e.length<2)return;for(let n of LV)if(n in t)return;let r=e.filter(n=>jV.some(i=>Array.isArray(n[i]))),o=null;if(!r.length)o=HR(e);else{let n=r[0],i=jV.find(c=>Array.isArray(n[c]));if(Object.keys(n).length!==1)return;let s=e.filter(c=>c!==n),a=n[i].map(c=>HR([...s,c]));if(a.some(c=>!c))return;o={[i]:a}}o&&(delete t.allOf,Hh(t,o))}function Ja(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=t.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let p=t.seen.get(d),m=p.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Hh(u,m),Hh(u,l),a._zod.parent===d)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(m.$ref&&p.def)for(let y in u)y==="$ref"||y==="allOf"||y in p.def&&JSON.stringify(u[y])===JSON.stringify(p.def[y])&&delete u[y]}let f=a._zod.parent;if(f&&f!==d){o(f);let p=t.seen.get(f);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(let m in u)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(u[m])===JSON.stringify(p.def[m])&&delete u[m]}t.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let a of[...t.seen.entries()].reverse())o(a[0]);if(t.target!=="openapi-3.0")for(let a of t.seen.entries())UV(a[1].def??a[1].schema);for(let a of t.deferred)a();if(t.intersections.length){let a=new Map;for(let c of t.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(u):a.set(l,[u])}for(let c of t.intersections)for(let u of a.get(c)??[])mme(u)}}let n={};if(t.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=t.external.uri(a)}Hh(n,r.defId?r.schema:r.def??r.schema);let i=t.metadataRegistry.get(e)?.id;i!==void 0&&n.id===i&&delete n.id;let s=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,vr(s,c.defId,c.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(s).length>0&&(t.target==="draft-2020-12"?n.$defs=s:n.definitions=s);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Hd(e,"input",t.processors),output:Hd(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ln(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ln(o.element,r);if(o.type==="set")return ln(o.valueType,r);if(o.type==="lazy")return ln(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return ln(o.innerType,r);if(o.type==="intersection")return ln(o.left,r)||ln(o.right,r);if(o.type==="record"||o.type==="map")return ln(o.keyType,r)||ln(o.valueType,r);if(o.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:ln(o.in,r)||ln(o.out,r);if(o.type==="object"){for(let n in o.shape)if(ln(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ln(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ln(n,r))return!0;return!!(o.rest&&ln(o.rest,r))}return!1}var BR=(t,e={})=>r=>{let o=Za({...r,processors:e});return et(t,o),Wa(o,t),Ja(o,t)},Hd=(t,e,r={})=>o=>{let{libraryOptions:n,target:i}=o??{},s=Za({...n??{},target:i,io:e,processors:r});return et(t,s),Wa(s,t),Ja(s,t)};var Bd=(t,e,r)=>{(t[e]===void 0||r>t[e])&&(t[e]=r)},Kd=(t,e,r)=>{(t[e]===void 0||r<t[e])&&(t[e]=r)},FV=(t,e)=>{Bd(t,"minimum",e),Kd(t,"maximum",e)},KV=(t,e)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(e)||t.multipleOf.push(e)},qV=(t,e)=>{t.patterns??(t.patterns=new Set),t.patterns.add(e)},ZV=(t,e)=>{t.mime=t.mime?t.mime.filter(r=>e.includes(r)):[...e]},WV=(t,e)=>{t.format=e,e.includes("int")&&(t.isInt=!0)},VV=(t,e)=>Bd(t,"minimum",e.minimum),HV=(t,e)=>Kd(t,"maximum",e.maximum),BV=t=>(e,r)=>{WV(e,r.format);let[o,n]=t[r.format];Bd(e,"minimum",o),Kd(e,"maximum",n)},hme={greater_than:(t,e)=>Bd(t,e.inclusive?"minimum":"exclusiveMinimum",e.value),less_than:(t,e)=>Kd(t,e.inclusive?"maximum":"exclusiveMaximum",e.value),multiple_of:(t,e)=>KV(t,e.value),number_format:BV(qm),bigint_format:BV(Zm),min_length:VV,max_length:HV,length_equals:(t,e)=>FV(t,e.length),min_size:VV,max_size:HV,size_equals:(t,e)=>FV(t,e.size),string_format:(t,e)=>{WV(t,e.format),e.pattern&&qV(t,e.pattern),(e.format==="base64"||e.format==="base64url")&&(t.contentEncoding=e.format),(e.local||e.precision===-1)&&(t.laxFormat=!0)},mime_type:(t,e)=>ZV(t,e.mime)};function Yt(t){let e={},r=t._zod.def,o=t._zod.traits.has("$ZodCheck")?[t,...r.checks??[]]:r.checks??[];for(let i of o)hme[i._zod.def.check]?.(e,i._zod.def);let n=t._zod.bag;n.minimum!==void 0&&Bd(e,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&Bd(e,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&Kd(e,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&Kd(e,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&KV(e,n.multipleOf),n.format!==void 0&&(e.format??(e.format=n.format),n.format.includes("int")&&(e.isInt=!0)),n.mime&&ZV(e,n.mime);for(let i of n.patterns??[])qV(e,i);return e}var gme={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yme=new Map([[qb,TP],[ch,PP]]),JV=t=>yme.get(t)??t,ZR=(t,e,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=Yt(t);if(typeof i=="number"&&(n.minLength=i),typeof s=="number"&&(n.maxLength=s),a&&(n.format=gme[a]??a,n.format===""&&delete n.format,(a==="time"||l)&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let d=[...c].map(JV);d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(f=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},WR=(t,e,r,o)=>{let n=r,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=Yt(t);n.type=l?"integer":"number";let d=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),p=e.target==="draft-04"||e.target==="openapi-3.0";if(d?p?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u:typeof i=="number"&&(n.minimum=i),f?p?(n.maximum=c,n.exclusiveMaximum=!0):n.exclusiveMaximum=c:typeof s=="number"&&(n.maximum=s),a){let m=new Set;for(let w of a)Number.isFinite(w)&&w!==0?m.add(Math.abs(w)):Xt(t,e,n,o,`A multipleOf divisor of ${w} cannot be represented in JSON Schema`);let[g,...y]=m;g!==void 0&&(n.multipleOf=g),y.length&&(n.allOf=[...n.allOf??[],...y.map(w=>({multipleOf:w}))])}},JR=(t,e,r,o)=>{r.type="boolean"},GR=(t,e,r,o)=>{Xt(t,e,r,o,"BigInt cannot be represented in JSON Schema")},XR=(t,e,r,o)=>{Xt(t,e,r,o,"Symbols cannot be represented in JSON Schema")},YR=(t,e,r,o)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},QR=(t,e,r,o)=>{Xt(t,e,r,o,"Undefined cannot be represented in JSON Schema")},eC=(t,e,r,o)=>{Xt(t,e,r,o,"Void cannot be represented in JSON Schema")},tC=(t,e,r,o)=>{r.not={}},rC=(t,e,r,o)=>{},nC=(t,e,r,o)=>{},oC=(t,e,r,o)=>{Xt(t,e,r,o,"Date cannot be represented in JSON Schema")},iC=(t,e,r,o)=>{let n=t._zod.def,i=od(n.entries);if(i.length===0){r.not={};return}i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},sC=(t,e,r,o)=>{let n=t._zod.def;if(n.values.length===0){r.not={};return}let i=[];for(let s of n.values)if(s===void 0){if(Xt(t,e,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(Xt(t,e,r,o,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];r.type=s===null?"null":typeof s,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},aC=(t,e,r,o)=>{Xt(t,e,r,o,"NaN cannot be represented in JSON Schema")},cC=(t,e,r,o)=>{let n=r,i=t._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},uC=(t,e,r,o)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=Yt(t);i!==void 0&&(n.minLength=i),s!==void 0&&(n.maxLength=s),a&&(a.length===0?n.not={}:a.length===1?n.contentMediaType=a[0]:n.anyOf=a.map(c=>({contentMediaType:c})))},lC=(t,e,r,o)=>{r.type="boolean"},dC=(t,e,r,o)=>{Xt(t,e,r,o,"Custom types cannot be represented in JSON Schema")},pC=(t,e,r,o)=>{Xt(t,e,r,o,"Function types cannot be represented in JSON Schema")},fC=(t,e,r,o)=>{Xt(t,e,r,o,"Transforms cannot be represented in JSON Schema")},mC=(t,e,r,o)=>{Xt(t,e,r,o,"Map cannot be represented in JSON Schema")},hC=(t,e,r,o)=>{Xt(t,e,r,o,"Set cannot be represented in JSON Schema")},gC=(t,e,r,o)=>{let n=r,i=t._zod.def,{minimum:s,maximum:a}=Yt(t);typeof s=="number"&&(n.minItems=s),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=et(i.element,e,{...o,path:[...o.path,"items"]})};function Bh(t){let e=t._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?Bh(e.out):e.type==="catch"?Bh(e.innerType):t._zod.optin}var yC=(t,e,r,o)=>{let n=r,i=t._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Xt(t,e,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in s)vr(n.properties,u,et(s[u],e,{...o,path:[...o.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];(e.io==="input"?Bh(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(n.required=c),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=et(i.catchall,e,{...o,path:[...o.path,"additionalProperties"]})):e.io==="output"&&(n.additionalProperties=!1)},DS=(t,e,r,o)=>{let n=t._zod.def,i=n.inclusive===!1,s=n.options.map((a,c)=>et(a,e,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=s:r.anyOf=s},vC=(t,e,r,o)=>{let n=t._zod.def,i=et(n.left,e,{...o,path:[...o.path,"allOf",0]}),s=et(n.right,e,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c,e.intersections.push(c)},wC=(t,e,r,o)=>{let n=r,i=t._zod.def;n.type="array";let s=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((g,y)=>et(g,e,{...o,path:[...o.path,s,y]})),u=i.rest?et(i.rest,e,{...o,path:[...o.path,a,...e.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let g=i.items[l-1];if(!(e.io==="input"?Bh(g)!==void 0:g._zod.optout==="optional"))break;l--}let d=i.items.length,f=!i.rest;e.target==="draft-2020-12"?(n.prefixItems=c,f?n.items=!1:u&&(n.items=u),l>0&&(n.minItems=l),f&&(n.maxItems=d)):e.target==="openapi-3.0"?(n.items={anyOf:c},u&&n.items.anyOf.push(u),l>0&&(n.minItems=l),f&&(n.maxItems=d)):(n.items=c,f?n.additionalItems=!1:u&&(n.additionalItems=u),l>0&&(n.minItems=l),f&&(n.maxItems=d));let{minimum:p,maximum:m}=Yt(t);typeof p=="number"&&(n.minItems=p),typeof m=="number"&&(n.maxItems=m)};function KR(t,e,r){if(e.$ref){if(r.has(e))return e;r.add(e);let m=t.get(e)?.def;if(!m)return e;let g=KR(t,m,r);return g===m?e:g}for(let m of["anyOf","oneOf"]){let g=e[m];if(!Array.isArray(g))continue;let y=g.map(w=>KR(t,w,r));y.some((w,b)=>w!==g[b])&&(e={...e,[m]:y})}let o=Array.isArray(e.type)?e.type:[e.type],n=!o.includes("string")&&o.some(m=>m==="number"||m==="integer"),i=e.enum??(e.const!==void 0?[e.const]:void 0);if(!n&&!i?.some(m=>typeof m=="number"))return e;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:f,...p}=e;return p.enum?p.enum=p.enum.map(m=>typeof m=="number"?String(m):m):typeof p.const=="number"&&(p.const=String(p.const)),n&&(p.type="string",i||(p.pattern=(o.includes("number")?ta:th).source)),p}var qR=new WeakMap;function vme(t){let e=new Map;for(let o of t.seen.values())o.def&&!e.has(o.schema)&&e.set(o.schema,o);let r=new Map;for(let o of qR.get(t)??[]){let n=t.seen.get(o),i=(n?.def??n?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=KR(e,i,new Set);s!==i&&r.set(i,s)}if(r.size)for(let o of t.seen.values())for(let n of[o.schema,o.def]){let i=n&&r.get(n.propertyNames);i&&(n.propertyNames=i)}}var bC=(t,e,r,o)=>{let n=r,i=t._zod.def;n.type="object";let s=i.keyType,a=Yt(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=et(i.valueType,e,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of a)vr(n.patternProperties,JV(d).source,l)}else{if(e.target==="draft-07"||e.target==="draft-2020-12"){n.propertyNames=et(i.keyType,e,{...o,path:[...o.path,"propertyNames"]});let l=qR.get(e);l||(l=[],qR.set(e,l),e.deferred.push(()=>vme(e))),l.push(t)}n.additionalProperties=et(i.valueType,e,{...o,path:[...o.path,"additionalProperties"]})}let c=s._zod.values,u=e.io==="input"&&Bh(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l.map(String))}},_C=(t,e,r,o)=>{let n=t._zod.def,i=et(n.innerType,e,o),s=e.seen.get(t);e.target==="openapi-3.0"?(s.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},SC=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType},xC=Symbol();function GV(t,e,r,o,n){let i=!1,s=JSON.stringify(t,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(Xt(e,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),xC):JSON.parse(s)}var EC=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType;let s=GV(n.defaultValue,t,e,r,o);s!==xC&&(r.default=s)},kC=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);if(i.ref=n.innerType,e.io!=="input")return;let s=GV(n.defaultValue,t,e,r,o);s!==xC&&(r._prefault=s)},IC=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{Xt(t,e,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},$C=(t,e,r,o)=>{let n=t._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=e.io==="input"?i?n.out:n.in:n.out;et(s,e,o);let a=e.seen.get(t);a.ref=s},AC=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType,r.readOnly=!0},TC=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType},zS=(t,e,r,o)=>{let n=t._zod.def;et(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType},PC=(t,e,r,o)=>{let n=t._zod.innerType;et(n,e,o);let i=e.seen.get(t);i.ref=n},NS={string:ZR,number:WR,boolean:JR,bigint:GR,symbol:XR,null:YR,undefined:QR,void:eC,never:tC,any:rC,unknown:nC,date:oC,enum:iC,literal:sC,nan:aC,template_literal:cC,file:uC,success:lC,custom:dC,function:pC,transform:fC,map:mC,set:hC,array:gC,object:yC,union:DS,intersection:vC,tuple:wC,record:bC,nullable:_C,nonoptional:SC,default:EC,prefault:kC,catch:IC,pipe:$C,readonly:AC,promise:TC,optional:zS,lazy:PC};function Lu(t,e){if("_idmap"in t){let o=t,n=Za({...e,processors:NS}),i={};for(let c of o._idmap.entries()){let[u,l]=c;et(l,n)}let s={},a={registry:o,uri:e?.uri,defs:i};n.external=a;for(let c of o._idmap.entries()){let[u,l]=c;Wa(n,l),vr(s,u,Ja(n,l))}if(Object.keys(i).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let r=Za({...e,processors:NS});return et(t,r),Wa(r,t),Ja(r,t)}var jS=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let r=e?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Za({processors:NS,target:r,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,r={path:[],schemaPath:[]}){return et(e,this.ctx,r)}emit(e,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Wa(this.ctx,e);let o=Ja(this.ctx,e),{"~standard":n,...i}=o;return i}};var XV={};var Qd={};yt(Qd,{ZodAny:()=>JC,ZodArray:()=>QC,ZodBase64:()=>rx,ZodBase64URL:()=>nx,ZodBigInt:()=>Xd,ZodBigIntFormat:()=>sx,ZodBoolean:()=>Gd,ZodCIDRv4:()=>ex,ZodCIDRv6:()=>tx,ZodCUID:()=>ZS,ZodCUID2:()=>WS,ZodCatch:()=>vO,ZodCodec:()=>Qh,ZodCreditCard:()=>BC,ZodCustom:()=>eg,ZodCustomStringFormat:()=>Vu,ZodDate:()=>Wh,ZodDefault:()=>pO,ZodDiscriminatedUnion:()=>tO,ZodE164:()=>ox,ZodEmail:()=>HS,ZodEmoji:()=>KS,ZodEnum:()=>Zd,ZodExactOptional:()=>ux,ZodFile:()=>cO,ZodFunction:()=>AO,ZodGUID:()=>BS,ZodIBAN:()=>KC,ZodIPv4:()=>YS,ZodIPv6:()=>QS,ZodISODate:()=>Xa,ZodISODateTime:()=>Ga,ZodISODuration:()=>Qa,ZodISOTime:()=>Ya,ZodInstanceOf:()=>RO,ZodIntersection:()=>rO,ZodJWT:()=>ix,ZodKSUID:()=>XS,ZodLazy:()=>kO,ZodLiteral:()=>aO,ZodMAC:()=>HC,ZodMap:()=>iO,ZodNaN:()=>bO,ZodNanoID:()=>qS,ZodNever:()=>XC,ZodNonOptional:()=>lx,ZodNull:()=>WC,ZodNullable:()=>dO,ZodNumber:()=>Jd,ZodNumberFormat:()=>Hu,ZodObject:()=>Jh,ZodOptional:()=>Bu,ZodPipe:()=>Yh,ZodPrefault:()=>mO,ZodPreprocess:()=>_O,ZodPromise:()=>$O,ZodReadonly:()=>SO,ZodRecord:()=>qd,ZodSet:()=>sO,ZodString:()=>Wd,ZodStringFormat:()=>it,ZodSuccess:()=>yO,ZodSymbol:()=>qC,ZodTemplateLiteral:()=>EO,ZodTransform:()=>uO,ZodTuple:()=>nO,ZodType:()=>ge,ZodULID:()=>JS,ZodURL:()=>qh,ZodUUID:()=>Xi,ZodUndefined:()=>ZC,ZodUnion:()=>Gh,ZodUnknown:()=>GC,ZodVoid:()=>YC,ZodXID:()=>GS,ZodXor:()=>eO,_ZodString:()=>VS,_default:()=>fO,_function:()=>iB,any:()=>LH,array:()=>Ae,base64:()=>bH,base64url:()=>_H,bigint:()=>DH,boolean:()=>Vt,catch:()=>wO,check:()=>sB,cidrv4:()=>vH,cidrv6:()=>wH,codec:()=>tB,creditCard:()=>xH,cuid:()=>lH,cuid2:()=>dH,currencyCode:()=>TH,custom:()=>dx,date:()=>VH,describe:()=>aB,discriminatedUnion:()=>Xh,e164:()=>SH,email:()=>eH,emoji:()=>cH,enum:()=>_r,exactOptional:()=>lO,file:()=>XH,float32:()=>RH,float64:()=>CH,function:()=>iB,guid:()=>tH,hash:()=>PH,hex:()=>AH,hostname:()=>$H,httpUrl:()=>aH,iban:()=>EH,instanceof:()=>uB,int:()=>LS,int32:()=>OH,int64:()=>zH,intersection:()=>Yd,invertCodec:()=>rB,ipv4:()=>hH,ipv6:()=>yH,json:()=>dB,jwt:()=>kH,keyof:()=>HH,ksuid:()=>mH,lazy:()=>IO,literal:()=>G,looseObject:()=>br,looseRecord:()=>ZH,mac:()=>gH,map:()=>WH,meta:()=>cB,nan:()=>eB,nanoid:()=>uH,nativeEnum:()=>GH,never:()=>ax,nonoptional:()=>gO,null:()=>Zh,nullable:()=>Kh,nullish:()=>YH,number:()=>Ze,object:()=>H,optional:()=>ot,partialRecord:()=>qH,pipe:()=>FS,prefault:()=>hO,preprocess:()=>tg,promise:()=>oB,readonly:()=>xO,record:()=>st,refine:()=>TO,set:()=>JH,strictObject:()=>BH,string:()=>I,stringFormat:()=>IH,stringbool:()=>lB,success:()=>QH,superRefine:()=>PO,symbol:()=>MH,templateLiteral:()=>nB,transform:()=>cx,tuple:()=>oO,uint32:()=>NH,uint64:()=>jH,ulid:()=>pH,undefined:()=>UH,union:()=>tt,unknown:()=>ut,url:()=>sH,uuid:()=>rH,uuidv4:()=>nH,uuidv6:()=>oH,uuidv7:()=>iH,void:()=>FH,xid:()=>fH,xor:()=>KH});var MS={};yt(MS,{endsWith:()=>Dd,gt:()=>Ji,gte:()=>Kn,includes:()=>Od,length:()=>Uu,lowercase:()=>Rd,lt:()=>Wi,lte:()=>Bn,maxLength:()=>Mu,maxSize:()=>Ka,mime:()=>jd,minLength:()=>ra,minSize:()=>Gi,multipleOf:()=>Ba,negative:()=>xS,nonnegative:()=>kS,nonpositive:()=>ES,normalize:()=>Md,overwrite:()=>Qo,positive:()=>SS,properties:()=>zd,property:()=>IS,regex:()=>Pd,size:()=>ju,slugify:()=>Vd,startsWith:()=>Nd,toLowerCase:()=>Ld,toUpperCase:()=>Fd,trim:()=>Ud,uppercase:()=>Cd});var YV=new WeakSet([Object.prototype,Error.prototype]);function US(t,e,r){Object.defineProperty(t,e,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,e,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,e,{value:o,configurable:!0,writable:!0})}})}var QV=(t,e)=>{uP.init(t,e),t.name="ZodError";let r=Object.getPrototypeOf(t);YV.has(r)||(YV.add(r),US(r,"format",o=>n=>Qm(o,n)),US(r,"flatten",o=>n=>Ym(o,n)),US(r,"addIssue",o=>n=>{o.issues.push(n),o.message=JSON.stringify(o.issues,id,2)}),US(r,"addIssues",o=>n=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,id,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},bme=S("ZodError",QV),An=S("ZodError",QV,void 0,{Parent:Error});var RC=dd(An),CC=pd(An),OC=fd(An),NC=hd(An),DC=ab(An),zC=cb(An),jC=ub(An),MC=lb(An),UC=db(An),LC=pb(An),FC=fb(An),VC=mb(An);function Sme(){cr.localeError||zt(K_())}function Fu(){cr.memoizer||zt({memoizer:gh()})}var ge=S("ZodType",(t,e)=>(Sme(),ae.init(t,e),t.def=e,t.type=e.type,t),{check(...t){let e=this.def;return this.clone(A.mergeDefs(e,{checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,e){return qe(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},refine(t,e){return this.check(TO(t,e))},superRefine(t,e){return this.check(PO(t,e))},overwrite(t){return this.check(Qo(t))},optional(){return ot(this)},exactOptional(){return lO(this)},nullable(){return Kh(this)},nullish(){return ot(Kh(this))},nonoptional(t){return gO(this,t)},array(){return Ae(this)},or(t){return tt([this,t])},and(t){return Yd(this,t)},transform(t){return FS(this,cx(t))},default(t){return fO(this,t)},prefault(t){return hO(this,t)},catch(t){return wO(this,t)},pipe(t){return FS(this,t)},readonly(){return xO(this)},describe(t){let e=this.clone();return wr.add(e,{description:t}),e},meta(...t){if(t.length===0)return wr.get(this);let e=this.clone();return wr.add(e,t[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...e){return e.length===0?t(this):t(this,...e)},get"~standard"(){return A.hide(this,"~standard",{...kb(this),jsonSchema:{input:Hd(this,"input"),output:Hd(this,"output")}})},set"~standard"(t){A.own(this,"~standard",t)},parse:function t(e,r){return RC(this,e,r,{callee:t})},parseAsync:async function t(e,r){return await CC(this,e,r,{callee:t})},safeParse(t,e){return OC(this,t,e)},async safeParseAsync(t,e){return NC(this,t,e)},get spa(){return this?.safeParseAsync},set spa(t){A.own(this,"spa",t)},validate(t,e){return yd(this,t,e)},validateAsync(t,e){return vd(this,t,e)},encode:function t(e,r){return DC(this,e,r,{callee:t})},decode:function t(e,r){return zC(this,e,r,{callee:t})},encodeAsync:async function t(e,r){return await jC(this,e,r,{callee:t})},decodeAsync:async function t(e,r){return await MC(this,e,r,{callee:t})},safeEncode(t,e){return UC(this,t,e)},safeDecode(t,e){return LC(this,t,e)},async safeEncodeAsync(t,e){return FC(this,t,e)},async safeDecodeAsync(t,e){return VC(this,t,e)},toJSONSchema(t){return BR(this,{})(t)},get description(){return wr.get(this)?.description},get _def(){return this._zod.def}}),VS=S("_ZodString",(t,e)=>{Va.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ZR(t,r,o,n)},A.derived({format:t=>Yt(t).format??null,minLength:t=>Yt(t).minimum??null,maxLength:t=>Yt(t).maximum??null},{regex(...t){return this.check(Pd(...t))},includes(...t){return this.check(Od(...t))},startsWith(...t){return this.check(Nd(...t))},endsWith(...t){return this.check(Dd(...t))},min(...t){return this.check(ra(...t))},max(...t){return this.check(Mu(...t))},length(...t){return this.check(Uu(...t))},nonempty(...t){return this.check(ra(1,...t))},lowercase(t){return this.check(Rd(t))},uppercase(t){return this.check(Cd(t))},trim(){return this.check(Ud())},normalize(...t){return this.check(Md(...t))},toLowerCase(){return this.check(Ld())},toUpperCase(){return this.check(Fd())},slugify(){return this.check(Vd())}})),Wd=S("ZodString",(t,e)=>{Va.init(t,e),VS.init(t,e)},{email(t){return this.check(vh(HS,t))},url(t){return this.check(Td(qh,t))},jwt(t){return this.check(Mh(ix,t))},emoji(t){return this.check(Eh(KS,t))},guid(t){return this.check(wh(BS,t))},uuid(t){return this.check(bh(Xi,t))},uuidv4(t){return this.check(_h(Xi,t))},uuidv6(t){return this.check(Sh(Xi,t))},uuidv7(t){return this.check(xh(Xi,t))},nanoid(t){return this.check(kh(qS,t))},cuid(t){return this.check(Ih(ZS,t))},cuid2(t){return this.check($h(WS,t))},ulid(t){return this.check(Ah(JS,t))},base64(t){return this.check(Dh(rx,t))},base64url(t){return this.check(zh(nx,t))},xid(t){return this.check(Th(GS,t))},ksuid(t){return this.check(Ph(XS,t))},ipv4(t){return this.check(Rh(YS,t))},ipv6(t){return this.check(Ch(QS,t))},cidrv4(t){return this.check(Oh(ex,t))},cidrv6(t){return this.check(Nh(tx,t))},e164(t){return this.check(jh(ox,t))},datetime(t){return this.check(Uh(Ga,t))},date(t){return this.check(Lh(Xa,t))},time(t){return this.check(Fh(Ya,t))},duration(t){return this.check(Vh(Qa,t))}});function I(t){return Q_(Wd,t)}var it=S("ZodStringFormat",(t,e)=>{Je.init(t,e),VS.init(t,e)}),Ga=S("ZodISODateTime",(t,e)=>{vR.init(t,e),it.init(t,e)}),Xa=S("ZodISODate",(t,e)=>{wR.init(t,e),it.init(t,e)}),Ya=S("ZodISOTime",(t,e)=>{bR.init(t,e),it.init(t,e)}),Qa=S("ZodISODuration",(t,e)=>{_R.init(t,e),it.init(t,e)}),HS=S("ZodEmail",(t,e)=>{Ab.init(t,e),it.init(t,e)});function eH(t){return vh(HS,t)}var BS=S("ZodGUID",(t,e)=>{Ib.init(t,e),it.init(t,e)});function tH(t){return wh(BS,t)}var Xi=S("ZodUUID",(t,e)=>{$b.init(t,e),it.init(t,e)});function rH(t){return bh(Xi,t)}function nH(t){return _h(Xi,t)}function oH(t){return Sh(Xi,t)}function iH(t){return xh(Xi,t)}var qh=S("ZodURL",(t,e)=>{Cb.init(t,e),it.init(t,e)});function sH(t){return Td(qh,t)}function aH(t){return Td(qh,{protocol:eh,hostname:CP,...A.normalizeParams(t)})}var KS=S("ZodEmoji",(t,e)=>{Ob.init(t,e),it.init(t,e)});function cH(t){return Eh(KS,t)}var qS=S("ZodNanoID",(t,e)=>{Nb.init(t,e),it.init(t,e)});function uH(t){return kh(qS,t)}var ZS=S("ZodCUID",(t,e)=>{Db.init(t,e),it.init(t,e)});function lH(t){return Ih(ZS,t)}var WS=S("ZodCUID2",(t,e)=>{zb.init(t,e),it.init(t,e)});function dH(t){return $h(WS,t)}var JS=S("ZodULID",(t,e)=>{jb.init(t,e),it.init(t,e)});function pH(t){return Ah(JS,t)}var GS=S("ZodXID",(t,e)=>{Mb.init(t,e),it.init(t,e)});function fH(t){return Th(GS,t)}var XS=S("ZodKSUID",(t,e)=>{Ub.init(t,e),it.init(t,e)});function mH(t){return Ph(XS,t)}var YS=S("ZodIPv4",(t,e)=>{Lb.init(t,e),it.init(t,e)});function hH(t){return Rh(YS,t)}var HC=S("ZodMAC",(t,e)=>{Vb.init(t,e),it.init(t,e)});function gH(t){return eS(HC,t)}var QS=S("ZodIPv6",(t,e)=>{Fb.init(t,e),it.init(t,e)});function yH(t){return Ch(QS,t)}var ex=S("ZodCIDRv4",(t,e)=>{Hb.init(t,e),it.init(t,e)});function vH(t){return Oh(ex,t)}var tx=S("ZodCIDRv6",(t,e)=>{Kb.init(t,e),it.init(t,e)});function wH(t){return Nh(tx,t)}var rx=S("ZodBase64",(t,e)=>{Zb.init(t,e),it.init(t,e)});function bH(t){return Dh(rx,t)}var nx=S("ZodBase64URL",(t,e)=>{Jb.init(t,e),it.init(t,e)});function _H(t){return zh(nx,t)}var ox=S("ZodE164",(t,e)=>{Gb.init(t,e),it.init(t,e)});function SH(t){return jh(ox,t)}var BC=S("ZodCreditCard",(t,e)=>{Yb.init(t,e),it.init(t,e)});function xH(t){return tS(BC,t)}var KC=S("ZodIBAN",(t,e)=>{e_.init(t,e),it.init(t,e)});function EH(t){return rS(KC,t)}var ix=S("ZodJWT",(t,e)=>{r_.init(t,e),it.init(t,e)});function kH(t){return Mh(ix,t)}var Vu=S("ZodCustomStringFormat",(t,e)=>{n_.init(t,e),it.init(t,e)});function IH(t,e,r={}){return qa(Vu,t,e,r)}function $H(t){return qa(Vu,"hostname",RP,t)}function AH(t){return qa(Vu,"hex",qP,t)}function TH(t){return qa(Vu,"currency_code",NP,t)}function PH(t,e){let r=e?.enc??"hex",o=`${t}_${r}`,n=Hn[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return qa(Vu,o,n,e)}var Jd=S("ZodNumber",(t,e)=>{uh.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>WR(t,r,o,n),t.isFinite=!0},A.derived({minValue:t=>{let{minimum:e,exclusiveMinimum:r}=Yt(t);return Math.max(e??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:t=>{let{maximum:e,exclusiveMaximum:r}=Yt(t);return Math.min(e??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:t=>{let{isInt:e,multipleOf:r}=Yt(t);return!!e||!!r?.some(Number.isSafeInteger)},format:t=>Yt(t).format??null},{gt(t,e){return this.check(Ji(t,e))},gte(t,e){return this.check(Kn(t,e))},min(t,e){return this.check(Kn(t,e))},lt(t,e){return this.check(Wi(t,e))},lte(t,e){return this.check(Bn(t,e))},max(t,e){return this.check(Bn(t,e))},int(t){return this.check(LS(t))},safe(t){return this.check(LS(t))},positive(t){return this.check(Ji(0,t))},nonnegative(t){return this.check(Kn(0,t))},negative(t){return this.check(Wi(0,t))},nonpositive(t){return this.check(Bn(0,t))},multipleOf(t,e){return this.check(Ba(t,e))},step(t,e){return this.check(Ba(t,e))},finite(){return this}}));function Ze(t){return nS(Jd,t)}var Hu=S("ZodNumberFormat",(t,e)=>{o_.init(t,e),Jd.init(t,e)});function LS(t){return oS(Hu,t)}function RH(t){return iS(Hu,t)}function CH(t){return sS(Hu,t)}function OH(t){return aS(Hu,t)}function NH(t){return cS(Hu,t)}var Gd=S("ZodBoolean",(t,e)=>{_d.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>JR(t,r,o,n)});function Vt(t){return uS(Gd,t)}var Xd=S("ZodBigInt",(t,e)=>{lh.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>GR(t,r,o,n)},A.derived({minValue:t=>Yt(t).minimum??null,maxValue:t=>Yt(t).maximum??null,format:t=>Yt(t).format??null},{gte(t,e){return this.check(Kn(t,e))},min(t,e){return this.check(Kn(t,e))},gt(t,e){return this.check(Ji(t,e))},lt(t,e){return this.check(Wi(t,e))},lte(t,e){return this.check(Bn(t,e))},max(t,e){return this.check(Bn(t,e))},positive(t){return this.check(Ji(BigInt(0),t))},negative(t){return this.check(Wi(BigInt(0),t))},nonpositive(t){return this.check(Bn(BigInt(0),t))},nonnegative(t){return this.check(Kn(BigInt(0),t))},multipleOf(t,e){return this.check(Ba(t,e))}}));function DH(t){return lS(Xd,t)}var sx=S("ZodBigIntFormat",(t,e)=>{i_.init(t,e),Xd.init(t,e)});function zH(t){return dS(sx,t)}function jH(t){return pS(sx,t)}var qC=S("ZodSymbol",(t,e)=>{s_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>XR(t,r,o,n)});function MH(t){return fS(qC,t)}var ZC=S("ZodUndefined",(t,e)=>{a_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>QR(t,r,o,n)});function UH(t){return mS(ZC,t)}var WC=S("ZodNull",(t,e)=>{c_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>YR(t,r,o,n)});function Zh(t){return hS(WC,t)}var JC=S("ZodAny",(t,e)=>{u_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>rC(t,r,o,n)});function LH(){return gS(JC)}var GC=S("ZodUnknown",(t,e)=>{l_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>nC(t,r,o,n)});function ut(){return yS(GC)}var XC=S("ZodNever",(t,e)=>{d_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>tC(t,r,o,n)});function ax(t){return vS(XC,t)}var YC=S("ZodVoid",(t,e)=>{p_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>eC(t,r,o,n)});function FH(t){return wS(YC,t)}var Wh=S("ZodDate",(t,e)=>{f_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>oC(t,r,o,n),t.min=(r,o)=>t.check(Kn(r,o)),t.max=(r,o)=>t.check(Bn(r,o))},A.derived({minDate:t=>{let{minimum:e}=Yt(t);return e?new Date(e):null},maxDate:t=>{let{maximum:e}=Yt(t);return e?new Date(e):null}},{}));function VH(t){return bS(Wh,t)}var QC=S("ZodArray",(t,e)=>{Fu(),m_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>gC(t,r,o,n),t.element=e.element},{min(t,e){return this.check(ra(t,e))},nonempty(t){return this.check(ra(1,t))},max(t,e){return this.check(Mu(t,e))},length(t,e){return this.check(Uu(t,e))},unwrap(){return this.element}});function Ae(t,e){return VR(QC,t,e)}function HH(t){let e=t._zod.def.shape;return _r(Object.keys(e))}var Jh=S("ZodObject",(t,e)=>{Fu(),xR.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>yC(t,r,o,n),A.installLazyProp(t,"shape",r=>r._zod.def.shape,!1)},{keyof(){return _r(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(A.mergeDefs(this._zod.def,{catchall:t}))},passthrough(){return this.clone(A.mergeDefs(this._zod.def,{catchall:ut()}))},loose(){return this.clone(A.mergeDefs(this._zod.def,{catchall:ut()}))},strict(){return this.clone(A.mergeDefs(this._zod.def,{catchall:ax()}))},strip(){return this.clone(A.mergeDefs(this._zod.def,{catchall:void 0}))},extend(t){return A.extend(this,t)},safeExtend(t){return A.safeExtend(this,t)},merge(t){return A.merge(this,t)},pick(t){return A.pick(this,t)},omit(t){return A.omit(this,t)},partial(...t){return A.partial(Bu,this,t[0])},exactPartial(...t){return A.partial(ux,this,t[0],"exactPartial")},required(...t){return A.required(lx,this,t[0])}});function H(t,e){let r={type:"object",shape:t??{},...A.normalizeParams(e)};return new Jh(r)}function BH(t,e){return new Jh({type:"object",shape:t,catchall:ax(),...A.normalizeParams(e)})}function br(t,e){return new Jh({type:"object",shape:t,catchall:ut(),...A.normalizeParams(e)})}var Gh=S("ZodUnion",(t,e)=>{Sd.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>DS(t,r,o,n),t.options=e.options});function tt(t,e){return new Gh({type:"union",options:t,...A.normalizeParams(e)})}var eO=S("ZodXor",(t,e)=>{Gh.init(t,e),g_.init(t,e),t._zod.processJSONSchema=(r,o,n)=>DS(t,r,o,n),t.options=e.options});function KH(t,e){return new eO({type:"union",options:t,inclusive:!1,...A.normalizeParams(e)})}var tO=S("ZodDiscriminatedUnion",(t,e)=>{Gh.init(t,e),y_.init(t,e)});function Xh(t,e,r){return new tO({type:"union",options:e,discriminator:t,...A.normalizeParams(r)})}var rO=S("ZodIntersection",(t,e)=>{v_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>vC(t,r,o,n)});function Yd(t,e){return new rO({type:"intersection",left:t,right:e})}var nO=S("ZodTuple",(t,e)=>{Fu(),dh.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>wC(t,r,o,n)},{rest(t){return this.clone({...this._zod.def,rest:t})},partial(){let t=this._zod.def;if(t.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...t,items:t.items.map(e=>new Bu({type:"optional",innerType:e}))})}});function oO(t,e,r){let o=e instanceof ae,n=o?r:e,i=o?e:null;return new nO({type:"tuple",items:t,rest:i,...A.normalizeParams(n)})}var qd=S("ZodRecord",(t,e)=>{Fu(),w_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>bC(t,r,o,n),t.keyType=e.keyType,t.valueType=e.valueType});function st(t,e,r){return!e||!e._zod?new qd({type:"record",keyType:I(),valueType:t,...A.normalizeParams(e)}):new qd({type:"record",keyType:t,valueType:e,...A.normalizeParams(r)})}function qH(t,e,r){return new qd({type:"record",keyType:t,valueType:e,...A.normalizeParams(r),partial:!0})}function ZH(t,e,r){return new qd({type:"record",keyType:t,valueType:e,mode:"loose",...A.normalizeParams(r)})}var iO=S("ZodMap",(t,e)=>{Fu(),b_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>mC(t,r,o,n),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(Gi(...r)),t.nonempty=r=>t.check(Gi(1,r)),t.max=(...r)=>t.check(Ka(...r)),t.size=(...r)=>t.check(ju(...r))});function WH(t,e,r){return new iO({type:"map",keyType:t,valueType:e,...A.normalizeParams(r)})}var sO=S("ZodSet",(t,e)=>{Fu(),__.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>hC(t,r,o,n),t.min=(...r)=>t.check(Gi(...r)),t.nonempty=r=>t.check(Gi(1,r)),t.max=(...r)=>t.check(Ka(...r)),t.size=(...r)=>t.check(ju(...r))});function JH(t,e){return new sO({type:"set",valueType:t,...A.normalizeParams(e)})}var Zd=S("ZodEnum",(t,e)=>{S_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(o,n,i)=>iC(t,o,n,i),t.enum=e.entries,t.options=[...t._zod.values];let r=new Set(Object.keys(e.entries));t.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Zd({...e,checks:[],...A.normalizeParams(n),entries:i})},t.exclude=(o,n)=>{let i={...e.entries};for(let s of o)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Zd({...e,checks:[],...A.normalizeParams(n),entries:i})}});function _r(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new Zd({type:"enum",entries:r,...A.normalizeParams(e)})}function GH(t,e){return new Zd({type:"enum",entries:t,...A.normalizeParams(e)})}var aO=S("ZodLiteral",(t,e)=>{x_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>sC(t,r,o,n),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function G(t,e){return new aO({type:"literal",values:Array.isArray(t)?t:[t],...A.normalizeParams(e)})}var cO=S("ZodFile",(t,e)=>{E_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>uC(t,r,o,n),t.min=(r,o)=>t.check(Gi(r,o)),t.max=(r,o)=>t.check(Ka(r,o)),t.mime=(r,o)=>t.check(jd(Array.isArray(r)?r:[r],o))});function XH(t){return $S(cO,t)}var uO=S("ZodTransform",(t,e)=>{Fu(),k_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>fC(t,r,o,n),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Fa(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(A.issue(i,r.value,e));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=t),r.issues.push(A.issue(s))}};let n=e.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r)):(r.value=n,r)}});function cx(t){return new uO({type:"transform",transform:t})}var Bu=S("ZodOptional",(t,e)=>{ph.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>zS(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function ot(t){return new Bu({type:"optional",innerType:t})}var ux=S("ZodExactOptional",(t,e)=>{I_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>zS(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function lO(t){return new ux({type:"optional",innerType:t})}var dO=S("ZodNullable",(t,e)=>{$_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>_C(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Kh(t){return new dO({type:"nullable",innerType:t})}function YH(t){return ot(Kh(t))}var pO=S("ZodDefault",(t,e)=>{A_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>EC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function fO(t,e){return new pO({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():A.shallowClone(e)}})}var mO=S("ZodPrefault",(t,e)=>{T_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>kC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function hO(t,e){return new mO({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():A.shallowClone(e)}})}var lx=S("ZodNonOptional",(t,e)=>{P_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>SC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function gO(t,e){return new lx({type:"nonoptional",innerType:t,...A.normalizeParams(e)})}var yO=S("ZodSuccess",(t,e)=>{R_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>lC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function QH(t){return new yO({type:"success",innerType:t})}var vO=S("ZodCatch",(t,e)=>{C_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>IC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function wO(t,e){return new vO({type:"catch",innerType:t,catchValue:typeof e=="function"?e:A.constantCatch(e)})}var bO=S("ZodNaN",(t,e)=>{O_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>aC(t,r,o,n)});function eB(t){return _S(bO,t)}var Yh=S("ZodPipe",(t,e)=>{fh.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>$C(t,r,o,n),t.in=e.in,t.out=e.out});function FS(t,e){return new Yh({type:"pipe",in:t,out:e})}var Qh=S("ZodCodec",(t,e)=>{Yh.init(t,e),xd.init(t,e)});function tB(t,e,r){return new Qh({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}function rB(t){let e=t._zod.def;return new Qh({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}var _O=S("ZodPreprocess",(t,e)=>{Yh.init(t,e),kR.init(t,e)}),SO=S("ZodReadonly",(t,e)=>{N_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>AC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function xO(t){return new SO({type:"readonly",innerType:t})}var EO=S("ZodTemplateLiteral",(t,e)=>{D_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>cC(t,r,o,n)});function nB(t,e){return new EO({type:"template_literal",parts:t,...A.normalizeParams(e)})}var kO=S("ZodLazy",(t,e)=>{Ed.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>PC(t,r,o,n),t.unwrap=()=>t._zod.def.getter()});function IO(t){return new kO({type:"lazy",getter:t})}var $O=S("ZodPromise",(t,e)=>{j_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>TC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function oB(t){return new $O({type:"promise",innerType:t})}var AO=S("ZodFunction",(t,e)=>{z_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>pC(t,r,o,n)});function iB(t){return new AO({type:"function",input:Array.isArray(t?.input)?oO(t?.input):t?.input??Ae(ut()),output:t?.output??ut()})}var eg=S("ZodCustom",(t,e)=>{M_.init(t,e),ge.init(t,e),t._zod.processJSONSchema=(r,o,n)=>dC(t,r,o,n)});function sB(t){let e=new nt({check:"custom"});return e._zod.check=t,e}function dx(t,e){return AS(eg,t??(()=>!0),e)}function TO(t,e={}){return TS(eg,t,e)}function PO(t,e){return PS(t,e)}var aB=RS,cB=CS,RO=S("ZodInstanceOf",(t,e)=>{eg.init(t,e)},{properties(t,e){return this.check(zd(t,e))}});function uB(t,e={}){let r=new RO({type:"custom",check:"custom",fn:o=>o instanceof t,abort:!0,...A.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=o=>{o.value instanceof t||o.issues.push({code:"invalid_type",expected:t.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}var lB=(...t)=>OS({Codec:Qh,Boolean:Gd,String:Wd},...t);function dB(t){let e=IO(()=>tt([I(t),Ze(),Vt(),Zh(),Ae(e),st(I(),e)]));return e}function tg(t,e){return new _O({type:"pipe",in:cx(t),out:e})}var xme={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Eme(t){zt({customError:t})}function kme(){return zt().customError}var CO;CO||(CO={});var Ku={};yt(Ku,{ZodISODate:()=>Xa,ZodISODateTime:()=>Ga,ZodISODuration:()=>Qa,ZodISOTime:()=>Ya,date:()=>$me,datetime:()=>Ime,duration:()=>Tme,time:()=>Ame});function Ime(t){return Uh(Ga,t)}function $me(t){return Lh(Xa,t)}function Ame(t){return Fh(Ya,t)}function Tme(t){return Vh(Qa,t)}var V={...Qd,...MS,iso:Ku},Pme=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Rme(t,e){let r=t.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function pB(t,e){return t.map((r,o)=>o<e?r:r.optional())}function Cme(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function Ome(t,e){if(!t.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=t.slice(1).split("/").filter(Boolean);if(r.length===0)return e.rootSchema;let o=e.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1]===void 0?void 0:Cme(r[1]);if(!n||!e.defs[n])throw new Error(`Reference not found: ${t}`);return e.defs[n]}throw new Error(`Reference not found: ${t}`)}function Nme(t,e){return V.transform(o=>o).check(o=>{let n=o.value;if(typeof n!="object"||n===null||Array.isArray(n))return;let i=Object.getOwnPropertyNames(n);if(e.minProperties!==void 0&&i.length<e.minProperties&&o.issues.push({origin:"object",code:"too_small",minimum:e.minProperties,inclusive:!0,message:`Too small: expected object to have >=${e.minProperties} properties`,input:n,inst:t,continue:!0}),e.maxProperties!==void 0&&i.length>e.maxProperties&&o.issues.push({origin:"object",code:"too_big",maximum:e.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${e.maxProperties} properties`,input:n,inst:t,continue:!0}),e.keySchema)for(let s of i){let a=e.keySchema.safeParse(s);a.success||o.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(t)}function OO(t,e){if(t===null)return"z";let r=typeof t;if(r!=="object"){if(r==="number"&&Number.isNaN(t))return null;let o=String(t);return`${r[0]}${o.length}:${o}`}if(e.has(t))return null;e.add(t);try{if(Array.isArray(t)){let i=[];for(let s of t){let a=OO(s,e);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let o=Object.keys(t).sort(),n=[];for(let i of o){let s=OO(t[i],e);if(s===null)return null;n.push(`${i.length}:${i}=${s}`)}return`o${n.length}:{${n.join(",")}}`}finally{e.delete(t)}}var Dme=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),zme=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function rg(t){return typeof t!="object"||t===null?!1:Array.isArray(t)?t.some(rg):typeof t.$ref=="string"?!0:Object.entries(t).some(([e,r])=>Dme.has(e)?rg(r):!zme.has(e)||typeof r!="object"||r===null?!1:Object.values(r).some(rg))}function fB(t){return t===1?"element":"elements"}function jme(t,e){return V.transform(o=>o).check(o=>{let n=o.value;if(Array.isArray(n)){if(e.uniqueItems===!0){let i=new Map;for(let s=0;s<n.length;s++){let a=OO(n[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}o.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:n,path:[s],continue:!0})}}if(e.containsSchema){let i=e.minContains??1,s=e.maxContains!==void 0?e.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of n)if(e.containsSchema.safeParse(c).success&&++a>=s)break;a<i&&o.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${fB(i)}; found ${a}`,input:n,continue:!0}),e.maxContains!==void 0&&a>e.maxContains&&o.issues.push({code:"custom",message:`Array must contain at most ${e.maxContains} matching ${fB(e.maxContains)}`,input:n,continue:!0})}}}).pipe(t)}function mB(t,e){if(t!==!1)return t===void 0||t===!0?V.any():dn(t,e)}var Mme=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function hB(t,e){if(t.not!==void 0){if(typeof t.not=="object"&&Object.keys(t.not).length===0)return V.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(t.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(t.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(t.if!==void 0||t.then!==void 0||t.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(t.dependentSchemas!==void 0||t.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(t.$ref){let n=t.$ref;if(e.refs.has(n))return e.refs.get(n);if(e.processing.has(n))return V.lazy(()=>{if(!e.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return e.refs.get(n)});e.processing.add(n);let i=Ome(n,e),s=dn(i,e);return e.refs.set(n,s),e.processing.delete(n),s}if(t.enum!==void 0){let n=t.enum;if(e.version==="openapi-3.0"&&t.nullable===!0&&n.length===1&&n[0]===null)return V.null();if(n.length===0)return V.never();if(n.length===1)return V.literal(n[0]);if(n.every(s=>typeof s=="string"))return V.enum(n);let i=n.map(s=>V.literal(s));return i.length<2?i[0]:V.union([i[0],i[1],...i.slice(2)])}if(t.const!==void 0)return V.literal(t.const);let r=t.type;if(Array.isArray(r)){let n=r.map(i=>{let s={...t,type:i};return hB(s,e)});return n.length===0?V.never():n.length===1?n[0]:V.union(n)}if(!r)return V.any();let o;switch(r){case"string":{let n=V.string();if(t.format){let i=t.format;i==="email"?n=n.check(V.email()):i==="uri"||i==="uri-reference"?n=n.check(V.url()):i==="uuid"||i==="guid"?n=n.check(V.uuid()):i==="date-time"?n=n.check(V.iso.datetime({offset:!0})):i==="date"?n=n.check(V.iso.date()):i==="time"?n=n.check(V.regex(Mme)):i==="duration"?n=n.check(V.iso.duration()):i==="hostname"?n=n.check(V.hostname()):i==="ipv4"?n=n.check(V.ipv4()):i==="ipv6"?n=n.check(V.ipv6()):i==="mac"?n=n.check(V.mac()):i==="cidr"?n=n.check(V.cidrv4()):i==="cidr-v6"?n=n.check(V.cidrv6()):i==="base64"?n=n.check(V.base64()):i==="base64url"?n=n.check(V.base64url()):i==="e164"?n=n.check(V.e164()):i==="credit_card"?n=n.check(V.creditCard()):i==="iban"?n=n.check(V.iban()):i==="jwt"?n=n.check(V.jwt()):i==="emoji"?n=n.check(V.emoji()):i==="nanoid"?n=n.check(V.nanoid()):i==="cuid"?n=n.check(V.cuid()):i==="cuid2"?n=n.check(V.cuid2()):i==="ulid"?n=n.check(V.ulid()):i==="xid"?n=n.check(V.xid()):i==="ksuid"&&(n=n.check(V.ksuid()))}typeof t.minLength=="number"&&(n=n.min(t.minLength)),typeof t.maxLength=="number"&&(n=n.max(t.maxLength)),t.pattern&&(n=n.regex(new RegExp(t.pattern))),o=n;break}case"number":case"integer":{let n=r==="integer"?V.number().int():V.number();typeof t.minimum=="number"&&t.exclusiveMinimum!==!0&&(n=n.min(t.minimum)),typeof t.maximum=="number"&&t.exclusiveMaximum!==!0&&(n=n.max(t.maximum)),typeof t.exclusiveMinimum=="number"?n=n.gt(t.exclusiveMinimum):t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(n=n.gt(t.minimum)),typeof t.exclusiveMaximum=="number"?n=n.lt(t.exclusiveMaximum):t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(n=n.lt(t.maximum)),typeof t.multipleOf=="number"&&(n=n.multipleOf(t.multipleOf)),o=n;break}case"boolean":{o=V.boolean();break}case"null":{o=V.null();break}case"object":{let n={},i=t.properties||{},s=new Set(t.required||[]),a=typeof t.additionalProperties=="object"?dn(t.additionalProperties,e):void 0;for(let[d,f]of Object.entries(i)){let p=dn(f,e);vr(n,d,s.has(d)?p:p.optional())}if(t.patternProperties){let d=t.patternProperties,f=Object.keys(d),p=[];for(let g of f){let y=dn(d[g],e),w=V.string().regex(new RegExp(g));p.push(V.looseRecord(w,y))}let m=[];if(Object.keys(n).length>0&&m.push(V.object(n).passthrough()),m.push(...p),m.length===0)o=V.object({}).passthrough();else if(m.length===1)o=m[0];else{let g=V.intersection(m[0],m[1]);for(let y=2;y<m.length;y++)g=V.intersection(g,m[y]);o=g}if(t.additionalProperties===!1){let g=Object.keys(n),y=f.map(b=>new RegExp(b)),w=o;o=o.check(b=>{if(!mo(b.value))return;let _=[];for(let k of Object.keys(b.value))g.includes(k)||y.some($=>$.test(k))||_.push(k);_.length&&b.issues.push({code:"unrecognized_keys",keys:_,input:b.value,inst:w})})}}else{let d=V.object(n);t.additionalProperties===!1?o=d.strict():a?o=d.catchall(a):o=d.passthrough()}let c=t.propertyNames!==void 0&&t.propertyNames!==!0,u=typeof t.minProperties=="number"?t.minProperties:void 0,l=typeof t.maxProperties=="number"?t.maxProperties:void 0;if(c||u!==void 0||l!==void 0){let d;if(c){let f=typeof t.propertyNames=="object"&&t.propertyNames.type===void 0?{type:"string",...t.propertyNames}:t.propertyNames;d=dn(f,e)}o=Nme(o,{keySchema:d,minProperties:u,maxProperties:l})}break}case"array":{let n=t.prefixItems,i=t.items;if(n&&Array.isArray(n)){let s=typeof t.minItems=="number"?t.minItems:0,a=n.map(d=>dn(d,e)),c=pB(a,s),u=Array.isArray(i)?void 0:mB(i,e),l=V.tuple(c);o=u?l.rest(u):l,typeof t.minItems=="number"&&(o=o.check(V.minLength(t.minItems))),typeof t.maxItems=="number"&&(o=o.check(V.maxLength(t.maxItems)))}else if(Array.isArray(i)){let s=typeof t.minItems=="number"?t.minItems:0,a=i.map(d=>dn(d,e)),c=pB(a,s),u=mB(t.additionalItems,e),l=V.tuple(c);o=u?l.rest(u):l,typeof t.minItems=="number"&&(o=o.check(V.minLength(t.minItems))),typeof t.maxItems=="number"&&(o=o.check(V.maxLength(t.maxItems)))}else if(i!==void 0){let s=dn(i,e),a=V.array(s);typeof t.minItems=="number"&&(a=a.min(t.minItems)),typeof t.maxItems=="number"&&(a=a.max(t.maxItems)),o=a}else o=V.array(V.any());(t.uniqueItems===!0||t.contains!==void 0)&&(o=jme(o,{uniqueItems:t.uniqueItems===!0,containsSchema:t.contains!==void 0?dn(t.contains,e):void 0,minContains:typeof t.minContains=="number"?t.minContains:void 0,maxContains:typeof t.maxContains=="number"?t.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return o}function dn(t,e){if(typeof t=="boolean")return t?V.any():V.never();let r=hB(t,e),o=t.type||t.enum!==void 0||t.const!==void 0;if(t.anyOf&&Array.isArray(t.anyOf)){let a=t.anyOf.map(u=>dn(u,e)),c=V.union(a);r=o?V.intersection(r,c):c}if(t.oneOf&&Array.isArray(t.oneOf)){let a=t.oneOf.map(u=>dn(u,e)),c=V.xor(a);r=o?V.intersection(r,c):c}if(t.allOf&&Array.isArray(t.allOf))if(t.allOf.length===0)r=o?r:V.any();else{let a=o?r:dn(t.allOf[0],e),c=o?0:1;for(let u=c;u<t.allOf.length;u++)a=V.intersection(a,dn(t.allOf[u],e));r=a}t.nullable===!0&&e.version==="openapi-3.0"&&(r=V.nullable(r)),t.readOnly===!0&&(r=V.readonly(r)),t.default!==void 0&&(r=r.default(t.default));let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in t&&(n[a]=t[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in t&&(n[a]=t[a]);if(t.type==="object"&&t.$ref===void 0){t.propertyNames!==void 0&&!rg(t.propertyNames)&&(n.propertyNames=t.propertyNames);for(let a of["minProperties","maxProperties"])t[a]!==void 0&&(n[a]=t[a])}if(t.type==="array"&&t.$ref===void 0){t.contains!==void 0&&!rg(t.contains)&&(n.contains=t.contains);for(let a of["uniqueItems","minContains","maxContains"])t[a]!==void 0&&(n[a]=t[a])}for(let a of Object.keys(t))Pme.has(a)||vr(n,a,t[a]);return Object.keys(n).length>0&&e.registry.add(r,n),t.description&&(r=r.describe(t.description)),r}function gB(t,e){if(typeof t=="boolean")return t?V.any():V.never();let r;try{r=JSON.parse(JSON.stringify(t))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=Rme(r,e?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:e?.registry??wr};return dn(r,i)}var yB=Symbol("z.visit/resolving");function ng(t,e){let r=typeof e=="function"?e:(s,a)=>{let c=e[s._zod.def.type];return c?c(s,a):s},o=new Map;function n(s){let a=o.get(s);if(a===yB)return new Ed({type:"lazy",getter:()=>o.get(s)});if(a!==void 0)return a;o.set(s,yB);let c=i(s),u=r(c,c!==s);return o.set(s,u),u}function i(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let u=a.shape,l=Object.keys(u),d=!1,f={};for(let m of l){let g=n(u[m]);g!==u[m]&&(d=!0),f[m]=g}let p=a.catchall;return a.catchall&&(p=n(a.catchall),p!==a.catchall&&(d=!0)),d?qe(s,{...a,shape:f,catchall:p}):s}case"array":{let u=n(a.element);return u===a.element?s:qe(s,{...a,element:u})}case"tuple":{let u=a.items,l=!1,d=[];for(let p of u){let m=n(p);m!==p&&(l=!0),d.push(m)}let f=a.rest;return a.rest&&(f=n(a.rest),f!==a.rest&&(l=!0)),l?qe(s,{...a,items:d,rest:f}):s}case"record":case"map":{let u=n(a.keyType),l=n(a.valueType);return u===a.keyType&&l===a.valueType?s:qe(s,{...a,keyType:u,valueType:l})}case"set":{let u=n(a.valueType);return u===a.valueType?s:qe(s,{...a,valueType:u})}case"union":{let u=a.options,l=!1,d=[];for(let f of u){let p=n(f);p!==f&&(l=!0),d.push(p)}return l?qe(s,{...a,options:d}):s}case"intersection":{let u=n(a.left),l=n(a.right);return u===a.left&&l===a.right?s:qe(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=n(a.innerType);return u===a.innerType?s:qe(s,{...a,innerType:u})}case"pipe":{let u=n(a.in),l=n(a.out);return u===a.in&&l===a.out?s:qe(s,{...a,in:u,out:l})}case"function":{let u=n(a.input),l=n(a.output);return u===a.input&&l===a.output?s:qe(s,{...a,input:u,output:l})}case"lazy":{let u=a.getter,{_cachedInner:l,...d}=a;return qe(s,{...d,getter:()=>n(u())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return s;default:return s}}return n(t)}function vB(t){return ng(t,{object:e=>e.partial(),union:e=>{let r=e._zod.def;return r.discriminator===void 0?e:tt(r.options)}})}function Ume(t,e){if(!e?.length)return t;let r=t._zod.def;return qe(t,fo(r,{checks:[...r.checks??[],...e]}),{parent:!0})}function wB(t){return Ume(t.out,t.checks)}function Lme(t){return t.in._zod.traits.has("$ZodTransform")?wB(t):t.in}function bB(t){return ng(t,{pipe:e=>Lme(e._zod.def),default:(e,r)=>r?ot(e._zod.def.innerType):e,catch:(e,r)=>r?e._zod.def.innerType:e})}function _B(t){return ng(t,{pipe:e=>wB(e._zod.def),prefault:(e,r)=>r?e._zod.def.innerType:e})}var NO={};yt(NO,{bigint:()=>Bme,boolean:()=>Hme,date:()=>Kme,number:()=>Vme,string:()=>Fme});function Fme(t){return zR(Wd,t)}function Vme(t){return MR(Jd,t)}function Hme(t){return UR(Gd,t)}function Bme(t){return LR(Xd,t)}function Kme(t){return FR(Wh,t)}var og={name:"@tomato414941/foundation",version:"29.0.4",description:"Manage Foundation resources and use them in local commands.",type:"module",engines:{node:">=24"},bin:{foundation:"dist/cli.mjs"},files:["dist/cli.mjs"],repository:{type:"git",url:"git+https://github.com/tomato414941/foundation.git",directory:"cli"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},license:"MIT"};typeof window<"u"&&h.config({jitless:!0});function SB(t){let e=/^(ssh-ed25519|ssh-rsa|ecdsa-sha2-nistp(?:256|384|521))[ \t]+([A-Za-z0-9+/]+={0,2})(?:[ \t]+[^\r\n\0]*)?$/.exec(t.trim());if(!e)return null;try{let r=Uint8Array.from(atob(e[2]),a=>a.charCodeAt(0)),o=new DataView(r.buffer),n=0,i=()=>{if(n+4>r.length)throw new Error("Invalid SSH key.");let a=o.getUint32(n);if(n+=4,n+a>r.length)throw new Error("Invalid SSH key.");let c=r.subarray(n,n+a);return n+=a,c},s=a=>new TextDecoder().decode(a);if(s(i())!==e[1])return null;if(e[1]==="ssh-ed25519"){if(i().length!==32)return null}else if(e[1]==="ssh-rsa"){let a=i(),c=i();if(!a.length||c.length<256||c.length>1025)return null}else{let a=s(i()),c=i(),u={nistp256:65,nistp384:97,nistp521:133};if(e[1]!=="ecdsa-sha2-"+a||c[0]!==4||c.length!==u[a])return null}return n===r.length?r:null}catch{return null}}var ig=h.string().trim().max(8192).refine(t=>SB(t)!==null,"Use an OpenSSH public key from a .pub file.");function DO(t){if(!SB(t))throw new Error("Use an OpenSSH public key from a .pub file.");let[e,r]=t.trim().split(/[ \t]+/);return{algorithm:e,key:r,publicKey:e+" "+r}}var ep=h.string().max(32).regex(/^[a-z_][a-z0-9_-]*$/,"Use a lowercase account name."),px=h.string().min(1).max(253).regex(/^[A-Za-z0-9_.:]+(?:-[A-Za-z0-9_.:]+)*$/,"Use a host name or IP address."),fx=h.string().min(1).max(1024).regex(/^[A-Za-z0-9._/%-]+$/).refine(t=>!t.split("/").includes("..")&&!/%(?!u)/.test(t)&&!t.endsWith("/"),"Use a file path, with %u for the account."),yFe=h.string().min(1).max(500).regex(/^[A-Za-z0-9.:*?/!_-]+(?:,[A-Za-z0-9.:*?/!_-]+)*$/,"Use comma-separated host or address patterns."),mx=h.string().regex(/^SHA256:[A-Za-z0-9+/]{43}$/);var tp=new TextEncoder,rp=new TextDecoder,xB=new TextDecoder("utf-8",{fatal:!0}),hx=2**32;function pn(...t){let e=t.reduce((n,{length:i})=>n+i,0),r=new Uint8Array(e),o=0;for(let n of t)r.set(n,o),o+=n.length;return r}function zO(t,e,r){if(e<0||e>=hx)throw new RangeError(`value must be >= 0 and <= ${hx-1}. Received ${e}`);t.set([e>>>24,e>>>16,e>>>8,e&255],r)}function jO(t){let e=Math.floor(t/hx),r=t%hx,o=new Uint8Array(8);return zO(o,e,0),zO(o,r,4),o}function gx(t){let e=new Uint8Array(4);return zO(e,t),e}var Zme=/[^\x00-\x7f]/;function Sr(t){if(typeof t=="string"&&t.length>=128){if(Zme.test(t))throw new TypeError("non-ASCII string encountered in encode()");return tp.encode(t)}let e=new Uint8Array(t.length);for(let r=0;r<t.length;r++){let o=t.charCodeAt(r);if(o>127)throw new TypeError("non-ASCII string encountered in encode()");e[r]=o}return e}function EB(t,e=!1){if(Uint8Array.prototype.toBase64)return t.toBase64({alphabet:e?"base64url":"base64",omitPadding:e});let r=32768,o=[];for(let i=0;i<t.length;i+=r)o.push(String.fromCharCode.apply(null,t.subarray(i,i+r)));let n=btoa(o.join(""));return e?n.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"):n}function kB(t,e=!1){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(t,{alphabet:e?"base64url":"base64"});if(e){if(t.includes("+")||t.includes("/"))throw new TypeError("Invalid base64url");t=t.replace(/-/g,"+").replace(/_/g,"/")}let r=atob(t),o=new Uint8Array(r.length);for(let n=0;n<r.length;n++)o[n]=r.charCodeAt(n);return o}async function yx(t,e){let r=`SHA-${t.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(r,e))}var na=class extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,r){super(e,r),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};var qu=class extends na{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"},at=class extends na{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"},ec=class extends na{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(e="decryption operation failed",r){super(e,r)}},U=class extends na{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"},xt=class extends na{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"};var sg=class extends na{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"};var vx=class extends na{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",r){super(e,r)}};var Wme="The input to be decoded is not correctly encoded.";function Zu(t){try{return kB(typeof t=="string"?t:rp.decode(t),!0)}catch(e){throw new TypeError(Wme,{cause:e})}}function Rt(t){return EB(typeof t=="string"?tp.encode(t):t,!0)}function qn(t,e){if(!(t instanceof Uint8Array))throw new TypeError(`${e} must be an instance of Uint8Array`)}function Kt(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||Object.getPrototypeOf(e)===null}function tc(...t){let e=new Set;for(let r of t)if(r)for(let o of Object.keys(r)){if(e.has(o))return!1;e.add(o)}return!0}function go(t,e){if(t!==void 0)throw new TypeError(`${e} can only be called once`)}function Tn(t,e,r){try{return Zu(t)}catch{throw new r(`Failed to base64url decode the ${e}`)}}function wx(t,e,r){try{return Sr(t)}catch{throw new r(`The ${e} is not a valid base64url string`)}}function np(t,e,r){let o;try{o=JSON.parse(xB.decode(Zu(t)))}catch{throw new e(r)}if(!Kt(o))throw new e(r);return o}var bx={__proto__:null,b64:!0},_x={__proto__:null};function ag(t,e){if(e!==void 0&&(!Array.isArray(e)||e.some(r=>typeof r!="string")))throw new TypeError(`"${t}" option must be an array of strings`);return e===void 0?void 0:new Set(e)}function Sx(t,e){let{crit:r}=e??{};if(Array.isArray(r)&&new Set(r).size!==r.length)throw new t('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}function rc(t,e,r,o,n){if(n.crit!==void 0&&o?.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||o.crit===void 0)return[];if(!Array.isArray(o.crit)||o.crit.length===0||o.crit.some(s=>typeof s!="string"||s.length===0))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i=r===void 0?e:{__proto__:null,...r,...e};for(let s of o.crit){if(!(s in i))throw new at(`Extension Header Parameter "${s}" is not recognized`);if(!Object.hasOwn(n,s)||n[s]===void 0)throw new t(`Extension Header Parameter "${s}" is missing`);if(i[s]&&(!Object.hasOwn(o,s)||o[s]===void 0))throw new t(`Extension Header Parameter "${s}" MUST be integrity protected`)}return o.crit}function xx(t,e){if(e.includes("b64")){let r=t.b64;if(typeof r!="boolean")throw new xt('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return r}return!0}function Wu(t,e){let r,o;try{r=JSON.stringify(e),o=JSON.parse(r)}catch(n){throw new t("JOSE Header is not valid JSON",{cause:n})}if(!Kt(o))throw new t("JOSE Header is not a JSON object");return[o,r]}var Jme=t=>t[Symbol.toStringTag],Gme=(t,e,r)=>{let{alg:o}=t;if(e.use!==void 0){let n=r==="sign"||r==="verify"?"sig":"enc";if(e.use!==n)throw new TypeError(`Invalid key for this operation, its "use" must be "${n}" when present`)}if(e.alg!==void 0&&e.alg!==o)throw new TypeError(`Invalid key for this operation, its "alg" must be "${o}" when present`);if(Array.isArray(e.key_ops)){let n=r==="encrypt"||r==="decrypt"?t.ops?.[r==="encrypt"?0:1]:r;if(n&&!e.key_ops.includes(n))throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${n}" when present`)}};async function ti(t,e,r){let{alg:o,secret:n}=t,i=r==="decrypt"||r==="sign";if(n&&e instanceof Uint8Array)return e;let s,a;if(Kt(e)){if(s=HO(e),typeof s.kty!="string")throw IB(o,e,n);if(!(n?s.kty==="oct"&&typeof s.k=="string":s.kty!=="oct"&&(i?s.kty==="AKP"&&typeof s.priv=="string"||typeof s.d=="string":s.d===void 0&&s.priv===void 0)))throw new TypeError(n?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${i?"private":"public"} JWK`);if(Gme(t,s,r),s.kty==="oct")return Zu(s.k);if(!Object.isFrozen(e)){let{key_ops:l}=e;Array.isArray(l)&&Object.freeze(l),Object.freeze(e)}}else{if(!LO(e))throw IB(o,e,n);let l=n?"secret":i?"private":"public";if(e.type!==l&&(n||["secret","public","private"].includes(e.type)))throw new TypeError(`${Jme(e)} instances must be of type "${l}" for the ${o} algorithm`);if(nc(e))return e;if(a=e,a.type==="secret")return a.export()}MO||=new WeakMap;let c=e,u=MO.get(c);if(u?.[o])return u[o];if(u||MO.set(c,u={}),a&&typeof a.toCryptoKey=="function"){let l=a.type==="public",d=Xme[a.asymmetricKeyDetails?.namedCurve],f=t.resolve?.({crv:d,asymmetricKeyType:a.asymmetricKeyType})??t.subtle;return u[o]=a.toCryptoKey(f,l,t.usages[l?0:1])}return s??=a.export({format:"jwk"}),s.alg=o,u[o]=await ip(t,s)}var MO,Xme={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function kx(t){if(!nc(t))throw new Error("CryptoKey instance expected")}var nc=t=>{if(t?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return t instanceof CryptoKey}catch{return!1}},UO=t=>t?.[Symbol.toStringTag]==="KeyObject",LO=t=>nc(t)||UO(t);function $B(t,e,...r){if(r.length>2){let o=r.pop();t+=`one of type ${r.join(", ")}, or ${o}.`}else r.length===2?t+=`one of type ${r[0]} or ${r[1]}.`:t+=`of type ${r[0]}.`;return e==null?t+=` Received ${e}`:typeof e=="function"&&e.name?t+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&e.constructor?.name&&(t+=` Received an instance of ${e.constructor.name}`),t}var oa=(t,...e)=>$B("Key must be ",t,...e);function IB(t,e,r){let o=["CryptoKey","KeyObject","JSON Web Key"];return r&&o.push("Uint8Array"),new TypeError($B(`Key for the ${t} algorithm must be `,e,...o))}var Ex=(t,e="algorithm.name")=>new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`);function FO(t,e){if(e&&!t.usages.includes(e))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${e}.`)}function op(t,e){let{modulusLength:r}=e.algorithm;if(typeof r!="number"||r<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}function VO(t,e,r){let o=t.algorithm;if(o.name!==e.name)throw Ex(e.name);if(e.hash&&o.hash?.name!==e.hash)throw Ex(e.hash,"algorithm.hash");if(e.namedCurve&&o.namedCurve!==e.namedCurve)throw Ex(e.namedCurve,"algorithm.namedCurve");if(e.length!==void 0&&o.length!==e.length)throw Ex(e.length,"algorithm.length");FO(t,r)}function Ix(t){return{__proto__:null,...t}}function HO(t){let e=Ix(t);if(e.ext!==void 0&&typeof e.ext!="boolean")throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(e.key_ops!==void 0){let r=e.key_ops,o=Array.isArray(r)?[...r]:void 0;if(!o||o.some(n=>typeof n!="string")||new Set(o).size!==o.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');e.key_ops=o}return e}function $x(t){if(t!==void 0&&typeof t!="boolean")throw new TypeError('"extractable" option must be a boolean');return t}async function ip(t,e,r){if(!t.kty.includes(e.kty))throw new at('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let o=t.resolve?.({kty:e.kty,crv:e.crv})??t.subtle,n=!!(e.d||e.priv),i={...e,ext:r??e.ext};return i.kty!=="AKP"&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,o,i.ext??!n,e.key_ops??t.usages[n?1:0])}async function ri(t,e,r,o=!1){return t instanceof Uint8Array&&(t=await crypto.subtle.importKey("raw",t,e,o,[r])),VO(t,e,r),t}var Ju=t=>crypto.getRandomValues(new Uint8Array(t.cekBits>>3));function Ax(t,e){let r=t.byteLength<<3;if(r!==e)throw new U(`Invalid Content Encryption Key length. Expected ${e} bits, got ${r} bits`)}var Yme=t=>crypto.getRandomValues(new Uint8Array(t.ivBits>>3));function AB(t,e){if(e.length<<3!==t.ivBits)throw new U("Invalid Initialization Vector length")}async function TB(t,e,r){if(!(e instanceof Uint8Array))throw new TypeError(oa(e,"Uint8Array"));let o=t.cekBits>>1,n=await crypto.subtle.importKey("raw",e.subarray(o>>3),"AES-CBC",!1,[r]),i=await crypto.subtle.importKey("raw",e.subarray(0,o>>3),{hash:`SHA-${o<<1}`,name:"HMAC"},!1,["sign"]);return[n,i,o]}async function PB(t,e,r){return new Uint8Array((await crypto.subtle.sign("HMAC",t,e)).slice(0,r>>3))}async function Qme(t,e,r,o,n){let[i,s,a]=await TB(t,r,"encrypt"),c=new Uint8Array(await crypto.subtle.encrypt({iv:o,name:"AES-CBC"},i,e)),u=pn(n,o,c,jO(n.length*8)),l=await PB(s,u,a);return{ciphertext:c,tag:l,iv:o}}async function ehe(t,e){let r={name:"HMAC",hash:"SHA-256"},o=await crypto.subtle.generateKey(r,!1,["sign","verify"]),n=await crypto.subtle.sign(r,o,t);return crypto.subtle.verify(r,o,n,e)}async function the(t,e,r,o,n,i){let[s,a,c]=await TB(t,e,"decrypt"),u=pn(i,o,r,jO(i.length*8)),l=await PB(a,u,c);try{if(await ehe(n,l))return new Uint8Array(await crypto.subtle.decrypt({iv:o,name:"AES-CBC"},s,r))}catch{}throw new ec}async function Tx(t,e,r,o,n){if(!nc(r)&&!(r instanceof Uint8Array))throw new TypeError(oa(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(o?AB(t,o):o=Yme(t),r instanceof Uint8Array&&Ax(r,t.cekBits),t.cbc)return Qme(t,e,r,o,n);let i=await ri(r,t.subtle,"encrypt"),s=new Uint8Array(await crypto.subtle.encrypt({additionalData:n,iv:o,name:"AES-GCM",tagLength:128},i,e));return{ciphertext:s.subarray(0,-16),tag:s.subarray(-16),iv:o}}async function Px(t,e,r,o,n,i){if(!nc(e)&&!(e instanceof Uint8Array))throw new TypeError(oa(e,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!o)throw new U("JWE Initialization Vector missing");if(!n)throw new U("JWE Authentication Tag missing");if(!t.cbc&&n.length!==16)throw new U("Invalid Authentication Tag length");if(AB(t,o),e instanceof Uint8Array&&Ax(e,t.cekBits),t.cbc)return the(t,e,r,o,n,i);let s=await ri(e,t.subtle,"decrypt");try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:i,iv:o,name:"AES-GCM",tagLength:128},s,pn(r,n)))}catch{throw new ec}}function cg(t){let e={__proto__:null};for(let r in t)e[r]={...t[r],alg:r};return e}var rhe=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],nhe=[[],["deriveBits"]],Ox=[[],[]];function Rx(t){return{kty:["RSA"],mode:"key-encryption",subtle:{name:"RSA-OAEP",hash:`SHA-${t}`},usages:rhe,ops:["wrapKey","unwrapKey"]}}function Cx(t){return{kty:["EC","OKP"],mode:t,subtle:{name:"ECDH"},resolve:({kty:e,crv:r,asymmetricKeyType:o})=>{if(r==="X25519"||o==="x25519")return{name:"X25519"};if(e==="OKP")throw new at('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:r}},usages:nhe,ops:[void 0,"deriveBits"]}}function sp(t,e=!1){return{kty:["oct"],mode:"key-wrapping",secret:!0,subtle:{name:e?"AES-GCM":"AES-KW",length:t},usages:Ox,ops:e?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function BO(){return{kty:["oct"],mode:"key-wrapping",secret:!0,subtle:{name:"PBKDF2"},usages:Ox,ops:["deriveBits","deriveBits"]}}var ia=cg({dir:{kty:["oct"],mode:"direct-encryption",secret:!0,subtle:{name:"AES-GCM"},usages:Ox,ops:["encrypt","decrypt"]},"RSA-OAEP":Rx(1),"RSA-OAEP-256":Rx(256),"RSA-OAEP-384":Rx(384),"RSA-OAEP-512":Rx(512),"ECDH-ES":Cx("direct-key-agreement"),"ECDH-ES+A128KW":Cx("key-agreement-with-key-wrapping"),"ECDH-ES+A192KW":Cx("key-agreement-with-key-wrapping"),"ECDH-ES+A256KW":Cx("key-agreement-with-key-wrapping"),A128KW:sp(128),A192KW:sp(192),A256KW:sp(256),A128GCMKW:sp(128,!0),A192GCMKW:sp(192,!0),A256GCMKW:sp(256,!0),"PBES2-HS256+A128KW":BO(),"PBES2-HS384+A192KW":BO(),"PBES2-HS512+A256KW":BO()}),ohe=["encrypt","decrypt"];function ap(t,e=!1){return{kty:["oct"],secret:!0,subtle:{name:e?"AES-CBC":"AES-GCM",length:t},usages:Ox,ops:ohe,cekBits:t,ivBits:e?128:96,cbc:e}}var ihe=cg({A128GCM:ap(128),A192GCM:ap(192),A256GCM:ap(256),"A128CBC-HS256":ap(256,!0),"A192CBC-HS384":ap(384,!0),"A256CBC-HS512":ap(512,!0)});function RB(t,e){throw new at(`Invalid or unsupported "${t}" (JWE ${e}) header value`)}function ni(t){return(typeof t=="string"?ia[t]:void 0)??RB("alg","Algorithm")}function oi(t){return t.mode==="key-wrapping"||t.mode==="key-encryption"||t.mode==="key-agreement-with-key-wrapping"}function Gu(t){return(typeof t=="string"?ihe[t]:void 0)??RB("enc","Encryption Algorithm")}function CB(t,e){if(t.algorithm.name!=="ECDH"&&t.algorithm.name!=="X25519")throw new TypeError("CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519");FO(t,e)}async function she(t,e,r){let o=await ri(e,ni(t).subtle,"wrapKey",!0),n=await crypto.subtle.importKey("raw",r,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",n,o,"AES-KW"))}async function ahe(t,e,r){let o=await ri(e,ni(t).subtle,"unwrapKey",!0),n=await crypto.subtle.unwrapKey("raw",r,o,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",n))}function NB(t,e,r){VO(e,ni(t).subtle,r),op(t,e)}async function DB(t,e,r,o){if(!(t instanceof Uint8Array)||t.length<8)throw new U("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(r)||Math.sign(r)!==1)throw new U("PBES2 Count Input must be a positive integer");let n=pn(Sr(e),Uint8Array.of(0),t),i=parseInt(e.slice(13,16),10),s={hash:`SHA-${e.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:n},a=await ri(o,ni(e).subtle,"deriveBits");return new Uint8Array(await crypto.subtle.deriveBits(s,a,i))}function KO(t){return pn(gx(t.length),t)}async function che(t,e,r){let o=e>>3,n=32,i=Math.ceil(o/n),s=new Uint8Array(i*n);for(let a=1;a<=i;a++){let c=await yx("sha256",pn(gx(a),t,r));s.set(c,(a-1)*n)}return s.slice(0,o)}async function zB(t,e,r,o,n=new Uint8Array,i=new Uint8Array){CB(t),CB(e,"deriveBits");let s=pn(KO(Sr(r)),KO(n),KO(i),gx(o)),a=new Uint8Array(await crypto.subtle.deriveBits({name:t.algorithm.name,public:t},e,t.algorithm.name==="X25519"?256:Math.ceil(parseInt(t.algorithm.namedCurve.slice(-3),10)/8)<<3));return che(a,o,s)}function jB(t){kx(t);let e=t.algorithm.namedCurve;if(e!=="P-256"&&e!=="P-384"&&e!=="P-521"&&t.algorithm.name!=="X25519")throw new at("ECDH with the provided key is not allowed or not supported by your javascript runtime")}function Nx(t,e){let r=t[e];if(r!==void 0){if(typeof r!="string")throw new U(`JOSE Header "${e}" (Agreement Party${e==="apu"?"U":"V"}Info) invalid`);return Tn(r,e,U)}}function MB(t,e){if(!(t===void 0||e===void 0||t.byteLength!==e.byteLength)){for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return;throw new U('JOSE Header "apu" and "apv" values must be distinct')}}function uhe(t){if(t===void 0)throw new U("JWE Encrypted Key missing")}function OB(t){if(t!==void 0)throw new U("Encountered unexpected JWE Encrypted Key")}function lhe(t){if(t!==void 0&&t!==1/0&&(!Number.isSafeInteger(t)||t<1))throw new TypeError("maxPBES2Count must be a positive safe integer or Infinity")}async function UB(t,e,r,o,n,i){let{alg:s}=t,a=t.mode;if(a==="direct-encryption")return OB(o),r;let c=a==="direct-key-agreement";switch(c?OB(o):uhe(o),t.subtle.name){case"ECDH":{let{epk:u}=n;if(!Kt(u)||["d","k","p","q","dp","dq","qi","oth","priv"].some(m=>Object.hasOwn(u,m)))throw new U('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');jB(r);let l=await ip(t,u),d=Nx(n,"apu"),f=Nx(n,"apv");MB(d,f);let p=await zB(l,r,c?e.alg:s,c?e.cekBits:parseInt(s.slice(-5,-2),10),d,f);if(c)return p;r=p;break}case"RSA-OAEP":return kx(r),NB(s,r,"decrypt"),new Uint8Array(await crypto.subtle.decrypt("RSA-OAEP",r,o));case"PBKDF2":{if(typeof n.p2c!="number")throw new U('JOSE Header "p2c" (PBES2 Count) missing or invalid');lhe(i);let u=i??1e4;if(n.p2c>u)throw new U('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof n.p2s!="string")throw new U('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let l=Tn(n.p2s,"p2s",U);r=await DB(l,s,n.p2c,r);break}case"AES-GCM":{if(typeof n.iv!="string")throw new U('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof n.tag!="string")throw new U('JOSE Header "tag" (Authentication Tag) missing or invalid');let u=Tn(n.iv,"iv",U),l=Tn(n.tag,"tag",U);if(u.byteLength!==12)throw new U("Invalid Initialization Vector length");if(l.byteLength!==16)throw new U("Invalid Authentication Tag length");return Px(Gu(s.slice(0,-2)),r,o,u,l,new Uint8Array)}}return ahe(s.slice(-6),r,o)}async function Dx(t,e,r,o,n,i={}){let{alg:s,mode:a}=t,c=oi(t);if(n!==void 0&&!c)throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${s}`);let u=await ti(a==="direct-encryption"?e:t,r,"encrypt");if(a==="direct-encryption")return[u,void 0,void 0];let l=c?n??Ju(e):void 0;l&&Ax(l,e.cekBits);let d,f;switch(t.subtle.name){case"ECDH":{jB(u);let{apu:p,apv:m}=i;p!==void 0&&qn(p,'"apu"'),m!==void 0&&qn(m,'"apv"');let g=p??Nx(o,"apu"),y=m??Nx(o,"apv");MB(g,y);let w;i.epk!==void 0?w=await ti(t,i.epk,"decrypt"):w=(await crypto.subtle.generateKey(u.algorithm,!0,["deriveBits"])).privateKey;let b=crypto.subtle,_=w;if(!_.extractable){if(typeof b.getPublicKey!="function")throw new TypeError('CryptoKey for "epk" must be extractable');_=await b.getPublicKey(w,[])}let{x:k,y:$,crv:D,kty:K}=await b.exportKey("jwk",_),te=a==="direct-key-agreement",Ie=await zB(u,w,te?e.alg:s,te?e.cekBits:parseInt(s.slice(-5,-2),10),g,y),xe={x:k,crv:D,kty:K};if(K==="EC"&&(xe.y=$),f={epk:xe},p!==void 0&&(f.apu=Rt(p)),m!==void 0&&(f.apv=Rt(m)),te)return[Ie,void 0,f];u=Ie;break}case"RSA-OAEP":{kx(u),NB(s,u,"encrypt"),d=new Uint8Array(await crypto.subtle.encrypt("RSA-OAEP",u,l));break}case"PBKDF2":{let{p2c:p=2048,p2s:m=crypto.getRandomValues(new Uint8Array(16))}=i;u=await DB(m,s,p,u),f={p2c:p,p2s:Rt(m)};break}case"AES-GCM":{let p=i.iv===void 0?crypto.getRandomValues(new Uint8Array(12)):i.iv;if(!(p instanceof Uint8Array))throw new TypeError('"iv" must be an instance of Uint8Array');let m=await Tx(Gu(s.slice(0,-2)),l,u,p,new Uint8Array);d=m.ciphertext,f={iv:Rt(m.iv),tag:Rt(m.tag)}}}if(d??=await she(s.slice(-6),u,l),!(d instanceof Uint8Array)||!d.byteLength)throw new TypeError("JWE key management algorithm did not produce an Encrypted Key");return[l,d,f]}function zx(t,e){if(t.zip!==void 0&&t.zip!=="DEF")throw new at('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(t.zip!==void 0&&!e?.zip)throw new U('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.')}function LB(t){if(typeof globalThis[t]>"u")throw new at(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${t} API.`)}async function FB(t,e,r=1/0){let o=t.writable.getWriter();o.write(e).catch(()=>{}),o.close().catch(()=>{});let n=[],i=0,s=t.readable.getReader();for(;;){let{value:a,done:c}=await s.read();if(c)break;if(n.push(a),i+=a.byteLength,r!==1/0&&i>r)throw new U("Decompressed plaintext exceeded the configured limit")}return pn(...n)}async function VB(t){return LB("CompressionStream"),FB(new CompressionStream("deflate-raw"),t)}async function HB(t,e){return LB("DecompressionStream"),FB(new DecompressionStream("deflate-raw"),t,e)}function BB(t){let{aad:e,ciphertext:r,iv:o,protected:n,tag:i,unprotected:s}=t;if(o!==void 0&&(typeof o!="string"||!o))throw new U("JWE Initialization Vector incorrect type");if(typeof r!="string")throw new U("JWE Ciphertext missing or incorrect type");if(i!==void 0&&(typeof i!="string"||!i))throw new U("JWE Authentication Tag incorrect type");if(n!==void 0&&typeof n!="string")throw new U("JWE Protected Header incorrect type");if(e!==void 0&&(typeof e!="string"||!e))throw new U("JWE AAD incorrect type");if(s!==void 0&&!Kt(s))throw new U("JWE Shared Unprotected Header incorrect type");return{aad:e,ciphertext:r,iv:o,protected:n,tag:i,unprotected:s===void 0?void 0:{...s}}}function KB(t){let e,r;try{let{header:o}=t;if(Kt(o)){r=o.alg;let i=Object.keys(o);i.includes("alg")||(r=void 0),e=Object.fromEntries(i.map(s=>[s,s==="alg"?r:o[s]]))}else e=o;let{encrypted_key:n}=t;return[{encrypted_key:n,header:e},r]}catch(o){return[void 0,r,o]}}function qB(t){let{encrypted_key:e,header:r}=t;if(e!==void 0&&typeof e!="string")throw new U("JWE Encrypted Key incorrect type");if(r!==void 0&&!Kt(r))throw new U("JWE Per-Recipient Unprotected Header incorrect type");if(t.protected===void 0&&r===void 0&&t.unprotected===void 0)throw new U("JOSE Header missing")}function qO(t){let{protected:e,ciphertext:r,iv:o,tag:n,aad:i}=t,s;return e!==void 0&&(s=np(e,U,"JWE Protected Header is invalid")),[s,Tn(r,"ciphertext",U),o!==void 0?Tn(o,"iv",U):void 0,n!==void 0?Tn(n,"tag",U):void 0,wx((e??"")+(i!==void 0?`.${i}`:""),"aad",U)]}function jx(t){return[t&&ag("keyManagementAlgorithms",t.keyManagementAlgorithms),t&&ag("contentEncryptionAlgorithms",t.contentEncryptionAlgorithms),t?.crit,t?.maxPBES2Count,t?.maxDecompressedLength]}async function ZO(t,e,r,o=qO(t)){let[n,i,s,a,c]=o,{header:u,unprotected:l,aad:d}=t,f;if(u!==void 0||l!==void 0){if(!tc(n,u,l))throw new U("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");f={...n,...u,...l}}else f=n??{};let[p,m,g,y,w]=e,{encrypted_key:b}=t;rc(U,_x,g,n,f),zx(f,n);let{alg:_,enc:k}=f;if(typeof _!="string"||!_)throw new U("missing JWE Algorithm (alg) in JWE Header");let $=ia[_];if(b===""&&(!$||!oi($)))throw new U("JWE Encrypted Key incorrect type");let D=$?.mode==="integrated-encryption";if(!D&&(typeof k!="string"||!k))throw new U("missing JWE Encryption Algorithm (enc) in JWE Header");if(p&&!p.has(_)||!p&&_.startsWith("PBES2"))throw new qu('"alg" (Algorithm) Header Parameter value not allowed');let K;if(D){if(k!==void 0)throw new U('JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption');if(s?.byteLength)throw new U("JWE Initialization Vector must be empty for integrated encryption");if(a?.byteLength)throw new U("JWE Authentication Tag must be empty for integrated encryption")}else{if(m&&!m.has(k))throw new qu('"enc" (Encryption Algorithm) Header Parameter value not allowed');K=Gu(k)}let te;if(b!==void 0)try{te=Tn(b,"encrypted_key",U)}catch($e){if(!$||!oi($))throw $e;te=new Uint8Array}let Ie=!1;typeof r=="function"&&(r=await r(n,t),Ie=!0);let xe=$??ni(_);oi(xe)&&te===void 0&&(te=new Uint8Array);let Qe=await ti(xe.mode==="direct-encryption"?K:xe,r,"decrypt"),Fe;if(xe.mode==="integrated-encryption")Fe=await xe.decrypt(Qe,te,i,c,n,f);else{let $e=K,J;try{J=await UB(xe,$e,Qe,te,f,y),oi(xe)&&J instanceof Uint8Array&&J.byteLength<<3!==$e.cekBits&&(J=Ju($e))}catch(Tt){if(Tt instanceof TypeError||Tt instanceof U||Tt instanceof at)throw Tt;J=Ju($e)}Fe=await Px($e,J,i,s,a,c)}if(f.zip==="DEF"){let $e=w??25e4;if($e===0)throw new at('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if($e!==1/0&&(!Number.isSafeInteger($e)||$e<1))throw new TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");Fe=await HB(Fe,$e).catch(J=>{throw J instanceof U?J:new U("Failed to decompress plaintext",{cause:J})})}return{plaintext:Fe,...n&&{protectedHeader:n},...d!==void 0&&{additionalAuthenticatedData:Tn(d,"aad",U)},...l&&{sharedUnprotectedHeader:l},...u&&{unprotectedHeader:u},...Ie&&{key:Qe}}}async function ZB(t,e,r){if(t instanceof Uint8Array&&(t=rp.decode(t)),typeof t!="string")throw new U("Compact JWE must be a string or Uint8Array");let{0:o,1:n,2:i,3:s,4:a,length:c}=t.split(".");if(c!==5)throw new U("Invalid Compact JWE");return ZO({ciphertext:s,iv:i||void 0,protected:o,tag:a||void 0,encrypted_key:n||void 0},e,r)}async function ug(t,e,r){return ZB(t,jx(r),e)}async function WO(t,e,r){if(!Kt(t))throw new U("General JWE must be an object");let o=t.recipients;if(!Array.isArray(o))throw new U("JWE Recipients missing or incorrect type");let n=Array.from(o);if(!n.every(Kt))throw new U("JWE Recipients missing or incorrect type");if(!n.length)throw new U("JWE Recipients has no members");let i,s,a;try{i=jx(r),s=BB(t),a=qO(s)}catch{throw new ec}let c=n.map(u=>KB(u));if(n.length>1)for(let[,u]of c){let l=a[0]?.alg??u??s.unprotected?.alg,d=typeof l=="string"?ia[l]:void 0;if(d&&!oi(d))throw new U(`"${l}" alg may only have a single recipient`)}for(let[u]of c)if(u)try{let l={...s,...u};return qB(l),await ZO(l,i,e,a)}catch{}throw new ec}function Mx(t,e,r){if(!tc(t,e,r))throw new U("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint")}function JO(t,e,r=!1){if(!t[1]&&!t[2]&&!t[3])throw new U("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");e!==void 0&&(t[8]=e?.crit);let[,o,n,i,s,a,c,u,l]=t;if(s!==void 0&&qn(s,"JWE Additional Authenticated Data"),a!==void 0&&qn(a,"JWE Content Encryption Key"),c!==void 0&&qn(c,"JWE Initialization Vector"),!r&&o!==void 0&&(o=Wu(U,o)[0],t[1]=o),n!==void 0&&(n=Wu(U,n)[0],t[2]=n),!r&&i!==void 0&&(i=Wu(U,i)[0],t[3]=i),u!==void 0&&!Kt(u))throw new TypeError("JWE Key Management Parameters must be an object");Mx(o,n,i);let d={...o,...n,...i};Sx(U,o),rc(U,_x,l,o,d),zx(d,o);let{alg:f,enc:p}=d;if(typeof f!="string"||!f)throw new U('JWE "alg" (Algorithm) Header Parameter missing or invalid');let m=ia[f];if(m?.mode==="integrated-encryption"){if(p!==void 0)throw new U('JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption');if(a!==void 0)throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${f}`);if(c!==void 0)throw new TypeError(`setInitializationVector cannot be called with JWE "alg" (Algorithm) Header ${f}`);return[d,void 0,m]}if(typeof p!="string"||!p)throw new U('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');return[d,Gu(p),m]}async function GO(t,e,r){let[o,n,i]=e,[s,a,c,u,l,d,f,p,,m]=t,g=a,y=c,w=i??ni(o.alg),b,_,k;w.mode==="integrated-encryption"?k=await ti(w,r,"encrypt"):[k,b,_]=await Dx(w,n,r,o,d,p),_&&(m?y=y?{...y,..._}:_:g=g?{...g,..._}:_,Mx(g,y,u));let $=g?Rt(JSON.stringify(g)):"",D=l?.byteLength?Rt(l):void 0,K=Sr(D?`${$}.${D}`:$),te=s;o.zip==="DEF"&&(te=await VB(te).catch($e=>{throw new U("Failed to compress plaintext",{cause:$e})}));let Ie,xe,Qe;w.mode==="integrated-encryption"?[b,Ie]=await w.encrypt(k,te,K,g,o,p):{ciphertext:Ie,tag:xe,iv:Qe}=await Tx(n,te,k,f,K);let Fe={ciphertext:Rt(Ie)};return Qe&&(Fe.iv=Rt(Qe)),xe&&(Fe.tag=Rt(xe)),b?.byteLength&&(Fe.encrypted_key=Rt(b)),D&&(Fe.aad=D),g&&(Fe.protected=$),u&&(Fe.unprotected=u),y&&(Fe.header=y),Fe}async function WB(t,e,r){return GO(t,JO(t,r),e)}function JB(t){return[t.protected,t.encrypted_key,t.iv,t.ciphertext,t.tag].join(".")}var XO=class{#e;state;constructor(e,r,o){this.#e=e,this.state=[void 0,void 0,r,o]}setUnprotectedHeader(e){return go(this.state[0],"setUnprotectedHeader"),this.state[0]=e,this}setKeyManagementParameters(e){return go(this.state[1],"setKeyManagementParameters"),this.state[1]=e,this}addRecipient(...e){return this.#e.addRecipient(...e)}encrypt(...e){return this.#e.encrypt(...e)}done(){return this.#e}},lg=class{#e;#t=[];#r;#n;#o;constructor(e){this.#e=e}addRecipient(e,r){let o=new XO(this,e,r?.crit);return this.#t.push(o),o}setProtectedHeader(e){return go(this.#r,"setProtectedHeader"),this.#r=e,this}setSharedUnprotectedHeader(e){return go(this.#n,"setSharedUnprotectedHeader"),this.#n=e,this}setAdditionalAuthenticatedData(e){return this.#o=e,this}async encrypt(){if(!this.#t.length)throw new U("at least one recipient must be added");qn(this.#e,"plaintext");let e=this.#t.length>1,r,o=this.#r,n=this.#n,i=[];for(let m of this.#t){let[g,y,w,b]=m.state,_=[this.#e,o,g,n,this.#o,void 0,void 0,y,b,e],k=JO(_,void 0,i.length>0);i.length||(o=_[1],n=_[3]),i.push([_,k,w]);let[{alg:$,enc:D},,K]=k;if(e&&K&&!oi(K))throw new U(`"${$}" alg may only have a single recipient`);if(!r)r=D;else if(r!==D)throw new U('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}for(let[,m]of i)m[2]??=ni(m[0].alg);let[s,a,c]=i[0],u=e?Ju(a[1]):void 0;s[5]=u;let{encrypted_key:l,header:d,...f}=await GO(s,a,c),p={...f,recipients:[{}]};l&&(p.recipients[0].encrypted_key=l),d&&(p.recipients[0].header=d);for(let m=1;m<i.length;m++){let[g,[y,w,b],_]=i[m],k=g[2],[,$,D]=await Dx(b,w,_,y,u,g[7]),K={encrypted_key:Rt($)};if(k||D){let te={...k,...D};D&&Mx(g[1],te,g[3]),K.header=te}p.recipients.push(K)}return p}};var dg=[["verify"],["sign"]];function YO(t){let e={name:"HMAC",hash:`SHA-${t}`};return{kty:["oct"],secret:!0,subtle:e,signing:e,usages:dg}}function cp(t,e){let r={name:e?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${t}`};return{kty:["RSA"],subtle:r,signing:e?{...r,saltLength:e}:r,usages:dg,minRsaBits:2048}}function QO(t,e){return{kty:["EC"],crv:t,subtle:{name:"ECDSA",namedCurve:t},signing:{name:"ECDSA",hash:`SHA-${e}`},usages:dg}}function GB(){let t={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:t,signing:t,usages:dg}}function eN(t){let e={name:`ML-DSA-${t}`};return{kty:["AKP"],subtle:e,signing:e,usages:dg}}var tN=cg({HS256:YO(256),HS384:YO(384),HS512:YO(512),RS256:cp(256),RS384:cp(384),RS512:cp(512),PS256:cp(256,32),PS384:cp(384,48),PS512:cp(512,64),ES256:QO("P-256",256),ES384:QO("P-384",384),ES512:QO("P-521",512),EdDSA:GB(),Ed25519:GB(),"ML-DSA-44":eN(44),"ML-DSA-65":eN(65),"ML-DSA-87":eN(87)});function Ux(t){let e=typeof t=="string"?tN[t]:void 0;if(!e)throw new at(`alg ${t} is not supported either by JOSE or your javascript runtime`);return e}function XB(t){return[t&&ag("algorithms",t.algorithms),t?.crit]}function dhe(t){return t===void 0?{}:np(t,xt,"JWS Protected Header is invalid")}function phe(t){try{return Sr(t)}catch{throw new xt("JWS Compact Serialization payload must use only ASCII characters")}}async function fhe(t,e,r,o,n){let{protected:i,header:s,payload:a}=t,c=n??dhe(i);if(!tc(c,s))throw new xt("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let u={...c,...s},l=xx(c,rc(xt,bx,e[1],c,u)),{alg:d}=u;if(typeof d!="string"||!d)throw new xt('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(e[0]&&!e[0].has(d))throw new qu('"alg" (Algorithm) Header Parameter value not allowed');if(l){if(typeof a!="string")throw new xt("JWS Payload must be a string")}else if(typeof a!="string"&&!(a instanceof Uint8Array))throw new xt("JWS Payload must be a string or an Uint8Array instance");let f=l||typeof a!="string"?a:o(a),p=!1;typeof r=="function"&&(r=await r(c,t),p=!0);let m=Ux(d),g=pn(i!==void 0?Sr(i):new Uint8Array,Sr("."),typeof f=="string"?e[2]??=wx(f,"payload",xt):f),y=Tn(t.signature,"signature",xt),w=await ti(m,r,"verify"),b=await ri(w,m.subtle,"verify");m.minRsaBits&&op(m.alg,b);let _=!1;try{_=await crypto.subtle.verify(m.signing,b,y,g)}catch{}if(!_)throw new vx;let k={payload:typeof f=="string"?Tn(f,"payload",xt):f};return i!==void 0&&(k.protectedHeader=c),s!==void 0&&(k.unprotectedHeader=s),p?[{...k,key:w},l]:[k,l]}async function YB(t,e,r){if(t instanceof Uint8Array&&(t=rp.decode(t)),typeof t!="string")throw new xt("Compact JWS must be a string or Uint8Array");let{0:o,1:n,2:i,length:s}=t.split(".");if(s!==3)throw new xt("Invalid Compact JWS");return fhe({payload:n,protected:o,signature:i},e,r,phe)}async function rN(t,e,r){let[o]=await YB(t,XB(r),e);return o}var up=class{#e;constructor(e){qn(e,"plaintext"),this.#e=[e]}setContentEncryptionKey(e){return go(this.#e[5],"setContentEncryptionKey"),this.#e[5]=e,this}setInitializationVector(e){return go(this.#e[6],"setInitializationVector"),this.#e[6]=e,this}setProtectedHeader(e){return go(this.#e[1],"setProtectedHeader"),this.#e[1]=e,this}setKeyManagementParameters(e){return go(this.#e[7],"setKeyManagementParameters"),this.#e[7]=e,this}async encrypt(e,r){return JB(await WB([...this.#e],e,r))}};async function mhe(t,e,r){let[o,n,i,s]=t,a="";if(n!==void 0){let w=Wu(xt,n);n=w[0],a=Rt(w[1])}if(i!==void 0&&(i=Wu(xt,i)[0]),!n&&!i)throw new xt("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!tc(n,i))throw new xt("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let c={...n,...i};Sx(xt,n);let u=xx(n,rc(xt,bx,s,n,c));u||r?.();let{alg:l}=c;if(typeof l!="string"||!l)throw new xt('JWS "alg" (Algorithm) Header Parameter missing or invalid');let d=Ux(l),f="",p=o,m;if(u){let w=t[4];w?(f=w[0]??=Rt(o),p=w[1]??=Sr(f)):(f=Rt(o),m=tp.encode(`${a}.${f}`))}m??=pn(Sr(a),Sr("."),p);let g=await ri(await ti(d,e,"sign"),d.subtle,"sign");d.minRsaBits&&op(d.alg,g);let y={signature:Rt(new Uint8Array(await crypto.subtle.sign(d.signing,g,m))),payload:f};return n&&(y.protected=a),i&&(y.header=i),[y,u]}async function QB(t,e,r,o,n){let[i]=await mhe([t,e,void 0,r],o,n);return`${i.protected}.${i.payload}.${i.signature}`}var pg=class{#e;#t;constructor(e){qn(e,"payload"),this.#e=e}setProtectedHeader(e){return go(this.#t,"setProtectedHeader"),this.#t=e,this}async sign(e,r){return QB(this.#e,this.#t,r?.crit,e,()=>{throw new TypeError("use the flattened module for creating JWS with b64: false")})}};var nN='"alg" (Algorithm)';function oN(t='JWK "alg" (Algorithm) Parameter'){throw new at(`Invalid or unsupported ${t} value`)}function fg(t,e){return(typeof t=="string"?tN[t]??ia[t]:void 0)??oN(e)}async function oc(t){if(UO(t))if(t.type==="secret")t=t.export();else return t.export({format:"jwk"});if(t instanceof Uint8Array)return{kty:"oct",k:Rt(t)};if(!nc(t))throw new TypeError(oa(t,"CryptoKey","KeyObject","Uint8Array"));if(!t.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");let e=await crypto.subtle.exportKey("jwk",t);delete e.ext,delete e.key_ops,delete e.use,e.kty!=="AKP"&&delete e.alg;for(let r of Object.keys(e))e[r]===void 0&&delete e[r];return e}var sa=(t,e)=>{if(typeof t!="string"||!t)throw new sg(`${e} missing or invalid`)};async function iN(t,e){let r;if(Kt(t)){if(r=Ix(t),typeof r.kty!="string")throw new TypeError(oa(t,"CryptoKey","KeyObject","JSON Web Key"))}else if(LO(t))r=Ix(await oc(t));else throw new TypeError(oa(t,"CryptoKey","KeyObject","JSON Web Key"));if(e??="sha256",e!=="sha256"&&e!=="sha384"&&e!=="sha512")throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let o;switch(r.kty){case"AKP":sa(r.alg,'"alg" (Algorithm) Parameter'),sa(r.pub,'"pub" (Public key) Parameter'),o={alg:r.alg,kty:r.kty,pub:r.pub};break;case"EC":sa(r.crv,'"crv" (Curve) Parameter'),sa(r.x,'"x" (X Coordinate) Parameter'),sa(r.y,'"y" (Y Coordinate) Parameter'),o={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":sa(r.crv,'"crv" (Subtype of Key Pair) Parameter'),sa(r.x,'"x" (Public Key) Parameter'),o={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":sa(r.e,'"e" (Exponent) Parameter'),sa(r.n,'"n" (Modulus) Parameter'),o={e:r.e,kty:r.kty,n:r.n};break;case"oct":if(typeof r.k!="string")throw new sg('"k" (Key Value) Parameter missing or invalid');o={k:r.k,kty:r.kty};break;default:throw new at('"kty" (Key Type) Parameter missing or unsupported')}let n=Sr(JSON.stringify(o));return Rt(await yx(e,n))}async function yo(t,e,r){if(!Kt(t))throw new TypeError("JWK must be an object");let o=HO(t),n=$x(r?.extractable),{alg:i}=o;if(e??=i,o.kty!=="oct"&&!e)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');switch(o.kty){case"oct":if(typeof o.k!="string")throw new TypeError('missing "k" (Key Value) Parameter value');return Zu(o.k);case"AKP":{if(typeof i!="string"||!i)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(e!==i)throw new TypeError("JWK alg and alg option value mismatch");return ip(fg(e),o,n)}case"RSA":case"EC":case"OKP":return ip(fg(e),o,n);default:throw new at('Unsupported "kty" (Key Type) Parameter value')}}function sN(t){let e;if(typeof t=="string"){let o=t.split(".");(o.length===3||o.length===5)&&([e]=o)}else if(typeof t=="object"&&t)if("protected"in t)e=t.protected;else throw new TypeError("Token does not contain a Protected Header");let r="Invalid Token or Protected Header formatting";if(typeof e!="string"||!e)throw new TypeError(r);return np(e,TypeError,r)}function hhe(t){let e=t?.modulusLength??2048;if(typeof e!="number"||!Number.isInteger(e)||e<2048)throw new at("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return e}async function mg(t,e){let r=$x(e?.extractable),o=fg(t,nN);o.secret&&oN(nN);let n;if(o.resolve){let i=e?.crv??"P-256";if(!["P-256","P-384","P-521","X25519"].includes(i))throw new at("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519");n=o.resolve({crv:i})}else{if(o.crv!==void 0&&e?.crv!==void 0&&e.crv!==o.crv)throw new at(`Invalid or unsupported crv option provided, the only supported value for ${t} is ${o.crv}`);n=o.kty[0]==="RSA"?{...o.subtle,publicExponent:Uint8Array.of(1,0,1),modulusLength:hhe(e)}:o.subtle}return crypto.subtle.generateKey(n,r??!1,[...o.usages[1],...o.usages[0]])}var nK=h.string().regex(/^[a-z]{2}(?:-gov)?-[a-z]+-\d$/),oK=h.string().max(2e3).regex(/^arn:aws(?:-us-gov|-cn)?:iam::\d{12}:role\/.+/),eK=h.string().min(1).max(128),tK=h.string().min(1).max(16384),ghe=h.discriminatedUnion("kind",[h.object({kind:h.literal("access_key"),accessKeyId:eK,secretAccessKey:tK}).strict(),h.object({kind:h.literal("session"),accessKeyId:eK,secretAccessKey:tK,sessionToken:h.string().min(1).max(16384),expiresAt:h.number().int().positive().max(Number.MAX_SAFE_INTEGER)}).strict(),h.object({kind:h.literal("environment")}).strict()]),yhe=h.object({arn:oK,externalId:h.string().min(2).max(1224).regex(/^[\w+=,.@:\/-]+$/).optional()}).strict(),aa=h.object({authentication:ghe,region:nK,role:yhe.optional()}).strict(),Lx=h.object({accountId:h.string().regex(/^\d{12}$/),principalId:h.string().min(1).max(256),arn:h.string().max(2e3).regex(/^arn:aws(?:-us-gov|-cn)?:(?:iam|sts)::\d{12}:.+/)}).strict(),Fx=aa.extend({sourceIdentity:Lx.optional(),identity:Lx.optional()}).strict();function lp(t){return t.includes(":assumed-role/")?t.slice(0,t.lastIndexOf("/")):t}function rK(t){return{...t,arn:lp(t.arn)}}function iK(t){return{authentication:t.authentication.kind,region:t.region,role:t.role??null,...t.sourceIdentity?{sourceIdentity:rK(t.sourceIdentity)}:{},...t.identity?{identity:rK(t.identity)}:{}}}var Vx=h.object({authentication:h.enum(["access_key","session","environment"]),region:nK,sourceAccountId:h.string().regex(/^\d{12}$/).optional(),sourceArn:h.string().max(2e3).optional(),roleArn:oK.optional(),expiresAt:h.number().int().positive().optional()}).strict();function sK(t){return{authentication:t.authentication.kind,region:t.region,...t.sourceIdentity?{sourceAccountId:t.sourceIdentity.accountId,sourceArn:t.sourceIdentity.arn}:{},...t.role?{roleArn:t.role.arn}:{},...t.authentication.kind==="session"?{expiresAt:t.authentication.expiresAt}:{}}}var aK=h.object({method:h.enum(["GET","POST","PUT","DELETE","PATCH"]),path:h.string().min(1).max(1e3).regex(/^\/[^\s\u0000]*$/)}).strict(),hg=h.object({account:h.string().min(1),identities:h.array(h.string()),user:h.string().nullable(),description:h.string().nullable(),roles:h.array(h.string()).nullable(),credentialId:h.number().int().positive(),rules:h.array(aK),allowedIPs:h.array(h.string()).nullable(),expiresAt:h.number().nullable()}).strict();function cK(t){return t.map(e=>{let r=e.match(/^(GET|POST|PUT|DELETE|PATCH) (\/[^\s\u0000]*)$/);if(!r)throw new Error("Use one HTTP method and API path for each OVH permission.");return aK.parse({method:r[1],path:r[2]})})}typeof window<"u"&&h.config({jitless:!0});var E=h.uuid(),me=h.string().trim().min(1).max(200).regex(/^[^\u0000-\u001f\u007f]+$/u),Ve=h.iso.datetime(),Zn=h.json(),xr=h.record(h.string(),Zn),uK=h.enum(["ja","en"]),lK=h.enum(["read","create","update","delete","share","transfer","reveal","use","manage_credentials","manage_billing","export"]);var dK=h.enum(["variable","connection","service","method","app","object","keyring","ssh_key","ssh_host"]),fn=h.object({kty:h.literal("EC"),crv:h.literal("P-256"),x:h.string().min(40).max(50),y:h.string().min(40).max(50)}).strict(),vhe=h.object({alg:h.literal("dir"),enc:h.literal("A256GCM"),sub:E}).strict(),vg=h.string().max(16384).regex(/^[A-Za-z0-9_-]+\.\.[A-Za-z0-9_-]{16}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]{22}$/).refine(t=>{try{return vhe.safeParse(sN(t)).success}catch{return!1}},"Use an A256GCM JWE for the wrapped encryption key.").brand(),Fr=h.object({protected:h.string().max(2048),iv:h.string().max(64),ciphertext:h.string().max(2e6),tag:h.string().max(64),aad:h.string().max(2048).optional(),recipients:h.array(h.object({encrypted_key:h.string().max(2048),header:h.object({kid:E,epk:fn.optional(),alg:h.string().optional()}).passthrough()})).min(1).max(100)}).strict(),QVe=h.object({id:E,name:me,publicKey:fn}),Yu=h.object({id:E,name:me,owner:h.object({id:E,name:me}).nullable(),createdAt:Ve,permissions:h.array(lK),createKinds:h.array(dK),publicKey:fn.nullable()}),pK=h.object({id:E,kind:h.enum(["passkey","email","key"]),name:h.string(),createdAt:Ve,lastUsedAt:Ve.nullable(),expiresAt:Ve.nullable(),canOpen:h.boolean()}),aN=h.string().regex(/^[a-z][a-z_]*[a-z]$/).max(64),whe=h.object({subjectId:E,relation:aN,objectId:E}).strict(),fK=h.enum(["principal",...dK.options]),mK=whe.extend({objectType:fK,subjectName:me,objectName:me,createdAt:Ve}),eHe=h.object({error:h.object({code:h.string(),message:h.string(),details:Zn.optional()})}),tHe=h.object({ok:h.literal(!0)}),bhe=h.object({value:h.string().min(1).max(200),label:h.string().min(1).max(200),values:h.record(h.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),h.string()).default({})}).strict(),Kx=h.object({name:h.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),label:h.string(),secret:h.boolean().optional(),inputType:h.enum(["text","password","file"]).optional(),required:h.boolean().optional(),placeholder:h.string().optional(),note:h.string().optional(),pattern:h.string().optional(),choices:h.array(bhe).min(1).max(100).optional(),defaultValue:h.string().max(1e3).optional(),when:h.object({field:h.string(),values:h.array(h.string()).min(1)}).strict().optional(),visibility:h.enum(["application","connection"]).optional()}).superRefine((t,e)=>{let r=t.choices??[];new Set(r.map(o=>o.value)).size!==r.length&&e.addIssue({code:"custom",path:["choices"],message:"Use a unique value for each choice."})}),cN=h.record(h.string().regex(/^[A-Z_][A-Z0-9_]*$/),h.string()),_he=h.record(h.string().regex(/^[A-Z_][A-Z0-9_]*$/),h.union([h.string(),h.array(h.union([h.string().max(8192),h.object({pointer:h.string().max(1e3)}).strict()])).min(1).max(32)])),uN=h.object({values:h.array(h.object({id:h.string(),name:h.string(),description:h.string().optional()})).optional(),default:h.array(h.string()).default([]),required:h.array(h.string()).optional(),separator:h.string().default(" "),docs:h.url().optional()}),Xu=h.string().min(1).max(4096),Bx=h.union([h.string(),h.array(h.string()).min(1)]),Pn="urn:ietf:params:oauth:grant-type:device_code",She=h.object({browserTokenExchange:h.enum(["available","unavailable","unknown"]).optional(),application:h.enum(["required","implicit"]).default("required"),grantType:h.enum(["authorization_code","client_credentials",Pn]).optional(),issuer:h.url().optional(),registrationUrl:h.url().optional(),authorizeUrl:Xu.optional(),deviceAuthorizationUrl:Xu.optional(),tokenUrl:Xu,identity:h.object({url:Xu.optional(),from:h.enum(["token","app"]).optional(),method:h.enum(["GET","POST"]).default("GET"),id:Bx.default("/id"),name:Bx.default("/name"),headers:h.record(h.string(),h.string()).default({})}).optional(),clientAuth:h.enum(["body","basic","none"]).default("body"),pkce:h.boolean().default(!0),tokenFormat:h.enum(["form","json"]).default("form"),okPointer:h.string().optional(),authorizeParams:h.record(h.string(),h.string()).default({}),tokenParams:h.record(h.string(),h.string()).default({}),defaults:h.record(h.string(),h.string()).default({}),scopes:uN.default({default:[],separator:" "}),fields:h.array(Kx).default([]),outputs:cN.default({ACCESS_TOKEN:"/accessToken"}),adapter:h.string().regex(/^[a-z][a-z0-9_-]{0,99}$/).optional(),keep:h.array(h.string()).default([]),hint:h.string().optional()}).refine(t=>t.grantType==="client_credentials"||t.grantType===Pn||!!t.authorizeUrl,{path:["authorizeUrl"],message:"An authorization code flow requires an authorization URL."}).refine(t=>t.grantType!==Pn||!!t.deviceAuthorizationUrl,{path:["deviceAuthorizationUrl"],message:"A device flow requires a device authorization URL."}),xhe=h.object({fields:h.array(Kx).min(1),outputs:_he,resolver:h.literal("vultr-role").optional(),bindFields:h.boolean().optional(),constants:h.record(h.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),h.string()).optional(),files:h.array(h.string().regex(/^[A-Z_][A-Z0-9_]*$/)).max(32).optional(),account:h.object({field:h.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),pointer:h.string().max(1e3)}).strict().optional(),identity:h.object({url:Xu,headers:h.record(h.string(),h.string()),id:Bx,name:Bx}).strict().optional(),console:h.url().optional(),instructions:h.string().optional(),hint:h.string().optional()}).superRefine((t,e)=>{t.files?.some(r=>!Object.hasOwn(t.outputs,r))&&e.addIssue({code:"custom",path:["files"],message:"Deliver only declared outputs as files."}),t.account&&!t.fields.some(r=>r.name===t.account.field)&&e.addIssue({code:"custom",path:["account"],message:"Read the account from a declared field."})}),lN=h.enum(["oauth","token","aws","ovh","approval"]),Ehe=h.object({hint:h.string().optional()}).strict(),khe=h.object({authorization:h.enum(["api_key","consumer_key"]),apiBaseUrl:Xu,fields:h.array(Kx).min(1),scopes:uN.default({default:[],separator:`
129
+ `}),outputs:cN,hint:h.string().optional()}).strict(),wg={name:me,docs:h.url().optional(),console:Xu.optional(),preparation:h.object({scopeSelection:h.enum(["optional","required","hidden"]).default("optional"),instructions:h.array(h.union([h.string().max(2e3),h.object({ja:h.string().max(2e3),en:h.string().max(2e3)}).strict()])).max(10).default([]),docs:h.boolean().default(!1)}).strict().optional()},qx=h.object({...wg,kind:h.literal("oauth"),config:She}).strict(),Zx=h.object({...wg,kind:h.literal("token"),config:xhe}).strict(),Wx=h.object({...wg,kind:h.literal("aws"),config:Ehe}).strict(),Jx=h.object({...wg,kind:h.literal("ovh"),config:khe}).strict(),Gx=h.object({...wg,kind:h.literal("approval"),config:h.object({adapter:h.literal("runpod-flash"),fields:h.array(Kx).default([]),scopes:uN.default({default:[],separator:" "}),outputs:cN,hint:h.string().optional()}).strict()}).strict(),dp=h.discriminatedUnion("kind",[qx,Zx,Wx,Jx,Gx]),gg={id:h.string().min(1),builtin:h.boolean(),availability:h.enum(["ready","app-required","unavailable"]),defaultName:me,registration:h.object({kind:h.enum(["input","authorization"]),device:h.enum(["browser","cli"]),browserExchange:h.enum(["available","unavailable","unknown"]),tokenAlternatives:h.array(h.string())}).strict()},ii=h.discriminatedUnion("kind",[qx.extend(gg),Zx.extend(gg),Wx.extend(gg),Jx.extend(gg),Gx.extend(gg)]),yg=h.string().regex(/^[a-z][a-z0-9_-]{0,79}$/),dN=h.object({name:me,logo:h.string().regex(/^[a-z0-9-]+$/).optional(),api:h.url().optional(),docs:h.url().optional(),console:h.url().optional(),targets:h.array(h.object({id:yg,name:me,api:h.url().optional(),methods:h.array(yg).min(1)}).strict()).max(32).optional()}).strict(),Ihe=dN.extend({methods:h.record(yg,h.string().min(1))}).strict(),hK=dN.extend({methods:h.record(yg,h.union([h.string().min(1),dp]))}).strict(),gK=dN.extend({id:h.string(),builtin:h.boolean(),methods:h.record(yg,ii)}),$he=h.object({id:E,output:h.string().min(1).max(100).optional()}).strict(),yK=t=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)&&!/^(FOUNDATION_|LD_|DYLD_)|^(NODE_OPTIONS|BASH_ENV|ENV|PYTHONSTARTUP|GIT_CONFIG_COUNT|GIT_CONFIG_SYSTEM)$/u.test(t),vK=h.object({name:h.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/),source:$he,format:h.enum(["text","file","json"]).optional(),pointer:h.string().optional()}).strict(),ca={id:E,ownerId:E,name:me,createdAt:Ve,updatedAt:Ve,version:h.number().int().positive(),permissions:h.array(lK)},pN={recipients:h.array(E).default([]),custodyRevision:h.number().int().positive().nullable().default(null)},Ahe=h.object({...ca,kind:h.literal("variable"),data:h.object({...pN,bytes:h.number().int().nonnegative()})}),The=h.object({...ca,kind:h.literal("connection"),data:h.object({...pN,methodId:h.string(),fields:h.record(h.string(),h.string()).default({}),settings:h.array(h.object({name:h.string(),label:h.string(),value:h.string()})).default([]),methodName:h.string(),methodKind:lN,services:h.array(h.object({id:h.string(),name:me})).default([]),account:h.string(),accountId:h.string().nullable().default(null),accountVerified:h.boolean().default(!1),scopes:h.array(h.string()),scopesStatus:h.enum(["unknown","requested","reported"]).default("unknown"),outputs:h.array(h.string()),state:h.enum(["ready","reconnect","review","disconnecting","uncertain"]),appId:E.nullable(),generation:E.optional(),authorizationDigest:h.string().optional(),aws:Vx.optional(),ovh:hg.optional()})}),Phe=h.object({...ca,kind:h.literal("service"),data:Ihe}),Rhe=h.object({...ca,kind:h.literal("method"),data:dp}),Che=h.object({...ca,kind:h.literal("app"),data:h.object({...pN,methodId:h.string(),clientId:h.string(),fields:h.record(h.string(),h.string()).default({}),generation:E.optional()})}),Ohe=h.object({...ca,kind:h.literal("object"),data:h.object({size:h.number().int().nonnegative(),contentType:h.string()})}),Nhe=h.object({...ca,kind:h.literal("keyring"),data:h.object({revision:h.number().int().positive(),signature:h.string()})}),Dhe=h.object({publicKey:ig,algorithm:h.string(),fingerprint:mx,purpose:h.string().max(500),privateKeyId:E.nullable(),revokedAt:Ve.nullable()}),zhe=h.object({...ca,kind:h.literal("ssh_key"),data:Dhe}),jhe=h.object({address:px,port:h.number().int().min(1).max(65535),hostKeys:h.array(ig).min(1).max(16),authorizedKeysFile:fx}),Mhe=h.object({...ca,kind:h.literal("ssh_host"),data:jhe}),mt=h.discriminatedUnion("kind",[Ahe,The,Phe,Rhe,Che,Ohe,Nhe,zhe,Mhe]),rHe=h.discriminatedUnion("kind",[h.object({kind:h.literal("service"),name:me,definition:hK}).strict(),h.object({kind:h.literal("method"),name:me,definition:dp}).strict()]),nHe=h.object({version:h.number().int().positive(),name:me.optional(),definition:h.union([hK,dp]).optional()}).strict(),vo=h.object({name:h.string().regex(/^[a-z][a-z0-9]*(?:\.[a-z][a-z0-9]*)+$/),input:xr}).strict(),fN=vo.extend({inputs:h.array(h.object({pointer:h.string(),label:h.string().min(1).max(100),secret:h.boolean().default(!1),multiline:h.boolean().default(!1),site:h.url().optional()}).strict()).max(16).default([])}),Xx=h.object({ja:h.string(),en:h.string()}).strict(),Hx=h.object({id:E,name:me}),wK=h.discriminatedUnion("kind",[h.object({kind:h.literal("line"),subject:Hx,relation:aN,object:Hx}),h.object({kind:h.literal("transfer"),item:Hx,to:Hx})]),oHe=h.object({id:E,name:me,publicKey:fn,state:h.enum(["pending","approving","approved"]),principalId:E.nullable(),createdAt:Ve,expiresAt:Ve}),iHe=h.object({available:h.boolean(),required:h.boolean(),active:h.boolean(),payer:Yu.pick({id:!0,name:!0}).nullable()}),sHe=h.object({storageBytes:h.number().nonnegative(),storageLimit:h.number().positive(),month:h.string()}),aHe=h.object({id:h.string(),actorId:E.nullable(),action:h.string(),targetId:E.nullable(),createdAt:Ve,details:xr}),cHe=h.object({returnUrl:h.url().optional(),refreshUrl:h.url().optional()}).strict(),Qt=t=>h.object({items:h.array(t),next:h.string().nullable().default(null)}),uHe=h.object({id:E}),Uhe=h.object({limit:h.coerce.number().int().min(1).max(200).default(100),after:h.string().optional()}),lHe=Uhe.extend({object:E.optional(),subject:E.optional(),relation:aN.optional(),objectType:fK.optional()}).refine(t=>!!t.object!=!!t.subject,"Choose the object or the subject of the lines.");var Lhe=new TextEncoder,Fhe=new TextDecoder,bg="ECDH-ES+A256KW",mN="A256GCM",Et=t=>Lhe.encode(t),qt=t=>Fhe.decode(t);function Qu(t){let e="";for(let r=0;r<t.length;r+=8192)e+=String.fromCharCode(...t.subarray(r,r+8192));return btoa(e).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function Yx(t){return Uint8Array.from(atob(t.replaceAll("-","+").replaceAll("_","/")),e=>e.charCodeAt(0))}async function Qx(){let t=await mg(bg,{crv:"P-256",extractable:!0});return{publicKey:fn.parse(await oc(t.publicKey)),privateKey:await oc(t.privateKey)}}async function el(t,e,r){if(!e.length||new Set(e.map(n=>n.id)).size!==e.length)throw new Error("Recipients must be distinct and nonempty.");let o=new lg(t).setProtectedHeader({enc:mN}).setAdditionalAuthenticatedData(Et(r));for(let n of e)o.addRecipient(await yo(n.publicKey,bg)).setUnprotectedHeader({alg:bg,kid:n.id});return Fr.parse(await o.encrypt())}async function wo(t,e,r,o){if(t.aad!==Qu(Et(o)))throw new Error("The encrypted content belongs to a different item.");let n=t.recipients.find(a=>a.header.kid===r);if(!n)throw new Error("This principal cannot decrypt the content.");let i=e instanceof CryptoKey?e:await yo(e,bg);return(await WO({...t,recipients:[n]},i,{keyManagementAlgorithms:[bg],contentEncryptionAlgorithms:[mN]})).plaintext}async function Vhe(t){let e=await crypto.subtle.importKey("raw",new Uint8Array(t),"HKDF",!1,["deriveBits"]);return new Uint8Array(await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:Et("Foundation"),info:Et("passkey encryption key")},e,256))}async function bK(t,e,r){let o=await ug(t,await Vhe(e),{keyManagementAlgorithms:["dir"],contentEncryptionAlgorithms:[mN]});if(o.protectedHeader.sub!==r)throw new Error("The key belongs to a different principal.");return JSON.parse(qt(o.plaintext))}var Vr=h.string().regex(/^[A-Za-z0-9_-]{43}$/),tr=h.string().min(100).max(4e6),_K=fn.extend({d:h.string().regex(/^[A-Za-z0-9_-]{43}$/)}),tl=h.object({encryption:_K,signing:_K}).strict(),si=h.object({id:E,principalId:E,generation:h.number().int().positive(),previous:Vr.nullable(),encryption:fn,signing:fn}).strict();function M(t){if(t===null||typeof t=="boolean"||typeof t=="number"&&Number.isFinite(t)||typeof t=="string"&&!/[\uD800-\uDFFF]/u.test(t))return JSON.stringify(t);if(Array.isArray(t))return"["+Array.from(t,M).join(",")+"]";if(t&&typeof t=="object"&&Object.getPrototypeOf(t)===Object.prototype)return"{"+Object.keys(t).sort().map(e=>{if(/[\uD800-\uDFFF]/u.test(e))throw new Error("Use Unicode property names.");return JSON.stringify(e)+":"+M(t[e])}).join(",")+"}";throw new Error("Use finite numbers, Unicode strings, arrays, and plain JSON objects.")}async function bo(t){return iN(fn.parse({kty:t.kty,crv:t.crv,x:t.x,y:t.y}),"sha256")}async function vt(t){return Qu(new Uint8Array(await crypto.subtle.digest("SHA-256",Et(M(t)))))}async function ic(t){let e=new Uint8Array(await crypto.subtle.digest("SHA-256",Et(M(t))));return"sha256:"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}async function e0(){let[t,e]=await Promise.all([Qx(),mg("ES256",{crv:"P-256",extractable:!0})]),r=await oc(e.privateKey);return tl.parse({encryption:t.privateKey,signing:r})}function pp(t){return fn.parse({kty:t.kty,crv:t.crv,x:t.x,y:t.y})}function t0(t,e){return si.parse({id:crypto.randomUUID(),principalId:t,generation:1,previous:null,encryption:pp(e.encryption),signing:pp(e.signing)})}async function rr(t,e,r){let o=e instanceof CryptoKey?e:await yo(e,"ES256");return new pg(Et(M(t))).setProtectedHeader({alg:"ES256",typ:"foundation."+r+"+jws"}).sign(o)}async function Yi(t,e,r,o){if(M(await hN(e,r,o))!==M(t))throw new Error("The signature does not authorize this content.")}async function hN(t,e,r){let o=await rN(t,await yo(fn.parse(e),"ES256"),{algorithms:["ES256"]});if(o.protectedHeader.typ!=="foundation."+r+"+jws"||Object.keys(o.protectedHeader).some(s=>!["alg","typ"].includes(s)))throw new Error("The signature does not authorize this content.");let n=new TextDecoder("utf-8",{fatal:!0}).decode(o.payload),i=JSON.parse(n);if(M(i)!==n)throw new Error("Sign canonical JSON content.");return i}var er=h.object({binding:si,signature:tr}).strict(),r0=h.object({previous:er,replacement:er,previousSignature:tr}).strict();async function _g(t,e,r){let o=t;for(let n of[...r].sort((i,s)=>i.replacement.binding.generation-s.replacement.binding.generation)){if(M(n.previous.binding)!==M(o))continue;let i=n.replacement.binding;if(i.principalId!==o.principalId||i.id===o.id||i.generation!==o.generation+1||i.previous!==await vt(o))return!1;if(await fp(n.previous),await fp(n.replacement),await Yi(i,n.previousSignature,o.signing,"key-replacement"),o=i,M(o)===M(e))return!0}return!1}async function mp(t,e){if(await hp(t),await bo(e.encryption)!==await bo(t.encryption)||await bo(e.signing)!==await bo(t.signing))throw new Error("The private keys do not match this identity.");return{binding:t,signature:await rr(t,e.signing,"key-binding")}}async function hp(t){let e=si.parse(t);if(e.generation===1!=(e.previous===null))throw new Error("Link each replacement key to its preceding binding.");if(await bo(e.encryption)===await bo(e.signing))throw new Error("Use separate encryption and signing keys.");await yo(e.encryption,"ECDH-ES+A256KW"),await yo(e.signing,"ES256")}async function fp(t){let{binding:e,signature:r}=er.parse(t);return await hp(e),await Yi(e,r,e.signing,"key-binding"),e}var Hhe=h.object({requestedAt:Ve,readyAt:Ve}).strict(),Bhe=h.object({email:h.boolean(),storage:h.boolean(),payments:h.boolean()}),n0=h.object({principal:Yu.nullable(),credentialId:E.nullable(),wrappedKey:vg.nullable(),requestId:E.nullable(),keyReset:Hhe.nullable(),server:h.object({name:me}),features:Bhe,principals:h.array(Yu)}),xHe=h.object({email:h.email().max(254),returnTo:h.string().max(2048).optional(),locale:uK.default("ja"),principalId:E.optional()}).strict(),EHe=h.object({intent:h.enum(["register","authenticate"]),name:me.optional(),principalId:E.optional(),credentialId:E.optional(),returnTo:h.string().max(2048).optional()}).strict(),kHe=h.object({challengeId:E,credential:h.json(),binding:er.optional(),existingPublicKey:fn.optional(),wrappedKey:vg.optional()}).strict(),IHe=h.object({binding:er,wrappedKey:vg}).strict();import{createInterface as qhe}from"node:readline/promises";var xK=h.object({action:h.string().regex(/^[a-z][a-zA-Z]*(\.[a-z][a-zA-Z]*)+$/).max(64),principalId:E}).catchall(Zn),EK=h.enum(["signature","decryption","email","passkey"]),Khe=h.object({confirmationId:E,principalId:E,credentialId:E,bindingId:E.nullable(),operation:h.string(),nonce:h.string()}).strict(),SK=h.object({id:E,operation:xK,methods:h.array(EK),state:h.enum(["pending","confirmed","held"]),expiresAt:Ve,challenge:Khe,sealed:Fr.nullable()}).strict(),RHe=h.discriminatedUnion("method",[h.object({method:h.literal("signature"),signature:tr}).strict(),h.object({method:h.literal("decryption"),secret:h.string().min(1).max(200)}).strict(),h.object({method:h.literal("email"),code:h.string().min(1).max(32)}).strict(),h.object({method:h.literal("passkey"),credential:h.json()}).strict()]),kK=h.object({operation:xK,methods:h.array(EK)}),IK="foundation-confirmation",$K=["confirmation_required","confirmation_invalid"],AK=(t,e)=>rr(t.challenge,e,"operation-confirmation"),TK=t=>"operation-confirmation:"+t;async function PK(t,e,r){let o=await t.json("/api/confirmations",{method:"POST",body:{operation:e.operation}},SK);return await t.json("/api/confirmations/"+o.id+"/proof",{method:"POST",body:await r(o,t)},SK),o.id}var ai=class extends Error{constructor(r,o,n,i){super(n);this.code=r;this.status=o;this.details=i}code;status;details},Qi=class{constructor(e){this.identity=e}identity;async response(e,r={}){if(!e.startsWith("/api/")||e.includes("\\")||/[\u0000-\u001f]/.test(e))throw new Error("Use a path beginning with /api/.");let o=new URL(e,this.identity.origin);if(o.origin!==this.identity.origin)throw new Error("Use a path on the configured Foundation origin.");let n;try{n=await fetch(o,{method:r.method??"GET",headers:{authorization:"Bearer "+this.identity.token,...r.confirmation?{[IK]:r.confirmation}:{},...r.raw?{"content-type":"application/octet-stream"}:r.body!==void 0?{"content-type":"application/json"}:{}},body:r.raw?new Uint8Array(r.raw):r.body!==void 0?JSON.stringify(r.body):void 0,redirect:"error",signal:AbortSignal.any([AbortSignal.timeout(9e4),...r.signal?[r.signal]:[]])})}catch{throw new Error("Could not reach Foundation. Check the origin and your network connection.")}if(!n.ok){let i;try{i=h.object({error:h.object({code:h.string(),message:h.string(),details:h.unknown().optional()})}).parse(await n.json())}catch{throw new ai("http_error",n.status,"Foundation returned HTTP "+n.status+".")}let s=kK.safeParse(i.error.details);if(!r.confirmation&&$K.includes(i.error.code)&&s.success)return this.response(e,{...r,confirmation:await this.confirm(s.data)});throw new ai(i.error.code,n.status,i.error.message,i.error.details)}return n}confirm(e){return PK(this,e,async r=>{let{keys:o,binding:n}=this.identity;if(r.methods.includes("signature")&&o&&n?.id===r.challenge.bindingId)return{method:"signature",signature:await AK(r,o.signing)};if(r.methods.includes("decryption")&&o&&r.sealed)return{method:"decryption",secret:qt(await wo(r.sealed,o.encryption,r.id,TK(r.id)))};if(r.methods.includes("email")&&process.stdin.isTTY&&process.stderr.isTTY){let{email:i}=await this.json("/api/confirmations/"+r.id+"/email",{method:"POST",body:{}}),s=qhe({input:process.stdin,output:process.stderr});try{return{method:"email",code:await s.question("Enter the confirmation code sent to "+i+": ")}}finally{s.close()}}throw new ai("confirmation_required",403,"Prove confirmation "+r.id+" with "+r.methods.join(" or ")+" through /api/confirmations/"+r.id+", then send the same request again with it (foundation api --confirmation "+r.id+").",{...e,confirmationId:r.id})})}async json(e,r={},o){let n=await this.response(e,r),i=n.status===204?null:await n.json();return o?o.parse(i):i}async session(){return this.json("/api/session",{},n0)}};import{rm as bge,stat as _ge}from"node:fs/promises";import{dirname as Sge,join as EN}from"node:path";import{chmod as Zhe,lstat as Whe,mkdir as Jhe,open as gN,readFile as CK,rename as Ghe,rm as Xhe}from"node:fs/promises";import{dirname as Yhe,join as yN,resolve as Qhe}from"node:path";import{homedir as ege}from"node:os";import{randomUUID as tge}from"node:crypto";var vN=h.object({origin:h.url(),principalId:h.uuid(),token:h.string().min(20),keys:tl.nullable(),binding:si.nullable()}).strict().refine(t=>!!t.keys==!!t.binding&&(!t.binding||t.binding.principalId===t.principalId),"Use the keys bound to this identity."),OK=h.object({current:h.uuid(),identities:h.array(vN).min(1)}).strict().refine(t=>t.identities.some(e=>e.principalId===t.current),"The current identity is missing.");function ci(){return yN(process.env.XDG_CONFIG_HOME||yN(ege(),".config"),"foundation","identity.json")}function gp(t=process.env.FOUNDATION_ORIGIN||"https://foundationsystems.app"){let e;try{e=new URL(t)}catch{throw new Error("Set FOUNDATION_ORIGIN to an HTTPS origin.")}if(e.username||e.password||e.pathname!=="/"||e.search||e.hash||e.protocol!=="https:"&&!(e.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(e.hostname)))throw new Error("Use an HTTPS origin, or HTTP on localhost.");return e.origin}async function wN(){try{let t=ci(),e=await Whe(t);if(!e.isFile()||e.isSymbolicLink())throw new Error("The identity must be a regular file.");return process.platform!=="win32"&&e.mode&63&&await Zhe(t,384),OK.parse(JSON.parse(await CK(t,"utf8")))}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return;throw new Error("The saved identity could not be read. Check its contents and permissions.")}}async function NK(){let t=await wN();return(t?.identities??[]).map(e=>({...e,current:e.principalId===t.current}))}async function DK(t){let e=await wN();if(!e?.identities.some(r=>r.principalId===t))throw new Error("No saved identity has principal "+t+". Run foundation identity list.");await ua(ci(),JSON.stringify({...e,current:t},null,2)+`
130
130
  `,!0)}async function zK(t,e){let r=process.env.FOUNDATION_TOKEN,o=e||(r?void 0:process.env.FOUNDATION_PRINCIPAL_ID),n=await wN(),i;if(n){if(i=n.identities.find(a=>a.principalId===(o??n.current)),o&&!i&&!r)throw new Error("No saved identity has principal "+o+". Run foundation identity list.")}else if(o&&!r)throw new Error("Run foundation login to sign in on this machine.");let s=gp(t||process.env.FOUNDATION_ORIGIN||i?.origin);if(r){if(t&&process.env.FOUNDATION_ORIGIN&&s!==gp(process.env.FOUNDATION_ORIGIN))throw new Error("The environment identity belongs to a different origin.");let a=process.env.FOUNDATION_PRINCIPAL_ID,c=process.env.FOUNDATION_PRIVATE_KEYS,u=process.env.FOUNDATION_KEY_BINDING;if(!a)throw new Error("FOUNDATION_TOKEN requires FOUNDATION_PRINCIPAL_ID.");try{return vN.parse({origin:s,principalId:a,token:r,keys:c?JSON.parse(Buffer.from(c,"base64url").toString("utf8")):null,binding:u?JSON.parse(Buffer.from(u,"base64url").toString("utf8")):null})}catch{throw new Error("The Foundation environment identity is invalid.")}}if(!i)throw new Error("Run foundation login to sign in on this machine.");if(s!==gp(i.origin))throw new Error("This identity belongs to another origin. Use a separate XDG_CONFIG_HOME to initialize another server.");return{...i,origin:s}}async function yp(t){let e=ci(),r;try{r=OK.parse(JSON.parse(await CK(e,"utf8")))}catch(i){if(!(i instanceof Error&&"code"in i&&i.code==="ENOENT"))throw new Error("The saved identity could not be read. Check its contents and permissions.")}let o=vN.parse(t),n=(r?.identities??[]).filter(i=>!(i.origin===o.origin&&i.principalId===o.principalId));await ua(e,JSON.stringify({current:o.principalId,identities:[...n,o]},null,2)+`
131
- `,!!r)}async function RK(t){if(process.platform==="win32")return;let e=await gN(t,"r");try{await e.sync()}finally{await e.close()}}async function ua(t,e,r){let o=Qhe(t),n=Yhe(o);if(await Jhe(n,{recursive:!0,mode:448}),!r){let s=await gN(o,"wx",384);try{await s.writeFile(e),await s.sync()}finally{await s.close()}await RK(n);return}let i=yN(n,".foundation-"+tge());try{let s=await gN(i,"wx",384);try{await s.writeFile(e),await s.sync()}finally{await s.close()}await Ghe(i,o),await RK(n)}finally{await Xhe(i,{force:!0})}}import{lstat as rge,mkdir as jK,readFile as nge,readdir as MK,rm as oge}from"node:fs/promises";import{join as vp}from"node:path";var bN=h.string().regex(/^(refresh|checkpoint|identity)_[A-Za-z0-9_-]{1,100}$/),UK=t=>bN.safeParse(t).success,sc=class{constructor(e,r,o,n){this.directory=e;this.origin=r;this.binding=o;this.privateKeys=n}directory;origin;binding;privateKeys;indexing;context(e){return M({purpose:"executor-journal",origin:this.origin,bindingId:this.binding.id,id:bN.parse(e)})}async read(e){let r=this.context(e),o=vp(this.directory,e+".json");try{let n=await rge(o);if(!n.isFile()||n.isSymbolicLink()||process.platform!=="win32"&&n.mode&63)throw new Error("The execution journal must use private regular files.");let i=h.string().max(32e6).parse(JSON.parse(await nge(o,"utf8"))),s=await ug(i,await yo(this.privateKeys.encryption,"ECDH-ES+A256KW"),{keyManagementAlgorithms:["ECDH-ES+A256KW"],contentEncryptionAlgorithms:["A256GCM"]});if(s.protectedHeader.kid!==this.binding.id||s.protectedHeader.ctx!==r)throw new Error("The journal entry belongs to another operation.");let a=JSON.parse(qt(s.plaintext));if(a.context!==r)throw new Error("The journal entry belongs to another operation.");return await Yi({context:r,value:a.value},a.signature,this.binding.signing,"journal"),a.value}catch(n){if(n instanceof Error&&"code"in n&&n.code==="ENOENT")return null;throw n}}async writeEntry(e,r){let o=this.context(e),n={context:o,value:r},i=await rr(n,this.privateKeys.signing,"journal"),s=Et(M({...n,signature:i}));if(s.byteLength>2e7)throw new Error("The execution record is too large.");let a=await new up(s).setProtectedHeader({alg:"ECDH-ES+A256KW",enc:"A256GCM",kid:this.binding.id,ctx:o}).encrypt(await yo(this.binding.encryption,"ECDH-ES+A256KW"));await jK(this.directory,{recursive:!0,mode:448}),await ua(vp(this.directory,e+".json"),M(a),!0)}delivery(e){return e.startsWith("refresh_")}delivered(e){return!!e&&typeof e=="object"&&"delivered"in e&&e.delivered===!0}async markPending(e){await jK(vp(this.directory,"pending"),{recursive:!0,mode:448}),await ua(vp(this.directory,"pending",bN.parse(e)),"",!0)}index(){return this.indexing??=(async()=>{let e="checkpoint_pending_index";if(!await this.read(e)){for(let r of await this.keys("")){if(!this.delivery(r))continue;let o=await this.read(r);o&&!this.delivered(o)&&await this.markPending(r)}await this.writeEntry(e,{version:1})}})()}async write(e,r){await this.index();let o=this.delivered(r);this.delivery(e)&&!o&&await this.markPending(e),await this.writeEntry(e,r),this.delivery(e)&&o&&await oge(vp(this.directory,"pending",e),{force:!0})}async pending(e){await this.index();let r;try{r=await MK(vp(this.directory,"pending"),{withFileTypes:!0})}catch(o){if(o instanceof Error&&"code"in o&&o.code==="ENOENT")return[];throw o}return r.filter(o=>o.isFile()&&o.name.startsWith(e)&&UK(o.name)).map(o=>o.name)}async keys(e){let r;try{r=await MK(this.directory,{withFileTypes:!0})}catch(o){if(o instanceof Error&&"code"in o&&o.code==="ENOENT")return[];throw o}return r.filter(o=>o.isFile()&&o.name.startsWith(e)&&o.name.endsWith(".json")&&UK(o.name.slice(0,-5))).map(o=>o.name.slice(0,-5))}};var FK=h.url().refine(t=>{let e=new URL(t);return e.origin===t&&!e.username&&!e.password&&(e.protocol==="https:"||e.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(e.hostname))},"Use an HTTPS origin, or HTTP on localhost."),kt={value:"03546b17-fa44-409f-b151-8da1a398b324",tokenSet:"7d4b64dd-4546-4acb-8e96-91f864bccea6",clientCredential:"714fc044-2cce-4f3f-a477-281ee64fe632"},ige=h.enum([kt.value,kt.tokenSet,kt.clientCredential]),VK=1e6,HK=t=>t===kt.tokenSet,Wn=h.object({format:h.literal(3),origin:FK,id:E,ownerId:E,contentType:ige,revision:h.number().int().positive(),authorities:h.array(si).min(1).max(100),readers:h.array(si).min(1).max(100),observers:h.array(E).max(100).optional()}).strict(),LK=h.object({ownerId:E,authorities:h.array(si).min(1).max(100)}).strict(),BK=h.object({origin:FK,id:E,revision:h.number().int().positive(),from:LK,to:LK,policyDigest:Vr,previous:Vr.nullable(),signerId:E}).strict(),sge=BK.extend({signature:tr}),age=16,KK=h.array(sge).max(age),Hr=h.object({policy:Wn,authorityId:E,authorization:tr,lineage:KK.optional(),materialRevision:h.number().int().positive(),updatedAt:Ve,metadata:xr,sealed:Fr,signerId:E,signature:tr}).strict(),rl=t=>({ownerId:t.ownerId,authorities:t.authorities});async function cge(t,e=[]){let r;for(let o of e){let{signature:n,...i}=o;if(o.origin!==t.origin||o.id!==t.id||o.revision>t.revision||r&&(o.revision<=r.revision||M(r.to)!==M(o.from))||o.previous!==(r?await vt(r):null))throw new Error("Keep the signed chain of authority changes for this item.");let s=o.from.authorities.find(a=>a.id===o.signerId);if(!s)throw new Error("Only an existing authority can hand over this item.");await Yi(i,n,s.signing,"authority-handoff"),r=o}if(r&&M(r.to)!==M(rl(t)))throw new Error("Use the authorities approved by the latest handoff.")}function _N(t){let e=t.policy.authorities.find(n=>n.id===t.authorityId);if(e)return e;let r=t.lineage?.at(-1),o=r?.revision===t.policy.revision?r.from.authorities.find(n=>n.id===t.authorityId):void 0;if(!o||o.id!==r?.signerId)throw new Error("The policy must be signed by an approved authority.");return o}function qK(t,e){if(t.id!==e.policy.id||t.origin!==e.policy.origin||t.contentType!==e.policy.contentType)return!1;let r=M(rl(t));return r===M(rl(e.policy))?!0:!!e.lineage?.some(o=>o.revision>t.revision&&M(o.from)===r)}async function uge(t,e,r,o){let n=[...t?.lineage??[]];if(t&&M(rl(t.policy))!==M(rl(e))){if(!t.policy.authorities.some(s=>M(s)===M(r))||t.policy.id!==e.id||t.policy.origin!==e.origin||t.policy.contentType!==e.contentType||e.revision!==t.policy.revision+1)throw new Error("An existing authority must approve this handoff at the next policy revision.");let i=BK.parse({origin:e.origin,id:e.id,revision:e.revision,from:rl(t.policy),to:rl(e),policyDigest:await vt(e),previous:n.length?await vt(n.at(-1)):null,signerId:r.id});n.push({...i,signature:await rr(i,o.signing,"authority-handoff")})}return n.length?{lineage:KK.parse(n)}:{}}async function ZK(t){let e=Wn.parse(t),r=new Map;for(let o of[...e.authorities,...e.readers]){await hp(o);let n=M(o);if(r.has(o.id)&&r.get(o.id)!==n)throw new Error("Each key binding must identify the same keys throughout a policy.");r.set(o.id,n)}for(let o of[e.readers,e.authorities])if(new Set(o.map(n=>n.id)).size!==o.length)throw new Error("Choose distinct key bindings.");for(let o of e.authorities)if(!e.readers.some(n=>n.id===o.id))throw new Error("A policy authority must be able to open its content.");return e}async function o0(t,e){return M({purpose:"resource",policyDigest:await vt(t),materialRevision:e})}async function wp(t,e,r,o,n,i,s){if(t.byteLength>VK)throw new Error("The content exceeds its storage limit.");let a=await ZK(e),c=await uge(s,a,o,n);if(!a.authorities.some(f=>M(f)===M(o))&&c.lineage?.at(-1)?.revision!==a.revision)throw new Error("Only a policy authority can replace its content.");let u=await el(t,a.readers.map(f=>({id:f.id,publicKey:f.encryption})),await o0(a,r)),l={policy:a,...c,authorityId:o.id,authorization:await rr(a,n.signing,"access-policy"),materialRevision:r,updatedAt:new Date().toISOString(),metadata:i??(a.contentType===kt.value?{bytes:t.byteLength}:{}),sealed:u,signerId:o.id},d=Hr.parse({...l,signature:await rr(l,n.signing,"resource")});return await ac(d),d}async function ac(t){let e=Hr.parse(t),{signature:r,...o}=e;await ZK(e.policy),await cge(e.policy,e.lineage);let n=_N(e),i=e.lineage?.at(-1);if(i?.revision===e.policy.revision&&i.policyDigest!==await vt(e.policy))throw new Error("The handoff approves a different access policy.");await Yi(e.policy,e.authorization,n.signing,"access-policy");let s=(e.signerId===n.id?n:void 0)??e.policy.authorities.find(u=>u.id===e.signerId)??(HK(e.policy.contentType)?e.policy.readers.find(u=>u.id===e.signerId):void 0);if(!s||Date.parse(e.updatedAt)>Date.now()+3e4)throw new Error("The signer cannot replace this content.");await Yi(o,r,s.signing,"resource");let a=e.policy.readers.map(u=>u.id).sort(),c=e.sealed.recipients.map(u=>u.header.kid).sort();if(M(a)!==M(c)||e.sealed.aad!==Qu(Et(await o0(e.policy,e.materialRevision))))throw new Error("Encrypt content for exactly the readers its policy names.");return e}async function WK(t,e,r,o,n=t.metadata){let i=await ac(t);if(!HK(i.policy.contentType)||!i.policy.readers.some(f=>M(f)===M(r)))throw new Error("Only a reader of this connection can renew it.");if(e.byteLength>VK)throw new Error("The content exceeds its storage limit.");let s=i.materialRevision+1,a=await el(e,i.policy.readers.map(f=>({id:f.id,publicKey:f.encryption})),await o0(i.policy,s)),{signature:c,...u}=i,l={...u,materialRevision:s,updatedAt:new Date().toISOString(),metadata:n,sealed:a,signerId:r.id},d={...l,signature:await rr(l,o.signing,"resource")};return await ac(d),d}async function Jn(t,e,r){let o=await ac(t);if(!o.policy.readers.some(n=>M(n)===M(e)))throw new Error("This identity cannot reveal the content.");return wo(o.sealed,r,e.id,await o0(o.policy,o.materialRevision))}var lge=h.object({binding:si,verifiedAt:Ve}).strict(),SN=h.object({origin:h.url(),ownerId:E,signerId:E,revision:h.number().int().positive(),keys:h.array(lge).max(1e3)}).strict(),dge=h.object({version:h.number().int().positive(),signature:tr}).strict(),xN=h.object({keyring:dge.nullable()}).strict(),lBe=h.object({version:h.number().int().positive().nullable(),signature:tr}).strict();function i0(t,e){return rr(SN.parse(t),e,"keyring")}function JK(t){return SN.parse(JSON.parse(qt(Yx(t.split(".")[1]??""))))}async function s0(t,e){let r=SN.parse(await hN(t,e.signing,"keyring"));if(r.signerId!==e.id)throw new Error("Another identity signed this keyring.");return r}var GK=h.enum(["content","keyring"]),wBe=h.object({id:E,replacement:er,previousSignature:tr,handoff:Fr}).strict(),XK=h.object({replacement:r0,handoff:Fr}).strict(),YK=h.discriminatedUnion("kind",[h.object({kind:h.literal("content"),content:Hr}).strict(),h.object({kind:h.literal("keyring"),signature:tr}).strict()]),bBe=h.object({sourceDigest:Vr,payload:YK,signature:tr}).strict(),_Be=h.object({sourceDigest:Vr,payload:YK}).strict(),QK=h.record(h.string(),h.unknown()),pge=h.object({kind:GK,id:E,name:me.nullable(),sourceDigest:Vr,state:h.enum(["pending","prepared","stale"]),signers:h.array(E).nullable(),source:QK.nullable()}),eq=h.object({rotation:h.object({id:E,principalId:E,previous:er,replacement:er,previousSignature:tr}).strict(),kind:GK,id:E,name:me,sourceDigest:Vr,source:QK}).strict(),fge=h.object({kind:h.string(),id:E,reason:h.string()}),a0=h.object({id:E,principalId:E,state:h.enum(["preparing","committed","cancelled"]),previous:er,replacement:er,previousSignature:tr,handoff:Fr,createdAt:Ve,finishedAt:Ve.nullable(),total:h.number().int().nonnegative(),prepared:h.number().int().nonnegative(),blockers:h.array(fge),items:h.array(pge),next:h.string().nullable()});function mge(t,e,r){let o=n=>{if(n.id!==e.id)return n;if(M(n)!==M(e))throw new Error("Use the exact previous key binding.");return r};return Wn.parse({...t,revision:t.revision+1,readers:t.readers.map(o),authorities:t.authorities.map(o)})}async function tq(t,e,r,o,n,i){let s=await Jn(t,o,n.encryption),a=await wp(s,mge(t.policy,e,r),t.materialRevision+1,o,n,t.metadata,t);if(o.id!==e.id)return a;if(!i)throw new Error("Keep the replacement keys before preparing rotated content.");let{signature:c,...u}=a,l={...u,authorityId:r.id,signerId:r.id,authorization:await rr(a.policy,i.signing,"access-policy")};return ac({...l,signature:await rr(l,i.signing,"resource")})}async function hge(t,e,r,o,n,i){return{rotationId:t,principalId:e,replacementId:r,itemId:o,sourceDigest:n,payloadDigest:await vt(i)}}async function gge(t,e,r,o,n,i,s){return{sourceDigest:n,payload:i,signature:await rr(await hge(t,e,r,o,n,i),s,"key-rotation-preparation")}}var rq=t=>"key-handoff:"+t.principalId+":"+t.id;function yge(t,e,r){return el(Et(JSON.stringify(r)),[{id:t.id,publicKey:t.encryption}],rq(e))}async function nq(t,e,r){let{replacement:o,handoff:n}=XK.parse(t);if(M(o.previous.binding)!==M(e))throw new Error("This key handoff follows other keys.");let i=o.replacement.binding;if(!await _g(e,i,[o]))throw new Error("The previous keys did not authorize these replacement keys.");let s=tl.parse(JSON.parse(qt(await wo(n,r,e.id,rq(i)))));return await mp(i,s),{binding:i,keys:s}}async function oq(t,e){let r=E.parse("binding"in e?e.binding.principalId:e.principalId),o="/api/principals/"+r+"/key-handoffs",n="binding"in e?e.binding:null,i=e.keys,s=null;for(let a=0;a<=32;a++){let{binding:c}=await t.json("/api/identities/"+r+"/binding",{},er);if(n?M(c)===M(n):await bo(c.encryption)===await bo(pp(e.keys.encryption)))return s?{binding:c,keys:s}:null;if(n&&c.generation<=n.generation||a===32)throw new Sg("The keys of this identity were made again. Sign in with a passkey that holds them.");let u=await t.json(n?o+"/"+E.parse(n.id):o+"?"+new URLSearchParams({encryption:await bo(pp(e.keys.encryption))}),{},XK),l=n??u.replacement.previous.binding;if(!n&&await bo(l.encryption)!==await bo(pp(e.keys.encryption)))throw new Error("This key handoff follows other keys.");let d=await nq(u,l,i.encryption);({binding:n}=d),i=s=d.keys}return null}var Sg=class extends Error{code="keys_replaced";constructor(e){super(e)}},vge=h.object({rotation:a0.nullable()});async function iq(t,e){let{binding:r,keys:o}=e,n=E.parse(r.principalId),i="/api/principals/"+n+"/key-rotations",{rotation:s}=await t.json(i,{},vge),a;if(s)a=await nq({replacement:{previous:s.previous,replacement:s.replacement,previousSignature:s.previousSignature},handoff:s.handoff},r,o.encryption);else{let u=await e0(),l={...t0(n,u),generation:r.generation+1,previous:await vt(r)};a={binding:l,keys:u},s=await t.json(i,{method:"POST",body:{id:crypto.randomUUID(),replacement:await mp(l,u),previousSignature:await rr(l,o.signing,"key-replacement"),handoff:await yge(r,l,u)}},a0)}let c=i+"/"+E.parse(s.id);for(let u=0;u<5;u++){let l=[],d=null,f=[];do{let p=await t.json(c+"?"+new URLSearchParams({limit:"100",...d?{after:d}:{}}),{},a0);f=p.blockers.filter(m=>m.reason==="authority_history_full");for(let m of p.items){if(m.state==="prepared"||f.some(y=>y.id===m.id))continue;if(m.signers){l.push(m);continue}let g=await wge(m,r,a,o);await t.json(c+"/items/"+m.kind+"/"+m.id,{method:"PUT",body:await gge(s.id,n,a.binding.id,m.id,m.sourceDigest,g,o.signing)})}d=p.next}while(d);if(f.length)return{state:"blocked",rotationId:s.id,blockers:f};if(l.length)return{state:"waiting",rotationId:s.id,waiting:l.map(p=>({kind:p.kind,id:p.id,name:p.name,signers:p.signers}))};try{return await t.json(c+"/commit",{method:"POST"},a0),{state:"committed",...a}}catch(p){if(!(p&&typeof p=="object"&&"code"in p&&["rotation_not_ready","rotation_busy","changed"].includes(String(p.code))))throw p}}throw new Error("The items kept changing during the key rotation. Try again later.")}async function wge(t,e,r,o){let n=t.source;if(!n)throw new Error("This identity cannot read an item it must prepare.");switch(t.kind){case"content":return{kind:t.kind,content:await tq(Hr.parse(n.content),e,r.binding,e,o,r.keys)};case"keyring":{let i=await s0(String(n.signature),e);return{kind:"keyring",signature:await i0({...i,signerId:r.binding.id,revision:i.revision+1,keys:i.keys.map(s=>s.binding.id===e.id?{...s,binding:r.binding}:s)},r.keys.signing)}}}}async function sq(t,e,r){let o=t.rotation.previous.binding,n=t.rotation.replacement.binding,i=t.source;if(t.kind==="content")return{kind:t.kind,content:await tq(Hr.parse(i.content),o,n,e,r)};throw new Error("Only the rotating identity prepares this item.")}var aq=t=>EN(Sge(ci()),"custody",t.id),xge=t=>_ge(t).then(()=>!0,()=>!1);async function cq(t,e,r){let o=aq(e.binding),n=aq(r.binding);if(!await xge(o))return;let i=async s=>{let a=new sc(EN(o,s),t,e.binding,e.keys),c=new sc(EN(n,s),t,r.binding,r.keys);for(let u of await a.keys("")){let l=await a.read(u);l!==null&&await c.write(u,l)}};for(let s of["client","connections"])await i(s);await bge(o,{recursive:!0,force:!0})}async function uq(t){if(!t.keys||!t.binding)return t;let e;try{e=await oq(new Qi(t),{binding:t.binding,keys:t.keys})}catch(o){if(!(o instanceof Sg))throw o;return process.stderr.write("foundation: "+o.message+`
131
+ `,!!r)}async function RK(t){if(process.platform==="win32")return;let e=await gN(t,"r");try{await e.sync()}finally{await e.close()}}async function ua(t,e,r){let o=Qhe(t),n=Yhe(o);if(await Jhe(n,{recursive:!0,mode:448}),!r){let s=await gN(o,"wx",384);try{await s.writeFile(e),await s.sync()}finally{await s.close()}await RK(n);return}let i=yN(n,".foundation-"+tge());try{let s=await gN(i,"wx",384);try{await s.writeFile(e),await s.sync()}finally{await s.close()}await Ghe(i,o),await RK(n)}finally{await Xhe(i,{force:!0})}}import{lstat as rge,mkdir as jK,readFile as nge,readdir as MK,rm as oge}from"node:fs/promises";import{join as vp}from"node:path";var bN=h.string().regex(/^(refresh|checkpoint|identity)_[A-Za-z0-9_-]{1,100}$/),UK=t=>bN.safeParse(t).success,sc=class{constructor(e,r,o,n){this.directory=e;this.origin=r;this.binding=o;this.privateKeys=n}directory;origin;binding;privateKeys;indexing;context(e){return M({purpose:"executor-journal",origin:this.origin,bindingId:this.binding.id,id:bN.parse(e)})}async read(e){let r=this.context(e),o=vp(this.directory,e+".json");try{let n=await rge(o);if(!n.isFile()||n.isSymbolicLink()||process.platform!=="win32"&&n.mode&63)throw new Error("The journal must use private regular files.");let i=h.string().max(32e6).parse(JSON.parse(await nge(o,"utf8"))),s=await ug(i,await yo(this.privateKeys.encryption,"ECDH-ES+A256KW"),{keyManagementAlgorithms:["ECDH-ES+A256KW"],contentEncryptionAlgorithms:["A256GCM"]});if(s.protectedHeader.kid!==this.binding.id||s.protectedHeader.ctx!==r)throw new Error("The journal entry belongs to another operation.");let a=JSON.parse(qt(s.plaintext));if(a.context!==r)throw new Error("The journal entry belongs to another operation.");return await Yi({context:r,value:a.value},a.signature,this.binding.signing,"journal"),a.value}catch(n){if(n instanceof Error&&"code"in n&&n.code==="ENOENT")return null;throw n}}async writeEntry(e,r){let o=this.context(e),n={context:o,value:r},i=await rr(n,this.privateKeys.signing,"journal"),s=Et(M({...n,signature:i}));if(s.byteLength>2e7)throw new Error("The journal entry is too large.");let a=await new up(s).setProtectedHeader({alg:"ECDH-ES+A256KW",enc:"A256GCM",kid:this.binding.id,ctx:o}).encrypt(await yo(this.binding.encryption,"ECDH-ES+A256KW"));await jK(this.directory,{recursive:!0,mode:448}),await ua(vp(this.directory,e+".json"),M(a),!0)}delivery(e){return e.startsWith("refresh_")}delivered(e){return!!e&&typeof e=="object"&&"delivered"in e&&e.delivered===!0}async markPending(e){await jK(vp(this.directory,"pending"),{recursive:!0,mode:448}),await ua(vp(this.directory,"pending",bN.parse(e)),"",!0)}index(){return this.indexing??=(async()=>{let e="checkpoint_pending_index";if(!await this.read(e)){for(let r of await this.keys("")){if(!this.delivery(r))continue;let o=await this.read(r);o&&!this.delivered(o)&&await this.markPending(r)}await this.writeEntry(e,{version:1})}})()}async write(e,r){await this.index();let o=this.delivered(r);this.delivery(e)&&!o&&await this.markPending(e),await this.writeEntry(e,r),this.delivery(e)&&o&&await oge(vp(this.directory,"pending",e),{force:!0})}async pending(e){await this.index();let r;try{r=await MK(vp(this.directory,"pending"),{withFileTypes:!0})}catch(o){if(o instanceof Error&&"code"in o&&o.code==="ENOENT")return[];throw o}return r.filter(o=>o.isFile()&&o.name.startsWith(e)&&UK(o.name)).map(o=>o.name)}async keys(e){let r;try{r=await MK(this.directory,{withFileTypes:!0})}catch(o){if(o instanceof Error&&"code"in o&&o.code==="ENOENT")return[];throw o}return r.filter(o=>o.isFile()&&o.name.startsWith(e)&&o.name.endsWith(".json")&&UK(o.name.slice(0,-5))).map(o=>o.name.slice(0,-5))}};var FK=h.url().refine(t=>{let e=new URL(t);return e.origin===t&&!e.username&&!e.password&&(e.protocol==="https:"||e.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(e.hostname))},"Use an HTTPS origin, or HTTP on localhost."),kt={value:"03546b17-fa44-409f-b151-8da1a398b324",tokenSet:"7d4b64dd-4546-4acb-8e96-91f864bccea6",clientCredential:"714fc044-2cce-4f3f-a477-281ee64fe632"},ige=h.enum([kt.value,kt.tokenSet,kt.clientCredential]),VK=1e6,HK=t=>t===kt.tokenSet,Wn=h.object({format:h.literal(3),origin:FK,id:E,ownerId:E,contentType:ige,revision:h.number().int().positive(),authorities:h.array(si).min(1).max(100),readers:h.array(si).min(1).max(100),observers:h.array(E).max(100).optional()}).strict(),LK=h.object({ownerId:E,authorities:h.array(si).min(1).max(100)}).strict(),BK=h.object({origin:FK,id:E,revision:h.number().int().positive(),from:LK,to:LK,policyDigest:Vr,previous:Vr.nullable(),signerId:E}).strict(),sge=BK.extend({signature:tr}),age=16,KK=h.array(sge).max(age),Hr=h.object({policy:Wn,authorityId:E,authorization:tr,lineage:KK.optional(),materialRevision:h.number().int().positive(),updatedAt:Ve,metadata:xr,sealed:Fr,signerId:E,signature:tr}).strict(),rl=t=>({ownerId:t.ownerId,authorities:t.authorities});async function cge(t,e=[]){let r;for(let o of e){let{signature:n,...i}=o;if(o.origin!==t.origin||o.id!==t.id||o.revision>t.revision||r&&(o.revision<=r.revision||M(r.to)!==M(o.from))||o.previous!==(r?await vt(r):null))throw new Error("Keep the signed chain of authority changes for this item.");let s=o.from.authorities.find(a=>a.id===o.signerId);if(!s)throw new Error("Only an existing authority can hand over this item.");await Yi(i,n,s.signing,"authority-handoff"),r=o}if(r&&M(r.to)!==M(rl(t)))throw new Error("Use the authorities approved by the latest handoff.")}function _N(t){let e=t.policy.authorities.find(n=>n.id===t.authorityId);if(e)return e;let r=t.lineage?.at(-1),o=r?.revision===t.policy.revision?r.from.authorities.find(n=>n.id===t.authorityId):void 0;if(!o||o.id!==r?.signerId)throw new Error("The policy must be signed by an approved authority.");return o}function qK(t,e){if(t.id!==e.policy.id||t.origin!==e.policy.origin||t.contentType!==e.policy.contentType)return!1;let r=M(rl(t));return r===M(rl(e.policy))?!0:!!e.lineage?.some(o=>o.revision>t.revision&&M(o.from)===r)}async function uge(t,e,r,o){let n=[...t?.lineage??[]];if(t&&M(rl(t.policy))!==M(rl(e))){if(!t.policy.authorities.some(s=>M(s)===M(r))||t.policy.id!==e.id||t.policy.origin!==e.origin||t.policy.contentType!==e.contentType||e.revision!==t.policy.revision+1)throw new Error("An existing authority must approve this handoff at the next policy revision.");let i=BK.parse({origin:e.origin,id:e.id,revision:e.revision,from:rl(t.policy),to:rl(e),policyDigest:await vt(e),previous:n.length?await vt(n.at(-1)):null,signerId:r.id});n.push({...i,signature:await rr(i,o.signing,"authority-handoff")})}return n.length?{lineage:KK.parse(n)}:{}}async function ZK(t){let e=Wn.parse(t),r=new Map;for(let o of[...e.authorities,...e.readers]){await hp(o);let n=M(o);if(r.has(o.id)&&r.get(o.id)!==n)throw new Error("Each key binding must identify the same keys throughout a policy.");r.set(o.id,n)}for(let o of[e.readers,e.authorities])if(new Set(o.map(n=>n.id)).size!==o.length)throw new Error("Choose distinct key bindings.");for(let o of e.authorities)if(!e.readers.some(n=>n.id===o.id))throw new Error("A policy authority must be able to open its content.");return e}async function o0(t,e){return M({purpose:"resource",policyDigest:await vt(t),materialRevision:e})}async function wp(t,e,r,o,n,i,s){if(t.byteLength>VK)throw new Error("The content exceeds its storage limit.");let a=await ZK(e),c=await uge(s,a,o,n);if(!a.authorities.some(f=>M(f)===M(o))&&c.lineage?.at(-1)?.revision!==a.revision)throw new Error("Only a policy authority can replace its content.");let u=await el(t,a.readers.map(f=>({id:f.id,publicKey:f.encryption})),await o0(a,r)),l={policy:a,...c,authorityId:o.id,authorization:await rr(a,n.signing,"access-policy"),materialRevision:r,updatedAt:new Date().toISOString(),metadata:i??(a.contentType===kt.value?{bytes:t.byteLength}:{}),sealed:u,signerId:o.id},d=Hr.parse({...l,signature:await rr(l,n.signing,"resource")});return await ac(d),d}async function ac(t){let e=Hr.parse(t),{signature:r,...o}=e;await ZK(e.policy),await cge(e.policy,e.lineage);let n=_N(e),i=e.lineage?.at(-1);if(i?.revision===e.policy.revision&&i.policyDigest!==await vt(e.policy))throw new Error("The handoff approves a different access policy.");await Yi(e.policy,e.authorization,n.signing,"access-policy");let s=(e.signerId===n.id?n:void 0)??e.policy.authorities.find(u=>u.id===e.signerId)??(HK(e.policy.contentType)?e.policy.readers.find(u=>u.id===e.signerId):void 0);if(!s||Date.parse(e.updatedAt)>Date.now()+3e4)throw new Error("The signer cannot replace this content.");await Yi(o,r,s.signing,"resource");let a=e.policy.readers.map(u=>u.id).sort(),c=e.sealed.recipients.map(u=>u.header.kid).sort();if(M(a)!==M(c)||e.sealed.aad!==Qu(Et(await o0(e.policy,e.materialRevision))))throw new Error("Encrypt content for exactly the readers its policy names.");return e}async function WK(t,e,r,o,n=t.metadata){let i=await ac(t);if(!HK(i.policy.contentType)||!i.policy.readers.some(f=>M(f)===M(r)))throw new Error("Only a reader of this connection can renew it.");if(e.byteLength>VK)throw new Error("The content exceeds its storage limit.");let s=i.materialRevision+1,a=await el(e,i.policy.readers.map(f=>({id:f.id,publicKey:f.encryption})),await o0(i.policy,s)),{signature:c,...u}=i,l={...u,materialRevision:s,updatedAt:new Date().toISOString(),metadata:n,sealed:a,signerId:r.id},d={...l,signature:await rr(l,o.signing,"resource")};return await ac(d),d}async function Jn(t,e,r){let o=await ac(t);if(!o.policy.readers.some(n=>M(n)===M(e)))throw new Error("This identity cannot reveal the content.");return wo(o.sealed,r,e.id,await o0(o.policy,o.materialRevision))}var lge=h.object({binding:si,verifiedAt:Ve}).strict(),SN=h.object({origin:h.url(),ownerId:E,signerId:E,revision:h.number().int().positive(),keys:h.array(lge).max(1e3)}).strict(),dge=h.object({version:h.number().int().positive(),signature:tr}).strict(),xN=h.object({keyring:dge.nullable()}).strict(),uBe=h.object({version:h.number().int().positive().nullable(),signature:tr}).strict();function i0(t,e){return rr(SN.parse(t),e,"keyring")}function JK(t){return SN.parse(JSON.parse(qt(Yx(t.split(".")[1]??""))))}async function s0(t,e){let r=SN.parse(await hN(t,e.signing,"keyring"));if(r.signerId!==e.id)throw new Error("Another identity signed this keyring.");return r}var GK=h.enum(["content","keyring"]),vBe=h.object({id:E,replacement:er,previousSignature:tr,handoff:Fr}).strict(),XK=h.object({replacement:r0,handoff:Fr}).strict(),YK=h.discriminatedUnion("kind",[h.object({kind:h.literal("content"),content:Hr}).strict(),h.object({kind:h.literal("keyring"),signature:tr}).strict()]),wBe=h.object({sourceDigest:Vr,payload:YK,signature:tr}).strict(),bBe=h.object({sourceDigest:Vr,payload:YK}).strict(),QK=h.record(h.string(),h.unknown()),pge=h.object({kind:GK,id:E,name:me.nullable(),sourceDigest:Vr,state:h.enum(["pending","prepared","stale"]),signers:h.array(E).nullable(),source:QK.nullable()}),eq=h.object({rotation:h.object({id:E,principalId:E,previous:er,replacement:er,previousSignature:tr}).strict(),kind:GK,id:E,name:me,sourceDigest:Vr,source:QK}).strict(),fge=h.object({kind:h.string(),id:E,reason:h.string()}),a0=h.object({id:E,principalId:E,state:h.enum(["preparing","committed","cancelled"]),previous:er,replacement:er,previousSignature:tr,handoff:Fr,createdAt:Ve,finishedAt:Ve.nullable(),total:h.number().int().nonnegative(),prepared:h.number().int().nonnegative(),blockers:h.array(fge),items:h.array(pge),next:h.string().nullable()});function mge(t,e,r){let o=n=>{if(n.id!==e.id)return n;if(M(n)!==M(e))throw new Error("Use the exact previous key binding.");return r};return Wn.parse({...t,revision:t.revision+1,readers:t.readers.map(o),authorities:t.authorities.map(o)})}async function tq(t,e,r,o,n,i){let s=await Jn(t,o,n.encryption),a=await wp(s,mge(t.policy,e,r),t.materialRevision+1,o,n,t.metadata,t);if(o.id!==e.id)return a;if(!i)throw new Error("Keep the replacement keys before preparing rotated content.");let{signature:c,...u}=a,l={...u,authorityId:r.id,signerId:r.id,authorization:await rr(a.policy,i.signing,"access-policy")};return ac({...l,signature:await rr(l,i.signing,"resource")})}async function hge(t,e,r,o,n,i){return{rotationId:t,principalId:e,replacementId:r,itemId:o,sourceDigest:n,payloadDigest:await vt(i)}}async function gge(t,e,r,o,n,i,s){return{sourceDigest:n,payload:i,signature:await rr(await hge(t,e,r,o,n,i),s,"key-rotation-preparation")}}var rq=t=>"key-handoff:"+t.principalId+":"+t.id;function yge(t,e,r){return el(Et(JSON.stringify(r)),[{id:t.id,publicKey:t.encryption}],rq(e))}async function nq(t,e,r){let{replacement:o,handoff:n}=XK.parse(t);if(M(o.previous.binding)!==M(e))throw new Error("This key handoff follows other keys.");let i=o.replacement.binding;if(!await _g(e,i,[o]))throw new Error("The previous keys did not authorize these replacement keys.");let s=tl.parse(JSON.parse(qt(await wo(n,r,e.id,rq(i)))));return await mp(i,s),{binding:i,keys:s}}async function oq(t,e){let r=E.parse("binding"in e?e.binding.principalId:e.principalId),o="/api/principals/"+r+"/key-handoffs",n="binding"in e?e.binding:null,i=e.keys,s=null;for(let a=0;a<=32;a++){let{binding:c}=await t.json("/api/identities/"+r+"/binding",{},er);if(n?M(c)===M(n):await bo(c.encryption)===await bo(pp(e.keys.encryption)))return s?{binding:c,keys:s}:null;if(n&&c.generation<=n.generation||a===32)throw new Sg("The keys of this identity were made again. Sign in with a passkey that holds them.");let u=await t.json(n?o+"/"+E.parse(n.id):o+"?"+new URLSearchParams({encryption:await bo(pp(e.keys.encryption))}),{},XK),l=n??u.replacement.previous.binding;if(!n&&await bo(l.encryption)!==await bo(pp(e.keys.encryption)))throw new Error("This key handoff follows other keys.");let d=await nq(u,l,i.encryption);({binding:n}=d),i=s=d.keys}return null}var Sg=class extends Error{code="keys_replaced";constructor(e){super(e)}},vge=h.object({rotation:a0.nullable()});async function iq(t,e){let{binding:r,keys:o}=e,n=E.parse(r.principalId),i="/api/principals/"+n+"/key-rotations",{rotation:s}=await t.json(i,{},vge),a;if(s)a=await nq({replacement:{previous:s.previous,replacement:s.replacement,previousSignature:s.previousSignature},handoff:s.handoff},r,o.encryption);else{let u=await e0(),l={...t0(n,u),generation:r.generation+1,previous:await vt(r)};a={binding:l,keys:u},s=await t.json(i,{method:"POST",body:{id:crypto.randomUUID(),replacement:await mp(l,u),previousSignature:await rr(l,o.signing,"key-replacement"),handoff:await yge(r,l,u)}},a0)}let c=i+"/"+E.parse(s.id);for(let u=0;u<5;u++){let l=[],d=null,f=[];do{let p=await t.json(c+"?"+new URLSearchParams({limit:"100",...d?{after:d}:{}}),{},a0);f=p.blockers.filter(m=>m.reason==="authority_history_full");for(let m of p.items){if(m.state==="prepared"||f.some(y=>y.id===m.id))continue;if(m.signers){l.push(m);continue}let g=await wge(m,r,a,o);await t.json(c+"/items/"+m.kind+"/"+m.id,{method:"PUT",body:await gge(s.id,n,a.binding.id,m.id,m.sourceDigest,g,o.signing)})}d=p.next}while(d);if(f.length)return{state:"blocked",rotationId:s.id,blockers:f};if(l.length)return{state:"waiting",rotationId:s.id,waiting:l.map(p=>({kind:p.kind,id:p.id,name:p.name,signers:p.signers}))};try{return await t.json(c+"/commit",{method:"POST"},a0),{state:"committed",...a}}catch(p){if(!(p&&typeof p=="object"&&"code"in p&&["rotation_not_ready","rotation_busy","changed"].includes(String(p.code))))throw p}}throw new Error("The items kept changing during the key rotation. Try again later.")}async function wge(t,e,r,o){let n=t.source;if(!n)throw new Error("This identity cannot read an item it must prepare.");switch(t.kind){case"content":return{kind:t.kind,content:await tq(Hr.parse(n.content),e,r.binding,e,o,r.keys)};case"keyring":{let i=await s0(String(n.signature),e);return{kind:"keyring",signature:await i0({...i,signerId:r.binding.id,revision:i.revision+1,keys:i.keys.map(s=>s.binding.id===e.id?{...s,binding:r.binding}:s)},r.keys.signing)}}}}async function sq(t,e,r){let o=t.rotation.previous.binding,n=t.rotation.replacement.binding,i=t.source;if(t.kind==="content")return{kind:t.kind,content:await tq(Hr.parse(i.content),o,n,e,r)};throw new Error("Only the rotating identity prepares this item.")}var aq=t=>EN(Sge(ci()),"custody",t.id),xge=t=>_ge(t).then(()=>!0,()=>!1);async function cq(t,e,r){let o=aq(e.binding),n=aq(r.binding);if(!await xge(o))return;let i=async s=>{let a=new sc(EN(o,s),t,e.binding,e.keys),c=new sc(EN(n,s),t,r.binding,r.keys);for(let u of await a.keys("")){let l=await a.read(u);l!==null&&await c.write(u,l)}};for(let s of["client","connections"])await i(s);await bge(o,{recursive:!0,force:!0})}async function uq(t){if(!t.keys||!t.binding)return t;let e;try{e=await oq(new Qi(t),{binding:t.binding,keys:t.keys})}catch(o){if(!(o instanceof Sg))throw o;return process.stderr.write("foundation: "+o.message+`
132
132
  `),t}if(!e)return t;let r={...t,keys:e.keys,binding:e.binding};return await cq(t.origin,{binding:t.binding,keys:t.keys},e),process.env.FOUNDATION_TOKEN?process.stderr.write(`foundation: This identity uses new keys. Replace FOUNDATION_PRIVATE_KEYS and FOUNDATION_KEY_BINDING with them.
133
- `):await yp(r),r}async function lq(t){if(!t.keys||!t.binding)throw new Error("Use a sign-in key with encryption and signing keys for this operation.");if(process.env.FOUNDATION_TOKEN)throw new Error("Rotate the keys from a machine that saves its identity.");let e={binding:t.binding,keys:t.keys},r=await iq(new Qi(t),e);return r.state!=="committed"?r:(await cq(t.origin,e,r),await yp({...t,keys:r.keys,binding:r.binding}),{state:r.state,bindingId:r.binding.id,generation:r.binding.generation})}import{spawn as Ege}from"node:child_process";import{chmod as kge,mkdtemp as Ige,rm as $ge,writeFile as Age}from"node:fs/promises";import{tmpdir as Tge}from"node:os";import{join as dq}from"node:path";import{StringDecoder as Pge}from"node:string_decoder";function Rge(t){return[...new Set(t.filter(Boolean).flatMap(e=>[e,encodeURIComponent(e),JSON.stringify(e).slice(1,-1),Buffer.from(e).toString("base64"),Buffer.from(e).toString("base64url")]))].sort((e,r)=>r.length-e.length)}var c0=class{constructor(e,r){this.secrets=e;this.output=r;this.max=Math.max(1,...e.map(o=>o.length))}secrets;output;pending="";decoder=new Pge("utf8");max;write(e){this.pending+=this.decoder.write(e),this.flush(!1)}end(){this.pending+=this.decoder.end(),this.flush(!0)}flush(e){let r=e?this.pending.length:Math.max(0,this.pending.length-this.max+1),o=0,n="";for(;o<r;){let i=this.secrets.find(s=>this.pending.startsWith(s,o));i?(n+="[redacted]",o+=i.length):(n+=this.pending[o],o++)}this.pending=this.pending.slice(o),n&&this.output(n)}};function Cge(t){return{...Object.fromEntries(["PATH","LANG","LC_ALL","TZ","TERM","HOME","TMPDIR","SYSTEMROOT","COMSPEC","PATHEXT"].flatMap(r=>process.env[r]?[[r,process.env[r]]]:[])),...t}}async function pq(t,e){if(!e.length)throw new Error("Put the command after --.");let r=await Ige(dq(Tge(),"foundation-"));await kge(r,448);try{let o=Cge(t.environment),n=[...t.sensitive];for(let[i,s]of Object.entries(t.files)){let a=Buffer.from(s,"base64"),c=dq(r,i);await Age(c,a,{mode:384,flag:"wx"}),o[i]=c,n.push(a.toString("utf8"),s,a.toString("base64url"))}return await new Promise((i,s)=>{let a=Ege(e[0],e.slice(1),{env:o,stdio:["inherit","pipe","pipe"],detached:process.platform!=="win32"}),c=Rge(n),u=new c0(c,m=>process.stdout.write(m)),l=new c0(c,m=>process.stderr.write(m));a.stdout.on("data",m=>u.write(m)),a.stderr.on("data",m=>l.write(m));let d=m=>{if(a.pid)try{process.platform==="win32"?a.kill(m):process.kill(-a.pid,m)}catch{}},f=()=>d("SIGINT"),p=()=>d("SIGTERM");process.on("SIGINT",f),process.on("SIGTERM",p),a.once("error",()=>s(new Error("The command could not be started. Check the executable and arguments."))),a.once("close",(m,g)=>{process.off("SIGINT",f),process.off("SIGTERM",p),u.end(),l.end(),i(m??(g==="SIGINT"?130:g==="SIGTERM"?143:1))})})}finally{await $ge(r,{recursive:!0,force:!0})}}import{dirname as aRe,join as _4}from"node:path";var mq=h.object({ownerId:E,name:me,resourceId:E.optional(),version:h.number().int().positive().optional()}).strict(),hq=mq.extend({value:h.literal("").optional()}),kN=mq.extend({methodId:h.string().min(1).max(200),clientId:h.string().max(1e3),fields:h.record(h.string(),h.string()).optional(),clientSecret:h.literal("").optional()}),gq=h.object({ownerId:E,connectionId:E,version:h.number().int().positive(),users:h.array(E).max(32)}).strict(),u0=h.object({ownerId:E,methodId:h.string().min(1).max(200),connectionId:E.optional(),name:me.optional(),appId:E.optional(),redirectUri:h.url().optional(),users:h.array(E).max(32).optional(),scopes:h.array(h.string().min(1).max(1e3)).max(200).optional(),methodDigest:h.string().regex(/^[A-Za-z0-9_-]{43}$/).optional(),clientId:h.string().max(1e3).optional(),fields:h.record(h.string(),h.string()).optional(),clientSecret:h.literal("").optional()}).strict(),yq=h.object({name:vo.shape.name,title:Xx,keyholder:h.boolean(),configure:h.array(h.string()),input:xr}).strict(),vq=864e5,wq=h.object({kind:h.literal("connection"),id:E}).strict(),bq=h.enum(["stopped","in_progress","succeeded","failed","uncertain","cancelled"]),nr=h.object({id:E,name:vo.shape.name,title:Xx,input:xr,keyholder:h.boolean(),configure:h.array(h.string()),ownerId:E.nullable(),actor:Yu.pick({id:!0,name:!0}),request:h.object({id:E,position:h.number().int().nonnegative()}).strict().nullable(),state:bq,result:Zn.nullable(),error:h.object({code:h.string(),message:h.string()}).strict().nullable(),continuation:wq.nullable(),canPerform:h.boolean(),canCancel:h.boolean(),url:h.url(),createdAt:Ve,updatedAt:Ve,expiresAt:Ve.nullable()}).strict(),MBe=vo.extend({id:E.optional(),proof:Zn.optional(),continuation:wq.optional()}).strict(),UBe=h.object({proof:Zn.optional()}).strict(),Oge=fN.extend({title:Xx,keyholder:h.boolean(),configure:h.array(h.string())}),fq=Yu.pick({id:!0,name:!0}),Nge=h.enum(["pending","approved","declined","withdrawn","expired"]),Br=h.object({id:E,from:fq,to:fq.nullable(),message:h.string(),operations:h.array(Oge),proposal:wK.nullable(),state:Nge,createdAt:Ve,expiresAt:Ve,answeredAt:Ve.nullable(),performed:h.array(h.object({position:h.number().int().nonnegative(),id:E,state:bq}).strict()),url:h.url(),code:h.string().optional(),returnUrl:h.url().nullable(),refreshUrl:h.url().nullable(),canAnswer:h.boolean(),canWithdraw:h.boolean()}).strict(),_q=h.object({id:E.optional(),to:E.optional(),message:h.string().max(1e3).default(""),operations:h.array(fN).min(1).max(8),expiresInMinutes:h.number().int().min(1).max(1440).default(30)}).strict(),Sq=h.object({values:h.array(h.record(h.string(),Zn)).max(8).default([]),configuration:h.array(xr).max(8).default([]),code:h.string().max(20).optional()}).strict();function Nt(t){switch(t.kind){case"oauth":let e=t.config.application;return{family:"oauth",application:e,requiresApp:e==="required",browserAuthorization:t.config.grantType!=="client_credentials",fields:t.config.fields,outputs:Object.keys(t.config.outputs)};case"token":return{family:"token",application:"none",requiresApp:!1,browserAuthorization:!1,fields:t.config.fields,outputs:Object.keys(t.config.outputs)};case"approval":return{family:"approval",application:"none",requiresApp:!1,browserAuthorization:!0,fields:t.config.fields,outputs:Object.keys(t.config.outputs)};case"ovh":{let r=t.config.authorization==="consumer_key";return{family:"ovh",application:r?"required":"none",requiresApp:r,browserAuthorization:r,fields:t.config.fields,outputs:Object.keys(t.config.outputs)}}case"aws":return{family:"aws",application:"none",requiresApp:!1,browserAuthorization:!1,fields:[],outputs:["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_DEFAULT_REGION","AWS_REGION"]}}}var xg=(t,e)=>Object.fromEntries(Object.entries(t).filter(([r])=>!e.includes(r)));function IN(t){let e=t.config;return{...xg(t,["name","docs","console","preparation"]),config:{...xg(t.config,["hint","instructions","console"]),...e.fields?{fields:e.fields.map(r=>({...xg(r,["label","placeholder","note"]),...r.choices?{choices:r.choices.map(o=>xg(o,["label"]))}:{}}))}:{},...e.scopes?{scopes:{...xg(e.scopes,["docs"]),...e.scopes.values?{values:e.scopes.values.map(r=>({id:r.id}))}:{}}}:{}}}}var la=t=>vt(IN(t));function cc(t){let{id:e,builtin:r,availability:o,registration:n,defaultName:i,...s}=t;return s}function es(t,e){return[...new Set([...t.required??[],...e??t.default])]}function uc(t){return Nt(t).requiresApp}function xq(t){return t.kind==="approval"?"unavailable":!Nt(t).browserAuthorization||t.kind==="ovh"||t.kind!=="oauth"?"available":t.config.browserTokenExchange??"unknown"}var Er=class extends Error{constructor(r,o,n,i){super(n);this.status=r;this.code=o;this.details=i}status;code;details};function C(t,e,r,o){throw new Er(t,e,r,o)}var Dge=new Set(["format","generation","methodId","method","appId","appGeneration","account","accountId","accountVerified","scopes","scopesStatus","outputs","state","methodKind","methodDigest","authorizationDigest"]),Eq=xr.refine(t=>Object.keys(t).every(e=>!Dge.has(e)),"Keep method-specific facts separate from common facts."),lc=h.object({accountId:h.string().max(2e3).nullable(),accountVerified:h.boolean(),scopes:h.array(h.string().max(1e3)).max(200),scopesStatus:h.enum(["unknown","requested","reported"]),authorization:Eq,details:Eq}).strict();function $N(t){if(t.method.kind!=="oauth")throw new Error("Use OAuth connection material.");let e="requestedScopes"in t?t.requestedScopes:void 0;return lc.parse({accountId:t.oauth?.account??"",accountVerified:t.oauth?.accountVerified??!1,scopes:e??t.oauth?.scopes??[],scopesStatus:e?"requested":t.oauth?.scopesStatus??"unknown",authorization:{},details:{}})}function bp(t){if(t.method.kind!=="token"&&t.method.kind!=="approval"||!t.fields)throw new Error("Use input credential material.");return"facts"in t&&t.facts?lc.parse(t.facts):lc.parse({accountId:null,accountVerified:!1,scopes:[],scopesStatus:"unknown",authorization:{},details:{}})}function AN(t){if(t.method.kind!=="ovh")throw new Error("Use OVH connection material.");let e="ovh"in t?t.ovh:void 0;if(!e){let r="requestedScopes"in t?t.requestedScopes:void 0;return lc.parse({accountId:null,accountVerified:!1,scopes:r??[],scopesStatus:r?"requested":"unknown",authorization:{},details:{}})}return lc.parse({accountId:e.user?e.account+"/"+e.user:e.account,accountVerified:!0,scopes:e.rules.map(r=>r.method+" "+r.path),scopesStatus:"reported",authorization:{ovh:e},details:{ovh:e}})}function TN(t){if(t.method.kind!=="aws"||!t.aws)throw new Error("Use AWS connection material.");return lc.parse({accountId:t.aws.identity?lp(t.aws.identity.arn):null,accountVerified:!!t.aws.identity,scopes:[],scopesStatus:"unknown",authorization:{aws:iK(t.aws)},details:{aws:sK(t.aws)}})}var zge={oauth:$N,token:bp,aws:TN,ovh:AN,approval:bp};function Eg(t){return zge[t.method.kind](t)}var lZ=St(qq(),1);var ma=class extends Error{template;position;hint;constructor(t,e,r,o){super(`${o} (at position ${e}): ${r}`),this.template=t,this.position=e,this.hint=r,this.name="TemplateParseError"}},aye=class extends ma{constructor(t,e){super(t,e,"Add the missing '}' to close the expression, or remove the stray '{'.","Unclosed expression: '{' has no matching '}'"),this.name="UnclosedExpressionError"}},cye=class extends ma{constructor(t,e){super(t,e,"Remove this stray '}' or add a matching '{' before it.","Stray '}' outside of any expression"),this.name="StrayClosingBraceError"}},uye=class extends ma{constructor(t,e){super(t,e,"RFC 6570 expressions cannot nest. Close the outer expression with '}' before starting a new one.","Nested '{' inside an unclosed expression"),this.name="NestedOpeningBraceError"}},lye=class extends ma{char;constructor(t,e,r){super(t,e,`Pct-encode '${r}' (e.g. '%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}') or remove it. Literals may not contain CTL, SP, '"', '\\'', lone '%', '<', '>', '\\\\', '^', '\`', or '|'.`,`Invalid literal character '${r}'`),this.char=r,this.name="InvalidLiteralError"}},dye=class extends ma{constructor(t,e){super(t,e,"Provide at least one varname inside the braces, e.g. '{var}'.","Empty expression '{}'"),this.name="EmptyExpressionError"}},pye=class extends ma{operator;constructor(t,e,r){super(t,e,`Operator '${r}' is reserved by RFC 6570 \xA72.2 for future extensions. Use one of '+', '#', '.', '/', ';', '?', '&' instead, or remove the operator.`,`Reserved operator '${r}'`),this.operator=r,this.name="ReservedOperatorError"}},fye=class extends ma{operator;constructor(t,e,r){super(t,e,`Replace '${r}' with one of '+', '#', '.', '/', ';', '?', '&' or remove it.`,`Unknown operator '${r}'`),this.operator=r,this.name="UnknownOperatorError"}},b0=class extends ma{varSpec;constructor(t,e,r,o,n){super(t,e,r,o),this.varSpec=n,this.name="InvalidVarSpecError"}},MN=class extends b0{constructor(t,e){super(t,e,"Remove the stray comma or insert a varname before/after it.","Empty varname in variable-list",""),this.name="EmptyVarNameError"}},mye=class extends b0{offendingChar;constructor(t,e,r,o){super(t,e,`Varnames may only contain ALPHA, DIGIT, '_', '.', or pct-encoded triplets. Replace '${o}' or pct-encode it.`,`Invalid character '${o}' in varname`,r),this.offendingChar=o,this.name="InvalidVarNameError"}},hye=class extends b0{prefix;constructor(t,e,r,o){super(t,e,"Prefix modifiers must be ':N' where N is a positive integer in 1..9999 with no leading zero (e.g. ':3').",`Invalid prefix modifier ':${o}'`,r),this.prefix=o,this.name="InvalidPrefixError"}},Zq=class extends b0{constructor(t,e){super(t,e,"Remove the trailing comma, or add a varspec after it.","Trailing ',' in variable-list",""),this.name="TrailingCommaError"}},gye=class extends ma{char;constructor(t,e,r){super(t,e,"Expected ',' or '}' here. Remove the unexpected character or pct-encode it if it belongs in the varname.",`Unexpected character '${r}' in expression`),this.char=r,this.name="UnexpectedCharacterError"}},yye=class extends Error{variableName;hint;constructor(t,e,r){super(`${r} for '${t}': ${e}`),this.variableName=t,this.hint=e,this.name="TemplateExpansionError"}},vye=class extends yye{prefix;valueType;constructor(t,e,r){super(t,"Remove the prefix modifier from this varspec, or provide a string value instead of a composite value.",`Prefix modifier ':${e}' is not applicable to ${r} values`),this.prefix=e,this.valueType=r,this.name="PrefixModifierNotApplicableError"}},wye=["","+",".","/",";","?","&","#"],eZ={"":{first:"",sep:",",named:!1,ifEmpty:"",allowReserved:!1},"+":{first:"",sep:",",named:!1,ifEmpty:"",allowReserved:!0},".":{first:".",sep:".",named:!1,ifEmpty:"",allowReserved:!1},"/":{first:"/",sep:"/",named:!1,ifEmpty:"",allowReserved:!1},";":{first:";",sep:";",named:!0,ifEmpty:"",allowReserved:!1},"?":{first:"?",sep:"&",named:!0,ifEmpty:"=",allowReserved:!1},"&":{first:"&",sep:"&",named:!0,ifEmpty:"=",allowReserved:!1},"#":{first:"#",sep:",",named:!1,ifEmpty:"",allowReserved:!0}},bye=new TextEncoder,Wq="0123456789ABCDEF",Jq=t=>fc(Zr(48,57),Zr(65,70),Zr(97,102))(t.charCodeAt(0)),Ag=(t,e)=>t[e]==="%"&&e+2<t.length&&Jq(t[e+1])&&Jq(t[e+2]);function UN(t,e){let r=t[e];return r==null?0:fc(tZ,rZ,ol("_"))(r)?1:Ag(t,e)?3:0}function _ye(t,e){if(Ag(t,e))return 3;let{char:r,size:o}=Tg(t,e);return xye(r)?o:0}function Tg(t,e){let r=t.codePointAt(e);if(r==null)return{char:"",size:0};let o=r>65535?2:1;return{char:t.slice(e,e+o),size:o}}var HN=t=>e=>{let r="";for(let o=0;o<e.length;){if(t&&Ag(e,o)){r+=e.slice(o,o+3),o+=3;continue}let{char:n,size:i}=Tg(e,o);r+=fc(nZ,s=>t&&Sye(s))(n)?n:oZ(n),o+=i}return r};function xp(t){let e="";for(let r=0;r<t.length;){if(Ag(t,r)){e+=t.slice(r,r+3),r+=3;continue}let{char:o,size:n}=Tg(t,r);e+=nZ(o)?o:oZ(o),r+=n}return e}function Ig(t,e){let r="",o=0;for(let n=0;n<t.length&&o<e;o++){if(Ag(t,n)){r+=t.slice(n,n+3),n+=3;continue}let{char:i,size:s}=Tg(t,n);r+=i,n+=s}return r}var tZ=t=>fc(Zr(65,90),Zr(97,122))(t.charCodeAt(0)),rZ=t=>Zr(48,57)(t.charCodeAt(0)),nZ=t=>fc(tZ,rZ,e=>"-._~".includes(e))(t),Sye=t=>":/?#[]@!$&'()*+,;=".includes(t),xye=t=>Eye(t.codePointAt(0)),Eye=t=>t!=null&&fc(ol(33),Zr(35,36),ol(38),Zr(40,59),ol(61),Zr(63,91),ol(93),ol(95),Zr(97,122),ol(126),kye,Iye)(t);function kye(t){if(t<65536)return fc(Zr(160,55295),Zr(63744,64975),Zr(65008,65519))(t);if(t>983037)return!1;let e=t%65536;return e<=65533&&(t<917504||e>=4096)}var Iye=t=>fc(Zr(57344,63743),Zr(983040,1048573),Zr(1048576,1114109))(t),oZ=t=>Array.from(bye.encode(t)).map(e=>`%${Wq[e>>4]}${Wq[e&15]}`).join(""),Zr=(t,e)=>r=>t<=r&&r<=e,ol=t=>e=>t===e,fc=(...t)=>e=>t.some(r=>r(e));function iZ(t,e,r){return t.map(o=>o.kind==="literal"?o.text:$ye(o.vars,o.operator,e,r)).join("")}function $ye(t,e,r,o){let n=eZ[e],i=t.flatMap(s=>Aye(s,r[s.name],n,o));return i.length<1?"":`${n.first}${i.join(n.sep)}`}function Aye(t,e,r,o){if(e==null)return[];if(zye(e)){let n=Cye(e,r.allowReserved);return n.length<1?[]:Gq(t,"list",o)?Pye(t,n,r):[]}if(Dye(e)){let n=Oye(e,r.allowReserved);return n.length<1?[]:Gq(t,"associative",o)?Rye(t,n,r):[]}return Tye(t,e,r)}function Tye(t,e,r){let o=String(e),n=t.prefix==null?o:Ig(o,t.prefix),i=HN(r.allowReserved)(n);return r.named?[$g(xp(t.name),i,r)]:[i]}function Pye(t,e,r){let o=xp(t.name);if(t.explode)return r.named?e.map(i=>$g(o,i,r)):[...e];let n=e.join(",");return r.named?[$g(o,n,r)]:[n]}function Rye(t,e,r){if(t.explode)return e.map(([n,i])=>$g(n,i,r));let o=e.flat(1).join(",");return r.named?[$g(xp(t.name),o,r)]:[o]}var $g=(t,e,r)=>e===""?`${t}${r.ifEmpty}`:`${t}=${e}`,Cye=(t,e)=>t.filter(r=>r!=null).map(String).map(HN(e)),Oye=(t,e)=>Object.entries(t).map(([r,o])=>[r,Nye(o)]).filter(([,r])=>r!=null).map(r=>r.map(HN(e)));function Nye(t){if(t==null)return null;if(!Array.isArray(t))return String(t);let e=t.filter(r=>r!=null).map(String);return e.length<1?null:e.join(",")}var Dye=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),zye=t=>Array.isArray(t);function Gq(t,e,{report:r,strict:o}){if(t.prefix==null)return!0;let n=new vye(t.name,t.prefix,e);if(r(n),o)throw n;return!1}function jye(t,e,r){return LN(t,e,r,0,0,{})}function LN(t,e,r,o,n,i){if(o>=t.length){if(n!==e.length)return null;let a=lve(i);return iZ(t,a,r)===e?a:null}let s=t[o];if(s.kind==="literal")return e.startsWith(s.text,n)?LN(t,e,r,o+1,n+s.text.length,i):null;for(let a of Mye(t,e,o,n)){let c=e.slice(n,a);for(let u of Lye(s.vars,s.operator,c)){let l=BN(i,u);if(l==null)continue;let d=LN(t,e,r,o+1,a,l);if(d!=null)return d}}return null}function*Mye(t,e,r,o){let n=t.slice(r+1).find(i=>i.kind==="literal"&&i.text!=="");if(n==null||n.kind!=="literal"){yield*Uye(e.length,o);return}for(let i=e.indexOf(n.text,o);i>=0;i=e.indexOf(n.text,i+1))yield i}function*Uye(t,e){for(let r=t;r>=e;r--)yield r}function*Lye(t,e,r){if(r===""){yield*Fye(t,e);return}let o=eZ[e];if(!r.startsWith(o.first))return;let n=r.slice(o.first.length);yield*o.named?Gye(t,o,n):Vye(t,o,n)}var Fye=(t,e)=>(e===""||e==="+")&&t.length===1?[pc(t[0],"")]:[{}],Vye=(t,e,r)=>FN(t,e,KN(r,e.sep),0,0);function*FN(t,e,r,o,n){if(o>=t.length){n>=r.length&&(yield{});return}let i=t[o];for(let s of Hye(i,e,r,n))for(let a of FN(t,e,r,o+1,s.index)){let c=BN(s.bindings,a);c!=null&&(yield c)}yield*FN(t,e,r,o+1,n)}function*Hye(t,e,r,o){if(o>=r.length)return;let n=r.length-o;for(let i=1;i<=n;i++){let s=r.slice(o,o+i);for(let a of Bye(t,e,s))yield{bindings:a,index:o+i}}}function*Bye(t,e,r){let o=sZ(t,e,r.join(e.sep));if(t.prefix!=null){yield*o;return}t.explode&&r.length>0&&(yield*Kye(t,e,r)),yield*o}function*Kye(t,e,r){let o=aZ(r,e.allowReserved);if(o==null)return;let n=qye(r,e);n!=null&&(yield pc(t,n)),yield pc(t,o)}var qye=(t,e)=>Zye(t.join(e.sep),e);function Zye(t,e){let r=[];for(let o=0;o<t.length;){let n=t.indexOf("=",o);if(n<0)return null;let i=n+1,s=Wye(t,i,e.sep),a=fa(t.slice(o,n),e.allowReserved),c=fa(t.slice(i,s),e.allowReserved);if(a==null||c==null)return null;r.push([a,c]),o=s+e.sep.length}return r.length<1?null:Object.fromEntries(r)}function Wye(t,e,r){for(let o=e;o<t.length;o++)if(Jye(t,o,r))return o;return t.length}var Jye=(t,e,r)=>{if(!t.startsWith(r,e))return!1;let o=e+r.length;for(let n=o;n<t.length;n++){if(t[n]==="=")return n>o;if(t.startsWith(r,n))return!1}return!1};function*sZ(t,e,r){let o=fa(r,e.allowReserved);if(o==null)return;let n=pc(t,o);if(t.prefix!=null){yield n;return}let i=KN(r,",");if(i.length<2){yield n;return}let s=aZ(i,e.allowReserved);if(s==null){yield n;return}let a=i.length%2===0?ive(i,e.allowReserved):null;a!=null&&(yield pc(t,a)),yield pc(t,s),yield n}var Gye=(t,e,r)=>VN(t,e,KN(r,e.sep).map(ove),0,0);function*VN(t,e,r,o,n){if(o>=t.length){n>=r.length&&(yield{});return}let i=t[o];for(let s of Xye(i,e,r,n,t))for(let a of VN(t,e,r,o+1,s.index)){let c=BN(s.bindings,a);c!=null&&(yield c)}yield*VN(t,e,r,o+1,n)}function*Xye(t,e,r,o,n){if(!(o>=r.length)){if(t.explode&&t.prefix==null){yield*Qye(t,e,r,o,n);return}yield*Yye(t,e,r,o)}}function*Yye(t,e,r,o){let n=r[o];if(n.name===xp(t.name))for(let i of sZ(t,e,n.value))yield{bindings:i,index:o+1}}function*Qye(t,e,r,o,n){yield*eve(t,e,r,o),yield*rve(t,e,r,o,n)}function*eve(t,e,r,o){let n=[...tve(xp(t.name),e,r,o)];n.length>0&&(yield{bindings:pc(t,n),index:o+n.length})}function*tve(t,e,r,o){for(let n=o;n<r.length&&r[n].name===t;n++){let i=fa(r[n].value,e.allowReserved);if(i==null)return;yield i}}function*rve(t,e,r,o,n){let i=[...nve(e,r,o,new Set(n.map(s=>xp(s.name))))];i.length>0&&(yield{bindings:pc(t,Object.fromEntries(i)),index:o+i.length})}function*nve(t,e,r,o){for(let n=r;n<e.length;n++){let i=e[n];if(n>r&&o.has(i.name))return;let s=fa(i.name,t.allowReserved),a=fa(i.value,t.allowReserved);if(s==null||a==null)return;yield[s,a]}}function ove(t){let e=t.indexOf("=");return e<0?{name:t,value:""}:{name:t.slice(0,e),value:t.slice(e+1)}}function ive(t,e){let r=[];for(let o=0;o<t.length;o+=2){let n=fa(t[o],e),i=fa(t[o+1],e);if(n==null||i==null)return null;r.push([n,i])}return Object.fromEntries(r)}function aZ(t,e){let r=[];for(let o of t){let n=fa(o,e);if(n==null)return null;r.push(n)}return r}function fa(t,e){if(e)return t;try{return decodeURIComponent(t)}catch{return null}}var pc=({name:t,prefix:e},r)=>({[t]:{value:r,prefix:e}});function BN(t,e){let r={...t};for(let[o,n]of Object.entries(e)){let i=r[o];if(i==null){r[o]=n;continue}let s=sve(i,n);if(s==null)return null;r[o]=s}return r}var sve=(t,e)=>w0(t)||w0(e)?ave(t,e):cve(t.value,e.value)?t:null;function ave(t,e){let r=Xq(t.value),o=Xq(e.value);if(r==null||o==null)return null;let n=w0(t),i=w0(e);if(!n&&!i)return null;if(n&&!i)return Ig(o,t.prefix)===r?e:null;if(!n&&i)return Ig(r,e.prefix)===o?t:null;let s=t.prefix,a=e.prefix;return s<=a?Ig(o,s)===r?e:null:Ig(r,a)===o?t:null}var w0=t=>t.prefix!=null,Xq=t=>typeof t=="string"?t:null;function cve(t,e){return Array.isArray(t)?Array.isArray(e)&&t.length===e.length&&t.every((r,o)=>r===e[o]):Yq(t)?Yq(e)&&uve(Object.entries(t),Object.entries(e)):t===e}var uve=(t,e)=>t.length===e.length&&t.every(([r,o],n)=>{let[i,s]=e[n];return r===i&&o===s}),Yq=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),lve=t=>Object.fromEntries(Object.entries(t).map(([e,r])=>[e,r.value])),KN=(t,e)=>e===""?[t]:t.split(e),dve=["=",",","!","@","|"];function pve(t,e,r){let o=a=>{throw a};if(t.length<1)return o(new dye(e,r));let n=t[0];if(gve(n))return o(new pye(e,r+1,n));if(!Qq(n)&&UN(t,0)<1)return o(new fye(e,r+1,n));let i=Qq(n)?n:"",s=i===""?0:1;return{kind:"expression",operator:i,vars:fve(t,e,r+1,s)}}function fve(t,e,r,o){if(o>=t.length)throw new MN(e,r+o);let n=[];for(let i=o;i<t.length;){if(t[i]===",")throw i===t.length-1?new Zq(e,r+i):new MN(e,r+i);let s=i,a=mve(t,i);if(a===s)throw new MN(e,r+i);let c=t.slice(s,a);i=a;let u=hve(t,e,r,i,c);if(i=u.index,i<t.length&&t[i]!==",")throw u.used?new gye(e,r+i,t[i]):new mye(e,r+i,c,t[i]);if(n.push({name:c,explode:u.explode,...u.prefix==null?{}:{prefix:u.prefix}}),i<t.length&&(i++,i>=t.length))throw new Zq(e,r+i-1)}return n}function mve(t,e){let r=e,o=!0;for(;r<t.length;){let n=UN(t,r);if(n>0){r+=n,o=!1;continue}if(t[r]!=="."||o||UN(t,r+1)<1)break;r++,o=!0}return r}function hve(t,e,r,o,n){if(t[o]==="*")return{explode:!0,index:o+1,used:!0};if(t[o]!==":")return{explode:!1,index:o,used:!1};let i=o+1,s=i;for(;s<t.length&&yve(t[s]);)s++;let a=t.slice(i,s);if(!/^[1-9][0-9]{0,3}$/.test(a))throw new hye(e,r+o,n,a);return{explode:!1,index:s,prefix:Number(a),used:!0}}function Qq(t){return wye.includes(t)&&t!==""}function gve(t){return dve.includes(t)}function yve(t){let e=t.charCodeAt(0);return e>=48&&e<=57}function vve(t,e){let{report:r}=e,o=[],n=i=>{let s=o.at(-1);s?.kind==="literal"?o[o.length-1]={kind:"literal",text:s.text+i}:o.push({kind:"literal",text:i})};for(let i=0;i<t.length;){let s=t[i];if(s==="{"){let l=t.indexOf("}",i+1);if(l<0){r(new aye(t,i)),n(t.slice(i));break}let d=t.indexOf("{",i+1);if(d>=0&&d<l){r(new uye(t,d)),n(t.slice(i,l+1)),i=l+1;continue}let f=t.slice(i+1,l);try{o.push(pve(f,t,i))}catch(p){r(p instanceof Error?p:new Error(String(p))),n(t.slice(i,l+1))}i=l+1;continue}if(s==="}"){r(new cye(t,i)),n(s),i++;continue}let a=_ye(t,i);if(a>0){n(t.slice(i,i+a)),i+=a;continue}let{char:c,size:u}=Tg(t,i);r(new lye(t,i,c)),n(c),i+=u}return o}var cZ=class uZ{uriTemplate;options;#e;#t;constructor(e,r={}){this.uriTemplate=e,this.options=r,this.#t=xve(r),this.#e=wve(vve(e,this.#t)),Object.freeze(this)}static parse(e,r={}){return new uZ(e,r)}get tokens(){return this.#e}expand=e=>iZ(this.#e,e,this.#t);match=e=>jye(this.#e,e,this.#t);toString=()=>this.uriTemplate},wve=t=>Object.freeze(t.map(bve)),bve=t=>t.kind==="literal"?Object.freeze({kind:"literal",text:t.text}):Object.freeze({kind:"expression",operator:t.operator,vars:Object.freeze(t.vars.map(_ve))}),_ve=t=>Object.freeze({name:t.name,explode:t.explode,...t.prefix==null?{}:{prefix:t.prefix}}),Sve=()=>{},xve=({strict:t,report:e})=>(e??=Sve,t??=!0,e=t?Eve(e):e,{strict:t,report:e}),Eve=t=>e=>{throw t(e),e};function kve(t){if(t==="")return[];if(!t.startsWith("/")||/~(?![01])/u.test(t))throw new Error("Invalid JSON pointer.");let e=t.slice(1).split("/").map(r=>r.replaceAll("~1","/").replaceAll("~0","~"));if(e.some(r=>["__proto__","prototype","constructor"].includes(r)))throw new Error("Invalid JSON pointer.");return e}function ui(t,e){for(let r of kve(e)){if(t===null||typeof t!="object"||!Object.hasOwn(t,r))return;t=t[r]}return t}function mc(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);throw new Error("The selected value is not text.")}function _0(t,e){return typeof e=="string"?mc(ui(t,e)):e.map(r=>typeof r=="string"?r:mc(ui(t,r.pointer))).join("")}var rs=class extends Error{constructor(r,o){super(o);this.code=r}code};function Ive(t,e){return!t.when||e[t.when.field]===void 0||t.when.values.includes(e[t.when.field])}function S0(t,e,r={}){let o=(i,s)=>{throw new rs(i,s)},n={...r,...e};for(let i of t)n[i.name]===void 0&&i.defaultValue!==void 0&&(n[i.name]=i.defaultValue);for(let i of t){if(!Ive(i,n)){delete n[i.name];continue}i.required!==!1&&!n[i.name]&&o("missing_field","Complete the required service fields."),n[i.name]?.includes("\0")&&o("invalid_field","Check the service fields."),i.choices&&n[i.name]&&!i.choices.some(s=>s.value===n[i.name])&&o("invalid_field","Choose an available service setting."),i.pattern&&(i.pattern.length>200||!(0,lZ.default)(i.pattern))&&o("invalid_pattern","Use a simple field validation pattern."),i.pattern&&n[i.name]&&!new RegExp(i.pattern,"u").test(n[i.name].slice(0,1e3))&&o("invalid_field","Check the service fields.")}return Object.keys(e).some(i=>!t.some(s=>s.name===i))&&o("invalid_field","Remove unrecognized service fields."),n}function ns(t,e,r={}){let o=S0(t,e,r),n={};for(let i of t){let s=i.choices?.find(a=>a.value===o[i.name]);for(let[a,c]of Object.entries(s?.values??{})){if(t.some(u=>u.name===a)||a in n&&n[a]!==c)throw new rs("invalid_field","Use distinct values for each service setting.");n[a]=c}}return{...o,...n}}function x0(t,e){for(let[r,o]of Object.entries(e)){let n=t.find(i=>i.name===r);if(!n)throw new rs("invalid_field","Use the fields declared by the connection method.");if(n.secret!==!1&&o!=="")throw new rs("encrypted_input_required","Supply private material directly with your encryption keys.")}return S0(t.map(r=>({...r,required:!1,defaultValue:void 0})),e)}function Eo(t,e){return x0(t,Object.fromEntries(t.filter(r=>r.secret===!1&&e[r.name]).map(r=>[r.name,e[r.name]])))}function Pg(t,e,r){x0(t,e);for(let[o,n]of Object.entries(e))if(n&&r[o]!==void 0&&r[o]!==n)throw new rs("operation_changed","Use the service settings prepared by this operation.");return{...e,...r}}function E0(t,e){let r;try{r=ui(JSON.parse(e[t.field]??""),t.pointer)}catch{r=void 0}if(typeof r!="string"||!r)throw new rs("invalid_field","Enter the complete JSON document the service issued.");return r}function dZ(t,e=Eg(t)){return e.accountVerified?e.accountId:null}function pZ(t,e=Eg(t)){let o=(t.method.kind==="oauth"||t.method.kind==="ovh"||t.method.kind==="token"&&!!(t.method.config.identity||t.method.config.resolver||t.method.config.bindFields))&&t.method.kind!=="aws"?Eo(t.method.config.fields,t.fields??{}):{};return{format:t.format,generation:t.generation,methodId:t.methodId,method:IN(t.method),appId:t.appId,appGeneration:t.appGeneration,..."implicitApp"in t&&t.implicitApp?{implicitApp:{clientId:t.implicitApp.clientId,generation:t.implicitApp.generation,fields:t.implicitApp.fields}}:{},account:e.accountId,accountVerified:e.accountVerified,scopes:[...e.scopes].sort(),...Object.keys(o).length?{fields:o}:{},...e.authorization,...t.state?{state:t.state}:{}}}var hc=h.record(h.string().max(100),h.string().max(16384)),Rn=h.object({format:h.literal(1),methodId:h.string().min(1),generation:E,clientId:h.string().max(1e3),clientSecret:h.string().max(16384).optional(),fields:hc}).strict(),qN=h.object({accessToken:h.string().min(1).max(16384),refreshToken:h.string().min(1).max(16384).optional(),expiresAt:h.number().nullable(),refreshExpiresAt:h.number().optional(),scopes:h.array(h.string()),requestedScopes:h.array(h.string()).optional(),account:h.string(),accountVerified:h.boolean().optional(),scopesStatus:h.enum(["unknown","requested","reported"]).optional(),extra:hc,facts:xr}).strict(),Rg={format:h.literal(3),methodId:h.string().min(1),method:dp,generation:E,appId:E.nullable(),appGeneration:E.nullable(),state:h.literal("reconnect").optional()},ha=h.never().optional(),Gn=h.union([h.object({...Rg,method:qx,oauth:qN.optional(),requestedScopes:h.array(h.string()).optional(),implicitApp:Rn.optional(),fields:hc.optional(),aws:ha}).strict(),h.object({...Rg,method:Zx,fields:hc,facts:lc.optional(),oauth:ha,aws:ha}).strict(),h.object({...Rg,method:Gx,fields:hc,oauth:ha,aws:ha}).strict(),h.object({...Rg,method:Jx,fields:hc,ovh:hg.optional(),requestedScopes:h.array(h.string()).optional(),oauth:ha,aws:ha}).strict(),h.object({...Rg,method:Wx,aws:Fx,oauth:ha,fields:ha}).strict()]).superRefine((t,e)=>{if("implicitApp"in t&&t.implicitApp&&(t.method.kind!=="oauth"||t.method.config.application!=="implicit"||t.implicitApp.methodId!==t.methodId)&&e.addIssue({code:"custom",message:"Keep the registered client with its implicit OAuth connection."}),t.method.kind==="oauth"&&t.fields)try{x0(t.method.config.fields,t.fields)}catch{e.addIssue({code:"custom",path:["fields"],message:"Keep only declared public settings in the connection."})}uc(t.method)&&(!t.appId||!t.appGeneration)&&e.addIssue({code:"custom",message:"Bind the application required by this connection."}),!uc(t.method)&&t.appId!==null&&e.addIssue({code:"custom",message:"Use an application only when the connection requires one."}),!!t.appId!=!!t.appGeneration&&e.addIssue({code:"custom",message:"Bind the application and its generation together."}),t.method.kind==="oauth"&&t.method.config.grantType==="client_credentials"&&!("requestedScopes"in t&&t.requestedScopes)&&!t.oauth?.requestedScopes&&e.addIssue({code:"custom",message:"Keep the selected scopes for client credentials renewal."})}),FKe=h.object({methodId:h.string().min(1).max(200),clientId:h.string().max(1e3),generation:E,fields:hc.optional()}).strict(),$ve=h.object({methodId:h.string().min(1).max(200),methodDigest:Vr,methodKind:lN,generation:E,authorizationDigest:Vr,appId:E.nullable(),accountId:h.string().max(2e3).nullable(),accountVerified:h.boolean(),scopes:h.array(h.string().max(1e3)).max(200),scopesStatus:h.enum(["unknown","requested","reported"]),outputs:h.array(h.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/)).max(100),state:h.enum(["ready","reconnect"]),fields:hc.optional(),aws:Vx.optional(),ovh:hg.optional()}).strict();async function Ep(t,e=Eg(t)){let{outputs:r}=Nt(t.method),o=t.method.kind!=="aws"&&t.fields?Eo(t.method.config.fields,t.fields):{},n=await vt(pZ(t,e));return $ve.parse({methodId:t.methodId,methodDigest:await la(t.method),methodKind:t.method.kind,generation:t.generation,authorizationDigest:n,appId:t.appId,accountId:dZ(t,e),accountVerified:e.accountVerified,scopes:e.scopes,scopesStatus:e.scopesStatus,outputs:r,state:t.state??"ready",...Object.keys(o).length?{fields:o}:{},...e.details})}var fZ=h.object({account:h.string().max(2e3)}).strict();function Cg(t){return{account:t.method.kind==="token"&&t.method.config.account&&t.fields?E0(t.method.config.account,t.fields):""}}var VKe=h.array(h.object({name:h.string(),label:h.string(),value:h.string()}).strict());function Og(t){let{methodId:e,method:r,...o}=t;return xr.parse(o)}var kp=t=>Et(M(Og(t)));function ZN(t,e,r){let o=t&&typeof t=="object"&&!("methodId"in t)&&!("method"in t)?Gn.safeParse({...t,methodId:e,method:r}):null;return o?.success||C(409,"reconnect_required","Reconnect this service with the current connection format."),o.data}var k0=(t,e,r)=>ZN(JSON.parse(qt(t)),e.methodId,r);var Ng=er.extend({name:me}),mZ=h.object({required:h.array(Ng),delegates:h.array(Ng)}).strict(),GKe=h.object({to:E,version:h.number().int().positive(),content:Hr.optional()}).strict(),WN=h.object({name:me,content:Hr,labels:fZ.optional(),version:h.number().int().positive().optional()}).strict(),hZ=h.object({content:Hr,version:h.number().int().positive()}).strict(),gZ=h.object({id:E,remove:h.array(E).max(1e3).default([])}).strict(),XKe=h.record(E,h.object({version:h.number().int().positive(),content:Hr}).strict()),yZ=h.object({id:E,name:me,version:h.number().int().positive(),content:Hr,policy:Wn}).strict(),Dg=h.object({id:E,resource_id:E,renewer_id:E,expected_revision:h.number().int().positive(),state:h.enum(["prepared","in_flight","committed","uncertain","aborted"]),fence:h.string().regex(/^\d+$/),result:Hr.nullable()}),YKe=h.object({id:E,resourceId:E,expectedRevision:h.number().int().positive()}).strict(),Ave=h.object({fence:h.string().regex(/^\d+$/)}).strict(),QKe=Ave.extend({content:Hr}).strict(),eqe=h.object({id:E,operationId:E,stateDigest:Vr,expiresAt:Ve}).strict(),JN=h.object({id:E,operationId:E,context:h.string(),sealed:Fr.nullable(),expiresAt:Ve,receivedAt:Ve.nullable()}).strict(),vZ=(t,e)=>"oauth-callback:"+t+":"+e;var Tve=["variable","connection","app"],nqe={variable:kt.value,connection:kt.tokenSet,app:kt.clientCredential},wZ=t=>Tve.includes(t);var Wr=class extends Error{constructor(r,o){super(o);this.code=r}code},zg=class extends Wr{constructor(r){super(r.code,"Verify the public keys of "+r.name+" ("+r.id+") before continuing.");this.recipient=r}recipient},I0=(t,...e)=>!!t&&typeof t=="object"&&("code"in t&&e.includes(String(t.code))||"status"in t&&e.includes(Number(t.status)));async function bZ(t,e,r,o){E.parse(r);let n=await t.json("/api/resources/"+E.parse(e),{},mt);return wZ(n.kind)?(await o()).transferProtected(n,r):t.json("/api/resources/"+e+"/transfer",{method:"POST",body:{to:r,version:n.version}},h.union([mt,Br]))}var $0=class{constructor(e,r,o,n,i,s){this.api=e;this.origin=r;this.binding=o;this.keys=n;this.trust=i;this.onRecipientAccess=s}api;origin;binding;keys;trust;onRecipientAccess;verifiedKeys;exclusions=new Map;pendingExclusions=new Map;async trusted(e){if(!await this.verifies(e)){let r=e.principalId===this.binding.principalId?this.binding:await this.known(e.principalId);if(r&&e.principalId!==this.binding.principalId&&e.generation>r.generation&&await this.connectedKeys(r,e)){let o=new Date().toISOString();try{await this.changeKeyring(n=>[...n.filter(i=>i.binding.principalId!==e.principalId),{binding:e,verifiedAt:o}])}catch(n){if(!I0(n,401,403))throw n}return(await this.keyring()).set(e.principalId,{binding:e,verifiedAt:o}),await this.trust.rememberBinding(e),e}throw e.principalId!==this.binding.principalId&&await this.known(e.principalId)?new Wr("identity_changed","Identity "+e.principalId+" replaced the keys verified before. Verify its current keys."):new Wr("identity_untrusted","Verify and trust the encryption and signing keys for identity "+e.principalId+" before sharing.")}return e}async connectedKeys(e,r){if(e.principalId!==r.principalId||r.generation-e.generation>32)return!1;let o=e;for(;o.generation<r.generation;){let{replacement:n}=await this.api.json("/api/identities/"+E.parse(r.principalId)+"/key-replacements/"+E.parse(o.id),{},h.object({replacement:r0.nullable()}));if(!n||!await _g(o,n.replacement.binding,[n]))return!1;o=n.replacement.binding}return M(o)===M(r)}async verifies(e){if(e.principalId===this.binding.principalId)return M(this.binding)===M(e);let r=await this.known(e.principalId);return!!r&&M(r)===M(e)}async known(e){return(await this.keyring()).get(e)?.binding??await this.trust.binding(e)}async verifiedIdentity(e){return this.verifies((await this.inspectIdentity(e)).binding)}keyring(){return this.verifiedKeys??=this.loadKeyring().catch(e=>{throw this.verifiedKeys=void 0,e})}async loadKeyring(){let e;try{e=(await this.readKeyring()).keyring?.keys??[]}catch(i){if(I0(i,401,403))return new Map;throw i}let r=new Set(e.map(i=>i.binding.principalId)),o=new Date().toISOString(),n=(await this.trust.bindings()).filter(i=>i.principalId!==this.binding.principalId&&!r.has(i.principalId));if(n.length)try{e=(await this.changeKeyring(i=>[...i,...n.filter(s=>!i.some(a=>a.binding.principalId===s.principalId)).map(s=>({binding:s,verifiedAt:o}))])).keys}catch(i){if(i instanceof Wr)throw i}return new Map(e.map(i=>[i.binding.principalId,i]))}async readKeyring(){let e="/api/principals/"+this.binding.principalId+"/keyring",{keyring:r}=await this.api.json(e,{},xN),o=await this.trust.keyring(),n=()=>new Wr("keyring_conflict","The list of verified public keys does not match what this device saw before.");if(!r){if(o)throw n();return{version:null,revision:0,keyring:null}}let i=JK(r.signature);if(i.signerId!==this.binding.id)return{version:r.version,revision:i.revision,keyring:null};let s=await s0(r.signature,this.binding).catch(()=>{throw n()}),a=await vt(s);if(s.ownerId!==this.binding.principalId||s.origin!==this.origin||o&&(s.revision<o.revision||s.revision===o.revision&&a!==o.digest))throw n();return(!o||s.revision>o.revision)&&await this.trust.rememberKeyring({revision:s.revision,digest:a}),{version:r.version,revision:s.revision,keyring:s}}async changeKeyring(e){for(let r=1;;r++){let o=await this.readKeyring(),n={origin:this.origin,ownerId:this.binding.principalId,signerId:this.binding.id,revision:o.revision+1,keys:e(o.keyring?.keys??[])};try{await this.api.json("/api/principals/"+this.binding.principalId+"/keyring",{method:"PUT",body:{version:o.version,signature:await i0(n,this.keys.signing)}},xN)}catch(i){if(r<3&&I0(i,"changed"))continue;throw i}return await this.trust.rememberKeyring({revision:n.revision,digest:await vt(n)}),n}}async inspectIdentity(e){let r=await this.api.json("/api/identities/"+E.parse(e)+"/binding",{},er);return await fp(r),{...r,fingerprint:await ic(r.binding)}}async trustIdentity(e,r){let o=await this.inspectIdentity(e);if(o.fingerprint!==r)throw new Wr("fingerprint_mismatch","The identity fingerprint does not match.");if(e===this.binding.principalId||M((await this.keyring()).get(e)?.binding??null)===M(o.binding))return o;let n=new Date().toISOString();try{let i=await this.changeKeyring(s=>[...s.filter(a=>a.binding.principalId!==e),{binding:o.binding,verifiedAt:n}]);this.verifiedKeys=Promise.resolve(new Map(i.keys.map(s=>[s.binding.principalId,s])))}catch(i){if(!I0(i,401,403))throw i;await this.trust.rememberBinding(o.binding)}return o}async recipients(e){let{items:r}=await this.api.json("/api/principals/"+E.parse(e)+"/bound-recipients",{},Qt(Ng)),o=await this.api.json("/api/principals/"+e+"/bound-delegates",{},Qt(Ng));return this.verifiedRecipients(e,r,o.items)}async verifiedRecipients(e,r,o){if(!r.length)throw new Error("Set up an encryption key for the owner before saving private content.");for(let{name:s,...a}of r){await fp(a);try{await this.trusted(a.binding)}catch(c){throw!(c instanceof Wr)||c.code!=="identity_untrusted"&&c.code!=="identity_changed"?c:new zg({id:a.binding.principalId,name:s,code:c.code})}}let n=[],i=[];for(let{name:s,...a}of o){await fp(a);try{n.push(await this.trusted(a.binding))}catch(c){if(!(c instanceof Wr)||c.code!=="identity_untrusted"&&c.code!=="identity_changed")throw c;i.push({id:a.binding.principalId,name:s,code:c.code})}}return this.exclusions.set(e,i),[...r.map(s=>s.binding),...n]}async ownerRecipients(e,r){let o=new Map([...await this.recipients(e),this.binding].map(s=>[s.principalId,s])),n=new Set(this.exclusions.get(e)?.map(s=>s.id)),i=s=>[...new Map([...s.filter(a=>!n.has(a.principalId)).map(a=>o.get(a.principalId)??a),...o.values()].map(a=>[a.principalId,a])).values()];return{readers:i(r?.readers??[]),authorities:i(r?.authorities??[])}}async ownerSide(e){let r=await this.recipients(e);return new Set([...r.map(o=>o.principalId),...(this.exclusions.get(e)??[]).map(o=>o.id)])}async refreshRecipients(e){let r=await this.ownerRecipients(e.ownerId,e),o=M(r)!==M({readers:e.readers,authorities:e.authorities});return{...e,...r,revision:e.revision+(o?1:0)}}async read(e){let r=await this.latest(e);if(r.replaced)throw new Wr("key_replaced","This item is sealed only for keys this identity has since replaced. Enter its value again.");return r}async latest(e){let r=await this.api.json("/api/custody/"+E.parse(e),{},hZ);return this.replaces(r.content.policy)?{...r,replaced:!0}:(await this.observe(r.content,e),{...r,replaced:!1})}replaces(e){return!e.readers.some(r=>M(r)===M(this.binding))&&e.readers.some(r=>r.principalId===this.binding.principalId)}async observe(e,r=e.policy.id){let o=await ac(e);if(o.policy.id!==r||o.policy.origin!==this.origin)throw new Error("The encrypted content belongs to another item.");let n=_N(o);await this.trusted(n);let i=await this.trust.checkpoint(o);if(i&&Wn.parse(i.policy),i){if(o.policy.revision<i.policy.revision||o.materialRevision<i.materialRevision||o.policy.revision===i.policy.revision&&M(o.policy)!==M(i.policy)||o.materialRevision===i.materialRevision&&await vt(o)!==i.digest)throw new Wr("content_conflict","The encrypted content is older than this device has already observed.");if(o.policy.revision>i.policy.revision&&!qK(i.policy,o)&&!i.policy.authorities.some(s=>s.principalId===n.principalId&&s.id!==n.id))throw new Wr("content_conflict","An existing policy authority must approve the new recipients.")}return await this.trust.rememberContent(o),o}async reveal(e){return Jn((await this.read(e)).content,this.binding,this.keys.encryption)}async connection(e){let{content:r}=await this.read(e),o=await Jn(r,this.binding,this.keys.encryption),n=cc(await this.api.json("/api/connections/"+E.parse(e)+"/method",{},ii));return k0(o,r.metadata,n)}async sharing(e){let r=typeof e=="string"?(await this.api.json(e,{},Qt(yZ))).items:e,o={};for(let n of r){let i=await this.read(n.id);if(i.version!==n.version||M(i.content)!==M(n.content))throw new Wr("content_conflict","Review the current content before changing its readers.");for(let s of n.policy.readers)await this.trusted(s);o[n.id]={version:n.version,content:await wp(await Jn(i.content,this.binding,this.keys.encryption),n.policy,i.content.materialRevision+1,this.binding,this.keys,i.content.metadata,i.content)}}return o}async policy(e,r,o={}){let{readers:n,authorities:i}=await this.ownerRecipients(e,o.previous);if(!n.some(s=>M(s)===M(this.binding)))throw new Error("Include your own identity as a reader before creating this item.");return Wn.parse({format:3,id:o.id??o.previous?.id??o.replacing?.id??crypto.randomUUID(),origin:this.origin,ownerId:e,contentType:r,revision:(o.previous?.revision??o.replacing?.revision??0)+1,authorities:i,readers:n,...o.previous?.observers?{observers:o.previous.observers}:{}})}async save(e,r,o,n={}){let i=n.previous;i&&M(o)===M({...i.content.policy,revision:o.revision})&&(o={...o,revision:i.content.policy.revision});let s=await wp(r,o,(i?.content.materialRevision??0)+1,this.binding,this.keys,n.metadata,i&&!this.replaces(i.content.policy)?i.content:void 0),a={name:e,content:s,...n.labels?{labels:n.labels}:{},...i?{version:i.version}:{}},c=n.commit?await n.commit(a):await this.api.json("/api/resources/"+o.id+"/custody",{method:"PUT",body:a},mt);return await this.trust.rememberContent(s),this.onRecipientAccess?.({id:c.id,name:c.name,excluded:this.exclusions.get(o.ownerId)??[]}),c}async transferProtected(e,r){let o="/api/resources/"+e.id+"/transfer",n=await this.read(e.id);if(n.version!==e.version)throw new Wr("changed","This item changed. Reload it before transferring it.");let i=await this.api.json(o+"-recipients?to="+encodeURIComponent(r),{},mZ),s=await this.verifiedRecipients(r,i.required,i.delegates),a={...n.content.policy,ownerId:r,revision:n.content.policy.revision+1,readers:s,authorities:s,observers:[]},c=await wp(await Jn(n.content,this.binding,this.keys.encryption),a,n.content.materialRevision+1,this.binding,this.keys,n.content.metadata,n.content),u=await this.api.json(o,{method:"POST",body:{to:r,content:c,version:n.version}},h.union([mt,Br]));return"kind"in u&&await this.trust.rememberContent(c),this.onRecipientAccess?.({id:u.id,name:e.name,operation:"transfer",excluded:this.exclusions.get(r)??[]}),"kind"in u?u:{...u,url:u.url+(u.url.includes("#")?"&":"#")+"fingerprint="+await ic(this.binding)}}async pendingProtection(){return(await this.api.json("/api/principals/"+this.binding.principalId+"/reprotection",{},Qt(gZ))).items}async reprotect(e,r=[]){let o=await this.read(e),{policy:n}=o.content,i={...n,...await this.resealed(e,n,new Set(r))};if(M({...i,revision:n.revision})===M(n))return null;let s=await this.api.json("/api/resources/"+n.id,{},mt);return this.save(s.name,await Jn(o.content,this.binding,this.keys.encryption),i,{metadata:o.content.metadata,previous:o})}async resealed(e,r,o){let n=await this.recipients(r.ownerId),i=this.exclusions.get(r.ownerId)??[];this.pendingExclusions.set(e,i);for(let m of i)o.add(m.id);let s=new Map(n.map(m=>[m.principalId,m])),a=[...r.readers,...r.authorities];for(let m of new Set(a.map(g=>g.principalId))){if(m===this.binding.principalId||s.has(m)||o.has(m))continue;let g=await this.inspectIdentity(m).then(y=>y.binding,()=>null);g&&a.some(y=>y.principalId===m&&y.id!==g.id)&&s.set(m,await this.trusted(g))}let c=m=>s.get(m.principalId)??m,u=m=>[...new Map(m.map(g=>[g.id,g])).values()],l=m=>!o.has(m.principalId),d=u(r.readers.filter(l).map(c)),f=u(r.authorities.filter(l).map(c)),p=n.filter(m=>!d.some(g=>g.id===m.id));return{revision:r.revision+1,readers:[...d,...p],authorities:[...f,...p.filter(m=>!f.some(g=>g.id===m.id))],...r.observers?{observers:r.observers.filter(m=>!o.has(m))}:{}}}async reprotectPending(e){let r=[],o=[],n=await this.pendingProtection(),i=0;e?.({completed:i,total:n.length});for(let a of n){try{await this.reprotect(a.id,a.remove)&&r.push(a.id);let c=this.pendingExclusions.get(a.id);c?.length&&o.push({id:a.id,code:"recipient_excluded",verification:c})}catch(c){o.push({id:a.id,code:c&&typeof c=="object"&&"code"in c&&typeof c.code=="string"?c.code:"failure"})}e?.({completed:++i,total:n.length})}let s=await this.endorseKeyRotations();return{done:[...r,...s.done],failed:[...o,...s.failed]}}async endorseKeyRotations(){let e=[],r=[],{items:o}=await this.api.json("/api/key-rotations/requests",{},h.object({items:h.array(eq)}));for(let n of o)try{let{rotation:i}=n,s=i.previous.binding,a=i.replacement.binding;if(await this.trusted(s),!await _g(s,a,[{previous:i.previous,replacement:i.replacement,previousSignature:i.previousSignature}]))throw new Wr("identity_changed","The replacement keys were not signed with the verified keys.");await this.api.json("/api/principals/"+E.parse(i.principalId)+"/key-rotations/"+E.parse(i.id)+"/items/"+n.kind+"/"+E.parse(n.id)+"/endorsement",{method:"PUT",body:{sourceDigest:n.sourceDigest,payload:await sq(n,this.binding,this.keys)}}),e.push(n.id)}catch(i){r.push({id:n.id,code:i&&typeof i=="object"&&"code"in i&&typeof i.code=="string"?i.code:"failure"})}return{done:e,failed:r}}async sourceContents(e){let r=new Map;for(let o of new Set(e))r.set(o,(await this.read(o)).content);for(let o of[...r.values()])o.policy.contentType===kt.tokenSet&&typeof o.metadata.appId=="string"&&!r.has(o.metadata.appId)&&r.set(o.metadata.appId,(await this.read(o.metadata.appId)).content);return[...r.values()]}};var A0=class{constructor(e){this.journal=e}journal;binding(e){return this.journal.read("identity_"+e)}async bindings(){return(await Promise.all((await this.journal.keys("identity_")).map(r=>this.journal.read(r)))).filter(r=>r!==null)}async rememberBinding(e){await hp(e),await this.journal.write("identity_"+e.principalId,e)}keyring(){return this.journal.read("checkpoint_keyring")}async rememberKeyring(e){await this.journal.write("checkpoint_keyring",e)}checkpoint(e){return this.journal.read("checkpoint_"+e.policy.format+"_"+e.policy.id)}async rememberContent(e){await this.journal.write("checkpoint_"+e.policy.format+"_"+e.policy.id,{policy:e.policy,materialRevision:e.materialRevision,digest:await vt(e)})}};var T0=class{api;constructor(e){this.api={async json(r,o={},n){try{return await e.json(r,o,n)}catch(i){throw i instanceof Error&&"status"in i&&typeof i.status=="number"&&"code"in i&&typeof i.code=="string"?new Er(i.status,i.code,i.message):i}}}}connections(){let e=this.api;return{method:async r=>cc(await e.json("/api/connections/"+r+"/method",{},ii)),prepare:(r,o,n)=>e.json("/api/connection-operations",{method:"POST",body:{id:r,resourceId:o,expectedRevision:n}},Dg),dispatch:(r,o)=>e.json("/api/connection-operations/"+r+"/dispatch",{method:"POST",body:{fence:o}},Dg),commit:(r,o,n)=>e.json("/api/connection-operations/"+r+"/commit",{method:"POST",body:{fence:o,content:n}},Hr),uncertain:(r,o)=>e.json("/api/connection-operations/"+r+"/uncertain",{method:"POST",body:{fence:o}}),abort:(r,o)=>e.json("/api/connection-operations/"+r+"/abort",{method:"POST",body:{fence:o}},Dg),state:r=>e.json("/api/connections/"+r+"/operation",{},Dg.nullable())}}};import{randomUUID as tRe}from"node:crypto";var Aa=St(doe(),1);import{randomUUID as WTe}from"node:crypto";function poe(t){let e=Lx.safeParse({accountId:t.Account,arn:t.Arn,principalId:t.Arn?.includes(":assumed-role/")?t.UserId?.split(":")[0]:t.UserId});return(!e.success||e.data.arn.split(":")[4]!==e.data.accountId)&&C(502,"invalid_response","The AWS account could not be verified."),e.data}function foe(t,e){return t.accountId===e.accountId&&t.principalId===e.principalId&&lp(t.arn)===lp(e.arn)}function a4(t){t&&(!Number.isFinite(t.getTime())||t.getTime()<=Date.now())&&C(409,"reconnect_required","Reconnect with current AWS credentials.")}var G$=class{async obtain(e,r,o){let n=aa.parse({authentication:e.authentication,region:e.region,...e.role?{role:e.role}:{}}),i=n.authentication,s=i.kind==="environment"?void 0:{accessKeyId:i.accessKeyId,secretAccessKey:i.secretAccessKey,...i.kind==="session"?{sessionToken:i.sessionToken,expiration:new Date(i.expiresAt)}:{}};a4(s?.expiration);let a=new Aa.STSClient({region:n.region,...s?{credentials:s}:{}}),c,u=AbortSignal.any([AbortSignal.timeout(2e4),...o?[o]:[]]),l=!1;try{let d=s??await a.config.credentials();a4(d.expiration),c=new Aa.STSClient({region:n.region,credentials:d});let f=r?.sourceIdentity?poe(await c.send(new Aa.GetCallerIdentityCommand({}),{abortSignal:u})):void 0;r?.sourceIdentity&&f&&!foe(f,r.sourceIdentity)&&C(409,"account_changed","Reconnect to approve the current AWS authentication source.");let p=d,m=f;if(n.role){l=!0;let w=(await c.send(new Aa.AssumeRoleCommand({RoleArn:n.role.arn,RoleSessionName:"foundation-"+WTe().slice(0,8),DurationSeconds:3600,...n.role.externalId?{ExternalId:n.role.externalId}:{}}),{abortSignal:u})).Credentials;(!w?.AccessKeyId||!w.SecretAccessKey||!w.SessionToken||!w.Expiration)&&C(502,"invalid_response","AWS did not return credentials."),p={accessKeyId:w.AccessKeyId,secretAccessKey:w.SecretAccessKey,sessionToken:w.SessionToken,expiration:w.Expiration},a4(p.expiration),r?.identity&&(c.destroy(),c=new Aa.STSClient({region:n.region,credentials:p}),m=poe(await c.send(new Aa.GetCallerIdentityCommand({}),{abortSignal:u})))}return r?.identity&&m&&!foe(m,r.identity)&&C(409,"account_changed","Reconnect to approve the current AWS account and role."),{state:Fx.parse({...n,sourceIdentity:f,identity:m}),credentials:{AWS_ACCESS_KEY_ID:p.accessKeyId,AWS_SECRET_ACCESS_KEY:p.secretAccessKey,AWS_SESSION_TOKEN:p.sessionToken??"",AWS_DEFAULT_REGION:n.region,AWS_REGION:n.region}}}catch(d){if(d instanceof Er)throw d;o?.aborted&&C(409,"cancelled","The operation was cancelled."),d instanceof Error&&["ExpiredToken","ExpiredTokenException","TokenRefreshRequired"].includes(d.name)&&C(409,"reconnect_required","Reconnect with current AWS credentials."),l&&C(502,"role_denied","Check the IAM role and its trust policy for this authentication source."),C(502,"aws_authentication_failed","Check the AWS credentials available on this machine.")}finally{c?.destroy(),a.destroy()}}};var X$=class{constructor(e){this.aws=e}aws;facts=TN;needsRenewal(){return!1}async outputs(e,r,o){return(await this.aws.obtain(e.aws,e.aws,o)).credentials}};var c4;(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(c4="oauth4webapi/v3.8.8");function rA(t,e){if(t==null)return!1;try{return t instanceof e||Object.getPrototypeOf(t)[Symbol.toStringTag]===e.prototype[Symbol.toStringTag]}catch{return!1}}var Bs="ERR_INVALID_ARG_VALUE",Ta="ERR_INVALID_ARG_TYPE";function sr(t,e,r){let o=new TypeError(t,{cause:r});return Object.assign(o,{code:e}),o}var goe=Symbol(),JTe=Symbol(),GTe=Symbol(),y4=Symbol();var Fv=Symbol();var XTe=new TextEncoder,YTe=new TextDecoder;function u4(t){return typeof t=="string"?XTe.encode(t):YTe.decode(t)}var l4;Uint8Array.prototype.toBase64?l4=t=>(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t.toBase64({alphabet:"base64url",omitPadding:!0})):l4=e=>{e instanceof ArrayBuffer&&(e=new Uint8Array(e));let r=[];for(let o=0;o<e.byteLength;o+=32768)r.push(String.fromCharCode.apply(null,e.subarray(o,o+32768)));return btoa(r.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")};var d4;Uint8Array.fromBase64?d4=t=>{try{return Uint8Array.fromBase64(t,{alphabet:"base64url"})}catch(e){throw sr("The input to be decoded is not correctly encoded.",Bs,e)}}:d4=t=>{try{let e=atob(t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);return r}catch(e){throw sr("The input to be decoded is not correctly encoded.",Bs,e)}};function p4(t){return typeof t=="string"?d4(t):l4(t)}var Gf=class extends Error{code;constructor(e,r){super(e,r),this.name=this.constructor.name,this.code=PPe,Error.captureStackTrace?.(this,this.constructor)}},Vv=class extends Error{code;constructor(e,r){super(e,r),this.name=this.constructor.name,r?.code&&(this.code=r?.code),Error.captureStackTrace?.(this,this.constructor)}};function ve(t,e,r){return new Vv(t,{code:e,cause:r})}function Y$(t){return!(t===null||typeof t!="object"||Array.isArray(t))}function yoe(t){rA(t,Headers)&&(t=Object.fromEntries(t.entries()));let e=new Headers(t??{});if(c4&&!e.has("user-agent")&&e.set("user-agent",c4),e.has("authorization"))throw sr('"options.headers" must not include the "authorization" header name',Bs);return e}function QTe(t,e){if(e!==void 0){if(typeof e=="function"&&(e=e(t.href)),!(e instanceof AbortSignal))throw sr('"options.signal" must return or be an instance of AbortSignal',Ta);return e}}function Xf(t,e,r,o,n){try{if(typeof t!="number"||!Number.isFinite(t))throw sr(`${r} must be a number`,Ta,n);if(t>0)return;if(e){if(t!==0)throw sr(`${r} must be a non-negative number`,Bs,n);return}throw sr(`${r} must be a positive number`,Bs,n)}catch(i){throw o?ve(i.message,o,n):i}}function Gt(t,e,r,o){try{if(typeof t!="string")throw sr(`${e} must be a string`,Ta,o);if(t.length===0)throw sr(`${e} must not be empty`,Bs,o)}catch(n){throw r?ve(n.message,r,o):n}}function voe(t){tPe(t,"application/json")}function ePe(t,...e){let r='"response" content-type must be ';if(e.length>2){let o=e.pop();r+=`${e.join(", ")}, or ${o}`}else e.length===2?r+=`${e[0]} or ${e[1]}`:r+=e[0];return ve(r,CPe,t)}function tPe(t,e){if(hPe(t)!==e)throw ePe(t,e)}async function woe(t){return Gt(t,"codeVerifier"),p4(await crypto.subtle.digest("SHA-256",u4(t)))}function boe(t){let e=t?.[JTe];return typeof e=="number"&&Number.isFinite(e)?e:0}function _oe(t){let e=t?.[GTe];return typeof e=="number"&&Number.isFinite(e)&&Math.sign(e)!==-1?e:30}function Soe(){return Math.floor(Date.now()/1e3)}function au(t){if(typeof t!="object"||t===null)throw sr('"as" must be an object',Ta);Gt(t.issuer,'"as.issuer"')}function cu(t){if(typeof t!="object"||t===null)throw sr('"client" must be an object',Ta);Gt(t.client_id,'"client.client_id"')}function moe(t){return encodeURIComponent(t).replace(/(?:[-_.!~*'()]|%20)/g,e=>{switch(e){case"-":case"_":case".":case"!":case"~":case"*":case"'":case"(":case")":return`%${e.charCodeAt(0).toString(16).toUpperCase()}`;case"%20":return"+";default:throw new Error}})}function xoe(t){return Gt(t,'"clientSecret"'),(e,r,o,n)=>{o.set("client_id",r.client_id),o.set("client_secret",t)}}function Eoe(t){return Gt(t,'"clientSecret"'),(e,r,o,n)=>{let i=moe(r.client_id),s=moe(t),a=btoa(`${i}:${s}`);n.set("authorization",`Basic ${a}`)}}function koe(){return(t,e,r,o)=>{r.set("client_id",e.client_id)}}var rPe=URL.parse?(t,e)=>URL.parse(t,e):(t,e)=>{try{return new URL(t,e)}catch{return null}};function nPe(t,e){if(e&&t.protocol!=="https:")throw ve("only requests to HTTPS are allowed",NPe,t);if(t.protocol!=="https:"&&t.protocol!=="http:")throw ve("only HTTP and HTTPS requests are allowed",DPe,t)}function hoe(t,e,r,o){let n;if(typeof t!="string"||!(n=rPe(t)))throw ve(`authorization server metadata does not contain a valid ${r?`"as.mtls_endpoint_aliases.${e}"`:`"as.${e}"`}`,t===void 0?zPe:jPe,{attribute:r?`mtls_endpoint_aliases.${e}`:e});return nPe(n,o),n}function Ioe(t,e,r,o){return r&&t.mtls_endpoint_aliases&&e in t.mtls_endpoint_aliases?hoe(t.mtls_endpoint_aliases[e],e,r,o):hoe(t[e],e,r,o)}var f4=class extends Error{cause;code;error;status;error_description;response;constructor(e,r){super(e,r),this.name=this.constructor.name,this.code=TPe,this.cause=r.cause,this.error=r.cause.error,this.status=r.response.status,this.error_description=r.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:r.response}),Error.captureStackTrace?.(this,this.constructor)}},Hv=class extends Error{cause;code;error;error_description;constructor(e,r){super(e,r),this.name=this.constructor.name,this.code=RPe,this.cause=r.cause,this.error=r.cause.get("error"),this.error_description=r.cause.get("error_description")??void 0,Error.captureStackTrace?.(this,this.constructor)}},m4=class extends Error{cause;code;response;status;constructor(e,r){super(e,r),this.name=this.constructor.name,this.code=APe,this.cause=r.cause,this.status=r.response.status,this.response=r.response,Object.defineProperty(this,"response",{enumerable:!1}),Error.captureStackTrace?.(this,this.constructor)}},Q$="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",oPe="[a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2}",iPe='"((?:[^"\\\\]|\\\\[\\s\\S])*)"',sPe="("+Q$+")\\s*=\\s*"+iPe,aPe="("+Q$+")\\s*=\\s*("+Q$+")",cPe=new RegExp("^[,\\s]*("+Q$+")"),uPe=new RegExp("^[,\\s]*"+sPe+"[,\\s]*(.*)"),lPe=new RegExp("^[,\\s]*"+aPe+"[,\\s]*(.*)"),dPe=new RegExp("^("+oPe+")(?:$|[,\\s])(.*)");function pPe(t){if(!rA(t,Response))throw sr('"response" must be an instance of Response',Ta);let e=t.headers.get("www-authenticate");if(e===null)return;let r=[],o=e;for(;o;){let n=o.match(cPe),i=n?.[1].toLowerCase();if(!i)return;let s=o.substring(n[0].length);if(s&&!s.match(/^[\s,]/))return;let a=s.match(/^\s+(.*)$/),c=!!a;o=a?a[1]:void 0;let u={},l;if(c)for(;o;){let f,p;if(n=o.match(uPe)){[,f,p,o]=n,p.includes("\\")&&(p=p.replace(/\\([\s\S])/g,"$1")),u[f.toLowerCase()]=p;continue}if(n=o.match(lPe)){[,f,p,o]=n,u[f.toLowerCase()]=p;continue}if(n=o.match(dPe)){if(Object.keys(u).length)break;[,l,o]=n;break}return}else o=s||void 0;let d={scheme:i,parameters:u};l&&(d.token68=l),r.push(d)}if(r.length)return r}async function fPe(t){if(t.status>399&&t.status<500){b4(t),voe(t);try{let e=await t.clone().json();if(Y$(e)&&typeof e.error=="string"&&e.error.length)return e}catch{}}}async function $oe(t,e,r){if(t.status!==e){yPe(t);let o;throw(o=await fPe(t))?(await t.body?.cancel(),new f4("server responded with an error in the response body",{cause:o,response:t})):ve(`"response" is not a conform ${r} response (unexpected HTTP status code)`,OPe,t)}}function mPe(t){if(!v4.has(t))throw sr('"options.DPoP" is not a valid DPoPHandle',Bs)}function hPe(t){return t.headers.get("content-type")?.split(";")[0]}async function Aoe(t,e,r,o,n,i,s){return await r(t,e,n,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),(s?.[y4]||fetch)(o.href,{body:n,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:QTe(o,s?.signal)})}async function nA(t,e,r,o,n,i){let s=Ioe(t,"token_endpoint",e.use_mtls_endpoint_aliases,i?.[goe]!==!0);n.set("grant_type",o);let a=yoe(i?.headers);a.set("accept","application/json"),i?.DPoP!==void 0&&(mPe(i.DPoP),await i.DPoP.addProof(s,a,"POST"));let c=await Aoe(t,e,r,s,n,a,i);return i?.DPoP?.cacheNonce(c,s),c}async function Toe(t,e,r,o,n){au(t),cu(e),Gt(o,'"refreshToken"');let i=new URLSearchParams(n?.additionalParameters);return i.set("refresh_token",o),nA(t,e,r,"refresh_token",i,n)}var Poe=new WeakMap,gPe=new WeakMap;function Roe(t){if(!t.id_token)return;let e=Poe.get(t);if(!e)throw sr('"ref" was already garbage collected or did not resolve from the proper sources',Bs);return e}async function Bv(t,e,r,o,n,i){if(au(t),cu(e),!rA(r,Response))throw sr('"response" must be an instance of Response',Ta);await $oe(r,200,"Token Endpoint"),b4(r);let s=await qoe(r);if(Gt(s.access_token,'"response" body "access_token" property',Me,{body:s}),Gt(s.token_type,'"response" body "token_type" property',Me,{body:s}),s.token_type=s.token_type.toLowerCase(),s.expires_in!==void 0){let a=typeof s.expires_in!="number"?parseFloat(s.expires_in):s.expires_in;Xf(a,!0,'"response" body "expires_in" property',Me,{body:s}),s.expires_in=a}if(s.refresh_token!==void 0&&Gt(s.refresh_token,'"response" body "refresh_token" property',Me,{body:s}),s.scope!==void 0&&typeof s.scope!="string")throw ve('"response" body "scope" property must be a string',Me,{body:s});if(s.id_token!==void 0){Gt(s.id_token,'"response" body "id_token" property',Me,{body:s});let a=[];e.require_auth_time===!0&&a.push("auth_time"),e.default_max_age!==void 0&&(Xf(e.default_max_age,!0,'"client.default_max_age"'),a.push("auth_time")),o?.length&&a.push(...o);let{claims:c,jwt:u}=await xPe(t,e,s.id_token,a,n);kPe(e,c),EPe(c),gPe.set(r,u),Poe.set(s,c)}if(i?.[s.token_type]!==void 0)i[s.token_type](r,s);else if(s.token_type!=="dpop"&&s.token_type!=="bearer")throw new Gf("unsupported `token_type` value",{cause:{body:s}});return s}function yPe(t){let e;if(e=pPe(t))throw new m4("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:e,response:t})}async function Coe(t,e,r,o){return Bv(t,e,r,void 0,o?.[Fv],o?.recognizedTokenTypes)}function vPe(t,e){if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(t))throw ve('unexpected JWT "aud" (audience) claim value',Yf,{expected:t,claims:e.claims,claim:"aud"})}else if(e.claims.aud!==t)throw ve('unexpected JWT "aud" (audience) claim value',Yf,{expected:t,claims:e.claims,claim:"aud"});return e}function wPe(t,e){let r=t[VPe]?.(e)??t.issuer;if(e.claims.iss!==r)throw ve('unexpected JWT "iss" (issuer) claim value',Yf,{expected:r,claims:e.claims,claim:"iss"});return e}var v4=new WeakSet;function bPe(t){return v4.add(t),t}var w4=Symbol();async function Ooe(t,e,r,o,n,i,s){if(au(t),cu(e),!v4.has(o))throw sr('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Bs);Gt(n,'"redirectUri"');let a=Ul(o,"code");if(!a)throw ve('no authorization code in "callbackParameters"',Me);let c=new URLSearchParams(s?.additionalParameters);return c.set("redirect_uri",n),c.set("code",a),i!==w4&&(Gt(i,'"codeVerifier"'),c.set("code_verifier",i)),nA(t,e,r,"authorization_code",c,s)}var Noe={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function _Pe(t,e){for(let r of t)if(e.claims[r]===void 0)throw ve(`JWT "${r}" (${Noe[r]}) claim missing`,Me,{claims:e.claims});return e}function SPe(t,e){if(typeof e.claims[t]!="string")throw ve(`unexpected JWT "${t}" (${Noe[t]}) claim type`,Me,{claims:e.claims});return e}function xPe(t,e,r,o,n){return MPe(r,UPe.bind(void 0,e.id_token_signed_response_alg,t.id_token_signing_alg_values_supported,"RS256"),boe(e),_oe(e),n).then(_Pe.bind(void 0,["aud","exp","iat","iss","sub",...o])).then(wPe.bind(void 0,t)).then(vPe.bind(void 0,e.client_id)).then(SPe.bind(void 0,"sub"))}function Doe(t,e){if(e===tA)return e;let r=e===void 0;return r&&(e=t.default_max_age),e===void 0?tA:(Xf(e,!0,r?'"client.default_max_age"':'"maxAge" argument'),e)}function EPe(t){t.auth_time!==void 0&&Xf(t.auth_time,!0,'ID Token "auth_time" (authentication time)',Me,{claims:t})}function zoe(t,e,r){if(r===tA)return;let o=Soe()+boe(t),n=_oe(t);if(e.auth_time+r<o-n)throw ve("too much time has elapsed since the last End-User authentication",g4,{claims:e,now:o,tolerance:n,claim:"auth_time"})}function joe(t,e){let r=e===eA?void 0:e;if(t.nonce!==r)throw ve('unexpected ID Token "nonce" claim value',Yf,{expected:r,claims:t,claim:"nonce"})}function kPe(t,e){if(Array.isArray(e.aud)&&e.aud.length!==1){if(e.azp===void 0)throw ve('ID Token "aud" (audience) claim includes additional untrusted audiences',Yf,{claims:e,claim:"aud"});if(e.azp!==t.client_id)throw ve('unexpected ID Token "azp" (authorized party) claim value',Yf,{expected:t.client_id,claims:e,claim:"azp"})}}var eA=Symbol(),tA=Symbol();async function Moe(t,e,r,o){return typeof o?.expectedNonce=="string"||typeof o?.maxAge=="number"||o?.requireIdToken?IPe(t,e,r,o.expectedNonce,o.maxAge,o[Fv],o.recognizedTokenTypes):$Pe(t,e,r,o?.maxAge,o?.[Fv],o?.recognizedTokenTypes)}async function IPe(t,e,r,o,n,i,s){let a=[];switch(o){case void 0:o=eA;break;case eA:break;default:Gt(o,'"expectedNonce" argument'),a.push("nonce")}n=Doe(e,n),n!==tA&&a.push("auth_time");let c=await Bv(t,e,r,a,i,s);Gt(c.id_token,'"response" body "id_token" property',Me,{body:c});let u=Roe(c);return zoe(e,u,n),joe(u,o),c}async function $Pe(t,e,r,o,n,i){let s=await Bv(t,e,r,void 0,n,i),a=Roe(s);return a&&(zoe(e,a,Doe(e,o)),joe(a,eA)),s}var APe="OAUTH_WWW_AUTHENTICATE_CHALLENGE",TPe="OAUTH_RESPONSE_BODY_ERROR",PPe="OAUTH_UNSUPPORTED_OPERATION",RPe="OAUTH_AUTHORIZATION_RESPONSE_ERROR";var h4="OAUTH_PARSE_ERROR",Me="OAUTH_INVALID_RESPONSE";var CPe="OAUTH_RESPONSE_IS_NOT_JSON",OPe="OAUTH_RESPONSE_IS_NOT_CONFORM",NPe="OAUTH_HTTP_REQUEST_FORBIDDEN",DPe="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",g4="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",Yf="OAUTH_JWT_CLAIM_COMPARISON_FAILED";var zPe="OAUTH_MISSING_SERVER_METADATA",jPe="OAUTH_INVALID_SERVER_METADATA";async function Uoe(t,e,r,o,n){return au(t),cu(e),nA(t,e,r,"client_credentials",new URLSearchParams(o),n)}async function Loe(t,e,r,o){return Bv(t,e,r,void 0,o?.[Fv],o?.recognizedTokenTypes)}function b4(t){if(t.bodyUsed)throw sr('"response" body has been used already',Bs)}async function MPe(t,e,r,o,n){let{0:i,1:s,length:a}=t.split(".");if(a===5)if(n!==void 0)t=await n(t),{0:i,1:s,length:a}=t.split(".");else throw new Gf("JWE decryption is not configured",{cause:t});if(a!==3)throw ve("Invalid JWT",Me,t);let c;try{c=JSON.parse(u4(p4(i)))}catch(d){throw ve("failed to parse JWT Header body as base64url encoded JSON",h4,d)}if(!Y$(c))throw ve("JWT Header must be a top level object",Me,t);if(e(c),c.crit!==void 0)throw new Gf('no JWT "crit" header parameter extensions are supported',{cause:{header:c}});let u;try{u=JSON.parse(u4(p4(s)))}catch(d){throw ve("failed to parse JWT Payload body as base64url encoded JSON",h4,d)}if(!Y$(u))throw ve("JWT Payload must be a top level object",Me,t);let l=Soe()+r;if(u.exp!==void 0){if(typeof u.exp!="number")throw ve('unexpected JWT "exp" (expiration time) claim type',Me,{claims:u});if(u.exp<=l-o)throw ve('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',g4,{claims:u,now:l,tolerance:o,claim:"exp"})}if(u.iat!==void 0&&typeof u.iat!="number")throw ve('unexpected JWT "iat" (issued at) claim type',Me,{claims:u});if(u.iss!==void 0&&typeof u.iss!="string")throw ve('unexpected JWT "iss" (issuer) claim type',Me,{claims:u});if(u.nbf!==void 0){if(typeof u.nbf!="number")throw ve('unexpected JWT "nbf" (not before) claim type',Me,{claims:u});if(u.nbf>l+o)throw ve('unexpected JWT "nbf" (not before) claim value',g4,{claims:u,now:l,tolerance:o,claim:"nbf"})}if(u.aud!==void 0&&typeof u.aud!="string"&&!Array.isArray(u.aud))throw ve('unexpected JWT "aud" (audience) claim type',Me,{claims:u});return{header:c,claims:u,jwt:t}}function UPe(t,e,r,o){if(t!==void 0){if(typeof t=="string"?o.alg!==t:!t.includes(o.alg))throw ve('unexpected JWT "alg" header parameter',Me,{header:o,expected:t,reason:"client configuration"});return}if(Array.isArray(e)){if(!e.includes(o.alg))throw ve('unexpected JWT "alg" header parameter',Me,{header:o,expected:e,reason:"authorization server metadata"});return}if(r!==void 0){if(typeof r=="string"?o.alg!==r:typeof r=="function"?!r(o.alg):!r.includes(o.alg))throw ve('unexpected JWT "alg" header parameter',Me,{header:o,expected:r,reason:"default value"});return}throw ve('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:t,issuer:e,fallback:r})}function Ul(t,e){let{0:r,length:o}=t.getAll(e);if(o>1)throw ve(`"${e}" parameter must be provided only once`,Me);return r}var LPe=Symbol(),FPe=Symbol();function Foe(t,e,r,o){if(au(t),cu(e),r instanceof URL&&(r=r.searchParams),!(r instanceof URLSearchParams))throw sr('"parameters" must be an instance of URLSearchParams, or URL',Ta);if(Ul(r,"response"))throw ve('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Me,{parameters:r});let n=Ul(r,"iss"),i=Ul(r,"state");if(!n&&t.authorization_response_iss_parameter_supported)throw ve('response parameter "iss" (issuer) missing',Me,{parameters:r});if(n&&n!==t.issuer)throw ve('unexpected "iss" (issuer) response parameter value',Me,{expected:t.issuer,parameters:r});switch(o){case void 0:case FPe:if(i!==void 0)throw ve('unexpected "state" response parameter encountered',Me,{expected:void 0,parameters:r});break;case LPe:break;default:if(Gt(o,'"expectedState" argument'),i!==o)throw ve(i===void 0?'response parameter "state" missing':'unexpected "state" response parameter value',Me,{expected:o,parameters:r})}if(Ul(r,"error"))throw new Hv("authorization response from the server is an error",{cause:r});let a=Ul(r,"id_token"),c=Ul(r,"token");if(a!==void 0||c!==void 0)throw new Gf("implicit and hybrid flows are not supported");return bPe(new URLSearchParams(r))}async function Voe(t,e,r,o,n){au(t),cu(e);let i=Ioe(t,"device_authorization_endpoint",e.use_mtls_endpoint_aliases,n?.[goe]!==!0),s=new URLSearchParams(o);s.set("client_id",e.client_id);let a=yoe(n?.headers);return a.set("accept","application/json"),Aoe(t,e,r,i,s,a,n)}async function Hoe(t,e,r){if(au(t),cu(e),!rA(r,Response))throw sr('"response" must be an instance of Response',Ta);await $oe(r,200,"Device Authorization Endpoint"),b4(r);let o=await qoe(r);Gt(o.device_code,'"response" body "device_code" property',Me,{body:o}),Gt(o.user_code,'"response" body "user_code" property',Me,{body:o}),Gt(o.verification_uri,'"response" body "verification_uri" property',Me,{body:o});let n=typeof o.expires_in!="number"?parseFloat(o.expires_in):o.expires_in;return Xf(n,!0,'"response" body "expires_in" property',Me,{body:o}),o.expires_in=n,o.verification_uri_complete!==void 0&&Gt(o.verification_uri_complete,'"response" body "verification_uri_complete" property',Me,{body:o}),o.interval!==void 0&&Xf(o.interval,!1,'"response" body "interval" property',Me,{body:o}),o}async function Boe(t,e,r,o,n){au(t),cu(e),Gt(o,'"deviceCode"');let i=new URLSearchParams(n?.additionalParameters);return i.set("device_code",o),nA(t,e,r,"urn:ietf:params:oauth:grant-type:device_code",i,n)}async function Koe(t,e,r,o){return Bv(t,e,r,void 0,o?.[Fv],o?.recognizedTokenTypes)}async function qoe(t,e=voe){let r;try{r=await t.json()}catch(o){throw e(t),ve('failed to parse "response" body as JSON',h4,o)}if(!Y$(r))throw ve('"response" body must be a top level object',Me,{body:r});return r}var VPe=Symbol();var Qf=St(Woe(),1);var BPe=Qf.default.IPv6.parseCIDR("2000::/3"),KPe=new Set(["unicast","amt","as112","as112v6","orchid2","droneRemoteIdProtocolEntityTags"]);function sA(t){if(!Qf.default.isValid(t)||t.includes("%"))return!1;let e=Qf.default.parse(t);return KPe.has(e.range())&&(!(e instanceof Qf.default.IPv6)||e.match(BPe))}function co(t,e){let r;try{r=new URL(t)}catch{C(400,"invalid_url","Enter an absolute HTTPS URL.")}(r.protocol!=="https:"||r.username||r.password||r.hash||r.port&&r.port!=="443"||r.origin===e)&&C(400,"invalid_url","Choose a public HTTPS destination.");let o=r.hostname.replace(/^\[|\]$/g,"");return(o==="localhost"||o.endsWith(".localhost")||o.endsWith(".local")||Qf.default.isValid(o)&&!sA(o))&&C(400,"private_destination","Choose a public HTTPS destination."),r}function zi(t){let e;try{e=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(t.body))}catch{C(502,"invalid_response","The service returned an invalid response.")}return(!e||typeof e!="object"||Array.isArray(e))&&C(502,"invalid_response","The service returned an invalid response."),e}var iA=class{constructor(e){this.origin=e}origin;async send(e){let r=co(e.url,this.origin),o=e.maxBytes??1048576;e.body&&(typeof e.body=="string"?new TextEncoder().encode(e.body).length:e.body.length)>o&&C(413,"body_limit","The request body is too large.");let n;try{n=await fetch(r,{method:e.method??"GET",headers:e.headers,body:typeof e.body=="string"?e.body:e.body?new Uint8Array(e.body):void 0,credentials:"omit",redirect:"error",referrerPolicy:"no-referrer",signal:AbortSignal.any([AbortSignal.timeout(2e4),...e.signal?[e.signal]:[]])})}catch{e.signal?.aborted&&C(409,"cancelled","The operation was cancelled."),C(409,"browser_exchange_unavailable","Restart authorization using the CLI on this device.")}let i=n.body?.getReader(),s=[],a=0;if(i)try{for(;;){let l=await i.read();if(l.done)break;a+=l.value.length,a>o&&C(413,"body_limit","The response body is too large."),s.push(l.value)}}finally{await i.cancel()}let c=new Uint8Array(a),u=0;for(let l of s)c.set(l,u),u+=l.length;return{status:n.status,headers:Object.fromEntries(n.headers),body:c}}};var Joe=Object.assign(Object.create(null),{dpop:()=>C(502,"invalid_response","The service returned an unsupported token.")}),qPe={redirectUri:t=>t.fields.ruName,recognizedTokenTypes:Object.assign(Object.create(null),Joe,{"user access token":()=>{}})},ZPe={authorize(t,e){delete t.response_type,delete t.client_id,delete t.redirect_uri,t.callback_url=e,t.key_label="Foundation"},async exchange({spec:t,transport:e,url:r,authorization:o,verifier:n}){let i=o.parameters;return(i.getAll("state").length!==1||i.get("state")!==o.state||i.getAll("code").length!==1||!i.get("code"))&&C(400,"invalid_state","Start the connection again."),e.send({url:r(),method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({...t.tokenParams,code:i.get("code"),code_verifier:n,code_challenge_method:"S256"})})},accessTokenField:"key"},WPe={tokenParameters(t){let e=t.get("redirect_uri");e!==null&&(t.set("redirect_url",e),t.delete("redirect_uri"))}};function Pa(t,e){let r=e?new URL(e):void 0;return{recognizedTokenTypes:Joe,...t.adapter==="github"?{normalizeToken(o){typeof o.scope=="string"&&(o.scope=o.scope.split(",").map(n=>n.trim()).join(t.scopes.separator))}}:{},...r?.hostname.endsWith(".myshopify.com")&&r.pathname==="/admin/oauth/access_token"?{normalizeToken(o){o.token_type===void 0&&(o.token_type="bearer")},...t.grantType==="client_credentials"?{clientCredentialsParameters(){return{...t.tokenParams}}}:{}}:{},...r?.hostname==="api.notion.com"&&r.pathname==="/v1/oauth/token"?{normalizeToken(o){o.refresh_token===null&&delete o.refresh_token}}:{},...t.adapter==="ebay"?qPe:t.adapter==="openrouter"?ZPe:t.adapter==="vultr"?WPe:{}}}function Ra(t,e){try{return co(new cZ(t).expand(e)).href}catch{C(400,"invalid_service_url","Check the service URL and its required fields.")}}var Goe=(t,e=" ")=>typeof t=="string"?[...new Set(t.split(e).filter(Boolean))].sort():[],Ll=t=>{let e=typeof t=="number"||typeof t=="string"?Number(t):NaN;return(!Number.isSafeInteger(e)||e<=0||e>315576e3)&&C(502,"invalid_response","The service returned an invalid expiry."),e};var Kv=h.object({deviceCode:h.string().min(1).max(16384),userCode:h.string().min(1).max(1e3),verificationUri:h.url(),verificationUriComplete:h.url().optional(),expiresAt:h.number().int().positive(),intervalSeconds:h.number().int().positive(),nextPollAt:h.number().int().positive()}).strict();var Ks=class{constructor(e){this.transport=e}transport;appValues(e,r){try{return{...ns(e.fields,r.fields,e.defaults),clientId:r.clientId}}catch(o){throw o instanceof rs&&C(400,o.code,o.message),o}}async authorize(e,r,o,n,i,s){(e.grantType==="client_credentials"||e.grantType===Pn||!e.authorizeUrl)&&C(400,"wrong_grant","Choose an authorization code connection method.");let a=new URL(Ra(e.authorizeUrl,this.appValues(e,r))),c={...e.authorizeParams,response_type:"code",client_id:r.clientId,redirect_uri:Pa(e).redirectUri?.(r,i)??i,state:o};s.length&&(c.scope=s.join(e.scopes.separator)),e.pkce&&(c.code_challenge=await woe(n),c.code_challenge_method="S256"),Pa(e).authorize?.(c,i);for(let[u,l]of Object.entries(c))a.searchParams.set(u,l);return a.href}configuration(e,r){let o={issuer:e.issuer??new URL(Ra(e.grantType==="client_credentials"||e.grantType===Pn?e.tokenUrl:e.authorizeUrl,this.appValues(e,r))).origin,token_endpoint:Ra(e.tokenUrl,this.appValues(e,r))};return e.issuer&&co(e.issuer),{server:o,client:{client_id:r.clientId}}}authentication(e,r){return r==="none"?koe():(e.clientSecret||C(409,"app_required","Add a client secret to this OAuth application."),r==="basic"?Eoe(e.clientSecret):xoe(e.clientSecret))}options(e){let r=e?.tokenFormat??"form";return{[y4]:async(o,{body:n,headers:i,method:s,signal:a})=>{let c=new URLSearchParams(n);e&&Pa(e).tokenParameters?.(c);let u=await this.transport.send({url:o,method:s,headers:r==="json"?{...i,"content-type":"application/json"}:i,body:r==="json"?JSON.stringify(Object.fromEntries(c)):c.toString(),signal:a});return new Response([204,205,304].includes(u.status)?null:new Uint8Array(u.body),{status:u.status,headers:u.headers})}}}async json(e){return zi({status:e.status,headers:{},body:new Uint8Array(await e.arrayBuffer())})}checkResponse(e,r,o,n=!1){return(r>=400||o.error||e.okPointer&&ui(o,e.okPointer)!==!0)&&(n&&(o.error==="invalid_grant"||o.error==="invalid_token")&&C(409,"reconnect_required","Reconnect this service to renew access."),r===429&&C(503,"service_rate_limit","The service is busy. Try again later."),C(502,"authorization_failed","The service did not authorize this connection.")),o}async tokenResponse(e,r,o,n=!1){o.status===429&&C(503,"service_rate_limit","The service is busy. Try again later.");let i=this.checkResponse(e,o.status,await this.json(o),n),{server:s,client:a}=this.configuration(e,r),c=new URL(s.token_endpoint),u={...i};delete u.id_token,Pa(e,c.href).normalizeToken?.(u),u.expires_in!==void 0&&(u.expires_in=Ll(u.expires_in));try{let d=await(n?Coe:e.grantType==="client_credentials"?Loe:e.grantType===Pn?Koe:Moe)(s,a,Response.json(u,{status:o.status}),{recognizedTokenTypes:Pa(e,c.href).recognizedTokenTypes});return{...i,...d}}catch(l){if(l instanceof Er)throw l;C(502,"invalid_response","The service did not return a valid access token.")}}token(e,r,o,n,i=!1){let s=r[Pa(e).accessTokenField??"access_token"];(typeof s!="string"||!s||s.length>16384||/[\s\u0000-\u001f]/.test(s))&&C(502,"invalid_response","The service did not return a valid access token.");let a=r.expires_in===void 0?null:Date.now()+Ll(r.expires_in)*1e3,c=r.refresh_token??n?.refreshToken;c!==void 0&&(typeof c!="string"||!c||c.length>16384)&&C(502,"invalid_response","The service returned an invalid refresh token.");let u={...n?.extra};for(let d of e.keep)typeof r[d]=="string"&&(u[d]=r[d]);let l={accessToken:s,...c?{refreshToken:String(c)}:{},expiresAt:a,scopes:r.scope!==void 0?Goe(r.scope,e.scopes.separator):i?n?.scopes??o:o,scopesStatus:r.scope!==void 0?"reported":i?n?.scopesStatus??"unknown":o.length?"requested":"unknown",account:n?.account??"",accountVerified:n?.accountVerified??!1,extra:u,facts:{}};return r.refresh_token_expires_in!==void 0&&(l.refreshExpiresAt=Date.now()+Ll(r.refresh_token_expires_in)*1e3),n?.refreshExpiresAt&&c===n.refreshToken&&(l.refreshExpiresAt=Math.min(l.refreshExpiresAt??1/0,n.refreshExpiresAt)),l}async exchange(e,r,o,n,i,s,a,c){(e.grantType==="client_credentials"||e.grantType===Pn)&&C(400,"wrong_grant","Choose an authorization code connection method.");let u,l=Pa(e);if(l.exchange){let f=await l.exchange({spec:e,app:r,transport:this.transport,url:()=>Ra(e.tokenUrl,this.appValues(e,r)),authorization:o,verifier:n});u=this.checkResponse(e,f.status,zi(f))}else{let{server:f,client:p}=this.configuration(e,r),m;try{let g=Foe(f,p,o.parameters,o.state);m=await Ooe(f,p,this.authentication(r,e.clientAuth),g,l.redirectUri?.(r,i)??i,e.pkce?n:w4,{...this.options(e),additionalParameters:e.tokenParams})}catch(g){throw(g instanceof Vv||g instanceof Hv)&&C(400,"invalid_state","Start the connection again."),g}u=await this.tokenResponse(e,r,m)}let d=this.token(e,u,s,a);return await c?.(d,u),d}async deviceAuthorization(e,r,o){(e.grantType!==Pn||!e.deviceAuthorizationUrl)&&C(400,"wrong_grant","Choose a device authorization connection method.");let{server:n,client:i}=this.configuration(e,r),s={...n,device_authorization_endpoint:Ra(e.deviceAuthorizationUrl,this.appValues(e,r))},a=await Voe(s,i,this.authentication(r,e.clientAuth),{...e.authorizeParams,...o.length?{scope:o.join(e.scopes.separator)}:{}},this.options(e)),c=await this.json(a);[200,400].includes(a.status)&&c.error==="device_flow_disabled"&&C(409,"device_flow_disabled","Enable device authorization in the service application settings.");let u=this.checkResponse(e,a.status,c),l;try{l=await Hoe(s,i,Response.json(u,{status:a.status}))}catch{C(502,"invalid_response","The service did not return a valid device authorization.")}let d=Date.now(),f=Ll(l.interval??5);return Kv.parse({deviceCode:l.device_code,userCode:l.user_code,verificationUri:co(l.verification_uri).href,...l.verification_uri_complete?{verificationUriComplete:co(l.verification_uri_complete).href}:{},expiresAt:d+Ll(l.expires_in)*1e3,intervalSeconds:f,nextPollAt:d+f*1e3})}async deviceToken(e,r,o,n){e.grantType!==Pn&&C(400,"wrong_grant","Choose a device authorization connection method.");let{server:i,client:s}=this.configuration(e,r),a=await Boe(i,s,this.authentication(r,e.clientAuth),o,{...this.options(e),additionalParameters:e.tokenParams}),c=await this.json(a);return[200,400].includes(a.status)&&["authorization_pending","slow_down"].includes(String(c.error))?{kind:"pending",slowDown:c.error==="slow_down",...c.interval!==void 0?{intervalSeconds:Ll(c.interval)}:{}}:([200,400].includes(a.status)&&(c.error==="access_denied"&&C(409,"device_access_denied","Device authorization was declined."),c.error==="expired_token"&&C(409,"device_code_expired","The device code expired. Start the connection again."),c.error==="device_flow_disabled"&&C(409,"device_flow_disabled","Enable device authorization in the service application settings.")),{kind:"connected",token:this.token(e,await this.tokenResponse(e,r,Response.json(c,{status:a.status})),n)})}async clientCredentials(e,r,o,n,i){e.grantType!=="client_credentials"&&C(400,"wrong_grant","Choose a client credentials connection method.");let{server:s,client:a}=this.configuration(e,r),c=Pa(e,s.token_endpoint),u={...e.tokenParams,...o.length?{scope:o.join(e.scopes.separator)}:{}},l=await Uoe(s,a,this.authentication(r,e.clientAuth),c.clientCredentialsParameters?.(u)??u,this.options(e)),d=await this.tokenResponse(e,r,l),f={...this.token(e,d,o,n,!!n),requestedScopes:o};return await i?.(f,d),f}async refresh(e,r,o,n){let i=o;if(o.expiresAt!==null&&o.expiresAt<Date.now()+6e4){if(e.grantType==="client_credentials")return o.requestedScopes||C(409,"reconnect_required","Reconnect this service to select its renewal scopes."),this.clientCredentials(e,r,o.requestedScopes,o,n);(!o.refreshToken||o.refreshExpiresAt&&o.refreshExpiresAt<=Date.now())&&C(409,"reconnect_required","Reconnect this service to renew access.");let{server:s,client:a}=this.configuration(e,r),c=await Toe(s,a,this.authentication(r,e.clientAuth),o.refreshToken,{...this.options(e),additionalParameters:e.tokenParams}),u=await this.tokenResponse(e,r,c,!0);i=this.token(e,u,o.scopes,o,!0),await n?.(i,u)}return i}outputs(e,r,o){let n={...this.appValues(e,r),...o.extra,...o,expiresAt:o.expiresAt===null?"":String(o.expiresAt)};return Object.fromEntries(Object.entries(e.outputs).map(([i,s])=>[i,mc(ui(n,s))]))}};function Xoe(t){if(t.method.kind!=="oauth")throw new Error("Use an OAuth connection provider.");return t.method.config}function Yoe(t){return t||C(409,"app_required","Choose an OAuth application."),t}function JPe(t){return{token:qN.parse(t.token),response:xr.parse(t.response)}}var aA=class{constructor(e){this.transport=e}transport;facts=$N;oauth(e){return new Ks({send:r=>this.transport.send({...r,...e?{signal:AbortSignal.any([e,...r.signal?[r.signal]:[]])}:{}})})}needsRenewal(e){return!e.oauth||e.oauth.expiresAt!==null&&e.oauth.expiresAt<Date.now()+6e4}async renew(e){let r=e.material,o=Xoe(r),n=Yoe(e.app),i=("requestedScopes"in r?r.requestedScopes:void 0)??r.oauth?.requestedScopes,s=(c,u)=>e.receive({token:c,response:u}),a=o.grantType==="client_credentials"?await this.oauth(e.signal).clientCredentials(o,n,i??es(o.scopes),r.oauth,s):await this.oauth(e.signal).refresh(o,n,r.oauth,s);return Gn.parse({...e.material,oauth:a})}async recover(e,r,o){let i=JPe(o).token;return Gn.parse({...e,oauth:i})}async outputs(e,r){return this.oauth().outputs(Xoe(e),Yoe(r),e.oauth)}};function GPe(t){if(t.method.kind!=="token"&&t.method.kind!=="approval")throw new Error("Use an input credential provider.");return t.method.config}var qv=class{facts=bp;needsRenewal(){return!1}async outputs(e){let r=GPe(e),o=ns(r.fields,e.fields,"constants"in r?r.constants??{}:{});return Object.fromEntries(Object.entries(r.outputs).map(([n,i])=>[n,_0(o,i)]))}};function cA(t){if(t.method.kind!=="ovh")throw new Error("Use an OVH connection provider.");return t.method.config}var uA=class{facts=AN;values(e,r){let o=cA(e),n=o.authorization==="consumer_key";n&&(!r?.clientId||!r.clientSecret)&&C(409,"app_required","Choose an OVHcloud API application with its key and secret.");let i=n?r.fields:e.fields;return ns(o.fields,i)}credentials(e,r){if(cA(e).authorization==="consumer_key")return{applicationKey:r.clientId,applicationSecret:r.clientSecret,consumerKey:e.fields.consumerKey};let o=this.values(e,r);return{applicationKey:o.applicationKey,applicationSecret:o.applicationSecret,consumerKey:o.consumerKey}}needsRenewal(){return!1}async outputs(e,r){if(e.method.kind!=="ovh")throw new Error("Use OVH connection material.");let o="ovh"in e?e.ovh:void 0;o&&o.expiresAt!==null&&o.expiresAt<=Date.now()&&C(409,"reconnect_required","Reconnect OVHcloud with a current API key.");let n=cA(e).authorization==="consumer_key"?{...this.values(e,r),...this.credentials(e,r)}:this.values(e,r);return Object.fromEntries(Object.entries(cA(e).outputs).map(([i,s])=>[i,mc(ui(n,s))]))}};import{readFile as XPe}from"node:fs/promises";var YPe=h.object({accessToken:h.string().min(1).max(16384).regex(/^\S+$/),expiresAt:h.number().int().positive()}).strict();async function QPe(t,e){if(t==="oidc"){let n=process.env.VULTR_OIDC_TOKEN_FILE,i=n?await XPe(n,"utf8"):process.env.VULTR_OIDC_TOKEN;return(!i||i.length>16384)&&C(409,"authentication_required","Provide the current OIDC token on this machine."),i.trim()}let r=await fetch("http://169.254.169.254/v1/identity/token",{redirect:"error",credentials:"omit",signal:AbortSignal.any([e,AbortSignal.timeout(3e3)])});r.ok||C(409,"authentication_required","Use a Vultr instance with an IAM role trust.");let o=(await r.text()).trim();return(!o||o.length>16384)&&C(502,"invalid_response","The instance did not return a valid identity token."),o}function Qoe(t){if(t.method.kind!=="token"||t.method.config.resolver!=="vultr-role")throw new Error("Use a Vultr IAM role connection.");return t.method.config}var lA=class{constructor(e,r=QPe){this.transport=e;this.identityToken=r}transport;identityToken;facts=bp;sessions=new Map;pending=new Map;needsRenewal(){return!1}async obtain(e,r){let o=ns(Qoe(e).fields,e.fields),n=o.authentication;["api_key","oidc","instance"].includes(n)||C(400,"invalid_field","Choose a Vultr authentication source.");let i=n==="api_key"?o.token:o.credential||await this.identityToken(n,r);(!i||i.length>16384||/\s/.test(i))&&C(409,"authentication_required","Provide current credentials for the selected authentication source.");let s=Number(o.duration);(!Number.isSafeInteger(s)||s<=0||s>315576e3)&&C(400,"invalid_field","Enter a valid session duration in seconds.");let a=await this.transport.send({url:"https://api.vultr.com/v2/assumed-roles/assume",method:"POST",headers:{"content-type":"application/json",authorization:"Bearer "+i},signal:r,body:JSON.stringify({role_id:o.roleId,session_name:o.sessionName,duration:s,auth_method:n==="instance"?"jwt":n,...n==="api_key"?{user_id:o.userId}:{},...n==="oidc"?{oidc_issuer_id:o.issuerId}:{}})});a.status>=400&&C(409,"role_denied","Check the role trust, permissions and authentication source in Vultr.");let c=zi(a);(c.role_id!==void 0&&c.role_id!==o.roleId||n==="api_key"&&c.user_id!==void 0&&c.user_id!==o.userId)&&C(409,"role_changed","Reconnect to approve the returned role and authentication source.");let u=YPe.parse({accessToken:c.session_token,expiresAt:typeof c.expires_at=="string"?Date.parse(c.expires_at):NaN});return u.expiresAt<=Date.now()&&C(502,"invalid_response","Vultr returned an expired role session."),u}async outputs(e,r,o){let n=Qoe(e);o.throwIfAborted();let i=await vt(e),s=this.sessions.get(i);if(!s||s.expiresAt<Date.now()+6e4){let a=this.pending.get(i);a||(a=this.obtain(e,o),this.pending.set(i,a));try{s=await a,this.sessions.set(i,s)}finally{this.pending.get(i)===a&&this.pending.delete(i)}}return Object.fromEntries(Object.entries(n.outputs).map(([a,c])=>[a,_0(s,c)]))}};function eie(t,e){let r={oauth:new aA(t),token:new qv,aws:new X$(e),approval:new qv,ovh:new uA},o=new lA(t);return n=>n.kind==="token"&&n.config.resolver==="vultr-role"?o:r[n.kind]}function dA(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}async function eRe(t,e){let r={},o={},n=[],i=new Set;for(let s of t){if(i.has(s.name)||!yK(s.name))throw new Error("Use distinct, unreserved environment variable names.");i.add(s.name);let a=await e(s.source),c=s.format??(a.file?"file":"text"),u=a.value;if(c==="json"&&(u=Et(mc(ui(JSON.parse(dA(u)),s.pointer??"")))),c==="file")o[s.name]=Buffer.from(u).toString("base64");else{let l=dA(u);if(l.includes("\0"))throw new Error("Use a file to pass binary content.");r[s.name]=l}n.push(Buffer.from(u).toString("utf8"),Buffer.from(u).toString("base64"),Buffer.from(u).toString("base64url"))}return{environment:r,files:o,sensitive:n}}async function tie(t,e,r){let o=await t.sourceContents(r.map(i=>i.source.id)),n=new Map;return eRe(r,async i=>{let s=o.find(u=>u.policy.id===i.id);if(s.policy.contentType===kt.value)return{value:await Jn(s,e.binding,e.keys.encryption)};n.has(i.id)||n.set(i.id,e.outputs(s,o,new AbortController().signal));let{values:a,files:c}=await n.get(i.id);if(!i.output||!Object.hasOwn(a,i.output))throw new Error("Choose an available connection output.");return{value:Et(a[i.output]),file:c.includes(i.output)}})}var pA=class{constructor(e,r,o,n,i,s=new G$){this.binding=e;this.keys=r;this.broker=o;this.journal=n;this.providers=eie(i,s)}binding;keys;broker;journal;providers;provider(e){return this.providers(e)}metadata(e){return Ep(e,this.provider(e.method).facts(e))}source(e,r,o){let n=o.find(i=>i.policy.id===e&&i.policy.contentType===r);return n||C(409,"input_required","Include the connection and its application in the inputs."),n}async method(e){typeof e.metadata.methodDigest!="string"&&C(409,"reconnect_required","Reconnect this service with the current connection format.");let r=await this.broker.method(e.policy.id);return await la(r)!==e.metadata.methodDigest&&C(409,"reconnect_required","Reconnect this service: its connection method changed."),r}async material(e){let r=await this.method(e),o=k0(await Jn(e,this.binding,this.keys.encryption),e.metadata,r);return(await this.metadata(o)).authorizationDigest!==e.metadata.authorizationDigest&&C(409,"connection_changed","Approve the current service account and permissions before using this connection."),o.state==="reconnect"&&C(409,"reconnect_required","Reconnect this service before using it."),o}async app(e,r,o){let n=this.source(e,kt.clientCredential,o);n.policy.readers.some(s=>s.id===this.binding.id)||C(403,"refresh_required","Only a reader of its application can renew this connection.");let i=Rn.parse(JSON.parse(dA(await Jn(n,this.binding,this.keys.encryption))));return i.methodId!==r&&C(400,"wrong_app","Choose an application for this connection method."),i}async connectionApp(e,r){if(Nt(e.method).application==="none")return null;if(!uc(e.method))return"implicitApp"in e&&e.implicitApp?e.implicitApp:Rn.parse({format:1,methodId:e.methodId,generation:e.generation,clientId:"",fields:{}});let o=await this.app(e.appId,e.methodId,r);return o.generation!==e.appGeneration&&C(409,"app_changed","Reconnect this service with the current application."),Nt(e.method).requiresApp&&e.method.kind!=="aws"&&Object.entries(Eo(e.method.config.fields,e.fields??{})).some(([n,i])=>o.fields[n]!==i)&&C(409,"app_changed","Reconnect this service with the current application settings."),o}async outputs(e,r,o){let n=await this.material(e);return this.provider(n.method).renew&&await this.broker.state(e.policy.id)&&C(409,"connection_busy","Resolve the current token update before using this connection."),n=await this.refresh(e,n,r,o),{values:await this.provider(n.method).outputs(n,await this.connectionApp(n,r),o),files:n.method.kind==="token"?n.method.config.files??[]:[]}}async refreshed(e,r){let o=await this.metadata(r);return o.authorizationDigest!==e.previous.metadata.authorizationDigest&&C(409,"connection_review","Review the changed service account or permissions before sharing the updated connection."),e.material=r,e.content=await WK(e.previous,kp(r),this.binding,this.keys,o),e.phase="settled",await this.journal.write("refresh_"+e.operation.id,e),await this.broker.commit(e.operation.id,e.operation.fence,e.content),e.delivered=!0,await this.journal.write("refresh_"+e.operation.id,e),r}async refresh(e,r,o,n){let i=this.provider(r.method);if(!i.needsRenewal(r))return r;i.renew||C(409,"reconnect_required","Reconnect this service to renew access.");let s=await this.connectionApp(r,o),a=tRe(),c=await this.broker.prepare(a,e.policy.id,e.materialRevision),u={operation:c,previous:e,material:r,app:s,phase:"prepared",delivered:!1};await this.journal.write("refresh_"+a,u);try{n.throwIfAborted(),u.phase="dispatched",await this.journal.write("refresh_"+a,u),await this.broker.dispatch(a,c.fence),n.throwIfAborted();let l=await i.renew({material:r,app:s,signal:n,receive:async d=>{u.checkpoint=d,u.phase="received",await this.journal.write("refresh_"+a,u)}});return await this.refreshed(u,l)}catch(l){if(u.phase==="prepared"?await this.broker.abort(a,c.fence):await this.broker.uncertain(a,c.fence).catch(()=>{}),l instanceof Er&&["connection_review","reconnect_required","account_changed","authorization_failed","service_rate_limit"].includes(l.code))throw l;C(409,"connection_uncertain","Check the token update before using this connection again.")}}async reconcile(){let e=[];for(let r of await this.journal.pending("refresh_"))try{let o=await this.journal.read(r);if(o.delivered)continue;if(o.content){await this.broker.commit(o.operation.id,o.operation.fence,o.content),o.delivered=!0,await this.journal.write(r,o);continue}let n=await this.broker.state(o.operation.resource_id);if(!n||n.id!==o.operation.id||n.state==="prepared")n?.id===o.operation.id&&n.state==="prepared"&&await this.broker.abort(o.operation.id,o.operation.fence),o.delivered=!0,await this.journal.write(r,o);else if(o.checkpoint&&this.provider(o.material.method).recover){let i=await this.provider(o.material.method).recover(o.material,o.app,o.checkpoint);await this.refreshed(o,i)}else await this.broker.uncertain(o.operation.id,o.operation.fence),o.delivered=!0,await this.journal.write(r,o)}catch{e.push(r.slice(8))}return e}};import{lookup as rRe}from"node:dns/promises";import{request as nRe}from"node:https";import{brotliDecompressSync as oRe,gunzipSync as iRe,inflateSync as sRe}from"node:zlib";var em=class{constructor(e){this.origin=e}origin;async send(e){let r=co(e.url,this.origin),o=r.hostname.replace(/^\[|\]$/g,""),n=e.maxBytes??1048576;e.body&&Buffer.byteLength(e.body)>n&&C(413,"body_limit","The request body is too large.");let i={"user-agent":"Foundation/1.0",accept:"application/json","accept-encoding":"identity"};for(let[s,a]of Object.entries(e.headers??{})){let c=s.toLowerCase();(["host","connection","content-length","transfer-encoding","upgrade","proxy-authorization","proxy-connection","accept-encoding","te","trailer"].includes(c)||!/^[!#$%&'*+.^_`|~0-9a-z-]+$/.test(c)||/[\r\n\u0000]/.test(a))&&C(400,"invalid_header","Choose a valid request header."),i[c]=a}try{let s=await rRe(o,{all:!0,verbatim:!0});(!s.length||s.some(u=>!sA(u.address)))&&C(400,"private_destination","Choose a public HTTPS destination.");let a=s[0],c=AbortSignal.any([AbortSignal.timeout(2e4),...e.signal?[e.signal]:[]]);return await new Promise((u,l)=>{let d={method:e.method??"GET",headers:i,signal:c,agent:!1,lookup:(p,m,g)=>{m.all?g(null,[a]):g(null,a.address,a.family)}},f=nRe(r,d,p=>{let m=[],g=0;p.on("data",y=>{g+=y.length,g>n?p.destroy(new Er(413,"body_limit","The response body is too large.")):m.push(y)}),p.on("error",l),p.on("end",()=>{try{let y=Buffer.concat(m),w=p.headers["content-encoding"];if(w&&w!=="identity"){let _=w==="gzip"?iRe:w==="deflate"?sRe:w==="br"?oRe:null;if(!_)throw new Er(502,"invalid_response","The service returned an unsupported response.");y=_(y,{maxOutputLength:n})}let b={};for(let[_,k]of Object.entries(p.headers))k!==void 0&&!["set-cookie","set-cookie2","content-encoding","transfer-encoding","connection"].includes(_)&&(b[_]=Array.isArray(k)?k.join(", "):k);u({status:p.statusCode??502,headers:b,body:new Uint8Array(y)})}catch(y){l(y)}})});f.on("error",l),f.end(e.body)})}catch(s){if(s instanceof Er)throw s;e.signal?.aborted&&C(409,"cancelled","The operation was cancelled."),C(502,"service_unavailable","The service could not be reached. Try again.")}}};function uu(t){let{keys:e,binding:r,origin:o}=t.identity;if(!e||!r)throw new Error("Use a sign-in key with encryption and signing keys for this operation.");let n=_4(aRe(ci()),"custody",r.id),i=new sc(_4(n,"client"),o,r,e),s=new Set,a=new $0(t,o,r,e,new A0(i),d=>{for(let f of d.excluded)s.has(f.id)||(s.add(f.id),process.stderr.write("foundation: "+f.name+" ("+f.id+") cannot open "+(d.operation==="transfer"?"the item after the transfer: ":"the saved item: ")+(f.code==="identity_changed"?"the previously verified public keys changed.":"its public keys are not verified by this identity.")+(d.operation==="transfer"?`
133
+ `):await yp(r),r}async function lq(t){if(!t.keys||!t.binding)throw new Error("Use a sign-in key with encryption and signing keys for this operation.");if(process.env.FOUNDATION_TOKEN)throw new Error("Rotate the keys from a machine that saves its identity.");let e={binding:t.binding,keys:t.keys},r=await iq(new Qi(t),e);return r.state!=="committed"?r:(await cq(t.origin,e,r),await yp({...t,keys:r.keys,binding:r.binding}),{state:r.state,bindingId:r.binding.id,generation:r.binding.generation})}import{spawn as Ege}from"node:child_process";import{chmod as kge,mkdtemp as Ige,rm as $ge,writeFile as Age}from"node:fs/promises";import{tmpdir as Tge}from"node:os";import{join as dq}from"node:path";import{StringDecoder as Pge}from"node:string_decoder";function Rge(t){return[...new Set(t.filter(Boolean).flatMap(e=>[e,encodeURIComponent(e),JSON.stringify(e).slice(1,-1),Buffer.from(e).toString("base64"),Buffer.from(e).toString("base64url")]))].sort((e,r)=>r.length-e.length)}var c0=class{constructor(e,r){this.secrets=e;this.output=r;this.max=Math.max(1,...e.map(o=>o.length))}secrets;output;pending="";decoder=new Pge("utf8");max;write(e){this.pending+=this.decoder.write(e),this.flush(!1)}end(){this.pending+=this.decoder.end(),this.flush(!0)}flush(e){let r=e?this.pending.length:Math.max(0,this.pending.length-this.max+1),o=0,n="";for(;o<r;){let i=this.secrets.find(s=>this.pending.startsWith(s,o));i?(n+="[redacted]",o+=i.length):(n+=this.pending[o],o++)}this.pending=this.pending.slice(o),n&&this.output(n)}};function Cge(t){return{...Object.fromEntries(["PATH","LANG","LC_ALL","TZ","TERM","HOME","TMPDIR","SYSTEMROOT","COMSPEC","PATHEXT"].flatMap(r=>process.env[r]?[[r,process.env[r]]]:[])),...t}}async function pq(t,e){if(!e.length)throw new Error("Put the command after --.");let r=await Ige(dq(Tge(),"foundation-"));await kge(r,448);try{let o=Cge(t.environment),n=[...t.sensitive];for(let[i,s]of Object.entries(t.files)){let a=Buffer.from(s,"base64"),c=dq(r,i);await Age(c,a,{mode:384,flag:"wx"}),o[i]=c,n.push(a.toString("utf8"),s,a.toString("base64url"))}return await new Promise((i,s)=>{let a=Ege(e[0],e.slice(1),{env:o,stdio:["inherit","pipe","pipe"],detached:process.platform!=="win32"}),c=Rge(n),u=new c0(c,m=>process.stdout.write(m)),l=new c0(c,m=>process.stderr.write(m));a.stdout.on("data",m=>u.write(m)),a.stderr.on("data",m=>l.write(m));let d=m=>{if(a.pid)try{process.platform==="win32"?a.kill(m):process.kill(-a.pid,m)}catch{}},f=()=>d("SIGINT"),p=()=>d("SIGTERM");process.on("SIGINT",f),process.on("SIGTERM",p),a.once("error",()=>s(new Error("The command could not be started. Check the executable and arguments."))),a.once("close",(m,g)=>{process.off("SIGINT",f),process.off("SIGTERM",p),u.end(),l.end(),i(m??(g==="SIGINT"?130:g==="SIGTERM"?143:1))})})}finally{await $ge(r,{recursive:!0,force:!0})}}import{dirname as aRe,join as _4}from"node:path";var mq=h.object({ownerId:E,name:me,resourceId:E.optional(),version:h.number().int().positive().optional()}).strict(),hq=mq.extend({value:h.literal("").optional()}),kN=mq.extend({methodId:h.string().min(1).max(200),clientId:h.string().max(1e3),fields:h.record(h.string(),h.string()).optional(),clientSecret:h.literal("").optional()}),gq=h.object({ownerId:E,connectionId:E,version:h.number().int().positive(),users:h.array(E).max(32)}).strict(),u0=h.object({ownerId:E,methodId:h.string().min(1).max(200),connectionId:E.optional(),name:me.optional(),appId:E.optional(),redirectUri:h.url().optional(),users:h.array(E).max(32).optional(),scopes:h.array(h.string().min(1).max(1e3)).max(200).optional(),methodDigest:h.string().regex(/^[A-Za-z0-9_-]{43}$/).optional(),clientId:h.string().max(1e3).optional(),fields:h.record(h.string(),h.string()).optional(),clientSecret:h.literal("").optional()}).strict(),yq=h.object({name:vo.shape.name,title:Xx,keyholder:h.boolean(),configure:h.array(h.string()),input:xr}).strict(),vq=864e5,wq=h.object({kind:h.literal("connection"),id:E}).strict(),bq=h.enum(["stopped","in_progress","succeeded","failed","uncertain","cancelled"]),nr=h.object({id:E,name:vo.shape.name,title:Xx,input:xr,keyholder:h.boolean(),configure:h.array(h.string()),ownerId:E.nullable(),actor:Yu.pick({id:!0,name:!0}),request:h.object({id:E,position:h.number().int().nonnegative()}).strict().nullable(),state:bq,result:Zn.nullable(),error:h.object({code:h.string(),message:h.string()}).strict().nullable(),continuation:wq.nullable(),canPerform:h.boolean(),canCancel:h.boolean(),url:h.url(),createdAt:Ve,updatedAt:Ve,expiresAt:Ve.nullable()}).strict(),jBe=vo.extend({id:E.optional(),proof:Zn.optional(),continuation:wq.optional()}).strict(),MBe=h.object({proof:Zn.optional()}).strict(),Oge=fN.extend({title:Xx,keyholder:h.boolean(),configure:h.array(h.string())}),fq=Yu.pick({id:!0,name:!0}),Nge=h.enum(["pending","approved","declined","withdrawn","expired"]),Br=h.object({id:E,from:fq,to:fq.nullable(),message:h.string(),operations:h.array(Oge),proposal:wK.nullable(),state:Nge,createdAt:Ve,expiresAt:Ve,answeredAt:Ve.nullable(),performed:h.array(h.object({position:h.number().int().nonnegative(),id:E,state:bq}).strict()),url:h.url(),code:h.string().optional(),returnUrl:h.url().nullable(),refreshUrl:h.url().nullable(),canAnswer:h.boolean(),canWithdraw:h.boolean()}).strict(),_q=h.object({id:E.optional(),to:E.optional(),message:h.string().max(1e3).default(""),operations:h.array(fN).min(1).max(8),expiresInMinutes:h.number().int().min(1).max(1440).default(30)}).strict(),Sq=h.object({values:h.array(h.record(h.string(),Zn)).max(8).default([]),configuration:h.array(xr).max(8).default([]),code:h.string().max(20).optional()}).strict();function Nt(t){switch(t.kind){case"oauth":let e=t.config.application;return{family:"oauth",application:e,requiresApp:e==="required",browserAuthorization:t.config.grantType!=="client_credentials",fields:t.config.fields,outputs:Object.keys(t.config.outputs)};case"token":return{family:"token",application:"none",requiresApp:!1,browserAuthorization:!1,fields:t.config.fields,outputs:Object.keys(t.config.outputs)};case"approval":return{family:"approval",application:"none",requiresApp:!1,browserAuthorization:!0,fields:t.config.fields,outputs:Object.keys(t.config.outputs)};case"ovh":{let r=t.config.authorization==="consumer_key";return{family:"ovh",application:r?"required":"none",requiresApp:r,browserAuthorization:r,fields:t.config.fields,outputs:Object.keys(t.config.outputs)}}case"aws":return{family:"aws",application:"none",requiresApp:!1,browserAuthorization:!1,fields:[],outputs:["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_DEFAULT_REGION","AWS_REGION"]}}}var xg=(t,e)=>Object.fromEntries(Object.entries(t).filter(([r])=>!e.includes(r)));function IN(t){let e=t.config;return{...xg(t,["name","docs","console","preparation"]),config:{...xg(t.config,["hint","instructions","console"]),...e.fields?{fields:e.fields.map(r=>({...xg(r,["label","placeholder","note"]),...r.choices?{choices:r.choices.map(o=>xg(o,["label"]))}:{}}))}:{},...e.scopes?{scopes:{...xg(e.scopes,["docs"]),...e.scopes.values?{values:e.scopes.values.map(r=>({id:r.id}))}:{}}}:{}}}}var la=t=>vt(IN(t));function cc(t){let{id:e,builtin:r,availability:o,registration:n,defaultName:i,...s}=t;return s}function es(t,e){return[...new Set([...t.required??[],...e??t.default])]}function uc(t){return Nt(t).requiresApp}function xq(t){return t.kind==="approval"?"unavailable":!Nt(t).browserAuthorization||t.kind==="ovh"||t.kind!=="oauth"?"available":t.config.browserTokenExchange??"unknown"}var Er=class extends Error{constructor(r,o,n,i){super(n);this.status=r;this.code=o;this.details=i}status;code;details};function C(t,e,r,o){throw new Er(t,e,r,o)}var Dge=new Set(["format","generation","methodId","method","appId","appGeneration","account","accountId","accountVerified","scopes","scopesStatus","outputs","state","methodKind","methodDigest","authorizationDigest"]),Eq=xr.refine(t=>Object.keys(t).every(e=>!Dge.has(e)),"Keep method-specific facts separate from common facts."),lc=h.object({accountId:h.string().max(2e3).nullable(),accountVerified:h.boolean(),scopes:h.array(h.string().max(1e3)).max(200),scopesStatus:h.enum(["unknown","requested","reported"]),authorization:Eq,details:Eq}).strict();function $N(t){if(t.method.kind!=="oauth")throw new Error("Use OAuth connection material.");let e="requestedScopes"in t?t.requestedScopes:void 0;return lc.parse({accountId:t.oauth?.account??"",accountVerified:t.oauth?.accountVerified??!1,scopes:e??t.oauth?.scopes??[],scopesStatus:e?"requested":t.oauth?.scopesStatus??"unknown",authorization:{},details:{}})}function bp(t){if(t.method.kind!=="token"&&t.method.kind!=="approval"||!t.fields)throw new Error("Use input credential material.");return"facts"in t&&t.facts?lc.parse(t.facts):lc.parse({accountId:null,accountVerified:!1,scopes:[],scopesStatus:"unknown",authorization:{},details:{}})}function AN(t){if(t.method.kind!=="ovh")throw new Error("Use OVH connection material.");let e="ovh"in t?t.ovh:void 0;if(!e){let r="requestedScopes"in t?t.requestedScopes:void 0;return lc.parse({accountId:null,accountVerified:!1,scopes:r??[],scopesStatus:r?"requested":"unknown",authorization:{},details:{}})}return lc.parse({accountId:e.user?e.account+"/"+e.user:e.account,accountVerified:!0,scopes:e.rules.map(r=>r.method+" "+r.path),scopesStatus:"reported",authorization:{ovh:e},details:{ovh:e}})}function TN(t){if(t.method.kind!=="aws"||!t.aws)throw new Error("Use AWS connection material.");return lc.parse({accountId:t.aws.identity?lp(t.aws.identity.arn):null,accountVerified:!!t.aws.identity,scopes:[],scopesStatus:"unknown",authorization:{aws:iK(t.aws)},details:{aws:sK(t.aws)}})}var zge={oauth:$N,token:bp,aws:TN,ovh:AN,approval:bp};function Eg(t){return zge[t.method.kind](t)}var lZ=St(qq(),1);var ma=class extends Error{template;position;hint;constructor(t,e,r,o){super(`${o} (at position ${e}): ${r}`),this.template=t,this.position=e,this.hint=r,this.name="TemplateParseError"}},aye=class extends ma{constructor(t,e){super(t,e,"Add the missing '}' to close the expression, or remove the stray '{'.","Unclosed expression: '{' has no matching '}'"),this.name="UnclosedExpressionError"}},cye=class extends ma{constructor(t,e){super(t,e,"Remove this stray '}' or add a matching '{' before it.","Stray '}' outside of any expression"),this.name="StrayClosingBraceError"}},uye=class extends ma{constructor(t,e){super(t,e,"RFC 6570 expressions cannot nest. Close the outer expression with '}' before starting a new one.","Nested '{' inside an unclosed expression"),this.name="NestedOpeningBraceError"}},lye=class extends ma{char;constructor(t,e,r){super(t,e,`Pct-encode '${r}' (e.g. '%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}') or remove it. Literals may not contain CTL, SP, '"', '\\'', lone '%', '<', '>', '\\\\', '^', '\`', or '|'.`,`Invalid literal character '${r}'`),this.char=r,this.name="InvalidLiteralError"}},dye=class extends ma{constructor(t,e){super(t,e,"Provide at least one varname inside the braces, e.g. '{var}'.","Empty expression '{}'"),this.name="EmptyExpressionError"}},pye=class extends ma{operator;constructor(t,e,r){super(t,e,`Operator '${r}' is reserved by RFC 6570 \xA72.2 for future extensions. Use one of '+', '#', '.', '/', ';', '?', '&' instead, or remove the operator.`,`Reserved operator '${r}'`),this.operator=r,this.name="ReservedOperatorError"}},fye=class extends ma{operator;constructor(t,e,r){super(t,e,`Replace '${r}' with one of '+', '#', '.', '/', ';', '?', '&' or remove it.`,`Unknown operator '${r}'`),this.operator=r,this.name="UnknownOperatorError"}},b0=class extends ma{varSpec;constructor(t,e,r,o,n){super(t,e,r,o),this.varSpec=n,this.name="InvalidVarSpecError"}},MN=class extends b0{constructor(t,e){super(t,e,"Remove the stray comma or insert a varname before/after it.","Empty varname in variable-list",""),this.name="EmptyVarNameError"}},mye=class extends b0{offendingChar;constructor(t,e,r,o){super(t,e,`Varnames may only contain ALPHA, DIGIT, '_', '.', or pct-encoded triplets. Replace '${o}' or pct-encode it.`,`Invalid character '${o}' in varname`,r),this.offendingChar=o,this.name="InvalidVarNameError"}},hye=class extends b0{prefix;constructor(t,e,r,o){super(t,e,"Prefix modifiers must be ':N' where N is a positive integer in 1..9999 with no leading zero (e.g. ':3').",`Invalid prefix modifier ':${o}'`,r),this.prefix=o,this.name="InvalidPrefixError"}},Zq=class extends b0{constructor(t,e){super(t,e,"Remove the trailing comma, or add a varspec after it.","Trailing ',' in variable-list",""),this.name="TrailingCommaError"}},gye=class extends ma{char;constructor(t,e,r){super(t,e,"Expected ',' or '}' here. Remove the unexpected character or pct-encode it if it belongs in the varname.",`Unexpected character '${r}' in expression`),this.char=r,this.name="UnexpectedCharacterError"}},yye=class extends Error{variableName;hint;constructor(t,e,r){super(`${r} for '${t}': ${e}`),this.variableName=t,this.hint=e,this.name="TemplateExpansionError"}},vye=class extends yye{prefix;valueType;constructor(t,e,r){super(t,"Remove the prefix modifier from this varspec, or provide a string value instead of a composite value.",`Prefix modifier ':${e}' is not applicable to ${r} values`),this.prefix=e,this.valueType=r,this.name="PrefixModifierNotApplicableError"}},wye=["","+",".","/",";","?","&","#"],eZ={"":{first:"",sep:",",named:!1,ifEmpty:"",allowReserved:!1},"+":{first:"",sep:",",named:!1,ifEmpty:"",allowReserved:!0},".":{first:".",sep:".",named:!1,ifEmpty:"",allowReserved:!1},"/":{first:"/",sep:"/",named:!1,ifEmpty:"",allowReserved:!1},";":{first:";",sep:";",named:!0,ifEmpty:"",allowReserved:!1},"?":{first:"?",sep:"&",named:!0,ifEmpty:"=",allowReserved:!1},"&":{first:"&",sep:"&",named:!0,ifEmpty:"=",allowReserved:!1},"#":{first:"#",sep:",",named:!1,ifEmpty:"",allowReserved:!0}},bye=new TextEncoder,Wq="0123456789ABCDEF",Jq=t=>fc(Zr(48,57),Zr(65,70),Zr(97,102))(t.charCodeAt(0)),Ag=(t,e)=>t[e]==="%"&&e+2<t.length&&Jq(t[e+1])&&Jq(t[e+2]);function UN(t,e){let r=t[e];return r==null?0:fc(tZ,rZ,ol("_"))(r)?1:Ag(t,e)?3:0}function _ye(t,e){if(Ag(t,e))return 3;let{char:r,size:o}=Tg(t,e);return xye(r)?o:0}function Tg(t,e){let r=t.codePointAt(e);if(r==null)return{char:"",size:0};let o=r>65535?2:1;return{char:t.slice(e,e+o),size:o}}var HN=t=>e=>{let r="";for(let o=0;o<e.length;){if(t&&Ag(e,o)){r+=e.slice(o,o+3),o+=3;continue}let{char:n,size:i}=Tg(e,o);r+=fc(nZ,s=>t&&Sye(s))(n)?n:oZ(n),o+=i}return r};function xp(t){let e="";for(let r=0;r<t.length;){if(Ag(t,r)){e+=t.slice(r,r+3),r+=3;continue}let{char:o,size:n}=Tg(t,r);e+=nZ(o)?o:oZ(o),r+=n}return e}function Ig(t,e){let r="",o=0;for(let n=0;n<t.length&&o<e;o++){if(Ag(t,n)){r+=t.slice(n,n+3),n+=3;continue}let{char:i,size:s}=Tg(t,n);r+=i,n+=s}return r}var tZ=t=>fc(Zr(65,90),Zr(97,122))(t.charCodeAt(0)),rZ=t=>Zr(48,57)(t.charCodeAt(0)),nZ=t=>fc(tZ,rZ,e=>"-._~".includes(e))(t),Sye=t=>":/?#[]@!$&'()*+,;=".includes(t),xye=t=>Eye(t.codePointAt(0)),Eye=t=>t!=null&&fc(ol(33),Zr(35,36),ol(38),Zr(40,59),ol(61),Zr(63,91),ol(93),ol(95),Zr(97,122),ol(126),kye,Iye)(t);function kye(t){if(t<65536)return fc(Zr(160,55295),Zr(63744,64975),Zr(65008,65519))(t);if(t>983037)return!1;let e=t%65536;return e<=65533&&(t<917504||e>=4096)}var Iye=t=>fc(Zr(57344,63743),Zr(983040,1048573),Zr(1048576,1114109))(t),oZ=t=>Array.from(bye.encode(t)).map(e=>`%${Wq[e>>4]}${Wq[e&15]}`).join(""),Zr=(t,e)=>r=>t<=r&&r<=e,ol=t=>e=>t===e,fc=(...t)=>e=>t.some(r=>r(e));function iZ(t,e,r){return t.map(o=>o.kind==="literal"?o.text:$ye(o.vars,o.operator,e,r)).join("")}function $ye(t,e,r,o){let n=eZ[e],i=t.flatMap(s=>Aye(s,r[s.name],n,o));return i.length<1?"":`${n.first}${i.join(n.sep)}`}function Aye(t,e,r,o){if(e==null)return[];if(zye(e)){let n=Cye(e,r.allowReserved);return n.length<1?[]:Gq(t,"list",o)?Pye(t,n,r):[]}if(Dye(e)){let n=Oye(e,r.allowReserved);return n.length<1?[]:Gq(t,"associative",o)?Rye(t,n,r):[]}return Tye(t,e,r)}function Tye(t,e,r){let o=String(e),n=t.prefix==null?o:Ig(o,t.prefix),i=HN(r.allowReserved)(n);return r.named?[$g(xp(t.name),i,r)]:[i]}function Pye(t,e,r){let o=xp(t.name);if(t.explode)return r.named?e.map(i=>$g(o,i,r)):[...e];let n=e.join(",");return r.named?[$g(o,n,r)]:[n]}function Rye(t,e,r){if(t.explode)return e.map(([n,i])=>$g(n,i,r));let o=e.flat(1).join(",");return r.named?[$g(xp(t.name),o,r)]:[o]}var $g=(t,e,r)=>e===""?`${t}${r.ifEmpty}`:`${t}=${e}`,Cye=(t,e)=>t.filter(r=>r!=null).map(String).map(HN(e)),Oye=(t,e)=>Object.entries(t).map(([r,o])=>[r,Nye(o)]).filter(([,r])=>r!=null).map(r=>r.map(HN(e)));function Nye(t){if(t==null)return null;if(!Array.isArray(t))return String(t);let e=t.filter(r=>r!=null).map(String);return e.length<1?null:e.join(",")}var Dye=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),zye=t=>Array.isArray(t);function Gq(t,e,{report:r,strict:o}){if(t.prefix==null)return!0;let n=new vye(t.name,t.prefix,e);if(r(n),o)throw n;return!1}function jye(t,e,r){return LN(t,e,r,0,0,{})}function LN(t,e,r,o,n,i){if(o>=t.length){if(n!==e.length)return null;let a=lve(i);return iZ(t,a,r)===e?a:null}let s=t[o];if(s.kind==="literal")return e.startsWith(s.text,n)?LN(t,e,r,o+1,n+s.text.length,i):null;for(let a of Mye(t,e,o,n)){let c=e.slice(n,a);for(let u of Lye(s.vars,s.operator,c)){let l=BN(i,u);if(l==null)continue;let d=LN(t,e,r,o+1,a,l);if(d!=null)return d}}return null}function*Mye(t,e,r,o){let n=t.slice(r+1).find(i=>i.kind==="literal"&&i.text!=="");if(n==null||n.kind!=="literal"){yield*Uye(e.length,o);return}for(let i=e.indexOf(n.text,o);i>=0;i=e.indexOf(n.text,i+1))yield i}function*Uye(t,e){for(let r=t;r>=e;r--)yield r}function*Lye(t,e,r){if(r===""){yield*Fye(t,e);return}let o=eZ[e];if(!r.startsWith(o.first))return;let n=r.slice(o.first.length);yield*o.named?Gye(t,o,n):Vye(t,o,n)}var Fye=(t,e)=>(e===""||e==="+")&&t.length===1?[pc(t[0],"")]:[{}],Vye=(t,e,r)=>FN(t,e,KN(r,e.sep),0,0);function*FN(t,e,r,o,n){if(o>=t.length){n>=r.length&&(yield{});return}let i=t[o];for(let s of Hye(i,e,r,n))for(let a of FN(t,e,r,o+1,s.index)){let c=BN(s.bindings,a);c!=null&&(yield c)}yield*FN(t,e,r,o+1,n)}function*Hye(t,e,r,o){if(o>=r.length)return;let n=r.length-o;for(let i=1;i<=n;i++){let s=r.slice(o,o+i);for(let a of Bye(t,e,s))yield{bindings:a,index:o+i}}}function*Bye(t,e,r){let o=sZ(t,e,r.join(e.sep));if(t.prefix!=null){yield*o;return}t.explode&&r.length>0&&(yield*Kye(t,e,r)),yield*o}function*Kye(t,e,r){let o=aZ(r,e.allowReserved);if(o==null)return;let n=qye(r,e);n!=null&&(yield pc(t,n)),yield pc(t,o)}var qye=(t,e)=>Zye(t.join(e.sep),e);function Zye(t,e){let r=[];for(let o=0;o<t.length;){let n=t.indexOf("=",o);if(n<0)return null;let i=n+1,s=Wye(t,i,e.sep),a=fa(t.slice(o,n),e.allowReserved),c=fa(t.slice(i,s),e.allowReserved);if(a==null||c==null)return null;r.push([a,c]),o=s+e.sep.length}return r.length<1?null:Object.fromEntries(r)}function Wye(t,e,r){for(let o=e;o<t.length;o++)if(Jye(t,o,r))return o;return t.length}var Jye=(t,e,r)=>{if(!t.startsWith(r,e))return!1;let o=e+r.length;for(let n=o;n<t.length;n++){if(t[n]==="=")return n>o;if(t.startsWith(r,n))return!1}return!1};function*sZ(t,e,r){let o=fa(r,e.allowReserved);if(o==null)return;let n=pc(t,o);if(t.prefix!=null){yield n;return}let i=KN(r,",");if(i.length<2){yield n;return}let s=aZ(i,e.allowReserved);if(s==null){yield n;return}let a=i.length%2===0?ive(i,e.allowReserved):null;a!=null&&(yield pc(t,a)),yield pc(t,s),yield n}var Gye=(t,e,r)=>VN(t,e,KN(r,e.sep).map(ove),0,0);function*VN(t,e,r,o,n){if(o>=t.length){n>=r.length&&(yield{});return}let i=t[o];for(let s of Xye(i,e,r,n,t))for(let a of VN(t,e,r,o+1,s.index)){let c=BN(s.bindings,a);c!=null&&(yield c)}yield*VN(t,e,r,o+1,n)}function*Xye(t,e,r,o,n){if(!(o>=r.length)){if(t.explode&&t.prefix==null){yield*Qye(t,e,r,o,n);return}yield*Yye(t,e,r,o)}}function*Yye(t,e,r,o){let n=r[o];if(n.name===xp(t.name))for(let i of sZ(t,e,n.value))yield{bindings:i,index:o+1}}function*Qye(t,e,r,o,n){yield*eve(t,e,r,o),yield*rve(t,e,r,o,n)}function*eve(t,e,r,o){let n=[...tve(xp(t.name),e,r,o)];n.length>0&&(yield{bindings:pc(t,n),index:o+n.length})}function*tve(t,e,r,o){for(let n=o;n<r.length&&r[n].name===t;n++){let i=fa(r[n].value,e.allowReserved);if(i==null)return;yield i}}function*rve(t,e,r,o,n){let i=[...nve(e,r,o,new Set(n.map(s=>xp(s.name))))];i.length>0&&(yield{bindings:pc(t,Object.fromEntries(i)),index:o+i.length})}function*nve(t,e,r,o){for(let n=r;n<e.length;n++){let i=e[n];if(n>r&&o.has(i.name))return;let s=fa(i.name,t.allowReserved),a=fa(i.value,t.allowReserved);if(s==null||a==null)return;yield[s,a]}}function ove(t){let e=t.indexOf("=");return e<0?{name:t,value:""}:{name:t.slice(0,e),value:t.slice(e+1)}}function ive(t,e){let r=[];for(let o=0;o<t.length;o+=2){let n=fa(t[o],e),i=fa(t[o+1],e);if(n==null||i==null)return null;r.push([n,i])}return Object.fromEntries(r)}function aZ(t,e){let r=[];for(let o of t){let n=fa(o,e);if(n==null)return null;r.push(n)}return r}function fa(t,e){if(e)return t;try{return decodeURIComponent(t)}catch{return null}}var pc=({name:t,prefix:e},r)=>({[t]:{value:r,prefix:e}});function BN(t,e){let r={...t};for(let[o,n]of Object.entries(e)){let i=r[o];if(i==null){r[o]=n;continue}let s=sve(i,n);if(s==null)return null;r[o]=s}return r}var sve=(t,e)=>w0(t)||w0(e)?ave(t,e):cve(t.value,e.value)?t:null;function ave(t,e){let r=Xq(t.value),o=Xq(e.value);if(r==null||o==null)return null;let n=w0(t),i=w0(e);if(!n&&!i)return null;if(n&&!i)return Ig(o,t.prefix)===r?e:null;if(!n&&i)return Ig(r,e.prefix)===o?t:null;let s=t.prefix,a=e.prefix;return s<=a?Ig(o,s)===r?e:null:Ig(r,a)===o?t:null}var w0=t=>t.prefix!=null,Xq=t=>typeof t=="string"?t:null;function cve(t,e){return Array.isArray(t)?Array.isArray(e)&&t.length===e.length&&t.every((r,o)=>r===e[o]):Yq(t)?Yq(e)&&uve(Object.entries(t),Object.entries(e)):t===e}var uve=(t,e)=>t.length===e.length&&t.every(([r,o],n)=>{let[i,s]=e[n];return r===i&&o===s}),Yq=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),lve=t=>Object.fromEntries(Object.entries(t).map(([e,r])=>[e,r.value])),KN=(t,e)=>e===""?[t]:t.split(e),dve=["=",",","!","@","|"];function pve(t,e,r){let o=a=>{throw a};if(t.length<1)return o(new dye(e,r));let n=t[0];if(gve(n))return o(new pye(e,r+1,n));if(!Qq(n)&&UN(t,0)<1)return o(new fye(e,r+1,n));let i=Qq(n)?n:"",s=i===""?0:1;return{kind:"expression",operator:i,vars:fve(t,e,r+1,s)}}function fve(t,e,r,o){if(o>=t.length)throw new MN(e,r+o);let n=[];for(let i=o;i<t.length;){if(t[i]===",")throw i===t.length-1?new Zq(e,r+i):new MN(e,r+i);let s=i,a=mve(t,i);if(a===s)throw new MN(e,r+i);let c=t.slice(s,a);i=a;let u=hve(t,e,r,i,c);if(i=u.index,i<t.length&&t[i]!==",")throw u.used?new gye(e,r+i,t[i]):new mye(e,r+i,c,t[i]);if(n.push({name:c,explode:u.explode,...u.prefix==null?{}:{prefix:u.prefix}}),i<t.length&&(i++,i>=t.length))throw new Zq(e,r+i-1)}return n}function mve(t,e){let r=e,o=!0;for(;r<t.length;){let n=UN(t,r);if(n>0){r+=n,o=!1;continue}if(t[r]!=="."||o||UN(t,r+1)<1)break;r++,o=!0}return r}function hve(t,e,r,o,n){if(t[o]==="*")return{explode:!0,index:o+1,used:!0};if(t[o]!==":")return{explode:!1,index:o,used:!1};let i=o+1,s=i;for(;s<t.length&&yve(t[s]);)s++;let a=t.slice(i,s);if(!/^[1-9][0-9]{0,3}$/.test(a))throw new hye(e,r+o,n,a);return{explode:!1,index:s,prefix:Number(a),used:!0}}function Qq(t){return wye.includes(t)&&t!==""}function gve(t){return dve.includes(t)}function yve(t){let e=t.charCodeAt(0);return e>=48&&e<=57}function vve(t,e){let{report:r}=e,o=[],n=i=>{let s=o.at(-1);s?.kind==="literal"?o[o.length-1]={kind:"literal",text:s.text+i}:o.push({kind:"literal",text:i})};for(let i=0;i<t.length;){let s=t[i];if(s==="{"){let l=t.indexOf("}",i+1);if(l<0){r(new aye(t,i)),n(t.slice(i));break}let d=t.indexOf("{",i+1);if(d>=0&&d<l){r(new uye(t,d)),n(t.slice(i,l+1)),i=l+1;continue}let f=t.slice(i+1,l);try{o.push(pve(f,t,i))}catch(p){r(p instanceof Error?p:new Error(String(p))),n(t.slice(i,l+1))}i=l+1;continue}if(s==="}"){r(new cye(t,i)),n(s),i++;continue}let a=_ye(t,i);if(a>0){n(t.slice(i,i+a)),i+=a;continue}let{char:c,size:u}=Tg(t,i);r(new lye(t,i,c)),n(c),i+=u}return o}var cZ=class uZ{uriTemplate;options;#e;#t;constructor(e,r={}){this.uriTemplate=e,this.options=r,this.#t=xve(r),this.#e=wve(vve(e,this.#t)),Object.freeze(this)}static parse(e,r={}){return new uZ(e,r)}get tokens(){return this.#e}expand=e=>iZ(this.#e,e,this.#t);match=e=>jye(this.#e,e,this.#t);toString=()=>this.uriTemplate},wve=t=>Object.freeze(t.map(bve)),bve=t=>t.kind==="literal"?Object.freeze({kind:"literal",text:t.text}):Object.freeze({kind:"expression",operator:t.operator,vars:Object.freeze(t.vars.map(_ve))}),_ve=t=>Object.freeze({name:t.name,explode:t.explode,...t.prefix==null?{}:{prefix:t.prefix}}),Sve=()=>{},xve=({strict:t,report:e})=>(e??=Sve,t??=!0,e=t?Eve(e):e,{strict:t,report:e}),Eve=t=>e=>{throw t(e),e};function kve(t){if(t==="")return[];if(!t.startsWith("/")||/~(?![01])/u.test(t))throw new Error("Invalid JSON pointer.");let e=t.slice(1).split("/").map(r=>r.replaceAll("~1","/").replaceAll("~0","~"));if(e.some(r=>["__proto__","prototype","constructor"].includes(r)))throw new Error("Invalid JSON pointer.");return e}function ui(t,e){for(let r of kve(e)){if(t===null||typeof t!="object"||!Object.hasOwn(t,r))return;t=t[r]}return t}function mc(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);throw new Error("The selected value is not text.")}function _0(t,e){return typeof e=="string"?mc(ui(t,e)):e.map(r=>typeof r=="string"?r:mc(ui(t,r.pointer))).join("")}var rs=class extends Error{constructor(r,o){super(o);this.code=r}code};function Ive(t,e){return!t.when||e[t.when.field]===void 0||t.when.values.includes(e[t.when.field])}function S0(t,e,r={}){let o=(i,s)=>{throw new rs(i,s)},n={...r,...e};for(let i of t)n[i.name]===void 0&&i.defaultValue!==void 0&&(n[i.name]=i.defaultValue);for(let i of t){if(!Ive(i,n)){delete n[i.name];continue}i.required!==!1&&!n[i.name]&&o("missing_field","Complete the required service fields."),n[i.name]?.includes("\0")&&o("invalid_field","Check the service fields."),i.choices&&n[i.name]&&!i.choices.some(s=>s.value===n[i.name])&&o("invalid_field","Choose an available service setting."),i.pattern&&(i.pattern.length>200||!(0,lZ.default)(i.pattern))&&o("invalid_pattern","Use a simple field validation pattern."),i.pattern&&n[i.name]&&!new RegExp(i.pattern,"u").test(n[i.name].slice(0,1e3))&&o("invalid_field","Check the service fields.")}return Object.keys(e).some(i=>!t.some(s=>s.name===i))&&o("invalid_field","Remove unrecognized service fields."),n}function ns(t,e,r={}){let o=S0(t,e,r),n={};for(let i of t){let s=i.choices?.find(a=>a.value===o[i.name]);for(let[a,c]of Object.entries(s?.values??{})){if(t.some(u=>u.name===a)||a in n&&n[a]!==c)throw new rs("invalid_field","Use distinct values for each service setting.");n[a]=c}}return{...o,...n}}function x0(t,e){for(let[r,o]of Object.entries(e)){let n=t.find(i=>i.name===r);if(!n)throw new rs("invalid_field","Use the fields declared by the connection method.");if(n.secret!==!1&&o!=="")throw new rs("encrypted_input_required","Supply private material directly with your encryption keys.")}return S0(t.map(r=>({...r,required:!1,defaultValue:void 0})),e)}function Eo(t,e){return x0(t,Object.fromEntries(t.filter(r=>r.secret===!1&&e[r.name]).map(r=>[r.name,e[r.name]])))}function Pg(t,e,r){x0(t,e);for(let[o,n]of Object.entries(e))if(n&&r[o]!==void 0&&r[o]!==n)throw new rs("operation_changed","Use the service settings prepared by this operation.");return{...e,...r}}function E0(t,e){let r;try{r=ui(JSON.parse(e[t.field]??""),t.pointer)}catch{r=void 0}if(typeof r!="string"||!r)throw new rs("invalid_field","Enter the complete JSON document the service issued.");return r}function dZ(t,e=Eg(t)){return e.accountVerified?e.accountId:null}function pZ(t,e=Eg(t)){let o=(t.method.kind==="oauth"||t.method.kind==="ovh"||t.method.kind==="token"&&!!(t.method.config.identity||t.method.config.resolver||t.method.config.bindFields))&&t.method.kind!=="aws"?Eo(t.method.config.fields,t.fields??{}):{};return{format:t.format,generation:t.generation,methodId:t.methodId,method:IN(t.method),appId:t.appId,appGeneration:t.appGeneration,..."implicitApp"in t&&t.implicitApp?{implicitApp:{clientId:t.implicitApp.clientId,generation:t.implicitApp.generation,fields:t.implicitApp.fields}}:{},account:e.accountId,accountVerified:e.accountVerified,scopes:[...e.scopes].sort(),...Object.keys(o).length?{fields:o}:{},...e.authorization,...t.state?{state:t.state}:{}}}var hc=h.record(h.string().max(100),h.string().max(16384)),Rn=h.object({format:h.literal(1),methodId:h.string().min(1),generation:E,clientId:h.string().max(1e3),clientSecret:h.string().max(16384).optional(),fields:hc}).strict(),qN=h.object({accessToken:h.string().min(1).max(16384),refreshToken:h.string().min(1).max(16384).optional(),expiresAt:h.number().nullable(),refreshExpiresAt:h.number().optional(),scopes:h.array(h.string()),requestedScopes:h.array(h.string()).optional(),account:h.string(),accountVerified:h.boolean().optional(),scopesStatus:h.enum(["unknown","requested","reported"]).optional(),extra:hc,facts:xr}).strict(),Rg={format:h.literal(3),methodId:h.string().min(1),method:dp,generation:E,appId:E.nullable(),appGeneration:E.nullable(),state:h.literal("reconnect").optional()},ha=h.never().optional(),Gn=h.union([h.object({...Rg,method:qx,oauth:qN.optional(),requestedScopes:h.array(h.string()).optional(),implicitApp:Rn.optional(),fields:hc.optional(),aws:ha}).strict(),h.object({...Rg,method:Zx,fields:hc,facts:lc.optional(),oauth:ha,aws:ha}).strict(),h.object({...Rg,method:Gx,fields:hc,oauth:ha,aws:ha}).strict(),h.object({...Rg,method:Jx,fields:hc,ovh:hg.optional(),requestedScopes:h.array(h.string()).optional(),oauth:ha,aws:ha}).strict(),h.object({...Rg,method:Wx,aws:Fx,oauth:ha,fields:ha}).strict()]).superRefine((t,e)=>{if("implicitApp"in t&&t.implicitApp&&(t.method.kind!=="oauth"||t.method.config.application!=="implicit"||t.implicitApp.methodId!==t.methodId)&&e.addIssue({code:"custom",message:"Keep the registered client with its implicit OAuth connection."}),t.method.kind==="oauth"&&t.fields)try{x0(t.method.config.fields,t.fields)}catch{e.addIssue({code:"custom",path:["fields"],message:"Keep only declared public settings in the connection."})}uc(t.method)&&(!t.appId||!t.appGeneration)&&e.addIssue({code:"custom",message:"Bind the application required by this connection."}),!uc(t.method)&&t.appId!==null&&e.addIssue({code:"custom",message:"Use an application only when the connection requires one."}),!!t.appId!=!!t.appGeneration&&e.addIssue({code:"custom",message:"Bind the application and its generation together."}),t.method.kind==="oauth"&&t.method.config.grantType==="client_credentials"&&!("requestedScopes"in t&&t.requestedScopes)&&!t.oauth?.requestedScopes&&e.addIssue({code:"custom",message:"Keep the selected scopes for client credentials renewal."})}),LKe=h.object({methodId:h.string().min(1).max(200),clientId:h.string().max(1e3),generation:E,fields:hc.optional()}).strict(),$ve=h.object({methodId:h.string().min(1).max(200),methodDigest:Vr,methodKind:lN,generation:E,authorizationDigest:Vr,appId:E.nullable(),accountId:h.string().max(2e3).nullable(),accountVerified:h.boolean(),scopes:h.array(h.string().max(1e3)).max(200),scopesStatus:h.enum(["unknown","requested","reported"]),outputs:h.array(h.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/)).max(100),state:h.enum(["ready","reconnect"]),fields:hc.optional(),aws:Vx.optional(),ovh:hg.optional()}).strict();async function Ep(t,e=Eg(t)){let{outputs:r}=Nt(t.method),o=t.method.kind!=="aws"&&t.fields?Eo(t.method.config.fields,t.fields):{},n=await vt(pZ(t,e));return $ve.parse({methodId:t.methodId,methodDigest:await la(t.method),methodKind:t.method.kind,generation:t.generation,authorizationDigest:n,appId:t.appId,accountId:dZ(t,e),accountVerified:e.accountVerified,scopes:e.scopes,scopesStatus:e.scopesStatus,outputs:r,state:t.state??"ready",...Object.keys(o).length?{fields:o}:{},...e.details})}var fZ=h.object({account:h.string().max(2e3)}).strict();function Cg(t){return{account:t.method.kind==="token"&&t.method.config.account&&t.fields?E0(t.method.config.account,t.fields):""}}var FKe=h.array(h.object({name:h.string(),label:h.string(),value:h.string()}).strict());function Og(t){let{methodId:e,method:r,...o}=t;return xr.parse(o)}var kp=t=>Et(M(Og(t)));function ZN(t,e,r){let o=t&&typeof t=="object"&&!("methodId"in t)&&!("method"in t)?Gn.safeParse({...t,methodId:e,method:r}):null;return o?.success||C(409,"reconnect_required","Reconnect this service with the current connection format."),o.data}var k0=(t,e,r)=>ZN(JSON.parse(qt(t)),e.methodId,r);var Ng=er.extend({name:me}),mZ=h.object({required:h.array(Ng),delegates:h.array(Ng)}).strict(),JKe=h.object({to:E,version:h.number().int().positive(),content:Hr.optional()}).strict(),WN=h.object({name:me,content:Hr,labels:fZ.optional(),version:h.number().int().positive().optional()}).strict(),hZ=h.object({content:Hr,version:h.number().int().positive()}).strict(),gZ=h.object({id:E,remove:h.array(E).max(1e3).default([])}).strict(),GKe=h.record(E,h.object({version:h.number().int().positive(),content:Hr}).strict()),yZ=h.object({id:E,name:me,version:h.number().int().positive(),content:Hr,policy:Wn}).strict(),Dg=h.object({id:E,resource_id:E,renewer_id:E,expected_revision:h.number().int().positive(),state:h.enum(["prepared","in_flight","committed","uncertain","aborted"]),fence:h.string().regex(/^\d+$/),result:Hr.nullable()}),XKe=h.object({id:E,resourceId:E,expectedRevision:h.number().int().positive()}).strict(),Ave=h.object({fence:h.string().regex(/^\d+$/)}).strict(),YKe=Ave.extend({content:Hr}).strict(),QKe=h.object({id:E,operationId:E,stateDigest:Vr,expiresAt:Ve}).strict(),JN=h.object({id:E,operationId:E,context:h.string(),sealed:Fr.nullable(),expiresAt:Ve,receivedAt:Ve.nullable()}).strict(),vZ=(t,e)=>"oauth-callback:"+t+":"+e;var Tve=["variable","connection","app"],rqe={variable:kt.value,connection:kt.tokenSet,app:kt.clientCredential},wZ=t=>Tve.includes(t);var Wr=class extends Error{constructor(r,o){super(o);this.code=r}code},zg=class extends Wr{constructor(r){super(r.code,"Verify the public keys of "+r.name+" ("+r.id+") before continuing.");this.recipient=r}recipient},I0=(t,...e)=>!!t&&typeof t=="object"&&("code"in t&&e.includes(String(t.code))||"status"in t&&e.includes(Number(t.status)));async function bZ(t,e,r,o){E.parse(r);let n=await t.json("/api/resources/"+E.parse(e),{},mt);return wZ(n.kind)?(await o()).transferProtected(n,r):t.json("/api/resources/"+e+"/transfer",{method:"POST",body:{to:r,version:n.version}},h.union([mt,Br]))}var $0=class{constructor(e,r,o,n,i,s){this.api=e;this.origin=r;this.binding=o;this.keys=n;this.trust=i;this.onRecipientAccess=s}api;origin;binding;keys;trust;onRecipientAccess;verifiedKeys;exclusions=new Map;pendingExclusions=new Map;async trusted(e){if(!await this.verifies(e)){let r=e.principalId===this.binding.principalId?this.binding:await this.known(e.principalId);if(r&&e.principalId!==this.binding.principalId&&e.generation>r.generation&&await this.connectedKeys(r,e)){let o=new Date().toISOString();try{await this.changeKeyring(n=>[...n.filter(i=>i.binding.principalId!==e.principalId),{binding:e,verifiedAt:o}])}catch(n){if(!I0(n,401,403))throw n}return(await this.keyring()).set(e.principalId,{binding:e,verifiedAt:o}),await this.trust.rememberBinding(e),e}throw e.principalId!==this.binding.principalId&&await this.known(e.principalId)?new Wr("identity_changed","Identity "+e.principalId+" replaced the keys verified before. Verify its current keys."):new Wr("identity_untrusted","Verify and trust the encryption and signing keys for identity "+e.principalId+" before sharing.")}return e}async connectedKeys(e,r){if(e.principalId!==r.principalId||r.generation-e.generation>32)return!1;let o=e;for(;o.generation<r.generation;){let{replacement:n}=await this.api.json("/api/identities/"+E.parse(r.principalId)+"/key-replacements/"+E.parse(o.id),{},h.object({replacement:r0.nullable()}));if(!n||!await _g(o,n.replacement.binding,[n]))return!1;o=n.replacement.binding}return M(o)===M(r)}async verifies(e){if(e.principalId===this.binding.principalId)return M(this.binding)===M(e);let r=await this.known(e.principalId);return!!r&&M(r)===M(e)}async known(e){return(await this.keyring()).get(e)?.binding??await this.trust.binding(e)}async verifiedIdentity(e){return this.verifies((await this.inspectIdentity(e)).binding)}keyring(){return this.verifiedKeys??=this.loadKeyring().catch(e=>{throw this.verifiedKeys=void 0,e})}async loadKeyring(){let e;try{e=(await this.readKeyring()).keyring?.keys??[]}catch(i){if(I0(i,401,403))return new Map;throw i}let r=new Set(e.map(i=>i.binding.principalId)),o=new Date().toISOString(),n=(await this.trust.bindings()).filter(i=>i.principalId!==this.binding.principalId&&!r.has(i.principalId));if(n.length)try{e=(await this.changeKeyring(i=>[...i,...n.filter(s=>!i.some(a=>a.binding.principalId===s.principalId)).map(s=>({binding:s,verifiedAt:o}))])).keys}catch(i){if(i instanceof Wr)throw i}return new Map(e.map(i=>[i.binding.principalId,i]))}async readKeyring(){let e="/api/principals/"+this.binding.principalId+"/keyring",{keyring:r}=await this.api.json(e,{},xN),o=await this.trust.keyring(),n=()=>new Wr("keyring_conflict","The list of verified public keys does not match what this device saw before.");if(!r){if(o)throw n();return{version:null,revision:0,keyring:null}}let i=JK(r.signature);if(i.signerId!==this.binding.id)return{version:r.version,revision:i.revision,keyring:null};let s=await s0(r.signature,this.binding).catch(()=>{throw n()}),a=await vt(s);if(s.ownerId!==this.binding.principalId||s.origin!==this.origin||o&&(s.revision<o.revision||s.revision===o.revision&&a!==o.digest))throw n();return(!o||s.revision>o.revision)&&await this.trust.rememberKeyring({revision:s.revision,digest:a}),{version:r.version,revision:s.revision,keyring:s}}async changeKeyring(e){for(let r=1;;r++){let o=await this.readKeyring(),n={origin:this.origin,ownerId:this.binding.principalId,signerId:this.binding.id,revision:o.revision+1,keys:e(o.keyring?.keys??[])};try{await this.api.json("/api/principals/"+this.binding.principalId+"/keyring",{method:"PUT",body:{version:o.version,signature:await i0(n,this.keys.signing)}},xN)}catch(i){if(r<3&&I0(i,"changed"))continue;throw i}return await this.trust.rememberKeyring({revision:n.revision,digest:await vt(n)}),n}}async inspectIdentity(e){let r=await this.api.json("/api/identities/"+E.parse(e)+"/binding",{},er);return await fp(r),{...r,fingerprint:await ic(r.binding)}}async trustIdentity(e,r){let o=await this.inspectIdentity(e);if(o.fingerprint!==r)throw new Wr("fingerprint_mismatch","The identity fingerprint does not match.");if(e===this.binding.principalId||M((await this.keyring()).get(e)?.binding??null)===M(o.binding))return o;let n=new Date().toISOString();try{let i=await this.changeKeyring(s=>[...s.filter(a=>a.binding.principalId!==e),{binding:o.binding,verifiedAt:n}]);this.verifiedKeys=Promise.resolve(new Map(i.keys.map(s=>[s.binding.principalId,s])))}catch(i){if(!I0(i,401,403))throw i;await this.trust.rememberBinding(o.binding)}return o}async recipients(e){let{items:r}=await this.api.json("/api/principals/"+E.parse(e)+"/bound-recipients",{},Qt(Ng)),o=await this.api.json("/api/principals/"+e+"/bound-delegates",{},Qt(Ng));return this.verifiedRecipients(e,r,o.items)}async verifiedRecipients(e,r,o){if(!r.length)throw new Error("Set up an encryption key for the owner before saving private content.");for(let{name:s,...a}of r){await fp(a);try{await this.trusted(a.binding)}catch(c){throw!(c instanceof Wr)||c.code!=="identity_untrusted"&&c.code!=="identity_changed"?c:new zg({id:a.binding.principalId,name:s,code:c.code})}}let n=[],i=[];for(let{name:s,...a}of o){await fp(a);try{n.push(await this.trusted(a.binding))}catch(c){if(!(c instanceof Wr)||c.code!=="identity_untrusted"&&c.code!=="identity_changed")throw c;i.push({id:a.binding.principalId,name:s,code:c.code})}}return this.exclusions.set(e,i),[...r.map(s=>s.binding),...n]}async ownerRecipients(e,r){let o=new Map([...await this.recipients(e),this.binding].map(s=>[s.principalId,s])),n=new Set(this.exclusions.get(e)?.map(s=>s.id)),i=s=>[...new Map([...s.filter(a=>!n.has(a.principalId)).map(a=>o.get(a.principalId)??a),...o.values()].map(a=>[a.principalId,a])).values()];return{readers:i(r?.readers??[]),authorities:i(r?.authorities??[])}}async ownerSide(e){let r=await this.recipients(e);return new Set([...r.map(o=>o.principalId),...(this.exclusions.get(e)??[]).map(o=>o.id)])}async refreshRecipients(e){let r=await this.ownerRecipients(e.ownerId,e),o=M(r)!==M({readers:e.readers,authorities:e.authorities});return{...e,...r,revision:e.revision+(o?1:0)}}async read(e){let r=await this.latest(e);if(r.replaced)throw new Wr("key_replaced","This item is sealed only for keys this identity has since replaced. Enter its value again.");return r}async latest(e){let r=await this.api.json("/api/custody/"+E.parse(e),{},hZ);return this.replaces(r.content.policy)?{...r,replaced:!0}:(await this.observe(r.content,e),{...r,replaced:!1})}replaces(e){return!e.readers.some(r=>M(r)===M(this.binding))&&e.readers.some(r=>r.principalId===this.binding.principalId)}async observe(e,r=e.policy.id){let o=await ac(e);if(o.policy.id!==r||o.policy.origin!==this.origin)throw new Error("The encrypted content belongs to another item.");let n=_N(o);await this.trusted(n);let i=await this.trust.checkpoint(o);if(i&&Wn.parse(i.policy),i){if(o.policy.revision<i.policy.revision||o.materialRevision<i.materialRevision||o.policy.revision===i.policy.revision&&M(o.policy)!==M(i.policy)||o.materialRevision===i.materialRevision&&await vt(o)!==i.digest)throw new Wr("content_conflict","The encrypted content is older than this device has already observed.");if(o.policy.revision>i.policy.revision&&!qK(i.policy,o)&&!i.policy.authorities.some(s=>s.principalId===n.principalId&&s.id!==n.id))throw new Wr("content_conflict","An existing policy authority must approve the new recipients.")}return await this.trust.rememberContent(o),o}async reveal(e){return Jn((await this.read(e)).content,this.binding,this.keys.encryption)}async connection(e){let{content:r}=await this.read(e),o=await Jn(r,this.binding,this.keys.encryption),n=cc(await this.api.json("/api/connections/"+E.parse(e)+"/method",{},ii));return k0(o,r.metadata,n)}async sharing(e){let r=typeof e=="string"?(await this.api.json(e,{},Qt(yZ))).items:e,o={};for(let n of r){let i=await this.read(n.id);if(i.version!==n.version||M(i.content)!==M(n.content))throw new Wr("content_conflict","Review the current content before changing its readers.");for(let s of n.policy.readers)await this.trusted(s);o[n.id]={version:n.version,content:await wp(await Jn(i.content,this.binding,this.keys.encryption),n.policy,i.content.materialRevision+1,this.binding,this.keys,i.content.metadata,i.content)}}return o}async policy(e,r,o={}){let{readers:n,authorities:i}=await this.ownerRecipients(e,o.previous);if(!n.some(s=>M(s)===M(this.binding)))throw new Error("Include your own identity as a reader before creating this item.");return Wn.parse({format:3,id:o.id??o.previous?.id??o.replacing?.id??crypto.randomUUID(),origin:this.origin,ownerId:e,contentType:r,revision:(o.previous?.revision??o.replacing?.revision??0)+1,authorities:i,readers:n,...o.previous?.observers?{observers:o.previous.observers}:{}})}async save(e,r,o,n={}){let i=n.previous;i&&M(o)===M({...i.content.policy,revision:o.revision})&&(o={...o,revision:i.content.policy.revision});let s=await wp(r,o,(i?.content.materialRevision??0)+1,this.binding,this.keys,n.metadata,i&&!this.replaces(i.content.policy)?i.content:void 0),a={name:e,content:s,...n.labels?{labels:n.labels}:{},...i?{version:i.version}:{}},c=n.commit?await n.commit(a):await this.api.json("/api/resources/"+o.id+"/custody",{method:"PUT",body:a},mt);return await this.trust.rememberContent(s),this.onRecipientAccess?.({id:c.id,name:c.name,excluded:this.exclusions.get(o.ownerId)??[]}),c}async transferProtected(e,r){let o="/api/resources/"+e.id+"/transfer",n=await this.read(e.id);if(n.version!==e.version)throw new Wr("changed","This item changed. Reload it before transferring it.");let i=await this.api.json(o+"-recipients?to="+encodeURIComponent(r),{},mZ),s=await this.verifiedRecipients(r,i.required,i.delegates),a={...n.content.policy,ownerId:r,revision:n.content.policy.revision+1,readers:s,authorities:s,observers:[]},c=await wp(await Jn(n.content,this.binding,this.keys.encryption),a,n.content.materialRevision+1,this.binding,this.keys,n.content.metadata,n.content),u=await this.api.json(o,{method:"POST",body:{to:r,content:c,version:n.version}},h.union([mt,Br]));return"kind"in u&&await this.trust.rememberContent(c),this.onRecipientAccess?.({id:u.id,name:e.name,operation:"transfer",excluded:this.exclusions.get(r)??[]}),"kind"in u?u:{...u,url:u.url+(u.url.includes("#")?"&":"#")+"fingerprint="+await ic(this.binding)}}async pendingProtection(){return(await this.api.json("/api/principals/"+this.binding.principalId+"/reprotection",{},Qt(gZ))).items}async reprotect(e,r=[]){let o=await this.read(e),{policy:n}=o.content,i={...n,...await this.resealed(e,n,new Set(r))};if(M({...i,revision:n.revision})===M(n))return null;let s=await this.api.json("/api/resources/"+n.id,{},mt);return this.save(s.name,await Jn(o.content,this.binding,this.keys.encryption),i,{metadata:o.content.metadata,previous:o})}async resealed(e,r,o){let n=await this.recipients(r.ownerId),i=this.exclusions.get(r.ownerId)??[];this.pendingExclusions.set(e,i);for(let m of i)o.add(m.id);let s=new Map(n.map(m=>[m.principalId,m])),a=[...r.readers,...r.authorities];for(let m of new Set(a.map(g=>g.principalId))){if(m===this.binding.principalId||s.has(m)||o.has(m))continue;let g=await this.inspectIdentity(m).then(y=>y.binding,()=>null);g&&a.some(y=>y.principalId===m&&y.id!==g.id)&&s.set(m,await this.trusted(g))}let c=m=>s.get(m.principalId)??m,u=m=>[...new Map(m.map(g=>[g.id,g])).values()],l=m=>!o.has(m.principalId),d=u(r.readers.filter(l).map(c)),f=u(r.authorities.filter(l).map(c)),p=n.filter(m=>!d.some(g=>g.id===m.id));return{revision:r.revision+1,readers:[...d,...p],authorities:[...f,...p.filter(m=>!f.some(g=>g.id===m.id))],...r.observers?{observers:r.observers.filter(m=>!o.has(m))}:{}}}async reprotectPending(e){let r=[],o=[],n=await this.pendingProtection(),i=0;e?.({completed:i,total:n.length});for(let a of n){try{await this.reprotect(a.id,a.remove)&&r.push(a.id);let c=this.pendingExclusions.get(a.id);c?.length&&o.push({id:a.id,code:"recipient_excluded",verification:c})}catch(c){o.push({id:a.id,code:c&&typeof c=="object"&&"code"in c&&typeof c.code=="string"?c.code:"failure"})}e?.({completed:++i,total:n.length})}let s=await this.endorseKeyRotations();return{done:[...r,...s.done],failed:[...o,...s.failed]}}async endorseKeyRotations(){let e=[],r=[],{items:o}=await this.api.json("/api/key-rotations/requests",{},h.object({items:h.array(eq)}));for(let n of o)try{let{rotation:i}=n,s=i.previous.binding,a=i.replacement.binding;if(await this.trusted(s),!await _g(s,a,[{previous:i.previous,replacement:i.replacement,previousSignature:i.previousSignature}]))throw new Wr("identity_changed","The replacement keys were not signed with the verified keys.");await this.api.json("/api/principals/"+E.parse(i.principalId)+"/key-rotations/"+E.parse(i.id)+"/items/"+n.kind+"/"+E.parse(n.id)+"/endorsement",{method:"PUT",body:{sourceDigest:n.sourceDigest,payload:await sq(n,this.binding,this.keys)}}),e.push(n.id)}catch(i){r.push({id:n.id,code:i&&typeof i=="object"&&"code"in i&&typeof i.code=="string"?i.code:"failure"})}return{done:e,failed:r}}async sourceContents(e){let r=new Map;for(let o of new Set(e))r.set(o,(await this.read(o)).content);for(let o of[...r.values()])o.policy.contentType===kt.tokenSet&&typeof o.metadata.appId=="string"&&!r.has(o.metadata.appId)&&r.set(o.metadata.appId,(await this.read(o.metadata.appId)).content);return[...r.values()]}};var A0=class{constructor(e){this.journal=e}journal;binding(e){return this.journal.read("identity_"+e)}async bindings(){return(await Promise.all((await this.journal.keys("identity_")).map(r=>this.journal.read(r)))).filter(r=>r!==null)}async rememberBinding(e){await hp(e),await this.journal.write("identity_"+e.principalId,e)}keyring(){return this.journal.read("checkpoint_keyring")}async rememberKeyring(e){await this.journal.write("checkpoint_keyring",e)}checkpoint(e){return this.journal.read("checkpoint_"+e.policy.format+"_"+e.policy.id)}async rememberContent(e){await this.journal.write("checkpoint_"+e.policy.format+"_"+e.policy.id,{policy:e.policy,materialRevision:e.materialRevision,digest:await vt(e)})}};var T0=class{api;constructor(e){this.api={async json(r,o={},n){try{return await e.json(r,o,n)}catch(i){throw i instanceof Error&&"status"in i&&typeof i.status=="number"&&"code"in i&&typeof i.code=="string"?new Er(i.status,i.code,i.message):i}}}}connections(){let e=this.api;return{method:async r=>cc(await e.json("/api/connections/"+r+"/method",{},ii)),prepare:(r,o,n)=>e.json("/api/connection-operations",{method:"POST",body:{id:r,resourceId:o,expectedRevision:n}},Dg),dispatch:(r,o)=>e.json("/api/connection-operations/"+r+"/dispatch",{method:"POST",body:{fence:o}},Dg),commit:(r,o,n)=>e.json("/api/connection-operations/"+r+"/commit",{method:"POST",body:{fence:o,content:n}},Hr),uncertain:(r,o)=>e.json("/api/connection-operations/"+r+"/uncertain",{method:"POST",body:{fence:o}}),abort:(r,o)=>e.json("/api/connection-operations/"+r+"/abort",{method:"POST",body:{fence:o}},Dg),state:r=>e.json("/api/connections/"+r+"/operation",{},Dg.nullable())}}};import{randomUUID as tRe}from"node:crypto";var Aa=St(doe(),1);import{randomUUID as WTe}from"node:crypto";function poe(t){let e=Lx.safeParse({accountId:t.Account,arn:t.Arn,principalId:t.Arn?.includes(":assumed-role/")?t.UserId?.split(":")[0]:t.UserId});return(!e.success||e.data.arn.split(":")[4]!==e.data.accountId)&&C(502,"invalid_response","The AWS account could not be verified."),e.data}function foe(t,e){return t.accountId===e.accountId&&t.principalId===e.principalId&&lp(t.arn)===lp(e.arn)}function a4(t){t&&(!Number.isFinite(t.getTime())||t.getTime()<=Date.now())&&C(409,"reconnect_required","Reconnect with current AWS credentials.")}var G$=class{async obtain(e,r,o){let n=aa.parse({authentication:e.authentication,region:e.region,...e.role?{role:e.role}:{}}),i=n.authentication,s=i.kind==="environment"?void 0:{accessKeyId:i.accessKeyId,secretAccessKey:i.secretAccessKey,...i.kind==="session"?{sessionToken:i.sessionToken,expiration:new Date(i.expiresAt)}:{}};a4(s?.expiration);let a=new Aa.STSClient({region:n.region,...s?{credentials:s}:{}}),c,u=AbortSignal.any([AbortSignal.timeout(2e4),...o?[o]:[]]),l=!1;try{let d=s??await a.config.credentials();a4(d.expiration),c=new Aa.STSClient({region:n.region,credentials:d});let f=r?.sourceIdentity?poe(await c.send(new Aa.GetCallerIdentityCommand({}),{abortSignal:u})):void 0;r?.sourceIdentity&&f&&!foe(f,r.sourceIdentity)&&C(409,"account_changed","Reconnect to approve the current AWS authentication source.");let p=d,m=f;if(n.role){l=!0;let w=(await c.send(new Aa.AssumeRoleCommand({RoleArn:n.role.arn,RoleSessionName:"foundation-"+WTe().slice(0,8),DurationSeconds:3600,...n.role.externalId?{ExternalId:n.role.externalId}:{}}),{abortSignal:u})).Credentials;(!w?.AccessKeyId||!w.SecretAccessKey||!w.SessionToken||!w.Expiration)&&C(502,"invalid_response","AWS did not return credentials."),p={accessKeyId:w.AccessKeyId,secretAccessKey:w.SecretAccessKey,sessionToken:w.SessionToken,expiration:w.Expiration},a4(p.expiration),r?.identity&&(c.destroy(),c=new Aa.STSClient({region:n.region,credentials:p}),m=poe(await c.send(new Aa.GetCallerIdentityCommand({}),{abortSignal:u})))}return r?.identity&&m&&!foe(m,r.identity)&&C(409,"account_changed","Reconnect to approve the current AWS account and role."),{state:Fx.parse({...n,sourceIdentity:f,identity:m}),credentials:{AWS_ACCESS_KEY_ID:p.accessKeyId,AWS_SECRET_ACCESS_KEY:p.secretAccessKey,AWS_SESSION_TOKEN:p.sessionToken??"",AWS_DEFAULT_REGION:n.region,AWS_REGION:n.region}}}catch(d){if(d instanceof Er)throw d;o?.aborted&&C(409,"cancelled","The operation was cancelled."),d instanceof Error&&["ExpiredToken","ExpiredTokenException","TokenRefreshRequired"].includes(d.name)&&C(409,"reconnect_required","Reconnect with current AWS credentials."),l&&C(502,"role_denied","Check the IAM role and its trust policy for this authentication source."),C(502,"aws_authentication_failed","Check the AWS credentials available on this machine.")}finally{c?.destroy(),a.destroy()}}};var X$=class{constructor(e){this.aws=e}aws;facts=TN;needsRenewal(){return!1}async outputs(e,r,o){return(await this.aws.obtain(e.aws,e.aws,o)).credentials}};var c4;(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(c4="oauth4webapi/v3.8.8");function rA(t,e){if(t==null)return!1;try{return t instanceof e||Object.getPrototypeOf(t)[Symbol.toStringTag]===e.prototype[Symbol.toStringTag]}catch{return!1}}var Bs="ERR_INVALID_ARG_VALUE",Ta="ERR_INVALID_ARG_TYPE";function sr(t,e,r){let o=new TypeError(t,{cause:r});return Object.assign(o,{code:e}),o}var goe=Symbol(),JTe=Symbol(),GTe=Symbol(),y4=Symbol();var Fv=Symbol();var XTe=new TextEncoder,YTe=new TextDecoder;function u4(t){return typeof t=="string"?XTe.encode(t):YTe.decode(t)}var l4;Uint8Array.prototype.toBase64?l4=t=>(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t.toBase64({alphabet:"base64url",omitPadding:!0})):l4=e=>{e instanceof ArrayBuffer&&(e=new Uint8Array(e));let r=[];for(let o=0;o<e.byteLength;o+=32768)r.push(String.fromCharCode.apply(null,e.subarray(o,o+32768)));return btoa(r.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")};var d4;Uint8Array.fromBase64?d4=t=>{try{return Uint8Array.fromBase64(t,{alphabet:"base64url"})}catch(e){throw sr("The input to be decoded is not correctly encoded.",Bs,e)}}:d4=t=>{try{let e=atob(t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);return r}catch(e){throw sr("The input to be decoded is not correctly encoded.",Bs,e)}};function p4(t){return typeof t=="string"?d4(t):l4(t)}var Gf=class extends Error{code;constructor(e,r){super(e,r),this.name=this.constructor.name,this.code=PPe,Error.captureStackTrace?.(this,this.constructor)}},Vv=class extends Error{code;constructor(e,r){super(e,r),this.name=this.constructor.name,r?.code&&(this.code=r?.code),Error.captureStackTrace?.(this,this.constructor)}};function ve(t,e,r){return new Vv(t,{code:e,cause:r})}function Y$(t){return!(t===null||typeof t!="object"||Array.isArray(t))}function yoe(t){rA(t,Headers)&&(t=Object.fromEntries(t.entries()));let e=new Headers(t??{});if(c4&&!e.has("user-agent")&&e.set("user-agent",c4),e.has("authorization"))throw sr('"options.headers" must not include the "authorization" header name',Bs);return e}function QTe(t,e){if(e!==void 0){if(typeof e=="function"&&(e=e(t.href)),!(e instanceof AbortSignal))throw sr('"options.signal" must return or be an instance of AbortSignal',Ta);return e}}function Xf(t,e,r,o,n){try{if(typeof t!="number"||!Number.isFinite(t))throw sr(`${r} must be a number`,Ta,n);if(t>0)return;if(e){if(t!==0)throw sr(`${r} must be a non-negative number`,Bs,n);return}throw sr(`${r} must be a positive number`,Bs,n)}catch(i){throw o?ve(i.message,o,n):i}}function Gt(t,e,r,o){try{if(typeof t!="string")throw sr(`${e} must be a string`,Ta,o);if(t.length===0)throw sr(`${e} must not be empty`,Bs,o)}catch(n){throw r?ve(n.message,r,o):n}}function voe(t){tPe(t,"application/json")}function ePe(t,...e){let r='"response" content-type must be ';if(e.length>2){let o=e.pop();r+=`${e.join(", ")}, or ${o}`}else e.length===2?r+=`${e[0]} or ${e[1]}`:r+=e[0];return ve(r,CPe,t)}function tPe(t,e){if(hPe(t)!==e)throw ePe(t,e)}async function woe(t){return Gt(t,"codeVerifier"),p4(await crypto.subtle.digest("SHA-256",u4(t)))}function boe(t){let e=t?.[JTe];return typeof e=="number"&&Number.isFinite(e)?e:0}function _oe(t){let e=t?.[GTe];return typeof e=="number"&&Number.isFinite(e)&&Math.sign(e)!==-1?e:30}function Soe(){return Math.floor(Date.now()/1e3)}function au(t){if(typeof t!="object"||t===null)throw sr('"as" must be an object',Ta);Gt(t.issuer,'"as.issuer"')}function cu(t){if(typeof t!="object"||t===null)throw sr('"client" must be an object',Ta);Gt(t.client_id,'"client.client_id"')}function moe(t){return encodeURIComponent(t).replace(/(?:[-_.!~*'()]|%20)/g,e=>{switch(e){case"-":case"_":case".":case"!":case"~":case"*":case"'":case"(":case")":return`%${e.charCodeAt(0).toString(16).toUpperCase()}`;case"%20":return"+";default:throw new Error}})}function xoe(t){return Gt(t,'"clientSecret"'),(e,r,o,n)=>{o.set("client_id",r.client_id),o.set("client_secret",t)}}function Eoe(t){return Gt(t,'"clientSecret"'),(e,r,o,n)=>{let i=moe(r.client_id),s=moe(t),a=btoa(`${i}:${s}`);n.set("authorization",`Basic ${a}`)}}function koe(){return(t,e,r,o)=>{r.set("client_id",e.client_id)}}var rPe=URL.parse?(t,e)=>URL.parse(t,e):(t,e)=>{try{return new URL(t,e)}catch{return null}};function nPe(t,e){if(e&&t.protocol!=="https:")throw ve("only requests to HTTPS are allowed",NPe,t);if(t.protocol!=="https:"&&t.protocol!=="http:")throw ve("only HTTP and HTTPS requests are allowed",DPe,t)}function hoe(t,e,r,o){let n;if(typeof t!="string"||!(n=rPe(t)))throw ve(`authorization server metadata does not contain a valid ${r?`"as.mtls_endpoint_aliases.${e}"`:`"as.${e}"`}`,t===void 0?zPe:jPe,{attribute:r?`mtls_endpoint_aliases.${e}`:e});return nPe(n,o),n}function Ioe(t,e,r,o){return r&&t.mtls_endpoint_aliases&&e in t.mtls_endpoint_aliases?hoe(t.mtls_endpoint_aliases[e],e,r,o):hoe(t[e],e,r,o)}var f4=class extends Error{cause;code;error;status;error_description;response;constructor(e,r){super(e,r),this.name=this.constructor.name,this.code=TPe,this.cause=r.cause,this.error=r.cause.error,this.status=r.response.status,this.error_description=r.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:r.response}),Error.captureStackTrace?.(this,this.constructor)}},Hv=class extends Error{cause;code;error;error_description;constructor(e,r){super(e,r),this.name=this.constructor.name,this.code=RPe,this.cause=r.cause,this.error=r.cause.get("error"),this.error_description=r.cause.get("error_description")??void 0,Error.captureStackTrace?.(this,this.constructor)}},m4=class extends Error{cause;code;response;status;constructor(e,r){super(e,r),this.name=this.constructor.name,this.code=APe,this.cause=r.cause,this.status=r.response.status,this.response=r.response,Object.defineProperty(this,"response",{enumerable:!1}),Error.captureStackTrace?.(this,this.constructor)}},Q$="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",oPe="[a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2}",iPe='"((?:[^"\\\\]|\\\\[\\s\\S])*)"',sPe="("+Q$+")\\s*=\\s*"+iPe,aPe="("+Q$+")\\s*=\\s*("+Q$+")",cPe=new RegExp("^[,\\s]*("+Q$+")"),uPe=new RegExp("^[,\\s]*"+sPe+"[,\\s]*(.*)"),lPe=new RegExp("^[,\\s]*"+aPe+"[,\\s]*(.*)"),dPe=new RegExp("^("+oPe+")(?:$|[,\\s])(.*)");function pPe(t){if(!rA(t,Response))throw sr('"response" must be an instance of Response',Ta);let e=t.headers.get("www-authenticate");if(e===null)return;let r=[],o=e;for(;o;){let n=o.match(cPe),i=n?.[1].toLowerCase();if(!i)return;let s=o.substring(n[0].length);if(s&&!s.match(/^[\s,]/))return;let a=s.match(/^\s+(.*)$/),c=!!a;o=a?a[1]:void 0;let u={},l;if(c)for(;o;){let f,p;if(n=o.match(uPe)){[,f,p,o]=n,p.includes("\\")&&(p=p.replace(/\\([\s\S])/g,"$1")),u[f.toLowerCase()]=p;continue}if(n=o.match(lPe)){[,f,p,o]=n,u[f.toLowerCase()]=p;continue}if(n=o.match(dPe)){if(Object.keys(u).length)break;[,l,o]=n;break}return}else o=s||void 0;let d={scheme:i,parameters:u};l&&(d.token68=l),r.push(d)}if(r.length)return r}async function fPe(t){if(t.status>399&&t.status<500){b4(t),voe(t);try{let e=await t.clone().json();if(Y$(e)&&typeof e.error=="string"&&e.error.length)return e}catch{}}}async function $oe(t,e,r){if(t.status!==e){yPe(t);let o;throw(o=await fPe(t))?(await t.body?.cancel(),new f4("server responded with an error in the response body",{cause:o,response:t})):ve(`"response" is not a conform ${r} response (unexpected HTTP status code)`,OPe,t)}}function mPe(t){if(!v4.has(t))throw sr('"options.DPoP" is not a valid DPoPHandle',Bs)}function hPe(t){return t.headers.get("content-type")?.split(";")[0]}async function Aoe(t,e,r,o,n,i,s){return await r(t,e,n,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),(s?.[y4]||fetch)(o.href,{body:n,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:QTe(o,s?.signal)})}async function nA(t,e,r,o,n,i){let s=Ioe(t,"token_endpoint",e.use_mtls_endpoint_aliases,i?.[goe]!==!0);n.set("grant_type",o);let a=yoe(i?.headers);a.set("accept","application/json"),i?.DPoP!==void 0&&(mPe(i.DPoP),await i.DPoP.addProof(s,a,"POST"));let c=await Aoe(t,e,r,s,n,a,i);return i?.DPoP?.cacheNonce(c,s),c}async function Toe(t,e,r,o,n){au(t),cu(e),Gt(o,'"refreshToken"');let i=new URLSearchParams(n?.additionalParameters);return i.set("refresh_token",o),nA(t,e,r,"refresh_token",i,n)}var Poe=new WeakMap,gPe=new WeakMap;function Roe(t){if(!t.id_token)return;let e=Poe.get(t);if(!e)throw sr('"ref" was already garbage collected or did not resolve from the proper sources',Bs);return e}async function Bv(t,e,r,o,n,i){if(au(t),cu(e),!rA(r,Response))throw sr('"response" must be an instance of Response',Ta);await $oe(r,200,"Token Endpoint"),b4(r);let s=await qoe(r);if(Gt(s.access_token,'"response" body "access_token" property',Me,{body:s}),Gt(s.token_type,'"response" body "token_type" property',Me,{body:s}),s.token_type=s.token_type.toLowerCase(),s.expires_in!==void 0){let a=typeof s.expires_in!="number"?parseFloat(s.expires_in):s.expires_in;Xf(a,!0,'"response" body "expires_in" property',Me,{body:s}),s.expires_in=a}if(s.refresh_token!==void 0&&Gt(s.refresh_token,'"response" body "refresh_token" property',Me,{body:s}),s.scope!==void 0&&typeof s.scope!="string")throw ve('"response" body "scope" property must be a string',Me,{body:s});if(s.id_token!==void 0){Gt(s.id_token,'"response" body "id_token" property',Me,{body:s});let a=[];e.require_auth_time===!0&&a.push("auth_time"),e.default_max_age!==void 0&&(Xf(e.default_max_age,!0,'"client.default_max_age"'),a.push("auth_time")),o?.length&&a.push(...o);let{claims:c,jwt:u}=await xPe(t,e,s.id_token,a,n);kPe(e,c),EPe(c),gPe.set(r,u),Poe.set(s,c)}if(i?.[s.token_type]!==void 0)i[s.token_type](r,s);else if(s.token_type!=="dpop"&&s.token_type!=="bearer")throw new Gf("unsupported `token_type` value",{cause:{body:s}});return s}function yPe(t){let e;if(e=pPe(t))throw new m4("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:e,response:t})}async function Coe(t,e,r,o){return Bv(t,e,r,void 0,o?.[Fv],o?.recognizedTokenTypes)}function vPe(t,e){if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(t))throw ve('unexpected JWT "aud" (audience) claim value',Yf,{expected:t,claims:e.claims,claim:"aud"})}else if(e.claims.aud!==t)throw ve('unexpected JWT "aud" (audience) claim value',Yf,{expected:t,claims:e.claims,claim:"aud"});return e}function wPe(t,e){let r=t[VPe]?.(e)??t.issuer;if(e.claims.iss!==r)throw ve('unexpected JWT "iss" (issuer) claim value',Yf,{expected:r,claims:e.claims,claim:"iss"});return e}var v4=new WeakSet;function bPe(t){return v4.add(t),t}var w4=Symbol();async function Ooe(t,e,r,o,n,i,s){if(au(t),cu(e),!v4.has(o))throw sr('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Bs);Gt(n,'"redirectUri"');let a=Ul(o,"code");if(!a)throw ve('no authorization code in "callbackParameters"',Me);let c=new URLSearchParams(s?.additionalParameters);return c.set("redirect_uri",n),c.set("code",a),i!==w4&&(Gt(i,'"codeVerifier"'),c.set("code_verifier",i)),nA(t,e,r,"authorization_code",c,s)}var Noe={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function _Pe(t,e){for(let r of t)if(e.claims[r]===void 0)throw ve(`JWT "${r}" (${Noe[r]}) claim missing`,Me,{claims:e.claims});return e}function SPe(t,e){if(typeof e.claims[t]!="string")throw ve(`unexpected JWT "${t}" (${Noe[t]}) claim type`,Me,{claims:e.claims});return e}function xPe(t,e,r,o,n){return MPe(r,UPe.bind(void 0,e.id_token_signed_response_alg,t.id_token_signing_alg_values_supported,"RS256"),boe(e),_oe(e),n).then(_Pe.bind(void 0,["aud","exp","iat","iss","sub",...o])).then(wPe.bind(void 0,t)).then(vPe.bind(void 0,e.client_id)).then(SPe.bind(void 0,"sub"))}function Doe(t,e){if(e===tA)return e;let r=e===void 0;return r&&(e=t.default_max_age),e===void 0?tA:(Xf(e,!0,r?'"client.default_max_age"':'"maxAge" argument'),e)}function EPe(t){t.auth_time!==void 0&&Xf(t.auth_time,!0,'ID Token "auth_time" (authentication time)',Me,{claims:t})}function zoe(t,e,r){if(r===tA)return;let o=Soe()+boe(t),n=_oe(t);if(e.auth_time+r<o-n)throw ve("too much time has elapsed since the last End-User authentication",g4,{claims:e,now:o,tolerance:n,claim:"auth_time"})}function joe(t,e){let r=e===eA?void 0:e;if(t.nonce!==r)throw ve('unexpected ID Token "nonce" claim value',Yf,{expected:r,claims:t,claim:"nonce"})}function kPe(t,e){if(Array.isArray(e.aud)&&e.aud.length!==1){if(e.azp===void 0)throw ve('ID Token "aud" (audience) claim includes additional untrusted audiences',Yf,{claims:e,claim:"aud"});if(e.azp!==t.client_id)throw ve('unexpected ID Token "azp" (authorized party) claim value',Yf,{expected:t.client_id,claims:e,claim:"azp"})}}var eA=Symbol(),tA=Symbol();async function Moe(t,e,r,o){return typeof o?.expectedNonce=="string"||typeof o?.maxAge=="number"||o?.requireIdToken?IPe(t,e,r,o.expectedNonce,o.maxAge,o[Fv],o.recognizedTokenTypes):$Pe(t,e,r,o?.maxAge,o?.[Fv],o?.recognizedTokenTypes)}async function IPe(t,e,r,o,n,i,s){let a=[];switch(o){case void 0:o=eA;break;case eA:break;default:Gt(o,'"expectedNonce" argument'),a.push("nonce")}n=Doe(e,n),n!==tA&&a.push("auth_time");let c=await Bv(t,e,r,a,i,s);Gt(c.id_token,'"response" body "id_token" property',Me,{body:c});let u=Roe(c);return zoe(e,u,n),joe(u,o),c}async function $Pe(t,e,r,o,n,i){let s=await Bv(t,e,r,void 0,n,i),a=Roe(s);return a&&(zoe(e,a,Doe(e,o)),joe(a,eA)),s}var APe="OAUTH_WWW_AUTHENTICATE_CHALLENGE",TPe="OAUTH_RESPONSE_BODY_ERROR",PPe="OAUTH_UNSUPPORTED_OPERATION",RPe="OAUTH_AUTHORIZATION_RESPONSE_ERROR";var h4="OAUTH_PARSE_ERROR",Me="OAUTH_INVALID_RESPONSE";var CPe="OAUTH_RESPONSE_IS_NOT_JSON",OPe="OAUTH_RESPONSE_IS_NOT_CONFORM",NPe="OAUTH_HTTP_REQUEST_FORBIDDEN",DPe="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",g4="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",Yf="OAUTH_JWT_CLAIM_COMPARISON_FAILED";var zPe="OAUTH_MISSING_SERVER_METADATA",jPe="OAUTH_INVALID_SERVER_METADATA";async function Uoe(t,e,r,o,n){return au(t),cu(e),nA(t,e,r,"client_credentials",new URLSearchParams(o),n)}async function Loe(t,e,r,o){return Bv(t,e,r,void 0,o?.[Fv],o?.recognizedTokenTypes)}function b4(t){if(t.bodyUsed)throw sr('"response" body has been used already',Bs)}async function MPe(t,e,r,o,n){let{0:i,1:s,length:a}=t.split(".");if(a===5)if(n!==void 0)t=await n(t),{0:i,1:s,length:a}=t.split(".");else throw new Gf("JWE decryption is not configured",{cause:t});if(a!==3)throw ve("Invalid JWT",Me,t);let c;try{c=JSON.parse(u4(p4(i)))}catch(d){throw ve("failed to parse JWT Header body as base64url encoded JSON",h4,d)}if(!Y$(c))throw ve("JWT Header must be a top level object",Me,t);if(e(c),c.crit!==void 0)throw new Gf('no JWT "crit" header parameter extensions are supported',{cause:{header:c}});let u;try{u=JSON.parse(u4(p4(s)))}catch(d){throw ve("failed to parse JWT Payload body as base64url encoded JSON",h4,d)}if(!Y$(u))throw ve("JWT Payload must be a top level object",Me,t);let l=Soe()+r;if(u.exp!==void 0){if(typeof u.exp!="number")throw ve('unexpected JWT "exp" (expiration time) claim type',Me,{claims:u});if(u.exp<=l-o)throw ve('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',g4,{claims:u,now:l,tolerance:o,claim:"exp"})}if(u.iat!==void 0&&typeof u.iat!="number")throw ve('unexpected JWT "iat" (issued at) claim type',Me,{claims:u});if(u.iss!==void 0&&typeof u.iss!="string")throw ve('unexpected JWT "iss" (issuer) claim type',Me,{claims:u});if(u.nbf!==void 0){if(typeof u.nbf!="number")throw ve('unexpected JWT "nbf" (not before) claim type',Me,{claims:u});if(u.nbf>l+o)throw ve('unexpected JWT "nbf" (not before) claim value',g4,{claims:u,now:l,tolerance:o,claim:"nbf"})}if(u.aud!==void 0&&typeof u.aud!="string"&&!Array.isArray(u.aud))throw ve('unexpected JWT "aud" (audience) claim type',Me,{claims:u});return{header:c,claims:u,jwt:t}}function UPe(t,e,r,o){if(t!==void 0){if(typeof t=="string"?o.alg!==t:!t.includes(o.alg))throw ve('unexpected JWT "alg" header parameter',Me,{header:o,expected:t,reason:"client configuration"});return}if(Array.isArray(e)){if(!e.includes(o.alg))throw ve('unexpected JWT "alg" header parameter',Me,{header:o,expected:e,reason:"authorization server metadata"});return}if(r!==void 0){if(typeof r=="string"?o.alg!==r:typeof r=="function"?!r(o.alg):!r.includes(o.alg))throw ve('unexpected JWT "alg" header parameter',Me,{header:o,expected:r,reason:"default value"});return}throw ve('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:t,issuer:e,fallback:r})}function Ul(t,e){let{0:r,length:o}=t.getAll(e);if(o>1)throw ve(`"${e}" parameter must be provided only once`,Me);return r}var LPe=Symbol(),FPe=Symbol();function Foe(t,e,r,o){if(au(t),cu(e),r instanceof URL&&(r=r.searchParams),!(r instanceof URLSearchParams))throw sr('"parameters" must be an instance of URLSearchParams, or URL',Ta);if(Ul(r,"response"))throw ve('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Me,{parameters:r});let n=Ul(r,"iss"),i=Ul(r,"state");if(!n&&t.authorization_response_iss_parameter_supported)throw ve('response parameter "iss" (issuer) missing',Me,{parameters:r});if(n&&n!==t.issuer)throw ve('unexpected "iss" (issuer) response parameter value',Me,{expected:t.issuer,parameters:r});switch(o){case void 0:case FPe:if(i!==void 0)throw ve('unexpected "state" response parameter encountered',Me,{expected:void 0,parameters:r});break;case LPe:break;default:if(Gt(o,'"expectedState" argument'),i!==o)throw ve(i===void 0?'response parameter "state" missing':'unexpected "state" response parameter value',Me,{expected:o,parameters:r})}if(Ul(r,"error"))throw new Hv("authorization response from the server is an error",{cause:r});let a=Ul(r,"id_token"),c=Ul(r,"token");if(a!==void 0||c!==void 0)throw new Gf("implicit and hybrid flows are not supported");return bPe(new URLSearchParams(r))}async function Voe(t,e,r,o,n){au(t),cu(e);let i=Ioe(t,"device_authorization_endpoint",e.use_mtls_endpoint_aliases,n?.[goe]!==!0),s=new URLSearchParams(o);s.set("client_id",e.client_id);let a=yoe(n?.headers);return a.set("accept","application/json"),Aoe(t,e,r,i,s,a,n)}async function Hoe(t,e,r){if(au(t),cu(e),!rA(r,Response))throw sr('"response" must be an instance of Response',Ta);await $oe(r,200,"Device Authorization Endpoint"),b4(r);let o=await qoe(r);Gt(o.device_code,'"response" body "device_code" property',Me,{body:o}),Gt(o.user_code,'"response" body "user_code" property',Me,{body:o}),Gt(o.verification_uri,'"response" body "verification_uri" property',Me,{body:o});let n=typeof o.expires_in!="number"?parseFloat(o.expires_in):o.expires_in;return Xf(n,!0,'"response" body "expires_in" property',Me,{body:o}),o.expires_in=n,o.verification_uri_complete!==void 0&&Gt(o.verification_uri_complete,'"response" body "verification_uri_complete" property',Me,{body:o}),o.interval!==void 0&&Xf(o.interval,!1,'"response" body "interval" property',Me,{body:o}),o}async function Boe(t,e,r,o,n){au(t),cu(e),Gt(o,'"deviceCode"');let i=new URLSearchParams(n?.additionalParameters);return i.set("device_code",o),nA(t,e,r,"urn:ietf:params:oauth:grant-type:device_code",i,n)}async function Koe(t,e,r,o){return Bv(t,e,r,void 0,o?.[Fv],o?.recognizedTokenTypes)}async function qoe(t,e=voe){let r;try{r=await t.json()}catch(o){throw e(t),ve('failed to parse "response" body as JSON',h4,o)}if(!Y$(r))throw ve('"response" body must be a top level object',Me,{body:r});return r}var VPe=Symbol();var Qf=St(Woe(),1);var BPe=Qf.default.IPv6.parseCIDR("2000::/3"),KPe=new Set(["unicast","amt","as112","as112v6","orchid2","droneRemoteIdProtocolEntityTags"]);function sA(t){if(!Qf.default.isValid(t)||t.includes("%"))return!1;let e=Qf.default.parse(t);return KPe.has(e.range())&&(!(e instanceof Qf.default.IPv6)||e.match(BPe))}function co(t,e){let r;try{r=new URL(t)}catch{C(400,"invalid_url","Enter an absolute HTTPS URL.")}(r.protocol!=="https:"||r.username||r.password||r.hash||r.port&&r.port!=="443"||r.origin===e)&&C(400,"invalid_url","Choose a public HTTPS destination.");let o=r.hostname.replace(/^\[|\]$/g,"");return(o==="localhost"||o.endsWith(".localhost")||o.endsWith(".local")||Qf.default.isValid(o)&&!sA(o))&&C(400,"private_destination","Choose a public HTTPS destination."),r}function zi(t){let e;try{e=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(t.body))}catch{C(502,"invalid_response","The service returned an invalid response.")}return(!e||typeof e!="object"||Array.isArray(e))&&C(502,"invalid_response","The service returned an invalid response."),e}var iA=class{constructor(e){this.origin=e}origin;async send(e){let r=co(e.url,this.origin),o=e.maxBytes??1048576;e.body&&(typeof e.body=="string"?new TextEncoder().encode(e.body).length:e.body.length)>o&&C(413,"body_limit","The request body is too large.");let n;try{n=await fetch(r,{method:e.method??"GET",headers:e.headers,body:typeof e.body=="string"?e.body:e.body?new Uint8Array(e.body):void 0,credentials:"omit",redirect:"error",referrerPolicy:"no-referrer",signal:AbortSignal.any([AbortSignal.timeout(2e4),...e.signal?[e.signal]:[]])})}catch{e.signal?.aborted&&C(409,"cancelled","The operation was cancelled."),C(409,"browser_exchange_unavailable","Restart authorization using the CLI on this device.")}let i=n.body?.getReader(),s=[],a=0;if(i)try{for(;;){let l=await i.read();if(l.done)break;a+=l.value.length,a>o&&C(413,"body_limit","The response body is too large."),s.push(l.value)}}finally{await i.cancel()}let c=new Uint8Array(a),u=0;for(let l of s)c.set(l,u),u+=l.length;return{status:n.status,headers:Object.fromEntries(n.headers),body:c}}};var Joe=Object.assign(Object.create(null),{dpop:()=>C(502,"invalid_response","The service returned an unsupported token.")}),qPe={redirectUri:t=>t.fields.ruName,recognizedTokenTypes:Object.assign(Object.create(null),Joe,{"user access token":()=>{}})},ZPe={authorize(t,e){delete t.response_type,delete t.client_id,delete t.redirect_uri,t.callback_url=e,t.key_label="Foundation"},async exchange({spec:t,transport:e,url:r,authorization:o,verifier:n}){let i=o.parameters;return(i.getAll("state").length!==1||i.get("state")!==o.state||i.getAll("code").length!==1||!i.get("code"))&&C(400,"invalid_state","Start the connection again."),e.send({url:r(),method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({...t.tokenParams,code:i.get("code"),code_verifier:n,code_challenge_method:"S256"})})},accessTokenField:"key"},WPe={tokenParameters(t){let e=t.get("redirect_uri");e!==null&&(t.set("redirect_url",e),t.delete("redirect_uri"))}};function Pa(t,e){let r=e?new URL(e):void 0;return{recognizedTokenTypes:Joe,...t.adapter==="github"?{normalizeToken(o){typeof o.scope=="string"&&(o.scope=o.scope.split(",").map(n=>n.trim()).join(t.scopes.separator))}}:{},...r?.hostname.endsWith(".myshopify.com")&&r.pathname==="/admin/oauth/access_token"?{normalizeToken(o){o.token_type===void 0&&(o.token_type="bearer")},...t.grantType==="client_credentials"?{clientCredentialsParameters(){return{...t.tokenParams}}}:{}}:{},...r?.hostname==="api.notion.com"&&r.pathname==="/v1/oauth/token"?{normalizeToken(o){o.refresh_token===null&&delete o.refresh_token}}:{},...t.adapter==="ebay"?qPe:t.adapter==="openrouter"?ZPe:t.adapter==="vultr"?WPe:{}}}function Ra(t,e){try{return co(new cZ(t).expand(e)).href}catch{C(400,"invalid_service_url","Check the service URL and its required fields.")}}var Goe=(t,e=" ")=>typeof t=="string"?[...new Set(t.split(e).filter(Boolean))].sort():[],Ll=t=>{let e=typeof t=="number"||typeof t=="string"?Number(t):NaN;return(!Number.isSafeInteger(e)||e<=0||e>315576e3)&&C(502,"invalid_response","The service returned an invalid expiry."),e};var Kv=h.object({deviceCode:h.string().min(1).max(16384),userCode:h.string().min(1).max(1e3),verificationUri:h.url(),verificationUriComplete:h.url().optional(),expiresAt:h.number().int().positive(),intervalSeconds:h.number().int().positive(),nextPollAt:h.number().int().positive()}).strict();var Ks=class{constructor(e){this.transport=e}transport;appValues(e,r){try{return{...ns(e.fields,r.fields,e.defaults),clientId:r.clientId}}catch(o){throw o instanceof rs&&C(400,o.code,o.message),o}}async authorize(e,r,o,n,i,s){(e.grantType==="client_credentials"||e.grantType===Pn||!e.authorizeUrl)&&C(400,"wrong_grant","Choose an authorization code connection method.");let a=new URL(Ra(e.authorizeUrl,this.appValues(e,r))),c={...e.authorizeParams,response_type:"code",client_id:r.clientId,redirect_uri:Pa(e).redirectUri?.(r,i)??i,state:o};s.length&&(c.scope=s.join(e.scopes.separator)),e.pkce&&(c.code_challenge=await woe(n),c.code_challenge_method="S256"),Pa(e).authorize?.(c,i);for(let[u,l]of Object.entries(c))a.searchParams.set(u,l);return a.href}configuration(e,r){let o={issuer:e.issuer??new URL(Ra(e.grantType==="client_credentials"||e.grantType===Pn?e.tokenUrl:e.authorizeUrl,this.appValues(e,r))).origin,token_endpoint:Ra(e.tokenUrl,this.appValues(e,r))};return e.issuer&&co(e.issuer),{server:o,client:{client_id:r.clientId}}}authentication(e,r){return r==="none"?koe():(e.clientSecret||C(409,"app_required","Add a client secret to this OAuth application."),r==="basic"?Eoe(e.clientSecret):xoe(e.clientSecret))}options(e){let r=e?.tokenFormat??"form";return{[y4]:async(o,{body:n,headers:i,method:s,signal:a})=>{let c=new URLSearchParams(n);e&&Pa(e).tokenParameters?.(c);let u=await this.transport.send({url:o,method:s,headers:r==="json"?{...i,"content-type":"application/json"}:i,body:r==="json"?JSON.stringify(Object.fromEntries(c)):c.toString(),signal:a});return new Response([204,205,304].includes(u.status)?null:new Uint8Array(u.body),{status:u.status,headers:u.headers})}}}async json(e){return zi({status:e.status,headers:{},body:new Uint8Array(await e.arrayBuffer())})}checkResponse(e,r,o,n=!1){return(r>=400||o.error||e.okPointer&&ui(o,e.okPointer)!==!0)&&(n&&(o.error==="invalid_grant"||o.error==="invalid_token")&&C(409,"reconnect_required","Reconnect this service to renew access."),r===429&&C(503,"service_rate_limit","The service is busy. Try again later."),C(502,"authorization_failed","The service did not authorize this connection.")),o}async tokenResponse(e,r,o,n=!1){o.status===429&&C(503,"service_rate_limit","The service is busy. Try again later.");let i=this.checkResponse(e,o.status,await this.json(o),n),{server:s,client:a}=this.configuration(e,r),c=new URL(s.token_endpoint),u={...i};delete u.id_token,Pa(e,c.href).normalizeToken?.(u),u.expires_in!==void 0&&(u.expires_in=Ll(u.expires_in));try{let d=await(n?Coe:e.grantType==="client_credentials"?Loe:e.grantType===Pn?Koe:Moe)(s,a,Response.json(u,{status:o.status}),{recognizedTokenTypes:Pa(e,c.href).recognizedTokenTypes});return{...i,...d}}catch(l){if(l instanceof Er)throw l;C(502,"invalid_response","The service did not return a valid access token.")}}token(e,r,o,n,i=!1){let s=r[Pa(e).accessTokenField??"access_token"];(typeof s!="string"||!s||s.length>16384||/[\s\u0000-\u001f]/.test(s))&&C(502,"invalid_response","The service did not return a valid access token.");let a=r.expires_in===void 0?null:Date.now()+Ll(r.expires_in)*1e3,c=r.refresh_token??n?.refreshToken;c!==void 0&&(typeof c!="string"||!c||c.length>16384)&&C(502,"invalid_response","The service returned an invalid refresh token.");let u={...n?.extra};for(let d of e.keep)typeof r[d]=="string"&&(u[d]=r[d]);let l={accessToken:s,...c?{refreshToken:String(c)}:{},expiresAt:a,scopes:r.scope!==void 0?Goe(r.scope,e.scopes.separator):i?n?.scopes??o:o,scopesStatus:r.scope!==void 0?"reported":i?n?.scopesStatus??"unknown":o.length?"requested":"unknown",account:n?.account??"",accountVerified:n?.accountVerified??!1,extra:u,facts:{}};return r.refresh_token_expires_in!==void 0&&(l.refreshExpiresAt=Date.now()+Ll(r.refresh_token_expires_in)*1e3),n?.refreshExpiresAt&&c===n.refreshToken&&(l.refreshExpiresAt=Math.min(l.refreshExpiresAt??1/0,n.refreshExpiresAt)),l}async exchange(e,r,o,n,i,s,a,c){(e.grantType==="client_credentials"||e.grantType===Pn)&&C(400,"wrong_grant","Choose an authorization code connection method.");let u,l=Pa(e);if(l.exchange){let f=await l.exchange({spec:e,app:r,transport:this.transport,url:()=>Ra(e.tokenUrl,this.appValues(e,r)),authorization:o,verifier:n});u=this.checkResponse(e,f.status,zi(f))}else{let{server:f,client:p}=this.configuration(e,r),m;try{let g=Foe(f,p,o.parameters,o.state);m=await Ooe(f,p,this.authentication(r,e.clientAuth),g,l.redirectUri?.(r,i)??i,e.pkce?n:w4,{...this.options(e),additionalParameters:e.tokenParams})}catch(g){throw(g instanceof Vv||g instanceof Hv)&&C(400,"invalid_state","Start the connection again."),g}u=await this.tokenResponse(e,r,m)}let d=this.token(e,u,s,a);return await c?.(d,u),d}async deviceAuthorization(e,r,o){(e.grantType!==Pn||!e.deviceAuthorizationUrl)&&C(400,"wrong_grant","Choose a device authorization connection method.");let{server:n,client:i}=this.configuration(e,r),s={...n,device_authorization_endpoint:Ra(e.deviceAuthorizationUrl,this.appValues(e,r))},a=await Voe(s,i,this.authentication(r,e.clientAuth),{...e.authorizeParams,...o.length?{scope:o.join(e.scopes.separator)}:{}},this.options(e)),c=await this.json(a);[200,400].includes(a.status)&&c.error==="device_flow_disabled"&&C(409,"device_flow_disabled","Enable device authorization in the service application settings.");let u=this.checkResponse(e,a.status,c),l;try{l=await Hoe(s,i,Response.json(u,{status:a.status}))}catch{C(502,"invalid_response","The service did not return a valid device authorization.")}let d=Date.now(),f=Ll(l.interval??5);return Kv.parse({deviceCode:l.device_code,userCode:l.user_code,verificationUri:co(l.verification_uri).href,...l.verification_uri_complete?{verificationUriComplete:co(l.verification_uri_complete).href}:{},expiresAt:d+Ll(l.expires_in)*1e3,intervalSeconds:f,nextPollAt:d+f*1e3})}async deviceToken(e,r,o,n){e.grantType!==Pn&&C(400,"wrong_grant","Choose a device authorization connection method.");let{server:i,client:s}=this.configuration(e,r),a=await Boe(i,s,this.authentication(r,e.clientAuth),o,{...this.options(e),additionalParameters:e.tokenParams}),c=await this.json(a);return[200,400].includes(a.status)&&["authorization_pending","slow_down"].includes(String(c.error))?{kind:"pending",slowDown:c.error==="slow_down",...c.interval!==void 0?{intervalSeconds:Ll(c.interval)}:{}}:([200,400].includes(a.status)&&(c.error==="access_denied"&&C(409,"device_access_denied","Device authorization was declined."),c.error==="expired_token"&&C(409,"device_code_expired","The device code expired. Start the connection again."),c.error==="device_flow_disabled"&&C(409,"device_flow_disabled","Enable device authorization in the service application settings.")),{kind:"connected",token:this.token(e,await this.tokenResponse(e,r,Response.json(c,{status:a.status})),n)})}async clientCredentials(e,r,o,n,i){e.grantType!=="client_credentials"&&C(400,"wrong_grant","Choose a client credentials connection method.");let{server:s,client:a}=this.configuration(e,r),c=Pa(e,s.token_endpoint),u={...e.tokenParams,...o.length?{scope:o.join(e.scopes.separator)}:{}},l=await Uoe(s,a,this.authentication(r,e.clientAuth),c.clientCredentialsParameters?.(u)??u,this.options(e)),d=await this.tokenResponse(e,r,l),f={...this.token(e,d,o,n,!!n),requestedScopes:o};return await i?.(f,d),f}async refresh(e,r,o,n){let i=o;if(o.expiresAt!==null&&o.expiresAt<Date.now()+6e4){if(e.grantType==="client_credentials")return o.requestedScopes||C(409,"reconnect_required","Reconnect this service to select its renewal scopes."),this.clientCredentials(e,r,o.requestedScopes,o,n);(!o.refreshToken||o.refreshExpiresAt&&o.refreshExpiresAt<=Date.now())&&C(409,"reconnect_required","Reconnect this service to renew access.");let{server:s,client:a}=this.configuration(e,r),c=await Toe(s,a,this.authentication(r,e.clientAuth),o.refreshToken,{...this.options(e),additionalParameters:e.tokenParams}),u=await this.tokenResponse(e,r,c,!0);i=this.token(e,u,o.scopes,o,!0),await n?.(i,u)}return i}outputs(e,r,o){let n={...this.appValues(e,r),...o.extra,...o,expiresAt:o.expiresAt===null?"":String(o.expiresAt)};return Object.fromEntries(Object.entries(e.outputs).map(([i,s])=>[i,mc(ui(n,s))]))}};function Xoe(t){if(t.method.kind!=="oauth")throw new Error("Use an OAuth connection provider.");return t.method.config}function Yoe(t){return t||C(409,"app_required","Choose an OAuth application."),t}function JPe(t){return{token:qN.parse(t.token),response:xr.parse(t.response)}}var aA=class{constructor(e){this.transport=e}transport;facts=$N;oauth(e){return new Ks({send:r=>this.transport.send({...r,...e?{signal:AbortSignal.any([e,...r.signal?[r.signal]:[]])}:{}})})}needsRenewal(e){return!e.oauth||e.oauth.expiresAt!==null&&e.oauth.expiresAt<Date.now()+6e4}async renew(e){let r=e.material,o=Xoe(r),n=Yoe(e.app),i=("requestedScopes"in r?r.requestedScopes:void 0)??r.oauth?.requestedScopes,s=(c,u)=>e.receive({token:c,response:u}),a=o.grantType==="client_credentials"?await this.oauth(e.signal).clientCredentials(o,n,i??es(o.scopes),r.oauth,s):await this.oauth(e.signal).refresh(o,n,r.oauth,s);return Gn.parse({...e.material,oauth:a})}async recover(e,r,o){let i=JPe(o).token;return Gn.parse({...e,oauth:i})}async outputs(e,r){return this.oauth().outputs(Xoe(e),Yoe(r),e.oauth)}};function GPe(t){if(t.method.kind!=="token"&&t.method.kind!=="approval")throw new Error("Use an input credential provider.");return t.method.config}var qv=class{facts=bp;needsRenewal(){return!1}async outputs(e){let r=GPe(e),o=ns(r.fields,e.fields,"constants"in r?r.constants??{}:{});return Object.fromEntries(Object.entries(r.outputs).map(([n,i])=>[n,_0(o,i)]))}};function cA(t){if(t.method.kind!=="ovh")throw new Error("Use an OVH connection provider.");return t.method.config}var uA=class{facts=AN;values(e,r){let o=cA(e),n=o.authorization==="consumer_key";n&&(!r?.clientId||!r.clientSecret)&&C(409,"app_required","Choose an OVHcloud API application with its key and secret.");let i=n?r.fields:e.fields;return ns(o.fields,i)}credentials(e,r){if(cA(e).authorization==="consumer_key")return{applicationKey:r.clientId,applicationSecret:r.clientSecret,consumerKey:e.fields.consumerKey};let o=this.values(e,r);return{applicationKey:o.applicationKey,applicationSecret:o.applicationSecret,consumerKey:o.consumerKey}}needsRenewal(){return!1}async outputs(e,r){if(e.method.kind!=="ovh")throw new Error("Use OVH connection material.");let o="ovh"in e?e.ovh:void 0;o&&o.expiresAt!==null&&o.expiresAt<=Date.now()&&C(409,"reconnect_required","Reconnect OVHcloud with a current API key.");let n=cA(e).authorization==="consumer_key"?{...this.values(e,r),...this.credentials(e,r)}:this.values(e,r);return Object.fromEntries(Object.entries(cA(e).outputs).map(([i,s])=>[i,mc(ui(n,s))]))}};import{readFile as XPe}from"node:fs/promises";var YPe=h.object({accessToken:h.string().min(1).max(16384).regex(/^\S+$/),expiresAt:h.number().int().positive()}).strict();async function QPe(t,e){if(t==="oidc"){let n=process.env.VULTR_OIDC_TOKEN_FILE,i=n?await XPe(n,"utf8"):process.env.VULTR_OIDC_TOKEN;return(!i||i.length>16384)&&C(409,"authentication_required","Provide the current OIDC token on this machine."),i.trim()}let r=await fetch("http://169.254.169.254/v1/identity/token",{redirect:"error",credentials:"omit",signal:AbortSignal.any([e,AbortSignal.timeout(3e3)])});r.ok||C(409,"authentication_required","Use a Vultr instance with an IAM role trust.");let o=(await r.text()).trim();return(!o||o.length>16384)&&C(502,"invalid_response","The instance did not return a valid identity token."),o}function Qoe(t){if(t.method.kind!=="token"||t.method.config.resolver!=="vultr-role")throw new Error("Use a Vultr IAM role connection.");return t.method.config}var lA=class{constructor(e,r=QPe){this.transport=e;this.identityToken=r}transport;identityToken;facts=bp;sessions=new Map;pending=new Map;needsRenewal(){return!1}async obtain(e,r){let o=ns(Qoe(e).fields,e.fields),n=o.authentication;["api_key","oidc","instance"].includes(n)||C(400,"invalid_field","Choose a Vultr authentication source.");let i=n==="api_key"?o.token:o.credential||await this.identityToken(n,r);(!i||i.length>16384||/\s/.test(i))&&C(409,"authentication_required","Provide current credentials for the selected authentication source.");let s=Number(o.duration);(!Number.isSafeInteger(s)||s<=0||s>315576e3)&&C(400,"invalid_field","Enter a valid session duration in seconds.");let a=await this.transport.send({url:"https://api.vultr.com/v2/assumed-roles/assume",method:"POST",headers:{"content-type":"application/json",authorization:"Bearer "+i},signal:r,body:JSON.stringify({role_id:o.roleId,session_name:o.sessionName,duration:s,auth_method:n==="instance"?"jwt":n,...n==="api_key"?{user_id:o.userId}:{},...n==="oidc"?{oidc_issuer_id:o.issuerId}:{}})});a.status>=400&&C(409,"role_denied","Check the role trust, permissions and authentication source in Vultr.");let c=zi(a);(c.role_id!==void 0&&c.role_id!==o.roleId||n==="api_key"&&c.user_id!==void 0&&c.user_id!==o.userId)&&C(409,"role_changed","Reconnect to approve the returned role and authentication source.");let u=YPe.parse({accessToken:c.session_token,expiresAt:typeof c.expires_at=="string"?Date.parse(c.expires_at):NaN});return u.expiresAt<=Date.now()&&C(502,"invalid_response","Vultr returned an expired role session."),u}async outputs(e,r,o){let n=Qoe(e);o.throwIfAborted();let i=await vt(e),s=this.sessions.get(i);if(!s||s.expiresAt<Date.now()+6e4){let a=this.pending.get(i);a||(a=this.obtain(e,o),this.pending.set(i,a));try{s=await a,this.sessions.set(i,s)}finally{this.pending.get(i)===a&&this.pending.delete(i)}}return Object.fromEntries(Object.entries(n.outputs).map(([a,c])=>[a,_0(s,c)]))}};function eie(t,e){let r={oauth:new aA(t),token:new qv,aws:new X$(e),approval:new qv,ovh:new uA},o=new lA(t);return n=>n.kind==="token"&&n.config.resolver==="vultr-role"?o:r[n.kind]}function dA(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}async function eRe(t,e){let r={},o={},n=[],i=new Set;for(let s of t){if(i.has(s.name)||!yK(s.name))throw new Error("Use distinct, unreserved environment variable names.");i.add(s.name);let a=await e(s.source),c=s.format??(a.file?"file":"text"),u=a.value;if(c==="json"&&(u=Et(mc(ui(JSON.parse(dA(u)),s.pointer??"")))),c==="file")o[s.name]=Buffer.from(u).toString("base64");else{let l=dA(u);if(l.includes("\0"))throw new Error("Use a file to pass binary content.");r[s.name]=l}n.push(Buffer.from(u).toString("utf8"),Buffer.from(u).toString("base64"),Buffer.from(u).toString("base64url"))}return{environment:r,files:o,sensitive:n}}async function tie(t,e,r){let o=await t.sourceContents(r.map(i=>i.source.id)),n=new Map;return eRe(r,async i=>{let s=o.find(u=>u.policy.id===i.id);if(s.policy.contentType===kt.value)return{value:await Jn(s,e.binding,e.keys.encryption)};n.has(i.id)||n.set(i.id,e.outputs(s,o,new AbortController().signal));let{values:a,files:c}=await n.get(i.id);if(!i.output||!Object.hasOwn(a,i.output))throw new Error("Choose an available connection output.");return{value:Et(a[i.output]),file:c.includes(i.output)}})}var pA=class{constructor(e,r,o,n,i,s=new G$){this.binding=e;this.keys=r;this.broker=o;this.journal=n;this.providers=eie(i,s)}binding;keys;broker;journal;providers;provider(e){return this.providers(e)}metadata(e){return Ep(e,this.provider(e.method).facts(e))}source(e,r,o){let n=o.find(i=>i.policy.id===e&&i.policy.contentType===r);return n||C(409,"input_required","Include the connection and its application in the inputs."),n}async method(e){typeof e.metadata.methodDigest!="string"&&C(409,"reconnect_required","Reconnect this service with the current connection format.");let r=await this.broker.method(e.policy.id);return await la(r)!==e.metadata.methodDigest&&C(409,"reconnect_required","Reconnect this service: its connection method changed."),r}async material(e){let r=await this.method(e),o=k0(await Jn(e,this.binding,this.keys.encryption),e.metadata,r);return(await this.metadata(o)).authorizationDigest!==e.metadata.authorizationDigest&&C(409,"connection_changed","Approve the current service account and permissions before using this connection."),o.state==="reconnect"&&C(409,"reconnect_required","Reconnect this service before using it."),o}async app(e,r,o){let n=this.source(e,kt.clientCredential,o);n.policy.readers.some(s=>s.id===this.binding.id)||C(403,"refresh_required","Only a reader of its application can renew this connection.");let i=Rn.parse(JSON.parse(dA(await Jn(n,this.binding,this.keys.encryption))));return i.methodId!==r&&C(400,"wrong_app","Choose an application for this connection method."),i}async connectionApp(e,r){if(Nt(e.method).application==="none")return null;if(!uc(e.method))return"implicitApp"in e&&e.implicitApp?e.implicitApp:Rn.parse({format:1,methodId:e.methodId,generation:e.generation,clientId:"",fields:{}});let o=await this.app(e.appId,e.methodId,r);return o.generation!==e.appGeneration&&C(409,"app_changed","Reconnect this service with the current application."),Nt(e.method).requiresApp&&e.method.kind!=="aws"&&Object.entries(Eo(e.method.config.fields,e.fields??{})).some(([n,i])=>o.fields[n]!==i)&&C(409,"app_changed","Reconnect this service with the current application settings."),o}async outputs(e,r,o){let n=await this.material(e);return this.provider(n.method).renew&&await this.broker.state(e.policy.id)&&C(409,"connection_busy","Resolve the current token update before using this connection."),n=await this.refresh(e,n,r,o),{values:await this.provider(n.method).outputs(n,await this.connectionApp(n,r),o),files:n.method.kind==="token"?n.method.config.files??[]:[]}}async refreshed(e,r){let o=await this.metadata(r);return o.authorizationDigest!==e.previous.metadata.authorizationDigest&&C(409,"connection_review","Review the changed service account or permissions before sharing the updated connection."),e.material=r,e.content=await WK(e.previous,kp(r),this.binding,this.keys,o),e.phase="settled",await this.journal.write("refresh_"+e.operation.id,e),await this.broker.commit(e.operation.id,e.operation.fence,e.content),e.delivered=!0,await this.journal.write("refresh_"+e.operation.id,e),r}async refresh(e,r,o,n){let i=this.provider(r.method);if(!i.needsRenewal(r))return r;i.renew||C(409,"reconnect_required","Reconnect this service to renew access.");let s=await this.connectionApp(r,o),a=tRe(),c=await this.broker.prepare(a,e.policy.id,e.materialRevision),u={operation:c,previous:e,material:r,app:s,phase:"prepared",delivered:!1};await this.journal.write("refresh_"+a,u);try{n.throwIfAborted(),u.phase="dispatched",await this.journal.write("refresh_"+a,u),await this.broker.dispatch(a,c.fence),n.throwIfAborted();let l=await i.renew({material:r,app:s,signal:n,receive:async d=>{u.checkpoint=d,u.phase="received",await this.journal.write("refresh_"+a,u)}});return await this.refreshed(u,l)}catch(l){if(u.phase==="prepared"?await this.broker.abort(a,c.fence):await this.broker.uncertain(a,c.fence).catch(()=>{}),l instanceof Er&&["connection_review","reconnect_required","account_changed","authorization_failed","service_rate_limit"].includes(l.code))throw l;C(409,"connection_uncertain","Check the token update before using this connection again.")}}async reconcile(){let e=[];for(let r of await this.journal.pending("refresh_"))try{let o=await this.journal.read(r);if(o.delivered)continue;if(o.content){await this.broker.commit(o.operation.id,o.operation.fence,o.content),o.delivered=!0,await this.journal.write(r,o);continue}let n=await this.broker.state(o.operation.resource_id);if(!n||n.id!==o.operation.id||n.state==="prepared")n?.id===o.operation.id&&n.state==="prepared"&&await this.broker.abort(o.operation.id,o.operation.fence),o.delivered=!0,await this.journal.write(r,o);else if(o.checkpoint&&this.provider(o.material.method).recover){let i=await this.provider(o.material.method).recover(o.material,o.app,o.checkpoint);await this.refreshed(o,i)}else await this.broker.uncertain(o.operation.id,o.operation.fence),o.delivered=!0,await this.journal.write(r,o)}catch{e.push(r.slice(8))}return e}};import{lookup as rRe}from"node:dns/promises";import{request as nRe}from"node:https";import{brotliDecompressSync as oRe,gunzipSync as iRe,inflateSync as sRe}from"node:zlib";var em=class{constructor(e){this.origin=e}origin;async send(e){let r=co(e.url,this.origin),o=r.hostname.replace(/^\[|\]$/g,""),n=e.maxBytes??1048576;e.body&&Buffer.byteLength(e.body)>n&&C(413,"body_limit","The request body is too large.");let i={"user-agent":"Foundation/1.0",accept:"application/json","accept-encoding":"identity"};for(let[s,a]of Object.entries(e.headers??{})){let c=s.toLowerCase();(["host","connection","content-length","transfer-encoding","upgrade","proxy-authorization","proxy-connection","accept-encoding","te","trailer"].includes(c)||!/^[!#$%&'*+.^_`|~0-9a-z-]+$/.test(c)||/[\r\n\u0000]/.test(a))&&C(400,"invalid_header","Choose a valid request header."),i[c]=a}try{let s=await rRe(o,{all:!0,verbatim:!0});(!s.length||s.some(u=>!sA(u.address)))&&C(400,"private_destination","Choose a public HTTPS destination.");let a=s[0],c=AbortSignal.any([AbortSignal.timeout(2e4),...e.signal?[e.signal]:[]]);return await new Promise((u,l)=>{let d={method:e.method??"GET",headers:i,signal:c,agent:!1,lookup:(p,m,g)=>{m.all?g(null,[a]):g(null,a.address,a.family)}},f=nRe(r,d,p=>{let m=[],g=0;p.on("data",y=>{g+=y.length,g>n?p.destroy(new Er(413,"body_limit","The response body is too large.")):m.push(y)}),p.on("error",l),p.on("end",()=>{try{let y=Buffer.concat(m),w=p.headers["content-encoding"];if(w&&w!=="identity"){let _=w==="gzip"?iRe:w==="deflate"?sRe:w==="br"?oRe:null;if(!_)throw new Er(502,"invalid_response","The service returned an unsupported response.");y=_(y,{maxOutputLength:n})}let b={};for(let[_,k]of Object.entries(p.headers))k!==void 0&&!["set-cookie","set-cookie2","content-encoding","transfer-encoding","connection"].includes(_)&&(b[_]=Array.isArray(k)?k.join(", "):k);u({status:p.statusCode??502,headers:b,body:new Uint8Array(y)})}catch(y){l(y)}})});f.on("error",l),f.end(e.body)})}catch(s){if(s instanceof Er)throw s;e.signal?.aborted&&C(409,"cancelled","The operation was cancelled."),C(502,"service_unavailable","The service could not be reached. Try again.")}}};function uu(t){let{keys:e,binding:r,origin:o}=t.identity;if(!e||!r)throw new Error("Use a sign-in key with encryption and signing keys for this operation.");let n=_4(aRe(ci()),"custody",r.id),i=new sc(_4(n,"client"),o,r,e),s=new Set,a=new $0(t,o,r,e,new A0(i),d=>{for(let f of d.excluded)s.has(f.id)||(s.add(f.id),process.stderr.write("foundation: "+f.name+" ("+f.id+") cannot open "+(d.operation==="transfer"?"the item after the transfer: ":"the saved item: ")+(f.code==="identity_changed"?"the previously verified public keys changed.":"its public keys are not verified by this identity.")+(d.operation==="transfer"?`
134
134
  After acceptance, the recipient can verify this delegate's fingerprint and run foundation trust `:`
135
135
  Verify the fingerprint with this principal, then run foundation trust `)+f.id+` --fingerprint <verified-fingerprint> to encrypt existing items for it.
136
136
  `))}),c=new T0(t),u=new em(o),l=new pA(r,e,c.connections(),new sc(_4(n,"connections"),o,r,e),u);return{custody:a,journal:i,directory:n,keys:e,binding:r,broker:c,transport:u,connections:l}}async function fA(t,e){let{custody:r,connections:o}=uu(t);return tie(r,o,e)}async function S4(t,e,r){let o=await t.ownerSide(e.ownerId),n=await Promise.all([...new Set(r)].filter(i=>!o.has(i)).map(async i=>{let{binding:s}=await t.inspectIdentity(i);return t.trusted(s)}));return Wn.parse({...e,readers:[...e.readers.filter(i=>o.has(i.principalId)),...n]})}async function mA(t,e,r,o){let n=r&&!r.replaced?r.content:void 0,i=n?await t.refreshRecipients(n.policy):await t.policy(e,kt.tokenSet,r?{replacing:r.content.policy}:{});return o?S4(t,{...i,revision:n?n.policy.revision+1:i.revision},o):i}function hA(t){if(Nt(t.method).application==="none")return null;let e=t.app??Rn.parse({format:1,methodId:t.methodId,generation:crypto.randomUUID(),clientId:"",fields:{}});if(Nt(t.method).requiresApp&&(!t.appId||e.methodId!==t.methodId))throw new Error("Choose an application for this connection method.");if(t.method.kind==="oauth"&&t.method.config.clientAuth!=="none"&&!e.clientSecret||t.method.kind==="ovh"&&(!e.clientId||!e.clientSecret))throw new Error("Enter the application client ID and secret.");return e}function gA(t,e){let r={format:3,methodId:t.methodId,method:t.method,generation:crypto.randomUUID(),appId:t.appId,appGeneration:t.appId?t.app.generation:null};if(t.method.kind==="aws")return Gn.parse({...r,aws:aa.parse(t.aws)});if(t.method.kind==="oauth")return Gn.parse({...r,requestedScopes:t.scopes,fields:Eo(t.method.config.fields,t.app.fields)});let o=t.method.config.fields,n=Object.fromEntries(o.filter(a=>e?.fields?.[a.name]!==void 0).map(a=>[a.name,e.fields[a.name]])),i=Object.fromEntries(Object.entries(t.fields).filter(([a,c])=>c!==""||o.find(u=>u.name===a)?.secret===!1||n[a]===void 0)),s=S0(o,i,n);return t.method.kind==="token"&&t.method.config.account&&E0(t.method.config.account,s),Gn.parse({...r,fields:s})}var yA=h.object({consumerKey:h.string().min(1).max(16384),validationUrl:h.url()});async function rie(t,e,r,o,n){if(t.method.kind==="oauth"){if(t.method.config.registrationUrl&&!t.app.clientId){if(t.method.config.application!=="implicit"||t.method.config.clientAuth!=="none")throw new Error("Use dynamic registration only with an implicit public OAuth client.");let l=await e.send({url:co(t.method.config.registrationUrl).href,method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_name:"Foundation",redirect_uris:[n],token_endpoint_auth_method:"none",grant_types:["authorization_code"],response_types:["code"]})});if(l.status>=400)throw new Error("The service could not register this connection.");let d=h.object({client_id:h.string().min(1).max(1e3),token_endpoint_auth_method:h.literal("none").optional()}).parse(zi(l));t.app.clientId=d.client_id}return{url:await new Ks(e).authorize(t.method.config,t.app,r,o,n,t.scopes)}}if(t.method.kind!=="ovh"||t.method.config.authorization!=="consumer_key")throw new Error("Choose a browser authorization method.");let i=new URL(n);i.searchParams.set("state",r);let s=Ra(t.method.config.apiBaseUrl,ns(t.method.config.fields,t.app.fields)).replace(/\/$/,"")+"/auth/credential",a=await e.send({url:s,method:"POST",headers:{"content-type":"application/json","X-Ovh-Application":t.app.clientId},body:JSON.stringify({redirection:i.href,accessRules:cK(es(t.method.config.scopes,t.scopes))})});if(a.status>=400)throw new Error("Check the OVHcloud application key and account region.");let c=yA.parse(zi(a)),u=co(c.validationUrl);if(!["ovh.com","ovhcloud.com"].some(l=>u.hostname===l||u.hostname.endsWith("."+l)))throw new Error("OVHcloud returned an unexpected authorization address.");return{url:c.validationUrl,ovh:c}}async function nie(t,e,r,o,n,i,s){let a=new URLSearchParams(r);if(a.getAll("state").length!==1||a.get("state")!==o)throw new Error("The authorization response does not match this connection.");if(a.has("error"))throw new Error("The service authorization was cancelled.");let c={format:3,methodId:t.methodId,method:t.method,generation:crypto.randomUUID(),appId:t.appId,appGeneration:t.appId?t.app.generation:null,fields:Eo(Nt(t.method).fields,t.app.fields),requestedScopes:t.scopes};if(t.method.kind==="ovh")return Gn.parse({...c,fields:{...c.fields,consumerKey:yA.parse(s).consumerKey}});if(t.method.kind!=="oauth")throw new Error("Choose a browser authorization method.");let u=await new Ks(e).exchange(t.method.config,t.app,{parameters:a,state:o},n,i,t.scopes);return Gn.parse({...c,oauth:u,...t.method.config.registrationUrl&&!t.appId?{implicitApp:t.app}:{}})}var vA=h.object({id:h.string().min(1).max(1e3),expiresAt:h.number().int().positive()}).strict();async function oie(t,e,r={}){let o=await t.send({url:"https://api.runpod.io/graphql",method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:e,variables:r})});o.status>=400&&C(502,"authorization_failed","RunPod could not authorize this connection.");let n=zi(o);return n.errors&&C(502,"authorization_failed","RunPod could not authorize this connection."),h.record(h.string(),h.unknown()).parse(n.data)}async function iie(t){let e=await oie(t,`mutation createFlashAuthRequest {
137
137
  createFlashAuthRequest { id status expiresAt }
138
138
  }`),r=h.object({id:h.string().min(1).max(1e3),expiresAt:h.iso.datetime({offset:!0})}).parse(e.createFlashAuthRequest),o=vA.parse({id:r.id,expiresAt:Date.parse(r.expiresAt)});o.expiresAt<=Date.now()&&C(409,"authorization_expired","Start the RunPod connection again.");let n=new URL("https://console.runpod.io/flash/login");return n.searchParams.set("request",r.id),{approval:o,url:n.href}}async function sie(t,e){e.expiresAt<=Date.now()&&C(409,"authorization_expired","Start the RunPod connection again.");let r=await oie(t,`query flashAuthRequestStatus($flashAuthRequestId: String!) {
139
139
  flashAuthRequestStatus(flashAuthRequestId: $flashAuthRequestId) { id status expiresAt apiKey }
140
- }`,{flashAuthRequestId:e.id}),o=h.object({id:h.string(),status:h.string(),apiKey:h.string().nullish()}).parse(r.flashAuthRequestStatus);return o.id!==e.id&&C(502,"invalid_response","RunPod returned another authorization request."),o.apiKey&&["APPROVED","CONSUMED"].includes(o.status)?h.string().min(1).max(16384).regex(/^\S+$/).parse(o.apiKey):(["DENIED","EXPIRED","CONSUMED"].includes(o.status)&&C(409,"authorization_failed","Start the RunPod connection again."),o.status!=="PENDING"&&C(502,"invalid_response","RunPod returned an unknown authorization state."),null)}var Zv=h.object({id:E,ownerId:E,registration:h.object({methodId:h.string().min(1),methodDigest:Vr,appId:E.nullable(),app:Rn.nullable(),fields:h.record(h.string(),h.string()),scopes:h.array(h.string())}).strict(),policy:Wn,previousPolicyDigest:h.string().nullable(),step:h.enum(["start","cli","authorize","exchange","commit","connected","cancelled","failed"]),createdAt:h.iso.datetime(),expiresAt:h.number(),operationId:E,url:h.url().nullable(),connectionId:E.nullable(),authorizationState:h.string(),verifier:h.string(),redirectUri:h.url(),ovh:yA.optional(),material:xr.optional(),proof:WN.omit({name:!0,labels:!0}).optional(),approval:vA.optional(),deviceAuthorization:Kv.optional(),error:h.string().optional(),exchangeStartedAt:h.number().optional(),exchangeDevice:h.enum(["browser","cli"])}).strict(),cRe=Zv.pick({id:!0,ownerId:!0,operationId:!0,error:!0}).strip(),wA=()=>Qu(crypto.getRandomValues(new Uint8Array(32))),bA=class{constructor(e,r,o=new iA(e.origin),n="browser"){this.custody=e;this.store=r;this.transport=o;this.device=n}custody;store;transport;device;approvalPolls=new Map;devicePolls=new Map;async flow(e){let r=await this.store.get(E.parse(e));if(!r)throw new Error("The saved progress for this connection is unavailable.");let o=Zv.parse(r);if(o.policy.origin!==this.custody.origin||!o.policy.authorities.some(n=>M(n)===M(this.custody.binding)))throw new Error("Open this connection with its initiating identity.");return o}async start(e,r,o){let n=u0.parse(e.input);if(e.name!=="connection.connect"||n.methodDigest!==await la(r)||!n.name)throw new Error("Use the connection prepared by this operation.");for(let[g,y]of Object.entries(n.fields??{}))if(y&&o[g]!==y)throw new Error("Use the service settings prepared by this operation.");if(!Nt(r).browserAuthorization||r.kind==="token"||r.kind==="aws")throw new Error("Choose a browser authorization method.");let i=es(r.config.scopes,n.scopes),s=n.connectionId?await this.custody.latest(n.connectionId):void 0;if(s&&(s.content.policy.contentType!==kt.tokenSet||s.content.policy.ownerId!==n.ownerId))throw new Error("Choose a connection belonging to this owner.");let a=Nt(r).requiresApp?E.parse(n.appId):null,c=a?Rn.parse(JSON.parse(qt(await this.custody.reveal(a)))):null,u=hA({methodId:n.methodId,method:r,appId:a??void 0,app:c}),l=await mA(this.custody,n.ownerId,s,n.users),d=crypto.randomUUID(),f={id:d,ownerId:n.ownerId,registration:{methodId:n.methodId,methodDigest:n.methodDigest,appId:a,app:u,fields:o,scopes:i},policy:l,previousPolicyDigest:s?await vt(s.content.policy):null,step:this.device==="browser"&&xq(r)==="unavailable"?"cli":"start",createdAt:new Date().toISOString(),expiresAt:Date.now()+this.window(r),operationId:e.id,url:null,connectionId:null,authorizationState:wA(),verifier:wA(),redirectUri:n.redirectUri??this.custody.origin+"/oauth/callback",exchangeDevice:this.device},p=new URL(f.redirectUri);if(f.redirectUri!==this.custody.origin+"/oauth/callback"&&!(this.device==="cli"&&p.protocol==="http:"&&["127.0.0.1","[::1]"].includes(p.hostname)&&!p.username&&!p.password&&!p.hash&&!p.search))throw new Error("Use the Foundation callback or a callback on this computer.");await this.store.put(f);let m={kind:"connection",id:d};return await(e.held?this.custody.api.json("/api/operations/"+e.id+"/continuation",{method:"PUT",body:{continuation:m}},nr):this.custody.api.json("/api/operations",{method:"POST",body:{id:e.id,name:e.name,input:e.input,continuation:m}},nr)),this.progress(d)}window(e){return e.kind==="oauth"&&e.config.grantType===Pn?vq:6e5}operation(e){return this.custody.api.json("/api/operations/"+e.operationId,{},nr)}async perform(e,r){await this.custody.api.json("/api/operations/"+e.operationId+"/perform",{method:"POST",body:{proof:r}},nr)}view(e){return cRe.parse(e)}async method(e){let r=(await this.custody.api.json("/api/connection-methods",{},Qt(ii))).items.find(n=>n.id===e.registration.methodId),o=r&&cc(r);if(!o||await la(o)!==e.registration.methodDigest)throw new Error("The connection method changed. Start the connection again.");return o}async registration(e){let{methodDigest:r,...o}=e.registration;return{...o,method:await this.method(e)}}async state(e){return ZN(e.material,e.registration.methodId,await this.method(e))}async name(e,r){return me.parse((await this.operation(e)).input.name??r.name)}async write(e,r){return WN.parse({...e.proof,name:await this.name(e,r.method),labels:Cg(r)})}authorizing(e){let r=e.deviceAuthorization;return{kind:"authorize",flow:this.view(e),url:e.url,...r?{device:{userCode:r.userCode,verificationUri:r.verificationUri,expiresAt:e.expiresAt}}:{}}}async awaitingAuthorization(e){let r=await this.operation(e);if(r.state!=="in_progress"||r.continuation?.id!==e.id||r.input.methodDigest!==e.registration.methodDigest)throw new Error("Continue the connection that is awaiting authorization.")}async currentApplication(e){if(!e.registration.appId)return;let r=Rn.parse(JSON.parse(qt(await this.custody.reveal(e.registration.appId)))),o=e.registration.app;if(r.methodId!==o.methodId||r.generation!==o.generation||r.clientId!==o.clientId||M(r.fields)!==M(o.fields))throw new Error("Start authorization again with the current application.");e.registration.app=r}async pollDevice(e){let r=Kv.parse(e.deviceAuthorization),o=await this.registration(e),n=o.method;if(n.kind!=="oauth"||n.config.grantType!==Pn)throw new Error("Choose a device authorization connection method.");if(e.expiresAt<=Date.now())return e.step="failed",e.error="device_code_expired",await this.store.put(e),{kind:"failed",flow:this.view(e),error:e.error};if(r.nextPollAt>Date.now())return this.authorizing(e);await this.awaitingAuthorization(e),await this.currentApplication(e),r.nextPollAt=Date.now()+r.intervalSeconds*1e3,e.deviceAuthorization=r,await this.store.put(e);let i;try{i=await new Ks(this.transport).deviceToken(n.config,e.registration.app,r.deviceCode,e.registration.scopes)}catch(s){let a=s&&typeof s=="object"&&"code"in s&&typeof s.code=="string"?s.code:"authorization_failed";return a==="service_unavailable"||a==="service_rate_limit"?(r.intervalSeconds*=2,r.nextPollAt=Date.now()+r.intervalSeconds*1e3,await this.store.put(e),this.authorizing(e)):(e.error=a,e.step=a==="browser_exchange_unavailable"?"cli":"failed",await this.store.put(e),e.step==="cli"?this.cli(e):{kind:"failed",flow:this.view(e),error:a})}return i.kind==="pending"?(r.intervalSeconds=Math.max(r.intervalSeconds+(i.slowDown?5:0),i.intervalSeconds??0),r.nextPollAt=Date.now()+r.intervalSeconds*1e3,await this.store.put(e),this.authorizing(e)):(await this.awaitingAuthorization(e),e.material=Og(Gn.parse({...gA(o),oauth:i.token})),e.step="commit",await this.store.put(e),this.accept(e.id))}async pollApproval(e){if(e.expiresAt<=Date.now())throw new Error("Start the connection again.");await this.awaitingAuthorization(e);let r=await sie(this.transport,vA.parse(e.approval));return r?(await this.awaitingAuthorization(e),e.material=Og(Gn.parse({format:3,methodId:e.registration.methodId,method:await this.method(e),generation:crypto.randomUUID(),appId:null,appGeneration:null,fields:{token:r}})),e.step="commit",await this.store.put(e),this.accept(e.id)):{kind:"authorize",flow:this.view(e),url:e.url}}cli(e){return{kind:"cli",flow:this.view(e),command:(e.step==="authorize"?"foundation connect wait ":"foundation operation continue ")+e.operationId}}async authorize(e){if(e.expiresAt<=Date.now())throw new Error("Start the connection again.");let r=await this.registration(e);if(r.method.kind==="oauth"&&r.method.config.grantType===Pn)try{let n=await new Ks(this.transport).deviceAuthorization(r.method.config,e.registration.app,e.registration.scopes);return e.deviceAuthorization=n,e.expiresAt=Math.min(e.expiresAt,n.expiresAt),e.step="authorize",e.url=n.verificationUriComplete??n.verificationUri,await this.store.put(e),this.authorizing(e)}catch(n){if(!(n&&typeof n=="object"&&"code"in n&&n.code==="browser_exchange_unavailable"))throw n;return e.step="cli",e.error="browser_exchange_unavailable",await this.store.put(e),this.cli(e)}if(r.method.kind==="approval"){let n=await iie(this.transport);return e.approval=n.approval,e.expiresAt=Math.min(e.expiresAt,n.approval.expiresAt),e.step="authorize",e.url=n.url,await this.store.put(e),{kind:"authorize",flow:this.view(e),url:e.url}}e.redirectUri===this.custody.origin+"/oauth/callback"&&await this.custody.api.json("/api/oauth/relays",{method:"POST",body:{id:e.id,operationId:e.operationId,stateDigest:await vt(e.authorizationState),expiresAt:new Date(e.expiresAt).toISOString()}},JN);let o=await rie(r,this.transport,e.authorizationState,e.verifier,e.redirectUri);return e.step="authorize",e.url=o.url,"ovh"in o&&(e.ovh=o.ovh),await this.store.put(e),{kind:"authorize",flow:this.view(e),url:e.url}}async progress(e,r=!0){let o=await this.flow(e);if(o.step==="connected")return o.proof&&await this.perform(o,await this.write(o,await this.state(o))),{kind:"connected",flow:this.view(o),id:o.connectionId};if(o.step==="cancelled")return{kind:"cancelled",flow:this.view(o)};if(o.step==="failed")return{kind:"failed",flow:this.view(o),error:o.error??"authorization_failed"};if(o.step==="commit")return this.accept(e);if(o.step==="exchange"){if(Date.now()-(o.exchangeStartedAt??Date.now())<3e4)return{kind:"pending",flow:this.view(o)};o.step="cli",o.error="browser_exchange_unavailable",await this.store.put(o)}if(o.step==="cli"){if(this.device==="browser")return this.cli(o);let n=await this.operation(o);o.step="start",o.exchangeDevice="cli",o.authorizationState=wA(),o.verifier=wA(),o.expiresAt=Math.min(Date.now()+this.window(await this.method(o)),Date.parse(n.expiresAt??new Date().toISOString())),delete o.error,await this.store.put(o)}if(o.step==="start")return this.authorize(o);if(o.exchangeDevice==="cli"&&this.device==="browser")return this.cli(o);if(o.deviceAuthorization){let n=this.devicePolls.get(e);n||(n=this.pollDevice(o),this.devicePolls.set(e,n));try{return await n}finally{this.devicePolls.get(e)===n&&this.devicePolls.delete(e)}}if(o.approval){let n=this.approvalPolls.get(e);n||(n=this.pollApproval(o),this.approvalPolls.set(e,n));try{return await n}finally{this.approvalPolls.get(e)===n&&this.approvalPolls.delete(e)}}if(r&&o.redirectUri===this.custody.origin+"/oauth/callback"){let n=await this.custody.api.json("/api/oauth/relays/"+e,{},JN);if(n.id!==e||n.operationId!==o.operationId||n.context!==vZ(this.custody.origin,e))throw new Error("The authorization response belongs to another connection.");if(n.sealed)return this.complete(e,qt(await wo(n.sealed,this.custody.keys.encryption,this.custody.binding.id,n.context)))}return this.authorizing(o)}async complete(e,r){let o=await this.flow(e);if(o.step!=="authorize")return this.progress(e,!1);if(o.exchangeDevice==="cli"&&this.device==="browser")return this.cli(o);if(o.deviceAuthorization)throw new Error("Device authorization completes after the code is approved at the service.");if(o.expiresAt<=Date.now())throw new Error("Start the connection again.");await this.awaitingAuthorization(o);let n=new URLSearchParams(r);if(n.getAll("state").length!==1||n.get("state")!==o.authorizationState)throw new Error("The authorization response does not match this connection.");if(n.has("error"))return this.cancel(e);await this.currentApplication(o),o.step="exchange",o.exchangeStartedAt=Date.now(),await this.store.put(o);try{o.material=Og(await nie(await this.registration(o),this.transport,r,o.authorizationState,o.verifier,o.redirectUri,o.ovh))}catch(i){if(o.error=i&&typeof i=="object"&&"code"in i&&typeof i.code=="string"?i.code:"authorization_failed",o.step=o.error==="browser_exchange_unavailable"?"cli":"failed",await this.store.put(o),o.step==="cli"&&this.device==="browser")return this.cli(o);throw i}return o.step="commit",await this.store.put(o),this.accept(e)}async accept(e){let r=await this.flow(e);if(r.step!=="commit"||!r.material)throw new Error("Complete authorization before saving this connection.");let o=r.previousPolicyDigest?await this.custody.latest(r.policy.id):void 0;if(o&&await vt(o.content.policy)!==r.previousPolicyDigest)throw new Error("The connection recipients changed. Start again to approve the current recipients.");let n=await this.state(r),i=async s=>{let{name:a,labels:c,...u}=s;return r.proof=u,await this.store.put(r),await this.perform(r,s),this.custody.api.json("/api/resources/"+r.policy.id,{},mt)};return r.proof?await i(await this.write(r,n)):await this.custody.save(await this.name(r,n.method),kp(n),r.policy,{previous:o,metadata:await Ep(n),labels:Cg(n),commit:i}),r.step="connected",r.connectionId=r.policy.id,await this.store.put(r),{kind:"connected",flow:this.view(r),id:r.connectionId}}async cancel(e){let r=await this.flow(e);return await this.custody.api.json("/api/operations/"+r.operationId+"/cancel",{method:"POST",body:{}},nr),r.step="cancelled",await this.store.put(r),{kind:"cancelled",flow:this.view(r)}}};var aie=h.object({id:E,actorId:E,bindingId:E,origin:h.url(),revision:h.number().int().positive(),sealed:Fr,signature:tr}).strict(),cie=(t,e)=>"operation-continuation:"+t+":"+e,Wv=class{constructor(e){this.custody=e}custody;revisions=new Map;async get(e,r){let o=await this.custody.api.json("/api/operation-continuations/"+E.parse(e),{},aie.nullable());if(!o)return this.revisions.set(e,0),null;let{signature:n,...i}=o;if(i.id!==e||i.origin!==this.custody.origin||i.actorId!==this.custody.binding.principalId||i.bindingId!==this.custody.binding.id)throw new Error("Use the identity that started this operation.");await Yi(i,n,this.custody.binding.signing,"operation-continuation");let s=r.parse(JSON.parse(qt(await wo(i.sealed,this.custody.keys.encryption,this.custody.binding.id,cie(this.custody.origin,e)))));return this.revisions.set(e,i.revision),s}async put(e,r){this.revisions.has(e)||await this.get(e,h.unknown());let o={id:e,origin:this.custody.origin,actorId:this.custody.binding.principalId,bindingId:this.custody.binding.id,revision:this.revisions.get(e)+1,sealed:await el(Et(M(r)),[{id:this.custody.binding.id,publicKey:this.custody.binding.encryption}],cie(this.custody.origin,e))},n=await rr(o,this.custody.keys.signing,"operation-continuation");await this.custody.api.json("/api/operation-continuations/"+e,{method:"PUT",body:{...o,signature:n}},aie),this.revisions.set(e,o.revision)}},_A=class{records;constructor(e){this.records=new Wv(e)}async get(e){let r=await this.records.get(e,Zv);if(r&&r.id!==e)throw new Error("The saved progress belongs to another operation.");return r}put(e){return this.records.put(e.id,Zv.parse(e))}};var x4=class{constructor(e){this.client=e}client;connectionNames=new Map;async method(e){let r=(await this.client.custody.api.json("/api/connection-methods",{},Qt(ii))).items.find(o=>o.id===e);if(!r)throw new Error("Choose an available connection method.");return this.connectionNames.set(e,r.defaultName),cc(r)}async prepareFields(e,r){let{name:o,input:n}=e,i=await this.method(String(n.methodId)),s=i.kind==="aws"?[]:i.config.fields,a=Eo(s,r.fields??{});if(o==="connection.connect"&&n.appId){let l=await this.client.custody.api.json("/api/resources/"+E.parse(n.appId),{},mt);if(l.kind!=="app")throw new Error("Choose a connection application.");a={...l.data.fields,...a}}let c=n.fields,u=Pg(s,c??{},a);return Object.entries(a).some(([l,d])=>c?.[l]!==d)?this.client.proceed(await this.client.configure(e,{fields:u}),r):null}async authorize(e){let r=e.id,{input:o}=e,n=gq.parse(o),i=await this.client.custody.read(n.connectionId);if(i.version!==n.version||i.content.policy.ownerId!==n.ownerId||i.content.policy.contentType!==kt.tokenSet)throw new Error("Review the current connection before changing its permissions.");let s=await S4(this.client.custody,{...i.content.policy,revision:i.content.policy.revision+1},n.users),a=await this.client.custody.api.json("/api/resources/"+n.connectionId,{},mt);return{kind:"saved",resource:await this.client.custody.save(a.name,await this.client.custody.reveal(n.connectionId),s,{previous:i,metadata:i.content.metadata,commit:async u=>mt.parse((await this.client.commit(e,u)).result)}),operationId:r}}async saveApplication(e,r){let o=await this.prepareFields(e,r);if(o)return o;let n=e.id,{input:i}=e,s=kN.parse(i),a=s.resourceId?await this.client.custody.latest(s.resourceId):void 0;if(a&&a.version!==s.version)throw new Error("This item changed. Reload it before saving.");let c=kt.clientCredential;if(a&&(a.content.policy.contentType!==c||a.content.policy.ownerId!==s.ownerId))throw new Error("Choose the item prepared by this operation.");let u=a&&!a.replaced?await this.client.custody.refreshRecipients(a.content.policy):await this.client.custody.policy(s.ownerId,c,a?{replacing:a.content.policy}:{}),l,d,f=kN.parse(i),p=a&&!a.replaced?Rn.parse(JSON.parse(qt(await this.client.custody.reveal(a.content.policy.id)))):null,m=await this.method(f.methodId),g=Pg(m.kind==="aws"?[]:m.config.fields,f.fields??{},r.fields??{}),y=p&&p.methodId===f.methodId&&p.clientId===f.clientId&&M(p.fields)===M(g),w=Rn.parse({format:1,methodId:f.methodId,clientId:f.clientId,fields:g,generation:y?p.generation:crypto.randomUUID(),...r.clientSecret||p?.clientSecret?{clientSecret:r.clientSecret||p?.clientSecret}:{}});return l=Et(M(w)),d={methodId:w.methodId,clientId:w.clientId,generation:w.generation,fields:Eo(m.kind==="aws"?[]:m.config.fields,g)},{kind:"saved",resource:await this.client.custody.save(s.name,l,u,{previous:a,metadata:d,commit:async _=>mt.parse((await this.client.commit(e,_)).result)}),operationId:n}}async connect(e,r){if(e.continuation?.kind==="connection")return this.client.connections.progress(e.continuation.id);let o=await this.prepareFields(e,r);if(o)return o;let n=e.id,{input:i}=e,s=u0.parse(i),a=await this.method(s.methodId);if(!s.name)return this.client.proceed(await this.client.configure(e,{name:this.connectionNames.get(s.methodId)??a.name}),r);if(r.scopes&&!s.scopes&&(a.kind==="oauth"||a.kind==="ovh"))return this.client.proceed(await this.client.configure(e,{scopes:r.scopes}),r);if(r.scopes&&s.scopes&&(a.kind==="oauth"||a.kind==="ovh")&&M(es(a.config.scopes,r.scopes).sort())!==M(es(a.config.scopes,s.scopes).sort()))throw new Error("Use the service permissions prepared by this operation.");if(uc(a)&&!s.appId){if(!s.clientId)throw new Error("Enter the application client ID.");let u=await this.saveApplication(await this.client.review({name:"app.save",input:{ownerId:s.ownerId,name:(s.name??a.name).slice(0,185)+" application",methodId:s.methodId,clientId:s.clientId,...s.fields?{fields:s.fields}:{}}}),{...r.clientSecret?{clientSecret:r.clientSecret}:{},...r.fields?{fields:r.fields}:{}});if(!("kind"in u)||u.kind!=="saved")throw new Error("Save the application for this connection.");return this.client.proceed(await this.client.configure(e,{appId:u.resource.id}),r)}let c=s.appId;if(!Nt(a).browserAuthorization){if(await la(a)!==s.methodDigest)throw new Error("Review the current connection method.");let u=s.connectionId?await this.client.custody.latest(s.connectionId):void 0;if(u&&(u.content.policy.ownerId!==s.ownerId||u.content.policy.contentType!==kt.tokenSet))throw new Error("Choose a connection belonging to this owner.");let l=u&&!u.replaced?await this.client.custody.connection(s.connectionId):void 0,d=hA({methodId:s.methodId,method:a,appId:c,app:c?Rn.parse(JSON.parse(qt(await this.client.custody.reveal(c)))):null}),f=gA({methodId:s.methodId,method:a,appId:c??null,app:d,fields:Pg(Nt(a).fields,s.fields??{},r.fields??{}),scopes:a.kind==="oauth"?es(a.config.scopes,s.scopes):[],aws:r.aws},l),p=await mA(this.client.custody,s.ownerId,u,s.users);return{kind:"saved",resource:await this.client.custody.save(s.name??a.name,kp(f),p,{previous:u,metadata:await Ep(f),labels:Cg(f),commit:async g=>{let y=await this.client.commit(e,g);return this.client.custody.api.json("/api/resources/"+E.parse(y.result?.id),{},mt)}}),operationId:n}}return this.client.connections.start(e,a,Pg(a.kind==="aws"?[]:a.config.fields,s.fields??{},r.fields??{}))}};function uie(t){let e=new x4(t);return new Map([["connection.authorize",{continue:r=>e.authorize(r)}],["app.save",{continue:(r,o)=>e.saveApplication(r,o)}],["connection.connect",{continue:(r,o)=>e.connect(r,o)}]])}function lie(t){return{continue:async(e,r)=>{let o=e.id,{input:n}=e,i=hq.parse(n),s=i.resourceId?await t.custody.latest(i.resourceId):void 0;if(s&&s.version!==i.version)throw new Error("This item changed. Reload it before saving.");let a=kt.value;if(s&&(s.content.policy.contentType!==a||s.content.policy.ownerId!==i.ownerId))throw new Error("Choose the item prepared by this operation.");let c=s&&!s.replaced?await t.custody.refreshRecipients(s.content.policy):await t.custody.policy(i.ownerId,a,s?{replacing:s.content.policy}:{});if(r.value===void 0)throw new Error("Enter the value to save.");let u=typeof r.value=="string"?Et(r.value):r.value;return{kind:"saved",resource:await t.custody.save(i.name,u,c,{previous:s,commit:async d=>mt.parse((await t.commit(e,d)).result)}),operationId:o}}}}function die(t){let e=uie(t);return e.set("variable.save",lie(t)),e}var fie=h.object({value:h.string().optional(),clientSecret:h.string().optional(),fields:h.record(h.string(),h.string()).optional(),scopes:h.array(h.string()).optional(),aws:aa.optional()}).strict(),pie=h.union([nr,Br]),SA=class{constructor(e,r){this.custody=e;this.connections=r;this.records=new Wv(e),this.operations=die(this)}custody;connections;records;operations;get(e){return this.custody.api.json("/api/operations/"+E.parse(e),{},nr)}async review(e,r=crypto.randomUUID()){let o=await this.custody.api.json("/api/operations/review",{method:"POST",body:vo.parse(e)},vo);return{id:r,...o,held:!1,continuation:null}}held(e){return{id:e.id,name:e.name,input:e.input,held:!0,continuation:e.continuation}}async perform(e,r={}){return this.operations.has(e.name)?this.proceed(await this.review(e),r):this.custody.api.json("/api/operations",{method:"POST",body:vo.parse(e)},pie)}async continue(e,r={}){let o=await this.get(e);return o.canPerform?o.keyholder?this.proceed(this.held(o),r):this.custody.api.json("/api/operations/"+o.id+"/perform",{method:"POST",body:{}},pie):o}proceed(e,r){let o=this.operations.get(e.name);if(!o)throw new Error("Choose an operation this device can make.");return o.continue(e,r)}async configure(e,r){return e.held?this.held(await this.custody.api.json("/api/operations/"+e.id,{method:"PATCH",body:{values:r}},nr)):this.review({name:e.name,input:{...e.input,...r}},e.id)}async commit(e,r){return e.held?this.custody.api.json("/api/operations/"+e.id+"/perform",{method:"POST",body:{proof:r}},nr):this.custody.api.json("/api/operations",{method:"POST",body:{id:e.id,name:e.name,input:e.input,proof:r}},nr)}};function lu(t,e=uu(t).custody){let r=new bA(e,new _A(e),new em(e.origin),"cli");return new SA(e,r)}var ze;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let i={};for(let s of n)i[s]=s;return i},t.getValidEnumValues=n=>{let i=t.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),s={};for(let a of i)s[a]=n[a];return t.objectValues(s)},t.objectValues=n=>t.objectKeys(n).map(function(i){return n[i]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&i.push(s);return i},t.find=(n,i)=>{for(let s of n)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function o(n,i=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=o,t.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(ze||(ze={}));var mie;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(mie||(mie={}));var B=ze.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ca=t=>{switch(typeof t){case"undefined":return B.undefined;case"string":return B.string;case"number":return Number.isNaN(t)?B.nan:B.number;case"boolean":return B.boolean;case"function":return B.function;case"bigint":return B.bigint;case"symbol":return B.symbol;case"object":return Array.isArray(t)?B.array:t===null?B.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?B.promise:typeof Map<"u"&&t instanceof Map?B.map:typeof Set<"u"&&t instanceof Set?B.set:typeof Date<"u"&&t instanceof Date?B.date:B.object;default:return B.unknown}};var O=ze.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var uo=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},o={_errors:[]},n=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)o._errors.push(r(s));else{let a=o,c=0;for(;c<s.path.length;){let u=s.path[c],l=c===s.path.length-1;if(u==="_errors"){l&&a._errors.push(r(s)),c++;continue}Object.prototype.hasOwnProperty.call(a,u)||(u==="__proto__"?Object.defineProperty(a,u,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):a[u]={_errors:[]}),a=a[u],l&&a._errors.push(r(s)),c++}}};return n(this),o}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ze.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),o=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];r[i]=r[i]||[],r[i].push(e(n))}else o.push(e(n));return{formErrors:o,fieldErrors:r}}get formErrors(){return this.flatten()}};uo.create=t=>new uo(t);var uRe=(t,e)=>{let r;switch(t.code){case O.invalid_type:t.received===B.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case O.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ze.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:r=`Unrecognized key(s) in object: ${ze.joinValues(t.keys,", ")}`;break;case O.invalid_union:r="Invalid input";break;case O.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ze.joinValues(t.options)}`;break;case O.invalid_enum_value:r=`Invalid enum value. Expected ${ze.joinValues(t.options)}, received '${t.received}'`;break;case O.invalid_arguments:r="Invalid function arguments";break;case O.invalid_return_type:r="Invalid function return type";break;case O.invalid_date:r="Invalid date";break;case O.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ze.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case O.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case O.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case O.custom:r="Invalid input";break;case O.invalid_intersection_types:r="Intersection results could not be merged";break;case O.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case O.not_finite:r="Number must be finite";break;default:r=e.defaultError,ze.assertNever(t)}return{message:r}},du=uRe;var lRe=du;function Jv(){return lRe}var xA=t=>{let{data:e,path:r,errorMaps:o,issueData:n}=t,i=[...r,...n.path||[]],s={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let a="",c=o.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...n,path:i,message:a}};function F(t,e){let r=Jv(),o=xA({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===du?void 0:du].filter(n=>!!n)});t.common.issues.push(o)}var tn=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let o=[];for(let n of r){if(n.status==="aborted")return oe;n.status==="dirty"&&e.dirty(),o.push(n.value)}return{status:e.value,value:o}}static async mergeObjectAsync(e,r){let o=[];for(let n of r){let i=await n.key,s=await n.value;o.push({key:i,value:s})}return t.mergeObjectSync(e,o)}static mergeObjectSync(e,r){let o={};for(let n of r){let{key:i,value:s}=n;if(i.status==="aborted"||s.status==="aborted")return oe;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(o[i.value]=s.value)}return{status:e.value,value:o}}},oe=Object.freeze({status:"aborted"}),tm=t=>({status:"dirty",value:t}),wn=t=>({status:"valid",value:t}),E4=t=>t.status==="aborted",k4=t=>t.status==="dirty",Fl=t=>t.status==="valid",Gv=t=>typeof Promise<"u"&&t instanceof Promise;var W;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(W||(W={}));var Ko=class{constructor(e,r,o,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=o,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},hie=(t,e)=>{if(Fl(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new uo(t.common.issues);return this._error=r,this._error}}};function we(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:o,description:n}=t;if(e&&(r||o))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??o??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:n}}var Te=class{get description(){return this._def.description}_getType(e){return Ca(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ca(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tn,ctx:{common:e.parent.common,data:e.data,parsedType:Ca(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Gv(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let o=this.safeParse(e,r);if(o.success)return o.data;throw o.error}safeParse(e,r){let o={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ca(e)},n=this._parseSync({data:e,path:o.path,parent:o});return hie(o,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ca(e)};if(!this["~standard"].async)try{let o=this._parseSync({data:e,path:[],parent:r});return Fl(o)?{value:o.value}:{issues:r.common.issues}}catch(o){o?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(o=>Fl(o)?{value:o.value}:{issues:r.common.issues})}async parseAsync(e,r){let o=await this.safeParseAsync(e,r);if(o.success)return o.data;throw o.error}async safeParseAsync(e,r){let o={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ca(e)},n=this._parse({data:e,path:o.path,parent:o}),i=await(Gv(n)?n:Promise.resolve(n));return hie(o,i)}refine(e,r){let o=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,i)=>{let s=e(n),a=()=>i.addIssue({code:O.custom,...o(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((o,n)=>e(o)?!0:(n.addIssue(typeof r=="function"?r(o,n):r),!1))}_refinement(e){return new Mi({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ji.create(this,this._def)}nullable(){return Da.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fu.create(this)}promise(){return Vl.create(this,this._def)}or(e){return sm.create([this,e],this._def)}and(e){return am.create(this,e,this._def)}transform(e){return new Mi({...we(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new pm({...we(this._def),innerType:this,defaultValue:r,typeName:z.ZodDefault})}brand(){return new EA({typeName:z.ZodBranded,type:this,...we(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new fm({...we(this._def),innerType:this,catchValue:r,typeName:z.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return kA.create(this,e)}readonly(){return mm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},dRe=/^c[^\s-]{8,}$/i,pRe=/^[0-9a-z]+$/,fRe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mRe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,hRe=/^[a-z0-9_-]{21}$/i,gRe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yRe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,vRe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wRe="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",I4,bRe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_Re=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,SRe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,xRe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ERe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kRe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gie="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",IRe=new RegExp(`^${gie}$`);function yie(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function $Re(t){return new RegExp(`^${yie(t)}$`)}function ARe(t){let e=`${gie}T${yie(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function TRe(t,e){return!!((e==="v4"||!e)&&bRe.test(t)||(e==="v6"||!e)&&SRe.test(t))}function PRe(t,e){if(!gRe.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let o=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(o));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function RRe(t,e){return!!((e==="v4"||!e)&&_Re.test(t)||(e==="v6"||!e)&&xRe.test(t))}var nm=class t extends Te{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==B.string){let i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_type,expected:B.string,received:i.parsedType}),oe}let o=new tn,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),F(n,{code:O.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),o.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),F(n,{code:O.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),o.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(n=this._getOrReturnCtx(e,n),s?F(n,{code:O.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&F(n,{code:O.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),o.dirty())}else if(i.kind==="email")vRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"email",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="emoji")I4||(I4=new RegExp(wRe,"u")),I4.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"emoji",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="uuid")mRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"uuid",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="nanoid")hRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"nanoid",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="cuid")dRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"cuid",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="cuid2")pRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"cuid2",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="ulid")fRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"ulid",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),F(n,{validation:"url",code:O.invalid_string,message:i.message}),o.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"regex",code:O.invalid_string,message:i.message}),o.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),F(n,{code:O.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),o.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),F(n,{code:O.invalid_string,validation:{startsWith:i.value},message:i.message}),o.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),F(n,{code:O.invalid_string,validation:{endsWith:i.value},message:i.message}),o.dirty()):i.kind==="datetime"?ARe(i).test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:O.invalid_string,validation:"datetime",message:i.message}),o.dirty()):i.kind==="date"?IRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:O.invalid_string,validation:"date",message:i.message}),o.dirty()):i.kind==="time"?$Re(i).test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:O.invalid_string,validation:"time",message:i.message}),o.dirty()):i.kind==="duration"?yRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"duration",code:O.invalid_string,message:i.message}),o.dirty()):i.kind==="ip"?TRe(e.data,i.version)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"ip",code:O.invalid_string,message:i.message}),o.dirty()):i.kind==="jwt"?PRe(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"jwt",code:O.invalid_string,message:i.message}),o.dirty()):i.kind==="cidr"?RRe(e.data,i.version)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"cidr",code:O.invalid_string,message:i.message}),o.dirty()):i.kind==="base64"?ERe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"base64",code:O.invalid_string,message:i.message}),o.dirty()):i.kind==="base64url"?kRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"base64url",code:O.invalid_string,message:i.message}),o.dirty()):ze.assertNever(i);return{status:o.value,value:e.data}}_regex(e,r,o){return this.refinement(n=>e.test(n),{validation:r,code:O.invalid_string,...W.errToObj(o)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...W.errToObj(e)})}url(e){return this._addCheck({kind:"url",...W.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...W.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...W.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...W.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...W.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...W.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...W.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...W.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...W.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...W.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...W.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...W.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...W.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...W.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...W.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...W.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...W.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...W.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...W.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...W.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...W.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...W.errToObj(r)})}nonempty(e){return this.min(1,W.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};nm.create=t=>new nm({checks:[],typeName:z.ZodString,coerce:t?.coerce??!1,...we(t)});function CRe(t,e){let r=(t.toString().split(".")[1]||"").length,o=(e.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return i%s/10**n}var Xv=class t extends Te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==B.number){let i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_type,expected:B.number,received:i.parsedType}),oe}let o,n=new tn;for(let i of this._def.checks)i.kind==="int"?ze.isInteger(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{code:O.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(o=this._getOrReturnCtx(e,o),F(o,{code:O.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(o=this._getOrReturnCtx(e,o),F(o,{code:O.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?CRe(e.data,i.value)!==0&&(o=this._getOrReturnCtx(e,o),F(o,{code:O.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{code:O.not_finite,message:i.message}),n.dirty()):ze.assertNever(i);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,W.toString(r))}gt(e,r){return this.setLimit("min",e,!1,W.toString(r))}lte(e,r){return this.setLimit("max",e,!0,W.toString(r))}lt(e,r){return this.setLimit("max",e,!1,W.toString(r))}setLimit(e,r,o,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:o,message:W.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:W.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:W.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:W.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:W.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:W.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ze.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(r===null||o.value>r)&&(r=o.value):o.kind==="max"&&(e===null||o.value<e)&&(e=o.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Xv.create=t=>new Xv({checks:[],typeName:z.ZodNumber,coerce:t?.coerce||!1,...we(t)});var Yv=class t extends Te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==B.bigint)return this._getInvalidInput(e);let o,n=new tn;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(o=this._getOrReturnCtx(e,o),F(o,{code:O.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(o=this._getOrReturnCtx(e,o),F(o,{code:O.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(o=this._getOrReturnCtx(e,o),F(o,{code:O.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):ze.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return F(r,{code:O.invalid_type,expected:B.bigint,received:r.parsedType}),oe}gte(e,r){return this.setLimit("min",e,!0,W.toString(r))}gt(e,r){return this.setLimit("min",e,!1,W.toString(r))}lte(e,r){return this.setLimit("max",e,!0,W.toString(r))}lt(e,r){return this.setLimit("max",e,!1,W.toString(r))}setLimit(e,r,o,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:o,message:W.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:W.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Yv.create=t=>new Yv({checks:[],typeName:z.ZodBigInt,coerce:t?.coerce??!1,...we(t)});var Qv=class extends Te{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==B.boolean){let o=this._getOrReturnCtx(e);return F(o,{code:O.invalid_type,expected:B.boolean,received:o.parsedType}),oe}return wn(e.data)}};Qv.create=t=>new Qv({typeName:z.ZodBoolean,coerce:t?.coerce||!1,...we(t)});var ew=class t extends Te{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==B.date){let i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_type,expected:B.date,received:i.parsedType}),oe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_date}),oe}let o=new tn,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),F(n,{code:O.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),o.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),F(n,{code:O.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),o.dirty()):ze.assertNever(i);return{status:o.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:W.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:W.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};ew.create=t=>new ew({checks:[],coerce:t?.coerce||!1,typeName:z.ZodDate,...we(t)});var tw=class extends Te{_parse(e){if(this._getType(e)!==B.symbol){let o=this._getOrReturnCtx(e);return F(o,{code:O.invalid_type,expected:B.symbol,received:o.parsedType}),oe}return wn(e.data)}};tw.create=t=>new tw({typeName:z.ZodSymbol,...we(t)});var om=class extends Te{_parse(e){if(this._getType(e)!==B.undefined){let o=this._getOrReturnCtx(e);return F(o,{code:O.invalid_type,expected:B.undefined,received:o.parsedType}),oe}return wn(e.data)}};om.create=t=>new om({typeName:z.ZodUndefined,...we(t)});var im=class extends Te{_parse(e){if(this._getType(e)!==B.null){let o=this._getOrReturnCtx(e);return F(o,{code:O.invalid_type,expected:B.null,received:o.parsedType}),oe}return wn(e.data)}};im.create=t=>new im({typeName:z.ZodNull,...we(t)});var rw=class extends Te{constructor(){super(...arguments),this._any=!0}_parse(e){return wn(e.data)}};rw.create=t=>new rw({typeName:z.ZodAny,...we(t)});var pu=class extends Te{constructor(){super(...arguments),this._unknown=!0}_parse(e){return wn(e.data)}};pu.create=t=>new pu({typeName:z.ZodUnknown,...we(t)});var qs=class extends Te{_parse(e){let r=this._getOrReturnCtx(e);return F(r,{code:O.invalid_type,expected:B.never,received:r.parsedType}),oe}};qs.create=t=>new qs({typeName:z.ZodNever,...we(t)});var nw=class extends Te{_parse(e){if(this._getType(e)!==B.undefined){let o=this._getOrReturnCtx(e);return F(o,{code:O.invalid_type,expected:B.void,received:o.parsedType}),oe}return wn(e.data)}};nw.create=t=>new nw({typeName:z.ZodVoid,...we(t)});var fu=class t extends Te{_parse(e){let{ctx:r,status:o}=this._processInputParams(e),n=this._def;if(r.parsedType!==B.array)return F(r,{code:O.invalid_type,expected:B.array,received:r.parsedType}),oe;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,a=r.data.length<n.exactLength.value;(s||a)&&(F(r,{code:s?O.too_big:O.too_small,minimum:a?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),o.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(F(r,{code:O.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),o.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(F(r,{code:O.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),o.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>n.type._parseAsync(new Ko(r,s,r.path,a)))).then(s=>tn.mergeArray(o,s));let i=[...r.data].map((s,a)=>n.type._parseSync(new Ko(r,s,r.path,a)));return tn.mergeArray(o,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:W.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:W.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:W.toString(r)}})}nonempty(e){return this.min(1,e)}};fu.create=(t,e)=>new fu({type:t,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...we(e)});function rm(t){if(t instanceof lo){let e={};for(let r in t.shape){let o=t.shape[r];e[r]=ji.create(rm(o))}return new lo({...t._def,shape:()=>e})}else return t instanceof fu?new fu({...t._def,type:rm(t.element)}):t instanceof ji?ji.create(rm(t.unwrap())):t instanceof Da?Da.create(rm(t.unwrap())):t instanceof Na?Na.create(t.items.map(e=>rm(e))):t}var lo=class t extends Te{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ze.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==B.object){let u=this._getOrReturnCtx(e);return F(u,{code:O.invalid_type,expected:B.object,received:u.parsedType}),oe}let{status:o,ctx:n}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof qs&&this._def.unknownKeys==="strip"))for(let u in n.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=i[u],d=n.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Ko(n,d,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof qs){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:n.data[l]}});else if(u==="strict")a.length>0&&(F(n,{code:O.unrecognized_keys,keys:a}),o.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=n.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Ko(n,d,n.path,l)),alwaysSet:l in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>tn.mergeObjectSync(o,u)):tn.mergeObjectSync(o,c)}get shape(){return this._def.shape()}strict(e){return W.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,o)=>{let n=this._def.errorMap?.(r,o).message??o.defaultError;return r.code==="unrecognized_keys"?{message:W.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:z.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let o of ze.objectKeys(e))e[o]&&this.shape[o]&&(r[o]=this.shape[o]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let o of ze.objectKeys(this.shape))e[o]||(r[o]=this.shape[o]);return new t({...this._def,shape:()=>r})}deepPartial(){return rm(this)}partial(e){let r={};for(let o of ze.objectKeys(this.shape)){let n=this.shape[o];e&&!e[o]?r[o]=n:r[o]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let o of ze.objectKeys(this.shape))if(e&&!e[o])r[o]=this.shape[o];else{let i=this.shape[o];for(;i instanceof ji;)i=i._def.innerType;r[o]=i}return new t({...this._def,shape:()=>r})}keyof(){return vie(ze.objectKeys(this.shape))}};lo.create=(t,e)=>new lo({shape:()=>t,unknownKeys:"strip",catchall:qs.create(),typeName:z.ZodObject,...we(e)});lo.strictCreate=(t,e)=>new lo({shape:()=>t,unknownKeys:"strict",catchall:qs.create(),typeName:z.ZodObject,...we(e)});lo.lazycreate=(t,e)=>new lo({shape:t,unknownKeys:"strip",catchall:qs.create(),typeName:z.ZodObject,...we(e)});var sm=class extends Te{_parse(e){let{ctx:r}=this._processInputParams(e),o=this._def.options;function n(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new uo(a.ctx.common.issues));return F(r,{code:O.invalid_union,unionErrors:s}),oe}if(r.common.async)return Promise.all(o.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(n);{let i,s=[];for(let c of o){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new uo(c));return F(r,{code:O.invalid_union,unionErrors:a}),oe}}get options(){return this._def.options}};sm.create=(t,e)=>new sm({options:t,typeName:z.ZodUnion,...we(e)});var Oa=t=>t instanceof cm?Oa(t.schema):t instanceof Mi?Oa(t.innerType()):t instanceof um?[t.value]:t instanceof lm?t.options:t instanceof dm?ze.objectValues(t.enum):t instanceof pm?Oa(t._def.innerType):t instanceof om?[void 0]:t instanceof im?[null]:t instanceof ji?[void 0,...Oa(t.unwrap())]:t instanceof Da?[null,...Oa(t.unwrap())]:t instanceof EA||t instanceof mm?Oa(t.unwrap()):t instanceof fm?Oa(t._def.innerType):[],$4=class t extends Te{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.object)return F(r,{code:O.invalid_type,expected:B.object,received:r.parsedType}),oe;let o=this.discriminator,n=r.data[o],i=this.optionsMap.get(n);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(F(r,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,o){let n=new Map;for(let i of r){let s=Oa(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,i)}}return new t({typeName:z.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...we(o)})}};function A4(t,e){let r=Ca(t),o=Ca(e);if(t===e)return{valid:!0,data:t};if(r===B.object&&o===B.object){let n=ze.objectKeys(e),i=ze.objectKeys(t).filter(a=>n.indexOf(a)!==-1),s={...t,...e};Object.prototype.hasOwnProperty.call(s,"__proto__")&&delete s.__proto__;for(let a of i){if(a==="__proto__")continue;let c=A4(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===B.array&&o===B.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let s=t[i],a=e[i],c=A4(s,a);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===B.date&&o===B.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var am=class extends Te{_parse(e){let{status:r,ctx:o}=this._processInputParams(e),n=(i,s)=>{if(E4(i)||E4(s))return oe;let a=A4(i.value,s.value);return a.valid?((k4(i)||k4(s))&&r.dirty(),{status:r.value,value:a.data}):(F(o,{code:O.invalid_intersection_types}),oe)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([i,s])=>n(i,s)):n(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}};am.create=(t,e,r)=>new am({left:t,right:e,typeName:z.ZodIntersection,...we(r)});var Na=class t extends Te{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==B.array)return F(o,{code:O.invalid_type,expected:B.array,received:o.parsedType}),oe;if(o.data.length<this._def.items.length)return F(o,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&o.data.length>this._def.items.length&&(F(o,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...o.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Ko(o,s,o.path,a)):null}).filter(s=>!!s);return o.common.async?Promise.all(i).then(s=>tn.mergeArray(r,s)):tn.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Na.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Na({items:t,typeName:z.ZodTuple,rest:null,...we(e)})};var T4=class t extends Te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==B.object)return F(o,{code:O.invalid_type,expected:B.object,received:o.parsedType}),oe;let n=[],i=this._def.keyType,s=this._def.valueType;for(let a in o.data)n.push({key:i._parse(new Ko(o,a,o.path,a)),value:s._parse(new Ko(o,o.data[a],o.path,a)),alwaysSet:a in o.data});return o.common.async?tn.mergeObjectAsync(r,n):tn.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,o){return r instanceof Te?new t({keyType:e,valueType:r,typeName:z.ZodRecord,...we(o)}):new t({keyType:nm.create(),valueType:e,typeName:z.ZodRecord,...we(r)})}},ow=class extends Te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==B.map)return F(o,{code:O.invalid_type,expected:B.map,received:o.parsedType}),oe;let n=this._def.keyType,i=this._def.valueType,s=[...o.data.entries()].map(([a,c],u)=>({key:n._parse(new Ko(o,a,o.path,[u,"key"])),value:i._parse(new Ko(o,c,o.path,[u,"value"]))}));if(o.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return oe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return oe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};ow.create=(t,e,r)=>new ow({valueType:e,keyType:t,typeName:z.ZodMap,...we(r)});var iw=class t extends Te{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==B.set)return F(o,{code:O.invalid_type,expected:B.set,received:o.parsedType}),oe;let n=this._def;n.minSize!==null&&o.data.size<n.minSize.value&&(F(o,{code:O.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&o.data.size>n.maxSize.value&&(F(o,{code:O.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return oe;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...o.data.values()].map((c,u)=>i._parse(new Ko(o,c,o.path,u)));return o.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:W.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:W.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};iw.create=(t,e)=>new iw({valueType:t,minSize:null,maxSize:null,typeName:z.ZodSet,...we(e)});var P4=class t extends Te{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.function)return F(r,{code:O.invalid_type,expected:B.function,received:r.parsedType}),oe;function o(a,c){return xA({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Jv(),du].filter(u=>!!u),issueData:{code:O.invalid_arguments,argumentsError:c}})}function n(a,c){return xA({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Jv(),du].filter(u=>!!u),issueData:{code:O.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Vl){let a=this;return wn(async function(...c){let u=new uo([]),l=await a._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(o(c,p)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(n(d,p)),u})})}else{let a=this;return wn(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new uo([o(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new uo([n(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Na.create(e).rest(pu.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,o){return new t({args:e||Na.create([]).rest(pu.create()),returns:r||pu.create(),typeName:z.ZodFunction,...we(o)})}},cm=class extends Te{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};cm.create=(t,e)=>new cm({getter:t,typeName:z.ZodLazy,...we(e)});var um=class extends Te{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return F(r,{received:r.data,code:O.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:e.data}}get value(){return this._def.value}};um.create=(t,e)=>new um({value:t,typeName:z.ZodLiteral,...we(e)});function vie(t,e){return new lm({values:t,typeName:z.ZodEnum,...we(e)})}var lm=class t extends Te{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),o=this._def.values;return F(r,{expected:ze.joinValues(o),received:r.parsedType,code:O.invalid_type}),oe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),o=this._def.values;return F(r,{received:r.data,code:O.invalid_enum_value,options:o}),oe}return wn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(o=>!e.includes(o)),{...this._def,...r})}};lm.create=vie;var dm=class extends Te{_parse(e){let r=ze.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(e);if(o.parsedType!==B.string&&o.parsedType!==B.number){let n=ze.objectValues(r);return F(o,{expected:ze.joinValues(n),received:o.parsedType,code:O.invalid_type}),oe}if(this._cache||(this._cache=new Set(ze.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=ze.objectValues(r);return F(o,{received:o.data,code:O.invalid_enum_value,options:n}),oe}return wn(e.data)}get enum(){return this._def.values}};dm.create=(t,e)=>new dm({values:t,typeName:z.ZodNativeEnum,...we(e)});var Vl=class extends Te{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.promise&&r.common.async===!1)return F(r,{code:O.invalid_type,expected:B.promise,received:r.parsedType}),oe;let o=r.parsedType===B.promise?r.data:Promise.resolve(r.data);return wn(o.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Vl.create=(t,e)=>new Vl({type:t,typeName:z.ZodPromise,...we(e)});var Mi=class extends Te{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:o}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:s=>{F(o,s),s.fatal?r.abort():r.dirty()},get path(){return o.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let s=n.transform(o.data,i);if(o.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return oe;let c=await this._def.schema._parseAsync({data:a,path:o.path,parent:o});return c.status==="aborted"?oe:c.status==="dirty"?tm(c.value):r.value==="dirty"?tm(c.value):c});{if(r.value==="aborted")return oe;let a=this._def.schema._parseSync({data:s,path:o.path,parent:o});return a.status==="aborted"?oe:a.status==="dirty"?tm(a.value):r.value==="dirty"?tm(a.value):a}}if(n.type==="refinement"){let s=a=>{let c=n.refinement(a,i);if(o.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(o.common.async===!1){let a=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return a.status==="aborted"?oe:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(a=>a.status==="aborted"?oe:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(n.type==="transform")if(o.common.async===!1){let s=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!Fl(s))return oe;let a=n.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(s=>Fl(s)?Promise.resolve(n.transform(s.value,i)).then(a=>({status:r.value,value:a})):oe);ze.assertNever(n)}};Mi.create=(t,e,r)=>new Mi({schema:t,typeName:z.ZodEffects,effect:e,...we(r)});Mi.createWithPreprocess=(t,e,r)=>new Mi({schema:e,effect:{type:"preprocess",transform:t},typeName:z.ZodEffects,...we(r)});var ji=class extends Te{_parse(e){return this._getType(e)===B.undefined?wn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ji.create=(t,e)=>new ji({innerType:t,typeName:z.ZodOptional,...we(e)});var Da=class extends Te{_parse(e){return this._getType(e)===B.null?wn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Da.create=(t,e)=>new Da({innerType:t,typeName:z.ZodNullable,...we(e)});var pm=class extends Te{_parse(e){let{ctx:r}=this._processInputParams(e),o=r.data;return r.parsedType===B.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};pm.create=(t,e)=>new pm({innerType:t,typeName:z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...we(e)});var fm=class extends Te{_parse(e){let{ctx:r}=this._processInputParams(e),o={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return Gv(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new uo(o.common.issues)},input:o.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new uo(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}};fm.create=(t,e)=>new fm({innerType:t,typeName:z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...we(e)});var sw=class extends Te{_parse(e){if(this._getType(e)!==B.nan){let o=this._getOrReturnCtx(e);return F(o,{code:O.invalid_type,expected:B.nan,received:o.parsedType}),oe}return{status:"valid",value:e.data}}};sw.create=t=>new sw({typeName:z.ZodNaN,...we(t)});var EA=class extends Te{_parse(e){let{ctx:r}=this._processInputParams(e),o=r.data;return this._def.type._parse({data:o,path:r.path,parent:r})}unwrap(){return this._def.type}},kA=class t extends Te{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return i.status==="aborted"?oe:i.status==="dirty"?(r.dirty(),tm(i.value)):this._def.out._parseAsync({data:i.value,path:o.path,parent:o})})();{let n=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return n.status==="aborted"?oe:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:o.path,parent:o})}}static create(e,r){return new t({in:e,out:r,typeName:z.ZodPipeline})}},mm=class extends Te{_parse(e){let r=this._def.innerType._parse(e),o=n=>(Fl(n)&&(n.value=Object.freeze(n.value)),n);return Gv(r)?r.then(n=>o(n)):o(r)}unwrap(){return this._def.innerType}};mm.create=(t,e)=>new mm({innerType:t,typeName:z.ZodReadonly,...we(e)});var Uwt={object:lo.lazycreate},z;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(z||(z={}));var Lwt=nm.create,Fwt=Xv.create,Vwt=sw.create,Hwt=Yv.create,Bwt=Qv.create,Kwt=ew.create,qwt=tw.create,Zwt=om.create,Wwt=im.create,Jwt=rw.create,Gwt=pu.create,Xwt=qs.create,Ywt=nw.create,Qwt=fu.create,wie=lo.create,ebt=lo.strictCreate,tbt=sm.create,rbt=$4.create,nbt=am.create,obt=Na.create,ibt=T4.create,sbt=ow.create,abt=iw.create,cbt=P4.create,ubt=cm.create,lbt=um.create,dbt=lm.create,pbt=dm.create,fbt=Vl.create,mbt=Mi.create,hbt=ji.create,gbt=Da.create,ybt=Mi.createWithPreprocess,vbt=kA.create;var NRe=S("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");ae.init(t,e),t.def=e,t.type=e.type},{get with(){return this.check},set with(t){Zi(this,"with",t)},parse(t,e){return Pu(this,t,e,{callee:this.parse})},parseAsync(t,e){return Ru(this,t,e,{callee:this.parseAsync})},safeParse(t,e){return md(this,t,e)},safeParseAsync(t,e){return gd(this,t,e)},check(...t){let e=this.def;return this.clone({...e,checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(t,e){return qe(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},apply(t,...e){return e.length===0?t(this):t(this,...e)}});var DRe=S("ZodMiniObject",(t,e)=>{h_.init(t,e),NRe.init(t,e),rP(t,"shape",r=>r._zod.def.shape,!1)});function R4(t,e){let r={type:"object",shape:t??{},...N(e)};return new DRe(r)}function Zs(t){return!!t._zod}function Hl(t){let e=Object.values(t);if(e.length===0)return R4({});let r=e.every(Zs),o=e.every(n=>!Zs(n));if(r)return R4(t);if(o)return wie(t);throw new Error("Mixed Zod versions detected in object shape.")}function mu(t,e){return Zs(t)?md(t,e):t.safeParse(e)}async function IA(t,e){return Zs(t)?await gd(t,e):await t.safeParseAsync(e)}function hu(t){if(!t)return;let e;if(Zs(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function hm(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let o=Object.values(t);if(o.length>0&&o.every(n=>typeof n=="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse=="function")))return Hl(t)}}if(Zs(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function jRe(t){return t.length===0?"object root":t.reduce((e,r,o)=>o===0?String(r):typeof r=="number"?`${e}[${r}]`:`${e}.${r}`,"")}function $A(t){if(t&&typeof t=="object"){if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0)return t.issues.map(e=>e.path?.length?`${e.message} at ${jRe(e.path)}`:e.message).join(`
141
- `);if("message"in t&&typeof t.message=="string")return t.message;try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function bie(t){return t.description}function _ie(t){if(Zs(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function gm(t){if(Zs(t)){let i=t._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=t.value;if(o!==void 0)return o}var O4="2025-11-25";var Sie=[O4,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],gu="io.modelcontextprotocol/related-task",TA="2.0",ar=dx(t=>t!==null&&(typeof t=="object"||typeof t=="function")),xie=tt([I(),Ze().int()]),Eie=I(),Cbt=br({ttl:Ze().optional(),pollInterval:Ze().optional()}),MRe=H({ttl:Ze().optional()}),URe=H({taskId:I()}),N4=br({progressToken:xie.optional(),[gu]:URe.optional()}),po=H({_meta:N4.optional()}),aw=po.extend({task:MRe.optional()}),kie=t=>aw.safeParse(t).success,zr=H({method:I(),params:po.loose().optional()}),qo=H({_meta:N4.optional()}),Zo=H({method:I(),params:qo.loose().optional()}),jr=br({_meta:N4.optional()}),PA=tt([I(),Ze().int()]),Iie=H({jsonrpc:G(TA),id:PA,...zr.shape}).strict(),D4=t=>Iie.safeParse(t).success,$ie=H({jsonrpc:G(TA),...Zo.shape}).strict(),Aie=t=>$ie.safeParse(t).success,z4=H({jsonrpc:G(TA),id:PA,result:jr}).strict(),cw=t=>z4.safeParse(t).success;var Y;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Y||(Y={}));var j4=H({jsonrpc:G(TA),id:PA.optional(),error:H({code:Ze().int(),message:I(),data:ut().optional()})}).strict();var Tie=t=>j4.safeParse(t).success;var Pie=tt([Iie,$ie,z4,j4]),Obt=tt([z4,j4]),RA=jr.strict(),LRe=qo.extend({requestId:PA.optional(),reason:I().optional()}),CA=Zo.extend({method:G("notifications/cancelled"),params:LRe}),FRe=H({src:I(),mimeType:I().optional(),sizes:Ae(I()).optional(),theme:_r(["light","dark"]).optional()}),uw=H({icons:Ae(FRe).optional()}),ym=H({name:I(),title:I().optional()}),Rie=ym.extend({...ym.shape,...uw.shape,version:I(),websiteUrl:I().optional(),description:I().optional()}),VRe=Yd(H({applyDefaults:Vt().optional()}),st(I(),ut())),HRe=tg(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Yd(H({form:VRe.optional(),url:ar.optional()}),st(I(),ut()).optional())),BRe=br({list:ar.optional(),cancel:ar.optional(),requests:br({sampling:br({createMessage:ar.optional()}).optional(),elicitation:br({create:ar.optional()}).optional()}).optional()}),KRe=br({list:ar.optional(),cancel:ar.optional(),requests:br({tools:br({call:ar.optional()}).optional()}).optional()}),qRe=H({experimental:st(I(),ar).optional(),sampling:H({context:ar.optional(),tools:ar.optional()}).optional(),elicitation:HRe.optional(),roots:H({listChanged:Vt().optional()}).optional(),tasks:BRe.optional(),extensions:st(I(),ar).optional()}),ZRe=po.extend({protocolVersion:I(),capabilities:qRe,clientInfo:Rie}),M4=zr.extend({method:G("initialize"),params:ZRe});var WRe=H({experimental:st(I(),ar).optional(),logging:ar.optional(),completions:ar.optional(),prompts:H({listChanged:Vt().optional()}).optional(),resources:H({subscribe:Vt().optional(),listChanged:Vt().optional()}).optional(),tools:H({listChanged:Vt().optional()}).optional(),tasks:KRe.optional(),extensions:st(I(),ar).optional()}),JRe=jr.extend({protocolVersion:I(),capabilities:WRe,serverInfo:Rie,instructions:I().optional()}),U4=Zo.extend({method:G("notifications/initialized"),params:qo.optional()});var OA=zr.extend({method:G("ping"),params:po.optional()}),GRe=H({progress:Ze(),total:ot(Ze()),message:ot(I())}),XRe=H({...qo.shape,...GRe.shape,progressToken:xie}),NA=Zo.extend({method:G("notifications/progress"),params:XRe}),YRe=po.extend({cursor:Eie.optional()}),lw=zr.extend({params:YRe.optional()}),dw=jr.extend({nextCursor:Eie.optional()}),QRe=_r(["working","input_required","completed","failed","cancelled"]),pw=H({taskId:I(),status:QRe,ttl:tt([Ze(),Zh()]),createdAt:I(),lastUpdatedAt:I(),pollInterval:ot(Ze()),statusMessage:ot(I())}),vm=jr.extend({task:pw}),eCe=qo.merge(pw),fw=Zo.extend({method:G("notifications/tasks/status"),params:eCe}),DA=zr.extend({method:G("tasks/get"),params:po.extend({taskId:I()})}),zA=jr.merge(pw),jA=zr.extend({method:G("tasks/result"),params:po.extend({taskId:I()})}),Nbt=jr.loose(),MA=lw.extend({method:G("tasks/list")}),UA=dw.extend({tasks:Ae(pw)}),LA=zr.extend({method:G("tasks/cancel"),params:po.extend({taskId:I()})}),Cie=jr.merge(pw),Oie=H({uri:I(),mimeType:ot(I()),_meta:st(I(),ut()).optional()}),Nie=Oie.extend({text:I()}),L4=I().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Die=Oie.extend({blob:L4}),mw=_r(["user","assistant"]),wm=H({audience:Ae(mw).optional(),priority:Ze().min(0).max(1).optional(),lastModified:Ku.datetime({offset:!0}).optional()}),zie=H({...ym.shape,...uw.shape,uri:I(),description:ot(I()),mimeType:ot(I()),size:ot(Ze()),annotations:wm.optional(),_meta:ot(br({}))}),tCe=H({...ym.shape,...uw.shape,uriTemplate:I(),description:ot(I()),mimeType:ot(I()),annotations:wm.optional(),_meta:ot(br({}))}),FA=lw.extend({method:G("resources/list")}),rCe=dw.extend({resources:Ae(zie)}),VA=lw.extend({method:G("resources/templates/list")}),nCe=dw.extend({resourceTemplates:Ae(tCe)}),F4=po.extend({uri:I()}),oCe=F4,HA=zr.extend({method:G("resources/read"),params:oCe}),iCe=jr.extend({contents:Ae(tt([Nie,Die]))}),sCe=Zo.extend({method:G("notifications/resources/list_changed"),params:qo.optional()}),aCe=F4,cCe=zr.extend({method:G("resources/subscribe"),params:aCe}),uCe=F4,lCe=zr.extend({method:G("resources/unsubscribe"),params:uCe}),dCe=qo.extend({uri:I()}),pCe=Zo.extend({method:G("notifications/resources/updated"),params:dCe}),fCe=H({name:I(),description:ot(I()),required:ot(Vt())}),mCe=H({...ym.shape,...uw.shape,description:ot(I()),arguments:ot(Ae(fCe)),_meta:ot(br({}))}),BA=lw.extend({method:G("prompts/list")}),hCe=dw.extend({prompts:Ae(mCe)}),gCe=po.extend({name:I(),arguments:st(I(),I()).optional()}),KA=zr.extend({method:G("prompts/get"),params:gCe}),V4=H({type:G("text"),text:I(),annotations:wm.optional(),_meta:st(I(),ut()).optional()}),H4=H({type:G("image"),data:L4,mimeType:I(),annotations:wm.optional(),_meta:st(I(),ut()).optional()}),B4=H({type:G("audio"),data:L4,mimeType:I(),annotations:wm.optional(),_meta:st(I(),ut()).optional()}),yCe=H({type:G("tool_use"),name:I(),id:I(),input:st(I(),ut()),_meta:st(I(),ut()).optional()}),vCe=H({type:G("resource"),resource:tt([Nie,Die]),annotations:wm.optional(),_meta:st(I(),ut()).optional()}),wCe=zie.extend({type:G("resource_link")}),K4=tt([V4,H4,B4,wCe,vCe]),bCe=H({role:mw,content:K4}),_Ce=jr.extend({description:I().optional(),messages:Ae(bCe)}),SCe=Zo.extend({method:G("notifications/prompts/list_changed"),params:qo.optional()}),xCe=H({title:I().optional(),readOnlyHint:Vt().optional(),destructiveHint:Vt().optional(),idempotentHint:Vt().optional(),openWorldHint:Vt().optional()}),ECe=H({taskSupport:_r(["required","optional","forbidden"]).optional()}),jie=H({...ym.shape,...uw.shape,description:I().optional(),inputSchema:H({type:G("object"),properties:st(I(),ar).optional(),required:Ae(I()).optional()}).catchall(ut()),outputSchema:H({type:G("object"),properties:st(I(),ar).optional(),required:Ae(I()).optional()}).catchall(ut()).optional(),annotations:xCe.optional(),execution:ECe.optional(),_meta:st(I(),ut()).optional()}),qA=lw.extend({method:G("tools/list")}),kCe=dw.extend({tools:Ae(jie)}),ZA=jr.extend({content:Ae(K4).default([]),structuredContent:st(I(),ut()).optional(),isError:Vt().optional()}),Dbt=ZA.or(jr.extend({toolResult:ut()})),ICe=aw.extend({name:I(),arguments:st(I(),ut()).optional()}),bm=zr.extend({method:G("tools/call"),params:ICe}),$Ce=Zo.extend({method:G("notifications/tools/list_changed"),params:qo.optional()}),zbt=H({autoRefresh:Vt().default(!0),debounceMs:Ze().int().nonnegative().default(300)}),hw=_r(["debug","info","notice","warning","error","critical","alert","emergency"]),ACe=po.extend({level:hw}),q4=zr.extend({method:G("logging/setLevel"),params:ACe}),TCe=qo.extend({level:hw,logger:I().optional(),data:ut()}),PCe=Zo.extend({method:G("notifications/message"),params:TCe}),RCe=H({name:I().optional()}),CCe=H({hints:Ae(RCe).optional(),costPriority:Ze().min(0).max(1).optional(),speedPriority:Ze().min(0).max(1).optional(),intelligencePriority:Ze().min(0).max(1).optional()}),OCe=H({mode:_r(["auto","required","none"]).optional()}),NCe=H({type:G("tool_result"),toolUseId:I().describe("The unique identifier for the corresponding tool call."),content:Ae(K4).default([]),structuredContent:H({}).loose().optional(),isError:Vt().optional(),_meta:st(I(),ut()).optional()}),DCe=Xh("type",[V4,H4,B4]),AA=Xh("type",[V4,H4,B4,yCe,NCe]),zCe=H({role:mw,content:tt([AA,Ae(AA)]),_meta:st(I(),ut()).optional()}),jCe=aw.extend({messages:Ae(zCe),modelPreferences:CCe.optional(),systemPrompt:I().optional(),includeContext:_r(["none","thisServer","allServers"]).optional(),temperature:Ze().optional(),maxTokens:Ze().int(),stopSequences:Ae(I()).optional(),metadata:ar.optional(),tools:Ae(jie).optional(),toolChoice:OCe.optional()}),MCe=zr.extend({method:G("sampling/createMessage"),params:jCe}),gw=jr.extend({model:I(),stopReason:ot(_r(["endTurn","stopSequence","maxTokens"]).or(I())),role:mw,content:DCe}),Z4=jr.extend({model:I(),stopReason:ot(_r(["endTurn","stopSequence","maxTokens","toolUse"]).or(I())),role:mw,content:tt([AA,Ae(AA)])}),UCe=H({type:G("boolean"),title:I().optional(),description:I().optional(),default:Vt().optional()}),LCe=H({type:G("string"),title:I().optional(),description:I().optional(),minLength:Ze().optional(),maxLength:Ze().optional(),format:_r(["email","uri","date","date-time"]).optional(),default:I().optional()}),FCe=H({type:_r(["number","integer"]),title:I().optional(),description:I().optional(),minimum:Ze().optional(),maximum:Ze().optional(),default:Ze().optional()}),VCe=H({type:G("string"),title:I().optional(),description:I().optional(),enum:Ae(I()),default:I().optional()}),HCe=H({type:G("string"),title:I().optional(),description:I().optional(),oneOf:Ae(H({const:I(),title:I()})),default:I().optional()}),BCe=H({type:G("string"),title:I().optional(),description:I().optional(),enum:Ae(I()),enumNames:Ae(I()).optional(),default:I().optional()}),KCe=tt([VCe,HCe]),qCe=H({type:G("array"),title:I().optional(),description:I().optional(),minItems:Ze().optional(),maxItems:Ze().optional(),items:H({type:G("string"),enum:Ae(I())}),default:Ae(I()).optional()}),ZCe=H({type:G("array"),title:I().optional(),description:I().optional(),minItems:Ze().optional(),maxItems:Ze().optional(),items:H({anyOf:Ae(H({const:I(),title:I()}))}),default:Ae(I()).optional()}),WCe=tt([qCe,ZCe]),JCe=tt([BCe,KCe,WCe]),GCe=tt([JCe,UCe,LCe,FCe]),XCe=aw.extend({mode:G("form").optional(),message:I(),requestedSchema:H({type:G("object"),properties:st(I(),GCe),required:Ae(I()).optional()})}),YCe=aw.extend({mode:G("url"),message:I(),elicitationId:I(),url:I().url()}),QCe=tt([XCe,YCe]),eOe=zr.extend({method:G("elicitation/create"),params:QCe}),tOe=qo.extend({elicitationId:I()}),rOe=Zo.extend({method:G("notifications/elicitation/complete"),params:tOe}),_m=jr.extend({action:_r(["accept","decline","cancel"]),content:tg(t=>t===null?void 0:t,st(I(),tt([I(),Ze(),Vt(),Ae(I())])).optional())}),nOe=H({type:G("ref/resource"),uri:I()});var oOe=H({type:G("ref/prompt"),name:I()}),iOe=po.extend({ref:tt([oOe,nOe]),argument:H({name:I(),value:I()}),context:H({arguments:st(I(),I()).optional()}).optional()}),WA=zr.extend({method:G("completion/complete"),params:iOe});function Mie(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function Uie(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var sOe=jr.extend({completion:br({values:Ae(I()).max(100),total:ot(Ze().int()),hasMore:ot(Vt())})}),aOe=H({uri:I().startsWith("file://"),name:I().optional(),_meta:st(I(),ut()).optional()}),cOe=zr.extend({method:G("roots/list"),params:po.optional()}),W4=jr.extend({roots:Ae(aOe)}),uOe=Zo.extend({method:G("notifications/roots/list_changed"),params:qo.optional()}),jbt=tt([OA,M4,WA,q4,KA,BA,FA,VA,HA,cCe,lCe,bm,qA,DA,jA,MA,LA]),Mbt=tt([CA,NA,U4,uOe,fw]),Ubt=tt([RA,gw,Z4,_m,W4,zA,UA,vm]),Lbt=tt([OA,MCe,eOe,cOe,DA,jA,MA,LA]),Fbt=tt([CA,NA,PCe,pCe,sCe,$Ce,SCe,fw,rOe]),Vbt=tt([RA,JRe,sOe,_Ce,hCe,rCe,nCe,iCe,ZA,kCe,zA,UA,vm]),q=class t extends Error{constructor(e,r,o){super(`MCP error ${e}: ${r}`),this.code=e,this.data=o,this.name="McpError"}static fromError(e,r,o){if(e===Y.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new C4(n.elicitations,r)}return new t(e,r,o)}},C4=class extends q{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(Y.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function yu(t){return t==="completed"||t==="failed"||t==="cancelled"}var Fie=Symbol("Let zodToJsonSchema decide on which parser to use");var Lie={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Vie=t=>typeof t=="string"?{...Lie,name:t}:{...Lie,...t};var Hie=t=>{let e=Vie(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([o,n])=>[n._def,{def:n._def,path:[...e.basePath,e.definitionPath,o],jsonSchema:void 0}]))}};function J4(t,e,r,o){o?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Ue(t,e,r,o,n){t[e]=r,J4(t,e,o,n)}var JA=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function Ot(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?JA(e,t.currentPath):e.join("/")}}function Bie(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==z.ZodAny&&(r.items=ie(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Ue(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Ue(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Ue(r,"minItems",t.exactLength.value,t.exactLength.message,e),Ue(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Kie(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let o of t.checks)switch(o.kind){case"min":e.target==="jsonSchema7"?o.inclusive?Ue(r,"minimum",o.value,o.message,e):Ue(r,"exclusiveMinimum",o.value,o.message,e):(o.inclusive||(r.exclusiveMinimum=!0),Ue(r,"minimum",o.value,o.message,e));break;case"max":e.target==="jsonSchema7"?o.inclusive?Ue(r,"maximum",o.value,o.message,e):Ue(r,"exclusiveMaximum",o.value,o.message,e):(o.inclusive||(r.exclusiveMaximum=!0),Ue(r,"maximum",o.value,o.message,e));break;case"multipleOf":Ue(r,"multipleOf",o.value,o.message,e);break}return r}function qie(){return{type:"boolean"}}function GA(t,e){return ie(t.type._def,e)}var Zie=(t,e)=>ie(t.innerType._def,e);function G4(t,e,r){let o=r??e.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((n,i)=>G4(t,e,n))};switch(o){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return lOe(t,e)}}var lOe=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let o of t.checks)switch(o.kind){case"min":Ue(r,"minimum",o.value,o.message,e);break;case"max":Ue(r,"maximum",o.value,o.message,e);break}return r};function Wie(t,e){return{...ie(t.innerType._def,e),default:t.defaultValue()}}function Jie(t,e){return e.effectStrategy==="input"?ie(t.schema._def,e):Ot(e)}function Gie(t){return{type:"string",enum:Array.from(t.values)}}var dOe=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Xie(t,e){let r=[ie(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),ie(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),o=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach(i=>{if(dOe(i))n.push(...i.allOf),i.unevaluatedProperties===void 0&&(o=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else o=void 0;n.push(s)}}),n.length?{allOf:n,...o}:void 0}function Yie(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var X4,Ui={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(X4===void 0&&(X4=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),X4),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function XA(t,e){let r={type:"string"};if(t.checks)for(let o of t.checks)switch(o.kind){case"min":Ue(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":Ue(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Li(r,"email",o.message,e);break;case"format:idn-email":Li(r,"idn-email",o.message,e);break;case"pattern:zod":bn(r,Ui.email,o.message,e);break}break;case"url":Li(r,"uri",o.message,e);break;case"uuid":Li(r,"uuid",o.message,e);break;case"regex":bn(r,o.regex,o.message,e);break;case"cuid":bn(r,Ui.cuid,o.message,e);break;case"cuid2":bn(r,Ui.cuid2,o.message,e);break;case"startsWith":bn(r,RegExp(`^${Y4(o.value,e)}`),o.message,e);break;case"endsWith":bn(r,RegExp(`${Y4(o.value,e)}$`),o.message,e);break;case"datetime":Li(r,"date-time",o.message,e);break;case"date":Li(r,"date",o.message,e);break;case"time":Li(r,"time",o.message,e);break;case"duration":Li(r,"duration",o.message,e);break;case"length":Ue(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),Ue(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{bn(r,RegExp(Y4(o.value,e)),o.message,e);break}case"ip":{o.version!=="v6"&&Li(r,"ipv4",o.message,e),o.version!=="v4"&&Li(r,"ipv6",o.message,e);break}case"base64url":bn(r,Ui.base64url,o.message,e);break;case"jwt":bn(r,Ui.jwt,o.message,e);break;case"cidr":{o.version!=="v6"&&bn(r,Ui.ipv4Cidr,o.message,e),o.version!=="v4"&&bn(r,Ui.ipv6Cidr,o.message,e);break}case"emoji":bn(r,Ui.emoji(),o.message,e);break;case"ulid":{bn(r,Ui.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Li(r,"binary",o.message,e);break}case"contentEncoding:base64":{Ue(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{bn(r,Ui.base64,o.message,e);break}}break}case"nanoid":bn(r,Ui.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Y4(t,e){return e.patternStrategy==="escape"?fOe(t):t}var pOe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function fOe(t){let e="";for(let r=0;r<t.length;r++)pOe.has(t[r])||(e+="\\"),e+=t[r];return e}function Li(t,e,r,o){t.format||t.anyOf?.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&o.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&o.errorMessages&&{errorMessage:{format:r}}})):Ue(t,"format",e,r,o)}function bn(t,e,r,o){t.pattern||t.allOf?.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&o.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:Qie(e,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})):Ue(t,"pattern",Qie(e,o),r,o)}function Qie(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},o=r.i?t.source.toLowerCase():t.source,n="",i=!1,s=!1,a=!1;for(let c=0;c<o.length;c++){if(i){n+=o[c],i=!1;continue}if(r.i){if(s){if(o[c].match(/[a-z]/)){a?(n+=o[c],n+=`${o[c-2]}-${o[c]}`.toUpperCase(),a=!1):o[c+1]==="-"&&o[c+2]?.match(/[a-z]/)?(n+=o[c],a=!0):n+=`${o[c]}${o[c].toUpperCase()}`;continue}}else if(o[c].match(/[a-z]/)){n+=`[${o[c]}${o[c].toUpperCase()}]`;continue}}if(r.m){if(o[c]==="^"){n+=`(^|(?<=[\r
140
+ }`,{flashAuthRequestId:e.id}),o=h.object({id:h.string(),status:h.string(),apiKey:h.string().nullish()}).parse(r.flashAuthRequestStatus);return o.id!==e.id&&C(502,"invalid_response","RunPod returned another authorization request."),o.apiKey&&["APPROVED","CONSUMED"].includes(o.status)?h.string().min(1).max(16384).regex(/^\S+$/).parse(o.apiKey):(["DENIED","EXPIRED","CONSUMED"].includes(o.status)&&C(409,"authorization_failed","Start the RunPod connection again."),o.status!=="PENDING"&&C(502,"invalid_response","RunPod returned an unknown authorization state."),null)}var Zv=h.object({id:E,ownerId:E,registration:h.object({methodId:h.string().min(1),methodDigest:Vr,appId:E.nullable(),app:Rn.nullable(),fields:h.record(h.string(),h.string()),scopes:h.array(h.string())}).strict(),policy:Wn,previousPolicyDigest:h.string().nullable(),step:h.enum(["start","cli","authorize","exchange","commit","connected","cancelled","failed"]),createdAt:h.iso.datetime(),expiresAt:h.number(),operationId:E,url:h.url().nullable(),connectionId:E.nullable(),authorizationState:h.string(),verifier:h.string(),redirectUri:h.url(),ovh:yA.optional(),material:xr.optional(),proof:WN.omit({name:!0,labels:!0}).optional(),approval:vA.optional(),deviceAuthorization:Kv.optional(),error:h.string().optional(),exchangeStartedAt:h.number().optional(),exchangeDevice:h.enum(["browser","cli"])}).strict(),cRe=Zv.pick({id:!0,ownerId:!0,operationId:!0,error:!0}).strip(),wA=()=>Qu(crypto.getRandomValues(new Uint8Array(32))),bA=class{constructor(e,r,o=new iA(e.origin),n="browser"){this.custody=e;this.store=r;this.transport=o;this.device=n}custody;store;transport;device;approvalPolls=new Map;devicePolls=new Map;async flow(e){let r=await this.store.get(E.parse(e));if(!r)throw new Error("The saved progress for this connection is unavailable.");let o=Zv.parse(r);if(o.policy.origin!==this.custody.origin||!o.policy.authorities.some(n=>M(n)===M(this.custody.binding)))throw new Error("Open this connection with its initiating identity.");return o}async start(e,r,o){let n=u0.parse(e.input);if(e.name!=="connection.connect"||n.methodDigest!==await la(r)||!n.name)throw new Error("Use the connection prepared by this operation.");for(let[g,y]of Object.entries(n.fields??{}))if(y&&o[g]!==y)throw new Error("Use the service settings prepared by this operation.");if(!Nt(r).browserAuthorization||r.kind==="token"||r.kind==="aws")throw new Error("Choose a browser authorization method.");let i=es(r.config.scopes,n.scopes),s=n.connectionId?await this.custody.latest(n.connectionId):void 0;if(s&&(s.content.policy.contentType!==kt.tokenSet||s.content.policy.ownerId!==n.ownerId))throw new Error("Choose a connection belonging to this owner.");let a=Nt(r).requiresApp?E.parse(n.appId):null,c=a?Rn.parse(JSON.parse(qt(await this.custody.reveal(a)))):null,u=hA({methodId:n.methodId,method:r,appId:a??void 0,app:c}),l=await mA(this.custody,n.ownerId,s,n.users),d=crypto.randomUUID(),f={id:d,ownerId:n.ownerId,registration:{methodId:n.methodId,methodDigest:n.methodDigest,appId:a,app:u,fields:o,scopes:i},policy:l,previousPolicyDigest:s?await vt(s.content.policy):null,step:this.device==="browser"&&xq(r)==="unavailable"?"cli":"start",createdAt:new Date().toISOString(),expiresAt:Date.now()+this.window(r),operationId:e.id,url:null,connectionId:null,authorizationState:wA(),verifier:wA(),redirectUri:n.redirectUri??this.custody.origin+"/oauth/callback",exchangeDevice:this.device},p=new URL(f.redirectUri);if(f.redirectUri!==this.custody.origin+"/oauth/callback"&&!(this.device==="cli"&&p.protocol==="http:"&&["127.0.0.1","[::1]"].includes(p.hostname)&&!p.username&&!p.password&&!p.hash&&!p.search))throw new Error("Use the Foundation callback or a callback on this computer.");await this.store.put(f);let m={kind:"connection",id:d};return await(e.held?this.custody.api.json("/api/operations/"+e.id+"/continuation",{method:"PUT",body:{continuation:m}},nr):this.custody.api.json("/api/operations",{method:"POST",body:{id:e.id,name:e.name,input:e.input,continuation:m}},nr)),this.progress(d)}window(e){return e.kind==="oauth"&&e.config.grantType===Pn?vq:6e5}operation(e){return this.custody.api.json("/api/operations/"+e.operationId,{},nr)}async perform(e,r){await this.custody.api.json("/api/operations/"+e.operationId+"/perform",{method:"POST",body:{proof:r}},nr)}view(e){return cRe.parse(e)}async method(e){let r=(await this.custody.api.json("/api/connection-methods",{},Qt(ii))).items.find(n=>n.id===e.registration.methodId),o=r&&cc(r);if(!o||await la(o)!==e.registration.methodDigest)throw new Error("The connection method changed. Start the connection again.");return o}async registration(e){let{methodDigest:r,...o}=e.registration;return{...o,method:await this.method(e)}}async state(e){return ZN(e.material,e.registration.methodId,await this.method(e))}async name(e,r){return me.parse((await this.operation(e)).input.name??r.name)}async write(e,r){return WN.parse({...e.proof,name:await this.name(e,r.method),labels:Cg(r)})}authorizing(e){let r=e.deviceAuthorization;return{kind:"authorize",flow:this.view(e),url:e.url,...r?{device:{userCode:r.userCode,verificationUri:r.verificationUri,expiresAt:e.expiresAt}}:{}}}async awaitingAuthorization(e){let r=await this.operation(e);if(r.state!=="in_progress"||r.continuation?.id!==e.id||r.input.methodDigest!==e.registration.methodDigest)throw new Error("Continue the connection that is awaiting authorization.")}async currentApplication(e){if(!e.registration.appId)return;let r=Rn.parse(JSON.parse(qt(await this.custody.reveal(e.registration.appId)))),o=e.registration.app;if(r.methodId!==o.methodId||r.generation!==o.generation||r.clientId!==o.clientId||M(r.fields)!==M(o.fields))throw new Error("Start authorization again with the current application.");e.registration.app=r}async pollDevice(e){let r=Kv.parse(e.deviceAuthorization),o=await this.registration(e),n=o.method;if(n.kind!=="oauth"||n.config.grantType!==Pn)throw new Error("Choose a device authorization connection method.");if(e.expiresAt<=Date.now())return e.step="failed",e.error="device_code_expired",await this.store.put(e),{kind:"failed",flow:this.view(e),error:e.error};if(r.nextPollAt>Date.now())return this.authorizing(e);await this.awaitingAuthorization(e),await this.currentApplication(e),r.nextPollAt=Date.now()+r.intervalSeconds*1e3,e.deviceAuthorization=r,await this.store.put(e);let i;try{i=await new Ks(this.transport).deviceToken(n.config,e.registration.app,r.deviceCode,e.registration.scopes)}catch(s){let a=s&&typeof s=="object"&&"code"in s&&typeof s.code=="string"?s.code:"authorization_failed";return a==="service_unavailable"||a==="service_rate_limit"?(r.intervalSeconds*=2,r.nextPollAt=Date.now()+r.intervalSeconds*1e3,await this.store.put(e),this.authorizing(e)):(e.error=a,e.step=a==="browser_exchange_unavailable"?"cli":"failed",await this.store.put(e),e.step==="cli"?this.cli(e):{kind:"failed",flow:this.view(e),error:a})}return i.kind==="pending"?(r.intervalSeconds=Math.max(r.intervalSeconds+(i.slowDown?5:0),i.intervalSeconds??0),r.nextPollAt=Date.now()+r.intervalSeconds*1e3,await this.store.put(e),this.authorizing(e)):(await this.awaitingAuthorization(e),e.material=Og(Gn.parse({...gA(o),oauth:i.token})),e.step="commit",await this.store.put(e),this.accept(e.id))}async pollApproval(e){if(e.expiresAt<=Date.now())throw new Error("Start the connection again.");await this.awaitingAuthorization(e);let r=await sie(this.transport,vA.parse(e.approval));return r?(await this.awaitingAuthorization(e),e.material=Og(Gn.parse({format:3,methodId:e.registration.methodId,method:await this.method(e),generation:crypto.randomUUID(),appId:null,appGeneration:null,fields:{token:r}})),e.step="commit",await this.store.put(e),this.accept(e.id)):{kind:"authorize",flow:this.view(e),url:e.url}}cli(e){return{kind:"cli",flow:this.view(e),command:(e.step==="authorize"?"foundation connect wait ":"foundation operation continue ")+e.operationId}}async authorize(e){if(e.expiresAt<=Date.now())throw new Error("Start the connection again.");let r=await this.registration(e);if(r.method.kind==="oauth"&&r.method.config.grantType===Pn)try{let n=await new Ks(this.transport).deviceAuthorization(r.method.config,e.registration.app,e.registration.scopes);return e.deviceAuthorization=n,e.expiresAt=Math.min(e.expiresAt,n.expiresAt),e.step="authorize",e.url=n.verificationUriComplete??n.verificationUri,await this.store.put(e),this.authorizing(e)}catch(n){if(!(n&&typeof n=="object"&&"code"in n&&n.code==="browser_exchange_unavailable"))throw n;return e.step="cli",e.error="browser_exchange_unavailable",await this.store.put(e),this.cli(e)}if(r.method.kind==="approval"){let n=await iie(this.transport);return e.approval=n.approval,e.expiresAt=Math.min(e.expiresAt,n.approval.expiresAt),e.step="authorize",e.url=n.url,await this.store.put(e),{kind:"authorize",flow:this.view(e),url:e.url}}e.redirectUri===this.custody.origin+"/oauth/callback"&&await this.custody.api.json("/api/oauth/relays",{method:"POST",body:{id:e.id,operationId:e.operationId,stateDigest:await vt(e.authorizationState),expiresAt:new Date(e.expiresAt).toISOString()}},JN);let o=await rie(r,this.transport,e.authorizationState,e.verifier,e.redirectUri);return e.step="authorize",e.url=o.url,"ovh"in o&&(e.ovh=o.ovh),await this.store.put(e),{kind:"authorize",flow:this.view(e),url:e.url}}async progress(e,r=!0){let o=await this.flow(e);if(o.step==="connected")return o.proof&&await this.perform(o,await this.write(o,await this.state(o))),{kind:"connected",flow:this.view(o),id:o.connectionId};if(o.step==="cancelled")return{kind:"cancelled",flow:this.view(o)};if(o.step==="failed")return{kind:"failed",flow:this.view(o),error:o.error??"authorization_failed"};if(o.step==="commit")return this.accept(e);if(o.step==="exchange"){if(Date.now()-(o.exchangeStartedAt??Date.now())<3e4)return{kind:"pending",flow:this.view(o)};o.step="cli",o.error="browser_exchange_unavailable",await this.store.put(o)}if(o.step==="cli"){if(this.device==="browser")return this.cli(o);let n=await this.operation(o);o.step="start",o.exchangeDevice="cli",o.authorizationState=wA(),o.verifier=wA(),o.expiresAt=Math.min(Date.now()+this.window(await this.method(o)),Date.parse(n.expiresAt??new Date().toISOString())),delete o.error,await this.store.put(o)}if(o.step==="start")return this.authorize(o);if(o.exchangeDevice==="cli"&&this.device==="browser")return this.cli(o);if(o.deviceAuthorization){let n=this.devicePolls.get(e);n||(n=this.pollDevice(o),this.devicePolls.set(e,n));try{return await n}finally{this.devicePolls.get(e)===n&&this.devicePolls.delete(e)}}if(o.approval){let n=this.approvalPolls.get(e);n||(n=this.pollApproval(o),this.approvalPolls.set(e,n));try{return await n}finally{this.approvalPolls.get(e)===n&&this.approvalPolls.delete(e)}}if(r&&o.redirectUri===this.custody.origin+"/oauth/callback"){let n=await this.custody.api.json("/api/oauth/relays/"+e,{},JN);if(n.id!==e||n.operationId!==o.operationId||n.context!==vZ(this.custody.origin,e))throw new Error("The authorization response belongs to another connection.");if(n.sealed)return this.complete(e,qt(await wo(n.sealed,this.custody.keys.encryption,this.custody.binding.id,n.context)))}return this.authorizing(o)}async complete(e,r){let o=await this.flow(e);if(o.step!=="authorize")return this.progress(e,!1);if(o.exchangeDevice==="cli"&&this.device==="browser")return this.cli(o);if(o.deviceAuthorization)throw new Error("Device authorization completes after the code is approved at the service.");if(o.expiresAt<=Date.now())throw new Error("Start the connection again.");await this.awaitingAuthorization(o);let n=new URLSearchParams(r);if(n.getAll("state").length!==1||n.get("state")!==o.authorizationState)throw new Error("The authorization response does not match this connection.");if(n.has("error"))return this.cancel(e);await this.currentApplication(o),o.step="exchange",o.exchangeStartedAt=Date.now(),await this.store.put(o);try{o.material=Og(await nie(await this.registration(o),this.transport,r,o.authorizationState,o.verifier,o.redirectUri,o.ovh))}catch(i){if(o.error=i&&typeof i=="object"&&"code"in i&&typeof i.code=="string"?i.code:"authorization_failed",o.step=o.error==="browser_exchange_unavailable"?"cli":"failed",await this.store.put(o),o.step==="cli"&&this.device==="browser")return this.cli(o);throw i}return o.step="commit",await this.store.put(o),this.accept(e)}async accept(e){let r=await this.flow(e);if(r.step!=="commit"||!r.material)throw new Error("Complete authorization before saving this connection.");let o=r.previousPolicyDigest?await this.custody.latest(r.policy.id):void 0;if(o&&await vt(o.content.policy)!==r.previousPolicyDigest)throw new Error("The connection recipients changed. Start again to approve the current recipients.");let n=await this.state(r),i=async s=>{let{name:a,labels:c,...u}=s;return r.proof=u,await this.store.put(r),await this.perform(r,s),this.custody.api.json("/api/resources/"+r.policy.id,{},mt)};return r.proof?await i(await this.write(r,n)):await this.custody.save(await this.name(r,n.method),kp(n),r.policy,{previous:o,metadata:await Ep(n),labels:Cg(n),commit:i}),r.step="connected",r.connectionId=r.policy.id,await this.store.put(r),{kind:"connected",flow:this.view(r),id:r.connectionId}}async cancel(e){let r=await this.flow(e);return await this.custody.api.json("/api/operations/"+r.operationId+"/cancel",{method:"POST",body:{}},nr),r.step="cancelled",await this.store.put(r),{kind:"cancelled",flow:this.view(r)}}};var aie=h.object({id:E,actorId:E,bindingId:E,origin:h.url(),revision:h.number().int().positive(),sealed:Fr,signature:tr}).strict(),cie=(t,e)=>"operation-continuation:"+t+":"+e,Wv=class{constructor(e){this.custody=e}custody;revisions=new Map;async get(e,r){let o=await this.custody.api.json("/api/operation-continuations/"+E.parse(e),{},aie.nullable());if(!o)return this.revisions.set(e,0),null;let{signature:n,...i}=o;if(i.id!==e||i.origin!==this.custody.origin||i.actorId!==this.custody.binding.principalId||i.bindingId!==this.custody.binding.id)throw new Error("Use the identity that started this operation.");await Yi(i,n,this.custody.binding.signing,"operation-continuation");let s=r.parse(JSON.parse(qt(await wo(i.sealed,this.custody.keys.encryption,this.custody.binding.id,cie(this.custody.origin,e)))));return this.revisions.set(e,i.revision),s}async put(e,r){this.revisions.has(e)||await this.get(e,h.unknown());let o={id:e,origin:this.custody.origin,actorId:this.custody.binding.principalId,bindingId:this.custody.binding.id,revision:this.revisions.get(e)+1,sealed:await el(Et(M(r)),[{id:this.custody.binding.id,publicKey:this.custody.binding.encryption}],cie(this.custody.origin,e))},n=await rr(o,this.custody.keys.signing,"operation-continuation");await this.custody.api.json("/api/operation-continuations/"+e,{method:"PUT",body:{...o,signature:n}},aie),this.revisions.set(e,o.revision)}},_A=class{records;constructor(e){this.records=new Wv(e)}async get(e){let r=await this.records.get(e,Zv);if(r&&r.id!==e)throw new Error("The saved progress belongs to another operation.");return r}put(e){return this.records.put(e.id,Zv.parse(e))}};var x4=class{constructor(e){this.client=e}client;connectionNames=new Map;async method(e){let r=(await this.client.custody.api.json("/api/connection-methods",{},Qt(ii))).items.find(o=>o.id===e);if(!r)throw new Error("Choose an available connection method.");return this.connectionNames.set(e,r.defaultName),cc(r)}async prepareFields(e,r){let{name:o,input:n}=e,i=await this.method(String(n.methodId)),s=i.kind==="aws"?[]:i.config.fields,a=Eo(s,r.fields??{});if(o==="connection.connect"&&n.appId){let l=await this.client.custody.api.json("/api/resources/"+E.parse(n.appId),{},mt);if(l.kind!=="app")throw new Error("Choose a connection application.");a={...l.data.fields,...a}}let c=n.fields,u=Pg(s,c??{},a);return Object.entries(a).some(([l,d])=>c?.[l]!==d)?this.client.proceed(await this.client.configure(e,{fields:u}),r):null}async authorize(e){let r=e.id,{input:o}=e,n=gq.parse(o),i=await this.client.custody.read(n.connectionId);if(i.version!==n.version||i.content.policy.ownerId!==n.ownerId||i.content.policy.contentType!==kt.tokenSet)throw new Error("Review the current connection before changing its permissions.");let s=await S4(this.client.custody,{...i.content.policy,revision:i.content.policy.revision+1},n.users),a=await this.client.custody.api.json("/api/resources/"+n.connectionId,{},mt);return{kind:"saved",resource:await this.client.custody.save(a.name,await this.client.custody.reveal(n.connectionId),s,{previous:i,metadata:i.content.metadata,commit:async u=>mt.parse((await this.client.commit(e,u)).result)}),operationId:r}}async saveApplication(e,r){let o=await this.prepareFields(e,r);if(o)return o;let n=e.id,{input:i}=e,s=kN.parse(i),a=s.resourceId?await this.client.custody.latest(s.resourceId):void 0;if(a&&a.version!==s.version)throw new Error("This item changed. Reload it before saving.");let c=kt.clientCredential;if(a&&(a.content.policy.contentType!==c||a.content.policy.ownerId!==s.ownerId))throw new Error("Choose the item prepared by this operation.");let u=a&&!a.replaced?await this.client.custody.refreshRecipients(a.content.policy):await this.client.custody.policy(s.ownerId,c,a?{replacing:a.content.policy}:{}),l,d,f=kN.parse(i),p=a&&!a.replaced?Rn.parse(JSON.parse(qt(await this.client.custody.reveal(a.content.policy.id)))):null,m=await this.method(f.methodId),g=Pg(m.kind==="aws"?[]:m.config.fields,f.fields??{},r.fields??{}),y=p&&p.methodId===f.methodId&&p.clientId===f.clientId&&M(p.fields)===M(g),w=Rn.parse({format:1,methodId:f.methodId,clientId:f.clientId,fields:g,generation:y?p.generation:crypto.randomUUID(),...r.clientSecret||p?.clientSecret?{clientSecret:r.clientSecret||p?.clientSecret}:{}});return l=Et(M(w)),d={methodId:w.methodId,clientId:w.clientId,generation:w.generation,fields:Eo(m.kind==="aws"?[]:m.config.fields,g)},{kind:"saved",resource:await this.client.custody.save(s.name,l,u,{previous:a,metadata:d,commit:async _=>mt.parse((await this.client.commit(e,_)).result)}),operationId:n}}async connect(e,r){if(e.continuation?.kind==="connection")return this.client.connections.progress(e.continuation.id);let o=await this.prepareFields(e,r);if(o)return o;let n=e.id,{input:i}=e,s=u0.parse(i),a=await this.method(s.methodId);if(!s.name)return this.client.proceed(await this.client.configure(e,{name:this.connectionNames.get(s.methodId)??a.name}),r);if(r.scopes&&!s.scopes&&(a.kind==="oauth"||a.kind==="ovh"))return this.client.proceed(await this.client.configure(e,{scopes:r.scopes}),r);if(r.scopes&&s.scopes&&(a.kind==="oauth"||a.kind==="ovh")&&M(es(a.config.scopes,r.scopes).sort())!==M(es(a.config.scopes,s.scopes).sort()))throw new Error("Use the service permissions prepared by this operation.");if(uc(a)&&!s.appId){if(!s.clientId)throw new Error("Enter the application client ID.");let u=await this.saveApplication(await this.client.review({name:"app.save",input:{ownerId:s.ownerId,name:(s.name??a.name).slice(0,185)+" application",methodId:s.methodId,clientId:s.clientId,...s.fields?{fields:s.fields}:{}}}),{...r.clientSecret?{clientSecret:r.clientSecret}:{},...r.fields?{fields:r.fields}:{}});if(!("kind"in u)||u.kind!=="saved")throw new Error("Save the application for this connection.");return this.client.proceed(await this.client.configure(e,{appId:u.resource.id}),r)}let c=s.appId;if(!Nt(a).browserAuthorization){if(await la(a)!==s.methodDigest)throw new Error("Review the current connection method.");let u=s.connectionId?await this.client.custody.latest(s.connectionId):void 0;if(u&&(u.content.policy.ownerId!==s.ownerId||u.content.policy.contentType!==kt.tokenSet))throw new Error("Choose a connection belonging to this owner.");let l=u&&!u.replaced?await this.client.custody.connection(s.connectionId):void 0,d=hA({methodId:s.methodId,method:a,appId:c,app:c?Rn.parse(JSON.parse(qt(await this.client.custody.reveal(c)))):null}),f=gA({methodId:s.methodId,method:a,appId:c??null,app:d,fields:Pg(Nt(a).fields,s.fields??{},r.fields??{}),scopes:a.kind==="oauth"?es(a.config.scopes,s.scopes):[],aws:r.aws},l),p=await mA(this.client.custody,s.ownerId,u,s.users);return{kind:"saved",resource:await this.client.custody.save(s.name??a.name,kp(f),p,{previous:u,metadata:await Ep(f),labels:Cg(f),commit:async g=>{let y=await this.client.commit(e,g);return this.client.custody.api.json("/api/resources/"+E.parse(y.result?.id),{},mt)}}),operationId:n}}return this.client.connections.start(e,a,Pg(a.kind==="aws"?[]:a.config.fields,s.fields??{},r.fields??{}))}};function uie(t){let e=new x4(t);return new Map([["connection.authorize",{continue:r=>e.authorize(r)}],["app.save",{continue:(r,o)=>e.saveApplication(r,o)}],["connection.connect",{continue:(r,o)=>e.connect(r,o)}]])}function lie(t){return{continue:async(e,r)=>{let o=e.id,{input:n}=e,i=hq.parse(n),s=i.resourceId?await t.custody.latest(i.resourceId):void 0;if(s&&s.version!==i.version)throw new Error("This item changed. Reload it before saving.");let a=kt.value;if(s&&(s.content.policy.contentType!==a||s.content.policy.ownerId!==i.ownerId))throw new Error("Choose the item prepared by this operation.");let c=s&&!s.replaced?await t.custody.refreshRecipients(s.content.policy):await t.custody.policy(i.ownerId,a,s?{replacing:s.content.policy}:{});if(r.value===void 0)throw new Error("Enter the value to save.");let u=typeof r.value=="string"?Et(r.value):r.value;return{kind:"saved",resource:await t.custody.save(i.name,u,c,{previous:s,commit:async d=>mt.parse((await t.commit(e,d)).result)}),operationId:o}}}}function die(t){let e=uie(t);return e.set("variable.save",lie(t)),e}var fie=h.object({value:h.string().optional(),clientSecret:h.string().optional(),fields:h.record(h.string(),h.string()).optional(),scopes:h.array(h.string()).optional(),aws:aa.optional()}).strict(),pie=h.union([nr,Br]),SA=class{constructor(e,r){this.custody=e;this.connections=r;this.records=new Wv(e),this.operations=die(this)}custody;connections;records;operations;get(e){return this.custody.api.json("/api/operations/"+E.parse(e),{},nr)}async review(e,r=crypto.randomUUID()){let o=await this.custody.api.json("/api/operations/review",{method:"POST",body:vo.parse(e)},vo);return{id:r,...o,held:!1,continuation:null}}held(e){return{id:e.id,name:e.name,input:e.input,held:!0,continuation:e.continuation}}async perform(e,r={}){return this.operations.has(e.name)?this.proceed(await this.review(e),r):this.custody.api.json("/api/operations",{method:"POST",body:vo.parse(e)},pie)}async continue(e,r={}){let o=await this.get(e);return o.canPerform?o.keyholder?this.proceed(this.held(o),r):this.custody.api.json("/api/operations/"+o.id+"/perform",{method:"POST",body:{}},pie):o}proceed(e,r){let o=this.operations.get(e.name);if(!o)throw new Error("Choose an operation this device can make.");return o.continue(e,r)}async configure(e,r){return e.held?this.held(await this.custody.api.json("/api/operations/"+e.id,{method:"PATCH",body:{values:r}},nr)):this.review({name:e.name,input:{...e.input,...r}},e.id)}async commit(e,r){return e.held?this.custody.api.json("/api/operations/"+e.id+"/perform",{method:"POST",body:{proof:r}},nr):this.custody.api.json("/api/operations",{method:"POST",body:{id:e.id,name:e.name,input:e.input,proof:r}},nr)}};function lu(t,e=uu(t).custody){let r=new bA(e,new _A(e),new em(e.origin),"cli");return new SA(e,r)}var ze;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let i={};for(let s of n)i[s]=s;return i},t.getValidEnumValues=n=>{let i=t.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),s={};for(let a of i)s[a]=n[a];return t.objectValues(s)},t.objectValues=n=>t.objectKeys(n).map(function(i){return n[i]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&i.push(s);return i},t.find=(n,i)=>{for(let s of n)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function o(n,i=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=o,t.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(ze||(ze={}));var mie;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(mie||(mie={}));var B=ze.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ca=t=>{switch(typeof t){case"undefined":return B.undefined;case"string":return B.string;case"number":return Number.isNaN(t)?B.nan:B.number;case"boolean":return B.boolean;case"function":return B.function;case"bigint":return B.bigint;case"symbol":return B.symbol;case"object":return Array.isArray(t)?B.array:t===null?B.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?B.promise:typeof Map<"u"&&t instanceof Map?B.map:typeof Set<"u"&&t instanceof Set?B.set:typeof Date<"u"&&t instanceof Date?B.date:B.object;default:return B.unknown}};var O=ze.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var uo=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},o={_errors:[]},n=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)o._errors.push(r(s));else{let a=o,c=0;for(;c<s.path.length;){let u=s.path[c],l=c===s.path.length-1;if(u==="_errors"){l&&a._errors.push(r(s)),c++;continue}Object.prototype.hasOwnProperty.call(a,u)||(u==="__proto__"?Object.defineProperty(a,u,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):a[u]={_errors:[]}),a=a[u],l&&a._errors.push(r(s)),c++}}};return n(this),o}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ze.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),o=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];r[i]=r[i]||[],r[i].push(e(n))}else o.push(e(n));return{formErrors:o,fieldErrors:r}}get formErrors(){return this.flatten()}};uo.create=t=>new uo(t);var uRe=(t,e)=>{let r;switch(t.code){case O.invalid_type:t.received===B.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case O.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ze.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:r=`Unrecognized key(s) in object: ${ze.joinValues(t.keys,", ")}`;break;case O.invalid_union:r="Invalid input";break;case O.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ze.joinValues(t.options)}`;break;case O.invalid_enum_value:r=`Invalid enum value. Expected ${ze.joinValues(t.options)}, received '${t.received}'`;break;case O.invalid_arguments:r="Invalid function arguments";break;case O.invalid_return_type:r="Invalid function return type";break;case O.invalid_date:r="Invalid date";break;case O.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ze.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case O.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case O.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case O.custom:r="Invalid input";break;case O.invalid_intersection_types:r="Intersection results could not be merged";break;case O.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case O.not_finite:r="Number must be finite";break;default:r=e.defaultError,ze.assertNever(t)}return{message:r}},du=uRe;var lRe=du;function Jv(){return lRe}var xA=t=>{let{data:e,path:r,errorMaps:o,issueData:n}=t,i=[...r,...n.path||[]],s={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let a="",c=o.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...n,path:i,message:a}};function F(t,e){let r=Jv(),o=xA({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===du?void 0:du].filter(n=>!!n)});t.common.issues.push(o)}var tn=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let o=[];for(let n of r){if(n.status==="aborted")return oe;n.status==="dirty"&&e.dirty(),o.push(n.value)}return{status:e.value,value:o}}static async mergeObjectAsync(e,r){let o=[];for(let n of r){let i=await n.key,s=await n.value;o.push({key:i,value:s})}return t.mergeObjectSync(e,o)}static mergeObjectSync(e,r){let o={};for(let n of r){let{key:i,value:s}=n;if(i.status==="aborted"||s.status==="aborted")return oe;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(o[i.value]=s.value)}return{status:e.value,value:o}}},oe=Object.freeze({status:"aborted"}),tm=t=>({status:"dirty",value:t}),wn=t=>({status:"valid",value:t}),E4=t=>t.status==="aborted",k4=t=>t.status==="dirty",Fl=t=>t.status==="valid",Gv=t=>typeof Promise<"u"&&t instanceof Promise;var W;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(W||(W={}));var Ko=class{constructor(e,r,o,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=o,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},hie=(t,e)=>{if(Fl(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new uo(t.common.issues);return this._error=r,this._error}}};function we(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:o,description:n}=t;if(e&&(r||o))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??o??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:n}}var Te=class{get description(){return this._def.description}_getType(e){return Ca(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ca(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tn,ctx:{common:e.parent.common,data:e.data,parsedType:Ca(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Gv(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let o=this.safeParse(e,r);if(o.success)return o.data;throw o.error}safeParse(e,r){let o={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ca(e)},n=this._parseSync({data:e,path:o.path,parent:o});return hie(o,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ca(e)};if(!this["~standard"].async)try{let o=this._parseSync({data:e,path:[],parent:r});return Fl(o)?{value:o.value}:{issues:r.common.issues}}catch(o){o?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(o=>Fl(o)?{value:o.value}:{issues:r.common.issues})}async parseAsync(e,r){let o=await this.safeParseAsync(e,r);if(o.success)return o.data;throw o.error}async safeParseAsync(e,r){let o={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ca(e)},n=this._parse({data:e,path:o.path,parent:o}),i=await(Gv(n)?n:Promise.resolve(n));return hie(o,i)}refine(e,r){let o=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,i)=>{let s=e(n),a=()=>i.addIssue({code:O.custom,...o(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((o,n)=>e(o)?!0:(n.addIssue(typeof r=="function"?r(o,n):r),!1))}_refinement(e){return new Mi({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ji.create(this,this._def)}nullable(){return Da.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fu.create(this)}promise(){return Vl.create(this,this._def)}or(e){return sm.create([this,e],this._def)}and(e){return am.create(this,e,this._def)}transform(e){return new Mi({...we(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new pm({...we(this._def),innerType:this,defaultValue:r,typeName:z.ZodDefault})}brand(){return new EA({typeName:z.ZodBranded,type:this,...we(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new fm({...we(this._def),innerType:this,catchValue:r,typeName:z.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return kA.create(this,e)}readonly(){return mm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},dRe=/^c[^\s-]{8,}$/i,pRe=/^[0-9a-z]+$/,fRe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mRe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,hRe=/^[a-z0-9_-]{21}$/i,gRe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yRe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,vRe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wRe="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",I4,bRe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_Re=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,SRe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,xRe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ERe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kRe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gie="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",IRe=new RegExp(`^${gie}$`);function yie(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function $Re(t){return new RegExp(`^${yie(t)}$`)}function ARe(t){let e=`${gie}T${yie(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function TRe(t,e){return!!((e==="v4"||!e)&&bRe.test(t)||(e==="v6"||!e)&&SRe.test(t))}function PRe(t,e){if(!gRe.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let o=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(o));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function RRe(t,e){return!!((e==="v4"||!e)&&_Re.test(t)||(e==="v6"||!e)&&xRe.test(t))}var nm=class t extends Te{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==B.string){let i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_type,expected:B.string,received:i.parsedType}),oe}let o=new tn,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),F(n,{code:O.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),o.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),F(n,{code:O.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),o.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(n=this._getOrReturnCtx(e,n),s?F(n,{code:O.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&F(n,{code:O.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),o.dirty())}else if(i.kind==="email")vRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"email",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="emoji")I4||(I4=new RegExp(wRe,"u")),I4.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"emoji",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="uuid")mRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"uuid",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="nanoid")hRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"nanoid",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="cuid")dRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"cuid",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="cuid2")pRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"cuid2",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="ulid")fRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"ulid",code:O.invalid_string,message:i.message}),o.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),F(n,{validation:"url",code:O.invalid_string,message:i.message}),o.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"regex",code:O.invalid_string,message:i.message}),o.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),F(n,{code:O.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),o.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),F(n,{code:O.invalid_string,validation:{startsWith:i.value},message:i.message}),o.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),F(n,{code:O.invalid_string,validation:{endsWith:i.value},message:i.message}),o.dirty()):i.kind==="datetime"?ARe(i).test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:O.invalid_string,validation:"datetime",message:i.message}),o.dirty()):i.kind==="date"?IRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:O.invalid_string,validation:"date",message:i.message}),o.dirty()):i.kind==="time"?$Re(i).test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:O.invalid_string,validation:"time",message:i.message}),o.dirty()):i.kind==="duration"?yRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"duration",code:O.invalid_string,message:i.message}),o.dirty()):i.kind==="ip"?TRe(e.data,i.version)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"ip",code:O.invalid_string,message:i.message}),o.dirty()):i.kind==="jwt"?PRe(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"jwt",code:O.invalid_string,message:i.message}),o.dirty()):i.kind==="cidr"?RRe(e.data,i.version)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"cidr",code:O.invalid_string,message:i.message}),o.dirty()):i.kind==="base64"?ERe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"base64",code:O.invalid_string,message:i.message}),o.dirty()):i.kind==="base64url"?kRe.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"base64url",code:O.invalid_string,message:i.message}),o.dirty()):ze.assertNever(i);return{status:o.value,value:e.data}}_regex(e,r,o){return this.refinement(n=>e.test(n),{validation:r,code:O.invalid_string,...W.errToObj(o)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...W.errToObj(e)})}url(e){return this._addCheck({kind:"url",...W.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...W.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...W.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...W.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...W.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...W.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...W.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...W.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...W.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...W.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...W.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...W.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...W.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...W.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...W.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...W.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...W.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...W.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...W.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...W.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...W.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...W.errToObj(r)})}nonempty(e){return this.min(1,W.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};nm.create=t=>new nm({checks:[],typeName:z.ZodString,coerce:t?.coerce??!1,...we(t)});function CRe(t,e){let r=(t.toString().split(".")[1]||"").length,o=(e.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return i%s/10**n}var Xv=class t extends Te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==B.number){let i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_type,expected:B.number,received:i.parsedType}),oe}let o,n=new tn;for(let i of this._def.checks)i.kind==="int"?ze.isInteger(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{code:O.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(o=this._getOrReturnCtx(e,o),F(o,{code:O.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(o=this._getOrReturnCtx(e,o),F(o,{code:O.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?CRe(e.data,i.value)!==0&&(o=this._getOrReturnCtx(e,o),F(o,{code:O.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{code:O.not_finite,message:i.message}),n.dirty()):ze.assertNever(i);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,W.toString(r))}gt(e,r){return this.setLimit("min",e,!1,W.toString(r))}lte(e,r){return this.setLimit("max",e,!0,W.toString(r))}lt(e,r){return this.setLimit("max",e,!1,W.toString(r))}setLimit(e,r,o,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:o,message:W.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:W.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:W.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:W.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:W.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:W.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ze.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(r===null||o.value>r)&&(r=o.value):o.kind==="max"&&(e===null||o.value<e)&&(e=o.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Xv.create=t=>new Xv({checks:[],typeName:z.ZodNumber,coerce:t?.coerce||!1,...we(t)});var Yv=class t extends Te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==B.bigint)return this._getInvalidInput(e);let o,n=new tn;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(o=this._getOrReturnCtx(e,o),F(o,{code:O.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(o=this._getOrReturnCtx(e,o),F(o,{code:O.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(o=this._getOrReturnCtx(e,o),F(o,{code:O.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):ze.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return F(r,{code:O.invalid_type,expected:B.bigint,received:r.parsedType}),oe}gte(e,r){return this.setLimit("min",e,!0,W.toString(r))}gt(e,r){return this.setLimit("min",e,!1,W.toString(r))}lte(e,r){return this.setLimit("max",e,!0,W.toString(r))}lt(e,r){return this.setLimit("max",e,!1,W.toString(r))}setLimit(e,r,o,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:o,message:W.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:W.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Yv.create=t=>new Yv({checks:[],typeName:z.ZodBigInt,coerce:t?.coerce??!1,...we(t)});var Qv=class extends Te{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==B.boolean){let o=this._getOrReturnCtx(e);return F(o,{code:O.invalid_type,expected:B.boolean,received:o.parsedType}),oe}return wn(e.data)}};Qv.create=t=>new Qv({typeName:z.ZodBoolean,coerce:t?.coerce||!1,...we(t)});var ew=class t extends Te{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==B.date){let i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_type,expected:B.date,received:i.parsedType}),oe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_date}),oe}let o=new tn,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),F(n,{code:O.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),o.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),F(n,{code:O.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),o.dirty()):ze.assertNever(i);return{status:o.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:W.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:W.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};ew.create=t=>new ew({checks:[],coerce:t?.coerce||!1,typeName:z.ZodDate,...we(t)});var tw=class extends Te{_parse(e){if(this._getType(e)!==B.symbol){let o=this._getOrReturnCtx(e);return F(o,{code:O.invalid_type,expected:B.symbol,received:o.parsedType}),oe}return wn(e.data)}};tw.create=t=>new tw({typeName:z.ZodSymbol,...we(t)});var om=class extends Te{_parse(e){if(this._getType(e)!==B.undefined){let o=this._getOrReturnCtx(e);return F(o,{code:O.invalid_type,expected:B.undefined,received:o.parsedType}),oe}return wn(e.data)}};om.create=t=>new om({typeName:z.ZodUndefined,...we(t)});var im=class extends Te{_parse(e){if(this._getType(e)!==B.null){let o=this._getOrReturnCtx(e);return F(o,{code:O.invalid_type,expected:B.null,received:o.parsedType}),oe}return wn(e.data)}};im.create=t=>new im({typeName:z.ZodNull,...we(t)});var rw=class extends Te{constructor(){super(...arguments),this._any=!0}_parse(e){return wn(e.data)}};rw.create=t=>new rw({typeName:z.ZodAny,...we(t)});var pu=class extends Te{constructor(){super(...arguments),this._unknown=!0}_parse(e){return wn(e.data)}};pu.create=t=>new pu({typeName:z.ZodUnknown,...we(t)});var qs=class extends Te{_parse(e){let r=this._getOrReturnCtx(e);return F(r,{code:O.invalid_type,expected:B.never,received:r.parsedType}),oe}};qs.create=t=>new qs({typeName:z.ZodNever,...we(t)});var nw=class extends Te{_parse(e){if(this._getType(e)!==B.undefined){let o=this._getOrReturnCtx(e);return F(o,{code:O.invalid_type,expected:B.void,received:o.parsedType}),oe}return wn(e.data)}};nw.create=t=>new nw({typeName:z.ZodVoid,...we(t)});var fu=class t extends Te{_parse(e){let{ctx:r,status:o}=this._processInputParams(e),n=this._def;if(r.parsedType!==B.array)return F(r,{code:O.invalid_type,expected:B.array,received:r.parsedType}),oe;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,a=r.data.length<n.exactLength.value;(s||a)&&(F(r,{code:s?O.too_big:O.too_small,minimum:a?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),o.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(F(r,{code:O.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),o.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(F(r,{code:O.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),o.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>n.type._parseAsync(new Ko(r,s,r.path,a)))).then(s=>tn.mergeArray(o,s));let i=[...r.data].map((s,a)=>n.type._parseSync(new Ko(r,s,r.path,a)));return tn.mergeArray(o,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:W.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:W.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:W.toString(r)}})}nonempty(e){return this.min(1,e)}};fu.create=(t,e)=>new fu({type:t,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...we(e)});function rm(t){if(t instanceof lo){let e={};for(let r in t.shape){let o=t.shape[r];e[r]=ji.create(rm(o))}return new lo({...t._def,shape:()=>e})}else return t instanceof fu?new fu({...t._def,type:rm(t.element)}):t instanceof ji?ji.create(rm(t.unwrap())):t instanceof Da?Da.create(rm(t.unwrap())):t instanceof Na?Na.create(t.items.map(e=>rm(e))):t}var lo=class t extends Te{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ze.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==B.object){let u=this._getOrReturnCtx(e);return F(u,{code:O.invalid_type,expected:B.object,received:u.parsedType}),oe}let{status:o,ctx:n}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof qs&&this._def.unknownKeys==="strip"))for(let u in n.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=i[u],d=n.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Ko(n,d,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof qs){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:n.data[l]}});else if(u==="strict")a.length>0&&(F(n,{code:O.unrecognized_keys,keys:a}),o.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=n.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Ko(n,d,n.path,l)),alwaysSet:l in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>tn.mergeObjectSync(o,u)):tn.mergeObjectSync(o,c)}get shape(){return this._def.shape()}strict(e){return W.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,o)=>{let n=this._def.errorMap?.(r,o).message??o.defaultError;return r.code==="unrecognized_keys"?{message:W.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:z.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let o of ze.objectKeys(e))e[o]&&this.shape[o]&&(r[o]=this.shape[o]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let o of ze.objectKeys(this.shape))e[o]||(r[o]=this.shape[o]);return new t({...this._def,shape:()=>r})}deepPartial(){return rm(this)}partial(e){let r={};for(let o of ze.objectKeys(this.shape)){let n=this.shape[o];e&&!e[o]?r[o]=n:r[o]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let o of ze.objectKeys(this.shape))if(e&&!e[o])r[o]=this.shape[o];else{let i=this.shape[o];for(;i instanceof ji;)i=i._def.innerType;r[o]=i}return new t({...this._def,shape:()=>r})}keyof(){return vie(ze.objectKeys(this.shape))}};lo.create=(t,e)=>new lo({shape:()=>t,unknownKeys:"strip",catchall:qs.create(),typeName:z.ZodObject,...we(e)});lo.strictCreate=(t,e)=>new lo({shape:()=>t,unknownKeys:"strict",catchall:qs.create(),typeName:z.ZodObject,...we(e)});lo.lazycreate=(t,e)=>new lo({shape:t,unknownKeys:"strip",catchall:qs.create(),typeName:z.ZodObject,...we(e)});var sm=class extends Te{_parse(e){let{ctx:r}=this._processInputParams(e),o=this._def.options;function n(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new uo(a.ctx.common.issues));return F(r,{code:O.invalid_union,unionErrors:s}),oe}if(r.common.async)return Promise.all(o.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(n);{let i,s=[];for(let c of o){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new uo(c));return F(r,{code:O.invalid_union,unionErrors:a}),oe}}get options(){return this._def.options}};sm.create=(t,e)=>new sm({options:t,typeName:z.ZodUnion,...we(e)});var Oa=t=>t instanceof cm?Oa(t.schema):t instanceof Mi?Oa(t.innerType()):t instanceof um?[t.value]:t instanceof lm?t.options:t instanceof dm?ze.objectValues(t.enum):t instanceof pm?Oa(t._def.innerType):t instanceof om?[void 0]:t instanceof im?[null]:t instanceof ji?[void 0,...Oa(t.unwrap())]:t instanceof Da?[null,...Oa(t.unwrap())]:t instanceof EA||t instanceof mm?Oa(t.unwrap()):t instanceof fm?Oa(t._def.innerType):[],$4=class t extends Te{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.object)return F(r,{code:O.invalid_type,expected:B.object,received:r.parsedType}),oe;let o=this.discriminator,n=r.data[o],i=this.optionsMap.get(n);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(F(r,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,o){let n=new Map;for(let i of r){let s=Oa(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,i)}}return new t({typeName:z.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...we(o)})}};function A4(t,e){let r=Ca(t),o=Ca(e);if(t===e)return{valid:!0,data:t};if(r===B.object&&o===B.object){let n=ze.objectKeys(e),i=ze.objectKeys(t).filter(a=>n.indexOf(a)!==-1),s={...t,...e};Object.prototype.hasOwnProperty.call(s,"__proto__")&&delete s.__proto__;for(let a of i){if(a==="__proto__")continue;let c=A4(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===B.array&&o===B.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let s=t[i],a=e[i],c=A4(s,a);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===B.date&&o===B.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var am=class extends Te{_parse(e){let{status:r,ctx:o}=this._processInputParams(e),n=(i,s)=>{if(E4(i)||E4(s))return oe;let a=A4(i.value,s.value);return a.valid?((k4(i)||k4(s))&&r.dirty(),{status:r.value,value:a.data}):(F(o,{code:O.invalid_intersection_types}),oe)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([i,s])=>n(i,s)):n(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}};am.create=(t,e,r)=>new am({left:t,right:e,typeName:z.ZodIntersection,...we(r)});var Na=class t extends Te{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==B.array)return F(o,{code:O.invalid_type,expected:B.array,received:o.parsedType}),oe;if(o.data.length<this._def.items.length)return F(o,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&o.data.length>this._def.items.length&&(F(o,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...o.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Ko(o,s,o.path,a)):null}).filter(s=>!!s);return o.common.async?Promise.all(i).then(s=>tn.mergeArray(r,s)):tn.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Na.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Na({items:t,typeName:z.ZodTuple,rest:null,...we(e)})};var T4=class t extends Te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==B.object)return F(o,{code:O.invalid_type,expected:B.object,received:o.parsedType}),oe;let n=[],i=this._def.keyType,s=this._def.valueType;for(let a in o.data)n.push({key:i._parse(new Ko(o,a,o.path,a)),value:s._parse(new Ko(o,o.data[a],o.path,a)),alwaysSet:a in o.data});return o.common.async?tn.mergeObjectAsync(r,n):tn.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,o){return r instanceof Te?new t({keyType:e,valueType:r,typeName:z.ZodRecord,...we(o)}):new t({keyType:nm.create(),valueType:e,typeName:z.ZodRecord,...we(r)})}},ow=class extends Te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==B.map)return F(o,{code:O.invalid_type,expected:B.map,received:o.parsedType}),oe;let n=this._def.keyType,i=this._def.valueType,s=[...o.data.entries()].map(([a,c],u)=>({key:n._parse(new Ko(o,a,o.path,[u,"key"])),value:i._parse(new Ko(o,c,o.path,[u,"value"]))}));if(o.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return oe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return oe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};ow.create=(t,e,r)=>new ow({valueType:e,keyType:t,typeName:z.ZodMap,...we(r)});var iw=class t extends Te{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==B.set)return F(o,{code:O.invalid_type,expected:B.set,received:o.parsedType}),oe;let n=this._def;n.minSize!==null&&o.data.size<n.minSize.value&&(F(o,{code:O.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&o.data.size>n.maxSize.value&&(F(o,{code:O.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return oe;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...o.data.values()].map((c,u)=>i._parse(new Ko(o,c,o.path,u)));return o.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:W.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:W.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};iw.create=(t,e)=>new iw({valueType:t,minSize:null,maxSize:null,typeName:z.ZodSet,...we(e)});var P4=class t extends Te{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.function)return F(r,{code:O.invalid_type,expected:B.function,received:r.parsedType}),oe;function o(a,c){return xA({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Jv(),du].filter(u=>!!u),issueData:{code:O.invalid_arguments,argumentsError:c}})}function n(a,c){return xA({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Jv(),du].filter(u=>!!u),issueData:{code:O.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Vl){let a=this;return wn(async function(...c){let u=new uo([]),l=await a._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(o(c,p)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(n(d,p)),u})})}else{let a=this;return wn(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new uo([o(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new uo([n(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Na.create(e).rest(pu.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,o){return new t({args:e||Na.create([]).rest(pu.create()),returns:r||pu.create(),typeName:z.ZodFunction,...we(o)})}},cm=class extends Te{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};cm.create=(t,e)=>new cm({getter:t,typeName:z.ZodLazy,...we(e)});var um=class extends Te{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return F(r,{received:r.data,code:O.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:e.data}}get value(){return this._def.value}};um.create=(t,e)=>new um({value:t,typeName:z.ZodLiteral,...we(e)});function vie(t,e){return new lm({values:t,typeName:z.ZodEnum,...we(e)})}var lm=class t extends Te{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),o=this._def.values;return F(r,{expected:ze.joinValues(o),received:r.parsedType,code:O.invalid_type}),oe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),o=this._def.values;return F(r,{received:r.data,code:O.invalid_enum_value,options:o}),oe}return wn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(o=>!e.includes(o)),{...this._def,...r})}};lm.create=vie;var dm=class extends Te{_parse(e){let r=ze.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(e);if(o.parsedType!==B.string&&o.parsedType!==B.number){let n=ze.objectValues(r);return F(o,{expected:ze.joinValues(n),received:o.parsedType,code:O.invalid_type}),oe}if(this._cache||(this._cache=new Set(ze.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=ze.objectValues(r);return F(o,{received:o.data,code:O.invalid_enum_value,options:n}),oe}return wn(e.data)}get enum(){return this._def.values}};dm.create=(t,e)=>new dm({values:t,typeName:z.ZodNativeEnum,...we(e)});var Vl=class extends Te{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.promise&&r.common.async===!1)return F(r,{code:O.invalid_type,expected:B.promise,received:r.parsedType}),oe;let o=r.parsedType===B.promise?r.data:Promise.resolve(r.data);return wn(o.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Vl.create=(t,e)=>new Vl({type:t,typeName:z.ZodPromise,...we(e)});var Mi=class extends Te{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:o}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:s=>{F(o,s),s.fatal?r.abort():r.dirty()},get path(){return o.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let s=n.transform(o.data,i);if(o.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return oe;let c=await this._def.schema._parseAsync({data:a,path:o.path,parent:o});return c.status==="aborted"?oe:c.status==="dirty"?tm(c.value):r.value==="dirty"?tm(c.value):c});{if(r.value==="aborted")return oe;let a=this._def.schema._parseSync({data:s,path:o.path,parent:o});return a.status==="aborted"?oe:a.status==="dirty"?tm(a.value):r.value==="dirty"?tm(a.value):a}}if(n.type==="refinement"){let s=a=>{let c=n.refinement(a,i);if(o.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(o.common.async===!1){let a=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return a.status==="aborted"?oe:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(a=>a.status==="aborted"?oe:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(n.type==="transform")if(o.common.async===!1){let s=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!Fl(s))return oe;let a=n.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(s=>Fl(s)?Promise.resolve(n.transform(s.value,i)).then(a=>({status:r.value,value:a})):oe);ze.assertNever(n)}};Mi.create=(t,e,r)=>new Mi({schema:t,typeName:z.ZodEffects,effect:e,...we(r)});Mi.createWithPreprocess=(t,e,r)=>new Mi({schema:e,effect:{type:"preprocess",transform:t},typeName:z.ZodEffects,...we(r)});var ji=class extends Te{_parse(e){return this._getType(e)===B.undefined?wn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ji.create=(t,e)=>new ji({innerType:t,typeName:z.ZodOptional,...we(e)});var Da=class extends Te{_parse(e){return this._getType(e)===B.null?wn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Da.create=(t,e)=>new Da({innerType:t,typeName:z.ZodNullable,...we(e)});var pm=class extends Te{_parse(e){let{ctx:r}=this._processInputParams(e),o=r.data;return r.parsedType===B.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};pm.create=(t,e)=>new pm({innerType:t,typeName:z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...we(e)});var fm=class extends Te{_parse(e){let{ctx:r}=this._processInputParams(e),o={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return Gv(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new uo(o.common.issues)},input:o.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new uo(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}};fm.create=(t,e)=>new fm({innerType:t,typeName:z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...we(e)});var sw=class extends Te{_parse(e){if(this._getType(e)!==B.nan){let o=this._getOrReturnCtx(e);return F(o,{code:O.invalid_type,expected:B.nan,received:o.parsedType}),oe}return{status:"valid",value:e.data}}};sw.create=t=>new sw({typeName:z.ZodNaN,...we(t)});var EA=class extends Te{_parse(e){let{ctx:r}=this._processInputParams(e),o=r.data;return this._def.type._parse({data:o,path:r.path,parent:r})}unwrap(){return this._def.type}},kA=class t extends Te{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return i.status==="aborted"?oe:i.status==="dirty"?(r.dirty(),tm(i.value)):this._def.out._parseAsync({data:i.value,path:o.path,parent:o})})();{let n=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return n.status==="aborted"?oe:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:o.path,parent:o})}}static create(e,r){return new t({in:e,out:r,typeName:z.ZodPipeline})}},mm=class extends Te{_parse(e){let r=this._def.innerType._parse(e),o=n=>(Fl(n)&&(n.value=Object.freeze(n.value)),n);return Gv(r)?r.then(n=>o(n)):o(r)}unwrap(){return this._def.innerType}};mm.create=(t,e)=>new mm({innerType:t,typeName:z.ZodReadonly,...we(e)});var Mwt={object:lo.lazycreate},z;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(z||(z={}));var Uwt=nm.create,Lwt=Xv.create,Fwt=sw.create,Vwt=Yv.create,Hwt=Qv.create,Bwt=ew.create,Kwt=tw.create,qwt=om.create,Zwt=im.create,Wwt=rw.create,Jwt=pu.create,Gwt=qs.create,Xwt=nw.create,Ywt=fu.create,wie=lo.create,Qwt=lo.strictCreate,ebt=sm.create,tbt=$4.create,rbt=am.create,nbt=Na.create,obt=T4.create,ibt=ow.create,sbt=iw.create,abt=P4.create,cbt=cm.create,ubt=um.create,lbt=lm.create,dbt=dm.create,pbt=Vl.create,fbt=Mi.create,mbt=ji.create,hbt=Da.create,gbt=Mi.createWithPreprocess,ybt=kA.create;var NRe=S("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");ae.init(t,e),t.def=e,t.type=e.type},{get with(){return this.check},set with(t){Zi(this,"with",t)},parse(t,e){return Pu(this,t,e,{callee:this.parse})},parseAsync(t,e){return Ru(this,t,e,{callee:this.parseAsync})},safeParse(t,e){return md(this,t,e)},safeParseAsync(t,e){return gd(this,t,e)},check(...t){let e=this.def;return this.clone({...e,checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(t,e){return qe(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},apply(t,...e){return e.length===0?t(this):t(this,...e)}});var DRe=S("ZodMiniObject",(t,e)=>{h_.init(t,e),NRe.init(t,e),rP(t,"shape",r=>r._zod.def.shape,!1)});function R4(t,e){let r={type:"object",shape:t??{},...N(e)};return new DRe(r)}function Zs(t){return!!t._zod}function Hl(t){let e=Object.values(t);if(e.length===0)return R4({});let r=e.every(Zs),o=e.every(n=>!Zs(n));if(r)return R4(t);if(o)return wie(t);throw new Error("Mixed Zod versions detected in object shape.")}function mu(t,e){return Zs(t)?md(t,e):t.safeParse(e)}async function IA(t,e){return Zs(t)?await gd(t,e):await t.safeParseAsync(e)}function hu(t){if(!t)return;let e;if(Zs(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function hm(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let o=Object.values(t);if(o.length>0&&o.every(n=>typeof n=="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse=="function")))return Hl(t)}}if(Zs(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function jRe(t){return t.length===0?"object root":t.reduce((e,r,o)=>o===0?String(r):typeof r=="number"?`${e}[${r}]`:`${e}.${r}`,"")}function $A(t){if(t&&typeof t=="object"){if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0)return t.issues.map(e=>e.path?.length?`${e.message} at ${jRe(e.path)}`:e.message).join(`
141
+ `);if("message"in t&&typeof t.message=="string")return t.message;try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function bie(t){return t.description}function _ie(t){if(Zs(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function gm(t){if(Zs(t)){let i=t._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=t.value;if(o!==void 0)return o}var O4="2025-11-25";var Sie=[O4,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],gu="io.modelcontextprotocol/related-task",TA="2.0",ar=dx(t=>t!==null&&(typeof t=="object"||typeof t=="function")),xie=tt([I(),Ze().int()]),Eie=I(),Rbt=br({ttl:Ze().optional(),pollInterval:Ze().optional()}),MRe=H({ttl:Ze().optional()}),URe=H({taskId:I()}),N4=br({progressToken:xie.optional(),[gu]:URe.optional()}),po=H({_meta:N4.optional()}),aw=po.extend({task:MRe.optional()}),kie=t=>aw.safeParse(t).success,zr=H({method:I(),params:po.loose().optional()}),qo=H({_meta:N4.optional()}),Zo=H({method:I(),params:qo.loose().optional()}),jr=br({_meta:N4.optional()}),PA=tt([I(),Ze().int()]),Iie=H({jsonrpc:G(TA),id:PA,...zr.shape}).strict(),D4=t=>Iie.safeParse(t).success,$ie=H({jsonrpc:G(TA),...Zo.shape}).strict(),Aie=t=>$ie.safeParse(t).success,z4=H({jsonrpc:G(TA),id:PA,result:jr}).strict(),cw=t=>z4.safeParse(t).success;var Y;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Y||(Y={}));var j4=H({jsonrpc:G(TA),id:PA.optional(),error:H({code:Ze().int(),message:I(),data:ut().optional()})}).strict();var Tie=t=>j4.safeParse(t).success;var Pie=tt([Iie,$ie,z4,j4]),Cbt=tt([z4,j4]),RA=jr.strict(),LRe=qo.extend({requestId:PA.optional(),reason:I().optional()}),CA=Zo.extend({method:G("notifications/cancelled"),params:LRe}),FRe=H({src:I(),mimeType:I().optional(),sizes:Ae(I()).optional(),theme:_r(["light","dark"]).optional()}),uw=H({icons:Ae(FRe).optional()}),ym=H({name:I(),title:I().optional()}),Rie=ym.extend({...ym.shape,...uw.shape,version:I(),websiteUrl:I().optional(),description:I().optional()}),VRe=Yd(H({applyDefaults:Vt().optional()}),st(I(),ut())),HRe=tg(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Yd(H({form:VRe.optional(),url:ar.optional()}),st(I(),ut()).optional())),BRe=br({list:ar.optional(),cancel:ar.optional(),requests:br({sampling:br({createMessage:ar.optional()}).optional(),elicitation:br({create:ar.optional()}).optional()}).optional()}),KRe=br({list:ar.optional(),cancel:ar.optional(),requests:br({tools:br({call:ar.optional()}).optional()}).optional()}),qRe=H({experimental:st(I(),ar).optional(),sampling:H({context:ar.optional(),tools:ar.optional()}).optional(),elicitation:HRe.optional(),roots:H({listChanged:Vt().optional()}).optional(),tasks:BRe.optional(),extensions:st(I(),ar).optional()}),ZRe=po.extend({protocolVersion:I(),capabilities:qRe,clientInfo:Rie}),M4=zr.extend({method:G("initialize"),params:ZRe});var WRe=H({experimental:st(I(),ar).optional(),logging:ar.optional(),completions:ar.optional(),prompts:H({listChanged:Vt().optional()}).optional(),resources:H({subscribe:Vt().optional(),listChanged:Vt().optional()}).optional(),tools:H({listChanged:Vt().optional()}).optional(),tasks:KRe.optional(),extensions:st(I(),ar).optional()}),JRe=jr.extend({protocolVersion:I(),capabilities:WRe,serverInfo:Rie,instructions:I().optional()}),U4=Zo.extend({method:G("notifications/initialized"),params:qo.optional()});var OA=zr.extend({method:G("ping"),params:po.optional()}),GRe=H({progress:Ze(),total:ot(Ze()),message:ot(I())}),XRe=H({...qo.shape,...GRe.shape,progressToken:xie}),NA=Zo.extend({method:G("notifications/progress"),params:XRe}),YRe=po.extend({cursor:Eie.optional()}),lw=zr.extend({params:YRe.optional()}),dw=jr.extend({nextCursor:Eie.optional()}),QRe=_r(["working","input_required","completed","failed","cancelled"]),pw=H({taskId:I(),status:QRe,ttl:tt([Ze(),Zh()]),createdAt:I(),lastUpdatedAt:I(),pollInterval:ot(Ze()),statusMessage:ot(I())}),vm=jr.extend({task:pw}),eCe=qo.merge(pw),fw=Zo.extend({method:G("notifications/tasks/status"),params:eCe}),DA=zr.extend({method:G("tasks/get"),params:po.extend({taskId:I()})}),zA=jr.merge(pw),jA=zr.extend({method:G("tasks/result"),params:po.extend({taskId:I()})}),Obt=jr.loose(),MA=lw.extend({method:G("tasks/list")}),UA=dw.extend({tasks:Ae(pw)}),LA=zr.extend({method:G("tasks/cancel"),params:po.extend({taskId:I()})}),Cie=jr.merge(pw),Oie=H({uri:I(),mimeType:ot(I()),_meta:st(I(),ut()).optional()}),Nie=Oie.extend({text:I()}),L4=I().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Die=Oie.extend({blob:L4}),mw=_r(["user","assistant"]),wm=H({audience:Ae(mw).optional(),priority:Ze().min(0).max(1).optional(),lastModified:Ku.datetime({offset:!0}).optional()}),zie=H({...ym.shape,...uw.shape,uri:I(),description:ot(I()),mimeType:ot(I()),size:ot(Ze()),annotations:wm.optional(),_meta:ot(br({}))}),tCe=H({...ym.shape,...uw.shape,uriTemplate:I(),description:ot(I()),mimeType:ot(I()),annotations:wm.optional(),_meta:ot(br({}))}),FA=lw.extend({method:G("resources/list")}),rCe=dw.extend({resources:Ae(zie)}),VA=lw.extend({method:G("resources/templates/list")}),nCe=dw.extend({resourceTemplates:Ae(tCe)}),F4=po.extend({uri:I()}),oCe=F4,HA=zr.extend({method:G("resources/read"),params:oCe}),iCe=jr.extend({contents:Ae(tt([Nie,Die]))}),sCe=Zo.extend({method:G("notifications/resources/list_changed"),params:qo.optional()}),aCe=F4,cCe=zr.extend({method:G("resources/subscribe"),params:aCe}),uCe=F4,lCe=zr.extend({method:G("resources/unsubscribe"),params:uCe}),dCe=qo.extend({uri:I()}),pCe=Zo.extend({method:G("notifications/resources/updated"),params:dCe}),fCe=H({name:I(),description:ot(I()),required:ot(Vt())}),mCe=H({...ym.shape,...uw.shape,description:ot(I()),arguments:ot(Ae(fCe)),_meta:ot(br({}))}),BA=lw.extend({method:G("prompts/list")}),hCe=dw.extend({prompts:Ae(mCe)}),gCe=po.extend({name:I(),arguments:st(I(),I()).optional()}),KA=zr.extend({method:G("prompts/get"),params:gCe}),V4=H({type:G("text"),text:I(),annotations:wm.optional(),_meta:st(I(),ut()).optional()}),H4=H({type:G("image"),data:L4,mimeType:I(),annotations:wm.optional(),_meta:st(I(),ut()).optional()}),B4=H({type:G("audio"),data:L4,mimeType:I(),annotations:wm.optional(),_meta:st(I(),ut()).optional()}),yCe=H({type:G("tool_use"),name:I(),id:I(),input:st(I(),ut()),_meta:st(I(),ut()).optional()}),vCe=H({type:G("resource"),resource:tt([Nie,Die]),annotations:wm.optional(),_meta:st(I(),ut()).optional()}),wCe=zie.extend({type:G("resource_link")}),K4=tt([V4,H4,B4,wCe,vCe]),bCe=H({role:mw,content:K4}),_Ce=jr.extend({description:I().optional(),messages:Ae(bCe)}),SCe=Zo.extend({method:G("notifications/prompts/list_changed"),params:qo.optional()}),xCe=H({title:I().optional(),readOnlyHint:Vt().optional(),destructiveHint:Vt().optional(),idempotentHint:Vt().optional(),openWorldHint:Vt().optional()}),ECe=H({taskSupport:_r(["required","optional","forbidden"]).optional()}),jie=H({...ym.shape,...uw.shape,description:I().optional(),inputSchema:H({type:G("object"),properties:st(I(),ar).optional(),required:Ae(I()).optional()}).catchall(ut()),outputSchema:H({type:G("object"),properties:st(I(),ar).optional(),required:Ae(I()).optional()}).catchall(ut()).optional(),annotations:xCe.optional(),execution:ECe.optional(),_meta:st(I(),ut()).optional()}),qA=lw.extend({method:G("tools/list")}),kCe=dw.extend({tools:Ae(jie)}),ZA=jr.extend({content:Ae(K4).default([]),structuredContent:st(I(),ut()).optional(),isError:Vt().optional()}),Nbt=ZA.or(jr.extend({toolResult:ut()})),ICe=aw.extend({name:I(),arguments:st(I(),ut()).optional()}),bm=zr.extend({method:G("tools/call"),params:ICe}),$Ce=Zo.extend({method:G("notifications/tools/list_changed"),params:qo.optional()}),Dbt=H({autoRefresh:Vt().default(!0),debounceMs:Ze().int().nonnegative().default(300)}),hw=_r(["debug","info","notice","warning","error","critical","alert","emergency"]),ACe=po.extend({level:hw}),q4=zr.extend({method:G("logging/setLevel"),params:ACe}),TCe=qo.extend({level:hw,logger:I().optional(),data:ut()}),PCe=Zo.extend({method:G("notifications/message"),params:TCe}),RCe=H({name:I().optional()}),CCe=H({hints:Ae(RCe).optional(),costPriority:Ze().min(0).max(1).optional(),speedPriority:Ze().min(0).max(1).optional(),intelligencePriority:Ze().min(0).max(1).optional()}),OCe=H({mode:_r(["auto","required","none"]).optional()}),NCe=H({type:G("tool_result"),toolUseId:I().describe("The unique identifier for the corresponding tool call."),content:Ae(K4).default([]),structuredContent:H({}).loose().optional(),isError:Vt().optional(),_meta:st(I(),ut()).optional()}),DCe=Xh("type",[V4,H4,B4]),AA=Xh("type",[V4,H4,B4,yCe,NCe]),zCe=H({role:mw,content:tt([AA,Ae(AA)]),_meta:st(I(),ut()).optional()}),jCe=aw.extend({messages:Ae(zCe),modelPreferences:CCe.optional(),systemPrompt:I().optional(),includeContext:_r(["none","thisServer","allServers"]).optional(),temperature:Ze().optional(),maxTokens:Ze().int(),stopSequences:Ae(I()).optional(),metadata:ar.optional(),tools:Ae(jie).optional(),toolChoice:OCe.optional()}),MCe=zr.extend({method:G("sampling/createMessage"),params:jCe}),gw=jr.extend({model:I(),stopReason:ot(_r(["endTurn","stopSequence","maxTokens"]).or(I())),role:mw,content:DCe}),Z4=jr.extend({model:I(),stopReason:ot(_r(["endTurn","stopSequence","maxTokens","toolUse"]).or(I())),role:mw,content:tt([AA,Ae(AA)])}),UCe=H({type:G("boolean"),title:I().optional(),description:I().optional(),default:Vt().optional()}),LCe=H({type:G("string"),title:I().optional(),description:I().optional(),minLength:Ze().optional(),maxLength:Ze().optional(),format:_r(["email","uri","date","date-time"]).optional(),default:I().optional()}),FCe=H({type:_r(["number","integer"]),title:I().optional(),description:I().optional(),minimum:Ze().optional(),maximum:Ze().optional(),default:Ze().optional()}),VCe=H({type:G("string"),title:I().optional(),description:I().optional(),enum:Ae(I()),default:I().optional()}),HCe=H({type:G("string"),title:I().optional(),description:I().optional(),oneOf:Ae(H({const:I(),title:I()})),default:I().optional()}),BCe=H({type:G("string"),title:I().optional(),description:I().optional(),enum:Ae(I()),enumNames:Ae(I()).optional(),default:I().optional()}),KCe=tt([VCe,HCe]),qCe=H({type:G("array"),title:I().optional(),description:I().optional(),minItems:Ze().optional(),maxItems:Ze().optional(),items:H({type:G("string"),enum:Ae(I())}),default:Ae(I()).optional()}),ZCe=H({type:G("array"),title:I().optional(),description:I().optional(),minItems:Ze().optional(),maxItems:Ze().optional(),items:H({anyOf:Ae(H({const:I(),title:I()}))}),default:Ae(I()).optional()}),WCe=tt([qCe,ZCe]),JCe=tt([BCe,KCe,WCe]),GCe=tt([JCe,UCe,LCe,FCe]),XCe=aw.extend({mode:G("form").optional(),message:I(),requestedSchema:H({type:G("object"),properties:st(I(),GCe),required:Ae(I()).optional()})}),YCe=aw.extend({mode:G("url"),message:I(),elicitationId:I(),url:I().url()}),QCe=tt([XCe,YCe]),eOe=zr.extend({method:G("elicitation/create"),params:QCe}),tOe=qo.extend({elicitationId:I()}),rOe=Zo.extend({method:G("notifications/elicitation/complete"),params:tOe}),_m=jr.extend({action:_r(["accept","decline","cancel"]),content:tg(t=>t===null?void 0:t,st(I(),tt([I(),Ze(),Vt(),Ae(I())])).optional())}),nOe=H({type:G("ref/resource"),uri:I()});var oOe=H({type:G("ref/prompt"),name:I()}),iOe=po.extend({ref:tt([oOe,nOe]),argument:H({name:I(),value:I()}),context:H({arguments:st(I(),I()).optional()}).optional()}),WA=zr.extend({method:G("completion/complete"),params:iOe});function Mie(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function Uie(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var sOe=jr.extend({completion:br({values:Ae(I()).max(100),total:ot(Ze().int()),hasMore:ot(Vt())})}),aOe=H({uri:I().startsWith("file://"),name:I().optional(),_meta:st(I(),ut()).optional()}),cOe=zr.extend({method:G("roots/list"),params:po.optional()}),W4=jr.extend({roots:Ae(aOe)}),uOe=Zo.extend({method:G("notifications/roots/list_changed"),params:qo.optional()}),zbt=tt([OA,M4,WA,q4,KA,BA,FA,VA,HA,cCe,lCe,bm,qA,DA,jA,MA,LA]),jbt=tt([CA,NA,U4,uOe,fw]),Mbt=tt([RA,gw,Z4,_m,W4,zA,UA,vm]),Ubt=tt([OA,MCe,eOe,cOe,DA,jA,MA,LA]),Lbt=tt([CA,NA,PCe,pCe,sCe,$Ce,SCe,fw,rOe]),Fbt=tt([RA,JRe,sOe,_Ce,hCe,rCe,nCe,iCe,ZA,kCe,zA,UA,vm]),q=class t extends Error{constructor(e,r,o){super(`MCP error ${e}: ${r}`),this.code=e,this.data=o,this.name="McpError"}static fromError(e,r,o){if(e===Y.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new C4(n.elicitations,r)}return new t(e,r,o)}},C4=class extends q{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(Y.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function yu(t){return t==="completed"||t==="failed"||t==="cancelled"}var Fie=Symbol("Let zodToJsonSchema decide on which parser to use");var Lie={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Vie=t=>typeof t=="string"?{...Lie,name:t}:{...Lie,...t};var Hie=t=>{let e=Vie(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([o,n])=>[n._def,{def:n._def,path:[...e.basePath,e.definitionPath,o],jsonSchema:void 0}]))}};function J4(t,e,r,o){o?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Ue(t,e,r,o,n){t[e]=r,J4(t,e,o,n)}var JA=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function Ot(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?JA(e,t.currentPath):e.join("/")}}function Bie(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==z.ZodAny&&(r.items=ie(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Ue(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Ue(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Ue(r,"minItems",t.exactLength.value,t.exactLength.message,e),Ue(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Kie(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let o of t.checks)switch(o.kind){case"min":e.target==="jsonSchema7"?o.inclusive?Ue(r,"minimum",o.value,o.message,e):Ue(r,"exclusiveMinimum",o.value,o.message,e):(o.inclusive||(r.exclusiveMinimum=!0),Ue(r,"minimum",o.value,o.message,e));break;case"max":e.target==="jsonSchema7"?o.inclusive?Ue(r,"maximum",o.value,o.message,e):Ue(r,"exclusiveMaximum",o.value,o.message,e):(o.inclusive||(r.exclusiveMaximum=!0),Ue(r,"maximum",o.value,o.message,e));break;case"multipleOf":Ue(r,"multipleOf",o.value,o.message,e);break}return r}function qie(){return{type:"boolean"}}function GA(t,e){return ie(t.type._def,e)}var Zie=(t,e)=>ie(t.innerType._def,e);function G4(t,e,r){let o=r??e.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((n,i)=>G4(t,e,n))};switch(o){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return lOe(t,e)}}var lOe=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let o of t.checks)switch(o.kind){case"min":Ue(r,"minimum",o.value,o.message,e);break;case"max":Ue(r,"maximum",o.value,o.message,e);break}return r};function Wie(t,e){return{...ie(t.innerType._def,e),default:t.defaultValue()}}function Jie(t,e){return e.effectStrategy==="input"?ie(t.schema._def,e):Ot(e)}function Gie(t){return{type:"string",enum:Array.from(t.values)}}var dOe=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Xie(t,e){let r=[ie(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),ie(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),o=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach(i=>{if(dOe(i))n.push(...i.allOf),i.unevaluatedProperties===void 0&&(o=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else o=void 0;n.push(s)}}),n.length?{allOf:n,...o}:void 0}function Yie(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var X4,Ui={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(X4===void 0&&(X4=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),X4),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function XA(t,e){let r={type:"string"};if(t.checks)for(let o of t.checks)switch(o.kind){case"min":Ue(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":Ue(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Li(r,"email",o.message,e);break;case"format:idn-email":Li(r,"idn-email",o.message,e);break;case"pattern:zod":bn(r,Ui.email,o.message,e);break}break;case"url":Li(r,"uri",o.message,e);break;case"uuid":Li(r,"uuid",o.message,e);break;case"regex":bn(r,o.regex,o.message,e);break;case"cuid":bn(r,Ui.cuid,o.message,e);break;case"cuid2":bn(r,Ui.cuid2,o.message,e);break;case"startsWith":bn(r,RegExp(`^${Y4(o.value,e)}`),o.message,e);break;case"endsWith":bn(r,RegExp(`${Y4(o.value,e)}$`),o.message,e);break;case"datetime":Li(r,"date-time",o.message,e);break;case"date":Li(r,"date",o.message,e);break;case"time":Li(r,"time",o.message,e);break;case"duration":Li(r,"duration",o.message,e);break;case"length":Ue(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),Ue(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{bn(r,RegExp(Y4(o.value,e)),o.message,e);break}case"ip":{o.version!=="v6"&&Li(r,"ipv4",o.message,e),o.version!=="v4"&&Li(r,"ipv6",o.message,e);break}case"base64url":bn(r,Ui.base64url,o.message,e);break;case"jwt":bn(r,Ui.jwt,o.message,e);break;case"cidr":{o.version!=="v6"&&bn(r,Ui.ipv4Cidr,o.message,e),o.version!=="v4"&&bn(r,Ui.ipv6Cidr,o.message,e);break}case"emoji":bn(r,Ui.emoji(),o.message,e);break;case"ulid":{bn(r,Ui.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Li(r,"binary",o.message,e);break}case"contentEncoding:base64":{Ue(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{bn(r,Ui.base64,o.message,e);break}}break}case"nanoid":bn(r,Ui.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Y4(t,e){return e.patternStrategy==="escape"?fOe(t):t}var pOe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function fOe(t){let e="";for(let r=0;r<t.length;r++)pOe.has(t[r])||(e+="\\"),e+=t[r];return e}function Li(t,e,r,o){t.format||t.anyOf?.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&o.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&o.errorMessages&&{errorMessage:{format:r}}})):Ue(t,"format",e,r,o)}function bn(t,e,r,o){t.pattern||t.allOf?.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&o.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:Qie(e,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})):Ue(t,"pattern",Qie(e,o),r,o)}function Qie(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},o=r.i?t.source.toLowerCase():t.source,n="",i=!1,s=!1,a=!1;for(let c=0;c<o.length;c++){if(i){n+=o[c],i=!1;continue}if(r.i){if(s){if(o[c].match(/[a-z]/)){a?(n+=o[c],n+=`${o[c-2]}-${o[c]}`.toUpperCase(),a=!1):o[c+1]==="-"&&o[c+2]?.match(/[a-z]/)?(n+=o[c],a=!0):n+=`${o[c]}${o[c].toUpperCase()}`;continue}}else if(o[c].match(/[a-z]/)){n+=`[${o[c]}${o[c].toUpperCase()}]`;continue}}if(r.m){if(o[c]==="^"){n+=`(^|(?<=[\r
142
142
  ]))`;continue}else if(o[c]==="$"){n+=`($|(?=[\r
143
143
  ]))`;continue}}if(r.s&&o[c]==="."){n+=s?`${o[c]}\r
144
144
  `:`[${o[c]}\r
@@ -148,7 +148,7 @@ Verify the fingerprint with this principal, then run foundation trust `)+f.id+`
148
148
  `),i=n.flatMap((u,l)=>u.startsWith(r)?[l]:[]),s=n.flatMap((u,l)=>u.replace(/\r$/,"")===o?[l]:[]);if(!i.length&&!s.length)return{before:n,managed:null,generation:null,after:[]};let a=()=>new Um("The managed lines for this host are not marked once from beginning to end.");if(i.length!==1||s.length!==1||s[0]<i[0])throw a();let c=/^(0|[1-9]\d{0,14})\r?$/.exec(n[i[0]].slice(r.length))?.[1];if(c===void 0)throw a();return{before:n.slice(0,i[0]),managed:n.slice(i[0]+1,s[0]),generation:Number(c),after:n.slice(s[0]+1)}}function Due(t,e,r,o){let{begin:n,end:i}=Oue(e),s=Nue(t,e);if(s.generation!==null&&s.generation>o)throw new Xw("A newer plan was applied to this account.");for(let a of r)if(a.includes(`
149
149
  `)||a.includes("\r"))throw new Um("Use one line for each key.");return[...s.before,n+o,...r,i,...s.after].join(`
150
150
  `)+`
151
- `}function zue(t,e){let r=Nue(t,e),o=new Set([...r.before,...r.after].map(BMe).filter(n=>n!==null));return{managed:(r.managed??[]).map(n=>n.replace(/\r$/,"")).filter(n=>n.trim()&&!n.trim().startsWith("#")),unmanaged:[...o].sort()}}var KMe=h.object({account:ep,file:fx,generation:h.number().int().nonnegative(),lines:h.array(h.string())}).strict(),jue=h.object({hostId:E,address:px,port:h.number().int().min(1).max(65535),hostKeys:h.array(ig).min(1),accounts:h.array(KMe)}).strict(),qMe=h.enum(["verified","conflict","unreachable","denied","host_key_mismatch","invalid_file","failed"]),HEt=h.discriminatedUnion("outcome",[h.object({account:ep,generation:h.number().int().nonnegative(),outcome:h.literal("verified"),managed:h.array(h.string().max(16384)).max(1e3),unmanaged:h.array(mx).max(1e3)}).strict(),h.object({account:ep,generation:h.number().int().nonnegative(),outcome:qMe.exclude(["verified"]),message:h.string().max(1e3).optional()}).strict()]);var HT=t=>"'"+t.replaceAll("'","'\\''")+"'";async function XMe(t,e,r,o,n){let i=["BatchMode=yes","StrictHostKeyChecking=yes","UserKnownHostsFile="+o,"GlobalKnownHostsFile=/dev/null","HostKeyAlias="+t.hostId,"UpdateHostKeys=no","CheckHostIP=no","PasswordAuthentication=no","KbdInteractiveAuthentication=no","ConnectTimeout=10","ConnectionAttempts=1","ServerAliveInterval=5","ServerAliveCountMax=2","ClearAllForwardings=yes","ForwardAgent=no","ForwardX11=no","PermitLocalCommand=no","LogLevel=ERROR",...r.identity?["IdentitiesOnly=yes","IdentityAgent="+(r.agent??"none")]:[]];return new Promise((s,a)=>{let c=sF("ssh",["-F","/dev/null","-T","-p",String(t.port),...r.identity?["-i",r.identity]:[],...i.flatMap(m=>["-o",m]),"--",e+"@"+t.address,"sh -s"],{stdio:["pipe","pipe","pipe"]}),u="",l="",d=!1,f=setTimeout(()=>c.kill("SIGKILL"),6e4),p=()=>{d=!0,c.kill("SIGKILL")};c.stdout.on("data",m=>{u+=m,u.length>8e6&&p()}),c.stderr.on("data",m=>{l+=m,l.length>64e3&&(l=l.slice(0,64e3),p())}),c.stdin.on("error",()=>{}),c.once("error",()=>{clearTimeout(f),a(new Error("Install OpenSSH to apply SSH access."))}),c.once("close",m=>{clearTimeout(f),s(d?{code:1,stdout:"",stderr:""}:{code:m??255,stdout:u,stderr:l})}),c.stdin.end(n)})}function iF(t){return t.code===255?/host key verification failed|remote host identification has changed|no \S+ host key is known/i.test(t.stderr)?{outcome:"host_key_mismatch",message:"The server did not prove itself with a registered host key."}:/permission denied/i.test(t.stderr)?{outcome:"denied",message:"The server did not let this client sign in to the account."}:{outcome:"unreachable",message:"The server could not be reached over SSH."}:t.code===3?{outcome:"conflict",message:"The authorized keys changed while they were being applied."}:t.code===4?{outcome:"invalid_file",message:"The authorized keys file is not a regular file."}:{outcome:"failed",message:"The authorized keys could not be read or written on the server."}}var que=t=>"f="+(t.startsWith("/")?HT(t):'"$HOME"/'+HT(t))+`
151
+ `}function zue(t,e){let r=Nue(t,e),o=new Set([...r.before,...r.after].map(BMe).filter(n=>n!==null));return{managed:(r.managed??[]).map(n=>n.replace(/\r$/,"")).filter(n=>n.trim()&&!n.trim().startsWith("#")),unmanaged:[...o].sort()}}var KMe=h.object({account:ep,file:fx,generation:h.number().int().nonnegative(),lines:h.array(h.string())}).strict(),jue=h.object({hostId:E,address:px,port:h.number().int().min(1).max(65535),hostKeys:h.array(ig).min(1),accounts:h.array(KMe)}).strict(),qMe=h.enum(["verified","conflict","unreachable","denied","host_key_mismatch","invalid_file","failed"]),VEt=h.discriminatedUnion("outcome",[h.object({account:ep,generation:h.number().int().nonnegative(),outcome:h.literal("verified"),managed:h.array(h.string().max(16384)).max(1e3),unmanaged:h.array(mx).max(1e3)}).strict(),h.object({account:ep,generation:h.number().int().nonnegative(),outcome:qMe.exclude(["verified"]),message:h.string().max(1e3).optional()}).strict()]);var HT=t=>"'"+t.replaceAll("'","'\\''")+"'";async function XMe(t,e,r,o,n){let i=["BatchMode=yes","StrictHostKeyChecking=yes","UserKnownHostsFile="+o,"GlobalKnownHostsFile=/dev/null","HostKeyAlias="+t.hostId,"UpdateHostKeys=no","CheckHostIP=no","PasswordAuthentication=no","KbdInteractiveAuthentication=no","ConnectTimeout=10","ConnectionAttempts=1","ServerAliveInterval=5","ServerAliveCountMax=2","ClearAllForwardings=yes","ForwardAgent=no","ForwardX11=no","PermitLocalCommand=no","LogLevel=ERROR",...r.identity?["IdentitiesOnly=yes","IdentityAgent="+(r.agent??"none")]:[]];return new Promise((s,a)=>{let c=sF("ssh",["-F","/dev/null","-T","-p",String(t.port),...r.identity?["-i",r.identity]:[],...i.flatMap(m=>["-o",m]),"--",e+"@"+t.address,"sh -s"],{stdio:["pipe","pipe","pipe"]}),u="",l="",d=!1,f=setTimeout(()=>c.kill("SIGKILL"),6e4),p=()=>{d=!0,c.kill("SIGKILL")};c.stdout.on("data",m=>{u+=m,u.length>8e6&&p()}),c.stderr.on("data",m=>{l+=m,l.length>64e3&&(l=l.slice(0,64e3),p())}),c.stdin.on("error",()=>{}),c.once("error",()=>{clearTimeout(f),a(new Error("Install OpenSSH to apply SSH access."))}),c.once("close",m=>{clearTimeout(f),s(d?{code:1,stdout:"",stderr:""}:{code:m??255,stdout:u,stderr:l})}),c.stdin.end(n)})}function iF(t){return t.code===255?/host key verification failed|remote host identification has changed|no \S+ host key is known/i.test(t.stderr)?{outcome:"host_key_mismatch",message:"The server did not prove itself with a registered host key."}:/permission denied/i.test(t.stderr)?{outcome:"denied",message:"The server did not let this client sign in to the account."}:{outcome:"unreachable",message:"The server could not be reached over SSH."}:t.code===3?{outcome:"conflict",message:"The authorized keys changed while they were being applied."}:t.code===4?{outcome:"invalid_file",message:"The authorized keys file is not a regular file."}:{outcome:"failed",message:"The authorized keys could not be read or written on the server."}}var que=t=>"f="+(t.startsWith("/")?HT(t):'"$HOME"/'+HT(t))+`
152
152
  d=$(dirname -- "$f")
153
153
  if [ -L "$d" ] || [ -L "$f" ] || { [ -e "$f" ] && [ ! -f "$f" ]; }; then exit 4; fi
154
154
  `,YMe=t=>`set -eu