@tinkerlandai/longplay-sdk 0.10.23 → 0.10.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +79 -0
  3. package/README.zh-CN.md +31 -0
  4. package/dist/{ai-usage-WFwbPTiq.d.ts → ai-usage-B6RepnmH.d.ts} +1 -1
  5. package/dist/{api-rZ_QoNQi.d.ts → api-C9P338XT.d.ts} +1547 -6
  6. package/dist/{chunk-5SHVM4AF.js → chunk-2KI63SPJ.js} +2 -2
  7. package/dist/{chunk-7MF2YMN4.js → chunk-2ZJ5CS5Q.js} +1 -1
  8. package/dist/chunk-34I23EKZ.js +1 -0
  9. package/dist/{chunk-XFO4FBFG.js → chunk-5HJMAZ7A.js} +1 -1
  10. package/dist/chunk-7AXCG6NU.js +1 -0
  11. package/dist/chunk-BB5P5HPS.js +1 -0
  12. package/dist/chunk-C2BODHNY.js +1 -0
  13. package/dist/chunk-EIYWDWXP.js +1 -0
  14. package/dist/chunk-LFFBNGXP.js +1 -0
  15. package/dist/{chunk-HDVLCRC6.js → chunk-MHEYMXGZ.js} +2 -2
  16. package/dist/{chunk-EZLLTGV3.js → chunk-ML3BIPM6.js} +1 -1
  17. package/dist/{chunk-KZ63ANBP.js → chunk-O3LZPMS4.js} +1 -1
  18. package/dist/chunk-O4535GJR.js +6 -0
  19. package/dist/{chunk-PKLLZXNM.js → chunk-OEH47Y2L.js} +1 -1
  20. package/dist/chunk-RKREEPCT.js +1 -0
  21. package/dist/{chunk-QVGTHPWT.js → chunk-SJNF6JDJ.js} +1 -1
  22. package/dist/chunk-THGLNE4K.js +1 -0
  23. package/dist/chunk-TUYBXAAK.js +1 -0
  24. package/dist/chunk-ZX2RWS3T.js +1 -0
  25. package/dist/content-FD2Q6XD6.js +1 -0
  26. package/dist/{coupon-Btz_KFKp.d.ts → coupon-DyKA-BRG.d.ts} +8 -0
  27. package/dist/funnel-host-purchase-XW7IF52Y.js +1 -0
  28. package/dist/{funnel-local-client-BYdKGnMb.d.ts → funnel-local-client-CSA9XoC4.d.ts} +3270 -32
  29. package/dist/{funnel-node-evaluation-eLMEZIFz.d.ts → funnel-node-evaluation-Cg-4tcAs.d.ts} +88 -0
  30. package/dist/funnel-process-client-RXgS2i-R.d.ts +23184 -0
  31. package/dist/funnel-runtime-host-I6PJXVRC.js +1 -0
  32. package/dist/index.d.ts +1219 -31
  33. package/dist/index.js +1 -1
  34. package/dist/native-shell.js +1 -1
  35. package/dist/openrouter.d.ts +2 -2
  36. package/dist/openrouter.js +1 -1
  37. package/dist/page.js +1 -1
  38. package/dist/paywall-CGBFHFRU.js +1 -0
  39. package/dist/popup.d.ts +3 -3
  40. package/dist/popup.js +1 -1
  41. package/dist/{presentation-loading-Ctk1djAi.d.ts → presentation-loading-D0A9G_kT.d.ts} +16 -2
  42. package/dist/react-native.d.ts +6 -6
  43. package/dist/react-native.js +1 -1
  44. package/dist/screen-renderer-WOMWOEYL.js +1 -0
  45. package/dist/server.d.ts +2402 -17
  46. package/dist/server.js +1 -1
  47. package/dist/visual.js +1 -1
  48. package/package.json +1 -1
  49. package/dist/chunk-3J24TUO7.js +0 -1
  50. package/dist/chunk-6DTGBDYG.js +0 -1
  51. package/dist/chunk-DUZ2E7BK.js +0 -1
  52. package/dist/chunk-IIYIIXNB.js +0 -1
  53. package/dist/chunk-KRQESEG2.js +0 -6
  54. package/dist/chunk-WMIDEJTZ.js +0 -1
  55. package/dist/chunk-YAVWELIV.js +0 -1
  56. package/dist/content-FM52HLRX.js +0 -1
  57. package/dist/funnel-process-client-C87pmLC9.d.ts +0 -64499
  58. package/dist/funnel-runtime-host-MZKLVLC4.js +0 -1
  59. package/dist/paywall-JL4SXFXT.js +0 -1
  60. package/dist/screen-renderer-TEVGVUT5.js +0 -1
