@tinkerlandai/longplay-sdk 0.10.18 → 0.10.19

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 (55) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +9 -3
  3. package/README.zh-CN.md +1 -1
  4. package/dist/{ai-usage-D7BUuP1H.d.ts → ai-usage-DPGx5otD.d.ts} +3 -3
  5. package/dist/{api-CIbhe8RY.d.ts → api-G8EA_ueL.d.ts} +3596 -200
  6. package/dist/chunk-2JBNOE2D.js +1 -0
  7. package/dist/chunk-4SWGHICJ.js +17 -0
  8. package/dist/chunk-5OD42XQS.js +1 -0
  9. package/dist/{chunk-OMHZBCS3.js → chunk-A7U4Z6EH.js} +1 -1
  10. package/dist/{chunk-LHBBSD77.js → chunk-CCRBXW4M.js} +1 -1
  11. package/dist/chunk-DVKZLOS7.js +1 -0
  12. package/dist/{chunk-ML6EHT43.js → chunk-EDVR7FPD.js} +1 -1
  13. package/dist/chunk-FISFN5IY.js +1 -0
  14. package/dist/chunk-GSFNAB3W.js +6 -0
  15. package/dist/{chunk-26HU2HXU.js → chunk-KHIQQNTR.js} +1 -1
  16. package/dist/{chunk-6HWNW6FJ.js → chunk-LNSFRQ6G.js} +1 -1
  17. package/dist/chunk-W2Z3UVW3.js +1 -0
  18. package/dist/{chunk-T5COWMDA.js → chunk-XIYNQHN7.js} +1 -1
  19. package/dist/{chunk-P6HCD5OQ.js → chunk-XXBN76NP.js} +1 -1
  20. package/dist/{chunk-E4LUW6KP.js → chunk-YNMSSQQY.js} +1 -1
  21. package/dist/{content-DLYNJIEB.js → content-E2OWWKDG.js} +1 -1
  22. package/dist/{customer-page-km5f1PJZ.d.ts → customer-page-BV5EvCUY.d.ts} +20 -0
  23. package/dist/{funnel-local-client-CAuNpJ-e.d.ts → funnel-local-client-DjvVzCfH.d.ts} +14039 -312
  24. package/dist/{funnel-node-evaluation-BLnJp8vj.d.ts → funnel-node-evaluation-D9FwkMa3.d.ts} +425 -1
  25. package/dist/funnel-process-client-bO9Wfumi.d.ts +62372 -0
  26. package/dist/funnel-runtime-host-FOM4Z7ZK.js +1 -0
  27. package/dist/index.d.ts +322 -23334
  28. package/dist/index.js +1 -1
  29. package/dist/native-shell.js +1 -1
  30. package/dist/openrouter.d.ts +2 -2
  31. package/dist/openrouter.js +1 -1
  32. package/dist/page.js +1 -1
  33. package/dist/paywall-OUIB7SVI.js +1 -0
  34. package/dist/popup.d.ts +2 -2
  35. package/dist/popup.js +1 -1
  36. package/dist/react-native.d.ts +41 -38098
  37. package/dist/react-native.js +1 -1
  38. package/dist/screen-renderer-ZNELQB64.js +1 -0
  39. package/dist/server.d.ts +6860 -298
  40. package/dist/server.js +1 -1
  41. package/dist/visual.js +1 -1
  42. package/package.json +1 -1
  43. package/dist/chunk-4ZUMMPHV.js +0 -1
  44. package/dist/chunk-EEZLS2YP.js +0 -1
  45. package/dist/chunk-JVQVQHV2.js +0 -6
  46. package/dist/chunk-KYXX676W.js +0 -1
  47. package/dist/chunk-LC2VUKYM.js +0 -1
  48. package/dist/chunk-N4HZ55YU.js +0 -1
  49. package/dist/chunk-PFHS7HK3.js +0 -17
  50. package/dist/chunk-VVW2J2GL.js +0 -1
  51. package/dist/funnel-process-client-C9EIwNTr.d.ts +0 -20575
  52. package/dist/funnel-runtime-host-FVOUCR35.js +0 -1
  53. package/dist/paywall-6Q3VLXXL.js +0 -1
  54. package/dist/screen-renderer-IZ3VJGU6.js +0 -1
  55. package/dist/{coupon-fA1QujHt.d.ts → coupon-Btz_KFKp.d.ts} +1 -1
