@tinkerlandai/longplay-sdk 0.10.33 → 0.10.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -3
- package/README.md +58 -9
- package/README.zh-CN.md +22 -5
- package/dist/check-response-GZZRWBEA.js +1 -0
- package/dist/chunk-2FE4FTPH.js +1 -0
- package/dist/chunk-3NCMYTNG.js +1 -0
- package/dist/chunk-44U3FOBB.js +1 -0
- package/dist/chunk-56BYGPQ6.js +1 -0
- package/dist/chunk-73NP72FV.js +1 -0
- package/dist/{chunk-KR3KDTVD.js → chunk-BLVBUN2R.js} +1 -1
- package/dist/chunk-BOVN2BE3.js +1 -0
- package/dist/chunk-BQRS7Y4K.js +1 -0
- package/dist/chunk-CIP5SQ5Y.js +1 -0
- package/dist/chunk-CKKIB2HC.js +1 -0
- package/dist/chunk-EM3MGDPG.js +1 -0
- package/dist/chunk-ETK6GC5P.js +1 -0
- package/dist/chunk-EUTWY7A2.js +1 -0
- package/dist/{chunk-NVHIGAO3.js → chunk-FMDC6N4W.js} +1 -1
- package/dist/chunk-GZRRVHYK.js +1 -0
- package/dist/{chunk-MIBRUDIS.js → chunk-KE26KWIU.js} +1 -1
- package/dist/{chunk-GGRDM54V.js → chunk-KPDHY76A.js} +1 -1
- package/dist/{chunk-FYQXSGRT.js → chunk-LF2UIJYD.js} +1 -1
- package/dist/{chunk-UWLEGMWX.js → chunk-MSK3VZ3A.js} +1 -1
- package/dist/{chunk-X4W22IH6.js → chunk-OX7PA64E.js} +1 -1
- package/dist/chunk-PUR5CYWX.js +1 -0
- package/dist/{chunk-XLSDL4D3.js → chunk-RML52BOR.js} +1 -1
- package/dist/chunk-RNEF4MZW.js +1 -0
- package/dist/chunk-SFHIFCXG.js +1 -0
- package/dist/{chunk-HQITRRHF.js → chunk-SXBM3DWK.js} +1 -1
- package/dist/chunk-TAFALMQN.js +1 -0
- package/dist/chunk-TJGIT5CU.js +1 -0
- package/dist/{chunk-KIMX3OIV.js → chunk-TLZP7BW6.js} +1 -1
- package/dist/chunk-TOTRALYQ.js +10 -0
- package/dist/chunk-U4RSRFZY.js +1 -0
- package/dist/chunk-UVRT4MY6.js +1 -0
- package/dist/chunk-V7MMTILA.js +1 -0
- package/dist/chunk-V7PFLFHE.js +1 -0
- package/dist/{chunk-BXPXJARS.js → chunk-VEX2FOFZ.js} +1 -1
- package/dist/chunk-W32FI2A2.js +1 -0
- package/dist/chunk-W6OQTXLL.js +1 -0
- package/dist/{chunk-EQPEUPMG.js → chunk-WZR2XCSJ.js} +1 -1
- package/dist/chunk-XUGEOELU.js +1 -0
- package/dist/chunk-YVXLCQGM.js +1 -0
- package/dist/content-AJDTSI7A.js +1 -0
- package/dist/funnel-host-purchase-Z7FCJ5CX.js +1 -0
- package/dist/{funnel-local-client-BeGBvi3z.d.ts → funnel-local-client-Dz1dTgES.d.ts} +22 -22
- package/dist/funnel-paywall-prerender-QHCUZZY3.js +1 -0
- package/dist/{funnel-process-client-C6QKDZun.d.ts → funnel-process-client-D6qjStm2.d.ts} +1 -1
- package/dist/funnel-runtime-host-UKSOOA4H.js +1 -0
- package/dist/index.d.ts +196 -61
- package/dist/index.js +1 -1
- package/dist/merchant-bridge-contracts-EAE4HQE4.js +1 -0
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.js +1 -1
- package/dist/operation-contracts-HS4M2UXN.js +1 -0
- package/dist/page.js +1 -1
- package/dist/paywall-VYUBYBUI.js +1 -0
- package/dist/paywall-content-YQAVSO2T.js +1 -0
- package/dist/paywall-session-E5V42XUT.js +1 -0
- package/dist/popup.d.ts +20 -2
- package/dist/popup.js +1 -1
- package/dist/{presentation-loading-CiEQbUDk.d.ts → presentation-loading-CFSiS0VX.d.ts} +3 -1
- package/dist/react-native.d.ts +4 -4
- package/dist/react-native.js +1 -1
- package/dist/screen-renderer-R5GH7XLV.js +1 -0
- package/dist/server.d.ts +32 -2
- package/dist/server.js +3 -3
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BRAVNBCC.js +0 -1
- package/dist/chunk-EHDHWYVJ.js +0 -1
- package/dist/chunk-ENZBWR3Y.js +0 -1
- package/dist/chunk-HQPP76BS.js +0 -1
- package/dist/chunk-ILEDKSRQ.js +0 -1
- package/dist/chunk-JN6JEKWN.js +0 -1
- package/dist/chunk-MPYJRLKB.js +0 -10
- package/dist/chunk-N7YXDSQL.js +0 -1
- package/dist/chunk-NAZU3EEJ.js +0 -1
- package/dist/chunk-NVIHK5GE.js +0 -1
- package/dist/chunk-R23IGK5U.js +0 -1
- package/dist/chunk-R4FDIYMN.js +0 -1
- package/dist/chunk-SCC3O2RD.js +0 -1
- package/dist/chunk-THMGTRXP.js +0 -1
- package/dist/chunk-U2R7MG3J.js +0 -1
- package/dist/chunk-U6E6CM7Z.js +0 -1
- package/dist/chunk-U6GWWCUS.js +0 -1
- package/dist/chunk-UHQGO6OR.js +0 -1
- package/dist/chunk-YTZQ5BMP.js +0 -1
- package/dist/content-CFX2L2BP.js +0 -1
- package/dist/funnel-host-purchase-MSPLT3ZV.js +0 -1
- package/dist/funnel-runtime-host-ATOA7MGC.js +0 -1
- package/dist/merchant-bridge-contracts-ZUQ6SGXZ.js +0 -1
- package/dist/operation-contracts-443N2P3A.js +0 -1
- package/dist/paywall-XAXSMLDU.js +0 -1
- package/dist/paywall-session-MB7BD2XP.js +0 -1
- package/dist/screen-renderer-3CBREMIS.js +0 -1
package/dist/chunk-U2R7MG3J.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as $A}from"./chunk-VYFSRHXM.js";import{a as y}from"./chunk-X4W22IH6.js";import{a as jA,c as BA,d as xA,e as MA,f as UA,h as sA}from"./chunk-R4FDIYMN.js";import{a as zA,b as FA}from"./chunk-UHQGO6OR.js";var pA="X-Indiana-Protocol",QA="X-Indiana-SDK-Version";var gA={current:"0.10"};function I(A){return typeof A=="string"?A:String(A)}var Se=/[\ud800-\udbff](?![\udc00-\udfff])|(^|[^\ud800-\udbff])[\udc00-\udfff]/g;function Ie(A){return A.replace(Se,"$1\uFFFD")}function yA(A,e){if(typeof A!="object"||A==null){let t="";throw t+="The provided value is not an object",new TypeError(t)}return A}function Ae(A){if(A!=null&&(typeof A=="object"||typeof A=="function")){let e=A[Symbol.iterator];if(e==null)return;if(typeof e!="function")throw new TypeError("The provided value is not iterable");let t=e.call(A);if(!t||typeof t!="object")throw new TypeError("Result of the Symbol.iterator method is not an object");return t}}function GA(A){let e;if(Array.isArray(A)){let t=A.map(I);if(t.length===2)return t}else if((e=Ae(A))!=null){let t=yA(e.next()),n=yA(e.next());if(!t.done&&!n.done)return[I(t.value),I(n.value)]}throw new TypeError("Each query pair must be an iterable [name, value] tuple")}var KA="0123456789ABCDEF",be=/(?:%[0-9A-Fa-f]{2})+/g;function M(A){return`%${KA[A>>4&15]}${KA[15&A]}`}function ee(A,e,t=!1){return A>=55296&&A<=57343&&(A=65533),A<=127?t&&A===32?"+":e(A)?M(A):String.fromCharCode(A):A<=2047?M(192|A>>6)+M(128|63&A):A<=65535?M(224|A>>12)+M(128|A>>6&63)+M(128|63&A):M(240|A>>18)+M(128|A>>12&63)+M(128|A>>6&63)+M(128|63&A)}function DA(A){return A>=48&&A<=57?A-48:A>=65&&A<=70?A-65+10:A>=97&&A<=102?A-97+10:-1}function SA(A,e=!1){let t=0;for(;t<A.length;t++){let n=A.charCodeAt(t);if(n===37||e&&n===43)break}return t===A.length?A:(e?A.replace(/\+/g," "):A).replace(be,n=>{try{return decodeURIComponent(n)}catch{return"\uFFFD".repeat(n.length/3)}})}function AA(A){return A<=31||A>126}function Ce(A){switch(A){case 32:case 34:case 60:case 62:case 96:return!0;default:return AA(A)}}function OA(A){switch(A){case 32:case 34:case 35:case 60:case 62:return!0;default:return AA(A)}}function Ee(A){return OA(A)||A===39}function IA(A){switch(A){case 63:case 94:case 96:case 123:case 125:return!0;default:return OA(A)}}function cA(A){switch(A){case 47:case 58:case 59:case 61:case 64:case 91:case 92:case 93:case 124:return!0;default:return IA(A)}}function YA(A){switch(A){case 33:case 39:case 40:case 41:case 126:return!0;default:return(function(t){switch(t){case 36:case 37:case 38:case 43:case 44:return!0;default:return cA(t)}})(A)}}function te(A,e){return ee(A=A||0,e)}function U(A,e,t=!1){let n=0;for(;n<A.length;n++){let u=A.charCodeAt(n);if(u>=128||t&&u===32||e(u))break}if(n===A.length)return A;let r=A.slice(0,n);for(;n<A.length;n++){let u=A.charCodeAt(n),l=u;if(u>=55296&&u<=56319&&n+1<A.length){let a=A.charCodeAt(n+1);a>=56320&&a<=57343&&(l=(u-55296<<10)+a-56320+65536,n++)}r+=ee(l,e,t)}return r}function RA(A){let e=[],t=0,n=0;for(;n<=A.length;){if(n=A.indexOf("&",t),n<0&&(n=A.length),n!==t){let r=A.slice(t,n),u=r.indexOf("=");u<0&&(u=r.length),e.push([SA(r.slice(0,u),!0),SA(r.slice(u+1),!0)])}if(t=n+1,n===A.length)break}return e}function bA(A){let e="";for(let t=0;t<A.length;t++){let n=U(A[t][0],YA,!0),r=U(A[t][1],YA,!0);e+=t!==0?`&${n}=${r}`:`${n}=${r}`}return e}var Te=[2191,2191,3164,3164,3292,3292,6863,6877,6880,6891,8385,8385,11158,11158,42958,42959,42962,42962,42964,42964,42993,42993,64451,64466,64912,64913,64968,64974,67904,67929,69317,69319,69328,69336,69370,69371,72544,72551,73136,73179,73184,73193,93856,93880,93883,93907,94194,94198,100344,100351,101641,101662,101760,101874,118010,118012,118458,118480,118496,118512,124608,124638,124640,124661,124670,124671,128728,128728,128887,128890,129232,129240,129620,129623,129674,129674,129678,129678,129736,129736,129741,129741,129770,129770,129775,129775,130042,130042,177978,177983,183970,183981,205744,210041],ve=[7296,7297,7298,7299,7300,7301,7302,7303,7304,42958,42962,42964,42993],Oe=["\u0432","\u0434","\u043E","\u0441","\u0442","\u0442","\u044A","\u0463","\uA64B","\uA7CF","\uA7D3","\uA7D5","s"],Re=[2381,2381,2509,2509,2637,2637,2765,2765,2893,2893,3021,3021,3149,3149,3277,3277,3387,3388,3405,3405,3530,3530,3642,3642,3770,3770,3972,3972,4153,4154,5908,5909,5940,5940,6098,6098,6752,6752,6980,6980,7082,7083,7154,7155,11647,11647,43014,43014,43052,43052,43204,43204,43347,43347,43456,43456,43766,43766,44013,44013,68159,68159,69702,69702,69744,69744,69759,69759,69817,69817,69939,69940,70080,70080,70197,70197,70378,70378,70477,70477,70606,70608,70722,70722,70850,70850,71103,71103,71231,71231,71350,71350,71467,71467,71737,71737,71997,71998,72160,72160,72244,72244,72263,72263,72345,72345,72767,72767,73028,73029,73111,73111,73537,73538,90415,90415];function ke(A){for(let e=0;e<A.length;e++){let t=A.codePointAt(e);if(t>65535&&e++,t<=32||t===37||t===127||t>=55296&&t<=57343||t>=128&&t<=159||t>=64976&&t<=65007||!(65534&~t)||t===65533)return!0}return!1}var[qe,Ne,Le,VA]=[[[],"0,6,7,8,m,w,10,1b,1d,1f,72,73,7k,8k,dt,2rk","AAAAAAAAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAA/AAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAADAAABwfwAAAAAAAMADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAQAAAAAAAAQCAAABAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgACAAAAAAAAAAAAAAAAD//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAP///////////////wAAAAAAAAAAAAAAAAAAAAA="],[[],"6,7,8,o,4o,7e,7f,7h,7i,7j,dl","AAAAAEF9+P/+BwAAAMAA//8AAPz/////BlADAAAAAJwAAPz///8AAADA//H/5+X8AAAAAAAAAAAA/P///wcAAAAAAAAAAAAAPv0vAD0BAABA/gAA/5/5/f8BAAAAAAAAgAAAAP//////////////AYD/////BQAAAAAAAAAAAAAAAAAAAAAAAP///////wcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8g+N8B+AAAAAAAAAAAAAAAAAAAAAAAAP//AwAAYAAAAAAAAAAAAAD/////CwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANgAAAAAAAAAAAAAAAAA//8fAB4AAAD//wMAAAAAAH3/HgwAAAAAAAD//////////w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],[[],"6,7,8,o,4o,7e,7f,7h,7i,7j,dl","AAAAAP3////+BwAAAMDu//////////////8vAADAAJwAAP3///8AAADg////////AAAAAAAAAAAA/P///wcAAAAAAAAAAAAA////Ab0H//9H/gAA/9////8BAAAAAAAAgAAAAP//////////////AYD/////BQAAAAAAAAAAAAAAAAAAAAAAAP///////wcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL/G//8T+AAAAAAAAAAAAAAAAAAAAAAAAP//AwAAfgAAAAAAAAAAAAD+////DwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANwAAAAAAAAAAAAAAAAA//8fAB4AAAD//wMAAAAAAH3/Hg4AAAAAAAD//////////w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],[[],"0,3,4,5,6,7,8,9,a,b,c,d,e,f,g,j,n,o,p,q,r,s,t,w,18,19,1c,4m,4o,4p,4q,4r,6z,72,73,75,76,77,7e,7h,7i,7j,7k,7l,7m,7n,7o,7p,7q,7r,7s,7t,7u,7v,7w,7x,7y,7z,8k,9t,a2,a3,a7,cc,cv,cx,cy,d6,dc,dd,de,dg,dh,di,dk,dl,2rk,2rl","AAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAD//////////////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/v////+/tgAAAAAAAAAAAP8XAAAAAAD4//8AAAEAAAAAAAAAAAAAAMCfnz0AAACAAgAAAP///wcAAAAAAAAAAAAAwP8BAAAAAAAA+A8gAADA++8+AAAAAAAOAAAAAAAAgP8AAAAAAPz///v///8HAAAAAAAAFP4h/gAMAAAAAgAAAAAAABAeIAAADAAAQAYAAAAAAAAQhjkCAAAAIwAGAAAAAAAAEL4hAAAMAAD8AgAAAAAAAJAeIGAADAAAAAQAAAAAAAAAASAAAAAAAAARAAAAAAAA0ME9YAAMAAAAAgAAAAAAAJBAMAAADAAAAAMAAAAAAAAYHiAAAAwAAAACAAAAAAAAAAAEXAAAAAAAAAAAAAAA8geAfwAAAAAAAAAAAAAAAPIfAH8AAAAAAAAAAAADAACgAgAAAAAAAP5/3+D//v///x9AAAAAAAAAAAAAAAAA4P1mAAAAwwEAHgBkIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAMAAAADAAAAAwAAAAAAAAAsD9A/g8gAAAAAAC4AAAAAAAAAAAAAAAAAABgAAAAAAIAAAAAAAAAAAAAAAAAAIcBBA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAJAAAAAAAAQH/lH/ifAAAAAAAA//////8//w8AAA8AAAAAANAXBAAAAAD4DwADAAAAPDsAAAAAAABAowMAAAAAAADwzwAAAAAAAAAAAAAAAAAAAAAAAAD3//0hEAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wDIAAAAfAAAAAAAAB/8AAAAAAAAAAAAAAAA/////wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAwAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAA/////wAAAAAAPAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAID3PwAAAMAAAAAAAAAAAAAAAwBECAAAYBAAAAAAAAAAAAAAAAAAAAAAAAAwAAAA//8DgAAAAADAPwAAgP8DAAAAAAAHAAAAAADIMwAAAAAgAAAAAAAAAAB+ZgAIEAAAAAAAEAAAAAAAAJ3BAgAAAAAwQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAICEAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAP//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAMAHAAAAAAAAAAAAAAAAAAAAAG7wAAAAAACHAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAPAAAAAAAAAAAD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAA/AAAAAAAAAAAwP8BAAAAAAA8AAAAAAAAAAAAAAAAAAAAAgAAAAAAAP9/AAAAAAAZgAMAAAAAAHgGBAAAAAAAAAAHAAAAgO8fAAAAAAAAAAgAAwAAAAAAwH8AngAAAAAAAAAAAAAAgNNAAgAAAAAAAAAAAAAAAAAAAAAAAID4BwAAAwAAAAAAABgBAAAAwB8fAAAAAAAAAAD4AUAFAAYAAAAAAAAAAAAA/1wAAEAAAAAAAAAAAAAA+IUNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8sAEAADAAAAAAAAAAAAAA+KcBAAAAAAAAAAAAAAAAKL8AAAAAAAAAAAAAAACgvA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgP8GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFgIAAAAAAAAAAAAAAAAAAAAAADwDAEAAAD+BwAAAAD4eYAAfg4AAAAAAPx/AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAF0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf78AAAAAAAAAAAAA/P///G0AAAAAAAAAAAAAAAAAAAB+tL8AAAAAAAAAAACjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAwAAAAAAwAcFAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//4H/PwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMD/4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwAAAAAAAAB/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAcAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAPAAAAAAAAAAAAAAD//////z///38AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAD+P/nDwAAADwAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////9/+P//////HyAAEAAA+P7/AAAAAAAAAAAAAH////nbBwAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAfwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASMAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfwAAAAAAAAAAAAAAAADwDwAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAA////////////////AAAAAAAAAAAAAAAAAAAAAP///////////////////////////////////////wAA"]].map(function([e,t,n]){return[e,t.split(",").map(r=>parseInt(r,36)),Uint8Array.from(atob(n),r=>r.charCodeAt(0))]});function He(A,e){return e===931||e===1010||e===120531||e===120589||e===120647||e===120705||e===120763?"\u03C3":e>=5112&&e<=5117?String.fromCodePoint(e-8):e>=43888&&e<=43967?String.fromCodePoint(e-38864):e>=93856&&e<=93880?String.fromCodePoint(e+27):e===837||e===890||e>=8064&&e<=8111||e>=8114&&e<=8188?A.normalize("NFD").replace(/\u0345/g,"\u03B9").normalize("NFC").toLowerCase():""}function ne(A,e){for(let t=0;t<A.length;t+=2)if(e>=A[t]&&e<=A[t+1])return!0;return!1}function W(A,e){let[t,n,r]=A,u=e>>8;for(let h=0;h<t.length;h+=2)if(u>=t[h]&&u<=t[h+1])return!0;let l=n.indexOf(u);if(l<0)return!1;let a=255&e;return!!(r[32*l+(a>>3)]&1<<(7&a))}function _e(A){let e=Array.from(A,t=>t.codePointAt(0));for(let t=0;t<e.length;t++){let n=e[t];if(n!==8204&&n!==8205||t>0&&ne(Re,e[t-1]))continue;if(n===8205)return!1;let r=t-1;for(;r>=0&&W(VA,e[r]);)r--;let u=t+1;for(;u<e.length&&W(VA,e[u]);)u++;if(!(r>=0&&u<e.length&&W(Ne,e[r])&&W(Le,e[u])))return!1}return!0}var je=/(?![\p{Mark}\p{Decimal_Number}])[\p{Script=Arabic}\p{Script=Hebrew}]/u,Be=/\p{Script=Latin}/u;function xe(A){return!je.test(A)||!Be.test(A)}var F=36,iA=1,CA=26,Me=38,Ue=700,$e=72,ze=128,Fe=2147483647;function XA(A){return String.fromCharCode(A+22+75*+(A<26))}function Qe(A,e,t){let n=0;for(A=t?Math.floor(A/Ue):A>>1,A+=Math.floor(A/e);A>(F-iA)*CA>>1;n+=F)A=Math.floor(A/(F-iA));return Math.floor(n+(F-iA+1)*A/(A+Me))}function Ge(A){let e=Array.from(A,h=>h.codePointAt(0)),t="",n=0;for(let h=0;h<e.length;h++){let f=e[h];f<128&&(t+=String.fromCharCode(f),n++)}let r=n;r&&(t+="-");let u=ze,l=0,a=$e;for(;n<e.length;){let h=Fe;for(let f=0;f<e.length;f++){let g=e[f];g>=u&&g<h&&(h=g)}l+=(h-u)*(n+1),u=h;for(let f=0;f<e.length;f++){let g=e[f];if(g<u&&l++,g===u){let p=l;for(let m=F;;m+=F){let P=m<=a?iA:m>=a+CA?CA:m-a;if(p<P)break;t+=XA(P+(p-P)%(F-P)),p=Math.floor((p-P)/(F-P))}t+=XA(p),a=Qe(l,n+1,n===r),l=0,n++}}l++,u++}return t}function wA(A){let e=10;if(A.length>=2&&A[0]==="0"&&(A[1]==="x"||A[1]==="X"))A=A.slice(2),e=16;else if(A.length>=2&&A[0]==="0")A=A.slice(1),e=8;else if(A==="")return-1;let t=0;for(let n=0;n<A.length;n++){let r=DA(A.charCodeAt(n));if(r>=e||r<0)return-1;t=t*e+r}return t}function JA(A){switch(A){case".":case"%2e":case"%2E":return!0;default:return!1}}function re(A,e){return(A>=65&&A<=90||A>=97&&A<=122)&&(e===58||e===124)}function se(A){return A.length===2&&re(A.codePointAt(0),A.codePointAt(1))}function WA(A){return A.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u)!==-1}function C(A){switch(A){case"ftp":case"http":case"https":case"ws":case"wss":case"file":return!0;default:return!1}}function oe(A){switch(A){case"ftp":return 21;case"http":case"ws":return 80;case"https":case"wss":return 443;default:return null}}function EA(A,e){if(A[0]==="[")return A[A.length-1]==="]"?(function(n){let r=[0,0,0,0,0,0,0,0],u=null,l=0,a=0,h=Array.from(n,f=>f.codePointAt(0));if(h[a]===58){if(h[a+1]!==58)return null;a+=2,l++,u=l}for(;a<h.length;){if(l===8)return null;if(h[a]===58){if(u!==null)return null;a++,l++,u=l;continue}let f=0,g=0,p=0;for(;p<4&&(f=DA(h[a]))>=0;)g=(g<<4)+f,a++,p++;if(h[a]===46){if(p===0||l>6)return null;a-=p;let m=0;for(;h[a]!==void 0;){let P=0;if(m>0)if(h[a]===46&&m<4)a++;else return null;if(h[a]==null||h[a]<48||h[a]>57)return null;for(;h[a]>=48&&h[a]<=57;){if(P=10*P+DA(h[a]),P>255)return null;a++}r[l]=256*r[l]+P,m++,m%2==0&&l++}if(m!==4)return null;break}else if(h[a]===58){if(h[++a]===void 0)return null}else if(h[a]!==void 0)return null;r[l]=g,l++}if(u!==null){let f=l-u;for(l=7;l!==0&&f>0;){let g=r[u+f-1];r[u+f-1]=r[l],r[l]=g,l--,f--}}else if(u===null&&l!==8)return null;return r})(A.substring(1,A.length-1)):null;if(e)return(function(n){return WA(n)?null:U(n,AA)})(A);{let t=(function(r){let u=!1,l=!1;for(let h=0;h<r.length;h++){let f=r.charCodeAt(h);if(f<=32||f===37||f===127)return null;if(f>=128){u=!0;break}f>=65&&f<=90&&(l=!0)}if(!u)return r!==""?l?r.toLowerCase():r:null;if((function(f){for(let g of f){let p=g.codePointAt(0);if(/[\p{Cn}\p{Co}\p{Cs}\p{Noncharacter_Code_Point}]/u.test(g)&&!ne(Te,p)||W(qe,p))return!0}return!1})(r))return null;let a=(r=(function(f){let g="";for(let p of f){let m=p.codePointAt(0);if(m!==8204&&m!==8205&&/\p{Default_Ignorable_Code_Point}/u.test(p))continue;let P=He(p,m);if(P){g+=P;continue}let k=ve.indexOf(m);g+=k<0?p:Oe[k]}return g})(r).normalize("NFKC").replace(/[\u3002\uff0e\uff61]/g,".").toLowerCase()).split(".");for(let h=0;h<a.length;h++){let f=a[h];if(f==="")continue;let g=/[^\0-\x7f]/.test(f);if(ke(f)||g&&(/^\p{Mark}/u.test(f)||!_e(f)||!xe(f)||f.startsWith("xn--")))return null;g&&(a[h]=`xn--${Ge(f)}`)}return(r=a.join("."))!==""?r:null})(A.indexOf("%")===-1?A:SA(A));return t===null||WA(t)?null:(function(r){let u=r.length,l=r.lastIndexOf(".",u-2)+1;if(r.charCodeAt(u-1)===46&&u--,u<=l)return!1;if(wA(r.slice(l,u))>=0)return!0;for(;l<u;l++){let a=r.charCodeAt(l);if(a<48||a>57)return!1}return!0})(t)?(function(r){let u=r.split("."),l=u.length;if(u[l-1]||l--,l>4)return null;let a=0;for(let f=0;f<l-1;f++){let g=wA(u[f]);if(g<0||g>255)return null;a+=g*(1<<8*(3-f))}let h=wA(u[l-1]);return h<0||h>=256**(5-l)?null:(a+=h,a)})(t):t}}function TA(A){return typeof A=="number"?(function(t){let r="";return r+=`${(t>>>24&255).toString(10)}.`,r+=`${(t>>>16&255).toString(10)}.`,r+=`${(t>>>8&255).toString(10)}.`,r+=(t&255).toString(10),r})(A):Array.isArray(A)?`[${(function(t){let n=(function(a){let h=-1,f=-1,g=1,p=0;for(let m=0;m<a.length;++m)a[m]!==0?(p>g&&(h=f,g=p),f=-1,p=0):(f===-1&&(f=m),++p);return p>g?f:h})(t),r="",u=!1;for(let l=0;l<=7;++l)if(!(u&&t[l]===0)){if(u&&(u=!1),n===l){r+=l===0?"::":":",u=!0;continue}r+=t[l].toString(16),l!==7&&(r+=":")}return r})(A)}]`:A}function ie(A){A.path.length>0&&(A.path.length!==1||A.scheme!=="file"||!(function(t){return/^[A-Za-z]:$/u.test(t)})(A.path[0]))&&A.path.pop()}function le(A){return A.username!==""||A.password!==""}function mA(A){return A.host===null||A.host===""||A.scheme==="file"}var s=0,o="",w="",D=null,i,lA=!1,uA=!1,G=!1,E;function H(A,e,t,n){e||(A=(function(l){let a=0,h=l.length;for(;a<h&&!(l.charCodeAt(a)>32);++a);for(;h>a&&!(l.charCodeAt(h-1)>32);--h);return l.substring(a,h)})(A)),A=(function(l){let a=0;for(;a<l.length;a++){let f=l.charCodeAt(a);if(f===9||f===10||f===13)break}if(a===l.length)return l;let h=l.slice(0,a);for(;a<l.length;a++){let f=l.charCodeAt(a);f!==9&&f!==10&&f!==13&&(h+=l[a])}return h})(A),s=0,o=A,w="",D=t||null,i=e||{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,opaquePath:!1},lA=!1,uA=!1,G=!1,E=n||0;let r=Ke;switch(n){case 3:case 4:r=aA;break;case 5:r=qA;break;case 6:r=K;break;case 7:r=Q;break;case 8:r=$}return r(c(A,s))!==1?i:null}function d(A,e){return s+=s===A?B(e):1,s<=o.length}function c(A,e){return e<A.length?A.codePointAt(e):void 0}function B(A){return A!=null&&A>65535?2:1}function ue(A){return A==null?"":A<=65535?String.fromCharCode(A):String.fromCodePoint(A)}var Ke=A=>{let e=s;if(A!=null&&(A>=65&&A<=90||A>=97&&A<=122)){let t=s+1;for(A=o.charCodeAt(t);A===43||A===45||A===46||A>=65&&A<=90||A>=97&&A<=122||A>=48&&A<=57;)t++,A=o.charCodeAt(t);return w=o.slice(s,t).toLowerCase(),s=t,Ye(t<o.length?A:void 0)}else return E?1:(--s,d(e,A)?ce(c(o,s)):0)},Ye=A=>{let e=s;if(A===58){if(E){if(C(i.scheme)!==C(w))return 0;if((le(i)||i.port!==null)&&w==="file")return 0;if(i.scheme==="file"&&i.host==="")return 0}return i.scheme=w,E?(i.port===oe(i.scheme)&&(i.port=null),0):(w="",i.scheme==="file"?d(e,A)?NA(c(o,s)):0:C(i.scheme)&&D!==null&&D.scheme===i.scheme?d(e,A)?Ve(c(o,s)):0:C(i.scheme)?d(e,A)?Je(c(o,s)):0:c(o,s+1)===47?(s++,d(e,A)?Xe(c(o,s)):0):(i.path=[""],i.opaquePath=!0,d(e,A)?fe(c(o,s)):0))}else return E?1:(w="",s=-1,d(e,A)?ce(c(o,s)):0)},ce=A=>{let e=s;return D===null||D.opaquePath&&A!==35?1:D.opaquePath&&A===35?(i.scheme=D.scheme,i.path=D.path.slice(),i.opaquePath=D.opaquePath,i.query=D.query,i.fragment="",d(e,A)?$(c(o,s)):0):D.scheme==="file"?(s--,d(e,A)?NA(c(o,s)):0):(s--,d(e,A)?kA(c(o,s)):0)},Ve=A=>{let e=s;return A===47&&c(o,s+1)===47?(++s,d(e,A)?hA(c(o,s)):0):(s--,d(e,A)?kA(c(o,s)):0)},Xe=A=>{let e=s;return A===47?d(e,A)?J(c(o,s)):0:(s--,d(e,A)?x(c(o,s)):0)},kA=A=>{let e=s;return i.scheme=D.scheme,A===47||C(i.scheme)&&A===92?d(e,A)?ZA(c(o,s)):0:(i.username=D.username,i.password=D.password,i.host=D.host,i.port=D.port,i.path=D.path.slice(),i.query=D.query,A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?$(c(o,s)):0):A!=null?(i.query=null,i.path.pop(),s--,d(e,A)?x(c(o,s)):0):d(e,A)?kA(c(o,s)):0)},ZA=A=>{let e=s;return C(i.scheme)&&(A===47||A===92)?d(e,A)?hA(c(o,s)):0:A===47?d(e,A)?J(c(o,s)):0:(i.username=D.username,i.password=D.password,i.host=D.host,i.port=D.port,s--,d(e,A)?x(c(o,s)):0)},Je=A=>{let e=s;return A===47&&c(o,s+1)===47?s++:s--,d(e,A)?hA(c(o,s)):0},hA=A=>{let e=s;return A!==47&&A!==92?(s--,d(e,A)?J(c(o,s)):0):d(e,A)?hA(c(o,s)):0},J=A=>{let e=s;if(A!=null&&A!==64&&A!==35&&A!==47&&A!==63&&(A!==92||!C(i.scheme))){let t=s+B(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===64||n===35||n===47||n===63||n===92&&C(i.scheme))break;t+=B(n)}return w+=o.slice(s,t),s=t-1,d(e,A)?J(c(o,s)):0}if(A===64){lA&&(w=`%40${w}`),lA=!0;for(let t=0;t<w.length;t++){let n=w.codePointAt(t);if(n===58&&!uA){uA=!0;continue}let r=te(n,cA);uA?i.password+=r:i.username+=r,n!=null&&n>65535&&t++}return w="",d(e,A)?J(c(o,s)):0}else return A==null||A===35||A===47||A===63||A===92&&C(i.scheme)?lA&&w===""?1:(s-=w.length+1,w="",d(e,A)?aA(c(o,s)):0):(w+=ue(A),d(e,A)?J(c(o,s)):0)},aA=A=>{let e=s;if(E&&i.scheme==="file")return s--,d(e,A)?LA(c(o,s)):0;if(A!=null&&A!==58&&A!==35&&A!==47&&A!==63&&(A!==92||!C(i.scheme))){let t=s+B(A);for(A===91?G=!0:A===93&&(G=!1);t<o.length;){let n=c(o,t);if(n==null||!G&&n===58||n===35||n===47||n===63||n===92&&C(i.scheme))break;n===91?G=!0:n===93&&(G=!1),t+=B(n)}return w+=o.slice(s,t),s=t-1,d(e,A)?aA(c(o,s)):0}else if(A===58&&!G){if(w===""||E===4)return 1;let t=EA(w,!C(i.scheme));return t===null?1:(i.host=TA(t),w="",d(e,A)?qA(c(o,s)):0)}else if(A==null||A===35||A===47||A===63||A===92&&C(i.scheme)){if(s--,C(i.scheme)&&w==="")return 1;if(E&&w===""&&(le(i)||i.port!==null))return 1;let t=EA(w,!C(i.scheme));return t===null?1:(i.host=TA(t),w="",E?0:d(e,A)?K(c(o,s)):0)}else return w+=ue(A),d(e,A)?aA(c(o,s)):0},qA=A=>{let e=s;if(A!=null&&A>=48&&A<=57){let t=s+1;for(;t<o.length;){let n=o.charCodeAt(t);if(n<48||n>57)break;t++}return w+=o.slice(s,t),s=t-1,d(e,A)?qA(c(o,s)):0}else if(E||A==null||A===35||A===47||A===63||A===92&&C(i.scheme)){if(w!==""){let t=parseInt(w,10);if(t>65535)return 1;if(i.port=t===oe(i.scheme)?null:t,w="",E)return 0}return E?1:(s--,d(e,A)?K(c(o,s)):0)}else return 1};function ae(A,e){let t=A.length-e;if(t<2)return!1;if(re(c(A,e),c(A,e+1))){if(t===2)return!0;{let n=c(A,e+2);return n===47||n===92||n===63||n===35}}else return!1}var NA=A=>{let e=s;return i.scheme="file",i.host="",A===47||A===92?d(e,A)?We(c(o,s)):0:D?.scheme==="file"?(i.host=D.host,i.path=D.path.slice(),i.opaquePath=D.opaquePath,i.query=D.query,A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?$(c(o,s)):0):A!=null?(i.query=null,ae(o,s)?i.path=[]:ie(i),s--,d(e,A)?x(c(o,s)):0):d(e,A)?NA(c(o,s)):0):(s--,d(e,A)?x(c(o,s)):0)},We=A=>{let e=s;return A===47||A===92?d(e,A)?LA(c(o,s)):0:(D!==null&&D.scheme==="file"&&(!ae(o,s)&&(function(n){if(n.length===2){let r=n.codePointAt(0),u=n.codePointAt(1);return(r>=65&&r<=90||r>=97&&r<=122)&&u===58}else return!1})(D.path[0])&&i.path.push(D.path[0]),i.host=D.host),s--,d(e,A)?x(c(o,s)):0)},LA=A=>{let e=s;if(A!=null&&A!==47&&A!==92&&A!==63&&A!==35){let t=s+B(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||n===92||n===63||n===35)break;t+=B(n)}return w+=o.slice(s,t),s=t-1,d(e,A)?LA(c(o,s)):0}else if(A==null||A===47||A===92||A===63||A===35){if(s--,!E&&se(w))return d(e,A)?x(c(o,s)):0;if(w==="")return i.host="",E?0:d(e,A)?K(c(o,s)):0;{let t=EA(w,!C(i.scheme));return t===null?1:(t==="localhost"&&(t=""),i.host=TA(t),w="",E?0:d(e,A)?K(c(o,s)):0)}}return 1},K=A=>{let e=s;return C(i.scheme)?(A!==92&&A!==47&&s--,d(e,A)?x(c(o,s)):0):!E&&A===63?(i.query="",d(e,A)?Q(c(o,s)):0):!E&&A===35?(i.fragment="",d(e,A)?$(c(o,s)):0):A!=null?(A!==47&&s--,d(e,A)?x(c(o,s)):0):(E&&i.host===null&&i.path.push(""),d(e,A)?K(c(o,s)):0)},x=A=>{let e=s;if(A!=null&&A!==47&&(!C(i.scheme)||A!==92)&&(E||A!==63&&A!==35)){let t=s+B(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||C(i.scheme)&&n===92||!E&&(n===63||n===35))break;t+=B(n)}w+=U(o.slice(s,t),IA),s=t,A=c(o,t)}if(A==null||A===47||C(i.scheme)&&A===92||!E&&(A===63||A===35)){let t=C(i.scheme)&&A===92;return(function(r){switch(r){case"..":case"%2e.":case"%2E.":case".%2e":case".%2E":case"%2e%2e":case"%2E%2e":case"%2e%2E":case"%2E%2E":return!0;default:return!1}})(w)?(ie(i),A!==47&&!t&&i.path.push("")):JA(w)&&A!==47&&!t?i.path.push(""):JA(w)||(i.scheme==="file"&&i.path.length===0&&se(w)&&(w=`${w[0]}:`),i.path.push(w)),w="",A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?$(c(o,s)):0):d(e,A)?x(c(o,s)):0}else return w+=te(A,IA),d(e,A)?x(c(o,s)):0},fe=A=>{let e=s;if(A===63)return i.query="",d(e,A)?Q(c(o,s)):0;if(A===35)return i.fragment="",d(e,A)?$(c(o,s)):0;if(A!=null){let t=s+B(A);for(;t<o.length;){let r=c(o,t);if(r===63||r===35)break;t+=B(r)}let n=o.slice(s,t);if(t<o.length&&n.charCodeAt(n.length-1)===32?i.path[0]+=U(n.slice(0,-1),AA)+"%20":i.path[0]+=U(n,AA),s=t,(A=c(o,t))===63)return i.query="",d(e,A)?Q(c(o,s)):0;if(A===35)return i.fragment="",d(e,A)?$(c(o,s)):0}return d(e,A)?fe(c(o,s)):0},Q=A=>{let e=s,t=s;if(A!=null){if(E)t=o.length;else{let r=o.indexOf("#",s);t=r===-1?o.length:r}let n=C(i.scheme)?Ee:OA;i.query+=U(o.slice(s,t),n)}return s=t,c(o,t)===35&&!E?(i.fragment="",d(e,A)?$(c(o,s)):0):d(e,A)?Q(c(o,s)):0},$=A=>{let e=s;return A!=null&&(i.fragment+=U(o.slice(s),Ce),s=o.length),d(e,A)?$(c(o,s)):0};function vA(A){if(A.opaquePath)return A.path[0];{let e="";for(let t of A.path)e+=`/${t}`;return e}}function he(A){switch(A.scheme){case"blob":{let e=H(vA(A),null,null,0);return e===null||e.scheme!=="http"&&e.scheme!=="https"?"null":he(e)}case"ftp":case"http":case"https":case"ws":case"wss":return(function(t){let n=`${t.scheme}://`;return n+=t.host,t.port!==null&&(n+=`:${t.port}`),n})(A);default:return"null"}}var S=Symbol("URLImpl"),eA=class A{constructor(e,t){if(e===void 0&&t===void 0)throw new TypeError('The "url" argument must be specified.');e=I(e),t!=null&&(t=I(t));let n=null;if(t!=null&&(n=H(t,null,null,0),n==null))throw new TypeError(`Invalid base URL: ${t}`);let r=H(e,null,n,0);if(r==null)throw new TypeError(`Invalid URL: ${e}`);this[S]={url:r,query:null}}static createObjectURL(e){throw new TypeError("URL.createObjetURL is unsupported")}static revokeObjectURL(e){}static parse(e,t){e=I(e),t!==void 0&&(t=I(t));try{return new A(e,t)}catch{return null}}static canParse(e,t){e=I(e),t!==void 0&&(t=I(t));let n=null;return t!=null&&(n=H(t,null,null,0),n==null)?!1:H(e,null,n,0)!=null}get href(){return(function(t){let n=`${t.scheme}:`;return t.host!==null&&(n+="//",(t.username!==""||t.password!=="")&&(n+=t.username,t.password!==""&&(n+=`:${t.password}`),n+="@"),n+=t.host,t.port!==null&&(n+=`:${t.port}`)),t.host===null&&!t.opaquePath&&t.path.length>1&&t.path[0]===""&&(n+="/."),n+=vA(t),t.query!==null&&(n+=`?${t.query}`),t.fragment!==null&&(n+=`#${t.fragment}`),n})(this[S].url)}set href(e){let t=H(e=I(e),null,null,0);if(t==null)throw new TypeError(`Invalid URL: ${e}`);this[S].url=t,this[S].query&&PA(this[S].query,t.query)}get origin(){return he(this[S].url)}get protocol(){return`${this[S].url.scheme}:`}set protocol(e){H(`${e=I(e)}:`,this[S].url,null,2)}get username(){return this[S].url.username}set username(e){e=I(e),mA(this[S].url)||(function(n,r){n.username=U(r,cA)})(this[S].url,e)}get password(){return this[S].url.password}set password(e){e=I(e),mA(this[S].url)||(function(n,r){n.password=U(r,cA)})(this[S].url,e)}get host(){let{url:e}=this[S];return e.host==null?"":e.port==null?e.host:`${e.host}:${e.port}`}set host(e){e=I(e),this[S].url.opaquePath||H(e,this[S].url,null,3)}get hostname(){let{url:e}=this[S];return e.host!=null?e.host:""}set hostname(e){e=I(e),this[S].url.opaquePath||H(e,this[S].url,null,4)}get port(){let{url:e}=this[S];return e.port!=null?`${e.port}`:""}set port(e){e=I(e);let{url:t}=this[S];mA(t)||(e?H(e,t,null,5):t.port=null)}get pathname(){return vA(this[S].url)}set pathname(e){e=I(e);let{url:t}=this[S];t.opaquePath||(t.path=[],H(e,t,null,6))}get search(){let{url:e}=this[S];return e.query?`?${e.query}`:""}set search(e){e=I(e);let{url:t,query:n}=this[S];if(!e)t.query=null,n&&PA(n,null);else{let r=e[0]==="?"?e.substring(1):e;t.query="",H(r,t,null,7),n&&PA(n,t.query)}}get searchParams(){let e=this[S],t=e.query;return t==null&&(t=e.query=(function(r,u){let l=new fA;return l[b].url=r,l[b].serialized=u==null,u&&(l[b].list=RA(u)),l})(this,e.url.query)),t}get hash(){let{url:e}=this[S];return e.fragment?`#${e.fragment}`:""}set hash(e){e=I(e);let{url:t}=this[S];if(!e)t.fragment=null;else{let n=e[0]==="#"?e.substring(1):e;t.fragment="",H(n,t,null,8)}}toJSON(){return this.href}toString(){return this.href}};Object.defineProperty(eA.prototype,Symbol.toStringTag,{value:"URL",configurable:!0});var b=Symbol("URLSearchParamsImpl"),Ze=Symbol.dispose||Symbol.for("dispose");function PA(A,e){e?A[b].list=RA(e):A[b].list.length=0,A[b].serialized=e==null}function oA(A){if(A.url){let e=bA(A.list);(function(n,r){n[S].url.query=r})(A.url,e||null),A.serialized=!0}}var At=typeof Iterator<"u"?Iterator:Object,Z=class extends At{constructor(e,t){super(),this[b]={ptr:e,map:t,index:0}}next(){let e=this[b];return e.index<e.ptr.list.length?{value:e.map(e.ptr.list[e.index++]),done:!1}:{value:void 0,done:!0}}[Symbol.iterator](){return this}[Ze](){}},fA=class{constructor(e){let t=this[b]={list:[],url:null,serialized:!0},n;if(Array.isArray(e))for(let r=0;r<e.length;r++)t.list.push(GA(e[r]));else if((n=Ae(e))!=null){let r;for(;!(r=yA(n.next())).done;)t.list.push(GA(r.value))}else if((typeof e=="object"||typeof e=="function")&&e!=null){let r=Object.keys(e);for(let u=0;u<r.length;u++){let l=r[u],a=Ie(l),h=I(e[l]),f=t.list.find(g=>g[0]===a);f?f[1]=h:t.list.push([a,h])}}else if(e!==void 0){let r=I(e);r=r[0]==="?"?r.substring(1):r,t.list=RA(r)}}get size(){return this[b].list.length}append(e,t){e=I(e),t=I(t),this[b].list.push([e,t]);let n=this[b];n.url&&n.serialized?(function(u,l){let a=u[S].url;a.query=a.query?`${a.query}&${l}`:l})(n.url,bA([[e,t]])):oA(n)}delete(e,t){e=I(e),t=t!=null?I(t):void 0;let{list:n}=this[b],r=0;for(;r<n.length;)n[r][0]===e&&(t==null||n[r][1]===t)?n.splice(r,1):r++;oA(this[b])}get(e){e=I(e);let{list:t}=this[b];for(let n=0;n<t.length;n++)if(t[n][0]===e)return t[n][1];return null}getAll(e){e=I(e);let t=[],{list:n}=this[b];for(let r=0;r<n.length;r++)n[r][0]===e&&t.push(n[r][1]);return t}has(e,t){e=I(e),t=t!=null?I(t):void 0;let{list:n}=this[b];for(let r=0;r<n.length;r++)if(n[r][0]===e&&(t==null||n[r][1]===t))return!0;return!1}set(e,t){e=I(e),t=I(t);let{list:n}=this[b],r=!1,u=!1,l=0;for(;l<n.length;)n[l][0]===e?r?(n.splice(l,1),u=!0):(r=!0,n[l][1]!==t&&(n[l][1]=t,u=!0),l++):l++;r||(n.push([e,t]),u=!0),u&&oA(this[b])}sort(){this[b].list.sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0),oA(this[b])}forEach(e,t){if(typeof e!="function")throw new TypeError('The "callback" argument must be of type function');let{list:n}=this[b];for(let r=0;r<n.length;r++)e.call(t,n[r][1],n[r][0],this)}entries(){return new Z(this[b],e=>e)}keys(){return new Z(this[b],e=>e[0])}values(){return new Z(this[b],e=>e[1])}toString(){return bA(this[b].list)}[Symbol.iterator](){return this.entries()}};Object.defineProperty(fA.prototype,Symbol.toStringTag,{value:"URLSearchParams",configurable:!0});function de(A){let e,t=()=>typeof e=="string"?e:e?.accessToken,n=0,r,u=new Map,l=()=>{for(let p of[...u.keys()])try{p()}catch{}};function a(p){let m=++n;r=void 0,e=void 0;for(let P of[...u.values()])try{P?.()}catch{}m===n&&(e=p,l())}let h=()=>a();function f(p,m=!1){let P=$A.safeParse(p);if(!P.success||m&&Date.parse(P.data.expiresAt)<=Date.now()||Date.parse(P.data.refreshExpiresAt)<=Date.now()||Date.parse(P.data.refreshExpiresAt)<Date.parse(P.data.expiresAt))throw new y("INVALID_RESPONSE","Invalid customer session credentials");return P.data}async function g(){if(r)return r;let p=typeof e=="object"?e:void 0,m=n;if(!p||Date.parse(p.refreshExpiresAt)<=Date.now())throw p&&h(),new y("UNAUTHENTICATED","Customer authentication is required",401);let P=(async()=>{try{let k=await A(p.refreshToken);if(m!==n)throw new y("IDENTITY_CHANGED","Customer identity changed during refresh");let Y=f(k,!0);if(Y.customerId!==p.customerId||Y.sessionId!==p.sessionId)throw new y("SCOPE_MISMATCH","Refresh changed the customer session");return e=Y,{...Y}}catch(k){throw m!==n?new y("IDENTITY_CHANGED","Customer identity changed during refresh"):(k instanceof y&&k.status===401&&h(),k)}})();r=P;try{return await P}finally{r===P&&(r=void 0)}}return{identify(p){let m=typeof p=="string"?p:f(p),P=typeof m=="string"?m:m.accessToken;if(!P.trim()||/\s/.test(P)||P.length>4096)throw new y("INVALID_TOKEN","A server-issued token is required");a(m)},reset:h,subscribeIdentity(p,m){return u.set(p,m),()=>{u.delete(p)}},access(){let p=typeof e=="object"?e:void 0;if(p&&Date.parse(p.expiresAt)<=Date.now()+3e4){let P=n;return g().then(()=>{let k=t();if(P!==n||!k)throw new y("IDENTITY_CHANGED","Customer identity changed during refresh");return k})}let m=t();if(!m)throw new y("NOT_IDENTIFIED","Identify a customer session before making a request");return m},peek:t,snapshot:()=>typeof e=="object"?{...e}:void 0,refresh:g}}var pe=Symbol("IndianaNoContent");function gt(A,e,t=eA){let n=A.configuration?.scope,r=A.scope??(n&&{projectId:n.projectId,environment:n.environment}),u=r?sA.parse(r):void 0;if(u&&n&&(u.projectId!==n.projectId||u.environment!==n.environment))throw new y("SCOPE_MISMATCH","Configuration belongs to another App/environment");let l=new t(A.baseUrl??FA);if(l.username||l.password||l.search||l.hash)throw new y("INVALID_URL","baseUrl must not contain credentials, query, or fragment");if(l.protocol!=="https:"&&!(l.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(l.hostname)))throw new y("INVALID_URL","Use HTTPS, or HTTP on localhost during development");let a=A.fetch??globalThis.fetch.bind(globalThis),h=A.timeoutMs??1e4;if(!Number.isFinite(h)||h<1||h>12e4)throw new y("INVALID_TIMEOUT","timeoutMs must be between 1 and 120000");let f=!1,g=0,p=null,m=new Set,P=A.session??de(async v=>{let T=await tA("customer-sessions/refresh",{},"POST",{},v);if(!T||typeof T!="object")throw new y("INVALID_RESPONSE","Invalid refresh response");let{requestId:_,scope:j,...V}=T;return V});function k(){g+=1,p=null;for(let v of m)v.abort();m.clear()}let Y=P.subscribeIdentity(k);function ge(){f||P.reset()}async function tA(v,T={},_="POST",j={},V){let N=j.installationDetach===!0;if(N&&(v!=="push/installations/detach"||_!=="POST"))throw new y("INVALID_REQUEST","Installation authority only detaches this installation");if(!V&&!N)throw new y("NOT_IDENTIFIED","Call identify with a server-issued customer token first");let X=g,L=new AbortController;N||m.add(L);let nA=()=>!N&&X!==g?new y("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):new y("TIMEOUT","The request timed out"),dA,Pe=new Promise((R,q)=>{dA=()=>q(nA()),L.signal.addEventListener("abort",dA,{once:!0})}),ye=setTimeout(()=>L.abort(),j.timeoutMs??h),De=async()=>{let R=await a(`${l.href.replace(/\/$/,"")}/api/v1/${v}`,{method:_,headers:{...j.headers,"Content-Type":"application/json",...N?{}:{Authorization:`Bearer ${V}`},[pA]:gA.current,[QA]:zA.version,...u?{"X-Indiana-Project":u.projectId,"X-Indiana-Environment":u.environment}:{}},body:_==="POST"?JSON.stringify(T):void 0,signal:L.signal,credentials:"omit",cache:_==="POST"&&typeof document<"u"&&v==="funnels"&&T!==null&&typeof T=="object"&&"operation"in T&&(T.operation==="start"||T.operation==="shown")?"default":"no-store",redirect:"error",...j.keepalive?{keepalive:!0}:{}});if(L.signal.aborted)throw nA();let q;try{q=R.status===204?pe:await R.json()}catch{throw L.signal.aborted?nA():new y(R.ok?"INVALID_RESPONSE":"HTTP_ERROR","The gateway returned an unreadable response",R.status,R.headers.get("X-Request-Id")??void 0)}if(L.signal.aborted)throw nA();if(!N&&X!==g)throw new y("IDENTITY_CHANGED","Customer identity changed while the request was in flight");if(!R.ok){let O=MA.safeParse(et(q)),z=O.success&&(!jA.safeParse(O.data.error.code).success||xA(O.data.error.code,R.status)),HA=z?O.data.error.code:"HTTP_ERROR",_A=UA(HA,R.status,{retryAfter:R.headers.get("Retry-After"),recovery:z?O.data.error.recovery:void 0,reason:z?O.data.error.reason:void 0});throw new y(HA,z?O.data.error.message:"The request failed",R.status,R.headers.get("X-Request-Id")??(O.success?O.data.requestId:void 0),{..._A,...O.success&&O.data.error.retryable===!1?{retryable:!1}:{},..._A.retryAfterSeconds===void 0&&O.success&&O.data.error.retryAfterSeconds!==void 0?{retryAfterSeconds:O.data.error.retryAfterSeconds}:{}})}if(R.headers.get(pA)!==gA.current)throw new y("PROTOCOL_MISMATCH","Response protocol does not match this SDK");if(u&&q!==pe){let O=q&&typeof q=="object"&&"scope"in q?q:q&&typeof q=="object"&&"configuration"in q?q.configuration:null;if(!O||typeof O!="object"||!("scope"in O))throw new y("INVALID_RESPONSE","Response is missing its App/environment scope");let z=sA.safeParse(O.scope);if(!z.success||z.data.projectId!==u.projectId||z.data.environment!==u.environment)throw new y("SCOPE_MISMATCH","Response scope does not match this SDK instance")}let rA=R.headers.get("X-Indiana-Telemetry-Subject");if(rA){if(!/^[a-f0-9]{64}$/.test(rA))throw new y("INVALID_RESPONSE","Invalid telemetry identity");p!==rA&&(p=rA,e?.(p))}return q};try{return await Promise.race([De(),Pe])}catch(R){throw!N&&X!==g?new y("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):R instanceof y?R:new y(L.signal.aborted?"TIMEOUT":"NETWORK_ERROR",L.signal.aborted?"The request timed out":"Unable to read the response")}finally{clearTimeout(ye),L.signal.removeEventListener("abort",dA),m.delete(L)}}function we(v,T={},_="POST",j={}){if(f)return Promise.reject(new y("CLOSED","SDK client was destroyed"));if(j.installationDetach)return tA(v,T,_,j);let V=g;try{let N=P.access(),X=L=>{if(V!==g)throw new y("IDENTITY_CHANGED","Customer identity changed before dispatch");return tA(v,T,_,j,L)};return typeof N=="string"?X(N):N.then(X)}catch(N){return Promise.reject(N)}}let me=Object.assign(we,{captureIdentity(){let v=g,T=f,_=!!P.peek();return()=>{if(T)throw new y("CLOSED","SDK client was destroyed");if(!_)throw new y("NOT_IDENTIFIED","Call identify with a server-issued customer token first");if(v!==g)throw new y("IDENTITY_CHANGED","Customer identity changed before dispatch")}}});return{session:P,requestWithCredential(v,T,_,j={}){return f?Promise.reject(new y("CLOSED","SDK client was destroyed")):tA(v,T,"POST",j,_)},subjectKey:()=>p,identify(v){if(f)throw new y("CLOSED","SDK client was destroyed");if(u&&typeof v=="object"&&"scope"in v){let T=sA.safeParse(v.scope);if(!T.success||T.data.projectId!==u.projectId||T.data.environment!==u.environment)throw new y("SCOPE_MISMATCH","Customer session belongs to another App/environment")}P.identify(v)},reset:ge,dispose(){f||(f=!0,Y(),k())},request:me}}function et(A){if(!A||typeof A!="object"||!("error"in A))return A;let e=A.error;if(!e||typeof e!="object"||!("reason"in e)||BA.safeParse(e.reason).success)return A;let{reason:t,...n}=e;return{...A,error:n}}export{eA as a,gt as b};
|
package/dist/chunk-U6E6CM7Z.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as rn}from"./chunk-JN6JEKWN.js";import{h as ue,i as se,r as nn,s as pe}from"./chunk-THMGTRXP.js";import{c as Be,d as Ke,e as J,l as en}from"./chunk-NAZU3EEJ.js";import{$ as U,D as Qe,R as Ye,W as Ze,X as We,Y as $,Z as Xe,_ as de,a as j,b as qe,c as Me,d as je,e as G,f as Ge,g as Ue,i as X,w as ee,x as ze,z as Je}from"./chunk-R23IGK5U.js";import{b as on}from"./chunk-EHDHWYVJ.js";import{b as ne}from"./chunk-U2R7MG3J.js";import{a as W}from"./chunk-VYFSRHXM.js";import{D as Te,L as ae,U as L,V as De,W as Le,ja as $e,ka as le,la as He,ma as ce,t as Oe,z as Ae}from"./chunk-N7YXDSQL.js";import{a as f}from"./chunk-X4W22IH6.js";import{h as D}from"./chunk-R4FDIYMN.js";import{b as tn}from"./chunk-UHQGO6OR.js";import{b as n}from"./chunk-VF6QMMEA.js";import{c as _e,d as ke,e as Ve,f as z}from"./chunk-7QL4GF4C.js";import{a as Pe,b as Ne}from"./chunk-BID4UGWB.js";function an(e){return En({...e,namespace:"commands",identity:[e.runToken]})}function En(e){let t,u,r=()=>new f("COMMAND_STORAGE_INVALID","Durable command storage is unavailable"),i=Promise.resolve().then(async()=>{if(t=e.storage??globalThis.localStorage,u=e.locks??globalThis.navigator?.locks,!t||!u||!globalThis.crypto?.subtle)throw r();let d=new TextEncoder().encode(JSON.stringify([new URL(e.baseUrl??tn).href,...e.identity])),a=new Uint8Array(await crypto.subtle.digest("SHA-256",d));return`indiana.funnel.${e.namespace}.v1.`+Array.from(a,o=>o.toString(16).padStart(2,"0")).join("")});i.catch(()=>{});async function p(d){try{let a=await i;return await u.request(a,{mode:"exclusive"},()=>d(a))}catch(a){throw a instanceof f?a:r()}}function c(d){let a=t.getItem(d);if(a===null)return{revision:0,entry:null};if(a.length>1048576)throw r();let o=JSON.parse(a);if(!o||typeof o!="object"||!("revision"in o)||!("entry"in o)||!Number.isSafeInteger(o.revision)||Number(o.revision)<0)throw r();return{revision:Number(o.revision),entry:o.entry}}return{read:()=>p(c),write:(d,a)=>p(o=>{if(c(o).revision!==d)return null;if(!Number.isSafeInteger(d+1))throw r();let y=JSON.stringify({revision:d+1,entry:a});if(y.length>1048576)throw r();return t.setItem(o,y),d+1})}}var un=n.strictObject({type:n.literal("funnel"),id:n.uuid(),versionId:n.uuid()});var q=n.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/),Cn=n.enum(["running","waiting","completed","closed","ineligible","failed"]),Pn=n.discriminatedUnion("type",[Qe,n.strictObject({type:n.literal("wait"),receiptId:n.uuid(),kind:n.enum(["timer","event","operation"]),deadline:n.iso.datetime({offset:!0}).nullable(),eventName:q.optional()}),n.strictObject({type:n.literal("open_url"),receiptId:n.uuid(),url:Ze,openIn:We}),n.strictObject({type:n.literal("event"),receiptId:n.uuid(),event:q})]),Nn={id:q,presentation:Te,outputs:n.array(q).max(250),inputs:ce,values:n.record(n.string(),L).optional(),offeringKey:j.optional(),capabilities:Oe,customerData:Ae,dataCursors:n.record(q,$e.nullable())},On=n.strictObject({...Nn,content:n.strictObject({type:n.literal("document"),document:ae})}),me=n.strictObject({id:n.uuid(),source:un,revision:n.number().int().nonnegative(),visit:n.number().int().nonnegative(),nodeId:q,nodeType:n.enum(["entry","screen","condition","split","feature","action","external_page","wait","end","offering","coupon","coupons","output"]),status:Cn,stopped:n.boolean(),canBack:n.boolean(),authenticated:n.boolean(),locale:n.string().min(1).max(35),answers:le,parameters:He,variables:n.record(n.string(),L),output:L.nullable(),screen:On.nullable(),paywall:n.strictObject({receiptId:n.uuid(),resolution:n.union([nn,pe]),quote:ue.nullable(),operation:se.nullable(),purchaseRequestId:n.uuid().nullable(),selectionGeneration:n.number().int().nonnegative().optional(),canReselect:n.boolean().optional()}).nullable(),instruction:Pn.nullable(),pendingRequest:n.strictObject({requestId:n.uuid(),authenticationRequired:n.boolean()}).nullable(),runExpiresAt:n.iso.datetime({offset:!0}),credentialExpiresAt:n.iso.datetime({offset:!0}).nullable()}),An=n.strictObject({scope:D,run:me,settlement:n.strictObject({requestId:n.uuid(),state:n.enum(["pending","unknown","settled"]),operationId:n.uuid().nullable(),receiptId:n.uuid().nullable().optional()}).optional(),purchase:n.strictObject({receiptId:n.uuid(),quote:ue.nullable(),operation:se.nullable(),canReselect:n.boolean().optional()}).optional(),review:n.strictObject({activeOperationId:n.uuid().nullable(),pages:n.array(n.strictObject({receiptId:n.uuid(),nodeId:q,visit:n.number().int().nonnegative()})).max(100),page:n.strictObject({receiptId:n.uuid(),nodeId:q,visit:n.number().int().nonnegative(),document:ae,answers:le,inputs:ce,values:n.record(n.string(),L).optional()}).nullable(),coupons:n.array(n.strictObject({grantId:n.uuid(),status:n.enum(["issued","reserved","redeemed","expired","revoked","unknown"]),expiresAt:n.string().nullable()})).max(100),purchases:n.array(n.strictObject({receiptId:n.uuid(),operationId:n.uuid(),status:n.enum(["pending","complete","cancelled","failed","unknown"])})).max(100)}).optional(),runToken:n.string().regex(/^gg_fr_[A-Za-z0-9_-]{43}$/).optional(),customerId:n.uuid().optional()}),sn=An.extend({run:me.extend({paywall:me.shape.paywall.unwrap().extend({resolution:pe}).nullable()})});var ln="X-Indiana-Server-Key";var H=class extends Error{constructor(t){super(t),this.name="FunnelCalculationError"}};function fe(e,t,u){let r={},i,p,c,d="next",a;switch(e.type){case"entry":a=e.next;break;case"condition":{let o=e.cases.findIndex(g=>ke(t.attributes??{},g.condition,t.savedGroups??{}));d=o<0?"default":`case:${o}`,a=o<0?e.default:e.cases[o].target;break}case"feature":if(!Object.hasOwn(t.features??{},e.featureKey))throw new H("Required GB Feature is unavailable");i=z(e.featureKey,t),c=i.value,Object.assign(r,G(e,{value:c})),a=e.next;break;case"split":{let o=u[e.experimentId];if(!o)throw new H("Required GB Experiment is unavailable");if(p=Ve(o,t),c=p.value,d=p.inExperiment&&!p.passthrough&&typeof c=="string"?c:"notParticipating",a=d==="notParticipating"?e.notParticipating:e.routes[d],!a)throw new H("Experiment Variation has no published route");break}case"offering":{let o=e.configuration.source==="fixed"?e.configuration.versionId:z(e.configuration.featureKey,t).value;c={type:"offering_version",id:n.uuid().parse(o)},Object.assign(r,G(e,{value:c})),a=e.next;break}case"coupon":case"coupons":c=e.type==="coupons"?e.couponIds.map(o=>({type:"reward",id:o})):{type:"reward",id:e.couponId},Object.assign(r,G(e,{value:c})),a=e.next;break}return{port:d,target:a,projections:r,...c===void 0?{}:{value:c},...i?{feature:i}:{},...p?{experiment:p}:{}}}function cn(e,t,u){n.uuid().parse(e),n.number().int().nonnegative().parse(t);let r=Pe(Ne(new TextEncoder().encode(JSON.stringify([e,t,u])))).slice(0,32);return`${r.slice(0,8)}-${r.slice(8,12)}-5${r.slice(13,16)}-a${r.slice(17,20)}-${r.slice(20)}`}var Tn=n.strictObject({selector:n.string().min(1).max(2048),action:n.enum(["set","append","remove"]),attribute:n.string().min(1).max(128).refine(e=>["html","class","style","position","href","src","alt","title","id","role","hidden"].includes(e)||/^(aria|data)-[a-z0-9_-]+$/.test(e)),value:n.string().max(5e4).optional(),parentSelector:n.string().max(2048).optional(),insertBeforeSelector:n.string().max(2048).optional()}),_n=n.strictObject({variation:n.string().min(1).max(128),description:n.string().max(2e3).default(""),css:n.string().max(1e5).default(""),js:n.string().max(1e5).default(""),domMutations:n.array(Tn).max(200).default([]),iam:ze.optional(),renderGuard:ee.optional()}),ge=_n.omit({variation:!0,description:!0,iam:!0}),kn=Be.omit({variations:!0,active:!0}).extend({changeId:n.string().regex(/^[a-f0-9]{64}$/),variations:n.tuple([ge,ge]).rest(ge).refine(e=>e.length<=20)}),dn=n.strictObject({trackExposures:n.boolean(),environmentId:n.uuid(),generation:n.string().regex(/^[a-f0-9]{64}$/),experiments:n.array(kn).max(100),savedGroups:Ke});var Q=n.string().regex(/^[a-f0-9]{64}$/),qt=n.strictObject({iam:Q,executionContracts:n.union([n.tuple([n.literal("funnel-run/1")]),n.tuple([n.literal("funnel-process/1")])]).default(["funnel-run/1"])}),Vn=n.strictObject({release:Q,render:ee,button:n.strictObject({selector:n.string().min(1).max(512),elementKey:n.string().min(1).max(256),tag:n.enum(["button","a","input"])}).nullable()}),Mt=n.strictObject({scope:D.extend({environmentId:n.uuid()}),release:Q,validatedAt:n.iso.datetime({offset:!0}),validUntil:n.iso.datetime({offset:!0}),entries:n.array(n.strictObject({id:n.uuid(),funnelId:n.uuid(),versionId:n.uuid(),event:n.enum(["screen_enter","button_click"]),target:Vn})).max(4e3)}),jt=n.strictObject({operation:n.literal("entry_start"),funnelId:n.uuid(),versionId:n.uuid(),entryId:n.uuid(),release:Q,requestId:n.uuid(),locale:n.string().min(1).max(35).default("en")}),Gt=n.strictObject({scope:D,suppressed:n.literal(!0),reason:n.enum(["frequency","in_progress"]),retryAt:n.iso.datetime({offset:!0}).nullable()}),Ut=n.strictObject({experimentId:n.uuid(),splitNodeId:n.string().min(1).max(128)}),Dn=n.strictObject({experimentId:n.uuid(),experimentKey:n.string().min(1).max(128),variationKey:n.string().min(1).max(128),inExperiment:n.boolean(),generation:n.string().min(1).max(256)}),ye=n.strictObject({operation:n.literal("page_experiments"),release:Q,usedReceiptIds:n.array(n.uuid()).max(20).default([]),customerToken:n.string().regex(W).optional()}),pn=n.strictObject({scope:D,runId:n.uuid(),assignments:n.array(Dn.extend({receiptId:n.uuid()})).max(100),payload:dn});var B=n.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/),fn=n.strictObject({entry:B,nodes:n.array(n.strictObject({id:B,type:n.enum(["entry","screen","condition","split","feature","action","external_page","wait","end","offering","coupon","coupons","output"]),outputs:n.record(n.string(),B),writes:n.record(j,j),resources:n.strictObject({screenId:B.optional(),paywallVersionId:n.uuid().optional(),couponId:n.uuid().optional(),couponIds:n.array(n.uuid()).max(20).optional(),experimentId:n.uuid().optional(),featureKey:n.string().optional(),offeringVersionId:n.uuid().optional()})})).min(1).max(500)}),mn={scope:D,funnelId:n.uuid(),versionId:n.uuid(),evaluationRevision:n.number().int().nonnegative(),expiresAt:n.iso.datetime({offset:!0}).nullable(),topology:fn},te=n.discriminatedUnion("evaluationMode",[n.strictObject({...mn,evaluationMode:n.literal("local"),growth:J,conditions:n.record(B,n.array(n.strictObject({condition:Le,port:n.string()})))}),n.strictObject({...mn,evaluationMode:n.literal("remote")})]),Ln=te.options[0].extend({evaluation:n.strictObject({maxTransitions:n.number().int().min(1).max(1e4),variables:n.record(j,Me),outputSchema:qe,terminals:n.record(B,n.strictObject({outcome:n.enum(["completed","closed","ineligible","failed"]),output:Ye.nullable()}))})});function qn(e){return fn.parse({entry:e.graph.entry,nodes:e.graph.nodes.map(t=>{let u={},r={};switch(t.type){case"entry":case"feature":case"offering":case"coupon":case"coupons":u.next=t.next;break;case"screen":Object.assign(u,t.outputs),r.screenId=t.screenId;{let p=e.screens.find(c=>c.id===t.screenId);p?.type==="paywall"&&(r.paywallVersionId=p.paywallVersionId)}break;case"condition":t.cases.forEach((p,c)=>{u[`case:${c}`]=p.target}),u.default=t.default;break;case"split":Object.assign(u,t.routes),u.notParticipating=t.notParticipating,r.experimentId=t.experimentId;break;case"action":for(let p of["success","cancel","unavailable","failure"])u[p]=t[p];t.action.type==="claim_offer"&&t.action.coupon.source==="literal"&&t.action.coupon.value&&typeof t.action.coupon.value=="object"&&!Array.isArray(t.action.coupon.value)&&(r.couponId=n.uuid().parse(t.action.coupon.value.id));break;case"external_page":u.opened=t.opened,u.failed=t.failed;break;case"wait":t.wait.type==="duration"?u.elapsed=t.wait.elapsed:(u.received=t.wait.received,u.timeout=t.wait.timeout);break;case"end":case"output":break}t.type==="feature"&&(r.featureKey=t.featureKey),t.type==="offering"&&t.configuration.source==="feature"&&(r.featureKey=t.configuration.featureKey);let i=t.type==="output"?t.value:t.type==="end"?t.output:void 0;return i?.type==="feature"&&(r.featureKey=i.featureKey),t.type==="coupon"&&(r.couponId=t.couponId),t.type==="coupons"&&(r.couponIds=t.couponIds),t.type==="offering"&&t.configuration.source==="fixed"&&(r.offeringVersionId=t.configuration.versionId),{id:t.id,type:t.type,outputs:u,resources:r,writes:"writes"in t?t.writes??{}:{}}})})}function ve(e){let t=de.parse(e.document),u=e.evaluationMode==="local"?J.parse(e.payload):null;if(u&&(u.scope.projectId!==e.scope.projectId||u.scope.environment!==e.scope.environment))throw new Error("GB payload belongs to another App or environment");let r={scope:e.scope,funnelId:e.funnelId,versionId:e.versionId,evaluationRevision:e.evaluationRevision,evaluationMode:e.evaluationMode,expiresAt:u?.expiresAt??null,topology:qn(t)};return te.parse(e.evaluationMode==="remote"?r:{...r,growth:en(t,u),conditions:Object.fromEntries(t.graph.nodes.filter(i=>i.type==="condition").map(i=>[i.id,i.cases.map((p,c)=>({condition:p.condition,port:`case:${c}`}))]))})}function Wt(e){let t=ve(e);if(t.evaluationMode!=="local")throw new Error("Remote Funnel cannot disclose local rules");let u=de.parse(e.document);return Ln.parse({...t,evaluation:{maxTransitions:u.execution.maxTransitions,variables:u.variables,outputSchema:u.outputSchema,terminals:Object.fromEntries(u.graph.nodes.flatMap(r=>{let i=r.type==="end"?r.output:r.type==="output"?r.value:void 0;return r.type!=="end"&&r.type!=="output"?[]:i&&i.type!=="literal"&&i.type!=="feature"&&i.type!=="variable"?[]:[[r.id,{outcome:r.type==="end"?r.outcome:"completed",output:i??null}]]}))}})}var he=32,Mn=522240;function we(e){if(["entry","condition","feature","split","offering","coupon","coupons"].includes(e.type))return!0;if(e.type!=="end"&&e.type!=="output")return!1;let t=e.type==="end"?e.output:e.value;return t?.type!=="bundle"&&t?.type!=="selection"}var jn=n.strictObject({nodeId:n.string().min(1).max(64),visit:n.number().int().nonnegative(),revision:n.number().int().nonnegative()}),Ie=n.record(n.string(),L),Gn=n.strictObject({id:n.uuid(),nodeId:n.string().min(1).max(64),visit:n.number().int().nonnegative(),input:n.strictObject({schemaVersion:$.shape.schemaVersion,kind:$.shape.kind,selector:$.shape.selector,contract:$.shape.contract}),context:Ie,removed:n.array(n.string()).max(100),attributes:Ie,removedAttributes:n.array(n.string()).max(100),result:Xe,offeringVersionId:n.uuid().nullable(),events:n.strictObject({entered:n.string().regex(/^[1-9][0-9]{0,18}$/),decision:n.string().regex(/^[1-9][0-9]{0,18}$/).nullable()})}),or=n.strictObject({schemaVersion:n.literal(1),mode:n.enum(["local","remote"]),versionId:n.uuid(),generation:n.number().int().positive(),base:jn,context:Ie,steps:n.array(Gn).min(1).max(he)}).refine(e=>X(e)<=Mn,"Segment exceeds its byte budget");var Un=/^(parameters(?:\.|$)|answers(?:\.|$)|results(?:\.|$)|variables(?:\.|$)|funnelParticipantId$)/;function Y(e){return Array.isArray(e)?e.some(Y):!e||typeof e!="object"?!1:Object.entries(e).some(([t,u])=>t.startsWith("$")?["$and","$or","$nor","$not"].includes(t)&&Y(u):!Un.test(t))}function gn(e,t,u,r){if(e.executionContract!=="funnel-process/1"||r)return null;if(["offering","coupon","coupons"].includes(t.type)||t.type==="action"&&t.action.type!=="event"||t.type==="screen"&&(t.offering||e.screens.some(d=>d.id===t.screenId&&d.type==="paywall")))return"customer_required";let i=t.type==="end"?t.output:t.type==="output"?t.value:void 0;if(i&&["bundle","selection","offering"].includes(i.type)||t.type==="condition"&&t.cases.some(d=>Y(d.condition)))return"customer_required";let p=JSON.stringify([t,t.type==="screen"?e.screens.find(d=>d.id===t.screenId):null]);for(let[d,a]of Object.entries(e.variables))if(a.source.type==="attribute"&&a.source.key!=="funnelParticipantId"&&(p.includes(`variables.${d}`)||p.includes(JSON.stringify(d))))return"customer_required";if(t.type==="split"){let d=u.experiments?.[t.experimentId];if((d?.hashAttribute??"id")!=="funnelParticipantId"||Y(d?.condition)||d?.parentConditions?.length)return"customer_experiment_required"}let c=t.type==="feature"?t.featureKey:i?.type==="feature"?i.featureKey:void 0;return c&&u.features?.[c]?.rules?.some(d=>(d.hashAttribute??"id")!=="funnelParticipantId"||Y(d.condition)||d.parentConditions?.length)?"customer_experiment_required":null}var be=class extends Error{constructor(u,r){super(r);this.code=u;this.name="FunnelLocalCalculationError"}code},re=(e,t)=>new be(e,t),Bn=e=>({experiments:e.experiments,features:e.features});function xe(e,t=re){let u=new Map(e.topology.nodes.map(c=>[c.id,c])),r=_e(e.growth.savedGroups),i=Bn(e.growth);function p(c,d){if(!Object.hasOwn(e.growth.features,c))throw t("INVALID_RESPONSE","Required GB Feature is unavailable");return z(c,d).value}return{nodes:u,savedGroups:r,features:i.features,feature:p,evaluate(c,d){let a=u.get(c);if(!a)throw t("NOT_FOUND","Funnel node is unavailable");let o,g;if(a.type==="condition"){let I=e.conditions[a.id];if(!I)throw t("INVALID_RESPONSE","Local condition rules are unavailable");o=fe({id:a.id,name:a.id,type:"condition",cases:I.map(h=>({condition:h.condition,target:a.outputs[h.port]})),default:a.outputs.default},d,i.experiments).port}else if(a.type==="feature"){if(!a.resources.featureKey)throw t("INVALID_RESPONSE","Feature reference is unavailable");g=p(a.resources.featureKey,d),o="next"}else if(a.type==="split"){if(!(a.resources.experimentId?e.growth.experiments[a.resources.experimentId]:void 0))throw t("INVALID_RESPONSE","Experiment reference is unavailable");let h=fe({id:a.id,name:a.id,type:"split",experimentId:a.resources.experimentId,routes:a.outputs,notParticipating:a.outputs.notParticipating},d,i.experiments);g=h.value,o=h.port}else if(["offering","end","output"].includes(a.type)&&a.resources.featureKey)g=p(a.resources.featureKey,d),o=a.type==="offering"?"next":"value";else throw t("SERVER_REQUIRED","This node is driven by the authoritative Funnel runtime");let y=a.outputs[o]??(o==="value"?a.id:void 0);if(!y)throw t("INVALID_RESPONSE","Evaluated node exit is unavailable");return{nodeId:c,port:o,target:y,...g===void 0?{}:{value:g}}}}}function vr(e,t,u,r=re){return Re(e,r)(t,u)}function Re(e,t){let u=te.parse(e);if(u.evaluationMode!=="local")throw t("EVALUATION_MODE","Remote nodes are evaluated by Grow");let r=u.expiresAt?Date.parse(u.expiresAt):null,i=()=>{if(r!==null&&r<=Date.now())throw t("CONFIGURATION_EXPIRED","Refresh local rules at the scheduled transition")};i();let p=xe(u,t);return(c,d)=>(i(),Kn(p,c,d))}function Kn(e,t,u){let r=De.parse(u.attributes??{}),{saveStickyBucketAssignmentDoc:i,onFeatureUsage:p,onExperimentViewed:c}=u,d={attributes:r,...i?{saveStickyBucketAssignmentDoc:a=>i(structuredClone(a))}:{},...p?{onFeatureUsage:(a,o)=>p(a,structuredClone(o))}:{},...c?{onExperimentViewed:(a,o)=>c(structuredClone(a),structuredClone(o))}:{},features:e.features,savedGroups:e.savedGroups,...u.stickyBucketAssignmentDocs?{stickyBucketAssignmentDocs:structuredClone(u.stickyBucketAssignmentDocs)}:{}};return e.evaluate(t,d)}function Ir(e,t,u,r=re){return yn(Re(e,r),t,u)}function yn(e,t,u){let r=[],i=[],p=[],c=e(t,{...u.attributes?{attributes:u.attributes}:{},stickyBucketAssignmentDocs:u.sticky,saveStickyBucketAssignmentDoc(d){let a=r.findIndex(y=>y.next.attributeName===d.attributeName&&y.next.attributeValue===d.attributeValue),o=d.attributeName+"||"+d.attributeValue,g={expected:u.sticky[o]??null,next:d};a<0?r.push(g):r[a]=g},onExperimentViewed(d,a){a.inExperiment&&a.hashUsed&&!a.passthrough&&i.push(L.parse({key:d.key,variationId:a.variationId,keyUsed:a.key,hashAttribute:a.hashAttribute,hashValue:a.hashValue}))},onFeatureUsage(d,a){p.push(L.parse({feature:d,value:a.value,source:a.source,...a.ruleId?{ruleId:a.ruleId}:{}}))}});return{port:c.port,...c.value===void 0?{}:{value:c.value},sticky:r,exposures:i,features:p}}function vn(e,t,u,r=re){let i=u,p=new Map(t.graph.nodes.map(O=>[O.id,O])),c=structuredClone(u.variables),d=structuredClone(i.sticky),a=[],o=u.nodeId,g=u.visit,y=!1,I,h=O=>gn(t,O,e.evaluationMode==="local"?e.growth:{features:{},experiments:{}},i.attributes.funnelCustomerBound===!0),b=O=>(I??=Re(e,r),yn(I,O,{attributes:Je({declarations:t.variables,attributes:i.attributes,parameters:u.parameters,answers:u.answers,results:c,savedGroups:{}}),sticky:d}));for(let O=0;O<he;O++){let s=p.get(o);if(!s||!we(s)||h(s))break;if(g>=t.execution.maxTransitions&&(g>t.execution.maxTransitions||s.type!=="end"&&s.type!=="output")){if(!a.length)throw r("TRANSITION_LIMIT","Local Funnel transition budget exceeded");break}let m,x;if(["condition","feature","split"].includes(s.type)||s.type==="offering"&&s.configuration.source==="feature")m=b(s.id),s.type==="offering"&&(m.value={type:"offering_version",id:String(m.value)}),s.type==="condition"?x=m.port==="default"?s.default:s.cases[Number(m.port.slice(5))]?.target:s.type==="split"?x=m.port==="notParticipating"?s.notParticipating:s.routes[m.port]:(s.type==="feature"||s.type==="offering")&&(x=s.next);else if(m={port:"next",sticky:[],exposures:[],features:[]},(s.type==="entry"||s.type==="coupon"||s.type==="coupons")&&(x=s.next),s.type==="offering"&&s.configuration.source==="fixed"&&(m.value={type:"offering_version",id:s.configuration.versionId},x=s.next),s.type==="end"||s.type==="output"){let R=s.type==="end"?s.output:s.value;if(m=R?.type==="feature"?b(s.id):{...m,port:"value",value:R?.type==="literal"?R.value:R?.type==="variable"?Ue({source:"variable",key:R.key,...R.path?{path:R.path}:{}},{declarations:t.variables,answers:u.answers,results:c,parameters:u.parameters,attributes:i.attributes,savedGroups:{}}):null},R&&(m.value===void 0||!je(t.outputSchema,m.value)))throw r("INVALID_RESPONSE","Local terminal violates its declared output")}let C=[...a,{nodeId:o,result:m}];if(X({steps:C})>6e4){if(!a.length)throw r("INVALID_REQUEST","Local step exceeds its command budget");break}if(a.push({nodeId:o,result:m}),s.type==="feature"||s.type==="offering"||s.type==="coupon"||s.type==="coupons"){let R=s.type==="coupons"?s.couponIds.map(V=>({type:"reward",id:V})):s.type==="coupon"?{type:"reward",id:s.couponId}:m.value;if(R===void 0)throw r("INVALID_RESPONSE","Node output is missing");let _=G(s,{value:R});Ge(t.variables,s,_),Object.assign(c,_)}for(let R of m.sticky)d[`${R.next.attributeName}||${R.next.attributeValue}`]=structuredClone(R.next);if(s.type==="end"||s.type==="output"){y=!0;break}if(!x)throw r("INVALID_RESPONSE","Local pure exit is unavailable");o=x,g++}let T=p.get(o);return{steps:a,...!y&&T&&(!we(T)||h(T))?{boundary:{nodeId:o,visit:g}}:{}}}function In(e,t){let u=sn.safeParse(t);if(!u.success)throw new f("INVALID_RESPONSE","Funnel response contract changed");let r=u.data;if(e.scope&&(r.scope.projectId!==e.scope.projectId||r.scope.environment!==e.scope.environment))throw new f("SCOPE_MISMATCH","Funnel scope changed");return r}var Se=(e,t)=>new f(e,t);function Fr(e){return xe(e,Se)}var zn=3,Jn=2e3;function $n(e){return e instanceof TypeError||e instanceof f&&/^(?:CONFIGURATION_UNAVAILABLE|CONFIGURATION_HTTP_(?:429|5\d\d)|TEMPORARY_UNAVAILABLE)$/i.test(e.code)}async function Hn(e){for(let t=1;;t++)try{return await e.refresh()}catch(u){if(t===zn||!$n(u))throw u;await new Promise(r=>setTimeout(r,t*Jn))}}async function Fe(e,t,{predict:u=!0}={}){let r=t.instruction;if(r?.type!=="evaluate_segment")throw new Error("Local segment instruction required");if(!e)throw new f("CONFIGURATION_UNAVAILABLE","Local execution requires public configuration");if(e.scope.environmentId!==r.environmentId)throw new f("SCOPE_MISMATCH","Evaluation environment changed");let i=null,p;if(u)try{let c=await e.funnel(t.source.id,t.source.versionId);p=c.manifest.generation,i=Qn(e,t,c)}catch{i=null}return p??=e.snapshot?.generation??(await Hn(e)).generation,{advance:{policyRevision:r.policyRevision,generation:p},prediction:i}}function Qn(e,t,u){let r=t.instruction;if(r?.type!=="evaluate_segment"||!u.growth||u.control.evaluationMode!=="local"||u.control.evaluationRevision!==r.policyRevision)return null;let{analyticsConfig:i,remoteFeatures:p,...c}=u.growth,d=ve({scope:{projectId:e.scope.projectId,environment:e.scope.environment},funnelId:t.source.id,versionId:t.source.versionId,evaluationMode:"local",evaluationRevision:r.policyRevision,document:u.document,payload:J.parse(c)}),a=Yn(d,u.document,{...t,...r}),o=a.steps.at(-1),g=a.boundary??(o?.result.port==="value"?{nodeId:o.nodeId,visit:t.visit+a.steps.length-1}:null);return g?{runId:t.id,from:{nodeId:t.nodeId,visit:t.visit,revision:t.revision},nodeId:g.nodeId,visit:g.visit,terminal:!a.boundary}:null}function Yn(e,t,u){return vn(e,t,u,Se)}var hn=U.refine(e=>!["start","get","review"].includes(e.operation)&&!("customerToken"in e),"Persist only the original mutation, without credentials").transform(e=>{if(e.operation==="start"||e.operation==="get"||e.operation==="review")throw new f("COMMAND_STORAGE_INVALID","Stored mutation required");return e}),wn=n.strictObject({schemaVersion:n.literal(1),scope:D,runId:n.uuid(),funnelId:n.uuid(),versionId:n.uuid(),processBindingIds:n.record(n.uuid(),n.uuid().nullable()).optional(),command:hn.optional(),closeCommand:hn.refine(e=>e.operation==="close").optional(),purchase:n.strictObject({receiptId:n.uuid(),operationId:n.uuid(),generation:n.number().int().nonnegative()}).optional(),closed:n.literal(!0).optional()}).refine(e=>!e.closeCommand||e.command&&e.command.operation!=="close"&&e.command.requestId!==e.closeCommand.requestId,"Close requires a separate request identity").refine(e=>e.command!==void 0||e.purchase!==void 0,"A recovery record requires an original obligation"),A=()=>new f("COMMAND_STORAGE_CONFLICT","Another host changed this Run's pending command"),oe=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Z(e,t){if(!e||!t)return e;if(e.processBindingIds&&Object.hasOwn(e.processBindingIds,t)){let u={...e.processBindingIds};delete u[t],e={...e,processBindingIds:u}}return e.command?.requestId===t?e.closeCommand?{...e,command:e.closeCommand,closeCommand:void 0}:e.purchase?{...e,command:void 0}:null:e.closeCommand?.requestId===t?{...e,closeCommand:void 0}:e}function bn(e){let t=0,u=null,r=a=>JSON.stringify([a.scope,a.runId,a.funnelId,a.versionId]),i=Promise.resolve();async function p(){let a=await e.read();if(!Number.isSafeInteger(a.revision)||a.revision<0)throw new f("COMMAND_STORAGE_INVALID","Invalid command storage revision");return{revision:a.revision,entry:a.entry===null?null:wn.parse(a.entry)}}function c(a){let o=i.then(a);return i=o.catch(()=>{}),o}async function d(a){for(let o=0;o<4;o++){let g=await p();if(g.entry&&u!==null&&r(g.entry)!==u)throw A();let y=a(g.entry,g.revision);if(oe(g.entry,y)){t=g.revision;return}let I=await e.write(g.revision,y);if(I!==null){if(!Number.isSafeInteger(I)||I<=g.revision)throw A();t=I;return}}throw A()}return{bind(a){let o=JSON.stringify([a.scope,a.runId,a.funnelId,a.versionId]);if(u!==null&&u!==o)throw A();u=o},async load(){let a=await p();return t=a.revision,u=a.entry?r(a.entry):null,a.entry},retain(a){let o=wn.parse(a),g=o.command;return!g||u!==null&&r(o)!==u?Promise.reject(A()):(u??=r(o),c(()=>d((y,I)=>{if(y&&!oe(r(y),r(o)))throw A();if(y&&o.processBindingIds){for(let[h,b]of Object.entries(o.processBindingIds))if(y.processBindingIds&&Object.hasOwn(y.processBindingIds,h)&&y.processBindingIds[h]!==b)throw A();y={...y,processBindingIds:{...y.processBindingIds,...o.processBindingIds}}}if(!y){if(I!==t&&g.operation!=="close")throw A();return o}if(!y.command)return{...y,command:g,...g.operation==="close"?{closed:!0}:{}};if(g.operation==="close"&&y.command.operation!=="close"){if(y.command.requestId===g.requestId||y.closeCommand&&!oe(y.closeCommand,g))throw A();return{...y,closeCommand:g,closed:!0}}if(!oe(y.command,g))throw A();return y})))},observePurchase(a,o,g,y){return c(()=>d((I,h)=>{if(!I&&h!==t||I&&r(I)!==r({...a,schemaVersion:1}))throw A();if(I?.purchase&&I.purchase.generation>o.generation)return Z(I,y);if(I?.purchase&&I.purchase.generation===o.generation&&I.purchase.operationId!==o.operationId)throw A();return g?!I?.purchase||I.purchase.operationId!==o.operationId?Z(I,y):Z(I.command?{...I,purchase:void 0}:null,y):Z({schemaVersion:1,...a,...I,purchase:o},y)}))},settle(a){return c(()=>d(o=>Z(o,a)))}}}function qr(e,t){return t.type==="id"?e.customerId===t.value:e.externalUserId===t.value}function ie(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((i,p)=>ie(i,t[p]));if(!e||!t||typeof e!="object"||typeof t!="object")return!1;let u=Object.entries(e),r=Object.entries(t);return u.length===r.length&&u.every(([i,p])=>Object.hasOwn(t,i)&&ie(p,Reflect.get(t,i)))}function xn(e,t){let u=t&&{...t},r=null,i=0,p=-1,c=0,d=new AbortController;function a(){c++,d.abort(new f("IDENTITY_CHANGED","Run identity changed")),d=new AbortController}let o=!1,g,y=0,I=new Set;return{get scope(){return u},bindScope(h){if(u&&(u.projectId!==h.projectId||u.environment!==h.environment))throw new f("SCOPE_MISMATCH","Run scope changed");u??={...h}},get view(){return r},get currentView(){return p===c?r:null},get viewAgeMs(){return r&&p===c?performance.now()-i:void 0},get generation(){return c},get signal(){return d.signal},get disposed(){return o},get customerToken(){return g},get readSequence(){return y},nextRead(){return++y},assertCurrent(h,b="Run identity changed during the request"){if(h!==c||o)throw new f("IDENTITY_CHANGED",b)},assertRun(h){if(r&&(h.id!==r.id||h.source.type!==r.source.type||h.source.id!==r.source.id||h.source.versionId!==r.source.versionId||h.locale!==r.locale||!ie(h.parameters,r.parameters)))throw new f("INVALID_RESPONSE","Run version changed");if(e&&h.source.id!==e)throw new f("INVALID_RESPONSE","Run belongs to another Funnel")},publish(h,b,T,O,s){if(!(h.operation==="review"&&r&&r!==T&&b.run.revision<=r.revision)&&!(r&&b.run.revision===r.revision&&O!==void 0&&O<y)&&(h.operation==="review"&&!b.run.stopped&&["running","waiting"].includes(b.run.status)&&r&&p===c&&b.run.nodeId===r.nodeId&&b.run.visit===r.visit&&b.run.revision===r.revision&&(b.run.screen=r.screen,(r.paywall?.quote?.operationId===b.review?.activeOperationId||!r.paywall?.quote&&b.review?.activeOperationId===null)&&(b.run.paywall=r.paywall)),!(r?.paywall&&b.run.paywall&&r.paywall.receiptId===b.run.paywall.receiptId&&(b.run.paywall.selectionGeneration??0)<(r.paywall.selectionGeneration??0)))){if(!r||b.run.revision>=r.revision)r=b.run,i=performance.now(),p=c;else if(!s)return;if(r&&p===c)for(let m of I)try{m(structuredClone(r))}catch{}}},identify(h){if(o)throw new f("IDENTITY_CHANGED","Controller was reset");if(!W.test(h))throw new f("INVALID_TOKEN","Customer credential required");a(),g=h},subscribe(h){return I.add(h),()=>I.delete(h)},reset(){o||(o=!0,a(),g=void 0,r=null,I.clear())}}}var Ee=/^gg_sk_[A-Za-z0-9_-]{32,128}$/;function zr(e,t,u="A server API key is required"){if(typeof window<"u")throw new f("SERVER_ONLY",t);if(!Ee.test(e))throw new f("INVALID_TOKEN",u)}function Jr(e){let t=ne(e);return t.identify(e.apiKey),t}function Rn(e,t){if(!e)return;let u=t?.execution,r=u?.provider==="merchant"?"merchant":u?.provider==="stripe"?u.executor==="merchant"?"record_only":"indiana":t&&["apple","google"].includes(t.provider)?"native":t?.provider==="stripe"?"indiana":void 0;if(!r||!e.allowed.includes(r))throw new f("EXECUTION_POLICY_REFUSED","The original quote does not permit the declared purchase execution")}function M(e){let{customerToken:t,...u}=e;return u}var Zn=e=>!(e instanceof f&&e.code==="EXECUTION_POLICY_REFUSED")&&(!(e instanceof f)||e.status===void 0||e.status>=500||[401,425].includes(e.status)||e.recovery==="recover_operation");function Sn({journal:e,state:t,call:u,processIdentity:r}){let i=null,p=null,c=!1,d={command:null,close:null},a=new Set,o,g=null,y=e?e.load().then(s=>{if(t.disposed)throw new f("IDENTITY_CHANGED","Controller was reset during command restoration");if(g=s,!s)return;if(r){if([s.command,s.closeCommand].some(x=>x&&!Object.hasOwn(s.processBindingIds??{},x.requestId)))throw new f("COMMAND_STORAGE_INVALID","The original process identity is missing");r.restore(s.processBindingIds??{})}if(t.scope&&(s.scope.projectId!==t.scope.projectId||s.scope.environment!==t.scope.environment))throw new f("SCOPE_MISMATCH","Pending command belongs to another scope");if(o=s.purchase,c=s.closed===!0,!s.command)return;let m=s.command;i=m.operation==="close"?null:m,p=m.operation==="close"?m:s.closeCommand?.operation==="close"?s.closeCommand:null,p&&(c=!0);for(let x of[i,p])x&&a.add(x.requestId)}):Promise.resolve();y.catch(()=>{});async function I(s){e&&await y;let m=t.generation;if(e){if(!t.view||!t.scope)throw new f("COMMAND_STORAGE_INVALID","Read the original scoped Run before persisting a mutation");await e.retain({schemaVersion:1,scope:t.scope,runId:t.view.id,funnelId:t.view.source.id,versionId:t.view.source.versionId,command:M(s),...r?{processBindingIds:{[s.requestId]:r.binding(s.requestId)}}:{}})}if(m!==t.generation||i!==s&&p!==s)throw new f("IDENTITY_CHANGED","Run changed before command dispatch");let x=a.has(s.requestId);a.add(s.requestId);try{return await u(s)}catch(C){let R=s.operation==="submit"&&s.input.type==="paywall_quote",_=!x&&!Zn(C),V=!1;if(R&&_&&m===t.generation&&i===s&&C instanceof f&&C.status!==void 0){let l=await T(s.requestId).catch(()=>{});V=l?.settlement?.state==="unknown"&&l.settlement.operationId===null}throw m===t.generation&&(i===s||p===s)&&_&&(!R||!(C instanceof f)||C.status===void 0||V)&&(e&&await e.settle(s.requestId),m===t.generation&&O(s)),C}}function h(s){let m=U.parse(s);if(m.operation==="start"||m.operation==="get"||m.operation==="review")throw new f("INVALID_REQUEST","Mutation required");if(c&&m.operation!=="close"){if(i?.requestId===m.requestId)return T(m.requestId);throw new f("COMMAND_PENDING","Close preserves the original recovery record; settle it by identity")}if(m.operation==="close"){if(i?.requestId===m.requestId)throw new f("INVALID_REQUEST","Close requires its own request identity");if(c=!0,p&&JSON.stringify(M(p))!==JSON.stringify(M(m)))throw new f("COMMAND_PENDING","Retry the original Close");return p??=m,d.close?d.close:b(p,"close")}if(i){if(JSON.stringify(M(i))!==JSON.stringify(M(m)))throw new f("COMMAND_PENDING","Retry the original command before sending another");if(d.command)return d.command}else i=m;return b(i,"command")}function b(s,m){let x=I(s);d[m]=x;let C=()=>{d[m]===x&&(d[m]=null)};return x.then(C,C),x}function T(s){return u({operation:"get",settlementRequestId:s})}function O(s){return!s||i!==s&&p!==s?!1:(i===s&&(i=null),p===s&&(p=null),a.delete(s.requestId),!i&&!p&&(g=null),!0)}return{ready:y,get pending(){return i},get closing(){return p},get closeRequested(){return c},get inFlight(){return d.command},get closeFlight(){return d.close},get purchase(){return o},assertBinding(s){if(g&&(s.run.id!==g.runId||s.run.source.id!==g.funnelId||s.run.source.versionId!==g.versionId))throw new f("SCOPE_MISMATCH","Stored command belongs to another Run or Version")},async observe(s,m,x,C){let R=s.operation==="get"?s.settlementRequestId:"requestId"in s&&s.operation!=="start"?s.requestId:void 0,_=R&&m.settlement?.state==="settled"&&m.run.pendingRequest?.requestId!==R&&(s.operation==="get"||!c||s.operation==="close"||!["running","waiting"].includes(m.run.status))?R:void 0,V=i?.requestId===_?i:p?.requestId===_?p:void 0;e?.bind({scope:m.scope,runId:m.run.id,funnelId:m.run.source.id,versionId:m.run.source.versionId});let l=m.run.paywall,v=l??m.purchase,P=v?.operation,E=m.settlement&&(!l||l.purchaseRequestId===m.settlement.requestId)&&(!o||o.operationId===m.settlement.operationId)?m.settlement:void 0,S=P?.operationId??v?.quote?.operationId??E?.operationId,F=v?.receiptId??E?.receiptId,w=l?.selectionGeneration??o?.generation??0;if(e&&S&&F&&s.operation!=="review"&&(!t.view||m.run.revision>=t.view.revision)&&(C===void 0||C>=t.readSequence)&&(!o||w>=o.generation)){let N={receiptId:F,operationId:S,generation:w},k=on(P,v?.canReselect===!0);await e.observePurchase({scope:m.scope,runId:m.run.id,funnelId:m.run.source.id,versionId:m.run.source.versionId},N,k,_),t.assertCurrent(x),(!o||N.generation>=o.generation)&&(C===void 0||C>=t.readSequence)&&(k?o?.operationId===N.operationId&&(o=void 0):o=N)}else e&&_&&await e.settle(_);return t.assertCurrent(x),_?O(V):!1},stop(){c=!0},submit:h,settle:T,reset(){c=!0,i=null,p=null,o=void 0,g=null,d.close=null,a.clear(),d.command=null}}}function Wn(e){e={...e};let t=e.initialResponse;delete e.initialResponse;let u=e.funnelExecutionPolicy&&structuredClone(e.funnelExecutionPolicy);if(!e.customerRun&&(typeof e.runToken!="string"||!/^gg_fr_[A-Za-z0-9_-]{43}$/.test(e.runToken)))throw new f("INVALID_TOKEN","Run credential required");if(e.customerRun&&(!e.session||!e.scope||!e.funnelId||!e.funnelCommandStorage||e.serverKey))throw new f("INVALID_REQUEST","Customer recovery requires its scoped session and durable journal");if(e.serverKey&&(typeof window<"u"||!Ee.test(e.serverKey)))throw new f("SERVER_ONLY","Run Server-Key proof belongs to the merchant backend");if(e.serverKey&&e.session)throw new f("INVALID_REQUEST","Choose Customer session or Server-Key proof for this Run");let r=ne({...e,session:void 0,timeoutMs:e.timeoutMs??35e3}),i=xn(e.funnelId,e.scope??e.configuration?.scope),p=e.session?.subscribeIdentity(b),c=null,d=e.funnelCommandStorage??(!e.customerRun&&typeof window<"u"&&window.isSecureContext?an(e):void 0),a=d&&bn(d),o=Sn({journal:a,state:i,call:T,processIdentity:e.process}),g=0,y=new Map;function I(){g++,y.clear(),t=void 0}async function h(l){let v=l.operation==="resume"?o.pending?.operation==="resume"?null:o.pending:l;if(u&&l.operation==="resume"&&!v&&l.requestId!==e.customerRun?.startRequestId)throw new f("EXECUTION_POLICY_REFUSED","The original command is required to verify execution permission before resuming");if(v?.operation==="submit"&&v.input.type==="paywall_confirm"){let N=i.view?.paywall;Rn(u,N?.quote?.operationId===v.input.operationId?N.quote:void 0)}if(e.process)return e.process.request(l);let P=i.generation;i.assertCurrent(P);let E=performance.now()+(e.timeoutMs??35e3),S=i.customerToken??("customerToken"in l?l.customerToken:void 0);if(e.session){let N=i.signal,k,K=()=>{},Fn=new Promise((Xn,Ce)=>{K=()=>Ce(N.reason),N.addEventListener("abort",K,{once:!0}),k=setTimeout(()=>Ce(new f("TIMEOUT","The request timed out")),Math.max(1,E-performance.now()))});try{S=await Promise.race([Promise.resolve().then(()=>(i.assertCurrent(P),e.session.access())),Fn])}finally{clearTimeout(k),N.removeEventListener("abort",K)}}i.assertCurrent(P);let F={...l,...S?{customerToken:S}:{}},w=l.operation==="page_experiments"?ye.parse(F):U.parse(F);if(e.customerRun){if(e.session?.snapshot()?.customerId!==e.customerRun.customerId||!S)throw new f("IDENTITY_CHANGED","Original recovery Customer changed");let N={...w};return"customerToken"in N&&delete N.customerToken,r.requestWithCredential("funnels",{operation:"run_command",runId:e.customerRun.runId,funnelId:e.funnelId,command:N},S,{timeoutMs:Math.max(1,E-performance.now())})}return r.requestWithCredential("funnels",w,e.runToken,{headers:e.serverKey&&!S?{[ln]:e.serverKey}:void 0,timeoutMs:Math.max(1,E-performance.now())})}function b(){I(),p?.(),i.reset(),o.reset(),c=null,r.dispose()}async function T(l,v){let P=t;t=void 0;let E=i.generation,S=()=>i.assertCurrent(E);a&&await o.ready,S();let F=i.view,w=In(e,P!==void 0&&l.operation==="get"&&!l.data&&!l.purchase&&!l.settlementRequestId?P:await h(l));if(l.operation==="review"&&!w.review)throw new f("INVALID_RESPONSE","Historical projection is missing");if(e.customerRun&&w.run.id!==e.customerRun.runId)throw new f("INVALID_RESPONSE","Original recovery Run changed");if(l.operation==="get"&&l.purchase&&w.purchase&&(w.purchase.receiptId!==l.purchase.receiptId||(w.purchase.operation?.operationId??w.purchase.quote?.operationId)!==l.purchase.operationId))throw new f("INVALID_RESPONSE","The requested original purchase changed");if(S(),w.runToken&&w.runToken!==e.runToken)throw new f("INVALID_RESPONSE","Run credential changed");let N=l.operation==="get"?l.settlementRequestId:"requestId"in l&&l.operation!=="start"?l.requestId:void 0;if(N&&w.settlement?.requestId!==N)throw new f("INVALID_RESPONSE","Exact command settlement is missing or belongs to another command");o.assertBinding(w),i.assertRun(w.run),i.bindScope(w.scope);let k=await o.observe(l,w,E,v);return(!i.view||w.run.revision>=i.view.revision)&&(v===void 0||v>=i.readSequence)&&(await e.onAcceptedResponse?.(w),S()),!w.run.stopped&&["running","waiting"].includes(w.run.status)&&l.operation==="get"&&l.settlementRequestId||(S(),["running","waiting"].includes(w.run.status)||o.stop(),i.publish(l,w,F,v,k)),w}function O(l){let v=i.generation;I();let P=l(),E=()=>{i.generation===v&&I()};return P.then(E,E),P}let s=l=>O(()=>o.submit(l)),m=null,x=new WeakMap;function C(l){let v=x.get(l);if(v)return v;let P=_(l);return x.set(l,P),P}let R=!1;async function _(l){let v=await l;if(v.run.instruction?.type!=="evaluate_segment")return v;if(m)return m;R=!0;let P=i.generation,E=(async()=>{for(let S=0;S<32&&v.run.instruction?.type==="evaluate_segment";S++){if(o.pending||o.closeRequested)return v;let F=v.run;if(v.run.instruction?.type==="evaluate_segment"){let{advance:N}=await Fe(e.configuration,F,{predict:!1});if(P!==i.generation)throw new f("IDENTITY_CHANGED","Run identity changed during segment calculation");if(o.pending||o.closeRequested)return v;if(i.view&&(i.view.revision!==F.revision||i.view.visit!==F.visit||i.view.nodeId!==F.nodeId))return T({operation:"get"});let k=!0;Fe(e.configuration,F).then(({prediction:K})=>{k&&P===i.generation&&!o.closeRequested&&i.view?.id===F.id&&!i.view.stopped&&i.view.nodeId===F.nodeId&&i.view.visit===F.visit&&i.view.revision===F.revision&&(c=K)}).catch(()=>{});try{v=await s({operation:"commit_segment",requestId:cn(F.id,F.visit,`segment:${F.revision}`),nodeId:F.nodeId,visit:F.visit,revision:F.revision,...N})}finally{k=!1,c=null}}}return v})();m=E;try{return await E}finally{m===E&&(m=null)}}let V={get configuration(){return R?e.configuration:void 0},get configurationReady(){return!0},get view(){let l=i.currentView;return l?structuredClone(l):null},get viewAgeMs(){return i.viewAgeMs},get pendingCommand(){let l=o.closing??o.pending;return l?structuredClone(M(l)):null},get pendingCommands(){return[o.pending,o.closing].filter(l=>l!==null).map(l=>structuredClone(M(l)))},get pendingPurchase(){return o.purchase?structuredClone(o.purchase):null},get hasDurableJournal(){return a!==void 0},get prediction(){let l=i.view;return c&&l&&!l.stopped&&["running","waiting"].includes(l.status)&&l.id===c.runId&&l.nodeId===c.from.nodeId&&l.visit===c.from.visit&&l.revision===c.from.revision&&!o.closeRequested?structuredClone(c):null},settle:(...l)=>O(()=>o.settle(...l)),get webViewUrl(){return"bundled"},resolvePaywall(l){return rn(e,l)},async pageExperiments(l,v=[]){let P=i.generation;i.assertCurrent(P);let E=i.view?.id;if(!E)throw new f("INVALID_REQUEST","Read the Run before its page experiments");let S=pn.parse(await h(ye.parse({operation:"page_experiments",release:l,usedReceiptIds:v})));if(i.assertCurrent(P),S.runId!==E||S.scope.projectId!==i.scope?.projectId||S.scope.environment!==i.scope?.environment)throw new f("SCOPE_MISMATCH","Page experiment Run changed");return S},review(l){return T({operation:"review",...l?{receiptId:l}:{}},i.nextRead())},async get(l,v){let P=i.generation;l=l&&structuredClone(l),v=v&&{...v},a&&await o.ready,i.assertCurrent(P),v??=o.purchase&&{receiptId:o.purchase.receiptId,operationId:o.purchase.operationId};let E=JSON.stringify([i.generation,g,l??null,v??null]),S=y.get(E);if(S)return S.then(k=>structuredClone(k));let F=i.nextRead(),w=C(T({operation:"get",...l?{data:l}:{},...v?{purchase:v}:{}},F));y.set(E,w);let N=()=>{y.get(E)===w&&y.delete(E)};return w.then(N,N),w.then(k=>structuredClone(k))},resume(l=i.view?.pendingRequest?.requestId){return l?o.closeRequested?V.settle(l):o.pending?.requestId===l?C(s(o.pending)):C(s({operation:"resume",requestId:l})):Promise.reject(new f("INVALID_REQUEST","No interrupted command is available"))},submit(l){return C(s(l))},async retry(){if(o.closeFlight)return o.closeFlight;if(o.closing)return s(o.closing);if(o.closeRequested&&o.pending)return V.settle(o.pending.requestId);if(o.inFlight)return C(o.inFlight);if(!o.pending)throw new f("INVALID_REQUEST","No command is pending");let l=o.pending;if(l.operation==="submit"&&l.input.type==="paywall_quote"){let v=i.generation;if(await V.settle(l.requestId),i.assertCurrent(v),!o.pending)return V.get();if(o.pending!==l||o.closeRequested)throw new f("COMMAND_PENDING","The original quote is being recovered")}return C(s(l))},identify(l){let v=i.customerToken?void 0:t;I(),i.identify(l),t=v,c=null,r.reset()},get identitySignal(){return i.signal},subscribe:i.subscribe,reset:b};return V}function go(e,t){return Wn({...e,runToken:"",initialResponse:t})}export{cn as a,un as b,Pn as c,me as d,An as e,sn as f,Vn as g,Mt as h,jt as i,Gt as j,ye as k,pn as l,te as m,Ln as n,Wt as o,vr as p,Ir as q,In as r,Se as s,Fr as t,Yn as u,wn as v,Z as w,an as x,En as y,qr as z,ie as A,Ee as B,zr as C,Jr as D,Rn as E,Wn as F,go as G};
|
package/dist/chunk-U6GWWCUS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as kn,b as rn,c as on,d as _e,e as Fn,f as We,h as Dn}from"./chunk-HQPP76BS.js";import{c as Cn,e as Pn,f as Rn,h as En,i as qn,j as Be,k as Ae,l as je}from"./chunk-BRAVNBCC.js";import{$ as Qe}from"./chunk-R23IGK5U.js";import{a as ze,e as gn,f as vn,g as hn,h as In,i as bn}from"./chunk-EHDHWYVJ.js";import{b as wn}from"./chunk-BXPXJARS.js";import{R as fn,qa as yn}from"./chunk-N7YXDSQL.js";import{a as P}from"./chunk-X4W22IH6.js";import{b as Sn,e as On}from"./chunk-SLUA7ABW.js";import{d as Tn}from"./chunk-KIMX3OIV.js";import{a as le}from"./chunk-DSPLGTQI.js";import{b as mn}from"./chunk-7QL4GF4C.js";var Te=new WeakMap;function Bn(n){let g=n.view,w=g?.paywall?.resolution;if(!g||!["running","waiting"].includes(g.status)||g.stopped||!w||"document"in w||!n.resolvePaywall||n.identitySignal?.aborted)return;let e=JSON.stringify(w);if(Te.get(n)?.key===e)return;let p=JSON.parse(e),D=n.identitySignal,a=Promise.resolve().then(async()=>{D?.throwIfAborted();let s=await n.resolvePaywall(p);return D?.throwIfAborted(),s}),S={key:e,content:a};return Te.set(n,S),a.catch(()=>{}),()=>{Te.get(n)===S&&Te.delete(n)}}function Nn(n,g){let w=Te.get(n);return Te.delete(n),w?.key===JSON.stringify(g)?w.content:n.resolvePaywall(g)}async function An(n){let{session:g,load:w}=Qn(n);try{return await w(),g}catch(e){throw g.destroy(),e}}function Qn(n){let g=n.view;if(!g?.paywall)throw new P("INVALID_REQUEST","The current node is not a Paywall");let w=g.paywall.receiptId,e=g.nodeId,p=g.visit,D=g.paywall.resolution,a=g.paywall,S="document"in D?{document:D.document,offering:D.offering,capabilities:D.capabilities}:null;function s(){let i=a.resolution;return"document"in i?i:S&&{...i,document:S.document,offering:S.offering,capabilities:gn(i.capabilities,S.capabilities)}}function v(i){if(!vn(i,D))throw new P("INVALID_RESPONSE","The pinned Paywall binding changed")}let u=!1,q=new Set,A=null;function V(){let i=s();if(i&&!u)for(let l of q)le(l,structuredClone(i))}async function k(){J();let i=s();if(i)return structuredClone(i);if(!A){let l=(async()=>{if("document"in a.resolution||!n.resolvePaywall)throw new P("INVALID_RESPONSE","Public Paywall reader is unavailable");let c=await Nn(n,a.resolution);return J(),v(c),S={document:c.document,offering:c.offering,capabilities:c.capabilities},V(),s()})();A=l;let o=()=>{A===l&&(A=null)};l.then(o,o)}return A.then(l=>structuredClone(l))}let d=new AbortController,F=(n.pendingCommands??(n.pendingCommand?[n.pendingCommand]:[])).find(i=>i.operation==="submit"&&i.nodeId===e&&i.visit===p&&i.input.type==="paywall_quote")?.requestId??g.paywall.purchaseRequestId,R=0,M=null,C=new Set,H=null,h=new Map;function _(i){if(i.purchase&&i.purchase.receiptId!==w)throw new P("INVALID_RESPONSE","Purchase receipt changed");let l=i.run.paywall;return i.purchase??(l?.receiptId===w?l:null)}function J(){if(u)throw new P("IDENTITY_CHANGED","Paywall presentation has closed")}function z(i,l,o){if(J(),l!==R||o!==void 0&&a.quote?.operationId!==o)return!1;let c=a.selectionGeneration??0,y=i.run.paywall;if(y?.receiptId===w){if((y.selectionGeneration??0)<(a.selectionGeneration??0))return!1;v(y.resolution)}let I=_(i),B=y?.receiptId===w&&(y.selectionGeneration??0)>c,G=B?I?.quote??null:I?.quote??a.quote,b=I?.operation??(G?.operationId===a.quote?.operationId?a.operation:null);return G&&b&&hn(b,{operationId:G.operationId},"Purchase operation changed"),(B||G?.operationId!==a.quote?.operationId)&&(R++,y?.receiptId===w&&(F=y.purchaseRequestId)),y?.canReselect===!0&&y.purchaseRequestId===H&&!(n.pendingCommands??[n.pendingCommand]).some($=>$?.requestId===H)&&(H=null),a={...a,...y?.receiptId===w?y:{},quote:G,operation:bn(a.operation,b,!0)},V(),!0}function L(i,l,o){return new Promise((c,y)=>{let I=!1,B=()=>{clearTimeout(Re),d.signal.removeEventListener("abort",$)},G=Ee=>{I||(I=!0,B(),c(Ee))},b=Ee=>{I||(I=!0,B(),y(Ee))},$=()=>b(new P("IDENTITY_CHANGED","Paywall presentation has closed")),Re=setTimeout(()=>b(new P("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,o)),Math.max(0,l-Date.now()));d.signal.addEventListener("abort",$,{once:!0}),d.signal.aborted&&$(),i.then(G,b)})}function de(i){return new Promise(l=>{let o=()=>{clearTimeout(c),d.signal.removeEventListener("abort",o),l()},c=setTimeout(o,i);d.signal.addEventListener("abort",o,{once:!0}),d.signal.aborted&&o()})}function Y(i,l){J();let o=h.get(i)??n.pendingCommands?.find(I=>I.requestId===i)??n.pendingCommand;if(o?.operation==="submit"&&o.requestId===i&&o.nodeId===e&&o.visit===p){l.type==="paywall_quote"&&o.input.type==="paywall_quote"&&o.input.predecessor&&!l.predecessor&&(l={...l,predecessor:o.input.predecessor});let I=Qe.parse(o),B=Qe.parse({...o,input:l});if(I.operation!=="submit"||B.operation!=="submit"||JSON.stringify(I.input)!==JSON.stringify(B.input))throw new P("CONFLICT","A purchase request cannot change its input");return h.set(i,I),I}let c=n.view;if(!c||c.nodeId!==e||c.visit!==p||c.paywall?.receiptId!==w)throw new P("PRECONDITION_FAILED","The Paywall visit has changed");let y=Qe.parse({operation:"submit",requestId:i,nodeId:e,visit:p,revision:c.revision,input:structuredClone(l)});if(y.operation!=="submit")throw new P("INVALID_REQUEST","A purchase submission is required");return h.set(i,y),y}async function ce(i,l){J();let{requestId:o,input:c}=i,y=Date.now()+3e4;C.add(o);try{let I=await L(n.submit(i),y,o);for(;I.run.pendingRequest?.requestId===o&&Date.now()<y&&!u&&(await de(Math.min(1e3,y-Date.now())),!(u||Date.now()>=y));)I=await L(n.resume(o),y,o);if(u)throw new P("IDENTITY_CHANGED","Paywall presentation has closed");if(I.run.pendingRequest?.requestId===o)throw new P("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,o);if(!z(I,l,c.type==="paywall_confirm"||c.type==="paywall_cancel"?c.operationId:void 0))throw new P("PRECONDITION_FAILED","The purchase selection has changed");H===o&&(H=null)}catch(I){if(H=o,c.type==="paywall_quote"&&n.settle&&!u&&I instanceof P&&I.status!==void 0&&![401,425].includes(I.status)&&!I.retryable&&I.recovery!=="recover_operation")try{if((await L(n.settle(o),y,o)).settlement?.state==="settled"){let G=await L(n.get(),y,o);z(G,l)&&G.run.paywall?.purchaseRequestId===o&&a.canReselect===!0&&h.delete(o)}}catch{}throw I instanceof P&&I.code==="COMMAND_PENDING"&&I.status===void 0&&h.delete(o),I}finally{C.delete(o)}}async function re(i){if(!a.quote)throw new P("INVALID_REQUEST","A quoted purchase is required");let l=i==="confirm"?"paywall_confirm":"paywall_cancel",o=[...h.values(),...n.pendingCommands??(n.pendingCommand?[n.pendingCommand]:[])].find(y=>y.operation==="submit"&&y.input.type===l&&"operationId"in y.input&&y.input.operationId===a.quote.operationId),c=o?.operation==="submit"&&o.input.type===l&&"operationId"in o.input&&o.input.operationId===a.quote.operationId?o.requestId:crypto.randomUUID();if(await ce(Y(c,{type:i==="confirm"?"paywall_confirm":"paywall_cancel",operationId:a.quote.operationId}),R),!a.operation)throw new P("INVALID_RESPONSE","The accepted purchase result is missing");return structuredClone(a.operation)}let T={get view(){return structuredClone(s())},get quote(){return a.quote?structuredClone(a.quote):null},get operation(){return a.operation?structuredClone(a.operation):null},get webViewUrl(){return n.webViewUrl},get canReselect(){return a.canReselect===!0&&H===null},get recovery(){let i=n.pendingCommands??(n.pendingCommand?[n.pendingCommand]:[]),l=n.pendingPurchase;if(l&&(l.receiptId!==w||l.operationId!==a.quote?.operationId))return{type:"recover",operationId:l.operationId,requestId:i[0]?.requestId??null};let o=ze({quote:a.quote,operation:a.operation,requestId:i[0]?.requestId??H??F,pending:C.size>0||i.length>0||H!==null,destroyed:u,canReselect:a.canReselect});return o.type==="recover"&&o.requestId===null&&!u&&n.hasDurableJournal===!0&&!a.quote&&!a.operation&&(a.selectionGeneration??0)===0&&!l&&!i.length&&!C.size&&!F?{type:"native",operationId:null}:o},get pendingCancellation(){return!u&&(n.pendingCommands??(n.pendingCommand?[n.pendingCommand]:[])).some(i=>i.operation==="submit"&&i.nodeId===e&&i.visit===p&&i.input.type==="paywall_cancel"&&i.input.operationId===a.quote?.operationId)},subscribe(i){return u?()=>{}:(q.add(i),()=>q.delete(i))},async refresh(){J();let i=R,l=await n.get();if(z(l,i),l.run.paywall?.receiptId!==w)throw new P("PRECONDITION_FAILED","Paywall presentation has changed");return k()},preview(i){let l=s();if(!l)return Promise.reject(new P("PRECONDITION_FAILED","Load the Paywall presentation first"));if(F&&F!==i.requestId&&(M||a.canReselect!==!0))return Promise.reject(new P("COMMAND_PENDING","Retry the original purchase before starting another"));let o=l.document.buttons[i.actionId],c=o?.type==="checkout"?wn(o.product,i.selection,l.capabilities):null;if(!c)return Promise.reject(new P("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));let y=yn(l.document.screen,c,i.selection,l.capabilities),I=F!==i.requestId&&(a.selectionGeneration??0)>0?{operationId:a.quote?.operationId??null,generation:a.selectionGeneration??0}:void 0;if(I&&a.canReselect!==!0)return Promise.reject(new P("COMMAND_PENDING","Original purchase requires authoritative termination"));let B;try{B=Y(i.requestId,{type:"paywall_quote",actionId:i.actionId,productVersionId:c,...Object.keys(y).length?{featureQuantities:y}:{},...I?{predecessor:I}:{},...i.offerId?{offerId:i.offerId}:{},...i.nativeOffer?{nativeOffer:i.nativeOffer}:{}})}catch($){return Promise.reject($)}if(F===i.requestId&&M)return M;F!==i.requestId&&R++;let G=R;F=i.requestId;let b=(async()=>{if(await ce(B,G),!a.quote)throw new P("INVALID_RESPONSE","The accepted quote is missing");return In(a.quote,{productVersionId:c,featureQuantities:y},"The selected purchase changed"),structuredClone(a.quote)})();return M=b,b.then(()=>{M===b&&(M=null)},$=>{M===b&&(M=null),F===i.requestId&&n.pendingCommand?.requestId!==i.requestId&&$ instanceof P&&$.status!==void 0&&$.status<500&&![401,425].includes($.status)&&(F=null)}),b},confirm:()=>re("confirm"),cancel:()=>re("cancel"),async read(){if(J(),!a.quote)throw new P("INVALID_REQUEST","A quoted purchase is required");let i=a.quote.operationId,l=R,o=n.pendingCommands?.find(G=>G.operation==="submit"&&(G.input.type==="paywall_confirm"||G.input.type==="paywall_cancel")&&G.input.operationId===i)??n.pendingCommand;o?.operation==="submit"&&(o.input.type==="paywall_confirm"||o.input.type==="paywall_cancel")&&o.input.operationId===i&&await n.settle?.(o.requestId);let c=await n.get(void 0,{receiptId:w,operationId:i});J();let y=_(c);if(y?.quote&&y.quote.operationId!==i||y?.operation&&y.operation.operationId!==i)throw new P("INVALID_RESPONSE","Purchase operation changed");let I=z(c,l,i),B=I?a.operation:y?.operation;if(!B)throw new P("INVALID_RESPONSE","The current purchase result is missing");return I&&C.size===0&&!(n.pendingCommands?.length??(n.pendingCommand?1:0))&&(H=null),structuredClone(B)},destroy(){u=!0,E(),q.clear(),d.abort(),h.clear()}},E=n.subscribe(i=>{u||i.nodeId!==e||i.visit!==p||i.paywall?.receiptId!==w||(i.paywall.selectionGeneration??0)<(a.selectionGeneration??0)||(v(i.paywall.resolution),a={...a,resolution:i.paywall.resolution},V())});return{session:T,load:k}}function _n(n){let g=new Set,w=new Set,e=null;async function p(s,v){let u=!1;for(;!n.stopped&&n.key===s&&n.client.pendingCommand?.requestId===v;){if(!n.client.settle)throw new P("COMMAND_PENDING","The original display acknowledgement is still pending");await n.client.settle(v),u=!0,n.client.pendingCommand?.requestId===v&&await new Promise(q=>setTimeout(q,1500))}n.stopped||n.key!==s||(u&&await n.client.get(),!(n.stopped||n.key!==s)&&g.add(s))}function D(s,v){e=v;let u=()=>{e===v&&(e=null),w.delete(s)};return v.then(u,q=>{u(),n.busy||n.fail(q)}),v}function a(s){if(n.reviewing||g.has(s)||w.has(s)||n.stopped)return;w.add(s);let v=async()=>{if(n.reviewing||n.stopped||n.key!==s||g.has(s)){w.delete(s);return}if(n.busy||n.client.pendingCommand){setTimeout(()=>{v()},250);return}let u=(async()=>{if(n.staleRead){if(await n.staleRead,n.stopped||n.key!==s)return;if(n.client.pendingCommand){setTimeout(()=>{v()},250);return}}let q=n.client.view,A=n.expected(),V=A.requestId;try{await n.client.submit({operation:"shown",...A})}catch(k){if(!(k instanceof P)||k.code!=="CONFLICT"||k.status!==409||n.client.pendingCommand)throw k;await n.client.get();let d=n.client.view;if(n.stopped||n.reviewing||n.key!==s||!d||!q||d.id!==q.id||d.source.versionId!==q.source.versionId||d.nodeId!==A.nodeId||d.visit!==A.visit||d.revision<=A.revision||d.stopped||!d.screen&&(!d.paywall||d.paywall.receiptId!==q.paywall?.receiptId)||!["running","waiting"].includes(d.status)||n.client.pendingCommand)throw k;let O=n.expected();V=O.requestId,await n.client.submit({operation:"shown",...O})}await p(s,V)})();D(s,u)};v()}function S(){if(e)return e;let s=n.client.pendingCommand;if(s?.operation!=="shown")return null;let v=n.key;return w.add(v),D(v,(async()=>{await n.client.retry(),await p(v,s.requestId)})())}return{report:a,settled:S,get inFlight(){return e}}}function Ln(n){let g={},w=new Map;async function e(p){let D=n.client.view,a=D?.screen,S=a?.customerData.nodes[p.nodeId];if(n.stopped||n.busy||!D||!a||!S)return;if(!["refresh","next","previous","filter","sources_next","sources_previous"].includes(p.action)){let k=n.document,d=k?fn(k,p.nodeId):null,O=d?.type==="customer_data"?d.data.outputs?.[p.action]:void 0;O&&a.outputs.includes(O)?await n.perform(()=>n.client.submit({operation:"submit",...n.expected(),input:{type:"screen",output:O,answers:n.answers,selection:p.value?{[p.nodeId]:p.value}:{}}})):await n.onIntent?.(p,D);return}let v=p.action.startsWith("sources_")?S.resources.find(k=>k.key===p.value):null;if(p.action.startsWith("sources_")&&!v)throw new P("INVALID_REQUEST","Choose a current resource");let u=`${D.visit}:${p.nodeId}:${v?.key??""}`,q=w.get(u)??[null],V=g[p.nodeId]??{page:1,after:null,filter:"all",...v?{resourceKey:v.key}:{}};if(p.action==="filter"){let k=p.value;if(!k||!(S.source==="offer_history"?["all","issued","reserved","redeemed","expired","revoked"]:["all","purchase","refund","source","usage","debt","settlement"]).includes(k))throw new P("INVALID_REQUEST","Unknown data filter");V={page:1,after:null,filter:k},q.splice(0,q.length,null)}else if(p.action==="next"||p.action==="sources_next"){let k=v?.sources.at(-1),d=v?k?{kind:"ledger",cursor:{at:k.detail[0],id:k.id,type:"source"}}:null:a.dataCursors[p.nodeId];if(!d||!v&&!S.hasNext)return;q[V.page]=d,V={...V,page:V.page+1,after:d}}else if(p.action==="previous"||p.action==="sources_previous"){if(V.page<=1)return;V={...V,page:V.page-1,after:q[V.page-2]??null}}w.set(u,q),g={...g,[p.nodeId]:V},await n.perform(()=>n.client.get({nodeId:D.nodeId,visit:D.visit,revision:D.revision,components:g}))}return{get queries(){return g},intent:e,reset(){g={},w.clear()}}}function Vn(n){let{doc:g,holder:w,reviewHolder:e,mountScreenPreview:p}=n,D=!1,a,S=0,s=null,v="",u,q=new Map,A=d=>d?`${d.id}:${d.nodeId}:${d.visit}:${d.revision}:${d.paywall?.quote?.operationId??""}`:"";async function V(d){if(n.stopped||!n.client.review||D&&d===a&&u?.active)return;let O=!D||d!==a;D||(v=A(n.client.view),q.set(v,structuredClone(n.answers))),D=!0,a=d,w.hidden=!0,n.suspend(!0),e.hidden=!1;let F=++S;O&&(u?.finish("dismissed"),s?.destroy(),s=null,e.replaceChildren(),u=je(e,n.loadingOptions,"funnel",()=>{k()}));let R=O?u:void 0;try{if(R?.start(!1,n.client.view?.locale),F!==S||n.stopped)return;let M=n.client.review(d),C=await(R?.wait(M,Ae)??M);if(n.stopped||F!==S||!D)return;if(!C.review)throw new P("INVALID_RESPONSE","Historical projection is missing");s?.destroy(),s=null,R||e.replaceChildren();let H=g.createElement("div"),h=R?Be(H,e):()=>{};e.append(H);let _=C.run.locale.startsWith("zh"),J=n.chrome;H.style.cssText=J.history;let z=g.createElement("p");z.textContent=_?"\u53EA\u8BFB\u56DE\u770B":"Read-only history",z.style.cssText=J.historyTitle,H.append(z);let L=g.createElement("p");L.style.cssText=J.historyNote,L.textContent=C.review.pages.length?_?"\u9009\u62E9\u4E00\u9875\u67E5\u770B\u5F53\u65F6\u7684\u5185\u5BB9\uFF0C\u56DE\u770B\u4E0D\u4F1A\u6539\u52A8\u4EFB\u4F55\u4FE1\u606F\u3002":"Choose a page to see it as it was. Nothing here can be changed.":_?"\u8FD8\u6CA1\u6709\u53EF\u56DE\u770B\u7684\u9875\u9762\u3002":"There are no earlier pages yet.",H.append(L);let de=C.review.page?.receiptId,Y=g.createElement("div");Y.style.cssText=J.historyPages;for(let[T,E]of C.review.pages.entries()){let i=g.createElement("button");i.type="button",i.textContent=_?`\u7B2C ${T+1} \u9875`:`Page ${T+1}`;let l=de!==void 0&&E.receiptId===de;i.style.cssText=l?J.primary:J.secondary,l&&i.setAttribute("aria-current","page"),_e(i,()=>n.chrome.focus),i.onclick=()=>{V(E.receiptId)},Y.append(i)}if(Y.childElementCount&&H.append(Y),C.review.page){let T=C.review.page,E=g.createElement("div");E.inert=!0,E.style.cssText=J.historyPage,H.append(E),s=p(E,{mode:"live",rendererUrl:n.client.webViewUrl,title:T.document.name,onAction:()=>{},onAnswers:()=>{},onCustomerDataIntent:()=>{},onRendered:()=>{F===S&&!n.stopped&&R?.present(h)},onError:l=>{if(F!==S||n.stopped)return;let o=new Error(l);R?.finish("error",o),s?.destroy(),s=null,H.remove(),n.fail(o)},onEscape:()=>{k()}});let i=s;if(i.update(T.document,C.run.locale,{serverInput:{bindings:T.inputs,answers:T.answers,values:T.values}}),await i.ready,n.stopped||F!==S||!D)return}let ce=_?{issued:"\u5DF2\u9886\u53D6",reserved:"\u5DF2\u9884\u7559",redeemed:"\u5DF2\u4F7F\u7528",expired:"\u5DF2\u8FC7\u671F",revoked:"\u5DF2\u64A4\u9500",unknown:"\u72B6\u6001\u5F85\u786E\u8BA4"}:{issued:"Issued",reserved:"Reserved",redeemed:"Used",expired:"Expired",revoked:"Revoked",unknown:"Status unconfirmed"},re=g.createElement("div");re.style.cssText=J.historyRecords;for(let T of[...C.review.coupons.map((E,i)=>`${_?"\u4F18\u60E0\u5238":"Coupon"} ${i+1}: ${ce[E.status]}`),...C.review.purchases.map((E,i)=>`${_?"\u8D2D\u4E70":"Purchase"} ${i+1}: ${Dn(E.status,_)}`)]){let E=g.createElement("p");E.textContent=T,E.style.margin="0",re.append(E)}re.childElementCount&&H.append(re),C.review.page||R?.present(h),n.client.view&&await n.enqueue(n.client.view)}catch(M){if(F!==S||n.stopped)return;R?.finish("error",M),s?.destroy(),s=null,e.replaceChildren(),n.fail(M)}}async function k(){if(!D||n.stopped||!n.client.review)return;let d=++S;u?.finish("dismissed");try{if(await n.client.review(),n.stopped||d!==S)return;D=!1,S++,u?.finish("dismissed"),s?.destroy(),s=null,e.replaceChildren(),e.hidden=!0,w.hidden=!1;let O=n.client.view;A(O)!==v?(q.set(v,structuredClone(n.answers)),n.resetScreen()):(q.delete(v),n.suspend(!1)),O&&await n.enqueue(O)}catch(O){if(d!==S||n.stopped)return;s?.destroy(),s=null,e.replaceChildren(),n.fail(O)}}return{get active(){return D},get receipt(){return a},open:V,exit:k,get drafts(){return new Map([...q].map(([d,O])=>[d,structuredClone(O)]))},stop(){D=!1,S++,u?.finish("dismissed"),s?.destroy(),s=null,e.replaceChildren(),e.hidden=!0,w.hidden=!1}}}function Mn(n){if(!n.client.pageExperiments)throw new Error("The Run controller does not support page experiments");let g=n.client.pageExperiments.bind(n.client),w=!1,e=!1,p=0,D=!1,a=!1,S="",s=()=>{let h=n.client.view;return JSON.stringify([h?.id,h?.source.versionId,h?.visit,h?.revision,h?.status,h?.stopped])},v=new Map,u=new Set,q={},A=new Map,V=Sn(n.appManifestRelease),k=()=>{for(let h of v.values())h.effect.revert();v.clear()},d=()=>{k();for(let h of A.values())h();A.clear()};function O(h){if(w||u.has(h))return;u.add(h);let _=p;g(n.appManifestRelease,[h]).catch(J=>{u.delete(h),!w&&_===p&&le(n.onError,J)})}async function F(){if(w)return;S=s();let h=n.client.view;if(!h||h.stopped||!["running","waiting"].includes(h.status)){p++,d();return}if(document.visibilityState==="hidden")return;if(D){a=!0;return}D=!0;let _=++p,J=`${h.id}:${h.visit}:${h.revision}`,z=location.href;try{let[L,{applyVisualVariation:de}]=await Promise.all([g(n.appManifestRelease),import("./visual-dom-6DCUZGPB.js")]),Y=n.client.view;if(w||_!==p||!Y||Y.stopped||!["running","waiting"].includes(Y.status)||`${Y.id}:${Y.visit}:${Y.revision}`!==J||location.href!==z)return;let ce=new Set,re=new Set;for(let T of L.assignments){let E=`${L.payload.environmentId}:${T.experimentKey}`;if(re.add(E),A.has(E)||A.set(E,On(E,q)),!!T.inExperiment)for(let i of L.payload.experiments){if(i.key!==T.experimentKey||!mn(location.href,i.urlPatterns??[]))continue;let l=i.meta?.findIndex(G=>G.key===T.variationKey)??-1,o=i.variations[l];if(!o?.renderGuard)continue;let c=T.receiptId+":"+i.changeId,y=JSON.stringify([T.variationKey,o]);ce.add(c);let I=v.get(c);if(I?.signature===y){I.effect.applied&&O(T.receiptId);continue}v.get(c)?.effect.revert(),v.delete(c);let B=de(o,{requireUniqueTargets:!0,boundVariations:i.variations,allowJs:!1,onApplied:()=>O(T.receiptId),onError:G=>le(n.onError,G)});v.set(c,{signature:y,effect:B}),B.applied&&O(T.receiptId)}}for(let[T,E]of v)ce.has(T)||(E.effect.revert(),v.delete(T));for(let[T,E]of A)re.has(T)||(E(),A.delete(T))}catch(L){_===p&&d(),!w&&_===p&&le(n.onError,L)}finally{D=!1,a&&!w&&(a=!1,F())}}let R=n.client.subscribe(()=>{if(s()===S)return;S=s(),p++;let h=n.client.view;(!h||h.stopped||!["running","waiting"].includes(h.status))&&d(),e&&F()}),M=Tn(()=>{p++,d(),e&&F()}),C=()=>{p++,k()};document.addEventListener("visibilitychange",C);let H=We({document,run:async()=>{e&&await F()},delay:()=>e&&!w?15e3:void 0});return{async start(){e||w||(e=!0,await H.refresh())},refresh:F,destroy(){w=!0,p++,H.destroy(),document.removeEventListener("visibilitychange",C),R(),M(),d(),V.destroy()}}}var sn=5e3;async function zn(n,g,w){let e=g,[{mountScreenPreview:p},{showPaywall:D}]=await Promise.all([import("./screen-renderer-3CBREMIS.js"),import("./paywall-XAXSMLDU.js")]),a=e.client.identitySignal;e.signal?.throwIfAborted(),a?.throwIfAborted();let S=e.appManifestRelease?Mn({client:e.client,appManifestRelease:e.appManifestRelease,onError:e.onError}):void 0;S?.start();let s=n.ownerDocument,v=En(s),u=s.createElement("section"),q=s.createElement("div"),A=s.createElement("div"),V=s.createElement("div"),k=s.createElement("button");V.hidden=!0,k.type="button";let d=s.createElement("p"),O=s.createElement("p"),F=s.createElement("button"),R=s.createElement("button"),M=s.createElement("button"),C=s.createElement("dialog"),H;u.dataset.indianaFunnel="",u.setAttribute("aria-busy","false"),d.setAttribute("role","status"),O.setAttribute("role","alert"),O.hidden=!0,F.type=R.type=M.type="button",A.append(F,k,d,O,M,R),u.append(q,V,A),n.append(u);let h=kn,_=rn(h),J="",z=(s.documentElement.lang||"").startsWith("zh"),L,de="",Y;for(let t of[F,k,M,R])_e(t,()=>_.focus);function ce(){let t=z?"\u5173\u95ED":"Close";R.parentElement===C?(R.textContent="\xD7",R.setAttribute("aria-label",t),Rn(R,h)):(R.textContent=t,R.removeAttribute("aria-label"),R.style.cssText=_.link+";margin-inline-start:auto")}function re(t){let r=t?.screen?.content.document.theme??h,f=JSON.stringify([r.primary,r.background,r.text,r.radius,r.font,R.parentElement===C]);f!==J&&(J=f,h=r,_=rn(h,R.parentElement===C),u.style.cssText=_.root+";min-width:0",A.style.cssText=_.bar,F.style.cssText=k.style.cssText=_.secondary,M.style.cssText=_.primary,d.style.cssText=_.status,O.style.cssText=_.alert,ce(),on(F))}function T(){A.hidden=F.hidden&&k.hidden&&M.hidden&&O.hidden&&!d.textContent&&(R.hidden||R.parentElement!==A),L?.responsive&&Y!==void 0&&L.setContentHeight(Y+A.getBoundingClientRect().height)}re();let E=null,i=null,l=null,o="",c="",y=!1,I="",B="",G="",b=!1,$=0,Re=!1,Ee="",Ke=null,Ye=Promise.resolve(),an=!e.client.view,W=w,qe,Oe,Le="",Ve,pe=!1,Ie=null,ye=!1,Me=()=>e.client.pendingCommand?.operation==="close",se=null,K=null,ln=We({document:s,run:async()=>{(!i?.observing||e.client.pendingCommand)&&await Ze()},delay:()=>{if(!(b||!l||!["running","waiting"].includes(l.status)&&!e.client.pendingCommand)&&!(i?.observing&&!e.client.pendingCommand))return l.pendingRequest||e.client.pendingCommand?1500:sn},hiddenDelay:()=>!b&&e.client.pendingCommand?15e3:void 0}),X=null;function Xe(){return K&&e.client.hasDurableJournal===!0&&X?.acknowledged===!0&&X.operationId===K.operationId&&e.client.view?.id===X.runId&&e.client.view?.status==="closed"&&e.client.view.revision===X.revision+1&&!(e.client.pendingCommands?.length??(e.client.pendingCommand?1:0))&&!e.client.pendingPurchase?K:null}function un(t){let r=t.run.paywall;if(X&&t.settlement?.requestId===X.requestId&&t.settlement.state==="settled"&&t.settlement.operationId===null&&t.run.id===X.runId&&t.run.status==="closed"&&!t.run.pendingRequest&&t.run.revision===X.revision+1&&t.run.nodeId===X.nodeId&&t.run.visit===X.visit&&r?.receiptId===X.receiptId&&r.selectionGeneration===X.selectionGeneration&&(r.quote?.operationId??null)===X.operationId&&(r.operation?.operationId??r.quote?.operationId??null)===X.operationId){let f=X.operationId===null&&r.selectionGeneration===0&&!r.quote&&!r.operation&&!r.purchaseRequestId,ne=ze({quote:r.quote,operation:r.operation,requestId:r.purchaseRequestId,pending:!1,destroyed:!1,canReselect:r.canReselect});(f||r.canReselect===!0&&ne.type==="native")&&(X.acknowledged=!0)}}let ke=null,He=new Set,fe={},Fe=!1,ue=(t,r=null)=>{b||(ke=r,Fe=!1,O.textContent=Fn(t,z),O.hidden=!1,M.hidden=e.client.pendingCommand===null,T(),le(e.onError,t))};function be(){let t=e.client.view;if(!t)throw new P("INVALID_REQUEST","No current Run is available");return{requestId:crypto.randomUUID(),nodeId:t.nodeId,visit:t.visit,revision:t.revision}}let U=Vn({client:e.client,doc:s,holder:q,reviewHolder:V,mountScreenPreview:p,loadingOptions:e,get chrome(){return _},get stopped(){return b},get answers(){return fe},suspend(t){i?.setSuspended(t)},resetScreen(){o="",c="",I=""},enqueue:me,fail:ue}),$e=_n({client:e.client,expected:be,fail:ue,get stopped(){return b},get reviewing(){return U.active},get key(){return o},get busy(){return $},get staleRead(){return Ke}}),Ue=Ln({client:e.client,expected:be,perform:Se,onIntent:e.onCustomerDataIntent,get stopped(){return b},get busy(){return $},get document(){return E?.document},get answers(){return fe}}),xe=t=>`${t.id}:${t.nodeId}:${t.visit}`,De=t=>t&&(t.screen||t.paywall)?xe(t):"";function Ce(){let t=e.client.view;F.disabled=!U.active&&($>0||!!e.client.pendingCommand||!t?.canBack||t.stopped||!["running","waiting"].includes(t.status)||!De(t)||c!==De(t)),F.hidden=!U.active&&!t?.canBack,on(F);let r=!!i&&!U.active;R.hidden=r&&!W?.active,k.hidden=!e.client.review||r&&!t?.canBack,r&&(d.textContent=""),T()}async function dn(t){if(!t)return;let r=e.client.view;await t;let f=e.client.view;if(!r||!f||f.id!==r.id||f.nodeId!==r.nodeId||f.visit!==r.visit||f.stopped||!["running","waiting"].includes(f.status))throw new P("PRECONDITION_FAILED","The screen changed while its display was acknowledged")}async function Se(t,r=!1){if(!(($||ye||se||K)&&!r||b||U.active&&!r)){$++,u.setAttribute("aria-busy","true"),O.hidden=!0,ke=null,Fe=!1,Ce();try{if(r||await dn($e.inFlight),b)return;let f=await t();b||await me(e.client.view??f.run)}catch(f){ue(f,e.client.pendingCommand?.requestId??null)}finally{$=Math.max(0,$-1),u.setAttribute("aria-busy",String($>0)),b||(M.hidden=e.client.pendingCommand===null,Ce())}}}function Ne(){ln.schedule()}async function Ze(){if(!(b||Re||$)){if(U.active){await U.open(U.receipt);return}Re=!0;try{let t=e.client.pendingCommand;t&&e.client.settle&&await e.client.settle(t.requestId);let r=e.client.view,f=Ue.queries,ne=await e.client.get(r?.screen&&Object.keys(f).length?{nodeId:r.nodeId,visit:r.visit,revision:r.revision,components:f}:void 0);Fe&&!b&&(Fe=!1,O.hidden=!0,T()),!b&&f===Ue.queries&&await me(e.client.view??ne.run)}catch(t){ue(t),Fe=!b}finally{Re=!1}}}function Ge(t,r){if(W?.active){let ne=W;return ne.setDismissHandler(()=>cn(ne)),ne}let f=je(n,e,"funnel",()=>cn(f));return W=f,f.start(t,r),f}function cn(t){b||pe||(pe=!0,t.finish("dismissed"),ve(),u.hidden=!0,e.client.view?Pe().finally(ae):ae())}function en(){clearTimeout(Ve?.timeout),Ve=void 0}function ve(){en(),qe?.abort(),qe=void 0,E?.destroy(),E=null,i?.destroy(),i=null,Oe?.(),Oe=void 0,C.open&&C.close(),q.replaceChildren(),q.style.cssText="",Y=void 0,o="",c="",y=!1,I="",G=""}function pn(){let t=s.defaultView;L?.responsive&&t&&E?.resizeViewport?.(t.innerHeight,t.innerWidth)}function nn(){L?.destroy(),L=void 0,de=""}function tn(t){let r=t.screen?.presentation;if(!r||r.type==="inline"){C.open&&C.close(),nn(),R.parentElement!==A&&A.append(R),u.parentElement!==n&&n.append(u),re(t),T();return}u.parentElement!==C&&(C.append(R,u),n.append(C)),re(t);let f=t.screen.content.document,ne=JSON.stringify([r,J]);if(ne!==de){nn(),de=ne;let ge={sm:420,md:640,lg:900},we="size"in r&&!r.backdrop?",0 0 0 100vmax #16142566":"";C.style.cssText=`box-sizing:border-box;padding:0;border:0;overflow:auto;background:${h.background};color:${h.text};`+(r.type==="fullscreen"?"width:100vw;height:100dvh;max-width:100vw;max-height:100dvh;margin:0;border-radius:0":`width:${ge[r.size]}px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);box-shadow:0 24px 80px #0003${we};`+(r.type==="sheet"?"margin:auto auto 0;border-radius:14px 14px 0 0":"border-radius:14px")),L=Cn(C,{presentation:r,theme:f.theme,pages:f.pages},pn),L.latch()}T(),C.setAttribute("aria-label",(H?.screen===t.screen?.content.document.name?H?.label:void 0)??E?.document?.name??t.screen?.content.document.name??"Funnel")}async function Hn(t){if(b||pe||ye&&(Me()||["running","waiting"].includes(t.status))||(l=t,ke&&e.client.pendingCommand?.requestId!==ke&&(O.hidden=!0,ke=null),z=t.locale.startsWith("zh"),k.textContent=z?"\u56DE\u770B":"History",F.textContent=U.active?z?"\u8FD4\u56DE\u5F53\u524D":"Return to current":z?"\u8FD4\u56DE":"Back",ce(),M.textContent=z?"\u91CD\u8BD5":"Retry",M.hidden=e.client.pendingCommand===null,d.textContent=t.pendingRequest?z?"\u6B63\u5728\u5904\u7406":"Processing":t.instruction?.type==="wait"?z?"\u7B49\u5F85\u4E2D":"Waiting":"",Ce(),Ee!==`${t.revision}:${t.visit}:${t.status}:${t.stopped}`&&(Ee=`${t.revision}:${t.visit}:${t.status}:${t.stopped}`,le(e.onState,structuredClone(t))),b||pe))return;if((!t.pendingRequest||ye&&t.status==="closed")&&["closed","ineligible","failed"].includes(t.status)){ae();return}if(t.stopped||e.client.configurationReady===!1){U.stop(),ve(),W?.finish("skipped"),u.hidden=!0,Ne();return}if(u.hidden=!1,U.active){Ne();return}let r=De(t),f=e.client.view;if(f&&f.revision>t.revision&&De(f)!==r)return;let ne=!t.instruction&&!t.pendingRequest&&t.nodeType==="screen"&&["running","waiting"].includes(t.status);r!==o&&(o&&W?.finish("dismissed"),ve(),o=r,fe={...t.answers},Ue.reset());let ge=xe(t);if(Le===ge){u.hidden=!0;return}if(ne&&!r){u.hidden=!0;let Q=Ge(!0,t.locale);!b&&!pe&&Ve?.key!==ge&&(en(),Ve={key:ge,timeout:setTimeout(()=>{let m=e.client.view;if(!Q.active||!m||xe(m)!==ge)return;Le=ge;let j=new Error("Funnel screen preparation timed out");Q.finish("error",j),ve(),ue(j)},Ae)}),Ne();return}en();let Z=Q=>{let m=e.client.view;return!b&&!pe&&!Ie&&!Q.aborted&&e.client.configurationReady!==!1&&!!m&&!m.stopped&&!["closed","ineligible","failed"].includes(m.status)&&De(m)===r},we=(Q,m)=>{Z(m)&&(Le=r,W?.finish("error",Q),ve(),u.hidden=!0,ue(Q))};if(r||(tn(t),t.instruction?.type!=="event"&&t.instruction?.type!=="open_url"&&W?.finish("skipped")),t.screen){let Q=t.screen.content;if(!E){let te=t.screen.presentation.type!=="inline",oe=Ge(te,t.locale);if(b||pe)return;let ie=(qe=new AbortController).signal;tn(t),Oe=te?qn(C):Be(u,n),E=p(q,{mode:"live",rendererUrl:e.client.webViewUrl,title:Q.document.name,...te?{hostPresentation:()=>L?.type??t.screen.presentation.type}:{},onResize:ee=>{Y=ee,L?.responsive&&L.setContentHeight(ee+A.getBoundingClientRect().height)},onAction(ee,he={},Gn={}){if(U.active||!Z(ie)||c!==r)return;fe={...fe,...Gn};let Jn=Object.fromEntries((t.screen?.inputs??[]).filter(({variable:Je})=>Object.hasOwn(fe,Je)).map(({variable:Je})=>[Je,fe[Je]]));Se(()=>e.client.submit({operation:"submit",...be(),input:{type:"screen",output:ee,answers:Jn,selection:he}}))},onAnswers:ee=>{U.active||!Z(ie)||c!==r||(fe={...fe,...ee})},onCustomerDataIntent:ee=>{U.active||!Z(ie)||c!==r||Ue.intent(ee).catch(ue)},onEscape:()=>{!Z(ie)||c!==r||U.active||se||K||Pe()},onError:ee=>{let he=new Error(ee);c===r?ue(he):we(he,ie)},onRendered:ee=>{if(!(!Z(ie)||c===r))try{oe.present(he=>{Oe?.(),Oe=void 0,ee&&(H={screen:Q.document.name,label:ee},C.setAttribute("aria-label",ee)),te&&(C.showModal(),L?.responsive&&C.focus({preventScroll:!0}),!he&&e.loading!=="host"&&Pn(C,L?.type??t.screen.presentation.type,L?.responsive)),c=r,y=te,Ce()}),Z(ie)&&$e.report(r)}catch(he){we(he,ie)}}}),pn()}let m={capabilities:t.screen.capabilities,customerData:t.screen.customerData,parameters:t.parameters,serverInput:{bindings:t.screen.inputs,answers:fe,values:t.screen.values}},j=JSON.stringify([Q,t.locale,m.parameters,t.screen.inputs,t.screen.values]);if(j!==I)E.update(Q.document,t.locale,m),I=j,B=JSON.stringify(m.capabilities),G=JSON.stringify(m.customerData);else{let te=JSON.stringify(m.capabilities);te!==B&&(E.updateCapabilities(m.capabilities),B=te),JSON.stringify(m.customerData)!==G&&(E.updateCustomerData(m.customerData),G=JSON.stringify(m.customerData))}let x=E;if(x)try{await(W?.wait(x.ready)??x.ready)}catch(te){qe&&we(te,qe.signal)}}else if(t.paywall&&!i){let Q=Ge(!0,t.locale);if(b||pe)return;let m=(qe=new AbortController).signal;tn(t);let j=await D(q,{loading:"host",signal:m,canInteract:()=>Z(m)&&!U.active&&!se&&!K,beforeAction:async()=>{$++;try{await dn($e.settled()),O.hidden=!0,ke=null,Fe=!1,T()}finally{$=Math.max(0,$-1)}},start:()=>An(e.client),onObservationChange:Ne,onPurchase:e.onPurchase,onCheckoutUrl:e.onCheckoutUrl,checkoutNavigation:e.checkoutNavigation,confirmOnHostedCheckout:e.confirmOnHostedCheckout,resolveOfferId:e.resolveOfferId,onEvent:e.onEvent,onOpenUrl:x=>e.onOpenUrl?e.onOpenUrl({receiptId:t.paywall.receiptId,url:x,openIn:"same_window"}):s.defaultView?.location.assign(x),onAction:async x=>{if(U.active)return;let te=await e.client.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:t.nodeId,visit:t.visit,revision:e.client.view?.revision??t.revision,input:{type:"screen",output:x,answers:{}}});await me(e.client.view??te.run)},onError:x=>{c===r?ue(x):we(x,m)}},{quoteError:x=>le(e.onError,x),present(x){Z(m)&&(Q.present(()=>{x(),c=r,y=!!q.querySelector("dialog[open]"),Ce()}),Z(m)&&$e.report(r))},async dismiss(){b||m.aborted||U.active||se||K||!ye&&!Z(m)||(ye=!0,await Pe())}}).catch(x=>(we(x,m),null));!Z(m)&&!(ye&&!b&&!m.aborted)?j?.host?.destroy():j&&(i=j.host,i?.setSuspended(U.active))}if(b||pe)return;Ce();let N=t.instruction;if(N&&(N.type==="open_url"||N.type==="event")&&!He.has(N.receiptId)){let Q=s.createElement("button");Q.type="button",Q.style.cssText=_.primary,_e(Q,()=>_.focus),q.style.cssText=_.stage,Q.textContent=N.type==="open_url"?`${z?"\u524D\u5F80":"Continue to"} ${new URL(N.url).host}`:z?"\u7EE7\u7EED":"Continue",Q.onclick=()=>{let m=be(),j=N.type==="open_url"&&!e.onOpenUrl&&N.openIn==="new_window"?$n(N.url):null;Se(async()=>{let x="success";if(N.type==="open_url")if(e.onOpenUrl)try{x=await e.onOpenUrl({receiptId:N.receiptId,url:N.url,openIn:N.openIn})===!1?"failed":"opened"}catch(oe){le(e.onError,oe),x="failed"}else x=N.openIn==="new_window"&&!j?"failed":"opened";if(N.type==="event"){if(!e.onEvent)throw new P("EVENT_HANDLER_REQUIRED","Provide the event handler");await e.onEvent(N.event)}if(b||e.client.view?.nodeId!==m.nodeId||e.client.view.visit!==m.visit)throw new P("PRECONDITION_FAILED","The client action visit changed");let te=await e.client.submit({operation:"submit",...m,input:{type:"client_action",receiptId:N.receiptId,outcome:x}});return He.add(N.receiptId),N.type==="open_url"&&!e.onOpenUrl&&N.openIn==="same_window"&&s.defaultView?.location.assign(N.url),te})},W?.active?W.present(()=>q.replaceChildren(Q)):q.replaceChildren(Q)}!t.pendingRequest&&t.status==="completed"&&!He.has(`complete:${t.id}`)&&(He.add(`complete:${t.id}`),le(e.onComplete,structuredClone(t))),Ne()}function $n(t){let r=s.defaultView?.open(t,"_blank")??null;return r&&(r.opener=null),r}function me(t){return Ce(),Ye=Ye.catch(()=>{}).then(async()=>{try{await Hn(t)}catch(r){throw W?.active&&(Le=xe(t),W.finish("error",r),ve(),u.hidden=!0),r}}),Ye}let Un=e.client.subscribe(t=>{if(!an){if(t.stopped&&y&&!ye){l=t,ae();return}!ye&&(t.stopped||e.client.configurationReady===!1||o&&c!==o&&(De(t)!==o||["closed","ineligible","failed"].includes(t.status)))&&(ve(),W?.finish("dismissed"),u.hidden=!0),me(t).catch(ue)}}),xn=e.client.subscribeError?.(ue);function Pe(t){if(Ie)return Ie;if(b||!t&&(se||K))return Promise.resolve();let r=!t&&Me();return!r&&e.client.view&&!["running","waiting"].includes(e.client.view.status)?(l=e.client.view,ae(),Promise.resolve()):(Ie=Se(async()=>{let f=r?await e.client.retry():await e.client.submit({operation:"close",...t??be()});return t&&un(f),f},!0).then(()=>{let f=e.client.view;f?.status==="closed"&&!Me()&&(l=f,ae())}).finally(()=>{Ie=null}),Ie)}function ae(){S?.destroy(),!b&&(b=!0,e.signal?.removeEventListener("abort",ae),a?.removeEventListener("abort",ae),W?.finish("dismissed"),ln.destroy(),Un(),xn?.(),ve(),nn(),U.stop(),C.remove(),u.remove(),v(),le(e.onDismiss,l?structuredClone(l):null))}F.onclick=()=>{if(!F.disabled){if(U.active){U.exit();return}Se(()=>e.client.submit({operation:"back",...be()}))}},k.onclick=()=>{U.open()},R.onclick=()=>{W?.active?W.dismiss():se||Pe()},M.onclick=()=>{Me()?Pe():Se(()=>e.client.retry())},C.addEventListener("cancel",t=>{t.preventDefault(),W?.active?W.dismiss():se||Pe()}),e.signal?.addEventListener("abort",ae,{once:!0}),a?.addEventListener("abort",ae,{once:!0});try{let t=e.client.view;if(t)((e.client.viewAgeMs??sn)>=sn||t.instruction?.type==="evaluate_segment")&&(Ke=Ze().finally(()=>{Ke=null})),await me(t);else{u.hidden=!0;let r=Ge(e.client.view?.screen?.presentation.type!=="inline",e.client.view?.locale);if(b||pe)throw new DOMException("Presentation cancelled","AbortError");let f=await r.wait(e.client.get(),Ae);an=!1,await me(e.client.view??f.run)}}catch(t){throw W?.finish("error",t),ae(),t}return{destroy:ae,refresh:Ze,get recovery(){let t=Xe();if(t)return t;if(!b&&!$&&!ye&&!se&&i){let r=i.recovery;if(r.type!=="native")return r}return{type:"recover",operationId:e.client.pendingPurchase?.operationId??e.client.view?.paywall?.quote?.operationId??K?.operationId??null,requestId:e.client.pendingCommand?.requestId??null}},prepareFallback(){if(se)return se;let t=Xe();if(t)return Promise.resolve(t);let r=e.client.pendingPurchase?.operationId??e.client.view?.paywall?.quote?.operationId??K?.operationId??null,f=()=>({type:"recover",operationId:r,requestId:e.client.pendingCommand?.requestId??null});if(e.client.hasDurableJournal!==!0){let N=i?.recovery;return Promise.resolve(N&&N.type!=="native"&&N.type!=="cancel"?N:f())}let ne=(e.client.pendingCommands??(e.client.pendingCommand?[e.client.pendingCommand]:[])).some(N=>N.operation==="close");if(b&&!(ne||K&&e.client.view?.status==="closed")||$||Re||Ie||U.active||!i&&!K&&!ne)return Promise.resolve(f());let ge=i,Z=(async()=>{try{if(!K&&ne){let m=await e.client.retry();return await me(e.client.view??m.run),f()}if(!K){let m=await ge.prepareFallback();if(m.type!=="native")return m;if(e.client.hasDurableJournal!==!0)return f();K=m}let N=e.client.pendingCommands??(e.client.pendingCommand?[e.client.pendingCommand]:[]);if(N.length){let m=N.find(x=>x.operation==="close");if(!m||!X||m.requestId!==X.requestId)return f();let j=await e.client.retry();un(j),await me(e.client.view??j.run)}else{let m=e.client.view,j=m?.paywall;if(!m||!j||j.selectionGeneration===void 0||(j.quote?.operationId??null)!==K.operationId||K.operationId!==null&&j.canReselect!==!0)return f();let x=j.selectionGeneration,te=await e.client.get();await me(e.client.view??te.run);let oe=e.client.view,ie=oe?.paywall;if(!oe||!ie||!["running","waiting"].includes(oe.status)||oe.stopped||oe.id!==m.id||oe.nodeId!==m.nodeId||oe.visit!==m.visit||ie.receiptId!==j.receiptId||ie.selectionGeneration!==x||(ie.quote?.operationId??null)!==K.operationId||K.operationId!==null&&ie.canReselect!==!0||e.client.pendingPurchase||(e.client.pendingCommands?.length??(e.client.pendingCommand?1:0)))return f();let ee=be();X={runId:oe.id,operationId:K.operationId,revision:ee.revision,requestId:ee.requestId,nodeId:oe.nodeId,visit:oe.visit,receiptId:ie.receiptId,selectionGeneration:x,acknowledged:!1},await Pe(ee)}let Q=Xe();return Q?(ae(),Q):f()}catch(N){return ue(N),f()}})();se=Z;let we=()=>{se===Z&&(se=null)};return Z.then(we,we),Z},review:U.open,exitReview:U.exit,get unappliedDrafts(){return U.drafts}}}function Vt(n,g,w){return zn(n,g,w)}export{Bn as a,Mn as b,zn as c,Vt as d};
|
package/dist/chunk-UHQGO6OR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s={name:"@tinkerlandai/longplay-sdk",version:"0.10.33",description:"Framework-independent Longplay SDK for customer identity, entitlements, credits, offers and growth surfaces.",license:"UNLICENSED",repository:{type:"git",url:"git+https://github.com/tinkerlandai/Indiana.git",directory:"packages/sdk"},engines:{node:">=22"},publishConfig:{access:"public",tag:"beta"},type:"module",sideEffects:!1,files:["dist","README.md","README.zh-CN.md","CHANGELOG.md","THIRD_PARTY_NOTICES.md"],exports:{"./react-native":{types:"./dist/react-native.d.ts","react-native":"./dist/react-native.js",import:"./dist/react-native.js",default:"./dist/react-native.js"},".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./popup":{types:"./dist/popup.d.ts",import:"./dist/popup.js"},"./server":{types:"./dist/server.d.ts",import:"./dist/server.js"},"./openrouter":{types:"./dist/openrouter.d.ts",import:"./dist/openrouter.js"},"./native-shell":{types:"./dist/native-shell.d.ts",import:"./dist/native-shell.js"},"./page":{types:"./dist/page.d.ts",import:"./dist/page.js"},"./visual":{types:"./dist/visual.d.ts",import:"./dist/visual.js"}},scripts:{build:"tsup",prepack:"pnpm run build",typecheck:"tsc --noEmit && tsc --noEmit -p tsconfig.test.json",lint:"node ../../scripts/ci/lint.mjs --workspace packages/sdk"},dependencies:{"@ai-sdk/provider":"4.0.26","@types/json-schema":"7.0.15","css-tree":"^3.2.1","dom-mutator":"0.7.0",dompurify:"^3.4.15",zod:"4.6.6"},devDependencies:{"@indiana/contracts":"workspace:*","@openrouter/sdk":"^1.4.25","@types/css-tree":"^3.2.0",ai:"7.0.136",tsup:"^8.5.1",typescript:"^5.9.3","whatwg-url-minimum":"0.2.0"},peerDependencies:{"@openrouter/sdk":"^1.4.25"},peerDependenciesMeta:{"@openrouter/sdk":{optional:!0}}};var i="https://api.longplayai.com";export{s as a,i as b};
|
package/dist/chunk-YTZQ5BMP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as h}from"./chunk-ILEDKSRQ.js";import{b as J}from"./chunk-FYQXSGRT.js";import{c as N,e as x}from"./chunk-JN6JEKWN.js";import{v as Q}from"./chunk-SCC3O2RD.js";import{a as j,f as H,g as K,h as B,i as F}from"./chunk-EHDHWYVJ.js";import{b as L}from"./chunk-BXPXJARS.js";import{b as U}from"./chunk-U2R7MG3J.js";import{a as M}from"./chunk-VYFSRHXM.js";import{qa as G}from"./chunk-N7YXDSQL.js";import{a as l}from"./chunk-X4W22IH6.js";import{a as W}from"./chunk-DSPLGTQI.js";async function ce(I,o){if(!M.test(o.customerToken))throw new l("INVALID_TOKEN","A verified Customer credential is required");if(I.session&&I.session.peek()!==o.customerToken)throw new l("SCOPE_MISMATCH","Paywall credential does not match the shared session");let u=h.resolvePaywall.request.parse({funnelId:o.funnelId,funnelVersionId:o.funnelVersionId,selector:o.paywallVersionId?{type:"version",versionId:o.paywallVersionId}:{type:"paywall",paywallId:o.paywallId},commerce:o.commerce,locale:o.locale,...o.requirement?{requirement:o.requirement}:{}}),S=U(I);I.session||S.identify(o.customerToken);let r=null,P=!1,D=new AbortController,s=null,c=null,v=null,w=null,R=null,d=null,f=null,A=0,O=null,_="",V=0,b=new Map,q=new Set;function g(){if(P)throw new l("IDENTITY_CHANGED","Paywall is closed")}function k(){let e=JSON.stringify([A,f!==null]);if(!O||e!==_){_=e;let t=Y(++V);O=t;let a=()=>{O===t&&(O=null)};t.then(a,a)}return O.then(t=>structuredClone(t))}async function Y(e){g();let t=h.resolvePaywall,a=await N(S.request,t,{...u,selector:r?{type:"version",versionId:r.id}:u.selector});J(u,a.paywall.check,a.scope);let i=await x(I,a.paywall);if(g(),o.paywallVersionId?i.id!==o.paywallVersionId:i.paywallId!==o.paywallId)throw new l("INVALID_RESPONSE","The requested Paywall changed");if(r&&(!H(i,r)||i.paywallId!==r.paywallId))throw new l("INVALID_RESPONSE","The pinned Paywall or Offering Version changed");if(e!==V)return structuredClone(r??i);r=i;for(let m of q)W(m,structuredClone(r));return structuredClone(r)}async function E(e){if(g(),w&&e!=="read")throw new l("COMMAND_PENDING","Wait for the original quote");if(!s)throw new l("INVALID_REQUEST","A quoted purchase is required");let t=s;if(e!=="read"){if(f){if(d===e)return f;throw new l("COMMAND_PENDING","Wait for the original purchase command")}if(d&&d!==e)throw new l("COMMAND_PENDING","Read the original purchase before changing an uncertain command");d=e,A++,V++}let a=d,i=A,m=e==="read"&&f===null,p=JSON.stringify([t.operationId,i,f!==null]);if(e==="read"&&b.has(p))return b.get(p).then(n=>structuredClone(n));let C=e==="read"?h.readSubscriptionOperation:h.attach,y=(async()=>{let n=await N(S.request,C,{operationId:t.operationId,...e==="read"?{}:{intent:e},...e==="confirm"&&t.merchantTerms?{merchantConfirmation:Q(t.merchantTerms)}:{}});return K(n.operation,{operationId:t.operationId,currency:u.commerce.currency},"The purchase operation changed"),g(),s?.operationId!==t.operationId?structuredClone(n.operation):(c=F(c,n.operation),(e!=="read"||m&&f===null)&&A===i&&d===a&&(d=null),structuredClone(c))})();if(e!=="read"){f=y;let n=()=>{f===y&&(f=null)};y.then(n,n)}else{b.set(p,y);let n=()=>{b.get(p)===y&&b.delete(p)};y.then(n,n)}return y.then(n=>structuredClone(n))}let T={signal:D.signal,get view(){return r?structuredClone(r):null},get quote(){return s?structuredClone(s):null},get operation(){return c?structuredClone(c):null},get webViewUrl(){return"bundled"},get recovery(){return j({quote:s,operation:c,requestId:R,pending:w!==null||d!==null,destroyed:P})},get pendingCancellation(){return!P&&d==="cancel"},refresh:k,subscribe(e){return P?()=>{}:(q.add(e),()=>q.delete(e))},async preview(e){if(g(),!r)throw new l("INVALID_REQUEST","Load the Paywall first");let t=r.document.buttons[e.actionId];if(t?.type!=="checkout")throw new l("INVALID_REQUEST","Choose an authored purchase action");let a=L(t.product,e.selection,r.capabilities);if(!a)throw new l("PRODUCT_UNAVAILABLE","Choose an available Product");let i=G(r.document.screen,a,e.selection,r.capabilities),m=h.previewAttach.request.parse({funnelId:u.funnelId,funnelVersionId:u.funnelVersionId,requestId:e.requestId,plans:[{productVersionId:a,...Object.keys(i).length?{featureQuantities:i}:{}}],provider:u.commerce.provider,currency:u.commerce.currency,...e.offerId?{offerId:e.offerId}:{},...e.nativeOffer?{nativeOffer:e.nativeOffer}:{}}),p=JSON.stringify(m);if(v&&v!==p&&(w||d||!c||c.status==="pending"))throw new l("COMMAND_PENDING","Finish or cancel the original purchase before changing it");if(v===p){if(w)return w;if(s)return structuredClone(s)}v!==p&&(s=null,c=null),v=p,R=m.requestId;let C=(async()=>{let y=h.previewAttach,n=await N(S.request,y,m);return g(),B(n.quote,{productVersionId:a,featureQuantities:i,currency:u.commerce.currency,provider:u.commerce.provider},"The purchase quote changed its selected Product or presentment"),s=n.quote,c=null,structuredClone(s)})();w=C;try{return await C}finally{w===C&&(w=null)}},confirm:()=>E("confirm"),cancel:()=>E("cancel"),read:()=>E("read"),destroy(){P||(P=!0,D.abort(),q.clear(),b.clear(),z?.(),S.dispose(),r=null,s=null,c=null,v=null,R=null)}},z=I.session?.subscribeIdentity(T.destroy);try{return await k(),T}catch(e){throw T.destroy(),e}}export{ce as a};
|
package/dist/content-CFX2L2BP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as se}from"./chunk-MPYJRLKB.js";import{a as Z,c as ee,e as te,f as ne,h as N,i as re,j as oe,l as ie}from"./chunk-BRAVNBCC.js";import{b as X}from"./chunk-EQPEUPMG.js";import{r as V}from"./chunk-NAZU3EEJ.js";import"./chunk-R23IGK5U.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-BXPXJARS.js";import"./chunk-U2R7MG3J.js";import"./chunk-VYFSRHXM.js";import{E as $,P as G,U as R,la as Y,ma as K}from"./chunk-N7YXDSQL.js";import"./chunk-MIBRUDIS.js";import{a as p}from"./chunk-X4W22IH6.js";import"./chunk-R4FDIYMN.js";import"./chunk-UHQGO6OR.js";import{b as u}from"./chunk-VF6QMMEA.js";import{a as h}from"./chunk-DSPLGTQI.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";var z=new WeakMap;function ce(s){let t={string:u.string(),number:u.number().finite(),boolean:u.boolean(),strings:u.array(u.string()),json:R}[s.type];return s.nullable?t.nullable():t}function ae(s,t){let f=u.record(u.string(),R).parse(s);if(Object.keys(f).length>40)throw new p("INVALID_REQUEST","Too many content inputs");for(let[m,r]of Object.entries(f))Y.parse({[m]:r});if(Object.keys(f).some(m=>!Object.hasOwn(t.inputs,m)))throw new p("INVALID_REQUEST","Undeclared content input");for(let[m,r]of Object.entries(t.inputs))if(Object.hasOwn(f,m))ce(r).parse(f[m]);else if(r.required)throw new p("INVALID_REQUEST",`Missing content input ${m}`);return f}async function Ae(s,t){return le(s,t,!1)}async function Se(s,t){return le(s,t,!0)}async function le(s,t,f){t.signal?.throwIfAborted();let m=X.parse(t.content),r=m.document;if(t.closeControl==="content"&&!r.screen.actions.some(e=>e.type==="event"&&e.close))throw new p("INVALID_REQUEST","An authored Close control requires a declared Close action");if(z.has(s))throw new p("CONFLICT","Content is already mounted in this container");let y=ae(t.inputs??{},r.contract),T=new Set(u.array(u.string()).max(40).parse(t.mutableInputs??[]));if(T.size!==(t.mutableInputs?.length??0)||[...T].some(e=>!Object.hasOwn(r.contract.inputs,e)))throw new p("INVALID_REQUEST","Mutable content inputs must name unique declared inputs");for(let e of Object.keys(r.contract.outputs))if(typeof t.actions[e]!="function")throw new p("INVALID_REQUEST",`Missing host handler for ${e}`);let M=K.parse(t.bindings??[]),d=s.ownerDocument,ue=s.clientHeight||d.defaultView?.innerHeight||800,P,w,a,_,x=r.kind==="popup",n=x?d.createElement("dialog"):null,c=d.createElement("div");if(c.dataset.indianaContent=r.kind,c.setAttribute("aria-label",r.name),c.style.cssText="width:100%;min-width:0",n){n.setAttribute("aria-label",r.name);let e=r.screen.presentation;n.style.cssText="box-sizing:border-box;padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto",e.type==="modal"||e.type==="sheet"?(n.style.width=`${$[e.size]}px`,e.type==="sheet"&&(n.style.margin="auto auto 0")):n.style.width="100vw",a=ee(n,r.screen,()=>{w?.resizeViewport(d.defaultView?.innerHeight||800,d.defaultView?.innerWidth||1024)}),n.append(c),s.append(n)}else s.append(c);let i=!1,A=!1,E=!1,S=!1,de=n?re(n):oe(c,s),D=ie(s,t,r.kind,()=>{k()&&(b(),h(t.onDismiss))}),q,H,L=new Promise((e,o)=>{q=e,H=o});L.catch(()=>{});let g=null,I=structuredClone(r.screen),W=G(I,[t.locale,...d.defaultView?.navigator.languages??[]]),j=t.capabilities;I.actions=I.actions.map(e=>e.type==="event"?{...e,close:!1}:e);function b(){i||(i=!0,t.signal?.removeEventListener("abort",b),D.finish("dismissed"),H(new Error("Content preparation cancelled")),a?.destroy(),_?.(),w?.destroy(),n?.close(),n?.remove(),c.remove(),z.delete(s),n&&P?.())}let v=()=>{!E||!k()||(b(),h(t.onDismiss))};function k(){try{return t.canDismiss?.()!==!1}catch(e){return h(t.onError,e),!1}}if(n&&t.closeControl!=="content"){let e=d.createElement("button");e.type="button",e.textContent="\xD7",e.setAttribute("aria-label",t.locale?.startsWith("zh")?"\u5173\u95ED":"Close"),ne(e,r.screen.theme),e.addEventListener("click",v),n.prepend(e)}n&&a?.responsive&&(_=Z(n,v,k,t.locale?.startsWith("zh")?"\u5173\u95ED":"Close"),n.addEventListener("click",e=>{if(e.target!==n)return;let o=n.getBoundingClientRect();(e.clientX<o.left||e.clientX>o.right||e.clientY<o.top||e.clientY>o.bottom)&&v()})),n?.addEventListener("cancel",e=>{e.preventDefault(),v()}),n?.addEventListener("keydown",e=>{e.key==="Escape"&&(e.preventDefault(),v())});async function F(){if(i||!E||A||!g)return;let e=g;A=!0,c.setAttribute("aria-busy","true");try{await t.actions[e.actionId](structuredClone(e)),g=null}catch(o){i||h(t.onError,o)}finally{A=!1,i||c.removeAttribute("aria-busy")}}function J(){if(i)throw new p("CONFLICT","Content host has been destroyed");E||!S||(P??=N(d),D.present(e=>{de(),n&&(a?.latch(),n.showModal(),a?.responsive&&n.focus({preventScroll:!0}),!e&&t.loading!=="host"&&te(n,a?.type??r.screen.presentation.type,a?.responsive)),E=!0}))}function U(e){D.finish("error",e),H(e instanceof Error?e:new Error(String(e))),b()}let Q={destroy:b,show:J,get pendingAction(){return g?structuredClone(g):null},retryAction:F,updateInputs(e){if(i)throw new p("CONFLICT","Content host has been destroyed");let o=u.record(u.string(),R).parse(e),C=ae({...y,...o},r.contract);for(let l of Object.keys(o))if(!T.has(l)&&(!Object.hasOwn(y,l)||V(y[l])!==V(C[l])))throw new p("PRECONDITION_FAILED","This content input is frozen; prepare a new presentation");V(y)!==V(C)&&(w?.update(I,W,{capabilities:j,serverInput:{bindings:M,answers:{},values:C}}),y=C)},updateCapabilities(e){if(i)return;let o=structuredClone(e);w?.updateCapabilities(o),j=o}};z.set(s,Q),t.signal?.addEventListener("abort",b,{once:!0});try{if(t.signal?.throwIfAborted(),f||(P=N(d),D.start(x,t.locale??r.screen.strings.defaultLocale),i&&await L),w=se(c,{mode:"live",rendererUrl:t.rendererUrl,title:r.name,viewportHeight:r.kind==="page"?ue:a?.responsive?d.defaultView?.innerHeight||800:void 0,...a?.responsive?{viewportWidth:d.defaultView?.innerWidth||1024,hostPresentation:()=>a.type}:{},onResize:e=>{i||a?.responsive&&(c.style.height=`${e}px`,c.style.overflow="clip",a.setContentHeight(e))},onRendered:e=>{if(!i&&(e&&n?.setAttribute("aria-label",e),!S))try{S=!0,f||J(),q()}catch(o){U(o),h(t.onError,o)}},onError:e=>{if(i)return;let o=new Error(e);S||U(o),h(t.onError,o)},onEscape:x?v:void 0,onAction:(e,o,C)=>{if(i||!E||A||g)return;let l=r.screen.actions.find(O=>O.id===e),B=r.contract.outputs[e];if(!(l?.type!=="event"||!B)&&!(l.close&&!k()))try{let O=ce(B).parse(Object.hasOwn(l.properties,"value")?l.properties.value:l.properties);g=structuredClone({requestId:crypto.randomUUID(),contentVersionId:m.id,actionId:e,event:l.event,value:O,selection:o??{},answers:C??{},requestedClose:l.close}),F()}catch(O){h(t.onError,O)}}}),w.update(I,W,{capabilities:j,serverInput:{bindings:M,answers:{},values:y}}),await Promise.race([w.ready,L]),f&&await L,i)throw new Error("Content preparation cancelled");return Q}catch(e){throw U(e),e}}export{Ae as mountContent,Se as prepareContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as I}from"./chunk-NVIHK5GE.js";import{d as p}from"./chunk-U6GWWCUS.js";import"./chunk-HQPP76BS.js";import{k as A,l as F}from"./chunk-BRAVNBCC.js";import"./chunk-GGRDM54V.js";import"./chunk-UWLEGMWX.js";import"./chunk-U6E6CM7Z.js";import"./chunk-JN6JEKWN.js";import"./chunk-THMGTRXP.js";import"./chunk-NAZU3EEJ.js";import"./chunk-SCC3O2RD.js";import"./chunk-R23IGK5U.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-EHDHWYVJ.js";import"./chunk-BXPXJARS.js";import"./chunk-U2R7MG3J.js";import"./chunk-VYFSRHXM.js";import"./chunk-N7YXDSQL.js";import"./chunk-MIBRUDIS.js";import{a as c}from"./chunk-X4W22IH6.js";import"./chunk-R4FDIYMN.js";import"./chunk-SLUA7ABW.js";import"./chunk-KIMX3OIV.js";import"./chunk-3VUPVXAV.js";import"./chunk-UHQGO6OR.js";import"./chunk-VF6QMMEA.js";import{a as o}from"./chunk-DSPLGTQI.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";var d=new WeakMap;function k(m,e){let g=d.get(e.client);if(g)return g;let h=Promise.resolve().then(async()=>{let n=!1,a,w,P=!1,y=()=>{},t=e.signal?AbortSignal.any([e.signal,e.client.identitySignal]):e.client.identitySignal,u=()=>{d.get(e.client)===h&&d.delete(e.client),t.removeEventListener("abort",f),y()},i=F(m,e,"funnel",f);function f(){n||(n=!0,i.finish("dismissed"),a?a.destroy():(u(),o(e.onDismiss,null)))}t.addEventListener("abort",f,{once:!0});try{let b=function(){!n&&!t.aborted&&!P&&w&&e.client.recovery.status==="complete"&&(P=!0,o(e.onComplete,structuredClone(w)))};var D=b;t.throwIfAborted();let l=e.client.controller?.view?.paywall?.resolution,E=l&&"document"in l?l.document:e.loadingDocument;if(i.start(!0,e.start?.locale??e.client.attempt?.locale??E?.screen.strings.defaultLocale,E??null),n)return null;t.throwIfAborted();let v=await i.wait(e.start?e.client.start(e.start):e.client.refresh(),A);t.throwIfAborted();let O=e.client.controller;return v.mode!=="run"||v.status==="blocked"||!O?(i.finish("skipped"),u(),null):(t.removeEventListener("abort",f),y=e.client.subscribe(b),a=await p(m,{...e,client:O,signal:t,checkoutNavigation:"after_confirmation",onCheckoutUrl(r){if(t.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");if(I(e.client.recovery)!==r)throw new c("PURCHASE_PENDING","Checkout differs from the original recovery proof");return e.onCheckoutUrl?e.onCheckoutUrl(r):m.ownerDocument.defaultView?.location.assign(r)},async resolveOfferId(r){if(t.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");let s=e.client.attempt;if(!s)throw new c("PURCHASE_PENDING","Read the original Start before selecting an offer");let C=await e.resolveOfferId?.(r,s);if(t.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");if(e.client.attempt?.requestId!==s.requestId)throw new c("PURCHASE_STORAGE_CONFLICT","The original purchase changed while selecting an offer");return C},onComplete(r){w=r,b()},onError(r){o(e.onError,r),r instanceof c&&r.status===401&&!t.aborted&&e.client.refresh().catch(s=>o(e.onError,s))},onDismiss(r){n=!0,u(),o(e.onDismiss,r)}},i),n||t.aborted?(a.destroy(),null):a)}catch(l){if(n)return null;throw i.finish("error",l),u(),o(e.onError,l),l}});return d.set(e.client,h),h}export{k as showFunnelPurchase};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as a,d as b}from"./chunk-U6GWWCUS.js";import"./chunk-HQPP76BS.js";import"./chunk-BRAVNBCC.js";import"./chunk-R23IGK5U.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-EHDHWYVJ.js";import"./chunk-BXPXJARS.js";import"./chunk-U2R7MG3J.js";import"./chunk-VYFSRHXM.js";import"./chunk-N7YXDSQL.js";import"./chunk-MIBRUDIS.js";import"./chunk-X4W22IH6.js";import"./chunk-R4FDIYMN.js";import"./chunk-SLUA7ABW.js";import"./chunk-KIMX3OIV.js";import"./chunk-UHQGO6OR.js";import"./chunk-VF6QMMEA.js";import"./chunk-DSPLGTQI.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";export{a as showFunnelRun,b as showObservedFunnelRun};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{N as r,O as m,h as e}from"./chunk-SCC3O2RD.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-VYFSRHXM.js";import"./chunk-MIBRUDIS.js";import"./chunk-R4FDIYMN.js";import"./chunk-VF6QMMEA.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";export{m as merchantBridgeCommerceSchema,r as merchantBridgeOperationSchema,e as merchantOperationLookupSchema};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as o}from"./chunk-ILEDKSRQ.js";import"./chunk-EQPEUPMG.js";import"./chunk-7MNJH5GB.js";import"./chunk-THMGTRXP.js";import"./chunk-NAZU3EEJ.js";import"./chunk-SCC3O2RD.js";import"./chunk-R23IGK5U.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-BXPXJARS.js";import"./chunk-5HJYR6Z4.js";import"./chunk-VYFSRHXM.js";import"./chunk-N7YXDSQL.js";import"./chunk-MIBRUDIS.js";import"./chunk-R4FDIYMN.js";import"./chunk-VF6QMMEA.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
|
package/dist/paywall-XAXSMLDU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as at,c as De,e as ot,g as st,h as lt}from"./chunk-HQPP76BS.js";import{d as Xe,e as Ze,f as et,h as tt,i as nt,j as rt,k as pe,l as it}from"./chunk-BRAVNBCC.js";import{a as Ge,c as Se,d as Ye,g as Je,j as Ke}from"./chunk-EHDHWYVJ.js";import{b as ee}from"./chunk-BXPXJARS.js";import"./chunk-U2R7MG3J.js";import"./chunk-VYFSRHXM.js";import{c as Z,o as ne,oa as re,qa as Oe}from"./chunk-N7YXDSQL.js";import{c as Te}from"./chunk-MIBRUDIS.js";import{a as k}from"./chunk-X4W22IH6.js";import"./chunk-R4FDIYMN.js";import"./chunk-UHQGO6OR.js";import"./chunk-VF6QMMEA.js";import{a as z}from"./chunk-DSPLGTQI.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";async function ct(T,i,N){if(i.status!=="complete")throw new k("INVALID_RESPONSE","A verified completed purchase is required");let O=T?ne.parse(T):null;if(await N.onComplete?.(i),!O||!N.check)return;let S=ne.parse(await N.check());if(S.internal_feature_id!==O.internal_feature_id||S.quantity!==O.quantity||O.observation!==void 0&&(S.observation===void 0||S.observation.requirementDigest!==O.observation.requirementDigest||S.observation.authority!==O.observation.authority||Te(S.observation.subject)!==Te(O.observation.subject)))throw new k("INVALID_RESPONSE","The access requirement changed");S.allowed&&await N.onAccessGranted?.(S)}function Ne(T){return Object.entries(T.document.buttons).filter(([,i])=>i.type==="checkout"&&i.product.type==="fixed"&&!ee(i.product,{},T.capabilities)).map(([i])=>i)}async function zt(T,i,N){let O=tt(T.ownerDocument),S=()=>{C.finish("dismissed"),O()},j=()=>S(),C=it(T,i,"paywall",()=>{S(),z(i.onDismiss)});i.signal?.throwIfAborted(),i.signal?.addEventListener("abort",j,{once:!0});let G=null,_,m,Le;try{let e=i.loadingDocument;if(C.start(!0,e?.screen.strings.defaultLocale,e??null),C.cancelled)throw new DOMException("Presentation cancelled","AbortError");if(G=i.check?ne.parse(await C.wait(i.check(),pe)):null,G?.allowed)return C.finish("skipped"),i.signal?.removeEventListener("abort",j),O(),await i.onAccessGranted?.(G),{check:G,host:null};let[t,n]=await Promise.allSettled([C.wait(import("./screen-renderer-3CBREMIS.js")),C.wait(i.start().then(r=>(C.cancelled&&r.destroy(),r)),pe)]);if(t.status==="rejected")throw n.status==="fulfilled"&&n.value.destroy(),t.reason;if(n.status==="rejected")throw n.reason;Le=t.value,_=n.value,i.signal?.throwIfAborted(),_.signal?.throwIfAborted(),_.signal?.addEventListener("abort",j,{once:!0});let s=_.view??await C.wait(_.refresh(),pe);if(!s)throw new k("INVALID_RESPONSE","Paywall presentation is missing");_.signal?.throwIfAborted(),m=s}catch(e){throw C.finish("error",e),i.signal?.removeEventListener("abort",j),_?.signal?.removeEventListener("abort",j),_?.destroy(),O(),e}let a=_,{mountScreenPreview:ut}=Le,d=T.ownerDocument,fe=new AbortController,I=d.createElement("section"),Y=d.createElement("div"),U=d.createElement("div"),u=d.createElement("p"),w=d.createElement("button"),h=d.createElement("button"),b=d.createElement("dialog"),o=m.document.screen.strings.defaultLocale.startsWith("zh"),dt=o?"\u6B63\u5728\u5904\u7406\u2026":"Processing\u2026",pt=o?"\u6B63\u5728\u51C6\u5907\u62A5\u4EF7\u2026":"Preparing your price\u2026",P=at(m.document.screen.theme);I.dataset.indianaPaywall="",I.setAttribute("aria-label",m.document.name),I.style.cssText=P.root,U.style.cssText=P.controls,u.style.cssText=P.message,u.setAttribute("role","status"),h.style.cssText=P.link,h.textContent=o?"\u5173\u95ED":"Close",w.style.cssText=P.secondary,w.textContent=o?"\u91CD\u8BD5":"Retry",w.hidden=!0,U.append(u,w,h),I.append(Y,U);let Me=()=>{let e=H??U,t=[...e.children].every(s=>s===u?!u.textContent:s.hidden),n=[...e.children].some(s=>s===h?!1:s===u?!!u.textContent:!s.hidden);e.style.cssText=t?P.controls.replace(/padding:[^;]+/,"padding:0"):n?`${P.controls};${P.pinned}`:P.controls,we()},_e=typeof MutationObserver>"u"?void 0:new MutationObserver(Me);_e?.observe(I,{attributes:!0,attributeFilter:["hidden"],characterData:!0,childList:!0,subtree:!0});let ie=m.document.presentation,ft=Object.entries(m.document.buttons).filter(([,e])=>e.type==="close").map(([e])=>e),B,Ue,me=!1,$e=JSON.stringify(m.capabilities),qe=e=>J?Object.entries(e.document.buttons).filter(([,t])=>t.type==="checkout").map(([t])=>t):Ne(e);function he(e){if(p)return;m=e;let t=JSON.stringify(e.capabilities);t!==$e&&(B?.updateCapabilities(e.capabilities,qe(e)),$e=t),ht(e)}let g,ye=0;function we(){let e=d.defaultView;if(!g?.responsive||!e)return;let t=H??U,n=e.innerHeight-(g.type==="modal"?32:0);t.style.maxHeight=`${Math.max(1,n)}px`,t.style.overflowY="auto",t.style.flexShrink="0",ye=Math.max(1,n-t.getBoundingClientRect().height),B?.resizeViewport?.(ye,e.innerWidth)}let p=!1,J=!1,E=null,ae=!1,Ve=!1,F=!1,be,ge=!1,$,H;function mt(){return J||p||$||ge?{type:"recover",operationId:a.operation?.operationId??a.quote?.operationId??null,requestId:null}:Se(a)}let R=()=>!p&&!ae&&!$&&i.canInteract?.()!==!1,oe=!1,c=null,q=null;function ht(e){J||E||a.quote||a.operation||(u.textContent=Object.values(e.capabilities.plans).some(t=>t.available)?"":o?"\u5F53\u524D\u8D26\u53F7\u6682\u65E0\u53EF\u8D2D\u4E70\u7684\u65B9\u6848\u3002":"No plans are currently available for this account.")}let ve=new Map,Ce=!1;function yt(e,t,n,s){let r=e.lines.length===1?e.lines[0]:void 0,y=ee(n,s,t.capabilities);if(!r||!y||r.productVersionId!==y)return!1;let x;try{x=Oe(t.document.screen,y,s,t.capabilities)}catch{return!1}let A=Object.fromEntries((r.prepaid??[]).map(W=>[W.internal_feature_id,W.quantity]));return[...new Set([...Object.keys(x),...Object.keys(A)])].every(W=>(x[W]??0)===(A[W]??0))}let se=e=>Ge({quote:a.quote,operation:e,requestId:null,pending:!1,destroyed:p,canReselect:a.canReselect});async function Pe(e){let t=e.merchantExecution;if(!(!R()||!e.checkoutUrl||i.checkoutNavigation==="after_confirmation"&&se(e).type!=="checkout"||t?.type==="purchase"&&!["not_started","pending"].includes(t.paymentStatus)||ve.get(e.operationId)===e.checkoutUrl)){ve.set(e.operationId,e.checkoutUrl);try{i.onCheckoutUrl?await i.onCheckoutUrl(e.checkoutUrl):d.defaultView?.location.assign(e.checkoutUrl)}catch(n){throw ve.delete(e.operationId),n}}}let Q=(e,t=!1)=>{if(t){let n=e instanceof k?e.code:void 0;n==="CAPABILITY_UNAVAILABLE"||n==="NOT_CONFIGURED"?(c=null,u.textContent=o?"\u6682\u65F6\u65E0\u6CD5\u4E3A\u6B64\u5957\u9910\u62A5\u4EF7\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002":"Pricing for this plan is unavailable. Payment hasn\u2019t started."):a.canReselect===!0&&!E?u.textContent=o?"\u672A\u80FD\u53D6\u5F97\u62A5\u4EF7\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002\u8BF7\u91CD\u65B0\u9009\u62E9\u5957\u9910\u3002":"We couldn\u2019t prepare your price. Payment hasn\u2019t started. Choose a plan again.":n==="COMMAND_PENDING"?u.textContent=o?"\u4ECD\u5728\u51C6\u5907\u62A5\u4EF7\uFF0C\u8BF7\u91CD\u8BD5\u4EE5\u67E5\u770B\u7ED3\u679C\u3002":"Your price is still being prepared. Retry to check the result.":u.textContent=o?"\u672A\u80FD\u53D6\u5F97\u62A5\u4EF7\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002\u8BF7\u91CD\u8BD5\u3002":"We couldn\u2019t prepare your price. Payment hasn\u2019t started. Try again."}else u.textContent=e instanceof k&&(e.code==="NETWORK_ERROR"||e.code==="TIMEOUT")?ot(e,o):e instanceof k?e.message:o?"\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002":"This action couldn\u2019t be completed. Try again.";w.hidden=c===null,t&&!g?.responsive&&u.scrollIntoView?.({block:"nearest"}),z(t&&N?.quoteError?N.quoteError:i.onError,e)},le=new WeakMap;function ce(e){J=e,B?.updateCapabilities?.(m.capabilities,qe(m));for(let t of q?.querySelectorAll("button")??[])e?(le.set(t,t.disabled),t.disabled=!0):le.has(t)&&(t.disabled=le.get(t),le.delete(t)),De(t)}function Ee(){u.textContent=o?"\u6682\u65F6\u65E0\u6CD5\u64CD\u4F5C\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"This action is unavailable right now. Try again in a moment."}async function wt(e){if(i.beforeAction)try{await i.beforeAction()}catch(t){throw c=e,t}}async function V(e){if(J||p)return;if(!R()){Ee();return}let t=e===ue,n=t?pt:dt;ce(!0),w.hidden=!0,u.textContent=n;try{if(await wt(e),p)return;if(!R()){c=e,w.hidden=!1,Ee();return}await e()}catch(s){p||Q(s,t)}finally{ce(!1),u.textContent===n&&(u.textContent="")}}async function bt(e){await ct(G,e,i)}function He(e){return Se(a).type==="recording"||se(e).type==="recording"}function je(e){let t=e.merchantTerms,n=t?.subscriptionTerms?.items??[],s=t?t.totalMinor:e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),r=t?n.length===1&&n[0]?.amountMinor===s&&n[0]:e.lines.length===1&&e.lines[0]?.catalogAmountMinor===s&&e.lines[0],y=s===null?Z(t.subtotalMinor-t.discountMinor,e.currency)+(o?" + \u5F85\u786E\u8BA4\u7A0E\u8D39":" + tax confirmed at checkout"):Z(s,e.currency)+(r?re(r.interval,o?"zh-CN":"en",r.intervalCount??1):""),x=e.lines.map(A=>A.productName).join(", ");return{label:x?`${x} \xB7 ${y}`:y,recurring:r}}async function D(e,t=i.checkoutNavigation!=="after_confirmation"){if(p)return;if(!R()){c=async()=>D(await a.read()),w.hidden=!1;return}if(u.textContent=lt(e.status,o),He(e)){let r=e.merchantExecution?.type==="purchase"&&e.merchantExecution.recordingStatus==="failed";u.textContent=r?o?"\u4ED8\u6B3E\u548C\u5546\u6237\u5904\u7406\u5DF2\u5B8C\u6210\uFF0C\u4F46\u4EA4\u6613\u8BB0\u5F55\u5931\u8D25\u3002\u8BF7\u8054\u7CFB\u5546\u6237\u4FEE\u590D\uFF0C\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"Payment and fulfillment succeeded, but recording failed. Contact the merchant to repair this purchase; do not buy again.":o?"\u4ED8\u6B3E\u548C\u5546\u6237\u5904\u7406\u5DF2\u5B8C\u6210\uFF0C\u6B63\u5728\u786E\u8BA4\u4EA4\u6613\u8BB0\u5F55\u3002\u8BF7\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"Payment and merchant fulfillment are complete. Recording is pending confirmation; do not purchase again.",w.textContent=o?"\u67E5\u8BE2\u8BB0\u5F55":"Check recording",c=async()=>D(await a.read()),w.hidden=!1;return}if(e.problem){let r=e.problem;c=te,w.textContent=o?"\u68C0\u67E5\u5E76\u6062\u590D\u539F\u64CD\u4F5C":"Check and recover original purchase",Q(new k(r.code,r.reason==="RESULT_UNKNOWN"?o?"\u4ED8\u6B3E\u7ED3\u679C\u5C1A\u672A\u786E\u5B9A\uFF0C\u8BF7\u6062\u590D\u539F\u64CD\u4F5C\uFF0C\u6682\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"The payment result is unknown. Recover the original purchase before buying again.":r.phase==="fulfillment"?o?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u5546\u6237\u6743\u76CA\u5904\u7406\u9700\u8981\u6838\u5BF9\u3002":"Payment was recorded. Access fulfillment needs attention.":r.code==="CAPABILITY_UNAVAILABLE"?o?"\u5546\u6237\u5C1A\u4E0D\u652F\u6301\u672C\u6B21\u8D2D\u4E70\u6240\u9700\u7684\u5B8C\u6574\u80FD\u529B\uFF0C\u8BF7\u5904\u7406\u540E\u6062\u590D\u539F\u64CD\u4F5C\u3002":"The merchant does not currently support all actions required by this purchase. Recover the original purchase after this is resolved.":r.code==="NOT_CONFIGURED"?o?"\u4ED8\u6B3E\u670D\u52A1\u8FDE\u63A5\u9700\u8981\u5904\u7406\uFF0C\u8BF7\u8054\u7CFB\u5546\u6237\u540E\u6062\u590D\u539F\u64CD\u4F5C\u3002":"The payment connection needs attention. Contact the merchant, then recover the original purchase.":o?"\u539F\u8D2D\u4E70\u64CD\u4F5C\u9700\u8981\u5904\u7406\uFF0C\u8BF7\u67E5\u8BE2\u6216\u6062\u590D\u6B64\u64CD\u4F5C\u3002":"The original purchase needs attention. Check or recover this operation.",void 0,void 0,r));return}if(e.merchantExecution?.type==="purchase"&&e.merchantExecution.paymentStatus==="succeeded"&&!["applied","not_applicable"].includes(e.merchantExecution.fulfillmentStatus)&&(u.textContent=o?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u6B63\u5728\u7B49\u5F85\u5546\u6237\u5B8C\u6210\u5904\u7406\u3002":"Payment was recorded. Waiting for merchant fulfillment."),e.status==="complete"){c=null,await bt(e);return}if(e.status!=="pending"){if(a.canReselect===!1){u.textContent=o?"\u6B63\u5728\u6838\u5BF9\u539F\u8D2D\u4E70\u7ED3\u679C":"Checking the original purchase result",w.textContent=o?"\u67E5\u8BE2\u7ED3\u679C":"Check result",c=async()=>D(await a.read()),w.hidden=!1;return}e.status==="cancelled"?u.textContent=o?"\u8FD9\u7B14\u8D2D\u4E70\u5DF2\u53D6\u6D88\uFF0C\u53EF\u4EE5\u91CD\u65B0\u9009\u62E9\u65B9\u6848\u3002":"This purchase was cancelled. Choose a plan to start again.":e.status==="failed"&&(u.textContent=o?"\u8FD9\u7B14\u8D2D\u4E70\u672A\u80FD\u5B8C\u6210\uFF0C\u53EF\u4EE5\u91CD\u65B0\u9009\u62E9\u65B9\u6848\u3002":"This purchase didn\u2019t go through. Choose a plan to try again."),w.textContent=o?"\u91CD\u8BD5":"Retry",c=null,E=null;return}if(!t&&se(e).type==="checkout"){let r=a.quote,y=r?.operationId===e.operationId?je(r).label:"";u.textContent=Ce?y?o?`${y} \u5C1A\u672A\u4ED8\u6B3E\u3002\u518D\u6B21\u9009\u62E9\u8BE5\u65B9\u6848\u5373\u53EF\u7EE7\u7EED\u4ED8\u6B3E\u3002`:`${y} is still unpaid. Choose it again to continue paying.`:o?"\u4E4B\u524D\u7684\u8D2D\u4E70\u5C1A\u672A\u4ED8\u6B3E\u3002\u518D\u6B21\u9009\u62E9\u8BE5\u65B9\u6848\u5373\u53EF\u7EE7\u7EED\u4ED8\u6B3E\u3002":"Your earlier purchase is still unpaid. Choose that plan again to continue paying.":"",Ce=!1,c=null;return}await Pe(e);let n=Date.now()+6e5,s=2e3;me=!0,z(i.onObservationChange,!0);try{for(;!p&&Date.now()<n;){if(await st(s,d,fe.signal),p)return;if(!R()){c=async()=>D(await a.read()),w.hidden=!1;return}let r=await a.read();if(!t&&se(r).type==="checkout"){await D(r,!1);return}if(!r.problem&&r.status==="pending"&&await Pe(r),r.status!=="pending"||r.problem||He(r)){await D(r);return}s=Math.min(s*1.5,3e4)}}finally{me=!1,z(i.onObservationChange,!1)}c=async()=>D(await a.read()),w.hidden=!1}async function xe(e=!1){let t=await a.read();if(p)return;if(!R()){c=()=>xe(e),w.hidden=!1;return}let n=a.quote;if(n&&Je(t,{operationId:n.operationId,currency:n.currency},"The original purchase operation changed"),n&&t.status==="pending"&&t.quoteFinalized===!1&&!t.confirmedAt&&!t.checkoutUrl&&!t.nativePurchase&&!t.merchantExecution&&!t.problem&&!a.pendingCancellation){Be(n);return}await D(t,e||void 0)}async function te(){q?.remove(),q=null,c=te;let e=await a.confirm();if(!R()){c=te,w.hidden=!1;return}if(e.problem){await D(e);return}if(e.status==="pending"){if(e.checkoutUrl)await Pe(e);else if(e.execution&&e.execution.provider!=="merchant"||e.nativePurchase){if(!i.onPurchase)throw new k("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await i.onPurchase({operation:e,signal:fe.signal})}}c=async()=>D(await a.read()),await D(e,!0)}function Be(e){q?.remove();let t=!(Date.parse(e.expiresAt)>Date.now());u.textContent=t?o?"\u6B64\u62A5\u4EF7\u5DF2\u8FC7\u671F\u3002\u8BF7\u5148\u53D6\u6D88\uFF0C\u518D\u91CD\u65B0\u9009\u62E9\u3002":"This quote has expired. Cancel it, then choose again.":"";let n=d.createElement("div"),s=d.createElement("button"),r=d.createElement("button"),y=d.createElement("div"),x=d.createElement("p"),A=e.merchantTerms,de=o?"zh-CN":"en",W=A?.subscriptionTerms?.items??[],Re=A?A.subscriptionTerms?.trial?.days:e.lines.find(l=>l.trial)?.trial?.days,X=Re===void 0?null:A?A.totalMinor:e.charge?e.charge.totalMinor:e.lines.every(l=>l.trial)?0:null,Fe=(l,f)=>o?`${f} \u5929\u8BD5\u7528\u7ED3\u675F\u540E ${l}`:`Then ${l} after the ${f}-day trial`,{label:gt,recurring:Qe}=je(e),vt=e.lines.map(l=>l.productName).join(", "),We=X===null?"":`${o?"\u4ECA\u5929\u5E94\u4ED8":"Due today"} ${Z(X,e.currency)}`;x.textContent=We?[vt,We].filter(Boolean).join(" \xB7 "):gt,s.textContent=o?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",s.disabled=t,r.textContent=o?"\u53D6\u6D88":"Cancel",n.style.cssText=P.panel,x.style.cssText=P.summary,y.style.cssText=P.actions,s.style.cssText=P.primary,r.style.cssText=P.secondary,De(s),s.onclick=()=>{V(te)};let ze=async()=>{let l=await a.cancel();p||(n.remove(),q=null,await D(l))};r.onclick=()=>{c=ze,V(ze)};let L=d.createElement("div");if(L.style.cssText=P.terms,A){for(let f of W){if(X===null&&f===Qe)continue;let v=d.createElement("p"),M=Z(f.amountMinor,e.currency)+re(f.interval,de,f.intervalCount);v.textContent=X!==null&&Re!==void 0?Fe(M,Re):M,L.append(v)}let l=A.subscriptionTerms?.trial;if(l){let f=d.createElement("p");f.textContent=o?`\u8BD5\u7528 ${l.days} \u5929\uFF1B${l.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${l.days}; ${l.cardRequired?"a payment method is required":"no payment method is required"}`,L.append(f)}for(let f of[...A.expectedEffects.map(v=>v.description),...A.requiredConsents.map(v=>v.summary)]){let v=d.createElement("p");v.textContent=f,L.append(v)}}else{for(let l of e.lines){if(X!==null||l!==Qe){let f=d.createElement("p"),v=`${Z(l.catalogAmountMinor,e.currency)}${re(l.interval,de,l.intervalCount??1)}`;f.textContent=X!==null&&l.trial?(e.lines.length>1?`${l.productName} \xB7 `:"")+Fe(v,l.trial.days):`${l.productName} \xB7 ${v}`,L.append(f)}for(let f of l.prepaid??[]){let v=d.createElement("p"),M=a.view?.capabilities.plans[l.productVersionId]?.prepaid?.find(Ct=>Ct.internalFeatureId===f.internal_feature_id);v.textContent=`${M?.name??f.internal_feature_id} \xB7 ${f.quantity} ${o?"\u4EFD":"packs"} \xD7 ${f.terms.units}`,M&&(v.textContent+=re(M.reset==="week"||M.reset==="month"||M.reset==="year"?M.reset:"one_time",de,M.resetCount)),L.append(v)}if(l.trial){let f=d.createElement("p");f.textContent=o?`\u8BD5\u7528 ${l.trial.days} \u5929\uFF1B${l.trial.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${l.trial.days}; ${l.trial.cardRequired?"a payment method is required":"no payment method is required"}`,L.append(f)}}if(!e.charge){let l=d.createElement("p");l.textContent=o?"\u76EE\u5F55\u4EF7\u683C\uFF1B\u6700\u7EC8\u91D1\u989D\u4EE5\u7ED3\u8D26\u65F6\u7A0E\u8D39\u548C\u8BD5\u7528\u89C4\u5219\u4E3A\u51C6\u3002":"Catalog price; the final charge depends on checkout taxes and trial terms.",L.append(l)}}for(let l of L.children)l.style.margin="0";y.append(s,r),n.append(x,...L.childElementCount?[L]:[],y),U.prepend(n),g?.responsive||n.scrollIntoView?.({block:"nearest"}),s.focus({preventScroll:!0}),q=n,c=null}async function ue(){if(!E)return;if(c=ue,!oe){let n=a.view,s=n?.document.buttons[E.actionId],r=n&&s?.type==="checkout"?ee(s.product,E.selection,n.capabilities):null;if(!r)throw new k("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");let y=await i.resolveOfferId?.({actionId:E.actionId,productVersionId:r});if(p)return;y!==void 0&&(E.offerId=y),oe=!0}if(!R()){w.hidden=!1;return}let e;try{e=await a.preview(E)}catch(n){throw a.canReselect===!0&&(E=null,oe=!1,c=null),n}if(p)return;let t=e.merchantTerms;if(i.confirmOnHostedCheckout&&R()&&e.provider==="merchant"&&e.billingSubscriptionId===null&&t?.request.action==="purchase"&&t.request.mode==="subscription"&&t.subscriptionTerms?.trial===null&&t.requiredConsents.length===0&&Date.parse(e.expiresAt)>Date.now()){let n=o?"\u6B63\u5728\u6253\u5F00\u6536\u94F6\u53F0\u2026":"Opening checkout\u2026";u.textContent=n;try{await te()}catch(s){p||Q(s)}finally{u.textContent===n&&(u.textContent="")}return}Be(e)}function K(e="destroy"){p||(p=!0,i.signal?.removeEventListener("abort",j),a.signal?.removeEventListener("abort",j),C.finish("dismissed"),Ue?.(),fe.abort(),_e?.disconnect(),g?.destroy(),B?.destroy(),a.destroy(),b.open&&b.close(),b.remove(),I.remove(),O(),e==="dismiss"&&z(i.onDismiss))}S=K;async function ke(){if(!F||p||ae||$==="closing"||!$&&!R())return;if(!N){K("dismiss");return}let e=d.createElement("p");e.setAttribute("role","status"),e.textContent=o?"\u6B63\u5728\u5173\u95ED\u2026":"Closing\u2026",H||(H=d.createElement("div"),H.style.cssText=U.style.cssText,U.replaceWith(H),Y.inert=!0),h.hidden=!1,H.replaceChildren(e,h),$="closing",h.setAttribute("aria-disabled","true"),h.focus({preventScroll:!0});try{await N.dismiss()}catch(t){p||z(i.onError,t)}p||($="retry",e.textContent=o?"\u672A\u80FD\u786E\u8BA4\u5173\u95ED\uFF0C\u8BF7\u91CD\u8BD5\u3002":"Could not confirm closure. Try again.",h.textContent=o?"\u91CD\u8BD5\u5173\u95ED":"Retry closing",h.removeAttribute("aria-label"),h.removeAttribute("aria-disabled"))}h.onclick=()=>{ke()},b.addEventListener("cancel",e=>{e.preventDefault(),ke()}),w.onclick=()=>{c&&V(c)};function Ie(e){C.finish("error",e),K()}function Ae(){if(!(!Ve||F||p||ae||g&&!R()))try{let e=t=>{be?.(),g&&(b.showModal(),g.responsive&&b.focus({preventScroll:!0}),!t&&i.loading!=="host"&&Ze(b,g.type,g.responsive)),F=!0};N?N.present(()=>C.present(()=>e(!0))):C.present(e)}catch(e){Ie(e),Q(e)}}try{ie.type==="inline"?(h.hidden=Object.values(m.document.buttons).some(t=>t.type==="close"),Me(),be=rt(I,T),T.append(I)):(b.setAttribute("aria-label",m.document.name),h.textContent="\xD7",h.setAttribute("aria-label",o?"\u5173\u95ED":"Close"),et(h,m.document.screen.theme),Ke(m.document)?(h.hidden=!0,b.append(I)):b.append(h,I),T.append(b),g=Xe(b,{...m.document.screen,presentation:ie},we),g.latch(),g.responsive&&(I.style.display="flex",I.style.flexDirection="column",I.style.maxHeight="100%",Y.style.overflow="clip",Y.style.minHeight="0"),be=nt(b)),B=ut(Y,{mode:"live",rendererUrl:a.webViewUrl,title:m.document.name,closeActions:ft,onAuthoredClose(t){p||$||(h.hidden=t,g&&!t&&h.parentElement!==b&&b.prepend(h))},hostPresentation:()=>g?.type??ie.type,reportContentHeight:g?.responsive,onResize:t=>{if(!g?.responsive)return;let n=Math.min(t,ye);Y.style.height=`${n}px`,g.setContentHeight(n+(H??U).getBoundingClientRect().height)},onAction(t,n={}){if(!F||p||$)return;if(!R()){Ee();return}let s=a.view,r=s?.document.buttons[t];if(!r)return;if(r.type==="close"){V(async()=>{await i.onAction?.(t),K(i.onAction?"action":"dismiss")});return}if(r.type==="action"){c=async()=>{if(r.action.type==="event"){if(!i.onEvent)throw new k("EVENT_HANDLER_REQUIRED","Provide the event handler");await i.onEvent(r.action.event)}else i.onOpenUrl?await i.onOpenUrl(r.action.url):d.defaultView?.location.assign(r.action.url);await i.onAction?.(t),c=null},V(c);return}if(q&&a.canReselect===!1){u.textContent=o?"\u8BF7\u5148\u786E\u8BA4\u6216\u53D6\u6D88\u5F53\u524D\u8D2D\u4E70\u3002":"Confirm or cancel the current purchase first.",g?.responsive||q.scrollIntoView?.({block:"nearest"}),q.querySelector("button")?.focus({preventScroll:!0});return}if((a.quote||E)&&a.canReselect===!1){let x=!!s&&!!a.quote&&yt(a.quote,s,r.product,n);Ce=!!a.quote&&!x,c=a.quote?()=>xe(x):ue,V(c);return}let y=s&&ee(r.product,n,s.capabilities);if(!s||!y){Q(new k("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(i.onPurchaseIntent){c=null,V(async()=>{let x={actionId:t,productVersionId:y,selection:structuredClone(n),featureQuantities:Oe(s.document.screen,y,n,s.capabilities)};ge=!0,await i.onPurchaseIntent(x)});return}if(E&&E.actionId!==t){Q(new k("COMMAND_PENDING","Finish the current purchase"));return}E||(E={requestId:crypto.randomUUID(),actionId:t,selection:n},oe=!1),V(ue)},onEscape:()=>{ke()},onError:t=>{let n=new Error(t);!F&&!p&&Ie(n),Q(n)},onRendered:t=>{t&&b.setAttribute("aria-label",t),Ve=!0,Ae()}}),we(),B.update(m.document.screen,m.document.screen.strings.defaultLocale,{capabilities:m.capabilities,unavailableActions:Ne(m),serverInput:{bindings:[],answers:{}}}),Ue=a.subscribe?.(he),he(a.view??m),await C.wait(B.ready);let e=a.operation;(a.quote||e&&(e.confirmedAt||e.checkoutUrl||e.status==="complete"))&&(c=()=>xe(),V(c))}catch(e){throw Ie(e),e}return{check:G,host:{get observing(){return me},get recovery(){return mt()},async prepareFallback(){if(J||p||$||ge)return{type:"recover",operationId:a.operation?.operationId??a.quote?.operationId??null,requestId:null};ce(!0);try{let e=await Ye(a);return e.type==="native"&&K(),e}finally{ce(!1)}},setSuspended(e){ae=e,I.hidden=e,e&&b.open?b.close():!e&&!F?Ae():!e&&!p&&F&&ie.type!=="inline"&&!b.open&&b.showModal()},destroy:K,refresh:async()=>{if(!R()){if(a.view)return a.view;throw new k("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await a.refresh();return he(e),Ae(),e}}}}export{zt as showPaywall};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-YTZQ5BMP.js";import"./chunk-ILEDKSRQ.js";import"./chunk-EQPEUPMG.js";import"./chunk-FYQXSGRT.js";import"./chunk-7MNJH5GB.js";import"./chunk-JN6JEKWN.js";import"./chunk-THMGTRXP.js";import"./chunk-NAZU3EEJ.js";import"./chunk-SCC3O2RD.js";import"./chunk-R23IGK5U.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-EHDHWYVJ.js";import"./chunk-BXPXJARS.js";import"./chunk-5HJYR6Z4.js";import"./chunk-U2R7MG3J.js";import"./chunk-VYFSRHXM.js";import"./chunk-N7YXDSQL.js";import"./chunk-MIBRUDIS.js";import"./chunk-X4W22IH6.js";import"./chunk-R4FDIYMN.js";import"./chunk-3VUPVXAV.js";import"./chunk-UHQGO6OR.js";import"./chunk-VF6QMMEA.js";import"./chunk-DSPLGTQI.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i}from"./chunk-MPYJRLKB.js";import"./chunk-BRAVNBCC.js";import"./chunk-N7YXDSQL.js";import"./chunk-MIBRUDIS.js";import"./chunk-X4W22IH6.js";import"./chunk-R4FDIYMN.js";import"./chunk-VF6QMMEA.js";import"./chunk-DSPLGTQI.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};
|