@tinkerlandai/longplay-sdk 0.10.52 → 0.10.54

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 (112) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{ai-usage-gcDQqLb2.d.ts → ai-usage-DBcYB8ix.d.ts} +1 -1
  3. package/dist/{api-D0Qu0isy.d.ts → api-1Tplv-7M.d.ts} +1 -1
  4. package/dist/check-response-MJHH5FWT.js +1 -0
  5. package/dist/{chunk-USM6HOXG.js → chunk-36VNAOG6.js} +1 -1
  6. package/dist/chunk-66TY4EFN.js +1 -0
  7. package/dist/{chunk-PGZZKX5K.js → chunk-6HKQILBV.js} +1 -1
  8. package/dist/{chunk-I643NVMZ.js → chunk-73UFNVEP.js} +1 -1
  9. package/dist/{chunk-UCDQJB53.js → chunk-ADTZEBQF.js} +1 -1
  10. package/dist/chunk-AEQUKR4O.js +1 -0
  11. package/dist/{chunk-5YQZEJBM.js → chunk-ANJPFGFN.js} +1 -1
  12. package/dist/{chunk-XI2NNZBS.js → chunk-BKBWGPNR.js} +1 -1
  13. package/dist/{chunk-7UXQJJFZ.js → chunk-BX2MSRA4.js} +1 -1
  14. package/dist/chunk-C4NXQMSO.js +1 -0
  15. package/dist/{chunk-K644WUOE.js → chunk-CAE4KIZN.js} +1 -1
  16. package/dist/{chunk-3TV3CVNP.js → chunk-CJUODAOF.js} +1 -1
  17. package/dist/{chunk-4CRUNNTC.js → chunk-DXLBEXC6.js} +1 -1
  18. package/dist/{chunk-CJUVMNDB.js → chunk-EACC667P.js} +1 -1
  19. package/dist/{chunk-TSBXPDUQ.js → chunk-GGZG56GR.js} +1 -1
  20. package/dist/{chunk-VPT5MFDG.js → chunk-HMJTABQ5.js} +2 -2
  21. package/dist/{chunk-EDV6ZNPQ.js → chunk-IN32NWRI.js} +1 -1
  22. package/dist/{chunk-2MDJ3JE5.js → chunk-J4RM5GQP.js} +1 -1
  23. package/dist/chunk-JCI5PGY3.js +1 -0
  24. package/dist/{chunk-AFZB2AYU.js → chunk-JJIP6BZL.js} +1 -1
  25. package/dist/{chunk-KXSZTBAG.js → chunk-JXWZS4UM.js} +1 -1
  26. package/dist/{chunk-FAMPOY6L.js → chunk-L64BS65O.js} +1 -1
  27. package/dist/{chunk-VGEH7B6S.js → chunk-LBDLWHBY.js} +1 -1
  28. package/dist/{chunk-AN7CPDBU.js → chunk-LFMAFY3P.js} +1 -1
  29. package/dist/{chunk-3LWZFXLN.js → chunk-LOBZ45T3.js} +1 -1
  30. package/dist/{chunk-CBOIDISB.js → chunk-M4P6TGBU.js} +1 -1
  31. package/dist/chunk-MRL7XUBV.js +1 -0
  32. package/dist/{chunk-XO6GV6O7.js → chunk-MZRDAMFQ.js} +1 -1
  33. package/dist/{chunk-KVIGHX2B.js → chunk-NL7AXMUA.js} +1 -1
  34. package/dist/{chunk-YJRO7NXN.js → chunk-NNJVMJUG.js} +1 -1
  35. package/dist/chunk-OJDO7546.js +1 -0
  36. package/dist/{chunk-RUMGXXVJ.js → chunk-OV46DXRX.js} +1 -1
  37. package/dist/{chunk-LDLS2VL2.js → chunk-OZK47BUU.js} +1 -1
  38. package/dist/{chunk-W3V7DTPC.js → chunk-PB34FLPJ.js} +1 -1
  39. package/dist/{chunk-DJYLJBU2.js → chunk-PPXVRQAG.js} +1 -1
  40. package/dist/{chunk-7Q25R5GL.js → chunk-PVMGYRGE.js} +1 -1
  41. package/dist/chunk-QAGK2SLZ.js +1 -0
  42. package/dist/{chunk-POX2ELNS.js → chunk-QGKROSRD.js} +1 -1
  43. package/dist/{chunk-FKC7TJWM.js → chunk-R2L227PQ.js} +1 -1
  44. package/dist/{chunk-YGOXUDDF.js → chunk-R4BYUK7S.js} +1 -1
  45. package/dist/{chunk-ZVLZLBDA.js → chunk-RJT764B2.js} +1 -1
  46. package/dist/{chunk-BBA64POP.js → chunk-RRZZUIFM.js} +1 -1
  47. package/dist/{chunk-OEUA65JK.js → chunk-S2MSRPR2.js} +1 -1
  48. package/dist/{chunk-PZZLYHKR.js → chunk-SK5JZ7HA.js} +2 -2
  49. package/dist/{chunk-7LHRBNSH.js → chunk-TS26DZNO.js} +1 -1
  50. package/dist/{chunk-NVHRWZIZ.js → chunk-UEKKQHUZ.js} +1 -1
  51. package/dist/{chunk-BYHBBZIO.js → chunk-WE55LJEN.js} +1 -1
  52. package/dist/{chunk-S4YBFFFY.js → chunk-XHZH3E4G.js} +1 -1
  53. package/dist/{chunk-JRHJO4BR.js → chunk-YMRWDMIL.js} +1 -1
  54. package/dist/chunk-ZEU56NVY.js +1 -0
  55. package/dist/{chunk-S6MXUFVF.js → chunk-ZQY7OYHM.js} +1 -1
  56. package/dist/{configuration-sync-DObsuVof.d.ts → configuration-sync-DeWWW5za.d.ts} +1 -1
  57. package/dist/{content-2EEYM7U7.js → content-A4SPKH7N.js} +1 -1
  58. package/dist/funnel-host-purchase-V2TIWGCQ.js +1 -0
  59. package/dist/funnel-host-recovery-paywall-DWKTPDLY.js +1 -0
  60. package/dist/{funnel-local-client-DzRzPX4x.d.ts → funnel-local-client-Fxsyl7rh.d.ts} +26 -26
  61. package/dist/funnel-paywall-prerender-DD7LQXDJ.js +1 -0
  62. package/dist/{funnel-process-client-DGRmy5KN.d.ts → funnel-process-client-D9saqPse.d.ts} +12 -12
  63. package/dist/funnel-route-prediction-ICGW4DPX.js +1 -0
  64. package/dist/funnel-route-source-64LTJZXN.js +1 -0
  65. package/dist/funnel-runtime-host-JG3OAYZ6.js +1 -0
  66. package/dist/index.d.ts +2353 -445
  67. package/dist/index.js +1 -1
  68. package/dist/merchant-bridge-contracts-DEDEIYNU.js +1 -0
  69. package/dist/native-shell.js +1 -1
  70. package/dist/openrouter.d.ts +3 -3
  71. package/dist/openrouter.js +1 -1
  72. package/dist/operation-contracts-RHJJI5NO.js +1 -0
  73. package/dist/page.d.ts +2 -2
  74. package/dist/page.js +1 -1
  75. package/dist/paywall-NM4HMYMK.js +1 -0
  76. package/dist/paywall-content-T2FGNRBR.js +1 -0
  77. package/dist/paywall-session-BAUWSWWR.js +1 -0
  78. package/dist/popup.d.ts +3 -3
  79. package/dist/popup.js +1 -1
  80. package/dist/{presentation-loading-BWUNotNa.d.ts → presentation-loading-sMyRJ21g.d.ts} +4 -2
  81. package/dist/react-native.d.ts +7 -7
  82. package/dist/react-native.js +1 -1
  83. package/dist/screen-renderer-CMFJVI36.js +1 -0
  84. package/dist/server.d.ts +7 -7
  85. package/dist/server.js +1 -1
  86. package/dist/{visual-dom-5LUN4AHO.js → visual-dom-MH3JDJHJ.js} +1 -1
  87. package/dist/visual.js +1 -1
  88. package/package.json +1 -1
  89. package/dist/check-response-AVQ7PY5I.js +0 -1
  90. package/dist/chunk-4OSW2Y67.js +0 -1
  91. package/dist/chunk-EJAF6OGO.js +0 -1
  92. package/dist/chunk-L66EXWTK.js +0 -1
  93. package/dist/chunk-QIY6PCYC.js +0 -1
  94. package/dist/chunk-ZNOVEJLM.js +0 -1
  95. package/dist/chunk-ZY4YDPSI.js +0 -1
  96. package/dist/funnel-host-purchase-UONTZRRJ.js +0 -1
  97. package/dist/funnel-paywall-prerender-AT4BXZIY.js +0 -1
  98. package/dist/funnel-route-prediction-Z3J2HSHI.js +0 -1
  99. package/dist/funnel-route-source-LFE6GSHU.js +0 -1
  100. package/dist/funnel-runtime-host-7ROIR7CU.js +0 -1
  101. package/dist/merchant-bridge-contracts-O6WIWC7T.js +0 -1
  102. package/dist/operation-contracts-H7NKQ373.js +0 -1
  103. package/dist/paywall-25MAYQ4B.js +0 -1
  104. package/dist/paywall-content-7KTEQLRN.js +0 -1
  105. package/dist/paywall-session-7HGW5IKN.js +0 -1
  106. package/dist/screen-renderer-XZWKIJWF.js +0 -1
  107. package/dist/{chunk-PY3AC5KD.js → chunk-5YBTU4KS.js} +0 -0
  108. package/dist/{chunk-CILM5XMH.js → chunk-DLRCJF6U.js} +0 -0
  109. package/dist/{chunk-VPT5MFDG.js.LEGAL.txt → chunk-HMJTABQ5.js.LEGAL.txt} +0 -0
  110. package/dist/{chunk-PZZLYHKR.js.LEGAL.txt → chunk-SK5JZ7HA.js.LEGAL.txt} +0 -0
  111. package/dist/{chunk-OJM6ORHE.js → chunk-VJIONC4S.js} +0 -0
  112. package/dist/{screen-CJepeiBT.d.ts → screen-D2bUmJ4M.d.ts} +1 -1
