@tinkerlandai/longplay-sdk 0.10.77 → 0.10.78

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 (91) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/check-response-DO2R3PE6.js +1 -0
  3. package/dist/{chunk-4G52SO64.js → chunk-2HIWXIJE.js} +1 -1
  4. package/dist/{chunk-MWTSCBSY.js → chunk-4CJUGCMG.js} +1 -1
  5. package/dist/{chunk-YMTCZWZG.js → chunk-5MPALDJL.js} +1 -1
  6. package/dist/{chunk-E4B7243C.js → chunk-5X7PTCI4.js} +1 -1
  7. package/dist/{chunk-LYTPUZOW.js → chunk-6FWT2BXF.js} +1 -1
  8. package/dist/{chunk-Q6SK6G7T.js → chunk-6NDL2ELB.js} +1 -1
  9. package/dist/{chunk-6JCM2PSZ.js → chunk-7RBU7UEU.js} +1 -1
  10. package/dist/{chunk-65QMZQE6.js → chunk-ABLGIN4X.js} +1 -1
  11. package/dist/{chunk-EQJIC52H.js → chunk-BN6UIKEV.js} +1 -1
  12. package/dist/{chunk-CLV4ROBM.js → chunk-BSPJMJDI.js} +1 -1
  13. package/dist/{chunk-SHJUMRYM.js → chunk-CAOUMQZ6.js} +1 -1
  14. package/dist/{chunk-TULPOZKV.js → chunk-CDFRRXSQ.js} +1 -1
  15. package/dist/{chunk-DRCBHEC6.js → chunk-CW7MTKXP.js} +1 -1
  16. package/dist/{chunk-HT5TYVH7.js → chunk-CZ33YJWK.js} +1 -1
  17. package/dist/{chunk-BB6PDBS4.js → chunk-D7SPHHSF.js} +1 -1
  18. package/dist/{chunk-H3LBNH34.js → chunk-DLLC7CRI.js} +1 -1
  19. package/dist/chunk-E773KSFH.js +1 -0
  20. package/dist/{chunk-SUUBL2WC.js → chunk-EDZJ2IGA.js} +1 -1
  21. package/dist/{chunk-QJLVJLVX.js → chunk-FVYB2P6Y.js} +1 -1
  22. package/dist/{chunk-XSEYXS4X.js → chunk-FWM3577O.js} +1 -1
  23. package/dist/{chunk-TQKNQGWV.js → chunk-HEPQNLR2.js} +1 -1
  24. package/dist/chunk-HOX2FQQE.js +1 -0
  25. package/dist/{chunk-CJJ4R645.js → chunk-HXWWH644.js} +1 -1
  26. package/dist/{chunk-FSHGHFU4.js → chunk-HXXUZ6RR.js} +2 -2
  27. package/dist/{chunk-3ZYWGEBY.js → chunk-IB6BBGLM.js} +1 -1
  28. package/dist/{chunk-SGI3Q2DQ.js → chunk-IEKRWGRV.js} +1 -1
  29. package/dist/{chunk-IJRQSIVF.js → chunk-IHAMRL3F.js} +1 -1
  30. package/dist/{chunk-QLMQI6SX.js → chunk-IXDARDPI.js} +1 -1
  31. package/dist/{chunk-DMMD4TMS.js → chunk-JXVZK3RZ.js} +1 -1
  32. package/dist/{chunk-47SYSZJP.js → chunk-L6XCRIR2.js} +1 -1
  33. package/dist/{chunk-66SRWQES.js → chunk-LUYWRWJ2.js} +1 -1
  34. package/dist/{chunk-X6ZYJHX4.js → chunk-LWIBARE4.js} +1 -1
  35. package/dist/{chunk-TZTWXL53.js → chunk-LZYQA3Q4.js} +1 -1
  36. package/dist/{chunk-KCRL2BDG.js → chunk-N6RBDJ5Y.js} +1 -1
  37. package/dist/{chunk-ENZRUXTJ.js → chunk-NJNENW5L.js} +1 -1
  38. package/dist/{chunk-B7CFFTJI.js → chunk-OZ32ZMZZ.js} +1 -1
  39. package/dist/{chunk-S5KGFAAW.js → chunk-PX7APKZR.js} +1 -1
  40. package/dist/{chunk-STASMAS7.js → chunk-R4ETTZ2H.js} +1 -1
  41. package/dist/{chunk-464CINQK.js → chunk-SQMA5YYI.js} +1 -1
  42. package/dist/{chunk-CWBL2S3A.js → chunk-T44KC4GO.js} +1 -1
  43. package/dist/{chunk-FINCNJBH.js → chunk-TJRXWGKB.js} +1 -1
  44. package/dist/{chunk-IEYSWIRA.js → chunk-VEGGHQTQ.js} +1 -1
  45. package/dist/{chunk-RM6RSLKI.js → chunk-VZMLPENL.js} +1 -1
  46. package/dist/{chunk-62MMCXIA.js → chunk-XLOCTL2Y.js} +1 -1
  47. package/dist/{chunk-5SNUVXZ7.js → chunk-XX5O7H6R.js} +1 -1
  48. package/dist/{chunk-OJ4VMUMS.js → chunk-YXD5B3UB.js} +1 -1
  49. package/dist/{chunk-NUIKM2BY.js → chunk-ZBV6DOEY.js} +1 -1
  50. package/dist/chunk-ZP5XCBBK.js +1 -0
  51. package/dist/{content-BEW3GFZ3.js → content-AD7CZRT4.js} +1 -1
  52. package/dist/{funnel-host-purchase-TLN4Z45B.js → funnel-host-purchase-45TUH4H2.js} +1 -1
  53. package/dist/funnel-host-recovery-paywall-JQWNXDLS.js +1 -0
  54. package/dist/{funnel-paywall-copies-43CVL4UQ.js → funnel-paywall-copies-BPHMFJ2K.js} +1 -1
  55. package/dist/funnel-paywall-prerender-RSXERNQ3.js +1 -0
  56. package/dist/funnel-route-prediction-G4OKIQGD.js +1 -0
  57. package/dist/funnel-route-source-W4R62B7H.js +1 -0
  58. package/dist/funnel-runtime-host-TQAFDG3X.js +1 -0
  59. package/dist/index.d.ts +10 -0
  60. package/dist/index.js +1 -1
  61. package/dist/merchant-bridge-contracts-ADLTLAJJ.js +1 -0
  62. package/dist/native-shell.js +1 -1
  63. package/dist/openrouter.js +1 -1
  64. package/dist/operation-contracts-WLKY7HAO.js +1 -0
  65. package/dist/page.js +1 -1
  66. package/dist/paywall-3P5YKZRE.js +1 -0
  67. package/dist/paywall-content-JJCSFM6J.js +1 -0
  68. package/dist/paywall-session-AWH5GSKC.js +1 -0
  69. package/dist/popup.js +1 -1
  70. package/dist/react-native.js +1 -1
  71. package/dist/screen-renderer-TZIU775B.js +1 -0
  72. package/dist/server.js +1 -1
  73. package/dist/visual.js +1 -1
  74. package/package.json +1 -1
  75. package/dist/check-response-LYK2HZFK.js +0 -1
  76. package/dist/chunk-2GVAT6HI.js +0 -1
  77. package/dist/chunk-KO4CSQ6R.js +0 -1
  78. package/dist/chunk-PBPKZLMG.js +0 -1
  79. package/dist/funnel-host-recovery-paywall-EMYMKT2L.js +0 -1
  80. package/dist/funnel-paywall-prerender-WG6BWWPM.js +0 -1
  81. package/dist/funnel-route-prediction-DXMYNMCA.js +0 -1
  82. package/dist/funnel-route-source-2OGRCZKX.js +0 -1
  83. package/dist/funnel-runtime-host-CHBYLSSZ.js +0 -1
  84. package/dist/merchant-bridge-contracts-MEMS65CV.js +0 -1
  85. package/dist/operation-contracts-L3CZMIL6.js +0 -1
  86. package/dist/paywall-RCDK73ML.js +0 -1
  87. package/dist/paywall-content-G3Q7KTR7.js +0 -1
  88. package/dist/paywall-session-RZHCKRRG.js +0 -1
  89. package/dist/screen-renderer-IKROGLA7.js +0 -1
  90. /package/dist/{chunk-FSHGHFU4.js.LEGAL.txt → chunk-HXXUZ6RR.js.LEGAL.txt} +0 -0
  91. /package/dist/{chunk-7RUOZL6C.js → chunk-J6MYX7WY.js} +0 -0
