mppx 0.17.0 → 0.17.3

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 (83) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/BodyDigest.js +13 -1
  3. package/dist/Method.d.ts +5 -0
  4. package/dist/Store.d.ts +225 -0
  5. package/dist/Store.js +358 -0
  6. package/dist/cli/cli.js +136 -135
  7. package/dist/cli/plugins/index.js +12 -11
  8. package/dist/cli/sessions/Manager.js +12 -1
  9. package/dist/cli/sessions/store.js +7 -1
  10. package/dist/cli/utils.d.ts +2 -0
  11. package/dist/cli/utils.js +6 -0
  12. package/dist/cli/validate/helpers.d.ts +1 -1
  13. package/dist/cli/validate/helpers.js +14 -2
  14. package/dist/client/Mppx.d.ts +1 -1
  15. package/dist/client/Mppx.js +18 -6
  16. package/dist/client/internal/Fetch.d.ts +3 -1
  17. package/dist/client/internal/Fetch.js +68 -3
  18. package/dist/client/internal/MethodResponse.d.ts +8 -0
  19. package/dist/client/internal/MethodResponse.js +9 -0
  20. package/dist/client/internal/ProofRealm.d.ts +3 -3
  21. package/dist/client/internal/ProofRealm.js +4 -4
  22. package/dist/client/internal/protocols/Mcp.d.ts +4 -0
  23. package/dist/client/internal/protocols/Mcp.js +27 -14
  24. package/dist/identity/Client.js +7 -1
  25. package/dist/internal/AcceptPayment.d.ts +12 -2
  26. package/dist/internal/AcceptPayment.js +12 -3
  27. package/dist/internal/sse.d.ts +21 -0
  28. package/dist/internal/sse.js +65 -0
  29. package/dist/internal/version.d.ts +2 -2
  30. package/dist/internal/version.js +1 -1
  31. package/dist/mcp/client/McpClient.d.ts +2 -2
  32. package/dist/mcp/client/McpClient.js +6 -3
  33. package/dist/proxy/Proxy.d.ts +17 -0
  34. package/dist/proxy/Proxy.js +116 -3
  35. package/dist/proxy/internal/Replay.d.ts +105 -0
  36. package/dist/proxy/internal/Replay.js +257 -0
  37. package/dist/server/Mppx.d.ts +2 -0
  38. package/dist/server/Mppx.js +7 -5
  39. package/dist/server/Transport.js +1 -1
  40. package/dist/server/internal/html/config.d.ts +7 -1
  41. package/dist/server/internal/html/config.js +4 -0
  42. package/dist/stripe/internal/types.d.ts +82 -6
  43. package/dist/stripe/server/Charge.js +1 -2
  44. package/dist/stripe/server/internal/html.gen.js +1 -1
  45. package/dist/tempo/client/Charge.d.ts +9 -0
  46. package/dist/tempo/client/Charge.js +13 -9
  47. package/dist/tempo/client/Methods.d.ts +2 -0
  48. package/dist/tempo/internal/fee-payer.d.ts +85 -10
  49. package/dist/tempo/internal/fee-payer.js +183 -19
  50. package/dist/tempo/legacy/session/Chain.js +2 -0
  51. package/dist/tempo/server/Charge.js +6 -3
  52. package/dist/tempo/server/Subscription.js +1 -0
  53. package/dist/tempo/server/internal/html.gen.js +1 -1
  54. package/dist/tempo/server/internal/transport.d.ts +6 -0
  55. package/dist/tempo/server/internal/transport.js +21 -21
  56. package/dist/tempo/session/client/ChannelOps.d.ts +2 -0
  57. package/dist/tempo/session/client/ChannelStore.d.ts +2 -0
  58. package/dist/tempo/session/client/ChannelStore.js +5 -0
  59. package/dist/tempo/session/client/CredentialState.js +2 -0
  60. package/dist/tempo/session/client/Session.d.ts +37 -2
  61. package/dist/tempo/session/client/Session.js +111 -7
  62. package/dist/tempo/session/client/SessionManager.d.ts +2 -1
  63. package/dist/tempo/session/client/SessionManager.js +60 -9
  64. package/dist/tempo/session/client/Transports.d.ts +4 -0
  65. package/dist/tempo/session/client/Transports.js +35 -3
  66. package/dist/tempo/session/precompile/Chain.js +1 -0
  67. package/dist/tempo/session/precompile/Voucher.js +20 -7
  68. package/dist/tempo/session/server/ChannelStore.d.ts +9 -0
  69. package/dist/tempo/session/server/ChannelStore.js +8 -1
  70. package/dist/tempo/session/server/MeteredStream.d.ts +4 -0
  71. package/dist/tempo/session/server/MeteredStream.js +6 -1
  72. package/dist/tempo/session/server/Session.d.ts +2 -1
  73. package/dist/tempo/session/server/Session.js +2 -1
  74. package/dist/tempo/session/server/Settlement.d.ts +4 -2
  75. package/dist/tempo/session/server/Settlement.js +2 -2
  76. package/dist/tempo/session/server/Sse.d.ts +59 -0
  77. package/dist/tempo/session/server/Sse.js +175 -10
  78. package/dist/tempo/session/server/Ws.js +29 -12
  79. package/dist/zod.d.ts +2 -1
  80. package/dist/zod.js +1 -1
  81. package/package.json +1 -3
  82. package/dist/stripe/server/internal/html/types.d.ts +0 -2
  83. package/dist/stripe/server/internal/html/types.js +0 -2
@@ -1,3 +1,3 @@
1
1
  // Generated — do not edit.
