@tinkerlandai/longplay-sdk 0.10.34 → 0.10.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +83 -5
  3. package/README.zh-CN.md +26 -3
  4. package/dist/{ai-usage-T62xehqa.d.ts → ai-usage-DXwAGTxT.d.ts} +1 -1
  5. package/dist/{api-Do-6AyWa.d.ts → api-r6FfVQpg.d.ts} +6 -1
  6. package/dist/check-response-DHY6T5Z2.js +1 -0
  7. package/dist/{chunk-7MNJH5GB.js → chunk-2HSD2SEU.js} +1 -1
  8. package/dist/chunk-2KKLY323.js +1 -0
  9. package/dist/{chunk-BXPXJARS.js → chunk-35VG2IYD.js} +1 -1
  10. package/dist/chunk-3NCMYTNG.js +1 -0
  11. package/dist/{chunk-HQITRRHF.js → chunk-5XIKN35D.js} +1 -1
  12. package/dist/chunk-5XKFUFXK.js +1 -0
  13. package/dist/chunk-7ZEXY4GC.js +1 -0
  14. package/dist/chunk-BL7E4RZ2.js +1 -0
  15. package/dist/{chunk-FYQXSGRT.js → chunk-BTPEXSNY.js} +1 -1
  16. package/dist/chunk-C4GBV32U.js +10 -0
  17. package/dist/chunk-CGXNU5BC.js +1 -0
  18. package/dist/chunk-DB4EO3JG.js +1 -0
  19. package/dist/chunk-DHT3AWJQ.js +1 -0
  20. package/dist/chunk-GLYFT5WW.js +1 -0
  21. package/dist/chunk-HS56A4IK.js +1 -0
  22. package/dist/chunk-HVVJGLYZ.js +1 -0
  23. package/dist/chunk-HYE2YQYM.js +1 -0
  24. package/dist/chunk-I6D25FWU.js +1 -0
  25. package/dist/{chunk-TYY3MUTF.js → chunk-IOBB6KFK.js} +1 -1
  26. package/dist/chunk-JOIPLLHK.js +1 -0
  27. package/dist/{chunk-MIBRUDIS.js → chunk-LAGGWYH3.js} +1 -1
  28. package/dist/{chunk-6T575JKD.js → chunk-LVG5ED52.js} +1 -1
  29. package/dist/{chunk-I6TSQQ5N.js → chunk-M3GGR53D.js} +1 -1
  30. package/dist/chunk-MHWPEMX7.js +1 -0
  31. package/dist/chunk-MYBUQFTC.js +1 -0
  32. package/dist/{chunk-7QL4GF4C.js → chunk-O4KXODTJ.js} +1 -1
  33. package/dist/chunk-OL2AI6DA.js +1 -0
  34. package/dist/chunk-QHJWVLJC.js +1 -0
  35. package/dist/chunk-R3YVDRTB.js +1 -0
  36. package/dist/chunk-RHF4NFCZ.js +1 -0
  37. package/dist/{chunk-5HJYR6Z4.js → chunk-RHWZRHK7.js} +1 -1
  38. package/dist/{chunk-X4W22IH6.js → chunk-TIQS5DUF.js} +1 -1
  39. package/dist/chunk-U4WUX3WB.js +1 -0
  40. package/dist/chunk-UHTTCVSL.js +1 -0
  41. package/dist/{chunk-UWLEGMWX.js → chunk-UVUFJO2V.js} +1 -1
  42. package/dist/{chunk-7NELM6EH.js → chunk-VKG6BB3Z.js} +1 -1
  43. package/dist/chunk-VWMFR22O.js +1 -0
  44. package/dist/chunk-W32FI2A2.js +1 -0
  45. package/dist/chunk-W3K5ARMY.js +1 -0
  46. package/dist/chunk-WRLVPHPE.js +1 -0
  47. package/dist/chunk-XE7GU6FZ.js +1 -0
  48. package/dist/{chunk-EQPEUPMG.js → chunk-XQTCEQXI.js} +1 -1
  49. package/dist/chunk-YQX27SBG.js +1 -0
  50. package/dist/{chunk-VYFSRHXM.js → chunk-ZYF6TRJ3.js} +1 -1
  51. package/dist/{configuration-sync-DdTRUv7A.d.ts → configuration-sync-BHrAf-ql.d.ts} +10 -1
  52. package/dist/content-RGKTEV23.js +1 -0
  53. package/dist/funnel-host-purchase-M7MM33EC.js +1 -0
  54. package/dist/{funnel-local-client-BeGBvi3z.d.ts → funnel-local-client-DR8OpKGU.d.ts} +167 -25
  55. package/dist/funnel-paywall-prerender-OSBI4VMY.js +1 -0
  56. package/dist/{funnel-process-client-C6QKDZun.d.ts → funnel-process-client-C87U4r_G.d.ts} +17 -3
  57. package/dist/funnel-runtime-host-AMJXEASH.js +1 -0
  58. package/dist/index.d.ts +214 -63
  59. package/dist/index.js +1 -1
  60. package/dist/merchant-bridge-contracts-GJQVKEAG.js +1 -0
  61. package/dist/native-shell.js +1 -1
  62. package/dist/openrouter.d.ts +3 -3
  63. package/dist/openrouter.js +1 -1
  64. package/dist/operation-contracts-MFK2KORK.js +1 -0
  65. package/dist/page.d.ts +2 -2
  66. package/dist/page.js +1 -1
  67. package/dist/paywall-ATZ2IZPS.js +1 -0
  68. package/dist/paywall-content-XERXGNND.js +1 -0
  69. package/dist/paywall-session-EMMF6IYS.js +1 -0
  70. package/dist/popup.d.ts +21 -3
  71. package/dist/popup.js +1 -1
  72. package/dist/{presentation-loading-CFSiS0VX.d.ts → presentation-loading-B_v5XZtM.d.ts} +11 -1
  73. package/dist/react-native.d.ts +7 -7
  74. package/dist/react-native.js +1 -1
  75. package/dist/{screen-CGCJ46b1.d.ts → screen-qUBRsUi9.d.ts} +26 -21
  76. package/dist/screen-renderer-B7LUTPTJ.js +1 -0
  77. package/dist/server.d.ts +37 -7
  78. package/dist/server.js +2 -2
  79. package/dist/{visual-dom-6DCUZGPB.js → visual-dom-5LUN4AHO.js} +1 -1
  80. package/dist/visual.js +1 -1
  81. package/package.json +1 -1
  82. package/dist/chunk-3JJYWRA3.js +0 -1
  83. package/dist/chunk-4WZVC4TM.js +0 -1
  84. package/dist/chunk-5JWMP4YD.js +0 -1
  85. package/dist/chunk-7VRZYSTR.js +0 -1
  86. package/dist/chunk-EHDHWYVJ.js +0 -1
  87. package/dist/chunk-ERJP2GBD.js +0 -1
  88. package/dist/chunk-ILEDKSRQ.js +0 -1
  89. package/dist/chunk-ITGERPCJ.js +0 -1
  90. package/dist/chunk-N7YXDSQL.js +0 -1
  91. package/dist/chunk-NAZU3EEJ.js +0 -1
  92. package/dist/chunk-QBA3B4YK.js +0 -1
  93. package/dist/chunk-R23IGK5U.js +0 -1
  94. package/dist/chunk-R4FDIYMN.js +0 -1
  95. package/dist/chunk-RKPAIF6U.js +0 -1
  96. package/dist/chunk-SCC3O2RD.js +0 -1
  97. package/dist/chunk-TDSATEGE.js +0 -10
  98. package/dist/chunk-THMGTRXP.js +0 -1
  99. package/dist/chunk-U6UHASIB.js +0 -1
  100. package/dist/chunk-WKIR2EQG.js +0 -1
  101. package/dist/chunk-WTVLNUMS.js +0 -1
  102. package/dist/chunk-ZGCKQWQ5.js +0 -1
  103. package/dist/content-ORU4ODJQ.js +0 -1
  104. package/dist/funnel-host-purchase-BEFE3N3E.js +0 -1
  105. package/dist/funnel-runtime-host-V6TYIDX3.js +0 -1
  106. package/dist/merchant-bridge-contracts-ZUQ6SGXZ.js +0 -1
  107. package/dist/operation-contracts-443N2P3A.js +0 -1
  108. package/dist/paywall-HO4PS472.js +0 -1
  109. package/dist/paywall-session-MZXFOPTR.js +0 -1
  110. package/dist/screen-renderer-W7ZGBFIR.js +0 -1
  111. /package/dist/{chunk-BID4UGWB.js → chunk-CILM5XMH.js} +0 -0
  112. /package/dist/{chunk-UKMEW5I7.js → chunk-OJM6ORHE.js} +0 -0
  113. /package/dist/{chunk-VF6QMMEA.js → chunk-ZYN4CRHS.js} +0 -0
