@tinkerlandai/indiana-sdk 0.8.4 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/README.md +45 -37
  3. package/README.zh-CN.md +42 -13
  4. package/dist/{ai-usage-DUlre7JC.d.ts → ai-usage-DMNKvCiq.d.ts} +3 -3
  5. package/dist/{api-XDc4pRlN.d.ts → api--Zf0gxfj.d.ts} +128 -124
  6. package/dist/chunk-3PZ4Y6UD.js +17 -0
  7. package/dist/chunk-5O667MKA.js +1 -0
  8. package/dist/chunk-7DXL3LHT.js +1 -0
  9. package/dist/chunk-7IB7CZ5P.js +1 -0
  10. package/dist/chunk-CPLLMISZ.js +1 -0
  11. package/dist/chunk-DAWZULXZ.js +1 -0
  12. package/dist/chunk-G23YNWWI.js +1 -0
  13. package/dist/chunk-G56XGVMS.js +1 -0
  14. package/dist/chunk-IH4KBLNR.js +1 -0
  15. package/dist/chunk-JEFEBF2H.js +1 -0
  16. package/dist/chunk-L7LKE3MG.js +173 -0
  17. package/dist/chunk-NH2PTTNK.js +2 -0
  18. package/dist/chunk-NTP55JMK.js +1 -0
  19. package/dist/chunk-SX5MO56H.js +4 -0
  20. package/dist/chunk-UBRLGIZE.js +1 -0
  21. package/dist/chunk-YAU4DI52.js +1 -0
  22. package/dist/{configuration-sync-Ce3dShy7.d.ts → configuration-sync-E98CqVwh.d.ts} +6 -5
  23. package/dist/content-YAPEUX6I.js +1 -0
  24. package/dist/{errors-C8lRYZ0n.d.ts → errors-0TSUIbUi.d.ts} +12 -1
  25. package/dist/{funnel-local-client-CUGavICI.d.ts → funnel-local-client-BjPwXlQb.d.ts} +550 -260
  26. package/dist/funnel-runtime-host-OZA763NT.js +1 -0
  27. package/dist/index.d.ts +689 -223
  28. package/dist/index.js +1 -1
  29. package/dist/native-shell.js +1 -1
  30. package/dist/openrouter.d.ts +3 -3
  31. package/dist/openrouter.js +1 -1
  32. package/dist/page.d.ts +6 -6
  33. package/dist/page.js +1 -1
  34. package/dist/paywall-EM7RGU56.js +1 -0
  35. package/dist/popup.d.ts +1 -1
  36. package/dist/popup.js +1 -1
  37. package/dist/react-native.d.ts +122 -99
  38. package/dist/react-native.js +1 -1
  39. package/dist/screen-renderer-A6VYE2QL.js +1 -0
  40. package/dist/server.d.ts +58 -58
  41. package/dist/server.js +1 -1
  42. package/dist/visual.d.ts +36 -1
  43. package/dist/visual.js +1 -2
  44. package/package.json +1 -1
  45. package/dist/chunk-3F2NQOR2.js +0 -1
  46. package/dist/chunk-663UOBHL.js +0 -1
  47. package/dist/chunk-BUDTHBFF.js +0 -173
  48. package/dist/chunk-EJTBSGLV.js +0 -10
  49. package/dist/chunk-EXCPE2XH.js +0 -1
  50. package/dist/chunk-F2GOIBDQ.js +0 -1
  51. package/dist/chunk-GRLMT5PR.js +0 -1
  52. package/dist/chunk-KQCTDXVD.js +0 -17
  53. package/dist/chunk-LMR2TM3X.js +0 -1
  54. package/dist/chunk-OBYJWIRB.js +0 -1
  55. package/dist/chunk-RRII2DMC.js +0 -1
  56. package/dist/chunk-RZBZ6LCT.js +0 -4
  57. package/dist/chunk-SOQO2RDZ.js +0 -1
  58. package/dist/chunk-SSHUBTT3.js +0 -1
  59. package/dist/chunk-VVV3JNS3.js +0 -1
  60. package/dist/content-2FCUY6XX.js +0 -1
  61. package/dist/funnel-runtime-host-ENRTSXPJ.js +0 -1
  62. package/dist/paywall-734GWAS4.js +0 -1
  63. package/dist/screen-renderer-DLXDQQKK.js +0 -1
  64. package/dist/src-CLEFCTAU.js +0 -1
  65. package/dist/{screen-BpAejkn0.d.ts → screen-BITZ11jn.d.ts} +18 -18
