@frak-labs/components 1.1.0-beta.85ee7f39 → 1.1.0-beta.9c160982

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.
@@ -1,4 +1,4 @@
1
- import{C as e,h as t,i as n,k as r,m as i,o as a,p as o}from"./loader.js";import{a as s,d as c,f as l,h as u,l as d,m as f,n as ee,p,s as te,t as m,u as h}from"./defaults.CT8FNvot.js";import{a as g,i as _,n as v,r as y,t as b}from"./GiftIcon.DV54EwfG.js";import{t as x}from"./useGlobalComponents.BT0loDl8.js";import{t as S}from"./useLightDomStyles.CZ1iTaa9.js";import{i as C}from"./rewards.D3nh4aTd.js";import{t as ne}from"./useReward.DWHEt1Zs.js";var w=`inAppBanner_body__1ibpiy74`,T=`inAppBanner_closeButton__1ibpiy77`,E=`inAppBanner_container__1ibpiy70`,D=`inAppBanner_cta__1ibpiy76`,O=`inAppBanner_description__1ibpiy75`,k=`inAppBanner_header__1ibpiy71`,A=`inAppBanner_iconWrapper__1ibpiy72`,j=`inAppBanner_title__1ibpiy73`;function re({title:e,description:t,cta:n,dismissLabel:r,onAction:i,onDismiss:a,className:o,classNames:s}){return f(`div`,{className:`${E}${o?` ${o}`:``}`,role:`alert`,children:[f(`div`,{className:k,children:[f(`span`,{className:`${A}${s?.icon?` ${s.icon}`:``}`,children:f(v,{width:20,height:20})}),f(`p`,{className:`${j}${s?.title?` ${s.title}`:``}`,children:e})]}),f(`div`,{className:w,children:[f(`p`,{className:`${O}${s?.description?` ${s.description}`:``}`,children:t}),f(`button`,{type:`button`,className:`${D}${s?.cta?` ${s.cta}`:``}`,onClick:i,children:[n,f(_,{width:14,height:14})]})]}),f(`button`,{type:`button`,className:`${T}${s?.close?` ${s.close}`:``}`,onClick:a,"aria-label":r,children:f(g,{width:16,height:16})})]})}var ie=`Banner_frakLogo__1gnumzi9`,ae=`Banner_iconSvg__1gnumzi1`,oe=`Banner_referral__1gnumzi2 reset_base__1831jhd0 Banner_rootBase__1gnumzi0`,se=`Banner_referralBody__1gnumzi5`,ce=`Banner_referralCta__1gnumzi8 sharedBaseCss_buttonReset__7cswil0`,le=`Banner_referralDescription__1gnumzi7 reset_base__1831jhd0`,ue=`Banner_referralIconWrapper__1gnumzi3`,de=`Banner_referralImage__1gnumzi4`,fe=`Banner_referralTitle__1gnumzi6 reset_base__1831jhd0`;function M({placement:u,classname:g=``,interaction:_,products:v,referralTitle:w,referralDescription:T,referralCta:E,inappTitle:D,inappDescription:O,inappCta:k,imageUrl:A,preview:j,previewMode:M,allowInappRedirect:N}){let P=!!j,F=s(),I=M===`inapp`?`inapp`:`referral`,L=N===!0||N===`true`,R=ee(u),{shouldRender:z,isHidden:B,isClientReady:V}=te();S(`frak-banner`,u,R?.components?.banner?.css,`@keyframes keyframes_fadeIn__mnqmlt0 {
1
+ import{O as e,S as t,a as n,f as r,m as i,p as a,s as o}from"./loader.js";import{a as s,d as c,f as l,h as u,l as d,m as f,n as ee,p,s as te,t as m,u as h}from"./defaults.CmUvOlLQ.js";import{a as g,i as _,n as v,r as y,t as b}from"./GiftIcon.CPyeWQNR.js";import{t as x}from"./useGlobalComponents.C7wnXWOg.js";import{t as S}from"./useLightDomStyles.BLyrWEBn.js";import{i as C}from"./rewards.DjfrchZd.js";import{t as ne}from"./useReward.fvxtDVaA.js";var w=`inAppBanner_body__1ibpiy74`,T=`inAppBanner_closeButton__1ibpiy77`,E=`inAppBanner_container__1ibpiy70`,D=`inAppBanner_cta__1ibpiy76`,O=`inAppBanner_description__1ibpiy75`,k=`inAppBanner_header__1ibpiy71`,A=`inAppBanner_iconWrapper__1ibpiy72`,j=`inAppBanner_title__1ibpiy73`;function re({title:e,description:t,cta:n,dismissLabel:r,onAction:i,onDismiss:a,className:o,classNames:s}){return f(`div`,{className:`${E}${o?` ${o}`:``}`,role:`alert`,children:[f(`div`,{className:k,children:[f(`span`,{className:`${A}${s?.icon?` ${s.icon}`:``}`,children:f(v,{width:20,height:20})}),f(`p`,{className:`${j}${s?.title?` ${s.title}`:``}`,children:e})]}),f(`div`,{className:w,children:[f(`p`,{className:`${O}${s?.description?` ${s.description}`:``}`,children:t}),f(`button`,{type:`button`,className:`${D}${s?.cta?` ${s.cta}`:``}`,onClick:i,children:[n,f(_,{width:14,height:14})]})]}),f(`button`,{type:`button`,className:`${T}${s?.close?` ${s.close}`:``}`,onClick:a,"aria-label":r,children:f(g,{width:16,height:16})})]})}var ie=`Banner_frakLogo__1gnumzi9`,ae=`Banner_iconSvg__1gnumzi1`,oe=`Banner_referral__1gnumzi2 reset_base__1831jhd0 Banner_rootBase__1gnumzi0`,se=`Banner_referralBody__1gnumzi5`,ce=`Banner_referralCta__1gnumzi8 sharedBaseCss_buttonReset__7cswil0`,le=`Banner_referralDescription__1gnumzi7 reset_base__1831jhd0`,ue=`Banner_referralIconWrapper__1gnumzi3`,de=`Banner_referralImage__1gnumzi4`,fe=`Banner_referralTitle__1gnumzi6 reset_base__1831jhd0`;function M({placement:u,classname:g=``,interaction:_,products:v,referralTitle:w,referralDescription:T,referralCta:E,inappTitle:D,inappDescription:O,inappCta:k,imageUrl:A,preview:j,previewMode:M,allowInappRedirect:N}){let P=!!j,F=s(),I=M===`inapp`?`inapp`:`referral`,L=N===!0||N===`true`,R=ee(u),{shouldRender:z,isHidden:B,isClientReady:V}=te();S(`frak-banner`,u,R?.components?.banner?.css,`@keyframes keyframes_fadeIn__mnqmlt0 {
2
2
  from {
3
3
  opacity: 0;
4
4
  }
@@ -180,4 +180,4 @@ import{C as e,h as t,i as n,k as r,m as i,o as a,p as o}from"./loader.js";import
180
180
  right: 16px;
181
181
  bottom: 12px;
182
182
  pointer-events: none;
183
- }`,r);let[H,U]=c(!1),[W,G]=c(()=>P?I:L&&o?`inapp`:null),K=d(null);l(()=>{P&&G(I)},[P,I]);let pe=h(()=>i(v),[v]),{reward:q}=ne(W===`referral`&&V,_,`referee`,pe),[J,Y]=c(null);l(()=>{let e=window.FrakSetup?.client;W!==`inapp`||P||!V||!e||a(e).then(e=>Y(e)).catch(()=>{})},[W,P,V]),l(()=>{P||!W||H||K.current!==W&&V&&(e(window.FrakSetup?.client,`banner_impression`,{placement:u,variant:W,has_reward:W===`referral`?!!q:void 0}),K.current=W)},[W,H,V,P,u]),l(()=>{if(P||W===`inapp`)return;let e=()=>G(`referral`);return window.addEventListener(n,e),()=>window.removeEventListener(n,e)},[P,W]);let X=p(async()=>{if(P)return;if(e(window.FrakSetup?.client,`banner_resolved`,{placement:u,variant:W??`referral`,outcome:`clicked`}),W===`referral`){U(!0);return}let n=J;if(!n&&window.FrakSetup?.client)try{n=await a(window.FrakSetup?.client)}catch{}let r=window.location.href;if(n){let e=new URL(r);e.searchParams.set(`fmt`,n),r=e.toString()}t(r)},[P,W,J,u]),me=p(()=>{P||(e(window.FrakSetup?.client,`banner_resolved`,{placement:u,variant:W??`referral`,outcome:`dismissed`}),U(!0))},[P,W,u]),he=x(),Z=R?.components?.banner??he?.banner,Q=A??Z?.imageUrl,$=h(()=>{let e=m[F].banner;if(W===`referral`){let t=q?e.referralTitleReward:e.referralTitle;return{title:C(w??Z?.referralTitle??t,q),description:C(T??Z?.referralDescription??e.referralDescription,q),cta:E??Z?.referralCta??e.referralCta}}return{title:C(D??Z?.inappTitle??e.inappTitle,void 0),description:C(O??Z?.inappDescription??e.inappDescription,void 0),cta:k??Z?.inappCta??e.inappCta}},[F,W,q,Z,w,T,E,D,O,k]);if(!W||!P&&(!z||B||H))return null;let ge=[oe,`frak-banner`,`frak-banner--${W}`,g].filter(Boolean).join(` `);return W===`inapp`?f(re,{title:$.title,description:$.description,cta:$.cta,dismissLabel:m[F].banner.dismissLabel,onAction:X,onDismiss:me,className:[`frak-banner`,`frak-banner--inapp`,g].filter(Boolean).join(` `),classNames:{icon:`frak-banner__icon`,title:`frak-banner__title`,description:`frak-banner__description`,cta:`frak-banner__cta`,close:`frak-banner__close`}}):f(`div`,{class:ge,role:`alert`,children:[f(`div`,{class:`${ue} frak-banner__icon`,children:Q?f(`img`,{src:Q,alt:``,class:de}):f(b,{class:ae})}),f(`div`,{class:`${se} frak-banner__text`,children:[f(`p`,{class:`${fe} frak-banner__title`,children:$.title}),f(`p`,{class:`${le} frak-banner__description`,children:$.description}),f(`button`,{type:`button`,class:`${ce} frak-banner__cta`,onClick:X,children:$.cta})]}),f(y,{class:`${ie} frak-banner__logo`,width:42,height:24})]})}u(M,`frak-banner`,[`placement`,`classname`,`interaction`,`products`,`referralTitle`,`referralDescription`,`referralCta`,`inappTitle`,`inappDescription`,`inappCta`,`preview`,`previewMode`,`imageUrl`,`allowInappRedirect`],{shadow:!1});export{M as Banner};
183
+ }`,e);let[H,U]=c(!1),[W,G]=c(()=>P?I:L&&r?`inapp`:null),K=d(null);l(()=>{P&&G(I)},[P,I]);let pe=h(()=>a(v),[v]),{reward:q}=ne(W===`referral`&&V,_,`referee`,pe),[J,Y]=c(null);l(()=>{let e=window.FrakSetup?.client;W!==`inapp`||P||!V||!e||o(e).then(e=>Y(e)).catch(()=>{})},[W,P,V]),l(()=>{P||!W||H||K.current!==W&&V&&(t(window.FrakSetup?.client,`banner_impression`,{placement:u,variant:W,has_reward:W===`referral`?!!q:void 0}),K.current=W)},[W,H,V,P,u]),l(()=>{if(P||W===`inapp`)return;let e=()=>G(`referral`);return window.addEventListener(n,e),()=>window.removeEventListener(n,e)},[P,W]);let X=p(async()=>{if(P)return;if(t(window.FrakSetup?.client,`banner_resolved`,{placement:u,variant:W??`referral`,outcome:`clicked`}),W===`referral`){U(!0);return}let e=J;if(!e&&window.FrakSetup?.client)try{e=await o(window.FrakSetup?.client)}catch{}let n=window.location.href;if(e){let t=new URL(n);t.searchParams.set(`fmt`,e),n=t.toString()}i(n)},[P,W,J,u]),me=p(()=>{P||(t(window.FrakSetup?.client,`banner_resolved`,{placement:u,variant:W??`referral`,outcome:`dismissed`}),U(!0))},[P,W,u]),he=x(),Z=R?.components?.banner??he?.banner,Q=A??Z?.imageUrl,$=h(()=>{let e=m[F].banner;if(W===`referral`){let t=q?e.referralTitleReward:e.referralTitle;return{title:C(w??Z?.referralTitle??t,q),description:C(T??Z?.referralDescription??e.referralDescription,q),cta:E??Z?.referralCta??e.referralCta}}return{title:C(D??Z?.inappTitle??e.inappTitle,void 0),description:C(O??Z?.inappDescription??e.inappDescription,void 0),cta:k??Z?.inappCta??e.inappCta}},[F,W,q,Z,w,T,E,D,O,k]);if(!W||!P&&(!z||B||H))return null;let ge=[oe,`frak-banner`,`frak-banner--${W}`,g].filter(Boolean).join(` `);return W===`inapp`?f(re,{title:$.title,description:$.description,cta:$.cta,dismissLabel:m[F].banner.dismissLabel,onAction:X,onDismiss:me,className:[`frak-banner`,`frak-banner--inapp`,g].filter(Boolean).join(` `),classNames:{icon:`frak-banner__icon`,title:`frak-banner__title`,description:`frak-banner__description`,cta:`frak-banner__cta`,close:`frak-banner__close`}}):f(`div`,{class:ge,role:`alert`,children:[f(`div`,{class:`${ue} frak-banner__icon`,children:Q?f(`img`,{src:Q,alt:``,class:de}):f(b,{class:ae})}),f(`div`,{class:`${se} frak-banner__text`,children:[f(`p`,{class:`${fe} frak-banner__title`,children:$.title}),f(`p`,{class:`${le} frak-banner__description`,children:$.description}),f(`button`,{type:`button`,class:`${ce} frak-banner__cta`,onClick:X,children:$.cta})]}),f(y,{class:`${ie} frak-banner__logo`,width:42,height:24})]})}u(M,`frak-banner`,[`placement`,`classname`,`interaction`,`products`,`referralTitle`,`referralDescription`,`referralCta`,`inappTitle`,`inappDescription`,`inappCta`,`preview`,`previewMode`,`imageUrl`,`allowInappRedirect`],{shadow:!1});export{M as Banner};
@@ -0,0 +1 @@
1
+ import{S as e,l as t,r as n}from"./loader.js";import{a as r,h as i,m as a,n as o,p as s,s as c,t as l,u}from"./defaults.CmUvOlLQ.js";import{t as d}from"./useGlobalComponents.C7wnXWOg.js";import{t as f}from"./useLightDomStyles.BLyrWEBn.js";import{i as p}from"./rewards.DjfrchZd.js";import{t as m}from"./useReward.fvxtDVaA.js";function h({placement:i,text:h,classname:g=``,noRewardText:_,targetInteraction:v,products:y,clickAction:b,preview:x}){let S=!!x,C=r(),w=o(i),T=d(),E=w?.components?.buttonShare??T?.buttonShare;f(`frak-button-share`,i,E?.css);let D=u(()=>w?.targetInteraction===void 0?v:w.targetInteraction,[w?.targetInteraction,v]),O=E?.text??h??l[C].buttonShare.text,k=E?.noRewardText??_,A=u(()=>O.includes(`{REWARD}`),[O]),j=u(()=>E?.clickAction??b??`sharing-page`,[E?.clickAction,b]),{shouldRender:M,isHidden:N,isClientReady:P}=c(),F=u(()=>t(y),[y]),{reward:I}=m(A&&P,D,void 0,F),L=u(()=>A?I?p(O,I):k??p(O,void 0):O,[A,O,k,I]),R=s(()=>{S||(e(window.FrakSetup.client,`share_button_clicked`,{placement:i,target_interaction:D,has_reward:!!I,click_action:j}),n(D,i,{products:F}))},[S,j,D,i,I,F]);if(!S&&(!M||N))return null;let z=[`button`,`button__fadeIn`,g].filter(Boolean).join(` `);return a(`button`,{type:`button`,disabled:!S&&!P,class:z,onClick:R,children:L})}i(h,`frak-button-share`,[`text`,`placement`,`classname`,`clickAction`,`noRewardText`,`targetInteraction`,`products`,`preview`],{shadow:!1});export{h as ButtonShare};
@@ -0,0 +1,40 @@
1
+ import{S as e,r as t}from"./loader.js";import{a as n,d as r,f as i,g as a,h as o,m as s,n as c,p as l,r as u,s as d,t as f,u as p}from"./defaults.CmUvOlLQ.js";import{t as m}from"./useReward.fvxtDVaA.js";function h(e){return s(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[s(`title`,{children:`Gift icon`}),s(`path`,{d:`m23.14 14v11.43h-18.29v-11.43m9.14 11.43v-17.14m0 0h-5.14c-0.76 0-1.48-0.3-2.02-0.84s-0.84-1.26-0.84-2.020.3-1.480.84-2.02 1.26-0.84 2.02-0.84c4 0 5.14 5.71 5.14 5.71zm0 0h5.14c0.76 0 1.48-0.3 2.02-0.84s0.84-1.260.84-2.02-0.3-1.48-0.84-2.02-1.26-0.84-2.02-0.84c-4 0-5.14 5.71-5.14 5.71zm-11.43 0h22.86v5.71h-22.86z`,stroke:`#fff`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]})}function g(){`vibrate`in navigator?navigator.vibrate(10):console.log(`Vibration not supported`)}function _(e,n){g(),t(e,n)}function v({placement:t,classname:o=``,useReward:g,targetInteraction:v}){let y=n(),b=c(t),x=p(()=>b?.targetInteraction===void 0?v:b.targetInteraction,[b?.targetInteraction,v]),S=p(()=>g===!0,[g]),{shouldRender:C,isHidden:w,isClientReady:T}=d(),{reward:E}=m(S&&T,x),[D,O]=r(`right`),k=l(()=>{e(window.FrakSetup.client,`share_button_clicked`,{placement:t,target_interaction:x,has_reward:!!E,click_action:`sharing-page`}),_(x,t)},[t,x,E]);if(i(()=>{let e=b?.components?.buttonWallet?.position,t=window.FrakSetup?.modalWalletConfig?.metadata?.position;O(e??t??`right`)},[b?.components?.buttonWallet?.position]),!C||w)return null;let A=[`button`,`button__fadeIn`,D===`left`?`button__left`:`button__right`,o].filter(Boolean).join(` `);return s(a,{children:[s(`style`,{children:u(`
2
+ .button {
3
+ all: unset;
4
+ position: fixed;
5
+ bottom: 20px;
6
+ z-index: 2000000;
7
+ display: flex;
8
+ justify-content: center;
9
+ align-items: center;
10
+ background-color: #3e557e;
11
+ width: 45px;
12
+ height: 45px;
13
+ border-radius: 50%;
14
+ cursor: pointer;
15
+ text-align: center;
16
+ font-size: 24px;
17
+ }
18
+
19
+ .button__left {
20
+ left: 20px;
21
+ }
22
+
23
+ .button__right {
24
+ right: 20px;
25
+ }
26
+
27
+ .reward {
28
+ position: absolute;
29
+ top: -4px;
30
+ right: 27px;
31
+ padding: 2px 3px;
32
+ border-radius: 5px;
33
+ background: #ff3f3f;
34
+ font-size: 9px;
35
+ color: #fff;
36
+ font-weight: 600;
37
+ white-space: nowrap;
38
+ line-height: 9px;
39
+ }
40
+ `,b?.components?.buttonWallet?.css)}),s(`button`,{type:`button`,"aria-label":f[y].buttonWallet.ariaLabel,part:`button`,disabled:!T,class:A,onClick:k,children:[s(h,{}),E&&s(`span`,{class:`reward`,children:E})]})]})}o(v,`frak-button-wallet`,[`placement`,`classname`,`useReward`,`targetInteraction`],{shadow:!0});export{v as ButtonWallet};
@@ -1 +1 @@
1
- import{m as e}from"./defaults.CT8FNvot.js";function t(t){return e(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M7.33 0C11.38 0 14.67 3.28 14.67 7.33C14.67 11.38 11.38 14.67 7.33 14.67C3.28 14.67 0 11.38 0 7.33C0 3.28 3.28 0 7.33 0ZM10.39 4.28C10.15 4.04 9.76 4.04 9.52 4.28L7.33 6.47L5.14 4.28C4.9 4.04 4.52 4.04 4.28 4.28C4.04 4.52 4.04 4.9 4.28 5.14L6.47 7.33L4.28 9.52C4.04 9.76 4.04 10.15 4.28 10.39C4.52 10.63 4.9 10.63 5.14 10.39L7.33 8.2L9.52 10.39C9.76 10.63 10.15 10.63 10.39 10.39C10.63 10.15 10.63 9.76 10.39 9.52L8.2 7.33L10.39 5.14C10.63 4.9 10.63 4.52 10.39 4.28Z`,fill:`currentColor`})})}function n(t){return e(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M5.46 0C5.76 0 6 0.24 6 0.55C6 0.85 5.76 1.09 5.46 1.09H4.36C3.05 1.09 2.28 1.36 1.82 1.82C1.36 2.28 1.09 3.05 1.09 4.36V7.64C1.09 8.95 1.36 9.72 1.82 10.18C2.28 10.64 3.05 10.91 4.36 10.91H7.64C8.95 10.91 9.72 10.64 10.18 10.18C10.64 9.72 10.91 8.95 10.91 7.64V6.55C10.91 6.24 11.15 6 11.46 6C11.76 6 12 6.24 12 6.55V7.64C12 9.05 11.72 10.19 10.95 10.95C10.19 11.72 9.05 12 7.64 12H4.36C2.95 12 1.81 11.72 1.05 10.95C0.28 10.19 6.04e-05 9.05 0 7.64V4.36C0 2.95 0.28 1.81 1.05 1.05C1.81 0.28 2.95 0 4.36 0H5.46ZM11.45 0C11.76 2.2e-05 12 0.24 12 0.55V3.16C12 3.47 11.76 3.71 11.45 3.71C11.15 3.71 10.91 3.46 10.91 3.16V1.86L6.93 5.84C6.72 6.05 6.37 6.05 6.16 5.84C5.95 5.63 5.95 5.28 6.16 5.07L10.14 1.09H8.84C8.54 1.09 8.29 0.85 8.29 0.55C8.29 0.24 8.53 0 8.84 0H11.45Z`,fill:`currentColor`})})}function r(t){return e(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t.width??`63`,height:t.height??`24`,fill:`none`,viewBox:`0 0 63 24`,...t,children:[e(`title`,{children:`Frak`}),e(`rect`,{width:`24`,height:`24`,rx:`6`,fill:`#0043EF`}),e(`path`,{fill:`white`,d:`M9.77 15.91L5.15 14.35C5.06 14.32 4.97 14.38 4.97 14.47V17.33C4.97 17.39 5.01 17.44 5.06 17.46L9.68 19.02C9.77 19.05 9.86 18.98 9.86 18.89V16.04C9.86 15.98 9.82 15.93 9.77 15.91ZM14.58 10.44L9.95 12C9.9 12.02 9.86 12.07 9.86 12.13V14.98C9.86 15.08 9.95 15.14 10.04 15.11L14.66 13.55C14.72 13.53 14.76 13.48 14.76 13.42V10.57C14.76 10.47 14.66 10.41 14.58 10.44ZM18.92 5.02L11.18 7.51C11.12 7.53 11.08 7.58 11.08 7.64V10.57C11.08 10.62 11.14 10.66 11.2 10.65L18.94 8.15C18.99 8.14 19.03 8.08 19.03 8.02V5.1C19.03 5.04 18.97 5 18.92 5.02Z`}),e(`path`,{fill:`currentColor`,d:`M52.72 9.51C52.83 9.51 52.91 9.6 52.91 9.7L52.84 18.21C52.84 18.31 52.76 18.39 52.66 18.39L52.64 18.39H51.3C51.15 18.39 50.78 18.25 50.39 18C49.86 18.25 49.27 18.39 48.64 18.39H48.39C47.24 18.39 46.19 17.91 45.43 17.14C44.67 16.38 44.2 15.32 44.2 14.15C44.2 12.98 44.67 11.92 45.43 11.15C46.16 10.41 47.16 9.94 48.26 9.91C49.17 9.86 49.99 9.99 50.49 10.5V9.7C50.49 9.6 50.57 9.51 50.68 9.51H52.72ZM35.35 5.62H36.96C37.09 5.62 37.19 5.72 37.19 5.85V7.81C37.19 7.94 37.09 8.04 36.96 8.04H34.92C34.32 8.04 33.63 8.64 33.63 9.25V10.61C34.26 9.98 34.93 9.65 35.35 9.63H36.46C36.59 9.63 36.69 9.73 36.69 9.86V11.82C36.69 11.95 36.59 12.05 36.46 12.05H34.92C34.31 12.05 33.63 12.65 33.63 13.27V18.2C33.63 18.3 33.54 18.39 33.44 18.39H31.39C31.29 18.39 31.21 18.3 31.21 18.2V9.94C31.21 9.87 31.2 9.8 31.2 9.73C31.24 8.88 31.15 5.44 35.35 5.62ZM39.93 9.63C40.04 9.63 40.12 9.72 40.12 9.82V10.61C40.76 9.98 41.58 9.63 41.85 9.63H43.46C43.58 9.63 43.68 9.73 43.69 9.86V11.82C43.68 11.95 43.58 12.05 43.46 12.05H41.41C40.81 12.05 40.12 12.65 40.12 13.27V18.2C40.12 18.3 40.04 18.39 39.93 18.39H37.89C37.79 18.39 37.7 18.3 37.7 18.2V9.82C37.7 9.72 37.79 9.63 37.89 9.63H39.93ZM56.2 7.01C56.3 7.01 56.39 7.09 56.39 7.2V13.45L59.83 10.19C59.87 10.16 59.91 10.14 59.96 10.14H62.28C62.45 10.14 62.54 10.34 62.42 10.46L59.3 13.63L62.8 18.07C62.9 18.2 62.81 18.39 62.65 18.39H60.24C60.18 18.39 60.13 18.36 60.09 18.31L57.67 15.32C57.6 15.23 57.47 15.22 57.39 15.3L56.39 16.29V18.19C56.39 18.3 56.3 18.39 56.2 18.39H54.19C54.08 18.39 54 18.3 54 18.19V7.2C54 7.09 54.08 7.01 54.19 7.01H56.2ZM48.37 11.96C47.78 11.96 47.24 12.21 46.85 12.6C46.46 13 46.22 13.54 46.22 14.14C46.22 14.73 46.46 15.28 46.85 15.67C47.24 16.07 47.78 16.31 48.37 16.31H48.66C49.25 16.31 49.79 16.07 50.18 15.67C50.57 15.28 50.81 14.73 50.81 14.14C50.81 13.54 50.57 12.99 50.18 12.6C49.79 12.21 49.25 11.96 48.66 11.96H48.37Z`})]})}2*Math.PI*11;function i(t){return e(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M8 0C12.42 0 16 3.58 16 8C16 12.42 12.42 16 8 16C3.58 16 0 12.42 0 8C0 3.58 3.58 0 8 0ZM8 1.5C4.41 1.5 1.5 4.41 1.5 8C1.5 11.59 4.41 14.5 8 14.5C11.59 14.5 14.5 11.59 14.5 8C14.5 4.41 11.59 1.5 8 1.5ZM8.1 10.21C8.82 10.21 9.24 10.63 9.24 11.33C9.24 12.03 8.82 12.46 8.1 12.46C7.36 12.46 6.97 12.03 6.97 11.33C6.97 10.63 7.36 10.21 8.1 10.21ZM8.85 3.54C9.01 3.54 9.15 3.68 9.15 3.84V4.75L8.84 8.37C8.83 8.53 8.7 8.65 8.54 8.65H7.63C7.47 8.65 7.34 8.52 7.33 8.37L7.08 4.75V3.84C7.09 3.68 7.22 3.54 7.38 3.54H8.85Z`,fill:`currentColor`})})}function a(t){return e(`svg`,{viewBox:`0 0 100 100`,fill:`none`,"aria-hidden":`true`,...t,children:[e(`circle`,{cx:`38`,cy:`28`,r:`23`,fill:`#FFF533`}),e(`path`,{d:`M50 38C30 10 12 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`path`,{d:`M50 38C70 10 88 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`rect`,{x:`10`,y:`38`,width:`80`,height:`16`,rx:`2`,stroke:`#222222`,"stroke-width":`4`}),e(`path`,{d:`M15 54V89C15 90.6 16.4 92 18 92H82C83.6 92 85 90.6 85 89V54`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`line`,{x1:`50`,y1:`54`,x2:`50`,y2:`92`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`})]})}export{t as a,n as i,i as n,r,a as t};
1
+ import{m as e}from"./defaults.CmUvOlLQ.js";function t(t){return e(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M7.33 0C11.38 0 14.67 3.28 14.67 7.33C14.67 11.38 11.38 14.67 7.33 14.67C3.28 14.67 0 11.38 0 7.33C0 3.28 3.28 0 7.33 0ZM10.39 4.28C10.15 4.04 9.76 4.04 9.52 4.28L7.33 6.47L5.14 4.28C4.9 4.04 4.52 4.04 4.28 4.28C4.04 4.52 4.04 4.9 4.28 5.14L6.47 7.33L4.28 9.52C4.04 9.76 4.04 10.15 4.28 10.39C4.52 10.63 4.9 10.63 5.14 10.39L7.33 8.2L9.52 10.39C9.76 10.63 10.15 10.63 10.39 10.39C10.63 10.15 10.63 9.76 10.39 9.52L8.2 7.33L10.39 5.14C10.63 4.9 10.63 4.52 10.39 4.28Z`,fill:`currentColor`})})}function n(t){return e(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M5.46 0C5.76 0 6 0.24 6 0.55C6 0.85 5.76 1.09 5.46 1.09H4.36C3.05 1.09 2.28 1.36 1.82 1.82C1.36 2.28 1.09 3.05 1.09 4.36V7.64C1.09 8.95 1.36 9.72 1.82 10.18C2.28 10.64 3.05 10.91 4.36 10.91H7.64C8.95 10.91 9.72 10.64 10.18 10.18C10.64 9.72 10.91 8.95 10.91 7.64V6.55C10.91 6.24 11.15 6 11.46 6C11.76 6 12 6.24 12 6.55V7.64C12 9.05 11.72 10.19 10.95 10.95C10.19 11.72 9.05 12 7.64 12H4.36C2.95 12 1.81 11.72 1.05 10.95C0.28 10.19 6.04e-05 9.05 0 7.64V4.36C0 2.95 0.28 1.81 1.05 1.05C1.81 0.28 2.95 0 4.36 0H5.46ZM11.45 0C11.76 2.2e-05 12 0.24 12 0.55V3.16C12 3.47 11.76 3.71 11.45 3.71C11.15 3.71 10.91 3.46 10.91 3.16V1.86L6.93 5.84C6.72 6.05 6.37 6.05 6.16 5.84C5.95 5.63 5.95 5.28 6.16 5.07L10.14 1.09H8.84C8.54 1.09 8.29 0.85 8.29 0.55C8.29 0.24 8.53 0 8.84 0H11.45Z`,fill:`currentColor`})})}function r(t){return e(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t.width??`63`,height:t.height??`24`,fill:`none`,viewBox:`0 0 63 24`,...t,children:[e(`title`,{children:`Frak`}),e(`rect`,{width:`24`,height:`24`,rx:`6`,fill:`#0043EF`}),e(`path`,{fill:`white`,d:`M9.77 15.91L5.15 14.35C5.06 14.32 4.97 14.38 4.97 14.47V17.33C4.97 17.39 5.01 17.44 5.06 17.46L9.68 19.02C9.77 19.05 9.86 18.98 9.86 18.89V16.04C9.86 15.98 9.82 15.93 9.77 15.91ZM14.58 10.44L9.95 12C9.9 12.02 9.86 12.07 9.86 12.13V14.98C9.86 15.08 9.95 15.14 10.04 15.11L14.66 13.55C14.72 13.53 14.76 13.48 14.76 13.42V10.57C14.76 10.47 14.66 10.41 14.58 10.44ZM18.92 5.02L11.18 7.51C11.12 7.53 11.08 7.58 11.08 7.64V10.57C11.08 10.62 11.14 10.66 11.2 10.65L18.94 8.15C18.99 8.14 19.03 8.08 19.03 8.02V5.1C19.03 5.04 18.97 5 18.92 5.02Z`}),e(`path`,{fill:`currentColor`,d:`M52.72 9.51C52.83 9.51 52.91 9.6 52.91 9.7L52.84 18.21C52.84 18.31 52.76 18.39 52.66 18.39L52.64 18.39H51.3C51.15 18.39 50.78 18.25 50.39 18C49.86 18.25 49.27 18.39 48.64 18.39H48.39C47.24 18.39 46.19 17.91 45.43 17.14C44.67 16.38 44.2 15.32 44.2 14.15C44.2 12.98 44.67 11.92 45.43 11.15C46.16 10.41 47.16 9.94 48.26 9.91C49.17 9.86 49.99 9.99 50.49 10.5V9.7C50.49 9.6 50.57 9.51 50.68 9.51H52.72ZM35.35 5.62H36.96C37.09 5.62 37.19 5.72 37.19 5.85V7.81C37.19 7.94 37.09 8.04 36.96 8.04H34.92C34.32 8.04 33.63 8.64 33.63 9.25V10.61C34.26 9.98 34.93 9.65 35.35 9.63H36.46C36.59 9.63 36.69 9.73 36.69 9.86V11.82C36.69 11.95 36.59 12.05 36.46 12.05H34.92C34.31 12.05 33.63 12.65 33.63 13.27V18.2C33.63 18.3 33.54 18.39 33.44 18.39H31.39C31.29 18.39 31.21 18.3 31.21 18.2V9.94C31.21 9.87 31.2 9.8 31.2 9.73C31.24 8.88 31.15 5.44 35.35 5.62ZM39.93 9.63C40.04 9.63 40.12 9.72 40.12 9.82V10.61C40.76 9.98 41.58 9.63 41.85 9.63H43.46C43.58 9.63 43.68 9.73 43.69 9.86V11.82C43.68 11.95 43.58 12.05 43.46 12.05H41.41C40.81 12.05 40.12 12.65 40.12 13.27V18.2C40.12 18.3 40.04 18.39 39.93 18.39H37.89C37.79 18.39 37.7 18.3 37.7 18.2V9.82C37.7 9.72 37.79 9.63 37.89 9.63H39.93ZM56.2 7.01C56.3 7.01 56.39 7.09 56.39 7.2V13.45L59.83 10.19C59.87 10.16 59.91 10.14 59.96 10.14H62.28C62.45 10.14 62.54 10.34 62.42 10.46L59.3 13.63L62.8 18.07C62.9 18.2 62.81 18.39 62.65 18.39H60.24C60.18 18.39 60.13 18.36 60.09 18.31L57.67 15.32C57.6 15.23 57.47 15.22 57.39 15.3L56.39 16.29V18.19C56.39 18.3 56.3 18.39 56.2 18.39H54.19C54.08 18.39 54 18.3 54 18.19V7.2C54 7.09 54.08 7.01 54.19 7.01H56.2ZM48.37 11.96C47.78 11.96 47.24 12.21 46.85 12.6C46.46 13 46.22 13.54 46.22 14.14C46.22 14.73 46.46 15.28 46.85 15.67C47.24 16.07 47.78 16.31 48.37 16.31H48.66C49.25 16.31 49.79 16.07 50.18 15.67C50.57 15.28 50.81 14.73 50.81 14.14C50.81 13.54 50.57 12.99 50.18 12.6C49.79 12.21 49.25 11.96 48.66 11.96H48.37Z`})]})}2*Math.PI*11;function i(t){return e(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M8 0C12.42 0 16 3.58 16 8C16 12.42 12.42 16 8 16C3.58 16 0 12.42 0 8C0 3.58 3.58 0 8 0ZM8 1.5C4.41 1.5 1.5 4.41 1.5 8C1.5 11.59 4.41 14.5 8 14.5C11.59 14.5 14.5 11.59 14.5 8C14.5 4.41 11.59 1.5 8 1.5ZM8.1 10.21C8.82 10.21 9.24 10.63 9.24 11.33C9.24 12.03 8.82 12.46 8.1 12.46C7.36 12.46 6.97 12.03 6.97 11.33C6.97 10.63 7.36 10.21 8.1 10.21ZM8.85 3.54C9.01 3.54 9.15 3.68 9.15 3.84V4.75L8.84 8.37C8.83 8.53 8.7 8.65 8.54 8.65H7.63C7.47 8.65 7.34 8.52 7.33 8.37L7.08 4.75V3.84C7.09 3.68 7.22 3.54 7.38 3.54H8.85Z`,fill:`currentColor`})})}function a(t){return e(`svg`,{viewBox:`0 0 100 100`,fill:`none`,"aria-hidden":`true`,...t,children:[e(`circle`,{cx:`38`,cy:`28`,r:`23`,fill:`#FFF533`}),e(`path`,{d:`M50 38C30 10 12 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`path`,{d:`M50 38C70 10 88 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`rect`,{x:`10`,y:`38`,width:`80`,height:`16`,rx:`2`,stroke:`#222222`,"stroke-width":`4`}),e(`path`,{d:`M15 54V89C15 90.6 16.4 92 18 92H82C83.6 92 85 90.6 85 89V54`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`line`,{x1:`50`,y1:`54`,x2:`50`,y2:`92`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`})]})}export{t as a,n as i,i as n,r,a as t};
@@ -1 +1 @@
1
- import{C as e,_ as t,d as n,g as r}from"./loader.js";import{a as i,h as a,m as o,n as s,s as c,t as l,u}from"./defaults.CT8FNvot.js";import{t as d}from"./useLightDomStyles.CZ1iTaa9.js";function f(r=`wallet`,i){let a=window.FrakSetup?.client;a&&e(a,`open_in_app_clicked`,{path:r,placement:i});let o=`${t}${r}`;n(o,{onFallback:()=>{a&&e(a,`app_not_installed`,{path:r,placement:i})}})}function p(){return{isMobile:u(()=>r(),[])}}function m({placement:e,text:t,classname:n=``}){let r=i(),a=s(e),{shouldRender:u,isHidden:m,isClientReady:h}=c(),{isMobile:g}=p();d(`frak-open-in-app`,e,a?.components?.openInApp?.css);let _=a?.components?.openInApp?.text??t??l[r].openInApp.text;if(!g||!u||m)return null;let v=()=>{f(void 0,e)},y=[`button`,`button__fadeIn`,n].filter(Boolean).join(` `);return o(`button`,{type:`button`,"aria-label":l[r].openInApp.ariaLabel,disabled:!h,class:y,onClick:v,children:_})}a(m,`frak-open-in-app`,[`text`,`placement`,`classname`],{shadow:!1});export{m as OpenInAppButton};
1
+ import{S as e,g as t,h as n,u as r}from"./loader.js";import{a as i,h as a,m as o,n as s,s as c,t as l,u}from"./defaults.CmUvOlLQ.js";import{t as d}from"./useLightDomStyles.BLyrWEBn.js";function f(n=`wallet`,i){let a=window.FrakSetup?.client;a&&e(a,`open_in_app_clicked`,{path:n,placement:i});let o=`${t}${n}`;r(o,{onFallback:()=>{a&&e(a,`app_not_installed`,{path:n,placement:i})}})}function p(){return{isMobile:u(()=>n(),[])}}function m({placement:e,text:t,classname:n=``}){let r=i(),a=s(e),{shouldRender:u,isHidden:m,isClientReady:h}=c(),{isMobile:g}=p();d(`frak-open-in-app`,e,a?.components?.openInApp?.css);let _=a?.components?.openInApp?.text??t??l[r].openInApp.text;if(!g||!u||m)return null;let v=()=>{f(void 0,e)},y=[`button`,`button__fadeIn`,n].filter(Boolean).join(` `);return o(`button`,{type:`button`,"aria-label":l[r].openInApp.ariaLabel,disabled:!h,class:y,onClick:v,children:_})}a(m,`frak-open-in-app`,[`text`,`placement`,`classname`],{shadow:!1});export{m as OpenInAppButton};
@@ -0,0 +1,89 @@
1
+ import{O as e,S as t,T as n,c as r,i,l as a,o,r as s,w as ee}from"./loader.js";import{a as te,d as c,f as l,h as u,l as d,m as f,n as p,p as m,s as h,t as ne,u as g}from"./defaults.CmUvOlLQ.js";import{r as re,t as ie}from"./GiftIcon.CPyeWQNR.js";import{t as ae}from"./useGlobalComponents.C7wnXWOg.js";import{t as oe}from"./useLightDomStyles.BLyrWEBn.js";import{i as _,n as v,t as se}from"./rewards.DjfrchZd.js";var ce=`PostPurchase_card__5fv5lh0`,le=`PostPurchase_cardLayout__5fv5lh1`,ue=`PostPurchase_cardLeft__5fv5lh2`,de=`PostPurchase_cardRight__5fv5lh3`,fe=`PostPurchase_cta__5fv5lh6 sharedBaseCss_buttonReset__7cswil0`,y=`PostPurchase_customImage__5fv5lha`,b=`PostPurchase_frakLogo__5fv5lhb`,pe=`PostPurchase_giftIcon__5fv5lh8`,me=`PostPurchase_icon__5fv5lh7`,he=`PostPurchase_imageWrapper__5fv5lh9`,ge=`PostPurchase_message__5fv5lh5`;function _e(e,t,n,r){let i=e?.isReferred?`referee`:`referrer`,a=v(t.rewards,{targetInteraction:`purchase`,currency:n,audience:i,products:r});if(!a)return null;let{campaign:o}=a,s=e?.isReferred&&o.referee?`referee`:`referrer`;return{variant:s,reward:s===`referee`?o.referee:o.referrer,merchantDomain:t.onChainMetadata.domain}}function x({customerId:u,orderId:v,token:x,sharingUrl:ve,merchantId:S,placement:C,classname:w=``,variant:T,badgeText:E,referrerText:D,refereeText:O,ctaText:k,preview:A,previewVariant:j,products:M,imageUrl:N}){let P=!!A,{shouldRender:F,isHidden:I,isClientReady:L}=h(),R=p(C),z=te(),B=g(()=>a(M),[M]);oe(`frak-post-purchase`,C,R?.components?.postPurchase?.css,`.PostPurchase_card__5fv5lh0 {
2
+ padding: 16px;
3
+ border-radius: 12px;
4
+ background-color: var(--surface-background__pbq4akc);
5
+ border: 1px solid var(--border-default__pbq4akv);
6
+ }
7
+ .PostPurchase_cardLayout__5fv5lh1 {
8
+ display: flex;
9
+ flex-direction: row;
10
+ align-items: center;
11
+ gap: 32px;
12
+ }
13
+ .PostPurchase_cardLeft__5fv5lh2 {
14
+ flex-grow: 1;
15
+ min-width: 0;
16
+ display: flex;
17
+ flex-direction: column;
18
+ gap: 8px;
19
+ }
20
+ .PostPurchase_cardRight__5fv5lh3 {
21
+ flex-shrink: 0;
22
+ display: flex;
23
+ flex-direction: column;
24
+ align-items: flex-end;
25
+ gap: 8px;
26
+ text-align: right;
27
+ }
28
+ .PostPurchase_badge__5fv5lh4 {
29
+ align-self: flex-start;
30
+ background-color: #FFF534;
31
+ border-radius: 4px;
32
+ padding: 4px 8px;
33
+ font-size: 12px;
34
+ font-weight: 600;
35
+ line-height: 12px;
36
+ color: var(--text-primary__pbq4ak0);
37
+ }
38
+ .PostPurchase_message__5fv5lh5 {
39
+ margin: 0;
40
+ font-size: 16px;
41
+ line-height: 22px;
42
+ color: var(--text-primary__pbq4ak0);
43
+ font-weight: 600;
44
+ }
45
+ .PostPurchase_cta__5fv5lh6 {
46
+ display: inline-flex;
47
+ align-items: center;
48
+ justify-content: center;
49
+ gap: 4px;
50
+ padding: 12px 16px;
51
+ border-radius: 9999px;
52
+ background-color: var(--text-primary__pbq4ak0);
53
+ color: var(--text-onAction__pbq4ak6);
54
+ font-size: 12px;
55
+ font-weight: bold;
56
+ text-transform: uppercase;
57
+ }
58
+ .PostPurchase_cta__5fv5lh6:disabled {
59
+ opacity: 0.7;
60
+ cursor: default;
61
+ }
62
+ .PostPurchase_icon__5fv5lh7 {
63
+ margin: -2px 0;
64
+ }
65
+ .PostPurchase_giftIcon__5fv5lh8 {
66
+ display: block;
67
+ flex-shrink: 0;
68
+ }
69
+ .PostPurchase_imageWrapper__5fv5lh9 {
70
+ flex-shrink: 0;
71
+ display: flex;
72
+ align-items: center;
73
+ justify-content: center;
74
+ width: 80px;
75
+ height: 80px;
76
+ overflow: hidden;
77
+ }
78
+ .PostPurchase_customImage__5fv5lha {
79
+ max-width: 100%;
80
+ max-height: 100%;
81
+ width: auto;
82
+ height: auto;
83
+ object-fit: contain;
84
+ display: block;
85
+ }
86
+ .PostPurchase_frakLogo__5fv5lhb {
87
+ display: block;
88
+ margin-left: auto;
89
+ }`,e);let[V,ye]=c(null),[H,U]=c(!1);l(()=>{P||!L||!u||!v||!x||i({customerId:u,orderId:v,token:x,merchantId:S}).catch(()=>{})},[P,L,u,v,x,S]),l(()=>{if(P||!L||H)return;let e=window.FrakSetup?.client;e&&Promise.all([o(e),r(e)]).then(([e,t])=>{U(!0),ye({referralStatus:e,merchantInfo:t})}).catch(e=>{if(e instanceof n&&e.code===ee.configError){U(!0);return}console.warn(`[Frak] Post-purchase context error`,e)})},[P,L,H]);let W=g(()=>V?_e(V.referralStatus,V.merchantInfo,window.FrakSetup?.client?.config?.metadata?.currency,B):null,[V,B]),G=d(null),K=T??W?.variant??(P?j??`referrer`:void 0),q=ve??W?.merchantDomain,J=g(()=>{if(!W?.reward)return;let e=window.FrakSetup?.client?.config?.metadata?.currency;return se(W.reward,e)},[W?.reward]),Y=ae(),X=R?.components?.postPurchase??Y?.postPurchase,Z=E??X?.badgeText,Q=N??X?.imageUrl,$=g(()=>{let e=ne[z].postPurchase;return{message:K===`referee`?J?_(O??X?.refereeText??e.refereeText,J):O??X?.refereeNoRewardText??e.refereeNoRewardText:J?_(D??X?.referrerText??e.referrerText,J):D??X?.referrerNoRewardText??e.referrerNoRewardText,cta:J?_(k??X?.ctaText??e.ctaText,J):k??X?.ctaNoRewardText??e.ctaNoRewardText}},[z,K,J,X,D,O,k]);l(()=>{K&&G.current!==K&&L&&(!P&&(!F||I)||(t(window.FrakSetup?.client,`post_purchase_impression`,{placement:C,variant:K,has_reward:!!W?.reward}),G.current=K))},[K,F,I,L,P,C,W?.reward]);let be=m(()=>{K&&(t(window.FrakSetup?.client,`post_purchase_clicked`,{placement:C,variant:K}),s(void 0,C,{link:q,products:B,checkoutToken:x}))},[K,C,q,B,x]);if(!K||!P&&(!F||I||!W))return null;let xe=[ce,w].filter(Boolean).join(` `);return f(`div`,{className:xe,children:f(`div`,{class:le,children:[f(`div`,{class:ue,children:[Z&&f(`span`,{class:`PostPurchase_badge__5fv5lh4`,children:Z}),f(`p`,{class:ge,children:$.message}),f(`button`,{type:`button`,className:`${fe} button`,disabled:!P&&!L,onClick:P?void 0:be,children:[$.cta,f(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`${me} button`,children:f(`path`,{d:`M13.9 11.14C13.99 11.05 14.15 11.11 14.15 11.24V11.64C14.15 13.05 12.63 14.19 10.75 14.19C8.87 14.19 7.34 13.05 7.34 11.64V11.24C7.34 11.11 7.51 11.05 7.59 11.14C8.35 11.93 9.48 12.43 10.75 12.43C12.01 12.43 13.15 11.93 13.9 11.14ZM1.85 9.65C1.85 9.51 2.01 9.44 2.1 9.54C2.85 10.32 3.99 10.82 5.25 10.82C5.52 10.82 5.79 10.8 6.04 10.76C6.26 10.72 6.47 10.88 6.47 11.1V12.17C6.47 12.32 6.37 12.45 6.22 12.48C5.92 12.55 5.59 12.59 5.25 12.59C3.37 12.59 1.85 11.45 1.85 10.04V9.65ZM10.75 6.21C12.63 6.21 14.15 7.35 14.15 8.75C14.15 10.16 12.63 11.3 10.75 11.3C8.87 11.3 7.34 10.16 7.34 8.75C7.34 7.35 8.87 6.21 10.75 6.21ZM1.85 6.85C1.85 6.71 2.01 6.65 2.1 6.74C2.85 7.53 3.99 8.03 5.25 8.03C5.52 8.03 5.79 8 6.04 7.96C6.26 7.92 6.47 8.09 6.47 8.3V9.37C6.47 9.52 6.37 9.65 6.22 9.69C5.92 9.75 5.59 9.79 5.25 9.79C3.37 9.79 1.85 8.65 1.85 7.24V6.85ZM5.25 1.81C7.13 1.81 8.66 2.95 8.66 4.36C8.66 5.76 7.13 6.9 5.25 6.9C3.37 6.9 1.85 5.76 1.85 4.36C1.85 2.95 3.37 1.81 5.25 1.81Z`,fill:`currentColor`})})]})]}),f(`div`,{class:de,children:[Q?f(`span`,{class:he,children:f(`img`,{src:Q,alt:``,class:y})}):f(ie,{className:pe,width:80,height:80}),f(re,{className:b,width:42,height:24})]})]})})}u(x,`frak-post-purchase`,[`customerId`,`orderId`,`token`,`sharingUrl`,`merchantId`,`placement`,`classname`,`variant`,`badgeText`,`referrerText`,`refereeText`,`ctaText`,`products`,`preview`,`previewVariant`,`imageUrl`],{shadow:!1});export{x as PostPurchase};
package/cdn/components.js CHANGED
@@ -1 +1 @@
1
- import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@beta/cdn/loader.js?v=1787903434185`);
1
+ import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@beta/cdn/loader.js?v=1788426982705`);
@@ -0,0 +1,58 @@
1
+ import{C as e,E as t,d as n,n as r,t as i}from"./loader.js";var a,o,s,c,l,u,d,f,p,m,h,g,_,v,y={},b=[],x=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,S=Array.isArray;function C(e,t){for(var n in t)e[n]=t[n];return e}function w(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function T(e,t,n){var r,i,o,s={};for(o in t)o==`key`?r=t[o]:o==`ref`?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return E(e,s,r,i,null)}function E(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++s,__i:-1,__u:0};return i==null&&o.vnode!=null&&o.vnode(a),a}function D(e){return e.children}function O(e,t){this.props=e,this.context=t}function k(e,t){if(t==null)return e.__?k(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?k(e):null}function A(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=C({},t);a.__v=t.__v+1,o.vnode&&o.vnode(a),L(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??k(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,oe(r,a,i),t.__e=t.__=null,a.__e!=n&&j(a)}}function j(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),j(e)}function M(e){(!e.__d&&(e.__d=!0)&&c.push(e)&&!N.__r++||l!=o.debounceRendering)&&((l=o.debounceRendering)||u)(N)}function N(){try{for(var e,t=1;c.length;)c.length>t&&c.sort(d),e=c.shift(),t=c.length,A(e)}finally{c.length=N.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r&&r.__k||b,v=t.length;for(c=P(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&_[p.__i]||y,p.__i=d,g=L(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&R(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),4&p.__u?(c=te(p,c,e),f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function P(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=E(null,o,null,null,null):S(o)?o=e.__k[a]=E(D,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=E(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=ne(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=k(s)),le(s,s));return r}function te(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=te(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=k(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function F(e,t){return t||=[],e==null||typeof e==`boolean`||(S(e)?e.some(function(e){F(e,t)}):t.push(e)),t}function ne(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function re(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||x.test(t)?n:n+`px`}function I(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||re(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||re(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(h,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[m]=r[m]:(n[m]=g,e.addEventListener(t,a?v:_,a)):e.removeEventListener(t,a?v:_,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ie(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[p]==null)t[p]=g++;else if(t[p]<n[m])return;return n(o.event?o.event(t):t)}}}function L(e,t,n,r,i,a,s,c,l,u){var d,f,p,m,h,g,_,v,y,x,T,E,A,j,M,N,P=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),a=[c=t.__e=n.__e]),(d=o.__b)&&d(t);n:if(typeof P==`function`){f=s.length;try{if(y=t.props,x=P.prototype&&P.prototype.render,T=(d=P.contextType)&&r[d.__c],E=d?T?T.props.value:d.__:r,n.__c?v=(p=t.__c=n.__c).__=p.__E:(x?t.__c=p=new P(y,E):(t.__c=p=new O(y,E),p.constructor=P,p.render=ue),T&&T.sub(p),p.state||(p.state={}),p.__n=r,m=p.__d=!0,p.__h=[],p._sb=[]),x&&p.__s==null&&(p.__s=p.state),x&&P.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=C({},p.__s)),C(p.__s,P.getDerivedStateFromProps(y,p.__s))),h=p.props,g=p.state,p.__v=t,m)x&&P.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),x&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(x&&P.getDerivedStateFromProps==null&&y!==h&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(y,E),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&!1===p.shouldComponentUpdate(y,p.__s,E)){t.__v!=n.__v&&(p.props=y,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),b.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),c=k(n);break n}p.componentWillUpdate!=null&&p.componentWillUpdate(y,p.__s,E),x&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(h,g,_)})}if(p.context=E,p.props=y,p.__P=e,p.__e=!1,A=o.__r,j=0,x)p.state=p.__s,p.__d=!1,A&&A(t),d=p.render(p.props,p.state,p.context),b.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,A&&A(t),d=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++j<25);p.state=p.__s,p.getChildContext!=null&&(r=C(C({},r),p.getChildContext())),x&&!m&&p.getSnapshotBeforeUpdate!=null&&(_=p.getSnapshotBeforeUpdate(h,g)),M=d!=null&&d.type===D&&d.key==null?se(d.props.children):d,c=ee(e,S(M)?M:[M],t,n,r,i,a,s,c,l,u),p.base=t.__e,t.__u&=-161,p.__h.length&&s.push(p),v&&(p.__E=p.__=null)}catch(e){if(s.length=f,t.__v=null,l||a!=null){if(e.then){for(t.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;a!=null&&(a[a.indexOf(c)]=null),t.__e=c}else if(a!=null)for(N=a.length;N--;)w(a[N])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||ae(t),o.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=ce(n.__e,t,n,r,i,a,s,l,u);return(d=o.diffed)&&d(t),128&t.__u?void 0:c}function ae(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ae))}function oe(e,t,n){for(var r=0;r<n.length;r++)R(n[r],n[++r],n[++r]);o.__c&&o.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){o.__e(e,t.__v)}})}function se(e){return typeof e!=`object`||!e||e.__b>0?e:S(e)?e.map(se):e.constructor===void 0?C({},e):null}function ce(e,t,n,r,i,s,c,l,u){var d,f,p,m,h,g,_,v=n.props||y,b=t.props,x=t.type;if(x==`svg`?i=`http://www.w3.org/2000/svg`:x==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((h=s[d])&&`setAttribute`in h==!!x&&(x?h.localName==x:h.nodeType==3)){e=h,s[d]=null;break}}if(e==null){if(x==null)return document.createTextNode(b);e=document.createElementNS(i,x,b.is&&b),l&&=(o.__m&&o.__m(t,s),!1),s=null}if(x==null)v===b||l&&e.data==b||(e.data=b);else{if(s=x==`textarea`&&b.defaultValue!=null?null:s&&a.call(e.childNodes),!l&&s!=null)for(v={},d=0;d<e.attributes.length;d++)v[(h=e.attributes[d]).name]=h.value;for(d in v)h=v[d],d==`dangerouslySetInnerHTML`?p=h:d==`children`||d in b||d==`value`&&`defaultValue`in b||d==`checked`&&`defaultChecked`in b||I(e,d,null,h,i);for(d in b)h=b[d],d==`children`?m=h:d==`dangerouslySetInnerHTML`?f=h:d==`value`?g=h:d==`checked`?_=h:l&&typeof h!=`function`||v[d]===h||I(e,d,h,v[d],i);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=``),ee(t.type==`template`?e.content:e,S(m)?m:[m],t,n,r,x==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,s,c,s?s[0]:n.__k&&k(n,0),l,u),s!=null)for(d=s.length;d--;)w(s[d]);l&&x!=`textarea`||(d=`value`,x==`progress`&&g==null?e.removeAttribute(`value`):g!=null&&(g!==e[d]||x==`progress`&&!g||x==`option`&&g!=v[d])&&I(e,d,g,v[d],i),d=`checked`,_!=null&&_!=e[d]&&I(e,d,_,v[d],i))}return e}function R(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){o.__e(e,n)}}function le(e,t,n){var r,i;if(o.unmount&&o.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||R(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){o.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&le(r[i],t,n||typeof e.type!=`function`);n||w(e.__e),e.__c=e.__=e.__e=void 0}function ue(e,t,n){return this.constructor(e,n)}function z(e,t,n){var r,i,s,c;t==document&&(t=document.documentElement),o.__&&o.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,s=[],c=[],L(t,e=(!r&&n||t).__k=T(D,null,[e]),i||y,y,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?a.call(t.childNodes):null,s,!r&&n?n:i?i.__e:t.firstChild,r,c),oe(s,e,c),e.props.children=null}function de(e,t){z(e,t,de)}function fe(e,t,n){var r,i,o,s,c=C({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)o==`key`?r=t[o]:o==`ref`?i=t[o]:c[o]=t[o]===void 0&&s!=null?s[o]:t[o];return arguments.length>2&&(c.children=arguments.length>3?a.call(arguments,2):n),E(e.type,c,r||e.key,i||e.ref,null)}a=b.slice,o={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},s=0,O.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=C({},this.state);typeof e==`function`&&(e=e(C({},n),this.props)),e&&C(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),M(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),M(this))},O.prototype.render=D,c=[],u=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,d=function(e,t){return e.__v.__b-t.__v.__b},N.__r=0,f=Math.random().toString(8),p=`__d`+f,m=`__a`+f,h=/(PointerCapture)$|Capture$/i,g=0,_=ie(!1),v=ie(!0);function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(this,arguments)}function pe(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var me=[`context`,`children`],he=[`useFragment`];function ge(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){ve.call(this,r)},i.prototype.attributeChangedCallback=be,i.prototype.disconnectedCallback=xe,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function _e(e){this.getChildContext=function(){return e.context};var t=e.children;return fe(t,pe(e,me))}function ve(e){var t=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=T(_e,B({},this._props,{context:t.detail.context}),Ce(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?de:z)(this._vdom,this._root)}function ye(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function be(e,t,n){if(this._vdom){var r={};r[e]=n??=void 0,r[ye(e)]=n,this._vdom=fe(this._vdom,r),z(this._vdom,this._root)}}function xe(){z(this._vdom=null,this._root)}function Se(e,t){var n=this,r=e.useFragment,i=pe(e,he);return T(r?D:`slot`,B({},i,{ref:function(e){e?(n.ref=e,n._listener||(n._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,n._listener))):n.ref.removeEventListener(`_preact`,n._listener)}}))}function Ce(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[ye(o[a].name)]=o[a].value);for(a=s.length;a--;){var c=Ce(s[a],null,n),l=s[a].slot;l?i[l]=T(Se,{name:l},c):r[a]=c}var u=!(!n||!n.shadow),d=t?T(Se,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=``),T(t||e.nodeName.toLowerCase(),i,d)}function we(e,n,r=[],a={shadow:!0}){typeof window<`u`&&(t(i),customElements.get(n)||ge(e,n,r,a))}var Te=0;Array.isArray;function Ee(e,t,n,r,i,a){t||={};var s,c,l=t;if(`ref`in l)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Te,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return o.vnode&&o.vnode(u),u}var V,H,U,De,W=0,Oe=[],G=o,ke=G.__b,Ae=G.__r,je=G.diffed,Me=G.__c,Ne=G.unmount,Pe=G.__;function K(e,t){G.__h&&G.__h(H,e,W||t),W=0;var n=H.__H||(H.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function q(e){return W=1,Fe(He,e)}function Fe(e,t,n){var r=K(V++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):He(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=H,!H.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};H.__f=!0;var a=H.shouldComponentUpdate,o=H.componentWillUpdate;H.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},H.shouldComponentUpdate=i}return r.__N||r.__}function J(e,t){var n=K(V++,3);!G.__s&&Q(n.__H,t)&&(n.__=e,n.u=t,H.__H.__h.push(n))}function Ie(e,t){var n=K(V++,4);!G.__s&&Q(n.__H,t)&&(n.__=e,n.u=t,H.__h.push(n))}function Le(e){return W=5,Y(function(){return{current:e}},[])}function Y(e,t){var n=K(V++,7);return Q(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Re(e,t){return W=8,Y(function(){return e},t)}function ze(){for(var e;e=Oe.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(X),t.__h.some(Z),t.__h=[]}catch(n){t.__h=[],G.__e(n,e.__v)}}}G.__b=function(e){H=null,ke&&ke(e)},G.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Pe&&Pe(e,t)},G.__r=function(e){Ae&&Ae(e),V=0;var t=(H=e.__c).__H;t&&(U===H?(t.__h=[],H.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(X),t.__h.some(Z),t.__h=[],V=0)),U=H},G.diffed=function(e){je&&je(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Oe.push(t)!==1&&De===G.requestAnimationFrame||((De=G.requestAnimationFrame)||Ve)(ze)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),U=H=null},G.__c=function(e,t){t.some(function(e){try{e.__h.some(X),e.__h=e.__h.filter(function(e){return!e.__||Z(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],G.__e(n,e.__v)}}),Me&&Me(e,t)},G.unmount=function(e){Ne&&Ne(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{X(e)}catch(e){t=e}}),n.__H=void 0,t&&G.__e(t,n.__v))};var Be=typeof requestAnimationFrame==`function`;function Ve(e){var t,n=function(){clearTimeout(r),Be&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Be&&(t=requestAnimationFrame(n))}function X(e){var t=H,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),H=t}function Z(e){var t=H;e.__c=e.__(),H=t}function Q(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function He(e,t){return typeof t==`function`?t(e):t}function Ue(e,t){for(var n in t)e[n]=t[n];return e}function We(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Ge(e,t){var n=t(),r=q({t:{__:n,u:t}}),i=r[0].t,a=r[1];return Ie(function(){i.__=n,i.u=t,Ke(i)&&a({t:i})},[e,n,t]),J(function(){return Ke(i)&&a({t:i}),e(function(){Ke(i)&&a({t:i})})},[e]),n}function Ke(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function qe(e,t){this.props=e,this.context=t}(qe.prototype=new O).isPureReactComponent=!0,qe.prototype.shouldComponentUpdate=function(e,t){return We(this.props,e)||We(this.state,t)};var Je=o.__b;o.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Je&&Je(e)},typeof Symbol<`u`&&Symbol.for;var Ye=o.__e;o.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}Ye(e,t,n,r)};var Xe=o.unmount;function Ze(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=Ue({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Ze(e,t,n)})),e}function Qe(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Qe(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function $e(){this.__u=0,this.o=null,this.__b=null}function et(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function $(){this.i=null,this.l=null}o.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Xe&&Xe(e)},($e.prototype=new O).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=et(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Qe(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},$e.prototype.componentWillUnmount=function(){this.o=[]},$e.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=Ze(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&T(D,null,e.fallback);return i&&(i.__u&=-33),[T(D,null,t.__a?null:e.children),i]};var tt=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};($.prototype=new O).__a=function(e){var t=this,n=et(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),tt(t,e,r)):i()};n?n(a):a()}},$.prototype.render=function(e){this.i=null,this.l=new Map;var t=F(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},$.prototype.componentDidUpdate=$.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){tt(e,n,t)})};var nt=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,rt=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,it=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,at=/[A-Z0-9]/g,ot=typeof document<`u`,st=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};O.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(O.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ct=o.event;o.event=function(e){return ct&&(e=ct(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var lt={configurable:!0,get:function(){return this.class}},ut=o.vnode;o.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||ot&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||st(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:it.test(a)&&(a=s):s=a=`oninput`:i&&rt.test(a)?a=a.replace(at,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=F(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=F(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",lt)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=nt,ut&&ut(e)};var dt=o.__r;o.__r=function(e){dt&&dt(e),e.__c};var ft=o.diffed;o.diffed=function(e){ft&&ft(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};function pt(){let[t,n]=q(()=>window.FrakSetup?.config?.waitForBackendConfig===!1||e.isResolved),[i,a]=q(()=>e.getConfig().hidden??!1),[o,s]=q(()=>!!window.FrakSetup?.client);return J(()=>{let t=e.getConfig();t.isResolved&&(n(!0),a(t.hidden??!1)),window.FrakSetup?.client&&s(!0);let i=e=>{let t=e.detail;t.isResolved&&n(!0),a(t.hidden??!1)};window.addEventListener(`frak:config`,i);let o=()=>s(!0);return r(`add`,o),()=>{window.removeEventListener(`frak:config`,i),r(`remove`,o)}},[]),{shouldRender:t,isHidden:i,isClientReady:o}}function mt(e){return typeof window>`u`?()=>{}:(window.addEventListener(`frak:config`,e),()=>window.removeEventListener(`frak:config`,e))}function ht(){return Ge(mt,()=>e.getConfig().lang??n()??`en`)}const gt=`
2
+ :host {
3
+ display: contents;
4
+ }
5
+
6
+ :host([hidden]) {
7
+ display: none;
8
+ }
9
+
10
+ .button:disabled {
11
+ opacity: 0.7;
12
+ cursor: default;
13
+ }
14
+
15
+ .button__fadeIn {
16
+ animation: frak-fadeIn 300ms ease-in;
17
+ }
18
+
19
+ @keyframes frak-fadeIn {
20
+ from {
21
+ opacity: 0;
22
+ }
23
+
24
+ to {
25
+ opacity: 1;
26
+ }
27
+ }
28
+ `;function _t(e,t){return t?`${gt}\n${e}\n${t}`:`${gt}\n${e}`}const vt=`
29
+ :where(frak-button-share, frak-open-in-app) {
30
+ display: contents;
31
+ }
32
+
33
+ :where(frak-button-share .button, frak-open-in-app .button) {
34
+ display: flex;
35
+ align-items: center;
36
+ justify-content: center;
37
+ gap: 10px;
38
+ }
39
+
40
+ :where(frak-button-share .button:disabled, frak-open-in-app .button:disabled) {
41
+ opacity: 0.7;
42
+ cursor: default;
43
+ }
44
+
45
+ :where(frak-button-share .button__fadeIn, frak-open-in-app .button__fadeIn) {
46
+ animation: frak-fadeIn 300ms ease-in;
47
+ }
48
+
49
+ @keyframes frak-fadeIn {
50
+ from {
51
+ opacity: 0;
52
+ }
53
+
54
+ to {
55
+ opacity: 1;
56
+ }
57
+ }
58
+ `;function yt(t){return e.getConfig().placements?.[t]}function bt(e){return Ge(mt,Re(()=>e?yt(e):void 0,[e]))}const xt={en:{buttonShare:{text:`Share & earn {REWARD}!`},postPurchase:{refereeText:`You just earned {REWARD}! Share with friends to earn even more.`,refereeNoRewardText:`You just earned a reward! Share with friends to earn even more.`,referrerText:`Earn {REWARD} by sharing this with your friends!`,referrerNoRewardText:`Share this with your friends and earn rewards!`,ctaText:`Share & earn {REWARD}`,ctaNoRewardText:`Share & earn`},openInApp:{text:`Open in App`,ariaLabel:`Open in Frak Wallet app`},buttonWallet:{ariaLabel:`Share and earn rewards`},banner:{referralTitleReward:`Earn {REWARD} on purchases`,referralTitle:`You've been referred!`,referralDescription:`Earn rewards after your purchase via the Frak partner app.`,referralCta:`Got it`,inappTitle:`Open in your browser`,inappDescription:`For a better experience and to earn your rewards, open this page in your default browser.`,inappCta:`Open browser`,dismissLabel:`Dismiss`}},fr:{buttonShare:{text:`Partagez et gagnez {REWARD} !`},postPurchase:{refereeText:`Vous venez de gagner {REWARD} ! Partagez avec vos amis pour gagner encore plus.`,refereeNoRewardText:`Vous venez de gagner une récompense ! Partagez avec vos amis pour gagner encore plus.`,referrerText:`Gagnez {REWARD} en partageant avec vos amis !`,referrerNoRewardText:`Partagez avec vos amis et gagnez des récompenses !`,ctaText:`Partagez et gagnez {REWARD}`,ctaNoRewardText:`Partagez et gagnez`},openInApp:{text:`Ouvrir dans l'app`,ariaLabel:`Ouvrir dans l'app Frak Wallet`},buttonWallet:{ariaLabel:`Partagez et gagnez des récompenses`},banner:{referralTitleReward:`Gagnez {REWARD} sur vos achats`,referralTitle:`Vous avez été parrainé !`,referralDescription:`Gagnez des récompenses après votre achat via l'application partenaire Frak.`,referralCta:`J'ai compris`,inappTitle:`Ouvrez dans votre navigateur`,inappDescription:`Pour une meilleure expérience et pour gagner vos récompenses, ouvrez cette page dans votre navigateur par défaut.`,inappCta:`Ouvrir le navigateur`,dismissLabel:`Fermer`}}};export{ht as a,Ge as c,q as d,J as f,D as g,we as h,vt as i,Le as l,Ee as m,bt as n,mt as o,Re as p,_t as r,pt as s,xt as t,Y as u};
package/cdn/loader.js CHANGED
@@ -165,4 +165,4 @@ super(e)}},_tlv:{encode:(e,t)=>{let{Err:n}=V;if(Ne(e,`tag`),e<0||e>255)throw new
165
165
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
166
166
  const on=an(en({p:BigInt(`0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff`),n:BigInt(`0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551`),h:BigInt(1),a:BigInt(`0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc`),b:BigInt(`0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b`),Gx:BigInt(`0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296`),Gy:BigInt(`0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5`)}),be),sn=`pkcs8`,cn=sn,ln=`spki`
167
167
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
168
- ;function W(){let e=globalThis?.crypto?.subtle;if(typeof e==`object`&&e)return e;throw Error(`crypto.subtle must be defined`)}function un(e,t){return async function(n){let r=await e();return{secretKey:r,publicKey:await t(r)}}}function dn(e){let t=e.match(/[0-9a-f]{2}/gi);if(!t||t.length*2!==e.length)throw Error(`invalid hex`);return Uint8Array.from(t,e=>Number.parseInt(e,16))}function fn(e,t){if(t.type!==e)throw Error(`invalid key type, expected ${e}`)}function pn(e,t,n,r){let i=t?[`deriveBits`]:[`sign`],a=t?[]:[`verify`],o=(e,t)=>t===`jwk`?e:new Uint8Array(e),s={async import(t,n){let r=await W().importKey(n,t,e,!0,a);return fn(`public`,r),r},async export(e,t){fn(`public`,e);let n=await W().exportKey(t,e);return o(n,t)},async convert(e,t,n){return s.export(await s.import(e,t),n)}},c={async import(a,o){let s=W(),c;if(o===`raw`){let t=A(a,n,`secretKey`),o=dn(r),l=new Uint8Array(o.length+t.length);l.set(o,0),l.set(t,o.length),c=await s.importKey(sn,l,e,!0,i)}else t&&o===`jwk`&&(a={...a,key_ops:i}),c=await s.importKey(o,a,e,!0,i);return fn(`private`,c),c},async export(e,t){let r=W();if(fn(`private`,e),t===`raw`){let t=(await r.exportKey(`jwk`,e)).d.replace(/-/g,`+`).replace(/_/g,`/`),i=t.length%4?`=`.repeat(4-t.length%4):``,a=atob(t+i),o=Uint8Array.from(a,e=>e.charCodeAt(0)),s=new Uint8Array(n);return s.set(o,n-o.length),s}let i=await r.exportKey(t,e);return o(i,t)},async convert(e,t,n){return c.export(await c.import(e,t),n)}};async function l(e,t={}){I(t,{},{formatSec:`string`,formatPub:`string`},`opts`);let n=t.formatSec??cn,r=t.formatPub??ln,i=n===`jwk`?{...e}:await c.convert(e,n,`jwk`);return delete i.d,i.key_ops=a,r===`jwk`?i:s.convert(i,`jwk`,r)}async function u(t=cn){let n=await W().generateKey(e,!0,i);return c.export(n.privateKey,t)}let d;return{pub:s,priv:c,async isSupported(){if(d!==void 0)return d;try{let n=W(),r=await n.generateKey(e,!0,i);return await c.export(r.privateKey,`jwk`),t&&await n.deriveBits({name:typeof e==`string`?e:e.name,public:r.publicKey},r.privateKey,8),d=!0}catch{return d=!1}},getPublicKey:l,keygen:un(u,l),utils:Object.freeze({randomSecretKey:u,convertPublicKey:s.convert,convertSecretKey:c.convert})}}function mn(e,t){return{async sign(n,r,i={}){I(i,{},{formatSec:`string`,formatPub:`string`},`opts`);let a=await e.priv.import(r,i.formatSec??cn),o=await W().sign(t,a,n);return new Uint8Array(o)},async verify(n,r,i,a={}){I(a,{},{formatSec:`string`,formatPub:`string`},`opts`);let o=await e.pub.import(i,a.formatPub??ln);return await W().verify(t,o,n,r)}}}function hn(e,t,n){return{async getSharedSecret(r,i,a={}){I(a,{},{formatSec:`string`,formatPub:`string`},`opts`);let o=await e.priv.import(r,a.formatSec===void 0?cn:a.formatSec),s=await e.pub.import(i,a.formatPub===void 0?ln:a.formatPub),c=await W().deriveBits({name:typeof t==`string`?t:t.name,public:s},o,8*n);return new Uint8Array(c)}}}function gn(e,t,n,r){let i={name:`ECDH`,namedCurve:e},a=pn({name:`ECDSA`,namedCurve:e},!1,n,r),o=pn(i,!0,n,r);return Object.freeze({name:e,isSupported:a.isSupported,getPublicKey:a.getPublicKey,keygen:un(a.utils.randomSecretKey,a.getPublicKey),...mn(a,{name:`ECDSA`,hash:{name:t}}),...hn(o,i,n),utils:Object.freeze({...a.utils,async convertSecretKey(e,t,n){let r=t===`jwk`?e:void 0;return Array.isArray(r?.key_ops)&&r.key_ops.length===1&&r.key_ops[0]===`deriveBits`?o.utils.convertSecretKey(e,t,n):a.utils.convertSecretKey(e,t,n)}})})}const _n=gn(`P-256`,`SHA-256`,32,`3041020100301306072a8648ce3d020106082a8648ce3d030107042730250201010420`),vn={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006,userRejected:-32007};var yn=class extends Error{code;data;constructor(e,t,n){super(t),this.code=e,this.data=n}toJSON(){return{code:this.code,message:this.message,data:this.data}}},bn=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}};function xn(e){let{emittingTransport:t,listeningTransport:n,targetOrigin:r,middleware:i=[],lifecycleHandlers:a}=e,o=new Map;function s(e){return typeof e!=`object`||!e?!1:`clientLifecycle`in e||`iframeLifecycle`in e}function c(e){return typeof e!=`object`||!e?!1:`id`in e&&`topic`in e&&`data`in e}async function l(e){try{`clientLifecycle`in e&&a?.clientLifecycle?await a.clientLifecycle(e,{origin:r,source:null}):`iframeLifecycle`in e&&a?.iframeLifecycle&&await a.iframeLifecycle(e,{origin:r,source:null})}catch(e){console.error(`[RPC Client] Lifecycle handler error:`,e)}}async function u(e){let t={origin:r,source:null};for(let n of i)n.onRequest&&await n.onRequest(e,t);return e}async function d(e,t){let n={origin:r,source:null},a=t;for(let t of i)t.onResponse&&(a=await t.onResponse(e,a,n));return a}async function f(e){try{let t=new URL(e.origin).origin.toLowerCase(),n=new URL(r).origin.toLowerCase();if(t!==n){console.log(`Not expected origin`,t,n);return}}catch(e){console.error(`[RPC Client] Invalid origin`,e);return}if(s(e.data)){await l(e.data);return}if(!c(e.data))return;let t;try{let n=e.data.data,r=n instanceof Uint8Array||ArrayBuffer.isView(n)?{result:n}:n;t=await d(e.data,r)}catch(e){console.error(`[RPC Client] Middleware error on response:`,e);return}let n=o.get(e.data.id);n&&n(t)}async function p(e){let n=e;try{n=await u(e)}catch(e){throw console.error(`[RPC Client] Middleware error on request:`,e),e}t.postMessage(n,r)}function m(e){t.postMessage(e,r)}function h(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}n.addEventListener(`message`,f);function g(e){let t=h(),n=new bn;return o.set(t,e=>{e.error?n.reject(new yn(e.error.code,e.error.message,e.error.data)):n.resolve(e.result),o.delete(t)}),p({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(t),n.reject(e)}),n.promise}function _(e,t){let n=h();return o.set(n,e=>{e.error?(console.error(`[RPC Client] Listener error:`,e.error),o.delete(n)):t(e.result)}),p({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{console.error(`[RPC Client] Failed to send listener request:`,e),o.delete(n)}),()=>{o.delete(n)}}function v(){n.removeEventListener(`message`,f),o.clear()}return{request:g,listen:_,sendLifecycle:m,cleanup:v}}function Sn(e){return new TextEncoder().encode(JSON.stringify(e))}function Cn(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}const wn=`__frakEnv`,Tn={prod:{wallet:`https://wallet.frak.id`,backend:`https://backend.frak.id`},dev:{wallet:`https://wallet-dev.frak.id`,backend:`https://backend.gcp-dev.frak.id`}};function En(){return typeof window<`u`}let Dn=Tn.prod;function On(e){return e.endsWith(`/`)?e.slice(0,-1):e}function kn(e){return typeof e==`string`?Tn[e]||(console.error(`[Frak SDK] Unknown env "${e}", falling back to production. Expected "prod", "dev", or { wallet, backend }.`),Tn.prod):!e?.wallet||!e?.backend?(console.error("[Frak SDK] env must state both `wallet` and `backend` origins, falling back to production. Received:",e),Tn.prod):{wallet:On(e.wallet),backend:On(e.backend)}}function An(e){if(!e)return jn();let t=kn(e),n=En()?window[wn]:void 0;return n&&(n.wallet!==t.wallet||n.backend!==t.backend)&&console.warn(`[Frak SDK] env changed after being published; the last value wins for every SDK call on this page.`,{previous:n,next:t}),Dn=t,En()&&(window[wn]=t),t}function jn(){return En()?window[wn]??Dn:Dn}function Mn(){return jn().wallet}function G(){return jn().backend}var Nn=class extends Map{maxSize;constructor(e){super(),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};let K;function Pn(){return K||={promiseCache:new Nn(1024),responseCache:new Nn(1024),failureCache:new Nn(1024)},K}async function q(e,{cacheKey:t,cacheTime:n=3e4}){let{promiseCache:r,responseCache:i,failureCache:a}=Pn();if(n>0){let e=i.get(t);if(e&&Date.now()-e.created<n)return e.data}let o=a.get(t);if(o&&Date.now()-o<1e3)throw Error(`Cache: ${t} recently failed, backing off`);let s=r.get(t);s||(s=e(),r.set(t,s));try{let e=await s;return i.set(t,{data:e,created:Date.now()}),a.delete(t),e}catch(e){throw a.set(t,Date.now()),e}finally{r.delete(t)}}function Fn(){K&&(K.promiseCache.clear(),K.responseCache.clear(),K.failureCache.clear())}const In=`__frakSdkConfig`,Ln=`frak-config-cache`,Rn=`frak-merchant-id`,zn={key:Ln},J=typeof window<`u`;function Bn(){return{isResolved:!1,merchantId:``}}let Vn=null;function Hn(){if(!J)return null;try{let e=localStorage.getItem(zn.key);if(!e)return null;let t=JSON.parse(e);return t.config?.isResolved?(Vn=t,t):null}catch{return null}}function Un(){return(Vn??Hn())?.config}function Wn(){let e=Vn??Hn();return e?Date.now()-e.timestamp<3e4:!1}function Gn(e){if(!(!J||!e.isResolved))try{let t={config:e,timestamp:Date.now()};localStorage.setItem(zn.key,JSON.stringify(t)),Vn=t}catch{}}function Kn(){if(J){Vn=null;try{localStorage.removeItem(zn.key)}catch{}}}function qn(){J&&(window[In]||(window[In]=Un()??Bn()))}function Jn(){return J?(qn(),window[In]??Bn()):Bn()}function Yn(e){J&&window.dispatchEvent(new CustomEvent(`frak:config`,{detail:e}))}function Xn(e){return e??(J?window.location.hostname:``)}async function Zn(e,t){try{let n=G(),r=t?`&lang=${encodeURIComponent(t)}`:``,i=await fetch(`${n}/user/merchant/resolve?domain=${encodeURIComponent(e)}${r}`);if(!i.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${e}: ${i.status}`);return}let a=await i.json();if(J)try{sessionStorage.setItem(Rn,a.merchantId)}catch{}return a}catch(e){console.warn(`[Frak SDK] Failed to fetch merchant config:`,e);return}}const Y={getConfig:Jn,get isResolved(){return Jn().isResolved},get isCacheFresh(){return Wn()},setCacheScope(e,t){let n=`${e}:${t??``}`;zn.key=`${Ln}:${n}`,Vn=null},setConfig(e){if(J&&(window[In]=e),Gn(e),Yn(e),J&&e.merchantId)try{sessionStorage.setItem(Rn,e.merchantId)}catch{}},reset(){let e=Un()??Bn();J&&(window[In]=e),Yn(e)},clearCache(){if(Kn(),Fn(),J)try{sessionStorage.removeItem(Rn)}catch{}},resolve(e,t){let n=Xn(e);return n?q(async()=>{let e=await Zn(n,t);if(!e)throw Error(`Config resolution returned empty`);return e},{cacheKey:`sdkConfig:${n}:${t??``}`,cacheTime:1/0}).catch(()=>void 0):Promise.resolve(void 0)},getMerchantId(){let e=Jn();if(e.isResolved&&e.merchantId)return e.merchantId;if(J)try{return sessionStorage.getItem(Rn)??void 0}catch{}},async resolveMerchantId(e){return Y.getMerchantId()||(await Y.resolve(e))?.merchantId}};function Qn(){if(!(typeof navigator>`u`))return navigator.locks}async function $n(e,t,n={}){let r=Qn();if(!r)return t();if(n.ifAvailable)return r.request(e,{ifAvailable:!0},async e=>e?t():void 0);let i=new AbortController,a=setTimeout(()=>i.abort(),5e3),o=!1;try{return await r.request(e,{signal:i.signal},()=>(o=!0,t()))}catch(e){if(o)throw e;return t()}finally{clearTimeout(a)}}async function er(e){return p(be(e))}const tr=`frak-client-id`,nr=`frak-client-key`,rr=`frak-client-id-legacy`,ir={formatSec:`raw`,formatPub:`raw`};let ar=null;function or(){return ar??=_n.isSupported().then(e=>e?_n:on).catch(()=>on),ar}const sr=()=>typeof window<`u`&&!!window.localStorage;let cr=null;function lr(e){let t=m(e);if(cr?.keyHex===t)return cr.publicKey;let n=on.getPublicKey(e,!1);return cr={keyHex:t,publicKey:n},n}function ur(){if(sr())return localStorage.getItem(rr)??void 0}function dr(){sr()&&localStorage.removeItem(rr)}function fr(){let e=localStorage.getItem(nr);if(!e)return null;if(!/^[0-9a-f]{64}$/i.test(e))throw Error(`[Frak SDK] Corrupt client key`);return h(e)}function pr(e){try{for(let[t,n]of e)localStorage.setItem(t,n)}catch{}}async function mr(){if(!sr())throw Error(`[Frak SDK] No window/localStorage available to derive a client id`);if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`[Frak SDK] crypto.getRandomValues unavailable, cannot derive a client id`);return $n(`frak-identity-key`,hr)}async function hr(){let e=localStorage.getItem(tr),t,n,r;try{t=fr(),n=t??on.utils.randomSecretKey(),r=await er(lr(n))}catch(e){throw localStorage.removeItem(nr),cr=null,e}if(t){e!==r&&pr([[tr,r]]);let t=ur();return{clientId:r,...t&&{pendingLegacyId:t}}}return pr([...e?[[rr,e]]:[],[nr,m(n)],[tr,r]]),{clientId:r,...e&&{pendingLegacyId:e}}}async function X(e){if(!sr())return null;try{let t=fr();if(!t)return null;let n=e.ts??Math.floor(Date.now()/1e3),r=f({op:e.op,merchantId:e.merchantId,anonymousId:e.anonymousId,binding:e.binding??new Uint8Array,ts:n}),i=await or()===_n?await _n.sign(r,t,ir):on.sign(r,t,{prehash:!0});return _({v:1,pk:lr(t),ts:n,sig:i})}catch{return null}}function gr(){return{"x-frak-sdk-version":`1.3.0`}}const _r=new Set([`PROOF_REQUIRED`,`PROOF_OR_TOKEN_REQUIRED`,`MISSING_ANONYMOUS_ID`]);async function vr(e){if(e.status>=500||e.status===403)return!0;try{let t=await e.clone().json();return typeof t.code==`string`&&_r.has(t.code)}catch{return!1}}async function yr({legacyId:e,derivedId:t}){if(!(typeof window>`u`)){if(!e||e===t){dr();return}await $n(`frak-legacy-merge`,async()=>{ur()===e&&await br({legacyId:e,derivedId:t})},{ifAvailable:!0})}}async function br({legacyId:e,derivedId:t}){try{let n=await Y.resolveMerchantId();if(!n)return;let r=await X({op:`frak-merge-v1`,merchantId:n,anonymousId:t});if(!r)return;let i=G(),a=await fetch(`${i}/user/identity/merge/initiate`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,...gr()},body:JSON.stringify({sourceAnonymousId:t,merchantId:n,proof:r})});if(!a.ok){await vr(a)||dr();return}let{mergeToken:o}=await a.json();if(!o)return;let s=await fetch(`${i}/user/identity/merge/execute`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,...gr()},body:JSON.stringify({mergeToken:o,targetAnonymousId:e,merchantId:n})});if(s.ok){dr();return}await vr(s)||dr()}catch{}}let xr=null,Sr=null;async function Cr(){return xr||Sr||(Sr=mr().then(({clientId:e,pendingLegacyId:t})=>(xr=e,t&&yr({legacyId:t,derivedId:e}),e)),Sr)}function wr(){if(xr)return xr;Cr().catch(()=>{})}async function Z(){return xr||Cr()}function Tr(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function Er(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(e.length+(t===0?0:4-t),`=`)),e=>e.charCodeAt(0))}function Dr(e){return Tr(Sn(e))}function Or(e,t,n,r,i,a,o){let s=Dr(kr({redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,merchantId:n,metadata:{name:r,css:a,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink},clientId:i,proof:o})),c=new URL(e);return c.pathname=`/sso`,c.searchParams.set(`p`,s),c.toString()}function kr(e){return{r:e.redirectUrl,cId:e.clientId,d:e.directExit,l:e.lang,m:e.merchantId,md:{n:e.metadata?.name,css:e.metadata?.css,l:e.metadata?.logoUrl,h:e.metadata?.homepageLink},pf:e.proof}}function Ar(e){return{...e,directExit:e.directExit??!e.redirectUrl}}async function jr(e,t){let{metadata:n,customizations:r}=e.config,i=wr()??await Z().catch(()=>void 0),a=await Y.resolveMerchantId()??``,o=i&&a?await X({op:`frak-sso-v1`,merchantId:a,anonymousId:i}):null;return{ssoUrl:Or(Mn(),Ar(t),a,n.name,i,r?.css,o??void 0)}}const Mr=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,Nr=`frak-sso`;async function Pr(e,t){let{metadata:n,customizations:r}=e.config;if(`ssoUrl`in t)return Fr(t.ssoUrl),await e.request({method:`frak_openSso`,params:[{},n.name,r?.css]})??{};let i=Ar(t);return i.openInSameWindow??!!i.redirectUrl?await e.request({method:`frak_openSso`,params:[i,n.name,r?.css]}):(Fr(i.ssoPopupUrl??(await jr(e,i)).ssoUrl),await e.request({method:`frak_openSso`,params:[i,n.name,r?.css]})??{})}function Fr(e){let t=window.open(e,Nr,Mr);if(!t)throw Error(`Popup was blocked. Please allow popups for this site.`);t.focus()}function Q(e,t,n){if(!e){console.debug(`[Frak] No client provided, skipping event tracking`);return}try{e.openPanel?.track(t,n)}catch(e){console.debug(`[Frak] Failed to track event:`,t,e)}}function Ir(e,t){let n=e.get(t);if(n!==null)return n;let r=t.toLowerCase();for(let[t,n]of e)if(t.toLowerCase()===r)return n;return null}function $(e,t){let n=t.toLowerCase(),r=[...e.keys()].filter(e=>e.toLowerCase()===n);for(let t of r)e.delete(t)}const Lr=/^0x[a-fA-F0-9]{40}$/;function Rr(e){return typeof e==`string`&&Lr.test(e)}function zr(e,t){return e.toLowerCase()===t.toLowerCase()}function Br(e){let t=new Uint8Array(20);for(let n=0;n<20;n++){let r=Number.parseInt(e.substring(2+n*2,4+n*2),16);if(Number.isNaN(r))throw Error(`Invalid address: ${e}`);t[n]=r}return t}const Vr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Hr(e){let t=`0x`;for(let n=0;n<20;n++)t+=Vr[e[n]];return t}function Ur(e){return`r`in e&&!(`v`in e)}function Wr(e){return`v`in e&&e.v===2}const Gr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Kr(e){return typeof e==`string`&&Gr.test(e)}function qr(e){let t=e.replace(/-/g,``),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=Number.parseInt(t.substring(e*2,e*2+2),16);return n}function Jr(e){let t=``;for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,`0`);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}function Yr(e){if(!Kr(e.m)||!Number.isInteger(e.t)||e.t<0||e.t>4294967295)return null;let t=typeof e.c==`string`&&e.c.length>0,n=typeof e.w==`string`&&Rr(e.w);if(!t&&!n||t&&!Kr(e.c))return null;let r=new Uint8Array(21+(t?16:0)+(n?20:0)),i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=0;return r[a++]=2|(t?16:0)|(n?32:0),r.set(qr(e.m),a),a+=16,i.setUint32(a,e.t,!1),a+=4,t&&(r.set(qr(e.c),a),a+=16),n&&(r.set(Br(e.w),a),a+=20),r}function Xr(e){if(e.length<21)return null;let t=e[0];if((t&15)!=2||t&192)return null;let n=!!(t&16),r=!!(t&32);if(!n&&!r)return null;let i=21+(n?16:0)+(r?20:0);if(e.length!==i)return null;let a=1,o=Jr(e.subarray(a,a+16));a+=16;let s=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(a,!1);a+=4;let c={v:2,m:o,t:s};if(n&&(c.c=Jr(e.subarray(a,a+16)),a+=16),r){let t=Hr(e.subarray(a,a+20));if(!Rr(t))return null;c.w=t,a+=20}return c}const Zr=`fCtx`;function Qr(e){if(e)try{if(Wr(e)){let t=Yr(e);return t?Tr(t):void 0}return Tr(Br(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function $r(e){if(!(!e||e.length===0))try{let t=Er(e);if(t.length!==20)return Xr(t)||void 0;let n=Hr(t);if(Rr(n))return{r:n}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function ei({url:e}){if(!e)return null;let t=Ir(new URL(e).searchParams,Zr);return t?$r(t):null}function ti(e){return{utm_source:e.utmSource??`frak`,utm_medium:e.utmMedium??void 0,utm_campaign:e.utmCampaign??void 0,utm_content:e.utmContent,utm_term:e.utmTerm,via:e.via??void 0,ref:e.ref??void 0}}function ni(e,t){let n=ti(t??{});for(let[t,r]of Object.entries(n))r!==void 0&&r!==``&&(e.searchParams.has(t)||e.searchParams.set(t,r))}function ri({url:e,context:t,attribution:n}){if(!e)return null;let r=Qr(t);if(!r)return null;let i=new URL(e);return $(i.searchParams,Zr),i.searchParams.set(Zr,r),ni(i,n),i.toString()}function ii(e){let t=new URL(e);return $(t.searchParams,Zr),t.toString()}function ai({url:e,context:t}){if(!window.location?.href||typeof window>`u`){console.error(`No window found, can't update context`);return}let n=e??window.location.href,r;r=t===null?ii(n):ri({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const oi={compress:Qr,decompress:$r,parse:ei,update:ri,remove:ii,replaceUrl:ai},si={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function ci(e){return e&&e in si?e:`eur`}function li(e){return e?si[e]??si.eur:si.eur}function ui(e,t){let n=li(t),r=ci(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function di(e){return e.formatToParts(1.1).find(e=>e.type===`decimal`)?.value??`.`}function fi(e,t){let n=li(t),r=ci(t),i=new Intl.NumberFormat(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2}),a=i.formatToParts(e),o=``,s=``,c=``,l=`suffix`,u=!1;for(let e of a)switch(e.type){case`integer`:case`group`:o+=e.value,u=!0;break;case`decimal`:case`fraction`:s+=e.value;break;case`currency`:c=e.value,l=u?`suffix`:`prefix`}return{integer:o,decimals:s||`${di(i)}00`,unit:c,unitPosition:l}}function pi(e){return{integer:String(e),unit:`%`,unitPosition:`suffix`}}function mi(e){return e?`${e}Amount`:`eurAmount`}var hi=class{constructor(e){this.baseUrl=e.baseUrl,this.headers={"Content-Type":`application/json`,...e.defaultHeaders},this.maxRetries=e.maxRetries??3,this.initialRetryDelay=e.initialRetryDelay??500}async resolveHeaders(){let e={};for(let[t,n]of Object.entries(this.headers)){let r=await n;r!==null&&(e[t]=r)}return e}addHeader(e,t){this.headers[e]=t}async post(e,t,n,r){try{let r=await fetch(e,{method:`POST`,headers:await this.resolveHeaders(),body:t?JSON.stringify(t??{}):void 0,keepalive:!0,...n});if(r.status===401)return null;if(r.status!==200&&r.status!==202)throw Error(`HTTP error! status: ${r.status}`);let i=await r.text();return i?JSON.parse(i):null}catch(i){if(r<this.maxRetries){let i=this.initialRetryDelay*2**r;return await new Promise(e=>setTimeout(e,i)),this.post(e,t,n,r+1)}return console.error(`Max retries reached:`,i),null}}async fetch(e,t,n={}){let r=`${this.baseUrl}${e}`;return this.post(r,t,n,0)}},gi=class{constructor(e){this.groups=[],this.queue=[],this.options=e;let t={"openpanel-client-id":e.clientId};e.clientSecret&&(t[`openpanel-client-secret`]=e.clientSecret),t[`openpanel-sdk-name`]=e.sdk||`node`,t[`openpanel-sdk-version`]=e.sdkVersion||`1.3.1`,this.api=new hi({baseUrl:e.apiUrl||`https://api.openpanel.dev`,defaultHeaders:t})}init(){}ready(){this.options.disabled=!1,this.options.waitForProfile=!1,this.flush()}shouldQueue(e){return!!(this.options.disabled||this.options.waitForProfile&&!this.profileId||e.type===`replay`&&!this.sessionId)}addQueue(e){e.type===`track`&&(e.payload.properties={...e.payload.properties??{},__timestamp:new Date().toISOString()}),this.queue.push(e)}async send(e){if(this.options.filter&&!this.options.filter(e))return Promise.resolve();if(this.shouldQueue(e))return this.addQueue(e),Promise.resolve();let t=await this.api.fetch(`/track`,e,{keepalive:e.type!==`replay`});this.deviceId=t?.deviceId;let n=!!this.sessionId;return this.sessionId=t?.sessionId,!n&&this.sessionId&&this.flush(),t}setGlobalProperties(e){this.global={...this.global,...e}}track(e,t){this.log(`track event`,e,t);let{groups:n,profileId:r,...i}=t??{},a=[...new Set([...this.groups,...n??[]])];return this.send({type:`track`,payload:{name:e,profileId:r??this.profileId,groups:a.length>0?a:void 0,properties:{...this.global??{},...i}}})}identify(e){if(this.log(`identify user`,e),e.profileId&&(this.profileId=e.profileId,this.flush()),e.profileId&&Object.keys(e).length>1)return this.send({type:`identify`,payload:{...e,properties:{...this.global,...e.properties}}})}upsertGroup(e){return this.log(`upsert group`,e),this.send({type:`group`,payload:e})}setGroup(e){return this.log(`set group`,e),this.groups.includes(e)||(this.groups=[...this.groups,e]),this.send({type:`assign_group`,payload:{groupIds:[e],profileId:this.profileId}})}setGroups(e){return this.log(`set groups`,e),this.groups=[...new Set([...this.groups,...e])],this.send({type:`assign_group`,payload:{groupIds:e,profileId:this.profileId}})}alias(e){}increment(e){return this.send({type:`increment`,payload:e})}decrement(e){return this.send({type:`decrement`,payload:e})}revenue(e,t){let n=t?.deviceId;return delete t?.deviceId,this.track(`revenue`,{...t??{},...n?{__deviceId:n}:{},__revenue:e})}getDeviceId(){return this.deviceId??``}getSessionId(){return this.sessionId??``}fetchDeviceId(){return Promise.resolve(this.deviceId??``)}clear(){this.profileId=void 0,this.groups=[],this.deviceId=void 0,this.sessionId=void 0}buildFlushPayload(e){if(e.type===`replay`)return e.payload;if(e.type===`track`){let t=`groups`in e.payload?e.payload.groups??[]:[],n=[...new Set([...this.groups,...t])];return{...e.payload,profileId:e.payload.profileId??this.profileId,groups:n.length>0?n:void 0}}return e.type===`identify`||e.type===`increment`||e.type===`decrement`||e.type===`assign_group`?{...e.payload,profileId:e.payload.profileId??this.profileId}:e.payload}flush(){let e=[];for(let t of this.queue){if(this.shouldQueue(t)){e.push(t);continue}let n=this.buildFlushPayload(t);this.send({...t,payload:n})}this.queue=e}log(...e){this.options.debug&&console.log(`[OpenPanel.dev]`,...e)}},_i=typeof document<`u`?document.currentScript:null;function vi(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var yi=class extends gi{constructor(e){if(super({sdk:`web`,sdkVersion:`1.4.1`,...e}),this.options=e,this.lastPath=``,this.pendingRevenues=[],!this.isServer()){try{let e=sessionStorage.getItem(`openpanel-pending-revenues`);if(e){let t=JSON.parse(e);Array.isArray(t)&&(this.pendingRevenues=t)}}catch{this.pendingRevenues=[]}if(this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&(this.trackScreenViews(),setTimeout(()=>this.screenView(),0)),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes(),this.options.sessionReplay?.enabled){let e=this.options.sessionReplay.sampleRate??1;Math.random()<e&&this.loadReplayModule().then(e=>{e&&e.startReplayRecorder(this.options.sessionReplay,e=>{this.send({type:`replay`,payload:{...e}})})})}}}async loadReplayModule(){try{if(typeof __OPENPANEL_REPLAY_URL__<`u`){let e=_i,t=this.options.sessionReplay?.scriptUrl||e?.src?.replace(`.js`,`-replay.js`)||`https://openpanel.dev/op1-replay.js`;return window.__openpanel_replay?window.__openpanel_replay:new Promise(e=>{let n=document.createElement(`script`);n.src=t,n.onload=()=>{e(window.__openpanel_replay??null)},n.onerror=()=>{console.warn(`[OpenPanel] Failed to load replay script from`,t),e(null)},document.head.appendChild(n)})}return await import(`./replay-V6FXES7X.CgBxdfNp.js`)}catch(e){return console.warn(`[OpenPanel] Failed to load replay module`,e),null}}debounce(e,t){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(e,t)}isServer(){return typeof document>`u`}trackOutgoingLinks(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`a`);if(n&&t){let e=n.getAttribute(`href`);if(e?.startsWith(`http`))try{let r=new URL(e),i=window.location.hostname;r.hostname!==i&&super.track(`link_out`,{href:e,text:n.innerText||n.getAttribute(`title`)||t.getAttribute(`alt`)||t.getAttribute(`title`)})}catch{}}})}trackScreenViews(){if(this.isServer())return;let e=history.pushState;history.pushState=function(...t){let n=e.apply(this,t);return window.dispatchEvent(new Event(`pushstate`)),window.dispatchEvent(new Event(`locationchange`)),n};let t=history.replaceState;history.replaceState=function(...e){let n=t.apply(this,e);return window.dispatchEvent(new Event(`replacestate`)),window.dispatchEvent(new Event(`locationchange`)),n},window.addEventListener(`popstate`,()=>{window.dispatchEvent(new Event(`locationchange`))});let n=()=>this.debounce(()=>this.screenView(),50);this.options.trackHashChanges?window.addEventListener(`hashchange`,n):window.addEventListener(`locationchange`,n)}trackAttributes(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`button`),r=t.closest(`a`),i=n?.getAttribute(`data-track`)?n:r?.getAttribute(`data-track`)?r:null;if(i){let e={};for(let t of i.attributes)t.name.startsWith(`data-`)&&t.name!==`data-track`&&(e[vi(t.name.replace(/^data-/,``))]=t.value);let t=i.getAttribute(`data-track`);t&&super.track(t,e)}})}track(e,t){return super.track(e,{...t,__path:this.lastPath})}screenView(e,t){if(this.isServer())return;let n,r;typeof e==`string`?(n=e,r=t):(n=window.location.href,r=e),this.lastPath!==n&&(this.lastPath=n,super.track(`screen_view`,{...r??{},__path:n,__title:document.title}))}async flushRevenue(){let e=this.pendingRevenues.map(e=>super.revenue(e.amount,e.properties));await Promise.all(e),this.clearRevenue()}clearRevenue(){if(this.pendingRevenues=[],!this.isServer())try{sessionStorage.removeItem(`openpanel-pending-revenues`)}catch{}}pendingRevenue(e,t){if(this.pendingRevenues.push({amount:e,properties:t}),!this.isServer())try{sessionStorage.setItem(`openpanel-pending-revenues`,JSON.stringify(this.pendingRevenues))}catch{}}};const bi=`nexus-wallet-backup`,xi=`frakwallet://`;function Si(e){let t=e?.split(`-`)[0]?.toLowerCase();return t===`en`||t===`fr`?t:void 0}function Ci(){return(typeof document<`u`?Si(document.documentElement.lang):void 0)||(typeof navigator<`u`?Si(navigator.language):void 0)}function wi(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href),r=n.searchParams.get(`sso`);r&&(t.then(()=>{e.sendLifecycle({clientLifecycle:`sso-redirect-complete`,data:{compressed:r}}),console.log(`[SSO URL Listener] Forwarded compressed SSO data to iframe`)}).catch(e=>{console.error(`[SSO URL Listener] Failed to forward SSO data:`,e)}),n.searchParams.delete(`sso`),window.history.replaceState({},``,n.toString()),console.log(`[SSO URL Listener] SSO parameter detected and URL cleaned`))}function Ti(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}const Ei=xi.replace(`://`,``);function Di(e){return`intent://${e.slice(13)}#Intent;scheme=${Ei};end`}function Oi(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=Ti()&&ki(e)?Di(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function ki(e){return e.startsWith(xi)}function Ai(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent;return!!(/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1)}const ji=Ai();function Mi(){return typeof navigator>`u`?!1:ji?!0:/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function Ni(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase();return e.includes(`instagram`)||e.includes(`fban`)||e.includes(`fbav`)||e.includes(`facebook`)}const Pi=Ni();function Fi(e){ji&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:ji&&e.startsWith(`http://`)?window.location.href=`x-safari-http://${e.slice(7)}`:window.location.href=`${G()}/common/social?u=${encodeURIComponent(e)}`}const Ii={id:`frak-wallet`,name:`frak-wallet`,title:`Frak Wallet`,allow:`publickey-credentials-get *; clipboard-write; web-share *`,style:{width:`0`,height:`0`,border:`0`,position:`absolute`,zIndex:2000001,top:`-1000px`,left:`-1000px`,colorScheme:`auto`}};async function Li({config:e}){let t=document.querySelector(`#frak-wallet`);t&&t.remove();let n=document.createElement(`iframe`);n.id=Ii.id,n.name=Ii.name,n.allow=Ii.allow,n.style.zIndex=Ii.style.zIndex.toString(),zi({iframe:n,isVisible:!1});let r=An(e?.env).wallet,i=await Cr().catch(e=>{console.warn(`[Frak SDK] Unable to derive a client id`,e)});return Vi(r),Vi(G()),n.src=Ri({walletUrl:r,clientId:i,preload:e?.preload}),new Promise(e=>{n.addEventListener(`load`,()=>e(n)),document.body.appendChild(n)})}function Ri({walletUrl:e=Mn(),clientId:t,preload:n}){let r=t?`${e}/listener?clientId=${encodeURIComponent(t)}`:`${e}/listener`;return!n||n.length===0?r:`${r}#preload=${n.join(`,`)}`}function zi({iframe:e,isVisible:t}){if(!t){e.style.width=`0`,e.style.height=`0`,e.style.border=`0`,e.style.position=`fixed`,e.style.top=`-1000px`,e.style.left=`-1000px`;return}e.style.position=`fixed`,e.style.top=`0`,e.style.left=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`auto`}function Bi(e=`/listener`){if(!window.opener)return null;let t=t=>{try{return t.location.origin===window.location.origin&&t.location.pathname===e}catch{return!1}};if(t(window.opener))return window.opener;try{let e=window.opener.frames;for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}catch(t){return console.error(`[findIframeInOpener] Error finding iframe with pathname ${e}:`,t),null}}function Vi(e){if(!(typeof document>`u`))try{let t=new URL(e).origin,n=`link[rel="preconnect"][data-frak-preconnect="${t}"]`;if(document.head.querySelector(n))return;let r=document.createElement(`link`);r.rel=`preconnect`,r.href=t,r.crossOrigin=``,r.dataset.frakPreconnect=t,document.head.appendChild(r)}catch{}}const Hi=ji&&Pi;function Ui(e){e?localStorage.setItem(bi,e):localStorage.removeItem(bi)}function Wi(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=qi(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function Gi(e){let t=new URL(window.location.href);e&&t.searchParams.set(`fmt`,e);let n=t.protocol===`http:`?`x-safari-http`:`x-safari-https`;window.location.href=`${n}://${t.host}${t.pathname}${t.search}${t.hash}`}function Ki(e){return e.includes(`/common/social`)}function qi(e,t){if(!t)return e;try{let n=new URL(e);return n.searchParams.set(`fmt`,t),n.toString()}catch{return`${e}${e.includes(`?`)?`&`:`?`}fmt=${encodeURIComponent(t)}`}}function Ji(e,t,n,r,i){if(i){let e=Wi(t,r);window.open(e,`_blank`);return}if(ki(t)){let i=Wi(t,r);Oi(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(Hi&&Ki(t))Gi(r);else{let e=Wi(t,r);window.location.href=e}}function Yi({iframe:e,targetOrigin:t}){let n=new bn;return{handleEvent:r=>{if(!(`iframeLifecycle`in r))return;let{iframeLifecycle:i,data:a}=r;switch(i){case`connected`:n.resolve(!0);break;case`do-backup`:Ui(a.backup);break;case`remove-backup`:localStorage.removeItem(bi);break;case`show`:case`hide`:zi({iframe:e,isVisible:i===`show`});break;case`redirect`:Ji(e,a.baseRedirectUrl,t,a.mergeToken,a.openInNewTab)}},isConnected:n.promise}}async function Xi({config:e,iframe:t}){let n=An(e?.env).wallet,r=e.metadata.lang??Ci(),i=e.domain??(typeof window<`u`?window.location.hostname:``);Y.setCacheScope(i,r),Y.reset();let a=Y.isCacheFresh?void 0:Y.resolve(e.domain,r),o=await Z().catch(()=>void 0),s=Yi({iframe:t,targetOrigin:n}),c=new bn,l=Date.now();if(!t.contentWindow)throw new yn(vn.configError,`The iframe does not have a content window`);let u=xn({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await s.isConnected)throw new yn(vn.clientNotConnected,`The iframe provider isn't connected yet`);return await c.promise,t}}],lifecycleHandlers:{iframeLifecycle:(e,t)=>{s.handleEvent(e)}}}),d=Zi(u,s),f,p=!1,m=async()=>{p=!0,d(),f?.(),u.cleanup(),t.remove(),Fn(),Y.clearCache(),Y.reset()},h;{console.log(`[Frak SDK] Initializing OpenPanel`),h=new yi({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdk_version`in t.properties||(t.properties={...t.properties,sdk_version:`1.3.0`,...o&&{user_anonymous_client_id:o}}),!0)}),h.setGlobalProperties({sdk_version:`1.3.0`,...o&&{user_anonymous_client_id:o}}),h.init(),h.track(`sdk_initialized`,{sdk_version:`1.3.0`});let e=!1,t=setTimeout(()=>{e||(e=!0,h?.track(`sdk_iframe_handshake_failed`,{reason:`timeout`}))},3e4);s.isConnected.then(()=>{e||(e=!0,clearTimeout(t),h?.track(`sdk_iframe_connected`,{handshake_duration_ms:Date.now()-l}))}).catch(()=>{e||(e=!0,clearTimeout(t),h?.track(`sdk_iframe_handshake_failed`,{reason:`unknown`}))})}let g=na({config:e,rpcClient:u,lifecycleManager:s,configPromise:a,contextSent:c,openPanel:h,clientId:o}).then(e=>{if(p){e();return}f=e}).catch(e=>{throw c.reject(e),e});return{config:e,waitForConnection:s.isConnected,waitForSetup:g,request:u.request,listenerRequest:u.listen,destroy:m,openPanel:h}}function Zi(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,250),r=setTimeout(()=>{o(),console.log(`Heartbeat timeout: connection failed`)},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}function Qi(e){return e.hasRawSdkConfig?{name:e.name,logoUrl:e.logoUrl,homepageLink:e.homepageLink,lang:e.lang,currency:e.currency,hidden:e.hidden,css:e.css,translations:e.translations,placements:e.placements,attribution:e.attribution}:e.attribution?{attribution:e.attribution}:void 0}function $i(e,t){if(!e)return;let n=e.global??{};e.setGlobalProperties({...n,merchant_id:t.merchantId,domain:t.domain??``})}async function ea(e){let t=new TextEncoder().encode(e);if(typeof crypto<`u`&&crypto.subtle)try{let e=await crypto.subtle.digest(`SHA-256`,t);return new Uint8Array(e)}catch{}try{return be(t)}catch{return}}async function ta({merchantId:e,anonymousId:t,pendingMergeToken:n}){let r=n?await ea(n):void 0,[i,a,o]=await Promise.all([r?X({op:`frak-merge-v1`,merchantId:e,anonymousId:t,binding:r}):Promise.resolve(null),X({op:`frak-merge-v1`,merchantId:e,anonymousId:t}),X({op:`frak-install-v1`,merchantId:e,anonymousId:t})]);if(!(!i&&!a&&!o))return{anonymousId:t,proofs:{...i&&{merge:i},...a&&{mergeSource:a},...o&&{install:o}}}}async function na({config:e,rpcClient:t,lifecycleManager:n,configPromise:r,contextSent:i,openPanel:a,clientId:o}){await n.isConnected,wi(t,n.isConnected);let s=new URL(window.location.href),c=s.searchParams.get(`fmt`)??void 0;c&&(s.searchParams.delete(`fmt`),window.history.replaceState({},``,s.toString()));let l=t=>{let n=t?.merchantId??e.metadata.merchantId??``,r=t?.domain??``,i=t?.allowedDomains??[],a=t?.sdkConfig,o=a?.attribution||e.attribution?{...e.attribution,...a?.attribution}:void 0;Y.setConfig(a?{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,hasRawSdkConfig:!0,name:a.name??e.metadata.name,logoUrl:a.logoUrl??e.metadata.logoUrl,homepageLink:a.homepageLink??e.metadata.homepageLink,lang:a.lang??e.metadata.lang,currency:a.currency??e.metadata.currency,hidden:a.hidden,css:a.css,translations:a.translations,placements:a.placements,components:a.components,attribution:o}:{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,name:e.metadata.name,logoUrl:e.metadata.logoUrl,homepageLink:e.metadata.homepageLink,lang:e.metadata.lang,currency:e.metadata.currency,attribution:o})},u=!1,d=Promise.resolve(),f=e=>{let n=u?void 0:c;u=!0;let r=Qi(e),i=o,s=window.location.href;return $i(a,e),d=d.then(async()=>{t.sendLifecycle({clientLifecycle:`resolved-config`,data:{merchantId:e.merchantId,domain:e.domain??``,allowedDomains:e.allowedDomains??[],sourceUrl:s,...i&&{sdkAnonymousId:i},...n&&{pendingMergeToken:n},...r&&{sdkConfig:r},...i&&{sdkIdentity:await ta({merchantId:e.merchantId,anonymousId:i,pendingMergeToken:n})}}})}).catch(e=>{console.error(`Failed to send lifecycle config`,e)}),d};Y.isResolved&&f(Y.getConfig()).then(i.resolve),r&&(l(await r),f(Y.getConfig()).then(i.resolve));async function p(){let n=e.customizations?.css;n&&t.sendLifecycle({clientLifecycle:`modal-css`,data:{cssLink:n}})}async function m(){let n=e.customizations?.i18n;n&&t.sendLifecycle({clientLifecycle:`modal-i18n`,data:{i18n:n}})}async function h(){if(typeof window>`u`)return;let e=window.localStorage.getItem(bi);e&&t.sendLifecycle({clientLifecycle:`restore-backup`,data:{backup:e}})}return(await Promise.allSettled([p(),m(),h()])).some(e=>e.status===`rejected`)&&a?.track(`sdk_iframe_handshake_failed`,{reason:`asset_push`}),ra(f)}function ra(e){if(typeof document>`u`)return()=>{};let t=0,n=n=>{if(document.visibilityState!==`visible`||!Y.isResolved)return;let r=Date.now();n&&r-t<6e4||(t=r,e(Y.getConfig()))},r=()=>n(!0),i=setInterval(()=>n(!1),3e5);return document.addEventListener(`visibilitychange`,r),()=>{clearInterval(i),document.removeEventListener(`visibilitychange`,r)}}function ia(e){return Cn(Er(e))}function aa(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function oa(e){if(!e)return null;if(Array.isArray(e))return e;if(typeof e!=`string`)return null;try{let t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function sa(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e==`string`&&e.trim()!==``){let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}}function ca(e){if(typeof e!=`string`)return;let t=e.trim();return t===``?void 0:t}function la(e){if(!e||typeof e!=`object`)return;let t=e,n={},r=ca(t.productId);r!==void 0&&(n.productId=r);let i=ca(t.sku);i!==void 0&&(n.sku=i);let a=ca(t.name);a!==void 0&&(n.name=a);let o=sa(t.quantity);o!==void 0&&(n.quantity=o);let s=sa(t.unitPrice);s!==void 0&&(n.unitPrice=s);let c=sa(t.totalPrice);return c!==void 0&&(n.totalPrice=c),Object.keys(n).length>0?n:void 0}function ua(e){let t=oa(e);if(!t)return;let n=[];for(let e of t){let t=la(e);t&&n.push(t)}return n.length>0?n:void 0}function da(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.title==`string`?t.title.trim():``;if(n===``)return null;let r={title:n,...la(e)};return typeof t.imageUrl==`string`&&aa(t.imageUrl)&&(r.imageUrl=t.imageUrl),typeof t.link==`string`&&aa(t.link)&&(r.link=t.link),typeof t.utmContent==`string`&&t.utmContent!==``&&(r.utmContent=t.utmContent),r}function fa(e){let t=oa(e);if(!t)return;let n=[];for(let e of t){let t=da(e);t&&n.push(t)}return n.length>0?n:void 0}function pa(e){if(!e)return;let t;try{t=ia(e)}catch{return}if(t!==null)return fa(t)}async function ma({config:e}){let t=ha(e),n=await Li({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=await Xi({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function ha(e){let t=ci(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}function ga({perCall:e,defaults:t,productUtmContent:n}){if(e===null)return;let r=e!==void 0,i=t!==void 0&&Object.keys(t).length>0;if(!r&&!i&&(n===void 0||n===``))return;let a={...t,...e??{}},o=n??e?.utmContent;return o!==void 0&&o!==``?a.utmContent=o:delete a.utmContent,a}var _a=t({DEEP_LINK_SCHEME:()=>xi,FrakContextManager:()=>oi,areAddressesEqual:()=>zr,base64urlDecode:()=>Er,base64urlEncode:()=>Tr,baseIframeProps:()=>Ii,buildListenerUrl:()=>Ri,clearAllCache:()=>Fn,coerceProductCandidates:()=>oa,compressJsonToB64:()=>Dr,createIFrameFrakClient:()=>Xi,decodeProductsParam:()=>pa,decompressJsonFromB64:()=>ia,deleteQueryParamCaseInsensitive:()=>$,detectPageLanguage:()=>Ci,findIframeInOpener:()=>Bi,formatAmount:()=>ui,formatAmountParts:()=>fi,generateSsoUrl:()=>Or,getBackendUrl:()=>G,getClientId:()=>wr,getClientIdAsync:()=>Z,getCurrencyAmountKey:()=>mi,getEnvironment:()=>jn,getQueryParamCaseInsensitive:()=>Ir,getSupportedCurrency:()=>ci,isIOS:()=>ji,isInAppBrowser:()=>Pi,isMobile:()=>Mi,mergeAttribution:()=>ga,normalizeProductDetails:()=>la,normalizeSharingProduct:()=>da,redirectToExternalBrowser:()=>Fi,sanitizeProductDetailsList:()=>ua,sanitizeSharingProducts:()=>fa,sdkConfigStore:()=>Y,setEnvironment:()=>An,setupClient:()=>ma,ssoPopupFeatures:()=>Mr,ssoPopupName:()=>Nr,trackEvent:()=>Q,triggerDeepLinkWithFallback:()=>Oi,withCache:()=>q});async function va(e,t,n){return await e.request({method:`frak_displayEmbeddedWallet`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function ya(e,{steps:t,metadata:n},r){return await e.request({method:`frak_displayModal`,params:r?[t,n,e.config.metadata,r]:[t,n,e.config.metadata]})}async function ba(e,t,n){return await e.request({method:`frak_displaySharingPage`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function xa(e){if(typeof window>`u`)return;let t=await Z().catch(()=>void 0);if(!t)return;let n=await Y.resolveMerchantId();if(!n)return;let r=`frak-identity-ensured-${n}-${t}`;if(!window.sessionStorage.getItem(r))try{let i=G(),a=await X({op:`frak-ensure-v1`,merchantId:n,anonymousId:t});(await fetch(`${i}/user/identity/ensure`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"x-wallet-sdk-auth":e,"x-frak-client-id":t,...gr()},body:JSON.stringify({merchantId:n,...a&&{proof:a}})})).ok&&window.sessionStorage.setItem(r,`1`)}catch{}}async function Sa(e,t){return q(()=>e.request({method:`frak_getMerchantInformation`}),{cacheKey:`frak_getMerchantInformation`,cacheTime:t?.cacheTime})}async function Ca(e,t){return q(async()=>{let t=await Z().catch(()=>void 0),n=await Y.resolveMerchantId(),r=t&&n?await X({op:`frak-merge-v1`,merchantId:n,anonymousId:t}):null;return e.request({method:`frak_getMergeToken`,params:r?[r]:void 0})},{cacheKey:`frak_getMergeToken`,cacheTime:t?.cacheTime})}async function wa(e,t){return q(()=>e.request({method:`frak_getUserReferralStatus`}),{cacheKey:`frak_getUserReferralStatus`,cacheTime:t?.cacheTime})}async function Ta(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function Ea(e,t){try{let n=await Z().catch(()=>void 0);await e.request({method:`frak_sendInteraction`,params:[t,{clientId:n}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}function Da(e,t,n){return Wr(t)?(Q(e,`user_referred_started`,{referrer_client_id:t.c,referrer_wallet:t.w,wallet_status:n?.key}),Ea(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referrerWallet:t.w,referralTimestamp:t.t}),!0):Ur(t)?(Q(e,`user_referred_started`,{referrer:t.r,wallet_status:n?.key}),Ea(e,{type:`arrival`,referrerWallet:t.r}),!0):!1}function Oa(e,t,n){return!t&&!n?null:{v:2,m:e,t:Math.floor(Date.now()/1e3),...t?{c:t}:{},...n?{w:n}:{}}}function ka(e,t,n){return Wr(e)?e.w&&n?.wallet?zr(e.w,n.wallet):e.c?t===e.c:!1:Ur(e)&&n?.wallet?zr(e.r,n.wallet):!1}async function Aa(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;let i=await Z().catch(()=>void 0);if(ka(n,i,t))return`self-referral`;if(!Da(e,n,t))return`no-referrer`;let a=Wr(n)?n.m:r?.merchantId,o=r?.alwaysAppendUrl&&a?Oa(a,i,t?.wallet):null;return oi.replaceUrl({url:window.location?.href,context:o}),Q(e,`user_referred_completed`,{status:`success`}),`success`}async function ja(e,{options:t}={}){let n=oi.parse({url:window.location.href}),r=await Fa(e);try{return await Aa(e,{walletStatus:r,frakContext:n,options:t})}catch(e){console.warn(`Error processing referral`,{error:e})}}const Ma=`frak:referral-success`;async function Na(e){try{await ja(e)===`success`&&window.dispatchEvent(new Event(Ma))}catch(e){console.warn(`[Frak] Referral setup failed`,e)}}async function Pa(e){if(typeof window>`u`){console.warn(`[Frak] No window found, can't track purchase`);return}let t=window.sessionStorage.getItem(`frak-wallet-interaction-token`),n=await Z().catch(()=>void 0);if(!t&&!n){console.warn(`[Frak] No identity found, skipping purchase check`);return}let r=e.merchantId??await Y.resolveMerchantId();if(!r){console.warn(`[Frak] No merchant id found, skipping purchase check`);return}let i={Accept:`application/json`,"Content-Type":`application/json`};t&&(i[`x-wallet-sdk-auth`]=t),n&&(i[`x-frak-client-id`]=n);let a=G();await fetch(`${a}/user/track/purchase`,{method:`POST`,headers:i,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:r})})}function Fa(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(Ia(e,t),t));let n=new bn,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{Ia(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function Ia(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),xa(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function La(e,{metadata:t,login:n}){return Ra(e,{steps:{login:n??{}},metadata:t})}function Ra(e,t){function n(n){return Ra(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return Ra(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return Ra(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function a(n,r){return n&&(t.metadata=n(t.metadata??{})),await ya(e,t,r)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function za(e,{tx:t,metadata:n}){return(await ya(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function Ba(e=96){let t=Math.ceil(e/2),n=``;if(typeof crypto<`u`&&crypto.getRandomValues){let e=new Uint8Array(t);crypto.getRandomValues(e);for(let t=0;t<e.length;t++)n+=e[t].toString(16).padStart(2,`0`)}else for(let e=0;e<t;e++)n+=(Math.random()*256|0).toString(16).padStart(2,`0`);return n.substring(0,e)}async function Va(e,{siwe:t,metadata:n}){let r=e.config?.domain??window.location.host,i=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await ya(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??Ba(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var Ha=t({REFERRAL_SUCCESS_EVENT:()=>Ma,displayEmbeddedWallet:()=>va,displayModal:()=>ya,displaySharingPage:()=>ba,ensureIdentity:()=>xa,getMerchantInformation:()=>Sa,getMergeToken:()=>Ca,getUserReferralStatus:()=>wa,modalBuilder:()=>La,openSso:()=>Pr,prepareSso:()=>Ta,prepareSsoUrl:()=>jr,processReferral:()=>Aa,referralInteraction:()=>ja,sendInteraction:()=>Ea,sendTransaction:()=>za,setupReferral:()=>Na,siweAuthenticate:()=>Va,trackPurchaseStatus:()=>Pa,watchWalletStatus:()=>Fa});async function Ua(e,t,n){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}await ba(window.FrakSetup.client,{...n?.link&&{link:n.link},...n?.products?.length&&{products:n.products},...n?.checkoutToken&&{checkoutToken:n.checkoutToken},...e&&{metadata:{targetInteraction:e}}},t)}const Wa=[`frak-button-share`,`frak-button-wallet`,`frak-open-in-app`,`frak-post-purchase`,`frak-banner`].join(`,`);function Ga(){return typeof document>`u`||document.querySelector(Wa)===null?[]:[`sharing`]}const Ka=`frak:client`;function qa(){let e=new CustomEvent(Ka);window.dispatchEvent(e)}function Ja(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(Ka,t,!1)}function Ya(){return window.FrakSetup.core={..._a,...Ha},window.FrakSetup?.client?Promise.resolve():q(()=>Xa(),{cacheKey:`frak-sdk-init`,cacheTime:1/0}).catch(e=>{Q(window.FrakSetup?.client,`sdk_init_failed`,{reason:e instanceof Error?e.message:typeof e==`string`?e:`unknown`,config_missing:!window.FrakSetup?.config})})}async function Xa(){if(!window.FrakSetup?.config)throw Error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`);console.log(`[Frak SDK] Starting initialization`);let e=await ma({config:Za(window.FrakSetup.config)});if(!e)throw Error(`[Frak SDK] Failed to create client`);window.FrakSetup.client=e,console.log(`[Frak SDK] Client initialized successfully`),qa(),Na(e),Qa()}function Za(e){return e.preload===void 0?{...e,preload:Ga()}:e}function Qa(){let e=new URL(window.location.href);if(Ir(e.searchParams,`frakAction`)?.toLowerCase()!==`share`)return;console.log(`[Frak SDK] Auto open share via query param`);let t=Ir(e.searchParams,`link`)??void 0,n=Ir(e.searchParams,`placement`)??void 0,r=pa(Ir(e.searchParams,`products`));$(e.searchParams,`frakAction`),$(e.searchParams,`link`),$(e.searchParams,`placement`),$(e.searchParams,`products`),window.history.replaceState({},``,e.toString()),Ua(void 0,n,{link:t,products:r})}o.injectBase(`shared`,n),o.injectBase(`fouce`,`frak-button-share:not(:defined), frak-button-wallet:not(:defined), frak-open-in-app:not(:defined), frak-post-purchase:not(:defined), frak-banner:not(:defined) { display: none !important; }`),s(Ya);const $a={"button-share":()=>import(`./ButtonShare.DIyDUgaT.js`),"button-wallet":()=>import(`./ButtonWallet.DNxaFMHH.js`),"open-in-app":()=>import(`./OpenInAppButton.X1noMnvq.js`),"post-purchase":()=>import(`./PostPurchase._SYhdjOf.js`),banner:()=>import(`./Banner.wHYQSyz3.js`)},eo=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&to(e)});async function to(e){let t=e instanceof Element?e.tagName.toLowerCase():``,n=t?.startsWith(`frak-`),r=Array.from(e.querySelectorAll(`:not(:defined)`)).map(e=>e.tagName.toLowerCase()).filter(e=>e.startsWith(`frak-`));n&&!customElements.get(t)&&r.push(t);let i=[...new Set(r)];await Promise.allSettled(i.map(e=>no(e)))}async function no(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,``);if(!(t in $a))throw Error(`Component ${e} is not supported.`);await $a[t]()}catch(e){console.error(e)}}to(document.body),eo.observe(document.documentElement,{subtree:!0,childList:!0});export{Q as C,s as D,yn as E,o as O,ci as S,vn as T,xi as _,Pa as a,ui as b,Sa as c,Oi as d,Ci as f,Mi as g,Fi as h,Ma as i,n as k,wa as l,ua as m,Ja as n,Ca as o,Pi as p,Ua as r,va as s,Ya as t,fa as u,fi as v,Y as w,mi as x,pi as y};
168
+ ;function W(){let e=globalThis?.crypto?.subtle;if(typeof e==`object`&&e)return e;throw Error(`crypto.subtle must be defined`)}function un(e,t){return async function(n){let r=await e();return{secretKey:r,publicKey:await t(r)}}}function dn(e){let t=e.match(/[0-9a-f]{2}/gi);if(!t||t.length*2!==e.length)throw Error(`invalid hex`);return Uint8Array.from(t,e=>Number.parseInt(e,16))}function fn(e,t){if(t.type!==e)throw Error(`invalid key type, expected ${e}`)}function pn(e,t,n,r){let i=t?[`deriveBits`]:[`sign`],a=t?[]:[`verify`],o=(e,t)=>t===`jwk`?e:new Uint8Array(e),s={async import(t,n){let r=await W().importKey(n,t,e,!0,a);return fn(`public`,r),r},async export(e,t){fn(`public`,e);let n=await W().exportKey(t,e);return o(n,t)},async convert(e,t,n){return s.export(await s.import(e,t),n)}},c={async import(a,o){let s=W(),c;if(o===`raw`){let t=A(a,n,`secretKey`),o=dn(r),l=new Uint8Array(o.length+t.length);l.set(o,0),l.set(t,o.length),c=await s.importKey(sn,l,e,!0,i)}else t&&o===`jwk`&&(a={...a,key_ops:i}),c=await s.importKey(o,a,e,!0,i);return fn(`private`,c),c},async export(e,t){let r=W();if(fn(`private`,e),t===`raw`){let t=(await r.exportKey(`jwk`,e)).d.replace(/-/g,`+`).replace(/_/g,`/`),i=t.length%4?`=`.repeat(4-t.length%4):``,a=atob(t+i),o=Uint8Array.from(a,e=>e.charCodeAt(0)),s=new Uint8Array(n);return s.set(o,n-o.length),s}let i=await r.exportKey(t,e);return o(i,t)},async convert(e,t,n){return c.export(await c.import(e,t),n)}};async function l(e,t={}){I(t,{},{formatSec:`string`,formatPub:`string`},`opts`);let n=t.formatSec??cn,r=t.formatPub??ln,i=n===`jwk`?{...e}:await c.convert(e,n,`jwk`);return delete i.d,i.key_ops=a,r===`jwk`?i:s.convert(i,`jwk`,r)}async function u(t=cn){let n=await W().generateKey(e,!0,i);return c.export(n.privateKey,t)}let d;return{pub:s,priv:c,async isSupported(){if(d!==void 0)return d;try{let n=W(),r=await n.generateKey(e,!0,i);return await c.export(r.privateKey,`jwk`),t&&await n.deriveBits({name:typeof e==`string`?e:e.name,public:r.publicKey},r.privateKey,8),d=!0}catch{return d=!1}},getPublicKey:l,keygen:un(u,l),utils:Object.freeze({randomSecretKey:u,convertPublicKey:s.convert,convertSecretKey:c.convert})}}function mn(e,t){return{async sign(n,r,i={}){I(i,{},{formatSec:`string`,formatPub:`string`},`opts`);let a=await e.priv.import(r,i.formatSec??cn),o=await W().sign(t,a,n);return new Uint8Array(o)},async verify(n,r,i,a={}){I(a,{},{formatSec:`string`,formatPub:`string`},`opts`);let o=await e.pub.import(i,a.formatPub??ln);return await W().verify(t,o,n,r)}}}function hn(e,t,n){return{async getSharedSecret(r,i,a={}){I(a,{},{formatSec:`string`,formatPub:`string`},`opts`);let o=await e.priv.import(r,a.formatSec===void 0?cn:a.formatSec),s=await e.pub.import(i,a.formatPub===void 0?ln:a.formatPub),c=await W().deriveBits({name:typeof t==`string`?t:t.name,public:s},o,8*n);return new Uint8Array(c)}}}function gn(e,t,n,r){let i={name:`ECDH`,namedCurve:e},a=pn({name:`ECDSA`,namedCurve:e},!1,n,r),o=pn(i,!0,n,r);return Object.freeze({name:e,isSupported:a.isSupported,getPublicKey:a.getPublicKey,keygen:un(a.utils.randomSecretKey,a.getPublicKey),...mn(a,{name:`ECDSA`,hash:{name:t}}),...hn(o,i,n),utils:Object.freeze({...a.utils,async convertSecretKey(e,t,n){let r=t===`jwk`?e:void 0;return Array.isArray(r?.key_ops)&&r.key_ops.length===1&&r.key_ops[0]===`deriveBits`?o.utils.convertSecretKey(e,t,n):a.utils.convertSecretKey(e,t,n)}})})}const _n=gn(`P-256`,`SHA-256`,32,`3041020100301306072a8648ce3d020106082a8648ce3d030107042730250201010420`),vn={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006,userRejected:-32007};var yn=class extends Error{code;data;constructor(e,t,n){super(t),this.code=e,this.data=n}toJSON(){return{code:this.code,message:this.message,data:this.data}}},bn=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}};function xn(e){let{emittingTransport:t,listeningTransport:n,targetOrigin:r,middleware:i=[],lifecycleHandlers:a}=e,o=new Map;function s(e){return typeof e!=`object`||!e?!1:`clientLifecycle`in e||`iframeLifecycle`in e}function c(e){return typeof e!=`object`||!e?!1:`id`in e&&`topic`in e&&`data`in e}async function l(e){try{`clientLifecycle`in e&&a?.clientLifecycle?await a.clientLifecycle(e,{origin:r,source:null}):`iframeLifecycle`in e&&a?.iframeLifecycle&&await a.iframeLifecycle(e,{origin:r,source:null})}catch(e){console.error(`[RPC Client] Lifecycle handler error:`,e)}}async function u(e){let t={origin:r,source:null};for(let n of i)n.onRequest&&await n.onRequest(e,t);return e}async function d(e,t){let n={origin:r,source:null},a=t;for(let t of i)t.onResponse&&(a=await t.onResponse(e,a,n));return a}async function f(e){try{let t=new URL(e.origin).origin.toLowerCase(),n=new URL(r).origin.toLowerCase();if(t!==n){console.log(`Not expected origin`,t,n);return}}catch(e){console.error(`[RPC Client] Invalid origin`,e);return}if(s(e.data)){await l(e.data);return}if(!c(e.data))return;let t;try{let n=e.data.data,r=n instanceof Uint8Array||ArrayBuffer.isView(n)?{result:n}:n;t=await d(e.data,r)}catch(e){console.error(`[RPC Client] Middleware error on response:`,e);return}let n=o.get(e.data.id);n&&n(t)}async function p(e){let n=e;try{n=await u(e)}catch(e){throw console.error(`[RPC Client] Middleware error on request:`,e),e}t.postMessage(n,r)}function m(e){t.postMessage(e,r)}function h(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}n.addEventListener(`message`,f);function g(e){let t=h(),n=new bn;return o.set(t,e=>{e.error?n.reject(new yn(e.error.code,e.error.message,e.error.data)):n.resolve(e.result),o.delete(t)}),p({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(t),n.reject(e)}),n.promise}function _(e,t){let n=h();return o.set(n,e=>{e.error?(console.error(`[RPC Client] Listener error:`,e.error),o.delete(n)):t(e.result)}),p({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{console.error(`[RPC Client] Failed to send listener request:`,e),o.delete(n)}),()=>{o.delete(n)}}function v(){n.removeEventListener(`message`,f),o.clear()}return{request:g,listen:_,sendLifecycle:m,cleanup:v}}function Sn(e){return new TextEncoder().encode(JSON.stringify(e))}function Cn(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}const wn=`__frakEnv`,Tn={prod:{wallet:`https://wallet.frak.id`,backend:`https://backend.frak.id`},dev:{wallet:`https://wallet-dev.frak.id`,backend:`https://backend.gcp-dev.frak.id`}};function En(){return typeof window<`u`}let Dn=Tn.prod;function On(e){return e.replace(/\/+$/,``)}function kn(e){return typeof e==`string`?Object.hasOwn(Tn,e)?Tn[e]:(console.error(`[Frak SDK] Unknown env "${e}", falling back to production. Expected "prod", "dev", or { wallet, backend }.`),Tn.prod):!e?.wallet||!e?.backend?(console.error("[Frak SDK] env must state both `wallet` and `backend` origins, falling back to production. Received:",e),Tn.prod):{wallet:On(e.wallet),backend:On(e.backend)}}function An(e){if(!e)return jn();let t=kn(e),n=En()?window[wn]:void 0;return n&&(n.wallet!==t.wallet||n.backend!==t.backend)&&console.warn(`[Frak SDK] env changed after being published; the last value wins for every SDK call on this page.`,{previous:n,next:t}),Dn=t,En()&&(window[wn]=t),t}function jn(){return En()?window[wn]??Dn:Dn}function Mn(){return jn().wallet}function G(){return jn().backend}var Nn=class extends Map{maxSize;constructor(e){super(),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};let K;function Pn(){return K||={promiseCache:new Nn(1024),responseCache:new Nn(1024),failureCache:new Nn(1024)},K}async function q(e,{cacheKey:t,cacheTime:n=3e4}){let{promiseCache:r,responseCache:i,failureCache:a}=Pn();if(n>0){let e=i.get(t);if(e&&Date.now()-e.created<n)return e.data}let o=a.get(t);if(o&&Date.now()-o<1e3)throw Error(`Cache: ${t} recently failed, backing off`);let s=r.get(t);s||(s=e(),r.set(t,s));try{let e=await s;return i.set(t,{data:e,created:Date.now()}),a.delete(t),e}catch(e){throw a.set(t,Date.now()),e}finally{r.delete(t)}}function Fn(){K&&(K.promiseCache.clear(),K.responseCache.clear(),K.failureCache.clear())}const In=`__frakSdkConfig`,Ln=`frak-config-cache`,Rn=`frak-merchant-id`,zn={key:Ln},J=typeof window<`u`;function Bn(){return{isResolved:!1,merchantId:``}}let Y=null;function Vn(){if(!J)return null;try{let e=localStorage.getItem(zn.key);if(!e)return null;let t=JSON.parse(e);return t.config?.isResolved?(Y=t,t):null}catch{return null}}function Hn(){return(Y??Vn())?.config}function Un(){let e=Y??Vn();return e?Date.now()-e.timestamp<3e4:!1}function Wn(e){if(!(!J||!e.isResolved))try{let t={config:e,timestamp:Date.now()};localStorage.setItem(zn.key,JSON.stringify(t)),Y=t}catch{}}function Gn(){if(J){Y=null;try{localStorage.removeItem(zn.key)}catch{}}}function Kn(){J&&(window[In]||(window[In]=Hn()??Bn()))}function qn(){return J?(Kn(),window[In]??Bn()):Bn()}function Jn(e){J&&window.dispatchEvent(new CustomEvent(`frak:config`,{detail:e}))}function Yn(e){return e??(J?window.location.hostname:``)}async function Xn(e,t){try{let n=G(),r=t?`&lang=${encodeURIComponent(t)}`:``,i=await fetch(`${n}/user/merchant/resolve?domain=${encodeURIComponent(e)}${r}`);if(!i.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${e}: ${i.status}`);return}let a=await i.json();if(J)try{sessionStorage.setItem(Rn,a.merchantId)}catch{}return a}catch(e){console.warn(`[Frak SDK] Failed to fetch merchant config:`,e);return}}const X={getConfig:qn,get isResolved(){return qn().isResolved},get isCacheFresh(){return Un()},setCacheScope(e,t){let n=`${e}:${t??``}`;zn.key=`${Ln}:${n}`,Y=null},setConfig(e){if(J&&(window[In]=e),Wn(e),Jn(e),J&&e.merchantId)try{sessionStorage.setItem(Rn,e.merchantId)}catch{}},reset(){let e=Hn()??Bn();J&&(window[In]=e),Jn(e)},clearCache(){if(Gn(),Fn(),J)try{sessionStorage.removeItem(Rn)}catch{}},resolve(e,t){let n=Yn(e);return n?q(async()=>{let e=await Xn(n,t);if(!e)throw Error(`Config resolution returned empty`);return e},{cacheKey:`sdkConfig:${n}:${t??``}`,cacheTime:1/0}).catch(()=>void 0):Promise.resolve(void 0)},getMerchantId(){let e=qn();if(e.isResolved&&e.merchantId)return e.merchantId;if(J)try{return sessionStorage.getItem(Rn)??void 0}catch{}},async resolveMerchantId(e){return X.getMerchantId()||(await X.resolve(e))?.merchantId}};function Zn(){if(!(typeof navigator>`u`))return navigator.locks}async function Qn(e,t,n={}){let r=Zn();if(!r)return t();if(n.ifAvailable){let n=!1;try{return await r.request(e,{ifAvailable:!0},async e=>{if(e)return n=!0,t()})}catch(e){if(n)throw e;return t()}}let i=new AbortController,a=setTimeout(()=>i.abort(),5e3),o=!1;try{return await r.request(e,{signal:i.signal},()=>(o=!0,t()))}catch(e){if(o)throw e;return t()}finally{clearTimeout(a)}}async function $n(e){return p(be(e))}const er=`frak-client-id`,tr=`frak-client-key`,nr=`frak-client-id-legacy`,rr={formatSec:`raw`,formatPub:`raw`};let ir=null;function ar(){return ir??=_n.isSupported().then(e=>e?_n:on).catch(()=>on),ir}const or=()=>typeof window<`u`&&!!window.localStorage;let sr=null;function cr(e){let t=m(e);if(sr?.keyHex===t)return sr.publicKey;let n=on.getPublicKey(e,!1);return sr={keyHex:t,publicKey:n},n}function lr(){if(or())return localStorage.getItem(nr)??void 0}function ur(){or()&&localStorage.removeItem(nr)}function dr(){let e=localStorage.getItem(tr);if(!e)return null;if(!/^[0-9a-f]{64}$/i.test(e))throw Error(`[Frak SDK] Corrupt client key`);return h(e)}function fr(e){try{for(let[t,n]of e)localStorage.setItem(t,n)}catch{}}async function pr(){if(!or())throw Error(`[Frak SDK] No window/localStorage available to derive a client id`);if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`[Frak SDK] crypto.getRandomValues unavailable, cannot derive a client id`);return Qn(`frak-identity-key`,mr)}async function mr(){let e=localStorage.getItem(er),t,n,r;try{t=dr(),n=t??on.utils.randomSecretKey(),r=await $n(cr(n))}catch(e){throw localStorage.removeItem(tr),sr=null,e}if(t){e!==r&&fr([[er,r]]);let t=lr();return{clientId:r,...t&&{pendingLegacyId:t}}}return fr([...e?[[nr,e]]:[],[tr,m(n)],[er,r]]),{clientId:r,...e&&{pendingLegacyId:e}}}async function Z(e){if(!or())return null;try{let t=dr();if(!t)return null;let n=e.ts??Math.floor(Date.now()/1e3),r=f({op:e.op,merchantId:e.merchantId,anonymousId:e.anonymousId,binding:e.binding??new Uint8Array,ts:n}),i=await ar()===_n?await _n.sign(r,t,rr):on.sign(r,t,{prehash:!0});return _({v:1,pk:cr(t),ts:n,sig:i})}catch{return null}}function hr(){return{"x-frak-sdk-version":`1.3.0`}}const gr=new Set([`PROOF_REQUIRED`,`PROOF_OR_TOKEN_REQUIRED`,`MISSING_ANONYMOUS_ID`]);async function _r(e){if(e.status>=500||e.status===403)return!0;try{let t=await e.clone().json();return typeof t.code==`string`&&gr.has(t.code)}catch{return!1}}async function vr({legacyId:e,derivedId:t}){if(!(typeof window>`u`)){if(!e||e===t){ur();return}await Qn(`frak-legacy-merge`,async()=>{lr()===e&&await yr({legacyId:e,derivedId:t})},{ifAvailable:!0})}}async function yr({legacyId:e,derivedId:t}){try{let n=await X.resolveMerchantId();if(!n)return;let r=await Z({op:`frak-merge-v1`,merchantId:n,anonymousId:t});if(!r)return;let i=G(),a=await fetch(`${i}/user/identity/merge/initiate`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,...hr()},body:JSON.stringify({sourceAnonymousId:t,merchantId:n,proof:r})});if(!a.ok){await _r(a)||ur();return}let{mergeToken:o}=await a.json();if(!o)return;let s=await fetch(`${i}/user/identity/merge/execute`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,...hr()},body:JSON.stringify({mergeToken:o,targetAnonymousId:e,merchantId:n})});if(s.ok){ur();return}await _r(s)||ur()}catch{}}let br=null,xr=null;async function Sr(){return br||xr||(xr=pr().then(({clientId:e,pendingLegacyId:t})=>(br=e,t&&vr({legacyId:t,derivedId:e}),e)),xr)}function Cr(){if(br)return br;Sr().catch(()=>{})}async function Q(){return br||Sr()}function wr(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function Tr(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(e.length+(t===0?0:4-t),`=`)),e=>e.charCodeAt(0))}function Er(e){return wr(Sn(e))}function Dr(e,t,n,r,i,a,o){let s=Er(Or({redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,merchantId:n,metadata:{name:r,css:a,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink},clientId:i,proof:o})),c=new URL(e);return c.pathname=`/sso`,c.searchParams.set(`p`,s),c.toString()}function Or(e){return{r:e.redirectUrl,cId:e.clientId,d:e.directExit,l:e.lang,m:e.merchantId,md:{n:e.metadata?.name,css:e.metadata?.css,l:e.metadata?.logoUrl,h:e.metadata?.homepageLink},pf:e.proof}}function kr(e){return{...e,directExit:e.directExit??!e.redirectUrl}}async function Ar(e,t){let{metadata:n,customizations:r}=e.config,i=Cr()??await Q().catch(()=>void 0),a=await X.resolveMerchantId()??``,o=i&&a?await Z({op:`frak-sso-v1`,merchantId:a,anonymousId:i}):null;return{ssoUrl:Dr(Mn(),kr(t),a,n.name,i,r?.css,o??void 0)}}const jr=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,Mr=`frak-sso`;async function Nr(e,t){let{metadata:n,customizations:r}=e.config;if(`ssoUrl`in t)return Pr(t.ssoUrl),await e.request({method:`frak_openSso`,params:[{},n.name,r?.css]})??{};let i=kr(t);return i.openInSameWindow??!!i.redirectUrl?await e.request({method:`frak_openSso`,params:[i,n.name,r?.css]}):(Pr(i.ssoPopupUrl??(await Ar(e,i)).ssoUrl),await e.request({method:`frak_openSso`,params:[i,n.name,r?.css]})??{})}function Pr(e){let t=window.open(e,Mr,jr);if(!t)throw Error(`Popup was blocked. Please allow popups for this site.`);t.focus()}function Fr(e,t,n){if(!e){console.debug(`[Frak] No client provided, skipping event tracking`);return}try{e.openPanel?.track(t,n)}catch(e){console.debug(`[Frak] Failed to track event:`,t,e)}}function Ir(e,t){let n=e.get(t);if(n!==null)return n;let r=t.toLowerCase();for(let[t,n]of e)if(t.toLowerCase()===r)return n;return null}function $(e,t){let n=t.toLowerCase(),r=[...e.keys()].filter(e=>e.toLowerCase()===n);for(let t of r)e.delete(t)}const Lr=/^0x[a-fA-F0-9]{40}$/;function Rr(e){return typeof e==`string`&&Lr.test(e)}function zr(e,t){return e.toLowerCase()===t.toLowerCase()}function Br(e){let t=new Uint8Array(20);for(let n=0;n<20;n++){let r=Number.parseInt(e.substring(2+n*2,4+n*2),16);if(Number.isNaN(r))throw Error(`Invalid address: ${e}`);t[n]=r}return t}const Vr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Hr(e){let t=`0x`;for(let n=0;n<20;n++)t+=Vr[e[n]];return t}function Ur(e){return`r`in e&&!(`v`in e)}function Wr(e){return`v`in e&&e.v===2}const Gr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Kr(e){return typeof e==`string`&&Gr.test(e)}function qr(e){let t=e.replace(/-/g,``),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=Number.parseInt(t.substring(e*2,e*2+2),16);return n}function Jr(e){let t=``;for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,`0`);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}function Yr(e){if(!Kr(e.m)||!Number.isInteger(e.t)||e.t<0||e.t>4294967295)return null;let t=typeof e.c==`string`&&e.c.length>0,n=typeof e.w==`string`&&Rr(e.w);if(!t&&!n||t&&!Kr(e.c))return null;let r=new Uint8Array(21+(t?16:0)+(n?20:0)),i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=0;return r[a++]=2|(t?16:0)|(n?32:0),r.set(qr(e.m),a),a+=16,i.setUint32(a,e.t,!1),a+=4,t&&(r.set(qr(e.c),a),a+=16),n&&(r.set(Br(e.w),a),a+=20),r}function Xr(e){if(e.length<21)return null;let t=e[0];if((t&15)!=2||t&192)return null;let n=!!(t&16),r=!!(t&32);if(!n&&!r)return null;let i=21+(n?16:0)+(r?20:0);if(e.length!==i)return null;let a=1,o=Jr(e.subarray(a,a+16));a+=16;let s=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(a,!1);a+=4;let c={v:2,m:o,t:s};if(n&&(c.c=Jr(e.subarray(a,a+16)),a+=16),r){let t=Hr(e.subarray(a,a+20));if(!Rr(t))return null;c.w=t,a+=20}return c}const Zr=`fCtx`;function Qr(e){if(e)try{if(Wr(e)){let t=Yr(e);return t?wr(t):void 0}return wr(Br(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function $r(e){if(!(!e||e.length===0))try{let t=Tr(e);if(t.length!==20)return Xr(t)||void 0;let n=Hr(t);if(Rr(n))return{r:n}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function ei({url:e}){if(!e)return null;let t=Ir(new URL(e).searchParams,Zr);return t?$r(t):null}function ti(e){return{utm_source:e.utmSource??`frak`,utm_medium:e.utmMedium??void 0,utm_campaign:e.utmCampaign??void 0,utm_content:e.utmContent,utm_term:e.utmTerm,via:e.via??void 0,ref:e.ref??void 0}}function ni(e,t){let n=ti(t??{});for(let[t,r]of Object.entries(n))r!==void 0&&r!==``&&(e.searchParams.has(t)||e.searchParams.set(t,r))}function ri({url:e,context:t,attribution:n}){if(!e)return null;let r=Qr(t);if(!r)return null;let i=new URL(e);return $(i.searchParams,Zr),i.searchParams.set(Zr,r),ni(i,n),i.toString()}function ii(e){let t=new URL(e);return $(t.searchParams,Zr),t.toString()}function ai({url:e,context:t}){if(!window.location?.href||typeof window>`u`){console.error(`No window found, can't update context`);return}let n=e??window.location.href,r;r=t===null?ii(n):ri({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const oi={compress:Qr,decompress:$r,parse:ei,update:ri,remove:ii,replaceUrl:ai},si={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function ci(e){return e&&e in si?e:`eur`}function li(e){return e?si[e]??si.eur:si.eur}function ui(e,t){let n=li(t),r=ci(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function di(e){return e.formatToParts(1.1).find(e=>e.type===`decimal`)?.value??`.`}function fi(e,t){let n=li(t),r=ci(t),i=new Intl.NumberFormat(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2}),a=i.formatToParts(e),o=``,s=``,c=``,l=`suffix`,u=!1;for(let e of a)switch(e.type){case`integer`:case`group`:o+=e.value,u=!0;break;case`decimal`:case`fraction`:s+=e.value;break;case`currency`:c=e.value,l=u?`suffix`:`prefix`}return{integer:o,decimals:s||`${di(i)}00`,unit:c,unitPosition:l}}function pi(e){return{integer:String(e),unit:`%`,unitPosition:`suffix`}}function mi(e){return e?`${e}Amount`:`eurAmount`}var hi=class{constructor(e){this.baseUrl=e.baseUrl,this.headers={"Content-Type":`application/json`,...e.defaultHeaders},this.maxRetries=e.maxRetries??3,this.initialRetryDelay=e.initialRetryDelay??500}async resolveHeaders(){let e={};for(let[t,n]of Object.entries(this.headers)){let r=await n;r!==null&&(e[t]=r)}return e}addHeader(e,t){this.headers[e]=t}async post(e,t,n,r){try{let r=await fetch(e,{method:`POST`,headers:await this.resolveHeaders(),body:t?JSON.stringify(t??{}):void 0,keepalive:!0,...n});if(r.status===401)return null;if(r.status!==200&&r.status!==202)throw Error(`HTTP error! status: ${r.status}`);let i=await r.text();return i?JSON.parse(i):null}catch(i){if(r<this.maxRetries){let i=this.initialRetryDelay*2**r;return await new Promise(e=>setTimeout(e,i)),this.post(e,t,n,r+1)}return console.error(`Max retries reached:`,i),null}}async fetch(e,t,n={}){let r=`${this.baseUrl}${e}`;return this.post(r,t,n,0)}},gi=class{constructor(e){this.groups=[],this.queue=[],this.options=e;let t={"openpanel-client-id":e.clientId};e.clientSecret&&(t[`openpanel-client-secret`]=e.clientSecret),t[`openpanel-sdk-name`]=e.sdk||`node`,t[`openpanel-sdk-version`]=e.sdkVersion||`1.3.1`,this.api=new hi({baseUrl:e.apiUrl||`https://api.openpanel.dev`,defaultHeaders:t})}init(){}ready(){this.options.disabled=!1,this.options.waitForProfile=!1,this.flush()}shouldQueue(e){return!!(this.options.disabled||this.options.waitForProfile&&!this.profileId||e.type===`replay`&&!this.sessionId)}addQueue(e){e.type===`track`&&(e.payload.properties={...e.payload.properties??{},__timestamp:new Date().toISOString()}),this.queue.push(e)}async send(e){if(this.options.filter&&!this.options.filter(e))return Promise.resolve();if(this.shouldQueue(e))return this.addQueue(e),Promise.resolve();let t=await this.api.fetch(`/track`,e,{keepalive:e.type!==`replay`});this.deviceId=t?.deviceId;let n=!!this.sessionId;return this.sessionId=t?.sessionId,!n&&this.sessionId&&this.flush(),t}setGlobalProperties(e){this.global={...this.global,...e}}track(e,t){this.log(`track event`,e,t);let{groups:n,profileId:r,...i}=t??{},a=[...new Set([...this.groups,...n??[]])];return this.send({type:`track`,payload:{name:e,profileId:r??this.profileId,groups:a.length>0?a:void 0,properties:{...this.global??{},...i}}})}identify(e){if(this.log(`identify user`,e),e.profileId&&(this.profileId=e.profileId,this.flush()),e.profileId&&Object.keys(e).length>1)return this.send({type:`identify`,payload:{...e,properties:{...this.global,...e.properties}}})}upsertGroup(e){return this.log(`upsert group`,e),this.send({type:`group`,payload:e})}setGroup(e){return this.log(`set group`,e),this.groups.includes(e)||(this.groups=[...this.groups,e]),this.send({type:`assign_group`,payload:{groupIds:[e],profileId:this.profileId}})}setGroups(e){return this.log(`set groups`,e),this.groups=[...new Set([...this.groups,...e])],this.send({type:`assign_group`,payload:{groupIds:e,profileId:this.profileId}})}alias(e){}increment(e){return this.send({type:`increment`,payload:e})}decrement(e){return this.send({type:`decrement`,payload:e})}revenue(e,t){let n=t?.deviceId;return delete t?.deviceId,this.track(`revenue`,{...t??{},...n?{__deviceId:n}:{},__revenue:e})}getDeviceId(){return this.deviceId??``}getSessionId(){return this.sessionId??``}fetchDeviceId(){return Promise.resolve(this.deviceId??``)}clear(){this.profileId=void 0,this.groups=[],this.deviceId=void 0,this.sessionId=void 0}buildFlushPayload(e){if(e.type===`replay`)return e.payload;if(e.type===`track`){let t=`groups`in e.payload?e.payload.groups??[]:[],n=[...new Set([...this.groups,...t])];return{...e.payload,profileId:e.payload.profileId??this.profileId,groups:n.length>0?n:void 0}}return e.type===`identify`||e.type===`increment`||e.type===`decrement`||e.type===`assign_group`?{...e.payload,profileId:e.payload.profileId??this.profileId}:e.payload}flush(){let e=[];for(let t of this.queue){if(this.shouldQueue(t)){e.push(t);continue}let n=this.buildFlushPayload(t);this.send({...t,payload:n})}this.queue=e}log(...e){this.options.debug&&console.log(`[OpenPanel.dev]`,...e)}},_i=typeof document<`u`?document.currentScript:null;function vi(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var yi=class extends gi{constructor(e){if(super({sdk:`web`,sdkVersion:`1.4.1`,...e}),this.options=e,this.lastPath=``,this.pendingRevenues=[],!this.isServer()){try{let e=sessionStorage.getItem(`openpanel-pending-revenues`);if(e){let t=JSON.parse(e);Array.isArray(t)&&(this.pendingRevenues=t)}}catch{this.pendingRevenues=[]}if(this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&(this.trackScreenViews(),setTimeout(()=>this.screenView(),0)),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes(),this.options.sessionReplay?.enabled){let e=this.options.sessionReplay.sampleRate??1;Math.random()<e&&this.loadReplayModule().then(e=>{e&&e.startReplayRecorder(this.options.sessionReplay,e=>{this.send({type:`replay`,payload:{...e}})})})}}}async loadReplayModule(){try{if(typeof __OPENPANEL_REPLAY_URL__<`u`){let e=_i,t=this.options.sessionReplay?.scriptUrl||e?.src?.replace(`.js`,`-replay.js`)||`https://openpanel.dev/op1-replay.js`;return window.__openpanel_replay?window.__openpanel_replay:new Promise(e=>{let n=document.createElement(`script`);n.src=t,n.onload=()=>{e(window.__openpanel_replay??null)},n.onerror=()=>{console.warn(`[OpenPanel] Failed to load replay script from`,t),e(null)},document.head.appendChild(n)})}return await import(`./replay-V6FXES7X.CgBxdfNp.js`)}catch(e){return console.warn(`[OpenPanel] Failed to load replay module`,e),null}}debounce(e,t){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(e,t)}isServer(){return typeof document>`u`}trackOutgoingLinks(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`a`);if(n&&t){let e=n.getAttribute(`href`);if(e?.startsWith(`http`))try{let r=new URL(e),i=window.location.hostname;r.hostname!==i&&super.track(`link_out`,{href:e,text:n.innerText||n.getAttribute(`title`)||t.getAttribute(`alt`)||t.getAttribute(`title`)})}catch{}}})}trackScreenViews(){if(this.isServer())return;let e=history.pushState;history.pushState=function(...t){let n=e.apply(this,t);return window.dispatchEvent(new Event(`pushstate`)),window.dispatchEvent(new Event(`locationchange`)),n};let t=history.replaceState;history.replaceState=function(...e){let n=t.apply(this,e);return window.dispatchEvent(new Event(`replacestate`)),window.dispatchEvent(new Event(`locationchange`)),n},window.addEventListener(`popstate`,()=>{window.dispatchEvent(new Event(`locationchange`))});let n=()=>this.debounce(()=>this.screenView(),50);this.options.trackHashChanges?window.addEventListener(`hashchange`,n):window.addEventListener(`locationchange`,n)}trackAttributes(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`button`),r=t.closest(`a`),i=n?.getAttribute(`data-track`)?n:r?.getAttribute(`data-track`)?r:null;if(i){let e={};for(let t of i.attributes)t.name.startsWith(`data-`)&&t.name!==`data-track`&&(e[vi(t.name.replace(/^data-/,``))]=t.value);let t=i.getAttribute(`data-track`);t&&super.track(t,e)}})}track(e,t){return super.track(e,{...t,__path:this.lastPath})}screenView(e,t){if(this.isServer())return;let n,r;typeof e==`string`?(n=e,r=t):(n=window.location.href,r=e),this.lastPath!==n&&(this.lastPath=n,super.track(`screen_view`,{...r??{},__path:n,__title:document.title}))}async flushRevenue(){let e=this.pendingRevenues.map(e=>super.revenue(e.amount,e.properties));await Promise.all(e),this.clearRevenue()}clearRevenue(){if(this.pendingRevenues=[],!this.isServer())try{sessionStorage.removeItem(`openpanel-pending-revenues`)}catch{}}pendingRevenue(e,t){if(this.pendingRevenues.push({amount:e,properties:t}),!this.isServer())try{sessionStorage.setItem(`openpanel-pending-revenues`,JSON.stringify(this.pendingRevenues))}catch{}}};const bi=`nexus-wallet-backup`,xi=`frakwallet://`;function Si(e){let t=e?.split(`-`)[0]?.toLowerCase();return t===`en`||t===`fr`?t:void 0}function Ci(){return(typeof document<`u`?Si(document.documentElement.lang):void 0)||(typeof navigator<`u`?Si(navigator.language):void 0)}function wi(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href),r=n.searchParams.get(`sso`);r&&(t.then(()=>{e.sendLifecycle({clientLifecycle:`sso-redirect-complete`,data:{compressed:r}}),console.log(`[SSO URL Listener] Forwarded compressed SSO data to iframe`)}).catch(e=>{console.error(`[SSO URL Listener] Failed to forward SSO data:`,e)}),n.searchParams.delete(`sso`),window.history.replaceState({},``,n.toString()),console.log(`[SSO URL Listener] SSO parameter detected and URL cleaned`))}function Ti(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}const Ei=xi.replace(`://`,``);function Di(e){return`intent://${e.slice(13)}#Intent;scheme=${Ei};end`}function Oi(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=Ti()&&ki(e)?Di(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function ki(e){return e.startsWith(xi)}function Ai(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent;return!!(/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1)}const ji=Ai();function Mi(){return typeof navigator>`u`?!1:ji?!0:/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function Ni(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase();return e.includes(`instagram`)||e.includes(`fban`)||e.includes(`fbav`)||e.includes(`facebook`)}const Pi=Ni();function Fi(e){ji&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:ji&&e.startsWith(`http://`)?window.location.href=`x-safari-http://${e.slice(7)}`:window.location.href=`${G()}/common/social?u=${encodeURIComponent(e)}`}const Ii={id:`frak-wallet`,name:`frak-wallet`,title:`Frak Wallet`,allow:`publickey-credentials-get *; clipboard-write; web-share *`,style:{width:`0`,height:`0`,border:`0`,position:`absolute`,zIndex:2000001,top:`-1000px`,left:`-1000px`,colorScheme:`auto`}};async function Li({config:e}){let t=document.querySelector(`#frak-wallet`);t&&t.remove();let n=document.createElement(`iframe`);n.id=Ii.id,n.name=Ii.name,n.allow=Ii.allow,n.style.zIndex=Ii.style.zIndex.toString(),zi({iframe:n,isVisible:!1});let r=An(e?.env).wallet,i=await Sr().catch(e=>{console.warn(`[Frak SDK] Unable to derive a client id`,e)});return Vi(r),Vi(G()),n.src=Ri({walletUrl:r,clientId:i,preload:e?.preload}),new Promise(e=>{n.addEventListener(`load`,()=>e(n)),document.body.appendChild(n)})}function Ri({walletUrl:e=Mn(),clientId:t,preload:n}){let r=t?`${e}/listener?clientId=${encodeURIComponent(t)}`:`${e}/listener`;return!n||n.length===0?r:`${r}#preload=${n.join(`,`)}`}function zi({iframe:e,isVisible:t}){if(!t){e.style.width=`0`,e.style.height=`0`,e.style.border=`0`,e.style.position=`fixed`,e.style.top=`-1000px`,e.style.left=`-1000px`;return}e.style.position=`fixed`,e.style.top=`0`,e.style.left=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`auto`}function Bi(e=`/listener`){if(!window.opener)return null;let t=t=>{try{return t.location.origin===window.location.origin&&t.location.pathname===e}catch{return!1}};if(t(window.opener))return window.opener;try{let e=window.opener.frames;for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}catch(t){return console.error(`[findIframeInOpener] Error finding iframe with pathname ${e}:`,t),null}}function Vi(e){if(!(typeof document>`u`))try{let t=new URL(e).origin,n=`link[rel="preconnect"][data-frak-preconnect="${t}"]`;if(document.head.querySelector(n))return;let r=document.createElement(`link`);r.rel=`preconnect`,r.href=t,r.crossOrigin=``,r.dataset.frakPreconnect=t,document.head.appendChild(r)}catch{}}const Hi=ji&&Pi;function Ui(e){e?localStorage.setItem(bi,e):localStorage.removeItem(bi)}function Wi(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=qi(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function Gi(e){let t=new URL(window.location.href);e&&t.searchParams.set(`fmt`,e);let n=t.protocol===`http:`?`x-safari-http`:`x-safari-https`;window.location.href=`${n}://${t.host}${t.pathname}${t.search}${t.hash}`}function Ki(e){return e.includes(`/common/social`)}function qi(e,t){if(!t)return e;try{let n=new URL(e);return n.searchParams.set(`fmt`,t),n.toString()}catch{return`${e}${e.includes(`?`)?`&`:`?`}fmt=${encodeURIComponent(t)}`}}function Ji(e,t,n,r,i){if(i){let e=Wi(t,r);window.open(e,`_blank`);return}if(ki(t)){let i=Wi(t,r);Oi(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(Hi&&Ki(t))Gi(r);else{let e=Wi(t,r);window.location.href=e}}function Yi({iframe:e,targetOrigin:t}){let n=new bn;return{handleEvent:r=>{if(!(`iframeLifecycle`in r))return;let{iframeLifecycle:i,data:a}=r;switch(i){case`connected`:n.resolve(!0);break;case`do-backup`:Ui(a.backup);break;case`remove-backup`:localStorage.removeItem(bi);break;case`show`:case`hide`:zi({iframe:e,isVisible:i===`show`});break;case`redirect`:Ji(e,a.baseRedirectUrl,t,a.mergeToken,a.openInNewTab)}},isConnected:n.promise}}async function Xi({config:e,iframe:t}){let n=An(e?.env).wallet,r=e.metadata.lang??Ci(),i=e.domain??(typeof window<`u`?window.location.hostname:``);X.setCacheScope(i,r),X.reset();let a=X.isCacheFresh?void 0:X.resolve(e.domain,r),o=await Q().catch(()=>void 0),s=Yi({iframe:t,targetOrigin:n}),c=new bn,l=Date.now();if(!t.contentWindow)throw new yn(vn.configError,`The iframe does not have a content window`);let u=xn({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await s.isConnected)throw new yn(vn.clientNotConnected,`The iframe provider isn't connected yet`);return await c.promise,t}}],lifecycleHandlers:{iframeLifecycle:(e,t)=>{s.handleEvent(e)}}}),d=Zi(u,s),f,p=!1,m=async()=>{p=!0,d(),f?.(),u.cleanup(),t.remove(),Fn(),X.clearCache(),X.reset()},h;{console.log(`[Frak SDK] Initializing OpenPanel`),h=new yi({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdk_version`in t.properties||(t.properties={...t.properties,sdk_version:`1.3.0`,...o&&{user_anonymous_client_id:o}}),!0)}),h.setGlobalProperties({sdk_version:`1.3.0`,...o&&{user_anonymous_client_id:o}}),h.init(),h.track(`sdk_initialized`,{sdk_version:`1.3.0`});let e=!1,t=setTimeout(()=>{e||(e=!0,h?.track(`sdk_iframe_handshake_failed`,{reason:`timeout`}))},3e4);s.isConnected.then(()=>{e||(e=!0,clearTimeout(t),h?.track(`sdk_iframe_connected`,{handshake_duration_ms:Date.now()-l}))}).catch(()=>{e||(e=!0,clearTimeout(t),h?.track(`sdk_iframe_handshake_failed`,{reason:`unknown`}))})}let g=na({config:e,rpcClient:u,lifecycleManager:s,configPromise:a,contextSent:c,openPanel:h,clientId:o}).then(e=>{if(p){e();return}f=e}).catch(e=>{throw c.reject(e),e});return{config:e,waitForConnection:s.isConnected,waitForSetup:g,request:u.request,listenerRequest:u.listen,destroy:m,openPanel:h}}function Zi(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,250),r=setTimeout(()=>{o(),console.log(`Heartbeat timeout: connection failed`)},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}function Qi(e){return e.hasRawSdkConfig?{name:e.name,logoUrl:e.logoUrl,homepageLink:e.homepageLink,lang:e.lang,currency:e.currency,hidden:e.hidden,css:e.css,translations:e.translations,placements:e.placements,attribution:e.attribution}:e.attribution?{attribution:e.attribution}:void 0}function $i(e,t){if(!e)return;let n=e.global??{};e.setGlobalProperties({...n,merchant_id:t.merchantId,domain:t.domain??``})}async function ea(e){let t=new TextEncoder().encode(e);if(typeof crypto<`u`&&crypto.subtle)try{let e=await crypto.subtle.digest(`SHA-256`,t);return new Uint8Array(e)}catch{}try{return be(t)}catch{return}}async function ta({merchantId:e,anonymousId:t,pendingMergeToken:n}){let r=n?await ea(n):void 0,[i,a,o]=await Promise.all([r?Z({op:`frak-merge-v1`,merchantId:e,anonymousId:t,binding:r}):Promise.resolve(null),Z({op:`frak-merge-v1`,merchantId:e,anonymousId:t}),Z({op:`frak-install-v1`,merchantId:e,anonymousId:t})]);if(!(!i&&!a&&!o))return{anonymousId:t,proofs:{...i&&{merge:i},...a&&{mergeSource:a},...o&&{install:o}}}}async function na({config:e,rpcClient:t,lifecycleManager:n,configPromise:r,contextSent:i,openPanel:a,clientId:o}){await n.isConnected,wi(t,n.isConnected);let s=new URL(window.location.href),c=s.searchParams.get(`fmt`)??void 0;c&&(s.searchParams.delete(`fmt`),window.history.replaceState({},``,s.toString()));let l=t=>{let n=t?.merchantId??e.metadata.merchantId??``,r=t?.domain??``,i=t?.allowedDomains??[],a=t?.sdkConfig,o=a?.attribution||e.attribution?{...e.attribution,...a?.attribution}:void 0;X.setConfig(a?{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,hasRawSdkConfig:!0,name:a.name??e.metadata.name,logoUrl:a.logoUrl??e.metadata.logoUrl,homepageLink:a.homepageLink??e.metadata.homepageLink,lang:a.lang??e.metadata.lang,currency:a.currency??e.metadata.currency,hidden:a.hidden,css:a.css,translations:a.translations,placements:a.placements,components:a.components,attribution:o}:{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,name:e.metadata.name,logoUrl:e.metadata.logoUrl,homepageLink:e.metadata.homepageLink,lang:e.metadata.lang,currency:e.metadata.currency,attribution:o})},u=!1,d=Promise.resolve(),f=e=>{let n=u?void 0:c;u=!0;let r=Qi(e),i=o,s=window.location.href;return $i(a,e),d=d.then(async()=>{t.sendLifecycle({clientLifecycle:`resolved-config`,data:{merchantId:e.merchantId,domain:e.domain??``,allowedDomains:e.allowedDomains??[],sourceUrl:s,...i&&{sdkAnonymousId:i},...n&&{pendingMergeToken:n},...r&&{sdkConfig:r},...i&&{sdkIdentity:await ta({merchantId:e.merchantId,anonymousId:i,pendingMergeToken:n})}}})}).catch(e=>{console.error(`Failed to send lifecycle config`,e)}),d};X.isResolved&&f(X.getConfig()).then(i.resolve),r&&(l(await r),f(X.getConfig()).then(i.resolve));async function p(){let n=e.customizations?.css;n&&t.sendLifecycle({clientLifecycle:`modal-css`,data:{cssLink:n}})}async function m(){let n=e.customizations?.i18n;n&&t.sendLifecycle({clientLifecycle:`modal-i18n`,data:{i18n:n}})}async function h(){if(typeof window>`u`)return;let e=window.localStorage.getItem(bi);e&&t.sendLifecycle({clientLifecycle:`restore-backup`,data:{backup:e}})}return(await Promise.allSettled([p(),m(),h()])).some(e=>e.status===`rejected`)&&a?.track(`sdk_iframe_handshake_failed`,{reason:`asset_push`}),ra(f)}function ra(e){if(typeof document>`u`)return()=>{};let t=0,n=n=>{if(document.visibilityState!==`visible`||!X.isResolved)return;let r=Date.now();n&&r-t<6e4||(t=r,e(X.getConfig()))},r=()=>n(!0),i=setInterval(()=>n(!1),3e5);return document.addEventListener(`visibilitychange`,r),()=>{clearInterval(i),document.removeEventListener(`visibilitychange`,r)}}function ia(e){return Cn(Tr(e))}function aa(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function oa(e){if(!e)return null;if(Array.isArray(e))return e;if(typeof e!=`string`)return null;try{let t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function sa(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e==`string`&&e.trim()!==``){let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}}function ca(e){if(typeof e!=`string`)return;let t=e.trim();return t===``?void 0:t}function la(e){if(!e||typeof e!=`object`)return;let t=e,n={},r=ca(t.productId);r!==void 0&&(n.productId=r);let i=ca(t.sku);i!==void 0&&(n.sku=i);let a=ca(t.name);a!==void 0&&(n.name=a);let o=sa(t.quantity);o!==void 0&&(n.quantity=o);let s=sa(t.unitPrice);s!==void 0&&(n.unitPrice=s);let c=sa(t.totalPrice);return c!==void 0&&(n.totalPrice=c),Object.keys(n).length>0?n:void 0}function ua(e){let t=oa(e);if(!t)return;let n=[];for(let e of t){let t=la(e);t&&n.push(t)}return n.length>0?n:void 0}function da(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.title==`string`?t.title.trim():``;if(n===``)return null;let r={title:n,...la(e)};return typeof t.imageUrl==`string`&&aa(t.imageUrl)&&(r.imageUrl=t.imageUrl),typeof t.link==`string`&&aa(t.link)&&(r.link=t.link),typeof t.utmContent==`string`&&t.utmContent!==``&&(r.utmContent=t.utmContent),r}function fa(e){let t=oa(e);if(!t)return;let n=[];for(let e of t){let t=da(e);t&&n.push(t)}return n.length>0?n:void 0}function pa(e){if(!e)return;let t;try{t=ia(e)}catch{return}if(t!==null)return fa(t)}async function ma({config:e}){let t=ha(e),n=await Li({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=await Xi({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function ha(e){let t=ci(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}function ga({perCall:e,defaults:t,productUtmContent:n}){if(e===null)return;let r=e!==void 0,i=t!==void 0&&Object.keys(t).length>0;if(!r&&!i&&(n===void 0||n===``))return;let a={...t,...e??{}},o=n??e?.utmContent;return o!==void 0&&o!==``?a.utmContent=o:delete a.utmContent,a}var _a=t({DEEP_LINK_SCHEME:()=>xi,FrakContextManager:()=>oi,areAddressesEqual:()=>zr,base64urlDecode:()=>Tr,base64urlEncode:()=>wr,baseIframeProps:()=>Ii,buildListenerUrl:()=>Ri,clearAllCache:()=>Fn,coerceProductCandidates:()=>oa,compressJsonToB64:()=>Er,createIFrameFrakClient:()=>Xi,decodeProductsParam:()=>pa,decompressJsonFromB64:()=>ia,deleteQueryParamCaseInsensitive:()=>$,detectPageLanguage:()=>Ci,findIframeInOpener:()=>Bi,formatAmount:()=>ui,formatAmountParts:()=>fi,generateSsoUrl:()=>Dr,getBackendUrl:()=>G,getClientId:()=>Cr,getClientIdAsync:()=>Q,getCurrencyAmountKey:()=>mi,getEnvironment:()=>jn,getQueryParamCaseInsensitive:()=>Ir,getSupportedCurrency:()=>ci,isIOS:()=>ji,isInAppBrowser:()=>Pi,isMobile:()=>Mi,mergeAttribution:()=>ga,normalizeProductDetails:()=>la,normalizeSharingProduct:()=>da,redirectToExternalBrowser:()=>Fi,sanitizeProductDetailsList:()=>ua,sanitizeSharingProducts:()=>fa,sdkConfigStore:()=>X,setEnvironment:()=>An,setupClient:()=>ma,ssoPopupFeatures:()=>jr,ssoPopupName:()=>Mr,trackEvent:()=>Fr,triggerDeepLinkWithFallback:()=>Oi,withCache:()=>q});async function va(e,{steps:t,metadata:n},r){return await e.request({method:`frak_displayModal`,params:r?[t,n,e.config.metadata,r]:[t,n,e.config.metadata]})}async function ya(e,t,n){return await e.request({method:`frak_displaySharingPage`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function ba(e){if(typeof window>`u`)return;let t=await Q().catch(()=>void 0);if(!t)return;let n=await X.resolveMerchantId();if(!n)return;let r=`frak-identity-ensured-${n}-${t}`;if(!window.sessionStorage.getItem(r))try{let i=G(),a=await Z({op:`frak-ensure-v1`,merchantId:n,anonymousId:t});(await fetch(`${i}/user/identity/ensure`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"x-wallet-sdk-auth":e,"x-frak-client-id":t,...hr()},body:JSON.stringify({merchantId:n,...a&&{proof:a}})})).ok&&window.sessionStorage.setItem(r,`1`)}catch{}}async function xa(e,t){return q(()=>e.request({method:`frak_getMerchantInformation`}),{cacheKey:`frak_getMerchantInformation`,cacheTime:t?.cacheTime})}async function Sa(e,t){return q(async()=>{let t=await Q().catch(()=>void 0),n=await X.resolveMerchantId(),r=t&&n?await Z({op:`frak-merge-v1`,merchantId:n,anonymousId:t}):null;return e.request({method:`frak_getMergeToken`,params:r?[r]:void 0})},{cacheKey:`frak_getMergeToken`,cacheTime:t?.cacheTime})}async function Ca(e,t){return q(()=>e.request({method:`frak_getUserReferralStatus`}),{cacheKey:`frak_getUserReferralStatus`,cacheTime:t?.cacheTime})}async function wa(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function Ta(e,t){try{let n=await Q().catch(()=>void 0);await e.request({method:`frak_sendInteraction`,params:[t,{clientId:n}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}function Ea(e,t,n){return Wr(t)?(Fr(e,`user_referred_started`,{referrer_client_id:t.c,referrer_wallet:t.w,wallet_status:n?.key}),Ta(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referrerWallet:t.w,referralTimestamp:t.t}),!0):Ur(t)?(Fr(e,`user_referred_started`,{referrer:t.r,wallet_status:n?.key}),Ta(e,{type:`arrival`,referrerWallet:t.r}),!0):!1}function Da(e,t,n){return!t&&!n?null:{v:2,m:e,t:Math.floor(Date.now()/1e3),...t?{c:t}:{},...n?{w:n}:{}}}function Oa(e,t,n){return Wr(e)?e.w&&n?.wallet?zr(e.w,n.wallet):e.c?t===e.c:!1:Ur(e)&&n?.wallet?zr(e.r,n.wallet):!1}async function ka(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;let i=await Q().catch(()=>void 0);if(Oa(n,i,t))return`self-referral`;if(!Ea(e,n,t))return`no-referrer`;let a=Wr(n)?n.m:r?.merchantId,o=r?.alwaysAppendUrl&&a?Da(a,i,t?.wallet):null;return oi.replaceUrl({url:window.location?.href,context:o}),Fr(e,`user_referred_completed`,{status:`success`}),`success`}async function Aa(e,{options:t}={}){let n=oi.parse({url:window.location.href}),r=await Pa(e);try{return await ka(e,{walletStatus:r,frakContext:n,options:t})}catch(e){console.warn(`Error processing referral`,{error:e})}}const ja=`frak:referral-success`;async function Ma(e){try{await Aa(e)===`success`&&window.dispatchEvent(new Event(ja))}catch(e){console.warn(`[Frak] Referral setup failed`,e)}}async function Na(e){if(typeof window>`u`){console.warn(`[Frak] No window found, can't track purchase`);return}let t=window.sessionStorage.getItem(`frak-wallet-interaction-token`),n=await Q().catch(()=>void 0);if(!t&&!n){console.warn(`[Frak] No identity found, skipping purchase check`);return}let r=e.merchantId??await X.resolveMerchantId();if(!r){console.warn(`[Frak] No merchant id found, skipping purchase check`);return}let i={Accept:`application/json`,"Content-Type":`application/json`};t&&(i[`x-wallet-sdk-auth`]=t),n&&(i[`x-frak-client-id`]=n);let a=G();await fetch(`${a}/user/track/purchase`,{method:`POST`,headers:i,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:r})})}function Pa(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(Fa(e,t),t));let n=new bn,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{Fa(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function Fa(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),ba(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function Ia(e,{metadata:t,login:n}){return La(e,{steps:{login:n??{}},metadata:t})}function La(e,t){function n(n){return La(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return La(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}async function i(n,r){return n&&(t.metadata=n(t.metadata??{})),await va(e,t,r)}return{params:t,sendTx:n,reward:r,display:i}}async function Ra(e,{tx:t,metadata:n}){return(await va(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function za(e=96){let t=Math.ceil(e/2),n=``;if(typeof crypto<`u`&&crypto.getRandomValues){let e=new Uint8Array(t);crypto.getRandomValues(e);for(let t=0;t<e.length;t++)n+=e[t].toString(16).padStart(2,`0`)}else for(let e=0;e<t;e++)n+=(Math.random()*256|0).toString(16).padStart(2,`0`);return n.substring(0,e)}async function Ba(e,{siwe:t,metadata:n}){let r=e.config?.domain??window.location.host,i=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await va(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??za(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var Va=t({REFERRAL_SUCCESS_EVENT:()=>ja,displayModal:()=>va,displaySharingPage:()=>ya,ensureIdentity:()=>ba,getMerchantInformation:()=>xa,getMergeToken:()=>Sa,getUserReferralStatus:()=>Ca,modalBuilder:()=>Ia,openSso:()=>Nr,prepareSso:()=>wa,prepareSsoUrl:()=>Ar,processReferral:()=>ka,referralInteraction:()=>Aa,sendInteraction:()=>Ta,sendTransaction:()=>Ra,setupReferral:()=>Ma,siweAuthenticate:()=>Ba,trackPurchaseStatus:()=>Na,watchWalletStatus:()=>Pa});async function Ha(e,t,n){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}await ya(window.FrakSetup.client,{...n?.link&&{link:n.link},...n?.products?.length&&{products:n.products},...n?.checkoutToken&&{checkoutToken:n.checkoutToken},...e&&{metadata:{targetInteraction:e}}},t)}const Ua=[`frak-button-share`,`frak-button-wallet`,`frak-open-in-app`,`frak-post-purchase`,`frak-banner`].join(`,`);function Wa(){return typeof document>`u`||document.querySelector(Ua)===null?[]:[`sharing`]}const Ga=`frak:client`;function Ka(){let e=new CustomEvent(Ga);window.dispatchEvent(e)}function qa(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(Ga,t,!1)}function Ja(){return window.FrakSetup.core={..._a,...Va},window.FrakSetup?.client?Promise.resolve():q(()=>Ya(),{cacheKey:`frak-sdk-init`,cacheTime:1/0}).catch(e=>{Fr(window.FrakSetup?.client,`sdk_init_failed`,{reason:e instanceof Error?e.message:typeof e==`string`?e:`unknown`,config_missing:!window.FrakSetup?.config})})}async function Ya(){if(!window.FrakSetup?.config)throw Error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`);console.log(`[Frak SDK] Starting initialization`);let e=await ma({config:Xa(window.FrakSetup.config)});if(!e)throw Error(`[Frak SDK] Failed to create client`);window.FrakSetup.client=e,console.log(`[Frak SDK] Client initialized successfully`),Ka(),Ma(e),Za()}function Xa(e){return e.preload===void 0?{...e,preload:Wa()}:e}function Za(){let e=new URL(window.location.href);if(Ir(e.searchParams,`frakAction`)?.toLowerCase()!==`share`)return;console.log(`[Frak SDK] Auto open share via query param`);let t=Ir(e.searchParams,`link`)??void 0,n=Ir(e.searchParams,`placement`)??void 0,r=pa(Ir(e.searchParams,`products`));$(e.searchParams,`frakAction`),$(e.searchParams,`link`),$(e.searchParams,`placement`),$(e.searchParams,`products`),window.history.replaceState({},``,e.toString()),Ha(void 0,n,{link:t,products:r})}o.injectBase(`shared`,n),o.injectBase(`fouce`,`frak-button-share:not(:defined), frak-button-wallet:not(:defined), frak-open-in-app:not(:defined), frak-post-purchase:not(:defined), frak-banner:not(:defined) { display: none !important; }`),s(Ja);const Qa={"button-share":()=>import(`./ButtonShare.CiEtGubR.js`),"button-wallet":()=>import(`./ButtonWallet.B-80TBVO.js`),"open-in-app":()=>import(`./OpenInAppButton.DYfr8q7L.js`),"post-purchase":()=>import(`./PostPurchase.CxEoeBs_.js`),banner:()=>import(`./Banner.Dh-KYDLv.js`)},$a=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&eo(e)});async function eo(e){let t=e instanceof Element?e.tagName.toLowerCase():``,n=t?.startsWith(`frak-`),r=Array.from(e.querySelectorAll(`:not(:defined)`)).map(e=>e.tagName.toLowerCase()).filter(e=>e.startsWith(`frak-`));n&&!customElements.get(t)&&r.push(t);let i=[...new Set(r)];await Promise.allSettled(i.map(e=>to(e)))}async function to(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,``);if(!(t in Qa))throw Error(`Component ${e} is not supported.`);await Qa[t]()}catch(e){console.error(e)}}eo(document.body),$a.observe(document.documentElement,{subtree:!0,childList:!0});export{X as C,o as D,s as E,n as O,Fr as S,yn as T,fi as _,ja as a,mi as b,xa as c,Ci as d,Pi as f,xi as g,Mi as h,Na as i,fa as l,Fi as m,qa as n,Ca as o,ua as p,Ha as r,Sa as s,Ja as t,Oi as u,pi as v,vn as w,ci as x,ui as y};
@@ -1 +1 @@
1
- import{S as e,b as t,v as n,x as r,y as i}from"./loader.js";function a(e){return Array.isArray(e)?e:e.conditions}function o(e){if(typeof e==`number`)return e;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:void 0}}function s(e,t,n){let r=[];for(let i of a(e)){if(`logic`in i){r.push(...s(i,t,n));continue}if(i.field===t&&n.has(i.operator)){let e=o(i.value);e!=null&&r.push(e)}}return r}const c=new Set([`gt`,`gte`,`between`]),l=new Set([`gt`,`gte`]);function u(e){let t=s(e,`purchase.amount`,c);return t.length>0?Math.min(...t):void 0}function d(e){let t=s(e,`time.timestamp`,l);if(t.length!==0)return new Date(Math.min(...t)*1e3)}function f(e,t){switch(e.payoutType){case`fixed`:return e.amount[t];case`percentage`:return e.maxAmount?.[t]??0;case`tiered`:return e.tiers.reduce((e,n)=>`amount`in n?Math.max(e,n.amount[t]):e,0)}}function p(e){return e.payoutType===`percentage`?e.percent:e.payoutType===`tiered`?e.tiers.reduce((e,t)=>`percent`in t?Math.max(e,t.percent):e,0):0}function m(e,t){let n=f(e,t);return n>0?n:p(e)*1e-6}function h(n,i){let a=e(i),o=r(a);switch(n.payoutType){case`fixed`:return t(Math.round(n.amount[o]),a);case`percentage`:return`${n.percent} %`;case`tiered`:{let e=f(n,o);if(e>0)return t(Math.round(e),a);let r=p(n);return r>0?`${r} %`:t(0,a)}}}function g(t,a){let o=e(a),s=r(o);switch(t.payoutType){case`fixed`:return n(Math.round(t.amount[s]),o);case`percentage`:return i(t.percent);case`tiered`:{let e=f(t,s);if(e>0)return n(Math.round(e),o);let r=p(t);return r>0?i(r):n(0,o)}}}function _(t,n){if(!(!t||m(t,r(e(n)))<=0))return h(t,n)}function v(e,t){return t?e.replaceAll(`{REWARD}`,t):e.replaceAll(`{REWARD}`,``)}const y=new Set([`eq`,`neq`,`gt`,`gte`,`lt`,`lte`,`between`]),b=new Set([`contains`,`starts_with`,`ends_with`]);function x(e){return`logic`in e&&`conditions`in e}function S(e,t){return e[t]}function C(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:void 0}}function w(e,t){let n=C(e),r=C(t);return n!==void 0&&r!==void 0?n-r:String(e).localeCompare(String(t))}function T(e,t,n){if(!Array.isArray(n))return e===`not_in`;if(t===void 0)return;let r=n.includes(t);return e===`in`?r:!r}function E(e,t,n,r){switch(e){case`eq`:return t===n;case`neq`:return t!==n;case`gt`:return w(t,n)>0;case`gte`:return w(t,n)>=0;case`lt`:return w(t,n)<0;case`lte`:return w(t,n)<=0;case`between`:return r==null||Array.isArray(r)?void 0:w(t,n)>=0&&w(t,r)<=0}}function D(e,t,n){if(typeof t==`string`&&typeof n==`string`)return e===`contains`?t.includes(n):e===`starts_with`?t.startsWith(n):t.endsWith(n)}function O(e,t){let n=S(t,e.field),{operator:r,value:i,valueTo:a}=e;if(r===`exists`)return n!==void 0;if(r===`not_exists`)return n===void 0;if(r===`in`||r===`not_in`)return T(r,n,i);if(!(Array.isArray(i)||n===void 0||i===null)){if(y.has(r))return E(r,n,i,a);if(b.has(r))return D(r,n,i)}}function k(e,t){if(x(e)){let n=e.conditions.map(e=>k(e,t));return e.logic===`all`?n.every(Boolean):e.logic===`any`?n.some(Boolean):e.logic!==`none`||!n.some(Boolean)}return O(e,t)??!0}function A(e,t){return e?Array.isArray(e)?e.every(e=>k(e,t)):k(e,t):!0}function j(e,t){return e.expiresAt!=null&&new Date(e.expiresAt).getTime()<=t}function M(e,t){let n=d(e.conditions);return n==null||n.getTime()<=t}function N(e,t){return t===`referee`?e.referee:e.referrer}function P(e,t,n){let r=N(e,n);return r?m(r,t):0}function F(e,t){if(!t||t.length===0||!e.productScope)return;let n=t.filter(t=>A(e.productScope,t));return n.length>0?n:void 0}function I(e,t){return!t||t.length===0||!e.productScope||t.some(t=>A(e.productScope,t))}function L(t,n={}){let i=(n.now??new Date).getTime(),a=n.audience??`referrer`,o=r(e(n.currency)),s=(n.targetInteraction?t.filter(e=>e.interactionTypeKey===n.targetInteraction):t).filter(e=>!j(e,i)),c=s.filter(e=>M(e,i));if(c.length>0){let e=c.reduce((e,t)=>{let r=I(e,n.products),i=I(t,n.products);return r===i?P(t,o,a)>P(e,o,a)?t:e:i?t:e});return{campaign:e,status:`live`,matchedProducts:F(e,n.products)}}let l=s.map(e=>({campaign:e,startsAt:d(e.conditions)})).filter(e=>e.startsAt!=null);if(l.length===0)return;let u=l.reduce((e,t)=>{let r=I(e.campaign,n.products),i=I(t.campaign,n.products);return r===i?t.startsAt.getTime()<e.startsAt.getTime()?t:e:i?t:e});return{campaign:u.campaign,status:`upcoming`,startsAt:u.startsAt,matchedProducts:F(u.campaign,n.products)}}function R(e,n={}){let r=L(e,n);if(!r)return;let i=N(r.campaign,n.audience??`referrer`);if(!i)return;let a=_(i,n.currency);if(!a)return;let o=u(r.campaign.conditions),s=o==null?void 0:t(o,n.currency),c=r.campaign.defaultLockupSeconds,l=c&&c>0?Math.round(c/86400):void 0;return{formatted:a,parts:g(i,n.currency),payoutType:i.payoutType,minPurchaseAmount:s,lockupDurationDays:l,referrerReward:r.campaign.referrer,refereeReward:r.campaign.referee,minPurchaseValue:o??void 0,isProductScoped:r.campaign.productScope!=null,matchedProducts:r.matchedProducts}}export{v as i,L as n,R as r,_ as t};
1
+ import{_ as e,b as t,v as n,x as r,y as i}from"./loader.js";function a(e){return Array.isArray(e)?e:e.conditions}function o(e){if(typeof e==`number`)return e;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:void 0}}function s(e,t,n){let r=[];for(let i of a(e)){if(`logic`in i){r.push(...s(i,t,n));continue}if(i.field===t&&n.has(i.operator)){let e=o(i.value);e!=null&&r.push(e)}}return r}const c=new Set([`gt`,`gte`,`between`]),l=new Set([`gt`,`gte`]);function u(e){let t=s(e,`purchase.amount`,c);return t.length>0?Math.min(...t):void 0}function d(e){let t=s(e,`time.timestamp`,l);if(t.length!==0)return new Date(Math.min(...t)*1e3)}function f(e,t){switch(e.payoutType){case`fixed`:return e.amount[t];case`percentage`:return e.maxAmount?.[t]??0;case`tiered`:return e.tiers.reduce((e,n)=>`amount`in n?Math.max(e,n.amount[t]):e,0)}}function p(e){return e.payoutType===`percentage`?e.percent:e.payoutType===`tiered`?e.tiers.reduce((e,t)=>`percent`in t?Math.max(e,t.percent):e,0):0}function m(e,t){let n=f(e,t);return n>0?n:p(e)*1e-6}function h(e,n){let a=r(n),o=t(a);switch(e.payoutType){case`fixed`:return i(Math.round(e.amount[o]),a);case`percentage`:return`${e.percent} %`;case`tiered`:{let t=f(e,o);if(t>0)return i(Math.round(t),a);let n=p(e);return n>0?`${n} %`:i(0,a)}}}function g(i,a){let o=r(a),s=t(o);switch(i.payoutType){case`fixed`:return e(Math.round(i.amount[s]),o);case`percentage`:return n(i.percent);case`tiered`:{let t=f(i,s);if(t>0)return e(Math.round(t),o);let r=p(i);return r>0?n(r):e(0,o)}}}function _(e,n){if(!(!e||m(e,t(r(n)))<=0))return h(e,n)}function v(e,t){return t?e.replaceAll(`{REWARD}`,t):e.replaceAll(`{REWARD}`,``)}const y=new Set([`eq`,`neq`,`gt`,`gte`,`lt`,`lte`,`between`]),b=new Set([`contains`,`starts_with`,`ends_with`]);function x(e){return`logic`in e&&`conditions`in e}function S(e,t){return e[t]}function C(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:void 0}}function w(e,t){let n=C(e),r=C(t);return n!==void 0&&r!==void 0?n-r:String(e).localeCompare(String(t))}function T(e,t,n){if(!Array.isArray(n))return e===`not_in`;if(t===void 0)return;let r=n.includes(t);return e===`in`?r:!r}function E(e,t,n,r){switch(e){case`eq`:return t===n;case`neq`:return t!==n;case`gt`:return w(t,n)>0;case`gte`:return w(t,n)>=0;case`lt`:return w(t,n)<0;case`lte`:return w(t,n)<=0;case`between`:return r==null||Array.isArray(r)?void 0:w(t,n)>=0&&w(t,r)<=0}}function D(e,t,n){if(typeof t==`string`&&typeof n==`string`)return e===`contains`?t.includes(n):e===`starts_with`?t.startsWith(n):t.endsWith(n)}function O(e,t){let n=S(t,e.field),{operator:r,value:i,valueTo:a}=e;if(r===`exists`)return n!==void 0;if(r===`not_exists`)return n===void 0;if(r===`in`||r===`not_in`)return T(r,n,i);if(!(Array.isArray(i)||n===void 0||i===null)){if(y.has(r))return E(r,n,i,a);if(b.has(r))return D(r,n,i)}}function k(e,t){if(x(e)){let n=e.conditions.map(e=>k(e,t));return e.logic===`all`?n.every(Boolean):e.logic===`any`?n.some(Boolean):e.logic!==`none`||!n.some(Boolean)}return O(e,t)??!0}function A(e,t){return e?Array.isArray(e)?e.every(e=>k(e,t)):k(e,t):!0}function j(e,t){return e.expiresAt!=null&&new Date(e.expiresAt).getTime()<=t}function M(e,t){let n=d(e.conditions);return n==null||n.getTime()<=t}function N(e,t){return t===`referee`?e.referee:e.referrer}function P(e,t,n){let r=N(e,n);return r?m(r,t):0}function F(e,t){if(!t||t.length===0||!e.productScope)return;let n=t.filter(t=>A(e.productScope,t));return n.length>0?n:void 0}function I(e,t){return!t||t.length===0||!e.productScope||t.some(t=>A(e.productScope,t))}function L(e,n={}){let i=(n.now??new Date).getTime(),a=n.audience??`referrer`,o=t(r(n.currency)),s=(n.targetInteraction?e.filter(e=>e.interactionTypeKey===n.targetInteraction):e).filter(e=>!j(e,i)),c=s.filter(e=>M(e,i));if(c.length>0){let e=c.reduce((e,t)=>{let r=I(e,n.products),i=I(t,n.products);return r===i?P(t,o,a)>P(e,o,a)?t:e:i?t:e});return{campaign:e,status:`live`,matchedProducts:F(e,n.products)}}let l=s.map(e=>({campaign:e,startsAt:d(e.conditions)})).filter(e=>e.startsAt!=null);if(l.length===0)return;let u=l.reduce((e,t)=>{let r=I(e.campaign,n.products),i=I(t.campaign,n.products);return r===i?t.startsAt.getTime()<e.startsAt.getTime()?t:e:i?t:e});return{campaign:u.campaign,status:`upcoming`,startsAt:u.startsAt,matchedProducts:F(u.campaign,n.products)}}function R(e,t={}){let n=L(e,t);if(!n)return;let r=N(n.campaign,t.audience??`referrer`);if(!r)return;let a=_(r,t.currency);if(!a)return;let o=u(n.campaign.conditions),s=o==null?void 0:i(o,t.currency),c=n.campaign.defaultLockupSeconds,l=c&&c>0?Math.round(c/86400):void 0;return{formatted:a,parts:g(r,t.currency),payoutType:r.payoutType,minPurchaseAmount:s,lockupDurationDays:l,referrerReward:n.campaign.referrer,refereeReward:n.campaign.referee,minPurchaseValue:o??void 0,isProductScoped:n.campaign.productScope!=null,matchedProducts:n.matchedProducts}}export{v as i,L as n,R as r,_ as t};
@@ -0,0 +1 @@
1
+ import{C as e}from"./loader.js";import{c as t,o as n}from"./defaults.CmUvOlLQ.js";function r(){return t(n,()=>e.getConfig().components)}export{r as t};
@@ -0,0 +1 @@
1
+ import{D as e}from"./loader.js";import{f as t,i as n}from"./defaults.CmUvOlLQ.js";function r(r,i,a,o,s){t(()=>{s&&e.injectBase(`shared`,s),e.injectBase(r,o??n)},[r]),t(()=>{!i||!a||e.injectPlacement(r,i,a)},[r,i,a])}export{r as t};
@@ -1 +1 @@
1
- import{c as e}from"./loader.js";import{d as t,f as n}from"./defaults.CT8FNvot.js";import{r}from"./rewards.D3nh4aTd.js";function i(i,a,o,s){let[c,l]=t(void 0);return n(()=>{if(!i)return;let t=window.FrakSetup?.client;t&&e(t).then(e=>{let n=r(e.rewards,{currency:t.config.metadata?.currency,targetInteraction:a,audience:o,products:s});n&&n.payoutType!==`percentage`&&l(n.formatted)}).catch(()=>{})},[i,a,o,s]),{reward:c}}export{i as t};
1
+ import{c as e}from"./loader.js";import{d as t,f as n}from"./defaults.CmUvOlLQ.js";import{r}from"./rewards.DjfrchZd.js";function i(i,a,o,s){let[c,l]=t(void 0);return n(()=>{if(!i)return;let t=window.FrakSetup?.client;t&&e(t).then(e=>{let n=r(e.rewards,{currency:t.config.metadata?.currency,targetInteraction:a,audience:o,products:s});n&&n.payoutType!==`percentage`&&l(n.formatted)}).catch(()=>{})},[i,a,o,s]),{reward:c}}export{i as t};
@@ -43,15 +43,17 @@ type ButtonShareProps = {
43
43
  */
44
44
  products?: SharingPageProduct[] | string;
45
45
  /**
46
- * Which UI to open on click.
46
+ * Reported on the `share_button_clicked` event.
47
47
  *
48
- * Legacy values (e.g. `"share-modal"`) are accepted at runtime and
49
- * gracefully route to the full-page sharing UI — the modal-flow
50
- * share path was retired in favour of `displaySharingPage`.
48
+ * It no longer selects anything: every click opens the full-page sharing
49
+ * UI. Retired values (`"share-modal"`, `"embedded-wallet"`) stay accepted
50
+ * because merchant configs and saved plugin markup still carry them, and
51
+ * the resolved value is reported as-is so a legacy config stays visible in
52
+ * analytics.
51
53
  *
52
54
  * @defaultValue `"sharing-page"`
53
55
  */
54
- clickAction?: "embedded-wallet" | "sharing-page";
56
+ clickAction?: "sharing-page" | (string & {});
55
57
  /**
56
58
  * When set, renders the button in preview mode (e.g. Shopify/WP editor).
57
59
  * Skips the client-ready gating so the button is always enabled visually,
@@ -1,5 +1,4 @@
1
1
  import { c as openSharingPage, i as useLang, o as useClientReady, s as registerWebComponent, t as usePlacement } from "./usePlacement-DtwWaLHO.js";
2
- import { t as openEmbeddedWallet } from "./embeddedWallet-CxgyuwtP.js";
3
2
  import { t as useGlobalComponents } from "./useGlobalComponents-DFv33ujB.js";
4
3
  import { t as useLightDomStyles } from "./useLightDomStyles-B_IbOqJZ.js";
5
4
  import { i as w } from "./rewards-CZkWSndn.js";
@@ -94,10 +93,6 @@ function ButtonShare({ placement: placementId, text, classname = "", noRewardTex
94
93
  has_reward: Boolean(reward),
95
94
  click_action: resolvedClickAction
96
95
  });
97
- if (resolvedClickAction === "embedded-wallet") {
98
- openEmbeddedWallet(resolvedTargetInteraction, placementId);
99
- return;
100
- }
101
96
  openSharingPage(resolvedTargetInteraction, placementId, { products: parsedProducts });
102
97
  }, [
103
98
  isPreview,
@@ -23,7 +23,12 @@ type ButtonWalletProps = {
23
23
  //#endregion
24
24
  //#region src/components/ButtonWallet/ButtonWallet.d.ts
25
25
  /**
26
- * Button to open wallet modal
26
+ * Floating circular button that opens the Frak sharing page.
27
+ *
28
+ * Historically this opened the embedded wallet drawer; that surface was
29
+ * retired, so the button now routes to the full-page sharing UI like every
30
+ * other share CTA. The `frak-button-wallet` tag name is kept because it is
31
+ * public API (merchant markup, Magento template).
27
32
  *
28
33
  * @param args
29
34
  * @returns The wallet button with `<button>` tag
@@ -60,7 +65,7 @@ type ButtonWalletProps = {
60
65
  * <frak-button-wallet placement="hero-wallet"></frak-button-wallet>
61
66
  * ```
62
67
  *
63
- * @see {@link @frak-labs/core-sdk!actions.modalBuilder | `modalBuilder()`} for more info about the modal display
68
+ * @see {@link @frak-labs/core-sdk!actions.displaySharingPage | `displaySharingPage()`} for more info about the sharing page
64
69
  * @see {@link @frak-labs/core-sdk!actions.getMerchantInformation | `getMerchantInformation()`} for more info about the estimated reward fetching
65
70
  */
66
71
  declare function ButtonWallet({ placement: placementId, classname, useReward: rawUseReward, targetInteraction }: ButtonWalletProps): import("preact").JSX.Element | null;
@@ -1,8 +1,8 @@
1
- import { i as useLang, n as buildStyleContent, o as useClientReady, s as registerWebComponent, t as usePlacement } from "./usePlacement-DtwWaLHO.js";
2
- import { t as openEmbeddedWallet } from "./embeddedWallet-CxgyuwtP.js";
1
+ import { c as openSharingPage, i as useLang, n as buildStyleContent, o as useClientReady, s as registerWebComponent, t as usePlacement } from "./usePlacement-DtwWaLHO.js";
3
2
  import { t as useReward } from "./useReward-D5zzFR11.js";
4
3
  import { componentDefaults } from "./i18n/defaults.js";
5
- import { useEffect, useMemo, useState } from "preact/hooks";
4
+ import { trackEvent } from "@frak-labs/core-sdk";
5
+ import { useCallback, useEffect, useMemo, useState } from "preact/hooks";
6
6
  import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
7
7
  //#region src/components/ButtonWallet/assets/GiftIcon.tsx
8
8
  function GiftIcon(props) {
@@ -32,9 +32,17 @@ function safeVibrate() {
32
32
  }
33
33
  //#endregion
34
34
  //#region src/components/ButtonWallet/utils.ts
35
+ /**
36
+ * Open the sharing surface behind `<frak-button-wallet>`.
37
+ *
38
+ * The button used to open the embedded wallet drawer; that surface was
39
+ * retired in favour of the full-page sharing UI, so the tag now routes
40
+ * there like every other share CTA. The tag name is kept because it is
41
+ * public API (merchant markup, Magento template).
42
+ */
35
43
  function openWalletModal(targetInteraction, placement) {
36
44
  safeVibrate();
37
- openEmbeddedWallet(targetInteraction, placement);
45
+ openSharingPage(targetInteraction, placement);
38
46
  }
39
47
  //#endregion
40
48
  //#region src/components/ButtonWallet/ButtonWallet.tsx
@@ -79,7 +87,12 @@ const componentCss = `
79
87
  }
80
88
  `;
81
89
  /**
82
- * Button to open wallet modal
90
+ * Floating circular button that opens the Frak sharing page.
91
+ *
92
+ * Historically this opened the embedded wallet drawer; that surface was
93
+ * retired, so the button now routes to the full-page sharing UI like every
94
+ * other share CTA. The `frak-button-wallet` tag name is kept because it is
95
+ * public API (merchant markup, Magento template).
83
96
  *
84
97
  * @param args
85
98
  * @returns The wallet button with `<button>` tag
@@ -116,7 +129,7 @@ const componentCss = `
116
129
  * <frak-button-wallet placement="hero-wallet"></frak-button-wallet>
117
130
  * ```
118
131
  *
119
- * @see {@link @frak-labs/core-sdk!actions.modalBuilder | `modalBuilder()`} for more info about the modal display
132
+ * @see {@link @frak-labs/core-sdk!actions.displaySharingPage | `displaySharingPage()`} for more info about the sharing page
120
133
  * @see {@link @frak-labs/core-sdk!actions.getMerchantInformation | `getMerchantInformation()`} for more info about the estimated reward fetching
121
134
  */
122
135
  function ButtonWallet({ placement: placementId, classname = "", useReward: rawUseReward, targetInteraction }) {
@@ -127,6 +140,19 @@ function ButtonWallet({ placement: placementId, classname = "", useReward: rawUs
127
140
  const { shouldRender, isHidden, isClientReady } = useClientReady();
128
141
  const { reward } = useReward(shouldUseReward && isClientReady, resolvedTargetInteraction);
129
142
  const [position, setPosition] = useState("right");
143
+ const onClick = useCallback(() => {
144
+ trackEvent(window.FrakSetup.client, "share_button_clicked", {
145
+ placement: placementId,
146
+ target_interaction: resolvedTargetInteraction,
147
+ has_reward: Boolean(reward),
148
+ click_action: "sharing-page"
149
+ });
150
+ openWalletModal(resolvedTargetInteraction, placementId);
151
+ }, [
152
+ placementId,
153
+ resolvedTargetInteraction,
154
+ reward
155
+ ]);
130
156
  useEffect(() => {
131
157
  const placementPosition = placement?.components?.buttonWallet?.position;
132
158
  const configPosition = window.FrakSetup?.modalWalletConfig?.metadata?.position;
@@ -145,9 +171,7 @@ function ButtonWallet({ placement: placementId, classname = "", useReward: rawUs
145
171
  part: "button",
146
172
  disabled: !isClientReady,
147
173
  class: buttonClass,
148
- onClick: () => {
149
- openWalletModal(resolvedTargetInteraction, placementId);
150
- },
174
+ onClick,
151
175
  children: [/* @__PURE__ */ jsx(GiftIcon, {}), reward && /* @__PURE__ */ jsx("span", {
152
176
  class: "reward",
153
177
  children: reward
@@ -27,7 +27,7 @@ const componentDefaults = {
27
27
  text: "Open in App",
28
28
  ariaLabel: "Open in Frak Wallet app"
29
29
  },
30
- buttonWallet: { ariaLabel: "Open wallet" },
30
+ buttonWallet: { ariaLabel: "Share and earn rewards" },
31
31
  banner: {
32
32
  referralTitleReward: "Earn {REWARD} on purchases",
33
33
  referralTitle: "You've been referred!",
@@ -53,7 +53,7 @@ const componentDefaults = {
53
53
  text: "Ouvrir dans l'app",
54
54
  ariaLabel: "Ouvrir dans l'app Frak Wallet"
55
55
  },
56
- buttonWallet: { ariaLabel: "Ouvrir le porte-monnaie" },
56
+ buttonWallet: { ariaLabel: "Partagez et gagnez des récompenses" },
57
57
  banner: {
58
58
  referralTitleReward: "Gagnez {REWARD} sur vos achats",
59
59
  referralTitle: "Vous avez été parrainé !",
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "url": "https://twitter.com/QNivelais"
12
12
  }
13
13
  ],
14
- "version": "1.1.0-beta.85ee7f39",
14
+ "version": "1.1.0-beta.9c160982",
15
15
  "description": "Frak Wallet components, helping any person to interact with the Frak wallet.",
16
16
  "repository": {
17
17
  "url": "https://github.com/frak-id/wallet",
@@ -103,9 +103,9 @@
103
103
  "publish": "echo 'Publishing components...'"
104
104
  },
105
105
  "dependencies": {
106
- "@frak-labs/core-sdk": "1.3.0-beta.85ee7f39",
106
+ "@frak-labs/core-sdk": "1.3.0-beta.9c160982",
107
107
  "@frak-labs/design-system": "0.0.0",
108
- "@frak-labs/frame-connector": "1.3.0-beta.85ee7f39",
108
+ "@frak-labs/frame-connector": "1.3.0-beta.9c160982",
109
109
  "preact": "^10.29.7",
110
110
  "preact-custom-element": "^4.6.0"
111
111
  },
@@ -1 +0,0 @@
1
- import{C as e,r as t,u as n}from"./loader.js";import{a as r,h as i,m as a,n as o,p as s,s as c,t as l,u}from"./defaults.CT8FNvot.js";import{t as d}from"./useGlobalComponents.BT0loDl8.js";import{t as f}from"./useLightDomStyles.CZ1iTaa9.js";import{i as p}from"./rewards.D3nh4aTd.js";import{t as m}from"./useReward.DWHEt1Zs.js";import{t as h}from"./embeddedWallet.BjQSXLkP.js";function g({placement:i,text:g,classname:_=``,noRewardText:v,targetInteraction:y,products:b,clickAction:x,preview:S}){let C=!!S,w=r(),T=o(i),E=d(),D=T?.components?.buttonShare??E?.buttonShare;f(`frak-button-share`,i,D?.css);let O=u(()=>T?.targetInteraction===void 0?y:T.targetInteraction,[T?.targetInteraction,y]),k=D?.text??g??l[w].buttonShare.text,A=D?.noRewardText??v,j=u(()=>k.includes(`{REWARD}`),[k]),M=u(()=>D?.clickAction??x??`sharing-page`,[D?.clickAction,x]),{shouldRender:N,isHidden:P,isClientReady:F}=c(),I=u(()=>n(b),[b]),{reward:L}=m(j&&F,O,void 0,I),R=u(()=>j?L?p(k,L):A??p(k,void 0):k,[j,k,A,L]),z=s(()=>{if(!C){if(e(window.FrakSetup.client,`share_button_clicked`,{placement:i,target_interaction:O,has_reward:!!L,click_action:M}),M===`embedded-wallet`){h(O,i);return}t(O,i,{products:I})}},[C,M,O,i,L,I]);if(!C&&(!N||P))return null;let B=[`button`,`button__fadeIn`,_].filter(Boolean).join(` `);return a(`button`,{type:`button`,disabled:!C&&!F,class:B,onClick:z,children:R})}i(g,`frak-button-share`,[`text`,`placement`,`classname`,`clickAction`,`noRewardText`,`targetInteraction`,`products`,`preview`],{shadow:!1});export{g as ButtonShare};
@@ -1,40 +0,0 @@
1
- import{a as e,d as t,f as n,g as r,h as i,m as a,n as o,r as s,s as c,t as l,u}from"./defaults.CT8FNvot.js";import{t as d}from"./useReward.DWHEt1Zs.js";import{t as f}from"./embeddedWallet.BjQSXLkP.js";function p(e){return a(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[a(`title`,{children:`Gift icon`}),a(`path`,{d:`m23.14 14v11.43h-18.29v-11.43m9.14 11.43v-17.14m0 0h-5.14c-0.76 0-1.48-0.3-2.02-0.84s-0.84-1.26-0.84-2.020.3-1.480.84-2.02 1.26-0.84 2.02-0.84c4 0 5.14 5.71 5.14 5.71zm0 0h5.14c0.76 0 1.48-0.3 2.02-0.84s0.84-1.260.84-2.02-0.3-1.48-0.84-2.02-1.26-0.84-2.02-0.84c-4 0-5.14 5.71-5.14 5.71zm-11.43 0h22.86v5.71h-22.86z`,stroke:`#fff`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]})}function m(){`vibrate`in navigator?navigator.vibrate(10):console.log(`Vibration not supported`)}function h(e,t){m(),f(e,t)}function g({placement:i,classname:f=``,useReward:m,targetInteraction:g}){let _=e(),v=o(i),y=u(()=>v?.targetInteraction===void 0?g:v.targetInteraction,[v?.targetInteraction,g]),b=u(()=>m===!0,[m]),{shouldRender:x,isHidden:S,isClientReady:C}=c(),{reward:w}=d(b&&C,y),[T,E]=t(`right`);if(n(()=>{let e=v?.components?.buttonWallet?.position,t=window.FrakSetup?.modalWalletConfig?.metadata?.position;E(e??t??`right`)},[v?.components?.buttonWallet?.position]),!x||S)return null;let D=[`button`,`button__fadeIn`,T===`left`?`button__left`:`button__right`,f].filter(Boolean).join(` `);return a(r,{children:[a(`style`,{children:s(`
2
- .button {
3
- all: unset;
4
- position: fixed;
5
- bottom: 20px;
6
- z-index: 2000000;
7
- display: flex;
8
- justify-content: center;
9
- align-items: center;
10
- background-color: #3e557e;
11
- width: 45px;
12
- height: 45px;
13
- border-radius: 50%;
14
- cursor: pointer;
15
- text-align: center;
16
- font-size: 24px;
17
- }
18
-
19
- .button__left {
20
- left: 20px;
21
- }
22
-
23
- .button__right {
24
- right: 20px;
25
- }
26
-
27
- .reward {
28
- position: absolute;
29
- top: -4px;
30
- right: 27px;
31
- padding: 2px 3px;
32
- border-radius: 5px;
33
- background: #ff3f3f;
34
- font-size: 9px;
35
- color: #fff;
36
- font-weight: 600;
37
- white-space: nowrap;
38
- line-height: 9px;
39
- }
40
- `,v?.components?.buttonWallet?.css)}),a(`button`,{type:`button`,"aria-label":l[_].buttonWallet.ariaLabel,part:`button`,disabled:!C,class:D,onClick:()=>{h(y,i)},children:[a(p,{}),w&&a(`span`,{class:`reward`,children:w})]})]})}i(g,`frak-button-wallet`,[`placement`,`classname`,`useReward`,`targetInteraction`],{shadow:!0});export{g as ButtonWallet};
@@ -1,89 +0,0 @@
1
- import{C as e,E as t,T as n,a as r,c as i,k as a,l as o,r as s,u as ee}from"./loader.js";import{a as te,d as c,f as l,h as u,l as d,m as f,n as p,p as m,s as h,t as ne,u as g}from"./defaults.CT8FNvot.js";import{r as re,t as ie}from"./GiftIcon.DV54EwfG.js";import{t as ae}from"./useGlobalComponents.BT0loDl8.js";import{t as oe}from"./useLightDomStyles.CZ1iTaa9.js";import{i as _,n as v,t as se}from"./rewards.D3nh4aTd.js";var ce=`PostPurchase_card__5fv5lh0`,le=`PostPurchase_cardLayout__5fv5lh1`,ue=`PostPurchase_cardLeft__5fv5lh2`,de=`PostPurchase_cardRight__5fv5lh3`,fe=`PostPurchase_cta__5fv5lh6 sharedBaseCss_buttonReset__7cswil0`,y=`PostPurchase_customImage__5fv5lha`,b=`PostPurchase_frakLogo__5fv5lhb`,pe=`PostPurchase_giftIcon__5fv5lh8`,me=`PostPurchase_icon__5fv5lh7`,he=`PostPurchase_imageWrapper__5fv5lh9`,ge=`PostPurchase_message__5fv5lh5`;function _e(e,t,n,r){let i=e?.isReferred?`referee`:`referrer`,a=v(t.rewards,{targetInteraction:`purchase`,currency:n,audience:i,products:r});if(!a)return null;let{campaign:o}=a,s=e?.isReferred&&o.referee?`referee`:`referrer`;return{variant:s,reward:s===`referee`?o.referee:o.referrer,merchantDomain:t.onChainMetadata.domain}}function x({customerId:u,orderId:v,token:x,sharingUrl:ve,merchantId:S,placement:C,classname:w=``,variant:T,badgeText:E,referrerText:D,refereeText:O,ctaText:k,preview:A,previewVariant:j,products:M,imageUrl:N}){let P=!!A,{shouldRender:F,isHidden:I,isClientReady:L}=h(),R=p(C),z=te(),B=g(()=>ee(M),[M]);oe(`frak-post-purchase`,C,R?.components?.postPurchase?.css,`.PostPurchase_card__5fv5lh0 {
2
- padding: 16px;
3
- border-radius: 12px;
4
- background-color: var(--surface-background__pbq4akc);
5
- border: 1px solid var(--border-default__pbq4akv);
6
- }
7
- .PostPurchase_cardLayout__5fv5lh1 {
8
- display: flex;
9
- flex-direction: row;
10
- align-items: center;
11
- gap: 32px;
12
- }
13
- .PostPurchase_cardLeft__5fv5lh2 {
14
- flex-grow: 1;
15
- min-width: 0;
16
- display: flex;
17
- flex-direction: column;
18
- gap: 8px;
19
- }
20
- .PostPurchase_cardRight__5fv5lh3 {
21
- flex-shrink: 0;
22
- display: flex;
23
- flex-direction: column;
24
- align-items: flex-end;
25
- gap: 8px;
26
- text-align: right;
27
- }
28
- .PostPurchase_badge__5fv5lh4 {
29
- align-self: flex-start;
30
- background-color: #FFF534;
31
- border-radius: 4px;
32
- padding: 4px 8px;
33
- font-size: 12px;
34
- font-weight: 600;
35
- line-height: 12px;
36
- color: var(--text-primary__pbq4ak0);
37
- }
38
- .PostPurchase_message__5fv5lh5 {
39
- margin: 0;
40
- font-size: 16px;
41
- line-height: 22px;
42
- color: var(--text-primary__pbq4ak0);
43
- font-weight: 600;
44
- }
45
- .PostPurchase_cta__5fv5lh6 {
46
- display: inline-flex;
47
- align-items: center;
48
- justify-content: center;
49
- gap: 4px;
50
- padding: 12px 16px;
51
- border-radius: 9999px;
52
- background-color: var(--text-primary__pbq4ak0);
53
- color: var(--text-onAction__pbq4ak6);
54
- font-size: 12px;
55
- font-weight: bold;
56
- text-transform: uppercase;
57
- }
58
- .PostPurchase_cta__5fv5lh6:disabled {
59
- opacity: 0.7;
60
- cursor: default;
61
- }
62
- .PostPurchase_icon__5fv5lh7 {
63
- margin: -2px 0;
64
- }
65
- .PostPurchase_giftIcon__5fv5lh8 {
66
- display: block;
67
- flex-shrink: 0;
68
- }
69
- .PostPurchase_imageWrapper__5fv5lh9 {
70
- flex-shrink: 0;
71
- display: flex;
72
- align-items: center;
73
- justify-content: center;
74
- width: 80px;
75
- height: 80px;
76
- overflow: hidden;
77
- }
78
- .PostPurchase_customImage__5fv5lha {
79
- max-width: 100%;
80
- max-height: 100%;
81
- width: auto;
82
- height: auto;
83
- object-fit: contain;
84
- display: block;
85
- }
86
- .PostPurchase_frakLogo__5fv5lhb {
87
- display: block;
88
- margin-left: auto;
89
- }`,a);let[V,ye]=c(null),[H,U]=c(!1);l(()=>{P||!L||!u||!v||!x||r({customerId:u,orderId:v,token:x,merchantId:S}).catch(()=>{})},[P,L,u,v,x,S]),l(()=>{if(P||!L||H)return;let e=window.FrakSetup?.client;e&&Promise.all([o(e),i(e)]).then(([e,t])=>{U(!0),ye({referralStatus:e,merchantInfo:t})}).catch(e=>{if(e instanceof t&&e.code===n.configError){U(!0);return}console.warn(`[Frak] Post-purchase context error`,e)})},[P,L,H]);let W=g(()=>V?_e(V.referralStatus,V.merchantInfo,window.FrakSetup?.client?.config?.metadata?.currency,B):null,[V,B]),G=d(null),K=T??W?.variant??(P?j??`referrer`:void 0),q=ve??W?.merchantDomain,J=g(()=>{if(!W?.reward)return;let e=window.FrakSetup?.client?.config?.metadata?.currency;return se(W.reward,e)},[W?.reward]),Y=ae(),X=R?.components?.postPurchase??Y?.postPurchase,Z=E??X?.badgeText,Q=N??X?.imageUrl,$=g(()=>{let e=ne[z].postPurchase;return{message:K===`referee`?J?_(O??X?.refereeText??e.refereeText,J):O??X?.refereeNoRewardText??e.refereeNoRewardText:J?_(D??X?.referrerText??e.referrerText,J):D??X?.referrerNoRewardText??e.referrerNoRewardText,cta:J?_(k??X?.ctaText??e.ctaText,J):k??X?.ctaNoRewardText??e.ctaNoRewardText}},[z,K,J,X,D,O,k]);l(()=>{K&&G.current!==K&&L&&(!P&&(!F||I)||(e(window.FrakSetup?.client,`post_purchase_impression`,{placement:C,variant:K,has_reward:!!W?.reward}),G.current=K))},[K,F,I,L,P,C,W?.reward]);let be=m(()=>{K&&(e(window.FrakSetup?.client,`post_purchase_clicked`,{placement:C,variant:K}),s(void 0,C,{link:q,products:B,checkoutToken:x}))},[K,C,q,B,x]);if(!K||!P&&(!F||I||!W))return null;let xe=[ce,w].filter(Boolean).join(` `);return f(`div`,{className:xe,children:f(`div`,{class:le,children:[f(`div`,{class:ue,children:[Z&&f(`span`,{class:`PostPurchase_badge__5fv5lh4`,children:Z}),f(`p`,{class:ge,children:$.message}),f(`button`,{type:`button`,className:`${fe} button`,disabled:!P&&!L,onClick:P?void 0:be,children:[$.cta,f(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`${me} button`,children:f(`path`,{d:`M13.9 11.14C13.99 11.05 14.15 11.11 14.15 11.24V11.64C14.15 13.05 12.63 14.19 10.75 14.19C8.87 14.19 7.34 13.05 7.34 11.64V11.24C7.34 11.11 7.51 11.05 7.59 11.14C8.35 11.93 9.48 12.43 10.75 12.43C12.01 12.43 13.15 11.93 13.9 11.14ZM1.85 9.65C1.85 9.51 2.01 9.44 2.1 9.54C2.85 10.32 3.99 10.82 5.25 10.82C5.52 10.82 5.79 10.8 6.04 10.76C6.26 10.72 6.47 10.88 6.47 11.1V12.17C6.47 12.32 6.37 12.45 6.22 12.48C5.92 12.55 5.59 12.59 5.25 12.59C3.37 12.59 1.85 11.45 1.85 10.04V9.65ZM10.75 6.21C12.63 6.21 14.15 7.35 14.15 8.75C14.15 10.16 12.63 11.3 10.75 11.3C8.87 11.3 7.34 10.16 7.34 8.75C7.34 7.35 8.87 6.21 10.75 6.21ZM1.85 6.85C1.85 6.71 2.01 6.65 2.1 6.74C2.85 7.53 3.99 8.03 5.25 8.03C5.52 8.03 5.79 8 6.04 7.96C6.26 7.92 6.47 8.09 6.47 8.3V9.37C6.47 9.52 6.37 9.65 6.22 9.69C5.92 9.75 5.59 9.79 5.25 9.79C3.37 9.79 1.85 8.65 1.85 7.24V6.85ZM5.25 1.81C7.13 1.81 8.66 2.95 8.66 4.36C8.66 5.76 7.13 6.9 5.25 6.9C3.37 6.9 1.85 5.76 1.85 4.36C1.85 2.95 3.37 1.81 5.25 1.81Z`,fill:`currentColor`})})]})]}),f(`div`,{class:de,children:[Q?f(`span`,{class:he,children:f(`img`,{src:Q,alt:``,class:y})}):f(ie,{className:pe,width:80,height:80}),f(re,{className:b,width:42,height:24})]})]})})}u(x,`frak-post-purchase`,[`customerId`,`orderId`,`token`,`sharingUrl`,`merchantId`,`placement`,`classname`,`variant`,`badgeText`,`referrerText`,`refereeText`,`ctaText`,`products`,`preview`,`previewVariant`,`imageUrl`],{shadow:!1});export{x as PostPurchase};
@@ -1,58 +0,0 @@
1
- import{D as e,f as t,n,t as r,w as i}from"./loader.js";var a,o,s,c,l,u,d,f,p,m,h,g,_,v,y={},b=[],x=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,S=Array.isArray;function C(e,t){for(var n in t)e[n]=t[n];return e}function w(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function T(e,t,n){var r,i,o,s={};for(o in t)o==`key`?r=t[o]:o==`ref`?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return E(e,s,r,i,null)}function E(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++s,__i:-1,__u:0};return i==null&&o.vnode!=null&&o.vnode(a),a}function D(e){return e.children}function O(e,t){this.props=e,this.context=t}function k(e,t){if(t==null)return e.__?k(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?k(e):null}function A(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=C({},t);a.__v=t.__v+1,o.vnode&&o.vnode(a),L(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??k(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,oe(r,a,i),t.__e=t.__=null,a.__e!=n&&j(a)}}function j(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),j(e)}function M(e){(!e.__d&&(e.__d=!0)&&c.push(e)&&!N.__r++||l!=o.debounceRendering)&&((l=o.debounceRendering)||u)(N)}function N(){try{for(var e,t=1;c.length;)c.length>t&&c.sort(d),e=c.shift(),t=c.length,A(e)}finally{c.length=N.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r&&r.__k||b,v=t.length;for(c=P(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&_[p.__i]||y,p.__i=d,g=L(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&R(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),4&p.__u?(c=te(p,c,e),f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function P(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=E(null,o,null,null,null):S(o)?o=e.__k[a]=E(D,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=E(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=ne(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=k(s)),le(s,s));return r}function te(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=te(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=k(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function F(e,t){return t||=[],e==null||typeof e==`boolean`||(S(e)?e.some(function(e){F(e,t)}):t.push(e)),t}function ne(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function re(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||x.test(t)?n:n+`px`}function I(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||re(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||re(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(h,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[m]=r[m]:(n[m]=g,e.addEventListener(t,a?v:_,a)):e.removeEventListener(t,a?v:_,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ie(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[p]==null)t[p]=g++;else if(t[p]<n[m])return;return n(o.event?o.event(t):t)}}}function L(e,t,n,r,i,a,s,c,l,u){var d,f,p,m,h,g,_,v,y,x,T,E,A,j,M,N,P=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),a=[c=t.__e=n.__e]),(d=o.__b)&&d(t);n:if(typeof P==`function`){f=s.length;try{if(y=t.props,x=P.prototype&&P.prototype.render,T=(d=P.contextType)&&r[d.__c],E=d?T?T.props.value:d.__:r,n.__c?v=(p=t.__c=n.__c).__=p.__E:(x?t.__c=p=new P(y,E):(t.__c=p=new O(y,E),p.constructor=P,p.render=ue),T&&T.sub(p),p.state||(p.state={}),p.__n=r,m=p.__d=!0,p.__h=[],p._sb=[]),x&&p.__s==null&&(p.__s=p.state),x&&P.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=C({},p.__s)),C(p.__s,P.getDerivedStateFromProps(y,p.__s))),h=p.props,g=p.state,p.__v=t,m)x&&P.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),x&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(x&&P.getDerivedStateFromProps==null&&y!==h&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(y,E),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&!1===p.shouldComponentUpdate(y,p.__s,E)){t.__v!=n.__v&&(p.props=y,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),b.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),c=k(n);break n}p.componentWillUpdate!=null&&p.componentWillUpdate(y,p.__s,E),x&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(h,g,_)})}if(p.context=E,p.props=y,p.__P=e,p.__e=!1,A=o.__r,j=0,x)p.state=p.__s,p.__d=!1,A&&A(t),d=p.render(p.props,p.state,p.context),b.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,A&&A(t),d=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++j<25);p.state=p.__s,p.getChildContext!=null&&(r=C(C({},r),p.getChildContext())),x&&!m&&p.getSnapshotBeforeUpdate!=null&&(_=p.getSnapshotBeforeUpdate(h,g)),M=d!=null&&d.type===D&&d.key==null?se(d.props.children):d,c=ee(e,S(M)?M:[M],t,n,r,i,a,s,c,l,u),p.base=t.__e,t.__u&=-161,p.__h.length&&s.push(p),v&&(p.__E=p.__=null)}catch(e){if(s.length=f,t.__v=null,l||a!=null){if(e.then){for(t.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;a!=null&&(a[a.indexOf(c)]=null),t.__e=c}else if(a!=null)for(N=a.length;N--;)w(a[N])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||ae(t),o.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=ce(n.__e,t,n,r,i,a,s,l,u);return(d=o.diffed)&&d(t),128&t.__u?void 0:c}function ae(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ae))}function oe(e,t,n){for(var r=0;r<n.length;r++)R(n[r],n[++r],n[++r]);o.__c&&o.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){o.__e(e,t.__v)}})}function se(e){return typeof e!=`object`||!e||e.__b>0?e:S(e)?e.map(se):e.constructor===void 0?C({},e):null}function ce(e,t,n,r,i,s,c,l,u){var d,f,p,m,h,g,_,v=n.props||y,b=t.props,x=t.type;if(x==`svg`?i=`http://www.w3.org/2000/svg`:x==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((h=s[d])&&`setAttribute`in h==!!x&&(x?h.localName==x:h.nodeType==3)){e=h,s[d]=null;break}}if(e==null){if(x==null)return document.createTextNode(b);e=document.createElementNS(i,x,b.is&&b),l&&=(o.__m&&o.__m(t,s),!1),s=null}if(x==null)v===b||l&&e.data==b||(e.data=b);else{if(s=x==`textarea`&&b.defaultValue!=null?null:s&&a.call(e.childNodes),!l&&s!=null)for(v={},d=0;d<e.attributes.length;d++)v[(h=e.attributes[d]).name]=h.value;for(d in v)h=v[d],d==`dangerouslySetInnerHTML`?p=h:d==`children`||d in b||d==`value`&&`defaultValue`in b||d==`checked`&&`defaultChecked`in b||I(e,d,null,h,i);for(d in b)h=b[d],d==`children`?m=h:d==`dangerouslySetInnerHTML`?f=h:d==`value`?g=h:d==`checked`?_=h:l&&typeof h!=`function`||v[d]===h||I(e,d,h,v[d],i);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=``),ee(t.type==`template`?e.content:e,S(m)?m:[m],t,n,r,x==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,s,c,s?s[0]:n.__k&&k(n,0),l,u),s!=null)for(d=s.length;d--;)w(s[d]);l&&x!=`textarea`||(d=`value`,x==`progress`&&g==null?e.removeAttribute(`value`):g!=null&&(g!==e[d]||x==`progress`&&!g||x==`option`&&g!=v[d])&&I(e,d,g,v[d],i),d=`checked`,_!=null&&_!=e[d]&&I(e,d,_,v[d],i))}return e}function R(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){o.__e(e,n)}}function le(e,t,n){var r,i;if(o.unmount&&o.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||R(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){o.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&le(r[i],t,n||typeof e.type!=`function`);n||w(e.__e),e.__c=e.__=e.__e=void 0}function ue(e,t,n){return this.constructor(e,n)}function z(e,t,n){var r,i,s,c;t==document&&(t=document.documentElement),o.__&&o.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,s=[],c=[],L(t,e=(!r&&n||t).__k=T(D,null,[e]),i||y,y,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?a.call(t.childNodes):null,s,!r&&n?n:i?i.__e:t.firstChild,r,c),oe(s,e,c),e.props.children=null}function de(e,t){z(e,t,de)}function fe(e,t,n){var r,i,o,s,c=C({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)o==`key`?r=t[o]:o==`ref`?i=t[o]:c[o]=t[o]===void 0&&s!=null?s[o]:t[o];return arguments.length>2&&(c.children=arguments.length>3?a.call(arguments,2):n),E(e.type,c,r||e.key,i||e.ref,null)}a=b.slice,o={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},s=0,O.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=C({},this.state);typeof e==`function`&&(e=e(C({},n),this.props)),e&&C(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),M(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),M(this))},O.prototype.render=D,c=[],u=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,d=function(e,t){return e.__v.__b-t.__v.__b},N.__r=0,f=Math.random().toString(8),p=`__d`+f,m=`__a`+f,h=/(PointerCapture)$|Capture$/i,g=0,_=ie(!1),v=ie(!0);function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(this,arguments)}function pe(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var me=[`context`,`children`],he=[`useFragment`];function ge(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){ve.call(this,r)},i.prototype.attributeChangedCallback=be,i.prototype.disconnectedCallback=xe,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function _e(e){this.getChildContext=function(){return e.context};var t=e.children;return fe(t,pe(e,me))}function ve(e){var t=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=T(_e,B({},this._props,{context:t.detail.context}),Ce(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?de:z)(this._vdom,this._root)}function ye(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function be(e,t,n){if(this._vdom){var r={};r[e]=n??=void 0,r[ye(e)]=n,this._vdom=fe(this._vdom,r),z(this._vdom,this._root)}}function xe(){z(this._vdom=null,this._root)}function Se(e,t){var n=this,r=e.useFragment,i=pe(e,he);return T(r?D:`slot`,B({},i,{ref:function(e){e?(n.ref=e,n._listener||(n._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,n._listener))):n.ref.removeEventListener(`_preact`,n._listener)}}))}function Ce(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[ye(o[a].name)]=o[a].value);for(a=s.length;a--;){var c=Ce(s[a],null,n),l=s[a].slot;l?i[l]=T(Se,{name:l},c):r[a]=c}var u=!(!n||!n.shadow),d=t?T(Se,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=``),T(t||e.nodeName.toLowerCase(),i,d)}function we(t,n,i=[],a={shadow:!0}){typeof window<`u`&&(e(r),customElements.get(n)||ge(t,n,i,a))}var Te=0;Array.isArray;function Ee(e,t,n,r,i,a){t||={};var s,c,l=t;if(`ref`in l)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Te,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return o.vnode&&o.vnode(u),u}var V,H,U,De,W=0,Oe=[],G=o,ke=G.__b,Ae=G.__r,je=G.diffed,Me=G.__c,Ne=G.unmount,Pe=G.__;function K(e,t){G.__h&&G.__h(H,e,W||t),W=0;var n=H.__H||(H.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function q(e){return W=1,Fe(He,e)}function Fe(e,t,n){var r=K(V++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):He(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=H,!H.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};H.__f=!0;var a=H.shouldComponentUpdate,o=H.componentWillUpdate;H.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},H.shouldComponentUpdate=i}return r.__N||r.__}function J(e,t){var n=K(V++,3);!G.__s&&Q(n.__H,t)&&(n.__=e,n.u=t,H.__H.__h.push(n))}function Ie(e,t){var n=K(V++,4);!G.__s&&Q(n.__H,t)&&(n.__=e,n.u=t,H.__h.push(n))}function Le(e){return W=5,Y(function(){return{current:e}},[])}function Y(e,t){var n=K(V++,7);return Q(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Re(e,t){return W=8,Y(function(){return e},t)}function ze(){for(var e;e=Oe.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(X),t.__h.some(Z),t.__h=[]}catch(n){t.__h=[],G.__e(n,e.__v)}}}G.__b=function(e){H=null,ke&&ke(e)},G.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Pe&&Pe(e,t)},G.__r=function(e){Ae&&Ae(e),V=0;var t=(H=e.__c).__H;t&&(U===H?(t.__h=[],H.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(X),t.__h.some(Z),t.__h=[],V=0)),U=H},G.diffed=function(e){je&&je(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Oe.push(t)!==1&&De===G.requestAnimationFrame||((De=G.requestAnimationFrame)||Ve)(ze)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),U=H=null},G.__c=function(e,t){t.some(function(e){try{e.__h.some(X),e.__h=e.__h.filter(function(e){return!e.__||Z(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],G.__e(n,e.__v)}}),Me&&Me(e,t)},G.unmount=function(e){Ne&&Ne(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{X(e)}catch(e){t=e}}),n.__H=void 0,t&&G.__e(t,n.__v))};var Be=typeof requestAnimationFrame==`function`;function Ve(e){var t,n=function(){clearTimeout(r),Be&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Be&&(t=requestAnimationFrame(n))}function X(e){var t=H,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),H=t}function Z(e){var t=H;e.__c=e.__(),H=t}function Q(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function He(e,t){return typeof t==`function`?t(e):t}function Ue(e,t){for(var n in t)e[n]=t[n];return e}function We(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Ge(e,t){var n=t(),r=q({t:{__:n,u:t}}),i=r[0].t,a=r[1];return Ie(function(){i.__=n,i.u=t,Ke(i)&&a({t:i})},[e,n,t]),J(function(){return Ke(i)&&a({t:i}),e(function(){Ke(i)&&a({t:i})})},[e]),n}function Ke(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function qe(e,t){this.props=e,this.context=t}(qe.prototype=new O).isPureReactComponent=!0,qe.prototype.shouldComponentUpdate=function(e,t){return We(this.props,e)||We(this.state,t)};var Je=o.__b;o.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Je&&Je(e)},typeof Symbol<`u`&&Symbol.for;var Ye=o.__e;o.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}Ye(e,t,n,r)};var Xe=o.unmount;function Ze(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=Ue({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Ze(e,t,n)})),e}function Qe(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Qe(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function $e(){this.__u=0,this.o=null,this.__b=null}function et(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function $(){this.i=null,this.l=null}o.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Xe&&Xe(e)},($e.prototype=new O).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=et(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Qe(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},$e.prototype.componentWillUnmount=function(){this.o=[]},$e.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=Ze(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&T(D,null,e.fallback);return i&&(i.__u&=-33),[T(D,null,t.__a?null:e.children),i]};var tt=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};($.prototype=new O).__a=function(e){var t=this,n=et(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),tt(t,e,r)):i()};n?n(a):a()}},$.prototype.render=function(e){this.i=null,this.l=new Map;var t=F(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},$.prototype.componentDidUpdate=$.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){tt(e,n,t)})};var nt=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,rt=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,it=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,at=/[A-Z0-9]/g,ot=typeof document<`u`,st=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};O.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(O.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ct=o.event;o.event=function(e){return ct&&(e=ct(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var lt={configurable:!0,get:function(){return this.class}},ut=o.vnode;o.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||ot&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||st(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:it.test(a)&&(a=s):s=a=`oninput`:i&&rt.test(a)?a=a.replace(at,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=F(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=F(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",lt)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=nt,ut&&ut(e)};var dt=o.__r;o.__r=function(e){dt&&dt(e),e.__c};var ft=o.diffed;o.diffed=function(e){ft&&ft(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};function pt(){let[e,t]=q(()=>window.FrakSetup?.config?.waitForBackendConfig===!1||i.isResolved),[r,a]=q(()=>i.getConfig().hidden??!1),[o,s]=q(()=>!!window.FrakSetup?.client);return J(()=>{let e=i.getConfig();e.isResolved&&(t(!0),a(e.hidden??!1)),window.FrakSetup?.client&&s(!0);let r=e=>{let n=e.detail;n.isResolved&&t(!0),a(n.hidden??!1)};window.addEventListener(`frak:config`,r);let o=()=>s(!0);return n(`add`,o),()=>{window.removeEventListener(`frak:config`,r),n(`remove`,o)}},[]),{shouldRender:e,isHidden:r,isClientReady:o}}function mt(e){return typeof window>`u`?()=>{}:(window.addEventListener(`frak:config`,e),()=>window.removeEventListener(`frak:config`,e))}function ht(){return Ge(mt,()=>i.getConfig().lang??t()??`en`)}const gt=`
2
- :host {
3
- display: contents;
4
- }
5
-
6
- :host([hidden]) {
7
- display: none;
8
- }
9
-
10
- .button:disabled {
11
- opacity: 0.7;
12
- cursor: default;
13
- }
14
-
15
- .button__fadeIn {
16
- animation: frak-fadeIn 300ms ease-in;
17
- }
18
-
19
- @keyframes frak-fadeIn {
20
- from {
21
- opacity: 0;
22
- }
23
-
24
- to {
25
- opacity: 1;
26
- }
27
- }
28
- `;function _t(e,t){return t?`${gt}\n${e}\n${t}`:`${gt}\n${e}`}const vt=`
29
- :where(frak-button-share, frak-open-in-app) {
30
- display: contents;
31
- }
32
-
33
- :where(frak-button-share .button, frak-open-in-app .button) {
34
- display: flex;
35
- align-items: center;
36
- justify-content: center;
37
- gap: 10px;
38
- }
39
-
40
- :where(frak-button-share .button:disabled, frak-open-in-app .button:disabled) {
41
- opacity: 0.7;
42
- cursor: default;
43
- }
44
-
45
- :where(frak-button-share .button__fadeIn, frak-open-in-app .button__fadeIn) {
46
- animation: frak-fadeIn 300ms ease-in;
47
- }
48
-
49
- @keyframes frak-fadeIn {
50
- from {
51
- opacity: 0;
52
- }
53
-
54
- to {
55
- opacity: 1;
56
- }
57
- }
58
- `;function yt(e){return i.getConfig().placements?.[e]}function bt(e){return Ge(mt,Re(()=>e?yt(e):void 0,[e]))}const xt={en:{buttonShare:{text:`Share & earn {REWARD}!`},postPurchase:{refereeText:`You just earned {REWARD}! Share with friends to earn even more.`,refereeNoRewardText:`You just earned a reward! Share with friends to earn even more.`,referrerText:`Earn {REWARD} by sharing this with your friends!`,referrerNoRewardText:`Share this with your friends and earn rewards!`,ctaText:`Share & earn {REWARD}`,ctaNoRewardText:`Share & earn`},openInApp:{text:`Open in App`,ariaLabel:`Open in Frak Wallet app`},buttonWallet:{ariaLabel:`Open wallet`},banner:{referralTitleReward:`Earn {REWARD} on purchases`,referralTitle:`You've been referred!`,referralDescription:`Earn rewards after your purchase via the Frak partner app.`,referralCta:`Got it`,inappTitle:`Open in your browser`,inappDescription:`For a better experience and to earn your rewards, open this page in your default browser.`,inappCta:`Open browser`,dismissLabel:`Dismiss`}},fr:{buttonShare:{text:`Partagez et gagnez {REWARD} !`},postPurchase:{refereeText:`Vous venez de gagner {REWARD} ! Partagez avec vos amis pour gagner encore plus.`,refereeNoRewardText:`Vous venez de gagner une récompense ! Partagez avec vos amis pour gagner encore plus.`,referrerText:`Gagnez {REWARD} en partageant avec vos amis !`,referrerNoRewardText:`Partagez avec vos amis et gagnez des récompenses !`,ctaText:`Partagez et gagnez {REWARD}`,ctaNoRewardText:`Partagez et gagnez`},openInApp:{text:`Ouvrir dans l'app`,ariaLabel:`Ouvrir dans l'app Frak Wallet`},buttonWallet:{ariaLabel:`Ouvrir le porte-monnaie`},banner:{referralTitleReward:`Gagnez {REWARD} sur vos achats`,referralTitle:`Vous avez été parrainé !`,referralDescription:`Gagnez des récompenses après votre achat via l'application partenaire Frak.`,referralCta:`J'ai compris`,inappTitle:`Ouvrez dans votre navigateur`,inappDescription:`Pour une meilleure expérience et pour gagner vos récompenses, ouvrez cette page dans votre navigateur par défaut.`,inappCta:`Ouvrir le navigateur`,dismissLabel:`Fermer`}}};export{ht as a,Ge as c,q as d,J as f,D as g,we as h,vt as i,Le as l,Ee as m,bt as n,mt as o,Re as p,_t as r,pt as s,xt as t,Y as u};
@@ -1 +0,0 @@
1
- import{s as e}from"./loader.js";async function t(t,n){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}let r=window.FrakSetup?.modalWalletConfig??{};await e(window.FrakSetup.client,t?{...r,metadata:{...r.metadata,targetInteraction:t}}:r,n)}export{t};
@@ -1 +0,0 @@
1
- import{w as e}from"./loader.js";import{c as t,o as n}from"./defaults.CT8FNvot.js";function r(){return t(n,()=>e.getConfig().components)}export{r as t};
@@ -1 +0,0 @@
1
- import{O as e}from"./loader.js";import{f as t,i as n}from"./defaults.CT8FNvot.js";function r(r,i,a,o,s){t(()=>{s&&e.injectBase(`shared`,s),e.injectBase(r,o??n)},[r]),t(()=>{!i||!a||e.injectPlacement(r,i,a)},[r,i,a])}export{r as t};
@@ -1,18 +0,0 @@
1
- import { displayEmbeddedWallet } from "@frak-labs/core-sdk/actions";
2
- //#region src/actions/embeddedWallet.ts
3
- async function openEmbeddedWallet(targetInteraction, placement) {
4
- if (!window.FrakSetup?.client) {
5
- console.error("Frak client not found");
6
- return;
7
- }
8
- const modalWalletConfig = window.FrakSetup?.modalWalletConfig ?? {};
9
- await displayEmbeddedWallet(window.FrakSetup.client, targetInteraction ? {
10
- ...modalWalletConfig,
11
- metadata: {
12
- ...modalWalletConfig.metadata,
13
- targetInteraction
14
- }
15
- } : modalWalletConfig, placement);
16
- }
17
- //#endregion
18
- export { openEmbeddedWallet as t };