@stacksjs/orm 0.72.38 → 0.72.39
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/dist/index.js +2 -2
- package/dist/routes.js +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ Signature verification is impossible without access to the original signed mater
|
|
|
12
12
|
If a webhook request is being forwarded by a third-party tool, ensure that the exact request body, including JSON formatting and new line style, is preserved.
|
|
13
13
|
`+P+`
|
|
14
14
|
`+I})}let h=Math.floor((typeof L==="number"?L:Date.now())/1000)-O.timestamp;if(w>0&&h>w)throw new g(z,H,{message:"Timestamp outside the tolerance zone"});return!0}function G(H,z){if(typeof H!=="string")return null;return z=z||X.EXPECTED_SCHEME,H.split(",").reduce((O,F)=>{let w=F.split("=");if(w[0]==="t")O.timestamp=parseInt(w[1],10);if(w[0]===z)O.signatures.push(w[1]);return O},{timestamp:-1,signatures:[]})}let W=null;function V(){if(!W)W=Z.createDefaultCryptoProvider();return W}function B(H){if(!H)throw new k({message:"Options are required"});let z=H.timestamp&&Math.floor(H.timestamp)||Math.floor(Date.now()/1000),O=H.scheme||X.EXPECTED_SCHEME,F=H.cryptoProvider||V(),w=`${z}.${H.payload}`;return{...H,timestamp:z,scheme:O,cryptoProvider:F,payloadString:w,generateHeaderString:(q)=>{return`t=${z},${O}=${q}`}}}return $.signature=X,$}var N5=_(()=>{E8();T8()});var I9="2026-06-24.dahlia";function t2(Z,$){for(let X in $){if(!Object.prototype.hasOwnProperty.call($,X))continue;let J=X[0].toLowerCase()+X.substring(1),Y=new $[X](Z);this[J]=Y}}function C(Z,$){return function(X){return new t2(X,$)}}var P0;var j9=_(()=>{x();P0=class P0 extends K{create(Z,$){return this._makeRequest("POST","/v2/core/account_links",Z,$)}}});var N0;var S9=_(()=>{x();N0=class N0 extends K{create(Z,$){return this._makeRequest("POST","/v2/core/account_tokens",Z,$,{requestSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v2/core/account_tokens/${encodeURIComponent(Z)}`,$,X)}}});var k0;var M9=_(()=>{x();k0=class k0 extends K{list(Z,$){return this._makeRequest("GET","/v1/financial_connections/accounts",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/financial_connections/accounts/${encodeURIComponent(Z)}`,$,X)}disconnect(Z,$,X){return this._makeRequest("POST",`/v1/financial_connections/accounts/${encodeURIComponent(Z)}/disconnect`,$,X)}refresh(Z,$,X){return this._makeRequest("POST",`/v1/financial_connections/accounts/${encodeURIComponent(Z)}/refresh`,$,X)}subscribe(Z,$,X){return this._makeRequest("POST",`/v1/financial_connections/accounts/${encodeURIComponent(Z)}/subscribe`,$,X)}unsubscribe(Z,$,X){return this._makeRequest("POST",`/v1/financial_connections/accounts/${encodeURIComponent(Z)}/unsubscribe`,$,X)}listOwners(Z,$,X){return this._makeRequest("GET",`/v1/financial_connections/accounts/${encodeURIComponent(Z)}/owners`,$,X,{methodType:"list"})}}});var f9;var k5=_(()=>{x();f9=class f9 extends K{list(Z,$,X){return this._makeRequest("GET",`/v2/core/accounts/${encodeURIComponent(Z)}/persons`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}})}create(Z,$,X){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(Z)}/persons`,$,X,{requestSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}})}del(Z,$,X,J){return this._makeRequest("DELETE",`/v2/core/accounts/${encodeURIComponent(Z)}/persons/${encodeURIComponent($)}`,X,J)}retrieve(Z,$,X,J){return this._makeRequest("GET",`/v2/core/accounts/${encodeURIComponent(Z)}/persons/${encodeURIComponent($)}`,X,J,{responseSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}})}update(Z,$,X,J){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(Z)}/persons/${encodeURIComponent($)}`,X,J,{requestSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}})}}});var y9;var I5=_(()=>{x();y9=class y9 extends K{create(Z,$,X){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(Z)}/person_tokens`,$,X,{requestSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}})}retrieve(Z,$,X,J){return this._makeRequest("GET",`/v2/core/accounts/${encodeURIComponent(Z)}/person_tokens/${encodeURIComponent($)}`,X,J)}}});var I0;var h9=_(()=>{x();k5();I5();I0=class I0 extends K{constructor(Z){super(Z);this.stripe=Z,this.persons=new f9(Z),this.personTokens=new y9(Z)}list(Z,$){return this._makeRequest("GET","/v2/core/accounts",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v2/core/accounts",Z,$,{requestSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}},responseSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v2/core/accounts/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}},responseSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}close(Z,$,X){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(Z)}/close`,$,X,{responseSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}}});var j0;var v9=_(()=>{x();j0=class j0 extends K{list(Z,$){return this._makeRequest("GET","/v1/entitlements/active_entitlements",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/entitlements/active_entitlements/${encodeURIComponent(Z)}`,$,X)}}});var S0;var R9=_(()=>{x();S0=class S0 extends K{list(Z,$){return this._makeRequest("GET","/v1/billing/alerts",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/billing/alerts",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/billing/alerts/${encodeURIComponent(Z)}`,$,X)}activate(Z,$,X){return this._makeRequest("POST",`/v1/billing/alerts/${encodeURIComponent(Z)}/activate`,$,X)}archive(Z,$,X){return this._makeRequest("POST",`/v1/billing/alerts/${encodeURIComponent(Z)}/archive`,$,X)}deactivate(Z,$,X){return this._makeRequest("POST",`/v1/billing/alerts/${encodeURIComponent(Z)}/deactivate`,$,X)}}});var M0;var b9=_(()=>{x();M0=class M0 extends K{find(Z,$){return this._makeRequest("GET","/v1/tax/associations/find",Z,$)}}});var f0;var g9=_(()=>{x();f0=class f0 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/authorizations",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/authorizations/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/authorizations/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}approve(Z,$,X){return this._makeRequest("POST",`/v1/issuing/authorizations/${encodeURIComponent(Z)}/approve`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}decline(Z,$,X){return this._makeRequest("POST",`/v1/issuing/authorizations/${encodeURIComponent(Z)}/decline`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}}});var y0;var u9=_(()=>{x();y0=class y0 extends K{create(Z,$){return this._makeRequest("POST","/v1/test_helpers/issuing/authorizations",Z,$,{requestSchema:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}capture(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(Z)}/capture`,$,X,{requestSchema:{kind:"object",fields:{purchase_details:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}},receipt:{kind:"array",element:{kind:"object",fields:{quantity:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}expire(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(Z)}/expire`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}finalizeAmount(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(Z)}/finalize_amount`,$,X,{requestSchema:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}respond(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(Z)}/fraud_challenges/respond`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}increment(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(Z)}/increment`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}reverse(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(Z)}/reverse`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}}});var h0;var c9=_(()=>{x();h0=class h0 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax/calculations/${encodeURIComponent(Z)}`,$,X)}create(Z,$){return this._makeRequest("POST","/v1/tax/calculations",Z,$)}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/tax/calculations/${encodeURIComponent(Z)}/line_items`,$,X,{methodType:"list"})}}});var v0;var m9=_(()=>{x();v0=class v0 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/cardholders",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/issuing/cardholders",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/cardholders/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/cardholders/${encodeURIComponent(Z)}`,$,X)}}});var R0;var l9=_(()=>{x();R0=class R0 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/cards",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/issuing/cards",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/cards/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/cards/${encodeURIComponent(Z)}`,$,X)}}});var b0;var d9=_(()=>{x();b0=class b0 extends K{deliverCard(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(Z)}/shipping/deliver`,$,X)}failCard(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(Z)}/shipping/fail`,$,X)}returnCard(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(Z)}/shipping/return`,$,X)}shipCard(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(Z)}/shipping/ship`,$,X)}submitCard(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(Z)}/shipping/submit`,$,X)}}});var g0;var n9=_(()=>{x();g0=class g0 extends K{list(Z,$){return this._makeRequest("GET","/v1/billing_portal/configurations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/billing_portal/configurations",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/billing_portal/configurations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/billing_portal/configurations/${encodeURIComponent(Z)}`,$,X)}}});var u0;var p9=_(()=>{x();u0=class u0 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/terminal/configurations/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/terminal/configurations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/terminal/configurations/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/terminal/configurations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/terminal/configurations",Z,$)}}});var c0;var i9=_(()=>{x();c0=class c0 extends K{create(Z,$){return this._makeRequest("POST","/v1/test_helpers/confirmation_tokens",Z,$)}}});var m0;var r9=_(()=>{x();m0=class m0 extends K{create(Z,$){return this._makeRequest("POST","/v1/terminal/connection_tokens",Z,$)}}});var l0;var t9=_(()=>{x();l0=class l0 extends K{retrieve(Z,$){return this._makeRequest("GET","/v1/billing/credit_balance_summary",Z,$)}}});var d0;var s9=_(()=>{x();d0=class d0 extends K{list(Z,$){return this._makeRequest("GET","/v1/billing/credit_balance_transactions",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/billing/credit_balance_transactions/${encodeURIComponent(Z)}`,$,X)}}});var n0;var o9=_(()=>{x();n0=class n0 extends K{list(Z,$){return this._makeRequest("GET","/v1/billing/credit_grants",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/billing/credit_grants",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/billing/credit_grants/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/billing/credit_grants/${encodeURIComponent(Z)}`,$,X)}expire(Z,$,X){return this._makeRequest("POST",`/v1/billing/credit_grants/${encodeURIComponent(Z)}/expire`,$,X)}voidGrant(Z,$,X){return this._makeRequest("POST",`/v1/billing/credit_grants/${encodeURIComponent(Z)}/void`,$,X)}}});var p0;var a9=_(()=>{x();p0=class p0 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/credit_reversals",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/treasury/credit_reversals",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/credit_reversals/${encodeURIComponent(Z)}`,$,X)}}});var i0;var e9=_(()=>{x();i0=class i0 extends K{fundCashBalance(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/customers/${encodeURIComponent(Z)}/fund_cash_balance`,$,X)}}});var r0;var Z1=_(()=>{x();r0=class r0 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/debit_reversals",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/treasury/debit_reversals",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/debit_reversals/${encodeURIComponent(Z)}`,$,X)}}});var t0;var $1=_(()=>{x();t0=class t0 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/disputes",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/issuing/disputes",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/disputes/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/disputes/${encodeURIComponent(Z)}`,$,X)}submit(Z,$,X){return this._makeRequest("POST",`/v1/issuing/disputes/${encodeURIComponent(Z)}/submit`,$,X)}}});var s0;var X1=_(()=>{x();s0=class s0 extends K{list(Z,$){return this._makeRequest("GET","/v1/radar/early_fraud_warnings",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/radar/early_fraud_warnings/${encodeURIComponent(Z)}`,$,X)}}});var o0;var J1=_(()=>{x();o0=class o0 extends K{list(Z,$){return this._makeRequest("GET","/v2/core/event_destinations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v2/core/event_destinations",Z,$)}del(Z,$,X){return this._makeRequest("DELETE",`/v2/core/event_destinations/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v2/core/event_destinations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v2/core/event_destinations/${encodeURIComponent(Z)}`,$,X)}disable(Z,$,X){return this._makeRequest("POST",`/v2/core/event_destinations/${encodeURIComponent(Z)}/disable`,$,X)}enable(Z,$,X){return this._makeRequest("POST",`/v2/core/event_destinations/${encodeURIComponent(Z)}/enable`,$,X)}ping(Z,$,X){return this._makeRequest("POST",`/v2/core/event_destinations/${encodeURIComponent(Z)}/ping`,$,X)}}});var a0;var Y1=_(()=>{x();a0=class a0 extends K{list(Z,$){let X=(J)=>{return{...J,data:J.data.map(this.addFetchRelatedObjectIfNeeded.bind(this))}};return this._makeRequest("GET","/v2/core/events",Z,$,{methodType:"list",transformResponseData:X})}retrieve(Z,$,X){let J=(Y)=>{return this.addFetchRelatedObjectIfNeeded(Y)};return this._makeRequest("GET",`/v2/core/events/${encodeURIComponent(Z)}`,$,X,{transformResponseData:J})}addFetchRelatedObjectIfNeeded(Z){if(!Z.related_object||!Z.related_object.url)return Z;return{...Z,fetchRelatedObject:()=>this._makeRequest("GET",Z.related_object.url,void 0,{stripeContext:Z.context,headers:{"Stripe-Request-Trigger":`event=${Z.id}`}})}}}});var e0;var Q1=_(()=>{x();e0=class e0 extends K{list(Z,$){return this._makeRequest("GET","/v1/entitlements/features",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/entitlements/features",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/entitlements/features/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/entitlements/features/${encodeURIComponent(Z)}`,$,X)}}});var Z4;var G1=_(()=>{x();Z4=class Z4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/financial_accounts",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/treasury/financial_accounts",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/financial_accounts/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/treasury/financial_accounts/${encodeURIComponent(Z)}`,$,X)}close(Z,$,X){return this._makeRequest("POST",`/v1/treasury/financial_accounts/${encodeURIComponent(Z)}/close`,$,X)}updateFeatures(Z,$,X){return this._makeRequest("POST",`/v1/treasury/financial_accounts/${encodeURIComponent(Z)}/features`,$,X)}retrieveFeatures(Z,$,X){return this._makeRequest("GET",`/v1/treasury/financial_accounts/${encodeURIComponent(Z)}/features`,$,X)}}});var $4;var W1=_(()=>{x();$4=class $4 extends K{list(Z,$){return this._makeRequest("GET","/v2/commerce/product_catalog/imports",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{status_details:{kind:"object",fields:{processing:{kind:"object",fields:{error_count:{kind:"int64_string"},success_count:{kind:"int64_string"}}},succeeded:{kind:"object",fields:{success_count:{kind:"int64_string"}}},succeeded_with_errors:{kind:"object",fields:{error_count:{kind:"int64_string"},error_file:{kind:"object",fields:{size:{kind:"int64_string"}}},samples:{kind:"array",element:{kind:"object",fields:{row:{kind:"int64_string"}}}},success_count:{kind:"int64_string"}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v2/commerce/product_catalog/imports",Z,$,{responseSchema:{kind:"object",fields:{status_details:{kind:"object",fields:{processing:{kind:"object",fields:{error_count:{kind:"int64_string"},success_count:{kind:"int64_string"}}},succeeded:{kind:"object",fields:{success_count:{kind:"int64_string"}}},succeeded_with_errors:{kind:"object",fields:{error_count:{kind:"int64_string"},error_file:{kind:"object",fields:{size:{kind:"int64_string"}}},samples:{kind:"array",element:{kind:"object",fields:{row:{kind:"int64_string"}}}},success_count:{kind:"int64_string"}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v2/commerce/product_catalog/imports/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{status_details:{kind:"object",fields:{processing:{kind:"object",fields:{error_count:{kind:"int64_string"},success_count:{kind:"int64_string"}}},succeeded:{kind:"object",fields:{success_count:{kind:"int64_string"}}},succeeded_with_errors:{kind:"object",fields:{error_count:{kind:"int64_string"},error_file:{kind:"object",fields:{size:{kind:"int64_string"}}},samples:{kind:"array",element:{kind:"object",fields:{row:{kind:"int64_string"}}}},success_count:{kind:"int64_string"}}}}}}}})}}});var X4;var B1=_(()=>{x();X4=class X4 extends K{fail(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/inbound_transfers/${encodeURIComponent(Z)}/fail`,$,X)}returnInboundTransfer(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/inbound_transfers/${encodeURIComponent(Z)}/return`,$,X)}succeed(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/inbound_transfers/${encodeURIComponent(Z)}/succeed`,$,X)}}});var J4;var V1=_(()=>{x();J4=class J4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/inbound_transfers",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/treasury/inbound_transfers",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/inbound_transfers/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/treasury/inbound_transfers/${encodeURIComponent(Z)}/cancel`,$,X)}}});var Y4;var K1=_(()=>{x();Y4=class Y4 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/terminal/locations/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/terminal/locations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/terminal/locations/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/terminal/locations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/terminal/locations",Z,$)}}});var Q4;var H1=_(()=>{x();Q4=class Q4 extends K{create(Z,$){return this._makeRequest("POST","/v1/billing/meter_event_adjustments",Z,$)}}});var G4;var z1=_(()=>{x();G4=class G4 extends K{create(Z,$){return this._makeRequest("POST","/v2/billing/meter_event_adjustments",Z,$)}}});var W4;var O1=_(()=>{x();W4=class W4 extends K{create(Z,$){return this._makeRequest("POST","/v2/billing/meter_event_session",Z,$)}}});var B4;var _1=_(()=>{x();B4=class B4 extends K{create(Z,$){return this._makeRequest("POST","/v2/billing/meter_event_stream",Z,$,{apiBase:"meter_events"})}}});var V4;var F1=_(()=>{x();V4=class V4 extends K{create(Z,$){return this._makeRequest("POST","/v1/billing/meter_events",Z,$)}}});var K4;var w1=_(()=>{x();K4=class K4 extends K{create(Z,$){return this._makeRequest("POST","/v2/billing/meter_events",Z,$)}}});var H4;var x1=_(()=>{x();H4=class H4 extends K{list(Z,$){return this._makeRequest("GET","/v1/billing/meters",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/billing/meters",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/billing/meters/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/billing/meters/${encodeURIComponent(Z)}`,$,X)}deactivate(Z,$,X){return this._makeRequest("POST",`/v1/billing/meters/${encodeURIComponent(Z)}/deactivate`,$,X)}reactivate(Z,$,X){return this._makeRequest("POST",`/v1/billing/meters/${encodeURIComponent(Z)}/reactivate`,$,X)}listEventSummaries(Z,$,X){return this._makeRequest("GET",`/v1/billing/meters/${encodeURIComponent(Z)}/event_summaries`,$,X,{methodType:"list"})}}});var z4;var T1=_(()=>{x();z4=class z4 extends K{create(Z,$){return this._makeRequest("POST","/v1/terminal/onboarding_links",Z,$)}}});var O4;var U1=_(()=>{x();O4=class O4 extends K{list(Z,$){return this._makeRequest("GET","/v1/climate/orders",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/climate/orders",Z,$,{requestSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/climate/orders/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/climate/orders/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}})}cancel(Z,$,X){return this._makeRequest("POST",`/v1/climate/orders/${encodeURIComponent(Z)}/cancel`,$,X,{responseSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}})}}});var _4;var q1=_(()=>{x();_4=class _4 extends K{update(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_payments/${encodeURIComponent(Z)}`,$,X)}fail(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_payments/${encodeURIComponent(Z)}/fail`,$,X)}post(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_payments/${encodeURIComponent(Z)}/post`,$,X)}returnOutboundPayment(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_payments/${encodeURIComponent(Z)}/return`,$,X)}}});var F4;var L1=_(()=>{x();F4=class F4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/outbound_payments",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/treasury/outbound_payments",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/outbound_payments/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/treasury/outbound_payments/${encodeURIComponent(Z)}/cancel`,$,X)}}});var w4;var D1=_(()=>{x();w4=class w4 extends K{update(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_transfers/${encodeURIComponent(Z)}`,$,X)}fail(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_transfers/${encodeURIComponent(Z)}/fail`,$,X)}post(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_transfers/${encodeURIComponent(Z)}/post`,$,X)}returnOutboundTransfer(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_transfers/${encodeURIComponent(Z)}/return`,$,X)}}});var x4;var A1=_(()=>{x();x4=class x4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/outbound_transfers",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/treasury/outbound_transfers",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/outbound_transfers/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/treasury/outbound_transfers/${encodeURIComponent(Z)}/cancel`,$,X)}}});var T4;var E1=_(()=>{x();T4=class T4 extends K{create(Z,$){return this._makeRequest("POST","/v1/radar/payment_evaluations",Z,$)}}});var U4;var C1=_(()=>{x();U4=class U4 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/personalization_designs",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/issuing/personalization_designs",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/personalization_designs/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/personalization_designs/${encodeURIComponent(Z)}`,$,X)}}});var q4;var P1=_(()=>{x();q4=class q4 extends K{activate(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/personalization_designs/${encodeURIComponent(Z)}/activate`,$,X)}deactivate(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/personalization_designs/${encodeURIComponent(Z)}/deactivate`,$,X)}reject(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/personalization_designs/${encodeURIComponent(Z)}/reject`,$,X)}}});var L4;var N1=_(()=>{x();L4=class L4 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/physical_bundles",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/physical_bundles/${encodeURIComponent(Z)}`,$,X)}}});var D4;var k1=_(()=>{x();D4=class D4 extends K{list(Z,$){return this._makeRequest("GET","/v1/climate/products",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{metric_tons_available:{kind:"decimal_string"}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/climate/products/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{metric_tons_available:{kind:"decimal_string"}}}})}}});var A4;var I1=_(()=>{x();A4=class A4 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/terminal/readers/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/terminal/readers/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/terminal/readers",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/terminal/readers",Z,$)}cancelAction(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/cancel_action`,$,X)}collectInputs(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/collect_inputs`,$,X)}collectPaymentMethod(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/collect_payment_method`,$,X)}confirmPaymentIntent(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/confirm_payment_intent`,$,X)}processPaymentIntent(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/process_payment_intent`,$,X)}processSetupIntent(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/process_setup_intent`,$,X)}refundPayment(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/refund_payment`,$,X)}setReaderDisplay(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/set_reader_display`,$,X)}}});var E4;var j1=_(()=>{x();E4=class E4 extends K{presentPaymentMethod(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/terminal/readers/${encodeURIComponent(Z)}/present_payment_method`,$,X)}succeedInputCollection(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/terminal/readers/${encodeURIComponent(Z)}/succeed_input_collection`,$,X)}timeoutInputCollection(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/terminal/readers/${encodeURIComponent(Z)}/timeout_input_collection`,$,X)}}});var C4;var S1=_(()=>{x();C4=class C4 extends K{create(Z,$){return this._makeRequest("POST","/v1/test_helpers/treasury/received_credits",Z,$)}}});var P4;var M1=_(()=>{x();P4=class P4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/received_credits",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/received_credits/${encodeURIComponent(Z)}`,$,X)}}});var N4;var f1=_(()=>{x();N4=class N4 extends K{create(Z,$){return this._makeRequest("POST","/v1/test_helpers/treasury/received_debits",Z,$)}}});var k4;var y1=_(()=>{x();k4=class k4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/received_debits",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/received_debits/${encodeURIComponent(Z)}`,$,X)}}});var I4;var h1=_(()=>{x();I4=class I4 extends K{expire(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/refunds/${encodeURIComponent(Z)}/expire`,$,X)}}});var j4;var v1=_(()=>{x();j4=class j4 extends K{list(Z,$){return this._makeRequest("GET","/v1/tax/registrations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/tax/registrations",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax/registrations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/tax/registrations/${encodeURIComponent(Z)}`,$,X)}}});var S4;var R1=_(()=>{x();S4=class S4 extends K{list(Z,$){return this._makeRequest("GET","/v1/reporting/report_runs",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/reporting/report_runs",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/reporting/report_runs/${encodeURIComponent(Z)}`,$,X)}}});var M4;var b1=_(()=>{x();M4=class M4 extends K{list(Z,$){return this._makeRequest("GET","/v1/reporting/report_types",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/reporting/report_types/${encodeURIComponent(Z)}`,$,X)}}});var f4;var g1=_(()=>{x();f4=class f4 extends K{list(Z,$){return this._makeRequest("GET","/v1/forwarding/requests",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/forwarding/requests",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/forwarding/requests/${encodeURIComponent(Z)}`,$,X)}}});var y4;var u1=_(()=>{x();y4=class y4 extends K{list(Z,$){return this._makeRequest("GET","/v1/sigma/scheduled_query_runs",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/sigma/scheduled_query_runs/${encodeURIComponent(Z)}`,$,X)}}});var h4;var c1=_(()=>{x();h4=class h4 extends K{list(Z,$){return this._makeRequest("GET","/v1/apps/secrets",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/apps/secrets",Z,$)}find(Z,$){return this._makeRequest("GET","/v1/apps/secrets/find",Z,$)}deleteWhere(Z,$){return this._makeRequest("POST","/v1/apps/secrets/delete",Z,$)}}});var v4;var m1=_(()=>{x();v4=class v4 extends K{create(Z,$){return this._makeRequest("POST","/v1/billing_portal/sessions",Z,$)}}});var R4;var l1=_(()=>{x();R4=class R4 extends K{list(Z,$){return this._makeRequest("GET","/v1/checkout/sessions",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/checkout/sessions",Z,$,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/checkout/sessions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/checkout/sessions/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}expire(Z,$,X){return this._makeRequest("POST",`/v1/checkout/sessions/${encodeURIComponent(Z)}/expire`,$,X,{responseSchema:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/checkout/sessions/${encodeURIComponent(Z)}/line_items`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}}});var b4;var d1=_(()=>{x();b4=class b4 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/financial_connections/sessions/${encodeURIComponent(Z)}`,$,X)}create(Z,$){return this._makeRequest("POST","/v1/financial_connections/sessions",Z,$)}}});var g4;var n1=_(()=>{x();g4=class g4 extends K{retrieve(Z,$){return this._makeRequest("GET","/v1/tax/settings",Z,$)}update(Z,$){return this._makeRequest("POST","/v1/tax/settings",Z,$)}}});var u4;var p1=_(()=>{x();u4=class u4 extends K{list(Z,$){return this._makeRequest("GET","/v1/climate/suppliers",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/climate/suppliers/${encodeURIComponent(Z)}`,$,X)}}});var c4;var i1=_(()=>{x();c4=class c4 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/test_helpers/test_clocks/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/test_helpers/test_clocks/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/test_helpers/test_clocks",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/test_helpers/test_clocks",Z,$)}advance(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/test_clocks/${encodeURIComponent(Z)}/advance`,$,X)}}});var m4;var r1=_(()=>{x();m4=class m4 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/tokens",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/tokens/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/tokens/${encodeURIComponent(Z)}`,$,X)}}});var l4;var t1=_(()=>{x();l4=class l4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/transaction_entries",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{flow_details:{kind:"nullable",inner:{kind:"object",fields:{issuing_authorization:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/transaction_entries/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{flow_details:{kind:"nullable",inner:{kind:"object",fields:{issuing_authorization:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}}}})}}});var d4;var s1=_(()=>{x();d4=class d4 extends K{list(Z,$){return this._makeRequest("GET","/v1/financial_connections/transactions",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/financial_connections/transactions/${encodeURIComponent(Z)}`,$,X)}}});var n4;var o1=_(()=>{x();n4=class n4 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/transactions",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/transactions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/transactions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}}});var p4;var a1=_(()=>{x();p4=class p4 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax/transactions/${encodeURIComponent(Z)}`,$,X)}createFromCalculation(Z,$){return this._makeRequest("POST","/v1/tax/transactions/create_from_calculation",Z,$)}createReversal(Z,$){return this._makeRequest("POST","/v1/tax/transactions/create_reversal",Z,$)}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/tax/transactions/${encodeURIComponent(Z)}/line_items`,$,X,{methodType:"list"})}}});var i4;var e1=_(()=>{x();i4=class i4 extends K{refund(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/transactions/${encodeURIComponent(Z)}/refund`,$,X,{responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}createForceCapture(Z,$){return this._makeRequest("POST","/v1/test_helpers/issuing/transactions/create_force_capture",Z,$,{requestSchema:{kind:"object",fields:{purchase_details:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}},receipt:{kind:"array",element:{kind:"object",fields:{quantity:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}createUnlinkedRefund(Z,$){return this._makeRequest("POST","/v1/test_helpers/issuing/transactions/create_unlinked_refund",Z,$,{requestSchema:{kind:"object",fields:{purchase_details:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}},receipt:{kind:"array",element:{kind:"object",fields:{quantity:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}}});var r4;var ZZ=_(()=>{x();r4=class r4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/transactions",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{entries:{kind:"nullable",inner:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{flow_details:{kind:"nullable",inner:{kind:"object",fields:{issuing_authorization:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/transactions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{entries:{kind:"nullable",inner:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{flow_details:{kind:"nullable",inner:{kind:"object",fields:{issuing_authorization:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}}}}}})}}});var t4;var $Z=_(()=>{x();t4=class t4 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/radar/value_list_items/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/radar/value_list_items/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/radar/value_list_items",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/radar/value_list_items",Z,$)}}});var s4;var XZ=_(()=>{x();s4=class s4 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/radar/value_lists/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/radar/value_lists/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/radar/value_lists/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/radar/value_lists",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/radar/value_lists",Z,$)}}});var o4;var JZ=_(()=>{x();o4=class o4 extends K{list(Z,$){return this._makeRequest("GET","/v1/identity/verification_reports",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/identity/verification_reports/${encodeURIComponent(Z)}`,$,X)}}});var a4;var YZ=_(()=>{x();a4=class a4 extends K{list(Z,$){return this._makeRequest("GET","/v1/identity/verification_sessions",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/identity/verification_sessions",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/identity/verification_sessions/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/identity/verification_sessions/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/identity/verification_sessions/${encodeURIComponent(Z)}/cancel`,$,X)}redact(Z,$,X){return this._makeRequest("POST",`/v1/identity/verification_sessions/${encodeURIComponent(Z)}/redact`,$,X)}}});var Y0;var C8=_(()=>{x();Y0=class Y0 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/accounts/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){if(typeof Z==="string")return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}`,$,X);else return this._makeRequest("GET","/v1/account",$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}`,$,X)}retrieveCurrent(Z,$){return this._makeRequest("GET","/v1/account",Z,$)}list(Z,$){return this._makeRequest("GET","/v1/accounts",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/accounts",Z,$)}reject(Z,$,X){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/reject`,$,X)}listCapabilities(Z,$,X){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}/capabilities`,$,X,{methodType:"list"})}retrieveCapability(Z,$,X,J){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}/capabilities/${encodeURIComponent($)}`,X,J)}updateCapability(Z,$,X,J){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/capabilities/${encodeURIComponent($)}`,X,J)}deleteExternalAccount(Z,$,X,J){return this._makeRequest("DELETE",`/v1/accounts/${encodeURIComponent(Z)}/external_accounts/${encodeURIComponent($)}`,X,J)}retrieveExternalAccount(Z,$,X,J){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}/external_accounts/${encodeURIComponent($)}`,X,J)}updateExternalAccount(Z,$,X,J){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/external_accounts/${encodeURIComponent($)}`,X,J)}listExternalAccounts(Z,$,X){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}/external_accounts`,$,X,{methodType:"list"})}createExternalAccount(Z,$,X){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/external_accounts`,$,X)}createLoginLink(Z,$,X){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/login_links`,$,X)}deletePerson(Z,$,X,J){return this._makeRequest("DELETE",`/v1/accounts/${encodeURIComponent(Z)}/persons/${encodeURIComponent($)}`,X,J)}retrievePerson(Z,$,X,J){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}/persons/${encodeURIComponent($)}`,X,J)}updatePerson(Z,$,X,J){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/persons/${encodeURIComponent($)}`,X,J)}listPersons(Z,$,X){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}/persons`,$,X,{methodType:"list"})}createPerson(Z,$,X){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/persons`,$,X)}}});var e4;var QZ=_(()=>{x();e4=class e4 extends K{create(Z,$){return this._makeRequest("POST","/v1/account_links",Z,$)}}});var Z6;var GZ=_(()=>{x();Z6=class Z6 extends K{create(Z,$){return this._makeRequest("POST","/v1/account_sessions",Z,$)}}});var $6;var WZ=_(()=>{x();$6=class $6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/apple_pay/domains/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/apple_pay/domains/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/apple_pay/domains",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/apple_pay/domains",Z,$)}}});var X6;var BZ=_(()=>{x();X6=class X6 extends K{list(Z,$){return this._makeRequest("GET","/v1/application_fees",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/application_fees/${encodeURIComponent(Z)}`,$,X)}retrieveRefund(Z,$,X,J){return this._makeRequest("GET",`/v1/application_fees/${encodeURIComponent(Z)}/refunds/${encodeURIComponent($)}`,X,J)}updateRefund(Z,$,X,J){return this._makeRequest("POST",`/v1/application_fees/${encodeURIComponent(Z)}/refunds/${encodeURIComponent($)}`,X,J)}listRefunds(Z,$,X){return this._makeRequest("GET",`/v1/application_fees/${encodeURIComponent(Z)}/refunds`,$,X,{methodType:"list"})}createRefund(Z,$,X){return this._makeRequest("POST",`/v1/application_fees/${encodeURIComponent(Z)}/refunds`,$,X)}}});var Q0;var P8=_(()=>{x();Q0=class Q0 extends K{retrieve(Z,$){return this._makeRequest("GET","/v1/balance",Z,$)}}});var J6;var VZ=_(()=>{x();J6=class J6 extends K{retrieve(Z,$){return this._makeRequest("GET","/v1/balance_settings",Z,$)}update(Z,$){return this._makeRequest("POST","/v1/balance_settings",Z,$)}}});var Y6;var KZ=_(()=>{x();Y6=class Y6 extends K{list(Z,$){return this._makeRequest("GET","/v1/balance_transactions",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/balance_transactions/${encodeURIComponent(Z)}`,$,X)}}});var Q6;var HZ=_(()=>{x();Q6=class Q6 extends K{list(Z,$){return this._makeRequest("GET","/v1/charges",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/charges",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/charges/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/charges/${encodeURIComponent(Z)}`,$,X)}search(Z,$){return this._makeRequest("GET","/v1/charges/search",Z,$,{methodType:"search"})}capture(Z,$,X){return this._makeRequest("POST",`/v1/charges/${encodeURIComponent(Z)}/capture`,$,X)}}});var G6;var zZ=_(()=>{x();G6=class G6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/confirmation_tokens/${encodeURIComponent(Z)}`,$,X)}}});var W6;var OZ=_(()=>{x();W6=class W6 extends K{list(Z,$){return this._makeRequest("GET","/v1/country_specs",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/country_specs/${encodeURIComponent(Z)}`,$,X)}}});var B6;var _Z=_(()=>{x();B6=class B6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/coupons/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/coupons/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/coupons/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/coupons",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/coupons",Z,$)}}});var V6;var FZ=_(()=>{x();V6=class V6 extends K{list(Z,$){return this._makeRequest("GET","/v1/credit_notes",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/credit_notes",Z,$,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/credit_notes/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/credit_notes/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}preview(Z,$){return this._makeRequest("GET","/v1/credit_notes/preview",Z,$,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}voidCreditNote(Z,$,X){return this._makeRequest("POST",`/v1/credit_notes/${encodeURIComponent(Z)}/void`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}listPreviewLineItems(Z,$){return this._makeRequest("GET","/v1/credit_notes/preview/lines",Z,$,{methodType:"list",requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/credit_notes/${encodeURIComponent(Z)}/lines`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}}});var K6;var wZ=_(()=>{x();K6=class K6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/customers/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{subscriptions:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}deleteDiscount(Z,$,X){return this._makeRequest("DELETE",`/v1/customers/${encodeURIComponent(Z)}/discount`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/customers",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{subscriptions:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/customers",Z,$,{responseSchema:{kind:"object",fields:{subscriptions:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}search(Z,$){return this._makeRequest("GET","/v1/customers/search",Z,$,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{subscriptions:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}})}listBalanceTransactions(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/balance_transactions`,$,X,{methodType:"list"})}createBalanceTransaction(Z,$,X){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/balance_transactions`,$,X)}retrieveBalanceTransaction(Z,$,X,J){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/balance_transactions/${encodeURIComponent($)}`,X,J)}updateBalanceTransaction(Z,$,X,J){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/balance_transactions/${encodeURIComponent($)}`,X,J)}retrieveCashBalance(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/cash_balance`,$,X)}updateCashBalance(Z,$,X){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/cash_balance`,$,X)}listCashBalanceTransactions(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/cash_balance_transactions`,$,X,{methodType:"list"})}retrieveCashBalanceTransaction(Z,$,X,J){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/cash_balance_transactions/${encodeURIComponent($)}`,X,J)}createFundingInstructions(Z,$,X){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/funding_instructions`,$,X)}listPaymentMethods(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/payment_methods`,$,X,{methodType:"list"})}retrievePaymentMethod(Z,$,X,J){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/payment_methods/${encodeURIComponent($)}`,X,J)}listSources(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/sources`,$,X,{methodType:"list"})}createSource(Z,$,X){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/sources`,$,X)}retrieveSource(Z,$,X,J){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/sources/${encodeURIComponent($)}`,X,J)}updateSource(Z,$,X,J){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/sources/${encodeURIComponent($)}`,X,J)}deleteSource(Z,$,X,J){return this._makeRequest("DELETE",`/v1/customers/${encodeURIComponent(Z)}/sources/${encodeURIComponent($)}`,X,J)}verifySource(Z,$,X,J){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/sources/${encodeURIComponent($)}/verify`,X,J)}deleteTaxId(Z,$,X,J){return this._makeRequest("DELETE",`/v1/customers/${encodeURIComponent(Z)}/tax_ids/${encodeURIComponent($)}`,X,J)}retrieveTaxId(Z,$,X,J){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/tax_ids/${encodeURIComponent($)}`,X,J)}listTaxIds(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/tax_ids`,$,X,{methodType:"list"})}createTaxId(Z,$,X){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/tax_ids`,$,X)}}});var H6;var xZ=_(()=>{x();H6=class H6 extends K{create(Z,$){return this._makeRequest("POST","/v1/customer_sessions",Z,$)}}});var z6;var TZ=_(()=>{x();z6=class z6 extends K{list(Z,$){return this._makeRequest("GET","/v1/disputes",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/disputes/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/disputes/${encodeURIComponent(Z)}`,$,X)}close(Z,$,X){return this._makeRequest("POST",`/v1/disputes/${encodeURIComponent(Z)}/close`,$,X)}}});var O6;var UZ=_(()=>{x();O6=class O6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/ephemeral_keys/${encodeURIComponent(Z)}`,$,X)}create(Z,$){return this._makeRequest("POST","/v1/ephemeral_keys",Z,$,{validator:(X,J)=>{if(!J.headers||!J.headers["Stripe-Version"])throw Error("Passing apiVersion in a separate options hash is required to create an ephemeral key. See https://stripe.com/docs/api/versioning?lang=node")}})}}});var _6;var qZ=_(()=>{x();_6=class _6 extends K{list(Z,$){return this._makeRequest("GET","/v1/events",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/events/${encodeURIComponent(Z)}`,$,X)}}});var F6;var LZ=_(()=>{x();F6=class F6 extends K{list(Z,$){return this._makeRequest("GET","/v1/exchange_rates",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/exchange_rates/${encodeURIComponent(Z)}`,$,X)}}});function j5(Z,$,X,J){if($=$||{},Z!=="POST")return J(null,p($));this._stripe._platformFunctions.tryBufferData($).then((Y)=>{let Q=s2(Z,Y,X);return J(null,Q)}).catch((Y)=>J(Y,null))}var s2=(Z,$,X)=>{let J=(Math.round(Math.random()*10000000000000000)+Math.round(Math.random()*10000000000000000)).toString();X["Content-Type"]=`multipart/form-data; boundary=${J}`;let Y=new TextEncoder,Q=new Uint8Array(0),G=Y.encode(`\r
|
|
15
|
-
`);function W(H){let z=Q,O=H instanceof Uint8Array?H:new Uint8Array(Y.encode(H));Q=new Uint8Array(z.length+O.length+2),Q.set(z),Q.set(O,z.length),Q.set(G,Q.length-2)}function V(H){return`"${H.replace(/"|"/g,"%22").replace(/\r\n|\r|\n/g," ")}"`}let B=V5($);for(let H in B){if(!Object.prototype.hasOwnProperty.call(B,H))continue;let z=B[H];if(W(`--${J}`),Object.prototype.hasOwnProperty.call(z,"data")){let O=z;W(`Content-Disposition: form-data; name=${V(H)}; filename=${V(O.name||"blob")}`),W(`Content-Type: ${O.type||"application/octet-stream"}`),W(""),W(O.data)}else W(`Content-Disposition: form-data; name=${V(H)}`),W(""),W(z)}return W(`--${J}--`),Q};var S5=_(()=>{i()});var w6;var DZ=_(()=>{S5();x();w6=class w6 extends K{constructor(){super(...arguments);this.requestDataProcessor=j5}list(Z,$){return this._makeRequest("GET","/v1/files",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/files",Z,$,{headers:{"Content-Type":"multipart/form-data"},apiBase:"files"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/files/${encodeURIComponent(Z)}`,$,X)}}});var x6;var AZ=_(()=>{x();x6=class x6 extends K{list(Z,$){return this._makeRequest("GET","/v1/file_links",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/file_links",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/file_links/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/file_links/${encodeURIComponent(Z)}`,$,X)}}});var T6;var EZ=_(()=>{x();T6=class T6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/invoices/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/invoices/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}list(Z,$){return this._makeRequest("GET","/v1/invoices",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/invoices",Z,$,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}search(Z,$){return this._makeRequest("GET","/v1/invoices/search",Z,$,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}addLines(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/add_lines`,$,X,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}attachPayment(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/attach_payment`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}finalizeInvoice(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/finalize`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}markUncollectible(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/mark_uncollectible`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}pay(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/pay`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}removeLines(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/remove_lines`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}sendInvoice(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/send`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}updateLines(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/update_lines`,$,X,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}voidInvoice(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/void`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}createPreview(Z,$){return this._makeRequest("POST","/v1/invoices/create_preview",Z,$,{requestSchema:{kind:"object",fields:{invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},schedule_details:{kind:"object",fields:{phases:{kind:"array",element:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}}},subscription_details:{kind:"object",fields:{items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/invoices/${encodeURIComponent(Z)}/lines`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}updateLineItem(Z,$,X,J){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/lines/${encodeURIComponent($)}`,X,J,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}}});var U6;var CZ=_(()=>{x();U6=class U6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/invoiceitems/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/invoiceitems/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/invoiceitems/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}})}list(Z,$){return this._makeRequest("GET","/v1/invoiceitems",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/invoiceitems",Z,$,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}})}}});var q6;var PZ=_(()=>{x();q6=class q6 extends K{list(Z,$){return this._makeRequest("GET","/v1/invoice_payments",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/invoice_payments/${encodeURIComponent(Z)}`,$,X)}}});var L6;var NZ=_(()=>{x();L6=class L6 extends K{list(Z,$){return this._makeRequest("GET","/v1/invoice_rendering_templates",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/invoice_rendering_templates/${encodeURIComponent(Z)}`,$,X)}archive(Z,$,X){return this._makeRequest("POST",`/v1/invoice_rendering_templates/${encodeURIComponent(Z)}/archive`,$,X)}unarchive(Z,$,X){return this._makeRequest("POST",`/v1/invoice_rendering_templates/${encodeURIComponent(Z)}/unarchive`,$,X)}}});var D6;var kZ=_(()=>{x();D6=class D6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/mandates/${encodeURIComponent(Z)}`,$,X)}}});var A6;var M5=_(()=>{x();i();A6=class A6 extends K{constructor(){super(...arguments);this.basePath=w0("/")}authorizeUrl(Z,$){Z=Z||{},$=$||{};let X="oauth/authorize";if($.express)X=`express/${X}`;if(!Z.response_type)Z.response_type="code";if(!Z.client_id)Z.client_id=this._stripe.getClientId();if(!Z.scope)Z.scope="read_write";return`https://${this._stripe.resolveBaseAddress("connect")}/${X}?${p(Z)}`}token(Z,$){return this._makeRequest("POST","/oauth/token",Z,$,{apiBase:"connect"})}deauthorize(Z,$){if(!Z.client_id)Z.client_id=this._stripe.getClientId();return this._makeRequest("POST","/oauth/deauthorize",Z,$,{apiBase:"connect"})}}});var E6;var IZ=_(()=>{x();E6=class E6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_attempt_records",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_attempt_records/${encodeURIComponent(Z)}`,$,X)}}});var C6;var jZ=_(()=>{x();C6=class C6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_intents",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payment_intents",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_intents/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}`,$,X)}search(Z,$){return this._makeRequest("GET","/v1/payment_intents/search",Z,$,{methodType:"search"})}applyCustomerBalance(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/apply_customer_balance`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/cancel`,$,X)}capture(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/capture`,$,X)}confirm(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/confirm`,$,X)}incrementAuthorization(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/increment_authorization`,$,X)}verifyMicrodeposits(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/verify_microdeposits`,$,X)}listAmountDetailsLineItems(Z,$,X){return this._makeRequest("GET",`/v1/payment_intents/${encodeURIComponent(Z)}/amount_details_line_items`,$,X,{methodType:"list"})}}});var P6;var SZ=_(()=>{x();P6=class P6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_links",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/payment_links",Z,$,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_links/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_links/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/payment_links/${encodeURIComponent(Z)}/line_items`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}}});var N6;var MZ=_(()=>{x();N6=class N6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_methods",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payment_methods",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_methods/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_methods/${encodeURIComponent(Z)}`,$,X)}attach(Z,$,X){return this._makeRequest("POST",`/v1/payment_methods/${encodeURIComponent(Z)}/attach`,$,X)}detach(Z,$,X){return this._makeRequest("POST",`/v1/payment_methods/${encodeURIComponent(Z)}/detach`,$,X)}}});var k6;var fZ=_(()=>{x();k6=class k6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_method_configurations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payment_method_configurations",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_method_configurations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_method_configurations/${encodeURIComponent(Z)}`,$,X)}}});var I6;var yZ=_(()=>{x();I6=class I6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_method_domains",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payment_method_domains",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_method_domains/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_method_domains/${encodeURIComponent(Z)}`,$,X)}validate(Z,$,X){return this._makeRequest("POST",`/v1/payment_method_domains/${encodeURIComponent(Z)}/validate`,$,X)}}});var j6;var hZ=_(()=>{x();j6=class j6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_records/${encodeURIComponent(Z)}`,$,X)}reportPaymentAttempt(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt`,$,X)}reportPaymentAttemptCanceled(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt_canceled`,$,X)}reportPaymentAttemptFailed(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt_failed`,$,X)}reportPaymentAttemptGuaranteed(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt_guaranteed`,$,X)}reportPaymentAttemptInformational(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt_informational`,$,X)}reportRefund(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_refund`,$,X)}reportPayment(Z,$){return this._makeRequest("POST","/v1/payment_records/report_payment",Z,$)}}});var S6;var vZ=_(()=>{x();S6=class S6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payouts",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payouts",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payouts/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payouts/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/payouts/${encodeURIComponent(Z)}/cancel`,$,X)}reverse(Z,$,X){return this._makeRequest("POST",`/v1/payouts/${encodeURIComponent(Z)}/reverse`,$,X)}}});var M6;var RZ=_(()=>{x();M6=class M6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/plans/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/plans/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/plans/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}list(Z,$){return this._makeRequest("GET","/v1/plans",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/plans",Z,$,{requestSchema:{kind:"object",fields:{amount_decimal:{kind:"decimal_string"},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}}});var f6;var bZ=_(()=>{x();f6=class f6 extends K{list(Z,$){return this._makeRequest("GET","/v1/prices",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/prices",Z,$,{requestSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/prices/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/prices/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}search(Z,$){return this._makeRequest("GET","/v1/prices/search",Z,$,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}}});var y6;var gZ=_(()=>{x();y6=class y6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/products/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/products/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/products/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/products",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/products",Z,$,{requestSchema:{kind:"object",fields:{default_price_data:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}}}}})}search(Z,$){return this._makeRequest("GET","/v1/products/search",Z,$,{methodType:"search"})}deleteFeature(Z,$,X,J){return this._makeRequest("DELETE",`/v1/products/${encodeURIComponent(Z)}/features/${encodeURIComponent($)}`,X,J)}retrieveFeature(Z,$,X,J){return this._makeRequest("GET",`/v1/products/${encodeURIComponent(Z)}/features/${encodeURIComponent($)}`,X,J)}listFeatures(Z,$,X){return this._makeRequest("GET",`/v1/products/${encodeURIComponent(Z)}/features`,$,X,{methodType:"list"})}createFeature(Z,$,X){return this._makeRequest("POST",`/v1/products/${encodeURIComponent(Z)}/features`,$,X)}}});var h6;var uZ=_(()=>{x();h6=class h6 extends K{list(Z,$){return this._makeRequest("GET","/v1/promotion_codes",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/promotion_codes",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/promotion_codes/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/promotion_codes/${encodeURIComponent(Z)}`,$,X)}}});var v6;var cZ=_(()=>{x();v6=class v6 extends K{list(Z,$){return this._makeRequest("GET","/v1/quotes",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/quotes",Z,$,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}accept(Z,$,X){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(Z)}/accept`,$,X,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}cancel(Z,$,X){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(Z)}/cancel`,$,X,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}finalizeQuote(Z,$,X){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(Z)}/finalize`,$,X,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}pdf(Z,$,X){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(Z)}/pdf`,$,X,{apiBase:"files",streaming:!0})}listComputedUpfrontLineItems(Z,$,X){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(Z)}/computed_upfront_line_items`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(Z)}/line_items`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}}});var R6;var mZ=_(()=>{x();R6=class R6 extends K{list(Z,$){return this._makeRequest("GET","/v1/refunds",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/refunds",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/refunds/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/refunds/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/refunds/${encodeURIComponent(Z)}/cancel`,$,X)}}});var b6;var lZ=_(()=>{x();b6=class b6 extends K{list(Z,$){return this._makeRequest("GET","/v1/reviews",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/reviews/${encodeURIComponent(Z)}`,$,X)}approve(Z,$,X){return this._makeRequest("POST",`/v1/reviews/${encodeURIComponent(Z)}/approve`,$,X)}}});var g6;var dZ=_(()=>{x();g6=class g6 extends K{list(Z,$){return this._makeRequest("GET","/v1/setup_attempts",Z,$,{methodType:"list"})}}});var u6;var nZ=_(()=>{x();u6=class u6 extends K{list(Z,$){return this._makeRequest("GET","/v1/setup_intents",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/setup_intents",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/setup_intents/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(Z)}/cancel`,$,X)}confirm(Z,$,X){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(Z)}/confirm`,$,X)}verifyMicrodeposits(Z,$,X){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(Z)}/verify_microdeposits`,$,X)}}});var c6;var pZ=_(()=>{x();c6=class c6 extends K{list(Z,$){return this._makeRequest("GET","/v1/shipping_rates",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/shipping_rates",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/shipping_rates/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/shipping_rates/${encodeURIComponent(Z)}`,$,X)}}});var m6;var iZ=_(()=>{x();m6=class m6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/sources/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/sources/${encodeURIComponent(Z)}`,$,X)}create(Z,$){return this._makeRequest("POST","/v1/sources",Z,$)}verify(Z,$,X){return this._makeRequest("POST",`/v1/sources/${encodeURIComponent(Z)}/verify`,$,X)}listSourceTransactions(Z,$,X){return this._makeRequest("GET",`/v1/sources/${encodeURIComponent(Z)}/source_transactions`,$,X,{methodType:"list"})}}});var l6;var rZ=_(()=>{x();l6=class l6 extends K{cancel(Z,$,X){return this._makeRequest("DELETE",`/v1/subscriptions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/subscriptions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/subscriptions/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}deleteDiscount(Z,$,X){return this._makeRequest("DELETE",`/v1/subscriptions/${encodeURIComponent(Z)}/discount`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/subscriptions",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/subscriptions",Z,$,{requestSchema:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}search(Z,$){return this._makeRequest("GET","/v1/subscriptions/search",Z,$,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}})}migrate(Z,$,X){return this._makeRequest("POST",`/v1/subscriptions/${encodeURIComponent(Z)}/migrate`,$,X,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}resume(Z,$,X){return this._makeRequest("POST",`/v1/subscriptions/${encodeURIComponent(Z)}/resume`,$,X,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}}});var d6;var tZ=_(()=>{x();d6=class d6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/subscription_items/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/subscription_items/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/subscription_items/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}})}list(Z,$){return this._makeRequest("GET","/v1/subscription_items",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/subscription_items",Z,$,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}})}}});var n6;var sZ=_(()=>{x();n6=class n6 extends K{list(Z,$){return this._makeRequest("GET","/v1/subscription_schedules",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/subscription_schedules",Z,$,{requestSchema:{kind:"object",fields:{phases:{kind:"array",element:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/subscription_schedules/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/subscription_schedules/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{phases:{kind:"array",element:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}}}})}cancel(Z,$,X){return this._makeRequest("POST",`/v1/subscription_schedules/${encodeURIComponent(Z)}/cancel`,$,X)}release(Z,$,X){return this._makeRequest("POST",`/v1/subscription_schedules/${encodeURIComponent(Z)}/release`,$,X)}}});var p6;var oZ=_(()=>{x();p6=class p6 extends K{list(Z,$){return this._makeRequest("GET","/v1/tax_codes",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax_codes/${encodeURIComponent(Z)}`,$,X)}}});var i6;var aZ=_(()=>{x();i6=class i6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/tax_ids/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax_ids/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/tax_ids",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/tax_ids",Z,$)}}});var r6;var eZ=_(()=>{x();r6=class r6 extends K{list(Z,$){return this._makeRequest("GET","/v1/tax_rates",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/tax_rates",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax_rates/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/tax_rates/${encodeURIComponent(Z)}`,$,X)}}});var t6;var Z$=_(()=>{x();t6=class t6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tokens/${encodeURIComponent(Z)}`,$,X)}create(Z,$){return this._makeRequest("POST","/v1/tokens",Z,$)}}});var s6;var $$=_(()=>{x();s6=class s6 extends K{list(Z,$){return this._makeRequest("GET","/v1/topups",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/topups",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/topups/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/topups/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/topups/${encodeURIComponent(Z)}/cancel`,$,X)}}});var o6;var X$=_(()=>{x();o6=class o6 extends K{list(Z,$){return this._makeRequest("GET","/v1/transfers",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/transfers",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/transfers/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/transfers/${encodeURIComponent(Z)}`,$,X)}listReversals(Z,$,X){return this._makeRequest("GET",`/v1/transfers/${encodeURIComponent(Z)}/reversals`,$,X,{methodType:"list"})}createReversal(Z,$,X){return this._makeRequest("POST",`/v1/transfers/${encodeURIComponent(Z)}/reversals`,$,X)}retrieveReversal(Z,$,X,J){return this._makeRequest("GET",`/v1/transfers/${encodeURIComponent(Z)}/reversals/${encodeURIComponent($)}`,X,J)}updateReversal(Z,$,X,J){return this._makeRequest("POST",`/v1/transfers/${encodeURIComponent(Z)}/reversals/${encodeURIComponent($)}`,X,J)}}});var a6;var J$=_(()=>{x();a6=class a6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/webhook_endpoints/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/webhook_endpoints/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/webhook_endpoints/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/webhook_endpoints",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/webhook_endpoints",Z,$)}}});var G0={};j8(G0,{WebhookEndpoints:()=>a6,V2:()=>_X,Treasury:()=>OX,Transfers:()=>o6,Topups:()=>s6,Tokens:()=>t6,TestHelpers:()=>zX,Terminal:()=>HX,TaxRates:()=>r6,TaxIds:()=>i6,TaxCodes:()=>p6,Tax:()=>KX,Subscriptions:()=>l6,SubscriptionSchedules:()=>n6,SubscriptionItems:()=>d6,Sources:()=>m6,Sigma:()=>VX,ShippingRates:()=>c6,SetupIntents:()=>u6,SetupAttempts:()=>g6,Reviews:()=>b6,Reporting:()=>BX,Refunds:()=>R6,Radar:()=>WX,Quotes:()=>v6,PromotionCodes:()=>h6,Products:()=>y6,Prices:()=>f6,Plans:()=>M6,Payouts:()=>S6,PaymentRecords:()=>j6,PaymentMethods:()=>N6,PaymentMethodDomains:()=>I6,PaymentMethodConfigurations:()=>k6,PaymentLinks:()=>P6,PaymentIntents:()=>C6,PaymentAttemptRecords:()=>E6,OAuthResource:()=>A6,Mandates:()=>D6,Issuing:()=>GX,Invoices:()=>T6,InvoiceRenderingTemplates:()=>L6,InvoicePayments:()=>q6,InvoiceItems:()=>U6,Identity:()=>QX,Forwarding:()=>YX,FinancialConnections:()=>JX,Files:()=>w6,FileLinks:()=>x6,ExchangeRates:()=>F6,Events:()=>_6,EphemeralKeys:()=>O6,Entitlements:()=>XX,Disputes:()=>z6,Customers:()=>K6,CustomerSessions:()=>H6,CreditNotes:()=>V6,Coupons:()=>B6,CountrySpecs:()=>W6,ConfirmationTokens:()=>G6,Climate:()=>$X,Checkout:()=>ZX,Charges:()=>Q6,BillingPortal:()=>e2,Billing:()=>a2,Balances:()=>Q0,BalanceTransactions:()=>Y6,BalanceSettings:()=>J6,Balance:()=>Q0,Apps:()=>o2,ApplicationFees:()=>X6,ApplePayDomains:()=>$6,Accounts:()=>Y0,AccountSessions:()=>Z6,AccountLinks:()=>e4,Account:()=>Y0});var o2,a2,e2,ZX,$X,XX,JX,YX,QX,GX,WX,BX,VX,KX,HX,zX,OX,_X;var Y$=_(()=>{j9();S9();M9();h9();v9();R9();b9();g9();u9();c9();m9();l9();d9();n9();p9();i9();r9();t9();s9();o9();a9();e9();Z1();$1();X1();J1();Y1();Q1();G1();W1();B1();V1();K1();H1();z1();O1();_1();F1();w1();x1();T1();U1();q1();L1();D1();A1();E1();C1();P1();N1();k1();I1();j1();S1();M1();f1();y1();h1();v1();R1();b1();g1();u1();c1();m1();l1();d1();n1();p1();i1();r1();t1();s1();o1();a1();e1();ZZ();$Z();XZ();JZ();YZ();C8();C8();QZ();GZ();WZ();BZ();P8();P8();VZ();KZ();HZ();zZ();OZ();_Z();FZ();wZ();xZ();TZ();UZ();qZ();LZ();DZ();AZ();EZ();CZ();PZ();NZ();kZ();M5();IZ();jZ();SZ();MZ();fZ();yZ();hZ();vZ();RZ();bZ();gZ();uZ();cZ();mZ();lZ();dZ();nZ();pZ();iZ();rZ();tZ();sZ();oZ();aZ();eZ();Z$();$$();X$();J$();o2=C("apps",{Secrets:h4}),a2=C("billing",{Alerts:S0,CreditBalanceSummary:l0,CreditBalanceTransactions:d0,CreditGrants:n0,MeterEventAdjustments:Q4,MeterEvents:V4,Meters:H4}),e2=C("billingPortal",{Configurations:g0,Sessions:v4}),ZX=C("checkout",{Sessions:R4}),$X=C("climate",{Orders:O4,Products:D4,Suppliers:u4}),XX=C("entitlements",{ActiveEntitlements:j0,Features:e0}),JX=C("financialConnections",{Accounts:k0,Sessions:b4,Transactions:d4}),YX=C("forwarding",{Requests:f4}),QX=C("identity",{VerificationReports:o4,VerificationSessions:a4}),GX=C("issuing",{Authorizations:f0,Cardholders:v0,Cards:R0,Disputes:t0,PersonalizationDesigns:U4,PhysicalBundles:L4,Tokens:m4,Transactions:n4}),WX=C("radar",{EarlyFraudWarnings:s0,PaymentEvaluations:T4,ValueListItems:t4,ValueLists:s4}),BX=C("reporting",{ReportRuns:S4,ReportTypes:M4}),VX=C("sigma",{ScheduledQueryRuns:y4}),KX=C("tax",{Associations:M0,Calculations:h0,Registrations:j4,Settings:g4,Transactions:p4}),HX=C("terminal",{Configurations:u0,ConnectionTokens:m0,Locations:Y4,OnboardingLinks:z4,Readers:A4}),zX=C("testHelpers",{ConfirmationTokens:c0,Customers:i0,Refunds:I4,TestClocks:c4,Issuing:C("issuing",{Authorizations:y0,Cards:b0,PersonalizationDesigns:q4,Transactions:i4}),Terminal:C("terminal",{Readers:E4}),Treasury:C("treasury",{InboundTransfers:X4,OutboundPayments:_4,OutboundTransfers:w4,ReceivedCredits:C4,ReceivedDebits:N4})}),OX=C("treasury",{CreditReversals:p0,DebitReversals:r0,FinancialAccounts:Z4,InboundTransfers:J4,OutboundPayments:F4,OutboundTransfers:x4,ReceivedCredits:P4,ReceivedDebits:k4,TransactionEntries:l4,Transactions:r4}),_X=C("v2",{Billing:C("billing",{MeterEventAdjustments:G4,MeterEventSession:W4,MeterEventStream:B4,MeterEvents:K4}),Commerce:C("commerce",{ProductCatalog:C("productCatalog",{Imports:$4})}),Core:C("core",{AccountLinks:P0,AccountTokens:N0,Accounts:I0,EventDestinations:o0,Events:a0})})});var f5=_(()=>{U8()});class Q${constructor(Z){this.stripe=Z,this.secrets=new h4(Z)}}var y5=_(()=>{c1()});class G${constructor(Z){this.stripe=Z,this.alerts=new S0(Z),this.creditBalanceSummaries=new l0(Z),this.creditBalanceTransactions=new d0(Z),this.creditGrants=new n0(Z),this.meters=new H4(Z),this.meterEvents=new V4(Z),this.meterEventAdjustments=new Q4(Z)}}var h5=_(()=>{R9();t9();s9();o9();x1();F1();H1()});class W${constructor(Z){this.stripe=Z,this.configurations=new g0(Z),this.sessions=new v4(Z)}}var v5=_(()=>{n9();m1()});class B${constructor(Z){this.stripe=Z,this.sessions=new R4(Z)}}var R5=_(()=>{l1()});class V${constructor(Z){this.stripe=Z,this.orders=new O4(Z),this.products=new D4(Z),this.suppliers=new u4(Z)}}var b5=_(()=>{U1();k1();p1()});class K${constructor(Z){this.stripe=Z,this.activeEntitlements=new j0(Z),this.features=new e0(Z)}}var g5=_(()=>{v9();Q1()});class H${constructor(Z){this.stripe=Z,this.accounts=new k0(Z),this.sessions=new b4(Z),this.transactions=new d4(Z)}}var u5=_(()=>{M9();d1();s1()});class z${constructor(Z){this.stripe=Z,this.requests=new f4(Z)}}var c5=_(()=>{g1()});class O${constructor(Z){this.stripe=Z,this.verificationReports=new o4(Z),this.verificationSessions=new a4(Z)}}var m5=_(()=>{JZ();YZ()});class _${constructor(Z){this.stripe=Z,this.authorizations=new f0(Z),this.cards=new R0(Z),this.cardholders=new v0(Z),this.disputes=new t0(Z),this.personalizationDesigns=new U4(Z),this.physicalBundles=new L4(Z),this.tokens=new m4(Z),this.transactions=new n4(Z)}}var l5=_(()=>{g9();l9();m9();$1();C1();N1();r1();o1()});class F${constructor(Z){this.stripe=Z,this.earlyFraudWarnings=new s0(Z),this.paymentEvaluations=new T4(Z),this.valueLists=new s4(Z),this.valueListItems=new t4(Z)}}var d5=_(()=>{X1();E1();XZ();$Z()});class w${constructor(Z){this.stripe=Z,this.reportRuns=new S4(Z),this.reportTypes=new M4(Z)}}var n5=_(()=>{R1();b1()});class x${constructor(Z){this.stripe=Z,this.scheduledQueryRuns=new y4(Z)}}var p5=_(()=>{u1()});class T${constructor(Z){this.stripe=Z,this.associations=new M0(Z),this.calculations=new h0(Z),this.registrations=new j4(Z),this.settings=new g4(Z),this.transactions=new p4(Z)}}var i5=_(()=>{b9();c9();v1();n1();a1()});class U${constructor(Z){this.stripe=Z,this.configurations=new u0(Z),this.connectionTokens=new m0(Z),this.locations=new Y4(Z),this.onboardingLinks=new z4(Z),this.readers=new A4(Z)}}var r5=_(()=>{p9();r9();K1();T1();I1()});class q${constructor(Z){this.stripe=Z,this.authorizations=new y0(Z),this.cards=new b0(Z),this.personalizationDesigns=new q4(Z),this.transactions=new i4(Z)}}var t5=_(()=>{u9();d9();P1();e1()});class L${constructor(Z){this.stripe=Z,this.readers=new E4(Z)}}var s5=_(()=>{j1()});class D${constructor(Z){this.stripe=Z,this.inboundTransfers=new X4(Z),this.outboundPayments=new _4(Z),this.outboundTransfers=new w4(Z),this.receivedCredits=new C4(Z),this.receivedDebits=new N4(Z)}}var o5=_(()=>{B1();q1();D1();S1();f1()});class A${constructor(Z){this.stripe=Z,this.confirmationTokens=new c0(Z),this.customers=new i0(Z),this.refunds=new I4(Z),this.testClocks=new c4(Z),this.issuing=new q$(Z),this.terminal=new L$(Z),this.treasury=new D$(Z)}}var a5=_(()=>{i9();e9();h1();i1();t5();s5();o5()});class E${constructor(Z){this.stripe=Z,this.creditReversals=new p0(Z),this.debitReversals=new r0(Z),this.financialAccounts=new Z4(Z),this.inboundTransfers=new J4(Z),this.outboundPayments=new F4(Z),this.outboundTransfers=new x4(Z),this.receivedCredits=new P4(Z),this.receivedDebits=new k4(Z),this.transactions=new r4(Z),this.transactionEntries=new l4(Z)}}var e5=_(()=>{a9();Z1();G1();V1();L1();A1();M1();y1();ZZ();t1()});class C${constructor(Z){this.stripe=Z,this.meterEvents=new K4(Z),this.meterEventAdjustments=new G4(Z),this.meterEventSession=new W4(Z),this.meterEventStream=new B4(Z)}}var Z7=_(()=>{w1();z1();O1();_1()});class P${constructor(Z){this.stripe=Z,this.imports=new $4(Z)}}var $7=_(()=>{W1()});class N${constructor(Z){this.stripe=Z,this.productCatalog=new P$(Z)}}var X7=_(()=>{$7()});class k${constructor(Z){this.stripe=Z,this.accounts=new I0(Z),this.accountLinks=new P0(Z),this.accountTokens=new N0(Z),this.events=new a0(Z),this.eventDestinations=new o0(Z)}}var J7=_(()=>{h9();j9();S9();Y1();J1()});class I${constructor(Z){this.stripe=Z,this.billing=new C$(Z),this.commerce=new N$(Z),this.core=new k$(Z)}}var Y7=_(()=>{Z7();X7();J7()});class A{static initialize(Z,$=z7){A._platformFunctions=Z,A._requestSenderFactory=$,A.webhooks=P5(Z),A.createNodeHttpClient=Z.createNodeHttpClient,A.createFetchHttpClient=Z.createFetchHttpClient,A.createNodeCryptoProvider=Z.createNodeCryptoProvider,A.createSubtleCryptoProvider=Z.createSubtleCryptoProvider;let X=Z.getEnv(),J=Z.getRuntimeVersion();A.aiAgent=X?K5(X):"",A.AI_AGENT=A.aiAgent,A.USER_AGENT={bindings_version:A.PACKAGE_VERSION,lang:"node",typescript:!1,...J?{lang_version:J}:{},...A.aiAgent?{ai_agent:A.aiAgent}:{}}}constructor(Z,$={}){this._authenticator=null;let X=this._getPropsFromConfig($);this._platformFunctions=A._platformFunctions,Object.defineProperty(this,"_emitter",{value:this._platformFunctions.createEmitter(),enumerable:!1,configurable:!1,writable:!1}),this.VERSION=A.PACKAGE_VERSION,this.on=this._emitter.on.bind(this._emitter),this.once=this._emitter.once.bind(this._emitter),this.off=this._emitter.removeListener.bind(this._emitter);let J=X.httpAgent||null;this._api={host:X.host||j$,port:X.port||Q7,protocol:X.protocol||"https",basePath:G7,version:X.apiVersion||W7,timeout:_8("timeout",X.timeout,B7),maxNetworkRetries:_8("maxNetworkRetries",X.maxNetworkRetries,2),agent:J,httpClient:X.httpClient||(J?this._platformFunctions.createNodeHttpClient(J):this._platformFunctions.createDefaultHttpClient()),dev:!1,stripeAccount:X.stripeAccount||null,stripeContext:X.stripeContext||null};let Y=X.typescript||!1;if(Y!==A.USER_AGENT.typescript)A.USER_AGENT.typescript=Y;if(X.appInfo)this._setAppInfo(X.appInfo);this._setAuthenticator(Z,X.authenticator||null),this.errors=A8,this.Decimal=v,this.webhooks=A.webhooks,this._prevRequestMetrics=[],this._enableTelemetry=X.telemetry!==!1,this._emitEventBodies=X.emitEventBodies===!0,this._requestSender=A._requestSenderFactory(this),this.accountLinks=new e4(this),this.accountSessions=new Z6(this),this.accounts=new Y0(this),this.applePayDomains=new $6(this),this.applicationFees=new X6(this),this.balance=new Q0(this),this.balanceSettings=new J6(this),this.balanceTransactions=new Y6(this),this.charges=new Q6(this),this.confirmationTokens=new G6(this),this.countrySpecs=new W6(this),this.coupons=new B6(this),this.creditNotes=new V6(this),this.customerSessions=new H6(this),this.customers=new K6(this),this.disputes=new z6(this),this.ephemeralKeys=new O6(this),this.events=new _6(this),this.exchangeRates=new F6(this),this.fileLinks=new x6(this),this.files=new w6(this),this.invoiceItems=new U6(this),this.invoicePayments=new q6(this),this.invoiceRenderingTemplates=new L6(this),this.invoices=new T6(this),this.mandates=new D6(this),this.paymentAttemptRecords=new E6(this),this.paymentIntents=new C6(this),this.paymentLinks=new P6(this),this.paymentMethodConfigurations=new k6(this),this.paymentMethodDomains=new I6(this),this.paymentMethods=new N6(this),this.paymentRecords=new j6(this),this.payouts=new S6(this),this.plans=new M6(this),this.prices=new f6(this),this.products=new y6(this),this.promotionCodes=new h6(this),this.quotes=new v6(this),this.refunds=new R6(this),this.reviews=new b6(this),this.setupAttempts=new g6(this),this.setupIntents=new u6(this),this.shippingRates=new c6(this),this.sources=new m6(this),this.subscriptionItems=new d6(this),this.subscriptionSchedules=new n6(this),this.subscriptions=new l6(this),this.taxCodes=new p6(this),this.taxIds=new i6(this),this.taxRates=new r6(this),this.tokens=new t6(this),this.topups=new s6(this),this.transfers=new o6(this),this.webhookEndpoints=new a6(this),this.apps=new Q$(this),this.billing=new G$(this),this.billingPortal=new W$(this),this.checkout=new B$(this),this.climate=new V$(this),this.entitlements=new K$(this),this.financialConnections=new H$(this),this.forwarding=new z$(this),this.identity=new O$(this),this.issuing=new _$(this),this.radar=new F$(this),this.reporting=new w$(this),this.sigma=new x$(this),this.tax=new T$(this),this.terminal=new U$(this),this.testHelpers=new A$(this),this.treasury=new E$(this),this.v2=new I$(this),this.account=this.accounts,this.oauth=new A6(this)}rawRequest(Z,$,X,J){return this._requestSender._rawRequest(Z,$,X,J)}_setAuthenticator(Z,$){if(Z&&$)throw Error("Can't specify both apiKey and authenticator");if(!Z&&!$)throw Error("Neither apiKey nor config.authenticator provided");this._authenticator=Z?G9(Z):$}_setAppInfo(Z){if(Z&&typeof Z!=="object")throw Error("AppInfo must be an object.");if(Z&&!Z.name)throw Error("AppInfo.name is required");Z=Z||{},this._appInfo=FX.reduce(($,X)=>{if(typeof Z[X]=="string")$=$||{},$[X]=Z[X];return $},{})}setClientId(Z){this._clientId=Z}getClientId(){return this._clientId}getConstant(Z){switch(Z){case"DEFAULT_HOST":return j$;case"DEFAULT_PORT":return Q7;case"DEFAULT_BASE_PATH":return G7;case"DEFAULT_API_VERSION":return W7;case"DEFAULT_TIMEOUT":return B7;case"MAX_NETWORK_RETRY_DELAY_SEC":return V7;case"INITIAL_NETWORK_RETRY_DELAY_SEC":return K7}return A[Z]}resolveBaseAddress(Z){let $=this.getApiField("host");if($!==j$)return $;return Y9[Z]}getMaxNetworkRetries(){return this.getApiField("maxNetworkRetries")}_setApiNumberField(Z,$,X){let J=_8(Z,$,X);this._setApiField(Z,J)}getMaxNetworkRetryDelay(){return V7}getInitialNetworkRetryDelay(){return K7}getClientUserAgent(Z){return this.getClientUserAgentSeeded(A.USER_AGENT,Z)}getClientUserAgentSeeded(Z,$){let X={};for(let Q in Z){if(!Object.prototype.hasOwnProperty.call(Z,Q))continue;X[Q]=encodeURIComponent(Z[Q]??"null")}let J=this._platformFunctions.getPlatformInfo();if(J&&this.getTelemetryEnabled())X.platform=encodeURIComponent(J);else delete X.platform;let Y=this.getApiField("httpClient");if(Y)X.httplib=encodeURIComponent(Y.getClientName());if(this._appInfo)X.application=this._appInfo;if(this.getTelemetryEnabled()){let Q=this._platformFunctions.getTelemetryId();if(Q)X.telemetry_id=Q}$(JSON.stringify(X))}getAppInfoAsString(){if(!this._appInfo)return"";let Z=this._appInfo.name;if(this._appInfo.version)Z+=`/${this._appInfo.version}`;if(this._appInfo.url)Z+=` (${this._appInfo.url})`;return Z}getTelemetryEnabled(){return this._enableTelemetry}getEmitEventBodiesEnabled(){return this._emitEventBodies}_prepResources(){for(let Z in G0){if(!Object.prototype.hasOwnProperty.call(G0,Z))continue;this[B5(Z.replace("Resource",""))]=new G0[Z](this)}}_getPropsFromConfig(Z){if(!Z)return{};let $=typeof Z==="string";if(!(Z===Object(Z)&&!Array.isArray(Z))&&!$)throw Error("Config must either be an object or a string");if($)return{apiVersion:Z};if(Object.keys(Z).filter((Y)=>!H7.includes(Y)).length>0)throw Error(`Config object may only contain the following: ${H7.join(", ")}`);return Z}_setApiField(Z,$){this._api[Z]=$}getApiField(Z){return this._api[Z]}parseEventNotification(Z,$,X,J,Y,Q){if(!this.webhooks.signature)throw Error("ERR: missing signature helper, unable to verify");this.webhooks.signature.verifyHeader(Z,$,X,J||this.webhooks.DEFAULT_TOLERANCE,Y||this._platformFunctions.createDefaultCryptoProvider(),Q);let G=Z instanceof Uint8Array?JSON.parse(new TextDecoder("utf8").decode(Z)):JSON.parse(Z);if(G&&G.object==="event")throw Error("You passed a webhook payload to stripe.parseEventNotification, which expects an event notification. Use stripe.webhooks.constructEvent instead.");if(G.context)G.context=l.parse(G.context);return G.fetchEvent=()=>{return this._requestSender._rawRequest("GET",`/v2/core/events/${G.id}`,void 0,{stripeContext:G.context,headers:{"Stripe-Request-Trigger":`event=${G.id}`}},["fetch_event"])},G.fetchRelatedObject=()=>{if(!G.related_object)return Promise.resolve(null);return this._requestSender._rawRequest("GET",G.related_object.url,void 0,{stripeContext:G.context,headers:{"Stripe-Request-Trigger":`event=${G.id}`}},["fetch_related_object"])},G}async parseEventNotificationAsync(Z,$,X,J,Y,Q){if(!this.webhooks.signature)throw Error("ERR: missing signature helper, unable to verify");await this.webhooks.signature.verifyHeaderAsync(Z,$,X,J||this.webhooks.DEFAULT_TOLERANCE,Y||this._platformFunctions.createDefaultCryptoProvider(),Q);let G=Z instanceof Uint8Array?JSON.parse(new TextDecoder("utf8").decode(Z)):JSON.parse(Z);if(G&&G.object==="event")throw Error("You passed a webhook payload to stripe.parseEventNotificationAsync, which expects an event notification. Use stripe.webhooks.constructEventAsync instead.");if(G.context)G.context=l.parse(G.context);return G.fetchEvent=()=>{return this._requestSender._rawRequest("GET",`/v2/core/events/${G.id}`,void 0,{stripeContext:G.context,headers:{"Stripe-Request-Trigger":`event=${G.id}`}},["fetch_event"])},G.fetchRelatedObject=()=>{if(!G.related_object)return Promise.resolve(null);return this._requestSender._rawRequest("GET",G.related_object.url,void 0,{stripeContext:G.context,headers:{"Stripe-Request-Trigger":`event=${G.id}`}},["fetch_related_object"])},G}}var j$="api.stripe.com",Q7="443",G7="/v1/",W7,B7=80000,V7=5,K7=0.5,FX,H7,z7=(Z)=>new J0(Z,K.MAX_BUFFERED_REQUEST_METRICS);var O7=_(()=>{E8();U5();x();Q9();N5();T8();x8();Y$();i();f5();C8();QZ();GZ();WZ();BZ();P8();VZ();KZ();HZ();zZ();OZ();_Z();FZ();wZ();xZ();TZ();UZ();LZ();DZ();AZ();EZ();CZ();PZ();NZ();kZ();IZ();jZ();SZ();MZ();fZ();yZ();hZ();vZ();RZ();bZ();gZ();uZ();cZ();mZ();lZ();dZ();nZ();pZ();iZ();rZ();tZ();sZ();oZ();aZ();eZ();Z$();$$();X$();J$();y5();h5();v5();R5();b5();g5();u5();c5();m5();l5();d5();n5();p5();i5();r5();a5();e5();Y7();qZ();Y$();W7=I9,FX=["name","version","url","partner_id"],H7=["authenticator","apiVersion","typescript","maxNetworkRetries","httpAgent","httpClient","timeout","host","port","protocol","telemetry","emitEventBodies","appInfo","stripeAccount","stripeContext"];A.PACKAGE_VERSION="22.3.2";A.API_VERSION=I9;A.aiAgent="";A.AI_AGENT="";A.USER_AGENT={bindings_version:A.PACKAGE_VERSION,lang:"node",typescript:!1};A.StripeResource=K;A.resources=G0;A.HttpClient=S;A.HttpClientResponse=T0;A.CryptoProvider=q0;A.StripeContext=l;A.errors=A8;A.Decimal=v;A._requestSenderFactory=z7});var _7={};j8(_7,{default:()=>wX,Stripe:()=>A,Decimal:()=>v});var wX;var F7=_(()=>{T5();U8();O7();A.initialize(new z9);wX=A});import"@stacksjs/validation";import{log as S8}from"@stacksjs/cli";import{db as R$}from"@stacksjs/database";async function r7(Z,$={}){let{olderThanDays:X=30,column:J="created_at",query:Y}=$;try{if(Y){let B=R$.deleteFrom(Z);B=Y(B);let H=await B.execute(),z=Array.isArray(H)?H:[H],O=Number(z[0]?.numDeletedRows??z.length??0);return S8.info(`Pruned ${O} records from ${Z}`),O}let Q=new Date;Q.setDate(Q.getDate()-X);let G=await R$.deleteFrom(Z).where(J,"<",Q.toISOString()).execute(),W=Array.isArray(G)?G:[G],V=Number(W[0]?.numDeletedRows??W.length??0);return S8.info(`Pruned ${V} records from ${Z} older than ${X} days`),V}catch(Q){throw S8.error(`Failed to prune ${Z}:`,Q),Q}}async function UY(Z,$={}){return r7(Z,$)}function qY(Z){if(!Z?.prunable)return null;if(typeof Z.prunable==="boolean")return{olderThanDays:30,column:"created_at"};return Z.prunable}import{createCipheriv as t7,createDecipheriv as s7,createHash as o7,randomBytes as a7}from"crypto";import{log as Q8}from"@stacksjs/logging";var b$="enc:",g$="aes-256-gcm",e7=12,Y8=null;async function u$(){if(Y8)return Y8;let Z=process.env.APP_KEY;if(!Z)try{Z=(await import("@stacksjs/config").catch(()=>null))?.config?.app?.key}catch{}if(!Z)return null;return Y8=o7("sha256").update(Z).digest(),Y8}function K0(Z){return typeof Z==="string"&&Z.startsWith(b$)}async function M8(Z){if(Z==null)return Z;if(K0(Z))return Z;if(typeof Z!=="string")return Z;let $=await u$();if(!$)return Q8.warn("[orm] encrypted attribute: APP_KEY not set \u2014 storing value in plaintext"),Z;let X=a7(e7),J=t7(g$,$,X),Y=Buffer.concat([J.update(Z,"utf8"),J.final()]),Q=J.getAuthTag();return`${b$}${X.toString("base64")}:${Q.toString("base64")}:${Y.toString("base64")}`}async function f8(Z){if(Z==null)return Z;if(typeof Z!=="string")return Z;if(!K0(Z))return Z;try{let $=await u$();if(!$)return Q8.warn("[orm] encrypted attribute: APP_KEY not set \u2014 cannot decrypt"),null;let[,X,J,Y]=Z.split(":");if(!X||!J||!Y)return Q8.warn("[orm] encrypted attribute: malformed envelope, returning null"),null;let Q=Buffer.from(X,"base64"),G=Buffer.from(J,"base64"),W=Buffer.from(Y,"base64"),V=s7(g$,$,Q);return V.setAuthTag(G),Buffer.concat([V.update(W),V.final()]).toString("utf8")}catch($){return Q8.warn("[orm] encrypted attribute: decrypt failed (key rotation? corrupted ciphertext?)",{error:$}),null}}function y8(Z){let $=Z.attributes;if(!$||typeof $!=="object")return[];let X=[];for(let[J,Y]of Object.entries($))if(Y&&typeof Y==="object"&&Y.encrypted===!0)X.push(J);return X}import{sqlDateTime as Z2}from"@stacksjs/database";import{log as z0}from"@stacksjs/logging";var $2=[/^password$/i,/^password_hash$/i,/^api_key$/i,/_token$/i,/_secret$/i,/^remember_token$/i],m$="model_audits",R8=null;function X2(Z){R8=Z}async function h8(){if(R8!=null)return R8;try{let Z=await import("@stacksjs/router").catch(()=>null);if(!Z)return null;let $=Z.getCurrentRequest;if(typeof $!=="function")return null;let X=$();if(!X)return null;return(X.user??X._user)?.id??null}catch{return null}}function G8(Z){if(!Z||typeof Z!=="object")return null;let $={};for(let[X,J]of Object.entries(Z)){if($2.some((Y)=>Y.test(X)))continue;$[X]=J}return $}function H0(Z){if(!Z||typeof Z!=="object")return null;let $=Z;if($._attributes&&typeof $._attributes==="object")return{...$._attributes};return{...Z}}function J2(Z,$){if(!Z||!$)return{old:Z,next:$};let X={},J={},Y=new Set([...Object.keys(Z),...Object.keys($)]);for(let Q of Y)if(Z[Q]!==$[Q])X[Q]=Z[Q],J[Q]=$[Q];return{old:X,next:J}}async function v8(Z,$=!1){try{let{db:X}=await import("@stacksjs/database");await X.insertInto(m$).values({auditable_type:Z.auditable_type,auditable_id:Z.auditable_id,event:Z.event,old_values:Z.old_values?JSON.stringify(Z.old_values):null,new_values:Z.new_values?JSON.stringify(Z.new_values):null,user_id:Z.user_id,created_at:Z2()}).executeTakeFirst()}catch(X){if(z0.warn(`[orm] audit row write failed for ${Z.auditable_type}#${String(Z.auditable_id)} (${Z.event})`,{error:X}),$)throw X}}function l$(Z){return{async audits($){try{let{db:X}=await import("@stacksjs/database");return(await X.selectFrom(m$).selectAll().where("auditable_type","=",Z).where("auditable_id","=",$).orderBy("created_at","desc").execute()??[]).map((Y)=>({...Y,old_values:typeof Y.old_values==="string"?c$(Y.old_values):Y.old_values,new_values:typeof Y.new_values==="string"?c$(Y.new_values):Y.new_values}))}catch(X){return z0.warn(`[orm] audits() lookup failed for ${Z}#${String($)}`,{error:X}),[]}}}}function c$(Z){try{return JSON.parse(Z)}catch{return Z}}function d$(Z){if(Z&&typeof Z==="object"&&"transactional"in Z)return{transactional:Z.transactional===!0};return{transactional:!1}}function n$(Z,$,X="id",J={}){let Y=J.transactional===!0,Q=Z;if(typeof Z.audits!=="function")Z.audits=l$($).audits;let G=async(H)=>{if(!Y)return await H();let{db:z}=await import("@stacksjs/database");return await z.transaction(async()=>H())},W=Z.create;if(typeof W==="function")Z.create=async function(...H){return await G(async()=>{let z=await W.apply(this,H);try{let O=H0(z),F=O?.[X];if(F!=null){let w=await h8();await v8({auditable_type:$,auditable_id:F,event:"created",old_values:null,new_values:G8(O),user_id:w},Y)}}catch(O){if(z0.warn(`[orm] audit(create) failed for ${$}`,{error:O}),Y)throw O}return z})};let V=Z.update;if(typeof V==="function")Z.update=async function(H,z){return await G(async()=>{let O=Q.find,F=typeof O==="function"?H0(await O.call(Q,H)):null,w=await V.call(this,H,z);try{let T=H0(w)??(typeof O==="function"?H0(await O.call(Q,H)):null),{old:q,next:L}=J2(F,T);if(L&&Object.keys(L).length>0){let E=await h8();await v8({auditable_type:$,auditable_id:H,event:"updated",old_values:G8(q),new_values:G8(L),user_id:E},Y)}}catch(T){if(z0.warn(`[orm] audit(update) failed for ${$}#${String(H)}`,{error:T}),Y)throw T}return w})};let B=(H)=>{let z=Z[H];if(typeof z!=="function")return;Z[H]=async function(O){return await G(async()=>{let F=Q.find,w=typeof F==="function"?H0(await F.call(Q,O)):null,T=await z.call(this,O);try{if(T!==!1&&w){let q=await h8();await v8({auditable_type:$,auditable_id:O,event:"deleted",old_values:G8(w),new_values:null,user_id:q},Y)}}catch(q){if(z0.warn(`[orm] audit(${H}) failed for ${$}#${String(O)}`,{error:q}),Y)throw q}return T})}};B("delete"),B("softDelete")}import{db as Y2,sql as Q2,sqlDateTime as b8}from"@stacksjs/database";function u(Z,$){if(typeof Z!=="number"||!Number.isFinite(Z)||Z<=0)throw Error(`[orm/commentable] ${$} requires a positive numeric id (received ${String(Z)})`)}var O0="commentable_upvotes",_0="commentables";function G2(Z){let $=Z;return $.code==="SQLITE_CONSTRAINT_UNIQUE"||$.code==="SQLITE_CONSTRAINT"||$.code==="23505"||$.errno===1062||/unique|duplicate/i.test($.message??"")}function g8(Z){let $=Y2;return{async comments(X){return u(X,"comments"),await $.selectFrom("commentables").where("commentables_id","=",X).where("commentables_type","=",Z).selectAll().execute()},async commentCount(X){let J=await $.selectFrom("commentables").select(Q2`count(*) as count`).where("commentables_id","=",X).where("commentables_type","=",Z).executeTakeFirst();return Number(J?.count)||0},async addComment(X,J){if(u(X,"addComment"),!J||typeof J.title!=="string"||J.title.trim().length===0)throw Error("[orm/commentable] addComment requires a non-empty comment.title");if(typeof J.body!=="string"||J.body.trim().length===0)throw Error("[orm/commentable] addComment requires a non-empty comment.body");let Y=await $.insertInto("commentables").values({...J,commentables_id:X,commentables_type:Z,status:"pending",created_at:b8(),updated_at:b8()}).returningAll().executeTakeFirst();if(Y&&typeof Y==="object"&&"id"in Y)return Y;let Q=Y?.lastInsertRowid;if(Q==null)return Y;return await $.selectFrom("commentables").where("id","=",Number(Q)).selectAll().executeTakeFirst()},async approvedComments(X){return await $.selectFrom("commentables").where("commentables_id","=",X).where("commentables_type","=",Z).where("status","=","approved").selectAll().execute()},async pendingComments(X){return await $.selectFrom("commentables").where("commentables_id","=",X).where("commentables_type","=",Z).where("status","=","pending").selectAll().execute()},async rejectedComments(X){return await $.selectFrom("commentables").where("commentables_id","=",X).where("commentables_type","=",Z).where("status","=","rejected").selectAll().execute()},async upvoteComment(X,J){u(X,"upvoteComment"),u(J,"upvoteComment");let Y=()=>$.selectFrom(O0).where("upvoteable_id","=",X).where("upvoteable_type","=",_0).where("user_id","=",J).selectAll().executeTakeFirst(),Q=await Y();if(Q)return Q;try{await $.insertInto(O0).values({upvoteable_id:X,upvoteable_type:_0,user_id:J,created_at:b8()}).execute()}catch(G){if(!G2(G))throw G}return await Y()},async removeCommentUpvote(X,J){u(X,"removeCommentUpvote"),u(J,"removeCommentUpvote"),await $.deleteFrom(O0).where("upvoteable_id","=",X).where("upvoteable_type","=",_0).where("user_id","=",J).execute()},async commentUpvoteCount(X){u(X,"commentUpvoteCount");let J=await $.selectFrom(O0).select("count(*) as count").where("upvoteable_id","=",X).where("upvoteable_type","=",_0).executeTakeFirst();return Number(J?.count)||0},async hasUpvotedComment(X,J){return u(X,"hasUpvotedComment"),u(J,"hasUpvotedComment"),!!await $.selectFrom(O0).where("upvoteable_id","=",X).where("upvoteable_type","=",_0).where("user_id","=",J).selectAll().executeTakeFirst()}}}import{db as W2,sql as B2,sqlDateTime as p$}from"@stacksjs/database";function u8(Z,$){if(typeof Z!=="number"||!Number.isFinite(Z)||Z<=0)throw Error(`[orm/taggable] ${$} requires a positive numeric id (received ${String(Z)})`)}function c8(Z){let $=W2;return{async tags(X){return u8(X,"tags"),await $.selectFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).selectAll().execute()},async tagCount(X){u8(X,"tagCount");let J=await $.selectFrom("taggables").select(B2`count(*) as count`).where("taggable_id","=",X).where("taggable_type","=",Z).executeTakeFirst();return Number(J?.count)||0},async addTag(X,J){if(u8(X,"addTag"),!J||typeof J.name!=="string"||J.name.trim().length===0)throw Error("[orm/taggable] addTag requires a non-empty tag.name");return await $.insertInto("taggables").values({...J,taggable_id:X,taggable_type:Z,slug:J.name.toLowerCase().replace(/[^a-z0-9]+/g,"-"),is_active:!0,created_at:p$(),updated_at:p$()}).execute(),await $.selectFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).where("name","=",J.name).selectAll().executeTakeFirst()},async activeTags(X){return await $.selectFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).where("is_active","=",!0).selectAll().execute()},async inactiveTags(X){return await $.selectFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).where("is_active","=",!1).selectAll().execute()},async removeTag(X,J){await $.deleteFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).where("id","=",J).execute()}}}import{db as V2,sqlDateTime as W8}from"@stacksjs/database";function m8(Z){let $=V2;async function X(J){return(await $.selectFrom("categorizable_models").where("categorizable_id","=",J).where("categorizable_type","=",Z).selectAll().execute()).map((Q)=>Q.category_id)}return{async categories(J){let Y=await X(J);if(Y.length===0)return[];return await $.selectFrom("categorizables").where("id","in",Y).selectAll().execute()},async categoryCount(J){return(await X(J)).length},async addCategory(J,Y){let Q=()=>$.selectFrom("categorizables").where("name","=",Y.name).where("categorizable_type","=",Z).selectAll().executeTakeFirst(),G=await Q();if(!G)await $.insertInto("categorizables").values({name:Y.name,description:Y.description,slug:Y.name.toLowerCase().replace(/[^a-z0-9]+/g,"-"),categorizable_type:Z,is_active:!0,created_at:W8(),updated_at:W8()}).execute(),G=await Q();return await $.insertInto("categorizable_models").values({categorizable_id:J,categorizable_type:Z,category_id:G.id,created_at:W8(),updated_at:W8()}).execute(),G},async activeCategories(J){let Y=await X(J);if(Y.length===0)return[];return await $.selectFrom("categorizables").where("id","in",Y).where("is_active","=",!0).selectAll().execute()},async inactiveCategories(J){let Y=await X(J);if(Y.length===0)return[];return await $.selectFrom("categorizables").where("id","in",Y).where("is_active","=",!1).selectAll().execute()},async removeCategory(J,Y){await $.deleteFrom("categorizable_models").where("categorizable_id","=",J).where("categorizable_type","=",Z).where("category_id","=",Y).execute()}}}import{db as K2,sqlDateTime as H2}from"@stacksjs/database";function l8(Z,$){let X=K2,J=$?.table||`${Z}_likes`,Y=$?.foreignKey||`${Z.replace(/s$/,"")}_id`;return{async likes(Q){return await X.selectFrom(J).where(Y,"=",Q).selectAll().execute()},async likeCount(Q){let G=await X.selectFrom(J).select("count(*) as count").where(Y,"=",Q).executeTakeFirst();return Number(G?.count)||0},async like(Q,G){if(typeof Q!=="number"||!Number.isFinite(Q)||Q<=0)throw Error(`[orm/likeable] like requires a positive numeric id (received ${String(Q)})`);if(typeof G!=="number"||!Number.isFinite(G)||G<=0)throw Error(`[orm/likeable] like requires a positive numeric userId (received ${String(G)})`);let W=H2();try{return await X.insertInto(J).values({[Y]:Q,user_id:G,created_at:W,updated_at:W}).returningAll().executeTakeFirst()}catch(V){let B=V;if(!(B.code==="SQLITE_CONSTRAINT_UNIQUE"||B.code==="SQLITE_CONSTRAINT"||B.code==="23505"||B.errno===1062||/unique|duplicate/i.test(B.message??"")))throw V;let z=await X.selectFrom(J).where(Y,"=",Q).where("user_id","=",G).selectAll().executeTakeFirst();if(z)return z;throw V}},async unlike(Q,G){await X.deleteFrom(J).where(Y,"=",Q).where("user_id","=",G).execute()},async isLiked(Q,G){return!!await X.selectFrom(J).where(Y,"=",Q).where("user_id","=",G).selectAll().executeTakeFirst()},async likedBy(Q){return(await X.selectFrom(J).select([Y]).where("user_id","=",Q).execute()).map((W)=>Number(W[Y])).filter(Boolean)}}}function r$(Z){let $=Z;return $?.code==="SQLITE_CONSTRAINT_UNIQUE"||$?.code==="SQLITE_CONSTRAINT"||$?.code==="23505"||$?.errno===1062||/unique|duplicate/i.test($?.message??"")}function z2(Z,$,X){let J=Z;if(Z instanceof Error&&typeof J.status==="number"&&Number.isInteger(J.status)&&J.status>=400&&J.status<600){let Y={error:Z.message};if(J.details!==void 0)Y.details=J.details;return{status:J.status,body:Y}}if(r$(Z))return{status:409,body:{error:`${$} already exists`}};return{status:500,body:{error:`Failed to ${X} ${$}`,detail:String(Z)}}}function y(Z){return Z.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function O2(Z){let $={};for(let[X,J]of Object.entries(Z))$[y(X)]=J;return $}function vY(Z,$){let X=String($||"").replace(/^\/+|\/+$/g,""),J=String(Z).replace(/^\/+/,"");return`/api/${X?`${X}/`:""}${J}`}function RY(Z){if(!Z)return null;let $=Z.attributes??{};if(Object.prototype.hasOwnProperty.call($,"teamId")||Object.prototype.hasOwnProperty.call($,"team_id"))return"team_id";return Z.belongsTo?.some((X)=>X==="Team")?"team_id":null}function bY(Z,$,X){let J=Object.keys(Z).find((Q)=>y(Q)===y($));if(Array.isArray(X)){if(J===void 0)return{data:Z,error:"Ownership value is required"};if(!X.some((Q)=>String(Q)===String(Z[J])))return{data:Z,error:"Ownership value is not available to this caller"};return{data:{...Z,[$]:Z[J]}}}if(X===null||X===void 0)return{data:Z,error:"Caller has no ownership identity"};let Y={...Z};for(let Q of Object.keys(Y))if(y(Q)===y($))delete Y[Q];return Y[$]=X,{data:Y}}function _2(Z){if(!Z)return[];let $=Object.entries(Z.attributes??{}).filter(([,X])=>X?.fillable===!0).map(([X])=>X);for(let X of Z.belongsTo??[]){if(typeof X!=="string"||!X.trim())continue;let J=y(X.trim()).split("_").filter(Boolean);if(J.length===0)continue;let Y=`${J[0]}${J.slice(1).map((Q)=>`${Q[0]?.toUpperCase()}${Q.slice(1)}`).join("")}Id`;$.push(Y)}return[...new Set($)]}function F2(Z,$){if(!Z||$.length===0)return{};let X={};for(let J of $){if(J in Z){X[J]=Z[J];continue}let Y=y(J);if(Y!==J&&Y in Z)X[J]=Z[Y]}return X}function w2(Z,$){if(Z?.name!=="date"||$ instanceof Date||typeof $!=="string")return $;let X=/^(\d{4})-(\d{2})-(\d{2})$/.exec($);if(!X)return $;let J=Number(X[1]),Y=Number(X[2]),Q=Number(X[3]),G=new Date(Date.UTC(J,Y-1,Q));if(G.getUTCFullYear()!==J||G.getUTCMonth()!==Y-1||G.getUTCDate()!==Q)return $;return G}function gY(Z,$){if(!$.length)return Z;let X={...Z};for(let J of $)delete X[J],delete X[y(J)];return X}function uY(Z,$){if(!Z||$.length===0)return Z;let X={...Z};for(let J of $)delete X[J],delete X[y(J)];return X}var x2=["id","uuid","created_at","updated_at","deleted_at"];function cY(Z,$){let X=new Map;for(let J of[...Object.keys(Z??{}),...x2]){let Y=y(J);if(!/^\w+$/.test(Y))continue;X.set(J,Y),X.set(Y,Y)}for(let J of $)X.delete(J),X.delete(y(J));return X}function mY(Z,$,X){if(!$)return Z;let J=String($).split(",").map((Q)=>Q.trim()).filter(Boolean),Y=Z;for(let Q of J){let G=Q.startsWith("-"),W=G?Q.slice(1):Q;if(!/^\w+$/.test(W))continue;let V=X.get(W);if(!V)continue;Y=Y.orderBy(V,G?"desc":"asc")}return Y}var T2={string:{get:(Z)=>Z!=null?String(Z):null,set:(Z)=>Z!=null?String(Z):null},number:{get:(Z)=>Z!=null?Number(Z):null,set:(Z)=>Z!=null?Number(Z):null},integer:{get:(Z)=>Z!=null?Math.trunc(Number(Z)):null,set:(Z)=>Z!=null?Math.trunc(Number(Z)):null},float:{get:(Z)=>Z!=null?Number.parseFloat(String(Z)):null,set:(Z)=>Z!=null?Number.parseFloat(String(Z)):null},boolean:{get:(Z)=>Z===1||Z==="1"||Z===!0||Z==="true",set:(Z)=>Z===!0||Z===1||Z==="1"||Z==="true"?1:0},json:{get:(Z)=>Z==null?null:typeof Z==="string"?U2(Z):Z,set:(Z)=>Z==null?null:typeof Z==="string"?Z:JSON.stringify(Z)},datetime:{get:(Z)=>Z?new Date(Z):null,set:(Z)=>Z instanceof Date?Z.toISOString():Z},date:{get:(Z)=>Z?new Date(Z):null,set:(Z)=>Z instanceof Date?Z.toISOString().split("T")[0]:Z},array:{get:(Z)=>Z==null?[]:Array.isArray(Z)?Z:typeof Z==="string"?q2(Z):[],set:(Z)=>Z==null?null:Array.isArray(Z)?JSON.stringify(Z):Z}};function U2(Z){try{return JSON.parse(Z)}catch{return Z}}function q2(Z){try{return JSON.parse(Z)}catch{return[]}}function lY(Z,$,X){if(!Z||typeof Z!=="object"||!$||Object.keys($).length===0)return Z;let J={...Z};for(let[Y,Q]of Object.entries($)){let G=typeof Q==="string"?T2[Q]:Q;if(!G||typeof G[X]!=="function")continue;if(Object.prototype.hasOwnProperty.call(J,Y))J[Y]=G[X](J[Y]);let W=y(Y);if(W!==Y&&Object.prototype.hasOwnProperty.call(J,W))J[W]=G[X](J[W])}return J}function t$(Z,$,X){let J=$?.attributes??{},Y={};for(let[Q,G]of Object.entries(J)){let W=G?.validation?.rule;if(!W||typeof W.validate!=="function")continue;let V=Object.prototype.hasOwnProperty.call(Z,Q);if(!V&&X==="updating")continue;let B=G!==null&&typeof G==="object"&&Object.prototype.hasOwnProperty.call(G,"default"),H=V?Z[Q]:B?G.default:void 0,z=w2(W,H),O=W.validate(z);if(!O?.valid&&Array.isArray(O?.errors)&&O.errors.length>0)Y[Q]=O.errors.map((F)=>G?.validation?.message?.[F?.code]??F?.message??"invalid")}return Object.keys(Y).length===0?{valid:!0}:{valid:!1,errors:Y}}function dY(Z){return Z.replace(/\{[^}]*\}/g,"{}").replace(/:[^/]+/g,"{}")}function d8(Z){if(Array.isArray(Z))return Z.filter(($)=>typeof $==="string"&&$.length>0);return typeof Z==="string"&&Z?[Z]:[]}function nY(Z){let $=typeof Z==="object"&&Z!==null&&"middleware"in Z,X=Z?.middleware;if(!$)return{read:["auth"],write:["auth"],declared:!1};if(X&&typeof X==="object"&&!Array.isArray(X)){let Y=X;return{read:"read"in Y?d8(Y.read):["auth"],write:"write"in Y?d8(Y.write):["auth"],declared:!0}}let J=d8(X);return{read:J,write:J,declared:!0}}var i$=15,L2=100;function pY(Z){let $=Number.parseInt(Z.get("page")||String(1),10),X=Number.isFinite($)?Math.max(1,$):1,J=Number.parseInt(Z.get("per_page")||String(i$),10),Y=Math.min(Number.isFinite(J)?Math.max(1,J):i$,L2);return{page:X,perPage:Y,offset:(X-1)*Y}}function B8(Z,$){let X=new URL(Z.toString());return X.searchParams.set("page",String($)),`${X.pathname}${X.search}`}function D2(Z,$,X,J,Y,Q){let G=($-1)*X,W=J===0,V={page:$,per_page:X,from:W?null:G+1,to:W?null:G+J,has_more_pages:Y,prev_page_url:$>1?B8(Z,$-1):null,next_page_url:Y?B8(Z,$+1):null};if(Q!==void 0&&!Number.isNaN(Q)){let B=Math.max(1,Math.ceil(Q/X));V.total=Q,V.last_page=B,V.first_page_url=B8(Z,1),V.last_page_url=B8(Z,B)}return V}function iY(Z,$,X,J,Y,Q){let{page:G,...W}=D2(Z,$,X,J,Y,Q);return{current_page:G,...W}}import{cacheRequestQuery as A2}from"@stacksjs/router";var V8=new WeakMap;function sY(Z,$){return A2(`batchLoad:${Z.name??"model"}:${String($)}`,async()=>{return new Promise((X,J)=>{let Y=V8.get(Z);if(!Y)Y={keys:[],resolvers:[],scheduled:!1},V8.set(Z,Y);if(Y.keys.push($),Y.resolvers.push({key:$,resolve:X,reject:J}),Y.scheduled)return;Y.scheduled=!0,Promise.resolve().then(async()=>{let Q=V8.get(Z);if(!Q)return;V8.delete(Z);let G=Array.from(new Set(Q.keys));try{let W=typeof Z.findMany==="function"?await Z.findMany(G):await Promise.all(G.map((B)=>Z.find?.(B))),V=new Map;for(let B of W??[]){let H=B?.id;if(H!==void 0)V.set(H,B)}for(let B of Q.resolvers)B.resolve(V.get(B.key))}catch(W){for(let V of Q.resolvers)V.reject(W)}})})})}import{db as ZQ}from"@stacksjs/database";class E2{conditions=[];where(Z,...$){let[X,J]=$,Y=J===void 0?"=":X,Q=J===void 0?X:J;this.addCondition("and","where",Z,Y,Q)}orWhere(Z,...$){let[X,J]=$,Y=J===void 0?"=":X,Q=J===void 0?X:J;this.addCondition("or","where",Z,Y,Q)}whereIn(Z,$){this.conditions.push({type:"and",method:"whereIn",column:Z,values:$})}whereNotIn(Z,$){this.conditions.push({type:"and",method:"whereIn",column:Z,values:$,operator:"not in"})}whereNull(Z){this.conditions.push({type:"and",method:"whereNull",column:Z})}whereNotNull(Z){this.conditions.push({type:"and",method:"whereNotNull",column:Z})}whereBetween(Z,$){this.conditions.push({type:"and",method:"whereBetween",column:Z,range:$})}whereExists(Z){this.conditions.push({type:"and",method:"whereExists",column:"",callback:Z})}addCondition(Z,$,X,J,Y){this.conditions.push({type:Z,method:$,column:X,operator:J,value:Y})}getConditions(){return this.conditions}}import{db as n8,runInTransactionScope as C2}from"@stacksjs/database";async function JQ(Z,$){return await C2(async()=>{return await n8.transaction(Z,$)})}async function YQ(Z){return await n8.savepoint(Z)}function QQ(Z,$){return n8.transactional(Z,$)}import{path as c}from"@stacksjs/path";import{fs as $0,globSync as t8}from"@stacksjs/storage";import{plural as Z5,singular as s$,snakeCase as j}from"@stacksjs/strings";import{isString as K8}from"@stacksjs/validation";function $5(Z){let $=Z.belongsToMany;if(!$)return[];if(Array.isArray($))return $.map((X)=>({relationName:typeof X==="string"?j(X):j(String(X.model)),relation:X}));return Object.entries($).map(([X,J])=>{if(typeof J==="string")return{relationName:X,relation:J};return{relationName:X,relation:{model:J.model,pivotTable:J.table,firstForeignKey:J.foreignKey,secondForeignKey:J.relatedKey}}})}async function HQ(Z){if(typeof Z==="string")Z=(await import(Z)).default;return Z.table??j(Z5(Z?.name||""))}function F0(Z,$){if(Z.name)return Z.name;return c.basename($).replace(/\.ts$/,"")}function b(Z,$){if(Z.table)return Z.table;return j(Z5(F0(Z,$)))}function P2(Z,$){let X=[Z,$];return X.sort(),X.join("_")}function zQ(Z,$){return $ in Z}async function N2(Z,$){let X=[];if(Z.hasOne)for(let J of Z.hasOne)X.push(await p8(J,Z,$,"hasOne"));if(Z.hasMany)for(let J of Z.hasMany)X.push(await p8(J,Z,$,"hasMany"));if(Z.belongsTo)for(let J of Z.belongsTo)X.push(await p8(J,Z,$,"belongsTo"));if(Z.hasOneThrough)for(let J of Z.hasOneThrough)X.push(await a$(J,Z,$,"hasOneThrough"));if(Z.hasManyThrough)for(let J of Z.hasManyThrough)X.push(await a$(J,Z,$,"hasManyThrough"));if(Z.belongsToMany)for(let{relationName:J,relation:Y}of $5(Z))X.push(await I2(Y,Z,$,"belongsToMany",J));if(Z.morphOne)X.push(await e$(Z.morphOne,Z,$,"morphOne"));if(Z.morphMany){let J=Array.isArray(Z.morphMany)?Z.morphMany:[Z.morphMany];for(let Y of J)X.push(await e$(Y,Z,$,"morphMany"))}if(Z.morphTo){let J=Z.morphTo,Y=Array.isArray(J)?J:typeof J==="object"&&J!==null?[J]:[];for(let Q of Y)X.push(k2(Q,Z,$))}if(Z.morphToMany){let J=Array.isArray(Z.morphToMany)?Z.morphToMany:[Z.morphToMany];for(let Y of J)X.push(o$(Y,Z,$,"morphToMany"))}if(Z.morphedByMany){let J=Array.isArray(Z.morphedByMany)?Z.morphedByMany:[Z.morphedByMany];for(let Y of J)X.push(o$(Y,Z,$,"morphedByMany"))}return X}function k2(Z,$,X){let J=Z&&typeof Z==="object"&&Z.name?String(Z.name):`${j(X)}able`,Y=Z?.type||`${J}_type`;return{relationship:"morphTo",model:"",table:"",relationTable:"",foreignKey:Z?.id||`${J}_id`,modelKey:Y,relationName:J,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:"",pivotKey:"",pivotTable:""}}function o$(Z,$,X,J){let Y=typeof Z==="object"&&Z!==null,Q=Y?String(Z.model||""):String(Z),G=Y&&Z.morphName?String(Z.morphName):`${j(X)}able`,W=Y&&Z.pivotTable?String(Z.pivotTable):G,V=Y&&Z.id||`${G}_id`,B=Y&&Z.type||`${G}_type`;return{relationship:J,model:Q,table:"",relationTable:"",foreignKey:V,modelKey:B,relationName:G,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:V,pivotKey:B,pivotTable:W}}async function H8(Z,$){let X=r8(`${$}.ts`),J=r8(`${Z}.ts`),Y=i8(`${Z}.ts`),Q=i8(`${$}.ts`);if(!X&&!Q)throw Error(`Model not found: ${$}`);if(!J&&!Y)throw Error(`Model not found: ${Z}`);let G;try{if($0.existsSync(X))G=(await import(X)).default;else G=(await import(Q)).default}catch(V){throw Error(`Failed to load model: ${$}. Error: ${V?.message||"Unknown error"}`)}let W=$0.existsSync(J)?J:Y;return{modelRelation:G,modelPath:W,modelRelationPath:$0.existsSync(X)?X:Q}}async function a$(Z,$,X,J){let Y="",Q="",G="",W="";if(K8(Z))Y=Z;else Y=Z.model,Q=Z.relationName||"",G=Z.through,W=Z.throughForeignKey||"";let{modelRelation:V,modelPath:B,modelRelationPath:H}=await H8(X,Y),z=b(V,H),O=b($,B),F=j(F0(V,H)),w=j(X);return{relationship:J,model:Y,table:z,relationTable:O,foreignKey:`${w}_id`,modelKey:`${F}_id`,relationName:Q,relationModel:X,throughModel:G,throughForeignKey:W,pivotForeign:`${w}_id`,pivotKey:`${F}_id`,pivotTable:O}}async function I2(Z,$,X,J,Y){let Q="",G="",W="",V=j(X);if(K8(Z))Q=Z;else Q=Z.model,G=Z.pivotTable||"",W=Z.firstForeignKey||`${V}_id`;let{modelRelation:B,modelPath:H,modelRelationPath:z}=await H8(X,Q),O=b(B,z),F=b($,H),w=j(F0(B,z));return{relationship:J,model:Q,table:O,relationTable:F,foreignKey:typeof Z==="string"?`${V}_id`:Z.firstForeignKey||`${V}_id`,modelKey:typeof Z==="string"?`${w}_id`:Z.secondForeignKey||`${w}_id`,relationName:Y,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:W,pivotKey:`${w}_id`,pivotTable:G}}async function e$(Z,$,X,J){let Y="",Q="",G="",W="";if(K8(Z))Y=Z,Q=`${j(X)}able`;else Y=Z.model,Q=Z.morphName||`${j(X)}able`,G=Z.type||`${Q}_type`,W=Z.id||`${Q}_id`;let{modelRelation:V,modelPath:B,modelRelationPath:H}=await H8(X,Y),z=b(V,H),O=b($,B);return{relationship:J,model:Y,table:z,relationTable:O,foreignKey:W||`${Q}_id`,modelKey:G||`${Q}_type`,relationName:Q,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:"",pivotKey:"",pivotTable:O}}async function p8(Z,$,X,J){let Y="",Q="";if(K8(Z))Y=Z;else Y=Z.model,Q=Z.relationName||"";let{modelRelation:G,modelPath:W,modelRelationPath:V}=await H8(X,Y),B=b(G,V),H=b($,W),z=j(F0(G,V)),O=j(X),F={relationship:J,model:Y,table:B,relationTable:H,foreignKey:typeof Z==="string"?`${O}_id`:Z.foreignKey||`${O}_id`,modelKey:`${z}_id`,relationName:Q,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:`${O}_id`,pivotKey:`${z}_id`,pivotTable:H};if(J==="belongsTo")F.foreignKey="";return F}function OQ(Z){let $=/belongs/,X=/has/,J=/Through/,Y=/morph/;if(J.test(Z))return"throughType";if($.test(Z))return"belongsType";if(X.test(Z))return"hasType";if(Y.test(Z))return"morphType";return""}function _Q(Z){let $=/One/;if(/Many/.test(Z))return"many";if($.test(Z))return"one";return""}async function FQ(Z,$){let X=[];if("belongsToMany"in Z){for(let{relation:J}of $5(Z)){let Y,Q;if(typeof J==="string")Q=J;else Q=J.model;let G=r8(`${Q}.ts`),W=i8(`${Q}.ts`);if($0.existsSync(G))Y=(await import(G)).default;else Y=(await import(W)).default;let V=b(Y,G),B=b(Z,$),H=typeof J==="object"&&"firstForeignKey"in J?J.firstForeignKey:`${s$(B)}_${Z.primaryKey}`,z=typeof J==="object"&&"secondForeignKey"in J?J.secondForeignKey:`${s$(V)}_${Z.primaryKey}`;X.push({table:(typeof J==="object"&&"pivotTable"in J?J.pivotTable:void 0)??P2(B,V),firstForeignKey:H,secondForeignKey:z})}return X}return[]}async function wQ(Z){let $=t8([c.userModelsPath("*.ts"),c.storagePath("framework/defaults/app/Models/**/*.ts")],{absolute:!0}),X=[];for(let J=0;J<$.length;J++){let Y=$[J],Q=await import(Y);if(Z===Q.default.name)continue;let G=F0(Q,Y),W=await N2(Q.default,G);if(!W.length)continue;let V=W.find((B)=>B.model===Z);if(V)X.push(V)}return X}function xQ(Z){if(Z===void 0)return[];return Object.keys(Z).filter(($)=>{return Z[$]?.hidden===!0})}function TQ(Z){let $=Z.attributes;if($===void 0)return[];return Object.keys($).filter((X)=>{return $[X]?.guarded===!0}).map((X)=>j(X))}function UQ(Z,$){let X=Z.attributes,J=[];if(X===void 0)return[];let Y=typeof Z.traits?.billable==="object"||typeof Z.traits?.billable==="boolean",Q=typeof Z.traits?.useAuth==="object"?Z.traits?.useAuth.usePasskey:!1,G=Z.traits?.useUuid||!1;if(Y)J.push("stripe_id");if(G)J.push("uuid");if(Q)J.push(...["two_factor_secret","public_key"]);let W=$.map((V)=>V.foreignKey).filter((V)=>V);return[...Object.keys(X).filter((V)=>{if(X===void 0)return!1;return X[V]?.fillable===!0}).map((V)=>j(V)),...J,...W]}async function qQ(Z,$){let X=Z.attributes;if(!X)X={};let J=Object.keys(X),Y=[],Q=Bun.file($),G="";try{if(await Q.exists())G=await Q.text()}catch{G=""}let W=/rule:.*$/gm,V;V=W.exec(G);while(V!==null)Y.push(V[0]),V=W.exec(G);return J.map((H,z)=>{let O=X[H],F=null,w=!1,T=!1,q=!1,L=!1;if(O)F=O||null,w=O.unique||!1,T=O.hidden||!1,q=O.fillable||!1;let E=Y[z]??"";return L=(O.validation?.rule).isRequired??!1,{field:H,default:F,unique:w,hidden:T,fillable:q,required:L,fieldArray:j2(E)}})}function j2(Z){let $=Z.split("rule: schema.");if($.length!==2)return null;if(!$[1])$[1]="";let X=$[1].replace(/,/g,"");if(!X)return null;let J=X.split("."),Y=/\(([^)]+)\)/;return J.map((Q)=>{let G=Y.exec(Q),W=G?G[1]:null;return{entity:Q.replace(Y,"").replace(/\(|\)/g,""),charValue:W}})[0]||null}function LQ(Z){let $=Z.fieldArray?.entity;switch($){case"enum":return"string | string[]";case"date":return"Date | string";case"timestamp":return"Date | string";case"datetime":return"Date | string";case"float":return"number";case"double":return"number";case"decimal":return"number";case"integer":return"number";case"bigint":return"number";default:return $}}function i8(Z){let $=c.join(c.storagePath("framework/defaults/app/Models"),"/"),X=c.join($,Z);if($0.existsSync(X))return X;return t8(`${$}**/${Z}`,{absolute:!0})[0]??""}function r8(Z){let $=c.join(c.userModelsPath("/"),"/"),X=c.join($,Z);if($0.existsSync(X))return X;return t8(`${$}**/${Z}`,{absolute:!0})[0]??""}function DQ(Z){let $=typeof Z==="number"?new Date(Z):typeof Z==="string"?new Date(Z):Z;if(Number.isNaN($.getTime()))throw Error(`Invalid date value: ${String(Z)}`);return $.toISOString().replace("T"," ").split(".")[0]??""}function AQ(Z){return Z.toISOString().split("T")[0]??""}function EQ(Z){return Z.getTime()}import{createModel as LX,registerModel as DX}from"@stacksjs/query-builder";import{log as f}from"@stacksjs/logging";import{snakeCase as d}from"@stacksjs/strings";import{AsyncLocalStorage as N7}from"async_hooks";function S2(Z){if(Z===null||typeof Z!=="object")return!1;let $=Z;return Array.isArray($.data)&&typeof $.current_page==="number"&&typeof $.per_page==="number"&&typeof $.total==="number"&&typeof $.last_page==="number"}function M2(Z){if(Z===null||typeof Z!=="object")return!1;let $=Z;return Array.isArray($.data)&&typeof $.current_page==="number"&&typeof $.per_page==="number"&&typeof $.has_more_pages==="boolean"&&!("total"in $)}function f2(Z){if(Z===null||typeof Z!=="object")return!1;let $=Z;return Array.isArray($.data)&&(typeof $.next_cursor==="string"||$.next_cursor===null)}function s8(Z){let{data:$}=Z,{perPage:X,page:J,total:Y,lastPage:Q}=Z.meta,G=$.length===0,W=G?null:(J-1)*X+1,V=G?null:W+$.length-1;return{data:$,current_page:J,per_page:X,total:Y,last_page:Q,from:W,to:V,has_more_pages:J<Q}}function o8(Z){return{data:Z.data,current_page:Z.meta.page,per_page:Z.meta.perPage,has_more_pages:Z.meta.hasMore}}function a8(Z){return{data:Z.data,per_page:Z.meta.perPage,next_cursor:X5(Z.meta.nextCursor),prev_cursor:X5(Z.meta.prevCursor),has_more_pages:Z.meta.nextCursor!==null&&Z.meta.nextCursor!==void 0}}function X5(Z){if(Z===null||Z===void 0)return null;if(typeof Z==="string")return Z;return JSON.stringify(Z)}function Z9(Z,$){let X=J9(),J=X?e8(X,"per_page"):void 0,Y=X?e8(X,"page"):void 0,Q=Z!==void 0?Math.max(1,Math.floor(Z)):Math.min(100,Math.max(1,J??15)),G=Math.max(1,Math.floor($??Y??1));return{perPage:Q,page:G}}function $9(Z,$){let X=J9(),J=X?Y5(X,"cursor"):void 0,Y=X?e8(X,"per_page"):void 0,Q=Z!==void 0?Math.max(1,Math.floor(Z)):Math.min(100,Math.max(1,Y??15)),W=J5($!==void 0?$:J??null);return{perPage:Q,cursor:W}}function J5(Z){if(Z===null||Z===void 0)return null;if(Array.isArray(Z))return Z;if(typeof Z==="string"&&Z.startsWith("["))try{let $=JSON.parse(Z);if(Array.isArray($))return $}catch{}return Z}function X9(Z){let $=J9();if(!$)return Z;let X=(()=>{try{return new URL($.url)}catch{return null}})();if(!X)return Z;let J=X.pathname;if(Z.path=J,"next_cursor"in Z)return Z.next_page_url=Z.next_cursor!==null?o(X,{cursor:Z.next_cursor}):null,Z.prev_page_url=Z.prev_cursor!==null?o(X,{cursor:Z.prev_cursor}):null,Z;let Y=Z.current_page;if(Z.prev_page_url=Y>1?o(X,{page:Y-1}):null,"total"in Z){let Q=Z.last_page;Z.next_page_url=Y<Q?o(X,{page:Y+1}):null,Z.first_page_url=o(X,{page:1}),Z.last_page_url=o(X,{page:Q})}else Z.next_page_url=Z.has_more_pages?o(X,{page:Y+1}):null;return Z}function o(Z,$){let X=new URL(Z.toString());for(let[J,Y]of Object.entries($))X.searchParams.set(J,String(Y));return`${X.pathname}${X.search}`}var X0;function J9(){if(X0===null)return;if(X0===void 0)try{let $=D("@stacksjs/router");if(typeof $.getCurrentRequest==="function")X0=$.getCurrentRequest;else{X0=null;return}}catch{X0=null;return}return X0()}function e8(Z,$){let X=Y5(Z,$);if(X===void 0)return;let J=Number(X);return Number.isFinite(J)?J:void 0}function Y5(Z,$){let X=Z.query?.[$];if(X===void 0)return;return Array.isArray(X)?X[0]:X}import{db as xX}from"@stacksjs/database";function w7(Z){let $=xX;return{async createStripeUser(X,J){let{manageCustomer:Y}=await import("@stacksjs/payments");return await Y.createStripeCustomer(X,J)},async updateStripeUser(X,J){let{manageCustomer:Y}=await import("@stacksjs/payments");return await Y.updateStripeCustomer(X,J)},async deleteStripeUser(X){let{manageCustomer:J}=await import("@stacksjs/payments");return await J.deleteStripeUser(X)},async createOrGetStripeUser(X,J){let{manageCustomer:Y}=await import("@stacksjs/payments");return await Y.createOrGetStripeUser(X,J)},async retrieveStripeUser(X){let{manageCustomer:J}=await import("@stacksjs/payments");return await J.retrieveStripeUser(X)},async defaultPaymentMethod(X){let{managePaymentMethod:J}=await import("@stacksjs/payments");return await J.retrieveDefaultPaymentMethod(X)},async setDefaultPaymentMethod(X,J){let{managePaymentMethod:Y}=await import("@stacksjs/payments");return await Y.setDefaultPaymentMethod(X,J)},async addPaymentMethod(X,J){let{managePaymentMethod:Y}=await import("@stacksjs/payments");return await Y.addPaymentMethod(X,J)},async paymentMethods(X,J){let{managePaymentMethod:Y}=await import("@stacksjs/payments");return await Y.listPaymentMethods(X,J)},async newSubscription(X,J,Y,Q={}){let{manageSubscription:G}=await import("@stacksjs/payments"),W=await G.create(X,J,Y,Q),B=W.latest_invoice?.payment_intent;return{subscription:W,paymentIntent:B}},async updateSubscription(X,J,Y,Q={}){let{manageSubscription:G}=await import("@stacksjs/payments"),W=await G.update(X,J,Y,Q),B=W.latest_invoice?.payment_intent;return{subscription:W,paymentIntent:B}},async cancelSubscription(X,J,Y={}){let{manageSubscription:Q}=await import("@stacksjs/payments");return{subscription:await Q.cancel(J,Y)}},async activeSubscription(X){let{manageSubscription:J}=await import("@stacksjs/payments"),Y=await $.selectFrom("subscriptions").where("user_id","=",X.id).where("provider_status","=","active").selectAll().executeTakeFirst();if(Y){let Q=await J.retrieve(X,Y.provider_id||"");return{subscription:Y,providerSubscription:Q}}return},async checkout(X,J,Y={}){let{manageCheckout:Q,manageCustomer:G}=await import("@stacksjs/payments"),W={};if(Y.enableTax)W.automatic_tax={enabled:!0},delete Y.enableTax;if(Y.allowPromotions)W.allow_promotion_codes=!0,delete Y.allowPromotions;let H={...{mode:"payment",customer:(await G.createOrGetStripeUser(X,{})).id,line_items:J.map((z)=>({price:z.priceId,quantity:z.quantity||1}))},...W,...Y};return await Q.create(X,H)},async createSetupIntent(X,J={}){let{manageSetupIntent:Y}=await import("@stacksjs/payments");return await Y.create(X,J)},async subscriptionHistory(X){let{manageInvoice:J}=await import("@stacksjs/payments");return await J.list(X)},async transactionHistory(X){let{manageTransaction:J}=await import("@stacksjs/payments");return await J.list(X)},async connectAccount(X,J={}){let Y=J.accountColumn||"stripe_account_id",Q=(X._attributes??X)[Y];if(!Q)return null;let G=await e6();try{return await G.accounts.retrieve(Q)}catch{return null}},async createConnectAccount(X,J={}){let Y=J.accountColumn||"stripe_account_id",Q=X._attributes??X,G=Q[Y],W=await e6();if(!G){let{stacksIdempotencyKey:V}=await import("@stacksjs/payments"),B=J.modelTable||Z,H=await W.accounts.create({type:J.type??"express",email:J.email??Q.email,country:J.country??"US",capabilities:J.capabilities??{card_payments:{requested:!0},transfers:{requested:!0}}},{idempotencyKey:V("connect.account.create",B,Q.id)});return G=H.id,await $.updateTable(B).set({[Y]:G}).where("id","=",Number(Q.id)).execute(),H}return await W.accounts.retrieve(G)},async connectOnboardLink(X,J){let Y=J.accountColumn||"stripe_account_id",G=(X._attributes??X)[Y];if(!G)throw Error("connectOnboardLink: model has no Stripe Connect account; call createConnectAccount first");return{url:(await(await e6()).accountLinks.create({account:G,refresh_url:J.refreshUrl,return_url:J.returnUrl,type:J.type??"account_onboarding"})).url,accountId:G}},async syncConnectStatus(X,J={}){let Y=J.accountColumn||"stripe_account_id",Q=J.chargesColumn||"charges_enabled",G=J.payoutsColumn||"payouts_enabled",W=X._attributes??X,V=W[Y];if(!V)return{chargesEnabled:!1,payoutsEnabled:!1};let H=await(await e6()).accounts.retrieve(V),z=!!H.charges_enabled,O=!!H.payouts_enabled,F=J.modelTable||Z;return await $.updateTable(F).set({[Q]:z,[G]:O}).where("id","=",Number(W.id)).execute(),{chargesEnabled:z,payoutsEnabled:O}},async chargeWithSplit(X,J){let Y=await e6(),Q=J.accountColumn||"stripe_account_id",G=X._attributes??X,W=J.connectAccountId||G[Q],V={amount:J.amountCents,currency:J.currency||"usd",automatic_payment_methods:{enabled:!0},metadata:J.metadata};if(W){if(V.transfer_data={destination:W},J.platformFeeCents)V.application_fee_amount=J.platformFeeCents}let{freshIdempotencyKey:B}=await import("@stacksjs/payments");return await Y.paymentIntents.create(V,{idempotencyKey:B("payment_intent.create",G.id,J.amountCents)})}}}async function e6(){let Z=globalThis.process?.env?.STRIPE_SECRET_KEY;if(!Z)throw Error("Stripe Connect: STRIPE_SECRET_KEY not configured");return new(await Promise.resolve().then(() => (F7(),_7))).default(Z,{apiVersion:"2026-06-24.dahlia"})}function x7(){return{async generateTwoFactorForModel(Z){let{generateTwoFactorSecret:$}=await import("@stacksjs/auth"),X=$();await Z.update({two_factor_secret:X})},async verifyTwoFactorCode(Z,$){let X=Z.get("two_factor_secret");if(typeof X!=="string")return!1;let{verifyTwoFactorCode:J,RateLimiter:Y}=await import("@stacksjs/auth"),Q=String(Z.id??Z.get?.("id")??Z.get?.("email")??X),G=`2fa:${Q}`;if(await Y.isRateLimited(G)){let{HttpError:V}=await import("@stacksjs/error-handling");throw new V(429,"Too many verification attempts. Please try again later.")}if(!await J($,X))return await Y.recordFailedAttempt(G),!1;try{let{cache:V}=await import("@stacksjs/cache"),B=`2fa:used:${Q}:${$}`;if(await V.has(B))return await Y.recordFailedAttempt(G),!1;await V.set(B,"1",90)}catch{}return await Y.resetAttempts(G),!0}}}import{sqlDateTime as TX}from"@stacksjs/database";import{log as W0}from"@stacksjs/logging";var N8="deleted_at";function T7(Z,$="id"){return{async softDelete(X){let J=TX(),Y=Z.where($,X);if(typeof Y?.update==="function")return await Y.update({[N8]:J}),!0;return!1},async restore(X){let J=Z.where($,X);if(typeof J?.update==="function")return await J.update({[N8]:null}),!0;return!1},async forceDelete(X){let J=Z.where($,X);if(typeof J?.delete==="function")return await J.delete(),!0;return!1},withTrashed(){return typeof Z.query==="function"?Z.query():Z},onlyTrashed(){let X=typeof Z.query==="function"?Z.query():Z;if(typeof X?.whereNotNull==="function")return X.whereNotNull(N8);return X?.where?.(N8,"!=",null)??X}}}function U7(Z){if(Z===!0||Z==null)return{};if(typeof Z==="object"&&!Array.isArray(Z)){let $=Z;if(Array.isArray($.cascade)){let X=$.cascade.filter((J)=>typeof J==="string");return X.length?{cascade:X}:{}}return{}}return{}}function UX(Z,$){let X=Z.hasMany??[],J=Z.hasOne??[],Y=X.some((H)=>S$(H,$,!0)),Q=J.some((H)=>S$(H,$,!1));if(!Y&&!Q)return W0.warn(`[orm] soft-delete cascade: '${$}' is not a declared hasMany/hasOne relation \u2014 skipping`),null;let W=(Y?X:J).find((H)=>S$(H,$,Y))??null;if(!W)return null;let B=globalThis[W];if(!B)return W0.warn(`[orm] soft-delete cascade: model '${W}' is not yet on globalThis \u2014 skipping cascade for '${$}'`),null;return{className:W,model:B}}function S$(Z,$,X){let J=Z.toLowerCase();if($===J)return!0;if(X&&$===`${J}s`)return!0;if(X&&J.endsWith("y")&&$===`${J.slice(0,-1)}ies`)return!0;return!1}async function qX(Z,$,X,J,Y){try{let Q=X.where;if(typeof Q!=="function"){W0.warn(`[orm] cascade ${Y}: child model has no .where()`);return}if(Y==="softDelete"){let G=X.softDelete;if(typeof G==="function"){let V=Q.call(X,J,$),B=typeof V?.get==="function"?await V.get():Array.isArray(V)?V:[],H=X.primaryKey||"id";for(let z of B){let O=z?.[H];if(O!=null)await G.call(X,O)}return}let W=Q.call(X,J,$);if(typeof W?.delete==="function"){W0.debug(`[orm] cascade soft-delete: child has no softDeletes trait, hard-deleting from ${String(X.table??"?")}`),await W.delete();return}}else{let G=X.restore;if(typeof G!=="function"){W0.debug("[orm] cascade restore: child has no restore() \u2014 nothing to do");return}let W=X.withTrashed,B=(typeof W==="function"?W.call(X):X).where?.(J,$),H=typeof B?.get==="function"?await B.get():[],z=X.primaryKey||"id";for(let O of H){let F=O?.[z];if(F!=null)await G.call(X,F)}}}catch(Q){if(W0.warn(`[orm] soft-delete cascade ${Y} on ${Z}#${String($)} failed`,{error:Q}),process.env.STACKS_ORM_CASCADE_SWALLOW!=="true")throw Q}}async function Z8(Z,$,X,J){let Y=$.cascade;if(!Y||Y.length===0)return;let Q=`${Z.name.toLowerCase()}_id`;for(let G of Y){let W=UX(Z,G);if(!W)continue;await qX(W.className,X,W.model,Q,J)}}var k7=new N7;function Z0(){return k7.getStore()?.suppressed===!0}function e(Z){return Promise.resolve(k7.run({suppressed:!0},Z))}var I7=new N7;function AX(){return I7.getStore()?.suppressed===!0}function EX(Z){return Promise.resolve(I7.run({suppressed:!0},Z))}var v$=Symbol.for("stacks.orm.modelDefinition");class j7 extends Error{status=422;errors;constructor(Z,$){let X=Object.keys($).join(", ");super(`${Z} validation failed: ${X}`);this.name="ModelValidationError",this.errors=$}}var q7=new Set;function CX(Z,$){let X=typeof Z==="string"?Z.slice(0,80):String(Z),J=`${typeof Z}:${X}`;if(q7.has(J))return;q7.add(J);let Y=$ instanceof Error?$.message:String($);console.error(`[orm] JSON cast failed to parse value (returning null): ${Y} \u2014 value preview: ${JSON.stringify(X)}`)}var PX={string:{get:(Z)=>Z!=null?String(Z):null,set:(Z)=>Z!=null?String(Z):null},number:{get:(Z)=>Z!=null?Number(Z):null,set:(Z)=>Z!=null?Number(Z):null},integer:{get:(Z)=>Z!=null?Math.trunc(Number(Z)):null,set:(Z)=>Z!=null?Math.trunc(Number(Z)):null},float:{get:(Z)=>Z!=null?Number.parseFloat(String(Z)):null,set:(Z)=>Z!=null?Number.parseFloat(String(Z)):null},boolean:{get:(Z)=>Z===1||Z==="1"||Z===!0||Z==="true",set:(Z)=>Z===!0||Z===1||Z==="1"||Z==="true"?1:0},json:{get:(Z)=>{if(Z==null)return null;if(typeof Z==="string")try{return JSON.parse(Z)}catch($){return CX(Z,$),null}return Z},set:(Z)=>{if(Z==null)return null;return typeof Z==="string"?Z:JSON.stringify(Z)}},datetime:{get:(Z)=>Z?new Date(Z):null,set:(Z)=>Z instanceof Date?Z.toISOString():Z},date:{get:(Z)=>Z?new Date(Z):null,set:(Z)=>Z instanceof Date?Z.toISOString().split("T")[0]:Z},array:{get:(Z)=>{if(Z==null)return[];if(Array.isArray(Z))return Z;if(typeof Z==="string")try{return JSON.parse(Z)}catch{return[]}return[]},set:(Z)=>{if(Z==null)return null;return Array.isArray(Z)?JSON.stringify(Z):Z}}};function S7(Z){return typeof Z==="string"?PX[Z]:Z}function L7(Z,$,X){if(!Z||typeof Z!=="object")return Z;let J={...Z};for(let[Y,Q]of Object.entries($))if(Y in J){let G=S7(Q);J[Y]=G[X](J[Y])}return J}var k8=new Set(["_attributes","_original","_definition","_hasSaved","_relations"]),D7=Symbol.for("stacks.modelInstanceProxy"),NX={tags:{bag:"_taggable",mode:"id"},tagCount:{bag:"_taggable",mode:"id"},addTag:{bag:"_taggable",mode:"id"},activeTags:{bag:"_taggable",mode:"id"},inactiveTags:{bag:"_taggable",mode:"id"},removeTag:{bag:"_taggable",mode:"id"},categories:{bag:"_categorizable",mode:"id"},categoryCount:{bag:"_categorizable",mode:"id"},addCategory:{bag:"_categorizable",mode:"id"},activeCategories:{bag:"_categorizable",mode:"id"},inactiveCategories:{bag:"_categorizable",mode:"id"},removeCategory:{bag:"_categorizable",mode:"id"},comments:{bag:"_commentable",mode:"id"},commentCount:{bag:"_commentable",mode:"id"},addComment:{bag:"_commentable",mode:"id"},approvedComments:{bag:"_commentable",mode:"id"},pendingComments:{bag:"_commentable",mode:"id"},rejectedComments:{bag:"_commentable",mode:"id"},likes:{bag:"_likeable",mode:"id"},likeCount:{bag:"_likeable",mode:"id"},like:{bag:"_likeable",mode:"id"},unlike:{bag:"_likeable",mode:"id"},isLiked:{bag:"_likeable",mode:"id"},createStripeUser:{bag:"_billable",mode:"model"},updateStripeUser:{bag:"_billable",mode:"model"},deleteStripeUser:{bag:"_billable",mode:"model"},createOrGetStripeUser:{bag:"_billable",mode:"model"},retrieveStripeUser:{bag:"_billable",mode:"model"},defaultPaymentMethod:{bag:"_billable",mode:"model"},setDefaultPaymentMethod:{bag:"_billable",mode:"model"},addPaymentMethod:{bag:"_billable",mode:"model"},paymentMethods:{bag:"_billable",mode:"model"},newSubscription:{bag:"_billable",mode:"model"},updateSubscription:{bag:"_billable",mode:"model"},cancelSubscription:{bag:"_billable",mode:"model"},activeSubscription:{bag:"_billable",mode:"model"},checkout:{bag:"_billable",mode:"model"},createSetupIntent:{bag:"_billable",mode:"model"},subscriptionHistory:{bag:"_billable",mode:"model"},transactionHistory:{bag:"_billable",mode:"model"},connectAccount:{bag:"_billable",mode:"model"},createConnectAccount:{bag:"_billable",mode:"model"},connectOnboardLink:{bag:"_billable",mode:"model"},syncConnectStatus:{bag:"_billable",mode:"model"},chargeWithSplit:{bag:"_billable",mode:"model"},generateTwoFactorForModel:{bag:"_twoFactor",mode:"model"},verifyTwoFactorCode:{bag:"_twoFactor",mode:"model"}};function kX(Z,$){if(!Z||!$)return null;let X=$.split("."),J=Z;for(let Y of X){if(J==null||typeof J!=="object")return null;let Q=J;if("_attributes"in Q&&Q._attributes&&typeof Q._attributes==="object"){let G=Q._attributes;if(Y in G){J=G[Y];continue}}if(Y in Q){J=Q[Y];continue}return null}return J??null}function R(Z,$){if(!Z||typeof Z!=="object")return Z;if(Z[D7])return Z;let X=Z._attributes;if(!X||typeof X!=="object")return Z;if($&&Object.keys($).length>0){for(let[J,Y]of Object.entries($))if(Object.prototype.hasOwnProperty.call(X,J))X[J]=S7(Y).get(X[J])}return new Proxy(Z,{get(J,Y,Q){if(Y===D7)return!0;if(Y==="saveAsync")return async function(){let W=J._definition,V=W?.set;if(V&&typeof J.isDirty==="function"){for(let[H,z]of Object.entries(V)){if(typeof z!=="function")continue;if(!J.isDirty(H))continue;let O=z(J._attributes),F=O&&typeof O.then==="function"?await O:O;J._attributes[H]=F}let B=W.set;W.set={};try{return J.save()}finally{W.set=B}}return J.save()};if(Y==="save")return function(){let W=J._definition,V=W?.set;if(V&&Object.keys(V).length>0&&typeof J.isDirty==="function"){for(let[H,z]of Object.entries(V)){if(typeof z!=="function")continue;if(!J.isDirty(H))continue;let O=z(J._attributes);if(O&&typeof O.then==="function")throw Error(`Setter for "${H}" returned a Promise \u2014 use \`saveAsync()\` instead of \`save()\` when a model has async setters.`);J._attributes[H]=O}let B=W.set;W.set={};try{return J.save()}finally{W.set=B}}return J.save()};if(Y==="updateAsync")return async function(W){if(W&&typeof W==="object"&&!Array.isArray(W))for(let[V,B]of Object.entries(W))Q[V]=B;return Q.saveAsync()};if(Y==="saveQuietly")return function(){return e(()=>J.save())};if(Y==="saveAsyncQuietly")return function(){return e(()=>Q.saveAsync())};if(Y==="updateQuietly")return function(W){return e(()=>J.update(W))};if(Y==="updateAsyncQuietly")return function(W){return e(()=>Q.updateAsync(W))};if(Y==="deleteQuietly")return function(){return e(()=>J.delete())};if(Y==="toSearchableObject")return function(){let B=J._definition?.traits?.useSearch;if(!B)return null;let H=J._attributes;if(!H)return null;if(B===!0){let T={...H};if(H.id!=null)T.id=String(H.id);return T}let z={},O=B.displayable?.length?B.displayable:[...B.searchable??[],...B.filterable??[],...B.sortable??[],"id"],F=B.denormalize??{},w=J._relations;for(let T of O){let q=d(T),L=H[q]??H[T];if(L!==void 0){z[q]=L;continue}let E=F[T]??F[q];if(E){z[q]=kX(w,E);continue}z[q]=void 0}if(H.id!=null)z.id=String(H.id);return z};if(typeof Y==="string"&&!k8.has(Y)){let W=J._attributes;if(W&&Object.prototype.hasOwnProperty.call(W,Y))return W[Y];let V=J._relations;if(V&&Object.prototype.hasOwnProperty.call(V,Y)){let H=V[Y];if(Array.isArray(H))return H.map((z)=>R(z,$));return R(H,$)}let B=NX[Y];if(B){let O=J._definition?.__traitMethods?.[B.bag]?.[Y];if(typeof O==="function")return B.mode==="model"?(...F)=>O(Q,...F):(...F)=>O(J.id,...F)}if(W){let H=d(Y);if(H!==Y&&Object.prototype.hasOwnProperty.call(W,H))return W[H]}}let G=Reflect.get(J,Y,J);return typeof G==="function"?G.bind(J):G},set(J,Y,Q,G){if(typeof Y==="string"&&!k8.has(Y)){let{_attributes:W,set:V}=J;if(W&&Object.prototype.hasOwnProperty.call(W,Y)){if(typeof V==="function")V.call(J,Y,Q);else W[Y]=Q;return!0}if(W){let B=d(Y);if(B!==Y&&Object.prototype.hasOwnProperty.call(W,B)){if(typeof V==="function")V.call(J,B,Q);else W[B]=Q;return!0}}if(W&&!(Y in J)){if(typeof V==="function")V.call(J,Y,Q);else W[Y]=Q;return!0}}return Reflect.set(J,Y,Q,G)},has(J,Y){if(typeof Y==="string"&&!k8.has(Y)){let Q=J._attributes;if(Q&&Object.prototype.hasOwnProperty.call(Q,Y))return!0;let G=J._relations;if(G&&Object.prototype.hasOwnProperty.call(G,Y))return!0;if(Q){let W=d(Y);if(W!==Y&&Object.prototype.hasOwnProperty.call(Q,W))return!0}}return Reflect.has(J,Y)},deleteProperty(J,Y){if(typeof Y==="string"&&!k8.has(Y)){let Q=J._attributes;if(Q&&Object.prototype.hasOwnProperty.call(Q,Y))return delete Q[Y],!0}return Reflect.deleteProperty(J,Y)},ownKeys(J){let Y=J._attributes;return Y?Object.keys(Y):[]},getOwnPropertyDescriptor(J,Y){if(typeof Y==="string"){let Q=J._attributes;if(Q&&Object.prototype.hasOwnProperty.call(Q,Y))return{configurable:!0,enumerable:!0,value:Q[Y],writable:!0}}return Object.getOwnPropertyDescriptor(J,Y)}})}var IX=new Set(["get","first","last","firstOrFail","find","findOrFail","all","paginate","simplePaginate","cursorPaginate"]),jX={paginate:s8,simplePaginate:o8,cursorPaginate:a8},A7=Symbol.for("stacks.queryBuilderProxy");function M7(Z,$){if(!Z||typeof Z!=="object")return Z;if(Z[A7])return Z;return new Proxy(Z,{get(X,J,Y){if(J===A7)return!0;let Q=Reflect.get(X,J,Y);if(typeof Q!=="function")return Q;return function(...G){let W=G,V=String(J);if(V==="paginate"||V==="simplePaginate"){let{perPage:z,page:O}=Z9(G[0],G[1]);W=[z,O]}else if(V==="cursorPaginate"){let{perPage:z,cursor:O}=$9(G[0],G[1]);W=[z,O,G[2],G[3]]}let B=Q.apply(X,W),H=(z)=>{if(IX.has(V)){if(Array.isArray(z))return z.map((F)=>R(F,$));let O=jX[V];if(O&&z&&Array.isArray(z.data)){let F=z.data.map((T)=>R(T,$)),w=O({...z,data:F});return X9(w)}if(z&&Array.isArray(z.data))return{...z,data:z.data.map((F)=>R(F,$))};return R(z,$)}if(z&&typeof z==="object"&&typeof z.get==="function")return M7(z,$);return z};if(B&&typeof B.then==="function")return B.then(H);return H(B)}}})}function SX(Z,$){let X=["find","first","last","all","firstOrFail","findOrFail","findMany"];for(let Q of X){let G=Z[Q];if(typeof G!=="function")continue;Z[Q]=function(...W){let V=G.apply(this,W),B=(H)=>Array.isArray(H)?H.map((z)=>R(z,$)):R(H,$);if(V&&typeof V.then==="function")return V.then(B);return B(V)}}let J=["create","firstOrCreate","updateOrCreate","make"];for(let Q of J){let G=Z[Q];if(typeof G!=="function")continue;Z[Q]=function(...W){let V=G.apply(this,W),B=(H)=>Array.isArray(H)?H.map((z)=>R(z,$)):R(H,$);if(V&&typeof V.then==="function")return V.then(B);return B(V)}}let Y=["query","where","orWhere","whereIn","whereNotIn","whereNull","whereNotNull","whereLike","whereBetween","whereNotBetween","orderBy","orderByDesc","select","with","limit","take","skip","latest","oldest"];for(let Q of Y){let G=Z[Q];if(typeof G!=="function")continue;Z[Q]=function(...W){let V=G.apply(this,W);return M7(V,$)}}}class f7 extends Error{model;id;constructor(Z,$){super($!=null?`[ORM] ${Z} not found for id=${String($)}`:`[ORM] No matching ${Z} row`);this.name="ModelNotFoundError",this.model=Z,this.id=$}}class f$ extends Error{model;attribute;reason;constructor(Z,$,X){let J=X==="guarded"?`'${$}' is marked guarded`:`'${$}' is not in the fillable allowlist`;super(`[ORM] Mass assignment to ${Z} forbidden: ${J}. Use ${Z}.forceCreate(...) / .forceUpdate(...) to bypass.`);this.name="MassAssignmentException",this.model=Z,this.attribute=$,this.reason=X}}var MX=new Set(["id","created_at","updated_at","deleted_at","uuid"]);function $8(Z,$,X={}){if(X.force)return $;if(!$||typeof $!=="object"||Array.isArray($))return $;let J=Z.attributes;if(!J)return $;let Y=new Set,Q=new Set,G=new Set;for(let[V,B]of Object.entries(J)){let H=d(V);if(Y.add(H),B?.fillable===!0)Q.add(H);if(B?.guarded===!0)G.add(H)}let W=Q.size>0?Q:Y;for(let V of Object.keys($)){let B=d(V);if(MX.has(B))continue;if(G.has(B))throw new f$(Z.name,V,"guarded");if(B.endsWith("_id"))continue;if(!W.has(B))throw new f$(Z.name,V,"not-fillable")}return $}async function y$(Z,$){let X=Z.set;if(!X||typeof X!=="object")return $;let J={...$};for(let[Y,Q]of Object.entries(X)){if(typeof Q!=="function"||!(Y in J))continue;try{J[Y]=await Q(J)}catch(G){f.error(`[orm] ${Z.name}.set.${Y} threw \u2014 skipping setter`,G)}}return J}function fX(Z,$){let X=$.primaryKey||"id",J=Z.create;function Y(B){let H=Z.where;if(typeof H!=="function")throw Error(`[ORM] ${$.name}.${B} needs a working where(): the underlying query builder did not expose one`);return H}function Q(B){let H=Z.find;if(typeof H!=="function")throw Error(`[ORM] ${$.name}.${B} needs a working find(): the underlying query builder did not expose one`);return H}function G(B){let H=Z.create;if(typeof H!=="function")throw Error(`[ORM] ${$.name}.${B} cannot create: the underlying query builder did not expose create()`);return H}if(typeof Z.update!=="function")Z.update=async function(B,H){if(B==null)throw Error(`[ORM] ${$.name}.update requires an id as the first argument`);if(!H||typeof H!=="object"||Array.isArray(H))throw Error(`[ORM] ${$.name}.update requires a data object as the second argument`);if(Object.keys(H).length===0){f.debug(`[orm] ${$.name}.update called with empty data \u2014 short-circuiting and returning current row`);let F=Z.find;return typeof F==="function"?await F.call(Z,B):null}$8($,H);let z=await y$($,H);await Y("update").call(Z,X,B).update(z);let O=Z.find;return typeof O==="function"?await O.call(Z,B):null};if(typeof Z.forceUpdate!=="function")Z.forceUpdate=async function(B,H){if(B==null)throw Error(`[ORM] ${$.name}.forceUpdate requires an id as the first argument`);if(!H||typeof H!=="object"||Array.isArray(H))throw Error(`[ORM] ${$.name}.forceUpdate requires a data object as the second argument`);let z=await y$($,H);await Y("forceUpdate").call(Z,X,B).update(z);let O=Z.find;return typeof O==="function"?await O.call(Z,B):null};if(typeof Z.forceCreate!=="function")Z.forceCreate=async function(B){if(!B||typeof B!=="object"||Array.isArray(B))throw Error(`[ORM] ${$.name}.forceCreate requires a data object`);let H=Z.make;if(typeof H==="function"){let z=await H.call(Z);if(z&&typeof z.forceFill==="function"&&typeof z.save==="function")return z.forceFill(B),await z.save()??z}if(typeof J!=="function")throw Error(`[ORM] ${$.name}.forceCreate cannot create: the underlying query builder did not expose create()`);return await J.call(Z,B)};if(typeof Z.delete!=="function")Z.delete=async function(B){if(B==null)throw Error(`[ORM] ${$.name}.delete requires an id as the first argument`);if(!await Q("delete").call(Z,B))return!1;return await Y("delete").call(Z,X,B).delete(),!0};if(typeof Z.findOrFail!=="function")Z.findOrFail=async function(B){let H=await Q("findOrFail").call(Z,B);if(H==null)throw new f7($.name,B);return H};if(typeof Z.exists!=="function")Z.exists=async function(B){if(B==null)return!1;let H=Y("exists").call(Z,X,B);if(typeof H.count==="function"){let O=await H.count();return Number(O)>0}let z=Z.find;return typeof z==="function"?await z.call(Z,B)!=null:!1};if(typeof Z.firstOrCreate!=="function")Z.firstOrCreate=async function(B,H={}){if(!B||typeof B!=="object"||Array.isArray(B))throw Error(`[ORM] ${$.name}.firstOrCreate requires a where-attrs object`);let z=Y("firstOrCreate").call(Z,B),O=typeof z.first==="function"?await z.first():await z;if(O)return O;let F={...B,...H};return $8($,F),await G("firstOrCreate").call(Z,F)};if(typeof Z.updateOrCreate!=="function")Z.updateOrCreate=async function(B,H){if(!B||typeof B!=="object"||Array.isArray(B))throw Error(`[ORM] ${$.name}.updateOrCreate requires a where-attrs object`);if(!H||typeof H!=="object"||Array.isArray(H))throw Error(`[ORM] ${$.name}.updateOrCreate requires a values object`);let z=Y("updateOrCreate").call(Z,B),O=typeof z.first==="function"?await z.first():await z;if(O){$8($,H);let w=O[X];await Y("updateOrCreate").call(Z,X,w).update(H);let T=Z.find;return typeof T==="function"?await T.call(Z,w):{...O,...H}}let F={...B,...H};return $8($,F),await G("updateOrCreate").call(Z,F)};if(typeof Z.count!=="function")Z.count=async function(){let B=Z;if(typeof B.query==="function"){let O=B.query();if(typeof O?.count==="function"){let F=await O.count();return Number(F)||0}}let{all:H,get:z}=Z;if(typeof H==="function")return(await H.call(Z)||[]).length;if(typeof z==="function")return(await z.call(Z)||[]).length;return 0};if(typeof Z.pluck!=="function")Z.pluck=async function(B){if(!B||typeof B!=="string")throw Error(`[ORM] ${$.name}.pluck requires a column name`);let H=Z.all;return((typeof H==="function"?await H.call(Z):[])||[]).map((O)=>O?.[B])};if(typeof Z.whereIn!=="function")Z.whereIn=async function(B,H){if(!B||typeof B!=="string")throw Error(`[ORM] ${$.name}.whereIn requires a column name`);if(!Array.isArray(H))throw Error(`[ORM] ${$.name}.whereIn requires an array of values`);if(H.length===0)return[];let z=Z.where;if(typeof z!=="function")return[];let O=z.call(Z,B,"in",H);if(O&&typeof O.get==="function")return await O.get();return await O};let W=[["latest","desc"],["oldest","asc"]];for(let[B,H]of W)if(typeof Z[B]!=="function")Z[B]=async function(z="created_at"){let O=Z,F=typeof O.query==="function"?O.query():O;if(typeof F?.orderBy==="function"){let L=F.orderBy(z,H);if(typeof L.first==="function")return await L.first();if(typeof L.get==="function")return(await L.get())?.[0]??null}let w=Z.all;if(typeof w!=="function")return null;return[...await w.call(Z)||[]].sort((L,E)=>{let P=L?.[z],I=E?.[z];if(P===I)return 0;return(P>I?1:-1)*(H==="desc"?-1:1)})[0]??null};let V=v7($.traits?.useSearch,$);if(V){let B=V.index??$.table??d(`${$.name}s`);if(typeof Z.search!=="function")Z.search=function(H,z){return RX(Z,B,H,z,V.searchable)};if(typeof Z.makeAllSearchable!=="function")Z.makeAllSearchable=async function(H=500){let z=Z.all;if(typeof z!=="function")throw Error(`[ORM] ${$.name}.makeAllSearchable cannot run: the underlying query builder did not expose all()`);let{useSearchEngine:O}=await import("@stacksjs/search-engine"),F=O(),w=0,T=Z.query;if(typeof T==="function")try{let E=T.call(Z);if(E&&typeof E.chunk==="function")return await E.chunk(H,async(P)=>{let I=await h$(P,V);if(I.length>0)await F.addDocuments(B,I);w+=I.length}),w}catch{}let q=await z.call(Z)||[],L=await h$(q,V);if(L.length>0)await F.addDocuments(B,L);return L.length};if(typeof Z.removeAllFromSearch!=="function")Z.removeAllFromSearch=async function(){let{useSearchEngine:H}=await import("@stacksjs/search-engine"),z=H();if(typeof z.deleteAllDocuments==="function"){await z.deleteAllDocuments(B);return}let O=Z.all,F=typeof O==="function"?await O.call(Z)||[]:[],w=H();for(let T of F){let q=T?.id??T?._attributes?.id;if(q!=null)await w.deleteDocument(B,Number(q))}}}}async function h$(Z,$){if(Z.length===0)return[];if(typeof $.shapeMany==="function"){let J=await $.shapeMany(Z);if(!Array.isArray(J)||J.length!==Z.length)throw TypeError(`[orm/search] shapeMany returned ${Array.isArray(J)?J.length:typeof J} documents for ${Z.length} rows. It must return one document per row, in order, or documents are indexed under the wrong ids.`);return J.filter(Boolean)}return(await Promise.all(Z.map((J)=>vX(J,$)))).filter(Boolean)}function yX(Z){let $=new Set,X=Z.attributes??{};for(let[J,Y]of Object.entries(X))if(Y?.hidden)$.add(J);return $}function hX(Z,$){if(!Z||$.size===0)return Z;let X={};for(let[J,Y]of Object.entries(Z))if(!$.has(J))X[J]=Y;return X}async function vX(Z,$){if(typeof $.shape==="function")try{return await $.shape(Z)}catch{return}let X=Z?.toSearchableObject?.();if(X!==void 0)return X;return hX(Z?._attributes??(typeof Z?.toJSON==="function"?Z.toJSON():null),$.hidden??new Set)}function RX(Z,$,X,J,Y){let Q=Y&&Y.length>0?{query_by:[...Y].join(",")}:{},G={q:X,...Q,...J??{}},W={with(V){return G={...G,...V},W},where(V){return G={...G,filter:V},W},async get(){let{useSearchEngine:V}=await import("@stacksjs/search-engine");return(await V().search($,G))?.hits??[]},async paginate(V,B=1){let{useSearchEngine:H}=await import("@stacksjs/search-engine"),O=await H().search($,{...G,limit:V,offset:(B-1)*V});return{hits:O.hits??[],total:Number(O.estimatedTotalHits??O.nbHits??O.total??0),page:B,perPage:V}},async raw(){let{useSearchEngine:V}=await import("@stacksjs/search-engine");return await V().search($,G)}};return W}function y7(Z){let $=d(Z);return $===Z?[Z]:[Z,$]}async function M$(Z,$){if(!Z||typeof Z!=="object")return;let X=Z._attributes??Z;for(let J of $)for(let Y of y7(J)){if(!(Y in X))continue;let Q=X[Y];if(!K0(Q))continue;X[Y]=await f8(Q)}}function bX(Z,$){if($.length===0)return;let X=async(W)=>{if(Array.isArray(W)){for(let V of W)await M$(V,$);return W}if(W&&typeof W==="object"&&Array.isArray(W.data)){for(let V of W.data)await M$(V,$);return W}if(W)await M$(W,$);return W},J=["find","first","last","all","firstOrFail","findOrFail","findMany"];for(let W of J){let V=Z[W];if(typeof V!=="function")continue;Z[W]=async function(...B){let H=await V.apply(this,B);return await X(H)}}let Y=["create","firstOrCreate","updateOrCreate","make"];for(let W of Y){let V=Z[W];if(typeof V!=="function")continue;Z[W]=async function(...B){let H=await V.apply(this,B);return await X(H)}}for(let W of["update","forceUpdate"]){let V=Z[W];if(typeof V!=="function")continue;Z[W]=async function(B,H){let z=await V.call(this,B,H);return await X(z)}}let Q=["first","firstOrFail","get","all","find","findOrFail","last","paginate","simplePaginate"],G=(W)=>{if(!W||typeof W!=="object")return W;let V=W;if(V.__stacksEncryptedReads)return W;for(let B of Q){let H=V[B];if(typeof H!=="function")continue;V[B]=async function(...z){return await X(await H.apply(this,z))}}for(let B of["where","whereIn","whereNull","whereNotNull","orWhere","orderBy","orderByDesc","limit","offset","with"]){let H=V[B];if(typeof H!=="function")continue;V[B]=function(...z){return G(H.apply(this,z))}}return Object.defineProperty(V,"__stacksEncryptedReads",{value:!0,enumerable:!1}),W};for(let W of["where","whereIn","whereNull","whereNotNull","orderBy","orderByDesc","limit","query"]){let V=Z[W];if(typeof V!=="function")continue;Z[W]=function(...B){return G(V.apply(this,B))}}}function gX(Z,$){if($.length===0)return;let X=async(Y)=>{if(!Y||typeof Y!=="object"||Array.isArray(Y))return Y;let Q={...Y};for(let G of $)for(let W of y7(G))if(W in Q)Q[W]=await M8(Q[W]);return Q},J=["create","firstOrCreate","updateOrCreate","forceCreate"];for(let Y of J){let Q=Z[Y];if(typeof Q!=="function")continue;Z[Y]=async function(...G){if(G[0]=await X(G[0]),G[1])G[1]=await X(G[1]);return await Q.apply(this,G)}}for(let Y of["update","forceUpdate"]){let Q=Z[Y];if(typeof Q!=="function")continue;Z[Y]=async function(G,W){let V=await X(W);return await Q.call(this,G,V)}}}function uX(Z,$){let X=Z.create;if(typeof X==="function")Z.create=async function(J,...Y){$8($,J);let Q=await y$($,J);return await X.call(this,Q,...Y)};for(let J of["firstOrCreate","updateOrCreate"]){let Y=Z[J];if(typeof Y!=="function")continue}}function cX(Z,$){let X=String($?.name??Z.name??"Model"),J=(G,W)=>{if(AX())return;if(!G||typeof G!=="object"||Array.isArray(G))return;let V=t$(G,$,W);if(!V.valid)throw new j7(X,V.errors)},Y=Z.create;if(typeof Y==="function")Z.create=async function(G,...W){return J(G,"creating"),await Y.call(this,G,...W)};let Q=Z.update;if(typeof Q==="function")Z.update=async function(G,W,...V){return J(W,"updating"),await Q.call(this,G,W,...V)}}function mX(Z,$){let X=["create","firstOrCreate","updateOrCreate"];for(let Y of X){let Q=Z[Y];if(typeof Q==="function")Z[Y]=async function(...G){if(f.debug(`[orm] ${Y.charAt(0).toUpperCase()+Y.slice(1)} ${String(Z.name||"unknown")}`,G[0]),G[0]&&typeof G[0]==="object"&&!Array.isArray(G[0]))G[0]=L7(G[0],$,"set");return await Q.apply(this,G)}}let J=Z.update;if(typeof J==="function")Z.update=async function(Y,Q){let G=Q&&typeof Q==="object"&&!Array.isArray(Q)?L7(Q,$,"set"):Q;return await J.call(this,Y,G)}}function h7(Z){f.debug(`[orm] Defining model: ${Z.name} (table: ${Z.table})`);let $=lX(Z),X=nX(Z),J=dX($,X),Y=pX(Z);Z.__traitMethods=Y;let Q=J?{...Z,hooks:{...Z.hooks,...J}}:Z,W=LX(Q);if(SX(W,Z.casts),fX(W,Q),uX(W,Q),Z.casts&&Object.keys(Z.casts).length>0)mX(W,Z.casts);let V=y8(Z);if(V.length>0)gX(W,V),bX(W,V);let B=Z.traits?.useSoftDeletes;if(B)iX(W,Q,B);let H=Z.traits?.useAudit;if(H){let O=d$(H);n$(W,Z.name,Z.primaryKey||"id",O)}cX(W,Q),W.withoutValidation=function(O){return EX(O)},W.withoutEvents=function(O){return e(O)};for(let O of["create","update","firstOrCreate","updateOrCreate","forceCreate","forceUpdate","delete","forceDelete","softDelete","restore"]){let F=W[O];if(typeof F!=="function")continue;let w=`${O}Quietly`;if(typeof W[w]==="function")continue;W[w]=function(...T){return e(()=>F.apply(W,T))}}let z=Object.assign(W,Y,{...Z,getDefinition:()=>Z,_isStacksModel:!0});return DX(Z.name,z),Object.defineProperty(z,v$,{value:Z,enumerable:!1,configurable:!0}),z}function lX(Z){let $=Z.traits?.observe;if(!$)return;let X=Z.name.toLowerCase(),J=(O)=>{let F=O?.attributes;if(!F||typeof F!=="object")return O;let w=Z.primaryKey||"id",T={...F};if(T[w]===void 0&&O[w]!==void 0)T[w]=O[w];return T},Y=async(O,F)=>{if(Z0())return;try{let{dispatch:w}=await import("@stacksjs/events");await w(O,F)}catch(w){if(w&&typeof w==="object"&&"code"in w&&w.code==="MODULE_NOT_FOUND")return;if(console.error(`[ORM] Event '${O}' handler error:`,w),process.env.STACKS_ORM_EVENT_ERRORS!=="swallow")throw w}},Q=Z.traits?.broadcastOn,G=Z.traits?.broadcastWith,W=typeof Q==="function"&&typeof G==="function",V=async(O,F)=>{if(!W)return;if(Z0())return;try{let w=Q(F),T=Array.isArray(w)?w:[w],q=G(F),E=(await import("@stacksjs/realtime").catch(()=>null))?.broadcast;if(typeof E!=="function")return;for(let P of T){if(typeof P!=="string"||P.length===0)continue;await E(P,O,q)}}catch(w){if(w&&typeof w==="object"&&"code"in w&&w.code==="MODULE_NOT_FOUND")return;if(console.error(`[ORM] Broadcast '${O}' handler error:`,w),process.env.STACKS_ORM_BROADCAST_ERRORS==="throw")throw w}},B=async(O,F)=>{if(Z0())return!0;try{let{dispatchAsync:w}=await import("@stacksjs/events"),T=await w(O,F);if(Array.isArray(T)&&T.some((q)=>q===!1))return!1}catch(w){if(w&&typeof w==="object"&&"code"in w&&w.code==="MODULE_NOT_FOUND")return!0;if(console.error(`[ORM] Before-event '${O}' handler error:`,w),process.env.STACKS_ORM_EVENT_ERRORS!=="swallow")throw w}return!0},H=$===!0?["create","update","delete"]:Array.isArray($)?$:[],z={};if(H.includes("create"))z.beforeCreate=async(O)=>{if(f.debug(`[orm] Create ${X}`,O),!await B(`${X}:saving`,O))throw Error(`[ORM] ${X}:saving event cancelled the operation`);if(!await B(`${X}:creating`,O))throw Error(`[ORM] ${X}:creating event cancelled the operation`)},z.afterCreate=async(O)=>{let F=J(O);await Y(`${X}:created`,F),await Y(`${X}:saved`,F),await V(`${X}:created`,O)};if(H.includes("update"))z.beforeUpdate=async(O)=>{if(f.debug(`[orm] Update ${X}#${O?.id??"unknown"}`,O),!await B(`${X}:saving`,O))throw Error(`[ORM] ${X}:saving event cancelled the operation`);if(!await B(`${X}:updating`,O))throw Error(`[ORM] ${X}:updating event cancelled the operation`)},z.afterUpdate=async(O)=>{let F=J(O);await Y(`${X}:updated`,F),await Y(`${X}:saved`,F),await V(`${X}:updated`,O)};if(H.includes("delete"))z.beforeDelete=async(O)=>{if(f.debug(`[orm] Delete ${X}#${O?.id??"unknown"}`),!await B(`${X}:deleting`,O))throw Error(`[ORM] ${X}:deleting event cancelled the operation`)},z.afterDelete=async(O)=>{await Y(`${X}:deleted`,J(O)),await V(`${X}:deleted`,O)};return z}function dX(...Z){let $={},X=new Set;for(let J of Z){if(!J)continue;for(let Y of Object.keys(J))X.add(Y)}for(let J of X){let Y=Z.map((Q)=>Q?.[J]).filter((Q)=>typeof Q==="function");if(!Y.length)continue;$[J]=async(...Q)=>{for(let G of Y)await G(...Q)}}return Object.keys($).length?$:void 0}function v7(Z,$){if(!Z)return null;let X=Z===!0?{}:typeof Z==="object"?{...Z}:null;if(!X)return null;if($)X.hidden=yX($);return X}function nX(Z){let $=v7(Z.traits?.useSearch,Z);if(!$)return;let X=$,J=X.index??Z.table??d(`${Z.name}s`);async function Y(W){if(typeof X.shapeMany==="function")try{let[H]=await h$([W],X);return H}catch(H){f.warn(`[orm/search] shapeMany() threw for ${Z.name}: ${H.message}`);return}if(typeof X.shape==="function")try{return await X.shape(W)}catch(H){f.warn(`[orm/search] shape() threw for ${Z.name}: ${H.message}`);return}let B=R(W).toSearchableObject?.();if(B!==void 0)return B;return W?._attributes??(typeof W?.toJSON==="function"?W.toJSON():null)}let Q=async(W)=>{if(Z0())return;let V=await Y(W);if(!V)return;if($.queueable){try{let{Jobs:B}=await import("@stacksjs/queue");await B.dispatch("SyncSearchIndex",{index:J,op:"upsert",doc:V})}catch(B){f.warn(`[orm/search] queue dispatch failed for ${Z.name}; falling back to inline: ${B.message}`),await C7(J,V,Z.name)}return}await C7(J,V,Z.name)};return{afterCreate:Q,afterUpdate:Q,afterDelete:async(W)=>{if(Z0())return;let V=W?.id??W?._attributes?.id;if(V==null)return;if($.queueable){try{let{Jobs:B}=await import("@stacksjs/queue");await B.dispatch("SyncSearchIndex",{index:J,op:"delete",id:Number(V)})}catch(B){f.warn(`[orm/search] queue dispatch failed for ${Z.name}#${V}; falling back to inline: ${B.message}`),await P7(J,Number(V),Z.name)}return}await P7(J,Number(V),Z.name)}}}var E7=new Map;function R7(Z,$){let X=E7.get(Z)??0;if(E7.set(Z,X+1),X===0)f.warn(`[orm/search] ${$}`);else if(X===9)f.warn(`[orm/search] ${Z} is still failing; further identical warnings suppressed for this process.`)}async function C7(Z,$,X){try{let{useSearchEngine:J}=await import("@stacksjs/search-engine");await J().addDocument(Z,$)}catch(J){R7(`index:${X}`,`Failed to index ${X}: ${J.message}`)}}async function P7(Z,$,X){try{let{useSearchEngine:J}=await import("@stacksjs/search-engine");await J().deleteDocument(Z,$)}catch(J){R7(`remove:${X}`,`Failed to remove ${X}#${$}: ${J.message}`)}}function pX(Z){let $={},X=Z.table,J=Z.traits;if(!J)return $;if(J.taggable)$._taggable=c8(X);if(J.categorizable)$._categorizable=m8(X);if(J.commentable)$._commentable=g8(X);if(J.billable)$._billable=w7(X);if(J.likeable){let Q=typeof J.likeable==="object"?J.likeable:void 0;$._likeable=l8(X,Q)}let Y=J.useAuth||J.authenticatable;if(typeof Y==="object"&&Y&&"useTwoFactor"in Y&&Y.useTwoFactor)$._twoFactor=x7();return $}function iX(Z,$,X){let J=T7(Z,$.primaryKey||"id"),Y=U7(X),Q=$,G=$.name.toLowerCase(),W=$.traits?.observe!=null&&$.traits?.observe!==!1,V=async(F)=>{if(!W||Z0())return!0;try{let{dispatchAsync:w}=await import("@stacksjs/events"),T=await w(`${G}:restoring`,{id:F});if(Array.isArray(T)&&T.some((q)=>q===!1))return!1}catch(w){if(w?.code!=="MODULE_NOT_FOUND")console.error(`[ORM] Before-event '${G}:restoring' handler error:`,w)}return!0},B=async(F)=>{if(!W||Z0())return;try{let{dispatch:w}=await import("@stacksjs/events");await w(`${G}:restored`,{id:F})}catch(w){if(w?.code!=="MODULE_NOT_FOUND")console.error(`[ORM] Event '${G}:restored' handler error:`,w)}},H=process.env.STACKS_ORM_CASCADE_SWALLOW!=="true",z=async(F)=>{if(!Y.cascade?.length||!H){let T=await J.softDelete(F);if(T&&Y.cascade?.length)await Z8(Q,Y,F,"softDelete");return T}let{db:w}=await import("@stacksjs/database");return await w.transaction(async()=>{let T=await J.softDelete(F);if(T)await Z8(Q,Y,F,"softDelete");return T})},O=async(F)=>{if(!await V(F))return!1;if(!Y.cascade?.length||!H){let L=await J.restore(F);if(L){if(Y.cascade?.length)await Z8(Q,Y,F,"restore");await B(F)}return L}let{db:T}=await import("@stacksjs/database"),q=await T.transaction(async()=>{let L=await J.restore(F);if(L)await Z8(Q,Y,F,"restore");return L});if(q)await B(F);return q};Z.softDelete=z,Z.restore=O,Z.forceDelete=J.forceDelete,Z.withTrashed=J.withTrashed,Z.onlyTrashed=J.onlyTrashed,Z.delete=z}function rX(Z){if(Z==null)return Z;if(Array.isArray(Z))return Z.map(rX);if(typeof Z!=="object")return Z;if(typeof Z.toJSON==="function")return Z.toJSON();if(Z._attributes&&typeof Z._attributes==="object")return Z._attributes;return Z}var tX=["belongsTo","hasOne","hasMany","belongsToMany","morphMany","morphOne"],sX=["traits","dashboard"];function oX(Z){let $=Z?.[v$];if($&&typeof $==="object")return $;if(Z&&typeof Z==="object"&&"name"in Z&&"attributes"in Z)return Z;throw TypeError("extendModel() expects a model created by defineModel(), or a model definition. Import the framework model itself rather than its table name.")}function aX(Z,$){let X=Array.isArray(Z)?Z:[],J=Array.isArray($)?$:[];if(!X.length&&!J.length)return;return[...new Set([...X,...J])]}function eX(Z){if(!Z)return 0;return Object.values(Z).reduce(($,X)=>{let J=Number(X?.order);return Number.isFinite(J)&&J>$?J:$},0)}function ZJ(Z,$){let X={...Z,...$},J=Z.attributes??{},Y=$.attributes??{};if($.attributes){let Q=eX(J),G=Object.fromEntries(Object.entries(Y).map(([W,V])=>{let B=!(W in J),H=Number.isFinite(Number(V?.order));if(B&&!H)return[W,{...V,order:++Q}];return[W,V]}));X.attributes={...J,...G}}for(let Q of tX){let G=aX(Z[Q],$[Q]);if(G)X[Q]=G}for(let Q of sX){let G=Z[Q],W=$[Q];if(G&&W&&typeof G==="object"&&typeof W==="object")X[Q]={...G,...W}}return X}function wT(Z,$){return h7(ZJ(oX(Z),$))}import{log as $J}from"@stacksjs/logging";import{path as n}from"@stacksjs/path";import{fs as X8}from"@stacksjs/storage";function r(Z){return Z.replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase()}function XJ(Z){let $=Z.default;if(typeof $==="boolean")return"boolean";if(typeof $==="number")return"number";if(typeof $==="string")return"string";return"unknown"}function JJ(Z){let $=Z.validation;if(!$||typeof $!=="object")return null;let X=$.rule;return X&&typeof X==="object"?X:null}function YJ(Z){if(!Z||String(Z.name??"")!=="enum")return null;let X=(Array.isArray(Z.allowedValues)?Z.allowedValues:[]).filter((J)=>typeof J==="string"||typeof J==="number").map((J)=>typeof J==="number"?String(J):JSON.stringify(J));return X.length>0?X.join(" | "):null}function QJ(Z){let $=JJ(Z),X=YJ($);if(X!==null)return Z.nullable===!0?`${X} | null`:X;let J=typeof Z.type==="string"?Z.type.toLowerCase():String($?.name??"").toLowerCase(),Y=(()=>{switch(J){case"string":case"text":case"longtext":case"mediumtext":case"tinytext":case"char":case"varchar":case"enum":case"uuid":case"date":case"datetime":case"timestamp":case"timestamptz":case"password":case"time":case"year":return"string";case"number":case"integer":case"int":case"tinyint":case"smallint":case"mediumint":case"float":case"double":case"decimal":case"numeric":return"number";case"bigint":return"number | bigint";case"boolean":case"bool":return"boolean";case"json":case"jsonb":return"unknown";case"binary":case"blob":case"bytea":return"Uint8Array";case"unix":return"number";case"array":return"unknown[]";case"object":return"Record<string, unknown>";default:return XJ(Z)}})();return Z.nullable===!0?`${Y} | null`:Y}function GJ(Z){let $={},X=Z.belongsTo;if(!X)return $;let J=Array.isArray(X)?X:Object.values(X);for(let Y of J){if(typeof Y==="string"){$[`${r(Y)}_id`]="number";continue}if(Y&&typeof Y==="object"){let Q=Y;if(typeof Q.foreignKey==="string"){$[Q.foreignKey]="number";continue}if(typeof Q.model==="string")$[`${r(Q.model)}_id`]="number"}}return $}function WJ(Z,$){let[X,J]=[r(Z),r($)].sort();return`${X}_${J}`}function BJ(Z){let $=Z.default,X=typeof $==="string"?"string":typeof $==="number"?"number":typeof $==="boolean"?"boolean":$ instanceof Date?"string":"unknown";return Z.nullable?`${X} | null`:X}function VJ(Z,$){let X=$.belongsToMany;if(!X)return[];let J=[],Y=Array.isArray(X)?X:Object.values(X);for(let Q of Y){let G,W,V,B,H={},z=!0;if(typeof Q==="string")G=Q;else if(Q&&typeof Q==="object"&&"model"in Q){let q=Q;if(G=q.model,"pivotTable"in q||"firstForeignKey"in q||"secondForeignKey"in q)W=q.pivotTable,V=q.firstForeignKey,B=q.secondForeignKey;else{let L=Q;W=L.table,V=L.foreignKey,B=L.relatedKey,H=L.pivot?.columns??{},z=Boolean(L.pivot?.timestamps)}}else continue;let O=W??WJ(Z,G),F=V??`${r(Z)}_id`,w=B??`${r(G)}_id`,T={id:"number",[F]:"number",[w]:"number"};for(let[q,L]of Object.entries(H))T[q]=BJ(L);if(z)T.created_at="string",T.updated_at="string | null";J.push({table:O,columns:T})}return J}var KJ={email_verified_at:"string | null",password_changed_at:"string | null",two_factor_secret:"string | null",two_factor_enabled:"boolean | null",two_factor_last_used_step:"number | null",stripe_id:"string | null"};function HJ(Z){let $={id:"number"},X=Z.traits??{};if(X.useUuid)$.uuid="string";if((X.useTimestamps??X.timestampable)!==!1)$.created_at="string",$.updated_at="string | null";if(X.useSoftDeletes??X.softDeletable)$.deleted_at="string | null";if((Z.table??"")==="users"||Z.name==="User")Object.assign($,KJ);return $}function zJ(Z){let $={},X=Z.attributes??{};for(let[J,Y]of Object.entries(X))$[r(J)]=QJ(Y);return $}function OJ(Z){return Z.replace(/_([a-z0-9])/g,($,X)=>X.toUpperCase())}function _J(Z){let $={...Z};for(let[X,J]of Object.entries(Z)){let Y=OJ(X);if(Y!==X&&!(Y in $))$[Y]=J}return $}function b7(Z,$,X=2){let J=" ".repeat(X),Y=" ".repeat(X+1),Q=Object.entries($).map(([W,V])=>`${Y}${W}: ${V}`).join(`
|
|
15
|
+
`);function W(H){let z=Q,O=H instanceof Uint8Array?H:new Uint8Array(Y.encode(H));Q=new Uint8Array(z.length+O.length+2),Q.set(z),Q.set(O,z.length),Q.set(G,Q.length-2)}function V(H){return`"${H.replace(/"|"/g,"%22").replace(/\r\n|\r|\n/g," ")}"`}let B=V5($);for(let H in B){if(!Object.prototype.hasOwnProperty.call(B,H))continue;let z=B[H];if(W(`--${J}`),Object.prototype.hasOwnProperty.call(z,"data")){let O=z;W(`Content-Disposition: form-data; name=${V(H)}; filename=${V(O.name||"blob")}`),W(`Content-Type: ${O.type||"application/octet-stream"}`),W(""),W(O.data)}else W(`Content-Disposition: form-data; name=${V(H)}`),W(""),W(z)}return W(`--${J}--`),Q};var S5=_(()=>{i()});var w6;var DZ=_(()=>{S5();x();w6=class w6 extends K{constructor(){super(...arguments);this.requestDataProcessor=j5}list(Z,$){return this._makeRequest("GET","/v1/files",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/files",Z,$,{headers:{"Content-Type":"multipart/form-data"},apiBase:"files"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/files/${encodeURIComponent(Z)}`,$,X)}}});var x6;var AZ=_(()=>{x();x6=class x6 extends K{list(Z,$){return this._makeRequest("GET","/v1/file_links",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/file_links",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/file_links/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/file_links/${encodeURIComponent(Z)}`,$,X)}}});var T6;var EZ=_(()=>{x();T6=class T6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/invoices/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/invoices/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}list(Z,$){return this._makeRequest("GET","/v1/invoices",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/invoices",Z,$,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}search(Z,$){return this._makeRequest("GET","/v1/invoices/search",Z,$,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}addLines(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/add_lines`,$,X,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}attachPayment(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/attach_payment`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}finalizeInvoice(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/finalize`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}markUncollectible(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/mark_uncollectible`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}pay(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/pay`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}removeLines(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/remove_lines`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}sendInvoice(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/send`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}updateLines(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/update_lines`,$,X,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}voidInvoice(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/void`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}createPreview(Z,$){return this._makeRequest("POST","/v1/invoices/create_preview",Z,$,{requestSchema:{kind:"object",fields:{invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},schedule_details:{kind:"object",fields:{phases:{kind:"array",element:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}}},subscription_details:{kind:"object",fields:{items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/invoices/${encodeURIComponent(Z)}/lines`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}updateLineItem(Z,$,X,J){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/lines/${encodeURIComponent($)}`,X,J,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}}});var U6;var CZ=_(()=>{x();U6=class U6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/invoiceitems/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/invoiceitems/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/invoiceitems/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}})}list(Z,$){return this._makeRequest("GET","/v1/invoiceitems",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/invoiceitems",Z,$,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}})}}});var q6;var PZ=_(()=>{x();q6=class q6 extends K{list(Z,$){return this._makeRequest("GET","/v1/invoice_payments",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/invoice_payments/${encodeURIComponent(Z)}`,$,X)}}});var L6;var NZ=_(()=>{x();L6=class L6 extends K{list(Z,$){return this._makeRequest("GET","/v1/invoice_rendering_templates",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/invoice_rendering_templates/${encodeURIComponent(Z)}`,$,X)}archive(Z,$,X){return this._makeRequest("POST",`/v1/invoice_rendering_templates/${encodeURIComponent(Z)}/archive`,$,X)}unarchive(Z,$,X){return this._makeRequest("POST",`/v1/invoice_rendering_templates/${encodeURIComponent(Z)}/unarchive`,$,X)}}});var D6;var kZ=_(()=>{x();D6=class D6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/mandates/${encodeURIComponent(Z)}`,$,X)}}});var A6;var M5=_(()=>{x();i();A6=class A6 extends K{constructor(){super(...arguments);this.basePath=w0("/")}authorizeUrl(Z,$){Z=Z||{},$=$||{};let X="oauth/authorize";if($.express)X=`express/${X}`;if(!Z.response_type)Z.response_type="code";if(!Z.client_id)Z.client_id=this._stripe.getClientId();if(!Z.scope)Z.scope="read_write";return`https://${this._stripe.resolveBaseAddress("connect")}/${X}?${p(Z)}`}token(Z,$){return this._makeRequest("POST","/oauth/token",Z,$,{apiBase:"connect"})}deauthorize(Z,$){if(!Z.client_id)Z.client_id=this._stripe.getClientId();return this._makeRequest("POST","/oauth/deauthorize",Z,$,{apiBase:"connect"})}}});var E6;var IZ=_(()=>{x();E6=class E6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_attempt_records",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_attempt_records/${encodeURIComponent(Z)}`,$,X)}}});var C6;var jZ=_(()=>{x();C6=class C6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_intents",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payment_intents",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_intents/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}`,$,X)}search(Z,$){return this._makeRequest("GET","/v1/payment_intents/search",Z,$,{methodType:"search"})}applyCustomerBalance(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/apply_customer_balance`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/cancel`,$,X)}capture(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/capture`,$,X)}confirm(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/confirm`,$,X)}incrementAuthorization(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/increment_authorization`,$,X)}verifyMicrodeposits(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/verify_microdeposits`,$,X)}listAmountDetailsLineItems(Z,$,X){return this._makeRequest("GET",`/v1/payment_intents/${encodeURIComponent(Z)}/amount_details_line_items`,$,X,{methodType:"list"})}}});var P6;var SZ=_(()=>{x();P6=class P6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_links",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/payment_links",Z,$,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_links/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_links/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/payment_links/${encodeURIComponent(Z)}/line_items`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}}});var N6;var MZ=_(()=>{x();N6=class N6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_methods",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payment_methods",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_methods/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_methods/${encodeURIComponent(Z)}`,$,X)}attach(Z,$,X){return this._makeRequest("POST",`/v1/payment_methods/${encodeURIComponent(Z)}/attach`,$,X)}detach(Z,$,X){return this._makeRequest("POST",`/v1/payment_methods/${encodeURIComponent(Z)}/detach`,$,X)}}});var k6;var fZ=_(()=>{x();k6=class k6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_method_configurations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payment_method_configurations",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_method_configurations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_method_configurations/${encodeURIComponent(Z)}`,$,X)}}});var I6;var yZ=_(()=>{x();I6=class I6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_method_domains",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payment_method_domains",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_method_domains/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_method_domains/${encodeURIComponent(Z)}`,$,X)}validate(Z,$,X){return this._makeRequest("POST",`/v1/payment_method_domains/${encodeURIComponent(Z)}/validate`,$,X)}}});var j6;var hZ=_(()=>{x();j6=class j6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_records/${encodeURIComponent(Z)}`,$,X)}reportPaymentAttempt(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt`,$,X)}reportPaymentAttemptCanceled(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt_canceled`,$,X)}reportPaymentAttemptFailed(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt_failed`,$,X)}reportPaymentAttemptGuaranteed(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt_guaranteed`,$,X)}reportPaymentAttemptInformational(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt_informational`,$,X)}reportRefund(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_refund`,$,X)}reportPayment(Z,$){return this._makeRequest("POST","/v1/payment_records/report_payment",Z,$)}}});var S6;var vZ=_(()=>{x();S6=class S6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payouts",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payouts",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payouts/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payouts/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/payouts/${encodeURIComponent(Z)}/cancel`,$,X)}reverse(Z,$,X){return this._makeRequest("POST",`/v1/payouts/${encodeURIComponent(Z)}/reverse`,$,X)}}});var M6;var RZ=_(()=>{x();M6=class M6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/plans/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/plans/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/plans/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}list(Z,$){return this._makeRequest("GET","/v1/plans",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/plans",Z,$,{requestSchema:{kind:"object",fields:{amount_decimal:{kind:"decimal_string"},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}}});var f6;var bZ=_(()=>{x();f6=class f6 extends K{list(Z,$){return this._makeRequest("GET","/v1/prices",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/prices",Z,$,{requestSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/prices/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/prices/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}search(Z,$){return this._makeRequest("GET","/v1/prices/search",Z,$,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}}});var y6;var gZ=_(()=>{x();y6=class y6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/products/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/products/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/products/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/products",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/products",Z,$,{requestSchema:{kind:"object",fields:{default_price_data:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}}}}})}search(Z,$){return this._makeRequest("GET","/v1/products/search",Z,$,{methodType:"search"})}deleteFeature(Z,$,X,J){return this._makeRequest("DELETE",`/v1/products/${encodeURIComponent(Z)}/features/${encodeURIComponent($)}`,X,J)}retrieveFeature(Z,$,X,J){return this._makeRequest("GET",`/v1/products/${encodeURIComponent(Z)}/features/${encodeURIComponent($)}`,X,J)}listFeatures(Z,$,X){return this._makeRequest("GET",`/v1/products/${encodeURIComponent(Z)}/features`,$,X,{methodType:"list"})}createFeature(Z,$,X){return this._makeRequest("POST",`/v1/products/${encodeURIComponent(Z)}/features`,$,X)}}});var h6;var uZ=_(()=>{x();h6=class h6 extends K{list(Z,$){return this._makeRequest("GET","/v1/promotion_codes",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/promotion_codes",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/promotion_codes/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/promotion_codes/${encodeURIComponent(Z)}`,$,X)}}});var v6;var cZ=_(()=>{x();v6=class v6 extends K{list(Z,$){return this._makeRequest("GET","/v1/quotes",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/quotes",Z,$,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}accept(Z,$,X){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(Z)}/accept`,$,X,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}cancel(Z,$,X){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(Z)}/cancel`,$,X,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}finalizeQuote(Z,$,X){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(Z)}/finalize`,$,X,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}pdf(Z,$,X){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(Z)}/pdf`,$,X,{apiBase:"files",streaming:!0})}listComputedUpfrontLineItems(Z,$,X){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(Z)}/computed_upfront_line_items`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(Z)}/line_items`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}}});var R6;var mZ=_(()=>{x();R6=class R6 extends K{list(Z,$){return this._makeRequest("GET","/v1/refunds",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/refunds",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/refunds/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/refunds/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/refunds/${encodeURIComponent(Z)}/cancel`,$,X)}}});var b6;var lZ=_(()=>{x();b6=class b6 extends K{list(Z,$){return this._makeRequest("GET","/v1/reviews",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/reviews/${encodeURIComponent(Z)}`,$,X)}approve(Z,$,X){return this._makeRequest("POST",`/v1/reviews/${encodeURIComponent(Z)}/approve`,$,X)}}});var g6;var dZ=_(()=>{x();g6=class g6 extends K{list(Z,$){return this._makeRequest("GET","/v1/setup_attempts",Z,$,{methodType:"list"})}}});var u6;var nZ=_(()=>{x();u6=class u6 extends K{list(Z,$){return this._makeRequest("GET","/v1/setup_intents",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/setup_intents",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/setup_intents/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(Z)}/cancel`,$,X)}confirm(Z,$,X){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(Z)}/confirm`,$,X)}verifyMicrodeposits(Z,$,X){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(Z)}/verify_microdeposits`,$,X)}}});var c6;var pZ=_(()=>{x();c6=class c6 extends K{list(Z,$){return this._makeRequest("GET","/v1/shipping_rates",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/shipping_rates",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/shipping_rates/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/shipping_rates/${encodeURIComponent(Z)}`,$,X)}}});var m6;var iZ=_(()=>{x();m6=class m6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/sources/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/sources/${encodeURIComponent(Z)}`,$,X)}create(Z,$){return this._makeRequest("POST","/v1/sources",Z,$)}verify(Z,$,X){return this._makeRequest("POST",`/v1/sources/${encodeURIComponent(Z)}/verify`,$,X)}listSourceTransactions(Z,$,X){return this._makeRequest("GET",`/v1/sources/${encodeURIComponent(Z)}/source_transactions`,$,X,{methodType:"list"})}}});var l6;var rZ=_(()=>{x();l6=class l6 extends K{cancel(Z,$,X){return this._makeRequest("DELETE",`/v1/subscriptions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/subscriptions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/subscriptions/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}deleteDiscount(Z,$,X){return this._makeRequest("DELETE",`/v1/subscriptions/${encodeURIComponent(Z)}/discount`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/subscriptions",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/subscriptions",Z,$,{requestSchema:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}search(Z,$){return this._makeRequest("GET","/v1/subscriptions/search",Z,$,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}})}migrate(Z,$,X){return this._makeRequest("POST",`/v1/subscriptions/${encodeURIComponent(Z)}/migrate`,$,X,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}resume(Z,$,X){return this._makeRequest("POST",`/v1/subscriptions/${encodeURIComponent(Z)}/resume`,$,X,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}}});var d6;var tZ=_(()=>{x();d6=class d6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/subscription_items/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/subscription_items/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/subscription_items/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}})}list(Z,$){return this._makeRequest("GET","/v1/subscription_items",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/subscription_items",Z,$,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}})}}});var n6;var sZ=_(()=>{x();n6=class n6 extends K{list(Z,$){return this._makeRequest("GET","/v1/subscription_schedules",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/subscription_schedules",Z,$,{requestSchema:{kind:"object",fields:{phases:{kind:"array",element:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/subscription_schedules/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/subscription_schedules/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{phases:{kind:"array",element:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}}}})}cancel(Z,$,X){return this._makeRequest("POST",`/v1/subscription_schedules/${encodeURIComponent(Z)}/cancel`,$,X)}release(Z,$,X){return this._makeRequest("POST",`/v1/subscription_schedules/${encodeURIComponent(Z)}/release`,$,X)}}});var p6;var oZ=_(()=>{x();p6=class p6 extends K{list(Z,$){return this._makeRequest("GET","/v1/tax_codes",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax_codes/${encodeURIComponent(Z)}`,$,X)}}});var i6;var aZ=_(()=>{x();i6=class i6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/tax_ids/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax_ids/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/tax_ids",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/tax_ids",Z,$)}}});var r6;var eZ=_(()=>{x();r6=class r6 extends K{list(Z,$){return this._makeRequest("GET","/v1/tax_rates",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/tax_rates",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax_rates/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/tax_rates/${encodeURIComponent(Z)}`,$,X)}}});var t6;var Z$=_(()=>{x();t6=class t6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tokens/${encodeURIComponent(Z)}`,$,X)}create(Z,$){return this._makeRequest("POST","/v1/tokens",Z,$)}}});var s6;var $$=_(()=>{x();s6=class s6 extends K{list(Z,$){return this._makeRequest("GET","/v1/topups",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/topups",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/topups/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/topups/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/topups/${encodeURIComponent(Z)}/cancel`,$,X)}}});var o6;var X$=_(()=>{x();o6=class o6 extends K{list(Z,$){return this._makeRequest("GET","/v1/transfers",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/transfers",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/transfers/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/transfers/${encodeURIComponent(Z)}`,$,X)}listReversals(Z,$,X){return this._makeRequest("GET",`/v1/transfers/${encodeURIComponent(Z)}/reversals`,$,X,{methodType:"list"})}createReversal(Z,$,X){return this._makeRequest("POST",`/v1/transfers/${encodeURIComponent(Z)}/reversals`,$,X)}retrieveReversal(Z,$,X,J){return this._makeRequest("GET",`/v1/transfers/${encodeURIComponent(Z)}/reversals/${encodeURIComponent($)}`,X,J)}updateReversal(Z,$,X,J){return this._makeRequest("POST",`/v1/transfers/${encodeURIComponent(Z)}/reversals/${encodeURIComponent($)}`,X,J)}}});var a6;var J$=_(()=>{x();a6=class a6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/webhook_endpoints/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/webhook_endpoints/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/webhook_endpoints/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/webhook_endpoints",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/webhook_endpoints",Z,$)}}});var G0={};j8(G0,{WebhookEndpoints:()=>a6,V2:()=>_X,Treasury:()=>OX,Transfers:()=>o6,Topups:()=>s6,Tokens:()=>t6,TestHelpers:()=>zX,Terminal:()=>HX,TaxRates:()=>r6,TaxIds:()=>i6,TaxCodes:()=>p6,Tax:()=>KX,Subscriptions:()=>l6,SubscriptionSchedules:()=>n6,SubscriptionItems:()=>d6,Sources:()=>m6,Sigma:()=>VX,ShippingRates:()=>c6,SetupIntents:()=>u6,SetupAttempts:()=>g6,Reviews:()=>b6,Reporting:()=>BX,Refunds:()=>R6,Radar:()=>WX,Quotes:()=>v6,PromotionCodes:()=>h6,Products:()=>y6,Prices:()=>f6,Plans:()=>M6,Payouts:()=>S6,PaymentRecords:()=>j6,PaymentMethods:()=>N6,PaymentMethodDomains:()=>I6,PaymentMethodConfigurations:()=>k6,PaymentLinks:()=>P6,PaymentIntents:()=>C6,PaymentAttemptRecords:()=>E6,OAuthResource:()=>A6,Mandates:()=>D6,Issuing:()=>GX,Invoices:()=>T6,InvoiceRenderingTemplates:()=>L6,InvoicePayments:()=>q6,InvoiceItems:()=>U6,Identity:()=>QX,Forwarding:()=>YX,FinancialConnections:()=>JX,Files:()=>w6,FileLinks:()=>x6,ExchangeRates:()=>F6,Events:()=>_6,EphemeralKeys:()=>O6,Entitlements:()=>XX,Disputes:()=>z6,Customers:()=>K6,CustomerSessions:()=>H6,CreditNotes:()=>V6,Coupons:()=>B6,CountrySpecs:()=>W6,ConfirmationTokens:()=>G6,Climate:()=>$X,Checkout:()=>ZX,Charges:()=>Q6,BillingPortal:()=>e2,Billing:()=>a2,Balances:()=>Q0,BalanceTransactions:()=>Y6,BalanceSettings:()=>J6,Balance:()=>Q0,Apps:()=>o2,ApplicationFees:()=>X6,ApplePayDomains:()=>$6,Accounts:()=>Y0,AccountSessions:()=>Z6,AccountLinks:()=>e4,Account:()=>Y0});var o2,a2,e2,ZX,$X,XX,JX,YX,QX,GX,WX,BX,VX,KX,HX,zX,OX,_X;var Y$=_(()=>{j9();S9();M9();h9();v9();R9();b9();g9();u9();c9();m9();l9();d9();n9();p9();i9();r9();t9();s9();o9();a9();e9();Z1();$1();X1();J1();Y1();Q1();G1();W1();B1();V1();K1();H1();z1();O1();_1();F1();w1();x1();T1();U1();q1();L1();D1();A1();E1();C1();P1();N1();k1();I1();j1();S1();M1();f1();y1();h1();v1();R1();b1();g1();u1();c1();m1();l1();d1();n1();p1();i1();r1();t1();s1();o1();a1();e1();ZZ();$Z();XZ();JZ();YZ();C8();C8();QZ();GZ();WZ();BZ();P8();P8();VZ();KZ();HZ();zZ();OZ();_Z();FZ();wZ();xZ();TZ();UZ();qZ();LZ();DZ();AZ();EZ();CZ();PZ();NZ();kZ();M5();IZ();jZ();SZ();MZ();fZ();yZ();hZ();vZ();RZ();bZ();gZ();uZ();cZ();mZ();lZ();dZ();nZ();pZ();iZ();rZ();tZ();sZ();oZ();aZ();eZ();Z$();$$();X$();J$();o2=C("apps",{Secrets:h4}),a2=C("billing",{Alerts:S0,CreditBalanceSummary:l0,CreditBalanceTransactions:d0,CreditGrants:n0,MeterEventAdjustments:Q4,MeterEvents:V4,Meters:H4}),e2=C("billingPortal",{Configurations:g0,Sessions:v4}),ZX=C("checkout",{Sessions:R4}),$X=C("climate",{Orders:O4,Products:D4,Suppliers:u4}),XX=C("entitlements",{ActiveEntitlements:j0,Features:e0}),JX=C("financialConnections",{Accounts:k0,Sessions:b4,Transactions:d4}),YX=C("forwarding",{Requests:f4}),QX=C("identity",{VerificationReports:o4,VerificationSessions:a4}),GX=C("issuing",{Authorizations:f0,Cardholders:v0,Cards:R0,Disputes:t0,PersonalizationDesigns:U4,PhysicalBundles:L4,Tokens:m4,Transactions:n4}),WX=C("radar",{EarlyFraudWarnings:s0,PaymentEvaluations:T4,ValueListItems:t4,ValueLists:s4}),BX=C("reporting",{ReportRuns:S4,ReportTypes:M4}),VX=C("sigma",{ScheduledQueryRuns:y4}),KX=C("tax",{Associations:M0,Calculations:h0,Registrations:j4,Settings:g4,Transactions:p4}),HX=C("terminal",{Configurations:u0,ConnectionTokens:m0,Locations:Y4,OnboardingLinks:z4,Readers:A4}),zX=C("testHelpers",{ConfirmationTokens:c0,Customers:i0,Refunds:I4,TestClocks:c4,Issuing:C("issuing",{Authorizations:y0,Cards:b0,PersonalizationDesigns:q4,Transactions:i4}),Terminal:C("terminal",{Readers:E4}),Treasury:C("treasury",{InboundTransfers:X4,OutboundPayments:_4,OutboundTransfers:w4,ReceivedCredits:C4,ReceivedDebits:N4})}),OX=C("treasury",{CreditReversals:p0,DebitReversals:r0,FinancialAccounts:Z4,InboundTransfers:J4,OutboundPayments:F4,OutboundTransfers:x4,ReceivedCredits:P4,ReceivedDebits:k4,TransactionEntries:l4,Transactions:r4}),_X=C("v2",{Billing:C("billing",{MeterEventAdjustments:G4,MeterEventSession:W4,MeterEventStream:B4,MeterEvents:K4}),Commerce:C("commerce",{ProductCatalog:C("productCatalog",{Imports:$4})}),Core:C("core",{AccountLinks:P0,AccountTokens:N0,Accounts:I0,EventDestinations:o0,Events:a0})})});var f5=_(()=>{U8()});class Q${constructor(Z){this.stripe=Z,this.secrets=new h4(Z)}}var y5=_(()=>{c1()});class G${constructor(Z){this.stripe=Z,this.alerts=new S0(Z),this.creditBalanceSummaries=new l0(Z),this.creditBalanceTransactions=new d0(Z),this.creditGrants=new n0(Z),this.meters=new H4(Z),this.meterEvents=new V4(Z),this.meterEventAdjustments=new Q4(Z)}}var h5=_(()=>{R9();t9();s9();o9();x1();F1();H1()});class W${constructor(Z){this.stripe=Z,this.configurations=new g0(Z),this.sessions=new v4(Z)}}var v5=_(()=>{n9();m1()});class B${constructor(Z){this.stripe=Z,this.sessions=new R4(Z)}}var R5=_(()=>{l1()});class V${constructor(Z){this.stripe=Z,this.orders=new O4(Z),this.products=new D4(Z),this.suppliers=new u4(Z)}}var b5=_(()=>{U1();k1();p1()});class K${constructor(Z){this.stripe=Z,this.activeEntitlements=new j0(Z),this.features=new e0(Z)}}var g5=_(()=>{v9();Q1()});class H${constructor(Z){this.stripe=Z,this.accounts=new k0(Z),this.sessions=new b4(Z),this.transactions=new d4(Z)}}var u5=_(()=>{M9();d1();s1()});class z${constructor(Z){this.stripe=Z,this.requests=new f4(Z)}}var c5=_(()=>{g1()});class O${constructor(Z){this.stripe=Z,this.verificationReports=new o4(Z),this.verificationSessions=new a4(Z)}}var m5=_(()=>{JZ();YZ()});class _${constructor(Z){this.stripe=Z,this.authorizations=new f0(Z),this.cards=new R0(Z),this.cardholders=new v0(Z),this.disputes=new t0(Z),this.personalizationDesigns=new U4(Z),this.physicalBundles=new L4(Z),this.tokens=new m4(Z),this.transactions=new n4(Z)}}var l5=_(()=>{g9();l9();m9();$1();C1();N1();r1();o1()});class F${constructor(Z){this.stripe=Z,this.earlyFraudWarnings=new s0(Z),this.paymentEvaluations=new T4(Z),this.valueLists=new s4(Z),this.valueListItems=new t4(Z)}}var d5=_(()=>{X1();E1();XZ();$Z()});class w${constructor(Z){this.stripe=Z,this.reportRuns=new S4(Z),this.reportTypes=new M4(Z)}}var n5=_(()=>{R1();b1()});class x${constructor(Z){this.stripe=Z,this.scheduledQueryRuns=new y4(Z)}}var p5=_(()=>{u1()});class T${constructor(Z){this.stripe=Z,this.associations=new M0(Z),this.calculations=new h0(Z),this.registrations=new j4(Z),this.settings=new g4(Z),this.transactions=new p4(Z)}}var i5=_(()=>{b9();c9();v1();n1();a1()});class U${constructor(Z){this.stripe=Z,this.configurations=new u0(Z),this.connectionTokens=new m0(Z),this.locations=new Y4(Z),this.onboardingLinks=new z4(Z),this.readers=new A4(Z)}}var r5=_(()=>{p9();r9();K1();T1();I1()});class q${constructor(Z){this.stripe=Z,this.authorizations=new y0(Z),this.cards=new b0(Z),this.personalizationDesigns=new q4(Z),this.transactions=new i4(Z)}}var t5=_(()=>{u9();d9();P1();e1()});class L${constructor(Z){this.stripe=Z,this.readers=new E4(Z)}}var s5=_(()=>{j1()});class D${constructor(Z){this.stripe=Z,this.inboundTransfers=new X4(Z),this.outboundPayments=new _4(Z),this.outboundTransfers=new w4(Z),this.receivedCredits=new C4(Z),this.receivedDebits=new N4(Z)}}var o5=_(()=>{B1();q1();D1();S1();f1()});class A${constructor(Z){this.stripe=Z,this.confirmationTokens=new c0(Z),this.customers=new i0(Z),this.refunds=new I4(Z),this.testClocks=new c4(Z),this.issuing=new q$(Z),this.terminal=new L$(Z),this.treasury=new D$(Z)}}var a5=_(()=>{i9();e9();h1();i1();t5();s5();o5()});class E${constructor(Z){this.stripe=Z,this.creditReversals=new p0(Z),this.debitReversals=new r0(Z),this.financialAccounts=new Z4(Z),this.inboundTransfers=new J4(Z),this.outboundPayments=new F4(Z),this.outboundTransfers=new x4(Z),this.receivedCredits=new P4(Z),this.receivedDebits=new k4(Z),this.transactions=new r4(Z),this.transactionEntries=new l4(Z)}}var e5=_(()=>{a9();Z1();G1();V1();L1();A1();M1();y1();ZZ();t1()});class C${constructor(Z){this.stripe=Z,this.meterEvents=new K4(Z),this.meterEventAdjustments=new G4(Z),this.meterEventSession=new W4(Z),this.meterEventStream=new B4(Z)}}var Z7=_(()=>{w1();z1();O1();_1()});class P${constructor(Z){this.stripe=Z,this.imports=new $4(Z)}}var $7=_(()=>{W1()});class N${constructor(Z){this.stripe=Z,this.productCatalog=new P$(Z)}}var X7=_(()=>{$7()});class k${constructor(Z){this.stripe=Z,this.accounts=new I0(Z),this.accountLinks=new P0(Z),this.accountTokens=new N0(Z),this.events=new a0(Z),this.eventDestinations=new o0(Z)}}var J7=_(()=>{h9();j9();S9();Y1();J1()});class I${constructor(Z){this.stripe=Z,this.billing=new C$(Z),this.commerce=new N$(Z),this.core=new k$(Z)}}var Y7=_(()=>{Z7();X7();J7()});class A{static initialize(Z,$=z7){A._platformFunctions=Z,A._requestSenderFactory=$,A.webhooks=P5(Z),A.createNodeHttpClient=Z.createNodeHttpClient,A.createFetchHttpClient=Z.createFetchHttpClient,A.createNodeCryptoProvider=Z.createNodeCryptoProvider,A.createSubtleCryptoProvider=Z.createSubtleCryptoProvider;let X=Z.getEnv(),J=Z.getRuntimeVersion();A.aiAgent=X?K5(X):"",A.AI_AGENT=A.aiAgent,A.USER_AGENT={bindings_version:A.PACKAGE_VERSION,lang:"node",typescript:!1,...J?{lang_version:J}:{},...A.aiAgent?{ai_agent:A.aiAgent}:{}}}constructor(Z,$={}){this._authenticator=null;let X=this._getPropsFromConfig($);this._platformFunctions=A._platformFunctions,Object.defineProperty(this,"_emitter",{value:this._platformFunctions.createEmitter(),enumerable:!1,configurable:!1,writable:!1}),this.VERSION=A.PACKAGE_VERSION,this.on=this._emitter.on.bind(this._emitter),this.once=this._emitter.once.bind(this._emitter),this.off=this._emitter.removeListener.bind(this._emitter);let J=X.httpAgent||null;this._api={host:X.host||j$,port:X.port||Q7,protocol:X.protocol||"https",basePath:G7,version:X.apiVersion||W7,timeout:_8("timeout",X.timeout,B7),maxNetworkRetries:_8("maxNetworkRetries",X.maxNetworkRetries,2),agent:J,httpClient:X.httpClient||(J?this._platformFunctions.createNodeHttpClient(J):this._platformFunctions.createDefaultHttpClient()),dev:!1,stripeAccount:X.stripeAccount||null,stripeContext:X.stripeContext||null};let Y=X.typescript||!1;if(Y!==A.USER_AGENT.typescript)A.USER_AGENT.typescript=Y;if(X.appInfo)this._setAppInfo(X.appInfo);this._setAuthenticator(Z,X.authenticator||null),this.errors=A8,this.Decimal=v,this.webhooks=A.webhooks,this._prevRequestMetrics=[],this._enableTelemetry=X.telemetry!==!1,this._emitEventBodies=X.emitEventBodies===!0,this._requestSender=A._requestSenderFactory(this),this.accountLinks=new e4(this),this.accountSessions=new Z6(this),this.accounts=new Y0(this),this.applePayDomains=new $6(this),this.applicationFees=new X6(this),this.balance=new Q0(this),this.balanceSettings=new J6(this),this.balanceTransactions=new Y6(this),this.charges=new Q6(this),this.confirmationTokens=new G6(this),this.countrySpecs=new W6(this),this.coupons=new B6(this),this.creditNotes=new V6(this),this.customerSessions=new H6(this),this.customers=new K6(this),this.disputes=new z6(this),this.ephemeralKeys=new O6(this),this.events=new _6(this),this.exchangeRates=new F6(this),this.fileLinks=new x6(this),this.files=new w6(this),this.invoiceItems=new U6(this),this.invoicePayments=new q6(this),this.invoiceRenderingTemplates=new L6(this),this.invoices=new T6(this),this.mandates=new D6(this),this.paymentAttemptRecords=new E6(this),this.paymentIntents=new C6(this),this.paymentLinks=new P6(this),this.paymentMethodConfigurations=new k6(this),this.paymentMethodDomains=new I6(this),this.paymentMethods=new N6(this),this.paymentRecords=new j6(this),this.payouts=new S6(this),this.plans=new M6(this),this.prices=new f6(this),this.products=new y6(this),this.promotionCodes=new h6(this),this.quotes=new v6(this),this.refunds=new R6(this),this.reviews=new b6(this),this.setupAttempts=new g6(this),this.setupIntents=new u6(this),this.shippingRates=new c6(this),this.sources=new m6(this),this.subscriptionItems=new d6(this),this.subscriptionSchedules=new n6(this),this.subscriptions=new l6(this),this.taxCodes=new p6(this),this.taxIds=new i6(this),this.taxRates=new r6(this),this.tokens=new t6(this),this.topups=new s6(this),this.transfers=new o6(this),this.webhookEndpoints=new a6(this),this.apps=new Q$(this),this.billing=new G$(this),this.billingPortal=new W$(this),this.checkout=new B$(this),this.climate=new V$(this),this.entitlements=new K$(this),this.financialConnections=new H$(this),this.forwarding=new z$(this),this.identity=new O$(this),this.issuing=new _$(this),this.radar=new F$(this),this.reporting=new w$(this),this.sigma=new x$(this),this.tax=new T$(this),this.terminal=new U$(this),this.testHelpers=new A$(this),this.treasury=new E$(this),this.v2=new I$(this),this.account=this.accounts,this.oauth=new A6(this)}rawRequest(Z,$,X,J){return this._requestSender._rawRequest(Z,$,X,J)}_setAuthenticator(Z,$){if(Z&&$)throw Error("Can't specify both apiKey and authenticator");if(!Z&&!$)throw Error("Neither apiKey nor config.authenticator provided");this._authenticator=Z?G9(Z):$}_setAppInfo(Z){if(Z&&typeof Z!=="object")throw Error("AppInfo must be an object.");if(Z&&!Z.name)throw Error("AppInfo.name is required");Z=Z||{},this._appInfo=FX.reduce(($,X)=>{if(typeof Z[X]=="string")$=$||{},$[X]=Z[X];return $},{})}setClientId(Z){this._clientId=Z}getClientId(){return this._clientId}getConstant(Z){switch(Z){case"DEFAULT_HOST":return j$;case"DEFAULT_PORT":return Q7;case"DEFAULT_BASE_PATH":return G7;case"DEFAULT_API_VERSION":return W7;case"DEFAULT_TIMEOUT":return B7;case"MAX_NETWORK_RETRY_DELAY_SEC":return V7;case"INITIAL_NETWORK_RETRY_DELAY_SEC":return K7}return A[Z]}resolveBaseAddress(Z){let $=this.getApiField("host");if($!==j$)return $;return Y9[Z]}getMaxNetworkRetries(){return this.getApiField("maxNetworkRetries")}_setApiNumberField(Z,$,X){let J=_8(Z,$,X);this._setApiField(Z,J)}getMaxNetworkRetryDelay(){return V7}getInitialNetworkRetryDelay(){return K7}getClientUserAgent(Z){return this.getClientUserAgentSeeded(A.USER_AGENT,Z)}getClientUserAgentSeeded(Z,$){let X={};for(let Q in Z){if(!Object.prototype.hasOwnProperty.call(Z,Q))continue;X[Q]=encodeURIComponent(Z[Q]??"null")}let J=this._platformFunctions.getPlatformInfo();if(J&&this.getTelemetryEnabled())X.platform=encodeURIComponent(J);else delete X.platform;let Y=this.getApiField("httpClient");if(Y)X.httplib=encodeURIComponent(Y.getClientName());if(this._appInfo)X.application=this._appInfo;if(this.getTelemetryEnabled()){let Q=this._platformFunctions.getTelemetryId();if(Q)X.telemetry_id=Q}$(JSON.stringify(X))}getAppInfoAsString(){if(!this._appInfo)return"";let Z=this._appInfo.name;if(this._appInfo.version)Z+=`/${this._appInfo.version}`;if(this._appInfo.url)Z+=` (${this._appInfo.url})`;return Z}getTelemetryEnabled(){return this._enableTelemetry}getEmitEventBodiesEnabled(){return this._emitEventBodies}_prepResources(){for(let Z in G0){if(!Object.prototype.hasOwnProperty.call(G0,Z))continue;this[B5(Z.replace("Resource",""))]=new G0[Z](this)}}_getPropsFromConfig(Z){if(!Z)return{};let $=typeof Z==="string";if(!(Z===Object(Z)&&!Array.isArray(Z))&&!$)throw Error("Config must either be an object or a string");if($)return{apiVersion:Z};if(Object.keys(Z).filter((Y)=>!H7.includes(Y)).length>0)throw Error(`Config object may only contain the following: ${H7.join(", ")}`);return Z}_setApiField(Z,$){this._api[Z]=$}getApiField(Z){return this._api[Z]}parseEventNotification(Z,$,X,J,Y,Q){if(!this.webhooks.signature)throw Error("ERR: missing signature helper, unable to verify");this.webhooks.signature.verifyHeader(Z,$,X,J||this.webhooks.DEFAULT_TOLERANCE,Y||this._platformFunctions.createDefaultCryptoProvider(),Q);let G=Z instanceof Uint8Array?JSON.parse(new TextDecoder("utf8").decode(Z)):JSON.parse(Z);if(G&&G.object==="event")throw Error("You passed a webhook payload to stripe.parseEventNotification, which expects an event notification. Use stripe.webhooks.constructEvent instead.");if(G.context)G.context=l.parse(G.context);return G.fetchEvent=()=>{return this._requestSender._rawRequest("GET",`/v2/core/events/${G.id}`,void 0,{stripeContext:G.context,headers:{"Stripe-Request-Trigger":`event=${G.id}`}},["fetch_event"])},G.fetchRelatedObject=()=>{if(!G.related_object)return Promise.resolve(null);return this._requestSender._rawRequest("GET",G.related_object.url,void 0,{stripeContext:G.context,headers:{"Stripe-Request-Trigger":`event=${G.id}`}},["fetch_related_object"])},G}async parseEventNotificationAsync(Z,$,X,J,Y,Q){if(!this.webhooks.signature)throw Error("ERR: missing signature helper, unable to verify");await this.webhooks.signature.verifyHeaderAsync(Z,$,X,J||this.webhooks.DEFAULT_TOLERANCE,Y||this._platformFunctions.createDefaultCryptoProvider(),Q);let G=Z instanceof Uint8Array?JSON.parse(new TextDecoder("utf8").decode(Z)):JSON.parse(Z);if(G&&G.object==="event")throw Error("You passed a webhook payload to stripe.parseEventNotificationAsync, which expects an event notification. Use stripe.webhooks.constructEventAsync instead.");if(G.context)G.context=l.parse(G.context);return G.fetchEvent=()=>{return this._requestSender._rawRequest("GET",`/v2/core/events/${G.id}`,void 0,{stripeContext:G.context,headers:{"Stripe-Request-Trigger":`event=${G.id}`}},["fetch_event"])},G.fetchRelatedObject=()=>{if(!G.related_object)return Promise.resolve(null);return this._requestSender._rawRequest("GET",G.related_object.url,void 0,{stripeContext:G.context,headers:{"Stripe-Request-Trigger":`event=${G.id}`}},["fetch_related_object"])},G}}var j$="api.stripe.com",Q7="443",G7="/v1/",W7,B7=80000,V7=5,K7=0.5,FX,H7,z7=(Z)=>new J0(Z,K.MAX_BUFFERED_REQUEST_METRICS);var O7=_(()=>{E8();U5();x();Q9();N5();T8();x8();Y$();i();f5();C8();QZ();GZ();WZ();BZ();P8();VZ();KZ();HZ();zZ();OZ();_Z();FZ();wZ();xZ();TZ();UZ();LZ();DZ();AZ();EZ();CZ();PZ();NZ();kZ();IZ();jZ();SZ();MZ();fZ();yZ();hZ();vZ();RZ();bZ();gZ();uZ();cZ();mZ();lZ();dZ();nZ();pZ();iZ();rZ();tZ();sZ();oZ();aZ();eZ();Z$();$$();X$();J$();y5();h5();v5();R5();b5();g5();u5();c5();m5();l5();d5();n5();p5();i5();r5();a5();e5();Y7();qZ();Y$();W7=I9,FX=["name","version","url","partner_id"],H7=["authenticator","apiVersion","typescript","maxNetworkRetries","httpAgent","httpClient","timeout","host","port","protocol","telemetry","emitEventBodies","appInfo","stripeAccount","stripeContext"];A.PACKAGE_VERSION="22.3.2";A.API_VERSION=I9;A.aiAgent="";A.AI_AGENT="";A.USER_AGENT={bindings_version:A.PACKAGE_VERSION,lang:"node",typescript:!1};A.StripeResource=K;A.resources=G0;A.HttpClient=S;A.HttpClientResponse=T0;A.CryptoProvider=q0;A.StripeContext=l;A.errors=A8;A.Decimal=v;A._requestSenderFactory=z7});var _7={};j8(_7,{default:()=>wX,Stripe:()=>A,Decimal:()=>v});var wX;var F7=_(()=>{T5();U8();O7();A.initialize(new z9);wX=A});import"@stacksjs/validation";import{log as S8}from"@stacksjs/cli";import{db as R$}from"@stacksjs/database";async function r7(Z,$={}){let{olderThanDays:X=30,column:J="created_at",query:Y}=$;try{if(Y){let B=R$.deleteFrom(Z);B=Y(B);let H=await B.execute(),z=Array.isArray(H)?H:[H],O=Number(z[0]?.numDeletedRows??z.length??0);return S8.info(`Pruned ${O} records from ${Z}`),O}let Q=new Date;Q.setDate(Q.getDate()-X);let G=await R$.deleteFrom(Z).where(J,"<",Q.toISOString()).execute(),W=Array.isArray(G)?G:[G],V=Number(W[0]?.numDeletedRows??W.length??0);return S8.info(`Pruned ${V} records from ${Z} older than ${X} days`),V}catch(Q){throw S8.error(`Failed to prune ${Z}:`,Q),Q}}async function UY(Z,$={}){return r7(Z,$)}function qY(Z){if(!Z?.prunable)return null;if(typeof Z.prunable==="boolean")return{olderThanDays:30,column:"created_at"};return Z.prunable}import{createCipheriv as t7,createDecipheriv as s7,createHash as o7,randomBytes as a7}from"crypto";import{log as Q8}from"@stacksjs/logging";var b$="enc:",g$="aes-256-gcm",e7=12,Y8=null;async function u$(){if(Y8)return Y8;let Z=process.env.APP_KEY;if(!Z)try{Z=(await import("@stacksjs/config").catch(()=>null))?.config?.app?.key}catch{}if(!Z)return null;return Y8=o7("sha256").update(Z).digest(),Y8}function K0(Z){return typeof Z==="string"&&Z.startsWith(b$)}async function M8(Z){if(Z==null)return Z;if(K0(Z))return Z;if(typeof Z!=="string")return Z;let $=await u$();if(!$)return Q8.warn("[orm] encrypted attribute: APP_KEY not set - storing value in plaintext"),Z;let X=a7(e7),J=t7(g$,$,X),Y=Buffer.concat([J.update(Z,"utf8"),J.final()]),Q=J.getAuthTag();return`${b$}${X.toString("base64")}:${Q.toString("base64")}:${Y.toString("base64")}`}async function f8(Z){if(Z==null)return Z;if(typeof Z!=="string")return Z;if(!K0(Z))return Z;try{let $=await u$();if(!$)return Q8.warn("[orm] encrypted attribute: APP_KEY not set - cannot decrypt"),null;let[,X,J,Y]=Z.split(":");if(!X||!J||!Y)return Q8.warn("[orm] encrypted attribute: malformed envelope, returning null"),null;let Q=Buffer.from(X,"base64"),G=Buffer.from(J,"base64"),W=Buffer.from(Y,"base64"),V=s7(g$,$,Q);return V.setAuthTag(G),Buffer.concat([V.update(W),V.final()]).toString("utf8")}catch($){return Q8.warn("[orm] encrypted attribute: decrypt failed (key rotation? corrupted ciphertext?)",{error:$}),null}}function y8(Z){let $=Z.attributes;if(!$||typeof $!=="object")return[];let X=[];for(let[J,Y]of Object.entries($))if(Y&&typeof Y==="object"&&Y.encrypted===!0)X.push(J);return X}import{sqlDateTime as Z2}from"@stacksjs/database";import{log as z0}from"@stacksjs/logging";var $2=[/^password$/i,/^password_hash$/i,/^api_key$/i,/_token$/i,/_secret$/i,/^remember_token$/i],m$="model_audits",R8=null;function X2(Z){R8=Z}async function h8(){if(R8!=null)return R8;try{let Z=await import("@stacksjs/router").catch(()=>null);if(!Z)return null;let $=Z.getCurrentRequest;if(typeof $!=="function")return null;let X=$();if(!X)return null;return(X.user??X._user)?.id??null}catch{return null}}function G8(Z){if(!Z||typeof Z!=="object")return null;let $={};for(let[X,J]of Object.entries(Z)){if($2.some((Y)=>Y.test(X)))continue;$[X]=J}return $}function H0(Z){if(!Z||typeof Z!=="object")return null;let $=Z;if($._attributes&&typeof $._attributes==="object")return{...$._attributes};return{...Z}}function J2(Z,$){if(!Z||!$)return{old:Z,next:$};let X={},J={},Y=new Set([...Object.keys(Z),...Object.keys($)]);for(let Q of Y)if(Z[Q]!==$[Q])X[Q]=Z[Q],J[Q]=$[Q];return{old:X,next:J}}async function v8(Z,$=!1){try{let{db:X}=await import("@stacksjs/database");await X.insertInto(m$).values({auditable_type:Z.auditable_type,auditable_id:Z.auditable_id,event:Z.event,old_values:Z.old_values?JSON.stringify(Z.old_values):null,new_values:Z.new_values?JSON.stringify(Z.new_values):null,user_id:Z.user_id,created_at:Z2()}).executeTakeFirst()}catch(X){if(z0.warn(`[orm] audit row write failed for ${Z.auditable_type}#${String(Z.auditable_id)} (${Z.event})`,{error:X}),$)throw X}}function l$(Z){return{async audits($){try{let{db:X}=await import("@stacksjs/database");return(await X.selectFrom(m$).selectAll().where("auditable_type","=",Z).where("auditable_id","=",$).orderBy("created_at","desc").execute()??[]).map((Y)=>({...Y,old_values:typeof Y.old_values==="string"?c$(Y.old_values):Y.old_values,new_values:typeof Y.new_values==="string"?c$(Y.new_values):Y.new_values}))}catch(X){return z0.warn(`[orm] audits() lookup failed for ${Z}#${String($)}`,{error:X}),[]}}}}function c$(Z){try{return JSON.parse(Z)}catch{return Z}}function d$(Z){if(Z&&typeof Z==="object"&&"transactional"in Z)return{transactional:Z.transactional===!0};return{transactional:!1}}function n$(Z,$,X="id",J={}){let Y=J.transactional===!0,Q=Z;if(typeof Z.audits!=="function")Z.audits=l$($).audits;let G=async(H)=>{if(!Y)return await H();let{db:z}=await import("@stacksjs/database");return await z.transaction(async()=>H())},W=Z.create;if(typeof W==="function")Z.create=async function(...H){return await G(async()=>{let z=await W.apply(this,H);try{let O=H0(z),F=O?.[X];if(F!=null){let w=await h8();await v8({auditable_type:$,auditable_id:F,event:"created",old_values:null,new_values:G8(O),user_id:w},Y)}}catch(O){if(z0.warn(`[orm] audit(create) failed for ${$}`,{error:O}),Y)throw O}return z})};let V=Z.update;if(typeof V==="function")Z.update=async function(H,z){return await G(async()=>{let O=Q.find,F=typeof O==="function"?H0(await O.call(Q,H)):null,w=await V.call(this,H,z);try{let T=H0(w)??(typeof O==="function"?H0(await O.call(Q,H)):null),{old:q,next:L}=J2(F,T);if(L&&Object.keys(L).length>0){let E=await h8();await v8({auditable_type:$,auditable_id:H,event:"updated",old_values:G8(q),new_values:G8(L),user_id:E},Y)}}catch(T){if(z0.warn(`[orm] audit(update) failed for ${$}#${String(H)}`,{error:T}),Y)throw T}return w})};let B=(H)=>{let z=Z[H];if(typeof z!=="function")return;Z[H]=async function(O){return await G(async()=>{let F=Q.find,w=typeof F==="function"?H0(await F.call(Q,O)):null,T=await z.call(this,O);try{if(T!==!1&&w){let q=await h8();await v8({auditable_type:$,auditable_id:O,event:"deleted",old_values:G8(w),new_values:null,user_id:q},Y)}}catch(q){if(z0.warn(`[orm] audit(${H}) failed for ${$}#${String(O)}`,{error:q}),Y)throw q}return T})}};B("delete"),B("softDelete")}import{db as Y2,sql as Q2,sqlDateTime as b8}from"@stacksjs/database";function u(Z,$){if(typeof Z!=="number"||!Number.isFinite(Z)||Z<=0)throw Error(`[orm/commentable] ${$} requires a positive numeric id (received ${String(Z)})`)}var O0="commentable_upvotes",_0="commentables";function G2(Z){let $=Z;return $.code==="SQLITE_CONSTRAINT_UNIQUE"||$.code==="SQLITE_CONSTRAINT"||$.code==="23505"||$.errno===1062||/unique|duplicate/i.test($.message??"")}function g8(Z){let $=Y2;return{async comments(X){return u(X,"comments"),await $.selectFrom("commentables").where("commentables_id","=",X).where("commentables_type","=",Z).selectAll().execute()},async commentCount(X){let J=await $.selectFrom("commentables").select(Q2`count(*) as count`).where("commentables_id","=",X).where("commentables_type","=",Z).executeTakeFirst();return Number(J?.count)||0},async addComment(X,J){if(u(X,"addComment"),!J||typeof J.title!=="string"||J.title.trim().length===0)throw Error("[orm/commentable] addComment requires a non-empty comment.title");if(typeof J.body!=="string"||J.body.trim().length===0)throw Error("[orm/commentable] addComment requires a non-empty comment.body");let Y=await $.insertInto("commentables").values({...J,commentables_id:X,commentables_type:Z,status:"pending",created_at:b8(),updated_at:b8()}).returningAll().executeTakeFirst();if(Y&&typeof Y==="object"&&"id"in Y)return Y;let Q=Y?.lastInsertRowid;if(Q==null)return Y;return await $.selectFrom("commentables").where("id","=",Number(Q)).selectAll().executeTakeFirst()},async approvedComments(X){return await $.selectFrom("commentables").where("commentables_id","=",X).where("commentables_type","=",Z).where("status","=","approved").selectAll().execute()},async pendingComments(X){return await $.selectFrom("commentables").where("commentables_id","=",X).where("commentables_type","=",Z).where("status","=","pending").selectAll().execute()},async rejectedComments(X){return await $.selectFrom("commentables").where("commentables_id","=",X).where("commentables_type","=",Z).where("status","=","rejected").selectAll().execute()},async upvoteComment(X,J){u(X,"upvoteComment"),u(J,"upvoteComment");let Y=()=>$.selectFrom(O0).where("upvoteable_id","=",X).where("upvoteable_type","=",_0).where("user_id","=",J).selectAll().executeTakeFirst(),Q=await Y();if(Q)return Q;try{await $.insertInto(O0).values({upvoteable_id:X,upvoteable_type:_0,user_id:J,created_at:b8()}).execute()}catch(G){if(!G2(G))throw G}return await Y()},async removeCommentUpvote(X,J){u(X,"removeCommentUpvote"),u(J,"removeCommentUpvote"),await $.deleteFrom(O0).where("upvoteable_id","=",X).where("upvoteable_type","=",_0).where("user_id","=",J).execute()},async commentUpvoteCount(X){u(X,"commentUpvoteCount");let J=await $.selectFrom(O0).select("count(*) as count").where("upvoteable_id","=",X).where("upvoteable_type","=",_0).executeTakeFirst();return Number(J?.count)||0},async hasUpvotedComment(X,J){return u(X,"hasUpvotedComment"),u(J,"hasUpvotedComment"),!!await $.selectFrom(O0).where("upvoteable_id","=",X).where("upvoteable_type","=",_0).where("user_id","=",J).selectAll().executeTakeFirst()}}}import{db as W2,sql as B2,sqlDateTime as p$}from"@stacksjs/database";function u8(Z,$){if(typeof Z!=="number"||!Number.isFinite(Z)||Z<=0)throw Error(`[orm/taggable] ${$} requires a positive numeric id (received ${String(Z)})`)}function c8(Z){let $=W2;return{async tags(X){return u8(X,"tags"),await $.selectFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).selectAll().execute()},async tagCount(X){u8(X,"tagCount");let J=await $.selectFrom("taggables").select(B2`count(*) as count`).where("taggable_id","=",X).where("taggable_type","=",Z).executeTakeFirst();return Number(J?.count)||0},async addTag(X,J){if(u8(X,"addTag"),!J||typeof J.name!=="string"||J.name.trim().length===0)throw Error("[orm/taggable] addTag requires a non-empty tag.name");return await $.insertInto("taggables").values({...J,taggable_id:X,taggable_type:Z,slug:J.name.toLowerCase().replace(/[^a-z0-9]+/g,"-"),is_active:!0,created_at:p$(),updated_at:p$()}).execute(),await $.selectFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).where("name","=",J.name).selectAll().executeTakeFirst()},async activeTags(X){return await $.selectFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).where("is_active","=",!0).selectAll().execute()},async inactiveTags(X){return await $.selectFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).where("is_active","=",!1).selectAll().execute()},async removeTag(X,J){await $.deleteFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).where("id","=",J).execute()}}}import{db as V2,sqlDateTime as W8}from"@stacksjs/database";function m8(Z){let $=V2;async function X(J){return(await $.selectFrom("categorizable_models").where("categorizable_id","=",J).where("categorizable_type","=",Z).selectAll().execute()).map((Q)=>Q.category_id)}return{async categories(J){let Y=await X(J);if(Y.length===0)return[];return await $.selectFrom("categorizables").where("id","in",Y).selectAll().execute()},async categoryCount(J){return(await X(J)).length},async addCategory(J,Y){let Q=()=>$.selectFrom("categorizables").where("name","=",Y.name).where("categorizable_type","=",Z).selectAll().executeTakeFirst(),G=await Q();if(!G)await $.insertInto("categorizables").values({name:Y.name,description:Y.description,slug:Y.name.toLowerCase().replace(/[^a-z0-9]+/g,"-"),categorizable_type:Z,is_active:!0,created_at:W8(),updated_at:W8()}).execute(),G=await Q();return await $.insertInto("categorizable_models").values({categorizable_id:J,categorizable_type:Z,category_id:G.id,created_at:W8(),updated_at:W8()}).execute(),G},async activeCategories(J){let Y=await X(J);if(Y.length===0)return[];return await $.selectFrom("categorizables").where("id","in",Y).where("is_active","=",!0).selectAll().execute()},async inactiveCategories(J){let Y=await X(J);if(Y.length===0)return[];return await $.selectFrom("categorizables").where("id","in",Y).where("is_active","=",!1).selectAll().execute()},async removeCategory(J,Y){await $.deleteFrom("categorizable_models").where("categorizable_id","=",J).where("categorizable_type","=",Z).where("category_id","=",Y).execute()}}}import{db as K2,sqlDateTime as H2}from"@stacksjs/database";function l8(Z,$){let X=K2,J=$?.table||`${Z}_likes`,Y=$?.foreignKey||`${Z.replace(/s$/,"")}_id`;return{async likes(Q){return await X.selectFrom(J).where(Y,"=",Q).selectAll().execute()},async likeCount(Q){let G=await X.selectFrom(J).select("count(*) as count").where(Y,"=",Q).executeTakeFirst();return Number(G?.count)||0},async like(Q,G){if(typeof Q!=="number"||!Number.isFinite(Q)||Q<=0)throw Error(`[orm/likeable] like requires a positive numeric id (received ${String(Q)})`);if(typeof G!=="number"||!Number.isFinite(G)||G<=0)throw Error(`[orm/likeable] like requires a positive numeric userId (received ${String(G)})`);let W=H2();try{return await X.insertInto(J).values({[Y]:Q,user_id:G,created_at:W,updated_at:W}).returningAll().executeTakeFirst()}catch(V){let B=V;if(!(B.code==="SQLITE_CONSTRAINT_UNIQUE"||B.code==="SQLITE_CONSTRAINT"||B.code==="23505"||B.errno===1062||/unique|duplicate/i.test(B.message??"")))throw V;let z=await X.selectFrom(J).where(Y,"=",Q).where("user_id","=",G).selectAll().executeTakeFirst();if(z)return z;throw V}},async unlike(Q,G){await X.deleteFrom(J).where(Y,"=",Q).where("user_id","=",G).execute()},async isLiked(Q,G){return!!await X.selectFrom(J).where(Y,"=",Q).where("user_id","=",G).selectAll().executeTakeFirst()},async likedBy(Q){return(await X.selectFrom(J).select([Y]).where("user_id","=",Q).execute()).map((W)=>Number(W[Y])).filter(Boolean)}}}function r$(Z){let $=Z;return $?.code==="SQLITE_CONSTRAINT_UNIQUE"||$?.code==="SQLITE_CONSTRAINT"||$?.code==="23505"||$?.errno===1062||/unique|duplicate/i.test($?.message??"")}function z2(Z,$,X){let J=Z;if(Z instanceof Error&&typeof J.status==="number"&&Number.isInteger(J.status)&&J.status>=400&&J.status<600){let Y={error:Z.message};if(J.details!==void 0)Y.details=J.details;return{status:J.status,body:Y}}if(r$(Z))return{status:409,body:{error:`${$} already exists`}};return{status:500,body:{error:`Failed to ${X} ${$}`,detail:String(Z)}}}function y(Z){return Z.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function O2(Z){let $={};for(let[X,J]of Object.entries(Z))$[y(X)]=J;return $}function vY(Z,$){let X=String($||"").replace(/^\/+|\/+$/g,""),J=String(Z).replace(/^\/+/,"");return`/api/${X?`${X}/`:""}${J}`}function RY(Z){if(!Z)return null;let $=Z.attributes??{};if(Object.prototype.hasOwnProperty.call($,"teamId")||Object.prototype.hasOwnProperty.call($,"team_id"))return"team_id";return Z.belongsTo?.some((X)=>X==="Team")?"team_id":null}function bY(Z,$,X){let J=Object.keys(Z).find((Q)=>y(Q)===y($));if(Array.isArray(X)){if(J===void 0)return{data:Z,error:"Ownership value is required"};if(!X.some((Q)=>String(Q)===String(Z[J])))return{data:Z,error:"Ownership value is not available to this caller"};return{data:{...Z,[$]:Z[J]}}}if(X===null||X===void 0)return{data:Z,error:"Caller has no ownership identity"};let Y={...Z};for(let Q of Object.keys(Y))if(y(Q)===y($))delete Y[Q];return Y[$]=X,{data:Y}}function _2(Z){if(!Z)return[];let $=Object.entries(Z.attributes??{}).filter(([,X])=>X?.fillable===!0).map(([X])=>X);for(let X of Z.belongsTo??[]){if(typeof X!=="string"||!X.trim())continue;let J=y(X.trim()).split("_").filter(Boolean);if(J.length===0)continue;let Y=`${J[0]}${J.slice(1).map((Q)=>`${Q[0]?.toUpperCase()}${Q.slice(1)}`).join("")}Id`;$.push(Y)}return[...new Set($)]}function F2(Z,$){if(!Z||$.length===0)return{};let X={};for(let J of $){if(J in Z){X[J]=Z[J];continue}let Y=y(J);if(Y!==J&&Y in Z)X[J]=Z[Y]}return X}function w2(Z,$){if(Z?.name!=="date"||$ instanceof Date||typeof $!=="string")return $;let X=/^(\d{4})-(\d{2})-(\d{2})$/.exec($);if(!X)return $;let J=Number(X[1]),Y=Number(X[2]),Q=Number(X[3]),G=new Date(Date.UTC(J,Y-1,Q));if(G.getUTCFullYear()!==J||G.getUTCMonth()!==Y-1||G.getUTCDate()!==Q)return $;return G}function gY(Z,$){if(!$.length)return Z;let X={...Z};for(let J of $)delete X[J],delete X[y(J)];return X}function uY(Z,$){if(!Z||$.length===0)return Z;let X={...Z};for(let J of $)delete X[J],delete X[y(J)];return X}var x2=["id","uuid","created_at","updated_at","deleted_at"];function cY(Z,$){let X=new Map;for(let J of[...Object.keys(Z??{}),...x2]){let Y=y(J);if(!/^\w+$/.test(Y))continue;X.set(J,Y),X.set(Y,Y)}for(let J of $)X.delete(J),X.delete(y(J));return X}function mY(Z,$,X){if(!$)return Z;let J=String($).split(",").map((Q)=>Q.trim()).filter(Boolean),Y=Z;for(let Q of J){let G=Q.startsWith("-"),W=G?Q.slice(1):Q;if(!/^\w+$/.test(W))continue;let V=X.get(W);if(!V)continue;Y=Y.orderBy(V,G?"desc":"asc")}return Y}var T2={string:{get:(Z)=>Z!=null?String(Z):null,set:(Z)=>Z!=null?String(Z):null},number:{get:(Z)=>Z!=null?Number(Z):null,set:(Z)=>Z!=null?Number(Z):null},integer:{get:(Z)=>Z!=null?Math.trunc(Number(Z)):null,set:(Z)=>Z!=null?Math.trunc(Number(Z)):null},float:{get:(Z)=>Z!=null?Number.parseFloat(String(Z)):null,set:(Z)=>Z!=null?Number.parseFloat(String(Z)):null},boolean:{get:(Z)=>Z===1||Z==="1"||Z===!0||Z==="true",set:(Z)=>Z===!0||Z===1||Z==="1"||Z==="true"?1:0},json:{get:(Z)=>Z==null?null:typeof Z==="string"?U2(Z):Z,set:(Z)=>Z==null?null:typeof Z==="string"?Z:JSON.stringify(Z)},datetime:{get:(Z)=>Z?new Date(Z):null,set:(Z)=>Z instanceof Date?Z.toISOString():Z},date:{get:(Z)=>Z?new Date(Z):null,set:(Z)=>Z instanceof Date?Z.toISOString().split("T")[0]:Z},array:{get:(Z)=>Z==null?[]:Array.isArray(Z)?Z:typeof Z==="string"?q2(Z):[],set:(Z)=>Z==null?null:Array.isArray(Z)?JSON.stringify(Z):Z}};function U2(Z){try{return JSON.parse(Z)}catch{return Z}}function q2(Z){try{return JSON.parse(Z)}catch{return[]}}function lY(Z,$,X){if(!Z||typeof Z!=="object"||!$||Object.keys($).length===0)return Z;let J={...Z};for(let[Y,Q]of Object.entries($)){let G=typeof Q==="string"?T2[Q]:Q;if(!G||typeof G[X]!=="function")continue;if(Object.prototype.hasOwnProperty.call(J,Y))J[Y]=G[X](J[Y]);let W=y(Y);if(W!==Y&&Object.prototype.hasOwnProperty.call(J,W))J[W]=G[X](J[W])}return J}function t$(Z,$,X){let J=$?.attributes??{},Y={};for(let[Q,G]of Object.entries(J)){let W=G?.validation?.rule;if(!W||typeof W.validate!=="function")continue;let V=Object.prototype.hasOwnProperty.call(Z,Q);if(!V&&X==="updating")continue;let B=G!==null&&typeof G==="object"&&Object.prototype.hasOwnProperty.call(G,"default"),H=V?Z[Q]:B?G.default:void 0,z=w2(W,H),O=W.validate(z);if(!O?.valid&&Array.isArray(O?.errors)&&O.errors.length>0)Y[Q]=O.errors.map((F)=>G?.validation?.message?.[F?.code]??F?.message??"invalid")}return Object.keys(Y).length===0?{valid:!0}:{valid:!1,errors:Y}}function dY(Z){return Z.replace(/\{[^}]*\}/g,"{}").replace(/:[^/]+/g,"{}")}function d8(Z){if(Array.isArray(Z))return Z.filter(($)=>typeof $==="string"&&$.length>0);return typeof Z==="string"&&Z?[Z]:[]}function nY(Z){let $=typeof Z==="object"&&Z!==null&&"middleware"in Z,X=Z?.middleware;if(!$)return{read:["auth"],write:["auth"],declared:!1};if(X&&typeof X==="object"&&!Array.isArray(X)){let Y=X;return{read:"read"in Y?d8(Y.read):["auth"],write:"write"in Y?d8(Y.write):["auth"],declared:!0}}let J=d8(X);return{read:J,write:J,declared:!0}}var i$=15,L2=100;function pY(Z){let $=Number.parseInt(Z.get("page")||String(1),10),X=Number.isFinite($)?Math.max(1,$):1,J=Number.parseInt(Z.get("per_page")||String(i$),10),Y=Math.min(Number.isFinite(J)?Math.max(1,J):i$,L2);return{page:X,perPage:Y,offset:(X-1)*Y}}function B8(Z,$){let X=new URL(Z.toString());return X.searchParams.set("page",String($)),`${X.pathname}${X.search}`}function D2(Z,$,X,J,Y,Q){let G=($-1)*X,W=J===0,V={page:$,per_page:X,from:W?null:G+1,to:W?null:G+J,has_more_pages:Y,prev_page_url:$>1?B8(Z,$-1):null,next_page_url:Y?B8(Z,$+1):null};if(Q!==void 0&&!Number.isNaN(Q)){let B=Math.max(1,Math.ceil(Q/X));V.total=Q,V.last_page=B,V.first_page_url=B8(Z,1),V.last_page_url=B8(Z,B)}return V}function iY(Z,$,X,J,Y,Q){let{page:G,...W}=D2(Z,$,X,J,Y,Q);return{current_page:G,...W}}import{cacheRequestQuery as A2}from"@stacksjs/router";var V8=new WeakMap;function sY(Z,$){return A2(`batchLoad:${Z.name??"model"}:${String($)}`,async()=>{return new Promise((X,J)=>{let Y=V8.get(Z);if(!Y)Y={keys:[],resolvers:[],scheduled:!1},V8.set(Z,Y);if(Y.keys.push($),Y.resolvers.push({key:$,resolve:X,reject:J}),Y.scheduled)return;Y.scheduled=!0,Promise.resolve().then(async()=>{let Q=V8.get(Z);if(!Q)return;V8.delete(Z);let G=Array.from(new Set(Q.keys));try{let W=typeof Z.findMany==="function"?await Z.findMany(G):await Promise.all(G.map((B)=>Z.find?.(B))),V=new Map;for(let B of W??[]){let H=B?.id;if(H!==void 0)V.set(H,B)}for(let B of Q.resolvers)B.resolve(V.get(B.key))}catch(W){for(let V of Q.resolvers)V.reject(W)}})})})}import{db as ZQ}from"@stacksjs/database";class E2{conditions=[];where(Z,...$){let[X,J]=$,Y=J===void 0?"=":X,Q=J===void 0?X:J;this.addCondition("and","where",Z,Y,Q)}orWhere(Z,...$){let[X,J]=$,Y=J===void 0?"=":X,Q=J===void 0?X:J;this.addCondition("or","where",Z,Y,Q)}whereIn(Z,$){this.conditions.push({type:"and",method:"whereIn",column:Z,values:$})}whereNotIn(Z,$){this.conditions.push({type:"and",method:"whereIn",column:Z,values:$,operator:"not in"})}whereNull(Z){this.conditions.push({type:"and",method:"whereNull",column:Z})}whereNotNull(Z){this.conditions.push({type:"and",method:"whereNotNull",column:Z})}whereBetween(Z,$){this.conditions.push({type:"and",method:"whereBetween",column:Z,range:$})}whereExists(Z){this.conditions.push({type:"and",method:"whereExists",column:"",callback:Z})}addCondition(Z,$,X,J,Y){this.conditions.push({type:Z,method:$,column:X,operator:J,value:Y})}getConditions(){return this.conditions}}import{db as n8,runInTransactionScope as C2}from"@stacksjs/database";async function JQ(Z,$){return await C2(async()=>{return await n8.transaction(Z,$)})}async function YQ(Z){return await n8.savepoint(Z)}function QQ(Z,$){return n8.transactional(Z,$)}import{path as c}from"@stacksjs/path";import{fs as $0,globSync as t8}from"@stacksjs/storage";import{plural as Z5,singular as s$,snakeCase as j}from"@stacksjs/strings";import{isString as K8}from"@stacksjs/validation";function $5(Z){let $=Z.belongsToMany;if(!$)return[];if(Array.isArray($))return $.map((X)=>({relationName:typeof X==="string"?j(X):j(String(X.model)),relation:X}));return Object.entries($).map(([X,J])=>{if(typeof J==="string")return{relationName:X,relation:J};return{relationName:X,relation:{model:J.model,pivotTable:J.table,firstForeignKey:J.foreignKey,secondForeignKey:J.relatedKey}}})}async function HQ(Z){if(typeof Z==="string")Z=(await import(Z)).default;return Z.table??j(Z5(Z?.name||""))}function F0(Z,$){if(Z.name)return Z.name;return c.basename($).replace(/\.ts$/,"")}function b(Z,$){if(Z.table)return Z.table;return j(Z5(F0(Z,$)))}function P2(Z,$){let X=[Z,$];return X.sort(),X.join("_")}function zQ(Z,$){return $ in Z}async function N2(Z,$){let X=[];if(Z.hasOne)for(let J of Z.hasOne)X.push(await p8(J,Z,$,"hasOne"));if(Z.hasMany)for(let J of Z.hasMany)X.push(await p8(J,Z,$,"hasMany"));if(Z.belongsTo)for(let J of Z.belongsTo)X.push(await p8(J,Z,$,"belongsTo"));if(Z.hasOneThrough)for(let J of Z.hasOneThrough)X.push(await a$(J,Z,$,"hasOneThrough"));if(Z.hasManyThrough)for(let J of Z.hasManyThrough)X.push(await a$(J,Z,$,"hasManyThrough"));if(Z.belongsToMany)for(let{relationName:J,relation:Y}of $5(Z))X.push(await I2(Y,Z,$,"belongsToMany",J));if(Z.morphOne)X.push(await e$(Z.morphOne,Z,$,"morphOne"));if(Z.morphMany){let J=Array.isArray(Z.morphMany)?Z.morphMany:[Z.morphMany];for(let Y of J)X.push(await e$(Y,Z,$,"morphMany"))}if(Z.morphTo){let J=Z.morphTo,Y=Array.isArray(J)?J:typeof J==="object"&&J!==null?[J]:[];for(let Q of Y)X.push(k2(Q,Z,$))}if(Z.morphToMany){let J=Array.isArray(Z.morphToMany)?Z.morphToMany:[Z.morphToMany];for(let Y of J)X.push(o$(Y,Z,$,"morphToMany"))}if(Z.morphedByMany){let J=Array.isArray(Z.morphedByMany)?Z.morphedByMany:[Z.morphedByMany];for(let Y of J)X.push(o$(Y,Z,$,"morphedByMany"))}return X}function k2(Z,$,X){let J=Z&&typeof Z==="object"&&Z.name?String(Z.name):`${j(X)}able`,Y=Z?.type||`${J}_type`;return{relationship:"morphTo",model:"",table:"",relationTable:"",foreignKey:Z?.id||`${J}_id`,modelKey:Y,relationName:J,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:"",pivotKey:"",pivotTable:""}}function o$(Z,$,X,J){let Y=typeof Z==="object"&&Z!==null,Q=Y?String(Z.model||""):String(Z),G=Y&&Z.morphName?String(Z.morphName):`${j(X)}able`,W=Y&&Z.pivotTable?String(Z.pivotTable):G,V=Y&&Z.id||`${G}_id`,B=Y&&Z.type||`${G}_type`;return{relationship:J,model:Q,table:"",relationTable:"",foreignKey:V,modelKey:B,relationName:G,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:V,pivotKey:B,pivotTable:W}}async function H8(Z,$){let X=r8(`${$}.ts`),J=r8(`${Z}.ts`),Y=i8(`${Z}.ts`),Q=i8(`${$}.ts`);if(!X&&!Q)throw Error(`Model not found: ${$}`);if(!J&&!Y)throw Error(`Model not found: ${Z}`);let G;try{if($0.existsSync(X))G=(await import(X)).default;else G=(await import(Q)).default}catch(V){throw Error(`Failed to load model: ${$}. Error: ${V?.message||"Unknown error"}`)}let W=$0.existsSync(J)?J:Y;return{modelRelation:G,modelPath:W,modelRelationPath:$0.existsSync(X)?X:Q}}async function a$(Z,$,X,J){let Y="",Q="",G="",W="";if(K8(Z))Y=Z;else Y=Z.model,Q=Z.relationName||"",G=Z.through,W=Z.throughForeignKey||"";let{modelRelation:V,modelPath:B,modelRelationPath:H}=await H8(X,Y),z=b(V,H),O=b($,B),F=j(F0(V,H)),w=j(X);return{relationship:J,model:Y,table:z,relationTable:O,foreignKey:`${w}_id`,modelKey:`${F}_id`,relationName:Q,relationModel:X,throughModel:G,throughForeignKey:W,pivotForeign:`${w}_id`,pivotKey:`${F}_id`,pivotTable:O}}async function I2(Z,$,X,J,Y){let Q="",G="",W="",V=j(X);if(K8(Z))Q=Z;else Q=Z.model,G=Z.pivotTable||"",W=Z.firstForeignKey||`${V}_id`;let{modelRelation:B,modelPath:H,modelRelationPath:z}=await H8(X,Q),O=b(B,z),F=b($,H),w=j(F0(B,z));return{relationship:J,model:Q,table:O,relationTable:F,foreignKey:typeof Z==="string"?`${V}_id`:Z.firstForeignKey||`${V}_id`,modelKey:typeof Z==="string"?`${w}_id`:Z.secondForeignKey||`${w}_id`,relationName:Y,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:W,pivotKey:`${w}_id`,pivotTable:G}}async function e$(Z,$,X,J){let Y="",Q="",G="",W="";if(K8(Z))Y=Z,Q=`${j(X)}able`;else Y=Z.model,Q=Z.morphName||`${j(X)}able`,G=Z.type||`${Q}_type`,W=Z.id||`${Q}_id`;let{modelRelation:V,modelPath:B,modelRelationPath:H}=await H8(X,Y),z=b(V,H),O=b($,B);return{relationship:J,model:Y,table:z,relationTable:O,foreignKey:W||`${Q}_id`,modelKey:G||`${Q}_type`,relationName:Q,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:"",pivotKey:"",pivotTable:O}}async function p8(Z,$,X,J){let Y="",Q="";if(K8(Z))Y=Z;else Y=Z.model,Q=Z.relationName||"";let{modelRelation:G,modelPath:W,modelRelationPath:V}=await H8(X,Y),B=b(G,V),H=b($,W),z=j(F0(G,V)),O=j(X),F={relationship:J,model:Y,table:B,relationTable:H,foreignKey:typeof Z==="string"?`${O}_id`:Z.foreignKey||`${O}_id`,modelKey:`${z}_id`,relationName:Q,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:`${O}_id`,pivotKey:`${z}_id`,pivotTable:H};if(J==="belongsTo")F.foreignKey="";return F}function OQ(Z){let $=/belongs/,X=/has/,J=/Through/,Y=/morph/;if(J.test(Z))return"throughType";if($.test(Z))return"belongsType";if(X.test(Z))return"hasType";if(Y.test(Z))return"morphType";return""}function _Q(Z){let $=/One/;if(/Many/.test(Z))return"many";if($.test(Z))return"one";return""}async function FQ(Z,$){let X=[];if("belongsToMany"in Z){for(let{relation:J}of $5(Z)){let Y,Q;if(typeof J==="string")Q=J;else Q=J.model;let G=r8(`${Q}.ts`),W=i8(`${Q}.ts`);if($0.existsSync(G))Y=(await import(G)).default;else Y=(await import(W)).default;let V=b(Y,G),B=b(Z,$),H=typeof J==="object"&&"firstForeignKey"in J?J.firstForeignKey:`${s$(B)}_${Z.primaryKey}`,z=typeof J==="object"&&"secondForeignKey"in J?J.secondForeignKey:`${s$(V)}_${Z.primaryKey}`;X.push({table:(typeof J==="object"&&"pivotTable"in J?J.pivotTable:void 0)??P2(B,V),firstForeignKey:H,secondForeignKey:z})}return X}return[]}async function wQ(Z){let $=t8([c.userModelsPath("*.ts"),c.storagePath("framework/defaults/app/Models/**/*.ts")],{absolute:!0}),X=[];for(let J=0;J<$.length;J++){let Y=$[J],Q=await import(Y);if(Z===Q.default.name)continue;let G=F0(Q,Y),W=await N2(Q.default,G);if(!W.length)continue;let V=W.find((B)=>B.model===Z);if(V)X.push(V)}return X}function xQ(Z){if(Z===void 0)return[];return Object.keys(Z).filter(($)=>{return Z[$]?.hidden===!0})}function TQ(Z){let $=Z.attributes;if($===void 0)return[];return Object.keys($).filter((X)=>{return $[X]?.guarded===!0}).map((X)=>j(X))}function UQ(Z,$){let X=Z.attributes,J=[];if(X===void 0)return[];let Y=typeof Z.traits?.billable==="object"||typeof Z.traits?.billable==="boolean",Q=typeof Z.traits?.useAuth==="object"?Z.traits?.useAuth.usePasskey:!1,G=Z.traits?.useUuid||!1;if(Y)J.push("stripe_id");if(G)J.push("uuid");if(Q)J.push(...["two_factor_secret","public_key"]);let W=$.map((V)=>V.foreignKey).filter((V)=>V);return[...Object.keys(X).filter((V)=>{if(X===void 0)return!1;return X[V]?.fillable===!0}).map((V)=>j(V)),...J,...W]}async function qQ(Z,$){let X=Z.attributes;if(!X)X={};let J=Object.keys(X),Y=[],Q=Bun.file($),G="";try{if(await Q.exists())G=await Q.text()}catch{G=""}let W=/rule:.*$/gm,V;V=W.exec(G);while(V!==null)Y.push(V[0]),V=W.exec(G);return J.map((H,z)=>{let O=X[H],F=null,w=!1,T=!1,q=!1,L=!1;if(O)F=O||null,w=O.unique||!1,T=O.hidden||!1,q=O.fillable||!1;let E=Y[z]??"";return L=(O.validation?.rule).isRequired??!1,{field:H,default:F,unique:w,hidden:T,fillable:q,required:L,fieldArray:j2(E)}})}function j2(Z){let $=Z.split("rule: schema.");if($.length!==2)return null;if(!$[1])$[1]="";let X=$[1].replace(/,/g,"");if(!X)return null;let J=X.split("."),Y=/\(([^)]+)\)/;return J.map((Q)=>{let G=Y.exec(Q),W=G?G[1]:null;return{entity:Q.replace(Y,"").replace(/\(|\)/g,""),charValue:W}})[0]||null}function LQ(Z){let $=Z.fieldArray?.entity;switch($){case"enum":return"string | string[]";case"date":return"Date | string";case"timestamp":return"Date | string";case"datetime":return"Date | string";case"float":return"number";case"double":return"number";case"decimal":return"number";case"integer":return"number";case"bigint":return"number";default:return $}}function i8(Z){let $=c.join(c.storagePath("framework/defaults/app/Models"),"/"),X=c.join($,Z);if($0.existsSync(X))return X;return t8(`${$}**/${Z}`,{absolute:!0})[0]??""}function r8(Z){let $=c.join(c.userModelsPath("/"),"/"),X=c.join($,Z);if($0.existsSync(X))return X;return t8(`${$}**/${Z}`,{absolute:!0})[0]??""}function DQ(Z){let $=typeof Z==="number"?new Date(Z):typeof Z==="string"?new Date(Z):Z;if(Number.isNaN($.getTime()))throw Error(`Invalid date value: ${String(Z)}`);return $.toISOString().replace("T"," ").split(".")[0]??""}function AQ(Z){return Z.toISOString().split("T")[0]??""}function EQ(Z){return Z.getTime()}import{createModel as LX,registerModel as DX}from"@stacksjs/query-builder";import{log as f}from"@stacksjs/logging";import{snakeCase as d}from"@stacksjs/strings";import{AsyncLocalStorage as N7}from"async_hooks";function S2(Z){if(Z===null||typeof Z!=="object")return!1;let $=Z;return Array.isArray($.data)&&typeof $.current_page==="number"&&typeof $.per_page==="number"&&typeof $.total==="number"&&typeof $.last_page==="number"}function M2(Z){if(Z===null||typeof Z!=="object")return!1;let $=Z;return Array.isArray($.data)&&typeof $.current_page==="number"&&typeof $.per_page==="number"&&typeof $.has_more_pages==="boolean"&&!("total"in $)}function f2(Z){if(Z===null||typeof Z!=="object")return!1;let $=Z;return Array.isArray($.data)&&(typeof $.next_cursor==="string"||$.next_cursor===null)}function s8(Z){let{data:$}=Z,{perPage:X,page:J,total:Y,lastPage:Q}=Z.meta,G=$.length===0,W=G?null:(J-1)*X+1,V=G?null:W+$.length-1;return{data:$,current_page:J,per_page:X,total:Y,last_page:Q,from:W,to:V,has_more_pages:J<Q}}function o8(Z){return{data:Z.data,current_page:Z.meta.page,per_page:Z.meta.perPage,has_more_pages:Z.meta.hasMore}}function a8(Z){return{data:Z.data,per_page:Z.meta.perPage,next_cursor:X5(Z.meta.nextCursor),prev_cursor:X5(Z.meta.prevCursor),has_more_pages:Z.meta.nextCursor!==null&&Z.meta.nextCursor!==void 0}}function X5(Z){if(Z===null||Z===void 0)return null;if(typeof Z==="string")return Z;return JSON.stringify(Z)}function Z9(Z,$){let X=J9(),J=X?e8(X,"per_page"):void 0,Y=X?e8(X,"page"):void 0,Q=Z!==void 0?Math.max(1,Math.floor(Z)):Math.min(100,Math.max(1,J??15)),G=Math.max(1,Math.floor($??Y??1));return{perPage:Q,page:G}}function $9(Z,$){let X=J9(),J=X?Y5(X,"cursor"):void 0,Y=X?e8(X,"per_page"):void 0,Q=Z!==void 0?Math.max(1,Math.floor(Z)):Math.min(100,Math.max(1,Y??15)),W=J5($!==void 0?$:J??null);return{perPage:Q,cursor:W}}function J5(Z){if(Z===null||Z===void 0)return null;if(Array.isArray(Z))return Z;if(typeof Z==="string"&&Z.startsWith("["))try{let $=JSON.parse(Z);if(Array.isArray($))return $}catch{}return Z}function X9(Z){let $=J9();if(!$)return Z;let X=(()=>{try{return new URL($.url)}catch{return null}})();if(!X)return Z;let J=X.pathname;if(Z.path=J,"next_cursor"in Z)return Z.next_page_url=Z.next_cursor!==null?o(X,{cursor:Z.next_cursor}):null,Z.prev_page_url=Z.prev_cursor!==null?o(X,{cursor:Z.prev_cursor}):null,Z;let Y=Z.current_page;if(Z.prev_page_url=Y>1?o(X,{page:Y-1}):null,"total"in Z){let Q=Z.last_page;Z.next_page_url=Y<Q?o(X,{page:Y+1}):null,Z.first_page_url=o(X,{page:1}),Z.last_page_url=o(X,{page:Q})}else Z.next_page_url=Z.has_more_pages?o(X,{page:Y+1}):null;return Z}function o(Z,$){let X=new URL(Z.toString());for(let[J,Y]of Object.entries($))X.searchParams.set(J,String(Y));return`${X.pathname}${X.search}`}var X0;function J9(){if(X0===null)return;if(X0===void 0)try{let $=D("@stacksjs/router");if(typeof $.getCurrentRequest==="function")X0=$.getCurrentRequest;else{X0=null;return}}catch{X0=null;return}return X0()}function e8(Z,$){let X=Y5(Z,$);if(X===void 0)return;let J=Number(X);return Number.isFinite(J)?J:void 0}function Y5(Z,$){let X=Z.query?.[$];if(X===void 0)return;return Array.isArray(X)?X[0]:X}import{db as xX}from"@stacksjs/database";function w7(Z){let $=xX;return{async createStripeUser(X,J){let{manageCustomer:Y}=await import("@stacksjs/payments");return await Y.createStripeCustomer(X,J)},async updateStripeUser(X,J){let{manageCustomer:Y}=await import("@stacksjs/payments");return await Y.updateStripeCustomer(X,J)},async deleteStripeUser(X){let{manageCustomer:J}=await import("@stacksjs/payments");return await J.deleteStripeUser(X)},async createOrGetStripeUser(X,J){let{manageCustomer:Y}=await import("@stacksjs/payments");return await Y.createOrGetStripeUser(X,J)},async retrieveStripeUser(X){let{manageCustomer:J}=await import("@stacksjs/payments");return await J.retrieveStripeUser(X)},async defaultPaymentMethod(X){let{managePaymentMethod:J}=await import("@stacksjs/payments");return await J.retrieveDefaultPaymentMethod(X)},async setDefaultPaymentMethod(X,J){let{managePaymentMethod:Y}=await import("@stacksjs/payments");return await Y.setDefaultPaymentMethod(X,J)},async addPaymentMethod(X,J){let{managePaymentMethod:Y}=await import("@stacksjs/payments");return await Y.addPaymentMethod(X,J)},async paymentMethods(X,J){let{managePaymentMethod:Y}=await import("@stacksjs/payments");return await Y.listPaymentMethods(X,J)},async newSubscription(X,J,Y,Q={}){let{manageSubscription:G}=await import("@stacksjs/payments"),W=await G.create(X,J,Y,Q),B=W.latest_invoice?.payment_intent;return{subscription:W,paymentIntent:B}},async updateSubscription(X,J,Y,Q={}){let{manageSubscription:G}=await import("@stacksjs/payments"),W=await G.update(X,J,Y,Q),B=W.latest_invoice?.payment_intent;return{subscription:W,paymentIntent:B}},async cancelSubscription(X,J,Y={}){let{manageSubscription:Q}=await import("@stacksjs/payments");return{subscription:await Q.cancel(J,Y)}},async activeSubscription(X){let{manageSubscription:J}=await import("@stacksjs/payments"),Y=await $.selectFrom("subscriptions").where("user_id","=",X.id).where("provider_status","=","active").selectAll().executeTakeFirst();if(Y){let Q=await J.retrieve(X,Y.provider_id||"");return{subscription:Y,providerSubscription:Q}}return},async checkout(X,J,Y={}){let{manageCheckout:Q,manageCustomer:G}=await import("@stacksjs/payments"),W={};if(Y.enableTax)W.automatic_tax={enabled:!0},delete Y.enableTax;if(Y.allowPromotions)W.allow_promotion_codes=!0,delete Y.allowPromotions;let H={...{mode:"payment",customer:(await G.createOrGetStripeUser(X,{})).id,line_items:J.map((z)=>({price:z.priceId,quantity:z.quantity||1}))},...W,...Y};return await Q.create(X,H)},async createSetupIntent(X,J={}){let{manageSetupIntent:Y}=await import("@stacksjs/payments");return await Y.create(X,J)},async subscriptionHistory(X){let{manageInvoice:J}=await import("@stacksjs/payments");return await J.list(X)},async transactionHistory(X){let{manageTransaction:J}=await import("@stacksjs/payments");return await J.list(X)},async connectAccount(X,J={}){let Y=J.accountColumn||"stripe_account_id",Q=(X._attributes??X)[Y];if(!Q)return null;let G=await e6();try{return await G.accounts.retrieve(Q)}catch{return null}},async createConnectAccount(X,J={}){let Y=J.accountColumn||"stripe_account_id",Q=X._attributes??X,G=Q[Y],W=await e6();if(!G){let{stacksIdempotencyKey:V}=await import("@stacksjs/payments"),B=J.modelTable||Z,H=await W.accounts.create({type:J.type??"express",email:J.email??Q.email,country:J.country??"US",capabilities:J.capabilities??{card_payments:{requested:!0},transfers:{requested:!0}}},{idempotencyKey:V("connect.account.create",B,Q.id)});return G=H.id,await $.updateTable(B).set({[Y]:G}).where("id","=",Number(Q.id)).execute(),H}return await W.accounts.retrieve(G)},async connectOnboardLink(X,J){let Y=J.accountColumn||"stripe_account_id",G=(X._attributes??X)[Y];if(!G)throw Error("connectOnboardLink: model has no Stripe Connect account; call createConnectAccount first");return{url:(await(await e6()).accountLinks.create({account:G,refresh_url:J.refreshUrl,return_url:J.returnUrl,type:J.type??"account_onboarding"})).url,accountId:G}},async syncConnectStatus(X,J={}){let Y=J.accountColumn||"stripe_account_id",Q=J.chargesColumn||"charges_enabled",G=J.payoutsColumn||"payouts_enabled",W=X._attributes??X,V=W[Y];if(!V)return{chargesEnabled:!1,payoutsEnabled:!1};let H=await(await e6()).accounts.retrieve(V),z=!!H.charges_enabled,O=!!H.payouts_enabled,F=J.modelTable||Z;return await $.updateTable(F).set({[Q]:z,[G]:O}).where("id","=",Number(W.id)).execute(),{chargesEnabled:z,payoutsEnabled:O}},async chargeWithSplit(X,J){let Y=await e6(),Q=J.accountColumn||"stripe_account_id",G=X._attributes??X,W=J.connectAccountId||G[Q],V={amount:J.amountCents,currency:J.currency||"usd",automatic_payment_methods:{enabled:!0},metadata:J.metadata};if(W){if(V.transfer_data={destination:W},J.platformFeeCents)V.application_fee_amount=J.platformFeeCents}let{freshIdempotencyKey:B}=await import("@stacksjs/payments");return await Y.paymentIntents.create(V,{idempotencyKey:B("payment_intent.create",G.id,J.amountCents)})}}}async function e6(){let Z=globalThis.process?.env?.STRIPE_SECRET_KEY;if(!Z)throw Error("Stripe Connect: STRIPE_SECRET_KEY not configured");return new(await Promise.resolve().then(() => (F7(),_7))).default(Z,{apiVersion:"2026-06-24.dahlia"})}function x7(){return{async generateTwoFactorForModel(Z){let{generateTwoFactorSecret:$}=await import("@stacksjs/auth"),X=$();await Z.update({two_factor_secret:X})},async verifyTwoFactorCode(Z,$){let X=Z.get("two_factor_secret");if(typeof X!=="string")return!1;let{verifyTwoFactorCode:J,RateLimiter:Y}=await import("@stacksjs/auth"),Q=String(Z.id??Z.get?.("id")??Z.get?.("email")??X),G=`2fa:${Q}`;if(await Y.isRateLimited(G)){let{HttpError:V}=await import("@stacksjs/error-handling");throw new V(429,"Too many verification attempts. Please try again later.")}if(!await J($,X))return await Y.recordFailedAttempt(G),!1;try{let{cache:V}=await import("@stacksjs/cache"),B=`2fa:used:${Q}:${$}`;if(await V.has(B))return await Y.recordFailedAttempt(G),!1;await V.set(B,"1",90)}catch{}return await Y.resetAttempts(G),!0}}}import{sqlDateTime as TX}from"@stacksjs/database";import{log as W0}from"@stacksjs/logging";var N8="deleted_at";function T7(Z,$="id"){return{async softDelete(X){let J=TX(),Y=Z.where($,X);if(typeof Y?.update==="function")return await Y.update({[N8]:J}),!0;return!1},async restore(X){let J=Z.where($,X);if(typeof J?.update==="function")return await J.update({[N8]:null}),!0;return!1},async forceDelete(X){let J=Z.where($,X);if(typeof J?.delete==="function")return await J.delete(),!0;return!1},withTrashed(){return typeof Z.query==="function"?Z.query():Z},onlyTrashed(){let X=typeof Z.query==="function"?Z.query():Z;if(typeof X?.whereNotNull==="function")return X.whereNotNull(N8);return X?.where?.(N8,"!=",null)??X}}}function U7(Z){if(Z===!0||Z==null)return{};if(typeof Z==="object"&&!Array.isArray(Z)){let $=Z;if(Array.isArray($.cascade)){let X=$.cascade.filter((J)=>typeof J==="string");return X.length?{cascade:X}:{}}return{}}return{}}function UX(Z,$){let X=Z.hasMany??[],J=Z.hasOne??[],Y=X.some((H)=>S$(H,$,!0)),Q=J.some((H)=>S$(H,$,!1));if(!Y&&!Q)return W0.warn(`[orm] soft-delete cascade: '${$}' is not a declared hasMany/hasOne relation - skipping`),null;let W=(Y?X:J).find((H)=>S$(H,$,Y))??null;if(!W)return null;let B=globalThis[W];if(!B)return W0.warn(`[orm] soft-delete cascade: model '${W}' is not yet on globalThis - skipping cascade for '${$}'`),null;return{className:W,model:B}}function S$(Z,$,X){let J=Z.toLowerCase();if($===J)return!0;if(X&&$===`${J}s`)return!0;if(X&&J.endsWith("y")&&$===`${J.slice(0,-1)}ies`)return!0;return!1}async function qX(Z,$,X,J,Y){try{let Q=X.where;if(typeof Q!=="function"){W0.warn(`[orm] cascade ${Y}: child model has no .where()`);return}if(Y==="softDelete"){let G=X.softDelete;if(typeof G==="function"){let V=Q.call(X,J,$),B=typeof V?.get==="function"?await V.get():Array.isArray(V)?V:[],H=X.primaryKey||"id";for(let z of B){let O=z?.[H];if(O!=null)await G.call(X,O)}return}let W=Q.call(X,J,$);if(typeof W?.delete==="function"){W0.debug(`[orm] cascade soft-delete: child has no softDeletes trait, hard-deleting from ${String(X.table??"?")}`),await W.delete();return}}else{let G=X.restore;if(typeof G!=="function"){W0.debug("[orm] cascade restore: child has no restore() - nothing to do");return}let W=X.withTrashed,B=(typeof W==="function"?W.call(X):X).where?.(J,$),H=typeof B?.get==="function"?await B.get():[],z=X.primaryKey||"id";for(let O of H){let F=O?.[z];if(F!=null)await G.call(X,F)}}}catch(Q){if(W0.warn(`[orm] soft-delete cascade ${Y} on ${Z}#${String($)} failed`,{error:Q}),process.env.STACKS_ORM_CASCADE_SWALLOW!=="true")throw Q}}async function Z8(Z,$,X,J){let Y=$.cascade;if(!Y||Y.length===0)return;let Q=`${Z.name.toLowerCase()}_id`;for(let G of Y){let W=UX(Z,G);if(!W)continue;await qX(W.className,X,W.model,Q,J)}}var k7=new N7;function Z0(){return k7.getStore()?.suppressed===!0}function e(Z){return Promise.resolve(k7.run({suppressed:!0},Z))}var I7=new N7;function AX(){return I7.getStore()?.suppressed===!0}function EX(Z){return Promise.resolve(I7.run({suppressed:!0},Z))}var v$=Symbol.for("stacks.orm.modelDefinition");class j7 extends Error{status=422;errors;constructor(Z,$){let X=Object.keys($).join(", ");super(`${Z} validation failed: ${X}`);this.name="ModelValidationError",this.errors=$}}var q7=new Set;function CX(Z,$){let X=typeof Z==="string"?Z.slice(0,80):String(Z),J=`${typeof Z}:${X}`;if(q7.has(J))return;q7.add(J);let Y=$ instanceof Error?$.message:String($);console.error(`[orm] JSON cast failed to parse value (returning null): ${Y} - value preview: ${JSON.stringify(X)}`)}var PX={string:{get:(Z)=>Z!=null?String(Z):null,set:(Z)=>Z!=null?String(Z):null},number:{get:(Z)=>Z!=null?Number(Z):null,set:(Z)=>Z!=null?Number(Z):null},integer:{get:(Z)=>Z!=null?Math.trunc(Number(Z)):null,set:(Z)=>Z!=null?Math.trunc(Number(Z)):null},float:{get:(Z)=>Z!=null?Number.parseFloat(String(Z)):null,set:(Z)=>Z!=null?Number.parseFloat(String(Z)):null},boolean:{get:(Z)=>Z===1||Z==="1"||Z===!0||Z==="true",set:(Z)=>Z===!0||Z===1||Z==="1"||Z==="true"?1:0},json:{get:(Z)=>{if(Z==null)return null;if(typeof Z==="string")try{return JSON.parse(Z)}catch($){return CX(Z,$),null}return Z},set:(Z)=>{if(Z==null)return null;return typeof Z==="string"?Z:JSON.stringify(Z)}},datetime:{get:(Z)=>Z?new Date(Z):null,set:(Z)=>Z instanceof Date?Z.toISOString():Z},date:{get:(Z)=>Z?new Date(Z):null,set:(Z)=>Z instanceof Date?Z.toISOString().split("T")[0]:Z},array:{get:(Z)=>{if(Z==null)return[];if(Array.isArray(Z))return Z;if(typeof Z==="string")try{return JSON.parse(Z)}catch{return[]}return[]},set:(Z)=>{if(Z==null)return null;return Array.isArray(Z)?JSON.stringify(Z):Z}}};function S7(Z){return typeof Z==="string"?PX[Z]:Z}function L7(Z,$,X){if(!Z||typeof Z!=="object")return Z;let J={...Z};for(let[Y,Q]of Object.entries($))if(Y in J){let G=S7(Q);J[Y]=G[X](J[Y])}return J}var k8=new Set(["_attributes","_original","_definition","_hasSaved","_relations"]),D7=Symbol.for("stacks.modelInstanceProxy"),NX={tags:{bag:"_taggable",mode:"id"},tagCount:{bag:"_taggable",mode:"id"},addTag:{bag:"_taggable",mode:"id"},activeTags:{bag:"_taggable",mode:"id"},inactiveTags:{bag:"_taggable",mode:"id"},removeTag:{bag:"_taggable",mode:"id"},categories:{bag:"_categorizable",mode:"id"},categoryCount:{bag:"_categorizable",mode:"id"},addCategory:{bag:"_categorizable",mode:"id"},activeCategories:{bag:"_categorizable",mode:"id"},inactiveCategories:{bag:"_categorizable",mode:"id"},removeCategory:{bag:"_categorizable",mode:"id"},comments:{bag:"_commentable",mode:"id"},commentCount:{bag:"_commentable",mode:"id"},addComment:{bag:"_commentable",mode:"id"},approvedComments:{bag:"_commentable",mode:"id"},pendingComments:{bag:"_commentable",mode:"id"},rejectedComments:{bag:"_commentable",mode:"id"},likes:{bag:"_likeable",mode:"id"},likeCount:{bag:"_likeable",mode:"id"},like:{bag:"_likeable",mode:"id"},unlike:{bag:"_likeable",mode:"id"},isLiked:{bag:"_likeable",mode:"id"},createStripeUser:{bag:"_billable",mode:"model"},updateStripeUser:{bag:"_billable",mode:"model"},deleteStripeUser:{bag:"_billable",mode:"model"},createOrGetStripeUser:{bag:"_billable",mode:"model"},retrieveStripeUser:{bag:"_billable",mode:"model"},defaultPaymentMethod:{bag:"_billable",mode:"model"},setDefaultPaymentMethod:{bag:"_billable",mode:"model"},addPaymentMethod:{bag:"_billable",mode:"model"},paymentMethods:{bag:"_billable",mode:"model"},newSubscription:{bag:"_billable",mode:"model"},updateSubscription:{bag:"_billable",mode:"model"},cancelSubscription:{bag:"_billable",mode:"model"},activeSubscription:{bag:"_billable",mode:"model"},checkout:{bag:"_billable",mode:"model"},createSetupIntent:{bag:"_billable",mode:"model"},subscriptionHistory:{bag:"_billable",mode:"model"},transactionHistory:{bag:"_billable",mode:"model"},connectAccount:{bag:"_billable",mode:"model"},createConnectAccount:{bag:"_billable",mode:"model"},connectOnboardLink:{bag:"_billable",mode:"model"},syncConnectStatus:{bag:"_billable",mode:"model"},chargeWithSplit:{bag:"_billable",mode:"model"},generateTwoFactorForModel:{bag:"_twoFactor",mode:"model"},verifyTwoFactorCode:{bag:"_twoFactor",mode:"model"}};function kX(Z,$){if(!Z||!$)return null;let X=$.split("."),J=Z;for(let Y of X){if(J==null||typeof J!=="object")return null;let Q=J;if("_attributes"in Q&&Q._attributes&&typeof Q._attributes==="object"){let G=Q._attributes;if(Y in G){J=G[Y];continue}}if(Y in Q){J=Q[Y];continue}return null}return J??null}function R(Z,$){if(!Z||typeof Z!=="object")return Z;if(Z[D7])return Z;let X=Z._attributes;if(!X||typeof X!=="object")return Z;if($&&Object.keys($).length>0){for(let[J,Y]of Object.entries($))if(Object.prototype.hasOwnProperty.call(X,J))X[J]=S7(Y).get(X[J])}return new Proxy(Z,{get(J,Y,Q){if(Y===D7)return!0;if(Y==="saveAsync")return async function(){let W=J._definition,V=W?.set;if(V&&typeof J.isDirty==="function"){for(let[H,z]of Object.entries(V)){if(typeof z!=="function")continue;if(!J.isDirty(H))continue;let O=z(J._attributes),F=O&&typeof O.then==="function"?await O:O;J._attributes[H]=F}let B=W.set;W.set={};try{return J.save()}finally{W.set=B}}return J.save()};if(Y==="save")return function(){let W=J._definition,V=W?.set;if(V&&Object.keys(V).length>0&&typeof J.isDirty==="function"){for(let[H,z]of Object.entries(V)){if(typeof z!=="function")continue;if(!J.isDirty(H))continue;let O=z(J._attributes);if(O&&typeof O.then==="function")throw Error(`Setter for "${H}" returned a Promise - use \`saveAsync()\` instead of \`save()\` when a model has async setters.`);J._attributes[H]=O}let B=W.set;W.set={};try{return J.save()}finally{W.set=B}}return J.save()};if(Y==="updateAsync")return async function(W){if(W&&typeof W==="object"&&!Array.isArray(W))for(let[V,B]of Object.entries(W))Q[V]=B;return Q.saveAsync()};if(Y==="saveQuietly")return function(){return e(()=>J.save())};if(Y==="saveAsyncQuietly")return function(){return e(()=>Q.saveAsync())};if(Y==="updateQuietly")return function(W){return e(()=>J.update(W))};if(Y==="updateAsyncQuietly")return function(W){return e(()=>Q.updateAsync(W))};if(Y==="deleteQuietly")return function(){return e(()=>J.delete())};if(Y==="toSearchableObject")return function(){let B=J._definition?.traits?.useSearch;if(!B)return null;let H=J._attributes;if(!H)return null;if(B===!0){let T={...H};if(H.id!=null)T.id=String(H.id);return T}let z={},O=B.displayable?.length?B.displayable:[...B.searchable??[],...B.filterable??[],...B.sortable??[],"id"],F=B.denormalize??{},w=J._relations;for(let T of O){let q=d(T),L=H[q]??H[T];if(L!==void 0){z[q]=L;continue}let E=F[T]??F[q];if(E){z[q]=kX(w,E);continue}z[q]=void 0}if(H.id!=null)z.id=String(H.id);return z};if(typeof Y==="string"&&!k8.has(Y)){let W=J._attributes;if(W&&Object.prototype.hasOwnProperty.call(W,Y))return W[Y];let V=J._relations;if(V&&Object.prototype.hasOwnProperty.call(V,Y)){let H=V[Y];if(Array.isArray(H))return H.map((z)=>R(z,$));return R(H,$)}let B=NX[Y];if(B){let O=J._definition?.__traitMethods?.[B.bag]?.[Y];if(typeof O==="function")return B.mode==="model"?(...F)=>O(Q,...F):(...F)=>O(J.id,...F)}if(W){let H=d(Y);if(H!==Y&&Object.prototype.hasOwnProperty.call(W,H))return W[H]}}let G=Reflect.get(J,Y,J);return typeof G==="function"?G.bind(J):G},set(J,Y,Q,G){if(typeof Y==="string"&&!k8.has(Y)){let{_attributes:W,set:V}=J;if(W&&Object.prototype.hasOwnProperty.call(W,Y)){if(typeof V==="function")V.call(J,Y,Q);else W[Y]=Q;return!0}if(W){let B=d(Y);if(B!==Y&&Object.prototype.hasOwnProperty.call(W,B)){if(typeof V==="function")V.call(J,B,Q);else W[B]=Q;return!0}}if(W&&!(Y in J)){if(typeof V==="function")V.call(J,Y,Q);else W[Y]=Q;return!0}}return Reflect.set(J,Y,Q,G)},has(J,Y){if(typeof Y==="string"&&!k8.has(Y)){let Q=J._attributes;if(Q&&Object.prototype.hasOwnProperty.call(Q,Y))return!0;let G=J._relations;if(G&&Object.prototype.hasOwnProperty.call(G,Y))return!0;if(Q){let W=d(Y);if(W!==Y&&Object.prototype.hasOwnProperty.call(Q,W))return!0}}return Reflect.has(J,Y)},deleteProperty(J,Y){if(typeof Y==="string"&&!k8.has(Y)){let Q=J._attributes;if(Q&&Object.prototype.hasOwnProperty.call(Q,Y))return delete Q[Y],!0}return Reflect.deleteProperty(J,Y)},ownKeys(J){let Y=J._attributes;return Y?Object.keys(Y):[]},getOwnPropertyDescriptor(J,Y){if(typeof Y==="string"){let Q=J._attributes;if(Q&&Object.prototype.hasOwnProperty.call(Q,Y))return{configurable:!0,enumerable:!0,value:Q[Y],writable:!0}}return Object.getOwnPropertyDescriptor(J,Y)}})}var IX=new Set(["get","first","last","firstOrFail","find","findOrFail","all","paginate","simplePaginate","cursorPaginate"]),jX={paginate:s8,simplePaginate:o8,cursorPaginate:a8},A7=Symbol.for("stacks.queryBuilderProxy");function M7(Z,$){if(!Z||typeof Z!=="object")return Z;if(Z[A7])return Z;return new Proxy(Z,{get(X,J,Y){if(J===A7)return!0;let Q=Reflect.get(X,J,Y);if(typeof Q!=="function")return Q;return function(...G){let W=G,V=String(J);if(V==="paginate"||V==="simplePaginate"){let{perPage:z,page:O}=Z9(G[0],G[1]);W=[z,O]}else if(V==="cursorPaginate"){let{perPage:z,cursor:O}=$9(G[0],G[1]);W=[z,O,G[2],G[3]]}let B=Q.apply(X,W),H=(z)=>{if(IX.has(V)){if(Array.isArray(z))return z.map((F)=>R(F,$));let O=jX[V];if(O&&z&&Array.isArray(z.data)){let F=z.data.map((T)=>R(T,$)),w=O({...z,data:F});return X9(w)}if(z&&Array.isArray(z.data))return{...z,data:z.data.map((F)=>R(F,$))};return R(z,$)}if(z&&typeof z==="object"&&typeof z.get==="function")return M7(z,$);return z};if(B&&typeof B.then==="function")return B.then(H);return H(B)}}})}function SX(Z,$){let X=["find","first","last","all","firstOrFail","findOrFail","findMany"];for(let Q of X){let G=Z[Q];if(typeof G!=="function")continue;Z[Q]=function(...W){let V=G.apply(this,W),B=(H)=>Array.isArray(H)?H.map((z)=>R(z,$)):R(H,$);if(V&&typeof V.then==="function")return V.then(B);return B(V)}}let J=["create","firstOrCreate","updateOrCreate","make"];for(let Q of J){let G=Z[Q];if(typeof G!=="function")continue;Z[Q]=function(...W){let V=G.apply(this,W),B=(H)=>Array.isArray(H)?H.map((z)=>R(z,$)):R(H,$);if(V&&typeof V.then==="function")return V.then(B);return B(V)}}let Y=["query","where","orWhere","whereIn","whereNotIn","whereNull","whereNotNull","whereLike","whereBetween","whereNotBetween","orderBy","orderByDesc","select","with","limit","take","skip","latest","oldest"];for(let Q of Y){let G=Z[Q];if(typeof G!=="function")continue;Z[Q]=function(...W){let V=G.apply(this,W);return M7(V,$)}}}class f7 extends Error{model;id;constructor(Z,$){super($!=null?`[ORM] ${Z} not found for id=${String($)}`:`[ORM] No matching ${Z} row`);this.name="ModelNotFoundError",this.model=Z,this.id=$}}class f$ extends Error{model;attribute;reason;constructor(Z,$,X){let J=X==="guarded"?`'${$}' is marked guarded`:`'${$}' is not in the fillable allowlist`;super(`[ORM] Mass assignment to ${Z} forbidden: ${J}. Use ${Z}.forceCreate(...) / .forceUpdate(...) to bypass.`);this.name="MassAssignmentException",this.model=Z,this.attribute=$,this.reason=X}}var MX=new Set(["id","created_at","updated_at","deleted_at","uuid"]);function $8(Z,$,X={}){if(X.force)return $;if(!$||typeof $!=="object"||Array.isArray($))return $;let J=Z.attributes;if(!J)return $;let Y=new Set,Q=new Set,G=new Set;for(let[V,B]of Object.entries(J)){let H=d(V);if(Y.add(H),B?.fillable===!0)Q.add(H);if(B?.guarded===!0)G.add(H)}let W=Q.size>0?Q:Y;for(let V of Object.keys($)){let B=d(V);if(MX.has(B))continue;if(G.has(B))throw new f$(Z.name,V,"guarded");if(B.endsWith("_id"))continue;if(!W.has(B))throw new f$(Z.name,V,"not-fillable")}return $}async function y$(Z,$){let X=Z.set;if(!X||typeof X!=="object")return $;let J={...$};for(let[Y,Q]of Object.entries(X)){if(typeof Q!=="function"||!(Y in J))continue;try{J[Y]=await Q(J)}catch(G){f.error(`[orm] ${Z.name}.set.${Y} threw - skipping setter`,G)}}return J}function fX(Z,$){let X=$.primaryKey||"id",J=Z.create;function Y(B){let H=Z.where;if(typeof H!=="function")throw Error(`[ORM] ${$.name}.${B} needs a working where(): the underlying query builder did not expose one`);return H}function Q(B){let H=Z.find;if(typeof H!=="function")throw Error(`[ORM] ${$.name}.${B} needs a working find(): the underlying query builder did not expose one`);return H}function G(B){let H=Z.create;if(typeof H!=="function")throw Error(`[ORM] ${$.name}.${B} cannot create: the underlying query builder did not expose create()`);return H}if(typeof Z.update!=="function")Z.update=async function(B,H){if(B==null)throw Error(`[ORM] ${$.name}.update requires an id as the first argument`);if(!H||typeof H!=="object"||Array.isArray(H))throw Error(`[ORM] ${$.name}.update requires a data object as the second argument`);if(Object.keys(H).length===0){f.debug(`[orm] ${$.name}.update called with empty data - short-circuiting and returning current row`);let F=Z.find;return typeof F==="function"?await F.call(Z,B):null}$8($,H);let z=await y$($,H);await Y("update").call(Z,X,B).update(z);let O=Z.find;return typeof O==="function"?await O.call(Z,B):null};if(typeof Z.forceUpdate!=="function")Z.forceUpdate=async function(B,H){if(B==null)throw Error(`[ORM] ${$.name}.forceUpdate requires an id as the first argument`);if(!H||typeof H!=="object"||Array.isArray(H))throw Error(`[ORM] ${$.name}.forceUpdate requires a data object as the second argument`);let z=await y$($,H);await Y("forceUpdate").call(Z,X,B).update(z);let O=Z.find;return typeof O==="function"?await O.call(Z,B):null};if(typeof Z.forceCreate!=="function")Z.forceCreate=async function(B){if(!B||typeof B!=="object"||Array.isArray(B))throw Error(`[ORM] ${$.name}.forceCreate requires a data object`);let H=Z.make;if(typeof H==="function"){let z=await H.call(Z);if(z&&typeof z.forceFill==="function"&&typeof z.save==="function")return z.forceFill(B),await z.save()??z}if(typeof J!=="function")throw Error(`[ORM] ${$.name}.forceCreate cannot create: the underlying query builder did not expose create()`);return await J.call(Z,B)};if(typeof Z.delete!=="function")Z.delete=async function(B){if(B==null)throw Error(`[ORM] ${$.name}.delete requires an id as the first argument`);if(!await Q("delete").call(Z,B))return!1;return await Y("delete").call(Z,X,B).delete(),!0};if(typeof Z.findOrFail!=="function")Z.findOrFail=async function(B){let H=await Q("findOrFail").call(Z,B);if(H==null)throw new f7($.name,B);return H};if(typeof Z.exists!=="function")Z.exists=async function(B){if(B==null)return!1;let H=Y("exists").call(Z,X,B);if(typeof H.count==="function"){let O=await H.count();return Number(O)>0}let z=Z.find;return typeof z==="function"?await z.call(Z,B)!=null:!1};if(typeof Z.firstOrCreate!=="function")Z.firstOrCreate=async function(B,H={}){if(!B||typeof B!=="object"||Array.isArray(B))throw Error(`[ORM] ${$.name}.firstOrCreate requires a where-attrs object`);let z=Y("firstOrCreate").call(Z,B),O=typeof z.first==="function"?await z.first():await z;if(O)return O;let F={...B,...H};return $8($,F),await G("firstOrCreate").call(Z,F)};if(typeof Z.updateOrCreate!=="function")Z.updateOrCreate=async function(B,H){if(!B||typeof B!=="object"||Array.isArray(B))throw Error(`[ORM] ${$.name}.updateOrCreate requires a where-attrs object`);if(!H||typeof H!=="object"||Array.isArray(H))throw Error(`[ORM] ${$.name}.updateOrCreate requires a values object`);let z=Y("updateOrCreate").call(Z,B),O=typeof z.first==="function"?await z.first():await z;if(O){$8($,H);let w=O[X];await Y("updateOrCreate").call(Z,X,w).update(H);let T=Z.find;return typeof T==="function"?await T.call(Z,w):{...O,...H}}let F={...B,...H};return $8($,F),await G("updateOrCreate").call(Z,F)};if(typeof Z.count!=="function")Z.count=async function(){let B=Z;if(typeof B.query==="function"){let O=B.query();if(typeof O?.count==="function"){let F=await O.count();return Number(F)||0}}let{all:H,get:z}=Z;if(typeof H==="function")return(await H.call(Z)||[]).length;if(typeof z==="function")return(await z.call(Z)||[]).length;return 0};if(typeof Z.pluck!=="function")Z.pluck=async function(B){if(!B||typeof B!=="string")throw Error(`[ORM] ${$.name}.pluck requires a column name`);let H=Z.all;return((typeof H==="function"?await H.call(Z):[])||[]).map((O)=>O?.[B])};if(typeof Z.whereIn!=="function")Z.whereIn=async function(B,H){if(!B||typeof B!=="string")throw Error(`[ORM] ${$.name}.whereIn requires a column name`);if(!Array.isArray(H))throw Error(`[ORM] ${$.name}.whereIn requires an array of values`);if(H.length===0)return[];let z=Z.where;if(typeof z!=="function")return[];let O=z.call(Z,B,"in",H);if(O&&typeof O.get==="function")return await O.get();return await O};let W=[["latest","desc"],["oldest","asc"]];for(let[B,H]of W)if(typeof Z[B]!=="function")Z[B]=async function(z="created_at"){let O=Z,F=typeof O.query==="function"?O.query():O;if(typeof F?.orderBy==="function"){let L=F.orderBy(z,H);if(typeof L.first==="function")return await L.first();if(typeof L.get==="function")return(await L.get())?.[0]??null}let w=Z.all;if(typeof w!=="function")return null;return[...await w.call(Z)||[]].sort((L,E)=>{let P=L?.[z],I=E?.[z];if(P===I)return 0;return(P>I?1:-1)*(H==="desc"?-1:1)})[0]??null};let V=v7($.traits?.useSearch,$);if(V){let B=V.index??$.table??d(`${$.name}s`);if(typeof Z.search!=="function")Z.search=function(H,z){return RX(Z,B,H,z,V.searchable)};if(typeof Z.makeAllSearchable!=="function")Z.makeAllSearchable=async function(H=500){let z=Z.all;if(typeof z!=="function")throw Error(`[ORM] ${$.name}.makeAllSearchable cannot run: the underlying query builder did not expose all()`);let{useSearchEngine:O}=await import("@stacksjs/search-engine"),F=O(),w=0,T=Z.query;if(typeof T==="function")try{let E=T.call(Z);if(E&&typeof E.chunk==="function")return await E.chunk(H,async(P)=>{let I=await h$(P,V);if(I.length>0)await F.addDocuments(B,I);w+=I.length}),w}catch{}let q=await z.call(Z)||[],L=await h$(q,V);if(L.length>0)await F.addDocuments(B,L);return L.length};if(typeof Z.removeAllFromSearch!=="function")Z.removeAllFromSearch=async function(){let{useSearchEngine:H}=await import("@stacksjs/search-engine"),z=H();if(typeof z.deleteAllDocuments==="function"){await z.deleteAllDocuments(B);return}let O=Z.all,F=typeof O==="function"?await O.call(Z)||[]:[],w=H();for(let T of F){let q=T?.id??T?._attributes?.id;if(q!=null)await w.deleteDocument(B,Number(q))}}}}async function h$(Z,$){if(Z.length===0)return[];if(typeof $.shapeMany==="function"){let J=await $.shapeMany(Z);if(!Array.isArray(J)||J.length!==Z.length)throw TypeError(`[orm/search] shapeMany returned ${Array.isArray(J)?J.length:typeof J} documents for ${Z.length} rows. It must return one document per row, in order, or documents are indexed under the wrong ids.`);return J.filter(Boolean)}return(await Promise.all(Z.map((J)=>vX(J,$)))).filter(Boolean)}function yX(Z){let $=new Set,X=Z.attributes??{};for(let[J,Y]of Object.entries(X))if(Y?.hidden)$.add(J);return $}function hX(Z,$){if(!Z||$.size===0)return Z;let X={};for(let[J,Y]of Object.entries(Z))if(!$.has(J))X[J]=Y;return X}async function vX(Z,$){if(typeof $.shape==="function")try{return await $.shape(Z)}catch{return}let X=Z?.toSearchableObject?.();if(X!==void 0)return X;return hX(Z?._attributes??(typeof Z?.toJSON==="function"?Z.toJSON():null),$.hidden??new Set)}function RX(Z,$,X,J,Y){let Q=Y&&Y.length>0?{query_by:[...Y].join(",")}:{},G={q:X,...Q,...J??{}},W={with(V){return G={...G,...V},W},where(V){return G={...G,filter:V},W},async get(){let{useSearchEngine:V}=await import("@stacksjs/search-engine");return(await V().search($,G))?.hits??[]},async paginate(V,B=1){let{useSearchEngine:H}=await import("@stacksjs/search-engine"),O=await H().search($,{...G,limit:V,offset:(B-1)*V});return{hits:O.hits??[],total:Number(O.estimatedTotalHits??O.nbHits??O.total??0),page:B,perPage:V}},async raw(){let{useSearchEngine:V}=await import("@stacksjs/search-engine");return await V().search($,G)}};return W}function y7(Z){let $=d(Z);return $===Z?[Z]:[Z,$]}async function M$(Z,$){if(!Z||typeof Z!=="object")return;let X=Z._attributes??Z;for(let J of $)for(let Y of y7(J)){if(!(Y in X))continue;let Q=X[Y];if(!K0(Q))continue;X[Y]=await f8(Q)}}function bX(Z,$){if($.length===0)return;let X=async(W)=>{if(Array.isArray(W)){for(let V of W)await M$(V,$);return W}if(W&&typeof W==="object"&&Array.isArray(W.data)){for(let V of W.data)await M$(V,$);return W}if(W)await M$(W,$);return W},J=["find","first","last","all","firstOrFail","findOrFail","findMany"];for(let W of J){let V=Z[W];if(typeof V!=="function")continue;Z[W]=async function(...B){let H=await V.apply(this,B);return await X(H)}}let Y=["create","firstOrCreate","updateOrCreate","make"];for(let W of Y){let V=Z[W];if(typeof V!=="function")continue;Z[W]=async function(...B){let H=await V.apply(this,B);return await X(H)}}for(let W of["update","forceUpdate"]){let V=Z[W];if(typeof V!=="function")continue;Z[W]=async function(B,H){let z=await V.call(this,B,H);return await X(z)}}let Q=["first","firstOrFail","get","all","find","findOrFail","last","paginate","simplePaginate"],G=(W)=>{if(!W||typeof W!=="object")return W;let V=W;if(V.__stacksEncryptedReads)return W;for(let B of Q){let H=V[B];if(typeof H!=="function")continue;V[B]=async function(...z){return await X(await H.apply(this,z))}}for(let B of["where","whereIn","whereNull","whereNotNull","orWhere","orderBy","orderByDesc","limit","offset","with"]){let H=V[B];if(typeof H!=="function")continue;V[B]=function(...z){return G(H.apply(this,z))}}return Object.defineProperty(V,"__stacksEncryptedReads",{value:!0,enumerable:!1}),W};for(let W of["where","whereIn","whereNull","whereNotNull","orderBy","orderByDesc","limit","query"]){let V=Z[W];if(typeof V!=="function")continue;Z[W]=function(...B){return G(V.apply(this,B))}}}function gX(Z,$){if($.length===0)return;let X=async(Y)=>{if(!Y||typeof Y!=="object"||Array.isArray(Y))return Y;let Q={...Y};for(let G of $)for(let W of y7(G))if(W in Q)Q[W]=await M8(Q[W]);return Q},J=["create","firstOrCreate","updateOrCreate","forceCreate"];for(let Y of J){let Q=Z[Y];if(typeof Q!=="function")continue;Z[Y]=async function(...G){if(G[0]=await X(G[0]),G[1])G[1]=await X(G[1]);return await Q.apply(this,G)}}for(let Y of["update","forceUpdate"]){let Q=Z[Y];if(typeof Q!=="function")continue;Z[Y]=async function(G,W){let V=await X(W);return await Q.call(this,G,V)}}}function uX(Z,$){let X=Z.create;if(typeof X==="function")Z.create=async function(J,...Y){$8($,J);let Q=await y$($,J);return await X.call(this,Q,...Y)};for(let J of["firstOrCreate","updateOrCreate"]){let Y=Z[J];if(typeof Y!=="function")continue}}function cX(Z,$){let X=String($?.name??Z.name??"Model"),J=(G,W)=>{if(AX())return;if(!G||typeof G!=="object"||Array.isArray(G))return;let V=t$(G,$,W);if(!V.valid)throw new j7(X,V.errors)},Y=Z.create;if(typeof Y==="function")Z.create=async function(G,...W){return J(G,"creating"),await Y.call(this,G,...W)};let Q=Z.update;if(typeof Q==="function")Z.update=async function(G,W,...V){return J(W,"updating"),await Q.call(this,G,W,...V)}}function mX(Z,$){let X=["create","firstOrCreate","updateOrCreate"];for(let Y of X){let Q=Z[Y];if(typeof Q==="function")Z[Y]=async function(...G){if(f.debug(`[orm] ${Y.charAt(0).toUpperCase()+Y.slice(1)} ${String(Z.name||"unknown")}`,G[0]),G[0]&&typeof G[0]==="object"&&!Array.isArray(G[0]))G[0]=L7(G[0],$,"set");return await Q.apply(this,G)}}let J=Z.update;if(typeof J==="function")Z.update=async function(Y,Q){let G=Q&&typeof Q==="object"&&!Array.isArray(Q)?L7(Q,$,"set"):Q;return await J.call(this,Y,G)}}function h7(Z){f.debug(`[orm] Defining model: ${Z.name} (table: ${Z.table})`);let $=lX(Z),X=nX(Z),J=dX($,X),Y=pX(Z);Z.__traitMethods=Y;let Q=J?{...Z,hooks:{...Z.hooks,...J}}:Z,W=LX(Q);if(SX(W,Z.casts),fX(W,Q),uX(W,Q),Z.casts&&Object.keys(Z.casts).length>0)mX(W,Z.casts);let V=y8(Z);if(V.length>0)gX(W,V),bX(W,V);let B=Z.traits?.useSoftDeletes;if(B)iX(W,Q,B);let H=Z.traits?.useAudit;if(H){let O=d$(H);n$(W,Z.name,Z.primaryKey||"id",O)}cX(W,Q),W.withoutValidation=function(O){return EX(O)},W.withoutEvents=function(O){return e(O)};for(let O of["create","update","firstOrCreate","updateOrCreate","forceCreate","forceUpdate","delete","forceDelete","softDelete","restore"]){let F=W[O];if(typeof F!=="function")continue;let w=`${O}Quietly`;if(typeof W[w]==="function")continue;W[w]=function(...T){return e(()=>F.apply(W,T))}}let z=Object.assign(W,Y,{...Z,getDefinition:()=>Z,_isStacksModel:!0});return DX(Z.name,z),Object.defineProperty(z,v$,{value:Z,enumerable:!1,configurable:!0}),z}function lX(Z){let $=Z.traits?.observe;if(!$)return;let X=Z.name.toLowerCase(),J=(O)=>{let F=O?.attributes;if(!F||typeof F!=="object")return O;let w=Z.primaryKey||"id",T={...F};if(T[w]===void 0&&O[w]!==void 0)T[w]=O[w];return T},Y=async(O,F)=>{if(Z0())return;try{let{dispatch:w}=await import("@stacksjs/events");await w(O,F)}catch(w){if(w&&typeof w==="object"&&"code"in w&&w.code==="MODULE_NOT_FOUND")return;if(console.error(`[ORM] Event '${O}' handler error:`,w),process.env.STACKS_ORM_EVENT_ERRORS!=="swallow")throw w}},Q=Z.traits?.broadcastOn,G=Z.traits?.broadcastWith,W=typeof Q==="function"&&typeof G==="function",V=async(O,F)=>{if(!W)return;if(Z0())return;try{let w=Q(F),T=Array.isArray(w)?w:[w],q=G(F),E=(await import("@stacksjs/realtime").catch(()=>null))?.broadcast;if(typeof E!=="function")return;for(let P of T){if(typeof P!=="string"||P.length===0)continue;await E(P,O,q)}}catch(w){if(w&&typeof w==="object"&&"code"in w&&w.code==="MODULE_NOT_FOUND")return;if(console.error(`[ORM] Broadcast '${O}' handler error:`,w),process.env.STACKS_ORM_BROADCAST_ERRORS==="throw")throw w}},B=async(O,F)=>{if(Z0())return!0;try{let{dispatchAsync:w}=await import("@stacksjs/events"),T=await w(O,F);if(Array.isArray(T)&&T.some((q)=>q===!1))return!1}catch(w){if(w&&typeof w==="object"&&"code"in w&&w.code==="MODULE_NOT_FOUND")return!0;if(console.error(`[ORM] Before-event '${O}' handler error:`,w),process.env.STACKS_ORM_EVENT_ERRORS!=="swallow")throw w}return!0},H=$===!0?["create","update","delete"]:Array.isArray($)?$:[],z={};if(H.includes("create"))z.beforeCreate=async(O)=>{if(f.debug(`[orm] Create ${X}`,O),!await B(`${X}:saving`,O))throw Error(`[ORM] ${X}:saving event cancelled the operation`);if(!await B(`${X}:creating`,O))throw Error(`[ORM] ${X}:creating event cancelled the operation`)},z.afterCreate=async(O)=>{let F=J(O);await Y(`${X}:created`,F),await Y(`${X}:saved`,F),await V(`${X}:created`,O)};if(H.includes("update"))z.beforeUpdate=async(O)=>{if(f.debug(`[orm] Update ${X}#${O?.id??"unknown"}`,O),!await B(`${X}:saving`,O))throw Error(`[ORM] ${X}:saving event cancelled the operation`);if(!await B(`${X}:updating`,O))throw Error(`[ORM] ${X}:updating event cancelled the operation`)},z.afterUpdate=async(O)=>{let F=J(O);await Y(`${X}:updated`,F),await Y(`${X}:saved`,F),await V(`${X}:updated`,O)};if(H.includes("delete"))z.beforeDelete=async(O)=>{if(f.debug(`[orm] Delete ${X}#${O?.id??"unknown"}`),!await B(`${X}:deleting`,O))throw Error(`[ORM] ${X}:deleting event cancelled the operation`)},z.afterDelete=async(O)=>{await Y(`${X}:deleted`,J(O)),await V(`${X}:deleted`,O)};return z}function dX(...Z){let $={},X=new Set;for(let J of Z){if(!J)continue;for(let Y of Object.keys(J))X.add(Y)}for(let J of X){let Y=Z.map((Q)=>Q?.[J]).filter((Q)=>typeof Q==="function");if(!Y.length)continue;$[J]=async(...Q)=>{for(let G of Y)await G(...Q)}}return Object.keys($).length?$:void 0}function v7(Z,$){if(!Z)return null;let X=Z===!0?{}:typeof Z==="object"?{...Z}:null;if(!X)return null;if($)X.hidden=yX($);return X}function nX(Z){let $=v7(Z.traits?.useSearch,Z);if(!$)return;let X=$,J=X.index??Z.table??d(`${Z.name}s`);async function Y(W){if(typeof X.shapeMany==="function")try{let[H]=await h$([W],X);return H}catch(H){f.warn(`[orm/search] shapeMany() threw for ${Z.name}: ${H.message}`);return}if(typeof X.shape==="function")try{return await X.shape(W)}catch(H){f.warn(`[orm/search] shape() threw for ${Z.name}: ${H.message}`);return}let B=R(W).toSearchableObject?.();if(B!==void 0)return B;return W?._attributes??(typeof W?.toJSON==="function"?W.toJSON():null)}let Q=async(W)=>{if(Z0())return;let V=await Y(W);if(!V)return;if($.queueable){try{let{Jobs:B}=await import("@stacksjs/queue");await B.dispatch("SyncSearchIndex",{index:J,op:"upsert",doc:V})}catch(B){f.warn(`[orm/search] queue dispatch failed for ${Z.name}; falling back to inline: ${B.message}`),await C7(J,V,Z.name)}return}await C7(J,V,Z.name)};return{afterCreate:Q,afterUpdate:Q,afterDelete:async(W)=>{if(Z0())return;let V=W?.id??W?._attributes?.id;if(V==null)return;if($.queueable){try{let{Jobs:B}=await import("@stacksjs/queue");await B.dispatch("SyncSearchIndex",{index:J,op:"delete",id:Number(V)})}catch(B){f.warn(`[orm/search] queue dispatch failed for ${Z.name}#${V}; falling back to inline: ${B.message}`),await P7(J,Number(V),Z.name)}return}await P7(J,Number(V),Z.name)}}}var E7=new Map;function R7(Z,$){let X=E7.get(Z)??0;if(E7.set(Z,X+1),X===0)f.warn(`[orm/search] ${$}`);else if(X===9)f.warn(`[orm/search] ${Z} is still failing; further identical warnings suppressed for this process.`)}async function C7(Z,$,X){try{let{useSearchEngine:J}=await import("@stacksjs/search-engine");await J().addDocument(Z,$)}catch(J){R7(`index:${X}`,`Failed to index ${X}: ${J.message}`)}}async function P7(Z,$,X){try{let{useSearchEngine:J}=await import("@stacksjs/search-engine");await J().deleteDocument(Z,$)}catch(J){R7(`remove:${X}`,`Failed to remove ${X}#${$}: ${J.message}`)}}function pX(Z){let $={},X=Z.table,J=Z.traits;if(!J)return $;if(J.taggable)$._taggable=c8(X);if(J.categorizable)$._categorizable=m8(X);if(J.commentable)$._commentable=g8(X);if(J.billable)$._billable=w7(X);if(J.likeable){let Q=typeof J.likeable==="object"?J.likeable:void 0;$._likeable=l8(X,Q)}let Y=J.useAuth||J.authenticatable;if(typeof Y==="object"&&Y&&"useTwoFactor"in Y&&Y.useTwoFactor)$._twoFactor=x7();return $}function iX(Z,$,X){let J=T7(Z,$.primaryKey||"id"),Y=U7(X),Q=$,G=$.name.toLowerCase(),W=$.traits?.observe!=null&&$.traits?.observe!==!1,V=async(F)=>{if(!W||Z0())return!0;try{let{dispatchAsync:w}=await import("@stacksjs/events"),T=await w(`${G}:restoring`,{id:F});if(Array.isArray(T)&&T.some((q)=>q===!1))return!1}catch(w){if(w?.code!=="MODULE_NOT_FOUND")console.error(`[ORM] Before-event '${G}:restoring' handler error:`,w)}return!0},B=async(F)=>{if(!W||Z0())return;try{let{dispatch:w}=await import("@stacksjs/events");await w(`${G}:restored`,{id:F})}catch(w){if(w?.code!=="MODULE_NOT_FOUND")console.error(`[ORM] Event '${G}:restored' handler error:`,w)}},H=process.env.STACKS_ORM_CASCADE_SWALLOW!=="true",z=async(F)=>{if(!Y.cascade?.length||!H){let T=await J.softDelete(F);if(T&&Y.cascade?.length)await Z8(Q,Y,F,"softDelete");return T}let{db:w}=await import("@stacksjs/database");return await w.transaction(async()=>{let T=await J.softDelete(F);if(T)await Z8(Q,Y,F,"softDelete");return T})},O=async(F)=>{if(!await V(F))return!1;if(!Y.cascade?.length||!H){let L=await J.restore(F);if(L){if(Y.cascade?.length)await Z8(Q,Y,F,"restore");await B(F)}return L}let{db:T}=await import("@stacksjs/database"),q=await T.transaction(async()=>{let L=await J.restore(F);if(L)await Z8(Q,Y,F,"restore");return L});if(q)await B(F);return q};Z.softDelete=z,Z.restore=O,Z.forceDelete=J.forceDelete,Z.withTrashed=J.withTrashed,Z.onlyTrashed=J.onlyTrashed,Z.delete=z}function rX(Z){if(Z==null)return Z;if(Array.isArray(Z))return Z.map(rX);if(typeof Z!=="object")return Z;if(typeof Z.toJSON==="function")return Z.toJSON();if(Z._attributes&&typeof Z._attributes==="object")return Z._attributes;return Z}var tX=["belongsTo","hasOne","hasMany","belongsToMany","morphMany","morphOne"],sX=["traits","dashboard"];function oX(Z){let $=Z?.[v$];if($&&typeof $==="object")return $;if(Z&&typeof Z==="object"&&"name"in Z&&"attributes"in Z)return Z;throw TypeError("extendModel() expects a model created by defineModel(), or a model definition. Import the framework model itself rather than its table name.")}function aX(Z,$){let X=Array.isArray(Z)?Z:[],J=Array.isArray($)?$:[];if(!X.length&&!J.length)return;return[...new Set([...X,...J])]}function eX(Z){if(!Z)return 0;return Object.values(Z).reduce(($,X)=>{let J=Number(X?.order);return Number.isFinite(J)&&J>$?J:$},0)}function ZJ(Z,$){let X={...Z,...$},J=Z.attributes??{},Y=$.attributes??{};if($.attributes){let Q=eX(J),G=Object.fromEntries(Object.entries(Y).map(([W,V])=>{let B=!(W in J),H=Number.isFinite(Number(V?.order));if(B&&!H)return[W,{...V,order:++Q}];return[W,V]}));X.attributes={...J,...G}}for(let Q of tX){let G=aX(Z[Q],$[Q]);if(G)X[Q]=G}for(let Q of sX){let G=Z[Q],W=$[Q];if(G&&W&&typeof G==="object"&&typeof W==="object")X[Q]={...G,...W}}return X}function wT(Z,$){return h7(ZJ(oX(Z),$))}import{log as $J}from"@stacksjs/logging";import{path as n}from"@stacksjs/path";import{fs as X8}from"@stacksjs/storage";function r(Z){return Z.replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase()}function XJ(Z){let $=Z.default;if(typeof $==="boolean")return"boolean";if(typeof $==="number")return"number";if(typeof $==="string")return"string";return"unknown"}function JJ(Z){let $=Z.validation;if(!$||typeof $!=="object")return null;let X=$.rule;return X&&typeof X==="object"?X:null}function YJ(Z){if(!Z||String(Z.name??"")!=="enum")return null;let X=(Array.isArray(Z.allowedValues)?Z.allowedValues:[]).filter((J)=>typeof J==="string"||typeof J==="number").map((J)=>typeof J==="number"?String(J):JSON.stringify(J));return X.length>0?X.join(" | "):null}function QJ(Z){let $=JJ(Z),X=YJ($);if(X!==null)return Z.nullable===!0?`${X} | null`:X;let J=typeof Z.type==="string"?Z.type.toLowerCase():String($?.name??"").toLowerCase(),Y=(()=>{switch(J){case"string":case"text":case"longtext":case"mediumtext":case"tinytext":case"char":case"varchar":case"enum":case"uuid":case"date":case"datetime":case"timestamp":case"timestamptz":case"password":case"time":case"year":return"string";case"number":case"integer":case"int":case"tinyint":case"smallint":case"mediumint":case"float":case"double":case"decimal":case"numeric":return"number";case"bigint":return"number | bigint";case"boolean":case"bool":return"boolean";case"json":case"jsonb":return"unknown";case"binary":case"blob":case"bytea":return"Uint8Array";case"unix":return"number";case"array":return"unknown[]";case"object":return"Record<string, unknown>";default:return XJ(Z)}})();return Z.nullable===!0?`${Y} | null`:Y}function GJ(Z){let $={},X=Z.belongsTo;if(!X)return $;let J=Array.isArray(X)?X:Object.values(X);for(let Y of J){if(typeof Y==="string"){$[`${r(Y)}_id`]="number";continue}if(Y&&typeof Y==="object"){let Q=Y;if(typeof Q.foreignKey==="string"){$[Q.foreignKey]="number";continue}if(typeof Q.model==="string")$[`${r(Q.model)}_id`]="number"}}return $}function WJ(Z,$){let[X,J]=[r(Z),r($)].sort();return`${X}_${J}`}function BJ(Z){let $=Z.default,X=typeof $==="string"?"string":typeof $==="number"?"number":typeof $==="boolean"?"boolean":$ instanceof Date?"string":"unknown";return Z.nullable?`${X} | null`:X}function VJ(Z,$){let X=$.belongsToMany;if(!X)return[];let J=[],Y=Array.isArray(X)?X:Object.values(X);for(let Q of Y){let G,W,V,B,H={},z=!0;if(typeof Q==="string")G=Q;else if(Q&&typeof Q==="object"&&"model"in Q){let q=Q;if(G=q.model,"pivotTable"in q||"firstForeignKey"in q||"secondForeignKey"in q)W=q.pivotTable,V=q.firstForeignKey,B=q.secondForeignKey;else{let L=Q;W=L.table,V=L.foreignKey,B=L.relatedKey,H=L.pivot?.columns??{},z=Boolean(L.pivot?.timestamps)}}else continue;let O=W??WJ(Z,G),F=V??`${r(Z)}_id`,w=B??`${r(G)}_id`,T={id:"number",[F]:"number",[w]:"number"};for(let[q,L]of Object.entries(H))T[q]=BJ(L);if(z)T.created_at="string",T.updated_at="string | null";J.push({table:O,columns:T})}return J}var KJ={email_verified_at:"string | null",password_changed_at:"string | null",two_factor_secret:"string | null",two_factor_enabled:"boolean | null",two_factor_last_used_step:"number | null",stripe_id:"string | null"};function HJ(Z){let $={id:"number"},X=Z.traits??{};if(X.useUuid)$.uuid="string";if((X.useTimestamps??X.timestampable)!==!1)$.created_at="string",$.updated_at="string | null";if(X.useSoftDeletes??X.softDeletable)$.deleted_at="string | null";if((Z.table??"")==="users"||Z.name==="User")Object.assign($,KJ);return $}function zJ(Z){let $={},X=Z.attributes??{};for(let[J,Y]of Object.entries(X))$[r(J)]=QJ(Y);return $}function OJ(Z){return Z.replace(/_([a-z0-9])/g,($,X)=>X.toUpperCase())}function _J(Z){let $={...Z};for(let[X,J]of Object.entries(Z)){let Y=OJ(X);if(Y!==X&&!(Y in $))$[Y]=J}return $}function b7(Z,$,X=2){let J=" ".repeat(X),Y=" ".repeat(X+1),Q=Object.entries($).map(([W,V])=>`${Y}${W}: ${V}`).join(`
|
|
16
16
|
`),G=/^[A-Z_a-z]\w*$/.test(Z)?Z:`'${Z}'`;return`${J}${G}: {
|
|
17
17
|
${Y}// columns
|
|
18
18
|
${Q}
|
|
@@ -32,4 +32,4 @@ export {}
|
|
|
32
32
|
`),O=`${g7(B)}${z}
|
|
33
33
|
${u7(B)}`;if(!Z.dryRun){let F=n.dirname(J);if(!X8.existsSync(F))X8.mkdirSync(F,{recursive:!0});X8.writeFileSync(J,O,"utf-8"),$J.success(`[generate:db-types] wrote ${W.length} table(s) to ${J}`)}return{outFile:J,tables:W,errors:Y,content:O}}function qJ(Z,$="app"){let X=[...Z].sort((J,Y)=>J.table.localeCompare(Y.table)).map((J)=>b7(J.table,J.columns,$==="framework"?1:2)).join(`
|
|
34
34
|
`);return`${g7($)}${X}
|
|
35
|
-
${u7($)}`}import{configureOrm as LJ}from"@stacksjs/query-builder";function DJ(){try{let Z=process.env.DB_DATABASE_PATH||"database/stacks.sqlite";if((process.env.DB_CONNECTION||"sqlite")==="sqlite")LJ({database:Z})}catch{}}DJ();async function m7(Z){for(let $=0;;$++){let X=await import(Z);try{return X.default}catch(J){if($<5&&J instanceof ReferenceError&&/before initialization/.test(J.message)){await new Promise((Y)=>setTimeout(Y,0));continue}throw J}}}async function I8(Z,$=[""]){let{path:X}=await import("@stacksjs/path"),J=X.userModelsPath(`${Z}.ts`);try{if(await Bun.file(J).exists())return await m7(J)}catch(Y){console.error(`[orm] Failed to import userland model ${Z} from ${J} \u2014 falling back to framework default. Reason:`,Y)}for(let Y of $){let Q=Y?`${Y}/`:"",G=X.frameworkPath(`defaults/app/Models/${Q}${Z}.ts`);try{if(await Bun.file(G).exists())return await m7(G)}catch(W){console.error(`[orm] Failed to import framework default model ${Z} from ${G} \u2014 trying next subdir. Reason:`,W)}}return null}var t={},l7=()=>{},ET=new Promise((Z)=>{l7=Z});function U(Z){return new Proxy(function(){},{get($,X){if(X==="then")return;let J=t[Z];if(J==null)return;let Y=J[X];return typeof Y==="function"?Y.bind(J):Y},set($,X,J){let Y=t[Z];if(Y==null)return!1;return Y[X]=J,!0},has($,X){let J=t[Z];return J==null?!1:(X in J)},apply($,X,J){let Y=t[Z];if(Y==null||typeof Y!=="function")return;return Y.apply(X,J)}})}var AJ=U("User"),EJ=U("Job"),CJ=U("FailedJob"),PJ=[["Team",[""],"auth"],["TeamInvitation",[""],"auth"],["TeamMember",[""],"auth"],["SocialAccount",[""],"auth"],["Subscriber",[""],"auth"],["SubscriberEmail",[""],"auth"],["Subscription",[""],"auth"],["Post",["Content"],"cms"],["Page",["Content"],"cms"],["PageRevision",["Content"],"cms"],["Redirect",["Content"],"cms"],["Menu",["Content"],"cms"],["MenuItem",["Content"],"cms"],["Author",["Content"],"cms"],["Comment",[""],"cms"],["Tag",[""],"cms"],["Site",[""],"auth"],["SiteDomain",[""],"auth"],["MagicLinkToken",[""],"auth"],["SmsOptOut",[""],"auth"],["Form",["Forms"],"forms"],["FormField",["Forms"],"forms"],["FormSubmission",["Forms"],"forms"],["Activity",[""],"dashboard"],["Board",[""],"dashboard"],["BoardColumn",[""],"dashboard"],["Card",[""],"dashboard"],["CardComment",[""],"dashboard"],["Deployment",[""],"dashboard"],["Label",[""],"dashboard"],["Release",[""],"dashboard"],["Notification",[""],"dashboard"],["NotificationDelivery",[""],"dashboard"],["MailPreference",[""],"dashboard"],["Log",[""],"dashboard"],["Request",[""],"dashboard"],["AnalyticsEvent",[""],"dashboard"],["QueryLog",[""],"dashboard"],["Error",[""],"monitoring"],["Websocket",["realtime"],"realtime"],["Campaign",[""],"marketing"],["CampaignSend",[""],"marketing"],["EmailList",[""],"marketing"],["EmailListSubscriber",[""],"marketing"],["EmailIdempotency",[""],"marketing"],["EmailSuppression",[""],"marketing"],["EmailWebhookEvent",[""],"marketing"],["SocialPost",[""],"marketing"],["Automation",[""],"marketing"],["AutomationRun",[""],"marketing"],["CampaignVariant",[""],"marketing"],["CommunicationSuppression",[""],"marketing"],["ConsentEvent",[""],"marketing"],["SenderDomain",[""],"marketing"],["UsageEvent",[""],"marketing"],["PaymentMethod",[""],"commerce"],["PaymentProduct",[""],"commerce"],["PaymentTransaction",[""],"commerce"],["Order",["commerce"],"commerce"],["OrderIdempotency",["commerce"],"commerce"],["OrderItem",["commerce"],"commerce"],["Cart",["commerce"],"commerce"],["CartItem",["commerce"],"commerce"],["Customer",["commerce"],"commerce"],["Product",["commerce"],"commerce"],["ProductVariant",["commerce"],"commerce"],["ProductUnit",["commerce"],"commerce"],["Manufacturer",["commerce"],"commerce"],["Category",["commerce"],"commerce"],["Coupon",["commerce"],"commerce"],["GiftCard",["commerce"],"commerce"],["LicenseKey",["commerce"],"commerce"],["Review",["commerce"],"commerce"],["Receipt",["commerce"],"commerce"],["PrintDevice",["commerce"],"commerce"],["ShippingMethod",["commerce"],"commerce"],["ShippingRate",["commerce"],"commerce"],["ShippingZone",["commerce"],"commerce"],["DeliveryRoute",["commerce"],"commerce"],["DeliveryStop",["commerce"],"commerce"],["DigitalDelivery",["commerce"],"commerce"],["Driver",["commerce"],"commerce"],["DriverPing",["commerce"],"commerce"],["TaxRate",["commerce"],"commerce"],["WaitlistProduct",["commerce"],"commerce"],["WaitlistRestaurant",["commerce"],"commerce"],["Auction",["commerce"],"commerce"],["AuctionItem",["commerce"],"commerce"],["Bid",["commerce"],"commerce"],["Pledge",["commerce"],"commerce"],["LoyaltyPoint",["commerce"],"commerce"],["LoyaltyReward",["commerce"],"commerce"],["Payment",["commerce"],"commerce"],["Transaction",["commerce"],"commerce"]];queueMicrotask(async()=>{try{let{feature:Z}=await import("@stacksjs/config"),$=await I8("User");if($)t.User=$;if(Z("queue")){let X=await I8("Job");if(X)t.Job=X;let J=await I8("FailedJob");if(J)t.FailedJob=J}for(let[X,J,Y]of PJ){if(!Z(Y))continue;let Q=await I8(X,J);if(Q)t[X]=Q}}catch(Z){console.error("[orm] deferred model load failed:",Z)}finally{l7()}});var NJ=U("Activity"),kJ=U("AnalyticsEvent"),IJ=U("Automation"),jJ=U("AutomationRun"),SJ=U("Auction"),MJ=U("CampaignVariant"),fJ=U("CommunicationSuppression"),yJ=U("ConsentEvent"),hJ=U("SenderDomain"),vJ=U("UsageEvent"),RJ=U("AuctionItem"),bJ=U("Author"),gJ=U("Bid"),uJ=U("Board"),cJ=U("BoardColumn"),mJ=U("Campaign"),lJ=U("Card"),dJ=U("CardComment"),nJ=U("Cart"),pJ=U("CartItem"),iJ=U("Category"),rJ=U("Comment"),tJ=U("Coupon"),sJ=U("Customer"),oJ=U("DeliveryRoute"),aJ=U("DeliveryStop"),eJ=U("Deployment"),Z3=U("DigitalDelivery"),$3=U("Driver"),X3=U("DriverPing"),J3=U("CampaignSend"),Y3=U("EmailList"),Q3=U("EmailListSubscriber"),G3=U("Form"),W3=U("FormField"),B3=U("FormSubmission"),V3=U("MagicLinkToken"),K3=U("Menu"),H3=U("MenuItem"),z3=U("PageRevision"),O3=U("Pledge"),_3=U("Redirect"),F3=U("Site"),w3=U("SiteDomain"),x3=U("SmsOptOut"),T3=U("EmailIdempotency"),U3=U("EmailSuppression"),q3=U("EmailWebhookEvent"),L3=U("Error"),D3=U("GiftCard"),A3=U("Label"),E3=U("LicenseKey"),C3=U("Log"),P3=U("LoyaltyPoint"),N3=U("LoyaltyReward"),k3=U("MailPreference"),I3=U("Manufacturer"),j3=U("Notification"),S3=U("NotificationDelivery"),M3=U("Order"),f3=U("OrderIdempotency"),y3=U("OrderItem"),h3=U("Page"),v3=U("Payment"),R3=U("PaymentMethod"),b3=U("PaymentProduct"),g3=U("PaymentTransaction"),u3=U("Post"),c3=U("PrintDevice"),m3=U("Product"),l3=U("ProductUnit"),d3=U("ProductVariant"),n3=U("QueryLog"),p3=U("Receipt"),i3=U("Release"),r3=U("Request"),t3=U("Review"),s3=U("ShippingMethod"),o3=U("ShippingRate"),a3=U("ShippingZone"),e3=U("SocialPost"),ZY=U("SocialAccount"),$Y=U("Subscriber"),XY=U("SubscriberEmail"),JY=U("Subscription"),YY=U("Tag"),QY=U("TaxRate"),GY=U("Team"),WY=U("TeamInvitation"),BY=U("TeamMember"),VY=U("Transaction"),KY=U("WaitlistProduct"),HY=U("WaitlistRestaurant"),zY=U("Websocket"),OY={User:AJ,Job:EJ,FailedJob:CJ,Activity:NJ,AnalyticsEvent:kJ,Automation:IJ,AutomationRun:jJ,Auction:SJ,AuctionItem:RJ,Author:bJ,Bid:gJ,Board:uJ,BoardColumn:cJ,Campaign:mJ,CampaignSend:J3,CampaignVariant:MJ,Card:lJ,CardComment:dJ,Cart:nJ,CartItem:pJ,Category:iJ,Comment:rJ,Coupon:tJ,Customer:sJ,CommunicationSuppression:fJ,ConsentEvent:yJ,DeliveryRoute:oJ,DeliveryStop:aJ,Deployment:eJ,DigitalDelivery:Z3,Driver:$3,DriverPing:X3,EmailList:Y3,EmailListSubscriber:Q3,EmailIdempotency:T3,EmailSuppression:U3,EmailWebhookEvent:q3,ErrorModel:L3,Form:G3,FormField:W3,FormSubmission:B3,GiftCard:D3,Label:A3,LicenseKey:E3,Log:C3,LoyaltyPoint:P3,LoyaltyReward:N3,MailPreference:k3,Manufacturer:I3,Notification:j3,MagicLinkToken:V3,Menu:K3,MenuItem:H3,NotificationDelivery:S3,Order:M3,OrderIdempotency:f3,OrderItem:y3,Page:h3,PageRevision:z3,Payment:v3,PaymentMethod:R3,PaymentProduct:b3,PaymentTransaction:g3,Pledge:O3,Post:u3,PrintDevice:c3,Product:m3,ProductUnit:l3,ProductVariant:d3,QueryLog:n3,Receipt:p3,Release:i3,Request:r3,Review:t3,ShippingMethod:s3,Redirect:_3,SenderDomain:hJ,ShippingRate:o3,ShippingZone:a3,Site:F3,SiteDomain:w3,SmsOptOut:x3,SocialAccount:ZY,SocialPost:e3,Subscriber:$Y,SubscriberEmail:XY,Subscription:JY,Tag:YY,TaxRate:QY,Team:GY,TeamInvitation:WY,TeamMember:BY,Transaction:VY,UsageEvent:vJ,WaitlistProduct:KY,WaitlistRestaurant:HY,Websocket:zY},B0=globalThis;for(let[Z,$]of Object.entries(OY))if($&&B0[Z]===void 0)B0[Z]=$;async function _Y(Z){if(!Z)return[];try{if(typeof Z.all==="function"){let $=await Z.all();return Array.isArray($)?$:[]}if(typeof Z.get==="function"){let $=await Z.get();return Array.isArray($)?$:[]}}catch{}return[]}function FY(Z,$,X=""){if(!Z)return X;try{if(typeof Z.get==="function"){let Y=Z.get($);if(Y!==void 0&&Y!==null)return Y}}catch{}let J=Z?.[$];return J!==void 0&&J!==null?J:X}if(B0.safeAll===void 0)B0.safeAll=_Y;if(B0.safeGet===void 0)B0.safeGet=FY;export{EX as withoutValidation,e as withoutEvents,QQ as transactional,JQ as transaction,EQ as toTimestamp,O2 as toSnakeCaseKeys,o8 as toSimplePaginator,s8 as toPaginator,a8 as toCursorPaginator,rX as toAttrs,X2 as setAuditUser,YQ as savepoint,Z9 as resolvePageArgs,$9 as resolveCursorArgs,qJ as renderDatabaseTypeFile,r7 as prunable,h$ as projectDocumentsFromTrait,J5 as parseCursor,ET as ormReady,HQ as modelTableName,ZJ as mergeModelDefinition,UY as massPrunable,z2 as mapWriteError,LQ as mapEntity,r$ as isUniqueViolation,M2 as isSimplePaginator,S2 as isPaginator,K0 as isEncrypted,f2 as isCursorPaginator,zQ as hasRelations,_2 as getWritableFields,b as getTableName,N2 as getRelations,OQ as getRelationType,_Q as getRelationCount,qY as getPrunableConfig,FQ as getPivotTables,P2 as getPivotTableName,F0 as getModelName,xQ as getHiddenAttributes,TQ as getGuardedAttributes,UQ as getFillableAttributes,DQ as formatDate,r8 as findUserModel,i8 as findCoreModel,F2 as filterFillable,wQ as fetchOtherModelRelations,qQ as extractFields,AQ as extractDate,wT as extendModel,X9 as enrichPaginatorUrls,M8 as encryptValue,h7 as defineModel,f8 as decryptValue,ZQ as db,c8 as createTaggableMethods,l8 as createLikeableMethods,g8 as createCommentableMethods,m8 as createCategorizableMethods,l$ as createAuditMethods,y8 as collectEncryptedAttributes,UJ as buildDatabaseSchema,sY as batchLoad,zY as Websocket,HY as WaitlistRestaurant,KY as WaitlistProduct,AJ as User,vJ as UsageEvent,VY as Transaction,BY as TeamMember,WY as TeamInvitation,GY as Team,QY as TaxRate,YY as Tag,JY as Subscription,XY as SubscriberEmail,$Y as Subscriber,E2 as SubqueryBuilder,e3 as SocialPost,ZY as SocialAccount,x3 as SmsOptOut,w3 as SiteDomain,F3 as Site,a3 as ShippingZone,o3 as ShippingRate,s3 as ShippingMethod,hJ as SenderDomain,t3 as Review,r3 as Request,i3 as Release,_3 as Redirect,p3 as Receipt,n3 as QueryLog,d3 as ProductVariant,l3 as ProductUnit,m3 as Product,c3 as PrintDevice,u3 as Post,O3 as Pledge,g3 as PaymentTransaction,b3 as PaymentProduct,R3 as PaymentMethod,v3 as Payment,z3 as PageRevision,h3 as Page,y3 as OrderItem,f3 as OrderIdempotency,M3 as Order,S3 as NotificationDelivery,j3 as Notification,j7 as ModelValidationError,f7 as ModelNotFoundError,H3 as MenuItem,K3 as Menu,f$ as MassAssignmentException,I3 as Manufacturer,k3 as MailPreference,V3 as MagicLinkToken,v$ as MODEL_DEFINITION,N3 as LoyaltyReward,P3 as LoyaltyPoint,C3 as Log,E3 as LicenseKey,A3 as Label,EJ as Job,D3 as GiftCard,B3 as FormSubmission,W3 as FormField,G3 as Form,CJ as FailedJob,L3 as ErrorModel,q3 as EmailWebhookEvent,U3 as EmailSuppression,Q3 as EmailListSubscriber,Y3 as EmailList,T3 as EmailIdempotency,X3 as DriverPing,$3 as Driver,Z3 as DigitalDelivery,eJ as Deployment,aJ as DeliveryStop,oJ as DeliveryRoute,sJ as Customer,tJ as Coupon,yJ as ConsentEvent,fJ as CommunicationSuppression,rJ as Comment,iJ as Category,pJ as CartItem,nJ as Cart,dJ as CardComment,lJ as Card,MJ as CampaignVariant,J3 as CampaignSend,mJ as Campaign,cJ as BoardColumn,uJ as Board,gJ as Bid,jJ as AutomationRun,IJ as Automation,bJ as Author,RJ as AuctionItem,SJ as Auction,kJ as AnalyticsEvent,NJ as Activity};
|
|
35
|
+
${u7($)}`}import{configureOrm as LJ}from"@stacksjs/query-builder";function DJ(){try{let Z=process.env.DB_DATABASE_PATH||"database/stacks.sqlite";if((process.env.DB_CONNECTION||"sqlite")==="sqlite")LJ({database:Z})}catch{}}DJ();async function m7(Z){for(let $=0;;$++){let X=await import(Z);try{return X.default}catch(J){if($<5&&J instanceof ReferenceError&&/before initialization/.test(J.message)){await new Promise((Y)=>setTimeout(Y,0));continue}throw J}}}async function I8(Z,$=[""]){let{path:X}=await import("@stacksjs/path"),J=X.userModelsPath(`${Z}.ts`);try{if(await Bun.file(J).exists())return await m7(J)}catch(Y){console.error(`[orm] Failed to import userland model ${Z} from ${J} - falling back to framework default. Reason:`,Y)}for(let Y of $){let Q=Y?`${Y}/`:"",G=X.frameworkPath(`defaults/app/Models/${Q}${Z}.ts`);try{if(await Bun.file(G).exists())return await m7(G)}catch(W){console.error(`[orm] Failed to import framework default model ${Z} from ${G} - trying next subdir. Reason:`,W)}}return null}var t={},l7=()=>{},ET=new Promise((Z)=>{l7=Z});function U(Z){return new Proxy(function(){},{get($,X){if(X==="then")return;let J=t[Z];if(J==null)return;let Y=J[X];return typeof Y==="function"?Y.bind(J):Y},set($,X,J){let Y=t[Z];if(Y==null)return!1;return Y[X]=J,!0},has($,X){let J=t[Z];return J==null?!1:(X in J)},apply($,X,J){let Y=t[Z];if(Y==null||typeof Y!=="function")return;return Y.apply(X,J)}})}var AJ=U("User"),EJ=U("Job"),CJ=U("FailedJob"),PJ=[["Team",[""],"auth"],["TeamInvitation",[""],"auth"],["TeamMember",[""],"auth"],["SocialAccount",[""],"auth"],["Subscriber",[""],"auth"],["SubscriberEmail",[""],"auth"],["Subscription",[""],"auth"],["Post",["Content"],"cms"],["Page",["Content"],"cms"],["PageRevision",["Content"],"cms"],["Redirect",["Content"],"cms"],["Menu",["Content"],"cms"],["MenuItem",["Content"],"cms"],["Author",["Content"],"cms"],["Comment",[""],"cms"],["Tag",[""],"cms"],["Site",[""],"auth"],["SiteDomain",[""],"auth"],["MagicLinkToken",[""],"auth"],["SmsOptOut",[""],"auth"],["Form",["Forms"],"forms"],["FormField",["Forms"],"forms"],["FormSubmission",["Forms"],"forms"],["Activity",[""],"dashboard"],["Board",[""],"dashboard"],["BoardColumn",[""],"dashboard"],["Card",[""],"dashboard"],["CardComment",[""],"dashboard"],["Deployment",[""],"dashboard"],["Label",[""],"dashboard"],["Release",[""],"dashboard"],["Notification",[""],"dashboard"],["NotificationDelivery",[""],"dashboard"],["MailPreference",[""],"dashboard"],["Log",[""],"dashboard"],["Request",[""],"dashboard"],["AnalyticsEvent",[""],"dashboard"],["QueryLog",[""],"dashboard"],["Error",[""],"monitoring"],["Websocket",["realtime"],"realtime"],["Campaign",[""],"marketing"],["CampaignSend",[""],"marketing"],["EmailList",[""],"marketing"],["EmailListSubscriber",[""],"marketing"],["EmailIdempotency",[""],"marketing"],["EmailSuppression",[""],"marketing"],["EmailWebhookEvent",[""],"marketing"],["SocialPost",[""],"marketing"],["Automation",[""],"marketing"],["AutomationRun",[""],"marketing"],["CampaignVariant",[""],"marketing"],["CommunicationSuppression",[""],"marketing"],["ConsentEvent",[""],"marketing"],["SenderDomain",[""],"marketing"],["UsageEvent",[""],"marketing"],["PaymentMethod",[""],"commerce"],["PaymentProduct",[""],"commerce"],["PaymentTransaction",[""],"commerce"],["Order",["commerce"],"commerce"],["OrderIdempotency",["commerce"],"commerce"],["OrderItem",["commerce"],"commerce"],["Cart",["commerce"],"commerce"],["CartItem",["commerce"],"commerce"],["Customer",["commerce"],"commerce"],["Product",["commerce"],"commerce"],["ProductVariant",["commerce"],"commerce"],["ProductUnit",["commerce"],"commerce"],["Manufacturer",["commerce"],"commerce"],["Category",["commerce"],"commerce"],["Coupon",["commerce"],"commerce"],["GiftCard",["commerce"],"commerce"],["LicenseKey",["commerce"],"commerce"],["Review",["commerce"],"commerce"],["Receipt",["commerce"],"commerce"],["PrintDevice",["commerce"],"commerce"],["ShippingMethod",["commerce"],"commerce"],["ShippingRate",["commerce"],"commerce"],["ShippingZone",["commerce"],"commerce"],["DeliveryRoute",["commerce"],"commerce"],["DeliveryStop",["commerce"],"commerce"],["DigitalDelivery",["commerce"],"commerce"],["Driver",["commerce"],"commerce"],["DriverPing",["commerce"],"commerce"],["TaxRate",["commerce"],"commerce"],["WaitlistProduct",["commerce"],"commerce"],["WaitlistRestaurant",["commerce"],"commerce"],["Auction",["commerce"],"commerce"],["AuctionItem",["commerce"],"commerce"],["Bid",["commerce"],"commerce"],["Pledge",["commerce"],"commerce"],["LoyaltyPoint",["commerce"],"commerce"],["LoyaltyReward",["commerce"],"commerce"],["Payment",["commerce"],"commerce"],["Transaction",["commerce"],"commerce"]];queueMicrotask(async()=>{try{let{feature:Z}=await import("@stacksjs/config"),$=await I8("User");if($)t.User=$;if(Z("queue")){let X=await I8("Job");if(X)t.Job=X;let J=await I8("FailedJob");if(J)t.FailedJob=J}for(let[X,J,Y]of PJ){if(!Z(Y))continue;let Q=await I8(X,J);if(Q)t[X]=Q}}catch(Z){console.error("[orm] deferred model load failed:",Z)}finally{l7()}});var NJ=U("Activity"),kJ=U("AnalyticsEvent"),IJ=U("Automation"),jJ=U("AutomationRun"),SJ=U("Auction"),MJ=U("CampaignVariant"),fJ=U("CommunicationSuppression"),yJ=U("ConsentEvent"),hJ=U("SenderDomain"),vJ=U("UsageEvent"),RJ=U("AuctionItem"),bJ=U("Author"),gJ=U("Bid"),uJ=U("Board"),cJ=U("BoardColumn"),mJ=U("Campaign"),lJ=U("Card"),dJ=U("CardComment"),nJ=U("Cart"),pJ=U("CartItem"),iJ=U("Category"),rJ=U("Comment"),tJ=U("Coupon"),sJ=U("Customer"),oJ=U("DeliveryRoute"),aJ=U("DeliveryStop"),eJ=U("Deployment"),Z3=U("DigitalDelivery"),$3=U("Driver"),X3=U("DriverPing"),J3=U("CampaignSend"),Y3=U("EmailList"),Q3=U("EmailListSubscriber"),G3=U("Form"),W3=U("FormField"),B3=U("FormSubmission"),V3=U("MagicLinkToken"),K3=U("Menu"),H3=U("MenuItem"),z3=U("PageRevision"),O3=U("Pledge"),_3=U("Redirect"),F3=U("Site"),w3=U("SiteDomain"),x3=U("SmsOptOut"),T3=U("EmailIdempotency"),U3=U("EmailSuppression"),q3=U("EmailWebhookEvent"),L3=U("Error"),D3=U("GiftCard"),A3=U("Label"),E3=U("LicenseKey"),C3=U("Log"),P3=U("LoyaltyPoint"),N3=U("LoyaltyReward"),k3=U("MailPreference"),I3=U("Manufacturer"),j3=U("Notification"),S3=U("NotificationDelivery"),M3=U("Order"),f3=U("OrderIdempotency"),y3=U("OrderItem"),h3=U("Page"),v3=U("Payment"),R3=U("PaymentMethod"),b3=U("PaymentProduct"),g3=U("PaymentTransaction"),u3=U("Post"),c3=U("PrintDevice"),m3=U("Product"),l3=U("ProductUnit"),d3=U("ProductVariant"),n3=U("QueryLog"),p3=U("Receipt"),i3=U("Release"),r3=U("Request"),t3=U("Review"),s3=U("ShippingMethod"),o3=U("ShippingRate"),a3=U("ShippingZone"),e3=U("SocialPost"),ZY=U("SocialAccount"),$Y=U("Subscriber"),XY=U("SubscriberEmail"),JY=U("Subscription"),YY=U("Tag"),QY=U("TaxRate"),GY=U("Team"),WY=U("TeamInvitation"),BY=U("TeamMember"),VY=U("Transaction"),KY=U("WaitlistProduct"),HY=U("WaitlistRestaurant"),zY=U("Websocket"),OY={User:AJ,Job:EJ,FailedJob:CJ,Activity:NJ,AnalyticsEvent:kJ,Automation:IJ,AutomationRun:jJ,Auction:SJ,AuctionItem:RJ,Author:bJ,Bid:gJ,Board:uJ,BoardColumn:cJ,Campaign:mJ,CampaignSend:J3,CampaignVariant:MJ,Card:lJ,CardComment:dJ,Cart:nJ,CartItem:pJ,Category:iJ,Comment:rJ,Coupon:tJ,Customer:sJ,CommunicationSuppression:fJ,ConsentEvent:yJ,DeliveryRoute:oJ,DeliveryStop:aJ,Deployment:eJ,DigitalDelivery:Z3,Driver:$3,DriverPing:X3,EmailList:Y3,EmailListSubscriber:Q3,EmailIdempotency:T3,EmailSuppression:U3,EmailWebhookEvent:q3,ErrorModel:L3,Form:G3,FormField:W3,FormSubmission:B3,GiftCard:D3,Label:A3,LicenseKey:E3,Log:C3,LoyaltyPoint:P3,LoyaltyReward:N3,MailPreference:k3,Manufacturer:I3,Notification:j3,MagicLinkToken:V3,Menu:K3,MenuItem:H3,NotificationDelivery:S3,Order:M3,OrderIdempotency:f3,OrderItem:y3,Page:h3,PageRevision:z3,Payment:v3,PaymentMethod:R3,PaymentProduct:b3,PaymentTransaction:g3,Pledge:O3,Post:u3,PrintDevice:c3,Product:m3,ProductUnit:l3,ProductVariant:d3,QueryLog:n3,Receipt:p3,Release:i3,Request:r3,Review:t3,ShippingMethod:s3,Redirect:_3,SenderDomain:hJ,ShippingRate:o3,ShippingZone:a3,Site:F3,SiteDomain:w3,SmsOptOut:x3,SocialAccount:ZY,SocialPost:e3,Subscriber:$Y,SubscriberEmail:XY,Subscription:JY,Tag:YY,TaxRate:QY,Team:GY,TeamInvitation:WY,TeamMember:BY,Transaction:VY,UsageEvent:vJ,WaitlistProduct:KY,WaitlistRestaurant:HY,Websocket:zY},B0=globalThis;for(let[Z,$]of Object.entries(OY))if($&&B0[Z]===void 0)B0[Z]=$;async function _Y(Z){if(!Z)return[];try{if(typeof Z.all==="function"){let $=await Z.all();return Array.isArray($)?$:[]}if(typeof Z.get==="function"){let $=await Z.get();return Array.isArray($)?$:[]}}catch{}return[]}function FY(Z,$,X=""){if(!Z)return X;try{if(typeof Z.get==="function"){let Y=Z.get($);if(Y!==void 0&&Y!==null)return Y}}catch{}let J=Z?.[$];return J!==void 0&&J!==null?J:X}if(B0.safeAll===void 0)B0.safeAll=_Y;if(B0.safeGet===void 0)B0.safeGet=FY;export{EX as withoutValidation,e as withoutEvents,QQ as transactional,JQ as transaction,EQ as toTimestamp,O2 as toSnakeCaseKeys,o8 as toSimplePaginator,s8 as toPaginator,a8 as toCursorPaginator,rX as toAttrs,X2 as setAuditUser,YQ as savepoint,Z9 as resolvePageArgs,$9 as resolveCursorArgs,qJ as renderDatabaseTypeFile,r7 as prunable,h$ as projectDocumentsFromTrait,J5 as parseCursor,ET as ormReady,HQ as modelTableName,ZJ as mergeModelDefinition,UY as massPrunable,z2 as mapWriteError,LQ as mapEntity,r$ as isUniqueViolation,M2 as isSimplePaginator,S2 as isPaginator,K0 as isEncrypted,f2 as isCursorPaginator,zQ as hasRelations,_2 as getWritableFields,b as getTableName,N2 as getRelations,OQ as getRelationType,_Q as getRelationCount,qY as getPrunableConfig,FQ as getPivotTables,P2 as getPivotTableName,F0 as getModelName,xQ as getHiddenAttributes,TQ as getGuardedAttributes,UQ as getFillableAttributes,DQ as formatDate,r8 as findUserModel,i8 as findCoreModel,F2 as filterFillable,wQ as fetchOtherModelRelations,qQ as extractFields,AQ as extractDate,wT as extendModel,X9 as enrichPaginatorUrls,M8 as encryptValue,h7 as defineModel,f8 as decryptValue,ZQ as db,c8 as createTaggableMethods,l8 as createLikeableMethods,g8 as createCommentableMethods,m8 as createCategorizableMethods,l$ as createAuditMethods,y8 as collectEncryptedAttributes,UJ as buildDatabaseSchema,sY as batchLoad,zY as Websocket,HY as WaitlistRestaurant,KY as WaitlistProduct,AJ as User,vJ as UsageEvent,VY as Transaction,BY as TeamMember,WY as TeamInvitation,GY as Team,QY as TaxRate,YY as Tag,JY as Subscription,XY as SubscriberEmail,$Y as Subscriber,E2 as SubqueryBuilder,e3 as SocialPost,ZY as SocialAccount,x3 as SmsOptOut,w3 as SiteDomain,F3 as Site,a3 as ShippingZone,o3 as ShippingRate,s3 as ShippingMethod,hJ as SenderDomain,t3 as Review,r3 as Request,i3 as Release,_3 as Redirect,p3 as Receipt,n3 as QueryLog,d3 as ProductVariant,l3 as ProductUnit,m3 as Product,c3 as PrintDevice,u3 as Post,O3 as Pledge,g3 as PaymentTransaction,b3 as PaymentProduct,R3 as PaymentMethod,v3 as Payment,z3 as PageRevision,h3 as Page,y3 as OrderItem,f3 as OrderIdempotency,M3 as Order,S3 as NotificationDelivery,j3 as Notification,j7 as ModelValidationError,f7 as ModelNotFoundError,H3 as MenuItem,K3 as Menu,f$ as MassAssignmentException,I3 as Manufacturer,k3 as MailPreference,V3 as MagicLinkToken,v$ as MODEL_DEFINITION,N3 as LoyaltyReward,P3 as LoyaltyPoint,C3 as Log,E3 as LicenseKey,A3 as Label,EJ as Job,D3 as GiftCard,B3 as FormSubmission,W3 as FormField,G3 as Form,CJ as FailedJob,L3 as ErrorModel,q3 as EmailWebhookEvent,U3 as EmailSuppression,Q3 as EmailListSubscriber,Y3 as EmailList,T3 as EmailIdempotency,X3 as DriverPing,$3 as Driver,Z3 as DigitalDelivery,eJ as Deployment,aJ as DeliveryStop,oJ as DeliveryRoute,sJ as Customer,tJ as Coupon,yJ as ConsentEvent,fJ as CommunicationSuppression,rJ as Comment,iJ as Category,pJ as CartItem,nJ as Cart,dJ as CardComment,lJ as Card,MJ as CampaignVariant,J3 as CampaignSend,mJ as Campaign,cJ as BoardColumn,uJ as Board,gJ as Bid,jJ as AutomationRun,IJ as Automation,bJ as Author,RJ as AuctionItem,SJ as Auction,kJ as AnalyticsEvent,NJ as Activity};
|