@@ -1 +1 @@
1
- import"./chunk-STASMAS7.js";import"./chunk-CJJ4R645.js";import"./chunk-47SYSZJP.js";import"./chunk-66SRWQES.js";import{a as i}from"./chunk-E4B7243C.js";import"./chunk-5SNUVXZ7.js";import"./chunk-ENZRUXTJ.js";import"./chunk-5MRSFLQA.js";import{b as A}from"./chunk-7RUOZL6C.js";import"./chunk-WOT6VMZA.js";var c=A.number().int().min(0).max(1e9);function R(e,o){let a=c.parse(e.promptTokens),p=c.parse(e.completionTokens),s=c.parse(e.promptTokensDetails?.cachedTokens??0),t=c.parse(e.promptTokensDetails?.cacheWriteTokens??0),r=c.parse(e.promptTokensDetails?.audioTokens??0),l=c.parse(e.completionTokensDetails?.audioTokens??0),n=c.parse(e.completionTokensDetails?.reasoningTokens??0);if(c.parse(e.totalTokens)!==a+p||s+t+r>a||n+l>p||(e.promptTokensDetails?.videoTokens??0)>0)throw new i("AI_USAGE_UNAVAILABLE","Token pools must conserve usage; video needs an explicit token mapper");return{input:a-s-t-r,output:p-l-(o==="separate"?n:0),cache_read:s,cache_write:t,input_audio:r,output_audio:l,reasoning:o==="separate"?n:0}}function I(e){if(!Number.isFinite(e)||e<0)throw new i("AI_USAGE_UNAVAILABLE","Provider cost must be a nonnegative USD amount");let o=String(e),a=o.includes("e")?e.toFixed(18).replace(/0+$/,"").replace(/\.$/,""):o;if(!/^(0|[1-9]\d{0,11})(\.\d{1,18})?$/.test(a)||Number(a)!==e)throw new i("AI_USAGE_UNAVAILABLE","Provider cost exceeds the supported precision");return a}async function f(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning)||!e.modelId||!e.generationId)throw new i("INVALID_REQUEST","Actual model, generation ID and reasoning pricing are required");let o={context:e.context,generationId:e.generationId,modelId:`openrouter/${e.modelId}`,usage:e.usage,tokens:null,quote:null,receipt:null,phase:"captured"};await e.persist(o);let a=e.mapTokens?e.mapTokens(e.usage):R(e.usage,e.reasoning),p=e.usage.cost==null?void 0:I(e.usage.cost),s=e.quote??await e.pricing.quoteTokens({modelId:o.modelId,tokens:a});if(s.pricing.modelId!==o.modelId||Object.keys(a).some(l=>a[l]!==s.tokens[l]))throw new i("INVALID_REQUEST","Saved quote must match the provider model and token pools");await e.persist({...o,tokens:a,quote:s,phase:"quoted"});let t=await e.pricing.trackTokens(e.client,{...e.context,quote:s,providerCostUsd:p,generationId:e.generationId});if(!t.receipt.accepted)throw new i("AI_BALANCE_REJECTED","OpenRouter usage was saved but the balance request was rejected");let r={...o,tokens:a,quote:s,receipt:t,phase:"settled"};return await e.persist(r),r}function T(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning))throw new i("INVALID_REQUEST","Reasoning pricing is required");let o=e.openRouter.chat;async function a(t){if(!t.usage||!t.modelId||!t.generationId)throw new i("AI_USAGE_UNAVAILABLE","OpenRouter did not return final usage and the actual model");await f({...e,context:t.context,generationId:t.generationId,modelId:t.modelId.slice(11),usage:t.usage})}let p=async(t,r)=>{let n={context:await e.context(),generationId:null,modelId:null,usage:null,tokens:null,quote:null,receipt:null,phase:"incomplete"},d;try{d=await o.send(t,r)}catch(g){throw await e.persist(n),g}if(!(d instanceof ReadableStream)){if(n={...n,generationId:d.id,modelId:d.model?`openrouter/${d.model}`:null,usage:d.usage??null},!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter omitted final accounting");return await a(n),d}let w=d.getReader(),m=!1;return new ReadableStream({async pull(g){try{let{value:u,done:k}=await w.read();if(k){if(m=!0,!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter stream ended without final accounting");await a(n),g.close();return}if(u.error)throw new i("AI_PROVIDER_ERROR",u.error.message);u.usage&&(n={...n,generationId:u.id,modelId:u.model?`openrouter/${u.model}`:null,usage:u.usage}),g.enqueue(u)}catch(u){m||(m=!0,await e.persist(n)),await w.cancel(u),g.error(u)}},async cancel(g){m||(m=!0,await e.persist(n)),await w.cancel(g)}})},s=new Proxy(o,{get(t,r){return r==="send"?p:Reflect.get(t,r,t)}});return new Proxy(e.openRouter,{get(t,r){return r==="chat"?s:Reflect.get(t,r,t)}})}export{T as createOpenRouterUsageClient,f as trackOpenRouterUsage};
1
+ import"./chunk-R4ETTZ2H.js";import"./chunk-HXWWH644.js";import"./chunk-L6XCRIR2.js";import"./chunk-LUYWRWJ2.js";import{a as i}from"./chunk-5X7PTCI4.js";import"./chunk-XX5O7H6R.js";import"./chunk-NJNENW5L.js";import"./chunk-5MRSFLQA.js";import{b as A}from"./chunk-J6MYX7WY.js";import"./chunk-WOT6VMZA.js";var c=A.number().int().min(0).max(1e9);function R(e,o){let a=c.parse(e.promptTokens),p=c.parse(e.completionTokens),s=c.parse(e.promptTokensDetails?.cachedTokens??0),t=c.parse(e.promptTokensDetails?.cacheWriteTokens??0),r=c.parse(e.promptTokensDetails?.audioTokens??0),l=c.parse(e.completionTokensDetails?.audioTokens??0),n=c.parse(e.completionTokensDetails?.reasoningTokens??0);if(c.parse(e.totalTokens)!==a+p||s+t+r>a||n+l>p||(e.promptTokensDetails?.videoTokens??0)>0)throw new i("AI_USAGE_UNAVAILABLE","Token pools must conserve usage; video needs an explicit token mapper");return{input:a-s-t-r,output:p-l-(o==="separate"?n:0),cache_read:s,cache_write:t,input_audio:r,output_audio:l,reasoning:o==="separate"?n:0}}function I(e){if(!Number.isFinite(e)||e<0)throw new i("AI_USAGE_UNAVAILABLE","Provider cost must be a nonnegative USD amount");let o=String(e),a=o.includes("e")?e.toFixed(18).replace(/0+$/,"").replace(/\.$/,""):o;if(!/^(0|[1-9]\d{0,11})(\.\d{1,18})?$/.test(a)||Number(a)!==e)throw new i("AI_USAGE_UNAVAILABLE","Provider cost exceeds the supported precision");return a}async function f(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning)||!e.modelId||!e.generationId)throw new i("INVALID_REQUEST","Actual model, generation ID and reasoning pricing are required");let o={context:e.context,generationId:e.generationId,modelId:`openrouter/${e.modelId}`,usage:e.usage,tokens:null,quote:null,receipt:null,phase:"captured"};await e.persist(o);let a=e.mapTokens?e.mapTokens(e.usage):R(e.usage,e.reasoning),p=e.usage.cost==null?void 0:I(e.usage.cost),s=e.quote??await e.pricing.quoteTokens({modelId:o.modelId,tokens:a});if(s.pricing.modelId!==o.modelId||Object.keys(a).some(l=>a[l]!==s.tokens[l]))throw new i("INVALID_REQUEST","Saved quote must match the provider model and token pools");await e.persist({...o,tokens:a,quote:s,phase:"quoted"});let t=await e.pricing.trackTokens(e.client,{...e.context,quote:s,providerCostUsd:p,generationId:e.generationId});if(!t.receipt.accepted)throw new i("AI_BALANCE_REJECTED","OpenRouter usage was saved but the balance request was rejected");let r={...o,tokens:a,quote:s,receipt:t,phase:"settled"};return await e.persist(r),r}function T(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning))throw new i("INVALID_REQUEST","Reasoning pricing is required");let o=e.openRouter.chat;async function a(t){if(!t.usage||!t.modelId||!t.generationId)throw new i("AI_USAGE_UNAVAILABLE","OpenRouter did not return final usage and the actual model");await f({...e,context:t.context,generationId:t.generationId,modelId:t.modelId.slice(11),usage:t.usage})}let p=async(t,r)=>{let n={context:await e.context(),generationId:null,modelId:null,usage:null,tokens:null,quote:null,receipt:null,phase:"incomplete"},d;try{d=await o.send(t,r)}catch(g){throw await e.persist(n),g}if(!(d instanceof ReadableStream)){if(n={...n,generationId:d.id,modelId:d.model?`openrouter/${d.model}`:null,usage:d.usage??null},!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter omitted final accounting");return await a(n),d}let w=d.getReader(),m=!1;return new ReadableStream({async pull(g){try{let{value:u,done:k}=await w.read();if(k){if(m=!0,!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter stream ended without final accounting");await a(n),g.close();return}if(u.error)throw new i("AI_PROVIDER_ERROR",u.error.message);u.usage&&(n={...n,generationId:u.id,modelId:u.model?`openrouter/${u.model}`:null,usage:u.usage}),g.enqueue(u)}catch(u){m||(m=!0,await e.persist(n)),await w.cancel(u),g.error(u)}},async cancel(g){m||(m=!0,await e.persist(n)),await w.cancel(g)}})},s=new Proxy(o,{get(t,r){return r==="send"?p:Reflect.get(t,r,t)}});return new Proxy(e.openRouter,{get(t,r){return r==="chat"?s:Reflect.get(t,r,t)}})}export{T as createOpenRouterUsageClient,f as trackOpenRouterUsage};
@@ -0,0 +1 @@
1
+ import{e as o}from"./chunk-CAOUMQZ6.js";import"./chunk-N6RBDJ5Y.js";import"./chunk-IB6BBGLM.js";import"./chunk-JXVZK3RZ.js";import"./chunk-6NDL2ELB.js";import"./chunk-6FWT2BXF.js";import"./chunk-LZYQA3Q4.js";import"./chunk-DLLC7CRI.js";import"./chunk-CW7MTKXP.js";import"./chunk-HEPQNLR2.js";import"./chunk-VILB5M4X.js";import"./chunk-HXWWH644.js";import"./chunk-LUYWRWJ2.js";import"./chunk-EDZJ2IGA.js";import"./chunk-2HIWXIJE.js";import"./chunk-T44KC4GO.js";import"./chunk-LWIBARE4.js";import"./chunk-TJRXWGKB.js";import"./chunk-XX5O7H6R.js";import"./chunk-J6MYX7WY.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
package/dist/page.js CHANGED
@@ -1 +1 @@
1
- import{d as o,e as r,f as e,g as f}from"./chunk-FSHGHFU4.js";import"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-ENZRUXTJ.js";import"./chunk-5MRSFLQA.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{f as createPageExperiments,o as mergeQueryStrings,r as pageAttributes,e as readPayload};
1
+ import{d as o,e as r,f as e,g as f}from"./chunk-HXXUZ6RR.js";import"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-NJNENW5L.js";import"./chunk-5MRSFLQA.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{f as createPageExperiments,o as mergeQueryStrings,r as pageAttributes,e as readPayload};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-PX7APKZR.js";import"./chunk-VEGGHQTQ.js";import"./chunk-W32FI2A2.js";import"./chunk-FWM3577O.js";import"./chunk-SQMA5YYI.js";import"./chunk-BN6UIKEV.js";import"./chunk-LZYQA3Q4.js";import"./chunk-DLLC7CRI.js";import"./chunk-CW7MTKXP.js";import"./chunk-VILB5M4X.js";import"./chunk-L6XCRIR2.js";import"./chunk-LUYWRWJ2.js";import"./chunk-EDZJ2IGA.js";import"./chunk-2HIWXIJE.js";import"./chunk-T44KC4GO.js";import"./chunk-LWIBARE4.js";import"./chunk-TJRXWGKB.js";import"./chunk-5X7PTCI4.js";import"./chunk-XX5O7H6R.js";import"./chunk-NJNENW5L.js";import"./chunk-5MRSFLQA.js";import"./chunk-J6MYX7WY.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as showPaywall};
@@ -0,0 +1 @@
1
+ import{b as a}from"./chunk-YXD5B3UB.js";import"./chunk-JXVZK3RZ.js";import"./chunk-6NDL2ELB.js";import"./chunk-6FWT2BXF.js";import"./chunk-LZYQA3Q4.js";import"./chunk-DLLC7CRI.js";import"./chunk-CW7MTKXP.js";import"./chunk-HEPQNLR2.js";import"./chunk-VILB5M4X.js";import"./chunk-L6XCRIR2.js";import"./chunk-LUYWRWJ2.js";import"./chunk-EDZJ2IGA.js";import"./chunk-2HIWXIJE.js";import"./chunk-T44KC4GO.js";import"./chunk-LWIBARE4.js";import"./chunk-TJRXWGKB.js";import"./chunk-5X7PTCI4.js";import"./chunk-XX5O7H6R.js";import"./chunk-3VUPVXAV.js";import"./chunk-NJNENW5L.js";import"./chunk-5MRSFLQA.js";import"./chunk-J6MYX7WY.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as readPaywallContent};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-7RBU7UEU.js";import"./chunk-CAOUMQZ6.js";import"./chunk-N6RBDJ5Y.js";import"./chunk-5MPALDJL.js";import"./chunk-SQMA5YYI.js";import"./chunk-BN6UIKEV.js";import"./chunk-IB6BBGLM.js";import"./chunk-OZ32ZMZZ.js";import"./chunk-YXD5B3UB.js";import"./chunk-JXVZK3RZ.js";import"./chunk-6NDL2ELB.js";import"./chunk-6FWT2BXF.js";import"./chunk-LZYQA3Q4.js";import"./chunk-DLLC7CRI.js";import"./chunk-CW7MTKXP.js";import"./chunk-HEPQNLR2.js";import"./chunk-VILB5M4X.js";import"./chunk-HXWWH644.js";import"./chunk-L6XCRIR2.js";import"./chunk-LUYWRWJ2.js";import"./chunk-EDZJ2IGA.js";import"./chunk-2HIWXIJE.js";import"./chunk-T44KC4GO.js";import"./chunk-LWIBARE4.js";import"./chunk-TJRXWGKB.js";import"./chunk-5X7PTCI4.js";import"./chunk-XX5O7H6R.js";import"./chunk-3VUPVXAV.js";import"./chunk-NJNENW5L.js";import"./chunk-5MRSFLQA.js";import"./chunk-J6MYX7WY.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
package/dist/popup.js CHANGED
@@ -1 +1 @@
1
- import{a as _,b as z,c as M,d as U,e as W,f as q,g as V,h as j,i as S}from"./chunk-QJLVJLVX.js";import{a as H,b as x,d as y,f as C,g as A,m as E}from"./chunk-XSEYXS4X.js";import"./chunk-SUUBL2WC.js";import{D as b}from"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import"./chunk-E4B7243C.js";import"./chunk-5SNUVXZ7.js";import"./chunk-7RUOZL6C.js";import{a as p}from"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";function O(m,r,n){let d=m.ownerDocument,s=d.defaultView;if(!s)throw new Error("Preview container has no browser window");let l=!1,u=!1,f=0,c,i=d.createElement("div");i.style.cssText="width:100%;min-width:0";let v=(e,F)=>{c=S(e,{mode:"live",rendererUrl:n.rendererUrl,title:n.title??r.name,onPageChange:n.onPageChange,onAction:(R,I)=>p(n.onAction,R,I),onError:n.onError,...F}),c.update(r,n.locale,{capabilities:n.capabilities,customerData:n.customerData})},h=r.presentation;if(h.type==="inline")return m.append(i),v(i,{onContentHeight(e){f=e,p(n.onContentHeight,e,m.clientHeight)}}),{presentation:"inline",inspect:()=>c?.inspect?.()??Promise.resolve(null),destroy(){l||(l=!0,c?.destroy(),i.remove())}};let t=d.createElement("dialog");t.lang=n.locale,t.dir=b(n.locale)?"rtl":"ltr",t.setAttribute("aria-label",r.name),t.style.cssText=H(n.host,h,r.theme);let a=d.createElement("button");a.type="button",a.textContent="×",a.setAttribute("aria-label",n.closeLabel),A(a,r.theme);let g=e=>{u&&!l&&p(n.onDismiss,e)};a.addEventListener("click",()=>g("close_button"));let D=()=>c?.resizeViewport(s.innerHeight||800,s.innerWidth||1024),o;if(n.host==="funnel"){let e=d.createElement("section");e.style.cssText="min-width:0;display:flex;flex-direction:column;min-height:100%",i.style.cssText+=";flex:1 0 auto;display:flex;flex-direction:column;justify-content:center",e.append(i),t.append(a,e),o=y(t,r,D)}else i.setAttribute("aria-label",r.name),o=y(t,r,D),t.append(i),t.prepend(a);let L=n.host==="content"&&o.responsive?x(t,()=>g("close_button"),()=>!0,n.closeLabel):void 0;t.addEventListener("cancel",e=>{e.preventDefault(),g("escape")});let w=e=>s.requestAnimationFrame?s.requestAnimationFrame(e):s.setTimeout(e,0),P=()=>{u&&!l&&p(n.onContentHeight,f,t.clientHeight)},T=E(t);return m.append(t),v(i,{viewportHeight:o.responsive?s.innerHeight||800:void 0,...o.responsive?{viewportWidth:s.innerWidth||1024,hostPresentation:()=>o.type}:{},...n.host!=="content"?{closeActions:n.closeActions??r.actions.filter(e=>e.close).map(e=>e.id),onAuthoredClose(e){a.hidden=e}}:{},onResize(e){o.responsive&&(i.style.height=`${e}px`,i.style.overflow="clip",o.setContentHeight(e)),w(P)},onContentHeight(e){f=e},onRendered(e){e&&t.setAttribute("aria-label",e),!(u||l)&&(u=!0,T(),o.latch(),t.showModal(),o.responsive&&t.focus({preventScroll:!0}),C(t,o.type,o.responsive),w(P))},onEscape:()=>g("escape")}),{get presentation(){return o.type},inspect:()=>c?.inspect?.()??Promise.resolve(null),destroy(){l||(l=!0,c?.destroy(),L?.(),o.destroy(),t.open&&t.close(),t.remove())}}}export{q as formatCustomerDecimal,z as hostedRendererScript,_ as hostedRendererShell,U as inspectCustomHtml,O as mountDialogPreview,S as mountScreenPreview,j as preparePopup,W as prepareScreen,M as sanitizeCustomHtml,V as showPopup};
1
+ import{a as _,b as z,c as M,d as U,e as W,f as q,g as V,h as j,i as S}from"./chunk-FVYB2P6Y.js";import{a as H,b as x,d as y,f as C,g as A,m as E}from"./chunk-FWM3577O.js";import"./chunk-EDZJ2IGA.js";import{D as b}from"./chunk-2HIWXIJE.js";import"./chunk-T44KC4GO.js";import"./chunk-LWIBARE4.js";import"./chunk-TJRXWGKB.js";import"./chunk-5X7PTCI4.js";import"./chunk-XX5O7H6R.js";import"./chunk-J6MYX7WY.js";import{a as p}from"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";function O(m,r,n){let d=m.ownerDocument,s=d.defaultView;if(!s)throw new Error("Preview container has no browser window");let l=!1,u=!1,f=0,c,i=d.createElement("div");i.style.cssText="width:100%;min-width:0";let v=(e,F)=>{c=S(e,{mode:"live",rendererUrl:n.rendererUrl,title:n.title??r.name,onPageChange:n.onPageChange,onAction:(R,I)=>p(n.onAction,R,I),onError:n.onError,...F}),c.update(r,n.locale,{capabilities:n.capabilities,customerData:n.customerData})},h=r.presentation;if(h.type==="inline")return m.append(i),v(i,{onContentHeight(e){f=e,p(n.onContentHeight,e,m.clientHeight)}}),{presentation:"inline",inspect:()=>c?.inspect?.()??Promise.resolve(null),destroy(){l||(l=!0,c?.destroy(),i.remove())}};let t=d.createElement("dialog");t.lang=n.locale,t.dir=b(n.locale)?"rtl":"ltr",t.setAttribute("aria-label",r.name),t.style.cssText=H(n.host,h,r.theme);let a=d.createElement("button");a.type="button",a.textContent="×",a.setAttribute("aria-label",n.closeLabel),A(a,r.theme);let g=e=>{u&&!l&&p(n.onDismiss,e)};a.addEventListener("click",()=>g("close_button"));let D=()=>c?.resizeViewport(s.innerHeight||800,s.innerWidth||1024),o;if(n.host==="funnel"){let e=d.createElement("section");e.style.cssText="min-width:0;display:flex;flex-direction:column;min-height:100%",i.style.cssText+=";flex:1 0 auto;display:flex;flex-direction:column;justify-content:center",e.append(i),t.append(a,e),o=y(t,r,D)}else i.setAttribute("aria-label",r.name),o=y(t,r,D),t.append(i),t.prepend(a);let L=n.host==="content"&&o.responsive?x(t,()=>g("close_button"),()=>!0,n.closeLabel):void 0;t.addEventListener("cancel",e=>{e.preventDefault(),g("escape")});let w=e=>s.requestAnimationFrame?s.requestAnimationFrame(e):s.setTimeout(e,0),P=()=>{u&&!l&&p(n.onContentHeight,f,t.clientHeight)},T=E(t);return m.append(t),v(i,{viewportHeight:o.responsive?s.innerHeight||800:void 0,...o.responsive?{viewportWidth:s.innerWidth||1024,hostPresentation:()=>o.type}:{},...n.host!=="content"?{closeActions:n.closeActions??r.actions.filter(e=>e.close).map(e=>e.id),onAuthoredClose(e){a.hidden=e}}:{},onResize(e){o.responsive&&(i.style.height=`${e}px`,i.style.overflow="clip",o.setContentHeight(e)),w(P)},onContentHeight(e){f=e},onRendered(e){e&&t.setAttribute("aria-label",e),!(u||l)&&(u=!0,T(),o.latch(),t.showModal(),o.responsive&&t.focus({preventScroll:!0}),C(t,o.type,o.responsive),w(P))},onEscape:()=>g("escape")}),{get presentation(){return o.type},inspect:()=>c?.inspect?.()??Promise.resolve(null),destroy(){l||(l=!0,c?.destroy(),L?.(),o.destroy(),t.open&&t.close(),t.remove())}}}export{q as formatCustomerDecimal,z as hostedRendererScript,_ as hostedRendererShell,U as inspectCustomHtml,O as mountDialogPreview,S as mountScreenPreview,j as preparePopup,W as prepareScreen,M as sanitizeCustomHtml,V as showPopup};
@@ -1 +1 @@
1
- import{b as S,c as E,d as T}from"./chunk-IJRQSIVF.js";import"./chunk-NUIKM2BY.js";import{a as A}from"./chunk-6JCM2PSZ.js";import{e as P}from"./chunk-SHJUMRYM.js";import"./chunk-KCRL2BDG.js";import{h as b,i as x,k as L}from"./chunk-TULPOZKV.js";import{E as C}from"./chunk-SGI3Q2DQ.js";import"./chunk-BB6PDBS4.js";import"./chunk-YMTCZWZG.js";import"./chunk-464CINQK.js";import"./chunk-EQJIC52H.js";import"./chunk-3ZYWGEBY.js";import"./chunk-B7CFFTJI.js";import"./chunk-OJ4VMUMS.js";import"./chunk-DMMD4TMS.js";import"./chunk-Q6SK6G7T.js";import"./chunk-LYTPUZOW.js";import"./chunk-TZTWXL53.js";import"./chunk-H3LBNH34.js";import"./chunk-DRCBHEC6.js";import"./chunk-RM6RSLKI.js";import"./chunk-TQKNQGWV.js";import"./chunk-VILB5M4X.js";import"./chunk-CJJ4R645.js";import"./chunk-47SYSZJP.js";import"./chunk-66SRWQES.js";import"./chunk-SUUBL2WC.js";import"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import{a as r}from"./chunk-E4B7243C.js";import{h as R}from"./chunk-5SNUVXZ7.js";import"./chunk-3VUPVXAV.js";import"./chunk-ENZRUXTJ.js";import"./chunk-5MRSFLQA.js";import"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";function k(t,d){let n,a=0,m=-1,l,i=!1,y=()=>{if(i)throw new r("CLOSED","Native host was destroyed");if(!t.nativeModule)throw new r("CAPABILITY_UNAVAILABLE","Link IndianaBridge and supply nativeModule");return t.nativeModule},o=()=>new r("IDENTITY_CHANGED","Customer identity changed during the native operation"),h=d.subscribeIdentity(()=>{a++,m=-1;let e=a;n&&t.nativeModule&&n.then(c=>t.nativeModule.reset(c,e)).catch(()=>{})}),I=t.nativeEvents?.(e=>{!n||!t.nativeModule||typeof e?.requestId!="string"||(async()=>{let c=await n;if(e.instanceId!==c)return;if(e.kind==="credential"){let w=a,f=null;try{if(!i&&e.revision===w){let N=await d.access();!i&&a===w&&(f=N)}}finally{await t.nativeModule.provideCredential(c,e.requestId,f)}return}let s=!1,u=a;try{if(i||e.revision!==u||!t.onNativeAction)throw o();await t.onNativeAction(e.action),s=!i&&a===u}finally{await t.nativeModule.acknowledge(c,e.requestId,s)}})().catch(()=>{})});async function p(e,c={}){let s=y();if(d.snapshot()&&!t.nativeEvents)throw new r("CAPABILITY_UNAVAILABLE","Supply nativeEvents to share credential refresh with the native host");let u=a,w=await d.access();if(i||a!==u)throw o();if(!n){let v=s.create(JSON.stringify({baseUrl:t.baseUrl??"https://api.longplayai.com",scope:t.scope,timeout:(t.timeoutMs??15e3)/1e3,credentialEvents:!!t.nativeEvents}));n=v,v.catch(()=>{n===v&&(n=void 0)})}let f=await n;if(i||a!==u)throw o();if(m!==u){if(!l||l.epoch!==u){let O=(async()=>{if(await s.identify(f,JSON.stringify({revision:u,credentials:w})),i||a!==u)throw await s.reset(f,u),o();m=u})();l={epoch:u,task:O}}let v=l;try{await v.task}finally{l===v&&(l=void 0)}}let N=await s.invoke(f,e,JSON.stringify(c));if(i||a!==u)throw o();try{return JSON.parse(N)}catch{throw new r("INVALID_RESPONSE","Native host returned invalid JSON")}}async function g(e,c){let s=await p(e,c);if(!s||typeof s!="object"||Array.isArray(s)||s.status!=="complete"&&s.status!=="dismissed")throw new r("INVALID_RESPONSE","Native presentation returned an invalid result");return s}return{showFunnel(e){return g("showFunnel",{runToken:e})},showPaywall(e){return g("showPaywall",e)},showContent(e){return g("showContent",e)},purchaseSubscription(e,c){return p("purchaseSubscription",{operationId:e,accepted:c})},switchSubscription(e,c){return p("switchSubscription",{operationId:e,accepted:c})},restorePurchases(){return p("restorePurchases")},manageSubscriptions(e){return p("manageSubscriptions",e?{productId:e}:{})},async dismiss(){a++,m=-1,n&&await y().reset(await n,a)},async destroy(){i||(i=!0,a++,h(),I?.(),n&&t.nativeModule&&await t.nativeModule.destroy(await n))}}}var M=P.trackUsage.request.shape.command,U=P.trackUsage.response;function F(t){let d=R.parse(t.scope),n=S({...t,scope:d}),a={...t,scope:d,session:n.session},m=k(t,n.session),l=0,i=!1;n.subscribeIdentity(()=>{l++});let y=()=>{if(i)throw new r("CLOSED","SDK client was destroyed");let o=n.session.peek();if(!o)throw new r("UNAUTHENTICATED","Identify the Customer first");return o};return{...n,native:m,async destroy(){i||(i=!0,l++,n.destroy(),await m.destroy())},funnel(){return E({...a,customerToken:y()})},resumeFunnel(o){return y(),C({...a,runToken:o})},paywall(o){return A(a,{...o,customerToken:y()})},async trackUsage(o){if(y(),!t.usageReporter)throw new r("INVALID_REQUEST","Configure your authenticated backend usageReporter");let h=M.parse(o),I=l,p;try{p=await t.usageReporter(h)}catch(e){throw I!==l?new r("IDENTITY_CHANGED","Customer identity changed during usage reporting"):e}if(I!==l)throw new r("IDENTITY_CHANGED","Customer identity changed during usage reporting");let g=U.parse(p);if(g.scope.projectId!==d.projectId||g.scope.environment!==d.environment)throw new r("INVALID_RESPONSE","Usage response scope differs");return g}}}export{r as LongplayError,x as createConfigurationSync,b as createFeatureClient,T as createFunnelProcess,L as createLocalFunnelClient,F as createLongplayReactNative};
1
+ import{b as S,c as E,d as T}from"./chunk-IHAMRL3F.js";import"./chunk-ZBV6DOEY.js";import{a as A}from"./chunk-7RBU7UEU.js";import{e as P}from"./chunk-CAOUMQZ6.js";import"./chunk-N6RBDJ5Y.js";import{h as b,i as x,k as L}from"./chunk-CDFRRXSQ.js";import{E as C}from"./chunk-IEKRWGRV.js";import"./chunk-D7SPHHSF.js";import"./chunk-5MPALDJL.js";import"./chunk-SQMA5YYI.js";import"./chunk-BN6UIKEV.js";import"./chunk-IB6BBGLM.js";import"./chunk-OZ32ZMZZ.js";import"./chunk-YXD5B3UB.js";import"./chunk-JXVZK3RZ.js";import"./chunk-6NDL2ELB.js";import"./chunk-6FWT2BXF.js";import"./chunk-LZYQA3Q4.js";import"./chunk-DLLC7CRI.js";import"./chunk-CW7MTKXP.js";import"./chunk-VZMLPENL.js";import"./chunk-HEPQNLR2.js";import"./chunk-VILB5M4X.js";import"./chunk-HXWWH644.js";import"./chunk-L6XCRIR2.js";import"./chunk-LUYWRWJ2.js";import"./chunk-EDZJ2IGA.js";import"./chunk-2HIWXIJE.js";import"./chunk-T44KC4GO.js";import"./chunk-LWIBARE4.js";import"./chunk-TJRXWGKB.js";import{a as r}from"./chunk-5X7PTCI4.js";import{h as R}from"./chunk-XX5O7H6R.js";import"./chunk-3VUPVXAV.js";import"./chunk-NJNENW5L.js";import"./chunk-5MRSFLQA.js";import"./chunk-J6MYX7WY.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";function k(t,d){let n,a=0,m=-1,l,i=!1,y=()=>{if(i)throw new r("CLOSED","Native host was destroyed");if(!t.nativeModule)throw new r("CAPABILITY_UNAVAILABLE","Link IndianaBridge and supply nativeModule");return t.nativeModule},o=()=>new r("IDENTITY_CHANGED","Customer identity changed during the native operation"),h=d.subscribeIdentity(()=>{a++,m=-1;let e=a;n&&t.nativeModule&&n.then(c=>t.nativeModule.reset(c,e)).catch(()=>{})}),I=t.nativeEvents?.(e=>{!n||!t.nativeModule||typeof e?.requestId!="string"||(async()=>{let c=await n;if(e.instanceId!==c)return;if(e.kind==="credential"){let w=a,f=null;try{if(!i&&e.revision===w){let N=await d.access();!i&&a===w&&(f=N)}}finally{await t.nativeModule.provideCredential(c,e.requestId,f)}return}let s=!1,u=a;try{if(i||e.revision!==u||!t.onNativeAction)throw o();await t.onNativeAction(e.action),s=!i&&a===u}finally{await t.nativeModule.acknowledge(c,e.requestId,s)}})().catch(()=>{})});async function p(e,c={}){let s=y();if(d.snapshot()&&!t.nativeEvents)throw new r("CAPABILITY_UNAVAILABLE","Supply nativeEvents to share credential refresh with the native host");let u=a,w=await d.access();if(i||a!==u)throw o();if(!n){let v=s.create(JSON.stringify({baseUrl:t.baseUrl??"https://api.longplayai.com",scope:t.scope,timeout:(t.timeoutMs??15e3)/1e3,credentialEvents:!!t.nativeEvents}));n=v,v.catch(()=>{n===v&&(n=void 0)})}let f=await n;if(i||a!==u)throw o();if(m!==u){if(!l||l.epoch!==u){let O=(async()=>{if(await s.identify(f,JSON.stringify({revision:u,credentials:w})),i||a!==u)throw await s.reset(f,u),o();m=u})();l={epoch:u,task:O}}let v=l;try{await v.task}finally{l===v&&(l=void 0)}}let N=await s.invoke(f,e,JSON.stringify(c));if(i||a!==u)throw o();try{return JSON.parse(N)}catch{throw new r("INVALID_RESPONSE","Native host returned invalid JSON")}}async function g(e,c){let s=await p(e,c);if(!s||typeof s!="object"||Array.isArray(s)||s.status!=="complete"&&s.status!=="dismissed")throw new r("INVALID_RESPONSE","Native presentation returned an invalid result");return s}return{showFunnel(e){return g("showFunnel",{runToken:e})},showPaywall(e){return g("showPaywall",e)},showContent(e){return g("showContent",e)},purchaseSubscription(e,c){return p("purchaseSubscription",{operationId:e,accepted:c})},switchSubscription(e,c){return p("switchSubscription",{operationId:e,accepted:c})},restorePurchases(){return p("restorePurchases")},manageSubscriptions(e){return p("manageSubscriptions",e?{productId:e}:{})},async dismiss(){a++,m=-1,n&&await y().reset(await n,a)},async destroy(){i||(i=!0,a++,h(),I?.(),n&&t.nativeModule&&await t.nativeModule.destroy(await n))}}}var M=P.trackUsage.request.shape.command,U=P.trackUsage.response;function F(t){let d=R.parse(t.scope),n=S({...t,scope:d}),a={...t,scope:d,session:n.session},m=k(t,n.session),l=0,i=!1;n.subscribeIdentity(()=>{l++});let y=()=>{if(i)throw new r("CLOSED","SDK client was destroyed");let o=n.session.peek();if(!o)throw new r("UNAUTHENTICATED","Identify the Customer first");return o};return{...n,native:m,async destroy(){i||(i=!0,l++,n.destroy(),await m.destroy())},funnel(){return E({...a,customerToken:y()})},resumeFunnel(o){return y(),C({...a,runToken:o})},paywall(o){return A(a,{...o,customerToken:y()})},async trackUsage(o){if(y(),!t.usageReporter)throw new r("INVALID_REQUEST","Configure your authenticated backend usageReporter");let h=M.parse(o),I=l,p;try{p=await t.usageReporter(h)}catch(e){throw I!==l?new r("IDENTITY_CHANGED","Customer identity changed during usage reporting"):e}if(I!==l)throw new r("IDENTITY_CHANGED","Customer identity changed during usage reporting");let g=U.parse(p);if(g.scope.projectId!==d.projectId||g.scope.environment!==d.environment)throw new r("INVALID_RESPONSE","Usage response scope differs");return g}}}export{r as LongplayError,x as createConfigurationSync,b as createFeatureClient,T as createFunnelProcess,L as createLocalFunnelClient,F as createLongplayReactNative};
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-FVYB2P6Y.js";import"./chunk-FWM3577O.js";import"./chunk-EDZJ2IGA.js";import"./chunk-2HIWXIJE.js";import"./chunk-T44KC4GO.js";import"./chunk-LWIBARE4.js";import"./chunk-TJRXWGKB.js";import"./chunk-5X7PTCI4.js";import"./chunk-XX5O7H6R.js";import"./chunk-J6MYX7WY.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};
package/dist/server.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as pn}from"./chunk-PBPKZLMG.js";import{a as I}from"./chunk-CLV4ROBM.js";import{a as fn,b as hn,c as gn,d as yn}from"./chunk-STASMAS7.js";import{a as xt}from"./chunk-6JCM2PSZ.js";import{a as Ue,b as Ve,c as qe,d as He,e as m}from"./chunk-SHJUMRYM.js";import"./chunk-KCRL2BDG.js";import{a as Te,b as ae,c as yt,d as It,e as wt,f as xe,g as vt,h as Me,i as dn,j as ln,k as mn}from"./chunk-TULPOZKV.js";import{B as V,C as N,d as ft,e as ht,k as gt,l as z,m as St,p as Ct,q as Rt,r as bt,s as At,t as Ot,y as pe,z as Tt}from"./chunk-SGI3Q2DQ.js";import"./chunk-BB6PDBS4.js";import{c as h}from"./chunk-YMTCZWZG.js";import"./chunk-464CINQK.js";import"./chunk-EQJIC52H.js";import"./chunk-3ZYWGEBY.js";import{a as Et,b as _e}from"./chunk-B7CFFTJI.js";import"./chunk-OJ4VMUMS.js";import"./chunk-DMMD4TMS.js";import{e as at}from"./chunk-Q6SK6G7T.js";import{B as pt,C as de,D as Z,E as lt,J as mt,a as et,e as q,j as Re,k as st,l as ct,q as ut,r as dt,s as be,t as Ae}from"./chunk-LYTPUZOW.js";import"./chunk-TZTWXL53.js";import"./chunk-H3LBNH34.js";import{A as W,B as oe,C as tt,D as Se,E as ie,G as se,H as Ce,M as j,O as ce,P as nt,R as Ee,S as rt,T as ot,f as Ge,g as je,j as we,r as ze,s as Ke,u as an,v as sn,y as cn,z as X}from"./chunk-DRCBHEC6.js";import{b as Oe}from"./chunk-RM6RSLKI.js";import{e as ve,i as Ze,l as it}from"./chunk-TQKNQGWV.js";import"./chunk-VILB5M4X.js";import"./chunk-CJJ4R645.js";import"./chunk-47SYSZJP.js";import{a as Ne,b as Le}from"./chunk-66SRWQES.js";import{o as ue}from"./chunk-SUUBL2WC.js";import"./chunk-4G52SO64.js";import{i as un,k as $e,l as Qe,m as Je}from"./chunk-CWBL2S3A.js";import{c as Ie}from"./chunk-X6ZYJHX4.js";import{e as Xe,h as We}from"./chunk-FINCNJBH.js";import{a as c}from"./chunk-E4B7243C.js";import{h as Y}from"./chunk-5SNUVXZ7.js";import"./chunk-3VUPVXAV.js";import"./chunk-ENZRUXTJ.js";import"./chunk-5MRSFLQA.js";import{b as u}from"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import{a as Ye}from"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var _t=4,Mt=[...tt,"requirement_checks","native_offers","preparations","benefit_claims","authorizations","business_results","checkout_termination"],In=u.enum(Mt),ee=(e,n)=>u.array(e).max(n).refine(t=>new Set(t).size===t.length,"Declarations must be unique"),ke=u.strictObject({...se.shape,bridgeVersion:u.literal(_t),capabilities:ee(In,Mt.length),checkKinds:ee(u.enum(["access","metered","credit"]),3),preparationActions:ee(u.enum(["purchase","subscription_change","refund"]),3),authorizationKinds:ee(u.enum(["auto_topup"]),1),nextActionTypes:ee(u.enum(["redirect","authenticate"]),2),resultEvents:ee(u.enum(["benefit.claimed","authorization.updated"]),2)}).superRefine((e,n)=>{e.capabilities.includes("catalog")!==(e.catalog!=="none")&&n.addIssue({code:"custom",path:["catalog"],message:"Catalog declaration differs from its capability"}),(e.capabilities.includes("billing_records")!==e.billingEvents.length>0||new Set(e.billingEvents).size!==e.billingEvents.length)&&n.addIssue({code:"custom",path:["billingEvents"],message:"Declare unique supported billing events"});let t=r=>e.capabilities.includes(r),o=(r,a)=>n.addIssue({code:"custom",path:[r],message:a});t("requirement_checks")!==e.checkKinds.length>0&&o("checkKinds","Declare the supported Check kinds"),t("preparations")!==e.preparationActions.length>0&&o("preparationActions","Declare the supported preparation actions"),t("authorizations")!==e.authorizationKinds.length>0&&o("authorizationKinds","Declare the supported authorization kinds"),t("business_results")!==e.resultEvents.length>0&&o("resultEvents","Declare the supported non-financial results");for(let[r,a,s]of[["purchases","purchase","purchase.completed"],["subscription_changes","subscription_change","subscription.change.completed"],["refunds","refund","refund.updated"]])t(r)&&(!t("operation_status")||!t("billing_records")||!t("preparations")||!e.preparationActions.includes(a)||!e.billingEvents.includes(s))&&o("capabilities",`${r} requires preparation, original lookup and its billing result`);t("purchases")&&!e.billingEvents.includes("purchase.closed")&&o("billingEvents","Purchase execution requires its terminal closure result"),t("checkout_termination")&&(!t("operation_status")||!t("billing_records")||!e.billingEvents.includes("purchase.closed"))&&o("capabilities","Checkout termination requires original lookup and purchase.closed"),t("subscription_changes")&&!e.billingEvents.includes("subscription.change.closed")&&o("billingEvents","Subscription change execution requires its terminal closure result");for(let[r,a]of[["benefit_claims","benefit.claimed"],["authorizations","authorization.updated"]])t(r)&&(!t("operation_status")||!t("business_results")||!e.resultEvents.includes(a))&&o("capabilities",`${r} requires original lookup and its non-financial result`)}),K={"bridge.ping":u.strictObject({challenge:u.uuid()}),"bridge.describe":u.strictObject({}),"requirement.check":$e,"operation.prepare":ze,"benefit.claim":Ue,"operation.read":qe,"purchase.terminate":j},wn={"bridge.ping":u.strictObject({challenge:u.uuid()}),"bridge.describe":ke,"requirement.check":Qe,"operation.prepare":Ke,"benefit.claim":Ve,"operation.read":He,"purchase.terminate":j.extend({outcome:u.enum(["requested","already_paid"])})},Gn=u.enum(["bridge.ping","bridge.describe","requirement.check","operation.prepare","benefit.claim","operation.read","purchase.terminate"]);function $(e,n){return u.strictObject({bridgeVersion:u.literal(_t),requestId:u.uuid(),scope:Ce,command:u.literal(e),data:n})}var kt=u.discriminatedUnion("command",[$("bridge.ping",K["bridge.ping"]),$("bridge.describe",K["bridge.describe"]),$("requirement.check",K["requirement.check"]),$("operation.prepare",K["operation.prepare"]),$("benefit.claim",K["benefit.claim"]),$("operation.read",K["operation.read"]),$("purchase.terminate",K["purchase.terminate"])]),Be=u.strictObject({code:u.string().regex(/^MERCHANT_BRIDGE_[A-Z_]+$/),message:u.string().min(1).max(500),retryable:u.boolean(),recovery:u.string().min(1).max(80),effect:u.enum(["none","unknown"])}).refine(e=>e.effect!=="unknown"||!e.retryable&&e.recovery==="recover_operation","Unknown effects require original-operation recovery");function Bt(e){let n={bridgeVersion:u.literal(4),requestId:u.uuid(),scope:Ce,command:u.literal(e)};return u.union([u.strictObject({...n,data:wn[e]}),u.strictObject({...n,error:Be})])}var Pt="X-Indiana-Bridge-Signature",Q="X-Indiana-Bridge-Key-Id";function vn(e){return new TextEncoder().encode(e)}function Dt(e){return Uint8Array.from(atob(e.replaceAll("-","+").replaceAll("_","/")),n=>n.charCodeAt(0))}function Ft(e,n,t,o){return vn(`indiana-merchant-bridge:${o}
1
+ import{a as pn}from"./chunk-E773KSFH.js";import{a as I}from"./chunk-BSPJMJDI.js";import{a as fn,b as hn,c as gn,d as yn}from"./chunk-R4ETTZ2H.js";import{a as xt}from"./chunk-7RBU7UEU.js";import{a as Ue,b as Ve,c as qe,d as He,e as m}from"./chunk-CAOUMQZ6.js";import"./chunk-N6RBDJ5Y.js";import{a as Te,b as ae,c as yt,d as It,e as wt,f as xe,g as vt,h as Me,i as dn,j as ln,k as mn}from"./chunk-CDFRRXSQ.js";import{B as V,C as N,d as ft,e as ht,k as gt,l as z,m as St,p as Ct,q as Rt,r as bt,s as At,t as Ot,y as pe,z as Tt}from"./chunk-IEKRWGRV.js";import"./chunk-D7SPHHSF.js";import{c as h}from"./chunk-5MPALDJL.js";import"./chunk-SQMA5YYI.js";import"./chunk-BN6UIKEV.js";import"./chunk-IB6BBGLM.js";import{a as Et,b as _e}from"./chunk-OZ32ZMZZ.js";import"./chunk-YXD5B3UB.js";import"./chunk-JXVZK3RZ.js";import{e as at}from"./chunk-6NDL2ELB.js";import{B as pt,C as de,D as Z,E as lt,J as mt,a as et,e as q,j as Re,k as st,l as ct,q as ut,r as dt,s as be,t as Ae}from"./chunk-6FWT2BXF.js";import"./chunk-LZYQA3Q4.js";import"./chunk-DLLC7CRI.js";import{A as W,B as oe,C as tt,D as Se,E as ie,G as se,H as Ce,M as j,O as ce,P as nt,R as Ee,S as rt,T as ot,f as Ge,g as je,j as we,r as ze,s as Ke,u as an,v as sn,y as cn,z as X}from"./chunk-CW7MTKXP.js";import{b as Oe}from"./chunk-VZMLPENL.js";import{e as ve,i as Ze,l as it}from"./chunk-HEPQNLR2.js";import"./chunk-VILB5M4X.js";import"./chunk-HXWWH644.js";import"./chunk-L6XCRIR2.js";import{a as Ne,b as Le}from"./chunk-LUYWRWJ2.js";import{o as ue}from"./chunk-EDZJ2IGA.js";import"./chunk-2HIWXIJE.js";import{i as un,k as $e,l as Qe,m as Je}from"./chunk-T44KC4GO.js";import{c as Ie}from"./chunk-LWIBARE4.js";import{e as Xe,h as We}from"./chunk-TJRXWGKB.js";import{a as c}from"./chunk-5X7PTCI4.js";import{h as Y}from"./chunk-XX5O7H6R.js";import"./chunk-3VUPVXAV.js";import"./chunk-NJNENW5L.js";import"./chunk-5MRSFLQA.js";import{b as u}from"./chunk-J6MYX7WY.js";import"./chunk-DSPLGTQI.js";import{a as Ye}from"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var _t=4,Mt=[...tt,"requirement_checks","native_offers","preparations","benefit_claims","authorizations","business_results","checkout_termination"],In=u.enum(Mt),ee=(e,n)=>u.array(e).max(n).refine(t=>new Set(t).size===t.length,"Declarations must be unique"),ke=u.strictObject({...se.shape,bridgeVersion:u.literal(_t),capabilities:ee(In,Mt.length),checkKinds:ee(u.enum(["access","metered","credit"]),3),preparationActions:ee(u.enum(["purchase","subscription_change","refund"]),3),authorizationKinds:ee(u.enum(["auto_topup"]),1),nextActionTypes:ee(u.enum(["redirect","authenticate"]),2),resultEvents:ee(u.enum(["benefit.claimed","authorization.updated"]),2)}).superRefine((e,n)=>{e.capabilities.includes("catalog")!==(e.catalog!=="none")&&n.addIssue({code:"custom",path:["catalog"],message:"Catalog declaration differs from its capability"}),(e.capabilities.includes("billing_records")!==e.billingEvents.length>0||new Set(e.billingEvents).size!==e.billingEvents.length)&&n.addIssue({code:"custom",path:["billingEvents"],message:"Declare unique supported billing events"});let t=r=>e.capabilities.includes(r),o=(r,a)=>n.addIssue({code:"custom",path:[r],message:a});t("requirement_checks")!==e.checkKinds.length>0&&o("checkKinds","Declare the supported Check kinds"),t("preparations")!==e.preparationActions.length>0&&o("preparationActions","Declare the supported preparation actions"),t("authorizations")!==e.authorizationKinds.length>0&&o("authorizationKinds","Declare the supported authorization kinds"),t("business_results")!==e.resultEvents.length>0&&o("resultEvents","Declare the supported non-financial results");for(let[r,a,s]of[["purchases","purchase","purchase.completed"],["subscription_changes","subscription_change","subscription.change.completed"],["refunds","refund","refund.updated"]])t(r)&&(!t("operation_status")||!t("billing_records")||!t("preparations")||!e.preparationActions.includes(a)||!e.billingEvents.includes(s))&&o("capabilities",`${r} requires preparation, original lookup and its billing result`);t("purchases")&&!e.billingEvents.includes("purchase.closed")&&o("billingEvents","Purchase execution requires its terminal closure result"),t("checkout_termination")&&(!t("operation_status")||!t("billing_records")||!e.billingEvents.includes("purchase.closed"))&&o("capabilities","Checkout termination requires original lookup and purchase.closed"),t("subscription_changes")&&!e.billingEvents.includes("subscription.change.closed")&&o("billingEvents","Subscription change execution requires its terminal closure result");for(let[r,a]of[["benefit_claims","benefit.claimed"],["authorizations","authorization.updated"]])t(r)&&(!t("operation_status")||!t("business_results")||!e.resultEvents.includes(a))&&o("capabilities",`${r} requires original lookup and its non-financial result`)}),K={"bridge.ping":u.strictObject({challenge:u.uuid()}),"bridge.describe":u.strictObject({}),"requirement.check":$e,"operation.prepare":ze,"benefit.claim":Ue,"operation.read":qe,"purchase.terminate":j},wn={"bridge.ping":u.strictObject({challenge:u.uuid()}),"bridge.describe":ke,"requirement.check":Qe,"operation.prepare":Ke,"benefit.claim":Ve,"operation.read":He,"purchase.terminate":j.extend({outcome:u.enum(["requested","already_paid"])})},Gn=u.enum(["bridge.ping","bridge.describe","requirement.check","operation.prepare","benefit.claim","operation.read","purchase.terminate"]);function $(e,n){return u.strictObject({bridgeVersion:u.literal(_t),requestId:u.uuid(),scope:Ce,command:u.literal(e),data:n})}var kt=u.discriminatedUnion("command",[$("bridge.ping",K["bridge.ping"]),$("bridge.describe",K["bridge.describe"]),$("requirement.check",K["requirement.check"]),$("operation.prepare",K["operation.prepare"]),$("benefit.claim",K["benefit.claim"]),$("operation.read",K["operation.read"]),$("purchase.terminate",K["purchase.terminate"])]),Be=u.strictObject({code:u.string().regex(/^MERCHANT_BRIDGE_[A-Z_]+$/),message:u.string().min(1).max(500),retryable:u.boolean(),recovery:u.string().min(1).max(80),effect:u.enum(["none","unknown"])}).refine(e=>e.effect!=="unknown"||!e.retryable&&e.recovery==="recover_operation","Unknown effects require original-operation recovery");function Bt(e){let n={bridgeVersion:u.literal(4),requestId:u.uuid(),scope:Ce,command:u.literal(e)};return u.union([u.strictObject({...n,data:wn[e]}),u.strictObject({...n,error:Be})])}var Pt="X-Indiana-Bridge-Signature",Q="X-Indiana-Bridge-Key-Id";function vn(e){return new TextEncoder().encode(e)}function Dt(e){return Uint8Array.from(atob(e.replaceAll("-","+").replaceAll("_","/")),n=>n.charCodeAt(0))}function Ft(e,n,t,o){return vn(`indiana-merchant-bridge:${o}
2
2
  ${n}
3
3
  POST
4
4
  ${W}
package/dist/visual.js CHANGED
@@ -1 +1 @@
1
- import{a as pe,c as fe}from"./chunk-OJM6ORHE.js";import{b as le}from"./chunk-J6KIN4RH.js";import{a as Ve,b as ce,c as de,d as ue}from"./chunk-SLUA7ABW.js";import{a as J,b as F,c as ge,e as me}from"./chunk-FSHGHFU4.js";import{a as re,b as ae,c as se,d as oe}from"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-ENZRUXTJ.js";import"./chunk-5MRSFLQA.js";import{b as o}from"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import{c as te,e as ie,g as M}from"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var K="indiana-visual-diagnostics-v1",Ae=o.strictObject({environmentId:o.string().uuid(),release:o.string().regex(/^[a-f0-9]{64}$/).nullable(),generation:o.string().regex(/^[a-f0-9]{64}$/).nullable(),publishedGeneration:o.string().regex(/^[a-f0-9]{64}$/).nullable(),checkedAt:o.string().datetime(),origin:o.string().url(),pathname:o.string().max(2048),urlMatches:o.boolean(),stopped:o.boolean(),rows:o.array(o.strictObject({changeId:o.string().regex(/^[a-f0-9]{64}$/),experimentKey:o.string().max(256),variationKey:o.string().max(256),inExperiment:o.boolean(),fingerprint:o.string().regex(/^[a-f0-9]{64}$/),status:o.enum(["inactive","waiting","partial","applied","mismatch","no_changes","unavailable","error"]),total:o.number().int().min(0).max(600),applied:o.number().int().min(0).max(600)})).max(100)});function ye(e){let l=n=>Array.isArray(n)?"["+n.map(l).join(",")+"]":n&&typeof n=="object"?"{"+Object.entries(n).filter(([,c])=>c!==void 0).sort(([c],[y])=>c.localeCompare(y)).map(([c,y])=>JSON.stringify(c)+":"+l(y)).join(",")+"}":JSON.stringify(n);return l({css:e.css,js:e.js,domMutations:e.domMutations,...e.renderGuard?{renderGuard:e.renderGuard}:{}})}function he(e){let l=new URL(e.baseUrl),n=l.origin==="https://api.longplayai.com"||l.origin==="https://api.dev.longplayai.com"?l.hostname.slice(4):void 0,c=e.origins??(n?[`https://console.${n}`]:[]),y=new Set(c.filter(t=>{try{let i=new URL(t);return i.origin===t&&(i.protocol==="https:"||i.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(i.hostname))}catch{return!1}})),v=!1,I=!1,k=0,T=async t=>{if(v||I||!t.source||!y.has(t.origin)||!t.data||typeof t.data!="object")return;let i=t.data;if(!(i.channel!==K||i.type!=="inspect"||i.environmentId!==e.environmentId||typeof i.nonce!="string"||!/^[a-f0-9-]{36}$/i.test(i.nonce)||typeof i.changeId!="string"||!/^[a-f0-9]{64}$/.test(i.changeId)||typeof i.url!="string"||i.url.length>2048||Date.now()-k<250)){try{if(new URL(i.url).origin!==location.origin)return}catch{return}I=!0,k=Date.now();try{let x=await e.inspect(i.changeId,i.url);!v&&x.rows.some(S=>S.changeId===i.changeId)&&t.source.postMessage({channel:K,type:"result",nonce:i.nonce,snapshot:x},t.origin)}finally{I=!1}}},u=t=>{T(t).catch(()=>{})};return window.addEventListener("message",u),()=>{v=!0,window.removeEventListener("message",u)}}var R=e=>!!e&&typeof e=="object"&&!Array.isArray(e),E=(e,l)=>typeof e=="string"&&e.length<=l,Ee=e=>typeof e=="string"&&(["html","class","style","position","href","src","alt","title","id","role","hidden"].includes(e)||/^(aria|data)-[a-z0-9_-]+$/.test(e));function ke(e){if(!R(e)||!E(e.css??"",1e5)||!E(e.js??"",1e5)||!Array.isArray(e.domMutations??[])||Array.isArray(e.domMutations)&&e.domMutations.length>200)throw new Error("Invalid visual variation");let l=e.domMutations??[];for(let n of l)if(!R(n)||!E(n.selector,2048)||!n.selector||!Ee(n.attribute)||!["set","append","remove"].includes(String(n.action))||n.value!==void 0&&!E(n.value,5e4)||n.parentSelector!==void 0&&!E(n.parentSelector,2048)||n.insertBeforeSelector!==void 0&&!E(n.insertBeforeSelector,2048))throw new Error("Invalid visual mutation");return{css:e.css??"",js:e.js??"",domMutations:l,...e.renderGuard===void 0?{}:{renderGuard:le(e.renderGuard)}}}function q(e){if(!R(e)||typeof e.environmentId!="string"||typeof e.trackExposures!="boolean"||!/^[-a-f0-9]{36}$/i.test(e.environmentId)||typeof e.generation!="string"||!/^[a-f0-9]{64}$/.test(e.generation)||!Array.isArray(e.experiments)||e.experiments.length>100||!R(e.savedGroups))throw new Error("Invalid visual experiment payload");let l=e.experiments.map(n=>{if(!R(n)||!["key","changeId"].every(c=>typeof n[c]=="string"&&n[c])||!/^[a-f0-9]{64}$/.test(String(n.changeId))||["namespace","status","groups","url"].some(c=>Object.hasOwn(n,c))||n.hashVersion!==void 0&&n.hashVersion!==2||!Array.isArray(n.variations)||n.variations.length<2||n.variations.length>20||n.urlPatterns!==void 0&&!Array.isArray(n.urlPatterns))throw new Error("Invalid visual experiment");return{...n,variations:n.variations.map(ke)}});return{...e,experiments:l}}var ve=6e4;function qe(e){let l=se(e.baseUrl);if(e.appManifestRelease!==void 0&&!/^[a-f0-9]{64}$/.test(e.appManifestRelease))throw new Error("Invalid IAM manifest digest");if(!/^[0-9a-f-]{36}$/i.test(e.environmentId))throw new Error("Invalid App environment ID");let n=e.fetch??globalThis.fetch.bind(globalThis),c=F(n),y=F(n),v=`${l}/api/v1/visual-experiments/${e.environmentId}`,I=e.appManifestRelease?`${v}?iam=${e.appManifestRelease}`:v,k=re(e.deviceIdCookie??"indiana_did"),T=ae(),u=null,t=!1,i=!1,x="",S={...e.attributes??{}},G,B,D=0,H=-1/0,$,m=new Map,O=new Map,C=new Set,z=ge({endpoint:`${v}/events`,fetch:n,log:e.log,label:"Visual exposure"}),P=z.flush,W,b;function j(){clearTimeout(W),b?.remove(),b=void 0}function Y(s,d){let f=M(s,d);C.has(f)||e.trackExposures===!1||u?.trackExposures===!1||t||(C.add(f),z.push({eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),deviceId:k,...T?{sessionId:T}:{},url:location.href,pageTitle:document.title.slice(0,512),experimentKey:s.key,variationKey:d.key}))}function we(s){if(!u||t)return;let d=new Set,f={onExperimentViewed:(r,p)=>{d.add(M(r,p))},url:location.href,attributes:{...me(k,location),...S,indianaAppManifestRelease:e.appManifestRelease??null},savedGroups:te(u.savedGroups),log:e.log},h=new Set;for(let r of u.experiments){if(de(`${e.environmentId}:${r.key}`))continue;let p=r;try{let a=ie(p,f);if(O.set(r.changeId,a),!a.inExperiment)continue;h.add(r.changeId);let w=JSON.stringify([a.key,a.value]),U=m.get(r.changeId);if(U?.signature===w){d.has(M(p,a))&&s.push(()=>{U.applied()&&Y(p,a)});continue}m.get(r.changeId)?.revert(),m.delete(r.changeId);let A=fe(a.value,{requireUniqueTargets:!!e.appManifestRelease&&Array.isArray(r.condition?.$and)&&r.condition.$and.some(g=>g!==null&&typeof g=="object"&&!Array.isArray(g)&&g.indianaAppManifestRelease===e.appManifestRelease),boundVariations:r.variations,allowJs:e.disableJsInjection===!1,nonce:e.nonce,onApplied:()=>{d.has(M(p,a))&&Y(p,a)},onError:g=>e.log?.("Visual experiment stopped",{experiment:r.key,changeId:r.changeId,variation:a.key,error:String(g)}),onTargetStatus:e.log?g=>e.log?.("Visual target status changed",{experiment:r.key,changeId:r.changeId,variation:a.key,...g}):void 0});m.set(r.changeId,{signature:w,revert:A.revert,applied:()=>A.applied,inspect:()=>A.inspect()})}catch(a){e.log?.("Skipping visual experiment",{experiment:r.key,error:String(a)})}}for(let[r,p]of m)h.has(r)||(p.revert(),m.delete(r));j()}let V=()=>{let s=[];pe(()=>we(s));for(let d of s)d()};async function _(){let s=++D,d;try{d=await c.read(I,J)}catch(h){if(t||s!==D)return!1;throw h}let f=q(d);if(f.environmentId.toLowerCase()!==e.environmentId.toLowerCase())throw new Error("Visual payload scope changed");return t||s!==D?!1:(u=f,H=performance.now(),!0)}async function Q(){!await _()||t||(N(),V())}function L(){clearTimeout($),$=setTimeout(()=>{if(document.visibilityState==="hidden")return L();Q().catch(s=>e.log?.("Visual payload refresh failed",{error:String(s)})).finally(()=>{t||L()})},ve)}let X=()=>{t||document.visibilityState==="hidden"||performance.now()-H<ve||(clearTimeout($),Q().catch(s=>e.log?.("Visual payload refresh failed",{error:String(s)})).finally(()=>{t||L()}))},Ie=()=>{x!==location.href&&(x=location.href,V())},Z=()=>{P(!0)},N=()=>{G||t||(G=oe(Ie),addEventListener("pagehide",Z),x=location.href)};async function ee(s,d){let f=location.href,h=u,r=[],p=null;if(!t)try{let a=q(await y.read(I,J));a.environmentId===e.environmentId&&(p=a.generation)}catch{}for(let a of h?.experiments??[]){if(s&&a.changeId!==s)continue;let w=O.get(a.changeId);if(!w)continue;let U=new TextEncoder().encode(ye(w.value)),A=[...new Uint8Array(await crypto.subtle.digest("SHA-256",U))].map(be=>be.toString(16).padStart(2,"0")).join(""),g=m.get(a.changeId)?.inspect()??{status:"inactive",total:0,applied:0};r.push({changeId:a.changeId,experimentKey:a.key,variationKey:w.key,inExperiment:w.inExperiment,fingerprint:A,...g})}return{environmentId:e.environmentId,release:e.appManifestRelease??null,generation:h?.generation??null,publishedGeneration:p,checkedAt:new Date().toISOString(),origin:location.origin,pathname:location.pathname,urlMatches:location.href===f&&(!d||d===f)&&h===u,stopped:t,rows:r}}let ne,xe=ue(()=>{i&&!t&&V()});return{async start(){if(!(i||t)){i=!0,e.appManifestRelease&&(B=ce(e.appManifestRelease)),e.antiFlicker&&(b=document.createElement("style"),e.nonce&&(b.nonce=e.nonce),b.textContent="body { visibility: hidden !important }",document.head.append(b),W=setTimeout(j,Math.min(3e3,Math.max(0,e.antiFlickerTimeout??1e3))));try{if(!await _()||t)return;N(),V()}finally{j(),t||(L(),document.addEventListener("visibilitychange",X),ne=he({environmentId:e.environmentId,baseUrl:l,origins:e.diagnosticsOrigins,inspect:ee}))}}},async refresh(){t||await _()&&(i&&N(),V())},setAttributes(s){S={...s},V()},flush:()=>P(),getDiagnostics:ee,getResults(){return new Map(O)},get generation(){return u?.generation??null},destroy(){t=!0,clearTimeout($),document.removeEventListener("visibilitychange",X),xe(),ne?.(),D++,c.destroy(),y.destroy(),G?.(),B?.destroy(),removeEventListener("pagehide",Z),j();for(let s of m.values())s.revert();m.clear(),P(!0),u=null,O.clear(),C.clear(),S={}}}}export{qe as createVisualExperiments,Ve as loadAppManifestRelease};
1
+ import{a as pe,c as fe}from"./chunk-OJM6ORHE.js";import{b as le}from"./chunk-J6KIN4RH.js";import{a as Ve,b as ce,c as de,d as ue}from"./chunk-SLUA7ABW.js";import{a as J,b as F,c as ge,e as me}from"./chunk-HXXUZ6RR.js";import{a as re,b as ae,c as se,d as oe}from"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-NJNENW5L.js";import"./chunk-5MRSFLQA.js";import{b as o}from"./chunk-J6MYX7WY.js";import"./chunk-DSPLGTQI.js";import{c as te,e as ie,g as M}from"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var K="indiana-visual-diagnostics-v1",Ae=o.strictObject({environmentId:o.string().uuid(),release:o.string().regex(/^[a-f0-9]{64}$/).nullable(),generation:o.string().regex(/^[a-f0-9]{64}$/).nullable(),publishedGeneration:o.string().regex(/^[a-f0-9]{64}$/).nullable(),checkedAt:o.string().datetime(),origin:o.string().url(),pathname:o.string().max(2048),urlMatches:o.boolean(),stopped:o.boolean(),rows:o.array(o.strictObject({changeId:o.string().regex(/^[a-f0-9]{64}$/),experimentKey:o.string().max(256),variationKey:o.string().max(256),inExperiment:o.boolean(),fingerprint:o.string().regex(/^[a-f0-9]{64}$/),status:o.enum(["inactive","waiting","partial","applied","mismatch","no_changes","unavailable","error"]),total:o.number().int().min(0).max(600),applied:o.number().int().min(0).max(600)})).max(100)});function ye(e){let l=n=>Array.isArray(n)?"["+n.map(l).join(",")+"]":n&&typeof n=="object"?"{"+Object.entries(n).filter(([,c])=>c!==void 0).sort(([c],[y])=>c.localeCompare(y)).map(([c,y])=>JSON.stringify(c)+":"+l(y)).join(",")+"}":JSON.stringify(n);return l({css:e.css,js:e.js,domMutations:e.domMutations,...e.renderGuard?{renderGuard:e.renderGuard}:{}})}function he(e){let l=new URL(e.baseUrl),n=l.origin==="https://api.longplayai.com"||l.origin==="https://api.dev.longplayai.com"?l.hostname.slice(4):void 0,c=e.origins??(n?[`https://console.${n}`]:[]),y=new Set(c.filter(t=>{try{let i=new URL(t);return i.origin===t&&(i.protocol==="https:"||i.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(i.hostname))}catch{return!1}})),v=!1,I=!1,k=0,T=async t=>{if(v||I||!t.source||!y.has(t.origin)||!t.data||typeof t.data!="object")return;let i=t.data;if(!(i.channel!==K||i.type!=="inspect"||i.environmentId!==e.environmentId||typeof i.nonce!="string"||!/^[a-f0-9-]{36}$/i.test(i.nonce)||typeof i.changeId!="string"||!/^[a-f0-9]{64}$/.test(i.changeId)||typeof i.url!="string"||i.url.length>2048||Date.now()-k<250)){try{if(new URL(i.url).origin!==location.origin)return}catch{return}I=!0,k=Date.now();try{let x=await e.inspect(i.changeId,i.url);!v&&x.rows.some(S=>S.changeId===i.changeId)&&t.source.postMessage({channel:K,type:"result",nonce:i.nonce,snapshot:x},t.origin)}finally{I=!1}}},u=t=>{T(t).catch(()=>{})};return window.addEventListener("message",u),()=>{v=!0,window.removeEventListener("message",u)}}var R=e=>!!e&&typeof e=="object"&&!Array.isArray(e),E=(e,l)=>typeof e=="string"&&e.length<=l,Ee=e=>typeof e=="string"&&(["html","class","style","position","href","src","alt","title","id","role","hidden"].includes(e)||/^(aria|data)-[a-z0-9_-]+$/.test(e));function ke(e){if(!R(e)||!E(e.css??"",1e5)||!E(e.js??"",1e5)||!Array.isArray(e.domMutations??[])||Array.isArray(e.domMutations)&&e.domMutations.length>200)throw new Error("Invalid visual variation");let l=e.domMutations??[];for(let n of l)if(!R(n)||!E(n.selector,2048)||!n.selector||!Ee(n.attribute)||!["set","append","remove"].includes(String(n.action))||n.value!==void 0&&!E(n.value,5e4)||n.parentSelector!==void 0&&!E(n.parentSelector,2048)||n.insertBeforeSelector!==void 0&&!E(n.insertBeforeSelector,2048))throw new Error("Invalid visual mutation");return{css:e.css??"",js:e.js??"",domMutations:l,...e.renderGuard===void 0?{}:{renderGuard:le(e.renderGuard)}}}function q(e){if(!R(e)||typeof e.environmentId!="string"||typeof e.trackExposures!="boolean"||!/^[-a-f0-9]{36}$/i.test(e.environmentId)||typeof e.generation!="string"||!/^[a-f0-9]{64}$/.test(e.generation)||!Array.isArray(e.experiments)||e.experiments.length>100||!R(e.savedGroups))throw new Error("Invalid visual experiment payload");let l=e.experiments.map(n=>{if(!R(n)||!["key","changeId"].every(c=>typeof n[c]=="string"&&n[c])||!/^[a-f0-9]{64}$/.test(String(n.changeId))||["namespace","status","groups","url"].some(c=>Object.hasOwn(n,c))||n.hashVersion!==void 0&&n.hashVersion!==2||!Array.isArray(n.variations)||n.variations.length<2||n.variations.length>20||n.urlPatterns!==void 0&&!Array.isArray(n.urlPatterns))throw new Error("Invalid visual experiment");return{...n,variations:n.variations.map(ke)}});return{...e,experiments:l}}var ve=6e4;function qe(e){let l=se(e.baseUrl);if(e.appManifestRelease!==void 0&&!/^[a-f0-9]{64}$/.test(e.appManifestRelease))throw new Error("Invalid IAM manifest digest");if(!/^[0-9a-f-]{36}$/i.test(e.environmentId))throw new Error("Invalid App environment ID");let n=e.fetch??globalThis.fetch.bind(globalThis),c=F(n),y=F(n),v=`${l}/api/v1/visual-experiments/${e.environmentId}`,I=e.appManifestRelease?`${v}?iam=${e.appManifestRelease}`:v,k=re(e.deviceIdCookie??"indiana_did"),T=ae(),u=null,t=!1,i=!1,x="",S={...e.attributes??{}},G,B,D=0,H=-1/0,$,m=new Map,O=new Map,C=new Set,z=ge({endpoint:`${v}/events`,fetch:n,log:e.log,label:"Visual exposure"}),P=z.flush,W,b;function j(){clearTimeout(W),b?.remove(),b=void 0}function Y(s,d){let f=M(s,d);C.has(f)||e.trackExposures===!1||u?.trackExposures===!1||t||(C.add(f),z.push({eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),deviceId:k,...T?{sessionId:T}:{},url:location.href,pageTitle:document.title.slice(0,512),experimentKey:s.key,variationKey:d.key}))}function we(s){if(!u||t)return;let d=new Set,f={onExperimentViewed:(r,p)=>{d.add(M(r,p))},url:location.href,attributes:{...me(k,location),...S,indianaAppManifestRelease:e.appManifestRelease??null},savedGroups:te(u.savedGroups),log:e.log},h=new Set;for(let r of u.experiments){if(de(`${e.environmentId}:${r.key}`))continue;let p=r;try{let a=ie(p,f);if(O.set(r.changeId,a),!a.inExperiment)continue;h.add(r.changeId);let w=JSON.stringify([a.key,a.value]),U=m.get(r.changeId);if(U?.signature===w){d.has(M(p,a))&&s.push(()=>{U.applied()&&Y(p,a)});continue}m.get(r.changeId)?.revert(),m.delete(r.changeId);let A=fe(a.value,{requireUniqueTargets:!!e.appManifestRelease&&Array.isArray(r.condition?.$and)&&r.condition.$and.some(g=>g!==null&&typeof g=="object"&&!Array.isArray(g)&&g.indianaAppManifestRelease===e.appManifestRelease),boundVariations:r.variations,allowJs:e.disableJsInjection===!1,nonce:e.nonce,onApplied:()=>{d.has(M(p,a))&&Y(p,a)},onError:g=>e.log?.("Visual experiment stopped",{experiment:r.key,changeId:r.changeId,variation:a.key,error:String(g)}),onTargetStatus:e.log?g=>e.log?.("Visual target status changed",{experiment:r.key,changeId:r.changeId,variation:a.key,...g}):void 0});m.set(r.changeId,{signature:w,revert:A.revert,applied:()=>A.applied,inspect:()=>A.inspect()})}catch(a){e.log?.("Skipping visual experiment",{experiment:r.key,error:String(a)})}}for(let[r,p]of m)h.has(r)||(p.revert(),m.delete(r));j()}let V=()=>{let s=[];pe(()=>we(s));for(let d of s)d()};async function _(){let s=++D,d;try{d=await c.read(I,J)}catch(h){if(t||s!==D)return!1;throw h}let f=q(d);if(f.environmentId.toLowerCase()!==e.environmentId.toLowerCase())throw new Error("Visual payload scope changed");return t||s!==D?!1:(u=f,H=performance.now(),!0)}async function Q(){!await _()||t||(N(),V())}function L(){clearTimeout($),$=setTimeout(()=>{if(document.visibilityState==="hidden")return L();Q().catch(s=>e.log?.("Visual payload refresh failed",{error:String(s)})).finally(()=>{t||L()})},ve)}let X=()=>{t||document.visibilityState==="hidden"||performance.now()-H<ve||(clearTimeout($),Q().catch(s=>e.log?.("Visual payload refresh failed",{error:String(s)})).finally(()=>{t||L()}))},Ie=()=>{x!==location.href&&(x=location.href,V())},Z=()=>{P(!0)},N=()=>{G||t||(G=oe(Ie),addEventListener("pagehide",Z),x=location.href)};async function ee(s,d){let f=location.href,h=u,r=[],p=null;if(!t)try{let a=q(await y.read(I,J));a.environmentId===e.environmentId&&(p=a.generation)}catch{}for(let a of h?.experiments??[]){if(s&&a.changeId!==s)continue;let w=O.get(a.changeId);if(!w)continue;let U=new TextEncoder().encode(ye(w.value)),A=[...new Uint8Array(await crypto.subtle.digest("SHA-256",U))].map(be=>be.toString(16).padStart(2,"0")).join(""),g=m.get(a.changeId)?.inspect()??{status:"inactive",total:0,applied:0};r.push({changeId:a.changeId,experimentKey:a.key,variationKey:w.key,inExperiment:w.inExperiment,fingerprint:A,...g})}return{environmentId:e.environmentId,release:e.appManifestRelease??null,generation:h?.generation??null,publishedGeneration:p,checkedAt:new Date().toISOString(),origin:location.origin,pathname:location.pathname,urlMatches:location.href===f&&(!d||d===f)&&h===u,stopped:t,rows:r}}let ne,xe=ue(()=>{i&&!t&&V()});return{async start(){if(!(i||t)){i=!0,e.appManifestRelease&&(B=ce(e.appManifestRelease)),e.antiFlicker&&(b=document.createElement("style"),e.nonce&&(b.nonce=e.nonce),b.textContent="body { visibility: hidden !important }",document.head.append(b),W=setTimeout(j,Math.min(3e3,Math.max(0,e.antiFlickerTimeout??1e3))));try{if(!await _()||t)return;N(),V()}finally{j(),t||(L(),document.addEventListener("visibilitychange",X),ne=he({environmentId:e.environmentId,baseUrl:l,origins:e.diagnosticsOrigins,inspect:ee}))}}},async refresh(){t||await _()&&(i&&N(),V())},setAttributes(s){S={...s},V()},flush:()=>P(),getDiagnostics:ee,getResults(){return new Map(O)},get generation(){return u?.generation??null},destroy(){t=!0,clearTimeout($),document.removeEventListener("visibilitychange",X),xe(),ne?.(),D++,c.destroy(),y.destroy(),G?.(),B?.destroy(),removeEventListener("pagehide",Z),j();for(let s of m.values())s.revert();m.clear(),P(!0),u=null,O.clear(),C.clear(),S={}}}}export{qe as createVisualExperiments,Ve as loadAppManifestRelease};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinkerlandai/longplay-sdk",
3
- "version": "0.10.77",
3
+ "version": "0.10.78",
4
4
  "description": "Framework-independent Longplay SDK for customer identity, entitlements, credits, offers and growth surfaces.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-B7CFFTJI.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-E4B7243C.js";import"./chunk-5SNUVXZ7.js";import"./chunk-7RUOZL6C.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as validateEntitlementCheck,b as validateResourceCheck};
@@ -1 +0,0 @@
1
- import{a as ve,b as be}from"./chunk-62MMCXIA.js";import{d as qe,e as ne}from"./chunk-EQJIC52H.js";import{a as Me}from"./chunk-E4B7243C.js";import{a as R}from"./chunk-DSPLGTQI.js";var Xe=5*6e4,$e=15e3,Le=new WeakMap;function an(s){return Le.get(s)}var k=s=>Array.isArray(s)?s.map(k):s&&typeof s=="object"?Object.fromEntries(Object.keys(s).sort().map(n=>[n,k(s[n])])):s,T=(s,n)=>JSON.stringify(k(s))===JSON.stringify(k(n)),re=s=>JSON.stringify(k([s.funnelId,s.locale??null,s.parameters??{}])),Qe=["onObservationChange","onPurchase","onCheckoutUrl","resumeCheckout","allowNewPurchase","checkoutNavigation","terminateCheckout","beforeCheckoutReplacement","purchaseConfirmation","confirmOnHostedCheckout","resolveOfferId","prepareSubscriptionChange","resolveSubscriptionChange","onOpenUrl","onEvent","onAction","onComplete","onError"];function Ye(s,n,S){let O=e=>structuredClone({funnelId:e.funnelId,locale:e.locale,parameters:e.parameters}),m,_="",E=n.start instanceof Promise?void 0:O(n.start),ae=e=>e?.parameters?.commerce,j=Promise.resolve(n.start).then(e=>e?O(e):void 0),te=n.maxAgeMs??Xe,Ie=new AbortController,g=AbortSignal.any([Ie.signal,n.client.identitySignal,...n.signal?[n.signal]:[]]),oe=()=>d("released","aborted"),a="preparing",Se,J,le=()=>{},U=0,b=null,v=null,C=null,p=null,h,x,V,Ce=new Map,P=null,W=new Set,D=new Map,ie,Ae=new Promise(e=>ie=e),G,se=new Promise(e=>G=e),ce,Te=new Promise(e=>ce=e);function K(e,r){a!==e&&(a=e,Se=r,R(n.onState,e))}function je(){g.removeEventListener("abort",oe),X(),v?.destroy(),v=null,b?.remove(),b=null,C=null}function d(e,r){["adopted","unavailable","released","closed"].includes(a)||(K(e,r),je(),ie(!1),G(!1),B(!1),ce(null))}function N(e){a!=="shown"&&d("unavailable",e)}let f,ue=!1,F=n.client.paywallCopies,de,Re=new Promise(e=>de=e),fe=!1,M=!1,ke,z=n.whenPurchasePending==="recover"&&!S,B,Je=new Promise(e=>B=e);function Ue(e){if(!z||f||!e||!p||!V||!A(p,V.commerce)||!["preparing","ready","shown"].includes(a))return!1;let r={savedAt:Date.now(),funnelId:e,context:V,resolution:structuredClone(p)};return f=r,we(r),Z(),!0}function pe(e){return!z||!f||!["preparing","ready","shown"].includes(a)?!1:(M=!0,ke=e,a==="shown"&&_e(),!0)}function _e(){let e=f?.context.locale??n.locale??"";v?.setPurchaseRecovery(e.startsWith("zh")?"正在查询原订单…":"Checking your purchase…")}function we(e){Re.then(r=>{r&&F&&F.write(r,e).catch(()=>{})})}function Ee(e){Re.then(async r=>{if(!r||!F)return;let l=await F.read(r);ue||l&&"presented"in l||await F.write(r,e)}).catch(()=>{})}let ye=e=>`error:${e?.code??e?.name??"unknown"}`,me=s.ownerDocument.defaultView,q=!S,Ve=null,H=!1,We=e=>e.storageArea===me?.localStorage&&(e.key===null||e.key.startsWith("indiana.funnel.purchases.")),De=e=>{We(e)&&$()},Ge=S?()=>{}:n.client.subscribe(()=>$());function X(){q&&(q=!1,me?.removeEventListener("storage",De),Ge(),le())}let ge=()=>q&&(a==="ready"||a==="preparing");function he(e){(a==="ready"||a==="preparing")&&d("unavailable",e)}function $(){if(a==="ready"&&Date.now()-U>=te)return X();H=!0,Ve??=(async()=>{for(;H&&m&&!M&&ge();){H=!1;try{await n.client.retained()==="pending"&&!pe("purchase_pending")&&he("purchase_pending")}catch(e){g.aborted?d("released","aborted"):he(ye(e))}}})().finally(()=>{Ve=null,H&&m&&!M&&ge()&&$()})}S||me?.addEventListener("storage",De),g.addEventListener("abort",oe,{once:!0});let Fe=S?Promise.resolve("none"):n.client.findPurchase();Fe.catch(()=>{});let Q;function Y(e){let r=Q?.paywallVersionId??n.paywallVersionId??f?.resolution.id??p?.id,l=JSON.stringify(k([r??null,e])),i=Ce.get(l);return i||(i=n.client.readPaywall({paywallVersionId:r,...r?{}:{paywallId:Q?.paywallId??n.paywallId},...e}),Ce.set(l,i)),i}function A(e,r){let l=Object.values(e.capabilities.plans),i=Object.values(e.document.buttons).some(t=>t.type==="checkout");return i&&l.length===0?!1:r.intent==="subscription_change"&&i?l.some(t=>t.available):l.every(t=>t.available)}function Pe(e,r){if(p&&!ne(e,p))return d("unavailable","paywall_changed"),!1;p=e,V=r,B(!0);for(let l of D.keys())R(l,structuredClone(e));return!0}function He(e,r){if(!(!p||!["preparing","ready","shown"].includes(a))){if(!ne(e,p))return N("paywall_changed");if(!A(e,r.commerce))return N("plan_unavailable");Pe(e,r)}}async function L(){let e=await Te;if(!e)throw new Me("PURCHASE_PENDING","The purchase did not start; open it again");return e}let Ke={get view(){return P?P.view:p},get signal(){return P?.signal??n.client.identitySignal},get quote(){return P?.quote??null},get operation(){return P?.operation??null},webViewUrl:"bundled",get canReselect(){return P?.canReselect},get recovery(){return P?.recovery},get pendingCancellation(){return P?.pendingCancellation},subscribe(e){return D.set(e,P?.subscribe?.(e)??(()=>{})),()=>{D.get(e)?.(),D.delete(e)}},refresh:async()=>P?P.refresh():structuredClone(p),preview:async e=>(await L()).preview(e),confirm:async()=>(await L()).confirm(),cancel:async()=>(await L()).cancel(),read:async()=>(await L()).read(),destroy(){P?.destroy()}},w={options:{},handoff:{}},Oe={loading:"host",focusAtReveal:!0,settleMotionAtReveal:!0,signal:n.client.identitySignal,start:async()=>Ke,canInteract:()=>w.options.canInteract?w.options.canInteract():!["unavailable","released","closed"].includes(a),async beforeAction(){let e=a!=="adopted",r=p?.capabilities,l=await L();if(e&&!T(l.view?.capabilities,r))throw new qe;await w.options.beforeAction?.()}};for(let e of Qe)Object.defineProperty(Oe,e,{enumerable:!0,get:()=>w.options[e]});function Z(){a!=="preparing"||!C||!v||!f&&(!m||!T(V?.commerce,ae(m))||V?.locale!==m.locale)||(K("ready"),ie(!0))}let xe={present(e){if(w.handoff.present)return w.handoff.present(e);a==="preparing"&&(C=e,U=Date.now(),Z())},async dismiss(){if(w.handoff.dismiss)return w.handoff.dismiss();d("closed");for(let e of[...W])R(e)},async closeAction(e){if(w.handoff.closeAction)return w.handoff.closeAction(e);w.options.onAction?await w.options.onAction(e):await xe.dismiss()},quoteError(e){w.handoff.quoteError?w.handoff.quoteError(e):R(w.options.onError,e)}};async function ze(){if(n.paywallVersionId||n.paywallId)return{paywallVersionId:n.paywallVersionId,paywallId:n.paywallId};let e=n.configuration;if(!e)return d("unavailable","paywall_missing"),null;let r=await Promise.resolve(n.start).catch(()=>null);if(!r||a!=="preparing")return null;let l=()=>ve(e,{funnelId:r.funnelId,customerId:n.client.customerId,parameters:r.parameters??{}});if(J=await l(),a!=="preparing")return null;let i=J;if(i.type!=="paywall")return d("unavailable",be(i)??"route"),null;let t=!1;return le=e.subscribe(()=>{t||!ge()||(t=!0,l().then(c=>{!(c.type==="unavailable"&&!["funnel_stopped","route_unavailable"].includes(c.reason))&&(c.type!=="paywall"||c.paywallVersionId!==i.paywallVersionId)&&he("route_changed")}).finally(()=>t=!1))}),q||le(),{paywallVersionId:i.paywallVersionId}}(async()=>{try{let[{showPaywall:e},r]=await Promise.all([import("./paywall-RCDK73ML.js"),ze()]),l=n.commerce??ae(E),i=n.locale??E?.locale,t=r&&l&&i?JSON.stringify(k([r.paywallVersionId??null,r.paywallId??null,{commerce:l,locale:i}])):null;if(de(t),g.throwIfAborted(),a!=="preparing"||!r)return;if(!l)return d("unavailable","commerce_missing");if(!i)return d("unavailable","locale_missing");Q=r;let c={commerce:l,locale:i},y=t?await F?.read(t).catch(()=>null):null;if(fe=!!y&&"presented"in y&&(!E||y.funnelId===E.funnelId),g.throwIfAborted(),a!=="preparing"||fe)return;y&&!("presented"in y)&&(!E||y.funnelId===E.funnelId)&&A(y.resolution,y.context.commerce)&&(f=y),G(!!f);let o;if(f){let ee=f.context;c=ee,o=structuredClone(f.resolution),Y(ee).then(Be=>He(Be,ee),()=>{})}else o=await Y(c);if(g.throwIfAborted(),a!=="preparing"||(!A(o,c.commerce)&&n.start instanceof Promise&&!h&&await j,!f&&h&&!T(c,h)&&(c=h,o=await Y(c)),g.throwIfAborted(),a!=="preparing"))return;if(!A(o,c.commerce))return d("unavailable","plan_unavailable");if(!Pe(o,c))return;b=s.ownerDocument.createElement("div"),s.append(b);let u=setTimeout(()=>a==="preparing"&&d("unavailable","timeout"),$e);Ae.then(()=>clearTimeout(u));let I=await e(b,Oe,xe);if(!I.host||g.aborted||a!=="preparing"){I.host?.destroy(),d(g.aborted?"released":"unavailable","error");return}v=I.host,Z()}catch(e){d(g.aborted?"released":"unavailable",ye(e))}finally{de(null),G(!1),B(!1)}})(),j.then(async e=>{let r=o=>{Ee(null),N(o)},l=async()=>{let o=await Fe;return o==="pending"?"purchase_pending":o==="found"?"original_purchase":o==="blocked"?"purchase_blocked":void 0},i=async o=>!o||o==="purchase_blocked"||!z?!1:(await se,pe(o)?!0:await Je&&Ue(e?.funnelId??await n.client.pendingFunnel().catch(()=>null)??void 0)&&pe(o));if(!e)return z&&await i(await l().catch(()=>{}))?void 0:r("gated");let t=e,c=ae(t),y=n.commerce??c;if(!T(c&&{...c,intent:void 0},y&&{...y,intent:void 0})||n.locale!==void 0&&t.locale!==n.locale)return r("start_mismatch");if(!c)return r("commerce_missing");h={commerce:c,locale:t.locale},x=t,f&&["preparing","ready","shown"].includes(a)&&(m=t,_=re(t));try{let o=await l();if(await i(o)){m=void 0,_="";return}if(o)return r(o);if(!["preparing","ready","shown"].includes(a))return;if(n.configuration&&(n.paywallId||n.paywallVersionId)){let u=await ve(n.configuration,{funnelId:t.funnelId,customerId:n.client.customerId,parameters:t.parameters??{}});g.throwIfAborted();let I=u.type==="unknown"||u.type==="unavailable"&&u.reason!=="funnel_stopped";if(u.type==="paywall"?f?u.paywallId!==f.resolution.paywallId:n.paywallVersionId?u.paywallVersionId!==n.paywallVersionId:u.paywallId!==n.paywallId:!I)return r(be(u)??"route_changed")}if(q&&(H=!1,await n.client.retained()==="pending")){if(await i("purchase_pending")){m=void 0,_="";return}return r("purchase_pending")}if(await se,fe){m=t,_=re(t);return}if(Q||n.paywallId||n.paywallVersionId||p){let u=await Y(h);if(g.throwIfAborted(),Ee(A(u,h.commerce)?{savedAt:Date.now(),funnelId:t.funnelId,context:h,resolution:u}:null),f)He(u,h);else{if(a!=="preparing")return;if(p){if(!A(u,h.commerce))return d("unavailable","plan_unavailable");if(!Pe(u,h))return}}}}catch(o){return g.aborted?d("released","aborted"):N(ye(o))}["preparing","ready","shown"].includes(a)&&(m=t,_=re(t),Z(),H&&$())},()=>N("gated"));let Ne={get state(){return a},get reason(){return Se??ke},ready:Ae,local:se,get start(){return m},get prediction(){return J?structuredClone(J):void 0},matches:e=>m?re(e)===_:!!f&&e.funnelId===f.funnelId&&e.locale===f.context.locale,open(){if(a==="preparing")return"pending";if(a!=="ready"||!C)return!1;if(Date.now()-U>=te)return d("unavailable","expired"),!1;let e=C;return C=null,X(),K("shown"),M&&_e(),e(),"shown"},destroy(){Ie.abort()}};return Le.set(Ne,{onClose(e){return a==="closed"?(R(e),()=>{}):(W.add(e),()=>{W.delete(e)})},claim(){X()},remember(e){ue=!0;let r=structuredClone(e);j.then(()=>{!x||!h||we({savedAt:Date.now(),funnelId:x.funnelId,context:h,resolution:r})},()=>{})},withhold(){ue=!0,j.then(()=>{x&&we({savedAt:Date.now(),funnelId:x.funnelId,presented:"nothing"})},()=>{})},async adopt(e,r){let l=e.paywall?.resolution,i=e.paywall&&!e.paywall.quote&&!e.paywall.operation&&!e.paywall.purchaseRequestId&&!(e.paywall.selectionGeneration??0);if(a!=="shown"||!v||!p||!l||!i||e.source.id!==m?.funnelId||e.locale!==m?.locale||!T(e.parameters??{},m?.parameters??{})||!["running","waiting"].includes(e.status)||!ne(l,p))return null;let t;try{t=await r.start()}catch{return null}if(a!=="shown"||!v)return t.destroy(),null;P=t,w.options=r.options,w.handoff=r.handoff;for(let[o]of D)D.set(o,t.subscribe?.(o)??(()=>{})),t.view&&R(o,structuredClone(t.view));g.removeEventListener("abort",oe),K("adopted"),ce(t),W.clear();let c=v,y=b;return v=null,b=null,C=null,new Proxy(c,{get(o,u){return u==="destroy"?()=>{o.destroy(),y?.remove()}:u==="retainPurchaseDialog"?()=>{let I=o.retainPurchaseDialog();if(I)return{dialog:I.dialog,release(){I.release(),y?.remove()}}}:Reflect.get(o,u,o)}})},retainPurchaseDialog(){if(a!=="shown")return;let e=v?.retainPurchaseDialog();if(!e)return;let r=b;return v=null,b=null,d("released"),{dialog:e.dialog,release(){e.release(),r?.remove()}}},get modal(){return p?.document.presentation.type!=="inline"},get revealable(){return a==="ready"&&!!C&&Date.now()-U<te},get recovering(){return M},release(){d("released")}}),Ne}function tn(s,n){let S=n.run.parameters??{},O=S?.commerce;return Ye(s,{client:n.client,start:{funnelId:n.run.source.id,locale:n.run.locale,parameters:S},paywallVersionId:n.paywallVersionId,...O&&{commerce:O},locale:n.run.locale,signal:n.signal},{run:!0})}export{Xe as a,an as b,Ye as c,tn as d};
@@ -1 +0,0 @@
1
- import{b as Rn}from"./chunk-2GVAT6HI.js";import{a as Pn}from"./chunk-MWTSCBSY.js";import{a as jn,b as Zn,c as Cn,d as bn,e as Be,f as Kn,h as et,i as nt,j as tt,k as it}from"./chunk-IEYSWIRA.js";import{a as rt}from"./chunk-45PGU2HW.js";import{a as Jn}from"./chunk-W32FI2A2.js";import{a as zn,d as Gn,f as Qn,g as Wn,j as Yn,k as _e,l as sn,m as Xn,n as an}from"./chunk-XSEYXS4X.js";import{b as xn}from"./chunk-BB6PDBS4.js";import{a as In,d as Bn}from"./chunk-464CINQK.js";import{C as $n}from"./chunk-4G52SO64.js";import{a as ne}from"./chunk-E4B7243C.js";import{a as ke}from"./chunk-DSPLGTQI.js";function ot(i){let E=new Set,q=new Set,n=null;async function u(o,p){let A=!1;for(;!i.stopped&&i.key===o&&i.client.pendingCommand?.requestId===p;){if(!i.client.settle)throw new ne("COMMAND_PENDING","The original display acknowledgement is still pending");await i.client.settle(p),A=!0,i.client.pendingCommand?.requestId===p&&await new Promise(h=>setTimeout(h,1500))}i.stopped||i.key!==o||(A&&await i.client.get(),!(i.stopped||i.key!==o)&&E.add(o))}function y(o,p){n=p;let A=()=>{n===p&&(n=null),q.delete(o)};return p.then(A,h=>{A(),i.busy||i.fail(h)}),p}function W(o){if(i.reviewing||E.has(o)||q.has(o)||i.stopped)return;q.add(o);let p=async()=>{if(i.reviewing||i.stopped||i.key!==o||E.has(o)){q.delete(o);return}if(i.busy||i.client.pendingCommand){setTimeout(()=>{p()},250);return}let A=(async()=>{if(i.staleRead){if(await i.staleRead,i.stopped||i.key!==o)return;if(i.client.pendingCommand){setTimeout(()=>{p()},250);return}}let h=i.client.view,de=i.expected(),O=de.requestId;try{await i.client.submit({operation:"shown",...de})}catch(k){if(!(k instanceof ne)||k.code!=="CONFLICT"||k.status!==409||i.client.pendingCommand)throw k;await i.client.get();let c=i.client.view;if(i.stopped||i.reviewing||i.key!==o||!c||!h||c.id!==h.id||c.source.versionId!==h.source.versionId||c.nodeId!==de.nodeId||c.visit!==de.visit||c.revision<=de.revision||c.stopped||!c.screen&&(!c.paywall||c.paywall.receiptId!==h.paywall?.receiptId)||!["running","waiting"].includes(c.status)||i.client.pendingCommand)throw k;let _=i.expected();O=_.requestId,await i.client.submit({operation:"shown",..._})}await u(o,O)})();y(o,A)};p()}function R(){if(n)return n;let o=i.client.pendingCommand;if(o?.operation!=="shown")return null;let p=i.key;return q.add(p),y(p,(async()=>{await i.client.retry(),await u(p,o.requestId)})())}return{report:W,settled:R,get inFlight(){return n}}}function st(i){let E={},q=new Map;async function n(u){let y=i.client.view,W=y?.screen,R=W?.customerData.nodes[u.nodeId];if(i.stopped||i.busy||!y||!W||!R)return;if(!["refresh","next","previous","filter","sources_next","sources_previous"].includes(u.action)){let k=i.document,c=k?$n(k,u.nodeId):null,_=c?.type==="customer_data"?c.data.outputs?.[u.action]:void 0;_&&W.outputs.includes(_)?await i.perform(()=>i.client.submit({operation:"submit",...i.expected(),input:{type:"screen",output:_,answers:i.answers,selection:u.value?{[u.nodeId]:u.value}:{}}})):await i.onIntent?.(u,y);return}let p=u.action.startsWith("sources_")?R.resources.find(k=>k.key===u.value):null;if(u.action.startsWith("sources_")&&!p)throw new ne("INVALID_REQUEST","Choose a current resource");let A=`${y.visit}:${u.nodeId}:${p?.key??""}`,h=q.get(A)??[null],O=E[u.nodeId]??{page:1,after:null,filter:"all",...p?{resourceKey:p.key}:{}};if(u.action==="filter"){let k=u.value;if(!k||!(R.source==="offer_history"?["all","issued","reserved","redeemed","expired","revoked"]:["all","purchase","refund","source","usage","debt","settlement"]).includes(k))throw new ne("INVALID_REQUEST","Unknown data filter");O={page:1,after:null,filter:k},h.splice(0,h.length,null)}else if(u.action==="next"||u.action==="sources_next"){let k=p?.sources.at(-1),c=p?k?{kind:"ledger",cursor:{at:k.detail[0],id:k.id,type:"source"}}:null:W.dataCursors[u.nodeId];if(!c||!p&&!R.hasNext)return;h[O.page]=c,O={...O,page:O.page+1,after:c}}else if(u.action==="previous"||u.action==="sources_previous"){if(O.page<=1)return;O={...O,page:O.page-1,after:h[O.page-2]??null}}q.set(A,h),E={...E,[u.nodeId]:O},await i.perform(()=>i.client.get({nodeId:y.nodeId,visit:y.visit,revision:y.revision,components:E}))}return{get queries(){return E},intent:n,reset(){E={},q.clear()}}}function at(i){let{doc:E,holder:q,reviewHolder:n,mountScreenPreview:u}=i,y=!1,W,R=0,o=null,p="",A,h=new Map,de=c=>c?`${c.id}:${c.nodeId}:${c.visit}:${c.revision}:${c.paywall?.quote?.operationId??""}`:"";async function O(c){if(i.stopped||!i.client.review||y&&c===W&&A?.active)return;let _=!y||c!==W;y||(p=de(i.client.view),h.set(p,structuredClone(i.answers))),y=!0,W=c,q.hidden=!0,i.suspend(!0),n.hidden=!1;let he=++R;_&&(A?.finish("dismissed"),o?.destroy(),o=null,n.replaceChildren(),A=sn(n,i.loadingOptions,"funnel",()=>{k()}));let g=_?A:void 0;try{if(g?.start(!1,i.client.view?.locale),he!==R||i.stopped)return;let Ie=i.client.review(c),V=await(g?.wait(Ie,_e)??Ie);if(i.stopped||he!==R||!y)return;if(!V.review)throw new ne("INVALID_RESPONSE","Historical projection is missing");o?.destroy(),o=null,g||n.replaceChildren();let l=E.createElement("div"),x=g?an(l,n):()=>{};n.append(l);let F=V.run.locale.startsWith("zh"),te=i.chrome;l.style.cssText=te.history;let ie=E.createElement("p");ie.textContent=F?"只读回看":"Read-only history",ie.style.cssText=te.historyTitle,l.append(ie);let me=E.createElement("p");me.style.cssText=te.historyNote,me.textContent=V.review.pages.length?F?"选择一页查看当时的内容,回看不会改动任何信息。":"Choose a page to see it as it was. Nothing here can be changed.":F?"还没有可回看的页面。":"There are no earlier pages yet.",l.append(me);let j=V.review.page?.receiptId,B=E.createElement("div");B.style.cssText=te.historyPages;for(let[m,U]of V.review.pages.entries()){let J=E.createElement("button");J.type="button",J.textContent=F?`第 ${m+1} 页`:`Page ${m+1}`;let ue=j!==void 0&&U.receiptId===j;J.style.cssText=ue?te.primary:te.secondary,ue&&J.setAttribute("aria-current","page"),Be(J,()=>i.chrome.focus),J.onclick=()=>{O(U.receiptId)},B.append(J)}if(B.childElementCount&&l.append(B),V.review.page){let m=V.review.page,U=E.createElement("div");U.inert=!0,U.style.cssText=te.historyPage,l.append(U),o=u(U,{mode:"live",rendererUrl:i.client.webViewUrl,title:m.document.name,onAction:()=>{},onAnswers:()=>{},onCustomerDataIntent:()=>{},onRendered:()=>{he===R&&!i.stopped&&g?.present(x)},onError:ue=>{if(he!==R||i.stopped)return;let X=new Error(ue);g?.finish("error",X),o?.destroy(),o=null,l.remove(),i.fail(X)},onEscape:()=>{k()}});let J=o;if(J.update(m.document,V.run.locale,{serverInput:{bindings:m.inputs,answers:m.answers,values:m.values}}),await J.ready,i.stopped||he!==R||!y)return}let D=F?{issued:"已领取",reserved:"已预留",redeemed:"已使用",expired:"已过期",revoked:"已撤销",unknown:"状态待确认"}:{issued:"Issued",reserved:"Reserved",redeemed:"Used",expired:"Expired",revoked:"Revoked",unknown:"Status unconfirmed"},Y=E.createElement("div");Y.style.cssText=te.historyRecords;for(let m of[...V.review.coupons.map((U,J)=>`${F?"优惠券":"Coupon"} ${J+1}: ${D[U.status]}`),...V.review.purchases.map((U,J)=>`${F?"购买":"Purchase"} ${J+1}: ${it(U.status,F)}`)]){let U=E.createElement("p");U.textContent=m,U.style.margin="0",Y.append(U)}Y.childElementCount&&l.append(Y),V.review.page||g?.present(x),i.client.view&&await i.enqueue(i.client.view)}catch(Ie){if(he!==R||i.stopped)return;g?.finish("error",Ie),o?.destroy(),o=null,n.replaceChildren(),i.fail(Ie)}}async function k(){if(!y||i.stopped||!i.client.review)return;let c=++R;A?.finish("dismissed");try{if(await i.client.review(),i.stopped||c!==R)return;y=!1,R++,A?.finish("dismissed"),o?.destroy(),o=null,n.replaceChildren(),n.hidden=!0,q.hidden=!1;let _=i.client.view;de(_)!==p?(h.set(p,structuredClone(i.answers)),i.resetScreen()):(h.delete(p),i.suspend(!1)),_&&await i.enqueue(_)}catch(_){if(c!==R||i.stopped)return;o?.destroy(),o=null,n.replaceChildren(),i.fail(_)}}return{get active(){return y},get receipt(){return W},open:O,exit:k,get drafts(){return new Map([...h].map(([c,_])=>[c,structuredClone(_)]))},stop(){y=!1,R++,A?.finish("dismissed"),o?.destroy(),o=null,n.replaceChildren(),n.hidden=!0,q.hidden=!1}}}var En=5e3,ft="position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap";async function mt(i,E,q){let n=E,u=n.prepared,y=u&&Rn(u),W=()=>{},R,o;function p(e){for(let t of R?.copies.values()??[])t!==e&&t.destroy();R=void 0}let A;function h(){u&&u.state!=="adopted"&&y?.release()}let de=()=>u?.state==="shown"&&!!y?.modal,O=n.client.identitySignal,k;try{k=await Promise.all([import("./screen-renderer-IKROGLA7.js"),import("./paywall-RCDK73ML.js")]),n.signal?.throwIfAborted(),O?.throwIfAborted()}catch(e){throw h(),e}let[{mountScreenPreview:c},{showPaywall:_}]=k,he=(typeof INDIANA_NATIVE_SHELL_BUILD>"u"||!INDIANA_NATIVE_SHELL_BUILD)&&n.appManifestRelease?rt({client:n.client,appManifestRelease:n.appManifestRelease,onError:n.onError}):void 0;he?.start();let g=i.ownerDocument,Ie=Yn(g),V=!1,l=g.createElement("section"),x=g.createElement("div"),F=g.createElement("div"),te=g.createElement("div"),ie=g.createElement("button");te.hidden=!0,ie.type="button";let me=g.createElement("p"),j=g.createElement("p"),B=g.createElement("button"),D=g.createElement("button"),Y=g.createElement("button"),m=g.createElement("dialog"),U,J=!1;l.dataset.indianaFunnel="",l.dataset.longplayCloseOwner="sdk",l.setAttribute("aria-busy","false"),me.setAttribute("role","status"),j.setAttribute("role","alert"),j.hidden=!0,B.type=D.type=Y.type="button",F.append(B,ie,me,j,Y,D),l.append(x,te,F),i.append(l);let ue=Zn,X=Cn(ue),ln="",we=(g.documentElement.lang||"").startsWith("zh"),K,dn="",Je,kn=!1,un=!1;for(let e of[B,ie,Y,D])Be(e,()=>X.focus);function Fn(){let e=we?"关闭":"Close";D.parentElement===m?(D.textContent="×",D.setAttribute("aria-label",e),Wn(D,ue)):(D.textContent=e,D.removeAttribute("aria-label"),D.style.cssText=X.link+";margin-inline-start:auto")}function ze(e){let t=e?.screen?.content.document.theme??ue,r=JSON.stringify([t.primary,t.background,t.text,t.radius,t.font,D.parentElement===m]);if(r===ln)return;ln=r,ue=t;let b=D.parentElement===m;X=Cn(ue,b),l.style.cssText=X.root+";min-width:0"+(b?";display:flex;flex-direction:column;min-height:100%":""),F.style.cssText=Dn(),F.hidden&&(F.style.display="none"),B.style.cssText=ie.style.cssText=X.secondary,Y.style.cssText=X.primary,me.style.cssText=X.status,j.style.cssText=X.alert,Fn(),bn(B)}function Dn(){let e=D.parentElement===m,t=e&&K?.responsive===!0;return X.bar+(e?";margin-top:auto":"")+(t?`;position:sticky;bottom:0;z-index:1;background:${ue.background}`:"")+(un?`;${ft}`:"")}function Tn(){return F.hidden||un?0:F.getBoundingClientRect().height}function Fe(){let e=D.parentElement===m,t=B.hidden&&ie.hidden&&Y.hidden&&j.hidden&&(D.hidden||D.parentElement!==F);un=e&&kn&&!!t,F.hidden=t&&!me.textContent,F.style.cssText=Dn(),F.style.display=F.hidden?"none":"flex",K?.responsive&&Je!==void 0&&K.setContentHeight(Je+Tn())}ze();let pe=null,C=null,re=null,Ce="",ee="",De=!1,Ge="",cn="",Qe="",s=!1,G=0,We=!1,An="",pn=null,fn=Promise.resolve(),Sn=!n.client.view,Ve,mn=!1,T=q,je=n.hostPaywallTarget,Ne,Ue,Ye="",Xe,oe=!1,Te=null,ye=!1,Ze=()=>n.client.pendingCommand?.operation==="close",se=null,H=null,wn=Jn({document:g,run:async()=>{(!C?.observing||n.client.pendingCommand)&&await gn()},delay:()=>{if(!ae.pending&&!(s||!re||!["running","waiting"].includes(re.status)&&!n.client.pendingCommand)&&!(C?.observing&&!n.client.pendingCommand))return re.pendingRequest||n.client.pendingCommand?1500:En},hiddenDelay:()=>!s&&!ae.pending&&n.client.pendingCommand?15e3:void 0}),M=null;function yn(){return H&&n.client.hasDurableJournal===!0&&M?.acknowledged===!0&&M.operationId===H.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?H:null}function On(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 r=M.operationId===null&&t.selectionGeneration===0&&!t.quote&&!t.operation&&!t.purchaseRequestId,b=In({quote:t.quote,operation:t.operation,requestId:t.purchaseRequestId,pending:!1,destroyed:!1,canReselect:t.canReselect});(r||t.canReselect===!0&&b.type==="native")&&(M.acknowledged=!0)}}let Ae=null,Me=new Set,ge={},qe=!1,Z=(e,t=null)=>{s||(e instanceof ne&&e.status===409&&e.reason==="STATE_CHANGED"&&e.recovery==="recover_operation"&&wn.destroy(),Ae=t,qe=!1,j.textContent=Kn(e,we),j.hidden=!1,Y.hidden=n.client.pendingCommand===null,Fe(),ke(n.onError,e))},ae=xn({client:n.client,document:g,conceal(){s||(ve(),T?.finish("dismissed"),l.hidden=!0,V||(V=!0,Ie()))},async receive(e){s||await ce(n.client.view??e.run)},failed(e){if(!s){if(!ae.pending){ye=!1;let t=n.client.view;t&&ce(t).then(()=>Z(e),Z);return}tn(),l.parentElement!==i&&i.append(l),l.hidden=!1,B.hidden=ie.hidden=D.hidden=!0,me.textContent="",ze(),Z(e,n.client.pendingCommand?.requestId??null)}}}),Nn=()=>{s||(Ae=null,j.textContent=nt(we),j.hidden=!1,Y.hidden=!0,Fe())};function Se(){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 v=at({client:n.client,doc:g,holder:x,reviewHolder:te,mountScreenPreview:c,loadingOptions:n,get chrome(){return X},get stopped(){return s},get answers(){return ge},suspend(e){C?.setSuspended(e)},resetScreen(){Ce="",ee="",Ge=""},enqueue:ce,fail:Z}),$e=ot({client:n.client,expected:Se,fail:Z,get stopped(){return s},get reviewing(){return v.active},get key(){return Ce},get busy(){return G},get staleRead(){return pn}}),Ke=st({client:n.client,expected:Se,perform:He,onIntent:n.onCustomerDataIntent,get stopped(){return s},get busy(){return G},get document(){return pe?.document},get answers(){return ge}}),en=e=>`${e.id}:${e.nodeId}:${e.visit}`,Oe=e=>e&&(e.screen||e.paywall)?en(e):"";function be(){let e=n.client.view;B.disabled=!v.active&&(G>0||!!n.client.pendingCommand||!e?.canBack||e.stopped||!["running","waiting"].includes(e.status)||!Oe(e)||ee!==Oe(e)),B.hidden=!v.active&&!e?.canBack,bn(B);let t=!!C&&!v.active;D.hidden=t&&!T?.active||J&&!v.active,ie.hidden=!n.client.review||!v.active&&!e?.canBack;let r=e?.locale.startsWith("zh");kn=!t&&(G>0||!!e?.pendingRequest),me.textContent=t?"":G>0||e?.pendingRequest?r?"正在处理":"Processing":e?.instruction?.type==="wait"?r?"等待中":"Waiting":"",Fe()}async function qn(e){if(!e)return;let t=n.client.view;await e;let r=n.client.view;if(!t||!r||r.id!==t.id||r.nodeId!==t.nodeId||r.visit!==t.visit||r.stopped||!["running","waiting"].includes(r.status))throw new ne("PRECONDITION_FAILED","The screen changed while its display was acknowledged")}async function He(e,t=!1,r){if(!((G||ye||se||H)&&!t||s||v.active&&!t)){G++,l.setAttribute("aria-busy","true"),j.hidden=!0,Ae=null,qe=!1,be();try{if(t||await qn($e.inFlight),s)return;let b=await e();s||await ce(n.client.view??b.run)}catch(b){r?.(b)&&n.client.pendingCommand===null?Nn():ae.pending||Z(b,n.client.pendingCommand?.requestId??null)}finally{G=Math.max(0,G-1),l.setAttribute("aria-busy",String(G>0)),s||(Y.hidden=n.client.pendingCommand===null,be())}}}function Le(){wn.schedule()}async function gn(){if(!(s||We||G)&&!ae.pending){if(v.active){await v.open(v.receipt);return}We=!0;try{let e=n.client.pendingCommand;e&&n.client.settle&&await n.client.settle(e.requestId);let t=n.client.view,r=Ke.queries,b=await n.client.get(t?.screen&&Object.keys(r).length?{nodeId:t.nodeId,visit:t.visit,revision:t.revision,components:r}:void 0);qe&&!s&&(qe=!1,j.hidden=!0,Fe()),!s&&r===Ke.queries&&await ce(n.client.view??b.run)}catch(e){Z(e),qe=!s}finally{We=!1}}}function nn(e,t,r){if(T?.active){let le=T;return le.setDismissHandler(()=>Hn(le)),le}let b=sn(i,n,"funnel",()=>Hn(b),jn);return T=b,b.start(e,t,r),b}function Hn(e){s||oe||(oe=!0,e.finish("dismissed"),ve(),l.hidden=!0,n.client.view?Pe().finally(z):z())}function vn(){clearTimeout(Xe?.timeout),Xe=void 0}function ve(e){J=!1,vn(),Ne?.abort(),Ne=void 0,pe?.destroy(),pe=null,C?.destroy(),C=null,Ve=void 0,Ue?.(),Ue=void 0,m.open&&m.close();for(let t of Array.from(x.children))(!e||!t.contains(e))&&t.remove();x.style.cssText="",Je=void 0,Ce="",ee="",De=!1,Ge="",Qe=""}function Ln(){let e=g.defaultView;K?.responsive&&e&&pe?.resizeViewport?.(e.innerHeight,e.innerWidth)}function tn(){K?.destroy(),K=void 0,dn=""}function rn(e){let t=e.screen?.presentation;if(!t||t.type==="inline"){m.open&&m.close(),tn(),D.parentElement!==F&&F.append(D),l.parentElement!==i&&i.append(l);for(let le of["flex","display","flex-direction","justify-content"])x.style.removeProperty(le);ze(e),Fe();return}l.parentElement!==m&&(m.append(D,l),i.append(m)),x.style.flex="1 0 auto",x.style.display="flex",x.style.flexDirection="column",x.style.justifyContent="center",ze(e);let r=e.screen.content.document,b=JSON.stringify([t,ln]);b!==dn&&(tn(),dn=b,m.style.cssText=zn("funnel",t,ue),K=Gn(m,{presentation:t,theme:r.theme,pages:r.pages},Ln),K.latch()),Fe(),m.setAttribute("aria-label",(U?.screen===e.screen?.content.document.name?U?.label:void 0)??pe?.document?.name??e.screen?.content.document.name??"Funnel")}async function lt(e){if(s||oe)return;if(ae.observe(),ae.pending){re=e;return}if(ye&&(Ze()||["running","waiting"].includes(e.status))||(re=e,Ae&&n.client.pendingCommand?.requestId!==Ae&&(j.hidden=!0,Ae=null),we=e.locale.startsWith("zh"),ie.textContent=we?"回看":"History",B.textContent=v.active?we?"返回当前":"Return to current":we?"返回":"Back",Fn(),Y.textContent=we?"重试":"Retry",Y.hidden=n.client.pendingCommand===null,be(),An!==`${e.revision}:${e.visit}:${e.status}:${e.stopped}`&&(An=`${e.revision}:${e.visit}:${e.status}:${e.stopped}`,ke(n.onState,structuredClone(e))),s||oe))return;if((!e.pendingRequest||ye&&e.status==="closed")&&["closed","ineligible","failed"].includes(e.status)){z();return}if(e.stopped&&de()){z();return}if(e.stopped||n.client.configurationReady===!1){v.stop(),h(),ve(),T?.finish("skipped"),l.hidden=!0,Le();return}if(l.hidden=!1,v.active){Le();return}if(e.status==="completed"&&C?.subscriptionUpgradeActive){Le();return}let t=Oe(e),r=n.client.view;if(r&&r.revision>e.revision&&Oe(r)!==t)return;let b=!e.instruction&&!e.pendingRequest&&e.nodeType==="screen"&&["running","waiting"].includes(e.status);t!==Ce&&(Ce&&T?.finish("dismissed"),ve(),Ce=t,ge={...e.answers},Ke.reset());let le=en(e);if(Ye===le){l.hidden=!0;return}if(b&&!t){l.hidden=!0;let P=u?.state==="shown"?null:nn(!0,e.locale);!s&&!oe&&Xe?.key!==le&&(vn(),Xe={key:le,timeout:setTimeout(()=>{let a=n.client.view;if(s||!P?.active&&u?.state!=="shown"||!a||en(a)!==le)return;Ye=le;let S=new Error("Funnel screen preparation timed out");P?.finish("error",S),h(),ve(),Z(S)},_e)}),Le();return}vn();let $=P=>{let a=n.client.view;return!s&&!oe&&!Te&&!P.aborted&&n.client.configurationReady!==!1&&!!a&&!a.stopped&&!["closed","ineligible","failed"].includes(a.status)&&(Oe(a)===t||a.status==="completed"&&C?.subscriptionUpgradeActive===!0)},Ee=(P,a)=>{$(a)&&(Ye=t,T?.finish("error",P),ve(),l.hidden=!0,Z(P))};if(t||((e.instruction&&e.instruction.type!=="evaluate_segment"||!["running","waiting"].includes(e.status))&&h(),rn(e),e.instruction?.type!=="event"&&e.instruction?.type!=="open_url"&&T?.finish("skipped")),e.screen){if(mn=!0,je=void 0,h(),n.prepareNextPaywall&&R?.key!==t){p();let L=new Map;for(let[I,N]of Object.entries(e.screen.nextPaywalls??{})){if(!e.screen.outputs.includes(I))continue;let f=n.prepareNextPaywall({run:e,paywallVersionId:N.paywallVersionId});f&&L.set(I,f)}R={key:t,copies:L}}let P=e.screen.content;if(!pe){let L=e.screen.presentation.type!=="inline",I=nn(L,e.locale);if(s||oe)return;let N=(Ne=new AbortController).signal;rn(e),Ue=L?Xn(m):an(l,i),pe=c(x,{mode:"live",closeActions:Array.from(new Set([...n.closeActions??[],...P.document.actions.filter(f=>f.type==="event"&&f.close).map(f=>f.id)])),onAuthoredClose(f){$(N)&&(J=f,be())},rendererUrl:n.client.webViewUrl,title:P.document.name,...L?{hostPresentation:()=>K?.type??e.screen.presentation.type}:{},onResize:f=>{Je=f,K?.responsive&&K.setContentHeight(f+Tn())},onAction(f,d={},fe={}){if(v.active||!$(N)||ee!==t)return;ge={...ge,...fe};let hn=e.screen?.inputs??[],Mn=Object.fromEntries(hn.filter(({variable:Re})=>Object.hasOwn(ge,Re)).map(({variable:Re})=>[Re,ge[Re]]));if(tt(hn,Mn).length){Nn();return}let xe=!G&&R?.key===t?R.copies.get(f):void 0;xe?.state==="ready"&&xe.open()==="shown"&&(p(xe),h(),W(),u=xe,y=Rn(xe),W=y?.onClose(Vn)??(()=>{}),o=t),He(()=>n.client.submit({operation:"submit",...Se(),input:{type:"screen",output:f,answers:Mn,selection:d}}),!1,Re=>et(Re,hn)).finally(()=>{let Re=n.client.view;o===t&&(!Re||Oe(Re)===t)&&(o=void 0,h())})},onAnswers:f=>{v.active||!$(N)||ee!==t||(ge={...ge,...f})},onCustomerDataIntent:f=>{v.active||!$(N)||ee!==t||Ke.intent(f).catch(Z)},onEscape:()=>{!$(N)||ee!==t||v.active||se||H||Pe()},onError:f=>{let d=new Error(f);ee===t?Z(d):Ee(d,N)},onRendered:f=>{if(!(!$(N)||ee===t))try{I.present(d=>{Ue?.(),Ue=void 0,f&&(U={screen:P.document.name,label:f},m.setAttribute("aria-label",f)),L&&(m.showModal(),V=!1,K?.responsive&&m.focus({preventScroll:!0}),!d&&n.loading!=="host"&&Qn(m,K?.type??e.screen.presentation.type,K?.responsive)),ee=t,De=L,be()}),$(N)&&$e.report(t)}catch(d){Ee(d,N)}}}),Ln()}let a={capabilities:e.screen.capabilities,customerData:e.screen.customerData,parameters:e.parameters,serverInput:{bindings:e.screen.inputs,answers:ge,values:e.screen.values}},S=JSON.stringify([P,e.locale,a.parameters,e.screen.inputs,e.screen.values]);if(S!==Ge)pe.update(P.document,e.locale,a),Ge=S,cn=JSON.stringify(a.capabilities),Qe=JSON.stringify(a.customerData);else{let L=JSON.stringify(a.capabilities);L!==cn&&(pe.updateCapabilities(a.capabilities),cn=L),JSON.stringify(a.customerData)!==Qe&&(pe.updateCustomerData(a.customerData),Qe=JSON.stringify(a.customerData))}let Q=pe;if(Q)try{await(T?.wait(Q.ready)??Q.ready)}catch(L){Ne&&Ee(L,Ne.signal)}}else if(e.paywall&&!C){mn=!0,p();let P=e.paywall.resolution,a="document"in P?P.document:null,S=y,Q=n.mountPaywallControls,L=null,I=(Ne=new AbortController).signal,N={loading:"host",signal:I,...Q&&{mountControls:d=>Q(d,e)},canInteract:()=>$(I)&&!v.active&&!se&&!H,beforeAction:async()=>{G++;try{await qn($e.settled()),j.hidden=!0,Ae=null,qe=!1,Fe()}finally{G=Math.max(0,G-1)}},start:async()=>{let d=await Pn(n.client),fe=A;return A=void 0,d.view&&fe?.(d.view),d},onObservationChange:Le,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,prepareSubscriptionChange:n.prepareSubscriptionChange,resolveSubscriptionChange:n.resolveSubscriptionChange,claimCoupon:n.claimCoupon,onEvent:n.onEvent,onOpenUrl:d=>n.onOpenUrl?n.onOpenUrl({receiptId:e.paywall.receiptId,url:d,openIn:"same_window"}):g.defaultView?.location.assign(d),onAction:async d=>{if(v.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:d,answers:{}}});await ce(n.client.view??fe.run)},onError:d=>{ee===t?Z(d):Ee(d,I)}},f={quoteError:d=>ke(n.onError,d),present(d){$(I)&&(L?.present(fe=>{d(fe),ee=t,De=f.retainedDialog?.dialog.open??!!x.querySelector("dialog[open]"),De&&(V=!1),be()}),$(I)&&$e.report(t))},async closeAction(d){s||v.active||await ae.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:n.client.view?.revision??e.revision,input:{type:"screen",output:d,answers:{}}})},async dismiss(){if(s||I.aborted||v.active||se||H||!ye&&!$(I))return;ye=!0;let d=n.client.view;if(d?.status==="completed"&&C?.subscriptionUpgradeActive){Me.add(`complete:${d.id}`),ke(n.onComplete,structuredClone(d)),z();return}if((n.resumeCheckout||n.terminateCheckout)&&pt()){re=n.client.view,z();return}await Pe()}};if(S&&Q)h();else if(S){let d=await S.adopt(e,{options:N,handoff:f,start:()=>Pn(n.client)});o=void 0,d&&$(I)&&!s?(rn(e),C=d,Ve={runId:e.id,receiptId:e.paywall.receiptId},T?.active&&T.present(()=>{}),ee=t,De=S.modal,De&&(V=!1),be(),$e.report(t),v.active&&C.setSuspended(!0)):(d?.destroy(),h(),A=fe=>y?.remember(fe))}if(s||oe)return;if(!C){if(L=nn(!0,e.locale,a),s||oe)return;(typeof INDIANA_NATIVE_SHELL_BUILD>"u"||!INDIANA_NATIVE_SHELL_BUILD)&&n.loading==="host"&&je?.ownerDocument===g&&(f.hostPaywallTarget=je),je=void 0,rn(e);let d=await _(x,N,f).catch(fe=>(Ee(fe,I),null));!$(I)&&!(ye&&!s&&!I.aborted)?d?.host?.destroy():d&&(C=d.host,C&&(Ve={runId:e.id,receiptId:e.paywall.receiptId}),C?.setSuspended(v.active))}}if(s||oe)return;be();let w=e.instruction;if(w&&(w.type==="open_url"||w.type==="event")&&!Me.has(w.receiptId)){let P=g.createElement("button");P.type="button",P.style.cssText=X.primary,Be(P,()=>X.focus),x.style.cssText=X.stage,P.textContent=w.type==="open_url"?`${we?"前往":"Continue to"} ${new URL(w.url).host}`:we?"继续":"Continue",P.onclick=()=>{let a=Se(),S=w.type==="open_url"&&!n.onOpenUrl&&w.openIn==="new_window"?dt(w.url):null;He(async()=>{let Q="success";if(w.type==="open_url")if(n.onOpenUrl)try{Q=await n.onOpenUrl({receiptId:w.receiptId,url:w.url,openIn:w.openIn})===!1?"failed":"opened"}catch(I){ke(n.onError,I),Q="failed"}else Q=w.openIn==="new_window"&&!S?"failed":"opened";if(w.type==="event"){if(!n.onEvent)throw new ne("EVENT_HANDLER_REQUIRED","Provide the event handler");await n.onEvent(w.event)}if(s||n.client.view?.nodeId!==a.nodeId||n.client.view.visit!==a.visit)throw new ne("PRECONDITION_FAILED","The client action visit changed");let L=await n.client.submit({operation:"submit",...a,input:{type:"client_action",receiptId:w.receiptId,outcome:Q}});return Me.add(w.receiptId),w.type==="open_url"&&!n.onOpenUrl&&w.openIn==="same_window"&&g.defaultView?.location.assign(w.url),L})},T?.active?T.present(()=>x.replaceChildren(P)):x.replaceChildren(P)}!e.pendingRequest&&e.status==="completed"&&!Me.has(`complete:${e.id}`)&&(Me.add(`complete:${e.id}`),ke(n.onComplete,structuredClone(e))),Le()}function dt(e){let t=g.defaultView?.open(e,"_blank")??null;return t&&(t.opener=null),t}function ce(e){return be(),fn=fn.catch(()=>{}).then(async()=>{try{await lt(e)}catch(t){throw T?.active&&(Ye=en(e),T.finish("error",t),ve(),l.hidden=!0),t}}),fn}let ut=n.client.subscribe(e=>{if(!Sn){if(e.stopped&&(De||de())&&!ye){re=e,z();return}!ye&&(e.stopped||n.client.configurationReady===!1||Ce&&ee!==Ce&&(Oe(e)!==Ce||["closed","ineligible","failed"].includes(e.status)))&&(ve(),T?.finish("dismissed"),l.hidden=!0),ce(e).catch(Z)}}),ct=n.client.subscribeError?.(e=>{ae.pending||Z(e)});function pt(){let e=n.client.view,t=e?.paywall;return!!t?.operation&&!!e&&["running","waiting"].includes(e.status)&&Bn(In({quote:t.quote,operation:t.operation,requestId:t.purchaseRequestId,pending:!1,destroyed:!1,canReselect:t.canReselect}))}function Pe(e){if(Te)return Te;if(s||!e&&(se||H))return Promise.resolve();let t=!e&&Ze();return!t&&n.client.view&&!["running","waiting"].includes(n.client.view.status)?(re=n.client.view,z(),Promise.resolve()):(Te=He(async()=>{let r=t?await n.client.retry():await(e?n.client.submit.bind(n.client):ae.submit)({operation:"close",...e??Se()});return e&&On(r),r},!0).then(()=>{let r=n.client.view;r?.status==="closed"&&!Ze()&&(re=r,z())}).finally(()=>{Te=null}),Te)}function z(){_n()}function _n(e){he?.destroy(),!s&&(s=!0,ae.destroy(),W(),p(),!mn&&(re?.status==="ineligible"||re?.status==="completed")&&y?.withhold(),h(),n.signal?.removeEventListener("abort",z),O?.removeEventListener("abort",z),T?.finish("dismissed"),wn.destroy(),ut(),ct?.(),ve(e),tn(),v.stop(),m.remove(),!e||!l.contains(e)?l.remove():(F.remove(),te.remove()),!e&&!V&&Ie(),ke(n.onDismiss,re?structuredClone(re):null))}B.onclick=()=>{if(!B.disabled){if(v.active){v.exit();return}He(()=>n.client.submit({operation:"back",...Se()}))}},ie.onclick=()=>{v.open()},D.onclick=()=>{T?.active?T.dismiss():se||Pe()},Y.onclick=()=>{ae.pending?ae.retry().catch(()=>{}):Ze()?Pe():He(()=>n.client.retry())},m.addEventListener("cancel",e=>{e.preventDefault(),T?.active?T.dismiss():se||Pe()}),n.signal?.addEventListener("abort",z,{once:!0}),O?.addEventListener("abort",z,{once:!0});let on=!1;function Vn(){s||oe||(oe=!0,T?.finish("dismissed"),ve(),l.hidden=!0,n.client.view?Pe().finally(z):on=!0)}y&&(W=y.onClose(Vn));let Un={destroy:z,refresh:gn,get recoveryPaywall(){if(C&&Ve)return{...Ve,view:C.currentResolution}},setPurchaseRecovery(e,t){return C?.setPurchaseRecovery(e,t),C!==null},retainPurchaseDialog(){let e=C?.retainPurchaseDialog();if(e)return C=null,_n(e.dialog),{dialog:e.dialog,release(){e.release(),l.remove(),V||Ie()}}},get recovery(){let e=yn();if(e)return e;if(!s&&!G&&!ye&&!se&&C){let t=C.recovery;if(t.type!=="native")return t}return{type:"recover",operationId:n.client.pendingPurchase?.operationId??n.client.view?.paywall?.quote?.operationId??H?.operationId??null,requestId:n.client.pendingCommand?.requestId??null}},prepareFallback(){if(se)return se;let e=yn();if(e)return Promise.resolve(e);let t=n.client.pendingPurchase?.operationId??n.client.view?.paywall?.quote?.operationId??H?.operationId??null,r=()=>({type:"recover",operationId:t,requestId:n.client.pendingCommand?.requestId??null});if(n.client.hasDurableJournal!==!0){let w=C?.recovery;return Promise.resolve(w&&w.type!=="native"&&w.type!=="cancel"?w:r())}let b=(n.client.pendingCommands??(n.client.pendingCommand?[n.client.pendingCommand]:[])).some(w=>w.operation==="close");if(s&&!(b||H&&n.client.view?.status==="closed")||G||We||Te||v.active||!C&&!H&&!b)return Promise.resolve(r());let le=C,$=(async()=>{try{if(!H&&b){let a=await n.client.retry();return await ce(n.client.view??a.run),r()}if(!H){let a=await le.prepareFallback();if(a.type!=="native")return a;if(n.client.hasDurableJournal!==!0)return r();H=a}let w=n.client.pendingCommands??(n.client.pendingCommand?[n.client.pendingCommand]:[]);if(w.length){let a=w.find(Q=>Q.operation==="close");if(!a||!M||a.requestId!==M.requestId)return r();let S=await n.client.retry();On(S),await ce(n.client.view??S.run)}else{let a=n.client.view,S=a?.paywall;if(!a||!S||S.selectionGeneration===void 0||(S.quote?.operationId??null)!==H.operationId||H.operationId!==null&&S.canReselect!==!0)return r();let Q=S.selectionGeneration,L=await n.client.get();await ce(n.client.view??L.run);let I=n.client.view,N=I?.paywall;if(!I||!N||!["running","waiting"].includes(I.status)||I.stopped||I.id!==a.id||I.nodeId!==a.nodeId||I.visit!==a.visit||N.receiptId!==S.receiptId||N.selectionGeneration!==Q||(N.quote?.operationId??null)!==H.operationId||H.operationId!==null&&N.canReselect!==!0||n.client.pendingPurchase||(n.client.pendingCommands?.length??(n.client.pendingCommand?1:0)))return r();let f=Se();M={runId:I.id,operationId:H.operationId,revision:f.revision,requestId:f.requestId,nodeId:I.nodeId,visit:I.visit,receiptId:N.receiptId,selectionGeneration:Q,acknowledged:!1},await Pe(f)}let P=yn();return P?(z(),P):r()}catch(w){return Z(w),r()}})();se=$;let Ee=()=>{se===$&&(se=null)};return $.then(Ee,Ee),$},review:v.open,exitReview:v.exit,get unappliedDrafts(){return v.drafts}};try{let e=n.client.view;if(e)((n.client.viewAgeMs??En)>=En||e.instruction?.type==="evaluate_segment")&&(pn=gn().finally(()=>{pn=null})),await ce(e);else{if(l.hidden=!0,s)throw new DOMException("Presentation cancelled","AbortError");let t=on||u?.state==="shown"?null:nn(n.client.view?.screen?.presentation.type!=="inline",n.client.view?.locale);if(s||oe&&!on)throw new DOMException("Presentation cancelled","AbortError");let r=n.client.get(),b=await(t?t.wait(r,_e):wt(r,_e));if(Sn=!1,on)return s||await Pe().finally(z),Un;await ce(n.client.view??b.run)}}catch(e){throw T?.finish("error",e),z(),e}return Un}function wt(i,E){let q;return Promise.race([i,new Promise((n,u)=>{q=setTimeout(()=>u(new Error("Presentation data timed out")),E)})]).finally(()=>clearTimeout(q))}function zt(i,E,q){return mt(i,E,q)}export{mt as a,zt as b};
@@ -1 +0,0 @@
1
- import{o as n,r as t}from"./chunk-SGI3Q2DQ.js";function u(o,e,a){return n(o,e,a,t)}export{u as a};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-65QMZQE6.js";import"./chunk-S5KGFAAW.js";import"./chunk-MWTSCBSY.js";import"./chunk-IEYSWIRA.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-XSEYXS4X.js";import"./chunk-464CINQK.js";import"./chunk-EQJIC52H.js";import"./chunk-LYTPUZOW.js";import"./chunk-TZTWXL53.js";import"./chunk-H3LBNH34.js";import"./chunk-DRCBHEC6.js";import"./chunk-TQKNQGWV.js";import"./chunk-VILB5M4X.js";import"./chunk-47SYSZJP.js";import"./chunk-66SRWQES.js";import"./chunk-SUUBL2WC.js";import"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import"./chunk-E4B7243C.js";import"./chunk-5SNUVXZ7.js";import"./chunk-ENZRUXTJ.js";import"./chunk-5MRSFLQA.js";import"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as mountFunnelRecoveryPaywall,b as replaceableOriginalSession};
@@ -1 +0,0 @@
1
- import{a,b,c,d}from"./chunk-2GVAT6HI.js";import"./chunk-62MMCXIA.js";import"./chunk-QLMQI6SX.js";import"./chunk-EQJIC52H.js";import"./chunk-H3LBNH34.js";import"./chunk-DRCBHEC6.js";import"./chunk-RM6RSLKI.js";import"./chunk-TQKNQGWV.js";import"./chunk-VILB5M4X.js";import"./chunk-66SRWQES.js";import"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import"./chunk-E4B7243C.js";import"./chunk-5SNUVXZ7.js";import"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as PRERENDER_MAX_AGE_MS,b as preparedInternals,c as prerenderFunnelPurchase,d as prerenderRunPaywall};
@@ -1 +0,0 @@
1
- import{a,b,c}from"./chunk-62MMCXIA.js";import"./chunk-QLMQI6SX.js";import"./chunk-RM6RSLKI.js";import"./chunk-TQKNQGWV.js";import"./chunk-VILB5M4X.js";import"./chunk-FINCNJBH.js";import"./chunk-7RUOZL6C.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as predictFunnelStart,c as predictedPaywallLoadingDocument,b as predictionRefusal};
@@ -1 +0,0 @@
1
- import{a as e,b as o,c as n}from"./chunk-QLMQI6SX.js";import"./chunk-RM6RSLKI.js";import"./chunk-TQKNQGWV.js";import"./chunk-VILB5M4X.js";import"./chunk-FINCNJBH.js";import"./chunk-7RUOZL6C.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{e as FUNNEL_ROUTE_LIMITS,o as funnelRouteSchema,n as projectFunnelRoute};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-KO4CSQ6R.js";import"./chunk-2GVAT6HI.js";import"./chunk-MWTSCBSY.js";import"./chunk-IEYSWIRA.js";import"./chunk-62MMCXIA.js";import"./chunk-QLMQI6SX.js";import"./chunk-45PGU2HW.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-XSEYXS4X.js";import"./chunk-BB6PDBS4.js";import"./chunk-464CINQK.js";import"./chunk-EQJIC52H.js";import"./chunk-LYTPUZOW.js";import"./chunk-TZTWXL53.js";import"./chunk-H3LBNH34.js";import"./chunk-DRCBHEC6.js";import"./chunk-RM6RSLKI.js";import"./chunk-TQKNQGWV.js";import"./chunk-VILB5M4X.js";import"./chunk-47SYSZJP.js";import"./chunk-66SRWQES.js";import"./chunk-SUUBL2WC.js";import"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import"./chunk-E4B7243C.js";import"./chunk-5SNUVXZ7.js";import"./chunk-SLUA7ABW.js";import"./chunk-MB2U2GWJ.js";import"./chunk-ENZRUXTJ.js";import"./chunk-5MRSFLQA.js";import"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as showFunnelRun,b as showObservedFunnelRun};
@@ -1 +0,0 @@
1
- import{P as r,Q as m,j as e}from"./chunk-DRCBHEC6.js";import"./chunk-66SRWQES.js";import"./chunk-X6ZYJHX4.js";import"./chunk-5SNUVXZ7.js";import"./chunk-7RUOZL6C.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{m as merchantBridgeCommerceSchema,r as merchantBridgeOperationSchema,e as merchantOperationLookupSchema};
@@ -1 +0,0 @@
1
- import{e as o}from"./chunk-SHJUMRYM.js";import"./chunk-KCRL2BDG.js";import"./chunk-3ZYWGEBY.js";import"./chunk-DMMD4TMS.js";import"./chunk-Q6SK6G7T.js";import"./chunk-LYTPUZOW.js";import"./chunk-TZTWXL53.js";import"./chunk-H3LBNH34.js";import"./chunk-DRCBHEC6.js";import"./chunk-TQKNQGWV.js";import"./chunk-VILB5M4X.js";import"./chunk-CJJ4R645.js";import"./chunk-66SRWQES.js";import"./chunk-SUUBL2WC.js";import"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import"./chunk-5SNUVXZ7.js";import"./chunk-7RUOZL6C.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
@@ -1 +0,0 @@
1
- import{a}from"./chunk-S5KGFAAW.js";import"./chunk-IEYSWIRA.js";import"./chunk-W32FI2A2.js";import"./chunk-XSEYXS4X.js";import"./chunk-464CINQK.js";import"./chunk-EQJIC52H.js";import"./chunk-TZTWXL53.js";import"./chunk-H3LBNH34.js";import"./chunk-DRCBHEC6.js";import"./chunk-VILB5M4X.js";import"./chunk-47SYSZJP.js";import"./chunk-66SRWQES.js";import"./chunk-SUUBL2WC.js";import"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import"./chunk-E4B7243C.js";import"./chunk-5SNUVXZ7.js";import"./chunk-ENZRUXTJ.js";import"./chunk-5MRSFLQA.js";import"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as showPaywall};
@@ -1 +0,0 @@
1
- import{b as a}from"./chunk-OJ4VMUMS.js";import"./chunk-DMMD4TMS.js";import"./chunk-Q6SK6G7T.js";import"./chunk-LYTPUZOW.js";import"./chunk-TZTWXL53.js";import"./chunk-H3LBNH34.js";import"./chunk-DRCBHEC6.js";import"./chunk-TQKNQGWV.js";import"./chunk-VILB5M4X.js";import"./chunk-47SYSZJP.js";import"./chunk-66SRWQES.js";import"./chunk-SUUBL2WC.js";import"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import"./chunk-E4B7243C.js";import"./chunk-5SNUVXZ7.js";import"./chunk-3VUPVXAV.js";import"./chunk-ENZRUXTJ.js";import"./chunk-5MRSFLQA.js";import"./chunk-7RUOZL6C.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as readPaywallContent};
@@ -1 +0,0 @@
1
- import{a}from"./chunk-6JCM2PSZ.js";import"./chunk-SHJUMRYM.js";import"./chunk-KCRL2BDG.js";import"./chunk-YMTCZWZG.js";import"./chunk-464CINQK.js";import"./chunk-EQJIC52H.js";import"./chunk-3ZYWGEBY.js";import"./chunk-B7CFFTJI.js";import"./chunk-OJ4VMUMS.js";import"./chunk-DMMD4TMS.js";import"./chunk-Q6SK6G7T.js";import"./chunk-LYTPUZOW.js";import"./chunk-TZTWXL53.js";import"./chunk-H3LBNH34.js";import"./chunk-DRCBHEC6.js";import"./chunk-TQKNQGWV.js";import"./chunk-VILB5M4X.js";import"./chunk-CJJ4R645.js";import"./chunk-47SYSZJP.js";import"./chunk-66SRWQES.js";import"./chunk-SUUBL2WC.js";import"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import"./chunk-E4B7243C.js";import"./chunk-5SNUVXZ7.js";import"./chunk-3VUPVXAV.js";import"./chunk-ENZRUXTJ.js";import"./chunk-5MRSFLQA.js";import"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i}from"./chunk-QJLVJLVX.js";import"./chunk-XSEYXS4X.js";import"./chunk-SUUBL2WC.js";import"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import"./chunk-E4B7243C.js";import"./chunk-5SNUVXZ7.js";import"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};
File without changes