@tinkerlandai/longplay-sdk 0.10.46 → 0.10.48
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/CHANGELOG.md +14 -0
- package/README.md +7 -2
- package/README.zh-CN.md +1 -1
- package/dist/check-response-MCT5RGOM.js +1 -0
- package/dist/{chunk-XQN7MLP5.js → chunk-2I2S5ZIH.js} +1 -1
- package/dist/{chunk-W55G3VGB.js → chunk-2LEDTNKQ.js} +1 -1
- package/dist/chunk-2LKDEPKP.js +1 -0
- package/dist/{chunk-HIUSHWDK.js → chunk-2UXX62Y4.js} +1 -1
- package/dist/{chunk-R2OJIXYE.js → chunk-3ITNAFAH.js} +1 -1
- package/dist/{chunk-ZNTV6TU7.js → chunk-5RGKWO6R.js} +1 -1
- package/dist/{chunk-XWD4N2QI.js → chunk-A5KU4MMN.js} +2 -17
- package/dist/chunk-A5KU4MMN.js.LEGAL.txt +17 -0
- package/dist/chunk-CB2VWRNI.js +1 -0
- package/dist/{chunk-ANTKNFC6.js → chunk-DCLEIAC6.js} +1 -1
- package/dist/chunk-DEJKZZTA.js +318 -0
- package/dist/chunk-EGFVGCDG.js +1 -0
- package/dist/chunk-EKN4CJLC.js +1 -0
- package/dist/{chunk-MMJBC6PW.js → chunk-F3WLQZXI.js} +1 -1
- package/dist/{chunk-AKBF7TGD.js → chunk-FGQ376NB.js} +1 -1
- package/dist/{chunk-UIKMEVXM.js → chunk-FRRKTQNZ.js} +1 -1
- package/dist/{chunk-XB24ATBA.js → chunk-FYD7CMS7.js} +1 -1
- package/dist/{chunk-7MTQQIGR.js → chunk-HP6OV6WF.js} +1 -1
- package/dist/{chunk-UBUFXGS7.js → chunk-HYCLLEFU.js} +1 -1
- package/dist/{chunk-ZQAAZ7Q4.js → chunk-HYX3EDZS.js} +1 -1
- package/dist/{chunk-JZ73DRHT.js → chunk-IDDPWGQE.js} +1 -1
- package/dist/{chunk-AAILPAL5.js → chunk-ILNOJRRY.js} +1 -1
- package/dist/{chunk-SWULFBRF.js → chunk-IVXYLNAF.js} +1 -1
- package/dist/chunk-JDIFYMSA.js +1 -0
- package/dist/{chunk-DTOYPMAW.js → chunk-KCN6OGYG.js} +1 -1
- package/dist/{chunk-MBWUIYCH.js → chunk-KSME3N3A.js} +1 -1
- package/dist/{chunk-N3C57R2I.js → chunk-L7C5TKKV.js} +1 -1
- package/dist/chunk-LE32WTZ7.js +1 -0
- package/dist/{chunk-CRCAYVV5.js → chunk-LSHIR6QM.js} +1 -1
- package/dist/{chunk-GFSAWDV2.js → chunk-MQ5LJEWV.js} +1 -1
- package/dist/{chunk-HMPIUYZ2.js → chunk-N3PZMMOO.js} +1 -1
- package/dist/chunk-NCKOKX7G.js +1 -0
- package/dist/{chunk-ASCVMPXG.js → chunk-NL26SIDD.js} +1 -1
- package/dist/chunk-OPUIFAQS.js +1 -0
- package/dist/{chunk-KAMYLHAT.js → chunk-PF6PRPRO.js} +1 -1
- package/dist/{chunk-UHT5DGAJ.js → chunk-PJAZ2UP4.js} +1 -1
- package/dist/{chunk-YHC5WAVP.js → chunk-RCSDBE5K.js} +1 -1
- package/dist/{chunk-A37ZU2AP.js → chunk-RFWVXTZ7.js} +1 -1
- package/dist/{chunk-X2ON6QRA.js → chunk-SZZIYCXK.js} +1 -1
- package/dist/{chunk-CI7UPAWD.js → chunk-TIOPNTMP.js} +1 -1
- package/dist/chunk-TLY2TLJB.js +1 -0
- package/dist/{chunk-4LIM2ZQR.js → chunk-TNPBYYAX.js} +1 -1
- package/dist/{chunk-EIVFBGI5.js → chunk-VBWVE3FU.js} +1 -1
- package/dist/{chunk-L42A5KVA.js → chunk-VKFLQEW4.js} +1 -1
- package/dist/{chunk-POOXIM6Q.js → chunk-W3B4GT74.js} +1 -1
- package/dist/{chunk-6RGARS6I.js → chunk-XVCSRZX4.js} +1 -1
- package/dist/{chunk-PPOPJTHA.js → chunk-Y2ASROJH.js} +1 -1
- package/dist/chunk-YFLVGOCJ.js +1 -0
- package/dist/chunk-YQRUQD5R.js +2 -0
- package/dist/chunk-YQRUQD5R.js.LEGAL.txt +4 -0
- package/dist/{chunk-MFAEHTOH.js → chunk-ZDIWOE4Q.js} +1 -1
- package/dist/content-7CR4XSVY.js +1 -0
- package/dist/funnel-host-purchase-QSRHTOIK.js +1 -0
- package/dist/funnel-paywall-prerender-6CG72RL5.js +1 -0
- package/dist/funnel-route-prediction-XNIKDJIM.js +1 -0
- package/dist/funnel-route-source-EUIA4M3Y.js +1 -0
- package/dist/funnel-runtime-host-YLIG45EU.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/dist/merchant-bridge-contracts-7EHDNPJJ.js +1 -0
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.js +1 -1
- package/dist/operation-contracts-C6CMAO6S.js +1 -0
- package/dist/page.js +1 -1
- package/dist/paywall-C5TM2TXD.js +1 -0
- package/dist/paywall-content-DYDVZNOK.js +1 -0
- package/dist/paywall-session-QMYOF2PZ.js +1 -0
- package/dist/popup.js +1 -1
- package/dist/react-native.js +1 -1
- package/dist/screen-renderer-HOIWGE5V.js +1 -0
- package/dist/server.js +1 -1
- package/dist/{visual-dom-KUABNJV6.js → visual-dom-IN6DRNX3.js} +1 -1
- package/dist/visual.js +1 -1
- package/native-funnel-host.NOTICES.txt +22 -0
- package/package.json +3 -2
- package/dist/check-response-5ZLFYMPK.js +0 -1
- package/dist/chunk-6RNLPMMJ.js +0 -1
- package/dist/chunk-D3WC3T4U.js +0 -1
- package/dist/chunk-EQKTKITL.js +0 -1
- package/dist/chunk-GJLCTQJN.js +0 -1
- package/dist/chunk-JDUB4T4P.js +0 -1
- package/dist/chunk-L7OMFH4O.js +0 -1
- package/dist/chunk-N3TAZ7HB.js +0 -1
- package/dist/chunk-PE5Y524X.js +0 -1
- package/dist/chunk-SIJY35EE.js +0 -4
- package/dist/chunk-TWQB35B7.js +0 -318
- package/dist/chunk-WQN2D5FZ.js +0 -1
- package/dist/chunk-YPN2ZL2V.js +0 -1
- package/dist/content-4Y57QHWP.js +0 -1
- package/dist/funnel-host-purchase-UWTK3C7Q.js +0 -1
- package/dist/funnel-paywall-prerender-MQWJONN5.js +0 -1
- package/dist/funnel-route-prediction-O7XGFYHS.js +0 -1
- package/dist/funnel-route-source-MYKZJIXG.js +0 -1
- package/dist/funnel-runtime-host-66OPNY4C.js +0 -1
- package/dist/merchant-bridge-contracts-Z5PJ2P6H.js +0 -1
- package/dist/operation-contracts-OSBKHIVO.js +0 -1
- package/dist/paywall-QMYTDELU.js +0 -1
- package/dist/paywall-content-LLRPWEZD.js +0 -1
- package/dist/paywall-session-P6NIFMKG.js +0 -1
- package/dist/screen-renderer-AQXCFML3.js +0 -1
- /package/dist/{chunk-KV5MZ4NI.js → chunk-RA7GZ67U.js} +0 -0
- /package/dist/{chunk-FRK6322O.js → chunk-WPFTSHP2.js} +0 -0
package/dist/chunk-WQN2D5FZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{N as S,a as P,b as M,c as w,d as T,g as h,h as f,l as L,m as F,n as G,o as j,p as E,r as b,s as y}from"./chunk-JDUB4T4P.js";import{a as X}from"./chunk-VILB5M4X.js";import{a as K,b as g,c as V,d as H,q as W}from"./chunk-GJLCTQJN.js";import{a as u,b as Q,c as $,d as Z}from"./chunk-4LIM2ZQR.js";import{e as Y,f as D,g as J}from"./chunk-KAMYLHAT.js";import{b as t}from"./chunk-6RGARS6I.js";var z={"zh-Hans":{merchandise:"\u51CF {discount}\uFF08\u5355\u6B21\u4F7F\u7528\uFF09",once:"\u9996\u671F\u51CF {discount}",repeating:"\u524D {months} \u4E2A\u6708\u6BCF\u6708\u51CF {discount}",forever:"\u6BCF\u671F\u51CF {discount}"},"zh-Hant":{merchandise:"\u6E1B {discount}\uFF08\u55AE\u6B21\u4F7F\u7528\uFF09",once:"\u9996\u671F\u6E1B {discount}",repeating:"\u524D {months} \u500B\u6708\u6BCF\u6708\u6E1B {discount}",forever:"\u6BCF\u671F\u6E1B {discount}"},en:{merchandise:"{discount} off \xB7 one use",once:"{discount} off your first payment",repeating:"{discount} off each month for the first {months} months",repeatingOne:"{discount} off the first month",forever:"{discount} off every payment"},ja:{merchandise:"{discount} \u5272\u5F15\uFF081\u56DE\u306E\u307F\uFF09",once:"\u521D\u56DE\u306E\u304A\u652F\u6255\u3044\u304C {discount} \u5272\u5F15",repeating:"\u6700\u521D\u306E {months} \u304B\u6708\u9593\u3001\u6BCE\u6708 {discount} \u5272\u5F15",forever:"\u6BCE\u56DE\u306E\u304A\u652F\u6255\u3044\u304C {discount} \u5272\u5F15"},ko:{merchandise:"{discount} \uD560\uC778 \xB7 1\uD68C \uC0AC\uC6A9",once:"\uCCAB \uACB0\uC81C {discount} \uD560\uC778",repeating:"\uCCAB {months}\uAC1C\uC6D4 \uB3D9\uC548 \uB9E4\uC6D4 {discount} \uD560\uC778",forever:"\uB9E4 \uACB0\uC81C {discount} \uD560\uC778"},es:{merchandise:"{discount} de descuento \xB7 un uso",once:"{discount} de descuento en el primer pago",repeating:"{discount} de descuento cada mes durante los primeros {months} meses",forever:"{discount} de descuento en cada pago",repeatingOne:"{discount} de descuento durante el primer mes"},fr:{merchandise:"{discount} de r\xE9duction \xB7 une utilisation",once:"{discount} de r\xE9duction sur le premier paiement",repeating:"{discount} de r\xE9duction par mois pendant les {months} premiers mois",forever:"{discount} de r\xE9duction sur chaque paiement",repeatingOne:"{discount} de r\xE9duction pendant le premier mois"},de:{merchandise:"{discount} Rabatt \xB7 einmalig",once:"{discount} Rabatt auf die erste Zahlung",repeating:"{discount} Rabatt pro Monat f\xFCr die ersten {months} Monate",forever:"{discount} Rabatt auf jede Zahlung",repeatingOne:"{discount} Rabatt im ersten Monat"},pt:{merchandise:"{discount} de desconto \xB7 um uso",once:"{discount} de desconto no primeiro pagamento",repeating:"{discount} de desconto por m\xEAs nos primeiros {months} meses",forever:"{discount} de desconto em cada pagamento",repeatingOne:"{discount} de desconto no primeiro m\xEAs"},it:{merchandise:"{discount} di sconto \xB7 un utilizzo",once:"{discount} di sconto sul primo pagamento",repeating:"{discount} di sconto al mese per i primi {months} mesi",forever:"{discount} di sconto su ogni pagamento",repeatingOne:"{discount} di sconto per il primo mese"},ru:{merchandise:"\u0421\u043A\u0438\u0434\u043A\u0430 {discount} \xB7 \u043E\u0434\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435",once:"\u0421\u043A\u0438\u0434\u043A\u0430 {discount} \u043D\u0430 \u043F\u0435\u0440\u0432\u044B\u0439 \u043F\u043B\u0430\u0442\u0451\u0436",repeating:"\u0421\u043A\u0438\u0434\u043A\u0430 {discount} \u043A\u0430\u0436\u0434\u044B\u0439 \u043C\u0435\u0441\u044F\u0446 \u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0435 \u043F\u0435\u0440\u0432\u044B\u0445 {months} \u043C\u0435\u0441.",repeatingOne:"\u0421\u043A\u0438\u0434\u043A\u0430 {discount} \u0432 \u043F\u0435\u0440\u0432\u044B\u0439 \u043C\u0435\u0441\u044F\u0446",forever:"\u0421\u043A\u0438\u0434\u043A\u0430 {discount} \u043D\u0430 \u043A\u0430\u0436\u0434\u044B\u0439 \u043F\u043B\u0430\u0442\u0451\u0436"},vi:{merchandise:"Gi\u1EA3m {discount} \xB7 d\xF9ng m\u1ED9t l\u1EA7n",once:"Gi\u1EA3m {discount} cho l\u1EA7n thanh to\xE1n \u0111\u1EA7u ti\xEAn",repeating:"Gi\u1EA3m {discount} m\u1ED7i th\xE1ng trong {months} th\xE1ng \u0111\u1EA7u",forever:"Gi\u1EA3m {discount} cho m\u1ED7i l\u1EA7n thanh to\xE1n"},th:{merchandise:"\u0E25\u0E14 {discount} \xB7 \u0E43\u0E0A\u0E49\u0E44\u0E14\u0E49\u0E04\u0E23\u0E31\u0E49\u0E07\u0E40\u0E14\u0E35\u0E22\u0E27",once:"\u0E25\u0E14 {discount} \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E0A\u0E33\u0E23\u0E30\u0E40\u0E07\u0E34\u0E19\u0E04\u0E23\u0E31\u0E49\u0E07\u0E41\u0E23\u0E01",repeating:"\u0E25\u0E14 {discount} \u0E15\u0E48\u0E2D\u0E40\u0E14\u0E37\u0E2D\u0E19\u0E43\u0E19\u0E0A\u0E48\u0E27\u0E07 {months} \u0E40\u0E14\u0E37\u0E2D\u0E19\u0E41\u0E23\u0E01",forever:"\u0E25\u0E14 {discount} \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E0A\u0E33\u0E23\u0E30\u0E40\u0E07\u0E34\u0E19\u0E17\u0E38\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07"},id:{merchandise:"Diskon {discount} \xB7 sekali pakai",once:"Diskon {discount} untuk pembayaran pertama",repeating:"Diskon {discount} setiap bulan selama {months} bulan pertama",forever:"Diskon {discount} untuk setiap pembayaran"},ar:{merchandise:"\u062E\u0635\u0645 {discount} \xB7 \u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0648\u0627\u062D\u062F",once:"\u062E\u0635\u0645 {discount} \u0639\u0644\u0649 \u0627\u0644\u062F\u0641\u0639\u0629 \u0627\u0644\u0623\u0648\u0644\u0649",repeating:"\u062E\u0635\u0645 {discount} \u0634\u0647\u0631\u064A\u064B\u0627 \u0644\u0645\u062F\u0629 {period}",forever:"\u062E\u0635\u0645 {discount} \u0639\u0644\u0649 \u0643\u0644 \u062F\u0641\u0639\u0629"}};function k(e){let i=W(e)??"en",n=i.split("-"),r=n[0]==="zh"?n.includes("Hans")?"zh-Hans":n.includes("Hant")||n.some(c=>["TW","HK","MO"].includes(c))?"zh-Hant":"zh-Hans":n[0]??"en",o=z[r];return o?{locale:i,copy:o}:{locale:"en",copy:z.en}}function we(e,i,n="zh-CN"){let r=Q(i);return $(e,i,k(n).locale,{currencyDisplay:"narrowSymbol",minimumFractionDigits:e%10**r===0?0:r,maximumFractionDigits:r})}function Te(e,i="zh-CN"){let n=k(i).locale;return e.type==="percent"?new Intl.NumberFormat(n,{style:"percent",maximumFractionDigits:2}).format(e.percentOff/100):we(e.amountOffCents,e.currency,n)}var ee={zh:"\u524D {months} \u4E2A\u6708\u5185\u5F00\u51FA\u7684\u8D26\u5355\u51CF {discount}","zh-Hant":"\u524D {months} \u500B\u6708\u5167\u958B\u51FA\u7684\u5E33\u55AE\u6E1B {discount}",en:"{discount} off invoices issued within the first {months} months",ja:"\u6700\u521D\u306E {months} \u304B\u6708\u4EE5\u5185\u306E\u8ACB\u6C42\u304C {discount} \u5272\u5F15",ko:"\uCCAB {months}\uAC1C\uC6D4 \uB0B4 \uCCAD\uAD6C\uC11C {discount} \uD560\uC778",es:"{discount} de descuento en facturas emitidas durante los primeros {months} meses",fr:"{discount} de r\xE9duction sur les factures \xE9mises pendant les {months} premiers mois",de:"{discount} Rabatt auf Rechnungen innerhalb der ersten {months} Monate",pt:"{discount} de desconto nas faturas emitidas nos primeiros {months} meses",it:"{discount} di sconto sulle fatture emesse nei primi {months} mesi",ru:"\u0421\u043A\u0438\u0434\u043A\u0430 {discount} \u043D\u0430 \u0441\u0447\u0435\u0442\u0430 \u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0435 \u043F\u0435\u0440\u0432\u044B\u0445 {months} \u043C\u0435\u0441.",vi:"Gi\u1EA3m {discount} cho h\xF3a \u0111\u01A1n trong {months} th\xE1ng \u0111\u1EA7u",th:"\u0E25\u0E14 {discount} \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E43\u0E1A\u0E41\u0E08\u0E49\u0E07\u0E2B\u0E19\u0E35\u0E49\u0E43\u0E19\u0E0A\u0E48\u0E27\u0E07 {months} \u0E40\u0E14\u0E37\u0E2D\u0E19\u0E41\u0E23\u0E01",id:"Diskon {discount} untuk tagihan dalam {months} bulan pertama",ar:"\u062E\u0635\u0645 {discount} \u0639\u0644\u0649 \u0627\u0644\u0641\u0648\u0627\u062A\u064A\u0631 \u0627\u0644\u0635\u0627\u062F\u0631\u0629 \u062E\u0644\u0627\u0644 \u0623\u0648\u0644 {period}"};function Ut(e,i="zh-CN",n="month"){let r=k(i),o=Te(e.discount,r.locale);if(e.appliesTo?.type==="merchandise")return r.copy.merchandise.replace("{discount}",o);let c=e.duration.type==="repeating"?new Intl.NumberFormat(r.locale).format(e.duration.months):"",a=r.locale.split("-")[0]??"en",m=a==="zh"&&/(?:Hant|TW|HK|MO)/.test(r.locale)?"zh-Hant":a,p=e.duration.type==="repeating"&&n!=="month"?ee[m]??ee.en:e.duration.type==="repeating"&&e.duration.months===1?r.copy.repeatingOne??r.copy.repeating:r.copy[e.duration.type],Me=e.duration.type==="repeating"?new Intl.NumberFormat(r.locale,{style:"unit",unit:"month",unitDisplay:"long"}).format(e.duration.months):"";return p.replace("{discount}",o).replace("{months}",c).replace("{period}",Me)}var Lt=t.discriminatedUnion("action",[t.strictObject({action:t.literal("create"),couponId:t.uuid(),productBindingId:t.uuid(),storeOfferId:t.string().min(1).max(255).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/).nullable(),storeOfferType:t.enum(["introductory","promotional"])}),t.strictObject({action:t.literal("set_enabled"),id:t.uuid(),revision:t.number().int().nonnegative(),enabled:t.boolean()})]),Ft=t.array(t.strictObject({id:t.uuid(),couponId:t.uuid(),productBindingId:t.uuid(),storeOfferId:t.string().min(1).max(255).nullable(),storeOfferType:t.enum(["introductory","promotional"]),enabled:t.boolean(),revision:t.number().int().nonnegative()})).max(500),_=t.strictObject({offerKind:t.enum(["none","introductory","promotional"]),offerId:t.string().min(1).max(255).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/).nullable(),discountMinor:t.number().int().min(0).max(1e8),trialDays:t.number().int().min(1).max(730).nullable()}).superRefine((e,i)=>{(e.offerKind==="none"&&(e.offerId!==null||e.discountMinor!==0||e.trialDays!==null)||e.trialDays!==null&&e.discountMinor!==0)&&i.addIssue({code:"custom",message:"Select one store purchase option with its exact terms"})}),Gt=t.record(t.uuid(),_).refine(e=>Object.keys(e).length<=20,"At most 20 native store selections");var R=t.object({type:t.literal("native_purchase"),receiptId:t.uuid(),orderId:t.uuid(),productVersionId:t.uuid(),provider:t.enum(["apple","google"]),productId:t.string().min(1).max(255),productKind:Z,replacement:t.strictObject({sourceOrderId:t.uuid(),sourceProductId:t.string().min(1).max(255),policy:t.enum(["apple_store","google_full_price"]),sourceAccountTokens:t.array(t.uuid()).max(50)}).nullable(),appAccountToken:t.uuid().optional(),obfuscatedAccountId:t.string().min(1).max(64).optional(),obfuscatedProfileId:t.uuid().optional(),basePlanId:t.string().min(1).max(255).optional(),offerId:t.string().min(1).max(255).optional(),offerKind:t.enum(["none","introductory","promotional"]),currency:u,catalogAmountMinor:t.number().int().nonnegative().max(1e8),discountMinor:t.number().int().nonnegative().max(1e8),trialDays:t.number().int().min(1).max(730).nullable(),seatBundle:t.array(t.strictObject({key:t.string().regex(/^[a-z][a-z0-9_]{0,63}$/),quantity:t.number().int().min(1).max(1e4)})).max(20),applePromotionalOffer:t.strictObject({offerId:t.string().min(1).max(255),keyId:t.string().min(1).max(255),nonce:t.uuid(),signature:t.string().min(1).max(1024),timestamp:t.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER)}).nullable()}).strict().superRefine((e,i)=>{let n=e.provider==="apple";(e.replacement!==null&&(e.productKind!=="membership"||e.offerKind!=="none"||e.trialDays!==null||e.replacement.policy!==(n?"apple_store":"google_full_price"))||e.productKind!=="membership"&&(e.trialDays!==null||e.offerKind!=="none"||e.basePlanId!==void 0)||!n&&e.productKind==="membership"&&e.basePlanId===void 0||e.discountMinor>e.catalogAmountMinor||new Set(e.seatBundle.map(o=>o.key)).size!==e.seatBundle.length||e.trialDays!==null&&(e.discountMinor!==0||e.offerKind==="none")||e.offerKind==="none"&&e.discountMinor!==0||(n?!e.appAccountToken||e.obfuscatedAccountId!==void 0||e.obfuscatedProfileId!==void 0||e.basePlanId!==void 0||e.offerKind==="promotional"!=(e.applePromotionalOffer!==null)||e.offerKind==="promotional"!=(e.offerId!==void 0)||e.applePromotionalOffer!==null&&e.applePromotionalOffer.offerId!==e.offerId:e.appAccountToken!==void 0||!e.obfuscatedAccountId||!e.obfuscatedProfileId||e.applePromotionalOffer!==null||e.offerKind==="none"!=(e.offerId===void 0)))&&i.addIssue({code:"custom",message:"Native purchase terms must match the accepted store selection"})});var je=t.enum(["active","inactive"]),Ee=t.preprocess((e,i)=>{let n=0;function r(o,c){if(!(++n>1e4||c>20)){if(Array.isArray(o))o.forEach(a=>r(a,c+1));else if(o&&typeof o=="object")for(let[a,m]of Object.entries(o))["__proto__","constructor","prototype"].includes(a)&&i.addIssue({code:"custom",message:"Reserved merchandise attribute"}),r(m,c+1)}}return r(e,0),e},Y),De=t.strictObject({id:t.string().trim().min(1).max(255),name:t.string().trim().min(1).max(255),status:je,metadata:Ee}),Jt=De.extend({internal_id:t.uuid(),project_id:t.uuid(),environment_id:t.uuid(),created_at:t.iso.datetime({offset:!0}),updated_at:t.iso.datetime({offset:!0})}),Xt=t.union([t.strictObject({id:t.string().trim().min(1).max(255)}),t.strictObject({internalId:t.uuid()})]),zt=t.enum(["customer","merchandise","context"]),ei=t.enum(["system","stored","request"]),ti=t.enum(["customer","merchandise","mixed"]),te=e=>e==="merchandiseId"||e==="merchandise"||e.startsWith("merchandise.");function N(e,i={},n=new Set){if(X(e).some(te))return!0;for(let r of J(e)){if(n.has(r))continue;n.add(r);let o=i[r];if(o?.type==="list"&&te(o.attributeKey)||o?.type==="condition"&&N(o.condition,i,n))return!0}return!1}var ci=t.enum(["draft","active","paused","archived"]),x=t.discriminatedUnion("type",[t.object({type:t.literal("percent"),percentOff:t.number().min(1).max(100).multipleOf(.01)}).strict(),t.object({type:t.literal("amount"),amountOffCents:t.number().int().min(1).max(1e8),currency:u}).strict()]),I=t.discriminatedUnion("type",[t.object({type:t.literal("once")}).strict(),t.object({type:t.literal("repeating"),months:t.number().int().min(1).max(36)}).strict(),t.object({type:t.literal("forever")}).strict()]),ie=[t.object({type:t.literal("all")}).strict(),t.object({type:t.literal("plans"),planIds:t.array(t.uuid()).min(1).max(50).refine(e=>new Set(e).size===e.length,"\u5957\u9910\u4E0D\u80FD\u91CD\u590D")}).strict()],ke=t.discriminatedUnion("type",[...ie,t.strictObject({type:t.literal("merchandise"),scope:t.discriminatedUnion("type",[t.strictObject({type:t.literal("all")}),t.strictObject({type:t.literal("selected"),merchandiseIds:t.array(t.uuid()).min(1).max(1e3).refine(e=>new Set(e).size===e.length,"Duplicate merchandise")}),t.strictObject({type:t.literal("condition"),condition:D})])})]),Re=t.discriminatedUnion("type",[...ie,t.strictObject({type:t.literal("merchandise"),scope:t.strictObject({type:t.enum(["all","selected","condition"])})})]),Ne=t.strictObject({firstPurchaseOnly:t.boolean(),condition:D}),ui=t.object({name:t.string().trim().min(1).max(80),description:t.string().max(500),discount:x,duration:I,nativeDiscountPolicy:P.optional(),appliesTo:ke,eligibility:Ne,selfClaimEnabled:t.boolean().default(!1),startsAt:t.iso.datetime().nullable(),endsAt:t.iso.datetime().nullable(),totalLimit:t.number().int().min(1).max(1e6).nullable(),perCustomerLimit:t.number().int().min(1).max(10),grantWindowHours:t.number().int().min(1).max(2160)}).strict().refine(e=>!e.startsAt||!e.endsAt||Date.parse(e.endsAt)>Date.parse(e.startsAt),{message:"\u7ED3\u675F\u65F6\u95F4\u5FC5\u987B\u665A\u4E8E\u5F00\u59CB\u65F6\u95F4",path:["endsAt"]}).refine(e=>!N(e.eligibility.condition),{message:"Customer eligibility cannot read merchandise; use merchandise applicability",path:["eligibility","condition"]}).refine(e=>e.appliesTo.type!=="merchandise"||e.duration.type==="once",{message:"Merchandise Coupons apply to one purchase",path:["duration"]}).refine(e=>e.appliesTo.type!=="merchandise"||!e.eligibility.firstPurchaseOnly,{message:"Merchant purchase eligibility requires trusted targeting attributes",path:["eligibility","firstPurchaseOnly"]}),mi=t.object({code:t.string().trim().transform(e=>e.toUpperCase()).pipe(t.string().regex(/^[A-Z0-9][A-Z0-9_-]{2,31}$/,"\u4F18\u60E0\u7801\u53EA\u80FD\u7528 3\u201332 \u4F4D\u5B57\u6BCD\u3001\u6570\u5B57\u3001- \u548C _\uFF0C\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934")),maxRedemptions:t.number().int().min(1).max(1e6).nullable(),expiresAt:t.iso.datetime().nullable(),firstPurchaseOnly:t.boolean(),minimumAmountCents:t.number().int().min(1).max(1e8).nullable(),minimumAmountCurrency:u.nullable()}).strict().refine(e=>e.minimumAmountCents===null==(e.minimumAmountCurrency===null),"Minimum amount requires its currency");var di=t.object({id:t.uuid(),couponId:t.uuid(),status:t.enum(["issued","reserved","redeemed","revoked","expired"]),issuedAt:t.iso.datetime(),expiresAt:t.iso.datetime(),coupon:t.object({name:t.string(),discount:x,duration:I,nativeDiscountPolicy:P.optional(),appliesTo:Re}).strict()}).strict(),pi=t.enum(["claim_disabled","unavailable","inactive","outside_window","not_targeted","not_first_purchase","limit_reached","sold_out"]);var ne=t.strictObject({itemKey:t.string().regex(/^paid:feature:[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/),internal_feature_id:t.uuid(),includedAmount:t.string().regex(/^(0|[1-9]\d{0,11})(\.\d{1,6})?$/),quantity:t.number().int().min(0).max(1e4),terms:V,pricing:K.optional(),unitAmountMinor:t.number().int().min(0).max(1e8),productId:t.string().min(1).max(255).nullable(),priceId:t.string().min(1).max(255).nullable()}).superRefine((e,i)=>{(e.quantity<e.terms.minimumQuantity||e.quantity>e.terms.maximumQuantity||e.productId===null!=(e.priceId===null)||e.quantity>0&&(e.pricing||e.unitAmountMinor>0)&&e.priceId===null)&&i.addIssue({code:"custom",message:"Purchased quantities need their published bounds and immutable price binding"});try{H(e.includedAmount,e.terms.units,e.quantity),g({quantity:e.quantity,unitAmountMinor:e.unitAmountMinor,...e.pricing===void 0?{}:{pricing:e.pricing}})}catch{i.addIssue({code:"custom",message:"Purchased allowance exceeds the ledger quantity limit"})}});var v=t.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/,"ID \u4F7F\u7528\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u4E0B\u5212\u7EBF\uFF0C\u5E76\u4EE5\u5B57\u6BCD\u5F00\u5934"),_i=t.object({amountCents:t.number().int().min(0).max(1e8),currency:u,interval:t.enum(["free","month","year"]),currencyOptions:t.partialRecord(u,t.number().int().min(1).max(1e8)).optional()}).refine(e=>e.interval==="free"?e.amountCents===0:e.amountCents>0,"\u514D\u8D39\u5957\u9910\u91D1\u989D\u5FC5\u987B\u4E3A 0\uFF0C\u4ED8\u8D39\u91D1\u989D\u5FC5\u987B\u5927\u4E8E 0").refine(e=>!e.currencyOptions||!Object.hasOwn(e.currencyOptions,e.currency)&&(e.interval!=="free"||Object.keys(e.currencyOptions).length===0),"\u9644\u52A0\u5E01\u79CD\u4E0D\u80FD\u91CD\u590D\u9ED8\u8BA4\u5E01\u79CD\uFF1B\u514D\u8D39\u5957\u9910\u4E0D\u8BBE\u7F6E\u9644\u52A0\u4EF7\u683C");var Ue=t.registry(),{BillingInterval:re}=(()=>{var e;return(function(i){i.OneOff="one_off",i.Week="week",i.Month="month",i.Quarter="quarter",i.SemiAnnual="semi_annual",i.Year="year"})(e||(e={})),{BillingInterval:e}})(),{DisplaySchema:qe}=(e=>({DisplaySchema:e.object({primary_text:e.string().meta({description:"Main display text (e.g. '$10' or '100 messages')."}),secondary_text:e.string().optional().meta({description:"Secondary display text (e.g. 'per month' or 'then $0.5 per 100')."})})}))(t),{withSpecDefault:Be}=(e=>({withSpecDefault:({schema:n,defaultValue:r,description:o})=>(e.add(n,{description:o,default:r}),n)}))(Ue),{COMMON:oe}={COMMON:["usd","eur","gbp","cad","aud","jpy","chf","cny","inr"]},{STRIPE_PRESENTMENT_CURRENCIES:Le}={STRIPE_PRESENTMENT_CURRENCIES:["usd","aed","afn","all","amd","ang","aoa","ars","aud","awg","azn","bam","bbd","bdt","bif","bmd","bnd","bob","brl","bsd","bwp","byn","bzd","cad","cdf","chf","clp","cny","cop","crc","cve","czk","djf","dkk","dop","dzd","egp","etb","eur","fjd","fkp","gbp","gel","gip","gmd","gnf","gtq","gyd","hkd","hnl","htg","huf","idr","ils","inr","isk","jmd","jpy","kes","kgs","khr","kmf","krw","kyd","kzt","lak","lbp","lkr","lrd","lsl","mad","mdl","mga","mkd","mmk","mnt","mop","mur","mvr","mwk","mxn","myr","mzn","nad","ngn","nio","nok","npr","nzd","pab","pen","pgk","php","pkr","pln","pyg","qar","ron","rsd","rub","rwf","sar","sbd","scr","sek","sgd","shp","sle","sos","srd","std","szl","thb","tjs","top","try","ttd","twd","tzs","uah","ugx","uyu","uzs","vnd","vuv","wst","xaf","xcd","xcg","xof","xpf","yer","zar","zmw"]},{COMMON_SET:Fe}=(e=>({COMMON_SET:new Set(e)}))(oe),{hasNoDuplicateCurrencies:ae}={hasNoDuplicateCurrencies:i=>{let n=new Set;for(let{currency:r}of i){let o=r.toLowerCase();if(n.has(o))return!1;n.add(o)}return!0}},{DUPLICATE_CURRENCY_MESSAGE:se}={DUPLICATE_CURRENCY_MESSAGE:"Each currency may appear at most once in additional_currencies."},{ApiStripePriceProcessorSchema:Ge}=(e=>({ApiStripePriceProcessorSchema:e.object({price_id:e.string().meta({description:"Stripe price ID. For prepaid with included > 0 this is the V2 price."})})}))(t),{Infinite:Qe}={Infinite:"inf"},{TierBehavior:$e}=(()=>{var e;return(function(i){i.Graduated="graduated",i.VolumeBased="volume"})(e||(e={})),{TierBehavior:e}})(),{BillingMethod:ce}=(()=>{var e;return(function(i){i.Prepaid="prepaid",i.UsageBased="usage_based"})(e||(e={})),{BillingMethod:e}})(),{AllocatedBilling:Ke}=(()=>{var e;return(function(i){i.Arrear="arrear",i.ProratedLegacy="prorated_legacy"})(e||(e={})),{AllocatedBilling:e}})(),{CREDIT_DIMENSION_NAME_MAX_LENGTH:Ve}={CREDIT_DIMENSION_NAME_MAX_LENGTH:64},{USAGE_ATTRIBUTION_DIMENSION_SEPARATOR:He}={USAGE_ATTRIBUTION_DIMENSION_SEPARATOR:"::"},{CreditMatchSchema:Ze}=(e=>({CreditMatchSchema:e.record(e.string(),e.union([e.string(),e.number(),e.boolean()]).transform(String).pipe(e.string()))}))(t),{ApiCreditTierSchema:ue}=(e=>({ApiCreditTierSchema:e.object({to:e.union([e.number().positive(),e.enum(["inf"])]).meta({description:"Inclusive upper usage boundary for this graduated tier. The final tier must be 'inf'."}),credit_cost:e.number().min(0).meta({description:"Credits consumed per billing-unit group within this tier."})})}))(t),{VIOLATION_MESSAGES:We}={VIOLATION_MESSAGES:{non_final_infinity:"Only the final tier may use an 'inf' boundary.",not_increasing:"Tier boundaries must be strictly increasing.",final_not_infinity:"The final tier must use an 'inf' boundary."}},{MarkupEntrySchema:me}=(e=>({MarkupEntrySchema:e.object({markup:e.number().min(-100)})}))(t),{ModelMarkupsSchema:Ye}=((e,i)=>({ModelMarkupsSchema:e.record(e.string().regex(/.+\/.+/,'Model keys are "<provider>/<model>", e.g. "openai/gpt-4o" or "custom/my-model".'),i.extend({markup:e.number().min(-100).optional(),input_cost:e.number().min(0).optional(),output_cost:e.number().min(0).optional()})).nullish()}))(t,me),{InvoiceUsageEntrySchema:Je}=(e=>({InvoiceUsageEntrySchema:e.object({feature_id:e.string().meta({description:"The metered feature whose units are being converted."}),quantity:e.number().nonnegative().meta({description:"Billable units of the metered feature. Converted to the credit-system feature through its rate card."}),properties:e.record(e.string(),e.unknown()).optional().meta({description:"Event properties used to pick the rate card dimension and multipliers."})}).strict()}))(t),{AttachDiscountSchema:de}=(e=>({AttachDiscountSchema:e.object({reward_id:e.string().optional().meta({description:"The ID of the reward to apply as a discount."}),promotion_code:e.string().optional().meta({description:"The promotion code to apply as a discount."})}).refine(n=>n.reward_id||n.promotion_code,{message:"Either reward_id or promotion_code must be provided."}).meta({title:"AttachDiscount",description:"A discount to apply. Can be either a reward ID or a promotion code."})}))(t),{CustomLineItemSchema:Xe}=(e=>({CustomLineItemSchema:e.object({amount:e.number().meta({description:"Amount in dollars for this line item (e.g. 10.50). Can be negative for credits."}),description:e.string().meta({description:"Description for the line item."})})}))(t),{UnixMsTimestampSchema:ze}=(e=>({UnixMsTimestampSchema:e.number().int().safe().nonnegative()}))(t),{CreateInvoicePreviewLineSchema:et}=(e=>({CreateInvoicePreviewLineSchema:e.object({plan_id:e.string().nullable(),feature_id:e.string().nullable(),description:e.string(),amount:e.number(),amount_after_discounts:e.number(),quantity:e.number().nullable(),prorated:e.boolean(),period_start:e.number().nullable(),period_end:e.number().nullable()})}))(t),{ReissueInvoiceParamsSchema:Oi}=(e=>({ReissueInvoiceParamsSchema:e.object({invoice_id:e.string().meta({description:"The Autumn invoice ID to void and replace.",example:"inv_2b3c4d5e6f7g8h"}),invoice_template_id:e.string().optional().meta({description:"ID of an invoice template (configured in billing settings) whose footer and memo are applied to the replacement invoice."}),net_terms_days:e.number().int().positive().optional().meta({description:"Number of days the customer has to pay the replacement invoice. Defaults to the original invoice's due date; required when that date has already passed."}),update_customer_email:e.email().optional().meta({description:"Updates the customer's billing email before the replacement is issued, so Stripe sends the new invoice to this address."})})}))(t),{InvoiceModeParamsSchema:l}=(e=>({InvoiceModeParamsSchema:e.object({enabled:e.boolean().meta({description:"When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method."}),enable_plan_immediately:e.boolean().default(!1).meta({description:"If true, enables the plan immediately even though the invoice is not paid yet."}),finalize:e.boolean().default(!0).meta({description:"If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review."}),invoice_template_id:e.string().optional().meta({description:"ID of an invoice template (configured in billing settings) whose footer (e.g. bank details) is applied to the invoice."}),net_terms_days:e.number().int().positive().optional().meta({description:"Number of days the customer has to pay the invoice before it is due (Stripe days_until_due)."})}).meta({title:"InvoiceMode",description:"Invoice mode configuration. Creates an invoice instead of charging the card immediately."})}))(t),{InvoiceTemplateSchema:Pi}=(e=>({InvoiceTemplateSchema:e.object({id:e.string().meta({description:"Unique identifier for the invoice template."}),name:e.string().meta({description:"User-defined name to distinguish this template when sending an invoice."}),footer:e.string().optional().meta({description:"Footer text rendered on the invoice, typically bank details so customers can pay directly."}),memo:e.string().optional().meta({description:"Memo shown near the top of the invoice (Stripe invoice description), e.g. a contact line for payment questions."}),net_terms_days:e.number().int().positive().optional().meta({description:"Default number of days the customer has to pay before the invoice is due. Overridable when sending."}),created_at:e.number().optional().meta({description:"Timestamp (ms) when the template was created."})})}))(t),{BasePriceSchema:tt}=((e,i,n)=>({BasePriceSchema:e.object({amount:e.number().meta({description:"Base price amount for the plan, in major currency units (e.g. dollars)."}),interval:e.enum(i).meta({description:"Billing interval (e.g. 'month', 'year')."}),interval_count:e.number().optional().meta({description:"Number of intervals per billing cycle. Defaults to 1."}),display:n.optional().meta({description:"Display text for showing this price in pricing pages."})})}))(t,re,qe),{CURRENCY_CODES:it}=((e,i,n)=>({CURRENCY_CODES:[...e,...i.filter(o=>!n.has(o)).sort()]}))(oe,Le,Fe),{ApiPriceProcessorsSchema:pe}=((e,i)=>({ApiPriceProcessorsSchema:e.object({stripe:i.nullish()}).meta({"x-atmn-mapping":!0})}))(t,Ge),{AllocatedBillingFieldSchema:nt}=((e,i)=>({AllocatedBillingFieldSchema:e.enum(i).optional().meta({internal:!0,description:"How an allocated usage_based price bills mid-cycle quantity changes. 'arrear' (default) bills at period end. 'prorated_legacy' is only returned for prices still on the legacy immediate-proration behavior; omit it to migrate the price to 'arrear'."})}))(t,Ke),{CreditDimensionNameSchema:rt}=((e,i,n)=>({CreditDimensionNameSchema:e.string().min(1).max(i).refine(o=>!o.includes(n),{message:`Dimension names cannot contain "${n}"`})}))(t,Ve,He),{ApiCreditMatchSchema:le}=(e=>({ApiCreditMatchSchema:e.meta({description:"Event properties this entry applies to. Every key must equal the tracked property, compared as strings."})}))(Ze),{findCreditTierViolations:ot}=(e=>({findCreditTierViolations:n=>{let r=[],o=(a,m)=>r.push({index:a,reason:m,message:e[m]}),c=0;for(let[a,m]of n.entries()){let p=a===n.length-1;if(m==="inf"){p||o(a,"non_final_infinity");continue}(!Number.isFinite(m)||m<=c)&&o(a,"not_increasing"),c=m,p&&o(a,"final_not_infinity")}return r}}))(We),{ApiCreditMultiplierSchema:at}=((e,i)=>({ApiCreditMultiplierSchema:e.object({match:i,factor:e.number().positive().optional().meta({description:"Multiplies the matched rate. All matching multipliers stack."}),add:e.number().optional().meta({description:"Added to the rate after every factor is applied, in credits per billing-unit group."})}).strict().refine(r=>r.factor!==void 0||r.add!==void 0,{message:"A multiplier needs a factor or an add."})}))(t,le),{ProviderMarkupsSchema:st}=((e,i)=>({ProviderMarkupsSchema:e.record(e.string(),i).nullish()}))(t,me),{InvoiceFeatureQuantitySchema:he}=((e,i,n)=>({InvoiceFeatureQuantitySchema:e.object({feature_id:e.string().meta({description:"The feature to bill."}),billing_behavior:e.enum(i).meta({description:"Which of the feature's prices to use: 'prepaid' or 'usage_based'."}),quantity:e.number().nonnegative().optional().meta({description:"Billable feature units in total, exclusive of any included usage. Not per seat or per entity. For a credit-system feature this is the number of credits."}),usage:e.array(n).optional().meta({description:"For credit-system features: billable units of the source features, converted through the credit rate card. Mutually exclusive with quantity."}),prorate:e.boolean().optional().meta({description:"Whether to prorate this line against period_start / period_end. Defaults to true for prepaid and false for usage-based."})}).strict().refine(o=>o.quantity!==void 0!=(o.usage!==void 0),{message:"Provide exactly one of quantity or usage."})}))(t,ce,Je),{CreateInvoicePreviewSchema:Mi}=((e,i)=>({CreateInvoicePreviewSchema:e.object({currency:e.string(),lines:e.array(i),subtotal:e.number(),discount_total:e.number(),tax:e.object({total:e.number(),amount_inclusive:e.number(),amount_exclusive:e.number(),status:e.enum(["complete","incomplete"])}).nullable(),total:e.number(),due_date:e.number().nullable()})}))(t,et),{SUPPORTED_SET:ct}=(e=>({SUPPORTED_SET:new Set(e)}))(it),{ApiCreditDimensionBaseSchema:ut}=((e,i)=>({ApiCreditDimensionBaseSchema:e.object({match:i,priority:e.number().int().optional().meta({description:"Breaks ties between dimensions that match the same number of keys. Higher wins."})})}))(t,le),{refineGraduatedTiers:fe}=(e=>({refineGraduatedTiers:(n,r)=>{let o=e(n.tiers.map(c=>c.to));for(let{index:c,message:a}of o)r.addIssue({code:"custom",message:a,path:["tiers",c,"to"]})}}))(ot),{ApiFeatureMarkupsOverrideSchema:mt}=((e,i,n)=>({ApiFeatureMarkupsOverrideSchema:e.strictObject({default_markup:e.number().min(-100).optional().meta({description:"Default percentage markup for customers on this plan. Use -100 to make usage free."}),provider_markups:i.meta({description:"Per-provider markup percentages for customers on this plan."}),model_markups:n.meta({description:"Per-model markup overrides for customers on this plan."})})}))(t,st,Ye),{isValidCurrencyCode:dt}=(e=>({isValidCurrencyCode:n=>!!n&&e.has(n.toLowerCase())}))(ct),{ApiCreditDimensionSchema:pt}=((e,i,n,r)=>({ApiCreditDimensionSchema:e.union([i.extend({tier_behavior:e.literal("graduated"),tiers:e.array(n).min(1)}).strict().superRefine(r),i.extend({credit_cost:e.number().min(0).meta({description:"Credits consumed per billing-unit group when this dimension matches."})}).strict()])}))(t,ut,ue,fe),{CurrencyCodeSchema:be}=((e,i)=>({CurrencyCodeSchema:e.string().refine(i,"must be a Stripe-supported currency code").meta({description:"Three-letter Stripe-supported currency code (e.g. 'eur', 'gbp')."})}))(t,dt),{AdditionalCurrencyTierSchema:lt}=((e,i)=>({AdditionalCurrencyTierSchema:e.object({currency:i,amount:e.number().optional().meta({description:"Per-unit amount for this tier in this currency."}),flat_amount:e.number().optional().meta({description:"Flat amount for this tier in this currency, if the tier uses one."})}).refine(r=>r.amount!==void 0||r.flat_amount!==void 0,{message:"Either amount or flat_amount, or both must be defined",path:["amount","flat_amount"]})}))(t,be),{ApiCreditSchemaItemBaseSchema:ye}=((e,i,n,r)=>({ApiCreditSchemaItemBaseSchema:e.object({metered_feature_id:e.string().nonempty().meta({description:"ID of the metered feature that draws from this credit system."}),billing_units:e.number().positive().optional().meta({description:"Number of metered-feature units priced together. Defaults to one when omitted."}),dimensions:e.record(i,n).optional().meta({description:"Named rates chosen by event properties. The most specific match sets the rate; with no match the item's own rate applies."}),multipliers:e.record(i,r).optional().meta({description:"Named adjustments chosen by event properties. Every match applies: factors multiply, then adds are summed."})})}))(t,rt,pt,at),{ApiFlatCreditSchemaItemSchema:ht}=((e,i)=>({ApiFlatCreditSchemaItemSchema:e.extend({credit_cost:i.number().min(0).meta({description:"Credits consumed per billing-unit group."})}).strict()}))(ye,t),{AdditionalCurrencyPriceSchema:ft}=((e,i)=>({AdditionalCurrencyPriceSchema:e.object({currency:i,amount:e.number().meta({description:"Price amount in this currency. Set explicitly per currency, not converted from the base amount."})})}))(t,be),{AdditionalCurrencyTierArraySchema:bt}=((e,i,n,r)=>({AdditionalCurrencyTierArraySchema:e.array(i).refine(n,{message:r})}))(t,lt,ae,se),{ApiGraduatedCreditSchemaItemSchema:yt}=((e,i,n,r)=>({ApiGraduatedCreditSchemaItemSchema:e.extend({tier_behavior:i.literal("graduated"),tiers:i.array(n).min(1)}).strict().superRefine(r)}))(ye,t,ue,fe),{AdditionalCurrencyPriceArraySchema:ge}=((e,i,n,r)=>({AdditionalCurrencyPriceArraySchema:e.array(i).refine(n,{message:r})}))(t,ft,ae,se),{ApiUsageTierWithCurrenciesSchema:gt}=((e,i,n)=>({ApiUsageTierWithCurrenciesSchema:e.object({to:e.number().or(e.literal(i)),amount:e.number().optional(),flat_amount:e.number().optional(),additional_currencies:n.optional().meta({description:"Per-currency amounts for this tier. Tier boundaries ('to') are shared across all currencies."})}).refine(o=>o.amount!==void 0||o.flat_amount!==void 0,{message:"Either amount or flat_amount, or both must be defined",path:["amount","flat_amount"]}).transform(o=>({...o,amount:o.amount??0})).pipe(e.object({to:e.number().or(e.literal(i)),amount:e.number(),flat_amount:e.number().optional(),additional_currencies:n.optional()}))}))(t,Qe,bt),{ApiCreditSchemaItemSchema:St}=((e,i,n)=>({ApiCreditSchemaItemSchema:e.union([i,n])}))(t,yt,ht),{BasePriceParamsSchema:_t}=((e,i,n,r)=>({BasePriceParamsSchema:e.omit({display:!0}).extend({interval_count:i({schema:n.number().optional(),defaultValue:1,description:"Number of intervals per billing cycle. Defaults to 1."}),additional_currencies:r.optional().meta({description:"Base price amounts in additional currencies. The base 'amount' is in the org's default currency."}),base_currency:n.string().optional().meta({internal:!0}),entitlement_id:n.string().optional().meta({internal:!0}),price_id:n.string().optional().meta({internal:!0}),stripe_price_id:n.string().optional().meta({description:"Stripe price id this base price is billed under. Set by sync flows to capture the actual Stripe price when it differs from the catalog default.",internal:!0})}).meta({title:"BasePrice",description:"Base price configuration for a plan."})}))(tt,Be,t,ge),{PlanItemPriceParamsSchema:xt}=((e,i,n,r,o,c,a)=>({PlanItemPriceParamsSchema:e.object({stripe_price_id:e.string().nullish().transform(p=>p??void 0).meta({description:"Stripe price id this feature price is billed under. Set by sync flows to preserve an existing Stripe price.",internal:!0}).optional(),amount:e.number().optional().meta({description:"Price per billing_units after included usage. Either 'amount' or 'tiers' is required."}),additional_currencies:i.optional().meta({description:"Amounts in additional currencies for this flat price. The base 'amount' is in the org's default currency. Only valid with 'amount', not 'tiers'."}),tiers:e.array(n).optional().meta({description:"Tiered pricing. Either 'amount' or 'tiers' is required."}),tier_behavior:e.enum(r).optional(),interval:e.enum(o).meta({description:"Billing interval. For consumable features, should match reset.interval."}),interval_count:e.number().default(1).optional().meta({description:"Number of intervals per billing cycle. Defaults to 1."}),billing_units:e.number().default(1).optional().meta({description:"Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200)."}),billing_method:e.enum(c).meta({description:"'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go."}),allocated_billing:a,max_purchase:e.number().nullish().meta({description:"Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. Null for no limit."})})}))(t,ge,gt,$e,re,ce,nt),{ApiFeatureOverrideSchema:It}=((e,i,n)=>({ApiFeatureOverrideSchema:e.strictObject({credit_schema:e.array(i).optional().meta({description:"For credit system features: replaces the feature's credit_schema entirely for customers on this plan."}),markups:n.optional().meta({description:"For AI credit system features: replaces the feature's markup chain entirely for customers on this plan. An unset level means no markup at that level rather than inheriting the feature's."})})}))(t,St,mt),{InvoiceBasePriceParamsSchema:Se}=((e,i)=>({InvoiceBasePriceParamsSchema:e.pick({amount:!0,interval:!0,interval_count:!0}).extend({processors:i.optional().meta({description:"Bill this line under an existing Stripe price instead of an inline one."})}).strict()}))(_t,pe),{InvoiceItemPriceParamsSchema:vt}=((e,i)=>({InvoiceItemPriceParamsSchema:e.pick({amount:!0,tiers:!0,tier_behavior:!0,interval:!0,interval_count:!0,billing_units:!0,billing_method:!0}).extend({processors:i.optional().meta({description:"Bill this line under an existing Stripe price instead of an inline one."})}).strict()}))(xt,pe),{InvoiceLicenseQuantitySchema:At}=((e,i,n)=>({InvoiceLicenseQuantitySchema:e.object({license_plan_id:e.string().meta({description:"The license plan linked to the parent plan."}),quantity:e.number().int().nonnegative().meta({description:"Billable seats, exclusive of any included seats."}),customize:e.object({price:i.nullable().optional()}).strict().optional().meta({description:"Override the license's per-seat price on this invoice."}),feature_quantities:e.array(n).optional().meta({description:"Feature charges priced through the license plan."}),prorate:e.boolean().optional().meta({description:"Whether to prorate seat charges against period_start / period_end. Defaults to true."})}).strict()}))(t,Se,he),{InvoiceCustomizeItemSchema:Ct}=((e,i,n)=>({InvoiceCustomizeItemSchema:e.object({feature_id:e.string().meta({description:"The feature whose pricing is overridden on this invoice."}),price:i.optional().meta({description:"Pricing to use for this feature on this invoice."}),feature_override:n.pick({credit_schema:!0}).strict().optional().meta({description:"For credit-system features: a credit rate card to use when converting `usage` on this invoice."})}).strict()}))(t,vt,It),{InvoiceCustomizeSchema:Ot}=((e,i,n)=>({InvoiceCustomizeSchema:e.object({price:i.nullable().optional().meta({description:"Override the plan's base price for this invoice. Pass null or an amount of 0 to omit the base price line."}),items:e.array(n).optional().meta({description:"Override feature pricing for this invoice. Only pricing fields are accepted; grants, resets and rollovers are not part of an invoice."})}).strict().meta({title:"InvoiceCustomize",description:"Pricing overrides applied to this invoice only. The catalog and the customer's plan are not changed."})}))(t,Se,Ct),{InvoicePlanParamsSchema:Pt}=((e,i,n,r,o)=>({InvoicePlanParamsSchema:e.object({plan_id:e.string().meta({description:"The catalog plan (or variant) whose pricing to use."}),version:e.number().optional().meta({description:"Plan version. Defaults to the active version."}),customize:i.optional(),feature_quantities:e.array(n).optional(),license_quantities:e.array(r).optional(),discounts:e.array(o).optional().meta({description:"Discounts applied only to this plan's lines."}),prorate:e.boolean().optional().meta({description:"Whether to prorate the base price against period_start / period_end. Defaults to true."})}).strict()}))(t,Ot,he,At,de),{CreateInvoiceParamsSchema:wi}=((e,i,n,r,o)=>({CreateInvoiceParamsSchema:e.object({customer_id:e.string().meta({description:"The customer to invoice."}),plans:e.array(i).optional(),custom_line_items:e.array(n).optional().meta({description:"Charges that are not tied to any plan or feature."}),discounts:e.array(r).optional().meta({description:"Discounts applied to the whole invoice."}),invoice_template_id:e.string().optional().meta({description:"ID of an invoice template whose footer, memo and default payment terms are applied."}),net_terms_days:e.number().int().positive().optional().meta({description:"Days until the invoice is due. Defaults to the template's terms, then the org default."}),tax_rate_id:e.string().optional().meta({description:"Stripe tax rate ID (txr_...) applied to every line."}),period_start:o.optional().meta({description:"Start of the period being invoiced, in milliseconds. Prorated lines are charged for period_start \u2192 period_end against one price interval starting at period_start."}),period_end:o.optional().meta({description:"End of the period being invoiced, in milliseconds."}),preview:e.boolean().optional().meta({description:"If true, returns the calculated lines and totals without creating an invoice."})}).strict().refine(a=>a.period_start===void 0==(a.period_end===void 0),{message:"period_start and period_end must be provided together."}).refine(a=>a.period_start===void 0||a.period_end===void 0||a.period_end>a.period_start,{message:"period_end must be after period_start."})}))(t,Pt,Xe,de,ze);var Ki=t.strictObject({requestId:t.uuid(),predecessorOperationId:t.uuid().optional(),invoiceMode:l.optional(),entityId:t.uuid().optional(),billingSubscriptionId:t.uuid().optional(),newBillingSubscription:t.literal(!0).optional(),offerId:t.uuid().optional(),nativeOffer:_.optional(),plans:t.array(t.strictObject({productVersionId:t.uuid(),seatQuantities:t.record(v,t.number().int().min(0).max(1e4)).optional(),featureQuantities:t.record(t.uuid(),t.number().int().min(0).max(1e4)).refine(e=>Object.keys(e).length<=100,"At most 100 feature quantities").optional()})).min(1).max(20).refine(e=>new Set(e.map(i=>i.productVersionId)).size===e.length,"Plan versions must be unique"),provider:t.enum(["stripe","apple","google","merchant"]),currency:u}).refine(e=>!e.offerId||!e.billingSubscriptionId&&(["stripe","merchant"].includes(e.provider)||e.nativeOffer!==void 0),"Held offers apply to new purchases; existing subscriptions use billing coupons").refine(e=>!e.nativeOffer||["apple","google"].includes(e.provider)&&e.plans.length===1,"A store selection applies to exactly one native SKU").refine(e=>!e.newBillingSubscription||["stripe","merchant"].includes(e.provider)&&!e.billingSubscriptionId,"A new billing subscription has no existing subscription target").refine(e=>!e.invoiceMode?.enabled||e.provider==="stripe"&&!e.entityId,"Invoice mode requires a Stripe subscription without an Entity target"),Vi=t.strictObject({operationId:t.uuid()}),s=t.number().int().min(0).max(1e8),Mt=t.strictObject({lineId:t.uuid(),productVersionId:t.uuid(),productName:t.string().min(1).max(80),interval:t.enum(["free","week","month","year","one_time"]),intervalCount:t.number().int().min(1).max(156).optional(),baseAmountMinor:s,seats:t.array(t.strictObject({key:v,quantity:t.number().int().min(0).max(1e4),includedQuantity:t.number().int().min(0).max(1e4),maximumQuantity:t.number().int().min(0).max(1e4),unitAmountMinor:s})).max(20),prepaid:t.array(ne).max(100).optional(),catalogAmountMinor:s,trial:L.nullable()}).refine(e=>new Set(e.seats.map(i=>i.key)).size===e.seats.length&&e.seats.every(i=>i.quantity>=i.includedQuantity&&i.quantity<=i.maximumQuantity)&&e.baseAmountMinor+e.seats.reduce((i,n)=>i+n.unitAmountMinor*(n.quantity-n.includedQuantity),0)+(e.prepaid??[]).reduce((i,n)=>i+g({quantity:n.quantity,unitAmountMinor:n.unitAmountMinor,...n.pricing===void 0?{}:{pricing:n.pricing}}),0)===e.catalogAmountMinor,"Quote must retain its published base price and component quantities"),Ie=t.string().regex(/^[A-Za-z0-9_-]{1,200}$/),wt=t.strictObject({id:Ie,name:t.string().min(1).max(40),percent_off:t.number().gt(0).max(100).optional(),amount_off:t.number().int().positive().optional(),currency:t.string().regex(/^[a-z]{3}$/).optional(),duration:t.enum(["once","repeating","forever"]),duration_in_months:t.number().int().min(1).max(36).optional()}).refine(e=>e.percent_off===void 0!=(e.amount_off===void 0)&&e.amount_off===void 0==(e.currency===void 0)&&e.duration==="repeating"==(e.duration_in_months!==void 0),"A Stripe coupon has one percentage or amount and months only when repeating"),Tt=t.strictObject({subscriptionId:t.string().regex(/^sub_[A-Za-z0-9]+$/),customerId:t.string().regex(/^cus_[A-Za-z0-9]+$/),sourceItems:t.array(t.strictObject({id:t.string(),price_id:t.string(),quantity:t.number().int().nonnegative(),discounts:t.array(t.strictObject({id:t.string(),coupon:t.string(),start:t.number(),end:t.number().nullable()})).optional()})).min(1).max(100),prorationDate:t.number().int().nonnegative(),amountMinor:t.number().int().positive(),periodStartMs:t.number(),periodEndMs:t.number()}),ve=t.strictObject({invoiceMode:l.optional(),append:Tt.optional(),provider:t.literal("stripe"),executor:t.enum(["indiana","merchant"]),accountId:t.string().regex(/^acct_[A-Za-z0-9]+$/),mode:t.enum(["payment","subscription"]),lineItems:t.array(t.strictObject({price:t.string().regex(/^price_[A-Za-z0-9]+$/).nullable(),quantity:t.number().int().min(1).max(1e4),priceId:t.uuid(),productName:t.string().min(1).max(80),amountMinor:t.number().int().min(0).max(1e8),currency:t.string().regex(/^[a-z]{3}$/),interval:t.enum(["week","month","year","one_off"]),intervalCount:t.number().int().min(1).max(52),slot:t.enum(["stripe_price_id","stripe_empty_price_id"]),tiers:t.strictObject({mode:t.enum(["graduated","volume"]),tiers:t.array(t.strictObject({upTo:t.number().int().min(1).max(1e6).nullable(),unitAmountMinor:t.number().int().min(0).max(1e8),flatAmountMinor:t.number().int().min(0).max(1e8).optional()})).min(2).max(12)}).nullable()})).min(1).max(100),discounts:t.array(t.strictObject({coupon:Ie,terms:wt})).max(1),trialPeriodDays:t.number().int().min(1).max(730).nullable(),metadata:t.strictObject({grooveCheckoutId:t.uuid(),grooveCustomerId:t.uuid()}),expiresAt:t.iso.datetime({offset:!0})}),U=t.strictObject({operationId:t.uuid(),merchantTerms:b.optional(),entityId:t.uuid().nullable(),billingSubscriptionId:t.uuid().nullable(),discount:t.strictObject({offerId:t.uuid(),couponId:t.uuid(),discount:x,duration:I,amountMinor:s,allocations:t.array(t.strictObject({productVersionId:t.uuid(),amountMinor:s})).min(1).max(20),expiresAt:t.iso.datetime({offset:!0})}).nullable(),charge:t.strictObject({effectiveAt:t.iso.datetime({offset:!0}),periodEndsAt:t.iso.datetime({offset:!0}),debitMinor:s,discountMinor:s,taxMinor:s,totalMinor:s}).nullable(),expiresAt:t.iso.datetime({offset:!0}),provider:t.enum(["stripe","apple","google","merchant"]),nativeOffer:_.optional(),currency:u,lines:t.array(Mt).min(1).max(20),catalogAmountMinor:s,nativeDiscountMinor:s.optional(),automaticTax:t.boolean(),execution:t.union([ve,M]).nullable()}).refine(e=>!e.merchantTerms||e.provider==="merchant"&&y(e.merchantTerms,e.operationId,"purchase",e.currency)).refine(e=>e.provider==="merchant"?e.execution?.provider==="merchant"&&e.execution.operationId===e.operationId&&e.execution.catalogAmountMinor===e.catalogAmountMinor&&e.execution.currency===e.currency&&Date.parse(e.execution.expiresAt)<=Date.parse(e.expiresAt)&&e.execution.trialPeriodDays===(e.lines[0]?.trial?.days??null)&&e.execution.discount?.grantId===e.discount?.offerId:e.provider==="stripe"?e.execution?.provider!=="merchant"&&(e.lines[0]?.trial?.cardRequired===!1&&!e.execution?.invoiceMode?.enabled?e.execution===null&&e.discount===null:e.execution!==null&&e.execution.metadata.grooveCheckoutId===e.operationId&&Date.parse(e.execution.expiresAt)<=Date.parse(e.expiresAt)&&e.execution.mode===(e.lines.some(i=>!["one_time","free"].includes(i.interval))?"subscription":"payment")&&e.execution.trialPeriodDays===(e.lines[0]?.trial?.days??null)&&(e.execution.executor==="indiana"||e.execution.lineItems.every(i=>i.price!==null))&&e.execution.discounts.every(i=>i.coupon===i.terms.id)&&e.execution.discounts.length===(e.discount?1:0)&&e.execution.discounts.every(i=>e.discount!==null&&(i.coupon===e.discount.couponId||e.discount.discount.type==="amount"&&i.coupon===`${e.discount.couponId}_credit_${e.discount.offerId}_${i.terms.amount_off}`&&i.terms.amount_off===e.discount.discount.amountOffCents&&i.terms.currency?.toUpperCase()===e.currency&&i.terms.duration==="once"))):e.execution===null,"Stripe execution must carry the quote identity, expiry, mode, trial and held coupon").refine(e=>(!e.discount||!e.billingSubscriptionId&&(["stripe","merchant"].includes(e.provider)||e.discount.duration.type==="once")&&e.discount.amountMinor<=e.catalogAmountMinor&&e.discount.allocations.length===e.lines.length&&e.discount.allocations.every((i,n)=>{let r=e.lines[n];return r!==void 0&&i.productVersionId===r.productVersionId&&i.amountMinor<=r.catalogAmountMinor})&&e.discount.allocations.reduce((i,n)=>i+n.amountMinor,0)===e.discount.amountMinor)&&(["stripe","merchant"].includes(e.provider)?e.nativeOffer===void 0:e.nativeOffer!==void 0&&e.lines.length===1&&e.nativeOffer.discountMinor<=e.catalogAmountMinor&&e.nativeOffer.trialDays===(e.lines[0]?.trial?.days??null)&&(!e.discount||e.nativeOffer.discountMinor===e.discount.amountMinor))&&(!e.charge||e.billingSubscriptionId!==null&&e.charge.totalMinor===e.charge.debitMinor-e.charge.discountMinor+e.charge.taxMinor&&e.charge.discountMinor<=e.charge.debitMinor&&Date.parse(e.charge.periodEndsAt)>Date.parse(e.charge.effectiveAt))&&new Set(e.lines.map(i=>i.lineId)).size===e.lines.length&&e.lines.reduce((i,n)=>i+n.catalogAmountMinor,0)===e.catalogAmountMinor,"Quote lines must conserve the catalog amount"),Ae=t.strictObject({operationId:t.uuid(),orderId:t.uuid(),append:t.boolean().optional(),invoiceMode:t.boolean().optional(),status:t.enum(["pending","complete","cancelled","failed"]),executor:t.enum(["indiana","merchant"]),checkoutUrl:t.url().refine(e=>new URL(e).protocol==="https:").nullable(),execution:t.union([ve,M]).nullable(),currency:u,catalogAmountMinor:s,taxMinor:s,totalMinor:t.number().int().min(0).max(2e8).nullable(),quoteFinalized:t.boolean(),nativePurchase:R.nullable(),confirmedAt:t.iso.datetime({offset:!0}).nullable().optional(),quote:U.optional(),merchantExecution:f.nullable().optional(),problem:h.nullable().optional(),authority:S.optional()}).refine(e=>(e.checkoutUrl===null||e.executor==="indiana"||e.merchantExecution?.type==="purchase")&&(e.execution===null||e.executor==="merchant"),"Only Indiana-executed purchases carry a Checkout URL and only record-only purchases carry execution instructions"),C=t.strictObject({enabled:t.literal(!0),featureIds:t.array(t.uuid()).min(1).max(100).refine(e=>new Set(e).size===e.length,"Feature IDs must be unique").optional()}),Hi=t.strictObject({requestId:t.uuid(),offerId:t.uuid().optional(),invoiceMode:l.optional(),membershipId:t.uuid(),carryOverBalances:C.optional(),carryOverUsages:C.optional(),membershipIds:t.array(t.uuid()).min(1).max(20).optional(),prorationBehavior:t.enum(["prorate_immediately","none","bill_difference"]).optional(),timing:t.enum(["immediate","renewal","store"]),change:t.discriminatedUnion("type",[t.strictObject({type:t.literal("plan"),productVersionId:t.uuid(),featureQuantities:t.record(t.uuid(),t.number().int().min(0).max(1e4)).refine(e=>Object.keys(e).length<=100).optional()}),t.strictObject({type:t.literal("seats"),licenseKey:v,quantity:t.number().int().min(0).max(1e4)}),t.strictObject({type:t.literal("quantity"),internal_feature_id:t.uuid(),quantity:t.number().int().min(0).max(1e4)}),t.strictObject({type:t.literal("cancel")}),t.strictObject({type:t.literal("uncancel")}),t.strictObject({type:t.literal("billing_cycle"),billingCycleAnchor:t.union([t.literal("now"),t.number().int().positive().max(0xe677d21fdbff)])})])}).refine(e=>!e.offerId||e.change.type==="plan"&&e.timing!=="store","A selected plan-change offer requires a merchant target Product").refine(e=>e.timing!=="store"||e.change.type==="plan","Store timing applies to a native plan replacement").refine(e=>e.change.type!=="billing_cycle"||e.timing===(e.change.billingCycleAnchor==="now"?"immediate":"renewal"),"Use immediate for now and renewal for a future millisecond anchor").refine(e=>!e.membershipIds||["cancel","uncancel"].includes(e.change.type)&&e.membershipIds.includes(e.membershipId)&&new Set(e.membershipIds).size===e.membershipIds.length,"Grouped actions require unique cancel/uncancel targets including the primary membership").refine(e=>!e.carryOverBalances&&!e.carryOverUsages||e.change.type==="plan"&&e.timing==="immediate","Carry applies only to immediate upgrades").refine(e=>!e.prorationBehavior||e.change.type==="quantity","prorationBehavior applies to prepaid quantity changes"),A=t.string().regex(/^price_[A-Za-z0-9]+$/),_e=t.strictObject({grooveUpdateId:t.uuid(),grooveCustomerId:t.uuid()}),xe=t.strictObject({price:A.nullable(),priceId:t.uuid().optional(),quantity:t.number().int().min(0).max(1e4)}),Ce=t.strictObject({provider:t.literal("stripe"),invoiceMode:l.optional(),executor:t.enum(["indiana","merchant"]),accountId:t.string().regex(/^acct_[A-Za-z0-9]+$/),subscriptionId:t.string().regex(/^sub_[A-Za-z0-9]+$/),action:t.enum(["update","cancel","schedule","release"]),update:t.strictObject({items:t.array(xe).max(20),remove:t.array(A).max(20),restoreItems:t.array(t.strictObject({price:A,quantity:t.number().int().min(0).max(1e4)})).min(1).max(20).optional(),prorationBehavior:t.enum(["always_invoice","create_prorations","none"]).optional(),prorationDate:t.number().int().positive().optional(),paymentBehavior:t.literal("error_if_incomplete").optional(),cancelAtPeriodEnd:t.boolean().optional(),clearCancelAt:t.literal(!0).optional(),billingCycleAnchorNow:t.literal(!0).optional(),metadata:_e}).nullable(),cancel:t.strictObject({prorate:t.literal(!1),invoiceNow:t.literal(!1)}).nullable(),schedule:t.strictObject({currentItems:t.array(t.strictObject({price:A,quantity:t.number().int().min(0).max(1e4)})).max(20),nextItems:t.array(xe).min(1).max(20),switchAt:t.number().int().positive(),interval:t.enum(["week","month","year"]),intervalCount:t.number().int().min(1).max(52),resetBillingCycleAnchor:t.literal(!0).optional(),metadata:_e}).nullable(),release:t.strictObject({schedule:t.string().regex(/^sub_sched_[A-Za-z0-9]+$/)}).nullable(),expiresAt:t.iso.datetime({offset:!0})}).refine(e=>["update","cancel","schedule","release"].every(i=>e[i]!==null==(e.action===i))&&(e.executor==="indiana"||[...e.update?.items??[],...e.schedule?.nextItems??[]].every(i=>i.price!==null)),"Stripe update execution carries exactly its action, with bound Prices for the merchant"),O=t.strictObject({merchantTerms:b.optional(),carryOverBalances:C.optional(),carryOverUsages:C.optional(),operationId:t.uuid(),membershipId:t.uuid(),productVersionId:t.uuid(),featureQuantities:t.record(t.uuid(),t.number().int().min(0).max(1e4)).refine(e=>Object.keys(e).length<=100).optional(),timing:t.enum(["immediate","renewal"]),effectiveAt:t.iso.datetime({offset:!0}),expiresAt:t.iso.datetime({offset:!0}),currency:u,creditMinor:s,debitMinor:s,discountMinor:s,taxMinor:s,totalMinor:s,retainedProductVersionIds:t.array(t.uuid()).max(19),execution:t.union([Ce,w])}).refine(e=>!e.merchantTerms||e.execution.provider==="merchant"&&y(e.merchantTerms,e.operationId,"subscription_change",e.currency)),q=t.strictObject({operationId:t.uuid(),invoiceMode:t.boolean().optional(),membershipId:t.uuid(),productVersionId:t.uuid(),featureQuantities:t.record(t.uuid(),t.number().int().min(0).max(1e4)).refine(e=>Object.keys(e).length<=100).optional(),status:t.enum(["prepared","quoted","confirmed","pending","scheduled","effective","cancelled","failed"]),timing:t.enum(["immediate","renewal"]),effectiveAt:t.iso.datetime({offset:!0}),checkoutUrl:t.url().refine(e=>new URL(e).protocol==="https:").nullable(),executor:t.enum(["indiana","merchant"]),execution:t.union([Ce,w]).nullable(),confirmedAt:t.iso.datetime({offset:!0}).nullable().optional(),merchantExecution:f.nullable().optional(),problem:h.nullable().optional(),quote:O.optional(),authority:S.optional()}).refine(e=>e.execution===null||e.executor==="merchant","Only record-only changes carry execution instructions"),jt=t.strictObject({operationId:t.uuid(),membershipId:t.uuid(),productVersionId:t.uuid(),timing:t.literal("store"),effectiveAt:t.null(),expiresAt:t.iso.datetime({offset:!0}),currency:u,creditMinor:t.null(),debitMinor:t.null(),discountMinor:t.null(),taxMinor:t.null(),totalMinor:t.null(),retainedProductVersionIds:t.array(t.uuid()).max(19),store:t.strictObject({provider:t.enum(["apple","google"]),productId:t.string().min(1).max(255),catalogAmountMinor:s,policy:t.enum(["apple_store","google_full_price"])})}),Et=t.strictObject({operationId:t.uuid(),membershipId:t.uuid(),productVersionId:t.uuid(),status:t.enum(["prepared","pending","effective","cancelled","failed"]),timing:t.literal("store"),effectiveAt:t.iso.datetime({offset:!0}).nullable(),checkoutUrl:t.null(),nativePurchase:R.nullable()}),Zi=t.union([O,jt]),Wi=t.union([q,Et]),B=F,d=G,Yi=t.strictObject({requestId:t.uuid(),invoiceId:t.uuid(),...E.shape}).refine(j,"A partial refund states amountMinor; a full refund refunds the remaining amount"),Oe=t.strictObject({provider:t.literal("stripe"),executor:t.enum(["indiana","merchant"]),accountId:t.string().regex(/^acct_[A-Za-z0-9]+$/),invoice:t.string().regex(/^in_[A-Za-z0-9]+$/),amountMinor:B,currency:t.string().regex(/^[a-z]{3}$/),metadata:t.strictObject({indianaRefundId:t.uuid()}),idempotencyKey:t.string().regex(/^indiana-refund-[0-9a-f-]{36}$/),cancelSubscriptions:t.array(t.string().regex(/^sub_[A-Za-z0-9]+$/)).max(20)}),Dt=t.strictObject({operationId:t.uuid(),merchantTerms:b.optional(),invoiceId:t.uuid(),providerInvoiceId:t.string().min(1).max(200),currency:u,paidMinor:d,refundedMinor:d,pendingMinor:d,amountMinor:B,mode:t.enum(["full","partial"]),entitlementAction:t.enum(["retain","revoke"]),revokes:t.strictObject({customerProductIds:t.array(t.uuid()).max(100),subscriptionIds:t.array(t.string().min(1).max(200)).max(20)}),execution:t.union([Oe,T]),expiresAt:t.iso.datetime({offset:!0})}).refine(e=>!e.merchantTerms||e.execution.provider==="merchant"&&y(e.merchantTerms,e.operationId,"refund",e.currency)).refine(e=>e.amountMinor<=e.paidMinor-e.refundedMinor-e.pendingMinor&&e.execution.amountMinor===e.amountMinor&&(e.execution.provider==="merchant"?e.execution.merchantInvoiceId===e.providerInvoiceId&&e.execution.operationId===e.operationId&&e.execution.currency===e.currency:e.execution.invoice===e.providerInvoiceId&&e.execution.metadata.indianaRefundId===e.operationId&&e.execution.currency===e.currency.toLowerCase())&&(e.entitlementAction==="revoke"||e.revokes.customerProductIds.length===0&&e.revokes.subscriptionIds.length===0),"Refund quote must stay within the refundable amount and match its execution"),kt=t.strictObject({operationId:t.uuid(),invoiceId:t.uuid(),providerInvoiceId:t.string().min(1).max(200),status:t.enum(["quoted","pending","succeeded","failed","expired"]),executor:t.enum(["indiana","merchant"]),currency:u,amountMinor:B,mode:t.enum(["full","partial"]),entitlementAction:t.enum(["retain","revoke"]),refundId:t.string().min(1).max(200).nullable(),quote:Dt.optional(),execution:t.union([Oe,T]).nullable(),confirmedAt:t.iso.datetime({offset:!0}).nullable().optional(),merchantExecution:f.nullable().optional(),problem:h.nullable().optional(),authority:S.optional(),failureReason:t.string().min(1).max(200).nullable(),createdAt:t.iso.datetime({offset:!0}),completedAt:t.iso.datetime({offset:!0}).nullable()}).refine(e=>(e.execution===null||e.executor==="merchant"&&e.status==="quoted")&&(e.status!=="succeeded"||e.refundId!==null),"Only quoted record-only refunds carry instructions; a succeeded refund names its Stripe refund"),Ji=t.strictObject({invoiceId:t.uuid(),currency:u,paidMinor:d,refundedMinor:d,pendingMinor:d,refundableMinor:d,executor:t.enum(["indiana","merchant"]).nullable(),canRefund:t.boolean(),operations:t.array(kt).max(50)}).refine(e=>e.operations.every(i=>i.invoiceId===e.invoiceId),"Refund operations belong to the invoice"),Xi=t.strictObject({requestId:t.uuid(),...E.shape}).refine(j,"A partial refund states amountMinor; a full refund refunds the remaining amount");var nn=t.strictObject({membershipId:t.uuid(),timing:t.enum(["immediate","renewal"])}),rn=t.union([U,O]),on=t.union([Ae,q]);function an(e){return"membershipId"in e}function Pe(e){return"membershipId"in e}function sn(e){return Pe(e)?e.status==="effective"||e.status==="scheduled":e.status==="complete"}function cn(e){return Pe(e)?["prepared","quoted","confirmed","pending"].includes(e.status):e.status==="pending"}export{_ as a,Xt as b,we as c,Te as d,Ut as e,x as f,I as g,Re as h,di as i,pi as j,Oi as k,Mi as l,wi as m,Ki as n,Vi as o,U as p,Ae as q,Hi as r,O as s,Zi as t,Wi as u,Yi as v,Dt as w,kt as x,nn as y,rn as z,on as A,an as B,Pe as C,sn as D,cn as E};
|
package/dist/chunk-YPN2ZL2V.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t="https://api.longplayai.com";var p={name:"@tinkerlandai/longplay-sdk",version:"0.10.46",description:"Framework-independent Longplay SDK for customer identity, entitlements, credits, offers and growth surfaces.",license:"UNLICENSED",repository:{type:"git",url:"git+https://github.com/tinkerlandai/Indiana.git",directory:"packages/sdk"},engines:{node:">=22"},publishConfig:{access:"public",tag:"beta"},type:"module",sideEffects:!1,files:["dist","README.md","README.zh-CN.md","CHANGELOG.md","THIRD_PARTY_NOTICES.md"],exports:{"./react-native":{types:"./dist/react-native.d.ts","react-native":"./dist/react-native.js",import:"./dist/react-native.js",default:"./dist/react-native.js"},".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./popup":{types:"./dist/popup.d.ts",import:"./dist/popup.js"},"./server":{types:"./dist/server.d.ts",import:"./dist/server.js"},"./openrouter":{types:"./dist/openrouter.d.ts",import:"./dist/openrouter.js"},"./native-shell":{types:"./dist/native-shell.d.ts",import:"./dist/native-shell.js"},"./page":{types:"./dist/page.d.ts",import:"./dist/page.js"},"./visual":{types:"./dist/visual.d.ts",import:"./dist/visual.js"}},scripts:{build:"tsup",prepack:"pnpm run build",typecheck:"tsc --noEmit && tsc --noEmit -p tsconfig.test.json",lint:"node ../../scripts/ci/lint.mjs --workspace packages/sdk"},dependencies:{"@ai-sdk/provider":"4.0.26","@types/json-schema":"7.0.15","css-tree":"^3.2.1","dom-mutator":"0.7.0",dompurify:"^3.4.15",zod:"4.6.6"},devDependencies:{"@indiana/contracts":"workspace:*","@openrouter/sdk":"^1.4.25","@types/css-tree":"^3.2.0",ai:"7.0.136",tsup:"^8.5.1",typescript:"^5.9.3","whatwg-url-minimum":"0.2.0"},peerDependencies:{"@openrouter/sdk":"^1.4.25"},peerDependenciesMeta:{"@openrouter/sdk":{optional:!0}}};export{p as a,t as b};
|
package/dist/content-4Y57QHWP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as ie}from"./chunk-TWQB35B7.js";import{a as Z,c as ee,e as te,f as ne,h as N,j as re,k as oe,l as se}from"./chunk-HIUSHWDK.js";import{b as X}from"./chunk-7MTQQIGR.js";import{r as V}from"./chunk-MBWUIYCH.js";import"./chunk-L7OMFH4O.js";import"./chunk-JZ73DRHT.js";import"./chunk-ZQAAZ7Q4.js";import"./chunk-WQN2D5FZ.js";import"./chunk-JDUB4T4P.js";import"./chunk-VILB5M4X.js";import"./chunk-D3WC3T4U.js";import"./chunk-UIKMEVXM.js";import{o as Y,p as K}from"./chunk-GFSAWDV2.js";import{A as G}from"./chunk-GJLCTQJN.js";import"./chunk-4LIM2ZQR.js";import"./chunk-DTOYPMAW.js";import{c as $,d as R}from"./chunk-KAMYLHAT.js";import{a as p}from"./chunk-MFAEHTOH.js";import"./chunk-XB24ATBA.js";import"./chunk-YPN2ZL2V.js";import{b as u}from"./chunk-6RGARS6I.js";import{a as h}from"./chunk-DSPLGTQI.js";import"./chunk-XWD4N2QI.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";var z=new WeakMap;function ce(s){let t={string:u.string(),number:u.number().finite(),boolean:u.boolean(),strings:u.array(u.string()),json:R}[s.type];return s.nullable?t.nullable():t}function ae(s,t){let f=u.record(u.string(),R).parse(s);if(Object.keys(f).length>40)throw new p("INVALID_REQUEST","Too many content inputs");for(let[m,r]of Object.entries(f))Y.parse({[m]:r});if(Object.keys(f).some(m=>!Object.hasOwn(t.inputs,m)))throw new p("INVALID_REQUEST","Undeclared content input");for(let[m,r]of Object.entries(t.inputs))if(Object.hasOwn(f,m))ce(r).parse(f[m]);else if(r.required)throw new p("INVALID_REQUEST",`Missing content input ${m}`);return f}async function Ae(s,t){return le(s,t,!1)}async function Se(s,t){return le(s,t,!0)}async function le(s,t,f){t.signal?.throwIfAborted();let m=X.parse(t.content),r=m.document;if(t.closeControl==="content"&&!r.screen.actions.some(e=>e.type==="event"&&e.close))throw new p("INVALID_REQUEST","An authored Close control requires a declared Close action");if(z.has(s))throw new p("CONFLICT","Content is already mounted in this container");let y=ae(t.inputs??{},r.contract),T=new Set(u.array(u.string()).max(40).parse(t.mutableInputs??[]));if(T.size!==(t.mutableInputs?.length??0)||[...T].some(e=>!Object.hasOwn(r.contract.inputs,e)))throw new p("INVALID_REQUEST","Mutable content inputs must name unique declared inputs");for(let e of Object.keys(r.contract.outputs))if(typeof t.actions[e]!="function")throw new p("INVALID_REQUEST",`Missing host handler for ${e}`);let M=K.parse(t.bindings??[]),d=s.ownerDocument,ue=s.clientHeight||d.defaultView?.innerHeight||800,P,w,a,_,x=r.kind==="popup",n=x?d.createElement("dialog"):null,c=d.createElement("div");if(c.dataset.indianaContent=r.kind,c.setAttribute("aria-label",r.name),c.style.cssText="width:100%;min-width:0",n){n.setAttribute("aria-label",r.name);let e=r.screen.presentation;n.style.cssText="box-sizing:border-box;padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto",e.type==="modal"||e.type==="sheet"?(n.style.width=`${$[e.size]}px`,e.type==="sheet"&&(n.style.margin="auto auto 0")):n.style.width="100vw",a=ee(n,r.screen,()=>{w?.resizeViewport(d.defaultView?.innerHeight||800,d.defaultView?.innerWidth||1024)}),n.append(c),s.append(n)}else s.append(c);let i=!1,A=!1,E=!1,S=!1,de=n?oe(n):se(c,s),D=re(s,t,r.kind,()=>{k()&&(b(),h(t.onDismiss))}),q,H,L=new Promise((e,o)=>{q=e,H=o});L.catch(()=>{});let g=null,I=structuredClone(r.screen),W=G(I,[t.locale,...d.defaultView?.navigator.languages??[]]),j=t.capabilities;I.actions=I.actions.map(e=>e.type==="event"?{...e,close:!1}:e);function b(){i||(i=!0,t.signal?.removeEventListener("abort",b),D.finish("dismissed"),H(new Error("Content preparation cancelled")),a?.destroy(),_?.(),w?.destroy(),n?.close(),n?.remove(),c.remove(),z.delete(s),n&&P?.())}let v=()=>{!E||!k()||(b(),h(t.onDismiss))};function k(){try{return t.canDismiss?.()!==!1}catch(e){return h(t.onError,e),!1}}if(n&&t.closeControl!=="content"){let e=d.createElement("button");e.type="button",e.textContent="\xD7",e.setAttribute("aria-label",t.locale?.startsWith("zh")?"\u5173\u95ED":"Close"),ne(e,r.screen.theme),e.addEventListener("click",v),n.prepend(e)}n&&a?.responsive&&(_=Z(n,v,k,t.locale?.startsWith("zh")?"\u5173\u95ED":"Close"),n.addEventListener("click",e=>{if(e.target!==n)return;let o=n.getBoundingClientRect();(e.clientX<o.left||e.clientX>o.right||e.clientY<o.top||e.clientY>o.bottom)&&v()})),n?.addEventListener("cancel",e=>{e.preventDefault(),v()}),n?.addEventListener("keydown",e=>{e.key==="Escape"&&(e.preventDefault(),v())});async function F(){if(i||!E||A||!g)return;let e=g;A=!0,c.setAttribute("aria-busy","true");try{await t.actions[e.actionId](structuredClone(e)),g=null}catch(o){i||h(t.onError,o)}finally{A=!1,i||c.removeAttribute("aria-busy")}}function J(){if(i)throw new p("CONFLICT","Content host has been destroyed");E||!S||(P??=N(d),D.present(e=>{de(),n&&(a?.latch(),n.showModal(),a?.responsive&&n.focus({preventScroll:!0}),!e&&t.loading!=="host"&&te(n,a?.type??r.screen.presentation.type,a?.responsive)),E=!0}))}function U(e){D.finish("error",e),H(e instanceof Error?e:new Error(String(e))),b()}let Q={destroy:b,show:J,get pendingAction(){return g?structuredClone(g):null},retryAction:F,updateInputs(e){if(i)throw new p("CONFLICT","Content host has been destroyed");let o=u.record(u.string(),R).parse(e),C=ae({...y,...o},r.contract);for(let l of Object.keys(o))if(!T.has(l)&&(!Object.hasOwn(y,l)||V(y[l])!==V(C[l])))throw new p("PRECONDITION_FAILED","This content input is frozen; prepare a new presentation");V(y)!==V(C)&&(w?.update(I,W,{capabilities:j,serverInput:{bindings:M,answers:{},values:C}}),y=C)},updateCapabilities(e){if(i)return;let o=structuredClone(e);w?.updateCapabilities(o),j=o}};z.set(s,Q),t.signal?.addEventListener("abort",b,{once:!0});try{if(t.signal?.throwIfAborted(),f||(P=N(d),D.start(x,t.locale??r.screen.strings.defaultLocale),i&&await L),w=ie(c,{mode:"live",rendererUrl:t.rendererUrl,title:r.name,viewportHeight:r.kind==="page"?ue:a?.responsive?d.defaultView?.innerHeight||800:void 0,...a?.responsive?{viewportWidth:d.defaultView?.innerWidth||1024,hostPresentation:()=>a.type}:{},onResize:e=>{i||a?.responsive&&(c.style.height=`${e}px`,c.style.overflow="clip",a.setContentHeight(e))},onRendered:e=>{if(!i&&(e&&n?.setAttribute("aria-label",e),!S))try{S=!0,f||J(),q()}catch(o){U(o),h(t.onError,o)}},onError:e=>{if(i)return;let o=new Error(e);S||U(o),h(t.onError,o)},onEscape:x?v:void 0,onAction:(e,o,C)=>{if(i||!E||A||g)return;let l=r.screen.actions.find(O=>O.id===e),B=r.contract.outputs[e];if(!(l?.type!=="event"||!B)&&!(l.close&&!k()))try{let O=ce(B).parse(Object.hasOwn(l.properties,"value")?l.properties.value:l.properties);g=structuredClone({requestId:crypto.randomUUID(),contentVersionId:m.id,actionId:e,event:l.event,value:O,selection:o??{},answers:C??{},requestedClose:l.close}),F()}catch(O){h(t.onError,O)}}}),w.update(I,W,{capabilities:j,serverInput:{bindings:M,answers:{},values:y}}),await Promise.race([w.ready,L]),f&&await L,i)throw new Error("Content preparation cancelled");return Q}catch(e){throw U(e),e}}export{Ae as mountContent,Se as prepareContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as ee}from"./chunk-N3TAZ7HB.js";import{b as j}from"./chunk-PE5Y524X.js";import"./chunk-HMPIUYZ2.js";import"./chunk-W55G3VGB.js";import{a as Y}from"./chunk-N3C57R2I.js";import{b as X}from"./chunk-ANTKNFC6.js";import"./chunk-MMJBC6PW.js";import"./chunk-W32FI2A2.js";import{f as Z,h as $,i as V,j as B}from"./chunk-HIUSHWDK.js";import"./chunk-R2OJIXYE.js";import"./chunk-XQN7MLP5.js";import"./chunk-YHC5WAVP.js";import"./chunk-POOXIM6Q.js";import"./chunk-PPOPJTHA.js";import"./chunk-EIVFBGI5.js";import"./chunk-UBUFXGS7.js";import"./chunk-MBWUIYCH.js";import"./chunk-L7OMFH4O.js";import"./chunk-X2ON6QRA.js";import"./chunk-JZ73DRHT.js";import"./chunk-CRCAYVV5.js";import"./chunk-EQKTKITL.js";import"./chunk-ZQAAZ7Q4.js";import"./chunk-WQN2D5FZ.js";import"./chunk-JDUB4T4P.js";import"./chunk-VILB5M4X.js";import"./chunk-D3WC3T4U.js";import"./chunk-UIKMEVXM.js";import"./chunk-GFSAWDV2.js";import"./chunk-GJLCTQJN.js";import"./chunk-4LIM2ZQR.js";import"./chunk-DTOYPMAW.js";import"./chunk-KAMYLHAT.js";import{a as R}from"./chunk-MFAEHTOH.js";import"./chunk-XB24ATBA.js";import"./chunk-SLUA7ABW.js";import"./chunk-AAILPAL5.js";import"./chunk-3VUPVXAV.js";import"./chunk-YPN2ZL2V.js";import"./chunk-6RGARS6I.js";import{a as w}from"./chunk-DSPLGTQI.js";import"./chunk-XWD4N2QI.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";function te(S,e){let i=S.ownerDocument,v=(e.locale??i.documentElement.lang).startsWith("zh"),U=$(i),y=i.createElement("dialog"),E=i.createElement("h2"),h=i.createElement("p"),a=i.createElement("button"),f=i.createElement("button"),P=i.createElement("button");E.textContent=v?"\u8D2D\u4E70\u72B6\u6001":"Your purchase",E.style.cssText="margin:0;font-size:20px;line-height:1.3",y.setAttribute("aria-label",E.textContent),y.style.cssText="box-sizing:border-box;width:min(640px,calc(100% - 32px));max-height:calc(100dvh - 32px);padding:24px;border:0;border-radius:16px;background:Canvas;color:CanvasText;font:14px/1.5 system-ui,sans-serif",a.textContent="\xD7",a.setAttribute("aria-label",v?"\u5173\u95ED":"Close"),Z(a,{background:"Canvas",text:"CanvasText"}),h.setAttribute("role","status"),P.textContent=v?"\u67E5\u8BE2\u72B6\u6001":"Check status";for(let o of[a,f,P])o.type="button";for(let o of[f,P])o.style.cssText="min-height:44px;padding:8px 14px;margin-inline-end:8px;border:1px solid ButtonBorder;border-radius:8px;font:inherit;cursor:pointer";y.append(E,a,h,f,P);let t=!1,s=!1,p=!1,c=e.initialState;function F(o){if(t)return;c=o;let m=c.actions.includes("continue_checkout"),M=e.allowConfirm&&c.actions.includes("confirm");f.hidden=!m&&!M,f.disabled=P.disabled=s,f.textContent=m?v?"\u7EE7\u7EED\u4ED8\u6B3E":"Continue checkout":v?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",h.textContent=p||c.status==="blocked"?v?"\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u8D2D\u4E70\u72B6\u6001\u3002\u8BF7\u91CD\u8BD5\u3002":"We couldn\u2019t check your purchase. Try again.":c.status==="complete"?v?"\u8D2D\u4E70\u5DF2\u5904\u7406\u3002":"Your purchase has been processed.":m?v?"\u53EF\u4EE5\u7EE7\u7EED\u539F\u8BA2\u5355\u4ED8\u6B3E\u3002":"You can continue your original checkout.":v?"\u6B63\u5728\u6838\u5BF9\u8D2D\u4E70\u72B6\u6001\u2026":"Checking your purchase\u2026"}async function N(o){if(!(t||s)){s=!0,p=!1,F(c);try{await o()}catch(m){t||(p=!0,w(e.onError,m))}finally{s=!1,F(e.client.recovery)}}}let I=()=>N(e.refresh),_=e.client.subscribe(F);function C(){t||(t=!0,e.signal.removeEventListener("abort",C),i.removeEventListener("visibilitychange",x),_(),y.remove(),U(),e.onDismiss())}function x(){i.visibilityState==="visible"&&I()}return a.onclick=C,y.addEventListener("cancel",o=>{o.preventDefault(),C()}),P.onclick=()=>{I()},f.onclick=()=>{N(async()=>{c.actions.includes("continue_checkout")?await e.client.continueCheckout(o=>{if(e.signal.throwIfAborted(),!t)return e.onCheckoutUrl?e.onCheckoutUrl(o):i.defaultView?.location.assign(o)}):e.allowConfirm&&c.actions.includes("confirm")&&await e.client.confirm()})},e.signal.addEventListener("abort",C,{once:!0}),i.addEventListener("visibilitychange",x),F(c),e.loading.present(()=>{t||e.signal.aborted||(S.append(y),y.showModal?y.showModal():y.open=!0,a.focus({preventScroll:!0}))}),{destroy:C,refresh:I,get recovery(){let o=c.purchases.filter(m=>!["native","complete"].includes(m.type));return structuredClone(o.length===1?o[0]:{type:"recover",operationId:null,requestId:null})},async prepareFallback(){return{type:"recover",operationId:null,requestId:null}},async review(){},async exitReview(){},get unappliedDrafts(){return new Map}}}var H=new WeakMap,G=new WeakMap,J=new WeakSet;function pe(S,e){let i=e.prepared,v=()=>{i&&!J.has(i)&&j(i)?.release()},U=H.get(e.client);if(U)return v(),U;let y=t=>({...t,requestId:t.requestId??crypto.randomUUID()}),E=e.allowNewPurchase!==!1&&e.start instanceof Promise?e.start:void 0,h=e.allowNewPurchase===!1||!e.start||e.start instanceof Promise?void 0:y(e.start);h&&i?.state==="ready"&&i.matches(h)&&i.open();let a=i&&(h&&(i.state==="preparing"||["shown","closed"].includes(i.state)&&i.matches(h))||E&&["preparing","ready"].includes(i.state))?i:void 0;a?J.add(a):v();let f=a&&j(a);f?.claim();let P=Promise.resolve().then(async()=>{let t=!1,s,p=0,c,F,N=!1,I=()=>{},_=()=>{},C,x=!1,o=!1,m,M=!1,l=e.signal?AbortSignal.any([e.signal,e.client.identitySignal]):e.client.identitySignal,A=()=>{H.get(e.client)===P&&H.delete(e.client),l.removeEventListener("abort",q),I(),_(),a&&J.delete(a),f?.release()};function K(){if(m)return m;let r=new Promise(b=>m=b);return G.set(e.client,r),r.then(()=>{G.get(e.client)===r&&G.delete(e.client)}),H.get(e.client)===P&&H.delete(e.client),m}let u=B(S,e,"funnel",()=>L(),Y);function q(){L()}function L(r=!1){if(!t){if(t=!0,u.finish("dismissed"),s){s.destroy();return}if(r&&C){let b=K();M=!0,C.then(async d=>{d.mode==="run"&&d.status!=="blocked"&&e.client.controller&&e.client.attempt?.requestId===h?.requestId&&await e.client.close()}).catch(()=>{}).finally(()=>{b(),w(e.onDismiss,null)}),A();return}A(),w(e.onDismiss,null)}}let W={destroy:()=>L(),refresh:()=>s?.refresh()??c??Promise.resolve(),get recovery(){return s?.recovery??{type:"recover",operationId:null,requestId:null}},prepareFallback:()=>s?.prepareFallback()??Promise.resolve({type:"recover",operationId:null,requestId:null}),review:(...r)=>s?.review(...r)??Promise.resolve(),exitReview:(...r)=>s?.exitReview(...r)??Promise.resolve(),get unappliedDrafts(){return s?.unappliedDrafts??new Map}};l.addEventListener("abort",q,{once:!0}),f&&(_=f.onClose(()=>{x?t||K():L(!0)}));try{l.throwIfAborted();let r=e.client.controller?.view?.paywall?.resolution,b=r&&"document"in r?r.document:e.loadingDocument;u.start(!0,h?.locale??e.client.attempt?.locale??b?.screen.strings.defaultLocale,b??null);let d=E?u.wait(E.then(k=>k?y(k):null,()=>null),V):Promise.resolve(h??null);d.catch(()=>{}),a?.state==="shown"?(o=!0,u.present(()=>{})):a&&["preparing","ready"].includes(a.state)&&Promise.all([a.ready,d.catch(()=>null)]).then(([k,n])=>{if(k){if(t||!u.active||!n||!a.matches(n)||!f?.revealable)return f?.release();u.present(()=>{a.open()==="shown"?o=!0:f.release()})}});let D=G.get(e.client);if(D&&await u.wait(D),t)return null;if(l.throwIfAborted(),E){let k=await d;if(t)return null;if(l.throwIfAborted(),!k)return u.finish("skipped"),A(),null;h=k}C=h?e.client.start(h):e.client.refresh();let O=await u.wait(C,V);return t?null:(l.throwIfAborted(),await z(O,u))}catch(r){if(M||m?.(),t)return null;throw u.finish("error",r),A(),w(e.onError,r),r}function re(){p++;let r=s;s=void 0,I(),I=()=>{},r?.destroy(),l.addEventListener("abort",q,{once:!0})}function Q(){if(c)return c;if(t||l.aborted)return Promise.resolve();re(),u=B(S,e,"funnel",()=>L(),Y),u.start(!0,e.client.attempt?.locale);let r=Promise.resolve().then(async()=>{try{let d=await e.client.refresh();!t&&!l.aborted&&await z(d,u)}catch(d){!t&&!l.aborted&&(w(e.onError,d),await z({...e.client.recovery,mode:"blocked",status:"blocked"},u))}});c=r;let b=()=>{c===r&&(c=void 0)};return r.then(b,b),r}async function z(r,b){let d=e.client.controller;if(r.mode==="run"&&r.status!=="blocked"&&d)return ne(d,b);if(r.purchases.length||r.status==="blocked"&&x){let D=++p;return s=te(S,{client:e.client,signal:l,loading:u,locale:e.client.attempt?.locale,onCheckoutUrl:e.onCheckoutUrl,onError:e.onError,refresh:Q,initialState:r,allowConfirm:e.allowNewPurchase!==!1,onDismiss(){D===p&&(t=!0,A(),w(e.onDismiss,null))}}),W}return u.finish("skipped"),A(),(o||x)&&(t=!0,w(e.onDismiss,null)),null}async function ne(r,b){l.removeEventListener("abort",q),x=!0;function d(){!t&&!l.aborted&&!N&&F&&e.client.recovery.status==="complete"&&(N=!0,w(e.onComplete,structuredClone(F)))}function D(n){if(l.throwIfAborted(),t)throw new DOMException("Presentation dismissed","AbortError");return e.onCheckoutUrl?e.onCheckoutUrl(n):S.ownerDocument.defaultView?.location.assign(n)}I(),I=e.client.subscribe(d);let O=++p,k=await ee(S,{...e,prepared:a,client:r,signal:l,checkoutNavigation:"after_confirmation",resumeCheckout:n=>e.client.continueCheckout(D,n),terminateCheckout:e.allowNewPurchase===!1?void 0:n=>e.client.terminateCheckout(n),async onCheckoutUrl(n){if(l.throwIfAborted(),t)throw new DOMException("Presentation dismissed","AbortError");let g=e.client.recovery;if((!g.actions.includes("continue_checkout")||!g.purchases.some(T=>T.type==="checkout"&&T.checkoutUrl===n))&&(g=await e.client.refresh(),l.throwIfAborted(),t))throw new DOMException("Presentation dismissed","AbortError");if(X(g)!==n)throw new R("PURCHASE_PENDING","Checkout differs from the original recovery proof");return D(n)},async resolveOfferId(n){if(l.throwIfAborted(),t)throw new DOMException("Presentation dismissed","AbortError");let g=e.client.attempt;if(!g)throw new R("PURCHASE_PENDING","Read the original Start before selecting an offer");let T=await e.resolveOfferId?.(n,g);if(l.throwIfAborted(),t)throw new DOMException("Presentation dismissed","AbortError");if(e.client.attempt?.requestId!==g.requestId)throw new R("PURCHASE_STORAGE_CONFLICT","The original purchase changed while selecting an offer");return T},async resolveSubscriptionChange(n){l.throwIfAborted();let g=e.client.attempt;if(t||!g)throw new R("PURCHASE_PENDING","Read the original Start before selecting a membership");let T=await e.resolveSubscriptionChange?.(n);if(l.throwIfAborted(),t||e.client.attempt?.requestId!==g.requestId)throw new R("PURCHASE_STORAGE_CONFLICT","The original purchase changed while selecting a membership");return T},onPresentationState(n){O===p&&w(e.onPresentationState,n)},onComplete(n){O===p&&(F=n,d())},onError(n){O===p&&(w(e.onError,n),n instanceof R&&(n.status===401||n.status===409&&n.reason==="STATE_CHANGED"&&n.recovery==="recover_operation")&&!l.aborted&&Q().catch(g=>w(e.onError,g)))},onDismiss(n){O===p&&(t=!0,A(),m?.(),w(e.onDismiss,n))}},b);return O!==p||t||l.aborted?(k.destroy(),t||l.aborted?null:W):(s=k,W)}});return H.set(e.client,P),P}export{pe as showFunnelPurchase};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-PE5Y524X.js";import"./chunk-HMPIUYZ2.js";import"./chunk-W55G3VGB.js";import"./chunk-X2ON6QRA.js";import"./chunk-JZ73DRHT.js";import"./chunk-EQKTKITL.js";import"./chunk-WQN2D5FZ.js";import"./chunk-JDUB4T4P.js";import"./chunk-VILB5M4X.js";import"./chunk-UIKMEVXM.js";import"./chunk-GJLCTQJN.js";import"./chunk-4LIM2ZQR.js";import"./chunk-DTOYPMAW.js";import"./chunk-KAMYLHAT.js";import"./chunk-MFAEHTOH.js";import"./chunk-XB24ATBA.js";import"./chunk-6RGARS6I.js";import"./chunk-DSPLGTQI.js";import"./chunk-XWD4N2QI.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as PRERENDER_MAX_AGE_MS,b as preparedInternals,c as prerenderFunnelPurchase};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-HMPIUYZ2.js";import"./chunk-W55G3VGB.js";import"./chunk-X2ON6QRA.js";import"./chunk-JZ73DRHT.js";import"./chunk-VILB5M4X.js";import"./chunk-KAMYLHAT.js";import"./chunk-6RGARS6I.js";import"./chunk-XWD4N2QI.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as predictFunnelStart,c as predictedPaywallLoadingDocument,b as predictionRefusal};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,b as o,c as n}from"./chunk-W55G3VGB.js";import"./chunk-X2ON6QRA.js";import"./chunk-JZ73DRHT.js";import"./chunk-VILB5M4X.js";import"./chunk-KAMYLHAT.js";import"./chunk-6RGARS6I.js";import"./chunk-XWD4N2QI.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{e as FUNNEL_ROUTE_LIMITS,o as funnelRouteSchema,n as projectFunnelRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk-N3TAZ7HB.js";import"./chunk-PE5Y524X.js";import"./chunk-HMPIUYZ2.js";import"./chunk-W55G3VGB.js";import"./chunk-N3C57R2I.js";import"./chunk-MMJBC6PW.js";import"./chunk-W32FI2A2.js";import"./chunk-HIUSHWDK.js";import"./chunk-POOXIM6Q.js";import"./chunk-L7OMFH4O.js";import"./chunk-X2ON6QRA.js";import"./chunk-JZ73DRHT.js";import"./chunk-CRCAYVV5.js";import"./chunk-EQKTKITL.js";import"./chunk-ZQAAZ7Q4.js";import"./chunk-WQN2D5FZ.js";import"./chunk-JDUB4T4P.js";import"./chunk-VILB5M4X.js";import"./chunk-D3WC3T4U.js";import"./chunk-UIKMEVXM.js";import"./chunk-GFSAWDV2.js";import"./chunk-GJLCTQJN.js";import"./chunk-4LIM2ZQR.js";import"./chunk-DTOYPMAW.js";import"./chunk-KAMYLHAT.js";import"./chunk-MFAEHTOH.js";import"./chunk-XB24ATBA.js";import"./chunk-SLUA7ABW.js";import"./chunk-AAILPAL5.js";import"./chunk-YPN2ZL2V.js";import"./chunk-6RGARS6I.js";import"./chunk-DSPLGTQI.js";import"./chunk-XWD4N2QI.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as showFunnelRun,b as showObservedFunnelRun};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as r,P as m,i as e}from"./chunk-JDUB4T4P.js";import"./chunk-UIKMEVXM.js";import"./chunk-DTOYPMAW.js";import"./chunk-XB24ATBA.js";import"./chunk-6RGARS6I.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{m as merchantBridgeCommerceSchema,r as merchantBridgeOperationSchema,e as merchantOperationLookupSchema};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as o}from"./chunk-L42A5KVA.js";import"./chunk-7MTQQIGR.js";import"./chunk-CI7UPAWD.js";import"./chunk-UBUFXGS7.js";import"./chunk-MBWUIYCH.js";import"./chunk-L7OMFH4O.js";import"./chunk-JZ73DRHT.js";import"./chunk-ZQAAZ7Q4.js";import"./chunk-WQN2D5FZ.js";import"./chunk-JDUB4T4P.js";import"./chunk-VILB5M4X.js";import"./chunk-SWULFBRF.js";import"./chunk-UIKMEVXM.js";import"./chunk-GFSAWDV2.js";import"./chunk-GJLCTQJN.js";import"./chunk-4LIM2ZQR.js";import"./chunk-DTOYPMAW.js";import"./chunk-KAMYLHAT.js";import"./chunk-XB24ATBA.js";import"./chunk-6RGARS6I.js";import"./chunk-XWD4N2QI.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
|
package/dist/paywall-QMYTDELU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Qt,c as jt,d as pt,f as mt,g as Bt,k as Ft}from"./chunk-N3C57R2I.js";import{b as dt}from"./chunk-W32FI2A2.js";import{d as _t,e as Mt,f as Ut,h as ft,i as qe,j as $t,k as Vt,l as Ht}from"./chunk-HIUSHWDK.js";import{a as Tt,c as lt,d as St,e as Dt}from"./chunk-CRCAYVV5.js";import{a as Fe,b as he,d as ut,f as Nt,j as Lt}from"./chunk-EQKTKITL.js";import{b as de}from"./chunk-ZQAAZ7Q4.js";import{B as A,C as Be,D as Re,E as Oe,y as Ot}from"./chunk-WQN2D5FZ.js";import"./chunk-JDUB4T4P.js";import"./chunk-VILB5M4X.js";import"./chunk-D3WC3T4U.js";import"./chunk-UIKMEVXM.js";import{r as be,t as me}from"./chunk-GFSAWDV2.js";import{i as Rt}from"./chunk-GJLCTQJN.js";import{c as ue,j as Ae}from"./chunk-4LIM2ZQR.js";import{c as ct}from"./chunk-DTOYPMAW.js";import"./chunk-KAMYLHAT.js";import{a as P}from"./chunk-MFAEHTOH.js";import"./chunk-XB24ATBA.js";import"./chunk-YPN2ZL2V.js";import"./chunk-6RGARS6I.js";import{a as G}from"./chunk-DSPLGTQI.js";import"./chunk-XWD4N2QI.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";async function qt(_,a,E){if(!Re(a))throw new P("INVALID_RESPONSE","A verified completed purchase is required");let k=_?Ae.parse(_):null;if(await E.onComplete?.(a),!k||!E.check)return;let U=Ae.parse(await E.check());if(U.internal_feature_id!==k.internal_feature_id||U.quantity!==k.quantity||k.observation!==void 0&&(U.observation===void 0||U.observation.requirementDigest!==k.observation.requirementDigest||U.observation.authority!==k.observation.authority||ct(U.observation.subject)!==ct(k.observation.subject)))throw new P("INVALID_RESPONSE","The access requirement changed");U.allowed&&await E.onAccessGranted?.(U)}function ht(_){return Object.entries(_.document.buttons).filter(([,a])=>a.type==="checkout"&&a.product.type==="fixed"&&!de(a.product,{},_.capabilities)).map(([a])=>a)}function Gt(_,a){let E=A(a)?void 0:a.lines[0];if(!A(a)&&(a.lines.length!==1||!E))return;let k=A(a)?a.productVersionId:E.productVersionId,{screen:U,buttons:X}=_.document,R=new Map(A(a)?Object.entries(a.featureQuantities??{}):(E?.prepaid??[]).map(h=>[h.internal_feature_id,h.quantity]));function Z(h,m){if(h.hidden)return!1;if(h.type==="plan_picker"&&_.capabilities.pickers[h.id]?.options.includes(k))return m[h.id]=k,!0;if(h.type==="quantity_picker"){let Y=R.get(h.internalFeatureId);return Y!==void 0&&(!h.bind?.plan||h.bind.plan===k)&&(m[h.id]=Y),!1}if(h.type==="button"&&h.action){let Y=X[h.action];return Y?.type==="checkout"&&Y.product.type==="fixed"&&Y.product.productVersionId===k}if(h.type!=="stack")return!1;let z=h.interaction,i=h.bind?.plan===k;for(let[Y,d]of h.children.entries()){let re={},N=Z(d,re);if(z?.type==="toggle"||z?.type==="tabs"){if(!N)continue;return m[h.id]=z.type==="toggle"?Y===0:d.id,Object.assign(m,re),!0}Object.assign(m,re),N&&(i=!0,z?.type==="select"&&z.purpose==="product"&&z.pickerId&&d.type==="stack"&&d.bind?.plan===k&&(m[h.id]=d.id,m[z.pickerId]=k))}return i}for(let h of U.pages){let m={__page:h.id};if(Z(h.root,m))return m}}async function _n(_,a,E){let k=a.focusAtReveal?()=>{}:ft(_.ownerDocument),U=()=>{R.finish("dismissed"),k()},X=()=>U(),R=$t(_,a,"paywall",()=>{U(),G(a.onDismiss)},Qt);a.signal?.throwIfAborted(),a.signal?.addEventListener("abort",X,{once:!0});let Z=null,h,m,z;try{if(R.start(!0,a.loadingDocument?.screen.strings.defaultLocale,a.loadingDocument??null),R.cancelled)throw new DOMException("Presentation cancelled","AbortError");if(Z=a.check?Ae.parse(await R.wait(a.check(),qe)):null,Z?.allowed)return R.finish("skipped"),a.signal?.removeEventListener("abort",X),k(),await a.onAccessGranted?.(Z),{check:Z,host:null};let[e,t]=await Promise.allSettled([R.wait(import("./screen-renderer-AQXCFML3.js")),R.wait(a.start().then(r=>(R.cancelled&&r.destroy(),r)),qe)]);if(e.status==="rejected")throw t.status==="fulfilled"&&t.value.destroy(),e.reason;if(t.status==="rejected")throw t.reason;z=e.value,h=t.value,a.signal?.throwIfAborted(),h.signal?.throwIfAborted(),h.signal?.addEventListener("abort",X,{once:!0});let n=h.view??await R.wait(h.refresh(),qe);if(!n)throw new P("INVALID_RESPONSE","Paywall presentation is missing");h.signal?.throwIfAborted(),m=n}catch(e){throw R.finish("error",e),a.signal?.removeEventListener("abort",X),h?.signal?.removeEventListener("abort",X),h?.destroy(),k(),e}let i=h,{mountScreenPreview:Y}=z,d=_.ownerDocument,re=new AbortController,N=d.createElement("section"),ie=d.createElement("div"),J=d.createElement("div"),Ge=a.mountControls,W=Ge?d.createElement("div"):void 0,f=d.createElement("p"),C=d.createElement("button"),x=d.createElement("button"),O=d.createElement("dialog"),We=i.locale||m.document.screen.strings.defaultLocale,o=We.toLowerCase().startsWith("zh"),Wt=o?"\u6B63\u5728\u5904\u7406\u2026":"Processing\u2026",zt=o?"\u6B63\u5728\u51C6\u5907\u62A5\u4EF7\u2026":"Preparing your price\u2026",M=jt(m.document.screen.theme);N.dataset.indianaPaywall="",N.setAttribute("aria-label",m.document.name),N.style.cssText=M.root,J.style.cssText=M.controls,f.style.cssText=M.message,f.setAttribute("role","status"),x.style.cssText=M.link,x.textContent=o?"\u5173\u95ED":"Close",C.style.cssText=M.secondary,C.textContent=o?"\u91CD\u8BD5":"Retry",C.hidden=!0,J.append(f,C,x),W&&(W.style.cssText="flex:1 0 100%;min-width:0",W.hidden=!0,J.prepend(W)),N.append(ie,J);let ze=()=>{if(W){let r=!W.childElementCount&&!W.textContent?.trim();W.hidden!==r&&(W.hidden=r)}let e=oe??J,t=[...e.children].every(r=>r===f?!f.textContent:r.hidden),n=[...e.children].some(r=>r===x?!1:r===f?!!f.textContent:!r.hidden);e.style.cssText=t?M.controls.replace(/padding:[^;]+/,"padding:0"):n?`${M.controls};${M.pinned}`:M.controls,Xe()},yt=typeof MutationObserver>"u"?void 0:new MutationObserver(ze);yt?.observe(N,{attributes:!0,attributeFilter:["hidden"],characterData:!0,childList:!0,subtree:!0});let Te=m.document.presentation,Yt=Object.entries(m.document.buttons).filter(([,e])=>e.type==="close").map(([e])=>e),B,wt,Ye=!1,gt=JSON.stringify(m.capabilities),Je=e=>ae&&!Ce?Object.entries(e.document.buttons).filter(([,t])=>t.type==="checkout").map(([t])=>t):ht(e);function Se(e){if(w)return;m=e;let t=JSON.stringify(e.capabilities);if(t!==gt){let n=!b&&!i.quote&&!i.operation?Fe(e,q,Ct):q;JSON.stringify(n)!==JSON.stringify(q)?(q=n,B?.update(e.document.screen,We,{capabilities:he(e),unavailableActions:Je(e),serverInput:{bindings:[],answers:{}},selection:q})):B?.updateCapabilities(he(e),Je(e)),gt=t}Xt(e),ve()}let I,Ke=0;function Xe(){let e=d.defaultView;if(!I?.responsive||!e)return;let t=oe??J,n=e.innerHeight-(I.type==="modal"?32:0);t.style.maxHeight=`${Math.max(1,n)}px`,t.style.overflowY="auto",t.style.flexShrink="0",Ke=Math.max(1,n-t.getBoundingClientRect().height),B?.resizeViewport?.(Ke,e.innerWidth)}let w=!1,ae=!1,b=null,Ze,De=!1,bt=!1,fe=!1,et,tt=!1,ee,oe;function Jt(){return ae||w||ee||tt?{type:"recover",operationId:i.operation?.operationId??i.quote?.operationId??null,requestId:null}:lt(i)}let T=()=>!w&&!De&&!ee&&a.canInteract?.()!==!1,F,ye=!1,we=!1,p=null,te=null,nt="",pe=()=>a.checkoutNavigation==="after_confirmation"&&!!(a.terminateCheckout||a.resumeCheckout),q={},Ct=new Set,Ce,K=null;function ve(){if(!pe()||!B?.updateCheckoutControls)return;let e=i.quote,t=!K&&!!e&&!!i.operation&&S(i.operation).type==="checkout",n=Object.entries(m.document.buttons).flatMap(([r,c])=>c.type==="checkout"?[{actionId:r,policy:c}]:[]);B.updateCheckoutControls({actions:n.map(({actionId:r})=>r),resume:t?n.filter(({actionId:r,policy:c})=>Me(e,m,r,c.product,q)).map(({actionId:r})=>r):[],resumeLabel:o?"\u7EE7\u7EED\u4ED8\u6B3E":"Continue checkout",busy:Ce})}function vt(){te?.remove(),te=null}async function rt(){if(K)return;if(a.resumeCheckout&&i.operation){await a.resumeCheckout(i.operation.operationId);return}let e=await i.read();if(S(e).type!=="checkout")return $(e,!1);T()&&(Le.delete(e.operationId),await Ue(e))}function Pt(){f.textContent=o?"\u6682\u65F6\u65E0\u6CD5\u6253\u5F00\u4ED8\u6B3E\u9875\u9762\u3002\u8BF7\u91CD\u8BD5\u3002":"Couldn\u2019t open checkout. Try again.",C.hidden=!0}async function kt(e=!1){let t=K;if(!t)return;C.hidden=!0;let n=Date.now()+2e4;for(;T();){let r=await i.read();if(r.operationId!==t.operationId)throw new P("PURCHASE_PENDING","The original Checkout changed");if(!T())break;let c=S(r);if(c.type==="native"){K=null,vt(),b=t.selection,F=t.coupon,ye=!1,we=!1,await xe();return}if(c.type==="complete"||c.type==="fulfillment"||c.type==="recording"){K=null,await $(r,!1);return}if(e&&c.type==="checkout"){e=!1;try{await a.terminateCheckout(t.operationId)}catch(g){G(a.onError,g)}}if(Date.now()>=n)break;await dt(1e3,d,re.signal)}w||Pt()}async function Kt(e,t,n){K={operationId:e,selection:t,coupon:n};let r=!1;try{await a.terminateCheckout(e)}catch(c){if(c instanceof P&&["CAPABILITY_UNAVAILABLE","NOT_CONFIGURED"].includes(c.code)){K=null,f.textContent=o?"\u8BF7\u7EE7\u7EED\u539F\u8BA2\u5355\uFF0C\u6216\u7B49\u5F85\u5B83\u8FC7\u671F\u540E\u518D\u66F4\u6362\u65B9\u6848\u3002":"Continue your original checkout, or wait for it to expire before changing plans.",G(a.onError,c);return}r=c instanceof P&&(c.status??0)>=500,G(a.onError,c)}T()&&await kt(r)}function Ne(e,t,n,r,c){let g=he(e).checkoutCoupons?.[t],l=g?g.products[n]:a.claimCoupon&&c?Rt(e.capabilities,c,r):void 0;return l?.couponId&&l.planVersionId===n?{id:l.couponId,offerId:l.offerId}:void 0}function Xt(e){ae||b||i.quote||i.operation||nt&&f.textContent===nt||(f.textContent=Object.values(e.capabilities.plans).some(t=>t.available)?"":o?"\u5F53\u524D\u8D26\u53F7\u6682\u65E0\u53EF\u8D2D\u4E70\u7684\u65B9\u6848\u3002":"No plans are currently available for this account.")}let Le=new Map,_e=!1;function Me(e,t,n,r,c,g){if(A(e)){let H=de(r,c,t.capabilities),le=H&&Ne(t,n,H,c,g),Ie=e.merchantTerms?.discount??(e.execution.provider==="merchant"?e.execution.discount:void 0),Ve=me(t.document.screen,e.productVersionId,c,t.capabilities);return H===e.productVersionId&&Object.keys(Ve).length===Object.keys(e.featureQuantities??{}).length&&Object.entries(Ve).every(([He,Qe])=>e.featureQuantities?.[He]===Qe)&&(!le||Ie?.couponId===le.id&&(!le.offerId||Ie.grantId===le.offerId))}let l=e.lines.length===1?e.lines[0]:void 0,s=de(r,c,t.capabilities);if(!l||!s||l.productVersionId!==s)return!1;let L=Ne(t,n,s,c,g);if((L||he(t).checkoutCoupons?.[n])&&(L?.id??null)!==(e.discount?.couponId??null))return!1;let V;try{V=me(t.document.screen,s,c,t.capabilities)}catch{return!1}let ce=Object.fromEntries((l.prepaid??[]).map(H=>[H.internal_feature_id,H.quantity]));return[...new Set([...Object.keys(V),...Object.keys(ce)])].every(H=>(V[H]??0)===(ce[H]??0))}let S=e=>Tt({quote:i.quote,operation:e,requestId:null,pending:!1,destroyed:w,canReselect:i.canReselect});async function Ue(e){let t=e.merchantExecution,n=S(e),r=n.type==="checkout"?n.checkoutUrl:e.checkoutUrl;if(!(!T()||!r||Be(e)&&n.type!=="checkout"||a.checkoutNavigation==="after_confirmation"&&n.type!=="checkout"||t?.type==="purchase"&&!["not_started","pending"].includes(t.paymentStatus)||Le.get(e.operationId)===r)){Le.set(e.operationId,r);try{a.onCheckoutUrl?await a.onCheckoutUrl(r):d.defaultView?.location.assign(r)}catch(c){throw Le.delete(e.operationId),c}}}let se=(e,t=!1)=>{if(e instanceof ut)p=null,f.textContent=e.customerMessage(o);else if(Bt(e))p=null,f.textContent=t?o?"\u5F53\u524D\u65E0\u6CD5\u5728\u6B64\u8D2D\u4E70\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002\u8BF7\u8054\u7CFB\u5546\u6237\u3002":"Purchases aren\u2019t available here right now. Payment hasn\u2019t started. Contact the merchant for help.":mt(e,o);else if(t){let n=e instanceof P?e.code:void 0;n==="CAPABILITY_UNAVAILABLE"||n==="NOT_CONFIGURED"?(p=null,f.textContent=o?"\u6682\u65F6\u65E0\u6CD5\u4E3A\u6B64\u5957\u9910\u62A5\u4EF7\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002":"Pricing for this plan is unavailable. Payment hasn\u2019t started."):i.canReselect===!0&&!b?f.textContent=o?"\u672A\u80FD\u53D6\u5F97\u62A5\u4EF7\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002\u8BF7\u91CD\u65B0\u9009\u62E9\u5957\u9910\u3002":"We couldn\u2019t prepare your price. Payment hasn\u2019t started. Choose a plan again.":n==="COMMAND_PENDING"?f.textContent=o?"\u4ECD\u5728\u51C6\u5907\u62A5\u4EF7\uFF0C\u8BF7\u91CD\u8BD5\u4EE5\u67E5\u770B\u7ED3\u679C\u3002":"Your price is still being prepared. Retry to check the result.":f.textContent=o?"\u672A\u80FD\u53D6\u5F97\u62A5\u4EF7\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002\u8BF7\u91CD\u8BD5\u3002":"We couldn\u2019t prepare your price. Payment hasn\u2019t started. Try again."}else f.textContent=e instanceof P&&(e.code==="NETWORK_ERROR"||e.code==="TIMEOUT")?mt(e,o):e instanceof P?e.message:o?"\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002":"This action couldn\u2019t be completed. Try again.";C.hidden=p===null,nt=f.textContent,t&&!I?.responsive&&f.scrollIntoView?.({block:"nearest"}),G(t&&E?.quoteError?E.quoteError:a.onError,e)},Pe=new WeakMap;function ke(e){ae=e,C.disabled=e,B?.updateCapabilities?.(he(m),Je(m));for(let t of te?.querySelectorAll("button")??[])e?(Pe.has(t)||Pe.set(t,t.disabled),t.disabled=!0):Pe.has(t)&&(t.disabled=Pe.get(t),Pe.delete(t)),pt(t)}function it(){f.textContent=o?"\u6682\u65F6\u65E0\u6CD5\u64CD\u4F5C\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"This action is unavailable right now. Try again in a moment."}async function Zt(e){if(a.beforeAction)try{await a.beforeAction()}catch(t){throw t instanceof ut?(b=null,ye=!1,we=!1,p=null):p=e,t}}async function j(e,t){if(ae||w)return;if(!T()){it();return}let n=e===xe,r=n?zt:Wt,c=pe()&&t!==void 0;Ce=c?t:void 0,ke(!0),ve(),C.hidden=!0,f.textContent=c?"":r;try{if(e!==It&&(e!==rt||!a.resumeCheckout)&&await Zt(e),w)return;if(!T()){p=e,C.hidden=!1,it();return}await e()}catch(g){w||se(g,n&&!c)}finally{Ce=void 0,ke(!1),ve(),f.textContent===r&&(f.textContent="")}}async function en(e){await qt(Z,e,a)}function Et(e){return lt(i).type==="recording"||S(e).type==="recording"}function xt(e){let t=e.merchantTerms,n=t?.subscriptionTerms?.items??[],r=t?t.totalMinor:A(e)?e.totalMinor:e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),c=t?n.length===1&&n[0]?.amountMinor===r&&n[0]:!A(e)&&e.lines.length===1&&e.lines[0]?.catalogAmountMinor===r&&e.lines[0],g=r===null?ue(t.subtotalMinor-t.discountMinor,e.currency)+(o?" + \u5F85\u786E\u8BA4\u7A0E\u8D39":" + tax confirmed at checkout"):ue(r,e.currency)+(c?be(c.interval,o?"zh-CN":"en",c.intervalCount??1):""),l=A(e)?i.view?.capabilities.plans[e.productVersionId]?.name??"":e.lines.map(s=>s.productName).join(", ");return{label:l?`${l} \xB7 ${g}`:g,recurring:c}}async function $(e,t=a.checkoutNavigation!=="after_confirmation"){if(w)return;if(!T()){p=async()=>$(await i.read()),C.hidden=!1;return}if(f.textContent=Ft(e.status,o),Et(e)){let s=e.merchantExecution?.recordingStatus==="failed";f.textContent=s?o?"\u4ED8\u6B3E\u548C\u5546\u6237\u5904\u7406\u5DF2\u5B8C\u6210\uFF0C\u4F46\u4EA4\u6613\u8BB0\u5F55\u5931\u8D25\u3002\u8BF7\u8054\u7CFB\u5546\u6237\u4FEE\u590D\uFF0C\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"Payment and fulfillment succeeded, but recording failed. Contact the merchant to repair this purchase; do not buy again.":o?"\u4ED8\u6B3E\u548C\u5546\u6237\u5904\u7406\u5DF2\u5B8C\u6210\uFF0C\u6B63\u5728\u786E\u8BA4\u4EA4\u6613\u8BB0\u5F55\u3002\u8BF7\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"Payment and merchant fulfillment are complete. Recording is pending confirmation; do not purchase again.",C.textContent=o?"\u67E5\u8BE2\u8BB0\u5F55":"Check recording",p=async()=>$(await i.read()),C.hidden=!1;return}if(e.problem&&S(e).type!=="native"){let s=e.problem;p=Ee,C.textContent=o?"\u68C0\u67E5\u5E76\u6062\u590D\u539F\u64CD\u4F5C":"Check and recover original purchase",se(new P(s.code,s.reason==="RESULT_UNKNOWN"?o?"\u4ED8\u6B3E\u7ED3\u679C\u5C1A\u672A\u786E\u5B9A\uFF0C\u8BF7\u6062\u590D\u539F\u64CD\u4F5C\uFF0C\u6682\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"The payment result is unknown. Recover the original purchase before buying again.":s.phase==="fulfillment"?o?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u5546\u6237\u6743\u76CA\u5904\u7406\u9700\u8981\u6838\u5BF9\u3002":"Payment was recorded. Access fulfillment needs attention.":s.code==="CAPABILITY_UNAVAILABLE"?o?"\u5546\u6237\u5C1A\u4E0D\u652F\u6301\u672C\u6B21\u8D2D\u4E70\u6240\u9700\u7684\u5B8C\u6574\u80FD\u529B\uFF0C\u8BF7\u5904\u7406\u540E\u6062\u590D\u539F\u64CD\u4F5C\u3002":"The merchant does not currently support all actions required by this purchase. Recover the original purchase after this is resolved.":s.code==="NOT_CONFIGURED"?o?"\u4ED8\u6B3E\u670D\u52A1\u8FDE\u63A5\u9700\u8981\u5904\u7406\uFF0C\u8BF7\u8054\u7CFB\u5546\u6237\u540E\u6062\u590D\u539F\u64CD\u4F5C\u3002":"The payment connection needs attention. Contact the merchant, then recover the original purchase.":o?"\u539F\u8D2D\u4E70\u64CD\u4F5C\u9700\u8981\u5904\u7406\uFF0C\u8BF7\u67E5\u8BE2\u6216\u6062\u590D\u6B64\u64CD\u4F5C\u3002":"The original purchase needs attention. Check or recover this operation.",void 0,void 0,s));return}if((e.merchantExecution?.type==="purchase"&&e.merchantExecution.paymentStatus==="succeeded"||e.merchantExecution?.type==="subscription_change"&&e.merchantExecution.status==="applied")&&!["applied","not_applicable"].includes(e.merchantExecution.fulfillmentStatus)&&(f.textContent=o?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u6B63\u5728\u7B49\u5F85\u5546\u6237\u5B8C\u6210\u5904\u7406\u3002":"Payment was recorded. Waiting for merchant fulfillment."),Re(e)&&S(e).type==="complete"){p=null,await en(e);return}if(!Oe(e)&&S(e).type!=="fulfillment"){if(i.canReselect===!1){f.textContent=o?"\u6B63\u5728\u6838\u5BF9\u539F\u8D2D\u4E70\u7ED3\u679C":"Checking the original purchase result",C.textContent=o?"\u67E5\u8BE2\u7ED3\u679C":"Check result",p=async()=>$(await i.read()),C.hidden=!1;return}e.status==="cancelled"?f.textContent=o?"\u8FD9\u7B14\u8D2D\u4E70\u5DF2\u53D6\u6D88\uFF0C\u53EF\u4EE5\u91CD\u65B0\u9009\u62E9\u65B9\u6848\u3002":"This purchase was cancelled. Choose a plan to start again.":e.status==="failed"&&(f.textContent=o?"\u8FD9\u7B14\u8D2D\u4E70\u672A\u80FD\u5B8C\u6210\uFF0C\u53EF\u4EE5\u91CD\u65B0\u9009\u62E9\u65B9\u6848\u3002":"This purchase didn\u2019t go through. Choose a plan to try again."),C.textContent=o?"\u91CD\u8BD5":"Retry",p=null,b=null;return}if(!t&&S(e).type==="checkout"){if(K){Pt();return}if(pe()){f.textContent="",_e=!1,p=null,ve();return}let s=i.quote,L=s?.operationId===e.operationId?xt(s).label:"";f.textContent=_e?L?o?`${L} \u5C1A\u672A\u4ED8\u6B3E\u3002\u518D\u6B21\u9009\u62E9\u8BE5\u65B9\u6848\u5373\u53EF\u7EE7\u7EED\u4ED8\u6B3E\u3002`:`${L} is still unpaid. Choose it again to continue paying.`:o?"\u4E4B\u524D\u7684\u8D2D\u4E70\u5C1A\u672A\u4ED8\u6B3E\u3002\u518D\u6B21\u9009\u62E9\u8BE5\u65B9\u6848\u5373\u53EF\u7EE7\u7EED\u4ED8\u6B3E\u3002":"Your earlier purchase is still unpaid. Choose that plan again to continue paying.":"",_e=!1,p=null;return}await Ue(e);let n=Date.now(),r=n+6e5,c=2e3,g=S(e).type!=="checkout",l=()=>g&&Date.now()-n<15e3;Ye=!0,G(a.onObservationChange,!0);try{for(;!w&&Date.now()<r;){if(await dt(l()?700:c,d,re.signal),w)return;if(!T()){p=async()=>$(await i.read()),C.hidden=!1;return}let s=await i.read();if(S(s).type==="checkout"&&(g=!1),!t&&S(s).type==="checkout"){await $(s,!1);return}if(!s.problem&&Oe(s)&&await Ue(s),!Oe(s)||s.problem||Et(s)){await $(s);return}l()||(c=Math.min(c*1.5,3e4))}}finally{Ye=!1,G(a.onObservationChange,!1)}p=async()=>$(await i.read()),C.hidden=!1}async function at(e=!1){let t=await i.read();if(w)return;if(!T()){p=()=>at(e),C.hidden=!1;return}let n=i.quote;if(n&&Nt(t,{operationId:n.operationId,currency:n.currency},"The original purchase operation changed"),n&&(Be(t)?["prepared","quoted"].includes(t.status):t.status==="pending")&&(Be(t)||t.quoteFinalized===!1)&&!t.confirmedAt&&!t.checkoutUrl&&!("nativePurchase"in t&&t.nativePurchase)&&!t.merchantExecution&&!t.problem&&!i.pendingCancellation){At(n);return}await $(t,e||void 0)}async function It(){await at()}async function Ee(){vt(),p=Ee;let e=await i.confirm();if(!T()){p=Ee,C.hidden=!1;return}if(e.problem){await $(e);return}if(Oe(e)){if(S(e).type==="checkout")await Ue(e);else if(e.execution&&e.execution.provider!=="merchant"||"nativePurchase"in e&&e.nativePurchase){if(!a.onPurchase)throw new P("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await a.onPurchase({operation:e,signal:re.signal})}}p=async()=>$(await i.read()),await $(e,!0)}function At(e){te?.remove();let t=!(Date.parse(e.expiresAt)>Date.now());f.textContent=t?o?"\u6B64\u62A5\u4EF7\u5DF2\u8FC7\u671F\u3002\u8BF7\u5148\u53D6\u6D88\uFF0C\u518D\u91CD\u65B0\u9009\u62E9\u3002":"This quote has expired. Cancel it, then choose again.":"";let n=d.createElement("div"),r=d.createElement("button"),c=d.createElement("button"),g=d.createElement("div"),l=d.createElement("p"),s=e.merchantTerms,L=o?"zh-CN":"en",V=s?.subscriptionTerms?.items??[],ce=s?s.subscriptionTerms?.trial?.days:A(e)?void 0:e.lines.find(u=>u.trial)?.trial?.days,ne=A(e)?s?s.totalMinor:e.totalMinor:ce===void 0?null:s?s.totalMinor:e.charge?e.charge.totalMinor:e.lines.every(u=>u.trial)?0:null,H=(u,y)=>o?`${y} \u5929\u8BD5\u7528\u7ED3\u675F\u540E ${u}`:`Then ${u} after the ${y}-day trial`,{label:le,recurring:Ie}=xt(e),Ve=A(e)?i.view?.capabilities.plans[e.productVersionId]?.name??"":e.lines.map(u=>u.productName).join(", "),He=ne===null?"":`${o?"\u4ECA\u5929\u5E94\u4ED8":"Due today"} ${ue(ne,e.currency)}`;l.textContent=He?[Ve,He].filter(Boolean).join(" \xB7 "):le,r.textContent=A(e)?o?"\u786E\u8BA4\u53D8\u66F4":"Confirm change":o?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",r.disabled=t,c.textContent=o?"\u53D6\u6D88":"Cancel",n.style.cssText=M.panel,l.style.cssText=M.summary,g.style.cssText=M.actions,r.style.cssText=M.primary,c.style.cssText=M.secondary,pt(r),r.onclick=()=>{j(Ee)};let Qe=async()=>{let u=await i.cancel();w||(n.remove(),te=null,await $(u))};c.onclick=()=>{p=Qe,j(Qe)};let Q=d.createElement("div");if(Q.style.cssText=M.terms,A(e)){for(let[y,v]of Object.entries(e.featureQuantities??{})){let D=i.view?.capabilities.plans[e.productVersionId]?.prepaid?.find(tn=>tn.internalFeatureId===y),je=d.createElement("p");je.textContent=`${D?.name??y} \xB7 ${v} ${o?"\u4EFD":"packs"}${D?` \xD7 ${D.terms.units}`:""}`,Q.append(je)}for(let[y,v]of[[o?"\u539F\u8BA2\u9605\u62B5\u6263":"Unused subscription credit",e.creditMinor],[o?"\u65B0\u5957\u9910\u8D39\u7528":"New plan charge",e.debitMinor],[o?"\u4F18\u60E0\u51CF\u514D":"Offer savings",s?.discountMinor??e.discountMinor],[o?"\u7A0E\u8D39":"Tax",s?s.taxMinor:e.taxMinor]]){let D=d.createElement("p");D.textContent=`${y}: ${v===null?o?"\u7ED3\u8D26\u65F6\u786E\u8BA4":"Confirmed at checkout":ue(v,e.currency)}`,Q.append(D)}let u=d.createElement("p");u.textContent=`${o?"\u751F\u6548\u65F6\u95F4":"Effective"}: ${e.effectiveAt}`,Q.append(u)}if(s){for(let y of V){if(ne===null&&y===Ie)continue;let v=d.createElement("p"),D=ue(y.amountMinor,e.currency)+be(y.interval,L,y.intervalCount);v.textContent=ne!==null&&ce!==void 0?H(D,ce):D,y.amountAfterOfferMinor!==void 0&&(v.textContent+=` \xB7 ${o?"\u4F18\u60E0\u7ED3\u675F\u540E":"After the offer"} ${ue(y.amountAfterOfferMinor,e.currency)}${be(y.interval,L,y.intervalCount)}`),Q.append(v)}let u=s.subscriptionTerms?.trial;if(u){let y=d.createElement("p");y.textContent=o?`\u8BD5\u7528 ${u.days} \u5929\uFF1B${u.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${u.days}; ${u.cardRequired?"a payment method is required":"no payment method is required"}`,Q.append(y)}for(let y of[...s.expectedEffects.map(v=>v.description),...s.requiredConsents.map(v=>v.summary)]){let v=d.createElement("p");v.textContent=y,Q.append(v)}}else if(!A(e)){for(let u of e.lines){if(ne!==null||u!==Ie){let y=d.createElement("p"),v=`${ue(u.catalogAmountMinor,e.currency)}${be(u.interval,L,u.intervalCount??1)}`;y.textContent=ne!==null&&u.trial?(e.lines.length>1?`${u.productName} \xB7 `:"")+H(v,u.trial.days):`${u.productName} \xB7 ${v}`,Q.append(y)}for(let y of u.prepaid??[]){let v=d.createElement("p"),D=i.view?.capabilities.plans[u.productVersionId]?.prepaid?.find(je=>je.internalFeatureId===y.internal_feature_id);v.textContent=`${D?.name??y.internal_feature_id} \xB7 ${y.quantity} ${o?"\u4EFD":"packs"} \xD7 ${y.terms.units}`,D&&(v.textContent+=be(D.reset==="week"||D.reset==="month"||D.reset==="year"?D.reset:"one_time",L,D.resetCount)),Q.append(v)}if(u.trial){let y=d.createElement("p");y.textContent=o?`\u8BD5\u7528 ${u.trial.days} \u5929\uFF1B${u.trial.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${u.trial.days}; ${u.trial.cardRequired?"a payment method is required":"no payment method is required"}`,Q.append(y)}}if(!e.charge){let u=d.createElement("p");u.textContent=o?"\u76EE\u5F55\u4EF7\u683C\uFF1B\u6700\u7EC8\u91D1\u989D\u4EE5\u7ED3\u8D26\u65F6\u7A0E\u8D39\u548C\u8BD5\u7528\u89C4\u5219\u4E3A\u51C6\u3002":"Catalog price; the final charge depends on checkout taxes and trial terms.",Q.append(u)}}for(let u of Q.children)u.style.margin="0";g.append(r,c),n.append(l,...Q.childElementCount?[Q]:[],g),J.prepend(n),I?.responsive||n.scrollIntoView?.({block:"nearest"}),r.focus({preventScroll:!0}),te=n,ae&&ke(!0),p=null}async function xe(){if(!b)return;if(p=xe,!ye){let n=i.view,r=n?.document.buttons[b.actionId],c=n&&r?.type==="checkout"?de(r.product,b.selection,n.capabilities):null;if(!n||!c)throw new P("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");if(!we){let l=await a.resolveSubscriptionChange?.({actionId:b.actionId,productVersionId:c,featureQuantities:me(n.document.screen,c,b.selection,n.capabilities)});if(w)return;l!==void 0&&(b.subscriptionChange=Ot.parse(l)),we=!0}let g=F?.offerId;if(F&&!g){if(!a.claimCoupon)throw new P("CAPABILITY_UNAVAILABLE","Coupon claiming is unavailable");let{offer:l}=await a.claimCoupon(F.id,b.requestId);if(w)return;if(!l||l.couponId!==F.id||l.status!=="issued"||!(Date.parse(l.expiresAt)>Date.now()))throw b=null,F=void 0,p=async()=>{Se(await i.refresh()),p=null},new P("COUPON_UNAVAILABLE","This Coupon is no longer available for this purchase");g=l.id}if(!F&&!n.document.screen.actions.some(l=>l.id===b?.actionId&&typeof l.properties.couponBinding=="string")&&(g=await a.resolveOfferId?.({actionId:b.actionId,productVersionId:c,featureQuantities:me(n.document.screen,c,b.selection,n.capabilities)})),w)return;g!==void 0&&(b.offerId=g),ye=!0}if(!T()){C.hidden=!1;return}let e;try{e=await i.preview(b)}catch(n){throw i.canReselect===!0&&(b=null,ye=!1,we=!1,F=void 0,p=null),n}if(F&&(A(e)?(()=>{let n=e.merchantTerms?.discount??(e.execution.provider==="merchant"?e.execution.discount:void 0);return n?.couponId!==F.id||n.grantId!==b.offerId})():e.discount?.couponId!==F.id||e.discount.offerId!==b.offerId))throw new P("INVALID_RESPONSE","The quote did not apply the Coupon selected on this Paywall");if(w)return;let t=e.merchantTerms;if(a.confirmOnHostedCheckout&&T()&&!A(e)&&e.provider==="merchant"&&e.billingSubscriptionId===null&&t?.request.action==="purchase"&&t.request.mode==="subscription"&&t.subscriptionTerms?.trial===null&&t.requiredConsents.length===0&&Date.parse(e.expiresAt)>Date.now()){let n=Ce?"":o?"\u6B63\u5728\u6253\u5F00\u6536\u94F6\u53F0\u2026":"Opening checkout\u2026";f.textContent=n;try{await Ee()}catch(r){w||se(r)}finally{f.textContent===n&&(f.textContent="")}return}At(e)}function ge(e="destroy"){if(w)return;w=!0;let t=Ze;Ze=void 0,G(t),a.signal?.removeEventListener("abort",X),i.signal?.removeEventListener("abort",X),R.finish("dismissed"),wt?.(),re.abort(),yt?.disconnect(),I?.destroy(),B?.destroy(),i.destroy(),O.open&&O.close(),O.remove(),N.remove(),k(),e==="dismiss"&&G(a.onDismiss)}U=ge;async function $e(){if(!fe||w||De||ee==="closing"||!ee&&!T())return;if(!E){ge("dismiss");return}let e=d.createElement("p");e.setAttribute("role","status"),e.textContent=o?"\u6B63\u5728\u5173\u95ED\u2026":"Closing\u2026",oe||(oe=d.createElement("div"),oe.style.cssText=J.style.cssText,J.replaceWith(oe),ie.inert=!0),x.hidden=!1,oe.replaceChildren(e,x),ee="closing",x.setAttribute("aria-disabled","true"),x.focus({preventScroll:!0});try{await E.dismiss()}catch(t){w||G(a.onError,t)}w||(ee="retry",e.textContent=o?"\u672A\u80FD\u786E\u8BA4\u5173\u95ED\uFF0C\u8BF7\u91CD\u8BD5\u3002":"Could not confirm closure. Try again.",x.textContent=o?"\u91CD\u8BD5\u5173\u95ED":"Retry closing",x.removeAttribute("aria-label"),x.removeAttribute("aria-disabled"))}x.onclick=()=>{$e()},O.addEventListener("cancel",e=>{e.preventDefault(),$e()}),C.onclick=()=>{p&&j(p)};function ot(e){R.finish("error",e),ge()}function st(){if(!(!bt||fe||w||De||I&&!T()))try{let e=t=>{a.focusAtReveal&&(k=ft(d)),B?.setHidden?.(!1),et?.(),I&&(O.showModal(),I.responsive&&O.focus({preventScroll:!0}),!t&&a.loading!=="host"&&Mt(O,I.type,I.responsive)),t&&a.loading!=="host"&&typeof ie.animate=="function"&&!d.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches&&ie.animate([{opacity:.55},{opacity:1}],{duration:160,easing:"ease-out"}),fe=!0};E?E.present(()=>R.present(()=>e(!0))):R.present(e)}catch(e){ot(e),se(e)}}try{if(Te.type==="inline"?(ze(),et=Ht(N,_),_.append(N)):(O.setAttribute("aria-label",m.document.name),x.textContent="\xD7",x.setAttribute("aria-label",o?"\u5173\u95ED":"Close"),Ut(x,m.document.screen.theme),x.hidden=Lt(m.document),O.append(x,N),_.append(O),I=_t(O,{...m.document.screen,presentation:Te},Xe),I.latch(),I.responsive&&(N.style.display="flex",N.style.flexDirection="column",N.style.maxHeight="100%",ie.style.overflow="clip",ie.style.minHeight="0"),et=Vt(O)),Ge&&W){let n=Ge(W);if(typeof n=="function"&&(w?G(n):Ze=n),w)throw new DOMException("Presentation cancelled","AbortError");ze()}B=Y(ie,{mode:"live",rendererUrl:i.webViewUrl,title:m.document.name,closeActions:Yt,onAuthoredClose(n){ee||w||(x.hidden=n)},hostPresentation:()=>I?.type??Te.type,reportContentHeight:I?.responsive,onResize:n=>{if(!I?.responsive)return;let r=Math.min(n,Ke);ie.style.height=`${r}px`,I.setContentHeight(r+(oe??J).getBoundingClientRect().height)},onSelection(n){for(let[r,c]of Object.entries(n))typeof c=="number"&&typeof q[r]=="number"&&q[r]!==c&&Ct.add(r);q=n,ve()},onAction(n,r={},c,g){if(!fe||w||ee)return;let l=i.view,s=l?.document.buttons[n];if(!s)return;if(s.type==="close"&&E&&a.resumeCheckout&&i.operation&&St(S(i.operation))){$e();return}if(ae)return;if(!T()){it();return}if(s.type==="close"){j(async()=>{E?.closeAction?await E.closeAction(n):await a.onAction?.(n),ge(a.onAction?"action":"dismiss")});return}if(s.type==="action"){p=async()=>{if(s.action.type==="event"){if(!a.onEvent)throw new P("EVENT_HANDLER_REQUIRED","Provide the event handler");await a.onEvent(s.action.event)}else a.onOpenUrl?await a.onOpenUrl(s.action.url):d.defaultView?.location.assign(s.action.url);await a.onAction?.(n),p=null},j(p);return}if(a.allowNewPurchase===!1){pe()&&l&&i.quote&&i.operation&&S(i.operation).type==="checkout"&&Me(i.quote,l,n,s.product,r,g)?j(rt,n):f.textContent=o?"\u5F53\u524D\u53EA\u80FD\u7EE7\u7EED\u539F\u8BA2\u5355\u3002":"Only your original checkout is available.";return}if(te&&i.canReselect===!1){f.textContent=o?"\u8BF7\u5148\u786E\u8BA4\u6216\u53D6\u6D88\u5F53\u524D\u8D2D\u4E70\u3002":"Confirm or cancel the current purchase first.",I?.responsive||te.scrollIntoView?.({block:"nearest"}),te.querySelector("button")?.focus({preventScroll:!0});return}if(pe()&&K){K.selection.actionId===n&&j(()=>kt(!0),n);return}if(pe()&&a.terminateCheckout&&l&&i.quote&&i.operation&&i.canReselect===!1&&S(i.operation).type==="checkout"){if(Me(i.quote,l,n,s.product,r,g)){j(rt,n);return}let V=de(s.product,r,l.capabilities);try{if(!V)throw new P("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");me(l.document.screen,V,r,l.capabilities)}catch(le){se(le);return}let ce=i.operation.operationId,ne={actionId:n,requestId:crypto.randomUUID(),selection:structuredClone(r)},H=Ne(l,n,V,r,g);j(()=>Kt(ce,ne,H),n);return}if((i.quote||b)&&i.canReselect===!1){let V=!!l&&!!i.quote&&Me(i.quote,l,n,s.product,r,g);_e=!!i.quote&&!V,p=i.quote?()=>at(V):xe,j(p);return}let L=l&&de(s.product,r,l.capabilities);if(!l||!L){se(new P("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(a.onPurchaseIntent){p=null,j(async()=>{let V={actionId:n,productVersionId:L,selection:structuredClone(r),featureQuantities:me(l.document.screen,L,r,l.capabilities)};tt=!0,await a.onPurchaseIntent(V)});return}if(b&&b.actionId!==n){se(new P("COMMAND_PENDING","Finish the current purchase"));return}b||(F=Ne(l,n,L,r,g),b={requestId:crypto.randomUUID(),actionId:n,selection:structuredClone(r)},ye=!1,we=!1),j(xe,n)},onEscape:()=>{$e()},onError:n=>{let r=new Error(n);!fe&&!w&&ot(r),se(r)},onRendered:n=>{n&&O.setAttribute("aria-label",n),bt=!0,st()}}),B.setHidden?.(!0),Xe();let e=pe()&&!!i.quote&&!!i.operation&&S(i.operation).type==="checkout";q=i.quote?Gt(m,i.quote)??Fe(m,{}):Fe(m,{}),B.update(m.document.screen,We,{capabilities:he(m),unavailableActions:ht(m),serverInput:{bindings:[],answers:{}},...Object.keys(q).length?{selection:q}:{}}),wt=i.subscribe?.(Se),Se(i.view??m),await R.wait(B.ready);let t=i.operation;!e&&(i.quote||t&&(t.confirmedAt||t.checkoutUrl||Re(t)))&&(p=It,j(p))}catch(e){throw ot(e),e}return{check:Z,host:{get observing(){return Ye},get recovery(){return Jt()},async prepareFallback(){if(ae||w||ee||tt)return{type:"recover",operationId:i.operation?.operationId??i.quote?.operationId??null,requestId:null};ke(!0);try{let e=await Dt(i);return e.type==="native"&&ge(),e}finally{ke(!1)}},setSuspended(e){De=e,N.hidden=e,e&&O.open?O.close():!e&&!fe?st():!e&&!w&&fe&&Te.type!=="inline"&&!O.open&&O.showModal()},destroy:ge,refresh:async()=>{if(!T()){if(i.view)return i.view;throw new P("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await i.refresh();return Se(e),st(),e}}}}export{_n as showPaywall};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as a}from"./chunk-EIVFBGI5.js";import"./chunk-UBUFXGS7.js";import"./chunk-MBWUIYCH.js";import"./chunk-L7OMFH4O.js";import"./chunk-JZ73DRHT.js";import"./chunk-ZQAAZ7Q4.js";import"./chunk-WQN2D5FZ.js";import"./chunk-JDUB4T4P.js";import"./chunk-VILB5M4X.js";import"./chunk-D3WC3T4U.js";import"./chunk-UIKMEVXM.js";import"./chunk-GFSAWDV2.js";import"./chunk-GJLCTQJN.js";import"./chunk-4LIM2ZQR.js";import"./chunk-DTOYPMAW.js";import"./chunk-KAMYLHAT.js";import"./chunk-MFAEHTOH.js";import"./chunk-XB24ATBA.js";import"./chunk-3VUPVXAV.js";import"./chunk-YPN2ZL2V.js";import"./chunk-6RGARS6I.js";import"./chunk-XWD4N2QI.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as readPaywallContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-ASCVMPXG.js";import"./chunk-L42A5KVA.js";import"./chunk-7MTQQIGR.js";import"./chunk-PPOPJTHA.js";import"./chunk-CI7UPAWD.js";import"./chunk-A37ZU2AP.js";import"./chunk-EIVFBGI5.js";import"./chunk-UBUFXGS7.js";import"./chunk-MBWUIYCH.js";import"./chunk-L7OMFH4O.js";import"./chunk-JZ73DRHT.js";import"./chunk-CRCAYVV5.js";import"./chunk-EQKTKITL.js";import"./chunk-ZQAAZ7Q4.js";import"./chunk-WQN2D5FZ.js";import"./chunk-JDUB4T4P.js";import"./chunk-VILB5M4X.js";import"./chunk-SWULFBRF.js";import"./chunk-D3WC3T4U.js";import"./chunk-UIKMEVXM.js";import"./chunk-GFSAWDV2.js";import"./chunk-GJLCTQJN.js";import"./chunk-4LIM2ZQR.js";import"./chunk-DTOYPMAW.js";import"./chunk-KAMYLHAT.js";import"./chunk-MFAEHTOH.js";import"./chunk-XB24ATBA.js";import"./chunk-3VUPVXAV.js";import"./chunk-YPN2ZL2V.js";import"./chunk-6RGARS6I.js";import"./chunk-DSPLGTQI.js";import"./chunk-XWD4N2QI.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i}from"./chunk-TWQB35B7.js";import"./chunk-HIUSHWDK.js";import"./chunk-GFSAWDV2.js";import"./chunk-GJLCTQJN.js";import"./chunk-4LIM2ZQR.js";import"./chunk-DTOYPMAW.js";import"./chunk-KAMYLHAT.js";import"./chunk-MFAEHTOH.js";import"./chunk-XB24ATBA.js";import"./chunk-6RGARS6I.js";import"./chunk-DSPLGTQI.js";import"./chunk-XWD4N2QI.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};
|
|
File without changes
|
|
File without changes
|