@imtbl/sdk 0.23.0-alpha → 0.23.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ (self.webpackChunk_imtbl_checkout_widgets_lib=self.webpackChunk_imtbl_checkout_widgets_lib||[]).push([[692],{28692:function(e){window,e.exports=function(e){var t={};function a(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)a.d(n,i,function(t){return e[t]}.bind(null,i));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=2)}([function(e,t,a){"use strict";a.r(t);var n="function"==typeof fetch?fetch.bind():function(e,t){return t=t||{},new Promise((function(a,n){var i=new XMLHttpRequest;for(var r in i.open(t.method||"get",e,!0),t.headers)i.setRequestHeader(r,t.headers[r]);function s(){var e,t=[],a=[],n={};return i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(i,r,s){t.push(r=r.toLowerCase()),a.push([r,s]),e=n[r],n[r]=e?e+","+s:s})),{ok:2==(i.status/100|0),status:i.status,statusText:i.statusText,url:i.responseURL,clone:s,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},headers:{keys:function(){return t},entries:function(){return a},get:function(e){return n[e.toLowerCase()]},has:function(e){return e.toLowerCase()in n}}}}i.withCredentials="include"==t.credentials,i.onload=function(){a(s())},i.onerror=n,i.send(t.body)}))};t.default=n},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),i=function(){function e(t,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pluginName=t}return n(e,[{key:"track",value:function(e,t){window.analytics.track(e,t,{integration:{name:this.pluginName}})}}]),e}();t.default=i},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.YouTubeAnalytics=t.VimeoAnalytics=void 0;var n=r(a(3)),i=r(a(4));function r(e){return e&&e.__esModule?e:{default:e}}t.VimeoAnalytics=n.default,t.YouTubeAnalytics=i.default},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),i=r(a(0));function r(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(e,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"VimeoAnalytics"));return n.authToken=a,n.player=e,n.metadata={content:{},playback:{videoPlayer:"Vimeo"}},n.mostRecentHeartbeat=0,n.isPaused=!1,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"initialize",value:function(){var e=this,t={loaded:this.retrieveMetadata,play:this.trackPlay,pause:this.trackPause,ended:this.trackEnded,timeupdate:this.trackHeartbeat};for(var a in t)this.registerHandler(a,t[a]);this.player.getVideoId().then((function(t){e.retrieveMetadata({id:t})})).catch(console.error)}},{key:"registerHandler",value:function(e,t){var a=this;this.player.on(e,(function(e){a.updateMetadata(e),t.call(a,e)}))}},{key:"trackPlay",value:function(){this.isPaused?(this.track("Video Playback Resumed",this.metadata.playback),this.isPaused=!1):(this.track("Video Playback Started",this.metadata.playback),this.track("Video Content Started",this.metadata.content))}},{key:"trackEnded",value:function(){this.track("Video Playback Completed",this.metadata.playback),this.track("Video Content Completed",this.metadata.content)}},{key:"trackHeartbeat",value:function(){var e=this.mostRecentHeartbeat,t=this.metadata.playback.position;t!==e&&t-e>=10&&(this.track("Video Content Playing",this.metadata.content),this.mostRecentHeartbeat=Math.floor(t))}},{key:"trackPause",value:function(){this.isPaused=!0,this.track("Video Playback Paused",this.metadata.playback)}},{key:"retrieveMetadata",value:function(e){var t=this;return new Promise((function(a,n){var r=e.id;(0,i.default)("https://api.vimeo.com/videos/"+r,{headers:{Authorization:"Bearer "+t.authToken}}).then((function(e){return e.ok?e.json():n(e)})).then((function(e){t.metadata.content.title=e.name,t.metadata.content.description=e.description,t.metadata.content.publisher=e.user.name,t.metadata.playback.position=0,t.metadata.playback.totalLength=e.duration})).catch((function(e){return console.error("Request to Vimeo API Failed with: ",e),n(e)}))}))}},{key:"updateMetadata",value:function(e){var t=this;return new Promise((function(a,n){t.player.getVolume().then((function(n){n&&(t.metadata.playback.sound=100*n),t.metadata.playback.position=e.seconds,a()})).catch(n)}))}}]),t}(r(a(1)).default);t.default=s},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),i=r(a(0));function r(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(e,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"YoutubeAnalytics"));return n.player=e,n.apiKey=a,n.playerLoaded=!1,n.playbackStarted=!1,n.contentStarted=!1,n.isPaused=!1,n.isBuffering=!1,n.isSeeking=!1,n.lastRecordedTime={timeReported:Date.now(),timeElapsed:0},n.metadata=[{playback:{video_player:"youtube"},content:{}}],n.playlistIndex=0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"initialize",value:function(){window.segmentYoutubeOnStateChange=this.onPlayerStateChange.bind(this),window.segmentYoutubeOnReady=this.onPlayerReady.bind(this),this.player.addEventListener("onReady","segmentYoutubeOnReady"),this.player.addEventListener("onStateChange","segmentYoutubeOnStateChange")}},{key:"onPlayerReady",value:function(e){this.retrieveMetadata()}},{key:"onPlayerStateChange",value:function(e){var t=this.player.getCurrentTime();switch(this.metadata[this.playlistIndex]&&(this.metadata[this.playlistIndex].playback.position=this.metadata[this.playlistIndex].content.position=t,this.metadata[this.playlistIndex].playback.quality=this.player.getPlaybackQuality(),this.metadata[this.playlistIndex].playback.sound=this.player.isMuted()?0:this.player.getVolume()),e.data){case-1:if(this.playerLoaded)break;this.retrieveMetadata(),this.playerLoaded=!0;break;case YT.PlayerState.BUFFERING:this.handleBuffer();break;case YT.PlayerState.PLAYING:this.handlePlay();break;case YT.PlayerState.PAUSED:this.handlePause();break;case YT.PlayerState.ENDED:this.handleEnd()}this.lastRecordedTime={timeReported:Date.now(),timeElapsed:1e3*this.player.getCurrentTime()}}},{key:"retrieveMetadata",value:function(){var e=this;return new Promise((function(t,a){var n=e.player.getVideoData(),r=e.player.getPlaylist()||[n.video_id],s=r.join();(0,i.default)("https://www.googleapis.com/youtube/v3/videos?id="+s+"&part=snippet,contentDetails&key="+e.apiKey).then((function(e){if(!e.ok){var t=new Error("Segment request to Youtube API failed (likely due to a bad API Key. Events will still be sent but will not contain video metadata)");throw t.response=e,t}return e.json()})).then((function(a){e.metadata=[];for(var n=0,i=0;i<r.length;i++){var s=a.items[i];e.metadata.push({content:{title:s.snippet.title,description:s.snippet.description,keywords:s.snippet.tags,channel:s.snippet.channelTitle,airdate:s.snippet.publishedAt}}),n+=o(s.contentDetails.duration)}for(i=0;i<r.length;i++)e.metadata[i].playback={total_length:n,video_player:"youtube"};t()})).catch((function(t){e.metadata=r.map((function(e){return{playback:{video_player:"youtube"},content:{}}})),a(t)}))}))}},{key:"handleBuffer",value:function(){var e=this.determineSeek();this.playbackStarted||(this.playbackStarted=!0,this.track("Video Playback Started",this.metadata[this.playlistIndex].playback)),e&&!this.isSeeking&&(this.isSeeking=!0,this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback)),this.isSeeking&&(this.track("Video Playback Seek Completed",this.metadata[this.playlistIndex].playback),this.isSeeking=!1);var t=this.player.getPlaylist();t&&0===this.player.getCurrentTime()&&this.player.getPlaylistIndex()!==this.playlistIndex&&(this.contentStarted=!1,this.playlistIndex===t.length-1&&0===this.player.getPlaylistIndex()&&(this.track("Video Playback Completed",this.metadata[this.player.getPlaylistIndex()].playback),this.track("Video Playback Started",this.metadata[this.player.getPlaylistIndex()].playback))),this.track("Video Playback Buffer Started",this.metadata[this.playlistIndex].playback),this.isBuffering=!0}},{key:"handlePlay",value:function(){this.contentStarted||(this.playlistIndex=this.player.getPlaylistIndex(),-1===this.playlistIndex&&(this.playlistIndex=0),this.track("Video Content Started",this.metadata[this.playlistIndex].content),this.contentStarted=!0),this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused&&(this.track("Video Playback Resumed",this.metadata[this.playlistIndex].playback),this.isPaused=!1)}},{key:"handlePause",value:function(){var e=this.determineSeek();this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused||(e?(this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback),this.isSeeking=!0):(this.track("Video Playback Paused",this.metadata[this.playlistIndex].playback),this.isPaused=!0))}},{key:"handleEnd",value:function(){this.track("Video Content Completed",this.metadata[this.playlistIndex].content),this.contentStarted=!1;var e=this.player.getPlaylistIndex(),t=this.player.getPlaylist();(t&&e===t.length-1||-1===e)&&(this.track("Video Playback Completed",this.metadata[this.playlistIndex].playback),this.playbackStarted=!1)}},{key:"determineSeek",value:function(){var e=this.isPaused||this.isBuffering?0:Date.now()-this.lastRecordedTime.timeReported,t=1e3*this.player.getCurrentTime()-this.lastRecordedTime.timeElapsed;return Math.abs(e-t)>2e3}}]),t}(r(a(1)).default);function o(e){var t=e.match(/PT(\d+H)?(\d+M)?(\d+S)?/);return t=t.slice(1).map((function(e){if(null!=e)return e.replace(/\D/,"")})),3600*(parseInt(t[0])||0)+60*(parseInt(t[1])||0)+(parseInt(t[2])||0)}t.default=s}])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_imtbl_checkout_widgets_lib=self.webpackChunk_imtbl_checkout_widgets_lib||[]).push([[703],{52889:function(e,t,n){n.d(t,{u:function(){return f}});var r=n(72771),a=n(50940),i=n(65535),o={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},s={color:"base.color.text.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},c={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},l={width:"100%",height:"base.spacing.x16"},d={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"},u=n(95269),p=n(10256);function f(e){var t=e.onCloseBottomSheet,n=e.visible,f=e.showHeaderBar,h=e.walletAddress,x=e.showAdjustAmount,v=u.f.drawers.notEnoughGas,E=v.content,m=v.buttons,b=(0,i.useState)(!1),C=(0,r.Z)(b,2),k=C[0],g=C[1],w=(0,i.useCallback)((function(){h&&""!==h&&navigator.clipboard.writeText(h),g(!0),setTimeout((function(){g(!1)}),3e3)}),[h]);return(0,p.jsx)(a.R1,{headerBarTitle:void 0,size:"full",onCloseBottomSheet:t,visible:n,showHeaderBar:f,children:(0,p.jsx)(a.R1.Content,{children:(0,p.jsxs)(a.xu,{testId:"not-enough-gas-bottom-sheet",sx:o,children:[(0,p.jsx)(a.fP,{imageUrl:"https://design-system.immutable.com/hosted-for-ds/currency-icons/currency--eth.svg",circularFrame:!0,sx:{backgroundColor:"white",height:"100px",padding:"10px"}}),(0,p.jsx)(a.X6,{size:"small",sx:s,testId:"not-enough-gas-heading",children:E.heading}),(0,p.jsx)(a.uT,{sx:s,children:E.body}),(0,p.jsxs)(a.xu,{sx:c,children:[x&&(0,p.jsx)(a.zx,{testId:"not-enough-gas-adjust-amount-button",sx:l,variant:"tertiary",onClick:t,children:m.adjustAmount}),(0,p.jsxs)(a.zx,{testId:"not-enough-gas-copy-address-button",sx:l,variant:"tertiary",onClick:w,children:[m.copyAddress,(0,p.jsx)(a.zx.Icon,{icon:k?"Tick":"CopyText"})]}),(0,p.jsx)(a.zx,{sx:l,variant:"tertiary",onClick:t,testId:"not-enough-gas-cancel-button",children:m.cancel})]}),(0,p.jsx)(a.xu,{sx:d,children:(0,p.jsx)(a.TR,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}},6506:function(e,t,n){n.d(t,{B:function(){return a}});var r=n(62290);var a={sendRequestBridgeEvent:function(e,t,n){var a=new CustomEvent(t,{detail:{type:r.Wy.REQUEST_BRIDGE,data:n}});console.log("bridge coins event:",e,a),void 0!==e&&e.dispatchEvent(a)},sendRequestSwapEvent:function(e,t,n){var a=new CustomEvent(t,{detail:{type:r.Wy.REQUEST_SWAP,data:n}});console.log("request swap event:",e,a),void 0!==e&&e.dispatchEvent(a)},sendRequestOnrampEvent:function(e,t,n){var a=new CustomEvent(t,{detail:{type:r.Wy.REQUEST_ONRAMP,data:n}});console.log("request onramp event:",e,a),void 0!==e&&e.dispatchEvent(a)}}},1138:function(e,t,n){n.d(t,{t:function(){return N}});var r=n(46999),a=n(18950),i=n(72771),o=n(50940),s=n(62290),c=n(65535),l=n(29956),d=n(4813),u=n(581),p=n(58534),f=n(39275),h=n(95269),x=n(6506),v=n(36011),E=n(23357),m=n(72225),b=function(e,t,n){var r=-1;if(e&&t){var a=m.formatUnits(e,t.decimals),i=n.get(t.symbol.toLocaleLowerCase());if(i){var o=parseFloat(a);if(Number.isNaN(o))return r;r=parseFloat(a)*i}}return r};function C(e){if(e<0)return"-.--";var t=e.toString();if(t.includes("e")||0===e)return"0.00";if(e<.01)for(var n=0;n<t.length;n++)if("0"!==t[n]&&"."!==t[n])return e.toFixed(n-1);return e.toFixed(2)}var k=function(e){var t=e.minPercentage,n=e.maxPercentage;return void 0===t||void 0===n?"-.--":"".concat(t,"% to ").concat(n)},g=function(e,t){var n=e.gasFee,r=n.estimatedAmount;if(void 0===r)return"-.--";var a=n.token;if(void 0===a)return"-.--";var i=b(r,a,t);return i<0?"-.--":C(i)},w=function(e,t){var n=e.gasFee,r=e.bridgeFee,a=n.estimatedAmount;if(void 0===a)return"-.--";var i=n.token;if(void 0===!i)return"-.--";var o=b(a,i,t);if(o<0)return"-.--";var s=b(r.estimatedAmount,r.token,t);return C(s<0?o:o+s)},L=n(47618),T=n(95175),y=n(46207),I=n(55820),j=n(35314),Z=n(9437),_=n(83712),S=n(10256);function A(e){var t=e.testId,n=e.icon,r=e.heading,a=e.caption,i=e.subcaption,s=e.onClick,c=e.renderFeeFunction;return(0,S.jsx)(o.xu,{testId:"top-up-view",sx:{paddingY:"1px"},children:(0,S.jsxs)(o.sN,{testId:"menu-item-".concat(t),size:"medium",emphasized:!0,onClick:s,children:[(0,S.jsx)(o.sN.Icon,{icon:n}),(0,S.jsx)(o.sN.Label,{size:"medium",children:r}),(0,S.jsx)(o.sN.IntentIcon,{}),(0,S.jsxs)(o.sN.Caption,{testId:"menu-item-caption-".concat(t),children:[a,(0,S.jsx)("br",{}),i," ",c("-.--",!1)]})]})})}var O=3e4;function N(e){var t=e.widgetEvent,n=e.showOnrampOption,m=e.showSwapOption,b=e.showBridgeOption,C=e.tokenAddress,N=e.amount,R=e.onCloseButtonClick,B=e.onBackButtonClick,M=(0,c.useContext)(I.R4).connectLoaderState,D=M.checkout,W=M.provider,F=h.f.views[f.cZ.TOP_UP_VIEW],P=F.header,U=F.topUpOptions,V=U.onramp,z=U.swap,G=U.bridge,K=(0,c.useContext)(f.A7).viewDispatch,q=(0,c.useContext)(L.FJ),J=q.cryptoFiatState,X=q.cryptoFiatDispatch,Y=J.conversions,H=J.fiatSymbol,Q=(0,c.useContext)(_.yh).eventTargetState.eventTarget,$=(0,c.useState)("-.--"),ee=(0,i.Z)($,2),te=ee[0],ne=ee[1],re=(0,c.useState)("-.--"),ae=(0,i.Z)(re,2),ie=ae[0],oe=ae[1],se=(0,c.useState)("-.--"),ce=(0,i.Z)(se,2),le=ce[0],de=ce[1],ue=(0,c.useState)(!1),pe=(0,i.Z)(ue,2),fe=pe[0],he=pe[1],xe=(0,c.useState)(!1),ve=(0,i.Z)(xe,2),Ee=ve[0],me=ve[1],be=(0,c.useState)(!1),Ce=(0,i.Z)(be,2),ke=Ce[0],ge=Ce[1],we=(0,j.T)(W);(0,c.useEffect)((function(){D&&X&&X({payload:{type:L.rj.SET_TOKEN_SYMBOLS,tokenSymbols:y.j}})}),[D,X]);var Le=function(){var e=(0,a.Z)((0,r.Z)().mark((function e(){var t,n,a,o,s,c,d,u,p,f=arguments;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=f.length>0&&void 0!==f[0]&&f[0],D){e.next=3;break}return e.abrupt("return");case 3:return t||(he(!0),me(!0),ge(!0)),e.prev=4,e.next=7,Promise.all([D.gasEstimate({gasEstimateType:l.IW.SWAP}),D.gasEstimate({gasEstimateType:l.IW.BRIDGE_TO_L2,isSpendingCapApprovalRequired:!0}),D.getExchangeFeeEstimate()]);case 7:n=e.sent,a=(0,i.Z)(n,3),o=a[0],s=a[1],c=a[2],d=k(c),ne(d),u=g(o,Y),oe(u),p=w(s,Y),de(p),e.next=25;break;case 20:e.prev=20,e.t0=e.catch(4),ne("-.--"),oe("-.--"),de("-.--");case 25:return e.prev=25,ge(!1),me(!1),he(!1),e.finish(25);case 30:case"end":return e.stop()}}),e,null,[[4,20,25,30]])})));return function(){return e.apply(this,arguments)}}();(0,T.Y)((function(){return Le(!0)}),O),(0,c.useEffect)((function(){D&&0!==Y.size&&Le()}),[D,0===Y.size]);var Te=function(e,t){return t?(0,S.jsx)(o.uT,{size:"xSmall",shimmer:1,testId:"fees-shimmer"}):" \u2248 $".concat(e," ").concat(H.toLocaleUpperCase())};return(0,S.jsx)(p.X,{header:(0,S.jsx)(u.F,{onBackButtonClick:B,onCloseButtonClick:R,showBack:!0}),footer:(0,S.jsx)(d.w,{}),children:(0,S.jsxs)(o.xu,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[(0,S.jsx)(o.X6,{size:"small",children:P.title}),(0,S.jsxs)(o.xu,{sx:{paddingY:"base.spacing.x4"},children:[n&&(0,S.jsx)(A,{testId:"onramp",icon:"Wallet",heading:V.heading,caption:V.caption,subcaption:V.subcaption,onClick:function(){t!==s.O6.IMTBL_ONRAMP_WIDGET_EVENT?x.B.sendRequestOnrampEvent(window,t,{tokenAddress:null!==C&&void 0!==C?C:"",amount:null!==N&&void 0!==N?N:""}):K({payload:{type:f.Cp.UPDATE_VIEW,view:{type:Z.d.ONRAMP,data:{contractAddress:"",amount:""}}}})},renderFeeFunction:function(){return e=te,fe?(0,S.jsx)(o.uT,{size:"xSmall",shimmer:1,testId:"fee-percentage-shimmer"}):" \u2248 ".concat(e,"%");var e}}),m&&(0,S.jsx)(A,{testId:"swap",icon:"Coins",heading:z.heading,caption:z.caption,subcaption:z.subcaption,onClick:function(){t!==s.O6.IMTBL_SWAP_WIDGET_EVENT?x.B.sendRequestSwapEvent(Q,t,{fromTokenAddress:"",toTokenAddress:null!==C&&void 0!==C?C:"",amount:""}):K({payload:{type:f.Cp.UPDATE_VIEW,view:{type:v.j.SWAP,data:{toContractAddress:"",fromAmount:"",fromContractAddress:""}}}})},renderFeeFunction:function(){return Te(ie,Ee)}}),b&&!we&&(0,S.jsx)(A,{testId:"bridge",icon:"Minting",heading:G.heading,caption:G.caption,subcaption:G.subcaption,onClick:function(){t!==s.O6.IMTBL_BRIDGE_WIDGET_EVENT?x.B.sendRequestBridgeEvent(Q,t,{tokenAddress:"",amount:""}):K({payload:{type:f.Cp.UPDATE_VIEW,view:{type:E.O.BRIDGE,data:{fromContractAddress:"",fromAmount:""}}}})},renderFeeFunction:function(){return Te(le,ke)}})]})]})})}},23703:function(e,t,n){n.r(t),n.d(t,{ImmutableWallet:function(){return Mt}});var r=n(74708),a=n(8821),i=n(85169),o=n(69803),s=n(2312),c=n(82248),l=n(8416),d=n(65535),u=n(64093),p=n(50940),f=n(46999),h=n(18950),x=n(72771),v=n(62290),E=n(37755),m={walletProvider:null,network:null,tokenBalances:[],supportedTopUps:null},b=function(e){return e.SET_WALLET_PROVIDER="SET_WALLET_PROVIDER",e.SET_NETWORK="SET_NETWORK",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_SUPPORTED_TOP_UPS="SUPPORTED_TOP_UPS",e}({}),C=(0,d.createContext)({walletState:m,walletDispatch:function(){}});C.displayName="WalletContext";var k=function(e,t){var n,r,a;switch(t.payload.type){case b.SET_WALLET_PROVIDER:return(0,E.Z)((0,E.Z)({},e),{},{walletProvider:t.payload.walletProvider});case b.SET_NETWORK:return(0,E.Z)((0,E.Z)({},e),{},{network:t.payload.network});case b.SET_TOKEN_BALANCES:return(0,E.Z)((0,E.Z)({},e),{},{tokenBalances:t.payload.tokenBalances});case b.SET_SUPPORTED_TOP_UPS:return(0,E.Z)((0,E.Z)({},e),{},{supportedTopUps:{isSwapEnabled:null===(n=t.payload.supportedTopUps.isSwapEnabled)||void 0===n||n,isOnRampEnabled:null===(r=t.payload.supportedTopUps.isOnRampEnabled)||void 0===r||r,isBridgeEnabled:null===(a=t.payload.supportedTopUps.isBridgeEnabled)||void 0===a||a}});default:return e}},g=n(29956),w=n(72225),L=n(4813),T=n(581),y=n(58534),I=n(95269),j={display:"flex",flexDirection:"row",justifyContent:"space-between",paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},Z={display:"flex",direction:"row",columnGap:"base.spacing.x1",alignItems:"center"},_={width:"base.icon.size.250",height:"base.icon.size.250",fill:"base.color.accent.4",cursor:"pointer",borderRadius:"50%"},S=n(39275),A=n(57287),O=n(10256);function N(e){var t=(0,d.useContext)(S.A7).viewDispatch,n=I.f.views[A.J.WALLET_BALANCES].totalTokenBalance,r=e.totalBalance,a=e.loading;return(0,O.jsxs)(p.xu,{sx:j,children:[(0,O.jsxs)(p.xu,{sx:Z,children:[(0,O.jsx)(p.uT,{size:"medium",children:n.heading}),(0,O.jsx)(p.xu,{sx:{pl:"base.spacing.x1"},children:(0,O.jsx)(p.iv,{testId:"coin-info-icon",variant:"tertiary",icon:"Information",sx:_,onClick:function(){return t({payload:{type:S.Cp.UPDATE_VIEW,view:{type:A.J.COIN_INFO}}})}})})]}),(0,O.jsxs)(p.xu,{sx:Z,children:[(0,O.jsx)(p.uT,{testId:"total-token-balance-value",weight:"bold",shimmer:a?1:0,shimmerSx:{minw:"100px"},children:n.totalHeading}),!a&&(0,O.jsxs)(p.uT,{testId:"total-token-balance",weight:"bold",children:["\u2248 USD $",r.toFixed(2)]})]})]})}var R=function(e){return{display:e?"":"none"}},B=n(6506),M=n(61339),D=n(46869),W=n(55820),F=n(35314),P=n(83712);function U(e){var t=e.balanceInfo,n=e.bridgeToL2OnClick,r=(0,d.useContext)(W.R4).connectLoaderState,a=r.checkout,i=r.provider,o="\u2248 USD $".concat((0,D.FL)(t.fiatAmount)),s=(0,d.useContext)(C).walletState,c=s.supportedTopUps,l=s.network,u=(0,d.useState)(),E=(0,x.Z)(u,2),m=E[0],b=E[1],k=(0,d.useState)(),w=(0,x.Z)(k,2),L=w[0],T=w[1],y=(0,d.useState)(),I=(0,x.Z)(y,2),j=I[0],Z=I[1],_=(0,d.useContext)(P.yh).eventTargetState.eventTarget,S=(0,d.useState)([]),A=(0,x.Z)(S,2),N=A[0],U=A[1],V=(0,F.T)(i);(0,d.useEffect)((function(){var e=function(){var e=(0,h.Z)((0,f.Z)().mark((function e(){var t;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,a.getTokenAllowList({type:g.Zs.ONRAMP,chainId:(0,M.D3)(a.config)});case 4:t=e.sent,U(t.tokens);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[a]),(0,d.useEffect)((function(){var e,t,n;if(l&&c&&a){var r=l.chainId===(0,M.D3)(a.config)&&(null===(e=null===c||void 0===c?void 0:c.isOnRampEnabled)||void 0===e||e);b(r);var i=l.chainId===(0,M.Tz)(a.config)&&(null===(t=null===c||void 0===c?void 0:c.isBridgeEnabled)||void 0===t||t)&&!V;T(i);var o=l.chainId===(0,M.D3)(a.config)&&(null===(n=null===c||void 0===c?void 0:c.isSwapEnabled)||void 0===n||n);Z(o)}}),[l,c,a,V]);var z=(0,d.useMemo)((function(){return Boolean(m&&N.length>0&&N.find((function(e){var n,r;return(null===(n=e.address)||void 0===n?void 0:n.toLowerCase())===(null===(r=t.address)||void 0===r?void 0:r.toLowerCase())})))}),[m,N]);return(0,O.jsxs)(p.sN,{testId:"balance-item-".concat(t.symbol),emphasized:!0,children:[(0,O.jsx)(p.sN.FramedIcon,{icon:"Coins",circularFrame:!0}),(0,O.jsx)(p.sN.Label,{children:t.symbol}),(0,O.jsx)(p.sN.Caption,{children:t.description}),(0,O.jsx)(p.sN.PriceDisplay,{testId:"balance-item-".concat(t.symbol),use:(0,O.jsx)(p.X6,{size:"xSmall"}),price:(0,D.Lr)(t.balance),fiatAmount:o}),(m||j||L)&&(0,O.jsxs)(p.sN.OverflowPopoverMenu,{size:"small",testId:"token-menu",children:[(0,O.jsxs)(p.sN,{testId:"balance-item-add-option",sx:R(z),onClick:function(){var e;B.B.sendRequestOnrampEvent(_,v.O6.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:null!==(e=t.address)&&void 0!==e?e:"",amount:""})},children:[(0,O.jsx)(p.sN.Icon,{icon:"Add"}),(0,O.jsx)(p.sN.Label,{children:"Add ".concat(t.symbol)})]}),(0,O.jsxs)(p.sN,{testId:"balance-item-swap-option",sx:R(j),onClick:function(){var e;B.B.sendRequestSwapEvent(_,v.O6.IMTBL_WALLET_WIDGET_EVENT,{fromTokenAddress:null!==(e=t.address)&&void 0!==e?e:"",toTokenAddress:"",amount:""})},children:[(0,O.jsx)(p.sN.Icon,{icon:"Exchange"}),(0,O.jsx)(p.sN.Label,{children:"Swap ".concat(t.symbol)})]}),(0,O.jsxs)(p.sN,{testId:"balance-item-move-option",sx:R(L),onClick:function(){return n(t.address)},children:[(0,O.jsx)(p.sN.Icon,{icon:"Minting"}),(0,O.jsx)(p.sN.Label,{children:"Move ".concat(t.symbol)})]})]})]})}var V={width:"100%",height:"100%",display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},z={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},G=n(26763),K=function(e){return e.filter((function(e){return e.balance!==G.q1||(0,D.Mg)(e.address)}))};function q(e){var t=e.balanceInfoItems,n=e.bridgeToL2OnClick,r=I.f.views[A.J.WALLET_BALANCES].tokenBalancesList.noTokensFound,a=K(t);return(0,O.jsxs)(p.xu,{sx:V,children:[0===a.length&&(0,O.jsx)(p.xu,{sx:z,children:(0,O.jsx)(p.uT,{testId:"no-tokens-found",children:r})}),a.map((function(e){return(0,O.jsx)(U,{balanceInfo:e,bridgeToL2OnClick:n},e.id)}))]})}var J=n(47169);function X(e){var t=new CustomEvent(v.O6.IMTBL_WALLET_WIDGET_EVENT,{detail:{type:v.f2.CLOSE_WIDGET,data:{}}});console.log("close widget event:",e,t),void 0!==e&&e.dispatchEvent(t)}function Y(e,t,n){var r=new CustomEvent(v.O6.IMTBL_WALLET_WIDGET_EVENT,{detail:{type:v.f2.NETWORK_SWITCH,data:{network:n.name,chainId:n.chainId,provider:t}}});console.log("switch network event:",e,r),void 0!==e&&e.dispatchEvent(r)}var H,Q,$={display:"flex",flexDirection:"column",alignItems:"flex-start",paddingTop:"base.spacing.x4"},ee={fontWeight:"base.text.caption.small.bold.fontWeight",borderColor:"base.color.translucent.emphasis.1000",borderStyle:"solid",borderWidth:"base.border.size.200"},te={fontWeight:"base.text.caption.small.bold.fontWeight"},ne=function(e,t){return{paddingRight:"base.spacing.x1",width:"22px",fill:t?e:"base.color.brand.4"}},re={paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},ae=(H={},(0,J.Z)(H,g.a_.IMTBL_ZKEVM_DEVNET,"base.color.text.link.primary"),(0,J.Z)(H,g.a_.IMTBL_ZKEVM_TESTNET,"base.color.text.link.primary"),(0,J.Z)(H,g.a_.IMTBL_ZKEVM_MAINNET,"base.color.text.link.primary"),(0,J.Z)(H,g.a_.ETHEREUM,"base.color.accent.5"),(0,J.Z)(H,g.a_.SEPOLIA,"base.color.accent.5"),H),ie=(Q={},(0,J.Z)(Q,g.a_.IMTBL_ZKEVM_DEVNET,"Immutable"),(0,J.Z)(Q,g.a_.IMTBL_ZKEVM_MAINNET,"Immutable"),(0,J.Z)(Q,g.a_.IMTBL_ZKEVM_TESTNET,"Immutable"),(0,J.Z)(Q,g.a_.ETHEREUM,"EthToken"),(0,J.Z)(Q,g.a_.SEPOLIA,"EthToken"),Q);function oe(e){var t=e.setBalancesLoading,n=(0,d.useContext)(W.R4),r=n.connectLoaderState,a=n.connectLoaderDispatch,i=(0,d.useContext)(P.yh).eventTargetState.eventTarget,o=r.checkout,s=r.provider,c=(0,d.useContext)(S.A7).viewDispatch,l=(0,d.useContext)(C),u=l.walletState,v=l.walletDispatch,E=I.f.views[A.J.WALLET_BALANCES].networkStatus,m=u.network,k=(0,d.useState)([]),w=(0,x.Z)(k,2),L=w[0],T=w[1],y=(0,d.useCallback)(function(){var e=(0,h.Z)((0,f.Z)().mark((function e(n){var r;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o&&s&&m&&m.chainId!==n){e.next=2;break}return e.abrupt("return");case 2:return t(!0),e.prev=3,e.next=6,o.switchNetwork({provider:s,chainId:n});case 6:r=e.sent,a({payload:{type:W.V1.SET_PROVIDER,provider:r.provider}}),v({payload:{type:b.SET_NETWORK,network:r.network}}),Y(i,r.provider,r.network),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(3),t(!1),"USER_REJECTED_REQUEST_ERROR"===e.t0.type||c({payload:{type:S.Cp.UPDATE_VIEW,view:{type:S.cZ.ERROR_VIEW,error:e.t0}}});case 16:case"end":return e.stop()}}),e,null,[[3,12]])})));return function(t){return e.apply(this,arguments)}}(),[o,s,m,v,c]);return(0,d.useEffect)((function(){(0,h.Z)((0,f.Z)().mark((function e(){var t,n;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o){e.next=7;break}return e.next=3,o.getNetworkAllowList({type:g.aF.ALL});case 3:n=e.sent,T(null!==(t=null===n||void 0===n?void 0:n.networks)&&void 0!==t?t:[]),e.next=8;break;case 7:T([]);case 8:case"end":return e.stop()}}),e)})))()}),[o]),(0,O.jsxs)(p.xu,{testId:"network-menu",sx:$,children:[(0,O.jsx)(p.uT,{testId:"network-heading",size:"medium",sx:re,children:E.heading}),(0,O.jsx)(p.AG,{children:o&&(null===L||void 0===L?void 0:L.sort((function(e,t){return(0,D.kc)(e,t,o.config)})).map((function(e){return(0,O.jsxs)(p.AG.Button,{testId:"".concat(e.name,"-network-button"),sx:e.chainId===(null===m||void 0===m?void 0:m.chainId)?ee:te,size:"small",onClick:function(){return y(e.chainId)},children:[(0,O.jsx)(p.zx.Icon,{icon:ie[e.chainId],iconVariant:"bold",sx:ne(ae[e.chainId],e.chainId===(null===m||void 0===m?void 0:m.chainId))}),e.name]},e.chainId)})))})]})}var se={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x2",flex:1},ce={backgroundColor:"base.color.neutral.800",paddingX:"base.spacing.x1",borderRadius:"base.borderRadius.x6",flex:1},le={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},de=function(e,t){var n=460;return e&&(n-=104),t&&(n-=98),{height:"".concat(n,"px"),overflowY:"auto",borderRadius:"base.borderRadius.x6"}},ue=n(47618),pe=n(70123),fe=function(e,t,n){return n?"".concat(e.toString(),"-").concat(t.toLowerCase(),"-").concat(n.toLowerCase()):"".concat(e.toString(),"-").concat(t.toLowerCase())},he=function(){var e=(0,h.Z)((0,f.Z)().mark((function e(t,n,r,a){var i,o,s,c;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&n&&r){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,n.getSigner().getAddress();case 4:return i=e.sent,e.next=7,(0,pe.X)((function(){return t.getAllBalances({provider:n,walletAddress:i,chainId:r})}),G.NA);case 7:return o=e.sent,s=(0,D.Dq)(t.config,o.balances,r),c=[],s.forEach((function(e){c.push({id:fe(r,e.token.symbol,e.token.address),balance:e.formattedBalance,fiatAmount:(0,D.yY)(e.formattedBalance,e.token.symbol,a),symbol:e.token.symbol,address:e.token.address,description:e.token.name})})),e.abrupt("return",c);case 12:case"end":return e.stop()}}),e)})));return function(t,n,r,a){return e.apply(this,arguments)}}(),xe=function(){var e=(0,h.Z)((0,f.Z)().mark((function e(t,n){var r,a;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getTokenAllowList({type:g.Zs.ALL,chainId:n});case 2:return r=e.sent,a=new Set,r.tokens.forEach((function(e){a.add(e.symbol)})),e.abrupt("return",Array.from(a));case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),ve=n(52889);function Ee(){var e=(0,d.useContext)(W.R4).connectLoaderState,t=e.checkout,n=e.provider,r=(0,d.useContext)(ue.FJ),a=r.cryptoFiatState,i=r.cryptoFiatDispatch,o=(0,d.useContext)(C),s=o.walletState,c=o.walletDispatch,l=(0,d.useContext)(P.yh).eventTargetState.eventTarget,u=(0,d.useContext)(S.A7).viewDispatch,E=(0,d.useState)(0),m=(0,x.Z)(E,2),k=m[0],j=m[1],Z=I.f.views[A.J.WALLET_BALANCES].header,_=s.network,R=s.supportedTopUps,U=s.tokenBalances,V=a.conversions,z=(0,d.useState)(!0),K=(0,x.Z)(z,2),J=K[0],Y=K[1],H=(0,d.useState)(!1),Q=(0,x.Z)(H,2),$=Q[0],ee=Q[1],te=(0,d.useState)(""),ne=(0,x.Z)(te,2),re=ne[0],ae=ne[1],ie=(0,d.useState)(!1),pe=(0,x.Z)(ie,2),fe=pe[0],Ee=pe[1],me=!(0,F.T)(n);(0,d.useEffect)((function(){(0,h.Z)((0,f.Z)().mark((function e(){var n;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:if(i){e.next=4;break}return e.abrupt("return");case 4:if(_){e.next=6;break}return e.abrupt("return");case 6:return e.next=8,xe(t,_.chainId);case 8:n=e.sent,i({payload:{type:ue.rj.SET_TOKEN_SYMBOLS,tokenSymbols:n}});case 10:case"end":return e.stop()}}),e)})))()}),[t,i,_]),(0,d.useEffect)((function(){var e=function(){var e=(0,h.Z)((0,f.Z)().mark((function e(){return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=2;break}return e.abrupt("return");case 2:return e.t0=ae,e.next=5,n.getSigner().getAddress();case 5:e.t1=e.sent,(0,e.t0)(e.t1);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[n]),(0,d.useEffect)((function(){var e=0;U.forEach((function(t){var n=parseFloat(t.fiatAmount);Number.isNaN(n)||(e+=n)})),j(e)}),[U]),(0,d.useEffect)((function(){var e=function(){var e=(0,h.Z)((0,f.Z)().mark((function e(){var n,r,a;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:if(_){e.next=4;break}return e.abrupt("return");case 4:if(_.chainId===(0,M.Tz)(t.config)){e.next=6;break}return e.abrupt("return");case 6:if(n=U.find((function(e){return(0,D.Mg)(e.address)&&e.symbol===G.ar}))){e.next=9;break}return e.abrupt("return");case 9:if(n.balance!==G.q1){e.next=12;break}return Ee(!0),e.abrupt("return");case 12:return e.prev=12,e.next=15,t.gasEstimate({gasEstimateType:g.IW.BRIDGE_TO_L2,isSpendingCapApprovalRequired:!1});case 15:if(r=e.sent,(a=r.gasFee).estimatedAmount){e.next=20;break}return Ee(!1),e.abrupt("return");case 20:Ee(a.estimatedAmount.gt(w.parseUnits(n.balance,G.vr))),e.next=26;break;case 23:e.prev=23,e.t0=e.catch(12),Ee(!1);case 26:case"end":return e.stop()}}),e,null,[[12,23]])})));return function(){return e.apply(this,arguments)}}();e()}),[U,t,_]);var be=(0,d.useCallback)((function(){u({payload:{type:S.Cp.UPDATE_VIEW,view:{type:S.cZ.ERROR_VIEW,error:new Error("Unable to fetch balances")}}})}),[u]);(0,d.useEffect)((function(){t&&n&&_&&V&&(V.size<=0||(0,h.Z)((0,f.Z)().mark((function e(){var r;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[],e.prev=1,e.next=4,he(t,n,_.chainId,V);case 4:r=e.sent,e.next=12;break;case 7:if(e.prev=7,e.t0=e.catch(1),!G.NA.nonRetryable(e.t0)){e.next=12;break}return be(),e.abrupt("return");case 12:c({payload:{type:b.SET_TOKEN_BALANCES,tokenBalances:r}}),Y(!1);case 14:case"end":return e.stop()}}),e,null,[[1,7]])})))())}),[t,n,_,V]);var Ce=(0,d.useMemo)((function(){return!(!t||!_)&&(_.chainId===(0,M.D3)(t.config)&&Boolean((null===R||void 0===R?void 0:R.isBridgeEnabled)||(null===R||void 0===R?void 0:R.isSwapEnabled)||(null===R||void 0===R?void 0:R.isOnRampEnabled)))}),[t,_,R]);return(0,O.jsx)(y.X,{testId:"wallet-balances",header:(0,O.jsx)(T.F,{title:Z.title,showSettings:!0,onSettingsClick:function(){u({payload:{type:S.Cp.UPDATE_VIEW,view:{type:A.J.SETTINGS}}})},onCloseButtonClick:function(){return X(l)}}),footer:(0,O.jsx)(L.w,{}),children:(0,O.jsxs)(p.xu,{sx:se,children:[(0,O.jsxs)(p.xu,{sx:ce,children:[me&&(0,O.jsx)(oe,{setBalancesLoading:Y}),(0,O.jsx)(N,{totalBalance:k,loading:J}),(0,O.jsxs)(p.xu,{sx:de(me,Ce),children:[J&&(0,O.jsxs)(p.xu,{sx:le,children:[(0,O.jsx)(p.sN,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),(0,O.jsx)(p.sN,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),(0,O.jsx)(p.sN,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!J&&(0,O.jsx)(q,{balanceInfoItems:U,bridgeToL2OnClick:function(e){fe?ee(!0):B.B.sendRequestBridgeEvent(l,v.O6.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:null!==e&&void 0!==e?e:"",amount:""})}})]})]}),Ce&&(0,O.jsxs)(p.sN,{testId:"add-coins",emphasized:!0,onClick:function(){u({payload:{type:S.Cp.UPDATE_VIEW,view:{type:S.cZ.TOP_UP_VIEW}}})},children:[(0,O.jsx)(p.sN.FramedIcon,{icon:"Add"}),(0,O.jsx)(p.sN.Label,{children:"Add coins"})]}),(0,O.jsx)(ve.u,{visible:$,showHeaderBar:!1,onCloseBottomSheet:function(){return ee(!1)},walletAddress:re,showAdjustAmount:!1})]})})}var me=n(74),be=n(33939),Ce=n(46207),ke={width:"100%",height:"88px",display:"flex",flexDirection:"row",justifyContent:"space-between",padding:"24px 11px 24px 32px",backgroundColor:"base.color.translucent.emphasis.400",borderRadius:"base.borderRadius.x6"},ge={width:"100%",display:"flex"},we={width:"318px",display:"flex",flexDirection:"column"},Le={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Te={background:"base.color.status.success.bright",fill:"base.color.status.success.bright"};function ye(e){var t=e.textToCopy,n=(0,d.useState)(!1),r=(0,x.Z)(n,2),a=r[0],i=r[1];return(0,O.jsx)(p.xu,{children:t&&(0,O.jsx)(p.xu,{sx:{cursor:"pointer"},children:(0,O.jsx)(p.iv,{sx:a?Te:{},onClick:function(){null!=t&&navigator.clipboard.writeText(t),i(!0),setTimeout((function(){i(!1)}),3e3)},size:"small",icon:a?"Tick":"CopyText"})})})}function Ie(e){var t=e.provider,n=(0,d.useState)(""),r=(0,x.Z)(n,2),a=r[0],i=r[1];return(0,d.useEffect)((function(){t&&(0,h.Z)((0,f.Z)().mark((function e(){var n;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getSigner().getAddress();case 2:n=e.sent,i(n);case 4:case"end":return e.stop()}}),e)})))()}),[t]),(0,O.jsx)(p.xu,{sx:ke,children:(0,O.jsxs)(p.xu,{sx:ge,children:[(0,O.jsxs)(p.xu,{sx:we,children:[(0,O.jsx)(p.X6,{size:"xSmall",children:"Wallet address"}),(0,O.jsx)(p.uT,{testId:"wallet-address",size:"xSmall",sx:Le,children:a})]}),(0,O.jsx)(ye,{textToCopy:a})]})})}var je={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",marginX:"base.spacing.x2"},Ze={marginTop:"32px"};function _e(){var e=(0,d.useContext)(W.R4).connectLoaderState.provider,t=I.f.views[A.J.SETTINGS],n=t.header,r=t.disconnectButton,a=(0,d.useContext)(P.yh).eventTargetState.eventTarget,i=(0,F.T)(e);return(0,O.jsx)(y.X,{testId:"wallet-balances",header:(0,O.jsx)(T.F,{showBack:!0,title:n.title,onCloseButtonClick:function(){return X(a)}}),footer:(0,O.jsx)(L.w,{}),children:(0,O.jsxs)(p.xu,{sx:je,children:[(0,O.jsx)(Ie,{provider:e}),i&&(0,O.jsx)(p.zx,{testId:"disconnect-button",variant:"secondary",sx:Ze,onClick:function(){return function(e){var t=new CustomEvent(v.O6.IMTBL_WALLET_WIDGET_EVENT,{detail:{type:v.f2.DISCONNECT_WALLET,data:{}}});console.log("disconnect wallet event:",e,t),void 0!==e&&e.dispatchEvent(t)}(a)},children:r.label})]})})}var Se,Ae,Oe,Ne,Re,Be,Me,De,We,Fe,Pe,Ue,Ve,ze,Ge,Ke,qe,Je,Xe,Ye,He,Qe,$e,et,tt,nt,rt,at,it,ot,st,ct,lt,dt,ut,pt,ft,ht,xt,vt,Et,mt,bt,Ct,kt=n(57367),gt=["title","titleId"];function wt(){return wt=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},wt.apply(this,arguments)}function Lt(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Tt(e,t){var n=e.title,r=e.titleId,a=Lt(e,gt);return d.createElement("svg",wt({width:430,height:211,viewBox:"0 0 430 211",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:t,"aria-labelledby":r},a),n?d.createElement("title",{id:r},n):null,Se||(Se=d.createElement("path",{d:"M213 120C132.857 120 65.7181 139.009 1 175.641V211H431V178.515C365.165 140.107 295.216 120 213 120Z",fill:"url(#paint0_linear_4525_125520)"})),Ae||(Ae=d.createElement("path",{d:"M428.5 210.5H383C383 123 114 113.5 236 120.5C333.6 126.1 405 163.833 428.5 182V210.5Z",fill:"#2D0034",fillOpacity:.2})),Oe||(Oe=d.createElement("path",{d:"M131.005 34.0566L130.576 32.4244L128.944 32.8537L129.373 34.4858L131.005 34.0566Z",fill:"white"})),Ne||(Ne=d.createElement("path",{d:"M77.1152 45.7678L76.5627 43.6667L74.4617 44.2193L75.0142 46.3203L77.1152 45.7678Z",fill:"white"})),Re||(Re=d.createElement("path",{d:"M264.238 30.1945L262.093 29.8494L261.748 31.9942L263.893 32.3394L264.238 30.1945Z",fill:"white"})),Be||(Be=d.createElement("path",{d:"M348.157 2.3323L348.776 1.04626L347.49 0.427149L346.871 1.71319L348.157 2.3323Z",fill:"white"})),Me||(Me=d.createElement("path",{d:"M342.606 56.5062L342.054 54.4052L339.953 54.9577L340.505 57.0587L342.606 56.5062Z",fill:"white"})),De||(De=d.createElement("path",{d:"M348.381 55.0847L349 53.7986L347.714 53.1795L347.095 54.4656L348.381 55.0847Z",fill:"white"})),We||(We=d.createElement("path",{d:"M107.606 18.8096L106.681 17.7229L105.594 18.6483L106.52 19.735L107.606 18.8096Z",fill:"white"})),Fe||(Fe=d.createElement("path",{d:"M233.14 2.3323L233.759 1.04626L232.473 0.427149L231.854 1.71319L233.14 2.3323Z",fill:"white"})),Pe||(Pe=d.createElement("path",{d:"M2.97844e-07 176.149C62.5366 139.802 135.143 119 212.584 119C292.029 119 366.384 140.892 430 179",stroke:"black"})),Ue||(Ue=d.createElement("path",{d:"M70.97 142.773C76.3142 146.15 87.6289 137.839 96.242 124.208C104.855 110.578 107.505 96.7911 102.161 93.414C96.8167 90.037 85.5021 98.3487 76.889 111.979C68.2758 125.609 65.6258 139.396 70.97 142.773Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Ve||(Ve=d.createElement("path",{d:"M76.8602 112.001C79.353 108.055 82.0686 104.564 84.8088 101.664L94.3989 126.977C86.0698 138.949 75.925 145.933 70.9515 142.793C65.6033 139.413 68.2536 125.631 76.8692 111.994L76.8602 112.001Z",fill:"black"})),ze||(ze=d.createElement("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Ge||(Ge=d.createElement("path",{d:"M98.2141 120.884C99.3274 118.901 100.309 116.925 101.153 115.003L108.025 119.342C107.181 121.264 106.2 123.233 105.085 125.224L98.2141 120.884Z",fill:"#F191FA"})),Ke||(Ke=d.createElement("path",{d:"M102.311 112.191C104.156 107.325 105.052 102.898 104.877 99.4899L111.748 103.829C111.923 107.238 111.035 111.665 109.182 116.531L102.311 112.191Z",fill:"black"})),qe||(qe=d.createElement("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Je||(Je=d.createElement("path",{d:"M341.833 142.899C353.278 131.542 356.039 115.768 348 107.668C339.962 99.5669 324.167 102.207 312.723 113.564C301.278 124.921 298.517 140.695 306.555 148.795C314.594 156.896 330.388 154.256 341.833 142.899Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Xe||(Xe=d.createElement("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Ye||(Ye=d.createElement("path",{d:"M344.451 139.969C345.913 138.216 347.189 136.39 348.264 134.524L352.416 138.709C351.341 140.575 350.065 142.4 348.603 144.153L344.451 139.969Z",fill:"#D8EFF4"})),He||(He=d.createElement("path",{d:"M349.72 131.746C352.022 126.818 352.967 121.785 352.442 117.302L356.594 121.486C357.119 125.97 356.174 131.002 353.872 135.93L349.72 131.746Z",fill:"black"})),Qe||(Qe=d.createElement("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),$e||($e=d.createElement("path",{d:"M155.769 157.057C169.703 165.169 185.654 163.751 191.396 153.888C197.138 144.026 190.497 129.454 176.563 121.342C162.629 113.229 146.679 114.648 140.937 124.51C135.195 134.373 141.836 148.944 155.769 157.057Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),et||(et=d.createElement("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),tt||(tt=d.createElement("path",{d:"M159.278 158.826C161.349 159.785 163.443 160.544 165.524 161.099L162.558 166.193C160.477 165.639 158.383 164.879 156.311 163.921L159.278 158.826Z",fill:"#D8EFF4"})),nt||(nt=d.createElement("path",{d:"M168.585 161.786C173.941 162.733 179.047 162.342 183.241 160.674L180.275 165.768C176.08 167.436 170.975 167.827 165.619 166.88L168.585 161.786Z",fill:"black"})),rt||(rt=d.createElement("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),at||(at=d.createElement("path",{d:"M234.03 133.525C249.631 129.452 260.983 121.192 259.386 115.075C257.79 108.959 243.848 107.301 228.248 111.374C212.647 115.446 201.294 123.706 202.891 129.823C204.488 135.94 218.429 137.597 234.03 133.525Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),it||(it=d.createElement("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),ot||(ot=d.createElement("path",{d:"M237.663 132.44C239.836 131.754 241.896 130.986 243.826 130.154L245.878 138.014C243.948 138.838 241.888 139.606 239.715 140.3L237.663 132.44Z",fill:"#F191FA"})),st||(st=d.createElement("path",{d:"M246.588 128.896C251.257 126.601 254.941 123.976 257.13 121.367L259.182 129.227C256.985 131.836 253.309 134.461 248.64 136.756L246.588 128.896Z",fill:"black"})),ct||(ct=d.createElement("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),lt||(lt=d.createElement("path",{d:"M189.995 60.1335C175.063 54.0502 161.025 53.8648 158.64 59.7194C156.255 65.5739 166.426 75.2515 181.358 81.3348C196.29 87.418 210.328 87.6034 212.713 81.7488C215.098 75.8943 204.927 66.2167 189.995 60.1335Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),dt||(dt=d.createElement("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),ut||(ut=d.createElement("path",{d:"M185.032 82.6694C187.186 83.4191 189.294 84.0389 191.339 84.5366L188.275 92.0629C186.23 91.5652 184.122 90.9454 181.968 90.1957L185.032 82.6694Z",fill:"#96DAF4"})),pt||(pt=d.createElement("path",{d:"M194.301 85.1776C199.418 86.1391 203.932 86.2438 207.256 85.4671L204.192 92.9934C200.868 93.762 196.353 93.6654 191.237 92.7038L194.301 85.1776Z",fill:"black"})),ft||(ft=d.createElement("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),ht||(ht=d.createElement("path",{d:"M331.022 121.427C326.722 126.062 313.654 120.93 301.833 109.965C290.012 99 283.915 86.3538 288.214 81.719C292.513 77.0841 305.581 82.2158 317.402 93.1808C329.223 104.146 335.321 116.792 331.022 121.427Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),xt||(xt=d.createElement("path",{d:"M317.436 93.1948C314.014 90.0206 310.494 87.3431 307.102 85.2426L304.325 112.168C315.446 121.604 327.043 125.752 331.044 121.441C335.347 116.803 329.25 104.162 317.425 93.1905L317.436 93.1948Z",fill:"black"})),vt||(vt=d.createElement("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Et||(Et=d.createElement("path",{d:"M299.075 107.258C297.49 105.627 296.034 103.969 294.725 102.327L289.197 108.284C290.506 109.926 291.959 111.577 293.546 113.215L299.075 107.258Z",fill:"#F191FA"})),mt||(mt=d.createElement("path",{d:"M292.885 99.9066C289.854 95.6761 287.853 91.6272 287.147 88.2883L281.619 94.2451C282.324 97.584 284.318 101.636 287.357 105.863L292.885 99.9066Z",fill:"black"})),bt||(bt=d.createElement("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})),Ct||(Ct=d.createElement("defs",null,d.createElement("linearGradient",{id:"paint0_linear_4525_125520",x1:191,y1:124.403,x2:247.716,y2:304.676,gradientUnits:"userSpaceOnUse"},d.createElement("stop",{stopColor:"#AD48BA"}),d.createElement("stop",{offset:.65625,stopColor:"#D178FF",stopOpacity:.24})))))}var yt=d.forwardRef(Tt),It=(n.p,n(6609));function jt(){return(0,O.jsx)(p.xu,{sx:(0,E.Z)((0,E.Z)({},It.q_),{},{background:"base.color.translucent.emphasis.100"}),children:(0,O.jsx)(p.xu,{sx:(0,E.Z)((0,E.Z)({},It.Tb),It.iz),children:(0,O.jsx)(yt,{})})})}function Zt(){var e=(0,d.useContext)(W.R4).connectLoaderState.provider,t=I.f.views[A.J.COIN_INFO],n=(0,F.T)(e),r=t.metamask,a=r.heading,i=r.body,o=t.passport,s=o.heading,c=o.body1,l=o.body2,u=o.linkText;return(0,O.jsxs)(y.X,{testId:"coin-info",header:(0,O.jsx)(T.F,{showBack:!0,transparent:!0}),footer:(0,O.jsx)(L.w,{}),heroContent:(0,O.jsx)(jt,{}),floatHeader:!0,children:[!n&&(0,O.jsx)(kt.b,{heading:a,children:i}),n&&(0,O.jsxs)(kt.b,{heading:s,children:[c,(0,O.jsx)(p.rU,{onClick:function(){return window.open(G.Yk)},children:u}),l]})]})}var _t=n(1138),St=n(48543);function At(e){var t=I.f.views[S.cZ.ERROR_VIEW].actionText,n=I.f.views[S.cZ.LOADING_VIEW].text,r=(0,d.useContext)(P.yh).eventTargetState.eventTarget,a=e.config,i=a.environment,o=a.theme,s=a.isOnRampEnabled,c=a.isSwapEnabled,l=a.isBridgeEnabled,u=(0,d.useContext)(W.R4).connectLoaderState,E=u.checkout,g=u.provider,w=(0,d.useReducer)(S.Uy,S.NW),L=(0,x.Z)(w,2),T=L[0],y=L[1],j=(0,d.useReducer)(k,m),Z=(0,x.Z)(j,2),_=Z[0],N=Z[1],R=(0,d.useMemo)((function(){return{walletState:_,walletDispatch:N}}),[_,N]),B=(0,d.useMemo)((function(){return{viewState:T,viewDispatch:y}}),[T,y]),M=(0,d.useMemo)((function(){return(0,St.e)(o)}),[o]);(0,d.useEffect)((function(){N({payload:{type:b.SET_SUPPORTED_TOP_UPS,supportedTopUps:{isBridgeEnabled:l,isSwapEnabled:c,isOnRampEnabled:s}}})}),[l,c,s,i]);var D=function(){var e=(0,h.Z)((0,f.Z)().mark((function e(){var t;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(E&&g){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,E.getNetworkInfo({provider:g});case 5:if((t=e.sent).isSupported){e.next=8;break}return e.abrupt("return");case 8:N({payload:{type:b.SET_NETWORK,network:t}}),y({payload:{type:S.Cp.UPDATE_VIEW,view:{type:A.J.WALLET_BALANCES}}}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),y({payload:{type:S.Cp.UPDATE_VIEW,view:{type:S.cZ.ERROR_VIEW,error:e.t0}}});case 15:case"end":return e.stop()}}),e,null,[[2,12]])})));return function(){return e.apply(this,arguments)}}();(0,d.useEffect)((function(){E&&g&&(0,h.Z)((0,f.Z)().mark((function e(){return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:D();case 1:case"end":return e.stop()}}),e)})))()}),[E,g]);var F=function(){var e=(0,h.Z)((0,f.Z)().mark((function e(){return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return y({payload:{type:S.Cp.UPDATE_VIEW,view:{type:A.J.WALLET_BALANCES}}}),e.next=3,D();case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,O.jsx)(p.mD,{theme:{base:M},children:(0,O.jsx)(S.A7.Provider,{value:B,children:(0,O.jsx)(Ce.e,{environment:i,children:(0,O.jsxs)(C.Provider,{value:R,children:[T.view.type===S.cZ.LOADING_VIEW&&(0,O.jsx)(be.J,{loadingText:n}),T.view.type===A.J.WALLET_BALANCES&&(0,O.jsx)(Ee,{}),T.view.type===A.J.SETTINGS&&(0,O.jsx)(_e,{}),T.view.type===A.J.COIN_INFO&&(0,O.jsx)(Zt,{}),T.view.type===S.cZ.ERROR_VIEW&&(0,O.jsx)(me.o,{actionText:t,onActionClick:F,onCloseClick:function(){return X(r)}}),T.view.type===S.cZ.TOP_UP_VIEW&&(0,O.jsx)(_t.t,{widgetEvent:v.O6.IMTBL_WALLET_WIDGET_EVENT,showOnrampOption:s,showSwapOption:c,showBridgeOption:l,onCloseButtonClick:function(){return X(r)}})]})})})})}var Ot=n(79394),Nt=n(73966),Rt=n(29601),Bt=n(95110),Mt=function(e){(0,c.Z)(n,e);var t=(0,l.Z)(n);function n(){var e;(0,a.Z)(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return(e=t.call.apply(t,[this].concat(i))).walletProvider=void 0,e}return(0,i.Z)(n,[{key:"connectedCallback",value:function(){var e;(0,o.Z)((0,s.Z)(n.prototype),"connectedCallback",this).call(this),this.walletProvider=null===(e=this.getAttribute("walletProvider"))||void 0===e?void 0:e.toLowerCase(),this.renderWidget()}},{key:"attributeChangedCallback",value:function(e,t,r){(0,o.Z)((0,s.Z)(n.prototype),"attributeChangedCallback",this).call(this,e,t,r),"walletprovider"===e&&(this.walletProvider=r.toLowerCase()),this.renderWidget()}},{key:"validateInputs",value:function(){(0,Rt.Qh)(this.walletProvider)||(console.warn('[IMTBL]: invalid "walletProvider" widget input'),this.walletProvider=void 0)}},{key:"renderWidget",value:function(){this.validateInputs();var e={targetLayer:G.PU.LAYER2,walletProvider:this.walletProvider,web3Provider:this.provider,passport:this.passport,allowedChains:[(0,G.Tz)(this.checkout.config),(0,G.D3)(this.checkout.config)]};this.reactRoot||(this.reactRoot=u.createRoot(this)),this.reactRoot.render((0,O.jsx)(d.StrictMode,{children:(0,O.jsx)(p.jU,{children:(0,O.jsx)(Bt.$,{widgetConfig:this.widgetConfig,children:(0,O.jsx)(Ot.X,{widgetConfig:this.widgetConfig,params:e,closeEvent:function(){return X(window)},children:(0,O.jsx)(At,{config:this.widgetConfig})})})})}))}}],[{key:"observedAttributes",get:function(){var e=(0,o.Z)((0,s.Z)(n),"observedAttributes",this);return[].concat((0,r.Z)(e),["walletprovider"])}}]),n}(Nt.D)}}]);