@@ -1 +1 @@
1
- import{f as o}from"./chunk-LDLS2VL2.js";var n=class extends Error{constructor(t,s,y,i,r){super(s);this.code=t;this.status=y;this.requestId=i;this.name="IndianaError",this.reason=r?.reason;let e=o(t,y??0,{...r,retryAfter:r?.retryAfterSeconds===void 0?void 0:String(r.retryAfterSeconds)});this.retryable=e.retryable,this.recovery=e.recovery,this.retryAfterSeconds=e.retryAfterSeconds}code;status;requestId;commandRequestId;retryable;recovery;retryAfterSeconds;reason};export{n as a};
1
+ import{f as o}from"./chunk-OZK47BUU.js";var n=class extends Error{constructor(t,s,y,i,r){super(s);this.code=t;this.status=y;this.requestId=i;this.name="IndianaError",this.reason=r?.reason;let e=o(t,y??0,{...r,retryAfter:r?.retryAfterSeconds===void 0?void 0:String(r.retryAfterSeconds)});this.retryable=e.retryable,this.recovery=e.recovery,this.retryAfterSeconds=e.retryAfterSeconds}code;status;requestId;commandRequestId;retryable;recovery;retryAfterSeconds;reason};export{n as a};
@@ -1 +1 @@
1
- import{m as o}from"./chunk-ZVLZLBDA.js";import{a as i}from"./chunk-BYHBBZIO.js";function m(t,e,n,r){if(!o(t,e)||n!==void 0&&e.observation&&e.observation.subject.customerId!==n||r!==void 0&&e.observation!==void 0&&(e.observation.subject.scope.projectId!==r.projectId||e.observation.subject.scope.environment!==r.environment))throw new i("INVALID_RESPONSE","The access requirement or Customer changed");return e}function d(t,e,n){if(t.requirement){if(!e)throw new i("INVALID_RESPONSE","The requested access check is missing");m(t.requirement,e,t.customerId,n)}}export{m as a,d as b};
1
+ import{m as o}from"./chunk-RJT764B2.js";import{a as i}from"./chunk-WE55LJEN.js";function m(t,e,n,r){if(!o(t,e)||n!==void 0&&e.observation&&e.observation.subject.customerId!==n||r!==void 0&&e.observation!==void 0&&(e.observation.subject.scope.projectId!==r.projectId||e.observation.subject.scope.environment!==r.environment))throw new i("INVALID_RESPONSE","The access requirement or Customer changed");return e}function d(t,e,n){if(t.requirement){if(!e)throw new i("INVALID_RESPONSE","The requested access check is missing");m(t.requirement,e,t.customerId,n)}}export{m as a,d as b};
@@ -1 +1 @@
1
- import{b as p,c as d}from"./chunk-7UXQJJFZ.js";import{t as a,w as u,z as m}from"./chunk-BBA64POP.js";import{b as e}from"./chunk-PY3AC5KD.js";var s=e.enum(["page","popup","banner"]),y=3e5,f=e.strictObject({type:e.enum(["string","number","boolean","strings","json"]),nullable:e.boolean()}),h=e.strictObject({inputs:e.record(a,f.extend({required:e.boolean()})).refine(t=>Object.keys(t).length<=40,"Too many content inputs"),outputs:e.record(a,f).refine(t=>Object.keys(t).length<=40,"Too many content outputs")}),g=e.strictObject({kind:s,schemaVersion:e.literal(1),name:e.string().trim().min(1).max(80),screen:u,contract:h}),c=g.superRefine((t,r)=>{let n=(o,b)=>r.addIssue({code:"custom",message:o,path:b});t.screen.surface!==t.kind&&n("Content surface must match its domain",["screen","surface"]),t.screen.name!==t.name&&n("Content has one editable name",["screen","name"]),t.kind==="banner"&&t.screen.presentation.type!=="inline"&&n("Banner requires an inline container",["screen","presentation"]),t.kind!=="banner"&&t.screen.presentation.type==="inline"&&n("Inline presentation belongs to Banner",["screen","presentation"]),t.screen.actions.some(o=>o.type!=="event"&&o.type!=="navigate")&&n("Content actions must emit host intents or navigate locally",["screen","actions"]);let i=new Set(t.screen.actions.filter(o=>o.type==="event").map(o=>o.id));(Object.keys(t.contract.outputs).some(o=>!i.has(o))||[...i].some(o=>!Object.hasOwn(t.contract.outputs,o)))&&n("Every event needs exactly one output declaration",["contract","outputs"]),d(t)>y&&n("Content document exceeds its byte budget",[])});function S(t,r){if(t===null)return r.nullable;switch(r.type){case"json":return!0;case"string":return typeof t=="string";case"number":return typeof t=="number"&&Number.isFinite(t);case"boolean":return typeof t=="boolean";case"strings":return Array.isArray(t)&&t.every(n=>typeof n=="string")}}var x=c.superRefine((t,r)=>{for(let n of p(t.screen))Object.keys(t.contract.inputs).some(i=>n===i||n.startsWith(i+"."))||r.addIssue({code:"custom",path:["contract","inputs"],message:"Declare every reusable input read"});for(let n of t.screen.actions){if(n.type!=="event")continue;let i=t.contract.outputs[n.id],o=Object.hasOwn(n.properties,"value")?n.properties.value:n.properties;i&&!S(o,i)&&r.addIssue({code:"custom",path:["contract","outputs",n.id],message:"Action value differs from its declared type"})}m(t.screen).some(n=>!n.complete)&&r.addIssue({code:"custom",path:["screen","strings"],message:"Content needs complete localized copy"})}),l=e.strictObject({id:e.uuid(),kind:s,projectId:e.uuid(),environmentId:e.uuid(),name:e.string(),revision:e.number().int().nonnegative(),status:e.enum(["draft","published","archived"]),publishedVersionId:e.uuid().nullable(),createdAt:e.iso.datetime({offset:!0}),updatedAt:e.iso.datetime({offset:!0})}),D=l.extend({draft:c}),I=e.strictObject({rows:e.array(l).max(200),nextCursor:e.uuid().nullable()}),v=e.strictObject({id:e.uuid(),kind:s,resourceId:e.uuid(),projectId:e.uuid(),environmentId:e.uuid(),version:e.number().int().positive(),sourceRevision:e.number().int().nonnegative(),document:x,createdAt:e.iso.datetime({offset:!0})}),z=v.omit({document:!0}),V=e.discriminatedUnion("action",[e.strictObject({action:e.literal("create"),kind:s,id:e.uuid(),document:c}),e.strictObject({action:e.literal("save"),kind:s,id:e.uuid(),revision:e.number().int().nonnegative(),document:c}),e.strictObject({action:e.enum(["publish","archive"]),kind:s,id:e.uuid(),revision:e.number().int().nonnegative()})]).superRefine((t,r)=>{"document"in t&&t.document.kind!==t.kind&&r.addIssue({code:"custom",path:["document","kind"],message:"Content cannot change domain"})});export{s as a,v as b};
1
+ import{b as p,c as d}from"./chunk-BX2MSRA4.js";import{t as a,w as u,z as m}from"./chunk-RRZZUIFM.js";import{b as e}from"./chunk-5YBTU4KS.js";var s=e.enum(["page","popup","banner"]),y=3e5,f=e.strictObject({type:e.enum(["string","number","boolean","strings","json"]),nullable:e.boolean()}),h=e.strictObject({inputs:e.record(a,f.extend({required:e.boolean()})).refine(t=>Object.keys(t).length<=40,"Too many content inputs"),outputs:e.record(a,f).refine(t=>Object.keys(t).length<=40,"Too many content outputs")}),g=e.strictObject({kind:s,schemaVersion:e.literal(1),name:e.string().trim().min(1).max(80),screen:u,contract:h}),c=g.superRefine((t,r)=>{let n=(o,b)=>r.addIssue({code:"custom",message:o,path:b});t.screen.surface!==t.kind&&n("Content surface must match its domain",["screen","surface"]),t.screen.name!==t.name&&n("Content has one editable name",["screen","name"]),t.kind==="banner"&&t.screen.presentation.type!=="inline"&&n("Banner requires an inline container",["screen","presentation"]),t.kind!=="banner"&&t.screen.presentation.type==="inline"&&n("Inline presentation belongs to Banner",["screen","presentation"]),t.screen.actions.some(o=>o.type!=="event"&&o.type!=="navigate")&&n("Content actions must emit host intents or navigate locally",["screen","actions"]);let i=new Set(t.screen.actions.filter(o=>o.type==="event").map(o=>o.id));(Object.keys(t.contract.outputs).some(o=>!i.has(o))||[...i].some(o=>!Object.hasOwn(t.contract.outputs,o)))&&n("Every event needs exactly one output declaration",["contract","outputs"]),d(t)>y&&n("Content document exceeds its byte budget",[])});function S(t,r){if(t===null)return r.nullable;switch(r.type){case"json":return!0;case"string":return typeof t=="string";case"number":return typeof t=="number"&&Number.isFinite(t);case"boolean":return typeof t=="boolean";case"strings":return Array.isArray(t)&&t.every(n=>typeof n=="string")}}var x=c.superRefine((t,r)=>{for(let n of p(t.screen))Object.keys(t.contract.inputs).some(i=>n===i||n.startsWith(i+"."))||r.addIssue({code:"custom",path:["contract","inputs"],message:"Declare every reusable input read"});for(let n of t.screen.actions){if(n.type!=="event")continue;let i=t.contract.outputs[n.id],o=Object.hasOwn(n.properties,"value")?n.properties.value:n.properties;i&&!S(o,i)&&r.addIssue({code:"custom",path:["contract","outputs",n.id],message:"Action value differs from its declared type"})}m(t.screen).some(n=>!n.complete)&&r.addIssue({code:"custom",path:["screen","strings"],message:"Content needs complete localized copy"})}),l=e.strictObject({id:e.uuid(),kind:s,projectId:e.uuid(),environmentId:e.uuid(),name:e.string(),revision:e.number().int().nonnegative(),status:e.enum(["draft","published","archived"]),publishedVersionId:e.uuid().nullable(),createdAt:e.iso.datetime({offset:!0}),updatedAt:e.iso.datetime({offset:!0})}),D=l.extend({draft:c}),I=e.strictObject({rows:e.array(l).max(200),nextCursor:e.uuid().nullable()}),v=e.strictObject({id:e.uuid(),kind:s,resourceId:e.uuid(),projectId:e.uuid(),environmentId:e.uuid(),version:e.number().int().positive(),sourceRevision:e.number().int().nonnegative(),document:x,createdAt:e.iso.datetime({offset:!0})}),z=v.omit({document:!0}),V=e.discriminatedUnion("action",[e.strictObject({action:e.literal("create"),kind:s,id:e.uuid(),document:c}),e.strictObject({action:e.literal("save"),kind:s,id:e.uuid(),revision:e.number().int().nonnegative(),document:c}),e.strictObject({action:e.enum(["publish","archive"]),kind:s,id:e.uuid(),revision:e.number().int().nonnegative()})]).superRefine((t,r)=>{"document"in t&&t.document.kind!==t.kind&&r.addIssue({code:"custom",path:["document","kind"],message:"Content cannot change domain"})});export{s as a,v as b};
@@ -0,0 +1 @@
1
+ import{b as zn}from"./chunk-S2MSRPR2.js";import{a as mn}from"./chunk-C4NXQMSO.js";import{a as Nn,b as _n,c as pn,d as fn,e as Ve,f as Un,h as $n,i as Vn,j as Mn,k as xn}from"./chunk-DXLBEXC6.js";import{a as Jn}from"./chunk-66TY4EFN.js";import{a as Dn}from"./chunk-W32FI2A2.js";import{c as On,e as Sn,f as qn,h as Hn,i as Le,j as en,k as Ln,l as nn}from"./chunk-QAGK2SLZ.js";import{b as An}from"./chunk-73UFNVEP.js";import{a as cn,d as Tn}from"./chunk-ADTZEBQF.js";import{C as Fn}from"./chunk-RRZZUIFM.js";import{a as ne}from"./chunk-WE55LJEN.js";import{a as Ie}from"./chunk-DSPLGTQI.js";function Bn(i){let E=new Set,U=new Set,n=null;async function p(a,f){let H=!1;for(;!i.stopped&&i.key===a&&i.client.pendingCommand?.requestId===f;){if(!i.client.settle)throw new ne("COMMAND_PENDING","The original display acknowledgement is still pending");await i.client.settle(f),H=!0,i.client.pendingCommand?.requestId===f&&await new Promise(L=>setTimeout(L,1500))}i.stopped||i.key!==a||(H&&await i.client.get(),!(i.stopped||i.key!==a)&&E.add(a))}function k(a,f){n=f;let H=()=>{n===f&&(n=null),U.delete(a)};return f.then(H,L=>{H(),i.busy||i.fail(L)}),f}function $(a){if(i.reviewing||E.has(a)||U.has(a)||i.stopped)return;U.add(a);let f=async()=>{if(i.reviewing||i.stopped||i.key!==a||E.has(a)){U.delete(a);return}if(i.busy||i.client.pendingCommand){setTimeout(()=>{f()},250);return}let H=(async()=>{if(i.staleRead){if(await i.staleRead,i.stopped||i.key!==a)return;if(i.client.pendingCommand){setTimeout(()=>{f()},250);return}}let L=i.client.view,oe=i.expected(),u=oe.requestId;try{await i.client.submit({operation:"shown",...oe})}catch(P){if(!(P instanceof ne)||P.code!=="CONFLICT"||P.status!==409||i.client.pendingCommand)throw P;await i.client.get();let s=i.client.view;if(i.stopped||i.reviewing||i.key!==a||!s||!L||s.id!==L.id||s.source.versionId!==L.source.versionId||s.nodeId!==oe.nodeId||s.visit!==oe.visit||s.revision<=oe.revision||s.stopped||!s.screen&&(!s.paywall||s.paywall.receiptId!==L.paywall?.receiptId)||!["running","waiting"].includes(s.status)||i.client.pendingCommand)throw P;let r=i.expected();u=r.requestId,await i.client.submit({operation:"shown",...r})}await p(a,u)})();k(a,H)};f()}function D(){if(n)return n;let a=i.client.pendingCommand;if(a?.operation!=="shown")return null;let f=i.key;return U.add(f),k(f,(async()=>{await i.client.retry(),await p(f,a.requestId)})())}return{report:$,settled:D,get inFlight(){return n}}}function Gn(i){let E={},U=new Map;async function n(p){let k=i.client.view,$=k?.screen,D=$?.customerData.nodes[p.nodeId];if(i.stopped||i.busy||!k||!$||!D)return;if(!["refresh","next","previous","filter","sources_next","sources_previous"].includes(p.action)){let P=i.document,s=P?Fn(P,p.nodeId):null,r=s?.type==="customer_data"?s.data.outputs?.[p.action]:void 0;r&&$.outputs.includes(r)?await i.perform(()=>i.client.submit({operation:"submit",...i.expected(),input:{type:"screen",output:r,answers:i.answers,selection:p.value?{[p.nodeId]:p.value}:{}}})):await i.onIntent?.(p,k);return}let f=p.action.startsWith("sources_")?D.resources.find(P=>P.key===p.value):null;if(p.action.startsWith("sources_")&&!f)throw new ne("INVALID_REQUEST","Choose a current resource");let H=`${k.visit}:${p.nodeId}:${f?.key??""}`,L=U.get(H)??[null],u=E[p.nodeId]??{page:1,after:null,filter:"all",...f?{resourceKey:f.key}:{}};if(p.action==="filter"){let P=p.value;if(!P||!(D.source==="offer_history"?["all","issued","reserved","redeemed","expired","revoked"]:["all","purchase","refund","source","usage","debt","settlement"]).includes(P))throw new ne("INVALID_REQUEST","Unknown data filter");u={page:1,after:null,filter:P},L.splice(0,L.length,null)}else if(p.action==="next"||p.action==="sources_next"){let P=f?.sources.at(-1),s=f?P?{kind:"ledger",cursor:{at:P.detail[0],id:P.id,type:"source"}}:null:$.dataCursors[p.nodeId];if(!s||!f&&!D.hasNext)return;L[u.page]=s,u={...u,page:u.page+1,after:s}}else if(p.action==="previous"||p.action==="sources_previous"){if(u.page<=1)return;u={...u,page:u.page-1,after:L[u.page-2]??null}}U.set(H,L),E={...E,[p.nodeId]:u},await i.perform(()=>i.client.get({nodeId:k.nodeId,visit:k.visit,revision:k.revision,components:E}))}return{get queries(){return E},intent:n,reset(){E={},U.clear()}}}function Qn(i){let{doc:E,holder:U,reviewHolder:n,mountScreenPreview:p}=i,k=!1,$,D=0,a=null,f="",H,L=new Map,oe=s=>s?`${s.id}:${s.nodeId}:${s.visit}:${s.revision}:${s.paywall?.quote?.operationId??""}`:"";async function u(s){if(i.stopped||!i.client.review||k&&s===$&&H?.active)return;let r=!k||s!==$;k||(f=oe(i.client.view),L.set(f,structuredClone(i.answers))),k=!0,$=s,U.hidden=!0,i.suspend(!0),n.hidden=!1;let O=++D;r&&(H?.finish("dismissed"),a?.destroy(),a=null,n.replaceChildren(),H=en(n,i.loadingOptions,"funnel",()=>{P()}));let T=r?H:void 0;try{if(T?.start(!1,i.client.view?.locale),O!==D||i.stopped)return;let de=i.client.review(s),N=await(T?.wait(de,Le)??de);if(i.stopped||O!==D||!k)return;if(!N.review)throw new ne("INVALID_RESPONSE","Historical projection is missing");a?.destroy(),a=null,T||n.replaceChildren();let Q=E.createElement("div"),W=T?nn(Q,n):()=>{};n.append(Q);let S=N.run.locale.startsWith("zh"),y=i.chrome;Q.style.cssText=y.history;let j=E.createElement("p");j.textContent=S?"只读回看":"Read-only history",j.style.cssText=y.historyTitle,Q.append(j);let F=E.createElement("p");F.style.cssText=y.historyNote,F.textContent=N.review.pages.length?S?"选择一页查看当时的内容,回看不会改动任何信息。":"Choose a page to see it as it was. Nothing here can be changed.":S?"还没有可回看的页面。":"There are no earlier pages yet.",Q.append(F);let Ae=N.review.page?.receiptId,ge=E.createElement("div");ge.style.cssText=y.historyPages;for(let[K,R]of N.review.pages.entries()){let v=E.createElement("button");v.type="button",v.textContent=S?`第 ${K+1} 页`:`Page ${K+1}`;let he=Ae!==void 0&&R.receiptId===Ae;v.style.cssText=he?y.primary:y.secondary,he&&v.setAttribute("aria-current","page"),Ve(v,()=>i.chrome.focus),v.onclick=()=>{u(R.receiptId)},ge.append(v)}if(ge.childElementCount&&Q.append(ge),N.review.page){let K=N.review.page,R=E.createElement("div");R.inert=!0,R.style.cssText=y.historyPage,Q.append(R),a=p(R,{mode:"live",rendererUrl:i.client.webViewUrl,title:K.document.name,onAction:()=>{},onAnswers:()=>{},onCustomerDataIntent:()=>{},onRendered:()=>{O===D&&!i.stopped&&T?.present(W)},onError:he=>{if(O!==D||i.stopped)return;let Ce=new Error(he);T?.finish("error",Ce),a?.destroy(),a=null,Q.remove(),i.fail(Ce)},onEscape:()=>{P()}});let v=a;if(v.update(K.document,N.run.locale,{serverInput:{bindings:K.inputs,answers:K.answers,values:K.values}}),await v.ready,i.stopped||O!==D||!k)return}let me=S?{issued:"已领取",reserved:"已预留",redeemed:"已使用",expired:"已过期",revoked:"已撤销",unknown:"状态待确认"}:{issued:"Issued",reserved:"Reserved",redeemed:"Used",expired:"Expired",revoked:"Revoked",unknown:"Status unconfirmed"},z=E.createElement("div");z.style.cssText=y.historyRecords;for(let K of[...N.review.coupons.map((R,v)=>`${S?"优惠券":"Coupon"} ${v+1}: ${me[R.status]}`),...N.review.purchases.map((R,v)=>`${S?"购买":"Purchase"} ${v+1}: ${xn(R.status,S)}`)]){let R=E.createElement("p");R.textContent=K,R.style.margin="0",z.append(R)}z.childElementCount&&Q.append(z),N.review.page||T?.present(W),i.client.view&&await i.enqueue(i.client.view)}catch(de){if(O!==D||i.stopped)return;T?.finish("error",de),a?.destroy(),a=null,n.replaceChildren(),i.fail(de)}}async function P(){if(!k||i.stopped||!i.client.review)return;let s=++D;H?.finish("dismissed");try{if(await i.client.review(),i.stopped||s!==D)return;k=!1,D++,H?.finish("dismissed"),a?.destroy(),a=null,n.replaceChildren(),n.hidden=!0,U.hidden=!1;let r=i.client.view;oe(r)!==f?(L.set(f,structuredClone(i.answers)),i.resetScreen()):(L.delete(f),i.suspend(!1)),r&&await i.enqueue(r)}catch(r){if(s!==D||i.stopped)return;a?.destroy(),a=null,n.replaceChildren(),i.fail(r)}}return{get active(){return k},get receipt(){return $},open:u,exit:P,get drafts(){return new Map([...L].map(([s,r])=>[s,structuredClone(r)]))},stop(){k=!1,D++,H?.finish("dismissed"),a?.destroy(),a=null,n.replaceChildren(),n.hidden=!0,U.hidden=!1}}}var wn=5e3;async function Kn(i,E,U){let n=E,p=n.prepared&&zn(n.prepared),k=()=>{};function $(){n.prepared&&n.prepared.state!=="adopted"&&p?.release()}let D=()=>n.prepared?.state==="shown"&&!!p?.modal,a=n.client.identitySignal,f;try{f=await Promise.all([import("./screen-renderer-CMFJVI36.js"),import("./paywall-NM4HMYMK.js")]),n.signal?.throwIfAborted(),a?.throwIfAborted()}catch(e){throw $(),e}let[{mountScreenPreview:H},{showPaywall:L}]=f,oe=(typeof INDIANA_NATIVE_SHELL_BUILD>"u"||!INDIANA_NATIVE_SHELL_BUILD)&&n.appManifestRelease?Jn({client:n.client,appManifestRelease:n.appManifestRelease,onError:n.onError}):void 0;oe?.start();let u=i.ownerDocument,P=Hn(u),s=!1,r=u.createElement("section"),O=u.createElement("div"),T=u.createElement("div"),de=u.createElement("div"),N=u.createElement("button");de.hidden=!0,N.type="button";let Q=u.createElement("p"),W=u.createElement("p"),S=u.createElement("button"),y=u.createElement("button"),j=u.createElement("button"),F=u.createElement("dialog"),Ae,ge=!1;r.dataset.indianaFunnel="",r.dataset.longplayCloseOwner="sdk",r.setAttribute("aria-busy","false"),Q.setAttribute("role","status"),W.setAttribute("role","alert"),W.hidden=!0,S.type=y.type=j.type="button",T.append(S,N,Q,W,j,y),r.append(O,de,T),i.append(r);let me=_n,z=pn(me),K="",R=(u.documentElement.lang||"").startsWith("zh"),v,he="",Ce;for(let e of[S,N,j,y])Ve(e,()=>z.focus);function yn(){let e=R?"关闭":"Close";y.parentElement===F?(y.textContent="×",y.setAttribute("aria-label",e),qn(y,me)):(y.textContent=e,y.removeAttribute("aria-label"),y.style.cssText=z.link+";margin-inline-start:auto")}function Me(e){let t=e?.screen?.content.document.theme??me,o=JSON.stringify([t.primary,t.background,t.text,t.radius,t.font,y.parentElement===F]);if(o===K)return;K=o,me=t;let g=y.parentElement===F;z=pn(me,g),r.style.cssText=z.root+";min-width:0"+(g?";display:flex;flex-direction:column;min-height:100%":""),T.style.cssText=z.bar+(g?";margin-top:auto":""),T.hidden&&(T.style.display="none"),S.style.cssText=N.style.cssText=z.secondary,j.style.cssText=z.primary,Q.style.cssText=z.status,W.style.cssText=z.alert,yn(),fn(S)}function be(){T.hidden=S.hidden&&N.hidden&&j.hidden&&W.hidden&&!Q.textContent&&(y.hidden||y.parentElement!==T),T.style.display=T.hidden?"none":"flex",v?.responsive&&Ce!==void 0&&v.setContentHeight(Ce+T.getBoundingClientRect().height)}Me();let ae=null,I=null,le=null,we="",ee="",Pe=!1,xe="",tn="",ze="",l=!1,X=0,Je=!1,vn="",rn=null,on=Promise.resolve(),gn=!n.client.view,Ne,A=U,Te,_e,Be="",Ge,te=!1,Re=null,ue=!1,Qe=()=>n.client.pendingCommand?.operation==="close",ie=null,V=null,sn=Dn({document:u,run:async()=>{(!I?.observing||n.client.pendingCommand)&&await ln()},delay:()=>{if(!re.pending&&!(l||!le||!["running","waiting"].includes(le.status)&&!n.client.pendingCommand)&&!(I?.observing&&!n.client.pendingCommand))return le.pendingRequest||n.client.pendingCommand?1500:wn},hiddenDelay:()=>!l&&!re.pending&&n.client.pendingCommand?15e3:void 0}),M=null;function an(){return V&&n.client.hasDurableJournal===!0&&M?.acknowledged===!0&&M.operationId===V.operationId&&n.client.view?.id===M.runId&&n.client.view?.status==="closed"&&n.client.view.revision===M.revision+1&&!(n.client.pendingCommands?.length??(n.client.pendingCommand?1:0))&&!n.client.pendingPurchase?V:null}function hn(e){let t=e.run.paywall;if(M&&e.settlement?.requestId===M.requestId&&e.settlement.state==="settled"&&e.settlement.operationId===null&&e.run.id===M.runId&&e.run.status==="closed"&&!e.run.pendingRequest&&e.run.revision===M.revision+1&&e.run.nodeId===M.nodeId&&e.run.visit===M.visit&&t?.receiptId===M.receiptId&&t.selectionGeneration===M.selectionGeneration&&(t.quote?.operationId??null)===M.operationId&&(t.operation?.operationId??t.quote?.operationId??null)===M.operationId){let o=M.operationId===null&&t.selectionGeneration===0&&!t.quote&&!t.operation&&!t.purchaseRequestId,g=cn({quote:t.quote,operation:t.operation,requestId:t.purchaseRequestId,pending:!1,destroyed:!1,canReselect:t.canReselect});(o||t.canReselect===!0&&g.type==="native")&&(M.acknowledged=!0)}}let Ee=null,Ue=new Set,ce={},De=!1,Y=(e,t=null)=>{l||(e instanceof ne&&e.status===409&&e.reason==="STATE_CHANGED"&&e.recovery==="recover_operation"&&sn.destroy(),Ee=t,De=!1,W.textContent=Un(e,R),W.hidden=!1,j.hidden=n.client.pendingCommand===null,be(),Ie(n.onError,e))},re=An({client:n.client,document:u,conceal(){l||(pe(),A?.finish("dismissed"),r.hidden=!0,s||(s=!0,P()))},async receive(e){l||await se(n.client.view??e.run)},failed(e){if(!l){if(!re.pending){ue=!1;let t=n.client.view;t&&se(t).then(()=>Y(e),Y);return}Ye(),r.parentElement!==i&&i.append(r),r.hidden=!1,S.hidden=N.hidden=y.hidden=!0,Q.textContent="",Me(),Y(e,n.client.pendingCommand?.requestId??null)}}}),In=()=>{l||(Ee=null,W.textContent=Vn(R),W.hidden=!1,j.hidden=!0,be())};function ke(){let e=n.client.view;if(!e)throw new ne("INVALID_REQUEST","No current Run is available");return{requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:e.revision}}let w=Qn({client:n.client,doc:u,holder:O,reviewHolder:de,mountScreenPreview:H,loadingOptions:n,get chrome(){return z},get stopped(){return l},get answers(){return ce},suspend(e){I?.setSuspended(e)},resetScreen(){we="",ee="",xe=""},enqueue:se,fail:Y}),$e=Bn({client:n.client,expected:ke,fail:Y,get stopped(){return l},get reviewing(){return w.active},get key(){return we},get busy(){return X},get staleRead(){return rn}}),We=Gn({client:n.client,expected:ke,perform:Se,onIntent:n.onCustomerDataIntent,get stopped(){return l},get busy(){return X},get document(){return ae?.document},get answers(){return ce}}),je=e=>`${e.id}:${e.nodeId}:${e.visit}`,Oe=e=>e&&(e.screen||e.paywall)?je(e):"";function ye(){let e=n.client.view;S.disabled=!w.active&&(X>0||!!n.client.pendingCommand||!e?.canBack||e.stopped||!["running","waiting"].includes(e.status)||!Oe(e)||ee!==Oe(e)),S.hidden=!w.active&&!e?.canBack,fn(S);let t=!!I&&!w.active;y.hidden=t&&!A?.active||ge&&!w.active,N.hidden=!n.client.review||!w.active&&!e?.canBack;let o=e?.locale.startsWith("zh");Q.textContent=t?"":X>0||e?.pendingRequest?o?"正在处理":"Processing":e?.instruction?.type==="wait"?o?"等待中":"Waiting":"",be()}async function Cn(e){if(!e)return;let t=n.client.view;await e;let o=n.client.view;if(!t||!o||o.id!==t.id||o.nodeId!==t.nodeId||o.visit!==t.visit||o.stopped||!["running","waiting"].includes(o.status))throw new ne("PRECONDITION_FAILED","The screen changed while its display was acknowledged")}async function Se(e,t=!1,o){if(!((X||ue||ie||V)&&!t||l||w.active&&!t)){X++,r.setAttribute("aria-busy","true"),W.hidden=!0,Ee=null,De=!1,ye();try{if(t||await Cn($e.inFlight),l)return;let g=await e();l||await se(n.client.view??g.run)}catch(g){o?.(g)&&n.client.pendingCommand===null?In():re.pending||Y(g,n.client.pendingCommand?.requestId??null)}finally{X=Math.max(0,X-1),r.setAttribute("aria-busy",String(X>0)),l||(j.hidden=n.client.pendingCommand===null,ye())}}}function qe(){sn.schedule()}async function ln(){if(!(l||Je||X)&&!re.pending){if(w.active){await w.open(w.receipt);return}Je=!0;try{let e=n.client.pendingCommand;e&&n.client.settle&&await n.client.settle(e.requestId);let t=n.client.view,o=We.queries,g=await n.client.get(t?.screen&&Object.keys(o).length?{nodeId:t.nodeId,visit:t.visit,revision:t.revision,components:o}:void 0);De&&!l&&(De=!1,W.hidden=!0,be()),!l&&o===We.queries&&await se(n.client.view??g.run)}catch(e){Y(e),De=!l}finally{Je=!1}}}function Xe(e,t,o){if(A?.active){let Z=A;return Z.setDismissHandler(()=>bn(Z)),Z}let g=en(i,n,"funnel",()=>bn(g),Nn);return A=g,g.start(e,t,o),g}function bn(e){l||te||(te=!0,e.finish("dismissed"),pe(),r.hidden=!0,n.client.view?ve().finally(J):J())}function dn(){clearTimeout(Ge?.timeout),Ge=void 0}function pe(e){ge=!1,dn(),Te?.abort(),Te=void 0,ae?.destroy(),ae=null,I?.destroy(),I=null,Ne=void 0,_e?.(),_e=void 0,F.open&&F.close();for(let t of Array.from(O.children))(!e||!t.contains(e))&&t.remove();O.style.cssText="",Ce=void 0,we="",ee="",Pe=!1,xe="",ze=""}function Pn(){let e=u.defaultView;v?.responsive&&e&&ae?.resizeViewport?.(e.innerHeight,e.innerWidth)}function Ye(){v?.destroy(),v=void 0,he=""}function Ze(e){let t=e.screen?.presentation;if(!t||t.type==="inline"){F.open&&F.close(),Ye(),y.parentElement!==T&&T.append(y),r.parentElement!==i&&i.append(r);for(let Z of["flex","display","flex-direction","justify-content"])O.style.removeProperty(Z);Me(e),be();return}r.parentElement!==F&&(F.append(y,r),i.append(F)),O.style.flex="1 0 auto",O.style.display="flex",O.style.flexDirection="column",O.style.justifyContent="center",Me(e);let o=e.screen.content.document,g=JSON.stringify([t,K]);if(g!==he){Ye(),he=g;let Z={sm:420,md:640,lg:900},fe="size"in t&&!t.backdrop?",0 0 0 100vmax #16142566":"";F.style.cssText=`box-sizing:border-box;padding:0;border:0;overflow:auto;background:${me.background};color:${me.text};`+(t.type==="fullscreen"?"width:100vw;height:100dvh;max-width:100vw;max-height:100dvh;margin:0;border-radius:0":`width:${Z[t.size]}px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);box-shadow:0 24px 80px #0003${fe};`+(t.type==="sheet"?"margin:auto auto 0;border-radius:14px 14px 0 0":"border-radius:14px")),v=On(F,{presentation:t,theme:o.theme,pages:o.pages},Pn),v.latch()}be(),F.setAttribute("aria-label",(Ae?.screen===e.screen?.content.document.name?Ae?.label:void 0)??ae?.document?.name??e.screen?.content.document.name??"Funnel")}async function Wn(e){if(l||te)return;if(re.observe(),re.pending){le=e;return}if(ue&&(Qe()||["running","waiting"].includes(e.status))||(le=e,Ee&&n.client.pendingCommand?.requestId!==Ee&&(W.hidden=!0,Ee=null),R=e.locale.startsWith("zh"),N.textContent=R?"回看":"History",S.textContent=w.active?R?"返回当前":"Return to current":R?"返回":"Back",yn(),j.textContent=R?"重试":"Retry",j.hidden=n.client.pendingCommand===null,ye(),vn!==`${e.revision}:${e.visit}:${e.status}:${e.stopped}`&&(vn=`${e.revision}:${e.visit}:${e.status}:${e.stopped}`,Ie(n.onState,structuredClone(e))),l||te))return;if((!e.pendingRequest||ue&&e.status==="closed")&&["closed","ineligible","failed"].includes(e.status)){J();return}if(e.stopped&&D()){J();return}if(e.stopped||n.client.configurationReady===!1){w.stop(),$(),pe(),A?.finish("skipped"),r.hidden=!0,qe();return}if(r.hidden=!1,w.active){qe();return}if(e.status==="completed"&&I?.subscriptionUpgradeActive){qe();return}let t=Oe(e),o=n.client.view;if(o&&o.revision>e.revision&&Oe(o)!==t)return;let g=!e.instruction&&!e.pendingRequest&&e.nodeType==="screen"&&["running","waiting"].includes(e.status);t!==we&&(we&&A?.finish("dismissed"),pe(),we=t,ce={...e.answers},We.reset());let Z=je(e);if(Be===Z){r.hidden=!0;return}if(g&&!t){r.hidden=!0;let C=n.prepared?.state==="shown"?null:Xe(!0,e.locale);!l&&!te&&Ge?.key!==Z&&(dn(),Ge={key:Z,timeout:setTimeout(()=>{let d=n.client.view;if(l||!C?.active&&n.prepared?.state!=="shown"||!d||je(d)!==Z)return;Be=Z;let q=new Error("Funnel screen preparation timed out");C?.finish("error",q),$(),pe(),Y(q)},Le)}),qe();return}dn();let _=C=>{let d=n.client.view;return!l&&!te&&!Re&&!C.aborted&&n.client.configurationReady!==!1&&!!d&&!d.stopped&&!["closed","ineligible","failed"].includes(d.status)&&(Oe(d)===t||d.status==="completed"&&I?.subscriptionUpgradeActive===!0)},fe=(C,d)=>{_(d)&&(Be=t,A?.finish("error",C),pe(),r.hidden=!0,Y(C))};if(t||((e.instruction&&e.instruction.type!=="evaluate_segment"||!["running","waiting"].includes(e.status))&&$(),Ze(e),e.instruction?.type!=="event"&&e.instruction?.type!=="open_url"&&A?.finish("skipped")),e.screen){$();let C=e.screen.content;if(!ae){let B=e.screen.presentation.type!=="inline",b=Xe(B,e.locale);if(l||te)return;let x=(Te=new AbortController).signal;Ze(e),_e=B?Ln(F):nn(r,i),ae=H(O,{mode:"live",closeActions:Array.from(new Set([...n.closeActions??[],...C.document.actions.filter(h=>h.type==="event"&&h.close).map(h=>h.id)])),onAuthoredClose(h){_(x)&&(ge=h,ye())},rendererUrl:n.client.webViewUrl,title:C.document.name,...B?{hostPresentation:()=>v?.type??e.screen.presentation.type}:{},onResize:h=>{Ce=h,v?.responsive&&v.setContentHeight(h+T.getBoundingClientRect().height)},onAction(h,c={},Fe={}){if(w.active||!_(x)||ee!==t)return;ce={...ce,...Fe};let un=e.screen?.inputs??[],kn=Object.fromEntries(un.filter(({variable:He})=>Object.hasOwn(ce,He)).map(({variable:He})=>[He,ce[He]]));if(Mn(un,kn).length){In();return}Se(()=>n.client.submit({operation:"submit",...ke(),input:{type:"screen",output:h,answers:kn,selection:c}}),!1,He=>$n(He,un))},onAnswers:h=>{w.active||!_(x)||ee!==t||(ce={...ce,...h})},onCustomerDataIntent:h=>{w.active||!_(x)||ee!==t||We.intent(h).catch(Y)},onEscape:()=>{!_(x)||ee!==t||w.active||ie||V||ve()},onError:h=>{let c=new Error(h);ee===t?Y(c):fe(c,x)},onRendered:h=>{if(!(!_(x)||ee===t))try{b.present(c=>{_e?.(),_e=void 0,h&&(Ae={screen:C.document.name,label:h},F.setAttribute("aria-label",h)),B&&(F.showModal(),s=!1,v?.responsive&&F.focus({preventScroll:!0}),!c&&n.loading!=="host"&&Sn(F,v?.type??e.screen.presentation.type,v?.responsive)),ee=t,Pe=B,ye()}),_(x)&&$e.report(t)}catch(c){fe(c,x)}}}),Pn()}let d={capabilities:e.screen.capabilities,customerData:e.screen.customerData,parameters:e.parameters,serverInput:{bindings:e.screen.inputs,answers:ce,values:e.screen.values}},q=JSON.stringify([C,e.locale,d.parameters,e.screen.inputs,e.screen.values]);if(q!==xe)ae.update(C.document,e.locale,d),xe=q,tn=JSON.stringify(d.capabilities),ze=JSON.stringify(d.customerData);else{let B=JSON.stringify(d.capabilities);B!==tn&&(ae.updateCapabilities(d.capabilities),tn=B),JSON.stringify(d.customerData)!==ze&&(ae.updateCustomerData(d.customerData),ze=JSON.stringify(d.customerData))}let G=ae;if(G)try{await(A?.wait(G.ready)??G.ready)}catch(B){Te&&fe(B,Te.signal)}}else if(e.paywall&&!I){let C=e.paywall.resolution,d="document"in C?C.document:null,q=p,G=n.mountPaywallControls,B=null,b=(Te=new AbortController).signal,x={loading:"host",signal:b,...G&&{mountControls:c=>G(c,e)},canInteract:()=>_(b)&&!w.active&&!ie&&!V,beforeAction:async()=>{X++;try{await Cn($e.settled()),W.hidden=!0,Ee=null,De=!1,be()}finally{X=Math.max(0,X-1)}},start:()=>mn(n.client),onObservationChange:qe,onPurchase:n.onPurchase,onCheckoutUrl:n.onCheckoutUrl,resumeCheckout:n.resumeCheckout,allowNewPurchase:n.allowNewPurchase,checkoutNavigation:n.checkoutNavigation,terminateCheckout:n.terminateCheckout,beforeCheckoutReplacement:n.beforeCheckoutReplacement,purchaseConfirmation:n.purchaseConfirmation,confirmOnHostedCheckout:n.confirmOnHostedCheckout,resolveOfferId:n.resolveOfferId,resolveSubscriptionChange:n.resolveSubscriptionChange,claimCoupon:n.claimCoupon,onEvent:n.onEvent,onOpenUrl:c=>n.onOpenUrl?n.onOpenUrl({receiptId:e.paywall.receiptId,url:c,openIn:"same_window"}):u.defaultView?.location.assign(c),onAction:async c=>{if(w.active)return;let Fe=await n.client.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:n.client.view?.revision??e.revision,input:{type:"screen",output:c,answers:{}}});await se(n.client.view??Fe.run)},onError:c=>{ee===t?Y(c):fe(c,b)}},h={quoteError:c=>Ie(n.onError,c),loadingLayout:()=>_(b)?B?.getLoadingLayout?.():void 0,present(c){_(b)&&(B?.present(Fe=>{c(Fe),ee=t,Pe=!!O.querySelector("dialog[open]"),Pe&&(s=!1),ye()}),_(b)&&$e.report(t))},async closeAction(c){l||w.active||await re.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:n.client.view?.revision??e.revision,input:{type:"screen",output:c,answers:{}}})},async dismiss(){if(l||b.aborted||w.active||ie||V||!ue&&!_(b))return;ue=!0;let c=n.client.view;if(c?.status==="completed"&&I?.subscriptionUpgradeActive){Ue.add(`complete:${c.id}`),Ie(n.onComplete,structuredClone(c)),J();return}if((n.resumeCheckout||n.terminateCheckout)&&Zn()){le=n.client.view,J();return}await ve()}};if(q&&G)$();else if(q){let c=await q.adopt(e,{options:x,handoff:h,start:()=>mn(n.client)});c&&_(b)&&!l?(Ze(e),I=c,Ne={runId:e.id,receiptId:e.paywall.receiptId},A?.active&&A.present(()=>{}),ee=t,Pe=q.modal,Pe&&(s=!1),ye(),$e.report(t),w.active&&I.setSuspended(!0)):(c?.destroy(),$())}if(l||te)return;if(!I){if(B=Xe(!0,e.locale,d),l||te)return;Ze(e);let c=await L(O,x,h).catch(Fe=>(fe(Fe,b),null));!_(b)&&!(ue&&!l&&!b.aborted)?c?.host?.destroy():c&&(I=c.host,I&&(Ne={runId:e.id,receiptId:e.paywall.receiptId}),I?.setSuspended(w.active))}}if(l||te)return;ye();let m=e.instruction;if(m&&(m.type==="open_url"||m.type==="event")&&!Ue.has(m.receiptId)){let C=u.createElement("button");C.type="button",C.style.cssText=z.primary,Ve(C,()=>z.focus),O.style.cssText=z.stage,C.textContent=m.type==="open_url"?`${R?"前往":"Continue to"} ${new URL(m.url).host}`:R?"继续":"Continue",C.onclick=()=>{let d=ke(),q=m.type==="open_url"&&!n.onOpenUrl&&m.openIn==="new_window"?jn(m.url):null;Se(async()=>{let G="success";if(m.type==="open_url")if(n.onOpenUrl)try{G=await n.onOpenUrl({receiptId:m.receiptId,url:m.url,openIn:m.openIn})===!1?"failed":"opened"}catch(b){Ie(n.onError,b),G="failed"}else G=m.openIn==="new_window"&&!q?"failed":"opened";if(m.type==="event"){if(!n.onEvent)throw new ne("EVENT_HANDLER_REQUIRED","Provide the event handler");await n.onEvent(m.event)}if(l||n.client.view?.nodeId!==d.nodeId||n.client.view.visit!==d.visit)throw new ne("PRECONDITION_FAILED","The client action visit changed");let B=await n.client.submit({operation:"submit",...d,input:{type:"client_action",receiptId:m.receiptId,outcome:G}});return Ue.add(m.receiptId),m.type==="open_url"&&!n.onOpenUrl&&m.openIn==="same_window"&&u.defaultView?.location.assign(m.url),B})},A?.active?A.present(()=>O.replaceChildren(C)):O.replaceChildren(C)}!e.pendingRequest&&e.status==="completed"&&!Ue.has(`complete:${e.id}`)&&(Ue.add(`complete:${e.id}`),Ie(n.onComplete,structuredClone(e))),qe()}function jn(e){let t=u.defaultView?.open(e,"_blank")??null;return t&&(t.opener=null),t}function se(e){return ye(),on=on.catch(()=>{}).then(async()=>{try{await Wn(e)}catch(t){throw A?.active&&(Be=je(e),A.finish("error",t),pe(),r.hidden=!0),t}}),on}let Xn=n.client.subscribe(e=>{if(!gn){if(e.stopped&&(Pe||D())&&!ue){le=e,J();return}!ue&&(e.stopped||n.client.configurationReady===!1||we&&ee!==we&&(Oe(e)!==we||["closed","ineligible","failed"].includes(e.status)))&&(pe(),A?.finish("dismissed"),r.hidden=!0),se(e).catch(Y)}}),Yn=n.client.subscribeError?.(e=>{re.pending||Y(e)});function Zn(){let e=n.client.view,t=e?.paywall;return!!t?.operation&&!!e&&["running","waiting"].includes(e.status)&&Tn(cn({quote:t.quote,operation:t.operation,requestId:t.purchaseRequestId,pending:!1,destroyed:!1,canReselect:t.canReselect}))}function ve(e){if(Re)return Re;if(l||!e&&(ie||V))return Promise.resolve();let t=!e&&Qe();return!t&&n.client.view&&!["running","waiting"].includes(n.client.view.status)?(le=n.client.view,J(),Promise.resolve()):(Re=Se(async()=>{let o=t?await n.client.retry():await(e?n.client.submit.bind(n.client):re.submit)({operation:"close",...e??ke()});return e&&hn(o),o},!0).then(()=>{let o=n.client.view;o?.status==="closed"&&!Qe()&&(le=o,J())}).finally(()=>{Re=null}),Re)}function J(){Rn()}function Rn(e){oe?.destroy(),!l&&(l=!0,re.destroy(),k(),$(),n.signal?.removeEventListener("abort",J),a?.removeEventListener("abort",J),A?.finish("dismissed"),sn.destroy(),Xn(),Yn?.(),pe(e),Ye(),w.stop(),F.remove(),!e||!r.contains(e)?r.remove():(T.remove(),de.remove()),!e&&!s&&P(),Ie(n.onDismiss,le?structuredClone(le):null))}S.onclick=()=>{if(!S.disabled){if(w.active){w.exit();return}Se(()=>n.client.submit({operation:"back",...ke()}))}},N.onclick=()=>{w.open()},y.onclick=()=>{A?.active?A.dismiss():ie||ve()},j.onclick=()=>{re.pending?re.retry().catch(()=>{}):Qe()?ve():Se(()=>n.client.retry())},F.addEventListener("cancel",e=>{e.preventDefault(),A?.active?A.dismiss():ie||ve()}),n.signal?.addEventListener("abort",J,{once:!0}),a?.addEventListener("abort",J,{once:!0});let Ke=!1;p&&(k=p.onClose(()=>{l||te||(te=!0,A?.finish("dismissed"),pe(),r.hidden=!0,n.client.view?ve().finally(J):Ke=!0)}));let En={destroy:J,refresh:ln,get recoveryPaywall(){if(I&&Ne)return{...Ne,view:I.currentResolution}},setPurchaseRecovery(e,t){return I?.setPurchaseRecovery(e,t),I!==null},retainPurchaseDialog(){let e=I?.retainPurchaseDialog();if(e)return I=null,Rn(e.dialog),{dialog:e.dialog,release(){e.release(),r.remove(),s||P()}}},get recovery(){let e=an();if(e)return e;if(!l&&!X&&!ue&&!ie&&I){let t=I.recovery;if(t.type!=="native")return t}return{type:"recover",operationId:n.client.pendingPurchase?.operationId??n.client.view?.paywall?.quote?.operationId??V?.operationId??null,requestId:n.client.pendingCommand?.requestId??null}},prepareFallback(){if(ie)return ie;let e=an();if(e)return Promise.resolve(e);let t=n.client.pendingPurchase?.operationId??n.client.view?.paywall?.quote?.operationId??V?.operationId??null,o=()=>({type:"recover",operationId:t,requestId:n.client.pendingCommand?.requestId??null});if(n.client.hasDurableJournal!==!0){let m=I?.recovery;return Promise.resolve(m&&m.type!=="native"&&m.type!=="cancel"?m:o())}let g=(n.client.pendingCommands??(n.client.pendingCommand?[n.client.pendingCommand]:[])).some(m=>m.operation==="close");if(l&&!(g||V&&n.client.view?.status==="closed")||X||Je||Re||w.active||!I&&!V&&!g)return Promise.resolve(o());let Z=I,_=(async()=>{try{if(!V&&g){let d=await n.client.retry();return await se(n.client.view??d.run),o()}if(!V){let d=await Z.prepareFallback();if(d.type!=="native")return d;if(n.client.hasDurableJournal!==!0)return o();V=d}let m=n.client.pendingCommands??(n.client.pendingCommand?[n.client.pendingCommand]:[]);if(m.length){let d=m.find(G=>G.operation==="close");if(!d||!M||d.requestId!==M.requestId)return o();let q=await n.client.retry();hn(q),await se(n.client.view??q.run)}else{let d=n.client.view,q=d?.paywall;if(!d||!q||q.selectionGeneration===void 0||(q.quote?.operationId??null)!==V.operationId||V.operationId!==null&&q.canReselect!==!0)return o();let G=q.selectionGeneration,B=await n.client.get();await se(n.client.view??B.run);let b=n.client.view,x=b?.paywall;if(!b||!x||!["running","waiting"].includes(b.status)||b.stopped||b.id!==d.id||b.nodeId!==d.nodeId||b.visit!==d.visit||x.receiptId!==q.receiptId||x.selectionGeneration!==G||(x.quote?.operationId??null)!==V.operationId||V.operationId!==null&&x.canReselect!==!0||n.client.pendingPurchase||(n.client.pendingCommands?.length??(n.client.pendingCommand?1:0)))return o();let h=ke();M={runId:b.id,operationId:V.operationId,revision:h.revision,requestId:h.requestId,nodeId:b.nodeId,visit:b.visit,receiptId:x.receiptId,selectionGeneration:G,acknowledged:!1},await ve(h)}let C=an();return C?(J(),C):o()}catch(m){return Y(m),o()}})();ie=_;let fe=()=>{ie===_&&(ie=null)};return _.then(fe,fe),_},review:w.open,exitReview:w.exit,get unappliedDrafts(){return w.drafts}};try{let e=n.client.view;if(e)((n.client.viewAgeMs??wn)>=wn||e.instruction?.type==="evaluate_segment")&&(rn=ln().finally(()=>{rn=null})),await se(e);else{if(r.hidden=!0,l)throw new DOMException("Presentation cancelled","AbortError");let t=Ke||n.prepared?.state==="shown"?null:Xe(n.client.view?.screen?.presentation.type!=="inline",n.client.view?.locale);if(l||te&&!Ke)throw new DOMException("Presentation cancelled","AbortError");let o=n.client.get(),g=await(t?t.wait(o,Le):et(o,Le));if(gn=!1,Ke)return l||await ve().finally(J),En;await se(n.client.view??g.run)}}catch(e){throw A?.finish("error",e),J(),e}return En}function et(i,E){let U;return Promise.race([i,new Promise((n,p)=>{U=setTimeout(()=>p(new Error("Presentation data timed out")),E)})]).finally(()=>clearTimeout(U))}function Dt(i,E,U){return Kn(i,E,U)}export{Kn as a,Dt as b};
@@ -1 +1 @@
1
- import{e as p}from"./chunk-KXSZTBAG.js";import{c as g}from"./chunk-K644WUOE.js";import{b as B}from"./chunk-S4YBFFFY.js";import{b as F}from"./chunk-AN7CPDBU.js";import{a as $}from"./chunk-UCDQJB53.js";import{e as Y,f as X,g as Z,h as ee,i as re}from"./chunk-RUMGXXVJ.js";import{b as j}from"./chunk-CBOIDISB.js";import{A as x,B as R,E as K,z as J}from"./chunk-TSBXPDUQ.js";import{x as G}from"./chunk-KVIGHX2B.js";import{b as W}from"./chunk-7LHRBNSH.js";import{a as M}from"./chunk-FAMPOY6L.js";import{t as H}from"./chunk-POX2ELNS.js";import{a}from"./chunk-BYHBBZIO.js";import{a as z}from"./chunk-DSPLGTQI.js";function ae(I){let t=[...new Set(I.map(({path:s})=>{let c=s.map(String).join(".");return c.startsWith("selector")?"paywallId or paywallVersionId":c||"input"}))],O=t.includes("locale")?` Pass locale, the Customer's language such as "en" or "zh-CN".`:"";return new a("INVALID_REQUEST",`createPaywallSession input is invalid: ${t.join(", ")}.${O}`)}async function Ie(I,t){if(!M.test(t.customerToken))throw new a("INVALID_TOKEN","A verified Customer credential is required");if(I.session&&I.session.peek()!==t.customerToken)throw new a("SCOPE_MISMATCH","Paywall credential does not match the shared session");let O=p.resolvePaywall.request.safeParse({funnelId:t.funnelId,funnelVersionId:t.funnelVersionId,selector:t.paywallVersionId?{type:"version",versionId:t.paywallVersionId}:{type:"paywall",paywallId:t.paywallId},commerce:t.commerce,locale:t.locale,...t.requirement?{requirement:t.requirement}:{}});if(!O.success)throw ae(O.error.issues);let s=O.data,c=W(I);I.session||c.identify(t.customerToken);let n=null,v=!1,U=new AbortController,u=null,d=null,b=null,P=null,T=null,y=null,m=null,A=0,q=null,k="",D=0,C=new Map,E=new Set;function S(){if(v)throw new a("IDENTITY_CHANGED","Paywall is closed")}function L(){let e=JSON.stringify([A,m!==null]);if(!q||e!==k){k=e;let r=te(++D);q=r;let i=()=>{q===r&&(q=null)};r.then(i,i)}return q.then(r=>structuredClone(r))}async function te(e){S();let r=p.resolvePaywall,i=await g(c.request,r,{...s,selector:n?{type:"version",versionId:n.id}:s.selector});B(s,i.paywall.check,i.scope);let l=await F(I,i.paywall);if(S(),t.paywallVersionId?l.id!==t.paywallVersionId:l.paywallId!==t.paywallId)throw new a("INVALID_RESPONSE","The requested Paywall changed");if(n&&(!Y(l,n)||l.paywallId!==n.paywallId))throw new a("INVALID_RESPONSE","The pinned Paywall or Offering Version changed");if(e!==D)return structuredClone(n??l);n=l;for(let h of E)z(h,structuredClone(n));return structuredClone(n)}async function Q(e){if(S(),P&&e!=="read")throw new a("COMMAND_PENDING","Wait for the original quote");if(!u)throw new a("INVALID_REQUEST","A quoted purchase is required");let r=u;if(e!=="read"){if(m){if(y===e)return m;throw new a("COMMAND_PENDING","Wait for the original purchase command")}if(y&&y!==e)throw new a("COMMAND_PENDING","Read the original purchase before changing an uncertain command");y=e,A++,D++}let i=y,l=A,h=e==="read"&&m===null,f=JSON.stringify([r.operationId,l,m!==null]);if(e==="read"&&C.has(f))return C.get(f).then(o=>structuredClone(o));let w=(async()=>{let o={operationId:r.operationId,...e==="read"?{}:{intent:e},...e==="confirm"&&r.merchantTerms?{merchantConfirmation:G(r.merchantTerms)}:{}},V=R(r)?e==="read"?await g(c.request,p.readSubscriptionUpdate,o):await g(c.request,p.update,o):e==="read"?await g(c.request,p.readSubscriptionOperation,o):await g(c.request,p.attach,o),N=x.parse(V.operation);return N.quote&&ee(r,N.quote),X(N,{operationId:r.operationId,currency:s.commerce.currency,membershipId:R(r)?r.membershipId:null,...R(r)?{featureQuantities:r.featureQuantities??{}}:{}},"The purchase operation changed"),S(),u?.operationId!==r.operationId?structuredClone(N):(d=re(d,N),(e!=="read"||h&&m===null)&&A===l&&y===i&&(y=null),structuredClone(d))})();if(e!=="read"){m=w;let o=()=>{m===w&&(m=null)};w.then(o,o)}else{C.set(f,w);let o=()=>{C.get(f)===w&&C.delete(f)};w.then(o,o)}return w.then(o=>structuredClone(o))}let _={signal:U.signal,get view(){return n?structuredClone(n):null},get quote(){return u?structuredClone(u):null},get operation(){return d?structuredClone(d):null},get webViewUrl(){return"bundled"},get locale(){return s.locale},get recovery(){return $({quote:u,operation:d,requestId:T,pending:P!==null||y!==null,destroyed:v})},get pendingCancellation(){return!v&&y==="cancel"},refresh:L,subscribe(e){return v?()=>{}:(E.add(e),()=>E.delete(e))},async preview(e){if(S(),!n)throw new a("INVALID_REQUEST","Load the Paywall first");let r=n.document.buttons[e.actionId];if(r?.type!=="checkout")throw new a("INVALID_REQUEST","Choose an authored purchase action");let i=j(r.product,e.selection,n.capabilities);if(!i)throw new a("PRODUCT_UNAVAILABLE","Choose an available Product");let l=H(n.document.screen,i,e.selection,n.capabilities);if(s.commerce.intent==="subscription_change"&&!e.subscriptionChange)throw new a("INVALID_REQUEST","Choose the existing membership for this subscription change");if(e.subscriptionChange&&e.nativeOffer)throw new a("INVALID_REQUEST","A web membership change cannot include a store offer");let h=e.subscriptionChange?p.previewUpdate.request.parse({requestId:e.requestId,...e.subscriptionChange,change:{type:"plan",productVersionId:i,...Object.keys(l).length?{featureQuantities:l}:{}},...e.offerId?{offerId:e.offerId}:{}}):p.previewAttach.request.parse({funnelId:s.funnelId,funnelVersionId:s.funnelVersionId,requestId:e.requestId,plans:[{productVersionId:i,...Object.keys(l).length?{featureQuantities:l}:{}}],provider:s.commerce.provider,currency:s.commerce.currency,...e.offerId?{offerId:e.offerId}:{},...e.nativeOffer?{nativeOffer:e.nativeOffer}:{}}),f=JSON.stringify(h);if(b&&b!==f&&(P||y||!d||K(d)))throw new a("COMMAND_PENDING","Finish or cancel the original purchase before changing it");if(b===f){if(P)return P;if(u)return structuredClone(u)}b!==f&&(u=null,d=null),b=f,T=h.requestId;let w=(async()=>{let o="membershipId"in h?await g(c.request,p.previewUpdate,h):await g(c.request,p.previewAttach,h),V=J.parse(o.quote);return S(),Z(V,{productVersionId:i,featureQuantities:l,currency:s.commerce.currency,provider:s.commerce.provider,subscriptionChange:e.subscriptionChange},"The purchase quote changed its selected Product or presentment"),u=V,d=null,structuredClone(u)})();P=w;try{return await w}finally{P===w&&(P=null)}},confirm:()=>Q("confirm"),cancel:()=>Q("cancel"),read:()=>Q("read"),destroy(){v||(v=!0,U.abort(),E.clear(),C.clear(),ne?.(),c.dispose(),n=null,u=null,d=null,b=null,T=null)}},ne=I.session?.subscribeIdentity(_.destroy);try{return await L(),_}catch(e){throw _.destroy(),e}}export{Ie as a};
1
+ import{e as p}from"./chunk-JXWZS4UM.js";import{c as g}from"./chunk-CAE4KIZN.js";import{b as B}from"./chunk-XHZH3E4G.js";import{b as F}from"./chunk-LFMAFY3P.js";import{a as $}from"./chunk-ADTZEBQF.js";import{e as Y,f as X,g as Z,h as ee,i as re}from"./chunk-OV46DXRX.js";import{b as j}from"./chunk-M4P6TGBU.js";import{A as x,B as R,E as K,z as J}from"./chunk-GGZG56GR.js";import{x as G}from"./chunk-NL7AXMUA.js";import{b as W}from"./chunk-TS26DZNO.js";import{a as M}from"./chunk-L64BS65O.js";import{t as H}from"./chunk-QGKROSRD.js";import{a}from"./chunk-WE55LJEN.js";import{a as z}from"./chunk-DSPLGTQI.js";function ae(I){let t=[...new Set(I.map(({path:s})=>{let c=s.map(String).join(".");return c.startsWith("selector")?"paywallId or paywallVersionId":c||"input"}))],O=t.includes("locale")?` Pass locale, the Customer's language such as "en" or "zh-CN".`:"";return new a("INVALID_REQUEST",`createPaywallSession input is invalid: ${t.join(", ")}.${O}`)}async function Ie(I,t){if(!M.test(t.customerToken))throw new a("INVALID_TOKEN","A verified Customer credential is required");if(I.session&&I.session.peek()!==t.customerToken)throw new a("SCOPE_MISMATCH","Paywall credential does not match the shared session");let O=p.resolvePaywall.request.safeParse({funnelId:t.funnelId,funnelVersionId:t.funnelVersionId,selector:t.paywallVersionId?{type:"version",versionId:t.paywallVersionId}:{type:"paywall",paywallId:t.paywallId},commerce:t.commerce,locale:t.locale,...t.requirement?{requirement:t.requirement}:{}});if(!O.success)throw ae(O.error.issues);let s=O.data,c=W(I);I.session||c.identify(t.customerToken);let n=null,v=!1,U=new AbortController,u=null,d=null,b=null,P=null,T=null,y=null,m=null,A=0,q=null,k="",D=0,C=new Map,E=new Set;function S(){if(v)throw new a("IDENTITY_CHANGED","Paywall is closed")}function L(){let e=JSON.stringify([A,m!==null]);if(!q||e!==k){k=e;let r=te(++D);q=r;let i=()=>{q===r&&(q=null)};r.then(i,i)}return q.then(r=>structuredClone(r))}async function te(e){S();let r=p.resolvePaywall,i=await g(c.request,r,{...s,selector:n?{type:"version",versionId:n.id}:s.selector});B(s,i.paywall.check,i.scope);let l=await F(I,i.paywall);if(S(),t.paywallVersionId?l.id!==t.paywallVersionId:l.paywallId!==t.paywallId)throw new a("INVALID_RESPONSE","The requested Paywall changed");if(n&&(!Y(l,n)||l.paywallId!==n.paywallId))throw new a("INVALID_RESPONSE","The pinned Paywall or Offering Version changed");if(e!==D)return structuredClone(n??l);n=l;for(let h of E)z(h,structuredClone(n));return structuredClone(n)}async function Q(e){if(S(),P&&e!=="read")throw new a("COMMAND_PENDING","Wait for the original quote");if(!u)throw new a("INVALID_REQUEST","A quoted purchase is required");let r=u;if(e!=="read"){if(m){if(y===e)return m;throw new a("COMMAND_PENDING","Wait for the original purchase command")}if(y&&y!==e)throw new a("COMMAND_PENDING","Read the original purchase before changing an uncertain command");y=e,A++,D++}let i=y,l=A,h=e==="read"&&m===null,f=JSON.stringify([r.operationId,l,m!==null]);if(e==="read"&&C.has(f))return C.get(f).then(o=>structuredClone(o));let w=(async()=>{let o={operationId:r.operationId,...e==="read"?{}:{intent:e},...e==="confirm"&&r.merchantTerms?{merchantConfirmation:G(r.merchantTerms)}:{}},V=R(r)?e==="read"?await g(c.request,p.readSubscriptionUpdate,o):await g(c.request,p.update,o):e==="read"?await g(c.request,p.readSubscriptionOperation,o):await g(c.request,p.attach,o),N=x.parse(V.operation);return N.quote&&ee(r,N.quote),X(N,{operationId:r.operationId,currency:s.commerce.currency,membershipId:R(r)?r.membershipId:null,...R(r)?{featureQuantities:r.featureQuantities??{}}:{}},"The purchase operation changed"),S(),u?.operationId!==r.operationId?structuredClone(N):(d=re(d,N),(e!=="read"||h&&m===null)&&A===l&&y===i&&(y=null),structuredClone(d))})();if(e!=="read"){m=w;let o=()=>{m===w&&(m=null)};w.then(o,o)}else{C.set(f,w);let o=()=>{C.get(f)===w&&C.delete(f)};w.then(o,o)}return w.then(o=>structuredClone(o))}let _={signal:U.signal,get view(){return n?structuredClone(n):null},get quote(){return u?structuredClone(u):null},get operation(){return d?structuredClone(d):null},get webViewUrl(){return"bundled"},get locale(){return s.locale},get recovery(){return $({quote:u,operation:d,requestId:T,pending:P!==null||y!==null,destroyed:v})},get pendingCancellation(){return!v&&y==="cancel"},refresh:L,subscribe(e){return v?()=>{}:(E.add(e),()=>E.delete(e))},async preview(e){if(S(),!n)throw new a("INVALID_REQUEST","Load the Paywall first");let r=n.document.buttons[e.actionId];if(r?.type!=="checkout")throw new a("INVALID_REQUEST","Choose an authored purchase action");let i=j(r.product,e.selection,n.capabilities);if(!i)throw new a("PRODUCT_UNAVAILABLE","Choose an available Product");let l=H(n.document.screen,i,e.selection,n.capabilities);if(s.commerce.intent==="subscription_change"&&!e.subscriptionChange)throw new a("INVALID_REQUEST","Choose the existing membership for this subscription change");if(e.subscriptionChange&&e.nativeOffer)throw new a("INVALID_REQUEST","A web membership change cannot include a store offer");let h=e.subscriptionChange?p.previewUpdate.request.parse({requestId:e.requestId,...e.subscriptionChange,change:{type:"plan",productVersionId:i,...Object.keys(l).length?{featureQuantities:l}:{}},...e.offerId?{offerId:e.offerId}:{}}):p.previewAttach.request.parse({funnelId:s.funnelId,funnelVersionId:s.funnelVersionId,requestId:e.requestId,plans:[{productVersionId:i,...Object.keys(l).length?{featureQuantities:l}:{}}],provider:s.commerce.provider,currency:s.commerce.currency,...e.offerId?{offerId:e.offerId}:{},...e.nativeOffer?{nativeOffer:e.nativeOffer}:{}}),f=JSON.stringify(h);if(b&&b!==f&&(P||y||!d||K(d)))throw new a("COMMAND_PENDING","Finish or cancel the original purchase before changing it");if(b===f){if(P)return P;if(u)return structuredClone(u)}b!==f&&(u=null,d=null),b=f,T=h.requestId;let w=(async()=>{let o="membershipId"in h?await g(c.request,p.previewUpdate,h):await g(c.request,p.previewAttach,h),V=J.parse(o.quote);return S(),Z(V,{productVersionId:i,featureQuantities:l,currency:s.commerce.currency,provider:s.commerce.provider,subscriptionChange:e.subscriptionChange},"The purchase quote changed its selected Product or presentment"),u=V,d=null,structuredClone(u)})();P=w;try{return await w}finally{P===w&&(P=null)}},confirm:()=>Q("confirm"),cancel:()=>Q("cancel"),read:()=>Q("read"),destroy(){v||(v=!0,U.abort(),E.clear(),C.clear(),ne?.(),c.dispose(),n=null,u=null,d=null,b=null,T=null)}},ne=I.session?.subscribeIdentity(_.destroy);try{return await L(),_}catch(e){throw _.destroy(),e}}export{Ie as a};
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { S as StackNode } from './screen-CJepeiBT.js';
2
+ import { S as StackNode } from './screen-D2bUmJ4M.js';
3
3
 