@@ -1 +1 @@
1
- import{sa as g}from"./chunk-KRQESEG2.js";async function u(t,r,e){if(Number(t.headers.get("content-length"))>r)throw t.body?.cancel().catch(()=>{}),e.error("limit");let o=t.body?.getReader();if(!o)throw e.error("missing");let i=[],s=0,c=!1,a=()=>{},b=new Promise((n,f)=>{a=()=>f(e.signal?.reason),e.signal?.addEventListener("abort",a,{once:!0}),e.signal?.aborted&&a()});try{for(;;){let n=await Promise.race([o.read(),b]);if(n.done){c=!0;break}if(s+=n.value.length,s>r)throw e.error("limit");i.push(n.value)}}finally{e.signal?.removeEventListener("abort",a),c||o.cancel().catch(()=>{}),o.releaseLock()}e.signal?.throwIfAborted();let l=new Uint8Array(s),d=0;for(let n of i)l.set(n,d),d+=n.length;return l}async function m(t,r,e){return new TextDecoder("utf-8",{fatal:!0}).decode(await u(t,r,e))}function y(t,r){let e=typeof t=="string"?new TextEncoder().encode(t):t;return e.byteLength===r.byteLength&&g(e)===r.sha256}export{u as a,m as b,y as c};
1
+ import{sa as g}from"./chunk-O4535GJR.js";async function u(t,r,e){if(Number(t.headers.get("content-length"))>r)throw t.body?.cancel().catch(()=>{}),e.error("limit");let o=t.body?.getReader();if(!o)throw e.error("missing");let i=[],s=0,c=!1,a=()=>{},b=new Promise((n,f)=>{a=()=>f(e.signal?.reason),e.signal?.addEventListener("abort",a,{once:!0}),e.signal?.aborted&&a()});try{for(;;){let n=await Promise.race([o.read(),b]);if(n.done){c=!0;break}if(s+=n.value.length,s>r)throw e.error("limit");i.push(n.value)}}finally{e.signal?.removeEventListener("abort",a),c||o.cancel().catch(()=>{}),o.releaseLock()}e.signal?.throwIfAborted();let l=new Uint8Array(s),d=0;for(let n of i)l.set(n,d),d+=n.length;return l}async function m(t,r,e){return new TextDecoder("utf-8",{fatal:!0}).decode(await u(t,r,e))}function y(t,r){let e=typeof t=="string"?new TextEncoder().encode(t):t;return e.byteLength===r.byteLength&&g(e)===r.sha256}export{u as a,m as b,y as c};
@@ -0,0 +1 @@
1
+ import{a as n}from"./chunk-SJNF6JDJ.js";function o(r,e){try{return r.parse(e)}catch{throw new n("INVALID_RESPONSE","Invalid gateway response")}}export{o as a};
@@ -1 +1 @@
1
- import{a as P}from"./chunk-QVGTHPWT.js";import{g as pA,h as xA,i as gA,kb as zA,lb as FA,r as $A}from"./chunk-KRQESEG2.js";import{a as sA,b as MA,e as jA,f as UA,g as _A}from"./chunk-HDVLCRC6.js";function S(A){return typeof A=="string"?A:String(A)}var ye=/[\ud800-\udbff](?![\udc00-\udfff])|(^|[^\ud800-\udbff])[\udc00-\udfff]/g;function Pe(A){return A.replace(ye,"$1\uFFFD")}function PA(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 ZA(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 QA(A){let e;if(Array.isArray(A)){let t=A.map(S);if(t.length===2)return t}else if((e=ZA(A))!=null){let t=PA(e.next()),n=PA(e.next());if(!t.done&&!n.done)return[S(t.value),S(n.value)]}throw new TypeError("Each query pair must be an iterable [name, value] tuple")}var GA="0123456789ABCDEF",De=/(?:%[0-9A-Fa-f]{2})+/g;function U(A){return`%${GA[A>>4&15]}${GA[15&A]}`}function Ae(A,e,t=!1){return A>=55296&&A<=57343&&(A=65533),A<=127?t&&A===32?"+":e(A)?U(A):String.fromCharCode(A):A<=2047?U(192|A>>6)+U(128|63&A):A<=65535?U(224|A>>12)+U(128|A>>6&63)+U(128|63&A):U(240|A>>18)+U(128|A>>12&63)+U(128|A>>6&63)+U(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 bA(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(De,n=>{try{return decodeURIComponent(n)}catch{return"\uFFFD".repeat(n.length/3)}})}function AA(A){return A<=31||A>126}function be(A){switch(A){case 32:case 34:case 60:case 62:case 96:return!0;default:return AA(A)}}function qA(A){switch(A){case 32:case 34:case 35:case 60:case 62:return!0;default:return AA(A)}}function Se(A){return qA(A)||A===39}function SA(A){switch(A){case 63:case 94:case 96:case 123:case 125:return!0;default:return qA(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 SA(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 ee(A,e){return Ae(A=A||0,e)}function _(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+=Ae(l,e,t)}return r}function NA(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([bA(r.slice(0,u),!0),bA(r.slice(u+1),!0)])}if(t=n+1,n===A.length)break}return e}function CA(A){let e="";for(let t=0;t<A.length;t++){let n=_(A[t][0],YA,!0),r=_(A[t][1],YA,!0);e+=t!==0?`&${n}=${r}`:`${n}=${r}`}return e}var Ce=[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],Ie=[7296,7297,7298,7299,7300,7301,7302,7303,7304,42958,42962,42964,42993],Ee=["\u0432","\u0434","\u043E","\u0441","\u0442","\u0442","\u044A","\u0463","\uA64B","\uA7CF","\uA7D3","\uA7D5","s"],ve=[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 Te(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,Oe,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 Re(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 te(A,e){for(let t=0;t<A.length;t+=2)if(e>=A[t]&&e<=A[t+1])return!0;return!1}function X(A,e){let[t,n,r]=A,u=e>>8;for(let f=0;f<t.length;f+=2)if(u>=t[f]&&u<=t[f+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 ke(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&&te(ve,e[t-1]))continue;if(n===8205)return!1;let r=t-1;for(;r>=0&&X(VA,e[r]);)r--;let u=t+1;for(;u<e.length&&X(VA,e[u]);)u++;if(!(r>=0&&u<e.length&&X(Ne,e[r])&&X(Oe,e[u])))return!1}return!0}var Le=/(?![\p{Mark}\p{Decimal_Number}])[\p{Script=Arabic}\p{Script=Hebrew}]/u,Be=/\p{Script=Latin}/u;function He(A){return!Le.test(A)||!Be.test(A)}var F=36,iA=1,IA=26,Me=38,je=700,Ue=72,_e=128,xe=2147483647;function KA(A){return String.fromCharCode(A+22+75*+(A<26))}function $e(A,e,t){let n=0;for(A=t?Math.floor(A/je):A>>1,A+=Math.floor(A/e);A>(F-iA)*IA>>1;n+=F)A=Math.floor(A/(F-iA));return Math.floor(n+(F-iA+1)*A/(A+Me))}function ze(A){let e=Array.from(A,f=>f.codePointAt(0)),t="",n=0;for(let f=0;f<e.length;f++){let h=e[f];h<128&&(t+=String.fromCharCode(h),n++)}let r=n;r&&(t+="-");let u=_e,l=0,a=Ue;for(;n<e.length;){let f=xe;for(let h=0;h<e.length;h++){let w=e[h];w>=u&&w<f&&(f=w)}l+=(f-u)*(n+1),u=f;for(let h=0;h<e.length;h++){let w=e[h];if(w<u&&l++,w===u){let p=l;for(let m=F;;m+=F){let y=m<=a?iA:m>=a+IA?IA:m-a;if(p<y)break;t+=KA(y+(p-y)%(F-y)),p=Math.floor((p-y)/(F-y))}t+=KA(p),a=$e(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 ne(A,e){return(A>=65&&A<=90||A>=97&&A<=122)&&(e===58||e===124)}function re(A){return A.length===2&&ne(A.codePointAt(0),A.codePointAt(1))}function WA(A){return A.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u)!==-1}function I(A){switch(A){case"ftp":case"http":case"https":case"ws":case"wss":case"file":return!0;default:return!1}}function se(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,f=Array.from(n,h=>h.codePointAt(0));if(f[a]===58){if(f[a+1]!==58)return null;a+=2,l++,u=l}for(;a<f.length;){if(l===8)return null;if(f[a]===58){if(u!==null)return null;a++,l++,u=l;continue}let h=0,w=0,p=0;for(;p<4&&(h=DA(f[a]))>=0;)w=(w<<4)+h,a++,p++;if(f[a]===46){if(p===0||l>6)return null;a-=p;let m=0;for(;f[a]!==void 0;){let y=0;if(m>0)if(f[a]===46&&m<4)a++;else return null;if(f[a]==null||f[a]<48||f[a]>57)return null;for(;f[a]>=48&&f[a]<=57;){if(y=10*y+DA(f[a]),y>255)return null;a++}r[l]=256*r[l]+y,m++,m%2==0&&l++}if(m!==4)return null;break}else if(f[a]===58){if(f[++a]===void 0)return null}else if(f[a]!==void 0)return null;r[l]=w,l++}if(u!==null){let h=l-u;for(l=7;l!==0&&h>0;){let w=r[u+h-1];r[u+h-1]=r[l],r[l]=w,l--,h--}}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:_(n,AA)})(A);{let t=(function(r){let u=!1,l=!1;for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h<=32||h===37||h===127)return null;if(h>=128){u=!0;break}h>=65&&h<=90&&(l=!0)}if(!u)return r!==""?l?r.toLowerCase():r:null;if((function(h){for(let w of h){let p=w.codePointAt(0);if(/[\p{Cn}\p{Co}\p{Cs}\p{Noncharacter_Code_Point}]/u.test(w)&&!te(Ce,p)||X(qe,p))return!0}return!1})(r))return null;let a=(r=(function(h){let w="";for(let p of h){let m=p.codePointAt(0);if(m!==8204&&m!==8205&&/\p{Default_Ignorable_Code_Point}/u.test(p))continue;let y=Re(p,m);if(y){w+=y;continue}let N=Ie.indexOf(m);w+=N<0?p:Ee[N]}return w})(r).normalize("NFKC").replace(/[\u3002\uff0e\uff61]/g,".").toLowerCase()).split(".");for(let f=0;f<a.length;f++){let h=a[f];if(h==="")continue;let w=/[^\0-\x7f]/.test(h);if(Te(h)||w&&(/^\p{Mark}/u.test(h)||!ke(h)||!He(h)||h.startsWith("xn--")))return null;w&&(a[f]=`xn--${ze(h)}`)}return(r=a.join("."))!==""?r:null})(A.indexOf("%")===-1?A:bA(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 h=0;h<l-1;h++){let w=wA(u[h]);if(w<0||w>255)return null;a+=w*(1<<8*(3-h))}let f=wA(u[l-1]);return f<0||f>=256**(5-l)?null:(a+=f,a)})(t):t}}function vA(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 f=-1,h=-1,w=1,p=0;for(let m=0;m<a.length;++m)a[m]!==0?(p>w&&(f=h,w=p),h=-1,p=0):(h===-1&&(h=m),++p);return p>w?h:f})(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 oe(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 ie(A){return A.username!==""||A.password!==""}function mA(A){return A.host===null||A.host===""||A.scheme==="file"}var s=0,o="",g="",D=null,i,lA=!1,uA=!1,G=!1,E;function B(A,e,t,n){e||(A=(function(l){let a=0,f=l.length;for(;a<f&&!(l.charCodeAt(a)>32);++a);for(;f>a&&!(l.charCodeAt(f-1)>32);--f);return l.substring(a,f)})(A)),A=(function(l){let a=0;for(;a<l.length;a++){let h=l.charCodeAt(a);if(h===9||h===10||h===13)break}if(a===l.length)return l;let f=l.slice(0,a);for(;a<l.length;a++){let h=l.charCodeAt(a);h!==9&&h!==10&&h!==13&&(f+=l[a])}return f})(A),s=0,o=A,g="",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=Fe;switch(n){case 3:case 4:r=aA;break;case 5:r=RA;break;case 6:r=Y;break;case 7:r=Q;break;case 8:r=x}return r(c(A,s))!==1?i:null}function d(A,e){return s+=s===A?M(e):1,s<=o.length}function c(A,e){return e<A.length?A.codePointAt(e):void 0}function M(A){return A!=null&&A>65535?2:1}function le(A){return A==null?"":A<=65535?String.fromCharCode(A):String.fromCodePoint(A)}var Fe=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 g=o.slice(s,t).toLowerCase(),s=t,Qe(t<o.length?A:void 0)}else return E?1:(--s,d(e,A)?ue(c(o,s)):0)},Qe=A=>{let e=s;if(A===58){if(E){if(I(i.scheme)!==I(g))return 0;if((ie(i)||i.port!==null)&&g==="file")return 0;if(i.scheme==="file"&&i.host==="")return 0}return i.scheme=g,E?(i.port===se(i.scheme)&&(i.port=null),0):(g="",i.scheme==="file"?d(e,A)?kA(c(o,s)):0:I(i.scheme)&&D!==null&&D.scheme===i.scheme?d(e,A)?Ge(c(o,s)):0:I(i.scheme)?d(e,A)?Ve(c(o,s)):0:c(o,s+1)===47?(s++,d(e,A)?Ye(c(o,s)):0):(i.path=[""],i.opaquePath=!0,d(e,A)?ae(c(o,s)):0))}else return E?1:(g="",s=-1,d(e,A)?ue(c(o,s)):0)},ue=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)?x(c(o,s)):0):D.scheme==="file"?(s--,d(e,A)?kA(c(o,s)):0):(s--,d(e,A)?OA(c(o,s)):0)},Ge=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)?OA(c(o,s)):0)},Ye=A=>{let e=s;return A===47?d(e,A)?W(c(o,s)):0:(s--,d(e,A)?j(c(o,s)):0)},OA=A=>{let e=s;return i.scheme=D.scheme,A===47||I(i.scheme)&&A===92?d(e,A)?XA(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)?x(c(o,s)):0):A!=null?(i.query=null,i.path.pop(),s--,d(e,A)?j(c(o,s)):0):d(e,A)?OA(c(o,s)):0)},XA=A=>{let e=s;return I(i.scheme)&&(A===47||A===92)?d(e,A)?hA(c(o,s)):0:A===47?d(e,A)?W(c(o,s)):0:(i.username=D.username,i.password=D.password,i.host=D.host,i.port=D.port,s--,d(e,A)?j(c(o,s)):0)},Ve=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)?W(c(o,s)):0):d(e,A)?hA(c(o,s)):0},W=A=>{let e=s;if(A!=null&&A!==64&&A!==35&&A!==47&&A!==63&&(A!==92||!I(i.scheme))){let t=s+M(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===64||n===35||n===47||n===63||n===92&&I(i.scheme))break;t+=M(n)}return g+=o.slice(s,t),s=t-1,d(e,A)?W(c(o,s)):0}if(A===64){lA&&(g=`%40${g}`),lA=!0;for(let t=0;t<g.length;t++){let n=g.codePointAt(t);if(n===58&&!uA){uA=!0;continue}let r=ee(n,cA);uA?i.password+=r:i.username+=r,n!=null&&n>65535&&t++}return g="",d(e,A)?W(c(o,s)):0}else return A==null||A===35||A===47||A===63||A===92&&I(i.scheme)?lA&&g===""?1:(s-=g.length+1,g="",d(e,A)?aA(c(o,s)):0):(g+=le(A),d(e,A)?W(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||!I(i.scheme))){let t=s+M(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&&I(i.scheme))break;n===91?G=!0:n===93&&(G=!1),t+=M(n)}return g+=o.slice(s,t),s=t-1,d(e,A)?aA(c(o,s)):0}else if(A===58&&!G){if(g===""||E===4)return 1;let t=EA(g,!I(i.scheme));return t===null?1:(i.host=vA(t),g="",d(e,A)?RA(c(o,s)):0)}else if(A==null||A===35||A===47||A===63||A===92&&I(i.scheme)){if(s--,I(i.scheme)&&g==="")return 1;if(E&&g===""&&(ie(i)||i.port!==null))return 1;let t=EA(g,!I(i.scheme));return t===null?1:(i.host=vA(t),g="",E?0:d(e,A)?Y(c(o,s)):0)}else return g+=le(A),d(e,A)?aA(c(o,s)):0},RA=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 g+=o.slice(s,t),s=t-1,d(e,A)?RA(c(o,s)):0}else if(E||A==null||A===35||A===47||A===63||A===92&&I(i.scheme)){if(g!==""){let t=parseInt(g,10);if(t>65535)return 1;if(i.port=t===se(i.scheme)?null:t,g="",E)return 0}return E?1:(s--,d(e,A)?Y(c(o,s)):0)}else return 1};function ce(A,e){let t=A.length-e;if(t<2)return!1;if(ne(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 kA=A=>{let e=s;return i.scheme="file",i.host="",A===47||A===92?d(e,A)?Ke(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)?x(c(o,s)):0):A!=null?(i.query=null,ce(o,s)?i.path=[]:oe(i),s--,d(e,A)?j(c(o,s)):0):d(e,A)?kA(c(o,s)):0):(s--,d(e,A)?j(c(o,s)):0)},Ke=A=>{let e=s;return A===47||A===92?d(e,A)?LA(c(o,s)):0:(D!==null&&D.scheme==="file"&&(!ce(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)?j(c(o,s)):0)},LA=A=>{let e=s;if(A!=null&&A!==47&&A!==92&&A!==63&&A!==35){let t=s+M(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||n===92||n===63||n===35)break;t+=M(n)}return g+=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&&re(g))return d(e,A)?j(c(o,s)):0;if(g==="")return i.host="",E?0:d(e,A)?Y(c(o,s)):0;{let t=EA(g,!I(i.scheme));return t===null?1:(t==="localhost"&&(t=""),i.host=vA(t),g="",E?0:d(e,A)?Y(c(o,s)):0)}}return 1},Y=A=>{let e=s;return I(i.scheme)?(A!==92&&A!==47&&s--,d(e,A)?j(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)?x(c(o,s)):0):A!=null?(A!==47&&s--,d(e,A)?j(c(o,s)):0):(E&&i.host===null&&i.path.push(""),d(e,A)?Y(c(o,s)):0)},j=A=>{let e=s;if(A!=null&&A!==47&&(!I(i.scheme)||A!==92)&&(E||A!==63&&A!==35)){let t=s+M(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||I(i.scheme)&&n===92||!E&&(n===63||n===35))break;t+=M(n)}g+=_(o.slice(s,t),SA),s=t,A=c(o,t)}if(A==null||A===47||I(i.scheme)&&A===92||!E&&(A===63||A===35)){let t=I(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}})(g)?(oe(i),A!==47&&!t&&i.path.push("")):JA(g)&&A!==47&&!t?i.path.push(""):JA(g)||(i.scheme==="file"&&i.path.length===0&&re(g)&&(g=`${g[0]}:`),i.path.push(g)),g="",A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?x(c(o,s)):0):d(e,A)?j(c(o,s)):0}else return g+=ee(A,SA),d(e,A)?j(c(o,s)):0},ae=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)?x(c(o,s)):0;if(A!=null){let t=s+M(A);for(;t<o.length;){let r=c(o,t);if(r===63||r===35)break;t+=M(r)}let n=o.slice(s,t);if(t<o.length&&n.charCodeAt(n.length-1)===32?i.path[0]+=_(n.slice(0,-1),AA)+"%20":i.path[0]+=_(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)?x(c(o,s)):0}return d(e,A)?ae(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=I(i.scheme)?Se:qA;i.query+=_(o.slice(s,t),n)}return s=t,c(o,t)===35&&!E?(i.fragment="",d(e,A)?x(c(o,s)):0):d(e,A)?Q(c(o,s)):0},x=A=>{let e=s;return A!=null&&(i.fragment+=_(o.slice(s),be),s=o.length),d(e,A)?x(c(o,s)):0};function TA(A){if(A.opaquePath)return A.path[0];{let e="";for(let t of A.path)e+=`/${t}`;return e}}function fe(A){switch(A.scheme){case"blob":{let e=B(TA(A),null,null,0);return e===null||e.scheme!=="http"&&e.scheme!=="https"?"null":fe(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 b=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=S(e),t!=null&&(t=S(t));let n=null;if(t!=null&&(n=B(t,null,null,0),n==null))throw new TypeError(`Invalid base URL: ${t}`);let r=B(e,null,n,0);if(r==null)throw new TypeError(`Invalid URL: ${e}`);this[b]={url:r,query:null}}static createObjectURL(e){throw new TypeError("URL.createObjetURL is unsupported")}static revokeObjectURL(e){}static parse(e,t){e=S(e),t!==void 0&&(t=S(t));try{return new A(e,t)}catch{return null}}static canParse(e,t){e=S(e),t!==void 0&&(t=S(t));let n=null;return t!=null&&(n=B(t,null,null,0),n==null)?!1:B(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+=TA(t),t.query!==null&&(n+=`?${t.query}`),t.fragment!==null&&(n+=`#${t.fragment}`),n})(this[b].url)}set href(e){let t=B(e=S(e),null,null,0);if(t==null)throw new TypeError(`Invalid URL: ${e}`);this[b].url=t,this[b].query&&yA(this[b].query,t.query)}get origin(){return fe(this[b].url)}get protocol(){return`${this[b].url.scheme}:`}set protocol(e){B(`${e=S(e)}:`,this[b].url,null,2)}get username(){return this[b].url.username}set username(e){e=S(e),mA(this[b].url)||(function(n,r){n.username=_(r,cA)})(this[b].url,e)}get password(){return this[b].url.password}set password(e){e=S(e),mA(this[b].url)||(function(n,r){n.password=_(r,cA)})(this[b].url,e)}get host(){let{url:e}=this[b];return e.host==null?"":e.port==null?e.host:`${e.host}:${e.port}`}set host(e){e=S(e),this[b].url.opaquePath||B(e,this[b].url,null,3)}get hostname(){let{url:e}=this[b];return e.host!=null?e.host:""}set hostname(e){e=S(e),this[b].url.opaquePath||B(e,this[b].url,null,4)}get port(){let{url:e}=this[b];return e.port!=null?`${e.port}`:""}set port(e){e=S(e);let{url:t}=this[b];mA(t)||(e?B(e,t,null,5):t.port=null)}get pathname(){return TA(this[b].url)}set pathname(e){e=S(e);let{url:t}=this[b];t.opaquePath||(t.path=[],B(e,t,null,6))}get search(){let{url:e}=this[b];return e.query?`?${e.query}`:""}set search(e){e=S(e);let{url:t,query:n}=this[b];if(!e)t.query=null,n&&yA(n,null);else{let r=e[0]==="?"?e.substring(1):e;t.query="",B(r,t,null,7),n&&yA(n,t.query)}}get searchParams(){let e=this[b],t=e.query;return t==null&&(t=e.query=(function(r,u){let l=new fA;return l[C].url=r,l[C].serialized=u==null,u&&(l[C].list=NA(u)),l})(this,e.url.query)),t}get hash(){let{url:e}=this[b];return e.fragment?`#${e.fragment}`:""}set hash(e){e=S(e);let{url:t}=this[b];if(!e)t.fragment=null;else{let n=e[0]==="#"?e.substring(1):e;t.fragment="",B(n,t,null,8)}}toJSON(){return this.href}toString(){return this.href}};Object.defineProperty(eA.prototype,Symbol.toStringTag,{value:"URL",configurable:!0});var C=Symbol("URLSearchParamsImpl"),Je=Symbol.dispose||Symbol.for("dispose");function yA(A,e){e?A[C].list=NA(e):A[C].list.length=0,A[C].serialized=e==null}function oA(A){if(A.url){let e=CA(A.list);(function(n,r){n[b].url.query=r})(A.url,e||null),A.serialized=!0}}var We=typeof Iterator<"u"?Iterator:Object,Z=class extends We{constructor(e,t){super(),this[C]={ptr:e,map:t,index:0}}next(){let e=this[C];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}[Je](){}},fA=class{constructor(e){let t=this[C]={list:[],url:null,serialized:!0},n;if(Array.isArray(e))for(let r=0;r<e.length;r++)t.list.push(QA(e[r]));else if((n=ZA(e))!=null){let r;for(;!(r=PA(n.next())).done;)t.list.push(QA(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=Pe(l),f=S(e[l]),h=t.list.find(w=>w[0]===a);h?h[1]=f:t.list.push([a,f])}}else if(e!==void 0){let r=S(e);r=r[0]==="?"?r.substring(1):r,t.list=NA(r)}}get size(){return this[C].list.length}append(e,t){e=S(e),t=S(t),this[C].list.push([e,t]);let n=this[C];n.url&&n.serialized?(function(u,l){let a=u[b].url;a.query=a.query?`${a.query}&${l}`:l})(n.url,CA([[e,t]])):oA(n)}delete(e,t){e=S(e),t=t!=null?S(t):void 0;let{list:n}=this[C],r=0;for(;r<n.length;)n[r][0]===e&&(t==null||n[r][1]===t)?n.splice(r,1):r++;oA(this[C])}get(e){e=S(e);let{list:t}=this[C];for(let n=0;n<t.length;n++)if(t[n][0]===e)return t[n][1];return null}getAll(e){e=S(e);let t=[],{list:n}=this[C];for(let r=0;r<n.length;r++)n[r][0]===e&&t.push(n[r][1]);return t}has(e,t){e=S(e),t=t!=null?S(t):void 0;let{list:n}=this[C];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=S(e),t=S(t);let{list:n}=this[C],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[C])}sort(){this[C].list.sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0),oA(this[C])}forEach(e,t){if(typeof e!="function")throw new TypeError('The "callback" argument must be of type function');let{list:n}=this[C];for(let r=0;r<n.length;r++)e.call(t,n[r][1],n[r][0],this)}entries(){return new Z(this[C],e=>e)}keys(){return new Z(this[C],e=>e[0])}values(){return new Z(this[C],e=>e[1])}toString(){return CA(this[C].list)}[Symbol.iterator](){return this.entries()}};Object.defineProperty(fA.prototype,Symbol.toStringTag,{value:"URLSearchParams",configurable:!0});function he(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 y of[...u.values()])try{y?.()}catch{}m===n&&(e=p,l())}let f=()=>a();function h(p,m=!1){let y=$A.safeParse(p);if(!y.success||m&&Date.parse(y.data.expiresAt)<=Date.now()||Date.parse(y.data.refreshExpiresAt)<=Date.now()||Date.parse(y.data.refreshExpiresAt)<Date.parse(y.data.expiresAt))throw new P("INVALID_RESPONSE","Invalid customer session credentials");return y.data}async function w(){if(r)return r;let p=typeof e=="object"?e:void 0,m=n;if(!p||Date.parse(p.refreshExpiresAt)<=Date.now())throw p&&f(),new P("UNAUTHENTICATED","Customer authentication is required",401);let y=(async()=>{try{let N=await A(p.refreshToken);if(m!==n)throw new P("IDENTITY_CHANGED","Customer identity changed during refresh");let V=h(N,!0);if(V.customerId!==p.customerId||V.sessionId!==p.sessionId)throw new P("SCOPE_MISMATCH","Refresh changed the customer session");return e=V,{...V}}catch(N){throw m!==n?new P("IDENTITY_CHANGED","Customer identity changed during refresh"):(N instanceof P&&N.status===401&&f(),N)}})();r=y;try{return await y}finally{r===y&&(r=void 0)}}return{identify(p){let m=typeof p=="string"?p:h(p),y=typeof m=="string"?m:m.accessToken;if(!y.trim()||/\s/.test(y)||y.length>4096)throw new P("INVALID_TOKEN","A server-issued token is required");a(m)},reset:f,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 y=n;return w().then(()=>{let N=t();if(y!==n||!N)throw new P("IDENTITY_CHANGED","Customer identity changed during refresh");return N})}let m=t();if(!m)throw new P("NOT_IDENTIFIED","Identify a customer session before making a request");return m},peek:t,snapshot:()=>typeof e=="object"?{...e}:void 0,refresh:w}}var de=Symbol("IndianaNoContent");function ut(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 P("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 P("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 P("INVALID_URL","Use HTTPS, or HTTP on localhost during development");let a=A.fetch??globalThis.fetch.bind(globalThis),f=A.timeoutMs??1e4;if(!Number.isFinite(f)||f<1||f>12e4)throw new P("INVALID_TIMEOUT","timeoutMs must be between 1 and 120000");let h=!1,w=0,p=null,m=new Set,y=A.session??he(async q=>{let O=await tA("customer-sessions/refresh",{},"POST",{},q);if(!O||typeof O!="object")throw new P("INVALID_RESPONSE","Invalid refresh response");let{requestId:$,scope:H,...K}=O;return K});function N(){w+=1,p=null;for(let q of m)q.abort();m.clear()}let V=y.subscribeIdentity(N);function pe(){h||y.reset()}async function tA(q,O={},$="POST",H={},K){let k=H.installationDetach===!0;if(k&&(q!=="push/installations/detach"||$!=="POST"))throw new P("INVALID_REQUEST","Installation authority only detaches this installation");if(!K&&!k)throw new P("NOT_IDENTIFIED","Call identify with a server-issued customer token first");let J=w,L=new AbortController;k||m.add(L);let nA=()=>!k&&J!==w?new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):new P("TIMEOUT","Longplay request timed out"),dA,ge=new Promise((T,R)=>{dA=()=>R(nA()),L.signal.addEventListener("abort",dA,{once:!0})}),we=setTimeout(()=>L.abort(),H.timeoutMs??f),me=async()=>{let T=await a(`${l.href.replace(/\/$/,"")}/api/v1/${q}`,{method:$,headers:{...H.headers,"Content-Type":"application/json",...k?{}:{Authorization:`Bearer ${K}`},[pA]:gA.current,[xA]:zA.version,...u?{"X-Indiana-Project":u.projectId,"X-Indiana-Environment":u.environment}:{}},body:$==="POST"?JSON.stringify(O):void 0,signal:L.signal,credentials:"omit",cache:"no-store",redirect:"error",...H.keepalive?{keepalive:!0}:{}});if(L.signal.aborted)throw nA();let R;try{R=T.status===204?de:await T.json()}catch{throw L.signal.aborted?nA():new P(T.ok?"INVALID_RESPONSE":"HTTP_ERROR","The gateway returned an unreadable response",T.status,T.headers.get("X-Request-Id")??void 0)}if(L.signal.aborted)throw nA();if(!k&&J!==w)throw new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight");if(!T.ok){let v=UA.safeParse(R),z=v.success&&(!MA.safeParse(v.data.error.code).success||jA(v.data.error.code,T.status)),BA=z?v.data.error.code:"HTTP_ERROR",HA=_A(BA,T.status,{retryAfter:T.headers.get("Retry-After"),recovery:z?v.data.error.recovery:void 0,reason:z?v.data.error.reason:void 0});throw new P(BA,z?v.data.error.message:"Longplay request failed",T.status,T.headers.get("X-Request-Id")??(v.success?v.data.requestId:void 0),{...HA,...v.success&&v.data.error.retryable===!1?{retryable:!1}:{},...HA.retryAfterSeconds===void 0&&v.success&&v.data.error.retryAfterSeconds!==void 0?{retryAfterSeconds:v.data.error.retryAfterSeconds}:{}})}if(T.headers.get(pA)!==gA.current)throw new P("PROTOCOL_MISMATCH","Response protocol does not match this SDK");if(u&&R!==de){let v=R&&typeof R=="object"&&"scope"in R?R:R&&typeof R=="object"&&"configuration"in R?R.configuration:null;if(!v||typeof v!="object"||!("scope"in v))throw new P("INVALID_RESPONSE","Response is missing its App/environment scope");let z=sA.safeParse(v.scope);if(!z.success||z.data.projectId!==u.projectId||z.data.environment!==u.environment)throw new P("SCOPE_MISMATCH","Response scope does not match this SDK instance")}let rA=T.headers.get("X-Indiana-Telemetry-Subject");if(rA){if(!/^[a-f0-9]{64}$/.test(rA))throw new P("INVALID_RESPONSE","Invalid telemetry identity");p!==rA&&(p=rA,e?.(p))}return R};try{return await Promise.race([me(),ge])}catch(T){throw!k&&J!==w?new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):T instanceof P?T:new P(L.signal.aborted?"TIMEOUT":"NETWORK_ERROR",L.signal.aborted?"Longplay request timed out":"Unable to read the Longplay response")}finally{clearTimeout(we),L.signal.removeEventListener("abort",dA),m.delete(L)}}return{session:y,requestWithCredential(q,O,$,H={}){return h?Promise.reject(new P("CLOSED","SDK client was destroyed")):tA(q,O,"POST",H,$)},subjectKey:()=>p,identify(q){if(h)throw new P("CLOSED","SDK client was destroyed");if(u&&typeof q=="object"&&"scope"in q){let O=sA.safeParse(q.scope);if(!O.success||O.data.projectId!==u.projectId||O.data.environment!==u.environment)throw new P("SCOPE_MISMATCH","Customer session belongs to another App/environment")}y.identify(q)},reset:pe,dispose(){h||(h=!0,V(),N())},request(q,O={},$="POST",H={}){if(h)return Promise.reject(new P("CLOSED","SDK client was destroyed"));if(H.installationDetach)return tA(q,O,$,H);let K=w;try{let k=y.access(),J=L=>{if(K!==w)throw new P("IDENTITY_CHANGED","Customer identity changed before dispatch");return tA(q,O,$,H,L)};return typeof k=="string"?J(k):k.then(J)}catch(k){return Promise.reject(k)}}}}export{eA as a,ut as b};
1
+ import{a as P}from"./chunk-SJNF6JDJ.js";import{g as pA,h as xA,i as gA,ob as zA,pb as FA,r as $A}from"./chunk-O4535GJR.js";import{a as sA,b as MA,e as jA,f as UA,g as _A}from"./chunk-MHEYMXGZ.js";function S(A){return typeof A=="string"?A:String(A)}var ye=/[\ud800-\udbff](?![\udc00-\udfff])|(^|[^\ud800-\udbff])[\udc00-\udfff]/g;function Pe(A){return A.replace(ye,"$1\uFFFD")}function PA(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 ZA(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 QA(A){let e;if(Array.isArray(A)){let t=A.map(S);if(t.length===2)return t}else if((e=ZA(A))!=null){let t=PA(e.next()),n=PA(e.next());if(!t.done&&!n.done)return[S(t.value),S(n.value)]}throw new TypeError("Each query pair must be an iterable [name, value] tuple")}var GA="0123456789ABCDEF",De=/(?:%[0-9A-Fa-f]{2})+/g;function U(A){return`%${GA[A>>4&15]}${GA[15&A]}`}function Ae(A,e,t=!1){return A>=55296&&A<=57343&&(A=65533),A<=127?t&&A===32?"+":e(A)?U(A):String.fromCharCode(A):A<=2047?U(192|A>>6)+U(128|63&A):A<=65535?U(224|A>>12)+U(128|A>>6&63)+U(128|63&A):U(240|A>>18)+U(128|A>>12&63)+U(128|A>>6&63)+U(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 bA(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(De,n=>{try{return decodeURIComponent(n)}catch{return"\uFFFD".repeat(n.length/3)}})}function AA(A){return A<=31||A>126}function be(A){switch(A){case 32:case 34:case 60:case 62:case 96:return!0;default:return AA(A)}}function qA(A){switch(A){case 32:case 34:case 35:case 60:case 62:return!0;default:return AA(A)}}function Se(A){return qA(A)||A===39}function SA(A){switch(A){case 63:case 94:case 96:case 123:case 125:return!0;default:return qA(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 SA(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 ee(A,e){return Ae(A=A||0,e)}function _(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+=Ae(l,e,t)}return r}function NA(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([bA(r.slice(0,u),!0),bA(r.slice(u+1),!0)])}if(t=n+1,n===A.length)break}return e}function CA(A){let e="";for(let t=0;t<A.length;t++){let n=_(A[t][0],YA,!0),r=_(A[t][1],YA,!0);e+=t!==0?`&${n}=${r}`:`${n}=${r}`}return e}var Ce=[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],Ie=[7296,7297,7298,7299,7300,7301,7302,7303,7304,42958,42962,42964,42993],Ee=["\u0432","\u0434","\u043E","\u0441","\u0442","\u0442","\u044A","\u0463","\uA64B","\uA7CF","\uA7D3","\uA7D5","s"],ve=[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 Te(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,Oe,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 Re(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 te(A,e){for(let t=0;t<A.length;t+=2)if(e>=A[t]&&e<=A[t+1])return!0;return!1}function X(A,e){let[t,n,r]=A,u=e>>8;for(let f=0;f<t.length;f+=2)if(u>=t[f]&&u<=t[f+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 ke(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&&te(ve,e[t-1]))continue;if(n===8205)return!1;let r=t-1;for(;r>=0&&X(VA,e[r]);)r--;let u=t+1;for(;u<e.length&&X(VA,e[u]);)u++;if(!(r>=0&&u<e.length&&X(Ne,e[r])&&X(Oe,e[u])))return!1}return!0}var Le=/(?![\p{Mark}\p{Decimal_Number}])[\p{Script=Arabic}\p{Script=Hebrew}]/u,Be=/\p{Script=Latin}/u;function He(A){return!Le.test(A)||!Be.test(A)}var F=36,iA=1,IA=26,Me=38,je=700,Ue=72,_e=128,xe=2147483647;function KA(A){return String.fromCharCode(A+22+75*+(A<26))}function $e(A,e,t){let n=0;for(A=t?Math.floor(A/je):A>>1,A+=Math.floor(A/e);A>(F-iA)*IA>>1;n+=F)A=Math.floor(A/(F-iA));return Math.floor(n+(F-iA+1)*A/(A+Me))}function ze(A){let e=Array.from(A,f=>f.codePointAt(0)),t="",n=0;for(let f=0;f<e.length;f++){let h=e[f];h<128&&(t+=String.fromCharCode(h),n++)}let r=n;r&&(t+="-");let u=_e,l=0,a=Ue;for(;n<e.length;){let f=xe;for(let h=0;h<e.length;h++){let m=e[h];m>=u&&m<f&&(f=m)}l+=(f-u)*(n+1),u=f;for(let h=0;h<e.length;h++){let m=e[h];if(m<u&&l++,m===u){let p=l;for(let w=F;;w+=F){let y=w<=a?iA:w>=a+IA?IA:w-a;if(p<y)break;t+=KA(y+(p-y)%(F-y)),p=Math.floor((p-y)/(F-y))}t+=KA(p),a=$e(l,n+1,n===r),l=0,n++}}l++,u++}return t}function mA(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 ne(A,e){return(A>=65&&A<=90||A>=97&&A<=122)&&(e===58||e===124)}function re(A){return A.length===2&&ne(A.codePointAt(0),A.codePointAt(1))}function WA(A){return A.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u)!==-1}function I(A){switch(A){case"ftp":case"http":case"https":case"ws":case"wss":case"file":return!0;default:return!1}}function se(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,f=Array.from(n,h=>h.codePointAt(0));if(f[a]===58){if(f[a+1]!==58)return null;a+=2,l++,u=l}for(;a<f.length;){if(l===8)return null;if(f[a]===58){if(u!==null)return null;a++,l++,u=l;continue}let h=0,m=0,p=0;for(;p<4&&(h=DA(f[a]))>=0;)m=(m<<4)+h,a++,p++;if(f[a]===46){if(p===0||l>6)return null;a-=p;let w=0;for(;f[a]!==void 0;){let y=0;if(w>0)if(f[a]===46&&w<4)a++;else return null;if(f[a]==null||f[a]<48||f[a]>57)return null;for(;f[a]>=48&&f[a]<=57;){if(y=10*y+DA(f[a]),y>255)return null;a++}r[l]=256*r[l]+y,w++,w%2==0&&l++}if(w!==4)return null;break}else if(f[a]===58){if(f[++a]===void 0)return null}else if(f[a]!==void 0)return null;r[l]=m,l++}if(u!==null){let h=l-u;for(l=7;l!==0&&h>0;){let m=r[u+h-1];r[u+h-1]=r[l],r[l]=m,l--,h--}}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:_(n,AA)})(A);{let t=(function(r){let u=!1,l=!1;for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h<=32||h===37||h===127)return null;if(h>=128){u=!0;break}h>=65&&h<=90&&(l=!0)}if(!u)return r!==""?l?r.toLowerCase():r:null;if((function(h){for(let m of h){let p=m.codePointAt(0);if(/[\p{Cn}\p{Co}\p{Cs}\p{Noncharacter_Code_Point}]/u.test(m)&&!te(Ce,p)||X(qe,p))return!0}return!1})(r))return null;let a=(r=(function(h){let m="";for(let p of h){let w=p.codePointAt(0);if(w!==8204&&w!==8205&&/\p{Default_Ignorable_Code_Point}/u.test(p))continue;let y=Re(p,w);if(y){m+=y;continue}let N=Ie.indexOf(w);m+=N<0?p:Ee[N]}return m})(r).normalize("NFKC").replace(/[\u3002\uff0e\uff61]/g,".").toLowerCase()).split(".");for(let f=0;f<a.length;f++){let h=a[f];if(h==="")continue;let m=/[^\0-\x7f]/.test(h);if(Te(h)||m&&(/^\p{Mark}/u.test(h)||!ke(h)||!He(h)||h.startsWith("xn--")))return null;m&&(a[f]=`xn--${ze(h)}`)}return(r=a.join("."))!==""?r:null})(A.indexOf("%")===-1?A:bA(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(mA(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 h=0;h<l-1;h++){let m=mA(u[h]);if(m<0||m>255)return null;a+=m*(1<<8*(3-h))}let f=mA(u[l-1]);return f<0||f>=256**(5-l)?null:(a+=f,a)})(t):t}}function vA(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 f=-1,h=-1,m=1,p=0;for(let w=0;w<a.length;++w)a[w]!==0?(p>m&&(f=h,m=p),h=-1,p=0):(h===-1&&(h=w),++p);return p>m?h:f})(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 oe(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 ie(A){return A.username!==""||A.password!==""}function wA(A){return A.host===null||A.host===""||A.scheme==="file"}var s=0,o="",g="",D=null,i,lA=!1,uA=!1,G=!1,E;function B(A,e,t,n){e||(A=(function(l){let a=0,f=l.length;for(;a<f&&!(l.charCodeAt(a)>32);++a);for(;f>a&&!(l.charCodeAt(f-1)>32);--f);return l.substring(a,f)})(A)),A=(function(l){let a=0;for(;a<l.length;a++){let h=l.charCodeAt(a);if(h===9||h===10||h===13)break}if(a===l.length)return l;let f=l.slice(0,a);for(;a<l.length;a++){let h=l.charCodeAt(a);h!==9&&h!==10&&h!==13&&(f+=l[a])}return f})(A),s=0,o=A,g="",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=Fe;switch(n){case 3:case 4:r=aA;break;case 5:r=RA;break;case 6:r=Y;break;case 7:r=Q;break;case 8:r=x}return r(c(A,s))!==1?i:null}function d(A,e){return s+=s===A?M(e):1,s<=o.length}function c(A,e){return e<A.length?A.codePointAt(e):void 0}function M(A){return A!=null&&A>65535?2:1}function le(A){return A==null?"":A<=65535?String.fromCharCode(A):String.fromCodePoint(A)}var Fe=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 g=o.slice(s,t).toLowerCase(),s=t,Qe(t<o.length?A:void 0)}else return E?1:(--s,d(e,A)?ue(c(o,s)):0)},Qe=A=>{let e=s;if(A===58){if(E){if(I(i.scheme)!==I(g))return 0;if((ie(i)||i.port!==null)&&g==="file")return 0;if(i.scheme==="file"&&i.host==="")return 0}return i.scheme=g,E?(i.port===se(i.scheme)&&(i.port=null),0):(g="",i.scheme==="file"?d(e,A)?kA(c(o,s)):0:I(i.scheme)&&D!==null&&D.scheme===i.scheme?d(e,A)?Ge(c(o,s)):0:I(i.scheme)?d(e,A)?Ve(c(o,s)):0:c(o,s+1)===47?(s++,d(e,A)?Ye(c(o,s)):0):(i.path=[""],i.opaquePath=!0,d(e,A)?ae(c(o,s)):0))}else return E?1:(g="",s=-1,d(e,A)?ue(c(o,s)):0)},ue=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)?x(c(o,s)):0):D.scheme==="file"?(s--,d(e,A)?kA(c(o,s)):0):(s--,d(e,A)?OA(c(o,s)):0)},Ge=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)?OA(c(o,s)):0)},Ye=A=>{let e=s;return A===47?d(e,A)?W(c(o,s)):0:(s--,d(e,A)?j(c(o,s)):0)},OA=A=>{let e=s;return i.scheme=D.scheme,A===47||I(i.scheme)&&A===92?d(e,A)?XA(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)?x(c(o,s)):0):A!=null?(i.query=null,i.path.pop(),s--,d(e,A)?j(c(o,s)):0):d(e,A)?OA(c(o,s)):0)},XA=A=>{let e=s;return I(i.scheme)&&(A===47||A===92)?d(e,A)?hA(c(o,s)):0:A===47?d(e,A)?W(c(o,s)):0:(i.username=D.username,i.password=D.password,i.host=D.host,i.port=D.port,s--,d(e,A)?j(c(o,s)):0)},Ve=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)?W(c(o,s)):0):d(e,A)?hA(c(o,s)):0},W=A=>{let e=s;if(A!=null&&A!==64&&A!==35&&A!==47&&A!==63&&(A!==92||!I(i.scheme))){let t=s+M(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===64||n===35||n===47||n===63||n===92&&I(i.scheme))break;t+=M(n)}return g+=o.slice(s,t),s=t-1,d(e,A)?W(c(o,s)):0}if(A===64){lA&&(g=`%40${g}`),lA=!0;for(let t=0;t<g.length;t++){let n=g.codePointAt(t);if(n===58&&!uA){uA=!0;continue}let r=ee(n,cA);uA?i.password+=r:i.username+=r,n!=null&&n>65535&&t++}return g="",d(e,A)?W(c(o,s)):0}else return A==null||A===35||A===47||A===63||A===92&&I(i.scheme)?lA&&g===""?1:(s-=g.length+1,g="",d(e,A)?aA(c(o,s)):0):(g+=le(A),d(e,A)?W(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||!I(i.scheme))){let t=s+M(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&&I(i.scheme))break;n===91?G=!0:n===93&&(G=!1),t+=M(n)}return g+=o.slice(s,t),s=t-1,d(e,A)?aA(c(o,s)):0}else if(A===58&&!G){if(g===""||E===4)return 1;let t=EA(g,!I(i.scheme));return t===null?1:(i.host=vA(t),g="",d(e,A)?RA(c(o,s)):0)}else if(A==null||A===35||A===47||A===63||A===92&&I(i.scheme)){if(s--,I(i.scheme)&&g==="")return 1;if(E&&g===""&&(ie(i)||i.port!==null))return 1;let t=EA(g,!I(i.scheme));return t===null?1:(i.host=vA(t),g="",E?0:d(e,A)?Y(c(o,s)):0)}else return g+=le(A),d(e,A)?aA(c(o,s)):0},RA=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 g+=o.slice(s,t),s=t-1,d(e,A)?RA(c(o,s)):0}else if(E||A==null||A===35||A===47||A===63||A===92&&I(i.scheme)){if(g!==""){let t=parseInt(g,10);if(t>65535)return 1;if(i.port=t===se(i.scheme)?null:t,g="",E)return 0}return E?1:(s--,d(e,A)?Y(c(o,s)):0)}else return 1};function ce(A,e){let t=A.length-e;if(t<2)return!1;if(ne(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 kA=A=>{let e=s;return i.scheme="file",i.host="",A===47||A===92?d(e,A)?Ke(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)?x(c(o,s)):0):A!=null?(i.query=null,ce(o,s)?i.path=[]:oe(i),s--,d(e,A)?j(c(o,s)):0):d(e,A)?kA(c(o,s)):0):(s--,d(e,A)?j(c(o,s)):0)},Ke=A=>{let e=s;return A===47||A===92?d(e,A)?LA(c(o,s)):0:(D!==null&&D.scheme==="file"&&(!ce(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)?j(c(o,s)):0)},LA=A=>{let e=s;if(A!=null&&A!==47&&A!==92&&A!==63&&A!==35){let t=s+M(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||n===92||n===63||n===35)break;t+=M(n)}return g+=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&&re(g))return d(e,A)?j(c(o,s)):0;if(g==="")return i.host="",E?0:d(e,A)?Y(c(o,s)):0;{let t=EA(g,!I(i.scheme));return t===null?1:(t==="localhost"&&(t=""),i.host=vA(t),g="",E?0:d(e,A)?Y(c(o,s)):0)}}return 1},Y=A=>{let e=s;return I(i.scheme)?(A!==92&&A!==47&&s--,d(e,A)?j(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)?x(c(o,s)):0):A!=null?(A!==47&&s--,d(e,A)?j(c(o,s)):0):(E&&i.host===null&&i.path.push(""),d(e,A)?Y(c(o,s)):0)},j=A=>{let e=s;if(A!=null&&A!==47&&(!I(i.scheme)||A!==92)&&(E||A!==63&&A!==35)){let t=s+M(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||I(i.scheme)&&n===92||!E&&(n===63||n===35))break;t+=M(n)}g+=_(o.slice(s,t),SA),s=t,A=c(o,t)}if(A==null||A===47||I(i.scheme)&&A===92||!E&&(A===63||A===35)){let t=I(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}})(g)?(oe(i),A!==47&&!t&&i.path.push("")):JA(g)&&A!==47&&!t?i.path.push(""):JA(g)||(i.scheme==="file"&&i.path.length===0&&re(g)&&(g=`${g[0]}:`),i.path.push(g)),g="",A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?x(c(o,s)):0):d(e,A)?j(c(o,s)):0}else return g+=ee(A,SA),d(e,A)?j(c(o,s)):0},ae=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)?x(c(o,s)):0;if(A!=null){let t=s+M(A);for(;t<o.length;){let r=c(o,t);if(r===63||r===35)break;t+=M(r)}let n=o.slice(s,t);if(t<o.length&&n.charCodeAt(n.length-1)===32?i.path[0]+=_(n.slice(0,-1),AA)+"%20":i.path[0]+=_(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)?x(c(o,s)):0}return d(e,A)?ae(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=I(i.scheme)?Se:qA;i.query+=_(o.slice(s,t),n)}return s=t,c(o,t)===35&&!E?(i.fragment="",d(e,A)?x(c(o,s)):0):d(e,A)?Q(c(o,s)):0},x=A=>{let e=s;return A!=null&&(i.fragment+=_(o.slice(s),be),s=o.length),d(e,A)?x(c(o,s)):0};function TA(A){if(A.opaquePath)return A.path[0];{let e="";for(let t of A.path)e+=`/${t}`;return e}}function fe(A){switch(A.scheme){case"blob":{let e=B(TA(A),null,null,0);return e===null||e.scheme!=="http"&&e.scheme!=="https"?"null":fe(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 b=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=S(e),t!=null&&(t=S(t));let n=null;if(t!=null&&(n=B(t,null,null,0),n==null))throw new TypeError(`Invalid base URL: ${t}`);let r=B(e,null,n,0);if(r==null)throw new TypeError(`Invalid URL: ${e}`);this[b]={url:r,query:null}}static createObjectURL(e){throw new TypeError("URL.createObjetURL is unsupported")}static revokeObjectURL(e){}static parse(e,t){e=S(e),t!==void 0&&(t=S(t));try{return new A(e,t)}catch{return null}}static canParse(e,t){e=S(e),t!==void 0&&(t=S(t));let n=null;return t!=null&&(n=B(t,null,null,0),n==null)?!1:B(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+=TA(t),t.query!==null&&(n+=`?${t.query}`),t.fragment!==null&&(n+=`#${t.fragment}`),n})(this[b].url)}set href(e){let t=B(e=S(e),null,null,0);if(t==null)throw new TypeError(`Invalid URL: ${e}`);this[b].url=t,this[b].query&&yA(this[b].query,t.query)}get origin(){return fe(this[b].url)}get protocol(){return`${this[b].url.scheme}:`}set protocol(e){B(`${e=S(e)}:`,this[b].url,null,2)}get username(){return this[b].url.username}set username(e){e=S(e),wA(this[b].url)||(function(n,r){n.username=_(r,cA)})(this[b].url,e)}get password(){return this[b].url.password}set password(e){e=S(e),wA(this[b].url)||(function(n,r){n.password=_(r,cA)})(this[b].url,e)}get host(){let{url:e}=this[b];return e.host==null?"":e.port==null?e.host:`${e.host}:${e.port}`}set host(e){e=S(e),this[b].url.opaquePath||B(e,this[b].url,null,3)}get hostname(){let{url:e}=this[b];return e.host!=null?e.host:""}set hostname(e){e=S(e),this[b].url.opaquePath||B(e,this[b].url,null,4)}get port(){let{url:e}=this[b];return e.port!=null?`${e.port}`:""}set port(e){e=S(e);let{url:t}=this[b];wA(t)||(e?B(e,t,null,5):t.port=null)}get pathname(){return TA(this[b].url)}set pathname(e){e=S(e);let{url:t}=this[b];t.opaquePath||(t.path=[],B(e,t,null,6))}get search(){let{url:e}=this[b];return e.query?`?${e.query}`:""}set search(e){e=S(e);let{url:t,query:n}=this[b];if(!e)t.query=null,n&&yA(n,null);else{let r=e[0]==="?"?e.substring(1):e;t.query="",B(r,t,null,7),n&&yA(n,t.query)}}get searchParams(){let e=this[b],t=e.query;return t==null&&(t=e.query=(function(r,u){let l=new fA;return l[C].url=r,l[C].serialized=u==null,u&&(l[C].list=NA(u)),l})(this,e.url.query)),t}get hash(){let{url:e}=this[b];return e.fragment?`#${e.fragment}`:""}set hash(e){e=S(e);let{url:t}=this[b];if(!e)t.fragment=null;else{let n=e[0]==="#"?e.substring(1):e;t.fragment="",B(n,t,null,8)}}toJSON(){return this.href}toString(){return this.href}};Object.defineProperty(eA.prototype,Symbol.toStringTag,{value:"URL",configurable:!0});var C=Symbol("URLSearchParamsImpl"),Je=Symbol.dispose||Symbol.for("dispose");function yA(A,e){e?A[C].list=NA(e):A[C].list.length=0,A[C].serialized=e==null}function oA(A){if(A.url){let e=CA(A.list);(function(n,r){n[b].url.query=r})(A.url,e||null),A.serialized=!0}}var We=typeof Iterator<"u"?Iterator:Object,Z=class extends We{constructor(e,t){super(),this[C]={ptr:e,map:t,index:0}}next(){let e=this[C];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}[Je](){}},fA=class{constructor(e){let t=this[C]={list:[],url:null,serialized:!0},n;if(Array.isArray(e))for(let r=0;r<e.length;r++)t.list.push(QA(e[r]));else if((n=ZA(e))!=null){let r;for(;!(r=PA(n.next())).done;)t.list.push(QA(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=Pe(l),f=S(e[l]),h=t.list.find(m=>m[0]===a);h?h[1]=f:t.list.push([a,f])}}else if(e!==void 0){let r=S(e);r=r[0]==="?"?r.substring(1):r,t.list=NA(r)}}get size(){return this[C].list.length}append(e,t){e=S(e),t=S(t),this[C].list.push([e,t]);let n=this[C];n.url&&n.serialized?(function(u,l){let a=u[b].url;a.query=a.query?`${a.query}&${l}`:l})(n.url,CA([[e,t]])):oA(n)}delete(e,t){e=S(e),t=t!=null?S(t):void 0;let{list:n}=this[C],r=0;for(;r<n.length;)n[r][0]===e&&(t==null||n[r][1]===t)?n.splice(r,1):r++;oA(this[C])}get(e){e=S(e);let{list:t}=this[C];for(let n=0;n<t.length;n++)if(t[n][0]===e)return t[n][1];return null}getAll(e){e=S(e);let t=[],{list:n}=this[C];for(let r=0;r<n.length;r++)n[r][0]===e&&t.push(n[r][1]);return t}has(e,t){e=S(e),t=t!=null?S(t):void 0;let{list:n}=this[C];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=S(e),t=S(t);let{list:n}=this[C],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[C])}sort(){this[C].list.sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0),oA(this[C])}forEach(e,t){if(typeof e!="function")throw new TypeError('The "callback" argument must be of type function');let{list:n}=this[C];for(let r=0;r<n.length;r++)e.call(t,n[r][1],n[r][0],this)}entries(){return new Z(this[C],e=>e)}keys(){return new Z(this[C],e=>e[0])}values(){return new Z(this[C],e=>e[1])}toString(){return CA(this[C].list)}[Symbol.iterator](){return this.entries()}};Object.defineProperty(fA.prototype,Symbol.toStringTag,{value:"URLSearchParams",configurable:!0});function he(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 w=++n;r=void 0,e=void 0;for(let y of[...u.values()])try{y?.()}catch{}w===n&&(e=p,l())}let f=()=>a();function h(p,w=!1){let y=$A.safeParse(p);if(!y.success||w&&Date.parse(y.data.expiresAt)<=Date.now()||Date.parse(y.data.refreshExpiresAt)<=Date.now()||Date.parse(y.data.refreshExpiresAt)<Date.parse(y.data.expiresAt))throw new P("INVALID_RESPONSE","Invalid customer session credentials");return y.data}async function m(){if(r)return r;let p=typeof e=="object"?e:void 0,w=n;if(!p||Date.parse(p.refreshExpiresAt)<=Date.now())throw p&&f(),new P("UNAUTHENTICATED","Customer authentication is required",401);let y=(async()=>{try{let N=await A(p.refreshToken);if(w!==n)throw new P("IDENTITY_CHANGED","Customer identity changed during refresh");let V=h(N,!0);if(V.customerId!==p.customerId||V.sessionId!==p.sessionId)throw new P("SCOPE_MISMATCH","Refresh changed the customer session");return e=V,{...V}}catch(N){throw w!==n?new P("IDENTITY_CHANGED","Customer identity changed during refresh"):(N instanceof P&&N.status===401&&f(),N)}})();r=y;try{return await y}finally{r===y&&(r=void 0)}}return{identify(p){let w=typeof p=="string"?p:h(p),y=typeof w=="string"?w:w.accessToken;if(!y.trim()||/\s/.test(y)||y.length>4096)throw new P("INVALID_TOKEN","A server-issued token is required");a(w)},reset:f,subscribeIdentity(p,w){return u.set(p,w),()=>{u.delete(p)}},access(){let p=typeof e=="object"?e:void 0;if(p&&Date.parse(p.expiresAt)<=Date.now()+3e4){let y=n;return m().then(()=>{let N=t();if(y!==n||!N)throw new P("IDENTITY_CHANGED","Customer identity changed during refresh");return N})}let w=t();if(!w)throw new P("NOT_IDENTIFIED","Identify a customer session before making a request");return w},peek:t,snapshot:()=>typeof e=="object"?{...e}:void 0,refresh:m}}var de=Symbol("IndianaNoContent");function ut(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 P("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 P("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 P("INVALID_URL","Use HTTPS, or HTTP on localhost during development");let a=A.fetch??globalThis.fetch.bind(globalThis),f=A.timeoutMs??1e4;if(!Number.isFinite(f)||f<1||f>12e4)throw new P("INVALID_TIMEOUT","timeoutMs must be between 1 and 120000");let h=!1,m=0,p=null,w=new Set,y=A.session??he(async q=>{let O=await tA("customer-sessions/refresh",{},"POST",{},q);if(!O||typeof O!="object")throw new P("INVALID_RESPONSE","Invalid refresh response");let{requestId:$,scope:H,...K}=O;return K});function N(){m+=1,p=null;for(let q of w)q.abort();w.clear()}let V=y.subscribeIdentity(N);function pe(){h||y.reset()}async function tA(q,O={},$="POST",H={},K){let k=H.installationDetach===!0;if(k&&(q!=="push/installations/detach"||$!=="POST"))throw new P("INVALID_REQUEST","Installation authority only detaches this installation");if(!K&&!k)throw new P("NOT_IDENTIFIED","Call identify with a server-issued customer token first");let J=m,L=new AbortController;k||w.add(L);let nA=()=>!k&&J!==m?new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):new P("TIMEOUT","Longplay request timed out"),dA,ge=new Promise((T,R)=>{dA=()=>R(nA()),L.signal.addEventListener("abort",dA,{once:!0})}),me=setTimeout(()=>L.abort(),H.timeoutMs??f),we=async()=>{let T=await a(`${l.href.replace(/\/$/,"")}/api/v1/${q}`,{method:$,headers:{...H.headers,"Content-Type":"application/json",...k?{}:{Authorization:`Bearer ${K}`},[pA]:gA.current,[xA]:zA.version,...u?{"X-Indiana-Project":u.projectId,"X-Indiana-Environment":u.environment}:{}},body:$==="POST"?JSON.stringify(O):void 0,signal:L.signal,credentials:"omit",cache:"no-store",redirect:"error",...H.keepalive?{keepalive:!0}:{}});if(L.signal.aborted)throw nA();let R;try{R=T.status===204?de:await T.json()}catch{throw L.signal.aborted?nA():new P(T.ok?"INVALID_RESPONSE":"HTTP_ERROR","The gateway returned an unreadable response",T.status,T.headers.get("X-Request-Id")??void 0)}if(L.signal.aborted)throw nA();if(!k&&J!==m)throw new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight");if(!T.ok){let v=UA.safeParse(R),z=v.success&&(!MA.safeParse(v.data.error.code).success||jA(v.data.error.code,T.status)),BA=z?v.data.error.code:"HTTP_ERROR",HA=_A(BA,T.status,{retryAfter:T.headers.get("Retry-After"),recovery:z?v.data.error.recovery:void 0,reason:z?v.data.error.reason:void 0});throw new P(BA,z?v.data.error.message:"Longplay request failed",T.status,T.headers.get("X-Request-Id")??(v.success?v.data.requestId:void 0),{...HA,...v.success&&v.data.error.retryable===!1?{retryable:!1}:{},...HA.retryAfterSeconds===void 0&&v.success&&v.data.error.retryAfterSeconds!==void 0?{retryAfterSeconds:v.data.error.retryAfterSeconds}:{}})}if(T.headers.get(pA)!==gA.current)throw new P("PROTOCOL_MISMATCH","Response protocol does not match this SDK");if(u&&R!==de){let v=R&&typeof R=="object"&&"scope"in R?R:R&&typeof R=="object"&&"configuration"in R?R.configuration:null;if(!v||typeof v!="object"||!("scope"in v))throw new P("INVALID_RESPONSE","Response is missing its App/environment scope");let z=sA.safeParse(v.scope);if(!z.success||z.data.projectId!==u.projectId||z.data.environment!==u.environment)throw new P("SCOPE_MISMATCH","Response scope does not match this SDK instance")}let rA=T.headers.get("X-Indiana-Telemetry-Subject");if(rA){if(!/^[a-f0-9]{64}$/.test(rA))throw new P("INVALID_RESPONSE","Invalid telemetry identity");p!==rA&&(p=rA,e?.(p))}return R};try{return await Promise.race([we(),ge])}catch(T){throw!k&&J!==m?new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):T instanceof P?T:new P(L.signal.aborted?"TIMEOUT":"NETWORK_ERROR",L.signal.aborted?"Longplay request timed out":"Unable to read the Longplay response")}finally{clearTimeout(me),L.signal.removeEventListener("abort",dA),w.delete(L)}}return{session:y,requestWithCredential(q,O,$,H={}){return h?Promise.reject(new P("CLOSED","SDK client was destroyed")):tA(q,O,"POST",H,$)},subjectKey:()=>p,identify(q){if(h)throw new P("CLOSED","SDK client was destroyed");if(u&&typeof q=="object"&&"scope"in q){let O=sA.safeParse(q.scope);if(!O.success||O.data.projectId!==u.projectId||O.data.environment!==u.environment)throw new P("SCOPE_MISMATCH","Customer session belongs to another App/environment")}y.identify(q)},reset:pe,dispose(){h||(h=!0,V(),N())},request(q,O={},$="POST",H={}){if(h)return Promise.reject(new P("CLOSED","SDK client was destroyed"));if(H.installationDetach)return tA(q,O,$,H);let K=m;try{let k=y.access(),J=L=>{if(K!==m)throw new P("IDENTITY_CHANGED","Customer identity changed before dispatch");return tA(q,O,$,H,L)};return typeof k=="string"?J(k):k.then(J)}catch(k){return Promise.reject(k)}}}}export{eA as a,ut as b};
@@ -0,0 +1 @@
1
+ import{b as fe}from"./chunk-THGLNE4K.js";import{a as B}from"./chunk-34I23EKZ.js";import{g as he,h as Ie,j as we,l as ge,p as M,r as ye}from"./chunk-LFFBNGXP.js";import{a as V,i as G}from"./chunk-RKREEPCT.js";import{b as me}from"./chunk-5HJMAZ7A.js";import{a as s}from"./chunk-SJNF6JDJ.js";import{Ga as ue,db as ce,eb as le,fb as de,ma as L,pb as pe}from"./chunk-O4535GJR.js";import{a as ee}from"./chunk-DSPLGTQI.js";import{a as se}from"./chunk-MHEYMXGZ.js";import{z as m}from"zod";var be=L.options[0].refine(l=>!l.customer&&!l.customerData),Fe=m.strictObject({receiptId:m.uuid(),operationId:m.uuid(),terminal:m.enum(["complete","native"]).nullable()}),Se=m.strictObject({schemaVersion:m.literal(1),baseUrl:m.url(),scope:se,customerId:m.uuid(),sessionId:m.uuid(),start:be,allowed:m.array(m.enum(["merchant","record_only","indiana","native"])),run:m.strictObject({id:m.uuid(),versionId:m.uuid(),status:ue.shape.status,revision:m.number().int().nonnegative(),runExpiresAt:m.iso.datetime({offset:!0}).optional()}).optional(),purchases:m.array(Fe).max(100),operationCommand:m.strictObject({operationId:m.uuid(),intent:m.literal("confirm")}).optional(),journal:m.strictObject({revision:m.number().int().nonnegative(),entry:he.nullable()})});function Pe(l){return we({...l,namespace:"purchases",identity:[l.scope.projectId,l.scope.environment,l.customerId]})}function Ce(l){let c=new URL(l.baseUrl??pe).href,E=()=>new s("PURCHASE_STORAGE_INVALID","Purchase recovery storage is unavailable or invalid; native fallback is not authorized");async function C(){l.assertCurrent();try{let w=await l.storage.read();if(l.assertCurrent(),!Number.isSafeInteger(w.revision)||w.revision<0)throw E();let r=w.entry===null?null:Se.parse(w.entry);if(r&&(r.baseUrl!==c||r.customerId!==l.customerId||r.scope.projectId!==l.scope.projectId||r.scope.environment!==l.scope.environment))throw new s("SCOPE_MISMATCH","Purchase recovery belongs to another Customer or environment");if(r?.journal.entry&&(r.journal.entry.scope.projectId!==r.scope.projectId||r.journal.entry.scope.environment!==r.scope.environment||r.journal.entry.funnelId!==r.start.funnelId||r.journal.entry.runId!==r.run?.id||r.journal.entry.versionId!==r.run?.versionId)||r?.operationCommand&&!r.purchases.some(P=>P.operationId===r.operationCommand?.operationId))throw E();return{revision:w.revision,entry:r}}catch(w){throw w instanceof s?w:E()}}async function z(w){for(let r=0;r<8;r++){let P=await C(),R=w(structuredClone(P.entry));if(JSON.stringify(R)===JSON.stringify(P.entry))return R;R&&Se.parse(R),l.assertCurrent();let v;try{v=await l.storage.write(P.revision,R)}catch{throw E()}if(l.assertCurrent(),v!==null){if(!Number.isSafeInteger(v)||v<=P.revision)throw E();return R}}throw new s("PURCHASE_STORAGE_CONFLICT","Another consumer changed this purchase; recover the original attempt")}return{read:C,update:z,baseUrl:c}}function Oe(l){let c=l.purchases.find(E=>E.type==="checkout");if(!l.actions.includes("continue_checkout")||c?.type!=="checkout")throw new s("PURCHASE_PENDING","No single resumable Checkout is confirmed");return c.checkoutUrl}function Ke(l){let c={...l,scope:{...l.scope},executionPolicy:structuredClone(l.executionPolicy)},E=c.session.snapshot();if(!E)throw new s("CUSTOMER_SESSION_REQUIRED","Purchase recovery requires a verified Customer session");let{customerId:C,sessionId:z}=E,w=!1,r=null,P,R=null,v=!1,O,T,U,b={mode:"idle",status:"idle",actions:["start"],purchases:[]},h=new Map,A=new Map,ne=new AbortController,k=new Set,Q=me(c),te=fe(Q.request);function D(e){return{code:e instanceof s?e.code:"PURCHASE_RECOVERY_BLOCKED",message:e instanceof Error?e.message:"The original purchase requires server confirmation",...e instanceof s&&e.status!==void 0?{status:e.status}:{}}}function y(){if(w||c.session.snapshot()?.customerId!==C)throw new s("IDENTITY_CHANGED","The original purchase Customer changed")}let I=Ce({...c,customerId:C,assertCurrent:y,storage:c.storage??Pe({baseUrl:c.baseUrl,scope:c.scope,customerId:C})}),Ee=c.session.subscribeIdentity(re);function re(){w||(w=!0,clearTimeout(U),ne.abort(new s("IDENTITY_CHANGED","Purchase consumer was destroyed")),Ee(),r?.reset(),r=null,R=null,Q.dispose(),k.clear(),h.clear(),A.clear())}function S(e){y();let n=JSON.stringify(e)!==JSON.stringify(b);b=e,clearTimeout(U),(e.mode==="operation"||e.mode==="run"&&!e.actions.includes("close"))&&["waiting_result","fulfillment","recording"].includes(e.status)&&(U=setTimeout(()=>{_().catch(()=>{})},5e3)),n&&ee(c.onRecovery,structuredClone(e));for(let t of n?k:[]){if(w)break;ee(t,structuredClone(e))}return structuredClone(e)}function f(e){if(y(),!e||e.start.requestId!==P)throw new s("PURCHASE_STORAGE_CONFLICT","This purchase was superseded; the old consumer cannot dispatch")}function F(e){let n=[...e.purchases],t=e.journal.entry?.purchase;return t&&!n.some(i=>i.operationId===t.operationId)&&n.push({receiptId:t.receiptId,operationId:t.operationId,terminal:null}),n}function x(e){return e.run&&!["running","waiting"].includes(e.run.status)&&!e.journal.entry?.command&&!e.journal.entry?.closeCommand&&!e.operationCommand&&F(e).every(n=>n.terminal!==null)}function q(e,n){let t=e.journal.entry?.command??e.journal.entry?.closeCommand,i=F(e).map(g=>{let Z=h.get(g.operationId);return g.terminal&&!Z?{type:g.terminal,operationId:g.operationId}:V({quote:Z?.quote??null,operation:Z??null,requestId:t?.requestId??null,pending:!1,destroyed:!1,canReselect:A.get(g.operationId)===!0})}),u=i.filter(g=>!["complete","native"].includes(g.type)),o=u[0],a=u.length===1&&o?.operationId?h.get(o.operationId):void 0;if(a&&(o?.type==="checkout"||o?.type==="cancel"))try{M({allowed:e.allowed.filter(g=>c.executionPolicy.allowed.includes(g))},a.quote)}catch(g){return{mode:n,status:"blocked",actions:["refresh",...n==="run"&&e.run&&["running","waiting"].includes(e.run.status)?["close"]:[]],purchases:i,error:D(g)}}let d;if(n==="operation"&&!t&&o?.type==="cancel"&&a?.quote&&!a.problem&&!a.confirmedAt)try{M({allowed:e.allowed.filter(g=>c.executionPolicy.allowed.includes(g))},a.quote),Date.parse(a.quote.expiresAt)>Date.now()&&(d={operationId:a.operationId,quote:a.quote})}catch{}let p=i.length>0&&u.length===0,j=x(e)||n==="operation"&&p&&!t&&!e.operationCommand?"complete":o?.type==="checkout"?"checkout":o?.type==="fulfillment"?"fulfillment":o?.type==="recording"?"recording":t||e.operationCommand||o&&o.type!=="cancel"||n==="operation"&&!d?"waiting_result":"ready";return{mode:n,status:j,purchases:i,...d?{confirmation:structuredClone(d)}:{},actions:["refresh",...x(e)?["start"]:[],...n==="run"&&e.run&&["running","waiting"].includes(e.run.status)?["close"]:[],...e.operationCommand?["retry"]:d?["confirm"]:[],...u.length===1&&o?.type==="checkout"?["continue_checkout"]:[]]}}function J(e){let n=V({quote:e?.quote??null,operation:e??null,requestId:null,pending:!1,destroyed:!1,canReselect:e&&A.get(e.operationId)===!0});return n.type==="complete"||n.type==="native"?n.type:null}function K(e){if(!e.operation)return;let n={...e.operation,...e.operation.quote?{}:e.quote?{quote:e.quote}:{}};if(n.merchantExecution&&n.merchantExecution.customerId!==C)throw new s("SCOPE_MISMATCH","Purchase execution belongs to another Customer");let t=G(h.get(n.operationId)??null,n);h.set(n.operationId,t),t===n&&A.set(n.operationId,e.canReselect===!0)}async function ve(e){y();for(let t of[e.purchase,e.run.paywall])t&&K(t);let n=await I.update(t=>{if(f(t),t.run&&(t.run.id!==e.run.id||t.run.versionId!==e.run.source.versionId))throw new s("SCOPE_MISMATCH","The original purchase Run changed");let i=F(t);for(let u of[e.purchase,e.run.paywall]){let o=u?.operation?.operationId??u?.quote?.operationId;if(!u||!o)continue;let a=i.find(p=>p.operationId===o);if(a&&a.receiptId!==u.receiptId)throw new s("INVALID_RESPONSE","The original purchase Receipt changed");let d=J(h.get(o));a?a.terminal??=d:i.push({receiptId:u.receiptId,operationId:o,terminal:d})}return{...t,purchases:i,run:t.run&&(t.run.revision>e.run.revision||!["running","waiting"].includes(t.run.status)&&["running","waiting"].includes(e.run.status))?t.run:{id:e.run.id,versionId:e.run.source.versionId,status:e.run.status,revision:e.run.revision,runExpiresAt:e.run.runExpiresAt}}});f(n),n.run&&!["running","waiting"].includes(n.run.status)&&F(n).some(t=>!t.terminal)&&(n=await Y(n,!n.journal.entry?.command&&!n.journal.entry?.closeCommand,new Set([e.purchase?.operation?.operationId,e.run.paywall?.operation?.operationId].filter(t=>!!t)))),f(n),S(q(n,"run"))}function Re(){return{async read(){let{entry:e}=await I.read();return f(e),structuredClone(e.journal)},async write(e,n){let t=null;return await I.update(i=>{if(f(i),i.operationCommand&&n?.command&&n.command.operation!=="close")throw new s("PURCHASE_PENDING","Recover the original Operation command before dispatching a Run mutation");return t=null,i.journal.revision!==e?i:(t=e+1,{...i,journal:{revision:t,entry:n}})}),t}}}async function Y(e,n=!1,t=new Set){f(e);let i=F(e);for(let o of i){if(o.terminal)continue;let a=t.has(o.operationId)?h.get(o.operationId):void 0;if(a??=await oe(e,o),y(),a.operationId!==o.operationId)throw new s("INVALID_RESPONSE","Original Operation changed");if(a.merchantExecution&&a.merchantExecution.customerId!==C)throw new s("SCOPE_MISMATCH","Purchase execution belongs to another Customer");if(n&&!e.operationCommand&&V({quote:a.quote??null,operation:a,requestId:null,pending:!1,destroyed:!1}).type==="cancel"){if({operation:a}=await te.attach({operationId:o.operationId,intent:"cancel"}),y(),a.operationId!==o.operationId)throw new s("INVALID_RESPONSE","Original cancellation Operation changed");a=await oe(e,o)}h.set(o.operationId,G(h.get(o.operationId)??null,a))}let u=await I.update(o=>{f(o);let a=o.operationCommand&&h.get(o.operationCommand.operationId);return{...o,...a&&(a.confirmedAt||a.merchantExecution||a.status!=="pending")?{operationCommand:void 0}:{},purchases:F(o).map(d=>({...d,terminal:d.terminal??J(h.get(d.operationId))}))}});return f(u),u}async function W(e){y();let n=await Q.request("funnels",e);return y(),n}async function oe(e,n){let t=B(de,await W({operation:"recover_purchase",runId:e.run.id,funnelId:e.start.funnelId,purchase:{receiptId:n.receiptId,operationId:n.operationId}}));if($(e,t),t.purchase.receiptId!==n.receiptId||t.purchase.operation?.operationId!==n.operationId)throw new s("INVALID_RESPONSE","Original purchase reference changed");return K(t.purchase),h.get(n.operationId)}async function ae(e){for(let n of[e.journal.entry?.command,e.journal.entry?.closeCommand]){if(!n)continue;let t=B(le,await W({operation:"settle_command",runId:e.run.id,funnelId:e.start.funnelId,requestId:n.requestId,...n.operation==="resume"?{}:{command:n}}));if($(e,t),t.settlement.requestId!==n.requestId)throw new s("INVALID_RESPONSE","Original command settlement changed");t.purchase&&K(t.purchase);let i=await I.update(u=>{f(u);let o=F(u),{receiptId:a,operationId:d}=t.settlement;if(a&&d){let j=o.find(g=>g.operationId===d);if(j&&j.receiptId!==a)throw new s("INVALID_RESPONSE","Original Receipt changed");j||o.push({receiptId:a,operationId:d,terminal:J(h.get(d))})}let p=t.settlement.state==="settled"?Ie(u.journal.entry,n.requestId):u.journal.entry;return{...u,purchases:o,journal:p===u.journal.entry?u.journal:{revision:u.journal.revision+1,entry:p}}});f(i),e=i}return e}function $(e,n){if(n.customerId!==C||n.scope.projectId!==c.scope.projectId||n.scope.environment!==c.scope.environment||n.target.funnelId!==e.start.funnelId||n.target.startRequestId!==e.start.requestId||e.run&&(n.target.runId!==e.run.id||n.target.versionId!==e.run.versionId))throw new s("SCOPE_MISMATCH","The original recovery binding changed")}async function X(e,n){if(f(e),e.run&&(e=await ae(e)),!F(e).length&&x(e))return S(q(e,"operation"));if(!F(e).length)return S({mode:"blocked",status:"blocked",actions:["refresh"],purchases:[],error:D(n)});v=!0;let t=await Y(e);return S(q(t,"operation"))}async function H(e,n=!1,t=!0){if(P=e.start.requestId,R=structuredClone({requestId:e.start.requestId,funnelId:e.start.funnelId,locale:e.start.locale,parameters:e.start.parameters}),!r){let i=e.run?{operation:"recover_run",runId:e.run.id,funnelId:e.start.funnelId}:{operation:"recover_start",intent:n?"resume":"lookup",start:{requestId:e.start.requestId,funnelId:e.start.funnelId,locale:e.start.locale,parameters:e.start.parameters}},u;try{u=await W(i)}catch(p){if(!e.run&&p instanceof s&&(p.status===void 0||p.status>=500))return S({mode:"blocked",status:"blocked",actions:["refresh","retry"],purchases:b.purchases,error:D(p)});throw p}let o=B(ce,u);if(o.customerId!==C||o.scope.projectId!==c.scope.projectId||o.scope.environment!==c.scope.environment)throw new s("SCOPE_MISMATCH","Recovery Customer or environment changed");if(o.outcome==="unknown")return S({mode:"blocked",status:"blocked",actions:["refresh","retry"],purchases:b.purchases,error:{code:"RESULT_UNKNOWN",message:"The original Start outcome remains unknown; retry only its original input"}});$(e,o);let a=await I.update(p=>(f(p),{...p,run:{id:o.target.runId,versionId:o.target.versionId,status:o.target.status,revision:o.view?.revision??p.run?.revision??0,runExpiresAt:o.target.runExpiresAt}}));if(f(a),e=a,o.access.type==="operation_only")return X(e,new s("RUN_RECONCILIATION_REQUIRED","Only the original command and Operation can be recovered"));e=await ae(e);let d=o.view;if(d.locale!==e.start.locale||!ge(d.parameters,e.start.parameters))throw new s("INVALID_RESPONSE","The original Start input changed");r=ye({...c,customerRun:{runId:o.target.runId,customerId:C,startRequestId:e.start.requestId},funnelId:e.start.funnelId,funnelExecutionPolicy:{allowed:e.allowed.filter(p=>c.executionPolicy.allowed.includes(p))},funnelCommandStorage:Re(),onAcceptedResponse:ve},{scope:o.scope,run:d})}try{await r.get(),r.view?.pendingRequest?.requestId===e.start.requestId&&!r.pendingCommands?.length&&await r.resume(r.view.pendingRequest.requestId);for(let u of r.pendingCommands??[])u.operation!=="close"&&await r.settle?.(u.requestId);r.pendingCommands?.length&&await r.retry(),y();let i=(await I.read()).entry;return f(i),S(q(i,"run"))}catch(i){if(y(),t&&i instanceof s&&(i.status===401||i.status===409&&i.reason==="STATE_CHANGED")){r.reset(),r=null;let u=(await I.read()).entry;return f(u),H(u,!1,!1)}throw i}}function N(e,n="read"){if(y(),O)return n==="read"||n===T?O:O.then(()=>N(e,n),()=>N(e,n));clearTimeout(U);let t=e().catch(i=>{throw w||S({mode:"blocked",status:"blocked",actions:["refresh"],purchases:b.purchases,error:D(i)}),i});return O=t,T=n,t.then(()=>{O===t&&(O=void 0,T=void 0)},()=>{O===t&&(O=void 0,T=void 0)}),t}function _(){return N(async()=>{let{entry:e}=await I.read();return e?(P&&e.start.requestId!==P&&(r?.reset(),r=null,h.clear(),A.clear()),v&&P===e.start.requestId?X(e,b.error):H(e)):S({mode:"idle",status:"idle",actions:["start"],purchases:[]})})}async function ie(){let e=await _();return e.mode==="operation"&&!e.actions.includes("confirm")&&!e.actions.includes("retry")?e:N(async()=>{let n=(await I.read()).entry;if(f(n),!v){if(!r?.view?.paywall?.quote)throw new s("PURCHASE_PENDING","Read the original quote before confirming");let a=r.view.paywall.operation;if(a?.confirmedAt||a?.merchantExecution||a&&a.status!=="pending")return S(q(n,"run"));if(r.pendingCommands?.length)await r.retry();else{let p=r.view;await r.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:p.nodeId,visit:p.visit,revision:p.revision,input:{type:"paywall_confirm",operationId:p.paywall.quote.operationId}})}let d=(await I.read()).entry;return f(d),S(q(d,"run"))}let t=n.operationCommand?.operationId??b.confirmation?.operationId,i=t&&h.get(t);if(!t||!i||n.journal.entry?.command||n.journal.entry?.closeCommand)throw new s("PURCHASE_PENDING","The original Run command must be settled before Operation confirmation");M({allowed:n.allowed.filter(a=>c.executionPolicy.allowed.includes(a))},i.quote),await I.update(a=>{if(f(a),a.journal.entry?.command||a.journal.entry?.closeCommand||a.operationCommand&&a.operationCommand.operationId!==t)throw new s("PURCHASE_PENDING","Another original command is pending");return{...a,operationCommand:{operationId:t,intent:"confirm"}}});let u=await te.attach({operationId:t,intent:"confirm"});if(y(),u.operation.operationId!==t)throw new s("INVALID_RESPONSE","Original confirmation Operation changed");h.set(t,G(i,u.operation));let o=(await I.read()).entry;return f(o),S(q(await Y(o,!1,new Set([t])),"operation"))},"confirm")}return{get controller(){return r},get recovery(){return structuredClone(b)},get attempt(){return y(),structuredClone(R)},get identitySignal(){return ne.signal},start(e){let n=L.parse({...structuredClone(e),operation:"start",requestId:e.requestId??crypto.randomUUID()});if(n.operation!=="start"||n.customer||n.customerData)throw new s("INVALID_REQUEST","A Customer-owned Funnel start is required");return N(async()=>{let t=await I.update(i=>{if(i&&!x(i)){if(i.start.funnelId!==n.funnelId)throw new s("PURCHASE_PENDING","Recover the original Funnel before starting another purchase");return i}return{schemaVersion:1,baseUrl:I.baseUrl,scope:c.scope,customerId:C,sessionId:z,start:n,allowed:[...c.executionPolicy.allowed],purchases:[],journal:{revision:0,entry:null}}});if(!t)throw new s("PURCHASE_STORAGE_INVALID","Original start was not retained");return P!==t.start.requestId&&(r?.reset(),r=null,h.clear(),A.clear(),v=!1),v?X(t,b.error):H(t,!0)},`start:${n.funnelId}`)},refresh:_,confirm:ie,retry:()=>v?ie():N(async()=>{let{entry:e}=await I.read();return e?H(e,!0):S({mode:"idle",status:"idle",actions:["start"],purchases:[]})},"retry"),async close(){return r?.view?N(async()=>{if(!r?.view)throw new s("PURCHASE_PENDING","Recover the original Run before closing");if(r.pendingCommands?.find(t=>t.operation==="close"))await r.retry();else if(["running","waiting"].includes(r.view.status)){let t=r.view;await r.submit({operation:"close",requestId:crypto.randomUUID(),nodeId:t.nodeId,visit:t.visit,revision:t.revision})}let n=(await I.read()).entry;return f(n),S(q(n,"run"))},"close"):_()},async continueCheckout(e){let n=await _();y(),await e(Oe(n))},subscribe(e){return k.add(e),()=>{k.delete(e)}},destroy:re}}export{Pe as a,Oe as b,Ke as c};
@@ -0,0 +1 @@
1
+ import{a as R,b as re}from"./chunk-THGLNE4K.js";import{a as ne,b as j,c as ie,f as se}from"./chunk-TUYBXAAK.js";import{a as m,q as U}from"./chunk-LFFBNGXP.js";import{b as te}from"./chunk-5HJMAZ7A.js";import{a as o}from"./chunk-SJNF6JDJ.js";import{Da as d,Fa as G,Ra as ee,_ as $,a as K,b as Q,c as W,d as M,e as H,f as X,ia as Z,q as B}from"./chunk-O4535GJR.js";import{a as J}from"./chunk-DSPLGTQI.js";import{a as Y}from"./chunk-MHEYMXGZ.js";var L=t=>{if(!Number.isSafeInteger(t)||t<0||t>=Number.MAX_SAFE_INTEGER)throw new o("INVALID_STATE","Installation sequence exhausted");return t+1},ve=async t=>[...new Uint8Array(await crypto.subtle.digest("SHA-256",Uint8Array.from(t,e=>e.charCodeAt(0))))].map(e=>e.toString(16).padStart(2,"0")).join("");function _(t,e){return t.transaction(n=>{if(!Number.isSafeInteger(n.identitySeq)||n.identitySeq<0||!Number.isSafeInteger(n.addressSeq)||n.addressSeq<0||n.detachSeq!==null&&(!Number.isSafeInteger(n.detachSeq)||n.detachSeq<1||n.detachSeq>n.identitySeq))throw new o("INVALID_STATE","Installation journal is invalid");return e({...n})})}function oe(t,e,n){let r=null,s=0,a=0,l=0,y=Promise.resolve(),g=!1;if(t&&(!n||Y.parse(t.scope).projectId!==n.projectId||t.scope.environment!==n.environment))throw new o("SCOPE_MISMATCH","Push installation belongs to another scope");let p=()=>{if(g)throw new o("CLOSED","SDK client was destroyed");if(!t)throw new o("NOT_CONFIGURED","Configure this client's native Push host first");return t},A=i=>{if(i!==s)throw new o("IDENTITY_CHANGED","Identity changed during Push operation")};async function D(i){let c=p();if(!c.sha256&&!globalThis.crypto?.subtle)throw new o("NOT_CONFIGURED","Configure native SHA-256 for this Push host");let u=c.sha256?await c.sha256(Uint8Array.from(i,b=>b.charCodeAt(0))):await ve(i);if(!/^[a-f0-9]{64}$/.test(u))throw new o("INVALID_STATE","Push credential digest is invalid");return u}function f(i){let c=H.parse(i);if(c.installationId.toLowerCase()!==p().installationId.toLowerCase())throw new o("INVALID_RESPONSE","Push response belongs to another installation");return c}async function S(i,c){let u=p(),b={installationId:u.installationId,publicKey:u.publicKey,issuedAt:new Date().toISOString(),...c},P=await u.sign(X(i,u.scope,b));return{...b,signature:P}}let I=(i,c,u)=>e.requestWithCredential?e.requestWithCredential(i,c,u):e.request(i,c);async function q(){let i=p(),c=s,u=r?await(e.session?.access()??r):null,b=_(i,w=>w),P;if(b.detachSeq!==null){let w=b.detachSeq,x=K.parse(await S("detach",{sequence:w,platform:i.platform}));try{let k=await e.request("push/installations/detach",{...i.scope,...x},"POST",{installationDetach:!0});if(!k||typeof k!="object"||!("installation"in k))throw new o("INVALID_RESPONSE","Push detach acknowledgement is invalid");let F=f(k.installation);if(F.bound||F.identitySeq!==w)throw new o("INVALID_RESPONSE","Push detach acknowledgement does not match its intent")}catch(k){if(k instanceof o&&k.status===404)P=k;else if(!(k instanceof o)||k.status!==412)throw k}P||_(i,k=>({...k,detachSeq:k.detachSeq===w?null:k.detachSeq}))}if(A(c),!u){if(P)throw P;return null}let E=d.bindPushInstallation,N=E.request.parse(await S("bind",{sequence:l,platform:i.platform,credentialDigest:await D(u)}));A(c);let C=E.response.parse(await I(E.path,N,u));A(c);let T=f(C.installation);if(!T.bound||T.identitySeq!==l)throw new o("INVALID_RESPONSE","Push binding acknowledgement does not match its intent");return P&&b.detachSeq!==null&&l>b.detachSeq&&_(i,w=>({...w,detachSeq:w.detachSeq===b.detachSeq?null:w.detachSeq})),T}async function h(){p();let i=s,c=r?await(e.session?.access()??r):null;if(!c)throw new o("NOT_IDENTIFIED","Identify before reading this installation");let u=d.readPushInstallation,b=u.request.parse(await S("read",{credentialDigest:await D(c)}));A(i);let P=u.response.parse(await I(u.path,b,c));return A(i),f(P.installation)}function O(i=q){let c=y.catch(()=>{}).then(i);return y=c,c.catch(u=>{try{t?.onError?.(u instanceof Error?u:new Error("Push synchronization failed"))}catch{}}),c}async function v(i,c,u){let b=p(),P=c.identity,E=c.observation,N=r?await(e.session?.access()??r):null;if(A(P),E!==a)throw new o("INVALID_STATE","Push observation changed during recovery");if(!N)throw new o("NOT_IDENTIFIED","Identify before recovering a Push address");if(!i.connectionId||!i.kind||!i.token||!["granted","provisional"].includes(i.permission))throw new o("INVALID_REQUEST","Recovery needs a provider token and notification permission");return await O(async()=>{if(A(P),await q(),A(P),E!==a)throw new o("INVALID_STATE","Push observation changed during recovery");let C=_(b,F=>u?F:{...F,addressSeq:L(F.addressSeq)}),w=await S(u?"recovery_confirm":"recovery_request",{...i,sequence:C.addressSeq,credentialDigest:await D(N),...u?{challenge:u}:{}}),x=u?W.parse(w):Q.parse(w);if(A(P),E!==a)throw new o("INVALID_STATE","Push observation changed during recovery");let k=await I(`push/installations/recovery/${u?"confirm":"request"}`,x,N);if(A(P),E!==a||_(b,F=>F).addressSeq!==C.addressSeq)throw new o("INVALID_STATE","Push observation changed during recovery");if(u){let F=d.updatePushAddress.response.parse(k),V=f(F.installation);if(!V.bound||V.identitySeq!==l||V.addressSeq!==C.addressSeq||V.connectionId!==i.connectionId||V.addressStatus!=="active")throw new o("INVALID_RESPONSE","Push recovery acknowledgement does not match its intent");return V}if(!k||typeof k!="object"||!("recovery"in k))throw new o("INVALID_RESPONSE","Push recovery acknowledgement is invalid");return M.parse(k.recovery)})}return{recoveryObserver(){p();let i={identity:s,observation:++a};return{async request(c){return M.parse(await v(c,i))},async confirm(c,u){return H.parse(await v(u,i,c))}}},identify(i){if(!t)return;l=_(t,u=>({...u,identitySeq:L(u.identitySeq)})).identitySeq,r=i,s++,a++},reset(){if(t)try{_(t,i=>{let c=L(i.identitySeq);return{...i,identitySeq:c,detachSeq:c}})}finally{r=null,s++,a++}},start(){t&&!g&&O()},destroy(){g=!0,r=null,s++,a++},async sync(){return await O()},read:h,async recover(){let i=p(),c=s,u=l;return a++,await O(async()=>{A(c);let b=await h();return A(c),l=_(i,E=>{if(E.identitySeq!==u)throw new o("IDENTITY_CHANGED","A newer installation intent exists");return{...E,identitySeq:L(Math.max(E.identitySeq,b.identitySeq)),addressSeq:Math.max(E.addressSeq,b.addressSeq)}}).identitySeq,await q()})},tokenObserver(){p();let i=++a,c=s;return async u=>{if(i!==a||c!==s)return null;let b=p(),P=r?await(e.session?.access()??r):null;if(!P)throw new o("NOT_IDENTIFIED","Identify before registering a Push token");if(await O(),A(c),i!==a)return null;let E=_(b,w=>({...w,addressSeq:L(w.addressSeq)})),N=d.updatePushAddress,C=N.request.parse(await S("address",{...u,sequence:E.addressSeq,credentialDigest:await D(P)}));if(A(c),i!==a)return null;let T=await I(N.path,C,P);return A(c),i!==a||_(b,w=>w).addressSeq!==E.addressSeq?null:f(N.response.parse(T).installation)}}}}function ae(t,e){let n={async preference(r){let s=d.readMessagingPreference;return(await m(t,s,{channel:r})).preference},async setPreference(r){let s=d.setMessagingPreference;return(await m(t,s,r)).preference}};return{messaging:n,push:{sync:e.sync,read:e.read,recover:e.recover,tokenObserver:e.tokenObserver,recoveryObserver:e.recoveryObserver,async preference(){return n.preference("push")},async setPreference(r){return n.setPreference({...r,channel:"push"})}}}}function ce(t,e,n={}){let r=!1;function s(){if(r)throw new o("CLOSED","SDK client was destroyed")}let a=new Set,l=g=>{for(let p of a)try{p(g)}catch{}},y=t.session.subscribeIdentity(()=>{l(!!t.session.peek()),n.afterChange?.()},()=>{e()});return{assertActive:s,isIdentified:()=>!r&&!!t.session.peek(),methods:{subscribeIdentity(g){return s(),a.add(g),()=>{a.delete(g)}},identify(g){s();let p=typeof g=="string"?g:g.accessToken;if(!B.test(p))throw new o("INVALID_TOKEN","Browser SDK requires a customer session");n.beforeIdentify?.(p),t.identify(g)},reset(){if(!r)try{n.beforeReset?.()}finally{t.reset()}},destroy(){if(!r){r=!0,y(),a.clear();try{n.beforeDestroy?.(),e()}finally{t.dispose()}}}}}}var Ee={...d.readHoldings,request:d.readHoldings.request.omit({customerId:!0})};function ue(t){return{async checkEntitlement(e){R(e);let n=d.checkEntitlement,r=n.request.parse(e),s=await m(t,n,r);return ne(r.requirement,s.check,void 0,s.scope),s},async readHoldings(e={}){return m(t,Ee,e)}}}function de(t){return{async readLedger(e){let n=d.readLedger;return m(t,n,{query:e})},async readCreditStatement(e){R(e);let n=d.readCreditStatement;return m(t,n,e)},async quoteBalance(e){R(e);let n=d.quoteBalance;return m(t,n,{command:e})}}}function le(t){return{async setupPayment(e){R(e);let n=d.setupPayment;return m(t,n,e)},async readPaymentSetup(e){R(e);let n=d.readPaymentSetup;return m(t,n,e)},async readBillingInvoice(e){R(e);let n=d.readBillingInvoice;return m(t,n,e)},async readBillingControls(e={}){R(e);let n=d.readBillingControls;return m(t,n,e)},async prepareBillingAuthorization(e){R(e);let n=d.prepareBillingAuthorization;return m(t,n,e)},async confirmBillingAuthorization(e){R(e);let n=d.confirmBillingAuthorization;return m(t,n,e)},async setBillingCoupons(e){R(e);let n=d.setBillingCoupons;return m(t,n,e,{request:"Invalid billing coupon list",response:"Invalid billing coupon receipt"})},async revokeBillingAuthorization(e){R(e);let n=d.revokeBillingAuthorization;return m(t,n,e)},async listBillingInvoices(e={after:null,limit:25}){R(e);let n=d.listBillingInvoices;return m(t,n,e)},async confirmBillingAdjustment(e){R(e);let n=d.confirmBillingAdjustment;return m(t,n,e)}}}function pe(t){return{async redeemReward(e){return R(e),(await m(t,d.redeemReward,{...e,requestId:e.requestId??crypto.randomUUID()},{request:"Invalid reward redemption",response:"Invalid reward receipt"})).redemption},async claimRewardProduct(e){return R(e),(await m(t,d.claimRewardProduct,e,{request:"Invalid reward product claim",response:"Invalid reward product checkout"})).checkout},async createReferralCode(e){return R(e),(await m(t,d.createReferralCode,{...e,requestId:e.requestId??crypto.randomUUID()},{request:"Invalid referral program",response:"Invalid referral code"})).referralCode},async redeemCoupon(e,n=crypto.randomUUID()){let r=await m(t,d.redeemCoupon,{code:e,requestId:n},{request:"Invalid coupon code",response:"Invalid Coupon receipt"});return{offer:r.offer,reason:r.reason}},async claimCoupon(e,n=crypto.randomUUID()){let r=await m(t,d.grantOffer,{couponId:e,requestId:n},{request:"Invalid Coupon claim",response:"Invalid Coupon receipt"});return{offer:r.offer,reason:r.reason}},async listOffers(){return(await m(t,d.listOffers,{},{response:"Invalid offers response"})).offers}}}function fe(t){return{...ue(t),...de(t),...le(t),...re(t),...pe(t)}}function me(t){return{async resolveContent(e){R(e);let n=d.resolveContent;return m(t,n,e)},async resolvePaywall(e){R(e);let n=d.resolvePaywall,r=n.request.parse(e),s=await m(t,n,r);return j(r,s.paywall.check,s.scope),s},async resolveOffering(e){R(e);let n=d.resolveOffering,r=n.request.parse(e),s=await m(t,n,r);return j(r,s.check,s.scope),s}}}var z=t=>new TextEncoder().encode(JSON.stringify(t)).length,ye=16384,be=5e3,Ae=6e4,Se=5;function Oe(t){return t instanceof o&&t.status!==void 0&&t.status>=400&&t.status<500&&!t.retryable}function Ie(t,e){let n=0,r,s=h=>{r={config:structuredClone(h),until:Date.now()+3e4}},a=[],l=null,y,g=0;function p(){if(!e())throw new o("NOT_IDENTIFIED","Call identify before using Features or events")}function A(){y||!a.length||!e()||(y=setTimeout(()=>{y=void 0,S().catch(()=>{}).finally(A)},Math.min(be*2**g,Ae)),typeof y=="object"&&"unref"in y&&y.unref())}function D(h){if(p(),r&&Date.now()<r.until&&!$(r.config,h.kind))return;q();let O=d.trackEvents.request.parse({events:[{...h,eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString()}]}).events[0];if(z({events:[O]})>ye)throw new o("INVALID_REQUEST","Event exceeds the delivery size limit");if(a.length>=500)throw new o("EVENT_QUEUE_FULL","Flush pending events before tracking more");a.push(structuredClone(O)),A()}function f(h,O={},v={}){D({kind:"custom",name:h,properties:O,...v})}async function S(h=!1){if(p(),l)return l;let O=n,v=(async()=>{let i={inserted:0,duplicates:0,rejected:0,skipped:0,rejections:[]},c=a.length;for(;c&&O===n;){let u=[],b=z({events:[]});for(let N of a.slice(0,Math.min(c,100))){let C=z(N)+(u.length?1:0);if(u.length&&b+C>ye)break;u.push(N),b+=C}let P=d.trackEvents,E;try{if(E=await m(t,P,{events:u},void 0,{keepalive:h}),O!==n)throw new o("IDENTITY_CHANGED","Event identity changed during delivery");if(E.inserted+E.duplicates+E.rejected+E.skipped!==u.length||E.rejections.length!==E.rejected)throw new o("INVALID_RESPONSE","Incomplete event acknowledgement")}catch(N){throw O===n&&(g++,(Oe(N)||g>=Se)&&(a.splice(0,u.length),g=0)),N}g=0,s(E.analyticsConfig),a.splice(0,u.length),c-=u.length,i.inserted+=E.inserted,i.duplicates+=E.duplicates,i.rejected+=E.rejected,i.skipped+=E.skipped,i.rejections.push(...E.rejections)}return i})();l=v;try{return await v}finally{l===v&&(l=null)}}let I;function q(){if(I||typeof document>"u")return;let h=()=>{document.visibilityState==="hidden"&&e()&&a.length&&S(!0).catch(()=>{})};document.addEventListener("visibilitychange",h),I=()=>document.removeEventListener("visibilitychange",h)}return{rememberConfiguration:s,track:f,observe:D,flush:S,reset(){n++,r=void 0,clearTimeout(y),y=void 0,a=[],g=0,l=null},detachVisibility(){I?.(),I=void 0}}}function he(t){let e=t.merchandise;if(typeof t.merchandiseId=="string")return{internalId:t.merchandiseId};if(!(!e||typeof e!="object"||Array.isArray(e))){if(typeof e.internalId=="string")return{internalId:e.internalId};if(typeof e.externalId=="string")return{id:e.externalId};if(typeof e.id=="string")return{id:e.id}}}var Pe=new Set([...Z,"merchandiseId","merchandise"]);function Ce(t){let e=he(t);return{...Object.fromEntries(Object.entries(t).filter(([r])=>!Pe.has(r))),...e?{merchandise:e}:{}}}function ge(t,e,n,r,s){if(s&&r&&(s.scope.projectId!==r.projectId||s.scope.environment!==r.environment))throw new o("SCOPE_MISMATCH","Configuration belongs to another App/environment");let a=0,l=new Set;function y(){if(!e())throw new o("NOT_IDENTIFIED","Call identify before using Features or events")}async function g(p={}){s||y();let A=a,D=!1,f=async()=>{if(D||A!==a)throw new o("IDENTITY_CHANGED","Feature identity changed");let C=d.getFeatures,T=s?{scope:{projectId:s.scope.projectId,environment:s.scope.environment},payload:await s.features()}:await m(t,C,{});if(A!==a)throw new o("IDENTITY_CHANGED","Feature identity changed");if(r&&(T.scope.projectId!==r.projectId||T.scope.environment!==r.environment))throw new o("INVALID_RESPONSE","Feature response scope changed");return n.rememberConfiguration(T.payload.analyticsConfig),T},S=await f(),I=!0,q,h=C=>{try{p.onError?.(C)}catch{}},O=(C,T)=>{try{let w=he(T);n.observe({...C,...w?{merchandise:w}:{}})}catch(w){h(w)}},v=ie({assertUsable:s?.assertFeatures,scope:S.scope,attributes:p.attributes,onError:p.onError,load:async()=>I?(I=!1,S.payload):(await f()).payload,evaluateRemote:async C=>{if(A!==a)throw new o("IDENTITY_CHANGED","Feature identity changed");let T=d.evaluateFeatures,w=await m(t,T,{...C,attributes:Ce(C.attributes)});if(w.scope.projectId!==S.scope.projectId||w.scope.environment!==S.scope.environment)throw new o("INVALID_RESPONSE","Remote Feature response scope changed");return{generation:w.generation,evaluatedAt:w.evaluatedAt,expiresAt:w.expiresAt,features:w.features,...w.merchandiseContext?{merchandiseContext:w.merchandiseContext}:{}}},onExperimentViewed:(C,T,w,x)=>O({kind:"experiment_exposure",generation:x,experimentId:C.key,variationId:T.key},w),onFeatureUsage:(C,T,w,x)=>O({kind:"feature_usage",generation:x,feature:C,value:T.value??null,source:T.source,ruleId:T.ruleId,...T.experimentResult?{variationId:T.experimentResult.key}:{}},w)}),i=v.refresh;function c(){clearTimeout(q),!s&&(D||A!==a||!v.expiresAt||(q=setTimeout(()=>{u().catch(h)},Math.min(2147483647,Math.max(1e3,Date.parse(v.expiresAt)-Date.now()))),typeof q=="object"&&"unref"in q&&q.unref()))}async function u(){try{return await i()}finally{c()}}let b=()=>{D||u().catch(h)},P=v.subscribe(c),E=s?.subscribe(()=>{!D&&s.fresh&&u().catch(h)});function N(){D||(D=!0,clearTimeout(q),typeof window<"u"&&window.removeEventListener("focus",b),P(),E?.(),v.reset(),l.delete(N))}l.add(N);try{await v.init(),(p.attributes?.merchandise||p.attributes?.merchandiseId)&&await v.refreshRemote()}catch(C){throw N(),C}return c(),!s&&typeof window<"u"&&window.addEventListener("focus",b),Object.assign(v,{refresh:u,destroy:N})}return{features:g,reset(p){a++,p();for(let A of l)A()}}}import{z as Re}from"zod";function we(t,e){let n="source"in e?{funnelId:e.source.id,funnelVersionId:e.source.versionId}:"versionId"in e?{funnelId:e.funnelId,funnelVersionId:e.versionId}:e,r=Re.object({funnelId:G.shape.id,funnelVersionId:G.shape.versionId.optional()}).safeParse(n);if(!r.success)throw new o("INVALID_REQUEST","A valid Funnel source is required");let s=Object.freeze(r.data);function a(l){if("customerId"in l)throw new o("INVALID_REQUEST","Customer identity cannot be overridden");if("funnelId"in l&&l.funnelId!==void 0&&l.funnelId!==s.funnelId||"funnelVersionId"in l&&l.funnelVersionId!==void 0&&l.funnelVersionId!==s.funnelVersionId)throw new o("SCOPE_MISMATCH","The original Funnel source cannot change");return{...l,...s}}return{async claimCoupon(l,y=crypto.randomUUID()){let g=d.grantOffer,p=await m(t,g,a({couponId:l,requestId:y}));return{offer:p.offer,reason:p.reason}},async resolveOffering(l){let y=d.resolveOffering,g=y.request.parse(a(l)),p=await m(t,y,g);return j(g,p.check,p.scope),p},async resolvePaywall(l){let y=d.resolvePaywall,g=y.request.parse(a(l)),p=await m(t,y,g);return j(g,p.paywall.check,p.scope),p},async previewAttach(l){let y=d.previewAttach;return m(t,y,a(l))}}}function Vt(t){return Te(t)}function Te(t){let e=te(t),n=e.request,r;try{r=oe(t.push,e,t.scope??t.configuration?.scope)}catch(y){throw e.dispose(),y}let s=ce(e,()=>{l.reset(a.reset),a.detachVisibility()},{beforeIdentify:r.identify,beforeReset:r.reset,afterChange:r.start,beforeDestroy:r.destroy}),a=Ie(n,s.isIdentified),l=ge(n,s.isIdentified,a,t.scope,t.configuration);return{session:e.session,...ae(n,r),...fe(n),...me(n),forFunnel(y){return s.assertActive(),we(n,y)},async features(y={}){return s.assertActive(),l.features(y)},track(y,g,p={}){return a.track(y,g,p)},flush(){return a.flush()},...s.methods}}function Ht(t){if(!B.test(t.customerToken))throw new o("INVALID_TOKEN","A customer credential is required");if(!t.scope)throw new o("INVALID_REQUEST","An explicit App and environment scope is required");let e=se({...t,scope:t.scope,apiKey:t.customerToken});return{async start(n){let r=await e.start(n),s=U({...t,runToken:r.runToken,initialResponse:r});s.identify(t.customerToken);let a=await s.get();return{...r,...a,controller:s}}}}function Qt(t){if(!t.scope)throw new o("INVALID_CONFIGURATION","An explicit process App/environment scope is required");if(t.session!==void 0)throw new o("INVALID_CONFIGURATION","The merchant process adapter owns the session");let e=null,n,r=0,s=new Set,a=new Map,l=new Map;async function y(f){let S,I=new Promise((q,h)=>{S=setTimeout(()=>h(new o("TIMEOUT","Process bridge request timed out")),t.timeoutMs??35e3)});try{return await Promise.race([Promise.resolve().then(f),I])}finally{clearTimeout(S)}}function g(f){throw f instanceof o&&(f.status===401||f.reason==="CUSTOMER_BINDING_CONFLICT")&&(r++,n?.reset(),n=void 0,e=null,a.clear(),l.clear()),f}function p(f,S){if(S!==r)throw new o("IDENTITY_CHANGED","Process was detached during a request");let I=ee.parse(f);if(I.scope.projectId!==t.scope.projectId||I.scope.environment!==t.scope.environment)throw new o("SCOPE_MISMATCH","Process response belongs to another App/environment");if(e&&(e.run.id!==I.run.id||e.run.source.versionId!==I.run.source.versionId||e.run.source.id!==I.run.source.id||e.run.runExpiresAt!==I.run.runExpiresAt||e.run.identity.startedAs!==I.run.identity.startedAs||e.run.identity.participantId!==I.run.identity.participantId||e.run.identity.binding&&I.run.identity.binding&&e.run.identity.binding.id!==I.run.identity.binding.id))throw new o("INVALID_RESPONSE","The process changed its Run or Customer binding");if(!e||I.run.revision>=e.run.revision){if(e?.run.identity.binding&&!I.run.identity.binding)throw new o("INVALID_RESPONSE","The process lost its Customer binding");e=I;for(let b of s)J(b,I.run);I.run.instruction?.type==="authentication_required"&&J(t.onAuthenticationRequired,I.run)}I.settlement?.accepted!==void 0&&l.set(I.settlement.requestId,I.settlement.accepted);let{identity:q,instruction:h,...O}=I.run,{contract:v,settlement:i,...c}=I,u=i&&(({accepted:b,...P})=>P)(i);return{...c,run:{...O,authenticated:q.binding!==null,instruction:h?.type==="authentication_required"?null:h},...u?{settlement:u}:{}}}let A=f=>(a.has(f)||a.set(f,e?.run.identity.binding?.id??null),a.get(f));async function D(f){let S=r,I=e?.run.identity.binding?.id??null,q=O=>{if(I!==(e?.run.identity.binding?.id??null))throw O;return g(O)};if(f.operation==="page_experiments"){if(!t.adapter.pageExperiments)throw new o("CAPABILITY_UNAVAILABLE","Process page experiments are unavailable",501);return y(()=>t.adapter.pageExperiments(f.release,f.usedReceiptIds)).catch(q)}let h;if(f.operation==="get"){let{operation:O,customerToken:v,...i}=f;h=await y(()=>t.adapter.get({...i,...i.settlementRequestId?{settlementBindingId:A(i.settlementRequestId)}:{}})).catch(q)}else if(f.operation==="review")h=await y(()=>t.adapter.review(f.receiptId)).catch(q);else{if(f.operation==="start")throw new o("INVALID_REQUEST","Use process.open for entry");{let{customerToken:O,...v}=f;h=await y(()=>t.adapter.command(v,A(v.requestId))).catch(q)}}return p(h,S)}return{get view(){return e?.run??null},get controller(){return n},async open(f){let S=r,I=await y(()=>t.adapter.open(f)).catch(g),q=p(I,S);if(!n){n=U({...t,runToken:I.runToken,initialResponse:q,process:{request:D,binding:A,restore(v){for(let[i,c]of Object.entries(v))a.set(i,c)}}});let h=n,O=h.submit;h.submit=async v=>{try{return await O(v)}catch(i){if(!(i instanceof o)||i.reason!=="IDENTITY_CONTEXT_CHANGED"||v.operation!=="submit"||v.input.type!=="screen"||a.get(v.requestId)!==null)throw i;await h.settle?.(v.requestId),await h.get();let c=h.view;if(l.get(v.requestId)!==!1||!c||c.id!==e?.run.id||c.nodeId!==v.nodeId||c.visit!==v.visit||!e?.run.identity.binding)throw i;return O({...v,requestId:crypto.randomUUID(),revision:c.revision})}}}await n.get();for(let h of n.pendingCommands??[])a.has(h.requestId)&&a.get(h.requestId)!==(e?.run.identity.binding?.id??null)&&await n.settle?.(h.requestId);return{run:e.run,controller:n}},async syncIdentity(){let f=r;p(await y(()=>t.adapter.syncIdentity()).catch(g),f),await n?.get();for(let S of n?.pendingCommands??[])a.has(S.requestId)&&a.get(S.requestId)!==(e?.run.identity.binding?.id??null)&&await n?.settle?.(S.requestId);return e.run},async detach(){r++,n?.reset(),n=void 0,e=null,a.clear(),l.clear(),await y(()=>t.adapter.detach())},forProcess(f){if(!e?.run.identity.binding)throw new o("UNAUTHENTICATED","Sign in before a commercial operation",401);return{runId:e.run.id,bindingId:e.run.identity.binding.id,receiptId:f}},subscribe(f){return s.add(f),()=>{s.delete(f)}},destroy(){r++,n?.reset(),n=void 0,e=null,a.clear(),l.clear(),s.clear()}}}export{Vt as a,Te as b,Ht as c,Qt as d};
@@ -0,0 +1 @@
1
+ import{d as t}from"./chunk-LFFBNGXP.js";import{kb as n}from"./chunk-O4535GJR.js";function r(e,o,a){return n(e,o,a,t)}export{r as a};
@@ -0,0 +1 @@
1
+ import{a as Me,c as ln}from"./chunk-JGG4R75K.js";import{d as on,f as qe,g as Le,h as sn,i as Ve,k as an}from"./chunk-ZX2RWS3T.js";import{a as _e,e as Ze,f as en,g as nn,h as tn,i as rn}from"./chunk-RKREEPCT.js";import{a as h}from"./chunk-SJNF6JDJ.js";import{b as un,e as cn}from"./chunk-SLUA7ABW.js";import{d as dn}from"./chunk-OEH47Y2L.js";import{Z as Ke,ma as Te}from"./chunk-O4535GJR.js";import{a as oe}from"./chunk-DSPLGTQI.js";import{Da as Ye,I as xe,Na as Xe}from"./chunk-MHEYMXGZ.js";async function pn(n){let{session:P,load:v}=Pn(n);try{return await v(),P}catch(e){throw P.destroy(),e}}function Pn(n){let P=n.view;if(!P?.paywall)throw new h("INVALID_REQUEST","The current node is not a Paywall");let v=P.paywall.receiptId,e=P.nodeId,f=P.visit,D=P.paywall.resolution,o=P.paywall,F="document"in D?{document:D.document,offering:D.offering,capabilities:D.capabilities}:null;function r(){let i=o.resolution;return"document"in i?i:F&&{...i,document:F.document,offering:F.offering,capabilities:Ze(i.capabilities,F.capabilities)}}function w(i){if(!en(i,D))throw new h("INVALID_RESPONSE","The pinned Paywall binding changed")}let d=!1,R=new Set,_=null;function T(){let i=r();if(i&&!d)for(let p of R)oe(p,structuredClone(i))}async function E(){U();let i=r();if(i)return structuredClone(i);if(!_){let p=(async()=>{if("document"in o.resolution||!n.resolvePaywall)throw new h("INVALID_RESPONSE","Public Paywall reader is unavailable");let I=await n.resolvePaywall(o.resolution);return U(),w(I),F={document:I.document,offering:I.offering,capabilities:I.capabilities},T(),r()})();_=p;let a=()=>{_===p&&(_=null)};p.then(a,a)}return _.then(p=>structuredClone(p))}let c=new AbortController,O=(n.pendingCommands??(n.pendingCommand?[n.pendingCommand]:[])).find(i=>i.operation==="submit"&&i.nodeId===e&&i.visit===f&&i.input.type==="paywall_quote")?.requestId??P.paywall.purchaseRequestId,G=0,M=null,q=new Set,j=null,m=new Map;function A(i){if(i.purchase&&i.purchase.receiptId!==v)throw new h("INVALID_RESPONSE","Purchase receipt changed");let p=i.run.paywall;return i.purchase??(p?.receiptId===v?p:null)}function U(){if(d)throw new h("IDENTITY_CHANGED","Paywall presentation has closed")}function X(i,p,a){if(U(),p!==G||a!==void 0&&o.quote?.operationId!==a)return!1;let I=o.selectionGeneration??0,u=i.run.paywall;if(u?.receiptId===v){if((u.selectionGeneration??0)<(o.selectionGeneration??0))return!1;w(u.resolution)}let g=A(i),Q=u?.receiptId===v&&(u.selectionGeneration??0)>I,J=Q?g?.quote??null:g?.quote??o.quote,K=g?.operation??(J?.operationId===o.quote?.operationId?o.operation:null);return J&&K&&nn(K,{operationId:J.operationId},"Purchase operation changed"),(Q||J?.operationId!==o.quote?.operationId)&&(G++,u?.receiptId===v&&(O=u.purchaseRequestId)),o={...o,...u?.receiptId===v?u:{},quote:J,operation:rn(o.operation,K,!0)},T(),!0}function k(i,p,a){return new Promise((I,u)=>{let g=!1,Q=()=>{clearTimeout(ye),c.signal.removeEventListener("abort",W)},J=ae=>{g||(g=!0,Q(),I(ae))},K=ae=>{g||(g=!0,Q(),u(ae))},W=()=>K(new h("IDENTITY_CHANGED","Paywall presentation has closed")),ye=setTimeout(()=>K(new h("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,a)),Math.max(0,p-Date.now()));c.signal.addEventListener("abort",W,{once:!0}),c.signal.aborted&&W(),i.then(J,K)})}function B(i){return new Promise(p=>{let a=()=>{clearTimeout(I),c.signal.removeEventListener("abort",a),p()},I=setTimeout(a,i);c.signal.addEventListener("abort",a,{once:!0}),c.signal.aborted&&a()})}function L(i,p){U();let a=m.get(i)??n.pendingCommands?.find(g=>g.requestId===i)??n.pendingCommand;if(a?.operation==="submit"&&a.requestId===i&&a.nodeId===e&&a.visit===f){p.type==="paywall_quote"&&a.input.type==="paywall_quote"&&a.input.predecessor&&!p.predecessor&&(p={...p,predecessor:a.input.predecessor});let g=Te.parse(a),Q=Te.parse({...a,input:p});if(g.operation!=="submit"||Q.operation!=="submit"||JSON.stringify(g.input)!==JSON.stringify(Q.input))throw new h("CONFLICT","A purchase request cannot change its input");return m.set(i,g),g}let I=n.view;if(!I||I.nodeId!==e||I.visit!==f||I.paywall?.receiptId!==v)throw new h("PRECONDITION_FAILED","The Paywall visit has changed");let u=Te.parse({operation:"submit",requestId:i,nodeId:e,visit:f,revision:I.revision,input:structuredClone(p)});if(u.operation!=="submit")throw new h("INVALID_REQUEST","A purchase submission is required");return m.set(i,u),u}async function se(i,p){U();let{requestId:a,input:I}=i,u=Date.now()+3e4;q.add(a);try{let g=await k(n.submit(i),u,a);for(;g.run.pendingRequest?.requestId===a&&Date.now()<u&&!d&&(await B(Math.min(1e3,u-Date.now())),!(d||Date.now()>=u));)g=await k(n.resume(a),u,a);if(d)throw new h("IDENTITY_CHANGED","Paywall presentation has closed");if(g.run.pendingRequest?.requestId===a)throw new h("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,a);if(!X(g,p,I.type==="paywall_confirm"||I.type==="paywall_cancel"?I.operationId:void 0))throw new h("PRECONDITION_FAILED","The purchase selection has changed");j===a&&(j=null)}catch(g){throw j=a,g instanceof h&&g.code==="COMMAND_PENDING"&&g.status===void 0&&m.delete(a),g}finally{q.delete(a)}}async function b(i){if(!o.quote)throw new h("INVALID_REQUEST","A quoted purchase is required");let p=i==="confirm"?"paywall_confirm":"paywall_cancel",a=[...m.values(),...n.pendingCommands??(n.pendingCommand?[n.pendingCommand]:[])].find(u=>u.operation==="submit"&&u.input.type===p&&"operationId"in u.input&&u.input.operationId===o.quote.operationId),I=a?.operation==="submit"&&a.input.type===p&&"operationId"in a.input&&a.input.operationId===o.quote.operationId?a.requestId:crypto.randomUUID();if(await se(L(I,{type:i==="confirm"?"paywall_confirm":"paywall_cancel",operationId:o.quote.operationId}),G),!o.operation)throw new h("INVALID_RESPONSE","The accepted purchase result is missing");return structuredClone(o.operation)}let S={get view(){return structuredClone(r())},get quote(){return o.quote?structuredClone(o.quote):null},get operation(){return o.operation?structuredClone(o.operation):null},get webViewUrl(){return n.webViewUrl},get canReselect(){return o.canReselect===!0},get recovery(){let i=n.pendingCommands??(n.pendingCommand?[n.pendingCommand]:[]),p=n.pendingPurchase;if(p&&(p.receiptId!==v||p.operationId!==o.quote?.operationId))return{type:"recover",operationId:p.operationId,requestId:i[0]?.requestId??null};let a=_e({quote:o.quote,operation:o.operation,requestId:i[0]?.requestId??j??O,pending:q.size>0||i.length>0||j!==null,destroyed:d,canReselect:o.canReselect});return a.type==="recover"&&a.requestId===null&&!d&&n.hasDurableJournal===!0&&!o.quote&&!o.operation&&(o.selectionGeneration??0)===0&&!p&&!i.length&&!q.size&&!O?{type:"native",operationId:null}:a},get pendingCancellation(){return!d&&(n.pendingCommands??(n.pendingCommand?[n.pendingCommand]:[])).some(i=>i.operation==="submit"&&i.nodeId===e&&i.visit===f&&i.input.type==="paywall_cancel"&&i.input.operationId===o.quote?.operationId)},subscribe(i){return d?()=>{}:(R.add(i),()=>R.delete(i))},async refresh(){U();let i=G,p=await n.get();if(X(p,i),p.run.paywall?.receiptId!==v)throw new h("PRECONDITION_FAILED","Paywall presentation has changed");return E()},preview(i){let p=r();if(!p)return Promise.reject(new h("PRECONDITION_FAILED","Load the Paywall presentation first"));if(O&&O!==i.requestId&&(M||o.canReselect!==!0))return Promise.reject(new h("COMMAND_PENDING","Retry the original purchase before starting another"));let a=p.document.buttons[i.actionId],I=a?.type==="checkout"?Ke(a.product,i.selection,p.capabilities):null;if(!I)return Promise.reject(new h("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));let u=Xe(p.document.screen,I,i.selection,p.capabilities),g=O!==i.requestId&&(o.selectionGeneration??0)>0?{operationId:o.quote?.operationId??null,generation:o.selectionGeneration??0}:void 0;if(g&&o.canReselect!==!0)return Promise.reject(new h("COMMAND_PENDING","Original purchase requires authoritative termination"));let Q;try{Q=L(i.requestId,{type:"paywall_quote",actionId:i.actionId,productVersionId:I,...Object.keys(u).length?{featureQuantities:u}:{},...g?{predecessor:g}:{},...i.offerId?{offerId:i.offerId}:{},...i.nativeOffer?{nativeOffer:i.nativeOffer}:{}})}catch(W){return Promise.reject(W)}if(O===i.requestId&&M)return M;O!==i.requestId&&G++;let J=G;O=i.requestId;let K=(async()=>{if(await se(Q,J),!o.quote)throw new h("INVALID_RESPONSE","The accepted quote is missing");return tn(o.quote,{productVersionId:I,featureQuantities:u},"The selected purchase changed"),structuredClone(o.quote)})();return M=K,K.then(()=>{M===K&&(M=null)},W=>{M===K&&(M=null),O===i.requestId&&n.pendingCommand?.requestId!==i.requestId&&W instanceof h&&W.status!==void 0&&W.status<500&&![401,425].includes(W.status)&&(O=null)}),K},confirm:()=>b("confirm"),cancel:()=>b("cancel"),async read(){if(U(),!o.quote)throw new h("INVALID_REQUEST","A quoted purchase is required");let i=o.quote.operationId,p=G,a=n.pendingCommands?.find(J=>J.operation==="submit"&&(J.input.type==="paywall_confirm"||J.input.type==="paywall_cancel")&&J.input.operationId===i)??n.pendingCommand;a?.operation==="submit"&&(a.input.type==="paywall_confirm"||a.input.type==="paywall_cancel")&&a.input.operationId===i&&await n.settle?.(a.requestId);let I=await n.get(void 0,{receiptId:v,operationId:i});U();let u=A(I);if(u?.quote&&u.quote.operationId!==i||u?.operation&&u.operation.operationId!==i)throw new h("INVALID_RESPONSE","Purchase operation changed");let g=X(I,p,i),Q=g?o.operation:u?.operation;if(!Q)throw new h("INVALID_RESPONSE","The current purchase result is missing");return g&&q.size===0&&!(n.pendingCommands?.length??(n.pendingCommand?1:0))&&(j=null),structuredClone(Q)},destroy(){d=!0,ne(),R.clear(),c.abort(),m.clear()}},ne=n.subscribe(i=>{d||i.nodeId!==e||i.visit!==f||i.paywall?.receiptId!==v||(i.paywall.selectionGeneration??0)<(o.selectionGeneration??0)||(w(i.paywall.resolution),o={...o,resolution:i.paywall.resolution},T())});return{session:S,load:E}}function fn(n){let P=new Set,v=new Set,e=null;async function f(r,w){let d=!1;for(;!n.stopped&&n.key===r&&n.client.pendingCommand?.requestId===w;){if(!n.client.settle)throw new h("COMMAND_PENDING","The original display acknowledgement is still pending");await n.client.settle(w),d=!0,n.client.pendingCommand?.requestId===w&&await new Promise(R=>setTimeout(R,1500))}n.stopped||n.key!==r||(d&&await n.client.get(),!(n.stopped||n.key!==r)&&P.add(r))}function D(r,w){e=w;let d=()=>{e===w&&(e=null),v.delete(r)};return w.then(d,R=>{d(),n.busy||n.fail(R)}),w}function o(r){if(n.reviewing||P.has(r)||v.has(r)||n.stopped)return;v.add(r);let w=async()=>{if(n.reviewing||n.stopped||n.key!==r||P.has(r)){v.delete(r);return}if(n.busy||n.client.pendingCommand){setTimeout(()=>{w()},250);return}let d=(async()=>{if(n.staleRead){if(await n.staleRead,n.stopped||n.key!==r)return;if(n.client.pendingCommand){setTimeout(()=>{w()},250);return}}let R=n.client.view,_=n.expected(),T=_.requestId;try{await n.client.submit({operation:"shown",..._})}catch(E){if(!(E instanceof h)||E.code!=="CONFLICT"||E.status!==409||n.client.pendingCommand)throw E;await n.client.get();let c=n.client.view;if(n.stopped||n.reviewing||n.key!==r||!c||!R||c.id!==R.id||c.source.versionId!==R.source.versionId||c.nodeId!==_.nodeId||c.visit!==_.visit||c.revision<=_.revision||c.stopped||!c.screen&&(!c.paywall||c.paywall.receiptId!==R.paywall?.receiptId)||!["running","waiting"].includes(c.status)||n.client.pendingCommand)throw E;let N=n.expected();T=N.requestId,await n.client.submit({operation:"shown",...N})}await f(r,T)})();D(r,d)};w()}function F(){if(e)return e;let r=n.client.pendingCommand;if(r?.operation!=="shown")return null;let w=n.key;return v.add(w),D(w,(async()=>{await n.client.retry(),await f(w,r.requestId)})())}return{report:o,settled:F,get inFlight(){return e}}}function mn(n){let P={},v=new Map;async function e(f){let D=n.client.view,o=D?.screen,F=o?.customerData.nodes[f.nodeId];if(n.stopped||n.busy||!D||!o||!F)return;if(!["refresh","next","previous","filter","sources_next","sources_previous"].includes(f.action)){let E=n.document,c=E?Ye(E,f.nodeId):null,N=c?.type==="customer_data"?c.data.outputs?.[f.action]:void 0;N&&o.outputs.includes(N)?await n.perform(()=>n.client.submit({operation:"submit",...n.expected(),input:{type:"screen",output:N,answers:n.answers,selection:f.value?{[f.nodeId]:f.value}:{}}})):await n.onIntent?.(f,D);return}let w=f.action.startsWith("sources_")?F.resources.find(E=>E.key===f.value):null;if(f.action.startsWith("sources_")&&!w)throw new h("INVALID_REQUEST","Choose a current resource");let d=`${D.visit}:${f.nodeId}:${w?.key??""}`,R=v.get(d)??[null],T=P[f.nodeId]??{page:1,after:null,filter:"all",...w?{resourceKey:w.key}:{}};if(f.action==="filter"){let E=f.value;if(!E||!(F.source==="offer_history"?["all","issued","reserved","redeemed","expired","revoked"]:["all","purchase","refund","source","usage","debt","settlement"]).includes(E))throw new h("INVALID_REQUEST","Unknown data filter");T={page:1,after:null,filter:E},R.splice(0,R.length,null)}else if(f.action==="next"||f.action==="sources_next"){let E=w?.sources.at(-1),c=w?E?{kind:"ledger",cursor:{at:E.detail[0],id:E.id,type:"source"}}:null:o.dataCursors[f.nodeId];if(!c||!w&&!F.hasNext)return;R[T.page]=c,T={...T,page:T.page+1,after:c}}else if(f.action==="previous"||f.action==="sources_previous"){if(T.page<=1)return;T={...T,page:T.page-1,after:R[T.page-2]??null}}v.set(d,R),P={...P,[f.nodeId]:T},await n.perform(()=>n.client.get({nodeId:D.nodeId,visit:D.visit,revision:D.revision,components:P}))}return{get queries(){return P},intent:e,reset(){P={},v.clear()}}}function wn(n){let{doc:P,holder:v,reviewHolder:e,mountScreenPreview:f}=n,D=!1,o,F=0,r=null,w="",d,R=new Map,_=c=>c?`${c.id}:${c.nodeId}:${c.visit}:${c.revision}:${c.paywall?.quote?.operationId??""}`:"";async function T(c){if(n.stopped||!n.client.review||D&&c===o&&d?.active)return;let N=!D||c!==o;D||(w=_(n.client.view),R.set(w,structuredClone(n.answers))),D=!0,o=c,v.hidden=!0,n.suspend(!0),e.hidden=!1;let O=++F;N&&(d?.finish("dismissed"),r?.destroy(),r=null,e.replaceChildren(),d=Le(e,n.loadingOptions,"funnel",()=>{E()}));let G=N?d:void 0;try{if(G?.start(!1,n.client.view?.locale),O!==F||n.stopped)return;let M=n.client.review(c),q=await(G?.wait(M,qe)??M);if(n.stopped||O!==F||!D)return;if(!q.review)throw new h("INVALID_RESPONSE","Historical projection is missing");r?.destroy(),r=null,G||e.replaceChildren();let j=P.createElement("div"),m=G?Ve(j,e):()=>{};e.append(j);let A=q.run.locale.startsWith("zh"),U=P.createElement("p");U.textContent=A?"\u53EA\u8BFB\u56DE\u770B":"Read-only history",j.append(U);for(let[k,B]of q.review.pages.entries()){let L=P.createElement("button");L.type="button",L.textContent=A?`\u7B2C ${k+1} \u9875`:`Page ${k+1}`,L.onclick=()=>{T(B.receiptId)},j.append(L)}if(q.review.page){let k=q.review.page,B=P.createElement("div");B.inert=!0,j.append(B),r=f(B,{mode:"live",rendererUrl:n.client.webViewUrl,title:k.document.name,onAction:()=>{},onAnswers:()=>{},onCustomerDataIntent:()=>{},onRendered:()=>{O===F&&!n.stopped&&G?.present(m)},onError:se=>{if(O!==F||n.stopped)return;let b=new Error(se);G?.finish("error",b),r?.destroy(),r=null,j.remove(),n.fail(b)},onEscape:()=>{E()}});let L=r;if(L.update(k.document,q.run.locale,{serverInput:{bindings:k.inputs,answers:k.answers,values:k.values}}),await L.ready,n.stopped||O!==F||!D)return}let X=A?{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"};for(let k of[...q.review.coupons.map((B,L)=>`${A?"\u4F18\u60E0\u5238":"Coupon"} ${L+1}: ${X[B.status]}`),...q.review.purchases.map((B,L)=>`${A?"\u8D2D\u4E70":"Purchase"} ${L+1}: ${ln(B.status,A)}`)]){let B=P.createElement("p");B.textContent=k,j.append(B)}q.review.page||G?.present(m),n.client.view&&await n.enqueue(n.client.view)}catch(M){if(O!==F||n.stopped)return;G?.finish("error",M),r?.destroy(),r=null,e.replaceChildren(),n.fail(M)}}async function E(){if(!D||n.stopped||!n.client.review)return;let c=++F;d?.finish("dismissed");try{if(await n.client.review(),n.stopped||c!==F)return;D=!1,F++,d?.finish("dismissed"),r?.destroy(),r=null,e.replaceChildren(),e.hidden=!0,v.hidden=!1;let N=n.client.view;_(N)!==w?(R.set(w,structuredClone(n.answers)),n.resetScreen()):(R.delete(w),n.suspend(!1)),N&&await n.enqueue(N)}catch(N){if(c!==F||n.stopped)return;r?.destroy(),r=null,e.replaceChildren(),n.fail(N)}}return{get active(){return D},get receipt(){return o},open:T,exit:E,get drafts(){return new Map([...R].map(([c,N])=>[c,structuredClone(N)]))},stop(){D=!1,F++,d?.finish("dismissed"),r?.destroy(),r=null,e.replaceChildren(),e.hidden=!0,v.hidden=!1}}}function yn(n){if(!n.client.pageExperiments)throw new Error("The Run controller does not support page experiments");let P=n.client.pageExperiments.bind(n.client),v=!1,e=!1,f=0,D=!1,o=!1,F="",r=()=>{let m=n.client.view;return JSON.stringify([m?.id,m?.source.versionId,m?.visit,m?.revision,m?.status,m?.stopped])},w=new Map,d=new Set,R={},_=new Map,T=un(n.appManifestRelease),E=()=>{for(let m of w.values())m.effect.revert();w.clear()},c=()=>{E();for(let m of _.values())m();_.clear()};function N(m){if(v||d.has(m))return;d.add(m);let A=f;P(n.appManifestRelease,[m]).catch(U=>{d.delete(m),!v&&A===f&&oe(n.onError,U)})}async function O(){if(v)return;F=r();let m=n.client.view;if(!m||m.stopped||!["running","waiting"].includes(m.status)){f++,c();return}if(document.visibilityState==="hidden")return;if(D){o=!0;return}D=!0;let A=++f,U=`${m.id}:${m.visit}:${m.revision}`,X=location.href;try{let[k,{applyVisualVariation:B}]=await Promise.all([P(n.appManifestRelease),import("./visual-dom-7IF7ITAK.js")]),L=n.client.view;if(v||A!==f||!L||L.stopped||!["running","waiting"].includes(L.status)||`${L.id}:${L.visit}:${L.revision}`!==U||location.href!==X)return;let se=new Set,b=new Set;for(let S of k.assignments){let ne=`${k.payload.environmentId}:${S.experimentKey}`;if(b.add(ne),_.has(ne)||_.set(ne,cn(ne,R)),!!S.inExperiment)for(let i of k.payload.experiments){if(i.key!==S.experimentKey||!xe(location.href,i.urlPatterns??[]))continue;let p=i.meta?.findIndex(J=>J.key===S.variationKey)??-1,a=i.variations[p];if(!a?.renderGuard)continue;let I=S.receiptId+":"+i.changeId,u=JSON.stringify([S.variationKey,a]);se.add(I);let g=w.get(I);if(g?.signature===u){g.effect.applied&&N(S.receiptId);continue}w.get(I)?.effect.revert(),w.delete(I);let Q=B(a,{requireUniqueTargets:!0,boundVariations:i.variations,allowJs:!1,onApplied:()=>N(S.receiptId),onError:J=>oe(n.onError,J)});w.set(I,{signature:u,effect:Q}),Q.applied&&N(S.receiptId)}}for(let[S,ne]of w)se.has(S)||(ne.effect.revert(),w.delete(S));for(let[S,ne]of _)b.has(S)||(ne(),_.delete(S))}catch(k){A===f&&c(),!v&&A===f&&oe(n.onError,k)}finally{D=!1,o&&!v&&(o=!1,O())}}let G=n.client.subscribe(()=>{if(r()===F)return;F=r(),f++;let m=n.client.view;(!m||m.stopped||!["running","waiting"].includes(m.status))&&c(),e&&O()}),M=dn(()=>{f++,c(),e&&O()}),q=()=>{f++,E()};document.addEventListener("visibilitychange",q);let j=Me({document,run:async()=>{e&&await O()},delay:()=>e&&!v?15e3:void 0});return{async start(){e||v||(e=!0,await j.refresh())},refresh:O,destroy(){v=!0,f++,j.destroy(),document.removeEventListener("visibilitychange",q),G(),M(),c(),T.destroy()}}}var Je=5e3;async function Rn(n,P,v){let e=P,[{mountScreenPreview:f},{showPaywall:D}]=await Promise.all([import("./screen-renderer-WOMWOEYL.js"),import("./paywall-CGBFHFRU.js")]),o=e.client.identitySignal;e.signal?.throwIfAborted(),o?.throwIfAborted();let F=e.appManifestRelease?yn({client:e.client,appManifestRelease:e.appManifestRelease,onError:e.onError}):void 0;F?.start();let r=n.ownerDocument,w=an(r),d=r.createElement("section"),R=r.createElement("div"),_=r.createElement("div"),T=r.createElement("div"),E=r.createElement("button");T.hidden=!0,E.type="button";let c=r.createElement("p"),N=r.createElement("p"),O=r.createElement("button"),G=r.createElement("button"),M=r.createElement("button"),q=r.createElement("dialog"),j;d.dataset.indianaFunnel="",d.setAttribute("aria-busy","false"),d.style.cssText="box-sizing:border-box;width:100%;min-width:0;font:14px/1.5 system-ui,sans-serif;color:#172033;background:#fff",_.style.cssText="display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:12px 20px",c.setAttribute("role","status"),N.setAttribute("role","alert"),N.hidden=!0,O.type=G.type=M.type="button",_.append(O,c,N,M,E,G),d.append(R,T,_),n.append(d);let m=null,A=null,U=null,X="",k="",B="",L="",se="",b=!1,S=0,ne=!1,i="",p=null,a=Promise.resolve(),I=!e.client.view,u=v,g,Q,J="",K,W=!1,ye=null,ae=!1,De=()=>e.client.pendingCommand?.operation==="close",re=null,x=null,ze=Me({document:r,run:async()=>{(!A?.observing||e.client.pendingCommand)&&await $e()},delay:()=>{if(!(b||!U||!["running","waiting"].includes(U.status)&&!e.client.pendingCommand)&&!(A?.observing&&!e.client.pendingCommand))return U.pendingRequest||e.client.pendingCommand?1500:Je},hiddenDelay:()=>!b&&e.client.pendingCommand?15e3:void 0}),Y=null;function Ue(){return x&&e.client.hasDurableJournal===!0&&Y?.acknowledged===!0&&Y.operationId===x.operationId&&e.client.view?.id===Y.runId&&e.client.view?.status==="closed"&&e.client.view.revision===Y.revision+1&&!(e.client.pendingCommands?.length??(e.client.pendingCommand?1:0))&&!e.client.pendingPurchase?x:null}function je(t){let s=t.run.paywall;if(Y&&t.settlement?.requestId===Y.requestId&&t.settlement.state==="settled"&&t.settlement.operationId===null&&t.run.id===Y.runId&&t.run.status==="closed"&&!t.run.pendingRequest&&t.run.revision===Y.revision+1&&t.run.nodeId===Y.nodeId&&t.run.visit===Y.visit&&s?.receiptId===Y.receiptId&&s.selectionGeneration===Y.selectionGeneration&&(s.quote?.operationId??null)===Y.operationId&&(s.operation?.operationId??s.quote?.operationId??null)===Y.operationId){let l=Y.operationId===null&&s.selectionGeneration===0&&!s.quote&&!s.operation&&!s.purchaseRequestId,te=_e({quote:s.quote,operation:s.operation,requestId:s.purchaseRequestId,pending:!1,destroyed:!1,canReselect:s.canReselect});(l||s.canReselect===!0&&te.type==="native")&&(Y.acknowledged=!0)}}let Ce=null,ke=new Set,pe={},le=(t,s=null)=>{b||(Ce=s,N.textContent=t instanceof Error?t.message:"Request failed",N.hidden=!1,M.hidden=e.client.pendingCommand===null,oe(e.onError,t))};function he(){let t=e.client.view;if(!t)throw new h("INVALID_REQUEST","No current Run is available");return{requestId:crypto.randomUUID(),nodeId:t.nodeId,visit:t.visit,revision:t.revision}}let V=wn({client:e.client,doc:r,holder:R,reviewHolder:T,mountScreenPreview:f,loadingOptions:e,get stopped(){return b},get answers(){return pe},suspend(t){A?.setSuspended(t)},resetScreen(){X="",k="",B=""},enqueue:fe,fail:le}),Fe=fn({client:e.client,expected:he,fail:le,get stopped(){return b},get reviewing(){return V.active},get key(){return X},get busy(){return S},get staleRead(){return p}}),Se=mn({client:e.client,expected:he,perform:Re,onIntent:e.onCustomerDataIntent,get stopped(){return b},get busy(){return S},get document(){return m?.document},get answers(){return pe}}),Ne=t=>`${t.id}:${t.nodeId}:${t.visit}`,Pe=t=>t&&(t.screen||t.paywall)?Ne(t):"";function Ie(){let t=e.client.view;O.disabled=!V.active&&(S>0||!!e.client.pendingCommand||!t?.canBack||t.stopped||!["running","waiting"].includes(t.status)||!Pe(t)||k!==Pe(t))}async function Be(t){if(!t)return;let s=e.client.view;await t;let l=e.client.view;if(!s||!l||l.id!==s.id||l.nodeId!==s.nodeId||l.visit!==s.visit||l.stopped||!["running","waiting"].includes(l.status))throw new h("PRECONDITION_FAILED","The screen changed while its display was acknowledged")}async function Re(t,s=!1){if(!((S||ae||re||x)&&!s||b||V.active&&!s)){S++,d.setAttribute("aria-busy","true"),Ie(),N.hidden=!0,Ce=null;try{if(s||await Be(Fe.inFlight),b)return;let l=await t();b||await fe(e.client.view??l.run)}catch(l){le(l,e.client.pendingCommand?.requestId??null)}finally{S=Math.max(0,S-1),d.setAttribute("aria-busy",String(S>0)),b||(M.hidden=e.client.pendingCommand===null,Ie())}}}function Ee(){ze.schedule()}async function $e(){if(!(b||ne||S)){if(V.active){await V.open(V.receipt);return}ne=!0;try{let t=e.client.pendingCommand;t&&e.client.settle&&await e.client.settle(t.requestId);let s=e.client.view,l=Se.queries,te=await e.client.get(s?.screen&&Object.keys(l).length?{nodeId:s.nodeId,visit:s.visit,revision:s.revision,components:l}:void 0);!b&&l===Se.queries&&await fe(e.client.view??te.run)}catch(t){le(t)}finally{ne=!1}}}function Oe(t,s){if(u?.active){let te=u;return te.setDismissHandler(()=>We(te)),te}let l=Le(n,e,"funnel",()=>We(l));return u=l,l.start(t,s),l}function We(t){b||W||(W=!0,t.finish("dismissed"),ge(),d.hidden=!0,e.client.view?be().finally(ue):ue())}function He(){clearTimeout(K?.timeout),K=void 0}function ge(){He(),g?.abort(),g=void 0,m?.destroy(),m=null,A?.destroy(),A=null,Q?.(),Q=void 0,q.open&&q.close(),R.replaceChildren(),X="",k="",B="",se=""}function Ge(t){let s=t.screen?.presentation;if(!s||s.type==="inline"){q.open&&q.close(),d.parentElement!==n&&n.append(d);return}d.parentElement!==q&&(q.append(d),n.append(q));let l={sm:420,md:640,lg:900};q.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${"size"in s?l[s.size]+"px":"100vw"}`,q.setAttribute("aria-label",(j?.screen===t.screen?.content.document.name?j?.label:void 0)??m?.document?.name??t.screen?.content.document.name??"Funnel")}async function gn(t){if(b||W||ae&&(De()||["running","waiting"].includes(t.status)))return;U=t,Ce&&e.client.pendingCommand?.requestId!==Ce&&(N.hidden=!0,Ce=null);let s=t.locale.startsWith("zh");if(E.textContent=s?"\u56DE\u770B":"History",E.hidden=!e.client.review,O.textContent=V.active?s?"\u8FD4\u56DE\u5F53\u524D":"Return to current":s?"\u8FD4\u56DE":"Back",G.textContent=s?"\u5173\u95ED":"Close",M.textContent=s?"\u91CD\u8BD5":"Retry",Ie(),M.hidden=e.client.pendingCommand===null,c.textContent=t.pendingRequest?s?"\u6B63\u5728\u5904\u7406":"Processing":t.instruction?.type==="wait"?s?"\u7B49\u5F85\u4E2D":"Waiting":"",i!==`${t.revision}:${t.visit}:${t.status}:${t.stopped}`&&(i=`${t.revision}:${t.visit}:${t.status}:${t.stopped}`,oe(e.onState,structuredClone(t))),b||W)return;if((!t.pendingRequest||ae&&t.status==="closed")&&["closed","ineligible","failed"].includes(t.status)){ue();return}if(t.stopped||e.client.configurationReady===!1){V.stop(),ge(),u?.finish("skipped"),d.hidden=!0,Ee();return}if(d.hidden=!1,V.active){Ee();return}let l=Pe(t),te=e.client.view;if(te&&te.revision>t.revision&&Pe(te)!==l)return;let Qe=!t.instruction&&!t.pendingRequest&&t.nodeType==="screen"&&["running","waiting"].includes(t.status);l!==X&&(X&&u?.finish("dismissed"),ge(),X=l,pe={...t.answers},Se.reset());let me=Ne(t);if(J===me){d.hidden=!0;return}if(Qe&&!l){d.hidden=!0;let C=Oe(!0,t.locale);!b&&!W&&K?.key!==me&&(He(),K={key:me,timeout:setTimeout(()=>{let y=e.client.view;if(!C.active||!y||Ne(y)!==me)return;J=me;let ee=new Error("Funnel screen preparation timed out");C.finish("error",ee),ge(),le(ee)},qe)}),Ee();return}He();let ie=C=>{let y=e.client.view;return!b&&!W&&!ye&&!C.aborted&&e.client.configurationReady!==!1&&!!y&&!y.stopped&&!["closed","ineligible","failed"].includes(y.status)&&Pe(y)===l},Z=(C,y)=>{ie(y)&&(J=l,u?.finish("error",C),ge(),d.hidden=!0,le(C))};if(l||(Ge(t),t.instruction?.type!=="event"&&t.instruction?.type!=="open_url"&&u?.finish("skipped")),t.screen){let C=t.screen.content;if(!m){let z=t.screen.presentation.type!=="inline",we=Oe(z,t.locale);if(b||W)return;let de=(g=new AbortController).signal;Ge(t),Q=z?sn(q):Ve(d,n),m=f(R,{mode:"live",rendererUrl:e.client.webViewUrl,title:C.document.name,onAction(ce,ve={},bn={}){if(V.active||!ie(de)||k!==l)return;pe={...pe,...bn};let Cn=Object.fromEntries((t.screen?.inputs??[]).filter(({variable:Ae})=>Object.hasOwn(pe,Ae)).map(({variable:Ae})=>[Ae,pe[Ae]]));Re(()=>e.client.submit({operation:"submit",...he(),input:{type:"screen",output:ce,answers:Cn,selection:ve}}))},onAnswers:ce=>{V.active||!ie(de)||k!==l||(pe={...pe,...ce})},onCustomerDataIntent:ce=>{V.active||!ie(de)||k!==l||Se.intent(ce).catch(le)},onEscape:()=>{!ie(de)||k!==l||V.active||re||x||be()},onError:ce=>{let ve=new Error(ce);k===l?le(ve):Z(ve,de)},onRendered:ce=>{if(!(!ie(de)||k===l))try{we.present(ve=>{Q?.(),Q=void 0,ce&&(j={screen:C.document.name,label:ce},q.setAttribute("aria-label",ce)),z&&(q.showModal(),!ve&&e.loading!=="host"&&on(q,t.screen.presentation.type)),k=l,Ie()}),ie(de)&&Fe.report(l)}catch(ve){Z(ve,de)}}})}let y={capabilities:t.screen.capabilities,customerData:t.screen.customerData,parameters:t.parameters,serverInput:{bindings:t.screen.inputs,answers:pe,values:t.screen.values}},ee=JSON.stringify([C,t.locale,y.parameters,t.screen.inputs,t.screen.values]);if(ee!==B)m.update(C.document,t.locale,y),B=ee,L=JSON.stringify(y.capabilities),se=JSON.stringify(y.customerData);else{let z=JSON.stringify(y.capabilities);z!==L&&(m.updateCapabilities(y.capabilities),L=z),JSON.stringify(y.customerData)!==se&&(m.updateCustomerData(y.customerData),se=JSON.stringify(y.customerData))}let H=m;if(H)try{await(u?.wait(H.ready)??H.ready)}catch(z){g&&Z(z,g.signal)}}else if(t.paywall&&!A){let C=Oe(!0,t.locale);if(b||W)return;let y=(g=new AbortController).signal;Ge(t);let ee=await D(R,{loading:"host",signal:y,canInteract:()=>ie(y)&&!V.active&&!re&&!x,beforeAction:async()=>{S++;try{await Be(Fe.settled()),N.hidden=!0,Ce=null}finally{S=Math.max(0,S-1)}},start:()=>pn(e.client),onObservationChange:Ee,onPurchase:e.onPurchase,onCheckoutUrl:e.onCheckoutUrl,checkoutNavigation:e.checkoutNavigation,resolveOfferId:e.resolveOfferId,onEvent:e.onEvent,onOpenUrl:H=>e.onOpenUrl?e.onOpenUrl({receiptId:t.paywall.receiptId,url:H,openIn:"same_window"}):r.defaultView?.location.assign(H),onAction:async H=>{if(V.active)return;let z=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:H,answers:{}}});await fe(e.client.view??z.run)},onError:H=>{k===l?le(H):Z(H,y)}},{quoteError:H=>oe(e.onError,H),present(H){ie(y)&&(C.present(()=>{H(),k=l,Ie()}),ie(y)&&Fe.report(l))},async dismiss(){b||y.aborted||V.active||re||x||!ae&&!ie(y)||(ae=!0,await be())}}).catch(H=>(Z(H,y),null));!ie(y)&&!(ae&&!b&&!y.aborted)?ee?.host?.destroy():ee&&(A=ee.host,A?.setSuspended(V.active))}if(b||W)return;Ie();let $=t.instruction;if($&&($.type==="open_url"||$.type==="event")&&!ke.has($.receiptId)){let C=r.createElement("button");C.type="button",C.textContent=$.type==="open_url"?`${s?"\u524D\u5F80":"Continue to"} ${new URL($.url).host}`:s?"\u7EE7\u7EED":"Continue",C.onclick=()=>{let y=he(),ee=$.type==="open_url"&&!e.onOpenUrl&&$.openIn==="new_window"?vn($.url):null;Re(async()=>{let H="success";if($.type==="open_url")if(e.onOpenUrl)try{H=await e.onOpenUrl({receiptId:$.receiptId,url:$.url,openIn:$.openIn})===!1?"failed":"opened"}catch(we){oe(e.onError,we),H="failed"}else H=$.openIn==="new_window"&&!ee?"failed":"opened";if($.type==="event"){if(!e.onEvent)throw new h("EVENT_HANDLER_REQUIRED","Provide the event handler");await e.onEvent($.event)}if(b||e.client.view?.nodeId!==y.nodeId||e.client.view.visit!==y.visit)throw new h("PRECONDITION_FAILED","The client action visit changed");let z=await e.client.submit({operation:"submit",...y,input:{type:"client_action",receiptId:$.receiptId,outcome:H}});return ke.add($.receiptId),$.type==="open_url"&&!e.onOpenUrl&&$.openIn==="same_window"&&r.defaultView?.location.assign($.url),z})},u?.active?u.present(()=>R.replaceChildren(C)):R.replaceChildren(C)}!t.pendingRequest&&t.status==="completed"&&!ke.has(`complete:${t.id}`)&&(ke.add(`complete:${t.id}`),oe(e.onComplete,structuredClone(t))),Ee()}function vn(t){let s=r.defaultView?.open(t,"_blank")??null;return s&&(s.opener=null),s}function fe(t){return Ie(),a=a.catch(()=>{}).then(async()=>{try{await gn(t)}catch(s){throw u?.active&&(J=Ne(t),u.finish("error",s),ge(),d.hidden=!0),s}}),a}let hn=e.client.subscribe(t=>{I||(!ae&&(t.stopped||e.client.configurationReady===!1||X&&k!==X&&(Pe(t)!==X||["closed","ineligible","failed"].includes(t.status)))&&(ge(),u?.finish("dismissed"),d.hidden=!0),fe(t).catch(le))}),In=e.client.subscribeError?.(le);function be(t){if(ye)return ye;if(b||!t&&(re||x))return Promise.resolve();let s=!t&&De();return!s&&e.client.view&&!["running","waiting"].includes(e.client.view.status)?(U=e.client.view,ue(),Promise.resolve()):(ye=Re(async()=>{let l=s?await e.client.retry():await e.client.submit({operation:"close",...t??he()});return t&&je(l),l},!0).then(()=>{let l=e.client.view;l?.status==="closed"&&!De()&&(U=l,ue())}).finally(()=>{ye=null}),ye)}function ue(){F?.destroy(),!b&&(b=!0,e.signal?.removeEventListener("abort",ue),o?.removeEventListener("abort",ue),u?.finish("dismissed"),ze.destroy(),hn(),In?.(),ge(),V.stop(),q.remove(),d.remove(),w(),oe(e.onDismiss,U?structuredClone(U):null))}O.onclick=()=>{if(!O.disabled){if(V.active){V.exit();return}Re(()=>e.client.submit({operation:"back",...he()}))}},E.onclick=()=>{V.open()},G.onclick=()=>{u?.active?u.dismiss():re||be()},M.onclick=()=>{De()?be():Re(()=>e.client.retry())},q.addEventListener("cancel",t=>{t.preventDefault(),u?.active?u.dismiss():re||be()}),e.signal?.addEventListener("abort",ue,{once:!0}),o?.addEventListener("abort",ue,{once:!0});try{let t=e.client.view;if(t)((e.client.viewAgeMs??Je)>=Je||t.instruction?.type==="evaluate_segment")&&(p=$e().finally(()=>{p=null})),await fe(t);else{d.hidden=!0;let s=Oe(e.client.view?.screen?.presentation.type!=="inline",e.client.view?.locale);if(b||W)throw new DOMException("Presentation cancelled","AbortError");let l=await s.wait(e.client.get(),qe);I=!1,await fe(e.client.view??l.run)}}catch(t){throw u?.finish("error",t),ue(),t}return{destroy:ue,refresh:$e,get recovery(){let t=Ue();if(t)return t;if(!b&&!S&&!ae&&!re&&A){let s=A.recovery;if(s.type!=="native")return s}return{type:"recover",operationId:e.client.pendingPurchase?.operationId??e.client.view?.paywall?.quote?.operationId??x?.operationId??null,requestId:e.client.pendingCommand?.requestId??null}},prepareFallback(){if(re)return re;let t=Ue();if(t)return Promise.resolve(t);let s=e.client.pendingPurchase?.operationId??e.client.view?.paywall?.quote?.operationId??x?.operationId??null,l=()=>({type:"recover",operationId:s,requestId:e.client.pendingCommand?.requestId??null});if(e.client.hasDurableJournal!==!0){let Z=A?.recovery;return Promise.resolve(Z&&Z.type!=="native"&&Z.type!=="cancel"?Z:l())}let te=(e.client.pendingCommands??(e.client.pendingCommand?[e.client.pendingCommand]:[])).some(Z=>Z.operation==="close");if(b&&!(te||x&&e.client.view?.status==="closed")||S||ne||ye||V.active||!A&&!x&&!te)return Promise.resolve(l());let Qe=A,me=(async()=>{try{if(!x&&te){let C=await e.client.retry();return await fe(e.client.view??C.run),l()}if(!x){let C=await Qe.prepareFallback();if(C.type!=="native")return C;if(e.client.hasDurableJournal!==!0)return l();x=C}let Z=e.client.pendingCommands??(e.client.pendingCommand?[e.client.pendingCommand]:[]);if(Z.length){let C=Z.find(ee=>ee.operation==="close");if(!C||!Y||C.requestId!==Y.requestId)return l();let y=await e.client.retry();je(y),await fe(e.client.view??y.run)}else{let C=e.client.view,y=C?.paywall;if(!C||!y||y.selectionGeneration===void 0||(y.quote?.operationId??null)!==x.operationId||x.operationId!==null&&y.canReselect!==!0)return l();let ee=y.selectionGeneration,H=await e.client.get();await fe(e.client.view??H.run);let z=e.client.view,we=z?.paywall;if(!z||!we||!["running","waiting"].includes(z.status)||z.stopped||z.id!==C.id||z.nodeId!==C.nodeId||z.visit!==C.visit||we.receiptId!==y.receiptId||we.selectionGeneration!==ee||(we.quote?.operationId??null)!==x.operationId||x.operationId!==null&&we.canReselect!==!0||e.client.pendingPurchase||(e.client.pendingCommands?.length??(e.client.pendingCommand?1:0)))return l();let de=he();Y={runId:z.id,operationId:x.operationId,revision:de.revision,requestId:de.requestId,nodeId:z.nodeId,visit:z.visit,receiptId:we.receiptId,selectionGeneration:ee,acknowledged:!1},await be(de)}let $=Ue();return $?(ue(),$):l()}catch(Z){return le(Z),l()}})();re=me;let ie=()=>{re===me&&(re=null)};return me.then(ie,ie),me},review:V.open,exitReview:V.exit,get unappliedDrafts(){return V.drafts}}}function at(n,P,v){return Rn(n,P,v)}export{yn as a,Rn as b,at as c};
@@ -0,0 +1 @@
1
+ import{b as de}from"./chunk-RKREEPCT.js";import{a as H,b as B}from"./chunk-5HJMAZ7A.js";import{a as s}from"./chunk-SJNF6JDJ.js";import{a as le,c as ce}from"./chunk-2ZJ5CS5Q.js";import{$ as X,Ea as re,Ia as te,Ja as oe,Oa as J,Pa as ie,bb as se,jb as ue,ma as k,mb as ae,oa as Z,pb as U,q as W,wa as ee,xa as ne}from"./chunk-O4535GJR.js";import{a as $}from"./chunk-MHEYMXGZ.js";function me(e){return Ee({...e,namespace:"commands",identity:[e.runToken]})}function Ee(e){let n,a,o=()=>new s("COMMAND_STORAGE_INVALID","Durable command storage is unavailable"),t=Promise.resolve().then(async()=>{if(n=e.storage??globalThis.localStorage,a=e.locks??globalThis.navigator?.locks,!n||!a||!globalThis.crypto?.subtle)throw o();let f=new TextEncoder().encode(JSON.stringify([new URL(e.baseUrl??U).href,...e.identity])),u=new Uint8Array(await crypto.subtle.digest("SHA-256",f));return`indiana.funnel.${e.namespace}.v1.`+Array.from(u,r=>r.toString(16).padStart(2,"0")).join("")});t.catch(()=>{});async function d(f){try{let u=await t;return await a.request(u,{mode:"exclusive"},()=>f(u))}catch(u){throw u instanceof s?u:o()}}function c(f){let u=n.getItem(f);if(u===null)return{revision:0,entry:null};if(u.length>1048576)throw o();let r=JSON.parse(u);if(!r||typeof r!="object"||!("revision"in r)||!("entry"in r)||!Number.isSafeInteger(r.revision)||Number(r.revision)<0)throw o();return{revision:Number(r.revision),entry:r.entry}}return{read:()=>d(c),write:(f,u)=>d(r=>{if(c(r).revision!==f)return null;if(!Number.isSafeInteger(f+1))throw o();let m=JSON.stringify({revision:f+1,entry:u});if(m.length>1048576)throw o();return n.setItem(r,m),f+1})}}function pe(e,n){let a=te.safeParse(n);if(!a.success)throw new s("INVALID_RESPONSE","Funnel response contract changed");let o=a.data;if(e.scope&&(o.scope.projectId!==e.scope.projectId||o.scope.environment!==e.scope.environment))throw new s("SCOPE_MISMATCH","Funnel scope changed");return o}async function fe(e,n){let a=ee.parse(n),{artifact:o,environmentId:t}=a.content,d=new H(e.baseUrl??U).origin,c=new H(o.url,d);if(c.origin!==d||c.username||c.password||c.search||c.hash||c.pathname!==`/api/v1/configuration/${t}/artifacts/${o.sha256}`)throw new s("INVALID_RESPONSE","Public Paywall locator is not trusted");let f=new AbortController,u,r=new Promise((m,y)=>{u=setTimeout(()=>{let w=new s("TIMEOUT","Public Paywall read timed out");f.abort(w),y(w)},Z.initializationMs)}),g=(async()=>{let m=await(e.fetch??globalThis.fetch)(c,{method:"GET",credentials:"omit",redirect:"error",cache:"default",signal:f.signal});if(f.signal.aborted&&(m.body?.cancel().catch(()=>{}),f.signal.throwIfAborted()),!m.ok||!m.headers.get("content-type")?.toLowerCase().startsWith("application/json")||Number(m.headers.get("content-length"))>o.byteLength)throw m.body?.cancel().catch(()=>{}),new s("INVALID_RESPONSE","Public Paywall is unavailable");let y=await le(m,o.byteLength,{signal:f.signal,error:w=>new s("INVALID_RESPONSE",w==="missing"?"Public Paywall body is missing":"Public Paywall exceeds its byte limit")});if(!ce(y,o))throw new s("INVALID_RESPONSE","Public Paywall digest or size changed");return ne(a,JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(y)))})();try{return await Promise.race([g,r])}finally{clearTimeout(u)}}var K=(e,n)=>new s(e,n);function ze(e){return ue(e,K)}var Fe=3,Se=2e3;function be(e){return e instanceof TypeError||e instanceof s&&/^(?:CONFIGURATION_UNAVAILABLE|CONFIGURATION_HTTP_(?:429|5\d\d)|TEMPORARY_UNAVAILABLE)$/i.test(e.code)}async function Te(e){for(let n=1;;n++)try{return await e.refresh()}catch(a){if(n===Fe||!be(a))throw a;await new Promise(o=>setTimeout(o,n*Se))}}async function Y(e,n,{predict:a=!0}={}){let o=n.instruction;if(o?.type!=="evaluate_segment")throw new Error("Local segment instruction required");if(!e)throw new s("CONFIGURATION_UNAVAILABLE","Local execution requires public configuration");if(e.scope.environmentId!==o.environmentId)throw new s("SCOPE_MISMATCH","Evaluation environment changed");let t=null,d;if(a)try{let c=await e.funnel(n.source.id,n.source.versionId);d=c.manifest.generation,t=Ne(e,n,c)}catch{t=null}return d??=e.snapshot?.generation??(await Te(e)).generation,{advance:{policyRevision:o.policyRevision,generation:d},prediction:t}}function Ne(e,n,a){let o=n.instruction;if(o?.type!=="evaluate_segment"||!a.growth||a.control.evaluationMode!=="local"||a.control.evaluationRevision!==o.policyRevision)return null;let{analyticsConfig:t,remoteFeatures:d,...c}=a.growth,f=se({scope:{projectId:e.scope.projectId,environment:e.scope.environment},funnelId:n.source.id,versionId:n.source.versionId,evaluationMode:"local",evaluationRevision:o.policyRevision,document:a.document,payload:X.parse(c)}),u=Ae(f,a.document,{...n,...o}),r=u.steps.at(-1),g=u.boundary??(r?.result.port==="value"?{nodeId:r.nodeId,visit:n.visit+u.steps.length-1}:null);return g?{runId:n.id,from:{nodeId:n.nodeId,visit:n.visit,revision:n.revision},nodeId:g.nodeId,visit:g.visit,terminal:!u.boundary}:null}function Ae(e,n,a){return ae(e,n,a,K)}import{z as A}from"zod";var ge=k.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 s("COMMAND_STORAGE_INVALID","Stored mutation required");return e}),Ie=A.strictObject({schemaVersion:A.literal(1),scope:$,runId:A.uuid(),funnelId:A.uuid(),versionId:A.uuid(),processBindingIds:A.record(A.uuid(),A.uuid().nullable()).optional(),command:ge.optional(),closeCommand:ge.refine(e=>e.operation==="close").optional(),purchase:A.strictObject({receiptId:A.uuid(),operationId:A.uuid(),generation:A.number().int().nonnegative()}).optional(),closed:A.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"),T=()=>new s("COMMAND_STORAGE_CONFLICT","Another host changed this Run's pending command"),j=(e,n)=>JSON.stringify(e)===JSON.stringify(n);function V(e,n){if(!e||!n)return e;if(e.processBindingIds&&Object.hasOwn(e.processBindingIds,n)){let a={...e.processBindingIds};delete a[n],e={...e,processBindingIds:a}}return e.command?.requestId===n?e.closeCommand?{...e,command:e.closeCommand,closeCommand:void 0}:e.purchase?{...e,command:void 0}:null:e.closeCommand?.requestId===n?{...e,closeCommand:void 0}:e}function ye(e){let n=0,a=null,o=u=>JSON.stringify([u.scope,u.runId,u.funnelId,u.versionId]),t=Promise.resolve();async function d(){let u=await e.read();if(!Number.isSafeInteger(u.revision)||u.revision<0)throw new s("COMMAND_STORAGE_INVALID","Invalid command storage revision");return{revision:u.revision,entry:u.entry===null?null:Ie.parse(u.entry)}}function c(u){let r=t.then(u);return t=r.catch(()=>{}),r}async function f(u){for(let r=0;r<4;r++){let g=await d();if(g.entry&&a!==null&&o(g.entry)!==a)throw T();let m=u(g.entry,g.revision);if(j(g.entry,m)){n=g.revision;return}let y=await e.write(g.revision,m);if(y!==null){if(!Number.isSafeInteger(y)||y<=g.revision)throw T();n=y;return}}throw T()}return{bind(u){let r=JSON.stringify([u.scope,u.runId,u.funnelId,u.versionId]);if(a!==null&&a!==r)throw T();a=r},async load(){let u=await d();return n=u.revision,a=u.entry?o(u.entry):null,u.entry},retain(u){let r=Ie.parse(u),g=r.command;return!g||a!==null&&o(r)!==a?Promise.reject(T()):(a??=o(r),c(()=>f((m,y)=>{if(m&&!j(o(m),o(r)))throw T();if(m&&r.processBindingIds){for(let[w,v]of Object.entries(r.processBindingIds))if(m.processBindingIds&&Object.hasOwn(m.processBindingIds,w)&&m.processBindingIds[w]!==v)throw T();m={...m,processBindingIds:{...m.processBindingIds,...r.processBindingIds}}}if(!m){if(y!==n&&g.operation!=="close")throw T();return r}if(!m.command)return{...m,command:g,...g.operation==="close"?{closed:!0}:{}};if(g.operation==="close"&&m.command.operation!=="close"){if(m.command.requestId===g.requestId||m.closeCommand&&!j(m.closeCommand,g))throw T();return{...m,closeCommand:g,closed:!0}}if(!j(m.command,g))throw T();return m})))},observePurchase(u,r,g,m){return c(()=>f((y,w)=>{if(!y&&w!==n||y&&o(y)!==o({...u,schemaVersion:1}))throw T();if(y?.purchase&&y.purchase.generation>r.generation)return V(y,m);if(y?.purchase&&y.purchase.generation===r.generation&&y.purchase.operationId!==r.operationId)throw T();return g?!y?.purchase||y.purchase.operationId!==r.operationId?V(y,m):V(y.command?{...y,purchase:void 0}:null,m):V({schemaVersion:1,...u,...y,purchase:r},m)}))},settle(u){return c(()=>f(r=>V(r,u)))}}}function sn(e,n){return n.type==="id"?e.customerId===n.value:e.externalUserId===n.value}function G(e,n){if(e===n)return!0;if(Array.isArray(e)||Array.isArray(n))return Array.isArray(e)&&Array.isArray(n)&&e.length===n.length&&e.every((t,d)=>G(t,n[d]));if(!e||!n||typeof e!="object"||typeof n!="object")return!1;let a=Object.entries(e),o=Object.entries(n);return a.length===o.length&&a.every(([t,d])=>Object.hasOwn(n,t)&&G(d,Reflect.get(n,t)))}function we(e,n){let a=n&&{...n},o=null,t=0,d=-1,c=0,f=new AbortController;function u(){c++,f.abort(new s("IDENTITY_CHANGED","Run identity changed")),f=new AbortController}let r=!1,g,m=0,y=new Set;return{get scope(){return a},bindScope(w){if(a&&(a.projectId!==w.projectId||a.environment!==w.environment))throw new s("SCOPE_MISMATCH","Run scope changed");a??={...w}},get view(){return o},get currentView(){return d===c?o:null},get viewAgeMs(){return o&&d===c?performance.now()-t:void 0},get generation(){return c},get signal(){return f.signal},get disposed(){return r},get customerToken(){return g},get readSequence(){return m},nextRead(){return++m},assertCurrent(w,v="Run identity changed during the request"){if(w!==c||r)throw new s("IDENTITY_CHANGED",v)},assertRun(w){if(o&&(w.id!==o.id||w.source.type!==o.source.type||w.source.id!==o.source.id||w.source.versionId!==o.source.versionId||w.locale!==o.locale||!G(w.parameters,o.parameters)))throw new s("INVALID_RESPONSE","Run version changed");if(e&&w.source.id!==e)throw new s("INVALID_RESPONSE","Run belongs to another Funnel")},publish(w,v,O,_,l){if(!(w.operation==="review"&&o&&o!==O&&v.run.revision<=o.revision)&&!(o&&v.run.revision===o.revision&&_!==void 0&&_<m)&&(w.operation==="review"&&!v.run.stopped&&["running","waiting"].includes(v.run.status)&&o&&d===c&&v.run.nodeId===o.nodeId&&v.run.visit===o.visit&&v.run.revision===o.revision&&(v.run.screen=o.screen,(o.paywall?.quote?.operationId===v.review?.activeOperationId||!o.paywall?.quote&&v.review?.activeOperationId===null)&&(v.run.paywall=o.paywall)),!(o?.paywall&&v.run.paywall&&o.paywall.receiptId===v.run.paywall.receiptId&&(v.run.paywall.selectionGeneration??0)<(o.paywall.selectionGeneration??0)))){if(!o||v.run.revision>=o.revision)o=v.run,t=performance.now(),d=c;else if(!l)return;if(o&&d===c)for(let p of y)try{p(structuredClone(o))}catch{}}},identify(w){if(r)throw new s("IDENTITY_CHANGED","Controller was reset");if(!W.test(w))throw new s("INVALID_TOKEN","Customer credential required");u(),g=w},subscribe(w){return y.add(w),()=>y.delete(w)},reset(){r||(r=!0,u(),g=void 0,o=null,y.clear())}}}var Q=/^gg_sk_[A-Za-z0-9_-]{32,128}$/;function pn(e,n,a="A server API key is required"){if(typeof window<"u")throw new s("SERVER_ONLY",n);if(!Q.test(e))throw new s("INVALID_TOKEN",a)}function fn(e){let n=B(e);return n.identify(e.apiKey),n}function he(e,n){if(!e)return;let a=n?.execution,o=a?.provider==="merchant"?"merchant":a?.provider==="stripe"?a.executor==="merchant"?"record_only":"indiana":n&&["apple","google"].includes(n.provider)?"native":n?.provider==="stripe"?"indiana":void 0;if(!o||!e.allowed.includes(o))throw new s("EXECUTION_POLICY_REFUSED","The original quote does not permit the declared purchase execution")}function x(e){let{customerToken:n,...a}=e;return a}var Oe=e=>!(e instanceof s&&e.code==="EXECUTION_POLICY_REFUSED")&&(!(e instanceof s)||e.status===void 0||e.status>=500||[401,425].includes(e.status)||e.recovery==="recover_operation");function ve({journal:e,state:n,call:a,processIdentity:o}){let t=null,d=null,c=!1,f={command:null,close:null},u=new Set,r,g=null,m=e?e.load().then(l=>{if(n.disposed)throw new s("IDENTITY_CHANGED","Controller was reset during command restoration");if(g=l,!l)return;if(o){if([l.command,l.closeCommand].some(S=>S&&!Object.hasOwn(l.processBindingIds??{},S.requestId)))throw new s("COMMAND_STORAGE_INVALID","The original process identity is missing");o.restore(l.processBindingIds??{})}if(n.scope&&(l.scope.projectId!==n.scope.projectId||l.scope.environment!==n.scope.environment))throw new s("SCOPE_MISMATCH","Pending command belongs to another scope");if(r=l.purchase,c=l.closed===!0,!l.command)return;let p=l.command;t=p.operation==="close"?null:p,d=p.operation==="close"?p:l.closeCommand?.operation==="close"?l.closeCommand:null,d&&(c=!0);for(let S of[t,d])S&&u.add(S.requestId)}):Promise.resolve();m.catch(()=>{});async function y(l){e&&await m;let p=n.generation;if(e){if(!n.view||!n.scope)throw new s("COMMAND_STORAGE_INVALID","Read the original scoped Run before persisting a mutation");await e.retain({schemaVersion:1,scope:n.scope,runId:n.view.id,funnelId:n.view.source.id,versionId:n.view.source.versionId,command:x(l),...o?{processBindingIds:{[l.requestId]:o.binding(l.requestId)}}:{}})}if(p!==n.generation||t!==l&&d!==l)throw new s("IDENTITY_CHANGED","Run changed before command dispatch");let S=u.has(l.requestId);u.add(l.requestId);try{return await a(l)}catch(b){throw p===n.generation&&(t===l||d===l)&&!S&&!Oe(b)&&(e&&await e.settle(l.requestId),p===n.generation&&_(l)),b}}function w(l){let p=k.parse(l);if(p.operation==="start"||p.operation==="get"||p.operation==="review")throw new s("INVALID_REQUEST","Mutation required");if(c&&p.operation!=="close"){if(t?.requestId===p.requestId)return O(p.requestId);throw new s("COMMAND_PENDING","Close preserves the original recovery record; settle it by identity")}if(p.operation==="close"){if(t?.requestId===p.requestId)throw new s("INVALID_REQUEST","Close requires its own request identity");if(c=!0,d&&JSON.stringify(x(d))!==JSON.stringify(x(p)))throw new s("COMMAND_PENDING","Retry the original Close");return d??=p,f.close?f.close:v(d,"close")}if(t){if(JSON.stringify(x(t))!==JSON.stringify(x(p)))throw new s("COMMAND_PENDING","Retry the original command before sending another");if(f.command)return f.command}else t=p;return v(t,"command")}function v(l,p){let S=y(l);f[p]=S;let b=()=>{f[p]===S&&(f[p]=null)};return S.then(b,b),S}function O(l){return a({operation:"get",settlementRequestId:l})}function _(l){return!l||t!==l&&d!==l?!1:(t===l&&(t=null),d===l&&(d=null),u.delete(l.requestId),!t&&!d&&(g=null),!0)}return{ready:m,get pending(){return t},get closing(){return d},get closeRequested(){return c},get inFlight(){return f.command},get closeFlight(){return f.close},get purchase(){return r},assertBinding(l){if(g&&(l.run.id!==g.runId||l.run.source.id!==g.funnelId||l.run.source.versionId!==g.versionId))throw new s("SCOPE_MISMATCH","Stored command belongs to another Run or Version")},async observe(l,p,S,b){let D=l.operation==="get"?l.settlementRequestId:"requestId"in l&&l.operation!=="start"?l.requestId:void 0,q=D&&p.settlement?.state==="settled"&&p.run.pendingRequest?.requestId!==D&&(l.operation==="get"||!c||l.operation==="close"||!["running","waiting"].includes(p.run.status))?D:void 0,L=t?.requestId===q?t:d?.requestId===q?d:void 0;e?.bind({scope:p.scope,runId:p.run.id,funnelId:p.run.source.id,versionId:p.run.source.versionId});let i=p.run.paywall,I=i??p.purchase,E=I?.operation,P=p.settlement&&(!i||i.purchaseRequestId===p.settlement.requestId)&&(!r||r.operationId===p.settlement.operationId)?p.settlement:void 0,R=E?.operationId??I?.quote?.operationId??P?.operationId,C=I?.receiptId??P?.receiptId,h=i?.selectionGeneration??r?.generation??0;if(e&&R&&C&&l.operation!=="review"&&(!n.view||p.run.revision>=n.view.revision)&&(b===void 0||b>=n.readSequence)&&(!r||h>=r.generation)){let F={receiptId:C,operationId:R,generation:h},N=de(E,I?.canReselect===!0);await e.observePurchase({scope:p.scope,runId:p.run.id,funnelId:p.run.source.id,versionId:p.run.source.versionId},F,N,q),n.assertCurrent(S),(!r||F.generation>=r.generation)&&(b===void 0||b>=n.readSequence)&&(N?r?.operationId===F.operationId&&(r=void 0):r=F)}else e&&q&&await e.settle(q);return n.assertCurrent(S),q?_(L):!1},stop(){c=!0},submit:w,settle:O,reset(){c=!0,t=null,d=null,r=void 0,g=null,f.close=null,u.clear(),f.command=null}}}function _e(e){e={...e};let n=e.initialResponse;delete e.initialResponse;let a=e.funnelExecutionPolicy&&structuredClone(e.funnelExecutionPolicy);if(!e.customerRun&&(typeof e.runToken!="string"||!/^gg_fr_[A-Za-z0-9_-]{43}$/.test(e.runToken)))throw new s("INVALID_TOKEN","Run credential required");if(e.customerRun&&(!e.session||!e.scope||!e.funnelId||!e.funnelCommandStorage||e.serverKey))throw new s("INVALID_REQUEST","Customer recovery requires its scoped session and durable journal");if(e.serverKey&&(typeof window<"u"||!Q.test(e.serverKey)))throw new s("SERVER_ONLY","Run Server-Key proof belongs to the merchant backend");if(e.serverKey&&e.session)throw new s("INVALID_REQUEST","Choose Customer session or Server-Key proof for this Run");let o=B({...e,session:void 0,timeoutMs:e.timeoutMs??35e3}),t=we(e.funnelId,e.scope??e.configuration?.scope),d=e.session?.subscribeIdentity(v),c=null,f=e.funnelCommandStorage??(!e.customerRun&&typeof window<"u"&&window.isSecureContext?me(e):void 0),u=f&&ye(f),r=ve({journal:u,state:t,call:O,processIdentity:e.process}),g=0,m=new Map;function y(){g++,m.clear(),n=void 0}async function w(i){let I=i.operation==="resume"?r.pending?.operation==="resume"?null:r.pending:i;if(a&&i.operation==="resume"&&!I&&i.requestId!==e.customerRun?.startRequestId)throw new s("EXECUTION_POLICY_REFUSED","The original command is required to verify execution permission before resuming");if(I?.operation==="submit"&&I.input.type==="paywall_confirm"){let F=t.view?.paywall;he(a,F?.quote?.operationId===I.input.operationId?F.quote:void 0)}if(e.process)return e.process.request(i);let E=t.generation;t.assertCurrent(E);let P=performance.now()+(e.timeoutMs??35e3),R=t.customerToken??("customerToken"in i?i.customerToken:void 0);if(e.session){let F=t.signal,N,M=()=>{},Pe=new Promise((xe,z)=>{M=()=>z(F.reason),F.addEventListener("abort",M,{once:!0}),N=setTimeout(()=>z(new s("TIMEOUT","Longplay request timed out")),Math.max(1,P-performance.now()))});try{R=await Promise.race([Promise.resolve().then(()=>(t.assertCurrent(E),e.session.access())),Pe])}finally{clearTimeout(N),F.removeEventListener("abort",M)}}t.assertCurrent(E);let C={...i,...R?{customerToken:R}:{}},h=i.operation==="page_experiments"?J.parse(C):k.parse(C);if(e.customerRun){if(e.session?.snapshot()?.customerId!==e.customerRun.customerId||!R)throw new s("IDENTITY_CHANGED","Original recovery Customer changed");let F={...h};return"customerToken"in F&&delete F.customerToken,o.requestWithCredential("funnels",{operation:"run_command",runId:e.customerRun.runId,funnelId:e.funnelId,command:F},R,{timeoutMs:Math.max(1,P-performance.now())})}return o.requestWithCredential("funnels",h,e.runToken,{headers:e.serverKey&&!R?{[oe]:e.serverKey}:void 0,timeoutMs:Math.max(1,P-performance.now())})}function v(){y(),d?.(),t.reset(),r.reset(),c=null,o.dispose()}async function O(i,I){let E=n;n=void 0;let P=t.generation,R=()=>t.assertCurrent(P);u&&await r.ready,R();let C=t.view,h=pe(e,E!==void 0&&i.operation==="get"&&!i.data&&!i.purchase&&!i.settlementRequestId?E:await w(i));if(i.operation==="review"&&!h.review)throw new s("INVALID_RESPONSE","Historical projection is missing");if(e.customerRun&&h.run.id!==e.customerRun.runId)throw new s("INVALID_RESPONSE","Original recovery Run changed");if(i.operation==="get"&&i.purchase&&h.purchase&&(h.purchase.receiptId!==i.purchase.receiptId||(h.purchase.operation?.operationId??h.purchase.quote?.operationId)!==i.purchase.operationId))throw new s("INVALID_RESPONSE","The requested original purchase changed");if(R(),h.runToken&&h.runToken!==e.runToken)throw new s("INVALID_RESPONSE","Run credential changed");let F=i.operation==="get"?i.settlementRequestId:"requestId"in i&&i.operation!=="start"?i.requestId:void 0;if(F&&h.settlement?.requestId!==F)throw new s("INVALID_RESPONSE","Exact command settlement is missing or belongs to another command");r.assertBinding(h),t.assertRun(h.run),t.bindScope(h.scope);let N=await r.observe(i,h,P,I);return(!t.view||h.run.revision>=t.view.revision)&&(I===void 0||I>=t.readSequence)&&(await e.onAcceptedResponse?.(h),R()),!h.run.stopped&&["running","waiting"].includes(h.run.status)&&i.operation==="get"&&i.settlementRequestId||(R(),["running","waiting"].includes(h.run.status)||r.stop(),t.publish(i,h,C,I,N)),h}function _(i){let I=t.generation;y();let E=i(),P=()=>{t.generation===I&&y()};return E.then(P,P),E}let l=i=>_(()=>r.submit(i)),p=null,S=new WeakMap;function b(i){let I=S.get(i);if(I)return I;let E=q(i);return S.set(i,E),E}let D=!1;async function q(i){let I=await i;if(I.run.instruction?.type!=="evaluate_segment")return I;if(p)return p;D=!0;let E=t.generation,P=(async()=>{for(let R=0;R<32&&I.run.instruction?.type==="evaluate_segment";R++){if(r.pending||r.closeRequested)return I;let C=I.run;if(I.run.instruction?.type==="evaluate_segment"){let{advance:F}=await Y(e.configuration,C,{predict:!1});if(E!==t.generation)throw new s("IDENTITY_CHANGED","Run identity changed during segment calculation");if(r.pending||r.closeRequested)return I;if(t.view&&(t.view.revision!==C.revision||t.view.visit!==C.visit||t.view.nodeId!==C.nodeId))return O({operation:"get"});let N=!0;Y(e.configuration,C).then(({prediction:M})=>{N&&E===t.generation&&!r.closeRequested&&t.view?.id===C.id&&!t.view.stopped&&t.view.nodeId===C.nodeId&&t.view.visit===C.visit&&t.view.revision===C.revision&&(c=M)}).catch(()=>{});try{I=await l({operation:"commit_segment",requestId:re(C.id,C.visit,`segment:${C.revision}`),nodeId:C.nodeId,visit:C.visit,revision:C.revision,...F})}finally{N=!1,c=null}}}return I})();p=P;try{return await P}finally{p===P&&(p=null)}}let L={get configuration(){return D?e.configuration:void 0},get configurationReady(){return!0},get view(){let i=t.currentView;return i?structuredClone(i):null},get viewAgeMs(){return t.viewAgeMs},get pendingCommand(){let i=r.closing??r.pending;return i?structuredClone(x(i)):null},get pendingCommands(){return[r.pending,r.closing].filter(i=>i!==null).map(i=>structuredClone(x(i)))},get pendingPurchase(){return r.purchase?structuredClone(r.purchase):null},get hasDurableJournal(){return u!==void 0},get prediction(){let i=t.view;return c&&i&&!i.stopped&&["running","waiting"].includes(i.status)&&i.id===c.runId&&i.nodeId===c.from.nodeId&&i.visit===c.from.visit&&i.revision===c.from.revision&&!r.closeRequested?structuredClone(c):null},settle:(...i)=>_(()=>r.settle(...i)),get webViewUrl(){return"bundled"},resolvePaywall(i){return fe(e,i)},async pageExperiments(i,I=[]){let E=t.generation;t.assertCurrent(E);let P=t.view?.id;if(!P)throw new s("INVALID_REQUEST","Read the Run before its page experiments");let R=ie.parse(await w(J.parse({operation:"page_experiments",release:i,usedReceiptIds:I})));if(t.assertCurrent(E),R.runId!==P||R.scope.projectId!==t.scope?.projectId||R.scope.environment!==t.scope?.environment)throw new s("SCOPE_MISMATCH","Page experiment Run changed");return R},review(i){return O({operation:"review",...i?{receiptId:i}:{}},t.nextRead())},async get(i,I){let E=t.generation;i=i&&structuredClone(i),I=I&&{...I},u&&await r.ready,t.assertCurrent(E),I??=r.purchase&&{receiptId:r.purchase.receiptId,operationId:r.purchase.operationId};let P=JSON.stringify([t.generation,g,i??null,I??null]),R=m.get(P);if(R)return R.then(N=>structuredClone(N));let C=t.nextRead(),h=b(O({operation:"get",...i?{data:i}:{},...I?{purchase:I}:{}},C));m.set(P,h);let F=()=>{m.get(P)===h&&m.delete(P)};return h.then(F,F),h.then(N=>structuredClone(N))},resume(i=t.view?.pendingRequest?.requestId){return i?r.closeRequested?L.settle(i):r.pending?.requestId===i?b(l(r.pending)):b(l({operation:"resume",requestId:i})):Promise.reject(new s("INVALID_REQUEST","No interrupted command is available"))},submit(i){return b(l(i))},retry(){return r.closeFlight?r.closeFlight:r.closing?l(r.closing):r.closeRequested&&r.pending?L.settle(r.pending.requestId):r.inFlight?b(r.inFlight):r.pending?b(l(r.pending)):Promise.reject(new s("INVALID_REQUEST","No command is pending"))},identify(i){let I=t.customerToken?void 0:n;y(),t.identify(i),n=I,c=null,o.reset()},get identitySignal(){return t.signal},subscribe:t.subscribe,reset:v};return L}function Dn(e,n){return _e({...e,runToken:"",initialResponse:n})}import{ZodError as qe}from"zod";function Re(e,n,a){if(!["subscriptions/operations/read","subscriptions/updates/read","subscriptions/refunds/read"].includes(e))return;let o=n,t=a,d=t.operation;if(d.operationId!==o.operationId||[d.authority,d.merchantExecution].some(c=>c&&(c.operationId!==o.operationId||o.customerId!==void 0&&c.customerId!==o.customerId))||d.authority&&(d.authority.scope.projectId!==t.scope.projectId||d.authority.scope.environment!==t.scope.environment))throw new s("INVALID_RESPONSE","Original commerce operation changed")}function Ce(e,n,a,o){try{return e.parse(n)}catch(t){throw o&&t instanceof qe?new s(a,o):t}}async function jn(e,n,a,o={},t){let d=typeof o=="function"?{}:o,c=Ce(n.request,a,"INVALID_REQUEST",d.request);try{let f=await e(n.path,c,n.method,t),u=typeof o=="function"?o:o.parseResponse,r=u?u(n.response,f):Ce(n.response,f,"INVALID_RESPONSE",d.response);return Re(n.path,c,r),r}catch(f){throw f instanceof s&&c!==null&&typeof c=="object"&&"requestId"in c&&typeof c.requestId=="string"&&(f.commandRequestId??=c.requestId),f}}export{jn as a,pe as b,fe as c,K as d,ze as e,Ae as f,Ie as g,V as h,me as i,Ee as j,sn as k,G as l,Q as m,pn as n,fn as o,he as p,_e as q,Dn as r};