@tinkerlandai/longplay-sdk 0.10.97 → 0.10.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -6
- package/README.zh-CN.md +7 -3
- package/dist/check-response-RG4OLOMY.js +1 -0
- package/dist/{chunk-F4AIEI5N.js → chunk-2VAQ56S2.js} +1 -1
- package/dist/{chunk-AO56DGNZ.js → chunk-2VK44BOH.js} +1 -1
- package/dist/{chunk-Y3W5G4BF.js → chunk-2XX7L5VK.js} +1 -1
- package/dist/{chunk-UGATOG2T.js → chunk-355B3KPL.js} +1 -1
- package/dist/{chunk-6XRQR43F.js → chunk-3I6OZU2J.js} +1 -1
- package/dist/{chunk-7ZAM4YRK.js → chunk-45PGU2HW.js} +1 -1
- package/dist/{chunk-BT7IC765.js → chunk-4AJTBYKE.js} +1 -1
- package/dist/{chunk-KCG7GZXO.js → chunk-6HOH7LOK.js} +1 -1
- package/dist/{chunk-EQUVI5QU.js → chunk-6RQJNL7B.js} +1 -1
- package/dist/{chunk-PBHOJKKG.js → chunk-6WOVMXJE.js} +1 -1
- package/dist/{chunk-CKMSSBJM.js → chunk-AHXR2QO2.js} +1 -1
- package/dist/{chunk-C4KLIT5L.js → chunk-CKUMSWUN.js} +1 -1
- package/dist/{chunk-LQV7EC5H.js → chunk-CNV22MDH.js} +1 -1
- package/dist/{chunk-XWVK4SJA.js → chunk-CV67DHPD.js} +1 -1
- package/dist/{chunk-67WFVDTV.js → chunk-DCKPSRMT.js} +1 -1
- package/dist/chunk-DS2AOHZY.js +1 -0
- package/dist/{chunk-2OBXRQMW.js → chunk-EEJPKNED.js} +1 -1
- package/dist/{chunk-Y6KA56V2.js → chunk-F467W5SE.js} +1 -1
- package/dist/{chunk-LFR2LWYC.js → chunk-FEZWUYEK.js} +1 -1
- package/dist/{chunk-WLO2GDRF.js → chunk-GGWIHM2N.js} +1 -1
- package/dist/{chunk-HKLAHQKF.js → chunk-GJTXTEZG.js} +1 -1
- package/dist/{chunk-A5WUQLAO.js → chunk-GRY5G7X3.js} +1 -1
- package/dist/{chunk-7CZEXBQY.js → chunk-HHKX7P4Q.js} +1 -1
- package/dist/{chunk-FYUMVOCV.js → chunk-HN46A5SD.js} +1 -1
- package/dist/chunk-IESVRPTI.js +1 -0
- package/dist/{chunk-XLGNBPGF.js → chunk-JHVEOUIF.js} +1 -1
- package/dist/{chunk-7QPCNDIY.js → chunk-JSRB6RDU.js} +1 -1
- package/dist/{chunk-JLKODCRG.js → chunk-JYE7LLEH.js} +2 -2
- package/dist/{chunk-MOIVJERE.js → chunk-JZYZHMCT.js} +1 -1
- package/dist/{chunk-BANN2HQH.js → chunk-L42BXSWX.js} +1 -1
- package/dist/{chunk-VXNN3RV3.js → chunk-LRJJNIUQ.js} +1 -1
- package/dist/{chunk-KCUE2VFJ.js → chunk-O33ABKTL.js} +1 -1
- package/dist/{chunk-6VVQWTHV.js → chunk-OC3IODWG.js} +1 -1
- package/dist/{chunk-33EKLIMB.js → chunk-OI4KRTEM.js} +1 -1
- package/dist/{chunk-3532HSBP.js → chunk-OILQZX5V.js} +1 -1
- package/dist/{chunk-CO6HDNOC.js → chunk-OJ6CPUN4.js} +1 -1
- package/dist/{chunk-BQFIJCBA.js → chunk-ORQ5RR4J.js} +1 -1
- package/dist/chunk-PVNZFREQ.js +1 -0
- package/dist/{chunk-Y55OBV7D.js → chunk-Q7TQHM5N.js} +1 -1
- package/dist/{chunk-BOT6ZDLK.js → chunk-QNJPFX5F.js} +1 -1
- package/dist/{chunk-CHRNCOXJ.js → chunk-RXHGIDNM.js} +1 -1
- package/dist/{chunk-ME6QTD5Y.js → chunk-SEBMCCXY.js} +1 -1
- package/dist/{chunk-55B6CYG6.js → chunk-SK73TK7R.js} +1 -1
- package/dist/{chunk-SX7U2ONB.js → chunk-UFO6XHFZ.js} +1 -1
- package/dist/{chunk-DUS5V65Z.js → chunk-VCRDA5R3.js} +1 -1
- package/dist/{chunk-KX67ZM7H.js → chunk-VID3LHBO.js} +1 -1
- package/dist/{chunk-FYMVNLQN.js → chunk-VPT5MFDG.js} +2 -2
- package/dist/{chunk-PUDTOCQF.js → chunk-WEORY7PV.js} +1 -1
- package/dist/{chunk-S2S4ROGY.js → chunk-XF746ACV.js} +1 -1
- package/dist/{chunk-XAPMQRVJ.js → chunk-YRVK3UDS.js} +1 -1
- package/dist/{chunk-FPJ3FE26.js → chunk-YTBCR2KU.js} +1 -1
- package/dist/{content-IDQO7TKS.js → content-N7THX3DD.js} +1 -1
- package/dist/funnel-host-purchase-FQLL3MCD.js +1 -0
- package/dist/funnel-host-purchase-entry-ONAAZZV6.js +1 -0
- package/dist/funnel-host-recovery-paywall-WYK3N5WY.js +1 -0
- package/dist/{funnel-paywall-copies-LPOTYSTS.js → funnel-paywall-copies-4K6FMGCP.js} +1 -1
- package/dist/{funnel-paywall-pins-source-ZK2DZWY3.js → funnel-paywall-pins-source-MJIRVW5F.js} +1 -1
- package/dist/funnel-paywall-prerender-WEB5AEVM.js +1 -0
- package/dist/funnel-route-prediction-YOS2OMCA.js +1 -0
- package/dist/funnel-route-source-WZ35NDNG.js +1 -0
- package/dist/funnel-runtime-host-TYQ4CQ7T.js +1 -0
- package/dist/index.d.ts +13 -17
- package/dist/index.js +1 -1
- package/dist/merchant-bridge-contracts-DPNCMPVN.js +1 -0
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.js +1 -1
- package/dist/operation-contracts-NLZ5ENTM.js +1 -0
- package/dist/page.js +1 -1
- package/dist/paywall-UGS2LKLH.js +1 -0
- package/dist/paywall-content-Y4SCPZRG.js +1 -0
- package/dist/paywall-session-J2VVRCZF.js +1 -0
- package/dist/popup.d.ts +2 -2
- package/dist/popup.js +1 -1
- package/dist/{presentation-loading-CU4c-koG.d.ts → presentation-loading-EAIPC1d3.d.ts} +2 -2
- package/dist/react-native.js +1 -1
- package/dist/screen-renderer-4VYPU7X6.js +1 -0
- package/dist/server.js +1 -1
- package/dist/{visual-dom-KUABNJV6.js → visual-dom-5LUN4AHO.js} +1 -1
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/check-response-XGOTG3KL.js +0 -1
- package/dist/chunk-7DQV2EUW.js +0 -1
- package/dist/chunk-GFH7OK3S.js +0 -1
- package/dist/chunk-JYTUTIBB.js +0 -1
- package/dist/funnel-host-purchase-7IYZRPYA.js +0 -1
- package/dist/funnel-host-purchase-entry-FFZUEX4Q.js +0 -1
- package/dist/funnel-host-recovery-paywall-DGCR4IBQ.js +0 -1
- package/dist/funnel-paywall-prerender-QHEGZSPT.js +0 -1
- package/dist/funnel-route-prediction-Q4HMRAVQ.js +0 -1
- package/dist/funnel-route-source-HYWJWEM3.js +0 -1
- package/dist/funnel-runtime-host-CFDI4AWM.js +0 -1
- package/dist/merchant-bridge-contracts-OIYML3DE.js +0 -1
- package/dist/operation-contracts-YJM6772C.js +0 -1
- package/dist/paywall-2Z3FUN2M.js +0 -1
- package/dist/paywall-content-JXWPOE3Y.js +0 -1
- package/dist/paywall-session-RNEEPYPG.js +0 -1
- package/dist/screen-renderer-HJOKBOZH.js +0 -1
- /package/dist/{chunk-FRK6322O.js → chunk-CILM5XMH.js} +0 -0
- /package/dist/{chunk-JLKODCRG.js.LEGAL.txt → chunk-JYE7LLEH.js.LEGAL.txt} +0 -0
- /package/dist/{chunk-KV5MZ4NI.js → chunk-OJM6ORHE.js} +0 -0
- /package/dist/{chunk-W22ESUYY.js → chunk-TDOPU2RH.js} +0 -0
- /package/dist/{chunk-FYMVNLQN.js.LEGAL.txt → chunk-VPT5MFDG.js.LEGAL.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as I,b as L}from"./chunk-FRK6322O.js";function M(e){try{let n=e.replace(/([^\\])\//g,"$1\\/");return new RegExp(n)}catch{return}}function j(e,n){if(!n.length)return!1;let t=!1,r=!1;for(let o of n){let s=pe(e,o.type,o.pattern);if(o.include===!1){if(s)return!1}else t=!0,s&&(r=!0)}return r||!t}function he(e,n,t){try{let r=n.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return t&&(r="\\/?"+r.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+r+"$","i").test(e)}catch{return!1}}function be(e,n){try{let t=new URL(n.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),r=[[e.host,t.host,!1],[e.pathname,t.pathname,!0]];return t.hash&&r.push([e.hash,t.hash,!1]),t.searchParams.forEach((o,s)=>{r.push([e.searchParams.get(s)||"",o,!1])}),!r.some(o=>!he(o[0],o[1],o[2]))}catch{return!1}}function pe(e,n,t){try{let r=new URL(e,"https://_");if(n==="regex"){let o=M(t);return o?o.test(r.href)||o.test(r.href.substring(r.origin.length)):!1}else if(n==="simple")return be(r,t);return!1}catch{return!1}}function K(e){for(let t of["namespace","status","url","groups"])if(Object.hasOwn(e,t))throw new TypeError(`Retired experiment field: ${t}`);let n=e;if(n.hashVersion!==void 0&&n.hashVersion!==2)throw new TypeError("Only hash version 2 is supported");if(n.filters?.some(t=>t.hashVersion!==2))throw new TypeError("Only hash version 2 is supported")}function T(e){for(let n of Object.values(e)){if(Array.isArray(n))throw new TypeError("Saved groups require typed list or condition entries");if(n&&Object.hasOwn(n,"useEmptyListGroup"))throw new TypeError("Retired saved group field: useEmptyListGroup")}}function H(e){for(let n of["overrides","groups"])if(Object.hasOwn(e,n))throw new TypeError(`Retired evaluation context field: ${n}`);T(e.savedGroups??{})}function J(e){let n=2166136261,t=e.length;for(let r=0;r<t;r++)n^=e.charCodeAt(r),n+=(n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24);return n>>>0}function C(e,n,t){return t===2?J(J(e+n)+"")%1e4/1e4:null}function me(e){return e<=0?[]:new Array(e).fill(1/e)}function $(e,n){return e>=n[0]&&e<n[1]}function W(e,n){for(let[t,r]of n.entries())if($(e,r))return t;return-1}function Q(e,n,t){n=n===void 0?1:n,n<0?n=0:n>1&&(n=1);let r=me(e);t=t||r,t.length!==e&&(t=r);let o=t.reduce((a,u)=>u+a,0);(o<.99||o>1.01)&&(t=r);let s=0,i=n;return t.map(a=>{let u=s;return s+=a,[u,u+i*a]})}function z(e,n,t){if(!n)return null;let r=n.split("?")[1];if(!r)return null;let s=r.replace(/#.*/,"").split("&").map(i=>i.split("=",2)).filter(([i])=>i===e).map(([,i])=>i===void 0?NaN:parseInt(i))[0];return s!==void 0&&s>=0&&s<t?s:null}function X(e){try{return e()}catch{return!1}}function E(e){return typeof e=="string"?e:JSON.stringify(e)}function y(e){typeof e=="number"&&(e=e+""),(!e||typeof e!="string")&&(e="0");let n=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return n.length===3&&n.push("~"),n.map(t=>t.match(/^[0-9]+$/)?t.padStart(5," "):t).join("-")}var Y=new Map,D=32,Z=new WeakMap,ee=new WeakMap;function Se(e){return I(L(new TextEncoder().encode(String(e))))}var B=e=>Array.isArray(e)?e.map(B):typeof e=="string"||typeof e=="number"?Se(e):null,O=e=>typeof e=="string"?e.toLowerCase():e;function oe(e){let n=Z.get(e);return n||(n=new Set(e),Z.set(e,n)),n}function ve(e){let n=ee.get(e);return n||(n=new Set(e.map(O)),ee.set(e,n)),n}function Ae(e){T(e);for(let n of Object.values(e)){let t=n?.type==="list"||n?.type==="hashed"?n.values:null;t&&t.length>=D&&oe(t)}return e}function h(e,n,t,r){t=t||{},r||T(t),r=r||new Set;for(let[o,s]of Object.entries(n))switch(o){case"$or":if(!ie(e,s,t,r))return!1;break;case"$nor":if(ie(e,s,t,r))return!1;break;case"$and":if(!Fe(e,s,t,r))return!1;break;case"$not":if(h(e,s,t,r))return!1;break;case"$savedGroup":if(!we(e,s,t,r))return!1;break;default:if(!V(s,se(e,o),t,!1,r))return!1}return!0}function we(e,n,t,r){if(!n||typeof n!="object"||Array.isArray(n))return!1;let{id:o,attributeKey:s}=n;if(typeof o!="string"||r.has(o)||s!==void 0&&typeof s!="string")return!1;let i=t[o];if(!i||Array.isArray(i)||typeof i!="object")return!1;let a=new Set(r).add(o);if(i.type==="list"||i.type==="hashed"){let u=s??i.attributeKey;if(typeof u!="string"||!Array.isArray(i.values))return!1;let f=se(e,u);return S(i.type==="hashed"?B(f):f,i.values)}return i.type==="condition"?!i.condition||typeof i.condition!="object"?!1:h(e,i.condition,t,a):!1}function se(e,n){let t=n.split("."),r=e;for(let o of t)if(r&&typeof r=="object"&&o in r)r=r[o];else return null;return r}function ne(e,n=!1){let t=`${e}${n?"/i":""}`,r=Y.get(t);return r||(r=new RegExp(e.replace(/([^\\])\//g,"$1\\/"),n?"i":void 0),Y.set(t,r)),r}function V(e,n,t,r=!1,o=new Set){if(typeof e=="string")return r?String(n).toLowerCase()===e.toLowerCase():n+""===e;if(typeof e=="number")return n*1===e;if(typeof e=="boolean")return n!==null&&!!n===e;if(e===null)return n===null;if(Array.isArray(e)||!ae(e))return JSON.stringify(n)===JSON.stringify(e);let s=e;for(let i in s)if(!Re(i,n,s[i],t,o))return!1;return!0}function ae(e){let n=Object.keys(e);return n.length>0&&n.filter(t=>t[0]==="$").length===n.length}function Ee(e){if(e===null)return"null";if(Array.isArray(e))return"array";let n=typeof e;return["string","number","boolean","object","undefined"].includes(n)?n:"unknown"}function Ve(e,n,t,r){if(!Array.isArray(e))return!1;let o=ae(n)?s=>V(n,s,t,!1,r):s=>h(s,n,t,r);for(let s=0;s<e.length;s++)if((e[s]??null)!==null&&o(e[s]))return!0;return!1}function S(e,n,t=!1){if(t){let o;if(n.length>=D){let s=ve(n);o=i=>{let a=O(i);return!(typeof a=="number"&&Number.isNaN(a))&&s.has(a)}}else o=s=>n.some(i=>O(s)===O(i));return Array.isArray(e)?e.some(s=>o(s)):o(e)}let r=n.length>=D?(o=>s=>o.has(s))(oe(n)):o=>n.includes(o);return Array.isArray(e)?e.some(o=>r(o)):r(e)}function te(e){return e===void 0?[]:e&&typeof e=="object"&&(e.type==="list"||e.type==="hashed")&&Array.isArray(e.values)?e.values:null}function re(e,n,t,r=!1,o=new Set){if(!Array.isArray(e))return!1;for(let s=0;s<n.length;s++){let i=!1;for(let a=0;a<e.length;a++)if(V(n[s],e[a],t,r,o)){i=!0;break}if(!i)return!1}return!0}function Re(e,n,t,r,o=new Set){let s=n,i=t;switch(e){case"$veq":return y(n)===y(t);case"$vne":return y(n)!==y(t);case"$vgt":return y(n)>y(t);case"$vgte":return y(n)>=y(t);case"$vlt":return y(n)<y(t);case"$vlte":return y(n)<=y(t);case"$eq":return n===t;case"$ne":return n!==t;case"$lt":return s<i;case"$lte":return s<=i;case"$gt":return s>i;case"$gte":return s>=i;case"$exists":return t?n!=null:n==null;case"$in":return Array.isArray(t)?S(n,t):!1;case"$ini":return Array.isArray(t)?S(n,t,!0):!1;case"$inGroup":{let a=r[t],u=te(a);return u===null?!1:S(a?.type==="hashed"?B(n):n,u)}case"$notInGroup":{let a=r[t],u=te(a);return u===null?!1:!S(a?.type==="hashed"?B(n):n,u)}case"$nin":return Array.isArray(t)?!S(n,t):!1;case"$nini":return Array.isArray(t)?!S(n,t,!0):!1;case"$not":return!V(t,n,r,!1,o);case"$size":return Array.isArray(n)?V(t,n.length,r,!1,o):!1;case"$elemMatch":return Ve(n,t,r,o);case"$all":return Array.isArray(t)?re(n,t,r,!1,o):!1;case"$alli":return Array.isArray(t)?re(n,t,r,!0,o):!1;case"$regex":try{return ne(t).test(n)}catch{return!1}case"$regexi":try{return ne(t,!0).test(n)}catch{return!1}case"$type":return Ee(n)===t;default:return!1}}function ie(e,n,t,r){if(!n.length)return!0;for(let o of n)if(h(e,o,t,r))return!0;return!1}function Fe(e,n,t,r){for(let o of n)if(!h(e,o,t,r))return!1;return!0}function ue(e){return Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))}function U(e){return H(e),{context:e,stack:{evaluatedFeatures:new Set}}}function _(e){return{...e.attributes,...e.attributeOverrides}}function p(e,n,t){let r=n||"id",o="",s=_(e);return s[r]&&(o=s[r]),!o&&t&&(s[t]&&(o=s[t]),o&&(r=t)),{hashAttribute:r,hashValue:o}}function l(e,n,t){e.context.log?.(n,t)}function x(e,n){return n=n||0,`${e}__${n}`}function q(e,n){return`${e}||${n}`}function Te(e,n,t){let r=e.stickyBucketAssignmentDocs;if(!r)return{};let{hashAttribute:o,hashValue:s}=p(e,n),i=q(o,E(s)),{hashAttribute:a,hashValue:u}=p(e,t),f=u?q(a,E(u)):null,c={};return f&&r[f]&&Object.assign(c,r[f].assignments||{}),r[i]&&Object.assign(c,r[i].assignments||{}),c}function le({context:e,expKey:n,expBucketVersion:t,expHashAttribute:r,expFallbackAttribute:o,expMinBucketVersion:s,expMeta:i}){t=t||0,s=s||0,r=r||"id",i=i||[];let a=x(n,t),u=Te(e,r,o);if(s>0)for(let d=0;d<s;d++){let k=x(n,d);if(u[k]!==void 0)return{variation:-1,versionIsBlocked:!0}}let f=u[a];if(f===void 0)return{variation:-1};let c=i.findIndex(d=>d.key===f);return c<0?{variation:-1}:{variation:c}}function fe(e,n,t,r){let o=q(n,t),s=e.stickyBucketAssignmentDocs,i=s&&s[o]?s[o].assignments||{}:{},a={...i,...r},u=JSON.stringify(i)!==JSON.stringify(a);return{key:o,doc:{attributeName:n,attributeValue:t,assignments:a},changed:u}}function Ce(e,n){let t=U(n),r=ge(e,null,t);return n.onExperimentEval?.(e,r),r}function $e(e,n){return N(e,U(n))}function Oe(e){return e.forcedVariations||{}}function ce(e,n,t){let{context:r}=e;if(r.trackedExperiments){let o=ke(n,t);if(r.trackedExperiments.has(o))return;r.trackedExperiments.add(o)}G(()=>r.onExperimentViewed?.(n,t))}function Be(e,n,t){let{context:r}=e;if(r.trackedFeatureUsage){let o=JSON.stringify(t.value);if(r.trackedFeatureUsage[n]===o)return;r.trackedFeatureUsage[n]=o}G(()=>r.onFeatureUsage?.(n,t))}function G(e){try{let n=e();n&&typeof n.catch=="function"&&n.catch(()=>{})}catch{}}function N(e,n){let{context:t}=n;if(n.stack.evaluatedFeatures.has(e))return l(n,`evalFeature: circular dependency detected: ${n.stack.id} -> ${e}`,{from:n.stack.id,to:e}),m(n,e,null,"cyclicPrerequisite");n.stack.evaluatedFeatures.add(e),n.stack.id=e;let r=t.features?.[e];for(let s of r?.rules??[])K(s);let o=t.forcedFeatureValues;if(o&&o.has(e))return l(n,"Global override",{id:e,value:o.get(e)}),m(n,e,o.get(e),"override");if(!r)return l(n,"Unknown feature",{id:e}),m(n,e,null,"unknownFeature");if(r.rules){let s=new Set(n.stack.evaluatedFeatures);e:for(let i of r.rules){if(i.parentConditions)for(let f of i.parentConditions){n.stack.evaluatedFeatures=new Set(s);let c=N(f.id,n);if(c.source==="cyclicPrerequisite")return m(n,e,null,"cyclicPrerequisite");let d={value:c.value};if(!h(d,f.condition||{},t.savedGroups||{})){if(f.gate)return l(n,"Feature blocked by prerequisite",{id:e,rule:i}),m(n,e,null,"prerequisite");l(n,"Skip rule because prerequisite evaluation fails",{id:e,rule:i});continue e}}if(i.filters&&ye(i.filters,n)){l(n,"Skip rule because of filters",{id:e,rule:i});continue}if("force"in i){if(i.condition&&!de(i.condition,n)){l(n,"Skip rule because of condition ff",{id:e,rule:i});continue}if(!xe(n,i.seed||e,i.hashAttribute,t.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion)){l(n,"Skip rule because user not included in rollout",{id:e,rule:i});continue}return l(n,"Force value from rule",{id:e,rule:i}),i.tracks&&i.tracks.forEach(f=>{ce(n,f.experiment,f.result)}),m(n,e,i.force,"force",i.id)}if(!i.variations){l(n,"Skip invalid rule",{id:e,rule:i});continue}let a={variations:i.variations,key:i.key||e};"coverage"in i&&(a.coverage=i.coverage),i.weights&&(a.weights=i.weights),i.hashAttribute&&(a.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(a.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(a.disableStickyBucketing=i.disableStickyBucketing),i.bucketVersion!==void 0&&(a.bucketVersion=i.bucketVersion),i.minBucketVersion!==void 0&&(a.minBucketVersion=i.minBucketVersion),i.meta&&(a.meta=i.meta),i.ranges&&(a.ranges=i.ranges),i.name&&(a.name=i.name),i.phase&&(a.phase=i.phase),i.seed&&(a.seed=i.seed),i.hashVersion&&(a.hashVersion=i.hashVersion),i.filters&&(a.filters=i.filters),i.condition&&(a.condition=i.condition);let u=ge(a,e,n);if(t.onExperimentEval?.(a,u),u.inExperiment&&!u.passthrough)return m(n,e,u.value,"experiment",i.id,a,u)}}return l(n,"Use default value",{id:e,value:r.defaultValue}),m(n,e,r.defaultValue===void 0?null:r.defaultValue,"defaultValue")}function ge(e,n,t){let{context:r}=t;K(e);let o=e.key,s=e.variations.length;if(s<2)return l(t,"Invalid experiment",{id:o}),g(t,e,-1,!1,n);if(r.enabled===!1)return l(t,"Context disabled",{id:o}),g(t,e,-1,!1,n);if(e.urlPatterns&&!j(r.url||"",e.urlPatterns))return l(t,"Skip because of url targeting",{id:o}),g(t,e,-1,!1,n);let i=z(o,r.url||"",s);if(i!==null)return l(t,"Force via querystring",{id:o,variation:i}),g(t,e,i,!1,n);let u=Oe(r)[o];if(u!==void 0)return l(t,"Force via dev tools",{id:o,variation:u}),g(t,e,u,!1,n);if(e.active===!1)return l(t,"Skip because inactive",{id:o}),g(t,e,-1,!1,n);let{hashAttribute:f,hashValue:c}=p(r,e.hashAttribute,r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!c)return l(t,"Skip because missing hashAttribute",{id:o}),g(t,e,-1,!1,n);let d=-1,k=!1,R=!1;if(r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{variation:b,versionIsBlocked:v}=le(ue({context:r,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta}));k=b>=0,d=b,R=!!v}if(!k){if(e.filters&&ye(e.filters,t))return l(t,"Skip because of filters",{id:o}),g(t,e,-1,!1,n);if(e.include&&!X(e.include))return l(t,"Skip because of include function",{id:o}),g(t,e,-1,!1,n);if(e.condition&&!de(e.condition,t))return l(t,"Skip because of condition exp",{id:o}),g(t,e,-1,!1,n);if(e.parentConditions){let b=new Set(t.stack.evaluatedFeatures);for(let v of e.parentConditions){t.stack.evaluatedFeatures=new Set(b);let w=N(v.id,t);if(w.source==="cyclicPrerequisite")return g(t,e,-1,!1,n);let P={value:w.value};if(!h(P,v.condition||{},r.savedGroups||{}))return l(t,"Skip because prerequisite evaluation fails",{id:o}),g(t,e,-1,!1,n)}}}let A=C(e.seed||o,c,e.hashVersion??2);if(A===null)return l(t,"Skip because of invalid hash version",{id:o}),g(t,e,-1,!1,n);if(!k){let b=e.ranges||Q(s,e.coverage===void 0?1:e.coverage,e.weights);d=W(A,b)}if(R)return l(t,"Skip because sticky bucket version is blocked",{id:o}),g(t,e,-1,!1,n,void 0,!0);if(d<0)return l(t,"Skip because of coverage",{id:o}),g(t,e,-1,!1,n);if("force"in e)return l(t,"Force variation",{id:o,variation:e.force}),g(t,e,e.force===void 0?-1:e.force,!1,n);if(r.qaMode)return l(t,"Skip because QA mode",{id:o}),g(t,e,-1,!1,n);let F=g(t,e,d,!0,n,A,k);if(r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{changed:b,key:v,doc:w}=fe(r,f,E(c),{[x(e.key,e.bucketVersion)]:F.key});if(b){r.stickyBucketAssignmentDocs=r.stickyBucketAssignmentDocs||{},r.stickyBucketAssignmentDocs[v]=w;let P=r.saveStickyBucketAssignmentDoc;G(()=>P(w))}}return ce(t,e,F),l(t,"In experiment",{id:o,variation:F.variationId}),F}function m(e,n,t,r,o,s,i){let a={value:t,on:!!t,off:!t,source:r,ruleId:o||""};return s&&(a.experiment=s),i&&(a.experimentResult=i),r!=="override"&&Be(e,n,a),a}function de(e,n){return h(_(n.context),e,n.context.savedGroups||{})}function ye(e,n){return e.some(t=>{let{hashValue:r}=p(n.context,t.attribute);if(!r)return!0;let o=C(t.seed,r,t.hashVersion||2);return o===null?!0:!t.ranges.some(s=>$(o,s))})}function xe(e,n,t,r,o,s,i){if(!o&&s===void 0)return!0;if(!o&&s===0)return!1;let{hashValue:a}=p(e.context,t,r);if(!a)return!1;let u=C(n,a,i??2);return u===null?!1:o?$(u,o):s!==void 0?u<=s:!0}function g(e,n,t,r,o,s,i){let a=!0;(t<0||t>=n.variations.length)&&(t=0,a=!1);let{hashAttribute:u,hashValue:f}=p(e.context,n.hashAttribute,e.context.saveStickyBucketAssignmentDoc&&!n.disableStickyBucketing?n.fallbackAttribute:void 0),c=n.meta?.[t]??{},d=n.variations[0];for(let[R,A]of n.variations.entries())if(R===t){d=A;break}let k={key:c.key||""+t,featureId:o,inExperiment:a,hashUsed:r,variationId:t,value:d,hashAttribute:u,hashValue:f,stickyBucketUsed:!!i};return c.name&&(k.name=c.name),s!==void 0&&(k.bucket=s),c.passthrough&&(k.passthrough=c.passthrough),k}function ke(e,n){return n.hashAttribute+n.hashValue+e.key+n.variationId}export{E as a,j as b,Ae as c,h as d,Ce as e,$e as f,ke as g};
|
|
2
|
-
/*! For license information please see chunk-
|
|
1
|
+
import{a as I,b as L}from"./chunk-CILM5XMH.js";function M(e){try{let n=e.replace(/([^\\])\//g,"$1\\/");return new RegExp(n)}catch{return}}function j(e,n){if(!n.length)return!1;let t=!1,r=!1;for(let o of n){let s=pe(e,o.type,o.pattern);if(o.include===!1){if(s)return!1}else t=!0,s&&(r=!0)}return r||!t}function he(e,n,t){try{let r=n.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return t&&(r="\\/?"+r.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+r+"$","i").test(e)}catch{return!1}}function be(e,n){try{let t=new URL(n.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),r=[[e.host,t.host,!1],[e.pathname,t.pathname,!0]];return t.hash&&r.push([e.hash,t.hash,!1]),t.searchParams.forEach((o,s)=>{r.push([e.searchParams.get(s)||"",o,!1])}),!r.some(o=>!he(o[0],o[1],o[2]))}catch{return!1}}function pe(e,n,t){try{let r=new URL(e,"https://_");if(n==="regex"){let o=M(t);return o?o.test(r.href)||o.test(r.href.substring(r.origin.length)):!1}else if(n==="simple")return be(r,t);return!1}catch{return!1}}function K(e){for(let t of["namespace","status","url","groups"])if(Object.hasOwn(e,t))throw new TypeError(`Retired experiment field: ${t}`);let n=e;if(n.hashVersion!==void 0&&n.hashVersion!==2)throw new TypeError("Only hash version 2 is supported");if(n.filters?.some(t=>t.hashVersion!==2))throw new TypeError("Only hash version 2 is supported")}function T(e){for(let n of Object.values(e)){if(Array.isArray(n))throw new TypeError("Saved groups require typed list or condition entries");if(n&&Object.hasOwn(n,"useEmptyListGroup"))throw new TypeError("Retired saved group field: useEmptyListGroup")}}function H(e){for(let n of["overrides","groups"])if(Object.hasOwn(e,n))throw new TypeError(`Retired evaluation context field: ${n}`);T(e.savedGroups??{})}function J(e){let n=2166136261,t=e.length;for(let r=0;r<t;r++)n^=e.charCodeAt(r),n+=(n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24);return n>>>0}function C(e,n,t){return t===2?J(J(e+n)+"")%1e4/1e4:null}function me(e){return e<=0?[]:new Array(e).fill(1/e)}function $(e,n){return e>=n[0]&&e<n[1]}function W(e,n){for(let[t,r]of n.entries())if($(e,r))return t;return-1}function Q(e,n,t){n=n===void 0?1:n,n<0?n=0:n>1&&(n=1);let r=me(e);t=t||r,t.length!==e&&(t=r);let o=t.reduce((a,u)=>u+a,0);(o<.99||o>1.01)&&(t=r);let s=0,i=n;return t.map(a=>{let u=s;return s+=a,[u,u+i*a]})}function z(e,n,t){if(!n)return null;let r=n.split("?")[1];if(!r)return null;let s=r.replace(/#.*/,"").split("&").map(i=>i.split("=",2)).filter(([i])=>i===e).map(([,i])=>i===void 0?NaN:parseInt(i))[0];return s!==void 0&&s>=0&&s<t?s:null}function X(e){try{return e()}catch{return!1}}function E(e){return typeof e=="string"?e:JSON.stringify(e)}function y(e){typeof e=="number"&&(e=e+""),(!e||typeof e!="string")&&(e="0");let n=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return n.length===3&&n.push("~"),n.map(t=>t.match(/^[0-9]+$/)?t.padStart(5," "):t).join("-")}var Y=new Map,D=32,Z=new WeakMap,ee=new WeakMap;function Se(e){return I(L(new TextEncoder().encode(String(e))))}var B=e=>Array.isArray(e)?e.map(B):typeof e=="string"||typeof e=="number"?Se(e):null,O=e=>typeof e=="string"?e.toLowerCase():e;function oe(e){let n=Z.get(e);return n||(n=new Set(e),Z.set(e,n)),n}function ve(e){let n=ee.get(e);return n||(n=new Set(e.map(O)),ee.set(e,n)),n}function Ae(e){T(e);for(let n of Object.values(e)){let t=n?.type==="list"||n?.type==="hashed"?n.values:null;t&&t.length>=D&&oe(t)}return e}function h(e,n,t,r){t=t||{},r||T(t),r=r||new Set;for(let[o,s]of Object.entries(n))switch(o){case"$or":if(!ie(e,s,t,r))return!1;break;case"$nor":if(ie(e,s,t,r))return!1;break;case"$and":if(!Fe(e,s,t,r))return!1;break;case"$not":if(h(e,s,t,r))return!1;break;case"$savedGroup":if(!we(e,s,t,r))return!1;break;default:if(!V(s,se(e,o),t,!1,r))return!1}return!0}function we(e,n,t,r){if(!n||typeof n!="object"||Array.isArray(n))return!1;let{id:o,attributeKey:s}=n;if(typeof o!="string"||r.has(o)||s!==void 0&&typeof s!="string")return!1;let i=t[o];if(!i||Array.isArray(i)||typeof i!="object")return!1;let a=new Set(r).add(o);if(i.type==="list"||i.type==="hashed"){let u=s??i.attributeKey;if(typeof u!="string"||!Array.isArray(i.values))return!1;let f=se(e,u);return S(i.type==="hashed"?B(f):f,i.values)}return i.type==="condition"?!i.condition||typeof i.condition!="object"?!1:h(e,i.condition,t,a):!1}function se(e,n){let t=n.split("."),r=e;for(let o of t)if(r&&typeof r=="object"&&o in r)r=r[o];else return null;return r}function ne(e,n=!1){let t=`${e}${n?"/i":""}`,r=Y.get(t);return r||(r=new RegExp(e.replace(/([^\\])\//g,"$1\\/"),n?"i":void 0),Y.set(t,r)),r}function V(e,n,t,r=!1,o=new Set){if(typeof e=="string")return r?String(n).toLowerCase()===e.toLowerCase():n+""===e;if(typeof e=="number")return n*1===e;if(typeof e=="boolean")return n!==null&&!!n===e;if(e===null)return n===null;if(Array.isArray(e)||!ae(e))return JSON.stringify(n)===JSON.stringify(e);let s=e;for(let i in s)if(!Re(i,n,s[i],t,o))return!1;return!0}function ae(e){let n=Object.keys(e);return n.length>0&&n.filter(t=>t[0]==="$").length===n.length}function Ee(e){if(e===null)return"null";if(Array.isArray(e))return"array";let n=typeof e;return["string","number","boolean","object","undefined"].includes(n)?n:"unknown"}function Ve(e,n,t,r){if(!Array.isArray(e))return!1;let o=ae(n)?s=>V(n,s,t,!1,r):s=>h(s,n,t,r);for(let s=0;s<e.length;s++)if((e[s]??null)!==null&&o(e[s]))return!0;return!1}function S(e,n,t=!1){if(t){let o;if(n.length>=D){let s=ve(n);o=i=>{let a=O(i);return!(typeof a=="number"&&Number.isNaN(a))&&s.has(a)}}else o=s=>n.some(i=>O(s)===O(i));return Array.isArray(e)?e.some(s=>o(s)):o(e)}let r=n.length>=D?(o=>s=>o.has(s))(oe(n)):o=>n.includes(o);return Array.isArray(e)?e.some(o=>r(o)):r(e)}function te(e){return e===void 0?[]:e&&typeof e=="object"&&(e.type==="list"||e.type==="hashed")&&Array.isArray(e.values)?e.values:null}function re(e,n,t,r=!1,o=new Set){if(!Array.isArray(e))return!1;for(let s=0;s<n.length;s++){let i=!1;for(let a=0;a<e.length;a++)if(V(n[s],e[a],t,r,o)){i=!0;break}if(!i)return!1}return!0}function Re(e,n,t,r,o=new Set){let s=n,i=t;switch(e){case"$veq":return y(n)===y(t);case"$vne":return y(n)!==y(t);case"$vgt":return y(n)>y(t);case"$vgte":return y(n)>=y(t);case"$vlt":return y(n)<y(t);case"$vlte":return y(n)<=y(t);case"$eq":return n===t;case"$ne":return n!==t;case"$lt":return s<i;case"$lte":return s<=i;case"$gt":return s>i;case"$gte":return s>=i;case"$exists":return t?n!=null:n==null;case"$in":return Array.isArray(t)?S(n,t):!1;case"$ini":return Array.isArray(t)?S(n,t,!0):!1;case"$inGroup":{let a=r[t],u=te(a);return u===null?!1:S(a?.type==="hashed"?B(n):n,u)}case"$notInGroup":{let a=r[t],u=te(a);return u===null?!1:!S(a?.type==="hashed"?B(n):n,u)}case"$nin":return Array.isArray(t)?!S(n,t):!1;case"$nini":return Array.isArray(t)?!S(n,t,!0):!1;case"$not":return!V(t,n,r,!1,o);case"$size":return Array.isArray(n)?V(t,n.length,r,!1,o):!1;case"$elemMatch":return Ve(n,t,r,o);case"$all":return Array.isArray(t)?re(n,t,r,!1,o):!1;case"$alli":return Array.isArray(t)?re(n,t,r,!0,o):!1;case"$regex":try{return ne(t).test(n)}catch{return!1}case"$regexi":try{return ne(t,!0).test(n)}catch{return!1}case"$type":return Ee(n)===t;default:return!1}}function ie(e,n,t,r){if(!n.length)return!0;for(let o of n)if(h(e,o,t,r))return!0;return!1}function Fe(e,n,t,r){for(let o of n)if(!h(e,o,t,r))return!1;return!0}function ue(e){return Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))}function U(e){return H(e),{context:e,stack:{evaluatedFeatures:new Set}}}function _(e){return{...e.attributes,...e.attributeOverrides}}function p(e,n,t){let r=n||"id",o="",s=_(e);return s[r]&&(o=s[r]),!o&&t&&(s[t]&&(o=s[t]),o&&(r=t)),{hashAttribute:r,hashValue:o}}function l(e,n,t){e.context.log?.(n,t)}function x(e,n){return n=n||0,`${e}__${n}`}function q(e,n){return`${e}||${n}`}function Te(e,n,t){let r=e.stickyBucketAssignmentDocs;if(!r)return{};let{hashAttribute:o,hashValue:s}=p(e,n),i=q(o,E(s)),{hashAttribute:a,hashValue:u}=p(e,t),f=u?q(a,E(u)):null,c={};return f&&r[f]&&Object.assign(c,r[f].assignments||{}),r[i]&&Object.assign(c,r[i].assignments||{}),c}function le({context:e,expKey:n,expBucketVersion:t,expHashAttribute:r,expFallbackAttribute:o,expMinBucketVersion:s,expMeta:i}){t=t||0,s=s||0,r=r||"id",i=i||[];let a=x(n,t),u=Te(e,r,o);if(s>0)for(let d=0;d<s;d++){let k=x(n,d);if(u[k]!==void 0)return{variation:-1,versionIsBlocked:!0}}let f=u[a];if(f===void 0)return{variation:-1};let c=i.findIndex(d=>d.key===f);return c<0?{variation:-1}:{variation:c}}function fe(e,n,t,r){let o=q(n,t),s=e.stickyBucketAssignmentDocs,i=s&&s[o]?s[o].assignments||{}:{},a={...i,...r},u=JSON.stringify(i)!==JSON.stringify(a);return{key:o,doc:{attributeName:n,attributeValue:t,assignments:a},changed:u}}function Ce(e,n){let t=U(n),r=ge(e,null,t);return n.onExperimentEval?.(e,r),r}function $e(e,n){return N(e,U(n))}function Oe(e){return e.forcedVariations||{}}function ce(e,n,t){let{context:r}=e;if(r.trackedExperiments){let o=ke(n,t);if(r.trackedExperiments.has(o))return;r.trackedExperiments.add(o)}G(()=>r.onExperimentViewed?.(n,t))}function Be(e,n,t){let{context:r}=e;if(r.trackedFeatureUsage){let o=JSON.stringify(t.value);if(r.trackedFeatureUsage[n]===o)return;r.trackedFeatureUsage[n]=o}G(()=>r.onFeatureUsage?.(n,t))}function G(e){try{let n=e();n&&typeof n.catch=="function"&&n.catch(()=>{})}catch{}}function N(e,n){let{context:t}=n;if(n.stack.evaluatedFeatures.has(e))return l(n,`evalFeature: circular dependency detected: ${n.stack.id} -> ${e}`,{from:n.stack.id,to:e}),m(n,e,null,"cyclicPrerequisite");n.stack.evaluatedFeatures.add(e),n.stack.id=e;let r=t.features?.[e];for(let s of r?.rules??[])K(s);let o=t.forcedFeatureValues;if(o&&o.has(e))return l(n,"Global override",{id:e,value:o.get(e)}),m(n,e,o.get(e),"override");if(!r)return l(n,"Unknown feature",{id:e}),m(n,e,null,"unknownFeature");if(r.rules){let s=new Set(n.stack.evaluatedFeatures);e:for(let i of r.rules){if(i.parentConditions)for(let f of i.parentConditions){n.stack.evaluatedFeatures=new Set(s);let c=N(f.id,n);if(c.source==="cyclicPrerequisite")return m(n,e,null,"cyclicPrerequisite");let d={value:c.value};if(!h(d,f.condition||{},t.savedGroups||{})){if(f.gate)return l(n,"Feature blocked by prerequisite",{id:e,rule:i}),m(n,e,null,"prerequisite");l(n,"Skip rule because prerequisite evaluation fails",{id:e,rule:i});continue e}}if(i.filters&&ye(i.filters,n)){l(n,"Skip rule because of filters",{id:e,rule:i});continue}if("force"in i){if(i.condition&&!de(i.condition,n)){l(n,"Skip rule because of condition ff",{id:e,rule:i});continue}if(!xe(n,i.seed||e,i.hashAttribute,t.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion)){l(n,"Skip rule because user not included in rollout",{id:e,rule:i});continue}return l(n,"Force value from rule",{id:e,rule:i}),i.tracks&&i.tracks.forEach(f=>{ce(n,f.experiment,f.result)}),m(n,e,i.force,"force",i.id)}if(!i.variations){l(n,"Skip invalid rule",{id:e,rule:i});continue}let a={variations:i.variations,key:i.key||e};"coverage"in i&&(a.coverage=i.coverage),i.weights&&(a.weights=i.weights),i.hashAttribute&&(a.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(a.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(a.disableStickyBucketing=i.disableStickyBucketing),i.bucketVersion!==void 0&&(a.bucketVersion=i.bucketVersion),i.minBucketVersion!==void 0&&(a.minBucketVersion=i.minBucketVersion),i.meta&&(a.meta=i.meta),i.ranges&&(a.ranges=i.ranges),i.name&&(a.name=i.name),i.phase&&(a.phase=i.phase),i.seed&&(a.seed=i.seed),i.hashVersion&&(a.hashVersion=i.hashVersion),i.filters&&(a.filters=i.filters),i.condition&&(a.condition=i.condition);let u=ge(a,e,n);if(t.onExperimentEval?.(a,u),u.inExperiment&&!u.passthrough)return m(n,e,u.value,"experiment",i.id,a,u)}}return l(n,"Use default value",{id:e,value:r.defaultValue}),m(n,e,r.defaultValue===void 0?null:r.defaultValue,"defaultValue")}function ge(e,n,t){let{context:r}=t;K(e);let o=e.key,s=e.variations.length;if(s<2)return l(t,"Invalid experiment",{id:o}),g(t,e,-1,!1,n);if(r.enabled===!1)return l(t,"Context disabled",{id:o}),g(t,e,-1,!1,n);if(e.urlPatterns&&!j(r.url||"",e.urlPatterns))return l(t,"Skip because of url targeting",{id:o}),g(t,e,-1,!1,n);let i=z(o,r.url||"",s);if(i!==null)return l(t,"Force via querystring",{id:o,variation:i}),g(t,e,i,!1,n);let u=Oe(r)[o];if(u!==void 0)return l(t,"Force via dev tools",{id:o,variation:u}),g(t,e,u,!1,n);if(e.active===!1)return l(t,"Skip because inactive",{id:o}),g(t,e,-1,!1,n);let{hashAttribute:f,hashValue:c}=p(r,e.hashAttribute,r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!c)return l(t,"Skip because missing hashAttribute",{id:o}),g(t,e,-1,!1,n);let d=-1,k=!1,R=!1;if(r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{variation:b,versionIsBlocked:v}=le(ue({context:r,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta}));k=b>=0,d=b,R=!!v}if(!k){if(e.filters&&ye(e.filters,t))return l(t,"Skip because of filters",{id:o}),g(t,e,-1,!1,n);if(e.include&&!X(e.include))return l(t,"Skip because of include function",{id:o}),g(t,e,-1,!1,n);if(e.condition&&!de(e.condition,t))return l(t,"Skip because of condition exp",{id:o}),g(t,e,-1,!1,n);if(e.parentConditions){let b=new Set(t.stack.evaluatedFeatures);for(let v of e.parentConditions){t.stack.evaluatedFeatures=new Set(b);let w=N(v.id,t);if(w.source==="cyclicPrerequisite")return g(t,e,-1,!1,n);let P={value:w.value};if(!h(P,v.condition||{},r.savedGroups||{}))return l(t,"Skip because prerequisite evaluation fails",{id:o}),g(t,e,-1,!1,n)}}}let A=C(e.seed||o,c,e.hashVersion??2);if(A===null)return l(t,"Skip because of invalid hash version",{id:o}),g(t,e,-1,!1,n);if(!k){let b=e.ranges||Q(s,e.coverage===void 0?1:e.coverage,e.weights);d=W(A,b)}if(R)return l(t,"Skip because sticky bucket version is blocked",{id:o}),g(t,e,-1,!1,n,void 0,!0);if(d<0)return l(t,"Skip because of coverage",{id:o}),g(t,e,-1,!1,n);if("force"in e)return l(t,"Force variation",{id:o,variation:e.force}),g(t,e,e.force===void 0?-1:e.force,!1,n);if(r.qaMode)return l(t,"Skip because QA mode",{id:o}),g(t,e,-1,!1,n);let F=g(t,e,d,!0,n,A,k);if(r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{changed:b,key:v,doc:w}=fe(r,f,E(c),{[x(e.key,e.bucketVersion)]:F.key});if(b){r.stickyBucketAssignmentDocs=r.stickyBucketAssignmentDocs||{},r.stickyBucketAssignmentDocs[v]=w;let P=r.saveStickyBucketAssignmentDoc;G(()=>P(w))}}return ce(t,e,F),l(t,"In experiment",{id:o,variation:F.variationId}),F}function m(e,n,t,r,o,s,i){let a={value:t,on:!!t,off:!t,source:r,ruleId:o||""};return s&&(a.experiment=s),i&&(a.experimentResult=i),r!=="override"&&Be(e,n,a),a}function de(e,n){return h(_(n.context),e,n.context.savedGroups||{})}function ye(e,n){return e.some(t=>{let{hashValue:r}=p(n.context,t.attribute);if(!r)return!0;let o=C(t.seed,r,t.hashVersion||2);return o===null?!0:!t.ranges.some(s=>$(o,s))})}function xe(e,n,t,r,o,s,i){if(!o&&s===void 0)return!0;if(!o&&s===0)return!1;let{hashValue:a}=p(e.context,t,r);if(!a)return!1;let u=C(n,a,i??2);return u===null?!1:o?$(u,o):s!==void 0?u<=s:!0}function g(e,n,t,r,o,s,i){let a=!0;(t<0||t>=n.variations.length)&&(t=0,a=!1);let{hashAttribute:u,hashValue:f}=p(e.context,n.hashAttribute,e.context.saveStickyBucketAssignmentDoc&&!n.disableStickyBucketing?n.fallbackAttribute:void 0),c=n.meta?.[t]??{},d=n.variations[0];for(let[R,A]of n.variations.entries())if(R===t){d=A;break}let k={key:c.key||""+t,featureId:o,inExperiment:a,hashUsed:r,variationId:t,value:d,hashAttribute:u,hashValue:f,stickyBucketUsed:!!i};return c.name&&(k.name=c.name),s!==void 0&&(k.bucket=s),c.passthrough&&(k.passthrough=c.passthrough),k}function ke(e,n){return n.hashAttribute+n.hashValue+e.key+n.variationId}export{E as a,j as b,Ae as c,h as d,Ce as e,$e as f,ke as g};
|
|
2
|
+
/*! For license information please see chunk-VPT5MFDG.js.LEGAL.txt */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as o}from"./chunk-
|
|
1
|
+
import{m as o}from"./chunk-VCRDA5R3.js";import{a as i}from"./chunk-355B3KPL.js";function m(t,e,n,r){if(!o(t,e)||n!==void 0&&e.observation&&e.observation.subject.customerId!==n||r!==void 0&&e.observation!==void 0&&(e.observation.subject.scope.projectId!==r.projectId||e.observation.subject.scope.environment!==r.environment))throw new i("INVALID_RESPONSE","The access requirement or Customer changed");return e}function d(t,e,n){if(t.requirement){if(!e)throw new i("INVALID_RESPONSE","The requested access check is missing");m(t.requirement,e,t.customerId,n)}}export{m as a,d as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p}from"./chunk-
|
|
1
|
+
import{a as p}from"./chunk-355B3KPL.js";import{a as d}from"./chunk-TDOPU2RH.js";function I(n,r,i){if(!["subscriptions/operations/read","subscriptions/updates/read","subscriptions/refunds/read"].includes(n))return;let e=r,s=i,o=s.operation;if(o.operationId!==e.operationId||[o.authority,o.merchantExecution].some(t=>t&&(t.operationId!==e.operationId||e.customerId!==void 0&&t.customerId!==e.customerId))||o.authority&&(o.authority.scope.projectId!==s.scope.projectId||o.authority.scope.environment!==s.scope.environment))throw new p("INVALID_RESPONSE","Original commerce operation changed")}function g(n){try{return structuredClone(n)}catch{return n}}async function E(n,r){let i=n.captureIdentity?.(),{apiOperations:e}=await import("./operation-contracts-NLZ5ENTM.js");return i?.(),e[r]}function m(n,r,i,e){try{return n.parse(r)}catch(s){throw e&&s instanceof d?new p(i,e):s}}async function P(n,r,i,e={},s){let o=typeof e=="function"?{}:e,t=m(r.request,i,"INVALID_REQUEST",o.request);try{let a=await n(r.path,t,r.method,s),u=typeof e=="function"?e:e.parseResponse,c=u?u(r.response,a):m(r.response,a,"INVALID_RESPONSE",o.response);return I(r.path,t,c),c}catch(a){throw a instanceof p&&t!==null&&typeof t=="object"&&"requestId"in t&&typeof t.requestId=="string"&&(a.commandRequestId??=t.requestId),a}}export{g as a,E as b,P as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as xn,c as Sn,d as Lt,f as Mt,g as Tn,k as On}from"./chunk-CHRNCOXJ.js";import{a as Cn,b as Ye}from"./chunk-W32FI2A2.js";import{e as Pn,f as vn,g as kn,h as In,j as Ut,k as ct,l as En,m as An,n as Rn}from"./chunk-CO6HDNOC.js";import{a as Ot,b as yn,d as Nt,e as gn,f as wn}from"./chunk-Y55OBV7D.js";import{a as st,b as te,d as Dt,f as _t,j as bn}from"./chunk-MOIVJERE.js";import{b as xe}from"./chunk-6XRQR43F.js";import{B as L,C as ot,D as Ge,E as Se,y as mn}from"./chunk-3532HSBP.js";import{r as Le,t as Ee}from"./chunk-Y3W5G4BF.js";import{i as hn}from"./chunk-FYUMVOCV.js";import{c as Ie,j as We}from"./chunk-DUS5V65Z.js";import{c as Tt}from"./chunk-BOT6ZDLK.js";import{a as k}from"./chunk-UGATOG2T.js";import{a as K}from"./chunk-DSPLGTQI.js";async function Nn(q,a,A){if(!Ge(a))throw new k("INVALID_RESPONSE","A verified completed purchase is required");let D=q?We.parse(q):null;if(await A.onComplete?.(a),!D||!A.check)return;let G=We.parse(await A.check());if(G.internal_feature_id!==D.internal_feature_id||G.quantity!==D.quantity||D.observation!==void 0&&(G.observation===void 0||G.observation.requirementDigest!==D.observation.requirementDigest||G.observation.authority!==D.observation.authority||Tt(G.observation.subject)!==Tt(D.observation.subject)))throw new k("INVALID_RESPONSE","The access requirement changed");G.allowed&&await A.onAccessGranted?.(G)}function Dn(q){return Object.entries(q.document.buttons).filter(([,a])=>a.type==="checkout"&&a.product.type==="fixed"&&!xe(a.product,{},q.capabilities)).map(([a])=>a)}function _n(q,a){let A=L(a)?void 0:a.lines[0];if(!L(a)&&(a.lines.length!==1||!A))return;let D=L(a)?a.productVersionId:A.productVersionId,{screen:G,buttons:ce}=q.document,B=new Map(L(a)?Object.entries(a.featureQuantities??{}):(A?.prepaid??[]).map(C=>[C.internal_feature_id,C.quantity]));function le(C,d){if(C.hidden)return!1;if(C.type==="plan_picker"&&q.capabilities.pickers[C.id]?.options.includes(D))return d[C.id]=D,!0;if(C.type==="quantity_picker"){let re=B.get(C.internalFeatureId);return re!==void 0&&(!C.bind?.plan||C.bind.plan===D)&&(d[C.id]=re),!1}if(C.type==="button"&&C.action){let re=ce[C.action];return re?.type==="checkout"&&re.product.type==="fixed"&&re.product.productVersionId===D}if(C.type!=="stack")return!1;let ne=C.interaction,i=C.bind?.plan===D;for(let[re,m]of C.children.entries()){let Z={},M=le(m,Z);if(ne?.type==="toggle"||ne?.type==="tabs"){if(!M)continue;return d[C.id]=ne.type==="toggle"?re===0:m.id,Object.assign(d,Z),!0}Object.assign(d,Z),M&&(i=!0,ne?.type==="select"&&ne.purpose==="product"&&ne.pickerId&&m.type==="stack"&&m.bind?.plan===D&&(d[C.id]=m.id,d[ne.pickerId]=D))}return i}for(let C of G.pages){let d={__page:C.id};if(le(C.root,d))return d}}var qn="position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0";async function kr(q,a,A){let D=a.focusAtReveal?()=>{}:Ut(q.ownerDocument),G=()=>{B.finish("dismissed"),D()},ce=()=>G(),B=En(q,a,"paywall",()=>{G(),K(a.onDismiss)},xn);a.signal?.throwIfAborted(),a.signal?.addEventListener("abort",ce,{once:!0});let le=null,C,d,ne;try{if(B.start(!0,a.loadingDocument?.screen.strings.defaultLocale,a.loadingDocument??null),B.cancelled)throw new DOMException("Presentation cancelled","AbortError");if(le=a.check?We.parse(await B.wait(a.check(),ct)):null,le?.allowed)return B.finish("skipped"),a.signal?.removeEventListener("abort",ce),D(),await a.onAccessGranted?.(le),{check:le,host:null};let[e,n]=await Promise.allSettled([B.wait(import("./screen-renderer-HJOKBOZH.js")),B.wait(a.start().then(r=>(B.cancelled&&r.destroy(),r)),ct)]);if(e.status==="rejected")throw n.status==="fulfilled"&&n.value.destroy(),e.reason;if(n.status==="rejected")throw n.reason;ne=e.value,C=n.value,a.signal?.throwIfAborted(),C.signal?.throwIfAborted(),C.signal?.addEventListener("abort",ce,{once:!0});let t=C.view??await B.wait(C.refresh(),ct);if(!t)throw new k("INVALID_RESPONSE","Paywall presentation is missing");C.signal?.throwIfAborted(),d=t}catch(e){throw B.finish("error",e),A?.retainedDialog?.release(),a.signal?.removeEventListener("abort",ce),C?.signal?.removeEventListener("abort",ce),C?.destroy(),D(),e}let i=C,{mountScreenPreview:re}=ne,m=q.ownerDocument,Z=new AbortController,M=m.createElement("section"),fe=m.createElement("div"),Y=m.createElement("div"),lt=a.mountControls,ee=lt?m.createElement("div"):void 0,p=m.createElement("p"),y=m.createElement("button"),ie=m.createElement("button"),_=m.createElement("button");(typeof INDIANA_NATIVE_SHELL_BUILD>"u"||!INDIANA_NATIVE_SHELL_BUILD)&&A?.hostPaywallTarget&&!A.retainedDialog&&d.document.presentation.type==="modal"&&(A.retainedDialog=In(A.hostPaywallTarget));let ue=A?.retainedDialog,S=ue?.dialog??m.createElement("dialog"),Me=ue&&d.document.presentation.type==="inline"?{type:"modal",size:"md"}:d.document.presentation,ae=Me.type==="inline"?Y:m.createElement("div"),ut=i.locale||d.document.screen.strings.defaultLocale,o=ut.toLowerCase().startsWith("zh"),Un=o?"正在处理…":"Processing…",Ln=o?"正在准备报价…":"Preparing your price…",U=Sn(d.document.screen.theme);M.dataset.indianaPaywall="",M.setAttribute("aria-label",d.document.name),M.style.cssText=U.root,Y.style.cssText=U.controls,p.style.cssText=U.message,p.setAttribute("role","status"),_.style.cssText=U.link,_.textContent=o?"关闭":"Close",y.style.cssText=U.secondary,y.textContent=o?"重试":"Retry",y.hidden=!0,ie.type="button",ie.style.cssText=U.primary,ie.textContent=o?"继续付款":"Continue payment",ie.hidden=!0,ae.append(p,ie,y),Y.append(_),ee&&(ee.style.cssText="flex:1 0 100%;min-width:0",ee.hidden=!0,Y.prepend(ee)),ae!==Y&&(ae.dataset.indianaPaywallStatus="",ae.style.cssText="display:none;padding:0",M.append(ae)),M.append(fe,Y);let dt=()=>{let e=$n();p.style.cssText=e?`${U.message};${qn}`:U.message,Kt();let n=c=>!c.hidden&&(c!==p||!!p.textContent&&!e);if(ae!==Y&&(ae.style.cssText=!oe&&[...ae.children].some(n)?`${U.controls};padding:12px 64px 12px 20px;flex-shrink:0`:e?"padding:0":"display:none;padding:0"),ee){let c=!ee.childElementCount&&!ee.textContent?.trim();ee.hidden!==c&&(ee.hidden=c)}let t=ye??Y,r=![...t.children].some(n),l=[...t.children].some(c=>c!==_&&n(c));t.style.cssText=r?U.controls.replace(/padding:[^;]+/,"padding:0"):l?`${U.controls};${U.pinned}`:U.controls,ft()},Vt=typeof MutationObserver>"u"?void 0:new MutationObserver(dt);Vt?.observe(M,{attributes:!0,attributeFilter:["hidden"],characterData:!0,childList:!0,subtree:!0});let Mn=Object.entries(d.document.buttons).filter(([,e])=>e.type==="close").map(([e])=>e),T,$t,Ve=!1,Ht=JSON.stringify(d.capabilities),V;function he(e){let n=Dn(e);if(V||de&&!se||F&&(P||!Ce()||be))return Oe(e).map(({actionId:r})=>r);if(Ct()||!P&&Ce())return n;let t=P?bt(e):Pt(e);return[...new Set([...n,...Oe(e).map(({actionId:r})=>r).filter(r=>!t.includes(r))])]}function $e(e){if(w)return;let n=d.id!==e.id;d=e;let t=JSON.stringify(e.capabilities);if(n||t!==Ht){let r=!b&&!i.quote&&!i.operation?st(e,J,jt):J;n||JSON.stringify(r)!==JSON.stringify(J)?(J=r,T?.update(e.document.screen,ut,{capabilities:te(e),unavailableActions:he(e),serverInput:{bindings:[],answers:{}},selection:J})):T?.updateCapabilities(te(e),he(e)),Ht=t}Hn(e),Pe(),Ze()}let $,pt=0;function Qt(){return(ye??Y).getBoundingClientRect().height+(ae===Y?0:ae.getBoundingClientRect().height)}function ft(){let e=m.defaultView;if(!$?.responsive||!e)return;let n=ye??Y,t=e.innerHeight-($.type==="modal"?32:0);n.style.maxHeight=`${Math.max(1,t)}px`,n.style.overflowY="auto",n.style.flexShrink="0",pt=Math.max(1,t-Qt()),T?.resizeViewport?.(pt,e.innerWidth)}let w=!1,de=!1,b=null,ht,ze=!1,Bt=!1,me=!1,mt,Ke=!1,oe,ye;function Vn(){return de||w||oe||Ke?{type:"recover",operationId:i.operation?.operationId??i.quote?.operationId??null,requestId:null}:Nt(i)}let E=()=>!w&&!ze&&!oe&&a.canInteract?.()!==!1,H,ge=!1,Te=!1,yt,h=null,pe=null,Je="",we=()=>a.checkoutNavigation==="after_confirmation"&&!!(a.terminateCheckout||a.resumeCheckout),J={},jt=new Set,se,P;function gt(e){return!!e&&L(e)&&e.timing==="immediate"&&e.execution.provider==="merchant"}let wt=o?"正在确认付款…":"Confirming payment…",F=null,be,Xe,qt=!1,Ce=()=>a.allowNewPurchase!==!1||qt;function Ft(){return JSON.stringify([d.id,d.capabilities])}function Wt(){let e=yt;return e&&e.read===a.prepareSubscriptionChange&&e.basis===Ft()?e:void 0}function Ze(){let e=a.prepareSubscriptionChange;if(!e||!me||!E()||!Ce()||a.onPurchaseIntent||m.visibilityState==="hidden"||b||i.quote||i.operation||!Oe(d).length||Wt())return;let n=Z.signal,t=new Promise(r=>{let l=()=>r(void 0);n.addEventListener("abort",l,{once:!0}),Promise.resolve().then(()=>(n.throwIfAborted(),e(n))).then(c=>r(n.aborted?void 0:c),l).finally(()=>n.removeEventListener("abort",l))});yt={read:e,basis:Ft(),result:t}}let Gt=()=>{m.visibilityState==="hidden"?yt=void 0:Ze()};m.addEventListener("visibilitychange",Gt);function Oe(e){return Object.entries(e.document.buttons).flatMap(([n,t])=>t.type==="checkout"?[{actionId:n,policy:t}]:[])}function Yt(e){let n=P?.quote;return n?Oe(e).filter(({actionId:t,policy:r})=>Ne(n,e,t,r.product,J)).map(({actionId:t})=>t):[]}function bt(e){return P?.phase==="payment"?Yt(e):[]}function Ct(){return(P?P.phase==="payment":!Ce())&&(Ce()||!!a.prepareUpgradeReplacement)&&we()&&!!a.terminateCheckout&&!!i.quote&&i.canReselect===!1&&!!i.operation&&R(i.operation).type==="checkout"}function Pt(e){let n=i.quote;return!we()||F||!n||!i.operation||R(i.operation).type!=="checkout"?[]:Oe(e).filter(({actionId:t,policy:r})=>Ne(n,e,t,r.product,J)).map(({actionId:t})=>t)}function Pe(){let e=V?[]:P?bt(d):Pt(d),n=a.allowNewPurchase===!1&&!!i.operation&&R(i.operation).type==="checkout";ie.hidden=!!V||(P?P.phase!=="payment":!n)||e.length>0,Kt(e)}function zt(){if(!(se===void 0||V))return p.textContent?p.textContent:P?.phase==="checking"?wt:void 0}function $n(){return!!T?.updateCheckoutControls&&!!p.textContent&&zt()!==void 0}let et;function Kt(e=V?[]:P?bt(d):Pt(d)){if(!T?.updateCheckoutControls)return;let n=zt(),t=we()||!!P;if(!n&&!t&&et?.on!==T)return;let r={actions:Oe(d).map(({actionId:c})=>c),resume:n?[se]:t?e:[],resumeLabel:n??(o?"继续付款":P?"Continue payment":"Continue checkout"),busy:se},l=JSON.stringify(r);et?.on===T&&et.key===l||(et={on:T,key:l},T.updateCheckoutControls(r))}function Jt(){pe?.remove(),pe=null}async function tt(){if(F)return;if(a.resumeCheckout&&i.operation){let n=i.operation.operationId;try{await a.resumeCheckout(n)}catch(t){if(!(t instanceof k&&t.code==="PURCHASE_PENDING"))throw t;let r=await i.read();if(!E())return;if(r.operationId!==n||R(r).type==="checkout")throw t;await Q(r,!1)}return}let e=await i.read();if(R(e).type!=="checkout")return Q(e,!1);E()&&(He.delete(e.operationId),await Qe(e))}function vt(){be?.destroy(),be=void 0,Xe=void 0}function Xt(){let e=F;if(!e||be)return;let n=o?"仍在核对原订单,暂时无法更换套餐。":"We’re still checking the original purchase before changing plans.",t=Date.now()+6e5,r=Cn({document:m,delay:()=>Date.now()<t?5e3:void 0,async run(){if(!E())return;let l=await i.read();if(be!==r||!E())return;if(l.operationId!==e.operationId)throw new k("PURCHASE_PENDING","The original Checkout changed");let c=R(l);c.type==="native"?(vt(),p.textContent=o?"原订单已关闭。你可以继续更换套餐。":"The original checkout is closed. You can continue changing plans.",y.textContent=o?"继续更换套餐":"Continue changing plans",h=()=>nt(),y.hidden=!1):(c.type==="complete"||c.type==="fulfillment"||c.type==="recording")&&(vt(),F=null,y.hidden=!0,await Q(l,!1))}});be=r,Xe=async()=>{try{await r.refresh()}finally{be===r&&(p.textContent=n,y.hidden=!1)}},h=Xe,y.textContent=o?"查询结果":"Check result",y.hidden=!1,p.textContent=n,r.schedule()}async function nt(e=!1,n=!1){let t=F;if(!t)return;h=()=>nt(),P&&(y.textContent=o?"查询状态":"Check status"),y.hidden=!0;let r=async()=>{if(!Ce()&&a.prepareUpgradeReplacement){let c=await a.prepareUpgradeReplacement(t.operationId,t.intent);if(!E())return;qt=!0,$e(c)}F=null,P&&De(P.quote),Jt(),b=t.selection,H=t.coupon,ge=!1,Te=!1,await qe()};if(n&&!Ce()&&a.prepareUpgradeReplacement)return r();let l=Date.now()+2e4;for(;E();){let c=await i.read();if(c.operationId!==t.operationId)throw new k("PURCHASE_PENDING","The original Checkout changed");if(!E())break;let s=R(c);if(s.type==="native"){await r();return}if(s.type==="complete"||s.type==="fulfillment"||s.type==="recording"){F=null,P?await Ae(P.quote,c):await Q(c,!1);return}if(e&&s.type==="checkout"){e=!1;try{await a.terminateCheckout(t.operationId)}catch(u){K(a.onError,u)}}if(Date.now()>=l){P&&s.type==="checkout"&&(F=null,await Ae(P.quote,c));break}await Ye(1e3,m,Z.signal)}!F||w||(P?(p.textContent=o?"仍在核对原升级单,暂时无法更换套餐。":"We’re still checking the original upgrade before changing plans.",y.hidden=!1):Xt())}async function Zt(e,n,t,r){if(h=()=>Zt(e,n,t,r),await a.beforeCheckoutReplacement?.(structuredClone(r)),!E())return;let l=i.operation;if(l?.operationId!==e||R(l).type!=="checkout"){h=null,l&&await Q(l,!1);return}F={operationId:e,selection:n,coupon:t,intent:r},P&&(p.textContent=o?"正在切换套餐…":"Changing plan…",y.hidden=!0);let c=!1,s=!1;try{let u=await a.terminateCheckout(e);s=(Array.isArray(u?.purchases)?u.purchases:[]).some(f=>f.operationId===e&&f.type==="native")}catch(u){if(u instanceof k&&["CAPABILITY_UNAVAILABLE","NOT_CONFIGURED"].includes(u.code)){F=null,P&&(h=It,y.textContent=o?"查询状态":"Check status",y.hidden=!1),p.textContent=o?"请继续原订单,或等待它过期后再更换方案。":"Continue your original checkout, or wait for it to expire before changing plans.",K(a.onError,u);return}c=u instanceof k&&(u.status??0)>=500,K(a.onError,u)}E()&&await nt(c,s)}function rt(e,n,t,r,l){let c=te(e).checkoutCoupons?.[n],s=c?c.products[t]:a.claimCoupon&&l?hn(e.capabilities,l,r):void 0;return s?.couponId&&s.planVersionId===t?{id:s.couponId,offerId:s.offerId}:void 0}function Hn(e){de||b||i.quote||i.operation||Je&&p.textContent===Je||(p.textContent=Object.values(e.capabilities.plans).some(n=>n.available)?"":o?"当前账号暂无可购买的方案。":"No plans are currently available for this account.")}let He=new Map,it=!1;function Ne(e,n,t,r,l,c){let s=L(e),u=!s&&e.lines.length===1?e.lines[0]:void 0,I=xe(r,l,n.capabilities);if(!I||I!==(s?e.productVersionId:u?.productVersionId))return!1;let f=rt(n,t,I,l,c),x;try{x=Ee(n.document.screen,I,l,n.capabilities)}catch{return!1}if(s){let X=e.merchantTerms?.discount??(e.execution.provider==="merchant"?e.execution.discount:void 0);return Object.keys(x).length===Object.keys(e.featureQuantities??{}).length&&Object.entries(x).every(([Ue,St])=>e.featureQuantities?.[Ue]===St)&&(!f||X?.couponId===f.id&&(!f.offerId||X.grantId===f.offerId))}if((f||te(n).checkoutCoupons?.[t])&&(f?.id??null)!==(e.discount?.couponId??null))return!1;let O=Object.fromEntries((u?.prepaid??[]).map(X=>[X.internal_feature_id,X.quantity]));return[...new Set([...Object.keys(x),...Object.keys(O)])].every(X=>(x[X]??0)===(O[X]??0))}let R=e=>yn({quote:i.quote,operation:e,requestId:null,pending:!1,destroyed:w,canReselect:i.canReselect});async function Qe(e){let n=e.merchantExecution,t=R(e),r=t.type==="checkout"?t.checkoutUrl:e.checkoutUrl;if(!(!E()||!r||ot(e)&&t.type!=="checkout"||a.checkoutNavigation==="after_confirmation"&&t.type!=="checkout"||n?.type==="purchase"&&!["not_started","pending"].includes(n.paymentStatus)||He.get(e.operationId)===r)){He.set(e.operationId,r);try{a.onCheckoutUrl?await a.onCheckoutUrl(r):m.defaultView?.location.assign(r)}catch(l){throw He.delete(e.operationId),l}}}let ve=(e,n=!1)=>{if(e instanceof Dt)h=null,p.textContent=e.customerMessage(o);else if(Tn(e))h=null,p.textContent=n?o?"当前无法在此购买,付款尚未开始。请联系商户。":"Purchases aren’t available here right now. Payment hasn’t started. Contact the merchant for help.":Mt(e,o);else if(n){let t=e instanceof k?e.code:void 0;t==="CAPABILITY_UNAVAILABLE"||t==="NOT_CONFIGURED"?(h=null,p.textContent=o?"暂时无法为此套餐报价,付款尚未开始。":"Pricing for this plan is unavailable. Payment hasn’t started."):i.canReselect===!0&&!b?p.textContent=o?"未能取得报价,付款尚未开始。请重新选择套餐。":"We couldn’t prepare your price. Payment hasn’t started. Choose a plan again.":t==="COMMAND_PENDING"?p.textContent=o?"仍在准备报价,请重试以查看结果。":"Your price is still being prepared. Retry to check the result.":p.textContent=o?"未能取得报价,付款尚未开始。请重试。":"We couldn’t prepare your price. Payment hasn’t started. Try again."}else p.textContent=e instanceof k&&(e.code==="NETWORK_ERROR"||e.code==="TIMEOUT")?Mt(e,o):e instanceof k?e.message:o?"操作未完成,请重试。":"This action couldn’t be completed. Try again.";y.hidden=h===null,Je=p.textContent,n&&se===void 0&&!$?.responsive&&p.scrollIntoView?.({block:"nearest"}),K(n&&A?.quoteError?A.quoteError:a.onError,e)},Be=new WeakMap;function je(e){de=e,y.disabled=e,ie.disabled=e,T?.updateCapabilities?.(te(d),he(d));for(let n of pe?.querySelectorAll("button")??[])e?(Be.has(n)||Be.set(n,n.disabled),n.disabled=!0):Be.has(n)&&(n.disabled=Be.get(n),Be.delete(n)),Lt(n)}function en(){V&&(p.textContent=V.message,y.textContent=o?"重试":"Retry",y.disabled=!1,y.hidden=!V.retry,ie.disabled=!0)}function kt(){p.textContent=o?"暂时无法操作,请稍后重试。":"This action is unavailable right now. Try again in a moment."}let tn=new WeakSet;async function Qn(e){if(a.beforeAction)try{await a.beforeAction({purchaseIntent:tn.has(e)})}catch(n){throw n instanceof Dt?(b=null,ge=!1,Te=!1,h=null):h=e,n}}async function W(e,n){if(de||w||V)return;if(!E()){kt();return}let t=e===qe,r=t?Ln:Un;se=n!==void 0&&T?.updateCheckoutControls?n:void 0,p.textContent=r,je(!0),Pe(),y.hidden=!0;try{if(e!==cn&&e!==It&&e!==xt&&e!==Xe&&(e!==tt||!a.resumeCheckout)&&await Qn(e),w||V)return;if(!E()){h=e,y.hidden=!1,kt();return}await e()}catch(l){w||ve(l,t)}finally{se=void 0,je(!1),Pe(),V?en():p.textContent===r&&(p.textContent="")}}async function nn(e){await Nn(le,e,a)}function De(e,n){P=n?{quote:e,phase:n}:void 0,n==="checking"?(se??=b?.actionId??Yt(d)[0],p.textContent=wt,h=It,y.textContent=o?"查询状态":"Check status",y.hidden=!0):se=void 0,T?.updateCapabilities(te(d),he(d)),Pe()}function rn(e){return e instanceof k&&(e.code==="COMMAND_PENDING"||e.reason==="RESULT_UNKNOWN"||e.code==="NETWORK_ERROR"||e.code==="TIMEOUT"||e.status===429||(e.status??0)>=500)}function an(e,n){_t(e,{...n,featureQuantities:n.featureQuantities??{}},"Purchase operation changed")}async function It(){P&&await Ae(P.quote)}async function Ae(e,n){De(e,"checking"),Je="";let t=1e3;Ve=!0,K(a.onObservationChange,!0);try{for(let r=n;E();r=void 0){if(!r){try{r=await i.read()}catch(l){if(!rn(l))throw l}if(!E())return}if(r){an(r,e);let l=R(r);if(l.type==="checkout"){De(e,"payment"),p.textContent=o?"请先完成原订单的付款。":"Finish paying for this upgrade.",y.hidden=!1;return}if(l.type==="complete"){De(e,"complete"),h=null;let c=d.capabilities.plans[e.productVersionId]?.name,s=e.merchantTerms?.subscriptionTerms?.items,u=s?.length===1?s[0].interval:void 0,I=u==="year"?o?"年付":"annual billing":u==="month"?o?"月付":"monthly billing":null;p.textContent=c?o?`已升级到 ${c}${I?" "+I:""}。`:`Upgraded to ${c}${I?" ("+I+")":""}.`:o?"已成功升级。":"Plan upgraded.",await nn(r);return}if(l.type==="native"&&!Se(r)){De(e),b=null,h=null,p.textContent=o?"付款没有成功,套餐未变更。请检查付款方式后重新选择套餐。":"Your payment didn’t go through, so your plan is unchanged. Check your payment method, then choose a plan again.",y.textContent=o?"重试":"Retry";return}if(r.problem&&!["RESULT_UNKNOWN","STATE_CHANGED"].includes(r.problem.reason??""))throw new k(r.problem.code,o?"暂时无法完成升级。":"The upgrade needs attention.",void 0,void 0,r.problem)}await Ye(t,m,Z.signal),t=Math.min(t*1.5,15e3)}}finally{Ve=!1,K(a.onObservationChange,!1)}}async function xt(){let e=P?.quote;if(!e)return;let n=await i.read();if(an(n,e),R(n).type!=="checkout")return Ae(e,n);if(a.resumeCheckout){await a.resumeCheckout(n.operationId);return}He.delete(n.operationId),await Qe(n)}function on(e){return Nt(i).type==="recording"||R(e).type==="recording"}function sn(e){let n=e.merchantTerms,t=n?.subscriptionTerms?.items??[],r=n?n.totalMinor:L(e)?e.totalMinor:e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),l=n?t.length===1&&t[0]?.amountMinor===r&&t[0]:!L(e)&&e.lines.length===1&&e.lines[0]?.catalogAmountMinor===r&&e.lines[0],c=r===null?Ie(n.subtotalMinor-n.discountMinor,e.currency)+(o?" + 待确认税费":" + tax confirmed at checkout"):Ie(r,e.currency)+(l?Le(l.interval,o?"zh-CN":"en",l.intervalCount??1):""),s=L(e)?i.view?.capabilities.plans[e.productVersionId]?.name??"":e.lines.map(u=>u.productName).join(", ");return{label:s?`${s} · ${c}`:c,recurring:l}}async function Q(e,n=a.checkoutNavigation!=="after_confirmation"){if(w)return;if(!E()){h=async()=>Q(await i.read()),y.hidden=!1;return}let t=e.quote??i.quote;if(gt(t)&&(e.confirmedAt||e.merchantExecution))return Ae(t,e);if(p.textContent=On(e.status,o),on(e)){let f=e.merchantExecution?.recordingStatus==="failed";p.textContent=f?o?"付款和商户处理已完成,但交易记录失败。请联系商户修复,勿重复购买。":"Payment and fulfillment succeeded, but recording failed. Contact the merchant to repair this purchase; do not buy again.":o?"付款和商户处理已完成,正在确认交易记录。请勿重复购买。":"Payment and merchant fulfillment are complete. Recording is pending confirmation; do not purchase again.",y.textContent=o?"查询记录":"Check recording",h=async()=>Q(await i.read()),y.hidden=!1;return}if(e.problem&&R(e).type!=="native"){let f=e.problem;h=_e,y.textContent=o?"检查并恢复原操作":"Check and recover original purchase",ve(new k(f.code,f.reason==="RESULT_UNKNOWN"?o?"付款结果尚未确定,请恢复原操作,暂勿重复购买。":"The payment result is unknown. Recover the original purchase before buying again.":f.phase==="fulfillment"?o?"付款已记录,商户权益处理需要核对。":"Payment was recorded. Access fulfillment needs attention.":f.code==="CAPABILITY_UNAVAILABLE"?o?"商户尚不支持本次购买所需的完整能力,请处理后恢复原操作。":"The merchant does not currently support all actions required by this purchase. Recover the original purchase after this is resolved.":f.code==="NOT_CONFIGURED"?o?"付款服务连接需要处理,请联系商户后恢复原操作。":"The payment connection needs attention. Contact the merchant, then recover the original purchase.":o?"原购买操作需要处理,请查询或恢复此操作。":"The original purchase needs attention. Check or recover this operation.",void 0,void 0,f));return}if((e.merchantExecution?.type==="purchase"&&e.merchantExecution.paymentStatus==="succeeded"||e.merchantExecution?.type==="subscription_change"&&e.merchantExecution.status==="applied")&&!["applied","not_applicable"].includes(e.merchantExecution.fulfillmentStatus)&&(p.textContent=o?"付款已记录,正在等待商户完成处理。":"Payment was recorded. Waiting for merchant fulfillment."),Ge(e)&&R(e).type==="complete"){h=null,await nn(e);return}let r=Ot(e);if((r||!Se(e))&&R(e).type!=="fulfillment"){if(i.canReselect===!1||r&&Se(e)&&i.canReselect!==!0){p.textContent=o?"正在核对原购买结果":"Checking the original purchase result",y.textContent=o?"查询结果":"Check result",h=async()=>Q(await i.read()),y.hidden=!1;return}r?p.textContent=o?"结账未启动,可以重新选择方案。":"Checkout didn’t start. Choose a plan to try again.":e.status==="cancelled"?p.textContent=o?"这笔购买已取消,可以重新选择方案。":"This purchase was cancelled. Choose a plan to start again.":e.status==="failed"&&(p.textContent=o?"这笔购买未能完成,可以重新选择方案。":"This purchase didn’t go through. Choose a plan to try again."),y.textContent=o?"重试":"Retry",h=null,b=null;return}if(!n&&R(e).type==="checkout"){if(F){Xt();return}if(we()){p.textContent="",it=!1,h=null,y.hidden=!0,T?.updateCapabilities?.(te(d),he(d)),Pe();return}let f=i.quote,x=f?.operationId===e.operationId?sn(f).label:"";p.textContent=it?x?o?`${x} 尚未付款。再次选择该方案即可继续付款。`:`${x} is still unpaid. Choose it again to continue paying.`:o?"之前的购买尚未付款。再次选择该方案即可继续付款。":"Your earlier purchase is still unpaid. Choose that plan again to continue paying.":"",it=!1,h=null;return}await Qe(e);let l=Date.now(),c=l+6e5,s=2e3,u=R(e).type!=="checkout",I=()=>u&&Date.now()-l<15e3;Ve=!0,K(a.onObservationChange,!0);try{for(;!w&&Date.now()<c;){if(await Ye(I()?700:s,m,Z.signal),w)return;if(!E()){h=async()=>Q(await i.read()),y.hidden=!1;return}let f=await i.read();if(R(f).type==="checkout"&&(u=!1),!n&&R(f).type==="checkout"){await Q(f,!1);return}if(!f.problem&&Se(f)&&await Qe(f),!Se(f)||Ot(f)||f.problem||on(f)){await Q(f);return}I()||(s=Math.min(s*1.5,3e4))}}finally{Ve=!1,K(a.onObservationChange,!1)}h=async()=>Q(await i.read()),y.hidden=!1}async function Et(e=!1){let n=await i.read();if(w)return;if(!E()){h=()=>Et(e),y.hidden=!1;return}let t=i.quote;if(t&&_t(n,{operationId:t.operationId,currency:t.currency},"The original purchase operation changed"),t&&(ot(n)?["prepared","quoted"].includes(n.status):n.status==="pending")&&(ot(n)||n.quoteFinalized===!1)&&!n.confirmedAt&&!n.checkoutUrl&&!("nativePurchase"in n&&n.nativePurchase)&&!n.merchantExecution&&!n.problem&&!i.pendingCancellation){if(a.purchaseConfirmation!=="paywall"){e?await _e():h=null;return}setTimeout(ln,0,t);return}await Q(n,e||void 0)}async function cn(){await Et()}async function Bn(e){p.textContent=wt;let n=Date.now()+12e3;for(;!w&&Date.now()<n&&(await Ye(1500,m,Z.signal),!(w||!E()));){let t;try{t=await i.read()}catch{break}if(t.problem?.reason!=="RESULT_UNKNOWN")return t}return e}async function _e(){if(i.quote&&!(Date.parse(i.quote.expiresAt)>Date.now()))throw new k("INVALID_REQUEST",o?"此报价已过期,请重新选择套餐。":"This quote has expired. Choose a plan again.");Jt();let e=i.quote;if(gt(e)){De(e,"checking");let t;try{t=await i.confirm()}catch(r){if(!rn(r))throw r;return Ae(e)}return Ae(e,t)}h=_e;let n=await i.confirm();if(!E()){h=_e,y.hidden=!1;return}if(n.problem?.reason==="RESULT_UNKNOWN"&&(n=await Bn(n)),n.problem){await Q(n);return}if(Se(n)){if(R(n).type==="checkout")await Qe(n);else if(n.execution&&n.execution.provider!=="merchant"||"nativePurchase"in n&&n.nativePurchase){if(!a.onPurchase)throw new k("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await a.onPurchase({operation:n,signal:Z.signal})}}h=async()=>Q(await i.read()),await Q(n,!0)}function ln(e){if(w)return;pe?.remove();let n=!(Date.parse(e.expiresAt)>Date.now());p.textContent=n?o?"此报价已过期。请先取消,再重新选择。":"This quote has expired. Cancel it, then choose again.":"";let t=m.createElement("div"),r=m.createElement("button"),l=m.createElement("button"),c=m.createElement("div"),s=m.createElement("p"),u=e.merchantTerms,I=o?"zh-CN":"en",f=u?.subscriptionTerms?.items??[],x=u?u.subscriptionTerms?.trial?.days:L(e)?void 0:e.lines.find(g=>g.trial)?.trial?.days,O=L(e)?u?u.totalMinor:e.totalMinor:x===void 0?null:u?u.totalMinor:e.charge?e.charge.totalMinor:e.lines.every(g=>g.trial)?0:null,ke=(g,v)=>o?`${v} 天试用结束后 ${g}`:`Then ${g} after the ${v}-day trial`,{label:X,recurring:Ue}=sn(e),St=L(e)?i.view?.capabilities.plans[e.productVersionId]?.name??"":e.lines.map(g=>g.productName).join(", "),pn=O===null?"":`${o?"今天应付":"Due today"} ${Ie(O,e.currency)}`;s.textContent=pn?[St,pn].filter(Boolean).join(" · "):X,r.textContent=L(e)?o?"确认变更":"Confirm change":o?"确认购买":"Confirm purchase",r.disabled=n,l.textContent=o?"取消":"Cancel",t.style.cssText=U.panel,s.style.cssText=U.summary,c.style.cssText=U.actions,r.style.cssText=U.primary,l.style.cssText=U.secondary,Lt(r),r.onclick=()=>{W(_e)};let fn=async()=>{let g=await i.cancel();w||(t.remove(),pe=null,await Q(g))};l.onclick=()=>{h=fn,W(fn)};let z=m.createElement("div");if(z.style.cssText=U.terms,L(e)){for(let[v,N]of Object.entries(e.featureQuantities??{})){let j=i.view?.capabilities.plans[e.productVersionId]?.prepaid?.find(jn=>jn.internalFeatureId===v),at=m.createElement("p");at.textContent=`${j?.name??v} · ${N} ${o?"份":"packs"}${j?` × ${j.terms.units}`:""}`,z.append(at)}for(let[v,N]of[[o?"原订阅抵扣":"Unused subscription credit",e.creditMinor],[o?"新套餐费用":"New plan charge",e.debitMinor],[o?"优惠减免":"Offer savings",u?.discountMinor??e.discountMinor],[o?"税费":"Tax",u?u.taxMinor:e.taxMinor]]){let j=m.createElement("p");j.textContent=`${v}: ${N===null?o?"结账时确认":"Confirmed at checkout":Ie(N,e.currency)}`,z.append(j)}let g=m.createElement("p");g.textContent=`${o?"生效时间":"Effective"}: ${e.effectiveAt}`,z.append(g)}if(u){for(let v of f){if(O===null&&v===Ue)continue;let N=m.createElement("p"),j=Ie(v.amountMinor,e.currency)+Le(v.interval,I,v.intervalCount);N.textContent=O!==null&&x!==void 0?ke(j,x):j,v.amountAfterOfferMinor!==void 0&&(N.textContent+=` · ${o?"优惠结束后":"After the offer"} ${Ie(v.amountAfterOfferMinor,e.currency)}${Le(v.interval,I,v.intervalCount)}`),z.append(N)}let g=u.subscriptionTerms?.trial;if(g){let v=m.createElement("p");v.textContent=o?`试用 ${g.days} 天;${g.cardRequired?"需要提供付款方式":"无需提供付款方式"}`:`Trial days: ${g.days}; ${g.cardRequired?"a payment method is required":"no payment method is required"}`,z.append(v)}for(let v of[...u.expectedEffects.map(N=>N.description),...u.requiredConsents.map(N=>N.summary)]){let N=m.createElement("p");N.textContent=v,z.append(N)}}else if(!L(e)){for(let g of e.lines){if(O!==null||g!==Ue){let v=m.createElement("p"),N=`${Ie(g.catalogAmountMinor,e.currency)}${Le(g.interval,I,g.intervalCount??1)}`;v.textContent=O!==null&&g.trial?(e.lines.length>1?`${g.productName} · `:"")+ke(N,g.trial.days):`${g.productName} · ${N}`,z.append(v)}for(let v of g.prepaid??[]){let N=m.createElement("p"),j=i.view?.capabilities.plans[g.productVersionId]?.prepaid?.find(at=>at.internalFeatureId===v.internal_feature_id);N.textContent=`${j?.name??v.internal_feature_id} · ${v.quantity} ${o?"份":"packs"} × ${v.terms.units}`,j&&(N.textContent+=Le(j.reset==="week"||j.reset==="month"||j.reset==="year"?j.reset:"one_time",I,j.resetCount)),z.append(N)}if(g.trial){let v=m.createElement("p");v.textContent=o?`试用 ${g.trial.days} 天;${g.trial.cardRequired?"需要提供付款方式":"无需提供付款方式"}`:`Trial days: ${g.trial.days}; ${g.trial.cardRequired?"a payment method is required":"no payment method is required"}`,z.append(v)}}if(!e.charge){let g=m.createElement("p");g.textContent=o?"目录价格;最终金额以结账时税费和试用规则为准。":"Catalog price; the final charge depends on checkout taxes and trial terms.",z.append(g)}}for(let g of z.children)g.style.margin="0";c.append(r,l),t.append(s,...z.childElementCount?[z]:[],c),Y.prepend(t),$?.responsive||t.scrollIntoView?.({block:"nearest"}),r.focus({preventScroll:!0}),pe=t,de&&je(!0),h=null}async function qe(){if(!b)return;if(a.onPurchaseIntent&&!ge&&!i.quote&&!i.operation){let t=b,r=i.view,l=r?.document.buttons[t.actionId],c=r&&l?.type==="checkout"?xe(l.product,t.selection,r.capabilities):null;if(!r||!c)throw new k("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");let s={actionId:t.actionId,productVersionId:c,selection:structuredClone(t.selection),featureQuantities:Ee(r.document.screen,c,t.selection,r.capabilities),...H&&{coupon:{id:H.id,...H.offerId&&{offerId:H.offerId}}}};b=null,H=void 0,h=null,Ke=!0,await a.onPurchaseIntent(s);return}if(h=qe,!ge){let t=i.view,r=t?.document.buttons[b.actionId],l=t&&r?.type==="checkout"?xe(r.product,b.selection,t.capabilities):null;if(!t||!l)throw new k("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");if(!Te){let s=Wt(),u=s?await s.result:void 0;if(w)return;let I=a.resolveSubscriptionChange;if(I||u){let f={actionId:b.actionId,productVersionId:l,featureQuantities:Ee(t.document.screen,l,b.selection,t.capabilities)},x=u?[async()=>u(f)]:[],O=I?await I(f,...x):await x[0]?.();if(w)return;O!==void 0&&(b.subscriptionChange=mn.parse(O))}Te=!0}let c=H?.offerId;if(H&&!c){if(!a.claimCoupon)throw new k("CAPABILITY_UNAVAILABLE","Coupon claiming is unavailable");let{offer:s}=await a.claimCoupon(H.id,b.requestId);if(w)return;if(!s||s.couponId!==H.id||s.status!=="issued"||!(Date.parse(s.expiresAt)>Date.now()))throw b=null,H=void 0,h=async()=>{$e(await i.refresh()),h=null},new k("COUPON_UNAVAILABLE","This Coupon is no longer available for this purchase");c=s.id}if(!H&&!t.document.screen.actions.some(s=>s.id===b?.actionId&&typeof s.properties.couponBinding=="string")&&(c=await a.resolveOfferId?.({actionId:b.actionId,productVersionId:l,featureQuantities:Ee(t.document.screen,l,b.selection,t.capabilities)})),w)return;c!==void 0&&(b.offerId=c),ge=!0}if(!E()){y.hidden=!1;return}let e;try{e=await i.preview(b)}catch(t){throw i.canReselect===!0&&(b=null,ge=!1,Te=!1,H=void 0,h=null),t}if(b.acceptHostedMonthly!==void 0){let t=i.operation;if(!t||t.operationId!==e.operationId||!t.confirmedAt)throw new k("INVALID_RESPONSE","The confirmed Checkout is missing");w||await Q(t,!0);return}if(H&&(L(e)?(()=>{let t=e.merchantTerms?.discount??(e.execution.provider==="merchant"?e.execution.discount:void 0);return t?.couponId!==H.id||t.grantId!==b.offerId})():e.discount?.couponId!==H.id||e.discount.offerId!==b.offerId))throw new k("INVALID_RESPONSE","The quote did not apply the Coupon selected on this Paywall");if(w)return;let n=e.merchantTerms;if(a.purchaseConfirmation!=="paywall"||a.confirmOnHostedCheckout&&E()&&!L(e)&&e.provider==="merchant"&&e.billingSubscriptionId===null&&n?.request.action==="purchase"&&n.request.mode==="subscription"&&n.subscriptionTerms?.trial===null&&n.requiredConsents.length===0&&Date.parse(e.expiresAt)>Date.now()){if(!E()){y.hidden=!1;return}if(!(Date.parse(e.expiresAt)>Date.now()))throw new k("INVALID_REQUEST",o?"此报价已过期,请重新选择套餐。":"This quote has expired. Choose a plan again.");let t=se?"":o?"正在打开收银台…":"Opening checkout…";p.textContent=t;try{await _e()}catch(r){w||ve(r)}finally{p.textContent===t&&(p.textContent="")}return}ln(e)}function Re(e="destroy",n=!1){if(w)return;w=!0;let t=ht;ht=void 0,K(t),a.signal?.removeEventListener("abort",ce),i.signal?.removeEventListener("abort",ce),B.finish("dismissed"),$t?.(),vt(),m.removeEventListener("visibilitychange",Gt),Z.abort(),Vt?.disconnect(),T?.destroy(),i.destroy(),S.removeEventListener("cancel",dn),_.remove(),M.remove(),n||un(),e==="dismiss"&&K(a.onDismiss)}function un(){if($?.destroy(),ue){ue.release();return}S.open&&S.close(),S.remove(),D()}G=Re;async function Fe(){if(!me||w||ze||oe==="closing"||!oe&&!E())return;if(!A){Re("dismiss");return}let e=m.createElement("p");e.setAttribute("role","status"),e.textContent=o?"正在关闭…":"Closing…",ye||(ye=m.createElement("div"),ye.style.cssText=Y.style.cssText,Y.replaceWith(ye),fe.inert=!0),_.hidden=!1,ye.replaceChildren(e,_),oe="closing",_.setAttribute("aria-disabled","true"),_.focus({preventScroll:!0});try{await A.dismiss()}catch(n){w||K(a.onError,n)}w||(oe="retry",e.textContent=o?"未能确认关闭,请重试。":"Could not confirm closure. Try again.",_.textContent=o?"重试关闭":"Retry closing",_.removeAttribute("aria-label"),_.removeAttribute("aria-disabled"))}_.onclick=()=>{Fe()};function dn(e){e.preventDefault(),Fe()}S.addEventListener("cancel",dn),ie.onclick=()=>{W(P?xt:tt)},y.onclick=()=>{if(V){V.retry?.();return}h&&W(h)};function At(e){B.finish("error",e),Re()}function Rt(){if(!(!Bt||me||w||ze||$&&!E()))try{let e=n=>{a.focusAtReveal&&(D=Ut(m)),a.settleMotionAtReveal?T?.setHidden?.(!1,!0):T?.setHidden?.(!1),mt?.(),$&&(S.open||S.showModal(),$.responsive&&S.focus({preventScroll:!0}),!n&&a.loading!=="host"&&vn(S,$.type,$.responsive)),n&&a.loading!=="host"&&typeof fe.animate=="function"&&!m.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches&&fe.animate([{opacity:.55},{opacity:1}],{duration:160,easing:"ease-out"}),me=!0,Ze()};A?A.present(n=>B.present(t=>e(n??t))):B.present(e)}catch(e){At(e),ve(e)}}try{if(Me.type==="inline"?(dt(),mt=Rn(M,q),q.append(M)):(S.setAttribute("aria-label",d.document.name),_.textContent="×",_.setAttribute("aria-label",o?"关闭":"Close"),kn(_,d.document.screen.theme),_.hidden=bn(d.document),(typeof INDIANA_NATIVE_SHELL_BUILD>"u"||!INDIANA_NATIVE_SHELL_BUILD)&&ue?.content?ue.content.append(_,M):S.replaceChildren(_,M),ue||q.append(S),$=Pn(S,{...d.document.screen,presentation:Me},ft),$.latch(),$.responsive&&(M.style.display="flex",M.style.flexDirection="column",M.style.maxHeight="100%",fe.style.overflow="clip",fe.style.minHeight="0"),ue||(mt=An(S))),lt&&ee){let t=lt(ee);if(typeof t=="function"&&(w?K(t):ht=t),w)throw new DOMException("Presentation cancelled","AbortError");dt()}T=re(fe,{mode:"live",rendererUrl:"bundled",title:d.document.name,closeActions:Mn,onAuthoredClose(t){oe||w||(_.hidden=t)},hostPresentation:()=>$?.type??Me.type,reportContentHeight:$?.responsive,onResize:t=>{if(!$?.responsive)return;let r=Math.min(t,pt);fe.style.height=`${r}px`,$.setContentHeight(r+Qt())},onSelection(t){for(let[r,l]of Object.entries(t))typeof l=="number"&&typeof J[r]=="number"&&J[r]!==l&&jt.add(r);J=t,Pe(),Ze()},onAction(t,r={},l,c){if(!me||w||oe)return;let s=i.view,u=s?.document.buttons[t];if(!u)return;if(V){u.type==="close"&&Fe();return}if(u.type==="close"&&A&&a.resumeCheckout&&i.operation&&gn(R(i.operation))){Fe();return}if(de)return;if(!E()){kt();return}if(u.type==="close"){W(async()=>{A?.closeAction?await A.closeAction(t):await a.onAction?.(t),Re(a.onAction?"action":"dismiss")});return}if(u.type==="action"){h=async()=>{if(u.action.type==="event"){if(!a.onEvent)throw new k("EVENT_HANDLER_REQUIRED","Provide the event handler");await a.onEvent(u.action.event)}else a.onOpenUrl?await a.onOpenUrl(u.action.url):m.defaultView?.location.assign(u.action.url);await a.onAction?.(t),h=null},W(h);return}if(we()&&F){!be&&F.selection.actionId===t&&W(()=>nt(!0),t);return}if(P){if(P.phase==="payment"&&s&&Ne(P.quote,s,t,u.product,r,c)){W(xt,t);return}if(!Ct())return}if(!Ce()&&!Ct()){we()&&s&&i.quote&&i.operation&&R(i.operation).type==="checkout"&&Ne(i.quote,s,t,u.product,r,c)?W(tt,t):p.textContent=o?"当前只能继续原订单。":"Only your original checkout is available.";return}if(pe&&i.canReselect===!1){p.textContent=o?"请先确认或取消当前购买。":"Confirm or cancel the current purchase first.",$?.responsive||pe.scrollIntoView?.({block:"nearest"}),pe.querySelector("button")?.focus({preventScroll:!0});return}if(we()&&a.terminateCheckout&&s&&i.quote&&i.operation&&i.canReselect===!1&&R(i.operation).type==="checkout"){if(Ne(i.quote,s,t,u.product,r,c)){W(tt,t);return}let f=xe(u.product,r,s.capabilities),x;try{if(!f)throw new k("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");x=Ee(s.document.screen,f,r,s.capabilities)}catch(Ue){ve(Ue);return}let O=i.operation.operationId,ke={actionId:t,requestId:crypto.randomUUID(),selection:structuredClone(r)},X=rt(s,t,f,r,c);W(()=>Zt(O,ke,X,{actionId:t,productVersionId:f,selection:ke.selection,featureQuantities:x}),t);return}if((i.quote||b)&&i.canReselect===!1){let f=!!s&&!!i.quote&&Ne(i.quote,s,t,u.product,r,c);it=!!i.quote&&!f,h=i.quote?()=>Et(f):qe,W(h,t);return}let I=s&&xe(u.product,r,s.capabilities);if(!s||!I){ve(new k("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(a.onPurchaseIntent){h=null;let f=async()=>{let x={actionId:t,productVersionId:I,selection:structuredClone(r),featureQuantities:Ee(s.document.screen,I,r,s.capabilities)},O=rt(s,t,I,r,c);O&&(x.coupon={id:O.id,...O.offerId&&{offerId:O.offerId}}),Ke=!0,await a.onPurchaseIntent(x)};tn.add(f),W(f,t);return}if(b&&b.actionId!==t){ve(new k("COMMAND_PENDING","Finish the current purchase"));return}if(!b){H=rt(s,t,I,r,c),b={requestId:crypto.randomUUID(),actionId:t,selection:structuredClone(r)};let f=s.document.screen.actions.find(ke=>ke.id===t)?.properties,x=f?.hostedMonthlyPriceMinor,O=f?.hostedMonthlyAutomaticTax;a.purchaseConfirmation==="purchase_button"&&a.confirmOnHostedCheckout&&i.supportsHostedCheckout===!0&&!H&&u.product.type==="fixed"&&typeof O=="boolean"&&typeof x=="number"&&Number.isSafeInteger(x)&&x>0&&x<=1e8&&Object.keys(Ee(s.document.screen,I,r,s.capabilities)).length===0&&(b.acceptHostedMonthly={amountMinor:x,automaticTax:O}),ge=b.acceptHostedMonthly!==void 0,Te=ge}W(qe,t)},onEscape:()=>{Fe()},onError:t=>{let r=new Error(t);!me&&!w&&At(r),ve(r)},onRendered:t=>{t&&S.setAttribute("aria-label",t),Bt=!0,Rt()}}),T.setHidden?.(!0),ft();let e=we()&&!!i.quote&&!!i.operation&&R(i.operation).type==="checkout";J=i.quote?_n(d,i.quote)??st(d,{}):st(d,{}),T.update(d.document.screen,ut,{capabilities:te(d),unavailableActions:he(d),serverInput:{bindings:[],answers:{}},...Object.keys(J).length?{selection:J}:{}}),$t=i.subscribe?.($e),$e(i.view??d),await B.wait(T.ready);let n=i.operation;(!e||gt(i.quote))&&(i.quote||n&&(n.confirmedAt||n.checkoutUrl||Ge(n)))&&(h=cn,W(h))}catch(e){throw At(e),e}return{check:le,host:{get currentResolution(){return d},setPurchaseRecovery(e,n){V={message:e,retry:n},T?.updateCapabilities?.(te(d),he(d)),Pe(),en()},clearPurchaseRecovery(){if(!V)return;let e=V.message;V=void 0,p.textContent===e&&(p.textContent=""),y.hidden=h===null,ie.disabled=de,T?.updateCapabilities?.(te(d),he(d)),Pe()},get subscriptionUpgradeActive(){return P!==void 0},get observing(){return Ve},get recovery(){return Vn()},async prepareFallback(){if(de||w||oe||Ke)return{type:"recover",operationId:i.operation?.operationId??i.quote?.operationId??null,requestId:null};je(!0);try{let e=await wn(i);return e.type==="native"&&Re(),e}finally{je(!1)}},setSuspended(e){ze=e,M.hidden=e,e&&S.open?S.close():!e&&!me?Rt():!e&&!w&&me&&Me.type!=="inline"&&!S.open&&S.showModal()},destroy:Re,retainPurchaseDialog(){if(!(w||!S.open||!S.isConnected))return Re("destroy",!0),{dialog:S,content:ue?.content,release:un}},refresh:async()=>{if(!E()){if(i.view)return i.view;throw new k("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await i.refresh();return $e(e),Rt(),e}}}}export{kr as a};
|
|
1
|
+
import{a as xn,c as Sn,d as Lt,f as Mt,g as Tn,k as On}from"./chunk-RXHGIDNM.js";import{a as Cn,b as Ye}from"./chunk-W32FI2A2.js";import{e as Pn,f as vn,g as kn,h as In,j as Ut,k as ct,l as En,m as An,n as Rn}from"./chunk-OJ6CPUN4.js";import{a as Ot,b as yn,d as Nt,e as gn,f as wn}from"./chunk-Q7TQHM5N.js";import{a as st,b as te,d as Dt,f as _t,j as bn}from"./chunk-JZYZHMCT.js";import{b as xe}from"./chunk-3I6OZU2J.js";import{B as L,C as ot,D as Ge,E as Se,y as mn}from"./chunk-OILQZX5V.js";import{r as Le,t as Ee}from"./chunk-2XX7L5VK.js";import{i as hn}from"./chunk-HN46A5SD.js";import{c as Ie,j as We}from"./chunk-VCRDA5R3.js";import{c as Tt}from"./chunk-QNJPFX5F.js";import{a as k}from"./chunk-355B3KPL.js";import{a as K}from"./chunk-DSPLGTQI.js";async function Nn(q,a,A){if(!Ge(a))throw new k("INVALID_RESPONSE","A verified completed purchase is required");let D=q?We.parse(q):null;if(await A.onComplete?.(a),!D||!A.check)return;let G=We.parse(await A.check());if(G.internal_feature_id!==D.internal_feature_id||G.quantity!==D.quantity||D.observation!==void 0&&(G.observation===void 0||G.observation.requirementDigest!==D.observation.requirementDigest||G.observation.authority!==D.observation.authority||Tt(G.observation.subject)!==Tt(D.observation.subject)))throw new k("INVALID_RESPONSE","The access requirement changed");G.allowed&&await A.onAccessGranted?.(G)}function Dn(q){return Object.entries(q.document.buttons).filter(([,a])=>a.type==="checkout"&&a.product.type==="fixed"&&!xe(a.product,{},q.capabilities)).map(([a])=>a)}function _n(q,a){let A=L(a)?void 0:a.lines[0];if(!L(a)&&(a.lines.length!==1||!A))return;let D=L(a)?a.productVersionId:A.productVersionId,{screen:G,buttons:ce}=q.document,B=new Map(L(a)?Object.entries(a.featureQuantities??{}):(A?.prepaid??[]).map(C=>[C.internal_feature_id,C.quantity]));function le(C,d){if(C.hidden)return!1;if(C.type==="plan_picker"&&q.capabilities.pickers[C.id]?.options.includes(D))return d[C.id]=D,!0;if(C.type==="quantity_picker"){let re=B.get(C.internalFeatureId);return re!==void 0&&(!C.bind?.plan||C.bind.plan===D)&&(d[C.id]=re),!1}if(C.type==="button"&&C.action){let re=ce[C.action];return re?.type==="checkout"&&re.product.type==="fixed"&&re.product.productVersionId===D}if(C.type!=="stack")return!1;let ne=C.interaction,i=C.bind?.plan===D;for(let[re,m]of C.children.entries()){let Z={},M=le(m,Z);if(ne?.type==="toggle"||ne?.type==="tabs"){if(!M)continue;return d[C.id]=ne.type==="toggle"?re===0:m.id,Object.assign(d,Z),!0}Object.assign(d,Z),M&&(i=!0,ne?.type==="select"&&ne.purpose==="product"&&ne.pickerId&&m.type==="stack"&&m.bind?.plan===D&&(d[C.id]=m.id,d[ne.pickerId]=D))}return i}for(let C of G.pages){let d={__page:C.id};if(le(C.root,d))return d}}var qn="position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0";async function kr(q,a,A){let D=a.focusAtReveal?()=>{}:Ut(q.ownerDocument),G=()=>{B.finish("dismissed"),D()},ce=()=>G(),B=En(q,a,"paywall",()=>{G(),K(a.onDismiss)},xn);a.signal?.throwIfAborted(),a.signal?.addEventListener("abort",ce,{once:!0});let le=null,C,d,ne;try{if(B.start(!0,a.loadingDocument?.screen.strings.defaultLocale,a.loadingDocument??null),B.cancelled)throw new DOMException("Presentation cancelled","AbortError");if(le=a.check?We.parse(await B.wait(a.check(),ct)):null,le?.allowed)return B.finish("skipped"),a.signal?.removeEventListener("abort",ce),D(),await a.onAccessGranted?.(le),{check:le,host:null};let[e,n]=await Promise.allSettled([B.wait(import("./screen-renderer-4VYPU7X6.js")),B.wait(a.start().then(r=>(B.cancelled&&r.destroy(),r)),ct)]);if(e.status==="rejected")throw n.status==="fulfilled"&&n.value.destroy(),e.reason;if(n.status==="rejected")throw n.reason;ne=e.value,C=n.value,a.signal?.throwIfAborted(),C.signal?.throwIfAborted(),C.signal?.addEventListener("abort",ce,{once:!0});let t=C.view??await B.wait(C.refresh(),ct);if(!t)throw new k("INVALID_RESPONSE","Paywall presentation is missing");C.signal?.throwIfAborted(),d=t}catch(e){throw B.finish("error",e),A?.retainedDialog?.release(),a.signal?.removeEventListener("abort",ce),C?.signal?.removeEventListener("abort",ce),C?.destroy(),D(),e}let i=C,{mountScreenPreview:re}=ne,m=q.ownerDocument,Z=new AbortController,M=m.createElement("section"),fe=m.createElement("div"),Y=m.createElement("div"),lt=a.mountControls,ee=lt?m.createElement("div"):void 0,p=m.createElement("p"),y=m.createElement("button"),ie=m.createElement("button"),_=m.createElement("button");(typeof INDIANA_NATIVE_SHELL_BUILD>"u"||!INDIANA_NATIVE_SHELL_BUILD)&&A?.hostPaywallTarget&&!A.retainedDialog&&d.document.presentation.type==="modal"&&(A.retainedDialog=In(A.hostPaywallTarget));let ue=A?.retainedDialog,S=ue?.dialog??m.createElement("dialog"),Me=ue&&d.document.presentation.type==="inline"?{type:"modal",size:"md"}:d.document.presentation,ae=Me.type==="inline"?Y:m.createElement("div"),ut=i.locale||d.document.screen.strings.defaultLocale,o=ut.toLowerCase().startsWith("zh"),Un=o?"正在处理…":"Processing…",Ln=o?"正在准备报价…":"Preparing your price…",U=Sn(d.document.screen.theme);M.dataset.indianaPaywall="",M.setAttribute("aria-label",d.document.name),M.style.cssText=U.root,Y.style.cssText=U.controls,p.style.cssText=U.message,p.setAttribute("role","status"),_.style.cssText=U.link,_.textContent=o?"关闭":"Close",y.style.cssText=U.secondary,y.textContent=o?"重试":"Retry",y.hidden=!0,ie.type="button",ie.style.cssText=U.primary,ie.textContent=o?"继续付款":"Continue payment",ie.hidden=!0,ae.append(p,ie,y),Y.append(_),ee&&(ee.style.cssText="flex:1 0 100%;min-width:0",ee.hidden=!0,Y.prepend(ee)),ae!==Y&&(ae.dataset.indianaPaywallStatus="",ae.style.cssText="display:none;padding:0",M.append(ae)),M.append(fe,Y);let dt=()=>{let e=$n();p.style.cssText=e?`${U.message};${qn}`:U.message,Kt();let n=c=>!c.hidden&&(c!==p||!!p.textContent&&!e);if(ae!==Y&&(ae.style.cssText=!oe&&[...ae.children].some(n)?`${U.controls};padding:12px 64px 12px 20px;flex-shrink:0`:e?"padding:0":"display:none;padding:0"),ee){let c=!ee.childElementCount&&!ee.textContent?.trim();ee.hidden!==c&&(ee.hidden=c)}let t=ye??Y,r=![...t.children].some(n),l=[...t.children].some(c=>c!==_&&n(c));t.style.cssText=r?U.controls.replace(/padding:[^;]+/,"padding:0"):l?`${U.controls};${U.pinned}`:U.controls,ft()},Vt=typeof MutationObserver>"u"?void 0:new MutationObserver(dt);Vt?.observe(M,{attributes:!0,attributeFilter:["hidden"],characterData:!0,childList:!0,subtree:!0});let Mn=Object.entries(d.document.buttons).filter(([,e])=>e.type==="close").map(([e])=>e),T,$t,Ve=!1,Ht=JSON.stringify(d.capabilities),V;function he(e){let n=Dn(e);if(V||de&&!se||F&&(P||!Ce()||be))return Oe(e).map(({actionId:r})=>r);if(Ct()||!P&&Ce())return n;let t=P?bt(e):Pt(e);return[...new Set([...n,...Oe(e).map(({actionId:r})=>r).filter(r=>!t.includes(r))])]}function $e(e){if(w)return;let n=d.id!==e.id;d=e;let t=JSON.stringify(e.capabilities);if(n||t!==Ht){let r=!b&&!i.quote&&!i.operation?st(e,J,jt):J;n||JSON.stringify(r)!==JSON.stringify(J)?(J=r,T?.update(e.document.screen,ut,{capabilities:te(e),unavailableActions:he(e),serverInput:{bindings:[],answers:{}},selection:J})):T?.updateCapabilities(te(e),he(e)),Ht=t}Hn(e),Pe(),Ze()}let $,pt=0;function Qt(){return(ye??Y).getBoundingClientRect().height+(ae===Y?0:ae.getBoundingClientRect().height)}function ft(){let e=m.defaultView;if(!$?.responsive||!e)return;let n=ye??Y,t=e.innerHeight-($.type==="modal"?32:0);n.style.maxHeight=`${Math.max(1,t)}px`,n.style.overflowY="auto",n.style.flexShrink="0",pt=Math.max(1,t-Qt()),T?.resizeViewport?.(pt,e.innerWidth)}let w=!1,de=!1,b=null,ht,ze=!1,Bt=!1,me=!1,mt,Ke=!1,oe,ye;function Vn(){return de||w||oe||Ke?{type:"recover",operationId:i.operation?.operationId??i.quote?.operationId??null,requestId:null}:Nt(i)}let E=()=>!w&&!ze&&!oe&&a.canInteract?.()!==!1,H,ge=!1,Te=!1,yt,h=null,pe=null,Je="",we=()=>a.checkoutNavigation==="after_confirmation"&&!!(a.terminateCheckout||a.resumeCheckout),J={},jt=new Set,se,P;function gt(e){return!!e&&L(e)&&e.timing==="immediate"&&e.execution.provider==="merchant"}let wt=o?"正在确认付款…":"Confirming payment…",F=null,be,Xe,qt=!1,Ce=()=>a.allowNewPurchase!==!1||qt;function Ft(){return JSON.stringify([d.id,d.capabilities])}function Wt(){let e=yt;return e&&e.read===a.prepareSubscriptionChange&&e.basis===Ft()?e:void 0}function Ze(){let e=a.prepareSubscriptionChange;if(!e||!me||!E()||!Ce()||a.onPurchaseIntent||m.visibilityState==="hidden"||b||i.quote||i.operation||!Oe(d).length||Wt())return;let n=Z.signal,t=new Promise(r=>{let l=()=>r(void 0);n.addEventListener("abort",l,{once:!0}),Promise.resolve().then(()=>(n.throwIfAborted(),e(n))).then(c=>r(n.aborted?void 0:c),l).finally(()=>n.removeEventListener("abort",l))});yt={read:e,basis:Ft(),result:t}}let Gt=()=>{m.visibilityState==="hidden"?yt=void 0:Ze()};m.addEventListener("visibilitychange",Gt);function Oe(e){return Object.entries(e.document.buttons).flatMap(([n,t])=>t.type==="checkout"?[{actionId:n,policy:t}]:[])}function Yt(e){let n=P?.quote;return n?Oe(e).filter(({actionId:t,policy:r})=>Ne(n,e,t,r.product,J)).map(({actionId:t})=>t):[]}function bt(e){return P?.phase==="payment"?Yt(e):[]}function Ct(){return(P?P.phase==="payment":!Ce())&&(Ce()||!!a.prepareUpgradeReplacement)&&we()&&!!a.terminateCheckout&&!!i.quote&&i.canReselect===!1&&!!i.operation&&R(i.operation).type==="checkout"}function Pt(e){let n=i.quote;return!we()||F||!n||!i.operation||R(i.operation).type!=="checkout"?[]:Oe(e).filter(({actionId:t,policy:r})=>Ne(n,e,t,r.product,J)).map(({actionId:t})=>t)}function Pe(){let e=V?[]:P?bt(d):Pt(d),n=a.allowNewPurchase===!1&&!!i.operation&&R(i.operation).type==="checkout";ie.hidden=!!V||(P?P.phase!=="payment":!n)||e.length>0,Kt(e)}function zt(){if(!(se===void 0||V))return p.textContent?p.textContent:P?.phase==="checking"?wt:void 0}function $n(){return!!T?.updateCheckoutControls&&!!p.textContent&&zt()!==void 0}let et;function Kt(e=V?[]:P?bt(d):Pt(d)){if(!T?.updateCheckoutControls)return;let n=zt(),t=we()||!!P;if(!n&&!t&&et?.on!==T)return;let r={actions:Oe(d).map(({actionId:c})=>c),resume:n?[se]:t?e:[],resumeLabel:n??(o?"继续付款":P?"Continue payment":"Continue checkout"),busy:se},l=JSON.stringify(r);et?.on===T&&et.key===l||(et={on:T,key:l},T.updateCheckoutControls(r))}function Jt(){pe?.remove(),pe=null}async function tt(){if(F)return;if(a.resumeCheckout&&i.operation){let n=i.operation.operationId;try{await a.resumeCheckout(n)}catch(t){if(!(t instanceof k&&t.code==="PURCHASE_PENDING"))throw t;let r=await i.read();if(!E())return;if(r.operationId!==n||R(r).type==="checkout")throw t;await Q(r,!1)}return}let e=await i.read();if(R(e).type!=="checkout")return Q(e,!1);E()&&(He.delete(e.operationId),await Qe(e))}function vt(){be?.destroy(),be=void 0,Xe=void 0}function Xt(){let e=F;if(!e||be)return;let n=o?"仍在核对原订单,暂时无法更换套餐。":"We’re still checking the original purchase before changing plans.",t=Date.now()+6e5,r=Cn({document:m,delay:()=>Date.now()<t?5e3:void 0,async run(){if(!E())return;let l=await i.read();if(be!==r||!E())return;if(l.operationId!==e.operationId)throw new k("PURCHASE_PENDING","The original Checkout changed");let c=R(l);c.type==="native"?(vt(),p.textContent=o?"原订单已关闭。你可以继续更换套餐。":"The original checkout is closed. You can continue changing plans.",y.textContent=o?"继续更换套餐":"Continue changing plans",h=()=>nt(),y.hidden=!1):(c.type==="complete"||c.type==="fulfillment"||c.type==="recording")&&(vt(),F=null,y.hidden=!0,await Q(l,!1))}});be=r,Xe=async()=>{try{await r.refresh()}finally{be===r&&(p.textContent=n,y.hidden=!1)}},h=Xe,y.textContent=o?"查询结果":"Check result",y.hidden=!1,p.textContent=n,r.schedule()}async function nt(e=!1,n=!1){let t=F;if(!t)return;h=()=>nt(),P&&(y.textContent=o?"查询状态":"Check status"),y.hidden=!0;let r=async()=>{if(!Ce()&&a.prepareUpgradeReplacement){let c=await a.prepareUpgradeReplacement(t.operationId,t.intent);if(!E())return;qt=!0,$e(c)}F=null,P&&De(P.quote),Jt(),b=t.selection,H=t.coupon,ge=!1,Te=!1,await qe()};if(n&&!Ce()&&a.prepareUpgradeReplacement)return r();let l=Date.now()+2e4;for(;E();){let c=await i.read();if(c.operationId!==t.operationId)throw new k("PURCHASE_PENDING","The original Checkout changed");if(!E())break;let s=R(c);if(s.type==="native"){await r();return}if(s.type==="complete"||s.type==="fulfillment"||s.type==="recording"){F=null,P?await Ae(P.quote,c):await Q(c,!1);return}if(e&&s.type==="checkout"){e=!1;try{await a.terminateCheckout(t.operationId)}catch(u){K(a.onError,u)}}if(Date.now()>=l){P&&s.type==="checkout"&&(F=null,await Ae(P.quote,c));break}await Ye(1e3,m,Z.signal)}!F||w||(P?(p.textContent=o?"仍在核对原升级单,暂时无法更换套餐。":"We’re still checking the original upgrade before changing plans.",y.hidden=!1):Xt())}async function Zt(e,n,t,r){if(h=()=>Zt(e,n,t,r),await a.beforeCheckoutReplacement?.(structuredClone(r)),!E())return;let l=i.operation;if(l?.operationId!==e||R(l).type!=="checkout"){h=null,l&&await Q(l,!1);return}F={operationId:e,selection:n,coupon:t,intent:r},P&&(p.textContent=o?"正在切换套餐…":"Changing plan…",y.hidden=!0);let c=!1,s=!1;try{let u=await a.terminateCheckout(e);s=(Array.isArray(u?.purchases)?u.purchases:[]).some(f=>f.operationId===e&&f.type==="native")}catch(u){if(u instanceof k&&["CAPABILITY_UNAVAILABLE","NOT_CONFIGURED"].includes(u.code)){F=null,P&&(h=It,y.textContent=o?"查询状态":"Check status",y.hidden=!1),p.textContent=o?"请继续原订单,或等待它过期后再更换方案。":"Continue your original checkout, or wait for it to expire before changing plans.",K(a.onError,u);return}c=u instanceof k&&(u.status??0)>=500,K(a.onError,u)}E()&&await nt(c,s)}function rt(e,n,t,r,l){let c=te(e).checkoutCoupons?.[n],s=c?c.products[t]:a.claimCoupon&&l?hn(e.capabilities,l,r):void 0;return s?.couponId&&s.planVersionId===t?{id:s.couponId,offerId:s.offerId}:void 0}function Hn(e){de||b||i.quote||i.operation||Je&&p.textContent===Je||(p.textContent=Object.values(e.capabilities.plans).some(n=>n.available)?"":o?"当前账号暂无可购买的方案。":"No plans are currently available for this account.")}let He=new Map,it=!1;function Ne(e,n,t,r,l,c){let s=L(e),u=!s&&e.lines.length===1?e.lines[0]:void 0,I=xe(r,l,n.capabilities);if(!I||I!==(s?e.productVersionId:u?.productVersionId))return!1;let f=rt(n,t,I,l,c),x;try{x=Ee(n.document.screen,I,l,n.capabilities)}catch{return!1}if(s){let X=e.merchantTerms?.discount??(e.execution.provider==="merchant"?e.execution.discount:void 0);return Object.keys(x).length===Object.keys(e.featureQuantities??{}).length&&Object.entries(x).every(([Ue,St])=>e.featureQuantities?.[Ue]===St)&&(!f||X?.couponId===f.id&&(!f.offerId||X.grantId===f.offerId))}if((f||te(n).checkoutCoupons?.[t])&&(f?.id??null)!==(e.discount?.couponId??null))return!1;let O=Object.fromEntries((u?.prepaid??[]).map(X=>[X.internal_feature_id,X.quantity]));return[...new Set([...Object.keys(x),...Object.keys(O)])].every(X=>(x[X]??0)===(O[X]??0))}let R=e=>yn({quote:i.quote,operation:e,requestId:null,pending:!1,destroyed:w,canReselect:i.canReselect});async function Qe(e){let n=e.merchantExecution,t=R(e),r=t.type==="checkout"?t.checkoutUrl:e.checkoutUrl;if(!(!E()||!r||ot(e)&&t.type!=="checkout"||a.checkoutNavigation==="after_confirmation"&&t.type!=="checkout"||n?.type==="purchase"&&!["not_started","pending"].includes(n.paymentStatus)||He.get(e.operationId)===r)){He.set(e.operationId,r);try{a.onCheckoutUrl?await a.onCheckoutUrl(r):m.defaultView?.location.assign(r)}catch(l){throw He.delete(e.operationId),l}}}let ve=(e,n=!1)=>{if(e instanceof Dt)h=null,p.textContent=e.customerMessage(o);else if(Tn(e))h=null,p.textContent=n?o?"当前无法在此购买,付款尚未开始。请联系商户。":"Purchases aren’t available here right now. Payment hasn’t started. Contact the merchant for help.":Mt(e,o);else if(n){let t=e instanceof k?e.code:void 0;t==="CAPABILITY_UNAVAILABLE"||t==="NOT_CONFIGURED"?(h=null,p.textContent=o?"暂时无法为此套餐报价,付款尚未开始。":"Pricing for this plan is unavailable. Payment hasn’t started."):i.canReselect===!0&&!b?p.textContent=o?"未能取得报价,付款尚未开始。请重新选择套餐。":"We couldn’t prepare your price. Payment hasn’t started. Choose a plan again.":t==="COMMAND_PENDING"?p.textContent=o?"仍在准备报价,请重试以查看结果。":"Your price is still being prepared. Retry to check the result.":p.textContent=o?"未能取得报价,付款尚未开始。请重试。":"We couldn’t prepare your price. Payment hasn’t started. Try again."}else p.textContent=e instanceof k&&(e.code==="NETWORK_ERROR"||e.code==="TIMEOUT")?Mt(e,o):e instanceof k?e.message:o?"操作未完成,请重试。":"This action couldn’t be completed. Try again.";y.hidden=h===null,Je=p.textContent,n&&se===void 0&&!$?.responsive&&p.scrollIntoView?.({block:"nearest"}),K(n&&A?.quoteError?A.quoteError:a.onError,e)},Be=new WeakMap;function je(e){de=e,y.disabled=e,ie.disabled=e,T?.updateCapabilities?.(te(d),he(d));for(let n of pe?.querySelectorAll("button")??[])e?(Be.has(n)||Be.set(n,n.disabled),n.disabled=!0):Be.has(n)&&(n.disabled=Be.get(n),Be.delete(n)),Lt(n)}function en(){V&&(p.textContent=V.message,y.textContent=o?"重试":"Retry",y.disabled=!1,y.hidden=!V.retry,ie.disabled=!0)}function kt(){p.textContent=o?"暂时无法操作,请稍后重试。":"This action is unavailable right now. Try again in a moment."}let tn=new WeakSet;async function Qn(e){if(a.beforeAction)try{await a.beforeAction({purchaseIntent:tn.has(e)})}catch(n){throw n instanceof Dt?(b=null,ge=!1,Te=!1,h=null):h=e,n}}async function W(e,n){if(de||w||V)return;if(!E()){kt();return}let t=e===qe,r=t?Ln:Un;se=n!==void 0&&T?.updateCheckoutControls?n:void 0,p.textContent=r,je(!0),Pe(),y.hidden=!0;try{if(e!==cn&&e!==It&&e!==xt&&e!==Xe&&(e!==tt||!a.resumeCheckout)&&await Qn(e),w||V)return;if(!E()){h=e,y.hidden=!1,kt();return}await e()}catch(l){w||ve(l,t)}finally{se=void 0,je(!1),Pe(),V?en():p.textContent===r&&(p.textContent="")}}async function nn(e){await Nn(le,e,a)}function De(e,n){P=n?{quote:e,phase:n}:void 0,n==="checking"?(se??=b?.actionId??Yt(d)[0],p.textContent=wt,h=It,y.textContent=o?"查询状态":"Check status",y.hidden=!0):se=void 0,T?.updateCapabilities(te(d),he(d)),Pe()}function rn(e){return e instanceof k&&(e.code==="COMMAND_PENDING"||e.reason==="RESULT_UNKNOWN"||e.code==="NETWORK_ERROR"||e.code==="TIMEOUT"||e.status===429||(e.status??0)>=500)}function an(e,n){_t(e,{...n,featureQuantities:n.featureQuantities??{}},"Purchase operation changed")}async function It(){P&&await Ae(P.quote)}async function Ae(e,n){De(e,"checking"),Je="";let t=1e3;Ve=!0,K(a.onObservationChange,!0);try{for(let r=n;E();r=void 0){if(!r){try{r=await i.read()}catch(l){if(!rn(l))throw l}if(!E())return}if(r){an(r,e);let l=R(r);if(l.type==="checkout"){De(e,"payment"),p.textContent=o?"请先完成原订单的付款。":"Finish paying for this upgrade.",y.hidden=!1;return}if(l.type==="complete"){De(e,"complete"),h=null;let c=d.capabilities.plans[e.productVersionId]?.name,s=e.merchantTerms?.subscriptionTerms?.items,u=s?.length===1?s[0].interval:void 0,I=u==="year"?o?"年付":"annual billing":u==="month"?o?"月付":"monthly billing":null;p.textContent=c?o?`已升级到 ${c}${I?" "+I:""}。`:`Upgraded to ${c}${I?" ("+I+")":""}.`:o?"已成功升级。":"Plan upgraded.",await nn(r);return}if(l.type==="native"&&!Se(r)){De(e),b=null,h=null,p.textContent=o?"付款没有成功,套餐未变更。请检查付款方式后重新选择套餐。":"Your payment didn’t go through, so your plan is unchanged. Check your payment method, then choose a plan again.",y.textContent=o?"重试":"Retry";return}if(r.problem&&!["RESULT_UNKNOWN","STATE_CHANGED"].includes(r.problem.reason??""))throw new k(r.problem.code,o?"暂时无法完成升级。":"The upgrade needs attention.",void 0,void 0,r.problem)}await Ye(t,m,Z.signal),t=Math.min(t*1.5,15e3)}}finally{Ve=!1,K(a.onObservationChange,!1)}}async function xt(){let e=P?.quote;if(!e)return;let n=await i.read();if(an(n,e),R(n).type!=="checkout")return Ae(e,n);if(a.resumeCheckout){await a.resumeCheckout(n.operationId);return}He.delete(n.operationId),await Qe(n)}function on(e){return Nt(i).type==="recording"||R(e).type==="recording"}function sn(e){let n=e.merchantTerms,t=n?.subscriptionTerms?.items??[],r=n?n.totalMinor:L(e)?e.totalMinor:e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),l=n?t.length===1&&t[0]?.amountMinor===r&&t[0]:!L(e)&&e.lines.length===1&&e.lines[0]?.catalogAmountMinor===r&&e.lines[0],c=r===null?Ie(n.subtotalMinor-n.discountMinor,e.currency)+(o?" + 待确认税费":" + tax confirmed at checkout"):Ie(r,e.currency)+(l?Le(l.interval,o?"zh-CN":"en",l.intervalCount??1):""),s=L(e)?i.view?.capabilities.plans[e.productVersionId]?.name??"":e.lines.map(u=>u.productName).join(", ");return{label:s?`${s} · ${c}`:c,recurring:l}}async function Q(e,n=a.checkoutNavigation!=="after_confirmation"){if(w)return;if(!E()){h=async()=>Q(await i.read()),y.hidden=!1;return}let t=e.quote??i.quote;if(gt(t)&&(e.confirmedAt||e.merchantExecution))return Ae(t,e);if(p.textContent=On(e.status,o),on(e)){let f=e.merchantExecution?.recordingStatus==="failed";p.textContent=f?o?"付款和商户处理已完成,但交易记录失败。请联系商户修复,勿重复购买。":"Payment and fulfillment succeeded, but recording failed. Contact the merchant to repair this purchase; do not buy again.":o?"付款和商户处理已完成,正在确认交易记录。请勿重复购买。":"Payment and merchant fulfillment are complete. Recording is pending confirmation; do not purchase again.",y.textContent=o?"查询记录":"Check recording",h=async()=>Q(await i.read()),y.hidden=!1;return}if(e.problem&&R(e).type!=="native"){let f=e.problem;h=_e,y.textContent=o?"检查并恢复原操作":"Check and recover original purchase",ve(new k(f.code,f.reason==="RESULT_UNKNOWN"?o?"付款结果尚未确定,请恢复原操作,暂勿重复购买。":"The payment result is unknown. Recover the original purchase before buying again.":f.phase==="fulfillment"?o?"付款已记录,商户权益处理需要核对。":"Payment was recorded. Access fulfillment needs attention.":f.code==="CAPABILITY_UNAVAILABLE"?o?"商户尚不支持本次购买所需的完整能力,请处理后恢复原操作。":"The merchant does not currently support all actions required by this purchase. Recover the original purchase after this is resolved.":f.code==="NOT_CONFIGURED"?o?"付款服务连接需要处理,请联系商户后恢复原操作。":"The payment connection needs attention. Contact the merchant, then recover the original purchase.":o?"原购买操作需要处理,请查询或恢复此操作。":"The original purchase needs attention. Check or recover this operation.",void 0,void 0,f));return}if((e.merchantExecution?.type==="purchase"&&e.merchantExecution.paymentStatus==="succeeded"||e.merchantExecution?.type==="subscription_change"&&e.merchantExecution.status==="applied")&&!["applied","not_applicable"].includes(e.merchantExecution.fulfillmentStatus)&&(p.textContent=o?"付款已记录,正在等待商户完成处理。":"Payment was recorded. Waiting for merchant fulfillment."),Ge(e)&&R(e).type==="complete"){h=null,await nn(e);return}let r=Ot(e);if((r||!Se(e))&&R(e).type!=="fulfillment"){if(i.canReselect===!1||r&&Se(e)&&i.canReselect!==!0){p.textContent=o?"正在核对原购买结果":"Checking the original purchase result",y.textContent=o?"查询结果":"Check result",h=async()=>Q(await i.read()),y.hidden=!1;return}r?p.textContent=o?"结账未启动,可以重新选择方案。":"Checkout didn’t start. Choose a plan to try again.":e.status==="cancelled"?p.textContent=o?"这笔购买已取消,可以重新选择方案。":"This purchase was cancelled. Choose a plan to start again.":e.status==="failed"&&(p.textContent=o?"这笔购买未能完成,可以重新选择方案。":"This purchase didn’t go through. Choose a plan to try again."),y.textContent=o?"重试":"Retry",h=null,b=null;return}if(!n&&R(e).type==="checkout"){if(F){Xt();return}if(we()){p.textContent="",it=!1,h=null,y.hidden=!0,T?.updateCapabilities?.(te(d),he(d)),Pe();return}let f=i.quote,x=f?.operationId===e.operationId?sn(f).label:"";p.textContent=it?x?o?`${x} 尚未付款。再次选择该方案即可继续付款。`:`${x} is still unpaid. Choose it again to continue paying.`:o?"之前的购买尚未付款。再次选择该方案即可继续付款。":"Your earlier purchase is still unpaid. Choose that plan again to continue paying.":"",it=!1,h=null;return}await Qe(e);let l=Date.now(),c=l+6e5,s=2e3,u=R(e).type!=="checkout",I=()=>u&&Date.now()-l<15e3;Ve=!0,K(a.onObservationChange,!0);try{for(;!w&&Date.now()<c;){if(await Ye(I()?700:s,m,Z.signal),w)return;if(!E()){h=async()=>Q(await i.read()),y.hidden=!1;return}let f=await i.read();if(R(f).type==="checkout"&&(u=!1),!n&&R(f).type==="checkout"){await Q(f,!1);return}if(!f.problem&&Se(f)&&await Qe(f),!Se(f)||Ot(f)||f.problem||on(f)){await Q(f);return}I()||(s=Math.min(s*1.5,3e4))}}finally{Ve=!1,K(a.onObservationChange,!1)}h=async()=>Q(await i.read()),y.hidden=!1}async function Et(e=!1){let n=await i.read();if(w)return;if(!E()){h=()=>Et(e),y.hidden=!1;return}let t=i.quote;if(t&&_t(n,{operationId:t.operationId,currency:t.currency},"The original purchase operation changed"),t&&(ot(n)?["prepared","quoted"].includes(n.status):n.status==="pending")&&(ot(n)||n.quoteFinalized===!1)&&!n.confirmedAt&&!n.checkoutUrl&&!("nativePurchase"in n&&n.nativePurchase)&&!n.merchantExecution&&!n.problem&&!i.pendingCancellation){if(a.purchaseConfirmation!=="paywall"){e?await _e():h=null;return}setTimeout(ln,0,t);return}await Q(n,e||void 0)}async function cn(){await Et()}async function Bn(e){p.textContent=wt;let n=Date.now()+12e3;for(;!w&&Date.now()<n&&(await Ye(1500,m,Z.signal),!(w||!E()));){let t;try{t=await i.read()}catch{break}if(t.problem?.reason!=="RESULT_UNKNOWN")return t}return e}async function _e(){if(i.quote&&!(Date.parse(i.quote.expiresAt)>Date.now()))throw new k("INVALID_REQUEST",o?"此报价已过期,请重新选择套餐。":"This quote has expired. Choose a plan again.");Jt();let e=i.quote;if(gt(e)){De(e,"checking");let t;try{t=await i.confirm()}catch(r){if(!rn(r))throw r;return Ae(e)}return Ae(e,t)}h=_e;let n=await i.confirm();if(!E()){h=_e,y.hidden=!1;return}if(n.problem?.reason==="RESULT_UNKNOWN"&&(n=await Bn(n)),n.problem){await Q(n);return}if(Se(n)){if(R(n).type==="checkout")await Qe(n);else if(n.execution&&n.execution.provider!=="merchant"||"nativePurchase"in n&&n.nativePurchase){if(!a.onPurchase)throw new k("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await a.onPurchase({operation:n,signal:Z.signal})}}h=async()=>Q(await i.read()),await Q(n,!0)}function ln(e){if(w)return;pe?.remove();let n=!(Date.parse(e.expiresAt)>Date.now());p.textContent=n?o?"此报价已过期。请先取消,再重新选择。":"This quote has expired. Cancel it, then choose again.":"";let t=m.createElement("div"),r=m.createElement("button"),l=m.createElement("button"),c=m.createElement("div"),s=m.createElement("p"),u=e.merchantTerms,I=o?"zh-CN":"en",f=u?.subscriptionTerms?.items??[],x=u?u.subscriptionTerms?.trial?.days:L(e)?void 0:e.lines.find(g=>g.trial)?.trial?.days,O=L(e)?u?u.totalMinor:e.totalMinor:x===void 0?null:u?u.totalMinor:e.charge?e.charge.totalMinor:e.lines.every(g=>g.trial)?0:null,ke=(g,v)=>o?`${v} 天试用结束后 ${g}`:`Then ${g} after the ${v}-day trial`,{label:X,recurring:Ue}=sn(e),St=L(e)?i.view?.capabilities.plans[e.productVersionId]?.name??"":e.lines.map(g=>g.productName).join(", "),pn=O===null?"":`${o?"今天应付":"Due today"} ${Ie(O,e.currency)}`;s.textContent=pn?[St,pn].filter(Boolean).join(" · "):X,r.textContent=L(e)?o?"确认变更":"Confirm change":o?"确认购买":"Confirm purchase",r.disabled=n,l.textContent=o?"取消":"Cancel",t.style.cssText=U.panel,s.style.cssText=U.summary,c.style.cssText=U.actions,r.style.cssText=U.primary,l.style.cssText=U.secondary,Lt(r),r.onclick=()=>{W(_e)};let fn=async()=>{let g=await i.cancel();w||(t.remove(),pe=null,await Q(g))};l.onclick=()=>{h=fn,W(fn)};let z=m.createElement("div");if(z.style.cssText=U.terms,L(e)){for(let[v,N]of Object.entries(e.featureQuantities??{})){let j=i.view?.capabilities.plans[e.productVersionId]?.prepaid?.find(jn=>jn.internalFeatureId===v),at=m.createElement("p");at.textContent=`${j?.name??v} · ${N} ${o?"份":"packs"}${j?` × ${j.terms.units}`:""}`,z.append(at)}for(let[v,N]of[[o?"原订阅抵扣":"Unused subscription credit",e.creditMinor],[o?"新套餐费用":"New plan charge",e.debitMinor],[o?"优惠减免":"Offer savings",u?.discountMinor??e.discountMinor],[o?"税费":"Tax",u?u.taxMinor:e.taxMinor]]){let j=m.createElement("p");j.textContent=`${v}: ${N===null?o?"结账时确认":"Confirmed at checkout":Ie(N,e.currency)}`,z.append(j)}let g=m.createElement("p");g.textContent=`${o?"生效时间":"Effective"}: ${e.effectiveAt}`,z.append(g)}if(u){for(let v of f){if(O===null&&v===Ue)continue;let N=m.createElement("p"),j=Ie(v.amountMinor,e.currency)+Le(v.interval,I,v.intervalCount);N.textContent=O!==null&&x!==void 0?ke(j,x):j,v.amountAfterOfferMinor!==void 0&&(N.textContent+=` · ${o?"优惠结束后":"After the offer"} ${Ie(v.amountAfterOfferMinor,e.currency)}${Le(v.interval,I,v.intervalCount)}`),z.append(N)}let g=u.subscriptionTerms?.trial;if(g){let v=m.createElement("p");v.textContent=o?`试用 ${g.days} 天;${g.cardRequired?"需要提供付款方式":"无需提供付款方式"}`:`Trial days: ${g.days}; ${g.cardRequired?"a payment method is required":"no payment method is required"}`,z.append(v)}for(let v of[...u.expectedEffects.map(N=>N.description),...u.requiredConsents.map(N=>N.summary)]){let N=m.createElement("p");N.textContent=v,z.append(N)}}else if(!L(e)){for(let g of e.lines){if(O!==null||g!==Ue){let v=m.createElement("p"),N=`${Ie(g.catalogAmountMinor,e.currency)}${Le(g.interval,I,g.intervalCount??1)}`;v.textContent=O!==null&&g.trial?(e.lines.length>1?`${g.productName} · `:"")+ke(N,g.trial.days):`${g.productName} · ${N}`,z.append(v)}for(let v of g.prepaid??[]){let N=m.createElement("p"),j=i.view?.capabilities.plans[g.productVersionId]?.prepaid?.find(at=>at.internalFeatureId===v.internal_feature_id);N.textContent=`${j?.name??v.internal_feature_id} · ${v.quantity} ${o?"份":"packs"} × ${v.terms.units}`,j&&(N.textContent+=Le(j.reset==="week"||j.reset==="month"||j.reset==="year"?j.reset:"one_time",I,j.resetCount)),z.append(N)}if(g.trial){let v=m.createElement("p");v.textContent=o?`试用 ${g.trial.days} 天;${g.trial.cardRequired?"需要提供付款方式":"无需提供付款方式"}`:`Trial days: ${g.trial.days}; ${g.trial.cardRequired?"a payment method is required":"no payment method is required"}`,z.append(v)}}if(!e.charge){let g=m.createElement("p");g.textContent=o?"目录价格;最终金额以结账时税费和试用规则为准。":"Catalog price; the final charge depends on checkout taxes and trial terms.",z.append(g)}}for(let g of z.children)g.style.margin="0";c.append(r,l),t.append(s,...z.childElementCount?[z]:[],c),Y.prepend(t),$?.responsive||t.scrollIntoView?.({block:"nearest"}),r.focus({preventScroll:!0}),pe=t,de&&je(!0),h=null}async function qe(){if(!b)return;if(a.onPurchaseIntent&&!ge&&!i.quote&&!i.operation){let t=b,r=i.view,l=r?.document.buttons[t.actionId],c=r&&l?.type==="checkout"?xe(l.product,t.selection,r.capabilities):null;if(!r||!c)throw new k("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");let s={actionId:t.actionId,productVersionId:c,selection:structuredClone(t.selection),featureQuantities:Ee(r.document.screen,c,t.selection,r.capabilities),...H&&{coupon:{id:H.id,...H.offerId&&{offerId:H.offerId}}}};b=null,H=void 0,h=null,Ke=!0,await a.onPurchaseIntent(s);return}if(h=qe,!ge){let t=i.view,r=t?.document.buttons[b.actionId],l=t&&r?.type==="checkout"?xe(r.product,b.selection,t.capabilities):null;if(!t||!l)throw new k("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");if(!Te){let s=Wt(),u=s?await s.result:void 0;if(w)return;let I=a.resolveSubscriptionChange;if(I||u){let f={actionId:b.actionId,productVersionId:l,featureQuantities:Ee(t.document.screen,l,b.selection,t.capabilities)},x=u?[async()=>u(f)]:[],O=I?await I(f,...x):await x[0]?.();if(w)return;O!==void 0&&(b.subscriptionChange=mn.parse(O))}Te=!0}let c=H?.offerId;if(H&&!c){if(!a.claimCoupon)throw new k("CAPABILITY_UNAVAILABLE","Coupon claiming is unavailable");let{offer:s}=await a.claimCoupon(H.id,b.requestId);if(w)return;if(!s||s.couponId!==H.id||s.status!=="issued"||!(Date.parse(s.expiresAt)>Date.now()))throw b=null,H=void 0,h=async()=>{$e(await i.refresh()),h=null},new k("COUPON_UNAVAILABLE","This Coupon is no longer available for this purchase");c=s.id}if(!H&&!t.document.screen.actions.some(s=>s.id===b?.actionId&&typeof s.properties.couponBinding=="string")&&(c=await a.resolveOfferId?.({actionId:b.actionId,productVersionId:l,featureQuantities:Ee(t.document.screen,l,b.selection,t.capabilities)})),w)return;c!==void 0&&(b.offerId=c),ge=!0}if(!E()){y.hidden=!1;return}let e;try{e=await i.preview(b)}catch(t){throw i.canReselect===!0&&(b=null,ge=!1,Te=!1,H=void 0,h=null),t}if(b.acceptHostedMonthly!==void 0){let t=i.operation;if(!t||t.operationId!==e.operationId||!t.confirmedAt)throw new k("INVALID_RESPONSE","The confirmed Checkout is missing");w||await Q(t,!0);return}if(H&&(L(e)?(()=>{let t=e.merchantTerms?.discount??(e.execution.provider==="merchant"?e.execution.discount:void 0);return t?.couponId!==H.id||t.grantId!==b.offerId})():e.discount?.couponId!==H.id||e.discount.offerId!==b.offerId))throw new k("INVALID_RESPONSE","The quote did not apply the Coupon selected on this Paywall");if(w)return;let n=e.merchantTerms;if(a.purchaseConfirmation!=="paywall"||a.confirmOnHostedCheckout&&E()&&!L(e)&&e.provider==="merchant"&&e.billingSubscriptionId===null&&n?.request.action==="purchase"&&n.request.mode==="subscription"&&n.subscriptionTerms?.trial===null&&n.requiredConsents.length===0&&Date.parse(e.expiresAt)>Date.now()){if(!E()){y.hidden=!1;return}if(!(Date.parse(e.expiresAt)>Date.now()))throw new k("INVALID_REQUEST",o?"此报价已过期,请重新选择套餐。":"This quote has expired. Choose a plan again.");let t=se?"":o?"正在打开收银台…":"Opening checkout…";p.textContent=t;try{await _e()}catch(r){w||ve(r)}finally{p.textContent===t&&(p.textContent="")}return}ln(e)}function Re(e="destroy",n=!1){if(w)return;w=!0;let t=ht;ht=void 0,K(t),a.signal?.removeEventListener("abort",ce),i.signal?.removeEventListener("abort",ce),B.finish("dismissed"),$t?.(),vt(),m.removeEventListener("visibilitychange",Gt),Z.abort(),Vt?.disconnect(),T?.destroy(),i.destroy(),S.removeEventListener("cancel",dn),_.remove(),M.remove(),n||un(),e==="dismiss"&&K(a.onDismiss)}function un(){if($?.destroy(),ue){ue.release();return}S.open&&S.close(),S.remove(),D()}G=Re;async function Fe(){if(!me||w||ze||oe==="closing"||!oe&&!E())return;if(!A){Re("dismiss");return}let e=m.createElement("p");e.setAttribute("role","status"),e.textContent=o?"正在关闭…":"Closing…",ye||(ye=m.createElement("div"),ye.style.cssText=Y.style.cssText,Y.replaceWith(ye),fe.inert=!0),_.hidden=!1,ye.replaceChildren(e,_),oe="closing",_.setAttribute("aria-disabled","true"),_.focus({preventScroll:!0});try{await A.dismiss()}catch(n){w||K(a.onError,n)}w||(oe="retry",e.textContent=o?"未能确认关闭,请重试。":"Could not confirm closure. Try again.",_.textContent=o?"重试关闭":"Retry closing",_.removeAttribute("aria-label"),_.removeAttribute("aria-disabled"))}_.onclick=()=>{Fe()};function dn(e){e.preventDefault(),Fe()}S.addEventListener("cancel",dn),ie.onclick=()=>{W(P?xt:tt)},y.onclick=()=>{if(V){V.retry?.();return}h&&W(h)};function At(e){B.finish("error",e),Re()}function Rt(){if(!(!Bt||me||w||ze||$&&!E()))try{let e=n=>{a.focusAtReveal&&(D=Ut(m)),a.settleMotionAtReveal?T?.setHidden?.(!1,!0):T?.setHidden?.(!1),mt?.(),$&&(S.open||S.showModal(),$.responsive&&S.focus({preventScroll:!0}),!n&&a.loading!=="host"&&vn(S,$.type,$.responsive)),n&&a.loading!=="host"&&typeof fe.animate=="function"&&!m.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches&&fe.animate([{opacity:.55},{opacity:1}],{duration:160,easing:"ease-out"}),me=!0,Ze()};A?A.present(n=>B.present(t=>e(n??t))):B.present(e)}catch(e){At(e),ve(e)}}try{if(Me.type==="inline"?(dt(),mt=Rn(M,q),q.append(M)):(S.setAttribute("aria-label",d.document.name),_.textContent="×",_.setAttribute("aria-label",o?"关闭":"Close"),kn(_,d.document.screen.theme),_.hidden=bn(d.document),(typeof INDIANA_NATIVE_SHELL_BUILD>"u"||!INDIANA_NATIVE_SHELL_BUILD)&&ue?.content?ue.content.append(_,M):S.replaceChildren(_,M),ue||q.append(S),$=Pn(S,{...d.document.screen,presentation:Me},ft),$.latch(),$.responsive&&(M.style.display="flex",M.style.flexDirection="column",M.style.maxHeight="100%",fe.style.overflow="clip",fe.style.minHeight="0"),ue||(mt=An(S))),lt&&ee){let t=lt(ee);if(typeof t=="function"&&(w?K(t):ht=t),w)throw new DOMException("Presentation cancelled","AbortError");dt()}T=re(fe,{mode:"live",rendererUrl:"bundled",title:d.document.name,closeActions:Mn,onAuthoredClose(t){oe||w||(_.hidden=t)},hostPresentation:()=>$?.type??Me.type,reportContentHeight:$?.responsive,onResize:t=>{if(!$?.responsive)return;let r=Math.min(t,pt);fe.style.height=`${r}px`,$.setContentHeight(r+Qt())},onSelection(t){for(let[r,l]of Object.entries(t))typeof l=="number"&&typeof J[r]=="number"&&J[r]!==l&&jt.add(r);J=t,Pe(),Ze()},onAction(t,r={},l,c){if(!me||w||oe)return;let s=i.view,u=s?.document.buttons[t];if(!u)return;if(V){u.type==="close"&&Fe();return}if(u.type==="close"&&A&&a.resumeCheckout&&i.operation&&gn(R(i.operation))){Fe();return}if(de)return;if(!E()){kt();return}if(u.type==="close"){W(async()=>{A?.closeAction?await A.closeAction(t):await a.onAction?.(t),Re(a.onAction?"action":"dismiss")});return}if(u.type==="action"){h=async()=>{if(u.action.type==="event"){if(!a.onEvent)throw new k("EVENT_HANDLER_REQUIRED","Provide the event handler");await a.onEvent(u.action.event)}else a.onOpenUrl?await a.onOpenUrl(u.action.url):m.defaultView?.location.assign(u.action.url);await a.onAction?.(t),h=null},W(h);return}if(we()&&F){!be&&F.selection.actionId===t&&W(()=>nt(!0),t);return}if(P){if(P.phase==="payment"&&s&&Ne(P.quote,s,t,u.product,r,c)){W(xt,t);return}if(!Ct())return}if(!Ce()&&!Ct()){we()&&s&&i.quote&&i.operation&&R(i.operation).type==="checkout"&&Ne(i.quote,s,t,u.product,r,c)?W(tt,t):p.textContent=o?"当前只能继续原订单。":"Only your original checkout is available.";return}if(pe&&i.canReselect===!1){p.textContent=o?"请先确认或取消当前购买。":"Confirm or cancel the current purchase first.",$?.responsive||pe.scrollIntoView?.({block:"nearest"}),pe.querySelector("button")?.focus({preventScroll:!0});return}if(we()&&a.terminateCheckout&&s&&i.quote&&i.operation&&i.canReselect===!1&&R(i.operation).type==="checkout"){if(Ne(i.quote,s,t,u.product,r,c)){W(tt,t);return}let f=xe(u.product,r,s.capabilities),x;try{if(!f)throw new k("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");x=Ee(s.document.screen,f,r,s.capabilities)}catch(Ue){ve(Ue);return}let O=i.operation.operationId,ke={actionId:t,requestId:crypto.randomUUID(),selection:structuredClone(r)},X=rt(s,t,f,r,c);W(()=>Zt(O,ke,X,{actionId:t,productVersionId:f,selection:ke.selection,featureQuantities:x}),t);return}if((i.quote||b)&&i.canReselect===!1){let f=!!s&&!!i.quote&&Ne(i.quote,s,t,u.product,r,c);it=!!i.quote&&!f,h=i.quote?()=>Et(f):qe,W(h,t);return}let I=s&&xe(u.product,r,s.capabilities);if(!s||!I){ve(new k("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(a.onPurchaseIntent){h=null;let f=async()=>{let x={actionId:t,productVersionId:I,selection:structuredClone(r),featureQuantities:Ee(s.document.screen,I,r,s.capabilities)},O=rt(s,t,I,r,c);O&&(x.coupon={id:O.id,...O.offerId&&{offerId:O.offerId}}),Ke=!0,await a.onPurchaseIntent(x)};tn.add(f),W(f,t);return}if(b&&b.actionId!==t){ve(new k("COMMAND_PENDING","Finish the current purchase"));return}if(!b){H=rt(s,t,I,r,c),b={requestId:crypto.randomUUID(),actionId:t,selection:structuredClone(r)};let f=s.document.screen.actions.find(ke=>ke.id===t)?.properties,x=f?.hostedMonthlyPriceMinor,O=f?.hostedMonthlyAutomaticTax;a.purchaseConfirmation==="purchase_button"&&a.confirmOnHostedCheckout&&i.supportsHostedCheckout===!0&&!H&&u.product.type==="fixed"&&typeof O=="boolean"&&typeof x=="number"&&Number.isSafeInteger(x)&&x>0&&x<=1e8&&Object.keys(Ee(s.document.screen,I,r,s.capabilities)).length===0&&(b.acceptHostedMonthly={amountMinor:x,automaticTax:O}),ge=b.acceptHostedMonthly!==void 0,Te=ge}W(qe,t)},onEscape:()=>{Fe()},onError:t=>{let r=new Error(t);!me&&!w&&At(r),ve(r)},onRendered:t=>{t&&S.setAttribute("aria-label",t),Bt=!0,Rt()}}),T.setHidden?.(!0),ft();let e=we()&&!!i.quote&&!!i.operation&&R(i.operation).type==="checkout";J=i.quote?_n(d,i.quote)??st(d,{}):st(d,{}),T.update(d.document.screen,ut,{capabilities:te(d),unavailableActions:he(d),serverInput:{bindings:[],answers:{}},...Object.keys(J).length?{selection:J}:{}}),$t=i.subscribe?.($e),$e(i.view??d),await B.wait(T.ready);let n=i.operation;(!e||gt(i.quote))&&(i.quote||n&&(n.confirmedAt||n.checkoutUrl||Ge(n)))&&(h=cn,W(h))}catch(e){throw At(e),e}return{check:le,host:{get currentResolution(){return d},setPurchaseRecovery(e,n){V={message:e,retry:n},T?.updateCapabilities?.(te(d),he(d)),Pe(),en()},clearPurchaseRecovery(){if(!V)return;let e=V.message;V=void 0,p.textContent===e&&(p.textContent=""),y.hidden=h===null,ie.disabled=de,T?.updateCapabilities?.(te(d),he(d)),Pe()},get subscriptionUpgradeActive(){return P!==void 0},get observing(){return Ve},get recovery(){return Vn()},async prepareFallback(){if(de||w||oe||Ke)return{type:"recover",operationId:i.operation?.operationId??i.quote?.operationId??null,requestId:null};je(!0);try{let e=await wn(i);return e.type==="native"&&Re(),e}finally{je(!1)}},setSuspended(e){ze=e,M.hidden=e,e&&S.open?S.close():!e&&!me?Rt():!e&&!w&&me&&Me.type!=="inline"&&!S.open&&S.showModal()},destroy:Re,retainPurchaseDialog(){if(!(w||!S.open||!S.isConnected))return Re("destroy",!0),{dialog:S,content:ue?.content,release:un}},refresh:async()=>{if(!E()){if(i.view)return i.view;throw new k("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await i.refresh();return $e(e),Rt(),e}}}}export{kr as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as p,c as d}from"./chunk-
|
|
1
|
+
import{b as p,c as d}from"./chunk-SEBMCCXY.js";import{t as a,w as u,z as m}from"./chunk-HN46A5SD.js";import{b as e}from"./chunk-TDOPU2RH.js";var s=e.enum(["page","popup","banner"]),y=3e5,f=e.strictObject({type:e.enum(["string","number","boolean","strings","json"]),nullable:e.boolean()}),h=e.strictObject({inputs:e.record(a,f.extend({required:e.boolean()})).refine(t=>Object.keys(t).length<=40,"Too many content inputs"),outputs:e.record(a,f).refine(t=>Object.keys(t).length<=40,"Too many content outputs")}),g=e.strictObject({kind:s,schemaVersion:e.literal(1),name:e.string().trim().min(1).max(80),screen:u,contract:h}),c=g.superRefine((t,r)=>{let n=(o,b)=>r.addIssue({code:"custom",message:o,path:b});t.screen.surface!==t.kind&&n("Content surface must match its domain",["screen","surface"]),t.screen.name!==t.name&&n("Content has one editable name",["screen","name"]),t.kind==="banner"&&t.screen.presentation.type!=="inline"&&n("Banner requires an inline container",["screen","presentation"]),t.kind!=="banner"&&t.screen.presentation.type==="inline"&&n("Inline presentation belongs to Banner",["screen","presentation"]),t.screen.actions.some(o=>o.type!=="event"&&o.type!=="navigate")&&n("Content actions must emit host intents or navigate locally",["screen","actions"]);let i=new Set(t.screen.actions.filter(o=>o.type==="event").map(o=>o.id));(Object.keys(t.contract.outputs).some(o=>!i.has(o))||[...i].some(o=>!Object.hasOwn(t.contract.outputs,o)))&&n("Every event needs exactly one output declaration",["contract","outputs"]),d(t)>y&&n("Content document exceeds its byte budget",[])});function S(t,r){if(t===null)return r.nullable;switch(r.type){case"json":return!0;case"string":return typeof t=="string";case"number":return typeof t=="number"&&Number.isFinite(t);case"boolean":return typeof t=="boolean";case"strings":return Array.isArray(t)&&t.every(n=>typeof n=="string")}}var x=c.superRefine((t,r)=>{for(let n of p(t.screen))Object.keys(t.contract.inputs).some(i=>n===i||n.startsWith(i+"."))||r.addIssue({code:"custom",path:["contract","inputs"],message:"Declare every reusable input read"});for(let n of t.screen.actions){if(n.type!=="event")continue;let i=t.contract.outputs[n.id],o=Object.hasOwn(n.properties,"value")?n.properties.value:n.properties;i&&!S(o,i)&&r.addIssue({code:"custom",path:["contract","outputs",n.id],message:"Action value differs from its declared type"})}m(t.screen).some(n=>!n.complete)&&r.addIssue({code:"custom",path:["screen","strings"],message:"Content needs complete localized copy"})}),l=e.strictObject({id:e.uuid(),kind:s,projectId:e.uuid(),environmentId:e.uuid(),name:e.string(),revision:e.number().int().nonnegative(),status:e.enum(["draft","published","archived"]),publishedVersionId:e.uuid().nullable(),createdAt:e.iso.datetime({offset:!0}),updatedAt:e.iso.datetime({offset:!0})}),D=l.extend({draft:c}),I=e.strictObject({rows:e.array(l).max(200),nextCursor:e.uuid().nullable()}),v=e.strictObject({id:e.uuid(),kind:s,resourceId:e.uuid(),projectId:e.uuid(),environmentId:e.uuid(),version:e.number().int().positive(),sourceRevision:e.number().int().nonnegative(),document:x,createdAt:e.iso.datetime({offset:!0})}),z=v.omit({document:!0}),V=e.discriminatedUnion("action",[e.strictObject({action:e.literal("create"),kind:s,id:e.uuid(),document:c}),e.strictObject({action:e.literal("save"),kind:s,id:e.uuid(),revision:e.number().int().nonnegative(),document:c}),e.strictObject({action:e.enum(["publish","archive"]),kind:s,id:e.uuid(),revision:e.number().int().nonnegative()})]).superRefine((t,r)=>{"document"in t&&t.document.kind!==t.kind&&r.addIssue({code:"custom",path:["document","kind"],message:"Content cannot change domain"})});export{s as a,v as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as ie}from"./chunk-
|
|
1
|
+
import{i as ie}from"./chunk-CNV22MDH.js";import{a as N,b as Z,d as ee,f as te,g as ne,j as M,l as re,m as oe,n as se}from"./chunk-OJ6CPUN4.js";import{b as K}from"./chunk-YTBCR2KU.js";import{r as V}from"./chunk-4AJTBYKE.js";import"./chunk-SEBMCCXY.js";import"./chunk-3I6OZU2J.js";import"./chunk-OILQZX5V.js";import"./chunk-DCKPSRMT.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-SK73TK7R.js";import"./chunk-O33ABKTL.js";import{o as X,p as Y}from"./chunk-2XX7L5VK.js";import{A as G}from"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import{d as R}from"./chunk-GRY5G7X3.js";import{a as p}from"./chunk-355B3KPL.js";import"./chunk-FEZWUYEK.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import{b as u}from"./chunk-TDOPU2RH.js";import{a as h}from"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var z=new WeakMap;function ce(o){let t={string:u.string(),number:u.number().finite(),boolean:u.boolean(),strings:u.array(u.string()),json:R}[o.type];return o.nullable?t.nullable():t}function ae(o,t){let f=u.record(u.string(),R).parse(o);if(Object.keys(f).length>40)throw new p("INVALID_REQUEST","Too many content inputs");for(let[m,n]of Object.entries(f))X.parse({[m]:n});if(Object.keys(f).some(m=>!Object.hasOwn(t.inputs,m)))throw new p("INVALID_REQUEST","Undeclared content input");for(let[m,n]of Object.entries(t.inputs))if(Object.hasOwn(f,m))ce(n).parse(f[m]);else if(n.required)throw new p("INVALID_REQUEST",`Missing content input ${m}`);return f}async function Ve(o,t){return le(o,t,!1)}async function Ae(o,t){return le(o,t,!0)}async function le(o,t,f){t.signal?.throwIfAborted();let m=K.parse(t.content),n=m.document;if(t.closeControl==="content"&&!n.screen.actions.some(e=>e.type==="event"&&e.close))throw new p("INVALID_REQUEST","An authored Close control requires a declared Close action");if(z.has(o))throw new p("CONFLICT","Content is already mounted in this container");let g=ae(t.inputs??{},n.contract),T=new Set(u.array(u.string()).max(40).parse(t.mutableInputs??[]));if(T.size!==(t.mutableInputs?.length??0)||[...T].some(e=>!Object.hasOwn(n.contract.inputs,e)))throw new p("INVALID_REQUEST","Mutable content inputs must name unique declared inputs");for(let e of Object.keys(n.contract.outputs))if(typeof t.actions[e]!="function")throw new p("INVALID_REQUEST",`Missing host handler for ${e}`);let q=Y.parse(t.bindings??[]),d=o.ownerDocument,ue=o.clientHeight||d.defaultView?.innerHeight||800,P,w,a,_,H=n.kind==="popup",r=H?d.createElement("dialog"):null,c=d.createElement("div");if(c.dataset.indianaContent=n.kind,c.setAttribute("aria-label",n.name),c.style.cssText="width:100%;min-width:0",r){r.setAttribute("aria-label",n.name);let e=n.screen.presentation;r.style.cssText=e.type==="inline"?N("content",{type:"fullscreen"},n.screen.theme):N("content",e,n.screen.theme),a=ee(r,n.screen,()=>{w?.resizeViewport(d.defaultView?.innerHeight||800,d.defaultView?.innerWidth||1024)}),r.append(c),o.append(r)}else o.append(c);let i=!1,A=!1,C=!1,D=!1,de=r?oe(r):se(c,o),S=re(o,t,n.kind,()=>{k()&&(v(),h(t.onDismiss))}),F,j,L=new Promise((e,s)=>{F=e,j=s});L.catch(()=>{});let y=null,E=structuredClone(n.screen),J=G(E,[t.locale,...d.defaultView?.navigator.languages??[]]),x=t.capabilities;E.actions=E.actions.map(e=>e.type==="event"?{...e,close:!1}:e);function v(){i||(i=!0,t.signal?.removeEventListener("abort",v),S.finish("dismissed"),j(new Error("Content preparation cancelled")),a?.destroy(),_?.(),w?.destroy(),r?.close(),r?.remove(),c.remove(),z.delete(o),r&&P?.())}let I=()=>{!C||!k()||(v(),h(t.onDismiss))};function k(){try{return t.canDismiss?.()!==!1}catch(e){return h(t.onError,e),!1}}if(r&&t.closeControl!=="content"){let e=d.createElement("button");e.type="button",e.textContent="×",e.setAttribute("aria-label",t.locale?.startsWith("zh")?"关闭":"Close"),ne(e,n.screen.theme),e.addEventListener("click",I),r.prepend(e)}r&&a?.responsive&&(_=Z(r,I,k,t.locale?.startsWith("zh")?"关闭":"Close")),r?.addEventListener("cancel",e=>{e.preventDefault(),I()}),r?.addEventListener("keydown",e=>{e.key==="Escape"&&(e.preventDefault(),I())});async function Q(){if(i||!C||A||!y)return;let e=y;A=!0,c.setAttribute("aria-busy","true");try{await t.actions[e.actionId](structuredClone(e)),y=null}catch(s){i||h(t.onError,s)}finally{A=!1,i||c.removeAttribute("aria-busy")}}function W(){if(i)throw new p("CONFLICT","Content host has been destroyed");C||!D||(P??=M(d),S.present(e=>{de(),r&&(a?.latch(),r.showModal(),a?.responsive&&r.focus({preventScroll:!0}),!e&&t.loading!=="host"&&te(r,a?.type??n.screen.presentation.type,a?.responsive)),C=!0}))}function U(e){S.finish("error",e),j(e instanceof Error?e:new Error(String(e))),v()}let B={destroy:v,show:W,get pendingAction(){return y?structuredClone(y):null},retryAction:Q,updateInputs(e){if(i)throw new p("CONFLICT","Content host has been destroyed");let s=u.record(u.string(),R).parse(e),b=ae({...g,...s},n.contract);for(let l of Object.keys(s))if(!T.has(l)&&(!Object.hasOwn(g,l)||V(g[l])!==V(b[l])))throw new p("PRECONDITION_FAILED","This content input is frozen; prepare a new presentation");V(g)!==V(b)&&(w?.update(E,J,{capabilities:x,serverInput:{bindings:q,answers:{},values:b}}),g=b)},updateCapabilities(e){if(i)return;let s=structuredClone(e);w?.updateCapabilities(s),x=s}};z.set(o,B),t.signal?.addEventListener("abort",v,{once:!0});try{if(t.signal?.throwIfAborted(),f||(P=M(d),S.start(H,t.locale??n.screen.strings.defaultLocale),i&&await L),w=ie(c,{mode:"live",rendererUrl:t.rendererUrl,title:n.name,viewportHeight:n.kind==="page"?ue:a?.responsive?d.defaultView?.innerHeight||800:void 0,...a?.responsive?{viewportWidth:d.defaultView?.innerWidth||1024,hostPresentation:()=>a.type}:{},onResize:e=>{i||a?.responsive&&(c.style.height=`${e}px`,c.style.overflow="clip",a.setContentHeight(e))},onRendered:e=>{if(!i&&(e&&r?.setAttribute("aria-label",e),!D))try{D=!0,f||W(),F()}catch(s){U(s),h(t.onError,s)}},onError:e=>{if(i)return;let s=new Error(e);D||U(s),h(t.onError,s)},onEscape:H?I:void 0,onAction:(e,s,b)=>{if(i||!C||A||y)return;let l=n.screen.actions.find(O=>O.id===e),$=n.contract.outputs[e];if(!(l?.type!=="event"||!$)&&!(l.close&&!k()))try{let O=ce($).parse(Object.hasOwn(l.properties,"value")?l.properties.value:l.properties);y=structuredClone({requestId:crypto.randomUUID(),contentVersionId:m.id,actionId:e,event:l.event,value:O,selection:s??{},answers:b??{},requestedClose:l.close}),Q()}catch(O){h(t.onError,O)}}}),w.update(E,J,{capabilities:x,serverInput:{bindings:q,answers:{},values:g}}),await Promise.race([w.ready,L]),f&&await L,i)throw new Error("Content preparation cancelled");return B}catch(e){throw U(e),e}}export{Ve as mountContent,Ae as prepareContent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-IESVRPTI.js";import"./chunk-GJTXTEZG.js";import"./chunk-PVNZFREQ.js";import"./chunk-6HOH7LOK.js";import"./chunk-YRVK3UDS.js";import"./chunk-CKUMSWUN.js";import"./chunk-RXHGIDNM.js";import"./chunk-HHKX7P4Q.js";import"./chunk-LRJJNIUQ.js";import"./chunk-CV67DHPD.js";import"./chunk-45PGU2HW.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-OJ6CPUN4.js";import"./chunk-JHVEOUIF.js";import"./chunk-6RQJNL7B.js";import"./chunk-ORQ5RR4J.js";import"./chunk-2VAQ56S2.js";import"./chunk-XF746ACV.js";import"./chunk-Q7TQHM5N.js";import"./chunk-JZYZHMCT.js";import"./chunk-L42BXSWX.js";import"./chunk-JSRB6RDU.js";import"./chunk-4AJTBYKE.js";import"./chunk-SEBMCCXY.js";import"./chunk-3I6OZU2J.js";import"./chunk-OILQZX5V.js";import"./chunk-DCKPSRMT.js";import"./chunk-VID3LHBO.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-SK73TK7R.js";import"./chunk-O33ABKTL.js";import"./chunk-2XX7L5VK.js";import"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import"./chunk-355B3KPL.js";import"./chunk-FEZWUYEK.js";import"./chunk-SLUA7ABW.js";import"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import"./chunk-TDOPU2RH.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as activeFunnelPurchase,b as showFunnelPurchase};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as X,b as Y}from"./chunk-IESVRPTI.js";import"./chunk-GJTXTEZG.js";import{a as G,c as J}from"./chunk-PVNZFREQ.js";import"./chunk-6HOH7LOK.js";import"./chunk-YRVK3UDS.js";import"./chunk-CKUMSWUN.js";import"./chunk-RXHGIDNM.js";import"./chunk-HHKX7P4Q.js";import"./chunk-LRJJNIUQ.js";import"./chunk-CV67DHPD.js";import"./chunk-45PGU2HW.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-OJ6CPUN4.js";import"./chunk-JHVEOUIF.js";import"./chunk-6RQJNL7B.js";import"./chunk-ORQ5RR4J.js";import"./chunk-2VAQ56S2.js";import"./chunk-XF746ACV.js";import"./chunk-Q7TQHM5N.js";import"./chunk-JZYZHMCT.js";import"./chunk-L42BXSWX.js";import"./chunk-JSRB6RDU.js";import"./chunk-4AJTBYKE.js";import"./chunk-SEBMCCXY.js";import"./chunk-3I6OZU2J.js";import"./chunk-OILQZX5V.js";import"./chunk-DCKPSRMT.js";import"./chunk-VID3LHBO.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-SK73TK7R.js";import"./chunk-O33ABKTL.js";import"./chunk-2XX7L5VK.js";import"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import"./chunk-355B3KPL.js";import"./chunk-FEZWUYEK.js";import"./chunk-SLUA7ABW.js";import"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import"./chunk-TDOPU2RH.js";import{a as F}from"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var j=.8,Z=1e3;function z(l){return l==="timeout"||l==="error"||l?.startsWith("error:")}function te(l,n){let v=l.ownerDocument,S=new AbortController,c=AbortSignal.any([S.signal,n.client.identitySignal,...n.signal?[n.signal]:[]]),o,u,P,I=n.maxAgeMs??G,R=Math.max(1,Math.min(Z,I*(1-j))),f=n.configuration,C=!!(n.paywallId||n.paywallVersionId||f),T,x=!1,A=()=>{},p=N(),M=p!==void 0,m=e=>F(n.onEvent,{at:performance.now(),...e});function g(e){e?.copy.destroy(),e?.select(void 0)}function w(){clearTimeout(P);let e=[o,u];o=u=void 0,e.forEach(g)}function V(){let e,t=new Promise(a=>{e=a}),r,d={select:e},s=J(l,{...n,start:t,signal:c,onState(a){m({type:"copy",state:a,...s.reason!==void 0&&{reason:s.reason},...r!==void 0&&{local:r}}),d.watch?.(a),F(n.onState,a)}},typeof p=="string"?{publication:p}:void 0);return d.copy=s,s.local.then(a=>r=a),d}function D(e){o=e,e.copy.ready.then(t=>{o===e&&(t?b():z(e.copy.reason)&&b(R,!1))})}function N(){if(!f?.fresh)return;let e=f.snapshot,t=e?.funnels[n.funnelId];if(!t)return;let r=n.paywallId?e?.paywalls?.[n.paywallId]:void 0;return x||=r!==void 0,t.state!=="active"||x&&r?.state!=="published"||n.paywallVersionId&&(T??=t.currentVersionId,T!==t.currentVersionId)?null:JSON.stringify([t.currentVersionId,t.controlRevision,t.evaluationRevision,n.paywallVersionId??r?.currentVersionId,r?.controlRevision])}function _(){return!M||f?.fresh===!0&&typeof p=="string"}function Q(){if(c.aborted)return;let e=N();e!==p&&(M||=e!==void 0,p=e,w(),y())}function H(){return C&&_()&&!c.aborted&&l.isConnected&&v.visibilityState!=="hidden"}function y(){!o&&H()&&D(V())}function b(e=I*j,t=!0){clearTimeout(P),P=setTimeout(()=>{if(!o||u||!H())return;let r=u=V();r.copy.ready.then(d=>{if(u===r){if(u=void 0,!d||!o){g(r),t&&o&&z(r.copy.reason)&&b(R,!1);return}g(o),o=r,m({type:"renewed"}),b()}})},e)}function W(){v.visibilityState==="hidden"?w():y()}function U(){v.removeEventListener("visibilitychange",W),A(),w()}function k(e){let t=e?.parameters?.commerce;return e?.funnelId===n.funnelId&&e.locale===n.locale&&t?.provider===n.commerce.provider&&t.currency===n.commerce.currency&&t.intent===n.commerce.intent}return c.aborted||(c.addEventListener("abort",U,{once:!0}),v.addEventListener("visibilitychange",W),f&&(A=f.subscribe(Q)),C||import("./screen-renderer-4VYPU7X6.js").catch(()=>{}),y()),{open(e){if(c.aborted)return Promise.resolve(null);let t=X(n.client);if(t)return e.start instanceof Promise&&e.start.catch(()=>{}),t;_()||w();let r=o;o=void 0,clearTimeout(P);let d=u;u=void 0,d&&D(d);let s=r?.copy,a=e.start,h=!e.hostPaywallTarget&&e.allowNewPurchase!==!1&&(a instanceof Promise||k(a)),L=!1,K=!1,E=i=>{K||(K=!0,m({type:"result",revealed:L,adopted:i}))},q=!1,O=i=>{q||(q=!0,E(!1),m({type:"end",outcome:i}))};m({type:"open",copy:s?.state??"none",used:!!s&&h}),r&&h?r.watch=i=>{i==="shown"?L=!0:i==="adopted"?E(!0):i!=="preparing"&&i!=="ready"&&E(!1)}:E(!1),h?s?.state==="ready"&&s.open():s?.destroy(),r?.select(h?a instanceof Promise?a.then(i=>{if(i&&!k(i)){s?.destroy();return}return i}):a:void 0);let B=Y(l,{...e,loading:e.loading??"notice",client:n.client,prepared:h?s:void 0,signal:c,onDismiss(i){return O("dismissed"),queueMicrotask(y),e.onDismiss?.(i)}});return B.then(i=>{i||O("nothing"),y()},()=>{O("error"),y()}),B},destroy(){S.abort()}}}export{te as createFunnelPurchaseEntry};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-6HOH7LOK.js";import"./chunk-YRVK3UDS.js";import"./chunk-CKUMSWUN.js";import"./chunk-RXHGIDNM.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-OJ6CPUN4.js";import"./chunk-Q7TQHM5N.js";import"./chunk-JZYZHMCT.js";import"./chunk-SEBMCCXY.js";import"./chunk-3I6OZU2J.js";import"./chunk-OILQZX5V.js";import"./chunk-DCKPSRMT.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-SK73TK7R.js";import"./chunk-O33ABKTL.js";import"./chunk-2XX7L5VK.js";import"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import"./chunk-355B3KPL.js";import"./chunk-FEZWUYEK.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import"./chunk-TDOPU2RH.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 +1 @@
|
|
|
1
|
-
import{d as p}from"./chunk-
|
|
1
|
+
import{d as p}from"./chunk-JSRB6RDU.js";import"./chunk-4AJTBYKE.js";import"./chunk-SEBMCCXY.js";import"./chunk-3I6OZU2J.js";import"./chunk-OILQZX5V.js";import"./chunk-DCKPSRMT.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-O33ABKTL.js";import"./chunk-2XX7L5VK.js";import"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import"./chunk-FEZWUYEK.js";import{a as g}from"./chunk-5MRSFLQA.js";import{b as t}from"./chunk-TDOPU2RH.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var m=1440*6e4,f=8,y=512*1024,h=t.strictObject({savedAt:t.number().int().nonnegative(),funnelId:t.string().min(1),context:t.strictObject({commerce:t.strictObject({provider:t.string(),currency:t.string(),intent:t.literal("subscription_change").optional()}),locale:t.string()}),resolution:p}),w=t.strictObject({savedAt:t.number().int().nonnegative(),funnelId:t.string().min(1),presented:t.literal("nothing")}),d=t.union([h,w]),S=t.strictObject({copies:t.record(t.string(),t.unknown())});function v(c){let u=(async()=>{let n=c.storage??globalThis.localStorage;if(!n||!globalThis.crypto?.subtle)return null;let s=new TextEncoder().encode(JSON.stringify([new URL(c.baseUrl??g).href,c.scope.projectId,c.scope.environment,c.customerId])),e=new Uint8Array(await crypto.subtle.digest("SHA-256",s));return{storage:n,key:"indiana.funnel.paywalls.v1."+Array.from(e,o=>o.toString(16).padStart(2,"0")).join("")}})().catch(()=>null);async function l(){let n=await u;if(!n)return null;try{let s=n.storage.getItem(n.key),e=s&&s.length<=y?S.safeParse(JSON.parse(s)):null;return{...n,copies:e?.success?e.data.copies:{}}}catch{return{...n,copies:{}}}}return{async read(n){let s=await l(),e=d.safeParse(s?.copies[n]);if(!e.success)return null;if("presented"in e.data)return e.data;let o=Date.now()-e.data.savedAt;return o>=0&&o<m?e.data:null},async write(n,s){let e=await l();if(!e)return;let o={...e.copies};delete o[n];let i=[...s?[[n,s]]:[],...Object.entries(o).map(([r,a])=>[r,d.safeParse(a)]).flatMap(([r,a])=>a.success?[[r,a.data]]:[]).sort(([,r],[,a])=>a.savedAt-r.savedAt)].slice(0,f);try{for(;i.length;){let r=JSON.stringify({copies:Object.fromEntries(i)});if(r.length<=y){e.storage.setItem(e.key,r);return}i.pop()}e.storage.removeItem(e.key)}catch{}}}}export{m as PAYWALL_COPY_MAX_AGE_MS,v as createPaywallCopies};
|
package/dist/{funnel-paywall-pins-source-ZK2DZWY3.js → funnel-paywall-pins-source-MJIRVW5F.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a}from"./chunk-
|
|
1
|
+
import{b as a}from"./chunk-TDOPU2RH.js";import"./chunk-WOT6VMZA.js";var l={paywalls:200,versionsPerPaywall:200,maxBytes:65536},n=a.object({kind:a.literal("funnel_paywall_pins"),formatVersion:a.literal(1),funnelId:a.uuid(),versionId:a.uuid(),paywalls:a.record(a.uuid(),a.array(a.uuid()).min(1).max(l.versionsPerPaywall)).refine(e=>Object.keys(e).length<=l.paywalls,"Too many Paywalls")});export{l as FUNNEL_PAYWALL_PINS_LIMITS,n as funnelPaywallPinsSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d}from"./chunk-PVNZFREQ.js";import"./chunk-HHKX7P4Q.js";import"./chunk-LRJJNIUQ.js";import"./chunk-JZYZHMCT.js";import"./chunk-OILQZX5V.js";import"./chunk-DCKPSRMT.js";import"./chunk-VID3LHBO.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-O33ABKTL.js";import"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import"./chunk-355B3KPL.js";import"./chunk-FEZWUYEK.js";import"./chunk-TDOPU2RH.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c}from"./chunk-HHKX7P4Q.js";import"./chunk-LRJJNIUQ.js";import"./chunk-VID3LHBO.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-GRY5G7X3.js";import"./chunk-TDOPU2RH.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as predictFunnelStart,c as predictedPaywallLoadingDocument,b as predictionRefusal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,b as o,c as n}from"./chunk-LRJJNIUQ.js";import"./chunk-VID3LHBO.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-GRY5G7X3.js";import"./chunk-TDOPU2RH.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-GJTXTEZG.js";import"./chunk-PVNZFREQ.js";import"./chunk-CKUMSWUN.js";import"./chunk-RXHGIDNM.js";import"./chunk-HHKX7P4Q.js";import"./chunk-LRJJNIUQ.js";import"./chunk-45PGU2HW.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-OJ6CPUN4.js";import"./chunk-2VAQ56S2.js";import"./chunk-Q7TQHM5N.js";import"./chunk-JZYZHMCT.js";import"./chunk-SEBMCCXY.js";import"./chunk-3I6OZU2J.js";import"./chunk-OILQZX5V.js";import"./chunk-DCKPSRMT.js";import"./chunk-VID3LHBO.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-SK73TK7R.js";import"./chunk-O33ABKTL.js";import"./chunk-2XX7L5VK.js";import"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import"./chunk-355B3KPL.js";import"./chunk-FEZWUYEK.js";import"./chunk-SLUA7ABW.js";import"./chunk-MB2U2GWJ.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import"./chunk-TDOPU2RH.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as showFunnelRun,b as showObservedFunnelRun};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { S as ScreenAnswers, P as PresentationLoadingOptions, s as screenInputBindingsSchema, a as SurfaceData, b as PaywallLoadingDocument, C as CustomerDataIntent, c as createPresentationLoading, d as PresentationState, R as RetainedPurchaseDialog } from './presentation-loading-
|
|
2
|
+
import { S as ScreenAnswers, P as PresentationLoadingOptions, s as screenInputBindingsSchema, a as SurfaceData, b as PaywallLoadingDocument, C as CustomerDataIntent, c as createPresentationLoading, d as PresentationState, R as RetainedPurchaseDialog } from './presentation-loading-EAIPC1d3.js';
|
|
3
3
|
import { J as JsonValue } from './growth-rules-B4YYy64R.js';
|
|
4
4
|
import { S as StackNode, a as ScreenSelection } from './screen-Pv_pViF6.js';
|
|
5
5
|
import { C as CouponInput, O as Offer } from './coupon-kfkIVf9n.js';
|
|
@@ -2956,12 +2956,12 @@ declare function prerenderFunnelPurchase$1(container: HTMLElement, input: {
|
|
|
2956
2956
|
onState?(state: PreparedState): void;
|
|
2957
2957
|
},
|
|
2958
2958
|
/**
|
|
2959
|
-
* SDK-internal
|
|
2960
|
-
*
|
|
2961
|
-
* Start and Paywall exactly.
|
|
2959
|
+
* SDK-internal. An existing Run owns its next screen and skips the original-purchase lookup.
|
|
2960
|
+
* Registered entries with an observed publication keep device copies under that selection.
|
|
2962
2961
|
*/
|
|
2963
|
-
|
|
2964
|
-
run
|
|
2962
|
+
internal?: {
|
|
2963
|
+
run?: true;
|
|
2964
|
+
publication?: string;
|
|
2965
2965
|
}): PreparedFunnelPurchase;
|
|
2966
2966
|
|
|
2967
2967
|
type FunnelHostOptions = PresentationLoadingOptions & {
|
|
@@ -3844,11 +3844,7 @@ type Host = Omit<RunHost, "retainPurchaseDialog" | "recoveryPaywall" | "setPurch
|
|
|
3844
3844
|
declare function showFunnelPurchase$1(container: HTMLElement, options: FunnelPurchaseHostOptions): Promise<Host | null>;
|
|
3845
3845
|
|
|
3846
3846
|
type Preparation = Parameters<typeof prerenderFunnelPurchase$1>[1];
|
|
3847
|
-
type FunnelPurchaseEntryOptions = Omit<Preparation, "start" | "funnelId" | "commerce" | "locale"> & Required<Pick<Preparation, "funnelId" | "commerce" | "locale">> &
|
|
3848
|
-
paywallId: string;
|
|
3849
|
-
} | {
|
|
3850
|
-
paywallVersionId: string;
|
|
3851
|
-
}) & {
|
|
3847
|
+
type FunnelPurchaseEntryOptions = Omit<Preparation, "start" | "funnelId" | "commerce" | "locale"> & Required<Pick<Preparation, "funnelId" | "commerce" | "locale">> & {
|
|
3852
3848
|
/**
|
|
3853
3849
|
* Every change of the entry's prepared copy and every opening, with the reason the SDK has
|
|
3854
3850
|
* for it. For diagnostics and timing: it never changes what the entry does.
|
|
@@ -3869,7 +3865,7 @@ type FunnelPurchaseEntryEvent = {
|
|
|
3869
3865
|
type: "renewed";
|
|
3870
3866
|
} | {
|
|
3871
3867
|
/**
|
|
3872
|
-
*
|
|
3868
|
+
* A click began a presentation. `copy` is what the click found; `used` is false when it
|
|
3873
3869
|
* could not take it (another scope, a host Paywall target, no new purchase allowed).
|
|
3874
3870
|
*/
|
|
3875
3871
|
type: "open";
|
|
@@ -3877,7 +3873,7 @@ type FunnelPurchaseEntryEvent = {
|
|
|
3877
3873
|
used: boolean;
|
|
3878
3874
|
} | {
|
|
3879
3875
|
/**
|
|
3880
|
-
* What became of the copy an opening took, once per
|
|
3876
|
+
* What became of the copy an opening took, once per opening. `revealed`: the Customer saw
|
|
3881
3877
|
* it. `adopted`: the Run took it over, so the Paywall the Customer saw at the click is the
|
|
3882
3878
|
* one they buy from. An opening that had no copy, could not use it, or whose Run presented
|
|
3883
3879
|
* its own Paywall instead reports `adopted: false`; count hits by this event, not by
|
|
@@ -3893,9 +3889,9 @@ type FunnelPurchaseEntryEvent = {
|
|
|
3893
3889
|
});
|
|
3894
3890
|
type OpenOptions = Omit<FunnelPurchaseHostOptions, "client" | "prepared" | "signal">;
|
|
3895
3891
|
/**
|
|
3896
|
-
* Keeps a prepared Paywall for a visible merchant entry
|
|
3897
|
-
*
|
|
3898
|
-
* and execution.
|
|
3892
|
+
* Keeps a prepared Paywall for a visible merchant entry when the first screen is known.
|
|
3893
|
+
* The caller supplies the final Start at the click. A cold opening uses a cancellable
|
|
3894
|
+
* non-modal notice by default. The purchase host owns recovery and execution.
|
|
3899
3895
|
*/
|
|
3900
3896
|
declare function createFunnelPurchaseEntry$1(container: HTMLElement, options: FunnelPurchaseEntryOptions): {
|
|
3901
3897
|
open(opening: OpenOptions): Promise<{
|
|
@@ -5440,7 +5436,7 @@ declare function createFunnelPurchaseEntry(...args: Parameters<typeof createFunn
|
|
|
5440
5436
|
open(opening: {
|
|
5441
5437
|
start?: (FunnelPurchaseStart | Promise<FunnelPurchaseStart | null | undefined>) | undefined;
|
|
5442
5438
|
resolveOfferId?: ((purchase: Parameters<NonNullable<FunnelHostOptions["resolveOfferId"]>>[0], attempt: FunnelPurchaseAttempt) => ReturnType<NonNullable<FunnelHostOptions["resolveOfferId"]>>) | undefined;
|
|
5443
|
-
loading?: "sdk" | "host" | undefined;
|
|
5439
|
+
loading?: "sdk" | "host" | "notice" | undefined;
|
|
5444
5440
|
onPresentationState?: ((state: PresentationState) => void) | undefined;
|
|
5445
5441
|
hostPaywallTarget?: HTMLElement | undefined;
|
|
5446
5442
|
closeActions?: readonly string[] | undefined;
|