@notabene/javascript-sdk 2.15.0-next.2 → 2.15.0-next.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.
- package/README.md +59 -0
- package/dist/cjs/notabene.cjs +1 -1
- package/dist/cjs/notabene.d.ts +508 -3
- package/dist/cjs/package.json +3 -5
- package/dist/esm/notabene.d.ts +508 -3
- package/dist/esm/notabene.js +9 -7
- package/dist/esm/package.json +3 -5
- package/dist/notabene.d.ts +508 -3
- package/dist/notabene.js +9 -7
- package/package.json +3 -5
- package/src/__tests__/notabene.test.ts +50 -0
- package/src/notabene.ts +10 -9
package/README.md
CHANGED
|
@@ -64,6 +64,10 @@ This library is the JavaScript SDK for loading the Notabene UX components in the
|
|
|
64
64
|
- [Only allow first party transactions](#only-allow-first-party-transactions)
|
|
65
65
|
- [Only VASP to VASP transactions](#only-vasp-to-vasp-transactions)
|
|
66
66
|
- [Only Self-hosted wallet transactions](#only-self-hosted-wallet-transactions)
|
|
67
|
+
- [Agent Section Layout](#agent-section-layout)
|
|
68
|
+
- [Section Options](#section-options)
|
|
69
|
+
- [Fallback Promotion](#fallback-promotion)
|
|
70
|
+
- [Legacy Behavior](#legacy-behavior)
|
|
67
71
|
- [Configuring ownership proofs](#configuring-ownership-proofs)
|
|
68
72
|
- [Supporting Micro Transactions (aka Satoshi tests)](#supporting-micro-transactions-aka-satoshi-tests)
|
|
69
73
|
- [Fallback Proof Options](#fallback-proof-options)
|
|
@@ -747,10 +751,16 @@ import Notabene, {
|
|
|
747
751
|
AgentType,
|
|
748
752
|
PersonType,
|
|
749
753
|
ProofTypes,
|
|
754
|
+
type SectionOption,
|
|
750
755
|
} from '@notabene/javascript-sdk';
|
|
751
756
|
|
|
752
757
|
const options: TransactionOptions = {
|
|
753
758
|
jurisdiction: "US", // Defaults to the jurisdiction associated with customer token
|
|
759
|
+
agentSections: { // Explicit control over agent selection layout
|
|
760
|
+
main: ['signature', 'screenshot', 'microtransfer'],
|
|
761
|
+
fallback: ['add-vasp', 'self-declaration'],
|
|
762
|
+
// When agentSections is set, proofs.fallbacks and vasps.addUnknown below are ignored
|
|
763
|
+
},
|
|
754
764
|
proofs: {
|
|
755
765
|
reuseProof: true, // Defaults true
|
|
756
766
|
microTransfer: {
|
|
@@ -893,6 +903,55 @@ const options: TransactionOptions = {
|
|
|
893
903
|
};
|
|
894
904
|
```
|
|
895
905
|
|
|
906
|
+
### Agent Section Layout
|
|
907
|
+
|
|
908
|
+
The `agentSections` option gives explicit control over which options appear in the main selection area vs. behind the "Can't find what you're looking for?" fallback toggle in the agent selection step.
|
|
909
|
+
|
|
910
|
+
```ts
|
|
911
|
+
const options: TransactionOptions = {
|
|
912
|
+
agentSections: {
|
|
913
|
+
main: ['signature', 'screenshot', 'microtransfer'],
|
|
914
|
+
fallback: ['add-vasp', 'self-declaration'],
|
|
915
|
+
},
|
|
916
|
+
};
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
When `agentSections` is provided, the following legacy fields are ignored:
|
|
920
|
+
- `proofs.fallbacks` — use `agentSections.fallback` instead
|
|
921
|
+
- `vasps.addUnknown` — include `'add-vasp'` in `agentSections` instead
|
|
922
|
+
|
|
923
|
+
Fields like `proofs.deminimis`, `proofs.microTransfer`, and `proofs.reuseProof` continue to work as before.
|
|
924
|
+
|
|
925
|
+
#### Section Options
|
|
926
|
+
|
|
927
|
+
| Option | Flow | Description |
|
|
928
|
+
|--------|------|-------------|
|
|
929
|
+
| `'signature'` | Self-hosted | Wallet connection for ownership proof via signature |
|
|
930
|
+
| `'self-declaration'` | Self-hosted | Self-declaration of wallet ownership (`ProofTypes.SelfDeclaration`) |
|
|
931
|
+
| `'screenshot'` | Self-hosted | Ownership proof via screenshot upload (`ProofTypes.Screenshot`) |
|
|
932
|
+
| `'microtransfer'` | Self-hosted | Ownership proof via micro-transfer (`ProofTypes.MicroTransfer`) |
|
|
933
|
+
| `'manual-signing'` | Self-hosted | Ownership proof via manual message signing (no `ProofTypes` equivalent) |
|
|
934
|
+
| `'add-vasp'` | Hosted | Manually add an unlisted exchange/VASP |
|
|
935
|
+
|
|
936
|
+
Options are automatically filtered by flow — e.g. `'add-vasp'` is ignored in the self-hosted tab, `'signature'` is ignored in the hosted tab. Including an option implicitly enables that capability (e.g. `'add-vasp'` enables VASP creation without needing `vasps.addUnknown`).
|
|
937
|
+
|
|
938
|
+
#### Fallback Promotion
|
|
939
|
+
|
|
940
|
+
When the main section has **no options** (either empty, omitted, or all filtered out for the current flow), fallback options are automatically promoted and shown inline instead of behind the toggle.
|
|
941
|
+
|
|
942
|
+
```ts
|
|
943
|
+
// Only fallback options — these get promoted to main since main is empty
|
|
944
|
+
const options: TransactionOptions = {
|
|
945
|
+
agentSections: {
|
|
946
|
+
fallback: ['self-declaration'],
|
|
947
|
+
},
|
|
948
|
+
};
|
|
949
|
+
```
|
|
950
|
+
|
|
951
|
+
#### Legacy Behavior
|
|
952
|
+
|
|
953
|
+
When `agentSections` is **not** provided, the existing behavior using `proofs.fallbacks` and `vasps.addUnknown` is preserved.
|
|
954
|
+
|
|
896
955
|
### Configuring ownership proofs
|
|
897
956
|
|
|
898
957
|
By default components support message signing proofs.
|
package/dist/cjs/notabene.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var qr=Object.defineProperty;var Yr=(e,n,d)=>n in e?qr(e,n,{enumerable:!0,configurable:!0,writable:!0,value:d}):e[n]=d;var Y=(e,n,d)=>Yr(e,typeof n!="symbol"?n+"":n,d);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var En=(e=>(e.PRIVATE="WALLET",e.VASP="VASP",e))(En||{}),we=(e=>(e.NATURAL="natural",e.LEGAL="legal",e.SELF="self",e))(we||{}),Tn=(e=>(e.EMPTY="empty",e.VERIFY="verify",e.PENDING="pending",e.VERIFIED="verified",e.BANNED="banned",e))(Tn||{}),Nn=(e=>(e.ALLOWED="allowed",e.PENDING="pending",e))(Nn||{}),An=(e=>(e.SMS="sms",e))(An||{}),Un=(e=>(e.PENDING="pending",e.APPROVED="approved",e.FAILED="failed",e.EXPIRED="expired",e.MAX_ATTEMPTS_REACHED="max_attempts_reached",e.UNREACHABLE="unreachable",e))(Un||{}),Mn=(e=>(e.ASSET="asset",e.DESTINATION="destination",e.COUNTERPARTY="counterparty",e.AGENT="agent",e))(Mn||{}),oe=(e=>(e.COMPLETE="complete",e.RESIZE="resize",e.RESULT="result",e.READY="ready",e.INVALID="invalid",e.ERROR="error",e.CANCEL="cancel",e.WARNING="warning",e.INFO="info",e))(oe||{}),kn=(e=>(e.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",e.WALLET_CONNECTION_FAILED="WALLET_CONNECTION_FAILED",e.WALLET_NOT_SUPPORTED="WALLET_NOT_SUPPORTED",e.TOKEN_INVALID="TOKEN_INVALID",e))(kn||{}),Cn=(e=>(e.WALLET_ADDRESS_NOT_CONNECTED="WALLET_ADDRESS_NOT_CONNECTED",e.WALLET_LOCKED="WALLET_LOCKED",e.WALLET_UNREACHABLE="WALLET_UNREACHABLE",e.JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE="JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE",e.IDV_UNAVAILABLE="IDV_UNAVAILABLE",e))(Cn||{}),Qt=(e=>(e.UPDATE="update",e.REQUEST_RESPONSE="requestResponse",e))(Qt||{}),Rn=(e=>(e.PENDING="pending",e.FAILED="rejected",e.FLAGGED="flagged",e.VERIFIED="verified",e))(Rn||{}),Ln=(e=>(e.SelfDeclaration="self-declaration",e.SIWE="siwe",e.SIWX="siwx",e.SOL_SIWX="sol-siwx",e.EIP191="eip-191",e.EIP712="eip-712",e.EIP1271="eip-1271",e.BIP137="bip-137",e.BIP322="bip-322",e.TIP191="tip-191",e.ED25519="ed25519",e.XRP_ED25519="xrp-ed25519",e.XLM_ED25519="xlm-ed25519",e.CIP8="cip-8",e.COSMOS="cosmos-ecdsa",e.MicroTransfer="microtransfer",e.Screenshot="screenshot",e.Connect="connect",e.CONCORDIUM="concordium",e))(Ln||{});class Qr{constructor(){Y(this,"listeners",new Map);Y(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(n){this.port=n,this.port.onmessage=this.handleMessage,this.port.start()}on(n,d){return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(d),()=>this.off(n,d)}off(n,d){const m=this.listeners.get(n);m&&(m.delete(d),m.size===0&&this.listeners.delete(n))}handleMessage(n){const d=n.data;if(typeof d=="object"&&d!==null&&"type"in d){const m=d.type,l=this.listeners.get(m);l&&l.forEach(s=>s(d))}}send(n){this.port&&this.port.postMessage(n)}}class Bn{constructor(n,d,m){Y(this,"_url");Y(this,"_value");Y(this,"_options");Y(this,"_errors",[]);Y(this,"iframe");Y(this,"eventManager");Y(this,"modal");this._url=n,this._value=d,this._options=m,this.eventManager=new Qr,this.on(oe.INVALID,l=>{l.type===oe.INVALID&&(this._errors=l.errors,this._value=l.value)}),this.on(oe.RESIZE,l=>{l.type===oe.RESIZE&&this.iframe&&(this.iframe.style.height=`${l.height}px`)})}get url(){return this._url}get value(){return this._value}get options(){return this._options}get errors(){return this._errors}open(){document.location.href=this.url}mount(n){const d=document.querySelector(n);if(!d)throw new Error(`parentID ${n} not found`);this.embed(d)}embed(n,d=!1){var m,l;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(d?"":"&embedded=true"),this.iframe.allow="web-share; clipboard-write; hid; bluetooth;",this.iframe.style.width="100%",this.iframe.style.height="0px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",this.iframe.scrolling="no",n.appendChild(this.iframe),window.addEventListener("message",s=>{var h,y;s.source===((h=this.iframe)==null?void 0:h.contentWindow)&&((y=this.eventManager)==null||y.setPort(s.ports[0]))}),(l=(m=this.iframe)==null?void 0:m.contentWindow)==null||l.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(n){this.eventManager.send(n)}on(n,d){return this.eventManager.on(n,d)}off(n,d){this.eventManager.off(n,d)}update(n,d){this._value=n,d&&(this._options=d),this.send({type:Qt.UPDATE,value:n,options:this._options})}completion(){return new Promise((n,d)=>{let m,l,s;function h(){m&&m(),l&&l(),s&&s()}m=this.on(oe.COMPLETE,y=>{n(y.response),h()}),l=this.on(oe.CANCEL,()=>{d(new Error("User cancelled")),h()}),s=this.on("error",y=>{d(new Error(y.message)),h()})})}async openModal(){this.modal&&this.closeModal(),this.modal=document.createElement("dialog"),this.modal.style.border="none",this.modal.style.backgroundColor="white",this.modal.style.maxWidth="100vw",this.modal.style.maxHeight="100vh",this.modal.style.width="600px",this.modal.style.height="600px",document.body.appendChild(this.modal),this.embed(this.modal,!0);const n=this.on(oe.CANCEL,()=>{this.closeModal()}),d=this.on(oe.COMPLETE,()=>{this.closeModal()});return this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion().finally(()=>{n(),d()})}closeModal(){var n;this.modal&&((n=this.modal)==null||n.close(),this.modal.remove(),this.modal=void 0)}async popup(){const n=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",l=>{var s;l.source===n&&(console.log("received message from popup",l.data),(s=this.eventManager)==null||s.setPort(l.ports[0]))});const d=this.on(oe.CANCEL,()=>{n==null||n.close()}),m=this.on(oe.COMPLETE,()=>{n==null||n.close()});return this.completion().finally(()=>{d(),m()})}}function xr(e){return Object.entries(e).map(([n,d])=>{if(d==null)return;const m=encodeURIComponent(n),l=encodeURIComponent(typeof d=="object"?JSON.stringify(d):String(d));return`${m}=${l}`}).filter(n=>n!==void 0).join("&")}function ei(e){const n=e.slice(1);return n?n.split("&").filter(Boolean).reduce((m,l)=>{const[s,h]=l.split("=");return s&&(m[decodeURIComponent(s)]=h?decodeURIComponent(h):""),m},{}):{}}new TextEncoder;const at=new TextDecoder;function ti(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const n=atob(e),d=new Uint8Array(n.length);for(let m=0;m<n.length;m++)d[m]=n.charCodeAt(m);return d}function ni(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:at.decode(e),{alphabet:"base64url"});let n=e;n instanceof Uint8Array&&(n=at.decode(n)),n=n.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return ti(n)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class Fn extends Error{constructor(d,m){var l;super(d,m);Y(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(l=Error.captureStackTrace)==null||l.call(Error,this,this.constructor)}}Y(Fn,"code","ERR_JOSE_GENERIC");class pe extends Fn{constructor(){super(...arguments);Y(this,"code","ERR_JWT_INVALID")}}Y(pe,"code","ERR_JWT_INVALID");function ri(e){return typeof e=="object"&&e!==null}const ii=e=>{if(!ri(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let n=e;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n};function ai(e){if(typeof e!="string")throw new pe("JWTs must use Compact JWS serialization, JWT must be a string");const{1:n,length:d}=e.split(".");if(d===5)throw new pe("Only JWTs using Compact JWS serialization can be decoded");if(d!==3)throw new pe("Invalid JWT");if(!n)throw new pe("JWTs must contain a payload");let m;try{m=ni(n)}catch{throw new pe("Failed to base64url decode the payload")}let l;try{l=JSON.parse(at.decode(m))}catch{throw new pe("Failed to parse the decoded payload as JSON")}if(!ii(l))throw new pe("Invalid JWT Claims Set");return l}var b=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Vn={},Gn={};Object.defineProperty(Gn,"__esModule",{value:!0});var ge={};Object.defineProperty(ge,"__esModule",{value:!0});ge.DocumentTypeCode=ge.TaxSchemeCode=ge.TaxCategoryCode=ge.UnitCode=void 0;var yn;(function(e){e.Kilogram="KGM",e.Gram="GRM",e.Milligram="MGM",e.Tonne="TNE",e.Liter="LTR",e.Milliliter="MLT",e.CubicMillimeter="MMQ",e.CubicCentimeter="CMQ",e.CubicDecimeter="DMQ",e.CubicMeter="MTQ",e.Millimeter="MMT",e.Centimeter="CMT",e.Decimeter="DMT",e.Meter="MTR",e.Kilometer="KMT",e.SquareMeter="MTK",e.Each="EA",e.Piece="PCE",e.NumberOfPairs="NPR",e.Second="SEC",e.Minute="MIN",e.Hour="HUR",e.Day="DAY",e.Week="WEE",e.Month="MON",e.Year="ANN",e.KilowattHour="KWH",e.NumberOfArticles="NAR"})(yn||(ge.UnitCode=yn={}));var $n;(function(e){e.StandardRate="S",e.ZeroRated="Z",e.ExemptFromTax="E",e.VATReverseCharge="AE",e.FreeExportItem="G",e.OutsideScopeOfTax="O",e.VATExemptIntraCommunity="K",e.CanaryIslandsIndirectTax="L",e.CeutaMelillaTax="M",e.HigherRate="H",e.LowerRate="AA",e.TransferredVAT="B",e.MixedTaxRate="A",e.ExemptForResale="AB",e.VATReverseChargeAlt="AC",e.VATExemptIntraCommunityAlt="AD",e.ExemptFromTaxDeprecated="C",e.ExemptArticle309="D"})($n||(ge.TaxCategoryCode=$n={}));var Sn;(function(e){e.ProfitTax="AAA",e.CorporateIncomeTax="AAB",e.PersonalIncomeTax="AAC",e.SocialSecurityTax="AAD",e.PropertyTax="AAE",e.InheritanceTax="AAF",e.GiftTax="AAG",e.CapitalGainsTax="AAH",e.WealthTax="AAI",e.StampDuty="AAJ",e.ConsumptionTax="CST",e.CustomsDuty="CUS",e.EnvironmentalTax="ENV",e.ExciseTax="EXC",e.ExportTax="EXP",e.FreightTax="FRT",e.GoodsAndServicesTax="GST",e.ImportTax="IMP",e.OtherTax="OTH",e.SalesTax="SAL",e.TurnoverTax="TOT",e.ValueAddedTax="VAT"})(Sn||(ge.TaxSchemeCode=Sn={}));var On;(function(e){e.Order="Order",e.OrderResponse="OrderResponse",e.OrderChange="OrderChange",e.OrderCancellation="OrderCancellation",e.Quotation="Quotation",e.DespatchAdvice="DespatchAdvice",e.ReceiptAdvice="ReceiptAdvice",e.Invoice="Invoice",e.CreditNote="CreditNote",e.DebitNote="DebitNote",e.SelfBilledInvoice="SelfBilledInvoice",e.RemittanceAdvice="RemittanceAdvice",e.Statement="Statement",e.CertificateOfOrigin="CertificateOfOrigin",e.Contract="Contract",e.Timesheet="Timesheet",e.Waybill="Waybill",e.Manifest="Manifest"})(On||(ge.DocumentTypeCode=On={}));var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});var Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.normalizeForHashing=Kn;Xe.generateNameHash=ci;function Kn(e){return e.replace(/\s+/g,"").toUpperCase()}function Xn(e){if(!e.name||e.name.length===0)return"";const d=e.name.find(l=>"nameIdentifierType"in l&&l.nameIdentifierType==="LEGL"||"naturalPersonNameIdentifierType"in l&&l.naturalPersonNameIdentifierType==="LEGL")||e.name[0],m=[];return d.secondaryIdentifier&&m.push(d.secondaryIdentifier),m.push(d.primaryIdentifier),m.join(" ")}function Hn(e){return!e.name||e.name.length===0?"":(e.name.find(m=>m.legalPersonNameIdentifierType==="LEGL")||e.name[0]).legalPersonName}function oi(e){return("originatorPersons"in e?e.originatorPersons:e.originatorPerson).map(d=>d.naturalPerson?Xn(d.naturalPerson):d.legalPerson?Hn(d.legalPerson):"").filter(d=>d.length>0)}function ui(e){return("beneficiaryPersons"in e?e.beneficiaryPersons:e.beneficiaryPerson).map(d=>d.naturalPerson?Xn(d.naturalPerson):d.legalPerson?Hn(d.legalPerson):"").filter(d=>d.length>0)}async function ci(e){let n;if(typeof e=="string")n=e;else if("originatorPersons"in e||"originatorPerson"in e)n=oi(e).join(" ");else if("beneficiaryPersons"in e||"beneficiaryPerson"in e)n=ui(e).join(" ");else throw new Error("Invalid input type. Expected string, IVMS101 Originator, or IVMS101 Beneficiary");const d=Kn(n),l=new TextEncoder().encode(d);let s;if(typeof globalThis<"u"&&"crypto"in globalThis&&globalThis.crypto&&"subtle"in globalThis.crypto)s=await globalThis.crypto.subtle.digest("SHA-256",l);else try{const i=(await new Function("specifier","return import(specifier)")("crypto")).createHash("sha256").update(l).digest();s=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}catch{throw new Error("No crypto implementation available. This environment does not support Web Crypto API or Node.js crypto module.")}return Array.from(new Uint8Array(s)).map(h=>h.toString(16).padStart(2,"0")).join("")}var qn={},Yn={},ot={},te={},De={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.globalConfig=e.$ZodEncodeError=e.$ZodAsyncError=e.$brand=e.NEVER=void 0,e.$constructor=n,e.config=l,e.NEVER=Object.freeze({status:"aborted"});function n(s,h,y){function i(t,a){var f;Object.defineProperty(t,"_zod",{value:t._zod??{},enumerable:!1}),(f=t._zod).traits??(f.traits=new Set),t._zod.traits.add(s),h(t,a);for(const I in u.prototype)I in t||Object.defineProperty(t,I,{value:u.prototype[I].bind(t)});t._zod.constr=u,t._zod.def=a}const r=(y==null?void 0:y.Parent)??Object;class o extends r{}Object.defineProperty(o,"name",{value:s});function u(t){var a;const f=y!=null&&y.Parent?new o:this;i(f,t),(a=f._zod).deferred??(a.deferred=[]);for(const I of f._zod.deferred)I();return f}return Object.defineProperty(u,"init",{value:i}),Object.defineProperty(u,Symbol.hasInstance,{value:t=>{var a,f;return y!=null&&y.Parent&&t instanceof y.Parent?!0:(f=(a=t==null?void 0:t._zod)==null?void 0:a.traits)==null?void 0:f.has(s)}}),Object.defineProperty(u,"name",{value:s}),u}e.$brand=Symbol("zod_brand");class d extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}e.$ZodAsyncError=d;class m extends Error{constructor(h){super(`Encountered unidirectional transform during encode: ${h}`),this.name="ZodEncodeError"}}e.$ZodEncodeError=m,e.globalConfig={};function l(s){return s&&Object.assign(e.globalConfig,s),e.globalConfig}})(De);var xt={},ce={},Z={};Object.defineProperty(Z,"__esModule",{value:!0});Z.Class=Z.BIGINT_FORMAT_RANGES=Z.NUMBER_FORMAT_RANGES=Z.primitiveTypes=Z.propertyKeyTypes=Z.getParsedType=Z.allowsEval=Z.captureStackTrace=void 0;Z.assertEqual=li;Z.assertNotEqual=di;Z.assertIs=si;Z.assertNever=fi;Z.assert=mi;Z.getEnumValues=gi;Z.joinValues=vi;Z.jsonStringifyReplacer=_i;Z.cached=Qn;Z.nullish=bi;Z.cleanRegex=hi;Z.floatSafeRemainder=pi;Z.defineLazy=yi;Z.objectClone=$i;Z.assignProp=ye;Z.mergeDefs=$e;Z.cloneDef=Si;Z.getElementAtPath=Oi;Z.promiseAllObject=ji;Z.randomString=Pi;Z.esc=Ii;Z.isObject=ut;Z.isPlainObject=He;Z.shallowClone=zi;Z.numKeys=wi;Z.escapeRegex=Di;Z.clone=Se;Z.normalizeParams=Ei;Z.createTransparentProxy=Ti;Z.stringifyPrimitive=xn;Z.optionalKeys=Ni;Z.pick=Ai;Z.omit=Ui;Z.extend=Mi;Z.safeExtend=ki;Z.merge=Ci;Z.partial=Ri;Z.required=Li;Z.aborted=Bi;Z.prefixIssues=Fi;Z.unwrapMessage=Ee;Z.finalizeIssue=Vi;Z.getSizableOrigin=Gi;Z.getLengthableOrigin=Ji;Z.issue=Wi;Z.cleanEnum=Ki;Z.base64ToUint8Array=er;Z.uint8ArrayToBase64=tr;Z.base64urlToUint8Array=Xi;Z.uint8ArrayToBase64url=Hi;Z.hexToUint8Array=qi;Z.uint8ArrayToHex=Yi;function li(e){return e}function di(e){return e}function si(e){}function fi(e){throw new Error}function mi(e){}function gi(e){const n=Object.values(e).filter(m=>typeof m=="number");return Object.entries(e).filter(([m,l])=>n.indexOf(+m)===-1).map(([m,l])=>l)}function vi(e,n="|"){return e.map(d=>xn(d)).join(n)}function _i(e,n){return typeof n=="bigint"?n.toString():n}function Qn(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function bi(e){return e==null}function hi(e){const n=e.startsWith("^")?1:0,d=e.endsWith("$")?e.length-1:e.length;return e.slice(n,d)}function pi(e,n){const d=(e.toString().split(".")[1]||"").length,m=n.toString();let l=(m.split(".")[1]||"").length;if(l===0&&/\d?e-\d?/.test(m)){const i=m.match(/\d?e-(\d?)/);i!=null&&i[1]&&(l=Number.parseInt(i[1]))}const s=d>l?d:l,h=Number.parseInt(e.toFixed(s).replace(".","")),y=Number.parseInt(n.toFixed(s).replace(".",""));return h%y/10**s}const jn=Symbol("evaluating");function yi(e,n,d){let m;Object.defineProperty(e,n,{get(){if(m!==jn)return m===void 0&&(m=jn,m=d()),m},set(l){Object.defineProperty(e,n,{value:l})},configurable:!0})}function $i(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ye(e,n,d){Object.defineProperty(e,n,{value:d,writable:!0,enumerable:!0,configurable:!0})}function $e(...e){const n={};for(const d of e){const m=Object.getOwnPropertyDescriptors(d);Object.assign(n,m)}return Object.defineProperties({},n)}function Si(e){return $e(e._zod.def)}function Oi(e,n){return n?n.reduce((d,m)=>d==null?void 0:d[m],e):e}function ji(e){const n=Object.keys(e),d=n.map(m=>e[m]);return Promise.all(d).then(m=>{const l={};for(let s=0;s<n.length;s++)l[n[s]]=m[s];return l})}function Pi(e=10){const n="abcdefghijklmnopqrstuvwxyz";let d="";for(let m=0;m<e;m++)d+=n[Math.floor(Math.random()*n.length)];return d}function Ii(e){return JSON.stringify(e)}Z.captureStackTrace="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ut(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Z.allowsEval=Qn(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function He(e){if(ut(e)===!1)return!1;const n=e.constructor;if(n===void 0)return!0;const d=n.prototype;return!(ut(d)===!1||Object.prototype.hasOwnProperty.call(d,"isPrototypeOf")===!1)}function zi(e){return He(e)?{...e}:Array.isArray(e)?[...e]:e}function wi(e){let n=0;for(const d in e)Object.prototype.hasOwnProperty.call(e,d)&&n++;return n}const Zi=e=>{const n=typeof e;switch(n){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${n}`)}};Z.getParsedType=Zi;Z.propertyKeyTypes=new Set(["string","number","symbol"]);Z.primitiveTypes=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Di(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Se(e,n,d){const m=new e._zod.constr(n??e._zod.def);return(!n||d!=null&&d.parent)&&(m._zod.parent=e),m}function Ei(e){const n=e;if(!n)return{};if(typeof n=="string")return{error:()=>n};if((n==null?void 0:n.message)!==void 0){if((n==null?void 0:n.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,typeof n.error=="string"?{...n,error:()=>n.error}:n}function Ti(e){let n;return new Proxy({},{get(d,m,l){return n??(n=e()),Reflect.get(n,m,l)},set(d,m,l,s){return n??(n=e()),Reflect.set(n,m,l,s)},has(d,m){return n??(n=e()),Reflect.has(n,m)},deleteProperty(d,m){return n??(n=e()),Reflect.deleteProperty(n,m)},ownKeys(d){return n??(n=e()),Reflect.ownKeys(n)},getOwnPropertyDescriptor(d,m){return n??(n=e()),Reflect.getOwnPropertyDescriptor(n,m)},defineProperty(d,m,l){return n??(n=e()),Reflect.defineProperty(n,m,l)}})}function xn(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ni(e){return Object.keys(e).filter(n=>e[n]._zod.optin==="optional"&&e[n]._zod.optout==="optional")}Z.NUMBER_FORMAT_RANGES={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};Z.BIGINT_FORMAT_RANGES={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ai(e,n){const d=e._zod.def,m=$e(e._zod.def,{get shape(){const l={};for(const s in n){if(!(s in d.shape))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(l[s]=d.shape[s])}return ye(this,"shape",l),l},checks:[]});return Se(e,m)}function Ui(e,n){const d=e._zod.def,m=$e(e._zod.def,{get shape(){const l={...e._zod.def.shape};for(const s in n){if(!(s in d.shape))throw new Error(`Unrecognized key: "${s}"`);n[s]&&delete l[s]}return ye(this,"shape",l),l},checks:[]});return Se(e,m)}function Mi(e,n){if(!He(n))throw new Error("Invalid input to extend: expected a plain object");const d=e._zod.def.checks;if(d&&d.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const l=$e(e._zod.def,{get shape(){const s={...e._zod.def.shape,...n};return ye(this,"shape",s),s},checks:[]});return Se(e,l)}function ki(e,n){if(!He(n))throw new Error("Invalid input to safeExtend: expected a plain object");const d={...e._zod.def,get shape(){const m={...e._zod.def.shape,...n};return ye(this,"shape",m),m},checks:e._zod.def.checks};return Se(e,d)}function Ci(e,n){const d=$e(e._zod.def,{get shape(){const m={...e._zod.def.shape,...n._zod.def.shape};return ye(this,"shape",m),m},get catchall(){return n._zod.def.catchall},checks:[]});return Se(e,d)}function Ri(e,n,d){const m=$e(n._zod.def,{get shape(){const l=n._zod.def.shape,s={...l};if(d)for(const h in d){if(!(h in l))throw new Error(`Unrecognized key: "${h}"`);d[h]&&(s[h]=e?new e({type:"optional",innerType:l[h]}):l[h])}else for(const h in l)s[h]=e?new e({type:"optional",innerType:l[h]}):l[h];return ye(this,"shape",s),s},checks:[]});return Se(n,m)}function Li(e,n,d){const m=$e(n._zod.def,{get shape(){const l=n._zod.def.shape,s={...l};if(d)for(const h in d){if(!(h in s))throw new Error(`Unrecognized key: "${h}"`);d[h]&&(s[h]=new e({type:"nonoptional",innerType:l[h]}))}else for(const h in l)s[h]=new e({type:"nonoptional",innerType:l[h]});return ye(this,"shape",s),s},checks:[]});return Se(n,m)}function Bi(e,n=0){var d;if(e.aborted===!0)return!0;for(let m=n;m<e.issues.length;m++)if(((d=e.issues[m])==null?void 0:d.continue)!==!0)return!0;return!1}function Fi(e,n){return n.map(d=>{var m;return(m=d).path??(m.path=[]),d.path.unshift(e),d})}function Ee(e){return typeof e=="string"?e:e==null?void 0:e.message}function Vi(e,n,d){var l,s,h,y,i,r;const m={...e,path:e.path??[]};if(!e.message){const o=Ee((h=(s=(l=e.inst)==null?void 0:l._zod.def)==null?void 0:s.error)==null?void 0:h.call(s,e))??Ee((y=n==null?void 0:n.error)==null?void 0:y.call(n,e))??Ee((i=d.customError)==null?void 0:i.call(d,e))??Ee((r=d.localeError)==null?void 0:r.call(d,e))??"Invalid input";m.message=o}return delete m.inst,delete m.continue,n!=null&&n.reportInput||delete m.input,m}function Gi(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ji(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Wi(...e){const[n,d,m]=e;return typeof n=="string"?{message:n,code:"custom",input:d,inst:m}:{...n}}function Ki(e){return Object.entries(e).filter(([n,d])=>Number.isNaN(Number.parseInt(n,10))).map(n=>n[1])}function er(e){const n=atob(e),d=new Uint8Array(n.length);for(let m=0;m<n.length;m++)d[m]=n.charCodeAt(m);return d}function tr(e){let n="";for(let d=0;d<e.length;d++)n+=String.fromCharCode(e[d]);return btoa(n)}function Xi(e){const n=e.replace(/-/g,"+").replace(/_/g,"/"),d="=".repeat((4-n.length%4)%4);return er(n+d)}function Hi(e){return tr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function qi(e){const n=e.replace(/^0x/,"");if(n.length%2!==0)throw new Error("Invalid hex string length");const d=new Uint8Array(n.length/2);for(let m=0;m<n.length;m+=2)d[m/2]=Number.parseInt(n.slice(m,m+2),16);return d}function Yi(e){return Array.from(e).map(n=>n.toString(16).padStart(2,"0")).join("")}class Qi{constructor(...n){}}Z.Class=Qi;var xi=b&&b.__createBinding||(Object.create?function(e,n,d,m){m===void 0&&(m=d);var l=Object.getOwnPropertyDescriptor(n,d);(!l||("get"in l?!n.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return n[d]}}),Object.defineProperty(e,m,l)}:function(e,n,d,m){m===void 0&&(m=d),e[m]=n[d]}),ea=b&&b.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),ta=b&&b.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var d in e)d!=="default"&&Object.prototype.hasOwnProperty.call(e,d)&&xi(n,e,d);return ea(n,e),n};Object.defineProperty(ce,"__esModule",{value:!0});ce.$ZodRealError=ce.$ZodError=void 0;ce.flattenError=ra;ce.formatError=ia;ce.treeifyError=aa;ce.toDotPath=ir;ce.prettifyError=oa;const nr=De,na=ta(Z),rr=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,na.jsonStringifyReplacer,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})};ce.$ZodError=(0,nr.$constructor)("$ZodError",rr);ce.$ZodRealError=(0,nr.$constructor)("$ZodError",rr,{Parent:Error});function ra(e,n=d=>d.message){const d={},m=[];for(const l of e.issues)l.path.length>0?(d[l.path[0]]=d[l.path[0]]||[],d[l.path[0]].push(n(l))):m.push(n(l));return{formErrors:m,fieldErrors:d}}function ia(e,n=d=>d.message){const d={_errors:[]},m=l=>{for(const s of l.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(h=>m({issues:h}));else if(s.code==="invalid_key")m({issues:s.issues});else if(s.code==="invalid_element")m({issues:s.issues});else if(s.path.length===0)d._errors.push(n(s));else{let h=d,y=0;for(;y<s.path.length;){const i=s.path[y];y===s.path.length-1?(h[i]=h[i]||{_errors:[]},h[i]._errors.push(n(s))):h[i]=h[i]||{_errors:[]},h=h[i],y++}}};return m(e),d}function aa(e,n=d=>d.message){const d={errors:[]},m=(l,s=[])=>{var h,y;for(const i of l.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(r=>m({issues:r},i.path));else if(i.code==="invalid_key")m({issues:i.issues},i.path);else if(i.code==="invalid_element")m({issues:i.issues},i.path);else{const r=[...s,...i.path];if(r.length===0){d.errors.push(n(i));continue}let o=d,u=0;for(;u<r.length;){const t=r[u],a=u===r.length-1;typeof t=="string"?(o.properties??(o.properties={}),(h=o.properties)[t]??(h[t]={errors:[]}),o=o.properties[t]):(o.items??(o.items=[]),(y=o.items)[t]??(y[t]={errors:[]}),o=o.items[t]),a&&o.errors.push(n(i)),u++}}};return m(e),d}function ir(e){const n=[],d=e.map(m=>typeof m=="object"?m.key:m);for(const m of d)typeof m=="number"?n.push(`[${m}]`):typeof m=="symbol"?n.push(`[${JSON.stringify(String(m))}]`):/[^\w$]/.test(m)?n.push(`[${JSON.stringify(m)}]`):(n.length&&n.push("."),n.push(m));return n.join("")}function oa(e){var m;const n=[],d=[...e.issues].sort((l,s)=>(l.path??[]).length-(s.path??[]).length);for(const l of d)n.push(`✖ ${l.message}`),(m=l.path)!=null&&m.length&&n.push(` → at ${ir(l.path)}`);return n.join(`
|
|
1
|
+
"use strict";var qr=Object.defineProperty;var Yr=(e,n,d)=>n in e?qr(e,n,{enumerable:!0,configurable:!0,writable:!0,value:d}):e[n]=d;var Y=(e,n,d)=>Yr(e,typeof n!="symbol"?n+"":n,d);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var En=(e=>(e.PRIVATE="WALLET",e.VASP="VASP",e))(En||{}),we=(e=>(e.NATURAL="natural",e.LEGAL="legal",e.SELF="self",e))(we||{}),Tn=(e=>(e.EMPTY="empty",e.VERIFY="verify",e.PENDING="pending",e.VERIFIED="verified",e.BANNED="banned",e))(Tn||{}),Nn=(e=>(e.ALLOWED="allowed",e.PENDING="pending",e))(Nn||{}),An=(e=>(e.SMS="sms",e))(An||{}),Un=(e=>(e.PENDING="pending",e.APPROVED="approved",e.FAILED="failed",e.EXPIRED="expired",e.MAX_ATTEMPTS_REACHED="max_attempts_reached",e.UNREACHABLE="unreachable",e))(Un||{}),Mn=(e=>(e.ASSET="asset",e.DESTINATION="destination",e.COUNTERPARTY="counterparty",e.AGENT="agent",e))(Mn||{}),oe=(e=>(e.COMPLETE="complete",e.RESIZE="resize",e.RESULT="result",e.READY="ready",e.INVALID="invalid",e.ERROR="error",e.CANCEL="cancel",e.WARNING="warning",e.INFO="info",e))(oe||{}),kn=(e=>(e.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",e.WALLET_CONNECTION_FAILED="WALLET_CONNECTION_FAILED",e.WALLET_NOT_SUPPORTED="WALLET_NOT_SUPPORTED",e.TOKEN_INVALID="TOKEN_INVALID",e))(kn||{}),Cn=(e=>(e.WALLET_ADDRESS_NOT_CONNECTED="WALLET_ADDRESS_NOT_CONNECTED",e.WALLET_LOCKED="WALLET_LOCKED",e.WALLET_UNREACHABLE="WALLET_UNREACHABLE",e.JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE="JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE",e.IDV_UNAVAILABLE="IDV_UNAVAILABLE",e))(Cn||{}),Qt=(e=>(e.UPDATE="update",e.REQUEST_RESPONSE="requestResponse",e))(Qt||{}),Rn=(e=>(e.PENDING="pending",e.FAILED="rejected",e.FLAGGED="flagged",e.VERIFIED="verified",e))(Rn||{}),Ln=(e=>(e.SelfDeclaration="self-declaration",e.SIWE="siwe",e.SIWX="siwx",e.SOL_SIWX="sol-siwx",e.EIP191="eip-191",e.EIP712="eip-712",e.EIP1271="eip-1271",e.BIP137="bip-137",e.BIP322="bip-322",e.TIP191="tip-191",e.ED25519="ed25519",e.XRP_ED25519="xrp-ed25519",e.XLM_ED25519="xlm-ed25519",e.CIP8="cip-8",e.COSMOS="cosmos-ecdsa",e.MicroTransfer="microtransfer",e.Screenshot="screenshot",e.Connect="connect",e.CONCORDIUM="concordium",e))(Ln||{});class Qr{constructor(){Y(this,"listeners",new Map);Y(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(n){this.port=n,this.port.onmessage=this.handleMessage,this.port.start()}on(n,d){return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(d),()=>this.off(n,d)}off(n,d){const m=this.listeners.get(n);m&&(m.delete(d),m.size===0&&this.listeners.delete(n))}handleMessage(n){const d=n.data;if(typeof d=="object"&&d!==null&&"type"in d){const m=d.type,l=this.listeners.get(m);l&&l.forEach(s=>s(d))}}send(n){this.port&&this.port.postMessage(n)}}class Bn{constructor(n,d,m){Y(this,"_url");Y(this,"_value");Y(this,"_options");Y(this,"_errors",[]);Y(this,"iframe");Y(this,"eventManager");Y(this,"modal");this._url=n,this._value=d,this._options=m,this.eventManager=new Qr,this.on(oe.INVALID,l=>{l.type===oe.INVALID&&(this._errors=l.errors,this._value=l.value)}),this.on(oe.RESIZE,l=>{l.type===oe.RESIZE&&this.iframe&&(this.iframe.style.height=`${l.height}px`)})}get url(){return this._url}get value(){return this._value}get options(){return this._options}get errors(){return this._errors}open(){document.location.href=this.url}mount(n){const d=document.querySelector(n);if(!d)throw new Error(`parentID ${n} not found`);this.embed(d)}embed(n,d=!1){var m,l;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(d?"":"&embedded=true"),this.iframe.allow="web-share; clipboard-write; hid; bluetooth;",this.iframe.style.width="100%",this.iframe.style.height="0px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",this.iframe.scrolling="no",n.appendChild(this.iframe),window.addEventListener("message",s=>{var h,y;s.source===((h=this.iframe)==null?void 0:h.contentWindow)&&((y=this.eventManager)==null||y.setPort(s.ports[0]))}),(l=(m=this.iframe)==null?void 0:m.contentWindow)==null||l.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(n){this.eventManager.send(n)}on(n,d){return this.eventManager.on(n,d)}off(n,d){this.eventManager.off(n,d)}update(n,d){this._value=n,d&&(this._options=d),this.send({type:Qt.UPDATE,value:n,options:this._options})}completion(){return new Promise((n,d)=>{let m,l,s;function h(){m&&m(),l&&l(),s&&s()}m=this.on(oe.COMPLETE,y=>{n(y.response),h()}),l=this.on(oe.CANCEL,()=>{d(new Error("User cancelled")),h()}),s=this.on("error",y=>{d(new Error(y.message)),h()})})}async openModal(){this.modal&&this.closeModal(),this.modal=document.createElement("dialog"),this.modal.style.border="none",this.modal.style.backgroundColor="white",this.modal.style.maxWidth="100vw",this.modal.style.maxHeight="100vh",this.modal.style.width="600px",this.modal.style.height="600px",document.body.appendChild(this.modal),this.embed(this.modal,!0);const n=this.on(oe.CANCEL,()=>{this.closeModal()}),d=this.on(oe.COMPLETE,()=>{this.closeModal()});return this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion().finally(()=>{n(),d()})}closeModal(){var n;this.modal&&((n=this.modal)==null||n.close(),this.modal.remove(),this.modal=void 0)}async popup(){const n=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",l=>{var s;l.source===n&&(console.log("received message from popup",l.data),(s=this.eventManager)==null||s.setPort(l.ports[0]))});const d=this.on(oe.CANCEL,()=>{n==null||n.close()}),m=this.on(oe.COMPLETE,()=>{n==null||n.close()});return this.completion().finally(()=>{d(),m()})}}function xr(e){return Object.entries(e).map(([n,d])=>{if(d==null)return;const m=encodeURIComponent(n),l=encodeURIComponent(typeof d=="object"?JSON.stringify(d):String(d));return`${m}=${l}`}).filter(n=>n!==void 0).join("&")}function ei(e){const n=e.slice(1);return n?n.split("&").filter(Boolean).reduce((m,l)=>{const[s,h]=l.split("=");return s&&(m[decodeURIComponent(s)]=h?decodeURIComponent(h):""),m},{}):{}}new TextEncoder;const at=new TextDecoder;function ti(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const n=atob(e),d=new Uint8Array(n.length);for(let m=0;m<n.length;m++)d[m]=n.charCodeAt(m);return d}function ni(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:at.decode(e),{alphabet:"base64url"});let n=e;n instanceof Uint8Array&&(n=at.decode(n)),n=n.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return ti(n)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class Fn extends Error{constructor(d,m){var l;super(d,m);Y(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(l=Error.captureStackTrace)==null||l.call(Error,this,this.constructor)}}Y(Fn,"code","ERR_JOSE_GENERIC");class pe extends Fn{constructor(){super(...arguments);Y(this,"code","ERR_JWT_INVALID")}}Y(pe,"code","ERR_JWT_INVALID");function ri(e){return typeof e=="object"&&e!==null}const ii=e=>{if(!ri(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let n=e;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n};function ai(e){if(typeof e!="string")throw new pe("JWTs must use Compact JWS serialization, JWT must be a string");const{1:n,length:d}=e.split(".");if(d===5)throw new pe("Only JWTs using Compact JWS serialization can be decoded");if(d!==3)throw new pe("Invalid JWT");if(!n)throw new pe("JWTs must contain a payload");let m;try{m=ni(n)}catch{throw new pe("Failed to base64url decode the payload")}let l;try{l=JSON.parse(at.decode(m))}catch{throw new pe("Failed to parse the decoded payload as JSON")}if(!ii(l))throw new pe("Invalid JWT Claims Set");return l}var b=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Vn={},Gn={};Object.defineProperty(Gn,"__esModule",{value:!0});var ge={};Object.defineProperty(ge,"__esModule",{value:!0});ge.DocumentTypeCode=ge.TaxSchemeCode=ge.TaxCategoryCode=ge.UnitCode=void 0;var yn;(function(e){e.Kilogram="KGM",e.Gram="GRM",e.Milligram="MGM",e.Tonne="TNE",e.Liter="LTR",e.Milliliter="MLT",e.CubicMillimeter="MMQ",e.CubicCentimeter="CMQ",e.CubicDecimeter="DMQ",e.CubicMeter="MTQ",e.Millimeter="MMT",e.Centimeter="CMT",e.Decimeter="DMT",e.Meter="MTR",e.Kilometer="KMT",e.SquareMeter="MTK",e.Each="EA",e.Piece="PCE",e.NumberOfPairs="NPR",e.Second="SEC",e.Minute="MIN",e.Hour="HUR",e.Day="DAY",e.Week="WEE",e.Month="MON",e.Year="ANN",e.KilowattHour="KWH",e.NumberOfArticles="NAR"})(yn||(ge.UnitCode=yn={}));var $n;(function(e){e.StandardRate="S",e.ZeroRated="Z",e.ExemptFromTax="E",e.VATReverseCharge="AE",e.FreeExportItem="G",e.OutsideScopeOfTax="O",e.VATExemptIntraCommunity="K",e.CanaryIslandsIndirectTax="L",e.CeutaMelillaTax="M",e.HigherRate="H",e.LowerRate="AA",e.TransferredVAT="B",e.MixedTaxRate="A",e.ExemptForResale="AB",e.VATReverseChargeAlt="AC",e.VATExemptIntraCommunityAlt="AD",e.ExemptFromTaxDeprecated="C",e.ExemptArticle309="D"})($n||(ge.TaxCategoryCode=$n={}));var Sn;(function(e){e.ProfitTax="AAA",e.CorporateIncomeTax="AAB",e.PersonalIncomeTax="AAC",e.SocialSecurityTax="AAD",e.PropertyTax="AAE",e.InheritanceTax="AAF",e.GiftTax="AAG",e.CapitalGainsTax="AAH",e.WealthTax="AAI",e.StampDuty="AAJ",e.ConsumptionTax="CST",e.CustomsDuty="CUS",e.EnvironmentalTax="ENV",e.ExciseTax="EXC",e.ExportTax="EXP",e.FreightTax="FRT",e.GoodsAndServicesTax="GST",e.ImportTax="IMP",e.OtherTax="OTH",e.SalesTax="SAL",e.TurnoverTax="TOT",e.ValueAddedTax="VAT"})(Sn||(ge.TaxSchemeCode=Sn={}));var On;(function(e){e.Order="Order",e.OrderResponse="OrderResponse",e.OrderChange="OrderChange",e.OrderCancellation="OrderCancellation",e.Quotation="Quotation",e.DespatchAdvice="DespatchAdvice",e.ReceiptAdvice="ReceiptAdvice",e.Invoice="Invoice",e.CreditNote="CreditNote",e.DebitNote="DebitNote",e.SelfBilledInvoice="SelfBilledInvoice",e.RemittanceAdvice="RemittanceAdvice",e.Statement="Statement",e.CertificateOfOrigin="CertificateOfOrigin",e.Contract="Contract",e.Timesheet="Timesheet",e.Waybill="Waybill",e.Manifest="Manifest"})(On||(ge.DocumentTypeCode=On={}));var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});var Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.normalizeForHashing=Kn;Xe.generateNameHash=ci;function Kn(e){return e.replace(/\s+/g,"").toUpperCase()}function Xn(e){var l;if(!((l=e.name)!=null&&l.nameIdentifier)||e.name.nameIdentifier.length===0)return"";const d=e.name.nameIdentifier.find(s=>s.naturalPersonNameIdentifierType==="LEGL")||e.name.nameIdentifier[0],m=[];return d.secondaryIdentifier&&m.push(d.secondaryIdentifier),m.push(d.primaryIdentifier),m.join(" ")}function Hn(e){var m;return!((m=e.name)!=null&&m.nameIdentifier)||e.name.nameIdentifier.length===0?"":(e.name.nameIdentifier.find(l=>l.legalPersonNameIdentifierType==="LEGL")||e.name.nameIdentifier[0]).legalPersonName}function oi(e){return e.originatorPerson.map(d=>d.naturalPerson?Xn(d.naturalPerson):d.legalPerson?Hn(d.legalPerson):"").filter(d=>d.length>0)}function ui(e){return e.beneficiaryPerson.map(d=>d.naturalPerson?Xn(d.naturalPerson):d.legalPerson?Hn(d.legalPerson):"").filter(d=>d.length>0)}async function ci(e){let n;if(typeof e=="string")n=e;else if("originatorPerson"in e)n=oi(e).join(" ");else if("beneficiaryPerson"in e)n=ui(e).join(" ");else throw new Error("Invalid input type. Expected string, IVMS101 Originator, or IVMS101 Beneficiary");const d=Kn(n),l=new TextEncoder().encode(d);let s;if(typeof globalThis<"u"&&"crypto"in globalThis&&globalThis.crypto&&"subtle"in globalThis.crypto)s=await globalThis.crypto.subtle.digest("SHA-256",l);else try{const i=(await new Function("specifier","return import(specifier)")("crypto")).createHash("sha256").update(l).digest();s=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}catch{throw new Error("No crypto implementation available. This environment does not support Web Crypto API or Node.js crypto module.")}return Array.from(new Uint8Array(s)).map(h=>h.toString(16).padStart(2,"0")).join("")}var qn={},Yn={},ot={},te={},De={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.globalConfig=e.$ZodEncodeError=e.$ZodAsyncError=e.$brand=e.NEVER=void 0,e.$constructor=n,e.config=l,e.NEVER=Object.freeze({status:"aborted"});function n(s,h,y){function i(t,a){var f;Object.defineProperty(t,"_zod",{value:t._zod??{},enumerable:!1}),(f=t._zod).traits??(f.traits=new Set),t._zod.traits.add(s),h(t,a);for(const I in u.prototype)I in t||Object.defineProperty(t,I,{value:u.prototype[I].bind(t)});t._zod.constr=u,t._zod.def=a}const r=(y==null?void 0:y.Parent)??Object;class o extends r{}Object.defineProperty(o,"name",{value:s});function u(t){var a;const f=y!=null&&y.Parent?new o:this;i(f,t),(a=f._zod).deferred??(a.deferred=[]);for(const I of f._zod.deferred)I();return f}return Object.defineProperty(u,"init",{value:i}),Object.defineProperty(u,Symbol.hasInstance,{value:t=>{var a,f;return y!=null&&y.Parent&&t instanceof y.Parent?!0:(f=(a=t==null?void 0:t._zod)==null?void 0:a.traits)==null?void 0:f.has(s)}}),Object.defineProperty(u,"name",{value:s}),u}e.$brand=Symbol("zod_brand");class d extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}e.$ZodAsyncError=d;class m extends Error{constructor(h){super(`Encountered unidirectional transform during encode: ${h}`),this.name="ZodEncodeError"}}e.$ZodEncodeError=m,e.globalConfig={};function l(s){return s&&Object.assign(e.globalConfig,s),e.globalConfig}})(De);var xt={},ce={},Z={};Object.defineProperty(Z,"__esModule",{value:!0});Z.Class=Z.BIGINT_FORMAT_RANGES=Z.NUMBER_FORMAT_RANGES=Z.primitiveTypes=Z.propertyKeyTypes=Z.getParsedType=Z.allowsEval=Z.captureStackTrace=void 0;Z.assertEqual=li;Z.assertNotEqual=di;Z.assertIs=si;Z.assertNever=fi;Z.assert=mi;Z.getEnumValues=gi;Z.joinValues=vi;Z.jsonStringifyReplacer=_i;Z.cached=Qn;Z.nullish=bi;Z.cleanRegex=hi;Z.floatSafeRemainder=pi;Z.defineLazy=yi;Z.objectClone=$i;Z.assignProp=ye;Z.mergeDefs=$e;Z.cloneDef=Si;Z.getElementAtPath=Oi;Z.promiseAllObject=ji;Z.randomString=Pi;Z.esc=Ii;Z.isObject=ut;Z.isPlainObject=He;Z.shallowClone=zi;Z.numKeys=wi;Z.escapeRegex=Di;Z.clone=Se;Z.normalizeParams=Ei;Z.createTransparentProxy=Ti;Z.stringifyPrimitive=xn;Z.optionalKeys=Ni;Z.pick=Ai;Z.omit=Ui;Z.extend=Mi;Z.safeExtend=ki;Z.merge=Ci;Z.partial=Ri;Z.required=Li;Z.aborted=Bi;Z.prefixIssues=Fi;Z.unwrapMessage=Ee;Z.finalizeIssue=Vi;Z.getSizableOrigin=Gi;Z.getLengthableOrigin=Ji;Z.issue=Wi;Z.cleanEnum=Ki;Z.base64ToUint8Array=er;Z.uint8ArrayToBase64=tr;Z.base64urlToUint8Array=Xi;Z.uint8ArrayToBase64url=Hi;Z.hexToUint8Array=qi;Z.uint8ArrayToHex=Yi;function li(e){return e}function di(e){return e}function si(e){}function fi(e){throw new Error}function mi(e){}function gi(e){const n=Object.values(e).filter(m=>typeof m=="number");return Object.entries(e).filter(([m,l])=>n.indexOf(+m)===-1).map(([m,l])=>l)}function vi(e,n="|"){return e.map(d=>xn(d)).join(n)}function _i(e,n){return typeof n=="bigint"?n.toString():n}function Qn(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function bi(e){return e==null}function hi(e){const n=e.startsWith("^")?1:0,d=e.endsWith("$")?e.length-1:e.length;return e.slice(n,d)}function pi(e,n){const d=(e.toString().split(".")[1]||"").length,m=n.toString();let l=(m.split(".")[1]||"").length;if(l===0&&/\d?e-\d?/.test(m)){const i=m.match(/\d?e-(\d?)/);i!=null&&i[1]&&(l=Number.parseInt(i[1]))}const s=d>l?d:l,h=Number.parseInt(e.toFixed(s).replace(".","")),y=Number.parseInt(n.toFixed(s).replace(".",""));return h%y/10**s}const jn=Symbol("evaluating");function yi(e,n,d){let m;Object.defineProperty(e,n,{get(){if(m!==jn)return m===void 0&&(m=jn,m=d()),m},set(l){Object.defineProperty(e,n,{value:l})},configurable:!0})}function $i(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ye(e,n,d){Object.defineProperty(e,n,{value:d,writable:!0,enumerable:!0,configurable:!0})}function $e(...e){const n={};for(const d of e){const m=Object.getOwnPropertyDescriptors(d);Object.assign(n,m)}return Object.defineProperties({},n)}function Si(e){return $e(e._zod.def)}function Oi(e,n){return n?n.reduce((d,m)=>d==null?void 0:d[m],e):e}function ji(e){const n=Object.keys(e),d=n.map(m=>e[m]);return Promise.all(d).then(m=>{const l={};for(let s=0;s<n.length;s++)l[n[s]]=m[s];return l})}function Pi(e=10){const n="abcdefghijklmnopqrstuvwxyz";let d="";for(let m=0;m<e;m++)d+=n[Math.floor(Math.random()*n.length)];return d}function Ii(e){return JSON.stringify(e)}Z.captureStackTrace="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ut(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Z.allowsEval=Qn(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function He(e){if(ut(e)===!1)return!1;const n=e.constructor;if(n===void 0)return!0;const d=n.prototype;return!(ut(d)===!1||Object.prototype.hasOwnProperty.call(d,"isPrototypeOf")===!1)}function zi(e){return He(e)?{...e}:Array.isArray(e)?[...e]:e}function wi(e){let n=0;for(const d in e)Object.prototype.hasOwnProperty.call(e,d)&&n++;return n}const Zi=e=>{const n=typeof e;switch(n){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${n}`)}};Z.getParsedType=Zi;Z.propertyKeyTypes=new Set(["string","number","symbol"]);Z.primitiveTypes=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Di(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Se(e,n,d){const m=new e._zod.constr(n??e._zod.def);return(!n||d!=null&&d.parent)&&(m._zod.parent=e),m}function Ei(e){const n=e;if(!n)return{};if(typeof n=="string")return{error:()=>n};if((n==null?void 0:n.message)!==void 0){if((n==null?void 0:n.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,typeof n.error=="string"?{...n,error:()=>n.error}:n}function Ti(e){let n;return new Proxy({},{get(d,m,l){return n??(n=e()),Reflect.get(n,m,l)},set(d,m,l,s){return n??(n=e()),Reflect.set(n,m,l,s)},has(d,m){return n??(n=e()),Reflect.has(n,m)},deleteProperty(d,m){return n??(n=e()),Reflect.deleteProperty(n,m)},ownKeys(d){return n??(n=e()),Reflect.ownKeys(n)},getOwnPropertyDescriptor(d,m){return n??(n=e()),Reflect.getOwnPropertyDescriptor(n,m)},defineProperty(d,m,l){return n??(n=e()),Reflect.defineProperty(n,m,l)}})}function xn(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ni(e){return Object.keys(e).filter(n=>e[n]._zod.optin==="optional"&&e[n]._zod.optout==="optional")}Z.NUMBER_FORMAT_RANGES={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};Z.BIGINT_FORMAT_RANGES={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ai(e,n){const d=e._zod.def,m=$e(e._zod.def,{get shape(){const l={};for(const s in n){if(!(s in d.shape))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(l[s]=d.shape[s])}return ye(this,"shape",l),l},checks:[]});return Se(e,m)}function Ui(e,n){const d=e._zod.def,m=$e(e._zod.def,{get shape(){const l={...e._zod.def.shape};for(const s in n){if(!(s in d.shape))throw new Error(`Unrecognized key: "${s}"`);n[s]&&delete l[s]}return ye(this,"shape",l),l},checks:[]});return Se(e,m)}function Mi(e,n){if(!He(n))throw new Error("Invalid input to extend: expected a plain object");const d=e._zod.def.checks;if(d&&d.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const l=$e(e._zod.def,{get shape(){const s={...e._zod.def.shape,...n};return ye(this,"shape",s),s},checks:[]});return Se(e,l)}function ki(e,n){if(!He(n))throw new Error("Invalid input to safeExtend: expected a plain object");const d={...e._zod.def,get shape(){const m={...e._zod.def.shape,...n};return ye(this,"shape",m),m},checks:e._zod.def.checks};return Se(e,d)}function Ci(e,n){const d=$e(e._zod.def,{get shape(){const m={...e._zod.def.shape,...n._zod.def.shape};return ye(this,"shape",m),m},get catchall(){return n._zod.def.catchall},checks:[]});return Se(e,d)}function Ri(e,n,d){const m=$e(n._zod.def,{get shape(){const l=n._zod.def.shape,s={...l};if(d)for(const h in d){if(!(h in l))throw new Error(`Unrecognized key: "${h}"`);d[h]&&(s[h]=e?new e({type:"optional",innerType:l[h]}):l[h])}else for(const h in l)s[h]=e?new e({type:"optional",innerType:l[h]}):l[h];return ye(this,"shape",s),s},checks:[]});return Se(n,m)}function Li(e,n,d){const m=$e(n._zod.def,{get shape(){const l=n._zod.def.shape,s={...l};if(d)for(const h in d){if(!(h in s))throw new Error(`Unrecognized key: "${h}"`);d[h]&&(s[h]=new e({type:"nonoptional",innerType:l[h]}))}else for(const h in l)s[h]=new e({type:"nonoptional",innerType:l[h]});return ye(this,"shape",s),s},checks:[]});return Se(n,m)}function Bi(e,n=0){var d;if(e.aborted===!0)return!0;for(let m=n;m<e.issues.length;m++)if(((d=e.issues[m])==null?void 0:d.continue)!==!0)return!0;return!1}function Fi(e,n){return n.map(d=>{var m;return(m=d).path??(m.path=[]),d.path.unshift(e),d})}function Ee(e){return typeof e=="string"?e:e==null?void 0:e.message}function Vi(e,n,d){var l,s,h,y,i,r;const m={...e,path:e.path??[]};if(!e.message){const o=Ee((h=(s=(l=e.inst)==null?void 0:l._zod.def)==null?void 0:s.error)==null?void 0:h.call(s,e))??Ee((y=n==null?void 0:n.error)==null?void 0:y.call(n,e))??Ee((i=d.customError)==null?void 0:i.call(d,e))??Ee((r=d.localeError)==null?void 0:r.call(d,e))??"Invalid input";m.message=o}return delete m.inst,delete m.continue,n!=null&&n.reportInput||delete m.input,m}function Gi(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ji(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Wi(...e){const[n,d,m]=e;return typeof n=="string"?{message:n,code:"custom",input:d,inst:m}:{...n}}function Ki(e){return Object.entries(e).filter(([n,d])=>Number.isNaN(Number.parseInt(n,10))).map(n=>n[1])}function er(e){const n=atob(e),d=new Uint8Array(n.length);for(let m=0;m<n.length;m++)d[m]=n.charCodeAt(m);return d}function tr(e){let n="";for(let d=0;d<e.length;d++)n+=String.fromCharCode(e[d]);return btoa(n)}function Xi(e){const n=e.replace(/-/g,"+").replace(/_/g,"/"),d="=".repeat((4-n.length%4)%4);return er(n+d)}function Hi(e){return tr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function qi(e){const n=e.replace(/^0x/,"");if(n.length%2!==0)throw new Error("Invalid hex string length");const d=new Uint8Array(n.length/2);for(let m=0;m<n.length;m+=2)d[m/2]=Number.parseInt(n.slice(m,m+2),16);return d}function Yi(e){return Array.from(e).map(n=>n.toString(16).padStart(2,"0")).join("")}class Qi{constructor(...n){}}Z.Class=Qi;var xi=b&&b.__createBinding||(Object.create?function(e,n,d,m){m===void 0&&(m=d);var l=Object.getOwnPropertyDescriptor(n,d);(!l||("get"in l?!n.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return n[d]}}),Object.defineProperty(e,m,l)}:function(e,n,d,m){m===void 0&&(m=d),e[m]=n[d]}),ea=b&&b.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),ta=b&&b.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var d in e)d!=="default"&&Object.prototype.hasOwnProperty.call(e,d)&&xi(n,e,d);return ea(n,e),n};Object.defineProperty(ce,"__esModule",{value:!0});ce.$ZodRealError=ce.$ZodError=void 0;ce.flattenError=ra;ce.formatError=ia;ce.treeifyError=aa;ce.toDotPath=ir;ce.prettifyError=oa;const nr=De,na=ta(Z),rr=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,na.jsonStringifyReplacer,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})};ce.$ZodError=(0,nr.$constructor)("$ZodError",rr);ce.$ZodRealError=(0,nr.$constructor)("$ZodError",rr,{Parent:Error});function ra(e,n=d=>d.message){const d={},m=[];for(const l of e.issues)l.path.length>0?(d[l.path[0]]=d[l.path[0]]||[],d[l.path[0]].push(n(l))):m.push(n(l));return{formErrors:m,fieldErrors:d}}function ia(e,n=d=>d.message){const d={_errors:[]},m=l=>{for(const s of l.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(h=>m({issues:h}));else if(s.code==="invalid_key")m({issues:s.issues});else if(s.code==="invalid_element")m({issues:s.issues});else if(s.path.length===0)d._errors.push(n(s));else{let h=d,y=0;for(;y<s.path.length;){const i=s.path[y];y===s.path.length-1?(h[i]=h[i]||{_errors:[]},h[i]._errors.push(n(s))):h[i]=h[i]||{_errors:[]},h=h[i],y++}}};return m(e),d}function aa(e,n=d=>d.message){const d={errors:[]},m=(l,s=[])=>{var h,y;for(const i of l.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(r=>m({issues:r},i.path));else if(i.code==="invalid_key")m({issues:i.issues},i.path);else if(i.code==="invalid_element")m({issues:i.issues},i.path);else{const r=[...s,...i.path];if(r.length===0){d.errors.push(n(i));continue}let o=d,u=0;for(;u<r.length;){const t=r[u],a=u===r.length-1;typeof t=="string"?(o.properties??(o.properties={}),(h=o.properties)[t]??(h[t]={errors:[]}),o=o.properties[t]):(o.items??(o.items=[]),(y=o.items)[t]??(y[t]={errors:[]}),o=o.items[t]),a&&o.errors.push(n(i)),u++}}};return m(e),d}function ir(e){const n=[],d=e.map(m=>typeof m=="object"?m.key:m);for(const m of d)typeof m=="number"?n.push(`[${m}]`):typeof m=="symbol"?n.push(`[${JSON.stringify(String(m))}]`):/[^\w$]/.test(m)?n.push(`[${JSON.stringify(m)}]`):(n.length&&n.push("."),n.push(m));return n.join("")}function oa(e){var m;const n=[],d=[...e.issues].sort((l,s)=>(l.path??[]).length-(s.path??[]).length);for(const l of d)n.push(`✖ ${l.message}`),(m=l.path)!=null&&m.length&&n.push(` → at ${ir(l.path)}`);return n.join(`
|
|
2
2
|
`)}(function(e){var n=b&&b.__createBinding||(Object.create?function(N,k,D,C){C===void 0&&(C=D);var B=Object.getOwnPropertyDescriptor(k,D);(!B||("get"in B?!k.__esModule:B.writable||B.configurable))&&(B={enumerable:!0,get:function(){return k[D]}}),Object.defineProperty(N,C,B)}:function(N,k,D,C){C===void 0&&(C=D),N[C]=k[D]}),d=b&&b.__setModuleDefault||(Object.create?function(N,k){Object.defineProperty(N,"default",{enumerable:!0,value:k})}:function(N,k){N.default=k}),m=b&&b.__importStar||function(N){if(N&&N.__esModule)return N;var k={};if(N!=null)for(var D in N)D!=="default"&&Object.prototype.hasOwnProperty.call(N,D)&&n(k,N,D);return d(k,N),k};Object.defineProperty(e,"__esModule",{value:!0}),e.safeDecodeAsync=e._safeDecodeAsync=e.safeEncodeAsync=e._safeEncodeAsync=e.safeDecode=e._safeDecode=e.safeEncode=e._safeEncode=e.decodeAsync=e._decodeAsync=e.encodeAsync=e._encodeAsync=e.decode=e._decode=e.encode=e._encode=e.safeParseAsync=e._safeParseAsync=e.safeParse=e._safeParse=e.parseAsync=e._parseAsync=e.parse=e._parse=void 0;const l=m(De),s=m(ce),h=m(Z),y=N=>(k,D,C,B)=>{const J=C?Object.assign(C,{async:!1}):{async:!1},X=k._zod.run({value:D,issues:[]},J);if(X instanceof Promise)throw new l.$ZodAsyncError;if(X.issues.length){const ie=new((B==null?void 0:B.Err)??N)(X.issues.map(se=>h.finalizeIssue(se,J,l.config())));throw h.captureStackTrace(ie,B==null?void 0:B.callee),ie}return X.value};e._parse=y,e.parse=(0,e._parse)(s.$ZodRealError);const i=N=>async(k,D,C,B)=>{const J=C?Object.assign(C,{async:!0}):{async:!0};let X=k._zod.run({value:D,issues:[]},J);if(X instanceof Promise&&(X=await X),X.issues.length){const ie=new((B==null?void 0:B.Err)??N)(X.issues.map(se=>h.finalizeIssue(se,J,l.config())));throw h.captureStackTrace(ie,B==null?void 0:B.callee),ie}return X.value};e._parseAsync=i,e.parseAsync=(0,e._parseAsync)(s.$ZodRealError);const r=N=>(k,D,C)=>{const B=C?{...C,async:!1}:{async:!1},J=k._zod.run({value:D,issues:[]},B);if(J instanceof Promise)throw new l.$ZodAsyncError;return J.issues.length?{success:!1,error:new(N??s.$ZodError)(J.issues.map(X=>h.finalizeIssue(X,B,l.config())))}:{success:!0,data:J.value}};e._safeParse=r,e.safeParse=(0,e._safeParse)(s.$ZodRealError);const o=N=>async(k,D,C)=>{const B=C?Object.assign(C,{async:!0}):{async:!0};let J=k._zod.run({value:D,issues:[]},B);return J instanceof Promise&&(J=await J),J.issues.length?{success:!1,error:new N(J.issues.map(X=>h.finalizeIssue(X,B,l.config())))}:{success:!0,data:J.value}};e._safeParseAsync=o,e.safeParseAsync=(0,e._safeParseAsync)(s.$ZodRealError);const u=N=>(k,D,C)=>{const B=C?Object.assign(C,{direction:"backward"}):{direction:"backward"};return(0,e._parse)(N)(k,D,B)};e._encode=u,e.encode=(0,e._encode)(s.$ZodRealError);const t=N=>(k,D,C)=>(0,e._parse)(N)(k,D,C);e._decode=t,e.decode=(0,e._decode)(s.$ZodRealError);const a=N=>async(k,D,C)=>{const B=C?Object.assign(C,{direction:"backward"}):{direction:"backward"};return(0,e._parseAsync)(N)(k,D,B)};e._encodeAsync=a,e.encodeAsync=(0,e._encodeAsync)(s.$ZodRealError);const f=N=>async(k,D,C)=>(0,e._parseAsync)(N)(k,D,C);e._decodeAsync=f,e.decodeAsync=(0,e._decodeAsync)(s.$ZodRealError);const I=N=>(k,D,C)=>{const B=C?Object.assign(C,{direction:"backward"}):{direction:"backward"};return(0,e._safeParse)(N)(k,D,B)};e._safeEncode=I,e.safeEncode=(0,e._safeEncode)(s.$ZodRealError);const w=N=>(k,D,C)=>(0,e._safeParse)(N)(k,D,C);e._safeDecode=w,e.safeDecode=(0,e._safeDecode)(s.$ZodRealError);const j=N=>async(k,D,C)=>{const B=C?Object.assign(C,{direction:"backward"}):{direction:"backward"};return(0,e._safeParseAsync)(N)(k,D,B)};e._safeEncodeAsync=j,e.safeEncodeAsync=(0,e._safeEncodeAsync)(s.$ZodRealError);const R=N=>async(k,D,C)=>(0,e._safeParseAsync)(N)(k,D,C);e._safeDecodeAsync=R,e.safeDecodeAsync=(0,e._safeDecodeAsync)(s.$ZodRealError)})(xt);var en={},qe={},Ye={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sha384_base64=e.sha384_hex=e.sha256_base64url=e.sha256_base64=e.sha256_hex=e.sha1_base64url=e.sha1_base64=e.sha1_hex=e.md5_base64url=e.md5_base64=e.md5_hex=e.hex=e.uppercase=e.lowercase=e.undefined=e.null=e.boolean=e.number=e.integer=e.bigint=e.string=e.date=e.e164=e.domain=e.hostname=e.base64url=e.base64=e.cidrv6=e.cidrv4=e.ipv6=e.ipv4=e.browserEmail=e.idnEmail=e.unicodeEmail=e.rfc5322Email=e.html5Email=e.email=e.uuid7=e.uuid6=e.uuid4=e.uuid=e.guid=e.extendedDuration=e.duration=e.nanoid=e.ksuid=e.xid=e.ulid=e.cuid2=e.cuid=void 0,e.sha512_base64url=e.sha512_base64=e.sha512_hex=e.sha384_base64url=void 0,e.emoji=m,e.time=h,e.datetime=y,e.cuid=/^[cC][^\s-]{8,}$/,e.cuid2=/^[0-9a-z]+$/,e.ulid=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,e.xid=/^[0-9a-vA-V]{20}$/,e.ksuid=/^[A-Za-z0-9]{27}$/,e.nanoid=/^[a-zA-Z0-9_-]{21}$/,e.duration=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,e.extendedDuration=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,e.guid=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;const n=a=>a?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${a}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;e.uuid=n,e.uuid4=(0,e.uuid)(4),e.uuid6=(0,e.uuid)(6),e.uuid7=(0,e.uuid)(7),e.email=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,e.html5Email=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,e.rfc5322Email=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,e.unicodeEmail=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,e.idnEmail=e.unicodeEmail,e.browserEmail=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;const d="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function m(){return new RegExp(d,"u")}e.ipv4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,e.ipv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,e.cidrv4=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,e.cidrv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,e.base64=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,e.base64url=/^[A-Za-z0-9_-]*$/,e.hostname=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,e.domain=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,e.e164=/^\+(?:[0-9]){6,14}[0-9]$/;const l="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";e.date=new RegExp(`^${l}$`);function s(a){const f="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof a.precision=="number"?a.precision===-1?`${f}`:a.precision===0?`${f}:[0-5]\\d`:`${f}:[0-5]\\d\\.\\d{${a.precision}}`:`${f}(?::[0-5]\\d(?:\\.\\d+)?)?`}function h(a){return new RegExp(`^${s(a)}$`)}function y(a){const f=s({precision:a.precision}),I=["Z"];a.local&&I.push(""),a.offset&&I.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const w=`${f}(?:${I.join("|")})`;return new RegExp(`^${l}T(?:${w})$`)}const i=a=>{const f=a?`[\\s\\S]{${(a==null?void 0:a.minimum)??0},${(a==null?void 0:a.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${f}$`)};e.string=i,e.bigint=/^-?\d+n?$/,e.integer=/^-?\d+$/,e.number=/^-?\d+(?:\.\d+)?/,e.boolean=/^(?:true|false)$/i;const r=/^null$/i;e.null=r;const o=/^undefined$/i;e.undefined=o,e.lowercase=/^[^A-Z]*$/,e.uppercase=/^[^a-z]*$/,e.hex=/^[0-9a-fA-F]*$/;function u(a,f){return new RegExp(`^[A-Za-z0-9+/]{${a}}${f}$`)}function t(a){return new RegExp(`^[A-Za-z0-9_-]{${a}}$`)}e.md5_hex=/^[0-9a-fA-F]{32}$/,e.md5_base64=u(22,"=="),e.md5_base64url=t(22),e.sha1_hex=/^[0-9a-fA-F]{40}$/,e.sha1_base64=u(27,"="),e.sha1_base64url=t(27),e.sha256_hex=/^[0-9a-fA-F]{64}$/,e.sha256_base64=u(43,"="),e.sha256_base64url=t(43),e.sha384_hex=/^[0-9a-fA-F]{96}$/,e.sha384_base64=u(64,""),e.sha384_base64url=t(64),e.sha512_hex=/^[0-9a-fA-F]{128}$/,e.sha512_base64=u(86,"=="),e.sha512_base64url=t(86)})(Ye);(function(e){var n=b&&b.__createBinding||(Object.create?function(r,o,u,t){t===void 0&&(t=u);var a=Object.getOwnPropertyDescriptor(o,u);(!a||("get"in a?!o.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return o[u]}}),Object.defineProperty(r,t,a)}:function(r,o,u,t){t===void 0&&(t=u),r[t]=o[u]}),d=b&&b.__setModuleDefault||(Object.create?function(r,o){Object.defineProperty(r,"default",{enumerable:!0,value:o})}:function(r,o){r.default=o}),m=b&&b.__importStar||function(r){if(r&&r.__esModule)return r;var o={};if(r!=null)for(var u in r)u!=="default"&&Object.prototype.hasOwnProperty.call(r,u)&&n(o,r,u);return d(o,r),o};Object.defineProperty(e,"__esModule",{value:!0}),e.$ZodCheckOverwrite=e.$ZodCheckMimeType=e.$ZodCheckProperty=e.$ZodCheckEndsWith=e.$ZodCheckStartsWith=e.$ZodCheckIncludes=e.$ZodCheckUpperCase=e.$ZodCheckLowerCase=e.$ZodCheckRegex=e.$ZodCheckStringFormat=e.$ZodCheckLengthEquals=e.$ZodCheckMinLength=e.$ZodCheckMaxLength=e.$ZodCheckSizeEquals=e.$ZodCheckMinSize=e.$ZodCheckMaxSize=e.$ZodCheckBigIntFormat=e.$ZodCheckNumberFormat=e.$ZodCheckMultipleOf=e.$ZodCheckGreaterThan=e.$ZodCheckLessThan=e.$ZodCheck=void 0;const l=m(De),s=m(Ye),h=m(Z);e.$ZodCheck=l.$constructor("$ZodCheck",(r,o)=>{var u;r._zod??(r._zod={}),r._zod.def=o,(u=r._zod).onattach??(u.onattach=[])});const y={number:"number",bigint:"bigint",object:"date"};e.$ZodCheckLessThan=l.$constructor("$ZodCheckLessThan",(r,o)=>{e.$ZodCheck.init(r,o);const u=y[typeof o.value];r._zod.onattach.push(t=>{const a=t._zod.bag,f=(o.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;o.value<f&&(o.inclusive?a.maximum=o.value:a.exclusiveMaximum=o.value)}),r._zod.check=t=>{(o.inclusive?t.value<=o.value:t.value<o.value)||t.issues.push({origin:u,code:"too_big",maximum:o.value,input:t.value,inclusive:o.inclusive,inst:r,continue:!o.abort})}}),e.$ZodCheckGreaterThan=l.$constructor("$ZodCheckGreaterThan",(r,o)=>{e.$ZodCheck.init(r,o);const u=y[typeof o.value];r._zod.onattach.push(t=>{const a=t._zod.bag,f=(o.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;o.value>f&&(o.inclusive?a.minimum=o.value:a.exclusiveMinimum=o.value)}),r._zod.check=t=>{(o.inclusive?t.value>=o.value:t.value>o.value)||t.issues.push({origin:u,code:"too_small",minimum:o.value,input:t.value,inclusive:o.inclusive,inst:r,continue:!o.abort})}}),e.$ZodCheckMultipleOf=l.$constructor("$ZodCheckMultipleOf",(r,o)=>{e.$ZodCheck.init(r,o),r._zod.onattach.push(u=>{var t;(t=u._zod.bag).multipleOf??(t.multipleOf=o.value)}),r._zod.check=u=>{if(typeof u.value!=typeof o.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof u.value=="bigint"?u.value%o.value===BigInt(0):h.floatSafeRemainder(u.value,o.value)===0)||u.issues.push({origin:typeof u.value,code:"not_multiple_of",divisor:o.value,input:u.value,inst:r,continue:!o.abort})}}),e.$ZodCheckNumberFormat=l.$constructor("$ZodCheckNumberFormat",(r,o)=>{var I;e.$ZodCheck.init(r,o),o.format=o.format||"float64";const u=(I=o.format)==null?void 0:I.includes("int"),t=u?"int":"number",[a,f]=h.NUMBER_FORMAT_RANGES[o.format];r._zod.onattach.push(w=>{const j=w._zod.bag;j.format=o.format,j.minimum=a,j.maximum=f,u&&(j.pattern=s.integer)}),r._zod.check=w=>{const j=w.value;if(u){if(!Number.isInteger(j)){w.issues.push({expected:t,format:o.format,code:"invalid_type",continue:!1,input:j,inst:r});return}if(!Number.isSafeInteger(j)){j>0?w.issues.push({input:j,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:r,origin:t,continue:!o.abort}):w.issues.push({input:j,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:r,origin:t,continue:!o.abort});return}}j<a&&w.issues.push({origin:"number",input:j,code:"too_small",minimum:a,inclusive:!0,inst:r,continue:!o.abort}),j>f&&w.issues.push({origin:"number",input:j,code:"too_big",maximum:f,inst:r})}}),e.$ZodCheckBigIntFormat=l.$constructor("$ZodCheckBigIntFormat",(r,o)=>{e.$ZodCheck.init(r,o);const[u,t]=h.BIGINT_FORMAT_RANGES[o.format];r._zod.onattach.push(a=>{const f=a._zod.bag;f.format=o.format,f.minimum=u,f.maximum=t}),r._zod.check=a=>{const f=a.value;f<u&&a.issues.push({origin:"bigint",input:f,code:"too_small",minimum:u,inclusive:!0,inst:r,continue:!o.abort}),f>t&&a.issues.push({origin:"bigint",input:f,code:"too_big",maximum:t,inst:r})}}),e.$ZodCheckMaxSize=l.$constructor("$ZodCheckMaxSize",(r,o)=>{var u;e.$ZodCheck.init(r,o),(u=r._zod.def).when??(u.when=t=>{const a=t.value;return!h.nullish(a)&&a.size!==void 0}),r._zod.onattach.push(t=>{const a=t._zod.bag.maximum??Number.POSITIVE_INFINITY;o.maximum<a&&(t._zod.bag.maximum=o.maximum)}),r._zod.check=t=>{const a=t.value;a.size<=o.maximum||t.issues.push({origin:h.getSizableOrigin(a),code:"too_big",maximum:o.maximum,inclusive:!0,input:a,inst:r,continue:!o.abort})}}),e.$ZodCheckMinSize=l.$constructor("$ZodCheckMinSize",(r,o)=>{var u;e.$ZodCheck.init(r,o),(u=r._zod.def).when??(u.when=t=>{const a=t.value;return!h.nullish(a)&&a.size!==void 0}),r._zod.onattach.push(t=>{const a=t._zod.bag.minimum??Number.NEGATIVE_INFINITY;o.minimum>a&&(t._zod.bag.minimum=o.minimum)}),r._zod.check=t=>{const a=t.value;a.size>=o.minimum||t.issues.push({origin:h.getSizableOrigin(a),code:"too_small",minimum:o.minimum,inclusive:!0,input:a,inst:r,continue:!o.abort})}}),e.$ZodCheckSizeEquals=l.$constructor("$ZodCheckSizeEquals",(r,o)=>{var u;e.$ZodCheck.init(r,o),(u=r._zod.def).when??(u.when=t=>{const a=t.value;return!h.nullish(a)&&a.size!==void 0}),r._zod.onattach.push(t=>{const a=t._zod.bag;a.minimum=o.size,a.maximum=o.size,a.size=o.size}),r._zod.check=t=>{const a=t.value,f=a.size;if(f===o.size)return;const I=f>o.size;t.issues.push({origin:h.getSizableOrigin(a),...I?{code:"too_big",maximum:o.size}:{code:"too_small",minimum:o.size},inclusive:!0,exact:!0,input:t.value,inst:r,continue:!o.abort})}}),e.$ZodCheckMaxLength=l.$constructor("$ZodCheckMaxLength",(r,o)=>{var u;e.$ZodCheck.init(r,o),(u=r._zod.def).when??(u.when=t=>{const a=t.value;return!h.nullish(a)&&a.length!==void 0}),r._zod.onattach.push(t=>{const a=t._zod.bag.maximum??Number.POSITIVE_INFINITY;o.maximum<a&&(t._zod.bag.maximum=o.maximum)}),r._zod.check=t=>{const a=t.value;if(a.length<=o.maximum)return;const I=h.getLengthableOrigin(a);t.issues.push({origin:I,code:"too_big",maximum:o.maximum,inclusive:!0,input:a,inst:r,continue:!o.abort})}}),e.$ZodCheckMinLength=l.$constructor("$ZodCheckMinLength",(r,o)=>{var u;e.$ZodCheck.init(r,o),(u=r._zod.def).when??(u.when=t=>{const a=t.value;return!h.nullish(a)&&a.length!==void 0}),r._zod.onattach.push(t=>{const a=t._zod.bag.minimum??Number.NEGATIVE_INFINITY;o.minimum>a&&(t._zod.bag.minimum=o.minimum)}),r._zod.check=t=>{const a=t.value;if(a.length>=o.minimum)return;const I=h.getLengthableOrigin(a);t.issues.push({origin:I,code:"too_small",minimum:o.minimum,inclusive:!0,input:a,inst:r,continue:!o.abort})}}),e.$ZodCheckLengthEquals=l.$constructor("$ZodCheckLengthEquals",(r,o)=>{var u;e.$ZodCheck.init(r,o),(u=r._zod.def).when??(u.when=t=>{const a=t.value;return!h.nullish(a)&&a.length!==void 0}),r._zod.onattach.push(t=>{const a=t._zod.bag;a.minimum=o.length,a.maximum=o.length,a.length=o.length}),r._zod.check=t=>{const a=t.value,f=a.length;if(f===o.length)return;const I=h.getLengthableOrigin(a),w=f>o.length;t.issues.push({origin:I,...w?{code:"too_big",maximum:o.length}:{code:"too_small",minimum:o.length},inclusive:!0,exact:!0,input:t.value,inst:r,continue:!o.abort})}}),e.$ZodCheckStringFormat=l.$constructor("$ZodCheckStringFormat",(r,o)=>{var u,t;e.$ZodCheck.init(r,o),r._zod.onattach.push(a=>{const f=a._zod.bag;f.format=o.format,o.pattern&&(f.patterns??(f.patterns=new Set),f.patterns.add(o.pattern))}),o.pattern?(u=r._zod).check??(u.check=a=>{o.pattern.lastIndex=0,!o.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:o.format,input:a.value,...o.pattern?{pattern:o.pattern.toString()}:{},inst:r,continue:!o.abort})}):(t=r._zod).check??(t.check=()=>{})}),e.$ZodCheckRegex=l.$constructor("$ZodCheckRegex",(r,o)=>{e.$ZodCheckStringFormat.init(r,o),r._zod.check=u=>{o.pattern.lastIndex=0,!o.pattern.test(u.value)&&u.issues.push({origin:"string",code:"invalid_format",format:"regex",input:u.value,pattern:o.pattern.toString(),inst:r,continue:!o.abort})}}),e.$ZodCheckLowerCase=l.$constructor("$ZodCheckLowerCase",(r,o)=>{o.pattern??(o.pattern=s.lowercase),e.$ZodCheckStringFormat.init(r,o)}),e.$ZodCheckUpperCase=l.$constructor("$ZodCheckUpperCase",(r,o)=>{o.pattern??(o.pattern=s.uppercase),e.$ZodCheckStringFormat.init(r,o)}),e.$ZodCheckIncludes=l.$constructor("$ZodCheckIncludes",(r,o)=>{e.$ZodCheck.init(r,o);const u=h.escapeRegex(o.includes),t=new RegExp(typeof o.position=="number"?`^.{${o.position}}${u}`:u);o.pattern=t,r._zod.onattach.push(a=>{const f=a._zod.bag;f.patterns??(f.patterns=new Set),f.patterns.add(t)}),r._zod.check=a=>{a.value.includes(o.includes,o.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:o.includes,input:a.value,inst:r,continue:!o.abort})}}),e.$ZodCheckStartsWith=l.$constructor("$ZodCheckStartsWith",(r,o)=>{e.$ZodCheck.init(r,o);const u=new RegExp(`^${h.escapeRegex(o.prefix)}.*`);o.pattern??(o.pattern=u),r._zod.onattach.push(t=>{const a=t._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(u)}),r._zod.check=t=>{t.value.startsWith(o.prefix)||t.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:o.prefix,input:t.value,inst:r,continue:!o.abort})}}),e.$ZodCheckEndsWith=l.$constructor("$ZodCheckEndsWith",(r,o)=>{e.$ZodCheck.init(r,o);const u=new RegExp(`.*${h.escapeRegex(o.suffix)}$`);o.pattern??(o.pattern=u),r._zod.onattach.push(t=>{const a=t._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(u)}),r._zod.check=t=>{t.value.endsWith(o.suffix)||t.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:o.suffix,input:t.value,inst:r,continue:!o.abort})}});function i(r,o,u){r.issues.length&&o.issues.push(...h.prefixIssues(u,r.issues))}e.$ZodCheckProperty=l.$constructor("$ZodCheckProperty",(r,o)=>{e.$ZodCheck.init(r,o),r._zod.check=u=>{const t=o.schema._zod.run({value:u.value[o.property],issues:[]},{});if(t instanceof Promise)return t.then(a=>i(a,u,o.property));i(t,u,o.property)}}),e.$ZodCheckMimeType=l.$constructor("$ZodCheckMimeType",(r,o)=>{e.$ZodCheck.init(r,o);const u=new Set(o.mime);r._zod.onattach.push(t=>{t._zod.bag.mime=o.mime}),r._zod.check=t=>{u.has(t.value.type)||t.issues.push({code:"invalid_value",values:o.mime,input:t.value.type,inst:r,continue:!o.abort})}}),e.$ZodCheckOverwrite=l.$constructor("$ZodCheckOverwrite",(r,o)=>{e.$ZodCheck.init(r,o),r._zod.check=u=>{u.value=o.tx(u.value)}})})(qe);var Te={};Object.defineProperty(Te,"__esModule",{value:!0});Te.Doc=void 0;class ua{constructor(n=[]){this.content=[],this.indent=0,this&&(this.args=n)}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n=="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}const m=n.split(`
|
|
3
3
|
`).filter(h=>h),l=Math.min(...m.map(h=>h.length-h.trimStart().length)),s=m.map(h=>h.slice(l)).map(h=>" ".repeat(this.indent*2)+h);for(const h of s)this.content.push(h)}compile(){const n=Function,d=this==null?void 0:this.args,l=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new n(...d,l.join(`
|
|
4
4
|
`))}}Te.Doc=ua;var Ne={};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.version=void 0;Ne.version={major:4,minor:1,patch:12};(function(e){var n=b&&b.__createBinding||(Object.create?function(g,v,_,O){O===void 0&&(O=_);var $=Object.getOwnPropertyDescriptor(v,_);(!$||("get"in $?!v.__esModule:$.writable||$.configurable))&&($={enumerable:!0,get:function(){return v[_]}}),Object.defineProperty(g,O,$)}:function(g,v,_,O){O===void 0&&(O=_),g[O]=v[_]}),d=b&&b.__setModuleDefault||(Object.create?function(g,v){Object.defineProperty(g,"default",{enumerable:!0,value:v})}:function(g,v){g.default=v}),m=b&&b.__importStar||function(g){if(g&&g.__esModule)return g;var v={};if(g!=null)for(var _ in g)_!=="default"&&Object.prototype.hasOwnProperty.call(g,_)&&n(v,g,_);return d(v,g),v};Object.defineProperty(e,"__esModule",{value:!0}),e.$ZodMap=e.$ZodRecord=e.$ZodTuple=e.$ZodIntersection=e.$ZodDiscriminatedUnion=e.$ZodUnion=e.$ZodObjectJIT=e.$ZodObject=e.$ZodArray=e.$ZodDate=e.$ZodVoid=e.$ZodNever=e.$ZodUnknown=e.$ZodAny=e.$ZodNull=e.$ZodUndefined=e.$ZodSymbol=e.$ZodBigIntFormat=e.$ZodBigInt=e.$ZodBoolean=e.$ZodNumberFormat=e.$ZodNumber=e.$ZodCustomStringFormat=e.$ZodJWT=e.$ZodE164=e.$ZodBase64URL=e.$ZodBase64=e.$ZodCIDRv6=e.$ZodCIDRv4=e.$ZodIPv6=e.$ZodIPv4=e.$ZodISODuration=e.$ZodISOTime=e.$ZodISODate=e.$ZodISODateTime=e.$ZodKSUID=e.$ZodXID=e.$ZodULID=e.$ZodCUID2=e.$ZodCUID=e.$ZodNanoID=e.$ZodEmoji=e.$ZodURL=e.$ZodEmail=e.$ZodUUID=e.$ZodGUID=e.$ZodStringFormat=e.$ZodString=e.clone=e.$ZodType=void 0,e.$ZodCustom=e.$ZodLazy=e.$ZodPromise=e.$ZodFunction=e.$ZodTemplateLiteral=e.$ZodReadonly=e.$ZodCodec=e.$ZodPipe=e.$ZodNaN=e.$ZodCatch=e.$ZodSuccess=e.$ZodNonOptional=e.$ZodPrefault=e.$ZodDefault=e.$ZodNullable=e.$ZodOptional=e.$ZodTransform=e.$ZodFile=e.$ZodLiteral=e.$ZodEnum=e.$ZodSet=void 0,e.isValidBase64=t,e.isValidBase64URL=a,e.isValidJWT=f;const l=m(qe),s=m(De),h=Te,y=xt,i=m(Ye),r=m(Z),o=Ne;e.$ZodType=s.$constructor("$ZodType",(g,v)=>{var $;var _;g??(g={}),g._zod.def=v,g._zod.bag=g._zod.bag||{},g._zod.version=o.version;const O=[...g._zod.def.checks??[]];g._zod.traits.has("$ZodCheck")&&O.unshift(g);for(const z of O)for(const T of z._zod.onattach)T(g);if(O.length===0)(_=g._zod).deferred??(_.deferred=[]),($=g._zod.deferred)==null||$.push(()=>{g._zod.run=g._zod.parse});else{const z=(A,M,L)=>{let V=r.aborted(A),G;for(const W of M){if(W._zod.def.when){if(!W._zod.def.when(A))continue}else if(V)continue;const H=A.issues.length,x=W._zod.check(A);if(x instanceof Promise&&(L==null?void 0:L.async)===!1)throw new s.$ZodAsyncError;if(G||x instanceof Promise)G=(G??Promise.resolve()).then(async()=>{await x,A.issues.length!==H&&(V||(V=r.aborted(A,H)))});else{if(A.issues.length===H)continue;V||(V=r.aborted(A,H))}}return G?G.then(()=>A):A},T=(A,M,L)=>{if(r.aborted(A))return A.aborted=!0,A;const V=z(M,O,L);if(V instanceof Promise){if(L.async===!1)throw new s.$ZodAsyncError;return V.then(G=>g._zod.parse(G,L))}return g._zod.parse(V,L)};g._zod.run=(A,M)=>{if(M.skipChecks)return g._zod.parse(A,M);if(M.direction==="backward"){const V=g._zod.parse({value:A.value,issues:[]},{...M,skipChecks:!0});return V instanceof Promise?V.then(G=>T(G,A,M)):T(V,A,M)}const L=g._zod.parse(A,M);if(L instanceof Promise){if(M.async===!1)throw new s.$ZodAsyncError;return L.then(V=>z(V,O,M))}return z(L,O,M)}}g["~standard"]={validate:z=>{var T;try{const A=(0,y.safeParse)(g,z);return A.success?{value:A.data}:{issues:(T=A.error)==null?void 0:T.issues}}catch{return(0,y.safeParseAsync)(g,z).then(M=>{var L;return M.success?{value:M.data}:{issues:(L=M.error)==null?void 0:L.issues}})}},vendor:"zod",version:1}});var u=Z;Object.defineProperty(e,"clone",{enumerable:!0,get:function(){return u.clone}}),e.$ZodString=s.$constructor("$ZodString",(g,v)=>{var _;e.$ZodType.init(g,v),g._zod.pattern=[...((_=g==null?void 0:g._zod.bag)==null?void 0:_.patterns)??[]].pop()??i.string(g._zod.bag),g._zod.parse=(O,$)=>{if(v.coerce)try{O.value=String(O.value)}catch{}return typeof O.value=="string"||O.issues.push({expected:"string",code:"invalid_type",input:O.value,inst:g}),O}}),e.$ZodStringFormat=s.$constructor("$ZodStringFormat",(g,v)=>{l.$ZodCheckStringFormat.init(g,v),e.$ZodString.init(g,v)}),e.$ZodGUID=s.$constructor("$ZodGUID",(g,v)=>{v.pattern??(v.pattern=i.guid),e.$ZodStringFormat.init(g,v)}),e.$ZodUUID=s.$constructor("$ZodUUID",(g,v)=>{if(v.version){const O={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[v.version];if(O===void 0)throw new Error(`Invalid UUID version: "${v.version}"`);v.pattern??(v.pattern=i.uuid(O))}else v.pattern??(v.pattern=i.uuid());e.$ZodStringFormat.init(g,v)}),e.$ZodEmail=s.$constructor("$ZodEmail",(g,v)=>{v.pattern??(v.pattern=i.email),e.$ZodStringFormat.init(g,v)}),e.$ZodURL=s.$constructor("$ZodURL",(g,v)=>{e.$ZodStringFormat.init(g,v),g._zod.check=_=>{try{const O=_.value.trim(),$=new URL(O);v.hostname&&(v.hostname.lastIndex=0,v.hostname.test($.hostname)||_.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:_.value,inst:g,continue:!v.abort})),v.protocol&&(v.protocol.lastIndex=0,v.protocol.test($.protocol.endsWith(":")?$.protocol.slice(0,-1):$.protocol)||_.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:v.protocol.source,input:_.value,inst:g,continue:!v.abort})),v.normalize?_.value=$.href:_.value=O;return}catch{_.issues.push({code:"invalid_format",format:"url",input:_.value,inst:g,continue:!v.abort})}}}),e.$ZodEmoji=s.$constructor("$ZodEmoji",(g,v)=>{v.pattern??(v.pattern=i.emoji()),e.$ZodStringFormat.init(g,v)}),e.$ZodNanoID=s.$constructor("$ZodNanoID",(g,v)=>{v.pattern??(v.pattern=i.nanoid),e.$ZodStringFormat.init(g,v)}),e.$ZodCUID=s.$constructor("$ZodCUID",(g,v)=>{v.pattern??(v.pattern=i.cuid),e.$ZodStringFormat.init(g,v)}),e.$ZodCUID2=s.$constructor("$ZodCUID2",(g,v)=>{v.pattern??(v.pattern=i.cuid2),e.$ZodStringFormat.init(g,v)}),e.$ZodULID=s.$constructor("$ZodULID",(g,v)=>{v.pattern??(v.pattern=i.ulid),e.$ZodStringFormat.init(g,v)}),e.$ZodXID=s.$constructor("$ZodXID",(g,v)=>{v.pattern??(v.pattern=i.xid),e.$ZodStringFormat.init(g,v)}),e.$ZodKSUID=s.$constructor("$ZodKSUID",(g,v)=>{v.pattern??(v.pattern=i.ksuid),e.$ZodStringFormat.init(g,v)}),e.$ZodISODateTime=s.$constructor("$ZodISODateTime",(g,v)=>{v.pattern??(v.pattern=i.datetime(v)),e.$ZodStringFormat.init(g,v)}),e.$ZodISODate=s.$constructor("$ZodISODate",(g,v)=>{v.pattern??(v.pattern=i.date),e.$ZodStringFormat.init(g,v)}),e.$ZodISOTime=s.$constructor("$ZodISOTime",(g,v)=>{v.pattern??(v.pattern=i.time(v)),e.$ZodStringFormat.init(g,v)}),e.$ZodISODuration=s.$constructor("$ZodISODuration",(g,v)=>{v.pattern??(v.pattern=i.duration),e.$ZodStringFormat.init(g,v)}),e.$ZodIPv4=s.$constructor("$ZodIPv4",(g,v)=>{v.pattern??(v.pattern=i.ipv4),e.$ZodStringFormat.init(g,v),g._zod.onattach.push(_=>{const O=_._zod.bag;O.format="ipv4"})}),e.$ZodIPv6=s.$constructor("$ZodIPv6",(g,v)=>{v.pattern??(v.pattern=i.ipv6),e.$ZodStringFormat.init(g,v),g._zod.onattach.push(_=>{const O=_._zod.bag;O.format="ipv6"}),g._zod.check=_=>{try{new URL(`http://[${_.value}]`)}catch{_.issues.push({code:"invalid_format",format:"ipv6",input:_.value,inst:g,continue:!v.abort})}}}),e.$ZodCIDRv4=s.$constructor("$ZodCIDRv4",(g,v)=>{v.pattern??(v.pattern=i.cidrv4),e.$ZodStringFormat.init(g,v)}),e.$ZodCIDRv6=s.$constructor("$ZodCIDRv6",(g,v)=>{v.pattern??(v.pattern=i.cidrv6),e.$ZodStringFormat.init(g,v),g._zod.check=_=>{const O=_.value.split("/");try{if(O.length!==2)throw new Error;const[$,z]=O;if(!z)throw new Error;const T=Number(z);if(`${T}`!==z)throw new Error;if(T<0||T>128)throw new Error;new URL(`http://[${$}]`)}catch{_.issues.push({code:"invalid_format",format:"cidrv6",input:_.value,inst:g,continue:!v.abort})}}});function t(g){if(g==="")return!0;if(g.length%4!==0)return!1;try{return atob(g),!0}catch{return!1}}e.$ZodBase64=s.$constructor("$ZodBase64",(g,v)=>{v.pattern??(v.pattern=i.base64),e.$ZodStringFormat.init(g,v),g._zod.onattach.push(_=>{_._zod.bag.contentEncoding="base64"}),g._zod.check=_=>{t(_.value)||_.issues.push({code:"invalid_format",format:"base64",input:_.value,inst:g,continue:!v.abort})}});function a(g){if(!i.base64url.test(g))return!1;const v=g.replace(/[-_]/g,O=>O==="-"?"+":"/"),_=v.padEnd(Math.ceil(v.length/4)*4,"=");return t(_)}e.$ZodBase64URL=s.$constructor("$ZodBase64URL",(g,v)=>{v.pattern??(v.pattern=i.base64url),e.$ZodStringFormat.init(g,v),g._zod.onattach.push(_=>{_._zod.bag.contentEncoding="base64url"}),g._zod.check=_=>{a(_.value)||_.issues.push({code:"invalid_format",format:"base64url",input:_.value,inst:g,continue:!v.abort})}}),e.$ZodE164=s.$constructor("$ZodE164",(g,v)=>{v.pattern??(v.pattern=i.e164),e.$ZodStringFormat.init(g,v)});function f(g,v=null){try{const _=g.split(".");if(_.length!==3)return!1;const[O]=_;if(!O)return!1;const $=JSON.parse(atob(O));return!("typ"in $&&($==null?void 0:$.typ)!=="JWT"||!$.alg||v&&(!("alg"in $)||$.alg!==v))}catch{return!1}}e.$ZodJWT=s.$constructor("$ZodJWT",(g,v)=>{e.$ZodStringFormat.init(g,v),g._zod.check=_=>{f(_.value,v.alg)||_.issues.push({code:"invalid_format",format:"jwt",input:_.value,inst:g,continue:!v.abort})}}),e.$ZodCustomStringFormat=s.$constructor("$ZodCustomStringFormat",(g,v)=>{e.$ZodStringFormat.init(g,v),g._zod.check=_=>{v.fn(_.value)||_.issues.push({code:"invalid_format",format:v.format,input:_.value,inst:g,continue:!v.abort})}}),e.$ZodNumber=s.$constructor("$ZodNumber",(g,v)=>{e.$ZodType.init(g,v),g._zod.pattern=g._zod.bag.pattern??i.number,g._zod.parse=(_,O)=>{if(v.coerce)try{_.value=Number(_.value)}catch{}const $=_.value;if(typeof $=="number"&&!Number.isNaN($)&&Number.isFinite($))return _;const z=typeof $=="number"?Number.isNaN($)?"NaN":Number.isFinite($)?void 0:"Infinity":void 0;return _.issues.push({expected:"number",code:"invalid_type",input:$,inst:g,...z?{received:z}:{}}),_}}),e.$ZodNumberFormat=s.$constructor("$ZodNumber",(g,v)=>{l.$ZodCheckNumberFormat.init(g,v),e.$ZodNumber.init(g,v)}),e.$ZodBoolean=s.$constructor("$ZodBoolean",(g,v)=>{e.$ZodType.init(g,v),g._zod.pattern=i.boolean,g._zod.parse=(_,O)=>{if(v.coerce)try{_.value=!!_.value}catch{}const $=_.value;return typeof $=="boolean"||_.issues.push({expected:"boolean",code:"invalid_type",input:$,inst:g}),_}}),e.$ZodBigInt=s.$constructor("$ZodBigInt",(g,v)=>{e.$ZodType.init(g,v),g._zod.pattern=i.bigint,g._zod.parse=(_,O)=>{if(v.coerce)try{_.value=BigInt(_.value)}catch{}return typeof _.value=="bigint"||_.issues.push({expected:"bigint",code:"invalid_type",input:_.value,inst:g}),_}}),e.$ZodBigIntFormat=s.$constructor("$ZodBigInt",(g,v)=>{l.$ZodCheckBigIntFormat.init(g,v),e.$ZodBigInt.init(g,v)}),e.$ZodSymbol=s.$constructor("$ZodSymbol",(g,v)=>{e.$ZodType.init(g,v),g._zod.parse=(_,O)=>{const $=_.value;return typeof $=="symbol"||_.issues.push({expected:"symbol",code:"invalid_type",input:$,inst:g}),_}}),e.$ZodUndefined=s.$constructor("$ZodUndefined",(g,v)=>{e.$ZodType.init(g,v),g._zod.pattern=i.undefined,g._zod.values=new Set([void 0]),g._zod.optin="optional",g._zod.optout="optional",g._zod.parse=(_,O)=>{const $=_.value;return typeof $>"u"||_.issues.push({expected:"undefined",code:"invalid_type",input:$,inst:g}),_}}),e.$ZodNull=s.$constructor("$ZodNull",(g,v)=>{e.$ZodType.init(g,v),g._zod.pattern=i.null,g._zod.values=new Set([null]),g._zod.parse=(_,O)=>{const $=_.value;return $===null||_.issues.push({expected:"null",code:"invalid_type",input:$,inst:g}),_}}),e.$ZodAny=s.$constructor("$ZodAny",(g,v)=>{e.$ZodType.init(g,v),g._zod.parse=_=>_}),e.$ZodUnknown=s.$constructor("$ZodUnknown",(g,v)=>{e.$ZodType.init(g,v),g._zod.parse=_=>_}),e.$ZodNever=s.$constructor("$ZodNever",(g,v)=>{e.$ZodType.init(g,v),g._zod.parse=(_,O)=>(_.issues.push({expected:"never",code:"invalid_type",input:_.value,inst:g}),_)}),e.$ZodVoid=s.$constructor("$ZodVoid",(g,v)=>{e.$ZodType.init(g,v),g._zod.parse=(_,O)=>{const $=_.value;return typeof $>"u"||_.issues.push({expected:"void",code:"invalid_type",input:$,inst:g}),_}}),e.$ZodDate=s.$constructor("$ZodDate",(g,v)=>{e.$ZodType.init(g,v),g._zod.parse=(_,O)=>{if(v.coerce)try{_.value=new Date(_.value)}catch{}const $=_.value,z=$ instanceof Date;return z&&!Number.isNaN($.getTime())||_.issues.push({expected:"date",code:"invalid_type",input:$,...z?{received:"Invalid Date"}:{},inst:g}),_}});function I(g,v,_){g.issues.length&&v.issues.push(...r.prefixIssues(_,g.issues)),v.value[_]=g.value}e.$ZodArray=s.$constructor("$ZodArray",(g,v)=>{e.$ZodType.init(g,v),g._zod.parse=(_,O)=>{const $=_.value;if(!Array.isArray($))return _.issues.push({expected:"array",code:"invalid_type",input:$,inst:g}),_;_.value=Array($.length);const z=[];for(let T=0;T<$.length;T++){const A=$[T],M=v.element._zod.run({value:A,issues:[]},O);M instanceof Promise?z.push(M.then(L=>I(L,_,T))):I(M,_,T)}return z.length?Promise.all(z).then(()=>_):_}});function w(g,v,_,O){g.issues.length&&v.issues.push(...r.prefixIssues(_,g.issues)),g.value===void 0?_ in O&&(v.value[_]=void 0):v.value[_]=g.value}function j(g){var O,$,z,T;const v=Object.keys(g.shape);for(const A of v)if(!((T=(z=($=(O=g.shape)==null?void 0:O[A])==null?void 0:$._zod)==null?void 0:z.traits)!=null&&T.has("$ZodType")))throw new Error(`Invalid element at key "${A}": expected a Zod schema`);const _=r.optionalKeys(g.shape);return{...g,keys:v,keySet:new Set(v),numKeys:v.length,optionalKeys:new Set(_)}}function R(g,v,_,O,$,z){const T=[],A=$.keySet,M=$.catchall._zod,L=M.def.type;for(const V of Object.keys(v)){if(A.has(V))continue;if(L==="never"){T.push(V);continue}const G=M.run({value:v[V],issues:[]},O);G instanceof Promise?g.push(G.then(W=>w(W,_,V,v))):w(G,_,V,v)}return T.length&&_.issues.push({code:"unrecognized_keys",keys:T,input:v,inst:z}),g.length?Promise.all(g).then(()=>_):_}e.$ZodObject=s.$constructor("$ZodObject",(g,v)=>{e.$ZodType.init(g,v);const _=Object.getOwnPropertyDescriptor(v,"shape");if(!(_!=null&&_.get)){const A=v.shape;Object.defineProperty(v,"shape",{get:()=>{const M={...A};return Object.defineProperty(v,"shape",{value:M}),M}})}const O=r.cached(()=>j(v));r.defineLazy(g._zod,"propValues",()=>{const A=v.shape,M={};for(const L in A){const V=A[L]._zod;if(V.values){M[L]??(M[L]=new Set);for(const G of V.values)M[L].add(G)}}return M});const $=r.isObject,z=v.catchall;let T;g._zod.parse=(A,M)=>{T??(T=O.value);const L=A.value;if(!$(L))return A.issues.push({expected:"object",code:"invalid_type",input:L,inst:g}),A;A.value={};const V=[],G=T.shape;for(const W of T.keys){const x=G[W]._zod.run({value:L[W],issues:[]},M);x instanceof Promise?V.push(x.then(fe=>w(fe,A,W,L))):w(x,A,W,L)}return z?R(V,L,A,M,O.value,g):V.length?Promise.all(V).then(()=>A):A}}),e.$ZodObjectJIT=s.$constructor("$ZodObjectJIT",(g,v)=>{e.$ZodObject.init(g,v);const _=g._zod.parse,O=r.cached(()=>j(v)),$=W=>{const H=new h.Doc(["shape","payload","ctx"]),x=O.value,fe=ne=>{const ae=r.esc(ne);return`shape[${ae}]._zod.run({ value: input[${ae}], issues: [] }, ctx)`};H.write("const input = payload.value;");const me=Object.create(null);let Qe=0;for(const ne of x.keys)me[ne]=`key_${Qe++}`;H.write("const newResult = {};");for(const ne of x.keys){const ae=me[ne],Oe=r.esc(ne);H.write(`const ${ae} = ${fe(ne)};`),H.write(`
|