2
- export const html = "<script>(function(){var e=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n=t((e=>{Object.defineProperty(e,\"__esModule\",{value:!0});function t(e){\"@babel/helpers - typeof\";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}var n=`dahlia`,r=function(e){return e===3?`v3`:e},i=`https://js.stripe.com`,a=`${i}/${n}/stripe.js`,o=/^https:\\/\\/js\\.stripe\\.com\\/v3\\/?(\\?.*)?$/,s=/^https:\\/\\/js\\.stripe\\.com\\/(v3|[a-z]+)\\/stripe\\.js(\\?.*)?$/,c=`loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used`,l=function(e){return o.test(e)||s.test(e)},u=function(){for(var e=document.querySelectorAll(`script[src^=\"${i}\"]`),t=0;t<e.length;t++){var n=e[t];if(l(n.src))return n}return null},d=function(e){var t=e&&!e.advancedFraudSignals?`?advancedFraudSignals=false`:``,n=document.createElement(`script`);n.src=`${a}${t}`;var r=document.head||document.body;if(!r)throw Error(`Expected document.body not to be null. Stripe.js requires a <body> element.`);return r.appendChild(n),n},f=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:`stripe-js`,version:`9.17.0`,startTime:t})},p=null,m=null,h=null,ee=function(e){return function(t){e(Error(`Failed to load Stripe.js`,{cause:t}))}},g=function(e,t){return function(){window.Stripe?e(window.Stripe):t(Error(`Stripe.js not available`))}},_=function(e){return p===null?(p=new Promise(function(t,n){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(c),window.Stripe){t(window.Stripe);return}try{var r=u();if(r&&e)console.warn(c);else if(!r)r=d(e);else if(r&&h!==null&&m!==null){var i;r.removeEventListener(`load`,h),r.removeEventListener(`error`,m),(i=r.parentNode)==null||i.removeChild(r),r=d(e)}h=g(t,n),m=ee(n),r.addEventListener(`load`,h),r.addEventListener(`error`,m)}catch(e){n(e);return}}),p.catch(function(e){return p=null,Promise.reject(e)})):p},te=function(e,i,a){if(e===null)return null;var o=i[0];if(typeof o!=`string`)throw Error(`Expected publishable key to be of type string, got type ${t(o)} instead.`);var s=o.match(/^pk_test/),c=r(e.version),l=n;s&&c!==l&&console.warn(`Stripe.js@${c} was loaded on the page, but @stripe/stripe-js@9.17.0 expected Stripe.js@${l}. This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning`);var u=e.apply(void 0,i);return f(u,a),u},v=function(e){var n=`invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ${JSON.stringify(e)}\n`;if(e===null||t(e)!==`object`)throw Error(n);if(Object.keys(e).length===1&&typeof e.advancedFraudSignals==`boolean`)return e;throw Error(n)},y,b=!1,x=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];b=!0;var r=Date.now();return _(y).then(function(e){return te(e,t,r)})};x.setLoadParameters=function(e){if(b&&y){var t=v(e);if(Object.keys(t).reduce(function(t,n){return t&&e[n]===y?.[n]},!0))return}if(b)throw Error(`You cannot change load parameters after calling loadStripe`);y=v(e)},e.loadStripe=x})),r=t(((e,t)=>{t.exports=n()}));let i={payment:`Payment`};var a,o=e((()=>{a=`0.1.1`}));function s(){return a}var c=e((()=>{o()}));function l(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause?l(e.cause,t):t?null:e}var u,d=e((()=>{c(),u=class e extends Error{static setStaticOptions(t){e.prototype.docsOrigin=t.docsOrigin,e.prototype.showVersion=t.showVersion,e.prototype.version=t.version}constructor(t,n={}){let r=(()=>{if(n.cause instanceof e){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&`details`in n.cause&&typeof n.cause.details==`string`?n.cause.details:n.cause?.message?n.cause.message:n.details})(),i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=n.docsOrigin??e.prototype.docsOrigin,o=`${a}${i??``}`,s=!!(n.version??e.prototype.showVersion),c=n.version??e.prototype.version,l=[t||`An error occurred.`,...n.metaMessages?[``,...n.metaMessages]:[],...r||i||s?[``,r?`Details: ${r}`:void 0,i?`See: ${o}`:void 0,s?`Version: ${c}`:void 0]:[]].filter(e=>typeof e==`string`).join(`\n`);super(l,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,\"details\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"docs\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"docsOrigin\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"docsPath\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"shortMessage\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"showVersion\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"version\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"cause\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsOrigin=a,this.docsPath=i,this.shortMessage=t,this.showVersion=s,this.version=c}walk(e){return l(this,e)}},Object.defineProperty(u,\"defaultStaticOptions\",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:`https://oxlib.sh`,showVersion:!1,version:`ox@${s()}`}}),u.setStaticOptions(u.defaultStaticOptions)}));function f(e,t){if(y(e)>t)throw new x({givenSize:y(e),maxSize:t})}function p(e,t={}){let{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new ne({size:e.length,targetSize:r,type:`Bytes`});let i=new Uint8Array(r);for(let t=0;t<r;t++){let a=n===`right`;i[a?t:r-t-1]=e[a?t:e.length-t-1]}return i}var m=e((()=>{re()}));function h(e){if(e===null||typeof e==`boolean`||typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`){if(!Number.isFinite(e))throw TypeError(`Cannot canonicalize non-finite number`);return Object.is(e,-0)?`0`:JSON.stringify(e)}if(typeof e==`bigint`)throw TypeError(`Cannot canonicalize bigint`);if(Array.isArray(e))return`[${e.map(e=>h(e)).join(`,`)}]`;if(typeof e==`object`)return`{${Object.keys(e).sort().reduce((t,n)=>{let r=e[n];return r!==void 0&&t.push(`${JSON.stringify(n)}:${h(r)}`),t},[]).join(`,`)}}`}function ee(e,t){return JSON.parse(e,(e,n)=>{let r=n;return typeof r==`string`&&r.endsWith(g)?BigInt(r.slice(0,-9)):typeof t==`function`?t(e,r):r})}var g,_=e((()=>{g=`#__bigint`}));function te(e,t={}){let{size:n}=t,r=b.encode(e);return typeof n==`number`?(f(r,n),v(r,n)):r}function v(e,t){return p(e,{dir:`right`,size:t})}function y(e){return e.length}var b,x,ne,re=e((()=>{d(),m(),_(),b=new TextEncoder,x=class extends u{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed \\`${t}\\` bytes. Given size: \\`${e}\\` bytes.`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Bytes.SizeOverflowError`})}},ne=class extends u{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\\`${e}\\`) exceeds padding size (\\`${t}\\`).`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Bytes.SizeExceedsPaddingSizeError`})}}}));re();let ie=new TextDecoder,S=Object.fromEntries(Array.from(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`).map((e,t)=>[t,e.charCodeAt(0)]));({...Object.fromEntries(Array.from(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`).map((e,t)=>[e.charCodeAt(0),t]))});function ae(e,t={}){let{pad:n=!0,url:r=!1}=t,i=new Uint8Array(Math.ceil(e.length/3)*4);for(let t=0,n=0;n<e.length;t+=4,n+=3){let r=(e[n]<<16)+(e[n+1]<<8)+(e[n+2]|0);i[t]=S[r>>18],i[t+1]=S[r>>12&63],i[t+2]=S[r>>6&63],i[t+3]=S[r&63]}let a=e.length%3,o=Math.floor(e.length/3)*4+(a&&a+1),s=ie.decode(new Uint8Array(i.buffer,0,o));return n&&a===1&&(s+=`==`),n&&a===2&&(s+=`=`),r&&(s=s.replaceAll(`+`,`-`).replaceAll(`/`,`_`)),s}function oe(e,t={}){return ae(te(e),t)}_();function se(e){return oe(h(e),{pad:!1,url:!0})}function ce(e,t){return typeof t==`bigint`?t.toString():t}var le=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 ue(e){return new le(e)}function de(e){return e==null}function fe(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function pe(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}let me=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function he(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ge(e){if(he(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return he(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function _e(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function C(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error(\"Cannot specify both `message` and `error` params\");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ve(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}function w(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ye(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function T(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function E(e){return typeof e==`string`?e:e?.message}function be(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function D(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function O(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:E(e.inst?._zod.def?.error?.(e))??E(a?.(e))??E(t?.error?.(e))??E(n.customError?.(e))??E(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}let xe=/[\\uD800-\\uDBFF]/;function Se(e){let t=e.length;if(!xe.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Ce(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function we(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Te(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):De(e,n,r.value)}}function k(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ee(e,t,n){return k(e,t,n,!1)}function De(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:k(this,t,n.bind(this))},set(e){k(this,t,e)}})}function Oe(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let A,j=!1,ke={configurable:!0,get(){j=!0}};function M(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&A!==e._zod){A=void 0;return}A=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,ke);let e=j;j=!1;try{let r=n(this);return j?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),j||=e,r}catch(n){throw delete this[t],j||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Ae(e,t,n,r){let i=Oe(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var je;let N={value:void 0,enumerable:!1},Me=`captureStackTrace`in Error?Error:null;function Ne(e){let t=Me;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Me=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function P(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){N.value=new a(r);try{Object.defineProperty(n,\"_zod\",N)}finally{N.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Te(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,\"name\",{value:e});function d(e){let t=r?.Parent?Ne(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,\"init\",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,\"name\",{value:e}),d}var F=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Pe=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(je=globalThis).__zod_globalConfig??(je.__zod_globalConfig={});let I=globalThis.__zod_globalConfig;function L(e){return e&&Object.assign(I,e),I}function Fe(){let e=this._zod;return e.message??=JSON.stringify(e.def,ce,2),e.message}function Ie(e){this._zod.message=e}let Le={get:Fe,set:Ie,enumerable:!0,configurable:!0},R={value:void 0,enumerable:!1},Re=new WeakSet([Object.prototype,Error.prototype]),ze=(e,t)=>{e.name=`$ZodError`,R.value=t,Object.defineProperty(e,\"issues\",R),R.value=void 0,Object.defineProperty(e,\"message\",Le);let n=Object.getPrototypeOf(e);Re.has(n)||(Re.add(n),Object.defineProperty(n,\"toString\",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,\"toString\",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,\"toString\",{value:e,configurable:!0,writable:!0})}}))};P(`$ZodError`,ze);let z=P(`$ZodError`,ze,void 0,{Parent:Error}),Be=(e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new F;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>O(e,o,L())));throw me(n,a?.callee??t),n}return s.value};return t})(z),Ve=(e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>O(e,o,L())));throw me(n,a?.callee??t),n}return s.value};return t})(z),He=(e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new F;return a.issues.length?Ue(e,a.issues,i):{success:!0,data:a.value}})(z);function Ue(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>O(e,n,L()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}let We=(e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Ue(e,a.issues,i):{success:!0,data:a.value}})(z),Ge=/^[\\s\\S]{0,}$/,Ke=/^-?\\d+(?:\\.\\d+)?$/,B=P(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),qe=e=>{let t=e.value;return!de(t)&&t.length!==void 0},Je=P(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=qe),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Se(r):i)>=t.minimum)return;let a=Ce(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ye=P(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Xe=P(`$ZodCheckRegex`,(e,t)=>{Ye.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ze={major:4,minor:6,patch:7},V=P(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ze;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=w(t),a;for(let o of n){if(o._zod.def.when){if(ye(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new F;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(D(t.issues,n,e),i||=w(t,n))});else{if(t.issues.length===n)continue;D(t.issues,n,e),i||=w(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(w(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new F;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new F;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get\"~standard\"(){return Ee(this,`~standard`,et(this))},set\"~standard\"(e){k(this,`~standard`,e)}}),Qe=(e,t)=>e.issues.length?{issues:e.issues.map(e=>O(e,t,L()))}:{value:e.value};async function $e(e,t){let n={async:!0};return Qe(await e._zod.run({value:t,issues:[]},n),n)}function et(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Qe(r,n)}catch{}return $e(e,t)},vendor:`zod`,version:1}}let tt=P(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=t.pattern??Ge,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),nt=P(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=Ke,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}});function rt(e,t){let n=be(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of be(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,D(n.issues,t,e),n}}return i(n,a)}}let it=e=>Array.isArray(e)?e.length:-1;function at(e,t,n){e.issues.length&&t.issues.push(...T(n,e.issues)),t.value[n]=e.value}let ot=P(`$ZodArray`,(e,t)=>{V.init(e,t);let n=I.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>at(t,r,e)));else if(at(c,r,e),s&&c.issues.length!==0&&w(c))break}return o.length?Promise.all(o).then(()=>r):r},rt(e,it)});function H(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...T(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}let st=[];function ct(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:st,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key \"${String(t)}\": expected a Zod schema`);let a=ve(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function lt(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(w(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>H(e,n,i,t,d,f))):H(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}let ut=P(`$ZodObject`,(e,t)=>{V.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,\"shape\",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,\"shape\",{get:e})}let i=ue(()=>ct(t));M(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||pe(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=he,o=t.catchall,s,c=I.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(w(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>H(n,t,e,r,a,o))):H(s,t,e,r,a,o)}return o?lt(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}});function dt(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!w(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>O(e,r,L())))}),t)}let ft=P(`$ZodUnion`,(e,t)=>{V.init(e,t),M(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),M(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),M(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),M(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>fe(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>dt(t,r,e,i)):dt(o,r,e,i)}}),pt=P(`$ZodRecord`,(e,t)=>{V.init(e,t);let n=I.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ge(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>O(e,i,L())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...T(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...T(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Ke.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>O(e,i,L())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...T(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...T(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),mt=P(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,I.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Pe(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new F;return n.value=i,n}});function ht(e,t){return e.value=t.issues.length?void 0:t.value,e}let gt=P(`$ZodOptional`,(e,t)=>{V.init(e,t),M(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,M(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),M(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${fe(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ht(e,t)):ht(e,r)}return t.innerType._zod.run(e,n)}}),_t=P(`$ZodPipe`,(e,t)=>{V.init(e,t),M(e,`values`,e=>e.def.in._zod.values),M(e,`optin`,e=>e.def.in._zod.optin),M(e,`optout`,e=>e.def.out._zod.optout),M(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>U(e,t.in,n)):U(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>U(e,t.out,n)):U(r,t.out,n)}});function U(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}let vt=P(`$ZodCustom`,(e,t)=>{B.init(e,t),V.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>yt(t,n,r,e));yt(i,n,r,e)}});function yt(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(we(e))}}function bt(e){return e.checks&&=[...e.checks],e}function xt(e,t){return new e(bt({type:`string`,...C(t)}))}function St(e,t){return new e(bt({type:`number`,checks:[],...C(t)}))}function W(e,t){return new Je({check:`min_length`,...C(t),minimum:e})}function Ct(e,t){return new Xe({check:`string_format`,format:`regex`,...C(t),pattern:e})}function wt(e,t,n){let r=C(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}let G=P(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);V.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){k(this,`with`,e)},parse(e,t){return Be(this,e,t,{callee:this.parse})},parseAsync(e,t){return Ve(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return He(this,e,t)},safeParseAsync(e,t){return We(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0})},clone(e,t){return _e(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),Tt=P(`ZodMiniString`,(e,t)=>{tt.init(e,t),G.init(e,t)});function K(e){return xt(Tt,e)}let Et=P(`ZodMiniNumber`,(e,t)=>{nt.init(e,t),G.init(e,t)});function Dt(e){return St(Et,e)}let Ot=P(`ZodMiniArray`,(e,t)=>{ot.init(e,t),G.init(e,t)});function kt(e,t){return new Ot({type:`array`,element:e,...C(t)})}let At=P(`ZodMiniObject`,(e,t)=>{ut.init(e,t),G.init(e,t),Ae(e,`shape`,e=>e._zod.def.shape,!1)});function q(e,t){let n={type:`object`,shape:e??{},...C(t)};return new At(n)}let jt=P(`ZodMiniUnion`,(e,t)=>{ft.init(e,t),G.init(e,t)});function Mt(e,t){return new jt({type:`union`,options:e,...C(t)})}let Nt=P(`ZodMiniRecord`,(e,t)=>{pt.init(e,t),G.init(e,t)});function Pt(e,t,n){return!t||!t._zod?new Nt({type:`record`,keyType:K(),valueType:e,...C(t)}):new Nt({type:`record`,keyType:e,valueType:t,...C(n)})}let Ft=P(`ZodMiniTransform`,(e,t)=>{mt.init(e,t),G.init(e,t)});function It(e){return new Ft({type:`transform`,transform:e})}let Lt=P(`ZodMiniOptional`,(e,t)=>{gt.init(e,t),G.init(e,t)});function J(e){return new Lt({type:`optional`,innerType:e})}let Rt=P(`ZodMiniPipe`,(e,t)=>{_t.init(e,t),G.init(e,t)});function zt(e,t){return new Rt({type:`pipe`,in:e,out:t})}let Bt=P(`ZodMiniCustom`,(e,t)=>{vt.init(e,t),G.init(e,t)});function Vt(e,t){return wt(Bt,e??(()=>!0),t)}function Ht(){return K().check(Ct(/^\\d+(\\.\\d+)?$/,`Invalid amount`))}function Ut(e){let{meta:t,opaque:n,request:r,...a}=e.challenge,o=n??(t===void 0?void 0:se(t)),s={challenge:{...a,...o!==void 0&&{opaque:o},request:se(r)},payload:e.payload,...e.source&&{source:e.source}},c=oe(JSON.stringify(s),{pad:!1,url:!0});return`${i.payment} ${c}`}function Wt(e){return e}function Gt(e,t){let{canHandleChallenge:n,context:r,createCredential:i}=t;return{...e,canHandleChallenge:n,context:r,createCredential:i}}function Kt(e,t){if(!Number.isInteger(t)||t<0)throw RangeError(`Decimals must be a non-negative integer.`);if(!/^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)$/.test(e))throw TypeError(`Value \\`${e}\\` is not a valid decimal number.`);let n=e.startsWith(`-`),[r=`0`,i=``]=(n?e.slice(1):e).split(`.`),a=i.slice(0,t).padEnd(t,`0`),o=BigInt(`${r||`0`}${a}`);return i.length>t&&i[t]>=`5`&&(o+=1n),n?-o:o}let qt=Mt([q({customer:J(K().check(W(1))),hooks:J(q({inputs:q({tax:q({calculation:K().check(W(1))})})})),metadata:J(Pt(K(),K())),receipt_email:J(K().check(W(1)))}),Vt(e=>typeof e==`function`)]),Jt=Wt({name:`stripe`,intent:`charge`,schema:{credential:{payload:q({externalId:J(K()),spt:K()})},request:zt(q({amount:Ht(),currency:K(),decimals:Dt(),description:J(K()),externalId:J(K()),metadata:J(Pt(K(),K())),networkId:K(),paymentIntentOptions:J(qt),paymentMethodTypes:kt(K()).check(W(1)),recipient:J(K())}),It(({amount:e,decimals:t,metadata:n,networkId:r,paymentIntentOptions:i,paymentMethodTypes:a,...o})=>({...o,amount:Kt(e,t).toString(),methodDetails:{networkId:r,paymentMethodTypes:a,...n!==void 0&&{metadata:n}}})))}});function Yt(e){let{client:t,createToken:n,externalId:r,paymentMethod:i}=e;return Gt(Jt,{context:q({paymentMethod:J(K())}),async createCredential({challenge:e,context:a}){let o=a?.paymentMethod??i;if(!o)throw Error(`paymentMethod is required (pass via context or parameters)`);let s=e.request.amount,c=e.request.currency,l=typeof e.request.externalId==`string`?e.request.externalId:void 0,u=e.request.methodDetails?.networkId;if(!u)throw Error(`networkId is required in challenge.methodDetails`);let d=e.request.methodDetails?.metadata;if(d?.externalId)throw Error(`methodDetails.metadata.externalId is reserved; use credential externalId instead`);let f=e.expires?Math.floor(new Date(e.expires).getTime()/1e3):Math.floor(Date.now()/1e3)+3600,p=await n({amount:s,challenge:e,client:t,currency:c,expiresAt:f,metadata:d,networkId:u,paymentMethod:o}),m=l??r;return Ut({challenge:e,payload:{spt:p,...m===void 0?{}:{externalId:m}}})}})}function Xt(e){return[Yt(e)]}(function(e){e.charge=Yt})(Xt||={});var Zt=r();let Y={data:`__MPPX_DATA__`,error:`root_error`,root:`root`},Qt={serviceWorker:`__mppx_worker`,tab:`__mppx_tab`},X={challengeId:`data-mppx-challenge-id`,remaining:`data-remaining`};var Z=class{name;constructor(e){this.name=`--mppx-${e}`}toString(){return`var(${this.name})`}};let $t={accent:new Z(`accent`),background:new Z(`background`),border:new Z(`border`),foreground:new Z(`foreground`),muted:new Z(`muted`),negative:new Z(`negative`),positive:new Z(`positive`),surface:new Z(`surface`),fontFamily:new Z(`font-family`),fontSizeBase:new Z(`font-size-base`),radius:new Z(`radius`),spacingUnit:new Z(`spacing-unit`)};String.raw`<style>\n *,\n ::after,\n ::before,\n ::backdrop,\n ::file-selector-button {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n border-color: ${$t.border};\n }\n html,\n :host {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n -webkit-tap-highlight-color: transparent;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n b,\n strong {\n font-weight: bolder;\n }\n code,\n kbd,\n samp,\n pre {\n font-family:\n ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',\n monospace;\n font-size: 1em;\n }\n small {\n font-size: 80%;\n }\n ol,\n ul,\n menu {\n list-style: none;\n }\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n vertical-align: middle;\n }\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n button,\n input,\n select,\n optgroup,\n textarea,\n ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n border-radius: 0;\n background-color: transparent;\n opacity: 1;\n }\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n ::placeholder {\n opacity: 1;\n }\n @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {\n ::placeholder {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n textarea {\n resize: vertical;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n :-moz-ui-invalid {\n box-shadow: none;\n }\n button,\n input:where([type='button'], [type='reset'], [type='submit']),\n ::file-selector-button {\n appearance: button;\n }\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n height: auto;\n }\n [hidden]:where(:not([hidden='until-found'])) {\n display: none !important;\n }\n</style>`;function en(e,t){if(t==null)return e;if(!Q(e)||!Q(t))return t??e;let n={...e};for(let[e,r]of Object.entries(t)){if(r==null||r===``)continue;let t=n[e];n[e]=Q(t)&&Q(r)?en(t,r):r}return n}function Q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function tn(e,t=`Authorization`){let n=new URL(location.href);n.searchParams.set(Qt.serviceWorker,``);let r=await navigator.serviceWorker.register(n.pathname+n.search),i=await new Promise(e=>{let t=r.installing??r.waiting??r.active;if(t?.state===`activated`)return e(t);let n=t??r;n.addEventListener(`statechange`,function t(){let i=r.active;i?.state===`activated`&&(n.removeEventListener(`statechange`,t),e(i))})});await new Promise(n=>{let r=new MessageChannel;r.port1.onmessage=()=>n(),i.postMessage({credential:e,header:t},[r.port2])}),location.reload()}_();function nn(e){let t=document.getElementById(Y.data),n=ee(t.textContent),r=t.getAttribute(X.remaining);!r||Number(r)<=1?t.remove():t.setAttribute(X.remaining,String(Number(r)-1));let i=document.currentScript,a=i?.getAttribute(X.challengeId),o=a?(i.removeAttribute(X.challengeId),n[a]):Object.values(n).find(t=>t.challenge.method===e);return{...o,error(e){if(!e){document.getElementById(Y.error)?.remove();return}let t=document.getElementById(Y.error);if(t){t.textContent=e;return}let n=document.createElement(`p`);n.id=Y.error,n.className=`mppx-error`,n.role=`alert`,n.textContent=e,document.getElementById(o.rootId)?.after(n)},root:document.getElementById(o.rootId),submit:e=>tn(e,o.challenge.header),vars:$t}}let $=nn(`stripe`),rn=String.raw,an=document.createElement(`style`);an.textContent=rn`\n form {\n display: flex;\n flex-direction: column;\n gap: calc(${$.vars.spacingUnit} * 8);\n }\n button {\n background: ${$.vars.accent};\n border-radius: ${$.vars.radius};\n color: ${$.vars.background};\n cursor: pointer;\n font-weight: 500;\n padding: calc(${$.vars.spacingUnit} * 4) calc(${$.vars.spacingUnit} * 8);\n width: 100%;\n }\n button:hover:not(:disabled) {\n opacity: 0.85;\n }\n button:disabled {\n cursor: default;\n opacity: 0.5;\n }\n`,$.root.append(an),(async()=>{let e=await(0,Zt.loadStripe)($.config.publishableKey);if(!e)throw Error(`Failed to loadStripe`);let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>{let e=(()=>{if($.config.elements?.options?.appearance?.theme)return $.config.elements?.options?.appearance?.theme;switch($.theme.colorScheme){case`light dark`:return t.matches?`night`:`stripe`;case`light`:return`stripe`;case`dark`:return`night`}})(),n=+!!t.matches;return en({disableAnimations:!0,theme:e,variables:{borderRadius:$.theme.radius,colorBackground:$.theme.surface[n],colorDanger:$.theme.negative[n],colorPrimary:$.theme.accent[n],colorText:$.theme.foreground[n],colorTextSecondary:$.theme.muted[n],fontSizeBase:$.theme.fontSizeBase,fontFamily:$.theme.fontFamily,spacingUnit:$.theme.spacingUnit}},$.config.elements?.options?.appearance??{})},r=e.elements({appearance:n(),...$.config.elements?.options,amount:Number($.challenge.request.amount),currency:$.challenge.request.currency,mode:`payment`,paymentMethodCreation:`manual`,paymentMethodTypes:$.challenge.request.methodDetails.paymentMethodTypes});t.addEventListener(`change`,()=>{r.update({appearance:n()})});let i=document.createElement(`form`);r.create(`payment`,$.config.elements?.paymentOptions).mount(i),$.root.appendChild(i);let a=document.createElement(`button`);a.textContent=$.text.pay,a.type=`submit`,i.appendChild(a),i.onsubmit=async t=>{t.preventDefault(),$.error(),a.disabled=!0;try{await r.submit();let{paymentMethod:t,error:n}=await e.createPaymentMethod({...$.config.elements?.createPaymentMethodOptions,elements:r});if(n||!t)throw n??Error(`Failed to create payment method`);let i=await Xt({client:e,createToken:on})[0].createCredential({challenge:$.challenge,context:{paymentMethod:t.id}});await $.submit(i)}catch(e){$.error(e instanceof Error?e.message:`Payment failed`)}finally{a.disabled=!1}}})();async function on(e){let t=new URL($.config.createTokenUrl,location.origin);if(t.origin!==location.origin)throw Error(`createTokenUrl must be same-origin`);let n=await fetch(t,{method:`POST`,headers:{\"Content-Type\":`application/json`},body:JSON.stringify(e)});if(!n.ok){let e=await n.text().catch(()=>`<response body unavailable>`);throw Error(`Failed to create SPT (${n.status}): ${e}`)}return(await n.json()).spt}})();</script>";
2
+ export const html = "<script>(function(){var e=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n=t((e=>{Object.defineProperty(e,\"__esModule\",{value:!0});function t(e){\"@babel/helpers - typeof\";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}var n=`dahlia`,r=function(e){return e===3?`v3`:e},i=`https://js.stripe.com`,a=`${i}/${n}/stripe.js`,o=/^https:\\/\\/js\\.stripe\\.com\\/v3\\/?(\\?.*)?$/,s=/^https:\\/\\/js\\.stripe\\.com\\/(v3|[a-z]+)\\/stripe\\.js(\\?.*)?$/,c=`loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used`,l=function(e){return o.test(e)||s.test(e)},u=function(){for(var e=document.querySelectorAll(`script[src^=\"${i}\"]`),t=0;t<e.length;t++){var n=e[t];if(l(n.src))return n}return null},d=function(e){var t=e&&!e.advancedFraudSignals?`?advancedFraudSignals=false`:``,n=document.createElement(`script`);n.src=`${a}${t}`;var r=document.head||document.body;if(!r)throw Error(`Expected document.body not to be null. Stripe.js requires a <body> element.`);return r.appendChild(n),n},f=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:`stripe-js`,version:`9.17.0`,startTime:t})},p=null,m=null,h=null,ee=function(e){return function(t){e(Error(`Failed to load Stripe.js`,{cause:t}))}},g=function(e,t){return function(){window.Stripe?e(window.Stripe):t(Error(`Stripe.js not available`))}},_=function(e){return p===null?(p=new Promise(function(t,n){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(c),window.Stripe){t(window.Stripe);return}try{var r=u();if(r&&e)console.warn(c);else if(!r)r=d(e);else if(r&&h!==null&&m!==null){var i;r.removeEventListener(`load`,h),r.removeEventListener(`error`,m),(i=r.parentNode)==null||i.removeChild(r),r=d(e)}h=g(t,n),m=ee(n),r.addEventListener(`load`,h),r.addEventListener(`error`,m)}catch(e){n(e);return}}),p.catch(function(e){return p=null,Promise.reject(e)})):p},te=function(e,i,a){if(e===null)return null;var o=i[0];if(typeof o!=`string`)throw Error(`Expected publishable key to be of type string, got type ${t(o)} instead.`);var s=o.match(/^pk_test/),c=r(e.version),l=n;s&&c!==l&&console.warn(`Stripe.js@${c} was loaded on the page, but @stripe/stripe-js@9.17.0 expected Stripe.js@${l}. This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning`);var u=e.apply(void 0,i);return f(u,a),u},v=function(e){var n=`invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ${JSON.stringify(e)}\n`;if(e===null||t(e)!==`object`)throw Error(n);if(Object.keys(e).length===1&&typeof e.advancedFraudSignals==`boolean`)return e;throw Error(n)},y,b=!1,x=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];b=!0;var r=Date.now();return _(y).then(function(e){return te(e,t,r)})};x.setLoadParameters=function(e){if(b&&y){var t=v(e);if(Object.keys(t).reduce(function(t,n){return t&&e[n]===y?.[n]},!0))return}if(b)throw Error(`You cannot change load parameters after calling loadStripe`);y=v(e)},e.loadStripe=x})),r=t(((e,t)=>{t.exports=n()}));let i={payment:`Payment`};var a,o=e((()=>{a=`0.1.1`}));function s(){return a}var c=e((()=>{o()}));function l(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause?l(e.cause,t):t?null:e}var u,d=e((()=>{c(),u=class e extends Error{static setStaticOptions(t){e.prototype.docsOrigin=t.docsOrigin,e.prototype.showVersion=t.showVersion,e.prototype.version=t.version}constructor(t,n={}){let r=(()=>{if(n.cause instanceof e){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&`details`in n.cause&&typeof n.cause.details==`string`?n.cause.details:n.cause?.message?n.cause.message:n.details})(),i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=n.docsOrigin??e.prototype.docsOrigin,o=`${a}${i??``}`,s=!!(n.version??e.prototype.showVersion),c=n.version??e.prototype.version,l=[t||`An error occurred.`,...n.metaMessages?[``,...n.metaMessages]:[],...r||i||s?[``,r?`Details: ${r}`:void 0,i?`See: ${o}`:void 0,s?`Version: ${c}`:void 0]:[]].filter(e=>typeof e==`string`).join(`\n`);super(l,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,\"details\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"docs\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"docsOrigin\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"docsPath\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"shortMessage\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"showVersion\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"version\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"cause\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsOrigin=a,this.docsPath=i,this.shortMessage=t,this.showVersion=s,this.version=c}walk(e){return l(this,e)}},Object.defineProperty(u,\"defaultStaticOptions\",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:`https://oxlib.sh`,showVersion:!1,version:`ox@${s()}`}}),u.setStaticOptions(u.defaultStaticOptions)}));function f(e,t){if(y(e)>t)throw new x({givenSize:y(e),maxSize:t})}function p(e,t={}){let{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new ne({size:e.length,targetSize:r,type:`Bytes`});let i=new Uint8Array(r);for(let t=0;t<r;t++){let a=n===`right`;i[a?t:r-t-1]=e[a?t:e.length-t-1]}return i}var m=e((()=>{re()}));function h(e){if(e===null||typeof e==`boolean`||typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`){if(!Number.isFinite(e))throw TypeError(`Cannot canonicalize non-finite number`);return Object.is(e,-0)?`0`:JSON.stringify(e)}if(typeof e==`bigint`)throw TypeError(`Cannot canonicalize bigint`);if(Array.isArray(e))return`[${e.map(e=>h(e)).join(`,`)}]`;if(typeof e==`object`)return`{${Object.keys(e).sort().reduce((t,n)=>{let r=e[n];return r!==void 0&&t.push(`${JSON.stringify(n)}:${h(r)}`),t},[]).join(`,`)}}`}function ee(e,t){return JSON.parse(e,(e,n)=>{let r=n;return typeof r==`string`&&r.endsWith(g)?BigInt(r.slice(0,-9)):typeof t==`function`?t(e,r):r})}var g,_=e((()=>{g=`#__bigint`}));function te(e,t={}){let{size:n}=t,r=b.encode(e);return typeof n==`number`?(f(r,n),v(r,n)):r}function v(e,t){return p(e,{dir:`right`,size:t})}function y(e){return e.length}var b,x,ne,re=e((()=>{d(),m(),_(),b=new TextEncoder,x=class extends u{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed \\`${t}\\` bytes. Given size: \\`${e}\\` bytes.`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Bytes.SizeOverflowError`})}},ne=class extends u{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\\`${e}\\`) exceeds padding size (\\`${t}\\`).`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Bytes.SizeExceedsPaddingSizeError`})}}}));re();let ie=new TextDecoder,S=Object.fromEntries(Array.from(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`).map((e,t)=>[t,e.charCodeAt(0)]));({...Object.fromEntries(Array.from(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`).map((e,t)=>[e.charCodeAt(0),t]))});function ae(e,t={}){let{pad:n=!0,url:r=!1}=t,i=new Uint8Array(Math.ceil(e.length/3)*4);for(let t=0,n=0;n<e.length;t+=4,n+=3){let r=(e[n]<<16)+(e[n+1]<<8)+(e[n+2]|0);i[t]=S[r>>18],i[t+1]=S[r>>12&63],i[t+2]=S[r>>6&63],i[t+3]=S[r&63]}let a=e.length%3,o=Math.floor(e.length/3)*4+(a&&a+1),s=ie.decode(new Uint8Array(i.buffer,0,o));return n&&a===1&&(s+=`==`),n&&a===2&&(s+=`=`),r&&(s=s.replaceAll(`+`,`-`).replaceAll(`/`,`_`)),s}function oe(e,t={}){return ae(te(e),t)}_();function se(e){return oe(h(e),{pad:!1,url:!0})}function ce(e,t){return typeof t==`bigint`?t.toString():t}var le=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 ue(e){return new le(e)}function de(e){return e==null}function fe(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function pe(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}let me=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function he(e){if(C(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return C(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ge(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function w(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error(\"Cannot specify both `message` and `error` params\");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function _e(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}function T(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ve(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function E(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function D(e){return typeof e==`string`?e:e?.message}function ye(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function O(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function k(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:D(e.inst?._zod.def?.error?.(e))??D(a?.(e))??D(t?.error?.(e))??D(n.customError?.(e))??D(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}let be=/[\\uD800-\\uDBFF]/;function xe(e){let t=e.length;if(!be.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Se(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ce(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function we(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ee(e,n,r.value)}}function A(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Te(e,t,n){return A(e,t,n,!1)}function Ee(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:A(this,t,n.bind(this))},set(e){A(this,t,e)}})}function De(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let j,M=!1,Oe={configurable:!0,get(){M=!0}};function N(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&j!==e._zod){j=void 0;return}j=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Oe);let e=M;M=!1;try{let r=n(this);return M?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),M||=e,r}catch(n){throw delete this[t],M||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function ke(e,t,n,r){let i=De(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Ae;let P={value:void 0,enumerable:!1},je=`captureStackTrace`in Error?Error:null;function Me(e){let t=je;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return je=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function F(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){P.value=new a(r);try{Object.defineProperty(n,\"_zod\",P)}finally{P.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),we(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,\"name\",{value:e});function d(e){let t=r?.Parent?Me(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,\"init\",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,\"name\",{value:e}),d}var I=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ne=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ae=globalThis).__zod_globalConfig??(Ae.__zod_globalConfig={});let L=globalThis.__zod_globalConfig;function R(e){return e&&Object.assign(L,e),L}function Pe(){let e=this._zod;return e.message??=JSON.stringify(e.def,ce,2),e.message}function Fe(e){this._zod.message=e}let Ie={get:Pe,set:Fe,enumerable:!0,configurable:!0},Le={value:void 0,enumerable:!1},Re=new WeakSet([Object.prototype,Error.prototype]),ze=(e,t)=>{e.name=`$ZodError`,Le.value=t,Object.defineProperty(e,\"issues\",Le),Le.value=void 0,Object.defineProperty(e,\"message\",Ie);let n=Object.getPrototypeOf(e);Re.has(n)||(Re.add(n),Object.defineProperty(n,\"toString\",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,\"toString\",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,\"toString\",{value:e,configurable:!0,writable:!0})}}))};F(`$ZodError`,ze);let z=F(`$ZodError`,ze,void 0,{Parent:Error}),Be=(e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new I;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>k(e,o,R())));throw me(n,a?.callee??t),n}return s.value};return t})(z),Ve=(e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>k(e,o,R())));throw me(n,a?.callee??t),n}return s.value};return t})(z),He=(e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new I;return a.issues.length?Ue(e,a.issues,i):{success:!0,data:a.value}})(z);function Ue(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>k(e,n,R()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}let We=(e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Ue(e,a.issues,i):{success:!0,data:a.value}})(z),Ge=/^[\\s\\S]{0,}$/,Ke=/^-?\\d+(?:\\.\\d+)?$/,qe=F(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Je=e=>{let t=e.value;return!de(t)&&t.length!==void 0},Ye=F(`$ZodCheckMinLength`,(e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=Je),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?xe(r):i)>=t.minimum)return;let a=Se(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Xe=F(`$ZodCheckStringFormat`,(e,t)=>{var n,r;qe.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ze=F(`$ZodCheckRegex`,(e,t)=>{Xe.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Qe={major:4,minor:6,patch:7},B=F(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Qe;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=T(t),a;for(let o of n){if(o._zod.def.when){if(ve(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new I;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(O(t.issues,n,e),i||=T(t,n))});else{if(t.issues.length===n)continue;O(t.issues,n,e),i||=T(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(T(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new I;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new I;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get\"~standard\"(){return Te(this,`~standard`,tt(this))},set\"~standard\"(e){A(this,`~standard`,e)}}),$e=(e,t)=>e.issues.length?{issues:e.issues.map(e=>k(e,t,R()))}:{value:e.value};async function et(e,t){let n={async:!0};return $e(await e._zod.run({value:t,issues:[]},n),n)}function tt(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return $e(r,n)}catch{}return et(e,t)},vendor:`zod`,version:1}}let nt=F(`$ZodString`,(e,t)=>{B.init(e,t),e._zod.pattern=t.pattern??Ge,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),rt=F(`$ZodNumber`,(e,t)=>{B.init(e,t),e._zod.pattern=Ke,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}});function it(e,t){let n=ye(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of ye(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,O(n.issues,t,e),n}}return i(n,a)}}let at=e=>Array.isArray(e)?e.length:-1;function ot(e,t,n){e.issues.length&&t.issues.push(...E(n,e.issues)),t.value[n]=e.value}let st=F(`$ZodArray`,(e,t)=>{B.init(e,t);let n=L.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>ot(t,r,e)));else if(ot(c,r,e),s&&c.issues.length!==0&&T(c))break}return o.length?Promise.all(o).then(()=>r):r},it(e,at)});function V(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...E(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}let ct=[];function lt(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ct,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key \"${String(t)}\": expected a Zod schema`);let a=_e(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function ut(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(T(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>V(e,n,i,t,d,f))):V(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}let dt=F(`$ZodObject`,(e,t)=>{B.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,\"shape\",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,\"shape\",{get:e})}let i=ue(()=>lt(t));N(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||pe(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=C,o=t.catchall,s,c=L.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(T(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>V(n,t,e,r,a,o))):V(s,t,e,r,a,o)}return o?ut(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}});function ft(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!T(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>k(e,r,R())))}),t)}let pt=F(`$ZodUnion`,(e,t)=>{B.init(e,t),N(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),N(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),N(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),N(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>fe(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>ft(t,r,e,i)):ft(o,r,e,i)}}),mt=F(`$ZodRecord`,(e,t)=>{B.init(e,t);let n=L.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!he(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>k(e,i,R())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...E(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...E(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Ke.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>k(e,i,R())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...E(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...E(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),ht=F(`$ZodTransform`,(e,t)=>{B.init(e,t),e._zod.optin=`optional`,L.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ne(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new I;return n.value=i,n}});function gt(e,t){return e.value=t.issues.length?void 0:t.value,e}let _t=F(`$ZodOptional`,(e,t)=>{B.init(e,t),N(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,N(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),N(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${fe(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>gt(e,t)):gt(e,r)}return t.innerType._zod.run(e,n)}}),vt=F(`$ZodPipe`,(e,t)=>{B.init(e,t),N(e,`values`,e=>e.def.in._zod.values),N(e,`optin`,e=>e.def.in._zod.optin),N(e,`optout`,e=>e.def.out._zod.optout),N(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>H(e,t.in,n)):H(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>H(e,t.out,n)):H(r,t.out,n)}});function H(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}let yt=F(`$ZodCustom`,(e,t)=>{qe.init(e,t),B.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>bt(t,n,r,e));bt(i,n,r,e)}});function bt(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ce(e))}}function xt(e){return e.checks&&=[...e.checks],e}function St(e,t){return new e(xt({type:`string`,...w(t)}))}function Ct(e,t){return new e(xt({type:`number`,checks:[],...w(t)}))}function U(e,t){return new Ye({check:`min_length`,...w(t),minimum:e})}function wt(e,t){return new Ze({check:`string_format`,format:`regex`,...w(t),pattern:e})}function Tt(e,t,n){let r=w(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}let W=F(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);B.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){A(this,`with`,e)},parse(e,t){return Be(this,e,t,{callee:this.parse})},parseAsync(e,t){return Ve(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return He(this,e,t)},safeParseAsync(e,t){return We(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0})},clone(e,t){return ge(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),Et=F(`ZodMiniString`,(e,t)=>{nt.init(e,t),W.init(e,t)});function G(e){return St(Et,e)}let Dt=F(`ZodMiniNumber`,(e,t)=>{rt.init(e,t),W.init(e,t)});function Ot(e){return Ct(Dt,e)}let kt=F(`ZodMiniArray`,(e,t)=>{st.init(e,t),W.init(e,t)});function At(e,t){return new kt({type:`array`,element:e,...w(t)})}let jt=F(`ZodMiniObject`,(e,t)=>{dt.init(e,t),W.init(e,t),ke(e,`shape`,e=>e._zod.def.shape,!1)});function K(e,t){let n={type:`object`,shape:e??{},...w(t)};return new jt(n)}let Mt=F(`ZodMiniUnion`,(e,t)=>{pt.init(e,t),W.init(e,t)});function Nt(e,t){return new Mt({type:`union`,options:e,...w(t)})}let Pt=F(`ZodMiniRecord`,(e,t)=>{mt.init(e,t),W.init(e,t)});function Ft(e,t,n){return!t||!t._zod?new Pt({type:`record`,keyType:G(),valueType:e,...w(t)}):new Pt({type:`record`,keyType:e,valueType:t,...w(n)})}let It=F(`ZodMiniTransform`,(e,t)=>{ht.init(e,t),W.init(e,t)});function Lt(e){return new It({type:`transform`,transform:e})}let Rt=F(`ZodMiniOptional`,(e,t)=>{_t.init(e,t),W.init(e,t)});function q(e){return new Rt({type:`optional`,innerType:e})}let zt=F(`ZodMiniPipe`,(e,t)=>{vt.init(e,t),W.init(e,t)});function Bt(e,t){return new zt({type:`pipe`,in:e,out:t})}let Vt=F(`ZodMiniCustom`,(e,t)=>{yt.init(e,t),W.init(e,t)});function Ht(e,t){return Tt(Vt,e??(()=>!0),t)}function Ut(){return G().check(wt(/^\\d+(\\.\\d+)?$/,`Invalid amount`))}function Wt(e){let{meta:t,opaque:n,request:r,...a}=e.challenge,o=n??(t===void 0?void 0:se(t)),s={challenge:{...a,...o!==void 0&&{opaque:o},request:se(r)},payload:e.payload,...e.source&&{source:e.source}},c=oe(JSON.stringify(s),{pad:!1,url:!0});return`${i.payment} ${c}`}function Gt(e){return e}function Kt(e,t){let{canHandleChallenge:n,context:r,createCredential:i}=t;return{...e,canHandleChallenge:n,context:r,createCredential:i}}function qt(e,t){if(!Number.isInteger(t)||t<0)throw RangeError(`Decimals must be a non-negative integer.`);if(!/^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)$/.test(e))throw TypeError(`Value \\`${e}\\` is not a valid decimal number.`);let n=e.startsWith(`-`),[r=`0`,i=``]=(n?e.slice(1):e).split(`.`),a=i.slice(0,t).padEnd(t,`0`),o=BigInt(`${r||`0`}${a}`);return i.length>t&&i[t]>=`5`&&(o+=1n),n?-o:o}let Jt=Nt([K({customer:q(G().check(U(1))),hooks:q(K({inputs:K({tax:K({calculation:G().check(U(1))})})})),metadata:q(Ft(G(),G())),receipt_email:q(G().check(U(1)))}),Ht(e=>typeof e==`function`)]),Yt=Gt({name:`stripe`,intent:`charge`,schema:{credential:{payload:K({externalId:q(G()),spt:G()})},request:Bt(K({amount:Ut(),currency:G(),decimals:Ot(),description:q(G()),externalId:q(G()),metadata:q(Ft(G(),G())),networkId:G(),paymentIntentOptions:q(Jt),paymentMethodTypes:At(G()).check(U(1)),recipient:q(G())}),Lt(({amount:e,decimals:t,metadata:n,networkId:r,paymentIntentOptions:i,paymentMethodTypes:a,...o})=>({...o,amount:qt(e,t).toString(),methodDetails:{networkId:r,paymentMethodTypes:a,...n!==void 0&&{metadata:n}}})))}});function Xt(e){let{client:t,createToken:n,externalId:r,paymentMethod:i}=e;return Kt(Yt,{context:K({paymentMethod:q(G())}),async createCredential({challenge:e,context:a}){let o=a?.paymentMethod??i;if(!o)throw Error(`paymentMethod is required (pass via context or parameters)`);let s=e.request.amount,c=e.request.currency,l=typeof e.request.externalId==`string`?e.request.externalId:void 0,u=e.request.methodDetails?.networkId;if(!u)throw Error(`networkId is required in challenge.methodDetails`);let d=e.request.methodDetails?.metadata;if(d?.externalId)throw Error(`methodDetails.metadata.externalId is reserved; use credential externalId instead`);let f=e.expires?Math.floor(new Date(e.expires).getTime()/1e3):Math.floor(Date.now()/1e3)+3600,p=await n({amount:s,challenge:e,client:t,currency:c,expiresAt:f,metadata:d,networkId:u,paymentMethod:o}),m=l??r;return Wt({challenge:e,payload:{spt:p,...m===void 0?{}:{externalId:m}}})}})}function Zt(e){return[Xt(e)]}(function(e){e.charge=Xt})(Zt||={});var Qt=r();let J={data:`__MPPX_DATA__`,error:`root_error`,root:`root`},$t={serviceWorker:`__mppx_worker`,tab:`__mppx_tab`},Y={challengeId:`data-mppx-challenge-id`,remaining:`data-remaining`};var X=class{name;constructor(e){this.name=`--mppx-${e}`}toString(){return`var(${this.name})`}};let en={accent:new X(`accent`),background:new X(`background`),border:new X(`border`),foreground:new X(`foreground`),muted:new X(`muted`),negative:new X(`negative`),positive:new X(`positive`),surface:new X(`surface`),fontFamily:new X(`font-family`),fontSizeBase:new X(`font-size-base`),radius:new X(`radius`),spacingUnit:new X(`spacing-unit`)};String.raw`<style>\n *,\n ::after,\n ::before,\n ::backdrop,\n ::file-selector-button {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n border-color: ${en.border};\n }\n html,\n :host {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n -webkit-tap-highlight-color: transparent;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n b,\n strong {\n font-weight: bolder;\n }\n code,\n kbd,\n samp,\n pre {\n font-family:\n ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',\n monospace;\n font-size: 1em;\n }\n small {\n font-size: 80%;\n }\n ol,\n ul,\n menu {\n list-style: none;\n }\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n vertical-align: middle;\n }\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n button,\n input,\n select,\n optgroup,\n textarea,\n ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n border-radius: 0;\n background-color: transparent;\n opacity: 1;\n }\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n ::placeholder {\n opacity: 1;\n }\n @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {\n ::placeholder {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n textarea {\n resize: vertical;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n :-moz-ui-invalid {\n box-shadow: none;\n }\n button,\n input:where([type='button'], [type='reset'], [type='submit']),\n ::file-selector-button {\n appearance: button;\n }\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n height: auto;\n }\n [hidden]:where(:not([hidden='until-found'])) {\n display: none !important;\n }\n</style>`;function tn(e,t){if(t==null)return e;if(!Z(e)||!Z(t))return t??e;let n={...e};for(let[e,r]of Object.entries(t)){if(r==null||r===``)continue;let t=n[e];n[e]=Z(t)&&Z(r)?tn(t,r):r}return n}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function nn(e,t=`Authorization`){let n=new URL(location.href);n.searchParams.set($t.serviceWorker,``);let r=await navigator.serviceWorker.register(n.pathname+n.search),i=await new Promise(e=>{let t=r.installing??r.waiting??r.active;if(t?.state===`activated`)return e(t);let n=t??r;n.addEventListener(`statechange`,function t(){let i=r.active;i?.state===`activated`&&(n.removeEventListener(`statechange`,t),e(i))})});await new Promise(n=>{let r=new MessageChannel;r.port1.onmessage=()=>n(),i.postMessage({credential:e,header:t},[r.port2])}),location.reload()}_();function rn(e){let t=document.getElementById(J.data),n=ee(t.textContent),r=t.getAttribute(Y.remaining);!r||Number(r)<=1?t.remove():t.setAttribute(Y.remaining,String(Number(r)-1));let i=document.currentScript,a=i?.getAttribute(Y.challengeId),o=a?(i.removeAttribute(Y.challengeId),n[a]):Object.values(n).find(t=>t.challenge.method===e);return{...o,error(e){if(!e){document.getElementById(J.error)?.remove();return}let t=document.getElementById(J.error);if(t){t.textContent=e;return}let n=document.createElement(`p`);n.id=J.error,n.className=`mppx-error`,n.role=`alert`,n.textContent=e,document.getElementById(o.rootId)?.after(n)},root:document.getElementById(o.rootId),submit:e=>nn(e,o.challenge.header),vars:en}}let Q=rn(`stripe`),$=Q.config.elements,an=String.raw,on=document.createElement(`style`);on.textContent=an`\n form {\n display: flex;\n flex-direction: column;\n gap: calc(${Q.vars.spacingUnit} * 8);\n }\n button {\n background: ${Q.vars.accent};\n border-radius: ${Q.vars.radius};\n color: ${Q.vars.background};\n cursor: pointer;\n font-weight: 500;\n padding: calc(${Q.vars.spacingUnit} * 4) calc(${Q.vars.spacingUnit} * 8);\n width: 100%;\n }\n button:hover:not(:disabled) {\n opacity: 0.85;\n }\n button:disabled {\n cursor: default;\n opacity: 0.5;\n }\n`,Q.root.append(on),(async()=>{let e=await(0,Qt.loadStripe)(Q.config.publishableKey);if(!e)throw Error(`Failed to loadStripe`);let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>{let e=(()=>{if($?.options?.appearance?.theme)return $?.options?.appearance?.theme;switch(Q.theme.colorScheme){case`light dark`:return t.matches?`night`:`stripe`;case`light`:return`stripe`;case`dark`:return`night`}})(),n=+!!t.matches;return tn({disableAnimations:!0,theme:e,variables:{borderRadius:Q.theme.radius,colorBackground:Q.theme.surface[n],colorDanger:Q.theme.negative[n],colorPrimary:Q.theme.accent[n],colorText:Q.theme.foreground[n],colorTextSecondary:Q.theme.muted[n],fontSizeBase:Q.theme.fontSizeBase,fontFamily:Q.theme.fontFamily,spacingUnit:Q.theme.spacingUnit}},$?.options?.appearance??{})},r=e.elements({appearance:n(),...$?.options,amount:Number(Q.challenge.request.amount),currency:Q.challenge.request.currency,mode:`payment`,paymentMethodCreation:`manual`,paymentMethodTypes:Q.challenge.request.methodDetails.paymentMethodTypes});t.addEventListener(`change`,()=>{r.update({appearance:n()})});let i=document.createElement(`form`);r.create(`payment`,$?.paymentOptions).mount(i),Q.root.appendChild(i);let a=document.createElement(`button`);a.textContent=Q.text.pay,a.type=`submit`,i.appendChild(a),i.onsubmit=async t=>{t.preventDefault(),Q.error(),a.disabled=!0;try{await r.submit();let{paymentMethod:t,error:n}=await e.createPaymentMethod({...$?.createPaymentMethodOptions,elements:r});if(n||!t)throw n??Error(`Failed to create payment method`);let i=await Zt({client:e,createToken:sn})[0].createCredential({challenge:Q.challenge,context:{paymentMethod:t.id}});await Q.submit(i)}catch(e){Q.error(e instanceof Error?e.message:`Payment failed`)}finally{a.disabled=!1}}})();async function sn(e){let t=new URL(Q.config.createTokenUrl,location.origin);if(t.origin!==location.origin)throw Error(`createTokenUrl must be same-origin`);let n=await fetch(t,{method:`POST`,headers:{\"Content-Type\":`application/json`},body:JSON.stringify(e)});if(!n.ok){let e=await n.text().catch(()=>`<response body unavailable>`);throw Error(`Failed to create SPT (${n.status}): ${e}`)}return(await n.json()).spt}})();</script>";
3
3
  //# sourceMappingURL=html.gen.js.map
@@ -21,6 +21,7 @@ export declare const validityWindowSeconds = 25;
21
21
  export type ChargeContext = {
22
22
  account?: Account.getResolver.Parameters['account'] | undefined;
23
23
  autoSwap?: AutoSwap.resolve.Value | undefined;
24
+ feeToken?: Address | undefined;
24
25
  mode?: Methods.ChargeMode | undefined;
25
26
  };
26
27
  /**
@@ -41,6 +42,7 @@ export declare function charge(parameters?: charge.Parameters): {
41
42
  readonly context?: z.ZodMiniObject<{
42
43
  account: z.ZodMiniOptional<z.ZodMiniCustom<`0x${string}` | Account.Account | undefined, `0x${string}` | Account.Account | undefined>>;
43
44
  autoSwap: z.ZodMiniOptional<z.ZodMiniCustom<AutoSwap.resolve.Value | undefined, AutoSwap.resolve.Value | undefined>>;
45
+ feeToken: z.ZodMiniOptional<z.ZodMiniCustom<`0x${string}` | undefined, `0x${string}` | undefined>>;
44
46
  mode: z.ZodMiniOptional<z.ZodMiniEnum<{
45
47
  pull: "pull";
46
48
  push: "push";
@@ -192,6 +194,7 @@ export declare function charge(parameters?: charge.Parameters): {
192
194
  }, {
193
195
  account?: `0x${string}` | Account.Account | undefined;
194
196
  autoSwap?: AutoSwap.resolve.Value | undefined;
197
+ feeToken?: `0x${string}` | undefined;
195
198
  mode?: "pull" | "push" | undefined;
196
199
  }>;
197
200
  };
@@ -210,6 +213,12 @@ export declare namespace charge {
210
213
  autoSwap?: AutoSwap | undefined;
211
214
  /** Client identifier used to derive the client fingerprint in attribution memos. */
212
215
  clientId?: string | undefined;
216
+ /**
217
+ * Token the payer pays its transaction fee in, when the challenge is not fee-sponsored.
218
+ * Set it for an access key whose spending limits do not cover the default fee token,
219
+ * such as a key limited to OUSD paying a USDC.e charge.
220
+ */
221
+ feeToken?: Address | undefined;
213
222
  /**
214
223
  * Chain ID this client is willing to pay on. When set, the client rejects
215
224
  * any challenge whose `methodDetails.chainId` differs, and signs on this
@@ -31,6 +31,7 @@ export const validityWindowSeconds = 25;
31
31
  const chargeContextSchema = z.object({
32
32
  account: z.optional(z.custom()),
33
33
  autoSwap: z.optional(z.custom()),
34
+ feeToken: z.optional(z.custom()),
34
35
  mode: z.optional(z.enum(Methods.chargeModes)),
35
36
  });
36
37
  /**
@@ -188,15 +189,18 @@ export function charge(parameters = {}) {
188
189
  }
189
190
  const calls = machineTokenRoute?.calls ?? [...(swapCalls ?? []), ...transferCalls];
190
191
  const allowedFeeTokens = defaultFeeTokens(chainId);
191
- const feeToken = machineTokenRoute || isMachineTokenCurrency
192
- ? await resolveFeeToken({
193
- account: account.address,
194
- allowedTokens: allowedFeeTokens,
195
- candidateTokens: allowedFeeTokens,
196
- client,
197
- prioritizeCandidates: true,
198
- })
199
- : undefined;
192
+ const explicitFeeToken = context?.feeToken ?? parameters.feeToken;
193
+ const feeToken = explicitFeeToken
194
+ ? explicitFeeToken
195
+ : machineTokenRoute || isMachineTokenCurrency
196
+ ? await resolveFeeToken({
197
+ account: account.address,
198
+ allowedTokens: allowedFeeTokens,
199
+ candidateTokens: allowedFeeTokens,
200
+ client,
201
+ prioritizeCandidates: true,
202
+ })
203
+ : undefined;
200
204
  const mode = (() => {
201
205
  const explicitMode = context?.mode ?? parameters.mode;
202
206
  if (explicitMode) {
@@ -24,6 +24,7 @@ export declare function tempo(parameters?: tempo.Parameters): readonly [{
24
24
  readonly context?: import("zod/mini").ZodMiniObject<{
25
25
  account: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniCustom<`0x${string}` | import("../../viem/Account.js").Account | undefined, `0x${string}` | import("../../viem/Account.js").Account | undefined>>;
26
26
  autoSwap: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniCustom<import("../internal/auto-swap.js").resolve.Value | undefined, import("../internal/auto-swap.js").resolve.Value | undefined>>;
27
+ feeToken: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniCustom<`0x${string}` | undefined, `0x${string}` | undefined>>;
27
28
  mode: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniEnum<{
28
29
  pull: "pull";
29
30
  push: "push";
@@ -175,6 +176,7 @@ export declare function tempo(parameters?: tempo.Parameters): readonly [{
175
176
  }, {
176
177
  account?: `0x${string}` | import("../../viem/Account.js").Account | undefined;
177
178
  autoSwap?: import("../internal/auto-swap.js").resolve.Value | undefined;
179
+ feeToken?: `0x${string}` | undefined;
178
180
  mode?: "pull" | "push" | undefined;
179
181
  }>;
180
182
  }, import("../../Method.js").Client<{
@@ -1,3 +1,4 @@
1
+ import { Signature } from 'ox';
1
2
  import { TempoAddress } from 'ox/tempo';
2
3
  import type { Hex } from 'viem';
3
4
  import type { Account } from 'viem';
@@ -67,50 +68,124 @@ export declare function fillHostedFeePayerTransaction(parameters: {
67
68
  transaction: SponsoredTransaction;
68
69
  }): Promise<{
69
70
  feePayer: `0x${string}`;
71
+ feePayerSignature: {
72
+ readonly r: bigint;
73
+ readonly s: bigint;
74
+ readonly yParity: number;
75
+ };
70
76
  feeToken: TempoAddress.Address;
71
77
  serializedTransaction: `0x${string}`;
72
78
  }>;
73
79
  /**
74
80
  * Returns a transaction shape suitable for pre-broadcast simulation.
75
81
  *
76
- * Sponsored transactions are first simulated as calls from the sender with no
77
- * fee fields or signatures. This checks call execution without requiring the
78
- * sender to hold the fee token; transferred value and call-level balances are
79
- * still checked by the RPC.
82
+ * Sponsored transactions are first simulated as calls from the sender, without
83
+ * signatures, fee payer or fee token, and with zero fee fields: Tempo nodes
84
+ * (v1.18+) skip the fee-token balance check for a zero-fee `eth_call`, so the
85
+ * sender's fee balance is irrelevant. The call keeps the transaction's exact
86
+ * gas limit and the fields that set its intrinsic gas (nonce, nonce key,
87
+ * validity window, key authorization, signature type), so it is the gas-bounded
88
+ * check at the broadcast limit: a transaction whose gas is too low fails here
89
+ * with out of gas instead of reverting onchain at the sponsor's expense.
90
+ * Transferred value and call-level balances are still checked by the RPC.
80
91
  */
81
92
  export declare function simulationTransaction(transaction: SponsoredTransaction, options: {
82
93
  feePayer: boolean;
83
94
  }): any;
84
95
  /**
85
96
  * Returns the final fee-sponsored transaction shape for pre-broadcast
86
- * simulation. RPC `eth_call` does not carry either transaction signature.
97
+ * simulation.
98
+ *
99
+ * Tempo nodes recover the fee payer of an `eth_call` only from
100
+ * `feePayerSignature`; a bare `feePayer` address is ignored and the sender is
101
+ * billed instead. Pass the sponsor's signature so the node charges the fee
102
+ * token to the sponsor, not to a sender that may not hold it. The sender's own
103
+ * signature is never sent.
87
104
  */
88
105
  export declare function sponsoredSimulationTransaction(transaction: SponsoredTransaction, options: {
89
106
  feePayer: TempoAddress.Address;
107
+ feePayerSignature?: Signature.Signature | undefined;
90
108
  feeToken?: TempoAddress.Address | undefined;
91
109
  }): any;
92
110
  /** A completed sponsorship envelope that can be simulated before signing or broadcast. */
93
111
  export type PreflightSponsorship = {
94
112
  feePayer: TempoAddress.Address;
113
+ /**
114
+ * The sponsor's signature over the final envelope. Hosted sponsors return it
115
+ * from `eth_fillTransaction`; local accounts are signed in `preflightSponsorship`.
116
+ */
117
+ feePayerSignature?: Signature.Signature | undefined;
95
118
  feeToken?: TempoAddress.Address | undefined;
96
119
  transaction: SponsoredTransaction;
97
120
  };
98
121
  /**
99
- * Runs execution-only sender and final-envelope simulations around sponsorship.
122
+ * Signs the fee-payer payload of a sponsored envelope with a local fee-payer
123
+ * account, the same payload `Transaction.serialize` signs before broadcast.
124
+ * Returns `undefined` when the envelope's fee payer cannot sign locally.
125
+ */
126
+ export declare function signFeePayerSimulation(transaction: SponsoredTransaction): Promise<Signature.Signature | undefined>;
127
+ /**
128
+ * Runs the sender and final-envelope simulations around sponsorship.
100
129
  *
101
- * First, it simulates the calls with the sender as `from`, omitting fee fields
102
- * and signatures so the sender's fee balance is irrelevant. Next, `complete`
103
- * resolves the sponsor and produces the co-signed transaction. Finally, it
104
- * simulates that transaction with its concrete fee payer and fee token.
130
+ * First, it simulates the sender's calls at the transaction's exact gas limit
131
+ * with zero fee fields (see {@link simulationTransaction}). This is the
132
+ * gas-bounded check at the broadcast limit, and needs no fee-token balance.
133
+ * Next, `complete` resolves the sponsor and produces the co-signed transaction.
134
+ * Finally, it simulates that transaction with its concrete fee payer, fee token
135
+ * and fee payer signature, so the node bills the sponsor rather than the sender
136
+ * and checks the sponsor's fee balance.
137
+ *
138
+ * A sponsored `eth_call` charges more gas than the mined transaction uses. A
139
+ * local fee payer therefore signs a simulation-only copy whose gas is raised by
140
+ * up to {@link sponsoredSimulationGasBuffer}, clamped so the copy stays within
141
+ * the same fee payer `policy` (`maxGas`, `maxTotalFee`) as the real
142
+ * transaction. The copy is never returned or broadcast. When the final
143
+ * simulation runs without the full buffer (hosted signatures cover the client's
144
+ * gas and cannot be padded, or the padding was clamped), a failure that is only
145
+ * out of gas is tolerated, since the sender simulation already bounded gas at
146
+ * the broadcast limit. Every other failure, such as an insufficient fee balance
147
+ * or a revert, is rethrown.
105
148
  *
106
149
  * `complete` runs only after sender-context execution succeeds, so a reverting
107
150
  * transaction never reaches a local signer or hosted fee-payer.
108
151
  */
109
152
  export declare function preflightSponsorship<sponsorship extends PreflightSponsorship>(parameters: {
110
153
  complete: () => Promise<sponsorship>;
154
+ /** The fee payer policy the completed transaction was checked against. */
155
+ policy?: Partial<Policy> | undefined;
111
156
  simulate: (request: Record<string, unknown>) => Promise<unknown>;
112
157
  transaction: SponsoredTransaction;
113
158
  }): Promise<sponsorship>;
159
+ /**
160
+ * Returns the gas limit of a local fee payer's simulation-only copy: the
161
+ * transaction's gas plus {@link sponsoredSimulationGasBuffer}, clamped to the
162
+ * fee payer policy's `maxGas` and to `maxTotalFee / maxFeePerGas`, so the
163
+ * signed copy never exceeds a cap the real transaction is held to.
164
+ */
165
+ export declare function sponsoredSimulationGas(transaction: Pick<SponsoredTransaction, 'chainId' | 'gas' | 'maxFeePerGas'>, policyOverrides?: Partial<Policy> | undefined): bigint;
166
+ /**
167
+ * Returns true when a simulation failed only because it ran out of gas.
168
+ *
169
+ * Tempo nodes report out of gas as `out of gas: …` (code -32003, shared with
170
+ * `insufficient fee token balance`) or `intrinsic gas too low` (code -32000),
171
+ * so this reads the node's own message rather than the code. Only the terminal
172
+ * RPC failure counts: the deepest `details` in the cause chain (viem's
173
+ * `RpcRequestError` carries the node's message there), or the deepest message
174
+ * when no error has details. Wrapper messages are ignored, the match is anchored
175
+ * to the start of the node's message, and an error carrying revert data is never
176
+ * treated as gas exhaustion, so a revert reason or wrapper text that merely
177
+ * mentions gas cannot hide another failure.
178
+ */
179
+ export declare function isOutOfGasError(error: unknown): boolean;
180
+ /**
181
+ * Extra gas a local fee payer signs into its simulation-only envelope. Tempo's sponsored
182
+ * `eth_call` charges more gas than the same transaction uses when mined (about 6,000 for a
183
+ * session top-up on v1.18.1), so simulating at the signed limit would reject transactions
184
+ * that succeed onchain. The padding is clamped to the fee payer policy; hosted signatures
185
+ * cover the client's gas and are simulated as signed. In both cases the gas bound at the
186
+ * broadcast limit comes from the sender simulation.
187
+ */
188
+ export declare const sponsoredSimulationGasBuffer = 10000n;
114
189
  /**
115
190
  * Validates an allowed fee-payer pattern. Returns the funding currency when the
116
191
  * calls are bound to the expected payment transfers.