@@ -1 +1 @@
1
- import{f as o}from"./chunk-PFHS7HK3.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;commandRequestId;retryable;recovery;retryAfterSeconds;reason};export{n as a};
1
+ import{g as o}from"./chunk-4SWGHICJ.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;commandRequestId;retryable;recovery;retryAfterSeconds;reason};export{n as a};
@@ -1 +1 @@
1
- import{a as u}from"./chunk-DSPLGTQI.js";import{cb as d}from"./chunk-JVQVQHV2.js";function m(e){if(!/^[A-Za-z0-9_-]{1,64}$/.test(e))throw new Error("Invalid device cookie name");let t="";for(let i of document.cookie.split(";"))if(i.trim().startsWith(`${e}=`))try{t=decodeURIComponent(i.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 y(){try{let e=sessionStorage.getItem("indiana_sid");return e||(e=crypto.randomUUID(),sessionStorage.setItem("indiana_sid",e)),e}catch{return}}function g(e=d){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 o=new Set,s;function S(e){let t=()=>e();if(o.add(t),!s){let i=!0,a=history.pushState,p=history.replaceState,r=()=>{if(i)for(let n of[...o])o.has(n)&&u(n)},c=function(...n){a.apply(this,n),r()},h=function(...n){p.apply(this,n),r()};history.pushState=c,history.replaceState=h,addEventListener("popstate",r),addEventListener("hashchange",r),s=()=>{i=!1,history.pushState===c&&(history.pushState=a),history.replaceState===h&&(history.replaceState=p),removeEventListener("popstate",r),removeEventListener("hashchange",r)}}return()=>{o.delete(t)&&(o.size||(s?.(),s=void 0))}}export{m as a,y as b,g as c,S as d};
1
+ import{a as u}from"./chunk-DSPLGTQI.js";import{kb as d}from"./chunk-GSFNAB3W.js";function m(e){if(!/^[A-Za-z0-9_-]{1,64}$/.test(e))throw new Error("Invalid device cookie name");let t="";for(let i of document.cookie.split(";"))if(i.trim().startsWith(`${e}=`))try{t=decodeURIComponent(i.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 y(){try{let e=sessionStorage.getItem("indiana_sid");return e||(e=crypto.randomUUID(),sessionStorage.setItem("indiana_sid",e)),e}catch{return}}function g(e=d){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 o=new Set,s;function S(e){let t=()=>e();if(o.add(t),!s){let i=!0,a=history.pushState,p=history.replaceState,r=()=>{if(i)for(let n of[...o])o.has(n)&&u(n)},c=function(...n){a.apply(this,n),r()},h=function(...n){p.apply(this,n),r()};history.pushState=c,history.replaceState=h,addEventListener("popstate",r),addEventListener("hashchange",r),s=()=>{i=!1,history.pushState===c&&(history.pushState=a),history.replaceState===h&&(history.replaceState=p),removeEventListener("popstate",r),removeEventListener("hashchange",r)}}return()=>{o.delete(t)&&(o.size||(s?.(),s=void 0))}}export{m as a,y as b,g as c,S as d};
@@ -0,0 +1 @@
1
+ import{c as Ne}from"./chunk-XIYNQHN7.js";import{a as qe,b as De,c as ke,d as Fe,e as Se,f as ye}from"./chunk-FISFN5IY.js";import{a as w}from"./chunk-KHIQQNTR.js";import{b as Oe,e as _e}from"./chunk-SLUA7ABW.js";import{d as Te}from"./chunk-LNSFRQ6G.js";import{a as K}from"./chunk-DSPLGTQI.js";import{Z as Pe,la as we}from"./chunk-GSFNAB3W.js";import{Da as Re,I as Ce,Na as Ee}from"./chunk-4SWGHICJ.js";function Ae(n){let O=n.view;if(!O?.paywall)throw new w("INVALID_REQUEST","The current node is not a Paywall");let e=O.paywall.receiptId,C=O.nodeId,c=O.visit,R=O.paywall.resolution,s=O.paywall,S="document"in R?{document:R.document,offering:R.offering,capabilities:R.capabilities}:null;function a(){let i=s.resolution;return"document"in i?i:S&&{...i,document:S.document,offering:S.offering,capabilities:qe(i.capabilities,S.capabilities)}}function p(i){if(!De(i,R))throw new w("INVALID_RESPONSE","The pinned Paywall binding changed")}let D=!1,v=new AbortController,y=(n.pendingCommands??(n.pendingCommand?[n.pendingCommand]:[])).find(i=>i.operation==="submit"&&i.nodeId===C&&i.visit===c&&i.input.type==="paywall_quote")?.requestId??O.paywall.purchaseRequestId,u=0,d=null,k=new Set,U=null,P=new Map;function A(i){if(i.purchase&&i.purchase.receiptId!==e)throw new w("INVALID_RESPONSE","Purchase receipt changed");let o=i.run.paywall;return i.purchase??(o?.receiptId===e?o:null)}function E(){if(D)throw new w("IDENTITY_CHANGED","Paywall presentation has closed")}function I(i,o,r){if(E(),o!==u||r!==void 0&&s.quote?.operationId!==r)return!1;let g=s.selectionGeneration??0,m=i.run.paywall;if(m?.receiptId===e){if((m.selectionGeneration??0)<(s.selectionGeneration??0))return!1;p(m.resolution)}let f=A(i),L=m?.receiptId===e&&(m.selectionGeneration??0)>g,$=L?f?.quote??null:f?.quote??s.quote,F=f?.operation??($?.operationId===s.quote?.operationId?s.operation:null);return $&&F&&ke(F,{operationId:$.operationId},"Purchase operation changed"),(L||$?.operationId!==s.quote?.operationId)&&(u++,m?.receiptId===e&&(y=m.purchaseRequestId)),s={...s,...m?.receiptId===e?m:{},quote:$,operation:Se(s.operation,F,!0)},!0}function V(i,o,r){return new Promise((g,m)=>{let f=!1,L=()=>{clearTimeout(T),v.signal.removeEventListener("abort",b)},$=te=>{f||(f=!0,L(),g(te))},F=te=>{f||(f=!0,L(),m(te))},b=()=>F(new w("IDENTITY_CHANGED","Paywall presentation has closed")),T=setTimeout(()=>F(new w("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,r)),Math.max(0,o-Date.now()));v.signal.addEventListener("abort",b,{once:!0}),v.signal.aborted&&b(),i.then($,F)})}function M(i){return new Promise(o=>{let r=()=>{clearTimeout(g),v.signal.removeEventListener("abort",r),o()},g=setTimeout(r,i);v.signal.addEventListener("abort",r,{once:!0}),v.signal.aborted&&r()})}function z(i,o){E();let r=P.get(i)??n.pendingCommands?.find(f=>f.requestId===i)??n.pendingCommand;if(r?.operation==="submit"&&r.requestId===i&&r.nodeId===C&&r.visit===c){o.type==="paywall_quote"&&r.input.type==="paywall_quote"&&r.input.predecessor&&!o.predecessor&&(o={...o,predecessor:r.input.predecessor});let f=we.parse(r),L=we.parse({...r,input:o});if(f.operation!=="submit"||L.operation!=="submit"||JSON.stringify(f.input)!==JSON.stringify(L.input))throw new w("CONFLICT","A purchase request cannot change its input");return P.set(i,f),f}let g=n.view;if(!g||g.nodeId!==C||g.visit!==c||g.paywall?.receiptId!==e)throw new w("PRECONDITION_FAILED","The Paywall visit has changed");let m=we.parse({operation:"submit",requestId:i,nodeId:C,visit:c,revision:g.revision,input:structuredClone(o)});if(m.operation!=="submit")throw new w("INVALID_REQUEST","A purchase submission is required");return P.set(i,m),m}async function J(i,o){E();let{requestId:r,input:g}=i,m=Date.now()+3e4;k.add(r);try{let f=await V(n.submit(i),m,r);for(;f.run.pendingRequest?.requestId===r&&Date.now()<m&&!D&&(await M(Math.min(1e3,m-Date.now())),!(D||Date.now()>=m));)f=await V(n.resume(r),m,r);if(D)throw new w("IDENTITY_CHANGED","Paywall presentation has closed");if(f.run.pendingRequest?.requestId===r)throw new w("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,r);if(!I(f,o,g.type==="paywall_confirm"||g.type==="paywall_cancel"?g.operationId:void 0))throw new w("PRECONDITION_FAILED","The purchase selection has changed");U===r&&(U=null)}catch(f){throw U=r,f instanceof w&&f.code==="COMMAND_PENDING"&&f.status===void 0&&P.delete(r),f}finally{k.delete(r)}}async function X(i){if(!s.quote)throw new w("INVALID_REQUEST","A quoted purchase is required");let o=i==="confirm"?"paywall_confirm":"paywall_cancel",r=[...P.values(),...n.pendingCommands??(n.pendingCommand?[n.pendingCommand]:[])].find(m=>m.operation==="submit"&&m.input.type===o&&"operationId"in m.input&&m.input.operationId===s.quote.operationId),g=r?.operation==="submit"&&r.input.type===o&&"operationId"in r.input&&r.input.operationId===s.quote.operationId?r.requestId:crypto.randomUUID();if(await J(z(g,{type:i==="confirm"?"paywall_confirm":"paywall_cancel",operationId:s.quote.operationId}),u),!s.operation)throw new w("INVALID_RESPONSE","The accepted purchase result is missing");return structuredClone(s.operation)}return{get view(){return structuredClone(a())},get quote(){return s.quote?structuredClone(s.quote):null},get operation(){return s.operation?structuredClone(s.operation):null},get webViewUrl(){return n.webViewUrl},get canReselect(){return s.canReselect===!0},get recovery(){let i=n.pendingCommands??(n.pendingCommand?[n.pendingCommand]:[]),o=n.pendingPurchase;if(o&&(o.receiptId!==e||o.operationId!==s.quote?.operationId))return{type:"recover",operationId:o.operationId,requestId:i[0]?.requestId??null};let r=ye({quote:s.quote,operation:s.operation,requestId:i[0]?.requestId??U??y,pending:k.size>0||i.length>0||U!==null,destroyed:D,canReselect:s.canReselect});return r.type==="recover"&&r.requestId===null&&!D&&n.hasDurableJournal===!0&&!s.quote&&!s.operation&&(s.selectionGeneration??0)===0&&!o&&!i.length&&!k.size&&!y?{type:"native",operationId:null}:r},get pendingCancellation(){return!D&&(n.pendingCommands??(n.pendingCommand?[n.pendingCommand]:[])).some(i=>i.operation==="submit"&&i.nodeId===C&&i.visit===c&&i.input.type==="paywall_cancel"&&i.input.operationId===s.quote?.operationId)},async refresh(){E();let i=u,o=await n.get();if(I(o,i),o.run.paywall?.receiptId!==e)throw new w("PRECONDITION_FAILED","Paywall presentation has changed");if(!a()){if("document"in s.resolution||!n.resolvePaywall)throw new w("INVALID_RESPONSE","Public Paywall reader is unavailable");let r=await n.resolvePaywall(s.resolution);E(),p(r),S={document:r.document,offering:r.offering,capabilities:r.capabilities}}return structuredClone(a())},preview(i){let o=a();if(!o)return Promise.reject(new w("PRECONDITION_FAILED","Load the Paywall presentation first"));if(y&&y!==i.requestId&&(d||s.canReselect!==!0))return Promise.reject(new w("COMMAND_PENDING","Retry the original purchase before starting another"));let r=o.document.buttons[i.actionId],g=r?.type==="checkout"?Pe(r.product,i.selection,o.capabilities):null;if(!g)return Promise.reject(new w("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));let m=Ee(o.document.screen,g,i.selection,o.capabilities),f=y!==i.requestId&&(s.selectionGeneration??0)>0?{operationId:s.quote?.operationId??null,generation:s.selectionGeneration??0}:void 0;if(f&&s.canReselect!==!0)return Promise.reject(new w("COMMAND_PENDING","Original purchase requires authoritative termination"));let L;try{L=z(i.requestId,{type:"paywall_quote",actionId:i.actionId,productVersionId:g,...Object.keys(m).length?{featureQuantities:m}:{},...f?{predecessor:f}:{},...i.offerId?{offerId:i.offerId}:{},...i.nativeOffer?{nativeOffer:i.nativeOffer}:{}})}catch(b){return Promise.reject(b)}if(y===i.requestId&&d)return d;y!==i.requestId&&u++;let $=u;y=i.requestId;let F=(async()=>{if(await J(L,$),!s.quote)throw new w("INVALID_RESPONSE","The accepted quote is missing");return Fe(s.quote,{productVersionId:g,featureQuantities:m},"The selected purchase changed"),structuredClone(s.quote)})();return d=F,F.then(()=>{d===F&&(d=null)},b=>{d===F&&(d=null),y===i.requestId&&n.pendingCommand?.requestId!==i.requestId&&b instanceof w&&b.status!==void 0&&b.status<500&&![401,425].includes(b.status)&&(y=null)}),F},confirm:()=>X("confirm"),cancel:()=>X("cancel"),async read(){if(E(),!s.quote)throw new w("INVALID_REQUEST","A quoted purchase is required");let i=s.quote.operationId,o=u,r=n.pendingCommands?.find($=>$.operation==="submit"&&($.input.type==="paywall_confirm"||$.input.type==="paywall_cancel")&&$.input.operationId===i)??n.pendingCommand;r?.operation==="submit"&&(r.input.type==="paywall_confirm"||r.input.type==="paywall_cancel")&&r.input.operationId===i&&await n.settle?.(r.requestId);let g=await n.get(void 0,{receiptId:e,operationId:i});E();let m=A(g);if(m?.quote&&m.quote.operationId!==i||m?.operation&&m.operation.operationId!==i)throw new w("INVALID_RESPONSE","Purchase operation changed");let f=I(g,o,i),L=f?s.operation:m?.operation;if(!L)throw new w("INVALID_RESPONSE","The current purchase result is missing");return f&&k.size===0&&!(n.pendingCommands?.length??(n.pendingCommand?1:0))&&(U=null),structuredClone(L)},destroy(){D=!0,v.abort(),P.clear()}}}function Ve(n){let O=new Set,e=new Set,C=null;async function c(a,p){let D=!1;for(;!n.stopped&&n.key===a&&n.client.pendingCommand?.requestId===p;){if(!n.client.settle)throw new w("COMMAND_PENDING","The original display acknowledgement is still pending");await n.client.settle(p),D=!0,n.client.pendingCommand?.requestId===p&&await new Promise(v=>setTimeout(v,1500))}n.stopped||n.key!==a||(D&&await n.client.get(),!(n.stopped||n.key!==a)&&O.add(a))}function R(a,p){C=p;let D=()=>{C===p&&(C=null),e.delete(a)};return p.then(D,v=>{D(),n.busy||n.fail(v)}),p}function s(a){if(n.reviewing||O.has(a)||e.has(a)||n.stopped)return;e.add(a);let p=async()=>{if(n.reviewing||n.stopped||n.key!==a||O.has(a)){e.delete(a);return}if(n.busy||n.client.pendingCommand){setTimeout(()=>{p()},250);return}let D=(async()=>{let v=n.client.view,G=n.expected(),y=G.requestId;try{await n.client.submit({operation:"shown",...G})}catch(u){if(!(u instanceof w)||u.code!=="CONFLICT"||u.status!==409||n.client.pendingCommand)throw u;await n.client.get();let d=n.client.view;if(n.stopped||n.reviewing||n.key!==a||!d||!v||d.id!==v.id||d.source.versionId!==v.source.versionId||d.nodeId!==G.nodeId||d.visit!==G.visit||d.revision<=G.revision||d.stopped||!d.screen&&(!d.paywall||d.paywall.receiptId!==v.paywall?.receiptId)||!["running","waiting"].includes(d.status)||n.client.pendingCommand)throw u;let k=n.expected();y=k.requestId,await n.client.submit({operation:"shown",...k})}await c(a,y)})();R(a,D)};p()}function S(){if(C)return C;let a=n.client.pendingCommand;if(a?.operation!=="shown")return null;let p=n.key;return e.add(p),R(p,(async()=>{await n.client.retry(),await c(p,a.requestId)})())}return{report:s,settled:S,get inFlight(){return C}}}function Le(n){let O={},e=new Map;async function C(c){let R=n.client.view,s=R?.screen,S=s?.customerData.nodes[c.nodeId];if(n.stopped||n.busy||!R||!s||!S)return;if(!["refresh","next","previous","filter","sources_next","sources_previous"].includes(c.action)){let u=n.document,d=u?Re(u,c.nodeId):null,k=d?.type==="customer_data"?d.data.outputs?.[c.action]:void 0;k&&s.outputs.includes(k)?await n.perform(()=>n.client.submit({operation:"submit",...n.expected(),input:{type:"screen",output:k,answers:n.answers,selection:c.value?{[c.nodeId]:c.value}:{}}})):await n.onIntent?.(c,R);return}let p=c.action.startsWith("sources_")?S.resources.find(u=>u.key===c.value):null;if(c.action.startsWith("sources_")&&!p)throw new w("INVALID_REQUEST","Choose a current resource");let D=`${R.visit}:${c.nodeId}:${p?.key??""}`,v=e.get(D)??[null],y=O[c.nodeId]??{page:1,after:null,filter:"all",...p?{resourceKey:p.key}:{}};if(c.action==="filter"){let u=c.value;if(!u||!(S.source==="offer_history"?["all","issued","reserved","redeemed","expired","revoked"]:["all","purchase","refund","source","usage","debt","settlement"]).includes(u))throw new w("INVALID_REQUEST","Unknown data filter");y={page:1,after:null,filter:u},v.splice(0,v.length,null)}else if(c.action==="next"||c.action==="sources_next"){let u=p?.sources.at(-1),d=p?u?{kind:"ledger",cursor:{at:u.detail[0],id:u.id,type:"source"}}:null:s.dataCursors[c.nodeId];if(!d||!p&&!S.hasNext)return;v[y.page]=d,y={...y,page:y.page+1,after:d}}else if(c.action==="previous"||c.action==="sources_previous"){if(y.page<=1)return;y={...y,page:y.page-1,after:v[y.page-2]??null}}e.set(D,v),O={...O,[c.nodeId]:y},await n.perform(()=>n.client.get({nodeId:R.nodeId,visit:R.visit,revision:R.revision,components:O}))}return{get queries(){return O},intent:C,reset(){O={},e.clear()}}}function $e(n){let{doc:O,holder:e,reviewHolder:C,mountScreenPreview:c}=n,R=!1,s,S=0,a=null,p="",D=new Map,v=u=>u?`${u.id}:${u.nodeId}:${u.visit}:${u.revision}:${u.paywall?.quote?.operationId??""}`:"";async function G(u){if(n.stopped||!n.client.review)return;R||(p=v(n.client.view),D.set(p,structuredClone(n.answers))),R=!0,s=u,e.hidden=!0,n.suspend(!0),C.hidden=!1;let d=++S;try{let k=await n.client.review(u);if(n.stopped||d!==S||!R)return;if(!k.review)throw new w("INVALID_RESPONSE","Historical projection is missing");a?.destroy(),a=null,C.replaceChildren();let U=k.run.locale.startsWith("zh"),P=O.createElement("p");P.textContent=U?"\u53EA\u8BFB\u56DE\u770B":"Read-only history",C.append(P);for(let[I,V]of k.review.pages.entries()){let M=O.createElement("button");M.type="button",M.textContent=U?`\u7B2C ${I+1} \u9875`:`Page ${I+1}`,M.onclick=()=>{G(V.receiptId)},C.append(M)}if(k.review.page){let I=k.review.page,V=O.createElement("div");if(V.inert=!0,C.append(V),a=c(V,{mode:"live",rendererUrl:n.client.webViewUrl,title:I.document.name,onAction:()=>{},onAnswers:()=>{},onCustomerDataIntent:()=>{},onRendered:()=>{},onEscape:()=>{y()}}),a.update(I.document,k.run.locale,{serverInput:{bindings:I.inputs,answers:I.answers,values:I.values}}),await a.ready,n.stopped||d!==S||!R)return}let A=U?{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"},E=U?{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 I of[...k.review.coupons.map((V,M)=>`${U?"\u4F18\u60E0\u5238":"Coupon"} ${M+1}: ${A[V.status]}`),...k.review.purchases.map((V,M)=>`${U?"\u8D2D\u4E70":"Purchase"} ${M+1}: ${E[V.status]}`)]){let V=O.createElement("p");V.textContent=I,C.append(V)}n.client.view&&await n.enqueue(n.client.view)}catch(k){if(d!==S||n.stopped)return;a?.destroy(),a=null,C.replaceChildren(),n.fail(k)}}async function y(){if(!R||n.stopped||!n.client.review)return;let u=++S;try{if(await n.client.review(),n.stopped||u!==S)return;R=!1,S++,a?.destroy(),a=null,C.replaceChildren(),C.hidden=!0,e.hidden=!1;let d=n.client.view;v(d)!==p?(D.set(p,structuredClone(n.answers)),n.resetScreen()):(D.delete(p),n.suspend(!1)),d&&await n.enqueue(d)}catch(d){if(u!==S||n.stopped)return;a?.destroy(),a=null,C.replaceChildren(),n.fail(d)}}return{get active(){return R},get receipt(){return s},open:G,exit:y,get drafts(){return new Map([...D].map(([u,d])=>[u,structuredClone(d)]))},stop(){R=!1,S++,a?.destroy(),a=null,C.replaceChildren(),C.hidden=!0,e.hidden=!1}}}function Ue(n){if(!n.client.pageExperiments)throw new Error("The Run controller does not support page experiments");let O=n.client.pageExperiments.bind(n.client),e=!1,C=!1,c=0,R=!1,s=!1,S,a=new Map,p=new Set,D={},v=new Map,G=Oe(n.appManifestRelease),y=()=>{for(let A of a.values())A.effect.revert();a.clear();for(let A of v.values())A();v.clear()};function u(A){if(e||p.has(A))return;p.add(A);let E=c;O(n.appManifestRelease,[A]).catch(I=>{p.delete(A),!e&&E===c&&K(n.onError,I)})}async function d(){if(e)return;let A=n.client.view;if(!A||A.stopped||!["running","waiting"].includes(A.status)){c++,y();return}if(R){s=!0;return}R=!0;let E=++c,I=`${A.id}:${A.visit}:${A.revision}`,V=location.href;try{let[M,{applyVisualVariation:z}]=await Promise.all([O(n.appManifestRelease),import("./visual-dom-7IF7ITAK.js")]),J=n.client.view;if(e||E!==c||!J||J.stopped||!["running","waiting"].includes(J.status)||`${J.id}:${J.visit}:${J.revision}`!==I||location.href!==V)return;let X=new Set,i=new Set;for(let o of M.assignments){let r=`${M.payload.environmentId}:${o.experimentKey}`;if(i.add(r),v.has(r)||v.set(r,_e(r,D)),!!o.inExperiment)for(let g of M.payload.experiments){if(g.key!==o.experimentKey||!Ce(location.href,g.urlPatterns??[]))continue;let m=g.meta?.findIndex(T=>T.key===o.variationKey)??-1,f=g.variations[m];if(!f?.renderGuard)continue;let L=o.receiptId+":"+g.changeId,$=JSON.stringify([o.variationKey,f]);X.add(L);let F=a.get(L);if(F?.signature===$){F.effect.applied&&u(o.receiptId);continue}a.get(L)?.effect.revert(),a.delete(L);let b=z(f,{requireUniqueTargets:!0,boundVariations:g.variations,allowJs:!1,onApplied:()=>u(o.receiptId),onError:T=>K(n.onError,T)});a.set(L,{signature:$,effect:b}),b.applied&&u(o.receiptId)}}for(let[o,r]of a)X.has(o)||(r.effect.revert(),a.delete(o));for(let[o,r]of v)i.has(o)||(r(),v.delete(o))}catch(M){E===c&&y(),!e&&E===c&&K(n.onError,M)}finally{R=!1,s&&!e&&(s=!1,d())}}let k=n.client.subscribe(()=>{c++,d()}),U=Te(()=>{c++,y(),d()}),P=async()=>{await d(),e||(S=setTimeout(()=>{P()},15e3))};return{async start(){C||e||(C=!0,await P())},refresh:d,destroy(){e=!0,c++,clearTimeout(S),k(),U(),y(),G.destroy()}}}async function hn(n,O){let e=O,{mountScreenPreview:C}=await import("./screen-renderer-ZNELQB64.js"),{showPaywall:c}=await import("./paywall-OUIB7SVI.js"),R=e.appManifestRelease?Ue({client:e.client,appManifestRelease:e.appManifestRelease,onError:e.onError}):void 0;R?.start();let s=n.ownerDocument,S=s.activeElement,a=s.createElement("section"),p=s.createElement("div"),D=s.createElement("div"),v=s.createElement("div"),G=s.createElement("button");v.hidden=!0,G.type="button";let y=s.createElement("p"),u=s.createElement("p"),d=s.createElement("button"),k=s.createElement("button"),U=s.createElement("button"),P=s.createElement("dialog"),A;a.dataset.indianaFunnel="",a.setAttribute("aria-busy","false"),a.style.cssText="box-sizing:border-box;width:100%;min-width:0;font:14px/1.5 system-ui,sans-serif;color:#172033;background:#fff",D.style.cssText="display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:12px 20px",y.setAttribute("role","status"),u.setAttribute("role","alert"),u.hidden=!0,d.type=k.type=U.type="button",D.append(d,y,u,U,G,k),a.append(p,v,D),n.append(a);let E=null,I=null,V=null,M="",z="",J="",X="",i="",o=!1,r=0,g=!1,m="",f=null,L=Promise.resolve(),$=null,F=null,b=null,T=null;function te(){return b&&e.client.hasDurableJournal===!0&&T?.acknowledged===!0&&T.operationId===b.operationId&&e.client.view?.id===T.runId&&e.client.view?.status==="closed"&&e.client.view.revision===T.revision+1&&!(e.client.pendingCommands?.length??(e.client.pendingCommand?1:0))&&!e.client.pendingPurchase?b:null}function Ie(t){let l=t.run.paywall;if(T&&t.settlement?.requestId===T.requestId&&t.settlement.state==="settled"&&t.settlement.operationId===null&&t.run.id===T.runId&&t.run.status==="closed"&&!t.run.pendingRequest&&t.run.revision===T.revision+1&&t.run.nodeId===T.nodeId&&t.run.visit===T.visit&&l?.receiptId===T.receiptId&&l.selectionGeneration===T.selectionGeneration&&(l.quote?.operationId??null)===T.operationId&&(l.operation?.operationId??l.quote?.operationId??null)===T.operationId){let h=T.operationId===null&&l.selectionGeneration===0&&!l.quote&&!l.operation&&!l.purchaseRequestId,N=ye({quote:l.quote,operation:l.operation,requestId:l.purchaseRequestId,pending:!1,destroyed:!1,canReselect:l.canReselect});(h||l.canReselect===!0&&N.type==="native")&&(T.acknowledged=!0)}}let re=null,pe=new Set,B={},W=(t,l=null)=>{o||(re=l,u.textContent=t instanceof Error?t.message:"Request failed",u.hidden=!1,U.hidden=e.client.pendingCommand===null,K(e.onError,t))};function ie(){let t=e.client.view;if(!t)throw new w("INVALID_REQUEST","No current Run is available");return{requestId:crypto.randomUUID(),nodeId:t.nodeId,visit:t.visit,revision:t.revision}}let _=$e({client:e.client,doc:s,holder:p,reviewHolder:v,mountScreenPreview:C,get stopped(){return o},get answers(){return B},suspend(t){I?.setSuspended(t)},resetScreen(){M="",z="",J=""},enqueue:Z,fail:W}),ue=Ve({client:e.client,expected:ie,fail:W,get stopped(){return o},get reviewing(){return _.active},get key(){return M},get busy(){return r}}),fe=Le({client:e.client,expected:ie,perform:oe,onIntent:e.onCustomerDataIntent,get stopped(){return o},get busy(){return r},get document(){return E?.document},get answers(){return B}}),ge=t=>t&&(t.screen||t.paywall)?`${t.id}:${t.nodeId}:${t.visit}`:"";function de(){let t=e.client.view;d.disabled=!_.active&&(r>0||!!e.client.pendingCommand||!t?.canBack||t.stopped||!["running","waiting"].includes(t.status)||!ge(t)||z!==ge(t))}async function he(t){if(!t)return;let l=e.client.view;await t;let h=e.client.view;if(!l||!h||h.id!==l.id||h.nodeId!==l.nodeId||h.visit!==l.visit||h.stopped||!["running","waiting"].includes(h.status))throw new w("PRECONDITION_FAILED","The screen changed while its display was acknowledged")}async function oe(t,l=!1){if(!((r||F||b)&&!l||o||_.active&&!l)){r++,a.setAttribute("aria-busy","true"),de(),u.hidden=!0,re=null;try{if(l||await he(ue.inFlight),o)return;let h=await t();o||await Z(e.client.view??h.run)}catch(h){W(h,e.client.pendingCommand?.requestId??null)}finally{r=Math.max(0,r-1),a.setAttribute("aria-busy",String(r>0)),o||(U.hidden=e.client.pendingCommand===null,de())}}}function me(){f&&clearTimeout(f),!(o||!V||!["running","waiting"].includes(V.status)&&!e.client.pendingCommand)&&(f=setTimeout(()=>{f=null,be().finally(me)},V.pendingRequest||e.client.pendingCommand?1500:5e3))}async function be(){if(!(o||g||r)){if(_.active){await _.open(_.receipt);return}g=!0;try{let t=e.client.pendingCommand;t&&e.client.settle&&await e.client.settle(t.requestId);let l=e.client.view,h=fe.queries,N=await e.client.get(l?.screen&&Object.keys(h).length?{nodeId:l.nodeId,visit:l.visit,revision:l.revision,components:h}:void 0);!o&&h===fe.queries&&await Z(e.client.view??N.run)}catch(t){W(t)}finally{g=!1}}}function Me(t){let l=t.screen?.presentation;if(!l||l.type==="inline"){P.open&&P.close(),a.parentElement!==n&&n.append(a);return}a.parentElement!==P&&(P.append(a),n.append(P));let h={sm:420,md:640,lg:900};P.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${"size"in l?h[l.size]+"px":"100vw"}`,P.setAttribute("aria-label",(A?.screen===t.screen?.content.document.name?A?.label:void 0)??E?.document?.name??t.screen?.content.document.name??"Funnel"),P.open||(P.showModal(),Ne(P,l.type))}async function He(t){if(o)return;V=t,re&&e.client.pendingCommand?.requestId!==re&&(u.hidden=!0,re=null);let l=t.locale.startsWith("zh");if(G.textContent=l?"\u56DE\u770B":"History",G.hidden=!e.client.review,d.textContent=_.active?l?"\u8FD4\u56DE\u5F53\u524D":"Return to current":l?"\u8FD4\u56DE":"Back",k.textContent=l?"\u5173\u95ED":"Close",U.textContent=l?"\u91CD\u8BD5":"Retry",de(),U.hidden=e.client.pendingCommand===null,y.textContent=t.pendingRequest?l?"\u6B63\u5728\u5904\u7406":"Processing":t.instruction?.type==="wait"?l?"\u7B49\u5F85\u4E2D":"Waiting":"",m!==`${t.revision}:${t.visit}:${t.status}:${t.stopped}`&&(m=`${t.revision}:${t.visit}:${t.status}:${t.stopped}`,K(e.onState,structuredClone(t))),!t.pendingRequest&&["closed","ineligible","failed"].includes(t.status)){se();return}if(t.stopped||e.client.configurationReady===!1){_.stop(),E?.destroy(),E=null,I?.destroy(),I=null,p.replaceChildren(),M="",z="",J="",i="",P.open&&P.close(),a.hidden=!0,me();return}if(a.hidden=!1,_.active){me();return}let h=ge(t);if(h!==M&&(z="",E?.destroy(),E=null,I?.destroy(),I=null,p.replaceChildren(),M=h,J="",i="",B={...t.answers},fe.reset()),Me(t),t.screen){let x=t.screen.content;E||(E=C(p,{mode:"live",rendererUrl:e.client.webViewUrl,title:x.document.name,onAction(q,ae={},Q={}){if(_.active)return;B={...B,...Q};let j=Object.fromEntries((t.screen?.inputs??[]).filter(({variable:ne})=>Object.hasOwn(B,ne)).map(({variable:ne})=>[ne,B[ne]]));oe(()=>e.client.submit({operation:"submit",...ie(),input:{type:"screen",output:q,answers:j,selection:ae}}))},onAnswers:q=>{_.active||(B={...B,...q})},onCustomerDataIntent:q=>{_.active||fe.intent(q).catch(W)},onEscape:()=>{_.active||F||b||ce()},onError:q=>W(new Error(q)),onRendered:q=>{if(!q)return ue.report(h);A={screen:x.document.name,label:q},P.open&&P.setAttribute("aria-label",q),ue.report(h)}}));let H={capabilities:t.screen.capabilities,customerData:t.screen.customerData,parameters:t.parameters,serverInput:{bindings:t.screen.inputs,answers:B,values:t.screen.values}},ee=JSON.stringify([x,t.locale,H.parameters,t.screen.inputs,t.screen.values]);if(ee!==J)E.update(x.document,t.locale,H),J=ee,X=JSON.stringify(H.capabilities),i=JSON.stringify(H.customerData);else{let q=JSON.stringify(H.capabilities);q!==X&&(E.updateCapabilities(H.capabilities),X=q),JSON.stringify(H.customerData)!==i&&(E.updateCustomerData(H.customerData),i=JSON.stringify(H.customerData))}await E.ready}else if(t.paywall&&!I){let x=await c(p,{canInteract:()=>!_.active&&!o&&!F&&!b,beforeAction:async()=>{r++;try{await he(ue.settled()),u.hidden=!0,re=null}finally{r=Math.max(0,r-1)}},start:async()=>Ae(e.client),onPurchase:e.onPurchase,onCheckoutUrl:e.onCheckoutUrl,resolveOfferId:e.resolveOfferId,onEvent:e.onEvent,onOpenUrl:H=>e.onOpenUrl?e.onOpenUrl({receiptId:t.paywall.receiptId,url:H,openIn:"same_window"}):s.defaultView?.location.assign(H),onAction:async H=>{if(_.active)return;let ee=await e.client.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:t.nodeId,visit:t.visit,revision:e.client.view?.revision??t.revision,input:{type:"screen",output:H,answers:{}}});await Z(e.client.view??ee.run)},onError:W,onDismiss:()=>{!_.active&&!o&&!F&&!b&&e.client.view?.visit===t.visit&&ce()}});o?x.host?.destroy():(I=x.host,I?.setSuspended(_.active)),ue.report(h)}if(o)return;z=h,de();let N=t.instruction;if(N&&(N.type==="open_url"||N.type==="event")&&!pe.has(N.receiptId)){let x=s.createElement("button");x.type="button",x.textContent=N.type==="open_url"?`${l?"\u524D\u5F80":"Continue to"} ${new URL(N.url).host}`:l?"\u7EE7\u7EED":"Continue",x.onclick=()=>{let H=ie(),ee=N.type==="open_url"&&!e.onOpenUrl&&N.openIn==="new_window"?Ge(N.url):null;oe(async()=>{let q="success";if(N.type==="open_url")if(e.onOpenUrl)try{q=await e.onOpenUrl({receiptId:N.receiptId,url:N.url,openIn:N.openIn})===!1?"failed":"opened"}catch(Q){K(e.onError,Q),q="failed"}else q=N.openIn==="new_window"&&!ee?"failed":"opened";if(N.type==="event"){if(!e.onEvent)throw new w("EVENT_HANDLER_REQUIRED","Provide the event handler");await e.onEvent(N.event)}if(o||e.client.view?.nodeId!==H.nodeId||e.client.view.visit!==H.visit)throw new w("PRECONDITION_FAILED","The client action visit changed");let ae=await e.client.submit({operation:"submit",...H,input:{type:"client_action",receiptId:N.receiptId,outcome:q}});return pe.add(N.receiptId),N.type==="open_url"&&!e.onOpenUrl&&N.openIn==="same_window"&&s.defaultView?.location.assign(N.url),ae})},p.replaceChildren(x)}!t.pendingRequest&&t.status==="completed"&&!pe.has(`complete:${t.id}`)&&(pe.add(`complete:${t.id}`),K(e.onComplete,structuredClone(t))),me()}function Ge(t){let l=s.defaultView?.open(t,"_blank")??null;return l&&(l.opener=null),l}function Z(t){return de(),L=L.catch(()=>{}).then(()=>He(t)),L}let Qe=e.client.subscribe(t=>{e.client.configurationReady===!1&&(a.hidden=!0,E?.destroy(),E=null,I?.destroy(),I=null,p.replaceChildren(),M="",z="",J="",i="",P.open&&P.close()),Z(t).catch(W)}),Je=e.client.subscribeError?.(W);function ce(t){return $||(o||!t&&(F||b)?Promise.resolve():e.client.view&&!["running","waiting"].includes(e.client.view.status)?(se(),Promise.resolve()):($=oe(async()=>{let l=await e.client.submit({operation:"close",...t??ie()});return t&&Ie(l),l},!0).then(()=>{e.client.view?.status==="closed"&&se()}).finally(()=>{$=null}),$))}function se(){R?.destroy(),!o&&(o=!0,f&&clearTimeout(f),Qe(),Je?.(),E?.destroy(),_.stop(),I?.destroy(),P.close(),P.remove(),a.remove(),S instanceof HTMLElement&&S.isConnected&&S.focus(),K(e.onDismiss,V?structuredClone(V):null))}d.onclick=()=>{if(!d.disabled){if(_.active){_.exit();return}oe(()=>e.client.submit({operation:"back",...ie()}))}},G.onclick=()=>{_.open()},k.onclick=()=>{F||ce()},U.onclick=()=>{oe(()=>e.client.retry())},P.addEventListener("cancel",t=>{t.preventDefault(),F||ce()});try{let t=await e.client.get();await Z(e.client.view??t.run)}catch(t){throw se(),t}return{destroy:se,refresh:be,get recovery(){let t=te();if(t)return t;if(!o&&!r&&!F&&I){let l=I.recovery;if(l.type!=="native")return l}return{type:"recover",operationId:e.client.pendingPurchase?.operationId??e.client.view?.paywall?.quote?.operationId??b?.operationId??null,requestId:e.client.pendingCommand?.requestId??null}},prepareFallback(){if(F)return F;let t=te();if(t)return Promise.resolve(t);let l=e.client.pendingPurchase?.operationId??e.client.view?.paywall?.quote?.operationId??b?.operationId??null,h=()=>({type:"recover",operationId:l,requestId:e.client.pendingCommand?.requestId??null});if(e.client.hasDurableJournal!==!0){let q=I?.recovery;return Promise.resolve(q&&q.type!=="native"&&q.type!=="cancel"?q:h())}let N=(e.client.pendingCommands??(e.client.pendingCommand?[e.client.pendingCommand]:[])).some(q=>q.operation==="close");if(o&&!(N||b&&e.client.view?.status==="closed")||r||g||$||_.active||!I&&!b&&!N)return Promise.resolve(h());let x=I,H=(async()=>{try{if(!b&&N){let Q=await e.client.retry();return await Z(e.client.view??Q.run),h()}if(!b){let Q=await x.prepareFallback();if(Q.type!=="native")return Q;if(e.client.hasDurableJournal!==!0)return h();b=Q}let q=e.client.pendingCommands??(e.client.pendingCommand?[e.client.pendingCommand]:[]);if(q.length){let Q=q.find(ne=>ne.operation==="close");if(!Q||!T||Q.requestId!==T.requestId)return h();let j=await e.client.retry();Ie(j),await Z(e.client.view??j.run)}else{let Q=e.client.view,j=Q?.paywall;if(!Q||!j||j.selectionGeneration===void 0||(j.quote?.operationId??null)!==b.operationId||b.operationId!==null&&j.canReselect!==!0)return h();let ne=j.selectionGeneration,xe=await e.client.get();await Z(e.client.view??xe.run);let Y=e.client.view,le=Y?.paywall;if(!Y||!le||!["running","waiting"].includes(Y.status)||Y.stopped||Y.id!==Q.id||Y.nodeId!==Q.nodeId||Y.visit!==Q.visit||le.receiptId!==j.receiptId||le.selectionGeneration!==ne||(le.quote?.operationId??null)!==b.operationId||b.operationId!==null&&le.canReselect!==!0||e.client.pendingPurchase||(e.client.pendingCommands?.length??(e.client.pendingCommand?1:0)))return h();let ve=ie();T={runId:Y.id,operationId:b.operationId,revision:ve.revision,requestId:ve.requestId,nodeId:Y.nodeId,visit:Y.visit,receiptId:le.receiptId,selectionGeneration:ne,acknowledged:!1},await ce(ve)}let ae=te();return ae?(se(),ae):h()}catch(q){return W(q),h()}})();F=H;let ee=()=>{F===H&&(F=null)};return H.then(ee,ee),H},review:_.open,exitReview:_.exit,get unappliedDrafts(){return _.drafts}}}export{Ue as a,hn as b};
@@ -1 +1 @@
1
- import{ka as y}from"./chunk-PFHS7HK3.js";var v=767;function D(e,r,c=!1){return(e.type==="modal"||e.type==="sheet")&&e.mobile&&c&&r<=v?e.mobile:e.type}function G(e,r,c){let a=e.ownerDocument.defaultView,n=r.presentation,u;if((n.type==="modal"||n.type==="sheet")&&n.backdrop){let t=`lp-backdrop-${crypto.randomUUID()}`,p={none:"transparent",scrim:"#f2f2f2cc",dim:"#0006","strong-dim":"#000000bf",blur:"#0006"};e.dataset.indianaBackdrop=t,u=e.ownerDocument.createElement("style"),u.textContent=`dialog[data-indiana-backdrop="${t}"]::backdrop{background:${p[n.backdrop]};backdrop-filter:${n.backdrop==="blur"?"blur(16px)":"none"}}`,e.append(u)}let i=r.pages?.[0]?.root.style?.shape,S=i?.type==="pill"?"9999px":i?.type==="rect"?typeof i.radius=="number"?`${i.radius}px`:[i.radius.topLeft,i.radius.topRight,i.radius.bottomRight,i.radius.bottomLeft].map(t=>`${t}px`).join(" "):void 0,m=(n.type==="modal"||n.type==="sheet")&&(n.desktopWidth!==void 0||n.mobile!==void 0),o=n.type,l,f,d=!1,x=t=>{d||!Number.isFinite(t)||t<0||(f=t,o!=="fullscreen"&&o!=="inline"&&(e.style.height=`min(${Math.max(t,40)}px, calc(100dvh - ${o==="sheet"?0:32}px))`))},s=()=>{if(!d&&(o=l??D(n,a?.innerWidth??1024,a?.matchMedia?.("(pointer: coarse)").matches===!0),e.dataset.presentation=o,!(!m||n.type!=="modal"&&n.type!=="sheet"))){if(e.style.boxSizing="border-box",e.style.padding="0",e.style.border="0",e.style.overflow="hidden",e.style.outline="none",e.tabIndex=-1,e.style.background=r.theme.background,e.style.color=r.theme.text,o==="fullscreen")e.style.width="100vw",e.style.height="100dvh",e.style.maxWidth="100vw",e.style.maxHeight="100dvh",e.style.margin="0",e.style.borderRadius="0";else{let t=n.mobile==="sheet"&&o==="sheet",p=n.desktopWidth,h=a?.innerWidth??1024;e.style.width=t?`${h}px`:p?`${Math.min(p.max,Math.max(h*p.viewport/100,p.min))}px`:`${y[n.size]}px`,e.style.maxWidth=`${Math.max(0,h-(o==="sheet"?0:32))}px`,e.style.maxHeight=o==="sheet"?"100dvh":"calc(100dvh - 32px)",e.style.margin=o==="sheet"?"auto auto 0":"auto",e.style.borderRadius=S??(o==="sheet"?"16px 16px 0 0":"24px"),e.style.height="",f!==void 0&&x(f)}c?.(o)}},b=m?[a?.matchMedia?.(`(max-width: ${v}px)`),a?.matchMedia?.("(pointer: coarse)")].filter(t=>t!==void 0):[];if(m){a?.addEventListener("resize",s);for(let t of b)t.addEventListener?t.addEventListener("change",s):t.addListener?.(s)}return s(),{responsive:m,get type(){return o},latch(){d||l!==void 0||(s(),l=o)},setContentHeight:x,destroy(){if(!d){d=!0,u?.remove(),delete e.dataset.indianaBackdrop,a?.removeEventListener("resize",s);for(let t of b)t.removeEventListener?t.removeEventListener("change",s):t.removeListener?.(s)}}}}function j(e,r,c=!1){let a=e.ownerDocument.defaultView;if(typeof e.animate!="function"||a?.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let n=c?{duration:300,easing:"cubic-bezier(0.23, 1, 0.32, 1)"}:{duration:240,easing:"cubic-bezier(0.2, 0.8, 0.2, 1)"};e.animate(r==="sheet"?[{transform:"translateY(100%)"},{transform:"none"}]:r==="modal"?[{opacity:0,transform:c?"translateY(12px) scale(0.96)":"translateY(8px) scale(0.98)"},{opacity:1,transform:"none"}]:[{opacity:0},{opacity:1}],n);try{e.animate([{opacity:0},{opacity:1}],{...n,pseudoElement:"::backdrop"})}catch{}}function F(e,r){e.style.cssText=["position:absolute","z-index:1","top:calc(4px + env(safe-area-inset-top, 0px))","inset-inline-end:calc(4px + env(safe-area-inset-right, 0px))","width:44px","height:44px","padding:0","border:0",`background:radial-gradient(circle, ${r.background} 0 15px, color-mix(in srgb, ${r.text} 22%, ${r.background}) 15px 16px, transparent 16.5px)`,`color:${r.text}`,"font:400 20px/1 system-ui,sans-serif","cursor:pointer","touch-action:manipulation"].join(";")}export{D as a,G as b,j as c,F as d};
1
+ import{sa as y}from"./chunk-4SWGHICJ.js";var v=767;function D(e,r,c=!1){return(e.type==="modal"||e.type==="sheet")&&e.mobile&&c&&r<=v?e.mobile:e.type}function G(e,r,c){let a=e.ownerDocument.defaultView,n=r.presentation,u;if((n.type==="modal"||n.type==="sheet")&&n.backdrop){let t=`lp-backdrop-${crypto.randomUUID()}`,p={none:"transparent",scrim:"#f2f2f2cc",dim:"#0006","strong-dim":"#000000bf",blur:"#0006"};e.dataset.indianaBackdrop=t,u=e.ownerDocument.createElement("style"),u.textContent=`dialog[data-indiana-backdrop="${t}"]::backdrop{background:${p[n.backdrop]};backdrop-filter:${n.backdrop==="blur"?"blur(16px)":"none"}}`,e.append(u)}let i=r.pages?.[0]?.root.style?.shape,S=i?.type==="pill"?"9999px":i?.type==="rect"?typeof i.radius=="number"?`${i.radius}px`:[i.radius.topLeft,i.radius.topRight,i.radius.bottomRight,i.radius.bottomLeft].map(t=>`${t}px`).join(" "):void 0,m=(n.type==="modal"||n.type==="sheet")&&(n.desktopWidth!==void 0||n.mobile!==void 0),o=n.type,l,f,d=!1,x=t=>{d||!Number.isFinite(t)||t<0||(f=t,o!=="fullscreen"&&o!=="inline"&&(e.style.height=`min(${Math.max(t,40)}px, calc(100dvh - ${o==="sheet"?0:32}px))`))},s=()=>{if(!d&&(o=l??D(n,a?.innerWidth??1024,a?.matchMedia?.("(pointer: coarse)").matches===!0),e.dataset.presentation=o,!(!m||n.type!=="modal"&&n.type!=="sheet"))){if(e.style.boxSizing="border-box",e.style.padding="0",e.style.border="0",e.style.overflow="hidden",e.style.outline="none",e.tabIndex=-1,e.style.background=r.theme.background,e.style.color=r.theme.text,o==="fullscreen")e.style.width="100vw",e.style.height="100dvh",e.style.maxWidth="100vw",e.style.maxHeight="100dvh",e.style.margin="0",e.style.borderRadius="0";else{let t=n.mobile==="sheet"&&o==="sheet",p=n.desktopWidth,h=a?.innerWidth??1024;e.style.width=t?`${h}px`:p?`${Math.min(p.max,Math.max(h*p.viewport/100,p.min))}px`:`${y[n.size]}px`,e.style.maxWidth=`${Math.max(0,h-(o==="sheet"?0:32))}px`,e.style.maxHeight=o==="sheet"?"100dvh":"calc(100dvh - 32px)",e.style.margin=o==="sheet"?"auto auto 0":"auto",e.style.borderRadius=S??(o==="sheet"?"16px 16px 0 0":"24px"),e.style.height="",f!==void 0&&x(f)}c?.(o)}},b=m?[a?.matchMedia?.(`(max-width: ${v}px)`),a?.matchMedia?.("(pointer: coarse)")].filter(t=>t!==void 0):[];if(m){a?.addEventListener("resize",s);for(let t of b)t.addEventListener?t.addEventListener("change",s):t.addListener?.(s)}return s(),{responsive:m,get type(){return o},latch(){d||l!==void 0||(s(),l=o)},setContentHeight:x,destroy(){if(!d){d=!0,u?.remove(),delete e.dataset.indianaBackdrop,a?.removeEventListener("resize",s);for(let t of b)t.removeEventListener?t.removeEventListener("change",s):t.removeListener?.(s)}}}}function j(e,r,c=!1){let a=e.ownerDocument.defaultView;if(typeof e.animate!="function"||a?.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let n=c?{duration:300,easing:"cubic-bezier(0.23, 1, 0.32, 1)"}:{duration:240,easing:"cubic-bezier(0.2, 0.8, 0.2, 1)"};e.animate(r==="sheet"?[{transform:"translateY(100%)"},{transform:"none"}]:r==="modal"?[{opacity:0,transform:c?"translateY(12px) scale(0.96)":"translateY(8px) scale(0.98)"},{opacity:1,transform:"none"}]:[{opacity:0},{opacity:1}],n);try{e.animate([{opacity:0},{opacity:1}],{...n,pseudoElement:"::backdrop"})}catch{}}function F(e,r){e.style.cssText=["position:absolute","z-index:1","top:calc(4px + env(safe-area-inset-top, 0px))","inset-inline-end:calc(4px + env(safe-area-inset-right, 0px))","width:44px","height:44px","padding:0","border:0",`background:radial-gradient(circle, ${r.background} 0 15px, color-mix(in srgb, ${r.text} 22%, ${r.background}) 15px 16px, transparent 16.5px)`,`color:${r.text}`,"font:400 20px/1 system-ui,sans-serif","cursor:pointer","touch-action:manipulation"].join(";")}export{D as a,G as b,j as c,F as d};
@@ -1 +1 @@
1
- import{a as u}from"./chunk-26HU2HXU.js";import{pa as E,qa as M,ra as j,sa as O,ta as T}from"./chunk-JVQVQHV2.js";import{k as w}from"./chunk-PFHS7HK3.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
+ import{a as u}from"./chunk-KHIQQNTR.js";import{Aa as O,Ba as T,xa as E,ya as M,za as j}from"./chunk-GSFNAB3W.js";import{q as w}from"./chunk-4SWGHICJ.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 +1 @@
1
- import{a as P}from"./chunk-26HU2HXU.js";import{a as sA,bb as zA,cb as FA,h as pA,i as xA,j as gA,o as $A}from"./chunk-JVQVQHV2.js";import{a as MA,d as jA,e as UA,f as _A}from"./chunk-PFHS7HK3.js";function S(A){return typeof A=="string"?A:String(A)}var ye=/[\ud800-\udbff](?![\udc00-\udfff])|(^|[^\ud800-\udbff])[\udc00-\udfff]/g;function Pe(A){return A.replace(ye,"$1\uFFFD")}function PA(A,e){if(typeof A!="object"||A==null){let t="";throw t+="The provided value is not an object",new TypeError(t)}return A}function ZA(A){if(A!=null&&(typeof A=="object"||typeof A=="function")){let e=A[Symbol.iterator];if(e==null)return;if(typeof e!="function")throw new TypeError("The provided value is not iterable");let t=e.call(A);if(!t||typeof t!="object")throw new TypeError("Result of the Symbol.iterator method is not an object");return t}}function QA(A){let e;if(Array.isArray(A)){let t=A.map(S);if(t.length===2)return t}else if((e=ZA(A))!=null){let t=PA(e.next()),n=PA(e.next());if(!t.done&&!n.done)return[S(t.value),S(n.value)]}throw new TypeError("Each query pair must be an iterable [name, value] tuple")}var GA="0123456789ABCDEF",De=/(?:%[0-9A-Fa-f]{2})+/g;function U(A){return`%${GA[A>>4&15]}${GA[15&A]}`}function Ae(A,e,t=!1){return A>=55296&&A<=57343&&(A=65533),A<=127?t&&A===32?"+":e(A)?U(A):String.fromCharCode(A):A<=2047?U(192|A>>6)+U(128|63&A):A<=65535?U(224|A>>12)+U(128|A>>6&63)+U(128|63&A):U(240|A>>18)+U(128|A>>12&63)+U(128|A>>6&63)+U(128|63&A)}function DA(A){return A>=48&&A<=57?A-48:A>=65&&A<=70?A-65+10:A>=97&&A<=102?A-97+10:-1}function bA(A,e=!1){let t=0;for(;t<A.length;t++){let n=A.charCodeAt(t);if(n===37||e&&n===43)break}return t===A.length?A:(e?A.replace(/\+/g," "):A).replace(De,n=>{try{return decodeURIComponent(n)}catch{return"\uFFFD".repeat(n.length/3)}})}function AA(A){return A<=31||A>126}function be(A){switch(A){case 32:case 34:case 60:case 62:case 96:return!0;default:return AA(A)}}function qA(A){switch(A){case 32:case 34:case 35:case 60:case 62:return!0;default:return AA(A)}}function Se(A){return qA(A)||A===39}function SA(A){switch(A){case 63:case 94:case 96:case 123:case 125:return!0;default:return qA(A)}}function cA(A){switch(A){case 47:case 58:case 59:case 61:case 64:case 91:case 92:case 93:case 124:return!0;default:return SA(A)}}function YA(A){switch(A){case 33:case 39:case 40:case 41:case 126:return!0;default:return(function(t){switch(t){case 36:case 37:case 38:case 43:case 44:return!0;default:return cA(t)}})(A)}}function ee(A,e){return Ae(A=A||0,e)}function _(A,e,t=!1){let n=0;for(;n<A.length;n++){let u=A.charCodeAt(n);if(u>=128||t&&u===32||e(u))break}if(n===A.length)return A;let r=A.slice(0,n);for(;n<A.length;n++){let u=A.charCodeAt(n),l=u;if(u>=55296&&u<=56319&&n+1<A.length){let a=A.charCodeAt(n+1);a>=56320&&a<=57343&&(l=(u-55296<<10)+a-56320+65536,n++)}r+=Ae(l,e,t)}return r}function NA(A){let e=[],t=0,n=0;for(;n<=A.length;){if(n=A.indexOf("&",t),n<0&&(n=A.length),n!==t){let r=A.slice(t,n),u=r.indexOf("=");u<0&&(u=r.length),e.push([bA(r.slice(0,u),!0),bA(r.slice(u+1),!0)])}if(t=n+1,n===A.length)break}return e}function CA(A){let e="";for(let t=0;t<A.length;t++){let n=_(A[t][0],YA,!0),r=_(A[t][1],YA,!0);e+=t!==0?`&${n}=${r}`:`${n}=${r}`}return e}var Ce=[2191,2191,3164,3164,3292,3292,6863,6877,6880,6891,8385,8385,11158,11158,42958,42959,42962,42962,42964,42964,42993,42993,64451,64466,64912,64913,64968,64974,67904,67929,69317,69319,69328,69336,69370,69371,72544,72551,73136,73179,73184,73193,93856,93880,93883,93907,94194,94198,100344,100351,101641,101662,101760,101874,118010,118012,118458,118480,118496,118512,124608,124638,124640,124661,124670,124671,128728,128728,128887,128890,129232,129240,129620,129623,129674,129674,129678,129678,129736,129736,129741,129741,129770,129770,129775,129775,130042,130042,177978,177983,183970,183981,205744,210041],Ie=[7296,7297,7298,7299,7300,7301,7302,7303,7304,42958,42962,42964,42993],Ee=["\u0432","\u0434","\u043E","\u0441","\u0442","\u0442","\u044A","\u0463","\uA64B","\uA7CF","\uA7D3","\uA7D5","s"],ve=[2381,2381,2509,2509,2637,2637,2765,2765,2893,2893,3021,3021,3149,3149,3277,3277,3387,3388,3405,3405,3530,3530,3642,3642,3770,3770,3972,3972,4153,4154,5908,5909,5940,5940,6098,6098,6752,6752,6980,6980,7082,7083,7154,7155,11647,11647,43014,43014,43052,43052,43204,43204,43347,43347,43456,43456,43766,43766,44013,44013,68159,68159,69702,69702,69744,69744,69759,69759,69817,69817,69939,69940,70080,70080,70197,70197,70378,70378,70477,70477,70606,70608,70722,70722,70850,70850,71103,71103,71231,71231,71350,71350,71467,71467,71737,71737,71997,71998,72160,72160,72244,72244,72263,72263,72345,72345,72767,72767,73028,73029,73111,73111,73537,73538,90415,90415];function Te(A){for(let e=0;e<A.length;e++){let t=A.codePointAt(e);if(t>65535&&e++,t<=32||t===37||t===127||t>=55296&&t<=57343||t>=128&&t<=159||t>=64976&&t<=65007||!(65534&~t)||t===65533)return!0}return!1}var[qe,Ne,Oe,VA]=[[[],"0,6,7,8,m,w,10,1b,1d,1f,72,73,7k,8k,dt,2rk","AAAAAAAAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAA/AAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAADAAABwfwAAAAAAAMADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAQAAAAAAAAQCAAABAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgACAAAAAAAAAAAAAAAAD//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAP///////////////wAAAAAAAAAAAAAAAAAAAAA="],[[],"6,7,8,o,4o,7e,7f,7h,7i,7j,dl","AAAAAEF9+P/+BwAAAMAA//8AAPz/////BlADAAAAAJwAAPz///8AAADA//H/5+X8AAAAAAAAAAAA/P///wcAAAAAAAAAAAAAPv0vAD0BAABA/gAA/5/5/f8BAAAAAAAAgAAAAP//////////////AYD/////BQAAAAAAAAAAAAAAAAAAAAAAAP///////wcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8g+N8B+AAAAAAAAAAAAAAAAAAAAAAAAP//AwAAYAAAAAAAAAAAAAD/////CwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANgAAAAAAAAAAAAAAAAA//8fAB4AAAD//wMAAAAAAH3/HgwAAAAAAAD//////////w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],[[],"6,7,8,o,4o,7e,7f,7h,7i,7j,dl","AAAAAP3////+BwAAAMDu//////////////8vAADAAJwAAP3///8AAADg////////AAAAAAAAAAAA/P///wcAAAAAAAAAAAAA////Ab0H//9H/gAA/9////8BAAAAAAAAgAAAAP//////////////AYD/////BQAAAAAAAAAAAAAAAAAAAAAAAP///////wcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL/G//8T+AAAAAAAAAAAAAAAAAAAAAAAAP//AwAAfgAAAAAAAAAAAAD+////DwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANwAAAAAAAAAAAAAAAAA//8fAB4AAAD//wMAAAAAAH3/Hg4AAAAAAAD//////////w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],[[],"0,3,4,5,6,7,8,9,a,b,c,d,e,f,g,j,n,o,p,q,r,s,t,w,18,19,1c,4m,4o,4p,4q,4r,6z,72,73,75,76,77,7e,7h,7i,7j,7k,7l,7m,7n,7o,7p,7q,7r,7s,7t,7u,7v,7w,7x,7y,7z,8k,9t,a2,a3,a7,cc,cv,cx,cy,d6,dc,dd,de,dg,dh,di,dk,dl,2rk,2rl","AAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAD//////////////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/v////+/tgAAAAAAAAAAAP8XAAAAAAD4//8AAAEAAAAAAAAAAAAAAMCfnz0AAACAAgAAAP///wcAAAAAAAAAAAAAwP8BAAAAAAAA+A8gAADA++8+AAAAAAAOAAAAAAAAgP8AAAAAAPz///v///8HAAAAAAAAFP4h/gAMAAAAAgAAAAAAABAeIAAADAAAQAYAAAAAAAAQhjkCAAAAIwAGAAAAAAAAEL4hAAAMAAD8AgAAAAAAAJAeIGAADAAAAAQAAAAAAAAAASAAAAAAAAARAAAAAAAA0ME9YAAMAAAAAgAAAAAAAJBAMAAADAAAAAMAAAAAAAAYHiAAAAwAAAACAAAAAAAAAAAEXAAAAAAAAAAAAAAA8geAfwAAAAAAAAAAAAAAAPIfAH8AAAAAAAAAAAADAACgAgAAAAAAAP5/3+D//v///x9AAAAAAAAAAAAAAAAA4P1mAAAAwwEAHgBkIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAMAAAADAAAAAwAAAAAAAAAsD9A/g8gAAAAAAC4AAAAAAAAAAAAAAAAAABgAAAAAAIAAAAAAAAAAAAAAAAAAIcBBA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAJAAAAAAAAQH/lH/ifAAAAAAAA//////8//w8AAA8AAAAAANAXBAAAAAD4DwADAAAAPDsAAAAAAABAowMAAAAAAADwzwAAAAAAAAAAAAAAAAAAAAAAAAD3//0hEAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wDIAAAAfAAAAAAAAB/8AAAAAAAAAAAAAAAA/////wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAwAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAA/////wAAAAAAPAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAID3PwAAAMAAAAAAAAAAAAAAAwBECAAAYBAAAAAAAAAAAAAAAAAAAAAAAAAwAAAA//8DgAAAAADAPwAAgP8DAAAAAAAHAAAAAADIMwAAAAAgAAAAAAAAAAB+ZgAIEAAAAAAAEAAAAAAAAJ3BAgAAAAAwQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAICEAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAP//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAMAHAAAAAAAAAAAAAAAAAAAAAG7wAAAAAACHAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAPAAAAAAAAAAAD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAA/AAAAAAAAAAAwP8BAAAAAAA8AAAAAAAAAAAAAAAAAAAAAgAAAAAAAP9/AAAAAAAZgAMAAAAAAHgGBAAAAAAAAAAHAAAAgO8fAAAAAAAAAAgAAwAAAAAAwH8AngAAAAAAAAAAAAAAgNNAAgAAAAAAAAAAAAAAAAAAAAAAAID4BwAAAwAAAAAAABgBAAAAwB8fAAAAAAAAAAD4AUAFAAYAAAAAAAAAAAAA/1wAAEAAAAAAAAAAAAAA+IUNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8sAEAADAAAAAAAAAAAAAA+KcBAAAAAAAAAAAAAAAAKL8AAAAAAAAAAAAAAACgvA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgP8GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFgIAAAAAAAAAAAAAAAAAAAAAADwDAEAAAD+BwAAAAD4eYAAfg4AAAAAAPx/AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAF0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf78AAAAAAAAAAAAA/P///G0AAAAAAAAAAAAAAAAAAAB+tL8AAAAAAAAAAACjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAwAAAAAAwAcFAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//4H/PwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMD/4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwAAAAAAAAB/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAcAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAPAAAAAAAAAAAAAAD//////z///38AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAD+P/nDwAAADwAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////9/+P//////HyAAEAAA+P7/AAAAAAAAAAAAAH////nbBwAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAfwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASMAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfwAAAAAAAAAAAAAAAADwDwAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAA////////////////AAAAAAAAAAAAAAAAAAAAAP///////////////////////////////////////wAA"]].map(function([e,t,n]){return[e,t.split(",").map(r=>parseInt(r,36)),Uint8Array.from(atob(n),r=>r.charCodeAt(0))]});function Re(A,e){return e===931||e===1010||e===120531||e===120589||e===120647||e===120705||e===120763?"\u03C3":e>=5112&&e<=5117?String.fromCodePoint(e-8):e>=43888&&e<=43967?String.fromCodePoint(e-38864):e>=93856&&e<=93880?String.fromCodePoint(e+27):e===837||e===890||e>=8064&&e<=8111||e>=8114&&e<=8188?A.normalize("NFD").replace(/\u0345/g,"\u03B9").normalize("NFC").toLowerCase():""}function te(A,e){for(let t=0;t<A.length;t+=2)if(e>=A[t]&&e<=A[t+1])return!0;return!1}function X(A,e){let[t,n,r]=A,u=e>>8;for(let f=0;f<t.length;f+=2)if(u>=t[f]&&u<=t[f+1])return!0;let l=n.indexOf(u);if(l<0)return!1;let a=255&e;return!!(r[32*l+(a>>3)]&1<<(7&a))}function ke(A){let e=Array.from(A,t=>t.codePointAt(0));for(let t=0;t<e.length;t++){let n=e[t];if(n!==8204&&n!==8205||t>0&&te(ve,e[t-1]))continue;if(n===8205)return!1;let r=t-1;for(;r>=0&&X(VA,e[r]);)r--;let u=t+1;for(;u<e.length&&X(VA,e[u]);)u++;if(!(r>=0&&u<e.length&&X(Ne,e[r])&&X(Oe,e[u])))return!1}return!0}var Le=/(?![\p{Mark}\p{Decimal_Number}])[\p{Script=Arabic}\p{Script=Hebrew}]/u,Be=/\p{Script=Latin}/u;function He(A){return!Le.test(A)||!Be.test(A)}var F=36,iA=1,IA=26,Me=38,je=700,Ue=72,_e=128,xe=2147483647;function KA(A){return String.fromCharCode(A+22+75*+(A<26))}function $e(A,e,t){let n=0;for(A=t?Math.floor(A/je):A>>1,A+=Math.floor(A/e);A>(F-iA)*IA>>1;n+=F)A=Math.floor(A/(F-iA));return Math.floor(n+(F-iA+1)*A/(A+Me))}function ze(A){let e=Array.from(A,f=>f.codePointAt(0)),t="",n=0;for(let f=0;f<e.length;f++){let h=e[f];h<128&&(t+=String.fromCharCode(h),n++)}let r=n;r&&(t+="-");let u=_e,l=0,a=Ue;for(;n<e.length;){let f=xe;for(let h=0;h<e.length;h++){let w=e[h];w>=u&&w<f&&(f=w)}l+=(f-u)*(n+1),u=f;for(let h=0;h<e.length;h++){let w=e[h];if(w<u&&l++,w===u){let p=l;for(let m=F;;m+=F){let y=m<=a?iA:m>=a+IA?IA:m-a;if(p<y)break;t+=KA(y+(p-y)%(F-y)),p=Math.floor((p-y)/(F-y))}t+=KA(p),a=$e(l,n+1,n===r),l=0,n++}}l++,u++}return t}function wA(A){let e=10;if(A.length>=2&&A[0]==="0"&&(A[1]==="x"||A[1]==="X"))A=A.slice(2),e=16;else if(A.length>=2&&A[0]==="0")A=A.slice(1),e=8;else if(A==="")return-1;let t=0;for(let n=0;n<A.length;n++){let r=DA(A.charCodeAt(n));if(r>=e||r<0)return-1;t=t*e+r}return t}function JA(A){switch(A){case".":case"%2e":case"%2E":return!0;default:return!1}}function ne(A,e){return(A>=65&&A<=90||A>=97&&A<=122)&&(e===58||e===124)}function re(A){return A.length===2&&ne(A.codePointAt(0),A.codePointAt(1))}function WA(A){return A.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u)!==-1}function I(A){switch(A){case"ftp":case"http":case"https":case"ws":case"wss":case"file":return!0;default:return!1}}function se(A){switch(A){case"ftp":return 21;case"http":case"ws":return 80;case"https":case"wss":return 443;default:return null}}function EA(A,e){if(A[0]==="[")return A[A.length-1]==="]"?(function(n){let r=[0,0,0,0,0,0,0,0],u=null,l=0,a=0,f=Array.from(n,h=>h.codePointAt(0));if(f[a]===58){if(f[a+1]!==58)return null;a+=2,l++,u=l}for(;a<f.length;){if(l===8)return null;if(f[a]===58){if(u!==null)return null;a++,l++,u=l;continue}let h=0,w=0,p=0;for(;p<4&&(h=DA(f[a]))>=0;)w=(w<<4)+h,a++,p++;if(f[a]===46){if(p===0||l>6)return null;a-=p;let m=0;for(;f[a]!==void 0;){let y=0;if(m>0)if(f[a]===46&&m<4)a++;else return null;if(f[a]==null||f[a]<48||f[a]>57)return null;for(;f[a]>=48&&f[a]<=57;){if(y=10*y+DA(f[a]),y>255)return null;a++}r[l]=256*r[l]+y,m++,m%2==0&&l++}if(m!==4)return null;break}else if(f[a]===58){if(f[++a]===void 0)return null}else if(f[a]!==void 0)return null;r[l]=w,l++}if(u!==null){let h=l-u;for(l=7;l!==0&&h>0;){let w=r[u+h-1];r[u+h-1]=r[l],r[l]=w,l--,h--}}else if(u===null&&l!==8)return null;return r})(A.substring(1,A.length-1)):null;if(e)return(function(n){return WA(n)?null:_(n,AA)})(A);{let t=(function(r){let u=!1,l=!1;for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h<=32||h===37||h===127)return null;if(h>=128){u=!0;break}h>=65&&h<=90&&(l=!0)}if(!u)return r!==""?l?r.toLowerCase():r:null;if((function(h){for(let w of h){let p=w.codePointAt(0);if(/[\p{Cn}\p{Co}\p{Cs}\p{Noncharacter_Code_Point}]/u.test(w)&&!te(Ce,p)||X(qe,p))return!0}return!1})(r))return null;let a=(r=(function(h){let w="";for(let p of h){let m=p.codePointAt(0);if(m!==8204&&m!==8205&&/\p{Default_Ignorable_Code_Point}/u.test(p))continue;let y=Re(p,m);if(y){w+=y;continue}let N=Ie.indexOf(m);w+=N<0?p:Ee[N]}return w})(r).normalize("NFKC").replace(/[\u3002\uff0e\uff61]/g,".").toLowerCase()).split(".");for(let f=0;f<a.length;f++){let h=a[f];if(h==="")continue;let w=/[^\0-\x7f]/.test(h);if(Te(h)||w&&(/^\p{Mark}/u.test(h)||!ke(h)||!He(h)||h.startsWith("xn--")))return null;w&&(a[f]=`xn--${ze(h)}`)}return(r=a.join("."))!==""?r:null})(A.indexOf("%")===-1?A:bA(A));return t===null||WA(t)?null:(function(r){let u=r.length,l=r.lastIndexOf(".",u-2)+1;if(r.charCodeAt(u-1)===46&&u--,u<=l)return!1;if(wA(r.slice(l,u))>=0)return!0;for(;l<u;l++){let a=r.charCodeAt(l);if(a<48||a>57)return!1}return!0})(t)?(function(r){let u=r.split("."),l=u.length;if(u[l-1]||l--,l>4)return null;let a=0;for(let h=0;h<l-1;h++){let w=wA(u[h]);if(w<0||w>255)return null;a+=w*(1<<8*(3-h))}let f=wA(u[l-1]);return f<0||f>=256**(5-l)?null:(a+=f,a)})(t):t}}function vA(A){return typeof A=="number"?(function(t){let r="";return r+=`${(t>>>24&255).toString(10)}.`,r+=`${(t>>>16&255).toString(10)}.`,r+=`${(t>>>8&255).toString(10)}.`,r+=(t&255).toString(10),r})(A):Array.isArray(A)?`[${(function(t){let n=(function(a){let f=-1,h=-1,w=1,p=0;for(let m=0;m<a.length;++m)a[m]!==0?(p>w&&(f=h,w=p),h=-1,p=0):(h===-1&&(h=m),++p);return p>w?h:f})(t),r="",u=!1;for(let l=0;l<=7;++l)if(!(u&&t[l]===0)){if(u&&(u=!1),n===l){r+=l===0?"::":":",u=!0;continue}r+=t[l].toString(16),l!==7&&(r+=":")}return r})(A)}]`:A}function oe(A){A.path.length>0&&(A.path.length!==1||A.scheme!=="file"||!(function(t){return/^[A-Za-z]:$/u.test(t)})(A.path[0]))&&A.path.pop()}function ie(A){return A.username!==""||A.password!==""}function mA(A){return A.host===null||A.host===""||A.scheme==="file"}var s=0,o="",g="",D=null,i,lA=!1,uA=!1,G=!1,E;function B(A,e,t,n){e||(A=(function(l){let a=0,f=l.length;for(;a<f&&!(l.charCodeAt(a)>32);++a);for(;f>a&&!(l.charCodeAt(f-1)>32);--f);return l.substring(a,f)})(A)),A=(function(l){let a=0;for(;a<l.length;a++){let h=l.charCodeAt(a);if(h===9||h===10||h===13)break}if(a===l.length)return l;let f=l.slice(0,a);for(;a<l.length;a++){let h=l.charCodeAt(a);h!==9&&h!==10&&h!==13&&(f+=l[a])}return f})(A),s=0,o=A,g="",D=t||null,i=e||{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,opaquePath:!1},lA=!1,uA=!1,G=!1,E=n||0;let r=Fe;switch(n){case 3:case 4:r=aA;break;case 5:r=RA;break;case 6:r=Y;break;case 7:r=Q;break;case 8:r=x}return r(c(A,s))!==1?i:null}function d(A,e){return s+=s===A?M(e):1,s<=o.length}function c(A,e){return e<A.length?A.codePointAt(e):void 0}function M(A){return A!=null&&A>65535?2:1}function le(A){return A==null?"":A<=65535?String.fromCharCode(A):String.fromCodePoint(A)}var Fe=A=>{let e=s;if(A!=null&&(A>=65&&A<=90||A>=97&&A<=122)){let t=s+1;for(A=o.charCodeAt(t);A===43||A===45||A===46||A>=65&&A<=90||A>=97&&A<=122||A>=48&&A<=57;)t++,A=o.charCodeAt(t);return g=o.slice(s,t).toLowerCase(),s=t,Qe(t<o.length?A:void 0)}else return E?1:(--s,d(e,A)?ue(c(o,s)):0)},Qe=A=>{let e=s;if(A===58){if(E){if(I(i.scheme)!==I(g))return 0;if((ie(i)||i.port!==null)&&g==="file")return 0;if(i.scheme==="file"&&i.host==="")return 0}return i.scheme=g,E?(i.port===se(i.scheme)&&(i.port=null),0):(g="",i.scheme==="file"?d(e,A)?kA(c(o,s)):0:I(i.scheme)&&D!==null&&D.scheme===i.scheme?d(e,A)?Ge(c(o,s)):0:I(i.scheme)?d(e,A)?Ve(c(o,s)):0:c(o,s+1)===47?(s++,d(e,A)?Ye(c(o,s)):0):(i.path=[""],i.opaquePath=!0,d(e,A)?ae(c(o,s)):0))}else return E?1:(g="",s=-1,d(e,A)?ue(c(o,s)):0)},ue=A=>{let e=s;return D===null||D.opaquePath&&A!==35?1:D.opaquePath&&A===35?(i.scheme=D.scheme,i.path=D.path.slice(),i.opaquePath=D.opaquePath,i.query=D.query,i.fragment="",d(e,A)?x(c(o,s)):0):D.scheme==="file"?(s--,d(e,A)?kA(c(o,s)):0):(s--,d(e,A)?OA(c(o,s)):0)},Ge=A=>{let e=s;return A===47&&c(o,s+1)===47?(++s,d(e,A)?hA(c(o,s)):0):(s--,d(e,A)?OA(c(o,s)):0)},Ye=A=>{let e=s;return A===47?d(e,A)?W(c(o,s)):0:(s--,d(e,A)?j(c(o,s)):0)},OA=A=>{let e=s;return i.scheme=D.scheme,A===47||I(i.scheme)&&A===92?d(e,A)?XA(c(o,s)):0:(i.username=D.username,i.password=D.password,i.host=D.host,i.port=D.port,i.path=D.path.slice(),i.query=D.query,A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?x(c(o,s)):0):A!=null?(i.query=null,i.path.pop(),s--,d(e,A)?j(c(o,s)):0):d(e,A)?OA(c(o,s)):0)},XA=A=>{let e=s;return I(i.scheme)&&(A===47||A===92)?d(e,A)?hA(c(o,s)):0:A===47?d(e,A)?W(c(o,s)):0:(i.username=D.username,i.password=D.password,i.host=D.host,i.port=D.port,s--,d(e,A)?j(c(o,s)):0)},Ve=A=>{let e=s;return A===47&&c(o,s+1)===47?s++:s--,d(e,A)?hA(c(o,s)):0},hA=A=>{let e=s;return A!==47&&A!==92?(s--,d(e,A)?W(c(o,s)):0):d(e,A)?hA(c(o,s)):0},W=A=>{let e=s;if(A!=null&&A!==64&&A!==35&&A!==47&&A!==63&&(A!==92||!I(i.scheme))){let t=s+M(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===64||n===35||n===47||n===63||n===92&&I(i.scheme))break;t+=M(n)}return g+=o.slice(s,t),s=t-1,d(e,A)?W(c(o,s)):0}if(A===64){lA&&(g=`%40${g}`),lA=!0;for(let t=0;t<g.length;t++){let n=g.codePointAt(t);if(n===58&&!uA){uA=!0;continue}let r=ee(n,cA);uA?i.password+=r:i.username+=r,n!=null&&n>65535&&t++}return g="",d(e,A)?W(c(o,s)):0}else return A==null||A===35||A===47||A===63||A===92&&I(i.scheme)?lA&&g===""?1:(s-=g.length+1,g="",d(e,A)?aA(c(o,s)):0):(g+=le(A),d(e,A)?W(c(o,s)):0)},aA=A=>{let e=s;if(E&&i.scheme==="file")return s--,d(e,A)?LA(c(o,s)):0;if(A!=null&&A!==58&&A!==35&&A!==47&&A!==63&&(A!==92||!I(i.scheme))){let t=s+M(A);for(A===91?G=!0:A===93&&(G=!1);t<o.length;){let n=c(o,t);if(n==null||!G&&n===58||n===35||n===47||n===63||n===92&&I(i.scheme))break;n===91?G=!0:n===93&&(G=!1),t+=M(n)}return g+=o.slice(s,t),s=t-1,d(e,A)?aA(c(o,s)):0}else if(A===58&&!G){if(g===""||E===4)return 1;let t=EA(g,!I(i.scheme));return t===null?1:(i.host=vA(t),g="",d(e,A)?RA(c(o,s)):0)}else if(A==null||A===35||A===47||A===63||A===92&&I(i.scheme)){if(s--,I(i.scheme)&&g==="")return 1;if(E&&g===""&&(ie(i)||i.port!==null))return 1;let t=EA(g,!I(i.scheme));return t===null?1:(i.host=vA(t),g="",E?0:d(e,A)?Y(c(o,s)):0)}else return g+=le(A),d(e,A)?aA(c(o,s)):0},RA=A=>{let e=s;if(A!=null&&A>=48&&A<=57){let t=s+1;for(;t<o.length;){let n=o.charCodeAt(t);if(n<48||n>57)break;t++}return g+=o.slice(s,t),s=t-1,d(e,A)?RA(c(o,s)):0}else if(E||A==null||A===35||A===47||A===63||A===92&&I(i.scheme)){if(g!==""){let t=parseInt(g,10);if(t>65535)return 1;if(i.port=t===se(i.scheme)?null:t,g="",E)return 0}return E?1:(s--,d(e,A)?Y(c(o,s)):0)}else return 1};function ce(A,e){let t=A.length-e;if(t<2)return!1;if(ne(c(A,e),c(A,e+1))){if(t===2)return!0;{let n=c(A,e+2);return n===47||n===92||n===63||n===35}}else return!1}var kA=A=>{let e=s;return i.scheme="file",i.host="",A===47||A===92?d(e,A)?Ke(c(o,s)):0:D?.scheme==="file"?(i.host=D.host,i.path=D.path.slice(),i.opaquePath=D.opaquePath,i.query=D.query,A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?x(c(o,s)):0):A!=null?(i.query=null,ce(o,s)?i.path=[]:oe(i),s--,d(e,A)?j(c(o,s)):0):d(e,A)?kA(c(o,s)):0):(s--,d(e,A)?j(c(o,s)):0)},Ke=A=>{let e=s;return A===47||A===92?d(e,A)?LA(c(o,s)):0:(D!==null&&D.scheme==="file"&&(!ce(o,s)&&(function(n){if(n.length===2){let r=n.codePointAt(0),u=n.codePointAt(1);return(r>=65&&r<=90||r>=97&&r<=122)&&u===58}else return!1})(D.path[0])&&i.path.push(D.path[0]),i.host=D.host),s--,d(e,A)?j(c(o,s)):0)},LA=A=>{let e=s;if(A!=null&&A!==47&&A!==92&&A!==63&&A!==35){let t=s+M(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||n===92||n===63||n===35)break;t+=M(n)}return g+=o.slice(s,t),s=t-1,d(e,A)?LA(c(o,s)):0}else if(A==null||A===47||A===92||A===63||A===35){if(s--,!E&&re(g))return d(e,A)?j(c(o,s)):0;if(g==="")return i.host="",E?0:d(e,A)?Y(c(o,s)):0;{let t=EA(g,!I(i.scheme));return t===null?1:(t==="localhost"&&(t=""),i.host=vA(t),g="",E?0:d(e,A)?Y(c(o,s)):0)}}return 1},Y=A=>{let e=s;return I(i.scheme)?(A!==92&&A!==47&&s--,d(e,A)?j(c(o,s)):0):!E&&A===63?(i.query="",d(e,A)?Q(c(o,s)):0):!E&&A===35?(i.fragment="",d(e,A)?x(c(o,s)):0):A!=null?(A!==47&&s--,d(e,A)?j(c(o,s)):0):(E&&i.host===null&&i.path.push(""),d(e,A)?Y(c(o,s)):0)},j=A=>{let e=s;if(A!=null&&A!==47&&(!I(i.scheme)||A!==92)&&(E||A!==63&&A!==35)){let t=s+M(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||I(i.scheme)&&n===92||!E&&(n===63||n===35))break;t+=M(n)}g+=_(o.slice(s,t),SA),s=t,A=c(o,t)}if(A==null||A===47||I(i.scheme)&&A===92||!E&&(A===63||A===35)){let t=I(i.scheme)&&A===92;return(function(r){switch(r){case"..":case"%2e.":case"%2E.":case".%2e":case".%2E":case"%2e%2e":case"%2E%2e":case"%2e%2E":case"%2E%2E":return!0;default:return!1}})(g)?(oe(i),A!==47&&!t&&i.path.push("")):JA(g)&&A!==47&&!t?i.path.push(""):JA(g)||(i.scheme==="file"&&i.path.length===0&&re(g)&&(g=`${g[0]}:`),i.path.push(g)),g="",A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?x(c(o,s)):0):d(e,A)?j(c(o,s)):0}else return g+=ee(A,SA),d(e,A)?j(c(o,s)):0},ae=A=>{let e=s;if(A===63)return i.query="",d(e,A)?Q(c(o,s)):0;if(A===35)return i.fragment="",d(e,A)?x(c(o,s)):0;if(A!=null){let t=s+M(A);for(;t<o.length;){let r=c(o,t);if(r===63||r===35)break;t+=M(r)}let n=o.slice(s,t);if(t<o.length&&n.charCodeAt(n.length-1)===32?i.path[0]+=_(n.slice(0,-1),AA)+"%20":i.path[0]+=_(n,AA),s=t,(A=c(o,t))===63)return i.query="",d(e,A)?Q(c(o,s)):0;if(A===35)return i.fragment="",d(e,A)?x(c(o,s)):0}return d(e,A)?ae(c(o,s)):0},Q=A=>{let e=s,t=s;if(A!=null){if(E)t=o.length;else{let r=o.indexOf("#",s);t=r===-1?o.length:r}let n=I(i.scheme)?Se:qA;i.query+=_(o.slice(s,t),n)}return s=t,c(o,t)===35&&!E?(i.fragment="",d(e,A)?x(c(o,s)):0):d(e,A)?Q(c(o,s)):0},x=A=>{let e=s;return A!=null&&(i.fragment+=_(o.slice(s),be),s=o.length),d(e,A)?x(c(o,s)):0};function TA(A){if(A.opaquePath)return A.path[0];{let e="";for(let t of A.path)e+=`/${t}`;return e}}function fe(A){switch(A.scheme){case"blob":{let e=B(TA(A),null,null,0);return e===null||e.scheme!=="http"&&e.scheme!=="https"?"null":fe(e)}case"ftp":case"http":case"https":case"ws":case"wss":return(function(t){let n=`${t.scheme}://`;return n+=t.host,t.port!==null&&(n+=`:${t.port}`),n})(A);default:return"null"}}var b=Symbol("URLImpl"),eA=class A{constructor(e,t){if(e===void 0&&t===void 0)throw new TypeError('The "url" argument must be specified.');e=S(e),t!=null&&(t=S(t));let n=null;if(t!=null&&(n=B(t,null,null,0),n==null))throw new TypeError(`Invalid base URL: ${t}`);let r=B(e,null,n,0);if(r==null)throw new TypeError(`Invalid URL: ${e}`);this[b]={url:r,query:null}}static createObjectURL(e){throw new TypeError("URL.createObjetURL is unsupported")}static revokeObjectURL(e){}static parse(e,t){e=S(e),t!==void 0&&(t=S(t));try{return new A(e,t)}catch{return null}}static canParse(e,t){e=S(e),t!==void 0&&(t=S(t));let n=null;return t!=null&&(n=B(t,null,null,0),n==null)?!1:B(e,null,n,0)!=null}get href(){return(function(t){let n=`${t.scheme}:`;return t.host!==null&&(n+="//",(t.username!==""||t.password!=="")&&(n+=t.username,t.password!==""&&(n+=`:${t.password}`),n+="@"),n+=t.host,t.port!==null&&(n+=`:${t.port}`)),t.host===null&&!t.opaquePath&&t.path.length>1&&t.path[0]===""&&(n+="/."),n+=TA(t),t.query!==null&&(n+=`?${t.query}`),t.fragment!==null&&(n+=`#${t.fragment}`),n})(this[b].url)}set href(e){let t=B(e=S(e),null,null,0);if(t==null)throw new TypeError(`Invalid URL: ${e}`);this[b].url=t,this[b].query&&yA(this[b].query,t.query)}get origin(){return fe(this[b].url)}get protocol(){return`${this[b].url.scheme}:`}set protocol(e){B(`${e=S(e)}:`,this[b].url,null,2)}get username(){return this[b].url.username}set username(e){e=S(e),mA(this[b].url)||(function(n,r){n.username=_(r,cA)})(this[b].url,e)}get password(){return this[b].url.password}set password(e){e=S(e),mA(this[b].url)||(function(n,r){n.password=_(r,cA)})(this[b].url,e)}get host(){let{url:e}=this[b];return e.host==null?"":e.port==null?e.host:`${e.host}:${e.port}`}set host(e){e=S(e),this[b].url.opaquePath||B(e,this[b].url,null,3)}get hostname(){let{url:e}=this[b];return e.host!=null?e.host:""}set hostname(e){e=S(e),this[b].url.opaquePath||B(e,this[b].url,null,4)}get port(){let{url:e}=this[b];return e.port!=null?`${e.port}`:""}set port(e){e=S(e);let{url:t}=this[b];mA(t)||(e?B(e,t,null,5):t.port=null)}get pathname(){return TA(this[b].url)}set pathname(e){e=S(e);let{url:t}=this[b];t.opaquePath||(t.path=[],B(e,t,null,6))}get search(){let{url:e}=this[b];return e.query?`?${e.query}`:""}set search(e){e=S(e);let{url:t,query:n}=this[b];if(!e)t.query=null,n&&yA(n,null);else{let r=e[0]==="?"?e.substring(1):e;t.query="",B(r,t,null,7),n&&yA(n,t.query)}}get searchParams(){let e=this[b],t=e.query;return t==null&&(t=e.query=(function(r,u){let l=new fA;return l[C].url=r,l[C].serialized=u==null,u&&(l[C].list=NA(u)),l})(this,e.url.query)),t}get hash(){let{url:e}=this[b];return e.fragment?`#${e.fragment}`:""}set hash(e){e=S(e);let{url:t}=this[b];if(!e)t.fragment=null;else{let n=e[0]==="#"?e.substring(1):e;t.fragment="",B(n,t,null,8)}}toJSON(){return this.href}toString(){return this.href}};Object.defineProperty(eA.prototype,Symbol.toStringTag,{value:"URL",configurable:!0});var C=Symbol("URLSearchParamsImpl"),Je=Symbol.dispose||Symbol.for("dispose");function yA(A,e){e?A[C].list=NA(e):A[C].list.length=0,A[C].serialized=e==null}function oA(A){if(A.url){let e=CA(A.list);(function(n,r){n[b].url.query=r})(A.url,e||null),A.serialized=!0}}var We=typeof Iterator<"u"?Iterator:Object,Z=class extends We{constructor(e,t){super(),this[C]={ptr:e,map:t,index:0}}next(){let e=this[C];return e.index<e.ptr.list.length?{value:e.map(e.ptr.list[e.index++]),done:!1}:{value:void 0,done:!0}}[Symbol.iterator](){return this}[Je](){}},fA=class{constructor(e){let t=this[C]={list:[],url:null,serialized:!0},n;if(Array.isArray(e))for(let r=0;r<e.length;r++)t.list.push(QA(e[r]));else if((n=ZA(e))!=null){let r;for(;!(r=PA(n.next())).done;)t.list.push(QA(r.value))}else if((typeof e=="object"||typeof e=="function")&&e!=null){let r=Object.keys(e);for(let u=0;u<r.length;u++){let l=r[u],a=Pe(l),f=S(e[l]),h=t.list.find(w=>w[0]===a);h?h[1]=f:t.list.push([a,f])}}else if(e!==void 0){let r=S(e);r=r[0]==="?"?r.substring(1):r,t.list=NA(r)}}get size(){return this[C].list.length}append(e,t){e=S(e),t=S(t),this[C].list.push([e,t]);let n=this[C];n.url&&n.serialized?(function(u,l){let a=u[b].url;a.query=a.query?`${a.query}&${l}`:l})(n.url,CA([[e,t]])):oA(n)}delete(e,t){e=S(e),t=t!=null?S(t):void 0;let{list:n}=this[C],r=0;for(;r<n.length;)n[r][0]===e&&(t==null||n[r][1]===t)?n.splice(r,1):r++;oA(this[C])}get(e){e=S(e);let{list:t}=this[C];for(let n=0;n<t.length;n++)if(t[n][0]===e)return t[n][1];return null}getAll(e){e=S(e);let t=[],{list:n}=this[C];for(let r=0;r<n.length;r++)n[r][0]===e&&t.push(n[r][1]);return t}has(e,t){e=S(e),t=t!=null?S(t):void 0;let{list:n}=this[C];for(let r=0;r<n.length;r++)if(n[r][0]===e&&(t==null||n[r][1]===t))return!0;return!1}set(e,t){e=S(e),t=S(t);let{list:n}=this[C],r=!1,u=!1,l=0;for(;l<n.length;)n[l][0]===e?r?(n.splice(l,1),u=!0):(r=!0,n[l][1]!==t&&(n[l][1]=t,u=!0),l++):l++;r||(n.push([e,t]),u=!0),u&&oA(this[C])}sort(){this[C].list.sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0),oA(this[C])}forEach(e,t){if(typeof e!="function")throw new TypeError('The "callback" argument must be of type function');let{list:n}=this[C];for(let r=0;r<n.length;r++)e.call(t,n[r][1],n[r][0],this)}entries(){return new Z(this[C],e=>e)}keys(){return new Z(this[C],e=>e[0])}values(){return new Z(this[C],e=>e[1])}toString(){return CA(this[C].list)}[Symbol.iterator](){return this.entries()}};Object.defineProperty(fA.prototype,Symbol.toStringTag,{value:"URLSearchParams",configurable:!0});function he(A){let e,t=()=>typeof e=="string"?e:e?.accessToken,n=0,r,u=new Map,l=()=>{for(let p of[...u.keys()])try{p()}catch{}};function a(p){let m=++n;r=void 0,e=void 0;for(let y of[...u.values()])try{y?.()}catch{}m===n&&(e=p,l())}let f=()=>a();function h(p,m=!1){let y=$A.safeParse(p);if(!y.success||m&&Date.parse(y.data.expiresAt)<=Date.now()||Date.parse(y.data.refreshExpiresAt)<=Date.now()||Date.parse(y.data.refreshExpiresAt)<Date.parse(y.data.expiresAt))throw new P("INVALID_RESPONSE","Invalid customer session credentials");return y.data}async function w(){if(r)return r;let p=typeof e=="object"?e:void 0,m=n;if(!p||Date.parse(p.refreshExpiresAt)<=Date.now())throw p&&f(),new P("UNAUTHENTICATED","Customer authentication is required",401);let y=(async()=>{try{let N=await A(p.refreshToken);if(m!==n)throw new P("IDENTITY_CHANGED","Customer identity changed during refresh");let V=h(N,!0);if(V.customerId!==p.customerId||V.sessionId!==p.sessionId)throw new P("SCOPE_MISMATCH","Refresh changed the customer session");return e=V,{...V}}catch(N){throw m!==n?new P("IDENTITY_CHANGED","Customer identity changed during refresh"):(N instanceof P&&N.status===401&&f(),N)}})();r=y;try{return await y}finally{r===y&&(r=void 0)}}return{identify(p){let m=typeof p=="string"?p:h(p),y=typeof m=="string"?m:m.accessToken;if(!y.trim()||/\s/.test(y)||y.length>4096)throw new P("INVALID_TOKEN","A server-issued token is required");a(m)},reset:f,subscribeIdentity(p,m){return u.set(p,m),()=>{u.delete(p)}},access(){let p=typeof e=="object"?e:void 0;if(p&&Date.parse(p.expiresAt)<=Date.now()+3e4){let y=n;return w().then(()=>{let N=t();if(y!==n||!N)throw new P("IDENTITY_CHANGED","Customer identity changed during refresh");return N})}let m=t();if(!m)throw new P("NOT_IDENTIFIED","Identify a customer session before making a request");return m},peek:t,snapshot:()=>typeof e=="object"?{...e}:void 0,refresh:w}}var de=Symbol("IndianaNoContent");function ut(A,e,t=eA){let n=A.configuration?.scope,r=A.scope??(n&&{projectId:n.projectId,environment:n.environment}),u=r?sA.parse(r):void 0;if(u&&n&&(u.projectId!==n.projectId||u.environment!==n.environment))throw new P("SCOPE_MISMATCH","Configuration belongs to another App/environment");let l=new t(A.baseUrl??FA);if(l.username||l.password||l.search||l.hash)throw new P("INVALID_URL","baseUrl must not contain credentials, query, or fragment");if(l.protocol!=="https:"&&!(l.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(l.hostname)))throw new P("INVALID_URL","Use HTTPS, or HTTP on localhost during development");let a=A.fetch??globalThis.fetch.bind(globalThis),f=A.timeoutMs??1e4;if(!Number.isFinite(f)||f<1||f>12e4)throw new P("INVALID_TIMEOUT","timeoutMs must be between 1 and 120000");let h=!1,w=0,p=null,m=new Set,y=A.session??he(async q=>{let O=await tA("customer-sessions/refresh",{},"POST",{},q);if(!O||typeof O!="object")throw new P("INVALID_RESPONSE","Invalid refresh response");let{requestId:$,scope:H,...K}=O;return K});function N(){w+=1,p=null;for(let q of m)q.abort();m.clear()}let V=y.subscribeIdentity(N);function pe(){h||y.reset()}async function tA(q,O={},$="POST",H={},K){let k=H.installationDetach===!0;if(k&&(q!=="push/installations/detach"||$!=="POST"))throw new P("INVALID_REQUEST","Installation authority only detaches this installation");if(!K&&!k)throw new P("NOT_IDENTIFIED","Call identify with a server-issued customer token first");let J=w,L=new AbortController;k||m.add(L);let nA=()=>!k&&J!==w?new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):new P("TIMEOUT","Longplay request timed out"),dA,ge=new Promise((T,R)=>{dA=()=>R(nA()),L.signal.addEventListener("abort",dA,{once:!0})}),we=setTimeout(()=>L.abort(),H.timeoutMs??f),me=async()=>{let T=await a(`${l.href.replace(/\/$/,"")}/api/v1/${q}`,{method:$,headers:{...H.headers,"Content-Type":"application/json",...k?{}:{Authorization:`Bearer ${K}`},[pA]:gA.current,[xA]:zA.version,...u?{"X-Indiana-Project":u.projectId,"X-Indiana-Environment":u.environment}:{}},body:$==="POST"?JSON.stringify(O):void 0,signal:L.signal,credentials:"omit",cache:"no-store",redirect:"error",...H.keepalive?{keepalive:!0}:{}});if(L.signal.aborted)throw nA();let R;try{R=T.status===204?de:await T.json()}catch{throw L.signal.aborted?nA():new P(T.ok?"INVALID_RESPONSE":"HTTP_ERROR","The gateway returned an unreadable response",T.status,T.headers.get("X-Request-Id")??void 0)}if(L.signal.aborted)throw nA();if(!k&&J!==w)throw new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight");if(!T.ok){let v=UA.safeParse(R),z=v.success&&(!MA.safeParse(v.data.error.code).success||jA(v.data.error.code,T.status)),BA=z?v.data.error.code:"HTTP_ERROR",HA=_A(BA,T.status,{retryAfter:T.headers.get("Retry-After"),recovery:z?v.data.error.recovery:void 0,reason:z?v.data.error.reason:void 0});throw new P(BA,z?v.data.error.message:"Longplay request failed",T.status,T.headers.get("X-Request-Id")??(v.success?v.data.requestId:void 0),{...HA,...v.success&&v.data.error.retryable===!1?{retryable:!1}:{},...HA.retryAfterSeconds===void 0&&v.success&&v.data.error.retryAfterSeconds!==void 0?{retryAfterSeconds:v.data.error.retryAfterSeconds}:{}})}if(T.headers.get(pA)!==gA.current)throw new P("PROTOCOL_MISMATCH","Response protocol does not match this SDK");if(u&&R!==de){let v=R&&typeof R=="object"&&"scope"in R?R:R&&typeof R=="object"&&"configuration"in R?R.configuration:null;if(!v||typeof v!="object"||!("scope"in v))throw new P("INVALID_RESPONSE","Response is missing its App/environment scope");let z=sA.safeParse(v.scope);if(!z.success||z.data.projectId!==u.projectId||z.data.environment!==u.environment)throw new P("SCOPE_MISMATCH","Response scope does not match this SDK instance")}let rA=T.headers.get("X-Indiana-Telemetry-Subject");if(rA){if(!/^[a-f0-9]{64}$/.test(rA))throw new P("INVALID_RESPONSE","Invalid telemetry identity");p!==rA&&(p=rA,e?.(p))}return R};try{return await Promise.race([me(),ge])}catch(T){throw!k&&J!==w?new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):T instanceof P?T:new P(L.signal.aborted?"TIMEOUT":"NETWORK_ERROR",L.signal.aborted?"Longplay request timed out":"Unable to read the Longplay response")}finally{clearTimeout(we),L.signal.removeEventListener("abort",dA),m.delete(L)}}return{session:y,requestWithCredential(q,O,$,H={}){return h?Promise.reject(new P("CLOSED","SDK client was destroyed")):tA(q,O,"POST",H,$)},subjectKey:()=>p,identify(q){if(h)throw new P("CLOSED","SDK client was destroyed");if(u&&typeof q=="object"&&"scope"in q){let O=sA.safeParse(q.scope);if(!O.success||O.data.projectId!==u.projectId||O.data.environment!==u.environment)throw new P("SCOPE_MISMATCH","Customer session belongs to another App/environment")}y.identify(q)},reset:pe,dispose(){h||(h=!0,V(),N())},request(q,O={},$="POST",H={}){if(h)return Promise.reject(new P("CLOSED","SDK client was destroyed"));if(H.installationDetach)return tA(q,O,$,H);let K=w;try{let k=y.access(),J=L=>{if(K!==w)throw new P("IDENTITY_CHANGED","Customer identity changed before dispatch");return tA(q,O,$,H,L)};return typeof k=="string"?J(k):k.then(J)}catch(k){return Promise.reject(k)}}}}export{eA as a,ut as b};
1
+ import{a as P}from"./chunk-KHIQQNTR.js";import{g as pA,h as xA,i as gA,jb as zA,kb as FA,r as $A}from"./chunk-GSFNAB3W.js";import{a as sA,b as MA,e as jA,f as UA,g as _A}from"./chunk-4SWGHICJ.js";function S(A){return typeof A=="string"?A:String(A)}var ye=/[\ud800-\udbff](?![\udc00-\udfff])|(^|[^\ud800-\udbff])[\udc00-\udfff]/g;function Pe(A){return A.replace(ye,"$1\uFFFD")}function PA(A,e){if(typeof A!="object"||A==null){let t="";throw t+="The provided value is not an object",new TypeError(t)}return A}function ZA(A){if(A!=null&&(typeof A=="object"||typeof A=="function")){let e=A[Symbol.iterator];if(e==null)return;if(typeof e!="function")throw new TypeError("The provided value is not iterable");let t=e.call(A);if(!t||typeof t!="object")throw new TypeError("Result of the Symbol.iterator method is not an object");return t}}function QA(A){let e;if(Array.isArray(A)){let t=A.map(S);if(t.length===2)return t}else if((e=ZA(A))!=null){let t=PA(e.next()),n=PA(e.next());if(!t.done&&!n.done)return[S(t.value),S(n.value)]}throw new TypeError("Each query pair must be an iterable [name, value] tuple")}var GA="0123456789ABCDEF",De=/(?:%[0-9A-Fa-f]{2})+/g;function U(A){return`%${GA[A>>4&15]}${GA[15&A]}`}function Ae(A,e,t=!1){return A>=55296&&A<=57343&&(A=65533),A<=127?t&&A===32?"+":e(A)?U(A):String.fromCharCode(A):A<=2047?U(192|A>>6)+U(128|63&A):A<=65535?U(224|A>>12)+U(128|A>>6&63)+U(128|63&A):U(240|A>>18)+U(128|A>>12&63)+U(128|A>>6&63)+U(128|63&A)}function DA(A){return A>=48&&A<=57?A-48:A>=65&&A<=70?A-65+10:A>=97&&A<=102?A-97+10:-1}function bA(A,e=!1){let t=0;for(;t<A.length;t++){let n=A.charCodeAt(t);if(n===37||e&&n===43)break}return t===A.length?A:(e?A.replace(/\+/g," "):A).replace(De,n=>{try{return decodeURIComponent(n)}catch{return"\uFFFD".repeat(n.length/3)}})}function AA(A){return A<=31||A>126}function be(A){switch(A){case 32:case 34:case 60:case 62:case 96:return!0;default:return AA(A)}}function qA(A){switch(A){case 32:case 34:case 35:case 60:case 62:return!0;default:return AA(A)}}function Se(A){return qA(A)||A===39}function SA(A){switch(A){case 63:case 94:case 96:case 123:case 125:return!0;default:return qA(A)}}function cA(A){switch(A){case 47:case 58:case 59:case 61:case 64:case 91:case 92:case 93:case 124:return!0;default:return SA(A)}}function YA(A){switch(A){case 33:case 39:case 40:case 41:case 126:return!0;default:return(function(t){switch(t){case 36:case 37:case 38:case 43:case 44:return!0;default:return cA(t)}})(A)}}function ee(A,e){return Ae(A=A||0,e)}function _(A,e,t=!1){let n=0;for(;n<A.length;n++){let u=A.charCodeAt(n);if(u>=128||t&&u===32||e(u))break}if(n===A.length)return A;let r=A.slice(0,n);for(;n<A.length;n++){let u=A.charCodeAt(n),l=u;if(u>=55296&&u<=56319&&n+1<A.length){let a=A.charCodeAt(n+1);a>=56320&&a<=57343&&(l=(u-55296<<10)+a-56320+65536,n++)}r+=Ae(l,e,t)}return r}function NA(A){let e=[],t=0,n=0;for(;n<=A.length;){if(n=A.indexOf("&",t),n<0&&(n=A.length),n!==t){let r=A.slice(t,n),u=r.indexOf("=");u<0&&(u=r.length),e.push([bA(r.slice(0,u),!0),bA(r.slice(u+1),!0)])}if(t=n+1,n===A.length)break}return e}function CA(A){let e="";for(let t=0;t<A.length;t++){let n=_(A[t][0],YA,!0),r=_(A[t][1],YA,!0);e+=t!==0?`&${n}=${r}`:`${n}=${r}`}return e}var Ce=[2191,2191,3164,3164,3292,3292,6863,6877,6880,6891,8385,8385,11158,11158,42958,42959,42962,42962,42964,42964,42993,42993,64451,64466,64912,64913,64968,64974,67904,67929,69317,69319,69328,69336,69370,69371,72544,72551,73136,73179,73184,73193,93856,93880,93883,93907,94194,94198,100344,100351,101641,101662,101760,101874,118010,118012,118458,118480,118496,118512,124608,124638,124640,124661,124670,124671,128728,128728,128887,128890,129232,129240,129620,129623,129674,129674,129678,129678,129736,129736,129741,129741,129770,129770,129775,129775,130042,130042,177978,177983,183970,183981,205744,210041],Ie=[7296,7297,7298,7299,7300,7301,7302,7303,7304,42958,42962,42964,42993],Ee=["\u0432","\u0434","\u043E","\u0441","\u0442","\u0442","\u044A","\u0463","\uA64B","\uA7CF","\uA7D3","\uA7D5","s"],ve=[2381,2381,2509,2509,2637,2637,2765,2765,2893,2893,3021,3021,3149,3149,3277,3277,3387,3388,3405,3405,3530,3530,3642,3642,3770,3770,3972,3972,4153,4154,5908,5909,5940,5940,6098,6098,6752,6752,6980,6980,7082,7083,7154,7155,11647,11647,43014,43014,43052,43052,43204,43204,43347,43347,43456,43456,43766,43766,44013,44013,68159,68159,69702,69702,69744,69744,69759,69759,69817,69817,69939,69940,70080,70080,70197,70197,70378,70378,70477,70477,70606,70608,70722,70722,70850,70850,71103,71103,71231,71231,71350,71350,71467,71467,71737,71737,71997,71998,72160,72160,72244,72244,72263,72263,72345,72345,72767,72767,73028,73029,73111,73111,73537,73538,90415,90415];function Te(A){for(let e=0;e<A.length;e++){let t=A.codePointAt(e);if(t>65535&&e++,t<=32||t===37||t===127||t>=55296&&t<=57343||t>=128&&t<=159||t>=64976&&t<=65007||!(65534&~t)||t===65533)return!0}return!1}var[qe,Ne,Oe,VA]=[[[],"0,6,7,8,m,w,10,1b,1d,1f,72,73,7k,8k,dt,2rk","AAAAAAAAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAA/AAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAADAAABwfwAAAAAAAMADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAQAAAAAAAAQCAAABAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgACAAAAAAAAAAAAAAAAD//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAP///////////////wAAAAAAAAAAAAAAAAAAAAA="],[[],"6,7,8,o,4o,7e,7f,7h,7i,7j,dl","AAAAAEF9+P/+BwAAAMAA//8AAPz/////BlADAAAAAJwAAPz///8AAADA//H/5+X8AAAAAAAAAAAA/P///wcAAAAAAAAAAAAAPv0vAD0BAABA/gAA/5/5/f8BAAAAAAAAgAAAAP//////////////AYD/////BQAAAAAAAAAAAAAAAAAAAAAAAP///////wcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8g+N8B+AAAAAAAAAAAAAAAAAAAAAAAAP//AwAAYAAAAAAAAAAAAAD/////CwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANgAAAAAAAAAAAAAAAAA//8fAB4AAAD//wMAAAAAAH3/HgwAAAAAAAD//////////w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],[[],"6,7,8,o,4o,7e,7f,7h,7i,7j,dl","AAAAAP3////+BwAAAMDu//////////////8vAADAAJwAAP3///8AAADg////////AAAAAAAAAAAA/P///wcAAAAAAAAAAAAA////Ab0H//9H/gAA/9////8BAAAAAAAAgAAAAP//////////////AYD/////BQAAAAAAAAAAAAAAAAAAAAAAAP///////wcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL/G//8T+AAAAAAAAAAAAAAAAAAAAAAAAP//AwAAfgAAAAAAAAAAAAD+////DwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANwAAAAAAAAAAAAAAAAA//8fAB4AAAD//wMAAAAAAH3/Hg4AAAAAAAD//////////w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],[[],"0,3,4,5,6,7,8,9,a,b,c,d,e,f,g,j,n,o,p,q,r,s,t,w,18,19,1c,4m,4o,4p,4q,4r,6z,72,73,75,76,77,7e,7h,7i,7j,7k,7l,7m,7n,7o,7p,7q,7r,7s,7t,7u,7v,7w,7x,7y,7z,8k,9t,a2,a3,a7,cc,cv,cx,cy,d6,dc,dd,de,dg,dh,di,dk,dl,2rk,2rl","AAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAD//////////////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/v////+/tgAAAAAAAAAAAP8XAAAAAAD4//8AAAEAAAAAAAAAAAAAAMCfnz0AAACAAgAAAP///wcAAAAAAAAAAAAAwP8BAAAAAAAA+A8gAADA++8+AAAAAAAOAAAAAAAAgP8AAAAAAPz///v///8HAAAAAAAAFP4h/gAMAAAAAgAAAAAAABAeIAAADAAAQAYAAAAAAAAQhjkCAAAAIwAGAAAAAAAAEL4hAAAMAAD8AgAAAAAAAJAeIGAADAAAAAQAAAAAAAAAASAAAAAAAAARAAAAAAAA0ME9YAAMAAAAAgAAAAAAAJBAMAAADAAAAAMAAAAAAAAYHiAAAAwAAAACAAAAAAAAAAAEXAAAAAAAAAAAAAAA8geAfwAAAAAAAAAAAAAAAPIfAH8AAAAAAAAAAAADAACgAgAAAAAAAP5/3+D//v///x9AAAAAAAAAAAAAAAAA4P1mAAAAwwEAHgBkIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAMAAAADAAAAAwAAAAAAAAAsD9A/g8gAAAAAAC4AAAAAAAAAAAAAAAAAABgAAAAAAIAAAAAAAAAAAAAAAAAAIcBBA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAJAAAAAAAAQH/lH/ifAAAAAAAA//////8//w8AAA8AAAAAANAXBAAAAAD4DwADAAAAPDsAAAAAAABAowMAAAAAAADwzwAAAAAAAAAAAAAAAAAAAAAAAAD3//0hEAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wDIAAAAfAAAAAAAAB/8AAAAAAAAAAAAAAAA/////wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAwAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAA/////wAAAAAAPAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAID3PwAAAMAAAAAAAAAAAAAAAwBECAAAYBAAAAAAAAAAAAAAAAAAAAAAAAAwAAAA//8DgAAAAADAPwAAgP8DAAAAAAAHAAAAAADIMwAAAAAgAAAAAAAAAAB+ZgAIEAAAAAAAEAAAAAAAAJ3BAgAAAAAwQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAICEAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAP//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAMAHAAAAAAAAAAAAAAAAAAAAAG7wAAAAAACHAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAPAAAAAAAAAAAD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAA/AAAAAAAAAAAwP8BAAAAAAA8AAAAAAAAAAAAAAAAAAAAAgAAAAAAAP9/AAAAAAAZgAMAAAAAAHgGBAAAAAAAAAAHAAAAgO8fAAAAAAAAAAgAAwAAAAAAwH8AngAAAAAAAAAAAAAAgNNAAgAAAAAAAAAAAAAAAAAAAAAAAID4BwAAAwAAAAAAABgBAAAAwB8fAAAAAAAAAAD4AUAFAAYAAAAAAAAAAAAA/1wAAEAAAAAAAAAAAAAA+IUNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8sAEAADAAAAAAAAAAAAAA+KcBAAAAAAAAAAAAAAAAKL8AAAAAAAAAAAAAAACgvA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgP8GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFgIAAAAAAAAAAAAAAAAAAAAAADwDAEAAAD+BwAAAAD4eYAAfg4AAAAAAPx/AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAF0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf78AAAAAAAAAAAAA/P///G0AAAAAAAAAAAAAAAAAAAB+tL8AAAAAAAAAAACjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAwAAAAAAwAcFAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//4H/PwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMD/4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwAAAAAAAAB/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAcAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAPAAAAAAAAAAAAAAD//////z///38AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAD+P/nDwAAADwAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////9/+P//////HyAAEAAA+P7/AAAAAAAAAAAAAH////nbBwAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAfwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASMAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfwAAAAAAAAAAAAAAAADwDwAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAA////////////////AAAAAAAAAAAAAAAAAAAAAP///////////////////////////////////////wAA"]].map(function([e,t,n]){return[e,t.split(",").map(r=>parseInt(r,36)),Uint8Array.from(atob(n),r=>r.charCodeAt(0))]});function Re(A,e){return e===931||e===1010||e===120531||e===120589||e===120647||e===120705||e===120763?"\u03C3":e>=5112&&e<=5117?String.fromCodePoint(e-8):e>=43888&&e<=43967?String.fromCodePoint(e-38864):e>=93856&&e<=93880?String.fromCodePoint(e+27):e===837||e===890||e>=8064&&e<=8111||e>=8114&&e<=8188?A.normalize("NFD").replace(/\u0345/g,"\u03B9").normalize("NFC").toLowerCase():""}function te(A,e){for(let t=0;t<A.length;t+=2)if(e>=A[t]&&e<=A[t+1])return!0;return!1}function X(A,e){let[t,n,r]=A,u=e>>8;for(let f=0;f<t.length;f+=2)if(u>=t[f]&&u<=t[f+1])return!0;let l=n.indexOf(u);if(l<0)return!1;let a=255&e;return!!(r[32*l+(a>>3)]&1<<(7&a))}function ke(A){let e=Array.from(A,t=>t.codePointAt(0));for(let t=0;t<e.length;t++){let n=e[t];if(n!==8204&&n!==8205||t>0&&te(ve,e[t-1]))continue;if(n===8205)return!1;let r=t-1;for(;r>=0&&X(VA,e[r]);)r--;let u=t+1;for(;u<e.length&&X(VA,e[u]);)u++;if(!(r>=0&&u<e.length&&X(Ne,e[r])&&X(Oe,e[u])))return!1}return!0}var Le=/(?![\p{Mark}\p{Decimal_Number}])[\p{Script=Arabic}\p{Script=Hebrew}]/u,Be=/\p{Script=Latin}/u;function He(A){return!Le.test(A)||!Be.test(A)}var F=36,iA=1,IA=26,Me=38,je=700,Ue=72,_e=128,xe=2147483647;function KA(A){return String.fromCharCode(A+22+75*+(A<26))}function $e(A,e,t){let n=0;for(A=t?Math.floor(A/je):A>>1,A+=Math.floor(A/e);A>(F-iA)*IA>>1;n+=F)A=Math.floor(A/(F-iA));return Math.floor(n+(F-iA+1)*A/(A+Me))}function ze(A){let e=Array.from(A,f=>f.codePointAt(0)),t="",n=0;for(let f=0;f<e.length;f++){let h=e[f];h<128&&(t+=String.fromCharCode(h),n++)}let r=n;r&&(t+="-");let u=_e,l=0,a=Ue;for(;n<e.length;){let f=xe;for(let h=0;h<e.length;h++){let w=e[h];w>=u&&w<f&&(f=w)}l+=(f-u)*(n+1),u=f;for(let h=0;h<e.length;h++){let w=e[h];if(w<u&&l++,w===u){let p=l;for(let m=F;;m+=F){let y=m<=a?iA:m>=a+IA?IA:m-a;if(p<y)break;t+=KA(y+(p-y)%(F-y)),p=Math.floor((p-y)/(F-y))}t+=KA(p),a=$e(l,n+1,n===r),l=0,n++}}l++,u++}return t}function wA(A){let e=10;if(A.length>=2&&A[0]==="0"&&(A[1]==="x"||A[1]==="X"))A=A.slice(2),e=16;else if(A.length>=2&&A[0]==="0")A=A.slice(1),e=8;else if(A==="")return-1;let t=0;for(let n=0;n<A.length;n++){let r=DA(A.charCodeAt(n));if(r>=e||r<0)return-1;t=t*e+r}return t}function JA(A){switch(A){case".":case"%2e":case"%2E":return!0;default:return!1}}function ne(A,e){return(A>=65&&A<=90||A>=97&&A<=122)&&(e===58||e===124)}function re(A){return A.length===2&&ne(A.codePointAt(0),A.codePointAt(1))}function WA(A){return A.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u)!==-1}function I(A){switch(A){case"ftp":case"http":case"https":case"ws":case"wss":case"file":return!0;default:return!1}}function se(A){switch(A){case"ftp":return 21;case"http":case"ws":return 80;case"https":case"wss":return 443;default:return null}}function EA(A,e){if(A[0]==="[")return A[A.length-1]==="]"?(function(n){let r=[0,0,0,0,0,0,0,0],u=null,l=0,a=0,f=Array.from(n,h=>h.codePointAt(0));if(f[a]===58){if(f[a+1]!==58)return null;a+=2,l++,u=l}for(;a<f.length;){if(l===8)return null;if(f[a]===58){if(u!==null)return null;a++,l++,u=l;continue}let h=0,w=0,p=0;for(;p<4&&(h=DA(f[a]))>=0;)w=(w<<4)+h,a++,p++;if(f[a]===46){if(p===0||l>6)return null;a-=p;let m=0;for(;f[a]!==void 0;){let y=0;if(m>0)if(f[a]===46&&m<4)a++;else return null;if(f[a]==null||f[a]<48||f[a]>57)return null;for(;f[a]>=48&&f[a]<=57;){if(y=10*y+DA(f[a]),y>255)return null;a++}r[l]=256*r[l]+y,m++,m%2==0&&l++}if(m!==4)return null;break}else if(f[a]===58){if(f[++a]===void 0)return null}else if(f[a]!==void 0)return null;r[l]=w,l++}if(u!==null){let h=l-u;for(l=7;l!==0&&h>0;){let w=r[u+h-1];r[u+h-1]=r[l],r[l]=w,l--,h--}}else if(u===null&&l!==8)return null;return r})(A.substring(1,A.length-1)):null;if(e)return(function(n){return WA(n)?null:_(n,AA)})(A);{let t=(function(r){let u=!1,l=!1;for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h<=32||h===37||h===127)return null;if(h>=128){u=!0;break}h>=65&&h<=90&&(l=!0)}if(!u)return r!==""?l?r.toLowerCase():r:null;if((function(h){for(let w of h){let p=w.codePointAt(0);if(/[\p{Cn}\p{Co}\p{Cs}\p{Noncharacter_Code_Point}]/u.test(w)&&!te(Ce,p)||X(qe,p))return!0}return!1})(r))return null;let a=(r=(function(h){let w="";for(let p of h){let m=p.codePointAt(0);if(m!==8204&&m!==8205&&/\p{Default_Ignorable_Code_Point}/u.test(p))continue;let y=Re(p,m);if(y){w+=y;continue}let N=Ie.indexOf(m);w+=N<0?p:Ee[N]}return w})(r).normalize("NFKC").replace(/[\u3002\uff0e\uff61]/g,".").toLowerCase()).split(".");for(let f=0;f<a.length;f++){let h=a[f];if(h==="")continue;let w=/[^\0-\x7f]/.test(h);if(Te(h)||w&&(/^\p{Mark}/u.test(h)||!ke(h)||!He(h)||h.startsWith("xn--")))return null;w&&(a[f]=`xn--${ze(h)}`)}return(r=a.join("."))!==""?r:null})(A.indexOf("%")===-1?A:bA(A));return t===null||WA(t)?null:(function(r){let u=r.length,l=r.lastIndexOf(".",u-2)+1;if(r.charCodeAt(u-1)===46&&u--,u<=l)return!1;if(wA(r.slice(l,u))>=0)return!0;for(;l<u;l++){let a=r.charCodeAt(l);if(a<48||a>57)return!1}return!0})(t)?(function(r){let u=r.split("."),l=u.length;if(u[l-1]||l--,l>4)return null;let a=0;for(let h=0;h<l-1;h++){let w=wA(u[h]);if(w<0||w>255)return null;a+=w*(1<<8*(3-h))}let f=wA(u[l-1]);return f<0||f>=256**(5-l)?null:(a+=f,a)})(t):t}}function vA(A){return typeof A=="number"?(function(t){let r="";return r+=`${(t>>>24&255).toString(10)}.`,r+=`${(t>>>16&255).toString(10)}.`,r+=`${(t>>>8&255).toString(10)}.`,r+=(t&255).toString(10),r})(A):Array.isArray(A)?`[${(function(t){let n=(function(a){let f=-1,h=-1,w=1,p=0;for(let m=0;m<a.length;++m)a[m]!==0?(p>w&&(f=h,w=p),h=-1,p=0):(h===-1&&(h=m),++p);return p>w?h:f})(t),r="",u=!1;for(let l=0;l<=7;++l)if(!(u&&t[l]===0)){if(u&&(u=!1),n===l){r+=l===0?"::":":",u=!0;continue}r+=t[l].toString(16),l!==7&&(r+=":")}return r})(A)}]`:A}function oe(A){A.path.length>0&&(A.path.length!==1||A.scheme!=="file"||!(function(t){return/^[A-Za-z]:$/u.test(t)})(A.path[0]))&&A.path.pop()}function ie(A){return A.username!==""||A.password!==""}function mA(A){return A.host===null||A.host===""||A.scheme==="file"}var s=0,o="",g="",D=null,i,lA=!1,uA=!1,G=!1,E;function B(A,e,t,n){e||(A=(function(l){let a=0,f=l.length;for(;a<f&&!(l.charCodeAt(a)>32);++a);for(;f>a&&!(l.charCodeAt(f-1)>32);--f);return l.substring(a,f)})(A)),A=(function(l){let a=0;for(;a<l.length;a++){let h=l.charCodeAt(a);if(h===9||h===10||h===13)break}if(a===l.length)return l;let f=l.slice(0,a);for(;a<l.length;a++){let h=l.charCodeAt(a);h!==9&&h!==10&&h!==13&&(f+=l[a])}return f})(A),s=0,o=A,g="",D=t||null,i=e||{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,opaquePath:!1},lA=!1,uA=!1,G=!1,E=n||0;let r=Fe;switch(n){case 3:case 4:r=aA;break;case 5:r=RA;break;case 6:r=Y;break;case 7:r=Q;break;case 8:r=x}return r(c(A,s))!==1?i:null}function d(A,e){return s+=s===A?M(e):1,s<=o.length}function c(A,e){return e<A.length?A.codePointAt(e):void 0}function M(A){return A!=null&&A>65535?2:1}function le(A){return A==null?"":A<=65535?String.fromCharCode(A):String.fromCodePoint(A)}var Fe=A=>{let e=s;if(A!=null&&(A>=65&&A<=90||A>=97&&A<=122)){let t=s+1;for(A=o.charCodeAt(t);A===43||A===45||A===46||A>=65&&A<=90||A>=97&&A<=122||A>=48&&A<=57;)t++,A=o.charCodeAt(t);return g=o.slice(s,t).toLowerCase(),s=t,Qe(t<o.length?A:void 0)}else return E?1:(--s,d(e,A)?ue(c(o,s)):0)},Qe=A=>{let e=s;if(A===58){if(E){if(I(i.scheme)!==I(g))return 0;if((ie(i)||i.port!==null)&&g==="file")return 0;if(i.scheme==="file"&&i.host==="")return 0}return i.scheme=g,E?(i.port===se(i.scheme)&&(i.port=null),0):(g="",i.scheme==="file"?d(e,A)?kA(c(o,s)):0:I(i.scheme)&&D!==null&&D.scheme===i.scheme?d(e,A)?Ge(c(o,s)):0:I(i.scheme)?d(e,A)?Ve(c(o,s)):0:c(o,s+1)===47?(s++,d(e,A)?Ye(c(o,s)):0):(i.path=[""],i.opaquePath=!0,d(e,A)?ae(c(o,s)):0))}else return E?1:(g="",s=-1,d(e,A)?ue(c(o,s)):0)},ue=A=>{let e=s;return D===null||D.opaquePath&&A!==35?1:D.opaquePath&&A===35?(i.scheme=D.scheme,i.path=D.path.slice(),i.opaquePath=D.opaquePath,i.query=D.query,i.fragment="",d(e,A)?x(c(o,s)):0):D.scheme==="file"?(s--,d(e,A)?kA(c(o,s)):0):(s--,d(e,A)?OA(c(o,s)):0)},Ge=A=>{let e=s;return A===47&&c(o,s+1)===47?(++s,d(e,A)?hA(c(o,s)):0):(s--,d(e,A)?OA(c(o,s)):0)},Ye=A=>{let e=s;return A===47?d(e,A)?W(c(o,s)):0:(s--,d(e,A)?j(c(o,s)):0)},OA=A=>{let e=s;return i.scheme=D.scheme,A===47||I(i.scheme)&&A===92?d(e,A)?XA(c(o,s)):0:(i.username=D.username,i.password=D.password,i.host=D.host,i.port=D.port,i.path=D.path.slice(),i.query=D.query,A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?x(c(o,s)):0):A!=null?(i.query=null,i.path.pop(),s--,d(e,A)?j(c(o,s)):0):d(e,A)?OA(c(o,s)):0)},XA=A=>{let e=s;return I(i.scheme)&&(A===47||A===92)?d(e,A)?hA(c(o,s)):0:A===47?d(e,A)?W(c(o,s)):0:(i.username=D.username,i.password=D.password,i.host=D.host,i.port=D.port,s--,d(e,A)?j(c(o,s)):0)},Ve=A=>{let e=s;return A===47&&c(o,s+1)===47?s++:s--,d(e,A)?hA(c(o,s)):0},hA=A=>{let e=s;return A!==47&&A!==92?(s--,d(e,A)?W(c(o,s)):0):d(e,A)?hA(c(o,s)):0},W=A=>{let e=s;if(A!=null&&A!==64&&A!==35&&A!==47&&A!==63&&(A!==92||!I(i.scheme))){let t=s+M(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===64||n===35||n===47||n===63||n===92&&I(i.scheme))break;t+=M(n)}return g+=o.slice(s,t),s=t-1,d(e,A)?W(c(o,s)):0}if(A===64){lA&&(g=`%40${g}`),lA=!0;for(let t=0;t<g.length;t++){let n=g.codePointAt(t);if(n===58&&!uA){uA=!0;continue}let r=ee(n,cA);uA?i.password+=r:i.username+=r,n!=null&&n>65535&&t++}return g="",d(e,A)?W(c(o,s)):0}else return A==null||A===35||A===47||A===63||A===92&&I(i.scheme)?lA&&g===""?1:(s-=g.length+1,g="",d(e,A)?aA(c(o,s)):0):(g+=le(A),d(e,A)?W(c(o,s)):0)},aA=A=>{let e=s;if(E&&i.scheme==="file")return s--,d(e,A)?LA(c(o,s)):0;if(A!=null&&A!==58&&A!==35&&A!==47&&A!==63&&(A!==92||!I(i.scheme))){let t=s+M(A);for(A===91?G=!0:A===93&&(G=!1);t<o.length;){let n=c(o,t);if(n==null||!G&&n===58||n===35||n===47||n===63||n===92&&I(i.scheme))break;n===91?G=!0:n===93&&(G=!1),t+=M(n)}return g+=o.slice(s,t),s=t-1,d(e,A)?aA(c(o,s)):0}else if(A===58&&!G){if(g===""||E===4)return 1;let t=EA(g,!I(i.scheme));return t===null?1:(i.host=vA(t),g="",d(e,A)?RA(c(o,s)):0)}else if(A==null||A===35||A===47||A===63||A===92&&I(i.scheme)){if(s--,I(i.scheme)&&g==="")return 1;if(E&&g===""&&(ie(i)||i.port!==null))return 1;let t=EA(g,!I(i.scheme));return t===null?1:(i.host=vA(t),g="",E?0:d(e,A)?Y(c(o,s)):0)}else return g+=le(A),d(e,A)?aA(c(o,s)):0},RA=A=>{let e=s;if(A!=null&&A>=48&&A<=57){let t=s+1;for(;t<o.length;){let n=o.charCodeAt(t);if(n<48||n>57)break;t++}return g+=o.slice(s,t),s=t-1,d(e,A)?RA(c(o,s)):0}else if(E||A==null||A===35||A===47||A===63||A===92&&I(i.scheme)){if(g!==""){let t=parseInt(g,10);if(t>65535)return 1;if(i.port=t===se(i.scheme)?null:t,g="",E)return 0}return E?1:(s--,d(e,A)?Y(c(o,s)):0)}else return 1};function ce(A,e){let t=A.length-e;if(t<2)return!1;if(ne(c(A,e),c(A,e+1))){if(t===2)return!0;{let n=c(A,e+2);return n===47||n===92||n===63||n===35}}else return!1}var kA=A=>{let e=s;return i.scheme="file",i.host="",A===47||A===92?d(e,A)?Ke(c(o,s)):0:D?.scheme==="file"?(i.host=D.host,i.path=D.path.slice(),i.opaquePath=D.opaquePath,i.query=D.query,A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?x(c(o,s)):0):A!=null?(i.query=null,ce(o,s)?i.path=[]:oe(i),s--,d(e,A)?j(c(o,s)):0):d(e,A)?kA(c(o,s)):0):(s--,d(e,A)?j(c(o,s)):0)},Ke=A=>{let e=s;return A===47||A===92?d(e,A)?LA(c(o,s)):0:(D!==null&&D.scheme==="file"&&(!ce(o,s)&&(function(n){if(n.length===2){let r=n.codePointAt(0),u=n.codePointAt(1);return(r>=65&&r<=90||r>=97&&r<=122)&&u===58}else return!1})(D.path[0])&&i.path.push(D.path[0]),i.host=D.host),s--,d(e,A)?j(c(o,s)):0)},LA=A=>{let e=s;if(A!=null&&A!==47&&A!==92&&A!==63&&A!==35){let t=s+M(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||n===92||n===63||n===35)break;t+=M(n)}return g+=o.slice(s,t),s=t-1,d(e,A)?LA(c(o,s)):0}else if(A==null||A===47||A===92||A===63||A===35){if(s--,!E&&re(g))return d(e,A)?j(c(o,s)):0;if(g==="")return i.host="",E?0:d(e,A)?Y(c(o,s)):0;{let t=EA(g,!I(i.scheme));return t===null?1:(t==="localhost"&&(t=""),i.host=vA(t),g="",E?0:d(e,A)?Y(c(o,s)):0)}}return 1},Y=A=>{let e=s;return I(i.scheme)?(A!==92&&A!==47&&s--,d(e,A)?j(c(o,s)):0):!E&&A===63?(i.query="",d(e,A)?Q(c(o,s)):0):!E&&A===35?(i.fragment="",d(e,A)?x(c(o,s)):0):A!=null?(A!==47&&s--,d(e,A)?j(c(o,s)):0):(E&&i.host===null&&i.path.push(""),d(e,A)?Y(c(o,s)):0)},j=A=>{let e=s;if(A!=null&&A!==47&&(!I(i.scheme)||A!==92)&&(E||A!==63&&A!==35)){let t=s+M(A);for(;t<o.length;){let n=c(o,t);if(n==null||n===47||I(i.scheme)&&n===92||!E&&(n===63||n===35))break;t+=M(n)}g+=_(o.slice(s,t),SA),s=t,A=c(o,t)}if(A==null||A===47||I(i.scheme)&&A===92||!E&&(A===63||A===35)){let t=I(i.scheme)&&A===92;return(function(r){switch(r){case"..":case"%2e.":case"%2E.":case".%2e":case".%2E":case"%2e%2e":case"%2E%2e":case"%2e%2E":case"%2E%2E":return!0;default:return!1}})(g)?(oe(i),A!==47&&!t&&i.path.push("")):JA(g)&&A!==47&&!t?i.path.push(""):JA(g)||(i.scheme==="file"&&i.path.length===0&&re(g)&&(g=`${g[0]}:`),i.path.push(g)),g="",A===63?(i.query="",d(e,A)?Q(c(o,s)):0):A===35?(i.fragment="",d(e,A)?x(c(o,s)):0):d(e,A)?j(c(o,s)):0}else return g+=ee(A,SA),d(e,A)?j(c(o,s)):0},ae=A=>{let e=s;if(A===63)return i.query="",d(e,A)?Q(c(o,s)):0;if(A===35)return i.fragment="",d(e,A)?x(c(o,s)):0;if(A!=null){let t=s+M(A);for(;t<o.length;){let r=c(o,t);if(r===63||r===35)break;t+=M(r)}let n=o.slice(s,t);if(t<o.length&&n.charCodeAt(n.length-1)===32?i.path[0]+=_(n.slice(0,-1),AA)+"%20":i.path[0]+=_(n,AA),s=t,(A=c(o,t))===63)return i.query="",d(e,A)?Q(c(o,s)):0;if(A===35)return i.fragment="",d(e,A)?x(c(o,s)):0}return d(e,A)?ae(c(o,s)):0},Q=A=>{let e=s,t=s;if(A!=null){if(E)t=o.length;else{let r=o.indexOf("#",s);t=r===-1?o.length:r}let n=I(i.scheme)?Se:qA;i.query+=_(o.slice(s,t),n)}return s=t,c(o,t)===35&&!E?(i.fragment="",d(e,A)?x(c(o,s)):0):d(e,A)?Q(c(o,s)):0},x=A=>{let e=s;return A!=null&&(i.fragment+=_(o.slice(s),be),s=o.length),d(e,A)?x(c(o,s)):0};function TA(A){if(A.opaquePath)return A.path[0];{let e="";for(let t of A.path)e+=`/${t}`;return e}}function fe(A){switch(A.scheme){case"blob":{let e=B(TA(A),null,null,0);return e===null||e.scheme!=="http"&&e.scheme!=="https"?"null":fe(e)}case"ftp":case"http":case"https":case"ws":case"wss":return(function(t){let n=`${t.scheme}://`;return n+=t.host,t.port!==null&&(n+=`:${t.port}`),n})(A);default:return"null"}}var b=Symbol("URLImpl"),eA=class A{constructor(e,t){if(e===void 0&&t===void 0)throw new TypeError('The "url" argument must be specified.');e=S(e),t!=null&&(t=S(t));let n=null;if(t!=null&&(n=B(t,null,null,0),n==null))throw new TypeError(`Invalid base URL: ${t}`);let r=B(e,null,n,0);if(r==null)throw new TypeError(`Invalid URL: ${e}`);this[b]={url:r,query:null}}static createObjectURL(e){throw new TypeError("URL.createObjetURL is unsupported")}static revokeObjectURL(e){}static parse(e,t){e=S(e),t!==void 0&&(t=S(t));try{return new A(e,t)}catch{return null}}static canParse(e,t){e=S(e),t!==void 0&&(t=S(t));let n=null;return t!=null&&(n=B(t,null,null,0),n==null)?!1:B(e,null,n,0)!=null}get href(){return(function(t){let n=`${t.scheme}:`;return t.host!==null&&(n+="//",(t.username!==""||t.password!=="")&&(n+=t.username,t.password!==""&&(n+=`:${t.password}`),n+="@"),n+=t.host,t.port!==null&&(n+=`:${t.port}`)),t.host===null&&!t.opaquePath&&t.path.length>1&&t.path[0]===""&&(n+="/."),n+=TA(t),t.query!==null&&(n+=`?${t.query}`),t.fragment!==null&&(n+=`#${t.fragment}`),n})(this[b].url)}set href(e){let t=B(e=S(e),null,null,0);if(t==null)throw new TypeError(`Invalid URL: ${e}`);this[b].url=t,this[b].query&&yA(this[b].query,t.query)}get origin(){return fe(this[b].url)}get protocol(){return`${this[b].url.scheme}:`}set protocol(e){B(`${e=S(e)}:`,this[b].url,null,2)}get username(){return this[b].url.username}set username(e){e=S(e),mA(this[b].url)||(function(n,r){n.username=_(r,cA)})(this[b].url,e)}get password(){return this[b].url.password}set password(e){e=S(e),mA(this[b].url)||(function(n,r){n.password=_(r,cA)})(this[b].url,e)}get host(){let{url:e}=this[b];return e.host==null?"":e.port==null?e.host:`${e.host}:${e.port}`}set host(e){e=S(e),this[b].url.opaquePath||B(e,this[b].url,null,3)}get hostname(){let{url:e}=this[b];return e.host!=null?e.host:""}set hostname(e){e=S(e),this[b].url.opaquePath||B(e,this[b].url,null,4)}get port(){let{url:e}=this[b];return e.port!=null?`${e.port}`:""}set port(e){e=S(e);let{url:t}=this[b];mA(t)||(e?B(e,t,null,5):t.port=null)}get pathname(){return TA(this[b].url)}set pathname(e){e=S(e);let{url:t}=this[b];t.opaquePath||(t.path=[],B(e,t,null,6))}get search(){let{url:e}=this[b];return e.query?`?${e.query}`:""}set search(e){e=S(e);let{url:t,query:n}=this[b];if(!e)t.query=null,n&&yA(n,null);else{let r=e[0]==="?"?e.substring(1):e;t.query="",B(r,t,null,7),n&&yA(n,t.query)}}get searchParams(){let e=this[b],t=e.query;return t==null&&(t=e.query=(function(r,u){let l=new fA;return l[C].url=r,l[C].serialized=u==null,u&&(l[C].list=NA(u)),l})(this,e.url.query)),t}get hash(){let{url:e}=this[b];return e.fragment?`#${e.fragment}`:""}set hash(e){e=S(e);let{url:t}=this[b];if(!e)t.fragment=null;else{let n=e[0]==="#"?e.substring(1):e;t.fragment="",B(n,t,null,8)}}toJSON(){return this.href}toString(){return this.href}};Object.defineProperty(eA.prototype,Symbol.toStringTag,{value:"URL",configurable:!0});var C=Symbol("URLSearchParamsImpl"),Je=Symbol.dispose||Symbol.for("dispose");function yA(A,e){e?A[C].list=NA(e):A[C].list.length=0,A[C].serialized=e==null}function oA(A){if(A.url){let e=CA(A.list);(function(n,r){n[b].url.query=r})(A.url,e||null),A.serialized=!0}}var We=typeof Iterator<"u"?Iterator:Object,Z=class extends We{constructor(e,t){super(),this[C]={ptr:e,map:t,index:0}}next(){let e=this[C];return e.index<e.ptr.list.length?{value:e.map(e.ptr.list[e.index++]),done:!1}:{value:void 0,done:!0}}[Symbol.iterator](){return this}[Je](){}},fA=class{constructor(e){let t=this[C]={list:[],url:null,serialized:!0},n;if(Array.isArray(e))for(let r=0;r<e.length;r++)t.list.push(QA(e[r]));else if((n=ZA(e))!=null){let r;for(;!(r=PA(n.next())).done;)t.list.push(QA(r.value))}else if((typeof e=="object"||typeof e=="function")&&e!=null){let r=Object.keys(e);for(let u=0;u<r.length;u++){let l=r[u],a=Pe(l),f=S(e[l]),h=t.list.find(w=>w[0]===a);h?h[1]=f:t.list.push([a,f])}}else if(e!==void 0){let r=S(e);r=r[0]==="?"?r.substring(1):r,t.list=NA(r)}}get size(){return this[C].list.length}append(e,t){e=S(e),t=S(t),this[C].list.push([e,t]);let n=this[C];n.url&&n.serialized?(function(u,l){let a=u[b].url;a.query=a.query?`${a.query}&${l}`:l})(n.url,CA([[e,t]])):oA(n)}delete(e,t){e=S(e),t=t!=null?S(t):void 0;let{list:n}=this[C],r=0;for(;r<n.length;)n[r][0]===e&&(t==null||n[r][1]===t)?n.splice(r,1):r++;oA(this[C])}get(e){e=S(e);let{list:t}=this[C];for(let n=0;n<t.length;n++)if(t[n][0]===e)return t[n][1];return null}getAll(e){e=S(e);let t=[],{list:n}=this[C];for(let r=0;r<n.length;r++)n[r][0]===e&&t.push(n[r][1]);return t}has(e,t){e=S(e),t=t!=null?S(t):void 0;let{list:n}=this[C];for(let r=0;r<n.length;r++)if(n[r][0]===e&&(t==null||n[r][1]===t))return!0;return!1}set(e,t){e=S(e),t=S(t);let{list:n}=this[C],r=!1,u=!1,l=0;for(;l<n.length;)n[l][0]===e?r?(n.splice(l,1),u=!0):(r=!0,n[l][1]!==t&&(n[l][1]=t,u=!0),l++):l++;r||(n.push([e,t]),u=!0),u&&oA(this[C])}sort(){this[C].list.sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0),oA(this[C])}forEach(e,t){if(typeof e!="function")throw new TypeError('The "callback" argument must be of type function');let{list:n}=this[C];for(let r=0;r<n.length;r++)e.call(t,n[r][1],n[r][0],this)}entries(){return new Z(this[C],e=>e)}keys(){return new Z(this[C],e=>e[0])}values(){return new Z(this[C],e=>e[1])}toString(){return CA(this[C].list)}[Symbol.iterator](){return this.entries()}};Object.defineProperty(fA.prototype,Symbol.toStringTag,{value:"URLSearchParams",configurable:!0});function he(A){let e,t=()=>typeof e=="string"?e:e?.accessToken,n=0,r,u=new Map,l=()=>{for(let p of[...u.keys()])try{p()}catch{}};function a(p){let m=++n;r=void 0,e=void 0;for(let y of[...u.values()])try{y?.()}catch{}m===n&&(e=p,l())}let f=()=>a();function h(p,m=!1){let y=$A.safeParse(p);if(!y.success||m&&Date.parse(y.data.expiresAt)<=Date.now()||Date.parse(y.data.refreshExpiresAt)<=Date.now()||Date.parse(y.data.refreshExpiresAt)<Date.parse(y.data.expiresAt))throw new P("INVALID_RESPONSE","Invalid customer session credentials");return y.data}async function w(){if(r)return r;let p=typeof e=="object"?e:void 0,m=n;if(!p||Date.parse(p.refreshExpiresAt)<=Date.now())throw p&&f(),new P("UNAUTHENTICATED","Customer authentication is required",401);let y=(async()=>{try{let N=await A(p.refreshToken);if(m!==n)throw new P("IDENTITY_CHANGED","Customer identity changed during refresh");let V=h(N,!0);if(V.customerId!==p.customerId||V.sessionId!==p.sessionId)throw new P("SCOPE_MISMATCH","Refresh changed the customer session");return e=V,{...V}}catch(N){throw m!==n?new P("IDENTITY_CHANGED","Customer identity changed during refresh"):(N instanceof P&&N.status===401&&f(),N)}})();r=y;try{return await y}finally{r===y&&(r=void 0)}}return{identify(p){let m=typeof p=="string"?p:h(p),y=typeof m=="string"?m:m.accessToken;if(!y.trim()||/\s/.test(y)||y.length>4096)throw new P("INVALID_TOKEN","A server-issued token is required");a(m)},reset:f,subscribeIdentity(p,m){return u.set(p,m),()=>{u.delete(p)}},access(){let p=typeof e=="object"?e:void 0;if(p&&Date.parse(p.expiresAt)<=Date.now()+3e4){let y=n;return w().then(()=>{let N=t();if(y!==n||!N)throw new P("IDENTITY_CHANGED","Customer identity changed during refresh");return N})}let m=t();if(!m)throw new P("NOT_IDENTIFIED","Identify a customer session before making a request");return m},peek:t,snapshot:()=>typeof e=="object"?{...e}:void 0,refresh:w}}var de=Symbol("IndianaNoContent");function ut(A,e,t=eA){let n=A.configuration?.scope,r=A.scope??(n&&{projectId:n.projectId,environment:n.environment}),u=r?sA.parse(r):void 0;if(u&&n&&(u.projectId!==n.projectId||u.environment!==n.environment))throw new P("SCOPE_MISMATCH","Configuration belongs to another App/environment");let l=new t(A.baseUrl??FA);if(l.username||l.password||l.search||l.hash)throw new P("INVALID_URL","baseUrl must not contain credentials, query, or fragment");if(l.protocol!=="https:"&&!(l.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(l.hostname)))throw new P("INVALID_URL","Use HTTPS, or HTTP on localhost during development");let a=A.fetch??globalThis.fetch.bind(globalThis),f=A.timeoutMs??1e4;if(!Number.isFinite(f)||f<1||f>12e4)throw new P("INVALID_TIMEOUT","timeoutMs must be between 1 and 120000");let h=!1,w=0,p=null,m=new Set,y=A.session??he(async q=>{let O=await tA("customer-sessions/refresh",{},"POST",{},q);if(!O||typeof O!="object")throw new P("INVALID_RESPONSE","Invalid refresh response");let{requestId:$,scope:H,...K}=O;return K});function N(){w+=1,p=null;for(let q of m)q.abort();m.clear()}let V=y.subscribeIdentity(N);function pe(){h||y.reset()}async function tA(q,O={},$="POST",H={},K){let k=H.installationDetach===!0;if(k&&(q!=="push/installations/detach"||$!=="POST"))throw new P("INVALID_REQUEST","Installation authority only detaches this installation");if(!K&&!k)throw new P("NOT_IDENTIFIED","Call identify with a server-issued customer token first");let J=w,L=new AbortController;k||m.add(L);let nA=()=>!k&&J!==w?new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):new P("TIMEOUT","Longplay request timed out"),dA,ge=new Promise((T,R)=>{dA=()=>R(nA()),L.signal.addEventListener("abort",dA,{once:!0})}),we=setTimeout(()=>L.abort(),H.timeoutMs??f),me=async()=>{let T=await a(`${l.href.replace(/\/$/,"")}/api/v1/${q}`,{method:$,headers:{...H.headers,"Content-Type":"application/json",...k?{}:{Authorization:`Bearer ${K}`},[pA]:gA.current,[xA]:zA.version,...u?{"X-Indiana-Project":u.projectId,"X-Indiana-Environment":u.environment}:{}},body:$==="POST"?JSON.stringify(O):void 0,signal:L.signal,credentials:"omit",cache:"no-store",redirect:"error",...H.keepalive?{keepalive:!0}:{}});if(L.signal.aborted)throw nA();let R;try{R=T.status===204?de:await T.json()}catch{throw L.signal.aborted?nA():new P(T.ok?"INVALID_RESPONSE":"HTTP_ERROR","The gateway returned an unreadable response",T.status,T.headers.get("X-Request-Id")??void 0)}if(L.signal.aborted)throw nA();if(!k&&J!==w)throw new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight");if(!T.ok){let v=UA.safeParse(R),z=v.success&&(!MA.safeParse(v.data.error.code).success||jA(v.data.error.code,T.status)),BA=z?v.data.error.code:"HTTP_ERROR",HA=_A(BA,T.status,{retryAfter:T.headers.get("Retry-After"),recovery:z?v.data.error.recovery:void 0,reason:z?v.data.error.reason:void 0});throw new P(BA,z?v.data.error.message:"Longplay request failed",T.status,T.headers.get("X-Request-Id")??(v.success?v.data.requestId:void 0),{...HA,...v.success&&v.data.error.retryable===!1?{retryable:!1}:{},...HA.retryAfterSeconds===void 0&&v.success&&v.data.error.retryAfterSeconds!==void 0?{retryAfterSeconds:v.data.error.retryAfterSeconds}:{}})}if(T.headers.get(pA)!==gA.current)throw new P("PROTOCOL_MISMATCH","Response protocol does not match this SDK");if(u&&R!==de){let v=R&&typeof R=="object"&&"scope"in R?R:R&&typeof R=="object"&&"configuration"in R?R.configuration:null;if(!v||typeof v!="object"||!("scope"in v))throw new P("INVALID_RESPONSE","Response is missing its App/environment scope");let z=sA.safeParse(v.scope);if(!z.success||z.data.projectId!==u.projectId||z.data.environment!==u.environment)throw new P("SCOPE_MISMATCH","Response scope does not match this SDK instance")}let rA=T.headers.get("X-Indiana-Telemetry-Subject");if(rA){if(!/^[a-f0-9]{64}$/.test(rA))throw new P("INVALID_RESPONSE","Invalid telemetry identity");p!==rA&&(p=rA,e?.(p))}return R};try{return await Promise.race([me(),ge])}catch(T){throw!k&&J!==w?new P("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):T instanceof P?T:new P(L.signal.aborted?"TIMEOUT":"NETWORK_ERROR",L.signal.aborted?"Longplay request timed out":"Unable to read the Longplay response")}finally{clearTimeout(we),L.signal.removeEventListener("abort",dA),m.delete(L)}}return{session:y,requestWithCredential(q,O,$,H={}){return h?Promise.reject(new P("CLOSED","SDK client was destroyed")):tA(q,O,"POST",H,$)},subjectKey:()=>p,identify(q){if(h)throw new P("CLOSED","SDK client was destroyed");if(u&&typeof q=="object"&&"scope"in q){let O=sA.safeParse(q.scope);if(!O.success||O.data.projectId!==u.projectId||O.data.environment!==u.environment)throw new P("SCOPE_MISMATCH","Customer session belongs to another App/environment")}y.identify(q)},reset:pe,dispose(){h||(h=!0,V(),N())},request(q,O={},$="POST",H={}){if(h)return Promise.reject(new P("CLOSED","SDK client was destroyed"));if(H.installationDetach)return tA(q,O,$,H);let K=w;try{let k=y.access(),J=L=>{if(K!==w)throw new P("IDENTITY_CHANGED","Customer identity changed before dispatch");return tA(q,O,$,H,L)};return typeof k=="string"?J(k):k.then(J)}catch(k){return Promise.reject(k)}}}}export{eA as a,ut as b};
@@ -1 +1 @@
1
- import{f as F,j as Q}from"./chunk-ML6EHT43.js";import{b as B}from"./chunk-SSLZKIIU.js";import{c as z,d as _}from"./chunk-T5COWMDA.js";import"./chunk-E4LUW6KP.js";import{a as d}from"./chunk-26HU2HXU.js";import{a as v}from"./chunk-DSPLGTQI.js";import{Q as M}from"./chunk-JVQVQHV2.js";import{A as V,Aa as N,Ba as q,ka as P,ta as U}from"./chunk-PFHS7HK3.js";import{z as p}from"zod";var x=new WeakMap;function W(r){let t={string:p.string(),number:p.number().finite(),boolean:p.boolean(),strings:p.array(p.string()),json:V}[r.type];return r.nullable?t.nullable():t}async function ie(r,t){return $(r,t,!1)}async function se(r,t){return $(r,t,!0)}async function $(r,t,w){t.signal?.throwIfAborted();let L=M.parse(t.content),o=L.document;if(x.has(r))throw new d("CONFLICT","Content is already mounted in this container");let f=p.record(p.string(),V).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))N.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))W(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 J=q.parse(t.bindings??[]),c=r.ownerDocument,T,k=o.kind==="popup",n=k?c.createElement("dialog"):null,i=c.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 l=!1,C=!1,g=!1;w&&!n&&(i.style.width=`${r.getBoundingClientRect().width||c.defaultView?.innerWidth||800}px`);let G=w?F(n??i):()=>{},D,A,S=new Promise((e,s)=>{D=e,A=s});S.catch(()=>{});let u=null,E=structuredClone(o.screen);E.actions=E.actions.map(e=>e.type==="event"?{...e,close:!1}:e);let y;function m(){l||(l=!0,t.signal?.removeEventListener("abort",m),A(new Error("Content preparation cancelled")),y?.destroy(),n?.close(),n?.remove(),i.remove(),x.delete(r),n&&T?.())}let O=()=>{g&&(m(),v(t.onDismiss))};if(n){let e=c.createElement("button");e.type="button",e.textContent="\xD7",e.setAttribute("aria-label",t.locale?.startsWith("zh")?"\u5173\u95ED":"Close"),_(e,o.screen.theme),e.addEventListener("click",O),n.prepend(e)}n?.addEventListener("cancel",e=>{e.preventDefault(),O()});async function H(){if(l||!g||C||!u)return;let e=u;C=!0,i.setAttribute("aria-busy","true");try{await t.actions[e.actionId](structuredClone(e)),u=null}catch(s){v(t.onError,s)}finally{C=!1,l||i.removeAttribute("aria-busy")}}function R(){if(l)throw new d("CONFLICT","Content host has been destroyed");g||(T=B(c),G(),w&&!n&&(i.style.width="100%"),n&&(n.showModal(),z(n,o.screen.presentation.type)),g=!0)}try{w||R(),y=Q(i,{mode:"live",rendererUrl:t.rendererUrl,title:o.name,viewportHeight:o.kind==="page"?r.clientHeight||c.defaultView?.innerHeight||800:void 0,onRendered:a=>{a&&n?.setAttribute("aria-label",a),D()},onError:a=>{let I=new Error(a);A(I),v(t.onError,I)},onEscape:k?O:void 0,onAction:(a,I,K)=>{if(l||!g||C||u)return;let h=o.screen.actions.find(b=>b.id===a),j=o.contract.outputs[a];if(!(h?.type!=="event"||!j))try{let b=W(j).parse(Object.hasOwn(h.properties,"value")?h.properties.value:h.properties);u={requestId:crypto.randomUUID(),contentVersionId:L.id,actionId:a,event:h.event,value:b,selection:I??{},answers:K??{},requestedClose:h.close},H()}catch(b){v(t.onError,b)}}});let e={destroy:m,show:R,get pendingAction(){return u?structuredClone(u):null},retryAction:H,updateCapabilities:a=>y?.updateCapabilities(a)};x.set(r,e),t.signal?.addEventListener("abort",m,{once:!0}),t.signal?.aborted&&(m(),t.signal.throwIfAborted());let s=U(E,[t.locale,...c.defaultView?.navigator.languages??[]]);if(y.update(E,s,{capabilities:t.capabilities,serverInput:{bindings:J,answers:{},values:f}}),await Promise.race([y.ready,S]),w&&await S,l)throw new Error("Content preparation cancelled");return e}catch(e){throw m(),e}}export{ie as mountContent,se as prepareContent};
1
+ import{f as F,j as Q}from"./chunk-EDVR7FPD.js";import{b as B}from"./chunk-SSLZKIIU.js";import{c as z,d as _}from"./chunk-XIYNQHN7.js";import"./chunk-YNMSSQQY.js";import{a as d}from"./chunk-KHIQQNTR.js";import{a as v}from"./chunk-DSPLGTQI.js";import{Y as M}from"./chunk-GSFNAB3W.js";import{Ba as U,Ia as N,Ja as q,O as V,sa as P}from"./chunk-4SWGHICJ.js";import{z as p}from"zod";var x=new WeakMap;function W(r){let t={string:p.string(),number:p.number().finite(),boolean:p.boolean(),strings:p.array(p.string()),json:V}[r.type];return r.nullable?t.nullable():t}async function ie(r,t){return $(r,t,!1)}async function se(r,t){return $(r,t,!0)}async function $(r,t,w){t.signal?.throwIfAborted();let L=M.parse(t.content),o=L.document;if(x.has(r))throw new d("CONFLICT","Content is already mounted in this container");let f=p.record(p.string(),V).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))N.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))W(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 J=q.parse(t.bindings??[]),c=r.ownerDocument,T,k=o.kind==="popup",n=k?c.createElement("dialog"):null,i=c.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 l=!1,C=!1,g=!1;w&&!n&&(i.style.width=`${r.getBoundingClientRect().width||c.defaultView?.innerWidth||800}px`);let G=w?F(n??i):()=>{},D,A,S=new Promise((e,s)=>{D=e,A=s});S.catch(()=>{});let u=null,E=structuredClone(o.screen);E.actions=E.actions.map(e=>e.type==="event"?{...e,close:!1}:e);let y;function m(){l||(l=!0,t.signal?.removeEventListener("abort",m),A(new Error("Content preparation cancelled")),y?.destroy(),n?.close(),n?.remove(),i.remove(),x.delete(r),n&&T?.())}let O=()=>{g&&(m(),v(t.onDismiss))};if(n){let e=c.createElement("button");e.type="button",e.textContent="\xD7",e.setAttribute("aria-label",t.locale?.startsWith("zh")?"\u5173\u95ED":"Close"),_(e,o.screen.theme),e.addEventListener("click",O),n.prepend(e)}n?.addEventListener("cancel",e=>{e.preventDefault(),O()});async function H(){if(l||!g||C||!u)return;let e=u;C=!0,i.setAttribute("aria-busy","true");try{await t.actions[e.actionId](structuredClone(e)),u=null}catch(s){v(t.onError,s)}finally{C=!1,l||i.removeAttribute("aria-busy")}}function R(){if(l)throw new d("CONFLICT","Content host has been destroyed");g||(T=B(c),G(),w&&!n&&(i.style.width="100%"),n&&(n.showModal(),z(n,o.screen.presentation.type)),g=!0)}try{w||R(),y=Q(i,{mode:"live",rendererUrl:t.rendererUrl,title:o.name,viewportHeight:o.kind==="page"?r.clientHeight||c.defaultView?.innerHeight||800:void 0,onRendered:a=>{a&&n?.setAttribute("aria-label",a),D()},onError:a=>{let I=new Error(a);A(I),v(t.onError,I)},onEscape:k?O:void 0,onAction:(a,I,K)=>{if(l||!g||C||u)return;let h=o.screen.actions.find(b=>b.id===a),j=o.contract.outputs[a];if(!(h?.type!=="event"||!j))try{let b=W(j).parse(Object.hasOwn(h.properties,"value")?h.properties.value:h.properties);u={requestId:crypto.randomUUID(),contentVersionId:L.id,actionId:a,event:h.event,value:b,selection:I??{},answers:K??{},requestedClose:h.close},H()}catch(b){v(t.onError,b)}}});let e={destroy:m,show:R,get pendingAction(){return u?structuredClone(u):null},retryAction:H,updateCapabilities:a=>y?.updateCapabilities(a)};x.set(r,e),t.signal?.addEventListener("abort",m,{once:!0}),t.signal?.aborted&&(m(),t.signal.throwIfAborted());let s=U(E,[t.locale,...c.defaultView?.navigator.languages??[]]);if(y.update(E,s,{capabilities:t.capabilities,serverInput:{bindings:J,answers:{},values:f}}),await Promise.race([y.ready,S]),w&&await S,l)throw new Error("Content preparation cancelled");return e}catch(e){throw m(),e}}export{ie as mountContent,se as prepareContent};
@@ -11,6 +11,26 @@ declare const surfaceDataSchema: z.ZodObject<{
11
11
  }>;
12
12
  quantity: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
13
13
  allowed: z.ZodBoolean;
14
+ observation: z.ZodOptional<z.ZodObject<{
15
+ subject: z.ZodObject<{
16
+ scope: z.ZodObject<{
17
+ projectId: z.ZodUUID;
18
+ environmentId: z.ZodUUID;
19
+ environment: z.ZodEnum<{
20
+ sandbox: "sandbox";
21
+ live: "live";
22
+ }>;
23
+ }, z.core.$strict>;
24
+ customerId: z.ZodUUID;
25
+ }, z.core.$strict>;
26
+ authority: z.ZodEnum<{
27
+ longplay: "longplay";
28
+ merchant: "merchant";
29
+ }>;
30
+ observedAt: z.ZodISODateTime;
31
+ sourceRevision: z.ZodString;
32
+ requirementDigest: z.ZodString;
33
+ }, z.core.$strict>>;
14
34
  reason: z.ZodNullable<z.ZodEnum<{
15
35
  not_entitled: "not_entitled";
16
36
  insufficient_balance: "insufficient_balance";