@houzhen888/groove-grow 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/README.md +24 -2
- package/dist/chunk-B5O7FDKE.js +5 -0
- package/dist/chunk-MGI4EQLR.js +1 -0
- package/dist/{chunk-ZPYBAV5Z.js → chunk-O5ZKLGES.js} +1 -1
- package/dist/{index-VzF48VxI.d.ts → index-CbW7E8PR.d.ts} +931 -171
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/popup.d.ts +6 -4
- package/dist/popup.js +71 -30
- package/dist/server.d.ts +166 -6
- package/dist/server.js +1 -1
- package/dist/src-EZB2YESL.js +1 -0
- package/dist/{transport-DrW-__2k.d.ts → transport-CPPD6uzW.d.ts} +617 -258
- package/package.json +1 -1
- package/dist/chunk-D5TMAVB3.js +0 -1
- package/dist/chunk-ORSJMBMZ.js +0 -1
- package/dist/src-QOPY5YKS.js +0 -1
package/dist/popup.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as W,b as pt,c as Pt,d as Oe}from"./chunk-MGI4EQLR.js";import"./chunk-O5ZKLGES.js";import{$b as He,Fb as _e,Sb as $e,Tb as ot,Tc as st,Vb as ze,Wc as dt,bd as ct,cc as ue,cd as lt,ed as se,gc as pe,gd as Fe,je as ut}from"./chunk-B5O7FDKE.js";import Lt from"dompurify";import{parse as Tt,generate as Mt,walk as Rt}from"css-tree";function Dt(l,u,w,k){return{html:ke(l,w,k),css:je(u)}}function je(l){if(!l.trim())return"";if(/[\\<]/.test(l))throw new Error("CSS \u6682\u4E0D\u652F\u6301\u53CD\u659C\u6760\u8F6C\u4E49\u6216 HTML \u6807\u7B7E\u3002");let u=Tt(l,{onParseError:k=>{throw Object.assign(new Error("CSS \u683C\u5F0F\u4E0D\u6B63\u786E\u3002"),{offset:k.offset})}}),w=0;return Rt(u,k=>{if(++w>5e3)throw new Error("CSS \u8FC7\u4E8E\u590D\u6742\u3002");if(k.type==="Raw"||k.type==="Url"||k.type==="Atrule"&&!["media","supports","keyframes"].includes(k.name.toLowerCase())||k.type==="Function"&&["image-set","-webkit-image-set","image","src","paint"].includes(k.name.toLowerCase()))throw new Error("CSS \u4E0D\u652F\u6301\u5916\u90E8\u8D44\u6E90\u3001\u5BFC\u5165\u6216\u672A\u77E5\u8BED\u6CD5\uFF1B\u56FE\u7247\u8BF7\u4F7F\u7528 HTML img \u6807\u7B7E\u3002")}),Mt(u)}function ke(l,u,w,k){if(!l.trim())return"";let c=ze(l);if(c.length)throw new Error(c[0]);let z=Lt(w),E=z.sanitize(l,{ALLOWED_TAGS:["main","section","article","header","footer","div","span","p","h1","h2","h3","h4","strong","em","b","i","small","br","hr","ul","ol","li","button","img"],ALLOWED_ATTR:["class","alt","src","width","height","title","type","disabled","data-grow-action","aria-label"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1,ADD_URI_SAFE_ATTR:["data-grow-action"],ALLOWED_URI_REGEXP:/^https:\/\//i,RETURN_DOM:!0});if(!(E instanceof w.Element))throw new Error("\u65E0\u6CD5\u89E3\u6790 HTML\u3002");if(k){let L=new Set;for(let v of z.removed){let T="element"in v?v.element.nodeName.toLowerCase():void 0,D="attribute"in v?v.attribute?.name:void 0;if(!T&&!D)continue;let m=D?/<[^>]+>/g:new RegExp(`<\\s*${T}\\b[^>]*>`,"gi"),$=[...l.matchAll(m)].find(N=>!L.has(`${D??T}:${N.index}`)&&(!D||new RegExp(`\\b${D}\\s*=`,"i").test(N[0])));if(!$)continue;let C=$.index;L.add(`${D??T}:${C}`);let S=D==="style"?"\u5185\u8054\u6837\u5F0F\u4E0D\u4FDD\u7559\uFF0C\u8BF7\u5199\u5728 CSS \u4E2D\u3002":D?.startsWith("on")?"\u811A\u672C\u4E8B\u4EF6\u4E0D\u5141\u8BB8\uFF0C\u8BF7\u4F7F\u7528\u52A8\u4F5C\u6309\u94AE\u3002":D==="src"?"\u56FE\u7247\u53EA\u652F\u6301 https \u5730\u5740\u3002":"\u8FD9\u4E2A\u5C5E\u6027\u4E0D\u5728\u5141\u8BB8\u7684\u5E03\u5C40\u3001\u56FE\u7247\u4E0E\u52A8\u4F5C\u5C5E\u6027\u4E2D\u3002";k.push({language:"html",from:C,to:C+$[0].length,severity:"warning",message:D?`\u5DF2\u79FB\u9664\u5C5E\u6027 ${D}\uFF1A${S}`:`\u5DF2\u79FB\u9664 <${T}>\uFF1A\u8FD9\u4E2A\u6807\u7B7E\u4E0D\u5728\u5141\u8BB8\u7684\u6392\u7248\u6807\u7B7E\u4E2D\u3002`})}}let I=ze(E.innerHTML);if(I.length)throw new Error(I[0]);if(E.querySelectorAll("*").length>500)throw new Error("HTML \u6700\u591A\u652F\u6301 500 \u4E2A\u5143\u7D20\u3002");for(let L of E.querySelectorAll("[data-grow-action]")){let v=L.getAttribute("data-grow-action");if(L.tagName!=="BUTTON"||!u.includes(v))throw new Error(`\u81EA\u5B9A\u4E49 HTML \u91CC\u7684\u6309\u94AE ${v.slice(0,64)} \u6CA1\u6709\u5BF9\u5E94\u7684\u52A8\u4F5C\uFF0C\u8BF7\u5148\u5728\u300C\u70B9\u51FB\u52A8\u4F5C\u300D\u91CC\u6DFB\u52A0\uFF0C\u5E76\u4F7F\u7528 button \u5143\u7D20\u3002`)}if(!E.textContent?.trim()&&!E.querySelector("img"))throw new Error("\u81EA\u5B9A\u4E49 HTML \u6E05\u6D17\u540E\u6CA1\u6709\u53EF\u663E\u793A\u7684\u5185\u5BB9\u3002");return E.innerHTML}function Nt(l,u,w,k){let c=[],z="",E="";for(let I of["html","css"])try{I==="html"?z=ke(l,w,k,c):E=je(u)}catch(L){let v=I==="html"?l:u,T=I==="html"?/\{\{|data-grow-action/:/@import\b|url\s*\(|image-set\s*\(|[\\<]/i,D=L instanceof Error?L.message:"\u5185\u5BB9\u65E0\u6CD5\u89E3\u6790",m=I==="html"?D.match(/未知变量:(.+)/)?.[1]:void 0,$=m?v.indexOf(m):-1,C=typeof L=="object"&&L!==null&&"offset"in L&&typeof L.offset=="number"?L.offset:$>=0?v.lastIndexOf("{{",$):v.search(T);c.push({language:I,from:Math.max(0,C),to:Math.min(v.length,Math.max(0,C)+2),severity:"error",message:D})}return{html:z,css:E,diagnostics:c,valid:!c.some(I=>I.severity==="error")}}function ge(l,u,w){if(!l)return;let k={},c=u.actions.map(z=>z.id);for(let[z,E]of Object.entries(l.nodes)){let I=L=>{if(L.html===void 0)return L;if(se(u,z)?.type!=="custom_html")throw new Error("HTML \u5546\u54C1\u6570\u636E\u53EA\u80FD\u7528\u4E8E\u81EA\u5B9A\u4E49 HTML \u7EC4\u4EF6");return{...L,html:ke(L.html,c,w)}};k[z]={...E,base:I(E.base),...E.byPlan?{byPlan:Object.fromEntries(Object.entries(E.byPlan).map(([L,v])=>[L,I(v)]))}:{}}}return{...l,nodes:k}}var gt=new WeakMap;function Se(l,u){let w=dt.parse(l),k=JSON.stringify(w),c=gt.get(u);c||(c=new Map,gt.set(u,c));let z=Date.now();for(let[C,S]of c)S.expires<=z&&c.delete(C);let E=c.get(k);if(E)return c.delete(k),c.set(k,E),JSON.parse(E.json);let I=w.actions.map(C=>C.id),L=C=>{if(C.type==="stack")return{...C,children:C.children.map(L)};if(C.type!=="custom_html")return C;let S={};for(let[N,j]of Object.entries(C.html))S[N]=ke(j,I,u);return{...C,html:S,css:je(C.css)}},v={...w,pages:w.pages.map(C=>({...C,root:L(C.root)}))},T=JSON.stringify(v),D=new TextEncoder,m=D.encode(T).length;if(m>pe.documentBytes)throw new Error("\u5F39\u7A97\u5185\u5BB9\u8FC7\u5927\uFF08\u4E0A\u9650 200 KB\uFF09\u3002");let $=D.encode(k).length;if($<=pe.documentBytes){c.set(k,{json:T,bytes:$+m,expires:z+6e4});let C=[...c.values()].reduce((S,N)=>S+N.bytes,0);for(;c.size>16||C>2*1024*1024;){let[S,N]=c.entries().next().value;c.delete(S),C-=N.bytes}}return v}function mt(l,u){let w=window,k={none:0,xs:4,sm:8,md:12,lg:20,xl:32},c={none:0,sm:4,md:8,lg:14,full:9999},z={system:'system-ui,-apple-system,"Segoe UI",Roboto,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans CJK SC",sans-serif',serif:'Georgia,"Times New Roman","Songti SC","Noto Serif CJK SC",serif',rounded:'ui-rounded,"SF Pro Rounded","Hiragino Maru Gothic ProN",system-ui,sans-serif',mono:"ui-monospace,SFMono-Regular,Menlo,Consolas,monospace"},E={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"},I={start:"flex-start",center:"center",end:"flex-end",between:"space-between"},L={start:"start",center:"center",end:"end",between:"stretch"},v={start:"start",center:"center",end:"end",stretch:"stretch"},T={"1:1":"1 / 1","4:3":"4 / 3","16:9":"16 / 9","3:1":"3 / 1"},D=`
|
|
2
2
|
*,*::before,*::after{box-sizing:border-box}
|
|
3
3
|
html,body{margin:0;padding:0;background:transparent}
|
|
4
4
|
body{font-family:var(--g-font);color:var(--g-text);-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
|
|
@@ -37,14 +37,14 @@ body{font-family:var(--g-font);color:var(--g-text);-webkit-font-smoothing:antial
|
|
|
37
37
|
.g-box span{position:absolute;left:-2px;bottom:100%;margin-bottom:2px;padding:1px 6px;font:500 11px/16px system-ui,sans-serif;color:#fff;background:var(--g-edit);border-radius:3px;white-space:nowrap;max-width:240px;overflow:hidden;text-overflow:ellipsis}
|
|
38
38
|
.g-box[data-below] span{bottom:auto;top:100%;margin:2px 0 0}
|
|
39
39
|
[data-g-editor] .g-btn{cursor:default}
|
|
40
|
-
.g-data{--g-data-ink:var(--g-text);--g-data-muted:var(--g-muted);--g-data-line:var(--g-border);--g-data-surface:var(--g-surface);width:100%;min-width:0;color:var(--g-data-ink);font-variant-numeric:tabular-nums}
|
|
40
|
+
.g-data{--g-data-ink:var(--g-text);--g-data-muted:var(--g-muted);--g-data-line:var(--g-border);--g-data-surface:var(--g-surface);width:100%;min-width:0;color:var(--g-data-ink);font-variant-numeric:tabular-nums;container-type:inline-size;container-name:customer-data}
|
|
41
41
|
.g-data-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}
|
|
42
|
-
.g-data-heading{display:flex;align-items:center;gap:10px;font-size:
|
|
42
|
+
.g-data-heading{display:flex;align-items:center;gap:10px;font-size:18px;line-height:1.35;font-weight:600;margin:0;letter-spacing:-.025em}
|
|
43
43
|
.g-data-icon{display:block;width:18px;height:18px;flex:none}
|
|
44
44
|
.g-data-controls{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
|
|
45
|
-
.g-data-button,.g-data-select{font:500
|
|
45
|
+
.g-data-button,.g-data-select{font:500 13px/1.4 var(--g-font);color:var(--g-data-ink);background:transparent;border:1px solid color-mix(in srgb,var(--g-data-ink) 52%,transparent);border-radius:6px;min-height:36px;padding:7px 10px;cursor:pointer;transition:background .15s,border-color .15s,transform .15s}
|
|
46
46
|
.g-data-button:hover{background:var(--g-data-surface)}
|
|
47
|
-
.g-data-button:focus-visible,.g-data-select:focus-visible,.g-data-sources>summary:focus-visible{outline:3px solid var(--g-
|
|
47
|
+
.g-data-button:focus-visible,.g-data-select:focus-visible,.g-data-sources>summary:focus-visible{outline:3px solid var(--g-data-ink);outline-offset:3px}
|
|
48
48
|
.g-data-button:disabled,.g-data-select:disabled{opacity:.4;cursor:default}
|
|
49
49
|
.g-data-refresh{border-color:transparent;width:32px;min-height:32px;display:grid;place-items:center;padding:6px;color:var(--g-data-muted)}
|
|
50
50
|
.g-data-refresh:hover{color:var(--g-data-ink)}
|
|
@@ -53,20 +53,20 @@ body{font-family:var(--g-font);color:var(--g-text);-webkit-font-smoothing:antial
|
|
|
53
53
|
.g-data-buy{background:var(--g-primary);color:var(--g-on-primary);border-color:transparent;min-height:40px;font-size:13px;font-weight:600}
|
|
54
54
|
.g-data-buy:hover{background:var(--g-primary);filter:brightness(.95);transform:translateY(-1px)}
|
|
55
55
|
.g-data[data-preview=true] .g-data-buy:disabled{opacity:.8}
|
|
56
|
-
.g-data-note{font-size:
|
|
56
|
+
.g-data-note{font-size:13px;line-height:1.6;color:var(--g-data-muted);margin:12px 0;overflow-wrap:anywhere}
|
|
57
57
|
.g-data-error{padding:12px 0;border-block:1px solid var(--g-data-line);color:var(--g-data-ink);font-size:13px;line-height:1.6}
|
|
58
58
|
.g-data-resource+.g-data-resource{border-top:1px solid var(--g-data-line);padding-top:24px;margin-top:24px}
|
|
59
59
|
.g-data-name{font-size:12px;color:var(--g-data-muted);font-weight:500;margin:0 0 10px}
|
|
60
60
|
.g-data-balance{display:flex;align-items:baseline;gap:14px;flex-wrap:wrap;margin-bottom:18px}
|
|
61
|
-
.g-data-number{font-size:clamp(44px,7vw,72px);font-weight:500;line-height:1;letter-spacing:-.
|
|
61
|
+
.g-data-number{font-family:var(--g-data-number-font,var(--g-font));font-size:var(--g-data-number-size,clamp(44px,7vw,72px));font-weight:var(--g-data-number-weight,500);line-height:1.08;letter-spacing:-.055em;overflow-wrap:anywhere;max-width:100%}
|
|
62
62
|
.g-data-fraction{font-size:22px;letter-spacing:-.025em;color:var(--g-data-muted)}
|
|
63
|
-
.g-data-unit{font-size:
|
|
64
|
-
.g-data-facts{display:flex;gap:24px;flex-wrap:wrap;font-size:
|
|
63
|
+
.g-data-unit{font-size:13px;color:var(--g-data-muted)}
|
|
64
|
+
.g-data-facts{display:flex;gap:24px;flex-wrap:wrap;font-size:13px;line-height:1.6;color:var(--g-data-muted)}
|
|
65
65
|
.g-data-facts strong{font-weight:600;color:var(--g-data-ink);margin-inline-start:6px}
|
|
66
|
-
.g-data-expiry{margin-inline-start:auto;font-size:
|
|
67
|
-
.g-data-resource-label{font-size:
|
|
66
|
+
.g-data-expiry{margin-inline-start:auto;font-size:12px}
|
|
67
|
+
.g-data-resource-label{font-size:12px;letter-spacing:0;color:var(--g-data-muted);padding-inline-start:10px;border-inline-start:1px solid var(--g-data-line);font-weight:400}
|
|
68
68
|
.g-data-sources{margin-top:20px;border-top:1px solid var(--g-data-line);padding-top:12px}
|
|
69
|
-
.g-data-sources>summary{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:
|
|
69
|
+
.g-data-sources>summary{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:13px;font-weight:500;cursor:pointer;line-height:1.5;list-style:none;border-radius:3px;padding:6px 0}
|
|
70
70
|
.g-data-sources>summary::-webkit-details-marker{display:none}
|
|
71
71
|
.g-data-sources>summary>.g-data-icon{width:16px;height:16px;transition:transform .18s}
|
|
72
72
|
.g-data-sources[open]>summary>.g-data-icon{transform:rotate(180deg)}
|
|
@@ -80,30 +80,41 @@ body{font-family:var(--g-font);color:var(--g-text);-webkit-font-smoothing:antial
|
|
|
80
80
|
.g-data-row-copy{min-width:0}
|
|
81
81
|
.g-data-row-mark{display:grid;place-items:center;width:34px;height:34px;flex:none;background:var(--g-data-surface);color:var(--g-data-muted);border:1px solid var(--g-data-line);border-radius:50%}
|
|
82
82
|
.g-data-row-mark .g-data-icon{width:16px;height:16px}
|
|
83
|
-
.g-data-row-label{font-size:
|
|
84
|
-
.g-data-row-detail{font-size:
|
|
85
|
-
.g-data-row-status{font-size:
|
|
83
|
+
.g-data-row-label{font-size:15px;font-weight:600;line-height:1.5;overflow-wrap:anywhere;margin:0}
|
|
84
|
+
.g-data-row-detail{font-size:13px;line-height:1.65;color:var(--g-data-muted);margin-top:4px;overflow-wrap:anywhere}
|
|
85
|
+
.g-data-row-status{font-size:12px;line-height:1.6;color:var(--g-data-muted);padding:4px 8px;border-radius:4px;background:var(--g-data-surface);width:fit-content;justify-self:end;overflow-wrap:anywhere}
|
|
86
86
|
.g-data-row-value{font-size:15px;font-weight:650;text-align:end;line-height:1.5;overflow-wrap:anywhere}
|
|
87
87
|
.g-data-row-extra{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap}
|
|
88
|
-
.g-data-footer{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:16px;font-size:
|
|
89
|
-
.g-data-empty{display:flex;align-items:center;gap:10px;padding:
|
|
88
|
+
.g-data-footer{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:16px;font-size:12px;color:var(--g-data-muted)}
|
|
89
|
+
.g-data-empty{display:flex;align-items:center;gap:10px;padding:28px 0;border-block:1px solid var(--g-data-line);font-size:13px;line-height:1.6;color:var(--g-data-muted)}
|
|
90
90
|
.g-data-empty>.g-data-icon{width:20px;height:20px;opacity:.65}
|
|
91
|
-
.g-data-
|
|
92
|
-
.g-data-
|
|
93
|
-
.g-data
|
|
91
|
+
.g-data-skeleton{padding-block:8px;animation:g-data-reveal .18s ease-out}
|
|
92
|
+
.g-data-skeleton-line{display:block;background:var(--g-data-line);border-radius:4px;animation:g-data-pulse 1.4s ease-in-out infinite}
|
|
93
|
+
.g-data-skeleton-value{width:42%;height:var(--g-data-number-size,64px);margin:4px 0 22px}
|
|
94
|
+
.g-data-skeleton-meta{width:65%;height:12px;margin-bottom:20px}
|
|
95
|
+
.g-data-skeleton-row{display:flex;justify-content:space-between;gap:24px;padding:20px 0;border-block-end:1px solid var(--g-data-line)}
|
|
96
|
+
.g-data-skeleton-row>.g-data-skeleton-line:first-child{width:52%;height:14px}
|
|
97
|
+
.g-data-skeleton-row>.g-data-skeleton-line:last-child{width:18%;height:14px}
|
|
98
|
+
.g-data[data-layout=compact] .g-data-skeleton-value{height:var(--g-data-number-size,34px);margin-bottom:16px}
|
|
99
|
+
.g-data-recovery{margin:12px 0}
|
|
100
|
+
.g-data-live-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
|
101
|
+
@keyframes g-data-pulse{50%{opacity:.4}}
|
|
102
|
+
.g-data-updated{font-size:11px;margin-bottom:0}
|
|
103
|
+
.g-data-preview{font-size:11px;color:var(--g-data-muted);border:1px solid var(--g-data-line);border-radius:4px;padding:3px 6px;white-space:nowrap}
|
|
104
|
+
.g-data[data-source=credit_balance] .g-data-heading{font-size:15px;font-weight:500;letter-spacing:0}
|
|
94
105
|
.g-data[data-source=credit_balance] .g-data-header{margin-bottom:18px}
|
|
95
|
-
.g-data[data-source=credit_balance] .g-data-updated{margin:0;font-size:
|
|
106
|
+
.g-data[data-source=credit_balance] .g-data-updated{margin:0;font-size:11px;color:var(--g-data-muted)}
|
|
96
107
|
.g-data[data-source=credit_balance] .g-data-sources>summary{max-width:100%}
|
|
97
|
-
.g-data-table-head{display:grid;grid-template-columns:minmax(0,1fr)
|
|
108
|
+
.g-data-table-head{display:grid;grid-template-columns:minmax(0,1fr) 92px minmax(120px,.45fr);gap:16px;padding:10px 0;font-size:12px;color:var(--g-data-muted);border-block:1px solid var(--g-data-line)}
|
|
98
109
|
.g-data-table-head>span:not(:first-child){text-align:end}
|
|
99
110
|
.g-data[data-source=credit_transactions] .g-data-list{border-top:0}
|
|
100
|
-
.g-data[data-source=credit_transactions] .g-data-row{grid-template-columns:minmax(0,1fr)
|
|
111
|
+
.g-data[data-source=credit_transactions] .g-data-row{grid-template-columns:minmax(0,1fr) 92px minmax(120px,.45fr);gap:16px;padding:18px 0;align-items:center;transition:background .15s}
|
|
101
112
|
.g-data[data-source=credit_transactions] .g-data-row:hover{background:var(--g-data-surface)}
|
|
102
113
|
.g-data[data-source=credit_transactions] .g-data-row-status{grid-column:2;grid-row:1}
|
|
103
114
|
.g-data[data-source=credit_transactions] .g-data-row-extra{grid-column:3;grid-row:1;justify-content:flex-end}
|
|
104
115
|
.g-data[data-source=credit_transactions] .g-data-facts{flex-direction:column;align-items:flex-end;gap:8px}
|
|
105
|
-
.g-data[data-source=credit_transactions] .g-data-facts>span{display:flex;flex-direction:column-reverse;align-items:flex-end;font-size:
|
|
106
|
-
.g-data[data-source=credit_transactions] .g-data-facts strong{font-size:
|
|
116
|
+
.g-data[data-source=credit_transactions] .g-data-facts>span{display:flex;flex-direction:column-reverse;align-items:flex-end;font-size:12px}
|
|
117
|
+
.g-data[data-source=credit_transactions] .g-data-facts strong{font-size:15px;margin-inline-start:0;font-weight:600}
|
|
107
118
|
.g-data[data-source=credit_packs] .g-data-row{border:0;padding:16px 0;grid-template-columns:minmax(0,1fr) auto}
|
|
108
119
|
.g-data[data-source=credit_packs] .g-data-list{border:0}
|
|
109
120
|
.g-data[data-source=credit_packs] .g-data-row+.g-data-row{border-top:1px solid var(--g-data-line)}
|
|
@@ -112,26 +123,56 @@ body{font-family:var(--g-font);color:var(--g-text);-webkit-font-smoothing:antial
|
|
|
112
123
|
.g-data[data-source=credit_packs] .g-data-buy{width:100%;margin-top:2px}
|
|
113
124
|
.g-data[data-source=credit_packs] .g-data-header{margin-bottom:4px}
|
|
114
125
|
.g-data[data-layout=compact] .g-data-header{margin-bottom:10px}
|
|
115
|
-
.g-data[data-layout=compact] .g-data-heading{font-size:
|
|
116
|
-
.g-data[data-layout=compact] .g-data-number{font-size:34px}
|
|
126
|
+
.g-data[data-layout=compact] .g-data-heading{font-size:14px;color:var(--g-data-muted);letter-spacing:0;font-weight:500}
|
|
127
|
+
.g-data[data-layout=compact] .g-data-number{font-size:var(--g-data-number-size,34px)}
|
|
117
128
|
.g-data[data-layout=compact] .g-data-row{padding:10px 0;column-gap:12px}
|
|
118
129
|
.g-data[data-layout=compact] .g-data-row{grid-template-columns:minmax(0,1fr) auto}
|
|
119
130
|
.g-data[data-layout=compact] .g-data-row-status{grid-column:1;grid-row:2;justify-self:start}
|
|
120
131
|
.g-data[data-layout=compact] .g-data-row-value{grid-column:2;grid-row:1}
|
|
121
132
|
.g-data[data-layout=compact] .g-data-updated{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
|
133
|
+
.g-data[data-source=credit_transactions][data-layout=compact] .g-data-table-head{display:none}
|
|
134
|
+
.g-data[data-source=credit_transactions][data-layout=compact] .g-data-row{grid-template-columns:minmax(0,1fr) 92px minmax(120px,.45fr);gap:16px;padding:14px 0}
|
|
135
|
+
.g-data[data-source=credit_transactions][data-layout=compact] .g-data-row-status{grid-column:2;grid-row:1}
|
|
136
|
+
.g-data[data-source=credit_transactions][data-layout=compact] .g-data-row-extra{grid-column:3;grid-row:1;justify-content:flex-end}
|
|
122
137
|
.g-data[data-source=membership][data-layout=compact] .g-data-list{border:0}
|
|
123
138
|
.g-data[data-source=membership][data-layout=compact] .g-data-row{padding:0;border:0}
|
|
124
139
|
.g-data[data-source=membership][data-layout=compact] .g-data-row-status{grid-column:2;grid-row:1;justify-self:end}
|
|
125
140
|
.g-data[data-source=membership][data-layout=compact] .g-data-header{margin-bottom:6px}
|
|
141
|
+
.g-data[data-source=membership][data-layout=full] .g-data-heading{font-size:14px;font-weight:500;color:var(--g-data-muted)}
|
|
142
|
+
.g-data[data-source=membership][data-layout=full] .g-data-list{border-top:0}
|
|
143
|
+
.g-data[data-source=membership][data-layout=full] .g-data-row{padding:12px 0 22px;column-gap:24px}
|
|
144
|
+
.g-data[data-source=membership][data-layout=full] .g-data-row-label{font-family:var(--g-data-display-font,var(--g-font));font-size:var(--g-data-display-size,30px);font-weight:var(--g-data-display-weight,600);letter-spacing:-.035em;line-height:1.25}
|
|
145
|
+
.g-data[data-source=membership][data-layout=full] .g-data-row-detail{font-size:13px;margin-top:12px}
|
|
146
|
+
.g-data[data-source=membership][data-layout=full] .g-data-row-status{font-size:12px;padding:5px 9px}
|
|
147
|
+
.g-data[data-source=customer_plans][data-layout=full] .g-data-row{padding:24px 0;grid-template-columns:minmax(0,1fr) 140px 180px;gap:24px;align-items:center}
|
|
148
|
+
.g-data[data-source=customer_plans][data-layout=full] .g-data-row-label{font-family:var(--g-data-display-font,var(--g-font));font-size:22px;font-weight:600}
|
|
149
|
+
.g-data[data-source=customer_plans][data-layout=full] .g-data-row-value{font-size:24px;font-weight:500;letter-spacing:-.035em}
|
|
150
|
+
.g-data[data-source=customer_plans][data-layout=full] .g-data-row-status{font-size:12px;padding:5px 9px}
|
|
151
|
+
@container customer-data (min-width:600px){
|
|
152
|
+
.g-data[data-source=credit_packs][data-layout=full]>.g-data-list,.g-data[data-source=customer_plans][data-layout=full]>.g-data-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:24px;border:0}
|
|
153
|
+
.g-data[data-source=credit_packs][data-layout=full]>.g-data-list>.g-data-row,.g-data[data-source=customer_plans][data-layout=full]>.g-data-list>.g-data-row{grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto 1fr;gap:20px;padding:24px;border:1px solid var(--g-data-line);border-radius:14px;align-items:start;align-content:start;transition:border-color .16s,background .16s}
|
|
154
|
+
.g-data[data-source=credit_packs][data-layout=full]>.g-data-list>.g-data-row:hover{border-color:var(--g-data-ink);background:var(--g-data-surface)}
|
|
155
|
+
.g-data[data-source=customer_plans][data-layout=full]>.g-data-list>.g-data-row{padding:24px 0;border:0;border-top:1px solid var(--g-data-ink);border-radius:0}
|
|
156
|
+
.g-data[data-source=credit_packs][data-layout=full]>.g-data-list>.g-data-row>.g-data-row-main,.g-data[data-source=customer_plans][data-layout=full]>.g-data-list>.g-data-row>.g-data-row-main{grid-column:1;grid-row:1}
|
|
157
|
+
.g-data[data-source=credit_packs][data-layout=full]>.g-data-list>.g-data-row>.g-data-row-value,.g-data[data-source=customer_plans][data-layout=full]>.g-data-list>.g-data-row>.g-data-row-value{grid-column:1;grid-row:2;text-align:start;font-size:30px;line-height:1.3;letter-spacing:-.035em;font-weight:500}
|
|
158
|
+
.g-data[data-source=credit_packs][data-layout=full]>.g-data-list>.g-data-row>.g-data-row-extra{grid-column:1;grid-row:3;align-self:end}
|
|
159
|
+
.g-data[data-source=customer_plans][data-layout=full]>.g-data-list>.g-data-row>.g-data-row-status{grid-column:1;grid-row:3;justify-self:start;align-self:end}
|
|
160
|
+
.g-data[data-source=customer_plans][data-layout=full]>.g-data-list>.g-data-row>.g-data-row-extra{grid-column:1;grid-row:auto}
|
|
161
|
+
.g-data[data-source=credit_packs][data-layout=full] .g-data-header,.g-data[data-source=customer_plans][data-layout=full] .g-data-header{margin-bottom:20px}
|
|
162
|
+
.g-data[data-source=credit_packs][data-layout=full] .g-data-buy{min-height:44px;border-radius:8px}
|
|
163
|
+
}
|
|
164
|
+
@media(max-width:560px){.g-data[data-source=customer_plans][data-layout=full] .g-data-row{grid-template-columns:minmax(0,1fr) auto;gap:12px}.g-data[data-source=customer_plans][data-layout=full] .g-data-row-value{font-size:20px}.g-data[data-source=membership][data-layout=full] .g-data-row-label{font-size:var(--g-data-display-size,24px)}}
|
|
126
165
|
@media(max-width:560px){.g-data-header{gap:10px}.g-data-controls{gap:6px}.g-data-row{grid-template-columns:minmax(0,1fr) auto;column-gap:12px}.g-data-row-status{grid-column:1;grid-row:2}.g-data-row-value{grid-column:2;grid-row:1}.g-data-row-extra{grid-column:1/-1}.g-data-facts{gap:12px}.g-data-button,.g-data-select{min-height:40px;padding:8px 10px}.g-data-refresh{width:40px;padding:10px}.g-data-sources>summary{min-height:36px}.g-data-table-head{display:none}.g-data[data-source=credit_transactions] .g-data-row{grid-template-columns:minmax(0,1fr) minmax(95px,.45fr);gap:12px}.g-data[data-source=credit_transactions] .g-data-row-status{grid-column:1;grid-row:2;margin-inline-start:46px;justify-self:start}.g-data[data-source=credit_transactions] .g-data-row-extra{grid-column:2;grid-row:1/3}.g-data[data-source=membership][data-layout=compact] .g-data-row-status{grid-column:2;grid-row:1}}
|
|
166
|
+
@media(max-width:560px){.g-data[data-source=credit_transactions][data-layout=compact] .g-data-row{grid-template-columns:minmax(0,1fr) minmax(95px,.45fr);gap:12px}.g-data[data-source=credit_transactions][data-layout=compact] .g-data-row-status{grid-column:1;grid-row:2;margin-inline-start:46px;justify-self:start}.g-data[data-source=credit_transactions][data-layout=compact] .g-data-row-extra{grid-column:2;grid-row:1/3}}
|
|
167
|
+
@media(max-width:560px){.g-data[data-source=membership] .g-data-row-no-value .g-data-row-status{grid-column:2;grid-row:1;align-self:start;justify-self:end}}
|
|
127
168
|
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
|
|
128
|
-
`,c=null,k=null,C=new Set,L=!1,$,W,G=[],_=Object.create(null),z=Object.create(null),m="",y=0,T=[],H=!1,Y=-1,Fe="",ge=null,Ee=null,fe=null,F=document.createElement("div");F.id="g-card";let me=document.createElement("div"),se=document.createElement("div");me.className=se.className="g-box",se.dataset.kind="select",me.append(document.createElement("span")),se.append(document.createElement("span"));function O(e){let a={...e,channel:l.channel};try{h.webkit?.messageHandlers?.grow?h.webkit.messageHandlers.grow.postMessage(a):h.GrowAndroid?h.GrowAndroid.postMessage(JSON.stringify(a)):window.parent.postMessage(a,l.parentOrigin)}catch{}}function ke(e){let a=parseInt(e.slice(1),16);return[a>>16&255,a>>8&255,a&255]}function he(e,a,t){let r=ke(e),i=ke(a),n=r.map((o,u)=>Math.round(o*t+i[u]*(1-t)));return`rgb(${n[0]},${n[1]},${n[2]})`}function lt(e){let[a,t,r]=ke(e).map(i=>{let n=i/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4});return .2126*a+.7152*t+.0722*r}function re(e){return typeof e!="string"?"":e.startsWith("#")?e:`var(--g-${e==="background"?"bg":e})`}function ut(e){let a=e.theme,t=document.documentElement.style,r=lt(a.primary),i=(r+.05)/.05>1.05/(r+.05)?"#111318":"#FFFFFF";t.setProperty("--g-primary",a.primary),t.setProperty("--g-on-primary",i),t.setProperty("--g-bg",a.background),t.setProperty("--g-text",a.text),t.setProperty("--g-muted",he(a.text,a.background,.62)),t.setProperty("--g-surface",he(a.text,a.background,.05)),t.setProperty("--g-border",he(a.text,a.background,.16)),t.setProperty("--g-focus",he(a.primary,a.background,.45)),t.setProperty("--g-radius",`${d[a.radius]??8}px`),t.setProperty("--g-font",R[a.font]??R.system),t.setProperty("--g-edit","#2C3C96")}function J(e){let a=c?.strings.locales[m]?.[e];return a&&a.trim()?{value:a,missing:!1}:{value:c?.strings.locales[c.strings.defaultLocale]?.[e]??"",missing:!0}}function ae(e){let a=$?.nodes[e];if(!a)return;let t=a.picker?_[a.picker]??$?.pickers[a.picker]?.selected:void 0;return typeof t=="string"?a.byPlan?.[t]??a.base:a.base}function Ce(e,a,t){let r=ae(e.id),i=r?.[a];if(i!==void 0)return{value:i,missing:!!r?.missing?.length};let n=J(t);return n.value.includes("{{")&&l.mode==="live"?{value:e.fallback?J(e.fallback).value:"",missing:!0}:{value:n.value,missing:n.missing||n.value.includes("{{")}}function pt(e){if(e.name)return e.name;let a=l.editorMessages?.nodeTypes?.[e.type];return l.mode==="editor"&&typeof a=="string"?a:{stack:"\u5BB9\u5668",text:"\u6587\u672C",image:"\u56FE\u7247",button:"\u6309\u94AE",divider:"\u5206\u9694\u7EBF",spacer:"\u7559\u767D",custom_html:"\u81EA\u5B9A\u4E49 HTML",price:"\u4EF7\u683C",coupon_code:"\u4F18\u60E0\u7801",countdown:"\u5012\u8BA1\u65F6",plan_picker:"\u771F\u5B9E\u5957\u9910\u9009\u62E9"}[e.type]??e.type}function gt(e,a){if(a.type==="color")e.background="none",e.backgroundColor=re(a.color);else if(a.type==="linear"){let t=a.stops.map(r=>`${re(r.color)} ${Number(r.at)}%`).join(",");e.backgroundColor="transparent",e.backgroundImage=`linear-gradient(${Number(a.angle)}deg,${t})`}else if(a.type==="image"&&typeof a.src=="string"){let t=/^data:image\/(?:svg\+xml|jpeg|png);base64,[A-Za-z0-9+/]+={0,2}$/.test(a.src)?a.src:a.src.replace(/[^A-Za-z0-9\-._~:/?#[\]@!$&*+;=%]/gu,i=>i.length===1&&i.charCodeAt(0)<128?`%${i.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`:encodeURIComponent(i));e.backgroundImage=`url("${t}")`;let r=a.position;e.backgroundPosition=r?`${r.x}% ${r.y}%`:"center",e.backgroundSize=a.fit==="contain"?"contain":"cover",e.backgroundRepeat="no-repeat"}}function Oe(e){return`${Number(e.top)}px ${Number(e.right)}px ${Number(e.bottom)}px ${Number(e.left)}px`}function Ue(e,a,t,r,i){if(a===void 0)return;let n=r?.direction??"vertical",o=n!=="overlay"&&t==="width"==(n==="horizontal"),u=t==="width"?"minWidth":"minHeight";a==="fill"?n==="overlay"?(e.style[t]="100%",e.style[t==="width"?"justifySelf":"alignSelf"]="stretch"):o?(e.style.flex="1 1 0",e.style[u]="0"):(e.style.alignSelf="stretch",e.style[t]="auto"):a==="fit"?(e.style[t]="fit-content",t==="width"&&(e.style.maxWidth="100%"),!o&&n!=="overlay"&&(!r||r.align==="stretch")&&(e.style.alignSelf=i==="center"?"center":i==="end"?"flex-end":"flex-start")):typeof a=="number"&&(e.style[t]=`${a}px`,t==="width"&&(e.style.maxWidth="100%"),o&&(e.style.flex="0 0 auto"))}function de(e,a,t){let r=a.style,i=r.text??{},n=e.style;if(a.type==="customer_data"&&i.color){let w=re(i.color);n.setProperty("--g-data-ink",w),n.setProperty("--g-data-muted",`color-mix(in srgb, ${w} 72%, transparent)`),n.setProperty("--g-data-line",`color-mix(in srgb, ${w} 20%, transparent)`),n.setProperty("--g-data-surface",`color-mix(in srgb, ${w} 8%, transparent)`)}r.padding&&(n.padding=Oe(r.padding)),r.margin&&(n.margin=Oe(r.margin)),typeof r.gap=="number"&&a.type==="stack"&&(n.gap=`${r.gap}px`),r.background&>(n,r.background),typeof r.opacity=="number"&&(n.opacity=String(r.opacity));let o=r.shape;if(o?.type==="pill")n.borderRadius="9999px";else if(o?.type==="rect"){let w=o.radius;n.borderRadius=typeof w=="number"?`${w}px`:`${Number(w.topLeft)}px ${Number(w.topRight)}px ${Number(w.bottomRight)}px ${Number(w.bottomLeft)}px`}(r.clipContent===!0||r.clipContent!==!1&&o&&(r.background||a.type==="image"))&&(n.overflow="hidden");let u=r.border;u&&(n.border=Number(u.width)>0?`${Number(u.width)}px ${u.style==="dashed"?"dashed":"solid"} ${re(u.color)}`:"0");let p=r.shadow;p&&(n.boxShadow=`${Number(p.x)}px ${Number(p.y)}px ${Number(p.blur)}px ${Number(p.spread)}px ${re(p.color)}`),["text","button","price","coupon_code","countdown","plan_picker"].includes(a.type)&&(i.font&&(n.fontFamily=R[String(i.font)]??""),typeof i.size=="number"&&(n.fontSize=`${i.size}px`),typeof i.weight=="number"&&(n.fontWeight=String(i.weight)),typeof i.lineHeight=="number"&&(n.lineHeight=String(i.lineHeight)),typeof i.letterSpacing=="number"&&(n.letterSpacing=`${i.letterSpacing}px`),i.color&&(n.color=re(i.color)),i.align&&(n.textAlign=String(i.align)),i.italic&&(n.fontStyle="italic"),i.decoration&&(n.textDecoration=String(i.decoration)),i.transform&&(n.textTransform=String(i.transform))),Ue(e,r.width,"width",t,i.align),Ue(e,r.height,"height",t,i.align),t?.direction==="horizontal"&&r.grow!==void 0&&(n.flexGrow=String(r.grow===!0?1:r.grow===!1?0:r.grow))}function ne(){if(!k)return;let e=k.snapshot();O({type:"funnel",state:e}),e.status==="waiting"&&je(),["completed","failed"].includes(e.status)&&(L=!0)}function je(e,a){let t=c?.funnel?.nodes.find(n=>n.id===k?.snapshot().nodeId);F.replaceChildren();let r=document.createElement("h2");r.textContent=t?.name??"\u6D41\u7A0B";let i=document.createElement("p");if(i.setAttribute("role","status"),i.textContent=e??"\u7B49\u5F85\u786E\u8BA4\u2026",F.append(r,i),a){let n=document.createElement("a");n.textContent="\u524D\u5F80\u5B89\u5168\u7ED3\u8D26",n.href=a,n.target="_blank",n.rel="noopener noreferrer",n.className="g-btn g-btn-primary",F.append(n)}if(t?.type==="purchase"||t?.type==="auth")for(let n of["confirm","cancel"]){let o=document.createElement("button");o.type="button",o.className="g-btn g-btn-secondary",o.textContent=n==="confirm"?"\u7EE7\u7EED\u786E\u8BA4":"\u8FD4\u56DE",o.addEventListener("click",u=>{u.isTrusted&&O({type:"funnel-intent",outcome:n})}),F.append(o)}K()}function qe(e,a){let t=c?.funnel?.questions.find(r=>r.source===e);!t||!k||(C.add(e),k.answer(t.id,a),ne())}function ft(){if(!c?.funnel)return!0;let e=new Set([...F.querySelectorAll("[data-g-node]")].filter(i=>{let n=i.getBoundingClientRect();return n.width>0&&n.height>0}).map(i=>i.dataset.gNode)),a=c.funnel.questions.filter(i=>i.required&&e.has(i.source)&&!C.has(i.source));if(F.querySelector("[data-g-validation]")?.remove(),!a.length)return!0;let t=document.createElement("p");return t.dataset.gValidation="",t.setAttribute("role","alert"),t.textContent=m.startsWith("zh")?"\u8BF7\u5148\u56DE\u7B54\u672C\u9875\u5FC5\u586B\u95EE\u9898":"Please answer the required questions",t.style.cssText="padding:12px 24px;color:var(--g-text)",F.append(t),F.querySelector(`[data-g-node="${a[0].source}"] [role=radio],[data-g-node="${a[0].source}"] button`)?.focus(),!1}function We(e){return c?e==="next"?y+1:e==="back"?T.at(-1)??-1:c.pages.findIndex(a=>a.id===e):-1}function Be(e,a){if(l.mode!=="live"||!c)return;let t=c.actions.find(i=>i.id===a);if(t?.type!=="navigate"||c.funnel?.routes.some(i=>i.action===t.id))return;let r=We(t.target);(r<0||r>=c.pages.length)&&(e.disabled=!0)}function mt(e){let a=document.createElement("section");a.className="g-data",a.dataset.layout=e.data.layout,a.dataset.source=e.data.source;let t=W?.nodes[e.id];a.dataset.preview=String(!!t?.preview);let r=t?.status==="loading",i=m.startsWith("zh"),n=(g,M)=>i?g:M;a.setAttribute("aria-busy",String(!!r));let o=(g,M,V)=>{let N=document.createElement(g);return N.className=M,V!==void 0&&(N.textContent=V),N},u=g=>{let M=document.createElementNS("http://www.w3.org/2000/svg","svg");M.setAttribute("viewBox","0 0 24 24"),M.setAttribute("fill","none"),M.setAttribute("stroke","currentColor"),M.setAttribute("stroke-width","1.7"),M.setAttribute("stroke-linecap","round"),M.setAttribute("stroke-linejoin","round"),M.setAttribute("aria-hidden","true"),M.classList.add("g-data-icon");let V={refresh:["M20 7v5h-5","M4 17v-5h5","M6.1 7a7 7 0 0 1 11.5-1.5L20 8M4 16l2.4 2.5A7 7 0 0 0 18 17"],down:["M7 7l10 10M7 17h10V7"],up:["M7 17L17 7M7 7h10v10"],chevron:["M6 9l6 6 6-6"],empty:["M4 8l8-4 8 4v10l-8 4-8-4V8Z","M4 8l8 4 8-4M12 12v10"],credit:["M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z","M12 7v10M8 12h8"]};for(let N of V[g]){let j=document.createElementNS("http://www.w3.org/2000/svg","path");j.setAttribute("d",N),M.append(j)}return M},p=(g,M,V,N=!1,j=M)=>{let Z=o("button","g-data-button",g);return Z.type="button",Z.disabled=N||!!r||!!t?.preview||l.mode!=="live",Z.dataset.gDataFocus=`${e.id}:${j}:${V??""}`,Z.addEventListener("click",X=>{!X.isTrusted||Z.disabled||O({type:"customer-data-intent",intent:{nodeId:e.id,action:M,...V?{value:V}:{}}})}),Z},w=o("div","g-data-header"),v=o("h2","g-data-heading",J(e.title).value);v.id=`g-data-title-${e.id}`,a.setAttribute("aria-labelledby",v.id);let f=o("div","g-data-controls"),A=[],U=g=>{g.hidden||(g.type==="customer_data"&&A.push(g),g.type==="stack"&&g.children.forEach(U))},Ze=c?.pages[y];Ze&&U(Ze.root);let xt=A.every(g=>W?.nodes[g.id]?.preview),wt=A.find(g=>g.data.source==="credit_balance")??A[0];t?.preview&&(!xt||wt?.id===e.id)&&f.append(o("span","g-data-preview",n("\u793A\u4F8B\u6570\u636E","Sample data")));let Te=r?n("\u66F4\u65B0\u4E2D\u2026","Updating\u2026"):n("\u5237\u65B0","Refresh"),oe=p(Te,"refresh");if(oe.replaceChildren(u("refresh")),oe.setAttribute("aria-label",Te),oe.title=Te,oe.classList.add("g-data-refresh"),r&&oe.classList.add("g-data-refreshing"),f.append(oe),e.data.source==="credit_balance"&&(v.prepend(u("credit")),t?.resources.length===1&&v.append(o("span","g-data-resource-label",t.resources[0].name)),t?.updatedAt)){let g=o("time","g-data-updated",`${n("\u66F4\u65B0\u4E8E","Updated")} ${new Intl.DateTimeFormat(m,{timeStyle:"short"}).format(new Date(t.updatedAt))}`);g.dateTime=t.updatedAt,g.title=new Intl.DateTimeFormat(m,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t.updatedAt)),f.prepend(g)}if(w.append(v,f),a.append(w),!t||t.source!==e.data.source)return a.append(o("p","g-data-empty",n("\u8FDE\u63A5\u5BA2\u6237\u6570\u636E\u540E\u663E\u793A\u6B64\u5185\u5BB9\u3002","Connect customer data to display this content."))),a;if(t.errorMessage){let g=o("div","g-data-error",t.errorMessage);g.setAttribute("role","alert"),a.append(g)}t.stale&&(t.resources.length||t.rows.length)&&a.append(o("p","g-data-note",n("\u663E\u793A\u4E0A\u6B21\u8BFB\u53D6\u7684\u7ED3\u679C\uFF0C\u6B63\u5728\u7B49\u5F85\u66F4\u65B0\u3002","Showing the last result while awaiting an update.")));let Ke={credit_transactions:[["all","\u5168\u90E8\u8BB0\u5F55","All activity"],["consume","\u6D88\u8D39","Usage"],["reserve","\u9884\u6263","Reserved"],["confirm","\u786E\u8BA4\u6263\u8D39","Confirmed"],["release","\u91CA\u653E","Released"],["refund","\u9000\u56DE","Refund"]],credit_pack_orders:[["all","\u5168\u90E8\u8BA2\u5355","All orders"],["pending","\u7B49\u5F85\u4ED8\u6B3E","Pending"],["paid","\u5DF2\u4ED8\u6B3E","Paid"],["expired","\u5DF2\u8FC7\u671F","Expired"],["refunded","\u5DF2\u9000\u6B3E","Refunded"],["disputed","\u4E89\u8BAE\u4E2D","Disputed"]],offer_history:[["all","\u5168\u90E8\u8BB0\u5F55","All offers"],["issued","\u53EF\u7528","Available"],["redeemed","\u5DF2\u4F7F\u7528","Redeemed"],["expired","\u5DF2\u5230\u671F","Expired"],["revoked","\u5DF2\u64A4\u9500","Revoked"]]};if(Ke[e.data.source]){let g=o("select","g-data-select");g.setAttribute("aria-label",n("\u7B5B\u9009\u8BB0\u5F55","Filter records")),g.dataset.gDataFocus=`${e.id}:filter`,g.disabled=!!r||t.preview||l.mode!=="live";for(let[M,V,N]of Ke[e.data.source]){let j=document.createElement("option");j.value=M,j.textContent=n(V,N),g.append(j)}g.value=t.filter,g.addEventListener("change",()=>{!g.disabled&&l.mode==="live"&&O({type:"customer-data-intent",intent:{nodeId:e.id,action:"filter",value:g.value}})}),f.prepend(g)}let Xe=(g,M=!1)=>{let V=o("ul","g-data-list");if(e.data.source==="credit_transactions"&&g.length&&!M){let N=o("div","g-data-table-head");N.setAttribute("aria-hidden","true"),N.append(o("span","",n("\u8BB0\u5F55","Record")),o("span","",n("\u7C7B\u578B","Type")),o("span","",n("\u79EF\u5206","Credits"))),a.append(N)}for(let N of g){let j=o("li","g-data-row"),Z=o("div","g-data-row-main"),X=o("div","g-data-row-copy");X.append(o("p","g-data-row-label",N.label));for(let B of N.detail)X.append(o("div","g-data-row-detail",B));if(e.data.source==="credit_transactions"&&!M){let B=o("span","g-data-row-mark");B.append(u(["Refund","\u9000\u56DE"].includes(N.status??"")?"up":"down")),Z.append(B)}if(Z.append(X),j.append(Z),N.status?j.append(o("div","g-data-row-status",N.status)):j.classList.add("g-data-row-no-status"),N.value?j.append(o("div","g-data-row-value",N.value)):j.classList.add("g-data-row-no-value"),N.facts.length||N.purchaseId){let B=o("div","g-data-row-extra"),Q=o("div","g-data-facts"),te=(ee,xe)=>{for(let Qe of ee){let et=o("span","",Qe.label);et.append(o("strong","",Qe.value)),xe.append(et)}};if(te(N.facts.slice(0,3),Q),N.facts.length>3){let ee=o("details","g-data-sources");ee.dataset.gDataSources=`facts:${N.id}`,ee.append(o("summary","",`${n("\u5168\u90E8\u6263\u8D39\u660E\u7EC6","All allocations")} \xB7 ${N.facts.length}`));let xe=o("div","g-data-facts");te(N.facts.slice(3),xe),ee.append(xe),Q.append(ee)}if(B.append(Q),N.purchaseId&&e.data.allowPurchase&&!M){let ee=p(t.buyingId===N.purchaseId?n("\u6B63\u5728\u51C6\u5907\u2026","Preparing\u2026"):n("\u8D2D\u4E70\u79EF\u5206","Buy credits"),"buy_pack",N.purchaseId,!!t.preview||!!t.buyingId);ee.classList.add("g-data-buy"),B.append(ee)}j.append(B)}V.append(j)}return V};for(let g of t.resources){let M=o("article","g-data-resource");M.setAttribute("aria-label",g.name),t.resources.length>1&&M.append(o("p","g-data-name",g.name));let V=o("div","g-data-balance"),N=new Intl.NumberFormat(m).formatToParts(1.1).find(B=>B.type==="decimal")?.value??".",j=g.spendable.lastIndexOf(N),Z=o("strong","g-data-number",j<0?g.spendable:g.spendable.slice(0,j));j>=0&&Z.append(o("span","g-data-fraction",g.spendable.slice(j))),V.append(Z,o("span","g-data-unit",n("\u53EF\u7528\u79EF\u5206","Spendable credits"))),M.append(V);let X=o("div","g-data-facts");for(let[B,Q]of[[n("\u4F59\u989D","Balance"),g.available],[n("\u51BB\u7ED3","Reserved"),g.reserved]]){let te=o("span","",B);te.append(o("strong","",Q)),X.append(te)}if(g.expiry&&X.append(o("span","g-data-expiry",`${n("\u6700\u8FD1\u5230\u671F","Next expiry")} \xB7 ${g.expiry}`)),M.append(X),e.data.showSources&&g.sourceCount){let B=o("details","g-data-sources");if(B.dataset.gDataSources=g.key,B.append(o("summary","",`${n("\u79EF\u5206\u6765\u6E90","Credit sources")} \xB7 ${g.sourceCount}`),Xe(g.sources,!0)),B.querySelector("summary")?.append(u("chevron")),g.hasNextSources||g.hasPreviousSources){let Q=o("div","g-data-footer");Q.append(o("span","",`${n("\u7B2C","Page")} ${g.sourcePage}`));let te=o("div","g-data-controls");te.append(p(n("\u4E0A\u4E00\u9875","Previous"),"sources_previous",g.key,!g.hasPreviousSources),p(n("\u4E0B\u4E00\u9875","Next"),"sources_next",g.key,!g.hasNextSources)),Q.append(te),B.append(Q)}M.append(B)}a.append(M)}if(t.rows.length&&a.append(Xe(t.rows)),!t.rows.length&&!t.resources.length&&t.status!=="error"){let g=o("p","g-data-empty",r?n("\u6B63\u5728\u8BFB\u53D6\u8D26\u6237\u6570\u636E\u2026","Loading account data\u2026"):t.status==="idle"?n("\u767B\u5F55\u540E\u67E5\u770B\u4F60\u7684\u8D26\u6237\u6570\u636E\u3002","Sign in to view your account data."):e.data.source==="credit_pack_orders"?n("\u6682\u65E0\u8D2D\u4E70\u8BB0\u5F55","No purchases yet"):n("\u8FD9\u91CC\u8FD8\u6CA1\u6709\u8BB0\u5F55\u3002","There are no records yet."));g.prepend(u("empty")),g.setAttribute("role","status"),a.append(g)}if(t.hasNext||t.hasPrevious){let g=o("div","g-data-footer");g.append(o("span","",`${n("\u7B2C","Page")} ${t.page}`));let M=o("div","g-data-controls");M.append(p(n("\u4E0A\u4E00\u9875","Previous"),"previous",void 0,!t.hasPrevious),p(n("\u4E0B\u4E00\u9875","Next"),"next",void 0,!t.hasNext)),g.append(M),a.append(g)}return t.updatedAt&&e.data.source!=="credit_balance"&&a.append(o("p","g-data-note g-data-updated",`${n("\u6570\u636E\u66F4\u65B0\u4E8E","Updated")} ${new Intl.DateTimeFormat(m,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t.updatedAt))}`)),a}let ce=new Map,Je=e=>{let a=e.target;for(let t of ce.keys())a&&!ye(t)?.contains(a)&&ce.delete(t)};document.addEventListener("focusin",Je),document.addEventListener("pointerdown",Je);function ht(e){let a=W;if(W=e,!c)return;let t=(r,i)=>{if(r.type==="stack"){r.children.forEach(f=>t(f,r));return}if(r.type!=="customer_data"||JSON.stringify(a?.nodes[r.id])===JSON.stringify(e.nodes[r.id]))return;let n=ye(r.id);if(!n)return;let o=document.activeElement;o&&n.contains(o)&&o.dataset.gDataFocus&&ce.set(r.id,o.dataset.gDataFocus);let u=new Set([...n.querySelectorAll("details[data-g-data-sources]")].filter(f=>f.open).map(f=>f.dataset.gDataSources)),p=Pe(r,i);if(!p)return;for(let f of p.querySelectorAll("details[data-g-data-sources]"))f.open=u.has(f.dataset.gDataSources);let w=n.scrollTop;n.replaceWith(p),p.scrollTop=w;let v=ce.get(r.id);v&&[...p.querySelectorAll("[data-g-data-focus]")].find(f=>f.dataset.gDataFocus===v)?.focus({preventScroll:!0}),p.animate&&e.nodes[r.id]?.status==="ready"&&!window.matchMedia("(prefers-reduced-motion:reduce)").matches&&p.animate([{opacity:.7},{opacity:1}],{duration:140,easing:"ease-out"})};t(c.pages[y]?.root??c.pages[0].root,null),K()}function Pe(e,a){if(e.hidden)return null;let t;if(e.type==="customer_data")t=mt(e);else if(e.type==="stack"){t=document.createElement("div"),t.className=`g-stack ${e.direction==="horizontal"?"g-h":e.direction==="overlay"?"g-o":"g-v"}`,e.direction==="overlay"?(t.style.alignItems=S[e.align]??"stretch",t.style.justifyItems=b[e.justify]??"stretch"):(t.style.alignItems=E[e.align]??"stretch",t.style.justifyContent=P[e.justify]??"flex-start");for(let r of e.children){let i=Pe(r,e);i&&t.append(i)}e.interaction&&yt(t,e),l.mode==="editor"&&!t.childElementCount&&(t.classList.add("g-empty"),t.dataset.gEditorPlaceholder=l.editorMessages?.emptyContainer??"\u62D6\u5165\u7EC4\u4EF6")}else if(e.type==="text"){let r=e.variant==="title"?"h1":e.variant==="heading"?"h2":"p";t=document.createElement(r),t.className=`g-text g-${e.variant}`;let i=Ce(e,"text",e.text);t.textContent=i.value,i.missing&&l.mode==="editor"&&t.classList.add("g-missing")}else if(e.type==="button"){t=document.createElement("button"),t.type="button",t.className=`g-btn g-btn-${e.variant}`;let r=Ce(e,"label",e.label);if(t.textContent=r.value,r.missing&&l.mode==="editor"&&t.classList.add("g-missing"),t.dataset.gAction=e.action,Be(t,e.action),c?.actions.find(i=>i.id===e.action)?.type==="purchase"&&l.mode==="live"&&(t.disabled=ae(e.id)?.unavailable??!0,t.disabled)){t.style.opacity="0.55",t.style.cursor="not-allowed";let i=ae(e.id)?.unavailableReason??(m.startsWith("zh")?"\u6682\u65F6\u6CA1\u6709\u53EF\u8D2D\u4E70\u7684\u5957\u9910\u3002":"No purchasable plan is available.");t.title=i,t.setAttribute("aria-label",`${r.value} \u2014 ${i}`);let n=document.createElement("span");n.style.cssText="display:block;margin-top:4px;font-size:.8em;font-weight:normal",n.textContent=i,t.append(n)}l.mode==="editor"&&(t.tabIndex=-1)}else if(e.type==="image"){t=document.createElement("div"),t.className="g-img",I[e.aspect]&&(t.dataset.aspect=e.aspect,t.style.aspectRatio=I[e.aspect]);let r=document.createElement("img");r.src=e.localizedSrc?.[m]??e.localizedSrc?.[c.strings.defaultLocale]??e.src,r.alt=Ce(e,"alt",e.alt).value,r.referrerPolicy="no-referrer",r.decoding="async",r.style.objectFit=e.fit,e.position&&(r.style.objectPosition=`${e.position.x}% ${e.position.y}%`),r.addEventListener("load",K),t.append(r)}else if(e.type==="price"){t=document.createElement("div"),t.className="g-price",t.style.cssText="display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;font-variant-numeric:tabular-nums";let r=ae(e.id);if(!r?.price)t.textContent=r?.text??J(e.fallback).value,l.mode==="editor"&&t.classList.add("g-missing");else for(let i of["current","original","period"]){let n=r.price[i];if(!n)continue;let o=document.createElement(i==="original"?"s":"span");o.textContent=n,i==="original"&&(o.style.opacity=".6"),e.parts?.[i]&&de(o,{type:"text",id:e.id,text:e.fallback,variant:"body",style:e.parts[i]},null),t.append(o)}}else if(e.type==="coupon_code"){t=document.createElement("div"),t.style.cssText="display:flex;align-items:center;gap:12px;flex-wrap:wrap";let r=ae(e.id);if(r?.code){let i=document.createElement("code");i.textContent=r.code;let n=document.createElement("button");n.type="button",n.className="g-btn g-btn-secondary",n.textContent=J(e.label).value,n.addEventListener("click",o=>{l.mode!=="editor"&&(o.stopPropagation(),O({type:"copy",nodeId:e.id}))}),t.append(i,n)}else t.textContent=r?.text??J(e.fallback).value,l.mode==="editor"&&t.classList.add("g-missing")}else if(e.type==="countdown"){t=document.createElement("span"),t.setAttribute("role","timer"),t.style.fontVariantNumeric="tabular-nums";let r=ae(e.id),i=r?.countdownAt?Date.parse(r.countdownAt):NaN;!Number.isFinite(i)&&l.mode==="editor"&&t.classList.add("g-missing");let n=()=>{if(!Number.isFinite(i)){t.textContent=r?.text??J(e.fallback).value;return}let o=Math.max(0,Math.ceil((i-Date.now())/1e3));if(!o){t.textContent=J(e.expired).value;return}let u=e.granularity,p=u==="day"?86400:u==="hour"?3600:u==="minute"?60:1;u!=="second"?t.textContent=new Intl.NumberFormat(m,{style:"unit",unit:u,unitDisplay:"short"}).format(Math.ceil(o/p)):t.textContent=[Math.floor(o/86400),Math.floor(o/3600)%24,Math.floor(o/60)%60,o%60].map(w=>String(w).padStart(2,"0")).join(":")};n(),Number.isFinite(i)&&G.push(setInterval(n,1e3))}else if(e.type==="plan_picker"){t=document.createElement("div"),t.setAttribute("role","radiogroup"),t.setAttribute("aria-label",J(e.label).value),t.style.cssText="display:flex;flex-direction:column;gap:8px";let r=$?.pickers[e.id];if(!r?.options.length)t.textContent=J(e.fallback).value,l.mode==="editor"&&t.classList.add("g-missing");else{let i=typeof _[e.id]=="string"?String(_[e.id]):r.selected;_[e.id]=i??"";let n=o=>{_[e.id]=o,le(),ye(e.id)?.querySelector(`[data-plan-id="${o}"]`)?.focus()};for(let[o,u]of r.options.entries()){let p=$.plans[u];if(!p)continue;let w=document.createElement("button");w.type="button",w.className="g-btn g-btn-secondary",w.style.cssText="width:100%;text-align:start",w.setAttribute("role","radio"),w.setAttribute("aria-checked",String(u===i)),w.tabIndex=l.mode==="editor"?-1:u===i?0:-1,w.dataset.planId=u;let v=$.nodes[e.id]?.byPlan?.[u]?.price;w.textContent=`${p.name} \xB7 ${v?.current??p.price}${v?.period??p.period}`,u===i&&(w.style.borderColor="var(--g-primary)",w.style.boxShadow="inset 0 0 0 1px var(--g-primary)",e.states?.selected&&de(w,{type:"text",id:e.id,text:e.label,variant:"body",style:e.states.selected},null)),w.addEventListener("click",f=>{l.mode!=="editor"&&(f.stopPropagation(),n(u))}),w.addEventListener("keydown",f=>{if(l.mode==="editor")return;let A;["ArrowRight","ArrowDown"].includes(f.key)?A=(o+1)%r.options.length:["ArrowLeft","ArrowUp"].includes(f.key)?A=(o-1+r.options.length)%r.options.length:f.key==="Home"?A=0:f.key==="End"&&(A=r.options.length-1),A!==void 0&&(f.preventDefault(),n(r.options[A]))}),t.append(w)}}}else if(e.type==="divider")t=document.createElement("hr"),t.className="g-divider";else if(e.type==="spacer")t=document.createElement("div"),t.setAttribute("aria-hidden","true"),t.style.flex="0 0 auto",t.style.width=t.style.height=`${x[e.size]??0}px`;else if(e.type==="custom_html"){t=document.createElement("div"),t.className="g-custom";let r=t.attachShadow({mode:"open"}),i=e.html[m],n=i&&i.trim()?i:e.html[c?.strings.defaultLocale??""]??"",o=ae(e.id);o?.html!==void 0?n=o.html:n.includes("{{")&&l.mode==="live"&&(n=J(e.fallback??"").value.replace(/[&<>"']/g,v=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[v])),(o?.missing?.length||!o&&n.includes("{{"))&&l.mode==="editor"&&t.classList.add("g-missing"),!(i&&i.trim())&&l.mode==="editor"&&t.classList.add("g-missing");let u=document.createElement("style");u.textContent=`:host{display:block}${e.css}`;let p=document.createElement("div");p.innerHTML=n;for(let w of p.querySelectorAll("button[data-grow-action]"))Be(w,w.getAttribute("data-grow-action"));r.append(u,p);for(let w of p.querySelectorAll("img"))w.addEventListener("load",K)}else return null;return e.style&&de(t,e,a),t.dataset.gNode=e.id,t.dataset.gLabel=pt(e),t}function yt(e,a){let t=a.interaction,r=[...e.children];e.setAttribute("aria-label",J(t.label).value);let i=c?.funnel?.questions.find(n=>n.source===a.id);if(i){let n=document.createElement("p");n.className="g-text g-body",n.textContent=J(t.label).value+(i.required?" *":""),e.prepend(n),i.required&&e.setAttribute("aria-required","true")}if(!(l.mode!=="live"||!r.length))if(t.type==="select"){e.setAttribute("role","radiogroup");let n=a.children.filter(p=>!p.hidden),o=n.findIndex(p=>p.id===_[a.id]);o<0&&(o=Math.min(t.defaultIndex,r.length-1));let u=(p,w=!1,v=!0)=>{o=p,_[a.id]=n[p].id,v&&qe(a.id,n[p].id),r.forEach((f,A)=>{f.setAttribute("aria-checked",String(A===p)),f.tabIndex=A===p?0:-1,f.style.cssText="";let U=n[A];U.type==="stack"&&(f.style.alignItems=E[U.align]??"stretch",f.style.justifyContent=P[U.justify]??"flex-start"),U.style&&de(f,U,a),A===p&&(t.selectedStyle&&de(f,{...U,style:t.selectedStyle},a),t.selectedStyle?.border||(f.style.outline="2px solid var(--g-primary)",f.style.outlineOffset="-2px")),f.style.cursor="pointer"}),w&&r[p].focus()};r.forEach((p,w)=>{p.setAttribute("role","radio"),p.setAttribute("aria-label",p.textContent?.trim()||String(w+1)),p.addEventListener("click",v=>{v.stopPropagation(),u(w)}),p.addEventListener("keydown",v=>{let f=v.key;["ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"," ","Enter"].includes(f)&&(v.preventDefault(),v.stopPropagation(),u(f==="Home"?0:f==="End"?r.length-1:f==="ArrowRight"||f==="ArrowDown"?(o+1)%r.length:f==="ArrowLeft"||f==="ArrowUp"?(o+r.length-1)%r.length:w,!0))})}),u(o,!1,!1)}else if(t.type==="tabs"){let n=a.children.filter(v=>!v.hidden),o=document.createElement("div");o.setAttribute("role","tablist"),o.setAttribute("aria-label",J(t.label).value),o.style.cssText="display:flex;gap:4px;padding:4px;border:1px solid var(--g-border);border-radius:12px";let u=r.map((v,f)=>{let A=document.createElement("button");return A.type="button",A.setAttribute("role","tab"),A.textContent=Ie(n[f])||String(f+1),A.style.cssText="flex:1;min-width:0;min-height:44px;padding:8px 16px;border:0;border-radius:8px;font:inherit;cursor:pointer",v.id=`g-${a.id}-${n[f].id}`,v.setAttribute("role","tabpanel"),A.setAttribute("aria-controls",v.id),o.append(A),A}),p=(v,f=!1)=>{_[a.id]=n[v].id,r.forEach((A,U)=>{A.hidden=U!==v,u[U].setAttribute("aria-selected",String(U===v)),u[U].tabIndex=U===v?0:-1,u[U].style.background=U===v?"var(--g-primary)":"transparent",u[U].style.color=U===v?"var(--g-on-primary)":"var(--g-text)"}),f&&u[v].focus(),K()};u.forEach((v,f)=>{v.addEventListener("click",A=>{A.stopPropagation(),p(f)}),v.addEventListener("keydown",A=>{["ArrowLeft","ArrowRight","Home","End"].includes(A.key)&&(A.preventDefault(),A.stopPropagation(),p(A.key==="Home"?0:A.key==="End"?r.length-1:(f+(A.key==="ArrowRight"?1:r.length-1))%r.length,!0))})}),e.prepend(o);let w=n.findIndex(v=>v.id===_[a.id]);p(w>=0?w:Math.min(t.defaultIndex,r.length-1))}else if(t.type==="toggle"){let n=document.createElement("button");n.type="button",n.setAttribute("role","switch"),n.className="g-btn g-btn-secondary",n.style.cssText="display:flex;align-items:center;justify-content:space-between;gap:16px;color:var(--g-text)";let o=document.createElement("span");o.textContent=J(t.label).value;let u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.cssText="position:relative;display:block;flex:none;width:44px;height:24px;border-radius:12px;background:var(--g-border)";let p=document.createElement("span");p.style.cssText="position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0003",u.append(p),n.append(o,u);let w=v=>{_[a.id]=v,n.setAttribute("aria-checked",String(v)),u.style.background=v?"var(--g-primary)":"var(--g-border)",p.style.left=v?"23px":"3px",p.style.background=v?"var(--g-on-primary)":"#FFFFFF",r.forEach((f,A)=>f.hidden=A!==(v?0:1)),K()};n.addEventListener("click",v=>{v.stopPropagation(),w(!_[a.id]),qe(a.id,!!_[a.id])}),e.prepend(n),w(typeof _[a.id]=="boolean"?_[a.id]:t.defaultEnabled)}else{e.setAttribute("role","region"),e.setAttribute("aria-roledescription","carousel");let n=document.createElement("div");n.style.cssText="display:flex;align-items:center;justify-content:center;gap:10px";let o=document.createElement("button"),u=document.createElement("button"),p=document.createElement("span"),w=m.startsWith("zh");o.textContent="\u2190",u.textContent="\u2192",o.setAttribute("aria-label",w?"\u4E0A\u4E00\u6761\u8BC4\u4EF7":"Previous review"),u.setAttribute("aria-label",w?"\u4E0B\u4E00\u6761\u8BC4\u4EF7":"Next review");for(let f of[o,u])f.type="button",f.className="g-btn g-btn-secondary",f.style.color="var(--g-text)";p.setAttribute("aria-live","polite");let v=f=>{z[a.id]=f,r.forEach((A,U)=>A.hidden=U!==f),p.textContent=`${f+1} / ${r.length}`,K()};o.addEventListener("click",f=>{f.stopPropagation(),v((z[a.id]+r.length-1)%r.length)}),u.addEventListener("click",f=>{f.stopPropagation(),v((z[a.id]+1)%r.length)}),n.append(o,p,u),e.append(n),v(z[a.id]??0)}}function Ie(e){if(e.hidden)return"";if(e.type==="text"&&(e.variant==="title"||e.variant==="heading"))return J(e.text).value;if(e.type==="stack")for(let a of e.children){let t=Ie(a);if(t)return t}return""}function le(){if(G.forEach(clearInterval),G=[],!c)return;let e=c.pages[y]??c.pages[0];ut(e.theme?{...c,theme:e.theme}:c);let a=m.split("-")[0];document.documentElement.lang=m,document.documentElement.dir=["ar","he","fa","ur"].includes(a)?"rtl":"ltr",F.dataset.gPresentation=c.presentation.type;let t=Pe(e.root,null);if(F.replaceChildren(...t?[t]:[]),c.surface==="onboarding"&&!c.funnel&&c.pages.length>1){let i=document.createElement("div");i.dataset.gProgress="",i.setAttribute("role","progressbar"),i.setAttribute("aria-label",c.name),i.setAttribute("aria-valuemin","1"),i.setAttribute("aria-valuemax",String(c.pages.length)),i.setAttribute("aria-valuenow",String(y+1)),i.style.cssText="display:flex;gap:6px;padding-top:20px;width:calc(100% - 48px);max-width:960px;margin-inline:auto";for(let n=0;n<c.pages.length;n++){let o=document.createElement("span");o.style.cssText=`flex:1;height:3px;border-radius:3px;background:${n<=y?"var(--g-primary)":"var(--g-border)"}`,i.append(o)}F.prepend(i)}F.dataset.gPage=e.id,l.mode==="live"&&O({type:"page",pageId:e.id}),Ae(),Le();let r=Math.ceil(F.getBoundingClientRect().height);H?K():(H=!0,Y=r,O({type:"rendered",height:r,label:Ie(e.root)||c.name}))}function K(){let e=Math.ceil(F.getBoundingClientRect().height);e!==Y&&(Y=e,O({type:"resize",height:e})),Ae(),Le()}function Le(){if(l.mode!=="editor")return;let e=[];for(let t of F.querySelectorAll("[data-g-node]")){let r=t.getBoundingClientRect();!r.width||!r.height||e.push({id:t.dataset.gNode,x:r.x,y:r.y,width:r.width,height:r.height})}let a=JSON.stringify(e);a!==Fe&&(Fe=a,O({type:"layout",nodes:e}))}function ye(e){return!e||!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(e)?null:F.querySelector(`[data-g-node="${e}"]`)}function Ve(e,a){let t=ye(a);if(!t){e.style.display="none";return}let r=t.getBoundingClientRect();e.style.display="block",e.style.left=`${r.left+window.scrollX}px`,e.style.top=`${r.top+window.scrollY}px`,e.style.width=`${r.width}px`,e.style.height=`${r.height}px`,e.toggleAttribute("data-below",r.top<20),e.firstChild.textContent=t.dataset.gLabel??""}function Ae(){l.mode==="editor"&&(Ve(se,Ee),Ve(me,ge&&ge!==Ee?ge:null))}function be(e){for(let a of e.composedPath()){if(a instanceof HTMLElement&&a.dataset.gNode)return a.dataset.gNode;if(a===F)break}return null}function bt(e){if(!(!e.isTrusted||L)){if(l.mode==="editor"){e.preventDefault(),e.stopPropagation(),O({type:"select",id:be(e)});return}for(let a of e.composedPath()){if(!(a instanceof HTMLElement))continue;let t=a.dataset.gAction??(a.tagName==="BUTTON"?a.getAttribute("data-grow-action"):null);if(t&&!a.disabled){e.preventDefault();let r=c?.actions.find(i=>i.id===t);if(r?.type==="navigate"&&c){let i=c.funnel?.routes.find(u=>u.action===t);if((r.target!=="back"||i)&&!ft())return;let n=We(r.target);if(k){let u;if(i?.target==="back"||r.target==="back"&&!i)u=k.back();else{let p=i?.target??c.pages[n]?.id;if(!p)return;u=k.move(p)}if(n=c.pages.findIndex(p=>p.id===u.pageId),u.status!=="running"){O({type:"action",actionId:t,selection:{..._}}),ne(),u.status==="failed"&&O({type:"error",message:u.error??"Funnel failed"});return}}if(n<0||n>=c.pages.length)return;r.target==="back"&&!i?T.pop():n!==y&&T.push(y),y=n,le(),ne(),F.animate&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches&&F.animate([{opacity:0,transform:"translateY(6px)"},{opacity:1,transform:"translateY(0)"}],{duration:160,easing:"ease-out"}),window.scrollTo?.(0,0);let o=F.querySelector("h1,h2,h3,button");o&&(o.tabIndex=-1,o.focus())}O({type:"action",actionId:t,nodeId:be(e)??void 0,...Object.keys(_).length?{selection:{..._}}:{}});return}if(a===F)return}}}function Ge(e){let a=e;if(!(!a||a.channel!==l.channel))try{if(a.type==="render"){if(c=a.doc,y=Math.max(0,c.pages.findIndex(t=>t.id===a.startPageId)),T=[],L=!1,C=new Set,k=c.funnel&&l.mode==="live"&&s?s(c.funnel,c.pages.map(t=>t.id)):null,k){let t=a.resume?k.restore(a.resume):k.start(typeof a.startPageId=="string"?a.startPageId:void 0);if(y=Math.max(0,c.pages.findIndex(r=>r.id===t.pageId)),t.status!=="running"){O({type:"rendered",height:1,label:c.name}),ne(),t.status==="failed"&&O({type:"error",message:t.error??"Funnel failed"});return}}_=Object.create(null),$=a.capabilities,W=a.customerData,ce.clear();for(let[t,r]of Object.entries($?.pickers??{}))r.selected&&(_[t]=r.selected);if(k&&a.resume){let t=k.snapshot();T=t.history.map(r=>c.pages.findIndex(i=>i.id===r));for(let r of c.funnel.questions)Object.hasOwn(t.answers,r.id)&&(_[r.source]=t.answers[r.id],C.add(r.source))}z=Object.create(null),m=String(a.locale),le(),ne()}else if(a.type==="capabilities")$=a.capabilities,le();else if(a.type==="customer-data")ht(a.data);else if(a.type==="funnel-result"&&k&&k.snapshot().status==="waiting")if(typeof a.target=="string"){let t=k.resolve(a.target);L=!1,t.status==="running"&&(y=c.pages.findIndex(r=>r.id===t.pageId),le()),ne()}else je(typeof a.label=="string"?a.label:void 0,typeof a.checkoutUrl=="string"&&/^https:\/\//.test(a.checkoutUrl)?a.checkoutUrl:void 0);else a.type==="highlight"&&l.mode==="editor"&&(ge=a.hoverId??null,Ee=a.selectedId??null,Ae())}catch(t){O({type:"error",message:t instanceof Error?t.message:"render failed"})}}let Ye=document.createElement("style");Ye.textContent=D,document.head.append(Ye),document.body.append(F),l.mode==="editor"&&(document.body.dataset.gEditor="",document.body.append(me,se),document.addEventListener("mouseover",e=>{let a=be(e);a!==fe&&(fe=a,O({type:"hover",id:a}))}),document.documentElement.addEventListener("mouseleave",()=>{fe!==null&&(fe=null,O({type:"hover",id:null}))}),document.addEventListener("dblclick",e=>{let a=be(e);a&&e.isTrusted&&O({type:"edit",id:a})}),document.addEventListener("click",e=>{F.contains(e.target)||O({type:"select",id:null})})),F.addEventListener("click",bt),document.addEventListener("keydown",e=>{e.key==="Escape"&&e.isTrusted&&O({type:"escape"})}),typeof ResizeObserver=="function"&&new ResizeObserver(K).observe(F),window.addEventListener("resize",K),l.mode==="editor"&&window.addEventListener("scroll",Le),window.addEventListener("message",e=>{e.source===window.parent&&Ge(e.data)}),h.__growReceive=Ge,O({type:"ready"})}function dt(l,s){let h=`(${st.toString()})(${JSON.stringify(l).replace(/</g,"\\u003c")}, (${Re.toString()}))`;return`<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-${s}'; style-src 'unsafe-inline'; img-src https: data:; connect-src 'none'; font-src 'none'; media-src 'none'; frame-src 'none'; base-uri 'none'; form-action 'none'"></head><body><script nonce="${s}">${h}<\/script></body></html>`}function Lt(){return`(() => {
|
|
169
|
+
`,m=null,$=null,C=new Set,S=!1,N,j,U=[],Z={},h=Object.create(null),f=Object.create(null),y="",M,_=0,Y=[],qe=!1,Ee=-1,Be="",me=null,Ae=null,fe=null,F=document.createElement("div");F.id="g-card";let he=document.createElement("div"),de=document.createElement("div");he.className=de.className="g-box",de.dataset.kind="select",he.append(document.createElement("span")),de.append(document.createElement("span"));function q(e){let a={...e,channel:l.channel};try{w.webkit?.messageHandlers?.grow?w.webkit.messageHandlers.grow.postMessage(a):w.GrowAndroid?w.GrowAndroid.postMessage(JSON.stringify(a)):window.parent.postMessage(a,l.parentOrigin)}catch{}}function Ie(e){let a=parseInt(e.slice(1),16);return[a>>16&255,a>>8&255,a&255]}function ye(e,a,t){let n=Ie(e),o=Ie(a),r=n.map((i,d)=>Math.round(i*t+o[d]*(1-t)));return`rgb(${r[0]},${r[1]},${r[2]})`}function bt(e){let[a,t,n]=Ie(e).map(o=>{let r=o/255;return r<=.03928?r/12.92:((r+.055)/1.055)**2.4});return .2126*a+.7152*t+.0722*n}function ne(e){return typeof e!="string"?"":e.startsWith("#")?e:`var(--g-${e==="background"?"bg":e})`}function We(e){let a=e.theme,t=document.documentElement.style,n=bt(a.primary),o=(n+.05)/.05>1.05/(n+.05)?"#111318":"#FFFFFF";t.setProperty("--g-primary",a.primary),t.setProperty("--g-on-primary",o),t.setProperty("--g-bg",a.background),t.setProperty("--g-text",a.text),t.setProperty("--g-muted",ye(a.text,a.background,.62)),t.setProperty("--g-surface",ye(a.text,a.background,.05)),t.setProperty("--g-border",ye(a.text,a.background,.16)),t.setProperty("--g-focus",ye(a.primary,a.background,.45)),t.setProperty("--g-radius",`${c[a.radius]??8}px`),t.setProperty("--g-font",z[a.font]??z.system),t.setProperty("--g-edit","#2C3C96")}function V(e){let a=m?.strings.locales[y]?.[e];return a&&a.trim()?{value:a,missing:!1}:{value:m?.strings.locales[m.strings.defaultLocale]?.[e]??"",missing:!0}}function ae(e){let a=N?.nodes[e];if(!a)return;let t=a.picker?h[a.picker]??N?.pickers[a.picker]?.selected:void 0;return typeof t=="string"?a.byPlan?.[t]??a.base:a.base}function Je(){return Object.fromEntries(Object.entries(h).filter(e=>!Array.isArray(e[1])))}function Ce(e,a,t){let n=ae(e.id),o=n?.[a],r=o!==void 0?{value:o,missing:!!n?.missing?.length}:V(t);if(l.mode==="live"&&m?.funnel){let i=!1,d=r.value.replace(/\{\{\s*(input|params)\.([a-zA-Z][a-zA-Z0-9_-]{0,63})\s*\}\}/g,(s,b,x)=>{let g=b==="params"?Z[x]:$?.snapshot().answers[x];return g===void 0||g===""||Array.isArray(g)&&!g.length?(i=!0,""):Array.isArray(g)?g.join(", "):String(g)});if(i)return{value:e.fallback?V(e.fallback).value:"",missing:!0};if(!d.includes("{{"))return{value:d,missing:r.missing}}return o!==void 0?r:r.value.includes("{{")&&l.mode==="live"?{value:e.fallback?V(e.fallback).value:"",missing:!0}:{value:r.value,missing:r.missing||r.value.includes("{{")}}function xt(e){if(e.name)return e.name;let a=l.editorMessages?.nodeTypes?.[e.type];return l.mode==="editor"&&typeof a=="string"?a:{stack:"\u5BB9\u5668",text:"\u6587\u672C",image:"\u56FE\u7247",button:"\u6309\u94AE",divider:"\u5206\u9694\u7EBF",spacer:"\u7559\u767D",custom_html:"\u81EA\u5B9A\u4E49 HTML",price:"\u4EF7\u683C",coupon_code:"\u4F18\u60E0\u7801",countdown:"\u5012\u8BA1\u65F6",plan_picker:"\u771F\u5B9E\u5957\u9910\u9009\u62E9"}[e.type]??e.type}function wt(e,a){if(a.type==="color")e.background="none",e.backgroundColor=ne(a.color);else if(a.type==="linear"){let t=a.stops.map(n=>`${ne(n.color)} ${Number(n.at)}%`).join(",");e.backgroundColor="transparent",e.backgroundImage=`linear-gradient(${Number(a.angle)}deg,${t})`}else if(a.type==="image"&&typeof a.src=="string"){let t=/^data:image\/(?:svg\+xml|jpeg|png);base64,[A-Za-z0-9+/]+={0,2}$/.test(a.src)?a.src:a.src.replace(/[^A-Za-z0-9\-._~:/?#[\]@!$&*+;=%]/gu,o=>o.length===1&&o.charCodeAt(0)<128?`%${o.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`:encodeURIComponent(o));e.backgroundImage=`url("${t}")`;let n=a.position;e.backgroundPosition=n?`${n.x}% ${n.y}%`:"center",e.backgroundSize=a.fit==="contain"?"contain":"cover",e.backgroundRepeat="no-repeat"}}function Ve(e){return`${Number(e.top)}px ${Number(e.right)}px ${Number(e.bottom)}px ${Number(e.left)}px`}function Ge(e,a,t,n,o){if(a===void 0)return;let r=n?.direction??"vertical",i=r!=="overlay"&&t==="width"==(r==="horizontal"),d=t==="width"?"minWidth":"minHeight";a==="fill"?r==="overlay"?(e.style[t]="100%",e.style[t==="width"?"justifySelf":"alignSelf"]="stretch"):i?(e.style.flex="1 1 0",e.style[d]="0"):(e.style.alignSelf="stretch",e.style[t]="auto"):a==="fit"?(e.style[t]="fit-content",t==="width"&&(e.style.maxWidth="100%"),!i&&r!=="overlay"&&(!n||n.align==="stretch")&&(e.style.alignSelf=o==="center"?"center":o==="end"?"flex-end":"flex-start")):typeof a=="number"&&(e.style[t]=`${a}px`,t==="width"&&(e.style.maxWidth="100%"),i&&(e.style.flex="0 0 auto"))}function ce(e,a,t){let n=a.style,o=n.text??{},r=e.style;if(a.type==="customer_data"&&(o.font&&r.setProperty("--g-data-display-font",z[String(o.font)]??z.system),a.data.source==="membership"&&(typeof o.size=="number"&&r.setProperty("--g-data-display-size",`clamp(${Math.min(o.size,28)}px, ${o.size/12}vw, ${o.size}px)`),typeof o.weight=="number"&&r.setProperty("--g-data-display-weight",String(o.weight)))),a.type==="customer_data"&&a.data.source==="credit_balance"&&(typeof o.size=="number"&&r.setProperty("--g-data-number-size",`clamp(${Math.min(o.size,48)}px, ${o.size/10}vw, ${o.size}px)`),o.font&&r.setProperty("--g-data-number-font",z[String(o.font)]??z.system),typeof o.weight=="number"&&r.setProperty("--g-data-number-weight",String(o.weight))),a.type==="customer_data"&&o.color){let b=ne(o.color);r.setProperty("--g-data-ink",b),r.setProperty("--g-data-muted",`color-mix(in srgb, ${b} 72%, transparent)`),r.setProperty("--g-data-line",`color-mix(in srgb, ${b} 20%, transparent)`),r.setProperty("--g-data-surface",`color-mix(in srgb, ${b} 8%, transparent)`)}n.padding&&(r.padding=Ve(n.padding)),n.margin&&(r.margin=Ve(n.margin)),typeof n.gap=="number"&&a.type==="stack"&&(r.gap=`${n.gap}px`),n.background&&wt(r,n.background),typeof n.opacity=="number"&&(r.opacity=String(n.opacity));let i=n.shape;if(i?.type==="pill")r.borderRadius="9999px";else if(i?.type==="rect"){let b=i.radius;r.borderRadius=typeof b=="number"?`${b}px`:`${Number(b.topLeft)}px ${Number(b.topRight)}px ${Number(b.bottomRight)}px ${Number(b.bottomLeft)}px`}(n.clipContent===!0||n.clipContent!==!1&&i&&(n.background||a.type==="image"))&&(r.overflow="hidden");let d=n.border;d&&(r.border=Number(d.width)>0?`${Number(d.width)}px ${d.style==="dashed"?"dashed":"solid"} ${ne(d.color)}`:"0");let s=n.shadow;s&&(r.boxShadow=`${Number(s.x)}px ${Number(s.y)}px ${Number(s.blur)}px ${Number(s.spread)}px ${ne(s.color)}`),["text","button","price","coupon_code","countdown","plan_picker"].includes(a.type)&&(o.font&&(r.fontFamily=z[String(o.font)]??""),typeof o.size=="number"&&(r.fontSize=`${o.size}px`),typeof o.weight=="number"&&(r.fontWeight=String(o.weight)),typeof o.lineHeight=="number"&&(r.lineHeight=String(o.lineHeight)),typeof o.letterSpacing=="number"&&(r.letterSpacing=`${o.letterSpacing}px`),o.color&&(r.color=ne(o.color)),o.align&&(r.textAlign=String(o.align)),o.italic&&(r.fontStyle="italic"),o.decoration&&(r.textDecoration=String(o.decoration)),o.transform&&(r.textTransform=String(o.transform))),Ge(e,n.width,"width",t,o.align),Ge(e,n.height,"height",t,o.align),t?.direction==="horizontal"&&n.grow!==void 0&&(r.flexGrow=String(n.grow===!0?1:n.grow===!1?0:n.grow))}function ie(){if(!$)return;let e=$.snapshot();q({type:"funnel",state:e}),e.status==="waiting"?Pe():M=void 0,["completed","failed"].includes(e.status)&&(S=!0)}function Pe(e,a){if(!m||!$)return;let t=$.snapshot().nodeId,n=m.funnel?.nodes.find(d=>d.id===t);(!M||M.nodeId!==t)&&(M={nodeId:t}),e!==void 0&&(M.label=e),a!==void 0&&(M.checkoutUrl=a);let o=y.startsWith("zh");We(m),document.documentElement.lang=y,document.documentElement.dir=/^(ar|he|fa|ur)(-|$)/i.test(y)?"rtl":"ltr",F.dataset.gPresentation=m.presentation.type,F.removeAttribute("data-g-page"),F.style.cssText="padding:24px;display:flex;flex-direction:column;gap:16px",F.replaceChildren();let r=document.createElement("h2");r.textContent=n?.type==="purchase"?o?"\u5B8C\u6210\u8D2D\u4E70":"Complete your purchase":n?.type==="auth"?o?"\u767B\u5F55\u4EE5\u7EE7\u7EED":"Sign in to continue":o?"\u8BF7\u7A0D\u5019":"Please wait";let i=document.createElement("p");if(i.setAttribute("role","status"),i.textContent=M.label??(o?"\u7B49\u5F85\u786E\u8BA4\u2026":"Waiting for confirmation\u2026"),F.append(r,i),M.checkoutUrl){let d=document.createElement("a");d.textContent=o?"\u524D\u5F80\u5B89\u5168\u7ED3\u8D26":"Go to secure checkout",d.href=M.checkoutUrl,d.target="_blank",d.rel="noopener noreferrer",d.className="g-btn g-btn-primary",F.append(d)}if(n?.type==="purchase"||n?.type==="auth")for(let d of["confirm","cancel"]){let s=document.createElement("button");s.type="button",s.className="g-btn g-btn-secondary",s.textContent=d==="confirm"?o?"\u7EE7\u7EED\u786E\u8BA4":"Confirm and continue":o?"\u8FD4\u56DE":"Back",s.addEventListener("click",b=>{b.isTrusted&&q({type:"funnel-intent",outcome:d})}),F.append(s)}Q()}function be(e,a){let t=m?.funnel?.questions.find(n=>n.source===e);!t||!$||(C.add(e),$.answer(t.id,a),ie())}function vt(){if(!m?.funnel)return!0;let e=new Set([...F.querySelectorAll("[data-g-node]")].filter(r=>{let i=r.getBoundingClientRect();return i.width>0&&i.height>0}).map(r=>r.dataset.gNode)),a=m.funnel.questions.filter(r=>{if(!e.has(r.source))return!1;let i=$?.snapshot().answers[r.id],d=F.querySelector(`[data-g-node="${r.source}"]`),s=d?.querySelector("input"),b=s&&typeof i=="string"&&i.trim()!==""&&(s.type==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(i))||s.type==="url"&&!/^https?:\/\/[^\s]+$/.test(String(i))),x=Array.isArray(i)&&i.length>0&&i.length<Number(d?.dataset.gMin??0);return b||x||r.required&&(!C.has(r.source)||i===""||typeof i=="string"&&!i.trim()||Array.isArray(i)&&!i.length)}),t=[...e];if(a.sort((r,i)=>t.indexOf(r.source)-t.indexOf(i.source)),F.querySelector("[data-g-validation]")?.remove(),!a.length)return!0;let n=document.createElement("p");return n.dataset.gValidation="",n.setAttribute("role","alert"),n.textContent=y.startsWith("zh")?"\u8BF7\u586B\u5199\u672C\u9875\u5FC5\u586B\u95EE\u9898\u5E76\u68C0\u67E5\u7B54\u6848":"Please complete the required questions and check your answers",n.style.cssText="padding:12px 24px;color:var(--g-text)",F.append(n),F.querySelector(`[data-g-node="${a[0].source}"] [role=radio],[data-g-node="${a[0].source}"] button,[data-g-node="${a[0].source}"] input,[data-g-node="${a[0].source}"] [role=checkbox]`)?.focus(),!1}function Ye(e){return m?e==="next"?_+1:e==="back"?Y.at(-1)??-1:m.pages.findIndex(a=>a.id===e):-1}function Ze(e,a){if(l.mode!=="live"||!m)return;let t=m.actions.find(o=>o.id===a);if(t?.type!=="navigate"||m.funnel?.routes.some(o=>o.action===t.id))return;let n=Ye(t.target);(n<0||n>=m.pages.length)&&(e.disabled=!0)}function kt(e){let a=document.createElement("section");a.className="g-data",a.dataset.layout=e.data.layout,a.dataset.source=e.data.source;let t=j?.nodes[e.id];a.dataset.status=t?.status??"idle",a.dataset.preview=String(!!t?.preview);let n=t?.status==="loading",o=y.startsWith("zh"),r=(p,A)=>o?p:A;a.setAttribute("aria-busy",String(!!n));let i=(p,A,B)=>{let R=document.createElement(p);return R.className=A,B!==void 0&&(R.textContent=B),R},d=p=>{let A=document.createElementNS("http://www.w3.org/2000/svg","svg");A.setAttribute("viewBox","0 0 24 24"),A.setAttribute("fill","none"),A.setAttribute("stroke","currentColor"),A.setAttribute("stroke-width","1.7"),A.setAttribute("stroke-linecap","round"),A.setAttribute("stroke-linejoin","round"),A.setAttribute("aria-hidden","true"),A.classList.add("g-data-icon");let B={refresh:["M20 7v5h-5","M4 17v-5h5","M6.1 7a7 7 0 0 1 11.5-1.5L20 8M4 16l2.4 2.5A7 7 0 0 0 18 17"],down:["M7 7l10 10M7 17h10V7"],up:["M7 17L17 7M7 7h10v10"],chevron:["M6 9l6 6 6-6"],empty:["M4 8l8-4 8 4v10l-8 4-8-4V8Z","M4 8l8 4 8-4M12 12v10"],credit:["M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z","M12 7v10M8 12h8"]};for(let R of B[p]){let O=document.createElementNS("http://www.w3.org/2000/svg","path");O.setAttribute("d",R),A.append(O)}return A},s=(p,A,B,R=!1,O=A)=>{let G=i("button","g-data-button",p);return G.type="button",G.disabled=R||!!n&&A!=="refresh"||!!t?.preview||l.mode!=="live",n&&A==="refresh"&&G.setAttribute("aria-disabled","true"),G.dataset.gDataFocus=`${e.id}:${O}:${B??""}`,G.addEventListener("click",K=>{!K.isTrusted||G.disabled||n||q({type:"customer-data-intent",intent:{nodeId:e.id,action:A,...B?{value:B}:{}}})}),G},b=i("div","g-data-header"),x=i("h2","g-data-heading",V(e.title).value);x.id=`g-data-title-${e.id}`,a.setAttribute("aria-labelledby",x.id);let g=i("div","g-data-controls"),P=[],H=p=>{p.hidden||(p.type==="customer_data"&&P.push(p),p.type==="stack"&&p.children.forEach(H))},tt=m?.pages[_];tt&&H(tt.root);let It=P.every(p=>j?.nodes[p.id]?.preview),Ct=P.find(p=>p.data.source==="credit_balance")??P[0];t?.preview&&(!It||Ct?.id===e.id)&&g.append(i("span","g-data-preview",r("\u793A\u4F8B\u6570\u636E","Sample data")));let Ne=n?r("\u66F4\u65B0\u4E2D\u2026","Updating\u2026"):r("\u5237\u65B0","Refresh"),oe=s(Ne,"refresh");if(oe.replaceChildren(d("refresh")),oe.setAttribute("aria-label",Ne),oe.title=Ne,oe.classList.add("g-data-refresh"),n&&oe.classList.add("g-data-refreshing"),g.append(oe),e.data.source==="credit_balance"&&(x.prepend(d("credit")),t?.resources.length===1&&x.append(i("span","g-data-resource-label",t.resources[0].name)),t?.updatedAt)){let p=i("time","g-data-updated",`${r("\u66F4\u65B0\u4E8E","Updated")} ${new Intl.DateTimeFormat(y,{timeStyle:"short"}).format(new Date(t.updatedAt))}`);p.dateTime=t.updatedAt,p.title=new Intl.DateTimeFormat(y,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t.updatedAt)),g.prepend(p)}if(b.append(x,g),a.append(b),!t||t.source!==e.data.source)return a.append(i("p","g-data-empty",r("\u8FDE\u63A5\u5BA2\u6237\u6570\u636E\u540E\u663E\u793A\u6B64\u5185\u5BB9\u3002","Connect customer data to display this content."))),a;if(t.errorMessage){let p=i("div","g-data-error",t.errorMessage);p.setAttribute("role","alert"),a.append(p);let A=i("div","g-data-recovery");A.append(s(r("\u91CD\u8BD5","Retry"),"refresh")),a.append(A)}if(t.membershipResult){let p=i("p","g-data-note",t.membershipResult);p.setAttribute("role","status"),a.append(p)}if(t.membershipReview){let p=t.membershipReview,A=i("section","g-data-resource");A.dataset.gDataReview="",A.setAttribute("aria-label",p.title),A.setAttribute("aria-busy",String(!!t.membershipBusy));let B=i("h3","g-data-row-label",p.title);B.tabIndex=-1,A.append(B);let R=i("dl","g-data-facts");for(let G of p.facts){let K=i("div","");K.append(i("dt","",G.label),i("dd","",G.value)),R.append(K)}A.append(R,i("p","g-data-note",p.note));let O=i("div","g-data-controls");O.append(s(r("\u8FD4\u56DE","Back"),"membership_dismiss",void 0,!!t.membershipBusy),s(t.membershipBusy?r("\u6B63\u5728\u5904\u7406\u2026","Processing\u2026"):r("\u786E\u8BA4","Confirm"),"membership_confirm",void 0,!!t.membershipBusy)),A.append(O),a.append(A)}if(t.stale&&(t.resources.length||t.rows.length)&&a.append(i("p",n?"g-data-live-status":"g-data-note",n?r("\u6B63\u5728\u66F4\u65B0\u8D26\u6237\u6570\u636E\u3002","Updating account data."):r("\u663E\u793A\u4E0A\u6B21\u8BFB\u53D6\u7684\u7ED3\u679C\uFF0C\u6B63\u5728\u7B49\u5F85\u66F4\u65B0\u3002","Showing the last result while awaiting an update."))),n&&!t.resources.length&&!t.rows.length){let p=i("div","g-data-skeleton");if(p.setAttribute("aria-hidden","true"),e.data.source==="credit_balance")p.append(i("span","g-data-skeleton-line g-data-skeleton-value"),i("span","g-data-skeleton-line g-data-skeleton-meta"));else{let B=Math.min(e.data.pageSize,e.data.layout==="compact"?2:4);for(let R=0;R<B;R++){let O=i("div","g-data-skeleton-row");O.append(i("span","g-data-skeleton-line"),i("span","g-data-skeleton-line")),p.append(O)}}let A=i("p","g-data-live-status",r("\u6B63\u5728\u8BFB\u53D6\u8D26\u6237\u6570\u636E\u2026","Loading account data\u2026"));return A.setAttribute("role","status"),a.append(p,A),a}let at={credit_transactions:[["all","\u5168\u90E8\u8BB0\u5F55","All activity"],["consume","\u6D88\u8D39","Usage"],["reserve","\u9884\u6263","Reserved"],["confirm","\u786E\u8BA4\u6263\u8D39","Confirmed"],["release","\u91CA\u653E","Released"],["refund","\u9000\u56DE","Refund"]],credit_pack_orders:[["all","\u5168\u90E8\u8BA2\u5355","All orders"],["pending","\u7B49\u5F85\u4ED8\u6B3E","Pending"],["paid","\u5DF2\u4ED8\u6B3E","Paid"],["expired","\u5DF2\u8FC7\u671F","Expired"],["refunded","\u5DF2\u9000\u6B3E","Refunded"],["disputed","\u4E89\u8BAE\u4E2D","Disputed"]],offer_history:[["all","\u5168\u90E8\u8BB0\u5F55","All offers"],["issued","\u53EF\u7528","Available"],["redeemed","\u5DF2\u4F7F\u7528","Redeemed"],["expired","\u5DF2\u5230\u671F","Expired"],["revoked","\u5DF2\u64A4\u9500","Revoked"]]};if(at[e.data.source]){let p=i("select","g-data-select");p.setAttribute("aria-label",r("\u7B5B\u9009\u8BB0\u5F55","Filter records")),p.dataset.gDataFocus=`${e.id}:filter`,p.disabled=!!n||t.preview||l.mode!=="live";for(let[A,B,R]of at[e.data.source]){let O=document.createElement("option");O.value=A,O.textContent=r(B,R),p.append(O)}p.value=t.filter,p.addEventListener("change",()=>{!p.disabled&&l.mode==="live"&&q({type:"customer-data-intent",intent:{nodeId:e.id,action:"filter",value:p.value}})}),g.prepend(p)}let rt=(p,A=!1)=>{let B=i("ul","g-data-list");if(e.data.source==="credit_transactions"&&p.length&&!A){let R=i("div","g-data-table-head");R.setAttribute("aria-hidden","true"),R.append(i("span","",r("\u8BB0\u5F55","Record")),i("span","",r("\u7C7B\u578B","Type")),i("span","",r("\u79EF\u5206","Credits"))),a.append(R)}for(let R of p){let O=i("li","g-data-row"),G=i("div","g-data-row-main"),K=i("div","g-data-row-copy");K.append(i("p","g-data-row-label",R.label));for(let J of R.detail)J!==R.status&&K.append(i("div","g-data-row-detail",J));if(e.data.source==="credit_transactions"&&!A){let J=i("span","g-data-row-mark");J.append(d(["Refund","\u9000\u56DE"].includes(R.status??"")?"up":"down")),G.append(J)}if(G.append(K),O.append(G),R.status?O.append(i("div","g-data-row-status",R.status)):O.classList.add("g-data-row-no-status"),R.value?O.append(i("div","g-data-row-value",R.value)):O.classList.add("g-data-row-no-value"),R.facts.length||R.purchaseId||R.membershipActions?.length){let J=i("div","g-data-row-extra"),ee=i("div","g-data-facts"),te=(X,ve)=>{for(let nt of X){let it=i("span","",nt.label);it.append(i("strong","",nt.value)),ve.append(it)}};if(te(R.facts.slice(0,3),ee),R.facts.length>3){let X=i("details","g-data-sources");X.dataset.gDataSources=`facts:${R.id}`,X.append(i("summary","",`${r("\u5168\u90E8\u6263\u8D39\u660E\u7EC6","All allocations")} \xB7 ${R.facts.length}`));let ve=i("div","g-data-facts");te(R.facts.slice(3),ve),X.append(ve),ee.append(X)}if(J.append(ee),R.purchaseId&&e.data.allowPurchase&&!A){let X=s(t.buyingId===R.purchaseId?r("\u6B63\u5728\u51C6\u5907\u2026","Preparing\u2026"):r("\u8D2D\u4E70\u79EF\u5206","Buy credits"),"buy_pack",R.purchaseId,!!t.preview||!!t.buyingId);X.classList.add("g-data-buy"),J.append(X)}if(e.data.allowPurchase&&!A)for(let X of R.membershipActions??[])J.append(s(X.label,"membership_preview",X.value,!!t.preview||!!t.membershipBusy||!!t.membershipReview));O.append(J)}B.append(O)}return B};for(let p of t.resources){let A=i("article","g-data-resource");A.setAttribute("aria-label",p.name),t.resources.length>1&&A.append(i("p","g-data-name",p.name));let B=i("div","g-data-balance"),R=new Intl.NumberFormat(y).formatToParts(1.1).find(J=>J.type==="decimal")?.value??".",O=p.spendable.lastIndexOf(R),G=i("strong","g-data-number",O<0?p.spendable:p.spendable.slice(0,O));O>=0&&G.append(i("span","g-data-fraction",p.spendable.slice(O))),B.append(G,i("span","g-data-unit",r("\u53EF\u7528\u79EF\u5206","Spendable credits"))),A.append(B);let K=i("div","g-data-facts");for(let[J,ee]of[[r("\u4F59\u989D","Balance"),p.available],[r("\u51BB\u7ED3","Reserved"),p.reserved]]){let te=i("span","",J);te.append(i("strong","",ee)),K.append(te)}if(p.expiry&&K.append(i("span","g-data-expiry",`${r("\u6700\u8FD1\u5230\u671F","Next expiry")} \xB7 ${p.expiry}`)),A.append(K),e.data.showSources&&p.sourceCount){let J=i("details","g-data-sources");if(J.dataset.gDataSources=p.key,J.append(i("summary","",`${r("\u79EF\u5206\u6765\u6E90","Credit sources")} \xB7 ${p.sourceCount}`),rt(p.sources,!0)),J.querySelector("summary")?.append(d("chevron")),p.hasNextSources||p.hasPreviousSources){let ee=i("div","g-data-footer");ee.append(i("span","",`${r("\u7B2C","Page")} ${p.sourcePage}`));let te=i("div","g-data-controls");te.append(s(r("\u4E0A\u4E00\u9875","Previous"),"sources_previous",p.key,!p.hasPreviousSources),s(r("\u4E0B\u4E00\u9875","Next"),"sources_next",p.key,!p.hasNextSources)),ee.append(te),J.append(ee)}A.append(J)}a.append(A)}if(t.rows.length&&a.append(rt(t.rows)),!t.rows.length&&!t.resources.length&&t.status!=="error"){let p=i("p","g-data-empty",n?r("\u6B63\u5728\u8BFB\u53D6\u8D26\u6237\u6570\u636E\u2026","Loading account data\u2026"):t.status==="idle"?r("\u767B\u5F55\u540E\u67E5\u770B\u4F60\u7684\u8D26\u6237\u6570\u636E\u3002","Sign in to view your account data."):t.filter!=="all"?r("\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u6761\u4EF6\u7684\u8BB0\u5F55\u3002","No records match this filter."):e.data.source==="credit_pack_orders"?r("\u6682\u65E0\u8D2D\u4E70\u8BB0\u5F55","No purchases yet"):e.data.source==="credit_balance"?r("\u6682\u65E0\u79EF\u5206\u6765\u6E90","No credit balances yet"):e.data.source==="membership"?r("\u6682\u65E0\u4F1A\u5458\u65B9\u6848","No memberships yet"):e.data.source==="customer_plans"?r("\u6682\u65E0\u53EF\u9009\u5957\u9910","No plans available"):e.data.source==="credit_packs"?r("\u6682\u65E0\u53EF\u8D2D\u4E70\u7684\u79EF\u5206\u5305","No credit packs available"):e.data.source==="offer_history"?r("\u6682\u65E0\u4F18\u60E0\u8BB0\u5F55","No offers yet"):r("\u8FD9\u91CC\u8FD8\u6CA1\u6709\u8BB0\u5F55\u3002","There are no records yet."));p.prepend(d("empty")),p.setAttribute("role","status"),a.append(p)}if(t.hasNext||t.hasPrevious){let p=i("div","g-data-footer");p.append(i("span","",`${r("\u7B2C","Page")} ${t.page}`));let A=i("div","g-data-controls");A.append(s(r("\u4E0A\u4E00\u9875","Previous"),"previous",void 0,!t.hasPrevious),s(r("\u4E0B\u4E00\u9875","Next"),"next",void 0,!t.hasNext)),p.append(A),a.append(p)}return t.updatedAt&&e.data.source!=="credit_balance"&&a.append(i("p","g-data-note g-data-updated",`${r("\u6570\u636E\u66F4\u65B0\u4E8E","Updated")} ${new Intl.DateTimeFormat(y,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t.updatedAt))}`)),a}let re=new Map,Le=new Map,Ke=e=>{let a=e.target;for(let t of re.keys())a&&!xe(t)?.contains(a)&&re.delete(t)};document.addEventListener("focusin",Ke),document.addEventListener("pointerdown",Ke);function St(e){let a=j;if(j=e,!m)return;let t=(n,o)=>{if(n.type==="stack"){n.children.forEach(H=>t(H,n));return}if(n.type!=="customer_data"||JSON.stringify(a?.nodes[n.id])===JSON.stringify(e.nodes[n.id]))return;let r=xe(n.id);if(!r)return;let i=document.activeElement;i&&r.contains(i)&&i.dataset.gDataFocus&&re.set(n.id,i.dataset.gDataFocus);let d=new Set([...r.querySelectorAll("details[data-g-data-sources]")].filter(H=>H.open).map(H=>H.dataset.gDataSources)),s=Te(n,o);if(!s)return;for(let H of s.querySelectorAll("details[data-g-data-sources]"))H.open=d.has(H.dataset.gDataSources);let b=r.scrollTop;r.replaceWith(s),s.scrollTop=b;let x=!!e.nodes[n.id]?.membershipReview&&!a?.nodes[n.id]?.membershipReview,g=!e.nodes[n.id]?.membershipReview&&!!a?.nodes[n.id]?.membershipReview;x&&re.get(n.id)&&Le.set(n.id,re.get(n.id));let P=g?Le.get(n.id):re.get(n.id);P&&[...s.querySelectorAll("[data-g-data-focus]")].find(H=>H.dataset.gDataFocus===P)?.focus({preventScroll:!0}),x&&s.querySelector("[data-g-data-review] h3")?.focus({preventScroll:!0}),g&&Le.delete(n.id),s.animate&&e.nodes[n.id]?.status==="ready"&&!window.matchMedia("(prefers-reduced-motion:reduce)").matches&&s.animate([{opacity:.7},{opacity:1}],{duration:140,easing:"ease-out"})};t(m.pages[_]?.root??m.pages[0].root,null),Q()}function Te(e,a){if(e.hidden)return null;let t;if(e.type==="customer_data")t=kt(e);else if(e.type==="stack"){t=document.createElement("div"),t.className=`g-stack ${e.direction==="horizontal"?"g-h":e.direction==="overlay"?"g-o":"g-v"}`,e.direction==="overlay"?(t.style.alignItems=v[e.align]??"stretch",t.style.justifyItems=L[e.justify]??"stretch"):(t.style.alignItems=E[e.align]??"stretch",t.style.justifyContent=I[e.justify]??"flex-start");for(let n of e.children){let o=Te(n,e);o&&t.append(o)}e.interaction&&Et(t,e),l.mode==="editor"&&!t.childElementCount&&(t.classList.add("g-empty"),t.dataset.gEditorPlaceholder=l.editorMessages?.emptyContainer??"\u62D6\u5165\u7EC4\u4EF6")}else if(e.type==="text"){let n=e.variant==="title"?"h1":e.variant==="heading"?"h2":"p";t=document.createElement(n),t.className=`g-text g-${e.variant}`;let o=Ce(e,"text",e.text);t.textContent=o.value,o.missing&&l.mode==="editor"&&t.classList.add("g-missing")}else if(e.type==="button"){t=document.createElement("button"),t.type="button",t.className=`g-btn g-btn-${e.variant}`;let n=Ce(e,"label",e.label);if(t.textContent=n.value,n.missing&&l.mode==="editor"&&t.classList.add("g-missing"),t.dataset.gAction=e.action,Ze(t,e.action),m?.actions.find(o=>o.id===e.action)?.type==="purchase"&&l.mode==="live"&&(t.disabled=ae(e.id)?.unavailable??!0,t.disabled)){t.style.opacity="0.55",t.style.cursor="not-allowed";let o=ae(e.id)?.unavailableReason??(y.startsWith("zh")?"\u6682\u65F6\u6CA1\u6709\u53EF\u8D2D\u4E70\u7684\u5957\u9910\u3002":"No purchasable plan is available.");t.title=o,t.setAttribute("aria-label",`${n.value} \u2014 ${o}`);let r=document.createElement("span");r.style.cssText="display:block;margin-top:4px;font-size:.8em;font-weight:normal",r.textContent=o,t.append(r)}l.mode==="editor"&&(t.tabIndex=-1)}else if(e.type==="image"){t=document.createElement("div"),t.className="g-img",T[e.aspect]&&(t.dataset.aspect=e.aspect,t.style.aspectRatio=T[e.aspect]);let n=document.createElement("img");n.src=e.localizedSrc?.[y]??e.localizedSrc?.[m.strings.defaultLocale]??e.src,n.alt=Ce(e,"alt",e.alt).value,n.referrerPolicy="no-referrer",n.decoding="async",n.style.objectFit=e.fit,e.position&&(n.style.objectPosition=`${e.position.x}% ${e.position.y}%`),n.addEventListener("load",Q),t.append(n)}else if(e.type==="price"){t=document.createElement("div"),t.className="g-price",t.style.cssText="display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;font-variant-numeric:tabular-nums";let n=ae(e.id);if(!n?.price)t.textContent=n?.text??V(e.fallback).value,l.mode==="editor"&&t.classList.add("g-missing");else for(let o of["current","original","period"]){let r=n.price[o];if(!r)continue;let i=document.createElement(o==="original"?"s":"span");i.textContent=r,o==="original"&&(i.style.opacity=".6"),e.parts?.[o]&&ce(i,{type:"text",id:e.id,text:e.fallback,variant:"body",style:e.parts[o]},null),t.append(i)}}else if(e.type==="coupon_code"){t=document.createElement("div"),t.style.cssText="display:flex;align-items:center;gap:12px;flex-wrap:wrap";let n=ae(e.id);if(n?.code){let o=document.createElement("code");o.textContent=n.code;let r=document.createElement("button");r.type="button",r.className="g-btn g-btn-secondary",r.textContent=V(e.label).value,r.addEventListener("click",i=>{l.mode!=="editor"&&(i.stopPropagation(),q({type:"copy",nodeId:e.id}))}),t.append(o,r)}else t.textContent=n?.text??V(e.fallback).value,l.mode==="editor"&&t.classList.add("g-missing")}else if(e.type==="countdown"){t=document.createElement("span"),t.setAttribute("role","timer"),t.style.fontVariantNumeric="tabular-nums";let n=ae(e.id),o=n?.countdownAt?Date.parse(n.countdownAt):NaN;!Number.isFinite(o)&&l.mode==="editor"&&t.classList.add("g-missing");let r=()=>{if(!Number.isFinite(o)){t.textContent=n?.text??V(e.fallback).value;return}let i=Math.max(0,Math.ceil((o-Date.now())/1e3));if(!i){t.textContent=V(e.expired).value;return}let d=e.granularity,s=d==="day"?86400:d==="hour"?3600:d==="minute"?60:1;d!=="second"?t.textContent=new Intl.NumberFormat(y,{style:"unit",unit:d,unitDisplay:"short"}).format(Math.ceil(i/s)):t.textContent=[Math.floor(i/86400),Math.floor(i/3600)%24,Math.floor(i/60)%60,i%60].map(b=>String(b).padStart(2,"0")).join(":")};r(),Number.isFinite(o)&&U.push(setInterval(r,1e3))}else if(e.type==="plan_picker"){t=document.createElement("div"),t.setAttribute("role","radiogroup"),t.setAttribute("aria-label",V(e.label).value),t.style.cssText="display:flex;flex-direction:column;gap:8px";let n=N?.pickers[e.id];if(!n?.options.length)t.textContent=V(e.fallback).value,l.mode==="editor"&&t.classList.add("g-missing");else{let o=typeof h[e.id]=="string"?String(h[e.id]):n.selected;h[e.id]=o??"";let r=i=>{h[e.id]=i,le(),xe(e.id)?.querySelector(`[data-plan-id="${i}"]`)?.focus()};for(let[i,d]of n.options.entries()){let s=N.plans[d];if(!s)continue;let b=document.createElement("button");b.type="button",b.className="g-btn g-btn-secondary",b.style.cssText="width:100%;text-align:start",b.setAttribute("role","radio"),b.setAttribute("aria-checked",String(d===o)),b.tabIndex=l.mode==="editor"?-1:d===o?0:-1,b.dataset.planId=d;let x=N.nodes[e.id]?.byPlan?.[d]?.price;b.textContent=`${s.name} \xB7 ${x?.current??s.price}${x?.period??s.period}`,d===o&&(b.style.borderColor="var(--g-primary)",b.style.boxShadow="inset 0 0 0 1px var(--g-primary)",e.states?.selected&&ce(b,{type:"text",id:e.id,text:e.label,variant:"body",style:e.states.selected},null)),b.addEventListener("click",g=>{l.mode!=="editor"&&(g.stopPropagation(),r(d))}),b.addEventListener("keydown",g=>{if(l.mode==="editor")return;let P;["ArrowRight","ArrowDown"].includes(g.key)?P=(i+1)%n.options.length:["ArrowLeft","ArrowUp"].includes(g.key)?P=(i-1+n.options.length)%n.options.length:g.key==="Home"?P=0:g.key==="End"&&(P=n.options.length-1),P!==void 0&&(g.preventDefault(),r(n.options[P]))}),t.append(b)}}}else if(e.type==="divider")t=document.createElement("hr"),t.className="g-divider";else if(e.type==="spacer")t=document.createElement("div"),t.setAttribute("aria-hidden","true"),t.style.flex="0 0 auto",t.style.width=t.style.height=`${k[e.size]??0}px`;else if(e.type==="custom_html"){t=document.createElement("div"),t.className="g-custom";let n=t.attachShadow({mode:"open"}),o=e.html[y],r=o&&o.trim()?o:e.html[m?.strings.defaultLocale??""]??"",i=ae(e.id);i?.html!==void 0?r=i.html:r.includes("{{")&&l.mode==="live"&&(r=V(e.fallback??"").value.replace(/[&<>"']/g,x=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[x])),(i?.missing?.length||!i&&r.includes("{{"))&&l.mode==="editor"&&t.classList.add("g-missing"),!(o&&o.trim())&&l.mode==="editor"&&t.classList.add("g-missing");let d=document.createElement("style");d.textContent=`:host{display:block}${e.css}`;let s=document.createElement("div");s.innerHTML=r;for(let b of s.querySelectorAll("button[data-grow-action]"))Ze(b,b.getAttribute("data-grow-action"));n.append(d,s);for(let b of s.querySelectorAll("img"))b.addEventListener("load",Q)}else return null;return e.style&&ce(t,e,a),t.dataset.gNode=e.id,t.dataset.gLabel=xt(e),t}function Et(e,a){let t=a.interaction,n=[...e.children];e.setAttribute("aria-label",V(t.label).value);let o=m?.funnel?.questions.find(r=>r.source===a.id);if(o){let r=document.createElement("p");r.className="g-text g-body",r.textContent=V(t.label).value+(o.required?" *":""),e.prepend(r),o.required&&e.setAttribute("aria-required","true")}if(t.type==="input"){let r=document.createElement("input");r.type=t.keyboard,r.maxLength=t.maxLength,r.autocomplete="off",r.setAttribute("aria-label",V(t.label).value),r.setAttribute("aria-required",String(!!o?.required)),r.value=typeof h[a.id]=="string"?String(h[a.id]):"",r.style.cssText="box-sizing:border-box;width:100%;min-height:44px;padding:10px 14px;border:1px solid var(--g-border);border-radius:8px;background:var(--g-surface);color:var(--g-text);font:inherit",r.disabled=l.mode!=="live",r.addEventListener("input",()=>{h[a.id]=r.value,be(a.id,r.value)}),e.append(r);return}if(!(l.mode!=="live"||!n.length&&t.type!=="toggle")){if(t.type==="multiselect"){e.setAttribute("role","group"),e.dataset.gMin=String(t.min);let r=a.children.filter(s=>!s.hidden),i=new Set(Array.isArray(h[a.id])?h[a.id]:[]),d=()=>n.forEach((s,b)=>{let x=i.has(r[b].id);s.setAttribute("aria-checked",String(x)),s.setAttribute("aria-disabled",String(!x&&i.size>=t.max)),s.style.outline=x?"2px solid var(--g-primary)":"",s.style.outlineOffset="-2px"});n.forEach((s,b)=>{s.setAttribute("role","checkbox"),s.tabIndex=0,s.setAttribute("aria-label",s.textContent?.trim()||String(b+1)),s.style.cursor="pointer";let x=()=>{let g=r[b].id;if(i.has(g))i.delete(g);else if(i.size<t.max)i.add(g);else return;let P=r.filter(H=>i.has(H.id)).map(H=>H.id);h[a.id]=P,d(),be(a.id,P)};s.addEventListener("click",g=>{g.stopPropagation(),x()}),s.addEventListener("keydown",g=>{[" ","Enter"].includes(g.key)&&(g.preventDefault(),g.stopPropagation(),x())})}),d();return}if(t.type==="select"){e.setAttribute("role","radiogroup");let r=a.children.filter(s=>!s.hidden),i=r.findIndex(s=>s.id===h[a.id]);i<0&&(i=Math.min(t.defaultIndex,n.length-1));let d=(s,b=!1,x=!0)=>{i=s,h[a.id]=r[s].id,x&&be(a.id,r[s].id),n.forEach((g,P)=>{g.setAttribute("aria-checked",String(P===s)),g.tabIndex=P===s?0:-1,g.style.cssText="";let H=r[P];H.type==="stack"&&(g.style.alignItems=E[H.align]??"stretch",g.style.justifyContent=I[H.justify]??"flex-start"),H.style&&ce(g,H,a),P===s&&(t.selectedStyle&&ce(g,{...H,style:t.selectedStyle},a),t.selectedStyle?.border||(g.style.outline="2px solid var(--g-primary)",g.style.outlineOffset="-2px")),g.style.cursor="pointer"}),b&&n[s].focus()};n.forEach((s,b)=>{s.setAttribute("role","radio"),s.setAttribute("aria-label",s.textContent?.trim()||String(b+1)),s.addEventListener("click",x=>{x.stopPropagation(),d(b)}),s.addEventListener("keydown",x=>{let g=x.key;["ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"," ","Enter"].includes(g)&&(x.preventDefault(),x.stopPropagation(),d(g==="Home"?0:g==="End"?n.length-1:g==="ArrowRight"||g==="ArrowDown"?(i+1)%n.length:g==="ArrowLeft"||g==="ArrowUp"?(i+n.length-1)%n.length:b,!0))})}),d(i,!1,!1)}else if(t.type==="tabs"){let r=a.children.filter(x=>!x.hidden),i=document.createElement("div");i.setAttribute("role","tablist"),i.setAttribute("aria-label",V(t.label).value),i.style.cssText="display:flex;gap:4px;padding:4px;border:1px solid var(--g-border);border-radius:12px";let d=n.map((x,g)=>{let P=document.createElement("button");return P.type="button",P.setAttribute("role","tab"),P.textContent=Me(r[g])||String(g+1),P.style.cssText="flex:1;min-width:0;min-height:44px;padding:8px 16px;border:0;border-radius:8px;font:inherit;cursor:pointer",x.id=`g-${a.id}-${r[g].id}`,x.setAttribute("role","tabpanel"),P.setAttribute("aria-controls",x.id),i.append(P),P}),s=(x,g=!1)=>{h[a.id]=r[x].id,n.forEach((P,H)=>{P.hidden=H!==x,d[H].setAttribute("aria-selected",String(H===x)),d[H].tabIndex=H===x?0:-1,d[H].style.background=H===x?"var(--g-primary)":"transparent",d[H].style.color=H===x?"var(--g-on-primary)":"var(--g-text)"}),g&&d[x].focus(),Q()};d.forEach((x,g)=>{x.addEventListener("click",P=>{P.stopPropagation(),s(g)}),x.addEventListener("keydown",P=>{["ArrowLeft","ArrowRight","Home","End"].includes(P.key)&&(P.preventDefault(),P.stopPropagation(),s(P.key==="Home"?0:P.key==="End"?n.length-1:(g+(P.key==="ArrowRight"?1:n.length-1))%n.length,!0))})}),e.prepend(i);let b=r.findIndex(x=>x.id===h[a.id]);s(b>=0?b:Math.min(t.defaultIndex,n.length-1))}else if(t.type==="toggle"){let r=document.createElement("button");r.type="button",r.setAttribute("role","switch"),r.className="g-btn g-btn-secondary",r.style.cssText="display:flex;align-items:center;justify-content:space-between;gap:16px;color:var(--g-text)";let i=document.createElement("span");i.textContent=V(t.label).value;let d=document.createElement("span");d.setAttribute("aria-hidden","true"),d.style.cssText="position:relative;display:block;flex:none;width:44px;height:24px;border-radius:12px;background:var(--g-border)";let s=document.createElement("span");s.style.cssText="position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0003",d.append(s),r.append(i,d);let b=x=>{h[a.id]=x,r.setAttribute("aria-checked",String(x)),d.style.background=x?"var(--g-primary)":"var(--g-border)",s.style.left=x?"23px":"3px",s.style.background=x?"var(--g-on-primary)":"#FFFFFF",n.forEach((g,P)=>g.hidden=P!==(x?0:1)),Q()};r.addEventListener("click",x=>{x.stopPropagation(),b(!h[a.id]),be(a.id,!!h[a.id])}),e.prepend(r),b(typeof h[a.id]=="boolean"?h[a.id]:t.defaultEnabled)}else{e.setAttribute("role","region"),e.setAttribute("aria-roledescription","carousel");let r=document.createElement("div");r.style.cssText="display:flex;align-items:center;justify-content:center;gap:10px";let i=document.createElement("button"),d=document.createElement("button"),s=document.createElement("span"),b=y.startsWith("zh");i.textContent="\u2190",d.textContent="\u2192",i.setAttribute("aria-label",b?"\u4E0A\u4E00\u6761\u8BC4\u4EF7":"Previous review"),d.setAttribute("aria-label",b?"\u4E0B\u4E00\u6761\u8BC4\u4EF7":"Next review");for(let g of[i,d])g.type="button",g.className="g-btn g-btn-secondary",g.style.color="var(--g-text)";s.setAttribute("aria-live","polite");let x=g=>{f[a.id]=g,n.forEach((P,H)=>P.hidden=H!==g),s.textContent=`${g+1} / ${n.length}`,Q()};i.addEventListener("click",g=>{g.stopPropagation(),x((f[a.id]+n.length-1)%n.length)}),d.addEventListener("click",g=>{g.stopPropagation(),x((f[a.id]+1)%n.length)}),r.append(i,s,d),e.append(r),x(f[a.id]??0)}}}function Me(e){if(e.hidden)return"";if(e.type==="text"&&(e.variant==="title"||e.variant==="heading"))return V(e.text).value;if(e.type==="stack")for(let a of e.children){let t=Me(a);if(t)return t}return""}function le(){if(U.forEach(clearInterval),U=[],!m)return;F.style.cssText="";let e=m.pages[_]??m.pages[0];We(e.theme?{...m,theme:e.theme}:m);let a=y.split("-")[0];document.documentElement.lang=y,document.documentElement.dir=["ar","he","fa","ur"].includes(a)?"rtl":"ltr",F.dataset.gPresentation=m.presentation.type;let t=Te(e.root,null);if(F.replaceChildren(...t?[t]:[]),m.surface==="onboarding"&&!m.funnel&&m.pages.length>1){let o=document.createElement("div");o.dataset.gProgress="",o.setAttribute("role","progressbar"),o.setAttribute("aria-label",m.name),o.setAttribute("aria-valuemin","1"),o.setAttribute("aria-valuemax",String(m.pages.length)),o.setAttribute("aria-valuenow",String(_+1)),o.style.cssText="display:flex;gap:6px;padding-top:20px;width:calc(100% - 48px);max-width:960px;margin-inline:auto";for(let r=0;r<m.pages.length;r++){let i=document.createElement("span");i.style.cssText=`flex:1;height:3px;border-radius:3px;background:${r<=_?"var(--g-primary)":"var(--g-border)"}`,o.append(i)}F.prepend(o)}F.dataset.gPage=e.id,l.mode==="live"&&q({type:"page",pageId:e.id}),De(),Re();let n=Math.ceil(F.getBoundingClientRect().height);qe?Q():(qe=!0,Ee=n,q({type:"rendered",height:n,label:Me(e.root)||m.name}))}function Q(){let e=Math.ceil(F.getBoundingClientRect().height);e!==Ee&&(Ee=e,q({type:"resize",height:e})),De(),Re()}function Re(){if(l.mode!=="editor")return;let e=[];for(let t of F.querySelectorAll("[data-g-node]")){let n=t.getBoundingClientRect();!n.width||!n.height||e.push({id:t.dataset.gNode,x:n.x,y:n.y,width:n.width,height:n.height})}let a=JSON.stringify(e);a!==Be&&(Be=a,q({type:"layout",nodes:e}))}function xe(e){return!e||!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(e)?null:F.querySelector(`[data-g-node="${e}"]`)}function Xe(e,a){let t=xe(a);if(!t){e.style.display="none";return}let n=t.getBoundingClientRect();e.style.display="block",e.style.left=`${n.left+window.scrollX}px`,e.style.top=`${n.top+window.scrollY}px`,e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,e.toggleAttribute("data-below",n.top<20),e.firstChild.textContent=t.dataset.gLabel??""}function De(){l.mode==="editor"&&(Xe(de,Ae),Xe(he,me&&me!==Ae?me:null))}function we(e){for(let a of e.composedPath()){if(a instanceof HTMLElement&&a.dataset.gNode)return a.dataset.gNode;if(a===F)break}return null}function At(e){if(!(!e.isTrusted||S)){if(l.mode==="editor"){e.preventDefault(),e.stopPropagation(),q({type:"select",id:we(e)});return}for(let a of e.composedPath()){if(!(a instanceof HTMLElement))continue;let t=a.dataset.gAction??(a.tagName==="BUTTON"?a.getAttribute("data-grow-action"):null);if(t&&!a.disabled){e.preventDefault();let n=m?.actions.find(o=>o.id===t);if(n?.type==="navigate"&&m){let o=m.funnel?.routes.find(d=>d.action===t);if((n.target!=="back"||o)&&!vt())return;let r=Ye(n.target);if($){let d;if(o?.target==="back"||n.target==="back"&&!o)d=$.back();else{let s=o?.target??m.pages[r]?.id;if(!s)return;d=$.move(s)}if(r=m.pages.findIndex(s=>s.id===d.pageId),d.status!=="running"){q({type:"action",actionId:t,selection:Je()}),ie(),d.status==="failed"&&q({type:"error",message:d.error??"Funnel failed"});return}}if(r<0||r>=m.pages.length)return;n.target==="back"&&!o?Y.pop():r!==_&&Y.push(_),_=r,le(),ie(),F.animate&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches&&F.animate([{opacity:0,transform:"translateY(6px)"},{opacity:1,transform:"translateY(0)"}],{duration:160,easing:"ease-out"}),window.scrollTo?.(0,0);let i=F.querySelector("h1,h2,h3,button");i&&(i.tabIndex=-1,i.focus())}q({type:"action",actionId:t,nodeId:we(e)??void 0,...Object.keys(h).length?{selection:Je()}:{}});return}if(a===F)return}}}function Qe(e){let a=e;if(!(!a||a.channel!==l.channel))try{if(a.type==="render"){if(m=a.doc,y=String(a.locale),M=void 0,_=Math.max(0,m.pages.findIndex(t=>t.id===a.startPageId)),Y=[],S=!1,C=new Set,Z=a.parameters??{},$=m.funnel&&l.mode==="live"&&u?u(m.funnel,m.pages.map(t=>t.id),Z):null,$){let t=a.resume?$.restore(a.resume):$.start(typeof a.startPageId=="string"?a.startPageId:void 0);if(_=Math.max(0,m.pages.findIndex(n=>n.id===t.pageId)),t.status!=="running"){q({type:"rendered",height:1,label:m.name}),ie(),t.status==="failed"&&q({type:"error",message:t.error??"Funnel failed"});return}}h=Object.create(null),N=a.capabilities,j=a.customerData,re.clear();for(let[t,n]of Object.entries(N?.pickers??{}))n.selected&&(h[t]=n.selected);if($&&a.resume){let t=$.snapshot();Y=t.history.map(n=>m.pages.findIndex(o=>o.id===n));for(let n of m.funnel.questions)Object.hasOwn(t.answers,n.id)&&(h[n.source]=t.answers[n.id],C.add(n.source))}f=Object.create(null),y=String(a.locale),le(),ie()}else if(a.type==="capabilities"){N=a.capabilities;for(let[t,n]of Object.entries(N.pickers))n.options.includes(String(h[t]))||(h[t]=n.selected??"");if($?.snapshot().status==="waiting")Pe();else{let t=document.activeElement,n=t?.closest("[data-g-node]")?.dataset.gNode,o=t instanceof HTMLInputElement?{start:t.selectionStart,end:t.selectionEnd}:void 0,r=t?.getAttribute("role"),i=t?.getAttribute("data-plan-id");if(le(),n){let d=F.querySelector(`[data-g-node="${n}"]`),s=r==="radio"&&i?d?.querySelector(`[data-plan-id="${i}"]`):d?.matches("button,[tabindex],a")?d:d?.querySelector("input,button,[tabindex],a");s?.focus({preventScroll:!0}),o&&s instanceof HTMLInputElement&&s.type==="text"&&s.setSelectionRange(o.start,o.end)}}}else if(a.type==="customer-data")St(a.data);else if(a.type==="restore-action-focus"&&l.mode==="live")[...F.querySelectorAll("button[data-g-node]")].find(t=>t.dataset.gNode===a.nodeId&&!t.disabled)?.focus({preventScroll:!0});else if(a.type==="funnel-result"&&$&&$.snapshot().status==="waiting")if(typeof a.target=="string"){let t=$.resolve(a.target);S=!1,t.status==="running"&&(_=m.pages.findIndex(n=>n.id===t.pageId),le()),ie()}else Pe(typeof a.label=="string"?a.label:void 0,typeof a.checkoutUrl=="string"&&/^https:\/\//.test(a.checkoutUrl)?a.checkoutUrl:void 0);else a.type==="highlight"&&l.mode==="editor"&&(me=a.hoverId??null,Ae=a.selectedId??null,De())}catch(t){q({type:"error",message:t instanceof Error?t.message:"render failed"})}}let et=document.createElement("style");et.textContent=D,document.head.append(et),document.body.append(F),l.mode==="editor"&&(document.body.dataset.gEditor="",document.body.append(he,de),document.addEventListener("mouseover",e=>{let a=we(e);a!==fe&&(fe=a,q({type:"hover",id:a}))}),document.documentElement.addEventListener("mouseleave",()=>{fe!==null&&(fe=null,q({type:"hover",id:null}))}),document.addEventListener("dblclick",e=>{let a=we(e);a&&e.isTrusted&&q({type:"edit",id:a})}),document.addEventListener("click",e=>{F.contains(e.target)||q({type:"select",id:null})})),F.addEventListener("click",At),document.addEventListener("keydown",e=>{e.key==="Escape"&&e.isTrusted&&q({type:"escape"})}),typeof ResizeObserver=="function"&&new ResizeObserver(Q).observe(F),window.addEventListener("resize",Q),l.mode==="editor"&&window.addEventListener("scroll",Re),window.addEventListener("message",e=>{e.source===window.parent&&Qe(e.data)}),w.__growReceive=Qe,q({type:"ready"})}function ft(l,u){let w=`(${mt.toString()})(${JSON.stringify(l).replace(/</g,"\\u003c")}, (${He.toString()}))`;return`<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-${u}'; style-src 'unsafe-inline'; img-src https: data:; connect-src 'none'; font-src 'none'; media-src 'none'; frame-src 'none'; base-uri 'none'; form-action 'none'"></head><body><script nonce="${u}">${w}<\/script></body></html>`}function _t(){return`(() => {
|
|
129
170
|
try {
|
|
130
171
|
const input = JSON.parse(decodeURIComponent(location.hash.slice(1)));
|
|
131
172
|
if (!input || !/^[a-f0-9-]{36}$/.test(input.channel) || input.mode !== "live") return;
|
|
132
173
|
const origin = new URL(input.parentOrigin);
|
|
133
174
|
if (!["https:", "http:"].includes(origin.protocol) || origin.origin !== input.parentOrigin) return;
|
|
134
175
|
const boot = { channel: input.channel, parentOrigin: origin.origin, mode: "live" };
|
|
135
|
-
(${
|
|
176
|
+
(${mt.toString()})(boot, (${He.toString()}));
|
|
136
177
|
} catch { /* No valid host bridge: leave the public shell empty. */ }
|
|
137
|
-
})();`}var ze=new WeakMap;function At(){return typeof navigator>"u"?[]:[...navigator.languages??[],navigator.language].filter(Boolean)}function ct(l,s,h,x){let d=crypto.randomUUID(),R=crypto.randomUUID().replaceAll("-",""),E=document.createElement("iframe");E.title=s,E.setAttribute("sandbox","allow-scripts"),E.referrerPolicy="no-referrer";let P={channel:d,parentOrigin:location.origin,mode:l,...l==="editor"?{editorMessages:h}:{}};if(x){if(l!=="live")throw new Error("Hosted Web Views only support live rendering");let I=new URL(x);if(I.username||I.password||I.search||I.hash||!/^\/web-view\/renderer\/[a-f0-9]{64}$/.test(I.pathname)||I.protocol!=="https:"&&!(I.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(I.hostname)))throw new Error("Invalid hosted renderer URL");I.hash=encodeURIComponent(JSON.stringify(P)),E.src=I.href}else E.srcdoc=dt(P,R);return{frame:E,post:I=>E.contentWindow?.postMessage({...I,channel:d},"*"),accept:I=>I.source===E.contentWindow&&I.origin==="null"&&I.data&&I.data.channel===d?I.data:null}}async function qt(l,s,h={}){let x=d=>{try{Promise.resolve(h.onError?.(d)).catch(()=>{})}catch{}};try{let d=await l.getPopup(s,{requestId:h.requestId,locale:h.locale,currency:h.currency});if(!d)return null;let R=new Set,E=new Map,P=Tt(d.popup,{rendererUrl:l.webViewUrl,onError:x,capabilities:d.capabilities,locale:d.locale,onFunnelState:h.onFunnelState,onEvent:b=>{let S={eventId:crypto.randomUUID(),deliveryId:d.id},I=b.type==="action"?{...S,type:"action",actionId:b.actionId}:b.type==="closed"?{...S,type:"closed",reason:b.reason}:{...S,type:"shown",locale:d.locale};Promise.resolve().then(()=>l.trackPopup(I)).catch(x);let D=c=>{try{Promise.resolve(h.onEvent?.(c)).catch(x)}catch(k){x(k)}};if(D(b),b.type==="action"){let c=d.popup.actions.find(k=>k.id===b.actionId);if(c?.type==="purchase"){if(!b.nodeId)return;let k=`${c.id}:${b.nodeId}:${JSON.stringify(b.selection??{})}`;if(R.has(k))return;R.add(k),D({type:"purchase",actionId:c.id,status:"started"}),(async()=>{try{if(!l.purchaseSurface)throw new Error("Surface checkout client unavailable.");if(c.channel!=="web")throw new Error("Native purchases are not configured.");let C=De(d.capabilities,b.nodeId,b.selection),L=E.get(k);L||(L=crypto.randomUUID(),E.set(k,L));let $=await l.purchaseSurface({deliveryId:d.id,actionId:c.id,nodeId:b.nodeId,planId:C?.planId,currency:C?.currency,requestId:L});if(!$.url){if(!$.trial||$.trial.status!=="active")throw new Error("Trial did not activate.");if(D({type:"purchase",actionId:c.id,status:"trial_started"}),l.refreshSurface)try{let W=await l.refreshSurface({deliveryId:d.id,locale:d.locale,currency:C?.currency});d.capabilities=W,P.updateCapabilities(W)}catch(W){x(W)}return}D({type:"purchase",actionId:c.id,status:"checkout",url:$.url}),h.onCheckout?await h.onCheckout($.url):location.assign($.url)}catch(C){x(C),D({type:"purchase",actionId:c.id,status:"error",message:C instanceof Error?C.message:"Checkout failed"})}finally{R.delete(k)}})()}c?.type==="claim_offer"&&l.claimOffer({deliveryId:d.id,actionId:c.id,couponId:c.couponId}).then(async({offer:k,reason:C})=>{if(k&&l.refreshSurface)try{let L=await l.refreshSurface({deliveryId:d.id,locale:d.locale,currency:h.currency});d.capabilities=L,P.updateCapabilities(L)}catch(L){x(L)}D({type:"offer",actionId:c.id,offer:k,reason:C})},k=>{x(k),D({type:"offer",actionId:c.id,offer:null,reason:"error"})})}}});return P}catch(d){return x(d),null}}function Tt(l,s={}){let h=Se(l,window);s.capabilities=ve(s.capabilities,h,window);let x=nt(h,[s.locale,...At()]),d=ot(h,x);if(ze.has(document))throw new Error("\u5DF2\u6709\u5F39\u7A97\u6B63\u5728\u5C55\u793A\uFF0C\u8BF7\u5148\u5173\u95ED\u3002");if(!document.body||!["https:","http:"].includes(location.protocol))throw new Error("\u5F39\u7A97\u9700\u8981 HTTP(S) \u9875\u9762\u3002");let R=document.activeElement,E=document.createElement("div");E.dataset.growPopup="";let P=E.attachShadow({mode:"open"}),b=document.createElement("style");b.textContent=":host{all:initial;position:fixed!important;inset:0!important;z-index:2147483647!important;font-family:system-ui,sans-serif;pointer-events:none} dialog{pointer-events:auto;box-sizing:border-box;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);padding:0;border:0;border-radius:14px;background:white;box-shadow:0 24px 80px #0003;overflow:hidden}dialog::backdrop{background:#16142577}button{position:absolute;z-index:1;inset-inline-end:8px;top:8px;width:30px;height:30px;border:1px solid #e5e5eb;border-radius:50%;background:#fff;color:#383344;font-size:20px;line-height:1;cursor:pointer}button:focus-visible{outline:3px solid #635bdf}iframe{display:block;border:0;width:100%;height:100%}";let S=document.createElement("dialog");S.setAttribute("aria-label",d.name),S.dataset.presentation=d.presentation.type,S.style.width=d.presentation.type==="fullscreen"?"100vw":`${at[d.presentation.size]}px`,d.presentation.type==="fullscreen"?S.style.cssText+=";max-width:100vw;max-height:100dvh;height:100dvh;margin:0;border-radius:0":d.presentation.type==="sheet"&&(S.style.cssText+=";margin:auto auto 0;max-width:100vw;max-height:100dvh;border-radius:14px 14px 0 0"),S.style.background=d.theme.background;let I=document.createElement("button");I.type="button",I.textContent="\xD7",I.setAttribute("aria-label","\u5173\u95ED\u5F39\u7A97");let{frame:D,post:c,accept:k}=ct("live",d.name,void 0,s.rendererUrl),C=!1,L=!1,$=y=>{d.presentation.type!=="fullscreen"&&(S.style.height=`min(${Math.max(y,40)}px, calc(100dvh - ${d.presentation.type==="sheet"?0:32}px))`)};function W(y){try{Promise.resolve(s.onEvent?.(y)).catch(()=>{})}catch{}}function G(y){C||(C=!0,clearTimeout(z),window.removeEventListener("message",_),S.close(),E.remove(),ze.delete(document),R instanceof HTMLElement&&R.isConnected&&R.focus({preventScroll:!0}),W({type:"closed",reason:y}))}function _(y){let T=C?null:k(y);if(T){if(T.type==="ready")c({type:"render",doc:d,locale:x,capabilities:s.capabilities,...s.resume?{resume:ue(d,s.resume)??void 0}:{}});else if(T.type==="rendered"&&!L)L=!0,clearTimeout(z),$(T.height),T.label&&S.setAttribute("aria-label",T.label),S.showModal(),I.focus(),W({type:"shown"});else if(T.type==="resize"&&L)$(T.height);else if(T.type==="funnel"&&L){let H=ue(d,T.state);H&&(q(s.onFunnelState,H),H.status==="completed"&&G("action"))}else if(T.type==="copy"&&L){let H=ie(d,T.nodeId),Y=De(s.capabilities,T.nodeId);H?.type==="coupon_code"&&Y?.code&&navigator.clipboard?.writeText(Y.code).catch(()=>{})}else if(T.type==="escape"&&L)G("escape");else if(T.type==="action"&&L&&typeof T.actionId=="string"){let H=d.actions.find(Y=>Y.id===T.actionId);if(!H)return;W({type:"action",actionId:H.id,...H.type==="purchase"?{nodeId:T.nodeId}:{},name:H.event,properties:{...H.properties},...T.selection?{selection:$e(d,T.selection,s.capabilities)}:{}}),H.type==="open_url"&&window.open(H.url,"_blank","noopener,noreferrer"),H.close&&G("action")}}}let z=setTimeout(()=>{q(s.onError,new Error("Web View renderer did not start")),G("timeout")},5e3),m={destroy:()=>G("destroy"),updateCapabilities:y=>{let T=ve(y,d,window);s.capabilities=T,c({type:"capabilities",capabilities:T})}};return I.addEventListener("click",()=>G("close_button")),S.addEventListener("cancel",y=>{y.preventDefault(),G("escape")}),S.append(I,D),P.append(b,S),window.addEventListener("message",_),ze.set(document,m),document.body.append(E),m}function Dt(l,s={}){let h=s.mode??"editor",{frame:x,post:d,accept:R}=ct(h,s.title??"\u5F39\u7A97\u9884\u89C8",s.editorMessages,s.rendererUrl);x.style.cssText="display:block;border:0;width:100%;height:0";let E=!1,P=null,b=null,S=!1,I,D,c=new Promise((z,m)=>{I=z,D=m});c.catch(()=>{});let k=setTimeout(()=>{if(S||E)return;let z=new Error("Web View renderer did not start");D(z),q(s.onError,z.message),C()},5e3);function C(){S||(S=!0,clearTimeout(k),E||D(new Error("Web View mount cancelled")),window.removeEventListener("message",_),x.remove())}let L=null,$="modal",W=new Set,G=z=>{let m=s.viewportHeight,y=m?$==="fullscreen"?m:Math.min(z,m-($==="sheet"?0:32)):z;x.style.height=`${y}px`,q(s.onResize,y)};function _(z){let m=S?null:R(z);if(m)if(m.type==="ready")E=!0,clearTimeout(k),I(),P&&d(P),b&&d(b);else if(m.type==="rendered"||m.type==="resize")G(m.height);else if(m.type==="layout"&&h==="editor")Array.isArray(m.nodes)&&m.nodes.length<=pe.nodes&&m.nodes.every(y=>y&&typeof y.id=="string"&&/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(y.id)&&[y.x,y.y,y.width,y.height].every(T=>typeof T=="number"&&Number.isFinite(T))&&y.width>0&&y.height>0)&&q(s.onLayout,m.nodes);else if(m.type==="page"&&h==="live"&&W.has(m.pageId))q(s.onPageChange,m.pageId);else if(m.type==="funnel-intent"&&h==="live"&&["confirm","cancel"].includes(m.outcome))q(s.onFunnelIntent,m.outcome);else if(m.type==="funnel"&&h==="live"&&L){let y=ue(L,m.state);y&&q(s.onFunnelState,y)}else if(m.type==="escape"&&h==="live")q(s.onEscape);else if(m.type==="hover")q(s.onHover,m.id);else if(m.type==="select")q(s.onSelect,m.id);else if(m.type==="edit")q(s.onEdit,m.id);else if(m.type==="customer-data-intent"&&h==="live"&&L){let y=tt.safeParse(m.intent);y.success&&ie(L,y.data.nodeId)?.type==="customer_data"&&q(s.onCustomerDataIntent,y.data)}else m.type==="action"&&L?.actions.some(y=>y.id===m.actionId)?q(s.onAction,m.actionId,$e(L,m.selection,P?.type==="render"?P.capabilities:void 0)):m.type==="error"&&q(s.onError,m.message)}return window.addEventListener("message",_),l.append(x),{ready:c,updateCustomerData(z){if(S||!L)return;let m=Me.parse(z),y={nodes:Object.fromEntries(Object.entries(m.nodes).filter(([T,H])=>{let Y=ie(L,T);return Y?.type==="customer_data"&&Y.data.source===H.source}))};P?.type==="render"&&(P.customerData=y),E&&d({type:"customer-data",data:y})},resolveFunnel(z){S||d({type:"funnel-result",...z})},update(z,m,y){let T;try{let H=Se(z,window);L=H,$=H.presentation.type,W=new Set(H.pages.map(Y=>Y.id)),T={type:"render",doc:H,locale:m,startPageId:y?.startPageId,capabilities:ve(y?.capabilities,H,window),customerData:y?.customerData?Me.parse(y.customerData):void 0,...y?.resume?{resume:ue(H,y.resume)??void 0}:{}},$==="fullscreen"&&s.viewportHeight&&G(s.viewportHeight)}catch(H){q(s.onError,H instanceof Error?H.message:"\u5185\u5BB9\u4E0D\u6B63\u786E");return}P=T,E&&d(T)},highlight(z,m){b={type:"highlight",hoverId:z,selectedId:m},E&&d(b)},destroy:C}}async function Wt(l,s){if(s.signal?.aborted)throw new Error("Page mount cancelled");let h=await s.client.getPage({pageId:s.pageId,locale:s.locale});if(s.signal?.aborted)throw new Error("Page mount cancelled");let x=null,d=Dt(l,{mode:"live",rendererUrl:s.client.webViewUrl,title:h.document.name,onCustomerDataIntent:P=>{x?.intent(P).catch(b=>q(s.onError,b))},onAction:P=>{let b=h.document.actions.find(S=>S.id===P);if(b&&(b.type==="open_url"&&window.open(b.url,"_blank","noopener,noreferrer"),s.onAction))try{Promise.resolve(s.onAction(b)).catch(S=>q(s.onError,S))}catch(S){q(s.onError,S)}},onError:P=>q(s.onError,new Error(P))}),R=()=>d.destroy();s.signal?.addEventListener("abort",R,{once:!0});try{d.update(h.document,h.locale,{capabilities:h.capabilities}),x=He(h.document,s.client,{locale:h.locale,onData:P=>d.updateCustomerData(P),onCheckout:s.onCheckout,onError:s.onError}),await d.ready}catch(P){throw x?.destroy(),d.destroy(),P}finally{s.signal?.removeEventListener("abort",R)}let E={versionId:h.versionId,refresh:()=>x.refresh(),snapshot:()=>x.snapshot(),destroy(){x?.destroy(),d.destroy(),s.signal?.removeEventListener("abort",E.destroy)}};return s.signal?.addEventListener("abort",E.destroy,{once:!0}),E}export{He as createCustomerPageController,vt as formatCustomerDecimal,Lt as hostedRendererScript,It as inspectCustomHtml,Wt as mountCustomerPage,Dt as mountScreenPreview,Se as prepareScreen,Pt as sanitizeCustomHtml,Tt as showPopup,qt as showRemotePopup};
|
|
178
|
+
})();`}var Ue=new WeakMap,ht=new WeakMap;function $t(){return typeof navigator>"u"?[]:[...navigator.languages??[],navigator.language].filter(Boolean)}function yt(l,u,w,k){let c=crypto.randomUUID(),z=crypto.randomUUID().replaceAll("-",""),E=document.createElement("iframe");E.title=u,E.setAttribute("sandbox","allow-scripts"),E.referrerPolicy="no-referrer";let I={channel:c,parentOrigin:location.origin,mode:l,...l==="editor"?{editorMessages:w}:{}};if(k){if(l!=="live")throw new Error("Hosted Web Views only support live rendering");let T=new URL(k);if(T.username||T.password||T.search||T.hash||!/^\/web-view\/renderer\/[a-f0-9]{64}$/.test(T.pathname)||T.protocol!=="https:"&&!(T.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(T.hostname)))throw new Error("Invalid hosted renderer URL");T.hash=encodeURIComponent(JSON.stringify(I)),E.src=T.href}else E.srcdoc=ft(I,z);return{frame:E,post:T=>E.contentWindow?.postMessage({...T,channel:c},"*"),accept:T=>T.source===E.contentWindow&&T.origin==="null"&&T.data&&T.data.channel===c?T.data:null}}async function Kt(l,u,w={}){let k=c=>{try{Promise.resolve(w.onError?.(c)).catch(()=>{})}catch{}};try{let c=await l.getPopup(u,{requestId:w.requestId,locale:w.locale,currency:w.currency});if(!c)return null;let z=new Set,E=new Map,I=new AbortController,L=l.subscribeIdentity?.(()=>I.abort()),v=zt(c.popup,{rendererUrl:l.webViewUrl,onError:k,capabilities:c.capabilities,locale:c.locale,onFunnelState:w.onFunnelState,onEvent:D=>{let m={eventId:crypto.randomUUID(),deliveryId:c.id},$=D.type==="action"?{...m,type:"action",actionId:D.actionId}:D.type==="closed"?{...m,type:"closed",reason:D.reason}:{...m,type:"shown",locale:c.locale};Promise.resolve().then(()=>l.trackPopup($)).catch(k);let C=S=>{try{Promise.resolve(w.onEvent?.(S)).catch(k)}catch(N){k(N)}};if(D.type==="closed"&&(I.abort(),L?.()),C(D),D.type==="action"){let S=c.popup.actions.find(N=>N.id===D.actionId);if(S?.type==="purchase"){if(!D.nodeId)return;let N=`${S.id}:${D.nodeId}:${JSON.stringify(D.selection??{})}`;if(z.has(N))return;z.add(N),C({type:"purchase",actionId:S.id,status:"started"}),(async()=>{try{if(!l.purchaseSurface)throw new Error("Surface checkout client unavailable.");if(S.channel!=="web")throw new Error("Native purchases are not configured.");let j=_e(c.capabilities,D.nodeId,D.selection),U=E.get(N);U||(U=crypto.randomUUID(),E.set(N,U));let Z={deliveryId:c.id,actionId:S.id,nodeId:D.nodeId,planId:j?.planId,currency:j?.currency,requestId:U},h=await l.purchaseSurface(Z);if(h.membershipPreview){if(!h.reviewKey)throw new Error("Membership review unavailable.");let f=await pt(h.membershipPreview,c.locale,I.signal);if(ht.get(v)?.(D.nodeId),!f||I.signal.aborted)return;if(h=await l.purchaseSurface({...Z,reviewKey:h.reviewKey}),h.membershipPreview)throw new Error("Membership confirmation required.")}if(!h.url){if(h.membership){if(C({type:"purchase",actionId:S.id,status:h.membership.status==="scheduled"?"membership_scheduled":h.membership.status==="payment_pending"?"payment_pending":"membership_updated"}),l.refreshSurface){let f=await l.refreshSurface({deliveryId:c.id,locale:c.locale,currency:j?.currency});c.capabilities=f,v.updateCapabilities(f)}return}if(!h.trial||h.trial.status!=="active")throw new Error("Trial did not activate.");if(C({type:"purchase",actionId:S.id,status:"trial_started"}),l.refreshSurface)try{let f=await l.refreshSurface({deliveryId:c.id,locale:c.locale,currency:j?.currency});c.capabilities=f,v.updateCapabilities(f)}catch(f){k(f)}return}C({type:"purchase",actionId:S.id,status:"checkout",url:h.url}),w.onCheckout?await w.onCheckout(h.url):location.assign(h.url)}catch(j){k(j),C({type:"purchase",actionId:S.id,status:"error",message:j instanceof Error?j.message:"Checkout failed"})}finally{z.delete(N)}})()}S?.type==="claim_offer"&&l.claimOffer({deliveryId:c.id,actionId:S.id,couponId:S.couponId}).then(async({offer:N,reason:j})=>{if(N&&l.refreshSurface)try{let U=await l.refreshSurface({deliveryId:c.id,locale:c.locale,currency:w.currency});c.capabilities=U,v.updateCapabilities(U)}catch(U){k(U)}C({type:"offer",actionId:S.id,offer:N,reason:j})},N=>{k(N),C({type:"offer",actionId:S.id,offer:null,reason:"error"})})}}}),T=v.destroy;return v.destroy=()=>{I.abort(),L?.(),T()},v}catch(c){return k(c),null}}function zt(l,u={}){let w=Se(l,window);u.capabilities=ge(u.capabilities,w,window);let k=ct(w,[u.locale,...$t()]),c=lt(w,k);if(Ue.has(document))throw new Error("\u5DF2\u6709\u5F39\u7A97\u6B63\u5728\u5C55\u793A\uFF0C\u8BF7\u5148\u5173\u95ED\u3002");if(!document.body||!["https:","http:"].includes(location.protocol))throw new Error("\u5F39\u7A97\u9700\u8981 HTTP(S) \u9875\u9762\u3002");let z=document.activeElement,E=document.createElement("div");E.dataset.growPopup="";let I=E.attachShadow({mode:"open"}),L=document.createElement("style");L.textContent=":host{all:initial;position:fixed!important;inset:0!important;z-index:2147483647!important;font-family:system-ui,sans-serif;pointer-events:none} dialog{pointer-events:auto;box-sizing:border-box;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);padding:0;border:0;border-radius:14px;background:white;box-shadow:0 24px 80px #0003;overflow:hidden}dialog::backdrop{background:#16142577}button{position:absolute;z-index:1;inset-inline-end:8px;top:8px;width:30px;height:30px;border:1px solid #e5e5eb;border-radius:50%;background:#fff;color:#383344;font-size:20px;line-height:1;cursor:pointer}button:focus-visible{outline:3px solid #635bdf}iframe{display:block;border:0;width:100%;height:100%}";let v=document.createElement("dialog");v.setAttribute("aria-label",c.name),v.dataset.presentation=c.presentation.type,v.style.width=c.presentation.type==="fullscreen"?"100vw":`${st[c.presentation.size]}px`,c.presentation.type==="fullscreen"?v.style.cssText+=";max-width:100vw;max-height:100dvh;height:100dvh;margin:0;border-radius:0":c.presentation.type==="sheet"&&(v.style.cssText+=";margin:auto auto 0;max-width:100vw;max-height:100dvh;border-radius:14px 14px 0 0"),v.style.background=c.theme.background;let T=document.createElement("button");T.type="button",T.textContent="\xD7",T.setAttribute("aria-label","\u5173\u95ED\u5F39\u7A97");let{frame:D,post:m,accept:$}=yt("live",c.name,void 0,u.rendererUrl),C=!1,S=!1,N=y=>{c.presentation.type!=="fullscreen"&&(v.style.height=`min(${Math.max(y,40)}px, calc(100dvh - ${c.presentation.type==="sheet"?0:32}px))`)};function j(y){try{Promise.resolve(u.onEvent?.(y)).catch(()=>{})}catch{}}function U(y){C||(C=!0,clearTimeout(h),window.removeEventListener("message",Z),v.close(),E.remove(),Ue.delete(document),z instanceof HTMLElement&&z.isConnected&&z.focus({preventScroll:!0}),j({type:"closed",reason:y}))}function Z(y){let M=C?null:$(y);if(M){if(M.type==="ready")m({type:"render",doc:c,locale:k,capabilities:u.capabilities,...u.resume?{resume:ue(c,u.resume)??void 0}:{}});else if(M.type==="rendered"&&!S)S=!0,clearTimeout(h),N(M.height),M.label&&v.setAttribute("aria-label",M.label),v.showModal(),T.focus(),j({type:"shown"});else if(M.type==="resize"&&S)N(M.height);else if(M.type==="funnel"&&S){let _=ue(c,M.state);_&&(W(u.onFunnelState,_),_.status==="completed"&&U("action"))}else if(M.type==="copy"&&S){let _=se(c,M.nodeId),Y=_e(u.capabilities,M.nodeId);_?.type==="coupon_code"&&Y?.code&&navigator.clipboard?.writeText(Y.code).catch(()=>{})}else if(M.type==="escape"&&S)U("escape");else if(M.type==="action"&&S&&typeof M.actionId=="string"){let _=c.actions.find(Y=>Y.id===M.actionId);if(!_)return;j({type:"action",actionId:_.id,..._.type==="purchase"?{nodeId:M.nodeId}:{},name:_.event,properties:{..._.properties},...M.selection?{selection:Fe(c,M.selection,u.capabilities)}:{}}),_.type==="open_url"&&window.open(_.url,"_blank","noopener,noreferrer"),_.close&&U("action")}}}let h=setTimeout(()=>{W(u.onError,new Error("Web View renderer did not start")),U("timeout")},5e3),f={destroy:()=>U("destroy"),updateCapabilities:y=>{let M=ge(y,c,window);u.capabilities=M,m({type:"capabilities",capabilities:M})}};return ht.set(f,y=>{C||m({type:"restore-action-focus",nodeId:y})}),T.addEventListener("click",()=>U("close_button")),v.addEventListener("cancel",y=>{y.preventDefault(),U("escape")}),v.append(T,D),I.append(L,v),window.addEventListener("message",Z),Ue.set(document,f),document.body.append(E),f}function Ht(l,u={}){let w=u.mode??"editor",{frame:k,post:c,accept:z}=yt(w,u.title??"\u5F39\u7A97\u9884\u89C8",u.editorMessages,u.rendererUrl);k.style.cssText="display:block;border:0;width:100%;height:0";let E=!1,I=null,L=null,v=!1,T,D,m=new Promise((h,f)=>{T=h,D=f});m.catch(()=>{});let $=setTimeout(()=>{if(v||E)return;let h=new Error("Web View renderer did not start");D(h),W(u.onError,h.message),C()},5e3);function C(){v||(v=!0,clearTimeout($),E||D(new Error("Web View mount cancelled")),window.removeEventListener("message",Z),k.remove())}let S=null,N="modal",j=new Set,U=h=>{let f=u.viewportHeight,y=f?N==="fullscreen"?f:Math.min(h,f-(N==="sheet"?0:32)):h;k.style.height=`${y}px`,W(u.onResize,y)};function Z(h){let f=v?null:z(h);if(f)if(f.type==="ready")E=!0,clearTimeout($),T(),I&&c(I),L&&c(L);else if(f.type==="rendered"||f.type==="resize")U(f.height);else if(f.type==="layout"&&w==="editor")Array.isArray(f.nodes)&&f.nodes.length<=pe.nodes&&f.nodes.every(y=>y&&typeof y.id=="string"&&/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(y.id)&&[y.x,y.y,y.width,y.height].every(M=>typeof M=="number"&&Number.isFinite(M))&&y.width>0&&y.height>0)&&W(u.onLayout,f.nodes);else if(f.type==="page"&&w==="live"&&j.has(f.pageId))W(u.onPageChange,f.pageId);else if(f.type==="funnel-intent"&&w==="live"&&["confirm","cancel"].includes(f.outcome))W(u.onFunnelIntent,f.outcome);else if(f.type==="funnel"&&w==="live"&&S){let y=ue(S,f.state);y&&W(u.onFunnelState,y)}else if(f.type==="escape"&&w==="live")W(u.onEscape);else if(f.type==="hover")W(u.onHover,f.id);else if(f.type==="select")W(u.onSelect,f.id);else if(f.type==="edit")W(u.onEdit,f.id);else if(f.type==="customer-data-intent"&&w==="live"&&S){let y=ot.safeParse(f.intent);y.success&&se(S,y.data.nodeId)?.type==="customer_data"&&W(u.onCustomerDataIntent,y.data)}else f.type==="action"&&S?.actions.some(y=>y.id===f.actionId)?W(u.onAction,f.actionId,Fe(S,f.selection,I?.type==="render"?I.capabilities:void 0)):f.type==="error"&&W(u.onError,f.message)}return window.addEventListener("message",Z),l.append(k),{ready:m,updateCustomerData(h){if(v||!S)return;let f=$e.parse(h),y={nodes:Object.fromEntries(Object.entries(f.nodes).filter(([M,_])=>{let Y=se(S,M);return Y?.type==="customer_data"&&Y.data.source===_.source}))};I?.type==="render"&&(I.customerData=y),E&&c({type:"customer-data",data:y})},resolveFunnel(h){v||c({type:"funnel-result",...h})},updateCapabilities(h){if(v||!S)return;let f=ge(h,S,window);f&&(I?.type==="render"&&(I.capabilities=f),E&&c({type:"capabilities",capabilities:f}))},update(h,f,y){let M;try{let _=Se(h,window);S=_,N=_.presentation.type,j=new Set(_.pages.map(Y=>Y.id)),M={type:"render",doc:_,locale:f,startPageId:y?.startPageId,parameters:ut.parse(y?.parameters??{}),capabilities:ge(y?.capabilities,_,window),customerData:y?.customerData?$e.parse(y.customerData):void 0,...y?.resume?{resume:ue(_,y.resume)??void 0}:{}},N==="fullscreen"&&u.viewportHeight&&U(u.viewportHeight)}catch(_){W(u.onError,_ instanceof Error?_.message:"\u5185\u5BB9\u4E0D\u6B63\u786E");return}I=M,E&&c(M)},highlight(h,f){L={type:"highlight",hoverId:h,selectedId:f},E&&c(L)},destroy:C}}async function Xt(l,u){if(u.signal?.aborted)throw new Error("Page mount cancelled");let w=await u.client.getPage({pageId:u.pageId,locale:u.locale});if(u.signal?.aborted)throw new Error("Page mount cancelled");let k=null,c=Ht(l,{mode:"live",rendererUrl:u.client.webViewUrl,title:w.document.name,onCustomerDataIntent:I=>{k?.intent(I).catch(L=>W(u.onError,L))},onAction:I=>{let L=w.document.actions.find(v=>v.id===I);if(L&&(L.type==="open_url"&&window.open(L.url,"_blank","noopener,noreferrer"),u.onAction))try{Promise.resolve(u.onAction(L)).catch(v=>W(u.onError,v))}catch(v){W(u.onError,v)}},onError:I=>W(u.onError,new Error(I))}),z=()=>c.destroy();u.signal?.addEventListener("abort",z,{once:!0});try{c.update(w.document,w.locale,{capabilities:w.capabilities}),k=Oe(w.document,u.client,{locale:w.locale,onData:I=>c.updateCustomerData(I),onCheckout:u.onCheckout,onError:u.onError}),await c.ready}catch(I){throw k?.destroy(),c.destroy(),I}finally{u.signal?.removeEventListener("abort",z)}let E={versionId:w.versionId,refresh:()=>k.refresh(),snapshot:()=>k.snapshot(),destroy(){k?.destroy(),c.destroy(),u.signal?.removeEventListener("abort",E.destroy)}};return u.signal?.addEventListener("abort",E.destroy,{once:!0}),E}export{Oe as createCustomerPageController,Pt as formatCustomerDecimal,_t as hostedRendererScript,Nt as inspectCustomHtml,Xt as mountCustomerPage,Ht as mountScreenPreview,Se as prepareScreen,Dt as sanitizeCustomHtml,zt as showPopup,Kt as showRemotePopup};
|