diff --git a/assets/DailyMotion-DLTLhg3q.js b/assets/DailyMotion-CPDTQONs.js similarity index 97% rename from assets/DailyMotion-DLTLhg3q.js rename to assets/DailyMotion-CPDTQONs.js index 3ceec87fb0..59bc0ee499 100644 --- a/assets/DailyMotion-DLTLhg3q.js +++ b/assets/DailyMotion-CPDTQONs.js @@ -1 +1 @@ -import{g as P,r as v,u as D,p as O}from"./index-Cb9cdkBC.js";function b(t,e){for(var r=0;ro[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,s=Object.defineProperty,w=Object.getOwnPropertyDescriptor,S=Object.getOwnPropertyNames,j=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,E=(t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of S(e))!T.call(t,a)&&a!==r&&s(t,a,{get:()=>e[a],enumerable:!(o=w(e,a))||o.enumerable});return t},L=(t,e,r)=>(r=t!=null?M(j(t)):{},h(!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t)),C=t=>h(s({},"__esModule",{value:!0}),t),n=(t,e,r)=>(E(t,typeof e!="symbol"?e+"":e,r),r),d={};A(d,{default:()=>p});var _=C(d),c=L(v),l=D,f=O;const N="https://api.dmcdn.net/all.js",x="DM",K="dmAsyncInit";class p extends c.Component{constructor(){super(...arguments),n(this,"callPlayer",l.callPlayer),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.callPlayer("setMuted",!0)}),n(this,"unmute",()=>{this.callPlayer("setMuted",!1)}),n(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{controls:r,config:o,onError:a,playing:i}=this.props,[,y]=e.match(f.MATCH_URL_DAILYMOTION);if(this.player){this.player.load(y,{start:(0,l.parseStartTime)(e),autoplay:i});return}(0,l.getSDK)(N,x,K,u=>u.player).then(u=>{if(!this.container)return;const g=u.player;this.player=new g(this.container,{width:"100%",height:"100%",video:y,params:{controls:r,autoplay:this.props.playing,mute:this.props.muted,start:(0,l.parseStartTime)(e),origin:window.location.origin,...o.params},events:{apiready:this.props.onReady,seeked:()=>this.props.onSeek(this.player.currentTime),video_end:this.props.onEnded,durationchange:this.onDurationChange,pause:this.props.onPause,playing:this.props.onPlay,waiting:this.props.onBuffer,error:m=>a(m)}})},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.player.duration||null}getCurrentTime(){return this.player.currentTime}getSecondsLoaded(){return this.player.bufferedTime}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}n(p,"displayName","DailyMotion");n(p,"canPlay",f.canPlay.dailymotion);n(p,"loopOnEnded",!0);const R=P(_),I=b({__proto__:null,default:R},[_]);export{I as D}; +import{g as P,r as v,u as D,p as O}from"./index-3lltu53p.js";function b(t,e){for(var r=0;ro[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,s=Object.defineProperty,w=Object.getOwnPropertyDescriptor,S=Object.getOwnPropertyNames,j=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,E=(t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of S(e))!T.call(t,a)&&a!==r&&s(t,a,{get:()=>e[a],enumerable:!(o=w(e,a))||o.enumerable});return t},L=(t,e,r)=>(r=t!=null?M(j(t)):{},h(!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t)),C=t=>h(s({},"__esModule",{value:!0}),t),n=(t,e,r)=>(E(t,typeof e!="symbol"?e+"":e,r),r),d={};A(d,{default:()=>p});var _=C(d),c=L(v),l=D,f=O;const N="https://api.dmcdn.net/all.js",x="DM",K="dmAsyncInit";class p extends c.Component{constructor(){super(...arguments),n(this,"callPlayer",l.callPlayer),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.callPlayer("setMuted",!0)}),n(this,"unmute",()=>{this.callPlayer("setMuted",!1)}),n(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{controls:r,config:o,onError:a,playing:i}=this.props,[,y]=e.match(f.MATCH_URL_DAILYMOTION);if(this.player){this.player.load(y,{start:(0,l.parseStartTime)(e),autoplay:i});return}(0,l.getSDK)(N,x,K,u=>u.player).then(u=>{if(!this.container)return;const g=u.player;this.player=new g(this.container,{width:"100%",height:"100%",video:y,params:{controls:r,autoplay:this.props.playing,mute:this.props.muted,start:(0,l.parseStartTime)(e),origin:window.location.origin,...o.params},events:{apiready:this.props.onReady,seeked:()=>this.props.onSeek(this.player.currentTime),video_end:this.props.onEnded,durationchange:this.onDurationChange,pause:this.props.onPause,playing:this.props.onPlay,waiting:this.props.onBuffer,error:m=>a(m)}})},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.player.duration||null}getCurrentTime(){return this.player.currentTime}getSecondsLoaded(){return this.player.bufferedTime}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}n(p,"displayName","DailyMotion");n(p,"canPlay",f.canPlay.dailymotion);n(p,"loopOnEnded",!0);const R=P(_),I=b({__proto__:null,default:R},[_]);export{I as D}; diff --git a/assets/Facebook-DC1yVOyL.js b/assets/Facebook-vIG5NxSv.js similarity index 98% rename from assets/Facebook-DC1yVOyL.js rename to assets/Facebook-vIG5NxSv.js index 9ccd975025..4b322aabe3 100644 --- a/assets/Facebook-DC1yVOyL.js +++ b/assets/Facebook-vIG5NxSv.js @@ -1 +1 @@ -import{g as _,r as g,u as P,p as m}from"./index-Cb9cdkBC.js";function v(t,e){for(var r=0;ra[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var O=Object.create,i=Object.defineProperty,D=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,I=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!j.call(t,s)&&s!==r&&i(t,s,{get:()=>e[s],enumerable:!(a=D(e,s))||a.enumerable});return t},w=(t,e,r)=>(r=t!=null?O(S(t)):{},h(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),F=t=>h(i({},"__esModule",{value:!0}),t),o=(t,e,r)=>(I(t,typeof e!="symbol"?e+"":e,r),r),b={};k(b,{default:()=>l});var d=F(b),u=w(g),n=P,x=m;const c="https://connect.facebook.net/en_US/sdk.js",y="FB",f="fbAsyncInit",L="facebook-player-";class l extends u.Component{constructor(){super(...arguments),o(this,"callPlayer",n.callPlayer),o(this,"playerID",this.props.config.playerId||`${L}${(0,n.randomString)()}`),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){if(r){(0,n.getSDK)(c,y,f).then(a=>a.XFBML.parse());return}(0,n.getSDK)(c,y,f).then(a=>{a.init({appId:this.props.config.appId,xfbml:!0,version:this.props.config.version}),a.Event.subscribe("xfbml.render",s=>{this.props.onLoaded()}),a.Event.subscribe("xfbml.ready",s=>{s.type==="video"&&s.id===this.playerID&&(this.player=s.instance,this.player.subscribe("startedPlaying",this.props.onPlay),this.player.subscribe("paused",this.props.onPause),this.player.subscribe("finishedPlaying",this.props.onEnded),this.player.subscribe("startedBuffering",this.props.onBuffer),this.player.subscribe("finishedBuffering",this.props.onBufferEnd),this.player.subscribe("error",this.props.onError),this.props.muted?this.callPlayer("mute"):this.callPlayer("unmute"),this.props.onReady(),document.getElementById(this.playerID).querySelector("iframe").style.visibility="visible")})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentPosition")}getSecondsLoaded(){return null}render(){const{attributes:e}=this.props.config,r={width:"100%",height:"100%"};return u.default.createElement("div",{style:r,id:this.playerID,className:"fb-video","data-href":this.props.url,"data-autoplay":this.props.playing?"true":"false","data-allowfullscreen":"true","data-controls":this.props.controls?"true":"false",...e})}}o(l,"displayName","Facebook");o(l,"canPlay",x.canPlay.facebook);o(l,"loopOnEnded",!0);const M=_(d),B=v({__proto__:null,default:M},[d]);export{B as F}; +import{g as _,r as g,u as P,p as m}from"./index-3lltu53p.js";function v(t,e){for(var r=0;ra[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var O=Object.create,i=Object.defineProperty,D=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,I=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!j.call(t,s)&&s!==r&&i(t,s,{get:()=>e[s],enumerable:!(a=D(e,s))||a.enumerable});return t},w=(t,e,r)=>(r=t!=null?O(S(t)):{},h(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),F=t=>h(i({},"__esModule",{value:!0}),t),o=(t,e,r)=>(I(t,typeof e!="symbol"?e+"":e,r),r),b={};k(b,{default:()=>l});var d=F(b),u=w(g),n=P,x=m;const c="https://connect.facebook.net/en_US/sdk.js",y="FB",f="fbAsyncInit",L="facebook-player-";class l extends u.Component{constructor(){super(...arguments),o(this,"callPlayer",n.callPlayer),o(this,"playerID",this.props.config.playerId||`${L}${(0,n.randomString)()}`),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){if(r){(0,n.getSDK)(c,y,f).then(a=>a.XFBML.parse());return}(0,n.getSDK)(c,y,f).then(a=>{a.init({appId:this.props.config.appId,xfbml:!0,version:this.props.config.version}),a.Event.subscribe("xfbml.render",s=>{this.props.onLoaded()}),a.Event.subscribe("xfbml.ready",s=>{s.type==="video"&&s.id===this.playerID&&(this.player=s.instance,this.player.subscribe("startedPlaying",this.props.onPlay),this.player.subscribe("paused",this.props.onPause),this.player.subscribe("finishedPlaying",this.props.onEnded),this.player.subscribe("startedBuffering",this.props.onBuffer),this.player.subscribe("finishedBuffering",this.props.onBufferEnd),this.player.subscribe("error",this.props.onError),this.props.muted?this.callPlayer("mute"):this.callPlayer("unmute"),this.props.onReady(),document.getElementById(this.playerID).querySelector("iframe").style.visibility="visible")})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentPosition")}getSecondsLoaded(){return null}render(){const{attributes:e}=this.props.config,r={width:"100%",height:"100%"};return u.default.createElement("div",{style:r,id:this.playerID,className:"fb-video","data-href":this.props.url,"data-autoplay":this.props.playing?"true":"false","data-allowfullscreen":"true","data-controls":this.props.controls?"true":"false",...e})}}o(l,"displayName","Facebook");o(l,"canPlay",x.canPlay.facebook);o(l,"loopOnEnded",!0);const M=_(d),B=v({__proto__:null,default:M},[d]);export{B as F}; diff --git a/assets/FilePlayer-cg52dueL.js b/assets/FilePlayer-U28waXko.js similarity index 99% rename from assets/FilePlayer-cg52dueL.js rename to assets/FilePlayer-U28waXko.js index 943e44f8b5..8310c6e8ee 100644 --- a/assets/FilePlayer-cg52dueL.js +++ b/assets/FilePlayer-U28waXko.js @@ -1 +1 @@ -import{g as b,r as _,u as O,p as A}from"./index-Cb9cdkBC.js";function R(s,e){for(var t=0;ti[n]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var I=Object.create,u=Object.defineProperty,D=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,M=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,U=(s,e,t)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,N=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},E=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of w(e))!k.call(s,n)&&n!==t&&u(s,n,{get:()=>e[n],enumerable:!(i=D(e,n))||i.enumerable});return s},j=(s,e,t)=>(t=s!=null?I(M(s)):{},E(!s||!s.__esModule?u(t,"default",{value:s,enumerable:!0}):t,s)),H=s=>E(u({},"__esModule",{value:!0}),s),r=(s,e,t)=>(U(s,typeof e!="symbol"?e+"":e,t),t),m={};N(m,{default:()=>P});var g=H(m),d=j(_),a=O,c=A;const y=typeof navigator<"u",F=y&&navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,v=y&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||F)&&!window.MSStream,V=y&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!window.MSStream,T="https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js",C="Hls",B="https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js",x="dashjs",K="https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js",G="flvjs",X=/www\.dropbox\.com\/.+/,f=/https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/,W="https://videodelivery.net/{id}/manifest/video.m3u8";class P extends d.Component{constructor(){super(...arguments),r(this,"onReady",(...e)=>this.props.onReady(...e)),r(this,"onPlay",(...e)=>this.props.onPlay(...e)),r(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),r(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),r(this,"onPause",(...e)=>this.props.onPause(...e)),r(this,"onEnded",(...e)=>this.props.onEnded(...e)),r(this,"onError",(...e)=>this.props.onError(...e)),r(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),r(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),r(this,"onDisablePIP",e=>{const{onDisablePIP:t,playing:i}=this.props;t(e),i&&this.play()}),r(this,"onPresentationModeChange",e=>{if(this.player&&(0,a.supportsWebKitPresentationMode)(this.player)){const{webkitPresentationMode:t}=this.player;t==="picture-in-picture"?this.onEnablePIP(e):t==="inline"&&this.onDisablePIP(e)}}),r(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),r(this,"mute",()=>{this.player.muted=!0}),r(this,"unmute",()=>{this.player.muted=!1}),r(this,"renderSourceElement",(e,t)=>typeof e=="string"?d.default.createElement("source",{key:t,src:e}):d.default.createElement("source",{key:t,...e})),r(this,"renderTrack",(e,t)=>d.default.createElement("track",{key:t,...e})),r(this,"ref",e=>{this.player&&(this.prevPlayer=this.player),this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getSource(this.props.url);e&&(this.player.src=e),(v||this.props.config.forceDisableHls)&&this.player.load()}componentDidUpdate(e){this.shouldUseAudio(this.props)!==this.shouldUseAudio(e)&&(this.removeListeners(this.prevPlayer,e.url),this.addListeners(this.player)),this.props.url!==e.url&&!(0,a.isMediaStream)(this.props.url)&&!(this.props.url instanceof Array)&&(this.player.srcObject=null)}componentWillUnmount(){this.player.removeAttribute("src"),this.removeListeners(this.player),this.hls&&this.hls.destroy()}addListeners(e){const{url:t,playsinline:i}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.addEventListener("canplay",this.onReady),i&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""))}removeListeners(e,t){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.removeEventListener("canplay",this.onReady)}shouldUseAudio(e){return e.config.forceVideo||e.config.attributes.poster?!1:c.AUDIO_EXTENSIONS.test(e.url)||e.config.forceAudio}shouldUseHLS(e){return V&&this.props.config.forceSafariHLS||this.props.config.forceHLS?!0:v||this.props.config.forceDisableHls?!1:c.HLS_EXTENSIONS.test(e)||f.test(e)}shouldUseDASH(e){return c.DASH_EXTENSIONS.test(e)||this.props.config.forceDASH}shouldUseFLV(e){return c.FLV_EXTENSIONS.test(e)||this.props.config.forceFLV}load(e){const{hlsVersion:t,hlsOptions:i,dashVersion:n,flvVersion:l}=this.props.config;if(this.hls&&this.hls.destroy(),this.dash&&this.dash.reset(),this.shouldUseHLS(e)&&(0,a.getSDK)(T.replace("VERSION",t),C).then(o=>{if(this.hls=new o(i),this.hls.on(o.Events.MANIFEST_PARSED,()=>{this.props.onReady()}),this.hls.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.hls,o)}),f.test(e)){const h=e.match(f)[1];this.hls.loadSource(W.replace("{id}",h))}else this.hls.loadSource(e);this.hls.attachMedia(this.player),this.props.onLoaded()}),this.shouldUseDASH(e)&&(0,a.getSDK)(B.replace("VERSION",n),x).then(o=>{this.dash=o.MediaPlayer().create(),this.dash.initialize(this.player,e,this.props.playing),this.dash.on("error",this.props.onError),parseInt(n)<3?this.dash.getDebug().setLogToBrowserConsole(!1):this.dash.updateSettings({debug:{logLevel:o.Debug.LOG_LEVEL_NONE}}),this.props.onLoaded()}),this.shouldUseFLV(e)&&(0,a.getSDK)(K.replace("VERSION",l),G).then(o=>{this.flv=o.createPlayer({type:"flv",url:e}),this.flv.attachMediaElement(this.player),this.flv.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.flv,o)}),this.flv.load(),this.props.onLoaded()}),e instanceof Array)this.player.load();else if((0,a.isMediaStream)(e))try{this.player.srcObject=e}catch{this.player.src=window.URL.createObjectURL(e)}}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.removeAttribute("src"),this.dash&&this.dash.reset()}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player?this.player.requestPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="picture-in-picture"&&this.player.webkitSetPresentationMode("picture-in-picture")}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player?document.exitPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="inline"&&this.player.webkitSetPresentationMode("inline")}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getSource(e){const t=this.shouldUseHLS(e),i=this.shouldUseDASH(e),n=this.shouldUseFLV(e);if(!(e instanceof Array||(0,a.isMediaStream)(e)||t||i||n))return X.test(e)?e.replace("www.dropbox.com","dl.dropboxusercontent.com"):e}render(){const{url:e,playing:t,loop:i,controls:n,muted:l,config:o,width:h,height:p}=this.props,L=this.shouldUseAudio(this.props)?"audio":"video",S={width:h==="auto"?h:"100%",height:p==="auto"?p:"100%"};return d.default.createElement(L,{ref:this.ref,src:this.getSource(e),style:S,preload:"auto",autoPlay:t||void 0,controls:n,muted:l,loop:i,...o.attributes},e instanceof Array&&e.map(this.renderSourceElement),o.tracks.map(this.renderTrack))}}r(P,"displayName","FilePlayer");r(P,"canPlay",c.canPlay.file);const z=b(g),J=R({__proto__:null,default:z},[g]);export{J as F}; +import{g as b,r as _,u as O,p as A}from"./index-3lltu53p.js";function R(s,e){for(var t=0;ti[n]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var I=Object.create,u=Object.defineProperty,D=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,M=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,U=(s,e,t)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,N=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},E=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of w(e))!k.call(s,n)&&n!==t&&u(s,n,{get:()=>e[n],enumerable:!(i=D(e,n))||i.enumerable});return s},j=(s,e,t)=>(t=s!=null?I(M(s)):{},E(!s||!s.__esModule?u(t,"default",{value:s,enumerable:!0}):t,s)),H=s=>E(u({},"__esModule",{value:!0}),s),r=(s,e,t)=>(U(s,typeof e!="symbol"?e+"":e,t),t),m={};N(m,{default:()=>P});var g=H(m),d=j(_),a=O,c=A;const y=typeof navigator<"u",F=y&&navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,v=y&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||F)&&!window.MSStream,V=y&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!window.MSStream,T="https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js",C="Hls",B="https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js",x="dashjs",K="https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js",G="flvjs",X=/www\.dropbox\.com\/.+/,f=/https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/,W="https://videodelivery.net/{id}/manifest/video.m3u8";class P extends d.Component{constructor(){super(...arguments),r(this,"onReady",(...e)=>this.props.onReady(...e)),r(this,"onPlay",(...e)=>this.props.onPlay(...e)),r(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),r(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),r(this,"onPause",(...e)=>this.props.onPause(...e)),r(this,"onEnded",(...e)=>this.props.onEnded(...e)),r(this,"onError",(...e)=>this.props.onError(...e)),r(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),r(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),r(this,"onDisablePIP",e=>{const{onDisablePIP:t,playing:i}=this.props;t(e),i&&this.play()}),r(this,"onPresentationModeChange",e=>{if(this.player&&(0,a.supportsWebKitPresentationMode)(this.player)){const{webkitPresentationMode:t}=this.player;t==="picture-in-picture"?this.onEnablePIP(e):t==="inline"&&this.onDisablePIP(e)}}),r(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),r(this,"mute",()=>{this.player.muted=!0}),r(this,"unmute",()=>{this.player.muted=!1}),r(this,"renderSourceElement",(e,t)=>typeof e=="string"?d.default.createElement("source",{key:t,src:e}):d.default.createElement("source",{key:t,...e})),r(this,"renderTrack",(e,t)=>d.default.createElement("track",{key:t,...e})),r(this,"ref",e=>{this.player&&(this.prevPlayer=this.player),this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getSource(this.props.url);e&&(this.player.src=e),(v||this.props.config.forceDisableHls)&&this.player.load()}componentDidUpdate(e){this.shouldUseAudio(this.props)!==this.shouldUseAudio(e)&&(this.removeListeners(this.prevPlayer,e.url),this.addListeners(this.player)),this.props.url!==e.url&&!(0,a.isMediaStream)(this.props.url)&&!(this.props.url instanceof Array)&&(this.player.srcObject=null)}componentWillUnmount(){this.player.removeAttribute("src"),this.removeListeners(this.player),this.hls&&this.hls.destroy()}addListeners(e){const{url:t,playsinline:i}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.addEventListener("canplay",this.onReady),i&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""))}removeListeners(e,t){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.removeEventListener("canplay",this.onReady)}shouldUseAudio(e){return e.config.forceVideo||e.config.attributes.poster?!1:c.AUDIO_EXTENSIONS.test(e.url)||e.config.forceAudio}shouldUseHLS(e){return V&&this.props.config.forceSafariHLS||this.props.config.forceHLS?!0:v||this.props.config.forceDisableHls?!1:c.HLS_EXTENSIONS.test(e)||f.test(e)}shouldUseDASH(e){return c.DASH_EXTENSIONS.test(e)||this.props.config.forceDASH}shouldUseFLV(e){return c.FLV_EXTENSIONS.test(e)||this.props.config.forceFLV}load(e){const{hlsVersion:t,hlsOptions:i,dashVersion:n,flvVersion:l}=this.props.config;if(this.hls&&this.hls.destroy(),this.dash&&this.dash.reset(),this.shouldUseHLS(e)&&(0,a.getSDK)(T.replace("VERSION",t),C).then(o=>{if(this.hls=new o(i),this.hls.on(o.Events.MANIFEST_PARSED,()=>{this.props.onReady()}),this.hls.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.hls,o)}),f.test(e)){const h=e.match(f)[1];this.hls.loadSource(W.replace("{id}",h))}else this.hls.loadSource(e);this.hls.attachMedia(this.player),this.props.onLoaded()}),this.shouldUseDASH(e)&&(0,a.getSDK)(B.replace("VERSION",n),x).then(o=>{this.dash=o.MediaPlayer().create(),this.dash.initialize(this.player,e,this.props.playing),this.dash.on("error",this.props.onError),parseInt(n)<3?this.dash.getDebug().setLogToBrowserConsole(!1):this.dash.updateSettings({debug:{logLevel:o.Debug.LOG_LEVEL_NONE}}),this.props.onLoaded()}),this.shouldUseFLV(e)&&(0,a.getSDK)(K.replace("VERSION",l),G).then(o=>{this.flv=o.createPlayer({type:"flv",url:e}),this.flv.attachMediaElement(this.player),this.flv.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.flv,o)}),this.flv.load(),this.props.onLoaded()}),e instanceof Array)this.player.load();else if((0,a.isMediaStream)(e))try{this.player.srcObject=e}catch{this.player.src=window.URL.createObjectURL(e)}}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.removeAttribute("src"),this.dash&&this.dash.reset()}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player?this.player.requestPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="picture-in-picture"&&this.player.webkitSetPresentationMode("picture-in-picture")}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player?document.exitPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="inline"&&this.player.webkitSetPresentationMode("inline")}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getSource(e){const t=this.shouldUseHLS(e),i=this.shouldUseDASH(e),n=this.shouldUseFLV(e);if(!(e instanceof Array||(0,a.isMediaStream)(e)||t||i||n))return X.test(e)?e.replace("www.dropbox.com","dl.dropboxusercontent.com"):e}render(){const{url:e,playing:t,loop:i,controls:n,muted:l,config:o,width:h,height:p}=this.props,L=this.shouldUseAudio(this.props)?"audio":"video",S={width:h==="auto"?h:"100%",height:p==="auto"?p:"100%"};return d.default.createElement(L,{ref:this.ref,src:this.getSource(e),style:S,preload:"auto",autoPlay:t||void 0,controls:n,muted:l,loop:i,...o.attributes},e instanceof Array&&e.map(this.renderSourceElement),o.tracks.map(this.renderTrack))}}r(P,"displayName","FilePlayer");r(P,"canPlay",c.canPlay.file);const z=b(g),J=R({__proto__:null,default:z},[g]);export{J as F}; diff --git a/assets/Kaltura-sPmLNc4J.js b/assets/Kaltura-DkhvApaa.js similarity index 97% rename from assets/Kaltura-sPmLNc4J.js rename to assets/Kaltura-DkhvApaa.js index ab12f371b6..e12379163b 100644 --- a/assets/Kaltura-sPmLNc4J.js +++ b/assets/Kaltura-DkhvApaa.js @@ -1 +1 @@ -import{g as y,r as f,u as _,p as m}from"./index-Cb9cdkBC.js";function P(r,e){for(var t=0;to[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,n=Object.defineProperty,b=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,O=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,j=(r,e,t)=>e in r?n(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,L=(r,e)=>{for(var t in e)n(r,t,{get:e[t],enumerable:!0})},c=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!w.call(r,a)&&a!==t&&n(r,a,{get:()=>e[a],enumerable:!(o=b(e,a))||o.enumerable});return r},K=(r,e,t)=>(t=r!=null?g(O(r)):{},c(!r||!r.__esModule?n(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>c(n({},"__esModule",{value:!0}),r),s=(r,e,t)=>(j(r,typeof e!="symbol"?e+"":e,t),t),d={};L(d,{default:()=>i});var h=D(d),u=K(f),p=_,M=m;const S="https://cdn.embed.ly/player-0.1.0.min.js",T="playerjs";class i extends u.Component{constructor(){super(...arguments),s(this,"callPlayer",p.callPlayer),s(this,"duration",null),s(this,"currentTime",null),s(this,"secondsLoaded",null),s(this,"mute",()=>{this.callPlayer("mute")}),s(this,"unmute",()=>{this.callPlayer("unmute")}),s(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,p.getSDK)(S,T).then(t=>{this.iframe&&(this.player=new t.Player(this.iframe),this.player.on("ready",()=>{setTimeout(()=>{this.player.isReady=!0,this.player.setLoop(this.props.loop),this.props.muted&&this.player.mute(),this.addListeners(this.player,this.props),this.props.onReady()},500)}))},this.props.onError)}addListeners(e,t){e.on("play",t.onPlay),e.on("pause",t.onPause),e.on("ended",t.onEnded),e.on("error",t.onError),e.on("timeupdate",({duration:o,seconds:a})=>{this.duration=o,this.currentTime=a})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,t=!0){this.callPlayer("setCurrentTime",e),t||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const e={width:"100%",height:"100%"};return u.default.createElement("iframe",{ref:this.ref,src:this.props.url,frameBorder:"0",scrolling:"no",style:e,allow:"encrypted-media; autoplay; fullscreen;",referrerPolicy:"no-referrer-when-downgrade"})}}s(i,"displayName","Kaltura");s(i,"canPlay",M.canPlay.kaltura);const E=y(h),N=P({__proto__:null,default:E},[h]);export{N as K}; +import{g as y,r as f,u as _,p as m}from"./index-3lltu53p.js";function P(r,e){for(var t=0;to[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,n=Object.defineProperty,b=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,O=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,j=(r,e,t)=>e in r?n(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,L=(r,e)=>{for(var t in e)n(r,t,{get:e[t],enumerable:!0})},c=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!w.call(r,a)&&a!==t&&n(r,a,{get:()=>e[a],enumerable:!(o=b(e,a))||o.enumerable});return r},K=(r,e,t)=>(t=r!=null?g(O(r)):{},c(!r||!r.__esModule?n(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>c(n({},"__esModule",{value:!0}),r),s=(r,e,t)=>(j(r,typeof e!="symbol"?e+"":e,t),t),d={};L(d,{default:()=>i});var h=D(d),u=K(f),p=_,M=m;const S="https://cdn.embed.ly/player-0.1.0.min.js",T="playerjs";class i extends u.Component{constructor(){super(...arguments),s(this,"callPlayer",p.callPlayer),s(this,"duration",null),s(this,"currentTime",null),s(this,"secondsLoaded",null),s(this,"mute",()=>{this.callPlayer("mute")}),s(this,"unmute",()=>{this.callPlayer("unmute")}),s(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,p.getSDK)(S,T).then(t=>{this.iframe&&(this.player=new t.Player(this.iframe),this.player.on("ready",()=>{setTimeout(()=>{this.player.isReady=!0,this.player.setLoop(this.props.loop),this.props.muted&&this.player.mute(),this.addListeners(this.player,this.props),this.props.onReady()},500)}))},this.props.onError)}addListeners(e,t){e.on("play",t.onPlay),e.on("pause",t.onPause),e.on("ended",t.onEnded),e.on("error",t.onError),e.on("timeupdate",({duration:o,seconds:a})=>{this.duration=o,this.currentTime=a})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,t=!0){this.callPlayer("setCurrentTime",e),t||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const e={width:"100%",height:"100%"};return u.default.createElement("iframe",{ref:this.ref,src:this.props.url,frameBorder:"0",scrolling:"no",style:e,allow:"encrypted-media; autoplay; fullscreen;",referrerPolicy:"no-referrer-when-downgrade"})}}s(i,"displayName","Kaltura");s(i,"canPlay",M.canPlay.kaltura);const E=y(h),N=P({__proto__:null,default:E},[h]);export{N as K}; diff --git a/assets/Mixcloud-D0RZnNsH.js b/assets/Mixcloud-CX0bmbVQ.js similarity index 97% rename from assets/Mixcloud-D0RZnNsH.js rename to assets/Mixcloud-CX0bmbVQ.js index f0a6c292f4..fb52903135 100644 --- a/assets/Mixcloud-D0RZnNsH.js +++ b/assets/Mixcloud-CX0bmbVQ.js @@ -1 +1 @@ -import{g as _,r as f,u as m,p as g}from"./index-Cb9cdkBC.js";function v(t,e){for(var r=0;rs[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,i=Object.defineProperty,O=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,M=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,x=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,j=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of b(e))!w.call(t,o)&&o!==r&&i(t,o,{get:()=>e[o],enumerable:!(s=O(e,o))||s.enumerable});return t},D=(t,e,r)=>(r=t!=null?P(M(t)):{},c(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>c(i({},"__esModule",{value:!0}),t),a=(t,e,r)=>(x(t,typeof e!="symbol"?e+"":e,r),r),d={};j(d,{default:()=>l});var h=S(d),p=D(f),u=m,y=g;const E="https://widget.mixcloud.com/media/js/widgetApi.js",L="Mixcloud";class l extends p.Component{constructor(){super(...arguments),a(this,"callPlayer",u.callPlayer),a(this,"duration",null),a(this,"currentTime",null),a(this,"secondsLoaded",null),a(this,"mute",()=>{}),a(this,"unmute",()=>{}),a(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,u.getSDK)(E,L).then(r=>{this.player=r.PlayerWidget(this.iframe),this.player.ready.then(()=>{this.player.events.play.on(this.props.onPlay),this.player.events.pause.on(this.props.onPause),this.player.events.ended.on(this.props.onEnded),this.player.events.error.on(this.props.error),this.player.events.progress.on((s,o)=>{this.currentTime=s,this.duration=o}),this.props.onReady()})},this.props.onError)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return null}render(){const{url:e,config:r}=this.props,s=e.match(y.MATCH_URL_MIXCLOUD)[1],o={width:"100%",height:"100%"},n=(0,u.queryString)({...r.options,feed:`/${s}/`});return p.default.createElement("iframe",{key:s,ref:this.ref,style:o,src:`https://www.mixcloud.com/widget/iframe/?${n}`,frameBorder:"0",allow:"autoplay"})}}a(l,"displayName","Mixcloud");a(l,"canPlay",y.canPlay.mixcloud);a(l,"loopOnEnded",!0);const T=_(h),N=v({__proto__:null,default:T},[h]);export{N as M}; +import{g as _,r as f,u as m,p as g}from"./index-3lltu53p.js";function v(t,e){for(var r=0;rs[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,i=Object.defineProperty,O=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,M=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,x=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,j=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of b(e))!w.call(t,o)&&o!==r&&i(t,o,{get:()=>e[o],enumerable:!(s=O(e,o))||s.enumerable});return t},D=(t,e,r)=>(r=t!=null?P(M(t)):{},c(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>c(i({},"__esModule",{value:!0}),t),a=(t,e,r)=>(x(t,typeof e!="symbol"?e+"":e,r),r),d={};j(d,{default:()=>l});var h=S(d),p=D(f),u=m,y=g;const E="https://widget.mixcloud.com/media/js/widgetApi.js",L="Mixcloud";class l extends p.Component{constructor(){super(...arguments),a(this,"callPlayer",u.callPlayer),a(this,"duration",null),a(this,"currentTime",null),a(this,"secondsLoaded",null),a(this,"mute",()=>{}),a(this,"unmute",()=>{}),a(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,u.getSDK)(E,L).then(r=>{this.player=r.PlayerWidget(this.iframe),this.player.ready.then(()=>{this.player.events.play.on(this.props.onPlay),this.player.events.pause.on(this.props.onPause),this.player.events.ended.on(this.props.onEnded),this.player.events.error.on(this.props.error),this.player.events.progress.on((s,o)=>{this.currentTime=s,this.duration=o}),this.props.onReady()})},this.props.onError)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return null}render(){const{url:e,config:r}=this.props,s=e.match(y.MATCH_URL_MIXCLOUD)[1],o={width:"100%",height:"100%"},n=(0,u.queryString)({...r.options,feed:`/${s}/`});return p.default.createElement("iframe",{key:s,ref:this.ref,style:o,src:`https://www.mixcloud.com/widget/iframe/?${n}`,frameBorder:"0",allow:"autoplay"})}}a(l,"displayName","Mixcloud");a(l,"canPlay",y.canPlay.mixcloud);a(l,"loopOnEnded",!0);const T=_(h),N=v({__proto__:null,default:T},[h]);export{N as M}; diff --git a/assets/Mux-svN9vEfL.js b/assets/Mux-QVBb5-ef.js similarity index 98% rename from assets/Mux-svN9vEfL.js rename to assets/Mux-QVBb5-ef.js index d15d47cfdd..758235376f 100644 --- a/assets/Mux-svN9vEfL.js +++ b/assets/Mux-QVBb5-ef.js @@ -1 +1 @@ -import{g as P,_ as E,r as g,p as _}from"./index-Cb9cdkBC.js";function b(r,e){for(var t=0;ti[s]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var L=Object.create,u=Object.defineProperty,I=Object.getOwnPropertyDescriptor,k=Object.getOwnPropertyNames,O=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,M=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,R=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of k(e))!x.call(r,s)&&s!==t&&u(r,s,{get:()=>e[s],enumerable:!(i=I(e,s))||i.enumerable});return r},w=(r,e,t)=>(t=r!=null?L(O(r)):{},f(!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>f(u({},"__esModule",{value:!0}),r),n=(r,e,t)=>(M(r,typeof e!="symbol"?e+"":e,t),t),y={};R(y,{default:()=>l});var m=D(y),v=w(g),p=_;const j="https://cdn.jsdelivr.net/npm/@mux/mux-player@VERSION/dist/mux-player.mjs";class l extends v.Component{constructor(){super(...arguments),n(this,"onReady",(...e)=>this.props.onReady(...e)),n(this,"onPlay",(...e)=>this.props.onPlay(...e)),n(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),n(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),n(this,"onPause",(...e)=>this.props.onPause(...e)),n(this,"onEnded",(...e)=>this.props.onEnded(...e)),n(this,"onError",(...e)=>this.props.onError(...e)),n(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),n(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),n(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.player.muted=!0}),n(this,"unmute",()=>{this.player.muted=!1}),n(this,"ref",e=>{this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getPlaybackId(this.props.url);e&&(this.player.playbackId=e)}componentWillUnmount(){this.player.playbackId=null,this.removeListeners(this.player)}addListeners(e){const{playsinline:t}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),e.addEventListener("canplay",this.onReady),t&&e.setAttribute("playsinline","")}removeListeners(e){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("canplay",this.onReady)}async load(e){var t;const{onError:i,config:s}=this.props;if(!((t=globalThis.customElements)!=null&&t.get("mux-player")))try{const a=j.replace("VERSION",s.version);await E(()=>import(`${a}`),[],import.meta.url),this.props.onLoaded()}catch(a){i(a)}const[,o]=e.match(p.MATCH_URL_MUX);this.player.playbackId=o}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.playbackId=null}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player&&this.player.requestPictureInPicture()}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player&&document.exitPictureInPicture()}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getPlaybackId(e){const[,t]=e.match(p.MATCH_URL_MUX);return t}render(){const{url:e,playing:t,loop:i,controls:s,muted:o,config:a,width:h,height:c}=this.props,d={width:h==="auto"?h:"100%",height:c==="auto"?c:"100%"};return s===!1&&(d["--controls"]="none"),v.default.createElement("mux-player",{ref:this.ref,"playback-id":this.getPlaybackId(e),style:d,preload:"auto",autoPlay:t||void 0,muted:o?"":void 0,loop:i?"":void 0,...a.attributes})}}n(l,"displayName","Mux");n(l,"canPlay",p.canPlay.mux);const C=P(m),B=b({__proto__:null,default:C},[m]);export{B as M}; +import{g as P,_ as E,r as g,p as _}from"./index-3lltu53p.js";function b(r,e){for(var t=0;ti[s]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var L=Object.create,u=Object.defineProperty,I=Object.getOwnPropertyDescriptor,k=Object.getOwnPropertyNames,O=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,M=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,R=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of k(e))!x.call(r,s)&&s!==t&&u(r,s,{get:()=>e[s],enumerable:!(i=I(e,s))||i.enumerable});return r},w=(r,e,t)=>(t=r!=null?L(O(r)):{},f(!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>f(u({},"__esModule",{value:!0}),r),n=(r,e,t)=>(M(r,typeof e!="symbol"?e+"":e,t),t),y={};R(y,{default:()=>l});var m=D(y),v=w(g),p=_;const j="https://cdn.jsdelivr.net/npm/@mux/mux-player@VERSION/dist/mux-player.mjs";class l extends v.Component{constructor(){super(...arguments),n(this,"onReady",(...e)=>this.props.onReady(...e)),n(this,"onPlay",(...e)=>this.props.onPlay(...e)),n(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),n(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),n(this,"onPause",(...e)=>this.props.onPause(...e)),n(this,"onEnded",(...e)=>this.props.onEnded(...e)),n(this,"onError",(...e)=>this.props.onError(...e)),n(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),n(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),n(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.player.muted=!0}),n(this,"unmute",()=>{this.player.muted=!1}),n(this,"ref",e=>{this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getPlaybackId(this.props.url);e&&(this.player.playbackId=e)}componentWillUnmount(){this.player.playbackId=null,this.removeListeners(this.player)}addListeners(e){const{playsinline:t}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),e.addEventListener("canplay",this.onReady),t&&e.setAttribute("playsinline","")}removeListeners(e){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("canplay",this.onReady)}async load(e){var t;const{onError:i,config:s}=this.props;if(!((t=globalThis.customElements)!=null&&t.get("mux-player")))try{const a=j.replace("VERSION",s.version);await E(()=>import(`${a}`),[],import.meta.url),this.props.onLoaded()}catch(a){i(a)}const[,o]=e.match(p.MATCH_URL_MUX);this.player.playbackId=o}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.playbackId=null}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player&&this.player.requestPictureInPicture()}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player&&document.exitPictureInPicture()}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getPlaybackId(e){const[,t]=e.match(p.MATCH_URL_MUX);return t}render(){const{url:e,playing:t,loop:i,controls:s,muted:o,config:a,width:h,height:c}=this.props,d={width:h==="auto"?h:"100%",height:c==="auto"?c:"100%"};return s===!1&&(d["--controls"]="none"),v.default.createElement("mux-player",{ref:this.ref,"playback-id":this.getPlaybackId(e),style:d,preload:"auto",autoPlay:t||void 0,muted:o?"":void 0,loop:i?"":void 0,...a.attributes})}}n(l,"displayName","Mux");n(l,"canPlay",p.canPlay.mux);const C=P(m),B=b({__proto__:null,default:C},[m]);export{B as M}; diff --git a/assets/Preview-YZrpqIBs.js b/assets/Preview-BCVJrb-Y.js similarity index 97% rename from assets/Preview-YZrpqIBs.js rename to assets/Preview-BCVJrb-Y.js index 3829b27b9b..c30d1e37c3 100644 --- a/assets/Preview-YZrpqIBs.js +++ b/assets/Preview-BCVJrb-Y.js @@ -1 +1 @@ -import{g as y,r as v}from"./index-Cb9cdkBC.js";function w(r,e){for(var t=0;tn[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,s=Object.defineProperty,O=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,I=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,E=(r,e,t)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,S=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},_=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of x(e))!j.call(r,a)&&a!==t&&s(r,a,{get:()=>e[a],enumerable:!(n=O(e,a))||n.enumerable});return r},C=(r,e,t)=>(t=r!=null?P(I(r)):{},_(!r||!r.__esModule?s(t,"default",{value:r,enumerable:!0}):t,r)),N=r=>_(s({},"__esModule",{value:!0}),r),p=(r,e,t)=>(E(r,typeof e!="symbol"?e+"":e,t),t),g={};S(g,{default:()=>k});var m=N(g),i=C(v);const u="64px",d={};class k extends i.Component{constructor(){super(...arguments),p(this,"mounted",!1),p(this,"state",{image:null}),p(this,"handleKeyPress",e=>{(e.key==="Enter"||e.key===" ")&&this.props.onClick()})}componentDidMount(){this.mounted=!0,this.fetchImage(this.props)}componentDidUpdate(e){const{url:t,light:n}=this.props;(e.url!==t||e.light!==n)&&this.fetchImage(this.props)}componentWillUnmount(){this.mounted=!1}fetchImage({url:e,light:t,oEmbedUrl:n}){if(!i.default.isValidElement(t)){if(typeof t=="string"){this.setState({image:t});return}if(d[e]){this.setState({image:d[e]});return}return this.setState({image:null}),window.fetch(n.replace("{url}",e)).then(a=>a.json()).then(a=>{if(a.thumbnail_url&&this.mounted){const o=a.thumbnail_url.replace("height=100","height=480").replace("-d_295x166","-d_640");this.setState({image:o}),d[e]=o}})}}render(){const{light:e,onClick:t,playIcon:n,previewTabIndex:a,previewAriaLabel:o}=this.props,{image:f}=this.state,l=i.default.isValidElement(e),h={display:"flex",alignItems:"center",justifyContent:"center"},c={preview:{width:"100%",height:"100%",backgroundImage:f&&!l?`url(${f})`:void 0,backgroundSize:"cover",backgroundPosition:"center",cursor:"pointer",...h},shadow:{background:"radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",borderRadius:u,width:u,height:u,position:l?"absolute":void 0,...h},playIcon:{borderStyle:"solid",borderWidth:"16px 0 16px 26px",borderColor:"transparent transparent transparent white",marginLeft:"7px"}},b=i.default.createElement("div",{style:c.shadow,className:"react-player__shadow"},i.default.createElement("div",{style:c.playIcon,className:"react-player__play-icon"}));return i.default.createElement("div",{style:c.preview,className:"react-player__preview",onClick:t,tabIndex:a,onKeyPress:this.handleKeyPress,...o?{"aria-label":o}:{}},l?e:null,n||b)}}const D=y(m),A=w({__proto__:null,default:D},[m]);export{A as P}; +import{g as y,r as v}from"./index-3lltu53p.js";function w(r,e){for(var t=0;tn[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,s=Object.defineProperty,O=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,I=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,E=(r,e,t)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,S=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},_=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of x(e))!j.call(r,a)&&a!==t&&s(r,a,{get:()=>e[a],enumerable:!(n=O(e,a))||n.enumerable});return r},C=(r,e,t)=>(t=r!=null?P(I(r)):{},_(!r||!r.__esModule?s(t,"default",{value:r,enumerable:!0}):t,r)),N=r=>_(s({},"__esModule",{value:!0}),r),p=(r,e,t)=>(E(r,typeof e!="symbol"?e+"":e,t),t),g={};S(g,{default:()=>k});var m=N(g),i=C(v);const u="64px",d={};class k extends i.Component{constructor(){super(...arguments),p(this,"mounted",!1),p(this,"state",{image:null}),p(this,"handleKeyPress",e=>{(e.key==="Enter"||e.key===" ")&&this.props.onClick()})}componentDidMount(){this.mounted=!0,this.fetchImage(this.props)}componentDidUpdate(e){const{url:t,light:n}=this.props;(e.url!==t||e.light!==n)&&this.fetchImage(this.props)}componentWillUnmount(){this.mounted=!1}fetchImage({url:e,light:t,oEmbedUrl:n}){if(!i.default.isValidElement(t)){if(typeof t=="string"){this.setState({image:t});return}if(d[e]){this.setState({image:d[e]});return}return this.setState({image:null}),window.fetch(n.replace("{url}",e)).then(a=>a.json()).then(a=>{if(a.thumbnail_url&&this.mounted){const o=a.thumbnail_url.replace("height=100","height=480").replace("-d_295x166","-d_640");this.setState({image:o}),d[e]=o}})}}render(){const{light:e,onClick:t,playIcon:n,previewTabIndex:a,previewAriaLabel:o}=this.props,{image:f}=this.state,l=i.default.isValidElement(e),h={display:"flex",alignItems:"center",justifyContent:"center"},c={preview:{width:"100%",height:"100%",backgroundImage:f&&!l?`url(${f})`:void 0,backgroundSize:"cover",backgroundPosition:"center",cursor:"pointer",...h},shadow:{background:"radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",borderRadius:u,width:u,height:u,position:l?"absolute":void 0,...h},playIcon:{borderStyle:"solid",borderWidth:"16px 0 16px 26px",borderColor:"transparent transparent transparent white",marginLeft:"7px"}},b=i.default.createElement("div",{style:c.shadow,className:"react-player__shadow"},i.default.createElement("div",{style:c.playIcon,className:"react-player__play-icon"}));return i.default.createElement("div",{style:c.preview,className:"react-player__preview",onClick:t,tabIndex:a,onKeyPress:this.handleKeyPress,...o?{"aria-label":o}:{}},l?e:null,n||b)}}const D=y(m),A=w({__proto__:null,default:D},[m]);export{A as P}; diff --git a/assets/SoundCloud-2L3D5aY5.js b/assets/SoundCloud-Bnz9RCCy.js similarity index 97% rename from assets/SoundCloud-2L3D5aY5.js rename to assets/SoundCloud-Bnz9RCCy.js index 7349f5b25f..e23f3ad74d 100644 --- a/assets/SoundCloud-2L3D5aY5.js +++ b/assets/SoundCloud-Bnz9RCCy.js @@ -1 +1 @@ -import{g as P,r as g,u as b,p as v}from"./index-Cb9cdkBC.js";function O(t,e){for(var r=0;rs[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var S=Object.create,l=Object.defineProperty,w=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,C=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty,D=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},d=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of j(e))!E.call(t,o)&&o!==r&&l(t,o,{get:()=>e[o],enumerable:!(s=w(e,o))||s.enumerable});return t},M=(t,e,r)=>(r=t!=null?S(C(t)):{},d(!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),R=t=>d(l({},"__esModule",{value:!0}),t),a=(t,e,r)=>(D(t,typeof e!="symbol"?e+"":e,r),r),h={};L(h,{default:()=>u});var f=R(h),p=M(g),c=b,T=v;const N="https://w.soundcloud.com/player/api.js",x="SC";class u extends p.Component{constructor(){super(...arguments),a(this,"callPlayer",c.callPlayer),a(this,"duration",null),a(this,"currentTime",null),a(this,"fractionLoaded",null),a(this,"mute",()=>{this.setVolume(0)}),a(this,"unmute",()=>{this.props.volume!==null&&this.setVolume(this.props.volume)}),a(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){(0,c.getSDK)(N,x).then(s=>{if(!this.iframe)return;const{PLAY:o,PLAY_PROGRESS:i,PAUSE:y,FINISH:_,ERROR:m}=s.Widget.Events;r||(this.player=s.Widget(this.iframe),this.player.bind(o,this.props.onPlay),this.player.bind(y,()=>{this.duration-this.currentTime<.05||this.props.onPause()}),this.player.bind(i,n=>{this.currentTime=n.currentPosition/1e3,this.fractionLoaded=n.loadedProgress}),this.player.bind(_,()=>this.props.onEnded()),this.player.bind(m,n=>this.props.onError(n))),this.player.load(e,{...this.props.config.options,callback:()=>{this.player.getDuration(n=>{this.duration=n/1e3,this.props.onReady()})}})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seekTo",e*1e3),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e*100)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.fractionLoaded*this.duration}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return p.default.createElement("iframe",{ref:this.ref,src:`https://w.soundcloud.com/player/?url=${encodeURIComponent(this.props.url)}`,style:r,frameBorder:0,allow:"autoplay"})}}a(u,"displayName","SoundCloud");a(u,"canPlay",T.canPlay.soundcloud);a(u,"loopOnEnded",!0);const A=P(f),F=O({__proto__:null,default:A},[f]);export{F as S}; +import{g as P,r as g,u as b,p as v}from"./index-3lltu53p.js";function O(t,e){for(var r=0;rs[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var S=Object.create,l=Object.defineProperty,w=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,C=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty,D=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},d=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of j(e))!E.call(t,o)&&o!==r&&l(t,o,{get:()=>e[o],enumerable:!(s=w(e,o))||s.enumerable});return t},M=(t,e,r)=>(r=t!=null?S(C(t)):{},d(!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),R=t=>d(l({},"__esModule",{value:!0}),t),a=(t,e,r)=>(D(t,typeof e!="symbol"?e+"":e,r),r),h={};L(h,{default:()=>u});var f=R(h),p=M(g),c=b,T=v;const N="https://w.soundcloud.com/player/api.js",x="SC";class u extends p.Component{constructor(){super(...arguments),a(this,"callPlayer",c.callPlayer),a(this,"duration",null),a(this,"currentTime",null),a(this,"fractionLoaded",null),a(this,"mute",()=>{this.setVolume(0)}),a(this,"unmute",()=>{this.props.volume!==null&&this.setVolume(this.props.volume)}),a(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){(0,c.getSDK)(N,x).then(s=>{if(!this.iframe)return;const{PLAY:o,PLAY_PROGRESS:i,PAUSE:y,FINISH:_,ERROR:m}=s.Widget.Events;r||(this.player=s.Widget(this.iframe),this.player.bind(o,this.props.onPlay),this.player.bind(y,()=>{this.duration-this.currentTime<.05||this.props.onPause()}),this.player.bind(i,n=>{this.currentTime=n.currentPosition/1e3,this.fractionLoaded=n.loadedProgress}),this.player.bind(_,()=>this.props.onEnded()),this.player.bind(m,n=>this.props.onError(n))),this.player.load(e,{...this.props.config.options,callback:()=>{this.player.getDuration(n=>{this.duration=n/1e3,this.props.onReady()})}})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seekTo",e*1e3),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e*100)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.fractionLoaded*this.duration}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return p.default.createElement("iframe",{ref:this.ref,src:`https://w.soundcloud.com/player/?url=${encodeURIComponent(this.props.url)}`,style:r,frameBorder:0,allow:"autoplay"})}}a(u,"displayName","SoundCloud");a(u,"canPlay",T.canPlay.soundcloud);a(u,"loopOnEnded",!0);const A=P(f),F=O({__proto__:null,default:A},[f]);export{F as S}; diff --git a/assets/Streamable-Pnjs9Gja.js b/assets/Streamable-Do3V8z4H.js similarity index 97% rename from assets/Streamable-Pnjs9Gja.js rename to assets/Streamable-Do3V8z4H.js index 4c2c2c5fb4..1af8b83dd4 100644 --- a/assets/Streamable-Pnjs9Gja.js +++ b/assets/Streamable-Do3V8z4H.js @@ -1 +1 @@ -import{g as m,r as f,u as _,p as b}from"./index-Cb9cdkBC.js";function P(t,e){for(var r=0;rs[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,l=Object.defineProperty,v=Object.getOwnPropertyDescriptor,O=Object.getOwnPropertyNames,S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,L=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of O(e))!j.call(t,a)&&a!==r&&l(t,a,{get:()=>e[a],enumerable:!(s=v(e,a))||s.enumerable});return t},M=(t,e,r)=>(r=t!=null?g(S(t)):{},c(!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),D=t=>c(l({},"__esModule",{value:!0}),t),o=(t,e,r)=>(L(t,typeof e!="symbol"?e+"":e,r),r),h={};w(h,{default:()=>i});var y=D(h),p=M(f),u=_,d=b;const E="https://cdn.embed.ly/player-0.1.0.min.js",T="playerjs";class i extends p.Component{constructor(){super(...arguments),o(this,"callPlayer",u.callPlayer),o(this,"duration",null),o(this,"currentTime",null),o(this,"secondsLoaded",null),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")}),o(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,u.getSDK)(E,T).then(r=>{this.iframe&&(this.player=new r.Player(this.iframe),this.player.setLoop(this.props.loop),this.player.on("ready",this.props.onReady),this.player.on("play",this.props.onPlay),this.player.on("pause",this.props.onPause),this.player.on("seeked",this.props.onSeek),this.player.on("ended",this.props.onEnded),this.player.on("error",this.props.onError),this.player.on("timeupdate",({duration:s,seconds:a})=>{this.duration=s,this.currentTime=a}),this.player.on("buffered",({percent:s})=>{this.duration&&(this.secondsLoaded=this.duration*s)}),this.props.muted&&this.player.mute())},this.props.onError)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("setCurrentTime",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e*100)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const e=this.props.url.match(d.MATCH_URL_STREAMABLE)[1],r={width:"100%",height:"100%"};return p.default.createElement("iframe",{ref:this.ref,src:`https://streamable.com/o/${e}`,frameBorder:"0",scrolling:"no",style:r,allow:"encrypted-media; autoplay; fullscreen;"})}}o(i,"displayName","Streamable");o(i,"canPlay",d.canPlay.streamable);const x=m(y),C=P({__proto__:null,default:x},[y]);export{C as S}; +import{g as m,r as f,u as _,p as b}from"./index-3lltu53p.js";function P(t,e){for(var r=0;rs[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,l=Object.defineProperty,v=Object.getOwnPropertyDescriptor,O=Object.getOwnPropertyNames,S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,L=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of O(e))!j.call(t,a)&&a!==r&&l(t,a,{get:()=>e[a],enumerable:!(s=v(e,a))||s.enumerable});return t},M=(t,e,r)=>(r=t!=null?g(S(t)):{},c(!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),D=t=>c(l({},"__esModule",{value:!0}),t),o=(t,e,r)=>(L(t,typeof e!="symbol"?e+"":e,r),r),h={};w(h,{default:()=>i});var y=D(h),p=M(f),u=_,d=b;const E="https://cdn.embed.ly/player-0.1.0.min.js",T="playerjs";class i extends p.Component{constructor(){super(...arguments),o(this,"callPlayer",u.callPlayer),o(this,"duration",null),o(this,"currentTime",null),o(this,"secondsLoaded",null),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")}),o(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,u.getSDK)(E,T).then(r=>{this.iframe&&(this.player=new r.Player(this.iframe),this.player.setLoop(this.props.loop),this.player.on("ready",this.props.onReady),this.player.on("play",this.props.onPlay),this.player.on("pause",this.props.onPause),this.player.on("seeked",this.props.onSeek),this.player.on("ended",this.props.onEnded),this.player.on("error",this.props.onError),this.player.on("timeupdate",({duration:s,seconds:a})=>{this.duration=s,this.currentTime=a}),this.player.on("buffered",({percent:s})=>{this.duration&&(this.secondsLoaded=this.duration*s)}),this.props.muted&&this.player.mute())},this.props.onError)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("setCurrentTime",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e*100)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const e=this.props.url.match(d.MATCH_URL_STREAMABLE)[1],r={width:"100%",height:"100%"};return p.default.createElement("iframe",{ref:this.ref,src:`https://streamable.com/o/${e}`,frameBorder:"0",scrolling:"no",style:r,allow:"encrypted-media; autoplay; fullscreen;"})}}o(i,"displayName","Streamable");o(i,"canPlay",d.canPlay.streamable);const x=m(y),C=P({__proto__:null,default:x},[y]);export{C as S}; diff --git a/assets/Twitch-D_j_UBgL.js b/assets/Twitch-41MSxuO7.js similarity index 97% rename from assets/Twitch-D_j_UBgL.js rename to assets/Twitch-41MSxuO7.js index d36ef6f21e..a07c5e97c1 100644 --- a/assets/Twitch-D_j_UBgL.js +++ b/assets/Twitch-41MSxuO7.js @@ -1 +1 @@ -import{g as w,r as D,u as C,p as N}from"./index-Cb9cdkBC.js";function I(t,e){for(var r=0;rs[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,l=Object.defineProperty,S=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,A=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty,R=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},_=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of j(e))!H.call(t,a)&&a!==r&&l(t,a,{get:()=>e[a],enumerable:!(s=S(e,a))||s.enumerable});return t},F=(t,e,r)=>(r=t!=null?M(A(t)):{},_(!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),U=t=>_(l({},"__esModule",{value:!0}),t),o=(t,e,r)=>(R(t,typeof e!="symbol"?e+"":e,r),r),P={};x(P,{default:()=>h});var f=U(P),y=F(D),c=C,u=N;const K="https://player.twitch.tv/js/embed/v1.js",V="Twitch",$="twitch-player-";class h extends y.Component{constructor(){super(...arguments),o(this,"callPlayer",c.callPlayer),o(this,"playerID",this.props.config.playerId||`${$}${(0,c.randomString)()}`),o(this,"mute",()=>{this.callPlayer("setMuted",!0)}),o(this,"unmute",()=>{this.callPlayer("setMuted",!1)})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){const{playsinline:s,onError:a,config:n,controls:v}=this.props,i=u.MATCH_URL_TWITCH_CHANNEL.test(e),p=i?e.match(u.MATCH_URL_TWITCH_CHANNEL)[1]:e.match(u.MATCH_URL_TWITCH_VIDEO)[1];if(r){i?this.player.setChannel(p):this.player.setVideo("v"+p);return}(0,c.getSDK)(K,V).then(d=>{this.player=new d.Player(this.playerID,{video:i?"":p,channel:i?p:"",height:"100%",width:"100%",playsinline:s,autoplay:this.props.playing,muted:this.props.muted,controls:i?!0:v,time:(0,c.parseStartTime)(e),...n.options});const{READY:g,PLAYING:m,PAUSE:E,ENDED:O,ONLINE:L,OFFLINE:b,SEEK:T}=d.Player;this.player.addEventListener(g,this.props.onReady),this.player.addEventListener(m,this.props.onPlay),this.player.addEventListener(E,this.props.onPause),this.player.addEventListener(O,this.props.onEnded),this.player.addEventListener(T,this.props.onSeek),this.player.addEventListener(L,this.props.onLoaded),this.player.addEventListener(b,this.props.onLoaded)},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){this.callPlayer("pause")}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentTime")}getSecondsLoaded(){return null}render(){const e={width:"100%",height:"100%"};return y.default.createElement("div",{style:e,id:this.playerID})}}o(h,"displayName","Twitch");o(h,"canPlay",u.canPlay.twitch);o(h,"loopOnEnded",!0);const W=w(f),G=I({__proto__:null,default:W},[f]);export{G as T}; +import{g as w,r as D,u as C,p as N}from"./index-3lltu53p.js";function I(t,e){for(var r=0;rs[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,l=Object.defineProperty,S=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,A=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty,R=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},_=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of j(e))!H.call(t,a)&&a!==r&&l(t,a,{get:()=>e[a],enumerable:!(s=S(e,a))||s.enumerable});return t},F=(t,e,r)=>(r=t!=null?M(A(t)):{},_(!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),U=t=>_(l({},"__esModule",{value:!0}),t),o=(t,e,r)=>(R(t,typeof e!="symbol"?e+"":e,r),r),P={};x(P,{default:()=>h});var f=U(P),y=F(D),c=C,u=N;const K="https://player.twitch.tv/js/embed/v1.js",V="Twitch",$="twitch-player-";class h extends y.Component{constructor(){super(...arguments),o(this,"callPlayer",c.callPlayer),o(this,"playerID",this.props.config.playerId||`${$}${(0,c.randomString)()}`),o(this,"mute",()=>{this.callPlayer("setMuted",!0)}),o(this,"unmute",()=>{this.callPlayer("setMuted",!1)})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){const{playsinline:s,onError:a,config:n,controls:v}=this.props,i=u.MATCH_URL_TWITCH_CHANNEL.test(e),p=i?e.match(u.MATCH_URL_TWITCH_CHANNEL)[1]:e.match(u.MATCH_URL_TWITCH_VIDEO)[1];if(r){i?this.player.setChannel(p):this.player.setVideo("v"+p);return}(0,c.getSDK)(K,V).then(d=>{this.player=new d.Player(this.playerID,{video:i?"":p,channel:i?p:"",height:"100%",width:"100%",playsinline:s,autoplay:this.props.playing,muted:this.props.muted,controls:i?!0:v,time:(0,c.parseStartTime)(e),...n.options});const{READY:g,PLAYING:m,PAUSE:E,ENDED:O,ONLINE:L,OFFLINE:b,SEEK:T}=d.Player;this.player.addEventListener(g,this.props.onReady),this.player.addEventListener(m,this.props.onPlay),this.player.addEventListener(E,this.props.onPause),this.player.addEventListener(O,this.props.onEnded),this.player.addEventListener(T,this.props.onSeek),this.player.addEventListener(L,this.props.onLoaded),this.player.addEventListener(b,this.props.onLoaded)},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){this.callPlayer("pause")}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentTime")}getSecondsLoaded(){return null}render(){const e={width:"100%",height:"100%"};return y.default.createElement("div",{style:e,id:this.playerID})}}o(h,"displayName","Twitch");o(h,"canPlay",u.canPlay.twitch);o(h,"loopOnEnded",!0);const W=w(f),G=I({__proto__:null,default:W},[f]);export{G as T}; diff --git a/assets/Vidyard-HWn1mekK.js b/assets/Vidyard-CaAeUx3d.js similarity index 97% rename from assets/Vidyard-HWn1mekK.js rename to assets/Vidyard-CaAeUx3d.js index 29641cc235..5c21d4bc70 100644 --- a/assets/Vidyard-HWn1mekK.js +++ b/assets/Vidyard-CaAeUx3d.js @@ -1 +1 @@ -import{g as m,r as v,u as b,p as O}from"./index-Cb9cdkBC.js";function V(t,e){for(var r=0;rs[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var D=Object.create,i=Object.defineProperty,j=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,S=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty,A=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of w(e))!M.call(t,a)&&a!==r&&i(t,a,{get:()=>e[a],enumerable:!(s=j(e,a))||s.enumerable});return t},L=(t,e,r)=>(r=t!=null?D(S(t)):{},h(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),R=t=>h(i({},"__esModule",{value:!0}),t),o=(t,e,r)=>(A(t,typeof e!="symbol"?e+"":e,r),r),_={};E(_,{default:()=>y});var f=R(_),c=L(v),d=b,P=O;const x="https://play.vidyard.com/embed/v4.js",C="VidyardV4",N="onVidyardAPI";class y extends c.Component{constructor(){super(...arguments),o(this,"callPlayer",d.callPlayer),o(this,"mute",()=>{this.setVolume(0)}),o(this,"unmute",()=>{this.props.volume!==null&&this.setVolume(this.props.volume)}),o(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{playing:r,config:s,onError:a,onDuration:n}=this.props,l=e&&e.match(P.MATCH_URL_VIDYARD)[1];this.player&&this.stop(),(0,d.getSDK)(x,C,N).then(p=>{this.container&&(p.api.addReadyListener((u,g)=>{this.player||(this.player=g,this.player.on("ready",this.props.onReady),this.player.on("play",this.props.onPlay),this.player.on("pause",this.props.onPause),this.player.on("seek",this.props.onSeek),this.player.on("playerComplete",this.props.onEnded))},l),p.api.renderPlayer({uuid:l,container:this.container,autoplay:r?1:0,...s.options}),p.api.getPlayerMetadata(l).then(u=>{this.duration=u.length_in_seconds,n(u.length_in_seconds)}))},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){window.VidyardV4.api.destroyPlayer(this.player)}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setPlaybackRate(e){this.callPlayer("setPlaybackSpeed",e)}getDuration(){return this.duration}getCurrentTime(){return this.callPlayer("currentTime")}getSecondsLoaded(){return null}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}o(y,"displayName","Vidyard");o(y,"canPlay",P.canPlay.vidyard);const T=m(f),K=V({__proto__:null,default:T},[f]);export{K as V}; +import{g as m,r as v,u as b,p as O}from"./index-3lltu53p.js";function V(t,e){for(var r=0;rs[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var D=Object.create,i=Object.defineProperty,j=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,S=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty,A=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of w(e))!M.call(t,a)&&a!==r&&i(t,a,{get:()=>e[a],enumerable:!(s=j(e,a))||s.enumerable});return t},L=(t,e,r)=>(r=t!=null?D(S(t)):{},h(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),R=t=>h(i({},"__esModule",{value:!0}),t),o=(t,e,r)=>(A(t,typeof e!="symbol"?e+"":e,r),r),_={};E(_,{default:()=>y});var f=R(_),c=L(v),d=b,P=O;const x="https://play.vidyard.com/embed/v4.js",C="VidyardV4",N="onVidyardAPI";class y extends c.Component{constructor(){super(...arguments),o(this,"callPlayer",d.callPlayer),o(this,"mute",()=>{this.setVolume(0)}),o(this,"unmute",()=>{this.props.volume!==null&&this.setVolume(this.props.volume)}),o(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{playing:r,config:s,onError:a,onDuration:n}=this.props,l=e&&e.match(P.MATCH_URL_VIDYARD)[1];this.player&&this.stop(),(0,d.getSDK)(x,C,N).then(p=>{this.container&&(p.api.addReadyListener((u,g)=>{this.player||(this.player=g,this.player.on("ready",this.props.onReady),this.player.on("play",this.props.onPlay),this.player.on("pause",this.props.onPause),this.player.on("seek",this.props.onSeek),this.player.on("playerComplete",this.props.onEnded))},l),p.api.renderPlayer({uuid:l,container:this.container,autoplay:r?1:0,...s.options}),p.api.getPlayerMetadata(l).then(u=>{this.duration=u.length_in_seconds,n(u.length_in_seconds)}))},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){window.VidyardV4.api.destroyPlayer(this.player)}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setPlaybackRate(e){this.callPlayer("setPlaybackSpeed",e)}getDuration(){return this.duration}getCurrentTime(){return this.callPlayer("currentTime")}getSecondsLoaded(){return null}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}o(y,"displayName","Vidyard");o(y,"canPlay",P.canPlay.vidyard);const T=m(f),K=V({__proto__:null,default:T},[f]);export{K as V}; diff --git a/assets/Vimeo-CDDCoytq.js b/assets/Vimeo-CfDyl8un.js similarity index 98% rename from assets/Vimeo-CDDCoytq.js rename to assets/Vimeo-CfDyl8un.js index ff37b5e29d..3b4d58bdef 100644 --- a/assets/Vimeo-CDDCoytq.js +++ b/assets/Vimeo-CfDyl8un.js @@ -1 +1 @@ -import{g as d,r as f,u as m,p as _}from"./index-Cb9cdkBC.js";function P(t,e){for(var r=0;ra[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,n=Object.defineProperty,b=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,O=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty,w=(t,e,r)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!D.call(t,o)&&o!==r&&n(t,o,{get:()=>e[o],enumerable:!(a=b(e,o))||a.enumerable});return t},j=(t,e,r)=>(r=t!=null?g(O(t)):{},h(!t||!t.__esModule?n(r,"default",{value:t,enumerable:!0}):r,t)),E=t=>h(n({},"__esModule",{value:!0}),t),i=(t,e,r)=>(w(t,typeof e!="symbol"?e+"":e,r),r),c={};M(c,{default:()=>l});var y=E(c),p=j(f),u=m,L=_;const S="https://player.vimeo.com/api/player.js",V="Vimeo",k=t=>t.replace("/manage/videos","");class l extends p.Component{constructor(){super(...arguments),i(this,"callPlayer",u.callPlayer),i(this,"duration",null),i(this,"currentTime",null),i(this,"secondsLoaded",null),i(this,"mute",()=>{this.setMuted(!0)}),i(this,"unmute",()=>{this.setMuted(!1)}),i(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){this.duration=null,(0,u.getSDK)(S,V).then(r=>{if(!this.container)return;const{playerOptions:a,title:o}=this.props.config;this.player=new r.Player(this.container,{url:k(e),autoplay:this.props.playing,muted:this.props.muted,loop:this.props.loop,playsinline:this.props.playsinline,controls:this.props.controls,...a}),this.player.ready().then(()=>{const s=this.container.querySelector("iframe");s.style.width="100%",s.style.height="100%",o&&(s.title=o)}).catch(this.props.onError),this.player.on("loaded",()=>{this.props.onReady(),this.refreshDuration()}),this.player.on("play",()=>{this.props.onPlay(),this.refreshDuration()}),this.player.on("pause",this.props.onPause),this.player.on("seeked",s=>this.props.onSeek(s.seconds)),this.player.on("ended",this.props.onEnded),this.player.on("error",this.props.onError),this.player.on("timeupdate",({seconds:s})=>{this.currentTime=s}),this.player.on("progress",({seconds:s})=>{this.secondsLoaded=s}),this.player.on("bufferstart",this.props.onBuffer),this.player.on("bufferend",this.props.onBufferEnd),this.player.on("playbackratechange",s=>this.props.onPlaybackRateChange(s.playbackRate))},this.props.onError)}refreshDuration(){this.player.getDuration().then(e=>{this.duration=e})}play(){const e=this.callPlayer("play");e&&e.catch(this.props.onError)}pause(){this.callPlayer("pause")}stop(){this.callPlayer("unload")}seekTo(e,r=!0){this.callPlayer("setCurrentTime",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setMuted(e){this.callPlayer("setMuted",e)}setLoop(e){this.callPlayer("setLoop",e)}setPlaybackRate(e){this.callPlayer("setPlaybackRate",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const{display:e}=this.props,r={width:"100%",height:"100%",overflow:"hidden",display:e};return p.default.createElement("div",{key:this.props.url,ref:this.ref,style:r})}}i(l,"displayName","Vimeo");i(l,"canPlay",L.canPlay.vimeo);i(l,"forceLoad",!0);const T=d(y),C=P({__proto__:null,default:T},[y]);export{C as V}; +import{g as d,r as f,u as m,p as _}from"./index-3lltu53p.js";function P(t,e){for(var r=0;ra[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,n=Object.defineProperty,b=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,O=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty,w=(t,e,r)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!D.call(t,o)&&o!==r&&n(t,o,{get:()=>e[o],enumerable:!(a=b(e,o))||a.enumerable});return t},j=(t,e,r)=>(r=t!=null?g(O(t)):{},h(!t||!t.__esModule?n(r,"default",{value:t,enumerable:!0}):r,t)),E=t=>h(n({},"__esModule",{value:!0}),t),i=(t,e,r)=>(w(t,typeof e!="symbol"?e+"":e,r),r),c={};M(c,{default:()=>l});var y=E(c),p=j(f),u=m,L=_;const S="https://player.vimeo.com/api/player.js",V="Vimeo",k=t=>t.replace("/manage/videos","");class l extends p.Component{constructor(){super(...arguments),i(this,"callPlayer",u.callPlayer),i(this,"duration",null),i(this,"currentTime",null),i(this,"secondsLoaded",null),i(this,"mute",()=>{this.setMuted(!0)}),i(this,"unmute",()=>{this.setMuted(!1)}),i(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){this.duration=null,(0,u.getSDK)(S,V).then(r=>{if(!this.container)return;const{playerOptions:a,title:o}=this.props.config;this.player=new r.Player(this.container,{url:k(e),autoplay:this.props.playing,muted:this.props.muted,loop:this.props.loop,playsinline:this.props.playsinline,controls:this.props.controls,...a}),this.player.ready().then(()=>{const s=this.container.querySelector("iframe");s.style.width="100%",s.style.height="100%",o&&(s.title=o)}).catch(this.props.onError),this.player.on("loaded",()=>{this.props.onReady(),this.refreshDuration()}),this.player.on("play",()=>{this.props.onPlay(),this.refreshDuration()}),this.player.on("pause",this.props.onPause),this.player.on("seeked",s=>this.props.onSeek(s.seconds)),this.player.on("ended",this.props.onEnded),this.player.on("error",this.props.onError),this.player.on("timeupdate",({seconds:s})=>{this.currentTime=s}),this.player.on("progress",({seconds:s})=>{this.secondsLoaded=s}),this.player.on("bufferstart",this.props.onBuffer),this.player.on("bufferend",this.props.onBufferEnd),this.player.on("playbackratechange",s=>this.props.onPlaybackRateChange(s.playbackRate))},this.props.onError)}refreshDuration(){this.player.getDuration().then(e=>{this.duration=e})}play(){const e=this.callPlayer("play");e&&e.catch(this.props.onError)}pause(){this.callPlayer("pause")}stop(){this.callPlayer("unload")}seekTo(e,r=!0){this.callPlayer("setCurrentTime",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setMuted(e){this.callPlayer("setMuted",e)}setLoop(e){this.callPlayer("setLoop",e)}setPlaybackRate(e){this.callPlayer("setPlaybackRate",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const{display:e}=this.props,r={width:"100%",height:"100%",overflow:"hidden",display:e};return p.default.createElement("div",{key:this.props.url,ref:this.ref,style:r})}}i(l,"displayName","Vimeo");i(l,"canPlay",L.canPlay.vimeo);i(l,"forceLoad",!0);const T=d(y),C=P({__proto__:null,default:T},[y]);export{C as V}; diff --git a/assets/Wistia-D4RBjiDy.js b/assets/Wistia-CJTmCJvg.js similarity index 98% rename from assets/Wistia-D4RBjiDy.js rename to assets/Wistia-CJTmCJvg.js index 7091bb4da9..01207a277b 100644 --- a/assets/Wistia-D4RBjiDy.js +++ b/assets/Wistia-CJTmCJvg.js @@ -1 +1 @@ -import{g,r as m,u as v,p as w}from"./index-Cb9cdkBC.js";function O(t,e){for(var a=0;as[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var C=Object.create,i=Object.defineProperty,k=Object.getOwnPropertyDescriptor,D=Object.getOwnPropertyNames,E=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty,R=(t,e,a)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,j=(t,e)=>{for(var a in e)i(t,a,{get:e[a],enumerable:!0})},h=(t,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of D(e))!S.call(t,r)&&r!==a&&i(t,r,{get:()=>e[r],enumerable:!(s=k(e,r))||s.enumerable});return t},I=(t,e,a)=>(a=t!=null?C(E(t)):{},h(!t||!t.__esModule?i(a,"default",{value:t,enumerable:!0}):a,t)),M=t=>h(i({},"__esModule",{value:!0}),t),n=(t,e,a)=>(R(t,typeof e!="symbol"?e+"":e,a),a),d={};j(d,{default:()=>l});var _=M(d),y=I(m),c=v,P=w;const W="https://fast.wistia.com/assets/external/E-v1.js",x="Wistia",A="wistia-player-";class l extends y.Component{constructor(){super(...arguments),n(this,"callPlayer",c.callPlayer),n(this,"playerID",this.props.config.playerId||`${A}${(0,c.randomString)()}`),n(this,"onPlay",(...e)=>this.props.onPlay(...e)),n(this,"onPause",(...e)=>this.props.onPause(...e)),n(this,"onSeek",(...e)=>this.props.onSeek(...e)),n(this,"onEnded",(...e)=>this.props.onEnded(...e)),n(this,"onPlaybackRateChange",(...e)=>this.props.onPlaybackRateChange(...e)),n(this,"mute",()=>{this.callPlayer("mute")}),n(this,"unmute",()=>{this.callPlayer("unmute")})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{playing:a,muted:s,controls:r,onReady:o,config:p,onError:b}=this.props;(0,c.getSDK)(W,x).then(f=>{p.customControls&&p.customControls.forEach(u=>f.defineControl(u)),window._wq=window._wq||[],window._wq.push({id:this.playerID,options:{autoPlay:a,silentAutoPlay:"allow",muted:s,controlsVisibleOnLoad:r,fullscreenButton:r,playbar:r,playbackRateControl:r,qualityControl:r,volumeControl:r,settingsControl:r,smallPlayButton:r,...p.options},onReady:u=>{this.player=u,this.unbind(),this.player.bind("play",this.onPlay),this.player.bind("pause",this.onPause),this.player.bind("seek",this.onSeek),this.player.bind("end",this.onEnded),this.player.bind("playbackratechange",this.onPlaybackRateChange),o()}})},b)}unbind(){this.player.unbind("play",this.onPlay),this.player.unbind("pause",this.onPause),this.player.unbind("seek",this.onSeek),this.player.unbind("end",this.onEnded),this.player.unbind("playbackratechange",this.onPlaybackRateChange)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){this.unbind(),this.callPlayer("remove")}seekTo(e,a=!0){this.callPlayer("time",e),a||this.pause()}setVolume(e){this.callPlayer("volume",e)}setPlaybackRate(e){this.callPlayer("playbackRate",e)}getDuration(){return this.callPlayer("duration")}getCurrentTime(){return this.callPlayer("time")}getSecondsLoaded(){return null}render(){const{url:e}=this.props,a=e&&e.match(P.MATCH_URL_WISTIA)[1],s=`wistia_embed wistia_async_${a}`,r={width:"100%",height:"100%"};return y.default.createElement("div",{id:this.playerID,key:a,className:s,style:r})}}n(l,"displayName","Wistia");n(l,"canPlay",P.canPlay.wistia);n(l,"loopOnEnded",!0);const L=g(_),T=O({__proto__:null,default:L},[_]);export{T as W}; +import{g,r as m,u as v,p as w}from"./index-3lltu53p.js";function O(t,e){for(var a=0;as[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var C=Object.create,i=Object.defineProperty,k=Object.getOwnPropertyDescriptor,D=Object.getOwnPropertyNames,E=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty,R=(t,e,a)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,j=(t,e)=>{for(var a in e)i(t,a,{get:e[a],enumerable:!0})},h=(t,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of D(e))!S.call(t,r)&&r!==a&&i(t,r,{get:()=>e[r],enumerable:!(s=k(e,r))||s.enumerable});return t},I=(t,e,a)=>(a=t!=null?C(E(t)):{},h(!t||!t.__esModule?i(a,"default",{value:t,enumerable:!0}):a,t)),M=t=>h(i({},"__esModule",{value:!0}),t),n=(t,e,a)=>(R(t,typeof e!="symbol"?e+"":e,a),a),d={};j(d,{default:()=>l});var _=M(d),y=I(m),c=v,P=w;const W="https://fast.wistia.com/assets/external/E-v1.js",x="Wistia",A="wistia-player-";class l extends y.Component{constructor(){super(...arguments),n(this,"callPlayer",c.callPlayer),n(this,"playerID",this.props.config.playerId||`${A}${(0,c.randomString)()}`),n(this,"onPlay",(...e)=>this.props.onPlay(...e)),n(this,"onPause",(...e)=>this.props.onPause(...e)),n(this,"onSeek",(...e)=>this.props.onSeek(...e)),n(this,"onEnded",(...e)=>this.props.onEnded(...e)),n(this,"onPlaybackRateChange",(...e)=>this.props.onPlaybackRateChange(...e)),n(this,"mute",()=>{this.callPlayer("mute")}),n(this,"unmute",()=>{this.callPlayer("unmute")})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{playing:a,muted:s,controls:r,onReady:o,config:p,onError:b}=this.props;(0,c.getSDK)(W,x).then(f=>{p.customControls&&p.customControls.forEach(u=>f.defineControl(u)),window._wq=window._wq||[],window._wq.push({id:this.playerID,options:{autoPlay:a,silentAutoPlay:"allow",muted:s,controlsVisibleOnLoad:r,fullscreenButton:r,playbar:r,playbackRateControl:r,qualityControl:r,volumeControl:r,settingsControl:r,smallPlayButton:r,...p.options},onReady:u=>{this.player=u,this.unbind(),this.player.bind("play",this.onPlay),this.player.bind("pause",this.onPause),this.player.bind("seek",this.onSeek),this.player.bind("end",this.onEnded),this.player.bind("playbackratechange",this.onPlaybackRateChange),o()}})},b)}unbind(){this.player.unbind("play",this.onPlay),this.player.unbind("pause",this.onPause),this.player.unbind("seek",this.onSeek),this.player.unbind("end",this.onEnded),this.player.unbind("playbackratechange",this.onPlaybackRateChange)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){this.unbind(),this.callPlayer("remove")}seekTo(e,a=!0){this.callPlayer("time",e),a||this.pause()}setVolume(e){this.callPlayer("volume",e)}setPlaybackRate(e){this.callPlayer("playbackRate",e)}getDuration(){return this.callPlayer("duration")}getCurrentTime(){return this.callPlayer("time")}getSecondsLoaded(){return null}render(){const{url:e}=this.props,a=e&&e.match(P.MATCH_URL_WISTIA)[1],s=`wistia_embed wistia_async_${a}`,r={width:"100%",height:"100%"};return y.default.createElement("div",{id:this.playerID,key:a,className:s,style:r})}}n(l,"displayName","Wistia");n(l,"canPlay",P.canPlay.wistia);n(l,"loopOnEnded",!0);const L=g(_),T=O({__proto__:null,default:L},[_]);export{T as W}; diff --git a/assets/YouTube-2MluosuP.js b/assets/YouTube-Bn_mFI0y.js similarity index 98% rename from assets/YouTube-2MluosuP.js rename to assets/YouTube-Bn_mFI0y.js index dbfb242e41..4064e8a466 100644 --- a/assets/YouTube-2MluosuP.js +++ b/assets/YouTube-Bn_mFI0y.js @@ -1 +1 @@ -import{g as U,r as I,u as L,p as M}from"./index-Cb9cdkBC.js";function Y(a,e){for(var t=0;ts[r]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}var k=Object.create,u=Object.defineProperty,N=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,V=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty,x=(a,e,t)=>e in a?u(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,K=(a,e)=>{for(var t in e)u(a,t,{get:e[t],enumerable:!0})},v=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of j(e))!B.call(a,r)&&r!==t&&u(a,r,{get:()=>e[r],enumerable:!(s=N(e,r))||s.enumerable});return a},F=(a,e,t)=>(t=a!=null?k(V(a)):{},v(!a||!a.__esModule?u(t,"default",{value:a,enumerable:!0}):t,a)),H=a=>v(u({},"__esModule",{value:!0}),a),o=(a,e,t)=>(x(a,typeof e!="symbol"?e+"":e,t),t),w={};K(w,{default:()=>O});var S=H(w),b=F(I),p=L,D=M;const G="https://www.youtube.com/iframe_api",T="YT",z="onYouTubeIframeAPIReady",f=/[?&](?:list|channel)=([a-zA-Z0-9_-]+)/,m=/user\/([a-zA-Z0-9_-]+)\/?/,Q=/youtube-nocookie\.com/,Z="https://www.youtube-nocookie.com";class O extends b.Component{constructor(){super(...arguments),o(this,"callPlayer",p.callPlayer),o(this,"parsePlaylist",e=>{if(e instanceof Array)return{listType:"playlist",playlist:e.map(this.getID).join(",")};if(f.test(e)){const[,t]=e.match(f);return{listType:"playlist",list:t.replace(/^UC/,"UU")}}if(m.test(e)){const[,t]=e.match(m);return{listType:"user_uploads",list:t}}return{}}),o(this,"onStateChange",e=>{const{data:t}=e,{onPlay:s,onPause:r,onBuffer:n,onBufferEnd:P,onEnded:_,onReady:g,loop:y,config:{playerVars:l,onUnstarted:h}}=this.props,{UNSTARTED:d,PLAYING:c,PAUSED:i,BUFFERING:E,ENDED:A,CUED:C}=window[T].PlayerState;if(t===d&&h(),t===c&&(s(),P()),t===i&&r(),t===E&&n(),t===A){const R=!!this.callPlayer("getPlaylist");y&&!R&&(l.start?this.seekTo(l.start):this.play()),_()}t===C&&g()}),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unMute")}),o(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}getID(e){return!e||e instanceof Array||f.test(e)?null:e.match(D.MATCH_URL_YOUTUBE)[1]}load(e,t){const{playing:s,muted:r,playsinline:n,controls:P,loop:_,config:g,onError:y}=this.props,{playerVars:l,embedOptions:h}=g,d=this.getID(e);if(t){if(f.test(e)||m.test(e)||e instanceof Array){this.player.loadPlaylist(this.parsePlaylist(e));return}this.player.cueVideoById({videoId:d,startSeconds:(0,p.parseStartTime)(e)||l.start,endSeconds:(0,p.parseEndTime)(e)||l.end});return}(0,p.getSDK)(G,T,z,c=>c.loaded).then(c=>{this.container&&(this.player=new c.Player(this.container,{width:"100%",height:"100%",videoId:d,playerVars:{autoplay:s?1:0,mute:r?1:0,controls:P?1:0,start:(0,p.parseStartTime)(e),end:(0,p.parseEndTime)(e),origin:window.location.origin,playsinline:n?1:0,...this.parsePlaylist(e),...l},events:{onReady:()=>{_&&this.player.setLoop(!0),this.props.onReady()},onPlaybackRateChange:i=>this.props.onPlaybackRateChange(i.data),onPlaybackQualityChange:i=>this.props.onPlaybackQualityChange(i),onStateChange:this.onStateChange,onError:i=>y(i.data)},host:Q.test(e)?Z:void 0,...h}))},y),h.events&&console.warn("Using `embedOptions.events` will likely break things. Use ReactPlayer’s callback props instead, eg onReady, onPlay, onPause")}play(){this.callPlayer("playVideo")}pause(){this.callPlayer("pauseVideo")}stop(){document.body.contains(this.callPlayer("getIframe"))&&this.callPlayer("stopVideo")}seekTo(e,t=!1){this.callPlayer("seekTo",e),!t&&!this.props.playing&&this.pause()}setVolume(e){this.callPlayer("setVolume",e*100)}setPlaybackRate(e){this.callPlayer("setPlaybackRate",e)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentTime")}getSecondsLoaded(){return this.callPlayer("getVideoLoadedFraction")*this.getDuration()}render(){const{display:e}=this.props,t={width:"100%",height:"100%",display:e};return b.default.createElement("div",{style:t},b.default.createElement("div",{ref:this.ref}))}}o(O,"displayName","YouTube");o(O,"canPlay",D.canPlay.youtube);const $=U(S),q=Y({__proto__:null,default:$},[S]);export{q as Y}; +import{g as U,r as I,u as L,p as M}from"./index-3lltu53p.js";function Y(a,e){for(var t=0;ts[r]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}var k=Object.create,u=Object.defineProperty,N=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,V=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty,x=(a,e,t)=>e in a?u(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,K=(a,e)=>{for(var t in e)u(a,t,{get:e[t],enumerable:!0})},v=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of j(e))!B.call(a,r)&&r!==t&&u(a,r,{get:()=>e[r],enumerable:!(s=N(e,r))||s.enumerable});return a},F=(a,e,t)=>(t=a!=null?k(V(a)):{},v(!a||!a.__esModule?u(t,"default",{value:a,enumerable:!0}):t,a)),H=a=>v(u({},"__esModule",{value:!0}),a),o=(a,e,t)=>(x(a,typeof e!="symbol"?e+"":e,t),t),w={};K(w,{default:()=>O});var S=H(w),b=F(I),p=L,D=M;const G="https://www.youtube.com/iframe_api",T="YT",z="onYouTubeIframeAPIReady",f=/[?&](?:list|channel)=([a-zA-Z0-9_-]+)/,m=/user\/([a-zA-Z0-9_-]+)\/?/,Q=/youtube-nocookie\.com/,Z="https://www.youtube-nocookie.com";class O extends b.Component{constructor(){super(...arguments),o(this,"callPlayer",p.callPlayer),o(this,"parsePlaylist",e=>{if(e instanceof Array)return{listType:"playlist",playlist:e.map(this.getID).join(",")};if(f.test(e)){const[,t]=e.match(f);return{listType:"playlist",list:t.replace(/^UC/,"UU")}}if(m.test(e)){const[,t]=e.match(m);return{listType:"user_uploads",list:t}}return{}}),o(this,"onStateChange",e=>{const{data:t}=e,{onPlay:s,onPause:r,onBuffer:n,onBufferEnd:P,onEnded:_,onReady:g,loop:y,config:{playerVars:l,onUnstarted:h}}=this.props,{UNSTARTED:d,PLAYING:c,PAUSED:i,BUFFERING:E,ENDED:A,CUED:C}=window[T].PlayerState;if(t===d&&h(),t===c&&(s(),P()),t===i&&r(),t===E&&n(),t===A){const R=!!this.callPlayer("getPlaylist");y&&!R&&(l.start?this.seekTo(l.start):this.play()),_()}t===C&&g()}),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unMute")}),o(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}getID(e){return!e||e instanceof Array||f.test(e)?null:e.match(D.MATCH_URL_YOUTUBE)[1]}load(e,t){const{playing:s,muted:r,playsinline:n,controls:P,loop:_,config:g,onError:y}=this.props,{playerVars:l,embedOptions:h}=g,d=this.getID(e);if(t){if(f.test(e)||m.test(e)||e instanceof Array){this.player.loadPlaylist(this.parsePlaylist(e));return}this.player.cueVideoById({videoId:d,startSeconds:(0,p.parseStartTime)(e)||l.start,endSeconds:(0,p.parseEndTime)(e)||l.end});return}(0,p.getSDK)(G,T,z,c=>c.loaded).then(c=>{this.container&&(this.player=new c.Player(this.container,{width:"100%",height:"100%",videoId:d,playerVars:{autoplay:s?1:0,mute:r?1:0,controls:P?1:0,start:(0,p.parseStartTime)(e),end:(0,p.parseEndTime)(e),origin:window.location.origin,playsinline:n?1:0,...this.parsePlaylist(e),...l},events:{onReady:()=>{_&&this.player.setLoop(!0),this.props.onReady()},onPlaybackRateChange:i=>this.props.onPlaybackRateChange(i.data),onPlaybackQualityChange:i=>this.props.onPlaybackQualityChange(i),onStateChange:this.onStateChange,onError:i=>y(i.data)},host:Q.test(e)?Z:void 0,...h}))},y),h.events&&console.warn("Using `embedOptions.events` will likely break things. Use ReactPlayer’s callback props instead, eg onReady, onPlay, onPause")}play(){this.callPlayer("playVideo")}pause(){this.callPlayer("pauseVideo")}stop(){document.body.contains(this.callPlayer("getIframe"))&&this.callPlayer("stopVideo")}seekTo(e,t=!1){this.callPlayer("seekTo",e),!t&&!this.props.playing&&this.pause()}setVolume(e){this.callPlayer("setVolume",e*100)}setPlaybackRate(e){this.callPlayer("setPlaybackRate",e)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentTime")}getSecondsLoaded(){return this.callPlayer("getVideoLoadedFraction")*this.getDuration()}render(){const{display:e}=this.props,t={width:"100%",height:"100%",display:e};return b.default.createElement("div",{style:t},b.default.createElement("div",{ref:this.ref}))}}o(O,"displayName","YouTube");o(O,"canPlay",D.canPlay.youtube);const $=U(S),q=Y({__proto__:null,default:$},[S]);export{q as Y}; diff --git a/assets/index-Cb9cdkBC.js b/assets/index-3lltu53p.js similarity index 99% rename from assets/index-Cb9cdkBC.js rename to assets/index-3lltu53p.js index ed2cbf6143..5f60b266d1 100644 --- a/assets/index-Cb9cdkBC.js +++ b/assets/index-3lltu53p.js @@ -449,7 +449,7 @@ use chrome, FireFox or Internet Explorer 11`)}var a=safeBufferExports,$=requireB `):" "+renderReason(tt[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+rt,"ERR_NOT_SUPPORT")}return j},adapters:knownAdapters};function throwIfCancellationRequested(_){if(_.cancelToken&&_.cancelToken.throwIfRequested(),_.signal&&_.signal.aborted)throw new CanceledError(null,_)}function dispatchRequest(_){return throwIfCancellationRequested(_),_.headers=AxiosHeaders.from(_.headers),_.data=transformData.call(_,_.transformRequest),["post","put","patch"].indexOf(_.method)!==-1&&_.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(_.adapter||defaults$1.adapter)(_).then(function(j){return throwIfCancellationRequested(_),j.data=transformData.call(_,_.transformResponse,j),j.headers=AxiosHeaders.from(j.headers),j},function(j){return isCancel(j)||(throwIfCancellationRequested(_),j&&j.response&&(j.response.data=transformData.call(_,_.transformResponse,j.response),j.response.headers=AxiosHeaders.from(j.response.headers))),Promise.reject(j)})}const VERSION$2="1.7.2",validators$1={};["object","boolean","number","function","string","symbol"].forEach((_,a)=>{validators$1[_]=function(j){return typeof j===_||"a"+(a<1?"n ":" ")+_}});const deprecatedWarnings={};validators$1.transitional=function _(a,$,j){function et(tt,rt){return"[Axios v"+VERSION$2+"] Transitional option '"+tt+"'"+rt+(j?". "+j:"")}return(tt,rt,nt)=>{if(a===!1)throw new AxiosError(et(rt," has been removed"+($?" in "+$:"")),AxiosError.ERR_DEPRECATED);return $&&!deprecatedWarnings[rt]&&(deprecatedWarnings[rt]=!0,console.warn(et(rt," has been deprecated since v"+$+" and will be removed in the near future"))),a?a(tt,rt,nt):!0}};function assertOptions(_,a,$){if(typeof _!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const j=Object.keys(_);let et=j.length;for(;et-- >0;){const tt=j[et],rt=a[tt];if(rt){const nt=_[tt],it=nt===void 0||rt(nt,tt,_);if(it!==!0)throw new AxiosError("option "+tt+" must be "+it,AxiosError.ERR_BAD_OPTION_VALUE);continue}if($!==!0)throw new AxiosError("Unknown option "+tt,AxiosError.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(a){this.defaults=a,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(a,$){try{return await this._request(a,$)}catch(j){if(j instanceof Error){let et;Error.captureStackTrace?Error.captureStackTrace(et={}):et=new Error;const tt=et.stack?et.stack.replace(/^.+\n/,""):"";try{j.stack?tt&&!String(j.stack).endsWith(tt.replace(/^.+\n.+\n/,""))&&(j.stack+=` `+tt):j.stack=tt}catch{}}throw j}}_request(a,$){typeof a=="string"?($=$||{},$.url=a):$=a||{},$=mergeConfig(this.defaults,$);const{transitional:j,paramsSerializer:et,headers:tt}=$;j!==void 0&&validator.assertOptions(j,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),et!=null&&(utils$4.isFunction(et)?$.paramsSerializer={serialize:et}:validator.assertOptions(et,{encode:validators.function,serialize:validators.function},!0)),$.method=($.method||this.defaults.method||"get").toLowerCase();let rt=tt&&utils$4.merge(tt.common,tt[$.method]);tt&&utils$4.forEach(["delete","get","head","post","put","patch","common"],Et=>{delete tt[Et]}),$.headers=AxiosHeaders.concat(rt,tt);const nt=[];let it=!0;this.interceptors.request.forEach(function(St){typeof St.runWhen=="function"&&St.runWhen($)===!1||(it=it&&St.synchronous,nt.unshift(St.fulfilled,St.rejected))});const ot=[];this.interceptors.response.forEach(function(St){ot.push(St.fulfilled,St.rejected)});let st,ct=0,ut;if(!it){const Et=[dispatchRequest.bind(this),void 0];for(Et.unshift.apply(Et,nt),Et.push.apply(Et,ot),ut=Et.length,st=Promise.resolve($);ct{if(!j._listeners)return;let tt=j._listeners.length;for(;tt-- >0;)j._listeners[tt](et);j._listeners=null}),this.promise.then=et=>{let tt;const rt=new Promise(nt=>{j.subscribe(nt),tt=nt}).then(et);return rt.cancel=function(){j.unsubscribe(tt)},rt},a(function(tt,rt,nt){j.reason||(j.reason=new CanceledError(tt,rt,nt),$(j.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(a){if(this.reason){a(this.reason);return}this._listeners?this._listeners.push(a):this._listeners=[a]}unsubscribe(a){if(!this._listeners)return;const $=this._listeners.indexOf(a);$!==-1&&this._listeners.splice($,1)}static source(){let a;return{token:new CancelToken(function(et){a=et}),cancel:a}}}function spread(_){return function($){return _.apply(null,$)}}function isAxiosError(_){return utils$4.isObject(_)&&_.isAxiosError===!0}const HttpStatusCode={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode).forEach(([_,a])=>{HttpStatusCode[a]=_});function createInstance(_){const a=new Axios(_),$=bind$1(Axios.prototype.request,a);return utils$4.extend($,Axios.prototype,a,{allOwnKeys:!0}),utils$4.extend($,a,null,{allOwnKeys:!0}),$.create=function(et){return createInstance(mergeConfig(_,et))},$}const axios=createInstance(defaults$1);axios.Axios=Axios;axios.CanceledError=CanceledError;axios.CancelToken=CancelToken;axios.isCancel=isCancel;axios.VERSION=VERSION$2;axios.toFormData=toFormData;axios.AxiosError=AxiosError;axios.Cancel=axios.CanceledError;axios.all=function _(a){return Promise.all(a)};axios.spread=spread;axios.isAxiosError=isAxiosError;axios.mergeConfig=mergeConfig;axios.AxiosHeaders=AxiosHeaders;axios.formToJSON=_=>formDataToJSON(utils$4.isHTMLForm(_)?new FormData(_):_);axios.getAdapter=adapters.getAdapter;axios.HttpStatusCode=HttpStatusCode;axios.default=axios;var MatrixMessageType;(function(_){_.TEXT="m.text"})(MatrixMessageType||(MatrixMessageType={}));class MatrixMessage{constructor(a,$,j,et){Vr(this,"type");Vr(this,"sender");Vr(this,"content");Vr(this,"timestamp");this.type=a,this.sender=$,this.content=j,this.timestamp=et}static from(a){if(isTextMessageEvent(a))return new MatrixMessage(a.content.msgtype,a.sender,a.content.body,a.origin_server_ts)}}const isCreateEvent=_=>_.type==="m.room.create"&&_.content instanceof Object&&"creator"in _.content,isJoinEvent=_=>_.type==="m.room.member"&&_.content instanceof Object&&"membership"in _.content&&_.content.membership==="join",isMessageEvent=_=>_.type==="m.room.message",isTextMessageEvent=_=>isMessageEvent(_)&&_.content instanceof Object&&"msgtype"in _.content&&_.content.msgtype===MatrixMessageType.TEXT;var MatrixRoomStatus;(function(_){_[_.UNKNOWN=0]="UNKNOWN",_[_.JOINED=1]="JOINED",_[_.INVITED=2]="INVITED",_[_.LEFT=3]="LEFT"})(MatrixRoomStatus||(MatrixRoomStatus={}));class MatrixRoom{constructor(a,$=MatrixRoomStatus.UNKNOWN,j=[],et=[]){Vr(this,"id");Vr(this,"status");Vr(this,"members");Vr(this,"messages");this.id=a,this.status=$,this.members=j,this.messages=et}static fromSync(a){if(!a)return[];function $(j,et){return Object.entries(j).map(([tt,rt])=>et(tt,rt))}return[...$(a.join??{},MatrixRoom.fromJoined),...$(a.invite??{},MatrixRoom.fromInvited),...$(a.leave??{},MatrixRoom.fromLeft)]}static from(a,$){return typeof a=="string"?new MatrixRoom(a,$||MatrixRoomStatus.UNKNOWN):$!==void 0?new MatrixRoom(a.id,$,a.members,a.messages):a}static merge(a,$){return!$||$.id!==a.id?MatrixRoom.from(a):new MatrixRoom(a.id,a.status,[...$.members,...a.members].filter((j,et,tt)=>tt.indexOf(j)===et),[...$.messages,...a.messages])}static fromJoined(a,$){const j=[...$.state.events,...$.timeline.events],et=MatrixRoom.getMembersFromEvents(j),tt=MatrixRoom.getMessagesFromEvents(j);return new MatrixRoom(a,MatrixRoomStatus.JOINED,et,tt)}static fromInvited(a,$){const j=MatrixRoom.getMembersFromEvents($.invite_state.events);return new MatrixRoom(a,MatrixRoomStatus.INVITED,j)}static fromLeft(a,$){const j=[...$.state.events,...$.timeline.events],et=MatrixRoom.getMembersFromEvents(j),tt=MatrixRoom.getMessagesFromEvents(j);return new MatrixRoom(a,MatrixRoomStatus.LEFT,et,tt)}static getMembersFromEvents(a){return MatrixRoom.getUniqueEvents(a.filter($=>isCreateEvent($)||isJoinEvent($))).map($=>$.sender).filter(($,j,et)=>et.indexOf($)===j)}static getMessagesFromEvents(a){return MatrixRoom.getUniqueEvents(a.filter(isMessageEvent)).map($=>MatrixMessage.from($)).filter(Boolean)}static getUniqueEvents(a){const $={},j=[];return a.forEach((et,tt)=>{const rt=et.event_id;(rt===void 0||!(rt in $))&&(rt!==void 0&&($[rt]=tt),j.push(et))}),j}}const PRESERVED_FIELDS=["syncToken","rooms"];class MatrixClientStore{constructor(a){Vr(this,"storage");Vr(this,"state",{isRunning:!1,userId:void 0,deviceId:void 0,txnNo:0,accessToken:void 0,syncToken:void 0,pollingTimeout:void 0,pollingRetries:0,rooms:{}});Vr(this,"onStateChangedListeners",new Map);Vr(this,"waitReadyPromise");this.storage=a,this.waitReadyPromise=new Promise(async($,j)=>{try{await this.initFromStorage(),$()}catch(et){j(et)}})}get(a){return this.state[a]}getRoom(a){const $=MatrixRoom.from(a,MatrixRoomStatus.UNKNOWN);return this.state.rooms[$.id]||$}async update(a){await this.waitReady();const $=Object.assign({},this.state);this.setState(a),this.updateStorage(a),this.notifyListeners($,this.state,a)}onStateChanged(a,...$){$.length>0?$.forEach(j=>{this.onStateChangedListeners.set(j,a)}):this.onStateChangedListeners.set("all",a)}async waitReady(){return this.waitReadyPromise}async initFromStorage(){const a=await this.storage.get(StorageKey.MATRIX_PRESERVED_STATE);this.setState(a)}prepareData(a){const j=["rooms"].some(et=>a[et]!==void 0)?JSON.parse(JSON.stringify(a)):a;return Object.values(j.rooms||{}).forEach(et=>{et.messages=[]}),j}updateStorage(a){if(Object.entries(a).filter(([j,et])=>PRESERVED_FIELDS.includes(j)&&!!et).length>0){const j={};PRESERVED_FIELDS.forEach(et=>{j[et]=this.state[et]}),this.storage.set(StorageKey.MATRIX_PRESERVED_STATE,this.prepareData(j))}}setState(a){this.state={isRunning:a.isRunning||this.state.isRunning,userId:a.userId||this.state.userId,deviceId:a.deviceId||this.state.deviceId,txnNo:a.txnNo||this.state.txnNo,accessToken:a.accessToken||this.state.accessToken,syncToken:a.syncToken||this.state.syncToken,pollingTimeout:a.pollingTimeout||this.state.pollingTimeout,pollingRetries:a.pollingRetries||this.state.pollingRetries,rooms:this.mergeRooms(this.state.rooms,a.rooms)}}mergeRooms(a,$){if(!$)return a;const j=Array.isArray($)?$:Object.values($),et=Object.assign({},a);return j.forEach(tt=>{et[tt.id]=MatrixRoom.merge(tt,a[tt.id])}),et}notifyListeners(a,$,j){const et=this.onStateChangedListeners.get("all");et&&et(a,$,j),keys(j).filter(tt=>j[tt]!==void 0).forEach(tt=>{const rt=this.onStateChangedListeners.get(tt);rt&&rt(a,$,j)})}}const logger$6=new Logger("MatrixHttpClient"),CLIENT_API_R0="/_matrix/client/r0";class MatrixHttpClient{constructor(a){Vr(this,"baseUrl");Vr(this,"cancelTokenSource");this.baseUrl=a,this.cancelTokenSource=axios.CancelToken.source()}async get(a,$,j){return this.send("GET",a,j,$)}async post(a,$,j,et){return this.send("POST",a,j,et,$)}async put(a,$,j,et){return this.send("PUT",a,j,et,$)}async cancelAllRequests(){return this.cancelTokenSource.cancel("Manually cancelled")}async send(a,$,j,et,tt){const rt=j?this.getHeaders(j):void 0,nt=et?this.getParams(et):void 0;let it;try{it=await axios.request({method:a,url:$,baseURL:this.apiUrl(CLIENT_API_R0),headers:rt,data:tt,params:nt,cancelToken:this.cancelTokenSource.token})}catch(ot){const st=ot;throw logger$6.error("send",st.code,st.message,st.response.data),ot.response.data}return it.data}getHeaders(a){const $={},j=[];if(a.accessToken&&j.push(["Authorization",`Bearer ${a.accessToken}`]),j.length!==0){for(const[et,tt]of j)$[et]=tt;return $}}getParams(a){if(!a)return;const $=Object.assign(a,{});return keys($).forEach(j=>$[j]===void 0&&delete $[j]),$}apiUrl(...a){const $=this.baseUrl.endsWith("/")?this.baseUrl.substr(0,this.baseUrl.length-1):this.baseUrl,j=a.map(et=>et.startsWith("/")?et.substr(1):et);return[$,...j].join("/")}}class MatrixRoomService{constructor(a){Vr(this,"httpClient");this.httpClient=a}async createRoom(a,$={}){return this.httpClient.post("/createRoom",$,{accessToken:a})}async inviteToRoom(a,$,j){return j.status!==MatrixRoomStatus.JOINED&&j.status!==MatrixRoomStatus.UNKNOWN?Promise.reject(`User is not a member of room ${j.id}.`):this.httpClient.post(`/rooms/${encodeURIComponent(j.id)}/invite`,{user_id:$},{accessToken:a})}async joinRoom(a,$){return $.status===MatrixRoomStatus.JOINED?Promise.resolve({room_id:$.id}):this.httpClient.post(`/rooms/${encodeURIComponent($.id)}/join`,{},{accessToken:a})}async getJoinedRooms(a){return this.httpClient.get("/joined_rooms",void 0,{accessToken:a})}}class MatrixUserService{constructor(a){Vr(this,"httpClient");this.httpClient=a}async login(a,$,j){return this.httpClient.post("/login",{type:"m.login.password",identifier:{type:"m.id.user",user:a},password:$,device_id:j})}}class MatrixEventService{constructor(a){Vr(this,"httpClient");Vr(this,"cachedPromises",new Map);this.httpClient=a}async sync(a,$){return this.withCache("sync",()=>this.httpClient.get("/sync",{timeout:$?$.pollingTimeout:void 0,since:$?$.syncToken:void 0},{accessToken:a}))}async sendMessage(a,$,j,et){return new Promise((tt,rt)=>this.scheduleEvent({accessToken:a,roomId:$,type:"m.room.message",content:j,txnId:et,onSuccess:tt,onError:rt}))}scheduleEvent(a){this.sendEvent(a)}async sendEvent(a){const{roomId:$,type:j,txnId:et,content:tt,accessToken:rt}=a;try{const nt=await this.httpClient.put(`/rooms/${encodeURIComponent($)}/send/${j}/${encodeURIComponent(et)}`,tt,{accessToken:rt});a.onSuccess(nt)}catch(nt){a.onError(nt)}}withCache(a,$){let j=this.cachedPromises.get(a);return j||(j=$().finally(()=>{this.cachedPromises.delete(a)}),this.cachedPromises.set(a,j)),j}}class EventEmitter{constructor(){Vr(this,"events",{})}on(a,$){return typeof this.events[a]!="object"&&(this.events[a]=[]),this.events[a].push($),()=>this.removeListener(a,$)}removeListener(a,$){if(typeof this.events[a]!="object")return;if(!$){this.events[a]=[];return}const j=this.events[a].indexOf($);j>-1&&this.events[a].splice(j,1)}removeAllListeners(){Object.keys(this.events).forEach(a=>this.events[a].splice(0,this.events[a].length))}emit(a,...$){typeof this.events[a]=="object"&&[...this.events[a]].forEach(j=>j.apply(this,$))}once(a,$){const j=this.on(a,(...et)=>{j(),$.apply(this,et)});return j}}var MatrixClientEventType;(function(_){_.INVITE="invite",_.MESSAGE="message"})(MatrixClientEventType||(MatrixClientEventType={}));class MatrixClientEventEmitter extends EventEmitter{constructor(){super(...arguments);Vr(this,"eventEmitProviders",new Map([[MatrixClientEventType.INVITE,()=>[this.isInvite,this.emitInvite.bind(this)]],[MatrixClientEventType.MESSAGE,()=>[this.isMessage,this.emitMessage.bind(this)]]]))}onStateChanged($,j,et){for(const tt of keys(MatrixClientEventType))this.emitIfEvent(MatrixClientEventType[tt],et)}emitIfEvent($,j){const et=this.eventEmitProviders.get($);if(et){const[tt,rt]=et();tt(j)&&rt($,j)}}emitClientEvent($,j,et){this.emit($,{type:$,content:j,timestamp:et})}isInvite($){return $.rooms?$.rooms.some(j=>j.status===MatrixRoomStatus.INVITED):!1}emitInvite($,j){j.rooms.filter(et=>et.status===MatrixRoomStatus.INVITED).map(et=>[et.id,et.members]).forEach(([et,tt])=>{this.emitClientEvent($,{roomId:et,members:tt})})}isMessage($){return $.rooms?$.rooms.some(j=>j.messages.length>0):!1}emitMessage($,j){j.rooms.filter(et=>et.messages.length>0).map(et=>et.messages.map(tt=>[et.id,tt,tt.timestamp])).reduce((et,tt)=>et.concat(tt),[]).forEach(([et,tt,rt])=>{this.emitClientEvent($,{roomId:et,message:tt},rt)})}}const logger$5=new Logger("MatrixClient"),IMMEDIATE_POLLING_RETRIES=3,RETRY_INTERVAL=5e3;class MatrixClient{constructor(a,$,j,et,tt,rt){Vr(this,"store");Vr(this,"eventEmitter");Vr(this,"userService");Vr(this,"roomService");Vr(this,"eventService");Vr(this,"httpClient");Vr(this,"isActive",!0);Vr(this,"_isReady",new ExposedPromise);this.store=a,this.eventEmitter=$,this.userService=j,this.roomService=et,this.eventService=tt,this.httpClient=rt,this.store.onStateChanged((nt,it,ot)=>{this.eventEmitter.onStateChanged(nt,it,ot)},"rooms")}static create(a){const $=new MatrixClientStore(a.storage),j=new MatrixClientEventEmitter,et=new MatrixHttpClient(a.baseUrl),tt=new MatrixUserService(et),rt=new MatrixRoomService(et),nt=new MatrixEventService(et);return new MatrixClient($,j,tt,rt,nt,et)}get joinedRooms(){return new Promise(async a=>{await this.isConnected(),a(Object.values(this.store.get("rooms")).filter($=>$.status===MatrixRoomStatus.JOINED))})}get invitedRooms(){return new Promise(async a=>{await this.isConnected(),a(Object.values(this.store.get("rooms")).filter($=>$.status===MatrixRoomStatus.INVITED))})}get leftRooms(){return new Promise(async a=>{await this.isConnected(),a(Object.values(this.store.get("rooms")).filter($=>$.status===MatrixRoomStatus.LEFT))})}async start(a){const $=await this.userService.login(a.id,a.password,a.deviceId);await this.store.update({accessToken:$.access_token});const j=new Promise(async(et,tt)=>{await this.poll(0,async rt=>{this.store.get("isRunning")||et(),await this.store.update({isRunning:!0,syncToken:rt.next_batch,pollingTimeout:3e4,pollingRetries:0,rooms:MatrixRoom.fromSync(rt.rooms)})},async rt=>{this.store.get("isRunning")||tt(rt),await this.store.update({isRunning:!1,pollingRetries:this.store.get("pollingRetries")+1})})});return j.then(()=>{this._isReady.resolve()}).catch(console.error),j}async isConnected(){return this._isReady.promise}async stop(){return logger$5.log("MATRIX CLIENT STOPPED"),this.isActive=!1,this._isReady=new ExposedPromise,this.httpClient.cancelAllRequests()}subscribe(a,$){this.eventEmitter.on(a,$)}unsubscribe(a,$){$&&this.eventEmitter.removeListener(a,$)}unsubscribeAll(a){this.eventEmitter.removeListener(a)}async getRoomById(a){return await this.isConnected(),this.store.getRoom(a)}async createTrustedPrivateRoom(...a){return await this.isConnected(),this.requiresAuthorization("createRoom",async $=>(await this.roomService.createRoom($,{room_version:"5",invite:a,preset:"public_chat",is_direct:!0})).room_id)}async inviteToRooms(a,...$){await this.isConnected(),await this.requiresAuthorization("invite",j=>Promise.all($.map(et=>{const tt=this.store.getRoom(et);this.roomService.inviteToRoom(j,a,tt).catch(rt=>logger$5.warn("inviteToRooms",rt))})))}async joinRooms(...a){await this.isConnected(),await this.requiresAuthorization("join",$=>Promise.all(a.map(j=>{const et=this.store.getRoom(j);return this.roomService.joinRoom($,et)})))}async sendTextMessage(a,$){await this.isConnected(),await this.requiresAuthorization("send",async j=>{const et=await this.createTxnId();return this.eventService.sendMessage(j,a,{msgtype:"m.text",body:$},et)})}async poll(a,$,j){const et=this.store,tt=this.sync.bind(this),rt=async(nt,it)=>{let ot=0;try{const st=await tt();$(st)}catch(st){j(st),ot=et.get("pollingRetries"),this.isActive&&logger$5.log(`Retry syncing... ${ot} retries so far`)}finally{this.isActive?setTimeout(async()=>{await rt(nt,it)},ot>IMMEDIATE_POLLING_RETRIES?RETRY_INTERVAL+a:a):it(new Error("Syncing stopped manually."))}};return new Promise(rt)}async sync(){return this.requiresAuthorization("sync",async a=>this.eventService.sync(a,{pollingTimeout:this.store.get("pollingTimeout"),syncToken:this.store.get("syncToken")}))}async requiresAuthorization(a,$){const j=this.store.get("accessToken");return j?$(j):Promise.reject(`${a} requires authorization but no access token has been provided.`)}async createTxnId(){const a=new Date().getTime(),$=this.store.get("txnNo");return await this.store.update({txnNo:$+1}),`m${a}.${$}`}}const logger$4=new Logger("P2PCommunicationClient"),RESPONSE_WAIT_TIME_MS=1e3,REGIONS_AND_SERVERS={[Regions.EUROPE_WEST]:["beacon-node-1.diamond.papers.tech","beacon-node-1.sky.papers.tech","beacon-node-2.sky.papers.tech","beacon-node-1.hope.papers.tech","beacon-node-1.hope-2.papers.tech","beacon-node-1.hope-3.papers.tech","beacon-node-1.hope-4.papers.tech","beacon-node-1.hope-5.papers.tech"],[Regions.NORTH_AMERICA_EAST]:["beacon-node-1.beacon-server-1.papers.tech"],[Regions.NORTH_AMERICA_WEST]:["beacon-node-1.beacon-server-2.papers.tech"],[Regions.ASIA_EAST]:["beacon-node-1.beacon-server-3.papers.tech"],[Regions.AUSTRALIA]:["beacon-node-1.beacon-server-4.papers.tech"]},sleep$2=_=>new Promise(a=>setTimeout(a,_));class P2PCommunicationClient extends CommunicationClient{constructor($,j,et,tt,rt,nt,it){super(j);Vr(this,"name");Vr(this,"replicationCount");Vr(this,"storage");Vr(this,"iconUrl");Vr(this,"appUrl");Vr(this,"client",new ExposedPromise);Vr(this,"initialEvent");Vr(this,"initialListener");Vr(this,"selectedRegion");Vr(this,"ENABLED_RELAY_SERVERS");Vr(this,"relayServer");Vr(this,"activeListeners",new Map);Vr(this,"ignoredRooms",[]);Vr(this,"loginCounter",0);this.name=$,this.replicationCount=et,this.storage=tt,this.iconUrl=nt,this.appUrl=it,logger$4.log("constructor","P2PCommunicationClient created"),this.ENABLED_RELAY_SERVERS=REGIONS_AND_SERVERS,rt&&(this.ENABLED_RELAY_SERVERS={...REGIONS_AND_SERVERS,...rt})}async getPairingRequestInfo(){const $=new P2PPairingRequest(await generateGUID(),this.name,await this.getPublicKey(),BEACON_VERSION,(await this.getRelayServer()).server);return this.iconUrl&&($.icon=this.iconUrl),this.appUrl&&($.appUrl=this.appUrl),$}async getPairingResponseInfo($){const j=new P2PPairingResponse($.id,this.name,await this.getPublicKey(),$.version,(await this.getRelayServer()).server);return this.iconUrl&&(j.icon=this.iconUrl),this.appUrl&&(j.appUrl=this.appUrl),j}async findBestRegionAndGetServer(){var ot;if(this.selectedRegion)return(ot=this.relayServer)==null?void 0:ot.promiseResult;const $=Object.keys(this.ENABLED_RELAY_SERVERS),j=[],et=new ExposedPromise;let tt=0;const rt=new ExposedPromise;$.forEach(st=>{const ct=this.ENABLED_RELAY_SERVERS[st]??[];if(ct.length===0)return;tt+=2;const ut=(St=!0)=>{const Mt=Date.now();Promise.race([this.getBeaconInfo(Et),rt.promise]).then(kt=>{typeof kt!="boolean"&&(j.push({time:Date.now()-Mt,server:Et,region:st,result:kt}),j.length>=tt&&et.resolve(void 0),St||ut(!0))})},ht=Math.floor(Math.random()*ct.length),Et=ct[ht];ut(!1)}),await Promise.race([et.promise,sleep$2(RESPONSE_WAIT_TIME_MS)]);let nt=0;for(;j.length<=0;){if(nt>=100)throw new Error("No server responded.");await sleep$2(50),nt++}rt.resolve(!0);const it=j.reduce((st,ct)=>st.time0){const et=await this.getBeaconInfo($);return this.relayServer.resolve({server:$,timestamp:et.timestamp,localTimestamp:new Date().getTime()}),{server:$,timestamp:et.timestamp}}const j=await this.findBestRegionAndGetServer();if(!j)throw new Error("No servers found");return this.storage.set(StorageKey.MATRIX_SELECTED_NODE,j.server).catch(et=>logger$4.log(et)),this.relayServer.resolve({server:j.server,timestamp:j.timestamp,localTimestamp:new Date().getTime()}),{server:j.server,timestamp:j.timestamp}}async getBeaconInfo($){return axios.get(`https://${$}/_synapse/client/beacon/info`).then(j=>({region:j.data.region,known_servers:j.data.known_servers,timestamp:Math.floor(j.data.timestamp)}))}async tryJoinRooms($,j=1){try{await(await this.client.promise).joinRooms($)}catch(et){j<=10&&et.errcode==="M_FORBIDDEN"?(logger$4.log("Retrying to join...",et),setTimeout(async()=>{await this.tryJoinRooms($,j+1)},200)):logger$4.log(`Failed to join after ${j} tries.`,et)}}async start(){logger$4.log("start","starting client"),logger$4.log("start","connecting to server");const $=await this.getRelayServer(),j=MatrixClient.create({baseUrl:`https://${$.server}`,storage:this.storage});if(this.initialListener=async ot=>{this.initialEvent&&this.initialEvent.timestamp&&ot&&ot.timestamp?this.initialEvent.timestamp{let st;ot.content.members.length===1&&(st=ot.content.members[0]),await this.tryJoinRooms(ot.content.roomId),st&&(await this.updateRelayServer(st),await this.updatePeerRoom(st,ot.content.roomId))}),!$.timestamp)throw new Error("No timestamp received from relay server");const et=Math.floor($.timestamp),tt=`login:${Math.floor(et/(5*60))}`;logger$4.log("start",`login ${tt}, ${await this.getPublicKeyHash()} on ${$.server}`);const rt=blake2b$1.hash(encode_1(tt),32),nt=this.keyPair.secretKey??this.keyPair.privateKey,it=ed25519.sign(nt,rt);try{await j.start({id:await this.getPublicKeyHash(),password:`ed:${toHex$1(it)}:${await this.getPublicKey()}`,deviceId:toHex$1(this.keyPair.publicKey)})}catch{if(logger$4.error("start","Could not log in, retrying"),await this.reset(),!this.selectedRegion)throw new Error("No region selected.");if(this.loginCounter<=(this.ENABLED_RELAY_SERVERS[this.selectedRegion]??[]).length){this.loginCounter++,this.start();return}else throw logger$4.error("start","Tried to log in to every known beacon node, but no login was successful."),new Error("Could not connect to any beacon nodes. Try again later.")}logger$4.log("start","login successful, client is ready"),this.client.resolve(j)}async stop(){logger$4.log("stop","stopping client"),this.client.isResolved()&&await(await this.client.promise).stop().catch($=>logger$4.error($)),await this.reset()}async reset(){logger$4.log("reset","resetting connection"),await this.storage.delete(StorageKey.MATRIX_PEER_ROOM_IDS).catch($=>logger$4.log($)),await this.storage.delete(StorageKey.MATRIX_PRESERVED_STATE).catch($=>logger$4.log($)),await this.storage.delete(StorageKey.MATRIX_SELECTED_NODE).catch($=>logger$4.log($)),this.relayServer=void 0,this.client=new ExposedPromise,this.initialEvent=void 0,this.initialListener=void 0}async listenForEncryptedMessage($,j){if(this.activeListeners.has($))return;logger$4.log("listenForEncryptedMessage",`start listening for encrypted messages from publicKey ${$}`);const et=await this.createCryptoBoxServer($,this.keyPair),tt=async it=>{if(this.isTextMessage(it.content)&&await this.isSender(it,$)){let ot;await this.updateRelayServer(it.content.message.sender),await this.updatePeerRoom(it.content.message.sender,it.content.roomId);try{ot=Buffer$g.from(it.content.message.content,"hex")}catch{}if(ot&&ot.length>=secretbox_NONCEBYTES+secretbox_MACBYTES)try{const st=await decryptCryptoboxPayload(ot,et.receive);logger$4.log("listenForEncryptedMessage",`received a message from ${$}`,st),j(st)}catch{}}};this.activeListeners.set($,tt),(await this.client.promise).subscribe(MatrixClientEventType.MESSAGE,tt);const rt=this.initialEvent;rt&&rt.timestamp&&new Date().getTime()-rt.timestamp<5*60*1e3?(logger$4.log("listenForEncryptedMessage","Handling previous event"),await tt(rt)):logger$4.log("listenForEncryptedMessage","No previous event found");const nt=this.initialListener;nt&&(await this.client.promise).unsubscribe(MatrixClientEventType.MESSAGE,nt),this.initialListener=void 0,this.initialEvent=void 0}async unsubscribeFromEncryptedMessage($){const j=this.activeListeners.get($);j&&((await this.client.promise).unsubscribe(MatrixClientEventType.MESSAGE,j),this.activeListeners.delete($))}async unsubscribeFromEncryptedMessages(){(await this.client.promise).unsubscribeAll(MatrixClientEventType.MESSAGE),this.activeListeners.clear()}async sendMessage($,j){const et=await this.createCryptoBoxClient(j.publicKey,this.keyPair),tt=await getHexHash(Buffer$g.from(j.publicKey,"hex")),rt=recipientString(tt,j.relayServer),nt=await this.getRelevantRoom(rt),it=await encryptCryptoboxPayload($,et.send);logger$4.log("sendMessage","sending encrypted message",j.publicKey,nt,$),(await this.client.promise).sendTextMessage(nt,it).catch(async ot=>{if(ot.errcode==="M_FORBIDDEN"){logger$4.log("sendMessage","M_FORBIDDEN",nt,ot),await this.deleteRoomIdFromRooms(nt);const st=await this.getRelevantRoom(rt);logger$4.log("sendMessage","Old room deleted, new room created",st),(await this.client.promise).sendTextMessage(st,it).catch(async ct=>{logger$4.log("sendMessage","inner error",st,ct)})}else logger$4.log("sendMessage","unexpected error",ot)})}async updatePeerRoom($,j){logger$4.log("updatePeerRoom",$,j);const et=$.split(":");if(et.length<2||!et[0].startsWith("@"))throw new Error("Invalid sender");const tt=await this.storage.get(StorageKey.MATRIX_PEER_ROOM_IDS),rt=tt[$];rt===j&&logger$4.debug("updatePeerRoom","rooms are the same, not updating"),logger$4.debug("updatePeerRoom","current room",rt,"new room",j),rt&&rt[1]&&(logger$4.log("updatePeerRoom",`adding room "${rt[1]}" to ignored array`),this.ignoredRooms.push(rt[1])),tt[$]=j,await this.storage.set(StorageKey.MATRIX_PEER_ROOM_IDS,tt)}async deleteRoomIdFromRooms($){const j=await this.storage.get(StorageKey.MATRIX_PEER_ROOM_IDS),et=Object.entries(j).filter(tt=>tt[1]!==$).reduce((tt,rt)=>({...tt,[rt[0]]:rt[1]}),{});await this.storage.set(StorageKey.MATRIX_PEER_ROOM_IDS,et),this.ignoredRooms.push($)}async listenForChannelOpening($){logger$4.debug("listenForChannelOpening"),(await this.client.promise).subscribe(MatrixClientEventType.MESSAGE,async j=>{if(this.isTextMessage(j.content)&&await this.isChannelOpenMessage(j.content)){logger$4.log("listenForChannelOpening","channel opening received, trying to decrypt",JSON.stringify(j)),await this.updateRelayServer(j.content.message.sender),await this.updatePeerRoom(j.content.message.sender,j.content.roomId);const et=j.content.message.content.split(":"),tt=Buffer$g.from(et[et.length-1],"hex");if(tt.length>=secretbox_NONCEBYTES+secretbox_MACBYTES)try{const rt=JSON.parse(await openCryptobox(tt,this.keyPair.publicKey,this.keyPair.secretKey));logger$4.log("listenForChannelOpening","channel opening received and decrypted",JSON.stringify(rt)),$({...rt,senderId:await getSenderId(rt.publicKey)})}catch{}}})}async waitForJoin($,j=0){const et=await(await this.client.promise).getRoomById($);if(logger$4.log("waitForJoin",`Currently ${et.members.length} members, we need at least 2`),!(et.members.length>=2)){if(j<=200)return logger$4.log(`Waiting for join... Try: ${j}`),new Promise(tt=>{setTimeout(()=>{tt(this.waitForJoin($,j+1))},100*(j>50?10:1))});throw new Error(`No one joined after ${j} tries.`)}}async sendPairingResponse($){logger$4.log("sendPairingResponse");const j=await getHexHash(Buffer$g.from($.publicKey,"hex")),et=recipientString(j,$.relayServer),tt=await(await this.client.promise).createTrustedPrivateRoom(et);logger$4.debug("sendPairingResponse",`Connecting to room "${tt}"`),await this.updatePeerRoom(et,tt),await this.waitForJoin(tt),logger$4.debug("sendPairingResponse","Successfully joined room.");const rt=typeof $.version>"u"?await this.getPublicKey():JSON.stringify(await this.getPairingResponseInfo($));logger$4.debug("sendPairingResponse","Sending pairing response",rt);const nt=await this.encryptMessageAsymmetric($.publicKey,rt),it=["@channel-open",et,nt].join(":");(await this.client.promise).sendTextMessage(tt,it).catch(async ot=>{if(ot.errcode==="M_FORBIDDEN"){logger$4.log("sendPairingResponse","M_FORBIDDEN",tt,ot),await this.deleteRoomIdFromRooms(tt);const st=await this.getRelevantRoom(et);logger$4.log("sendPairingResponse","Old room deleted, new room created",st),(await this.client.promise).sendTextMessage(st,it).catch(async ct=>{logger$4.log("sendPairingResponse","inner error",st,ct)})}else logger$4.log("sendPairingResponse","unexpected error",ot)})}isTextMessage($){return $.message.type===MatrixMessageType.TEXT}async updateRelayServer($){logger$4.log("updateRelayServer",$);const j=$.split(":");if(j.length<2||!j[0].startsWith("@"))throw new Error("Invalid sender");const et=j.shift(),tt=j.join(":"),rt=localStorage.getItem("beacon:communication-peers-dapp")?new PeerManager(this.storage,StorageKey.TRANSPORT_P2P_PEERS_DAPP):new PeerManager(this.storage,StorageKey.TRANSPORT_P2P_PEERS_WALLET),it=(await rt.getPeers()).map(async ot=>{`@${await getHexHash(Buffer$g.from(ot.publicKey,"hex"))}`===et&&ot.relayServer!==tt&&(ot.relayServer=tt,await rt.addPeer(ot))});await Promise.all(it)}async isChannelOpenMessage($){return $.message.content.startsWith(`@channel-open:@${await getHexHash(Buffer$g.from(await this.getPublicKey(),"hex"))}`)}async isSender($,j){return $.content.message.sender.startsWith(`@${await getHexHash(Buffer$g.from(j,"hex"))}`)}async getRelevantRoom($){const j=await this.storage.get(StorageKey.MATRIX_PEER_ROOM_IDS);let et=j[$];if(!et){logger$4.log("getRelevantRoom",`No room found for peer ${$}, checking joined ones.`);const tt=await this.getRelevantJoinedRoom($);et=tt.id,j[$]=tt.id,await this.storage.set(StorageKey.MATRIX_PEER_ROOM_IDS,j)}return logger$4.log("getRelevantRoom",`Using room ${et}`),et}async getRelevantJoinedRoom($){const j=await(await this.client.promise).joinedRooms;logger$4.log("checking joined rooms",j,$);const et=j.filter(rt=>!this.ignoredRooms.some(nt=>rt.id===nt)).filter(rt=>rt.members.some(nt=>nt===$));let tt;if(et.length===0||this.ignoredRooms.length>0){logger$4.log("getRelevantJoinedRoom","no relevant rooms found, creating new one");const rt=await(await this.client.promise).createTrustedPrivateRoom($);tt=await(await this.client.promise).getRoomById(rt),logger$4.log("getRelevantJoinedRoom",`waiting for other party to join room: ${tt.id}`),await this.waitForJoin(rt),logger$4.log("getRelevantJoinedRoom",`new room created and peer invited: ${tt.id}`)}else tt=et[0],logger$4.log("getRelevantJoinedRoom",`channel already open, reusing room ${tt.id}`);return tt}}const logger$3=new Logger("P2PTransport");class P2PTransport extends Transport$2{constructor($,j,et,tt,rt,nt,it){super($,new P2PCommunicationClient($,j,1,et,tt,nt,it),new PeerManager(et,rt));Vr(this,"type",TransportType.P2P)}static async isAvailable(){return Promise.resolve(!0)}async connect(){if(this._isConnected!==TransportStatus.NOT_CONNECTED)return;logger$3.log("connect"),this._isConnected=TransportStatus.CONNECTING,await this.client.start();const $=await this.getPeers();if($.length>0){logger$3.log("connect",`connecting to ${$.length} peers`);const j=$.map(async et=>this.listen(et.publicKey));Promise.all(j).catch(et=>logger$3.error("connect",et))}return await this.startOpenChannelListener(),super.connect()}async disconnect(){return await this.client.stop(),super.disconnect()}async startOpenChannelListener(){}async getPairingRequestInfo(){return this.client.getPairingRequestInfo()}async listen($){await this.client.listenForEncryptedMessage($,j=>{const et={origin:Origin.P2P,id:$};this.notifyListeners(j,et).catch(tt=>{throw tt})}).catch(j=>{throw j})}}class WalletP2PTransport extends P2PTransport{constructor(a,$,j,et,tt,rt){super(a,$,j,et,StorageKey.TRANSPORT_P2P_PEERS_WALLET,tt,rt)}async addPeer(a,$=!0){await super.addPeer(a),$&&await this.client.sendPairingResponse(a)}}const logger$2=new Logger("IncomingRequestInterceptor");class IncomingRequestInterceptor{static async intercept(a){logger$2.log("INTERCEPTING REQUEST",a.message),a.message.version==="2"?IncomingRequestInterceptor.handleV2Message(a):a.message.version==="3"&&IncomingRequestInterceptor.handleV3Message(a)}static async getAppMetadata(a,$){const j=await a.getAppMetadata($);if(!j)throw new Error("AppMetadata not found");return j}static async handleV2Message(a){const{message:$,connectionInfo:j,appMetadataManager:et,interceptorCallback:tt}=a;switch($.type){case BeaconMessageType.PermissionRequest:logger$2.log("PERMISSION REQUEST V*",$),$.appMetadata.beaconId&&!$.appMetadata.senderId&&($.appMetadata.senderId=$.appMetadata.beaconId,delete $.appMetadata.beaconId),await et.addAppMetadata($.appMetadata),tt($,j);break;case BeaconMessageType.OperationRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.SignPayloadRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.BroadcastRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.ProofOfEventChallengeRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.SimulatedProofOfEventChallengeRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.SimulatedProofOfEventChallengeRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;default:logger$2.log("intercept","Message not handled"),assertNever$1()}}static async handleV3Message(a){const{message:$,connectionInfo:j,appMetadataManager:et,interceptorCallback:tt}=a,rt=$,nt=rt.message;switch(nt.type){case BeaconMessageType.PermissionRequest:await et.addAppMetadata({...nt.blockchainData.appMetadata,senderId:$.senderId}),tt(rt,j);break;case BeaconMessageType.BlockchainRequest:{const it={...rt};tt(it,j)}break;default:logger$2.log("intercept","Message not handled"),assertNever$1()}}}function assertNever$1(_){throw new Error("Function not implemented.")}const logger$1=new Logger("OutgoingResponseInterceptor");class OutgoingResponseInterceptor{static async intercept(a){a.request.version==="2"?OutgoingResponseInterceptor.handleV2Message(a):a.request.version==="3"&&OutgoingResponseInterceptor.handleV3Message(a)}static async handleV3Message(a){const{message:$,appMetadataManager:j,interceptorCallback:et}=a,rt=$.message;logger$1.log("LOGGING OUTGOING V3",rt,j),et($)}static async handleV2Message(a){const{senderId:$,request:j,message:et,ownAppMetadata:tt,permissionManager:rt,appMetadataManager:nt,interceptorCallback:it}=a;switch(et.type){case BeaconMessageType.Error:{const ot={type:et.type,version:"2",senderId:$,id:et.id,errorType:et.errorType};if(et.errorType===BeaconErrorType.TRANSACTION_INVALID_ERROR&&et.errorData){const st=et.errorData;Array.isArray(st)&&st.every(ct=>!!ct.kind&&!!ct.id)?ot.errorData=et.errorData:logger$1.warn("ErrorData provided is not in correct format. It needs to be an array of RPC errors. It will not be included in the message sent to the dApp")}it(ot);break}case BeaconMessageType.Acknowledge:{const ot={type:et.type,version:"2",senderId:$,id:et.id};it(ot);break}case BeaconMessageType.PermissionResponse:{const ot={senderId:$,version:"2",appMetadata:tt,...et};if(!ot.address&&!ot.publicKey)throw new Error("Address or PublicKey must be defined");const st=ot.publicKey,ct=ot.address??await getAddressFromPublicKey(st);if(!isValidAddress(ct))throw new Error(`Invalid address: "${ct}"`);if(et.walletType==="abstracted_account"&&ct.substring(0,3)!==CONTRACT_PREFIX)throw new Error(`Invalid abstracted account address "${ct}", it should be a ${CONTRACT_PREFIX} address`);const ut=await nt.getAppMetadata(j.senderId);if(!ut)throw new Error("AppMetadata not found");const ht={accountIdentifier:await getAccountIdentifier(ct,ot.network),senderId:j.senderId,appMetadata:ut,website:"",address:ct,publicKey:st,network:ot.network,scopes:ot.scopes,connectedAt:new Date().getTime()};rt.addPermission(ht).catch(console.error),it(ot);break}case BeaconMessageType.OperationResponse:{const ot={senderId:$,version:"2",...et};it(ot)}break;case BeaconMessageType.SignPayloadResponse:{const ot={senderId:$,version:"2",...et};it(ot)}break;case BeaconMessageType.BroadcastResponse:{const ot={senderId:$,version:"2",...et};it(ot)}break;case BeaconMessageType.ProofOfEventChallengeResponse:{const ot={senderId:$,version:"2",...et};it(ot)}break;case BeaconMessageType.SimulatedProofOfEventChallengeResponse:{const ot={senderId:$,version:"2",...et};it(ot)}break;default:logger$1.log("intercept","Message not handled"),assertNever()}}}function assertNever(_){throw new Error("Function not implemented.")}const logger=new Logger("WalletClient");let WalletClient$1=class extends Client{constructor($){super({storage:$&&$.storage?$.storage:new LocalStorage,...$});Vr(this,"_isConnected",new ExposedPromise);Vr(this,"permissionManager");Vr(this,"appMetadataManager");Vr(this,"pendingRequests",[]);this.permissionManager=new PermissionManager(this.storage),this.appMetadataManager=new AppMetadataManager(this.storage)}get isConnected(){return this._isConnected.promise}async init(){const $=await this.keyPair,j=new WalletP2PTransport(this.name,$,this.storage,this.matrixNodes,this.iconUrl,this.appUrl);return super.init(j)}async connect($){return this.handleResponse=async(j,et)=>{if(j.version==="3"){const tt=j;if(tt.message.type===BeaconMessageType.Disconnect)return this.disconnect(tt.senderId);this.pendingRequests.some(rt=>rt[0].id===j.id)||(this.pendingRequests.push([tt,et]),await this.sendAcknowledgeResponse(tt,et),await IncomingRequestInterceptor.intercept({message:tt,connectionInfo:et,appMetadataManager:this.appMetadataManager,interceptorCallback:$}))}else{const tt=j;if(tt.type===BeaconMessageType.Disconnect)return this.disconnect(tt.senderId);this.pendingRequests.some(rt=>rt[0].id===j.id)||(this.pendingRequests.push([tt,et]),tt.version!=="1"&&await this.sendAcknowledgeResponse(tt,et),await IncomingRequestInterceptor.intercept({message:tt,connectionInfo:et,appMetadataManager:this.appMetadataManager,interceptorCallback:$}))}},this._connect()}async getRegisterPushChallenge($,j,et=NOTIFICATION_ORACLE_URL){const tt=(await axios.get(`${et}/challenge`)).data,rt=["Tezos Signed Message: ",tt.id,tt.timestamp,j,$].join(" "),nt=toHex$1(rt),it="0501"+nt.length.toString(16).padStart(8,"0")+nt;return{challenge:tt,payloadToSign:it}}async registerPush($,j,et,tt,rt,nt,it=NOTIFICATION_ORACLE_URL){const ot=await this.storage.get(StorageKey.PUSH_TOKENS),st=ot.find(ht=>ht.publicKey===tt&&ht.backendUrl===et);if(st)return st;const ct=(await axios.post(`${it}/register`,{name:this.name,challenge:$,accountPublicKey:tt,signature:j,backendUrl:et,protocolIdentifier:rt,deviceId:nt})).data,ut={publicKey:tt,backendUrl:et,accessToken:ct.accessToken,managementToken:ct.managementToken};return ot.push(ut),await this.storage.set(StorageKey.PUSH_TOKENS,ot),ut}async _connect(){const $=await this.transport;$.connectionStatus===TransportStatus.NOT_CONNECTED&&(await $.connect(),$.addListener(async(j,et)=>{if(typeof j=="string"){const tt=await new Serializer().deserialize(j);this.handleResponse(tt,et)}}).catch(j=>logger.log("_connect",j)),this._isConnected.resolve(!0))}async respond($){logger.log("RESPONSE",$);const j=this.pendingRequests.find(et=>et[0].id===$.id);if(!j)throw new Error("No matching request found!");this.pendingRequests=this.pendingRequests.filter(et=>et[0].id!==$.id),await OutgoingResponseInterceptor.intercept({senderId:await getSenderId(await this.beaconId),request:j[0],message:$,ownAppMetadata:await this.getOwnAppMetadata(),permissionManager:this.permissionManager,appMetadataManager:this.appMetadataManager,interceptorCallback:async et=>{await this.respondToMessage(et,j[1])}})}async getAppMetadataList(){return this.appMetadataManager.getAppMetadataList()}async getAppMetadata($){return this.appMetadataManager.getAppMetadata($)}async removeAppMetadata($){return this.appMetadataManager.removeAppMetadata($)}async removeAllAppMetadata(){return this.appMetadataManager.removeAllAppMetadata()}async getPermissions(){return this.permissionManager.getPermissions()}async getPermission($){return this.permissionManager.getPermission($)}async removePermission($){return this.permissionManager.removePermission($)}async removeAllPermissions(){return this.permissionManager.removeAllPermissions()}async getPeerInfo($){const j=await getSenderId($.publicKey);return $ instanceof PostMessagePairingRequest?new ExtendedPostMessagePairingRequest($.id,$.name,$.publicKey,$.version,j):$ instanceof P2PPairingRequest?new ExtendedP2PPairingRequest($.id,$.name,$.publicKey,$.version,$.relayServer,j):$ instanceof ExtendedWalletConnectPairingRequest?new ExtendedWalletConnectPairingRequest($.id,$.name,$.publicKey,$.version,j,$.uri):{...$,senderId:j}}async addPeer($,j=!0){return(await this.transport).addPeer(await this.getPeerInfo($),j)}async removePeer($,j=!1){const et=(await this.transport).removePeer($);return await this.removePermissionsForPeers([$]),j&&await this.sendDisconnectToPeer($),et}async removeAllPeers($=!1){const j=await(await this.transport).getPeers(),et=(await this.transport).removeAllPeers();if(await this.removePermissionsForPeers(j),$){const tt=j.map(rt=>this.sendDisconnectToPeer(rt));await Promise.all(tt)}return et}async removePermissionsForPeers($){const j=await this.permissionManager.getPermissions(),et=$.map(nt=>nt.senderId),rt=j.filter(nt=>et.includes(nt.appMetadata.senderId)).map(nt=>nt.accountIdentifier);await this.permissionManager.removePermissions(rt)}async sendAcknowledgeResponse($,j){const et={id:$.id,type:BeaconMessageType.Acknowledge};await OutgoingResponseInterceptor.intercept({senderId:await getSenderId(await this.beaconId),request:$,message:et,ownAppMetadata:await this.getOwnAppMetadata(),permissionManager:this.permissionManager,appMetadataManager:this.appMetadataManager,interceptorCallback:async tt=>{await this.respondToMessage(tt,j)}})}async respondToMessage($,j){const et=await new Serializer().serialize($);if(j){const rt=(await this.getPeers()).find(nt=>nt.publicKey===j.id);await(await this.transport).send(et,rt)}else await(await this.transport).send(et)}async disconnect($){const j=await this.transport,tt=(await j.getPeers()).find(rt=>rt.senderId===$);tt&&await this.removePeer(tt),await j.disconnect()}};const WalletClient=new WalletClient$1({name:"Umami",iconUrl:"",appUrl:"https://umamiwallet.com/"});var KEY_PREFIX$2="persist:",FLUSH="persist/FLUSH",REHYDRATE="persist/REHYDRATE",PAUSE="persist/PAUSE",PERSIST="persist/PERSIST",PURGE="persist/PURGE",REGISTER="persist/REGISTER",DEFAULT_VERSION=-1;function _typeof$5(_){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$5=function($){return typeof $}:_typeof$5=function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},_typeof$5(_)}function ownKeys$5(_,a){var $=Object.keys(_);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(_);a&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(_,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$4(_){for(var a=1;a=0)&&Object.prototype.propertyIsEnumerable.call(_,j)&&($[j]=_[j])}return $}function _objectWithoutPropertiesLoose$2(_,a){if(_==null)return{};var $={},j=Object.keys(_),et,tt;for(tt=0;tt=0)&&($[et]=_[et]);return $}var DEFAULT_TIMEOUT=5e3;function persistReducer(_,a){var $=_.version!==void 0?_.version:DEFAULT_VERSION;_.debug;var j=_.stateReconciler===void 0?autoMergeLevel1:_.stateReconciler,et=_.getStoredState||getStoredState,tt=_.timeout!==void 0?_.timeout:DEFAULT_TIMEOUT,rt=null,nt=!1,it=!0,ot=function(ct){return ct._persist.rehydrated&&rt&&!it&&rt.update(ct),ct};return function(st,ct){var ut=st||{},ht=ut._persist,Et=_objectWithoutProperties$1(ut,["_persist"]),St=Et;if(ct.type===PERSIST){var Mt=!1,kt=function($t,Bt){Mt||(ct.rehydrate(_.key,$t,Bt),Mt=!0)};if(tt&&setTimeout(function(){!Mt&&kt(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(_.key,'"')))},tt),it=!1,rt||(rt=createPersistoid(_)),ht)return _objectSpread$3({},a(St,ct),{_persist:ht});if(typeof ct.rehydrate!="function"||typeof ct.register!="function")throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return ct.register(_.key),et(_).then(function(jt){var $t=_.migrate||function(Bt,Nt){return Promise.resolve(Bt)};$t(jt,$).then(function(Bt){kt(Bt)},function(Bt){kt(void 0,Bt)})},function(jt){kt(void 0,jt)}),_objectSpread$3({},a(St,ct),{_persist:{version:$,rehydrated:!1}})}else{if(ct.type===PURGE)return nt=!0,ct.result(purgeStoredState(_)),_objectSpread$3({},a(St,ct),{_persist:ht});if(ct.type===FLUSH)return ct.result(rt&&rt.flush()),_objectSpread$3({},a(St,ct),{_persist:ht});if(ct.type===PAUSE)it=!0;else if(ct.type===REHYDRATE){if(nt)return _objectSpread$3({},St,{_persist:_objectSpread$3({},ht,{rehydrated:!0})});if(ct.key===_.key){var Ct=a(St,ct),Ot=ct.payload,zt=j!==!1&&Ot!==void 0?j(Ot,st,Ct,_):Ct,Ut=_objectSpread$3({},zt,{_persist:_objectSpread$3({},ht,{rehydrated:!0})});return ot(Ut)}}}if(!ht)return a(st,ct);var Vt=a(St,ct);return Vt===St?st:ot(_objectSpread$3({},Vt,{_persist:ht}))}}function formatProdErrorMessage$1(_){return`Minified Redux error #${_}; visit https://redux.js.org/Errors?code=${_} for the full message or use the non-minified dev environment for full errors. `}var $$observable=typeof Symbol=="function"&&Symbol.observable||"@@observable",symbol_observable_default=$$observable,randomString$1=()=>Math.random().toString(36).substring(7).split("").join("."),ActionTypes={INIT:`@@redux/INIT${randomString$1()}`,REPLACE:`@@redux/REPLACE${randomString$1()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${randomString$1()}`},actionTypes_default=ActionTypes;function isPlainObject$2(_){if(typeof _!="object"||_===null)return!1;let a=_;for(;Object.getPrototypeOf(a)!==null;)a=Object.getPrototypeOf(a);return Object.getPrototypeOf(_)===a||Object.getPrototypeOf(_)===null}function createStore(_,a,$){if(typeof _!="function")throw new Error(formatProdErrorMessage$1(2));if(typeof a=="function"&&typeof $=="function"||typeof $=="function"&&typeof arguments[3]=="function")throw new Error(formatProdErrorMessage$1(0));if(typeof a=="function"&&typeof $>"u"&&($=a,a=void 0),typeof $<"u"){if(typeof $!="function")throw new Error(formatProdErrorMessage$1(1));return $(createStore)(_,a)}let j=_,et=a,tt=new Map,rt=tt,nt=0,it=!1;function ot(){rt===tt&&(rt=new Map,tt.forEach((Mt,kt)=>{rt.set(kt,Mt)}))}function st(){if(it)throw new Error(formatProdErrorMessage$1(3));return et}function ct(Mt){if(typeof Mt!="function")throw new Error(formatProdErrorMessage$1(4));if(it)throw new Error(formatProdErrorMessage$1(5));let kt=!0;ot();const Ct=nt++;return rt.set(Ct,Mt),function(){if(kt){if(it)throw new Error(formatProdErrorMessage$1(6));kt=!1,ot(),rt.delete(Ct),tt=null}}}function ut(Mt){if(!isPlainObject$2(Mt))throw new Error(formatProdErrorMessage$1(7));if(typeof Mt.type>"u")throw new Error(formatProdErrorMessage$1(8));if(typeof Mt.type!="string")throw new Error(formatProdErrorMessage$1(17));if(it)throw new Error(formatProdErrorMessage$1(9));try{it=!0,et=j(et,Mt)}finally{it=!1}return(tt=rt).forEach(Ct=>{Ct()}),Mt}function ht(Mt){if(typeof Mt!="function")throw new Error(formatProdErrorMessage$1(10));j=Mt,ut({type:actionTypes_default.REPLACE})}function Et(){const Mt=ct;return{subscribe(kt){if(typeof kt!="object"||kt===null)throw new Error(formatProdErrorMessage$1(11));function Ct(){const zt=kt;zt.next&&zt.next(st())}return Ct(),{unsubscribe:Mt(Ct)}},[symbol_observable_default](){return this}}}return ut({type:actionTypes_default.INIT}),{dispatch:ut,subscribe:ct,getState:st,replaceReducer:ht,[symbol_observable_default]:Et}}function assertReducerShape(_){Object.keys(_).forEach(a=>{const $=_[a];if(typeof $(void 0,{type:actionTypes_default.INIT})>"u")throw new Error(formatProdErrorMessage$1(12));if(typeof $(void 0,{type:actionTypes_default.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(formatProdErrorMessage$1(13))})}function combineReducers(_){const a=Object.keys(_),$={};for(let tt=0;tt"u")throw nt&&nt.type,new Error(formatProdErrorMessage$1(14));ot[ct]=Et,it=it||Et!==ht}return it=it||j.length!==Object.keys(rt).length,it?ot:rt}}function compose(..._){return _.length===0?a=>a:_.length===1?_[0]:_.reduce((a,$)=>(...j)=>a($(...j)))}function applyMiddleware(..._){return a=>($,j)=>{const et=a($,j);let tt=()=>{throw new Error(formatProdErrorMessage$1(15))};const rt={getState:et.getState,dispatch:(it,...ot)=>tt(it,...ot)},nt=_.map(it=>it(rt));return tt=compose(...nt)(et.dispatch),{...et,dispatch:tt}}}function isAction(_){return isPlainObject$2(_)&&"type"in _&&typeof _.type=="string"}function _toConsumableArray(_){return _arrayWithoutHoles(_)||_iterableToArray(_)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(_){if(Symbol.iterator in Object(_)||Object.prototype.toString.call(_)==="[object Arguments]")return Array.from(_)}function _arrayWithoutHoles(_){if(Array.isArray(_)){for(var a=0,$=new Array(_.length);a<_.length;a++)$[a]=_[a];return $}}function ownKeys$3(_,a){var $=Object.keys(_);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(_);a&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(_,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$2(_){for(var a=1;a0&&arguments[0]!==void 0?arguments[0]:initialState$a,$=arguments.length>1?arguments[1]:void 0;switch($.type){case REGISTER:return _objectSpread$2({},a,{registry:[].concat(_toConsumableArray(a.registry),[$.key])});case REHYDRATE:var j=a.registry.indexOf($.key),et=_toConsumableArray(a.registry);return et.splice(j,1),_objectSpread$2({},a,{registry:et,bootstrapped:et.length===0});default:return a}};function persistStore(_,a,$){var j=createStore(persistorReducer,initialState$a,void 0),et=function(it){j.dispatch({type:REGISTER,key:it})},tt=function(it,ot,st){var ct={type:REHYDRATE,payload:ot,err:st,key:it};_.dispatch(ct),j.dispatch(ct)},rt=_objectSpread$2({},j,{purge:function(){var it=[];return _.dispatch({type:PURGE,result:function(st){it.push(st)}}),Promise.all(it)},flush:function(){var it=[];return _.dispatch({type:FLUSH,result:function(st){it.push(st)}}),Promise.all(it)},pause:function(){_.dispatch({type:PAUSE})},persist:function(){_.dispatch({type:PERSIST,register:et,rehydrate:tt})}});return rt.persist(),rt}var NOTHING=Symbol.for("immer-nothing"),DRAFTABLE=Symbol.for("immer-draftable"),DRAFT_STATE=Symbol.for("immer-state");function die(_,...a){throw new Error(`[Immer] minified error nr: ${_}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf$1=Object.getPrototypeOf;function isDraft(_){return!!_&&!!_[DRAFT_STATE]}function isDraftable(_){var a;return _?isPlainObject$1(_)||Array.isArray(_)||!!_[DRAFTABLE]||!!((a=_.constructor)!=null&&a[DRAFTABLE])||isMap(_)||isSet(_):!1}var objectCtorString=Object.prototype.constructor.toString();function isPlainObject$1(_){if(!_||typeof _!="object")return!1;const a=getPrototypeOf$1(_);if(a===null)return!0;const $=Object.hasOwnProperty.call(a,"constructor")&&a.constructor;return $===Object?!0:typeof $=="function"&&Function.toString.call($)===objectCtorString}function each(_,a){getArchtype(_)===0?Reflect.ownKeys(_).forEach($=>{a($,_[$],_)}):_.forEach(($,j)=>a(j,$,_))}function getArchtype(_){const a=_[DRAFT_STATE];return a?a.type_:Array.isArray(_)?1:isMap(_)?2:isSet(_)?3:0}function has(_,a){return getArchtype(_)===2?_.has(a):Object.prototype.hasOwnProperty.call(_,a)}function set(_,a,$){const j=getArchtype(_);j===2?_.set(a,$):j===3?_.add($):_[a]=$}function is(_,a){return _===a?_!==0||1/_===1/a:_!==_&&a!==a}function isMap(_){return _ instanceof Map}function isSet(_){return _ instanceof Set}function latest(_){return _.copy_||_.base_}function shallowCopy(_,a){if(isMap(_))return new Map(_);if(isSet(_))return new Set(_);if(Array.isArray(_))return Array.prototype.slice.call(_);const $=isPlainObject$1(_);if(a===!0||a==="class_only"&&!$){const j=Object.getOwnPropertyDescriptors(_);delete j[DRAFT_STATE];let et=Reflect.ownKeys(j);for(let tt=0;tt1&&(_.set=_.add=_.clear=_.delete=dontMutateFrozenCollections),Object.freeze(_),a&&Object.entries(_).forEach(([$,j])=>freeze(j,!0))),_}function dontMutateFrozenCollections(){die(2)}function isFrozen(_){return Object.isFrozen(_)}var plugins={};function getPlugin(_){const a=plugins[_];return a||die(0,_),a}var currentScope;function getCurrentScope(){return currentScope}function createScope(_,a){return{drafts_:[],parent_:_,immer_:a,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope(_,a){a&&(getPlugin("Patches"),_.patches_=[],_.inversePatches_=[],_.patchListener_=a)}function revokeScope(_){leaveScope(_),_.drafts_.forEach(revokeDraft),_.drafts_=null}function leaveScope(_){_===currentScope&&(currentScope=_.parent_)}function enterScope(_){return currentScope=createScope(currentScope,_)}function revokeDraft(_){const a=_[DRAFT_STATE];a.type_===0||a.type_===1?a.revoke_():a.revoked_=!0}function processResult(_,a){a.unfinalizedDrafts_=a.drafts_.length;const $=a.drafts_[0];return _!==void 0&&_!==$?($[DRAFT_STATE].modified_&&(revokeScope(a),die(4)),isDraftable(_)&&(_=finalize(a,_),a.parent_||maybeFreeze(a,_)),a.patches_&&getPlugin("Patches").generateReplacementPatches_($[DRAFT_STATE].base_,_,a.patches_,a.inversePatches_)):_=finalize(a,$,[]),revokeScope(a),a.patches_&&a.patchListener_(a.patches_,a.inversePatches_),_!==NOTHING?_:void 0}function finalize(_,a,$){if(isFrozen(a))return a;const j=a[DRAFT_STATE];if(!j)return each(a,(et,tt)=>finalizeProperty(_,j,a,et,tt,$)),a;if(j.scope_!==_)return a;if(!j.modified_)return maybeFreeze(_,j.base_,!0),j.base_;if(!j.finalized_){j.finalized_=!0,j.scope_.unfinalizedDrafts_--;const et=j.copy_;let tt=et,rt=!1;j.type_===3&&(tt=new Set(et),et.clear(),rt=!0),each(tt,(nt,it)=>finalizeProperty(_,j,et,nt,it,$,rt)),maybeFreeze(_,et,!1),$&&_.patches_&&getPlugin("Patches").generatePatches_(j,$,_.patches_,_.inversePatches_)}return j.copy_}function finalizeProperty(_,a,$,j,et,tt,rt){if(isDraft(et)){const nt=tt&&a&&a.type_!==3&&!has(a.assigned_,j)?tt.concat(j):void 0,it=finalize(_,et,nt);if(set($,j,it),isDraft(it))_.canAutoFreeze_=!1;else return}else rt&&$.add(et);if(isDraftable(et)&&!isFrozen(et)){if(!_.immer_.autoFreeze_&&_.unfinalizedDrafts_<1)return;finalize(_,et),(!a||!a.scope_.parent_)&&typeof j!="symbol"&&Object.prototype.propertyIsEnumerable.call($,j)&&maybeFreeze(_,et)}}function maybeFreeze(_,a,$=!1){!_.parent_&&_.immer_.autoFreeze_&&_.canAutoFreeze_&&freeze(a,$)}function createProxyProxy(_,a){const $=Array.isArray(_),j={type_:$?1:0,scope_:a?a.scope_:getCurrentScope(),modified_:!1,finalized_:!1,assigned_:{},parent_:a,base_:_,draft_:null,copy_:null,revoke_:null,isManual_:!1};let et=j,tt=objectTraps;$&&(et=[j],tt=arrayTraps);const{revoke:rt,proxy:nt}=Proxy.revocable(et,tt);return j.draft_=nt,j.revoke_=rt,nt}var objectTraps={get(_,a){if(a===DRAFT_STATE)return _;const $=latest(_);if(!has($,a))return readPropFromProto(_,$,a);const j=$[a];return _.finalized_||!isDraftable(j)?j:j===peek(_.base_,a)?(prepareCopy(_),_.copy_[a]=createProxy(j,_)):j},has(_,a){return a in latest(_)},ownKeys(_){return Reflect.ownKeys(latest(_))},set(_,a,$){const j=getDescriptorFromProto(latest(_),a);if(j!=null&&j.set)return j.set.call(_.draft_,$),!0;if(!_.modified_){const et=peek(latest(_),a),tt=et==null?void 0:et[DRAFT_STATE];if(tt&&tt.base_===$)return _.copy_[a]=$,_.assigned_[a]=!1,!0;if(is($,et)&&($!==void 0||has(_.base_,a)))return!0;prepareCopy(_),markChanged(_)}return _.copy_[a]===$&&($!==void 0||a in _.copy_)||Number.isNaN($)&&Number.isNaN(_.copy_[a])||(_.copy_[a]=$,_.assigned_[a]=!0),!0},deleteProperty(_,a){return peek(_.base_,a)!==void 0||a in _.base_?(_.assigned_[a]=!1,prepareCopy(_),markChanged(_)):delete _.assigned_[a],_.copy_&&delete _.copy_[a],!0},getOwnPropertyDescriptor(_,a){const $=latest(_),j=Reflect.getOwnPropertyDescriptor($,a);return j&&{writable:!0,configurable:_.type_!==1||a!=="length",enumerable:j.enumerable,value:$[a]}},defineProperty(){die(11)},getPrototypeOf(_){return getPrototypeOf$1(_.base_)},setPrototypeOf(){die(12)}},arrayTraps={};each(objectTraps,(_,a)=>{arrayTraps[_]=function(){return arguments[0]=arguments[0][0],a.apply(this,arguments)}});arrayTraps.deleteProperty=function(_,a){return arrayTraps.set.call(this,_,a,void 0)};arrayTraps.set=function(_,a,$){return objectTraps.set.call(this,_[0],a,$,_[0])};function peek(_,a){const $=_[DRAFT_STATE];return($?latest($):_)[a]}function readPropFromProto(_,a,$){var et;const j=getDescriptorFromProto(a,$);return j?"value"in j?j.value:(et=j.get)==null?void 0:et.call(_.draft_):void 0}function getDescriptorFromProto(_,a){if(!(a in _))return;let $=getPrototypeOf$1(_);for(;$;){const j=Object.getOwnPropertyDescriptor($,a);if(j)return j;$=getPrototypeOf$1($)}}function markChanged(_){_.modified_||(_.modified_=!0,_.parent_&&markChanged(_.parent_))}function prepareCopy(_){_.copy_||(_.copy_=shallowCopy(_.base_,_.scope_.immer_.useStrictShallowCopy_))}var Immer2=class{constructor(_){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(a,$,j)=>{if(typeof a=="function"&&typeof $!="function"){const tt=$;$=a;const rt=this;return function(it=tt,...ot){return rt.produce(it,st=>$.call(this,st,...ot))}}typeof $!="function"&&die(6),j!==void 0&&typeof j!="function"&&die(7);let et;if(isDraftable(a)){const tt=enterScope(this),rt=createProxy(a,void 0);let nt=!0;try{et=$(rt),nt=!1}finally{nt?revokeScope(tt):leaveScope(tt)}return usePatchesInScope(tt,j),processResult(et,tt)}else if(!a||typeof a!="object"){if(et=$(a),et===void 0&&(et=a),et===NOTHING&&(et=void 0),this.autoFreeze_&&freeze(et,!0),j){const tt=[],rt=[];getPlugin("Patches").generateReplacementPatches_(a,et,tt,rt),j(tt,rt)}return et}else die(1,a)},this.produceWithPatches=(a,$)=>{if(typeof a=="function")return(rt,...nt)=>this.produceWithPatches(rt,it=>a(it,...nt));let j,et;return[this.produce(a,$,(rt,nt)=>{j=rt,et=nt}),j,et]},typeof(_==null?void 0:_.autoFreeze)=="boolean"&&this.setAutoFreeze(_.autoFreeze),typeof(_==null?void 0:_.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(_.useStrictShallowCopy)}createDraft(_){isDraftable(_)||die(8),isDraft(_)&&(_=current(_));const a=enterScope(this),$=createProxy(_,void 0);return $[DRAFT_STATE].isManual_=!0,leaveScope(a),$}finishDraft(_,a){const $=_&&_[DRAFT_STATE];(!$||!$.isManual_)&&die(9);const{scope_:j}=$;return usePatchesInScope(j,a),processResult(void 0,j)}setAutoFreeze(_){this.autoFreeze_=_}setUseStrictShallowCopy(_){this.useStrictShallowCopy_=_}applyPatches(_,a){let $;for($=a.length-1;$>=0;$--){const et=a[$];if(et.path.length===0&&et.op==="replace"){_=et.value;break}}$>-1&&(a=a.slice($+1));const j=getPlugin("Patches").applyPatches_;return isDraft(_)?j(_,a):this.produce(_,et=>j(et,a))}};function createProxy(_,a){const $=isMap(_)?getPlugin("MapSet").proxyMap_(_,a):isSet(_)?getPlugin("MapSet").proxySet_(_,a):createProxyProxy(_,a);return(a?a.scope_:getCurrentScope()).drafts_.push($),$}function current(_){return isDraft(_)||die(10,_),currentImpl(_)}function currentImpl(_){if(!isDraftable(_)||isFrozen(_))return _;const a=_[DRAFT_STATE];let $;if(a){if(!a.modified_)return a.base_;a.finalized_=!0,$=shallowCopy(_,a.scope_.immer_.useStrictShallowCopy_)}else $=shallowCopy(_,!0);return each($,(j,et)=>{set($,j,currentImpl(et))}),a&&(a.finalized_=!1),$}var immer=new Immer2,produce=immer.produce;immer.produceWithPatches.bind(immer);immer.setAutoFreeze.bind(immer);immer.setUseStrictShallowCopy.bind(immer);immer.applyPatches.bind(immer);immer.createDraft.bind(immer);immer.finishDraft.bind(immer);function assertIsFunction(_,a=`expected a function, instead received ${typeof _}`){if(typeof _!="function")throw new TypeError(a)}function assertIsObject(_,a=`expected an object, instead received ${typeof _}`){if(typeof _!="object")throw new TypeError(a)}function assertIsArrayOfFunctions(_,a="expected all items to be functions, instead received the following types: "){if(!_.every($=>typeof $=="function")){const $=_.map(j=>typeof j=="function"?`function ${j.name||"unnamed"}()`:typeof j).join(", ");throw new TypeError(`${a}[${$}]`)}}var ensureIsArray=_=>Array.isArray(_)?_:[_];function getDependencies(_){const a=Array.isArray(_[0])?_[0]:_;return assertIsArrayOfFunctions(a,"createSelector expects all input-selectors to be functions, but received the following types: "),a}function collectInputSelectorResults(_,a){const $=[],{length:j}=_;for(let et=0;et{$=createCacheNode(),rt.resetResultsCount()},rt.resultsCount=()=>tt,rt.resetResultsCount=()=>{tt=0},rt}function createSelectorCreator(_,...a){const $=typeof _=="function"?{memoize:_,memoizeOptions:a}:_,j=(...et)=>{let tt=0,rt=0,nt,it={},ot=et.pop();typeof ot=="object"&&(it=ot,ot=et.pop()),assertIsFunction(ot,`createSelector expects an output function after the inputs, but received: [${typeof ot}]`);const st={...$,...it},{memoize:ct,memoizeOptions:ut=[],argsMemoize:ht=weakMapMemoize,argsMemoizeOptions:Et=[],devModeChecks:St={}}=st,Mt=ensureIsArray(ut),kt=ensureIsArray(Et),Ct=getDependencies(et),Ot=ct(function(){return tt++,ot.apply(null,arguments)},...Mt),zt=ht(function(){rt++;const Vt=collectInputSelectorResults(Ct,arguments);return nt=Ot.apply(null,Vt),nt},...kt);return Object.assign(zt,{resultFunc:ot,memoizedResultFunc:Ot,dependencies:Ct,dependencyRecomputations:()=>rt,resetDependencyRecomputations:()=>{rt=0},lastResult:()=>nt,recomputations:()=>tt,resetRecomputations:()=>{tt=0},memoize:ct,argsMemoize:ht})};return Object.assign(j,{withTypes:()=>j}),j}var createSelector=createSelectorCreator(weakMapMemoize),createStructuredSelector=Object.assign((_,a=createSelector)=>{assertIsObject(_,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof _}`);const $=Object.keys(_),j=$.map(tt=>_[tt]);return a(j,(...tt)=>tt.reduce((rt,nt,it)=>(rt[$[it]]=nt,rt),{}))},{withTypes:()=>createStructuredSelector});function createThunkMiddleware(_){return({dispatch:$,getState:j})=>et=>tt=>typeof tt=="function"?tt($,j,_):et(tt)}var thunk=createThunkMiddleware(),withExtraArgument=createThunkMiddleware,createDraftSafeSelectorCreator=(..._)=>{const a=createSelectorCreator(..._),$=Object.assign((...j)=>{const et=a(...j),tt=(rt,...nt)=>et(isDraft(rt)?current(rt):rt,...nt);return Object.assign(tt,et),tt},{withTypes:()=>$});return $};createDraftSafeSelectorCreator(weakMapMemoize);var composeWithDevTools=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?compose:compose.apply(null,arguments)},hasMatchFunction=_=>_&&typeof _.match=="function";function createAction(_,a){function $(...j){if(a){let et=a(...j);if(!et)throw new Error(formatProdErrorMessage(0));return{type:_,payload:et.payload,..."meta"in et&&{meta:et.meta},..."error"in et&&{error:et.error}}}return{type:_,payload:j[0]}}return $.toString=()=>`${_}`,$.type=_,$.match=j=>isAction(j)&&j.type===_,$}var Tuple=class ip extends Array{constructor(...a){super(...a),Object.setPrototypeOf(this,ip.prototype)}static get[Symbol.species](){return ip}concat(...a){return super.concat.apply(this,a)}prepend(...a){return a.length===1&&Array.isArray(a[0])?new ip(...a[0].concat(this)):new ip(...a.concat(this))}};function freezeDraftable(_){return isDraftable(_)?produce(_,()=>{}):_}function emplace(_,a,$){if(_.has(a)){let et=_.get(a);return $.update&&(et=$.update(et,a,_),_.set(a,et)),et}if(!$.insert)throw new Error(formatProdErrorMessage(10));const j=$.insert(a,_);return _.set(a,j),j}function isBoolean(_){return typeof _=="boolean"}var buildGetDefaultMiddleware=()=>function(a){const{thunk:$=!0,immutableCheck:j=!0,serializableCheck:et=!0,actionCreatorCheck:tt=!0}=a??{};let rt=new Tuple;return $&&(isBoolean($)?rt.push(thunk):rt.push(withExtraArgument($.extraArgument))),rt},SHOULD_AUTOBATCH="RTK_autoBatch",createQueueWithTimer=_=>a=>{setTimeout(a,_)},rAF=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:createQueueWithTimer(10),autoBatchEnhancer=(_={type:"raf"})=>a=>(...$)=>{const j=a(...$);let et=!0,tt=!1,rt=!1;const nt=new Set,it=_.type==="tick"?queueMicrotask:_.type==="raf"?rAF:_.type==="callback"?_.queueNotification:createQueueWithTimer(_.timeout),ot=()=>{rt=!1,tt&&(tt=!1,nt.forEach(st=>st()))};return Object.assign({},j,{subscribe(st){const ct=()=>et&&st(),ut=j.subscribe(ct);return nt.add(st),()=>{ut(),nt.delete(st)}},dispatch(st){var ct;try{return et=!((ct=st==null?void 0:st.meta)!=null&&ct[SHOULD_AUTOBATCH]),tt=!et,tt&&(rt||(rt=!0,it(ot))),j.dispatch(st)}finally{et=!0}}})},buildGetDefaultEnhancers=_=>function($){const{autoBatch:j=!0}=$??{};let et=new Tuple(_);return j&&et.push(autoBatchEnhancer(typeof j=="object"?j:void 0)),et},IS_PRODUCTION=!0;function configureStore(_){const a=buildGetDefaultMiddleware(),{reducer:$=void 0,middleware:j,devTools:et=!0,preloadedState:tt=void 0,enhancers:rt=void 0}=_||{};let nt;if(typeof $=="function")nt=$;else if(isPlainObject$2($))nt=combineReducers($);else throw new Error(formatProdErrorMessage(1));let it;typeof j=="function"?it=j(a):it=a();let ot=compose;et&&(ot=composeWithDevTools({trace:!IS_PRODUCTION,...typeof et=="object"&&et}));const st=applyMiddleware(...it),ct=buildGetDefaultEnhancers(st);let ut=typeof rt=="function"?rt(ct):ct();const ht=ot(...ut);return createStore(nt,tt,ht)}function executeReducerBuilderCallback(_){const a={},$=[];let j;const et={addCase(tt,rt){const nt=typeof tt=="string"?tt:tt.type;if(!nt)throw new Error(formatProdErrorMessage(28));if(nt in a)throw new Error(formatProdErrorMessage(29));return a[nt]=rt,et},addMatcher(tt,rt){return $.push({matcher:tt,reducer:rt}),et},addDefaultCase(tt){return j=tt,et}};return _(et),[a,$,j]}function isStateFunction(_){return typeof _=="function"}function createReducer(_,a){let[$,j,et]=executeReducerBuilderCallback(a),tt;if(isStateFunction(_))tt=()=>freezeDraftable(_());else{const nt=freezeDraftable(_);tt=()=>nt}function rt(nt=tt(),it){let ot=[$[it.type],...j.filter(({matcher:st})=>st(it)).map(({reducer:st})=>st)];return ot.filter(st=>!!st).length===0&&(ot=[et]),ot.reduce((st,ct)=>{if(ct)if(isDraft(st)){const ht=ct(st,it);return ht===void 0?st:ht}else{if(isDraftable(st))return produce(st,ut=>ct(ut,it));{const ut=ct(st,it);if(ut===void 0){if(st===null)return st;throw new Error(formatProdErrorMessage(9))}return ut}}return st},nt)}return rt.getInitialState=tt,rt}var urlAlphabet="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",nanoid=(_=21)=>{let a="",$=_;for(;$--;)a+=urlAlphabet[Math.random()*64|0];return a},matches=(_,a)=>hasMatchFunction(_)?_.match(a):_(a);function isAnyOf(..._){return a=>_.some($=>matches($,a))}var commonProperties=["name","message","stack","code"],RejectWithValue=class{constructor(_,a){Vr(this,"_type");this.payload=_,this.meta=a}},FulfillWithMeta=class{constructor(_,a){Vr(this,"_type");this.payload=_,this.meta=a}},miniSerializeError=_=>{if(typeof _=="object"&&_!==null){const a={};for(const $ of commonProperties)typeof _[$]=="string"&&(a[$]=_[$]);return a}return{message:String(_)}},createAsyncThunk=(()=>{function _(a,$,j){const et=createAction(a+"/fulfilled",(it,ot,st,ct)=>({payload:it,meta:{...ct||{},arg:st,requestId:ot,requestStatus:"fulfilled"}})),tt=createAction(a+"/pending",(it,ot,st)=>({payload:void 0,meta:{...st||{},arg:ot,requestId:it,requestStatus:"pending"}})),rt=createAction(a+"/rejected",(it,ot,st,ct,ut)=>({payload:ct,error:(j&&j.serializeError||miniSerializeError)(it||"Rejected"),meta:{...ut||{},arg:st,requestId:ot,rejectedWithValue:!!ct,requestStatus:"rejected",aborted:(it==null?void 0:it.name)==="AbortError",condition:(it==null?void 0:it.name)==="ConditionError"}}));function nt(it){return(ot,st,ct)=>{const ut=j!=null&&j.idGenerator?j.idGenerator(it):nanoid(),ht=new AbortController;let Et,St;function Mt(Ct){St=Ct,ht.abort()}const kt=async function(){var zt,Ut;let Ct;try{let Vt=(zt=j==null?void 0:j.condition)==null?void 0:zt.call(j,it,{getState:st,extra:ct});if(isThenable(Vt)&&(Vt=await Vt),Vt===!1||ht.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const jt=new Promise(($t,Bt)=>{Et=()=>{Bt({name:"AbortError",message:St||"Aborted"})},ht.signal.addEventListener("abort",Et)});ot(tt(ut,it,(Ut=j==null?void 0:j.getPendingMeta)==null?void 0:Ut.call(j,{requestId:ut,arg:it},{getState:st,extra:ct}))),Ct=await Promise.race([jt,Promise.resolve($(it,{dispatch:ot,getState:st,extra:ct,requestId:ut,signal:ht.signal,abort:Mt,rejectWithValue:($t,Bt)=>new RejectWithValue($t,Bt),fulfillWithValue:($t,Bt)=>new FulfillWithMeta($t,Bt)})).then($t=>{if($t instanceof RejectWithValue)throw $t;return $t instanceof FulfillWithMeta?et($t.payload,ut,it,$t.meta):et($t,ut,it)})])}catch(Vt){Ct=Vt instanceof RejectWithValue?rt(null,ut,it,Vt.payload,Vt.meta):rt(Vt,ut,it)}finally{Et&&ht.signal.removeEventListener("abort",Et)}return j&&!j.dispatchConditionRejection&&rt.match(Ct)&&Ct.meta.condition||ot(Ct),Ct}();return Object.assign(kt,{abort:Mt,requestId:ut,arg:it,unwrap(){return kt.then(unwrapResult)}})}}return Object.assign(nt,{pending:tt,rejected:rt,fulfilled:et,settled:isAnyOf(rt,et),typePrefix:a})}return _.withTypes=()=>_,_})();function unwrapResult(_){if(_.meta&&_.meta.rejectedWithValue)throw _.payload;if(_.error)throw _.error;return _.payload}function isThenable(_){return _!==null&&typeof _=="object"&&typeof _.then=="function"}var asyncThunkSymbol=Symbol.for("rtk-slice-createasyncthunk");function getType(_,a){return`${_}/${a}`}function buildCreateSlice({creators:_}={}){var $;const a=($=_==null?void 0:_.asyncThunk)==null?void 0:$[asyncThunkSymbol];return function(et){const{name:tt,reducerPath:rt=tt}=et;if(!tt)throw new Error(formatProdErrorMessage(11));typeof process$1$1<"u";const nt=(typeof et.reducers=="function"?et.reducers(buildReducerCreators()):et.reducers)||{},it=Object.keys(nt),ot={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},st={addCase(Ot,zt){const Ut=typeof Ot=="string"?Ot:Ot.type;if(!Ut)throw new Error(formatProdErrorMessage(12));if(Ut in ot.sliceCaseReducersByType)throw new Error(formatProdErrorMessage(13));return ot.sliceCaseReducersByType[Ut]=zt,st},addMatcher(Ot,zt){return ot.sliceMatchers.push({matcher:Ot,reducer:zt}),st},exposeAction(Ot,zt){return ot.actionCreators[Ot]=zt,st},exposeCaseReducer(Ot,zt){return ot.sliceCaseReducersByName[Ot]=zt,st}};it.forEach(Ot=>{const zt=nt[Ot],Ut={reducerName:Ot,type:getType(tt,Ot),createNotation:typeof et.reducers=="function"};isAsyncThunkSliceReducerDefinition(zt)?handleThunkCaseReducerDefinition(Ut,zt,st,a):handleNormalReducerDefinition(Ut,zt,st)});function ct(){const[Ot={},zt=[],Ut=void 0]=typeof et.extraReducers=="function"?executeReducerBuilderCallback(et.extraReducers):[et.extraReducers],Vt={...Ot,...ot.sliceCaseReducersByType};return createReducer(et.initialState,jt=>{for(let $t in Vt)jt.addCase($t,Vt[$t]);for(let $t of ot.sliceMatchers)jt.addMatcher($t.matcher,$t.reducer);for(let $t of zt)jt.addMatcher($t.matcher,$t.reducer);Ut&&jt.addDefaultCase(Ut)})}const ut=Ot=>Ot,ht=new Map;let Et;function St(Ot,zt){return Et||(Et=ct()),Et(Ot,zt)}function Mt(){return Et||(Et=ct()),Et.getInitialState()}function kt(Ot,zt=!1){function Ut(jt){let $t=jt[Ot];return typeof $t>"u"&&zt&&($t=Mt()),$t}function Vt(jt=ut){const $t=emplace(ht,zt,{insert:()=>new WeakMap});return emplace($t,jt,{insert:()=>{const Bt={};for(const[Nt,Lt]of Object.entries(et.selectors??{}))Bt[Nt]=wrapSelector(Lt,jt,Mt,zt);return Bt}})}return{reducerPath:Ot,getSelectors:Vt,get selectors(){return Vt(Ut)},selectSlice:Ut}}const Ct={name:tt,reducer:St,actions:ot.actionCreators,caseReducers:ot.sliceCaseReducersByName,getInitialState:Mt,...kt(rt),injectInto(Ot,{reducerPath:zt,...Ut}={}){const Vt=zt??rt;return Ot.inject({reducerPath:Vt,reducer:St},Ut),{...Ct,...kt(Vt,!0)}}};return Ct}}function wrapSelector(_,a,$,j){function et(tt,...rt){let nt=a(tt);return typeof nt>"u"&&j&&(nt=$()),_(nt,...rt)}return et.unwrapped=_,et}var createSlice=buildCreateSlice();function buildReducerCreators(){function _(a,$){return{_reducerDefinitionType:"asyncThunk",payloadCreator:a,...$}}return _.withTypes=()=>_,{reducer(a){return Object.assign({[a.name](...$){return a(...$)}}[a.name],{_reducerDefinitionType:"reducer"})},preparedReducer(a,$){return{_reducerDefinitionType:"reducerWithPrepare",prepare:a,reducer:$}},asyncThunk:_}}function handleNormalReducerDefinition({type:_,reducerName:a,createNotation:$},j,et){let tt,rt;if("reducer"in j){if($&&!isCaseReducerWithPrepareDefinition(j))throw new Error(formatProdErrorMessage(17));tt=j.reducer,rt=j.prepare}else tt=j;et.addCase(_,tt).exposeCaseReducer(a,tt).exposeAction(a,rt?createAction(_,rt):createAction(_))}function isAsyncThunkSliceReducerDefinition(_){return _._reducerDefinitionType==="asyncThunk"}function isCaseReducerWithPrepareDefinition(_){return _._reducerDefinitionType==="reducerWithPrepare"}function handleThunkCaseReducerDefinition({type:_,reducerName:a},$,j,et){if(!et)throw new Error(formatProdErrorMessage(18));const{payloadCreator:tt,fulfilled:rt,pending:nt,rejected:it,settled:ot,options:st}=$,ct=et(_,tt,st);j.exposeAction(a,ct),rt&&j.addCase(ct.fulfilled,rt),nt&&j.addCase(ct.pending,nt),it&&j.addCase(ct.rejected,it),ot&&j.addMatcher(ct.settled,ot),j.exposeCaseReducer(a,{fulfilled:rt||noop$5,pending:nt||noop$5,rejected:it||noop$5,settled:ot||noop$5})}function noop$5(){}var assertFunction=(_,a)=>{if(typeof _!="function")throw new Error(formatProdErrorMessage(32))},alm="listenerMiddleware",getListenerEntryPropsFrom=_=>{let{type:a,actionCreator:$,matcher:j,predicate:et,effect:tt}=_;if(a)et=createAction(a).match;else if($)a=$.type,et=$.match;else if(j)et=j;else if(!et)throw new Error(formatProdErrorMessage(21));return assertFunction(tt),{predicate:et,type:a,effect:tt}},createListenerEntry=Object.assign(_=>{const{type:a,predicate:$,effect:j}=getListenerEntryPropsFrom(_);return{id:nanoid(),effect:j,type:a,predicate:$,pending:new Set,unsubscribe:()=>{throw new Error(formatProdErrorMessage(22))}}},{withTypes:()=>createListenerEntry}),addListener=Object.assign(createAction(`${alm}/add`),{withTypes:()=>addListener});createAction(`${alm}/removeAll`);var removeListener=Object.assign(createAction(`${alm}/remove`),{withTypes:()=>removeListener});function formatProdErrorMessage(_){return`Minified Redux Toolkit error #${_}; visit https://redux-toolkit.js.org/Errors?code=${_} for the full message or use the non-minified dev environment for full errors. `}var createWebStorage$1={},getStorage$1={};getStorage$1.__esModule=!0;getStorage$1.default=getStorage;function _typeof$4(_){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$4=function($){return typeof $}:_typeof$4=function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},_typeof$4(_)}function noop$4(){}var noopStorage={getItem:noop$4,setItem:noop$4,removeItem:noop$4};function hasStorage(_){if((typeof self>"u"?"undefined":_typeof$4(self))!=="object"||!(_ in self))return!1;try{var a=self[_],$="redux-persist ".concat(_," test");a.setItem($,"test"),a.getItem($),a.removeItem($)}catch{return!1}return!0}function getStorage(_){var a="".concat(_,"Storage");return hasStorage(a)?self[a]:noopStorage}createWebStorage$1.__esModule=!0;createWebStorage$1.default=createWebStorage;var _getStorage=_interopRequireDefault$6(getStorage$1);function _interopRequireDefault$6(_){return _&&_.__esModule?_:{default:_}}function createWebStorage(_){var a=(0,_getStorage.default)(_);return{getItem:function(j){return new Promise(function(et,tt){et(a.getItem(j))})},setItem:function(j,et){return new Promise(function(tt,rt){tt(a.setItem(j,et))})},removeItem:function(j){return new Promise(function(et,tt){et(a.removeItem(j))})}}}var default_1=void 0,_createWebStorage=_interopRequireDefault$5(createWebStorage$1);function _interopRequireDefault$5(_){return _&&_.__esModule?_:{default:_}}var _default$5=(0,_createWebStorage.default)("local");default_1=_default$5;function createAsyncMigrate(_,a){return async($,j)=>{if(!$)return;const et=$._persist&&$._persist.version!==void 0?$._persist.version:DEFAULT_VERSION;if(et===j||et>j)return $;const tt=Object.keys(_).map(nt=>parseInt(nt)).filter(nt=>j>=nt&&nt>et).sort((nt,it)=>nt-it);let rt=$;for(const nt of tt)rt=await _[nt](rt);return rt}}const initialState$9={html:"",seen:!0},announcementSlice=createSlice({name:"announcements",initialState:initialState$9,reducers:{reset:()=>initialState$9,setCurrent:(_,{payload:a})=>{a!==_.html&&(_.seen=!1),_.html=a},setSeen:_=>{_.seen=!0}}}),ERROR_MSG_INPUT="Input must be an string, Buffer or Uint8Array";function normalizeInput(_){let a;if(_ instanceof Uint8Array)a=_;else if(typeof _=="string")a=new TextEncoder().encode(_);else throw new Error(ERROR_MSG_INPUT);return a}function toHex(_){return Array.prototype.map.call(_,function(a){return(a<16?"0":"")+a.toString(16)}).join("")}function uint32ToHex(_){return(4294967296+_).toString(16).substring(1)}function debugPrint(_,a,$){let j=` `+_+" = ";for(let et=0;et=4294967296&&et++,_[a]=j,_[a+1]=et}function ADD64AC(_,a,$,j){let et=_[a]+$;$<0&&(et+=4294967296);let tt=_[a+1]+j;et>=4294967296&&tt++,_[a]=et,_[a+1]=tt}function B2B_GET32(_,a){return _[a]^_[a+1]<<8^_[a+2]<<16^_[a+3]<<24}function B2B_G(_,a,$,j,et,tt){const rt=m$1[et],nt=m$1[et+1],it=m$1[tt],ot=m$1[tt+1];ADD64AA(v$2,_,a),ADD64AC(v$2,_,rt,nt);let st=v$2[j]^v$2[_],ct=v$2[j+1]^v$2[_+1];v$2[j]=ct,v$2[j+1]=st,ADD64AA(v$2,$,j),st=v$2[a]^v$2[$],ct=v$2[a+1]^v$2[$+1],v$2[a]=st>>>24^ct<<8,v$2[a+1]=ct>>>24^st<<8,ADD64AA(v$2,_,a),ADD64AC(v$2,_,it,ot),st=v$2[j]^v$2[_],ct=v$2[j+1]^v$2[_+1],v$2[j]=st>>>16^ct<<16,v$2[j+1]=ct>>>16^st<<16,ADD64AA(v$2,$,j),st=v$2[a]^v$2[$],ct=v$2[a+1]^v$2[$+1],v$2[a]=ct>>>31^st<<1,v$2[a+1]=st>>>31^ct<<1}const BLAKE2B_IV32=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),SIGMA8=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],SIGMA82=new Uint8Array(SIGMA8.map(function(_){return _*2})),v$2=new Uint32Array(32),m$1=new Uint32Array(32);function blake2bCompress(_,a){let $=0;for($=0;$<16;$++)v$2[$]=_.h[$],v$2[$+16]=BLAKE2B_IV32[$];for(v$2[24]=v$2[24]^_.t,v$2[25]=v$2[25]^_.t/4294967296,a&&(v$2[28]=~v$2[28],v$2[29]=~v$2[29]),$=0;$<32;$++)m$1[$]=B2B_GET32(_.b,4*$);for($=0;$<12;$++)B2B_G(0,8,16,24,SIGMA82[$*16+0],SIGMA82[$*16+1]),B2B_G(2,10,18,26,SIGMA82[$*16+2],SIGMA82[$*16+3]),B2B_G(4,12,20,28,SIGMA82[$*16+4],SIGMA82[$*16+5]),B2B_G(6,14,22,30,SIGMA82[$*16+6],SIGMA82[$*16+7]),B2B_G(0,10,20,30,SIGMA82[$*16+8],SIGMA82[$*16+9]),B2B_G(2,12,22,24,SIGMA82[$*16+10],SIGMA82[$*16+11]),B2B_G(4,14,16,26,SIGMA82[$*16+12],SIGMA82[$*16+13]),B2B_G(6,8,18,28,SIGMA82[$*16+14],SIGMA82[$*16+15]);for($=0;$<16;$++)_.h[$]=_.h[$]^v$2[$]^v$2[$+16]}const parameterBlock=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function blake2bInit(_,a,$,j){if(_===0||_>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(a&&a.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if($&&$.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(j&&j.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const et={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:_};parameterBlock.fill(0),parameterBlock[0]=_,a&&(parameterBlock[1]=a.length),parameterBlock[2]=1,parameterBlock[3]=1,$&¶meterBlock.set($,32),j&¶meterBlock.set(j,48);for(let tt=0;tt<16;tt++)et.h[tt]=BLAKE2B_IV32[tt]^B2B_GET32(parameterBlock,tt*4);return a&&(blake2bUpdate(et,a),et.c=128),et}function blake2bUpdate(_,a){for(let $=0;$>2]>>8*($&3);return a}function blake2b(_,a,$,j,et){$=$||64,_=util$2.normalizeInput(_),j&&(j=util$2.normalizeInput(j)),et&&(et=util$2.normalizeInput(et));const tt=blake2bInit($,a,j,et);return blake2bUpdate(tt,_),blake2bFinal(tt)}function blake2bHex(_,a,$,j,et){const tt=blake2b(_,a,$,j,et);return util$2.toHex(tt)}var blake2b_1={blake2b,blake2bHex,blake2bInit,blake2bUpdate,blake2bFinal};const util$1=util$3;function B2S_GET32(_,a){return _[a]^_[a+1]<<8^_[a+2]<<16^_[a+3]<<24}function B2S_G(_,a,$,j,et,tt){v$1[_]=v$1[_]+v$1[a]+et,v$1[j]=ROTR32(v$1[j]^v$1[_],16),v$1[$]=v$1[$]+v$1[j],v$1[a]=ROTR32(v$1[a]^v$1[$],12),v$1[_]=v$1[_]+v$1[a]+tt,v$1[j]=ROTR32(v$1[j]^v$1[_],8),v$1[$]=v$1[$]+v$1[j],v$1[a]=ROTR32(v$1[a]^v$1[$],7)}function ROTR32(_,a){return _>>>a^_<<32-a}const BLAKE2S_IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),v$1=new Uint32Array(16),m=new Uint32Array(16);function blake2sCompress(_,a){let $=0;for($=0;$<8;$++)v$1[$]=_.h[$],v$1[$+8]=BLAKE2S_IV[$];for(v$1[12]^=_.t,v$1[13]^=_.t/4294967296,a&&(v$1[14]=~v$1[14]),$=0;$<16;$++)m[$]=B2S_GET32(_.b,4*$);for($=0;$<10;$++)B2S_G(0,4,8,12,m[SIGMA[$*16+0]],m[SIGMA[$*16+1]]),B2S_G(1,5,9,13,m[SIGMA[$*16+2]],m[SIGMA[$*16+3]]),B2S_G(2,6,10,14,m[SIGMA[$*16+4]],m[SIGMA[$*16+5]]),B2S_G(3,7,11,15,m[SIGMA[$*16+6]],m[SIGMA[$*16+7]]),B2S_G(0,5,10,15,m[SIGMA[$*16+8]],m[SIGMA[$*16+9]]),B2S_G(1,6,11,12,m[SIGMA[$*16+10]],m[SIGMA[$*16+11]]),B2S_G(2,7,8,13,m[SIGMA[$*16+12]],m[SIGMA[$*16+13]]),B2S_G(3,4,9,14,m[SIGMA[$*16+14]],m[SIGMA[$*16+15]]);for($=0;$<8;$++)_.h[$]^=v$1[$]^v$1[$+8]}function blake2sInit(_,a){if(!(_>0&&_<=32))throw new Error("Incorrect output length, should be in [1, 32]");const $=a?a.length:0;if(a&&!($>0&&$<=32))throw new Error("Incorrect key length, should be in [1, 32]");const j={h:new Uint32Array(BLAKE2S_IV),b:new Uint8Array(64),c:0,t:0,outlen:_};return j.h[0]^=16842752^$<<8^_,$>0&&(blake2sUpdate(j,a),j.c=64),j}function blake2sUpdate(_,a){for(let $=0;$>2]>>8*($&3)&255;return a}function blake2s(_,a,$){$=$||32,_=util$1.normalizeInput(_);const j=blake2sInit($,a);return blake2sUpdate(j,_),blake2sFinal(j)}function blake2sHex(_,a,$){const j=blake2s(_,a,$);return util$1.toHex(j)}var blake2s_1={blake2s,blake2sHex,blake2sInit,blake2sUpdate,blake2sFinal};const b2b=blake2b_1,b2s=blake2s_1;var blakejs={blake2b:b2b.blake2b,blake2bHex:b2b.blake2bHex,blake2bInit:b2b.blake2bInit,blake2bUpdate:b2b.blake2bUpdate,blake2bFinal:b2b.blake2bFinal,blake2s:b2s.blake2s,blake2sHex:b2s.blake2sHex,blake2sInit:b2s.blake2sInit,blake2sUpdate:b2s.blake2sUpdate,blake2sFinal:b2s.blake2sFinal};const blake=getDefaultExportFromCjs$1(blakejs);var sha256$2={},_sha2={},_assert={};Object.defineProperty(_assert,"__esModule",{value:!0});_assert.output=_assert.exists=_assert.hash=_assert.bytes=_assert.bool=_assert.number=void 0;function number$2(_){if(!Number.isSafeInteger(_)||_<0)throw new Error(`Wrong positive integer: ${_}`)}_assert.number=number$2;function bool$2(_){if(typeof _!="boolean")throw new Error(`Expected boolean, not ${_}`)}_assert.bool=bool$2;function isBytes$3(_){return _ instanceof Uint8Array||_!=null&&typeof _=="object"&&_.constructor.name==="Uint8Array"}function bytes$1(_,...a){if(!isBytes$3(_))throw new Error("Expected Uint8Array");if(a.length>0&&!a.includes(_.length))throw new Error(`Expected Uint8Array of length ${a}, not of length=${_.length}`)}_assert.bytes=bytes$1;function hash$2(_){if(typeof _!="function"||typeof _.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$2(_.outputLen),number$2(_.blockLen)}_assert.hash=hash$2;function exists$1(_,a=!0){if(_.destroyed)throw new Error("Hash instance has been destroyed");if(a&&_.finished)throw new Error("Hash#digest() has already been called")}_assert.exists=exists$1;function output$1(_,a){bytes$1(_);const $=a.outputLen;if(_.length<$)throw new Error(`digestInto() expects output buffer of length at least ${$}`)}_assert.output=output$1;const assert$2={number:number$2,bool:bool$2,bytes:bytes$1,hash:hash$2,exists:exists$1,output:output$1};_assert.default=assert$2;var utils$2={},crypto$1={};Object.defineProperty(crypto$1,"__esModule",{value:!0});crypto$1.crypto=void 0;crypto$1.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(_){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(_,"__esModule",{value:!0}),_.randomBytes=_.wrapXOFConstructorWithOpts=_.wrapConstructorWithOpts=_.wrapConstructor=_.checkOpts=_.Hash=_.concatBytes=_.toBytes=_.utf8ToBytes=_.asyncLoop=_.nextTick=_.hexToBytes=_.bytesToHex=_.isLE=_.rotr=_.createView=_.u32=_.u8=void 0;const a=crypto$1,$=$t=>new Uint8Array($t.buffer,$t.byteOffset,$t.byteLength);_.u8=$;const j=$t=>new Uint32Array($t.buffer,$t.byteOffset,Math.floor($t.byteLength/4));_.u32=j;function et($t){return $t instanceof Uint8Array||$t!=null&&typeof $t=="object"&&$t.constructor.name==="Uint8Array"}const tt=$t=>new DataView($t.buffer,$t.byteOffset,$t.byteLength);_.createView=tt;const rt=($t,Bt)=>$t<<32-Bt|$t>>>Bt;if(_.rotr=rt,_.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!_.isLE)throw new Error("Non little-endian hardware is not supported");const nt=Array.from({length:256},($t,Bt)=>Bt.toString(16).padStart(2,"0"));function it($t){if(!et($t))throw new Error("Uint8Array expected");let Bt="";for(let Nt=0;Nt<$t.length;Nt++)Bt+=nt[$t[Nt]];return Bt}_.bytesToHex=it;const ot={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function st($t){if($t>=ot._0&&$t<=ot._9)return $t-ot._0;if($t>=ot._A&&$t<=ot._F)return $t-(ot._A-10);if($t>=ot._a&&$t<=ot._f)return $t-(ot._a-10)}function ct($t){if(typeof $t!="string")throw new Error("hex string expected, got "+typeof $t);const Bt=$t.length,Nt=Bt/2;if(Bt%2)throw new Error("padded hex string expected, got unpadded hex of length "+Bt);const Lt=new Uint8Array(Nt);for(let Pt=0,bt=0;Pt{};_.nextTick=ut;async function ht($t,Bt,Nt){let Lt=Date.now();for(let Pt=0;Pt<$t;Pt++){Nt(Pt);const bt=Date.now()-Lt;bt>=0&&bt$t().update(St(Lt)).digest(),Nt=$t();return Bt.outputLen=Nt.outputLen,Bt.blockLen=Nt.blockLen,Bt.create=()=>$t(),Bt}_.wrapConstructor=zt;function Ut($t){const Bt=(Lt,Pt)=>$t(Pt).update(St(Lt)).digest(),Nt=$t({});return Bt.outputLen=Nt.outputLen,Bt.blockLen=Nt.blockLen,Bt.create=Lt=>$t(Lt),Bt}_.wrapConstructorWithOpts=Ut;function Vt($t){const Bt=(Lt,Pt)=>$t(Pt).update(St(Lt)).digest(),Nt=$t({});return Bt.outputLen=Nt.outputLen,Bt.blockLen=Nt.blockLen,Bt.create=Lt=>$t(Lt),Bt}_.wrapXOFConstructorWithOpts=Vt;function jt($t=32){if(a.crypto&&typeof a.crypto.getRandomValues=="function")return a.crypto.getRandomValues(new Uint8Array($t));throw new Error("crypto.getRandomValues must be defined")}_.randomBytes=jt})(utils$2);Object.defineProperty(_sha2,"__esModule",{value:!0});_sha2.SHA2=void 0;const _assert_js_1$1=_assert,utils_js_1$3=utils$2;function setBigUint64(_,a,$,j){if(typeof _.setBigUint64=="function")return _.setBigUint64(a,$,j);const et=BigInt(32),tt=BigInt(4294967295),rt=Number($>>et&tt),nt=Number($&tt),it=j?4:0,ot=j?0:4;_.setUint32(a+it,rt,j),_.setUint32(a+ot,nt,j)}class SHA2 extends utils_js_1$3.Hash{constructor(a,$,j,et){super(),this.blockLen=a,this.outputLen=$,this.padOffset=j,this.isLE=et,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(a),this.view=(0,utils_js_1$3.createView)(this.buffer)}update(a){(0,_assert_js_1$1.exists)(this);const{view:$,buffer:j,blockLen:et}=this;a=(0,utils_js_1$3.toBytes)(a);const tt=a.length;for(let rt=0;rtet-rt&&(this.process(j,0),rt=0);for(let ct=rt;ctst.length)throw new Error("_sha2: outputLen bigger than state");for(let ct=0;ct_&a^~_&$,Maj=(_,a,$)=>_&a^_&$^a&$,SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64);class SHA256 extends _sha2_js_1$1.SHA2{constructor(){super(64,32,8,!1),this.A=IV[0]|0,this.B=IV[1]|0,this.C=IV[2]|0,this.D=IV[3]|0,this.E=IV[4]|0,this.F=IV[5]|0,this.G=IV[6]|0,this.H=IV[7]|0}get(){const{A:a,B:$,C:j,D:et,E:tt,F:rt,G:nt,H:it}=this;return[a,$,j,et,tt,rt,nt,it]}set(a,$,j,et,tt,rt,nt,it){this.A=a|0,this.B=$|0,this.C=j|0,this.D=et|0,this.E=tt|0,this.F=rt|0,this.G=nt|0,this.H=it|0}process(a,$){for(let ct=0;ct<16;ct++,$+=4)SHA256_W[ct]=a.getUint32($,!1);for(let ct=16;ct<64;ct++){const ut=SHA256_W[ct-15],ht=SHA256_W[ct-2],Et=(0,utils_js_1$2.rotr)(ut,7)^(0,utils_js_1$2.rotr)(ut,18)^ut>>>3,St=(0,utils_js_1$2.rotr)(ht,17)^(0,utils_js_1$2.rotr)(ht,19)^ht>>>10;SHA256_W[ct]=St+SHA256_W[ct-7]+Et+SHA256_W[ct-16]|0}let{A:j,B:et,C:tt,D:rt,E:nt,F:it,G:ot,H:st}=this;for(let ct=0;ct<64;ct++){const ut=(0,utils_js_1$2.rotr)(nt,6)^(0,utils_js_1$2.rotr)(nt,11)^(0,utils_js_1$2.rotr)(nt,25),ht=st+ut+Chi(nt,it,ot)+SHA256_K[ct]+SHA256_W[ct]|0,St=((0,utils_js_1$2.rotr)(j,2)^(0,utils_js_1$2.rotr)(j,13)^(0,utils_js_1$2.rotr)(j,22))+Maj(j,et,tt)|0;st=ot,ot=it,it=nt,nt=rt+ht|0,rt=tt,tt=et,et=j,j=ht+St|0}j=j+this.A|0,et=et+this.B|0,tt=tt+this.C|0,rt=rt+this.D|0,nt=nt+this.E|0,it=it+this.F|0,ot=ot+this.G|0,st=st+this.H|0,this.set(j,et,tt,rt,nt,it,ot,st)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class SHA224 extends SHA256{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}sha256$2.sha256=(0,utils_js_1$2.wrapConstructor)(()=>new SHA256);sha256$2.sha224=(0,utils_js_1$2.wrapConstructor)(()=>new SHA224);function base$1(_){if(_.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),$=0;$>>0,Ot=new Uint8Array(Ct);Mt!==kt;){for(var zt=ht[Mt],Ut=0,Vt=Ct-1;(zt!==0||Ut>>0,Ot[Vt]=zt%rt>>>0,zt=zt/rt>>>0;if(zt!==0)throw new Error("Non-zero carry");St=Ut,Mt++}for(var jt=Ct-St;jt!==Ct&&Ot[jt]===0;)jt++;for(var $t=nt.repeat(Et);jt>>0,Ct=new Uint8Array(kt);ht[Et];){var Ot=a[ht.charCodeAt(Et)];if(Ot===255)return;for(var zt=0,Ut=kt-1;(Ot!==0||zt>>0,Ct[Ut]=Ot%256>>>0,Ot=Ot/256>>>0;if(Ot!==0)throw new Error("Non-zero carry");Mt=zt,Et++}for(var Vt=kt-Mt;Vt!==kt&&Ct[Vt]===0;)Vt++;for(var jt=new Uint8Array(St+(kt-Vt)),$t=St;Vt!==kt;)jt[$t++]=Ct[Vt++];return jt}function ut(ht){var Et=ct(ht);if(Et)return Et;throw new Error("Non-base"+rt+" character")}return{encode:st,decodeUnsafe:ct,decode:ut}}var src$1=base$1;const basex=src$1,ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var bs58=basex(ALPHABET),base58=bs58,base=function(_){function a(tt){var rt=Uint8Array.from(tt),nt=_(rt),it=rt.length+4,ot=new Uint8Array(it);return ot.set(rt,0),ot.set(nt.subarray(0,4),rt.length),base58.encode(ot,it)}function $(tt){var rt=tt.slice(0,-4),nt=tt.slice(-4),it=_(rt);if(!(nt[0]^it[0]|nt[1]^it[1]|nt[2]^it[2]|nt[3]^it[3]))return rt}function j(tt){var rt=base58.decodeUnsafe(tt);if(rt)return $(rt)}function et(tt){var rt=base58.decode(tt),nt=$(rt);if(!nt)throw new Error("Invalid checksum");return nt}return{encode:a,decode:et,decodeUnsafe:j}},{sha256:sha256$1}=sha256$2,bs58checkBase=base;function sha256x2(_){return sha256$1(sha256$1(_))}var bs58check=bs58checkBase(sha256x2);const bs58check$1=getDefaultExportFromCjs$1(bs58check);class TaquitoError extends Error{}class ParameterValidationError extends TaquitoError{}class RpcError extends TaquitoError{}class TezosToolkitConfigError extends TaquitoError{}class UnsupportedActionError extends TaquitoError{}class NetworkError extends TaquitoError{}class InvalidAddressError extends ParameterValidationError{constructor(a,$){super(),this.address=a,this.errorDetail=$,this.name="InvalidAddressError",this.message=`Invalid address "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidBlockHashError extends ParameterValidationError{constructor(a,$){super(),this.blockHash=a,this.errorDetail=$,this.name="InvalidBlockHashError",this.message=`Invalid block hash "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidAmountError extends ParameterValidationError{constructor(a){super(),this.amount=a,this.name="InvalidAmountError",this.message=`Invalid amount "${a}"`}}class InvalidDerivationPathError extends ParameterValidationError{constructor(a,$){super(),this.derivationPath=a,this.errorDetail=$,this.name="InvalidDerivationPathError",this.message=`Invalid derivation path "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidHexStringError extends ParameterValidationError{constructor(a,$){super(),this.hexString=a,this.errorDetail=$,this.name="InvalidHexStringError",this.message=`Invalid hex string "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidMessageError extends ParameterValidationError{constructor(a,$){super(),this.msg=a,this.errorDetail=$,this.name="InvalidMessageError",this.message=`Invalid message "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidViewParameterError extends ParameterValidationError{constructor(a,$,j,et){super(),this.viewName=a,this.sigs=$,this.args=j,this.cause=et,this.name="InvalidViewParameterError",this.message=`Invalid view arguments ${JSON.stringify(j)} received for name "${a}" expecting one of the following signatures ${JSON.stringify($)}.`}}class InvalidKeyError extends ParameterValidationError{constructor(a){super(),this.errorDetail=a,this.name="InvalidKeyError",this.message="Invalid private key",this.message+=a?` ${a}.`:"."}}class InvalidPublicKeyError extends ParameterValidationError{constructor(a,$){super(),this.publicKey=a,this.errorDetail=$,this.name="InvalidPublicKeyError",this.message=`Invalid public key "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidContractAddressError extends ParameterValidationError{constructor(a,$){super(),this.contractAddress=a,this.errorDetail=$,this.name="InvalidContractAddressError",this.message=`Invalid contract address "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidChainIdError extends ParameterValidationError{constructor(a,$){super(),this.chainId=a,this.errorDetail=$,this.name="InvalidChainIdError",this.message=`Invalid chain id "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidKeyHashError extends ParameterValidationError{constructor(a,$){super(),this.keyHash=a,this.errorDetail=$,this.name="InvalidKeyHashError",this.message=`Invalid public key hash "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidOperationHashError extends ParameterValidationError{constructor(a,$){super(),this.operationHash=a,this.errorDetail=$,this.name="InvalidOperationHashError",this.message=`Invalid operation hash "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidOperationKindError extends ParameterValidationError{constructor(a,$){super(),this.operationKind=a,this.errorDetail=$,this.name="InvalidOperationKindError",this.message=`Invalid operation kind "${a}"`,this.message+=$?` ${$}.`:"."}}class DeprecationError extends UnsupportedActionError{constructor(a){super(),this.message=a,this.name="DeprecationError"}}class ProhibitedActionError extends UnsupportedActionError{constructor(a){super(),this.message=a,this.name="ProhibitedActionError"}}class PublicKeyNotFoundError extends TaquitoError{constructor(a,$){super(),this.pkh=a,this.cause=$,this.name="PublicKeyNotFoundError",this.message=`Public key not found of this address "${a}" in either wallet or contract API.`}}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER$2=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(_){var a,$,j,et=Ct.prototype={constructor:Ct,toString:null,valueOf:null},tt=new Ct(1),rt=20,nt=4,it=-7,ot=21,st=-1e7,ct=1e7,ut=!1,ht=1,Et=0,St={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Mt="0123456789abcdefghijklmnopqrstuvwxyz",kt=!0;function Ct($t,Bt){var Nt,Lt,Pt,bt,at,dt,vt,xt,wt=this;if(!(wt instanceof Ct))return new Ct($t,Bt);if(Bt==null){if($t&&$t._isBigNumber===!0){wt.s=$t.s,!$t.c||$t.e>ct?wt.c=wt.e=null:$t.e=10;at/=10,bt++);bt>ct?wt.c=wt.e=null:(wt.e=bt,wt.c=[$t]);return}xt=String($t)}else{if(!isNumeric.test(xt=String($t)))return j(wt,xt,dt);wt.s=xt.charCodeAt(0)==45?(xt=xt.slice(1),-1):1}(bt=xt.indexOf("."))>-1&&(xt=xt.replace(".","")),(at=xt.search(/e/i))>0?(bt<0&&(bt=at),bt+=+xt.slice(at+1),xt=xt.substring(0,at)):bt<0&&(bt=xt.length)}else{if(intCheck(Bt,2,Mt.length,"Base"),Bt==10&&kt)return wt=new Ct($t),Vt(wt,rt+wt.e+1,nt);if(xt=String($t),dt=typeof $t=="number"){if($t*0!=0)return j(wt,xt,dt,Bt);if(wt.s=1/$t<0?(xt=xt.slice(1),-1):1,Ct.DEBUG&&xt.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+$t)}else wt.s=xt.charCodeAt(0)===45?(xt=xt.slice(1),-1):1;for(Nt=Mt.slice(0,Bt),bt=at=0,vt=xt.length;atbt){bt=vt;continue}}else if(!Pt&&(xt==xt.toUpperCase()&&(xt=xt.toLowerCase())||xt==xt.toLowerCase()&&(xt=xt.toUpperCase()))){Pt=!0,at=-1,bt=0;continue}return j(wt,String($t),dt,Bt)}dt=!1,xt=$(xt,Bt,10,wt.s),(bt=xt.indexOf("."))>-1?xt=xt.replace(".",""):bt=xt.length}for(at=0;xt.charCodeAt(at)===48;at++);for(vt=xt.length;xt.charCodeAt(--vt)===48;);if(xt=xt.slice(at,++vt)){if(vt-=at,dt&&Ct.DEBUG&&vt>15&&($t>MAX_SAFE_INTEGER$2||$t!==mathfloor($t)))throw Error(tooManyDigits+wt.s*$t);if((bt=bt-at-1)>ct)wt.c=wt.e=null;else if(bt=-MAX&&Pt<=MAX&&Pt===mathfloor(Pt)){if(Lt[0]===0){if(Pt===0&&Lt.length===1)return!0;break e}if(Bt=(Pt+1)%LOG_BASE,Bt<1&&(Bt+=LOG_BASE),String(Lt[0]).length==Bt){for(Bt=0;Bt=BASE||Nt!==mathfloor(Nt))break e;if(Nt!==0)return!0}}}else if(Lt===null&&Pt===null&&(bt===null||bt===1||bt===-1))return!0;throw Error(bignumberError+"Invalid BigNumber: "+$t)},Ct.maximum=Ct.max=function(){return zt(arguments,-1)},Ct.minimum=Ct.min=function(){return zt(arguments,1)},Ct.random=function(){var $t=9007199254740992,Bt=Math.random()*$t&2097151?function(){return mathfloor(Math.random()*$t)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(Nt){var Lt,Pt,bt,at,dt,vt=0,xt=[],wt=new Ct(tt);if(Nt==null?Nt=rt:intCheck(Nt,0,MAX),at=mathceil(Nt/LOG_BASE),ut)if(crypto.getRandomValues){for(Lt=crypto.getRandomValues(new Uint32Array(at*=2));vt>>11),dt>=9e15?(Pt=crypto.getRandomValues(new Uint32Array(2)),Lt[vt]=Pt[0],Lt[vt+1]=Pt[1]):(xt.push(dt%1e14),vt+=2);vt=at/2}else if(crypto.randomBytes){for(Lt=crypto.randomBytes(at*=7);vt=9e15?crypto.randomBytes(7).copy(Lt,vt):(xt.push(dt%1e14),vt+=7);vt=at/7}else throw ut=!1,Error(bignumberError+"crypto unavailable");if(!ut)for(;vt=10;dt/=10,vt++);vtPt-1&&(dt[at+1]==null&&(dt[at+1]=0),dt[at+1]+=dt[at]/Pt|0,dt[at]%=Pt)}return dt.reverse()}return function(Nt,Lt,Pt,bt,at){var dt,vt,xt,wt,_t,At,Tt,yt,It=Nt.indexOf("."),rr=rt,ir=nt;for(It>=0&&(wt=Et,Et=0,Nt=Nt.replace(".",""),yt=new Ct(Lt),At=yt.pow(Nt.length-It),Et=wt,yt.c=Bt(toFixedPoint(coeffToString(At.c),At.e,"0"),10,Pt,$t),yt.e=yt.c.length),Tt=Bt(Nt,Lt,Pt,at?(dt=Mt,$t):(dt=$t,Mt)),xt=wt=Tt.length;Tt[--wt]==0;Tt.pop());if(!Tt[0])return dt.charAt(0);if(It<0?--xt:(At.c=Tt,At.e=xt,At.s=bt,At=a(At,yt,rr,ir,Pt),Tt=At.c,_t=At.r,xt=At.e),vt=xt+rr+1,It=Tt[vt],wt=Pt/2,_t=_t||vt<0||Tt[vt+1]!=null,_t=ir<4?(It!=null||_t)&&(ir==0||ir==(At.s<0?3:2)):It>wt||It==wt&&(ir==4||_t||ir==6&&Tt[vt-1]&1||ir==(At.s<0?8:7)),vt<1||!Tt[0])Nt=_t?toFixedPoint(dt.charAt(1),-rr,dt.charAt(0)):dt.charAt(0);else{if(Tt.length=vt,_t)for(--Pt;++Tt[--vt]>Pt;)Tt[vt]=0,vt||(++xt,Tt=[1].concat(Tt));for(wt=Tt.length;!Tt[--wt];);for(It=0,Nt="";It<=wt;Nt+=dt.charAt(Tt[It++]));Nt=toFixedPoint(Nt,xt,dt.charAt(0))}return Nt}}(),a=function(){function $t(Lt,Pt,bt){var at,dt,vt,xt,wt=0,_t=Lt.length,At=Pt%SQRT_BASE,Tt=Pt/SQRT_BASE|0;for(Lt=Lt.slice();_t--;)vt=Lt[_t]%SQRT_BASE,xt=Lt[_t]/SQRT_BASE|0,at=Tt*vt+xt*At,dt=At*vt+at%SQRT_BASE*SQRT_BASE+wt,wt=(dt/bt|0)+(at/SQRT_BASE|0)+Tt*xt,Lt[_t]=dt%bt;return wt&&(Lt=[wt].concat(Lt)),Lt}function Bt(Lt,Pt,bt,at){var dt,vt;if(bt!=at)vt=bt>at?1:-1;else for(dt=vt=0;dtPt[dt]?1:-1;break}return vt}function Nt(Lt,Pt,bt,at){for(var dt=0;bt--;)Lt[bt]-=dt,dt=Lt[bt]1;Lt.splice(0,1));}return function(Lt,Pt,bt,at,dt){var vt,xt,wt,_t,At,Tt,yt,It,rr,ir,nr,Gt,qt,Jt,Ft,Kt,Qt,dr=Lt.s==Pt.s?1:-1,xr=Lt.c,pr=Pt.c;if(!xr||!xr[0]||!pr||!pr[0])return new Ct(!Lt.s||!Pt.s||(xr?pr&&xr[0]==pr[0]:!pr)?NaN:xr&&xr[0]==0||!pr?dr*0:dr/0);for(It=new Ct(dr),rr=It.c=[],xt=Lt.e-Pt.e,dr=bt+xt+1,dt||(dt=BASE,xt=bitFloor(Lt.e/LOG_BASE)-bitFloor(Pt.e/LOG_BASE),dr=dr/LOG_BASE|0),wt=0;pr[wt]==(xr[wt]||0);wt++);if(pr[wt]>(xr[wt]||0)&&xt--,dr<0)rr.push(1),_t=!0;else{for(Jt=xr.length,Kt=pr.length,wt=0,dr+=2,At=mathfloor(dt/(pr[0]+1)),At>1&&(pr=$t(pr,At,dt),xr=$t(xr,At,dt),Kt=pr.length,Jt=xr.length),qt=Kt,ir=xr.slice(0,Kt),nr=ir.length;nr=dt/2&&Ft++;do{if(At=0,vt=Bt(pr,ir,Kt,nr),vt<0){if(Gt=ir[0],Kt!=nr&&(Gt=Gt*dt+(ir[1]||0)),At=mathfloor(Gt/Ft),At>1)for(At>=dt&&(At=dt-1),Tt=$t(pr,At,dt),yt=Tt.length,nr=ir.length;Bt(Tt,ir,yt,nr)==1;)At--,Nt(Tt,Kt=10;dr/=10,wt++);Vt(It,bt+(It.e=wt+xt*LOG_BASE-1)+1,at,_t)}else It.e=xt,It.r=+_t;return It}}();function Ot($t,Bt,Nt,Lt){var Pt,bt,at,dt,vt;if(Nt==null?Nt=nt:intCheck(Nt,0,8),!$t.c)return $t.toString();if(Pt=$t.c[0],at=$t.e,Bt==null)vt=coeffToString($t.c),vt=Lt==1||Lt==2&&(at<=it||at>=ot)?toExponential(vt,at):toFixedPoint(vt,at,"0");else if($t=Vt(new Ct($t),Bt,Nt),bt=$t.e,vt=coeffToString($t.c),dt=vt.length,Lt==1||Lt==2&&(Bt<=bt||bt<=it)){for(;dtdt){if(--Bt>0)for(vt+=".";Bt--;vt+="0");}else if(Bt+=bt-dt,Bt>0)for(bt+1==dt&&(vt+=".");Bt--;vt+="0");return $t.s<0&&Pt?"-"+vt:vt}function zt($t,Bt){for(var Nt,Lt,Pt=1,bt=new Ct($t[0]);Pt<$t.length;Pt++)Lt=new Ct($t[Pt]),(!Lt.s||(Nt=compare$c(bt,Lt))===Bt||Nt===0&&bt.s===Bt)&&(bt=Lt);return bt}function Ut($t,Bt,Nt){for(var Lt=1,Pt=Bt.length;!Bt[--Pt];Bt.pop());for(Pt=Bt[0];Pt>=10;Pt/=10,Lt++);return(Nt=Lt+Nt*LOG_BASE-1)>ct?$t.c=$t.e=null:Nt=10;dt/=10,Pt++);if(bt=Bt-Pt,bt<0)bt+=LOG_BASE,at=Bt,vt=_t[xt=0],wt=mathfloor(vt/At[Pt-at-1]%10);else if(xt=mathceil((bt+1)/LOG_BASE),xt>=_t.length)if(Lt){for(;_t.length<=xt;_t.push(0));vt=wt=0,Pt=1,bt%=LOG_BASE,at=bt-LOG_BASE+1}else break e;else{for(vt=dt=_t[xt],Pt=1;dt>=10;dt/=10,Pt++);bt%=LOG_BASE,at=bt-LOG_BASE+Pt,wt=at<0?0:mathfloor(vt/At[Pt-at-1]%10)}if(Lt=Lt||Bt<0||_t[xt+1]!=null||(at<0?vt:vt%At[Pt-at-1]),Lt=Nt<4?(wt||Lt)&&(Nt==0||Nt==($t.s<0?3:2)):wt>5||wt==5&&(Nt==4||Lt||Nt==6&&(bt>0?at>0?vt/At[Pt-at]:0:_t[xt-1])%10&1||Nt==($t.s<0?8:7)),Bt<1||!_t[0])return _t.length=0,Lt?(Bt-=$t.e+1,_t[0]=At[(LOG_BASE-Bt%LOG_BASE)%LOG_BASE],$t.e=-Bt||0):_t[0]=$t.e=0,$t;if(bt==0?(_t.length=xt,dt=1,xt--):(_t.length=xt+1,dt=At[LOG_BASE-bt],_t[xt]=at>0?mathfloor(vt/At[Pt-at]%At[at])*dt:0),Lt)for(;;)if(xt==0){for(bt=1,at=_t[0];at>=10;at/=10,bt++);for(at=_t[0]+=dt,dt=1;at>=10;at/=10,dt++);bt!=dt&&($t.e++,_t[0]==BASE&&(_t[0]=1));break}else{if(_t[xt]+=dt,_t[xt]!=BASE)break;_t[xt--]=0,dt=1}for(bt=_t.length;_t[--bt]===0;_t.pop());}$t.e>ct?$t.c=$t.e=null:$t.e=ot?toExponential(Bt,Nt):toFixedPoint(Bt,Nt,"0"),$t.s<0?"-"+Bt:Bt)}return et.absoluteValue=et.abs=function(){var $t=new Ct(this);return $t.s<0&&($t.s=1),$t},et.comparedTo=function($t,Bt){return compare$c(this,new Ct($t,Bt))},et.decimalPlaces=et.dp=function($t,Bt){var Nt,Lt,Pt,bt=this;if($t!=null)return intCheck($t,0,MAX),Bt==null?Bt=nt:intCheck(Bt,0,8),Vt(new Ct(bt),$t+bt.e+1,Bt);if(!(Nt=bt.c))return null;if(Lt=((Pt=Nt.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,Pt=Nt[Pt])for(;Pt%10==0;Pt/=10,Lt--);return Lt<0&&(Lt=0),Lt},et.dividedBy=et.div=function($t,Bt){return a(this,new Ct($t,Bt),rt,nt)},et.dividedToIntegerBy=et.idiv=function($t,Bt){return a(this,new Ct($t,Bt),0,1)},et.exponentiatedBy=et.pow=function($t,Bt){var Nt,Lt,Pt,bt,at,dt,vt,xt,wt,_t=this;if($t=new Ct($t),$t.c&&!$t.isInteger())throw Error(bignumberError+"Exponent not an integer: "+jt($t));if(Bt!=null&&(Bt=new Ct(Bt)),dt=$t.e>14,!_t.c||!_t.c[0]||_t.c[0]==1&&!_t.e&&_t.c.length==1||!$t.c||!$t.c[0])return wt=new Ct(Math.pow(+jt(_t),dt?$t.s*(2-isOdd($t)):+jt($t))),Bt?wt.mod(Bt):wt;if(vt=$t.s<0,Bt){if(Bt.c?!Bt.c[0]:!Bt.s)return new Ct(NaN);Lt=!vt&&_t.isInteger()&&Bt.isInteger(),Lt&&(_t=_t.mod(Bt))}else{if($t.e>9&&(_t.e>0||_t.e<-1||(_t.e==0?_t.c[0]>1||dt&&_t.c[1]>=24e7:_t.c[0]<8e13||dt&&_t.c[0]<=9999975e7)))return bt=_t.s<0&&isOdd($t)?-0:0,_t.e>-1&&(bt=1/bt),new Ct(vt?1/bt:bt);Et&&(bt=mathceil(Et/LOG_BASE+2))}for(dt?(Nt=new Ct(.5),vt&&($t.s=1),xt=isOdd($t)):(Pt=Math.abs(+jt($t)),xt=Pt%2),wt=new Ct(tt);;){if(xt){if(wt=wt.times(_t),!wt.c)break;bt?wt.c.length>bt&&(wt.c.length=bt):Lt&&(wt=wt.mod(Bt))}if(Pt){if(Pt=mathfloor(Pt/2),Pt===0)break;xt=Pt%2}else if($t=$t.times(Nt),Vt($t,$t.e+1,1),$t.e>14)xt=isOdd($t);else{if(Pt=+jt($t),Pt===0)break;xt=Pt%2}_t=_t.times(_t),bt?_t.c&&_t.c.length>bt&&(_t.c.length=bt):Lt&&(_t=_t.mod(Bt))}return Lt?wt:(vt&&(wt=tt.div(wt)),Bt?wt.mod(Bt):bt?Vt(wt,Et,nt,at):wt)},et.integerValue=function($t){var Bt=new Ct(this);return $t==null?$t=nt:intCheck($t,0,8),Vt(Bt,Bt.e+1,$t)},et.isEqualTo=et.eq=function($t,Bt){return compare$c(this,new Ct($t,Bt))===0},et.isFinite=function(){return!!this.c},et.isGreaterThan=et.gt=function($t,Bt){return compare$c(this,new Ct($t,Bt))>0},et.isGreaterThanOrEqualTo=et.gte=function($t,Bt){return(Bt=compare$c(this,new Ct($t,Bt)))===1||Bt===0},et.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},et.isLessThan=et.lt=function($t,Bt){return compare$c(this,new Ct($t,Bt))<0},et.isLessThanOrEqualTo=et.lte=function($t,Bt){return(Bt=compare$c(this,new Ct($t,Bt)))===-1||Bt===0},et.isNaN=function(){return!this.s},et.isNegative=function(){return this.s<0},et.isPositive=function(){return this.s>0},et.isZero=function(){return!!this.c&&this.c[0]==0},et.minus=function($t,Bt){var Nt,Lt,Pt,bt,at=this,dt=at.s;if($t=new Ct($t,Bt),Bt=$t.s,!dt||!Bt)return new Ct(NaN);if(dt!=Bt)return $t.s=-Bt,at.plus($t);var vt=at.e/LOG_BASE,xt=$t.e/LOG_BASE,wt=at.c,_t=$t.c;if(!vt||!xt){if(!wt||!_t)return wt?($t.s=-Bt,$t):new Ct(_t?at:NaN);if(!wt[0]||!_t[0])return _t[0]?($t.s=-Bt,$t):new Ct(wt[0]?at:nt==3?-0:0)}if(vt=bitFloor(vt),xt=bitFloor(xt),wt=wt.slice(),dt=vt-xt){for((bt=dt<0)?(dt=-dt,Pt=wt):(xt=vt,Pt=_t),Pt.reverse(),Bt=dt;Bt--;Pt.push(0));Pt.reverse()}else for(Lt=(bt=(dt=wt.length)<(Bt=_t.length))?dt:Bt,dt=Bt=0;Bt0)for(;Bt--;wt[Nt++]=0);for(Bt=BASE-1;Lt>dt;){if(wt[--Lt]<_t[Lt]){for(Nt=Lt;Nt&&!wt[--Nt];wt[Nt]=Bt);--wt[Nt],wt[Lt]+=BASE}wt[Lt]-=_t[Lt]}for(;wt[0]==0;wt.splice(0,1),--xt);return wt[0]?Ut($t,wt,xt):($t.s=nt==3?-1:1,$t.c=[$t.e=0],$t)},et.modulo=et.mod=function($t,Bt){var Nt,Lt,Pt=this;return $t=new Ct($t,Bt),!Pt.c||!$t.s||$t.c&&!$t.c[0]?new Ct(NaN):!$t.c||Pt.c&&!Pt.c[0]?new Ct(Pt):(ht==9?(Lt=$t.s,$t.s=1,Nt=a(Pt,$t,0,3),$t.s=Lt,Nt.s*=Lt):Nt=a(Pt,$t,0,ht),$t=Pt.minus(Nt.times($t)),!$t.c[0]&&ht==1&&($t.s=Pt.s),$t)},et.multipliedBy=et.times=function($t,Bt){var Nt,Lt,Pt,bt,at,dt,vt,xt,wt,_t,At,Tt,yt,It,rr,ir=this,nr=ir.c,Gt=($t=new Ct($t,Bt)).c;if(!nr||!Gt||!nr[0]||!Gt[0])return!ir.s||!$t.s||nr&&!nr[0]&&!Gt||Gt&&!Gt[0]&&!nr?$t.c=$t.e=$t.s=null:($t.s*=ir.s,!nr||!Gt?$t.c=$t.e=null:($t.c=[0],$t.e=0)),$t;for(Lt=bitFloor(ir.e/LOG_BASE)+bitFloor($t.e/LOG_BASE),$t.s*=ir.s,vt=nr.length,_t=Gt.length,vt<_t&&(yt=nr,nr=Gt,Gt=yt,Pt=vt,vt=_t,_t=Pt),Pt=vt+_t,yt=[];Pt--;yt.push(0));for(It=BASE,rr=SQRT_BASE,Pt=_t;--Pt>=0;){for(Nt=0,At=Gt[Pt]%rr,Tt=Gt[Pt]/rr|0,at=vt,bt=Pt+at;bt>Pt;)xt=nr[--at]%rr,wt=nr[at]/rr|0,dt=Tt*xt+wt*At,xt=At*xt+dt%rr*rr+yt[bt]+Nt,Nt=(xt/It|0)+(dt/rr|0)+Tt*wt,yt[bt--]=xt%It;yt[bt]=Nt}return Nt?++Lt:yt.splice(0,1),Ut($t,yt,Lt)},et.negated=function(){var $t=new Ct(this);return $t.s=-$t.s||null,$t},et.plus=function($t,Bt){var Nt,Lt=this,Pt=Lt.s;if($t=new Ct($t,Bt),Bt=$t.s,!Pt||!Bt)return new Ct(NaN);if(Pt!=Bt)return $t.s=-Bt,Lt.minus($t);var bt=Lt.e/LOG_BASE,at=$t.e/LOG_BASE,dt=Lt.c,vt=$t.c;if(!bt||!at){if(!dt||!vt)return new Ct(Pt/0);if(!dt[0]||!vt[0])return vt[0]?$t:new Ct(dt[0]?Lt:Pt*0)}if(bt=bitFloor(bt),at=bitFloor(at),dt=dt.slice(),Pt=bt-at){for(Pt>0?(at=bt,Nt=vt):(Pt=-Pt,Nt=dt),Nt.reverse();Pt--;Nt.push(0));Nt.reverse()}for(Pt=dt.length,Bt=vt.length,Pt-Bt<0&&(Nt=vt,vt=dt,dt=Nt,Bt=Pt),Pt=0;Bt;)Pt=(dt[--Bt]=dt[Bt]+vt[Bt]+Pt)/BASE|0,dt[Bt]=BASE===dt[Bt]?0:dt[Bt]%BASE;return Pt&&(dt=[Pt].concat(dt),++at),Ut($t,dt,at)},et.precision=et.sd=function($t,Bt){var Nt,Lt,Pt,bt=this;if($t!=null&&$t!==!!$t)return intCheck($t,1,MAX),Bt==null?Bt=nt:intCheck(Bt,0,8),Vt(new Ct(bt),$t,Bt);if(!(Nt=bt.c))return null;if(Pt=Nt.length-1,Lt=Pt*LOG_BASE+1,Pt=Nt[Pt]){for(;Pt%10==0;Pt/=10,Lt--);for(Pt=Nt[0];Pt>=10;Pt/=10,Lt++);}return $t&&bt.e+1>Lt&&(Lt=bt.e+1),Lt},et.shiftedBy=function($t){return intCheck($t,-MAX_SAFE_INTEGER$2,MAX_SAFE_INTEGER$2),this.times("1e"+$t)},et.squareRoot=et.sqrt=function(){var $t,Bt,Nt,Lt,Pt,bt=this,at=bt.c,dt=bt.s,vt=bt.e,xt=rt+4,wt=new Ct("0.5");if(dt!==1||!at||!at[0])return new Ct(!dt||dt<0&&(!at||at[0])?NaN:at?bt:1/0);if(dt=Math.sqrt(+jt(bt)),dt==0||dt==1/0?(Bt=coeffToString(at),(Bt.length+vt)%2==0&&(Bt+="0"),dt=Math.sqrt(+Bt),vt=bitFloor((vt+1)/2)-(vt<0||vt%2),dt==1/0?Bt="5e"+vt:(Bt=dt.toExponential(),Bt=Bt.slice(0,Bt.indexOf("e")+1)+vt),Nt=new Ct(Bt)):Nt=new Ct(dt+""),Nt.c[0]){for(vt=Nt.e,dt=vt+xt,dt<3&&(dt=0);;)if(Pt=Nt,Nt=wt.times(Pt.plus(a(bt,Pt,xt,1))),coeffToString(Pt.c).slice(0,dt)===(Bt=coeffToString(Nt.c)).slice(0,dt))if(Nt.e0&&yt>0){for(bt=yt%dt||dt,wt=Tt.substr(0,bt);bt0&&(wt+=xt+Tt.slice(bt)),At&&(wt="-"+wt)}Lt=_t?wt+(Nt.decimalSeparator||"")+((vt=+Nt.fractionGroupSize)?_t.replace(new RegExp("\\d{"+vt+"}\\B","g"),"$&"+(Nt.fractionGroupSeparator||"")):_t):wt}return(Nt.prefix||"")+Lt+(Nt.suffix||"")},et.toFraction=function($t){var Bt,Nt,Lt,Pt,bt,at,dt,vt,xt,wt,_t,At,Tt=this,yt=Tt.c;if($t!=null&&(dt=new Ct($t),!dt.isInteger()&&(dt.c||dt.s!==1)||dt.lt(tt)))throw Error(bignumberError+"Argument "+(dt.isInteger()?"out of range: ":"not an integer: ")+jt(dt));if(!yt)return new Ct(Tt);for(Bt=new Ct(tt),xt=Nt=new Ct(tt),Lt=vt=new Ct(tt),At=coeffToString(yt),bt=Bt.e=At.length-Tt.e-1,Bt.c[0]=POWS_TEN[(at=bt%LOG_BASE)<0?LOG_BASE+at:at],$t=!$t||dt.comparedTo(Bt)>0?bt>0?Bt:xt:dt,at=ct,ct=1/0,dt=new Ct(At),vt.c[0]=0;wt=a(dt,Bt,0,1),Pt=Nt.plus(wt.times(Lt)),Pt.comparedTo($t)!=1;)Nt=Lt,Lt=Pt,xt=vt.plus(wt.times(Pt=xt)),vt=Pt,Bt=dt.minus(wt.times(Pt=Bt)),dt=Pt;return Pt=a($t.minus(Nt),Lt,0,1),vt=vt.plus(Pt.times(xt)),Nt=Nt.plus(Pt.times(Lt)),vt.s=xt.s=Tt.s,bt=bt*2,_t=a(xt,Lt,bt,nt).minus(Tt).abs().comparedTo(a(vt,Nt,bt,nt).minus(Tt).abs())<1?[xt,Lt]:[vt,Nt],ct=at,_t},et.toNumber=function(){return+jt(this)},et.toPrecision=function($t,Bt){return $t!=null&&intCheck($t,1,MAX),Ot(this,$t,Bt,2)},et.toString=function($t){var Bt,Nt=this,Lt=Nt.s,Pt=Nt.e;return Pt===null?Lt?(Bt="Infinity",Lt<0&&(Bt="-"+Bt)):Bt="NaN":($t==null?Bt=Pt<=it||Pt>=ot?toExponential(coeffToString(Nt.c),Pt):toFixedPoint(coeffToString(Nt.c),Pt,"0"):$t===10&&kt?(Nt=Vt(new Ct(Nt),rt+Pt+1,nt),Bt=toFixedPoint(coeffToString(Nt.c),Nt.e,"0")):(intCheck($t,2,Mt.length,"Base"),Bt=$(toFixedPoint(coeffToString(Nt.c),Pt,"0"),10,$t,Lt,!0)),Lt<0&&Nt.c[0]&&(Bt="-"+Bt)),Bt},et.valueOf=et.toJSON=function(){return jt(this)},et._isBigNumber=!0,et[Symbol.toStringTag]="BigNumber",et[Symbol.for("nodejs.util.inspect.custom")]=et.valueOf,_!=null&&Ct.set(_),Ct}function bitFloor(_){var a=_|0;return _>0||_===a?a:a-1}function coeffToString(_){for(var a,$,j=1,et=_.length,tt=_[0]+"";jot^$?1:-1;for(nt=(it=et.length)<(ot=tt.length)?it:ot,rt=0;rttt[rt]^$?1:-1;return it==ot?0:it>ot^$?1:-1}function intCheck(_,a,$,j){if(_$||_!==mathfloor(_))throw Error(bignumberError+(j||"Argument")+(typeof _=="number"?_$?" out of range: ":" not an integer: ":" not a primitive number: ")+String(_))}function isOdd(_){var a=_.c.length-1;return bitFloor(_.e/LOG_BASE)==a&&_.c[a]%2!=0}function toExponential(_,a){return(_.length>1?_.charAt(0)+"."+_.slice(1):_)+(a<0?"e":"e+")+a}function toFixedPoint(_,a,$){var j,et;if(a<0){for(et=$+".";++a;et+=$);_=et+_}else if(j=_.length,++a>j){for(et=$,a-=j;--a;et+=$);_+=et}else abs58check$1.decode(_).slice(a.length);function b58decode(_){const a=bs58check$1.decode(_),j={[prefix.tz1.toString()]:"0000",[prefix.tz2.toString()]:"0001",[prefix.tz3.toString()]:"0002"}[new Uint8Array(a.slice(0,3)).toString()];if(j){const et=buf2hex(a.slice(3));return j+et}else return"01"+buf2hex(a.slice(3,42))+"00"}function encodeAddress(_){if(_.substring(0,2)==="0x"&&(_=_.slice(2)),_.substring(0,2)==="00"){const a={"0000":prefix.tz1,"0001":prefix.tz2,"0002":prefix.tz3};return b58cencode(_.substring(4),a[_.substring(0,4)])}return b58cencode(_.substring(2,42),prefix.KT)}function encodeKey(_){if(_[0]==="0"){const a={"00":new Uint8Array([13,15,37,217]),"01":new Uint8Array([3,254,226,86]),"02":new Uint8Array([3,178,139,127])};return b58cencode(_.substring(2),a[_.substring(0,2)])}}function encodeKeyHash(_){if(_[0]==="0"){const a={"00":new Uint8Array([6,161,159]),"01":new Uint8Array([6,161,161]),"02":new Uint8Array([6,161,164])};return b58cencode(_.substring(2),a[_.substring(0,2)])}}const hex2buf=_=>{if(_.length%2!==0)throw new InvalidHexStringError(_,": Expecting even number of characters");const a=stripHexPrefix$1(_);if(!a.match(/^([\da-f]{2})*$/gi))throw new InvalidHexStringError(_,": Only characters 0-9, a-f and A-F are expected. Optionally, it can be prefixed with '0x'");const $=new Uint8Array(a.length/2);let j=0;for(let et=0;et{const $=new Uint8Array(_.length+a.length);return $.set(_),$.set(a,_.length),$},buf2hex=_=>{const a=[];return _.forEach($=>{const et=`00${$.toString(16)}`.slice(-2);a.push(et)}),a.join("")};function hex2Bytes(_){const a=stripHexPrefix$1(_);if(!a.match(/^(0x)?([\da-f]{2})*$/gi))throw new InvalidHexStringError(_,": Expecting even number of characters: 0-9, a-z, A-Z, optionally prefixed with 0x");return buffer$1.Buffer.from(a,"hex")}function stripHexPrefix$1(_){return _.startsWith("0x")?_.slice(2):_}var util;(function(_){_.assertEqual=et=>et;function a(et){}_.assertIs=a;function $(et){throw new Error}_.assertNever=$,_.arrayToEnum=et=>{const tt={};for(const rt of et)tt[rt]=rt;return tt},_.getValidEnumValues=et=>{const tt=_.objectKeys(et).filter(nt=>typeof et[et[nt]]!="number"),rt={};for(const nt of tt)rt[nt]=et[nt];return _.objectValues(rt)},_.objectValues=et=>_.objectKeys(et).map(function(tt){return et[tt]}),_.objectKeys=typeof Object.keys=="function"?et=>Object.keys(et):et=>{const tt=[];for(const rt in et)Object.prototype.hasOwnProperty.call(et,rt)&&tt.push(rt);return tt},_.find=(et,tt)=>{for(const rt of et)if(tt(rt))return rt},_.isInteger=typeof Number.isInteger=="function"?et=>Number.isInteger(et):et=>typeof et=="number"&&isFinite(et)&&Math.floor(et)===et;function j(et,tt=" | "){return et.map(rt=>typeof rt=="string"?`'${rt}'`:rt).join(tt)}_.joinValues=j,_.jsonStringifyReplacer=(et,tt)=>typeof tt=="bigint"?tt.toString():tt})(util||(util={}));var objectUtil;(function(_){_.mergeShapes=(a,$)=>({...a,...$})})(objectUtil||(objectUtil={}));const ZodParsedType=util.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=_=>{switch(typeof _){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(_)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(_)?ZodParsedType.array:_===null?ZodParsedType.null:_.then&&typeof _.then=="function"&&_.catch&&typeof _.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&_ instanceof Map?ZodParsedType.map:typeof Set<"u"&&_ instanceof Set?ZodParsedType.set:typeof Date<"u"&&_ instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=_=>JSON.stringify(_,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(a){super(),this.issues=[],this.addIssue=j=>{this.issues=[...this.issues,j]},this.addIssues=(j=[])=>{this.issues=[...this.issues,...j]};const $=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,$):this.__proto__=$,this.name="ZodError",this.issues=a}get errors(){return this.issues}format(a){const $=a||function(tt){return tt.message},j={_errors:[]},et=tt=>{for(const rt of tt.issues)if(rt.code==="invalid_union")rt.unionErrors.map(et);else if(rt.code==="invalid_return_type")et(rt.returnTypeError);else if(rt.code==="invalid_arguments")et(rt.argumentsError);else if(rt.path.length===0)j._errors.push($(rt));else{let nt=j,it=0;for(;it$.message){const $={},j=[];for(const et of this.issues)et.path.length>0?($[et.path[0]]=$[et.path[0]]||[],$[et.path[0]].push(a(et))):j.push(a(et));return{formErrors:j,fieldErrors:$}}get formErrors(){return this.flatten()}}ZodError.create=_=>new ZodError(_);const errorMap=(_,a)=>{let $;switch(_.code){case ZodIssueCode.invalid_type:_.received===ZodParsedType.undefined?$="Required":$=`Expected ${_.expected}, received ${_.received}`;break;case ZodIssueCode.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(_.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:$=`Unrecognized key(s) in object: ${util.joinValues(_.keys,", ")}`;break;case ZodIssueCode.invalid_union:$="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${util.joinValues(_.options)}`;break;case ZodIssueCode.invalid_enum_value:$=`Invalid enum value. Expected ${util.joinValues(_.options)}, received '${_.received}'`;break;case ZodIssueCode.invalid_arguments:$="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:$="Invalid function return type";break;case ZodIssueCode.invalid_date:$="Invalid date";break;case ZodIssueCode.invalid_string:typeof _.validation=="object"?"includes"in _.validation?($=`Invalid input: must include "${_.validation.includes}"`,typeof _.validation.position=="number"&&($=`${$} at one or more positions greater than or equal to ${_.validation.position}`)):"startsWith"in _.validation?$=`Invalid input: must start with "${_.validation.startsWith}"`:"endsWith"in _.validation?$=`Invalid input: must end with "${_.validation.endsWith}"`:util.assertNever(_.validation):_.validation!=="regex"?$=`Invalid ${_.validation}`:$="Invalid";break;case ZodIssueCode.too_small:_.type==="array"?$=`Array must contain ${_.exact?"exactly":_.inclusive?"at least":"more than"} ${_.minimum} element(s)`:_.type==="string"?$=`String must contain ${_.exact?"exactly":_.inclusive?"at least":"over"} ${_.minimum} character(s)`:_.type==="number"?$=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`:_.type==="date"?$=`Date must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(_.minimum))}`:$="Invalid input";break;case ZodIssueCode.too_big:_.type==="array"?$=`Array must contain ${_.exact?"exactly":_.inclusive?"at most":"less than"} ${_.maximum} element(s)`:_.type==="string"?$=`String must contain ${_.exact?"exactly":_.inclusive?"at most":"under"} ${_.maximum} character(s)`:_.type==="number"?$=`Number must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="bigint"?$=`BigInt must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="date"?$=`Date must be ${_.exact?"exactly":_.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(_.maximum))}`:$="Invalid input";break;case ZodIssueCode.custom:$="Invalid input";break;case ZodIssueCode.invalid_intersection_types:$="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:$=`Number must be a multiple of ${_.multipleOf}`;break;case ZodIssueCode.not_finite:$="Number must be finite";break;default:$=a.defaultError,util.assertNever(_)}return{message:$}};let overrideErrorMap=errorMap;function setErrorMap(_){overrideErrorMap=_}function getErrorMap(){return overrideErrorMap}const makeIssue=_=>{const{data:a,path:$,errorMaps:j,issueData:et}=_,tt=[...$,...et.path||[]],rt={...et,path:tt};if(et.message!==void 0)return{...et,path:tt,message:et.message};let nt="";const it=j.filter(ot=>!!ot).slice().reverse();for(const ot of it)nt=ot(rt,{data:a,defaultError:nt}).message;return{...et,path:tt,message:nt}},EMPTY_PATH=[];function addIssueToContext(_,a){const $=getErrorMap(),j=makeIssue({issueData:a,data:_.data,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,$,$===errorMap?void 0:errorMap].filter(et=>!!et)});_.common.issues.push(j)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(a,$){const j=[];for(const et of $){if(et.status==="aborted")return INVALID;et.status==="dirty"&&a.dirty(),j.push(et.value)}return{status:a.value,value:j}}static async mergeObjectAsync(a,$){const j=[];for(const et of $){const tt=await et.key,rt=await et.value;j.push({key:tt,value:rt})}return ParseStatus.mergeObjectSync(a,j)}static mergeObjectSync(a,$){const j={};for(const et of $){const{key:tt,value:rt}=et;if(tt.status==="aborted"||rt.status==="aborted")return INVALID;tt.status==="dirty"&&a.dirty(),rt.status==="dirty"&&a.dirty(),tt.value!=="__proto__"&&(typeof rt.value<"u"||et.alwaysSet)&&(j[tt.value]=rt.value)}return{status:a.value,value:j}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=_=>({status:"dirty",value:_}),OK=_=>({status:"valid",value:_}),isAborted=_=>_.status==="aborted",isDirty=_=>_.status==="dirty",isValid$1=_=>_.status==="valid",isAsync=_=>typeof Promise<"u"&&_ instanceof Promise;function __classPrivateFieldGet$1(_,a,$,j){if(typeof a=="function"?_!==a||!j:!a.has(_))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a.get(_)}function __classPrivateFieldSet$1(_,a,$,j,et){if(typeof a=="function"?_!==a||!et:!a.has(_))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a.set(_,$),$}typeof SuppressedError=="function"&&SuppressedError;var errorUtil;(function(_){_.errToObj=a=>typeof a=="string"?{message:a}:a||{},_.toString=a=>typeof a=="string"?a:a==null?void 0:a.message})(errorUtil||(errorUtil={}));var _ZodEnum_cache,_ZodNativeEnum_cache;class ParseInputLazyPath{constructor(a,$,j,et){this._cachedPath=[],this.parent=a,this.data=$,this._path=j,this._key=et}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(_,a)=>{if(isValid$1(a))return{success:!0,data:a.value};if(!_.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const $=new ZodError(_.common.issues);return this._error=$,this._error}}};function processCreateParams(_){if(!_)return{};const{errorMap:a,invalid_type_error:$,required_error:j,description:et}=_;if(a&&($||j))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return a?{errorMap:a,description:et}:{errorMap:(rt,nt)=>{var it,ot;const{message:st}=_;return rt.code==="invalid_enum_value"?{message:st??nt.defaultError}:typeof nt.data>"u"?{message:(it=st??j)!==null&&it!==void 0?it:nt.defaultError}:rt.code!=="invalid_type"?{message:nt.defaultError}:{message:(ot=st??$)!==null&&ot!==void 0?ot:nt.defaultError}},description:et}}class ZodType{constructor(a){this.spa=this.safeParseAsync,this._def=a,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(a){return getParsedType(a.data)}_getOrReturnCtx(a,$){return $||{common:a.parent.common,data:a.data,parsedType:getParsedType(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}_processInputParams(a){return{status:new ParseStatus,ctx:{common:a.parent.common,data:a.data,parsedType:getParsedType(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}}_parseSync(a){const $=this._parse(a);if(isAsync($))throw new Error("Synchronous parse encountered promise.");return $}_parseAsync(a){const $=this._parse(a);return Promise.resolve($)}parse(a,$){const j=this.safeParse(a,$);if(j.success)return j.data;throw j.error}safeParse(a,$){var j;const et={common:{issues:[],async:(j=$==null?void 0:$.async)!==null&&j!==void 0?j:!1,contextualErrorMap:$==null?void 0:$.errorMap},path:($==null?void 0:$.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:getParsedType(a)},tt=this._parseSync({data:a,path:et.path,parent:et});return handleResult(et,tt)}async parseAsync(a,$){const j=await this.safeParseAsync(a,$);if(j.success)return j.data;throw j.error}async safeParseAsync(a,$){const j={common:{issues:[],contextualErrorMap:$==null?void 0:$.errorMap,async:!0},path:($==null?void 0:$.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:getParsedType(a)},et=this._parse({data:a,path:j.path,parent:j}),tt=await(isAsync(et)?et:Promise.resolve(et));return handleResult(j,tt)}refine(a,$){const j=et=>typeof $=="string"||typeof $>"u"?{message:$}:typeof $=="function"?$(et):$;return this._refinement((et,tt)=>{const rt=a(et),nt=()=>tt.addIssue({code:ZodIssueCode.custom,...j(et)});return typeof Promise<"u"&&rt instanceof Promise?rt.then(it=>it?!0:(nt(),!1)):rt?!0:(nt(),!1)})}refinement(a,$){return this._refinement((j,et)=>a(j)?!0:(et.addIssue(typeof $=="function"?$(j,et):$),!1))}_refinement(a){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:a}})}superRefine(a){return this._refinement(a)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(a){return ZodUnion.create([this,a],this._def)}and(a){return ZodIntersection.create(this,a,this._def)}transform(a){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:a}})}default(a){const $=typeof a=="function"?a:()=>a;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:$,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(a){const $=typeof a=="function"?a:()=>a;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:$,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(a){const $=this.constructor;return new $({...this._def,description:a})}pipe(a){return ZodPipeline.create(this,a)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(_){let a="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return _.precision?a=`${a}\\.\\d{${_.precision}}`:_.precision==null&&(a=`${a}(\\.\\d+)?`),a}function timeRegex(_){return new RegExp(`^${timeRegexSource(_)}$`)}function datetimeRegex(_){let a=`${dateRegexSource}T${timeRegexSource(_)}`;const $=[];return $.push(_.local?"Z?":"Z"),_.offset&&$.push("([+-]\\d{2}:?\\d{2})"),a=`${a}(${$.join("|")})`,new RegExp(`^${a}$`)}function isValidIP(_,a){return!!((a==="v4"||!a)&&ipv4Regex.test(_)||(a==="v6"||!a)&&ipv6Regex.test(_))}class ZodString extends ZodType{_parse(a){if(this._def.coerce&&(a.data=String(a.data)),this._getType(a)!==ZodParsedType.string){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:tt.parsedType}),INVALID}const j=new ParseStatus;let et;for(const tt of this._def.checks)if(tt.kind==="min")a.data.lengthtt.value&&(et=this._getOrReturnCtx(a,et),addIssueToContext(et,{code:ZodIssueCode.too_big,maximum:tt.value,type:"string",inclusive:!0,exact:!1,message:tt.message}),j.dirty());else if(tt.kind==="length"){const rt=a.data.length>tt.value,nt=a.data.lengtha.test(et),{validation:$,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(j)})}_addCheck(a){return new ZodString({...this._def,checks:[...this._def.checks,a]})}email(a){return this._addCheck({kind:"email",...errorUtil.errToObj(a)})}url(a){return this._addCheck({kind:"url",...errorUtil.errToObj(a)})}emoji(a){return this._addCheck({kind:"emoji",...errorUtil.errToObj(a)})}uuid(a){return this._addCheck({kind:"uuid",...errorUtil.errToObj(a)})}nanoid(a){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(a)})}cuid(a){return this._addCheck({kind:"cuid",...errorUtil.errToObj(a)})}cuid2(a){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(a)})}ulid(a){return this._addCheck({kind:"ulid",...errorUtil.errToObj(a)})}base64(a){return this._addCheck({kind:"base64",...errorUtil.errToObj(a)})}ip(a){return this._addCheck({kind:"ip",...errorUtil.errToObj(a)})}datetime(a){var $,j;return typeof a=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:a}):this._addCheck({kind:"datetime",precision:typeof(a==null?void 0:a.precision)>"u"?null:a==null?void 0:a.precision,offset:($=a==null?void 0:a.offset)!==null&&$!==void 0?$:!1,local:(j=a==null?void 0:a.local)!==null&&j!==void 0?j:!1,...errorUtil.errToObj(a==null?void 0:a.message)})}date(a){return this._addCheck({kind:"date",message:a})}time(a){return typeof a=="string"?this._addCheck({kind:"time",precision:null,message:a}):this._addCheck({kind:"time",precision:typeof(a==null?void 0:a.precision)>"u"?null:a==null?void 0:a.precision,...errorUtil.errToObj(a==null?void 0:a.message)})}duration(a){return this._addCheck({kind:"duration",...errorUtil.errToObj(a)})}regex(a,$){return this._addCheck({kind:"regex",regex:a,...errorUtil.errToObj($)})}includes(a,$){return this._addCheck({kind:"includes",value:a,position:$==null?void 0:$.position,...errorUtil.errToObj($==null?void 0:$.message)})}startsWith(a,$){return this._addCheck({kind:"startsWith",value:a,...errorUtil.errToObj($)})}endsWith(a,$){return this._addCheck({kind:"endsWith",value:a,...errorUtil.errToObj($)})}min(a,$){return this._addCheck({kind:"min",value:a,...errorUtil.errToObj($)})}max(a,$){return this._addCheck({kind:"max",value:a,...errorUtil.errToObj($)})}length(a,$){return this._addCheck({kind:"length",value:a,...errorUtil.errToObj($)})}nonempty(a){return this.min(1,errorUtil.errToObj(a))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(a=>a.kind==="datetime")}get isDate(){return!!this._def.checks.find(a=>a.kind==="date")}get isTime(){return!!this._def.checks.find(a=>a.kind==="time")}get isDuration(){return!!this._def.checks.find(a=>a.kind==="duration")}get isEmail(){return!!this._def.checks.find(a=>a.kind==="email")}get isURL(){return!!this._def.checks.find(a=>a.kind==="url")}get isEmoji(){return!!this._def.checks.find(a=>a.kind==="emoji")}get isUUID(){return!!this._def.checks.find(a=>a.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(a=>a.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(a=>a.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(a=>a.kind==="cuid2")}get isULID(){return!!this._def.checks.find(a=>a.kind==="ulid")}get isIP(){return!!this._def.checks.find(a=>a.kind==="ip")}get isBase64(){return!!this._def.checks.find(a=>a.kind==="base64")}get minLength(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a}get maxLength(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.value{var a;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(a=_==null?void 0:_.coerce)!==null&&a!==void 0?a:!1,...processCreateParams(_)})};function floatSafeRemainder(_,a){const $=(_.toString().split(".")[1]||"").length,j=(a.toString().split(".")[1]||"").length,et=$>j?$:j,tt=parseInt(_.toFixed(et).replace(".","")),rt=parseInt(a.toFixed(et).replace(".",""));return tt%rt/Math.pow(10,et)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(a){if(this._def.coerce&&(a.data=Number(a.data)),this._getType(a)!==ZodParsedType.number){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:tt.parsedType}),INVALID}let j;const et=new ParseStatus;for(const tt of this._def.checks)tt.kind==="int"?util.isInteger(a.data)||(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:tt.message}),et.dirty()):tt.kind==="min"?(tt.inclusive?a.datatt.value:a.data>=tt.value)&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.too_big,maximum:tt.value,type:"number",inclusive:tt.inclusive,exact:!1,message:tt.message}),et.dirty()):tt.kind==="multipleOf"?floatSafeRemainder(a.data,tt.value)!==0&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.not_multiple_of,multipleOf:tt.value,message:tt.message}),et.dirty()):tt.kind==="finite"?Number.isFinite(a.data)||(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.not_finite,message:tt.message}),et.dirty()):util.assertNever(tt);return{status:et.value,value:a.data}}gte(a,$){return this.setLimit("min",a,!0,errorUtil.toString($))}gt(a,$){return this.setLimit("min",a,!1,errorUtil.toString($))}lte(a,$){return this.setLimit("max",a,!0,errorUtil.toString($))}lt(a,$){return this.setLimit("max",a,!1,errorUtil.toString($))}setLimit(a,$,j,et){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:a,value:$,inclusive:j,message:errorUtil.toString(et)}]})}_addCheck(a){return new ZodNumber({...this._def,checks:[...this._def.checks,a]})}int(a){return this._addCheck({kind:"int",message:errorUtil.toString(a)})}positive(a){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(a)})}negative(a){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(a)})}multipleOf(a,$){return this._addCheck({kind:"multipleOf",value:a,message:errorUtil.toString($)})}finite(a){return this._addCheck({kind:"finite",message:errorUtil.toString(a)})}safe(a){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(a)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(a)})}get minValue(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a}get maxValue(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.valuea.kind==="int"||a.kind==="multipleOf"&&util.isInteger(a.value))}get isFinite(){let a=null,$=null;for(const j of this._def.checks){if(j.kind==="finite"||j.kind==="int"||j.kind==="multipleOf")return!0;j.kind==="min"?($===null||j.value>$)&&($=j.value):j.kind==="max"&&(a===null||j.valuenew ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(_==null?void 0:_.coerce)||!1,...processCreateParams(_)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(a){if(this._def.coerce&&(a.data=BigInt(a.data)),this._getType(a)!==ZodParsedType.bigint){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:tt.parsedType}),INVALID}let j;const et=new ParseStatus;for(const tt of this._def.checks)tt.kind==="min"?(tt.inclusive?a.datatt.value:a.data>=tt.value)&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.too_big,type:"bigint",maximum:tt.value,inclusive:tt.inclusive,message:tt.message}),et.dirty()):tt.kind==="multipleOf"?a.data%tt.value!==BigInt(0)&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.not_multiple_of,multipleOf:tt.value,message:tt.message}),et.dirty()):util.assertNever(tt);return{status:et.value,value:a.data}}gte(a,$){return this.setLimit("min",a,!0,errorUtil.toString($))}gt(a,$){return this.setLimit("min",a,!1,errorUtil.toString($))}lte(a,$){return this.setLimit("max",a,!0,errorUtil.toString($))}lt(a,$){return this.setLimit("max",a,!1,errorUtil.toString($))}setLimit(a,$,j,et){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:a,value:$,inclusive:j,message:errorUtil.toString(et)}]})}_addCheck(a){return new ZodBigInt({...this._def,checks:[...this._def.checks,a]})}positive(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(a)})}negative(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(a)})}multipleOf(a,$){return this._addCheck({kind:"multipleOf",value:a,message:errorUtil.toString($)})}get minValue(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a}get maxValue(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.value{var a;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(a=_==null?void 0:_.coerce)!==null&&a!==void 0?a:!1,...processCreateParams(_)})};class ZodBoolean extends ZodType{_parse(a){if(this._def.coerce&&(a.data=!!a.data),this._getType(a)!==ZodParsedType.boolean){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:j.parsedType}),INVALID}return OK(a.data)}}ZodBoolean.create=_=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(_==null?void 0:_.coerce)||!1,...processCreateParams(_)});class ZodDate extends ZodType{_parse(a){if(this._def.coerce&&(a.data=new Date(a.data)),this._getType(a)!==ZodParsedType.date){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:tt.parsedType}),INVALID}if(isNaN(a.data.getTime())){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_date}),INVALID}const j=new ParseStatus;let et;for(const tt of this._def.checks)tt.kind==="min"?a.data.getTime()tt.value&&(et=this._getOrReturnCtx(a,et),addIssueToContext(et,{code:ZodIssueCode.too_big,message:tt.message,inclusive:!0,exact:!1,maximum:tt.value,type:"date"}),j.dirty()):util.assertNever(tt);return{status:j.value,value:new Date(a.data.getTime())}}_addCheck(a){return new ZodDate({...this._def,checks:[...this._def.checks,a]})}min(a,$){return this._addCheck({kind:"min",value:a.getTime(),message:errorUtil.toString($)})}max(a,$){return this._addCheck({kind:"max",value:a.getTime(),message:errorUtil.toString($)})}get minDate(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a!=null?new Date(a):null}get maxDate(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.valuenew ZodDate({checks:[],coerce:(_==null?void 0:_.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(_)});class ZodSymbol extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.symbol){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:j.parsedType}),INVALID}return OK(a.data)}}ZodSymbol.create=_=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(_)});class ZodUndefined extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.undefined){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:j.parsedType}),INVALID}return OK(a.data)}}ZodUndefined.create=_=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(_)});class ZodNull extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.null){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:j.parsedType}),INVALID}return OK(a.data)}}ZodNull.create=_=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(_)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(a){return OK(a.data)}}ZodAny.create=_=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(_)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(a){return OK(a.data)}}ZodUnknown.create=_=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(_)});class ZodNever extends ZodType{_parse(a){const $=this._getOrReturnCtx(a);return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:$.parsedType}),INVALID}}ZodNever.create=_=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(_)});class ZodVoid extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.undefined){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:j.parsedType}),INVALID}return OK(a.data)}}ZodVoid.create=_=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(_)});class ZodArray extends ZodType{_parse(a){const{ctx:$,status:j}=this._processInputParams(a),et=this._def;if($.parsedType!==ZodParsedType.array)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:$.parsedType}),INVALID;if(et.exactLength!==null){const rt=$.data.length>et.exactLength.value,nt=$.data.lengthet.maxLength.value&&(addIssueToContext($,{code:ZodIssueCode.too_big,maximum:et.maxLength.value,type:"array",inclusive:!0,exact:!1,message:et.maxLength.message}),j.dirty()),$.common.async)return Promise.all([...$.data].map((rt,nt)=>et.type._parseAsync(new ParseInputLazyPath($,rt,$.path,nt)))).then(rt=>ParseStatus.mergeArray(j,rt));const tt=[...$.data].map((rt,nt)=>et.type._parseSync(new ParseInputLazyPath($,rt,$.path,nt)));return ParseStatus.mergeArray(j,tt)}get element(){return this._def.type}min(a,$){return new ZodArray({...this._def,minLength:{value:a,message:errorUtil.toString($)}})}max(a,$){return new ZodArray({...this._def,maxLength:{value:a,message:errorUtil.toString($)}})}length(a,$){return new ZodArray({...this._def,exactLength:{value:a,message:errorUtil.toString($)}})}nonempty(a){return this.min(1,a)}}ZodArray.create=(_,a)=>new ZodArray({type:_,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(a)});function deepPartialify(_){if(_ instanceof ZodObject){const a={};for(const $ in _.shape){const j=_.shape[$];a[$]=ZodOptional.create(deepPartialify(j))}return new ZodObject({..._._def,shape:()=>a})}else return _ instanceof ZodArray?new ZodArray({..._._def,type:deepPartialify(_.element)}):_ instanceof ZodOptional?ZodOptional.create(deepPartialify(_.unwrap())):_ instanceof ZodNullable?ZodNullable.create(deepPartialify(_.unwrap())):_ instanceof ZodTuple?ZodTuple.create(_.items.map(a=>deepPartialify(a))):_}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const a=this._def.shape(),$=util.objectKeys(a);return this._cached={shape:a,keys:$}}_parse(a){if(this._getType(a)!==ZodParsedType.object){const ot=this._getOrReturnCtx(a);return addIssueToContext(ot,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:ot.parsedType}),INVALID}const{status:j,ctx:et}=this._processInputParams(a),{shape:tt,keys:rt}=this._getCached(),nt=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const ot in et.data)rt.includes(ot)||nt.push(ot);const it=[];for(const ot of rt){const st=tt[ot],ct=et.data[ot];it.push({key:{status:"valid",value:ot},value:st._parse(new ParseInputLazyPath(et,ct,et.path,ot)),alwaysSet:ot in et.data})}if(this._def.catchall instanceof ZodNever){const ot=this._def.unknownKeys;if(ot==="passthrough")for(const st of nt)it.push({key:{status:"valid",value:st},value:{status:"valid",value:et.data[st]}});else if(ot==="strict")nt.length>0&&(addIssueToContext(et,{code:ZodIssueCode.unrecognized_keys,keys:nt}),j.dirty());else if(ot!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const ot=this._def.catchall;for(const st of nt){const ct=et.data[st];it.push({key:{status:"valid",value:st},value:ot._parse(new ParseInputLazyPath(et,ct,et.path,st)),alwaysSet:st in et.data})}}return et.common.async?Promise.resolve().then(async()=>{const ot=[];for(const st of it){const ct=await st.key,ut=await st.value;ot.push({key:ct,value:ut,alwaysSet:st.alwaysSet})}return ot}).then(ot=>ParseStatus.mergeObjectSync(j,ot)):ParseStatus.mergeObjectSync(j,it)}get shape(){return this._def.shape()}strict(a){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...a!==void 0?{errorMap:($,j)=>{var et,tt,rt,nt;const it=(rt=(tt=(et=this._def).errorMap)===null||tt===void 0?void 0:tt.call(et,$,j).message)!==null&&rt!==void 0?rt:j.defaultError;return $.code==="unrecognized_keys"?{message:(nt=errorUtil.errToObj(a).message)!==null&&nt!==void 0?nt:it}:{message:it}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(a){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...a})})}merge(a){return new ZodObject({unknownKeys:a._def.unknownKeys,catchall:a._def.catchall,shape:()=>({...this._def.shape(),...a._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(a,$){return this.augment({[a]:$})}catchall(a){return new ZodObject({...this._def,catchall:a})}pick(a){const $={};return util.objectKeys(a).forEach(j=>{a[j]&&this.shape[j]&&($[j]=this.shape[j])}),new ZodObject({...this._def,shape:()=>$})}omit(a){const $={};return util.objectKeys(this.shape).forEach(j=>{a[j]||($[j]=this.shape[j])}),new ZodObject({...this._def,shape:()=>$})}deepPartial(){return deepPartialify(this)}partial(a){const $={};return util.objectKeys(this.shape).forEach(j=>{const et=this.shape[j];a&&!a[j]?$[j]=et:$[j]=et.optional()}),new ZodObject({...this._def,shape:()=>$})}required(a){const $={};return util.objectKeys(this.shape).forEach(j=>{if(a&&!a[j])$[j]=this.shape[j];else{let tt=this.shape[j];for(;tt instanceof ZodOptional;)tt=tt._def.innerType;$[j]=tt}}),new ZodObject({...this._def,shape:()=>$})}keyof(){return createZodEnum(util.objectKeys(this.shape))}}ZodObject.create=(_,a)=>new ZodObject({shape:()=>_,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(a)});ZodObject.strictCreate=(_,a)=>new ZodObject({shape:()=>_,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(a)});ZodObject.lazycreate=(_,a)=>new ZodObject({shape:_,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(a)});class ZodUnion extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a),j=this._def.options;function et(tt){for(const nt of tt)if(nt.result.status==="valid")return nt.result;for(const nt of tt)if(nt.result.status==="dirty")return $.common.issues.push(...nt.ctx.common.issues),nt.result;const rt=tt.map(nt=>new ZodError(nt.ctx.common.issues));return addIssueToContext($,{code:ZodIssueCode.invalid_union,unionErrors:rt}),INVALID}if($.common.async)return Promise.all(j.map(async tt=>{const rt={...$,common:{...$.common,issues:[]},parent:null};return{result:await tt._parseAsync({data:$.data,path:$.path,parent:rt}),ctx:rt}})).then(et);{let tt;const rt=[];for(const it of j){const ot={...$,common:{...$.common,issues:[]},parent:null},st=it._parseSync({data:$.data,path:$.path,parent:ot});if(st.status==="valid")return st;st.status==="dirty"&&!tt&&(tt={result:st,ctx:ot}),ot.common.issues.length&&rt.push(ot.common.issues)}if(tt)return $.common.issues.push(...tt.ctx.common.issues),tt.result;const nt=rt.map(it=>new ZodError(it));return addIssueToContext($,{code:ZodIssueCode.invalid_union,unionErrors:nt}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(_,a)=>new ZodUnion({options:_,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(a)});const getDiscriminator=_=>_ instanceof ZodLazy?getDiscriminator(_.schema):_ instanceof ZodEffects?getDiscriminator(_.innerType()):_ instanceof ZodLiteral?[_.value]:_ instanceof ZodEnum?_.options:_ instanceof ZodNativeEnum?util.objectValues(_.enum):_ instanceof ZodDefault?getDiscriminator(_._def.innerType):_ instanceof ZodUndefined?[void 0]:_ instanceof ZodNull?[null]:_ instanceof ZodOptional?[void 0,...getDiscriminator(_.unwrap())]:_ instanceof ZodNullable?[null,...getDiscriminator(_.unwrap())]:_ instanceof ZodBranded||_ instanceof ZodReadonly?getDiscriminator(_.unwrap()):_ instanceof ZodCatch?getDiscriminator(_._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a);if($.parsedType!==ZodParsedType.object)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:$.parsedType}),INVALID;const j=this.discriminator,et=$.data[j],tt=this.optionsMap.get(et);return tt?$.common.async?tt._parseAsync({data:$.data,path:$.path,parent:$}):tt._parseSync({data:$.data,path:$.path,parent:$}):(addIssueToContext($,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[j]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(a,$,j){const et=new Map;for(const tt of $){const rt=getDiscriminator(tt.shape[a]);if(!rt.length)throw new Error(`A discriminator value for key \`${a}\` could not be extracted from all schema options`);for(const nt of rt){if(et.has(nt))throw new Error(`Discriminator property ${String(a)} has duplicate value ${String(nt)}`);et.set(nt,tt)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:a,options:$,optionsMap:et,...processCreateParams(j)})}}function mergeValues(_,a){const $=getParsedType(_),j=getParsedType(a);if(_===a)return{valid:!0,data:_};if($===ZodParsedType.object&&j===ZodParsedType.object){const et=util.objectKeys(a),tt=util.objectKeys(_).filter(nt=>et.indexOf(nt)!==-1),rt={..._,...a};for(const nt of tt){const it=mergeValues(_[nt],a[nt]);if(!it.valid)return{valid:!1};rt[nt]=it.data}return{valid:!0,data:rt}}else if($===ZodParsedType.array&&j===ZodParsedType.array){if(_.length!==a.length)return{valid:!1};const et=[];for(let tt=0;tt<_.length;tt++){const rt=_[tt],nt=a[tt],it=mergeValues(rt,nt);if(!it.valid)return{valid:!1};et.push(it.data)}return{valid:!0,data:et}}else return $===ZodParsedType.date&&j===ZodParsedType.date&&+_==+a?{valid:!0,data:_}:{valid:!1}}class ZodIntersection extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a),et=(tt,rt)=>{if(isAborted(tt)||isAborted(rt))return INVALID;const nt=mergeValues(tt.value,rt.value);return nt.valid?((isDirty(tt)||isDirty(rt))&&$.dirty(),{status:$.value,value:nt.data}):(addIssueToContext(j,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return j.common.async?Promise.all([this._def.left._parseAsync({data:j.data,path:j.path,parent:j}),this._def.right._parseAsync({data:j.data,path:j.path,parent:j})]).then(([tt,rt])=>et(tt,rt)):et(this._def.left._parseSync({data:j.data,path:j.path,parent:j}),this._def.right._parseSync({data:j.data,path:j.path,parent:j}))}}ZodIntersection.create=(_,a,$)=>new ZodIntersection({left:_,right:a,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams($)});class ZodTuple extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.array)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:j.parsedType}),INVALID;if(j.data.lengththis._def.items.length&&(addIssueToContext(j,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$.dirty());const tt=[...j.data].map((rt,nt)=>{const it=this._def.items[nt]||this._def.rest;return it?it._parse(new ParseInputLazyPath(j,rt,j.path,nt)):null}).filter(rt=>!!rt);return j.common.async?Promise.all(tt).then(rt=>ParseStatus.mergeArray($,rt)):ParseStatus.mergeArray($,tt)}get items(){return this._def.items}rest(a){return new ZodTuple({...this._def,rest:a})}}ZodTuple.create=(_,a)=>{if(!Array.isArray(_))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:_,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(a)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.object)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:j.parsedType}),INVALID;const et=[],tt=this._def.keyType,rt=this._def.valueType;for(const nt in j.data)et.push({key:tt._parse(new ParseInputLazyPath(j,nt,j.path,nt)),value:rt._parse(new ParseInputLazyPath(j,j.data[nt],j.path,nt)),alwaysSet:nt in j.data});return j.common.async?ParseStatus.mergeObjectAsync($,et):ParseStatus.mergeObjectSync($,et)}get element(){return this._def.valueType}static create(a,$,j){return $ instanceof ZodType?new ZodRecord({keyType:a,valueType:$,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(j)}):new ZodRecord({keyType:ZodString.create(),valueType:a,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams($)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.map)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:j.parsedType}),INVALID;const et=this._def.keyType,tt=this._def.valueType,rt=[...j.data.entries()].map(([nt,it],ot)=>({key:et._parse(new ParseInputLazyPath(j,nt,j.path,[ot,"key"])),value:tt._parse(new ParseInputLazyPath(j,it,j.path,[ot,"value"]))}));if(j.common.async){const nt=new Map;return Promise.resolve().then(async()=>{for(const it of rt){const ot=await it.key,st=await it.value;if(ot.status==="aborted"||st.status==="aborted")return INVALID;(ot.status==="dirty"||st.status==="dirty")&&$.dirty(),nt.set(ot.value,st.value)}return{status:$.value,value:nt}})}else{const nt=new Map;for(const it of rt){const ot=it.key,st=it.value;if(ot.status==="aborted"||st.status==="aborted")return INVALID;(ot.status==="dirty"||st.status==="dirty")&&$.dirty(),nt.set(ot.value,st.value)}return{status:$.value,value:nt}}}}ZodMap.create=(_,a,$)=>new ZodMap({valueType:a,keyType:_,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams($)});class ZodSet extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.set)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:j.parsedType}),INVALID;const et=this._def;et.minSize!==null&&j.data.sizeet.maxSize.value&&(addIssueToContext(j,{code:ZodIssueCode.too_big,maximum:et.maxSize.value,type:"set",inclusive:!0,exact:!1,message:et.maxSize.message}),$.dirty());const tt=this._def.valueType;function rt(it){const ot=new Set;for(const st of it){if(st.status==="aborted")return INVALID;st.status==="dirty"&&$.dirty(),ot.add(st.value)}return{status:$.value,value:ot}}const nt=[...j.data.values()].map((it,ot)=>tt._parse(new ParseInputLazyPath(j,it,j.path,ot)));return j.common.async?Promise.all(nt).then(it=>rt(it)):rt(nt)}min(a,$){return new ZodSet({...this._def,minSize:{value:a,message:errorUtil.toString($)}})}max(a,$){return new ZodSet({...this._def,maxSize:{value:a,message:errorUtil.toString($)}})}size(a,$){return this.min(a,$).max(a,$)}nonempty(a){return this.min(1,a)}}ZodSet.create=(_,a)=>new ZodSet({valueType:_,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(a)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(a){const{ctx:$}=this._processInputParams(a);if($.parsedType!==ZodParsedType.function)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:$.parsedType}),INVALID;function j(nt,it){return makeIssue({data:nt,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,getErrorMap(),errorMap].filter(ot=>!!ot),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:it}})}function et(nt,it){return makeIssue({data:nt,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,getErrorMap(),errorMap].filter(ot=>!!ot),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:it}})}const tt={errorMap:$.common.contextualErrorMap},rt=$.data;if(this._def.returns instanceof ZodPromise){const nt=this;return OK(async function(...it){const ot=new ZodError([]),st=await nt._def.args.parseAsync(it,tt).catch(ht=>{throw ot.addIssue(j(it,ht)),ot}),ct=await Reflect.apply(rt,this,st);return await nt._def.returns._def.type.parseAsync(ct,tt).catch(ht=>{throw ot.addIssue(et(ct,ht)),ot})})}else{const nt=this;return OK(function(...it){const ot=nt._def.args.safeParse(it,tt);if(!ot.success)throw new ZodError([j(it,ot.error)]);const st=Reflect.apply(rt,this,ot.data),ct=nt._def.returns.safeParse(st,tt);if(!ct.success)throw new ZodError([et(st,ct.error)]);return ct.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...a){return new ZodFunction({...this._def,args:ZodTuple.create(a).rest(ZodUnknown.create())})}returns(a){return new ZodFunction({...this._def,returns:a})}implement(a){return this.parse(a)}strictImplement(a){return this.parse(a)}static create(a,$,j){return new ZodFunction({args:a||ZodTuple.create([]).rest(ZodUnknown.create()),returns:$||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(j)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(a){const{ctx:$}=this._processInputParams(a);return this._def.getter()._parse({data:$.data,path:$.path,parent:$})}}ZodLazy.create=(_,a)=>new ZodLazy({getter:_,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(a)});class ZodLiteral extends ZodType{_parse(a){if(a.data!==this._def.value){const $=this._getOrReturnCtx(a);return addIssueToContext($,{received:$.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:a.data}}get value(){return this._def.value}}ZodLiteral.create=(_,a)=>new ZodLiteral({value:_,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(a)});function createZodEnum(_,a){return new ZodEnum({values:_,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(a)})}class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(a){if(typeof a.data!="string"){const $=this._getOrReturnCtx(a),j=this._def.values;return addIssueToContext($,{expected:util.joinValues(j),received:$.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet$1(this,_ZodEnum_cache)||__classPrivateFieldSet$1(this,_ZodEnum_cache,new Set(this._def.values)),!__classPrivateFieldGet$1(this,_ZodEnum_cache).has(a.data)){const $=this._getOrReturnCtx(a),j=this._def.values;return addIssueToContext($,{received:$.data,code:ZodIssueCode.invalid_enum_value,options:j}),INVALID}return OK(a.data)}get options(){return this._def.values}get enum(){const a={};for(const $ of this._def.values)a[$]=$;return a}get Values(){const a={};for(const $ of this._def.values)a[$]=$;return a}get Enum(){const a={};for(const $ of this._def.values)a[$]=$;return a}extract(a,$=this._def){return ZodEnum.create(a,{...this._def,...$})}exclude(a,$=this._def){return ZodEnum.create(this.options.filter(j=>!a.includes(j)),{...this._def,...$})}}_ZodEnum_cache=new WeakMap;ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(a){const $=util.getValidEnumValues(this._def.values),j=this._getOrReturnCtx(a);if(j.parsedType!==ZodParsedType.string&&j.parsedType!==ZodParsedType.number){const et=util.objectValues($);return addIssueToContext(j,{expected:util.joinValues(et),received:j.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet$1(this,_ZodNativeEnum_cache)||__classPrivateFieldSet$1(this,_ZodNativeEnum_cache,new Set(util.getValidEnumValues(this._def.values))),!__classPrivateFieldGet$1(this,_ZodNativeEnum_cache).has(a.data)){const et=util.objectValues($);return addIssueToContext(j,{received:j.data,code:ZodIssueCode.invalid_enum_value,options:et}),INVALID}return OK(a.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap;ZodNativeEnum.create=(_,a)=>new ZodNativeEnum({values:_,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(a)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(a){const{ctx:$}=this._processInputParams(a);if($.parsedType!==ZodParsedType.promise&&$.common.async===!1)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:$.parsedType}),INVALID;const j=$.parsedType===ZodParsedType.promise?$.data:Promise.resolve($.data);return OK(j.then(et=>this._def.type.parseAsync(et,{path:$.path,errorMap:$.common.contextualErrorMap})))}}ZodPromise.create=(_,a)=>new ZodPromise({type:_,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(a)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(a){const{status:$,ctx:j}=this._processInputParams(a),et=this._def.effect||null,tt={addIssue:rt=>{addIssueToContext(j,rt),rt.fatal?$.abort():$.dirty()},get path(){return j.path}};if(tt.addIssue=tt.addIssue.bind(tt),et.type==="preprocess"){const rt=et.transform(j.data,tt);if(j.common.async)return Promise.resolve(rt).then(async nt=>{if($.value==="aborted")return INVALID;const it=await this._def.schema._parseAsync({data:nt,path:j.path,parent:j});return it.status==="aborted"?INVALID:it.status==="dirty"||$.value==="dirty"?DIRTY(it.value):it});{if($.value==="aborted")return INVALID;const nt=this._def.schema._parseSync({data:rt,path:j.path,parent:j});return nt.status==="aborted"?INVALID:nt.status==="dirty"||$.value==="dirty"?DIRTY(nt.value):nt}}if(et.type==="refinement"){const rt=nt=>{const it=et.refinement(nt,tt);if(j.common.async)return Promise.resolve(it);if(it instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return nt};if(j.common.async===!1){const nt=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});return nt.status==="aborted"?INVALID:(nt.status==="dirty"&&$.dirty(),rt(nt.value),{status:$.value,value:nt.value})}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then(nt=>nt.status==="aborted"?INVALID:(nt.status==="dirty"&&$.dirty(),rt(nt.value).then(()=>({status:$.value,value:nt.value}))))}if(et.type==="transform")if(j.common.async===!1){const rt=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(!isValid$1(rt))return rt;const nt=et.transform(rt.value,tt);if(nt instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:$.value,value:nt}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then(rt=>isValid$1(rt)?Promise.resolve(et.transform(rt.value,tt)).then(nt=>({status:$.value,value:nt})):rt);util.assertNever(et)}}ZodEffects.create=(_,a,$)=>new ZodEffects({schema:_,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:a,...processCreateParams($)});ZodEffects.createWithPreprocess=(_,a,$)=>new ZodEffects({schema:a,effect:{type:"preprocess",transform:_},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams($)});class ZodOptional extends ZodType{_parse(a){return this._getType(a)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}ZodOptional.create=(_,a)=>new ZodOptional({innerType:_,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(a)});class ZodNullable extends ZodType{_parse(a){return this._getType(a)===ZodParsedType.null?OK(null):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}ZodNullable.create=(_,a)=>new ZodNullable({innerType:_,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(a)});class ZodDefault extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a);let j=$.data;return $.parsedType===ZodParsedType.undefined&&(j=this._def.defaultValue()),this._def.innerType._parse({data:j,path:$.path,parent:$})}removeDefault(){return this._def.innerType}}ZodDefault.create=(_,a)=>new ZodDefault({innerType:_,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof a.default=="function"?a.default:()=>a.default,...processCreateParams(a)});class ZodCatch extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a),j={...$,common:{...$.common,issues:[]}},et=this._def.innerType._parse({data:j.data,path:j.path,parent:{...j}});return isAsync(et)?et.then(tt=>({status:"valid",value:tt.status==="valid"?tt.value:this._def.catchValue({get error(){return new ZodError(j.common.issues)},input:j.data})})):{status:"valid",value:et.status==="valid"?et.value:this._def.catchValue({get error(){return new ZodError(j.common.issues)},input:j.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(_,a)=>new ZodCatch({innerType:_,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof a.catch=="function"?a.catch:()=>a.catch,...processCreateParams(a)});class ZodNaN extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.nan){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:j.parsedType}),INVALID}return{status:"valid",value:a.data}}}ZodNaN.create=_=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(_)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a),j=$.data;return this._def.type._parse({data:j,path:$.path,parent:$})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.common.async)return(async()=>{const tt=await this._def.in._parseAsync({data:j.data,path:j.path,parent:j});return tt.status==="aborted"?INVALID:tt.status==="dirty"?($.dirty(),DIRTY(tt.value)):this._def.out._parseAsync({data:tt.value,path:j.path,parent:j})})();{const et=this._def.in._parseSync({data:j.data,path:j.path,parent:j});return et.status==="aborted"?INVALID:et.status==="dirty"?($.dirty(),{status:"dirty",value:et.value}):this._def.out._parseSync({data:et.value,path:j.path,parent:j})}}static create(a,$){return new ZodPipeline({in:a,out:$,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(a){const $=this._def.innerType._parse(a),j=et=>(isValid$1(et)&&(et.value=Object.freeze(et.value)),et);return isAsync($)?$.then(et=>j(et)):j($)}unwrap(){return this._def.innerType}}ZodReadonly.create=(_,a)=>new ZodReadonly({innerType:_,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(a)});function custom(_,a={},$){return _?ZodAny.create().superRefine((j,et)=>{var tt,rt;if(!_(j)){const nt=typeof a=="function"?a(j):typeof a=="string"?{message:a}:a,it=(rt=(tt=nt.fatal)!==null&&tt!==void 0?tt:$)!==null&&rt!==void 0?rt:!0,ot=typeof nt=="string"?{message:nt}:nt;et.addIssue({code:"custom",...ot,fatal:it})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(_){_.ZodString="ZodString",_.ZodNumber="ZodNumber",_.ZodNaN="ZodNaN",_.ZodBigInt="ZodBigInt",_.ZodBoolean="ZodBoolean",_.ZodDate="ZodDate",_.ZodSymbol="ZodSymbol",_.ZodUndefined="ZodUndefined",_.ZodNull="ZodNull",_.ZodAny="ZodAny",_.ZodUnknown="ZodUnknown",_.ZodNever="ZodNever",_.ZodVoid="ZodVoid",_.ZodArray="ZodArray",_.ZodObject="ZodObject",_.ZodUnion="ZodUnion",_.ZodDiscriminatedUnion="ZodDiscriminatedUnion",_.ZodIntersection="ZodIntersection",_.ZodTuple="ZodTuple",_.ZodRecord="ZodRecord",_.ZodMap="ZodMap",_.ZodSet="ZodSet",_.ZodFunction="ZodFunction",_.ZodLazy="ZodLazy",_.ZodLiteral="ZodLiteral",_.ZodEnum="ZodEnum",_.ZodEffects="ZodEffects",_.ZodNativeEnum="ZodNativeEnum",_.ZodOptional="ZodOptional",_.ZodNullable="ZodNullable",_.ZodDefault="ZodDefault",_.ZodCatch="ZodCatch",_.ZodPromise="ZodPromise",_.ZodBranded="ZodBranded",_.ZodPipeline="ZodPipeline",_.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(_,a={message:`Input not instance of ${_.name}`})=>custom($=>$ instanceof _,a),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType$1=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce$2={string:_=>ZodString.create({..._,coerce:!0}),number:_=>ZodNumber.create({..._,coerce:!0}),boolean:_=>ZodBoolean.create({..._,coerce:!0}),bigint:_=>ZodBigInt.create({..._,coerce:!0}),date:_=>ZodDate.create({..._,coerce:!0})},NEVER$1=INVALID;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID,DIRTY,OK,isAborted,isDirty,isValid:isValid$1,isAsync,get util(){return util},get objectUtil(){return objectUtil},ZodParsedType,getParsedType,ZodType,datetimeRegex,ZodString,ZodNumber,ZodBigInt,ZodBoolean,ZodDate,ZodSymbol,ZodUndefined,ZodNull,ZodAny,ZodUnknown,ZodNever,ZodVoid,ZodArray,ZodObject,ZodUnion,ZodDiscriminatedUnion,ZodIntersection,ZodTuple,ZodRecord,ZodMap,ZodSet,ZodFunction,ZodLazy,ZodLiteral,ZodEnum,ZodNativeEnum,ZodPromise,ZodEffects,ZodTransformer:ZodEffects,ZodOptional,ZodNullable,ZodDefault,ZodCatch,ZodNaN,BRAND,ZodBranded,ZodPipeline,ZodReadonly,custom,Schema:ZodType,ZodSchema:ZodType,late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce$2,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType$1,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean,onumber,optional:optionalType,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER:NEVER$1,ZodIssueCode,quotelessJson,ZodError});const Schema$1=z.object({address:z.string()}),parsePkh=_=>{if(isValidContractPkh(_))return parseContractPkh(_);if(isValidImplicitPkh(_))return parseImplicitPkh(_);throw new Error(`Cannot parse address type: ${_}`)},isAddressValid=_=>validateAddress(_)===ValidationResult.VALID,isValidContractPkh=_=>isAddressValid(_)&&_.match(/^KT1\w+/),isValidImplicitPkh=_=>isAddressValid(_)&&_.match(/^tz[1234]\w+/),parseContractPkh=_=>{if(isValidContractPkh(_))return{type:"contract",pkh:_};throw new Error(`Invalid contract address: ${_}`)},parseImplicitPkh=_=>{if(isValidImplicitPkh(_))return{type:"implicit",pkh:_};throw new Error(`Invalid implicit address: ${_}`)},encodeReserved=[encodeURIComponent,encodeURIComponent];function encode$3(_,a=","){const $=(j,et)=>{const tt=_[et%_.length];return typeof j>"u"?"":typeof j=="object"?Array.isArray(j)?j.map(tt).join(a):Object.entries(j).reduce((nt,it)=>[...nt,...it],[]).map(tt).join(a):tt(String(j))};return(j,...et)=>j.reduce((tt,rt,nt)=>`${tt}${rt}${$(et[nt],nt)}`,"")}function delimited(_=","){return(a,$=encodeReserved)=>Object.entries(a).filter(([,j])=>j!==void 0).map(([j,et])=>encode$3($,_)`${j}=${et}`).join("&")}function stripUndefined(_){return _&&JSON.parse(JSON.stringify(_))}function joinUrl(..._){return _.filter(Boolean).map((a,$)=>$===0?a:a.replace(/^\/+/,"")).map((a,$,j)=>$===j.length-1?a:a.replace(/\/+$/,"")).join("/")}function query(..._){const a=_.filter(Boolean).join("&");return a&&`?${a}`}function explode(_,a=encodeReserved){const $=encode$3(a);return Object.entries(_).filter(([,j])=>j!==void 0).map(([j,et])=>Array.isArray(et)?et.map(tt=>$`${j}=${tt}`).join("&"):typeof et=="object"?explode(et,a):$`${j}=${et}`).join("&")}const form=delimited(),SUCCESS_CODES=[200,201,202,204];async function ok(_){const a=await _;if(SUCCESS_CODES.some($=>$==a.status))return a.data;throw new HttpError(a.status,a.data)}class HttpError extends Error{constructor($,j){super(`Error: ${$}`);Vr(this,"status");Vr(this,"data");this.status=$,this.data=j}}function runtime$1(_){async function a(tt,rt){const nt=await et(tt,rt);let it;try{it=await nt.text()}catch{}return{status:nt.status,headers:nt.headers,contentType:nt.headers.get("content-type"),data:it}}async function $(tt,rt={}){const{status:nt,headers:it,contentType:ot,data:st}=await a(tt,{...rt,headers:{Accept:"application/json",...rt.headers}});return(ot?ot.includes("json"):!1)?{status:nt,headers:it,data:st?JSON.parse(st):null}:{status:nt,headers:it,data:st}}async function j(tt,rt={}){const nt=await et(tt,rt);let it;try{it=await nt.blob()}catch{}return{status:nt.status,headers:nt.headers,data:it}}async function et(tt,rt={}){const{baseUrl:nt,headers:it,fetch:ot,...st}={..._,...rt},ct=joinUrl(nt,tt);return await(ot||fetch)(ct,{...st,headers:stripUndefined({..._.headers,...it})})}return{ok,fetchText:a,fetchJson:$,fetchBlob:j,json({body:tt,headers:rt,...nt}){return{...nt,...tt!=null&&{body:JSON.stringify(tt)},headers:{...rt,"Content-Type":"application/json"}}},form({body:tt,headers:rt,...nt}){return{...nt,...tt!=null&&{body:form(tt)},headers:{...rt,"Content-Type":"application/x-www-form-urlencoded"}}},multipart({body:tt,...rt}){if(tt==null)return rt;const nt=new(_.formDataConstructor||rt.formDataConstructor||FormData);return Object.entries(tt).forEach(([it,ot])=>{nt.append(it,ot)}),{...rt,body:nt}}}}const jsonParameter=(_,a)=>{if(!a)return{};const $={};return Object.entries(a).forEach(([j,et])=>{if(!(et instanceof Object))throw new Error(`Expected ${_} value to be object, received ${typeof et}`);const{jsonPath:tt,jsonValue:rt}=et;if(rt==null)throw new Error(`Expected jsonValue in ${_} -> ${j}, found: ${rt}`);const it=[_,tt,j].filter(ot=>ot!==void 0).join(".");$[it]=rt}),$},anyofParameter=(_,a)=>{if(!a)return{};const{fields:$}=a;(rt=>{if(!Array.isArray(rt))throw new Error(`Expected ${_} fields to be Array. Received ${typeof rt}.`);return rt.forEach(nt=>{if(typeof nt!="string")throw new Error(`Expected ${_} fields to be strings. Received ${typeof nt}`)}),!0})($);const et={},tt=$.join(".");if(a.value){const rt=`${_}.${tt}`;et[rt]=a.value}for(const rt of["in","eq","null"])if(a[rt]){const nt=`${_}.${tt}.${rt}`;return et[nt]=Array.isArray(a[rt])?a[rt].join(","):a[rt],et}return et},queryParameter=(_,a)=>{if(!a)return{};const $={};return Object.entries(a).forEach(([j,et])=>{const tt=`${_}.${j}`;$[tt]=et}),$},parsers={jsonParameter,queryParameter,anyofParameter},defaults={baseUrl:"https://api.tzkt.io"},oazapfts=runtime$1(defaults);function accountsGet({id:_,address:a,$type:$,kind:j,delegate:et,balance:tt,staked:rt,lastActivity:nt,select:it,sort:ot,offset:st,limit:ct}={},ut){return oazapfts.ok(oazapfts.fetchJson(`/v1/accounts${query(explode({limit:ct,...parsers.queryParameter("id",_),...parsers.queryParameter("address",a),...parsers.queryParameter("type",$),...parsers.queryParameter("kind",j),...parsers.queryParameter("delegate",et),...parsers.queryParameter("balance",tt),...parsers.queryParameter("staked",rt),...parsers.queryParameter("lastActivity",nt),...parsers.queryParameter("select",it),...parsers.queryParameter("sort",ot),...parsers.queryParameter("offset",st)}))}`,{...ut}))}function blocksGetCount(_){return oazapfts.ok(oazapfts.fetchJson("/v1/blocks/count",{..._}))}function contractsGet({address:_,kind:a,tzips:$,creator:j,manager:et,delegate:tt,balance:rt,lastActivity:nt,typeHash:it,codeHash:ot,select:st,sort:ct,offset:ut,limit:ht,includeStorage:Et}={},St){return oazapfts.ok(oazapfts.fetchJson(`/v1/contracts${query(explode({limit:ht,includeStorage:Et,...parsers.queryParameter("address",_),...parsers.queryParameter("kind",a),...parsers.queryParameter("tzips",$),...parsers.queryParameter("creator",j),...parsers.queryParameter("manager",et),...parsers.queryParameter("delegate",tt),...parsers.queryParameter("balance",rt),...parsers.queryParameter("lastActivity",nt),...parsers.queryParameter("typeHash",it),...parsers.queryParameter("codeHash",ot),...parsers.queryParameter("select",st),...parsers.queryParameter("sort",ct),...parsers.queryParameter("offset",ut)}))}`,{...St}))}function delegatesGet({active:_,lastActivity:a,select:$,sort:j,offset:et,limit:tt}={},rt){return oazapfts.ok(oazapfts.fetchJson(`/v1/delegates${query(explode({limit:tt,...parsers.queryParameter("active",_),...parsers.queryParameter("lastActivity",a),...parsers.queryParameter("select",$),...parsers.queryParameter("sort",j),...parsers.queryParameter("offset",et)}))}`,{...rt}))}function operationsGetDelegations({anyof:_,initiator:a,sender:$,prevDelegate:j,newDelegate:et,level:tt,timestamp:rt,senderCodeHash:nt,status:it,select:ot,sort:st,offset:ct,limit:ut,quote:ht}={},Et){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/delegations${query(explode({limit:ut,quote:ht,...parsers.anyofParameter("anyof",_),...parsers.queryParameter("initiator",a),...parsers.queryParameter("sender",$),...parsers.queryParameter("prevDelegate",j),...parsers.queryParameter("newDelegate",et),...parsers.queryParameter("level",tt),...parsers.queryParameter("timestamp",rt),...parsers.queryParameter("senderCodeHash",nt),...parsers.queryParameter("status",it),...parsers.queryParameter("select",ot),...parsers.queryParameter("sort",st),...parsers.queryParameter("offset",ct)}))}`,{...Et}))}function operationsGetOriginations({anyof:_,initiator:a,sender:$,contractManager:j,contractDelegate:et,originatedContract:tt,id:rt,typeHash:nt,codeHash:it,level:ot,timestamp:st,senderCodeHash:ct,anyCodeHash:ut,status:ht,select:Et,sort:St,offset:Mt,limit:kt,micheline:Ct,quote:Ot}={},zt){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/originations${query(explode({limit:kt,micheline:Ct,quote:Ot,...parsers.anyofParameter("anyof",_),...parsers.queryParameter("initiator",a),...parsers.queryParameter("sender",$),...parsers.queryParameter("contractManager",j),...parsers.queryParameter("contractDelegate",et),...parsers.queryParameter("originatedContract",tt),...parsers.queryParameter("id",rt),...parsers.queryParameter("typeHash",nt),...parsers.queryParameter("codeHash",it),...parsers.queryParameter("level",ot),...parsers.queryParameter("timestamp",st),...parsers.queryParameter("senderCodeHash",ct),...parsers.queryParameter("anyCodeHash",ut),...parsers.queryParameter("status",ht),...parsers.queryParameter("select",Et),...parsers.queryParameter("sort",St),...parsers.queryParameter("offset",Mt)}))}`,{...zt}))}function operationsGetTransactions({anyof:_,initiator:a,sender:$,target:j,amount:et,id:tt,level:rt,timestamp:nt,senderCodeHash:it,targetCodeHash:ot,codeHash:st,entrypoint:ct,parameter:ut,hasInternals:ht,status:Et,select:St,sort:Mt,offset:kt,limit:Ct,micheline:Ot,quote:zt}={},Ut){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/transactions${query(explode({limit:Ct,micheline:Ot,quote:zt,...parsers.anyofParameter("anyof",_),...parsers.queryParameter("initiator",a),...parsers.queryParameter("sender",$),...parsers.queryParameter("target",j),...parsers.queryParameter("amount",et),...parsers.queryParameter("id",tt),...parsers.queryParameter("level",rt),...parsers.queryParameter("timestamp",nt),...parsers.queryParameter("senderCodeHash",it),...parsers.queryParameter("targetCodeHash",ot),...parsers.queryParameter("codeHash",st),...parsers.queryParameter("entrypoint",ct),...parsers.jsonParameter("parameter",ut),...parsers.queryParameter("hasInternals",ht),...parsers.queryParameter("status",Et),...parsers.queryParameter("select",St),...parsers.queryParameter("sort",Mt),...parsers.queryParameter("offset",kt)}))}`,{...Ut}))}function quotesGetLast(_){return oazapfts.ok(oazapfts.fetchJson("/v1/quotes/last",{..._}))}function tokensGetTokenBalances({id:_,account:a,tokenId:$,tokenContract:j,tokenTokenId:et,tokenStandard:tt,tokenMetadata:rt,tokenHasFilters:nt,balance:it,firstLevel:ot,firstTime:st,lastLevel:ct,lastTime:ut,indexedAt:ht,sort:Et,offset:St,limit:Mt,select:kt}={},Ct){return oazapfts.ok(oazapfts.fetchJson(`/v1/tokens/balances${query(explode({"token.HasFilters":nt,limit:Mt,...parsers.queryParameter("id",_),...parsers.queryParameter("account",a),...parsers.queryParameter("token.id",$),...parsers.queryParameter("token.contract",j),...parsers.queryParameter("token.tokenId",et),...parsers.queryParameter("token.standard",tt),...parsers.jsonParameter("token.metadata",rt),...parsers.queryParameter("balance",it),...parsers.queryParameter("firstLevel",ot),...parsers.queryParameter("firstTime",st),...parsers.queryParameter("lastLevel",ct),...parsers.queryParameter("lastTime",ut),...parsers.queryParameter("indexedAt",ht),...parsers.queryParameter("sort",Et),...parsers.queryParameter("offset",St),...parsers.queryParameter("select",kt)}))}`,{...Ct}))}function tokensGetTokenTransfers({id:_,level:a,timestamp:$,tokenId:j,tokenContract:et,tokenTokenId:tt,tokenStandard:rt,tokenMetadata:nt,tokenHasFilters:it,anyof:ot,$from:st,to:ct,amount:ut,transactionId:ht,originationId:Et,migrationId:St,indexedAt:Mt,sort:kt,offset:Ct,limit:Ot,select:zt}={},Ut){return oazapfts.ok(oazapfts.fetchJson(`/v1/tokens/transfers${query(explode({"token.HasFilters":it,limit:Ot,...parsers.queryParameter("id",_),...parsers.queryParameter("level",a),...parsers.queryParameter("timestamp",$),...parsers.queryParameter("token.id",j),...parsers.queryParameter("token.contract",et),...parsers.queryParameter("token.tokenId",tt),...parsers.queryParameter("token.standard",rt),...parsers.jsonParameter("token.metadata",nt),...parsers.anyofParameter("anyof",ot),...parsers.queryParameter("from",st),...parsers.queryParameter("to",ct),...parsers.queryParameter("amount",ut),...parsers.queryParameter("transactionId",ht),...parsers.queryParameter("originationId",Et),...parsers.queryParameter("migrationId",St),...parsers.queryParameter("indexedAt",Mt),...parsers.queryParameter("sort",kt),...parsers.queryParameter("offset",Ct),...parsers.queryParameter("select",zt)}))}`,{...Ut}))}let e$1=class{constructor(a){this.queue=void 0,this.maxConcurrent=void 0,this.count=void 0,this.queue=[],this.maxConcurrent=a,this.count=0}get canAcquire(){return this.countthis.queue.push(a))}release(){const a=this.queue.shift();a?setTimeout(a,0):this.count--}};const t$4="_default";class s{constructor(a=1){this.semaphoreInstances=void 0,this.maxConcurrent=void 0,this.semaphoreInstances={},this.maxConcurrent=a}hasSemaphoreInstance(a=t$4){return!!this.semaphoreInstances[a]}getSemaphoreInstance(a=t$4){return this.hasSemaphoreInstance(a)||(this.semaphoreInstances[a]=new e$1(this.maxConcurrent)),this.semaphoreInstances[a]}tidy(a=t$4){this.hasSemaphoreInstance(a)&&this.getSemaphoreInstance(a).count===0&&delete this.semaphoreInstances[a]}canAcquire(a=t$4){return this.getSemaphoreInstance(a).canAcquire}acquire(a=t$4){return this.getSemaphoreInstance(a).acquire()}release(a=t$4){this.getSemaphoreInstance(a).release(),this.tidy(a)}count(a=t$4){return this.hasSemaphoreInstance(a)?this.getSemaphoreInstance(a).count:0}hasTasks(a=t$4){return this.count(a)>0}async request(a,$=t$4){try{return await this.acquire($),await a()}finally{this.release($)}}async requestIfAvailable(a,$=t$4){return this.canAcquire($)?this.request(a,$):null}}function assign(_,a){for(const $ in a)Object.defineProperty(_,$,{value:a[$],enumerable:!0,configurable:!0});return _}function createError(_,a,$){if(!_||typeof _=="string")throw new TypeError("Please pass an Error to err-code");$||($={}),typeof a=="object"&&($=a,a=void 0),a!=null&&($.code=a);try{return assign(_,$)}catch{$.message=_.message,$.stack=_.stack;const et=function(){};return et.prototype=Object.create(Object.getPrototypeOf(_)),assign(new et,$)}}var errCode=createError,retry$3={};function RetryOperation(_,a){typeof a=="boolean"&&(a={forever:a}),this._originalTimeouts=JSON.parse(JSON.stringify(_)),this._timeouts=_,this._options=a||{},this._maxRetryTime=a&&a.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var retry_operation=RetryOperation;RetryOperation.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(_){if(this._timeout&&clearTimeout(this._timeout),!_)return!1;var a=new Date().getTime();if(_&&a-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(_);var $=this._timeouts.shift();if($===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),$=this._timeouts.shift();else return!1;var j=this,et=setTimeout(function(){j._attempts++,j._operationTimeoutCb&&(j._timeout=setTimeout(function(){j._operationTimeoutCb(j._attempts)},j._operationTimeout),j._options.unref&&j._timeout.unref()),j._fn(j._attempts)},$);return this._options.unref&&et.unref(),!0};RetryOperation.prototype.attempt=function(_,a){this._fn=_,a&&(a.timeout&&(this._operationTimeout=a.timeout),a.cb&&(this._operationTimeoutCb=a.cb));var $=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){$._operationTimeoutCb()},$._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};RetryOperation.prototype.try=function(_){console.log("Using RetryOperation.try() is deprecated"),this.attempt(_)};RetryOperation.prototype.start=function(_){console.log("Using RetryOperation.start() is deprecated"),this.attempt(_)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this._errors};RetryOperation.prototype.attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var _={},a=null,$=0,j=0;j=$&&(a=et,$=rt)}return a};(function(_){var a=retry_operation;_.operation=function($){var j=_.timeouts($);return new a(j,{forever:$&&$.forever,unref:$&&$.unref,maxRetryTime:$&&$.maxRetryTime})},_.timeouts=function($){if($ instanceof Array)return[].concat($);var j={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var et in $)j[et]=$[et];if(j.minTimeout>j.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var tt=[],rt=0;rttzktRateLimiter.acquire().then(()=>promiseRetry$1(a=>_().catch(a),{retries:3,minTimeout:100})).catch(a=>{throw"status"in a&&"data"in a?new Error(`Fetching data from tzkt failed with: ${a.status}, ${a.data}`):a}).finally(()=>tzktRateLimiter.release()),MULTISIG_FETCH_LIMIT=1e4,TYPE_HASH=1963879877,CODE_HASH=-1890025422,getAllMultiSigContracts=async _=>withRateLimit(async()=>{try{const a=`${_.tzktApiUrl}/v1/contracts?typeHash=${TYPE_HASH}&codeHash=${CODE_HASH}&includeStorage=true&limit=${MULTISIG_FETCH_LIMIT}`,{data:$}=await axios.get(a);return $}catch(a){throw new Error(`Error fetching same contracts from tzkt: ${a.message}`)}}),getExistingContracts=(_,a)=>withRateLimit(()=>contractsGet({address:{in:[_.join(",")]},select:{fields:["address"]},limit:Math.min(1e4,_.length)},{baseUrl:a.tzktApiUrl})),getPendingOperations=async(_,a)=>withRateLimit(async()=>{if(_.length===0)return Promise.resolve([]);const $=`${a.tzktApiUrl}/v1/bigmaps/keys?active=true&bigmap.in=${_.join(",")}&limit=${MULTISIG_FETCH_LIMIT}`,{data:j}=await axios.get($);return j}),parseMultisig=_=>({address:parseContractPkh(_.address),threshold:Number(_.storage.threshold),signers:_.storage.signers.map(parseImplicitPkh),pendingOperationsBigmapId:_.storage.pending_ops}),getRelevantMultisigContracts=async(_,a)=>(await getAllMultiSigContracts(a)).filter(({storage:{signers:j}})=>lodashExports.every(j,isValidImplicitPkh)?j.filter(tt=>_.has(tt)).length>0:!1).map(parseMultisig),getNetworksForContracts=async(_,a)=>{const $=new Map;return a.length===0||(await Promise.all(_.map(async et=>(await getExistingContracts(a,et)).map(tt=>[tt,et.name])))).flat().forEach(([et,tt])=>$.set(et,tt)),$},parseMultisigOperation=_=>{const{bigmap:a,key:$,value:j}=_;if($===null||j===null)throw new Error("parseMultisigOperation failed");return{id:$,bigmapId:a,rawActions:j.actions,approvals:j.approvals.map(parseImplicitPkh)}},getPendingOperationsForMultisigs=async(_,a)=>{if(_.length===0)return[];const $=_.map(et=>et.pendingOperationsBigmapId),j=await getPendingOperations($,a);return lodashExports.compact(j.map(parseMultisigOperation))},VERSION$1=6,mainStoreMigrations={0:_=>produce(_,a=>{a.multisigs.labelsMap={}}),1:_=>produce(_,a=>{a.announcement=initialState$9}),2:lodashExports.identity,3:_=>produce(_,a=>{a.networks.current.name==="ghostnet"&&(a.networks.current.buyTezUrl="https://faucet.ghostnet.teztnets.com/");for(const $ of a.networks.available)if($.name==="ghostnet"){$.buyTezUrl="https://faucet.ghostnet.teztnets.com/";break}}),4:lodashExports.identity,5:_=>produce(_,a=>{delete a.assets.transfers.tez}),6:async _=>{const a=Object.values(_.contacts).filter(tt=>isValidImplicitPkh(tt.pkh)).map(tt=>[tt.pkh,{...tt,network:void 0}]),$=Object.values(_.contacts).filter(tt=>isValidContractPkh(tt.pkh)).map(tt=>tt.pkh),et=[...(await getNetworksForContracts(_.networks.available,$)).entries()].map(([tt,rt])=>[tt,{..._.contacts[tt],network:rt}]);return produce(_,tt=>{tt.contacts=lodashExports.fromPairs([...a,...et])})}},accountsMigrations={0:lodashExports.identity,1:lodashExports.identity,2:_=>produce(_,a=>{a.items.forEach($=>{$.type==="secret_key"&&($.curve="ed25519")})}),3:lodashExports.identity,4:_=>produce(_,a=>{a.items.forEach($=>{$.type==="ledger"&&!$.derivationPathTemplate&&($.derivationPathTemplate=void 0,$.derivationPath==="44'/1729'/0'/0'"?$.derivationPathTemplate="44'/1729'/?'/0'":$.derivationPath==="44'/1729'/0'/0'/0'"&&($.derivationPathTemplate="44'/1729'/?'/0'/0'"))})}),5:lodashExports.identity,6:lodashExports.identity},AES_MODE="AES-GCM",BYTE_TO_BIT=8,KEY_SIZE=32,NUM_ITERATIONS_V2=6e5,NUM_ITERATIONS_V1=1e4,derivePasswordBasedKeyV1=async(_,a)=>derivePasswordBasedKey(Buffer$g.alloc(32,_,"utf-8"),a,NUM_ITERATIONS_V1),derivePasswordBasedKeyV2=async(_,a)=>derivePasswordBasedKey(Buffer$g.from(_,"utf-8"),a,NUM_ITERATIONS_V2),derivePasswordBasedKey=async(_,a,$)=>{const j={name:"PBKDF2",salt:a,iterations:$,hash:"SHA-256"},et=await crypto.subtle.importKey("raw",_,j.name,!1,["deriveKey"]);return await crypto.subtle.deriveKey(j,et,{name:AES_MODE,length:KEY_SIZE*BYTE_TO_BIT},!1,["encrypt","decrypt"])},SALT_SIZE=32,IV_SIZE=12,encrypt$1=async(_,a)=>{const $=crypto.getRandomValues(new Uint8Array(SALT_SIZE)),j=await derivePasswordBasedKeyV2(a,$),et=crypto.getRandomValues(new Uint8Array(IV_SIZE)),tt=await crypto.subtle.encrypt({name:AES_MODE,iv:et},j,Buffer$g.from(_,"utf-8"));return{iv:buf2hex(Buffer$g.from(et)),salt:buf2hex(Buffer$g.from($)),data:buf2hex(Buffer$g.from(tt))}},decrypt$1=async(_,a,$="V2")=>{const{iv:j,salt:et,data:tt}=_;try{const rt=$==="V2"?await derivePasswordBasedKeyV2(a,hex2Bytes(et)):await derivePasswordBasedKeyV1(a,hex2Bytes(et)),nt=await crypto.subtle.decrypt({name:AES_MODE,iv:hex2Bytes(j)},rt,hex2Bytes(tt));return Buffer$g.from(nt).toString("utf-8")}catch{throw new Error("Error decrypting data: Invalid password")}},changeMnemonicPassword=createAsyncThunk("accounts/changeMnemonicPassword",async({currentPassword:_,newPassword:a},{getState:$})=>{if(_===a)throw new Error("New password must be different from the current password");const{items:j,seedPhrases:et}=$().accounts;if(j.filter(rt=>rt.type==="mnemonic").length===0)throw new Error("No mnemonic accounts found");const tt=await Promise.all(Object.entries(et).map(async([rt,nt])=>{if(!nt)throw new Error("No encrypted mnemonic found");try{const it=await decrypt$1(nt,_),ot=await encrypt$1(it,a);return[rt,ot]}catch(it){throw new Error(it.message)}}));return{newEncryptedMnemonics:lodashExports.fromPairs(tt)}}),initialState$8={items:[],seedPhrases:{},secretKeys:{}},accountsSlice=createSlice({name:"accounts",initialState:initialState$8,extraReducers:_=>{_.addCase(changeMnemonicPassword.fulfilled,(a,$)=>{const{newEncryptedMnemonics:j}=$.payload;a.seedPhrases=j})},reducers:{reset:()=>initialState$8,removeMnemonicAndAccounts:(_,{payload:a})=>{const{fingerPrint:$}=a,j=_.items.filter(et=>!(et.type==="mnemonic"&&et.seedFingerPrint===$));_.items=j,delete _.seedPhrases[$]},removeNonMnemonicAccounts:(_,{payload:a})=>{_.items=lodashExports.remove(_.items,$=>$.type==="mnemonic"||$.type!==a.accountType),a.accountType==="secret_key"&&(_.secretKeys={})},removeAccount:(_,{payload:a})=>{lodashExports.remove(_.items,$=>$.address.pkh===a.address.pkh),a.type==="secret_key"&&delete _.secretKeys[a.address.pkh]},renameAccount:(_,{payload:a})=>{const{account:$,newName:j}=a;if(j.length===0)throw new Error("Cannot rename account to an empty name.");if(_.items.find(tt=>tt.label===j))throw new Error(`Cannot rename account ${$.address.pkh} to ${j} since the name already exists.`);const et=_.items.find(tt=>tt.address.pkh===$.address.pkh&&tt.label===$.label);et&&(et.label=j)},addAccount:(_,{payload:a})=>{_.items=concatUnique(_.items,[a])},addMnemonicAccounts:(_,{payload:{encryptedMnemonic:a,accounts:$,seedFingerprint:j}})=>{_.items=concatUnique(_.items,$),_.seedPhrases[j]=a},addSecretKey:(_,{payload:{pkh:a,encryptedSecretKey:$}})=>{_.secretKeys[a]=$}}}),concatUnique=(_,a)=>(a.forEach($=>{if(_.some(j=>j.address.pkh===$.address.pkh))throw new Error(`Can't add account with address ${$.address.pkh} because it already exists.`)}),[..._,...a]);accountsSlice.actions;const FA12TokenSchema=z.object({standard:z.string().regex(/^fa1\.2$/i),contract:Schema$1}),FA2TokenSchema=z.object({standard:z.string().regex(/^fa2$/i),tokenId:z.string(),contract:Schema$1}),NFTSchema=z.object({id:z.number(),standard:z.string().regex(/^fa2$/i),tokenId:z.string(),contract:Schema$1,totalSupply:z.string().optional(),metadata:z.object({displayUri:z.string(),decimals:z.void().or(z.string().regex(/^0$/))})}),fromRaw$1=_=>{const a=_.metadata;if(_.standard==="fa1.2"){const et=FA12TokenSchema.safeParse(_);return et.success?{type:"fa1.2",metadata:a,contract:et.data.contract.address,tokenId:"0"}:(console.warn("Invalid FA1 token: "+JSON.stringify(_)),null)}const $=NFTSchema.safeParse(_);if($.success)return{metadata:a,type:"nft",id:$.data.id,contract:$.data.contract.address,tokenId:$.data.tokenId,displayUri:$.data.metadata.displayUri,totalSupply:$.data.totalSupply};const j=FA2TokenSchema.safeParse(_);return j.success?{type:"fa2",metadata:a,contract:j.data.contract.address,tokenId:j.data.tokenId}:(console.warn("Invalid FA2 token: "+JSON.stringify(_)),null)},fullId=_=>`${_.contract}:${_.tokenId}`,defaultTokenName=_=>{switch(_.type){case"fa1.2":return DEFAULT_FA1_NAME;case"fa2":return DEFAULT_FA2_NAME;case"nft":return DEFAULT_NFT_NAME}},tokenNameSafe=_=>tokenName(_)||defaultTokenName(_),tokenName=_=>{var a;return(a=_.metadata)==null?void 0:a.name},defaultTokenSymbol=_=>{switch(_.type){case"fa1.2":return DEFAULT_FA1_SYMBOL;case"fa2":return DEFAULT_FA2_SYMBOL;case"nft":return DEFAULT_NFT_SYMBOL}},tokenSymbolSafe=_=>tokenSymbol(_)||defaultTokenSymbol(_),tokenSymbol=_=>{var a;return(a=_.metadata)==null?void 0:a.symbol},tokenDecimals=_=>{var a;return((a=_.metadata)==null?void 0:a.decimals)??DEFAULT_TOKEN_DECIMALS},getRealAmount=(_,a)=>{const $=new BigNumber(a),j=tokenDecimals(_);return $.multipliedBy(new BigNumber(10).exponentiatedBy(j)).toFixed()},formatTokenAmount=(_,a=DEFAULT_TOKEN_DECIMALS)=>{const $=BigNumber(_).dividedBy(BigNumber(10).pow(a));try{return new Intl.NumberFormat("en-US",{minimumFractionDigits:Number(a),maximumFractionDigits:Number(a)}).format($.toNumber())}catch{return console.warn(`Can't format token amount with decimals = ${a}`),formatTokenAmount(_,"0")}},tokenPrettyAmount=(_,a,$)=>{var nt;if(a.type==="nft")return _;const j=tokenSymbolSafe(a),et=(nt=a.metadata)==null?void 0:nt.decimals,tt=$!=null&&$.showSymbol?` ${j}`:"";return`${formatTokenAmount(_,et)}${tt}`},artifactUri=_=>_.metadata.artifactUri||_.displayUri,thumbnailUri=_=>_.metadata.thumbnailUri||_.displayUri,mimeType=_=>{var a,$;return($=(a=_.metadata.formats)==null?void 0:a.find(j=>j.uri===artifactUri(_)))==null?void 0:$.mimeType},royalties=_=>{const a=_.metadata.royalties;if(!a)return[];const $=Math.pow(10,Number(a.decimals)),j=Object.entries(a.shares).map(([et,tt])=>({address:et,share:Number(tt)*100/$}));return j.sort((et,tt)=>et.share`${tokenUri(_,a)}/metadata`,tokenUri=({contract:_,tokenId:a},$)=>`${$.tzktExplorerUrl}/${_}/tokens/${a}`,DEFAULT_FA1_NAME="FA1.2 token",DEFAULT_FA2_NAME="FA2 token",DEFAULT_NFT_NAME="NFT",DEFAULT_FA1_SYMBOL="FA1.2",DEFAULT_FA2_SYMBOL="FA2",DEFAULT_NFT_SYMBOL="NFT",DEFAULT_TOKEN_DECIMALS="0",fromRaw=_=>{const a=fromRaw$1(_.token);return!a||!_.balance?null:{balance:_.balance,lastLevel:_.lastLevel,...a}},keepNFTs=_=>_.filter(a=>a.type==="nft"),keepFA1s=_=>_.filter(a=>a.type==="fa1.2"),keepFA2s=_=>_.filter(a=>a.type==="fa2"),initialState$7={blockLevel:null,balances:{mutez:{},tokens:{}},transfers:{tokens:{}},delegationLevels:{},bakers:[],conversionRate:void 0,refetchTrigger:0,isLoading:!1,lastTimeUpdated:null},assetsSlice=createSlice({name:"assets",initialState:initialState$7,extraReducers:_=>_.addCase(accountsSlice.actions.reset,()=>initialState$7),reducers:{reset:()=>initialState$7,updateBlockLevel:(_,{payload:a})=>{_.blockLevel=a},updateTokenTransfers:(_,{payload:a})=>{a.forEach($=>{_.transfers.tokens[$.transactionId]=$})},updateTezBalance:(_,{payload:a})=>{_.balances.mutez=a.reduce(($,j)=>({...$,[j.address]:String(j.balance)}),{}),_.delegationLevels=a.reduce(($,j)=>({...$,[j.address]:j.delegationLevel}),{})},updateTokenBalance:(_,{payload:a})=>{const $=lodashExports.groupBy(a,j=>j.account.address);_.balances.tokens=lodashExports.mapValues($,j=>lodashExports.compact(j.map(fromRaw)).map(({balance:et,contract:tt,tokenId:rt,lastLevel:nt})=>({balance:et,contract:tt,tokenId:rt,lastLevel:nt})))},removeAccountsData:(_,{payload:a})=>{a.forEach($=>{delete _.balances.mutez[$],delete _.balances.tokens[$],delete _.delegationLevels[$]})},updateBakers:(_,{payload:a})=>{_.bakers=a},updateConversionRate:(_,{payload:a})=>{_.conversionRate=a},refetch:_=>{_.refetchTrigger+=1},setIsLoading:(_,{payload:a})=>{_.isLoading=a},setLastTimeUpdated:(_,{payload:a})=>{_.lastTimeUpdated=a}}}),assetsActions=assetsSlice.actions,MAINNET={name:"mainnet",rpcUrl:"https://prod.tcinfra.net/rpc/mainnet/",tzktApiUrl:"https://api.mainnet.tzkt.io",tzktExplorerUrl:"https://tzkt.io",buyTezUrl:"https://widget.wert.io"},GHOSTNET={name:"ghostnet",rpcUrl:"https://ghostnet.ecadinfra.com",tzktApiUrl:"https://api.ghostnet.tzkt.io",tzktExplorerUrl:"https://ghostnet.tzkt.io",buyTezUrl:"https://faucet.ghostnet.teztnets.com/"},isDefault=_=>DefaultNetworks.map(a=>a.name).includes(_.name),DefaultNetworks=[MAINNET,GHOSTNET],initialState$6=lodashExports.fromPairs(DefaultNetworks.map(_=>[_.name,[]])),batchesSlice=createSlice({name:"batches",initialState:initialState$6,reducers:{reset:()=>initialState$6,add:(_,{payload:{operations:a,network:$}})=>{$.name in _||(_[$.name]=[]);const j=_[$.name],et=j.find(tt=>tt.sender.address.pkh===a.sender.address.pkh);if(et){et.operations.push(...a.operations);return}j.push(a)},clear:(_,{payload:{pkh:a,network:$}})=>{const j=_[$.name]||[],et=lodashExports.findIndex(j,tt=>tt.sender.address.pkh===a);et!==-1&&j.splice(et,1)},removeItem:(_,{payload:{pkh:a,index:$,network:j}})=>{const et=_[j.name]||[],tt=lodashExports.findIndex(et,nt=>nt.sender.address.pkh===a);if(tt===-1)return;const rt=et[tt];$lodashExports.fromPairs(Object.entries(_).map(([$,j])=>{const et=(j||[]).filter(tt=>!a.includes(tt.sender.address.pkh));return[$,et]}))}}),batchesActions=batchesSlice.actions,initialState$5={},beaconSlice=createSlice({name:"beacon",initialState:initialState$5,reducers:{reset:()=>initialState$5,addConnection:(_,{payload:a})=>{_[a.dAppId]={accountPkh:a.accountPkh,networkType:a.networkType}},removeConnection:(_,{payload:a})=>{delete _[a]},removeConnections:(_,{payload:a})=>lodashExports.fromPairs(Object.entries(_).filter(([$,j])=>!a.includes(j.accountPkh)))}});beaconSlice.actions;const initialState$4={},contactsSlice=createSlice({name:"contacts",initialState:initialState$4,reducers:{reset:()=>initialState$4,upsert:(_,{payload:a})=>{_[a.pkh]=a},remove:(_,{payload:a})=>{delete _[a]}}}),contactsActions=contactsSlice.actions,MAX_ERRORS_LEN=100,initialState$3=[],errorsSlice=createSlice({name:"errors",initialState:initialState$3,reducers:{reset:()=>initialState$3,add(_,{payload:a}){_.length===MAX_ERRORS_LEN&&_.shift(),_.push(a)}}}),initialState$2={items:[],pendingOperations:{},labelsMap:{}},multisigsSlice=createSlice({name:"multisigs",initialState:initialState$2,reducers:{reset:()=>initialState$2,mockAddAccount:(_,{payload:a})=>{_.items.push({label:`Multisig Account ${_.items.length}`,type:"multisig",...a})},setMultisigs:(_,{payload:a})=>{const $=lodashExports.fromPairs(_.items.map(j=>[j.address.pkh,j.label]));_.items=a.map((j,et)=>({...j,label:$[j.address.pkh]||_.labelsMap[j.address.pkh]||`Multisig Account ${et}`,type:"multisig"}))},addMultisigLabel:(_,{payload:{pkh:a,label:$}})=>{_.labelsMap[a]=$},setPendingOperations:(_,{payload:a})=>{_.pendingOperations=lodashExports.groupBy(a,$=>$.bigmapId)},setName:(_,{payload:a})=>{const{account:{address:{pkh:$}},newName:j}=a,et=_.items.find(tt=>tt.address.pkh===$);et&&(et.label=j)},removeMultisigsData:(_,{payload:a})=>{const $=_.items.filter(j=>a.includes(j.address.pkh)).map(j=>String(j.pendingOperationsBigmapId));_.pendingOperations=lodashExports.omit(_.pendingOperations,$),_.labelsMap=lodashExports.omit(_.labelsMap,a)}}}),multisigActions=multisigsSlice.actions,initialState$1={available:DefaultNetworks,current:MAINNET},networksSlice=createSlice({name:"networks",initialState:initialState$1,reducers:{reset:()=>initialState$1,setCurrent:(_,{payload:a})=>{_.current=a},upsertNetwork:(_,{payload:a})=>{if(isDefault(a))return;const $=_.available.findIndex(j=>j.name===a.name);if(_.current.name===a.name&&(_.current=a),$!==-1){_.available[$]=a;return}_.available.push(a)},removeNetwork:(_,{payload:a})=>{isDefault(a)||lodashExports.remove(_.available,$=>$.name===a.name)}}}),networksActions=networksSlice.actions,initialState=lodashExports.fromPairs(DefaultNetworks.map(_=>[_.name,{}])),tokensSlice=createSlice({name:"tokens",initialState,reducers:{reset:()=>initialState,addTokens:(_,{payload:{network:a,tokens:$}})=>{lodashExports.compact($.map(fromRaw$1)).forEach(j=>{lodashExports.setWith(_,[a.name,j.contract,j.tokenId],j,Object)})}}}),tokensActions=tokensSlice.actions,rootPersistConfig={key:"root",version:VERSION$1,storage:default_1,blacklist:["accounts"],migrate:createAsyncMigrate(mainStoreMigrations)},accountsPersistConfig={key:"accounts",version:VERSION$1,storage:default_1,migrate:createAsyncMigrate(accountsMigrations)},rootReducers=combineReducers({accounts:persistReducer(accountsPersistConfig,accountsSlice.reducer),announcement:announcementSlice.reducer,assets:assetsSlice.reducer,batches:batchesSlice.reducer,beacon:beaconSlice.reducer,contacts:contactsSlice.reducer,errors:errorsSlice.reducer,multisigs:multisigsSlice.reducer,networks:networksSlice.reducer,tokens:tokensSlice.reducer}),reducer=persistReducer(rootPersistConfig,rootReducers),store=configureStore({reducer,middleware:_=>_({serializableCheck:{ignoredActions:[FLUSH,REHYDRATE,PAUSE,PERSIST,PURGE,REGISTER]}})}),persistor=persistStore(store),FormErrorMessage=({children:_,...a})=>jsxRuntimeExports.jsxs(FormErrorMessage$1,{color:colors.orange,fontSize:"12px",...a,children:[jsxRuntimeExports.jsx(Icon,{as:ExclamationIcon,marginRight:"6px"}),_]}),CONFIRMATION_CODE="wasabi",reset=()=>WalletClient.destroy().catch(lodashExports.noop).finally(()=>{persistor.pause(),localStorage.clear(),window.location.reload()}),OffboardingForm=()=>{const _=useForm({mode:"onBlur"}),{register:a,handleSubmit:$,formState:{isValid:j,errors:et},getValues:tt}=_,rt=()=>{if(!(!tt("check")||tt("confirmationCode")!==CONFIRMATION_CODE))return reset()};return jsxRuntimeExports.jsx(FormProvider,{..._,children:jsxRuntimeExports.jsxs("form",{onSubmit:$(rt),children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalHeader,{marginBottom:"10px",textAlign:"center",children:jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(WarningIcon,{width:"40px",height:"40px",marginBottom:"20px"}),jsxRuntimeExports.jsx(Heading,{children:"Off-board Wallet"})]})}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Text,{marginBottom:"8px",color:colors.gray[400],fontWeight:"bold",textAlign:"center",size:"sm",children:"This will permanently remove any data from this computer."}),jsxRuntimeExports.jsxs(Text,{color:colors.gray[400],textAlign:"center",size:"sm",children:["Please enter « ",CONFIRMATION_CODE," » to confirm. The accounts are still available to be imported in the future; in order to regain access to your accounts, please make sure that you keep the recovery phrase."]}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Divider,{borderColor:colors.gray[700],marginY:"20px"}),jsxRuntimeExports.jsx(FormControl,{isInvalid:!!et.check,children:jsxRuntimeExports.jsx(Checkbox,{...a("check",{required:!0}),children:jsxRuntimeExports.jsx(Text,{marginLeft:"8px",fontWeight:"bold",children:"I have read the warning and I am certain I want to remove my private keys locally. I also made sure to keep my recovery phrase."})})}),jsxRuntimeExports.jsx(Divider,{borderColor:colors.gray[700],marginY:"20px"}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!et.confirmationCode,paddingY:5,children:[jsxRuntimeExports.jsx(Input,{type:"text",...a("confirmationCode",{required:"Confirmation is required",validate:nt=>nt===CONFIRMATION_CODE||"Confirmation code does not match"}),placeholder:"Enter code word to confirm"}),et.confirmationCode&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.confirmationCode.message})]})]})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:0,children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:"8px",isDisabled:!j,size:"lg",type:"submit",variant:"warning",children:"Confirm"})})]})})},useOffboardingModal=()=>{const{isOpen:_,onOpen:a,onClose:$}=useDisclosure$1();return{modalElement:jsxRuntimeExports.jsxs(Modal,{isCentered:!0,isOpen:_,onClose:$,children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(ModalContent,{background:colors.gray[900],children:jsxRuntimeExports.jsx(OffboardingForm,{})})]}),onOpen:a}},CircleIcon=({icon:_,size:a,onClick:$=()=>{}})=>jsxRuntimeExports.jsx(Box,{width:a,height:a,margin:"auto",background:colors.gray[700],borderRadius:"full",onClick:$,children:jsxRuntimeExports.jsx(Center,{height:"100%",children:_})}),ModalContentWrapper=({children:_,icon:a,title:$,subtitle:j})=>jsxRuntimeExports.jsxs(VStack,{maxHeight:"83vh",spacing:0,children:[jsxRuntimeExports.jsx(Box,{marginBottom:"16px",children:jsxRuntimeExports.jsx(CircleIcon,{icon:a,size:"48px"})}),jsxRuntimeExports.jsxs(Center,{flexDirection:"column",width:"340px",marginBottom:"32px",children:[jsxRuntimeExports.jsx(Heading,{lineHeight:"26px",size:"xl",children:$}),j&&jsxRuntimeExports.jsx(Text,{marginTop:"10px",color:colors.gray[400],lineHeight:"18px",textAlign:"center",size:"sm",children:j})]}),_]}),name="umami",productName="umami",version="2.2.0",author="Trilitech ",description="Tezos Wallet",homepage="https://umamiwallet.com",repository="https://github.com/trilitech/umami-v2",license="MIT",engines={node:">=20 <21.0.0"},type$5="commonjs",main="build/electron.js",scripts={build:"vite build",dev:"vite dev",preview:"vite preview","electron:package:linux":"electron-builder -l","electron:package:mac":"electron-builder -m","electron:package:mac:debug":"DEBUG=true yarn build --mode dev && sed -i='' 's@devTools: false@devTools: true@g' build/electron.js && yarn electron:package:mac -c electron-builder.dev.yml && rm -rf build","electron:package:win":"electron-builder -w","electron:start":"electronmon .",docs:"typedoc --tsconfig tsconfig.e2e.json","format:ci":"prettier --check .",format:"prettier --write .","lint:ci":"eslint src --ext .js,.jsx,.ts,.tsx --max-warnings=0",lint:"eslint src --ext .js,.jsx,.ts,.tsx --fix",test:"cross-env TZ=CET jest","test:watch":"cross-env DEV=true yarn test --watch","test:e2e":"cross-env TS_NODE_PROJECT=tsconfig.e2e.json cucumber-js","test:e2e:focus":"yarn test:e2e --tags='@focus'","theme:watch":"chakra-cli tokens src/style/theme.ts --watch",theme:"chakra-cli tokens src/style/theme.ts"},devDependencies={"@airgap/beacon-wallet":"^4.2.2","@babel/core":"^7.24.7","@babel/preset-env":"^7.24.7","@babel/preset-react":"^7.24.7","@babel/preset-typescript":"^7.24.7","@babel/runtime":"^7.24.7","@chakra-ui/anatomy":"2.2.2","@chakra-ui/cli":"^2.4.1","@chakra-ui/icons":"^2.1.1","@chakra-ui/react":"^2.8.2","@chakra-ui/styled-system":"2.9.2","@chakra-ui/system":"^2.6.2","@chriscdn/promise-semaphore":"^2.0.9","@cucumber/cucumber":"^10.8.0","@electron/notarize":"^2.3.2","@emotion/react":"^11.11.4","@emotion/styled":"^11.11.5","@ledgerhq/hw-transport-webusb":"^6.28.6","@playwright/test":"^1.44.1","@reduxjs/toolkit":"^2.2.5","@stylistic/eslint-plugin":"^2.1.0","@tanstack/eslint-plugin-query":"^5.43.1","@tanstack/react-query":"^5.40.1","@tanstack/react-query-devtools":"^5.40.1","@taquito/ledger-signer":"^19.2.1","@taquito/michel-codec":"^19.2.1","@taquito/rpc":"^19.2.1","@taquito/signer":"^19.2.1","@taquito/taquito":"19.2.1","@taquito/utils":"^19.2.1","@testing-library/dom":"^10.1.0","@testing-library/jest-dom":"6.4.5","@testing-library/react":"14.3.1","@testing-library/user-event":"14.5.2","@toruslabs/customauth":"^16.0.6","@types/babel__core":"^7.20.5","@types/babel__preset-env":"^7.9.6","@types/identity-obj-proxy":"^3.0.2","@types/jest":"^29.5.12","@types/md5":"^2.3.5","@types/node":"20.14.2","@types/papaparse":"^5.3.14","@types/pluralize":"^0.0.33","@types/promise-retry":"^1.1.6","@types/react":"18.3.3","@types/react-dom":"18.3.0","@types/react-test-renderer":"^18.3.0","@typescript-eslint/eslint-plugin":"^7.12.0","@typescript-eslint/parser":"^7.12.0","@tzkt/sdk-api":"^2.2.1","@vitejs/plugin-react":"^4.3.1",axios:"^1.7.2","babel-jest":"^29.7.0","bignumber.js":"^9.1.2",bip39:"^3.1.0",concurrently:"^8.2.2","cross-env":"^7.0.3","date-fns":"^3.6.0",electron:"^30.1.0","electron-builder":"^24.13.3",electronmon:"^2.0.3",eslint:"^8.57.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-chakra-ui":"^0.11.0","eslint-plugin-deprecation":"^3.0.0","eslint-plugin-import":"^2.29.1","eslint-plugin-jest":"^28.6.0","eslint-plugin-jest-dom":"^5.4.0","eslint-plugin-playwright":"^1.6.2","eslint-plugin-react":"^7.34.2","eslint-plugin-react-hooks":"^4.6.2","eslint-plugin-react-redux":"^4.1.0","eslint-plugin-testing-library":"^6.2.2","eslint-plugin-tsdoc":"^0.3.0","eslint-plugin-unused-imports":"^3.2.0","framer-motion":"^11.2.10","http-server":"^14.1.1","identity-obj-proxy":"^3.0.0",immer:"^10.1.1",jest:"29.7.0","jest-canvas-mock":"^2.5.2","jest-environment-jsdom":"^29.7.0","jest-fail-on-console":"^3.3.0","jest-resolve":"29.7.0","jest-watch-typeahead":"^2.2.2",lodash:"^4.17.21",md5:"^2.3.0",mockdate:"^3.0.5",ordinal:"^1.0.3",papaparse:"^5.4.1",pluralize:"^8.0.0",prettier:"^3.3.1","prettier-plugin-gherkin":"^2.2.1",process:"^0.11.10","promise-retry":"^2.0.1",react:"^18.3.1","react-dom":"^18.3.1","react-error-boundary":"^4.0.13","react-hook-form":"^7.51.5","react-hooks-testing-library":"^0.6.0","react-player":"^2.16.0","react-qrcode-logo":"^3.0.0","react-redux":"9.1.2","react-refresh":"^0.14.2","react-remove-scroll":"^2.5.10","react-responsive-carousel":"^3.2.23","react-router-dom":"^6.23.1","react-test-renderer":"^18.3.1",redux:"^5.0.1","redux-persist":"^6.0.0","ts-node":"^10.9.2",typedoc:"^0.25.13","typedoc-plugin-missing-exports":"^2.2.0",typescript:"5.4.5",vite:"^5.2.13","vite-plugin-checker":"^0.6.4","vite-plugin-node-polyfills":"^0.22.0",zipurl:"^0.2.18",zod:"^3.23.8"},packageManager="yarn@4.2.2",dependencies={"electron-updater":"^6.2.1"},resolutions={jsdom:"^23.0.1","@types/jsdom":"^21.1.6"},packageInfo={name,productName,version,author,description,homepage,repository,license,engines,type:type$5,main,scripts,devDependencies,packageManager,dependencies,resolutions};var withSelector={exports:{}},useSyncExternalStoreWithSelector_production_min={};/** +`+new Array(_.length+4).join(" "):et=4294967296&&et++,_[a]=j,_[a+1]=et}function ADD64AC(_,a,$,j){let et=_[a]+$;$<0&&(et+=4294967296);let tt=_[a+1]+j;et>=4294967296&&tt++,_[a]=et,_[a+1]=tt}function B2B_GET32(_,a){return _[a]^_[a+1]<<8^_[a+2]<<16^_[a+3]<<24}function B2B_G(_,a,$,j,et,tt){const rt=m$1[et],nt=m$1[et+1],it=m$1[tt],ot=m$1[tt+1];ADD64AA(v$2,_,a),ADD64AC(v$2,_,rt,nt);let st=v$2[j]^v$2[_],ct=v$2[j+1]^v$2[_+1];v$2[j]=ct,v$2[j+1]=st,ADD64AA(v$2,$,j),st=v$2[a]^v$2[$],ct=v$2[a+1]^v$2[$+1],v$2[a]=st>>>24^ct<<8,v$2[a+1]=ct>>>24^st<<8,ADD64AA(v$2,_,a),ADD64AC(v$2,_,it,ot),st=v$2[j]^v$2[_],ct=v$2[j+1]^v$2[_+1],v$2[j]=st>>>16^ct<<16,v$2[j+1]=ct>>>16^st<<16,ADD64AA(v$2,$,j),st=v$2[a]^v$2[$],ct=v$2[a+1]^v$2[$+1],v$2[a]=ct>>>31^st<<1,v$2[a+1]=st>>>31^ct<<1}const BLAKE2B_IV32=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),SIGMA8=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],SIGMA82=new Uint8Array(SIGMA8.map(function(_){return _*2})),v$2=new Uint32Array(32),m$1=new Uint32Array(32);function blake2bCompress(_,a){let $=0;for($=0;$<16;$++)v$2[$]=_.h[$],v$2[$+16]=BLAKE2B_IV32[$];for(v$2[24]=v$2[24]^_.t,v$2[25]=v$2[25]^_.t/4294967296,a&&(v$2[28]=~v$2[28],v$2[29]=~v$2[29]),$=0;$<32;$++)m$1[$]=B2B_GET32(_.b,4*$);for($=0;$<12;$++)B2B_G(0,8,16,24,SIGMA82[$*16+0],SIGMA82[$*16+1]),B2B_G(2,10,18,26,SIGMA82[$*16+2],SIGMA82[$*16+3]),B2B_G(4,12,20,28,SIGMA82[$*16+4],SIGMA82[$*16+5]),B2B_G(6,14,22,30,SIGMA82[$*16+6],SIGMA82[$*16+7]),B2B_G(0,10,20,30,SIGMA82[$*16+8],SIGMA82[$*16+9]),B2B_G(2,12,22,24,SIGMA82[$*16+10],SIGMA82[$*16+11]),B2B_G(4,14,16,26,SIGMA82[$*16+12],SIGMA82[$*16+13]),B2B_G(6,8,18,28,SIGMA82[$*16+14],SIGMA82[$*16+15]);for($=0;$<16;$++)_.h[$]=_.h[$]^v$2[$]^v$2[$+16]}const parameterBlock=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function blake2bInit(_,a,$,j){if(_===0||_>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(a&&a.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if($&&$.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(j&&j.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const et={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:_};parameterBlock.fill(0),parameterBlock[0]=_,a&&(parameterBlock[1]=a.length),parameterBlock[2]=1,parameterBlock[3]=1,$&¶meterBlock.set($,32),j&¶meterBlock.set(j,48);for(let tt=0;tt<16;tt++)et.h[tt]=BLAKE2B_IV32[tt]^B2B_GET32(parameterBlock,tt*4);return a&&(blake2bUpdate(et,a),et.c=128),et}function blake2bUpdate(_,a){for(let $=0;$>2]>>8*($&3);return a}function blake2b(_,a,$,j,et){$=$||64,_=util$2.normalizeInput(_),j&&(j=util$2.normalizeInput(j)),et&&(et=util$2.normalizeInput(et));const tt=blake2bInit($,a,j,et);return blake2bUpdate(tt,_),blake2bFinal(tt)}function blake2bHex(_,a,$,j,et){const tt=blake2b(_,a,$,j,et);return util$2.toHex(tt)}var blake2b_1={blake2b,blake2bHex,blake2bInit,blake2bUpdate,blake2bFinal};const util$1=util$3;function B2S_GET32(_,a){return _[a]^_[a+1]<<8^_[a+2]<<16^_[a+3]<<24}function B2S_G(_,a,$,j,et,tt){v$1[_]=v$1[_]+v$1[a]+et,v$1[j]=ROTR32(v$1[j]^v$1[_],16),v$1[$]=v$1[$]+v$1[j],v$1[a]=ROTR32(v$1[a]^v$1[$],12),v$1[_]=v$1[_]+v$1[a]+tt,v$1[j]=ROTR32(v$1[j]^v$1[_],8),v$1[$]=v$1[$]+v$1[j],v$1[a]=ROTR32(v$1[a]^v$1[$],7)}function ROTR32(_,a){return _>>>a^_<<32-a}const BLAKE2S_IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),v$1=new Uint32Array(16),m=new Uint32Array(16);function blake2sCompress(_,a){let $=0;for($=0;$<8;$++)v$1[$]=_.h[$],v$1[$+8]=BLAKE2S_IV[$];for(v$1[12]^=_.t,v$1[13]^=_.t/4294967296,a&&(v$1[14]=~v$1[14]),$=0;$<16;$++)m[$]=B2S_GET32(_.b,4*$);for($=0;$<10;$++)B2S_G(0,4,8,12,m[SIGMA[$*16+0]],m[SIGMA[$*16+1]]),B2S_G(1,5,9,13,m[SIGMA[$*16+2]],m[SIGMA[$*16+3]]),B2S_G(2,6,10,14,m[SIGMA[$*16+4]],m[SIGMA[$*16+5]]),B2S_G(3,7,11,15,m[SIGMA[$*16+6]],m[SIGMA[$*16+7]]),B2S_G(0,5,10,15,m[SIGMA[$*16+8]],m[SIGMA[$*16+9]]),B2S_G(1,6,11,12,m[SIGMA[$*16+10]],m[SIGMA[$*16+11]]),B2S_G(2,7,8,13,m[SIGMA[$*16+12]],m[SIGMA[$*16+13]]),B2S_G(3,4,9,14,m[SIGMA[$*16+14]],m[SIGMA[$*16+15]]);for($=0;$<8;$++)_.h[$]^=v$1[$]^v$1[$+8]}function blake2sInit(_,a){if(!(_>0&&_<=32))throw new Error("Incorrect output length, should be in [1, 32]");const $=a?a.length:0;if(a&&!($>0&&$<=32))throw new Error("Incorrect key length, should be in [1, 32]");const j={h:new Uint32Array(BLAKE2S_IV),b:new Uint8Array(64),c:0,t:0,outlen:_};return j.h[0]^=16842752^$<<8^_,$>0&&(blake2sUpdate(j,a),j.c=64),j}function blake2sUpdate(_,a){for(let $=0;$>2]>>8*($&3)&255;return a}function blake2s(_,a,$){$=$||32,_=util$1.normalizeInput(_);const j=blake2sInit($,a);return blake2sUpdate(j,_),blake2sFinal(j)}function blake2sHex(_,a,$){const j=blake2s(_,a,$);return util$1.toHex(j)}var blake2s_1={blake2s,blake2sHex,blake2sInit,blake2sUpdate,blake2sFinal};const b2b=blake2b_1,b2s=blake2s_1;var blakejs={blake2b:b2b.blake2b,blake2bHex:b2b.blake2bHex,blake2bInit:b2b.blake2bInit,blake2bUpdate:b2b.blake2bUpdate,blake2bFinal:b2b.blake2bFinal,blake2s:b2s.blake2s,blake2sHex:b2s.blake2sHex,blake2sInit:b2s.blake2sInit,blake2sUpdate:b2s.blake2sUpdate,blake2sFinal:b2s.blake2sFinal};const blake=getDefaultExportFromCjs$1(blakejs);var sha256$2={},_sha2={},_assert={};Object.defineProperty(_assert,"__esModule",{value:!0});_assert.output=_assert.exists=_assert.hash=_assert.bytes=_assert.bool=_assert.number=void 0;function number$2(_){if(!Number.isSafeInteger(_)||_<0)throw new Error(`Wrong positive integer: ${_}`)}_assert.number=number$2;function bool$2(_){if(typeof _!="boolean")throw new Error(`Expected boolean, not ${_}`)}_assert.bool=bool$2;function isBytes$3(_){return _ instanceof Uint8Array||_!=null&&typeof _=="object"&&_.constructor.name==="Uint8Array"}function bytes$1(_,...a){if(!isBytes$3(_))throw new Error("Expected Uint8Array");if(a.length>0&&!a.includes(_.length))throw new Error(`Expected Uint8Array of length ${a}, not of length=${_.length}`)}_assert.bytes=bytes$1;function hash$2(_){if(typeof _!="function"||typeof _.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$2(_.outputLen),number$2(_.blockLen)}_assert.hash=hash$2;function exists$1(_,a=!0){if(_.destroyed)throw new Error("Hash instance has been destroyed");if(a&&_.finished)throw new Error("Hash#digest() has already been called")}_assert.exists=exists$1;function output$1(_,a){bytes$1(_);const $=a.outputLen;if(_.length<$)throw new Error(`digestInto() expects output buffer of length at least ${$}`)}_assert.output=output$1;const assert$2={number:number$2,bool:bool$2,bytes:bytes$1,hash:hash$2,exists:exists$1,output:output$1};_assert.default=assert$2;var utils$2={},crypto$1={};Object.defineProperty(crypto$1,"__esModule",{value:!0});crypto$1.crypto=void 0;crypto$1.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(_){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(_,"__esModule",{value:!0}),_.randomBytes=_.wrapXOFConstructorWithOpts=_.wrapConstructorWithOpts=_.wrapConstructor=_.checkOpts=_.Hash=_.concatBytes=_.toBytes=_.utf8ToBytes=_.asyncLoop=_.nextTick=_.hexToBytes=_.bytesToHex=_.isLE=_.rotr=_.createView=_.u32=_.u8=void 0;const a=crypto$1,$=$t=>new Uint8Array($t.buffer,$t.byteOffset,$t.byteLength);_.u8=$;const j=$t=>new Uint32Array($t.buffer,$t.byteOffset,Math.floor($t.byteLength/4));_.u32=j;function et($t){return $t instanceof Uint8Array||$t!=null&&typeof $t=="object"&&$t.constructor.name==="Uint8Array"}const tt=$t=>new DataView($t.buffer,$t.byteOffset,$t.byteLength);_.createView=tt;const rt=($t,Bt)=>$t<<32-Bt|$t>>>Bt;if(_.rotr=rt,_.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!_.isLE)throw new Error("Non little-endian hardware is not supported");const nt=Array.from({length:256},($t,Bt)=>Bt.toString(16).padStart(2,"0"));function it($t){if(!et($t))throw new Error("Uint8Array expected");let Bt="";for(let Nt=0;Nt<$t.length;Nt++)Bt+=nt[$t[Nt]];return Bt}_.bytesToHex=it;const ot={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function st($t){if($t>=ot._0&&$t<=ot._9)return $t-ot._0;if($t>=ot._A&&$t<=ot._F)return $t-(ot._A-10);if($t>=ot._a&&$t<=ot._f)return $t-(ot._a-10)}function ct($t){if(typeof $t!="string")throw new Error("hex string expected, got "+typeof $t);const Bt=$t.length,Nt=Bt/2;if(Bt%2)throw new Error("padded hex string expected, got unpadded hex of length "+Bt);const Lt=new Uint8Array(Nt);for(let Pt=0,bt=0;Pt{};_.nextTick=ut;async function ht($t,Bt,Nt){let Lt=Date.now();for(let Pt=0;Pt<$t;Pt++){Nt(Pt);const bt=Date.now()-Lt;bt>=0&&bt$t().update(St(Lt)).digest(),Nt=$t();return Bt.outputLen=Nt.outputLen,Bt.blockLen=Nt.blockLen,Bt.create=()=>$t(),Bt}_.wrapConstructor=zt;function Ut($t){const Bt=(Lt,Pt)=>$t(Pt).update(St(Lt)).digest(),Nt=$t({});return Bt.outputLen=Nt.outputLen,Bt.blockLen=Nt.blockLen,Bt.create=Lt=>$t(Lt),Bt}_.wrapConstructorWithOpts=Ut;function Vt($t){const Bt=(Lt,Pt)=>$t(Pt).update(St(Lt)).digest(),Nt=$t({});return Bt.outputLen=Nt.outputLen,Bt.blockLen=Nt.blockLen,Bt.create=Lt=>$t(Lt),Bt}_.wrapXOFConstructorWithOpts=Vt;function jt($t=32){if(a.crypto&&typeof a.crypto.getRandomValues=="function")return a.crypto.getRandomValues(new Uint8Array($t));throw new Error("crypto.getRandomValues must be defined")}_.randomBytes=jt})(utils$2);Object.defineProperty(_sha2,"__esModule",{value:!0});_sha2.SHA2=void 0;const _assert_js_1$1=_assert,utils_js_1$3=utils$2;function setBigUint64(_,a,$,j){if(typeof _.setBigUint64=="function")return _.setBigUint64(a,$,j);const et=BigInt(32),tt=BigInt(4294967295),rt=Number($>>et&tt),nt=Number($&tt),it=j?4:0,ot=j?0:4;_.setUint32(a+it,rt,j),_.setUint32(a+ot,nt,j)}class SHA2 extends utils_js_1$3.Hash{constructor(a,$,j,et){super(),this.blockLen=a,this.outputLen=$,this.padOffset=j,this.isLE=et,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(a),this.view=(0,utils_js_1$3.createView)(this.buffer)}update(a){(0,_assert_js_1$1.exists)(this);const{view:$,buffer:j,blockLen:et}=this;a=(0,utils_js_1$3.toBytes)(a);const tt=a.length;for(let rt=0;rtet-rt&&(this.process(j,0),rt=0);for(let ct=rt;ctst.length)throw new Error("_sha2: outputLen bigger than state");for(let ct=0;ct_&a^~_&$,Maj=(_,a,$)=>_&a^_&$^a&$,SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64);class SHA256 extends _sha2_js_1$1.SHA2{constructor(){super(64,32,8,!1),this.A=IV[0]|0,this.B=IV[1]|0,this.C=IV[2]|0,this.D=IV[3]|0,this.E=IV[4]|0,this.F=IV[5]|0,this.G=IV[6]|0,this.H=IV[7]|0}get(){const{A:a,B:$,C:j,D:et,E:tt,F:rt,G:nt,H:it}=this;return[a,$,j,et,tt,rt,nt,it]}set(a,$,j,et,tt,rt,nt,it){this.A=a|0,this.B=$|0,this.C=j|0,this.D=et|0,this.E=tt|0,this.F=rt|0,this.G=nt|0,this.H=it|0}process(a,$){for(let ct=0;ct<16;ct++,$+=4)SHA256_W[ct]=a.getUint32($,!1);for(let ct=16;ct<64;ct++){const ut=SHA256_W[ct-15],ht=SHA256_W[ct-2],Et=(0,utils_js_1$2.rotr)(ut,7)^(0,utils_js_1$2.rotr)(ut,18)^ut>>>3,St=(0,utils_js_1$2.rotr)(ht,17)^(0,utils_js_1$2.rotr)(ht,19)^ht>>>10;SHA256_W[ct]=St+SHA256_W[ct-7]+Et+SHA256_W[ct-16]|0}let{A:j,B:et,C:tt,D:rt,E:nt,F:it,G:ot,H:st}=this;for(let ct=0;ct<64;ct++){const ut=(0,utils_js_1$2.rotr)(nt,6)^(0,utils_js_1$2.rotr)(nt,11)^(0,utils_js_1$2.rotr)(nt,25),ht=st+ut+Chi(nt,it,ot)+SHA256_K[ct]+SHA256_W[ct]|0,St=((0,utils_js_1$2.rotr)(j,2)^(0,utils_js_1$2.rotr)(j,13)^(0,utils_js_1$2.rotr)(j,22))+Maj(j,et,tt)|0;st=ot,ot=it,it=nt,nt=rt+ht|0,rt=tt,tt=et,et=j,j=ht+St|0}j=j+this.A|0,et=et+this.B|0,tt=tt+this.C|0,rt=rt+this.D|0,nt=nt+this.E|0,it=it+this.F|0,ot=ot+this.G|0,st=st+this.H|0,this.set(j,et,tt,rt,nt,it,ot,st)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class SHA224 extends SHA256{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}sha256$2.sha256=(0,utils_js_1$2.wrapConstructor)(()=>new SHA256);sha256$2.sha224=(0,utils_js_1$2.wrapConstructor)(()=>new SHA224);function base$1(_){if(_.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),$=0;$>>0,Ot=new Uint8Array(Ct);Mt!==kt;){for(var zt=ht[Mt],Ut=0,Vt=Ct-1;(zt!==0||Ut>>0,Ot[Vt]=zt%rt>>>0,zt=zt/rt>>>0;if(zt!==0)throw new Error("Non-zero carry");St=Ut,Mt++}for(var jt=Ct-St;jt!==Ct&&Ot[jt]===0;)jt++;for(var $t=nt.repeat(Et);jt>>0,Ct=new Uint8Array(kt);ht[Et];){var Ot=a[ht.charCodeAt(Et)];if(Ot===255)return;for(var zt=0,Ut=kt-1;(Ot!==0||zt>>0,Ct[Ut]=Ot%256>>>0,Ot=Ot/256>>>0;if(Ot!==0)throw new Error("Non-zero carry");Mt=zt,Et++}for(var Vt=kt-Mt;Vt!==kt&&Ct[Vt]===0;)Vt++;for(var jt=new Uint8Array(St+(kt-Vt)),$t=St;Vt!==kt;)jt[$t++]=Ct[Vt++];return jt}function ut(ht){var Et=ct(ht);if(Et)return Et;throw new Error("Non-base"+rt+" character")}return{encode:st,decodeUnsafe:ct,decode:ut}}var src$1=base$1;const basex=src$1,ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var bs58=basex(ALPHABET),base58=bs58,base=function(_){function a(tt){var rt=Uint8Array.from(tt),nt=_(rt),it=rt.length+4,ot=new Uint8Array(it);return ot.set(rt,0),ot.set(nt.subarray(0,4),rt.length),base58.encode(ot,it)}function $(tt){var rt=tt.slice(0,-4),nt=tt.slice(-4),it=_(rt);if(!(nt[0]^it[0]|nt[1]^it[1]|nt[2]^it[2]|nt[3]^it[3]))return rt}function j(tt){var rt=base58.decodeUnsafe(tt);if(rt)return $(rt)}function et(tt){var rt=base58.decode(tt),nt=$(rt);if(!nt)throw new Error("Invalid checksum");return nt}return{encode:a,decode:et,decodeUnsafe:j}},{sha256:sha256$1}=sha256$2,bs58checkBase=base;function sha256x2(_){return sha256$1(sha256$1(_))}var bs58check=bs58checkBase(sha256x2);const bs58check$1=getDefaultExportFromCjs$1(bs58check);class TaquitoError extends Error{}class ParameterValidationError extends TaquitoError{}class RpcError extends TaquitoError{}class TezosToolkitConfigError extends TaquitoError{}class UnsupportedActionError extends TaquitoError{}class NetworkError extends TaquitoError{}class InvalidAddressError extends ParameterValidationError{constructor(a,$){super(),this.address=a,this.errorDetail=$,this.name="InvalidAddressError",this.message=`Invalid address "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidBlockHashError extends ParameterValidationError{constructor(a,$){super(),this.blockHash=a,this.errorDetail=$,this.name="InvalidBlockHashError",this.message=`Invalid block hash "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidAmountError extends ParameterValidationError{constructor(a){super(),this.amount=a,this.name="InvalidAmountError",this.message=`Invalid amount "${a}"`}}class InvalidDerivationPathError extends ParameterValidationError{constructor(a,$){super(),this.derivationPath=a,this.errorDetail=$,this.name="InvalidDerivationPathError",this.message=`Invalid derivation path "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidHexStringError extends ParameterValidationError{constructor(a,$){super(),this.hexString=a,this.errorDetail=$,this.name="InvalidHexStringError",this.message=`Invalid hex string "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidMessageError extends ParameterValidationError{constructor(a,$){super(),this.msg=a,this.errorDetail=$,this.name="InvalidMessageError",this.message=`Invalid message "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidViewParameterError extends ParameterValidationError{constructor(a,$,j,et){super(),this.viewName=a,this.sigs=$,this.args=j,this.cause=et,this.name="InvalidViewParameterError",this.message=`Invalid view arguments ${JSON.stringify(j)} received for name "${a}" expecting one of the following signatures ${JSON.stringify($)}.`}}class InvalidKeyError extends ParameterValidationError{constructor(a){super(),this.errorDetail=a,this.name="InvalidKeyError",this.message="Invalid private key",this.message+=a?` ${a}.`:"."}}class InvalidPublicKeyError extends ParameterValidationError{constructor(a,$){super(),this.publicKey=a,this.errorDetail=$,this.name="InvalidPublicKeyError",this.message=`Invalid public key "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidContractAddressError extends ParameterValidationError{constructor(a,$){super(),this.contractAddress=a,this.errorDetail=$,this.name="InvalidContractAddressError",this.message=`Invalid contract address "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidChainIdError extends ParameterValidationError{constructor(a,$){super(),this.chainId=a,this.errorDetail=$,this.name="InvalidChainIdError",this.message=`Invalid chain id "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidKeyHashError extends ParameterValidationError{constructor(a,$){super(),this.keyHash=a,this.errorDetail=$,this.name="InvalidKeyHashError",this.message=`Invalid public key hash "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidOperationHashError extends ParameterValidationError{constructor(a,$){super(),this.operationHash=a,this.errorDetail=$,this.name="InvalidOperationHashError",this.message=`Invalid operation hash "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidOperationKindError extends ParameterValidationError{constructor(a,$){super(),this.operationKind=a,this.errorDetail=$,this.name="InvalidOperationKindError",this.message=`Invalid operation kind "${a}"`,this.message+=$?` ${$}.`:"."}}class DeprecationError extends UnsupportedActionError{constructor(a){super(),this.message=a,this.name="DeprecationError"}}class ProhibitedActionError extends UnsupportedActionError{constructor(a){super(),this.message=a,this.name="ProhibitedActionError"}}class PublicKeyNotFoundError extends TaquitoError{constructor(a,$){super(),this.pkh=a,this.cause=$,this.name="PublicKeyNotFoundError",this.message=`Public key not found of this address "${a}" in either wallet or contract API.`}}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER$2=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(_){var a,$,j,et=Ct.prototype={constructor:Ct,toString:null,valueOf:null},tt=new Ct(1),rt=20,nt=4,it=-7,ot=21,st=-1e7,ct=1e7,ut=!1,ht=1,Et=0,St={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Mt="0123456789abcdefghijklmnopqrstuvwxyz",kt=!0;function Ct($t,Bt){var Nt,Lt,Pt,bt,at,dt,vt,xt,wt=this;if(!(wt instanceof Ct))return new Ct($t,Bt);if(Bt==null){if($t&&$t._isBigNumber===!0){wt.s=$t.s,!$t.c||$t.e>ct?wt.c=wt.e=null:$t.e=10;at/=10,bt++);bt>ct?wt.c=wt.e=null:(wt.e=bt,wt.c=[$t]);return}xt=String($t)}else{if(!isNumeric.test(xt=String($t)))return j(wt,xt,dt);wt.s=xt.charCodeAt(0)==45?(xt=xt.slice(1),-1):1}(bt=xt.indexOf("."))>-1&&(xt=xt.replace(".","")),(at=xt.search(/e/i))>0?(bt<0&&(bt=at),bt+=+xt.slice(at+1),xt=xt.substring(0,at)):bt<0&&(bt=xt.length)}else{if(intCheck(Bt,2,Mt.length,"Base"),Bt==10&&kt)return wt=new Ct($t),Vt(wt,rt+wt.e+1,nt);if(xt=String($t),dt=typeof $t=="number"){if($t*0!=0)return j(wt,xt,dt,Bt);if(wt.s=1/$t<0?(xt=xt.slice(1),-1):1,Ct.DEBUG&&xt.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+$t)}else wt.s=xt.charCodeAt(0)===45?(xt=xt.slice(1),-1):1;for(Nt=Mt.slice(0,Bt),bt=at=0,vt=xt.length;atbt){bt=vt;continue}}else if(!Pt&&(xt==xt.toUpperCase()&&(xt=xt.toLowerCase())||xt==xt.toLowerCase()&&(xt=xt.toUpperCase()))){Pt=!0,at=-1,bt=0;continue}return j(wt,String($t),dt,Bt)}dt=!1,xt=$(xt,Bt,10,wt.s),(bt=xt.indexOf("."))>-1?xt=xt.replace(".",""):bt=xt.length}for(at=0;xt.charCodeAt(at)===48;at++);for(vt=xt.length;xt.charCodeAt(--vt)===48;);if(xt=xt.slice(at,++vt)){if(vt-=at,dt&&Ct.DEBUG&&vt>15&&($t>MAX_SAFE_INTEGER$2||$t!==mathfloor($t)))throw Error(tooManyDigits+wt.s*$t);if((bt=bt-at-1)>ct)wt.c=wt.e=null;else if(bt=-MAX&&Pt<=MAX&&Pt===mathfloor(Pt)){if(Lt[0]===0){if(Pt===0&&Lt.length===1)return!0;break e}if(Bt=(Pt+1)%LOG_BASE,Bt<1&&(Bt+=LOG_BASE),String(Lt[0]).length==Bt){for(Bt=0;Bt=BASE||Nt!==mathfloor(Nt))break e;if(Nt!==0)return!0}}}else if(Lt===null&&Pt===null&&(bt===null||bt===1||bt===-1))return!0;throw Error(bignumberError+"Invalid BigNumber: "+$t)},Ct.maximum=Ct.max=function(){return zt(arguments,-1)},Ct.minimum=Ct.min=function(){return zt(arguments,1)},Ct.random=function(){var $t=9007199254740992,Bt=Math.random()*$t&2097151?function(){return mathfloor(Math.random()*$t)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(Nt){var Lt,Pt,bt,at,dt,vt=0,xt=[],wt=new Ct(tt);if(Nt==null?Nt=rt:intCheck(Nt,0,MAX),at=mathceil(Nt/LOG_BASE),ut)if(crypto.getRandomValues){for(Lt=crypto.getRandomValues(new Uint32Array(at*=2));vt>>11),dt>=9e15?(Pt=crypto.getRandomValues(new Uint32Array(2)),Lt[vt]=Pt[0],Lt[vt+1]=Pt[1]):(xt.push(dt%1e14),vt+=2);vt=at/2}else if(crypto.randomBytes){for(Lt=crypto.randomBytes(at*=7);vt=9e15?crypto.randomBytes(7).copy(Lt,vt):(xt.push(dt%1e14),vt+=7);vt=at/7}else throw ut=!1,Error(bignumberError+"crypto unavailable");if(!ut)for(;vt=10;dt/=10,vt++);vtPt-1&&(dt[at+1]==null&&(dt[at+1]=0),dt[at+1]+=dt[at]/Pt|0,dt[at]%=Pt)}return dt.reverse()}return function(Nt,Lt,Pt,bt,at){var dt,vt,xt,wt,_t,At,Tt,yt,It=Nt.indexOf("."),rr=rt,ir=nt;for(It>=0&&(wt=Et,Et=0,Nt=Nt.replace(".",""),yt=new Ct(Lt),At=yt.pow(Nt.length-It),Et=wt,yt.c=Bt(toFixedPoint(coeffToString(At.c),At.e,"0"),10,Pt,$t),yt.e=yt.c.length),Tt=Bt(Nt,Lt,Pt,at?(dt=Mt,$t):(dt=$t,Mt)),xt=wt=Tt.length;Tt[--wt]==0;Tt.pop());if(!Tt[0])return dt.charAt(0);if(It<0?--xt:(At.c=Tt,At.e=xt,At.s=bt,At=a(At,yt,rr,ir,Pt),Tt=At.c,_t=At.r,xt=At.e),vt=xt+rr+1,It=Tt[vt],wt=Pt/2,_t=_t||vt<0||Tt[vt+1]!=null,_t=ir<4?(It!=null||_t)&&(ir==0||ir==(At.s<0?3:2)):It>wt||It==wt&&(ir==4||_t||ir==6&&Tt[vt-1]&1||ir==(At.s<0?8:7)),vt<1||!Tt[0])Nt=_t?toFixedPoint(dt.charAt(1),-rr,dt.charAt(0)):dt.charAt(0);else{if(Tt.length=vt,_t)for(--Pt;++Tt[--vt]>Pt;)Tt[vt]=0,vt||(++xt,Tt=[1].concat(Tt));for(wt=Tt.length;!Tt[--wt];);for(It=0,Nt="";It<=wt;Nt+=dt.charAt(Tt[It++]));Nt=toFixedPoint(Nt,xt,dt.charAt(0))}return Nt}}(),a=function(){function $t(Lt,Pt,bt){var at,dt,vt,xt,wt=0,_t=Lt.length,At=Pt%SQRT_BASE,Tt=Pt/SQRT_BASE|0;for(Lt=Lt.slice();_t--;)vt=Lt[_t]%SQRT_BASE,xt=Lt[_t]/SQRT_BASE|0,at=Tt*vt+xt*At,dt=At*vt+at%SQRT_BASE*SQRT_BASE+wt,wt=(dt/bt|0)+(at/SQRT_BASE|0)+Tt*xt,Lt[_t]=dt%bt;return wt&&(Lt=[wt].concat(Lt)),Lt}function Bt(Lt,Pt,bt,at){var dt,vt;if(bt!=at)vt=bt>at?1:-1;else for(dt=vt=0;dtPt[dt]?1:-1;break}return vt}function Nt(Lt,Pt,bt,at){for(var dt=0;bt--;)Lt[bt]-=dt,dt=Lt[bt]1;Lt.splice(0,1));}return function(Lt,Pt,bt,at,dt){var vt,xt,wt,_t,At,Tt,yt,It,rr,ir,nr,Gt,qt,Jt,Ft,Kt,Qt,dr=Lt.s==Pt.s?1:-1,xr=Lt.c,pr=Pt.c;if(!xr||!xr[0]||!pr||!pr[0])return new Ct(!Lt.s||!Pt.s||(xr?pr&&xr[0]==pr[0]:!pr)?NaN:xr&&xr[0]==0||!pr?dr*0:dr/0);for(It=new Ct(dr),rr=It.c=[],xt=Lt.e-Pt.e,dr=bt+xt+1,dt||(dt=BASE,xt=bitFloor(Lt.e/LOG_BASE)-bitFloor(Pt.e/LOG_BASE),dr=dr/LOG_BASE|0),wt=0;pr[wt]==(xr[wt]||0);wt++);if(pr[wt]>(xr[wt]||0)&&xt--,dr<0)rr.push(1),_t=!0;else{for(Jt=xr.length,Kt=pr.length,wt=0,dr+=2,At=mathfloor(dt/(pr[0]+1)),At>1&&(pr=$t(pr,At,dt),xr=$t(xr,At,dt),Kt=pr.length,Jt=xr.length),qt=Kt,ir=xr.slice(0,Kt),nr=ir.length;nr=dt/2&&Ft++;do{if(At=0,vt=Bt(pr,ir,Kt,nr),vt<0){if(Gt=ir[0],Kt!=nr&&(Gt=Gt*dt+(ir[1]||0)),At=mathfloor(Gt/Ft),At>1)for(At>=dt&&(At=dt-1),Tt=$t(pr,At,dt),yt=Tt.length,nr=ir.length;Bt(Tt,ir,yt,nr)==1;)At--,Nt(Tt,Kt=10;dr/=10,wt++);Vt(It,bt+(It.e=wt+xt*LOG_BASE-1)+1,at,_t)}else It.e=xt,It.r=+_t;return It}}();function Ot($t,Bt,Nt,Lt){var Pt,bt,at,dt,vt;if(Nt==null?Nt=nt:intCheck(Nt,0,8),!$t.c)return $t.toString();if(Pt=$t.c[0],at=$t.e,Bt==null)vt=coeffToString($t.c),vt=Lt==1||Lt==2&&(at<=it||at>=ot)?toExponential(vt,at):toFixedPoint(vt,at,"0");else if($t=Vt(new Ct($t),Bt,Nt),bt=$t.e,vt=coeffToString($t.c),dt=vt.length,Lt==1||Lt==2&&(Bt<=bt||bt<=it)){for(;dtdt){if(--Bt>0)for(vt+=".";Bt--;vt+="0");}else if(Bt+=bt-dt,Bt>0)for(bt+1==dt&&(vt+=".");Bt--;vt+="0");return $t.s<0&&Pt?"-"+vt:vt}function zt($t,Bt){for(var Nt,Lt,Pt=1,bt=new Ct($t[0]);Pt<$t.length;Pt++)Lt=new Ct($t[Pt]),(!Lt.s||(Nt=compare$c(bt,Lt))===Bt||Nt===0&&bt.s===Bt)&&(bt=Lt);return bt}function Ut($t,Bt,Nt){for(var Lt=1,Pt=Bt.length;!Bt[--Pt];Bt.pop());for(Pt=Bt[0];Pt>=10;Pt/=10,Lt++);return(Nt=Lt+Nt*LOG_BASE-1)>ct?$t.c=$t.e=null:Nt=10;dt/=10,Pt++);if(bt=Bt-Pt,bt<0)bt+=LOG_BASE,at=Bt,vt=_t[xt=0],wt=mathfloor(vt/At[Pt-at-1]%10);else if(xt=mathceil((bt+1)/LOG_BASE),xt>=_t.length)if(Lt){for(;_t.length<=xt;_t.push(0));vt=wt=0,Pt=1,bt%=LOG_BASE,at=bt-LOG_BASE+1}else break e;else{for(vt=dt=_t[xt],Pt=1;dt>=10;dt/=10,Pt++);bt%=LOG_BASE,at=bt-LOG_BASE+Pt,wt=at<0?0:mathfloor(vt/At[Pt-at-1]%10)}if(Lt=Lt||Bt<0||_t[xt+1]!=null||(at<0?vt:vt%At[Pt-at-1]),Lt=Nt<4?(wt||Lt)&&(Nt==0||Nt==($t.s<0?3:2)):wt>5||wt==5&&(Nt==4||Lt||Nt==6&&(bt>0?at>0?vt/At[Pt-at]:0:_t[xt-1])%10&1||Nt==($t.s<0?8:7)),Bt<1||!_t[0])return _t.length=0,Lt?(Bt-=$t.e+1,_t[0]=At[(LOG_BASE-Bt%LOG_BASE)%LOG_BASE],$t.e=-Bt||0):_t[0]=$t.e=0,$t;if(bt==0?(_t.length=xt,dt=1,xt--):(_t.length=xt+1,dt=At[LOG_BASE-bt],_t[xt]=at>0?mathfloor(vt/At[Pt-at]%At[at])*dt:0),Lt)for(;;)if(xt==0){for(bt=1,at=_t[0];at>=10;at/=10,bt++);for(at=_t[0]+=dt,dt=1;at>=10;at/=10,dt++);bt!=dt&&($t.e++,_t[0]==BASE&&(_t[0]=1));break}else{if(_t[xt]+=dt,_t[xt]!=BASE)break;_t[xt--]=0,dt=1}for(bt=_t.length;_t[--bt]===0;_t.pop());}$t.e>ct?$t.c=$t.e=null:$t.e=ot?toExponential(Bt,Nt):toFixedPoint(Bt,Nt,"0"),$t.s<0?"-"+Bt:Bt)}return et.absoluteValue=et.abs=function(){var $t=new Ct(this);return $t.s<0&&($t.s=1),$t},et.comparedTo=function($t,Bt){return compare$c(this,new Ct($t,Bt))},et.decimalPlaces=et.dp=function($t,Bt){var Nt,Lt,Pt,bt=this;if($t!=null)return intCheck($t,0,MAX),Bt==null?Bt=nt:intCheck(Bt,0,8),Vt(new Ct(bt),$t+bt.e+1,Bt);if(!(Nt=bt.c))return null;if(Lt=((Pt=Nt.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,Pt=Nt[Pt])for(;Pt%10==0;Pt/=10,Lt--);return Lt<0&&(Lt=0),Lt},et.dividedBy=et.div=function($t,Bt){return a(this,new Ct($t,Bt),rt,nt)},et.dividedToIntegerBy=et.idiv=function($t,Bt){return a(this,new Ct($t,Bt),0,1)},et.exponentiatedBy=et.pow=function($t,Bt){var Nt,Lt,Pt,bt,at,dt,vt,xt,wt,_t=this;if($t=new Ct($t),$t.c&&!$t.isInteger())throw Error(bignumberError+"Exponent not an integer: "+jt($t));if(Bt!=null&&(Bt=new Ct(Bt)),dt=$t.e>14,!_t.c||!_t.c[0]||_t.c[0]==1&&!_t.e&&_t.c.length==1||!$t.c||!$t.c[0])return wt=new Ct(Math.pow(+jt(_t),dt?$t.s*(2-isOdd($t)):+jt($t))),Bt?wt.mod(Bt):wt;if(vt=$t.s<0,Bt){if(Bt.c?!Bt.c[0]:!Bt.s)return new Ct(NaN);Lt=!vt&&_t.isInteger()&&Bt.isInteger(),Lt&&(_t=_t.mod(Bt))}else{if($t.e>9&&(_t.e>0||_t.e<-1||(_t.e==0?_t.c[0]>1||dt&&_t.c[1]>=24e7:_t.c[0]<8e13||dt&&_t.c[0]<=9999975e7)))return bt=_t.s<0&&isOdd($t)?-0:0,_t.e>-1&&(bt=1/bt),new Ct(vt?1/bt:bt);Et&&(bt=mathceil(Et/LOG_BASE+2))}for(dt?(Nt=new Ct(.5),vt&&($t.s=1),xt=isOdd($t)):(Pt=Math.abs(+jt($t)),xt=Pt%2),wt=new Ct(tt);;){if(xt){if(wt=wt.times(_t),!wt.c)break;bt?wt.c.length>bt&&(wt.c.length=bt):Lt&&(wt=wt.mod(Bt))}if(Pt){if(Pt=mathfloor(Pt/2),Pt===0)break;xt=Pt%2}else if($t=$t.times(Nt),Vt($t,$t.e+1,1),$t.e>14)xt=isOdd($t);else{if(Pt=+jt($t),Pt===0)break;xt=Pt%2}_t=_t.times(_t),bt?_t.c&&_t.c.length>bt&&(_t.c.length=bt):Lt&&(_t=_t.mod(Bt))}return Lt?wt:(vt&&(wt=tt.div(wt)),Bt?wt.mod(Bt):bt?Vt(wt,Et,nt,at):wt)},et.integerValue=function($t){var Bt=new Ct(this);return $t==null?$t=nt:intCheck($t,0,8),Vt(Bt,Bt.e+1,$t)},et.isEqualTo=et.eq=function($t,Bt){return compare$c(this,new Ct($t,Bt))===0},et.isFinite=function(){return!!this.c},et.isGreaterThan=et.gt=function($t,Bt){return compare$c(this,new Ct($t,Bt))>0},et.isGreaterThanOrEqualTo=et.gte=function($t,Bt){return(Bt=compare$c(this,new Ct($t,Bt)))===1||Bt===0},et.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},et.isLessThan=et.lt=function($t,Bt){return compare$c(this,new Ct($t,Bt))<0},et.isLessThanOrEqualTo=et.lte=function($t,Bt){return(Bt=compare$c(this,new Ct($t,Bt)))===-1||Bt===0},et.isNaN=function(){return!this.s},et.isNegative=function(){return this.s<0},et.isPositive=function(){return this.s>0},et.isZero=function(){return!!this.c&&this.c[0]==0},et.minus=function($t,Bt){var Nt,Lt,Pt,bt,at=this,dt=at.s;if($t=new Ct($t,Bt),Bt=$t.s,!dt||!Bt)return new Ct(NaN);if(dt!=Bt)return $t.s=-Bt,at.plus($t);var vt=at.e/LOG_BASE,xt=$t.e/LOG_BASE,wt=at.c,_t=$t.c;if(!vt||!xt){if(!wt||!_t)return wt?($t.s=-Bt,$t):new Ct(_t?at:NaN);if(!wt[0]||!_t[0])return _t[0]?($t.s=-Bt,$t):new Ct(wt[0]?at:nt==3?-0:0)}if(vt=bitFloor(vt),xt=bitFloor(xt),wt=wt.slice(),dt=vt-xt){for((bt=dt<0)?(dt=-dt,Pt=wt):(xt=vt,Pt=_t),Pt.reverse(),Bt=dt;Bt--;Pt.push(0));Pt.reverse()}else for(Lt=(bt=(dt=wt.length)<(Bt=_t.length))?dt:Bt,dt=Bt=0;Bt0)for(;Bt--;wt[Nt++]=0);for(Bt=BASE-1;Lt>dt;){if(wt[--Lt]<_t[Lt]){for(Nt=Lt;Nt&&!wt[--Nt];wt[Nt]=Bt);--wt[Nt],wt[Lt]+=BASE}wt[Lt]-=_t[Lt]}for(;wt[0]==0;wt.splice(0,1),--xt);return wt[0]?Ut($t,wt,xt):($t.s=nt==3?-1:1,$t.c=[$t.e=0],$t)},et.modulo=et.mod=function($t,Bt){var Nt,Lt,Pt=this;return $t=new Ct($t,Bt),!Pt.c||!$t.s||$t.c&&!$t.c[0]?new Ct(NaN):!$t.c||Pt.c&&!Pt.c[0]?new Ct(Pt):(ht==9?(Lt=$t.s,$t.s=1,Nt=a(Pt,$t,0,3),$t.s=Lt,Nt.s*=Lt):Nt=a(Pt,$t,0,ht),$t=Pt.minus(Nt.times($t)),!$t.c[0]&&ht==1&&($t.s=Pt.s),$t)},et.multipliedBy=et.times=function($t,Bt){var Nt,Lt,Pt,bt,at,dt,vt,xt,wt,_t,At,Tt,yt,It,rr,ir=this,nr=ir.c,Gt=($t=new Ct($t,Bt)).c;if(!nr||!Gt||!nr[0]||!Gt[0])return!ir.s||!$t.s||nr&&!nr[0]&&!Gt||Gt&&!Gt[0]&&!nr?$t.c=$t.e=$t.s=null:($t.s*=ir.s,!nr||!Gt?$t.c=$t.e=null:($t.c=[0],$t.e=0)),$t;for(Lt=bitFloor(ir.e/LOG_BASE)+bitFloor($t.e/LOG_BASE),$t.s*=ir.s,vt=nr.length,_t=Gt.length,vt<_t&&(yt=nr,nr=Gt,Gt=yt,Pt=vt,vt=_t,_t=Pt),Pt=vt+_t,yt=[];Pt--;yt.push(0));for(It=BASE,rr=SQRT_BASE,Pt=_t;--Pt>=0;){for(Nt=0,At=Gt[Pt]%rr,Tt=Gt[Pt]/rr|0,at=vt,bt=Pt+at;bt>Pt;)xt=nr[--at]%rr,wt=nr[at]/rr|0,dt=Tt*xt+wt*At,xt=At*xt+dt%rr*rr+yt[bt]+Nt,Nt=(xt/It|0)+(dt/rr|0)+Tt*wt,yt[bt--]=xt%It;yt[bt]=Nt}return Nt?++Lt:yt.splice(0,1),Ut($t,yt,Lt)},et.negated=function(){var $t=new Ct(this);return $t.s=-$t.s||null,$t},et.plus=function($t,Bt){var Nt,Lt=this,Pt=Lt.s;if($t=new Ct($t,Bt),Bt=$t.s,!Pt||!Bt)return new Ct(NaN);if(Pt!=Bt)return $t.s=-Bt,Lt.minus($t);var bt=Lt.e/LOG_BASE,at=$t.e/LOG_BASE,dt=Lt.c,vt=$t.c;if(!bt||!at){if(!dt||!vt)return new Ct(Pt/0);if(!dt[0]||!vt[0])return vt[0]?$t:new Ct(dt[0]?Lt:Pt*0)}if(bt=bitFloor(bt),at=bitFloor(at),dt=dt.slice(),Pt=bt-at){for(Pt>0?(at=bt,Nt=vt):(Pt=-Pt,Nt=dt),Nt.reverse();Pt--;Nt.push(0));Nt.reverse()}for(Pt=dt.length,Bt=vt.length,Pt-Bt<0&&(Nt=vt,vt=dt,dt=Nt,Bt=Pt),Pt=0;Bt;)Pt=(dt[--Bt]=dt[Bt]+vt[Bt]+Pt)/BASE|0,dt[Bt]=BASE===dt[Bt]?0:dt[Bt]%BASE;return Pt&&(dt=[Pt].concat(dt),++at),Ut($t,dt,at)},et.precision=et.sd=function($t,Bt){var Nt,Lt,Pt,bt=this;if($t!=null&&$t!==!!$t)return intCheck($t,1,MAX),Bt==null?Bt=nt:intCheck(Bt,0,8),Vt(new Ct(bt),$t,Bt);if(!(Nt=bt.c))return null;if(Pt=Nt.length-1,Lt=Pt*LOG_BASE+1,Pt=Nt[Pt]){for(;Pt%10==0;Pt/=10,Lt--);for(Pt=Nt[0];Pt>=10;Pt/=10,Lt++);}return $t&&bt.e+1>Lt&&(Lt=bt.e+1),Lt},et.shiftedBy=function($t){return intCheck($t,-MAX_SAFE_INTEGER$2,MAX_SAFE_INTEGER$2),this.times("1e"+$t)},et.squareRoot=et.sqrt=function(){var $t,Bt,Nt,Lt,Pt,bt=this,at=bt.c,dt=bt.s,vt=bt.e,xt=rt+4,wt=new Ct("0.5");if(dt!==1||!at||!at[0])return new Ct(!dt||dt<0&&(!at||at[0])?NaN:at?bt:1/0);if(dt=Math.sqrt(+jt(bt)),dt==0||dt==1/0?(Bt=coeffToString(at),(Bt.length+vt)%2==0&&(Bt+="0"),dt=Math.sqrt(+Bt),vt=bitFloor((vt+1)/2)-(vt<0||vt%2),dt==1/0?Bt="5e"+vt:(Bt=dt.toExponential(),Bt=Bt.slice(0,Bt.indexOf("e")+1)+vt),Nt=new Ct(Bt)):Nt=new Ct(dt+""),Nt.c[0]){for(vt=Nt.e,dt=vt+xt,dt<3&&(dt=0);;)if(Pt=Nt,Nt=wt.times(Pt.plus(a(bt,Pt,xt,1))),coeffToString(Pt.c).slice(0,dt)===(Bt=coeffToString(Nt.c)).slice(0,dt))if(Nt.e0&&yt>0){for(bt=yt%dt||dt,wt=Tt.substr(0,bt);bt0&&(wt+=xt+Tt.slice(bt)),At&&(wt="-"+wt)}Lt=_t?wt+(Nt.decimalSeparator||"")+((vt=+Nt.fractionGroupSize)?_t.replace(new RegExp("\\d{"+vt+"}\\B","g"),"$&"+(Nt.fractionGroupSeparator||"")):_t):wt}return(Nt.prefix||"")+Lt+(Nt.suffix||"")},et.toFraction=function($t){var Bt,Nt,Lt,Pt,bt,at,dt,vt,xt,wt,_t,At,Tt=this,yt=Tt.c;if($t!=null&&(dt=new Ct($t),!dt.isInteger()&&(dt.c||dt.s!==1)||dt.lt(tt)))throw Error(bignumberError+"Argument "+(dt.isInteger()?"out of range: ":"not an integer: ")+jt(dt));if(!yt)return new Ct(Tt);for(Bt=new Ct(tt),xt=Nt=new Ct(tt),Lt=vt=new Ct(tt),At=coeffToString(yt),bt=Bt.e=At.length-Tt.e-1,Bt.c[0]=POWS_TEN[(at=bt%LOG_BASE)<0?LOG_BASE+at:at],$t=!$t||dt.comparedTo(Bt)>0?bt>0?Bt:xt:dt,at=ct,ct=1/0,dt=new Ct(At),vt.c[0]=0;wt=a(dt,Bt,0,1),Pt=Nt.plus(wt.times(Lt)),Pt.comparedTo($t)!=1;)Nt=Lt,Lt=Pt,xt=vt.plus(wt.times(Pt=xt)),vt=Pt,Bt=dt.minus(wt.times(Pt=Bt)),dt=Pt;return Pt=a($t.minus(Nt),Lt,0,1),vt=vt.plus(Pt.times(xt)),Nt=Nt.plus(Pt.times(Lt)),vt.s=xt.s=Tt.s,bt=bt*2,_t=a(xt,Lt,bt,nt).minus(Tt).abs().comparedTo(a(vt,Nt,bt,nt).minus(Tt).abs())<1?[xt,Lt]:[vt,Nt],ct=at,_t},et.toNumber=function(){return+jt(this)},et.toPrecision=function($t,Bt){return $t!=null&&intCheck($t,1,MAX),Ot(this,$t,Bt,2)},et.toString=function($t){var Bt,Nt=this,Lt=Nt.s,Pt=Nt.e;return Pt===null?Lt?(Bt="Infinity",Lt<0&&(Bt="-"+Bt)):Bt="NaN":($t==null?Bt=Pt<=it||Pt>=ot?toExponential(coeffToString(Nt.c),Pt):toFixedPoint(coeffToString(Nt.c),Pt,"0"):$t===10&&kt?(Nt=Vt(new Ct(Nt),rt+Pt+1,nt),Bt=toFixedPoint(coeffToString(Nt.c),Nt.e,"0")):(intCheck($t,2,Mt.length,"Base"),Bt=$(toFixedPoint(coeffToString(Nt.c),Pt,"0"),10,$t,Lt,!0)),Lt<0&&Nt.c[0]&&(Bt="-"+Bt)),Bt},et.valueOf=et.toJSON=function(){return jt(this)},et._isBigNumber=!0,et[Symbol.toStringTag]="BigNumber",et[Symbol.for("nodejs.util.inspect.custom")]=et.valueOf,_!=null&&Ct.set(_),Ct}function bitFloor(_){var a=_|0;return _>0||_===a?a:a-1}function coeffToString(_){for(var a,$,j=1,et=_.length,tt=_[0]+"";jot^$?1:-1;for(nt=(it=et.length)<(ot=tt.length)?it:ot,rt=0;rttt[rt]^$?1:-1;return it==ot?0:it>ot^$?1:-1}function intCheck(_,a,$,j){if(_$||_!==mathfloor(_))throw Error(bignumberError+(j||"Argument")+(typeof _=="number"?_$?" out of range: ":" not an integer: ":" not a primitive number: ")+String(_))}function isOdd(_){var a=_.c.length-1;return bitFloor(_.e/LOG_BASE)==a&&_.c[a]%2!=0}function toExponential(_,a){return(_.length>1?_.charAt(0)+"."+_.slice(1):_)+(a<0?"e":"e+")+a}function toFixedPoint(_,a,$){var j,et;if(a<0){for(et=$+".";++a;et+=$);_=et+_}else if(j=_.length,++a>j){for(et=$,a-=j;--a;et+=$);_+=et}else abs58check$1.decode(_).slice(a.length);function b58decode(_){const a=bs58check$1.decode(_),j={[prefix.tz1.toString()]:"0000",[prefix.tz2.toString()]:"0001",[prefix.tz3.toString()]:"0002"}[new Uint8Array(a.slice(0,3)).toString()];if(j){const et=buf2hex(a.slice(3));return j+et}else return"01"+buf2hex(a.slice(3,42))+"00"}function encodeAddress(_){if(_.substring(0,2)==="0x"&&(_=_.slice(2)),_.substring(0,2)==="00"){const a={"0000":prefix.tz1,"0001":prefix.tz2,"0002":prefix.tz3};return b58cencode(_.substring(4),a[_.substring(0,4)])}return b58cencode(_.substring(2,42),prefix.KT)}function encodeKey(_){if(_[0]==="0"){const a={"00":new Uint8Array([13,15,37,217]),"01":new Uint8Array([3,254,226,86]),"02":new Uint8Array([3,178,139,127])};return b58cencode(_.substring(2),a[_.substring(0,2)])}}function encodeKeyHash(_){if(_[0]==="0"){const a={"00":new Uint8Array([6,161,159]),"01":new Uint8Array([6,161,161]),"02":new Uint8Array([6,161,164])};return b58cencode(_.substring(2),a[_.substring(0,2)])}}const hex2buf=_=>{if(_.length%2!==0)throw new InvalidHexStringError(_,": Expecting even number of characters");const a=stripHexPrefix$1(_);if(!a.match(/^([\da-f]{2})*$/gi))throw new InvalidHexStringError(_,": Only characters 0-9, a-f and A-F are expected. Optionally, it can be prefixed with '0x'");const $=new Uint8Array(a.length/2);let j=0;for(let et=0;et{const $=new Uint8Array(_.length+a.length);return $.set(_),$.set(a,_.length),$},buf2hex=_=>{const a=[];return _.forEach($=>{const et=`00${$.toString(16)}`.slice(-2);a.push(et)}),a.join("")};function hex2Bytes(_){const a=stripHexPrefix$1(_);if(!a.match(/^(0x)?([\da-f]{2})*$/gi))throw new InvalidHexStringError(_,": Expecting even number of characters: 0-9, a-z, A-Z, optionally prefixed with 0x");return buffer$1.Buffer.from(a,"hex")}function stripHexPrefix$1(_){return _.startsWith("0x")?_.slice(2):_}var util;(function(_){_.assertEqual=et=>et;function a(et){}_.assertIs=a;function $(et){throw new Error}_.assertNever=$,_.arrayToEnum=et=>{const tt={};for(const rt of et)tt[rt]=rt;return tt},_.getValidEnumValues=et=>{const tt=_.objectKeys(et).filter(nt=>typeof et[et[nt]]!="number"),rt={};for(const nt of tt)rt[nt]=et[nt];return _.objectValues(rt)},_.objectValues=et=>_.objectKeys(et).map(function(tt){return et[tt]}),_.objectKeys=typeof Object.keys=="function"?et=>Object.keys(et):et=>{const tt=[];for(const rt in et)Object.prototype.hasOwnProperty.call(et,rt)&&tt.push(rt);return tt},_.find=(et,tt)=>{for(const rt of et)if(tt(rt))return rt},_.isInteger=typeof Number.isInteger=="function"?et=>Number.isInteger(et):et=>typeof et=="number"&&isFinite(et)&&Math.floor(et)===et;function j(et,tt=" | "){return et.map(rt=>typeof rt=="string"?`'${rt}'`:rt).join(tt)}_.joinValues=j,_.jsonStringifyReplacer=(et,tt)=>typeof tt=="bigint"?tt.toString():tt})(util||(util={}));var objectUtil;(function(_){_.mergeShapes=(a,$)=>({...a,...$})})(objectUtil||(objectUtil={}));const ZodParsedType=util.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=_=>{switch(typeof _){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(_)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(_)?ZodParsedType.array:_===null?ZodParsedType.null:_.then&&typeof _.then=="function"&&_.catch&&typeof _.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&_ instanceof Map?ZodParsedType.map:typeof Set<"u"&&_ instanceof Set?ZodParsedType.set:typeof Date<"u"&&_ instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=_=>JSON.stringify(_,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(a){super(),this.issues=[],this.addIssue=j=>{this.issues=[...this.issues,j]},this.addIssues=(j=[])=>{this.issues=[...this.issues,...j]};const $=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,$):this.__proto__=$,this.name="ZodError",this.issues=a}get errors(){return this.issues}format(a){const $=a||function(tt){return tt.message},j={_errors:[]},et=tt=>{for(const rt of tt.issues)if(rt.code==="invalid_union")rt.unionErrors.map(et);else if(rt.code==="invalid_return_type")et(rt.returnTypeError);else if(rt.code==="invalid_arguments")et(rt.argumentsError);else if(rt.path.length===0)j._errors.push($(rt));else{let nt=j,it=0;for(;it$.message){const $={},j=[];for(const et of this.issues)et.path.length>0?($[et.path[0]]=$[et.path[0]]||[],$[et.path[0]].push(a(et))):j.push(a(et));return{formErrors:j,fieldErrors:$}}get formErrors(){return this.flatten()}}ZodError.create=_=>new ZodError(_);const errorMap=(_,a)=>{let $;switch(_.code){case ZodIssueCode.invalid_type:_.received===ZodParsedType.undefined?$="Required":$=`Expected ${_.expected}, received ${_.received}`;break;case ZodIssueCode.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(_.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:$=`Unrecognized key(s) in object: ${util.joinValues(_.keys,", ")}`;break;case ZodIssueCode.invalid_union:$="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${util.joinValues(_.options)}`;break;case ZodIssueCode.invalid_enum_value:$=`Invalid enum value. Expected ${util.joinValues(_.options)}, received '${_.received}'`;break;case ZodIssueCode.invalid_arguments:$="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:$="Invalid function return type";break;case ZodIssueCode.invalid_date:$="Invalid date";break;case ZodIssueCode.invalid_string:typeof _.validation=="object"?"includes"in _.validation?($=`Invalid input: must include "${_.validation.includes}"`,typeof _.validation.position=="number"&&($=`${$} at one or more positions greater than or equal to ${_.validation.position}`)):"startsWith"in _.validation?$=`Invalid input: must start with "${_.validation.startsWith}"`:"endsWith"in _.validation?$=`Invalid input: must end with "${_.validation.endsWith}"`:util.assertNever(_.validation):_.validation!=="regex"?$=`Invalid ${_.validation}`:$="Invalid";break;case ZodIssueCode.too_small:_.type==="array"?$=`Array must contain ${_.exact?"exactly":_.inclusive?"at least":"more than"} ${_.minimum} element(s)`:_.type==="string"?$=`String must contain ${_.exact?"exactly":_.inclusive?"at least":"over"} ${_.minimum} character(s)`:_.type==="number"?$=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`:_.type==="date"?$=`Date must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(_.minimum))}`:$="Invalid input";break;case ZodIssueCode.too_big:_.type==="array"?$=`Array must contain ${_.exact?"exactly":_.inclusive?"at most":"less than"} ${_.maximum} element(s)`:_.type==="string"?$=`String must contain ${_.exact?"exactly":_.inclusive?"at most":"under"} ${_.maximum} character(s)`:_.type==="number"?$=`Number must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="bigint"?$=`BigInt must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="date"?$=`Date must be ${_.exact?"exactly":_.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(_.maximum))}`:$="Invalid input";break;case ZodIssueCode.custom:$="Invalid input";break;case ZodIssueCode.invalid_intersection_types:$="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:$=`Number must be a multiple of ${_.multipleOf}`;break;case ZodIssueCode.not_finite:$="Number must be finite";break;default:$=a.defaultError,util.assertNever(_)}return{message:$}};let overrideErrorMap=errorMap;function setErrorMap(_){overrideErrorMap=_}function getErrorMap(){return overrideErrorMap}const makeIssue=_=>{const{data:a,path:$,errorMaps:j,issueData:et}=_,tt=[...$,...et.path||[]],rt={...et,path:tt};if(et.message!==void 0)return{...et,path:tt,message:et.message};let nt="";const it=j.filter(ot=>!!ot).slice().reverse();for(const ot of it)nt=ot(rt,{data:a,defaultError:nt}).message;return{...et,path:tt,message:nt}},EMPTY_PATH=[];function addIssueToContext(_,a){const $=getErrorMap(),j=makeIssue({issueData:a,data:_.data,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,$,$===errorMap?void 0:errorMap].filter(et=>!!et)});_.common.issues.push(j)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(a,$){const j=[];for(const et of $){if(et.status==="aborted")return INVALID;et.status==="dirty"&&a.dirty(),j.push(et.value)}return{status:a.value,value:j}}static async mergeObjectAsync(a,$){const j=[];for(const et of $){const tt=await et.key,rt=await et.value;j.push({key:tt,value:rt})}return ParseStatus.mergeObjectSync(a,j)}static mergeObjectSync(a,$){const j={};for(const et of $){const{key:tt,value:rt}=et;if(tt.status==="aborted"||rt.status==="aborted")return INVALID;tt.status==="dirty"&&a.dirty(),rt.status==="dirty"&&a.dirty(),tt.value!=="__proto__"&&(typeof rt.value<"u"||et.alwaysSet)&&(j[tt.value]=rt.value)}return{status:a.value,value:j}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=_=>({status:"dirty",value:_}),OK=_=>({status:"valid",value:_}),isAborted=_=>_.status==="aborted",isDirty=_=>_.status==="dirty",isValid$1=_=>_.status==="valid",isAsync=_=>typeof Promise<"u"&&_ instanceof Promise;function __classPrivateFieldGet$1(_,a,$,j){if(typeof a=="function"?_!==a||!j:!a.has(_))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a.get(_)}function __classPrivateFieldSet$1(_,a,$,j,et){if(typeof a=="function"?_!==a||!et:!a.has(_))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a.set(_,$),$}typeof SuppressedError=="function"&&SuppressedError;var errorUtil;(function(_){_.errToObj=a=>typeof a=="string"?{message:a}:a||{},_.toString=a=>typeof a=="string"?a:a==null?void 0:a.message})(errorUtil||(errorUtil={}));var _ZodEnum_cache,_ZodNativeEnum_cache;class ParseInputLazyPath{constructor(a,$,j,et){this._cachedPath=[],this.parent=a,this.data=$,this._path=j,this._key=et}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(_,a)=>{if(isValid$1(a))return{success:!0,data:a.value};if(!_.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const $=new ZodError(_.common.issues);return this._error=$,this._error}}};function processCreateParams(_){if(!_)return{};const{errorMap:a,invalid_type_error:$,required_error:j,description:et}=_;if(a&&($||j))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return a?{errorMap:a,description:et}:{errorMap:(rt,nt)=>{var it,ot;const{message:st}=_;return rt.code==="invalid_enum_value"?{message:st??nt.defaultError}:typeof nt.data>"u"?{message:(it=st??j)!==null&&it!==void 0?it:nt.defaultError}:rt.code!=="invalid_type"?{message:nt.defaultError}:{message:(ot=st??$)!==null&&ot!==void 0?ot:nt.defaultError}},description:et}}class ZodType{constructor(a){this.spa=this.safeParseAsync,this._def=a,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(a){return getParsedType(a.data)}_getOrReturnCtx(a,$){return $||{common:a.parent.common,data:a.data,parsedType:getParsedType(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}_processInputParams(a){return{status:new ParseStatus,ctx:{common:a.parent.common,data:a.data,parsedType:getParsedType(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}}_parseSync(a){const $=this._parse(a);if(isAsync($))throw new Error("Synchronous parse encountered promise.");return $}_parseAsync(a){const $=this._parse(a);return Promise.resolve($)}parse(a,$){const j=this.safeParse(a,$);if(j.success)return j.data;throw j.error}safeParse(a,$){var j;const et={common:{issues:[],async:(j=$==null?void 0:$.async)!==null&&j!==void 0?j:!1,contextualErrorMap:$==null?void 0:$.errorMap},path:($==null?void 0:$.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:getParsedType(a)},tt=this._parseSync({data:a,path:et.path,parent:et});return handleResult(et,tt)}async parseAsync(a,$){const j=await this.safeParseAsync(a,$);if(j.success)return j.data;throw j.error}async safeParseAsync(a,$){const j={common:{issues:[],contextualErrorMap:$==null?void 0:$.errorMap,async:!0},path:($==null?void 0:$.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:getParsedType(a)},et=this._parse({data:a,path:j.path,parent:j}),tt=await(isAsync(et)?et:Promise.resolve(et));return handleResult(j,tt)}refine(a,$){const j=et=>typeof $=="string"||typeof $>"u"?{message:$}:typeof $=="function"?$(et):$;return this._refinement((et,tt)=>{const rt=a(et),nt=()=>tt.addIssue({code:ZodIssueCode.custom,...j(et)});return typeof Promise<"u"&&rt instanceof Promise?rt.then(it=>it?!0:(nt(),!1)):rt?!0:(nt(),!1)})}refinement(a,$){return this._refinement((j,et)=>a(j)?!0:(et.addIssue(typeof $=="function"?$(j,et):$),!1))}_refinement(a){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:a}})}superRefine(a){return this._refinement(a)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(a){return ZodUnion.create([this,a],this._def)}and(a){return ZodIntersection.create(this,a,this._def)}transform(a){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:a}})}default(a){const $=typeof a=="function"?a:()=>a;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:$,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(a){const $=typeof a=="function"?a:()=>a;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:$,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(a){const $=this.constructor;return new $({...this._def,description:a})}pipe(a){return ZodPipeline.create(this,a)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(_){let a="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return _.precision?a=`${a}\\.\\d{${_.precision}}`:_.precision==null&&(a=`${a}(\\.\\d+)?`),a}function timeRegex(_){return new RegExp(`^${timeRegexSource(_)}$`)}function datetimeRegex(_){let a=`${dateRegexSource}T${timeRegexSource(_)}`;const $=[];return $.push(_.local?"Z?":"Z"),_.offset&&$.push("([+-]\\d{2}:?\\d{2})"),a=`${a}(${$.join("|")})`,new RegExp(`^${a}$`)}function isValidIP(_,a){return!!((a==="v4"||!a)&&ipv4Regex.test(_)||(a==="v6"||!a)&&ipv6Regex.test(_))}class ZodString extends ZodType{_parse(a){if(this._def.coerce&&(a.data=String(a.data)),this._getType(a)!==ZodParsedType.string){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:tt.parsedType}),INVALID}const j=new ParseStatus;let et;for(const tt of this._def.checks)if(tt.kind==="min")a.data.lengthtt.value&&(et=this._getOrReturnCtx(a,et),addIssueToContext(et,{code:ZodIssueCode.too_big,maximum:tt.value,type:"string",inclusive:!0,exact:!1,message:tt.message}),j.dirty());else if(tt.kind==="length"){const rt=a.data.length>tt.value,nt=a.data.lengtha.test(et),{validation:$,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(j)})}_addCheck(a){return new ZodString({...this._def,checks:[...this._def.checks,a]})}email(a){return this._addCheck({kind:"email",...errorUtil.errToObj(a)})}url(a){return this._addCheck({kind:"url",...errorUtil.errToObj(a)})}emoji(a){return this._addCheck({kind:"emoji",...errorUtil.errToObj(a)})}uuid(a){return this._addCheck({kind:"uuid",...errorUtil.errToObj(a)})}nanoid(a){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(a)})}cuid(a){return this._addCheck({kind:"cuid",...errorUtil.errToObj(a)})}cuid2(a){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(a)})}ulid(a){return this._addCheck({kind:"ulid",...errorUtil.errToObj(a)})}base64(a){return this._addCheck({kind:"base64",...errorUtil.errToObj(a)})}ip(a){return this._addCheck({kind:"ip",...errorUtil.errToObj(a)})}datetime(a){var $,j;return typeof a=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:a}):this._addCheck({kind:"datetime",precision:typeof(a==null?void 0:a.precision)>"u"?null:a==null?void 0:a.precision,offset:($=a==null?void 0:a.offset)!==null&&$!==void 0?$:!1,local:(j=a==null?void 0:a.local)!==null&&j!==void 0?j:!1,...errorUtil.errToObj(a==null?void 0:a.message)})}date(a){return this._addCheck({kind:"date",message:a})}time(a){return typeof a=="string"?this._addCheck({kind:"time",precision:null,message:a}):this._addCheck({kind:"time",precision:typeof(a==null?void 0:a.precision)>"u"?null:a==null?void 0:a.precision,...errorUtil.errToObj(a==null?void 0:a.message)})}duration(a){return this._addCheck({kind:"duration",...errorUtil.errToObj(a)})}regex(a,$){return this._addCheck({kind:"regex",regex:a,...errorUtil.errToObj($)})}includes(a,$){return this._addCheck({kind:"includes",value:a,position:$==null?void 0:$.position,...errorUtil.errToObj($==null?void 0:$.message)})}startsWith(a,$){return this._addCheck({kind:"startsWith",value:a,...errorUtil.errToObj($)})}endsWith(a,$){return this._addCheck({kind:"endsWith",value:a,...errorUtil.errToObj($)})}min(a,$){return this._addCheck({kind:"min",value:a,...errorUtil.errToObj($)})}max(a,$){return this._addCheck({kind:"max",value:a,...errorUtil.errToObj($)})}length(a,$){return this._addCheck({kind:"length",value:a,...errorUtil.errToObj($)})}nonempty(a){return this.min(1,errorUtil.errToObj(a))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(a=>a.kind==="datetime")}get isDate(){return!!this._def.checks.find(a=>a.kind==="date")}get isTime(){return!!this._def.checks.find(a=>a.kind==="time")}get isDuration(){return!!this._def.checks.find(a=>a.kind==="duration")}get isEmail(){return!!this._def.checks.find(a=>a.kind==="email")}get isURL(){return!!this._def.checks.find(a=>a.kind==="url")}get isEmoji(){return!!this._def.checks.find(a=>a.kind==="emoji")}get isUUID(){return!!this._def.checks.find(a=>a.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(a=>a.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(a=>a.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(a=>a.kind==="cuid2")}get isULID(){return!!this._def.checks.find(a=>a.kind==="ulid")}get isIP(){return!!this._def.checks.find(a=>a.kind==="ip")}get isBase64(){return!!this._def.checks.find(a=>a.kind==="base64")}get minLength(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a}get maxLength(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.value{var a;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(a=_==null?void 0:_.coerce)!==null&&a!==void 0?a:!1,...processCreateParams(_)})};function floatSafeRemainder(_,a){const $=(_.toString().split(".")[1]||"").length,j=(a.toString().split(".")[1]||"").length,et=$>j?$:j,tt=parseInt(_.toFixed(et).replace(".","")),rt=parseInt(a.toFixed(et).replace(".",""));return tt%rt/Math.pow(10,et)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(a){if(this._def.coerce&&(a.data=Number(a.data)),this._getType(a)!==ZodParsedType.number){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:tt.parsedType}),INVALID}let j;const et=new ParseStatus;for(const tt of this._def.checks)tt.kind==="int"?util.isInteger(a.data)||(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:tt.message}),et.dirty()):tt.kind==="min"?(tt.inclusive?a.datatt.value:a.data>=tt.value)&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.too_big,maximum:tt.value,type:"number",inclusive:tt.inclusive,exact:!1,message:tt.message}),et.dirty()):tt.kind==="multipleOf"?floatSafeRemainder(a.data,tt.value)!==0&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.not_multiple_of,multipleOf:tt.value,message:tt.message}),et.dirty()):tt.kind==="finite"?Number.isFinite(a.data)||(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.not_finite,message:tt.message}),et.dirty()):util.assertNever(tt);return{status:et.value,value:a.data}}gte(a,$){return this.setLimit("min",a,!0,errorUtil.toString($))}gt(a,$){return this.setLimit("min",a,!1,errorUtil.toString($))}lte(a,$){return this.setLimit("max",a,!0,errorUtil.toString($))}lt(a,$){return this.setLimit("max",a,!1,errorUtil.toString($))}setLimit(a,$,j,et){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:a,value:$,inclusive:j,message:errorUtil.toString(et)}]})}_addCheck(a){return new ZodNumber({...this._def,checks:[...this._def.checks,a]})}int(a){return this._addCheck({kind:"int",message:errorUtil.toString(a)})}positive(a){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(a)})}negative(a){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(a)})}multipleOf(a,$){return this._addCheck({kind:"multipleOf",value:a,message:errorUtil.toString($)})}finite(a){return this._addCheck({kind:"finite",message:errorUtil.toString(a)})}safe(a){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(a)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(a)})}get minValue(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a}get maxValue(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.valuea.kind==="int"||a.kind==="multipleOf"&&util.isInteger(a.value))}get isFinite(){let a=null,$=null;for(const j of this._def.checks){if(j.kind==="finite"||j.kind==="int"||j.kind==="multipleOf")return!0;j.kind==="min"?($===null||j.value>$)&&($=j.value):j.kind==="max"&&(a===null||j.valuenew ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(_==null?void 0:_.coerce)||!1,...processCreateParams(_)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(a){if(this._def.coerce&&(a.data=BigInt(a.data)),this._getType(a)!==ZodParsedType.bigint){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:tt.parsedType}),INVALID}let j;const et=new ParseStatus;for(const tt of this._def.checks)tt.kind==="min"?(tt.inclusive?a.datatt.value:a.data>=tt.value)&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.too_big,type:"bigint",maximum:tt.value,inclusive:tt.inclusive,message:tt.message}),et.dirty()):tt.kind==="multipleOf"?a.data%tt.value!==BigInt(0)&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.not_multiple_of,multipleOf:tt.value,message:tt.message}),et.dirty()):util.assertNever(tt);return{status:et.value,value:a.data}}gte(a,$){return this.setLimit("min",a,!0,errorUtil.toString($))}gt(a,$){return this.setLimit("min",a,!1,errorUtil.toString($))}lte(a,$){return this.setLimit("max",a,!0,errorUtil.toString($))}lt(a,$){return this.setLimit("max",a,!1,errorUtil.toString($))}setLimit(a,$,j,et){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:a,value:$,inclusive:j,message:errorUtil.toString(et)}]})}_addCheck(a){return new ZodBigInt({...this._def,checks:[...this._def.checks,a]})}positive(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(a)})}negative(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(a)})}multipleOf(a,$){return this._addCheck({kind:"multipleOf",value:a,message:errorUtil.toString($)})}get minValue(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a}get maxValue(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.value{var a;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(a=_==null?void 0:_.coerce)!==null&&a!==void 0?a:!1,...processCreateParams(_)})};class ZodBoolean extends ZodType{_parse(a){if(this._def.coerce&&(a.data=!!a.data),this._getType(a)!==ZodParsedType.boolean){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:j.parsedType}),INVALID}return OK(a.data)}}ZodBoolean.create=_=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(_==null?void 0:_.coerce)||!1,...processCreateParams(_)});class ZodDate extends ZodType{_parse(a){if(this._def.coerce&&(a.data=new Date(a.data)),this._getType(a)!==ZodParsedType.date){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:tt.parsedType}),INVALID}if(isNaN(a.data.getTime())){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_date}),INVALID}const j=new ParseStatus;let et;for(const tt of this._def.checks)tt.kind==="min"?a.data.getTime()tt.value&&(et=this._getOrReturnCtx(a,et),addIssueToContext(et,{code:ZodIssueCode.too_big,message:tt.message,inclusive:!0,exact:!1,maximum:tt.value,type:"date"}),j.dirty()):util.assertNever(tt);return{status:j.value,value:new Date(a.data.getTime())}}_addCheck(a){return new ZodDate({...this._def,checks:[...this._def.checks,a]})}min(a,$){return this._addCheck({kind:"min",value:a.getTime(),message:errorUtil.toString($)})}max(a,$){return this._addCheck({kind:"max",value:a.getTime(),message:errorUtil.toString($)})}get minDate(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a!=null?new Date(a):null}get maxDate(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.valuenew ZodDate({checks:[],coerce:(_==null?void 0:_.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(_)});class ZodSymbol extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.symbol){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:j.parsedType}),INVALID}return OK(a.data)}}ZodSymbol.create=_=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(_)});class ZodUndefined extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.undefined){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:j.parsedType}),INVALID}return OK(a.data)}}ZodUndefined.create=_=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(_)});class ZodNull extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.null){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:j.parsedType}),INVALID}return OK(a.data)}}ZodNull.create=_=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(_)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(a){return OK(a.data)}}ZodAny.create=_=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(_)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(a){return OK(a.data)}}ZodUnknown.create=_=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(_)});class ZodNever extends ZodType{_parse(a){const $=this._getOrReturnCtx(a);return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:$.parsedType}),INVALID}}ZodNever.create=_=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(_)});class ZodVoid extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.undefined){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:j.parsedType}),INVALID}return OK(a.data)}}ZodVoid.create=_=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(_)});class ZodArray extends ZodType{_parse(a){const{ctx:$,status:j}=this._processInputParams(a),et=this._def;if($.parsedType!==ZodParsedType.array)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:$.parsedType}),INVALID;if(et.exactLength!==null){const rt=$.data.length>et.exactLength.value,nt=$.data.lengthet.maxLength.value&&(addIssueToContext($,{code:ZodIssueCode.too_big,maximum:et.maxLength.value,type:"array",inclusive:!0,exact:!1,message:et.maxLength.message}),j.dirty()),$.common.async)return Promise.all([...$.data].map((rt,nt)=>et.type._parseAsync(new ParseInputLazyPath($,rt,$.path,nt)))).then(rt=>ParseStatus.mergeArray(j,rt));const tt=[...$.data].map((rt,nt)=>et.type._parseSync(new ParseInputLazyPath($,rt,$.path,nt)));return ParseStatus.mergeArray(j,tt)}get element(){return this._def.type}min(a,$){return new ZodArray({...this._def,minLength:{value:a,message:errorUtil.toString($)}})}max(a,$){return new ZodArray({...this._def,maxLength:{value:a,message:errorUtil.toString($)}})}length(a,$){return new ZodArray({...this._def,exactLength:{value:a,message:errorUtil.toString($)}})}nonempty(a){return this.min(1,a)}}ZodArray.create=(_,a)=>new ZodArray({type:_,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(a)});function deepPartialify(_){if(_ instanceof ZodObject){const a={};for(const $ in _.shape){const j=_.shape[$];a[$]=ZodOptional.create(deepPartialify(j))}return new ZodObject({..._._def,shape:()=>a})}else return _ instanceof ZodArray?new ZodArray({..._._def,type:deepPartialify(_.element)}):_ instanceof ZodOptional?ZodOptional.create(deepPartialify(_.unwrap())):_ instanceof ZodNullable?ZodNullable.create(deepPartialify(_.unwrap())):_ instanceof ZodTuple?ZodTuple.create(_.items.map(a=>deepPartialify(a))):_}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const a=this._def.shape(),$=util.objectKeys(a);return this._cached={shape:a,keys:$}}_parse(a){if(this._getType(a)!==ZodParsedType.object){const ot=this._getOrReturnCtx(a);return addIssueToContext(ot,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:ot.parsedType}),INVALID}const{status:j,ctx:et}=this._processInputParams(a),{shape:tt,keys:rt}=this._getCached(),nt=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const ot in et.data)rt.includes(ot)||nt.push(ot);const it=[];for(const ot of rt){const st=tt[ot],ct=et.data[ot];it.push({key:{status:"valid",value:ot},value:st._parse(new ParseInputLazyPath(et,ct,et.path,ot)),alwaysSet:ot in et.data})}if(this._def.catchall instanceof ZodNever){const ot=this._def.unknownKeys;if(ot==="passthrough")for(const st of nt)it.push({key:{status:"valid",value:st},value:{status:"valid",value:et.data[st]}});else if(ot==="strict")nt.length>0&&(addIssueToContext(et,{code:ZodIssueCode.unrecognized_keys,keys:nt}),j.dirty());else if(ot!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const ot=this._def.catchall;for(const st of nt){const ct=et.data[st];it.push({key:{status:"valid",value:st},value:ot._parse(new ParseInputLazyPath(et,ct,et.path,st)),alwaysSet:st in et.data})}}return et.common.async?Promise.resolve().then(async()=>{const ot=[];for(const st of it){const ct=await st.key,ut=await st.value;ot.push({key:ct,value:ut,alwaysSet:st.alwaysSet})}return ot}).then(ot=>ParseStatus.mergeObjectSync(j,ot)):ParseStatus.mergeObjectSync(j,it)}get shape(){return this._def.shape()}strict(a){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...a!==void 0?{errorMap:($,j)=>{var et,tt,rt,nt;const it=(rt=(tt=(et=this._def).errorMap)===null||tt===void 0?void 0:tt.call(et,$,j).message)!==null&&rt!==void 0?rt:j.defaultError;return $.code==="unrecognized_keys"?{message:(nt=errorUtil.errToObj(a).message)!==null&&nt!==void 0?nt:it}:{message:it}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(a){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...a})})}merge(a){return new ZodObject({unknownKeys:a._def.unknownKeys,catchall:a._def.catchall,shape:()=>({...this._def.shape(),...a._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(a,$){return this.augment({[a]:$})}catchall(a){return new ZodObject({...this._def,catchall:a})}pick(a){const $={};return util.objectKeys(a).forEach(j=>{a[j]&&this.shape[j]&&($[j]=this.shape[j])}),new ZodObject({...this._def,shape:()=>$})}omit(a){const $={};return util.objectKeys(this.shape).forEach(j=>{a[j]||($[j]=this.shape[j])}),new ZodObject({...this._def,shape:()=>$})}deepPartial(){return deepPartialify(this)}partial(a){const $={};return util.objectKeys(this.shape).forEach(j=>{const et=this.shape[j];a&&!a[j]?$[j]=et:$[j]=et.optional()}),new ZodObject({...this._def,shape:()=>$})}required(a){const $={};return util.objectKeys(this.shape).forEach(j=>{if(a&&!a[j])$[j]=this.shape[j];else{let tt=this.shape[j];for(;tt instanceof ZodOptional;)tt=tt._def.innerType;$[j]=tt}}),new ZodObject({...this._def,shape:()=>$})}keyof(){return createZodEnum(util.objectKeys(this.shape))}}ZodObject.create=(_,a)=>new ZodObject({shape:()=>_,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(a)});ZodObject.strictCreate=(_,a)=>new ZodObject({shape:()=>_,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(a)});ZodObject.lazycreate=(_,a)=>new ZodObject({shape:_,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(a)});class ZodUnion extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a),j=this._def.options;function et(tt){for(const nt of tt)if(nt.result.status==="valid")return nt.result;for(const nt of tt)if(nt.result.status==="dirty")return $.common.issues.push(...nt.ctx.common.issues),nt.result;const rt=tt.map(nt=>new ZodError(nt.ctx.common.issues));return addIssueToContext($,{code:ZodIssueCode.invalid_union,unionErrors:rt}),INVALID}if($.common.async)return Promise.all(j.map(async tt=>{const rt={...$,common:{...$.common,issues:[]},parent:null};return{result:await tt._parseAsync({data:$.data,path:$.path,parent:rt}),ctx:rt}})).then(et);{let tt;const rt=[];for(const it of j){const ot={...$,common:{...$.common,issues:[]},parent:null},st=it._parseSync({data:$.data,path:$.path,parent:ot});if(st.status==="valid")return st;st.status==="dirty"&&!tt&&(tt={result:st,ctx:ot}),ot.common.issues.length&&rt.push(ot.common.issues)}if(tt)return $.common.issues.push(...tt.ctx.common.issues),tt.result;const nt=rt.map(it=>new ZodError(it));return addIssueToContext($,{code:ZodIssueCode.invalid_union,unionErrors:nt}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(_,a)=>new ZodUnion({options:_,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(a)});const getDiscriminator=_=>_ instanceof ZodLazy?getDiscriminator(_.schema):_ instanceof ZodEffects?getDiscriminator(_.innerType()):_ instanceof ZodLiteral?[_.value]:_ instanceof ZodEnum?_.options:_ instanceof ZodNativeEnum?util.objectValues(_.enum):_ instanceof ZodDefault?getDiscriminator(_._def.innerType):_ instanceof ZodUndefined?[void 0]:_ instanceof ZodNull?[null]:_ instanceof ZodOptional?[void 0,...getDiscriminator(_.unwrap())]:_ instanceof ZodNullable?[null,...getDiscriminator(_.unwrap())]:_ instanceof ZodBranded||_ instanceof ZodReadonly?getDiscriminator(_.unwrap()):_ instanceof ZodCatch?getDiscriminator(_._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a);if($.parsedType!==ZodParsedType.object)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:$.parsedType}),INVALID;const j=this.discriminator,et=$.data[j],tt=this.optionsMap.get(et);return tt?$.common.async?tt._parseAsync({data:$.data,path:$.path,parent:$}):tt._parseSync({data:$.data,path:$.path,parent:$}):(addIssueToContext($,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[j]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(a,$,j){const et=new Map;for(const tt of $){const rt=getDiscriminator(tt.shape[a]);if(!rt.length)throw new Error(`A discriminator value for key \`${a}\` could not be extracted from all schema options`);for(const nt of rt){if(et.has(nt))throw new Error(`Discriminator property ${String(a)} has duplicate value ${String(nt)}`);et.set(nt,tt)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:a,options:$,optionsMap:et,...processCreateParams(j)})}}function mergeValues(_,a){const $=getParsedType(_),j=getParsedType(a);if(_===a)return{valid:!0,data:_};if($===ZodParsedType.object&&j===ZodParsedType.object){const et=util.objectKeys(a),tt=util.objectKeys(_).filter(nt=>et.indexOf(nt)!==-1),rt={..._,...a};for(const nt of tt){const it=mergeValues(_[nt],a[nt]);if(!it.valid)return{valid:!1};rt[nt]=it.data}return{valid:!0,data:rt}}else if($===ZodParsedType.array&&j===ZodParsedType.array){if(_.length!==a.length)return{valid:!1};const et=[];for(let tt=0;tt<_.length;tt++){const rt=_[tt],nt=a[tt],it=mergeValues(rt,nt);if(!it.valid)return{valid:!1};et.push(it.data)}return{valid:!0,data:et}}else return $===ZodParsedType.date&&j===ZodParsedType.date&&+_==+a?{valid:!0,data:_}:{valid:!1}}class ZodIntersection extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a),et=(tt,rt)=>{if(isAborted(tt)||isAborted(rt))return INVALID;const nt=mergeValues(tt.value,rt.value);return nt.valid?((isDirty(tt)||isDirty(rt))&&$.dirty(),{status:$.value,value:nt.data}):(addIssueToContext(j,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return j.common.async?Promise.all([this._def.left._parseAsync({data:j.data,path:j.path,parent:j}),this._def.right._parseAsync({data:j.data,path:j.path,parent:j})]).then(([tt,rt])=>et(tt,rt)):et(this._def.left._parseSync({data:j.data,path:j.path,parent:j}),this._def.right._parseSync({data:j.data,path:j.path,parent:j}))}}ZodIntersection.create=(_,a,$)=>new ZodIntersection({left:_,right:a,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams($)});class ZodTuple extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.array)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:j.parsedType}),INVALID;if(j.data.lengththis._def.items.length&&(addIssueToContext(j,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$.dirty());const tt=[...j.data].map((rt,nt)=>{const it=this._def.items[nt]||this._def.rest;return it?it._parse(new ParseInputLazyPath(j,rt,j.path,nt)):null}).filter(rt=>!!rt);return j.common.async?Promise.all(tt).then(rt=>ParseStatus.mergeArray($,rt)):ParseStatus.mergeArray($,tt)}get items(){return this._def.items}rest(a){return new ZodTuple({...this._def,rest:a})}}ZodTuple.create=(_,a)=>{if(!Array.isArray(_))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:_,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(a)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.object)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:j.parsedType}),INVALID;const et=[],tt=this._def.keyType,rt=this._def.valueType;for(const nt in j.data)et.push({key:tt._parse(new ParseInputLazyPath(j,nt,j.path,nt)),value:rt._parse(new ParseInputLazyPath(j,j.data[nt],j.path,nt)),alwaysSet:nt in j.data});return j.common.async?ParseStatus.mergeObjectAsync($,et):ParseStatus.mergeObjectSync($,et)}get element(){return this._def.valueType}static create(a,$,j){return $ instanceof ZodType?new ZodRecord({keyType:a,valueType:$,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(j)}):new ZodRecord({keyType:ZodString.create(),valueType:a,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams($)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.map)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:j.parsedType}),INVALID;const et=this._def.keyType,tt=this._def.valueType,rt=[...j.data.entries()].map(([nt,it],ot)=>({key:et._parse(new ParseInputLazyPath(j,nt,j.path,[ot,"key"])),value:tt._parse(new ParseInputLazyPath(j,it,j.path,[ot,"value"]))}));if(j.common.async){const nt=new Map;return Promise.resolve().then(async()=>{for(const it of rt){const ot=await it.key,st=await it.value;if(ot.status==="aborted"||st.status==="aborted")return INVALID;(ot.status==="dirty"||st.status==="dirty")&&$.dirty(),nt.set(ot.value,st.value)}return{status:$.value,value:nt}})}else{const nt=new Map;for(const it of rt){const ot=it.key,st=it.value;if(ot.status==="aborted"||st.status==="aborted")return INVALID;(ot.status==="dirty"||st.status==="dirty")&&$.dirty(),nt.set(ot.value,st.value)}return{status:$.value,value:nt}}}}ZodMap.create=(_,a,$)=>new ZodMap({valueType:a,keyType:_,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams($)});class ZodSet extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.set)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:j.parsedType}),INVALID;const et=this._def;et.minSize!==null&&j.data.sizeet.maxSize.value&&(addIssueToContext(j,{code:ZodIssueCode.too_big,maximum:et.maxSize.value,type:"set",inclusive:!0,exact:!1,message:et.maxSize.message}),$.dirty());const tt=this._def.valueType;function rt(it){const ot=new Set;for(const st of it){if(st.status==="aborted")return INVALID;st.status==="dirty"&&$.dirty(),ot.add(st.value)}return{status:$.value,value:ot}}const nt=[...j.data.values()].map((it,ot)=>tt._parse(new ParseInputLazyPath(j,it,j.path,ot)));return j.common.async?Promise.all(nt).then(it=>rt(it)):rt(nt)}min(a,$){return new ZodSet({...this._def,minSize:{value:a,message:errorUtil.toString($)}})}max(a,$){return new ZodSet({...this._def,maxSize:{value:a,message:errorUtil.toString($)}})}size(a,$){return this.min(a,$).max(a,$)}nonempty(a){return this.min(1,a)}}ZodSet.create=(_,a)=>new ZodSet({valueType:_,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(a)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(a){const{ctx:$}=this._processInputParams(a);if($.parsedType!==ZodParsedType.function)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:$.parsedType}),INVALID;function j(nt,it){return makeIssue({data:nt,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,getErrorMap(),errorMap].filter(ot=>!!ot),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:it}})}function et(nt,it){return makeIssue({data:nt,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,getErrorMap(),errorMap].filter(ot=>!!ot),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:it}})}const tt={errorMap:$.common.contextualErrorMap},rt=$.data;if(this._def.returns instanceof ZodPromise){const nt=this;return OK(async function(...it){const ot=new ZodError([]),st=await nt._def.args.parseAsync(it,tt).catch(ht=>{throw ot.addIssue(j(it,ht)),ot}),ct=await Reflect.apply(rt,this,st);return await nt._def.returns._def.type.parseAsync(ct,tt).catch(ht=>{throw ot.addIssue(et(ct,ht)),ot})})}else{const nt=this;return OK(function(...it){const ot=nt._def.args.safeParse(it,tt);if(!ot.success)throw new ZodError([j(it,ot.error)]);const st=Reflect.apply(rt,this,ot.data),ct=nt._def.returns.safeParse(st,tt);if(!ct.success)throw new ZodError([et(st,ct.error)]);return ct.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...a){return new ZodFunction({...this._def,args:ZodTuple.create(a).rest(ZodUnknown.create())})}returns(a){return new ZodFunction({...this._def,returns:a})}implement(a){return this.parse(a)}strictImplement(a){return this.parse(a)}static create(a,$,j){return new ZodFunction({args:a||ZodTuple.create([]).rest(ZodUnknown.create()),returns:$||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(j)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(a){const{ctx:$}=this._processInputParams(a);return this._def.getter()._parse({data:$.data,path:$.path,parent:$})}}ZodLazy.create=(_,a)=>new ZodLazy({getter:_,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(a)});class ZodLiteral extends ZodType{_parse(a){if(a.data!==this._def.value){const $=this._getOrReturnCtx(a);return addIssueToContext($,{received:$.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:a.data}}get value(){return this._def.value}}ZodLiteral.create=(_,a)=>new ZodLiteral({value:_,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(a)});function createZodEnum(_,a){return new ZodEnum({values:_,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(a)})}class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(a){if(typeof a.data!="string"){const $=this._getOrReturnCtx(a),j=this._def.values;return addIssueToContext($,{expected:util.joinValues(j),received:$.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet$1(this,_ZodEnum_cache)||__classPrivateFieldSet$1(this,_ZodEnum_cache,new Set(this._def.values)),!__classPrivateFieldGet$1(this,_ZodEnum_cache).has(a.data)){const $=this._getOrReturnCtx(a),j=this._def.values;return addIssueToContext($,{received:$.data,code:ZodIssueCode.invalid_enum_value,options:j}),INVALID}return OK(a.data)}get options(){return this._def.values}get enum(){const a={};for(const $ of this._def.values)a[$]=$;return a}get Values(){const a={};for(const $ of this._def.values)a[$]=$;return a}get Enum(){const a={};for(const $ of this._def.values)a[$]=$;return a}extract(a,$=this._def){return ZodEnum.create(a,{...this._def,...$})}exclude(a,$=this._def){return ZodEnum.create(this.options.filter(j=>!a.includes(j)),{...this._def,...$})}}_ZodEnum_cache=new WeakMap;ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(a){const $=util.getValidEnumValues(this._def.values),j=this._getOrReturnCtx(a);if(j.parsedType!==ZodParsedType.string&&j.parsedType!==ZodParsedType.number){const et=util.objectValues($);return addIssueToContext(j,{expected:util.joinValues(et),received:j.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet$1(this,_ZodNativeEnum_cache)||__classPrivateFieldSet$1(this,_ZodNativeEnum_cache,new Set(util.getValidEnumValues(this._def.values))),!__classPrivateFieldGet$1(this,_ZodNativeEnum_cache).has(a.data)){const et=util.objectValues($);return addIssueToContext(j,{received:j.data,code:ZodIssueCode.invalid_enum_value,options:et}),INVALID}return OK(a.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap;ZodNativeEnum.create=(_,a)=>new ZodNativeEnum({values:_,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(a)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(a){const{ctx:$}=this._processInputParams(a);if($.parsedType!==ZodParsedType.promise&&$.common.async===!1)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:$.parsedType}),INVALID;const j=$.parsedType===ZodParsedType.promise?$.data:Promise.resolve($.data);return OK(j.then(et=>this._def.type.parseAsync(et,{path:$.path,errorMap:$.common.contextualErrorMap})))}}ZodPromise.create=(_,a)=>new ZodPromise({type:_,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(a)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(a){const{status:$,ctx:j}=this._processInputParams(a),et=this._def.effect||null,tt={addIssue:rt=>{addIssueToContext(j,rt),rt.fatal?$.abort():$.dirty()},get path(){return j.path}};if(tt.addIssue=tt.addIssue.bind(tt),et.type==="preprocess"){const rt=et.transform(j.data,tt);if(j.common.async)return Promise.resolve(rt).then(async nt=>{if($.value==="aborted")return INVALID;const it=await this._def.schema._parseAsync({data:nt,path:j.path,parent:j});return it.status==="aborted"?INVALID:it.status==="dirty"||$.value==="dirty"?DIRTY(it.value):it});{if($.value==="aborted")return INVALID;const nt=this._def.schema._parseSync({data:rt,path:j.path,parent:j});return nt.status==="aborted"?INVALID:nt.status==="dirty"||$.value==="dirty"?DIRTY(nt.value):nt}}if(et.type==="refinement"){const rt=nt=>{const it=et.refinement(nt,tt);if(j.common.async)return Promise.resolve(it);if(it instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return nt};if(j.common.async===!1){const nt=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});return nt.status==="aborted"?INVALID:(nt.status==="dirty"&&$.dirty(),rt(nt.value),{status:$.value,value:nt.value})}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then(nt=>nt.status==="aborted"?INVALID:(nt.status==="dirty"&&$.dirty(),rt(nt.value).then(()=>({status:$.value,value:nt.value}))))}if(et.type==="transform")if(j.common.async===!1){const rt=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(!isValid$1(rt))return rt;const nt=et.transform(rt.value,tt);if(nt instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:$.value,value:nt}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then(rt=>isValid$1(rt)?Promise.resolve(et.transform(rt.value,tt)).then(nt=>({status:$.value,value:nt})):rt);util.assertNever(et)}}ZodEffects.create=(_,a,$)=>new ZodEffects({schema:_,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:a,...processCreateParams($)});ZodEffects.createWithPreprocess=(_,a,$)=>new ZodEffects({schema:a,effect:{type:"preprocess",transform:_},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams($)});class ZodOptional extends ZodType{_parse(a){return this._getType(a)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}ZodOptional.create=(_,a)=>new ZodOptional({innerType:_,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(a)});class ZodNullable extends ZodType{_parse(a){return this._getType(a)===ZodParsedType.null?OK(null):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}ZodNullable.create=(_,a)=>new ZodNullable({innerType:_,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(a)});class ZodDefault extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a);let j=$.data;return $.parsedType===ZodParsedType.undefined&&(j=this._def.defaultValue()),this._def.innerType._parse({data:j,path:$.path,parent:$})}removeDefault(){return this._def.innerType}}ZodDefault.create=(_,a)=>new ZodDefault({innerType:_,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof a.default=="function"?a.default:()=>a.default,...processCreateParams(a)});class ZodCatch extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a),j={...$,common:{...$.common,issues:[]}},et=this._def.innerType._parse({data:j.data,path:j.path,parent:{...j}});return isAsync(et)?et.then(tt=>({status:"valid",value:tt.status==="valid"?tt.value:this._def.catchValue({get error(){return new ZodError(j.common.issues)},input:j.data})})):{status:"valid",value:et.status==="valid"?et.value:this._def.catchValue({get error(){return new ZodError(j.common.issues)},input:j.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(_,a)=>new ZodCatch({innerType:_,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof a.catch=="function"?a.catch:()=>a.catch,...processCreateParams(a)});class ZodNaN extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.nan){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:j.parsedType}),INVALID}return{status:"valid",value:a.data}}}ZodNaN.create=_=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(_)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a),j=$.data;return this._def.type._parse({data:j,path:$.path,parent:$})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.common.async)return(async()=>{const tt=await this._def.in._parseAsync({data:j.data,path:j.path,parent:j});return tt.status==="aborted"?INVALID:tt.status==="dirty"?($.dirty(),DIRTY(tt.value)):this._def.out._parseAsync({data:tt.value,path:j.path,parent:j})})();{const et=this._def.in._parseSync({data:j.data,path:j.path,parent:j});return et.status==="aborted"?INVALID:et.status==="dirty"?($.dirty(),{status:"dirty",value:et.value}):this._def.out._parseSync({data:et.value,path:j.path,parent:j})}}static create(a,$){return new ZodPipeline({in:a,out:$,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(a){const $=this._def.innerType._parse(a),j=et=>(isValid$1(et)&&(et.value=Object.freeze(et.value)),et);return isAsync($)?$.then(et=>j(et)):j($)}unwrap(){return this._def.innerType}}ZodReadonly.create=(_,a)=>new ZodReadonly({innerType:_,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(a)});function custom(_,a={},$){return _?ZodAny.create().superRefine((j,et)=>{var tt,rt;if(!_(j)){const nt=typeof a=="function"?a(j):typeof a=="string"?{message:a}:a,it=(rt=(tt=nt.fatal)!==null&&tt!==void 0?tt:$)!==null&&rt!==void 0?rt:!0,ot=typeof nt=="string"?{message:nt}:nt;et.addIssue({code:"custom",...ot,fatal:it})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(_){_.ZodString="ZodString",_.ZodNumber="ZodNumber",_.ZodNaN="ZodNaN",_.ZodBigInt="ZodBigInt",_.ZodBoolean="ZodBoolean",_.ZodDate="ZodDate",_.ZodSymbol="ZodSymbol",_.ZodUndefined="ZodUndefined",_.ZodNull="ZodNull",_.ZodAny="ZodAny",_.ZodUnknown="ZodUnknown",_.ZodNever="ZodNever",_.ZodVoid="ZodVoid",_.ZodArray="ZodArray",_.ZodObject="ZodObject",_.ZodUnion="ZodUnion",_.ZodDiscriminatedUnion="ZodDiscriminatedUnion",_.ZodIntersection="ZodIntersection",_.ZodTuple="ZodTuple",_.ZodRecord="ZodRecord",_.ZodMap="ZodMap",_.ZodSet="ZodSet",_.ZodFunction="ZodFunction",_.ZodLazy="ZodLazy",_.ZodLiteral="ZodLiteral",_.ZodEnum="ZodEnum",_.ZodEffects="ZodEffects",_.ZodNativeEnum="ZodNativeEnum",_.ZodOptional="ZodOptional",_.ZodNullable="ZodNullable",_.ZodDefault="ZodDefault",_.ZodCatch="ZodCatch",_.ZodPromise="ZodPromise",_.ZodBranded="ZodBranded",_.ZodPipeline="ZodPipeline",_.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(_,a={message:`Input not instance of ${_.name}`})=>custom($=>$ instanceof _,a),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType$1=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce$2={string:_=>ZodString.create({..._,coerce:!0}),number:_=>ZodNumber.create({..._,coerce:!0}),boolean:_=>ZodBoolean.create({..._,coerce:!0}),bigint:_=>ZodBigInt.create({..._,coerce:!0}),date:_=>ZodDate.create({..._,coerce:!0})},NEVER$1=INVALID;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID,DIRTY,OK,isAborted,isDirty,isValid:isValid$1,isAsync,get util(){return util},get objectUtil(){return objectUtil},ZodParsedType,getParsedType,ZodType,datetimeRegex,ZodString,ZodNumber,ZodBigInt,ZodBoolean,ZodDate,ZodSymbol,ZodUndefined,ZodNull,ZodAny,ZodUnknown,ZodNever,ZodVoid,ZodArray,ZodObject,ZodUnion,ZodDiscriminatedUnion,ZodIntersection,ZodTuple,ZodRecord,ZodMap,ZodSet,ZodFunction,ZodLazy,ZodLiteral,ZodEnum,ZodNativeEnum,ZodPromise,ZodEffects,ZodTransformer:ZodEffects,ZodOptional,ZodNullable,ZodDefault,ZodCatch,ZodNaN,BRAND,ZodBranded,ZodPipeline,ZodReadonly,custom,Schema:ZodType,ZodSchema:ZodType,late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce$2,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType$1,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean,onumber,optional:optionalType,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER:NEVER$1,ZodIssueCode,quotelessJson,ZodError});const Schema$1=z.object({address:z.string()}),parsePkh=_=>{if(isValidContractPkh(_))return parseContractPkh(_);if(isValidImplicitPkh(_))return parseImplicitPkh(_);throw new Error(`Cannot parse address type: ${_}`)},isAddressValid=_=>validateAddress(_)===ValidationResult.VALID,isValidContractPkh=_=>isAddressValid(_)&&_.match(/^KT1\w+/),isValidImplicitPkh=_=>isAddressValid(_)&&_.match(/^tz[1234]\w+/),parseContractPkh=_=>{if(isValidContractPkh(_))return{type:"contract",pkh:_};throw new Error(`Invalid contract address: ${_}`)},parseImplicitPkh=_=>{if(isValidImplicitPkh(_))return{type:"implicit",pkh:_};throw new Error(`Invalid implicit address: ${_}`)},encodeReserved=[encodeURIComponent,encodeURIComponent];function encode$3(_,a=","){const $=(j,et)=>{const tt=_[et%_.length];return typeof j>"u"?"":typeof j=="object"?Array.isArray(j)?j.map(tt).join(a):Object.entries(j).reduce((nt,it)=>[...nt,...it],[]).map(tt).join(a):tt(String(j))};return(j,...et)=>j.reduce((tt,rt,nt)=>`${tt}${rt}${$(et[nt],nt)}`,"")}function delimited(_=","){return(a,$=encodeReserved)=>Object.entries(a).filter(([,j])=>j!==void 0).map(([j,et])=>encode$3($,_)`${j}=${et}`).join("&")}function stripUndefined(_){return _&&JSON.parse(JSON.stringify(_))}function joinUrl(..._){return _.filter(Boolean).map((a,$)=>$===0?a:a.replace(/^\/+/,"")).map((a,$,j)=>$===j.length-1?a:a.replace(/\/+$/,"")).join("/")}function query(..._){const a=_.filter(Boolean).join("&");return a&&`?${a}`}function explode(_,a=encodeReserved){const $=encode$3(a);return Object.entries(_).filter(([,j])=>j!==void 0).map(([j,et])=>Array.isArray(et)?et.map(tt=>$`${j}=${tt}`).join("&"):typeof et=="object"?explode(et,a):$`${j}=${et}`).join("&")}const form=delimited(),SUCCESS_CODES=[200,201,202,204];async function ok(_){const a=await _;if(SUCCESS_CODES.some($=>$==a.status))return a.data;throw new HttpError(a.status,a.data)}class HttpError extends Error{constructor($,j){super(`Error: ${$}`);Vr(this,"status");Vr(this,"data");this.status=$,this.data=j}}function runtime$1(_){async function a(tt,rt){const nt=await et(tt,rt);let it;try{it=await nt.text()}catch{}return{status:nt.status,headers:nt.headers,contentType:nt.headers.get("content-type"),data:it}}async function $(tt,rt={}){const{status:nt,headers:it,contentType:ot,data:st}=await a(tt,{...rt,headers:{Accept:"application/json",...rt.headers}});return(ot?ot.includes("json"):!1)?{status:nt,headers:it,data:st?JSON.parse(st):null}:{status:nt,headers:it,data:st}}async function j(tt,rt={}){const nt=await et(tt,rt);let it;try{it=await nt.blob()}catch{}return{status:nt.status,headers:nt.headers,data:it}}async function et(tt,rt={}){const{baseUrl:nt,headers:it,fetch:ot,...st}={..._,...rt},ct=joinUrl(nt,tt);return await(ot||fetch)(ct,{...st,headers:stripUndefined({..._.headers,...it})})}return{ok,fetchText:a,fetchJson:$,fetchBlob:j,json({body:tt,headers:rt,...nt}){return{...nt,...tt!=null&&{body:JSON.stringify(tt)},headers:{...rt,"Content-Type":"application/json"}}},form({body:tt,headers:rt,...nt}){return{...nt,...tt!=null&&{body:form(tt)},headers:{...rt,"Content-Type":"application/x-www-form-urlencoded"}}},multipart({body:tt,...rt}){if(tt==null)return rt;const nt=new(_.formDataConstructor||rt.formDataConstructor||FormData);return Object.entries(tt).forEach(([it,ot])=>{nt.append(it,ot)}),{...rt,body:nt}}}}const jsonParameter=(_,a)=>{if(!a)return{};const $={};return Object.entries(a).forEach(([j,et])=>{if(!(et instanceof Object))throw new Error(`Expected ${_} value to be object, received ${typeof et}`);const{jsonPath:tt,jsonValue:rt}=et;if(rt==null)throw new Error(`Expected jsonValue in ${_} -> ${j}, found: ${rt}`);const it=[_,tt,j].filter(ot=>ot!==void 0).join(".");$[it]=rt}),$},anyofParameter=(_,a)=>{if(!a)return{};const{fields:$}=a;(rt=>{if(!Array.isArray(rt))throw new Error(`Expected ${_} fields to be Array. Received ${typeof rt}.`);return rt.forEach(nt=>{if(typeof nt!="string")throw new Error(`Expected ${_} fields to be strings. Received ${typeof nt}`)}),!0})($);const et={},tt=$.join(".");if(a.value){const rt=`${_}.${tt}`;et[rt]=a.value}for(const rt of["in","eq","null"])if(a[rt]){const nt=`${_}.${tt}.${rt}`;return et[nt]=Array.isArray(a[rt])?a[rt].join(","):a[rt],et}return et},queryParameter=(_,a)=>{if(!a)return{};const $={};return Object.entries(a).forEach(([j,et])=>{const tt=`${_}.${j}`;$[tt]=et}),$},parsers={jsonParameter,queryParameter,anyofParameter},defaults={baseUrl:"https://api.tzkt.io"},oazapfts=runtime$1(defaults);function accountsGet({id:_,address:a,$type:$,kind:j,delegate:et,balance:tt,staked:rt,lastActivity:nt,select:it,sort:ot,offset:st,limit:ct}={},ut){return oazapfts.ok(oazapfts.fetchJson(`/v1/accounts${query(explode({limit:ct,...parsers.queryParameter("id",_),...parsers.queryParameter("address",a),...parsers.queryParameter("type",$),...parsers.queryParameter("kind",j),...parsers.queryParameter("delegate",et),...parsers.queryParameter("balance",tt),...parsers.queryParameter("staked",rt),...parsers.queryParameter("lastActivity",nt),...parsers.queryParameter("select",it),...parsers.queryParameter("sort",ot),...parsers.queryParameter("offset",st)}))}`,{...ut}))}function blocksGetCount(_){return oazapfts.ok(oazapfts.fetchJson("/v1/blocks/count",{..._}))}function contractsGet({address:_,kind:a,tzips:$,creator:j,manager:et,delegate:tt,balance:rt,lastActivity:nt,typeHash:it,codeHash:ot,select:st,sort:ct,offset:ut,limit:ht,includeStorage:Et}={},St){return oazapfts.ok(oazapfts.fetchJson(`/v1/contracts${query(explode({limit:ht,includeStorage:Et,...parsers.queryParameter("address",_),...parsers.queryParameter("kind",a),...parsers.queryParameter("tzips",$),...parsers.queryParameter("creator",j),...parsers.queryParameter("manager",et),...parsers.queryParameter("delegate",tt),...parsers.queryParameter("balance",rt),...parsers.queryParameter("lastActivity",nt),...parsers.queryParameter("typeHash",it),...parsers.queryParameter("codeHash",ot),...parsers.queryParameter("select",st),...parsers.queryParameter("sort",ct),...parsers.queryParameter("offset",ut)}))}`,{...St}))}function delegatesGet({active:_,lastActivity:a,select:$,sort:j,offset:et,limit:tt}={},rt){return oazapfts.ok(oazapfts.fetchJson(`/v1/delegates${query(explode({limit:tt,...parsers.queryParameter("active",_),...parsers.queryParameter("lastActivity",a),...parsers.queryParameter("select",$),...parsers.queryParameter("sort",j),...parsers.queryParameter("offset",et)}))}`,{...rt}))}function operationsGetDelegations({anyof:_,initiator:a,sender:$,prevDelegate:j,newDelegate:et,level:tt,timestamp:rt,senderCodeHash:nt,status:it,select:ot,sort:st,offset:ct,limit:ut,quote:ht}={},Et){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/delegations${query(explode({limit:ut,quote:ht,...parsers.anyofParameter("anyof",_),...parsers.queryParameter("initiator",a),...parsers.queryParameter("sender",$),...parsers.queryParameter("prevDelegate",j),...parsers.queryParameter("newDelegate",et),...parsers.queryParameter("level",tt),...parsers.queryParameter("timestamp",rt),...parsers.queryParameter("senderCodeHash",nt),...parsers.queryParameter("status",it),...parsers.queryParameter("select",ot),...parsers.queryParameter("sort",st),...parsers.queryParameter("offset",ct)}))}`,{...Et}))}function operationsGetOriginations({anyof:_,initiator:a,sender:$,contractManager:j,contractDelegate:et,originatedContract:tt,id:rt,typeHash:nt,codeHash:it,level:ot,timestamp:st,senderCodeHash:ct,anyCodeHash:ut,status:ht,select:Et,sort:St,offset:Mt,limit:kt,micheline:Ct,quote:Ot}={},zt){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/originations${query(explode({limit:kt,micheline:Ct,quote:Ot,...parsers.anyofParameter("anyof",_),...parsers.queryParameter("initiator",a),...parsers.queryParameter("sender",$),...parsers.queryParameter("contractManager",j),...parsers.queryParameter("contractDelegate",et),...parsers.queryParameter("originatedContract",tt),...parsers.queryParameter("id",rt),...parsers.queryParameter("typeHash",nt),...parsers.queryParameter("codeHash",it),...parsers.queryParameter("level",ot),...parsers.queryParameter("timestamp",st),...parsers.queryParameter("senderCodeHash",ct),...parsers.queryParameter("anyCodeHash",ut),...parsers.queryParameter("status",ht),...parsers.queryParameter("select",Et),...parsers.queryParameter("sort",St),...parsers.queryParameter("offset",Mt)}))}`,{...zt}))}function operationsGetTransactions({anyof:_,initiator:a,sender:$,target:j,amount:et,id:tt,level:rt,timestamp:nt,senderCodeHash:it,targetCodeHash:ot,codeHash:st,entrypoint:ct,parameter:ut,hasInternals:ht,status:Et,select:St,sort:Mt,offset:kt,limit:Ct,micheline:Ot,quote:zt}={},Ut){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/transactions${query(explode({limit:Ct,micheline:Ot,quote:zt,...parsers.anyofParameter("anyof",_),...parsers.queryParameter("initiator",a),...parsers.queryParameter("sender",$),...parsers.queryParameter("target",j),...parsers.queryParameter("amount",et),...parsers.queryParameter("id",tt),...parsers.queryParameter("level",rt),...parsers.queryParameter("timestamp",nt),...parsers.queryParameter("senderCodeHash",it),...parsers.queryParameter("targetCodeHash",ot),...parsers.queryParameter("codeHash",st),...parsers.queryParameter("entrypoint",ct),...parsers.jsonParameter("parameter",ut),...parsers.queryParameter("hasInternals",ht),...parsers.queryParameter("status",Et),...parsers.queryParameter("select",St),...parsers.queryParameter("sort",Mt),...parsers.queryParameter("offset",kt)}))}`,{...Ut}))}function quotesGetLast(_){return oazapfts.ok(oazapfts.fetchJson("/v1/quotes/last",{..._}))}function tokensGetTokenBalances({id:_,account:a,tokenId:$,tokenContract:j,tokenTokenId:et,tokenStandard:tt,tokenMetadata:rt,tokenHasFilters:nt,balance:it,firstLevel:ot,firstTime:st,lastLevel:ct,lastTime:ut,indexedAt:ht,sort:Et,offset:St,limit:Mt,select:kt}={},Ct){return oazapfts.ok(oazapfts.fetchJson(`/v1/tokens/balances${query(explode({"token.HasFilters":nt,limit:Mt,...parsers.queryParameter("id",_),...parsers.queryParameter("account",a),...parsers.queryParameter("token.id",$),...parsers.queryParameter("token.contract",j),...parsers.queryParameter("token.tokenId",et),...parsers.queryParameter("token.standard",tt),...parsers.jsonParameter("token.metadata",rt),...parsers.queryParameter("balance",it),...parsers.queryParameter("firstLevel",ot),...parsers.queryParameter("firstTime",st),...parsers.queryParameter("lastLevel",ct),...parsers.queryParameter("lastTime",ut),...parsers.queryParameter("indexedAt",ht),...parsers.queryParameter("sort",Et),...parsers.queryParameter("offset",St),...parsers.queryParameter("select",kt)}))}`,{...Ct}))}function tokensGetTokenTransfers({id:_,level:a,timestamp:$,tokenId:j,tokenContract:et,tokenTokenId:tt,tokenStandard:rt,tokenMetadata:nt,tokenHasFilters:it,anyof:ot,$from:st,to:ct,amount:ut,transactionId:ht,originationId:Et,migrationId:St,indexedAt:Mt,sort:kt,offset:Ct,limit:Ot,select:zt}={},Ut){return oazapfts.ok(oazapfts.fetchJson(`/v1/tokens/transfers${query(explode({"token.HasFilters":it,limit:Ot,...parsers.queryParameter("id",_),...parsers.queryParameter("level",a),...parsers.queryParameter("timestamp",$),...parsers.queryParameter("token.id",j),...parsers.queryParameter("token.contract",et),...parsers.queryParameter("token.tokenId",tt),...parsers.queryParameter("token.standard",rt),...parsers.jsonParameter("token.metadata",nt),...parsers.anyofParameter("anyof",ot),...parsers.queryParameter("from",st),...parsers.queryParameter("to",ct),...parsers.queryParameter("amount",ut),...parsers.queryParameter("transactionId",ht),...parsers.queryParameter("originationId",Et),...parsers.queryParameter("migrationId",St),...parsers.queryParameter("indexedAt",Mt),...parsers.queryParameter("sort",kt),...parsers.queryParameter("offset",Ct),...parsers.queryParameter("select",zt)}))}`,{...Ut}))}let e$1=class{constructor(a){this.queue=void 0,this.maxConcurrent=void 0,this.count=void 0,this.queue=[],this.maxConcurrent=a,this.count=0}get canAcquire(){return this.countthis.queue.push(a))}release(){const a=this.queue.shift();a?setTimeout(a,0):this.count--}};const t$4="_default";class s{constructor(a=1){this.semaphoreInstances=void 0,this.maxConcurrent=void 0,this.semaphoreInstances={},this.maxConcurrent=a}hasSemaphoreInstance(a=t$4){return!!this.semaphoreInstances[a]}getSemaphoreInstance(a=t$4){return this.hasSemaphoreInstance(a)||(this.semaphoreInstances[a]=new e$1(this.maxConcurrent)),this.semaphoreInstances[a]}tidy(a=t$4){this.hasSemaphoreInstance(a)&&this.getSemaphoreInstance(a).count===0&&delete this.semaphoreInstances[a]}canAcquire(a=t$4){return this.getSemaphoreInstance(a).canAcquire}acquire(a=t$4){return this.getSemaphoreInstance(a).acquire()}release(a=t$4){this.getSemaphoreInstance(a).release(),this.tidy(a)}count(a=t$4){return this.hasSemaphoreInstance(a)?this.getSemaphoreInstance(a).count:0}hasTasks(a=t$4){return this.count(a)>0}async request(a,$=t$4){try{return await this.acquire($),await a()}finally{this.release($)}}async requestIfAvailable(a,$=t$4){return this.canAcquire($)?this.request(a,$):null}}function assign(_,a){for(const $ in a)Object.defineProperty(_,$,{value:a[$],enumerable:!0,configurable:!0});return _}function createError(_,a,$){if(!_||typeof _=="string")throw new TypeError("Please pass an Error to err-code");$||($={}),typeof a=="object"&&($=a,a=void 0),a!=null&&($.code=a);try{return assign(_,$)}catch{$.message=_.message,$.stack=_.stack;const et=function(){};return et.prototype=Object.create(Object.getPrototypeOf(_)),assign(new et,$)}}var errCode=createError,retry$3={};function RetryOperation(_,a){typeof a=="boolean"&&(a={forever:a}),this._originalTimeouts=JSON.parse(JSON.stringify(_)),this._timeouts=_,this._options=a||{},this._maxRetryTime=a&&a.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var retry_operation=RetryOperation;RetryOperation.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(_){if(this._timeout&&clearTimeout(this._timeout),!_)return!1;var a=new Date().getTime();if(_&&a-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(_);var $=this._timeouts.shift();if($===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),$=this._timeouts.shift();else return!1;var j=this,et=setTimeout(function(){j._attempts++,j._operationTimeoutCb&&(j._timeout=setTimeout(function(){j._operationTimeoutCb(j._attempts)},j._operationTimeout),j._options.unref&&j._timeout.unref()),j._fn(j._attempts)},$);return this._options.unref&&et.unref(),!0};RetryOperation.prototype.attempt=function(_,a){this._fn=_,a&&(a.timeout&&(this._operationTimeout=a.timeout),a.cb&&(this._operationTimeoutCb=a.cb));var $=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){$._operationTimeoutCb()},$._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};RetryOperation.prototype.try=function(_){console.log("Using RetryOperation.try() is deprecated"),this.attempt(_)};RetryOperation.prototype.start=function(_){console.log("Using RetryOperation.start() is deprecated"),this.attempt(_)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this._errors};RetryOperation.prototype.attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var _={},a=null,$=0,j=0;j=$&&(a=et,$=rt)}return a};(function(_){var a=retry_operation;_.operation=function($){var j=_.timeouts($);return new a(j,{forever:$&&$.forever,unref:$&&$.unref,maxRetryTime:$&&$.maxRetryTime})},_.timeouts=function($){if($ instanceof Array)return[].concat($);var j={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var et in $)j[et]=$[et];if(j.minTimeout>j.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var tt=[],rt=0;rttzktRateLimiter.acquire().then(()=>promiseRetry$1(a=>_().catch(a),{retries:3,minTimeout:100})).catch(a=>{throw"status"in a&&"data"in a?new Error(`Fetching data from tzkt failed with: ${a.status}, ${a.data}`):a}).finally(()=>tzktRateLimiter.release()),MULTISIG_FETCH_LIMIT=1e4,TYPE_HASH=1963879877,CODE_HASH=-1890025422,getAllMultiSigContracts=async _=>withRateLimit(async()=>{try{const a=`${_.tzktApiUrl}/v1/contracts?typeHash=${TYPE_HASH}&codeHash=${CODE_HASH}&includeStorage=true&limit=${MULTISIG_FETCH_LIMIT}`,{data:$}=await axios.get(a);return $}catch(a){throw new Error(`Error fetching same contracts from tzkt: ${a.message}`)}}),getExistingContracts=(_,a)=>withRateLimit(()=>contractsGet({address:{in:[_.join(",")]},select:{fields:["address"]},limit:Math.min(1e4,_.length)},{baseUrl:a.tzktApiUrl})),getPendingOperations=async(_,a)=>withRateLimit(async()=>{if(_.length===0)return Promise.resolve([]);const $=`${a.tzktApiUrl}/v1/bigmaps/keys?active=true&bigmap.in=${_.join(",")}&limit=${MULTISIG_FETCH_LIMIT}`,{data:j}=await axios.get($);return j}),parseMultisig=_=>({address:parseContractPkh(_.address),threshold:Number(_.storage.threshold),signers:_.storage.signers.map(parseImplicitPkh),pendingOperationsBigmapId:_.storage.pending_ops}),getRelevantMultisigContracts=async(_,a)=>(await getAllMultiSigContracts(a)).filter(({storage:{signers:j}})=>lodashExports.every(j,isValidImplicitPkh)?j.filter(tt=>_.has(tt)).length>0:!1).map(parseMultisig),getNetworksForContracts=async(_,a)=>{const $=new Map;return a.length===0||(await Promise.all(_.map(async et=>(await getExistingContracts(a,et)).map(tt=>[tt,et.name])))).flat().forEach(([et,tt])=>$.set(et,tt)),$},parseMultisigOperation=_=>{const{bigmap:a,key:$,value:j}=_;if($===null||j===null)throw new Error("parseMultisigOperation failed");return{id:$,bigmapId:a,rawActions:j.actions,approvals:j.approvals.map(parseImplicitPkh)}},getPendingOperationsForMultisigs=async(_,a)=>{if(_.length===0)return[];const $=_.map(et=>et.pendingOperationsBigmapId),j=await getPendingOperations($,a);return lodashExports.compact(j.map(parseMultisigOperation))},VERSION$1=6,mainStoreMigrations={0:_=>produce(_,a=>{a.multisigs.labelsMap={}}),1:_=>produce(_,a=>{a.announcement=initialState$9}),2:lodashExports.identity,3:_=>produce(_,a=>{a.networks.current.name==="ghostnet"&&(a.networks.current.buyTezUrl="https://faucet.ghostnet.teztnets.com/");for(const $ of a.networks.available)if($.name==="ghostnet"){$.buyTezUrl="https://faucet.ghostnet.teztnets.com/";break}}),4:lodashExports.identity,5:_=>produce(_,a=>{delete a.assets.transfers.tez}),6:async _=>{const a=Object.values(_.contacts).filter(tt=>isValidImplicitPkh(tt.pkh)).map(tt=>[tt.pkh,{...tt,network:void 0}]),$=Object.values(_.contacts).filter(tt=>isValidContractPkh(tt.pkh)).map(tt=>tt.pkh),et=[...(await getNetworksForContracts(_.networks.available,$)).entries()].map(([tt,rt])=>[tt,{..._.contacts[tt],network:rt}]);return produce(_,tt=>{tt.contacts=lodashExports.fromPairs([...a,...et])})}},accountsMigrations={0:lodashExports.identity,1:lodashExports.identity,2:_=>produce(_,a=>{a.items.forEach($=>{$.type==="secret_key"&&($.curve="ed25519")})}),3:lodashExports.identity,4:_=>produce(_,a=>{a.items.forEach($=>{$.type==="ledger"&&!$.derivationPathTemplate&&($.derivationPathTemplate=void 0,$.derivationPath==="44'/1729'/0'/0'"?$.derivationPathTemplate="44'/1729'/?'/0'":$.derivationPath==="44'/1729'/0'/0'/0'"&&($.derivationPathTemplate="44'/1729'/?'/0'/0'"))})}),5:lodashExports.identity,6:lodashExports.identity},AES_MODE="AES-GCM",BYTE_TO_BIT=8,KEY_SIZE=32,NUM_ITERATIONS_V2=6e5,NUM_ITERATIONS_V1=1e4,derivePasswordBasedKeyV1=async(_,a)=>derivePasswordBasedKey(Buffer$g.alloc(32,_,"utf-8"),a,NUM_ITERATIONS_V1),derivePasswordBasedKeyV2=async(_,a)=>derivePasswordBasedKey(Buffer$g.from(_,"utf-8"),a,NUM_ITERATIONS_V2),derivePasswordBasedKey=async(_,a,$)=>{const j={name:"PBKDF2",salt:a,iterations:$,hash:"SHA-256"},et=await crypto.subtle.importKey("raw",_,j.name,!1,["deriveKey"]);return await crypto.subtle.deriveKey(j,et,{name:AES_MODE,length:KEY_SIZE*BYTE_TO_BIT},!1,["encrypt","decrypt"])},SALT_SIZE=32,IV_SIZE=12,encrypt$1=async(_,a)=>{const $=crypto.getRandomValues(new Uint8Array(SALT_SIZE)),j=await derivePasswordBasedKeyV2(a,$),et=crypto.getRandomValues(new Uint8Array(IV_SIZE)),tt=await crypto.subtle.encrypt({name:AES_MODE,iv:et},j,Buffer$g.from(_,"utf-8"));return{iv:buf2hex(Buffer$g.from(et)),salt:buf2hex(Buffer$g.from($)),data:buf2hex(Buffer$g.from(tt))}},decrypt$1=async(_,a,$="V2")=>{const{iv:j,salt:et,data:tt}=_;try{const rt=$==="V2"?await derivePasswordBasedKeyV2(a,hex2Bytes(et)):await derivePasswordBasedKeyV1(a,hex2Bytes(et)),nt=await crypto.subtle.decrypt({name:AES_MODE,iv:hex2Bytes(j)},rt,hex2Bytes(tt));return Buffer$g.from(nt).toString("utf-8")}catch{throw new Error("Error decrypting data: Invalid password")}},changeMnemonicPassword=createAsyncThunk("accounts/changeMnemonicPassword",async({currentPassword:_,newPassword:a},{getState:$})=>{if(_===a)throw new Error("New password must be different from the current password");const{items:j,seedPhrases:et}=$().accounts;if(j.filter(rt=>rt.type==="mnemonic").length===0)throw new Error("No mnemonic accounts found");const tt=await Promise.all(Object.entries(et).map(async([rt,nt])=>{if(!nt)throw new Error("No encrypted mnemonic found");try{const it=await decrypt$1(nt,_),ot=await encrypt$1(it,a);return[rt,ot]}catch(it){throw new Error(it.message)}}));return{newEncryptedMnemonics:lodashExports.fromPairs(tt)}}),initialState$8={items:[],seedPhrases:{},secretKeys:{}},accountsSlice=createSlice({name:"accounts",initialState:initialState$8,extraReducers:_=>{_.addCase(changeMnemonicPassword.fulfilled,(a,$)=>{const{newEncryptedMnemonics:j}=$.payload;a.seedPhrases=j})},reducers:{reset:()=>initialState$8,removeMnemonicAndAccounts:(_,{payload:a})=>{const{fingerPrint:$}=a,j=_.items.filter(et=>!(et.type==="mnemonic"&&et.seedFingerPrint===$));_.items=j,delete _.seedPhrases[$]},removeNonMnemonicAccounts:(_,{payload:a})=>{_.items=lodashExports.remove(_.items,$=>$.type==="mnemonic"||$.type!==a.accountType),a.accountType==="secret_key"&&(_.secretKeys={})},removeAccount:(_,{payload:a})=>{lodashExports.remove(_.items,$=>$.address.pkh===a.address.pkh),a.type==="secret_key"&&delete _.secretKeys[a.address.pkh]},renameAccount:(_,{payload:a})=>{const{account:$,newName:j}=a;if(j.length===0)throw new Error("Cannot rename account to an empty name.");if(_.items.find(tt=>tt.label===j))throw new Error(`Cannot rename account ${$.address.pkh} to ${j} since the name already exists.`);const et=_.items.find(tt=>tt.address.pkh===$.address.pkh&&tt.label===$.label);et&&(et.label=j)},addAccount:(_,{payload:a})=>{_.items=concatUnique(_.items,[a])},addMnemonicAccounts:(_,{payload:{encryptedMnemonic:a,accounts:$,seedFingerprint:j}})=>{_.items=concatUnique(_.items,$),_.seedPhrases[j]=a},addSecretKey:(_,{payload:{pkh:a,encryptedSecretKey:$}})=>{_.secretKeys[a]=$}}}),concatUnique=(_,a)=>(a.forEach($=>{if(_.some(j=>j.address.pkh===$.address.pkh))throw new Error(`Can't add account with address ${$.address.pkh} because it already exists.`)}),[..._,...a]);accountsSlice.actions;const FA12TokenSchema=z.object({standard:z.string().regex(/^fa1\.2$/i),contract:Schema$1}),FA2TokenSchema=z.object({standard:z.string().regex(/^fa2$/i),tokenId:z.string(),contract:Schema$1}),NFTSchema=z.object({id:z.number(),standard:z.string().regex(/^fa2$/i),tokenId:z.string(),contract:Schema$1,totalSupply:z.string().optional(),metadata:z.object({displayUri:z.string(),decimals:z.void().or(z.string().regex(/^0$/))})}),fromRaw$1=_=>{const a=_.metadata;if(_.standard==="fa1.2"){const et=FA12TokenSchema.safeParse(_);return et.success?{type:"fa1.2",metadata:a,contract:et.data.contract.address,tokenId:"0"}:(console.warn("Invalid FA1 token: "+JSON.stringify(_)),null)}const $=NFTSchema.safeParse(_);if($.success)return{metadata:a,type:"nft",id:$.data.id,contract:$.data.contract.address,tokenId:$.data.tokenId,displayUri:$.data.metadata.displayUri,totalSupply:$.data.totalSupply};const j=FA2TokenSchema.safeParse(_);return j.success?{type:"fa2",metadata:a,contract:j.data.contract.address,tokenId:j.data.tokenId}:(console.warn("Invalid FA2 token: "+JSON.stringify(_)),null)},fullId=_=>`${_.contract}:${_.tokenId}`,defaultTokenName=_=>{switch(_.type){case"fa1.2":return DEFAULT_FA1_NAME;case"fa2":return DEFAULT_FA2_NAME;case"nft":return DEFAULT_NFT_NAME}},tokenNameSafe=_=>tokenName(_)||defaultTokenName(_),tokenName=_=>{var a;return(a=_.metadata)==null?void 0:a.name},defaultTokenSymbol=_=>{switch(_.type){case"fa1.2":return DEFAULT_FA1_SYMBOL;case"fa2":return DEFAULT_FA2_SYMBOL;case"nft":return DEFAULT_NFT_SYMBOL}},tokenSymbolSafe=_=>tokenSymbol(_)||defaultTokenSymbol(_),tokenSymbol=_=>{var a;return(a=_.metadata)==null?void 0:a.symbol},tokenDecimals=_=>{var a;return((a=_.metadata)==null?void 0:a.decimals)??DEFAULT_TOKEN_DECIMALS},getRealAmount=(_,a)=>{const $=new BigNumber(a),j=tokenDecimals(_);return $.multipliedBy(new BigNumber(10).exponentiatedBy(j)).toFixed()},formatTokenAmount=(_,a=DEFAULT_TOKEN_DECIMALS)=>{const $=BigNumber(_).dividedBy(BigNumber(10).pow(a));try{return new Intl.NumberFormat("en-US",{minimumFractionDigits:Number(a),maximumFractionDigits:Number(a)}).format($.toNumber())}catch{return console.warn(`Can't format token amount with decimals = ${a}`),formatTokenAmount(_,"0")}},tokenPrettyAmount=(_,a,$)=>{var nt;if(a.type==="nft")return _;const j=tokenSymbolSafe(a),et=(nt=a.metadata)==null?void 0:nt.decimals,tt=$!=null&&$.showSymbol?` ${j}`:"";return`${formatTokenAmount(_,et)}${tt}`},artifactUri=_=>_.metadata.artifactUri||_.displayUri,thumbnailUri=_=>_.metadata.thumbnailUri||_.displayUri,mimeType=_=>{var a,$;return($=(a=_.metadata.formats)==null?void 0:a.find(j=>j.uri===artifactUri(_)))==null?void 0:$.mimeType},royalties=_=>{const a=_.metadata.royalties;if(!a)return[];const $=Math.pow(10,Number(a.decimals)),j=Object.entries(a.shares).map(([et,tt])=>({address:et,share:Number(tt)*100/$}));return j.sort((et,tt)=>et.share`${tokenUri(_,a)}/metadata`,tokenUri=({contract:_,tokenId:a},$)=>`${$.tzktExplorerUrl}/${_}/tokens/${a}`,DEFAULT_FA1_NAME="FA1.2 token",DEFAULT_FA2_NAME="FA2 token",DEFAULT_NFT_NAME="NFT",DEFAULT_FA1_SYMBOL="FA1.2",DEFAULT_FA2_SYMBOL="FA2",DEFAULT_NFT_SYMBOL="NFT",DEFAULT_TOKEN_DECIMALS="0",fromRaw=_=>{const a=fromRaw$1(_.token);return!a||!_.balance?null:{balance:_.balance,lastLevel:_.lastLevel,...a}},keepNFTs=_=>_.filter(a=>a.type==="nft"),keepFA1s=_=>_.filter(a=>a.type==="fa1.2"),keepFA2s=_=>_.filter(a=>a.type==="fa2"),initialState$7={blockLevel:null,balances:{mutez:{},tokens:{}},transfers:{tokens:{}},delegationLevels:{},bakers:[],conversionRate:void 0,refetchTrigger:0,isLoading:!1,lastTimeUpdated:null},assetsSlice=createSlice({name:"assets",initialState:initialState$7,extraReducers:_=>_.addCase(accountsSlice.actions.reset,()=>initialState$7),reducers:{reset:()=>initialState$7,updateBlockLevel:(_,{payload:a})=>{_.blockLevel=a},updateTokenTransfers:(_,{payload:a})=>{a.forEach($=>{_.transfers.tokens[$.transactionId]=$})},updateTezBalance:(_,{payload:a})=>{_.balances.mutez=a.reduce(($,j)=>({...$,[j.address]:String(j.balance)}),{}),_.delegationLevels=a.reduce(($,j)=>({...$,[j.address]:j.delegationLevel}),{})},updateTokenBalance:(_,{payload:a})=>{const $=lodashExports.groupBy(a,j=>j.account.address);_.balances.tokens=lodashExports.mapValues($,j=>lodashExports.compact(j.map(fromRaw)).map(({balance:et,contract:tt,tokenId:rt,lastLevel:nt})=>({balance:et,contract:tt,tokenId:rt,lastLevel:nt})))},removeAccountsData:(_,{payload:a})=>{a.forEach($=>{delete _.balances.mutez[$],delete _.balances.tokens[$],delete _.delegationLevels[$]})},updateBakers:(_,{payload:a})=>{_.bakers=a},updateConversionRate:(_,{payload:a})=>{_.conversionRate=a},refetch:_=>{_.refetchTrigger+=1},setIsLoading:(_,{payload:a})=>{_.isLoading=a},setLastTimeUpdated:(_,{payload:a})=>{_.lastTimeUpdated=a}}}),assetsActions=assetsSlice.actions,MAINNET={name:"mainnet",rpcUrl:"https://prod.tcinfra.net/rpc/mainnet/",tzktApiUrl:"https://api.mainnet.tzkt.io",tzktExplorerUrl:"https://tzkt.io",buyTezUrl:"https://widget.wert.io"},GHOSTNET={name:"ghostnet",rpcUrl:"https://ghostnet.ecadinfra.com",tzktApiUrl:"https://api.ghostnet.tzkt.io",tzktExplorerUrl:"https://ghostnet.tzkt.io",buyTezUrl:"https://faucet.ghostnet.teztnets.com/"},isDefault=_=>DefaultNetworks.map(a=>a.name).includes(_.name),DefaultNetworks=[MAINNET,GHOSTNET],initialState$6=lodashExports.fromPairs(DefaultNetworks.map(_=>[_.name,[]])),batchesSlice=createSlice({name:"batches",initialState:initialState$6,reducers:{reset:()=>initialState$6,add:(_,{payload:{operations:a,network:$}})=>{$.name in _||(_[$.name]=[]);const j=_[$.name],et=j.find(tt=>tt.sender.address.pkh===a.sender.address.pkh);if(et){et.operations.push(...a.operations);return}j.push(a)},clear:(_,{payload:{pkh:a,network:$}})=>{const j=_[$.name]||[],et=lodashExports.findIndex(j,tt=>tt.sender.address.pkh===a);et!==-1&&j.splice(et,1)},removeItem:(_,{payload:{pkh:a,index:$,network:j}})=>{const et=_[j.name]||[],tt=lodashExports.findIndex(et,nt=>nt.sender.address.pkh===a);if(tt===-1)return;const rt=et[tt];$lodashExports.fromPairs(Object.entries(_).map(([$,j])=>{const et=(j||[]).filter(tt=>!a.includes(tt.sender.address.pkh));return[$,et]}))}}),batchesActions=batchesSlice.actions,initialState$5={},beaconSlice=createSlice({name:"beacon",initialState:initialState$5,reducers:{reset:()=>initialState$5,addConnection:(_,{payload:a})=>{_[a.dAppId]={accountPkh:a.accountPkh,networkType:a.networkType}},removeConnection:(_,{payload:a})=>{delete _[a]},removeConnections:(_,{payload:a})=>lodashExports.fromPairs(Object.entries(_).filter(([$,j])=>!a.includes(j.accountPkh)))}});beaconSlice.actions;const initialState$4={},contactsSlice=createSlice({name:"contacts",initialState:initialState$4,reducers:{reset:()=>initialState$4,upsert:(_,{payload:a})=>{_[a.pkh]=a},remove:(_,{payload:a})=>{delete _[a]}}}),contactsActions=contactsSlice.actions,MAX_ERRORS_LEN=100,initialState$3=[],errorsSlice=createSlice({name:"errors",initialState:initialState$3,reducers:{reset:()=>initialState$3,add(_,{payload:a}){_.length===MAX_ERRORS_LEN&&_.shift(),_.push(a)}}}),initialState$2={items:[],pendingOperations:{},labelsMap:{}},multisigsSlice=createSlice({name:"multisigs",initialState:initialState$2,reducers:{reset:()=>initialState$2,mockAddAccount:(_,{payload:a})=>{_.items.push({label:`Multisig Account ${_.items.length}`,type:"multisig",...a})},setMultisigs:(_,{payload:a})=>{const $=lodashExports.fromPairs(_.items.map(j=>[j.address.pkh,j.label]));_.items=a.map((j,et)=>({...j,label:$[j.address.pkh]||_.labelsMap[j.address.pkh]||`Multisig Account ${et}`,type:"multisig"}))},addMultisigLabel:(_,{payload:{pkh:a,label:$}})=>{_.labelsMap[a]=$},setPendingOperations:(_,{payload:a})=>{_.pendingOperations=lodashExports.groupBy(a,$=>$.bigmapId)},setName:(_,{payload:a})=>{const{account:{address:{pkh:$}},newName:j}=a,et=_.items.find(tt=>tt.address.pkh===$);et&&(et.label=j)},removeMultisigsData:(_,{payload:a})=>{const $=_.items.filter(j=>a.includes(j.address.pkh)).map(j=>String(j.pendingOperationsBigmapId));_.pendingOperations=lodashExports.omit(_.pendingOperations,$),_.labelsMap=lodashExports.omit(_.labelsMap,a)}}}),multisigActions=multisigsSlice.actions,initialState$1={available:DefaultNetworks,current:MAINNET},networksSlice=createSlice({name:"networks",initialState:initialState$1,reducers:{reset:()=>initialState$1,setCurrent:(_,{payload:a})=>{_.current=a},upsertNetwork:(_,{payload:a})=>{if(isDefault(a))return;const $=_.available.findIndex(j=>j.name===a.name);if(_.current.name===a.name&&(_.current=a),$!==-1){_.available[$]=a;return}_.available.push(a)},removeNetwork:(_,{payload:a})=>{isDefault(a)||lodashExports.remove(_.available,$=>$.name===a.name)}}}),networksActions=networksSlice.actions,initialState=lodashExports.fromPairs(DefaultNetworks.map(_=>[_.name,{}])),tokensSlice=createSlice({name:"tokens",initialState,reducers:{reset:()=>initialState,addTokens:(_,{payload:{network:a,tokens:$}})=>{lodashExports.compact($.map(fromRaw$1)).forEach(j=>{lodashExports.setWith(_,[a.name,j.contract,j.tokenId],j,Object)})}}}),tokensActions=tokensSlice.actions,rootPersistConfig={key:"root",version:VERSION$1,storage:default_1,blacklist:["accounts"],migrate:createAsyncMigrate(mainStoreMigrations)},accountsPersistConfig={key:"accounts",version:VERSION$1,storage:default_1,migrate:createAsyncMigrate(accountsMigrations)},rootReducers=combineReducers({accounts:persistReducer(accountsPersistConfig,accountsSlice.reducer),announcement:announcementSlice.reducer,assets:assetsSlice.reducer,batches:batchesSlice.reducer,beacon:beaconSlice.reducer,contacts:contactsSlice.reducer,errors:errorsSlice.reducer,multisigs:multisigsSlice.reducer,networks:networksSlice.reducer,tokens:tokensSlice.reducer}),reducer=persistReducer(rootPersistConfig,rootReducers),store=configureStore({reducer,middleware:_=>_({serializableCheck:{ignoredActions:[FLUSH,REHYDRATE,PAUSE,PERSIST,PURGE,REGISTER]}})}),persistor=persistStore(store),FormErrorMessage=({children:_,...a})=>jsxRuntimeExports.jsxs(FormErrorMessage$1,{color:colors.orange,fontSize:"12px",...a,children:[jsxRuntimeExports.jsx(Icon,{as:ExclamationIcon,marginRight:"6px"}),_]}),CONFIRMATION_CODE="wasabi",reset=()=>WalletClient.destroy().catch(lodashExports.noop).finally(()=>{persistor.pause(),localStorage.clear(),window.location.reload()}),OffboardingForm=()=>{const _=useForm({mode:"onBlur"}),{register:a,handleSubmit:$,formState:{isValid:j,errors:et},getValues:tt}=_,rt=()=>{if(!(!tt("check")||tt("confirmationCode")!==CONFIRMATION_CODE))return reset()};return jsxRuntimeExports.jsx(FormProvider,{..._,children:jsxRuntimeExports.jsxs("form",{onSubmit:$(rt),children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalHeader,{marginBottom:"10px",textAlign:"center",children:jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(WarningIcon,{width:"40px",height:"40px",marginBottom:"20px"}),jsxRuntimeExports.jsx(Heading,{children:"Off-board Wallet"})]})}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Text,{marginBottom:"8px",color:colors.gray[400],fontWeight:"bold",textAlign:"center",size:"sm",children:"This will permanently remove any data from this computer."}),jsxRuntimeExports.jsxs(Text,{color:colors.gray[400],textAlign:"center",size:"sm",children:["Please enter « ",CONFIRMATION_CODE," » to confirm. The accounts are still available to be imported in the future; in order to regain access to your accounts, please make sure that you keep the recovery phrase."]}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Divider,{borderColor:colors.gray[700],marginY:"20px"}),jsxRuntimeExports.jsx(FormControl,{isInvalid:!!et.check,children:jsxRuntimeExports.jsx(Checkbox,{...a("check",{required:!0}),children:jsxRuntimeExports.jsx(Text,{marginLeft:"8px",fontWeight:"bold",children:"I have read the warning and I am certain I want to remove my private keys locally. I also made sure to keep my recovery phrase."})})}),jsxRuntimeExports.jsx(Divider,{borderColor:colors.gray[700],marginY:"20px"}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!et.confirmationCode,paddingY:5,children:[jsxRuntimeExports.jsx(Input,{type:"text",...a("confirmationCode",{required:"Confirmation is required",validate:nt=>nt===CONFIRMATION_CODE||"Confirmation code does not match"}),placeholder:"Enter code word to confirm"}),et.confirmationCode&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.confirmationCode.message})]})]})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:0,children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:"8px",isDisabled:!j,size:"lg",type:"submit",variant:"warning",children:"Confirm"})})]})})},useOffboardingModal=()=>{const{isOpen:_,onOpen:a,onClose:$}=useDisclosure$1();return{modalElement:jsxRuntimeExports.jsxs(Modal,{isCentered:!0,isOpen:_,onClose:$,children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(ModalContent,{background:colors.gray[900],children:jsxRuntimeExports.jsx(OffboardingForm,{})})]}),onOpen:a}},CircleIcon=({icon:_,size:a,onClick:$=()=>{}})=>jsxRuntimeExports.jsx(Box,{width:a,height:a,margin:"auto",background:colors.gray[700],borderRadius:"full",onClick:$,children:jsxRuntimeExports.jsx(Center,{height:"100%",children:_})}),ModalContentWrapper=({children:_,icon:a,title:$,subtitle:j})=>jsxRuntimeExports.jsxs(VStack,{maxHeight:"83vh",spacing:0,children:[jsxRuntimeExports.jsx(Box,{marginBottom:"16px",children:jsxRuntimeExports.jsx(CircleIcon,{icon:a,size:"48px"})}),jsxRuntimeExports.jsxs(Center,{flexDirection:"column",width:"340px",marginBottom:"32px",children:[jsxRuntimeExports.jsx(Heading,{lineHeight:"26px",size:"xl",children:$}),j&&jsxRuntimeExports.jsx(Text,{marginTop:"10px",color:colors.gray[400],lineHeight:"18px",textAlign:"center",size:"sm",children:j})]}),_]}),name="umami",productName="umami",version="2.2.0",author="Trilitech ",description="Tezos Wallet",homepage="https://umamiwallet.com",repository="https://github.com/trilitech/umami-v2",license="MIT",engines={node:">=20 <21.0.0"},type$5="commonjs",main="build/electron.js",scripts={build:"vite build",dev:"vite dev",preview:"vite preview","electron:package:linux":"electron-builder -l","electron:package:mac":"electron-builder -m","electron:package:mac:debug":"DEBUG=true yarn build --mode dev && sed -i='' 's@devTools: false@devTools: true@g' build/electron.js && yarn electron:package:mac -c electron-builder.dev.yml && rm -rf build","electron:package:win":"electron-builder -w","electron:start":"electronmon .",docs:"typedoc --tsconfig tsconfig.e2e.json","format:ci":"prettier --check .",format:"prettier --write .","lint:ci":"eslint src --ext .js,.jsx,.ts,.tsx --max-warnings=0",lint:"eslint src --ext .js,.jsx,.ts,.tsx --fix",test:"cross-env TZ=CET jest","test:watch":"cross-env DEV=true yarn test --watch","test:e2e":"cross-env TS_NODE_PROJECT=tsconfig.e2e.json cucumber-js","test:e2e:focus":"yarn test:e2e --tags='@focus'","theme:watch":"chakra-cli tokens src/style/theme.ts --watch",theme:"chakra-cli tokens src/style/theme.ts"},devDependencies={"@airgap/beacon-wallet":"^4.2.2","@babel/core":"^7.24.7","@babel/preset-env":"^7.24.7","@babel/preset-react":"^7.24.7","@babel/preset-typescript":"^7.24.7","@babel/runtime":"^7.24.7","@chakra-ui/anatomy":"2.2.2","@chakra-ui/cli":"^2.4.1","@chakra-ui/icons":"^2.1.1","@chakra-ui/react":"^2.8.2","@chakra-ui/styled-system":"2.9.2","@chakra-ui/system":"^2.6.2","@chriscdn/promise-semaphore":"^2.0.9","@cucumber/cucumber":"^10.8.0","@electron/notarize":"^2.3.2","@emotion/react":"^11.11.4","@emotion/styled":"^11.11.5","@ledgerhq/hw-transport-webusb":"^6.28.6","@playwright/test":"^1.44.1","@reduxjs/toolkit":"^2.2.5","@stylistic/eslint-plugin":"^2.1.0","@tanstack/eslint-plugin-query":"^5.43.1","@tanstack/react-query":"^5.40.1","@tanstack/react-query-devtools":"^5.40.1","@taquito/ledger-signer":"^19.2.1","@taquito/michel-codec":"^19.2.1","@taquito/rpc":"^19.2.1","@taquito/signer":"^19.2.1","@taquito/taquito":"19.2.1","@taquito/utils":"^19.2.1","@testing-library/dom":"^10.1.0","@testing-library/jest-dom":"6.4.5","@testing-library/react":"14.3.1","@testing-library/user-event":"14.5.2","@toruslabs/customauth":"^16.0.6","@types/babel__core":"^7.20.5","@types/babel__preset-env":"^7.9.6","@types/identity-obj-proxy":"^3.0.2","@types/jest":"^29.5.12","@types/md5":"^2.3.5","@types/node":"20.14.2","@types/papaparse":"^5.3.14","@types/pluralize":"^0.0.33","@types/promise-retry":"^1.1.6","@types/react":"18.3.3","@types/react-dom":"18.3.0","@types/react-test-renderer":"^18.3.0","@typescript-eslint/eslint-plugin":"^7.12.0","@typescript-eslint/parser":"^7.12.0","@tzkt/sdk-api":"^2.2.1","@vitejs/plugin-react":"^4.3.1",axios:"^1.7.2","babel-jest":"^29.7.0","bignumber.js":"^9.1.2",bip39:"^3.1.0",concurrently:"^8.2.2","cross-env":"^7.0.3","date-fns":"^3.6.0",electron:"^30.1.0","electron-builder":"^24.13.3",electronmon:"^2.0.3",eslint:"^8.57.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-chakra-ui":"^0.11.0","eslint-plugin-deprecation":"^3.0.0","eslint-plugin-import":"^2.29.1","eslint-plugin-jest":"^28.6.0","eslint-plugin-jest-dom":"^5.4.0","eslint-plugin-playwright":"^1.6.2","eslint-plugin-react":"^7.34.2","eslint-plugin-react-hooks":"^4.6.2","eslint-plugin-react-redux":"^4.1.0","eslint-plugin-testing-library":"^6.2.2","eslint-plugin-tsdoc":"^0.3.0","eslint-plugin-unused-imports":"^3.2.0","framer-motion":"^11.2.10","http-server":"^14.1.1","identity-obj-proxy":"^3.0.0",immer:"^10.1.1",jest:"29.7.0","jest-canvas-mock":"^2.5.2","jest-environment-jsdom":"^29.7.0","jest-fail-on-console":"^3.3.0","jest-resolve":"29.7.0","jest-watch-typeahead":"^2.2.2",lodash:"^4.17.21",md5:"^2.3.0",mockdate:"^3.0.5",ordinal:"^1.0.3",papaparse:"^5.4.1",pluralize:"^8.0.0",prettier:"^3.3.1","prettier-plugin-gherkin":"^2.2.1",process:"^0.11.10","promise-retry":"^2.0.1",react:"^18.3.1","react-dom":"^18.3.1","react-error-boundary":"^4.0.13","react-hook-form":"^7.51.5","react-hooks-testing-library":"^0.6.0","react-player":"^2.16.0","react-qrcode-logo":"^3.0.0","react-redux":"9.1.2","react-refresh":"^0.14.2","react-remove-scroll":"^2.5.10","react-responsive-carousel":"^3.2.23","react-router-dom":"^6.23.1","react-test-renderer":"^18.3.1",redux:"^5.0.1","redux-persist":"^6.0.0","ts-node":"^10.9.2",typedoc:"^0.25.13","typedoc-plugin-missing-exports":"^2.2.0",typescript:"5.4.5",vite:"^5.2.13","vite-plugin-checker":"^0.6.4","vite-plugin-node-polyfills":"^0.22.0",zipurl:"^0.2.18",zod:"^3.23.8"},packageManager="yarn@4.3.0",dependencies={"electron-updater":"^6.2.1"},resolutions={jsdom:"^23.0.1","@types/jsdom":"^21.1.6"},packageInfo={name,productName,version,author,description,homepage,repository,license,engines,type:type$5,main,scripts,devDependencies,packageManager,dependencies,resolutions};var withSelector={exports:{}},useSyncExternalStoreWithSelector_production_min={};/** * @license React * use-sync-external-store-with-selector.production.min.js * @@ -542,7 +542,7 @@ License: MIT "main main" `,height:"100%",children:[jsxRuntimeExports.jsx(GridItem,{gridArea:"header",children:jsxRuntimeExports.jsx(TopBar,{title:"Help"})}),jsxRuntimeExports.jsxs(GridItem,{gridArea:"main",marginTop:1,children:[jsxRuntimeExports.jsx(HelpCard,{title:"Learn More",children:jsxRuntimeExports.jsx(HelpLinkRow,{about:"Browse Articles",externalLink:"https://medium.com/umamiwallet"})}),jsxRuntimeExports.jsxs(HelpCard,{title:"Need Help?",children:[jsxRuntimeExports.jsx(HelpLinkRow,{about:"Contact our Support Team",externalLink:"mailto:umami-support@trili.tech",linkDescription:"umami-support@trili.tech"}),jsxRuntimeExports.jsx(HelpLinkRow,{about:"Get in touch with the Community",externalLink:"https://join.slack.com/t/tezos-dev/shared_invite/zt-1ur1ymxrp-G_X_bFHrvWXwoeiy53J8lg",linkDescription:"Slack #Umami"})]}),jsxRuntimeExports.jsxs(HelpCard,{title:"Terms",children:[jsxRuntimeExports.jsx(HelpLinkRow,{about:"Read Terms of Service",externalLink:"https://umamiwallet.com/tos.html"}),jsxRuntimeExports.jsx(HelpLinkRow,{about:"Read Privacy Policy",externalLink:"https://umamiwallet.com/privacypolicy.html"})]})]})]}),HelpLinkRow=({about:_,externalLink:a,linkDescription:$})=>jsxRuntimeExports.jsx(Link,{rel:"noopener noreferrer",target:"_blank",to:a,children:jsxRuntimeExports.jsx(ClickableCard,{cursor:"pointer",isSelected:!1,children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Heading,{size:"sm",children:_}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[$&&jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[400],size:"sm",children:$}),jsxRuntimeExports.jsx(ExternalLinkIcon,{})]})]})})}),HelpCard=({title:_,children:a})=>jsxRuntimeExports.jsx(Box,{"data-testid":"help-card",marginY:"10px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsxs(Box,{width:"550px",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"16px",size:"lg",children:_}),a]})})}),ConnectOptions=({goToStep:_})=>{const a=useImplicitAccounts().length>0;return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(LinkIcon,{}),title:"Connect or Import Account",children:jsxRuntimeExports.jsxs(VStack,{width:"100%",spacing:"16px",children:[jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"restoreMnemonic"}),size:"lg",children:"Import with Seed Phrase"}),jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"restoreSecretKey"}),size:"lg",variant:"tertiary",children:"Import with Secret Key"}),!a&&jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"restoreBackup"}),size:"lg",variant:"tertiary",children:"Restore from Backup"}),jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"nameAccount",account:{type:"ledger"}}),size:"lg",variant:"tertiary",children:"Connect ledger"})]})})},withTimeout=(_,a,$)=>Promise.race([_(),new Promise((j,et)=>setTimeout(()=>{et(new Error("The operation has timed out"))},a))]),LOGIN_TIMEOUT=minutesToMilliseconds(1),useOnboardWithSocial=(_,a)=>{const $=useToast(),{isLoading:j,handleAsyncAction:et}=useAsyncActionHandler(),tt=useRestoreSocial(),rt=reactExports.useCallback(()=>et(async()=>{const{secretKey:nt,name:it}=await withTimeout(()=>forIDP(_).getCredentials(),LOGIN_TIMEOUT),{pk:ot,pkh:st}=await getPublicKeyPairFromSk(nt);tt(ot,st,it,_),$({description:`Successfully added ${it} account`,status:"success"}),a()},{title:"Social login failed"}),[_,$,et,tt,a]);return{isLoading:j,onboard:rt}},OnboardWithFacebookButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("facebook",_);return jsxRuntimeExports.jsx(IconButton,{"aria-label":"Facebook SSO","data-testid":"login-button-facebook",icon:jsxRuntimeExports.jsx(FacebookIcon,{}),isLoading:a,onClick:$,variant:"socialLogin"})},OnboardWithGoogleButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("google",_);return jsxRuntimeExports.jsx(IconButton,{"aria-label":"Google SSO","data-testid":"login-button-google",icon:jsxRuntimeExports.jsx(GoogleIcon,{}),isLoading:a,onClick:$,variant:"socialLogin"})},OnboardWithRedditButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("reddit",_);return jsxRuntimeExports.jsx(IconButton,{"aria-label":"Reddit SSO","data-testid":"login-button-reddit",icon:jsxRuntimeExports.jsx(RedditIcon,{}),isLoading:a,onClick:$,variant:"socialLogin"})},OnboardWithTwitterButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("twitter",_);return jsxRuntimeExports.jsx(IconButton,{color:"black","aria-label":"Twitter SSO","data-testid":"login-button-twitter",icon:jsxRuntimeExports.jsx(TwitterIcon,{fill:"currentColor"}),isLoading:a,onClick:$,variant:"socialLogin"})},IS_DEV=!1,ConnectOrCreate=({goToStep:_,closeModal:a})=>jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(WalletPlusIcon,{}),title:"Connect or Create Account",children:jsxRuntimeExports.jsxs(VStack,{width:"100%",spacing:"16px",children:[jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"notice"}),size:"lg",children:"Create a new Account"}),jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"connectOptions"}),size:"lg",variant:"tertiary",children:"I already have a wallet"}),IS_DEV,jsxRuntimeExports.jsxs(Flex,{width:"100%",paddingTop:"14px",paddingBottom:"6px",children:[jsxRuntimeExports.jsx(Divider,{marginTop:"11px"}),jsxRuntimeExports.jsx(Text,{minWidth:"160px",color:colors.gray[400],textAlign:"center",noOfLines:1,size:"sm",children:"Continue with social"}),jsxRuntimeExports.jsx(Divider,{marginTop:"11px"})]}),jsxRuntimeExports.jsxs(Flex,{gap:"12px",children:[jsxRuntimeExports.jsx(OnboardWithGoogleButton,{onAuth:a}),jsxRuntimeExports.jsx(OnboardWithFacebookButton,{onAuth:a}),jsxRuntimeExports.jsx(OnboardWithTwitterButton,{onAuth:a}),jsxRuntimeExports.jsx(OnboardWithRedditButton,{onAuth:a})]})]})}),Select=({selected:_,options:a,onChange:$})=>{const[j,et]=reactExports.useState(_),[tt,rt]=reactExports.useState(!1);return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",height:"48px",padding:"12px 15px 15px 15px",color:colors.gray[300],background:colors.gray[800],border:"1px solid",borderColor:colors.gray[500],borderRadius:"4px",_hover:{borderColor:colors.gray[450]},cursor:"pointer","data-testid":"select-input",onClick:()=>rt(nt=>!nt),children:[jsxRuntimeExports.jsx(Text,{size:"sm",children:j.label}),jsxRuntimeExports.jsx(ChevronDownIcon$1,{marginTop:"2px"})]}),tt&&jsxRuntimeExports.jsx(UnorderedList,{position:"absolute",zIndex:2,width:"100%",margin:0,marginTop:"8px",padding:"15px",background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],borderRadius:"8px","data-testid":"select-options",listStyleType:"none",children:a.map(nt=>jsxRuntimeExports.jsx(ListItem,{marginBottom:"5px",padding:"11px",color:colors.gray[300],background:"transparent",borderRadius:"4px",_hover:{background:colors.gray[500]},cursor:"pointer",onClick:()=>{rt(!1),et(nt),$(nt.value)},children:jsxRuntimeExports.jsx(Text,{size:"sm",children:nt.label})},nt.value))})]})},DerivationPath=({goToStep:_,account:a})=>{const[$,j]=reactExports.useState(!1),{handleSubmit:et,register:tt,setValue:rt,formState:{isValid:nt,errors:it}}=useForm({mode:"onBlur",defaultValues:{derivationPathTemplate:defaultDerivationPathTemplate,derivationPath:getDefaultDerivationPath(0)}}),ot=async({derivationPathTemplate:st,derivationPath:ct})=>{switch(a.type){case"ledger":return _($?{type:"restoreLedger",account:{...a,derivationPath:normalizeDerivationPath(ct)}}:{type:"restoreLedger",account:{...a,derivationPathTemplate:normalizeDerivationPath(st)}});case"mnemonic":{if($){const ut=await deriveSecretKey(a.mnemonic,ct,"ed25519");return _({type:"masterPassword",account:{type:"secret_key",secretKey:ut,label:a.label}})}return _({type:"masterPassword",account:{...a,derivationPathTemplate:st}})}}};return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(SlashIcon,{}),subtitle:"Choose a custom derivation path or select the default derivation path and use the default key.",title:"Derivation Path",children:jsxRuntimeExports.jsxs("form",{onSubmit:et(ot),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(Center,{width:"100%",marginBottom:"12px",children:[jsxRuntimeExports.jsx(Text,{fontWeight:$?400:600,size:"sm",children:"Default Path"}),jsxRuntimeExports.jsx(Switch,{"data-testid":"custom-path-switch",marginX:"10px",onChange:()=>j(st=>!st),variant:"danger"}),jsxRuntimeExports.jsx(Text,{fontWeight:$?600:400,size:"sm",children:"Custom Path"})]}),$&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Center,{marginTop:"16px",marginBottom:"32px",children:jsxRuntimeExports.jsx(Text,{width:"340px",color:colors.orange,textAlign:"center",size:"xs",children:"Please write down to your derivation path. You may not be able to restore your data if you lose it."})}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"20px",isInvalid:!!it.derivationPath,children:[jsxRuntimeExports.jsx(Input,{fontSize:"sm",textAlign:"center","data-testid":"custom-path-input",...tt("derivationPath",{validate:validateDerivationPath})}),it.derivationPath&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"error-message",children:it.derivationPath.message})]})]}),!$&&jsxRuntimeExports.jsx(FormControl,{marginTop:"32px",marginBottom:"20px",children:jsxRuntimeExports.jsx(Select,{onChange:st=>rt("derivationPathTemplate",st),options:AVAILABLE_DERIVATION_PATH_TEMPLATES,selected:DEFAULT_DERIVATION_PATH_TEMPLATE})}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"12px",isDisabled:!nt,size:"lg",type:"submit",children:"Continue"}),jsxRuntimeExports.jsx(ExternalLink,{display:"block",width:"100%",marginTop:"32px",textAlign:"center",href:"https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki",children:jsxRuntimeExports.jsx(Tooltip,{backgroundColor:"white",defaultIsOpen:!1,hasArrow:!0,label:"Derivation path is a set of directions that helps create different secret keys; it starts from a master key or seed.",children:jsxRuntimeExports.jsx(Text,{color:colors.blue,fontWeight:600,textDecoration:"underline",_hover:{textDecoration:"underline"},size:"sm",children:"What's a Derivation Path?"})})})]})})},normalizeDerivationPath=_=>_.trim().toLowerCase().replace("m/",""),validateDerivationPath=_=>{const a=normalizeDerivationPath(_);return a.length===0?"Derivation path is required":a.startsWith("44'/1729'/")?a.match(new RegExp("^44'/1729'/([0-9]+'/)*([0-9]+')$"))?!0:"Invalid derivation path":"Derivation path must start with `44'/1729'/`"},Eula=({goToStep:_})=>{const[a,$]=React$2.useState(!1);return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(DocumentIcon,{}),title:"Accept to Continue",children:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Checkbox,{paddingBottom:"24px",fontWeight:"600",onChange:j=>$(j.target.checked),children:["I confirm that I have read and agreed with the"," ",jsxRuntimeExports.jsx(Link$1,{textDecoration:"underline",_hover:{color:colors.green},href:"https://umamiwallet.com/tos.html",rel:"noopener noreferrer",target:"_blank",children:"Terms of Service"})," ","and the"," ",jsxRuntimeExports.jsx(Link$1,{textDecoration:"underline",_hover:{color:colors.green},href:"https://umamiwallet.com/privacypolicy.html",rel:"noopener noreferrer",target:"_blank",children:"Privacy Policy"})]}),jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!a,onClick:()=>{_({type:"connectOrCreate"})},size:"lg",children:"Continue"})]})})},FakeAccount=({onClose:_})=>{const{register:a,handleSubmit:$,formState:{errors:j}}=useForm({mode:"onBlur"}),et=useRestoreLedger(),tt=useRestoreSocial(),rt=async({pkh:nt,name:it,idp:ot})=>{if(ot&&ot.length>0&&!["google","facebook","twitter","reddit","email"].includes(ot))throw new Error("Invalid IDP");const ct=await new RpcClient(GHOSTNET.rpcUrl).getManagerKey(nt),ut=typeof ct=="string"?ct:ct.key;ot?tt(ut,nt,it,ot):et(defaultDerivationPathTemplate,makeDerivationPath(defaultDerivationPathTemplate,0),ut,nt,it),_()};return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(WalletPlusIcon,{}),title:"Add a Fake Account",children:jsxRuntimeExports.jsxs("form",{onSubmit:$(rt),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!j.pkh,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Address"}),jsxRuntimeExports.jsx(Input,{...a("pkh",{required:!0}),autoComplete:"off",placeholder:"Please enter the account address"})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"12px",isInvalid:!!j.name,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Name"}),jsxRuntimeExports.jsx(Input,{...a("name",{required:!0}),autoComplete:"off",placeholder:"Please enter the account name"})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"12px",isInvalid:!!j.idp,children:[jsxRuntimeExports.jsx(FormLabel,{children:"IDP (For a social account)"}),jsxRuntimeExports.jsx(Input,{...a("idp"),autoComplete:"off",placeholder:"Please enter the IDP"})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"12px",size:"lg",type:"submit",children:"Add account"})]})})},EnterAndConfirmPassword=({onSubmit:_,isLoading:a})=>{const $=useForm({mode:"onBlur"}),{handleSubmit:j,formState:{errors:et,isValid:tt},getValues:rt}=$,nt=({confirm:it})=>_(it);return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(LockIcon,{}),subtitle:"Please choose a master password for Umami. You will need to use this password in order to perform any operations within Umami.",title:"Umami Master Password",children:jsxRuntimeExports.jsx(FormProvider,{...$,children:jsxRuntimeExports.jsxs("form",{onSubmit:j(nt),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!et.password,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password",inputName:"password",placeholder:"Enter master password"}),et.password&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.password.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!et.confirm,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"confirmation",inputName:"confirm",label:"Confirm Password",placeholder:"Confirm your password",required:"Confirmation is required",validate:it=>rt("password")===it||"Your passwords do no match"}),et.confirm&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.confirm.message})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px",isDisabled:!tt||a,isLoading:a,size:"lg",type:"submit",children:"Submit"})]})})})},EnterPassword=({onSubmit:_,isLoading:a})=>{const $=useForm({mode:"onBlur"}),{handleSubmit:j,formState:{errors:et,isValid:tt}}=$,rt=nt=>{_(nt.password)};return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(LockIcon,{}),subtitle:"Enter your master password for Umami.",title:"Umami Master Password",children:jsxRuntimeExports.jsx(FormProvider,{...$,children:jsxRuntimeExports.jsxs("form",{onSubmit:j(rt),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!et.password,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password",inputName:"password"}),et.password&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.password.message})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px",isDisabled:!tt,isLoading:a,size:"lg",type:"submit",children:"Submit"})]})})})},MasterPassword=({account:_,onClose:a})=>{const $=useRestoreFromMnemonic(),j=useRestoreFromSecretKey(),et=useValidateMasterPassword(),tt=et!==null,{isLoading:rt,handleAsyncAction:nt}=useAsyncActionHandler(),it=useToast(),ot=st=>nt(async()=>{switch(tt&&await et(st),_.type){case"secret_key":await j(_.secretKey,st,_.label);break;case"mnemonic":await $({..._,password:st})}it({description:"Account successfully created!",status:"success"}),a()});return tt?jsxRuntimeExports.jsx(EnterPassword,{isLoading:rt,onSubmit:ot}):jsxRuntimeExports.jsx(EnterAndConfirmPassword,{isLoading:rt,onSubmit:ot})},Notice=({goToStep:_})=>{const a=[{content:"Write down your seed phrase and store it in a safe place."},{content:"Make sure there is no one around you or looking over your shoulder."},{content:"Do not copy and paste the Seed Phrase or store it on your device."},{content:"Do not take a screenshot of your Seed Phrase."}];return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(NoticeIcon,{}),subtitle:"Please read the following before you continue to see your secret Seed Phrase.",title:"Important Notice",children:jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(OrderedList,{spacing:"16px",variant:"onboardingNotice",children:a.map(($,j)=>jsxRuntimeExports.jsx(ListItem,{fontSize:"16px",fontWeight:600,children:$.content},j))}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"28px",onClick:()=>_({type:"showSeedphrase",account:{type:"mnemonic",mnemonic:generate24WordMnemonic()}}),size:"lg",children:"I understand"}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"16px",onClick:()=>_({type:"restoreMnemonic"}),size:"lg",variant:"tertiary",children:"I already have a Seed Phrase"})]})})},RestoreBackupFile=()=>{const _=useForm({mode:"onBlur"}),{handleSubmit:a,register:$,formState:{errors:j,isValid:et}}=_,{handleAsyncAction:tt}=useAsyncActionHandler(),rt=useRestoreV1BackupFile(),nt=({password:it,file:ot})=>tt(async()=>{const st=await ot[0].text(),ct=JSON.parse(st);if(ct.recoveryPhrases&&ct.derivationPaths)await rt(ct,it);else if(ct["persist:accounts"])await restoreV2BackupFile(ct,it),reload();else throw new Error("Invalid backup file.")});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(RotateIcon,{}),subtitle:"Select a JSON backup file and enter the password you used to encrypt it.",title:"Restore from Backup",children:jsxRuntimeExports.jsx(FormProvider,{..._,children:jsxRuntimeExports.jsx("form",{onSubmit:a(nt),style:{width:"100%"},children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!j.file,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Upload File"}),jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(Input,{padding:"2px","data-testid":"file-input",...$("file",{required:"File is required"}),accept:".json",type:"file",variant:"unstyled"})}),j.file&&jsxRuntimeExports.jsx(FormErrorMessage$1,{"data-testid":"file-errors",children:j.file.message})]}),jsxRuntimeExports.jsx(FormControl,{marginTop:"24px",children:jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password-input",inputName:"password",label:"Your password (if you have one)",required:!1})}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px",isDisabled:!et,size:"lg",type:"submit",children:"Import Wallet"})]})})})})},getPk=async _=>{const a=await TransportWebUSB.create(),$=new LedgerSigner(a,_,!0),j=await $.publicKey(),et=await $.publicKeyHash();return await a.close(),{pk:j,pkh:et}},LEDGER_TIMEOUT=60*1e3,RestoreLedger=({closeModal:_,account:a})=>{const $=useRestoreLedger(),j=useToast(),{isLoading:et,handleAsyncAction:tt}=useAsyncActionHandler(),rt=[{content:"Plug your Ledger into your computer using a USB cable."},{content:"Unlock your Ledger."},{content:"Make sure your Ledger has the latest firmware version."},{content:"Install and open the Tezos Wallet app on your Ledger."},{content:"Click the button below and confirm the action on your Ledger."}],nt=()=>tt(()=>withTimeout(async()=>{const it=j({description:"Please open the Tezos app on your Ledger and approve the operation",status:"info"}),ot=a.derivationPathTemplate?makeDerivationPath(a.derivationPathTemplate,0):a.derivationPath,{pk:st,pkh:ct}=await getPk(ot);$(a.derivationPathTemplate,ot,st,ct,a.label),j.close(it),j({description:"Account successfully created!",status:"success"}),_()},LEDGER_TIMEOUT),it=>it.name==="PublicKeyRetrievalError"?{description:"Request rejected. Please unlock your Ledger and open the Tezos app"}:it.name==="InvalidStateError"?{description:"Request pending. Check your ledger..."}:{description:`Ledger error. ${it.message||it.name}`});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(USBIcon,{}),subtitle:"Complete the steps to connect.",title:"Connect Ledger",children:jsxRuntimeExports.jsxs(VStack,{overflowY:"auto",spacing:"24px",children:[jsxRuntimeExports.jsx(OrderedList,{spacing:4,children:rt.map((it,ot)=>jsxRuntimeExports.jsx(ListItem,{children:it.content},ot))}),jsxRuntimeExports.jsx(Button,{width:"100%",isLoading:et,onClick:nt,size:"lg",children:"Export Public Key"})]})})},MnemonicAutocomplete=({inputName:_,validate:a,inputProps:$,listProps:j})=>{const[et,tt]=reactExports.useState(!0),{register:rt,setValue:nt,watch:it}=useFormContext(),ot=it(_),st=wordlists.EN.filter(ut=>ot&&ut.startsWith(ot)).sort(),ct=!et&&st.length>0&&(st.length>1||st[0]!==ot);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Input,{zIndex:0,autoComplete:"off","data-testid":"mnemonic-input",onFocus:()=>tt(!1),placeholder:"Type here...",...rt(_,{required:"Required",validate:a,onChange:()=>tt(!1),onBlur:()=>tt(!0)}),...$}),ct&&jsxRuntimeExports.jsx(UnorderedList,{"data-testid":"suggestions",variant:"suggestions",...j,children:st.map(ut=>jsxRuntimeExports.jsx(ListItem,{paddingTop:"2px",fontSize:"14px",fontWeight:600,"data-testid":"suggestion",onMouseDown:()=>nt(_,ut),paddingX:"7px",children:ut},ut))})]})},mnemonicSizes=[12,15,18,24],RestoreMnemonic=({goToStep:_})=>{const a=useForm({mode:"onBlur"}),{handleSubmit:$,setValue:j,trigger:et,formState:{isValid:tt}}=a,{handleAsyncAction:rt}=useAsyncActionHandler(),[nt,it]=reactExports.useState(24),ot=ut=>{const ht=Number(ut);if(mnemonicSizes.includes(ht))return it(Et=>(Et>ht&&lodashExports.range(ht,Math.max(...mnemonicSizes)).forEach(St=>{j(`word${St}`,void 0)}),ht)),et()},st=ut=>rt(async()=>{const ht=ut.split(" ");if(!mnemonicSizes.includes(ht.length))throw new Error(`the mnemonic must be ${mnemonicSizes.join(", ")} words long`);return ht.slice(0,nt).forEach((Et,St)=>{j(`word${St}`,Et)}),et()}),ct=ut=>rt(async()=>{const ht=Object.values(ut).join(" ").trim();if(!validateMnemonic_1(ht))throw new Error(`Invalid Mnemonic: "${ht}"`);return _({type:"nameAccount",account:{type:"mnemonic",mnemonic:ht}}),Promise.resolve()});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(KeyIcon,{width:"24px",height:"24px"}),subtitle:"Please fill in the Seed Phrase in sequence.",title:"Import Seed Phrase",children:jsxRuntimeExports.jsx(Box,{overflowX:"hidden",children:jsxRuntimeExports.jsx(FormProvider,{...a,children:jsxRuntimeExports.jsx("form",{onSubmit:$(ct),style:{width:"100%"},children:jsxRuntimeExports.jsxs(VStack,{width:"100%",spacing:4,children:[jsxRuntimeExports.jsx(Select$1,{height:"48px",color:colors.gray[450],"data-testid":"select",icon:jsxRuntimeExports.jsx(ChevronDownIcon,{}),onChange:ut=>ot(ut.target.value),value:nt,children:mnemonicSizes.reverse().map(ut=>jsxRuntimeExports.jsxs("option",{value:ut,children:[ut," Words"]},ut))}),jsxRuntimeExports.jsx(Grid,{gridGap:3,gridTemplateColumns:"repeat(3, 1fr)",paddingBottom:"20px",children:lodashExports.range(nt).map(ut=>{const ht=`word${ut}`;return jsxRuntimeExports.jsxs(GridItem,{display:"flex",height:"38px",padding:"4px",fontSize:"sm",background:colors.gray[800],border:"1px solid",borderColor:colors.gray[500],borderRadius:"4px",children:[jsxRuntimeExports.jsx(Heading,{width:"19px",marginRight:"6px",paddingTop:"6px",color:colors.gray[400],textAlign:"right",size:"sm",children:ut+1}),jsxRuntimeExports.jsx(MnemonicAutocomplete,{inputName:ht,inputProps:{onPaste:async Et=>{Et.preventDefault();const St=await navigator.clipboard.readText();return st(St)},border:"none",size:"xsmall"},listProps:{width:"126px",marginTop:"38px",marginLeft:"-5px"}})]},ut)})}),jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!tt,size:"lg",type:"submit",children:"Continue"}),IS_DEV]})})})})})},RestoreSecretKey=({goToStep:_})=>{const[a,$]=reactExports.useState(!1),{handleAsyncAction:j}=useAsyncActionHandler(),et=useForm({mode:"onBlur",defaultValues:{password:""}}),{register:tt,handleSubmit:rt,formState:{errors:nt,isValid:it}}=et,ot=async({secretKey:st,password:ct})=>j(async()=>{try{const ht=await(await InMemorySigner.fromSecretKey(st.trim(),ct)).secretKey();_({type:"nameAccount",account:{type:"secret_key",secretKey:ht}})}catch(ut){const ht=ut.message||"";throw ht.includes("Cannot read properties of null")?new Error("Key-password pair is invalid"):ht.includes("Invalid checksum")?new Error("Invalid secret key: checksum doesn't match"):ut}});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(KeyIcon,{width:"24px",height:"24px"}),title:"Insert Secret Key",children:jsxRuntimeExports.jsx(FormProvider,{...et,children:jsxRuntimeExports.jsxs("form",{onSubmit:rt(ot),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!nt.secretKey,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Secret Key"}),jsxRuntimeExports.jsx(Textarea,{minHeight:"130px","data-testid":"secret-key",...tt("secretKey",{required:"Secret key is required",onChange:st=>$(isEncryptedSecretKeyPrefix(st.target.value.trim()))}),placeholder:"Your secret key"}),nt.secretKey&&jsxRuntimeExports.jsx(FormErrorMessage$1,{children:nt.secretKey.message})]}),a&&jsxRuntimeExports.jsxs(FormControl,{marginTop:"20px",isInvalid:!!nt.password,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password",inputName:"password",minLength:0}),nt.password&&jsxRuntimeExports.jsx(FormErrorMessage$1,{children:nt.password.message})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px","data-testid":"restore-continue-button",isDisabled:!it,size:"lg",type:"submit",children:"Continue"})]})})})},ShowSeedphrase=({goToStep:_,account:a})=>jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(KeyIcon,{width:"24px",height:"24px"}),subtitle:"Please record the following 24 words in sequence in order to restore it in the future.",title:"Record Seed Phrase",children:jsxRuntimeExports.jsxs(VStack,{children:[jsxRuntimeExports.jsx(SimpleGrid,{columns:3,spacing:2,children:a.mnemonic.split(" ").map(($,j)=>jsxRuntimeExports.jsxs(Flex,{width:"126px",padding:"6px",border:"1px dashed",borderColor:colors.gray[500],borderRadius:"4px",children:[jsxRuntimeExports.jsx(Heading,{width:"18px",marginRight:"10px",paddingTop:"2px",color:colors.gray[450],textAlign:"right",size:"sm",children:j+1}),jsxRuntimeExports.jsx(Text,{"data-testid":`mnemonic-word-${j}`,size:"sm",children:$})]},j))}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"20px",onClick:$=>{_({type:"verifySeedphrase",account:a})},size:"lg",children:"OK, I've recorded it"})]})}),VerifySeedphrase=({goToStep:_,account:a})=>{const $=a.mnemonic.split(" "),j=useForm({mode:"onBlur"}),{handleSubmit:et,formState:{errors:tt,isValid:rt}}=j,[nt]=reactExports.useState(selectRandomElements($,5)),it=()=>_({type:"nameAccount",account:a});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(DoubleCheckmarkIcon,{}),subtitle:"To verify, please type in the word that corresponds to each sequence number.",title:"Verify Seed Phrase",children:jsxRuntimeExports.jsx(Box,{overflowX:"hidden",overflowY:"auto",width:"100%",children:jsxRuntimeExports.jsx(FormProvider,{...j,children:jsxRuntimeExports.jsxs("form",{onSubmit:et(it),children:[nt.map((ot,st)=>{const ct=`${ot.index}`,ut=tt[ct];return jsxRuntimeExports.jsxs(FormControl,{marginBottom:"12px",isInvalid:!!ut,children:[jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:1,width:"26px",marginTop:"12px",marginLeft:"4px",textAlign:"right","data-testid":"mnemonic-index",children:ot.index+1}),jsxRuntimeExports.jsx(Box,{width:"100%",children:jsxRuntimeExports.jsx(MnemonicAutocomplete,{inputName:ct,inputProps:{paddingLeft:"36px",size:"md"},listProps:{marginTop:"6px"},validate:ht=>{if(ht!==ot.value)return"Word doesn't match"}})}),(ut==null?void 0:ut.message)&&jsxRuntimeExports.jsx(FormErrorMessage,{children:ut.message})]},st)}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"20px",isDisabled:!rt,size:"lg",type:"submit",children:"Continue"}),IS_DEV]})})})})},useStepHistory=_=>{const[a,$]=reactExports.useState(_),[j,et]=reactExports.useState([a]),tt=j.length===1;return{reset:()=>{$(_),et([_])},goToStep:rt=>{$(rt),et([...j,rt])},currentStep:a,goBack:()=>{if(tt)return;j.pop();const rt=j[j.length-1];et(j),$(rt)},atInitialStep:tt,fullHistory:j}},useOnboardingModal=_=>{const{isOpen:a,onOpen:$,onClose:j}=useDisclosure$1(),et=useImplicitAccounts().length!==0,tt=useStepHistory({type:et?"connectOrCreate":"eula"}),{currentStep:rt,goToStep:nt}=tt,it=()=>{tt.reset(),_&&_(),j()},ot=()=>{switch(rt.type){case"eula":return jsxRuntimeExports.jsx(Eula,{goToStep:nt});case"connectOrCreate":return jsxRuntimeExports.jsx(ConnectOrCreate,{closeModal:it,goToStep:nt});case"connectOptions":return jsxRuntimeExports.jsx(ConnectOptions,{goToStep:nt});case"notice":return jsxRuntimeExports.jsx(Notice,{goToStep:nt});case"restoreMnemonic":return jsxRuntimeExports.jsx(RestoreMnemonic,{goToStep:nt});case"restoreBackup":return jsxRuntimeExports.jsx(RestoreBackupFile,{});case"showSeedphrase":return jsxRuntimeExports.jsx(ShowSeedphrase,{goToStep:nt,...rt});case"verifySeedphrase":return jsxRuntimeExports.jsx(VerifySeedphrase,{goToStep:nt,...rt});case"nameAccount":return jsxRuntimeExports.jsx(NameAccount,{goToStep:nt,...rt});case"derivationPath":return jsxRuntimeExports.jsx(DerivationPath,{goToStep:nt,...rt});case"restoreLedger":return jsxRuntimeExports.jsx(RestoreLedger,{closeModal:it,...rt});case"masterPassword":return jsxRuntimeExports.jsx(MasterPassword,{onClose:it,...rt});case"fakeAccount":return jsxRuntimeExports.jsx(FakeAccount,{onClose:j});case"restoreSecretKey":return jsxRuntimeExports.jsx(RestoreSecretKey,{goToStep:nt})}};return{modalElement:jsxRuntimeExports.jsxs(Modal,{autoFocus:!1,closeOnOverlayClick:!1,isCentered:!0,isOpen:a,onClose:it,children:[et&&jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsxs(ModalContent,{children:[!tt.atInitialStep&&jsxRuntimeExports.jsx(ModalBackButton,{onClick:tt.goBack}),jsxRuntimeExports.jsx(ModalCloseButton,{onClick:it}),ot()]})]}),onOpen:$}},AccountListHeader=()=>{const{onOpen:_,modalElement:a}=useOnboardingModal();return jsxRuntimeExports.jsxs(Flex,{flexDirection:"row-reverse",marginTop:"12px",marginBottom:"16px",children:[jsxRuntimeExports.jsxs(Button,{paddingRight:"0",onClick:_,variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(AddAccountIcon,{stroke:"currentcolor"}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:"Add Account"})]}),a]})},AccountGroupPopover=({onRemove:_,onCreate:a})=>jsxRuntimeExports.jsx(PopoverMenu,{children:jsxRuntimeExports.jsxs(Box,{paddingY:"0",children:[jsxRuntimeExports.jsx(Button,{height:a?"24px":"28px","data-testid":"popover-remove",onClick:_,variant:"popover",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",flex:1,children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Remove"}),jsxRuntimeExports.jsx(TrashIcon,{stroke:"inherit"})]})}),a&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{marginY:"4px"}),jsxRuntimeExports.jsx(Button,{onClick:a,variant:"popover",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",flex:1,children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Create"}),jsxRuntimeExports.jsx(PlusIcon,{width:"18px",height:"18px",stroke:"inherit"})]})})]})]})}),DeriveMnemonicAccountModal=({onDone:_,fingerPrint:a})=>{const[$,j]=reactExports.useState(),{isLoading:et,handleAsyncAction:tt}=useAsyncActionHandler(),rt=useToast(),nt=useDeriveMnemonicAccount(),it=({name:ot,password:st})=>tt(async()=>{await nt({fingerPrint:a,password:st,label:ot.trim()||DEFAULT_ACCOUNT_LABEL}),_(),rt({description:`New account created! Successfully derived account from ${a}`})},{title:"Failed to derive new account"});return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),$?jsxRuntimeExports.jsx(EnterPassword,{isLoading:et,onSubmit:ot=>it({name:$,password:ot})}):jsxRuntimeExports.jsx(NameAccountDisplay,{onSubmit:ot=>j(ot.accountName),subtitle:`Name the new account derived from ${a}`})]})},getAccountGroupLabel=_=>{switch(_.type){case"mnemonic":return`Seedphrase ${_.seedFingerPrint}`;case"social":return"Social Accounts";case"ledger":return"Ledger Accounts";case"secret_key":return"Secret Key Accounts";case"multisig":return"Multisig Accounts"}},AccountGroup=({groupLabel:_,accounts:a,balances:$})=>{const j=a[0],et=j.type==="multisig",tt=j.type==="mnemonic",{openWith:rt,onClose:nt}=reactExports.useContext(DynamicModalContext),it=useRemoveMnemonic(),ot=useRemoveNonMnemonic(),st=useImplicitAccounts().length===a.length,ct="Remove All Accounts";let ut,ht="Remove All";const Et=getAccountGroupLabel(j);st?(ut="Removing all your accounts will off-board you from Umami. This will remove or reset all customized settings to their defaults. Personal data (including saved contacts, password and accounts) won't be affected.",ht="Remove & Off-board"):tt?ut=`Are you sure you want to remove all accounts derived from ${Et}?`:ut=`Are you sure you want to remove all of your ${Et}?`;const St=()=>rt(jsxRuntimeExports.jsx(ConfirmationModal,{buttonLabel:ht,description:ut,onSubmit:()=>{tt?it(j.seedFingerPrint):et||ot(j.type),nt()},title:ct})),Mt=()=>{if(!tt)throw new Error("Can't derive a non mnemonic account!");return rt(jsxRuntimeExports.jsx(DeriveMnemonicAccountModal,{fingerPrint:j.seedFingerPrint,onDone:nt}))};return jsxRuntimeExports.jsxs(Box,{"data-testid":`account-group-${_}`,children:[jsxRuntimeExports.jsxs(Center,{justifyContent:"space-between",marginTop:"24px",marginBottom:"16px",children:[jsxRuntimeExports.jsx(Heading,{"data-testid":"account-group-title",size:"md",children:_}),!et&&jsxRuntimeExports.jsx(AccountGroupPopover,{onCreate:tt?Mt:void 0,onRemove:St})]}),a.map(kt=>jsxRuntimeExports.jsx(Box,{marginBottom:"16px",children:jsxRuntimeExports.jsx(AccountTile,{account:kt,balance:$[kt.address.pkh]})},kt.address.pkh))]})},NestedScroll=_=>jsxRuntimeExports.jsx(Box,{overflowY:"auto",height:"100%",children:_.children});var indicator$1=function _(a){a=Math.abs(a);var $=a%100;if($>=10&&$<=20)return"th";var j=a%10;return j===1?"st":j===2?"nd":j===3?"rd":"th"},indicator=indicator$1;function ordinal(_){if(typeof _!="number")throw new TypeError("Expected Number, got "+typeof _+" "+_);return Number.isFinite(_)?_+indicator(_):_}ordinal.indicator=indicator;var ordinal_1=ordinal;const ordinal$1=getDefaultExportFromCjs$1(ordinal_1),SignTransactionFormPage=_=>{const a=useAppDispatch(),{isLoading:$,handleAsyncAction:j}=useAsyncActionHandler(),{mode:et,operations:tt,data:{threshold:rt,signers:nt,name:it}}=_,{fee:ot,operations:st,estimationFailed:ct,isLoading:ut,form:ht,reEstimate:Et,signer:St,onSign:Mt}=useSignPageHelpers(tt,et),kt=$||ut,Ct=Ot=>j(async()=>{const zt=await Mt(Ot);if(!zt)throw new Error("An error occurred during contract origination");const Ut=(await zt.getOriginatedContractAddresses())[0];a(multisigActions.addMultisigLabel({pkh:Ut,label:it}))});return jsxRuntimeExports.jsx(FormProvider,{...ht,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,description:"Please review the details and then continue to submit contract.",operationsType:st.type,signer:St,title:"Review & Submit"}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Text,{marginBottom:"24px",padding:"14px",color:colors.gray[50],background:colors.gray[800],borderRadius:"6px","data-testid":"contract-name",children:it}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{}),jsxRuntimeExports.jsx(FormLabel,{children:"Approvers"}),jsxRuntimeExports.jsx(Flex,{flexDirection:"column",gap:"12px",marginBottom:"12px","data-testid":"approvers",children:nt.map(Ot=>jsxRuntimeExports.jsx(AddressTile,{address:parsePkh(Ot.val),"data-testid":`approver-${Ot.val}`},Ot.val))}),jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",children:jsxRuntimeExports.jsx(Threshold,{signersAmount:nt.length,threshold:rt})}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(FormControl,{marginTop:"24px",marginBottom:"12px",children:jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!1,inputName:"signer",isLoading:kt,keepValid:!0,label:"Creation Fee Payer",onUpdate:Et})}),jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",children:jsxRuntimeExports.jsx(SignPageFee,{fee:ot})})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:ct,isLoading:kt,onSubmit:Ct,signer:St,text:"Submit Contract"})})]})})})},Threshold=({threshold:_,signersAmount:a})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center","data-testid":"threshold",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"No. of approvals:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:`${_} out of ${a}`})]}),contract=[{prim:"storage",args:[{prim:"pair",args:[{prim:"address",annots:["%owner"]},{prim:"pair",args:[{prim:"set",args:[{prim:"address"}],annots:["%signers"]},{prim:"pair",args:[{prim:"nat",annots:["%threshold"]},{prim:"pair",args:[{prim:"nat",annots:["%last_op_id"]},{prim:"pair",args:[{prim:"big_map",args:[{prim:"nat"},{prim:"pair",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"list",args:[{prim:"operation"}]}],annots:["%actions"]},{prim:"set",args:[{prim:"address"}],annots:["%approvals"]}]}],annots:["%pending_ops"]},{prim:"big_map",args:[{prim:"string"},{prim:"bytes"}],annots:["%metadata"]}]}]}]}]}]}]},{prim:"parameter",args:[{prim:"or",args:[{prim:"or",args:[{prim:"or",args:[{prim:"bytes",annots:["%set_metadata_uri"]},{prim:"unit",annots:["%default"]}]},{prim:"or",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"list",args:[{prim:"operation"}]}],annots:["%propose"]},{prim:"nat",annots:["%approve"]}]}]},{prim:"nat",annots:["%execute"]}]}]},{prim:"code",args:[[{prim:"NIL",args:[{prim:"operation"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"UNPAIR"},{prim:"DIP",args:[{int:"1"},[{prim:"UNPAIR",args:[{int:"6"}]}]]},{prim:"IF_LEFT",args:[[{prim:"IF_LEFT",args:[[{prim:"IF_LEFT",args:[[{prim:"DUP",args:[{int:"2"}]},{prim:"SENDER"},{prim:"COMPARE"},{prim:"EQ"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"INVALID_CALLER"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"7"}]},{prim:"DUP",args:[{int:"2"}]},{prim:"SOME"},{prim:"PUSH",args:[{prim:"string"},{string:""}]},{prim:"UPDATE"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"1"}]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}],[{prim:"DROP",args:[{int:"1"}]},{prim:"DUP",args:[{int:"3"}]},{prim:"DUP",args:[{int:"3"}]},{prim:"SIZE"},{prim:"COMPARE"},{prim:"GE"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"FUNDING BLOCKED SINCE PARAMS ARE INVALID"}]},{prim:"FAILWITH"}],[]]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}]]}],[{prim:"IF_LEFT",args:[[{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]},{prim:"AMOUNT"},{prim:"COMPARE"},{prim:"EQ"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"TO FUND CONTRACT, PLEASE USE THE DEFAULT ENTRYPOINT"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"3"}]},{prim:"SENDER"},{prim:"MEM"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"ONLY FOR SIGNERS"}]},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"nat"},{int:"1"}]},{prim:"DUP",args:[{int:"6"}]},{prim:"ADD"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"4"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"4"}]},{prim:"DUP",args:[{int:"6"}]},{prim:"DUP",args:[{int:"6"}]},{prim:"MEM"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"pending_ops"}]},{prim:"PUSH",args:[{prim:"string"},{string:"KEY_EXISTS"}]},{prim:"PAIR"},{prim:"FAILWITH"}],[{prim:"DUP",args:[{int:"6"}]},{prim:"EMPTY_SET",args:[{prim:"address"}]},{prim:"PUSH",args:[{prim:"bool"},{prim:"True"}]},{prim:"SENDER"},{prim:"UPDATE"},{prim:"DUP",args:[{int:"3"}]},{prim:"PAIR"},{prim:"SOME"},{prim:"DUP",args:[{int:"7"}]},{prim:"UPDATE"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"5"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"5"}]}]]},{prim:"DROP",args:[{int:"1"}]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}],[{prim:"DUP",args:[{int:"6"}]},{prim:"DUP",args:[{int:"2"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"INVALID OP ID"}]},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]},{prim:"AMOUNT"},{prim:"COMPARE"},{prim:"EQ"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"TO FUND CONTRACT, PLEASE USE THE DEFAULT ENTRYPOINT"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"4"}]},{prim:"SENDER"},{prim:"MEM"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"ONLY FOR SIGNERS"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP"},{prim:"CDR"},{prim:"SENDER"},{prim:"MEM"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"ALREADY APPROVED"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"7"}]},{prim:"DUP",args:[{int:"8"}]},{prim:"DUP",args:[{int:"4"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"pending_ops"}]},{prim:"PUSH",args:[{prim:"string"},{string:"ASSET_NOT_FOUND"}]},{prim:"PAIR"},{prim:"FAILWITH"}],[]]},{prim:"UNPAIR"},{prim:"SWAP"},{prim:"DROP",args:[{int:"1"}]},{prim:"DUP",args:[{int:"9"}]},{prim:"DUP",args:[{int:"5"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"pending_ops"}]},{prim:"PUSH",args:[{prim:"string"},{string:"ASSET_NOT_FOUND"}]},{prim:"PAIR"},{prim:"FAILWITH"}],[]]},{prim:"CDR"},{prim:"PUSH",args:[{prim:"bool"},{prim:"True"}]},{prim:"SENDER"},{prim:"UPDATE"},{prim:"SWAP"},{prim:"PAIR"},{prim:"SOME"},{prim:"DUP",args:[{int:"4"}]},{prim:"UPDATE"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"2"}]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}]]}]]}],[{prim:"DUP",args:[{int:"6"}]},{prim:"DUP",args:[{int:"2"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"INVALID OP ID"}]},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]},{prim:"AMOUNT"},{prim:"COMPARE"},{prim:"EQ"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"TO FUND CONTRACT, PLEASE USE THE DEFAULT ENTRYPOINT"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"4"}]},{prim:"SENDER"},{prim:"MEM"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"ONLY FOR SIGNERS"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"5"}]},{prim:"DUP",args:[{int:"2"}]},{prim:"CDR"},{prim:"SIZE"},{prim:"COMPARE"},{prim:"GE"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"NOT YET APPROVED"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"7"}]},{prim:"DUP",args:[{int:"3"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"pending_ops"}]},{prim:"PUSH",args:[{prim:"string"},{string:"ASSET_NOT_FOUND"}]},{prim:"PAIR"},{prim:"FAILWITH"}],[]]},{prim:"CAR"},{prim:"PUSH",args:[{prim:"unit"},{prim:"Unit"}]},{prim:"EXEC"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"8"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"8"}]},{prim:"DUP",args:[{int:"7"}]},{prim:"NONE",args:[{prim:"pair",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"list",args:[{prim:"operation"}]}]},{prim:"set",args:[{prim:"address"}]}]}]},{prim:"DUP",args:[{int:"4"}]},{prim:"UPDATE"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"2"}]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}]]}]]}],makeStorageJSON=(_,a,$)=>({owner:_,signers:a,threshold:$,last_op_id:"0",pending_ops:[],metadata:[]}),toOperation$4=_=>({type:"contract_origination",sender:parsePkh(_.sender),code:contract,storage:makeStorageJSON(_.sender,_.signers.map(a=>a.val),String(_.threshold))}),SelectApproversFormPage=_=>{const{goBack:a,sender:$,...j}=_,et=useForm({mode:"onBlur",defaultValues:{sender:$.address.pkh,signers:[{val:""}],threshold:1,...formDefaultValues(j)}}),{formState:{errors:tt,isValid:rt},control:nt,register:it,handleSubmit:ot,getValues:st,watch:ct}=et,ut=useFieldArray({control:nt,name:"signers",rules:{minLength:1}}),ht=ct("signers").length,Et=useOpenSignPageFormAction({SignPage:SignTransactionFormPage,signPageExtraData:ct(),FormPage:SelectApproversFormPage,defaultFormPageProps:_,toOperation:toOperation$4}),{onFormSubmitActionHandlers:[St],isLoading:Mt}=useHandleOnSubmitFormActions([Et]);return jsxRuntimeExports.jsx(FormProvider,{...et,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalBackButton,{onClick:a}),jsxRuntimeExports.jsxs("form",{onSubmit:ot(St),children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"Select the participants of the contract and choose the minimum number of approvals.",title:"Select Approvers"}),jsxRuntimeExports.jsxs(ModalBody,{children:[ut.fields.map((kt,Ct)=>{var jt;const Ot=tt.signers&&tt.signers[Ct],zt=`${Ct===0?"Select ":""}${ordinal$1(Ct+1)} approver`,Ut=ht>1?"short":"default",Vt=Ut==="short"?"368px":"100%";return jsxRuntimeExports.jsxs(FormControl,{display:"inline-block",width:Vt,marginBottom:"8px","data-testid":`signer-input-${Ct}`,isInvalid:!!Ot,children:[jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!0,inputName:`signers.${Ct}.val`,label:zt,size:Ut,style:{width:Vt},validate:$t=>{if(!isValidImplicitPkh($t))return"Signer must be valid TZ address";const Bt=st("signers").map(Nt=>Nt.val);if(Bt.length>new Set(Bt).size)return"Duplicate approver"}}),ht>1&&jsxRuntimeExports.jsx(IconButton,{position:"absolute",height:"24px",marginTop:"-36px",marginLeft:"374px",background:colors.gray[500],"aria-label":"Remove","data-testid":`remove-signer-${Ct}`,icon:jsxRuntimeExports.jsx(TrashIcon,{width:"12px",height:"14px",stroke:colors.gray[300]}),isRound:!0,onClick:()=>ut.remove(Ct),size:"xs",variant:"tertiary"}),Ot&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":`signer-${Ct}-error`,children:(jt=Ot.val)==null?void 0:jt.message})]},kt.id)}),jsxRuntimeExports.jsx(Button,{paddingLeft:0,onClick:()=>ut.append({val:""}),variant:"specialCTA",children:"+ Add Approver"}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!tt.threshold,children:[jsxRuntimeExports.jsxs(FormLabel,{display:"inline",children:["Min No. of approvals:",jsxRuntimeExports.jsx(InputGroup,{display:"inline",marginLeft:"10px",children:jsxRuntimeExports.jsx(Input,{width:"60px",color:"white","data-testid":"threshold-input",step:1,type:"number",...it("threshold",{valueAsNumber:!0,required:"No. of approvals is required",max:{value:ht,message:`Max no. of approvals is ${ht}`},min:{value:1,message:"Min no. of approvals is 1"}})})})]}),jsxRuntimeExports.jsxs(Text,{display:"inline","data-testid":"max-signers",children:["out of ",ht]}),tt.threshold&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"threshold-error",children:tt.threshold.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!rt,isLoading:Mt,size:"lg",type:"submit",children:"Review"})})]})]})})},NameMultisigFormPage=({name:_})=>{const a=useForm({mode:"onBlur",defaultValues:{name:_||""}}),{formState:{errors:$,isValid:j},register:et,handleSubmit:tt}=a,rt=useImplicitAccounts(),nt=useGetMostFundedImplicitAccount(),{openWith:it}=reactExports.useContext(DynamicModalContext),ot=({name:ct})=>it(jsxRuntimeExports.jsx(SelectApproversFormPage,{form:{name:ct.trim()},goBack:()=>it(jsxRuntimeExports.jsx(NameMultisigFormPage,{name:ct})),sender:nt(rt)})),st=useValidateName();return jsxRuntimeExports.jsx(FormProvider,{...a,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:tt(ot),children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"Name your account. The account name will only appear in your local Umami app.",title:"Account Name"}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!$.name,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Account Name"}),jsxRuntimeExports.jsx(InputGroup,{children:jsxRuntimeExports.jsx(Input,{"data-testid":"multisig-account-name",type:"text",...et("name",{validate:st}),placeholder:"Account Name"})}),$.name&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"name-error",children:$.name.message})]})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!j,size:"lg",type:"submit",children:"Continue"})})]})})})},AccountsList=()=>{const _=useAllAccounts(),a=useAppSelector(tt=>tt.assets.balances.mutez),$=lodashExports.groupBy(_,getAccountGroupLabel),{openWith:j}=reactExports.useContext(DynamicModalContext),et=Object.entries($).map(([tt,rt])=>jsxRuntimeExports.jsx(AccountGroup,{accounts:rt,balances:a,groupLabel:tt},tt));return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Box,{height:"100%",marginRight:0,children:jsxRuntimeExports.jsxs(NestedScroll,{children:[lodashExports.compact(et),jsxRuntimeExports.jsx(Button,{width:"100%",height:"90px",background:colors.black,border:"1px dashed",borderColor:colors.gray[500],onClick:()=>j(jsxRuntimeExports.jsx(NameMultisigFormPage,{})),variant:"outline",children:jsxRuntimeExports.jsxs(Text,{display:"block",width:"100%",margin:"20px",color:colors.gray[400],textAlign:"center",children:[jsxRuntimeExports.jsx(KeyIcon,{marginRight:"4px"}),"Create New Multisig"]})})]})})})},useGetDelegationPrettyDisplayValues=()=>{const _=useGetAccountBalance();return a=>{const $=_(a.sender),j=new Date,et=prettyTezAmount(a.amount),tt=$&&prettyTezAmount($),rt=`Since ${formatRelative(new Date(a.timestamp),j)}`;return{initialBalance:et,currentBalance:tt,duration:rt}}},SignPage$4=_=>{const{mode:a,operations:$}=_,{fee:j,operations:et,estimationFailed:tt,isLoading:rt,form:nt,signer:it,reEstimate:ot,onSign:st}=useSignPageHelpers($,a),ct=et.operations[0].recipient;return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:et.type,signer:et.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:it.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",marginBottom:"24px",paddingX:"4px",children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(SignPageFee,{fee:j})})}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:ct}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:rt,operationType:et.type,reEstimate:ot,sender:et.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:tt,isLoading:rt,onSubmit:st,signer:it,text:headerText(et.type,a)})})]})})})},FormPage$3=_=>{var ct;const a=(ct=_.form)==null?void 0:ct.baker,$=useOpenSignPageFormAction({SignPage:SignPage$4,signPageExtraData:void 0,FormPage:FormPage$3,defaultFormPageProps:_,toOperation:toOperation$3}),j=useAddToBatchFormAction(toOperation$3),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:formDefaultValues(_)}),{formState:{isValid:it,errors:ot},handleSubmit:st}=nt;return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{"data-testid":"delegate-form",children:[jsxRuntimeExports.jsxs(HeaderWrapper,{children:[jsxRuntimeExports.jsx(Text,{fontWeight:"600",size:"2xl",children:a?"Change Baker":"Delegate"}),jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!!_.sender,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px","data-testid":"baker",isInvalid:!!ot.baker,children:[jsxRuntimeExports.jsx(BakersAutocomplete,{allowUnknown:!0,inputName:"baker",label:"Baker"}),ot.baker&&jsxRuntimeExports.jsx(FormErrorMessage,{children:ot.baker.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:st(tt),onSingleSubmit:st(et)})})]})})})},toOperation$3=_=>({type:"delegation",sender:parsePkh(_.sender),recipient:parseImplicitPkh(_.baker)}),SignPage$3=_=>{const{mode:a,operations:$}=_,{fee:j,operations:et,estimationFailed:tt,isLoading:rt,form:nt,signer:it,reEstimate:ot,onSign:st}=useSignPageHelpers($,a);return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:et.type,signer:et.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:it.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",paddingX:"4px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:j})}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:rt,operationType:et.type,reEstimate:ot,sender:et.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:tt,isLoading:rt,onSubmit:st,signer:it,text:headerText(et.type,a)})})]})})})},FormPage$2=_=>{var st;const{sender:a}=_,$=(st=_.form)==null?void 0:st.baker,j=useOpenSignPageFormAction({SignPage:SignPage$3,signPageExtraData:void 0,FormPage:FormPage$2,defaultFormPageProps:{sender:a},toOperation:toOperation$2}),et=useAddToBatchFormAction(toOperation$2),{onFormSubmitActionHandlers:[tt,rt],isLoading:nt}=useHandleOnSubmitFormActions([j,et]),it=useForm({mode:"onBlur",defaultValues:formDefaultValues({sender:a})}),{handleSubmit:ot}=it;return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{"data-testid":"undelegate-form",children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"Select preview to end delegation or insert this transaction into a Batch.",title:"End Delegation"}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormControl,{children:jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"Baker"}),$&&jsxRuntimeExports.jsx(AddressTile,{address:parsePkh($)})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:nt,isValid:!0,onAddToBatch:ot(rt),onSingleSubmit:ot(tt)})})]})})})},toOperation$2=_=>({type:"undelegation",sender:parsePkh(_.sender)}),Row=({label:_,value:a,...$})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"50px",padding:"16px","data-testid":_,...$,children:[jsxRuntimeExports.jsx(Box,{flex:1,children:jsxRuntimeExports.jsx(Heading,{color:colors.gray[400],size:"sm",children:_})}),jsxRuntimeExports.jsx(Box,{flex:1,children:typeof a=="string"?jsxRuntimeExports.jsx(Text,{size:"sm",children:a}):a})]}),DelegationDisplay=({delegation:_,account:a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext),j=useGetOwnedAccount(),et=useGetDelegationPrettyDisplayValues();if(!_)return jsxRuntimeExports.jsx(NoDelegations,{onDelegate:()=>$(jsxRuntimeExports.jsx(FormPage$3,{sender:a})),size:"md"});const{currentBalance:tt,duration:rt,initialBalance:nt}=et(_),{sender:it,delegate:{address:ot}}=_,st=j(it);return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Row,{borderBottom:`1px solid ${colors.gray[700]}`,borderTopRadius:"8px",_odd:{bg:colors.gray[800]},label:"Initial Balance:",value:nt}),tt&&jsxRuntimeExports.jsx(Row,{_odd:{bg:colors.gray[800]},label:"Current Balance:",value:tt}),jsxRuntimeExports.jsx(Row,{borderBottom:`1px solid ${colors.gray[700]}`,_odd:{bg:colors.gray[800]},label:"Duration:",value:rt}),jsxRuntimeExports.jsx(Row,{borderBottomRadius:"8px",_odd:{bg:colors.gray[800]},label:"Baker:",value:jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.delegate.address)})}),jsxRuntimeExports.jsxs(Flex,{marginTop:"24px",children:[jsxRuntimeExports.jsx(Button,{flex:1,marginRight:"16px",onClick:()=>$(jsxRuntimeExports.jsx(FormPage$2,{form:{sender:it,baker:ot},sender:st})),variant:"warning",children:"End Delegation"}),jsxRuntimeExports.jsx(Button,{flex:1,onClick:()=>$(jsxRuntimeExports.jsx(FormPage$3,{form:{sender:it,baker:ot},sender:st})),variant:"tertiary",children:"Change Baker"})]})]})},MultisigDecodedOperation=({operation:_})=>{switch(_.type){case"delegation":return jsxRuntimeExports.jsxs(Box,{"data-testid":"decoded-item-delegate",marginY:6,children:[jsxRuntimeExports.jsx(Text,{marginRight:"3px",color:colors.gray[450],fontSize:"14px",children:"Delegate to:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.recipient})]});case"undelegation":return jsxRuntimeExports.jsx(Box,{"data-testid":"decoded-item-undelegate",marginY:6,children:jsxRuntimeExports.jsx(Text,{color:colors.gray[450],fontSize:"14px",children:"End Delegation"})});case"tez":case"fa1.2":case"fa2":return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(MultisigOperationAmount,{operation:_}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"8px",children:[jsxRuntimeExports.jsx(Text,{marginRight:"3px",color:colors.gray[450],fontSize:"14px",children:"Send to:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.recipient})]})]});case"contract_origination":case"contract_call":throw new Error(`${_.type} is not supported yet`)}},MultisigOperationAmount=({operation:_})=>{const a=useGetToken();switch(_.type){case"tez":return jsxRuntimeExports.jsxs(Flex,{alignItems:"center","data-testid":"decoded-tez-amount",children:[jsxRuntimeExports.jsx(OutgoingArrow,{}),jsxRuntimeExports.jsxs(Text,{marginLeft:"8px",color:colors.orange,fontSize:"14px",fontWeight:600,textAlign:"center",children:["-",prettyTezAmount(_.amount)]})]});case"fa1.2":case"fa2":{const $=a(_.contract.pkh,_.tokenId);if(!$)return null;const j=tokenNameSafe($),et=$.type==="nft";return jsxRuntimeExports.jsxs(Flex,{alignItems:"center","data-testid":"decoded-fa-amount",children:[jsxRuntimeExports.jsx(OutgoingArrow,{}),jsxRuntimeExports.jsx(Box,{marginLeft:"8px",color:colors.orange,textAlign:"center",children:et?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text,{display:"inline",marginRight:"3px",fontSize:"14px",fontWeight:600,children:_.amount}),jsxRuntimeExports.jsx(Text,{display:"inline",color:"white",fontSize:"14px",fontWeight:600,children:j})]}):jsxRuntimeExports.jsxs(Text,{fontSize:"14px",fontWeight:600,children:["-",tokenPrettyAmount(_.amount,$,{showSymbol:!0})]})})]})}case"delegation":case"undelegation":case"contract_origination":case"contract_call":return null}},caseInsensitiveLiteral=_=>z.string().regex(new RegExp(`^${_}$`,"i")),prim=_=>z.object({prim:caseInsensitiveLiteral(_)}),pushKeyHashSchema=z.object({prim:z.literal("PUSH"),args:z.tuple([z.object({prim:z.literal("key_hash")}),z.object({bytes:z.string()})])}),pushAddressSchema=z.object({prim:z.literal("PUSH"),args:z.tuple([z.object({prim:z.literal("address")}),z.object({bytes:z.string()})])}),pair=(_,a)=>z.object({prim:z.literal("Pair"),args:z.tuple([_,a])}),contractZeroTezSchema=z.object({prim:z.literal("PUSH"),args:z.tuple([z.object({prim:z.literal("mutez")}),z.object({int:z.literal("0")})])}),lambdaEndSchema=[prim("TRANSFER_TOKENS"),prim("CONS")],contractHeadSchema=z.object({prim:z.literal("CONTRACT")}),batchHeadSchema=z.tuple([z.object({prim:z.literal("DROP")}),z.object({prim:z.literal("NIL"),args:z.array(z.object({prim:z.literal("operation")}))})]),pushMutezSchema=z.object({prim:z.literal("PUSH"),args:z.tuple([z.object({prim:z.literal("mutez")}),z.object({int:z.string()})])}),tezSchema=z.tuple([pushKeyHashSchema,prim("IMPLICIT_ACCOUNT"),pushMutezSchema,prim("UNIT"),...lambdaEndSchema]),contractTezSchema=z.tuple([pushAddressSchema,contractHeadSchema,prim("IF_NONE"),pushMutezSchema,prim("UNIT"),...lambdaEndSchema]),setDelegateSchema=z.tuple([pushKeyHashSchema,prim("SOME"),prim("SET_DELEGATE"),prim("CONS")]),removeDelegateSchema=z.tuple([z.object({prim:z.literal("NONE"),args:z.tuple([z.object({prim:z.literal("key_hash")})])}),prim("SET_DELEGATE"),prim("CONS")]),fa2Schema=z.tuple([pushAddressSchema,contractHeadSchema,z.tuple([prim("IF_NONE")]),contractZeroTezSchema,z.object({prim:z.literal("PUSH"),args:z.tuple([prim("list"),z.array(pair(z.object({bytes:z.string({description:"from"})}),z.array(pair(z.object({bytes:z.string({description:"to"})}),pair(z.object({int:z.string({description:"token_id"})}),z.object({int:z.string({description:"amount"})}))))))])}),...lambdaEndSchema]),fa1Schema=z.tuple([pushAddressSchema,contractHeadSchema,z.tuple([prim("IF_NONE")]),contractZeroTezSchema,z.object({prim:z.literal("PUSH"),args:z.tuple([prim("Pair"),pair(z.object({bytes:z.string({description:"from"})}),pair(z.object({bytes:z.string({description:"to"})}),z.object({int:z.string({description:"amount"})})))])}),...lambdaEndSchema]);class UnrecognizedMichelsonError extends Error{}const convertToPkh=_=>(_.length===42&&(_="00"+_),encodeAddress(_)),parseTez=_=>{const a=tezSchema.parse(_),$=a[0].args[1].bytes,j=a[2].args[1].int;return{type:"tez",recipient:parseImplicitPkh(convertToPkh($)),amount:j}},parseTezContract=_=>{const a=contractTezSchema.parse(_),$=a[0].args[1].bytes,j=a[3].args[1].int;return{type:"tez",recipient:parseContractPkh(convertToPkh($)),amount:j}},parseFa2=_=>{const a=fa2Schema.parse(_),$=parseContractPkh(convertToPkh(a[0].args[1].bytes));return a[4].args[1].flatMap(et=>{const tt=et.args[0].bytes;return et.args[1].map(rt=>{const nt=rt.args[0].bytes,it=rt.args[1].args[0].int,ot=rt.args[1].args[1].int;return{type:"fa2",contract:$,sender:parsePkh(convertToPkh(tt)),recipient:parsePkh(convertToPkh(nt)),tokenId:it,amount:ot}})})},parseFa1=_=>{const a=fa1Schema.parse(_),$=a[0],j=a[4].args[1],et=j.args[0].bytes,tt=j.args[1].args[0].bytes;return{type:"fa1.2",amount:j.args[1].args[1].int,contract:parseContractPkh(convertToPkh($.args[1].bytes)),recipient:parsePkh(convertToPkh(tt)),sender:parsePkh(convertToPkh(et)),tokenId:"0"}},parseSetDelegate=(_,a)=>{const $=setDelegateSchema.parse(_);return{type:"delegation",sender:a.address,recipient:parseImplicitPkh(convertToPkh($[0].args[1].bytes))}},parseRemoveDelegate=(_,a)=>({type:"undelegation",sender:a.address}),parsings=[{schema:tezSchema,parsingFn:parseTez},{schema:contractTezSchema,parsingFn:parseTezContract},{schema:fa2Schema,parsingFn:parseFa2},{schema:fa1Schema,parsingFn:parseFa1},{schema:setDelegateSchema,parsingFn:parseSetDelegate},{schema:removeDelegateSchema,parsingFn:parseRemoveDelegate}],parse=(_,a,$=[])=>{if(_.length===0)return $;for(let j=0;j{batchHeadSchema.parse(_.slice(0,2))},decode=(_,a)=>(assertHead(_),parse(_.slice(2),a)),parseRawMichelson=(_,a)=>{const $=JSON.parse(_);return decode($,a)},MultisigDecodedOperations=({rawMichelson:_,sender:a})=>{try{const $=parseRawMichelson(_,a);return jsxRuntimeExports.jsx(Box,{borderRadius:"8px",backgroundColor:colors.gray[900],children:$.map((j,et)=>jsxRuntimeExports.jsxs(Box,{width:"100%",paddingTop:"10px",paddingBottom:et<$.length-1?0:"15px",paddingX:"15px",children:[jsxRuntimeExports.jsx(MultisigDecodedOperation,{operation:j}),et<$.length-1&&jsxRuntimeExports.jsx(Divider,{marginTop:"15px"})]},et))})}catch($){return $ instanceof UnrecognizedMichelsonError?jsxRuntimeExports.jsx(UnrecognizedOperation,{rawMichelson:_}):jsxRuntimeExports.jsxs(Box,{height:"50px",padding:"10px",background:colors.gray[900],borderRadius:"8px",children:["Invalid michelson code: ",$.message]})}},UnrecognizedOperation=({rawMichelson:_})=>jsxRuntimeExports.jsx(Accordion,{width:"100%",marginBottom:"8px",background:colors.gray[900],borderColor:colors.gray[900],borderRadius:"8px",allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Heading,{flex:"1",height:"30px",marginTop:"6px",textAlign:"left",size:"md",children:"Unrecognized operation"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{overflowY:"scroll",height:"400px",paddingBottom:"12px",children:jsxRuntimeExports.jsx(JsValueWrap,{space:1,value:JSON.parse(_)})})]})}),MultisigActionButton=({approveOrExecute:_,isLoading:a,signerState:$})=>{switch($){case"awaitingApprovalByExternalSigner":return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",alignSelf:"flex-end","data-testid":"multisig-signer-awaiting-approval",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[300],children:"Awaiting Approval"}),jsxRuntimeExports.jsx(HourglassIcon,{marginTop:"2px"})]});case"approved":return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",alignSelf:"flex-end",marginBottom:"8px","data-testid":"multisig-signer-approved",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[300],children:"Approved"}),jsxRuntimeExports.jsx(CheckmarkIcon,{marginTop:"2px"})]});case"executable":return jsxRuntimeExports.jsx(Button,{"data-testid":"multisig-signer-button",isLoading:a,onClick:_,children:"Execute"});case"approvable":return jsxRuntimeExports.jsx(Button,{"data-testid":"multisig-signer-button",isLoading:a,onClick:_,children:"Approve"})}},SignPage$2=({signer:_,operation:a,actionType:$,transactionCount:j})=>{const{handleAsyncAction:et}=useAsyncActionHandler(),{openWith:tt}=reactExports.useContext(DynamicModalContext),rt=useForm({defaultValues:{executeParams:a.estimates}}),nt=ot=>et(async()=>{const{opHash:st}=await executeOperations({...a,estimates:rt.watch("executeParams")},ot);return tt(jsxRuntimeExports.jsx(SuccessStep,{hash:st}))},{title:`Failed ${$}`}),it=`${lodashExports.capitalize($)} transaction`;return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(BatchModalBody,{operation:a,title:it,transactionCount:j}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{onSubmit:nt,signer:_,text:it})})]})})},MultisigSignerTile=({pendingApprovals:_,sender:a,operation:$,signerAddress:j})=>{const et=useAddressKind$1(j),tt=useGetImplicitAccountSafe(),{isLoading:rt,handleAsyncAction:nt}=useAsyncActionHandler(),{openWith:it}=reactExports.useContext(DynamicModalContext),ot=useSelectedNetwork(),st=tt(j.pkh),ct=_===0,ut=()=>nt(async()=>{if(!st)throw new Error("Can't approve or execute with an account you don't own");const Et=ct?"execute":"approve",St=makeAccountOperations(st,st,[makeMultisigApproveOrExecuteOperation(a.address,Et,$.id)]),Mt=await estimate(St,ot);let kt;try{kt=parseRawMichelson($.rawActions,a).length}catch{kt=1}return it(jsxRuntimeExports.jsx(SignPage$2,{actionType:Et,operation:Mt,signer:st,transactionCount:kt}))}),ht=getMultisigSignerState({approvals:$.approvals,signerAddress:j,operationIsExecutable:ct,signerAccount:st});return jsxRuntimeExports.jsx(AccountTileBase,{height:"80px",marginTop:"10px",marginBottom:"0",padding:"15px",borderRadius:"8px",backgroundColor:colors.gray[700],icon:jsxRuntimeExports.jsx(AddressTileIcon,{addressKind:et,size:"lg"}),leftElement:jsxRuntimeExports.jsx(LabelAndAddress,{label:et.label,pkh:et.pkh}),rightElement:jsxRuntimeExports.jsx(MultisigActionButton,{approveOrExecute:ut,"data-testid":"multisig-signer-button",isLoading:rt,signerState:ht})})},getMultisigSignerState=({signerAccount:_,operationIsExecutable:a,approvals:$,signerAddress:j})=>{const et=!!$.find(tt=>tt.pkh===j.pkh);return _?et&&!a?"approved":a?"executable":"approvable":et?"approved":"awaitingApprovalByExternalSigner"},MultisigPendingOperation=({operation:_,sender:a})=>{const{signers:$,threshold:j}=a,et=Math.max(j-_.approvals.length,0);return jsxRuntimeExports.jsxs(Box,{marginBottom:"24px",background:colors.gray[800],border:"none",borderRadius:"8px","data-testid":"multisig-pending-operation-"+_.id,paddingX:"16px",paddingY:"15px",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"6px",padding:0,textAlign:"left",children:[jsxRuntimeExports.jsxs(Heading,{size:"md",children:["Pending #",_.id]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginBottom:"6px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Pending Approvals:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"pending-approvals-count",children:et})]})]}),jsxRuntimeExports.jsxs(Box,{padding:"0",children:[jsxRuntimeExports.jsx(MultisigDecodedOperations,{rawMichelson:_.rawActions,sender:a}),$.map(tt=>jsxRuntimeExports.jsx(MultisigSignerTile,{operation:_,pendingApprovals:et,sender:a,signerAddress:tt},tt.pkh))]})]})},MultisigPendingOperations=({account:_})=>{const $=useGetPendingMultisigOperations()(_);return jsxRuntimeExports.jsx(Box,{margin:"0",padding:"0",children:$.map(j=>jsxRuntimeExports.jsx(MultisigPendingOperation,{operation:j,sender:_},j.id))})},ViewAllLink=({to:_,owner:a,...$})=>jsxRuntimeExports.jsx(Center,{...$,children:jsxRuntimeExports.jsxs(Link$1,{as:Link,color:colors.gray[300],stroke:colors.gray[450],_hover:{color:colors.green,stroke:colors.green},to:`${_}?accounts=${a}`,children:[jsxRuntimeExports.jsx(RefreshClockIcon,{display:"inline",stroke:"inherit"}),jsxRuntimeExports.jsx(Text,{display:"inline",size:"sm",children:" View All"})]})}),MAX_NFTS_SIZE=18,NFTsGrid=({owner:_,nfts:a,...$})=>{if(a.length===0)return jsxRuntimeExports.jsx(NoNFTs,{size:"md"});const j=sortedByLastUpdate(a).slice(0,MAX_NFTS_SIZE);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SimpleGrid,{marginBottom:"35px",spacing:"12px",...$,children:j.map(et=>{const tt=getIPFSurl(thumbnailUri(et)),nt={width:"100%",height:40,fallbackSrc:getIPFSurl(et.displayUri),src:tt};return jsxRuntimeExports.jsx(Link,{"data-testid":"nft-link",to:`/home/${_}/${fullId(et)}`,children:jsxRuntimeExports.jsx(Card,{background:colors.gray[800],border:"1px solid transparent",_hover:{background:colors.gray[700],borderColor:colors.gray[500]},children:jsxRuntimeExports.jsxs(CardBody,{overflow:"hidden",padding:"8px",borderRadius:"6px",children:[jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsxs(Box,{position:"relative",width:"100%",height:"100%",children:[jsxRuntimeExports.jsx(AspectRatio,{zIndex:2,width:"100%",opacity:"0",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{...nt,width:"100%",height:40})}),jsxRuntimeExports.jsx(AspectRatio,{position:"absolute",zIndex:0,top:"0",width:"100%",filter:"blur(20px)",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{...nt,width:"100%",height:40})}),jsxRuntimeExports.jsx(AspectRatio,{position:"absolute",zIndex:1,top:"0",width:"100%",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{...nt,width:"100%",height:40})})]})}),Number(et.balance)>1&&jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:3,display:"inline",height:"20px",marginTop:"-24px",marginLeft:"4px",padding:"0 8px",borderRadius:"100px",backgroundColor:"rgba(33, 33, 33, 0.75)","data-testid":"nft-owned-count",size:"xs",children:"x"+et.balance})]})})},`${_}:${fullId(et)}`)})}),a.length>MAX_NFTS_SIZE&&jsxRuntimeExports.jsx(ViewAllLink,{marginBottom:"40px",owner:_,to:"/nfts"})]})},OperationTileContext=React$2.createContext({mode:"page"}),FEE_FIELDS=["bakerFee","storageFee","allocationFee"],Fee=({operation:_})=>{const a=reactExports.useContext(OperationTileContext),j=useIsOwnedAddress()(_.sender.address);if(a.mode==="drawer"||!j)return null;const et=FEE_FIELDS.reduce((tt,rt)=>rt in _?tt.plus(lodashExports.get(_,rt)||0):tt,BigNumber(0));return et.eq(0)?null:jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"md",children:"Fee:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"fee",children:prettyTezAmount(et)})]})},useGetOperationDestination=(_,a)=>{const $=useIsOwnedAddress(),j=$(_),et=$(a);return!j&&!et?"unrelated":j?"outgoing":"incoming"},operationSign=_=>{switch(_){case"incoming":return"+";case"outgoing":return"-";case"unrelated":return""}},operationColor=_=>{switch(_){case"incoming":return colors.green;case"outgoing":return colors.orange;case"unrelated":return"white"}},InternalPrefix=({operation:_})=>{var et,tt,rt;let a,$;switch(_.type){case"transaction":a=(et=_.target)==null?void 0:et.address,$=_.sender.address;break;case"origination":case"delegation":a=null,$=_.sender.address;break;case"token_transfer":a=(tt=_.to)==null?void 0:tt.address,$=(rt=_.from)==null?void 0:rt.address;break}return useGetOperationDestination($,a)!=="unrelated"?null:jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],"data-testid":"internal-prefix",size:"md",children:"Internal:"})},OperationStatus=({level:_,status:a})=>{const $=useIsBlockFinalised(_);return a===void 0||a==="applied"?$?jsxRuntimeExports.jsx(CheckmarkIcon,{"data-testid":"checkmark"}):jsxRuntimeExports.jsx(HourglassIcon,{"data-testid":"hourglass"}):jsxRuntimeExports.jsx(CrossedCircleIcon,{"data-testid":"crossed-circle"})},OperationTypeWrapper=({children:_})=>reactExports.useContext(OperationTileContext).mode==="drawer"?null:jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[300],"data-testid":"operation-type",size:"sm",children:_}),Timestamp=({timestamp:_})=>_?jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"timestamp",size:"sm",children:getDisplayTimestamp(_)}):null,getDisplayTimestamp=_=>{const a=new Date,$=new Date(_);return differenceInDays(a,$)<2?formatDistance($,a,{addSuffix:!0}):format($,"dd MMM yyyy")},TzktLink$1=({hash:_,counter:a,transactionId:$,originationId:j,migrationId:et,children:tt,...rt})=>{const{tzktExplorerUrl:nt}=useSelectedNetwork();let it=nt;return _?it=lodashExports.compact([nt,_,a]).join("/"):et?it=`${it}/migrations/${et}`:j?it=`${it}/originations/${j}`:$?it=`${it}/transactions/${$}`:console.warn("No id provided to TzktLink"),jsxRuntimeExports.jsx(Link$1,{"data-testid":"tzkt-link",href:it,isExternal:!0,...rt,children:tt})},ContractCallTile=({operation:_})=>{var a;return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-contract-call",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(ContractIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(InternalPrefix,{operation:_}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",counter:_.counter,"data-testid":"title",hash:_.hash,children:jsxRuntimeExports.jsxs(Heading,{size:"md",children:["Contract Call: ",(a=_.parameter)==null?void 0:a.entrypoint]})}),jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:_.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{children:[_.target&&jsxRuntimeExports.jsxs(Flex,{marginRight:"15px","data-testid":"to",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.target})]}),jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.sender})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Contract Call"}),jsxRuntimeExports.jsx(OperationStatus,{..._})]})]})})]})},DelegationTile=({operation:_})=>{const a=_.newDelegate?"Delegate":"Delegation Ended";return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-delegation",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(BakerIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(InternalPrefix,{operation:_}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",counter:_.counter,"data-testid":"title",hash:_.hash,children:jsxRuntimeExports.jsx(Heading,{size:"md",children:a})}),jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:_.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{children:[_.newDelegate&&jsxRuntimeExports.jsxs(Flex,{marginRight:"15px","data-testid":"to",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.newDelegate})]}),jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.sender})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:a}),jsxRuntimeExports.jsx(OperationStatus,{..._})]})]})})]})},OriginationTile=({operation:_})=>{var j;const $=((j=_.originatedContract)==null?void 0:j.codeHash)===CODE_HASH&&_.originatedContract.typeHash===TYPE_HASH?"Multisig Account Created":"Contract Origination";return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-origination",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(ContractIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(InternalPrefix,{operation:_}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",counter:_.counter,"data-testid":"title",hash:_.hash,children:jsxRuntimeExports.jsx(Heading,{size:"md",children:$})}),jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:_.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.sender})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Contract Origination"}),jsxRuntimeExports.jsx(OperationStatus,{..._})]})]})})]})},TransactionDirectionIcon=({destination:_,...a})=>_==="outgoing"?jsxRuntimeExports.jsx(OutgoingArrow,{"data-testid":"outgoing-arrow",...a}):_==="incoming"?jsxRuntimeExports.jsx(IncomingArrow,{"data-testid":"incoming-arrow",...a}):jsxRuntimeExports.jsx(ContractIcon,{"data-testid":"unrelated-operation-icon",...a}),TokenTransferTile=({operation:_,tokenTransfer:a,token:$})=>{var ct,ut;const j=a.amount,et=useGetOperationDestination((ct=a.from)==null?void 0:ct.address,(ut=a.to)==null?void 0:ut.address),tt=$.type==="nft",rt=tokenPrettyAmount(j,$,{showSymbol:!0}),nt=operationColor(et),it=tt?"white":nt,ot=operationSign(et),st=tt?jsxRuntimeExports.jsx(Tooltip,{padding:"8px",background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],borderRadius:"8px","data-testid":"nft-tooltip",label:jsxRuntimeExports.jsx(AspectRatio,{width:"170px",height:"170px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{src:getIPFSurl(thumbnailUri($))})}),openDelay:300,children:jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(InternalPrefix,{operation:_||a}),jsxRuntimeExports.jsxs(TzktLink$1,{marginRight:"8px",color:it,"data-testid":"title",migrationId:a.migrationId,originationId:a.originationId,transactionId:a.transactionId,children:[jsxRuntimeExports.jsxs(Text,{display:"inline",color:nt,fontWeight:"600",children:[ot,rt]}),jsxRuntimeExports.jsxs(Text,{display:"inline",fontWeight:"600",children:[" ",tokenNameSafe($)]})]})]})}):jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(InternalPrefix,{operation:_||a}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",color:it,"data-testid":"title",migrationId:a.migrationId,originationId:a.originationId,transactionId:a.transactionId,children:jsxRuntimeExports.jsxs(Text,{display:"inline",color:nt,fontWeight:"600",children:[ot,rt]})})]});return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-token-transfer",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(TransactionDirectionIcon,{marginRight:"8px",destination:et}),st,_&&jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:a.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{children:[a.to&&jsxRuntimeExports.jsxs(Flex,{marginRight:"15px","data-testid":"to",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:a.to})]}),a.from&&jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:a.from})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Token Transfer"}),jsxRuntimeExports.jsx(OperationStatus,{level:a.level})]})]})})]})},TransactionTile=({operation:_})=>{var tt;const a=useGetOperationDestination(_.sender.address,(tt=_.target)==null?void 0:tt.address),$=prettyTezAmount(String(_.amount)),j=operationColor(a),et=operationSign(a);return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-transaction",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(TransactionDirectionIcon,{marginRight:"8px",destination:a}),jsxRuntimeExports.jsx(InternalPrefix,{operation:_}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",color:j,counter:_.counter,"data-testid":"title",hash:_.hash,children:jsxRuntimeExports.jsxs(Text,{color:j,fontWeight:"600",children:[et," ",$]})}),jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:_.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{children:[_.target&&jsxRuntimeExports.jsxs(Flex,{marginRight:"15px","data-testid":"to",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.target.address)})]}),jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.sender.address)})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Transaction"}),jsxRuntimeExports.jsx(OperationStatus,{..._})]})]})})]})},OperationTile=({operation:_})=>{const a=useGetTokenTransfer();switch(_.type){case"token_transfer":{const $=fromRaw$1(_.token);return $?jsxRuntimeExports.jsx(TokenTransferTile,{token:$,tokenTransfer:_}):(console.warn(`Could not parse token transfer ${_.id}`),null)}case"transaction":{const $=!!_.parameter,j=a(_.id);if(j){const et=fromRaw$1(j.token);return et?jsxRuntimeExports.jsx(TokenTransferTile,{operation:_,token:et,tokenTransfer:j}):jsxRuntimeExports.jsx(TransactionTile,{operation:_})}else return $?jsxRuntimeExports.jsx(ContractCallTile,{operation:_}):jsxRuntimeExports.jsx(TransactionTile,{operation:_})}case"delegation":return jsxRuntimeExports.jsx(DelegationTile,{operation:_});case"origination":return jsxRuntimeExports.jsx(OriginationTile,{operation:_})}},MAX_OPERATIONS_SIZE=20,OperationListDisplay=({owner:_,operations:a})=>{if(a.length===0)return jsxRuntimeExports.jsx(NoOperations,{size:"md"});const $=a.slice(0,MAX_OPERATIONS_SIZE);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[$.map((j,et)=>jsxRuntimeExports.jsxs(Box,{height:"90px",children:[jsxRuntimeExports.jsx(OperationTile,{operation:j}),et<$.length-1&&jsxRuntimeExports.jsx(Divider,{marginY:"20px"})]},j.id)),a.length>MAX_OPERATIONS_SIZE&&jsxRuntimeExports.jsx(ViewAllLink,{owner:_,to:"/operations"})]})},verifiedTokens=["KT1XnTn74bUtxHfDtBmm2bGZAQfhPbvKWR8o","KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn","KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW","KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW","KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW","KT1K9gCRgaLRFKTErYt1wVxA3Frb9FjasjTV","KT1Ha4yFVeyzw6KRAdkzq6TxDHB97KG4pZe8","KT1JBNFcB5tiycHNdYGYCtR3kk6JaJysUCi8","KT1Xobej4mc6XgEjDoJoHtTKgbD1ELMvcQuL","KT1JVjgXPMMSaa6FkzeJcgb8q9cUaLmwaJUX","KT193D4vozYnhGJQVtw7CoxxqphqUEEwK6Vb","KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9","KT1914CUZ7EegAFPbfgQMRkw8Uz5mYkEz2ui","KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY","KT19ovJhcsUn4YU8Q5L3BGovKSixfbWcecEA","KT1TgmD7kXQzofpuc9VbTRMdZCS2e6JDuTtc","KT1F1mn2jbqQCJcsNgYKVAQjvenecNMY2oPK","KT1ErKVqEhG9jxXgUG2KGLW3bNM7zXHX8SDF","KT1A5P4ejnLix13jtadsfV9GCnXLMNnab8UT","KT1AM3PV1cwmGRw28DVTgsjjsjHvmL6z4rGh","KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY","KT1SjXiUX63QvdNMcM2m492f7kuf8JxXRLp4","KT1MZg99PxMDEENwB4Fi64xkqAVh5d1rv8Z9","KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY","KT1XTxpQvo7oRCqp85LikEZgAZ22uDxhbWJv","KT1VaEsVNiBoA56eToEK6n6BcPgh1tdx9eXi"],TokenNameWithIcon=({token:_,...a})=>{const $=verifiedTokens.includes(_.contract);return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Text,{...a,marginRight:"4px",children:tokenNameSafe(_)}),$&&jsxRuntimeExports.jsx(VerifiedIcon,{})]})},MAX_TOKENS_SIZE=20,TokenList=({owner:_,tokens:a})=>{if(a.length===0)return jsxRuntimeExports.jsx(NoTokens,{size:"md"});const $=a.slice(0,MAX_TOKENS_SIZE);return jsxRuntimeExports.jsxs(Box,{children:[$.map(j=>jsxRuntimeExports.jsx(TokenTile$1,{token:j},fullId(j))),a.length>MAX_TOKENS_SIZE&&jsxRuntimeExports.jsx(ViewAllLink,{owner:_,to:"/tokens"})]})},TokenTile$1=({token:_})=>{const a=tokenPrettyAmount(_.balance,_,{showSymbol:!1});return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-around",height:20,borderBottom:`1px solid ${colors.gray[800]}`,"data-testid":"token-tile",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",flex:1,children:[jsxRuntimeExports.jsx(TokenIcon,{width:"38px",background:colors.gray[500],borderRadius:"4px",contract:_.contract}),jsxRuntimeExports.jsx(Box,{marginLeft:"16px",children:jsxRuntimeExports.jsx(TokenNameWithIcon,{fontWeight:600,"data-testid":"token-name",token:_})})]}),jsxRuntimeExports.jsx(Heading,{"data-testid":"token-balance",size:"lg",children:a})]})},buildTzktAddressUrl=(_,a)=>`${_.tzktExplorerUrl}/${a}`,useGetOperations=_=>{const a=useSelectedNetwork(),$=useAppDispatch(),j=useRefetchTrigger(),et=useReactQueryErrorHandler(),{isFetching:tt,data:rt,hasNextPage:nt,isLoading:it,fetchNextPage:ot,fetchPreviousPage:st,error:ct}=useInfiniteQuery({queryFn:({pageParam:ut})=>fetchOperationsAndUpdateTokensInfo($,a,_,ut),queryKey:["operations",_,$,a],initialPageParam:{},retry:3,retryDelay:ut=>ut*2e3,gcTime:0,refetchOnWindowFocus:!1,getNextPageParam:ut=>ut.length===0?null:{lastId:ut[ut.length-1].id},getPreviousPageParam:(ut,ht)=>{var St;const Et=(St=lodashExports.maxBy(ht.flat(),"id"))==null?void 0:St.id;return Et?{lastId:Et,sort:"asc"}:{}},select:({pages:ut})=>filterDuplicatedTokenTransfers([[...ut[0]].sort((ht,Et)=>ht.id{const ut=setInterval(()=>void st(),BLOCK_TIME);return()=>clearInterval(ut)},[st]),reactExports.useEffect(()=>{st()},[j,st]),{operations:rt||[],isFirstLoad:it,isLoading:tt,hasMore:nt,loadMore:ot}},fetchOperationsAndUpdateTokensInfo=async(_,a,$,j)=>{const et=await getCombinedOperations($.map(ot=>ot.address.pkh),a,j),tt=et.filter(ot=>ot.type==="transaction").map(ot=>ot.id),rt=await getRelatedTokenTransfers(tt,a),nt=et.filter(ot=>ot.type==="token_transfer"),it=[...rt,...nt];return _(assetsActions.updateTokenTransfers(it)),_(tokensActions.addTokens({network:a,tokens:it.map(ot=>ot.token)})),et},filterDuplicatedTokenTransfers=_=>{const a=new Set(_.filter($=>$.type!=="token_transfer").map($=>$.id));return _.filter($=>$.type!=="token_transfer"||!a.has($.transactionId))},SmallTab=({children:_,...a})=>jsxRuntimeExports.jsx(Tab,{...a,fontSize:"sm",paddingX:3,children:_}),AssetsPanel=({tokens:_,nfts:a,account:$,delegation:j})=>{const et=useGetPendingMultisigOperations(),tt=$.type==="multisig"&&et($).length>0,rt=useSelectedNetwork(),{operations:nt,isFirstLoad:it}=useGetOperations([$]);return jsxRuntimeExports.jsxs(Tabs,{flexDirection:"column",display:"flex",width:"100%",marginTop:"60px","data-testid":"asset-panel",children:[jsxRuntimeExports.jsxs(TabList,{justifyContent:"space-between","data-testid":"asset-panel-tablist",children:[jsxRuntimeExports.jsxs(Flex,{children:[tt&&jsxRuntimeExports.jsxs(SmallTab,{"data-testid":"account-card-pending-tab",children:[jsxRuntimeExports.jsx(Text,{children:"Pending"}),jsxRuntimeExports.jsx(Box,{width:"6px",height:"6px",marginTop:"-7px",marginRight:"-3px",marginLeft:"3px",borderRadius:"100%",backgroundColor:colors.orangeL})]}),jsxRuntimeExports.jsx(SmallTab,{"data-testid":"account-card-operations-tab",children:"Operations"}),jsxRuntimeExports.jsx(SmallTab,{"data-testid":"account-card-delegation-tab",children:"Delegation"}),jsxRuntimeExports.jsx(SmallTab,{"data-testid":"account-card-nfts-tab",children:"NFTs"}),jsxRuntimeExports.jsx(SmallTab,{"data-testid":"account-card-tokens-tab",children:"Tokens"})]}),jsxRuntimeExports.jsx(ExternalLink,{href:buildTzktAddressUrl(rt,$.address.pkh),children:jsxRuntimeExports.jsxs(Button,{paddingRight:0,variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{marginRight:"7px",size:"sm",children:"View on Tzkt"}),jsxRuntimeExports.jsx(ExternalLinkIcon,{stroke:"currentcolor"})]})})]}),jsxRuntimeExports.jsxs(TabPanels,{height:"100%",children:[tt&&jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",height:"100%",paddingTop:"24px",paddingBottom:"60px","data-testid":"account-card-pending-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsx(MultisigPendingOperations,{account:$})}),jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",height:"100%",paddingTop:"24px",paddingBottom:"60px","data-testid":"account-card-operations-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsxs(OperationTileContext.Provider,{value:{mode:"drawer",selectedAddress:$.address},children:[jsxRuntimeExports.jsx(Center,{display:it?"flex":"none",height:"50px",children:jsxRuntimeExports.jsx(Image$1,{width:"150px",height:"75px",src:"./static/media/loading-wheel.gif"})}),!it&&jsxRuntimeExports.jsx(OperationListDisplay,{operations:nt,owner:$.address.pkh})]})}),jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",paddingTop:"24px","data-testid":"account-card-delegation-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsx(DelegationDisplay,{account:$,delegation:j})}),jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",height:"100%",paddingTop:"24px",paddingBottom:0,"data-testid":"account-card-nfts-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsx(NFTsGrid,{columns:3,nfts:a,owner:$.address.pkh})}),jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",height:"100%",paddingTop:"24px","data-testid":"account-card-tokens-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsx(TokenList,{owner:$.address.pkh,tokens:_})})]})]})},MultisigApprovers=({signers:_})=>jsxRuntimeExports.jsx(Box,{width:"100%",marginTop:"40px",marginBottom:"-20px",background:colors.gray[800],borderRadius:"8px",children:jsxRuntimeExports.jsx(Accordion,{padding:"15px",allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{as:"span",flex:"1",padding:"0",textAlign:"left",cursor:"pointer",children:[jsxRuntimeExports.jsx(Heading,{width:"100%",size:"md",children:"Approvers"}),jsxRuntimeExports.jsx(AccordionIcon,{cursor:"pointer"})]}),jsxRuntimeExports.jsx(AccordionPanel,{padding:"0",children:jsxRuntimeExports.jsx(Wrap,{marginTop:"20px","data-testid":"multisig-tag-section",spacingX:"0",spacingY:"12px",children:_.map(a=>jsxRuntimeExports.jsx(AddressPill,{marginRight:"12px",address:a},a.pkh))})})]})})}),renameAccount=(_,a)=>($,j)=>{const{accounts:et,multisigs:tt,contacts:rt}=j(),nt=_.type==="multisig",it=et.items.map(ct=>ct.label),ot=tt.items.map(ct=>ct.label),st=Object.values(rt).map(ct=>ct.name);[it,ot,st].flat().includes(a)||$(nt?multisigsSlice.actions.setName({newName:a,account:_}):accountsSlice.actions.renameAccount({newName:a,account:_}))},RenameAccountModal=({account:_})=>{const a=useAppDispatch(),{onClose:$}=reactExports.useContext(DynamicModalContext),j=({name:ct})=>{a(renameAccount(_,ct)),$()},{handleSubmit:et,formState:{isValid:tt,errors:rt},register:nt,reset:it}=useForm({mode:"onBlur",defaultValues:{name:_.label}}),ot=({name:ct})=>{j({name:ct.trim()}),it()},st=useValidateName(_.label);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:et(ot),children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"Edit your account name here.",title:"Edit Name"}),jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!rt.name,marginY:"20px",children:[jsxRuntimeExports.jsx(FormLabel,{children:"Account name"}),jsxRuntimeExports.jsx(Input,{type:"text",...nt("name",{required:"Name is required",validate:st}),placeholder:"Enter contact's name"}),rt.name&&jsxRuntimeExports.jsx(FormErrorMessage$1,{"data-testid":"name-error",children:rt.name.message})]})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:"8px",isDisabled:!tt,size:"lg",type:"submit",children:"Save"})})]})})},RenameRemoveMenuSwitch=({account:_})=>{const{openWith:a,onClose:$}=reactExports.useContext(DynamicModalContext),j=useNavigate(),et=useImplicitAccounts().length===1,tt=useRemoveAccount();let rt;switch(_.type){case"secret_key":case"ledger":case"social":rt=()=>a(jsxRuntimeExports.jsx(ConfirmationModal,{buttonLabel:ot,description:it,onSubmit:()=>{tt(_),$(),j("/")},title:nt}));break}const nt="Remove Account";let it="Are you sure you want to remove this account?",ot="Remove Account";return et&&(it="Removing your last account will off-board you from Umami. This will remove or reset all customized settings to their defaults. Personal data (including saved contacts, password and accounts) won't be affected.",ot="Remove & Off-board"),jsxRuntimeExports.jsx(RenameRemoveMenu,{onRemove:rt,onRename:()=>a(jsxRuntimeExports.jsx(RenameAccountModal,{account:_}))})},makeDelegation=_=>_.newDelegate?{sender:_.sender.address,timestamp:_.timestamp,id:_.id,amount:new BigNumber(_.amount),delegate:{address:_.newDelegate.address,alias:_.newDelegate.alias??void 0}}:null,TezRecapDisplay=_=>jsxRuntimeExports.jsxs(Box,{textAlign:_.center?"center":"initial",children:[jsxRuntimeExports.jsx(Heading,{size:"md",children:prettyTezAmount(_.balance)}),_.dollarBalance!==void 0&&jsxRuntimeExports.jsxs(Text,{marginTop:"6px",color:colors.gray[400],size:"sm",children:["$",_.dollarBalance.toFixed(2)]})]}),RoundButton=({icon:_,label:a,onClick:$=()=>{}})=>jsxRuntimeExports.jsxs(Box,{className:"account-drawer-cta-button",color:colors.gray[300],textAlign:"center",_hover:{color:colors.green},cursor:"pointer",marginX:"24px",onClick:$,children:[jsxRuntimeExports.jsx(IconButton,{className:"account-drawer-cta-button-icon",marginBottom:"8px","aria-label":"button",icon:_,size:"lg",variant:"circle_without_color"}),jsxRuntimeExports.jsx(Text,{cursor:"pointer",size:"sm",children:a})]}),AccountDrawerDisplay=({onSend:_,onReceive:a=()=>{},balance:$,dollarBalance:j,tokens:et,nfts:tt,account:rt})=>{const nt=rt.type==="multisig",{openWith:it}=reactExports.useContext(DynamicModalContext),ot=useSelectedNetwork(),[st,ct]=reactExports.useState(null),{handleAsyncAction:ut}=useAsyncActionHandler();return reactExports.useEffect(()=>{ut(async()=>{const ht=await getLastDelegation(rt.address.pkh,ot);ht&&ct(makeDelegation(ht))}).catch(lodashExports.noop)},[rt.address.pkh,ut,ot]),jsxRuntimeExports.jsxs(Flex,{zIndex:2,alignItems:"center",flexDirection:"column",height:"100%",marginTop:"-86px",paddingTop:"86px",paddingRight:"30px",background:accountIconGradient({account:rt,radius:"350px",opacity:"35",mainBackgroundColor:"transparent",left:"300px",top:"-125px"}),"data-testid":`account-card-${rt.address.pkh}`,children:[jsxRuntimeExports.jsx(AccountTileIcon,{account:rt,size:"lg"}),jsxRuntimeExports.jsx(Heading,{marginTop:"24px",size:"md",children:rt.label}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"8px",marginBottom:"30px",children:[jsxRuntimeExports.jsx(AddressPill,{marginRight:"4px",address:rt.address,mode:{type:"no_icons"}}),jsxRuntimeExports.jsx(RenameRemoveMenuSwitch,{account:rt})]}),$&&jsxRuntimeExports.jsx(TezRecapDisplay,{balance:$,center:!0,dollarBalance:j}),jsxRuntimeExports.jsxs(Center,{marginTop:"34px",children:[jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(OutgoingArrow,{width:"24px",height:"24px",stroke:"currentcolor"}),label:"Send",onClick:_}),jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(IncomingArrow,{width:"24px",height:"24px",stroke:"currentcolor"}),label:"Receive",onClick:a}),!nt&&jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(PlusIcon,{stroke:"currentcolor"}),label:"Buy Tez",onClick:()=>it(jsxRuntimeExports.jsx(BuyTezForm,{recipient:rt.address.pkh}))}),jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(BakerIcon,{width:"24px",height:"24px",stroke:"currentcolor"}),label:"Delegate",onClick:()=>it(jsxRuntimeExports.jsx(FormPage$3,{form:st?{baker:st.delegate.address,sender:rt.address.pkh}:void 0,sender:rt}))})]}),nt&&jsxRuntimeExports.jsx(MultisigApprovers,{signers:rt.signers}),jsxRuntimeExports.jsx(AssetsPanel,{account:rt,delegation:st,nfts:tt,tokens:et})]})};var dist={},lodash_isequal={exports:{}};lodash_isequal.exports;(function(_,a){var $=200,j="__lodash_hash_undefined__",et=1,tt=2,rt=9007199254740991,nt="[object Arguments]",it="[object Array]",ot="[object AsyncFunction]",st="[object Boolean]",ct="[object Date]",ut="[object Error]",ht="[object Function]",Et="[object GeneratorFunction]",St="[object Map]",Mt="[object Number]",kt="[object Null]",Ct="[object Object]",Ot="[object Promise]",zt="[object Proxy]",Ut="[object RegExp]",Vt="[object Set]",jt="[object String]",$t="[object Symbol]",Bt="[object Undefined]",Nt="[object WeakMap]",Lt="[object ArrayBuffer]",Pt="[object DataView]",bt="[object Float32Array]",at="[object Float64Array]",dt="[object Int8Array]",vt="[object Int16Array]",xt="[object Int32Array]",wt="[object Uint8Array]",_t="[object Uint8ClampedArray]",At="[object Uint16Array]",Tt="[object Uint32Array]",yt=/[\\^$.*+?()[\]{}|]/g,It=/^\[object .+?Constructor\]$/,rr=/^(?:0|[1-9]\d*)$/,ir={};ir[bt]=ir[at]=ir[dt]=ir[vt]=ir[xt]=ir[wt]=ir[_t]=ir[At]=ir[Tt]=!0,ir[nt]=ir[it]=ir[Lt]=ir[st]=ir[Pt]=ir[ct]=ir[ut]=ir[ht]=ir[St]=ir[Mt]=ir[Ct]=ir[Ut]=ir[Vt]=ir[jt]=ir[Nt]=!1;var nr=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Gt=typeof self=="object"&&self&&self.Object===Object&&self,qt=nr||Gt||Function("return this")(),Jt=a&&!a.nodeType&&a,Ft=Jt&&!0&&_&&!_.nodeType&&_,Kt=Ft&&Ft.exports===Jt,Qt=Kt&&nr.process,dr=function(){try{return Qt&&Qt.binding&&Qt.binding("util")}catch{}}(),xr=dr&&dr.isTypedArray;function pr(_r,Yt){for(var cr=-1,gr=_r==null?0:_r.length,Dr=0,Zr=[];++cr-1}function vs(_r,Yt){var cr=this.__data__,gr=wo(cr,_r);return gr<0?(++this.size,cr.push([_r,Yt])):cr[gr][1]=Yt,this}hn.prototype.clear=yn,hn.prototype.delete=ps,hn.prototype.get=ms,hn.prototype.has=gs,hn.prototype.set=vs;function Zn(_r){var Yt=-1,cr=_r==null?0:_r.length;for(this.clear();++Ytwn))return!1;var mn=Zr.get(_r);if(mn&&Zr.get(Yt))return mn==Yt;var Bn=-1,Fn=!0,Xn=cr&tt?new os:void 0;for(Zr.set(_r,Yt),Zr.set(Yt,_r);++Bn-1&&_r%1==0&&_r-1&&_r%1==0&&_r<=rt}function Lo(_r){var Yt=typeof _r;return _r!=null&&(Yt=="object"||Yt=="function")}function Co(_r){return _r!=null&&typeof _r=="object"}var Bo=xr?fr(xr):xl;function Xl(_r){return To(_r)?yl(_r):El(_r)}function Qn(){return[]}function Gn(){return!1}_.exports=Cs})(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports,qrcode={exports:{}};(function(_,a){var $=function(){var j=function(Ut,Vt){var jt=236,$t=17,Bt=Ut,Nt=tt[Vt],Lt=null,Pt=0,bt=null,at=[],dt={},vt=function(qt,Jt){Pt=Bt*4+17,Lt=function(Ft){for(var Kt=new Array(Ft),Qt=0;Qt=7&&Tt(qt),bt==null&&(bt=ir(Bt,Nt,at)),It(bt,Jt)},xt=function(qt,Jt){for(var Ft=-1;Ft<=7;Ft+=1)if(!(qt+Ft<=-1||Pt<=qt+Ft))for(var Kt=-1;Kt<=7;Kt+=1)Jt+Kt<=-1||Pt<=Jt+Kt||(0<=Ft&&Ft<=6&&(Kt==0||Kt==6)||0<=Kt&&Kt<=6&&(Ft==0||Ft==6)||2<=Ft&&Ft<=4&&2<=Kt&&Kt<=4?Lt[qt+Ft][Jt+Kt]=!0:Lt[qt+Ft][Jt+Kt]=!1)},wt=function(){for(var qt=0,Jt=0,Ft=0;Ft<8;Ft+=1){vt(!0,Ft);var Kt=nt.getLostPoint(dt);(Ft==0||qt>Kt)&&(qt=Kt,Jt=Ft)}return Jt},_t=function(){for(var qt=8;qt>Ft&1)==1;Lt[Math.floor(Ft/3)][Ft%3+Pt-8-3]=Kt}for(var Ft=0;Ft<18;Ft+=1){var Kt=!qt&&(Jt>>Ft&1)==1;Lt[Ft%3+Pt-8-3][Math.floor(Ft/3)]=Kt}},yt=function(qt,Jt){for(var Ft=Nt<<3|Jt,Kt=nt.getBCHTypeInfo(Ft),Qt=0;Qt<15;Qt+=1){var dr=!qt&&(Kt>>Qt&1)==1;Qt<6?Lt[Qt][8]=dr:Qt<8?Lt[Qt+1][8]=dr:Lt[Pt-15+Qt][8]=dr}for(var Qt=0;Qt<15;Qt+=1){var dr=!qt&&(Kt>>Qt&1)==1;Qt<8?Lt[8][Pt-Qt-1]=dr:Qt<9?Lt[8][15-Qt-1+1]=dr:Lt[8][15-Qt-1]=dr}Lt[Pt-8][8]=!qt},It=function(qt,Jt){for(var Ft=-1,Kt=Pt-1,Qt=7,dr=0,xr=nt.getMaskFunction(Jt),pr=Pt-1;pr>0;pr-=2)for(pr==6&&(pr-=1);;){for(var Ir=0;Ir<2;Ir+=1)if(Lt[Kt][pr-Ir]==null){var Cr=!1;dr>>Qt&1)==1);var lr=xr(Kt,pr-Ir);lr&&(Cr=!Cr),Lt[Kt][pr-Ir]=Cr,Qt-=1,Qt==-1&&(dr+=1,Qt=7)}if(Kt+=Ft,Kt<0||Pt<=Kt){Kt-=Ft,Ft=-Ft;break}}},rr=function(qt,Jt){for(var Ft=0,Kt=0,Qt=0,dr=new Array(Jt.length),xr=new Array(Jt.length),pr=0;pr=0?Ar.getAt(kr):0}}for(var Sr=0,lr=0;lrpr*8)throw"code length overflow. ("+Qt.getLengthInBits()+">"+pr*8+")";for(Qt.getLengthInBits()+4<=pr*8&&Qt.put(0,4);Qt.getLengthInBits()%8!=0;)Qt.putBit(!1);for(;!(Qt.getLengthInBits()>=pr*8||(Qt.put(jt,8),Qt.getLengthInBits()>=pr*8));)Qt.put($t,8);return rr(Qt,Kt)};dt.addData=function(qt,Jt){Jt=Jt||"Byte";var Ft=null;switch(Jt){case"Numeric":Ft=ut(qt);break;case"Alphanumeric":Ft=ht(qt);break;case"Byte":Ft=Et(qt);break;case"Kanji":Ft=St(qt);break;default:throw"mode:"+Jt}at.push(Ft),bt=null},dt.isDark=function(qt,Jt){if(qt<0||Pt<=qt||Jt<0||Pt<=Jt)throw qt+","+Jt;return Lt[qt][Jt]},dt.getModuleCount=function(){return Pt},dt.make=function(){if(Bt<1){for(var qt=1;qt<40;qt++){for(var Jt=st.getRSBlocks(qt,Nt),Ft=ct(),Kt=0;Kt"u"?qt*4:Jt;var Ft="";Ft+='";for(var Qt=0;Qt';Ft+=""}return Ft+="",Ft+="
",Ft},dt.createSvgTag=function(qt,Jt,Ft,Kt){var Qt={};typeof arguments[0]=="object"&&(Qt=arguments[0],qt=Qt.cellSize,Jt=Qt.margin,Ft=Qt.alt,Kt=Qt.title),qt=qt||2,Jt=typeof Jt>"u"?qt*4:Jt,Ft=typeof Ft=="string"?{text:Ft}:Ft||{},Ft.text=Ft.text||null,Ft.id=Ft.text?Ft.id||"qrcode-description":null,Kt=typeof Kt=="string"?{text:Kt}:Kt||{},Kt.text=Kt.text||null,Kt.id=Kt.text?Kt.id||"qrcode-title":null;var dr=dt.getModuleCount()*qt+Jt*2,xr,pr,Ir,Cr,lr="",fr;for(fr="l"+qt+",0 0,"+qt+" -"+qt+",0 0,-"+qt+"z ",lr+=''+nr(Kt.text)+"":"",lr+=Ft.text?''+nr(Ft.text)+"":"",lr+='',lr+='"u"?qt*4:Jt;var Ft=dt.getModuleCount()*qt+Jt*2,Kt=Jt,Qt=Ft-Jt;return zt(Ft,Ft,function(dr,xr){if(Kt<=dr&&dr"u"?qt*4:Jt;var Kt=dt.getModuleCount()*qt+Jt*2,Qt="";return Qt+="",Qt};var nr=function(qt){for(var Jt="",Ft=0;Ft":Jt+=">";break;case"&":Jt+="&";break;case'"':Jt+=""";break;default:Jt+=Kt;break}}return Jt},Gt=function(qt){var Jt=1;qt=typeof qt>"u"?Jt*2:qt;var Ft=dt.getModuleCount()*Jt+qt*2,Kt=qt,Qt=Ft-qt,dr,xr,pr,Ir,Cr,lr={"██":"█","█ ":"▀"," █":"▄"," ":" "},fr={"██":"▀","█ ":"▀"," █":" "," ":" "},Er="";for(dr=0;dr=Qt?fr[Cr]:lr[Cr];Er+=` `}return Ft%2&&qt>0?Er.substring(0,Er.length-Ft-1)+Array(Ft+1).join("▀"):Er.substring(0,Er.length-1)};return dt.createASCII=function(qt,Jt){if(qt=qt||1,qt<2)return Gt(Jt);qt-=1,Jt=typeof Jt>"u"?qt*2:Jt;var Ft=dt.getModuleCount()*qt+Jt*2,Kt=Jt,Qt=Ft-Jt,dr,xr,pr,Ir,Cr=Array(qt+1).join("██"),lr=Array(qt+1).join(" "),fr="",Er="";for(dr=0;dr>>8),Nt.push(bt&255)):Nt.push($t)}}return Nt}};var et={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},tt={L:1,M:0,Q:3,H:2},rt={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},nt=function(){var Ut=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],Vt=1335,jt=7973,$t=21522,Bt={},Nt=function(Lt){for(var Pt=0;Lt!=0;)Pt+=1,Lt>>>=1;return Pt};return Bt.getBCHTypeInfo=function(Lt){for(var Pt=Lt<<10;Nt(Pt)-Nt(Vt)>=0;)Pt^=Vt<=0;)Pt^=jt<5&&(bt+=3+vt-5)}for(var at=0;at=256;)Bt-=255;return Ut[Bt]},$t}();function ot(Ut,Vt){if(typeof Ut.length>"u")throw Ut.length+"/"+Vt;var jt=function(){for(var Bt=0;Bt"u")throw"bad rs block @ typeNumber:"+Bt+"/errorCorrectionLevel:"+Nt;for(var Pt=Lt.length/3,bt=[],at=0;at>>7-$t%8&1)==1},jt.put=function($t,Bt){for(var Nt=0;Nt>>Bt-Nt-1&1)==1)},jt.getLengthInBits=function(){return Vt},jt.putBit=function($t){var Bt=Math.floor(Vt/8);Ut.length<=Bt&&Ut.push(0),$t&&(Ut[Bt]|=128>>>Vt%8),Vt+=1},jt},ut=function(Ut){var Vt=et.MODE_NUMBER,jt=Ut,$t={};$t.getMode=function(){return Vt},$t.getLength=function(Lt){return jt.length},$t.write=function(Lt){for(var Pt=jt,bt=0;bt+2>>8&255)*192+(bt&255),Nt.put(bt,13),Pt+=2}if(Pt>>8)},Vt.writeBytes=function(jt,$t,Bt){$t=$t||0,Bt=Bt||jt.length;for(var Nt=0;Nt0&&(jt+=","),jt+=Ut[$t];return jt+="]",jt},Vt},kt=function(){var Ut=0,Vt=0,jt=0,$t="",Bt={},Nt=function(Pt){$t+=String.fromCharCode(Lt(Pt&63))},Lt=function(Pt){if(!(Pt<0)){if(Pt<26)return 65+Pt;if(Pt<52)return 97+(Pt-26);if(Pt<62)return 48+(Pt-52);if(Pt==62)return 43;if(Pt==63)return 47}throw"n:"+Pt};return Bt.writeByte=function(Pt){for(Ut=Ut<<8|Pt&255,Vt+=8,jt+=1;Vt>=6;)Nt(Ut>>>Vt-6),Vt-=6},Bt.flush=function(){if(Vt>0&&(Nt(Ut<<6-Vt),Ut=0,Vt=0),jt%3!=0)for(var Pt=3-jt%3,bt=0;bt=Vt.length){if(Bt==0)return-1;throw"unexpected end of file./"+Bt}var Pt=Vt.charAt(jt);if(jt+=1,Pt=="=")return Bt=0,-1;if(Pt.match(/^\s$/))continue;$t=$t<<6|Lt(Pt.charCodeAt(0)),Bt+=6}var bt=$t>>>Bt-8&255;return Bt-=8,bt};var Lt=function(Pt){if(65<=Pt&&Pt<=90)return Pt-65;if(97<=Pt&&Pt<=122)return Pt-97+26;if(48<=Pt&&Pt<=57)return Pt-48+52;if(Pt==43)return 62;if(Pt==47)return 63;throw"c:"+Pt};return Nt},Ot=function(Ut,Vt){var jt=Ut,$t=Vt,Bt=new Array(Ut*Vt),Nt={};Nt.setPixel=function(at,dt,vt){Bt[dt*jt+at]=vt},Nt.write=function(at){at.writeString("GIF87a"),at.writeShort(jt),at.writeShort($t),at.writeByte(128),at.writeByte(0),at.writeByte(0),at.writeByte(0),at.writeByte(0),at.writeByte(0),at.writeByte(255),at.writeByte(255),at.writeByte(255),at.writeString(","),at.writeShort(0),at.writeShort(0),at.writeShort(jt),at.writeShort($t),at.writeByte(0);var dt=2,vt=Pt(dt);at.writeByte(dt);for(var xt=0;vt.length-xt>255;)at.writeByte(255),at.writeBytes(vt,xt,255),xt+=255;at.writeByte(vt.length-xt),at.writeBytes(vt,xt,vt.length-xt),at.writeByte(0),at.writeString(";")};var Lt=function(at){var dt=at,vt=0,xt=0,wt={};return wt.write=function(_t,At){if(_t>>>At)throw"length over";for(;vt+At>=8;)dt.writeByte(255&(_t<>>=8-vt,xt=0,vt=0;xt=_t<0&&dt.writeByte(xt)},wt},Pt=function(at){for(var dt=1<>6,128|it&63):it<55296||it>=57344?rt.push(224|it>>12,128|it>>6&63,128|it&63):(nt++,it=65536+((it&1023)<<10|tt.charCodeAt(nt)&1023),rt.push(240|it>>18,128|it>>12&63,128|it>>6&63,128|it&63))}return rt}return et(j)}})(),function(j){_.exports=j()}(function(){return $})})(qrcode);var qrcodeExports=qrcode.exports,__extends=commonjsGlobal&&commonjsGlobal.__extends||function(){var _=function(a,$){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(j,et){j.__proto__=et}||function(j,et){for(var tt in et)Object.prototype.hasOwnProperty.call(et,tt)&&(j[tt]=et[tt])},_(a,$)};return function(a,$){if(typeof $!="function"&&$!==null)throw new TypeError("Class extends value "+String($)+" is not a constructor or null");_(a,$);function j(){this.constructor=a}a.prototype=$===null?Object.create($):(j.prototype=$.prototype,new j)}}(),__assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(_){for(var a,$=1,j=arguments.length;$=1&&tt<=127?j+=$.charAt(et):tt>2047?(j+=String.fromCharCode(224|tt>>12&15),j+=String.fromCharCode(128|tt>>6&63),j+=String.fromCharCode(128|tt>>0&63)):(j+=String.fromCharCode(192|tt>>6&31),j+=String.fromCharCode(128|tt>>0&63));return j},a.prototype.drawRoundedSquare=function($,j,et,tt,rt,nt,it,ot){ot.lineWidth=$,ot.fillStyle=rt,ot.strokeStyle=rt,et+=$/2,j+=$/2,tt-=$,Array.isArray(nt)||(nt=[nt,nt,nt,nt]),nt=nt.map(function(Et){return Et=Math.min(Et,tt/2),Et<0?0:Et});var st=nt[0]||0,ct=nt[1]||0,ut=nt[2]||0,ht=nt[3]||0;ot.beginPath(),ot.moveTo(j+st,et),ot.lineTo(j+tt-ct,et),ct&&ot.quadraticCurveTo(j+tt,et,j+tt,et+ct),ot.lineTo(j+tt,et+tt-ut),ut&&ot.quadraticCurveTo(j+tt,et+tt,j+tt-ut,et+tt),ot.lineTo(j+ht,et+tt),ht&&ot.quadraticCurveTo(j,et+tt,j,et+tt-ht),ot.lineTo(j,et+st),st&&ot.quadraticCurveTo(j,et,j+st,et),ot.closePath(),ot.stroke(),it&&ot.fill()},a.prototype.drawPositioningPattern=function($,j,et,tt,rt,nt,it){it===void 0&&(it=[0,0,0,0]);var ot=Math.ceil(j),st,ct;typeof it!="number"&&!Array.isArray(it)?(st=it.outer||0,ct=it.inner||0):(st=it,ct=st);var ut,ht;typeof nt!="string"?(ut=nt.outer,ht=nt.inner):(ut=nt,ht=nt);var Et=tt*j+et,St=rt*j+et,Mt=j*7;this.drawRoundedSquare(ot,St,Et,Mt,ut,st,!1,$),Mt=j*3,Et+=j*2,St+=j*2,this.drawRoundedSquare(ot,St,Et,Mt,ht,ct,!0,$)},a.prototype.isInPositioninZone=function($,j,et){return et.some(function(tt){return j>=tt.row&&j<=tt.row+7&&$>=tt.col&&$<=tt.col+7})},a.prototype.transformPixelLengthIntoNumberOfCells=function($,j){return $/j},a.prototype.isCoordinateInImage=function($,j,et,tt,rt,nt,it,ot){if(ot){var st=2,ct=this.transformPixelLengthIntoNumberOfCells(rt,it),ut=this.transformPixelLengthIntoNumberOfCells(nt,it),ht=this.transformPixelLengthIntoNumberOfCells(et,it)-1,Et=this.transformPixelLengthIntoNumberOfCells(tt,it)-1;return j>=ct-st&&j<=ct+ht+st&&$>=ut-st&&$<=ut+Et+st}else return!1},a.prototype.shouldComponentUpdate=function($){return!isEqual$1(this.props,$)},a.prototype.componentDidMount=function(){this.update()},a.prototype.componentDidUpdate=function(){this.update()},a.prototype.update=function(){var $,j=this.props,et=j.value,tt=j.ecLevel,rt=j.enableCORS,nt=j.bgColor,it=j.fgColor,ot=j.logoImage,st=j.logoOpacity,ct=j.logoOnLoad,ut=j.removeQrCodeBehindLogo,ht=j.qrStyle,Et=j.eyeRadius,St=j.eyeColor,Mt=j.logoPaddingStyle,kt=+this.props.size,Ct=+this.props.quietZone,Ot=this.props.logoWidth?+this.props.logoWidth:0,zt=this.props.logoHeight?+this.props.logoHeight:0,Ut=this.props.logoPadding?+this.props.logoPadding:0,Vt=qrGenerator(0,tt);Vt.addData(this.utf16to8(et)),Vt.make();var jt=($=this.canvasRef)===null||$===void 0?void 0:$.current,$t=jt.getContext("2d"),Bt=kt+2*Ct,Nt=Vt.getModuleCount(),Lt=kt/Nt,Pt=window.devicePixelRatio||1;jt.height=jt.width=Bt*Pt,$t.scale(Pt,Pt),$t.fillStyle=nt,$t.fillRect(0,0,Bt,Bt);var bt=Ct,at=[{row:0,col:0},{row:0,col:Nt-7},{row:Nt-7,col:0}];if($t.strokeStyle=it,ht==="dots"){$t.fillStyle=it;for(var dt=Lt/2,vt=0;vt0&&!Vt.isDark(vt-1,xt)&&xt>0&&!Vt.isDark(vt,xt-1)&&(wt[0]=!0),vt>0&&!Vt.isDark(vt-1,xt)&&xt0&&!Vt.isDark(vt,xt-1)&&(wt[3]=!0);var _t=Math.ceil((xt+1)*Lt)-Math.floor(xt*Lt),At=Math.ceil((vt+1)*Lt)-Math.floor(vt*Lt);$t.fillStyle=it,$t.beginPath(),$t.arc(Math.round(xt*Lt)+dt+bt,Math.round(vt*Lt)+dt+bt,dt,0,2*Math.PI,!1),$t.closePath(),$t.fill(),wt[0]||$t.fillRect(Math.round(xt*Lt)+bt,Math.round(vt*Lt)+bt,_t/2,At/2),wt[1]||$t.fillRect(Math.round(xt*Lt)+bt+Math.floor(_t/2),Math.round(vt*Lt)+bt,_t/2,At/2),wt[2]||$t.fillRect(Math.round(xt*Lt)+bt+Math.floor(_t/2),Math.round(vt*Lt)+bt+Math.floor(At/2),_t/2,At/2),wt[3]||$t.fillRect(Math.round(xt*Lt)+bt,Math.round(vt*Lt)+bt+Math.floor(At/2),_t/2,At/2)}}else for(var vt=0;vt{const $=useGetOwnedAccountSafe()(_);return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"You can receive tez or other digital assets by scanning or sharing this QR code",title:"Receive"}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",flexDirection:"column",children:jsxRuntimeExports.jsx(Box,{padding:"8px",background:"white",borderRadius:"8px",children:jsxRuntimeExports.jsx(QRCode_1,{size:232,value:_})})})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsxs(Box,{width:"100%",children:[$&&jsxRuntimeExports.jsx(Heading,{textAlign:"center",marginY:2,children:$.label}),jsxRuntimeExports.jsx(Flex,{justifyContent:"center",width:"100%",children:jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_),mode:{type:"no_icons"}})})]})})]})},AccountCard=({accountPkh:_})=>{const a=useGetOwnedAccount(),$=useGetAccountBalance(),j=useGetDollarBalance(),et=useGetAccountAllTokens(),tt=useGetAccountNFTs(),{openWith:rt}=reactExports.useContext(DynamicModalContext),nt=a(_),it=$(_),ot=j(_),st=et(_),ct=sortedByLastUpdate(tt(_));return jsxRuntimeExports.jsx(AccountDrawerDisplay,{account:nt,balance:it,dollarBalance:ot,nfts:ct,onReceive:()=>rt(jsxRuntimeExports.jsx(ReceiveModal,{pkh:_})),onSend:()=>rt(jsxRuntimeExports.jsx(FormPage$4,{sender:nt})),tokens:st})},InfoModal=({account:_})=>{const a=[{title:"Template",content:_.derivationPathTemplate},{title:"Path",content:_.derivationPath},{title:"Type (Curve)",content:_.curve}];return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalHeader,{children:[jsxRuntimeExports.jsx(CircleIcon,{icon:jsxRuntimeExports.jsx(SlashIcon,{}),size:"48px"}),jsxRuntimeExports.jsx(Center,{marginBottom:"8px",children:jsxRuntimeExports.jsx(Heading,{marginTop:"16px",children:"Derivation Info"})}),jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsx(ModalBody,{children:a.map(({title:$,content:j})=>j?jsxRuntimeExports.jsxs(Box,{marginTop:"24px",children:[jsxRuntimeExports.jsx(Heading,{size:"md",children:$}),jsxRuntimeExports.jsx(Center,{justifyContent:"flex-start",marginTop:"12px",padding:"15px",borderRadius:"4px",backgroundColor:colors.gray[800],children:jsxRuntimeExports.jsx(Text,{size:"sm",children:j})})]},j):null)})]})},DerivationInfoButton=({account:_,...a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext);switch(_.type){case"multisig":case"secret_key":case"social":return null;case"ledger":case"mnemonic":return jsxRuntimeExports.jsx(Button,{"data-testid":"derivation-info-button",onClick:()=>$(jsxRuntimeExports.jsx(InfoModal,{account:_})),variant:"CTAWithIcon",...a,children:jsxRuntimeExports.jsx(FolderInfoIcon,{stroke:"currentcolor"})})}},CloseDrawerButton=({onClose:_})=>jsxRuntimeExports.jsx(Button,{minWidth:"24px",padding:"0",onClick:_,variant:"CTAWithIcon",children:jsxRuntimeExports.jsx(ExitArrowIcon,{stroke:"currentcolor"})}),scriptRel="modulepreload",assetsURL=function(_,a){return new URL(_,a).href},seen={},__vitePreload=function _(a,$,j){let et=Promise.resolve();if($&&$.length>0){const tt=document.getElementsByTagName("link"),rt=document.querySelector("meta[property=csp-nonce]"),nt=(rt==null?void 0:rt.nonce)||(rt==null?void 0:rt.getAttribute("nonce"));et=Promise.all($.map(it=>{if(it=assetsURL(it,j),it in seen)return;seen[it]=!0;const ot=it.endsWith(".css"),st=ot?'[rel="stylesheet"]':"";if(!!j)for(let ht=tt.length-1;ht>=0;ht--){const Et=tt[ht];if(Et.href===it&&(!ot||Et.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${it}"]${st}`))return;const ut=document.createElement("link");if(ut.rel=ot?"stylesheet":scriptRel,ot||(ut.as="script",ut.crossOrigin=""),ut.href=it,nt&&ut.setAttribute("nonce",nt),document.head.appendChild(ut),ot)return new Promise((ht,Et)=>{ut.addEventListener("load",ht),ut.addEventListener("error",()=>Et(new Error(`Unable to preload CSS for ${it}`)))})}))}return et.then(()=>a()).catch(tt=>{const rt=new Event("vite:preloadError",{cancelable:!0});if(rt.payload=tt,window.dispatchEvent(rt),!rt.defaultPrevented)throw tt})};var loadScript=function _(a,$,j){var et=document.head||document.getElementsByTagName("head")[0],tt=document.createElement("script");typeof $=="function"&&(j=$,$={}),$=$||{},j=j||function(){},tt.type=$.type||"text/javascript",tt.charset=$.charset||"utf8",tt.async="async"in $?!!$.async:!0,tt.src=a,$.attrs&&setAttributes(tt,$.attrs),$.text&&(tt.text=""+$.text);var rt="onload"in tt?stdOnEnd:ieOnEnd;rt(tt,j),tt.onload||stdOnEnd(tt,j),et.appendChild(tt)};function setAttributes(_,a){for(var $ in a)_.setAttribute($,a[$])}function stdOnEnd(_,a){_.onload=function(){this.onerror=this.onload=null,a(null,_)},_.onerror=function(){this.onerror=this.onload=null,a(new Error("Failed to load "+this.src),_)}}function ieOnEnd(_,a){_.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,a(null,_))}}var isMergeableObject=function _(a){return isNonNullObject(a)&&!isSpecial(a)};function isNonNullObject(_){return!!_&&typeof _=="object"}function isSpecial(_){var a=Object.prototype.toString.call(_);return a==="[object RegExp]"||a==="[object Date]"||isReactElement(_)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(_){return _.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(_){return Array.isArray(_)?[]:{}}function cloneUnlessOtherwiseSpecified(_,a){return a.clone!==!1&&a.isMergeableObject(_)?deepmerge(emptyTarget(_),_,a):_}function defaultArrayMerge(_,a,$){return _.concat(a).map(function(j){return cloneUnlessOtherwiseSpecified(j,$)})}function getMergeFunction(_,a){if(!a.customMerge)return deepmerge;var $=a.customMerge(_);return typeof $=="function"?$:deepmerge}function getEnumerableOwnPropertySymbols(_){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(_).filter(function(a){return Object.propertyIsEnumerable.call(_,a)}):[]}function getKeys(_){return Object.keys(_).concat(getEnumerableOwnPropertySymbols(_))}function propertyIsOnObject(_,a){try{return a in _}catch{return!1}}function propertyIsUnsafe(_,a){return propertyIsOnObject(_,a)&&!(Object.hasOwnProperty.call(_,a)&&Object.propertyIsEnumerable.call(_,a))}function mergeObject(_,a,$){var j={};return $.isMergeableObject(_)&&getKeys(_).forEach(function(et){j[et]=cloneUnlessOtherwiseSpecified(_[et],$)}),getKeys(a).forEach(function(et){propertyIsUnsafe(_,et)||(propertyIsOnObject(_,et)&&$.isMergeableObject(a[et])?j[et]=getMergeFunction(et,$)(_[et],a[et],$):j[et]=cloneUnlessOtherwiseSpecified(a[et],$))}),j}function deepmerge(_,a,$){$=$||{},$.arrayMerge=$.arrayMerge||defaultArrayMerge,$.isMergeableObject=$.isMergeableObject||isMergeableObject,$.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var j=Array.isArray(a),et=Array.isArray(_),tt=j===et;return tt?j?$.arrayMerge(_,a,$):mergeObject(_,a,$):cloneUnlessOtherwiseSpecified(a,$)}deepmerge.all=function _(a,$){if(!Array.isArray(a))throw new Error("first argument should be an array");return a.reduce(function(j,et){return deepmerge(j,et,$)},{})};var deepmerge_1=deepmerge,cjs=deepmerge_1,__create$4=Object.create,__defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__getOwnPropNames$6=Object.getOwnPropertyNames,__getProtoOf$4=Object.getPrototypeOf,__hasOwnProp$6=Object.prototype.hasOwnProperty,__export$6=(_,a)=>{for(var $ in a)__defProp$6(_,$,{get:a[$],enumerable:!0})},__copyProps$6=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$6(a))!__hasOwnProp$6.call(_,et)&&et!==$&&__defProp$6(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$6(a,et))||j.enumerable});return _},__toESM$4=(_,a,$)=>($=_!=null?__create$4(__getProtoOf$4(_)):{},__copyProps$6(!_||!_.__esModule?__defProp$6($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$6=_=>__copyProps$6(__defProp$6({},"__esModule",{value:!0}),_),utils_exports={};__export$6(utils_exports,{callPlayer:()=>callPlayer,getConfig:()=>getConfig,getSDK:()=>getSDK,isBlobUrl:()=>isBlobUrl,isMediaStream:()=>isMediaStream,lazy:()=>lazy,omit:()=>omit,parseEndTime:()=>parseEndTime,parseStartTime:()=>parseStartTime,queryString:()=>queryString,randomString:()=>randomString,supportsWebKitPresentationMode:()=>supportsWebKitPresentationMode});var utils$1=__toCommonJS$6(utils_exports),import_react$2=__toESM$4(reactExports),import_load_script=__toESM$4(loadScript),import_deepmerge$1=__toESM$4(cjs);const lazy=_=>import_react$2.default.lazy(async()=>{const a=await _();return typeof a.default=="function"?a:a.default}),MATCH_START_QUERY=/[?&#](?:start|t)=([0-9hms]+)/,MATCH_END_QUERY=/[?&#]end=([0-9hms]+)/,MATCH_START_STAMP=/(\d+)(h|m|s)/g,MATCH_NUMERIC=/^\d+$/;function parseTimeParam(_,a){if(_ instanceof Array)return;const $=_.match(a);if($){const j=$[1];if(j.match(MATCH_START_STAMP))return parseTimeString(j);if(MATCH_NUMERIC.test(j))return parseInt(j)}}function parseTimeString(_){let a=0,$=MATCH_START_STAMP.exec(_);for(;$!==null;){const[,j,et]=$;et==="h"&&(a+=parseInt(j,10)*60*60),et==="m"&&(a+=parseInt(j,10)*60),et==="s"&&(a+=parseInt(j,10)),$=MATCH_START_STAMP.exec(_)}return a}function parseStartTime(_){return parseTimeParam(_,MATCH_START_QUERY)}function parseEndTime(_){return parseTimeParam(_,MATCH_END_QUERY)}function randomString(){return Math.random().toString(36).substr(2,5)}function queryString(_){return Object.keys(_).map(a=>`${a}=${_[a]}`).join("&")}function getGlobal(_){return window[_]?window[_]:window.exports&&window.exports[_]?window.exports[_]:window.module&&window.module.exports&&window.module.exports[_]?window.module.exports[_]:null}const requests={},getSDK=function _(a,$,j=null,et=()=>!0,tt=import_load_script.default){const rt=getGlobal($);return rt&&et(rt)?Promise.resolve(rt):new Promise((nt,it)=>{if(requests[a]){requests[a].push({resolve:nt,reject:it});return}requests[a]=[{resolve:nt,reject:it}];const ot=st=>{requests[a].forEach(ct=>ct.resolve(st))};if(j){const st=window[j];window[j]=function(){st&&st(),ot(getGlobal($))}}tt(a,st=>{st?(requests[a].forEach(ct=>ct.reject(st)),requests[a]=null):j||ot(getGlobal($))})})};function getConfig(_,a){return(0,import_deepmerge$1.default)(a.config,_.config)}function omit(_,...a){const $=[].concat(...a),j={},et=Object.keys(_);for(const tt of et)$.indexOf(tt)===-1&&(j[tt]=_[tt]);return j}function callPlayer(_,...a){if(!this.player||!this.player[_]){let $=`ReactPlayer: ${this.constructor.displayName} player could not call %c${_}%c – `;return this.player?this.player[_]||($+="The method was not available"):$+="The player was not available",console.warn($,"font-weight: bold",""),null}return this.player[_](...a)}function isMediaStream(_){return typeof window<"u"&&typeof window.MediaStream<"u"&&_ instanceof window.MediaStream}function isBlobUrl(_){return/^blob:/.test(_)}function supportsWebKitPresentationMode(_=document.createElement("video")){const a=/iPhone|iPod/.test(navigator.userAgent)===!1;return _.webkitSupportsPresentationMode&&typeof _.webkitSetPresentationMode=="function"&&a}function enableStubOn(_){return _}var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__getOwnPropNames$5=Object.getOwnPropertyNames,__hasOwnProp$5=Object.prototype.hasOwnProperty,__export$5=(_,a)=>{for(var $ in a)__defProp$5(_,$,{get:a[$],enumerable:!0})},__copyProps$5=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$5(a))!__hasOwnProp$5.call(_,et)&&et!==$&&__defProp$5(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$5(a,et))||j.enumerable});return _},__toCommonJS$5=_=>__copyProps$5(__defProp$5({},"__esModule",{value:!0}),_),patterns_exports={};__export$5(patterns_exports,{AUDIO_EXTENSIONS:()=>AUDIO_EXTENSIONS,DASH_EXTENSIONS:()=>DASH_EXTENSIONS,FLV_EXTENSIONS:()=>FLV_EXTENSIONS,HLS_EXTENSIONS:()=>HLS_EXTENSIONS,MATCH_URL_DAILYMOTION:()=>MATCH_URL_DAILYMOTION,MATCH_URL_FACEBOOK:()=>MATCH_URL_FACEBOOK,MATCH_URL_FACEBOOK_WATCH:()=>MATCH_URL_FACEBOOK_WATCH,MATCH_URL_KALTURA:()=>MATCH_URL_KALTURA,MATCH_URL_MIXCLOUD:()=>MATCH_URL_MIXCLOUD,MATCH_URL_MUX:()=>MATCH_URL_MUX,MATCH_URL_SOUNDCLOUD:()=>MATCH_URL_SOUNDCLOUD,MATCH_URL_STREAMABLE:()=>MATCH_URL_STREAMABLE,MATCH_URL_TWITCH_CHANNEL:()=>MATCH_URL_TWITCH_CHANNEL,MATCH_URL_TWITCH_VIDEO:()=>MATCH_URL_TWITCH_VIDEO,MATCH_URL_VIDYARD:()=>MATCH_URL_VIDYARD,MATCH_URL_VIMEO:()=>MATCH_URL_VIMEO,MATCH_URL_WISTIA:()=>MATCH_URL_WISTIA,MATCH_URL_YOUTUBE:()=>MATCH_URL_YOUTUBE,VIDEO_EXTENSIONS:()=>VIDEO_EXTENSIONS,canPlay:()=>canPlay});var patterns=__toCommonJS$5(patterns_exports),import_utils$3=utils$1;const MATCH_URL_YOUTUBE=/(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//,MATCH_URL_SOUNDCLOUD=/(?:soundcloud\.com|snd\.sc)\/[^.]+$/,MATCH_URL_VIMEO=/vimeo\.com\/(?!progressive_redirect).+/,MATCH_URL_MUX=/stream\.mux\.com\/(?!\w+\.m3u8)(\w+)/,MATCH_URL_FACEBOOK=/^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/,MATCH_URL_FACEBOOK_WATCH=/^https?:\/\/fb\.watch\/.+$/,MATCH_URL_STREAMABLE=/streamable\.com\/([a-z0-9]+)$/,MATCH_URL_WISTIA=/(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/,MATCH_URL_TWITCH_VIDEO=/(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/,MATCH_URL_TWITCH_CHANNEL=/(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/,MATCH_URL_DAILYMOTION=/^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?(?:[\w.#_-]+)?/,MATCH_URL_MIXCLOUD=/mixcloud\.com\/([^/]+\/[^/]+)/,MATCH_URL_VIDYARD=/vidyard.com\/(?:watch\/)?([a-zA-Z0-9-_]+)/,MATCH_URL_KALTURA=/^https?:\/\/[a-zA-Z]+\.kaltura.(com|org)\/p\/([0-9]+)\/sp\/([0-9]+)00\/embedIframeJs\/uiconf_id\/([0-9]+)\/partner_id\/([0-9]+)(.*)entry_id.([a-zA-Z0-9-_].*)$/,AUDIO_EXTENSIONS=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i,VIDEO_EXTENSIONS=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,HLS_EXTENSIONS=/\.(m3u8)($|\?)/i,DASH_EXTENSIONS=/\.(mpd)($|\?)/i,FLV_EXTENSIONS=/\.(flv)($|\?)/i,canPlayFile=_=>{if(_ instanceof Array){for(const a of _)if(typeof a=="string"&&canPlayFile(a)||canPlayFile(a.src))return!0;return!1}return(0,import_utils$3.isMediaStream)(_)||(0,import_utils$3.isBlobUrl)(_)?!0:AUDIO_EXTENSIONS.test(_)||VIDEO_EXTENSIONS.test(_)||HLS_EXTENSIONS.test(_)||DASH_EXTENSIONS.test(_)||FLV_EXTENSIONS.test(_)},canPlay={youtube:_=>_ instanceof Array?_.every(a=>MATCH_URL_YOUTUBE.test(a)):MATCH_URL_YOUTUBE.test(_),soundcloud:_=>MATCH_URL_SOUNDCLOUD.test(_)&&!AUDIO_EXTENSIONS.test(_),vimeo:_=>MATCH_URL_VIMEO.test(_)&&!VIDEO_EXTENSIONS.test(_)&&!HLS_EXTENSIONS.test(_),mux:_=>MATCH_URL_MUX.test(_),facebook:_=>MATCH_URL_FACEBOOK.test(_)||MATCH_URL_FACEBOOK_WATCH.test(_),streamable:_=>MATCH_URL_STREAMABLE.test(_),wistia:_=>MATCH_URL_WISTIA.test(_),twitch:_=>MATCH_URL_TWITCH_VIDEO.test(_)||MATCH_URL_TWITCH_CHANNEL.test(_),dailymotion:_=>MATCH_URL_DAILYMOTION.test(_),mixcloud:_=>MATCH_URL_MIXCLOUD.test(_),vidyard:_=>MATCH_URL_VIDYARD.test(_),kaltura:_=>MATCH_URL_KALTURA.test(_),file:canPlayFile};var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__getOwnPropNames$4=Object.getOwnPropertyNames,__hasOwnProp$4=Object.prototype.hasOwnProperty,__export$4=(_,a)=>{for(var $ in a)__defProp$4(_,$,{get:a[$],enumerable:!0})},__copyProps$4=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$4(a))!__hasOwnProp$4.call(_,et)&&et!==$&&__defProp$4(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$4(a,et))||j.enumerable});return _},__toCommonJS$4=_=>__copyProps$4(__defProp$4({},"__esModule",{value:!0}),_),players_exports={};__export$4(players_exports,{default:()=>players_default});var players=__toCommonJS$4(players_exports),import_utils$2=utils$1,import_patterns=patterns,players_default=[{key:"youtube",name:"YouTube",canPlay:import_patterns.canPlay.youtube,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./YouTube-2MluosuP.js").then(_=>_.Y),[],import.meta.url))},{key:"soundcloud",name:"SoundCloud",canPlay:import_patterns.canPlay.soundcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./SoundCloud-2L3D5aY5.js").then(_=>_.S),[],import.meta.url))},{key:"vimeo",name:"Vimeo",canPlay:import_patterns.canPlay.vimeo,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vimeo-CDDCoytq.js").then(_=>_.V),[],import.meta.url))},{key:"mux",name:"Mux",canPlay:import_patterns.canPlay.mux,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mux-svN9vEfL.js").then(_=>_.M),[],import.meta.url))},{key:"facebook",name:"Facebook",canPlay:import_patterns.canPlay.facebook,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Facebook-DC1yVOyL.js").then(_=>_.F),[],import.meta.url))},{key:"streamable",name:"Streamable",canPlay:import_patterns.canPlay.streamable,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Streamable-Pnjs9Gja.js").then(_=>_.S),[],import.meta.url))},{key:"wistia",name:"Wistia",canPlay:import_patterns.canPlay.wistia,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Wistia-D4RBjiDy.js").then(_=>_.W),[],import.meta.url))},{key:"twitch",name:"Twitch",canPlay:import_patterns.canPlay.twitch,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Twitch-D_j_UBgL.js").then(_=>_.T),[],import.meta.url))},{key:"dailymotion",name:"DailyMotion",canPlay:import_patterns.canPlay.dailymotion,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./DailyMotion-DLTLhg3q.js").then(_=>_.D),[],import.meta.url))},{key:"mixcloud",name:"Mixcloud",canPlay:import_patterns.canPlay.mixcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mixcloud-D0RZnNsH.js").then(_=>_.M),[],import.meta.url))},{key:"vidyard",name:"Vidyard",canPlay:import_patterns.canPlay.vidyard,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vidyard-HWn1mekK.js").then(_=>_.V),[],import.meta.url))},{key:"kaltura",name:"Kaltura",canPlay:import_patterns.canPlay.kaltura,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Kaltura-sPmLNc4J.js").then(_=>_.K),[],import.meta.url))},{key:"file",name:"FilePlayer",canPlay:import_patterns.canPlay.file,canEnablePIP:_=>import_patterns.canPlay.file(_)&&(document.pictureInPictureEnabled||(0,import_utils$2.supportsWebKitPresentationMode)())&&!import_patterns.AUDIO_EXTENSIONS.test(_),lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./FilePlayer-cg52dueL.js").then(_=>_.F),[],import.meta.url))}],safeIsNaN=Number.isNaN||function _(a){return typeof a=="number"&&a!==a};function isEqual(_,a){return!!(_===a||safeIsNaN(_)&&safeIsNaN(a))}function areInputsEqual(_,a){if(_.length!==a.length)return!1;for(var $=0;$<_.length;$++)if(!isEqual(_[$],a[$]))return!1;return!0}function memoizeOne(_,a){a===void 0&&(a=areInputsEqual);var $,j=[],et,tt=!1;function rt(){for(var nt=[],it=0;it{for(var $ in a)__defProp$3(_,$,{get:a[$],enumerable:!0})},__copyProps$3=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$3(a))!__hasOwnProp$3.call(_,et)&&et!==$&&__defProp$3(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$3(a,et))||j.enumerable});return _},__toESM$3=(_,a,$)=>($=_!=null?__create$3(__getProtoOf$3(_)):{},__copyProps$3(!_||!_.__esModule?__defProp$3($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$3=_=>__copyProps$3(__defProp$3({},"__esModule",{value:!0}),_),props_exports={};__export$3(props_exports,{defaultProps:()=>defaultProps,propTypes:()=>propTypes});var props=__toCommonJS$3(props_exports),import_prop_types=__toESM$3(propTypesExports);const{string,bool,number,array,oneOfType,shape,object,func,node}=import_prop_types.default,propTypes={url:oneOfType([string,array,object]),playing:bool,loop:bool,controls:bool,volume:number,muted:bool,playbackRate:number,width:oneOfType([string,number]),height:oneOfType([string,number]),style:object,progressInterval:number,playsinline:bool,pip:bool,stopOnUnmount:bool,light:oneOfType([bool,string,object]),playIcon:node,previewTabIndex:number,previewAriaLabel:string,fallback:node,oEmbedUrl:string,wrapper:oneOfType([string,func,shape({render:func.isRequired})]),config:shape({soundcloud:shape({options:object}),youtube:shape({playerVars:object,embedOptions:object,onUnstarted:func}),facebook:shape({appId:string,version:string,playerId:string,attributes:object}),dailymotion:shape({params:object}),vimeo:shape({playerOptions:object,title:string}),mux:shape({attributes:object,version:string}),file:shape({attributes:object,tracks:array,forceVideo:bool,forceAudio:bool,forceHLS:bool,forceSafariHLS:bool,forceDisableHls:bool,forceDASH:bool,forceFLV:bool,hlsOptions:object,hlsVersion:string,dashVersion:string,flvVersion:string}),wistia:shape({options:object,playerId:string,customControls:array}),mixcloud:shape({options:object}),twitch:shape({options:object,playerId:string}),vidyard:shape({options:object})}),onReady:func,onStart:func,onPlay:func,onPause:func,onBuffer:func,onBufferEnd:func,onEnded:func,onError:func,onDuration:func,onSeek:func,onPlaybackRateChange:func,onPlaybackQualityChange:func,onProgress:func,onClickPreview:func,onEnablePIP:func,onDisablePIP:func},noop$1=()=>{},defaultProps={playing:!1,loop:!1,controls:!1,volume:null,muted:!1,playbackRate:1,width:"640px",height:"360px",style:{},progressInterval:1e3,playsinline:!1,pip:!1,stopOnUnmount:!0,light:!1,fallback:null,wrapper:"div",previewTabIndex:0,previewAriaLabel:"",oEmbedUrl:"https://noembed.com/embed?url={url}",config:{soundcloud:{options:{visual:!0,buying:!1,liking:!1,download:!1,sharing:!1,show_comments:!1,show_playcount:!1}},youtube:{playerVars:{playsinline:1,showinfo:0,rel:0,iv_load_policy:3,modestbranding:1},embedOptions:{},onUnstarted:noop$1},facebook:{appId:"1309697205772819",version:"v3.3",playerId:null,attributes:{}},dailymotion:{params:{api:1,"endscreen-enable":!1}},vimeo:{playerOptions:{autopause:!1,byline:!1,portrait:!1,title:!1},title:null},mux:{attributes:{},version:"2"},file:{attributes:{},tracks:[],forceVideo:!1,forceAudio:!1,forceHLS:!1,forceDASH:!1,forceFLV:!1,hlsOptions:{},hlsVersion:"1.1.4",dashVersion:"3.1.3",flvVersion:"1.5.0",forceDisableHls:!1},wistia:{options:{},playerId:null,customControls:null},mixcloud:{options:{hide_cover:1}},twitch:{options:{},playerId:null},vidyard:{options:{}}},onReady:noop$1,onStart:noop$1,onPlay:noop$1,onPause:noop$1,onBuffer:noop$1,onBufferEnd:noop$1,onEnded:noop$1,onError:noop$1,onDuration:noop$1,onSeek:noop$1,onPlaybackRateChange:noop$1,onPlaybackQualityChange:noop$1,onProgress:noop$1,onClickPreview:noop$1,onEnablePIP:noop$1,onDisablePIP:noop$1};var __create$2=Object.create,__defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__getOwnPropNames$2=Object.getOwnPropertyNames,__getProtoOf$2=Object.getPrototypeOf,__hasOwnProp$2=Object.prototype.hasOwnProperty,__defNormalProp$1=(_,a,$)=>a in _?__defProp$2(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$,__export$2=(_,a)=>{for(var $ in a)__defProp$2(_,$,{get:a[$],enumerable:!0})},__copyProps$2=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$2(a))!__hasOwnProp$2.call(_,et)&&et!==$&&__defProp$2(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$2(a,et))||j.enumerable});return _},__toESM$2=(_,a,$)=>($=_!=null?__create$2(__getProtoOf$2(_)):{},__copyProps$2(!_||!_.__esModule?__defProp$2($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$2=_=>__copyProps$2(__defProp$2({},"__esModule",{value:!0}),_),__publicField$1=(_,a,$)=>(__defNormalProp$1(_,typeof a!="symbol"?a+"":a,$),$),Player_exports={};__export$2(Player_exports,{default:()=>Player});var Player_1=__toCommonJS$2(Player_exports),import_react$1=__toESM$2(reactExports),import_react_fast_compare$1=__toESM$2(reactFastCompare),import_props$1=props,import_utils$1=utils$1;const SEEK_ON_PLAY_EXPIRY=5e3;class Player extends import_react$1.Component{constructor(){super(...arguments),__publicField$1(this,"mounted",!1),__publicField$1(this,"isReady",!1),__publicField$1(this,"isPlaying",!1),__publicField$1(this,"isLoading",!0),__publicField$1(this,"loadOnReady",null),__publicField$1(this,"startOnPlay",!0),__publicField$1(this,"seekOnPlay",null),__publicField$1(this,"onDurationCalled",!1),__publicField$1(this,"handlePlayerMount",a=>{if(this.player){this.progress();return}this.player=a,this.player.load(this.props.url),this.progress()}),__publicField$1(this,"getInternalPlayer",a=>this.player?this.player[a]:null),__publicField$1(this,"progress",()=>{if(this.props.url&&this.player&&this.isReady){const a=this.getCurrentTime()||0,$=this.getSecondsLoaded(),j=this.getDuration();if(j){const et={playedSeconds:a,played:a/j};$!==null&&(et.loadedSeconds=$,et.loaded=$/j),(et.playedSeconds!==this.prevPlayed||et.loadedSeconds!==this.prevLoaded)&&this.props.onProgress(et),this.prevPlayed=et.playedSeconds,this.prevLoaded=et.loadedSeconds}}this.progressTimeout=setTimeout(this.progress,this.props.progressFrequency||this.props.progressInterval)}),__publicField$1(this,"handleReady",()=>{if(!this.mounted)return;this.isReady=!0,this.isLoading=!1;const{onReady:a,playing:$,volume:j,muted:et}=this.props;a(),!et&&j!==null&&this.player.setVolume(j),this.loadOnReady?(this.player.load(this.loadOnReady,!0),this.loadOnReady=null):$&&this.player.play(),this.handleDurationCheck()}),__publicField$1(this,"handlePlay",()=>{this.isPlaying=!0,this.isLoading=!1;const{onStart:a,onPlay:$,playbackRate:j}=this.props;this.startOnPlay&&(this.player.setPlaybackRate&&j!==1&&this.player.setPlaybackRate(j),a(),this.startOnPlay=!1),$(),this.seekOnPlay&&(this.seekTo(this.seekOnPlay),this.seekOnPlay=null),this.handleDurationCheck()}),__publicField$1(this,"handlePause",a=>{this.isPlaying=!1,this.isLoading||this.props.onPause(a)}),__publicField$1(this,"handleEnded",()=>{const{activePlayer:a,loop:$,onEnded:j}=this.props;a.loopOnEnded&&$&&this.seekTo(0),$||(this.isPlaying=!1,j())}),__publicField$1(this,"handleError",(...a)=>{this.isLoading=!1,this.props.onError(...a)}),__publicField$1(this,"handleDurationCheck",()=>{clearTimeout(this.durationCheckTimeout);const a=this.getDuration();a?this.onDurationCalled||(this.props.onDuration(a),this.onDurationCalled=!0):this.durationCheckTimeout=setTimeout(this.handleDurationCheck,100)}),__publicField$1(this,"handleLoaded",()=>{this.isLoading=!1})}componentDidMount(){this.mounted=!0}componentWillUnmount(){clearTimeout(this.progressTimeout),clearTimeout(this.durationCheckTimeout),this.isReady&&this.props.stopOnUnmount&&(this.player.stop(),this.player.disablePIP&&this.player.disablePIP()),this.mounted=!1}componentDidUpdate(a){if(!this.player)return;const{url:$,playing:j,volume:et,muted:tt,playbackRate:rt,pip:nt,loop:it,activePlayer:ot,disableDeferredLoading:st}=this.props;if(!(0,import_react_fast_compare$1.default)(a.url,$)){if(this.isLoading&&!ot.forceLoad&&!st&&!(0,import_utils$1.isMediaStream)($)){console.warn(`ReactPlayer: the attempt to load ${$} is being deferred until the player has loaded`),this.loadOnReady=$;return}this.isLoading=!0,this.startOnPlay=!0,this.onDurationCalled=!1,this.player.load($,this.isReady)}!a.playing&&j&&!this.isPlaying&&this.player.play(),a.playing&&!j&&this.isPlaying&&this.player.pause(),!a.pip&&nt&&this.player.enablePIP&&this.player.enablePIP(),a.pip&&!nt&&this.player.disablePIP&&this.player.disablePIP(),a.volume!==et&&et!==null&&this.player.setVolume(et),a.muted!==tt&&(tt?this.player.mute():(this.player.unmute(),et!==null&&setTimeout(()=>this.player.setVolume(et)))),a.playbackRate!==rt&&this.player.setPlaybackRate&&this.player.setPlaybackRate(rt),a.loop!==it&&this.player.setLoop&&this.player.setLoop(it)}getDuration(){return this.isReady?this.player.getDuration():null}getCurrentTime(){return this.isReady?this.player.getCurrentTime():null}getSecondsLoaded(){return this.isReady?this.player.getSecondsLoaded():null}seekTo(a,$,j){if(!this.isReady){a!==0&&(this.seekOnPlay=a,setTimeout(()=>{this.seekOnPlay=null},SEEK_ON_PLAY_EXPIRY));return}if($?$==="fraction":a>0&&a<1){const tt=this.player.getDuration();if(!tt){console.warn("ReactPlayer: could not seek using fraction – duration not yet available");return}this.player.seekTo(tt*a,j);return}this.player.seekTo(a,j)}render(){const a=this.props.activePlayer;return a?import_react$1.default.createElement(a,{...this.props,onMount:this.handlePlayerMount,onReady:this.handleReady,onPlay:this.handlePlay,onPause:this.handlePause,onEnded:this.handleEnded,onLoaded:this.handleLoaded,onError:this.handleError}):null}}__publicField$1(Player,"displayName","Player");__publicField$1(Player,"propTypes",import_props$1.propTypes);__publicField$1(Player,"defaultProps",import_props$1.defaultProps);var __create$1=Object.create,__defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__getOwnPropNames$1=Object.getOwnPropertyNames,__getProtoOf$1=Object.getPrototypeOf,__hasOwnProp$1=Object.prototype.hasOwnProperty,__defNormalProp=(_,a,$)=>a in _?__defProp$1(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$,__export$1=(_,a)=>{for(var $ in a)__defProp$1(_,$,{get:a[$],enumerable:!0})},__copyProps$1=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$1(a))!__hasOwnProp$1.call(_,et)&&et!==$&&__defProp$1(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$1(a,et))||j.enumerable});return _},__toESM$1=(_,a,$)=>($=_!=null?__create$1(__getProtoOf$1(_)):{},__copyProps$1(!_||!_.__esModule?__defProp$1($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$1=_=>__copyProps$1(__defProp$1({},"__esModule",{value:!0}),_),__publicField=(_,a,$)=>(__defNormalProp(_,typeof a!="symbol"?a+"":a,$),$),ReactPlayer_exports={};__export$1(ReactPlayer_exports,{createReactPlayer:()=>createReactPlayer});var ReactPlayer$1=__toCommonJS$1(ReactPlayer_exports),import_react=__toESM$1(reactExports),import_deepmerge=__toESM$1(cjs),import_memoize_one=__toESM$1(require$$2),import_react_fast_compare=__toESM$1(reactFastCompare),import_props=props,import_utils=utils$1,import_Player=__toESM$1(Player_1);const Preview=(0,import_utils.lazy)(()=>__vitePreload(()=>import("./Preview-YZrpqIBs.js").then(_=>_.P),[],import.meta.url)),IS_BROWSER=typeof window<"u"&&window.document&&typeof document<"u",IS_GLOBAL=typeof commonjsGlobal<"u"&&commonjsGlobal.window&&commonjsGlobal.window.document,SUPPORTED_PROPS=Object.keys(import_props.propTypes),UniversalSuspense=IS_BROWSER||IS_GLOBAL?import_react.Suspense:()=>null,customPlayers=[],createReactPlayer=(_,a)=>{var $;return $=class extends import_react.Component{constructor(){super(...arguments),__publicField(this,"state",{showPreview:!!this.props.light}),__publicField(this,"references",{wrapper:j=>{this.wrapper=j},player:j=>{this.player=j}}),__publicField(this,"handleClickPreview",j=>{this.setState({showPreview:!1}),this.props.onClickPreview(j)}),__publicField(this,"showPreview",()=>{this.setState({showPreview:!0})}),__publicField(this,"getDuration",()=>this.player?this.player.getDuration():null),__publicField(this,"getCurrentTime",()=>this.player?this.player.getCurrentTime():null),__publicField(this,"getSecondsLoaded",()=>this.player?this.player.getSecondsLoaded():null),__publicField(this,"getInternalPlayer",(j="player")=>this.player?this.player.getInternalPlayer(j):null),__publicField(this,"seekTo",(j,et,tt)=>{if(!this.player)return null;this.player.seekTo(j,et,tt)}),__publicField(this,"handleReady",()=>{this.props.onReady(this)}),__publicField(this,"getActivePlayer",(0,import_memoize_one.default)(j=>{for(const et of[...customPlayers,..._])if(et.canPlay(j))return et;return a||null})),__publicField(this,"getConfig",(0,import_memoize_one.default)((j,et)=>{const{config:tt}=this.props;return import_deepmerge.default.all([import_props.defaultProps.config,import_props.defaultProps.config[et]||{},tt,tt[et]||{}])})),__publicField(this,"getAttributes",(0,import_memoize_one.default)(j=>(0,import_utils.omit)(this.props,SUPPORTED_PROPS))),__publicField(this,"renderActivePlayer",j=>{if(!j)return null;const et=this.getActivePlayer(j);if(!et)return null;const tt=this.getConfig(j,et.key);return import_react.default.createElement(import_Player.default,{...this.props,key:et.key,ref:this.references.player,config:tt,activePlayer:et.lazyPlayer||et,onReady:this.handleReady})})}shouldComponentUpdate(j,et){return!(0,import_react_fast_compare.default)(this.props,j)||!(0,import_react_fast_compare.default)(this.state,et)}componentDidUpdate(j){const{light:et}=this.props;!j.light&&et&&this.setState({showPreview:!0}),j.light&&!et&&this.setState({showPreview:!1})}renderPreview(j){if(!j)return null;const{light:et,playIcon:tt,previewTabIndex:rt,oEmbedUrl:nt,previewAriaLabel:it}=this.props;return import_react.default.createElement(Preview,{url:j,light:et,playIcon:tt,previewTabIndex:rt,previewAriaLabel:it,oEmbedUrl:nt,onClick:this.handleClickPreview})}render(){const{url:j,style:et,width:tt,height:rt,fallback:nt,wrapper:it}=this.props,{showPreview:ot}=this.state,st=this.getAttributes(j),ct=typeof it=="string"?this.references.wrapper:void 0;return import_react.default.createElement(it,{ref:ct,style:{...et,width:tt,height:rt},...st},import_react.default.createElement(UniversalSuspense,{fallback:nt},ot?this.renderPreview(j):this.renderActivePlayer(j)))}},__publicField($,"displayName","ReactPlayer"),__publicField($,"propTypes",import_props.propTypes),__publicField($,"defaultProps",import_props.defaultProps),__publicField($,"addCustomPlayer",j=>{customPlayers.push(j)}),__publicField($,"removeCustomPlayers",()=>{customPlayers.length=0}),__publicField($,"canPlay",j=>{for(const et of[...customPlayers,..._])if(et.canPlay(j))return!0;return!1}),__publicField($,"canEnablePIP",j=>{for(const et of[...customPlayers,..._])if(et.canEnablePIP&&et.canEnablePIP(j))return!0;return!1}),$};var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(_,a)=>{for(var $ in a)__defProp(_,$,{get:a[$],enumerable:!0})},__copyProps=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames(a))!__hasOwnProp.call(_,et)&&et!==$&&__defProp(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc(a,et))||j.enumerable});return _},__toESM=(_,a,$)=>($=_!=null?__create(__getProtoOf(_)):{},__copyProps(!_||!_.__esModule?__defProp($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS=_=>__copyProps(__defProp({},"__esModule",{value:!0}),_),src_exports={};__export(src_exports,{default:()=>src_default});var lib$1=__toCommonJS(src_exports),import_players=__toESM(players),import_ReactPlayer=ReactPlayer$1;const fallback=import_players.default[import_players.default.length-1];var src_default=(0,import_ReactPlayer.createReactPlayer)(import_players.default,fallback);const ReactPlayer=getDefaultExportFromCjs$1(lib$1),AttributesAccordionItem=({nft:_,style:a})=>{const $=_.metadata.attributes;return!$||$.length===0?null:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],"data-testid":"attributes-section",style:a,children:[jsxRuntimeExports.jsxs(AccordionButton,{paddingY:"16px",children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",size:"md",children:"Attributes"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(Wrap,{marginLeft:"0",spacing:"10px",children:$.map(j=>jsxRuntimeExports.jsx(WrapItem,{flex:"1","data-testid":"nft-attribute",children:jsxRuntimeExports.jsx(Card,{width:"160px",height:"128px",marginBottom:"2px",background:colors.gray[700],children:jsxRuntimeExports.jsxs(CardBody,{padding:"16px",children:[jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:j.name}),jsxRuntimeExports.jsx(Heading,{size:"md",children:j.value})]})})},j.name))})})]})},TruncatedTextWithTooltip=({text:_,maxLength:a})=>_.length<=a?jsxRuntimeExports.jsx(Text,{"data-testid":"truncated-text",children:_}):jsxRuntimeExports.jsx(Tooltip,{label:_,children:jsxRuntimeExports.jsx(Text,{"data-testid":"truncated-text",children:truncate(_,a)})}),TzktLink=({url:_,...a})=>jsxRuntimeExports.jsx("a",{"data-testid":"tzkt-link",href:_,rel:"noopener noreferrer",target:"_blank",children:jsxRuntimeExports.jsx(WindowLinkIcon,{...a})}),CreatorElement=({nft:_})=>{if(!_.metadata.creators||_.metadata.creators.length===0)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"-"});const a=_.metadata.creators[0];return a.startsWith("tz")?jsxRuntimeExports.jsx(AddressPill,{marginRight:1,address:parsePkh(a)}):jsxRuntimeExports.jsx(TruncatedTextWithTooltip,{maxLength:15,text:a})},PropertiesAccordionItem=({nft:_,style:a})=>{const $=royalties(_),j=$.reduce((tt,rt)=>tt+rt.share,0).toFixed(2),et=useSelectedNetwork();return jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],style:a,children:[jsxRuntimeExports.jsxs(AccordionButton,{paddingY:"16px",children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",size:"md",children:"Properties"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(TableContainer,{children:jsxRuntimeExports.jsx(Table,{variant:"stripped",children:jsxRuntimeExports.jsxs(Tbody,{fontSize:"14px",children:[jsxRuntimeExports.jsxs(Tr,{background:colors.gray[900],borderColor:colors.gray[700],borderBottomWidth:"1px",borderRadius:"8px",children:[jsxRuntimeExports.jsx(Td,{width:"20%",padding:"16px 0 16px 15px",paddingRight:"0",color:colors.gray[400],borderTopLeftRadius:"8px","data-testid":"nft-editions",children:"Editions:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px","data-testid":"nft-editions-value",children:_.totalSupply||"?"}),jsxRuntimeExports.jsx(Td,{width:"20%",padding:"16px 0 16px 15px",color:colors.gray[400],children:"Token ID:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px",borderTopRightRadius:"8px",children:_.tokenId})]}),jsxRuntimeExports.jsxs(Tr,{background:colors.gray[800],borderColor:colors.gray[700],borderBottomWidth:"1px",children:[jsxRuntimeExports.jsxs(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],"data-testid":"nft-royalty",children:["Royalties",$.length>1?" ("+$.length+")":"",":"]}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px","data-testid":"nft-royalty-value",children:$.length>0?j+"%":"-"}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],"data-testid":"nft-mime",children:"MIME type:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px","data-testid":"nft-mime-value",children:mimeType(_)||"-"})]}),jsxRuntimeExports.jsxs(Tr,{background:colors.gray[900],borderColor:colors.gray[700],borderBottomWidth:"1px",children:[jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],children:"Contract:"}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px",children:jsxRuntimeExports.jsx(AddressPill,{marginRight:1,address:parsePkh(_.contract)})}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],children:"Metadata:"}),jsxRuntimeExports.jsxs(Td,{width:"30%",padding:"16px 0 16px 5px",children:["TzKT ",jsxRuntimeExports.jsx(TzktLink,{url:metadataUri(_,et)})]})]}),jsxRuntimeExports.jsxs(Tr,{background:colors.gray[800],borderColor:colors.gray[700],borderBottomWidth:"1px",children:[jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],"data-testid":"nft-creator",children:"Creator:"}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px","data-testid":"nft-creator-value",children:jsxRuntimeExports.jsx(CreatorElement,{nft:_})}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],children:"License:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px",children:jsxRuntimeExports.jsx(TruncatedTextWithTooltip,{maxLength:15,text:_.metadata.rights||"-"})})]})]})})})})]})},TagsSection=({nft:_})=>{const a=_.metadata.tags;return!a||a.length===0?null:jsxRuntimeExports.jsx(Wrap,{marginTop:"20px","data-testid":"tags-section",children:a.map($=>jsxRuntimeExports.jsx(WrapItem,{padding:"3px 8px",background:colors.gray[600],borderRadius:"100px",children:jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-tag",children:$})},$))})},SendNFTRecapTile=({nft:_})=>{const a=getIPFSurl(thumbnailUri(_)),$=getIPFSurl(_.displayUri);return jsxRuntimeExports.jsx(Box,{width:"100%","aria-label":"nft",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"60px",padding:3,background:colors.gray[800],borderRadius:"4px","data-testid":"nft-name",children:[jsxRuntimeExports.jsx(AspectRatio,{width:"30px",height:"30px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{fallbackSrc:$,src:a})}),_.metadata.name&&jsxRuntimeExports.jsx(Heading,{marginLeft:4,size:"sm",children:truncate(_.metadata.name,45)})]})})},SignPage$1=_=>{const{mode:a,operations:$,data:{nft:j}}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:ot,reEstimate:st,onSign:ct}=useSignPageHelpers($,a),{recipient:ut}=tt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:tt.type,signer:tt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Flex,{marginBottom:"12px",children:jsxRuntimeExports.jsx(SendNFTRecapTile,{nft:j})}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",marginY:"12px",paddingX:"4px",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Owned:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-owned",size:"sm",children:j.balance})]}),jsxRuntimeExports.jsx(SignPageFee,{fee:et})]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"12px",marginBottom:"24px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"12px",size:"md",children:"Quantity:"}),jsxRuntimeExports.jsx(Center,{width:"100px",height:"48px",background:colors.gray[800],borderRadius:"4px",children:jsxRuntimeExports.jsxs(Text,{textAlign:"center",children:[tt.operations[0].amount," out of ",j.balance]})})]}),jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{marginBottom:"24px",address:tt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:ut}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:nt,operationType:tt.type,reEstimate:st,sender:tt.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:ct,signer:ot,text:headerText(tt.type,a)})})]})})})},FormPage$1=_=>{const{nft:a}=_,$=useOpenSignPageFormAction({SignPage:SignPage$1,signPageExtraData:{nft:a},FormPage:FormPage$1,defaultFormPageProps:_,toOperation:toOperation$1(a)}),j=useAddToBatchFormAction(toOperation$1(a)),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:{quantity:1,...formDefaultValues(_)}}),{formState:{isValid:it,errors:ot},register:st,handleSubmit:ct}=nt;return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(FormPageHeader,{}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Flex,{marginBottom:"12px",children:jsxRuntimeExports.jsx(SendNFTRecapTile,{nft:_.nft})}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Owned:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-owned",size:"sm",children:a.balance})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.quantity,children:[jsxRuntimeExports.jsx(FormLabel,{children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"8px",size:"md",children:"Quantity:"}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(InputGroup,{width:"75px",children:jsxRuntimeExports.jsx(Input,{width:"60px",color:"white","data-testid":"quantity-input",step:1,type:"number",...st("quantity",{required:"Quantity is required",max:{value:a.balance,message:`Max quantity is ${a.balance}`},min:{value:1,message:"Min quantity is 1"}})})}),jsxRuntimeExports.jsxs(Text,{"data-testid":"out-of-nft",children:["out of ",a.balance]})]})]})}),ot.quantity&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"quantity-error",children:ot.quantity.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),ot.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:ot.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ct(tt),onSingleSubmit:ct(et)})})]})})})},toOperation$1=_=>a=>({type:"fa2",sender:parsePkh(a.sender),recipient:parsePkh(a.recipient),contract:parseContractPkh(_.contract),tokenId:_.tokenId,amount:a.quantity.toString()}),NFTDrawerCard=({nft:_})=>{var it;const a=getIPFSurl(artifactUri(_)),$=getIPFSurl(_.displayUri),j=useGetOwnedAccount(),{openWith:et}=reactExports.useContext(DynamicModalContext),tt=(it=mimeType(_))==null?void 0:it.startsWith("video/"),rt=tokenName(_),nt={border:"none",borderRadius:"8px",marginBottom:"20px"};return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Card,{width:"534px",height:"534px",background:colors.gray[800],children:jsxRuntimeExports.jsxs(CardBody,{padding:"24px",children:[jsxRuntimeExports.jsx(Box,{position:"relative",width:"486px",height:"486px",children:tt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Box,{position:"absolute",zIndex:1,width:"486px",height:"486px",children:jsxRuntimeExports.jsx(ReactPlayer,{width:"100%",height:"100%",loop:!0,playing:!0,url:a})}),jsxRuntimeExports.jsx(Image$1,{position:"absolute",zIndex:0,top:"0",width:"486px",height:"486px",objectFit:"contain",alt:rt,filter:"blur(20px)",src:$})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Image$1,{position:"absolute",zIndex:1,width:"486px",height:"486px",objectFit:"contain",alt:rt,fallbackSrc:$,src:a}),jsxRuntimeExports.jsx(Image$1,{position:"absolute",zIndex:0,top:"0",width:"486px",height:"486px",objectFit:"contain",alt:rt,"data-testid":"nft-image",fallbackSrc:$,filter:"blur(20px)",src:a})]})}),Number(_.balance)>1&&jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:3,display:"inline",height:"24px",marginTop:"-38px",marginLeft:"16px",borderRadius:"100px",backgroundColor:"rgba(33, 33, 33, 0.75)","data-testid":"nft-owned-count",paddingX:"8px",children:"x"+_.balance})]})}),jsxRuntimeExports.jsx(TagsSection,{nft:_}),rt&&jsxRuntimeExports.jsx(Heading,{marginTop:"16px",marginBottom:"14px","data-testid":"nft-name",size:"lg",children:rt}),_.metadata.description&&jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-description",size:"sm",children:_.metadata.description}),jsxRuntimeExports.jsx(Button,{marginTop:"20px",onClick:()=>et(jsxRuntimeExports.jsx(FormPage$1,{nft:_,sender:j(_.owner)})),children:"Send"}),jsxRuntimeExports.jsxs(Accordion,{marginTop:"32px",allowMultiple:!0,children:[jsxRuntimeExports.jsx(AttributesAccordionItem,{nft:_,style:nt}),jsxRuntimeExports.jsx(PropertiesAccordionItem,{nft:_,style:nt}),jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],style:nt,children:[jsxRuntimeExports.jsxs(AccordionButton,{paddingY:"16px",children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",size:"md",children:"JSON"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(JsValueWrap,{value:_})})]})]})]})},NFTDrawerBody=({nft:_,onCloseDrawer:a})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",paddingBottom:"22px",color:colors.gray[400],"data-testid":"nft-drawer-body",children:[jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.owner)}),jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:a})]}),jsxRuntimeExports.jsx(NFTDrawerCard,{nft:_})]}),AccountListWithDrawer=()=>{const[_,a]=reactExports.useState(null),{ownerPkh:$,nftId:j}=useParams(),et=useAllNfts(),tt=$&&lodashExports.get(et,[$],[]).find(ht=>fullId(ht)===j),rt=!!tt,{isOpen:nt,onOpen:it,onClose:ot}=useDisclosure$1({defaultIsOpen:rt}),st=useNavigate(),ct=reactExports.useCallback(()=>{a(null),ot(),st("/home")},[ot,st]);reactExports.useEffect(()=>{const ht=Et=>{Et.key==="Escape"&&ct()};return document.addEventListener("keydown",ht),()=>document.removeEventListener("keydown",ht)},[ct]);const ut=reactExports.useMemo(()=>({selectedAccount:_,selectAccount:ht=>{a(ht),it()}}),[_,it]);return jsxRuntimeExports.jsxs(SelectedAccountContext.Provider,{value:ut,children:[jsxRuntimeExports.jsx(AccountsList,{}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:nt,onClose:ct,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsxs(DrawerContent,{children:[rt&&jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(NFTDrawerBody,{nft:{...tt,owner:$},onCloseDrawer:ct})}),!rt&&_&&jsxRuntimeExports.jsxs(ModalBody,{overflow:"hidden",overflowY:"scroll",paddingRight:"0",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"flex-end",width:"100%",paddingRight:"24px",children:[jsxRuntimeExports.jsx(DerivationInfoButton,{marginRight:"5px",account:_}),jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:ct})]}),jsxRuntimeExports.jsx(AccountCard,{accountPkh:_.address.pkh})]})]})]})]})},HomeView=()=>jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Accounts"}),jsxRuntimeExports.jsx(Flex,{flex:1,minHeight:1,children:jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",flex:1,marginRight:"12px",paddingBottom:"12px",children:[jsxRuntimeExports.jsx(AccountListHeader,{}),jsxRuntimeExports.jsx(Box,{flex:1,overflow:"hidden",borderRadius:"8px",children:jsxRuntimeExports.jsx(AccountListWithDrawer,{})})]})})]}),SelectedNFTContext=reactExports.createContext({selectedNFT:void 0,setSelectedNFT:_=>{}}),NFTCard=({nft:_})=>{const{selectedNFT:a,setSelectedNFT:$}=reactExports.useContext(SelectedNFTContext),j=getIPFSurl(thumbnailUri(_)),et=getIPFSurl(_.displayUri),tt=_.metadata.name,rt={width:"100%",minWidth:"242px",minHeight:"242px",objectFit:"contain",aspectRatio:"1",fallbackSrc:et,src:j},nt=a&&fullId(a)===fullId(_)&&a.owner===_.owner;return jsxRuntimeExports.jsx(Card,{minWidth:"274px",borderRadius:"8px",cursor:"pointer","data-testid":`nft-card${nt?"-selected":""}`,onClick:()=>$(_),children:jsxRuntimeExports.jsxs(CardBody,{padding:"16px",background:colors.gray[900],border:"1px solid",borderColor:nt?colors.orangeL:"transparent",borderRadius:"8px",_hover:{background:colors.gray[700],borderColor:colors.gray[500]},children:[jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsxs(Box,{position:"relative",width:"100%",children:[jsxRuntimeExports.jsx(Image$1,{...rt,zIndex:2,opacity:"0"}),jsxRuntimeExports.jsx(Image$1,{...rt,position:"absolute",zIndex:0,top:"0",filter:"blur(20px)"}),jsxRuntimeExports.jsx(Image$1,{...rt,position:"absolute",zIndex:1,top:"0","data-testid":"nft-image"})]})}),Number(_.balance)>1&&jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:3,display:"inline",height:"24px",marginTop:"-36px",marginLeft:"10px",paddingTop:"1px",fontSize:"14px",borderRadius:"full",backgroundColor:"rgba(33, 33, 33, 0.75)","data-testid":"nft-owned-count",paddingX:"8px",children:"x"+_.balance}),jsxRuntimeExports.jsx(Box,{overflow:"hidden","data-testid":"nft-card-name",children:jsxRuntimeExports.jsx(Heading,{overflow:"hidden",marginTop:"15px",marginBottom:"8px",fontSize:"sm",whiteSpace:"nowrap",textOverflow:"ellipsis",children:tt})}),jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.owner)})]})})},NFTGallery=({nftsByOwner:_})=>{const a=Object.entries(_).flatMap(([j,et])=>(et||[]).map(tt=>({owner:j,...tt})));let $="repeat(auto-fit, minmax(min(100%/2, max(274px, 100%/7)), 1fr))";return a.length<3&&($=`repeat(auto-fit, min(100% / ${a.length} - 16px, 450px))`),jsxRuntimeExports.jsx(SimpleGrid,{gridTemplateColumns:$,marginBottom:"16px",minChildWidth:"340px",spacing:"16px",children:sortedByLastUpdate(a).map(j=>jsxRuntimeExports.jsx(NFTCard,{nft:j},`${j.owner}:${fullId(j)}`))})},AccountListDisplay=({accounts:_,onSelect:a})=>jsxRuntimeExports.jsx(MenuList,{zIndex:"docked",overflowY:"scroll",maxHeight:"300px",padding:0,background:colors.gray[900],children:_.map($=>jsxRuntimeExports.jsx(MenuItem$1,{width:"100%",minHeight:"48px",padding:"5px",background:colors.gray[700],"aria-label":$.label,onClick:()=>{a($)},value:$.address.pkh,children:jsxRuntimeExports.jsx(AddressTile,{width:"370px",height:"40px",padding:"5px",background:colors.gray[700],borderRadius:"4px",_hover:{background:colors.gray[500]},cursor:"pointer",address:$.address})},$.address.pkh))}),useAccountsFilter=()=>{const _=useAllAccounts(),[a]=reactExports.useState(_),[$,j]=useSearchParams(),et=$.getAll("accounts"),[tt,rt]=reactExports.useState(et.length===0),[nt,it]=reactExports.useState(_.filter(ct=>et.includes(ct.address.pkh))),ot=lodashExports.differenceBy(_,nt,ct=>ct.address.pkh),st=nt.length===_.length;return reactExports.useEffect(()=>{j(ct=>({...ct,accounts:nt.map(ut=>ut.address.pkh)}))},[nt,j]),{selectedAccounts:tt?a:nt,accountsFilter:jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(Box,{alignSelf:"flex-start",children:jsxRuntimeExports.jsxs(Menu,{children:[jsxRuntimeExports.jsx(MenuButton,{as:Button,maxHeight:"26px",paddingLeft:0,fontWeight:"normal",_hover:{bg:"none"},_active:{bg:"none"},"data-testid":"account-filter",isDisabled:st,marginY:"16px",rightIcon:jsxRuntimeExports.jsx(ChevronDownIcon,{}),variant:"ghost",children:"Filter by Account"}),jsxRuntimeExports.jsx(AccountListDisplay,{accounts:ot,onSelect:ct=>{rt(!1),it(ut=>[...ut,ct])}})]})}),jsxRuntimeExports.jsx(Wrap,{width:"100%",children:nt.map(ct=>jsxRuntimeExports.jsx(AddressPill,{address:ct.address,"data-testid":"account-pill",mode:{type:"removable",onRemove:()=>{rt(nt.length===1),it(ut=>ut.filter(ht=>ht.address.pkh!==ct.address.pkh))}}},ct.address.pkh))})]})}},NFTsView=()=>{const _=useAllNfts(),{accountsFilter:a,selectedAccounts:$}=useAccountsFilter(),[j,et]=reactExports.useState(void 0);reactExports.useEffect(()=>{const it=ot=>{ot.key==="Escape"&&et(void 0)};return document.addEventListener("keydown",it),()=>document.removeEventListener("keydown",it)},[]);const tt=lodashExports.pick(_,$.map(it=>it.address.pkh)),rt=lodashExports.sumBy(Object.values(tt).flat(),it=>Number((it==null?void 0:it.balance)||0)),nt=lodashExports.every(tt,it=>!it||it.length===0);return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{subtitle:`(${rt})`,title:"NFTs"}),a,nt?jsxRuntimeExports.jsx(NoNFTs,{size:"lg"}):jsxRuntimeExports.jsxs(SelectedNFTContext.Provider,{value:{setSelectedNFT:et,selectedNFT:j},children:[jsxRuntimeExports.jsx(Box,{overflowY:"scroll",children:jsxRuntimeExports.jsx(NFTGallery,{nftsByOwner:tt})}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:!!j,onClose:()=>et(void 0),placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsx(ModalBody,{children:j&&jsxRuntimeExports.jsx(NFTDrawerBody,{nft:j,onCloseDrawer:()=>et(void 0)})})})]})]})]})},OperationsView=()=>{const{accountsFilter:_,selectedAccounts:a}=useAccountsFilter(),{operations:$,loadMore:j,hasMore:et,isLoading:tt,isFirstLoad:rt}=useGetOperations(a),nt=reactExports.useRef(!1),it=ot=>{if(nt.current||!et||tt)return;const st=ot.target;if(st.scrollHeight-st.scrollTop-st.clientHeight<100)return nt.current=!0,j().finally(()=>{nt.current=!1})};return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Operations"}),_,jsxRuntimeExports.jsx(Center,{display:tt&&rt?"flex":"none",height:"100%",children:jsxRuntimeExports.jsx(Image$1,{width:"150px",height:"75px",marginBottom:"136px",src:"./static/media/loading-wheel.gif"})}),$.length===0&&!tt&&jsxRuntimeExports.jsx(NoOperations,{size:"lg"}),$.length>0&&jsxRuntimeExports.jsxs(Box,{overflowY:"scroll",marginBottom:"20px",background:colors.gray[900],borderRadius:"8px",onScroll:it,paddingX:"20px",children:[jsxRuntimeExports.jsx(OperationTileContext.Provider,{value:{mode:"page"},children:$.map((ot,st)=>{const ct=st===$.length-1;return jsxRuntimeExports.jsxs(Box,{height:"90px",marginBottom:ct?"10px":0,paddingY:"20px",children:[jsxRuntimeExports.jsx(OperationTile,{operation:ot}),!ct&&jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(Divider,{marginTop:"20px"})})]},ot.id)})}),jsxRuntimeExports.jsxs(Center,{flexDirection:"column",display:tt&&!rt?"flex":"none",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Image$1,{width:"100px",height:"50px",src:"./static/media/loading-dots.gif"})]})]})]})},DrawerTopButtons=({onClose:_,...a})=>jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",paddingBottom:"30px",cursor:"pointer",...a,children:jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:_})}),BeaconPeers=()=>{const _=usePeers(),[a,$]=reactExports.useState([]);return reactExports.useEffect(()=>{const j=_.map(async et=>({...et,senderId:et.senderId||await getSenderId(et.publicKey)}));Promise.all(j).then($).catch(lodashExports.noop)},[_]),a.length===0?jsxRuntimeExports.jsxs(Box,{"data-testid":"beacon-peers-empty",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Text,{marginTop:"31px",color:colors.gray[400],size:"lg",children:"Your dApps will appear here"})]}):jsxRuntimeExports.jsx(PeersDisplay,{"data-testid":"beacon-peers",peerInfos:a})},PeersDisplay=({peerInfos:_})=>jsxRuntimeExports.jsx(Box,{children:_.map(a=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(PeerRow,{peerInfo:a})]},a.senderId))}),PeerRow=({peerInfo:_})=>{const a=useRemovePeer();return jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",height:"106px","data-testid":"peer-row",paddingY:"30px",children:[jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(AspectRatio,{width:"48px",marginRight:"16px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{width:"100%",src:_.icon})}),jsxRuntimeExports.jsxs(Center,{alignItems:"flex-start",flexDirection:"column",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"6px",size:"md",children:_.name}),jsxRuntimeExports.jsx(StoredPeerInfo,{peerInfo:_})]})]}),jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsx(IconButton,{"aria-label":"Remove Peer",icon:jsxRuntimeExports.jsx(TrashIcon,{}),onClick:()=>a(_),size:"xs",variant:"circle"})})]})},StoredPeerInfo=({peerInfo:_})=>{const a=useGetConnectionInfo(_.senderId);return a?jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(AddressPill,{marginRight:"10px",address:parsePkh(a.accountPkh)}),jsxRuntimeExports.jsx(Divider,{marginRight:"10px",orientation:"vertical"}),jsxRuntimeExports.jsx(Text,{marginTop:"2px",marginRight:"4px",color:colors.gray[450],fontWeight:650,size:"sm",children:"Network:"}),jsxRuntimeExports.jsx(Text,{marginTop:"2px",color:colors.white,"data-testid":"dapp-connection-network",size:"sm",children:lodashExports.capitalize(a.networkType)})]}):null},DAppsDrawerCard=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1(),j=useAddPeer();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"dApps",isSelected:_,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:_,onClose:a,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{"data-testid":"drawer-body",children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:a}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",height:"96px",children:jsxRuntimeExports.jsx(Heading,{children:"dApps"})}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.readText().then(et=>j(et)),children:"Connect with Pairing Request"}),jsxRuntimeExports.jsx(Text,{marginTop:"16px",marginBottom:"32px",color:colors.gray[400],children:"or open a deeplink from inside the dApp..."}),jsxRuntimeExports.jsx(BeaconPeers,{})]})]})})]})]})},ErrorLogsDrawerCard=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Error Logs",isSelected:_,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{blockScrollOnMount:!1,isOpen:_,onClose:a,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:a}),jsxRuntimeExports.jsx(ErrorLogsDrawerBody,{})]})})]})]})},ErrorLogsDrawerBody=()=>{const _=[...useAppSelector(j=>j.errors)].reverse(),a=useDispatch(),$=()=>{a(errorsSlice.actions.reset())};return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",height:"50px",marginBottom:"20px",children:[jsxRuntimeExports.jsx(Heading,{size:"xl",children:"Error Logs"}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx("a",{download:"UmamiErrorLogs.json",href:`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(_))}`,children:jsxRuntimeExports.jsx(Button,{variant:"tertiary",children:"Download error logs"})}),jsxRuntimeExports.jsx(Button,{marginLeft:"8px",onClick:$,variant:"warning",children:"Clear All"})]})]}),_.map(j=>jsxRuntimeExports.jsx(ErrorLogRow,{errorLog:j},nanoid()))]})},ErrorLogRow=({errorLog:_})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{marginY:1}),jsxRuntimeExports.jsx(Flex,{justifyContent:"space-between",paddingY:"12px",children:jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(OutlineExclamationCircleIcon,{marginTop:"1px",marginRight:"8px"}),jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[jsxRuntimeExports.jsx(Heading,{wordBreak:"break-all",size:"sm",children:_.description}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:_.timestamp})]})]})})]}),removeTrailingSlashes=_=>_.replace(/\/+$/g,""),UpsertNetworkModal=({network:_})=>{const a=_?"edit":"create",{onClose:$}=reactExports.useContext(DynamicModalContext),j=useDispatch(),et=useAvailableNetworks(),{formState:{errors:tt,isValid:rt},register:nt,handleSubmit:it}=useForm({mode:"onBlur",defaultValues:_}),ot=st=>{j(networksActions.upsertNetwork(st)),$()};return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:it(ot),children:[jsxRuntimeExports.jsxs(ModalHeader,{textAlign:"center",children:[a==="edit"?"Edit":"Add"," Network",jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsxs(ModalBody,{children:[a==="create"&&jsxRuntimeExports.jsxs(FormControl,{marginTop:"32px",marginBottom:"24px",isInvalid:!!tt.name,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Name"}),jsxRuntimeExports.jsx(Input,{placeholder:"mainnet",...nt("name",{required:"Name is required",validate:st=>{if(et.find(ct=>ct.name===st))return"Network with this name already exists"}})}),tt.name&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.name.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"24px",isInvalid:!!tt.rpcUrl,children:[jsxRuntimeExports.jsx(FormLabel,{children:"RPC URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://prod.tcinfra.net/rpc/mainnet",...nt("rpcUrl",{required:"RPC URL is required",setValueAs:removeTrailingSlashes})}),tt.rpcUrl&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.rpcUrl.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"24px",isInvalid:!!tt.tzktApiUrl,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Tzkt API URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://api.ghostnet.tzkt.io",...nt("tzktApiUrl",{required:"Tzkt API URL is required",setValueAs:removeTrailingSlashes})}),tt.tzktApiUrl&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.tzktApiUrl.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"24px",isInvalid:!!tt.tzktExplorerUrl,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Tzkt Explorer URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://ghostnet.tzkt.io",...nt("tzktExplorerUrl",{required:"Tzkt Explorer URL is required",setValueAs:removeTrailingSlashes})}),tt.tzktExplorerUrl&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.tzktExplorerUrl.message})]}),jsxRuntimeExports.jsxs(FormControl,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"Buy Tez URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://faucet.ghostnet.teztnets.com",...nt("buyTezUrl")})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!rt,onClick:()=>{},type:"submit",children:a==="edit"?"Save changes":"Add network"})})]})]})})},NetworkSettingsDrawerBody=()=>{const{openWith:_}=reactExports.useContext(DynamicModalContext),a=useSelectedNetwork(),$=useSelectNetwork(),j=useAvailableNetworks(),et=useAppDispatch(),tt=rt=>{et(networksActions.removeNetwork(rt))};return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[jsxRuntimeExports.jsxs(Center,{justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Heading,{children:"Network Settings"}),jsxRuntimeExports.jsxs(Button,{paddingRight:"0",onClick:()=>_(jsxRuntimeExports.jsx(UpsertNetworkModal,{})),variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{size:"sm",children:"Add Network"}),jsxRuntimeExports.jsx(PlusIcon,{width:"18px",height:"18px",marginLeft:"4px",stroke:"currentcolor"})]})]}),jsxRuntimeExports.jsx(RadioGroup,{marginTop:"60px",onChange:$,value:a.name,children:jsxRuntimeExports.jsx(Stack,{children:j.map(rt=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{borderColor:colors.gray[700]}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between","data-testid":`network-${rt.name}`,children:[jsxRuntimeExports.jsx(Radio,{height:"100px",value:rt.name,variant:"primary",children:jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",marginLeft:"16px",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"4px",size:"sm",children:rt.name}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],children:rt.rpcUrl})]})}),!isDefault(rt)&&jsxRuntimeExports.jsx(Center,{"data-testid":"popover-menu",children:jsxRuntimeExports.jsxs(PopoverMenu,{children:[jsxRuntimeExports.jsxs(Button,{onClick:()=>_(jsxRuntimeExports.jsx(UpsertNetworkModal,{network:rt})),variant:"popover",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Edit"}),jsxRuntimeExports.jsx(PenIcon,{stroke:"inherit"})]}),jsxRuntimeExports.jsx(Divider,{marginTop:"4px"}),jsxRuntimeExports.jsxs(Button,{onClick:()=>tt(rt),variant:"popover",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Remove"}),jsxRuntimeExports.jsx(TrashIcon,{stroke:"inherit"})]})]})})]})]},rt.name))})})]})},NetworkSettingsDrawerCard=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Network Settings",isSelected:_,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{blockScrollOnMount:!1,isOpen:_,onClose:a,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:a}),jsxRuntimeExports.jsx(NetworkSettingsDrawerBody,{})]})})]})]})},ChangePasswordForm=()=>{const{onClose:_}=reactExports.useContext(DynamicModalContext),a=useForm({mode:"onBlur"}),$=useToast(),j=useAppDispatch(),{handleAsyncAction:et,isLoading:tt}=useAsyncActionHandler(),{handleSubmit:rt,formState:{isValid:nt,errors:it},getValues:ot}=a,st=async({currentPassword:ct,newPassword:ut,newPasswordConfirmation:ht})=>{if(!(ct===ut||ut!==ht))return et(async()=>{await j(changeMnemonicPassword({currentPassword:ct,newPassword:ut})).unwrap(),$({description:"Password updated",status:"success"}),_()})};return jsxRuntimeExports.jsx(FormProvider,{...a,children:jsxRuntimeExports.jsx(ModalContent,{background:colors.gray[700],"data-testid":"change-password-modal",children:jsxRuntimeExports.jsxs("form",{onSubmit:rt(st),children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalHeader,{textAlign:"center",children:jsxRuntimeExports.jsx(Heading,{children:"Change Password"})}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{marginTop:"32px",isInvalid:!!it.currentPassword,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"current-password",inputName:"currentPassword",label:"Current Password",placeholder:"Enter your current password",required:"Current password is required"}),it.currentPassword&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"current-password-error",children:it.currentPassword.message})]}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!it.newPassword,marginY:6,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"new-password",inputName:"newPassword",label:"New Password",placeholder:"Enter new password",required:"New password is required",validate:ct=>ot("currentPassword")!==ct||"Cannot be the same as old password"}),it.newPassword&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"new-password-error",children:it.newPassword.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:3,isInvalid:!!it.newPasswordConfirmation,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"new-password-confirmation",inputName:"newPasswordConfirmation",label:"Confirm New Password",placeholder:"Confirm new password",required:"Confirmation is required",validate:ct=>ot("newPassword")===ct||"Your new passwords do no match"}),it.newPasswordConfirmation&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"new-password-confirmation-error",children:it.newPasswordConfirmation.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!nt,isLoading:tt,size:"lg",type:"submit",children:"Update Password"})})]})})})},SettingsView=()=>jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Settings"}),jsxRuntimeExports.jsxs(Box,{overflowY:"scroll",children:[jsxRuntimeExports.jsx(Box,{marginTop:"16px",children:jsxRuntimeExports.jsx(GeneralSection,{})}),jsxRuntimeExports.jsx(BackupSection,{}),jsxRuntimeExports.jsx(AdvancedSection,{})]})]}),GeneralSection=()=>jsxRuntimeExports.jsxs(SectionContainer,{title:"General",children:[jsxRuntimeExports.jsx(NetworkSettingsDrawerCard,{}),jsxRuntimeExports.jsx(ErrorLogsDrawerCard,{})]}),BackupSection=()=>jsxRuntimeExports.jsx(SectionContainer,{title:"Backup",children:jsxRuntimeExports.jsx(ClickableCard,{isSelected:!1,onClick:downloadBackupFile,children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Heading,{size:"sm",children:"Download backup file"}),jsxRuntimeExports.jsx(Button,{onClick:downloadBackupFile,variant:"unstyled",children:jsxRuntimeExports.jsx(DownloadIcon,{cursor:"pointer"})})]})})}),AdvancedSection=()=>{const{modalElement:_,onOpen:a}=useOffboardingModal(),{openWith:$}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(SectionContainer,{title:"Advanced Settings",children:[jsxRuntimeExports.jsx(DAppsDrawerCard,{}),jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Off-board Wallet",isSelected:!1,onClick:a}),jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Change Password",isSelected:!1,onClick:()=>$(jsxRuntimeExports.jsx(ChangePasswordForm,{}))}),_]})},SectionContainer=({title:_,children:a})=>jsxRuntimeExports.jsx(Box,{marginTop:"8px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsxs(Box,{width:"550px",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"16px",size:"lg",children:_}),a]})})}),TokenTile=({token:_,amount:a,...$})=>{const{contract:j}=_,et=tokenPrettyAmount(a,_),tt=tokenSymbolSafe(_);return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"start",width:"400px",padding:"15px",background:colors.gray[800],borderRadius:"4px","data-testid":"token-tile",...$,children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(AspectRatio,{width:"30px",height:"30px",marginRight:"12px",ratio:1,children:jsxRuntimeExports.jsx(TokenIcon,{padding:"6.25px",background:colors.gray[500],borderRadius:"4px",contract:j})})}),jsxRuntimeExports.jsx(PrettyNumber,{number:et}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:tt})]})},SignPage=_=>{const{mode:a,operations:$,data:{token:j}}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:ot,reEstimate:st,onSign:ct}=useSignPageHelpers($,a),{amount:ut,recipient:ht}=tt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:tt.type,signer:tt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TokenTile,{amount:ut,token:j}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",marginBottom:"24px",paddingX:"4px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(SignPageFee,{fee:et})})}),jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{marginBottom:"24px",address:tt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:ht}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:nt,operationType:tt.type,reEstimate:st,sender:tt.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:ct,signer:ot,text:headerText(tt.type,a)})})]})})})},FormPage=_=>{const{token:a}=_,$=useOpenSignPageFormAction({SignPage,signPageExtraData:{token:a},FormPage,defaultFormPageProps:_,toOperation:toOperation(a)}),j=useAddToBatchFormAction(toOperation(a)),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:formDefaultValues(_)}),{formState:{isValid:it,errors:ot},register:st,handleSubmit:ct}=nt,ut=tokenDecimals(a),ht=formatTokenAmount(a.balance,ut),Et=getSmallestUnit(Number(ut));return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(FormPageHeader,{}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!ot.prettyAmount,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Amount"}),jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{isDisabled:rt,step:Et,type:"number",...st("prettyAmount",{required:"Amount is required",max:{value:ht.toString(),message:`Max amount is ${ht}`},validate:makeValidateDecimals(Number(ut))}),placeholder:Et}),jsxRuntimeExports.jsx(InputRightElement,{paddingRight:"12px","data-testid":"token-symbol",children:tokenSymbolSafe(a)})]}),ot.prettyAmount&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"amount-error",children:ot.prettyAmount.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),ot.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:ot.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ct(tt),onSingleSubmit:ct(et)})})]})})})},toOperation=_=>a=>{const $={type:"fa2",sender:parsePkh(a.sender),recipient:parsePkh(a.recipient),contract:parseContractPkh(_.contract),tokenId:_.tokenId,amount:getRealAmount(_,a.prettyAmount)};return _.type==="fa2"?$:{...$,type:"fa1.2",tokenId:"0"}},Header=({account:_})=>{const{address:a,label:$}=_;return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"78px",background:accountIconGradient({left:"-10px",top:"-10px",account:_,radius:"100px",mainBackgroundColor:colors.gray[800]}),borderTopRadius:"8px","data-testid":"header",paddingX:"30px",children:[jsxRuntimeExports.jsx(AccountTileIcon,{account:_,size:"lg"}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",flex:1,children:[jsxRuntimeExports.jsxs(Box,{marginLeft:"16px","data-testid":"account-identifier",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"4px",size:"md",children:$}),jsxRuntimeExports.jsx(Text,{color:colors.gray[300],size:"sm",children:formatPkh(a.pkh)})]}),jsxRuntimeExports.jsx(Flex,{flexDirection:"column-reverse",children:jsxRuntimeExports.jsx(AccountBalance,{verticalAlign:"bottom",address:_.address.pkh})})]})]})},AccountTokens=({account:_,tokens:a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Card,{overflowX:"auto",marginBottom:"16px",borderBottomRadius:"8px",backgroundColor:colors.gray[900],children:[jsxRuntimeExports.jsx(Header,{account:_}),jsxRuntimeExports.jsx(TableContainer,{paddingX:"30px",children:jsxRuntimeExports.jsx(Table,{children:jsxRuntimeExports.jsx(Tbody,{children:a.map((j,et)=>{const tt=et===a.length-1?"transparent":colors.gray[700];return jsxRuntimeExports.jsxs(Tr,{"data-testid":"token-tile",children:[jsxRuntimeExports.jsx(Td,{width:"20%",minWidth:"240px",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(TokenIcon,{display:"inline-block",width:"38px",contract:j.contract}),jsxRuntimeExports.jsx(Heading,{display:"inline-block",marginLeft:"16px",size:"sm",children:jsxRuntimeExports.jsx(TokenNameWithIcon,{token:j})})]})}),jsxRuntimeExports.jsx(Td,{width:"20%",minWidth:"200px",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsx(AddressPill,{address:parseContractPkh(j.contract)})}),jsxRuntimeExports.jsx(Td,{width:"15%",minWidth:"160px",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsx(Heading,{size:"sm",children:tokenPrettyAmount(j.balance,j,{showSymbol:!1})})}),jsxRuntimeExports.jsx(Td,{textAlign:"right",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsx(SendButton,{onClick:()=>$(jsxRuntimeExports.jsx(FormPage,{sender:_,token:j}))})})]},fullId(j))})})})})]})},TokensPage=()=>{const{accountsFilter:_,selectedAccounts:a}=useAccountsFilter(),$=useGetAccountAllTokens(),j=a.map(et=>[et,$(et.address.pkh)]).filter(([,et])=>et.length>0);return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Tokens"}),_,j.length===0?jsxRuntimeExports.jsx(NoTokens,{size:"lg"}):jsxRuntimeExports.jsx(Box,{overflowY:"auto",children:j.map(([et,tt])=>jsxRuntimeExports.jsx(AccountTokens,{account:et,tokens:tt},et.address.pkh))})]})},AppVersion=({isCollapsed:_,...a})=>{const $=_?packageInfo.version:`Umami v${packageInfo.version}`;return jsxRuntimeExports.jsx(Text,{color:colors.gray[450],...a,children:$})},CollapseMenuButton=({toggle:_,...a})=>jsxRuntimeExports.jsx(Center,{width:"44px",height:"44px",marginRight:"-14px",borderRadius:"4px",_hover:{background:colors.gray[800]},cursor:"pointer","data-testid":"collapse-menu-button",onClick:_,...a,children:jsxRuntimeExports.jsx(BurgerMenuIcon,{})}),useCollapseMenu=()=>{const[_,a]=reactExports.useState(!1),$=reactExports.useCallback(()=>{a(j=>!j)},[]);return{isCollapsed:_,toggle:$}},ORANGE="#F74F18",MakiLogo=_=>{const a=useSelectedNetwork();return jsxRuntimeExports.jsx(MakiIcon,{background:"white",borderRadius:"8px","data-testid":"maki-logo",fishColor:a.name==="mainnet"?ORANGE:"black",..._})},NetworkSelector=()=>{const _=useSelectedNetwork(),a=useAvailableNetworks(),$=useSelectNetwork(),{onOpen:j,onClose:et,isOpen:tt}=useDisclosure$1();return jsxRuntimeExports.jsxs(Popover,{isOpen:tt,onClose:et,onOpen:j,placement:"bottom-end",children:[jsxRuntimeExports.jsx(PopoverTrigger,{children:jsxRuntimeExports.jsxs(Button,{marginTop:"4px",color:colors.green,"data-testid":"network-selector",variant:"unstyled",children:[lodashExports.capitalize(_.name),tt?jsxRuntimeExports.jsx(ChevronUpIcon,{marginTop:"-2px",stroke:"currentcolor"}):jsxRuntimeExports.jsx(ChevronDownIcon$1,{marginTop:"-2px",stroke:"currentcolor"})]})}),jsxRuntimeExports.jsx(PopoverContent,{width:"100px",marginTop:"-10px",background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],children:jsxRuntimeExports.jsx(PopoverBody,{padding:"4px 12px",children:jsxRuntimeExports.jsx(Flex,{flexDirection:"column",children:a.map((rt,nt)=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{height:"34px",color:rt.name===_.name?colors.green:colors.gray[300],fontSize:"14px",fontWeight:400,textAlign:"right",_hover:{color:colors.greenL},onClick:()=>{$(rt.name),et()},variant:"unstyled",children:lodashExports.capitalize(rt.name)}),nt{const[_,a]=reactExports.useState(!1),$=window;reactExports.useEffect(()=>{$&&$.electronAPI&&$.electronAPI.onAppUpdateDownloaded(et=>a(!0))},[$]);const j=()=>{$&&$.electronAPI&&$.electronAPI.installAppUpdateAndQuit()};return _?jsxRuntimeExports.jsx(Box,{marginTop:"24px",marginBottom:"6px",children:jsxRuntimeExports.jsxs(Button,{justifyContent:"flex-start",width:"100%",height:"32px",paddingTop:"7px",paddingRight:"8px",paddingBottom:"7px",paddingLeft:"8px",color:colors.black,background:colors.green,_hover:{color:colors.black,background:colors.greenL},onClick:j,children:[jsxRuntimeExports.jsx(FlipForwardEnergy,{}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:"Update Umami"})]})}):null},SideNavbar=()=>{const{isCollapsed:_,toggle:a}=useCollapseMenu(),$=jsxRuntimeExports.jsx(CollapseMenuButton,{marginTop:_?0:"2px",marginRight:_?0:"-14px",toggle:a});return jsxRuntimeExports.jsxs(Flex,{alignItems:_?"center":"normal",flexDirection:"column",width:_?"80px":"236px",padding:_?"30px 20px":"30px",background:colors.gray[900],"data-testid":`side-navbar${_?"-collapsed":""}`,children:[jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",height:"30px",children:_?$:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(MakiLogo,{width:"38px",height:"38px"}),jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(NetworkSelector,{}),$]})]})}),jsxRuntimeExports.jsx(Divider,{marginTop:"28px"})]}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",flexDirection:"column",flex:1,children:[jsxRuntimeExports.jsxs(Box,{alignItems:_?"center":"normal",justifyContent:_?"space-around":"normal",display:_?"flex":"block",height:"100%",children:[!_&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(UpdateAppButton,{}),jsxRuntimeExports.jsx(TotalBalance,{})]}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(AccountsIcon,{}),isCollapsed:_,label:"Accounts",to:"/home"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(DiamondIcon,{}),isCollapsed:_,label:"NFTs",to:"/nfts"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(RefreshClockIcon,{width:"24px",height:"24px"}),isCollapsed:_,label:"Operations",to:"/operations"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(CoinIcon,{}),isCollapsed:_,label:"Tokens",to:"/tokens"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(BatchIcon,{}),isCollapsed:_,label:"Batch",to:"/batch"})]})]}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(MenuItem,{marginTop:"22px",icon:jsxRuntimeExports.jsx(AddressBookIcon,{}),isCollapsed:_,label:"Address Book",to:"/address-book"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(GearIcon,{}),isCollapsed:_,label:"Settings",to:"/settings"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(HelpIcon,{}),isCollapsed:_,label:"Help",to:"/help"}),jsxRuntimeExports.jsx(AppVersion,{marginTop:"24px",fontSize:"14px",textAlign:_?"center":"left",isCollapsed:_})]})]})]})},MenuItem=({icon:_,label:a,to:$,isCollapsed:j,...et})=>{const rt=useLocation().pathname.startsWith($);return jsxRuntimeExports.jsx(Link,{to:$,children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"flex-start",width:j?"44px":"176px",marginBottom:"8px",padding:"10px",background:rt?colors.gray[600]:"transparent",borderRadius:"4px",_hover:{background:rt?colors.gray[600]:colors.gray[800]},cursor:"pointer",...et,children:[_,!j&&jsxRuntimeExports.jsx(Text,{marginLeft:"10px",size:"sm",children:a})]})})},TotalBalance=()=>{const _=useTotalBalance(),[a]=useMediaQuery("(max-height: 900px)");return jsxRuntimeExports.jsxs(Box,{marginTop:"24px",marginBottom:a?"30px":"100px","data-testid":"total-balance",children:[jsxRuntimeExports.jsx(Text,{marginBottom:"4px",size:"sm",children:"Balance"}),_&&jsxRuntimeExports.jsx(TezRecapDisplay,{balance:_.mutez,dollarBalance:_.usd})]})},withSideMenu=_=>jsxRuntimeExports.jsxs(Flex,{height:"100vh",children:[jsxRuntimeExports.jsx(SideNavbar,{}),jsxRuntimeExports.jsx(Box,{flex:1,overflowX:"hidden",height:"100%",background:"linear-gradient(180deg, rgba(0, 231, 182, 0.35) -41.53%, rgba(0, 231, 182, 0.00) 34.71%)",paddingX:"24px",children:_})]}),AccountsImage=""+new URL("accounts-DTYOez9Q.png",import.meta.url).href,BatchImage=""+new URL("batch-CoYFN9ox.png",import.meta.url).href,MultisigImage=""+new URL("multisig-GRRIvmJS.png",import.meta.url).href;var js={},Carousel$1={},lib={},reactSwipe={},hasRequiredReactSwipe;function requireReactSwipe(){return hasRequiredReactSwipe||(hasRequiredReactSwipe=1,function(_){(function(a,$){$(_,reactExports,propTypesExports)})(commonjsGlobal,function(a,$,j){Object.defineProperty(a,"__esModule",{value:!0}),a.setHasSupportToCaptureOption=Et;var et=rt($),tt=rt(j);function rt(Ct){return Ct&&Ct.__esModule?Ct:{default:Ct}}var nt=Object.assign||function(Ct){for(var Ot=1;Ot=0||Object.prototype.hasOwnProperty.call(Ct,Ut)&&(zt[Ut]=Ct[Ut]);return zt}function ot(Ct,Ot){if(!(Ct instanceof Ot))throw new TypeError("Cannot call a class as a function")}var st=function(){function Ct(Ot,zt){for(var Ut=0;Ut0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return ht?Ct:Ct.capture}function Mt(Ct){if("touches"in Ct){var Ot=Ct.touches[0],zt=Ot.pageX,Ut=Ot.pageY;return{x:zt,y:Ut}}var Vt=Ct.screenX,jt=Ct.screenY;return{x:Vt,y:jt}}var kt=function(Ct){ut(Ot,Ct);function Ot(){var zt;ot(this,Ot);for(var Ut=arguments.length,Vt=Array(Ut),jt=0;jtVt&&this.props.onSwipeRight(1,Ut),this.movePosition.deltaY<-Vt?this.props.onSwipeUp(1,Ut):this.movePosition.deltaY>Vt&&this.props.onSwipeDown(1,Ut)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(Ut){this.swiper=Ut,this.props.innerRef(Ut)}},{key:"render",value:function(){var Ut=this.props;Ut.tagName;var Vt=Ut.className,jt=Ut.style,$t=Ut.children;Ut.allowMouseEvents,Ut.onSwipeUp,Ut.onSwipeDown,Ut.onSwipeLeft,Ut.onSwipeRight,Ut.onSwipeStart,Ut.onSwipeMove,Ut.onSwipeEnd,Ut.innerRef,Ut.tolerance;var Bt=it(Ut,["tagName","className","style","children","allowMouseEvents","onSwipeUp","onSwipeDown","onSwipeLeft","onSwipeRight","onSwipeStart","onSwipeMove","onSwipeEnd","innerRef","tolerance"]);return et.default.createElement(this.props.tagName,nt({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:Vt,style:jt},Bt),$t)}}]),Ot}($.Component);kt.displayName="ReactSwipe",kt.propTypes={tagName:tt.default.string,className:tt.default.string,style:tt.default.object,children:tt.default.node,allowMouseEvents:tt.default.bool,onSwipeUp:tt.default.func,onSwipeDown:tt.default.func,onSwipeLeft:tt.default.func,onSwipeRight:tt.default.func,onSwipeStart:tt.default.func,onSwipeMove:tt.default.func,onSwipeEnd:tt.default.func,innerRef:tt.default.func,tolerance:tt.default.number.isRequired},kt.defaultProps={tagName:"div",allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},a.default=kt})}(reactSwipe)),reactSwipe}(function(_){(function(a,$){$(_,requireReactSwipe())})(commonjsGlobal,function(a,$){Object.defineProperty(a,"__esModule",{value:!0});var j=et($);function et(tt){return tt&&tt.__esModule?tt:{default:tt}}a.default=j.default})})(lib);var cssClasses={},classnames={exports:{}};/*! +`}return fr.substring(0,fr.length-1)},dt.renderTo2dContext=function(qt,Jt){Jt=Jt||2;for(var Ft=dt.getModuleCount(),Kt=0;Kt>>8),Nt.push(bt&255)):Nt.push($t)}}return Nt}};var et={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},tt={L:1,M:0,Q:3,H:2},rt={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},nt=function(){var Ut=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],Vt=1335,jt=7973,$t=21522,Bt={},Nt=function(Lt){for(var Pt=0;Lt!=0;)Pt+=1,Lt>>>=1;return Pt};return Bt.getBCHTypeInfo=function(Lt){for(var Pt=Lt<<10;Nt(Pt)-Nt(Vt)>=0;)Pt^=Vt<=0;)Pt^=jt<5&&(bt+=3+vt-5)}for(var at=0;at=256;)Bt-=255;return Ut[Bt]},$t}();function ot(Ut,Vt){if(typeof Ut.length>"u")throw Ut.length+"/"+Vt;var jt=function(){for(var Bt=0;Bt"u")throw"bad rs block @ typeNumber:"+Bt+"/errorCorrectionLevel:"+Nt;for(var Pt=Lt.length/3,bt=[],at=0;at>>7-$t%8&1)==1},jt.put=function($t,Bt){for(var Nt=0;Nt>>Bt-Nt-1&1)==1)},jt.getLengthInBits=function(){return Vt},jt.putBit=function($t){var Bt=Math.floor(Vt/8);Ut.length<=Bt&&Ut.push(0),$t&&(Ut[Bt]|=128>>>Vt%8),Vt+=1},jt},ut=function(Ut){var Vt=et.MODE_NUMBER,jt=Ut,$t={};$t.getMode=function(){return Vt},$t.getLength=function(Lt){return jt.length},$t.write=function(Lt){for(var Pt=jt,bt=0;bt+2>>8&255)*192+(bt&255),Nt.put(bt,13),Pt+=2}if(Pt>>8)},Vt.writeBytes=function(jt,$t,Bt){$t=$t||0,Bt=Bt||jt.length;for(var Nt=0;Nt0&&(jt+=","),jt+=Ut[$t];return jt+="]",jt},Vt},kt=function(){var Ut=0,Vt=0,jt=0,$t="",Bt={},Nt=function(Pt){$t+=String.fromCharCode(Lt(Pt&63))},Lt=function(Pt){if(!(Pt<0)){if(Pt<26)return 65+Pt;if(Pt<52)return 97+(Pt-26);if(Pt<62)return 48+(Pt-52);if(Pt==62)return 43;if(Pt==63)return 47}throw"n:"+Pt};return Bt.writeByte=function(Pt){for(Ut=Ut<<8|Pt&255,Vt+=8,jt+=1;Vt>=6;)Nt(Ut>>>Vt-6),Vt-=6},Bt.flush=function(){if(Vt>0&&(Nt(Ut<<6-Vt),Ut=0,Vt=0),jt%3!=0)for(var Pt=3-jt%3,bt=0;bt=Vt.length){if(Bt==0)return-1;throw"unexpected end of file./"+Bt}var Pt=Vt.charAt(jt);if(jt+=1,Pt=="=")return Bt=0,-1;if(Pt.match(/^\s$/))continue;$t=$t<<6|Lt(Pt.charCodeAt(0)),Bt+=6}var bt=$t>>>Bt-8&255;return Bt-=8,bt};var Lt=function(Pt){if(65<=Pt&&Pt<=90)return Pt-65;if(97<=Pt&&Pt<=122)return Pt-97+26;if(48<=Pt&&Pt<=57)return Pt-48+52;if(Pt==43)return 62;if(Pt==47)return 63;throw"c:"+Pt};return Nt},Ot=function(Ut,Vt){var jt=Ut,$t=Vt,Bt=new Array(Ut*Vt),Nt={};Nt.setPixel=function(at,dt,vt){Bt[dt*jt+at]=vt},Nt.write=function(at){at.writeString("GIF87a"),at.writeShort(jt),at.writeShort($t),at.writeByte(128),at.writeByte(0),at.writeByte(0),at.writeByte(0),at.writeByte(0),at.writeByte(0),at.writeByte(255),at.writeByte(255),at.writeByte(255),at.writeString(","),at.writeShort(0),at.writeShort(0),at.writeShort(jt),at.writeShort($t),at.writeByte(0);var dt=2,vt=Pt(dt);at.writeByte(dt);for(var xt=0;vt.length-xt>255;)at.writeByte(255),at.writeBytes(vt,xt,255),xt+=255;at.writeByte(vt.length-xt),at.writeBytes(vt,xt,vt.length-xt),at.writeByte(0),at.writeString(";")};var Lt=function(at){var dt=at,vt=0,xt=0,wt={};return wt.write=function(_t,At){if(_t>>>At)throw"length over";for(;vt+At>=8;)dt.writeByte(255&(_t<>>=8-vt,xt=0,vt=0;xt=_t<0&&dt.writeByte(xt)},wt},Pt=function(at){for(var dt=1<>6,128|it&63):it<55296||it>=57344?rt.push(224|it>>12,128|it>>6&63,128|it&63):(nt++,it=65536+((it&1023)<<10|tt.charCodeAt(nt)&1023),rt.push(240|it>>18,128|it>>12&63,128|it>>6&63,128|it&63))}return rt}return et(j)}})(),function(j){_.exports=j()}(function(){return $})})(qrcode);var qrcodeExports=qrcode.exports,__extends=commonjsGlobal&&commonjsGlobal.__extends||function(){var _=function(a,$){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(j,et){j.__proto__=et}||function(j,et){for(var tt in et)Object.prototype.hasOwnProperty.call(et,tt)&&(j[tt]=et[tt])},_(a,$)};return function(a,$){if(typeof $!="function"&&$!==null)throw new TypeError("Class extends value "+String($)+" is not a constructor or null");_(a,$);function j(){this.constructor=a}a.prototype=$===null?Object.create($):(j.prototype=$.prototype,new j)}}(),__assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(_){for(var a,$=1,j=arguments.length;$=1&&tt<=127?j+=$.charAt(et):tt>2047?(j+=String.fromCharCode(224|tt>>12&15),j+=String.fromCharCode(128|tt>>6&63),j+=String.fromCharCode(128|tt>>0&63)):(j+=String.fromCharCode(192|tt>>6&31),j+=String.fromCharCode(128|tt>>0&63));return j},a.prototype.drawRoundedSquare=function($,j,et,tt,rt,nt,it,ot){ot.lineWidth=$,ot.fillStyle=rt,ot.strokeStyle=rt,et+=$/2,j+=$/2,tt-=$,Array.isArray(nt)||(nt=[nt,nt,nt,nt]),nt=nt.map(function(Et){return Et=Math.min(Et,tt/2),Et<0?0:Et});var st=nt[0]||0,ct=nt[1]||0,ut=nt[2]||0,ht=nt[3]||0;ot.beginPath(),ot.moveTo(j+st,et),ot.lineTo(j+tt-ct,et),ct&&ot.quadraticCurveTo(j+tt,et,j+tt,et+ct),ot.lineTo(j+tt,et+tt-ut),ut&&ot.quadraticCurveTo(j+tt,et+tt,j+tt-ut,et+tt),ot.lineTo(j+ht,et+tt),ht&&ot.quadraticCurveTo(j,et+tt,j,et+tt-ht),ot.lineTo(j,et+st),st&&ot.quadraticCurveTo(j,et,j+st,et),ot.closePath(),ot.stroke(),it&&ot.fill()},a.prototype.drawPositioningPattern=function($,j,et,tt,rt,nt,it){it===void 0&&(it=[0,0,0,0]);var ot=Math.ceil(j),st,ct;typeof it!="number"&&!Array.isArray(it)?(st=it.outer||0,ct=it.inner||0):(st=it,ct=st);var ut,ht;typeof nt!="string"?(ut=nt.outer,ht=nt.inner):(ut=nt,ht=nt);var Et=tt*j+et,St=rt*j+et,Mt=j*7;this.drawRoundedSquare(ot,St,Et,Mt,ut,st,!1,$),Mt=j*3,Et+=j*2,St+=j*2,this.drawRoundedSquare(ot,St,Et,Mt,ht,ct,!0,$)},a.prototype.isInPositioninZone=function($,j,et){return et.some(function(tt){return j>=tt.row&&j<=tt.row+7&&$>=tt.col&&$<=tt.col+7})},a.prototype.transformPixelLengthIntoNumberOfCells=function($,j){return $/j},a.prototype.isCoordinateInImage=function($,j,et,tt,rt,nt,it,ot){if(ot){var st=2,ct=this.transformPixelLengthIntoNumberOfCells(rt,it),ut=this.transformPixelLengthIntoNumberOfCells(nt,it),ht=this.transformPixelLengthIntoNumberOfCells(et,it)-1,Et=this.transformPixelLengthIntoNumberOfCells(tt,it)-1;return j>=ct-st&&j<=ct+ht+st&&$>=ut-st&&$<=ut+Et+st}else return!1},a.prototype.shouldComponentUpdate=function($){return!isEqual$1(this.props,$)},a.prototype.componentDidMount=function(){this.update()},a.prototype.componentDidUpdate=function(){this.update()},a.prototype.update=function(){var $,j=this.props,et=j.value,tt=j.ecLevel,rt=j.enableCORS,nt=j.bgColor,it=j.fgColor,ot=j.logoImage,st=j.logoOpacity,ct=j.logoOnLoad,ut=j.removeQrCodeBehindLogo,ht=j.qrStyle,Et=j.eyeRadius,St=j.eyeColor,Mt=j.logoPaddingStyle,kt=+this.props.size,Ct=+this.props.quietZone,Ot=this.props.logoWidth?+this.props.logoWidth:0,zt=this.props.logoHeight?+this.props.logoHeight:0,Ut=this.props.logoPadding?+this.props.logoPadding:0,Vt=qrGenerator(0,tt);Vt.addData(this.utf16to8(et)),Vt.make();var jt=($=this.canvasRef)===null||$===void 0?void 0:$.current,$t=jt.getContext("2d"),Bt=kt+2*Ct,Nt=Vt.getModuleCount(),Lt=kt/Nt,Pt=window.devicePixelRatio||1;jt.height=jt.width=Bt*Pt,$t.scale(Pt,Pt),$t.fillStyle=nt,$t.fillRect(0,0,Bt,Bt);var bt=Ct,at=[{row:0,col:0},{row:0,col:Nt-7},{row:Nt-7,col:0}];if($t.strokeStyle=it,ht==="dots"){$t.fillStyle=it;for(var dt=Lt/2,vt=0;vt0&&!Vt.isDark(vt-1,xt)&&xt>0&&!Vt.isDark(vt,xt-1)&&(wt[0]=!0),vt>0&&!Vt.isDark(vt-1,xt)&&xt0&&!Vt.isDark(vt,xt-1)&&(wt[3]=!0);var _t=Math.ceil((xt+1)*Lt)-Math.floor(xt*Lt),At=Math.ceil((vt+1)*Lt)-Math.floor(vt*Lt);$t.fillStyle=it,$t.beginPath(),$t.arc(Math.round(xt*Lt)+dt+bt,Math.round(vt*Lt)+dt+bt,dt,0,2*Math.PI,!1),$t.closePath(),$t.fill(),wt[0]||$t.fillRect(Math.round(xt*Lt)+bt,Math.round(vt*Lt)+bt,_t/2,At/2),wt[1]||$t.fillRect(Math.round(xt*Lt)+bt+Math.floor(_t/2),Math.round(vt*Lt)+bt,_t/2,At/2),wt[2]||$t.fillRect(Math.round(xt*Lt)+bt+Math.floor(_t/2),Math.round(vt*Lt)+bt+Math.floor(At/2),_t/2,At/2),wt[3]||$t.fillRect(Math.round(xt*Lt)+bt,Math.round(vt*Lt)+bt+Math.floor(At/2),_t/2,At/2)}}else for(var vt=0;vt{const $=useGetOwnedAccountSafe()(_);return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"You can receive tez or other digital assets by scanning or sharing this QR code",title:"Receive"}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",flexDirection:"column",children:jsxRuntimeExports.jsx(Box,{padding:"8px",background:"white",borderRadius:"8px",children:jsxRuntimeExports.jsx(QRCode_1,{size:232,value:_})})})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsxs(Box,{width:"100%",children:[$&&jsxRuntimeExports.jsx(Heading,{textAlign:"center",marginY:2,children:$.label}),jsxRuntimeExports.jsx(Flex,{justifyContent:"center",width:"100%",children:jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_),mode:{type:"no_icons"}})})]})})]})},AccountCard=({accountPkh:_})=>{const a=useGetOwnedAccount(),$=useGetAccountBalance(),j=useGetDollarBalance(),et=useGetAccountAllTokens(),tt=useGetAccountNFTs(),{openWith:rt}=reactExports.useContext(DynamicModalContext),nt=a(_),it=$(_),ot=j(_),st=et(_),ct=sortedByLastUpdate(tt(_));return jsxRuntimeExports.jsx(AccountDrawerDisplay,{account:nt,balance:it,dollarBalance:ot,nfts:ct,onReceive:()=>rt(jsxRuntimeExports.jsx(ReceiveModal,{pkh:_})),onSend:()=>rt(jsxRuntimeExports.jsx(FormPage$4,{sender:nt})),tokens:st})},InfoModal=({account:_})=>{const a=[{title:"Template",content:_.derivationPathTemplate},{title:"Path",content:_.derivationPath},{title:"Type (Curve)",content:_.curve}];return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalHeader,{children:[jsxRuntimeExports.jsx(CircleIcon,{icon:jsxRuntimeExports.jsx(SlashIcon,{}),size:"48px"}),jsxRuntimeExports.jsx(Center,{marginBottom:"8px",children:jsxRuntimeExports.jsx(Heading,{marginTop:"16px",children:"Derivation Info"})}),jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsx(ModalBody,{children:a.map(({title:$,content:j})=>j?jsxRuntimeExports.jsxs(Box,{marginTop:"24px",children:[jsxRuntimeExports.jsx(Heading,{size:"md",children:$}),jsxRuntimeExports.jsx(Center,{justifyContent:"flex-start",marginTop:"12px",padding:"15px",borderRadius:"4px",backgroundColor:colors.gray[800],children:jsxRuntimeExports.jsx(Text,{size:"sm",children:j})})]},j):null)})]})},DerivationInfoButton=({account:_,...a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext);switch(_.type){case"multisig":case"secret_key":case"social":return null;case"ledger":case"mnemonic":return jsxRuntimeExports.jsx(Button,{"data-testid":"derivation-info-button",onClick:()=>$(jsxRuntimeExports.jsx(InfoModal,{account:_})),variant:"CTAWithIcon",...a,children:jsxRuntimeExports.jsx(FolderInfoIcon,{stroke:"currentcolor"})})}},CloseDrawerButton=({onClose:_})=>jsxRuntimeExports.jsx(Button,{minWidth:"24px",padding:"0",onClick:_,variant:"CTAWithIcon",children:jsxRuntimeExports.jsx(ExitArrowIcon,{stroke:"currentcolor"})}),scriptRel="modulepreload",assetsURL=function(_,a){return new URL(_,a).href},seen={},__vitePreload=function _(a,$,j){let et=Promise.resolve();if($&&$.length>0){const tt=document.getElementsByTagName("link"),rt=document.querySelector("meta[property=csp-nonce]"),nt=(rt==null?void 0:rt.nonce)||(rt==null?void 0:rt.getAttribute("nonce"));et=Promise.all($.map(it=>{if(it=assetsURL(it,j),it in seen)return;seen[it]=!0;const ot=it.endsWith(".css"),st=ot?'[rel="stylesheet"]':"";if(!!j)for(let ht=tt.length-1;ht>=0;ht--){const Et=tt[ht];if(Et.href===it&&(!ot||Et.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${it}"]${st}`))return;const ut=document.createElement("link");if(ut.rel=ot?"stylesheet":scriptRel,ot||(ut.as="script",ut.crossOrigin=""),ut.href=it,nt&&ut.setAttribute("nonce",nt),document.head.appendChild(ut),ot)return new Promise((ht,Et)=>{ut.addEventListener("load",ht),ut.addEventListener("error",()=>Et(new Error(`Unable to preload CSS for ${it}`)))})}))}return et.then(()=>a()).catch(tt=>{const rt=new Event("vite:preloadError",{cancelable:!0});if(rt.payload=tt,window.dispatchEvent(rt),!rt.defaultPrevented)throw tt})};var loadScript=function _(a,$,j){var et=document.head||document.getElementsByTagName("head")[0],tt=document.createElement("script");typeof $=="function"&&(j=$,$={}),$=$||{},j=j||function(){},tt.type=$.type||"text/javascript",tt.charset=$.charset||"utf8",tt.async="async"in $?!!$.async:!0,tt.src=a,$.attrs&&setAttributes(tt,$.attrs),$.text&&(tt.text=""+$.text);var rt="onload"in tt?stdOnEnd:ieOnEnd;rt(tt,j),tt.onload||stdOnEnd(tt,j),et.appendChild(tt)};function setAttributes(_,a){for(var $ in a)_.setAttribute($,a[$])}function stdOnEnd(_,a){_.onload=function(){this.onerror=this.onload=null,a(null,_)},_.onerror=function(){this.onerror=this.onload=null,a(new Error("Failed to load "+this.src),_)}}function ieOnEnd(_,a){_.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,a(null,_))}}var isMergeableObject=function _(a){return isNonNullObject(a)&&!isSpecial(a)};function isNonNullObject(_){return!!_&&typeof _=="object"}function isSpecial(_){var a=Object.prototype.toString.call(_);return a==="[object RegExp]"||a==="[object Date]"||isReactElement(_)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(_){return _.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(_){return Array.isArray(_)?[]:{}}function cloneUnlessOtherwiseSpecified(_,a){return a.clone!==!1&&a.isMergeableObject(_)?deepmerge(emptyTarget(_),_,a):_}function defaultArrayMerge(_,a,$){return _.concat(a).map(function(j){return cloneUnlessOtherwiseSpecified(j,$)})}function getMergeFunction(_,a){if(!a.customMerge)return deepmerge;var $=a.customMerge(_);return typeof $=="function"?$:deepmerge}function getEnumerableOwnPropertySymbols(_){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(_).filter(function(a){return Object.propertyIsEnumerable.call(_,a)}):[]}function getKeys(_){return Object.keys(_).concat(getEnumerableOwnPropertySymbols(_))}function propertyIsOnObject(_,a){try{return a in _}catch{return!1}}function propertyIsUnsafe(_,a){return propertyIsOnObject(_,a)&&!(Object.hasOwnProperty.call(_,a)&&Object.propertyIsEnumerable.call(_,a))}function mergeObject(_,a,$){var j={};return $.isMergeableObject(_)&&getKeys(_).forEach(function(et){j[et]=cloneUnlessOtherwiseSpecified(_[et],$)}),getKeys(a).forEach(function(et){propertyIsUnsafe(_,et)||(propertyIsOnObject(_,et)&&$.isMergeableObject(a[et])?j[et]=getMergeFunction(et,$)(_[et],a[et],$):j[et]=cloneUnlessOtherwiseSpecified(a[et],$))}),j}function deepmerge(_,a,$){$=$||{},$.arrayMerge=$.arrayMerge||defaultArrayMerge,$.isMergeableObject=$.isMergeableObject||isMergeableObject,$.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var j=Array.isArray(a),et=Array.isArray(_),tt=j===et;return tt?j?$.arrayMerge(_,a,$):mergeObject(_,a,$):cloneUnlessOtherwiseSpecified(a,$)}deepmerge.all=function _(a,$){if(!Array.isArray(a))throw new Error("first argument should be an array");return a.reduce(function(j,et){return deepmerge(j,et,$)},{})};var deepmerge_1=deepmerge,cjs=deepmerge_1,__create$4=Object.create,__defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__getOwnPropNames$6=Object.getOwnPropertyNames,__getProtoOf$4=Object.getPrototypeOf,__hasOwnProp$6=Object.prototype.hasOwnProperty,__export$6=(_,a)=>{for(var $ in a)__defProp$6(_,$,{get:a[$],enumerable:!0})},__copyProps$6=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$6(a))!__hasOwnProp$6.call(_,et)&&et!==$&&__defProp$6(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$6(a,et))||j.enumerable});return _},__toESM$4=(_,a,$)=>($=_!=null?__create$4(__getProtoOf$4(_)):{},__copyProps$6(!_||!_.__esModule?__defProp$6($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$6=_=>__copyProps$6(__defProp$6({},"__esModule",{value:!0}),_),utils_exports={};__export$6(utils_exports,{callPlayer:()=>callPlayer,getConfig:()=>getConfig,getSDK:()=>getSDK,isBlobUrl:()=>isBlobUrl,isMediaStream:()=>isMediaStream,lazy:()=>lazy,omit:()=>omit,parseEndTime:()=>parseEndTime,parseStartTime:()=>parseStartTime,queryString:()=>queryString,randomString:()=>randomString,supportsWebKitPresentationMode:()=>supportsWebKitPresentationMode});var utils$1=__toCommonJS$6(utils_exports),import_react$2=__toESM$4(reactExports),import_load_script=__toESM$4(loadScript),import_deepmerge$1=__toESM$4(cjs);const lazy=_=>import_react$2.default.lazy(async()=>{const a=await _();return typeof a.default=="function"?a:a.default}),MATCH_START_QUERY=/[?&#](?:start|t)=([0-9hms]+)/,MATCH_END_QUERY=/[?&#]end=([0-9hms]+)/,MATCH_START_STAMP=/(\d+)(h|m|s)/g,MATCH_NUMERIC=/^\d+$/;function parseTimeParam(_,a){if(_ instanceof Array)return;const $=_.match(a);if($){const j=$[1];if(j.match(MATCH_START_STAMP))return parseTimeString(j);if(MATCH_NUMERIC.test(j))return parseInt(j)}}function parseTimeString(_){let a=0,$=MATCH_START_STAMP.exec(_);for(;$!==null;){const[,j,et]=$;et==="h"&&(a+=parseInt(j,10)*60*60),et==="m"&&(a+=parseInt(j,10)*60),et==="s"&&(a+=parseInt(j,10)),$=MATCH_START_STAMP.exec(_)}return a}function parseStartTime(_){return parseTimeParam(_,MATCH_START_QUERY)}function parseEndTime(_){return parseTimeParam(_,MATCH_END_QUERY)}function randomString(){return Math.random().toString(36).substr(2,5)}function queryString(_){return Object.keys(_).map(a=>`${a}=${_[a]}`).join("&")}function getGlobal(_){return window[_]?window[_]:window.exports&&window.exports[_]?window.exports[_]:window.module&&window.module.exports&&window.module.exports[_]?window.module.exports[_]:null}const requests={},getSDK=function _(a,$,j=null,et=()=>!0,tt=import_load_script.default){const rt=getGlobal($);return rt&&et(rt)?Promise.resolve(rt):new Promise((nt,it)=>{if(requests[a]){requests[a].push({resolve:nt,reject:it});return}requests[a]=[{resolve:nt,reject:it}];const ot=st=>{requests[a].forEach(ct=>ct.resolve(st))};if(j){const st=window[j];window[j]=function(){st&&st(),ot(getGlobal($))}}tt(a,st=>{st?(requests[a].forEach(ct=>ct.reject(st)),requests[a]=null):j||ot(getGlobal($))})})};function getConfig(_,a){return(0,import_deepmerge$1.default)(a.config,_.config)}function omit(_,...a){const $=[].concat(...a),j={},et=Object.keys(_);for(const tt of et)$.indexOf(tt)===-1&&(j[tt]=_[tt]);return j}function callPlayer(_,...a){if(!this.player||!this.player[_]){let $=`ReactPlayer: ${this.constructor.displayName} player could not call %c${_}%c – `;return this.player?this.player[_]||($+="The method was not available"):$+="The player was not available",console.warn($,"font-weight: bold",""),null}return this.player[_](...a)}function isMediaStream(_){return typeof window<"u"&&typeof window.MediaStream<"u"&&_ instanceof window.MediaStream}function isBlobUrl(_){return/^blob:/.test(_)}function supportsWebKitPresentationMode(_=document.createElement("video")){const a=/iPhone|iPod/.test(navigator.userAgent)===!1;return _.webkitSupportsPresentationMode&&typeof _.webkitSetPresentationMode=="function"&&a}function enableStubOn(_){return _}var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__getOwnPropNames$5=Object.getOwnPropertyNames,__hasOwnProp$5=Object.prototype.hasOwnProperty,__export$5=(_,a)=>{for(var $ in a)__defProp$5(_,$,{get:a[$],enumerable:!0})},__copyProps$5=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$5(a))!__hasOwnProp$5.call(_,et)&&et!==$&&__defProp$5(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$5(a,et))||j.enumerable});return _},__toCommonJS$5=_=>__copyProps$5(__defProp$5({},"__esModule",{value:!0}),_),patterns_exports={};__export$5(patterns_exports,{AUDIO_EXTENSIONS:()=>AUDIO_EXTENSIONS,DASH_EXTENSIONS:()=>DASH_EXTENSIONS,FLV_EXTENSIONS:()=>FLV_EXTENSIONS,HLS_EXTENSIONS:()=>HLS_EXTENSIONS,MATCH_URL_DAILYMOTION:()=>MATCH_URL_DAILYMOTION,MATCH_URL_FACEBOOK:()=>MATCH_URL_FACEBOOK,MATCH_URL_FACEBOOK_WATCH:()=>MATCH_URL_FACEBOOK_WATCH,MATCH_URL_KALTURA:()=>MATCH_URL_KALTURA,MATCH_URL_MIXCLOUD:()=>MATCH_URL_MIXCLOUD,MATCH_URL_MUX:()=>MATCH_URL_MUX,MATCH_URL_SOUNDCLOUD:()=>MATCH_URL_SOUNDCLOUD,MATCH_URL_STREAMABLE:()=>MATCH_URL_STREAMABLE,MATCH_URL_TWITCH_CHANNEL:()=>MATCH_URL_TWITCH_CHANNEL,MATCH_URL_TWITCH_VIDEO:()=>MATCH_URL_TWITCH_VIDEO,MATCH_URL_VIDYARD:()=>MATCH_URL_VIDYARD,MATCH_URL_VIMEO:()=>MATCH_URL_VIMEO,MATCH_URL_WISTIA:()=>MATCH_URL_WISTIA,MATCH_URL_YOUTUBE:()=>MATCH_URL_YOUTUBE,VIDEO_EXTENSIONS:()=>VIDEO_EXTENSIONS,canPlay:()=>canPlay});var patterns=__toCommonJS$5(patterns_exports),import_utils$3=utils$1;const MATCH_URL_YOUTUBE=/(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//,MATCH_URL_SOUNDCLOUD=/(?:soundcloud\.com|snd\.sc)\/[^.]+$/,MATCH_URL_VIMEO=/vimeo\.com\/(?!progressive_redirect).+/,MATCH_URL_MUX=/stream\.mux\.com\/(?!\w+\.m3u8)(\w+)/,MATCH_URL_FACEBOOK=/^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/,MATCH_URL_FACEBOOK_WATCH=/^https?:\/\/fb\.watch\/.+$/,MATCH_URL_STREAMABLE=/streamable\.com\/([a-z0-9]+)$/,MATCH_URL_WISTIA=/(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/,MATCH_URL_TWITCH_VIDEO=/(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/,MATCH_URL_TWITCH_CHANNEL=/(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/,MATCH_URL_DAILYMOTION=/^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?(?:[\w.#_-]+)?/,MATCH_URL_MIXCLOUD=/mixcloud\.com\/([^/]+\/[^/]+)/,MATCH_URL_VIDYARD=/vidyard.com\/(?:watch\/)?([a-zA-Z0-9-_]+)/,MATCH_URL_KALTURA=/^https?:\/\/[a-zA-Z]+\.kaltura.(com|org)\/p\/([0-9]+)\/sp\/([0-9]+)00\/embedIframeJs\/uiconf_id\/([0-9]+)\/partner_id\/([0-9]+)(.*)entry_id.([a-zA-Z0-9-_].*)$/,AUDIO_EXTENSIONS=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i,VIDEO_EXTENSIONS=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,HLS_EXTENSIONS=/\.(m3u8)($|\?)/i,DASH_EXTENSIONS=/\.(mpd)($|\?)/i,FLV_EXTENSIONS=/\.(flv)($|\?)/i,canPlayFile=_=>{if(_ instanceof Array){for(const a of _)if(typeof a=="string"&&canPlayFile(a)||canPlayFile(a.src))return!0;return!1}return(0,import_utils$3.isMediaStream)(_)||(0,import_utils$3.isBlobUrl)(_)?!0:AUDIO_EXTENSIONS.test(_)||VIDEO_EXTENSIONS.test(_)||HLS_EXTENSIONS.test(_)||DASH_EXTENSIONS.test(_)||FLV_EXTENSIONS.test(_)},canPlay={youtube:_=>_ instanceof Array?_.every(a=>MATCH_URL_YOUTUBE.test(a)):MATCH_URL_YOUTUBE.test(_),soundcloud:_=>MATCH_URL_SOUNDCLOUD.test(_)&&!AUDIO_EXTENSIONS.test(_),vimeo:_=>MATCH_URL_VIMEO.test(_)&&!VIDEO_EXTENSIONS.test(_)&&!HLS_EXTENSIONS.test(_),mux:_=>MATCH_URL_MUX.test(_),facebook:_=>MATCH_URL_FACEBOOK.test(_)||MATCH_URL_FACEBOOK_WATCH.test(_),streamable:_=>MATCH_URL_STREAMABLE.test(_),wistia:_=>MATCH_URL_WISTIA.test(_),twitch:_=>MATCH_URL_TWITCH_VIDEO.test(_)||MATCH_URL_TWITCH_CHANNEL.test(_),dailymotion:_=>MATCH_URL_DAILYMOTION.test(_),mixcloud:_=>MATCH_URL_MIXCLOUD.test(_),vidyard:_=>MATCH_URL_VIDYARD.test(_),kaltura:_=>MATCH_URL_KALTURA.test(_),file:canPlayFile};var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__getOwnPropNames$4=Object.getOwnPropertyNames,__hasOwnProp$4=Object.prototype.hasOwnProperty,__export$4=(_,a)=>{for(var $ in a)__defProp$4(_,$,{get:a[$],enumerable:!0})},__copyProps$4=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$4(a))!__hasOwnProp$4.call(_,et)&&et!==$&&__defProp$4(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$4(a,et))||j.enumerable});return _},__toCommonJS$4=_=>__copyProps$4(__defProp$4({},"__esModule",{value:!0}),_),players_exports={};__export$4(players_exports,{default:()=>players_default});var players=__toCommonJS$4(players_exports),import_utils$2=utils$1,import_patterns=patterns,players_default=[{key:"youtube",name:"YouTube",canPlay:import_patterns.canPlay.youtube,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./YouTube-Bn_mFI0y.js").then(_=>_.Y),[],import.meta.url))},{key:"soundcloud",name:"SoundCloud",canPlay:import_patterns.canPlay.soundcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./SoundCloud-Bnz9RCCy.js").then(_=>_.S),[],import.meta.url))},{key:"vimeo",name:"Vimeo",canPlay:import_patterns.canPlay.vimeo,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vimeo-CfDyl8un.js").then(_=>_.V),[],import.meta.url))},{key:"mux",name:"Mux",canPlay:import_patterns.canPlay.mux,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mux-QVBb5-ef.js").then(_=>_.M),[],import.meta.url))},{key:"facebook",name:"Facebook",canPlay:import_patterns.canPlay.facebook,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Facebook-vIG5NxSv.js").then(_=>_.F),[],import.meta.url))},{key:"streamable",name:"Streamable",canPlay:import_patterns.canPlay.streamable,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Streamable-Do3V8z4H.js").then(_=>_.S),[],import.meta.url))},{key:"wistia",name:"Wistia",canPlay:import_patterns.canPlay.wistia,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Wistia-CJTmCJvg.js").then(_=>_.W),[],import.meta.url))},{key:"twitch",name:"Twitch",canPlay:import_patterns.canPlay.twitch,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Twitch-41MSxuO7.js").then(_=>_.T),[],import.meta.url))},{key:"dailymotion",name:"DailyMotion",canPlay:import_patterns.canPlay.dailymotion,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./DailyMotion-CPDTQONs.js").then(_=>_.D),[],import.meta.url))},{key:"mixcloud",name:"Mixcloud",canPlay:import_patterns.canPlay.mixcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mixcloud-CX0bmbVQ.js").then(_=>_.M),[],import.meta.url))},{key:"vidyard",name:"Vidyard",canPlay:import_patterns.canPlay.vidyard,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vidyard-CaAeUx3d.js").then(_=>_.V),[],import.meta.url))},{key:"kaltura",name:"Kaltura",canPlay:import_patterns.canPlay.kaltura,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Kaltura-DkhvApaa.js").then(_=>_.K),[],import.meta.url))},{key:"file",name:"FilePlayer",canPlay:import_patterns.canPlay.file,canEnablePIP:_=>import_patterns.canPlay.file(_)&&(document.pictureInPictureEnabled||(0,import_utils$2.supportsWebKitPresentationMode)())&&!import_patterns.AUDIO_EXTENSIONS.test(_),lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./FilePlayer-U28waXko.js").then(_=>_.F),[],import.meta.url))}],safeIsNaN=Number.isNaN||function _(a){return typeof a=="number"&&a!==a};function isEqual(_,a){return!!(_===a||safeIsNaN(_)&&safeIsNaN(a))}function areInputsEqual(_,a){if(_.length!==a.length)return!1;for(var $=0;$<_.length;$++)if(!isEqual(_[$],a[$]))return!1;return!0}function memoizeOne(_,a){a===void 0&&(a=areInputsEqual);var $,j=[],et,tt=!1;function rt(){for(var nt=[],it=0;it{for(var $ in a)__defProp$3(_,$,{get:a[$],enumerable:!0})},__copyProps$3=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$3(a))!__hasOwnProp$3.call(_,et)&&et!==$&&__defProp$3(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$3(a,et))||j.enumerable});return _},__toESM$3=(_,a,$)=>($=_!=null?__create$3(__getProtoOf$3(_)):{},__copyProps$3(!_||!_.__esModule?__defProp$3($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$3=_=>__copyProps$3(__defProp$3({},"__esModule",{value:!0}),_),props_exports={};__export$3(props_exports,{defaultProps:()=>defaultProps,propTypes:()=>propTypes});var props=__toCommonJS$3(props_exports),import_prop_types=__toESM$3(propTypesExports);const{string,bool,number,array,oneOfType,shape,object,func,node}=import_prop_types.default,propTypes={url:oneOfType([string,array,object]),playing:bool,loop:bool,controls:bool,volume:number,muted:bool,playbackRate:number,width:oneOfType([string,number]),height:oneOfType([string,number]),style:object,progressInterval:number,playsinline:bool,pip:bool,stopOnUnmount:bool,light:oneOfType([bool,string,object]),playIcon:node,previewTabIndex:number,previewAriaLabel:string,fallback:node,oEmbedUrl:string,wrapper:oneOfType([string,func,shape({render:func.isRequired})]),config:shape({soundcloud:shape({options:object}),youtube:shape({playerVars:object,embedOptions:object,onUnstarted:func}),facebook:shape({appId:string,version:string,playerId:string,attributes:object}),dailymotion:shape({params:object}),vimeo:shape({playerOptions:object,title:string}),mux:shape({attributes:object,version:string}),file:shape({attributes:object,tracks:array,forceVideo:bool,forceAudio:bool,forceHLS:bool,forceSafariHLS:bool,forceDisableHls:bool,forceDASH:bool,forceFLV:bool,hlsOptions:object,hlsVersion:string,dashVersion:string,flvVersion:string}),wistia:shape({options:object,playerId:string,customControls:array}),mixcloud:shape({options:object}),twitch:shape({options:object,playerId:string}),vidyard:shape({options:object})}),onReady:func,onStart:func,onPlay:func,onPause:func,onBuffer:func,onBufferEnd:func,onEnded:func,onError:func,onDuration:func,onSeek:func,onPlaybackRateChange:func,onPlaybackQualityChange:func,onProgress:func,onClickPreview:func,onEnablePIP:func,onDisablePIP:func},noop$1=()=>{},defaultProps={playing:!1,loop:!1,controls:!1,volume:null,muted:!1,playbackRate:1,width:"640px",height:"360px",style:{},progressInterval:1e3,playsinline:!1,pip:!1,stopOnUnmount:!0,light:!1,fallback:null,wrapper:"div",previewTabIndex:0,previewAriaLabel:"",oEmbedUrl:"https://noembed.com/embed?url={url}",config:{soundcloud:{options:{visual:!0,buying:!1,liking:!1,download:!1,sharing:!1,show_comments:!1,show_playcount:!1}},youtube:{playerVars:{playsinline:1,showinfo:0,rel:0,iv_load_policy:3,modestbranding:1},embedOptions:{},onUnstarted:noop$1},facebook:{appId:"1309697205772819",version:"v3.3",playerId:null,attributes:{}},dailymotion:{params:{api:1,"endscreen-enable":!1}},vimeo:{playerOptions:{autopause:!1,byline:!1,portrait:!1,title:!1},title:null},mux:{attributes:{},version:"2"},file:{attributes:{},tracks:[],forceVideo:!1,forceAudio:!1,forceHLS:!1,forceDASH:!1,forceFLV:!1,hlsOptions:{},hlsVersion:"1.1.4",dashVersion:"3.1.3",flvVersion:"1.5.0",forceDisableHls:!1},wistia:{options:{},playerId:null,customControls:null},mixcloud:{options:{hide_cover:1}},twitch:{options:{},playerId:null},vidyard:{options:{}}},onReady:noop$1,onStart:noop$1,onPlay:noop$1,onPause:noop$1,onBuffer:noop$1,onBufferEnd:noop$1,onEnded:noop$1,onError:noop$1,onDuration:noop$1,onSeek:noop$1,onPlaybackRateChange:noop$1,onPlaybackQualityChange:noop$1,onProgress:noop$1,onClickPreview:noop$1,onEnablePIP:noop$1,onDisablePIP:noop$1};var __create$2=Object.create,__defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__getOwnPropNames$2=Object.getOwnPropertyNames,__getProtoOf$2=Object.getPrototypeOf,__hasOwnProp$2=Object.prototype.hasOwnProperty,__defNormalProp$1=(_,a,$)=>a in _?__defProp$2(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$,__export$2=(_,a)=>{for(var $ in a)__defProp$2(_,$,{get:a[$],enumerable:!0})},__copyProps$2=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$2(a))!__hasOwnProp$2.call(_,et)&&et!==$&&__defProp$2(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$2(a,et))||j.enumerable});return _},__toESM$2=(_,a,$)=>($=_!=null?__create$2(__getProtoOf$2(_)):{},__copyProps$2(!_||!_.__esModule?__defProp$2($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$2=_=>__copyProps$2(__defProp$2({},"__esModule",{value:!0}),_),__publicField$1=(_,a,$)=>(__defNormalProp$1(_,typeof a!="symbol"?a+"":a,$),$),Player_exports={};__export$2(Player_exports,{default:()=>Player});var Player_1=__toCommonJS$2(Player_exports),import_react$1=__toESM$2(reactExports),import_react_fast_compare$1=__toESM$2(reactFastCompare),import_props$1=props,import_utils$1=utils$1;const SEEK_ON_PLAY_EXPIRY=5e3;class Player extends import_react$1.Component{constructor(){super(...arguments),__publicField$1(this,"mounted",!1),__publicField$1(this,"isReady",!1),__publicField$1(this,"isPlaying",!1),__publicField$1(this,"isLoading",!0),__publicField$1(this,"loadOnReady",null),__publicField$1(this,"startOnPlay",!0),__publicField$1(this,"seekOnPlay",null),__publicField$1(this,"onDurationCalled",!1),__publicField$1(this,"handlePlayerMount",a=>{if(this.player){this.progress();return}this.player=a,this.player.load(this.props.url),this.progress()}),__publicField$1(this,"getInternalPlayer",a=>this.player?this.player[a]:null),__publicField$1(this,"progress",()=>{if(this.props.url&&this.player&&this.isReady){const a=this.getCurrentTime()||0,$=this.getSecondsLoaded(),j=this.getDuration();if(j){const et={playedSeconds:a,played:a/j};$!==null&&(et.loadedSeconds=$,et.loaded=$/j),(et.playedSeconds!==this.prevPlayed||et.loadedSeconds!==this.prevLoaded)&&this.props.onProgress(et),this.prevPlayed=et.playedSeconds,this.prevLoaded=et.loadedSeconds}}this.progressTimeout=setTimeout(this.progress,this.props.progressFrequency||this.props.progressInterval)}),__publicField$1(this,"handleReady",()=>{if(!this.mounted)return;this.isReady=!0,this.isLoading=!1;const{onReady:a,playing:$,volume:j,muted:et}=this.props;a(),!et&&j!==null&&this.player.setVolume(j),this.loadOnReady?(this.player.load(this.loadOnReady,!0),this.loadOnReady=null):$&&this.player.play(),this.handleDurationCheck()}),__publicField$1(this,"handlePlay",()=>{this.isPlaying=!0,this.isLoading=!1;const{onStart:a,onPlay:$,playbackRate:j}=this.props;this.startOnPlay&&(this.player.setPlaybackRate&&j!==1&&this.player.setPlaybackRate(j),a(),this.startOnPlay=!1),$(),this.seekOnPlay&&(this.seekTo(this.seekOnPlay),this.seekOnPlay=null),this.handleDurationCheck()}),__publicField$1(this,"handlePause",a=>{this.isPlaying=!1,this.isLoading||this.props.onPause(a)}),__publicField$1(this,"handleEnded",()=>{const{activePlayer:a,loop:$,onEnded:j}=this.props;a.loopOnEnded&&$&&this.seekTo(0),$||(this.isPlaying=!1,j())}),__publicField$1(this,"handleError",(...a)=>{this.isLoading=!1,this.props.onError(...a)}),__publicField$1(this,"handleDurationCheck",()=>{clearTimeout(this.durationCheckTimeout);const a=this.getDuration();a?this.onDurationCalled||(this.props.onDuration(a),this.onDurationCalled=!0):this.durationCheckTimeout=setTimeout(this.handleDurationCheck,100)}),__publicField$1(this,"handleLoaded",()=>{this.isLoading=!1})}componentDidMount(){this.mounted=!0}componentWillUnmount(){clearTimeout(this.progressTimeout),clearTimeout(this.durationCheckTimeout),this.isReady&&this.props.stopOnUnmount&&(this.player.stop(),this.player.disablePIP&&this.player.disablePIP()),this.mounted=!1}componentDidUpdate(a){if(!this.player)return;const{url:$,playing:j,volume:et,muted:tt,playbackRate:rt,pip:nt,loop:it,activePlayer:ot,disableDeferredLoading:st}=this.props;if(!(0,import_react_fast_compare$1.default)(a.url,$)){if(this.isLoading&&!ot.forceLoad&&!st&&!(0,import_utils$1.isMediaStream)($)){console.warn(`ReactPlayer: the attempt to load ${$} is being deferred until the player has loaded`),this.loadOnReady=$;return}this.isLoading=!0,this.startOnPlay=!0,this.onDurationCalled=!1,this.player.load($,this.isReady)}!a.playing&&j&&!this.isPlaying&&this.player.play(),a.playing&&!j&&this.isPlaying&&this.player.pause(),!a.pip&&nt&&this.player.enablePIP&&this.player.enablePIP(),a.pip&&!nt&&this.player.disablePIP&&this.player.disablePIP(),a.volume!==et&&et!==null&&this.player.setVolume(et),a.muted!==tt&&(tt?this.player.mute():(this.player.unmute(),et!==null&&setTimeout(()=>this.player.setVolume(et)))),a.playbackRate!==rt&&this.player.setPlaybackRate&&this.player.setPlaybackRate(rt),a.loop!==it&&this.player.setLoop&&this.player.setLoop(it)}getDuration(){return this.isReady?this.player.getDuration():null}getCurrentTime(){return this.isReady?this.player.getCurrentTime():null}getSecondsLoaded(){return this.isReady?this.player.getSecondsLoaded():null}seekTo(a,$,j){if(!this.isReady){a!==0&&(this.seekOnPlay=a,setTimeout(()=>{this.seekOnPlay=null},SEEK_ON_PLAY_EXPIRY));return}if($?$==="fraction":a>0&&a<1){const tt=this.player.getDuration();if(!tt){console.warn("ReactPlayer: could not seek using fraction – duration not yet available");return}this.player.seekTo(tt*a,j);return}this.player.seekTo(a,j)}render(){const a=this.props.activePlayer;return a?import_react$1.default.createElement(a,{...this.props,onMount:this.handlePlayerMount,onReady:this.handleReady,onPlay:this.handlePlay,onPause:this.handlePause,onEnded:this.handleEnded,onLoaded:this.handleLoaded,onError:this.handleError}):null}}__publicField$1(Player,"displayName","Player");__publicField$1(Player,"propTypes",import_props$1.propTypes);__publicField$1(Player,"defaultProps",import_props$1.defaultProps);var __create$1=Object.create,__defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__getOwnPropNames$1=Object.getOwnPropertyNames,__getProtoOf$1=Object.getPrototypeOf,__hasOwnProp$1=Object.prototype.hasOwnProperty,__defNormalProp=(_,a,$)=>a in _?__defProp$1(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$,__export$1=(_,a)=>{for(var $ in a)__defProp$1(_,$,{get:a[$],enumerable:!0})},__copyProps$1=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$1(a))!__hasOwnProp$1.call(_,et)&&et!==$&&__defProp$1(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$1(a,et))||j.enumerable});return _},__toESM$1=(_,a,$)=>($=_!=null?__create$1(__getProtoOf$1(_)):{},__copyProps$1(!_||!_.__esModule?__defProp$1($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$1=_=>__copyProps$1(__defProp$1({},"__esModule",{value:!0}),_),__publicField=(_,a,$)=>(__defNormalProp(_,typeof a!="symbol"?a+"":a,$),$),ReactPlayer_exports={};__export$1(ReactPlayer_exports,{createReactPlayer:()=>createReactPlayer});var ReactPlayer$1=__toCommonJS$1(ReactPlayer_exports),import_react=__toESM$1(reactExports),import_deepmerge=__toESM$1(cjs),import_memoize_one=__toESM$1(require$$2),import_react_fast_compare=__toESM$1(reactFastCompare),import_props=props,import_utils=utils$1,import_Player=__toESM$1(Player_1);const Preview=(0,import_utils.lazy)(()=>__vitePreload(()=>import("./Preview-BCVJrb-Y.js").then(_=>_.P),[],import.meta.url)),IS_BROWSER=typeof window<"u"&&window.document&&typeof document<"u",IS_GLOBAL=typeof commonjsGlobal<"u"&&commonjsGlobal.window&&commonjsGlobal.window.document,SUPPORTED_PROPS=Object.keys(import_props.propTypes),UniversalSuspense=IS_BROWSER||IS_GLOBAL?import_react.Suspense:()=>null,customPlayers=[],createReactPlayer=(_,a)=>{var $;return $=class extends import_react.Component{constructor(){super(...arguments),__publicField(this,"state",{showPreview:!!this.props.light}),__publicField(this,"references",{wrapper:j=>{this.wrapper=j},player:j=>{this.player=j}}),__publicField(this,"handleClickPreview",j=>{this.setState({showPreview:!1}),this.props.onClickPreview(j)}),__publicField(this,"showPreview",()=>{this.setState({showPreview:!0})}),__publicField(this,"getDuration",()=>this.player?this.player.getDuration():null),__publicField(this,"getCurrentTime",()=>this.player?this.player.getCurrentTime():null),__publicField(this,"getSecondsLoaded",()=>this.player?this.player.getSecondsLoaded():null),__publicField(this,"getInternalPlayer",(j="player")=>this.player?this.player.getInternalPlayer(j):null),__publicField(this,"seekTo",(j,et,tt)=>{if(!this.player)return null;this.player.seekTo(j,et,tt)}),__publicField(this,"handleReady",()=>{this.props.onReady(this)}),__publicField(this,"getActivePlayer",(0,import_memoize_one.default)(j=>{for(const et of[...customPlayers,..._])if(et.canPlay(j))return et;return a||null})),__publicField(this,"getConfig",(0,import_memoize_one.default)((j,et)=>{const{config:tt}=this.props;return import_deepmerge.default.all([import_props.defaultProps.config,import_props.defaultProps.config[et]||{},tt,tt[et]||{}])})),__publicField(this,"getAttributes",(0,import_memoize_one.default)(j=>(0,import_utils.omit)(this.props,SUPPORTED_PROPS))),__publicField(this,"renderActivePlayer",j=>{if(!j)return null;const et=this.getActivePlayer(j);if(!et)return null;const tt=this.getConfig(j,et.key);return import_react.default.createElement(import_Player.default,{...this.props,key:et.key,ref:this.references.player,config:tt,activePlayer:et.lazyPlayer||et,onReady:this.handleReady})})}shouldComponentUpdate(j,et){return!(0,import_react_fast_compare.default)(this.props,j)||!(0,import_react_fast_compare.default)(this.state,et)}componentDidUpdate(j){const{light:et}=this.props;!j.light&&et&&this.setState({showPreview:!0}),j.light&&!et&&this.setState({showPreview:!1})}renderPreview(j){if(!j)return null;const{light:et,playIcon:tt,previewTabIndex:rt,oEmbedUrl:nt,previewAriaLabel:it}=this.props;return import_react.default.createElement(Preview,{url:j,light:et,playIcon:tt,previewTabIndex:rt,previewAriaLabel:it,oEmbedUrl:nt,onClick:this.handleClickPreview})}render(){const{url:j,style:et,width:tt,height:rt,fallback:nt,wrapper:it}=this.props,{showPreview:ot}=this.state,st=this.getAttributes(j),ct=typeof it=="string"?this.references.wrapper:void 0;return import_react.default.createElement(it,{ref:ct,style:{...et,width:tt,height:rt},...st},import_react.default.createElement(UniversalSuspense,{fallback:nt},ot?this.renderPreview(j):this.renderActivePlayer(j)))}},__publicField($,"displayName","ReactPlayer"),__publicField($,"propTypes",import_props.propTypes),__publicField($,"defaultProps",import_props.defaultProps),__publicField($,"addCustomPlayer",j=>{customPlayers.push(j)}),__publicField($,"removeCustomPlayers",()=>{customPlayers.length=0}),__publicField($,"canPlay",j=>{for(const et of[...customPlayers,..._])if(et.canPlay(j))return!0;return!1}),__publicField($,"canEnablePIP",j=>{for(const et of[...customPlayers,..._])if(et.canEnablePIP&&et.canEnablePIP(j))return!0;return!1}),$};var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(_,a)=>{for(var $ in a)__defProp(_,$,{get:a[$],enumerable:!0})},__copyProps=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames(a))!__hasOwnProp.call(_,et)&&et!==$&&__defProp(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc(a,et))||j.enumerable});return _},__toESM=(_,a,$)=>($=_!=null?__create(__getProtoOf(_)):{},__copyProps(!_||!_.__esModule?__defProp($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS=_=>__copyProps(__defProp({},"__esModule",{value:!0}),_),src_exports={};__export(src_exports,{default:()=>src_default});var lib$1=__toCommonJS(src_exports),import_players=__toESM(players),import_ReactPlayer=ReactPlayer$1;const fallback=import_players.default[import_players.default.length-1];var src_default=(0,import_ReactPlayer.createReactPlayer)(import_players.default,fallback);const ReactPlayer=getDefaultExportFromCjs$1(lib$1),AttributesAccordionItem=({nft:_,style:a})=>{const $=_.metadata.attributes;return!$||$.length===0?null:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],"data-testid":"attributes-section",style:a,children:[jsxRuntimeExports.jsxs(AccordionButton,{paddingY:"16px",children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",size:"md",children:"Attributes"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(Wrap,{marginLeft:"0",spacing:"10px",children:$.map(j=>jsxRuntimeExports.jsx(WrapItem,{flex:"1","data-testid":"nft-attribute",children:jsxRuntimeExports.jsx(Card,{width:"160px",height:"128px",marginBottom:"2px",background:colors.gray[700],children:jsxRuntimeExports.jsxs(CardBody,{padding:"16px",children:[jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:j.name}),jsxRuntimeExports.jsx(Heading,{size:"md",children:j.value})]})})},j.name))})})]})},TruncatedTextWithTooltip=({text:_,maxLength:a})=>_.length<=a?jsxRuntimeExports.jsx(Text,{"data-testid":"truncated-text",children:_}):jsxRuntimeExports.jsx(Tooltip,{label:_,children:jsxRuntimeExports.jsx(Text,{"data-testid":"truncated-text",children:truncate(_,a)})}),TzktLink=({url:_,...a})=>jsxRuntimeExports.jsx("a",{"data-testid":"tzkt-link",href:_,rel:"noopener noreferrer",target:"_blank",children:jsxRuntimeExports.jsx(WindowLinkIcon,{...a})}),CreatorElement=({nft:_})=>{if(!_.metadata.creators||_.metadata.creators.length===0)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"-"});const a=_.metadata.creators[0];return a.startsWith("tz")?jsxRuntimeExports.jsx(AddressPill,{marginRight:1,address:parsePkh(a)}):jsxRuntimeExports.jsx(TruncatedTextWithTooltip,{maxLength:15,text:a})},PropertiesAccordionItem=({nft:_,style:a})=>{const $=royalties(_),j=$.reduce((tt,rt)=>tt+rt.share,0).toFixed(2),et=useSelectedNetwork();return jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],style:a,children:[jsxRuntimeExports.jsxs(AccordionButton,{paddingY:"16px",children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",size:"md",children:"Properties"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(TableContainer,{children:jsxRuntimeExports.jsx(Table,{variant:"stripped",children:jsxRuntimeExports.jsxs(Tbody,{fontSize:"14px",children:[jsxRuntimeExports.jsxs(Tr,{background:colors.gray[900],borderColor:colors.gray[700],borderBottomWidth:"1px",borderRadius:"8px",children:[jsxRuntimeExports.jsx(Td,{width:"20%",padding:"16px 0 16px 15px",paddingRight:"0",color:colors.gray[400],borderTopLeftRadius:"8px","data-testid":"nft-editions",children:"Editions:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px","data-testid":"nft-editions-value",children:_.totalSupply||"?"}),jsxRuntimeExports.jsx(Td,{width:"20%",padding:"16px 0 16px 15px",color:colors.gray[400],children:"Token ID:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px",borderTopRightRadius:"8px",children:_.tokenId})]}),jsxRuntimeExports.jsxs(Tr,{background:colors.gray[800],borderColor:colors.gray[700],borderBottomWidth:"1px",children:[jsxRuntimeExports.jsxs(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],"data-testid":"nft-royalty",children:["Royalties",$.length>1?" ("+$.length+")":"",":"]}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px","data-testid":"nft-royalty-value",children:$.length>0?j+"%":"-"}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],"data-testid":"nft-mime",children:"MIME type:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px","data-testid":"nft-mime-value",children:mimeType(_)||"-"})]}),jsxRuntimeExports.jsxs(Tr,{background:colors.gray[900],borderColor:colors.gray[700],borderBottomWidth:"1px",children:[jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],children:"Contract:"}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px",children:jsxRuntimeExports.jsx(AddressPill,{marginRight:1,address:parsePkh(_.contract)})}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],children:"Metadata:"}),jsxRuntimeExports.jsxs(Td,{width:"30%",padding:"16px 0 16px 5px",children:["TzKT ",jsxRuntimeExports.jsx(TzktLink,{url:metadataUri(_,et)})]})]}),jsxRuntimeExports.jsxs(Tr,{background:colors.gray[800],borderColor:colors.gray[700],borderBottomWidth:"1px",children:[jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],"data-testid":"nft-creator",children:"Creator:"}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px","data-testid":"nft-creator-value",children:jsxRuntimeExports.jsx(CreatorElement,{nft:_})}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],children:"License:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px",children:jsxRuntimeExports.jsx(TruncatedTextWithTooltip,{maxLength:15,text:_.metadata.rights||"-"})})]})]})})})})]})},TagsSection=({nft:_})=>{const a=_.metadata.tags;return!a||a.length===0?null:jsxRuntimeExports.jsx(Wrap,{marginTop:"20px","data-testid":"tags-section",children:a.map($=>jsxRuntimeExports.jsx(WrapItem,{padding:"3px 8px",background:colors.gray[600],borderRadius:"100px",children:jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-tag",children:$})},$))})},SendNFTRecapTile=({nft:_})=>{const a=getIPFSurl(thumbnailUri(_)),$=getIPFSurl(_.displayUri);return jsxRuntimeExports.jsx(Box,{width:"100%","aria-label":"nft",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"60px",padding:3,background:colors.gray[800],borderRadius:"4px","data-testid":"nft-name",children:[jsxRuntimeExports.jsx(AspectRatio,{width:"30px",height:"30px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{fallbackSrc:$,src:a})}),_.metadata.name&&jsxRuntimeExports.jsx(Heading,{marginLeft:4,size:"sm",children:truncate(_.metadata.name,45)})]})})},SignPage$1=_=>{const{mode:a,operations:$,data:{nft:j}}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:ot,reEstimate:st,onSign:ct}=useSignPageHelpers($,a),{recipient:ut}=tt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:tt.type,signer:tt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Flex,{marginBottom:"12px",children:jsxRuntimeExports.jsx(SendNFTRecapTile,{nft:j})}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",marginY:"12px",paddingX:"4px",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Owned:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-owned",size:"sm",children:j.balance})]}),jsxRuntimeExports.jsx(SignPageFee,{fee:et})]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"12px",marginBottom:"24px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"12px",size:"md",children:"Quantity:"}),jsxRuntimeExports.jsx(Center,{width:"100px",height:"48px",background:colors.gray[800],borderRadius:"4px",children:jsxRuntimeExports.jsxs(Text,{textAlign:"center",children:[tt.operations[0].amount," out of ",j.balance]})})]}),jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{marginBottom:"24px",address:tt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:ut}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:nt,operationType:tt.type,reEstimate:st,sender:tt.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:ct,signer:ot,text:headerText(tt.type,a)})})]})})})},FormPage$1=_=>{const{nft:a}=_,$=useOpenSignPageFormAction({SignPage:SignPage$1,signPageExtraData:{nft:a},FormPage:FormPage$1,defaultFormPageProps:_,toOperation:toOperation$1(a)}),j=useAddToBatchFormAction(toOperation$1(a)),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:{quantity:1,...formDefaultValues(_)}}),{formState:{isValid:it,errors:ot},register:st,handleSubmit:ct}=nt;return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(FormPageHeader,{}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Flex,{marginBottom:"12px",children:jsxRuntimeExports.jsx(SendNFTRecapTile,{nft:_.nft})}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Owned:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-owned",size:"sm",children:a.balance})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.quantity,children:[jsxRuntimeExports.jsx(FormLabel,{children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"8px",size:"md",children:"Quantity:"}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(InputGroup,{width:"75px",children:jsxRuntimeExports.jsx(Input,{width:"60px",color:"white","data-testid":"quantity-input",step:1,type:"number",...st("quantity",{required:"Quantity is required",max:{value:a.balance,message:`Max quantity is ${a.balance}`},min:{value:1,message:"Min quantity is 1"}})})}),jsxRuntimeExports.jsxs(Text,{"data-testid":"out-of-nft",children:["out of ",a.balance]})]})]})}),ot.quantity&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"quantity-error",children:ot.quantity.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),ot.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:ot.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ct(tt),onSingleSubmit:ct(et)})})]})})})},toOperation$1=_=>a=>({type:"fa2",sender:parsePkh(a.sender),recipient:parsePkh(a.recipient),contract:parseContractPkh(_.contract),tokenId:_.tokenId,amount:a.quantity.toString()}),NFTDrawerCard=({nft:_})=>{var it;const a=getIPFSurl(artifactUri(_)),$=getIPFSurl(_.displayUri),j=useGetOwnedAccount(),{openWith:et}=reactExports.useContext(DynamicModalContext),tt=(it=mimeType(_))==null?void 0:it.startsWith("video/"),rt=tokenName(_),nt={border:"none",borderRadius:"8px",marginBottom:"20px"};return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Card,{width:"534px",height:"534px",background:colors.gray[800],children:jsxRuntimeExports.jsxs(CardBody,{padding:"24px",children:[jsxRuntimeExports.jsx(Box,{position:"relative",width:"486px",height:"486px",children:tt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Box,{position:"absolute",zIndex:1,width:"486px",height:"486px",children:jsxRuntimeExports.jsx(ReactPlayer,{width:"100%",height:"100%",loop:!0,playing:!0,url:a})}),jsxRuntimeExports.jsx(Image$1,{position:"absolute",zIndex:0,top:"0",width:"486px",height:"486px",objectFit:"contain",alt:rt,filter:"blur(20px)",src:$})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Image$1,{position:"absolute",zIndex:1,width:"486px",height:"486px",objectFit:"contain",alt:rt,fallbackSrc:$,src:a}),jsxRuntimeExports.jsx(Image$1,{position:"absolute",zIndex:0,top:"0",width:"486px",height:"486px",objectFit:"contain",alt:rt,"data-testid":"nft-image",fallbackSrc:$,filter:"blur(20px)",src:a})]})}),Number(_.balance)>1&&jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:3,display:"inline",height:"24px",marginTop:"-38px",marginLeft:"16px",borderRadius:"100px",backgroundColor:"rgba(33, 33, 33, 0.75)","data-testid":"nft-owned-count",paddingX:"8px",children:"x"+_.balance})]})}),jsxRuntimeExports.jsx(TagsSection,{nft:_}),rt&&jsxRuntimeExports.jsx(Heading,{marginTop:"16px",marginBottom:"14px","data-testid":"nft-name",size:"lg",children:rt}),_.metadata.description&&jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-description",size:"sm",children:_.metadata.description}),jsxRuntimeExports.jsx(Button,{marginTop:"20px",onClick:()=>et(jsxRuntimeExports.jsx(FormPage$1,{nft:_,sender:j(_.owner)})),children:"Send"}),jsxRuntimeExports.jsxs(Accordion,{marginTop:"32px",allowMultiple:!0,children:[jsxRuntimeExports.jsx(AttributesAccordionItem,{nft:_,style:nt}),jsxRuntimeExports.jsx(PropertiesAccordionItem,{nft:_,style:nt}),jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],style:nt,children:[jsxRuntimeExports.jsxs(AccordionButton,{paddingY:"16px",children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",size:"md",children:"JSON"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(JsValueWrap,{value:_})})]})]})]})},NFTDrawerBody=({nft:_,onCloseDrawer:a})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",paddingBottom:"22px",color:colors.gray[400],"data-testid":"nft-drawer-body",children:[jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.owner)}),jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:a})]}),jsxRuntimeExports.jsx(NFTDrawerCard,{nft:_})]}),AccountListWithDrawer=()=>{const[_,a]=reactExports.useState(null),{ownerPkh:$,nftId:j}=useParams(),et=useAllNfts(),tt=$&&lodashExports.get(et,[$],[]).find(ht=>fullId(ht)===j),rt=!!tt,{isOpen:nt,onOpen:it,onClose:ot}=useDisclosure$1({defaultIsOpen:rt}),st=useNavigate(),ct=reactExports.useCallback(()=>{a(null),ot(),st("/home")},[ot,st]);reactExports.useEffect(()=>{const ht=Et=>{Et.key==="Escape"&&ct()};return document.addEventListener("keydown",ht),()=>document.removeEventListener("keydown",ht)},[ct]);const ut=reactExports.useMemo(()=>({selectedAccount:_,selectAccount:ht=>{a(ht),it()}}),[_,it]);return jsxRuntimeExports.jsxs(SelectedAccountContext.Provider,{value:ut,children:[jsxRuntimeExports.jsx(AccountsList,{}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:nt,onClose:ct,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsxs(DrawerContent,{children:[rt&&jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(NFTDrawerBody,{nft:{...tt,owner:$},onCloseDrawer:ct})}),!rt&&_&&jsxRuntimeExports.jsxs(ModalBody,{overflow:"hidden",overflowY:"scroll",paddingRight:"0",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"flex-end",width:"100%",paddingRight:"24px",children:[jsxRuntimeExports.jsx(DerivationInfoButton,{marginRight:"5px",account:_}),jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:ct})]}),jsxRuntimeExports.jsx(AccountCard,{accountPkh:_.address.pkh})]})]})]})]})},HomeView=()=>jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Accounts"}),jsxRuntimeExports.jsx(Flex,{flex:1,minHeight:1,children:jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",flex:1,marginRight:"12px",paddingBottom:"12px",children:[jsxRuntimeExports.jsx(AccountListHeader,{}),jsxRuntimeExports.jsx(Box,{flex:1,overflow:"hidden",borderRadius:"8px",children:jsxRuntimeExports.jsx(AccountListWithDrawer,{})})]})})]}),SelectedNFTContext=reactExports.createContext({selectedNFT:void 0,setSelectedNFT:_=>{}}),NFTCard=({nft:_})=>{const{selectedNFT:a,setSelectedNFT:$}=reactExports.useContext(SelectedNFTContext),j=getIPFSurl(thumbnailUri(_)),et=getIPFSurl(_.displayUri),tt=_.metadata.name,rt={width:"100%",minWidth:"242px",minHeight:"242px",objectFit:"contain",aspectRatio:"1",fallbackSrc:et,src:j},nt=a&&fullId(a)===fullId(_)&&a.owner===_.owner;return jsxRuntimeExports.jsx(Card,{minWidth:"274px",borderRadius:"8px",cursor:"pointer","data-testid":`nft-card${nt?"-selected":""}`,onClick:()=>$(_),children:jsxRuntimeExports.jsxs(CardBody,{padding:"16px",background:colors.gray[900],border:"1px solid",borderColor:nt?colors.orangeL:"transparent",borderRadius:"8px",_hover:{background:colors.gray[700],borderColor:colors.gray[500]},children:[jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsxs(Box,{position:"relative",width:"100%",children:[jsxRuntimeExports.jsx(Image$1,{...rt,zIndex:2,opacity:"0"}),jsxRuntimeExports.jsx(Image$1,{...rt,position:"absolute",zIndex:0,top:"0",filter:"blur(20px)"}),jsxRuntimeExports.jsx(Image$1,{...rt,position:"absolute",zIndex:1,top:"0","data-testid":"nft-image"})]})}),Number(_.balance)>1&&jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:3,display:"inline",height:"24px",marginTop:"-36px",marginLeft:"10px",paddingTop:"1px",fontSize:"14px",borderRadius:"full",backgroundColor:"rgba(33, 33, 33, 0.75)","data-testid":"nft-owned-count",paddingX:"8px",children:"x"+_.balance}),jsxRuntimeExports.jsx(Box,{overflow:"hidden","data-testid":"nft-card-name",children:jsxRuntimeExports.jsx(Heading,{overflow:"hidden",marginTop:"15px",marginBottom:"8px",fontSize:"sm",whiteSpace:"nowrap",textOverflow:"ellipsis",children:tt})}),jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.owner)})]})})},NFTGallery=({nftsByOwner:_})=>{const a=Object.entries(_).flatMap(([j,et])=>(et||[]).map(tt=>({owner:j,...tt})));let $="repeat(auto-fit, minmax(min(100%/2, max(274px, 100%/7)), 1fr))";return a.length<3&&($=`repeat(auto-fit, min(100% / ${a.length} - 16px, 450px))`),jsxRuntimeExports.jsx(SimpleGrid,{gridTemplateColumns:$,marginBottom:"16px",minChildWidth:"340px",spacing:"16px",children:sortedByLastUpdate(a).map(j=>jsxRuntimeExports.jsx(NFTCard,{nft:j},`${j.owner}:${fullId(j)}`))})},AccountListDisplay=({accounts:_,onSelect:a})=>jsxRuntimeExports.jsx(MenuList,{zIndex:"docked",overflowY:"scroll",maxHeight:"300px",padding:0,background:colors.gray[900],children:_.map($=>jsxRuntimeExports.jsx(MenuItem$1,{width:"100%",minHeight:"48px",padding:"5px",background:colors.gray[700],"aria-label":$.label,onClick:()=>{a($)},value:$.address.pkh,children:jsxRuntimeExports.jsx(AddressTile,{width:"370px",height:"40px",padding:"5px",background:colors.gray[700],borderRadius:"4px",_hover:{background:colors.gray[500]},cursor:"pointer",address:$.address})},$.address.pkh))}),useAccountsFilter=()=>{const _=useAllAccounts(),[a]=reactExports.useState(_),[$,j]=useSearchParams(),et=$.getAll("accounts"),[tt,rt]=reactExports.useState(et.length===0),[nt,it]=reactExports.useState(_.filter(ct=>et.includes(ct.address.pkh))),ot=lodashExports.differenceBy(_,nt,ct=>ct.address.pkh),st=nt.length===_.length;return reactExports.useEffect(()=>{j(ct=>({...ct,accounts:nt.map(ut=>ut.address.pkh)}))},[nt,j]),{selectedAccounts:tt?a:nt,accountsFilter:jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(Box,{alignSelf:"flex-start",children:jsxRuntimeExports.jsxs(Menu,{children:[jsxRuntimeExports.jsx(MenuButton,{as:Button,maxHeight:"26px",paddingLeft:0,fontWeight:"normal",_hover:{bg:"none"},_active:{bg:"none"},"data-testid":"account-filter",isDisabled:st,marginY:"16px",rightIcon:jsxRuntimeExports.jsx(ChevronDownIcon,{}),variant:"ghost",children:"Filter by Account"}),jsxRuntimeExports.jsx(AccountListDisplay,{accounts:ot,onSelect:ct=>{rt(!1),it(ut=>[...ut,ct])}})]})}),jsxRuntimeExports.jsx(Wrap,{width:"100%",children:nt.map(ct=>jsxRuntimeExports.jsx(AddressPill,{address:ct.address,"data-testid":"account-pill",mode:{type:"removable",onRemove:()=>{rt(nt.length===1),it(ut=>ut.filter(ht=>ht.address.pkh!==ct.address.pkh))}}},ct.address.pkh))})]})}},NFTsView=()=>{const _=useAllNfts(),{accountsFilter:a,selectedAccounts:$}=useAccountsFilter(),[j,et]=reactExports.useState(void 0);reactExports.useEffect(()=>{const it=ot=>{ot.key==="Escape"&&et(void 0)};return document.addEventListener("keydown",it),()=>document.removeEventListener("keydown",it)},[]);const tt=lodashExports.pick(_,$.map(it=>it.address.pkh)),rt=lodashExports.sumBy(Object.values(tt).flat(),it=>Number((it==null?void 0:it.balance)||0)),nt=lodashExports.every(tt,it=>!it||it.length===0);return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{subtitle:`(${rt})`,title:"NFTs"}),a,nt?jsxRuntimeExports.jsx(NoNFTs,{size:"lg"}):jsxRuntimeExports.jsxs(SelectedNFTContext.Provider,{value:{setSelectedNFT:et,selectedNFT:j},children:[jsxRuntimeExports.jsx(Box,{overflowY:"scroll",children:jsxRuntimeExports.jsx(NFTGallery,{nftsByOwner:tt})}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:!!j,onClose:()=>et(void 0),placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsx(ModalBody,{children:j&&jsxRuntimeExports.jsx(NFTDrawerBody,{nft:j,onCloseDrawer:()=>et(void 0)})})})]})]})]})},OperationsView=()=>{const{accountsFilter:_,selectedAccounts:a}=useAccountsFilter(),{operations:$,loadMore:j,hasMore:et,isLoading:tt,isFirstLoad:rt}=useGetOperations(a),nt=reactExports.useRef(!1),it=ot=>{if(nt.current||!et||tt)return;const st=ot.target;if(st.scrollHeight-st.scrollTop-st.clientHeight<100)return nt.current=!0,j().finally(()=>{nt.current=!1})};return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Operations"}),_,jsxRuntimeExports.jsx(Center,{display:tt&&rt?"flex":"none",height:"100%",children:jsxRuntimeExports.jsx(Image$1,{width:"150px",height:"75px",marginBottom:"136px",src:"./static/media/loading-wheel.gif"})}),$.length===0&&!tt&&jsxRuntimeExports.jsx(NoOperations,{size:"lg"}),$.length>0&&jsxRuntimeExports.jsxs(Box,{overflowY:"scroll",marginBottom:"20px",background:colors.gray[900],borderRadius:"8px",onScroll:it,paddingX:"20px",children:[jsxRuntimeExports.jsx(OperationTileContext.Provider,{value:{mode:"page"},children:$.map((ot,st)=>{const ct=st===$.length-1;return jsxRuntimeExports.jsxs(Box,{height:"90px",marginBottom:ct?"10px":0,paddingY:"20px",children:[jsxRuntimeExports.jsx(OperationTile,{operation:ot}),!ct&&jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(Divider,{marginTop:"20px"})})]},ot.id)})}),jsxRuntimeExports.jsxs(Center,{flexDirection:"column",display:tt&&!rt?"flex":"none",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Image$1,{width:"100px",height:"50px",src:"./static/media/loading-dots.gif"})]})]})]})},DrawerTopButtons=({onClose:_,...a})=>jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",paddingBottom:"30px",cursor:"pointer",...a,children:jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:_})}),BeaconPeers=()=>{const _=usePeers(),[a,$]=reactExports.useState([]);return reactExports.useEffect(()=>{const j=_.map(async et=>({...et,senderId:et.senderId||await getSenderId(et.publicKey)}));Promise.all(j).then($).catch(lodashExports.noop)},[_]),a.length===0?jsxRuntimeExports.jsxs(Box,{"data-testid":"beacon-peers-empty",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Text,{marginTop:"31px",color:colors.gray[400],size:"lg",children:"Your dApps will appear here"})]}):jsxRuntimeExports.jsx(PeersDisplay,{"data-testid":"beacon-peers",peerInfos:a})},PeersDisplay=({peerInfos:_})=>jsxRuntimeExports.jsx(Box,{children:_.map(a=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(PeerRow,{peerInfo:a})]},a.senderId))}),PeerRow=({peerInfo:_})=>{const a=useRemovePeer();return jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",height:"106px","data-testid":"peer-row",paddingY:"30px",children:[jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(AspectRatio,{width:"48px",marginRight:"16px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{width:"100%",src:_.icon})}),jsxRuntimeExports.jsxs(Center,{alignItems:"flex-start",flexDirection:"column",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"6px",size:"md",children:_.name}),jsxRuntimeExports.jsx(StoredPeerInfo,{peerInfo:_})]})]}),jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsx(IconButton,{"aria-label":"Remove Peer",icon:jsxRuntimeExports.jsx(TrashIcon,{}),onClick:()=>a(_),size:"xs",variant:"circle"})})]})},StoredPeerInfo=({peerInfo:_})=>{const a=useGetConnectionInfo(_.senderId);return a?jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(AddressPill,{marginRight:"10px",address:parsePkh(a.accountPkh)}),jsxRuntimeExports.jsx(Divider,{marginRight:"10px",orientation:"vertical"}),jsxRuntimeExports.jsx(Text,{marginTop:"2px",marginRight:"4px",color:colors.gray[450],fontWeight:650,size:"sm",children:"Network:"}),jsxRuntimeExports.jsx(Text,{marginTop:"2px",color:colors.white,"data-testid":"dapp-connection-network",size:"sm",children:lodashExports.capitalize(a.networkType)})]}):null},DAppsDrawerCard=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1(),j=useAddPeer();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"dApps",isSelected:_,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:_,onClose:a,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{"data-testid":"drawer-body",children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:a}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",height:"96px",children:jsxRuntimeExports.jsx(Heading,{children:"dApps"})}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.readText().then(et=>j(et)),children:"Connect with Pairing Request"}),jsxRuntimeExports.jsx(Text,{marginTop:"16px",marginBottom:"32px",color:colors.gray[400],children:"or open a deeplink from inside the dApp..."}),jsxRuntimeExports.jsx(BeaconPeers,{})]})]})})]})]})},ErrorLogsDrawerCard=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Error Logs",isSelected:_,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{blockScrollOnMount:!1,isOpen:_,onClose:a,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:a}),jsxRuntimeExports.jsx(ErrorLogsDrawerBody,{})]})})]})]})},ErrorLogsDrawerBody=()=>{const _=[...useAppSelector(j=>j.errors)].reverse(),a=useDispatch(),$=()=>{a(errorsSlice.actions.reset())};return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",height:"50px",marginBottom:"20px",children:[jsxRuntimeExports.jsx(Heading,{size:"xl",children:"Error Logs"}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx("a",{download:"UmamiErrorLogs.json",href:`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(_))}`,children:jsxRuntimeExports.jsx(Button,{variant:"tertiary",children:"Download error logs"})}),jsxRuntimeExports.jsx(Button,{marginLeft:"8px",onClick:$,variant:"warning",children:"Clear All"})]})]}),_.map(j=>jsxRuntimeExports.jsx(ErrorLogRow,{errorLog:j},nanoid()))]})},ErrorLogRow=({errorLog:_})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{marginY:1}),jsxRuntimeExports.jsx(Flex,{justifyContent:"space-between",paddingY:"12px",children:jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(OutlineExclamationCircleIcon,{marginTop:"1px",marginRight:"8px"}),jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[jsxRuntimeExports.jsx(Heading,{wordBreak:"break-all",size:"sm",children:_.description}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:_.timestamp})]})]})})]}),removeTrailingSlashes=_=>_.replace(/\/+$/g,""),UpsertNetworkModal=({network:_})=>{const a=_?"edit":"create",{onClose:$}=reactExports.useContext(DynamicModalContext),j=useDispatch(),et=useAvailableNetworks(),{formState:{errors:tt,isValid:rt},register:nt,handleSubmit:it}=useForm({mode:"onBlur",defaultValues:_}),ot=st=>{j(networksActions.upsertNetwork(st)),$()};return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:it(ot),children:[jsxRuntimeExports.jsxs(ModalHeader,{textAlign:"center",children:[a==="edit"?"Edit":"Add"," Network",jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsxs(ModalBody,{children:[a==="create"&&jsxRuntimeExports.jsxs(FormControl,{marginTop:"32px",marginBottom:"24px",isInvalid:!!tt.name,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Name"}),jsxRuntimeExports.jsx(Input,{placeholder:"mainnet",...nt("name",{required:"Name is required",validate:st=>{if(et.find(ct=>ct.name===st))return"Network with this name already exists"}})}),tt.name&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.name.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"24px",isInvalid:!!tt.rpcUrl,children:[jsxRuntimeExports.jsx(FormLabel,{children:"RPC URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://prod.tcinfra.net/rpc/mainnet",...nt("rpcUrl",{required:"RPC URL is required",setValueAs:removeTrailingSlashes})}),tt.rpcUrl&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.rpcUrl.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"24px",isInvalid:!!tt.tzktApiUrl,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Tzkt API URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://api.ghostnet.tzkt.io",...nt("tzktApiUrl",{required:"Tzkt API URL is required",setValueAs:removeTrailingSlashes})}),tt.tzktApiUrl&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.tzktApiUrl.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"24px",isInvalid:!!tt.tzktExplorerUrl,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Tzkt Explorer URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://ghostnet.tzkt.io",...nt("tzktExplorerUrl",{required:"Tzkt Explorer URL is required",setValueAs:removeTrailingSlashes})}),tt.tzktExplorerUrl&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.tzktExplorerUrl.message})]}),jsxRuntimeExports.jsxs(FormControl,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"Buy Tez URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://faucet.ghostnet.teztnets.com",...nt("buyTezUrl")})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!rt,onClick:()=>{},type:"submit",children:a==="edit"?"Save changes":"Add network"})})]})]})})},NetworkSettingsDrawerBody=()=>{const{openWith:_}=reactExports.useContext(DynamicModalContext),a=useSelectedNetwork(),$=useSelectNetwork(),j=useAvailableNetworks(),et=useAppDispatch(),tt=rt=>{et(networksActions.removeNetwork(rt))};return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[jsxRuntimeExports.jsxs(Center,{justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Heading,{children:"Network Settings"}),jsxRuntimeExports.jsxs(Button,{paddingRight:"0",onClick:()=>_(jsxRuntimeExports.jsx(UpsertNetworkModal,{})),variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{size:"sm",children:"Add Network"}),jsxRuntimeExports.jsx(PlusIcon,{width:"18px",height:"18px",marginLeft:"4px",stroke:"currentcolor"})]})]}),jsxRuntimeExports.jsx(RadioGroup,{marginTop:"60px",onChange:$,value:a.name,children:jsxRuntimeExports.jsx(Stack,{children:j.map(rt=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{borderColor:colors.gray[700]}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between","data-testid":`network-${rt.name}`,children:[jsxRuntimeExports.jsx(Radio,{height:"100px",value:rt.name,variant:"primary",children:jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",marginLeft:"16px",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"4px",size:"sm",children:rt.name}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],children:rt.rpcUrl})]})}),!isDefault(rt)&&jsxRuntimeExports.jsx(Center,{"data-testid":"popover-menu",children:jsxRuntimeExports.jsxs(PopoverMenu,{children:[jsxRuntimeExports.jsxs(Button,{onClick:()=>_(jsxRuntimeExports.jsx(UpsertNetworkModal,{network:rt})),variant:"popover",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Edit"}),jsxRuntimeExports.jsx(PenIcon,{stroke:"inherit"})]}),jsxRuntimeExports.jsx(Divider,{marginTop:"4px"}),jsxRuntimeExports.jsxs(Button,{onClick:()=>tt(rt),variant:"popover",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Remove"}),jsxRuntimeExports.jsx(TrashIcon,{stroke:"inherit"})]})]})})]})]},rt.name))})})]})},NetworkSettingsDrawerCard=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Network Settings",isSelected:_,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{blockScrollOnMount:!1,isOpen:_,onClose:a,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:a}),jsxRuntimeExports.jsx(NetworkSettingsDrawerBody,{})]})})]})]})},ChangePasswordForm=()=>{const{onClose:_}=reactExports.useContext(DynamicModalContext),a=useForm({mode:"onBlur"}),$=useToast(),j=useAppDispatch(),{handleAsyncAction:et,isLoading:tt}=useAsyncActionHandler(),{handleSubmit:rt,formState:{isValid:nt,errors:it},getValues:ot}=a,st=async({currentPassword:ct,newPassword:ut,newPasswordConfirmation:ht})=>{if(!(ct===ut||ut!==ht))return et(async()=>{await j(changeMnemonicPassword({currentPassword:ct,newPassword:ut})).unwrap(),$({description:"Password updated",status:"success"}),_()})};return jsxRuntimeExports.jsx(FormProvider,{...a,children:jsxRuntimeExports.jsx(ModalContent,{background:colors.gray[700],"data-testid":"change-password-modal",children:jsxRuntimeExports.jsxs("form",{onSubmit:rt(st),children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalHeader,{textAlign:"center",children:jsxRuntimeExports.jsx(Heading,{children:"Change Password"})}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{marginTop:"32px",isInvalid:!!it.currentPassword,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"current-password",inputName:"currentPassword",label:"Current Password",placeholder:"Enter your current password",required:"Current password is required"}),it.currentPassword&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"current-password-error",children:it.currentPassword.message})]}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!it.newPassword,marginY:6,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"new-password",inputName:"newPassword",label:"New Password",placeholder:"Enter new password",required:"New password is required",validate:ct=>ot("currentPassword")!==ct||"Cannot be the same as old password"}),it.newPassword&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"new-password-error",children:it.newPassword.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:3,isInvalid:!!it.newPasswordConfirmation,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"new-password-confirmation",inputName:"newPasswordConfirmation",label:"Confirm New Password",placeholder:"Confirm new password",required:"Confirmation is required",validate:ct=>ot("newPassword")===ct||"Your new passwords do no match"}),it.newPasswordConfirmation&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"new-password-confirmation-error",children:it.newPasswordConfirmation.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!nt,isLoading:tt,size:"lg",type:"submit",children:"Update Password"})})]})})})},SettingsView=()=>jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Settings"}),jsxRuntimeExports.jsxs(Box,{overflowY:"scroll",children:[jsxRuntimeExports.jsx(Box,{marginTop:"16px",children:jsxRuntimeExports.jsx(GeneralSection,{})}),jsxRuntimeExports.jsx(BackupSection,{}),jsxRuntimeExports.jsx(AdvancedSection,{})]})]}),GeneralSection=()=>jsxRuntimeExports.jsxs(SectionContainer,{title:"General",children:[jsxRuntimeExports.jsx(NetworkSettingsDrawerCard,{}),jsxRuntimeExports.jsx(ErrorLogsDrawerCard,{})]}),BackupSection=()=>jsxRuntimeExports.jsx(SectionContainer,{title:"Backup",children:jsxRuntimeExports.jsx(ClickableCard,{isSelected:!1,onClick:downloadBackupFile,children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Heading,{size:"sm",children:"Download backup file"}),jsxRuntimeExports.jsx(Button,{onClick:downloadBackupFile,variant:"unstyled",children:jsxRuntimeExports.jsx(DownloadIcon,{cursor:"pointer"})})]})})}),AdvancedSection=()=>{const{modalElement:_,onOpen:a}=useOffboardingModal(),{openWith:$}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(SectionContainer,{title:"Advanced Settings",children:[jsxRuntimeExports.jsx(DAppsDrawerCard,{}),jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Off-board Wallet",isSelected:!1,onClick:a}),jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Change Password",isSelected:!1,onClick:()=>$(jsxRuntimeExports.jsx(ChangePasswordForm,{}))}),_]})},SectionContainer=({title:_,children:a})=>jsxRuntimeExports.jsx(Box,{marginTop:"8px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsxs(Box,{width:"550px",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"16px",size:"lg",children:_}),a]})})}),TokenTile=({token:_,amount:a,...$})=>{const{contract:j}=_,et=tokenPrettyAmount(a,_),tt=tokenSymbolSafe(_);return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"start",width:"400px",padding:"15px",background:colors.gray[800],borderRadius:"4px","data-testid":"token-tile",...$,children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(AspectRatio,{width:"30px",height:"30px",marginRight:"12px",ratio:1,children:jsxRuntimeExports.jsx(TokenIcon,{padding:"6.25px",background:colors.gray[500],borderRadius:"4px",contract:j})})}),jsxRuntimeExports.jsx(PrettyNumber,{number:et}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:tt})]})},SignPage=_=>{const{mode:a,operations:$,data:{token:j}}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:ot,reEstimate:st,onSign:ct}=useSignPageHelpers($,a),{amount:ut,recipient:ht}=tt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:tt.type,signer:tt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TokenTile,{amount:ut,token:j}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",marginBottom:"24px",paddingX:"4px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(SignPageFee,{fee:et})})}),jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{marginBottom:"24px",address:tt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:ht}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:nt,operationType:tt.type,reEstimate:st,sender:tt.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:ct,signer:ot,text:headerText(tt.type,a)})})]})})})},FormPage=_=>{const{token:a}=_,$=useOpenSignPageFormAction({SignPage,signPageExtraData:{token:a},FormPage,defaultFormPageProps:_,toOperation:toOperation(a)}),j=useAddToBatchFormAction(toOperation(a)),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:formDefaultValues(_)}),{formState:{isValid:it,errors:ot},register:st,handleSubmit:ct}=nt,ut=tokenDecimals(a),ht=formatTokenAmount(a.balance,ut),Et=getSmallestUnit(Number(ut));return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(FormPageHeader,{}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!ot.prettyAmount,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Amount"}),jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{isDisabled:rt,step:Et,type:"number",...st("prettyAmount",{required:"Amount is required",max:{value:ht.toString(),message:`Max amount is ${ht}`},validate:makeValidateDecimals(Number(ut))}),placeholder:Et}),jsxRuntimeExports.jsx(InputRightElement,{paddingRight:"12px","data-testid":"token-symbol",children:tokenSymbolSafe(a)})]}),ot.prettyAmount&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"amount-error",children:ot.prettyAmount.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),ot.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:ot.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ct(tt),onSingleSubmit:ct(et)})})]})})})},toOperation=_=>a=>{const $={type:"fa2",sender:parsePkh(a.sender),recipient:parsePkh(a.recipient),contract:parseContractPkh(_.contract),tokenId:_.tokenId,amount:getRealAmount(_,a.prettyAmount)};return _.type==="fa2"?$:{...$,type:"fa1.2",tokenId:"0"}},Header=({account:_})=>{const{address:a,label:$}=_;return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"78px",background:accountIconGradient({left:"-10px",top:"-10px",account:_,radius:"100px",mainBackgroundColor:colors.gray[800]}),borderTopRadius:"8px","data-testid":"header",paddingX:"30px",children:[jsxRuntimeExports.jsx(AccountTileIcon,{account:_,size:"lg"}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",flex:1,children:[jsxRuntimeExports.jsxs(Box,{marginLeft:"16px","data-testid":"account-identifier",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"4px",size:"md",children:$}),jsxRuntimeExports.jsx(Text,{color:colors.gray[300],size:"sm",children:formatPkh(a.pkh)})]}),jsxRuntimeExports.jsx(Flex,{flexDirection:"column-reverse",children:jsxRuntimeExports.jsx(AccountBalance,{verticalAlign:"bottom",address:_.address.pkh})})]})]})},AccountTokens=({account:_,tokens:a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Card,{overflowX:"auto",marginBottom:"16px",borderBottomRadius:"8px",backgroundColor:colors.gray[900],children:[jsxRuntimeExports.jsx(Header,{account:_}),jsxRuntimeExports.jsx(TableContainer,{paddingX:"30px",children:jsxRuntimeExports.jsx(Table,{children:jsxRuntimeExports.jsx(Tbody,{children:a.map((j,et)=>{const tt=et===a.length-1?"transparent":colors.gray[700];return jsxRuntimeExports.jsxs(Tr,{"data-testid":"token-tile",children:[jsxRuntimeExports.jsx(Td,{width:"20%",minWidth:"240px",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(TokenIcon,{display:"inline-block",width:"38px",contract:j.contract}),jsxRuntimeExports.jsx(Heading,{display:"inline-block",marginLeft:"16px",size:"sm",children:jsxRuntimeExports.jsx(TokenNameWithIcon,{token:j})})]})}),jsxRuntimeExports.jsx(Td,{width:"20%",minWidth:"200px",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsx(AddressPill,{address:parseContractPkh(j.contract)})}),jsxRuntimeExports.jsx(Td,{width:"15%",minWidth:"160px",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsx(Heading,{size:"sm",children:tokenPrettyAmount(j.balance,j,{showSymbol:!1})})}),jsxRuntimeExports.jsx(Td,{textAlign:"right",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsx(SendButton,{onClick:()=>$(jsxRuntimeExports.jsx(FormPage,{sender:_,token:j}))})})]},fullId(j))})})})})]})},TokensPage=()=>{const{accountsFilter:_,selectedAccounts:a}=useAccountsFilter(),$=useGetAccountAllTokens(),j=a.map(et=>[et,$(et.address.pkh)]).filter(([,et])=>et.length>0);return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Tokens"}),_,j.length===0?jsxRuntimeExports.jsx(NoTokens,{size:"lg"}):jsxRuntimeExports.jsx(Box,{overflowY:"auto",children:j.map(([et,tt])=>jsxRuntimeExports.jsx(AccountTokens,{account:et,tokens:tt},et.address.pkh))})]})},AppVersion=({isCollapsed:_,...a})=>{const $=_?packageInfo.version:`Umami v${packageInfo.version}`;return jsxRuntimeExports.jsx(Text,{color:colors.gray[450],...a,children:$})},CollapseMenuButton=({toggle:_,...a})=>jsxRuntimeExports.jsx(Center,{width:"44px",height:"44px",marginRight:"-14px",borderRadius:"4px",_hover:{background:colors.gray[800]},cursor:"pointer","data-testid":"collapse-menu-button",onClick:_,...a,children:jsxRuntimeExports.jsx(BurgerMenuIcon,{})}),useCollapseMenu=()=>{const[_,a]=reactExports.useState(!1),$=reactExports.useCallback(()=>{a(j=>!j)},[]);return{isCollapsed:_,toggle:$}},ORANGE="#F74F18",MakiLogo=_=>{const a=useSelectedNetwork();return jsxRuntimeExports.jsx(MakiIcon,{background:"white",borderRadius:"8px","data-testid":"maki-logo",fishColor:a.name==="mainnet"?ORANGE:"black",..._})},NetworkSelector=()=>{const _=useSelectedNetwork(),a=useAvailableNetworks(),$=useSelectNetwork(),{onOpen:j,onClose:et,isOpen:tt}=useDisclosure$1();return jsxRuntimeExports.jsxs(Popover,{isOpen:tt,onClose:et,onOpen:j,placement:"bottom-end",children:[jsxRuntimeExports.jsx(PopoverTrigger,{children:jsxRuntimeExports.jsxs(Button,{marginTop:"4px",color:colors.green,"data-testid":"network-selector",variant:"unstyled",children:[lodashExports.capitalize(_.name),tt?jsxRuntimeExports.jsx(ChevronUpIcon,{marginTop:"-2px",stroke:"currentcolor"}):jsxRuntimeExports.jsx(ChevronDownIcon$1,{marginTop:"-2px",stroke:"currentcolor"})]})}),jsxRuntimeExports.jsx(PopoverContent,{width:"100px",marginTop:"-10px",background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],children:jsxRuntimeExports.jsx(PopoverBody,{padding:"4px 12px",children:jsxRuntimeExports.jsx(Flex,{flexDirection:"column",children:a.map((rt,nt)=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{height:"34px",color:rt.name===_.name?colors.green:colors.gray[300],fontSize:"14px",fontWeight:400,textAlign:"right",_hover:{color:colors.greenL},onClick:()=>{$(rt.name),et()},variant:"unstyled",children:lodashExports.capitalize(rt.name)}),nt{const[_,a]=reactExports.useState(!1),$=window;reactExports.useEffect(()=>{$&&$.electronAPI&&$.electronAPI.onAppUpdateDownloaded(et=>a(!0))},[$]);const j=()=>{$&&$.electronAPI&&$.electronAPI.installAppUpdateAndQuit()};return _?jsxRuntimeExports.jsx(Box,{marginTop:"24px",marginBottom:"6px",children:jsxRuntimeExports.jsxs(Button,{justifyContent:"flex-start",width:"100%",height:"32px",paddingTop:"7px",paddingRight:"8px",paddingBottom:"7px",paddingLeft:"8px",color:colors.black,background:colors.green,_hover:{color:colors.black,background:colors.greenL},onClick:j,children:[jsxRuntimeExports.jsx(FlipForwardEnergy,{}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:"Update Umami"})]})}):null},SideNavbar=()=>{const{isCollapsed:_,toggle:a}=useCollapseMenu(),$=jsxRuntimeExports.jsx(CollapseMenuButton,{marginTop:_?0:"2px",marginRight:_?0:"-14px",toggle:a});return jsxRuntimeExports.jsxs(Flex,{alignItems:_?"center":"normal",flexDirection:"column",width:_?"80px":"236px",padding:_?"30px 20px":"30px",background:colors.gray[900],"data-testid":`side-navbar${_?"-collapsed":""}`,children:[jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",height:"30px",children:_?$:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(MakiLogo,{width:"38px",height:"38px"}),jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(NetworkSelector,{}),$]})]})}),jsxRuntimeExports.jsx(Divider,{marginTop:"28px"})]}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",flexDirection:"column",flex:1,children:[jsxRuntimeExports.jsxs(Box,{alignItems:_?"center":"normal",justifyContent:_?"space-around":"normal",display:_?"flex":"block",height:"100%",children:[!_&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(UpdateAppButton,{}),jsxRuntimeExports.jsx(TotalBalance,{})]}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(AccountsIcon,{}),isCollapsed:_,label:"Accounts",to:"/home"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(DiamondIcon,{}),isCollapsed:_,label:"NFTs",to:"/nfts"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(RefreshClockIcon,{width:"24px",height:"24px"}),isCollapsed:_,label:"Operations",to:"/operations"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(CoinIcon,{}),isCollapsed:_,label:"Tokens",to:"/tokens"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(BatchIcon,{}),isCollapsed:_,label:"Batch",to:"/batch"})]})]}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(MenuItem,{marginTop:"22px",icon:jsxRuntimeExports.jsx(AddressBookIcon,{}),isCollapsed:_,label:"Address Book",to:"/address-book"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(GearIcon,{}),isCollapsed:_,label:"Settings",to:"/settings"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(HelpIcon,{}),isCollapsed:_,label:"Help",to:"/help"}),jsxRuntimeExports.jsx(AppVersion,{marginTop:"24px",fontSize:"14px",textAlign:_?"center":"left",isCollapsed:_})]})]})]})},MenuItem=({icon:_,label:a,to:$,isCollapsed:j,...et})=>{const rt=useLocation().pathname.startsWith($);return jsxRuntimeExports.jsx(Link,{to:$,children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"flex-start",width:j?"44px":"176px",marginBottom:"8px",padding:"10px",background:rt?colors.gray[600]:"transparent",borderRadius:"4px",_hover:{background:rt?colors.gray[600]:colors.gray[800]},cursor:"pointer",...et,children:[_,!j&&jsxRuntimeExports.jsx(Text,{marginLeft:"10px",size:"sm",children:a})]})})},TotalBalance=()=>{const _=useTotalBalance(),[a]=useMediaQuery("(max-height: 900px)");return jsxRuntimeExports.jsxs(Box,{marginTop:"24px",marginBottom:a?"30px":"100px","data-testid":"total-balance",children:[jsxRuntimeExports.jsx(Text,{marginBottom:"4px",size:"sm",children:"Balance"}),_&&jsxRuntimeExports.jsx(TezRecapDisplay,{balance:_.mutez,dollarBalance:_.usd})]})},withSideMenu=_=>jsxRuntimeExports.jsxs(Flex,{height:"100vh",children:[jsxRuntimeExports.jsx(SideNavbar,{}),jsxRuntimeExports.jsx(Box,{flex:1,overflowX:"hidden",height:"100%",background:"linear-gradient(180deg, rgba(0, 231, 182, 0.35) -41.53%, rgba(0, 231, 182, 0.00) 34.71%)",paddingX:"24px",children:_})]}),AccountsImage=""+new URL("accounts-DTYOez9Q.png",import.meta.url).href,BatchImage=""+new URL("batch-CoYFN9ox.png",import.meta.url).href,MultisigImage=""+new URL("multisig-GRRIvmJS.png",import.meta.url).href;var js={},Carousel$1={},lib={},reactSwipe={},hasRequiredReactSwipe;function requireReactSwipe(){return hasRequiredReactSwipe||(hasRequiredReactSwipe=1,function(_){(function(a,$){$(_,reactExports,propTypesExports)})(commonjsGlobal,function(a,$,j){Object.defineProperty(a,"__esModule",{value:!0}),a.setHasSupportToCaptureOption=Et;var et=rt($),tt=rt(j);function rt(Ct){return Ct&&Ct.__esModule?Ct:{default:Ct}}var nt=Object.assign||function(Ct){for(var Ot=1;Ot=0||Object.prototype.hasOwnProperty.call(Ct,Ut)&&(zt[Ut]=Ct[Ut]);return zt}function ot(Ct,Ot){if(!(Ct instanceof Ot))throw new TypeError("Cannot call a class as a function")}var st=function(){function Ct(Ot,zt){for(var Ut=0;Ut0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return ht?Ct:Ct.capture}function Mt(Ct){if("touches"in Ct){var Ot=Ct.touches[0],zt=Ot.pageX,Ut=Ot.pageY;return{x:zt,y:Ut}}var Vt=Ct.screenX,jt=Ct.screenY;return{x:Vt,y:jt}}var kt=function(Ct){ut(Ot,Ct);function Ot(){var zt;ot(this,Ot);for(var Ut=arguments.length,Vt=Array(Ut),jt=0;jtVt&&this.props.onSwipeRight(1,Ut),this.movePosition.deltaY<-Vt?this.props.onSwipeUp(1,Ut):this.movePosition.deltaY>Vt&&this.props.onSwipeDown(1,Ut)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(Ut){this.swiper=Ut,this.props.innerRef(Ut)}},{key:"render",value:function(){var Ut=this.props;Ut.tagName;var Vt=Ut.className,jt=Ut.style,$t=Ut.children;Ut.allowMouseEvents,Ut.onSwipeUp,Ut.onSwipeDown,Ut.onSwipeLeft,Ut.onSwipeRight,Ut.onSwipeStart,Ut.onSwipeMove,Ut.onSwipeEnd,Ut.innerRef,Ut.tolerance;var Bt=it(Ut,["tagName","className","style","children","allowMouseEvents","onSwipeUp","onSwipeDown","onSwipeLeft","onSwipeRight","onSwipeStart","onSwipeMove","onSwipeEnd","innerRef","tolerance"]);return et.default.createElement(this.props.tagName,nt({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:Vt,style:jt},Bt),$t)}}]),Ot}($.Component);kt.displayName="ReactSwipe",kt.propTypes={tagName:tt.default.string,className:tt.default.string,style:tt.default.object,children:tt.default.node,allowMouseEvents:tt.default.bool,onSwipeUp:tt.default.func,onSwipeDown:tt.default.func,onSwipeLeft:tt.default.func,onSwipeRight:tt.default.func,onSwipeStart:tt.default.func,onSwipeMove:tt.default.func,onSwipeEnd:tt.default.func,innerRef:tt.default.func,tolerance:tt.default.number.isRequired},kt.defaultProps={tagName:"div",allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},a.default=kt})}(reactSwipe)),reactSwipe}(function(_){(function(a,$){$(_,requireReactSwipe())})(commonjsGlobal,function(a,$){Object.defineProperty(a,"__esModule",{value:!0});var j=et($);function et(tt){return tt&&tt.__esModule?tt:{default:tt}}a.default=j.default})})(lib);var cssClasses={},classnames={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames diff --git a/index.html b/index.html index 36cf10a958..33581a2d56 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,7 @@ --> Umami - +