@@ -1 +0,0 @@
1
- var t="https://api.tinker.cash";export{t as a};
@@ -1 +0,0 @@
1
- import{Bh as E,Ch as M,Dh as j,Eh as O,Fh as T}from"./chunk-EJTBSGLV.js";import{a as u}from"./chunk-SOQO2RDZ.js";import{x as w}from"./chunk-LMR2TM3X.js";import{z as t}from"zod";var _=E,V=t.string().regex(/^(0|[1-9]\d{0,5})(\.\d{1,12})?$/),C=t.strictObject(Object.fromEntries(_.map(i=>[i,t.number().int().nonnegative().max(1e9)]))),L=M,D=j,q=t.strictObject({modelId:L,source:t.enum(["models.dev","custom"]),fetchedAt:t.iso.datetime(),rates:O,contextTier:t.number().int().nonnegative(),markupPercent:D}),U=t.strictObject({pricing:q,tokens:C,quantity:w,digest:t.string().regex(/^[a-f0-9]{64}$/)}),z=i=>{let[s,o=""]=i.split(".");return BigInt(s)*10n**12n+BigInt(o.padEnd(12,"0"))};function $(i){if(typeof i!="number"||!Number.isFinite(i)||i<0)throw new u("AI_PRICE_UNAVAILABLE","A published token price is missing");let s=String(i),o=s.includes("e")?i.toFixed(12).replace(/0+$/,"").replace(/\.$/,""):s;if(Number(o)!==i||!V.safeParse(o).success)throw new u("AI_PRICE_UNAVAILABLE","Published price exceeds the supported precision");return o}var R=t.strictObject({input:t.number().nonnegative(),output:t.number().nonnegative(),cache_read:t.number().nonnegative().optional(),cache_write:t.number().nonnegative().optional(),reasoning:t.number().nonnegative().optional(),input_audio:t.number().nonnegative().optional(),output_audio:t.number().nonnegative().optional()}),F=R.extend({context_over_200k:t.unknown().optional(),tiers:t.array(R.extend({tier:t.strictObject({type:t.literal("context"),size:t.number().int().nonnegative()})})).max(20).refine(i=>new Set(i.map(s=>s.tier.size)).size===i.length).optional()});async function N(i,s,o){let d=new TextEncoder().encode(JSON.stringify({pricing:i,tokens:s,quantity:o}));return[...new Uint8Array(await crypto.subtle.digest("SHA-256",d))].map(m=>m.toString(16).padStart(2,"0")).join("")}function B(i,s){let o=0n;for(let c of _){if(!s[c])continue;let f=i.rates[c];if(f===void 0)throw new u("AI_PRICE_UNAVAILABLE",`No published price for ${c}; report exclusive token pools`);o+=z(f)*BigInt(s[c])}let[d,m="0"]=String(i.markupPercent).split("e"),r=(d.split(".")[1]?.length??0)-Number(m),e=10n**BigInt(Math.max(r,0)),n=BigInt(d.replace(".",""))*10n**BigInt(Math.max(-r,0)),g=100n*e+n,l=100n*e*1000000n,a=(o*g+l-1n)/l;return w.parse(`${a/1000000n}.${(a%1000000n).toString().padStart(6,"0")}`)}function K(i={}){if(typeof window<"u")throw new u("SERVER_ONLY","AI token pricing belongs on your backend");let s=T.parse({defaultMarkup:i.defaultMarkup??0,providerMarkups:i.providerMarkups??{},modelMarkups:i.modelMarkups??{},customModels:i.customModels??{}}),o=null,d=0;async function m(){if(!o||Date.now()>=d){d=Date.now()+15*6e4;let r=(async()=>{let e=await(i.fetch??fetch)("https://models.dev/api.json",{signal:AbortSignal.timeout(3e4)});if(!e.ok)throw new u("AI_PRICE_UNAVAILABLE","Models.dev pricing is unavailable");return{data:t.record(t.string(),t.object({models:t.record(t.string(),t.unknown())})).parse(await e.json()),fetchedAt:new Date().toISOString()}})().catch(e=>{throw o===r&&(o=null),e});o=r}return o}return{refreshPrices(){o=null,d=0},async quoteTokens(r){let e=L.parse(r.modelId),n=C.parse(r.tokens),[g,...l]=e.split("/"),a=s.customModels[e],c,f,p,y=0;if(a?.input!==void 0&&a.output!==void 0&&_.every(A=>n[A]===0||a[A]!==void 0))c={...a,input:a.input,output:a.output},f="custom",p=new Date().toISOString();else{let A=await m(),x=A.data[g]?.models[l.join("/")];if(!x)throw new u("AI_PRICE_UNAVAILABLE","Unknown model; configure a complete custom price");let{cost:I}=t.object({cost:F}).parse(x),P=n.input+n.cache_read+n.cache_write+n.input_audio;if(I.tiers===void 0&&I.context_over_200k!==void 0&&P>2e5)throw new u("AI_PRICE_UNAVAILABLE","A current context tier is required for this model");let b=I.tiers?.filter(k=>P>k.tier.size).sort((k,Q)=>Q.tier.size-k.tier.size)[0],v=b??I;b&&(y=b.tier.size),c=Object.fromEntries(_.filter(k=>v[k]!==void 0).map(k=>[k,$(v[k])])),c={...c,...a},f=a?"custom":"models.dev",p=A.fetchedAt}let h=q.parse({modelId:e,source:f,fetchedAt:p,rates:c,contextTier:y,markupPercent:s.modelMarkups[e]??s.providerMarkups[g]??s.defaultMarkup}),S=B(h,n);return U.parse({pricing:h,tokens:n,quantity:S,digest:await N(h,n,S)})},async trackTokens(r,e){let n=U.parse(e.quote);if(n.quantity!==B(n.pricing,n.tokens)||n.digest!==await N(n.pricing,n.tokens,n.quantity))throw new u("INVALID_REQUEST","AI quote changed after pricing");let g=e.properties??{},l=e.providerCostUsd===void 0?void 0:t.string().regex(/^(0|[1-9]\d{0,11})(\.\d{1,18})?$/).parse(e.providerCostUsd),a=e.generationId===void 0?void 0:t.string().min(1).max(120).parse(e.generationId),c=8+ +(l!==void 0)+ +(a!==void 0);if(Object.keys(g).some(p=>p.startsWith("ai_")))throw new u("INVALID_REQUEST","AI tracking reserves ai_ event properties");if(Object.keys(g).length>16-c)throw new u("INVALID_REQUEST","AI tracking properties exceed the available event budget");let f={operation:"consume",internal_feature_id:e.internal_feature_id,quantity:n.quantity,idempotencyKey:e.idempotencyKey,properties:{...g,...l!==void 0?{ai_provider_cost_usd:l}:{},...a!==void 0?{ai_generation_id:a}:{},ai_model:n.pricing.modelId,ai_source:n.pricing.source,ai_price_at:n.pricing.fetchedAt,ai_quote_hash:n.digest,ai_markup:String(n.pricing.markupPercent),ai_tier:String(n.pricing.contextTier),ai_tokens:_.map(p=>n.tokens[p]).join(","),ai_rates:"v1:"+_.map(p=>n.pricing.rates[p]===void 0?"-":z(n.pricing.rates[p]).toString(36)).join(",")},...e.entityId?{entityId:e.entityId}:{}};return r.mutateBalance({customerId:e.customerId,command:f})}}}async function Y(i,s,o={}){let{config:d,model_markups:m}=await i.readAiPricing(s);return K({defaultMarkup:d.default_markup??0,providerMarkups:Object.fromEntries(Object.entries(d.provider_markups??{}).map(([r,e])=>[r,e.markup])),modelMarkups:Object.fromEntries(Object.entries(m??{}).filter(([,r])=>r.markup!==void 0).map(([r,e])=>[r,e.markup])),customModels:Object.fromEntries(Object.entries(m??{}).filter(([,r])=>r.input_cost!==void 0||r.output_cost!==void 0).map(([r,e])=>[r,{...e.input_cost!==void 0?{input:String(e.input_cost)}:{},...e.output_cost!==void 0?{output:String(e.output_cost)}:{}}])),...o})}export{q as a,U as b,K as c,Y as d};
@@ -1 +0,0 @@
1
- import{a as o}from"./chunk-SOQO2RDZ.js";function a(r,n){let t=i=>"document"in i?i.offering.id:i.content.offeringVersionId;return r.id===n.id&&t(r)===t(n)&&r.content?.artifact.sha256===n.content?.artifact.sha256}function s(r,n,t){if(r.operationId!==n.operationId||n.currency!==void 0&&r.currency!==n.currency)throw new o("INVALID_RESPONSE",t)}function u(r,n,t){if(r.lines.length!==1||r.lines[0].productVersionId!==n.productVersionId||n.currency!==void 0&&r.currency!==n.currency||n.provider!==void 0&&r.provider!==n.provider)throw new o("INVALID_RESPONSE",t)}function c(r,n,t=!1){return!r||r.operationId!==n?.operationId?n:r.status==="complete"&&n.status!=="complete"||r.status!=="pending"&&(n.status==="pending"||t&&n.status!=="complete")?r:n}export{a,s as b,u as c,c as d};
@@ -1,17 +0,0 @@
1
- function G(e){let t=2166136261,n=e.length;for(let r=0;r<n;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}function C(e,t,n){return n===2?G(G(e+t)+"")%1e4/1e4:null}function ae(e){return e<=0?[]:new Array(e).fill(1/e)}function V(e,t){return e>=t[0]&&e<t[1]}function N(e,t){for(let[n,r]of t.entries())if(V(e,r))return n;return-1}function M(e,t,n){t=t===void 0?1:t,t<0?t=0:t>1&&(t=1);let r=ae(e);n=n||r,n.length!==e&&(n=r);let o=n.reduce((a,u)=>u+a,0);(o<.99||o>1.01)&&(n=r);let i=0,s=t;return n.map(a=>{let u=i;return i+=a,[u,u+s*a]})}function I(e,t,n){if(!t)return null;let r=t.split("?")[1];if(!r)return null;let i=r.replace(/#.*/,"").split("&").map(s=>s.split("=",2)).filter(([s])=>s===e).map(([,s])=>s===void 0?NaN:parseInt(s))[0];return i!==void 0&&i>=0&&i<n?i:null}function q(e){try{return e()}catch{return!1}}function B(e){return typeof e=="string"?e:JSON.stringify(e)}function p(e){typeof e=="number"&&(e=e+""),(!e||typeof e!="string")&&(e="0");let t=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return t.length===3&&t.push("~"),t.map(n=>n.match(/^[0-9]+$/)?n.padStart(5," "):n).join("-")}function ue(e){try{let t=e.replace(/([^\\])\//g,"$1\\/");return new RegExp(t)}catch{return}}function W(e,t){if(!t.length)return!1;let n=!1,r=!1;for(let o of t){let i=De(e,o.type,o.pattern);if(o.include===!1){if(i)return!1}else n=!0,i&&(r=!0)}return r||!n}function Ue(e,t,n){try{let r=t.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return n&&(r="\\/?"+r.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+r+"$","i").test(e)}catch{return!1}}function _e(e,t){try{let n=new URL(t.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),r=[[e.host,n.host,!1],[e.pathname,n.pathname,!0]];return n.hash&&r.push([e.hash,n.hash,!1]),n.searchParams.forEach((o,i)=>{r.push([e.searchParams.get(i)||"",o,!1])}),!r.some(o=>!Ue(o[0],o[1],o[2]))}catch{return!1}}function De(e,t,n){try{let r=new URL(e,"https://_");if(t==="regex"){let o=ue(n);return o?o.test(r.href)||o.test(r.href.substring(r.origin.length)):!1}else if(t==="simple")return _e(r,n);return!1}catch{return!1}}function J(e){for(let n of["namespace","status","url","groups"])if(Object.hasOwn(e,n))throw new TypeError(`Retired experiment field: ${n}`);let t=e;if(t.hashVersion!==void 0&&t.hashVersion!==2)throw new TypeError("Only hash version 2 is supported");if(t.filters?.some(n=>n.hashVersion!==2))throw new TypeError("Only hash version 2 is supported")}function H(e){for(let t of Object.values(e)){if(Array.isArray(t))throw new TypeError("Saved groups require typed list or condition entries");if(t&&Object.hasOwn(t,"useEmptyListGroup"))throw new TypeError("Retired saved group field: useEmptyListGroup")}}function ce(e){for(let t of["overrides","groups"])if(Object.hasOwn(e,t))throw new TypeError(`Retired evaluation context field: ${t}`);H(e.savedGroups??{})}var je=e=>e/2**32|0,Pe=e=>e>>>0;function fe(e,t,n,r){let o=je(n),i=Pe(n);e.setUint32(t,r?i:o,r),e.setUint32(t+4,r?o:i,r)}function le(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var Q=e=>e?`"${e}" `:"";function Ke(e,t=""){if(typeof e!="number")throw new TypeError(Q(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(Q(t)+"expected integer >= 0, got "+e);return e}function L(e,t,n=""){if(le(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Ke(t,"length");let r=le(e),o=t!==void 0?` of length ${t}`:"",i=r?`length=${e.length}`:`type=${typeof e}`,s=Q(n)+"expected Uint8Array"+o+", got "+i;throw r?new RangeError(s):new TypeError(s)}var Ge=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError((t==="object"?"":`"${t}" `)+"expected object, got type="+typeof e)},de=(e,t)=>{Ge(e,t);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw new TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,"__proto__"))throw new TypeError(`"${t}.__proto__" is not allowed`)};function X(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function he(e,t){L(e,void 0,"output");let n=t.outputLen;if(!(e.length>=n))throw new RangeError('"output" expected length >= '+n)}function z(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function U(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function x(e,t){return e<<32-t|e>>>t}var Ne=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Me=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function be(e){if(L(e),Ne)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Me[e[n]];return t}function Ie(e,t,n="opts"){return de(e,"defaults"),t!==void 0&&de(t,n),Object.assign(Object.create(null),e,t)}function pe(e,t={}){if(typeof e!="function")throw new TypeError('"hashCons" expected function, got type='+typeof e);t=Ie({},t,"info");let n=(o,i)=>e(i).update(o).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=o=>e(o),Object.assign(n,t),Object.freeze(n)}var ge=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function xe(e,t,n){return e&t^~e&n}function ye(e,t,n){return e&t^e&n^t&n}var _=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,n,r,o){this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=U(this.buffer)}update(t){X(this),L(t);let{view:n,buffer:r,blockLen:o}=this,i=t.length,s=!1;for(let a=0;a<i;){let u=Math.min(o-this.pos,i-a);if(u===o){let f=U(t);for(;o<=i-a;a+=o)this.process(f,a);s=!0;continue}r.set(a===0&&u===i?t:t.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===o&&(this.process(n,0),this.pos=0,s=!0)}return this.length+=t.length,s&&this.roundClean(),this}digestInto(t){X(this),he(t,this),this.finished=!0;let{buffer:n,view:r,blockLen:o,isLE:i}=this,{pos:s}=this;n[s++]=128,n.fill(0,s),this.padOffset>o-s&&(this.process(r,0),n.fill(0)),fe(r,o-8,this.length*8,i),this.process(r,0),this.roundClean();let a=t===n?r:U(t),u=this.outputLen,f=u/4,d=this.get();if(u%4||f>d.length)throw new Error("invalid outputLen");for(let c=0;c<f;c++)a.setUint32(4*c,d[c],i)}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let r=t.slice(0,n);return this.destroy(),r}_cloneIntoMeta(t){let{buffer:n,length:r,finished:o,destroyed:i,pos:s}=this;return t.destroyed=i,t.finished=o,t.length=r,t.pos=s,s&&t.buffer.set(n),t}clone(){return this._cloneInto()}},ke=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var qe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),E=new Uint32Array(64),Y=class extends _{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(t,n){super(64,t,8,!1),this.A=n[0]|0,this.B=n[1]|0,this.C=n[2]|0,this.D=n[3]|0,this.E=n[4]|0,this.F=n[5]|0,this.G=n[6]|0,this.H=n[7]|0}get(){let{A:t,B:n,C:r,D:o,E:i,F:s,G:a,H:u}=this;return[t,n,r,o,i,s,a,u]}set(t,n,r,o,i,s,a,u){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=a|0,this.H=u|0}_cloneInto(t){return(t||=new this.constructor).set(...this.get()),this._cloneIntoMeta(t)}process(t,n){for(let c=0;c<16;c++,n+=4)E[c]=t.getUint32(n,!1);for(let c=16;c<64;c++){let h=E[c-15],g=E[c-2],w=x(h,7)^x(h,18)^h>>>3,S=x(g,17)^x(g,19)^g>>>10;E[c]=S+E[c-7]+w+E[c-16]|0}let{A:r,B:o,C:i,D:s,E:a,F:u,G:f,H:d}=this;for(let c=0;c<64;c++){let h=x(a,6)^x(a,11)^x(a,25),g=d+h+xe(a,u,f)+qe[c]+E[c]|0,S=(x(r,2)^x(r,13)^x(r,22))+ye(r,o,i)|0;d=f,f=u,u=a,a=s+g|0,s=i,i=o,o=r,r=g+S|0}r=r+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,a=a+this.E|0,u=u+this.F|0,f=f+this.G|0,d=d+this.H|0,this.set(r,o,i,s,a,u,f,d)}roundClean(){z(E)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),z(this.buffer)}},Z=class extends Y{constructor(){super(32,ke)}};var me=pe(()=>new Z,ge(1));var we=new Map,ee=32,Se=new WeakMap,Ae=new WeakMap;function We(e){return be(me(new TextEncoder().encode(String(e))))}var j=e=>Array.isArray(e)?e.map(j):typeof e=="string"||typeof e=="number"?We(e):null,D=e=>typeof e=="string"?e.toLowerCase():e;function Fe(e){let t=Se.get(e);return t||(t=new Set(e),Se.set(e,t)),t}function Je(e){let t=Ae.get(e);return t||(t=new Set(e.map(D)),Ae.set(e,t)),t}function Qe(e){H(e);for(let t of Object.values(e)){let n=t?.type==="list"||t?.type==="hashed"?t.values:null;n&&n.length>=ee&&Fe(n)}return e}function k(e,t,n,r){n=n||{},r||H(n),r=r||new Set;for(let[o,i]of Object.entries(t))switch(o){case"$or":if(!Te(e,i,n,r))return!1;break;case"$nor":if(Te(e,i,n,r))return!1;break;case"$and":if(!et(e,i,n,r))return!1;break;case"$not":if(k(e,i,n,r))return!1;break;case"$savedGroup":if(!Xe(e,i,n,r))return!1;break;default:if(!O(i,Re(e,o),n,!1,r))return!1}return!0}function Xe(e,t,n,r){if(!t||typeof t!="object"||Array.isArray(t))return!1;let{id:o,attributeKey:i}=t;if(typeof o!="string"||r.has(o)||i!==void 0&&typeof i!="string")return!1;let s=n[o];if(!s||Array.isArray(s)||typeof s!="object")return!1;let a=new Set(r).add(o);if(s.type==="list"||s.type==="hashed"){let u=i??s.attributeKey;if(typeof u!="string"||!Array.isArray(s.values))return!1;let f=Re(e,u);return T(s.type==="hashed"?j(f):f,s.values)}return s.type==="condition"?!s.condition||typeof s.condition!="object"?!1:k(e,s.condition,n,a):!1}function Re(e,t){let n=t.split("."),r=e;for(let o of n)if(r&&typeof r=="object"&&o in r)r=r[o];else return null;return r}function Ee(e,t=!1){let n=`${e}${t?"/i":""}`,r=we.get(n);return r||(r=new RegExp(e.replace(/([^\\])\//g,"$1\\/"),t?"i":void 0),we.set(n,r)),r}function O(e,t,n,r=!1,o=new Set){if(typeof e=="string")return r?String(t).toLowerCase()===e.toLowerCase():t+""===e;if(typeof e=="number")return t*1===e;if(typeof e=="boolean")return t!==null&&!!t===e;if(e===null)return t===null;if(Array.isArray(e)||!Ce(e))return JSON.stringify(t)===JSON.stringify(e);let i=e;for(let s in i)if(!Ze(s,t,i[s],n,o))return!1;return!0}function Ce(e){let t=Object.keys(e);return t.length>0&&t.filter(n=>n[0]==="$").length===t.length}function ze(e){if(e===null)return"null";if(Array.isArray(e))return"array";let t=typeof e;return["string","number","boolean","object","undefined"].includes(t)?t:"unknown"}function Ye(e,t,n,r){if(!Array.isArray(e))return!1;let o=Ce(t)?i=>O(t,i,n,!1,r):i=>k(i,t,n,r);for(let i=0;i<e.length;i++)if((e[i]??null)!==null&&o(e[i]))return!0;return!1}function T(e,t,n=!1){if(n){let o;if(t.length>=ee){let i=Je(t);o=s=>{let a=D(s);return!(typeof a=="number"&&Number.isNaN(a))&&i.has(a)}}else o=i=>t.some(s=>D(i)===D(s));return Array.isArray(e)?e.some(i=>o(i)):o(e)}let r=t.length>=ee?(o=>i=>o.has(i))(Fe(t)):o=>t.includes(o);return Array.isArray(e)?e.some(o=>r(o)):r(e)}function ve(e){return e===void 0?[]:e&&typeof e=="object"&&(e.type==="list"||e.type==="hashed")&&Array.isArray(e.values)?e.values:null}function Be(e,t,n,r=!1,o=new Set){if(!Array.isArray(e))return!1;for(let i=0;i<t.length;i++){let s=!1;for(let a=0;a<e.length;a++)if(O(t[i],e[a],n,r,o)){s=!0;break}if(!s)return!1}return!0}function Ze(e,t,n,r,o=new Set){let i=t,s=n;switch(e){case"$veq":return p(t)===p(n);case"$vne":return p(t)!==p(n);case"$vgt":return p(t)>p(n);case"$vgte":return p(t)>=p(n);case"$vlt":return p(t)<p(n);case"$vlte":return p(t)<=p(n);case"$eq":return t===n;case"$ne":return t!==n;case"$lt":return i<s;case"$lte":return i<=s;case"$gt":return i>s;case"$gte":return i>=s;case"$exists":return n?t!=null:t==null;case"$in":return Array.isArray(n)?T(t,n):!1;case"$ini":return Array.isArray(n)?T(t,n,!0):!1;case"$inGroup":{let a=r[n],u=ve(a);return u===null?!1:T(a?.type==="hashed"?j(t):t,u)}case"$notInGroup":{let a=r[n],u=ve(a);return u===null?!1:!T(a?.type==="hashed"?j(t):t,u)}case"$nin":return Array.isArray(n)?!T(t,n):!1;case"$nini":return Array.isArray(n)?!T(t,n,!0):!1;case"$not":return!O(n,t,r,!1,o);case"$size":return Array.isArray(t)?O(n,t.length,r,!1,o):!1;case"$elemMatch":return Ye(t,n,r,o);case"$all":return Array.isArray(n)?Be(t,n,r,!1,o):!1;case"$alli":return Array.isArray(n)?Be(t,n,r,!0,o):!1;case"$regex":try{return Ee(n).test(t)}catch{return!1}case"$regexi":try{return Ee(n,!0).test(t)}catch{return!1}case"$type":return ze(t)===n;default:return!1}}function Te(e,t,n,r){if(!t.length)return!0;for(let o of t)if(k(e,o,n,r))return!0;return!1}function et(e,t,n,r){for(let o of t)if(!k(e,o,n,r))return!1;return!0}function te(e){return ce(e),{context:e,stack:{evaluatedFeatures:new Set}}}function ne(e){return{...e.attributes,...e.attributeOverrides}}function m(e,t,n){let r=t||"id",o="",i=ne(e);return i[r]&&(o=i[r]),!o&&n&&(i[n]&&(o=i[n]),o&&(r=n)),{hashAttribute:r,hashValue:o}}function l(e,t,n){e.context.log?.(t,n)}function $(e,t){return t=t||0,`${e}__${t}`}function P(e,t){return`${e}||${t}`}function tt(e,t,n){let r=e.stickyBucketAssignmentDocs;if(!r)return{};let{hashAttribute:o,hashValue:i}=m(e,t),s=P(o,B(i)),{hashAttribute:a,hashValue:u}=m(e,n),f=u?P(a,B(u)):null,d={};return f&&r[f]&&Object.assign(d,r[f].assignments||{}),r[s]&&Object.assign(d,r[s].assignments||{}),d}function re({context:e,expKey:t,expBucketVersion:n,expHashAttribute:r,expFallbackAttribute:o,expMinBucketVersion:i,expMeta:s}){n=n||0,i=i||0,r=r||"id",s=s||[];let a=$(t,n),u=tt(e,r,o);if(i>0)for(let c=0;c<i;c++){let h=$(t,c);if(u[h]!==void 0)return{variation:-1,versionIsBlocked:!0}}let f=u[a];if(f===void 0)return{variation:-1};let d=s.findIndex(c=>c.key===f);return d<0?{variation:-1}:{variation:d}}function oe(e,t,n,r){let o=P(t,n),i=e.stickyBucketAssignmentDocs,s=i&&i[o]?i[o].assignments||{}:{},a={...s,...r},u=JSON.stringify(s)!==JSON.stringify(a);return{key:o,doc:{attributeName:t,attributeValue:n,assignments:a},changed:u}}function nt(e){let t=new Set;return Object.values(e).forEach(n=>{if(n.rules)for(let r of n.rules)r.variations&&(t.add(r.hashAttribute||"id"),r.fallbackAttribute&&t.add(r.fallbackAttribute))}),Array.from(t)}function rt(e,t=e.features||{}){let n={};return nt(t).forEach(r=>{let{hashValue:o}=m(e,r);n[r]=B(o)}),n}function y(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function ot(e){return y({...e,parentConditions:e.parentConditions?.map(t=>y(t)),filters:e.filters?.map(t=>y(t)),meta:e.meta?.map(t=>y(t))})}function Ht(e){return y({...e,parentConditions:e.parentConditions?.map(t=>y(t)),filters:e.filters?.map(t=>y(t)),meta:e.meta?.map(t=>y(t)),tracks:e.tracks?.map(t=>({experiment:ot(t.experiment),result:y(t.result)}))})}function st(e,t){let n=te(t),r=Oe(e,null,n);return t.onExperimentEval?.(e,r),r}function it(e,t){return ie(e,te(t))}function at(e){return e.forcedVariations||{}}function Ve(e,t,n){let{context:r}=e;if(r.trackedExperiments){let o=Le(t,n);if(r.trackedExperiments.has(o))return;r.trackedExperiments.add(o)}se(()=>r.onExperimentViewed?.(t,n))}function ut(e,t,n){let{context:r}=e;if(r.trackedFeatureUsage){let o=JSON.stringify(n.value);if(r.trackedFeatureUsage[t]===o)return;r.trackedFeatureUsage[t]=o}se(()=>r.onFeatureUsage?.(t,n))}function se(e){try{let t=e();t&&typeof t.catch=="function"&&t.catch(()=>{})}catch{}}function ie(e,t){let{context:n}=t;if(t.stack.evaluatedFeatures.has(e))return l(t,`evalFeature: circular dependency detected: ${t.stack.id} -> ${e}`,{from:t.stack.id,to:e}),v(t,e,null,"cyclicPrerequisite");t.stack.evaluatedFeatures.add(e),t.stack.id=e;let r=n.features?.[e];for(let i of r?.rules??[])J(i);let o=n.forcedFeatureValues;if(o&&o.has(e))return l(t,"Global override",{id:e,value:o.get(e)}),v(t,e,o.get(e),"override");if(!r)return l(t,"Unknown feature",{id:e}),v(t,e,null,"unknownFeature");if(r.rules){let i=new Set(t.stack.evaluatedFeatures);e:for(let s of r.rules){if(s.parentConditions)for(let f of s.parentConditions){t.stack.evaluatedFeatures=new Set(i);let d=ie(f.id,t);if(d.source==="cyclicPrerequisite")return v(t,e,null,"cyclicPrerequisite");let c={value:d.value};if(!k(c,f.condition||{},n.savedGroups||{})){if(f.gate)return l(t,"Feature blocked by prerequisite",{id:e,rule:s}),v(t,e,null,"prerequisite");l(t,"Skip rule because prerequisite evaluation fails",{id:e,rule:s});continue e}}if(s.filters&&He(s.filters,t)){l(t,"Skip rule because of filters",{id:e,rule:s});continue}if("force"in s){if(s.condition&&!$e(s.condition,t)){l(t,"Skip rule because of condition ff",{id:e,rule:s});continue}if(!ct(t,s.seed||e,s.hashAttribute,n.saveStickyBucketAssignmentDoc&&!s.disableStickyBucketing?s.fallbackAttribute:void 0,s.range,s.coverage,s.hashVersion)){l(t,"Skip rule because user not included in rollout",{id:e,rule:s});continue}return l(t,"Force value from rule",{id:e,rule:s}),s.tracks&&s.tracks.forEach(f=>{Ve(t,f.experiment,f.result)}),v(t,e,s.force,"force",s.id)}if(!s.variations){l(t,"Skip invalid rule",{id:e,rule:s});continue}let a={variations:s.variations,key:s.key||e};"coverage"in s&&(a.coverage=s.coverage),s.weights&&(a.weights=s.weights),s.hashAttribute&&(a.hashAttribute=s.hashAttribute),s.fallbackAttribute&&(a.fallbackAttribute=s.fallbackAttribute),s.disableStickyBucketing&&(a.disableStickyBucketing=s.disableStickyBucketing),s.bucketVersion!==void 0&&(a.bucketVersion=s.bucketVersion),s.minBucketVersion!==void 0&&(a.minBucketVersion=s.minBucketVersion),s.meta&&(a.meta=s.meta),s.ranges&&(a.ranges=s.ranges),s.name&&(a.name=s.name),s.phase&&(a.phase=s.phase),s.seed&&(a.seed=s.seed),s.hashVersion&&(a.hashVersion=s.hashVersion),s.filters&&(a.filters=s.filters),s.condition&&(a.condition=s.condition);let u=Oe(a,e,t);if(n.onExperimentEval?.(a,u),u.inExperiment&&!u.passthrough)return v(t,e,u.value,"experiment",s.id,a,u)}}return l(t,"Use default value",{id:e,value:r.defaultValue}),v(t,e,r.defaultValue===void 0?null:r.defaultValue,"defaultValue")}function Oe(e,t,n){let{context:r}=n;J(e);let o=e.key,i=e.variations.length;if(i<2)return l(n,"Invalid experiment",{id:o}),b(n,e,-1,!1,t);if(r.enabled===!1)return l(n,"Context disabled",{id:o}),b(n,e,-1,!1,t);if(e.urlPatterns&&!W(r.url||"",e.urlPatterns))return l(n,"Skip because of url targeting",{id:o}),b(n,e,-1,!1,t);let s=I(o,r.url||"",i);if(s!==null)return l(n,"Force via querystring",{id:o,variation:s}),b(n,e,s,!1,t);let u=at(r)[o];if(u!==void 0)return l(n,"Force via dev tools",{id:o,variation:u}),b(n,e,u,!1,t);if(e.active===!1)return l(n,"Skip because inactive",{id:o}),b(n,e,-1,!1,t);let{hashAttribute:f,hashValue:d}=m(r,e.hashAttribute,r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!d)return l(n,"Skip because missing hashAttribute",{id:o}),b(n,e,-1,!1,t);let c=-1,h=!1,g=!1;if(r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{variation:A,versionIsBlocked:F}=re(y({context:r,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta}));h=A>=0,c=A,g=!!F}if(!h){if(e.filters&&He(e.filters,n))return l(n,"Skip because of filters",{id:o}),b(n,e,-1,!1,t);if(e.include&&!q(e.include))return l(n,"Skip because of include function",{id:o}),b(n,e,-1,!1,t);if(e.condition&&!$e(e.condition,n))return l(n,"Skip because of condition exp",{id:o}),b(n,e,-1,!1,t);if(e.parentConditions){let A=new Set(n.stack.evaluatedFeatures);for(let F of e.parentConditions){n.stack.evaluatedFeatures=new Set(A);let R=ie(F.id,n);if(R.source==="cyclicPrerequisite")return b(n,e,-1,!1,t);let K={value:R.value};if(!k(K,F.condition||{},r.savedGroups||{}))return l(n,"Skip because prerequisite evaluation fails",{id:o}),b(n,e,-1,!1,t)}}}let w=C(e.seed||o,d,e.hashVersion??2);if(w===null)return l(n,"Skip because of invalid hash version",{id:o}),b(n,e,-1,!1,t);if(!h){let A=e.ranges||M(i,e.coverage===void 0?1:e.coverage,e.weights);c=N(w,A)}if(g)return l(n,"Skip because sticky bucket version is blocked",{id:o}),b(n,e,-1,!1,t,void 0,!0);if(c<0)return l(n,"Skip because of coverage",{id:o}),b(n,e,-1,!1,t);if("force"in e)return l(n,"Force variation",{id:o,variation:e.force}),b(n,e,e.force===void 0?-1:e.force,!1,t);if(r.qaMode)return l(n,"Skip because QA mode",{id:o}),b(n,e,-1,!1,t);let S=b(n,e,c,!0,t,w,h);if(r.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{changed:A,key:F,doc:R}=oe(r,f,B(d),{[$(e.key,e.bucketVersion)]:S.key});if(A){r.stickyBucketAssignmentDocs=r.stickyBucketAssignmentDocs||{},r.stickyBucketAssignmentDocs[F]=R;let K=r.saveStickyBucketAssignmentDoc;se(()=>K(R))}}return Ve(n,e,S),l(n,"In experiment",{id:o,variation:S.variationId}),S}function v(e,t,n,r,o,i,s){let a={value:n,on:!!n,off:!n,source:r,ruleId:o||""};return i&&(a.experiment=i),s&&(a.experimentResult=s),r!=="override"&&ut(e,t,a),a}function $e(e,t){return k(ne(t.context),e,t.context.savedGroups||{})}function He(e,t){return e.some(n=>{let{hashValue:r}=m(t.context,n.attribute);if(!r)return!0;let o=C(n.seed,r,n.hashVersion||2);return o===null?!0:!n.ranges.some(i=>V(o,i))})}function ct(e,t,n,r,o,i,s){if(!o&&i===void 0)return!0;if(!o&&i===0)return!1;let{hashValue:a}=m(e.context,n,r);if(!a)return!1;let u=C(t,a,s??2);return u===null?!1:o?V(u,o):i!==void 0?u<=i:!0}function b(e,t,n,r,o,i,s){let a=!0;(n<0||n>=t.variations.length)&&(n=0,a=!1);let{hashAttribute:u,hashValue:f}=m(e.context,t.hashAttribute,e.context.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0),d=t.meta?.[n]??{},c=t.variations[0];for(let[g,w]of t.variations.entries())if(g===n){c=w;break}let h={key:d.key||""+n,featureId:o,inExperiment:a,hashUsed:r,variationId:n,value:c,hashAttribute:u,hashValue:f,stickyBucketUsed:!!s};return d.name&&(h.name=d.name),i!==void 0&&(h.bucket=i),d.passthrough&&(h.passthrough=d.passthrough),h}function Le(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}/*!
2
- Copyright (c) 2025 GrowthBook, Inc.
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
5
- furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all
8
- copies or substantial portions of the Software.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16
- SOFTWARE.
17
- */export{y as a,Ht as b,I as c,B as d,W as e,be as f,me as g,Qe as h,k as i,rt as j,st as k,it as l,Le as m};
@@ -1 +0,0 @@
1
- import{a as ue}from"./chunk-RRII2DMC.js";import{z as A}from"zod";var te=A.enum(["INVALID_PROTOCOL_VERSION","UNSUPPORTED_PROTOCOL_VERSION","PROTOCOL_RETIRED","UNAUTHENTICATED","FORBIDDEN","SCOPE_MISMATCH","INVALID_REQUEST","NOT_FOUND","CONFLICT","PAYLOAD_TOO_LARGE","RATE_LIMITED","SERVICE_UNAVAILABLE","NOT_CONFIGURED","CAPABILITY_UNAVAILABLE","INTERNAL_ERROR"]),Sr=A.enum([...te.options,"INVALID_SERVER_RESPONSE","RESPONSE_TOO_LARGE","AMBIGUOUS_AUTHENTICATION","BROWSER_REQUIRED","INVALID_REDIRECT_URI","AUTHORIZATION_UNAVAILABLE","UNREGISTERED_CLIENT","MANAGEMENT_OPERATION_FAILED"]),xr=A.enum([...te.options,"stale_revision"]),ot=A.enum(["fix_request","authenticate","check_permissions","check_scope","resolve_conflict","reload_state","retry_same_request","configure_integration","check_availability","upgrade_sdk","recover_operation","contact_support"]),at=A.enum(["CAPABILITY_NOT_ENABLED","INTEGRATION_MISSING","PROVIDER_CREDENTIAL_REJECTED","PRICE_BINDING_REQUIRED","IDEMPOTENCY_CONFLICT","RESULT_UNKNOWN","STATE_CHANGED","OPERATION_IN_PROGRESS","FUNNEL_VERSION_RETIRED"]),Ee={INVALID_PROTOCOL_VERSION:{status:400,recovery:"fix_request"},UNSUPPORTED_PROTOCOL_VERSION:{status:400,recovery:"upgrade_sdk"},PROTOCOL_RETIRED:{status:410,recovery:"upgrade_sdk"},UNAUTHENTICATED:{status:401,recovery:"authenticate"},FORBIDDEN:{status:403,recovery:"check_permissions"},SCOPE_MISMATCH:{status:403,recovery:"check_scope"},INVALID_REQUEST:{status:400,recovery:"fix_request"},NOT_FOUND:{status:404,recovery:"fix_request"},CONFLICT:{status:409,recovery:"resolve_conflict"},PAYLOAD_TOO_LARGE:{status:413,recovery:"fix_request"},RATE_LIMITED:{status:429,recovery:"retry_same_request"},SERVICE_UNAVAILABLE:{status:503,recovery:"retry_same_request"},NOT_CONFIGURED:{status:501,recovery:"configure_integration"},CAPABILITY_UNAVAILABLE:{status:501,recovery:"check_availability"},INTERNAL_ERROR:{status:500,recovery:"recover_operation"}};function _r(e){return[400,405,415,422].includes(e)?"INVALID_REQUEST":e===401?"UNAUTHENTICATED":e===403?"FORBIDDEN":e===404?"NOT_FOUND":[409,412,425].includes(e)?"CONFLICT":e===413?"PAYLOAD_TOO_LARGE":e===429?"RATE_LIMITED":e===501?"NOT_CONFIGURED":[408,502,503,504].includes(e)?"SERVICE_UNAVAILABLE":"INTERNAL_ERROR"}var Ie={TIMEOUT:"recover_operation",NETWORK_ERROR:"recover_operation",HTTP_ERROR:"recover_operation",INVALID_RESPONSE:"recover_operation",NOT_IDENTIFIED:"authenticate",INVALID_TOKEN:"authenticate",INVALID_URL:"fix_request",INVALID_TIMEOUT:"fix_request",SERVER_ONLY:"fix_request",PROTOCOL_MISMATCH:"upgrade_sdk",IDENTITY_CHANGED:"reload_state",INVALID_STATE:"reload_state",EVENT_QUEUE_FULL:"retry_same_request",COMMAND_PENDING:"recover_operation",DECISION_PENDING:"recover_operation",DECISION_ACCEPTANCE_UNKNOWN:"recover_operation",RUN_RECONCILIATION_REQUIRED:"recover_operation",DECISION_FAILED:"contact_support",COMMAND_STORAGE_CONFLICT:"resolve_conflict",COMMAND_STORAGE_INVALID:"fix_request",CONFIGURATION_UNAVAILABLE:"check_availability",CONFIGURATION_EXPIRED:"reload_state",CONFIGURATION_CHANGED:"reload_state",CONFIGURATION_DISPOSED:"reload_state",UNSUPPORTED_SCHEMA:"upgrade_sdk",FUNNEL_STOPPED:"check_availability",PAYWALL_UNAVAILABLE:"check_availability",EVALUATION_MODE:"reload_state",SERVER_REQUIRED:"fix_request",STICKY_SAVE_FAILED:"retry_same_request",TRANSITION_LIMIT:"resolve_conflict",PRECONDITION_FAILED:"reload_state",PRODUCT_UNAVAILABLE:"fix_request",PURCHASE_HANDLER_REQUIRED:"fix_request",EVENT_HANDLER_REQUIRED:"fix_request",CLOSED:"fix_request",BRIDGE_UNAVAILABLE:"check_availability",INVALID_CONFIGURATION:"fix_request",NATIVE_OPERATION_FAILED:"contact_support",AI_PRICE_UNAVAILABLE:"fix_request",AI_USAGE_UNAVAILABLE:"recover_operation",AI_PROVIDER_ERROR:"check_availability",AI_BALANCE_REJECTED:"resolve_conflict"};function st(e,t){if(e==="CONFLICT"&&t===425)return{retryable:!0,recovery:"retry_same_request"};if(e==="CONFLICT"&&t===412)return{retryable:!1,recovery:"reload_state"};if(e==="INVALID_SERVER_RESPONSE")return{retryable:!1,recovery:"recover_operation"};if(e==="AMBIGUOUS_AUTHENTICATION")return{retryable:!1,recovery:"fix_request"};if(Object.hasOwn(Ie,e)){let i=Ie[e];return{retryable:i==="retry_same_request",recovery:i}}let n=te.safeParse(e);return n.success?{retryable:e==="RATE_LIMITED"||e==="SERVICE_UNAVAILABLE",recovery:Ee[n.data].recovery}:{retryable:!1,recovery:"contact_support"}}function Ir(e,t){let n=te.safeParse(e);if(n.success)return e==="CONFLICT"?[409,412,425].includes(t):e==="SERVICE_UNAVAILABLE"?[408,502,503,504].includes(t):e==="INVALID_REQUEST"?[400,405,415,422].includes(t):e==="NOT_CONFIGURED"?[501,503].includes(t):Ee[n.data].status===t;let i={INVALID_SERVER_RESPONSE:[502],RESPONSE_TOO_LARGE:[502],AMBIGUOUS_AUTHENTICATION:[400],BROWSER_REQUIRED:[403],INVALID_REDIRECT_URI:[403],AUTHORIZATION_UNAVAILABLE:[400],UNREGISTERED_CLIENT:[403],MANAGEMENT_OPERATION_FAILED:[400,422,500]};return Object.hasOwn(i,e)&&(i[e]?.includes(t)??!1)}function ct(e,t=Date.now()){if(e===null)return;let n=e.trim();if(/^\d+$/.test(n)){let a=Number(n);return Number.isSafeInteger(a)?a:void 0}if(!/^[A-Za-z]{3}, \d{2} [A-Za-z]{3} \d{4} \d{2}:\d{2}:\d{2} GMT$/.test(n))return;let i=Date.parse(n);return Number.isFinite(i)?Math.max(0,Math.ceil((i-t)/1e3)):void 0}var Ae=A.object({retryable:A.boolean(),recovery:ot,reason:at.optional(),retryAfterSeconds:A.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional()}),lt=A.object({requestId:A.uuid().optional(),error:A.object({code:A.string().regex(/^[A-Z][A-Z0-9_]{0,95}$/),message:A.string(),...Ae.partial().shape})}),Er=A.object({error:lt.shape.error.extend({requestId:A.uuid().optional()})}),Ar=A.object({error:A.string(),code:A.string().regex(/^[A-Za-z][A-Za-z0-9_]{0,95}$/),requestId:A.uuid(),...Ae.shape});function Nr(e,t,n={}){let i=st(e,t),a=n.reason==="RESULT_UNKNOWN"?"recover_operation":n.recovery??i.recovery,c=i.retryable&&n.retryable!==!1&&a!=="recover_operation",l=c?ct(n.retryAfter??null):void 0;return{...i,retryable:c,recovery:a,...l===void 0?{}:{retryAfterSeconds:l},...n.reason?{reason:n.reason}:{}}}import{z as ut}from"zod";var pt=["USD","EUR","CNY","GBP","JPY","CAD","AUD","NZD","CHF","HKD","SGD","KRW","INR","BRL","MXN","TWD","THB","IDR","MYR","PHP","VND","ZAR","AED","SAR","SEK","NOK","DKK","PLN","CZK","HUF","ILS","TRY","RON"],O=ut.enum(pt);function pe(e){let t=O.parse(e.toUpperCase());return["JPY","KRW","VND"].includes(t)?0:2}function kr(e,t){let n=pe(t),i=e.trim().match(/^(\d+)(?:\.(\d+))?$/);if(!i?.[1]||(i[2]?.length??0)>n)throw new Error("Amount has invalid currency precision");let a=BigInt(i[1])*BigInt(10**n)+BigInt((i[2]??"").padEnd(n,"0")||"0");if(a>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("Amount exceeds the supported range");return Number(a)}function Cr(e,t){if(!Number.isSafeInteger(e)||e<0)throw new Error("Expected a nonnegative integer amount");let n=pe(t),i=String(e).padStart(n+1,"0");return n?`${i.slice(0,-n)}.${i.slice(-n)}`:i}function Lr(e,t,n="en",i={}){let a=O.parse(t.toUpperCase());return new Intl.NumberFormat(n,{style:"currency",currency:a,...i}).format(e/10**pe(a))}import{z as _}from"zod";var re=_.string().regex(/^(0|[1-9]\d{0,12})(\.\d{1,12})?$/),E=_.string().regex(/^(0|[1-9]\d{0,11})(\.\d{1,6})?$/).transform(e=>e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e),mt=_.string().regex(/^-?(0|[1-9]\d{0,11})(\.\d{1,6})?$/).transform(e=>{let t=e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e;return t==="-0"?"0":t}),me=E.refine(e=>/[1-9]/.test(e),"\u6570\u91CF\u5FC5\u987B\u5927\u4E8E 0"),Ne=_.string().min(1).max(64),V=_.string().min(1).regex(/^[a-zA-Z0-9_-]+$/),Re=_.string().min(1).max(64).refine(e=>!e.includes("::"),"Dimension IDs cannot contain ::"),L=_.record(Ne,_.union([_.string().max(120),_.number().finite(),_.boolean()])).refine(e=>Object.keys(e).length<=16,"\u6700\u591A 16 \u4E2A\u8BA1\u4EF7\u5C5E\u6027").transform(e=>Object.fromEntries(Object.entries(e).map(([t,n])=>[t,String(n)]))),Oe=_.record(Ne,_.union([_.string().max(120),_.number().finite(),_.boolean()]).transform(String)).refine(e=>Object.keys(e).length<=8,"\u5339\u914D\u6761\u4EF6\u6700\u591A 8 \u4E2A\u5C5E\u6027"),q=e=>{let t=e.startsWith("-");t&&(e=e.slice(1));let[n,i=""]=e.split(".");if(n===void 0||n==="")throw new Error("Invalid decimal value");let a=BigInt(n)*BigInt("1000000")+BigInt(i.padEnd(6,"0"));return t?-a:a},ke=_.array(_.object({upTo:me.nullable(),cost:E}).strict()).min(1).max(12).refine(e=>e.at(-1)?.upTo===null&&e.slice(0,-1).every((t,n)=>{let i=e[n-1]?.upTo;return t.upTo!==null&&(n===0||i!=null&&q(t.upTo)>q(i))}),"\u9636\u68AF\u4E0A\u9650\u5FC5\u987B\u9012\u589E\uFF0C\u6700\u540E\u4E00\u6863\u4E3A\u65E0\u9650"),dt=_.object({key:Re,match:Oe,priority:_.number().int().default(0),cost:E.optional(),tiers:ke.optional()}).strict().refine(e=>e.cost!==void 0||e.tiers!==void 0,"\u7EF4\u5EA6\u9700\u8981\u6307\u5B9A\u5355\u4EF7\u6216\u9636\u68AF"),ft=_.object({key:Re,match:Oe,factor:me.optional(),add:mt.optional()}).strict().refine(e=>e.factor!==void 0||e.add!==void 0,"A multiplier needs a factor or an add").transform(e=>({...e,factor:e.factor??"1",add:e.add??"0"})),gt=_.object({units:me.default("1"),cost:E,tiers:ke.optional(),dimensions:_.array(dt).max(12).optional(),multipliers:_.array(ft).max(4).optional()}).strict().superRefine((e,t)=>{let n=e.dimensions??[],i=e.multipliers??[];(new Set(n.map(l=>l.key)).size!==n.length||new Set(i.map(l=>l.key)).size!==i.length)&&t.addIssue({code:"custom",message:"\u7EF4\u5EA6\u548C\u500D\u7387\u7684 ID \u4E0D\u80FD\u91CD\u590D"});for(let[l,d]of n.entries())for(let g of n.slice(l+1))Object.keys(d.match).length===Object.keys(g.match).length&&d.priority===g.priority&&!Object.keys(d.match).some(s=>g.match[s]!==void 0&&g.match[s]!==d.match[s])&&t.addIssue({code:"custom",message:"\u7EF4\u5EA6\u53EF\u80FD\u540C\u65F6\u5339\u914D\uFF0C\u8BF7\u8C03\u6574\u4F18\u5148\u7EA7"});let a=[e.cost,...(e.tiers??[]).map(l=>l.cost),...n.flatMap(l=>[...l.cost===void 0?[]:[l.cost],...(l.tiers??[]).map(d=>d.cost)])],c=q(e.units);for(let l of a)for(let d=0;d<1<<i.length;d++){let g=i.filter((v,R)=>d&1<<R);if(g.some((v,R)=>g.slice(R+1).some(_e=>Object.keys(v.match).some(le=>_e.match[le]!==void 0&&_e.match[le]!==v.match[le]))))continue;let s=q(l),p=BigInt("1"),b=BigInt("0");for(let[v,R]of i.entries())d&1<<v&&(s*=q(R.factor??"1"),p*=BigInt("1000000"),b+=q(R.add??"0"));let h=(s+b*p)*BigInt("1000000"),w=p*c;(h<BigInt("0")||h%w!==BigInt("0")||h/w>BigInt("999999999999999999"))&&t.addIssue({code:"custom",message:"\u6BCF\u4E2A\u4E1A\u52A1\u5355\u4F4D\u7684\u6700\u7EC8\u5355\u4EF7\u5FC5\u987B\u975E\u8D1F\u3001\u5728\u8303\u56F4\u5185\u4E14\u80FD\u7CBE\u786E\u8868\u793A\u4E3A\u6700\u591A 6 \u4F4D\u5C0F\u6570"})}}),Dr=gt.safeExtend({featureKey:V});import{z as bt}from"zod";var Le=/^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|[0-9]{3}))?$/,M=bt.string().max(16).regex(Le,"\u8BED\u8A00\u4EE3\u7801\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u4F8B\u5982 zh-CN\u3001en").refine(e=>{try{return Intl.getCanonicalLocales(e)[0]===e}catch{return!1}},"\u6301\u4E45\u5316\u8BED\u8A00\u4EE3\u7801\u5FC5\u987B\u4F7F\u7528\u89C4\u8303\u5199\u6CD5");function de(e){if(typeof e!="string")return null;try{let t=Intl.getCanonicalLocales(e.trim().replaceAll("_","-"))[0];if(!t)return null;let{language:n,script:i,region:a}=new Intl.Locale(t),c=[n,i,a].filter(Boolean).join("-");return Le.test(c)?c:null}catch{return null}}var yt=new Set(["TW","HK","MO"]);function Ce(e){let[t,n,i]=e.split("-");if(t!=="zh")return`${t}-${new Intl.Locale(e).maximize().script??""}`;let a=n?.length===4?n:void 0,c=n?.length===4?i:n;return a?`zh-${a}`:c&&yt.has(c)?"zh-Hant":"zh-Hans"}function Te(e,t,n){let i=t.map(a=>({code:M.parse(a),normalized:a}));for(let a of e){let c=de(a);if(!c)continue;let l=i.find(p=>p.normalized===c);if(l)return l.code;let d=Ce(c),g=i.filter(p=>Ce(p.normalized)===d),s=g.find(p=>!p.normalized.includes("-")||p.normalized===d)??g[0];if(s)return s.code}return n}var ht=[{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587\uFF08\u53F0\u7063\uFF09"},{code:"zh-HK",label:"\u7E41\u9AD4\u4E2D\u6587\uFF08\u9999\u6E2F\uFF09"},{code:"en",label:"English"},{code:"ja",label:"\u65E5\u672C\u8A9E"},{code:"ko",label:"\uD55C\uAD6D\uC5B4"},{code:"es",label:"Espa\xF1ol"},{code:"fr",label:"Fran\xE7ais"},{code:"de",label:"Deutsch"},{code:"pt-BR",label:"Portugu\xEAs (Brasil)"},{code:"it",label:"Italiano"},{code:"ru",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},{code:"vi",label:"Ti\u1EBFng Vi\u1EC7t"},{code:"th",label:"\u0E44\u0E17\u0E22"},{code:"id",label:"Bahasa Indonesia"},{code:"ar",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629"}];function wr(e){return ht.find(t=>t.code===e)?.label??e}import{z as u}from"zod";var $=E.refine(e=>/[1-9]/.test(e),"Quantity must be positive"),H=u.string().min(1).max(120),ne=u.enum(["cap","overflow"]),k=(e,t)=>{let[n,i=""]=e.split(".");if(n===void 0||n==="")throw new Error("Invalid decimal value");return BigInt(n)*10n**BigInt(t)+BigInt(i.padEnd(t,"0"))},K=e=>{try{return e()}catch{return!1}},$r=u.discriminatedUnion("operation",[u.object({operation:u.literal("quote"),overageBehavior:ne.optional(),internal_feature_id:u.uuid(),entityId:u.uuid().optional(),quantity:$,properties:L}).strict(),u.object({operation:u.literal("consume"),overageBehavior:ne.optional(),occurredAt:u.iso.datetime({offset:!0}).optional(),internal_feature_id:u.uuid(),entityId:u.uuid().optional(),quantity:E,properties:L,idempotencyKey:H}).strict(),u.object({operation:u.literal("reserve"),occurredAt:u.iso.datetime({offset:!0}).optional(),internal_feature_id:u.uuid(),entityId:u.uuid().optional(),quantity:$,properties:L,idempotencyKey:H,expiresInSeconds:u.number().int().min(1).max(86400)}).strict(),u.object({operation:u.literal("confirm"),operationId:u.uuid(),quantity:$,properties:L.optional(),idempotencyKey:H}).strict(),u.object({operation:u.literal("refund"),operationId:u.uuid(),quantity:$,idempotencyKey:H}).strict(),u.object({operation:u.literal("release"),operationId:u.uuid(),idempotencyKey:H}).strict()]),St=u.object({internal_credit_feature_id:u.uuid().nullable(),internal_metered_feature_id:u.uuid(),dimension:u.string().min(1).max(64),counterKey:u.string().min(1).max(240),cycleStart:u.iso.datetime({offset:!0}),unitCost:E,units:$,amount:re,tier:u.number().int().min(1).max(12).nullable()}).strict(),Q=u.string().regex(/^(0|[1-9]\d{0,17})(\.\d{1,12})?$/);function je(e,t){let n=e.reduce((i,a)=>i+k(a.units,12),0n)-k(t,12);return e.some(i=>i.funding==="balance")?n>=-100n&&n<=100n:n===0n}var De=u.discriminatedUnion("funding",[u.strictObject({funding:u.literal("balance"),sourceId:u.uuid(),rolloverId:u.uuid().nullable(),units:Q.refine(e=>/[1-9]/.test(e)),amount:re}),u.strictObject({funding:u.literal("unbilled"),units:Q.refine(e=>/[1-9]/.test(e))}),u.object({funding:u.literal("prepaid"),sourceId:u.uuid(),units:$,amount:re,pricing:u.array(St).min(1).max(12)}).strict().refine(e=>K(()=>e.pricing.reduce((t,n)=>t+k(n.units,6),0n)===k(e.units,6)&&e.pricing.reduce((t,n)=>t+k(n.amount,12),0n)===k(e.amount,12)&&e.pricing.every(t=>k(t.unitCost,6)*k(t.units,6)===k(t.amount,12))),"Frozen pricing must conserve allocated units and amounts"),u.object({funding:u.literal("postpaid"),invoiceLineId:u.uuid().nullable(),units:$,authorizationId:u.uuid()}).strict()]),ie=u.enum(["unavailable","insufficient_balance","limit_exceeded","awaiting_topup","authorization_required","payment_blocked","cash_budget_exceeded"]),Br=u.object({allowed:u.boolean(),internal_feature_id:u.uuid(),quantity:E,requestedQuantity:E.optional(),overageBehavior:ne.optional(),reason:ie.nullable(),allocations:u.array(De).max(500)}).strict().refine(e=>K(()=>e.allowed?e.reason===null&&je(e.allocations,e.quantity):e.reason!==null&&e.allocations.length===0),"A quote must conserve its accepted units").refine(e=>K(()=>e.overageBehavior===void 0?e.requestedQuantity===void 0&&/[1-9]/.test(e.quantity):e.requestedQuantity!==void 0&&k(e.requestedQuantity,6)>=k(e.quantity,6)&&(e.overageBehavior==="cap"||e.requestedQuantity===e.quantity)),"Explicit overage behavior must retain the requested quantity"),qr=u.object({id:u.uuid(),internal_feature_id:u.uuid(),kind:u.enum(["consume","reserve","confirm","refund","release","expire"]),originalId:u.uuid().nullable(),quantity:E,requestedQuantity:E.optional(),overageBehavior:ne.optional(),accepted:u.boolean(),reason:u.enum([...ie.options,"expired"]).nullable(),createdAt:u.iso.datetime({offset:!0}),reservationStatus:u.enum(["pending","confirmed","released","expired"]).nullable(),expiresAt:u.iso.datetime({offset:!0}).nullable(),allocations:u.array(De).max(500)}).strict().refine(e=>K(()=>e.accepted?e.reason===null&&je(e.allocations,e.quantity):e.reason!==null&&e.allocations.length===0),"An operation must conserve its requested units").refine(e=>K(()=>e.overageBehavior===void 0?e.requestedQuantity===void 0:e.kind==="consume"&&e.requestedQuantity!==void 0&&k(e.requestedQuantity,6)>=k(e.quantity,6)&&(e.overageBehavior==="cap"||e.requestedQuantity===e.quantity)),"Overage metadata belongs to consumption and preserves requested units").refine(e=>/[1-9]/.test(e.quantity)||e.kind==="consume","Only consumption can record a zero cost event").refine(e=>e.allocations.every(t=>t.funding!=="postpaid"||t.invoiceLineId!==null),"Accepted operations must reference persisted invoice lines").refine(e=>e.originalId!==null===["confirm","refund","release","expire"].includes(e.kind)&&e.expiresAt!==null==(e.reservationStatus!==null)&&(e.kind!=="reserve"||!e.accepted||e.reservationStatus!==null),"Operation provenance and reservation state must be explicit");import{z as T}from"zod";var xt=T.string().max(40).regex(/^(0|[1-9]\d*)(\.\d{1,12})?$/),_t=T.string().max(41).regex(/^-?(0|[1-9]\d*)(\.\d{1,12})?$/),ze=T.strictObject({internal_feature_id:T.uuid(),entityId:T.uuid().nullable()}),Gr=ze.extend({quantity:E,expectedRevision:T.number().int().min(0).max(Number.MAX_SAFE_INTEGER),idempotencyKey:T.string().min(1).max(120),properties:L.refine(e=>Object.keys(e).length<=13&&!Object.keys(e).some(t=>t.startsWith("usage_")),"Usage accounting reserves three properties")}).strict(),Pe=ze.extend({operationId:T.uuid().nullable(),usage:E,capacity:xt.nullable(),remaining:_t.nullable(),withinLimit:T.boolean(),revision:T.number().int().min(0).max(Number.MAX_SAFE_INTEGER),updatedAt:T.iso.datetime({offset:!0}).nullable()}).strict().superRefine((e,t)=>{let n=i=>{let a=i.startsWith("-"),[c,l=""]=(a?i.slice(1):i).split(".");if(c===void 0||c==="")throw new Error("Invalid decimal value");return(a?-1n:1n)*(BigInt(c)*10n**12n+BigInt(l.padEnd(12,"0")))};(e.capacity===null!=(e.remaining===null)||(e.capacity===null?!e.withinLimit:e.remaining===null||n(e.remaining)!==n(e.capacity)-n(e.usage)||e.withinLimit!==n(e.remaining)>=0n)||e.revision===0!=(e.operationId===null)||e.operationId===null!=(e.updatedAt===null))&&t.addIssue({code:"custom",message:"Absolute usage must conserve capacity and its immutable revision"})});import{z as o}from"zod";var P=o.string().regex(/^(0|[1-9]\d{0,17})(\.\d{1,12})?$/),j=o.iso.datetime({offset:!0}),It=o.enum(["access","metered","credit"]),W={internal_feature_id:o.uuid(),key:V,name:o.string().min(1).max(120),kind:It},Jr=o.object({customerId:o.uuid(),snapshotAt:j,memberships:o.array(o.object({id:o.uuid(),productId:o.string().min(1).max(255),productVersionId:o.uuid(),billingProductVersionId:o.uuid(),version:o.number().int().positive(),key:o.string().min(1).max(64),name:o.string().min(1).max(120),groupId:o.string().max(255).nullable(),membershipType:o.enum(["main","addon"]),status:o.enum(["trial","active","past_due","ended","expired","trialing","paused","pending","scheduled","unknown"]),cancelAtPeriodEnd:o.boolean(),accessEnabled:o.boolean(),renewalChange:o.object({productVersionId:o.uuid(),name:o.string().min(1).max(120),version:o.number().int().positive(),effectiveAt:j,benefitsAppliedAt:j.nullable(),timing:o.enum(["immediate","renewal"]),changeKind:o.enum(["plan","seats","quantity"]),feature:o.strictObject({internal_feature_id:o.uuid(),name:o.string().min(1).max(80),fromQuantity:o.number().int().min(0).max(1e4),toQuantity:o.number().int().min(0).max(1e4)}).optional(),seat:o.object({key:o.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/),fromQuantity:o.number().int().min(0).max(1e4),toQuantity:o.number().int().min(0).max(1e4)}).strict().nullable(),status:o.enum(["prepared","quoted","confirmed","pending","scheduled"])}).strict().refine(e=>e.changeKind==="seats"==(e.seat!==null)&&e.changeKind==="quantity"==(e.feature!==void 0),"Quantity changes require their fixed component identities and quantities").nullable(),period:o.object({phase:o.enum(["paid","trial"]),startsAt:j,endsAt:j.nullable()}).strict().nullable()}).strict()).max(100),membershipsLimited:o.boolean(),balances:o.array(o.object({...W,usageType:o.enum(["consumable","non_consumable"]).nullable(),accessible:o.boolean(),unlimited:o.boolean(),available:P,held:P,debt:P,nextExpiresAt:j.nullable(),usage:Pe.nullable()}).strict().refine(e=>e.kind==="metered"==(e.usageType!==null)&&(e.accessible||e.available==="0"&&e.held==="0")&&(e.usageType==="non_consumable"?e.usage!==null&&e.usage.internal_feature_id===e.internal_feature_id&&e.unlimited===(e.usage.capacity===null)&&e.available===(e.usage.remaining===null||e.usage.remaining.startsWith("-")?"0":e.usage.remaining)&&e.held==="0"&&e.debt==="0":e.usage===null),"Balances must expose their actual spendable or non-consumable state")).max(500),balancesLimited:o.boolean()}).strict(),we=o.enum(["source","usage","transaction","invoice","debt","settlement"]),oe=o.object({at:j,id:o.uuid(),type:we}).strict(),en=o.object({type:we.nullable(),resourceKey:V.optional(),kind:o.enum(["purchase","refund"]).optional(),topup:o.boolean().optional(),from:o.iso.date().nullable(),to:o.iso.date().nullable(),after:oe.nullable(),limit:o.number().int().min(1).max(50)}).strict().refine(e=>!e.from||!e.to||e.from<=e.to,"Date range is reversed"),F={id:o.uuid(),occurredAt:j},Et=o.discriminatedUnion("type",[o.strictObject({...F,type:o.literal("invoice"),status:o.string().min(1).max(80),paid:P,refunded:P,currency:O,externalId:o.string().nullable()}),o.object({...F,...W,type:o.literal("source"),reason:o.enum(["membership","trial","topup","manual","rollover","upgrade_carry","seat"]),quantity:P,unlimited:o.boolean(),status:o.enum(["scheduled","active","expired","revoked","unavailable"]),startsAt:j,expiresAt:j.nullable(),orderId:o.uuid().nullable(),parentSourceId:o.uuid().nullable()}).strict(),o.object({...F,type:o.literal("usage"),internal_feature_id:o.uuid(),name:o.string().min(1).max(120),kind:o.enum(["consume","set_usage","reserve","confirm","refund","release","expire"]),originalId:o.uuid().nullable(),quantity:E,accepted:o.boolean(),reason:o.enum([...ie.options,"expired"]).nullable(),properties:L,reservationStatus:o.enum(["pending","confirmed","released","expired"]).nullable(),expiresAt:j.nullable(),charges:o.array(o.discriminatedUnion("funding",[o.strictObject({funding:o.literal("balance"),sourceId:o.uuid(),rolloverId:o.uuid().nullable(),units:Q,amount:P}),o.strictObject({funding:o.literal("unbilled"),units:Q}),o.object({...W,funding:o.literal("prepaid"),amount:P}).strict(),o.object({funding:o.literal("postpaid"),invoiceId:o.uuid(),invoiceLineId:o.uuid(),authorizationId:o.uuid(),units:E,currency:O}).strict()])).max(500)}).strict().refine(e=>(e.kind==="set_usage"||e.kind==="consume"&&e.quantity==="0"?e.accepted&&e.reason===null&&e.charges.length===0&&e.reservationStatus===null:e.accepted?e.reason===null&&e.charges.length>0:e.reason!==null&&e.charges.length===0)&&e.originalId!==null===["confirm","refund","release","expire"].includes(e.kind)&&e.expiresAt!==null==(e.reservationStatus!==null),"Usage facts must retain their original outcome and receipt"),o.object({...F,type:o.literal("transaction"),purpose:o.enum(["product","invoice"]),productVersionId:o.uuid().nullable(),productName:o.string().min(1).max(120).nullable(),productVersion:o.number().int().positive().nullable(),invoiceId:o.uuid().nullable(),orderId:o.uuid(),originalId:o.uuid().nullable(),kind:o.enum(["purchase","refund"]),amountMinor:o.number().int().nonnegative().max(2e8).nullable(),currency:O.nullable()}).strict().refine(e=>e.currency===null==(e.amountMinor===null)&&(e.purpose==="product"?e.productVersionId!==null&&e.productName!==null&&e.productVersion!==null&&e.invoiceId===null:e.productVersionId===null&&e.productName===null&&e.productVersion===null&&e.invoiceId!==null)&&e.kind==="refund"==(e.originalId!==null)&&(e.kind!=="refund"||e.amountMinor===null||e.amountMinor>0),"Payment fact provenance is incomplete"),o.object({...F,...W,type:o.literal("debt"),sourceId:o.uuid(),transactionId:o.uuid(),amount:P}).strict(),o.object({...F,...W,type:o.literal("settlement"),sourceId:o.uuid(),debtId:o.uuid(),kind:o.enum(["payment","usage_refund","payment_return"]),amount:P}).strict()]),tn=o.object({customerId:o.uuid(),rows:o.array(Et).max(50),nextCursor:oe.nullable()}).strict().refine(e=>new Set(e.rows.map(t=>t.type+t.id)).size===e.rows.length,"A page cannot repeat a fact").refine(e=>{let t=e.rows.at(-1);return!e.nextCursor||!!(t&&t.id===e.nextCursor.id&&t.type===e.nextCursor.type&&t.occurredAt===e.nextCursor.at)},"Cursor must name the final displayed fact");import{z as Z}from"zod";var ve=Z.enum(["stripe","apple","google"]),on=Z.enum(["membership","credit_pack","lifetime"]),an=Z.enum(["active","grace","suspended","inactive","revoked"]),sn=Z.strictObject({currency:Z.string().regex(/^[A-Z]{3}$/),micros:Z.string().regex(/^(0|[1-9][0-9]{0,29})$/)});import{z as At}from"zod";var Ue=At.object({provider:ve,currency:O}).strict();import{z as x}from"zod";var Ve=x.strictObject({internal_feature_id:x.uuid(),quantity:E.refine(e=>/[1-9]/.test(e)),properties:L,entityId:x.uuid().optional()}),yn=x.strictObject({requirement:Ve,commerce:Ue.optional(),paywallId:x.uuid().optional()}),Nt=x.enum(["not_entitled","insufficient_balance","capacity_exceeded","limit_exceeded","awaiting_topup","authorization_required","payment_blocked","cash_budget_exceeded","unavailable","authentication_required"]),Rt=x.strictObject({productId:x.string().min(1),productVersionId:x.string().min(1),name:x.string().min(1).max(120),action:x.enum(["purchase","upgrade","addon","topup"]),membershipId:x.string().min(1).nullable(),currency:O,amountMinor:x.string().regex(/^(0|[1-9]\d{0,8})$/),interval:x.enum(["free","week","month","year","one_time"]),intervalCount:x.number().int().min(1).max(156)}),$e=x.strictObject({internal_feature_id:x.string().min(1),name:x.string().min(1).max(120),kind:x.enum(["access","metered","credit"]),quantity:E,allowed:x.boolean(),reason:Nt.nullable(),preview:x.strictObject({scenario:x.enum(["feature_flag","usage_limit"]),candidates:x.array(Rt).max(20)}).nullable()}).superRefine((e,t)=>{(e.allowed!==(e.reason===null)||e.allowed&&e.preview!==null||new Set(e.preview?.candidates.map(n=>n.productVersionId)).size!==(e.preview?.candidates.length??0)||e.preview?.candidates.some(n=>n.action==="upgrade"!=(n.membershipId!==null)))&&t.addIssue({code:"custom",message:"Invalid access recommendation"})}),hn=x.strictObject({paywallId:x.uuid(),requirement:Ve});import{z as f}from"zod";var Ot=["plan.name","plan.price","plan.period","plan.price_per_month","trial.headline","trial.terms","offer.headline","offer.name","offer.description","offer.eligibility","offer.validity","offer.terms","offer.discount","offer.price","offer.original_price","offer.months","offer.code","offer.ends_at","offer.expires_at","paywall.feature","paywall.message","paywall.action"],fe=f.object({plan:f.string().min(1).max(200).optional(),coupon:f.uuid().optional(),promotionCode:f.uuid().optional(),picker:f.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/).optional()}).strict(),Be=f.object({text:f.string().optional(),label:f.string().optional(),alt:f.string().optional(),html:f.string().max(32768).optional(),price:f.object({current:f.string(),original:f.string().nullable(),period:f.string()}).optional(),code:f.string().optional(),countdownAt:f.iso.datetime().optional(),planId:f.string().min(1).max(200).optional(),planVersionId:f.string().min(1).max(200).optional(),currency:O.optional(),couponId:f.uuid().optional(),offerId:f.uuid().optional(),unavailable:f.boolean().optional(),unavailableReason:f.string().optional(),missing:f.array(f.string()).optional()}).strict(),En=f.object({paywall:$e.optional(),nodes:f.record(f.string(),f.object({base:Be,picker:f.string().optional(),byPlan:f.record(f.string(),Be).optional()}).strict()),plans:f.record(f.string(),f.object({id:f.string().min(1).max(200),versionId:f.string().min(1).max(200),available:f.boolean(),name:f.string(),price:f.string(),period:f.string(),currency:O.optional()}).strict()),pickers:f.record(f.string(),f.object({options:f.array(f.string().min(1).max(200)).max(20),selected:f.string().min(1).max(200).nullable()}).strict()),diagnostics:f.array(f.object({nodeId:f.string(),message:f.string()}).strict())}).strict();function ae(e){return[...e.matchAll(/\{\{\s*([^{}]+?)\s*\}\}/g)].flatMap(t=>t[1]===void 0?[]:[t[1].trim()])}function se(e){let t=ae(e).filter(i=>!Ot.includes(i)&&!/^variables\.[A-Za-z0-9_][A-Za-z0-9_.:-]*$/.test(i)),n=e.replace(/\{\{\s*[^{}]+?\s*\}\}/g,"");return(n.includes("{{")||n.includes("}}"))&&t.push("\u65E0\u6548\u53D8\u91CF\u8BED\u6CD5"),[...new Set(t)]}function An(e,t,n,i=!1){let a=ae(e).filter(c=>!/^variables\.[A-Za-z0-9_][A-Za-z0-9_.:-]*$/.test(c)&&t[c]===void 0);return a.length&&!i?{value:n,missing:a}:{value:e.replace(/\{\{\s*([^{}]+?)\s*\}\}/g,(c,l)=>t[l.trim()]??c),missing:a}}function Nn(e,t,n={}){let i=e?.nodes[t];if(!i)return;let a=i.picker?n[i.picker]??e?.pickers[i.picker]?.selected:void 0;return typeof a=="string"?i.byPlan?.[a]??i.base:i.base}function qe(e){return e.type==="stack"&&e.interaction?.type==="select"&&e.interaction.purpose==="product"&&!!e.interaction.pickerId}function ce(e){let t={};function n(i){if(qe(i)){let a=t[i.interaction.pickerId]??={ids:[],defaultId:null};for(let l of i.children){let d=l.type==="stack"?l.bind?.plan:void 0;d&&!a.ids.includes(d)&&a.ids.push(d)}let c=i.children[i.interaction.defaultIndex];!a.defaultId&&c?.type==="stack"&&(a.defaultId=c.bind?.plan??null)}i.type==="stack"&&i.children.forEach(n)}return e.pages.forEach(i=>n(i.root)),t}function Me(e,t,n){let i={};function a(g){if(g.hidden)return;if(g.type==="plan_picker"){let b=n.pickers[g.id];i[g.id]={ids:b?.options??[],defaults:b?.selected?[b.selected]:[],remembered:[]};return}if(g.type!=="stack")return;let s=g.children.filter(b=>!b.hidden),p=g.interaction;if(qe(g)){let b=i[g.interaction.pickerId]??={ids:[],defaults:[],remembered:[]},h=n.pickers[g.interaction.pickerId]?.options??[];for(let v of s){let R=v.type==="stack"?v.bind?.plan:void 0;R&&h.includes(R)&&!b.ids.includes(R)&&b.ids.push(R),R&&v.id===t[g.id]&&b.remembered.push(R)}let w=g.children[g.interaction.defaultIndex];w?.type==="stack"&&!w.hidden&&w.bind?.plan&&b.defaults.push(w.bind.plan)}if(p?.type==="tabs"){let b=s.find(h=>h.id===t[g.id])??g.children[p.defaultIndex];b&&a(b)}else if(p?.type==="toggle"){let b=typeof t[g.id]=="boolean"?t[g.id]:p.defaultEnabled,h=g.children[b?0:1];h&&a(h)}else s.forEach(a)}let c=typeof t.__page=="string"?t.__page:e.initialPageId??e.pages[0]?.id,l=e.pages.find(g=>g.id===c);l&&a(l.root);let d={};for(let[g,s]of Object.entries(i)){let p=t[g],b=s.remembered[0]??(s.ids.includes(n.pickers[g]?.selected??"")?n.pickers[g]?.selected:s.defaults[0]);d[g]=typeof p=="string"?s.ids.includes(p)?p:"":b&&s.ids.includes(b)?b:""}for(let g of Object.keys(ce(e)))d[g]??="";return d}import{z as U}from"zod";var Fe=U.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),Ze=U.strictObject({tiers:U.array(U.strictObject({id:Fe,name:U.string().trim().min(1).max(80)})).min(1).max(8),assignments:U.array(U.strictObject({productVersionId:U.string().min(1).max(200),tierId:Fe,period:U.enum(["month","year"])})).max(20)}).superRefine((e,t)=>{let n=e.tiers.map(i=>i.id);(new Set(n).size!==n.length||new Set(e.assignments.map(i=>i.productVersionId)).size!==e.assignments.length||new Set(e.assignments.map(i=>`${i.tierId}:${i.period}`)).size!==e.assignments.length||e.assignments.some(i=>!n.includes(i.tierId)))&&t.addIssue({code:"custom",message:"Each product and tier/period cell must have one unambiguous assignment"})});function Ge(e,t){return e.assignments.length===t.length&&e.assignments.every(n=>t.includes(n.productVersionId))}import{z as m}from"zod";var kt=["credit_balance","credit_transactions","membership","billing","billing_controls","customer_plans","credit_packs","credit_pack_orders","offer_history"],He=m.enum(kt),Ke=m.object({source:He,layout:m.enum(["full","compact"]),resourceKey:V.optional(),pageSize:m.number().int().min(1).max(50),showSources:m.boolean(),allowPurchase:m.boolean(),outputs:m.object({billing_adjustment:m.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/).optional(),billing_authorization:m.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/).optional(),buy_pack:m.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/).optional(),billing_portal:m.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/).optional(),cancel_membership:m.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/).optional(),resume_membership:m.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/).optional()}).strict().optional()}).strict().superRefine((e,t)=>{(e.outputs?.billing_authorization||e.outputs?.billing_adjustment)&&e.source!=="billing_controls"&&t.addIssue({code:"custom",message:"Payment authorization routes belong to the billing controls component."}),e.resourceKey&&!["credit_balance","credit_transactions"].includes(e.source)&&t.addIssue({code:"custom",message:"\u8FD9\u4E2A\u6570\u636E\u6E90\u4E0D\u80FD\u7ED1\u5B9A\u79EF\u5206\u8D44\u6E90\u3002"}),e.showSources&&e.source!=="credit_balance"&&t.addIssue({code:"custom",message:"\u53EA\u6709\u79EF\u5206\u4F59\u989D\u53EF\u4EE5\u5C55\u5F00\u6765\u6E90\u3002"}),e.allowPurchase&&!["credit_packs","customer_plans","membership"].includes(e.source)&&t.addIssue({code:"custom",message:"\u53EA\u6709\u79EF\u5206\u5305\u3001\u5957\u9910\u4E0E\u4F1A\u5458\u7EC4\u4EF6\u53EF\u4EE5\u542F\u7528\u4EA4\u6613\u3002"})}),N=m.string().max(2e3),Qe=m.object({id:m.string().max(100),label:N,detail:m.array(N).max(12),value:N.optional(),status:N.optional(),facts:m.array(m.object({label:N,value:N}).strict()).max(1e3),purchaseId:m.uuid().optional(),invoiceUrl:m.url().max(2048).refine(e=>{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}).optional(),billingActions:m.array(m.strictObject({action:m.literal("invoice_open"),label:N})).max(1).optional(),membershipActions:m.array(m.object({value:m.string().max(100),label:N}).strict()).max(3).optional()}).strict(),Ct=m.object({key:V,name:N,spendable:N,reserved:N,available:N,expiry:N.nullable(),sources:m.array(Qe).max(50),sourceCount:m.number().int().nonnegative(),sourcePage:m.number().int().positive(),hasNextSources:m.boolean(),hasPreviousSources:m.boolean()}).strict(),Lt=m.object({source:He,status:m.enum(["idle","loading","ready","error"]),stale:m.boolean(),preview:m.boolean(),errorCode:m.string().max(80).optional(),errorMessage:N.optional(),resources:m.array(Ct).max(500),rows:m.array(Qe).max(50),hasNext:m.boolean(),hasPrevious:m.boolean(),page:m.number().int().positive(),filter:m.string().max(40),updatedAt:m.iso.datetime().optional(),buyingId:m.uuid().optional(),membershipBusy:m.boolean().optional(),billingBusy:m.boolean().optional(),membershipReview:m.object({title:N,note:N,facts:m.array(m.object({label:N,value:N}).strict()).max(100)}).strict().optional(),membershipResult:N.optional()}).strict(),jn=m.object({nodes:m.record(m.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),Lt)}).strict(),Dn=m.object({nodeId:m.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),action:m.enum(["refresh","next","previous","filter","buy_pack","billing_portal","billing_authorization","billing_adjustment","invoice_open","membership_preview","membership_confirm","membership_dismiss","sources_next","sources_previous"]),value:m.string().max(100).optional()}).strict();function zn(e){return{source:e,status:"idle",stale:!0,preview:!1,resources:[],rows:[],hasNext:!1,hasPrevious:!1,page:1,filter:"all"}}function ge(e){let t=se(e).map(n=>`\u672A\u77E5\u53D8\u91CF\uFF1A${n}`);for(let n=0;n<e.length;n++){if(e[n]!=="<"||!/[A-Za-z!/?{]/.test(e[n+1]??""))continue;let i=n;if(e.startsWith("<!--",n)){let a=e.indexOf("-->",n+4);n=a<0?e.length:a+2}else{let a="";for(n++;n<e.length;n++){let c=e[n];if(a)c===a&&(a="");else if(c==='"'||c==="'")a=c;else if(c===">")break}}/\{\{|\}\}/.test(e.slice(i,n+1))&&t.push("\u53D8\u91CF\u53EA\u80FD\u653E\u5728 HTML \u6587\u5B57\u4E2D\uFF0C\u4E0D\u80FD\u653E\u5165\u6807\u7B7E\u3001\u5C5E\u6027\u6216\u6CE8\u91CA")}return[...new Set(t)]}function We(e){return e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function vn(e,t,n,i=!1){let a=ge(e);if(a.length)throw new Error(a[0]);let c=[...new Set(ae(e).filter(l=>!l.startsWith("variables.")&&t[l]===void 0))];return c.length&&!i?{value:We(n),missing:c}:{value:e.replace(/\{\{\s*([^{}]+?)\s*\}\}/g,(l,d)=>t[d.trim()]===void 0?l:We(t[d.trim()])),missing:c}}import{z as r}from"zod";var Tt=4,z={nodes:150,depth:8,children:50,locales:20,actions:40,pages:10,stringLength:2e3,customHtml:32768,customCss:16384,documentBytes:2e5},X=r.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),S=r.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/),jt=r.enum(["none","xs","sm","md","lg","xl"]),Dt=r.enum(["none","sm","md","lg","full"]),be=r.string().regex(/^#[0-9a-fA-F]{6}$/),Je=r.string().max(2048).refine(e=>{try{let t=new URL(e);return t.protocol==="https:"&&t.hostname.length>0}catch{return!1}},"\u53EA\u652F\u6301 https \u94FE\u63A5"),ye=r.union([Je,r.string().max(32768).regex(/^data:image\/svg\+xml;base64,[A-Za-z0-9+/]+={0,2}$/),r.string().max(131072).regex(/^data:image\/jpeg;base64,\/9j\/[A-Za-z0-9+/]+={0,2}$/),r.string().max(131072).regex(/^data:image\/png;base64,iVBORw0KGgo[A-Za-z0-9+/]+={0,2}$/)]),Ye=r.object({primary:be,background:be,text:be,radius:Dt,font:r.enum(["system","serif","rounded","mono"])}).strict(),J=r.union([r.enum(["primary","text","muted","background","surface"]),r.string().regex(/^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/)]),y=(e,t)=>r.number().int().min(e).max(t),Xe=r.union([r.enum(["fit","fill"]),y(1,1200)]),zt=r.object({top:y(0,200),right:y(0,200),bottom:y(0,200),left:y(0,200)}).strict(),Pt=r.object({top:y(-100,200),right:y(-100,200),bottom:y(-100,200),left:y(-100,200)}).strict(),et=r.object({x:y(0,100),y:y(0,100)}).strict(),wt=r.discriminatedUnion("type",[r.object({type:r.literal("color"),color:J}).strict(),r.object({type:r.literal("linear"),angle:y(0,360),stops:r.array(r.object({color:J,at:y(0,100)}).strict()).min(2).max(4)}).strict(),r.object({type:r.literal("image"),src:ye,fit:r.enum(["cover","contain"]),position:et.optional()}).strict()]),vt=r.discriminatedUnion("type",[r.object({type:r.literal("rect"),radius:r.union([y(0,200),r.object({topLeft:y(0,200),topRight:y(0,200),bottomRight:y(0,200),bottomLeft:y(0,200)}).strict()])}).strict(),r.object({type:r.literal("pill")}).strict()]),Ut=r.object({width:y(0,12),color:J,style:r.enum(["solid","dashed"])}).strict(),Vt=r.object({x:y(-40,40),y:y(-40,40),blur:y(0,80),spread:y(-20,40),color:J}).strict(),$t=r.object({font:r.enum(["system","serif","rounded","mono"]),size:y(8,96),weight:r.number().int().min(100).max(900).multipleOf(100),lineHeight:r.number().min(.8).max(3),letterSpacing:r.number().min(-5).max(20),color:J,align:r.enum(["start","center","end"]),italic:r.boolean(),decoration:r.enum(["none","underline","line-through"]),transform:r.enum(["none","uppercase"])}).strict().partial(),B=r.object({width:Xe,height:Xe,padding:zt,margin:Pt,gap:y(0,120),grow:r.union([r.boolean(),r.number().min(0).max(12)]),background:wt,opacity:r.number().min(0).max(1),clipContent:r.boolean(),shape:vt,border:Ut,shadow:Vt,text:$t}).strict().partial(),C={id:X,name:r.string().trim().min(1).max(60).optional(),hidden:r.boolean().optional(),style:B.optional(),fallback:S.optional()},Bt=r.object({...C,type:r.literal("text"),productField:r.enum(["name","price","trial","period"]).optional(),feature:r.object({id:r.uuid(),field:r.enum(["name","allowance"])}).strict().optional(),text:S,variant:r.enum(["title","heading","body","caption"])}).strict(),qt=r.object({...C,type:r.literal("image"),src:ye,localizedSrc:r.record(M,ye).optional(),alt:S,aspect:r.enum(["auto","1:1","4:3","16:9","3:1"]),fit:r.enum(["cover","contain"]),position:et.optional()}).strict(),Mt=r.object({...C,type:r.literal("button"),label:S,variant:r.enum(["primary","secondary","link"]),action:S,purpose:r.enum(["purchase","navigation","close"]).optional(),bind:fe.optional()}).strict(),Ft=r.object({...C,type:r.literal("divider")}).strict(),Zt=r.object({...C,type:r.literal("customer_data"),title:S,data:Ke}).strict(),Gt=r.object({...C,type:r.literal("spacer"),size:jt}).strict(),Ht=r.object({...C,type:r.literal("custom_html"),html:r.record(M,r.string().max(z.customHtml)),css:r.string().max(z.customCss)}).strict(),Kt=r.object({...C,type:r.literal("price"),fallback:S,parts:r.object({current:B.optional(),original:B.optional(),period:B.optional()}).strict().optional()}).strict(),Qt=r.object({...C,type:r.literal("coupon_code"),label:S,fallback:S}).strict(),Wt=r.object({...C,type:r.literal("countdown"),source:r.enum(["offer.ends_at","offer.expires_at","fixed"]),at:r.iso.datetime().optional(),granularity:r.enum(["day","hour","minute","second"]),expired:S,fallback:S}).strict().refine(e=>e.source!=="fixed"||!!e.at,"\u56FA\u5B9A\u5012\u8BA1\u65F6\u9700\u8981\u7ED3\u675F\u65F6\u95F4"),Yt=r.object({...C,type:r.literal("plan_picker"),label:S,fallback:S,planIds:r.array(r.string().min(1).max(200)).min(1).max(20).refine(e=>new Set(e).size===e.length,"\u5957\u9910\u4E0D\u80FD\u91CD\u590D").optional(),defaultPlan:r.string().min(1).max(200).optional(),grouping:Ze.safeExtend({monthLabel:S,yearLabel:S,unavailableLabel:S}).optional(),states:r.object({selected:B.optional()}).strict().optional()}).strict().superRefine((e,t)=>{e.grouping&&(!e.planIds||!Ge(e.grouping,e.planIds))&&t.addIssue({code:"custom",message:"Grouped picker assignments must match its product allowlist"})}),Xt=r.discriminatedUnion("type",[r.object({type:r.literal("input"),label:S,keyboard:r.enum(["text","email","tel","url"]),maxLength:y(1,500)}).strict(),r.object({type:r.literal("multiselect"),label:S,min:y(0,50),max:y(1,50)}).strict(),r.object({type:r.literal("select"),label:S,defaultIndex:y(0,49),purpose:r.enum(["option","product","tier"]).optional(),pickerId:X.optional(),selectedStyle:B.optional()}).strict(),r.object({type:r.literal("tabs"),label:S,defaultIndex:y(0,49),purpose:r.literal("tier").optional()}).strict(),r.object({type:r.literal("toggle"),label:S,defaultEnabled:r.boolean()}).strict(),r.object({type:r.literal("carousel"),label:S}).strict()]),D={...C,type:r.literal("stack"),direction:r.enum(["vertical","horizontal","overlay"]),align:r.enum(["start","center","end","stretch"]),justify:r.enum(["start","center","end","between"]),productSlot:r.object({index:y(0,19),period:r.enum(["month","year"]).optional(),requireBinding:r.boolean().optional()}).strict().optional(),interaction:Xt.optional(),states:r.object({selected:B.optional()}).strict().optional(),purpose:r.literal("benefits").optional(),purchaseAction:S.optional(),buttonVariant:r.enum(["primary","secondary","link"]).optional(),bind:fe.optional()},tt=r.lazy(()=>r.object({...C,type:D.type,direction:D.direction,align:D.align,justify:D.justify,children:r.array(Jt).max(z.children),productSlot:D.productSlot,interaction:D.interaction,states:D.states,purpose:D.purpose,purchaseAction:D.purchaseAction,buttonVariant:D.buttonVariant,bind:D.bind}).strict()),Jt=r.lazy(()=>r.union([tt,Bt,qt,Mt,Ft,Gt,Ht,Kt,Qt,Wt,Yt,Zt])),er=r.union([r.string().max(500),r.number().finite(),r.boolean(),r.null()]),Y={id:S,event:S,properties:r.record(S,er).refine(e=>Object.keys(e).length<=20,"\u6700\u591A 20 \u4E2A\u53C2\u6570")},tr=r.discriminatedUnion("type",[r.object({...Y,type:r.literal("navigate"),close:r.literal(!1),pageId:X}).strict(),r.object({...Y,type:r.literal("event"),close:r.boolean()}).strict(),r.object({...Y,type:r.literal("close"),close:r.literal(!0)}).strict(),r.object({...Y,type:r.literal("open_url"),close:r.boolean(),url:Je}).strict(),r.object({...Y,type:r.literal("claim_offer"),close:r.boolean(),couponId:r.uuid()}).strict()]),rr=r.object({defaultLocale:M,locales:r.record(M,r.record(S,r.string().max(z.stringLength)))}).strict(),nr=r.enum(["popup","paywall","onboarding","page","banner"]),Gn={popup:"/workspace/popups",paywall:"/workspace/paywalls",onboarding:"/workspace/funnels",page:"/workspace/pages",banner:"/workspace/banners"},ir=r.discriminatedUnion("type",[r.object({type:r.literal("modal"),size:r.enum(["sm","md","lg"])}).strict(),r.object({type:r.literal("sheet"),size:r.enum(["sm","md","lg"])}).strict(),r.object({type:r.literal("fullscreen")}).strict(),r.object({type:r.literal("inline")}).strict()]),Hn={sm:360,md:420,lg:560},or=r.object({kind:r.literal("screen"),schemaVersion:r.literal(Tt),name:r.string().trim().min(1).max(80),surface:nr,initialPageId:X.optional(),presentation:ir,theme:Ye,pages:r.array(r.object({id:X,name:r.string().trim().min(1).max(60),root:tt,theme:Ye.optional(),editorPosition:r.object({x:r.number().finite().min(-1e5).max(1e5),y:r.number().finite().min(-1e5).max(1e5)}).strict().optional()}).strict()).min(1).max(z.pages),strings:rr,actions:r.array(tr).max(z.actions)}).strict();function G(e,t){for(let n of e.pages)ee(n.root,t)}function Kn(e,t){return{...e,pages:e.pages.map((n,i)=>i===0?{...n,root:t}:n)}}var ar=or.superRefine((e,t)=>{let n=z;e.surface!=="paywall"&&e.pages.length!==1&&t.addIssue({code:"custom",message:"Only a Paywall can contain multiple screens"}),e.initialPageId&&!e.pages.some(p=>p.id===e.initialPageId)&&t.addIssue({code:"custom",message:"Initial screen does not exist"});for(let p of e.actions)p.type==="navigate"&&(e.surface!=="paywall"||!e.pages.some(b=>b.id===p.pageId))&&t.addIssue({code:"custom",message:"Navigation screen does not exist"});e.pages.length>n.pages&&t.addIssue({code:"custom",message:`\u9875\u9762\u6700\u591A ${n.pages} \u4E2A`}),e.actions.length>n.actions&&t.addIssue({code:"custom",message:`\u52A8\u4F5C\u6700\u591A ${n.actions} \u4E2A`});let i=p=>t.addIssue({code:"custom",message:p}),a=Object.keys(e.strings.locales);a.includes(e.strings.defaultLocale)||i("\u9ED8\u8BA4\u8BED\u8A00\u5FC5\u987B\u5728\u8BED\u8A00\u5217\u8868\u91CC"),a.length>z.locales&&i(`\u6700\u591A ${z.locales} \u79CD\u8BED\u8A00`);let c=new Set;for(let p of e.actions)c.has(p.id)&&i(`\u52A8\u4F5C\u6807\u8BC6\u91CD\u590D\uFF1A${p.id}`),c.add(p.id);let l=new Set;for(let p of e.pages)["next","back"].includes(p.id)&&i(`\u9875\u9762 id \u4E0D\u80FD\u4F7F\u7528\u4FDD\u7559\u540D\u79F0\uFF1A${p.id}`),l.has(p.id)&&i(`\u9875\u9762 id \u91CD\u590D\uFF1A${p.id}`),l.add(p.id);let d=new Set,g=0,s=!1;G(e,(p,b)=>{if(g++,b>z.depth&&(s=!0),d.has(p.id)&&i(`\u7EC4\u4EF6 id \u91CD\u590D\uFF1A${p.id}`),d.add(p.id),p.type==="button"&&!c.has(p.action)&&i(`\u6309\u94AE ${p.id} \u5F15\u7528\u7684\u52A8\u4F5C\u4E0D\u5B58\u5728\uFF1A${p.action}`),p.type==="custom_html")for(let h of Object.keys(p.html))a.includes(h)||i(`\u81EA\u5B9A\u4E49 HTML ${p.id} \u542B\u6709\u672A\u542F\u7528\u7684\u8BED\u8A00\uFF1A${h}`);if(p.type==="image")for(let h of Object.keys(p.localizedSrc??{}))a.includes(h)||i(`\u56FE\u7247 ${p.id} \u542B\u6709\u672A\u542F\u7528\u7684\u8BED\u8A00\uFF1A${h}`)}),g>n.nodes&&i(`\u7EC4\u4EF6\u6700\u591A ${n.nodes} \u4E2A`),s&&i(`\u5C42\u7EA7\u6700\u591A ${z.depth} \u5C42`)});function ee(e,t,n=1,i=null){if(t(e,n,i)!==!1&&e.type==="stack")for(let a of e.children)ee(a,t,n+1,e)}function Se(e){let t=[],n=new Set;return G(e,i=>{let a=(c,l,d)=>{n.has(c)||(n.add(c),t.push({key:c,nodeId:i.id,nodeType:i.type,field:l,required:d}))};i.type==="stack"&&i.interaction&&a(i.interaction.label,"label",!0),i.fallback&&a(i.fallback,"text",!0),i.type==="text"&&a(i.text,"text",!0),i.type==="customer_data"&&a(i.title,"title",!0),(i.type==="plan_picker"||i.type==="coupon_code")&&a(i.label,"label",!0),i.type==="plan_picker"&&i.grouping&&(a(i.grouping.monthLabel,"label",!0),a(i.grouping.yearLabel,"label",!0),a(i.grouping.unavailableLabel,"text",!0)),i.type==="countdown"&&a(i.expired,"text",!0),i.type==="button"&&a(i.label,"label",!0),i.type==="image"&&(a(`image:${i.id}`,"src",!1),a(i.alt,"alt",!1)),i.type==="custom_html"&&a(`html:${i.id}`,"html",!0)}),t}function sr(e,t,n){if(t.field==="html"){let i;return G(e,a=>{a.id===t.nodeId&&a.type==="custom_html"&&(i=a.html[n])}),i}if(t.field==="src"){let i=he(e,t.nodeId);return i?.type==="image"?i.localizedSrc?.[n]??(n===e.strings.defaultLocale?i.src:void 0):void 0}return e.strings.locales[n]?.[t.key]}function rt(e){let t=Se(e).filter(i=>i.required);return Object.keys(e.strings.locales).sort((i,a)=>i===e.strings.defaultLocale?-1:a===e.strings.defaultLocale?1:0).map(i=>{let a=t.filter(c=>!sr(e,c,i)?.trim()).map(c=>c.key);return{locale:i,total:t.length,filled:t.length-a.length,missing:a,complete:a.length===0}})}function Qn(e){return nt(e,!0)}function Wn(e){return nt(e,!1)}function nt(e,t){let n=[],i=t&&e.actions.some(s=>typeof s.properties.templateKey=="string"&&s.properties.templateKey.startsWith("popup-coupon-"));i&&(!e.actions.some(s=>s.type==="claim_offer")||e.actions.some(s=>s.type==="event"&&typeof s.properties.templateKey=="string"&&s.properties.templateKey.startsWith("popup-coupon-")))&&n.push("\u4F18\u60E0\u5F39\u7A97\u6A21\u677F\u5C1A\u672A\u7ED1\u5B9A\u771F\u5B9E\u4F18\u60E0\u5238\uFF1A\u8BF7\u5C06\u9886\u53D6\u6309\u94AE\u8BBE\u4E3A\u300C\u9886\u53D6\u4F18\u60E0\u300D\u5E76\u9009\u62E9\u751F\u6548\u4E2D\u7684\u5238");function a(s,p){let b=s.type==="stack"||s.type==="button"?s.bind?.coupon??p:p;if(i&&s.type==="text"&&Object.values(e.strings.locales).some(h=>h[s.text]?.includes("{{offer."))&&!b&&n.push("\u4F18\u60E0\u5F39\u7A97\u6A21\u677F\u5C1A\u672A\u7ED1\u5B9A\u771F\u5B9E\u4F18\u60E0\u5238\uFF1A\u52A8\u6001\u6587\u6848\u9700\u8981\u7EE7\u627F\u4F18\u60E0\u5238\u7ED1\u5B9A"),s.type==="button"){let h=e.actions.find(w=>w.id===s.action);h?.type==="claim_offer"&&b&&b!==h.couponId&&n.push(`\u9886\u53D6\u6309\u94AE ${s.id} \u4E0E\u5C55\u793A\u5185\u5BB9\u7ED1\u5B9A\u4E86\u4E0D\u540C\u7684\u4F18\u60E0\u5238`)}s.type==="stack"&&s.children.forEach(h=>a(h,b))}e.pages.forEach(s=>a(s.root));let c=[],l=ar.safeParse(e);l.success||n.push(...l.error.issues.map(s=>s.message));for(let s of Object.values(e.strings.locales))for(let p of Object.values(s))for(let b of se(p))n.push(`\u672A\u77E5\u53D8\u91CF\uFF1A${b}`);G(e,s=>{if(s.type==="customer_data"&&Object.values(e.strings.locales).some(b=>/\{\{|\}\}/.test(b[s.title]??""))&&n.push(`\u6570\u636E\u7EC4\u4EF6 ${s.id} \u7684\u6807\u9898\u9700\u8981\u4F7F\u7528\u9759\u6001\u6587\u5B57`),(s.type==="text"?[s.text]:s.type==="button"?[s.label]:[]).some(b=>Object.values(e.strings.locales).some(h=>h[b]?.includes("{{")))&&!s.fallback&&n.push(`\u7EC4\u4EF6 ${s.id} \u4F7F\u7528\u53D8\u91CF\uFF0C\u8BF7\u586B\u5199\u5907\u7528\u6587\u6848`),s.fallback&&Object.values(e.strings.locales).some(b=>b[s.fallback]?.includes("{{"))&&n.push(`\u7EC4\u4EF6 ${s.id} \u7684\u5907\u7528\u6587\u6848\u9700\u8981\u4F7F\u7528\u9759\u6001\u6587\u5B57`),s.type==="custom_html"){for(let b of Object.values(s.html))n.push(...ge(b).map(h=>`HTML ${s.id}\uFF1A${h}`));Object.values(s.html).some(b=>b.includes("{{"))&&!s.fallback&&n.push(`HTML ${s.id} \u4F7F\u7528\u53D8\u91CF\uFF0C\u8BF7\u586B\u5199\u5907\u7528\u6587\u6848`),/\{\{/.test(s.css)&&n.push(`HTML ${s.id} \u7684 CSS \u4E0D\u652F\u6301\u53D8\u91CF`)}(s.type==="stack"||s.type==="button")&&s.bind?.picker&&he(e,s.bind.picker)?.type!=="plan_picker"&&!Object.hasOwn(ce(e),s.bind.picker)&&n.push(`\u5BB9\u5668 ${s.id} \u5F15\u7528\u7684\u5957\u9910\u9009\u62E9\u4E0D\u5B58\u5728`)});for(let s of Object.keys(ce(e)))he(e,s)||n.push(`Product selection scope ${s} must reference a UI node`);let d=rt(e);for(let s of d)s.complete||(s.locale===e.strings.defaultLocale?n.push(`\u9ED8\u8BA4\u8BED\u8A00 ${s.locale} \u8FD8\u6709 ${s.missing.length} \u5904\u5185\u5BB9\u6CA1\u586B`):n.push(`${s.locale} \u8FD8\u6709 ${s.missing.length} \u5904\u6CA1\u7FFB\u8BD1\uFF0C\u8BF7\u8865\u9F50\u6216\u5220\u9664\u8FD9\u79CD\u8BED\u8A00\u540E\u53D1\u5E03`));Se(e).length===0&&!e.pages.some(s=>cr(s.root))&&n.push("\u5F39\u7A97\u91CC\u8FD8\u6CA1\u6709\u53EF\u663E\u793A\u7684\u5185\u5BB9");let g=new Set;G(e,s=>{s.type==="button"&&g.add(s.action)});for(let s of e.actions)!g.has(s.id)&&!e.pages.some(p=>lr(p.root,s.id))&&c.push(`\u52A8\u4F5C ${s.id} \u6CA1\u6709\u88AB\u4EFB\u4F55\u6309\u94AE\u4F7F\u7528`);return{errors:n,warnings:c}}function cr(e){let t=!1;return ee(e,n=>{if(n.hidden)return!1;n.type==="image"&&(t=!0)}),t}function lr(e,t){let n=!1;return ee(e,i=>{if(i.type==="custom_html")for(let a of Object.values(i.html))a.includes(`data-grow-action="${t}"`)&&(n=!0)}),n}function ur(e){return rt(e).filter(t=>t.complete||t.locale===e.strings.defaultLocale).map(t=>t.locale)}function Yn(e,t){return Te(t,ur(e),e.strings.defaultLocale)}function Xn(e,t){let n=e.strings.locales[t]??{},i=e.strings.locales[e.strings.defaultLocale]??{},a={};for(let l of Se(e)){if(l.field==="html"||l.field==="src")continue;let d=n[l.key]?.trim()?n[l.key]:i[l.key];d!==void 0&&(a[l.key]=d)}let c=l=>{if(l.type==="stack")return{...l,children:l.children.map(c)};if(l.type==="custom_html"){let d=l.html[t]?.trim()?l.html[t]:l.html[e.strings.defaultLocale];return{...l,html:d===void 0?{}:{[t]:d}}}if(l.type==="image"){let{localizedSrc:d,...g}=l;return{...g,src:d?.[t]??d?.[e.strings.defaultLocale]??l.src}}return l};return{...e,pages:e.pages.map(l=>({...l,root:c(l.root)})),strings:{defaultLocale:t,locales:{[t]:a}}}}function pr(e,t){let n=null;return ee(e,i=>{if(n)return!1;i.id===t&&(n=i)}),n}function he(e,t){for(let n of e.pages){let i=pr(n.root,t);if(i)return i}return null}function Jn(e){let t=de(e)?.split("-")[0];return t!==void 0&&["ar","he","fa","ur"].includes(t)}function ei(e,t,n){let i={};if(!t||typeof t!="object"||Array.isArray(t))return i;let a=t;if(G(e,c=>{if(c.type==="plan_picker"){let d=a[c.id];typeof d=="string"&&(i[c.id]=n?.pickers[c.id]?.options.includes(d)?d:"");return}if(c.type!=="stack"||!c.interaction)return;let l=Object.hasOwn(a,c.id)?a[c.id]:void 0;["select","tabs"].includes(c.interaction.type)&&typeof l=="string"&&c.children.some(d=>d.id===l)&&(i[c.id]=l),c.interaction.type==="toggle"&&typeof l=="boolean"&&(i[c.id]=l)}),e.surface==="paywall"&&typeof a.__page=="string"&&e.pages.some(c=>c.id===a.__page)&&(i.__page=a.__page),n){let c={...i};for(let[l,d]of Object.entries(a))(typeof d=="string"||typeof d=="boolean")&&(c[l]=d);Object.assign(i,Me(e,c,n))}return i}import{z as I}from"zod";var oi=I.discriminatedUnion("kind",[I.object({kind:I.literal("ledger"),cursor:oe}).strict(),I.object({kind:I.literal("billing"),cursor:I.uuid()}).strict()]),mr=I.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),dr=I.record(I.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/),I.union([I.string().max(500),I.boolean(),I.array(I.string().max(500)).max(50)])).refine(e=>Object.keys(e).length<=40,"Too many answers"),fr=/^(?:api_?key|authorization|password|(?:customer|run|visitor|access|purchase)_?token|client_?secret|signed_?transaction|raw_?proof)$/i;function xe(e,t=0){return t>20?!0:!!e&&typeof e=="object"&&(Array.isArray(e)?e.some(n=>xe(n,t+1)):Object.entries(e).some(([n,i])=>["__proto__","constructor","prototype"].includes(n)||fr.test(n)||xe(i,t+1)))}var gr=/gg_(?:sk|ct|fr|fv|gc)_[A-Za-z0-9_-]{20,}/,br=I.record(mr,ue).refine(e=>Object.keys(e).length<=20,"Too many parameters").refine(e=>!xe(e)&&!gr.test(JSON.stringify(e)),"Credentials cannot be screen parameters");function ai(e){let t=Object.create(null);for(let[n,i]of new URL(e).searchParams)I.string().max(500).parse(i),Object.hasOwn(t,n)||(t[n]=i);return br.parse(t),t}var it=I.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/),yr=I.array(I.object({variable:it,componentId:it,required:I.boolean()}).strict()).max(40).refine(e=>new Set(e.map(t=>t.variable)).size===e.length&&new Set(e.map(t=>t.componentId)).size===e.length,"Input bindings must be unique"),si=I.object({bindings:yr,answers:dr,values:I.record(I.string(),ue).optional()}).strict();export{te as a,Sr as b,xr as c,ot as d,at as e,Ee as f,_r as g,Ie as h,st as i,Ir as j,ct as k,Ae as l,lt as m,Er as n,Ar as o,Nr as p,pt as q,O as r,pe as s,kr as t,Cr as u,Lr as v,re as w,E as x,mt as y,V as z,L as A,ke as B,dt as C,ft as D,gt as E,Dr as F,M as G,de as H,Te as I,ht as J,wr as K,ne as L,$r as M,St as N,Q as O,De as P,ie as Q,Br as R,qr as S,ze as T,Gr as U,Pe as V,P as W,Jr as X,we as Y,oe as Z,en as _,Et as $,tn as aa,ve as ba,on as ca,an as da,sn as ea,Ue as fa,Ve as ga,yn as ha,Nt as ia,Rt as ja,$e as ka,hn as la,Ot as ma,fe as na,Be as oa,En as pa,ae as qa,se as ra,An as sa,Nn as ta,qe as ua,ce as va,Me as wa,Ze as xa,Ge as ya,kt as za,He as Aa,Ke as Ba,Lt as Ca,jn as Da,Dn as Ea,zn as Fa,ge as Ga,We as Ha,vn as Ia,Tt as Ja,z as Ka,X as La,S as Ma,jt as Na,Dt as Oa,ye as Pa,Ye as Qa,J as Ra,Xe as Sa,zt as Ta,Pt as Ua,et as Va,wt as Wa,vt as Xa,Ut as Ya,Vt as Za,$t as _a,B as $a,Bt as ab,qt as bb,Mt as cb,Ft as db,Zt as eb,Gt as fb,Ht as gb,Kt as hb,Qt as ib,Wt as jb,Yt as kb,Xt as lb,tt as mb,Jt as nb,tr as ob,rr as pb,nr as qb,Gn as rb,ir as sb,Hn as tb,G as ub,Kn as vb,ar as wb,ee as xb,Se as yb,sr as zb,rt as Ab,Qn as Bb,Wn as Cb,ur as Db,Yn as Eb,Xn as Fb,pr as Gb,he as Hb,Jn as Ib,ei as Jb,oi as Kb,dr as Lb,br as Mb,ai as Nb,yr as Ob,si as Pb};
@@ -1 +0,0 @@
1
- import{a as m,c as p}from"./chunk-RRII2DMC.js";import{z as d}from"zod";var z=d.enum(["sandbox","live"]),j=d.object({projectId:d.string().min(1),environment:z}).strict();import{z as t}from"zod";var y=t.tuple([t.number().min(0).max(1),t.number().min(0).max(1)]).refine(([n,l])=>n<=l),A=t.strictObject({attribute:t.string().optional(),seed:t.string(),hashVersion:t.literal(2),ranges:t.array(y).max(100)}),C=t.strictObject({id:t.string().min(1).max(255),condition:p,gate:t.boolean().optional()}),E=t.strictObject({key:t.string().optional(),name:t.string().optional(),passthrough:t.boolean().optional()}),R={condition:p.optional(),parentConditions:t.array(C).max(100).optional(),weights:t.array(t.number().min(0).max(1)).max(20).optional(),coverage:t.number().min(0).max(1).optional(),hashAttribute:t.string().optional(),fallbackAttribute:t.string().optional(),hashVersion:t.literal(2).optional(),disableStickyBucketing:t.boolean().optional(),bucketVersion:t.number().int().nonnegative().optional(),minBucketVersion:t.number().int().nonnegative().optional(),filters:t.array(A).max(100).optional(),ranges:t.array(y).max(20).optional(),meta:t.array(E).max(20).optional(),seed:t.string().optional(),name:t.string().optional(),phase:t.string().optional()},g=t.strictObject({...R,key:t.string().min(1).max(255),variations:t.tuple([m,m]).rest(m).refine(n=>n.length<=20),urlPatterns:t.array(t.strictObject({include:t.boolean(),type:t.enum(["regex","simple"]),pattern:t.string()})).max(100).optional(),force:t.number().int().nonnegative().optional(),active:t.boolean().optional(),persistQueryString:t.boolean().optional()}),$=t.strictObject({value:m,variationId:t.number().int(),key:t.string(),name:t.string().optional(),bucket:t.number().optional(),passthrough:t.boolean().optional(),inExperiment:t.boolean(),hashUsed:t.boolean().optional(),hashAttribute:t.string(),hashValue:t.string(),featureId:t.string().nullable(),stickyBucketUsed:t.boolean().optional()}),G=t.strictObject({...R,id:t.string().max(255).optional(),force:m.optional(),variations:t.array(m).min(2).max(20).optional(),key:t.string().optional(),range:y.optional(),tracks:t.array(t.strictObject({experiment:g,result:$})).max(100).optional()}),H=t.strictObject({defaultValue:m.optional(),rules:t.array(G).max(500).optional()}),b=t.record(t.string(),t.union([t.strictObject({type:t.literal("hashed"),attributeKey:t.string(),values:t.array(t.string().regex(/^[a-f0-9]{64}$/))}),t.strictObject({type:t.literal("list"),attributeKey:t.string(),values:t.array(t.union([t.string(),t.number()]))}),t.strictObject({type:t.literal("condition"),condition:p})])),Y=t.strictObject({scope:j,generation:t.string().regex(/^[a-f0-9]{64}$/),evaluatedAt:t.iso.datetime({offset:!0}),expiresAt:t.iso.datetime({offset:!0}).nullable(),features:t.record(t.string(),H),savedGroups:b,experiments:t.record(t.uuid(),g)});import{z as a}from"zod";import{z as e}from"zod";import{z as r}from"zod";var O=r.strictObject({schemaVersion:r.literal(1),renderKey:r.string().min(1).max(256),routeTemplate:r.string().startsWith("/").max(2048),selectors:r.array(r.string().regex(/^[a-z][a-z0-9-]*\[(?:id|data-testid|data-test|data-qa|data-indiana-id)="(?:[^"\\\x00-\x1f\x7f]|\\["\\])*"\]$/).max(512)),present:r.array(r.number().int().min(0)).min(1),absent:r.array(r.number().int().min(0))}).superRefine((n,l)=>{let o=[...n.present,...n.absent];(new Set(n.selectors).size!==n.selectors.length||new Set(o).size!==o.length||o.length!==n.selectors.length||o.some(s=>s>=n.selectors.length))&&l.addIssue({code:"custom",message:"Incomplete or ambiguous render signature"})}),k=r.strictObject({renderKey:r.string().min(1).max(256),routeKey:r.string().min(1).max(256),stateKey:r.string().min(1).max(256),documentKey:r.string().min(1).max(256),documentHash:r.string().regex(/^[a-f0-9]{64}$/),compositionKey:r.string().min(1).max(256),entryMode:r.enum(["hard","soft"]),match:r.strictObject({present:r.array(r.number().int().min(0)),absent:r.array(r.number().int().min(0))})});import{z as u}from"zod";var U=["enterprise-internal-indiana-test","tinkerland-indiana-prod"],f="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",N=u.string().regex(new RegExp(`^${f}/${f}/${f}/manifest\\.json$`)),M=u.strictObject({kind:u.literal("gcs-resumable"),url:u.url(),bucket:u.enum(U),objectKey:N,byteLength:u.number().int().positive(),expiresAt:u.iso.datetime()}).superRefine((n,l)=>{let o=new URL(n.url),s=o.searchParams,V=["uploadType","upload_id","name","upload_protocol","ifGenerationMatch"];(o.origin!=="https://storage.googleapis.com"||o.username||o.password||o.hash||o.pathname!==`/upload/storage/v1/b/${n.bucket}/o`||[...s.keys()].some(S=>!V.includes(S)||s.getAll(S).length!==1)||s.get("uploadType")!=="resumable"||!/^[A-Za-z0-9_-]{1,4096}$/.test(s.get("upload_id")??"")||s.has("name")&&s.get("name")!==`app-manifests/${n.objectKey}`||s.has("upload_protocol")&&s.get("upload_protocol")!=="resumable"||s.has("ifGenerationMatch")&&s.get("ifGenerationMatch")!=="0")&&l.addIssue({code:"custom",message:"Invalid IAM upload capability"})});var i=e.string().min(1).max(256),c=e.string().regex(/^[a-f0-9]{64}$/),se=e.strictObject({versionId:e.uuid(),manifestDigest:c,sourceGraphDigest:c,pageKey:i,stateKey:i,documentKey:i,documentHash:c,elementKey:i.optional(),nodeId:i.optional(),contentHash:c.optional(),renderKey:i.optional()}),w=e.strictObject({pageKey:i,documentKey:i,expectedDocumentHash:c,renderKey:i.optional(),nodeId:i,elementKey:i,expectedContentHash:c,property:e.enum(["text","fontSize","color"]),value:e.union([e.string().max(4e3),e.number().finite()])}),P=e.strictObject({versionId:e.uuid(),manifestDigest:c,sourceGraphDigest:c,pageKey:i,stateKey:i,documentKey:i,documentHash:c,renderKey:i.optional(),patches:e.array(w.omit({pageKey:!0,documentKey:!0,expectedDocumentHash:!0,renderKey:!0})).min(1).max(200)}),B=/^[a-z][a-z0-9-]{0,39}$/,x=e.string().regex(B),v=e.enum(["web","ios","android"]),oe=e.discriminatedUnion("action",[e.strictObject({action:e.literal("register"),requestId:e.uuid(),client:x,platform:v,label:e.string().trim().min(1).max(100),sha256:c,bytes:e.number().int().min(1),transferBytes:e.number().int().min(1)}),e.strictObject({action:e.literal("complete"),versionId:e.uuid()}),e.strictObject({action:e.literal("current"),versionId:e.uuid(),expectedCurrent:e.uuid().nullable()}),e.strictObject({action:e.literal("delivery"),enabled:e.boolean()}),e.strictObject({action:e.literal("changes"),versionId:e.uuid(),experimentId:e.uuid(),variationId:i,changesetId:e.uuid().nullable(),expectedRevision:c.nullable(),editorUrl:e.string().url().max(2048),patches:e.array(w).min(1).max(200)})]),K=e.strictObject({id:e.uuid(),projectId:e.uuid(),environmentId:e.uuid(),clientKey:x,platform:v,label:e.string(),sha256:c,bytes:e.number().int().positive(),objectKey:e.string(),state:e.enum(["uploading","ready","rejected"]),isCurrent:e.boolean(),revision:e.number().int().nonnegative(),createdAt:e.string(),expiresAt:e.string(),readyAt:e.string().nullable(),summary:e.record(e.string(),e.json()),routeTree:e.json().nullable(),validation:e.record(e.string(),e.json())}),_=e.strictObject({key:x,platform:v,currentId:e.uuid().nullable()}),ce=e.strictObject({rows:e.array(K).max(100),nextCursor:e.uuid().nullable(),clients:e.array(_).max(20)}),h=e.strictObject({storedBytes:e.number().int().nonnegative(),reservedBytes:e.number().int().nonnegative(),chargedBytes:e.number().int().nonnegative(),versions:e.number().int().nonnegative(),objects:e.number().int().nonnegative(),orphanObjects:e.number().int().nonnegative(),missingReadyObjects:e.number().int().nonnegative(),unknownObjectSizes:e.number().int().nonnegative(),byteLimit:e.number().int().positive(),versionLimit:e.number().int().positive(),remainingBytes:e.number().int().nonnegative()}),me=e.strictObject({asOf:e.iso.datetime({offset:!0}),reclamation:e.literal("manual-review-required"),buckets:e.strictObject({source:h,runtime:h,previews:h})}),le=e.strictObject({asOf:e.iso.datetime({offset:!0}),reviewOnly:e.literal(!0),complete:e.boolean(),issues:e.strictObject({scanLimit:e.boolean(),invalidReferences:e.number().int().nonnegative(),missingVersions:e.number().int().nonnegative()}),totals:e.strictObject({versions:e.number().int().nonnegative(),protected:e.number().int().nonnegative(),reviewCandidates:e.number().int().nonnegative()}),rows:e.array(e.strictObject({versionId:e.uuid(),kind:e.enum(["source","runtime"]),state:e.enum(["uploading","ready","rejected"]),createdAt:e.iso.datetime({offset:!0}),reviewAfter:e.iso.datetime({offset:!0}),reasons:e.array(e.enum(["current","upload-capability","retention-grace","incomplete-inventory","retained-observation","gb","gb-observation","funnel-draft","funnel-draft-observation","funnel-version","funnel-version-observation"])).max(11)})).max(50),nextCursor:e.uuid().nullable()}),ue=e.strictObject({version:K,actorId:e.uuid(),claims:e.record(e.string(),e.json())}),pe=e.strictObject({version:K,upload:M.nullable()}),ge=e.object({format:e.literal("indiana-route-state-index"),schemaVersion:e.literal(3),routes:e.array(e.object({routeKey:i,path:e.string(),documentKey:i,documentHash:c,initialStateKey:i,initialRenderKey:i})),renders:e.array(k)}).loose().superRefine((n,l)=>{(!n.renders||n.routes.some(o=>!n.renders?.some(s=>s.renderKey===o.initialRenderKey&&s.routeKey===o.routeKey&&s.documentKey===o.documentKey&&s.stateKey===o.initialStateKey&&s.documentHash===o.documentHash&&s.entryMode==="hard")))&&l.addIssue({code:"custom",message:"Incomplete render catalog"})}),de=e.strictObject({rows:e.array(e.object({id:e.uuid(),name:e.string(),status:e.string(),variations:e.array(e.object({id:i,key:i,name:e.string().optional()}).loose())}).loose()),limited:e.boolean()}),ye=e.strictObject({enabled:e.boolean(),allowedOrigins:e.array(e.string())});var D=a.strictObject({selector:a.string().min(1).max(2048),action:a.enum(["set","append","remove"]),attribute:a.string().min(1).max(128).refine(n=>["html","class","style","position","href","src","alt","title","id","role","hidden"].includes(n)||/^(aria|data)-[a-z0-9_-]+$/.test(n)),value:a.string().max(5e4).optional(),parentSelector:a.string().max(2048).optional(),insertBeforeSelector:a.string().max(2048).optional()}),T=a.strictObject({variation:a.string().min(1).max(128),description:a.string().max(2e3).default(""),css:a.string().max(1e5).default(""),js:a.string().max(1e5).default(""),domMutations:a.array(D).max(200).default([]),iam:P.optional(),renderGuard:O.optional()}),I=T.omit({variation:!0,description:!0,iam:!0}),L=g.omit({variations:!0,active:!0}).extend({changeId:a.string().regex(/^[a-f0-9]{64}$/),variations:a.tuple([I,I]).rest(I).refine(n=>n.length<=20)}),Ke=a.strictObject({trackExposures:a.boolean(),environmentId:a.uuid(),generation:a.string().regex(/^[a-f0-9]{64}$/),experiments:a.array(L).max(100),savedGroups:b});export{z as a,j as b,g as c,$ as d,G as e,H as f,b as g,Y as h,se as i,D as j,T as k,I as l,L as m,Ke as n};
@@ -1 +0,0 @@
1
- import{a as m,b as j}from"./chunk-KQCTDXVD.js";import{z as e}from"zod";var f=e.json().superRefine((t,a)=>{let r=0;function i(o,s){if(++r>1e4||s>20){a.addIssue({code:"custom",message:"JSON exceeds its depth or node budget"});return}if(typeof o=="string"&&(o.includes("\0")||/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(o))&&a.addIssue({code:"custom",message:"JSON text must contain valid Unicode without NUL"}),Array.isArray(o))o.forEach(n=>i(n,s+1));else if(o&&typeof o=="object")for(let[n,c]of Object.entries(o))(n.includes("\0")||/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(n)||["__proto__","prototype","constructor"].includes(n))&&a.addIssue({code:"custom",message:"Reserved JSON property"}),i(c,s+1)}i(t,0),new TextEncoder().encode(JSON.stringify(t)).byteLength>65536&&a.addIssue({code:"custom",message:"JSON exceeds 64 KiB"})}),$=e.record(e.string().min(1).max(128),f).superRefine((t,a)=>{(!f.safeParse(t).success||Object.keys(t).length>128||new TextEncoder().encode(JSON.stringify(t)).byteLength>65536||["__proto__","constructor","prototype"].some(r=>Object.hasOwn(t,r)))&&a.addIssue({code:"custom",message:"Attribute document exceeds its budget or uses a reserved key"})}),D=new Set(["$in","$ini","$inGroup","$nin","$nini","$notInGroup","$gt","$gte","$lt","$lte","$regex","$regexi","$ne","$eq","$size","$elemMatch","$all","$alli","$not","$type","$exists","$vgt","$vgte","$vlt","$vlte","$vne","$veq","$and","$or","$nor","$savedGroup"]),h=$.superRefine((t,a)=>{function r(i){if(Array.isArray(i))i.forEach(r);else if(i&&typeof i=="object")for(let[o,s]of Object.entries(i)){if(o==="$savedGroup"&&!e.strictObject({id:e.uuid(),attributeKey:e.string().min(1).max(128).optional()}).safeParse(s).success&&a.addIssue({code:"custom",message:"Saved groups use v2 object references"}),!o.startsWith("$")&&o.split(".").some(n=>["__proto__","prototype","constructor"].includes(n))&&a.addIssue({code:"custom",message:"Reserved attribute path"}),o.startsWith("$")&&!D.has(o)&&a.addIssue({code:"custom",message:`Unknown GrowthBook operator: ${o}`}),["$regex","$regexi"].includes(o)&&typeof s=="string"){(/\(\?[<!=]|\\[0-9]|\\k</.test(s)||[...s.matchAll(/\{(\d+)(?:,(\d*))?\}/g)].some(n=>Number(n[1])>255||Number(n[2]||0)>255)||o==="$regexi"&&/[^\x00-\x7f]/.test(s.replace(/\\u([0-9a-f]{4})/gi,(n,c)=>String.fromCharCode(Number.parseInt(c,16)))))&&a.addIssue({code:"custom",message:"Regex is outside the shared TS/SQL subset"});try{new RegExp(s)}catch{a.addIssue({code:"custom",message:"Invalid regular expression"})}}r(s)}}typeof t.source=="string"&&["all","any","group","parameter","answer","attribute","result"].includes(t.source)&&("operator"in t||"predicates"in t||"groupId"in t)&&a.addIssue({code:"custom",message:"Obsolete condition protocol"}),r(t)}),V=e.discriminatedUnion("type",[e.strictObject({type:e.literal("condition"),condition:h}),e.strictObject({type:e.literal("list"),attributeKey:e.string().min(1).max(128),values:e.array(e.union([e.string(),e.number().finite()])).max(1e5)})]).refine(t=>t.type!=="list"||new TextEncoder().encode(JSON.stringify(t.values)).byteLength<=1048576,"Saved group list exceeds 1 MiB");function C(t){let a=new Set;function r(i){if(Array.isArray(i))i.forEach(r);else if(i&&typeof i=="object")for(let[o,s]of Object.entries(i))o==="$savedGroup"&&s&&typeof s=="object"&&!Array.isArray(s)&&typeof s.id=="string"?a.add(s.id):["$inGroup","$notInGroup"].includes(o)&&typeof s=="string"?a.add(s):["$eq","$ne","$in","$nin","$ini","$nini"].includes(o)||r(s)}return r(t),[...a]}var G=e.record(e.uuid(),V).superRefine((t,a)=>{let r=new Set,i=new Set;function o(s){if(r.has(s)){a.addIssue({code:"custom",message:"Cyclic saved group dependency"});return}if(i.has(s))return;let n=t[s];if(!n){a.addIssue({code:"custom",message:"Missing saved group dependency"});return}r.add(s),n.type==="condition"&&C(n.condition).forEach(o),r.delete(s),i.add(s)}Object.keys(t).forEach(o)}),k=e.tuple([e.number().min(0).max(1),e.number().min(0).max(1)]).refine(([t,a])=>t<=a),A=e.strictObject({attribute:e.string().optional(),seed:e.string().min(1),hashVersion:e.literal(2),ranges:e.array(k).min(1).max(100)}),R=e.strictObject({id:e.string().min(1).max(128),condition:h,gate:e.boolean().optional()}),w={id:e.string().max(128).optional(),condition:h.optional(),parentConditions:e.array(R).max(50).optional(),filters:e.array(A).max(20).optional()},B=e.union([e.strictObject({...w}),e.strictObject({...w,force:f,coverage:e.number().min(0).max(1).optional(),range:k.optional(),seed:e.string().min(1).optional(),hashAttribute:e.string().optional(),hashVersion:e.literal(2).optional()}),e.strictObject({...w,type:e.literal("experiment-ref"),experimentId:e.uuid(),values:e.record(e.string().min(1),f),meta:e.record(e.string().min(1),e.strictObject({passthrough:e.boolean()})).optional()})]),_=e.strictObject({defaultValue:f,rules:e.array(B).max(100)}),X=e.record(e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,127}$/),_).superRefine((t,a)=>{Object.keys(t).length>100&&a.addIssue({code:"custom",message:"Too many Features"});let r=new Set,i=new Set;function o(s){if(r.has(s)){a.addIssue({code:"custom",message:`Cyclic Feature dependency: ${s}`});return}if(i.has(s))return;let n=t[s];if(!n){a.addIssue({code:"custom",message:`Unknown prerequisite Feature: ${s}`});return}r.add(s);for(let c of n.rules)for(let d of c.parentConditions??[])o(d.id);r.delete(s),i.add(s)}Object.keys(t).forEach(o)}),z=e.strictObject({name:e.string().max(80),reason:e.string().max(500),dateStarted:e.iso.datetime({offset:!0}),dateEnded:e.iso.datetime({offset:!0}).nullable(),coverage:e.number().min(0).max(1),variationWeights:e.array(e.number().min(0).max(1)).min(2).max(20).refine(t=>Math.abs(t.reduce((a,r)=>a+r,0)-1)<=.01),condition:h,savedGroups:e.array(e.strictObject({match:e.enum(["any","all","none"]),ids:e.array(e.uuid()).min(1)})).max(50),namespace:e.strictObject({id:e.uuid(),ranges:e.array(k).min(1)}).nullable(),seed:e.string().min(1).max(128)}),J=e.strictObject({key:e.string().min(1).max(128),name:e.string().min(1).max(80),hypothesis:e.string().max(2e3),status:e.enum(["draft","running","stopped"]),hashAttribute:e.string().min(1).max(128),fallbackAttribute:e.string().max(128).nullable(),hashVersion:e.literal(2),disableStickyBucketing:e.boolean(),bucketVersion:e.number().int().min(0).max(1e3),minBucketVersion:e.number().int().min(0).max(1e3),variations:e.array(e.strictObject({id:e.string().min(1),key:e.string().min(1),name:e.string().max(80),description:e.string().max(500)})).min(2).max(20),phases:e.array(z).min(1).max(100),releasedVariationId:e.string().nullable(),excludeFromPayload:e.boolean(),statusSchedule:e.strictObject({startAt:e.iso.datetime({offset:!0}).nullable(),stopAt:e.iso.datetime({offset:!0}).nullable(),stopAfter:e.strictObject({value:e.number().int().positive().max(36500),unit:e.enum(["hours","days"])}).nullable().optional()}).nullable()}).superRefine((t,a)=>{(t.minBucketVersion>t.bucketVersion||t.statusSchedule?.stopAt&&t.statusSchedule?.stopAfter||t.phases.some((r,i)=>{if(i===0)return!1;let o=t.phases[i-1];return!o?.dateEnded||Date.parse(r.dateStarted)<Date.parse(o.dateStarted)||Date.parse(o.dateEnded)>Date.parse(r.dateStarted)})||new Set(t.variations.map(r=>r.key)).size!==t.variations.length||new Set(t.variations.map(r=>r.id)).size!==t.variations.length||t.releasedVariationId!==null&&!t.variations.some(r=>r.id===t.releasedVariationId)||t.statusSchedule?.startAt&&t.statusSchedule?.stopAt&&Date.parse(t.statusSchedule.startAt)>=Date.parse(t.statusSchedule.stopAt)||t.phases.some(r=>r.dateEnded&&Date.parse(r.dateStarted)>=Date.parse(r.dateEnded)||r.namespace?.ranges.some(([i,o],s,n)=>i>=o||n.some(([c,d],g)=>g!==s&&i<d&&c<o)))||t.phases.some(r=>r.variationWeights.length!==t.variations.length))&&a.addIssue({code:"custom",message:"Invalid experiment versions, variation keys or weights"})});function Y(t,a,r=Date.now()){return Object.fromEntries(Object.entries(t).map(([i,o])=>[i,{defaultValue:o.defaultValue,rules:o.rules.flatMap(s=>{if(!("experimentId"in s))return[j({...s,hashVersion:2})];let n=a[s.experimentId];if(!n)throw new Error(`Missing experiment: ${s.experimentId}`);let c=n.phases.at(-1);if(!c)throw new Error("Experiment requires an active phase");let d=n.statusSchedule?.startAt?Date.parse(n.statusSchedule.startAt):null,g=E(n),F=n.status!=="stopped"&&(n.status==="running"||d!==null&&r>=d)&&(d===null||r>=d)&&(g===null||r<g),{type:M,experimentId:U,values:b,meta:y,...x}=s,p=m({...x,parentConditions:x.parentConditions?.map(u=>m(u)),filters:x.filters?.map(u=>m(u))});if(n.variations.some(u=>!Object.hasOwn(b,u.key))||Object.keys(b).length!==n.variations.length||Object.keys(y??{}).some(u=>!n.variations.some(l=>l.key===u)))throw new Error("Every variation needs a Feature value");let O=u=>{let l=b[u];if(l===void 0)throw new Error("Every variation needs a Feature value");return l},S={$and:[c.condition,...p.condition?[p.condition]:[],...c.savedGroups.map(u=>{let l=u.ids.map(I=>({$savedGroup:{id:I}}));return u.match==="all"?{$and:l}:u.match==="none"?{$nor:l}:{$or:l}})]},v=n.variations.find(u=>u.id===n.releasedVariationId);return v&&!n.excludeFromPayload?y?.[v.key]?.passthrough?[{...p,condition:S}]:[{...p,condition:S,force:O(v.key)}]:[{...p,condition:S,key:n.key,variations:n.variations.map(u=>O(u.key)),meta:n.variations.map(u=>({key:u.key,name:u.name,...m(y?.[u.key]??{})})),weights:c.variationWeights,coverage:F?c.coverage:0,seed:c.seed,hashVersion:2,hashAttribute:n.hashAttribute,...n.fallbackAttribute===null?{}:{fallbackAttribute:n.fallbackAttribute},disableStickyBucketing:!F||n.disableStickyBucketing,bucketVersion:n.bucketVersion,minBucketVersion:n.minBucketVersion,filters:[...p.filters??[],...(n.filters??[]).map(u=>m(u))]}]})}]))}function E(t){if(t.statusSchedule?.stopAt)return Date.parse(t.statusSchedule.stopAt);let a=t.statusSchedule?.stopAfter;if(!a||t.status==="draft"&&!t.statusSchedule?.startAt)return null;let r=t.statusSchedule?.startAt??t.phases.at(-1)?.dateStarted;if(!r)throw new Error("Experiment requires an active phase");return Date.parse(r)+a.value*(a.unit==="days"?864e5:36e5)}function ee(t,a=Date.now()){let r=Object.values(t).filter(i=>i.status!=="stopped"&&!(i.releasedVariationId&&!i.excludeFromPayload)).flatMap(i=>[i.statusSchedule?.startAt?Date.parse(i.statusSchedule.startAt):null,E(i)]).filter(i=>i!==null&&i>a);return r.length?new Date(Math.min(...r)).toISOString():null}var N=J.safeExtend({filters:e.array(A).optional()}),q=e.strictObject({experiments:e.record(e.uuid(),N),savedGroups:G}),P=e.strictObject({attributeName:e.string(),attributeValue:e.string(),assignments:e.record(e.string(),e.string())}),te=e.strictObject({snapshot:q,attributes:$,results:$,stickyBucketAssignmentDocs:e.record(e.string(),P)}),re=e.strictObject({variantKey:e.string().nullable(),bucketVersion:e.number().int().min(0),source:e.enum(["unknownFeature","defaultValue","force","override","experiment","prerequisite","cyclicPrerequisite"]),bucket:e.number().min(0).max(1).optional(),stickyBucketUsed:e.boolean().optional(),hashUsed:e.boolean().optional()});export{f as a,$ as b,h as c,V as d,C as e,G as f,B as g,_ as h,X as i,z as j,J as k,Y as l,E as m,ee as n,N as o,q as p,P as q,te as r,re as s};
@@ -1,4 +0,0 @@
1
- import{a as P}from"./chunk-DSPLGTQI.js";import{a as $}from"./chunk-EXCPE2XH.js";import{e as C,h as O,k as D}from"./chunk-KQCTDXVD.js";function N(e){if(!/^[A-Za-z0-9_-]{1,64}$/.test(e))throw new Error("Invalid device cookie name");let t="";for(let n of document.cookie.split(";"))if(n.trim().startsWith(`${e}=`))try{t=decodeURIComponent(n.trim().slice(e.length+1))}catch{}return/^[A-Za-z0-9_-]{8,128}$/.test(t)||(t=crypto.randomUUID(),document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${400*24*3600}; SameSite=Lax`),t}function j(){try{let e=sessionStorage.getItem("indiana_sid");return e||(e=crypto.randomUUID(),sessionStorage.setItem("indiana_sid",e)),e}catch{return}}function H(e=$){let t=new URL(e);if(t.protocol!=="https:"&&!(t.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(t.hostname))||t.username||t.password||t.search||t.hash)throw new Error("baseUrl must be an https origin without credentials");return t.origin}var w=new Set,R;function Y(e){let t=()=>e();if(w.add(t),!R){let n=!0,r=history.pushState,o=history.replaceState,s=()=>{if(n)for(let i of[...w])w.has(i)&&P(i)},c=function(...i){r.apply(this,i),s()},a=function(...i){o.apply(this,i),s()};history.pushState=c,history.replaceState=a,addEventListener("popstate",s),addEventListener("hashchange",s),R=()=>{n=!1,history.pushState===c&&(history.pushState=r),history.replaceState===a&&(history.replaceState=o),removeEventListener("popstate",s),removeEventListener("hashchange",s)}}return()=>{w.delete(t)&&(w.size||(R?.(),R=void 0))}}var ee=e=>new TextEncoder().encode(JSON.stringify({events:e})).length;function te(e,t){let n=e,r=o=>Number.isInteger(o)&&o>=0;return!!n&&typeof n=="object"&&r(n.inserted)&&r(n.duplicates)&&r(n.skipped)&&Array.isArray(n.rejected)&&n.inserted+n.duplicates+n.skipped+n.rejected.length===t}function B(e){let t=[],n,r=(a,i)=>e.log?.(`${e.label} ${a}`,i);function o(a){n===void 0&&t.length&&(n=setTimeout(()=>{c()},a))}async function s(a){let i;try{i=await e.fetch(e.endpoint,{method:"POST",body:JSON.stringify({events:a}),headers:{"Content-Type":"text/plain"},keepalive:!0,credentials:"omit"})}catch(f){return r("not sent",{error:f}),!1}if(i.status===408||i.status===429||i.status>=500)return r("not sent",{status:i.status}),!1;if(!i.ok)return r("rejected",{status:i.status,events:a.length}),!0;let p;try{p=await i.json()}catch{p=void 0}return te(p,a.length)?(p.rejected.length&&r("rejected",{rejected:p.rejected}),!0):(r("not acknowledged",{status:i.status}),!1)}function c(){clearTimeout(n),n=void 0;let a=[];for(;t.length&&a.length<20&&(!a.length||ee([...a,t[0]].map(i=>i.event))<=65536);)a.push(t.shift());return a.length?s(a.map(i=>i.event)).then(i=>{if(i)return o(1e3);let p=a.filter(f=>++f.attempts<5);p.length<a.length&&r("dropped after retries",{events:a.length-p.length}),t.unshift(...p),o(5e3)}):Promise.resolve()}return{push(a){t.push({event:a,attempts:0}),t.length>=20?c():o(1e3)},flush:c}}async function q(e,t,n,r={}){let o=r.message??"Invalid SDK JSON response",s=e.headers.get("content-length");if(!e.ok||!/^application\/json(?:;|$)/i.test(e.headers.get("content-type")??"")||s!==null&&(!/^\d+$/.test(s)||Number(s)>t)||!e.body)throw e.body?.cancel().catch(()=>{}),Error(o);let c=e.body.getReader(),a=[],i=0,p=!1,f=()=>{},g=new Promise((y,h)=>{f=()=>h(Error(o)),n.addEventListener("abort",f,{once:!0}),n.aborted&&f()});try{for(;;){let m=await Promise.race([c.read(),g]);if(m.done){p=!0;break}if(i+=m.value.byteLength,i>t)throw Error(o);a.push(m.value)}let y=new Uint8Array(i),h=0;for(let m of a)y.set(m,h),h+=m.length;return JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(y))}finally{n.removeEventListener("abort",f),p||c.cancel().catch(()=>{}),c.releaseLock()}}async function V(e,t){let n=e?.body;if(!n)return;let r=n.getReader(),o=0,s=!1,c,a=new Promise((f,g)=>{c=setTimeout(()=>g(Error("Exposure response timeout")),2e3)}),i=()=>{},p=new Promise((f,g)=>{i=()=>g(t?.reason),t?.addEventListener("abort",i,{once:!0}),t?.aborted&&i()});try{for(;;){let f=await Promise.race([r.read(),a,p]);if(f.done){s=!0;return}if(o+=f.value.byteLength,o>16384)throw Error("Exposure response budget")}}finally{clearTimeout(c),t?.removeEventListener("abort",i),s||r.cancel().catch(()=>{}),r.releaseLock()}}var fe=2*1024*1024,G=256*1024;async function J(e,t,n,r){let o=()=>{},s=new Promise((c,a)=>{o=()=>a(r.reason),r.addEventListener("abort",o,{once:!0}),r.aborted&&o()});try{let c=e(t,{...n,signal:r});return c.then(a=>{r.aborted&&a.body?.cancel().catch(()=>{})},()=>{}),await Promise.race([c,s])}finally{r.removeEventListener("abort",o)}}async function ge(e,t,n,r=!1){if(new TextEncoder().encode(n).byteLength>65536)throw Error("Exposure request budget");let o=new AbortController,s=setTimeout(()=>o.abort(Error("Exposure request timeout")),5e3);try{let c=await J(e,t,{method:"POST",headers:{"Content-Type":"text/plain"},body:n,credentials:"omit",keepalive:r,redirect:"error"},o.signal);await V(c,o.signal)}finally{clearTimeout(s)}}function M(e){let t,n=!1;return{async read(r,o){if(n)throw Error("Experiment client stopped");t?.abort(Error("Experiment request superseded"));let s=new AbortController;t=s;let{signal:c}=s,a=setTimeout(()=>s.abort(Error("Experiment request timeout")),5e3);try{let i=await J(e,r,{cache:"no-cache",credentials:"omit",redirect:"error"},c),p=await q(i,o,c);return c.throwIfAborted(),p}finally{clearTimeout(a),t===s&&(t=void 0)}},destroy(){n=!0,t?.abort(Error("Experiment client stopped")),t=void 0}}}/*!
2
- Portions ported from GrowthBook sdk-js @ ed29827 (GrowthBook.ts auto experiments, util.ts mergeQueryStrings,
3
- plugins/auto-attributes.ts). Copyright (c) GrowthBook, Inc. MIT License.
4
- */function re(e,t){let n,r;try{n=new URL(e),r=new URL(t)}catch{return t}return n.searchParams.forEach((o,s)=>{r.searchParams.has(s)||r.searchParams.set(s,o)}),r.toString()}function ne(e,t){let n=navigator.userAgent,r=new URLSearchParams(t.search),o={};for(let s of["source","medium","campaign","term","content"]){let c=r.get(`utm_${s}`);c!==null&&(o[`utm${s[0].toUpperCase()}${s.slice(1)}`]=c)}return{id:e,deviceId:e,url:t.href,path:t.pathname,host:t.host,query:t.search,pageTitle:typeof document>"u"?"":document.title,browser:/Edg/.test(n)?"edge":/Chrome/.test(n)?"chrome":/Firefox/.test(n)?"firefox":/Safari/.test(n)?"safari":"unknown",deviceType:/Mobi/.test(n)?"mobile":"desktop",...o}}function oe(e){let t=e;if(!(!!t&&typeof t=="object"&&typeof t.environmentId=="string"&&typeof t.trackExposures=="boolean"&&/^[a-f0-9]{64}$/.test(t.generation??"")&&Array.isArray(t.experiments)&&t.experiments.length<=100&&t.experiments.every(r=>!!r&&!["namespace","status","url","groups"].some(o=>Object.hasOwn(r,o))&&(r.hashVersion===void 0||r.hashVersion===2)&&typeof r.key=="string"&&Array.isArray(r.variations)&&r.variations.length>=2&&r.variations.every(o=>!!o&&typeof o.urlRedirect=="string")&&(r.urlPatterns===void 0||Array.isArray(r.urlPatterns)))&&!!t.savedGroups&&typeof t.savedGroups=="object"&&!Array.isArray(t.savedGroups)))throw new Error("Invalid page experiment payload");return t}function xe(e){if(e.configuration&&e.configuration.scope.environmentId!==e.environmentId)throw new Error("Page configuration belongs to another App environment");let t=H(e.baseUrl);if(!/^[0-9a-f-]{36}$/i.test(e.environmentId))throw new Error("environmentId must be the App environment ID");let n=e.fetch??globalThis.fetch.bind(globalThis),r=M(async(u,d)=>{let l=await n(u,d);if(!l.ok)throw l.body?.cancel().catch(()=>{}),new Error(`Page experiments unavailable (${l.status})`);return l}),o=e.log?(u,d)=>P(e.log,u,d):void 0,s=`${t}/api/v1/page-experiments/${e.environmentId}`,c=N(e.deviceIdCookie??"indiana_did"),a=j(),i=null,p={...e.attributes??{}},f="",g=!1,y=!1,h=0,m=new Map,T=B({endpoint:`${s}/events`,fetch:n,log:o,label:"Exposure"}),S=T.flush,E={trackedExperiments:new Set,log:o,onExperimentViewed:(u,d)=>{e.trackExposures===!1||i?.trackExposures===!1||T.push({eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),deviceId:c,...a?{sessionId:a}:{},url:location.href,pageTitle:document.title.slice(0,512),experimentKey:u.key,variationKey:d.key})}},z=()=>{E.url=location.href,E.attributes={...ne(c,location),...p}};function Q(u){if(!e.disableCrossOriginUrlRedirects)return!1;try{let d=new URL(location.href);return u.variations.some(l=>{if(!l.urlRedirect)return!1;let v=new URL(l.urlRedirect);return v.protocol!==d.protocol||v.host!==d.host})}catch{return!0}}function W(u,d){let l=e.configuration?.snapshot?.generation;f=u;let v=e.navigate??(x=>location.replace(x)),X=e.navigateDelay??(e.navigate?0:100),Z=e.maxNavigateDelay??1e3;Promise.all([Promise.race([d,new Promise(x=>setTimeout(x,Z))]),new Promise(x=>setTimeout(x,X))]).then(()=>{!g&&(!e.configuration||e.configuration.fresh&&e.configuration.snapshot?.generation===l)&&v(u)})}function b(){if(!(!i||g||e.configuration&&!e.configuration.fresh)){z();for(let u of i.experiments){if(Q(u)){o?.("Auto experiment blocked",{id:u.key});continue}let d;try{d=D(u,E)}catch(l){o?.("Skipping page experiment",{id:u.key,error:String(l)});continue}if(m.set(u.key,d),!!d.inExperiment){if(d.value.urlRedirect){let l=u.persistQueryString?re(location.href,d.value.urlRedirect):d.value.urlRedirect;C(l,u.urlPatterns??[])?o?.("Skipping redirect because original URL matches redirect URL",{id:u.key}):l!==f&&W(l,S())}break}}}}let k="",F=()=>{location.href!==k&&(k=location.href,f="",b())},L,I;function K(){L??=Y(F),addEventListener("pagehide",U)}let U=()=>{S()};async function A(){if(g)return!1;let u=++h,d;try{d=e.configuration?await e.configuration.pageExperiments():await r.read(s,G)}catch(v){if(g||u!==h)return!1;throw v}if(g||u!==h)return!1;let l=oe(d);if(l.environmentId.toLowerCase()!==e.environmentId.toLowerCase())throw new Error("Page experiment payload scope changed");return i?.trackExposures===!1&&l.trackExposures&&E.trackedExperiments?.clear(),i=l,E.savedGroups=O(l.savedGroups),!0}function _(){g||(I??=e.configuration?.subscribe(()=>{!g&&e.configuration?.fresh&&A().then(u=>{u&&b()}).catch(u=>o?.("Page configuration unavailable",{error:String(u)}))}),K(),k=location.href)}return{async start(){y||g||(y=!0,await A()&&(_(),b()))},async refresh(){await A()&&(y&&_(),f="",b())},setAttributes(u){p={...u},b()},getResults(){return new Map(m)},get generation(){return i?.generation??null},destroy(){g||(g=!0,h++,r.destroy(),I?.(),L?.(),removeEventListener("pagehide",U),i=null,m.clear(),S())}}}export{N as a,j as b,H as c,Y as d,fe as e,ge as f,M as g,re as h,ne as i,oe as j,xe as k};
@@ -1 +0,0 @@
1
- import{p as o}from"./chunk-LMR2TM3X.js";var n=class extends Error{constructor(t,s,y,i,r){super(s);this.code=t;this.status=y;this.requestId=i;this.name="IndianaError",this.reason=r?.reason;let e=o(t,y??0,{...r,retryAfter:r?.retryAfterSeconds===void 0?void 0:String(r.retryAfterSeconds)});this.retryable=e.retryable,this.recovery=e.recovery,this.retryAfterSeconds=e.retryAfterSeconds}code;status;requestId;retryable;recovery;retryAfterSeconds;reason};export{n as a};
@@ -1 +0,0 @@
1
- import{o as v,p as k,s as S}from"./chunk-EJTBSGLV.js";import{a as e}from"./chunk-SOQO2RDZ.js";import{a as C,j,m as _,p as P}from"./chunk-LMR2TM3X.js";import{b}from"./chunk-OBYJWIRB.js";import{a as L}from"./chunk-EXCPE2XH.js";var M={name:"@tinkerlandai/indiana-sdk",version:"0.8.4",description:"Framework-independent Indiana SDK for customer identity, entitlements, credits, offers and growth surfaces.",license:"UNLICENSED",repository:{type:"git",url:"git+https://github.com/tinkerlandai/Indiana.git",directory:"packages/sdk"},engines:{node:">=22"},publishConfig:{access:"public",tag:"beta"},type:"module",sideEffects:!1,files:["dist","README.md","README.zh-CN.md","CHANGELOG.md","THIRD_PARTY_NOTICES.md"],exports:{"./react-native":{types:"./dist/react-native.d.ts","react-native":"./dist/react-native.js",import:"./dist/react-native.js",default:"./dist/react-native.js"},".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./popup":{types:"./dist/popup.d.ts",import:"./dist/popup.js"},"./server":{types:"./dist/server.d.ts",import:"./dist/server.js"},"./openrouter":{types:"./dist/openrouter.d.ts",import:"./dist/openrouter.js"},"./native-shell":{types:"./dist/native-shell.d.ts",import:"./dist/native-shell.js"},"./page":{types:"./dist/page.d.ts",import:"./dist/page.js"},"./visual":{types:"./dist/visual.d.ts",import:"./dist/visual.js"}},scripts:{build:"tsup",prepack:"pnpm run build",typecheck:"tsc --noEmit",lint:"node ../../scripts/ci/lint.mjs --workspace packages/sdk"},dependencies:{"@ai-sdk/provider":"4.0.26","@types/json-schema":"7.0.15","css-tree":"^3.2.1","dom-mutator":"0.7.0",dompurify:"^3.4.15",zod:"4.6.6"},devDependencies:{"@indiana/contracts":"workspace:*","@openrouter/sdk":"^1.4.25","@types/css-tree":"^3.2.0",ai:"7.0.136",tsup:"^8.5.1",typescript:"^5.9.3","whatwg-url-minimum":"0.2.0"},peerDependencies:{"@openrouter/sdk":"^1.4.25"},peerDependenciesMeta:{"@openrouter/sdk":{optional:!0}}};var U=Symbol("IndianaNoContent");function Z(p,H,q=URL){let l=p.configuration?.scope,R=p.scope??(l&&{projectId:l.projectId,environment:l.environment}),s=R?b.parse(R):void 0;if(s&&l&&(s.projectId!==l.projectId||s.environment!==l.environment))throw new e("SCOPE_MISMATCH","Configuration belongs to another App/environment");let a=new q(p.baseUrl??L);if(a.username||a.password||a.search||a.hash)throw new e("INVALID_URL","baseUrl must not contain credentials, query, or fragment");if(a.protocol!=="https:"&&!(a.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(a.hostname)))throw new e("INVALID_URL","Use HTTPS, or HTTP on localhost during development");let V=p.fetch??globalThis.fetch.bind(globalThis),f=p.timeoutMs??1e4;if(!Number.isFinite(f)||f<1||f>12e4)throw new e("INVALID_TIMEOUT","timeoutMs must be between 1 and 120000");let h=null,u=0,m=null,g=new Set;function A(){u+=1,h=null,m=null;for(let i of g)i.abort();g.clear()}async function x(i,K={},I="POST",D={}){let d=D.installationDetach===!0;if(d&&(i!=="push/installations/detach"||I!=="POST"))throw new e("INVALID_REQUEST","Installation authority only detaches this installation");if(!h&&!d)throw new e("NOT_IDENTIFIED","Call identify with a server-issued customer token first");let E=u,o=new AbortController;d||g.add(o);let w=()=>!d&&E!==u?new e("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):new e("TIMEOUT","Indiana request timed out"),T,F=new Promise((n,r)=>{T=()=>r(w()),o.signal.addEventListener("abort",T,{once:!0})}),G=setTimeout(()=>o.abort(),f),X=async()=>{let n=await V(`${a.href.replace(/\/$/,"")}/api/v1/${i}`,{method:I,headers:{"Content-Type":"application/json",...d?{}:{Authorization:`Bearer ${h}`},[v]:S.current,[k]:M.version,...s?{"X-Indiana-Project":s.projectId,"X-Indiana-Environment":s.environment}:{}},body:I==="POST"?JSON.stringify(K):void 0,signal:o.signal,credentials:"omit",cache:"no-store",redirect:"error",...D.keepalive?{keepalive:!0}:{}});if(o.signal.aborted)throw w();let r;try{r=n.status===204?U:await n.json()}catch{throw o.signal.aborted?w():new e(n.ok?"INVALID_RESPONSE":"HTTP_ERROR","The gateway returned an unreadable response",n.status,n.headers.get("X-Request-Id")??void 0)}if(o.signal.aborted)throw w();if(!d&&E!==u)throw new e("IDENTITY_CHANGED","Customer identity changed while the request was in flight");if(!n.ok){let t=_.safeParse(r),c=t.success&&(!C.safeParse(t.data.error.code).success||j(t.data.error.code,n.status)),N=c?t.data.error.code:"HTTP_ERROR",O=P(N,n.status,{retryAfter:n.headers.get("Retry-After"),recovery:c?t.data.error.recovery:void 0,reason:c?t.data.error.reason:void 0});throw new e(N,c?t.data.error.message:"Indiana request failed",n.status,n.headers.get("X-Request-Id")??(t.success?t.data.requestId:void 0),{...O,...t.success&&t.data.error.retryable===!1?{retryable:!1}:{},...O.retryAfterSeconds===void 0&&t.success&&t.data.error.retryAfterSeconds!==void 0?{retryAfterSeconds:t.data.error.retryAfterSeconds}:{}})}if(n.headers.get(v)!==S.current)throw new e("PROTOCOL_MISMATCH","Response protocol does not match this SDK");if(s&&r!==U){let t=r&&typeof r=="object"&&"scope"in r?r:r&&typeof r=="object"&&"configuration"in r?r.configuration:null;if(!t||typeof t!="object"||!("scope"in t))throw new e("INVALID_RESPONSE","Response is missing its App/environment scope");let c=b.safeParse(t.scope);if(!c.success||c.data.projectId!==s.projectId||c.data.environment!==s.environment)throw new e("SCOPE_MISMATCH","Response scope does not match this SDK instance")}let y=n.headers.get("X-Indiana-Telemetry-Subject");if(y){if(!/^[a-f0-9]{64}$/.test(y))throw new e("INVALID_RESPONSE","Invalid telemetry identity");m!==y&&(m=y,H?.(m))}return r};try{return await Promise.race([X(),F])}catch(n){throw!d&&E!==u?new e("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):n instanceof e?n:new e(o.signal.aborted?"TIMEOUT":"NETWORK_ERROR",o.signal.aborted?"Indiana request timed out":"Unable to read the Indiana response")}finally{clearTimeout(G),o.signal.removeEventListener("abort",T),g.delete(o)}}return{subjectKey:()=>m,identify(i){if(!i.trim()||/\s/.test(i)||i.length>4096)throw new e("INVALID_TOKEN","A nonempty server-issued token is required");A(),h=i},reset:A,request:x}}export{Z as a};
@@ -1 +0,0 @@
1
- import{a as u}from"./chunk-SOQO2RDZ.js";import{ZodError as f}from"zod";function T(n,r,t,e){try{return n.parse(r)}catch(s){throw e&&s instanceof f?new u(t,e):s}}async function R(n,r,t,e={},s){let o=typeof e=="function"?{}:e,i=T(r.request,t,"INVALID_REQUEST",o.request),p=await n(r.path,i,r.method,s),a=typeof e=="function"?e:e.parseResponse;return a?a(r.response,p):T(r.response,p,"INVALID_RESPONSE",o.response)}export{R as a};
@@ -1 +0,0 @@
1
- import{f as _,j as F}from"./chunk-BUDTHBFF.js";import{b as q}from"./chunk-SSLZKIIU.js";import"./chunk-SSHUBTT3.js";import{cd as U}from"./chunk-EJTBSGLV.js";import{a as d}from"./chunk-SOQO2RDZ.js";import{Eb as M,Mb as z,Ob as N,tb as P}from"./chunk-LMR2TM3X.js";import{a as v}from"./chunk-DSPLGTQI.js";import"./chunk-OBYJWIRB.js";import"./chunk-EXCPE2XH.js";import{a as O}from"./chunk-RRII2DMC.js";import"./chunk-KQCTDXVD.js";import{z as p}from"zod";var V=new WeakMap;function Q(r){let t={string:p.string(),number:p.number().finite(),boolean:p.boolean(),strings:p.array(p.string()),json:O}[r.type];return r.nullable?t.nullable():t}async function ne(r,t){return W(r,t,!1)}async function re(r,t){return W(r,t,!0)}async function W(r,t,w){t.signal?.throwIfAborted();let T=U.parse(t.content),o=T.document;if(V.has(r))throw new d("CONFLICT","Content is already mounted in this container");let f=p.record(p.string(),O).parse(t.inputs??{});if(Object.keys(f).length>40)throw new d("INVALID_REQUEST","Too many content inputs");for(let[e,s]of Object.entries(f))z.parse({[e]:s});if(Object.keys(f).some(e=>!Object.hasOwn(o.contract.inputs,e)))throw new d("INVALID_REQUEST","Undeclared content input");for(let[e,s]of Object.entries(o.contract.inputs))if(Object.hasOwn(f,e))Q(s).parse(f[e]);else if(s.required)throw new d("INVALID_REQUEST",`Missing content input ${e}`);for(let e of Object.keys(o.contract.outputs))if(typeof t.actions[e]!="function")throw new d("INVALID_REQUEST",`Missing host handler for ${e}`);let $=N.parse(t.bindings??[]),a=r.ownerDocument,L,k=o.kind==="popup",n=k?a.createElement("dialog"):null,i=a.createElement("div");if(i.dataset.indianaContent=o.kind,i.setAttribute("aria-label",o.name),i.style.cssText="width:100%;min-width:0",n){n.setAttribute("aria-label",o.name);let e=o.screen.presentation;n.style.cssText="box-sizing:border-box;padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto",e.type==="modal"||e.type==="sheet"?(n.style.width=`${P[e.size]}px`,e.type==="sheet"&&(n.style.margin="auto auto 0")):n.style.width="100vw",n.append(i),r.append(n)}else r.append(i);let c=!1,C=!1,g=!1;w&&!n&&(i.style.width=`${r.getBoundingClientRect().width||a.defaultView?.innerWidth||800}px`);let B=w?_(n??i):()=>{},H,x,A=new Promise((e,s)=>{H=e,x=s});A.catch(()=>{});let l=null,E=structuredClone(o.screen);E.actions=E.actions.map(e=>e.type==="event"?{...e,close:!1}:e);let y;function m(){c||(c=!0,t.signal?.removeEventListener("abort",m),x(new Error("Content preparation cancelled")),y?.destroy(),n?.close(),n?.remove(),i.remove(),V.delete(r),n&&L?.())}let S=()=>{g&&(m(),v(t.onDismiss))};if(n){let e=a.createElement("button");e.type="button",e.textContent="\xD7",e.setAttribute("aria-label",t.locale?.startsWith("zh")?"\u5173\u95ED":"Close"),e.style.cssText="position:absolute;right:8px;top:8px;width:30px;height:30px;z-index:1",e.addEventListener("click",S),n.prepend(e)}n?.addEventListener("cancel",e=>{e.preventDefault(),S()});async function D(){if(c||!g||C||!l)return;let e=l;C=!0,i.setAttribute("aria-busy","true");try{await t.actions[e.actionId](structuredClone(e)),l=null}catch(s){v(t.onError,s)}finally{C=!1,c||i.removeAttribute("aria-busy")}}function R(){if(c)throw new d("CONFLICT","Content host has been destroyed");g||(L=q(a),B(),w&&!n&&(i.style.width="100%"),n?.showModal(),g=!0)}try{w||R(),y=F(i,{mode:"live",title:o.name,viewportHeight:o.kind==="page"?r.clientHeight||a.defaultView?.innerHeight||800:void 0,onRendered:H,onError:u=>{let I=new Error(u);x(I),v(t.onError,I)},onEscape:k?S:void 0,onAction:(u,I,J)=>{if(c||!g||C||l)return;let h=o.screen.actions.find(b=>b.id===u),j=o.contract.outputs[u];if(!(h?.type!=="event"||!j))try{let b=Q(j).parse(Object.hasOwn(h.properties,"value")?h.properties.value:h.properties);l={requestId:crypto.randomUUID(),contentVersionId:T.id,actionId:u,event:h.event,value:b,selection:I??{},answers:J??{},requestedClose:h.close},D()}catch(b){v(t.onError,b)}}});let e={destroy:m,show:R,get pendingAction(){return l?structuredClone(l):null},retryAction:D,updateCapabilities:u=>y?.updateCapabilities(u)};V.set(r,e),t.signal?.addEventListener("abort",m,{once:!0}),t.signal?.aborted&&(m(),t.signal.throwIfAborted());let s=M(E,[t.locale,...a.defaultView?.navigator.languages??[]]);if(y.update(E,s,{capabilities:t.capabilities,serverInput:{bindings:$,answers:{},values:f}}),await Promise.race([y.ready,A]),w&&await A,c)throw new Error("Content preparation cancelled");return e}catch(e){throw m(),e}}export{ne as mountContent,re as prepareContent};
@@ -1 +0,0 @@
1
- import{a as le,b as ue,d as de}from"./chunk-GRLMT5PR.js";import"./chunk-SSHUBTT3.js";import{Je as ae,Vg as re}from"./chunk-EJTBSGLV.js";import{a as u}from"./chunk-SOQO2RDZ.js";import{Hb as se}from"./chunk-LMR2TM3X.js";import{a as X}from"./chunk-DSPLGTQI.js";import"./chunk-OBYJWIRB.js";import"./chunk-EXCPE2XH.js";import"./chunk-RRII2DMC.js";import"./chunk-KQCTDXVD.js";function ce(e){let C=e.view;if(!C?.paywall)throw new u("INVALID_REQUEST","The current node is not a Paywall");let n=C.paywall.receiptId,P=C.nodeId,h=C.visit,o=C.paywall.resolution,k=o,s="document"in o?o:null;function v(i){if(!le(i,o))throw new u("INVALID_RESPONSE","The pinned Paywall binding changed")}let a=C.paywall.quote,R=C.paywall.operation,S=!1,T=new AbortController,l=C.paywall.purchaseRequestId,r=0,f=C.paywall.selectionGeneration??0,E=C.paywall.canReselect===!0,y=null,O=new Map,U=new Map;function G(i){if(i.purchase&&i.purchase.receiptId!==n)throw new u("INVALID_RESPONSE","Purchase receipt changed");let w=i.run.paywall;return i.purchase??(w?.receiptId===n?w:null)}function F(){if(S)throw new u("IDENTITY_CHANGED","Paywall presentation has closed")}function _(i,w,c){if(F(),w!==r||c!==void 0&&a?.operationId!==c)return!1;let I=f,d=i.run.paywall;if(d?.receiptId===n){if((d.selectionGeneration??0)<f)return!1;f=d.selectionGeneration??0,E=d.canReselect===!0,v(d.resolution)}let m=G(i),p=f>I,N=p?m?.quote??null:m?.quote??a,q=m?.operation??(N?.operationId===a?.operationId?R:null);return N&&q&&ue(q,{operationId:N.operationId},"Purchase operation changed"),d?.receiptId===n&&(k=d.resolution,s="document"in k?k:s?{...k,document:s.document,offering:s.offering}:null),(p||N?.operationId!==a?.operationId)&&(r++,d?.receiptId===n&&(l=d.purchaseRequestId)),a=N,R=de(R,q,!0),!0}function $(i,w,c){return new Promise((I,d)=>{let m=!1,p=()=>{clearTimeout(D),T.signal.removeEventListener("abort",J)},N=z=>{m||(m=!0,p(),I(z))},q=z=>{m||(m=!0,p(),d(z))},J=()=>q(new u("IDENTITY_CHANGED","Paywall presentation has closed")),D=setTimeout(()=>q(new u("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,c)),Math.max(0,w-Date.now()));T.signal.addEventListener("abort",J,{once:!0}),T.signal.aborted&&J(),i.then(N,q)})}function j(i){return new Promise(w=>{let c=()=>{clearTimeout(I),T.signal.removeEventListener("abort",c),w()},I=setTimeout(c,i);T.signal.addEventListener("abort",c,{once:!0}),T.signal.aborted&&c()})}async function A(i,w,c){F();let I=O.get(i);if(!I){let p=e.pendingCommands?.find(N=>N.requestId===i)??e.pendingCommand;if(p?.operation==="submit"&&p.requestId===i&&p.nodeId===P&&p.visit===h){w.type==="paywall_quote"&&p.input.type==="paywall_quote"&&p.input.predecessor&&!w.predecessor&&(w={...w,predecessor:p.input.predecessor});let N=re.parse(p),q=re.parse({...p,input:w});if(q.operation!=="submit"||N.operation!=="submit"||JSON.stringify(q.input)!==JSON.stringify(N.input))throw new u("CONFLICT","A restored purchase request cannot change its input");w=q.input,I=N,O.set(i,I)}}if(I){if(JSON.stringify(I.input)!==JSON.stringify(w))throw new u("CONFLICT","A purchase request cannot change its input")}else{let p=e.view;if(!p||p.nodeId!==P||p.visit!==h||p.paywall?.receiptId!==n)throw new u("PRECONDITION_FAILED","The Paywall visit has changed");I={operation:"submit",requestId:i,nodeId:P,visit:h,revision:p.revision,input:w},O.set(i,I)}let d=Date.now()+3e4,m=await $(e.submit(I),d,i);for(;m.run.pendingRequest?.requestId===i&&Date.now()<d&&!S&&(await j(Math.min(1e3,d-Date.now())),!(S||Date.now()>=d));)m=await $(e.resume(i),d,i);if(S)throw new u("IDENTITY_CHANGED","Paywall presentation has closed");if(m.run.pendingRequest?.requestId===i)throw new u("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,i);if(!_(m,c,w.type==="paywall_confirm"||w.type==="paywall_cancel"?w.operationId:void 0))throw new u("PRECONDITION_FAILED","The purchase selection has changed")}async function Q(i){if(!a)throw new u("INVALID_REQUEST","A quoted purchase is required");let w=`${i}:${a.operationId}`,c=U.get(w);if(!c){let I=i==="confirm"?"paywall_confirm":"paywall_cancel",d=e.pendingCommands?.find(m=>m.operation==="submit"&&m.input.type===I&&"operationId"in m.input&&m.input.operationId===a.operationId)??e.pendingCommand;c=d?.operation==="submit"&&d.input.type===I&&"operationId"in d.input&&d.input.operationId===a.operationId?d.requestId:crypto.randomUUID(),U.set(w,c)}if(await A(c,{type:i==="confirm"?"paywall_confirm":"paywall_cancel",operationId:a.operationId},r),!R)throw new u("INVALID_RESPONSE","The accepted purchase result is missing");return structuredClone(R)}return{get view(){return structuredClone(s)},get quote(){return a?structuredClone(a):null},get operation(){return R?structuredClone(R):null},get webViewUrl(){return e.webViewUrl},get canReselect(){return E},async refresh(){F();let i=r,w=await e.get();if(_(w,i),w.run.paywall?.receiptId!==n)throw new u("PRECONDITION_FAILED","Paywall presentation has changed");if(!s){if("document"in k||!e.resolvePaywall)throw new u("INVALID_RESPONSE","Public Paywall reader is unavailable");let c=await e.resolvePaywall(k);F(),v(c),s={...k,document:c.document,offering:c.offering}}return structuredClone(s)},preview(i){if(!s)return Promise.reject(new u("PRECONDITION_FAILED","Load the Paywall presentation first"));if(l&&l!==i.requestId&&(y||!E))return Promise.reject(new u("COMMAND_PENDING","Retry the original purchase before starting another"));if(l===i.requestId&&y)return y;let w=s.document.buttons[i.actionId],c=w?.type==="checkout"?ae(w.product,i.selection,s.capabilities):null;if(!c)return Promise.reject(new u("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));let I=l!==i.requestId&&f>0?{operationId:a?.operationId??null,generation:f}:void 0;if(I&&(!E||f<=0))return Promise.reject(new u("COMMAND_PENDING","Original purchase requires authoritative termination"));l!==i.requestId&&r++;let d=r;l=i.requestId;let m=(async()=>{if(await A(i.requestId,{type:"paywall_quote",actionId:i.actionId,productVersionId:c,...I?{predecessor:I}:{},...i.offerId?{offerId:i.offerId}:{},...i.nativeOffer?{nativeOffer:i.nativeOffer}:{}},d),!a)throw new u("INVALID_RESPONSE","The accepted quote is missing");return structuredClone(a)})();return y=m,m.then(()=>{y===m&&(y=null)},p=>{y===m&&(y=null),l===i.requestId&&e.pendingCommand?.requestId!==i.requestId&&p instanceof u&&p.status!==void 0&&p.status<500&&![401,425].includes(p.status)&&(l=null)}),m},confirm:()=>Q("confirm"),cancel:()=>Q("cancel"),async read(){if(F(),!a)throw new u("INVALID_REQUEST","A quoted purchase is required");let i=a.operationId,w=r,c=e.pendingCommands?.find(p=>p.operation==="submit"&&(p.input.type==="paywall_confirm"||p.input.type==="paywall_cancel")&&p.input.operationId===i)??e.pendingCommand;c?.operation==="submit"&&(c.input.type==="paywall_confirm"||c.input.type==="paywall_cancel")&&c.input.operationId===i&&await e.settle?.(c.requestId);let I=await e.get(void 0,{receiptId:n,operationId:i});F();let d=G(I);if(d?.quote&&d.quote.operationId!==i||d?.operation&&d.operation.operationId!==i)throw new u("INVALID_RESPONSE","Purchase operation changed");let m=_(I,w,i)?R:d?.operation;if(!m)throw new u("INVALID_RESPONSE","The current purchase result is missing");return structuredClone(m)},destroy(){S=!0,T.abort(),O.clear(),U.clear()}}}function pe(e){let C=new Set,n=new Set,P=null;function h(o){if(e.reviewing||C.has(o)||n.has(o)||e.stopped)return;n.add(o);let k=async()=>{if(e.reviewing||e.stopped||e.key!==o){n.delete(o);return}if(e.busy||e.client.pendingCommand){setTimeout(()=>{k()},250);return}let s=(async()=>{let a=e.client.view,R=e.expected(),S=R.requestId,T=!1;try{await e.client.submit({operation:"shown",...R})}catch(l){if(!(l instanceof u)||l.code!=="CONFLICT"||l.status!==409||e.client.pendingCommand)throw l;await e.client.get();let r=e.client.view;if(e.stopped||e.reviewing||e.key!==o||!r||!a||r.id!==a.id||r.source.versionId!==a.source.versionId||r.nodeId!==R.nodeId||r.visit!==R.visit||r.revision<=R.revision||r.stopped||!r.screen||!["running","waiting"].includes(r.status)||e.client.pendingCommand)throw l;let f=e.expected();S=f.requestId,await e.client.submit({operation:"shown",...f})}for(;!e.stopped&&e.key===o&&e.client.pendingCommand?.requestId===S;){if(!e.client.settle)throw new u("COMMAND_PENDING","The original display acknowledgement is still pending");await e.client.settle(S),T=!0,e.client.pendingCommand?.requestId===S&&await new Promise(l=>setTimeout(l,1500))}e.stopped||e.key!==o||(T&&await e.client.get(),!(e.stopped||e.key!==o)&&C.add(o))})();P=s;let v=()=>{P===s&&(P=null),n.delete(o)};s.then(v,a=>{v(),e.busy||e.fail(a)})};k()}return{report:h,get inFlight(){return P}}}function fe(e){let C={},n=new Map;async function P(h){let o=e.client.view,k=o?.screen,s=k?.customerData.nodes[h.nodeId];if(e.stopped||e.busy||!o||!k||!s)return;if(!["refresh","next","previous","filter","sources_next","sources_previous"].includes(h.action)){let r=e.document,f=r?se(r,h.nodeId):null,E=f?.type==="customer_data"?f.data.outputs?.[h.action]:void 0;E&&k.outputs.includes(E)?await e.perform(()=>e.client.submit({operation:"submit",...e.expected(),input:{type:"screen",output:E,answers:e.answers,selection:h.value?{[h.nodeId]:h.value}:{}}})):await e.onIntent?.(h,o);return}let a=h.action.startsWith("sources_")?s.resources.find(r=>r.key===h.value):null;if(h.action.startsWith("sources_")&&!a)throw new u("INVALID_REQUEST","Choose a current resource");let R=`${o.visit}:${h.nodeId}:${a?.key??""}`,S=n.get(R)??[null],l=C[h.nodeId]??{page:1,after:null,filter:"all",...a?{resourceKey:a.key}:{}};if(h.action==="filter"){let r=h.value;if(!r||!(s.source==="offer_history"?["all","issued","reserved","redeemed","expired","revoked"]:["all","purchase","refund","source","usage","debt","settlement"]).includes(r))throw new u("INVALID_REQUEST","Unknown data filter");l={page:1,after:null,filter:r},S.splice(0,S.length,null)}else if(h.action==="next"||h.action==="sources_next"){let r=a?.sources.at(-1),f=a?r?{kind:"ledger",cursor:{at:r.detail[0],id:r.id,type:"source"}}:null:k.dataCursors[h.nodeId];if(!f||!a&&!s.hasNext)return;S[l.page]=f,l={...l,page:l.page+1,after:f}}else if(h.action==="previous"||h.action==="sources_previous"){if(l.page<=1)return;l={...l,page:l.page-1,after:S[l.page-2]??null}}n.set(R,S),C={...C,[h.nodeId]:l},await e.perform(()=>e.client.get({nodeId:o.nodeId,visit:o.visit,revision:o.revision,components:C}))}return{get queries(){return C},intent:P,reset(){C={},n.clear()}}}function we(e){let{doc:C,holder:n,reviewHolder:P,mountScreenPreview:h}=e,o=!1,k,s=0,v=null,a="",R=new Map,S=r=>r?`${r.id}:${r.nodeId}:${r.visit}:${r.revision}:${r.paywall?.quote?.operationId??""}`:"";async function T(r){if(e.stopped||!e.client.review)return;o||(a=S(e.client.view),R.set(a,structuredClone(e.answers))),o=!0,k=r,n.hidden=!0,e.suspend(!0),P.hidden=!1;let f=++s;try{let E=await e.client.review(r);if(e.stopped||f!==s||!o)return;if(!E.review)throw new u("INVALID_RESPONSE","Historical projection is missing");v?.destroy(),v=null,P.replaceChildren();let y=E.run.locale.startsWith("zh"),O=C.createElement("p");O.textContent=y?"\u53EA\u8BFB\u56DE\u770B":"Read-only history",P.append(O);for(let[F,_]of E.review.pages.entries()){let $=C.createElement("button");$.type="button",$.textContent=y?`\u7B2C ${F+1} \u9875`:`Page ${F+1}`,$.onclick=()=>{T(_.receiptId)},P.append($)}if(E.review.page){let F=E.review.page,_=C.createElement("div");if(_.inert=!0,P.append(_),v=h(_,{mode:"live",rendererUrl:e.client.webViewUrl,title:F.document.name,onAction:()=>{},onAnswers:()=>{},onCustomerDataIntent:()=>{},onRendered:()=>{},onEscape:()=>{l()}}),v.update(F.document,E.run.locale,{serverInput:{bindings:F.inputs,answers:F.answers,values:F.values}}),await v.ready,e.stopped||f!==s||!o)return}let U=y?{issued:"\u5DF2\u9886\u53D6",reserved:"\u5DF2\u9884\u7559",redeemed:"\u5DF2\u4F7F\u7528",expired:"\u5DF2\u8FC7\u671F",revoked:"\u5DF2\u64A4\u9500",unknown:"\u72B6\u6001\u5F85\u786E\u8BA4"}:{issued:"Issued",reserved:"Reserved",redeemed:"Used",expired:"Expired",revoked:"Revoked",unknown:"Status unconfirmed"},G=y?{pending:"\u5904\u7406\u4E2D",complete:"\u5DF2\u5B8C\u6210",cancelled:"\u5DF2\u53D6\u6D88",failed:"\u5931\u8D25",unknown:"\u72B6\u6001\u5F85\u786E\u8BA4"}:{pending:"Processing",complete:"Completed",cancelled:"Cancelled",failed:"Failed",unknown:"Status unconfirmed"};for(let F of[...E.review.coupons.map((_,$)=>`${y?"\u4F18\u60E0\u5238":"Coupon"} ${$+1}: ${U[_.status]}`),...E.review.purchases.map((_,$)=>`${y?"\u8D2D\u4E70":"Purchase"} ${$+1}: ${G[_.status]}`)]){let _=C.createElement("p");_.textContent=F,P.append(_)}e.client.view&&await e.enqueue(e.client.view)}catch(E){if(f!==s||e.stopped)return;v?.destroy(),v=null,P.replaceChildren(),e.fail(E)}}async function l(){if(!o||e.stopped||!e.client.review)return;let r=++s;try{if(await e.client.review(),e.stopped||r!==s)return;o=!1,s++,v?.destroy(),v=null,P.replaceChildren(),P.hidden=!0,n.hidden=!1;let f=e.client.view;S(f)!==a?(R.set(a,structuredClone(e.answers)),e.resetScreen()):(R.delete(a),e.suspend(!1)),f&&await e.enqueue(f)}catch(f){if(r!==s||e.stopped)return;v?.destroy(),v=null,P.replaceChildren(),e.fail(f)}}return{get active(){return o},get receipt(){return k},open:T,exit:l,get drafts(){return new Map([...R].map(([r,f])=>[r,structuredClone(f)]))},stop(){o=!1,s++,v?.destroy(),v=null,P.replaceChildren(),P.hidden=!0,n.hidden=!1}}}async function Ue(e,C){let n=C,{mountScreenPreview:P}=await import("./screen-renderer-DLXDQQKK.js"),{showPaywall:h}=await import("./paywall-734GWAS4.js"),o=e.ownerDocument,k=o.activeElement,s=o.createElement("section"),v=o.createElement("div"),a=o.createElement("div"),R=o.createElement("div"),S=o.createElement("button");R.hidden=!0,S.type="button";let T=o.createElement("p"),l=o.createElement("p"),r=o.createElement("button"),f=o.createElement("button"),E=o.createElement("button"),y=o.createElement("dialog");s.dataset.indianaFunnel="",s.setAttribute("aria-busy","false"),s.style.cssText="box-sizing:border-box;width:100%;min-width:0;font:14px/1.5 system-ui,sans-serif;color:#172033;background:#fff",a.style.cssText="display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:12px 20px",T.setAttribute("role","status"),l.setAttribute("role","alert"),l.hidden=!0,r.type=f.type=E.type="button",a.append(r,T,l,E,S,f),s.append(v,R,a),e.append(s);let O=null,U=null,G=null,F="",_="",$="",j="",A=!1,Q=0,i=!1,w="",c=null,I=Promise.resolve(),d=null,m=null,p=new Set,N={},q=(t,g=null)=>{A||(m=g,l.textContent=t instanceof Error?t.message:"Request failed",l.hidden=!1,E.hidden=n.client.pendingCommand===null,X(n.onError,t))};function J(){let t=n.client.view;if(!t)throw new u("INVALID_REQUEST","No current Run is available");return{requestId:crypto.randomUUID(),nodeId:t.nodeId,visit:t.visit,revision:t.revision}}let D=we({client:n.client,doc:o,holder:v,reviewHolder:R,mountScreenPreview:P,get stopped(){return A},get answers(){return N},suspend(t){U?.setSuspended(t)},resetScreen(){F="",_=""},enqueue:W,fail:q}),z=pe({client:n.client,expected:J,fail:q,get stopped(){return A},get reviewing(){return D.active},get key(){return F},get busy(){return Q}}),Z=fe({client:n.client,expected:J,perform:B,onIntent:n.onCustomerDataIntent,get stopped(){return A},get busy(){return Q},get document(){return O?.document},get answers(){return N}});async function B(t,g=!1){if(!(Q&&!g||A||D.active&&!g)){Q++,s.setAttribute("aria-busy","true"),l.hidden=!0,m=null;try{if(!g&&z.inFlight){let b=n.client.view;await z.inFlight;let L=n.client.view;if(!b||!L||L.id!==b.id||L.nodeId!==b.nodeId||L.visit!==b.visit||L.stopped||!["running","waiting"].includes(L.status))throw new u("PRECONDITION_FAILED","The screen changed while its display was acknowledged")}if(A)return;let M=await t();A||await W(n.client.view??M.run)}catch(M){q(M,n.client.pendingCommand?.requestId??null)}finally{Q=Math.max(0,Q-1),s.setAttribute("aria-busy",String(Q>0)),A||(E.hidden=n.client.pendingCommand===null,r.disabled=Q>0||!!n.client.pendingCommand||!n.client.view?.canBack)}}}function x(){c&&clearTimeout(c),!(A||!G||!["running","waiting"].includes(G.status)&&!n.client.pendingCommand)&&(c=setTimeout(()=>{c=null,oe().finally(x)},G.pendingRequest||n.client.pendingCommand?1500:5e3))}async function oe(){if(!(A||i||Q)){if(D.active){await D.open(D.receipt);return}i=!0;try{let t=n.client.pendingCommand;t&&n.client.settle&&await n.client.settle(t.requestId);let g=n.client.view,M=Z.queries,b=await n.client.get(g?.screen&&Object.keys(M).length?{nodeId:g.nodeId,visit:g.visit,revision:g.revision,components:M}:void 0);!A&&M===Z.queries&&await W(n.client.view??b.run)}catch(t){q(t)}finally{i=!1}}}function me(t){let g=t.screen?.presentation;if(!g||g.type==="inline"){y.open&&y.close(),s.parentElement!==e&&e.append(s);return}s.parentElement!==y&&(y.append(s),e.append(y));let M={sm:420,md:640,lg:900};y.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${"size"in g?M[g.size]+"px":"100vw"}`,y.setAttribute("aria-label",O?.document?.name??t.screen?.content.document.name??"Funnel"),y.open||y.showModal()}async function ye(t){if(A)return;G=t,m&&n.client.pendingCommand?.requestId!==m&&(l.hidden=!0,m=null);let g=t.locale.startsWith("zh");if(S.textContent=g?"\u56DE\u770B":"History",S.hidden=!n.client.review,r.textContent=D.active?g?"\u8FD4\u56DE\u5F53\u524D":"Return to current":g?"\u8FD4\u56DE":"Back",f.textContent=g?"\u5173\u95ED":"Close",E.textContent=g?"\u91CD\u8BD5":"Retry",r.disabled=!D.active&&(Q>0||!!n.client.pendingCommand||!t.canBack),E.hidden=n.client.pendingCommand===null,T.textContent=t.pendingRequest?g?"\u6B63\u5728\u5904\u7406":"Processing":t.instruction?.type==="wait"?g?"\u7B49\u5F85\u4E2D":"Waiting":"",w!==`${t.revision}:${t.visit}:${t.status}:${t.stopped}`&&(w=`${t.revision}:${t.visit}:${t.status}:${t.stopped}`,X(n.onState,structuredClone(t))),t.stopped||n.client.configurationReady===!1){D.stop(),O?.destroy(),O=null,U?.destroy(),U=null,v.replaceChildren(),F="",_="",j="",y.open&&y.close(),s.hidden=!0,x();return}if(s.hidden=!1,D.active){x();return}let M=t.screen||t.paywall?`${t.id}:${t.nodeId}:${t.visit}`:"";if(M!==F&&(O?.destroy(),O=null,U?.destroy(),U=null,v.replaceChildren(),F=M,_="",j="",N={...t.answers},Z.reset()),me(t),t.screen){let L=t.screen.content;O||(O=P(v,{mode:"live",rendererUrl:n.client.webViewUrl,title:L.document.name,onAction(H,te={},ie={}){if(D.active)return;N={...N,...ie};let Ie=Object.fromEntries((t.screen?.inputs??[]).filter(({variable:ne})=>Object.hasOwn(N,ne)).map(({variable:ne})=>[ne,N[ne]]));B(()=>n.client.submit({operation:"submit",...J(),input:{type:"screen",output:H,answers:Ie,selection:te}}))},onAnswers:H=>{D.active||(N={...N,...H})},onCustomerDataIntent:H=>{D.active||Z.intent(H).catch(q)},onEscape:()=>{D.active||K()},onError:H=>q(new Error(H)),onRendered:()=>z.report(M)}));let V={capabilities:t.screen.capabilities,customerData:t.screen.customerData,parameters:t.parameters,serverInput:{bindings:t.screen.inputs,answers:N,values:t.screen.values}},Y=JSON.stringify([L,t.locale,V.parameters,t.screen.inputs,t.screen.values]);if(Y!==_)O.update(L.document,t.locale,V),_=Y,$=JSON.stringify(V.capabilities),j=JSON.stringify(V.customerData);else{let H=JSON.stringify(V.capabilities);H!==$&&(O.updateCapabilities(V.capabilities),$=H),JSON.stringify(V.customerData)!==j&&(O.updateCustomerData(V.customerData),j=JSON.stringify(V.customerData))}await O.ready}else if(t.paywall&&!U){let L=await h(v,{canInteract:()=>!D.active&&!A,start:async()=>ce(n.client),onPurchase:n.onPurchase,onCheckoutUrl:n.onCheckoutUrl,resolveOfferId:n.resolveOfferId,onEvent:n.onEvent,onOpenUrl:V=>n.onOpenUrl?n.onOpenUrl({receiptId:t.paywall.receiptId,url:V,openIn:"same_window"}):o.defaultView?.location.assign(V),onAction:async V=>{if(D.active)return;let Y=await n.client.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:t.nodeId,visit:t.visit,revision:t.revision,input:{type:"screen",output:V,answers:{}}});await W(n.client.view??Y.run)},onError:q,onDismiss:()=>{!D.active&&!A&&n.client.view?.visit===t.visit&&K()}});A?L.host?.destroy():(U=L.host,U?.setSuspended(D.active)),z.report(M)}let b=t.instruction;if(b&&(b.type==="open_url"||b.type==="event")&&!p.has(b.receiptId)){let L=o.createElement("button");L.type="button",L.textContent=b.type==="open_url"?`${g?"\u524D\u5F80":"Continue to"} ${new URL(b.url).host}`:g?"\u7EE7\u7EED":"Continue",L.onclick=()=>{let V=J(),Y=b.type==="open_url"&&!n.onOpenUrl&&b.openIn==="new_window"?he(b.url):null;B(async()=>{let H="success";if(b.type==="open_url")if(n.onOpenUrl)try{H=await n.onOpenUrl({receiptId:b.receiptId,url:b.url,openIn:b.openIn})===!1?"failed":"opened"}catch(ie){X(n.onError,ie),H="failed"}else H=b.openIn==="new_window"&&!Y?"failed":"opened";if(b.type==="event"){if(!n.onEvent)throw new u("EVENT_HANDLER_REQUIRED","Provide the event handler");await n.onEvent(b.event)}if(A||n.client.view?.nodeId!==V.nodeId||n.client.view.visit!==V.visit)throw new u("PRECONDITION_FAILED","The client action visit changed");let te=await n.client.submit({operation:"submit",...V,input:{type:"client_action",receiptId:b.receiptId,outcome:H}});return p.add(b.receiptId),b.type==="open_url"&&!n.onOpenUrl&&b.openIn==="same_window"&&o.defaultView?.location.assign(b.url),te})},v.replaceChildren(L)}!t.pendingRequest&&t.status==="completed"&&!p.has(`complete:${t.id}`)&&(p.add(`complete:${t.id}`),X(n.onComplete,structuredClone(t))),x()}function he(t){let g=o.defaultView?.open(t,"_blank")??null;return g&&(g.opener=null),g}function W(t){return I=I.catch(()=>{}).then(()=>ye(t)),I}let ve=n.client.subscribe(t=>{n.client.configurationReady===!1&&(s.hidden=!0,O?.destroy(),O=null,U?.destroy(),U=null,v.replaceChildren(),F="",_="",j="",y.open&&y.close()),W(t).catch(q)}),ge=n.client.subscribeError?.(q);function K(){return d||(A?Promise.resolve():n.client.view&&!["running","waiting"].includes(n.client.view.status)?(ee(),Promise.resolve()):(d=B(()=>n.client.submit({operation:"close",...J()}),!0).then(()=>{n.client.view?.status==="closed"&&ee()}).finally(()=>{d=null}),d))}function ee(){A||(A=!0,c&&clearTimeout(c),ve(),ge?.(),O?.destroy(),D.stop(),U?.destroy(),y.close(),y.remove(),s.remove(),k instanceof HTMLElement&&k.isConnected&&k.focus(),X(n.onDismiss,G?structuredClone(G):null))}r.onclick=()=>{if(D.active){D.exit();return}B(()=>n.client.submit({operation:"back",...J()}))},S.onclick=()=>{D.open()},f.onclick=()=>{K()},E.onclick=()=>{B(()=>n.client.retry())},y.addEventListener("cancel",t=>{t.preventDefault(),K()});try{let t=await n.client.get();await W(n.client.view??t.run)}catch(t){throw ee(),t}return{destroy:ee,refresh:oe,review:D.open,exitReview:D.exit,get unappliedDrafts(){return D.drafts}}}export{Ue as showFunnelRun};
@@ -1 +0,0 @@
1
- import{b as W}from"./chunk-SSLZKIIU.js";import"./chunk-SSHUBTT3.js";import{Je as q,ek as j}from"./chunk-EJTBSGLV.js";import{a as w}from"./chunk-SOQO2RDZ.js";import{ka as L,v as $}from"./chunk-LMR2TM3X.js";import{a as z}from"./chunk-DSPLGTQI.js";import"./chunk-OBYJWIRB.js";import"./chunk-EXCPE2XH.js";import"./chunk-RRII2DMC.js";import"./chunk-KQCTDXVD.js";async function J(v,t,h){if(t.status!=="complete")throw new w("INVALID_RESPONSE","A verified completed purchase is required");if(await h.onComplete?.(t),!v||!h.check)return;let P=L.parse(await h.check());if(P.internal_feature_id!==v.internal_feature_id||P.quantity!==v.quantity)throw new w("INVALID_RESPONSE","The access requirement changed");P.allowed&&await h.onAccessGranted?.(P)}async function se(v,t){let h=t.check?L.parse(await t.check()):null;if(h?.allowed)return await t.onAccessGranted?.(h),{check:h,host:null};let P=W(v.ownerDocument),n=await t.start(),y=n.view??await n.refresh();if(!y)throw new w("INVALID_RESPONSE","Paywall presentation is missing");let{mountScreenPreview:K}=await import("./screen-renderer-DLXDQQKK.js"),i=v.ownerDocument,O=new AbortController,b=i.createElement("section"),Q=i.createElement("div"),D=i.createElement("div"),g=i.createElement("p"),c=i.createElement("button"),_=i.createElement("button"),u=i.createElement("dialog"),p=y.document.screen.strings.defaultLocale.startsWith("zh");b.dataset.indianaPaywall="",b.setAttribute("aria-label",y.document.name),b.style.cssText="width:100%;box-sizing:border-box;background:#fff;color:#172033;font:14px/1.5 system-ui,sans-serif",D.style.cssText="display:flex;gap:12px;padding:12px 20px;align-items:center;flex-wrap:wrap",g.setAttribute("role","status"),_.textContent=p?"\u5173\u95ED":"Close",c.textContent=p?"\u91CD\u8BD5":"Retry",c.hidden=!0,D.append(g,c,_),b.append(Q,D);let U=y.document.presentation,R,d=!1,T=!1,f=null,G=!1,m=()=>!G&&t.canInteract?.()!==!1,M=!1,r=null,I=null,N=e=>{g.textContent=e instanceof Error?e.message:p?"\u8BF7\u6C42\u5931\u8D25":"Request failed",z(t.onError,e),c.hidden=r===null};async function C(e){if(!(T||d||!m())){T=!0,c.hidden=!0,g.textContent="";try{await e()}catch(s){d||N(s)}finally{T=!1}}}async function X(e){await J(h,e,t)}async function E(e){if(d)return;if(!m()){r=async()=>E(await n.read()),c.hidden=!1;return}if(g.textContent=e.status,e.status==="complete"){r=null,await X(e);return}if(e.status!=="pending"){if(n.canReselect===!1){g.textContent=p?"\u6B63\u5728\u6838\u5BF9\u539F\u8D2D\u4E70\u7ED3\u679C":"Checking the original purchase result",c.textContent=p?"\u67E5\u8BE2\u7ED3\u679C":"Check result",r=async()=>E(await n.read()),c.hidden=!1;return}c.textContent=p?"\u91CD\u8BD5":"Retry",r=null,f=null;return}let s=Date.now()+6e5,l=2e3;for(;!d&&Date.now()<s;){if(await new Promise(k=>{let S=()=>{clearTimeout(A),k()},A=setTimeout(()=>{O.signal.removeEventListener("abort",S),k()},l);O.signal.addEventListener("abort",S,{once:!0})}),d)return;if(!m()){r=async()=>E(await n.read()),c.hidden=!1;return}let a=await n.read();if(a.status!=="pending"){await E(a);return}l=Math.min(l*1.5,3e4)}r=async()=>E(await n.read()),c.hidden=!1}async function V(){I?.remove(),I=null,r=V;let e=await n.confirm();if(!m()){r=V,c.hidden=!1;return}if(e.status==="pending"){if(e.checkoutUrl)t.onCheckoutUrl?await t.onCheckoutUrl(e.checkoutUrl):i.defaultView?.location.assign(e.checkoutUrl);else if(e.execution||e.nativePurchase){if(!t.onPurchase)throw new w("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await t.onPurchase({operation:e,signal:O.signal})}}r=async()=>E(await n.read()),await E(e)}function Y(e){I?.remove();let s=i.createElement("div"),l=i.createElement("button"),a=i.createElement("button"),k=i.createElement("p");k.textContent=e.lines.map(o=>o.productName).join(", ")+" \xB7 "+$(e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),e.currency),l.textContent=p?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",a.textContent=p?"\u53D6\u6D88":"Cancel",l.onclick=()=>{C(V)};let S=async()=>{let o=await n.cancel();d||(s.remove(),I=null,await E(o))};a.onclick=()=>{r=S,C(S)};let A=i.createElement("div");for(let o of e.lines){let F=i.createElement("p");if(F.textContent=`${o.productName} \xB7 ${$(o.catalogAmountMinor,e.currency)}${j(o.interval,p?"zh-CN":"en",o.intervalCount??1)}`,A.append(F),o.trial){let B=i.createElement("p");B.textContent=p?`\u8BD5\u7528 ${o.trial.days} \u5929\uFF1B${o.trial.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${o.trial.days}; ${o.trial.cardRequired?"a payment method is required":"no payment method is required"}`,A.append(B)}}if(!e.charge){let o=i.createElement("p");o.textContent=p?"\u76EE\u5F55\u4EF7\u683C\uFF1B\u6700\u7EC8\u91D1\u989D\u4EE5\u7ED3\u8D26\u65F6\u7A0E\u8D39\u548C\u8BD5\u7528\u89C4\u5219\u4E3A\u51C6\u3002":"Catalog price; the final charge depends on checkout taxes and trial terms.",A.append(o)}s.append(k,A,l,a),D.prepend(s),I=s,r=null}async function H(){if(!f)return;if(r=H,!M){let s=n.view,l=s?.document.buttons[f.actionId],a=s&&l?.type==="checkout"?q(l.product,f.selection,s.capabilities):null;if(!a)throw new w("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");let k=await t.resolveOfferId?.({actionId:f.actionId,productVersionId:a});if(d)return;k!==void 0&&(f.offerId=k),M=!0}if(!m()){c.hidden=!1;return}let e=await n.preview(f);d||Y(e)}function x(e="destroy"){d||(d=!0,O.abort(),R?.destroy(),n.destroy(),u.open&&u.close(),u.remove(),b.remove(),P(),e==="dismiss"&&z(t.onDismiss))}_.onclick=()=>{m()&&x("dismiss")},u.addEventListener("cancel",e=>{e.preventDefault(),m()&&x("dismiss")}),c.onclick=()=>{r&&C(r)};try{if(U.type==="inline")v.append(b);else{let e={sm:420,md:640,lg:900};u.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${"size"in U?e[U.size]+"px":"100vw"}`,u.setAttribute("aria-label",y.document.name),u.append(b),v.append(u),m()&&u.showModal()}R=K(Q,{mode:"live",rendererUrl:n.webViewUrl,title:y.document.name,onAction(e,s={}){if(!m())return;let l=n.view,a=l?.document.buttons[e];if(a){if(a.type==="close"){C(async()=>{await t.onAction?.(e),x(t.onAction?"action":"dismiss")});return}if(a.type==="action"){r=async()=>{if(a.action.type==="event"){if(!t.onEvent)throw new w("EVENT_HANDLER_REQUIRED","Provide the event handler");await t.onEvent(a.action.event)}else t.onOpenUrl?await t.onOpenUrl(a.action.url):i.defaultView?.location.assign(a.action.url);await t.onAction?.(e),r=null},C(r);return}if((n.quote||f)&&n.canReselect===!1){r=n.quote?async()=>E(await n.read()):H,C(r);return}if(!l||!q(a.product,s,l.capabilities)){N(new w("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(f&&f.actionId!==e){N(new w("COMMAND_PENDING","Finish the current purchase"));return}f||(f={requestId:crypto.randomUUID(),actionId:e,selection:s},M=!1),C(H)}},onEscape:()=>{m()&&x("dismiss")},onError:e=>N(new Error(e))}),R.update(y.document.screen,y.document.screen.strings.defaultLocale,{capabilities:y.capabilities,serverInput:{bindings:[],answers:{}}}),await R.ready}catch(e){throw x(),e}return{check:h,host:{setSuspended(e){G=e,b.hidden=e,e&&u.open?u.close():!e&&!d&&U.type!=="inline"&&!u.open&&u.showModal()},destroy:x,refresh:async()=>{if(!m()){if(n.view)return n.view;throw new w("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await n.refresh();return d||R?.updateCapabilities(e.capabilities),e}}}}export{se as showPaywall};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,g as f,h as g,i as h,j as i}from"./chunk-BUDTHBFF.js";import"./chunk-SSLZKIIU.js";import"./chunk-SOQO2RDZ.js";import"./chunk-LMR2TM3X.js";import"./chunk-DSPLGTQI.js";import"./chunk-RRII2DMC.js";import"./chunk-KQCTDXVD.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};
@@ -1 +0,0 @@
1
- import{$ as Ha,$a as lc,$b as td,$c as lg,$d as lh,$e as ri,$f as xj,$g as xk,$h as xl,$i as xm,$j as yn,A as Y,Aa as Hb,Ab as Mc,Ac as ce,Ad as Mg,Ae as Mh,Af as Yi,Ag as Yj,Ah as Yk,Ai as Yl,Aj as Ym,Ak as co,B as Z,Ba as Ib,Bb as Nc,Bc as Nf,Bd as Ng,Be as Nh,Bf as Zi,Bg as Zj,Bh as Zk,Bi as Zl,Bj as Zm,Bk as eo,C as _,Ca as Jb,Cb as Oc,Cc as Of,Cd as Og,Ce as Oh,Cf as _i,Cg as _j,Ch as _k,Ci as _l,Cj as _m,Ck as fo,D as $,Da as Kb,Db as Pc,Dc as Pf,Dd as Pg,De as Ph,Df as $i,Dg as $j,Dh as $k,Di as $l,Dj as $m,E as aa,Ea as Lb,Eb as Qc,Ec as Qf,Ed as Qg,Ee as Qh,Ef as aj,Eg as ak,Eh as al,Ei as am,Ej as an,F as ba,Fa as Mb,Fb as Rc,Fc as Rf,Fd as Rg,Fe as Rh,Ff as bj,Fg as bk,Fh as bl,Fi as bm,Fj as bn,G as ma,Ga as Nb,Gb as Sc,Gc as Sf,Gd as Sg,Ge as Sh,Gf as cj,Gg as ck,Gh as cl,Gi as cm,Gj as cn,H as na,Ha as Tb,Hb as Tc,Hc as Tf,Hd as Tg,He as Th,Hf as dj,Hg as dk,Hh as dl,Hi as dm,Hj as dn,I as oa,Ia as Ub,Ib as Uc,Ic as Uf,Id as Ug,Ie as Uh,If as ej,Ig as ek,Ih as el,Ii as em,Ij as en,J as pa,Ja as Vb,Jb as Vc,Jc as Vf,Jd as Vg,Je as Vh,Jf as fj,Jg as fk,Jh as fl,Ji as fm,Jj as fn,K as qa,Ka as Wb,Kb as Wc,Kc as Wf,Kd as Wg,Ke as Wh,Kf as gj,Kg as gk,Kh as gl,Ki as gm,Kj as gn,L as ra,La as Xb,Lb as Xc,Lc as Xf,Ld as Xg,Le as Xh,Lf as hj,Lg as hk,Lh as hl,Li as hm,Lj as hn,M as sa,Ma as Yb,Mb as Yc,Mc as Yf,Md as Yg,Me as Yh,Mf as ij,Mg as ik,Mh as il,Mi as im,Mj as jn,N as ta,Na as Zb,Nb as Zc,Nc as Zf,Nd as Zg,Ne as Zh,Nf as jj,Ng as jk,Nh as jl,Ni as jm,Nj as kn,O as ua,Oa as _b,Ob as _c,Oc as _f,Od as _g,Oe as _h,Of as kj,Og as kk,Oh as kl,Oi as km,Oj as ln,P as va,Pa as $b,Pb as $c,Pc as $f,Pd as $g,Pe as $h,Pf as lj,Pg as lk,Ph as ll,Pi as lm,Pj as mn,Q as wa,Qa as ac,Qb as ad,Qc as ag,Qd as ah,Qe as ai,Qf as mj,Qg as mk,Qh as ml,Qi as mm,Qj as nn,R as xa,Ra as bc,Rb as bd,Rc as bg,Rd as bh,Re as bi,Rf as nj,Rg as nk,Rh as nl,Ri as nm,Rj as on,S as ya,Sa as cc,Sb as cd,Sc as cg,Sd as ch,Se as ci,Sf as oj,Sg as ok,Sh as ol,Si as om,Sj as pn,T as za,Ta as dc,Tb as dd,Tc as dg,Td as dh,Te as di,Tf as pj,Tg as pk,Th as pl,Ti as pm,Tj as qn,U as Aa,Ua as ec,Ub as ed,Uc as eg,Ud as eh,Ue as ei,Uf as qj,Ug as qk,Uh as ql,Ui as qm,Uj as rn,V as Ba,Va as fc,Vb as fd,Vc as fg,Vd as fh,Ve as fi,Vf as rj,Vg as rk,Vh as rl,Vi as rm,Vj as sn,W as Ca,Wa as gc,Wb as gd,Wc as gg,Wd as gh,We as gi,Wf as sj,Wg as sk,Wh as sl,Wi as sm,Wj as tn,X as Da,Xa as hc,Xb as hd,Xc as hg,Xd as hh,Xe as hi,Xf as tj,Xg as tk,Xh as tl,Xi as tm,Xj as un,Y as Ea,Ya as ic,Yb as qd,Yc as ig,Yd as ih,Ye as ii,Yf as uj,Yg as uk,Yh as ul,Yi as um,Yj as vn,Z as Fa,Za as jc,Zb as rd,Zc as jg,Zd as jh,Ze as ji,Zf as vj,Zg as vk,Zh as vl,Zi as vm,Zj as wn,_ as Ga,_a as kc,_b as sd,_c as kg,_d as kh,_e as ki,_f as wj,_g as wk,_h as wl,_i as wm,_j as xn,a as c,aa as Ia,ab as mc,ac as ud,ad as mg,ae as mh,af as si,ag as yj,ah as yk,ai as yl,aj as ym,ak as zn,b as d,ba as Ja,bb as nc,bc as vd,bd as ng,be as nh,bf as ti,bg as zj,bh as zk,bi as zl,bj as zm,bk as An,c as e,ca as Ka,cb as oc,cc as wd,cd as og,ce as oh,cf as ui,cg as Aj,ch as Ak,ci as Al,cj as Am,ck as Bn,d as f,da as La,db as pc,dc as xd,dd as pg,de as ph,df as vi,dg as Bj,dh as Bk,di as Bl,dj as Bm,dk as Cn,e as g,ea as Ma,eb as qc,ec as yd,ed as qg,ee as qh,ef as wi,eg as Cj,eh as Ck,ei as Cl,ej as Cm,ek as Dn,f as h,fa as Na,fb as rc,fc as zd,fd as rg,fe as rh,ff as xi,fg as Dj,fh as Dk,fi as Dl,fj as Dm,fk as En,g as i,ga as Oa,gb as sc,gc as Kd,gd as sg,ge as sh,gf as yi,gg as Ej,gh as Ek,gi as El,gj as Em,gk as Fn,h as j,ha as Pa,hb as tc,hc as Ld,hd as tg,he as th,hf as zi,hg as Fj,hh as Fk,hi as Fl,hj as Fm,hk as Gn,i as k,ia as Qa,ib as uc,ic as Md,id as ug,ie as uh,if as Ai,ig as Gj,ih as Gk,ii as Gl,ij as Gm,ik as Hn,j as l,ja as Ra,jb as vc,jc as Nd,jd as vg,je as vh,jf as Bi,jg as Hj,jh as Hk,ji as Hl,jj as Hm,jk as In,k as m,ka as Sa,kb as wc,kc as Od,kd as wg,ke as wh,kf as Ci,kg as Ij,kh as Ik,ki as Il,kj as Im,kk as Jn,l as n,la as Ta,lb as xc,lc as Pd,ld as xg,le as xh,lf as Di,lg as Jj,lh as Jk,li as Jl,lj as Jm,lk as Kn,m as o,ma as Ua,mb as yc,mc as Qd,md as yg,me as yh,mf as Ki,mg as Kj,mh as Kk,mi as Kl,mj as Km,mk as Ln,n as p,na as Va,nb as zc,nc as Rd,nd as zg,ne as zh,nf as Li,ng as Lj,nh as Lk,ni as Ll,nj as Lm,nk as Rn,o as G,oa as Wa,ob as Ac,oc as Sd,od as Ag,oe as Ah,of as Mi,og as Mj,oh as Mk,oi as Ml,oj as Mm,ok as Sn,p as H,pa as Xa,pb as Bc,pc as Td,pd as Bg,pe as Bh,pf as Ni,pg as Nj,ph as Nk,pi as Nl,pj as Nm,pk as Tn,q as I,qa as Ya,qb as Cc,qc as Ud,qd as Cg,qe as Ch,qf as Oi,qg as Oj,qh as Ok,qi as Ol,qj as Om,qk as Un,r as J,ra as Za,rb as Dc,rc as Vd,rd as Dg,re as Dh,rf as Pi,rg as Pj,rh as Pk,ri as Pl,rj as Pm,rk as Vn,s as K,sa as _a,sb as Ec,sc as Wd,sd as Eg,se as Eh,sf as Qi,sg as Qj,sh as Qk,si as Ql,sj as Qm,sk as Wn,t as L,ta as Ab,tb as Fc,tc as Xd,td as Fg,te as Fh,tf as Ri,tg as Rj,th as Rk,ti as Rl,tj as Rm,tk as Xn,u as M,ua as Bb,ub as Gc,uc as Yd,ud as Gg,ue as Gh,uf as Si,ug as Sj,uh as Sk,ui as Sl,uj as Sm,uk as Yn,v as N,va as Cb,vb as Hc,vc as Zd,vd as Hg,ve as Hh,vf as Ti,vg as Tj,vh as Tk,vi as Tl,vj as Tm,vk as Zn,w as O,wa as Db,wb as Ic,wc as _d,wd as Ig,we as Ih,wf as Ui,wg as Uj,wh as Uk,wi as Ul,wj as Um,wk as _n,x as P,xa as Eb,xb as Jc,xc as $d,xd as Jg,xe as Jh,xf as Vi,xg as Vj,xh as Vk,xi as Vl,xj as Vm,xk as $n,y as Q,ya as Fb,yb as Kc,yc as ae,yd as Kg,ye as Kh,yf as Wi,yg as Wj,yh as Wk,yi as Wl,yj as Wm,yk as ao,z as R,za as Gb,zb as Lc,zc as be,zd as Lg,ze as Lh,zf as Xi,zg as Xj,zh as Xk,zi as Xl,zj as Xm,zk as bo}from"./chunk-EJTBSGLV.js";import{$ as Id,$a as bf,A as ga,Aa as Ce,Ab as Df,B as ha,Ba as De,Bb as Ef,C as ia,Ca as Ee,Cb as Ff,D as ja,Da as Fe,Db as Gf,E as ka,Ea as Ge,Eb as Hf,F as la,Fa as He,Fb as If,G as Ob,Ga as Ie,Gb as Jf,H as Pb,Ha as Je,Hb as Kf,I as Qb,Ia as Ke,Ib as Lf,J as Rb,Ja as Le,Jb as Mf,K as Sb,Ka as Me,Kb as Ei,L as id,La as Ne,Lb as Fi,M as jd,Ma as Oe,Mb as Gi,N as kd,Na as Pe,Nb as Hi,O as ld,Oa as Qe,Ob as Ii,P as md,Pa as Re,Pb as Ji,Q as nd,Qa as Se,R as od,Ra as Te,S as pd,Sa as Ue,T as Ad,Ta as Ve,U as Bd,Ua as We,V as Cd,Va as Xe,W as Dd,Wa as Ye,X as Ed,Xa as Ze,Y as Fd,Ya as _e,Z as Gd,Za as $e,_ as Hd,_a as af,a as q,aa as Jd,ab as cf,b as r,ba as de,bb as df,c as s,ca as ee,cb as ef,d as t,da as fe,db as ff,e as u,ea as ge,eb as gf,f as v,fa as he,fb as hf,g as w,ga as ie,gb as jf,h as x,ha as je,hb as kf,i as y,ia as ke,ib as lf,j as z,ja as le,jb as mf,k as A,ka as me,kb as nf,l as B,la as ne,lb as of,m as C,ma as oe,mb as pf,n as D,na as pe,nb as qf,o as E,oa as qe,ob as rf,p as F,pa as re,pb as sf,q as S,qa as se,qb as tf,r as T,ra as te,rb as uf,s as U,sa as ue,sb as vf,t as V,ta as ve,tb as wf,u as W,ua as we,ub as xf,v as X,va as xe,vb as yf,w as ca,wa as ye,wb as zf,x as da,xa as ze,xb as Af,y as ea,ya as Ae,yb as Bf,z as fa,za as Be,zb as Cf}from"./chunk-LMR2TM3X.js";import{a,b,c as li,d as mi,e as ni,f as oi,g as pi,h as qi,j as Mn,k as Nn,l as On,m as Pn,n as Qn}from"./chunk-OBYJWIRB.js";import{a as hb,b as ib,c as jb,d as kb,e as lb,f as mb,g as nb,h as ob,i as pb,j as qb,k as rb,l as sb,m as tb,n as ub,o as vb,p as wb,q as xb,r as yb,s as zb}from"./chunk-RRII2DMC.js";import{c as $a,d as ab,e as bb,h as cb,i as db,j as eb,k as fb,l as gb}from"./chunk-KQCTDXVD.js";export{Ml as CODE_REFERENCE_LIMITS,Rb as COMMON_LOCALES,Ek as CONFIGURATION_POLICY,fg as CONTENT_DOCUMENT_BYTES,Tb as COUPON_TERM_LOCALES,Be as CUSTOMER_DATA_SOURCES,Cg as CreateInvoiceParamsSchema,Bg as CreateInvoicePreviewSchema,Pi as DEFAULT_FUNNEL_EXECUTION_POLICY,Jj as FUNNEL_API_CAPABILITIES,Wj as FUNNEL_EXECUTION_LIMITS,Xi as FUNNEL_LIMITS,Xj as FUNNEL_RECORDING_LIMITS,Tn as FUNNEL_SEGMENT_BYTES,Sn as FUNNEL_SEGMENT_LIMIT,Mm as FUNNEL_SERVER_KEY_HEADER,Zj as FUNNEL_TRANSITION_BUDGET_MESSAGE,Am as FunnelCalculationError,$n as FunnelLocalCalculationError,zg as InvoiceModeParamsSchema,Ag as InvoiceTemplateSchema,Sd as MSG_CHANNEL_METERS,Pd as MSG_CHANNEL_PROVIDERS,Bh as OFFERING_MAX_DEPTH,Dh as OFFERING_MAX_ITEMS,Ch as OFFERING_MAX_PRODUCTS,wf as POPUP_WIDTHS,vk as PUBLIC_PAYWALL_UNSUPPORTED_NODES,yg as ReissueInvoiceParamsSchema,Me as SCREEN_LIMITS,Le as SCREEN_SCHEMA_VERSION,G as SDK_PROTOCOL_HEADER,I as SDK_SUPPORT_HEADER,J as SDK_SUPPORT_POLICY,H as SDK_VERSION_HEADER,uf as SURFACE_PATHS,oe as SURFACE_VARIABLES,P as SdkProtocolError,Yi as UNBOUND_PRODUCT_VERSION_ID,N as addSupportMonths,Ra as aiCreditSystemConfigSchema,$k as aiMarkupSchema,_k as aiModelIdSchema,al as aiModelRatesSchema,bl as aiPricingConfigurationSchema,Zk as aiTokenPools,V as amountToMinor,ii as analyticsConfigSchema,ki as analyticsEventEnabled,v as apiErrorCatalog,w as apiErrorCodeForStatus,q as apiErrorCodeSchema,um as apiOperations,nm as apiPermissionSchema,zm as archiveSurfaceTemplateSchema,tc as autoTopupPurchaseLimitSchema,Fc as autoTopupStateSchema,Jn as autumnAmountToMinor,hn as autumnCustomerAutoTopupSchema,nn as autumnCustomerControlsSchema,pn as autumnCustomerMetadataSchema,mn as autumnCustomerOverageAllowedSchema,rn as autumnCustomerProductSummarySchema,qn as autumnCustomerProfileRecordSchema,jn as autumnCustomerSpendLimitSchema,ln as autumnCustomerUsageAlertSchema,kn as autumnCustomerUsageLimitSchema,on as autumnEntityControlsSchema,Kn as autumnMinorToAmount,Ln as autumnUsageUnitAmountDecimal,Uk as balanceAdjustmentCommandSchema,Vk as balanceAdjustmentStateSchema,md as balanceAllocationSchema,jd as balanceCommandSchema,rd as balanceGrantCommandSchema,qd as balanceGrantCreateSchema,ud as balanceGrantPageSchema,td as balanceGrantReadSchema,sd as balanceGrantSchema,pd as balanceOperationSchema,kd as balancePricingSegmentSchema,od as balanceQuoteSchema,ld as balanceReceiptUnitsSchema,nd as balanceRejectionReasonSchema,Wk as balanceSourceStateSchema,_m as bannerVersionReferenceSchema,mc as billingAccruedMinorSchema,lc as billingAmountMinorSchema,wc as billingAuthorizationSchema,vc as billingAuthorizationTermsSchema,nc as billingBudgetMinorSchema,Gc as billingControlInputSchema,Hc as billingControlsSchema,Pc as billingCouponsSchema,Y as billingCurrencies,Ic as billingInvoiceLineSchema,Jc as billingInvoiceSchema,Mc as billingInvoicesSchema,Ac as billingLimitSchema,aa as billingSettingsMutationSchema,_ as billingSettingsSchema,$ as billingSettingsScopeSchema,Ec as billingUsageWindowSchema,_e as borderSchema,ef as buttonNodeSchema,Bm as calculateFunnelNode,co as calculateLocalFunnelEvaluation,eo as calculateLocalFunnelSegment,Pb as canonicalLocale,pe as capabilityBindingSchema,rc as cashPriceSchema,pc as cashPricingSchema,oc as cashPricingTiersSchema,kc as cashUnitAmountMinorSchema,Cl as claimRewardProductRequestSchema,Pl as codeReferenceBranchSchema,Vl as codeReferenceConfigRequestSchema,Ul as codeReferenceConfigureSchema,$l as codeReferenceFeatureSummarySchema,Nl as codeReferenceKeySchema,Ql as codeReferencePathSchema,Yl as codeReferenceReceiptSchema,Ol as codeReferenceRepoSchema,Xl as codeReferenceReportSchema,Sl as codeReferenceRepositoryInputSchema,Tl as codeReferenceRepositorySchema,Wl as codeReferenceScanConfigSchema,Zl as codeReferenceScanSchema,_l as codeReferenceSettingsSchema,am as codeReferenceSummarySchema,fe as commerceAccessSchema,he as commerceContextSchema,mh as commerceCursorSchema,nh as commerceListQuerySchema,ge as commerceMoneySchema,An as commerceProductKind,ee as commerceProductKindSchema,de as commerceProviderSchema,sb as compileGrowthFeatures,Jb as conditionUsesMerchandise,Hk as configurationArtifactSchema,Nk as configurationDependencies,Gk as configurationDependenciesSchema,Lk as configurationDigest,Ik as configurationFunnelSchema,Mk as configurationGeneration,Kk as configurationJson,Dk as configurationPaywallSchema,Fk as configurationScopeSchema,Kc as confirmBillingAdjustmentInputSchema,yc as confirmBillingAuthorizationInputSchema,s as consoleErrorCodeSchema,E as consoleErrorResponseSchema,Yg as consoleRefundRequestSchema,ng as contentCollectionSchema,hg as contentContractSchema,ig as contentDocumentDraftSchema,kg as contentDocumentSchema,eg as contentKindSchema,mg as contentRecordSchema,lg as contentSummarySchema,jg as contentValueMatches,gg as contentValueSchema,og as contentVersionSchema,pg as contentVersionSummarySchema,qg as contentWriteSchema,mf as countdownNodeSchema,_b as couponAppliesToSchema,ec as couponChangeErrors,lf as couponCodeNodeSchema,gi as couponContentDigestSchema,Yb as couponDiscountSchema,tk as couponDisplaySchema,Zb as couponDurationSchema,ac as couponEligibilitySchema,bc as couponInputSchema,Lb as couponMerchandiseCondition,Mb as couponMerchandiseScope,$b as couponPublicAppliesToSchema,bm as couponRedemptionCommandSchema,cm as couponRedemptionReceiptSchema,Xb as couponStatusSchema,hc as couponWindow,qm as createCustomerRequestSchema,rm as createCustomerResponseSchema,El as createReferralCodeRequestSchema,ca as creditAmountSchema,el as creditAnalyticsFilterSchema,gl as creditAnalyticsPageSchema,fl as creditAnalyticsQuerySchema,cl as creditAnalyticsRangeSchema,dl as creditAnalyticsTimezoneSchema,ia as creditDimensionSchema,ja as creditMultiplierSchema,ea as creditPriceAdjustmentSchema,ka as creditPricingSchema,ga as creditPropertiesSchema,da as creditQuantitySchema,la as creditRateSchema,Rc as creditResetCountSchema,Qc as creditResetSchema,fa as creditResourceKeySchema,Sc as creditRolloverSchema,Ka as creditSchemaItemSchema,yd as creditStatementInputSchema,zd as creditStatementSchema,Qa as creditSystemConfigSchema,ha as creditTiersSchema,S as currencies,Z as currencyAmountOptionsSchema,U as currencyDecimals,T as currencySchema,vm as currentApiOperations,jf as customHtmlNodeSchema,Ha as customerActivitySchema,fj as customerAttributesSchema,De as customerDataConfigSchema,Ge as customerDataIntentSchema,gf as customerDataNodeSchema,lj as customerDataReferenceMessage,kj as customerDataReferenced,jj as customerDataSchema,Ce as customerDataSourceSchema,tm as customerEntitlementsSchema,sj as customerFiltersSchema,gj as customerFingerprintSchema,qj as customerGetSchema,Ed as customerHoldingsSchema,hj as customerInputSchema,Id as customerLedgerEntrySchema,Jd as customerLedgerPageSchema,Hd as customerLedgerQuerySchema,oj as customerLookupSchema,nj as customerMutationSchema,Fe as customerPageDataSchema,Ee as customerPageNodeStateSchema,tj as customerPageSchema,pj as customerPatchSchema,Ga as customerPlanSchema,mj as customerProfileSchema,ij as customerReferenceSchema,ej as customerTagsSchema,rj as customerUpdateRequestSchema,Rl as defaultCodeReferenceMethods,Lm as deliveredFunnelResponse,Sk as deliveredPaywall,zi as deliveredScreenDocument,Nb as deriveSavedGroupSubjects,fc as describeCoupon,bd as diffProductVariant,ff as dividerNodeSchema,He as emptyCustomerPageNode,je as entitlementCheckInputSchema,ke as entitlementCheckReasonSchema,me as entitlementCheckResultSchema,ie as entitlementRequirementSchema,Da as entitlementSnapshotSchema,sm as entitlementStatusSchema,a as environmentSchema,z as errorCodeMatchesStatus,F as errorMetadata,B as errorMetadataSchema,y as errorPolicy,u as errorReasonSchema,t as errorRecoverySchema,C as errorResponseSchema,Je as escapeHtmlText,fn as estimateMsgSmsSegments,db as evalCondition,gb as evalFeature,ti as evaluateFeaturesRequestSchema,vi as evaluateFeaturesResultSchema,bo as evaluateLocalFunnelNode,Hm as executionSourceSchema,_n as expandFunnelSegment,rb as experimentConfigurationSchema,qb as experimentPhaseSchema,vb as experimentSnapshotSchema,Va as featureCollectionSchema,Oa as featureConfigOverrideSchema,Sa as featureDefinitionSchema,ri as featureDeliveryPayloadSchema,Ia as featureIdSchema,wa as featureInputSchema,Na as featureMarkupsOverrideSchema,Wa as featureOptionsSchema,qi as featurePayloadSchema,Ua as featureRecordSchema,xa as featureSchema,Ta as featureUpdateRulesSchema,Ad as featureUsageReadSchema,Bd as featureUsageSetSchema,Cd as featureUsageStateSchema,Ja as featureUsageTypeSchema,Xa as featureWriteSchema,Cf as fieldValue,Ye as fillSchema,Dd as financialAmountSchema,Gd as financialCursorSchema,Fd as financialEntryTypeSchema,Kf as findDocumentNode,Jf as findNode,en as formatCouponConditions,Vb as formatCouponDiscount,Ub as formatCouponMoney,Wb as formatCouponTerms,X as formatCurrencyMinor,Dn as formatProductBillingPeriod,gc as formatUsd,Kj as funnelApiBindingSchema,Hj as funnelApiProjectionSchema,an as funnelAuthorDraftSchema,Aj as funnelBundleDefinitionSchema,Ej as funnelBundleLiterals,Dj as funnelBundleResultSchema,Bj as funnelBundleSelectionSchema,Qm as funnelCampaignCommandSchema,Sm as funnelCampaignStartDeliverySchema,Rm as funnelCampaignStartResponseSchema,Lj as funnelCapabilitySchema,rk as funnelCommandSchema,Um as funnelConfigurationSchema,$j as funnelConsumedVariables,$m as funnelContentDraftSchema,bn as funnelContentPublishedSchema,Zm as funnelContentReferenceSchema,Zn as funnelContextDelta,Nm as funnelCredentialCommandSchema,Pm as funnelCredentialDeliverySchema,Om as funnelCredentialResponseSchema,qk as funnelDataQueriesSchema,wj as funnelDecideShape,xj as funnelDecisionCommandSchema,aj as funnelDecisionEvaluationSchema,uj as funnelDecisionOutputSchema,yj as funnelDecisionResponseSchema,vj as funnelDecisionSchema,dj as funnelDecisionSegmentEvaluationSchema,zj as funnelDecisionUsedResponseSchema,ik as funnelDocumentDraftSchema,mk as funnelDocumentSchema,Ci as funnelEvaluationAttributes,$i as funnelEvaluationInstructionSchema,Zi as funnelEvaluationModeSchema,_i as funnelEvaluationResultSchema,Oi as funnelExecutionPolicySchema,fk as funnelExecutionStateSchema,Nj as funnelExternalPageUrlSchema,Ni as funnelExternalTaskSchema,Qj as funnelGraphDraftSchema,Pj as funnelGraphNodeSchema,Rj as funnelGraphSchema,Sj as funnelGraphTargets,Gm as funnelInstructionSchema,Cm as funnelInvocationId,Vm as funnelLocalConfigurationSchema,Dm as funnelLocalScreenCommandSchema,Em as funnelLocalScreenResponseSchema,cj as funnelLocalSegmentStepSchema,dk as funnelNodeInputSchema,bk as funnelNodeKindSchema,Tf as funnelNodeProjections,ek as funnelNodeResultSchema,_j as funnelNodeVisitAllowed,Qf as funnelNodeWritesSchema,Oj as funnelOpenInSchema,Ti as funnelOrchestrationCommandSchema,Hi as funnelParametersFromUrl,pk as funnelPresentationSubmissionSchema,Fj as funnelProjectionFilterValueSchema,Gj as funnelProjectionWhereSchema,ok as funnelPublicationDraftSchema,kk as funnelPublicationRules,nk as funnelPublicationSchema,lk as funnelPublishableDraftSchema,Un as funnelPureNode,ck as funnelResourceReferenceSchema,sn as funnelResultsCursorSchema,tn as funnelResultsQuerySchema,Wi as funnelResultsResponseSchema,un as funnelResultsSchema,Im as funnelRunViewSchema,Km as funnelRuntimeDeliverySchema,Jm as funnelRuntimeResponseSchema,Fm as funnelRuntimeStatusSchema,ag as funnelScreenReads,$f as funnelScreenTokens,bg as funnelScreenValues,fo as funnelSegmentConfigurationSchema,bj as funnelSegmentEvaluationInstructionSchema,Vn as funnelSegmentPositionSchema,Xn as funnelSegmentSchema,Wn as funnelSegmentStepSchema,Ui as funnelSignalResponseSchema,Yn as funnelStepId,Mi as funnelTaskBindingSchema,Ki as funnelTaskDataSchema,Li as funnelTaskOutputsSchema,Qi as funnelTaskResponseSchema,Vi as funnelTaskResultsSchema,Wm as funnelTopology,Tm as funnelTopologySchema,gk as funnelTraceEventSchema,Wf as funnelValueBindingSchema,Nf as funnelValueDeclarationSchema,Rf as funnelValueMatches,Vf as funnelValuePathSchema,Bi as funnelValueSchema,Of as funnelVariableDeclarationSchema,Pf as funnelVariableDeclarationsSchema,_f as funnelVariableRead,Sf as funnelVariableValues,Yj as funnelVisitAllowed,ak as funnelWaitKindSchema,mi as gbRuntimeExperimentResultSchema,li as gbRuntimeExperimentSchema,ni as gbRuntimeFeatureRuleSchema,oi as gbRuntimeFeatureSchema,pi as gbRuntimeSavedGroupsSchema,$a as getQueryStringOverride,eb as getStickyBucketAttributes,ib as growthAttributesSchema,lb as growthConditionGroupIds,Ab as growthConditionPaths,jb as growthConditionSchema,tb as growthExperimentStop,ub as growthFeatureExpiry,nb as growthFeatureRuleSchema,ob as growthFeatureSchema,pb as growthFeaturesSchema,kb as growthGroupSchema,yb as growthRuleContextSchema,mb as growthSavedGroupsSchema,wb as growthSnapshotSchema,zb as growthSplitResultSchema,Kb as guardMerchandiseCondition,Ie as htmlVariableErrors,Tk as hydratePaywall,Oe as identifierSchema,df as imageNodeSchema,Xe as imagePositionSchema,Ve as insetsSchema,hm as invoiceCommandSchema,vd as invoiceDetailInputSchema,xd as invoiceDetailSchema,km as invoiceOperationSchema,wd as invoiceProductItemSchema,Xg as invoiceRefundsSchema,gm as invoiceTemplateCommandSchema,fm as invoiceTemplatePageSchema,dm as invoiceTemplateValuesSchema,sc as isInvoiceCreditPrice,Ib as isMerchandiseAttribute,we as isProductGroup,zn as isRecurringMembership,Lf as isRtlLocale,M as isStableSdkProtocol,bb as isURLTargeted,qc as itemBillingCycleSchema,dg as jsonStorageBytes,hb as jsonValueSchema,ba as licenseOfferSchema,Lc as listBillingInvoicesInputSchema,x as localErrorRecovery,Sb as localeLabel,Ob as localeSchema,Df as localeStatuses,If as localizeScreen,Cc as manageBillingLimitsInputSchema,Bc as manageOveragePolicyInputSchema,jm as managedInvoiceDetailSchema,lm as managedInvoicePageSchema,im as managedInvoiceSchema,em as managedInvoiceTemplateSchema,r as managementErrorCodeSchema,D as managementErrorResponseSchema,We as marginSchema,Qb as matchLocale,Di as matchesGrowthCondition,cn as materializeFunnelContent,qa as membershipActionSchema,Bn as membershipBillingCount,ra as membershipChangeSchema,sa as membershipHoldingSchema,oa as membershipRulesSchema,ta as membershipStateSchema,pa as membershipTimingSchema,Cb as merchandiseInputSchema,Eb as merchandiseReferenceSchema,Db as merchandiseSchema,Bb as merchandiseStatusSchema,n as messagingPreferenceSchema,o as messagingPreferenceSetSchema,va as metadataSchema,Pa as meteredConfigSchema,W as minorToAmount,Ma as modelMarkupsSchema,Zd as msgAudienceSchema,_d as msgBroadcastDraftSchema,Nd as msgChannelSchema,Xd as msgContentSchema,ae as msgDispatchStateSchema,Td as msgEmailContentSchema,Rd as msgMeterSchema,Qd as msgPhoneSchema,$d as msgPreferenceInputSchema,Od as msgProviderSchema,Wd as msgPushContentSchema,be as msgReceiptKindSchema,Yd as msgSendInputSchema,Ud as msgSmsContentSchema,ce as msgUsageSummarySchema,gn as msgVoiceBillableSeconds,Vd as msgVoiceContentSchema,wn as nativeCompletionSchema,rg as nativeCouponStoreOfferLinkWriteSchema,sg as nativeCouponStoreOfferLinksSchema,vn as nativeProofSchema,xg as nativePurchaseInstructionSchema,xn as nativeReceiptCommandSchema,yn as nativeReceiptResponseSchema,xh as nativeRestoreCommandSchema,yh as nativeRestoreResultSchema,vg as nativeStoreOfferForProduct,tg as nativeStoreOfferSelectionSchema,ug as nativeStoreOfferSelectionsSchema,wg as nativeStoreSelectionMatches,Pg as nativeSubscriptionUpdatePreviewSchema,Qg as nativeSubscriptionUpdateResultSchema,dc as newCouponInput,ji as newEnvironmentAnalyticsConfig,Ne as nodeIdSchema,jk as offerCopyUnscoped,ic as offerSchema,jc as offerUnavailableReasonSchema,Mh as offeringCollectionSchema,Ih as offeringDocumentSchema,Eh as offeringItemSchema,Fh as offeringItemsSchema,Ah as offeringMetadataSchema,Jh as offeringProductEvidenceSchema,zh as offeringProductIdSchema,Gh as offeringProductIds,Qh as offeringProductOptionSchema,Hh as offeringProductPaths,Sh as offeringPublicationIssues,Kh as offeringRecordSchema,Ph as offeringSelectorSchema,Th as offeringValueSchema,Lh as offeringVersionSchema,Rh as offeringWorkspaceSchema,Oh as offeringWriteResultSchema,Nh as offeringWriteSchema,id as overageBehaviorSchema,Dc as overagePolicySchema,hk as ownedFunnelScreenSchema,Gn as pageExperimentEventSchema,Hn as pageExperimentEventsRequestSchema,In as pageExperimentEventsResponseSchema,Fn as pageExperimentPayloadSchema,En as pageExperimentSchema,Te as paintColorSchema,Ok as parsePublicFunnel,A as parseRetryAfter,gh as paymentSetupCommandSchema,hh as paymentSetupReadSchema,jh as paymentSetupSchema,le as paywallCandidateSchema,Yh as paywallClientActionSchema,ci as paywallCollectionSchema,Rk as paywallDeliverySchema,Zh as paywallDocumentDraftSchema,_h as paywallDocumentSchema,ai as paywallFlowIssues,fi as paywallLibrarySchema,$h as paywallProductIssues,Uh as paywallProductsSchema,bi as paywallRecordSchema,ne as paywallRequestSchema,Qk as paywallResolutionSchema,Pk as paywallResolveInputSchema,di as paywallSummarySchema,ei as paywallWriteSchema,Aa as planConfigSchema,Ba as planInputSchema,za as planItemSchema,nf as planPickerNodeSchema,Ca as planSchema,Ea as planVersionSchema,gd as prepaidAllowanceAmount,Za as prepaidPriceAmount,_a as prepaidQuantityAmount,hd as prepaidQuantitySchema,Ya as prepaidTierPricingSchema,uc as prepareBillingAuthorizationInputSchema,ao as prepareLocalFunnelNodes,cb as prepareSavedGroups,xc as preparedBillingAuthorizationSchema,vf as presentationSchema,kf as priceNodeSchema,ya as priceSchema,Vc as productAllowanceSchema,ed as productCollectionSchema,Yc as productConfigurationSchema,$c as productDefinitionSchema,fd as productEditorOptionsSchema,Ae as productGroupingMatches,ze as productGroupingSchema,Xc as productLicenseSchema,cd as productOptionsSchema,Uc as productPrepaidPriceSchema,Tc as productPricesSchema,dd as productRecordSchema,Wh as productSelectionSchema,Wc as productTrialSchema,Zc as productVariantOverridesSchema,_c as productVariantSchema,Ij as projectFunnelApiOutputs,Xm as projectFunnelConfiguration,Ym as projectFunnelLocalConfiguration,cc as promotionCodeInputSchema,L as protocolForSdkVersion,La as providerMarkupsSchema,hi as publicCouponScreenDataSchema,si as publicFeatureConfigurationSchema,Rn as publicFunnelDocument,xk as publicPaywallBenefitSchema,Bk as publicPaywallButtonSchema,yk as publicPaywallChannelsSchema,Ak as publicPaywallCouponSchema,wk as publicPaywallPriceSchema,zk as publicPaywallProductSchema,Ck as publicPaywallSchema,Ai as publicScreenDocument,yi as publicScreenIssues,Ef as publishChecks,ph as purchaseListItemSchema,vh as purchaseListPageSchema,i as pushAddressRequestSchema,f as pushBindRequestSchema,h as pushDetachRequestSchema,e as pushInstallationProofSchema,m as pushInstallationStateSchema,c as pushPermissionSchema,d as pushPlatformSchema,p as pushProofPayload,g as pushReadRequestSchema,k as pushRecoveryConfirmSchema,j as pushRecoveryRequestSchema,l as pushRecoveryRequestedSchema,Qe as radiusSchema,Xf as readFunnelValuePath,Bl as redeemRewardRequestSchema,Fl as referralCodeSchema,Hl as referralProgramCollectionSchema,ul as referralProgramInputSchema,wl as referralProgramRecordSchema,zl as referralProgramWriteSchema,ui as remoteFeatureResultSchema,cg as renameFunnelScreenVariable,yf as replaceFirstPageRoot,uk as resolveCouponDisplay,Cj as resolveFunnelBundle,Mj as resolveFunnelCapabilityInputs,Si as resolveFunnelTaskInputs,Yf as resolveFunnelValueBinding,Zf as resolveFunnelValueBindings,ad as resolveProductVariant,Hf as resolveScreenLocale,Q as resolveSdkProtocol,pm as responseMetaSchema,zc as revokeBillingAuthorizationInputSchema,Jl as rewardActivityRedemptionSchema,Kl as rewardActivitySchema,tl as rewardCodeInputSchema,Il as rewardCodeSchema,Ll as rewardCodeWriteSchema,Gl as rewardCollectionSchema,ql as rewardConfigurationSchema,ol as rewardGrantExpirySchema,pl as rewardGrantSchema,sl as rewardInputSchema,rl as rewardKeySchema,xl as rewardOptionSchema,Dl as rewardProductCheckoutSchema,vl as rewardRecordSchema,Al as rewardRedemptionSchema,nl as rewardStatusSchema,ml as rewardTypeSchema,yl as rewardWriteSchema,fb as runExperiment,Cn as sameMembershipBillingCycle,ym as saveSurfaceTemplateSchema,b as scopeSchema,rf as screenActionSchema,Fi as screenAnswersSchema,Ei as screenDataCursorSchema,zf as screenDocumentSchema,Re as screenImageSourceSchema,Ii as screenInputBindingsSchema,qf as screenNodeSchema,Gi as screenParametersSchema,Xh as screenPresentationSchema,xe as screenProductScopes,ye as screenProductSelections,Ji as screenRendererInputSchema,Mf as screenSelections,sf as screenStringsSchema,Jk as sdkConfigurationManifestSchema,K as sdkProtocolRegistry,R as sdkProtocolResponseHeaders,Ld as seatCommandSchema,Kd as seatReadSchema,Md as seatsStateSchema,Uj as selectFunnelCondition,Vh as selectedPaywallProduct,ve as selectedSurfaceValue,Gf as servableLocales,Oc as setBillingCouponsInputSchema,$e as shadowSchema,Ze as shapeSchema,Ue as sizeSchema,Pe as spaceSchema,hf as spacerNodeSchema,ua as stableKeySchema,of as stackInteractionSchema,pf as stackNodeSchema,xb as stickyAssignmentDocumentSchema,Gg as stripeAppendContextSchema,Fg as stripeCouponTermsSchema,Hg as stripePurchaseExecutionSchema,Ug as stripeRefundExecutionSchema,ih as stripeSetupExecutionSchema,Mg as stripeSubscriptionUpdateExecutionSchema,Ng as stripeSubscriptionUpdatePreviewSchema,Og as stripeSubscriptionUpdateResultSchema,dh as stripeTrialExecutionSchema,bf as styleSchema,Dg as subscriptionAttachCommandSchema,Ig as subscriptionAttachQuoteSchema,Zg as subscriptionBatchCommandSchema,$g as subscriptionBatchGroupSchema,_g as subscriptionBatchReadSchema,ah as subscriptionBatchSchema,Kg as subscriptionCarryOptionsSchema,wh as subscriptionConflictPageSchema,rh as subscriptionConflictQuerySchema,th as subscriptionConflictRetryResultSchema,sh as subscriptionConflictRetrySchema,qh as subscriptionConflictSchema,Nc as subscriptionCouponExecutionSchema,mm as subscriptionInvoiceModeSchema,oh as subscriptionListItemSchema,uh as subscriptionListPageSchema,Eg as subscriptionOperationInputSchema,Jg as subscriptionOperationSchema,Tg as subscriptionRefundCommandSchema,Vg as subscriptionRefundPreviewSchema,Wg as subscriptionRefundResultSchema,bh as subscriptionTrialCommandSchema,fh as subscriptionTrialPolicySchema,ch as subscriptionTrialReadSchema,eh as subscriptionTrialResultSchema,Lg as subscriptionUpdateCommandSchema,Rg as subscriptionUpdatePreviewSchema,Sg as subscriptionUpdateResultSchema,kh as subscriptionVerificationInputSchema,lh as subscriptionVerificationSchema,Ke as substituteHtmlVariables,ue as substituteSurfaceVariables,re as surfaceDataSchema,tf as surfaceSchema,xm as surfaceTemplateSchema,qe as surfaceValueSchema,se as surfaceVariableNames,Gb as targetingAttributeSourceSchema,Fb as targetingEntitySchema,Hb as targetingSubjectSchema,Ff as templateChecks,wm as templateCoverImageSchema,cf as textNodeSchema,af as textStyleSchema,Se as themeSchema,ab as toAttributeString,wi as trackEventsRequestSchema,xi as trackEventsResultSchema,Vj as transitionFunnelGraph,Bf as translatableFields,ma as trialPolicySchema,na as trialRecordSchema,te as unknownSurfaceVariables,il as usageAnalyticsPageSchema,hl as usageAnalyticsQuerySchema,ll as usageBatchPageSchema,kl as usageBatchReadSchema,jl as usageBatchSubmitSchema,Xk as usageEntityCommandSchema,Yk as usageEntitySchema,dn as validateFunnelContentPublication,Tj as validateFunnelGraph,Uf as validateFunnelProjections,Ri as validateFunnelTaskData,sk as validateScreenAnswers,O as validateSdkProtocolRegistry,Fa as validitySchema,om as verifiedPrincipalSchema,Nn as visualChangeSchema,Qn as visualExperimentPayloadSchema,Pn as visualExperimentSchema,Mn as visualMutationSchema,On as visualVariationSchema,xf as walkDocument,Af as walkScreen};