4
4
  declare const configurationScopeSchema: z.ZodObject<{
5
5
  projectId: z.ZodString;
@@ -1 +1 @@
1
- import{i as ie}from"./chunk-NVHRWZIZ.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-ZNOVEJLM.js";import{b as X}from"./chunk-JRHJO4BR.js";import{r as V}from"./chunk-CJUVMNDB.js";import"./chunk-7UXQJJFZ.js";import"./chunk-2MDJ3JE5.js";import"./chunk-CBOIDISB.js";import"./chunk-TSBXPDUQ.js";import"./chunk-KVIGHX2B.js";import"./chunk-VILB5M4X.js";import"./chunk-7LHRBNSH.js";import"./chunk-FAMPOY6L.js";import{o as Y,p as K}from"./chunk-POX2ELNS.js";import{A as G}from"./chunk-BBA64POP.js";import"./chunk-ZVLZLBDA.js";import"./chunk-XI2NNZBS.js";import{c as $,d as R}from"./chunk-YJRO7NXN.js";import{a as p}from"./chunk-BYHBBZIO.js";import"./chunk-LDLS2VL2.js";import"./chunk-VGEH7B6S.js";import{b as u}from"./chunk-PY3AC5KD.js";import{a as h}from"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.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="×",e.setAttribute("aria-label",t.locale?.startsWith("zh")?"关闭":"Close"),ne(e,r.screen.theme),e.addEventListener("click",v),n.prepend(e)}n&&a?.responsive&&(_=Z(n,v,k,t.locale?.startsWith("zh")?"关闭":"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
+ import{i as ie}from"./chunk-UEKKQHUZ.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-QAGK2SLZ.js";import{b as X}from"./chunk-YMRWDMIL.js";import{r as V}from"./chunk-EACC667P.js";import"./chunk-BX2MSRA4.js";import"./chunk-J4RM5GQP.js";import"./chunk-M4P6TGBU.js";import"./chunk-GGZG56GR.js";import"./chunk-NL7AXMUA.js";import"./chunk-VILB5M4X.js";import"./chunk-TS26DZNO.js";import"./chunk-L64BS65O.js";import{o as Y,p as K}from"./chunk-QGKROSRD.js";import{A as G}from"./chunk-RRZZUIFM.js";import"./chunk-RJT764B2.js";import"./chunk-BKBWGPNR.js";import{c as $,d as R}from"./chunk-NNJVMJUG.js";import{a as p}from"./chunk-WE55LJEN.js";import"./chunk-OZK47BUU.js";import"./chunk-LBDLWHBY.js";import{b as u}from"./chunk-5YBTU4KS.js";import{a as h}from"./chunk-DSPLGTQI.js";import"./chunk-HMJTABQ5.js";import"./chunk-DLRCJF6U.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="×",e.setAttribute("aria-label",t.locale?.startsWith("zh")?"关闭":"Close"),ne(e,r.screen.theme),e.addEventListener("click",v),n.prepend(e)}n&&a?.responsive&&(_=Z(n,v,k,t.locale?.startsWith("zh")?"关闭":"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};
@@ -0,0 +1 @@
1
+ import{b as ne}from"./chunk-ZEU56NVY.js";import{b as j}from"./chunk-S2MSRPR2.js";import"./chunk-C4NXQMSO.js";import"./chunk-JJIP6BZL.js";import"./chunk-R4BYUK7S.js";import{a as re}from"./chunk-OJDO7546.js";import{a as z}from"./chunk-DXLBEXC6.js";import{b as te}from"./chunk-JCI5PGY3.js";import"./chunk-66TY4EFN.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import{i as O,j as V}from"./chunk-QAGK2SLZ.js";import"./chunk-PVMGYRGE.js";import"./chunk-36VNAOG6.js";import"./chunk-MZRDAMFQ.js";import"./chunk-73UFNVEP.js";import"./chunk-CAE4KIZN.js";import"./chunk-LFMAFY3P.js";import"./chunk-6HKQILBV.js";import"./chunk-EACC667P.js";import"./chunk-BX2MSRA4.js";import"./chunk-LOBZ45T3.js";import"./chunk-J4RM5GQP.js";import"./chunk-ADTZEBQF.js";import"./chunk-OV46DXRX.js";import"./chunk-M4P6TGBU.js";import"./chunk-GGZG56GR.js";import"./chunk-NL7AXMUA.js";import"./chunk-VILB5M4X.js";import"./chunk-TS26DZNO.js";import"./chunk-L64BS65O.js";import"./chunk-QGKROSRD.js";import"./chunk-RRZZUIFM.js";import"./chunk-RJT764B2.js";import"./chunk-BKBWGPNR.js";import"./chunk-NNJVMJUG.js";import{a as C}from"./chunk-WE55LJEN.js";import"./chunk-OZK47BUU.js";import"./chunk-SLUA7ABW.js";import"./chunk-R2L227PQ.js";import"./chunk-3VUPVXAV.js";import"./chunk-LBDLWHBY.js";import"./chunk-5YBTU4KS.js";import{a as h}from"./chunk-DSPLGTQI.js";import"./chunk-HMJTABQ5.js";import"./chunk-DLRCJF6U.js";import"./chunk-WOT6VMZA.js";var k=new WeakMap,_=new WeakMap,B=new WeakSet;function he(D,e){let m=e.prepared,J=()=>{m&&!B.has(m)&&j(m)?.release()},K=k.get(e.client);if(K)return J(),K;let Q=n=>({...n,requestId:n.requestId??crypto.randomUUID()}),R=e.allowNewPurchase!==!1&&e.start instanceof Promise?e.start:void 0,w=e.allowNewPurchase===!1||!e.start||e.start instanceof Promise?void 0:Q(e.start);w&&m?.state==="ready"&&m.matches(w)&&m.open();let f=m&&(w&&(m.state==="preparing"||["shown","closed"].includes(m.state)&&m.matches(w))||R&&["preparing","ready"].includes(m.state))?m:void 0;f?B.add(f):J();let y=f&&j(f);y?.claim();let S=Promise.resolve().then(async()=>{let n=!1,c,p=!1,U,g=0,E,q,X=!1,F=()=>{},Y=()=>{},H,L=!1,M=!1,I,Z=!1,a=e.signal?AbortSignal.any([e.signal,e.client.identitySignal]):e.client.identitySignal,v=()=>{k.get(e.client)===S&&k.delete(e.client),a.removeEventListener("abort",A),F(),Y(),f&&B.delete(f),y?.release()};function $(){if(I)return I;let t=new Promise(o=>I=o);return _.set(e.client,t),t.then(()=>{_.get(e.client)===t&&_.delete(e.client)}),k.get(e.client)===S&&k.delete(e.client),I}let l=V(D,e,"funnel",()=>b(),z);function A(){b()}function b(t=!1){if(!n){if(n=!0,l.finish("dismissed"),c){c.destroy();return}if(t&&H){let o=$();Z=!0,H.then(async i=>{i.mode==="run"&&i.status!=="blocked"&&e.client.controller&&e.client.attempt?.requestId===w?.requestId&&await e.client.close()}).catch(()=>{}).finally(()=>{o(),h(e.onDismiss,null)}),v();return}v(),h(e.onDismiss,null)}}let N={destroy:()=>b(),refresh:()=>E??(p?G():c?.refresh())??Promise.resolve(),get recovery(){return c?.recovery??{type:"recover",operationId:null,requestId:null}},prepareFallback:()=>c?.prepareFallback()??Promise.resolve({type:"recover",operationId:null,requestId:null}),review:(...t)=>c?.review(...t)??Promise.resolve(),exitReview:(...t)=>c?.exitReview(...t)??Promise.resolve(),get unappliedDrafts(){return c?.unappliedDrafts??new Map}};a.addEventListener("abort",A,{once:!0}),y&&(Y=y.onClose(()=>{L?n||$():b(!0)}));try{a.throwIfAborted();let t=e.client.controller?.view?.paywall?.resolution,o=t&&"document"in t?t.document:e.loadingDocument;l.start(!0,w?.locale??e.client.attempt?.locale??o?.screen.strings.defaultLocale,o??null);let i=R?l.wait(R.then(r=>r?Q(r):null,()=>null),O):Promise.resolve(w??null);i.catch(()=>{}),f?.state==="shown"?(M=!0,l.present(()=>{})):f&&["preparing","ready"].includes(f.state)&&Promise.all([f.ready,i.catch(()=>null)]).then(([r,s])=>{if(r){if(n||!l.active||!s||!f.matches(s)||!y?.revealable)return y?.release();l.present(()=>{f.open()==="shown"?M=!0:y.release()})}});let d=_.get(e.client);if(d&&await l.wait(d),n)return null;if(a.throwIfAborted(),R){let r=await i;if(n)return null;if(a.throwIfAborted(),!r)return l.finish("skipped"),v(),null;w=r}H=w?e.client.start(w):e.client.refresh();let u=await l.wait(H,O);return n?null:(a.throwIfAborted(),await ee(u,l))}catch(t){if(Z||I?.(),n)return null;throw l.finish("error",t),v(),h(e.onError,t),t}function x(t=!1){g++;let o=c;c=void 0,F(),F=()=>{};let i=t?o?.retainPurchaseDialog?.():void 0;return o?.destroy(),a.addEventListener("abort",A,{once:!0}),i}function T(t){p=!0;let o=e.client.attempt?.locale??w?.locale,i=o?.startsWith("zh"),d=t?i?"正在查询原订单…":"Checking your purchase…":i?"暂时无法确认原订单,请重试。":"Could not check your original purchase. Try again.",u=t?void 0:()=>{G()};c?.setPurchaseRecovery?.(d,u)||(c&&x(),l.active||(l=V(D,e,"funnel",()=>b(),z),l.start(!0,o,e.loadingDocument??null)),l.setPurchaseRecovery(d,u))}function G(){if(E)return E;if(n||a.aborted)return Promise.resolve();U??=c?.recoveryPaywall,a.addEventListener("abort",A,{once:!0}),T(!0);let t=Promise.resolve().then(async()=>{try{let i=await l.wait(e.client.refresh(),O);!n&&!a.aborted&&await ee(i,l)}catch(i){!n&&!a.aborted&&(h(e.onError,i),T(!1))}});E=t;let o=()=>{E===t&&(E=void 0)};return t.then(o,o),t}async function ee(t,o){let i=e.client.controller;if(t.mode==="run"&&t.status!=="blocked"&&i)return p&&c&&x(),p=!1,U=void 0,ae(i,o?.active?o:void 0);if(t.mode==="operation"&&t.purchases.length){T(!0);let d=await l.wait(e.client.recoverPurchasePaywall(U).then(u=>((n||a.aborted)&&u?.destroy(),u)),O).catch(u=>(!n&&!a.aborted&&h(e.onError,u),null));if(n||a.aborted)return null;if(d){if(n||a.aborted)return d.destroy(),null;let u=x(!0)??y?.retainPurchaseDialog?.()??l.retainPurchaseDialog();y?.release();let r=await re(D,{signal:a,loading:"host",start:async()=>d,checkoutNavigation:"after_confirmation",allowNewPurchase:!1,resumeCheckout:P=>e.client.continueCheckout(W,P),onError:e.onError,onDismiss:()=>{n||b()}},{retainedDialog:u,present(P){l.active?l.present(P):P(!!u)},async dismiss(){b()}});if(!r.host||n||a.aborted)return r.host?.destroy(),u?.release(),v(),null;let s=r.host;return p=!1,c={destroy(){s.destroy(),v(),h(e.onDismiss,null)},refresh:async()=>{await s.refresh()},get recovery(){return s.recovery},prepareFallback:()=>s.prepareFallback(),review:async()=>{},exitReview:async()=>{},unappliedDrafts:new Map},N}}return t.purchases.length||p?(T(!1),N):(l.finish("skipped"),v(),(M||L)&&(n=!0,h(e.onDismiss,null)),null)}function W(t){if(a.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");return e.onCheckoutUrl?e.onCheckoutUrl(t):D.ownerDocument.defaultView?.location.assign(t)}async function ae(t,o){a.removeEventListener("abort",A),L=!0;function i(){!n&&!a.aborted&&!p&&!X&&q&&e.client.recovery.status==="complete"&&(X=!0,h(e.onComplete,structuredClone(q)))}F(),F=e.client.subscribe(i);let d=++g,u=await ne(D,{...e,prepared:f,client:t,signal:a,checkoutNavigation:"after_confirmation",resumeCheckout:r=>e.client.continueCheckout(W,r),terminateCheckout:e.allowNewPurchase===!1?void 0:r=>e.client.terminateCheckout(r),async onCheckoutUrl(r){if(a.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");let s=e.client.recovery;if((!s.actions.includes("continue_checkout")||!s.purchases.some(P=>P.type==="checkout"&&P.checkoutUrl===r))&&(s=await e.client.refresh(),a.throwIfAborted(),n))throw new DOMException("Presentation dismissed","AbortError");if(te(s)!==r)throw new C("PURCHASE_PENDING","Checkout differs from the original recovery proof");return W(r)},async resolveOfferId(r){if(a.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 P=await e.resolveOfferId?.(r,s);if(a.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 P},async resolveSubscriptionChange(r){a.throwIfAborted();let s=e.client.attempt;if(n||!s)throw new C("PURCHASE_PENDING","Read the original Start before selecting a membership");let P=await e.resolveSubscriptionChange?.(r);if(a.throwIfAborted(),n||e.client.attempt?.requestId!==s.requestId)throw new C("PURCHASE_STORAGE_CONFLICT","The original purchase changed while selecting a membership");return P},onPresentationState(r){d===g&&h(e.onPresentationState,r)},onComplete(r){d===g&&(q=r,i())},onError(r){d===g&&(h(e.onError,r),r instanceof C&&(r.status===401||r.status===409&&r.reason==="STATE_CHANGED"&&r.recovery==="recover_operation")&&!a.aborted&&G().catch(s=>h(e.onError,s)))},onDismiss(r){d===g&&(n=!0,v(),I?.(),h(e.onDismiss,r))}},o);return d!==g||n||a.aborted?(u.destroy(),n||a.aborted?null:N):(c=u,N)}});return k.set(e.client,S),S}export{he as showFunnelPurchase};
@@ -0,0 +1 @@
1
+ import{a as A}from"./chunk-C4NXQMSO.js";import{a as S}from"./chunk-OJDO7546.js";import"./chunk-DXLBEXC6.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-QAGK2SLZ.js";import"./chunk-BX2MSRA4.js";import"./chunk-J4RM5GQP.js";import"./chunk-ADTZEBQF.js";import"./chunk-OV46DXRX.js";import{b as C}from"./chunk-M4P6TGBU.js";import"./chunk-GGZG56GR.js";import"./chunk-NL7AXMUA.js";import"./chunk-VILB5M4X.js";import"./chunk-TS26DZNO.js";import"./chunk-L64BS65O.js";import{t as k}from"./chunk-QGKROSRD.js";import"./chunk-RRZZUIFM.js";import"./chunk-RJT764B2.js";import"./chunk-BKBWGPNR.js";import"./chunk-NNJVMJUG.js";import{a as l}from"./chunk-WE55LJEN.js";import"./chunk-OZK47BUU.js";import"./chunk-LBDLWHBY.js";import"./chunk-5YBTU4KS.js";import"./chunk-DSPLGTQI.js";import"./chunk-HMJTABQ5.js";import"./chunk-DLRCJF6U.js";import"./chunk-WOT6VMZA.js";async function M(p,t){let c=p.closest("dialog");if(!c?.open)return null;let a=AbortSignal.any([t.signal,t.client.identitySignal]);a.throwIfAborted();let i=t.operationId?await t.client.recoverPurchasePaywall(void 0,t.operationId):await t.client.recoverPurchasePaywall();if(!i)return null;let f=i.view;if(!f||f.document.presentation.type!=="modal"||a.aborted)return i.destroy(),null;let o=t.upgradeReplacement,u=i,h=u,m,E=o?new Proxy(i,{get(n,e){let s=h[e];return typeof s=="function"?s.bind(h):s}}):i;async function R(n,e){if(a.throwIfAborted(),!o||u.operation?.operationId!==n||!u.canReselect)throw new l("PURCHASE_PENDING","The original upgrade has not been closed");if(!m){let r=await o.start();if(!r)throw new l("PRODUCT_UNAVAILABLE","The selected upgrade is unavailable");if(r.funnelId!==t.client.attempt?.funnelId)throw new l("SCOPE_MISMATCH","The new upgrade belongs to another Funnel");m={...r,requestId:r.requestId??crypto.randomUUID()}}a.throwIfAborted();let s=await t.client.start(m),P=t.client.controller;if(s.mode!=="run"||s.status!=="ready"||!P?.view?.paywall)throw new l("PURCHASE_PENDING","The current Paywall could not be opened for the replacement");let w=await A(P);try{a.throwIfAborted();let r=w.view,g=r?.document.buttons[e.actionId],v=r&&g?.type==="checkout"?C(g.product,e.selection,r.capabilities):null;if(!r||v!==e.productVersionId)throw new l("PRODUCT_UNAVAILABLE","The selected upgrade is no longer available");let I=k(r.document.screen,v,e.selection,r.capabilities);if(Object.keys(I).length!==Object.keys(e.featureQuantities).length||Object.entries(I).some(([D,L])=>e.featureQuantities[D]!==L))throw new l("PRODUCT_UNAVAILABLE","The selected upgrade quantities have changed");return h=w,u.destroy(),r}catch(r){throw w.destroy(),r}}let U=["style","tabindex","aria-label","data-presentation","data-indiana-backdrop"].map(n=>[n,c.getAttribute(n)]),O=()=>{for(let[n,e]of U)e===null?c.removeAttribute(n):c.setAttribute(n,e)},d,T=new Promise(n=>{d=n}),y=!1,b=()=>d(!1);a.addEventListener("abort",b,{once:!0});try{let{host:n}=await S(p,{signal:a,start:async()=>E,loading:"host",checkoutNavigation:"after_confirmation",allowNewPurchase:!1,...o&&{beforeCheckoutReplacement:o.beforeCheckoutReplacement,resolveOfferId:o.resolveOfferId,resolveSubscriptionChange:o.resolveSubscriptionChange,terminateCheckout:e=>t.client.terminateCheckout(e),prepareUpgradeReplacement:R},resumeCheckout:e=>t.client.continueCheckout(t.onCheckoutUrl,e),onComplete:t.onComplete,onError(e){y?t.onError?.(e):d(!1)}},{retainedDialog:{dialog:c,release:O},retainedContent:p,present(e){e(!0),y=!0,d(!0)},async dismiss(){t.onDismiss()}});return!n||!await T||a.aborted?(n?.destroy(),null):{document:f.document,destroy:()=>n.destroy()}}finally{a.removeEventListener("abort",b)}}export{M as mountFunnelRecoveryPaywall};
@@ -1,9 +1,9 @@
1
1
  import * as zod from 'zod';
2
2
  import { z } from 'zod';
3
- import { I as InvoiceModeParams, b as InvoiceModeParamsInput, A as ApiInput } from './api-D0Qu0isy.js';
4
- import { S as StackNode, a as ScreenSelection } from './screen-CJepeiBT.js';
3
+ import { I as InvoiceModeParams, b as InvoiceModeParamsInput, A as ApiInput } from './api-1Tplv-7M.js';
4
+ import { S as StackNode, a as ScreenSelection } from './screen-D2bUmJ4M.js';
5
5
  import { J as JsonValue, E as EvaluationContext, F as FeatureResult } from './growth-rules-B4YYy64R.js';
6
- import { C as ConfigurationSync } from './configuration-sync-DObsuVof.js';
6
+ import { C as ConfigurationSync } from './configuration-sync-DeWWW5za.js';
7
7
 
8
8
  declare const scopeSchema: z.ZodObject<{
9
9
  projectId: z.ZodString;
@@ -967,9 +967,9 @@ declare const funnelRunViewSchema: z.ZodObject<{
967
967
  nodes: z.ZodRecord<z.ZodString, z.ZodObject<{
968
968
  source: z.ZodEnum<{
969
969
  membership: "membership";
970
+ billing: "billing";
970
971
  credit_balance: "credit_balance";
971
972
  credit_transactions: "credit_transactions";
972
- billing: "billing";
973
973
  billing_controls: "billing_controls";
974
974
  customer_plans: "customer_plans";
975
975
  credit_packs: "credit_packs";
@@ -6689,12 +6689,12 @@ declare const funnelRunViewSchema: z.ZodObject<{
6689
6689
  instruction: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
6690
6690
  environmentId: z.ZodUUID;
6691
6691
  attributes: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
6692
+ policyRevision: z.ZodNumber;
6692
6693
  sticky: z.ZodRecord<z.ZodString, z.ZodObject<{
6693
6694
  attributeName: z.ZodString;
6694
6695
  attributeValue: z.ZodString;
6695
6696
  assignments: z.ZodRecord<z.ZodString, z.ZodString>;
6696
6697
  }, z.core.$strict>>;
6697
- policyRevision: z.ZodNumber;
6698
6698
  type: z.ZodLiteral<"evaluate_segment">;
6699
6699
  }, z.core.$strict>, z.ZodObject<{
6700
6700
  type: z.ZodLiteral<"wait">;
@@ -7373,9 +7373,9 @@ declare const funnelRuntimeResponseSchema: z.ZodObject<{
7373
7373
  nodes: z.ZodRecord<z.ZodString, z.ZodObject<{
7374
7374
  source: z.ZodEnum<{
7375
7375
  membership: "membership";
7376
+ billing: "billing";
7376
7377
  credit_balance: "credit_balance";
7377
7378
  credit_transactions: "credit_transactions";
7378
- billing: "billing";
7379
7379
  billing_controls: "billing_controls";
7380
7380
  customer_plans: "customer_plans";
7381
7381
  credit_packs: "credit_packs";
@@ -13095,12 +13095,12 @@ declare const funnelRuntimeResponseSchema: z.ZodObject<{
13095
13095
  instruction: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
13096
13096
  environmentId: z.ZodUUID;
13097
13097
  attributes: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
13098
+ policyRevision: z.ZodNumber;
13098
13099
  sticky: z.ZodRecord<z.ZodString, z.ZodObject<{
13099
13100
  attributeName: z.ZodString;
13100
13101
  attributeValue: z.ZodString;
13101
13102
  assignments: z.ZodRecord<z.ZodString, z.ZodString>;
13102
13103
  }, z.core.$strict>>;
13103
- policyRevision: z.ZodNumber;
13104
13104
  type: z.ZodLiteral<"evaluate_segment">;
13105
13105
  }, z.core.$strict>, z.ZodObject<{
13106
13106
  type: z.ZodLiteral<"wait">;
@@ -18320,9 +18320,9 @@ declare const funnelProcessRunViewSchema: z.ZodObject<{
18320
18320
  nodes: z.ZodRecord<z.ZodString, z.ZodObject<{
18321
18321
  source: z.ZodEnum<{
18322
18322
  membership: "membership";
18323
+ billing: "billing";
18323
18324
  credit_balance: "credit_balance";
18324
18325
  credit_transactions: "credit_transactions";
18325
- billing: "billing";
18326
18326
  billing_controls: "billing_controls";
18327
18327
  customer_plans: "customer_plans";
18328
18328
  credit_packs: "credit_packs";
@@ -24058,9 +24058,9 @@ declare const funnelProcessRunViewSchema: z.ZodObject<{
24058
24058
  nodeId: z.ZodString;
24059
24059
  parameters: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
24060
24060
  answers: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
24061
+ visit: z.ZodNumber;
24061
24062
  stopped: z.ZodBoolean;
24062
24063
  variables: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
24063
- visit: z.ZodNumber;
24064
24064
  nodeType: z.ZodEnum<{
24065
24065
  output: "output";
24066
24066
  action: "action";
@@ -24098,12 +24098,12 @@ declare const funnelProcessRunViewSchema: z.ZodObject<{
24098
24098
  instruction: z.ZodNullable<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
24099
24099
  environmentId: z.ZodUUID;
24100
24100
  attributes: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
24101
+ policyRevision: z.ZodNumber;
24101
24102
  sticky: z.ZodRecord<z.ZodString, z.ZodObject<{
24102
24103
  attributeName: z.ZodString;
24103
24104
  attributeValue: z.ZodString;
24104
24105
  assignments: z.ZodRecord<z.ZodString, z.ZodString>;
24105
24106
  }, z.core.$strict>>;
24106
- policyRevision: z.ZodNumber;
24107
24107
  type: z.ZodLiteral<"evaluate_segment">;
24108
24108
  }, z.core.$strict>, z.ZodObject<{
24109
24109
  type: z.ZodLiteral<"wait">;
@@ -24226,8 +24226,8 @@ declare const funnelProcessMutationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
24226
24226
  operation: z.ZodLiteral<"commit_segment">;
24227
24227
  generation: z.ZodString;
24228
24228
  nodeId: z.ZodString;
24229
- policyRevision: z.ZodNumber;
24230
24229
  visit: z.ZodNumber;
24230
+ policyRevision: z.ZodNumber;
24231
24231
  }, z.core.$strict>], "operation">;
24232
24232
  declare const funnelProcessCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
24233
24233
  contract: z.ZodLiteral<"funnel-process/1">;
@@ -24464,8 +24464,8 @@ declare const funnelProcessCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
24464
24464
  operation: z.ZodLiteral<"commit_segment">;
24465
24465
  generation: z.ZodString;
24466
24466
  nodeId: z.ZodString;
24467
- policyRevision: z.ZodNumber;
24468
24467
  visit: z.ZodNumber;
24468
+ policyRevision: z.ZodNumber;
24469
24469
  }, z.core.$strict>], "operation">;
24470
24470
  contract: z.ZodLiteral<"funnel-process/1">;
24471
24471
  customerToken: z.ZodString;
@@ -29653,9 +29653,9 @@ declare const funnelProcessRuntimeResponseSchema: z.ZodObject<{
29653
29653
  nodes: z.ZodRecord<z.ZodString, z.ZodObject<{
29654
29654
  source: z.ZodEnum<{
29655
29655
  membership: "membership";
29656
+ billing: "billing";
29656
29657
  credit_balance: "credit_balance";
29657
29658
  credit_transactions: "credit_transactions";
29658
- billing: "billing";
29659
29659
  billing_controls: "billing_controls";
29660
29660
  customer_plans: "customer_plans";
29661
29661
  credit_packs: "credit_packs";
@@ -35391,9 +35391,9 @@ declare const funnelProcessRuntimeResponseSchema: z.ZodObject<{
35391
35391
  nodeId: z.ZodString;
35392
35392
  parameters: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
35393
35393
  answers: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
35394
+ visit: z.ZodNumber;
35394
35395
  stopped: z.ZodBoolean;
35395
35396
  variables: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
35396
- visit: z.ZodNumber;
35397
35397
  nodeType: z.ZodEnum<{
35398
35398
  output: "output";
35399
35399
  action: "action";
@@ -35431,12 +35431,12 @@ declare const funnelProcessRuntimeResponseSchema: z.ZodObject<{
35431
35431
  instruction: z.ZodNullable<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
35432
35432
  environmentId: z.ZodUUID;
35433
35433
  attributes: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
35434
+ policyRevision: z.ZodNumber;
35434
35435
  sticky: z.ZodRecord<z.ZodString, z.ZodObject<{
35435
35436
  attributeName: z.ZodString;
35436
35437
  attributeValue: z.ZodString;
35437
35438
  assignments: z.ZodRecord<z.ZodString, z.ZodString>;
35438
35439
  }, z.core.$strict>>;
35439
- policyRevision: z.ZodNumber;
35440
35440
  type: z.ZodLiteral<"evaluate_segment">;
35441
35441
  }, z.core.$strict>, z.ZodObject<{
35442
35442
  type: z.ZodLiteral<"wait">;
@@ -47411,7 +47411,7 @@ declare function createFunnelRunController(options: FunnelRunControllerOptions):
47411
47411
  };
47412
47412
  customerData: {
47413
47413
  nodes: Record<string, {
47414
- source: "membership" | "credit_balance" | "credit_transactions" | "billing" | "billing_controls" | "customer_plans" | "credit_packs" | "credit_pack_orders" | "offer_history";
47414
+ source: "membership" | "billing" | "credit_balance" | "credit_transactions" | "billing_controls" | "customer_plans" | "credit_packs" | "credit_pack_orders" | "offer_history";
47415
47415
  status: "error" | "ready" | "idle" | "loading";
47416
47416
  stale: boolean;
47417
47417
  preview: boolean;
@@ -50873,12 +50873,12 @@ declare function createFunnelRunController(options: FunnelRunControllerOptions):
50873
50873
  instruction: {
50874
50874
  environmentId: string;
50875
50875
  attributes: Record<string, zod.JSONType>;
50876
+ policyRevision: number;
50876
50877
  sticky: Record<string, {
50877
50878
  attributeName: string;
50878
50879
  attributeValue: string;
50879
50880
  assignments: Record<string, string>;
50880
50881
  }>;
50881
- policyRevision: number;
50882
50882
  type: "evaluate_segment";
50883
50883
  } | {
50884
50884
  type: "wait";
@@ -51391,7 +51391,7 @@ declare function createFunnelRunController(options: FunnelRunControllerOptions):
51391
51391
  };
51392
51392
  customerData: {
51393
51393
  nodes: Record<string, {
51394
- source: "membership" | "credit_balance" | "credit_transactions" | "billing" | "billing_controls" | "customer_plans" | "credit_packs" | "credit_pack_orders" | "offer_history";
51394
+ source: "membership" | "billing" | "credit_balance" | "credit_transactions" | "billing_controls" | "customer_plans" | "credit_packs" | "credit_pack_orders" | "offer_history";
51395
51395
  status: "error" | "ready" | "idle" | "loading";
51396
51396
  stale: boolean;
51397
51397
  preview: boolean;
@@ -54853,12 +54853,12 @@ declare function createFunnelRunController(options: FunnelRunControllerOptions):
54853
54853
  instruction: {
54854
54854
  environmentId: string;
54855
54855
  attributes: Record<string, zod.JSONType>;
54856
+ policyRevision: number;
54856
54857
  sticky: Record<string, {
54857
54858
  attributeName: string;
54858
54859
  attributeValue: string;
54859
54860
  assignments: Record<string, string>;
54860
54861
  }>;
54861
- policyRevision: number;
54862
54862
  type: "evaluate_segment";
54863
54863
  } | {
54864
54864
  type: "wait";
@@ -58648,7 +58648,7 @@ declare function createFunnelRunController(options: FunnelRunControllerOptions):
58648
58648
  };
58649
58649
  customerData: {
58650
58650
  nodes: Record<string, {
58651
- source: "membership" | "credit_balance" | "credit_transactions" | "billing" | "billing_controls" | "customer_plans" | "credit_packs" | "credit_pack_orders" | "offer_history";
58651
+ source: "membership" | "billing" | "credit_balance" | "credit_transactions" | "billing_controls" | "customer_plans" | "credit_packs" | "credit_pack_orders" | "offer_history";
58652
58652
  status: "error" | "ready" | "idle" | "loading";
58653
58653
  stale: boolean;
58654
58654
  preview: boolean;
@@ -62110,12 +62110,12 @@ declare function createFunnelRunController(options: FunnelRunControllerOptions):
62110
62110
  instruction: {
62111
62111
  environmentId: string;
62112
62112
  attributes: Record<string, zod.JSONType>;
62113
+ policyRevision: number;
62113
62114
  sticky: Record<string, {
62114
62115
  attributeName: string;
62115
62116
  attributeValue: string;
62116
62117
  assignments: Record<string, string>;
62117
62118
  }>;
62118
- policyRevision: number;
62119
62119
  type: "evaluate_segment";
62120
62120
  } | {
62121
62121
  type: "wait";
@@ -65402,7 +65402,7 @@ declare function createFunnelRunController(options: FunnelRunControllerOptions):
65402
65402
  };
65403
65403
  customerData: {
65404
65404
  nodes: Record<string, {
65405
- source: "membership" | "credit_balance" | "credit_transactions" | "billing" | "billing_controls" | "customer_plans" | "credit_packs" | "credit_pack_orders" | "offer_history";
65405
+ source: "membership" | "billing" | "credit_balance" | "credit_transactions" | "billing_controls" | "customer_plans" | "credit_packs" | "credit_pack_orders" | "offer_history";
65406
65406
  status: "error" | "ready" | "idle" | "loading";
65407
65407
  stale: boolean;
65408
65408
  preview: boolean;
@@ -68864,12 +68864,12 @@ declare function createFunnelRunController(options: FunnelRunControllerOptions):
68864
68864
  instruction: {
68865
68865
  environmentId: string;
68866
68866
  attributes: Record<string, zod.JSONType>;
68867
+ policyRevision: number;
68867
68868
  sticky: Record<string, {
68868
68869
  attributeName: string;
68869
68870
  attributeValue: string;
68870
68871
  assignments: Record<string, string>;
68871
68872
  }>;
68872
- policyRevision: number;
68873
68873
  type: "evaluate_segment";
68874
68874
  } | {
68875
68875
  type: "wait";
@@ -72154,7 +72154,7 @@ declare function createFunnelRunController(options: FunnelRunControllerOptions):
72154
72154
  };
72155
72155
  customerData: {
72156
72156
  nodes: Record<string, {
72157
- source: "membership" | "credit_balance" | "credit_transactions" | "billing" | "billing_controls" | "customer_plans" | "credit_packs" | "credit_pack_orders" | "offer_history";
72157
+ source: "membership" | "billing" | "credit_balance" | "credit_transactions" | "billing_controls" | "customer_plans" | "credit_packs" | "credit_pack_orders" | "offer_history";
72158
72158
  status: "error" | "ready" | "idle" | "loading";
72159
72159
  stale: boolean;
72160
72160
  preview: boolean;
@@ -75616,12 +75616,12 @@ declare function createFunnelRunController(options: FunnelRunControllerOptions):
75616
75616
  instruction: {
75617
75617
  environmentId: string;
75618
75618
  attributes: Record<string, zod.JSONType>;
75619
+ policyRevision: number;
75619
75620
  sticky: Record<string, {
75620
75621
  attributeName: string;
75621
75622
  attributeValue: string;
75622
75623
  assignments: Record<string, string>;
75623
75624
  }>;
75624
- policyRevision: number;
75625
75625
  type: "evaluate_segment";
75626
75626
  } | {
75627
75627
  type: "wait";
@@ -78980,4 +78980,4 @@ type LocalFunnelClient = {
78980
78980
  /** Local predicts public rules for display. The server calculates and accepts every Flow segment. */
78981
78981
  declare function createLocalFunnelClient(options: LocalFunnelClientOptions): Promise<LocalFunnelClient>;
78982
78982
 
78983
- export { createFeatureClient as A, createFunnelRunController as B, type CustomerSession as C, createLocalFunnelClient as D, getPaywallRecovery as E, type FunnelCommandStorage as F, isPaywallOperationComplete as G, isPaywallOperationPending as H, type IndianaOptions as I, isPaywallUpdateOperation as J, isPaywallUpdateQuote as K, type LocalFunnelClient as L, preparePaywallFallback as M, type Scope as N, type PushAddressObservation as O, type PaywallSession as P, type FunnelProcessOpenInput as Q, type RemoteFeatureResult as R, type SessionCredentials as S, type FunnelProcessResponse as T, type FunnelCommand as U, type FunnelProcessMutation as V, type FunnelPageExperimentsResponse as W, type IndianaServerOptions as X, type FunnelProcessSuppression as Y, type FunnelProcessCommand as Z, createFunnelStartClient as _, type PaywallOperation as a, type PaywallSubscriptionChange as b, type FunnelStartInput as c, type FunnelExecutionPolicy as d, type PaywallRecovery as e, type PaywallQuote as f, type FunnelRunController as g, type PaywallResolution as h, type FunnelRunView as i, type IamFunnelEntryDelivery as j, type FunnelProcessRunView as k, createPaywallSession as l, type FeatureClient as m, type FeatureClientOptions as n, type FunnelControllerResponse as o, type FunnelPendingEntry as p, type FunnelPurchaseRecovery as q, type FunnelRuntimeResponse as r, scopeSchema as s, type FunnelSegmentPrediction as t, type LocalFunnelClientOptions as u, IndianaError as v, type PaywallPurchaseInput as w, type PaywallStartInput as x, type PushHost as y, type PushJournal as z };
78983
+ export { createFeatureClient as A, createFunnelRunController as B, type CustomerSession as C, createLocalFunnelClient as D, getPaywallRecovery as E, type FunnelCommandStorage as F, isPaywallOperationComplete as G, isPaywallOperationPending as H, type IndianaOptions as I, isPaywallUpdateOperation as J, isPaywallUpdateQuote as K, type LocalFunnelClient as L, preparePaywallFallback as M, type Scope as N, type PushAddressObservation as O, type PaywallSession as P, type FunnelProcessOpenInput as Q, type RemoteFeatureResult as R, type SessionCredentials as S, type FunnelProcessResponse as T, type FunnelCommand as U, type FunnelProcessMutation as V, type FunnelPageExperimentsResponse as W, type IndianaServerOptions as X, type FunnelProcessSuppression as Y, type FunnelProcessCommand as Z, createFunnelStartClient as _, type PaywallOperation as a, type PaywallResolution as b, type PaywallSubscriptionChange as c, type FunnelStartInput as d, type FunnelExecutionPolicy as e, type PaywallRecovery as f, type PaywallQuote as g, type FunnelRunController as h, type FunnelRunView as i, type IamFunnelEntryDelivery as j, type FunnelProcessRunView as k, createPaywallSession as l, type FeatureClient as m, type FeatureClientOptions as n, type FunnelControllerResponse as o, type FunnelPendingEntry as p, type FunnelPurchaseRecovery as q, type FunnelRuntimeResponse as r, scopeSchema as s, type FunnelSegmentPrediction as t, type LocalFunnelClientOptions as u, IndianaError as v, type PaywallPurchaseInput as w, type PaywallStartInput as x, type PushHost as y, type PushJournal as z };
@@ -0,0 +1 @@
1
+ import{a,b,c}from"./chunk-S2MSRPR2.js";import"./chunk-JJIP6BZL.js";import"./chunk-R4BYUK7S.js";import"./chunk-LOBZ45T3.js";import"./chunk-J4RM5GQP.js";import"./chunk-OV46DXRX.js";import"./chunk-GGZG56GR.js";import"./chunk-NL7AXMUA.js";import"./chunk-VILB5M4X.js";import"./chunk-L64BS65O.js";import"./chunk-RRZZUIFM.js";import"./chunk-RJT764B2.js";import"./chunk-BKBWGPNR.js";import"./chunk-NNJVMJUG.js";import"./chunk-WE55LJEN.js";import"./chunk-OZK47BUU.js";import"./chunk-5YBTU4KS.js";import"./chunk-DSPLGTQI.js";import"./chunk-HMJTABQ5.js";import"./chunk-DLRCJF6U.js";import"./chunk-WOT6VMZA.js";export{a as PRERENDER_MAX_AGE_MS,b as preparedInternals,c as prerenderFunnelPurchase};