@@ -1 +0,0 @@
1
- import{a as $,m as K,p as Z}from"./chunk-NAZU3EEJ.js";import{M as S,a as v,b as A,c as C,f as h,g as f,k as j,l as R,m as D,n as P,o as M,q as b,r as y}from"./chunk-SCC3O2RD.js";import{j as O,o as Q,p as G}from"./chunk-R23IGK5U.js";import{a as u,d as k,e as g,f as N,g as U,i as q,j as B,k as V,o as F,t as L}from"./chunk-N7YXDSQL.js";import{b as t}from"./chunk-VF6QMMEA.js";var W={funnelId:t.uuid().optional(),funnelVersionId:t.uuid().optional()};var Y=t.strictObject({runId:t.uuid(),bindingId:t.uuid(),receiptId:t.uuid()});var _e=t.registry(),{BillingInterval:H}=(()=>{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:Ie}=(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:xe}=(e=>({withSpecDefault:({schema:n,defaultValue:r,description:a})=>(e.add(n,{description:a,default:r}),n)}))(_e),{COMMON:X}={COMMON:["usd","eur","gbp","cad","aud","jpy","chf","cny","inr"]},{STRIPE_PRESENTMENT_CURRENCIES:ve}={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:Ae}=(e=>({COMMON_SET:new Set(e)}))(X),{hasNoDuplicateCurrencies:J}={hasNoDuplicateCurrencies:i=>{let n=new Set;for(let{currency:r}of i){let a=r.toLowerCase();if(n.has(a))return!1;n.add(a)}return!0}},{DUPLICATE_CURRENCY_MESSAGE:z}={DUPLICATE_CURRENCY_MESSAGE:"Each currency may appear at most once in additional_currencies."},{ApiStripePriceProcessorSchema:Ce}=(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:Pe}={Infinite:"inf"},{TierBehavior:Me}=(()=>{var e;return(function(i){i.Graduated="graduated",i.VolumeBased="volume"})(e||(e={})),{TierBehavior:e}})(),{BillingMethod:ee}=(()=>{var e;return(function(i){i.Prepaid="prepaid",i.UsageBased="usage_based"})(e||(e={})),{BillingMethod:e}})(),{AllocatedBilling:Oe}=(()=>{var e;return(function(i){i.Arrear="arrear",i.ProratedLegacy="prorated_legacy"})(e||(e={})),{AllocatedBilling:e}})(),{CREDIT_DIMENSION_NAME_MAX_LENGTH:we}={CREDIT_DIMENSION_NAME_MAX_LENGTH:64},{USAGE_ATTRIBUTION_DIMENSION_SEPARATOR:Ee}={USAGE_ATTRIBUTION_DIMENSION_SEPARATOR:"::"},{CreditMatchSchema:Te}=(e=>({CreditMatchSchema:e.record(e.string(),e.union([e.string(),e.number(),e.boolean()]).transform(String).pipe(e.string()))}))(t),{ApiCreditTierSchema:te}=(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:je}={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:ie}=(e=>({MarkupEntrySchema:e.object({markup:e.number().min(-100)})}))(t),{ModelMarkupsSchema:Re}=((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,ie),{InvoiceUsageEntrySchema:De}=(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:ne}=(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:ke}=(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:Ne}=(e=>({UnixMsTimestampSchema:e.number().int().safe().nonnegative()}))(t),{CreateInvoicePreviewLineSchema:Ue}=(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:Ot}=(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:wt}=(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:qe}=((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,H,Ie),{CURRENCY_CODES:Be}=((e,i,n)=>({CURRENCY_CODES:[...e,...i.filter(a=>!n.has(a)).sort()]}))(X,ve,Ae),{ApiPriceProcessorsSchema:re}=((e,i)=>({ApiPriceProcessorsSchema:e.object({stripe:i.nullish()}).meta({"x-atmn-mapping":!0})}))(t,Ce),{AllocatedBillingFieldSchema:Ve}=((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,Oe),{CreditDimensionNameSchema:Fe}=((e,i,n)=>({CreditDimensionNameSchema:e.string().min(1).max(i).refine(a=>!a.includes(n),{message:`Dimension names cannot contain "${n}"`})}))(t,we,Ee),{ApiCreditMatchSchema:ae}=(e=>({ApiCreditMatchSchema:e.meta({description:"Event properties this entry applies to. Every key must equal the tracked property, compared as strings."})}))(Te),{findCreditTierViolations:Le}=(e=>({findCreditTierViolations:n=>{let r=[],a=(o,m)=>r.push({index:o,reason:m,message:e[m]}),s=0;for(let[o,m]of n.entries()){let p=o===n.length-1;if(m==="inf"){p||a(o,"non_final_infinity");continue}(!Number.isFinite(m)||m<=s)&&a(o,"not_increasing"),s=m,p&&a(o,"final_not_infinity")}return r}}))(je),{ApiCreditMultiplierSchema:Qe}=((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,ae),{ProviderMarkupsSchema:Ge}=((e,i)=>({ProviderMarkupsSchema:e.record(e.string(),i).nullish()}))(t,ie),{InvoiceFeatureQuantitySchema:oe}=((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(a=>a.quantity!==void 0!=(a.usage!==void 0),{message:"Provide exactly one of quantity or usage."})}))(t,ee,De),{CreateInvoicePreviewSchema:Et}=((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,Ue),{SUPPORTED_SET:$e}=(e=>({SUPPORTED_SET:new Set(e)}))(Be),{ApiCreditDimensionBaseSchema:Ke}=((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,ae),{refineGraduatedTiers:ce}=(e=>({refineGraduatedTiers:(n,r)=>{let a=e(n.tiers.map(s=>s.to));for(let{index:s,message:o}of a)r.addIssue({code:"custom",message:o,path:["tiers",s,"to"]})}}))(Le),{ApiFeatureMarkupsOverrideSchema:Ze}=((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,Ge,Re),{isValidCurrencyCode:We}=(e=>({isValidCurrencyCode:n=>!!n&&e.has(n.toLowerCase())}))($e),{ApiCreditDimensionSchema:Ye}=((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,Ke,te,ce),{CurrencyCodeSchema:se}=((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,We),{AdditionalCurrencyTierSchema:He}=((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,se),{ApiCreditSchemaItemBaseSchema:ue}=((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,Fe,Ye,Qe),{ApiFlatCreditSchemaItemSchema:Xe}=((e,i)=>({ApiFlatCreditSchemaItemSchema:e.extend({credit_cost:i.number().min(0).meta({description:"Credits consumed per billing-unit group."})}).strict()}))(ue,t),{AdditionalCurrencyPriceSchema:Je}=((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,se),{AdditionalCurrencyTierArraySchema:ze}=((e,i,n,r)=>({AdditionalCurrencyTierArraySchema:e.array(i).refine(n,{message:r})}))(t,He,J,z),{ApiGraduatedCreditSchemaItemSchema:et}=((e,i,n,r)=>({ApiGraduatedCreditSchemaItemSchema:e.extend({tier_behavior:i.literal("graduated"),tiers:i.array(n).min(1)}).strict().superRefine(r)}))(ue,t,te,ce),{AdditionalCurrencyPriceArraySchema:me}=((e,i,n,r)=>({AdditionalCurrencyPriceArraySchema:e.array(i).refine(n,{message:r})}))(t,Je,J,z),{ApiUsageTierWithCurrenciesSchema:tt}=((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(a=>a.amount!==void 0||a.flat_amount!==void 0,{message:"Either amount or flat_amount, or both must be defined",path:["amount","flat_amount"]}).transform(a=>({...a,amount:a.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,Pe,ze),{ApiCreditSchemaItemSchema:it}=((e,i,n)=>({ApiCreditSchemaItemSchema:e.union([i,n])}))(t,et,Xe),{BasePriceParamsSchema:nt}=((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."})}))(qe,xe,t,me),{PlanItemPriceParamsSchema:rt}=((e,i,n,r,a,s,o)=>({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(a).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(s).meta({description:"'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go."}),allocated_billing:o,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,me,tt,Me,H,ee,Ve),{ApiFeatureOverrideSchema:at}=((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,it,Ze),{InvoiceBasePriceParamsSchema:de}=((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()}))(nt,re),{InvoiceItemPriceParamsSchema:ot}=((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()}))(rt,re),{InvoiceLicenseQuantitySchema:ct}=((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,de,oe),{InvoiceCustomizeItemSchema:st}=((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,ot,at),{InvoiceCustomizeSchema:ut}=((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,de,st),{InvoicePlanParamsSchema:mt}=((e,i,n,r,a)=>({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(a).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,ut,oe,ct,ne),{CreateInvoiceParamsSchema:Tt}=((e,i,n,r,a)=>({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:a.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:a.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(o=>o.period_start===void 0==(o.period_end===void 0),{message:"period_start and period_end must be provided together."}).refine(o=>o.period_start===void 0||o.period_end===void 0||o.period_end>o.period_start,{message:"period_end must be after period_start."})}))(t,mt,ke,ne,Ne);var w=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:q,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(a=>a.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 pe=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:N,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{U(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 _=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"),Qt=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 ai=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:O.optional(),plans:t.array(t.strictObject({productVersionId:t.uuid(),seatQuantities:t.record(_,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"),oi=t.strictObject({operationId:t.uuid()}),c=t.number().int().min(0).max(1e8),dt=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:c,seats:t.array(t.strictObject({key:_,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:c})).max(20),prepaid:t.array(pe).max(100).optional(),catalogAmountMinor:c,trial:j.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"),fe=t.string().regex(/^[A-Za-z0-9_-]{1,200}$/),pt=t.strictObject({id:fe,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"),lt=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()}),be=t.strictObject({invoiceMode:l.optional(),append:lt.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:fe,terms:pt})).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})}),ht=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:Q,duration:G,amountMinor:c,allocations:t.array(t.strictObject({productVersionId:t.uuid(),amountMinor:c})).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:c,discountMinor:c,taxMinor:c,totalMinor:c}).nullable(),expiresAt:t.iso.datetime({offset:!0}),provider:t.enum(["stripe","apple","google","merchant"]),nativeOffer:O.optional(),currency:u,lines:t.array(dt).min(1).max(20),catalogAmountMinor:c,nativeDiscountMinor:c.optional(),automaticTax:t.boolean(),execution:t.union([be,v]).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"),ci=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([be,v]).nullable(),currency:u,catalogAmountMinor:c,taxMinor:c,totalMinor:t.number().int().min(0).max(2e8).nullable(),quoteFinalized:t.boolean(),nativePurchase:w.nullable(),confirmedAt:t.iso.datetime({offset:!0}).nullable().optional(),quote:ht.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"),x=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()}),si=t.strictObject({requestId:t.uuid(),offerId:t.uuid().optional(),invoiceMode:l.optional(),membershipId:t.uuid(),carryOverBalances:x.optional(),carryOverUsages:x.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()}),t.strictObject({type:t.literal("seats"),licenseKey:_,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"),I=t.string().regex(/^price_[A-Za-z0-9]+$/),le=t.strictObject({grooveUpdateId:t.uuid(),grooveCustomerId:t.uuid()}),he=t.strictObject({price:I.nullable(),priceId:t.uuid().optional(),quantity:t.number().int().min(0).max(1e4)}),ye=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(he).max(20),remove:t.array(I).max(20),restoreItems:t.array(t.strictObject({price:I,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:le}).nullable(),cancel:t.strictObject({prorate:t.literal(!1),invoiceNow:t.literal(!1)}).nullable(),schedule:t.strictObject({currentItems:t.array(t.strictObject({price:I,quantity:t.number().int().min(0).max(1e4)})).max(20),nextItems:t.array(he).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:le}).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"),ge=t.strictObject({merchantTerms:b.optional(),carryOverBalances:x.optional(),carryOverUsages:x.optional(),operationId:t.uuid(),membershipId:t.uuid(),productVersionId:t.uuid(),timing:t.enum(["immediate","renewal"]),effectiveAt:t.iso.datetime({offset:!0}),expiresAt:t.iso.datetime({offset:!0}),currency:u,creditMinor:c,debitMinor:c,discountMinor:c,taxMinor:c,totalMinor:c,retainedProductVersionIds:t.array(t.uuid()).max(19),execution:t.union([ye,A])}).refine(e=>!e.merchantTerms||e.execution.provider==="merchant"&&y(e.merchantTerms,e.operationId,"subscription_change",e.currency)),ft=t.strictObject({operationId:t.uuid(),invoiceMode:t.boolean().optional(),membershipId:t.uuid(),productVersionId:t.uuid(),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([ye,A]).nullable(),confirmedAt:t.iso.datetime({offset:!0}).nullable().optional(),merchantExecution:f.nullable().optional(),problem:h.nullable().optional(),quote:ge.optional(),authority:S.optional()}).refine(e=>e.execution===null||e.executor==="merchant","Only record-only changes carry execution instructions"),bt=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:c,policy:t.enum(["apple_store","google_full_price"])})}),yt=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:w.nullable()}),ui=t.union([ge,bt]),mi=t.union([ft,yt]),E=R,d=D,di=t.strictObject({requestId:t.uuid(),invoiceId:t.uuid(),...M.shape}).refine(P,"A partial refund states amountMinor; a full refund refunds the remaining amount"),Se=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:E,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)}),gt=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:E,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([Se,C]),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"),St=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:E,mode:t.enum(["full","partial"]),entitlementAction:t.enum(["retain","revoke"]),refundId:t.string().min(1).max(200).nullable(),quote:gt.optional(),execution:t.union([Se,C]).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"),pi=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(St).max(50)}).refine(e=>e.operations.every(i=>i.invoiceId===e.invoiceId),"Refund operations belong to the invoice"),li=t.strictObject({requestId:t.uuid(),...M.shape}).refine(P,"A partial refund states amountMinor; a full refund refunds the remaining amount");var Ai=t.strictObject({processContext:Y.optional(),...W,selector:t.discriminatedUnion("type",[t.strictObject({type:t.literal("paywall"),paywallId:t.uuid()}),t.strictObject({type:t.literal("version"),versionId:t.uuid()})]),customerId:t.uuid().optional(),commerce:B,locale:t.string().min(1).max(35),requirement:V.optional()}),T=t.strictObject({id:t.uuid(),paywallId:t.uuid(),version:t.number().int().positive(),document:$.omit({requirement:!0,offeringId:!0}),offering:t.strictObject({id:t.uuid()}),content:t.strictObject({environmentId:t.uuid(),offeringVersionId:t.uuid(),artifact:Z.refine(e=>e.kind==="paywall"&&e.formatVersion===1)}).optional(),capabilities:L,check:F.nullable()}).superRefine((e,i)=>{let n=new Set(e.document.products.items.map(r=>r.productVersionId));(e.document.offeringVersionId!==e.offering.id||Object.values(e.capabilities.plans).some(r=>!n.has(r.versionId)))&&i.addIssue({code:"custom",message:"Paywall resolution must preserve the exact Offering Version and displayed Product subset"})}),Ci=t.strictObject(T.shape).omit({document:!0,offering:!0}).extend({content:T.shape.content.unwrap()});function Pi(e,i){let n=K.parse(i);if(n.offeringVersionId!==e.content.offeringVersionId)throw new Error("Public Paywall Offering pin changed");let r=structuredClone(e.capabilities);for(let[a,s]of Object.entries(n.catalog)){let o=r.plans[a],m=s.channels.stripe?.prices.find(p=>p.currency===o?.currency);o&&m&&Object.assign(o,{amountMinor:m.amountMinor,interval:s.interval,intervalCount:s.intervalCount,...s.prepaid?.length?{prepaid:s.prepaid}:{}})}return T.parse({...e,capabilities:r,document:{schemaVersion:3,kind:n.kind,name:n.name,presentation:n.presentation,products:n.products,offeringVersionId:n.offeringVersionId,screen:n.screen,buttons:n.buttons},offering:{id:n.offeringVersionId}})}export{W as a,Y as b,Ot as c,Et as d,Tt as e,ai as f,oi as g,ht as h,ci as i,si as j,ge as k,ui as l,mi as m,di as n,gt as o,St as p,Ai as q,T as r,Ci as s,Pi as t};
@@ -1 +0,0 @@
1
- import{E as k}from"./chunk-N7YXDSQL.js";import{a as M}from"./chunk-DSPLGTQI.js";var z={sm:420,md:640,lg:900},A=767;function pe(e,n,o=()=>!0,c="Close"){let r=e.ownerDocument.defaultView,i=e.ownerDocument.createElement("button");i.type="button",i.setAttribute("aria-label",c),i.style.cssText="position:absolute;inset:0 48px auto;z-index:2;height:24px;border:0;padding:0;background:transparent;touch-action:none;cursor:grab";let d=e.ownerDocument.createElement("span");d.style.cssText="display:block;width:36px;height:4px;border-radius:4px;margin:8px auto 12px;background:currentColor;opacity:.22;pointer-events:none",i.append(d),e.prepend(i);let l,s=0,a=!1,f=()=>{i.hidden=e.dataset.presentation!=="sheet",i.setAttribute("aria-disabled",String(!o()))},v=t=>{f(),!(i.hidden||!o()||t.button!==0)&&(l={y:t.clientY,time:Date.now(),id:t.pointerId},s=0,a=!1,i.setPointerCapture?.(t.pointerId))},y=t=>{!l||t.pointerId!==l.id||(s=Math.max(0,t.clientY-l.y),e.style.transform=`translateY(${s}px)`)},g=t=>{if(!l||t.pointerId!==l.id)return;let u=Math.max(1,Date.now()-l.time),x=t.type!=="pointercancel"&&o()&&(s>120||s>40&&s/u>.5);a=s>6,l=void 0,i.releasePointerCapture?.(t.pointerId),e.style.transform="",x?n():s&&typeof e.animate=="function"&&!r?.matchMedia?.("(prefers-reduced-motion: reduce)").matches&&e.animate([{transform:`translateY(${s}px)`},{transform:"none"}],{duration:200,easing:"cubic-bezier(.2,.8,.2,1)"}),s=0},m=()=>{if(a){a=!1;return}!l&&s===0&&o()&&n()};i.addEventListener("pointerdown",v),i.addEventListener("pointermove",y),i.addEventListener("pointerup",g),i.addEventListener("pointercancel",g),i.addEventListener("click",m);let p=typeof MutationObserver=="function"?new MutationObserver(f):void 0;return p?.observe(e,{attributes:!0,attributeFilter:["data-presentation"]}),r?.addEventListener("resize",f),f(),()=>{p?.disconnect(),r?.removeEventListener("resize",f),i.remove(),e.style.transform=""}}function O(e,n,o=!1){return(e.type==="modal"||e.type==="sheet")&&e.mobile&&o&&n<=A?e.mobile:e.type}function W(e,n,o){let c=e.ownerDocument.defaultView,r=n.presentation,i;if((r.type==="modal"||r.type==="sheet")&&r.backdrop){let t=`lp-backdrop-${crypto.randomUUID()}`,u={none:"transparent",scrim:"#f2f2f2cc",dim:"#0006","strong-dim":"#000000bf",blur:"#0006"};e.dataset.indianaBackdrop=t,i=e.ownerDocument.createElement("style"),i.textContent=`dialog[data-indiana-backdrop="${t}"]::backdrop{background:${u[r.backdrop]};backdrop-filter:${r.backdrop==="blur"?"blur(16px)":"none"}}`,e.append(i)}let d=n.pages?.[0]?.root.style?.shape,l=d?.type==="pill"?"9999px":d?.type==="rect"?typeof d.radius=="number"?`${d.radius}px`:[d.radius.topLeft,d.radius.topRight,d.radius.bottomRight,d.radius.bottomLeft].map(t=>`${t}px`).join(" "):void 0,s=(r.type==="modal"||r.type==="sheet")&&(r.desktopWidth!==void 0||r.mobile!==void 0),a=r.type,f,v,y=!1,g=t=>{y||!Number.isFinite(t)||t<0||(v=t,a!=="fullscreen"&&a!=="inline"&&(e.style.height=`min(${Math.max(t,40)}px, calc(100dvh - ${a==="sheet"?0:32}px))`))},m=()=>{if(!y&&(a=f??O(r,c?.innerWidth??1024,c?.matchMedia?.("(pointer: coarse)").matches===!0),e.dataset.presentation=a,!(!s||r.type!=="modal"&&r.type!=="sheet"))){if(e.style.boxSizing="border-box",e.style.padding="0",e.style.border="0",e.style.overflow="hidden",e.style.outline="none",e.tabIndex=-1,e.style.background=n.theme.background,e.style.color=n.theme.text,a==="fullscreen")e.style.width="100vw",e.style.height="100dvh",e.style.maxWidth="100vw",e.style.maxHeight="100dvh",e.style.margin="0",e.style.borderRadius="0";else{let t=r.mobile==="sheet"&&a==="sheet",u=r.desktopWidth,x=c?.innerWidth??1024;e.style.width=t?`${x}px`:u?`${Math.min(u.max,Math.max(x*u.viewport/100,u.min))}px`:`${k[r.size]}px`,e.style.maxWidth=`${Math.max(0,x-(a==="sheet"?0:32))}px`,e.style.maxHeight=a==="sheet"?"100dvh":"calc(100dvh - 32px)",e.style.margin=a==="sheet"?"auto auto 0":"auto",e.style.borderRadius=l??(a==="sheet"?"16px 16px 0 0":"24px"),e.style.height="",v!==void 0&&g(v)}o?.(a)}},p=s?[c?.matchMedia?.(`(max-width: ${A}px)`),c?.matchMedia?.("(pointer: coarse)")].filter(t=>t!==void 0):[];if(s){c?.addEventListener("resize",m);for(let t of p)t.addEventListener?t.addEventListener("change",m):t.addListener?.(m)}return m(),{responsive:s,get type(){return a},latch(){y||f!==void 0||(m(),f=a)},setContentHeight:g,destroy(){if(!y){y=!0,i?.remove(),delete e.dataset.indianaBackdrop,c?.removeEventListener("resize",m);for(let t of p)t.removeEventListener?t.removeEventListener("change",m):t.removeListener?.(m)}}}}function ue(e,n,o){let{presentation:c}=n,r="size"in c?`${z[c.size]}px`:"100vw";return e.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${r}`,W(e,n,o)}function me(e,n,o=!1){let c=e.ownerDocument.defaultView;if(typeof e.animate!="function"||c?.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let r=o?{duration:300,easing:"cubic-bezier(0.23, 1, 0.32, 1)"}:{duration:240,easing:"cubic-bezier(0.2, 0.8, 0.2, 1)"};e.animate(n==="sheet"?[{transform:"translateY(100%)"},{transform:"none"}]:n==="modal"?[{opacity:0,transform:o?"translateY(12px) scale(0.96)":"translateY(8px) scale(0.98)"},{opacity:1,transform:"none"}]:[{opacity:0},{opacity:1}],r);try{e.animate([{opacity:0},{opacity:1}],{...r,pseudoElement:"::backdrop"})}catch{}}function $(e,n){e.style.cssText=["position:absolute","z-index:1","top:calc(4px + env(safe-area-inset-top, 0px))","inset-inline-end:calc(4px + env(safe-area-inset-right, 0px))","width:44px","height:44px","padding:0","border:0","font:400 20px/1 system-ui,sans-serif","cursor:pointer","touch-action:manipulation"].join(";"),e.style.background=`radial-gradient(circle, ${n.background} 0 15px, color-mix(in srgb, ${n.text} 22%, ${n.background}) 15px 16px, transparent 16.5px)`,e.style.color=n.text}var C=new WeakMap;function he(e,n){return C.set(e,n),()=>C.delete(e)}function xe(e){let n=e.defaultView?.HTMLElement,o=e.activeElement;for(let r=0;r<16&&o?.shadowRoot?.activeElement;r++)o=o.shadowRoot.activeElement;let c=o?C.get(o)?.():void 0;return()=>{!o?.isConnected||!n||!(o instanceof n)||(o.focus({preventScroll:!0}),c?.())}}var ge=15e3;function we(e,n,o,c,r){let i=e.ownerDocument,d=new AbortController,l=!1,s=!1,a,f;function v(){f?.(),f=void 0,a?.tagName==="DIALOG"&&a.close?.(),a?.remove(),a=void 0}function y(p,t){s||(s=!0,v(),(p==="dismissed"||p==="error")&&d.abort(t??new DOMException("Presentation cancelled","AbortError")),!(!l&&p!=="ready")&&M(n.onPresentationState,p==="error"?{surface:o,state:p,error:t}:{surface:o,state:p}))}let g=c,m=()=>{s||g()};return{setDismissHandler(p){g=p},get active(){return l&&!s},get cancelled(){return d.signal.aborted},start(p,t,u){if(!(l||s)){if(l=!0,n.loading!=="host"){let x=(t??i.documentElement.lang)||"en",b=p&&u?.presentation?.type!=="inline",S=u!==void 0,h=i.createElement(b?"dialog":"div");a=h,h.dataset.longplayLoading=o;let E=x.startsWith("zh"),I=S?E?"\u6B63\u5728\u52A0\u8F7D\u5957\u9910":"Loading plans":E?"\u6B63\u5728\u52A0\u8F7D":"Loading",R=u?.screen.theme??{background:"Canvas",text:"CanvasText"};h.setAttribute("aria-label",I);let P=i.createElement("div");P.setAttribute("role","status");let L=i.createElement("div");L.setAttribute("aria-hidden","true");let H=()=>{P.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)"};S?P.style.cssText="padding:24px 60px 24px 24px;font:500 16px/1.5 system-ui,sans-serif":H(),P.textContent=I;let w=i.createElement("button");w.type="button",w.textContent="\xD7",w.setAttribute("aria-label",E?"\u53D6\u6D88\u52A0\u8F7D":"Cancel loading"),$(w,R),w.addEventListener("click",m),h.addEventListener("cancel",D=>{D.preventDefault(),m()}),h.append(P,L,w),e.append(h);let T=()=>{if(!s&&b){let D=h;D.showModal?D.showModal():D.open=!0,w.focus({preventScroll:!0})}};u&&r?(f=r(h,L,u,x,()=>{s||(L.style.visibility="",H())}),T()):S?(h.style.cssText=b?"padding:0;border:0;border-radius:24px;background:Canvas;color:CanvasText;width:min(420px,calc(100vw - 32px))":"position:relative;background:Canvas;color:CanvasText;width:100%",T()):(_(h,L,b,o),T())}M(n.onPresentationState,{surface:o,state:"loading",dismiss:m})}},present(p){if(s)return;let t=!!a;v(),p(t),y("ready")},dismiss:m,finish:y,async wait(p,t){let u=d.signal,x,b,S=new Promise((h,E)=>{b=()=>E(u.reason),u.aborted?b():u.addEventListener("abort",b,{once:!0}),t!==void 0&&(x=setTimeout(()=>E(new Error("Presentation data timed out")),t))});try{let h=await Promise.race([S,p]);return u.throwIfAborted(),h}finally{u.removeEventListener("abort",b),clearTimeout(x)}}}}function _(e,n,o,c){e.style.cssText="position:relative;box-sizing:border-box;background:Canvas;color:CanvasText;padding:24px 48px 24px 24px;"+(o?"position:fixed;width:min(480px,calc(100% - 32px));border:0;border-radius:16px;max-height:calc(100dvh - 32px)":"width:100%"),n.style.cssText="display:grid;gap:12px";let r=c==="banner"?[["72%",12],["44%",10]]:[["46%",20],["84%",12],["65%",12],["100%",64]];for(let[i,d]of r){let l=e.ownerDocument.createElement("div");l.style.cssText=`width:${i};height:${d}px;background:currentColor;opacity:.11;border-radius:6px`,n.append(l)}}function F(e){let n={display:"block",position:"fixed",top:"0",left:"0",opacity:"0",pointerEvents:"none",zIndex:"-1"},o=Object.keys(n).map(i=>{let d=i,l=e.style[d];return e.style[d]=n[d],[d,l]}),c=e.inert??!1,r=e.getAttribute("aria-hidden");return e.inert=!0,e.setAttribute("aria-hidden","true"),()=>{for(let[i,d]of o)e.style[i]=d;e.inert=c,r===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r)}}function Se(e,n){let o=e.style.width;e.style.width=`${n.getBoundingClientRect().width||n.ownerDocument.defaultView?.innerWidth||800}px`;let c=F(e);return()=>{c(),e.style.width=o}}export{pe as a,O as b,W as c,ue as d,me as e,$ as f,he as g,xe as h,ge as i,we as j,F as k,Se as l};
@@ -1 +0,0 @@
1
- var s={name:"@tinkerlandai/longplay-sdk",version:"0.10.34",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}}};var i="https://api.longplayai.com";export{s as a,i as b};
@@ -1 +0,0 @@
1
- import{b as $A}from"./chunk-VYFSRHXM.js";import{a as y}from"./chunk-X4W22IH6.js";import{a as jA,c as BA,d as xA,e as MA,f as UA,h as sA}from"./chunk-R4FDIYMN.js";import{a as zA,b as FA}from"./chunk-WKIR2EQG.js";var pA="X-Indiana-Protocol",QA="X-Indiana-SDK-Version";var gA={current:"0.10"};function I(A){return typeof A=="string"?A:String(A)}var Se=/[\ud800-\udbff](?![\udc00-\udfff])|(^|[^\ud800-\udbff])[\udc00-\udfff]/g;function Ie(A){return A.replace(Se,"$1\uFFFD")}function yA(A,e){if(typeof A!="object"||A==null){let t="";throw t+="The provided value is not an object",new TypeError(t)}return A}function Ae(A){if(A!=null&&(typeof A=="object"||typeof A=="function")){let e=A[Symbol.iterator];if(e==null)return;if(typeof e!="function")throw new TypeError("The provided value is not iterable");let t=e.call(A);if(!t||typeof t!="object")throw new TypeError("Result of the Symbol.iterator method is not an object");return t}}function GA(A){let e;if(Array.isArray(A)){let t=A.map(I);if(t.length===2)return t}else if((e=Ae(A))!=null){let t=yA(e.next()),n=yA(e.next());if(!t.done&&!n.done)return[I(t.value),I(n.value)]}throw new TypeError("Each query pair must be an iterable [name, value] tuple")}var KA="0123456789ABCDEF",be=/(?:%[0-9A-Fa-f]{2})+/g;function M(A){return`%${KA[A>>4&15]}${KA[15&A]}`}function ee(A,e,t=!1){return A>=55296&&A<=57343&&(A=65533),A<=127?t&&A===32?"+":e(A)?M(A):String.fromCharCode(A):A<=2047?M(192|A>>6)+M(128|63&A):A<=65535?M(224|A>>12)+M(128|A>>6&63)+M(128|63&A):M(240|A>>18)+M(128|A>>12&63)+M(128|A>>6&63)+M(128|63&A)}function DA(A){return A>=48&&A<=57?A-48:A>=65&&A<=70?A-65+10:A>=97&&A<=102?A-97+10:-1}function SA(A,e=!1){let t=0;for(;t<A.length;t++){let n=A.charCodeAt(t);if(n===37||e&&n===43)break}return t===A.length?A:(e?A.replace(/\+/g," "):A).replace(be,n=>{try{return decodeURIComponent(n)}catch{return"\uFFFD".repeat(n.length/3)}})}function AA(A){return A<=31||A>126}function Ce(A){switch(A){case 32:case 34:case 60:case 62:case 96:return!0;default:return AA(A)}}function OA(A){switch(A){case 32:case 34:case 35:case 60:case 62:return!0;default:return AA(A)}}function Ee(A){return OA(A)||A===39}function IA(A){switch(A){case 63:case 94:case 96:case 123:case 125:return!0;default:return OA(A)}}function cA(A){switch(A){case 47:case 58:case 59:case 61:case 64:case 91:case 92:case 93:case 124:return!0;default:return IA(A)}}function YA(A){switch(A){case 33:case 39:case 40:case 41:case 126:return!0;default:return(function(t){switch(t){case 36:case 37:case 38:case 43:case 44:return!0;default:return cA(t)}})(A)}}function te(A,e){return ee(A=A||0,e)}function U(A,e,t=!1){let n=0;for(;n<A.length;n++){let u=A.charCodeAt(n);if(u>=128||t&&u===32||e(u))break}if(n===A.length)return A;let r=A.slice(0,n);for(;n<A.length;n++){let u=A.charCodeAt(n),l=u;if(u>=55296&&u<=56319&&n+1<A.length){let a=A.charCodeAt(n+1);a>=56320&&a<=57343&&(l=(u-55296<<10)+a-56320+65536,n++)}r+=ee(l,e,t)}return r}function RA(A){let e=[],t=0,n=0;for(;n<=A.length;){if(n=A.indexOf("&",t),n<0&&(n=A.length),n!==t){let r=A.slice(t,n),u=r.indexOf("=");u<0&&(u=r.length),e.push([SA(r.slice(0,u),!0),SA(r.slice(u+1),!0)])}if(t=n+1,n===A.length)break}return e}function bA(A){let e="";for(let t=0;t<A.length;t++){let n=U(A[t][0],YA,!0),r=U(A[t][1],YA,!0);e+=t!==0?`&${n}=${r}`:`${n}=${r}`}return e}var Te=[2191,2191,3164,3164,3292,3292,6863,6877,6880,6891,8385,8385,11158,11158,42958,42959,42962,42962,42964,42964,42993,42993,64451,64466,64912,64913,64968,64974,67904,67929,69317,69319,69328,69336,69370,69371,72544,72551,73136,73179,73184,73193,93856,93880,93883,93907,94194,94198,100344,100351,101641,101662,101760,101874,118010,118012,118458,118480,118496,118512,124608,124638,124640,124661,124670,124671,128728,128728,128887,128890,129232,129240,129620,129623,129674,129674,129678,129678,129736,129736,129741,129741,129770,129770,129775,129775,130042,130042,177978,177983,183970,183981,205744,210041],ve=[7296,7297,7298,7299,7300,7301,7302,7303,7304,42958,42962,42964,42993],Oe=["\u0432","\u0434","\u043E","\u0441","\u0442","\u0442","\u044A","\u0463","\uA64B","\uA7CF","\uA7D3","\uA7D5","s"],Re=[2381,2381,2509,2509,2637,2637,2765,2765,2893,2893,3021,3021,3149,3149,3277,3277,3387,3388,3405,3405,3530,3530,3642,3642,3770,3770,3972,3972,4153,4154,5908,5909,5940,5940,6098,6098,6752,6752,6980,6980,7082,7083,7154,7155,11647,11647,43014,43014,43052,43052,43204,43204,43347,43347,43456,43456,43766,43766,44013,44013,68159,68159,69702,69702,69744,69744,69759,69759,69817,69817,69939,69940,70080,70080,70197,70197,70378,70378,70477,70477,70606,70608,70722,70722,70850,70850,71103,71103,71231,71231,71350,71350,71467,71467,71737,71737,71997,71998,72160,72160,72244,72244,72263,72263,72345,72345,72767,72767,73028,73029,73111,73111,73537,73538,90415,90415];function ke(A){for(let e=0;e<A.length;e++){let t=A.codePointAt(e);if(t>65535&&e++,t<=32||t===37||t===127||t>=55296&&t<=57343||t>=128&&t<=159||t>=64976&&t<=65007||!(65534&~t)||t===65533)return!0}return!1}var[qe,Ne,Le,VA]=[[[],"0,6,7,8,m,w,10,1b,1d,1f,72,73,7k,8k,dt,2rk","AAAAAAAAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAA/AAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAADAAABwfwAAAAAAAMADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAQAAAAAAAAQCAAABAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgACAAAAAAAAAAAAAAAAD//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAP///////////////wAAAAAAAAAAAAAAAAAAAAA="],[[],"6,7,8,o,4o,7e,7f,7h,7i,7j,dl","AAAAAEF9+P/+BwAAAMAA//8AAPz/////BlADAAAAAJwAAPz///8AAADA//H/5+X8AAAAAAAAAAAA/P///wcAAAAAAAAAAAAAPv0vAD0BAABA/gAA/5/5/f8BAAAAAAAAgAAAAP//////////////AYD/////BQAAAAAAAAAAAAAAAAAAAAAAAP///////wcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8g+N8B+AAAAAAAAAAAAAAAAAAAAAAAAP//AwAAYAAAAAAAAAAAAAD/////CwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANgAAAAAAAAAAAAAAAAA//8fAB4AAAD//wMAAAAAAH3/HgwAAAAAAAD//////////w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],[[],"6,7,8,o,4o,7e,7f,7h,7i,7j,dl","AAAAAP3////+BwAAAMDu//////////////8vAADAAJwAAP3///8AAADg////////AAAAAAAAAAAA/P///wcAAAAAAAAAAAAA////Ab0H//9H/gAA/9////8BAAAAAAAAgAAAAP//////////////AYD/////BQAAAAAAAAAAAAAAAAAAAAAAAP///////wcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL/G//8T+AAAAAAAAAAAAAAAAAAAAAAAAP//AwAAfgAAAAAAAAAAAAD+////DwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANwAAAAAAAAAAAAAAAAA//8fAB4AAAD//wMAAAAAAH3/Hg4AAAAAAAD//////////w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],[[],"0,3,4,5,6,7,8,9,a,b,c,d,e,f,g,j,n,o,p,q,r,s,t,w,18,19,1c,4m,4o,4p,4q,4r,6z,72,73,75,76,77,7e,7h,7i,7j,7k,7l,7m,7n,7o,7p,7q,7r,7s,7t,7u,7v,7w,7x,7y,7z,8k,9t,a2,a3,a7,cc,cv,cx,cy,d6,dc,dd,de,dg,dh,di,dk,dl,2rk,2rl","AAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAD//////////////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/v////+/tgAAAAAAAAAAAP8XAAAAAAD4//8AAAEAAAAAAAAAAAAAAMCfnz0AAACAAgAAAP///wcAAAAAAAAAAAAAwP8BAAAAAAAA+A8gAADA++8+AAAAAAAOAAAAAAAAgP8AAAAAAPz///v///8HAAAAAAAAFP4h/gAMAAAAAgAAAAAAABAeIAAADAAAQAYAAAAAAAAQhjkCAAAAIwAGAAAAAAAAEL4hAAAMAAD8AgAAAAAAAJAeIGAADAAAAAQAAAAAAAAAASAAAAAAAAARAAAAAAAA0ME9YAAMAAAAAgAAAAAAAJBAMAAADAAAAAMAAAAAAAAYHiAAAAwAAAACAAAAAAAAAAAEXAAAAAAAAAAAAAAA8geAfwAAAAAAAAAAAAAAAPIfAH8AAAAAAAAAAAADAACgAgAAAAAAAP5/3+D//v///x9AAAAAAAAAAAAAAAAA4P1mAAAAwwEAHgBkIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAMAAAADAAAAAwAAAAAAAAAsD9A/g8gAAAAAAC4AAAAAAAAAAAAAAAAAABgAAAAAAIAAAAAAAAAAAAAAAAAAIcBBA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAJAAAAAAAAQH/lH/ifAAAAAAAA//////8//w8AAA8AAAAAANAXBAAAAAD4DwADAAAAPDsAAAAAAABAowMAAAAAAADwzwAAAAAAAAAAAAAAAAAAAAAAAAD3//0hEAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wDIAAAAfAAAAAAAAB/8AAAAAAAAAAAAAAAA/////wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAwAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAA/////wAAAAAAPAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAID3PwAAAMAAAAAAAAAAAAAAAwBECAAAYBAAAAAAAAAAAAAAAAAAAAAAAAAwAAAA//8DgAAAAADAPwAAgP8DAAAAAAAHAAAAAADIMwAAAAAgAAAAAAAAAAB+ZgAIEAAAAAAAEAAAAAAAAJ3BAgAAAAAwQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAICEAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAP//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAMAHAAAAAAAAAAAAAAAAAAAAAG7wAAAAAACHAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAPAAAAAAAAAAAD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAA/AAAAAAAAAAAwP8BAAAAAAA8AAAAAAAAAAAAAAAAAAAAAgAAAAAAAP9/AAAAAAAZgAMAAAAAAHgGBAAAAAAAAAAHAAAAgO8fAAAAAAAAAAgAAwAAAAAAwH8AngAAAAAAAAAAAAAAgNNAAgAAAAAAAAAAAAAAAAAAAAAAAID4BwAAAwAAAAAAABgBAAAAwB8fAAAAAAAAAAD4AUAFAAYAAAAAAAAAAAAA/1wAAEAAAAAAAAAAAAAA+IUNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8sAEAADAAAAAAAAAAAAAA+KcBAAAAAAAAAAAAAAAAKL8AAAAAAAAAAAAAAACgvA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgP8GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFgIAAAAAAAAAAAAAAAAAAAAAADwDAEAAAD+BwAAAAD4eYAAfg4AAAAAAPx/AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAF0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf78AAAAAAAAAAAAA/P///G0AAAAAAAAAAAAAAAAAAAB+tL8AAAAAAAAAAACjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAwAAAAAAwAcFAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//4H/PwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMD/4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwAAAAAAAAB/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAcAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAPAAAAAAAAAAAAAAD//////z///38AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAD+P/nDwAAADwAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////9/+P//////HyAAEAAA+P7/AAAAAAAAAAAAAH////nbBwAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAfwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASMAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfwAAAAAAAAAAAAAAAADwDwAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAA////////////////AAAAAAAAAAAAAAAAAAAAAP///////////////////////////////////////wAA"]].map(function([e,t,n]){return[e,t.split(",").map(r=>parseInt(r,36)),Uint8Array.from(atob(n),r=>r.charCodeAt(0))]});function He(A,e){return e===931||e===1010||e===120531||e===120589||e===120647||e===120705||e===120763?"\u03C3":e>=5112&&e<=5117?String.fromCodePoint(e-8):e>=43888&&e<=43967?String.fromCodePoint(e-38864):e>=93856&&e<=93880?String.fromCodePoint(e+27):e===837||e===890||e>=8064&&e<=8111||e>=8114&&e<=8188?A.normalize("NFD").replace(/\u0345/g,"\u03B9").normalize("NFC").toLowerCase():""}function ne(A,e){for(let t=0;t<A.length;t+=2)if(e>=A[t]&&e<=A[t+1])return!0;return!1}function W(A,e){let[t,n,r]=A,u=e>>8;for(let h=0;h<t.length;h+=2)if(u>=t[h]&&u<=t[h+1])return!0;let l=n.indexOf(u);if(l<0)return!1;let a=255&e;return!!(r[32*l+(a>>3)]&1<<(7&a))}function _e(A){let e=Array.from(A,t=>t.codePointAt(0));for(let t=0;t<e.length;t++){let n=e[t];if(n!==8204&&n!==8205||t>0&&ne(Re,e[t-1]))continue;if(n===8205)return!1;let r=t-1;for(;r>=0&&W(VA,e[r]);)r--;let u=t+1;for(;u<e.length&&W(VA,e[u]);)u++;if(!(r>=0&&u<e.length&&W(Ne,e[r])&&W(Le,e[u])))return!1}return!0}var je=/(?![\p{Mark}\p{Decimal_Number}])[\p{Script=Arabic}\p{Script=Hebrew}]/u,Be=/\p{Script=Latin}/u;function xe(A){return!je.test(A)||!Be.test(A)}var F=36,iA=1,CA=26,Me=38,Ue=700,$e=72,ze=128,Fe=2147483647;function XA(A){return String.fromCharCode(A+22+75*+(A<26))}function Qe(A,e,t){let n=0;for(A=t?Math.floor(A/Ue):A>>1,A+=Math.floor(A/e);A>(F-iA)*CA>>1;n+=F)A=Math.floor(A/(F-iA));return Math.floor(n+(F-iA+1)*A/(A+Me))}function Ge(A){let e=Array.from(A,h=>h.codePointAt(0)),t="",n=0;for(let h=0;h<e.length;h++){let f=e[h];f<128&&(t+=String.fromCharCode(f),n++)}let r=n;r&&(t+="-");let u=ze,l=0,a=$e;for(;n<e.length;){let h=Fe;for(let f=0;f<e.length;f++){let g=e[f];g>=u&&g<h&&(h=g)}l+=(h-u)*(n+1),u=h;for(let f=0;f<e.length;f++){let g=e[f];if(g<u&&l++,g===u){let p=l;for(let m=F;;m+=F){let P=m<=a?iA:m>=a+CA?CA:m-a;if(p<P)break;t+=XA(P+(p-P)%(F-P)),p=Math.floor((p-P)/(F-P))}t+=XA(p),a=Qe(l,n+1,n===r),l=0,n++}}l++,u++}return t}function wA(A){let e=10;if(A.length>=2&&A[0]==="0"&&(A[1]==="x"||A[1]==="X"))A=A.slice(2),e=16;else if(A.length>=2&&A[0]==="0")A=A.slice(1),e=8;else if(A==="")return-1;let t=0;for(let n=0;n<A.length;n++){let r=DA(A.charCodeAt(n));if(r>=e||r<0)return-1;t=t*e+r}return t}function JA(A){switch(A){case".":case"%2e":case"%2E":return!0;default:return!1}}function re(A,e){return(A>=65&&A<=90||A>=97&&A<=122)&&(e===58||e===124)}function se(A){return A.length===2&&re(A.codePointAt(0),A.codePointAt(1))}function WA(A){return A.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u)!==-1}function C(A){switch(A){case"ftp":case"http":case"https":case"ws":case"wss":case"file":return!0;default:return!1}}function oe(A){switch(A){case"ftp":return 21;case"http":case"ws":return 80;case"https":case"wss":return 443;default:return null}}function EA(A,e){if(A[0]==="[")return A[A.length-1]==="]"?(function(n){let r=[0,0,0,0,0,0,0,0],u=null,l=0,a=0,h=Array.from(n,f=>f.codePointAt(0));if(h[a]===58){if(h[a+1]!==58)return null;a+=2,l++,u=l}for(;a<h.length;){if(l===8)return null;if(h[a]===58){if(u!==null)return null;a++,l++,u=l;continue}let f=0,g=0,p=0;for(;p<4&&(f=DA(h[a]))>=0;)g=(g<<4)+f,a++,p++;if(h[a]===46){if(p===0||l>6)return null;a-=p;let m=0;for(;h[a]!==void 0;){let P=0;if(m>0)if(h[a]===46&&m<4)a++;else return null;if(h[a]==null||h[a]<48||h[a]>57)return null;for(;h[a]>=48&&h[a]<=57;){if(P=10*P+DA(h[a]),P>255)return null;a++}r[l]=256*r[l]+P,m++,m%2==0&&l++}if(m!==4)return null;break}else if(h[a]===58){if(h[++a]===void 0)return null}else if(h[a]!==void 0)return null;r[l]=g,l++}if(u!==null){let f=l-u;for(l=7;l!==0&&f>0;){let g=r[u+f-1];r[u+f-1]=r[l],r[l]=g,l--,f--}}else if(u===null&&l!==8)return null;return r})(A.substring(1,A.length-1)):null;if(e)return(function(n){return WA(n)?null:U(n,AA)})(A);{let t=(function(r){let u=!1,l=!1;for(let h=0;h<r.length;h++){let f=r.charCodeAt(h);if(f<=32||f===37||f===127)return null;if(f>=128){u=!0;break}f>=65&&f<=90&&(l=!0)}if(!u)return r!==""?l?r.toLowerCase():r:null;if((function(f){for(let g of f){let p=g.codePointAt(0);if(/[\p{Cn}\p{Co}\p{Cs}\p{Noncharacter_Code_Point}]/u.test(g)&&!ne(Te,p)||W(qe,p))return!0}return!1})(r))return null;let a=(r=(function(f){let g="";for(let p of f){let m=p.codePointAt(0);if(m!==8204&&m!==8205&&/\p{Default_Ignorable_Code_Point}/u.test(p))continue;let P=He(p,m);if(P){g+=P;continue}let k=ve.indexOf(m);g+=k<0?p:Oe[k]}return g})(r).normalize("NFKC").replace(/[\u3002\uff0e\uff61]/g,".").toLowerCase()).split(".");for(let h=0;h<a.length;h++){let f=a[h];if(f==="")continue;let g=/[^\0-\x7f]/.test(f);if(ke(f)||g&&(/^\p{Mark}/u.test(f)||!_e(f)||!xe(f)||f.startsWith("xn--")))return null;g&&(a[h]=`xn--${Ge(f)}`)}return(r=a.join("."))!==""?r:null})(A.indexOf("%")===-1?A:SA(A));return t===null||WA(t)?null:(function(r){let u=r.length,l=r.lastIndexOf(".",u-2)+1;if(r.charCodeAt(u-1)===46&&u--,u<=l)return!1;if(wA(r.slice(l,u))>=0)return!0;for(;l<u;l++){let a=r.charCodeAt(l);if(a<48||a>57)return!1}return!0})(t)?(function(r){let u=r.split("."),l=u.length;if(u[l-1]||l--,l>4)return null;let a=0;for(let f=0;f<l-1;f++){let g=wA(u[f]);if(g<0||g>255)return null;a+=g*(1<<8*(3-f))}let h=wA(u[l-1]);return h<0||h>=256**(5-l)?null:(a+=h,a)})(t):t}}function TA(A){return typeof A=="number"?(function(t){let r="";return r+=`${(t>>>24&255).toString(10)}.`,r+=`${(t>>>16&255).toString(10)}.`,r+=`${(t>>>8&255).toString(10)}.`,r+=(t&255).toString(10),r})(A):Array.isArray(A)?`[${(function(t){let n=(function(a){let h=-1,f=-1,g=1,p=0;for(let m=0;m<a.length;++m)a[m]!==0?(p>g&&(h=f,g=p),f=-1,p=0):(f===-1&&(f=m),++p);return p>g?f:h})(t),r="",u=!1;for(let l=0;l<=7;++l)if(!(u&&t[l]===0)){if(u&&(u=!1),n===l){r+=l===0?"::":":",u=!0;continue}r+=t[l].toString(16),l!==7&&(r+=":")}return r})(A)}]`:A}function ie(A){A.path.length>0&&(A.path.length!==1||A.scheme!=="file"||!(function(t){return/^[A-Za-z]:$/u.test(t)})(A.path[0]))&&A.path.pop()}function le(A){return A.username!==""||A.password!==""}function mA(A){return A.host===null||A.host===""||A.scheme==="file"}var s=0,o="",w="",D=null,i,lA=!1,uA=!1,G=!1,E;function H(A,e,t,n){e||(A=(function(l){let a=0,h=l.length;for(;a<h&&!(l.charCodeAt(a)>32);++a);for(;h>a&&!(l.charCodeAt(h-1)>32);--h);return l.substring(a,h)})(A)),A=(function(l){let a=0;for(;a<l.length;a++){let f=l.charCodeAt(a);if(f===9||f===10||f===13)break}if(a===l.length)return l;let h=l.slice(0,a);for(;a<l.length;a++){let f=l.charCodeAt(a);f!==9&&f!==10&&f!==13&&(h+=l[a])}return h})(A),s=0,o=A,w="",D=t||null,i=e||{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,opaquePath:!1},lA=!1,uA=!1,G=!1,E=n||0;let r=Ke;switch(n){case 3:case 4:r=aA;break;case 5:r=qA;break;case 6:r=K;break;case 7:r=Q;break;case 8:r=$}return r(c(A,s))!==1?i:null}function d(A,e){return s+=s===A?B(e):1,s<=o.length}function c(A,e){return e<A.length?A.codePointAt(e):void 0}function B(A){return A!=null&&A>65535?2:1}function ue(A){return A==null?"":A<=65535?String.fromCharCode(A):String.fromCodePoint(A)}var Ke=A=>{let e=s;if(A!=null&&(A>=65&&A<=90||A>=97&&A<=122)){let t=s+1;for(A=o.charCodeAt(t);A===43||A===45||A===46||A>=65&&A<=90||A>=97&&A<=122||A>=48&&A<=57;)t++,A=o.charCodeAt(t);return w=o.slice(s,t).toLowerCase(),s=t,Ye(t<o.length?A:void 0)}else return E?1:(--s,d(e,A)?ce(c(o,s)):0)},Ye=A=>{let e=s;if(A===58){if(E){if(C(i.scheme)!==C(w))return 0;if((le(i)||i.port!==null)&&w==="file")return 0;if(i.scheme==="file"&&i.host==="")return 0}return i.scheme=w,E?(i.port===oe(i.scheme)&&(i.port=null),0):(w="",i.scheme==="file"?d(e,A)?NA(c(o,s)):0:C(i.scheme)&&D!==null&&D.scheme===i.scheme?d(e,A)?Ve(c(o,s)):0:C(i.scheme)?d(e,A)?Je(c(o,s)):0:c(o,s+1)===47?(s++,d(e,A)?Xe(c(o,s)):0):(i.path=[""],i.opaquePath=!0,d(e,A)?fe(c(o,s)):0))}else return E?1:(w="",s=-1,d(e,A)?ce(c(o,s)):0)},ce=A=>{let e=s;return D===null||D.opaquePath&&A!==35?1:D.opaquePath&&A===35?(i.scheme=D.scheme,i.path=D.path.slice(),i.opaquePath=D.opaquePath,i.query=D.query,i.fragment="",d(e,A)?$(c(o,s)):0):D.scheme==="file"?(s--,d(e,A)?NA(c(o,s)):0):(s--,d(e,A)?kA(c(o,s)):0)},Ve=A=>{let e=s;return A===47&&c(o,s+1)===47?(++s,d(e,A)?hA(c(o,s)):0):(s--,d(e,A)?kA(c(o,s)):0)},Xe=A=>{let e=s;return A===47?d(e,A)?J(c(o,s)):0:(s--,d(e,A)?x(c(o,s)):0)},kA=A=>{let e=s;return i.scheme=D.scheme,A===47||C(i.scheme)&&A===92?d(e,A)?ZA(c(o,s)):0:(i.username=D.username,i.password=D.password,i.host=D.host,i.port=D.port,i.path=D.path.slice(),i.query=D.query,A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?$(c(o,s)):0):A!=null?(i.query=null,i.path.pop(),s--,d(e,A)?x(c(o,s)):0):d(e,A)?kA(c(o,s)):0)},ZA=A=>{let e=s;return C(i.scheme)&&(A===47||A===92)?d(e,A)?hA(c(o,s)):0:A===47?d(e,A)?J(c(o,s)):0:(i.username=D.username,i.password=D.password,i.host=D.host,i.port=D.port,s--,d(e,A)?x(c(o,s)):0)},Je=A=>{let e=s;return A===47&&c(o,s+1)===47?s++:s--,d(e,A)?hA(c(o,s)):0},hA=A=>{let e=s;return A!==47&&A!==92?(s--,d(e,A)?J(c(o,s)):0):d(e,A)?hA(c(o,s)):0},J=A=>{let e=s;if(A!=null&&A!==64&&A!==35&&A!==47&&A!==63&&(A!==92||!C(i.scheme))){let t=s+B(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===64||n===35||n===47||n===63||n===92&&C(i.scheme))break;t+=B(n)}return w+=o.slice(s,t),s=t-1,d(e,A)?J(c(o,s)):0}if(A===64){lA&&(w=`%40${w}`),lA=!0;for(let t=0;t<w.length;t++){let n=w.codePointAt(t);if(n===58&&!uA){uA=!0;continue}let r=te(n,cA);uA?i.password+=r:i.username+=r,n!=null&&n>65535&&t++}return w="",d(e,A)?J(c(o,s)):0}else return A==null||A===35||A===47||A===63||A===92&&C(i.scheme)?lA&&w===""?1:(s-=w.length+1,w="",d(e,A)?aA(c(o,s)):0):(w+=ue(A),d(e,A)?J(c(o,s)):0)},aA=A=>{let e=s;if(E&&i.scheme==="file")return s--,d(e,A)?LA(c(o,s)):0;if(A!=null&&A!==58&&A!==35&&A!==47&&A!==63&&(A!==92||!C(i.scheme))){let t=s+B(A);for(A===91?G=!0:A===93&&(G=!1);t<o.length;){let n=c(o,t);if(n==null||!G&&n===58||n===35||n===47||n===63||n===92&&C(i.scheme))break;n===91?G=!0:n===93&&(G=!1),t+=B(n)}return w+=o.slice(s,t),s=t-1,d(e,A)?aA(c(o,s)):0}else if(A===58&&!G){if(w===""||E===4)return 1;let t=EA(w,!C(i.scheme));return t===null?1:(i.host=TA(t),w="",d(e,A)?qA(c(o,s)):0)}else if(A==null||A===35||A===47||A===63||A===92&&C(i.scheme)){if(s--,C(i.scheme)&&w==="")return 1;if(E&&w===""&&(le(i)||i.port!==null))return 1;let t=EA(w,!C(i.scheme));return t===null?1:(i.host=TA(t),w="",E?0:d(e,A)?K(c(o,s)):0)}else return w+=ue(A),d(e,A)?aA(c(o,s)):0},qA=A=>{let e=s;if(A!=null&&A>=48&&A<=57){let t=s+1;for(;t<o.length;){let n=o.charCodeAt(t);if(n<48||n>57)break;t++}return w+=o.slice(s,t),s=t-1,d(e,A)?qA(c(o,s)):0}else if(E||A==null||A===35||A===47||A===63||A===92&&C(i.scheme)){if(w!==""){let t=parseInt(w,10);if(t>65535)return 1;if(i.port=t===oe(i.scheme)?null:t,w="",E)return 0}return E?1:(s--,d(e,A)?K(c(o,s)):0)}else return 1};function ae(A,e){let t=A.length-e;if(t<2)return!1;if(re(c(A,e),c(A,e+1))){if(t===2)return!0;{let n=c(A,e+2);return n===47||n===92||n===63||n===35}}else return!1}var NA=A=>{let e=s;return i.scheme="file",i.host="",A===47||A===92?d(e,A)?We(c(o,s)):0:D?.scheme==="file"?(i.host=D.host,i.path=D.path.slice(),i.opaquePath=D.opaquePath,i.query=D.query,A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?$(c(o,s)):0):A!=null?(i.query=null,ae(o,s)?i.path=[]:ie(i),s--,d(e,A)?x(c(o,s)):0):d(e,A)?NA(c(o,s)):0):(s--,d(e,A)?x(c(o,s)):0)},We=A=>{let e=s;return A===47||A===92?d(e,A)?LA(c(o,s)):0:(D!==null&&D.scheme==="file"&&(!ae(o,s)&&(function(n){if(n.length===2){let r=n.codePointAt(0),u=n.codePointAt(1);return(r>=65&&r<=90||r>=97&&r<=122)&&u===58}else return!1})(D.path[0])&&i.path.push(D.path[0]),i.host=D.host),s--,d(e,A)?x(c(o,s)):0)},LA=A=>{let e=s;if(A!=null&&A!==47&&A!==92&&A!==63&&A!==35){let t=s+B(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||n===92||n===63||n===35)break;t+=B(n)}return w+=o.slice(s,t),s=t-1,d(e,A)?LA(c(o,s)):0}else if(A==null||A===47||A===92||A===63||A===35){if(s--,!E&&se(w))return d(e,A)?x(c(o,s)):0;if(w==="")return i.host="",E?0:d(e,A)?K(c(o,s)):0;{let t=EA(w,!C(i.scheme));return t===null?1:(t==="localhost"&&(t=""),i.host=TA(t),w="",E?0:d(e,A)?K(c(o,s)):0)}}return 1},K=A=>{let e=s;return C(i.scheme)?(A!==92&&A!==47&&s--,d(e,A)?x(c(o,s)):0):!E&&A===63?(i.query="",d(e,A)?Q(c(o,s)):0):!E&&A===35?(i.fragment="",d(e,A)?$(c(o,s)):0):A!=null?(A!==47&&s--,d(e,A)?x(c(o,s)):0):(E&&i.host===null&&i.path.push(""),d(e,A)?K(c(o,s)):0)},x=A=>{let e=s;if(A!=null&&A!==47&&(!C(i.scheme)||A!==92)&&(E||A!==63&&A!==35)){let t=s+B(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||C(i.scheme)&&n===92||!E&&(n===63||n===35))break;t+=B(n)}w+=U(o.slice(s,t),IA),s=t,A=c(o,t)}if(A==null||A===47||C(i.scheme)&&A===92||!E&&(A===63||A===35)){let t=C(i.scheme)&&A===92;return(function(r){switch(r){case"..":case"%2e.":case"%2E.":case".%2e":case".%2E":case"%2e%2e":case"%2E%2e":case"%2e%2E":case"%2E%2E":return!0;default:return!1}})(w)?(ie(i),A!==47&&!t&&i.path.push("")):JA(w)&&A!==47&&!t?i.path.push(""):JA(w)||(i.scheme==="file"&&i.path.length===0&&se(w)&&(w=`${w[0]}:`),i.path.push(w)),w="",A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?$(c(o,s)):0):d(e,A)?x(c(o,s)):0}else return w+=te(A,IA),d(e,A)?x(c(o,s)):0},fe=A=>{let e=s;if(A===63)return i.query="",d(e,A)?Q(c(o,s)):0;if(A===35)return i.fragment="",d(e,A)?$(c(o,s)):0;if(A!=null){let t=s+B(A);for(;t<o.length;){let r=c(o,t);if(r===63||r===35)break;t+=B(r)}let n=o.slice(s,t);if(t<o.length&&n.charCodeAt(n.length-1)===32?i.path[0]+=U(n.slice(0,-1),AA)+"%20":i.path[0]+=U(n,AA),s=t,(A=c(o,t))===63)return i.query="",d(e,A)?Q(c(o,s)):0;if(A===35)return i.fragment="",d(e,A)?$(c(o,s)):0}return d(e,A)?fe(c(o,s)):0},Q=A=>{let e=s,t=s;if(A!=null){if(E)t=o.length;else{let r=o.indexOf("#",s);t=r===-1?o.length:r}let n=C(i.scheme)?Ee:OA;i.query+=U(o.slice(s,t),n)}return s=t,c(o,t)===35&&!E?(i.fragment="",d(e,A)?$(c(o,s)):0):d(e,A)?Q(c(o,s)):0},$=A=>{let e=s;return A!=null&&(i.fragment+=U(o.slice(s),Ce),s=o.length),d(e,A)?$(c(o,s)):0};function vA(A){if(A.opaquePath)return A.path[0];{let e="";for(let t of A.path)e+=`/${t}`;return e}}function he(A){switch(A.scheme){case"blob":{let e=H(vA(A),null,null,0);return e===null||e.scheme!=="http"&&e.scheme!=="https"?"null":he(e)}case"ftp":case"http":case"https":case"ws":case"wss":return(function(t){let n=`${t.scheme}://`;return n+=t.host,t.port!==null&&(n+=`:${t.port}`),n})(A);default:return"null"}}var S=Symbol("URLImpl"),eA=class A{constructor(e,t){if(e===void 0&&t===void 0)throw new TypeError('The "url" argument must be specified.');e=I(e),t!=null&&(t=I(t));let n=null;if(t!=null&&(n=H(t,null,null,0),n==null))throw new TypeError(`Invalid base URL: ${t}`);let r=H(e,null,n,0);if(r==null)throw new TypeError(`Invalid URL: ${e}`);this[S]={url:r,query:null}}static createObjectURL(e){throw new TypeError("URL.createObjetURL is unsupported")}static revokeObjectURL(e){}static parse(e,t){e=I(e),t!==void 0&&(t=I(t));try{return new A(e,t)}catch{return null}}static canParse(e,t){e=I(e),t!==void 0&&(t=I(t));let n=null;return t!=null&&(n=H(t,null,null,0),n==null)?!1:H(e,null,n,0)!=null}get href(){return(function(t){let n=`${t.scheme}:`;return t.host!==null&&(n+="//",(t.username!==""||t.password!=="")&&(n+=t.username,t.password!==""&&(n+=`:${t.password}`),n+="@"),n+=t.host,t.port!==null&&(n+=`:${t.port}`)),t.host===null&&!t.opaquePath&&t.path.length>1&&t.path[0]===""&&(n+="/."),n+=vA(t),t.query!==null&&(n+=`?${t.query}`),t.fragment!==null&&(n+=`#${t.fragment}`),n})(this[S].url)}set href(e){let t=H(e=I(e),null,null,0);if(t==null)throw new TypeError(`Invalid URL: ${e}`);this[S].url=t,this[S].query&&PA(this[S].query,t.query)}get origin(){return he(this[S].url)}get protocol(){return`${this[S].url.scheme}:`}set protocol(e){H(`${e=I(e)}:`,this[S].url,null,2)}get username(){return this[S].url.username}set username(e){e=I(e),mA(this[S].url)||(function(n,r){n.username=U(r,cA)})(this[S].url,e)}get password(){return this[S].url.password}set password(e){e=I(e),mA(this[S].url)||(function(n,r){n.password=U(r,cA)})(this[S].url,e)}get host(){let{url:e}=this[S];return e.host==null?"":e.port==null?e.host:`${e.host}:${e.port}`}set host(e){e=I(e),this[S].url.opaquePath||H(e,this[S].url,null,3)}get hostname(){let{url:e}=this[S];return e.host!=null?e.host:""}set hostname(e){e=I(e),this[S].url.opaquePath||H(e,this[S].url,null,4)}get port(){let{url:e}=this[S];return e.port!=null?`${e.port}`:""}set port(e){e=I(e);let{url:t}=this[S];mA(t)||(e?H(e,t,null,5):t.port=null)}get pathname(){return vA(this[S].url)}set pathname(e){e=I(e);let{url:t}=this[S];t.opaquePath||(t.path=[],H(e,t,null,6))}get search(){let{url:e}=this[S];return e.query?`?${e.query}`:""}set search(e){e=I(e);let{url:t,query:n}=this[S];if(!e)t.query=null,n&&PA(n,null);else{let r=e[0]==="?"?e.substring(1):e;t.query="",H(r,t,null,7),n&&PA(n,t.query)}}get searchParams(){let e=this[S],t=e.query;return t==null&&(t=e.query=(function(r,u){let l=new fA;return l[b].url=r,l[b].serialized=u==null,u&&(l[b].list=RA(u)),l})(this,e.url.query)),t}get hash(){let{url:e}=this[S];return e.fragment?`#${e.fragment}`:""}set hash(e){e=I(e);let{url:t}=this[S];if(!e)t.fragment=null;else{let n=e[0]==="#"?e.substring(1):e;t.fragment="",H(n,t,null,8)}}toJSON(){return this.href}toString(){return this.href}};Object.defineProperty(eA.prototype,Symbol.toStringTag,{value:"URL",configurable:!0});var b=Symbol("URLSearchParamsImpl"),Ze=Symbol.dispose||Symbol.for("dispose");function PA(A,e){e?A[b].list=RA(e):A[b].list.length=0,A[b].serialized=e==null}function oA(A){if(A.url){let e=bA(A.list);(function(n,r){n[S].url.query=r})(A.url,e||null),A.serialized=!0}}var At=typeof Iterator<"u"?Iterator:Object,Z=class extends At{constructor(e,t){super(),this[b]={ptr:e,map:t,index:0}}next(){let e=this[b];return e.index<e.ptr.list.length?{value:e.map(e.ptr.list[e.index++]),done:!1}:{value:void 0,done:!0}}[Symbol.iterator](){return this}[Ze](){}},fA=class{constructor(e){let t=this[b]={list:[],url:null,serialized:!0},n;if(Array.isArray(e))for(let r=0;r<e.length;r++)t.list.push(GA(e[r]));else if((n=Ae(e))!=null){let r;for(;!(r=yA(n.next())).done;)t.list.push(GA(r.value))}else if((typeof e=="object"||typeof e=="function")&&e!=null){let r=Object.keys(e);for(let u=0;u<r.length;u++){let l=r[u],a=Ie(l),h=I(e[l]),f=t.list.find(g=>g[0]===a);f?f[1]=h:t.list.push([a,h])}}else if(e!==void 0){let r=I(e);r=r[0]==="?"?r.substring(1):r,t.list=RA(r)}}get size(){return this[b].list.length}append(e,t){e=I(e),t=I(t),this[b].list.push([e,t]);let n=this[b];n.url&&n.serialized?(function(u,l){let a=u[S].url;a.query=a.query?`${a.query}&${l}`:l})(n.url,bA([[e,t]])):oA(n)}delete(e,t){e=I(e),t=t!=null?I(t):void 0;let{list:n}=this[b],r=0;for(;r<n.length;)n[r][0]===e&&(t==null||n[r][1]===t)?n.splice(r,1):r++;oA(this[b])}get(e){e=I(e);let{list:t}=this[b];for(let n=0;n<t.length;n++)if(t[n][0]===e)return t[n][1];return null}getAll(e){e=I(e);let t=[],{list:n}=this[b];for(let r=0;r<n.length;r++)n[r][0]===e&&t.push(n[r][1]);return t}has(e,t){e=I(e),t=t!=null?I(t):void 0;let{list:n}=this[b];for(let r=0;r<n.length;r++)if(n[r][0]===e&&(t==null||n[r][1]===t))return!0;return!1}set(e,t){e=I(e),t=I(t);let{list:n}=this[b],r=!1,u=!1,l=0;for(;l<n.length;)n[l][0]===e?r?(n.splice(l,1),u=!0):(r=!0,n[l][1]!==t&&(n[l][1]=t,u=!0),l++):l++;r||(n.push([e,t]),u=!0),u&&oA(this[b])}sort(){this[b].list.sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0),oA(this[b])}forEach(e,t){if(typeof e!="function")throw new TypeError('The "callback" argument must be of type function');let{list:n}=this[b];for(let r=0;r<n.length;r++)e.call(t,n[r][1],n[r][0],this)}entries(){return new Z(this[b],e=>e)}keys(){return new Z(this[b],e=>e[0])}values(){return new Z(this[b],e=>e[1])}toString(){return bA(this[b].list)}[Symbol.iterator](){return this.entries()}};Object.defineProperty(fA.prototype,Symbol.toStringTag,{value:"URLSearchParams",configurable:!0});function de(A){let e,t=()=>typeof e=="string"?e:e?.accessToken,n=0,r,u=new Map,l=()=>{for(let p of[...u.keys()])try{p()}catch{}};function a(p){let m=++n;r=void 0,e=void 0;for(let P of[...u.values()])try{P?.()}catch{}m===n&&(e=p,l())}let h=()=>a();function f(p,m=!1){let P=$A.safeParse(p);if(!P.success||m&&Date.parse(P.data.expiresAt)<=Date.now()||Date.parse(P.data.refreshExpiresAt)<=Date.now()||Date.parse(P.data.refreshExpiresAt)<Date.parse(P.data.expiresAt))throw new y("INVALID_RESPONSE","Invalid customer session credentials");return P.data}async function g(){if(r)return r;let p=typeof e=="object"?e:void 0,m=n;if(!p||Date.parse(p.refreshExpiresAt)<=Date.now())throw p&&h(),new y("UNAUTHENTICATED","Customer authentication is required",401);let P=(async()=>{try{let k=await A(p.refreshToken);if(m!==n)throw new y("IDENTITY_CHANGED","Customer identity changed during refresh");let Y=f(k,!0);if(Y.customerId!==p.customerId||Y.sessionId!==p.sessionId)throw new y("SCOPE_MISMATCH","Refresh changed the customer session");return e=Y,{...Y}}catch(k){throw m!==n?new y("IDENTITY_CHANGED","Customer identity changed during refresh"):(k instanceof y&&k.status===401&&h(),k)}})();r=P;try{return await P}finally{r===P&&(r=void 0)}}return{identify(p){let m=typeof p=="string"?p:f(p),P=typeof m=="string"?m:m.accessToken;if(!P.trim()||/\s/.test(P)||P.length>4096)throw new y("INVALID_TOKEN","A server-issued token is required");a(m)},reset:h,subscribeIdentity(p,m){return u.set(p,m),()=>{u.delete(p)}},access(){let p=typeof e=="object"?e:void 0;if(p&&Date.parse(p.expiresAt)<=Date.now()+3e4){let P=n;return g().then(()=>{let k=t();if(P!==n||!k)throw new y("IDENTITY_CHANGED","Customer identity changed during refresh");return k})}let m=t();if(!m)throw new y("NOT_IDENTIFIED","Identify a customer session before making a request");return m},peek:t,snapshot:()=>typeof e=="object"?{...e}:void 0,refresh:g}}var pe=Symbol("IndianaNoContent");function gt(A,e,t=eA){let n=A.configuration?.scope,r=A.scope??(n&&{projectId:n.projectId,environment:n.environment}),u=r?sA.parse(r):void 0;if(u&&n&&(u.projectId!==n.projectId||u.environment!==n.environment))throw new y("SCOPE_MISMATCH","Configuration belongs to another App/environment");let l=new t(A.baseUrl??FA);if(l.username||l.password||l.search||l.hash)throw new y("INVALID_URL","baseUrl must not contain credentials, query, or fragment");if(l.protocol!=="https:"&&!(l.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(l.hostname)))throw new y("INVALID_URL","Use HTTPS, or HTTP on localhost during development");let a=A.fetch??globalThis.fetch.bind(globalThis),h=A.timeoutMs??1e4;if(!Number.isFinite(h)||h<1||h>12e4)throw new y("INVALID_TIMEOUT","timeoutMs must be between 1 and 120000");let f=!1,g=0,p=null,m=new Set,P=A.session??de(async v=>{let T=await tA("customer-sessions/refresh",{},"POST",{},v);if(!T||typeof T!="object")throw new y("INVALID_RESPONSE","Invalid refresh response");let{requestId:_,scope:j,...V}=T;return V});function k(){g+=1,p=null;for(let v of m)v.abort();m.clear()}let Y=P.subscribeIdentity(k);function ge(){f||P.reset()}async function tA(v,T={},_="POST",j={},V){let N=j.installationDetach===!0;if(N&&(v!=="push/installations/detach"||_!=="POST"))throw new y("INVALID_REQUEST","Installation authority only detaches this installation");if(!V&&!N)throw new y("NOT_IDENTIFIED","Call identify with a server-issued customer token first");let X=g,L=new AbortController;N||m.add(L);let nA=()=>!N&&X!==g?new y("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):new y("TIMEOUT","The request timed out"),dA,Pe=new Promise((R,q)=>{dA=()=>q(nA()),L.signal.addEventListener("abort",dA,{once:!0})}),ye=setTimeout(()=>L.abort(),j.timeoutMs??h),De=async()=>{let R=await a(`${l.href.replace(/\/$/,"")}/api/v1/${v}`,{method:_,headers:{...j.headers,"Content-Type":"application/json",...N?{}:{Authorization:`Bearer ${V}`},[pA]:gA.current,[QA]:zA.version,...u?{"X-Indiana-Project":u.projectId,"X-Indiana-Environment":u.environment}:{}},body:_==="POST"?JSON.stringify(T):void 0,signal:L.signal,credentials:"omit",cache:_==="POST"&&typeof document<"u"&&v==="funnels"&&T!==null&&typeof T=="object"&&"operation"in T&&(T.operation==="start"||T.operation==="shown")?"default":"no-store",redirect:"error",...j.keepalive?{keepalive:!0}:{}});if(L.signal.aborted)throw nA();let q;try{q=R.status===204?pe:await R.json()}catch{throw L.signal.aborted?nA():new y(R.ok?"INVALID_RESPONSE":"HTTP_ERROR","The gateway returned an unreadable response",R.status,R.headers.get("X-Request-Id")??void 0)}if(L.signal.aborted)throw nA();if(!N&&X!==g)throw new y("IDENTITY_CHANGED","Customer identity changed while the request was in flight");if(!R.ok){let O=MA.safeParse(et(q)),z=O.success&&(!jA.safeParse(O.data.error.code).success||xA(O.data.error.code,R.status)),HA=z?O.data.error.code:"HTTP_ERROR",_A=UA(HA,R.status,{retryAfter:R.headers.get("Retry-After"),recovery:z?O.data.error.recovery:void 0,reason:z?O.data.error.reason:void 0});throw new y(HA,z?O.data.error.message:"The request failed",R.status,R.headers.get("X-Request-Id")??(O.success?O.data.requestId:void 0),{..._A,...O.success&&O.data.error.retryable===!1?{retryable:!1}:{},..._A.retryAfterSeconds===void 0&&O.success&&O.data.error.retryAfterSeconds!==void 0?{retryAfterSeconds:O.data.error.retryAfterSeconds}:{}})}if(R.headers.get(pA)!==gA.current)throw new y("PROTOCOL_MISMATCH","Response protocol does not match this SDK");if(u&&q!==pe){let O=q&&typeof q=="object"&&"scope"in q?q:q&&typeof q=="object"&&"configuration"in q?q.configuration:null;if(!O||typeof O!="object"||!("scope"in O))throw new y("INVALID_RESPONSE","Response is missing its App/environment scope");let z=sA.safeParse(O.scope);if(!z.success||z.data.projectId!==u.projectId||z.data.environment!==u.environment)throw new y("SCOPE_MISMATCH","Response scope does not match this SDK instance")}let rA=R.headers.get("X-Indiana-Telemetry-Subject");if(rA){if(!/^[a-f0-9]{64}$/.test(rA))throw new y("INVALID_RESPONSE","Invalid telemetry identity");p!==rA&&(p=rA,e?.(p))}return q};try{return await Promise.race([De(),Pe])}catch(R){throw!N&&X!==g?new y("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):R instanceof y?R:new y(L.signal.aborted?"TIMEOUT":"NETWORK_ERROR",L.signal.aborted?"The request timed out":"Unable to read the response")}finally{clearTimeout(ye),L.signal.removeEventListener("abort",dA),m.delete(L)}}function we(v,T={},_="POST",j={}){if(f)return Promise.reject(new y("CLOSED","SDK client was destroyed"));if(j.installationDetach)return tA(v,T,_,j);let V=g;try{let N=P.access(),X=L=>{if(V!==g)throw new y("IDENTITY_CHANGED","Customer identity changed before dispatch");return tA(v,T,_,j,L)};return typeof N=="string"?X(N):N.then(X)}catch(N){return Promise.reject(N)}}let me=Object.assign(we,{captureIdentity(){let v=g,T=f,_=!!P.peek();return()=>{if(T)throw new y("CLOSED","SDK client was destroyed");if(!_)throw new y("NOT_IDENTIFIED","Call identify with a server-issued customer token first");if(v!==g)throw new y("IDENTITY_CHANGED","Customer identity changed before dispatch")}}});return{session:P,requestWithCredential(v,T,_,j={}){return f?Promise.reject(new y("CLOSED","SDK client was destroyed")):tA(v,T,"POST",j,_)},subjectKey:()=>p,identify(v){if(f)throw new y("CLOSED","SDK client was destroyed");if(u&&typeof v=="object"&&"scope"in v){let T=sA.safeParse(v.scope);if(!T.success||T.data.projectId!==u.projectId||T.data.environment!==u.environment)throw new y("SCOPE_MISMATCH","Customer session belongs to another App/environment")}P.identify(v)},reset:ge,dispose(){f||(f=!0,Y(),k())},request:me}}function et(A){if(!A||typeof A!="object"||!("error"in A))return A;let e=A.error;if(!e||typeof e!="object"||!("reason"in e)||BA.safeParse(e.reason).success)return A;let{reason:t,...n}=e;return{...A,error:n}}export{eA as a,gt as b};
@@ -1 +0,0 @@
1
- import{b as e}from"./chunk-VF6QMMEA.js";var c=e.enum(["replace","stack_native"]);export{c as a};
@@ -1 +0,0 @@
1
- import{i as ie}from"./chunk-TDSATEGE.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-U6UHASIB.js";import{b as X}from"./chunk-EQPEUPMG.js";import{r as V}from"./chunk-NAZU3EEJ.js";import"./chunk-R23IGK5U.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-BXPXJARS.js";import"./chunk-WTVLNUMS.js";import"./chunk-VYFSRHXM.js";import{E as $,P as G,U as R,la as Y,ma as K}from"./chunk-N7YXDSQL.js";import"./chunk-MIBRUDIS.js";import{a as p}from"./chunk-X4W22IH6.js";import"./chunk-R4FDIYMN.js";import"./chunk-WKIR2EQG.js";import{b as u}from"./chunk-VF6QMMEA.js";import{a as h}from"./chunk-DSPLGTQI.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.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 I}from"./chunk-3JJYWRA3.js";import{d as C}from"./chunk-RKPAIF6U.js";import{a as p}from"./chunk-4WZVC4TM.js";import{i as A,j as F}from"./chunk-U6UHASIB.js";import"./chunk-I6TSQQ5N.js";import"./chunk-UWLEGMWX.js";import"./chunk-QBA3B4YK.js";import"./chunk-ITGERPCJ.js";import"./chunk-THMGTRXP.js";import"./chunk-NAZU3EEJ.js";import"./chunk-SCC3O2RD.js";import"./chunk-R23IGK5U.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-EHDHWYVJ.js";import"./chunk-BXPXJARS.js";import"./chunk-WTVLNUMS.js";import"./chunk-VYFSRHXM.js";import"./chunk-N7YXDSQL.js";import"./chunk-MIBRUDIS.js";import{a as c}from"./chunk-X4W22IH6.js";import"./chunk-R4FDIYMN.js";import"./chunk-SLUA7ABW.js";import"./chunk-6T575JKD.js";import"./chunk-3VUPVXAV.js";import"./chunk-WKIR2EQG.js";import"./chunk-VF6QMMEA.js";import{a as o}from"./chunk-DSPLGTQI.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";var d=new WeakMap;function _(m,e){let b=d.get(e.client);if(b)return b;let h=Promise.resolve().then(async()=>{let n=!1,a,w,g=!1,y=()=>{},t=e.signal?AbortSignal.any([e.signal,e.client.identitySignal]):e.client.identitySignal,u=()=>{d.get(e.client)===h&&d.delete(e.client),t.removeEventListener("abort",f),y()},i=F(m,e,"funnel",f,p);function f(){n||(n=!0,i.finish("dismissed"),a?a.destroy():(u(),o(e.onDismiss,null)))}t.addEventListener("abort",f,{once:!0});try{let P=function(){!n&&!t.aborted&&!g&&w&&e.client.recovery.status==="complete"&&(g=!0,o(e.onComplete,structuredClone(w)))};var H=P;t.throwIfAborted();let l=e.client.controller?.view?.paywall?.resolution,E=l&&"document"in l?l.document:e.loadingDocument;if(i.start(!0,e.start?.locale??e.client.attempt?.locale??E?.screen.strings.defaultLocale,E??null),n)return null;t.throwIfAborted();let v=await i.wait(e.start?e.client.start(e.start):e.client.refresh(),A);t.throwIfAborted();let O=e.client.controller;return v.mode!=="run"||v.status==="blocked"||!O?(i.finish("skipped"),u(),null):(t.removeEventListener("abort",f),y=e.client.subscribe(P),a=await C(m,{...e,client:O,signal:t,checkoutNavigation:"after_confirmation",onCheckoutUrl(r){if(t.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");if(I(e.client.recovery)!==r)throw new c("PURCHASE_PENDING","Checkout differs from the original recovery proof");return e.onCheckoutUrl?e.onCheckoutUrl(r):m.ownerDocument.defaultView?.location.assign(r)},async resolveOfferId(r){if(t.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");let s=e.client.attempt;if(!s)throw new c("PURCHASE_PENDING","Read the original Start before selecting an offer");let D=await e.resolveOfferId?.(r,s);if(t.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");if(e.client.attempt?.requestId!==s.requestId)throw new c("PURCHASE_STORAGE_CONFLICT","The original purchase changed while selecting an offer");return D},onComplete(r){w=r,P()},onError(r){o(e.onError,r),r instanceof c&&r.status===401&&!t.aborted&&e.client.refresh().catch(s=>o(e.onError,s))},onDismiss(r){n=!0,u(),o(e.onDismiss,r)}},i),n||t.aborted?(a.destroy(),null):a)}catch(l){if(n)return null;throw i.finish("error",l),u(),o(e.onError,l),l}});return d.set(e.client,h),h}export{_ as showFunnelPurchase};
@@ -1 +0,0 @@
1
- import{c as a,d as b}from"./chunk-RKPAIF6U.js";import"./chunk-4WZVC4TM.js";import"./chunk-U6UHASIB.js";import"./chunk-R23IGK5U.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-EHDHWYVJ.js";import"./chunk-BXPXJARS.js";import"./chunk-WTVLNUMS.js";import"./chunk-VYFSRHXM.js";import"./chunk-N7YXDSQL.js";import"./chunk-MIBRUDIS.js";import"./chunk-X4W22IH6.js";import"./chunk-R4FDIYMN.js";import"./chunk-SLUA7ABW.js";import"./chunk-6T575JKD.js";import"./chunk-WKIR2EQG.js";import"./chunk-VF6QMMEA.js";import"./chunk-DSPLGTQI.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";export{a as showFunnelRun,b as showObservedFunnelRun};
@@ -1 +0,0 @@
1
- import{N as r,O as m,h as e}from"./chunk-SCC3O2RD.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-VYFSRHXM.js";import"./chunk-MIBRUDIS.js";import"./chunk-R4FDIYMN.js";import"./chunk-VF6QMMEA.js";import"./chunk-BID4UGWB.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-ILEDKSRQ.js";import"./chunk-EQPEUPMG.js";import"./chunk-7MNJH5GB.js";import"./chunk-THMGTRXP.js";import"./chunk-NAZU3EEJ.js";import"./chunk-SCC3O2RD.js";import"./chunk-R23IGK5U.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-BXPXJARS.js";import"./chunk-5HJYR6Z4.js";import"./chunk-VYFSRHXM.js";import"./chunk-N7YXDSQL.js";import"./chunk-MIBRUDIS.js";import"./chunk-R4FDIYMN.js";import"./chunk-VF6QMMEA.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
@@ -1 +0,0 @@
1
- import{a as at,c as ot,d as De,f as st,h as ct,i as lt}from"./chunk-4WZVC4TM.js";import{d as Xe,e as Ze,f as et,h as tt,i as fe,j as nt,k as rt,l as it}from"./chunk-U6UHASIB.js";import{a as Ge,c as Se,d as Ye,g as Je,j as Ke}from"./chunk-EHDHWYVJ.js";import{b as ee}from"./chunk-BXPXJARS.js";import"./chunk-WTVLNUMS.js";import"./chunk-VYFSRHXM.js";import{c as Z,o as ne,oa as re,qa as pe}from"./chunk-N7YXDSQL.js";import{c as Oe}from"./chunk-MIBRUDIS.js";import{a as k}from"./chunk-X4W22IH6.js";import"./chunk-R4FDIYMN.js";import"./chunk-WKIR2EQG.js";import"./chunk-VF6QMMEA.js";import{a as z}from"./chunk-DSPLGTQI.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";async function ut(T,r,N){if(r.status!=="complete")throw new k("INVALID_RESPONSE","A verified completed purchase is required");let O=T?ne.parse(T):null;if(await N.onComplete?.(r),!O||!N.check)return;let S=ne.parse(await N.check());if(S.internal_feature_id!==O.internal_feature_id||S.quantity!==O.quantity||O.observation!==void 0&&(S.observation===void 0||S.observation.requirementDigest!==O.observation.requirementDigest||S.observation.authority!==O.observation.authority||Oe(S.observation.subject)!==Oe(O.observation.subject)))throw new k("INVALID_RESPONSE","The access requirement changed");S.allowed&&await N.onAccessGranted?.(S)}function Ne(T){return Object.entries(T.document.buttons).filter(([,r])=>r.type==="checkout"&&r.product.type==="fixed"&&!ee(r.product,{},T.capabilities)).map(([r])=>r)}async function Yt(T,r,N){let O=tt(T.ownerDocument),S=()=>{P.finish("dismissed"),O()},B=()=>S(),P=nt(T,r,"paywall",()=>{S(),z(r.onDismiss)},at);r.signal?.throwIfAborted(),r.signal?.addEventListener("abort",B,{once:!0});let G=null,_,h,Le;try{if(P.start(!0,r.loadingDocument?.screen.strings.defaultLocale,r.loadingDocument??null),P.cancelled)throw new DOMException("Presentation cancelled","AbortError");if(G=r.check?ne.parse(await P.wait(r.check(),fe)):null,G?.allowed)return P.finish("skipped"),r.signal?.removeEventListener("abort",B),O(),await r.onAccessGranted?.(G),{check:G,host:null};let[e,t]=await Promise.allSettled([P.wait(import("./screen-renderer-W7ZGBFIR.js")),P.wait(r.start().then(s=>(P.cancelled&&s.destroy(),s)),fe)]);if(e.status==="rejected")throw t.status==="fulfilled"&&t.value.destroy(),e.reason;if(t.status==="rejected")throw t.reason;Le=e.value,_=t.value,r.signal?.throwIfAborted(),_.signal?.throwIfAborted(),_.signal?.addEventListener("abort",B,{once:!0});let n=_.view??await P.wait(_.refresh(),fe);if(!n)throw new k("INVALID_RESPONSE","Paywall presentation is missing");_.signal?.throwIfAborted(),h=n}catch(e){throw P.finish("error",e),r.signal?.removeEventListener("abort",B),_?.signal?.removeEventListener("abort",B),_?.destroy(),O(),e}let a=_,{mountScreenPreview:dt}=Le,d=T.ownerDocument,me=new AbortController,A=d.createElement("section"),Y=d.createElement("div"),U=d.createElement("div"),u=d.createElement("p"),y=d.createElement("button"),w=d.createElement("button"),g=d.createElement("dialog"),o=h.document.screen.strings.defaultLocale.startsWith("zh"),pt=o?"\u6B63\u5728\u5904\u7406\u2026":"Processing\u2026",ft=o?"\u6B63\u5728\u51C6\u5907\u62A5\u4EF7\u2026":"Preparing your price\u2026",E=ot(h.document.screen.theme);A.dataset.indianaPaywall="",A.setAttribute("aria-label",h.document.name),A.style.cssText=E.root,U.style.cssText=E.controls,u.style.cssText=E.message,u.setAttribute("role","status"),w.style.cssText=E.link,w.textContent=o?"\u5173\u95ED":"Close",y.style.cssText=E.secondary,y.textContent=o?"\u91CD\u8BD5":"Retry",y.hidden=!0,U.append(u,y,w),A.append(Y,U);let Me=()=>{let e=H??U,t=[...e.children].every(s=>s===u?!u.textContent:s.hidden),n=[...e.children].some(s=>s===w?!1:s===u?!!u.textContent:!s.hidden);e.style.cssText=t?E.controls.replace(/padding:[^;]+/,"padding:0"):n?`${E.controls};${E.pinned}`:E.controls,be()},_e=typeof MutationObserver>"u"?void 0:new MutationObserver(Me);_e?.observe(A,{attributes:!0,attributeFilter:["hidden"],characterData:!0,childList:!0,subtree:!0});let ie=h.document.presentation,mt=Object.entries(h.document.buttons).filter(([,e])=>e.type==="close").map(([e])=>e),F,Ue,he=!1,$e=JSON.stringify(h.capabilities),qe=e=>J?Object.entries(e.document.buttons).filter(([,t])=>t.type==="checkout").map(([t])=>t):Ne(e);function ye(e){if(p)return;h=e;let t=JSON.stringify(e.capabilities);t!==$e&&(F?.updateCapabilities(e.capabilities,qe(e)),$e=t),yt(e)}let b,we=0;function be(){let e=d.defaultView;if(!b?.responsive||!e)return;let t=H??U,n=e.innerHeight-(b.type==="modal"?32:0);t.style.maxHeight=`${Math.max(1,n)}px`,t.style.overflowY="auto",t.style.flexShrink="0",we=Math.max(1,n-t.getBoundingClientRect().height),F?.resizeViewport?.(we,e.innerWidth)}let p=!1,J=!1,v=null,ae=!1,Ve=!1,Q=!1,ge,ve=!1,$,H;function ht(){return J||p||$||ve?{type:"recover",operationId:a.operation?.operationId??a.quote?.operationId??null,requestId:null}:Se(a)}let R=()=>!p&&!ae&&!$&&r.canInteract?.()!==!1,oe=!1,l=null,q=null;function yt(e){J||v||a.quote||a.operation||(u.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 Ce=new Map,Pe=!1;function wt(e,t,n,s){let i=e.lines.length===1?e.lines[0]:void 0,m=ee(n,s,t.capabilities);if(!i||!m||i.productVersionId!==m)return!1;let x;try{x=pe(t.document.screen,m,s,t.capabilities)}catch{return!1}let I=Object.fromEntries((i.prepaid??[]).map(W=>[W.internal_feature_id,W.quantity]));return[...new Set([...Object.keys(x),...Object.keys(I)])].every(W=>(x[W]??0)===(I[W]??0))}let se=e=>Ge({quote:a.quote,operation:e,requestId:null,pending:!1,destroyed:p,canReselect:a.canReselect});async function Ee(e){let t=e.merchantExecution;if(!(!R()||!e.checkoutUrl||r.checkoutNavigation==="after_confirmation"&&se(e).type!=="checkout"||t?.type==="purchase"&&!["not_started","pending"].includes(t.paymentStatus)||Ce.get(e.operationId)===e.checkoutUrl)){Ce.set(e.operationId,e.checkoutUrl);try{r.onCheckoutUrl?await r.onCheckoutUrl(e.checkoutUrl):d.defaultView?.location.assign(e.checkoutUrl)}catch(n){throw Ce.delete(e.operationId),n}}}let j=(e,t=!1)=>{if(t){let n=e instanceof k?e.code:void 0;n==="CAPABILITY_UNAVAILABLE"||n==="NOT_CONFIGURED"?(l=null,u.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."):a.canReselect===!0&&!v?u.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"?u.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.":u.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 u.textContent=e instanceof k&&(e.code==="NETWORK_ERROR"||e.code==="TIMEOUT")?st(e,o):e instanceof k?e.message:o?"\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002":"This action couldn\u2019t be completed. Try again.";y.hidden=l===null,t&&!b?.responsive&&u.scrollIntoView?.({block:"nearest"}),z(t&&N?.quoteError?N.quoteError:r.onError,e)},ce=new WeakMap;function le(e){J=e,F?.updateCapabilities?.(h.capabilities,qe(h));for(let t of q?.querySelectorAll("button")??[])e?(ce.set(t,t.disabled),t.disabled=!0):ce.has(t)&&(t.disabled=ce.get(t),ce.delete(t)),De(t)}function xe(){u.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 bt(e){if(r.beforeAction)try{await r.beforeAction()}catch(t){throw l=e,t}}async function V(e){if(J||p)return;if(!R()){xe();return}let t=e===ue,n=t?ft:pt;le(!0),y.hidden=!0,u.textContent=n;try{if(await bt(e),p)return;if(!R()){l=e,y.hidden=!1,xe();return}await e()}catch(s){p||j(s,t)}finally{le(!1),u.textContent===n&&(u.textContent="")}}async function gt(e){await ut(G,e,r)}function He(e){return Se(a).type==="recording"||se(e).type==="recording"}function Be(e){let t=e.merchantTerms,n=t?.subscriptionTerms?.items??[],s=t?t.totalMinor:e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),i=t?n.length===1&&n[0]?.amountMinor===s&&n[0]:e.lines.length===1&&e.lines[0]?.catalogAmountMinor===s&&e.lines[0],m=s===null?Z(t.subtotalMinor-t.discountMinor,e.currency)+(o?" + \u5F85\u786E\u8BA4\u7A0E\u8D39":" + tax confirmed at checkout"):Z(s,e.currency)+(i?re(i.interval,o?"zh-CN":"en",i.intervalCount??1):""),x=e.lines.map(I=>I.productName).join(", ");return{label:x?`${x} \xB7 ${m}`:m,recurring:i}}async function D(e,t=r.checkoutNavigation!=="after_confirmation"){if(p)return;if(!R()){l=async()=>D(await a.read()),y.hidden=!1;return}if(u.textContent=lt(e.status,o),He(e)){let i=e.merchantExecution?.type==="purchase"&&e.merchantExecution.recordingStatus==="failed";u.textContent=i?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.",y.textContent=o?"\u67E5\u8BE2\u8BB0\u5F55":"Check recording",l=async()=>D(await a.read()),y.hidden=!1;return}if(e.problem){let i=e.problem;l=te,y.textContent=o?"\u68C0\u67E5\u5E76\u6062\u590D\u539F\u64CD\u4F5C":"Check and recover original purchase",j(new k(i.code,i.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.":i.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.":i.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.":i.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,i));return}if(e.merchantExecution?.type==="purchase"&&e.merchantExecution.paymentStatus==="succeeded"&&!["applied","not_applicable"].includes(e.merchantExecution.fulfillmentStatus)&&(u.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."),e.status==="complete"){l=null,await gt(e);return}if(e.status!=="pending"){if(a.canReselect===!1){u.textContent=o?"\u6B63\u5728\u6838\u5BF9\u539F\u8D2D\u4E70\u7ED3\u679C":"Checking the original purchase result",y.textContent=o?"\u67E5\u8BE2\u7ED3\u679C":"Check result",l=async()=>D(await a.read()),y.hidden=!1;return}e.status==="cancelled"?u.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"&&(u.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."),y.textContent=o?"\u91CD\u8BD5":"Retry",l=null,v=null;return}if(!t&&se(e).type==="checkout"){let i=a.quote,m=i?.operationId===e.operationId?Be(i).label:"";u.textContent=Pe?m?o?`${m} \u5C1A\u672A\u4ED8\u6B3E\u3002\u518D\u6B21\u9009\u62E9\u8BE5\u65B9\u6848\u5373\u53EF\u7EE7\u7EED\u4ED8\u6B3E\u3002`:`${m} 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.":"",Pe=!1,l=null;return}await Ee(e);let n=Date.now()+6e5,s=2e3;he=!0,z(r.onObservationChange,!0);try{for(;!p&&Date.now()<n;){if(await ct(s,d,me.signal),p)return;if(!R()){l=async()=>D(await a.read()),y.hidden=!1;return}let i=await a.read();if(!t&&se(i).type==="checkout"){await D(i,!1);return}if(!i.problem&&i.status==="pending"&&await Ee(i),i.status!=="pending"||i.problem||He(i)){await D(i);return}s=Math.min(s*1.5,3e4)}}finally{he=!1,z(r.onObservationChange,!1)}l=async()=>D(await a.read()),y.hidden=!1}async function ke(e=!1){let t=await a.read();if(p)return;if(!R()){l=()=>ke(e),y.hidden=!1;return}let n=a.quote;if(n&&Je(t,{operationId:n.operationId,currency:n.currency},"The original purchase operation changed"),n&&t.status==="pending"&&t.quoteFinalized===!1&&!t.confirmedAt&&!t.checkoutUrl&&!t.nativePurchase&&!t.merchantExecution&&!t.problem&&!a.pendingCancellation){Fe(n);return}await D(t,e||void 0)}async function te(){q?.remove(),q=null,l=te;let e=await a.confirm();if(!R()){l=te,y.hidden=!1;return}if(e.problem){await D(e);return}if(e.status==="pending"){if(e.checkoutUrl)await Ee(e);else if(e.execution&&e.execution.provider!=="merchant"||e.nativePurchase){if(!r.onPurchase)throw new k("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await r.onPurchase({operation:e,signal:me.signal})}}l=async()=>D(await a.read()),await D(e,!0)}function Fe(e){q?.remove();let t=!(Date.parse(e.expiresAt)>Date.now());u.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"),s=d.createElement("button"),i=d.createElement("button"),m=d.createElement("div"),x=d.createElement("p"),I=e.merchantTerms,de=o?"zh-CN":"en",W=I?.subscriptionTerms?.items??[],Te=I?I.subscriptionTerms?.trial?.days:e.lines.find(c=>c.trial)?.trial?.days,X=Te===void 0?null:I?I.totalMinor:e.charge?e.charge.totalMinor:e.lines.every(c=>c.trial)?0:null,Qe=(c,f)=>o?`${f} \u5929\u8BD5\u7528\u7ED3\u675F\u540E ${c}`:`Then ${c} after the ${f}-day trial`,{label:vt,recurring:je}=Be(e),Ct=e.lines.map(c=>c.productName).join(", "),We=X===null?"":`${o?"\u4ECA\u5929\u5E94\u4ED8":"Due today"} ${Z(X,e.currency)}`;x.textContent=We?[Ct,We].filter(Boolean).join(" \xB7 "):vt,s.textContent=o?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",s.disabled=t,i.textContent=o?"\u53D6\u6D88":"Cancel",n.style.cssText=E.panel,x.style.cssText=E.summary,m.style.cssText=E.actions,s.style.cssText=E.primary,i.style.cssText=E.secondary,De(s),s.onclick=()=>{V(te)};let ze=async()=>{let c=await a.cancel();p||(n.remove(),q=null,await D(c))};i.onclick=()=>{l=ze,V(ze)};let L=d.createElement("div");if(L.style.cssText=E.terms,I){for(let f of W){if(X===null&&f===je)continue;let C=d.createElement("p"),M=Z(f.amountMinor,e.currency)+re(f.interval,de,f.intervalCount);C.textContent=X!==null&&Te!==void 0?Qe(M,Te):M,L.append(C)}let c=I.subscriptionTerms?.trial;if(c){let f=d.createElement("p");f.textContent=o?`\u8BD5\u7528 ${c.days} \u5929\uFF1B${c.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${c.days}; ${c.cardRequired?"a payment method is required":"no payment method is required"}`,L.append(f)}for(let f of[...I.expectedEffects.map(C=>C.description),...I.requiredConsents.map(C=>C.summary)]){let C=d.createElement("p");C.textContent=f,L.append(C)}}else{for(let c of e.lines){if(X!==null||c!==je){let f=d.createElement("p"),C=`${Z(c.catalogAmountMinor,e.currency)}${re(c.interval,de,c.intervalCount??1)}`;f.textContent=X!==null&&c.trial?(e.lines.length>1?`${c.productName} \xB7 `:"")+Qe(C,c.trial.days):`${c.productName} \xB7 ${C}`,L.append(f)}for(let f of c.prepaid??[]){let C=d.createElement("p"),M=a.view?.capabilities.plans[c.productVersionId]?.prepaid?.find(Pt=>Pt.internalFeatureId===f.internal_feature_id);C.textContent=`${M?.name??f.internal_feature_id} \xB7 ${f.quantity} ${o?"\u4EFD":"packs"} \xD7 ${f.terms.units}`,M&&(C.textContent+=re(M.reset==="week"||M.reset==="month"||M.reset==="year"?M.reset:"one_time",de,M.resetCount)),L.append(C)}if(c.trial){let f=d.createElement("p");f.textContent=o?`\u8BD5\u7528 ${c.trial.days} \u5929\uFF1B${c.trial.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${c.trial.days}; ${c.trial.cardRequired?"a payment method is required":"no payment method is required"}`,L.append(f)}}if(!e.charge){let c=d.createElement("p");c.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.",L.append(c)}}for(let c of L.children)c.style.margin="0";m.append(s,i),n.append(x,...L.childElementCount?[L]:[],m),U.prepend(n),b?.responsive||n.scrollIntoView?.({block:"nearest"}),s.focus({preventScroll:!0}),q=n,l=null}async function ue(){if(!v)return;if(l=ue,!oe){let n=a.view,s=n?.document.buttons[v.actionId],i=n&&s?.type==="checkout"?ee(s.product,v.selection,n.capabilities):null;if(!n||!i)throw new k("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");let m=await r.resolveOfferId?.({actionId:v.actionId,productVersionId:i,featureQuantities:pe(n.document.screen,i,v.selection,n.capabilities)});if(p)return;m!==void 0&&(v.offerId=m),oe=!0}if(!R()){y.hidden=!1;return}let e;try{e=await a.preview(v)}catch(n){throw a.canReselect===!0&&(v=null,oe=!1,l=null),n}if(p)return;let t=e.merchantTerms;if(r.confirmOnHostedCheckout&&R()&&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=o?"\u6B63\u5728\u6253\u5F00\u6536\u94F6\u53F0\u2026":"Opening checkout\u2026";u.textContent=n;try{await te()}catch(s){p||j(s)}finally{u.textContent===n&&(u.textContent="")}return}Fe(e)}function K(e="destroy"){p||(p=!0,r.signal?.removeEventListener("abort",B),a.signal?.removeEventListener("abort",B),P.finish("dismissed"),Ue?.(),me.abort(),_e?.disconnect(),b?.destroy(),F?.destroy(),a.destroy(),g.open&&g.close(),g.remove(),A.remove(),O(),e==="dismiss"&&z(r.onDismiss))}S=K;async function Ie(){if(!Q||p||ae||$==="closing"||!$&&!R())return;if(!N){K("dismiss");return}let e=d.createElement("p");e.setAttribute("role","status"),e.textContent=o?"\u6B63\u5728\u5173\u95ED\u2026":"Closing\u2026",H||(H=d.createElement("div"),H.style.cssText=U.style.cssText,U.replaceWith(H),Y.inert=!0),w.hidden=!1,H.replaceChildren(e,w),$="closing",w.setAttribute("aria-disabled","true"),w.focus({preventScroll:!0});try{await N.dismiss()}catch(t){p||z(r.onError,t)}p||($="retry",e.textContent=o?"\u672A\u80FD\u786E\u8BA4\u5173\u95ED\uFF0C\u8BF7\u91CD\u8BD5\u3002":"Could not confirm closure. Try again.",w.textContent=o?"\u91CD\u8BD5\u5173\u95ED":"Retry closing",w.removeAttribute("aria-label"),w.removeAttribute("aria-disabled"))}w.onclick=()=>{Ie()},g.addEventListener("cancel",e=>{e.preventDefault(),Ie()}),y.onclick=()=>{l&&V(l)};function Ae(e){P.finish("error",e),K()}function Re(){if(!(!Ve||Q||p||ae||b&&!R()))try{let e=t=>{ge?.(),b&&(g.showModal(),b.responsive&&g.focus({preventScroll:!0}),!t&&r.loading!=="host"&&Ze(g,b.type,b.responsive)),Q=!0};N?N.present(()=>P.present(()=>e(!0))):P.present(e)}catch(e){Ae(e),j(e)}}try{ie.type==="inline"?(Me(),ge=it(A,T),T.append(A)):(g.setAttribute("aria-label",h.document.name),w.textContent="\xD7",w.setAttribute("aria-label",o?"\u5173\u95ED":"Close"),et(w,h.document.screen.theme),w.hidden=Ke(h.document),g.append(w,A),T.append(g),b=Xe(g,{...h.document.screen,presentation:ie},be),b.latch(),b.responsive&&(A.style.display="flex",A.style.flexDirection="column",A.style.maxHeight="100%",Y.style.overflow="clip",Y.style.minHeight="0"),ge=rt(g)),F=dt(Y,{mode:"live",rendererUrl:a.webViewUrl,title:h.document.name,closeActions:mt,onAuthoredClose(t){$||p||(w.hidden=t)},hostPresentation:()=>b?.type??ie.type,reportContentHeight:b?.responsive,onResize:t=>{if(!b?.responsive)return;let n=Math.min(t,we);Y.style.height=`${n}px`,b.setContentHeight(n+(H??U).getBoundingClientRect().height)},onAction(t,n={}){if(!Q||p||$)return;if(!R()){xe();return}let s=a.view,i=s?.document.buttons[t];if(!i)return;if(i.type==="close"){V(async()=>{await r.onAction?.(t),K(r.onAction?"action":"dismiss")});return}if(i.type==="action"){l=async()=>{if(i.action.type==="event"){if(!r.onEvent)throw new k("EVENT_HANDLER_REQUIRED","Provide the event handler");await r.onEvent(i.action.event)}else r.onOpenUrl?await r.onOpenUrl(i.action.url):d.defaultView?.location.assign(i.action.url);await r.onAction?.(t),l=null},V(l);return}if(q&&a.canReselect===!1){u.textContent=o?"\u8BF7\u5148\u786E\u8BA4\u6216\u53D6\u6D88\u5F53\u524D\u8D2D\u4E70\u3002":"Confirm or cancel the current purchase first.",b?.responsive||q.scrollIntoView?.({block:"nearest"}),q.querySelector("button")?.focus({preventScroll:!0});return}if((a.quote||v)&&a.canReselect===!1){let x=!!s&&!!a.quote&&wt(a.quote,s,i.product,n);Pe=!!a.quote&&!x,l=a.quote?()=>ke(x):ue,V(l);return}let m=s&&ee(i.product,n,s.capabilities);if(!s||!m){j(new k("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(r.onPurchaseIntent){l=null,V(async()=>{let x={actionId:t,productVersionId:m,selection:structuredClone(n),featureQuantities:pe(s.document.screen,m,n,s.capabilities)};ve=!0,await r.onPurchaseIntent(x)});return}if(v&&v.actionId!==t){j(new k("COMMAND_PENDING","Finish the current purchase"));return}v||(v={requestId:crypto.randomUUID(),actionId:t,selection:structuredClone(n)},oe=!1),V(ue)},onEscape:()=>{Ie()},onError:t=>{let n=new Error(t);!Q&&!p&&Ae(n),j(n)},onRendered:t=>{t&&g.setAttribute("aria-label",t),Ve=!0,Re()}}),be(),F.update(h.document.screen,h.document.screen.strings.defaultLocale,{capabilities:h.capabilities,unavailableActions:Ne(h),serverInput:{bindings:[],answers:{}}}),Ue=a.subscribe?.(ye),ye(a.view??h),await P.wait(F.ready);let e=a.operation;(a.quote||e&&(e.confirmedAt||e.checkoutUrl||e.status==="complete"))&&(l=()=>ke(),V(l))}catch(e){throw Ae(e),e}return{check:G,host:{get observing(){return he},get recovery(){return ht()},async prepareFallback(){if(J||p||$||ve)return{type:"recover",operationId:a.operation?.operationId??a.quote?.operationId??null,requestId:null};le(!0);try{let e=await Ye(a);return e.type==="native"&&K(),e}finally{le(!1)}},setSuspended(e){ae=e,A.hidden=e,e&&g.open?g.close():!e&&!Q?Re():!e&&!p&&Q&&ie.type!=="inline"&&!g.open&&g.showModal()},destroy:K,refresh:async()=>{if(!R()){if(a.view)return a.view;throw new k("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await a.refresh();return ye(e),Re(),e}}}}export{Yt as showPaywall};
@@ -1 +0,0 @@
1
- import{a}from"./chunk-ERJP2GBD.js";import"./chunk-ILEDKSRQ.js";import"./chunk-EQPEUPMG.js";import"./chunk-FYQXSGRT.js";import"./chunk-7MNJH5GB.js";import"./chunk-ITGERPCJ.js";import"./chunk-THMGTRXP.js";import"./chunk-NAZU3EEJ.js";import"./chunk-SCC3O2RD.js";import"./chunk-R23IGK5U.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-EHDHWYVJ.js";import"./chunk-BXPXJARS.js";import"./chunk-5HJYR6Z4.js";import"./chunk-WTVLNUMS.js";import"./chunk-VYFSRHXM.js";import"./chunk-N7YXDSQL.js";import"./chunk-MIBRUDIS.js";import"./chunk-X4W22IH6.js";import"./chunk-R4FDIYMN.js";import"./chunk-3VUPVXAV.js";import"./chunk-WKIR2EQG.js";import"./chunk-VF6QMMEA.js";import"./chunk-DSPLGTQI.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.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-TDSATEGE.js";import"./chunk-U6UHASIB.js";import"./chunk-N7YXDSQL.js";import"./chunk-MIBRUDIS.js";import"./chunk-X4W22IH6.js";import"./chunk-R4FDIYMN.js";import"./chunk-VF6QMMEA.js";import"./chunk-DSPLGTQI.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.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
File without changes