diff --git a/app/dist/assets/index-9ca5ffe9.js b/app/dist/assets/index-d91d7471.js similarity index 98% rename from app/dist/assets/index-9ca5ffe9.js rename to app/dist/assets/index-d91d7471.js index 4d7ff0d8..b67506b8 100644 --- a/app/dist/assets/index-9ca5ffe9.js +++ b/app/dist/assets/index-d91d7471.js @@ -137,7 +137,7 @@ function print() { __p += __j.call(arguments, '') } */var wasm=null;try{wasm=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(i){}function Long(i,t,n){this.low=i|0,this.high=t|0,this.unsigned=!!n}Long.prototype.__isLong__;Object.defineProperty(Long.prototype,"__isLong__",{value:!0});function isLong(i){return(i&&i.__isLong__)===!0}function ctz32(i){var t=Math.clz32(i&-i);return i?31-t:t}Long.isLong=isLong;var INT_CACHE={},UINT_CACHE={};function fromInt(i,t){var n,s,o;return t?(i>>>=0,(o=0<=i&&i<256)&&(s=UINT_CACHE[i],s)?s:(n=fromBits(i,0,!0),o&&(UINT_CACHE[i]=n),n)):(i|=0,(o=-128<=i&&i<128)&&(s=INT_CACHE[i],s)?s:(n=fromBits(i,i<0?-1:0,!1),o&&(INT_CACHE[i]=n),n))}Long.fromInt=fromInt;function fromNumber(i,t){if(isNaN(i))return t?UZERO:ZERO;if(t){if(i<0)return UZERO;if(i>=TWO_PWR_64_DBL)return MAX_UNSIGNED_VALUE}else{if(i<=-TWO_PWR_63_DBL)return MIN_VALUE;if(i+1>=TWO_PWR_63_DBL)return MAX_VALUE}return i<0?fromNumber(-i,t).neg():fromBits(i%TWO_PWR_32_DBL|0,i/TWO_PWR_32_DBL|0,t)}Long.fromNumber=fromNumber;function fromBits(i,t,n){return new Long(i,t,n)}Long.fromBits=fromBits;var pow_dbl=Math.pow;function fromString(i,t,n){if(i.length===0)throw Error("empty string");if(typeof t=="number"?(n=t,t=!1):t=!!t,i==="NaN"||i==="Infinity"||i==="+Infinity"||i==="-Infinity")return t?UZERO:ZERO;if(n=n||10,n<2||360)throw Error("interior hyphen");if(s===0)return fromString(i.substring(1),t,n).neg();for(var o=fromNumber(pow_dbl(n,8)),r=ZERO,l=0;l>>0:this.low};LongPrototype.toNumber=function i(){return this.unsigned?(this.high>>>0)*TWO_PWR_32_DBL+(this.low>>>0):this.high*TWO_PWR_32_DBL+(this.low>>>0)};LongPrototype.toString=function i(t){if(t=t||10,t<2||36>>0,f=u.toString(t);if(l=c,l.isZero())return f+a;for(;f.length<6;)f="0"+f;a=""+f+a}};LongPrototype.getHighBits=function i(){return this.high};LongPrototype.getHighBitsUnsigned=function i(){return this.high>>>0};LongPrototype.getLowBits=function i(){return this.low};LongPrototype.getLowBitsUnsigned=function i(){return this.low>>>0};LongPrototype.getNumBitsAbs=function i(){if(this.isNegative())return this.eq(MIN_VALUE)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&!(t&1<=0};LongPrototype.isOdd=function i(){return(this.low&1)===1};LongPrototype.isEven=function i(){return(this.low&1)===0};LongPrototype.equals=function i(t){return isLong(t)||(t=fromValue(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};LongPrototype.eq=LongPrototype.equals;LongPrototype.notEquals=function i(t){return!this.eq(t)};LongPrototype.neq=LongPrototype.notEquals;LongPrototype.ne=LongPrototype.notEquals;LongPrototype.lessThan=function i(t){return this.comp(t)<0};LongPrototype.lt=LongPrototype.lessThan;LongPrototype.lessThanOrEqual=function i(t){return this.comp(t)<=0};LongPrototype.lte=LongPrototype.lessThanOrEqual;LongPrototype.le=LongPrototype.lessThanOrEqual;LongPrototype.greaterThan=function i(t){return this.comp(t)>0};LongPrototype.gt=LongPrototype.greaterThan;LongPrototype.greaterThanOrEqual=function i(t){return this.comp(t)>=0};LongPrototype.gte=LongPrototype.greaterThanOrEqual;LongPrototype.ge=LongPrototype.greaterThanOrEqual;LongPrototype.compare=function i(t){if(isLong(t)||(t=fromValue(t)),this.eq(t))return 0;var n=this.isNegative(),s=t.isNegative();return n&&!s?-1:!n&&s?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};LongPrototype.comp=LongPrototype.compare;LongPrototype.negate=function i(){return!this.unsigned&&this.eq(MIN_VALUE)?MIN_VALUE:this.not().add(ONE)};LongPrototype.neg=LongPrototype.negate;LongPrototype.add=function i(t){isLong(t)||(t=fromValue(t));var n=this.high>>>16,s=this.high&65535,o=this.low>>>16,r=this.low&65535,l=t.high>>>16,a=t.high&65535,c=t.low>>>16,u=t.low&65535,f=0,h=0,p=0,g=0;return g+=r+u,p+=g>>>16,g&=65535,p+=o+c,h+=p>>>16,p&=65535,h+=s+a,f+=h>>>16,h&=65535,f+=n+l,f&=65535,fromBits(p<<16|g,f<<16|h,this.unsigned)};LongPrototype.subtract=function i(t){return isLong(t)||(t=fromValue(t)),this.add(t.neg())};LongPrototype.sub=LongPrototype.subtract;LongPrototype.multiply=function i(t){if(this.isZero())return this;if(isLong(t)||(t=fromValue(t)),wasm){var n=wasm.mul(this.low,this.high,t.low,t.high);return fromBits(n,wasm.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?UZERO:ZERO;if(this.eq(MIN_VALUE))return t.isOdd()?MIN_VALUE:ZERO;if(t.eq(MIN_VALUE))return this.isOdd()?MIN_VALUE:ZERO;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(TWO_PWR_24)&&t.lt(TWO_PWR_24))return fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var s=this.high>>>16,o=this.high&65535,r=this.low>>>16,l=this.low&65535,a=t.high>>>16,c=t.high&65535,u=t.low>>>16,f=t.low&65535,h=0,p=0,g=0,b=0;return b+=l*f,g+=b>>>16,b&=65535,g+=r*f,p+=g>>>16,g&=65535,g+=l*u,p+=g>>>16,g&=65535,p+=o*f,h+=p>>>16,p&=65535,p+=r*u,h+=p>>>16,p&=65535,p+=l*c,h+=p>>>16,p&=65535,h+=s*f+o*u+r*c+l*a,h&=65535,fromBits(g<<16|b,h<<16|p,this.unsigned)};LongPrototype.mul=LongPrototype.multiply;LongPrototype.divide=function i(t){if(isLong(t)||(t=fromValue(t)),t.isZero())throw Error("division by zero");if(wasm){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?wasm.div_u:wasm.div_s)(this.low,this.high,t.low,t.high);return fromBits(n,wasm.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?UZERO:ZERO;var s,o,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return UZERO;if(t.gt(this.shru(1)))return UONE;r=UZERO}else{if(this.eq(MIN_VALUE)){if(t.eq(ONE)||t.eq(NEG_ONE))return MIN_VALUE;if(t.eq(MIN_VALUE))return ONE;var l=this.shr(1);return s=l.div(t).shl(1),s.eq(ZERO)?t.isNegative()?ONE:NEG_ONE:(o=this.sub(t.mul(s)),r=s.add(o.div(t)),r)}else if(t.eq(MIN_VALUE))return this.unsigned?UZERO:ZERO;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();r=ZERO}for(o=this;o.gte(t);){s=Math.max(1,Math.floor(o.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(s)/Math.LN2),c=a<=48?1:pow_dbl(2,a-48),u=fromNumber(s),f=u.mul(t);f.isNegative()||f.gt(o);)s-=c,u=fromNumber(s,this.unsigned),f=u.mul(t);u.isZero()&&(u=ONE),r=r.add(u),o=o.sub(f)}return r};LongPrototype.div=LongPrototype.divide;LongPrototype.modulo=function i(t){if(isLong(t)||(t=fromValue(t)),wasm){var n=(this.unsigned?wasm.rem_u:wasm.rem_s)(this.low,this.high,t.low,t.high);return fromBits(n,wasm.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};LongPrototype.mod=LongPrototype.modulo;LongPrototype.rem=LongPrototype.modulo;LongPrototype.not=function i(){return fromBits(~this.low,~this.high,this.unsigned)};LongPrototype.countLeadingZeros=function i(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};LongPrototype.clz=LongPrototype.countLeadingZeros;LongPrototype.countTrailingZeros=function i(){return this.low?ctz32(this.low):ctz32(this.high)+32};LongPrototype.ctz=LongPrototype.countTrailingZeros;LongPrototype.and=function i(t){return isLong(t)||(t=fromValue(t)),fromBits(this.low&t.low,this.high&t.high,this.unsigned)};LongPrototype.or=function i(t){return isLong(t)||(t=fromValue(t)),fromBits(this.low|t.low,this.high|t.high,this.unsigned)};LongPrototype.xor=function i(t){return isLong(t)||(t=fromValue(t)),fromBits(this.low^t.low,this.high^t.high,this.unsigned)};LongPrototype.shiftLeft=function i(t){return isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?fromBits(this.low<>>32-t,this.unsigned):fromBits(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};LongPrototype.shr=LongPrototype.shiftRight;LongPrototype.shiftRightUnsigned=function i(t){return isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?fromBits(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?fromBits(this.high,0,this.unsigned):fromBits(this.high>>>t-32,0,this.unsigned)};LongPrototype.shru=LongPrototype.shiftRightUnsigned;LongPrototype.shr_u=LongPrototype.shiftRightUnsigned;LongPrototype.rotateLeft=function i(t){var n;return isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?fromBits(this.high,this.low,this.unsigned):t<32?(n=32-t,fromBits(this.low<>>n,this.high<>>n,this.unsigned)):(t-=32,n=32-t,fromBits(this.high<>>n,this.low<>>n,this.unsigned))};LongPrototype.rotl=LongPrototype.rotateLeft;LongPrototype.rotateRight=function i(t){var n;return isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?fromBits(this.high,this.low,this.unsigned):t<32?(n=32-t,fromBits(this.high<>>t,this.low<>>t,this.unsigned)):(t-=32,n=32-t,fromBits(this.low<>>t,this.high<>>t,this.unsigned))};LongPrototype.rotr=LongPrototype.rotateRight;LongPrototype.toSigned=function i(){return this.unsigned?fromBits(this.low,this.high,!1):this};LongPrototype.toUnsigned=function i(){return this.unsigned?this:fromBits(this.low,this.high,!0)};LongPrototype.toBytes=function i(t){return t?this.toBytesLE():this.toBytesBE()};LongPrototype.toBytesLE=function i(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};LongPrototype.toBytesBE=function i(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};Long.fromBytes=function i(t,n,s){return s?Long.fromBytesLE(t,n):Long.fromBytesBE(t,n)};Long.fromBytesLE=function i(t,n){return new Long(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};Long.fromBytesBE=function i(t,n){return new Long(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};function parseClnGetInfo(i){return{identity_pubkey:bufferToHexString(i.id)}}function parseClnListPeerChannelsRes(i){return parseClnPeerChannelList(i.channels)}function parseClnListPeerRes(i){return i.peers.map(n=>({pub_key:bufferToHexString(n.id),address:n.netaddr[0],bytes_recv:0,bytes_sent:0,sat_sent:0,sat_recv:0,inbound:0,ping_time:0,sync_type:0}))}function parseClnPeerChannelList(i){return i.map((n,s)=>({remote_pubkey:bufferToHexString(n.peer_id),capacity:convertMillisatsToSats(n.total_msat.msat),local_balance:convertMillisatsToSats(n.spendable_msat.msat),remote_balance:convertMillisatsToSats(n.receivable_msat.msat),channel_point:`${bufferToHexString(n.funding_txid)}:${s}`,active:getChannelStatus(n.status),chan_id:shortChanIDtoInt64(n.short_channel_id)}))}function shortChanIDtoInt64(i){if(typeof i!="string"||!(i.includes(":")||i.includes("x")))return"";let t=[];const n=[":","x"];for(const l of n)i.includes(l)&&(t=i.split(l));if(!t||!Array.isArray(t)||t.length!==3)return"";const s=Long.fromString(t[0],!0).shiftLeft(40),o=Long.fromString(t[1],!0).shiftLeft(16),r=Long.fromString(t[2],!0);return s.or(o).or(r).toString()}function getChannelStatus(i){const t={};for(let n=0;n0){let t=[];for(let n=0;n0){let n=[];for(let s=0;stransition_out(c[f],1,1,()=>{c[f]=null});return{c(){t=element("div"),s=text(n),o=space(),r=element("div");for(let f=0;fbind(p,"value",B,i[3]));function F(N){i[17](N)}let q={labelText:"Address",placeholder:"New node address"};return i[2]!==void 0&&(q.value=i[2]),S=new TextInput$1({props:q}),binding_callbacks.push(()=>bind(S,"value",F,i[2])),E=new Button$1({props:{disabled:i[6],class:"peer-btn",size:"field",icon:Add,$$slots:{default:[create_default_slot$g]},$$scope:{ctx:i}}}),E.$on("click",i[9]),{c(){t=element("section"),n=element("div"),create_component(s.$$.fragment),o=space(),R&&R.c(),r=space(),l=element("div"),l.textContent="New Peer",a=space(),O&&O.c(),c=space(),u=element("section"),f=element("div"),h=space(),create_component(p.$$.fragment),b=space(),v=element("div"),y=space(),create_component(S.$$.fragment),w=space(),T=element("div"),A=space(),x=element("center"),create_component(E.$$.fragment),attr(n,"class","back svelte-12fohvo"),attr(l,"class","label new-peer-label svelte-12fohvo"),attr(f,"class","spacer"),attr(v,"class","spacer"),attr(T,"class","spacer"),attr(u,"class","new-peer-form"),attr(t,"class","peer-wrap svelte-12fohvo")},m(N,ee){insert(N,t,ee),append(t,n),mount_component(s,n,null),append(t,o),R&&R.m(t,null),append(t,r),append(t,l),append(t,a),O&&O.m(t,null),append(t,c),append(t,u),append(u,f),append(u,h),mount_component(p,u,null),append(u,b),append(u,v),append(u,y),mount_component(S,u,null),append(u,w),append(u,T),append(u,A),append(u,x),mount_component(E,x,null),M=!0,P||(L=[listen(n,"click",function(){is_function(i[0])&&i[0].apply(this,arguments)}),listen(n,"keypress",keypress_handler$2)],P=!0)},p(N,[ee]){i=N,i[4]&&i[4].length?R?(R.p(i,ee),ee&16&&transition_in(R,1)):(R=create_if_block_1$e(i),R.c(),transition_in(R,1),R.m(t,r)):R&&(group_outros(),transition_out(R,1,1,()=>{R=null}),check_outros()),i[5]?O?(O.p(i,ee),ee&32&&transition_in(O,1)):(O=create_if_block$p(i),O.c(),transition_in(O,1),O.m(t,c)):O&&(group_outros(),transition_out(O,1,1,()=>{O=null}),check_outros());const X={};!g&&ee&8&&(g=!0,X.value=i[3],add_flush_callback(()=>g=!1)),p.$set(X);const Q={};!C&&ee&4&&(C=!0,Q.value=i[2],add_flush_callback(()=>C=!1)),S.$set(Q);const J={};ee&64&&(J.disabled=i[6]),ee&8388608&&(J.$$scope={dirty:ee,ctx:i}),E.$set(J)},i(N){M||(transition_in(s.$$.fragment,N),transition_in(R),transition_in(O),transition_in(p.$$.fragment,N),transition_in(S.$$.fragment,N),transition_in(E.$$.fragment,N),M=!0)},o(N){transition_out(s.$$.fragment,N),transition_out(R),transition_out(O),transition_out(p.$$.fragment,N),transition_out(S.$$.fragment,N),transition_out(E.$$.fragment,N),M=!1},d(N){N&&detach(t),destroy_component(s),R&&R.d(),O&&O.d(),destroy_component(p),destroy_component(S),destroy_component(E),P=!1,run_all(L)}}}const keypress_handler$2=()=>{};function instance$D(i,t,n){let s,o,r,l,a,c,u,f,h;component_subscribe(i,finishedOnboarding,E=>n(12,u=E)),component_subscribe(i,isOnboarding,E=>n(18,f=E)),component_subscribe(i,peers,E=>n(13,h=E));let{back:p=()=>{}}=t,{tag:g=""}=t,{newChannel:b=E=>{}}=t,{type:v=""}=t,y=!1;async function S(){if(v==="Cln"){if(await add_peer(g,s,o)){n(5,y=!0),n(3,s=""),n(2,o="");const M=await list_peers(g),P=await parseClnListPeerRes(M);peers.update(L=>({...L,[g]:P})),createdPeerForOnboarding.update(()=>!0)}}else await add_peer$1(g,s,o)&&(n(5,y=!0),n(3,s=""),n(2,o=""),setTimeout(async()=>{const E=await list_peers$1(g);peers.update(M=>({...M,[g]:E.peers})),createdPeerForOnboarding.update(()=>!0)},1e3))}function C(){f&&u.hasBalance&&!u.hasPeers&&(n(3,s="023d70f2f76d283c6c4e58109ee3a2816eb9d8feb40b23d62469060a2b2867b77f"),n(2,o="54.159.193.149:9735"))}const w=E=>b(E),T=E=>{E.preventDefault(),n(5,y=!1)};function A(E){s=E,n(3,s)}function x(E){o=E,n(2,o)}return i.$$set=E=>{"back"in E&&n(0,p=E.back),"tag"in E&&n(10,g=E.tag),"newChannel"in E&&n(1,b=E.newChannel),"type"in E&&n(11,v=E.type)},i.$$.update=()=>{i.$$.dirty&4096&&C(),i.$$.dirty&9216&&n(4,r=h&&h[g]),i.$$.dirty&16&&n(8,l=r&&r.length?r.length:"No"),i.$$.dirty&16&&n(7,a=r&&r.length<=1?"peer":"peers"),i.$$.dirty&12&&n(6,c=!s||!o)},n(3,s=""),n(2,o=""),[p,b,o,s,r,y,c,a,l,S,g,v,u,h,w,T,A,x]}class Peers extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$D,create_fragment$E,safe_not_equal,{back:0,tag:10,newChannel:1,type:11})}}function parseLndInvoices(i){const t=i.invoices;if(t.length>0){let n=[];for(let s=0;s0){let n=[];for(let s=0;sbind(S,"selectedId",Y,i[2]));function Z(me){i[18](me)}let ge={labelText:"Amount (can't be greater than wallet balance)",placeholder:"Enter channel amount",type:"number"};i[1]!==void 0&&(ge.value=i[1]),x=new TextInput$1({props:ge}),binding_callbacks.push(()=>bind(x,"value",Z,i[1]));function oe(me){i[19](me)}let re={labelText:"Sats per byte",placeholder:"Enter channel sats per byte",type:"number"};return i[5]!==void 0&&(re.value=i[5]),R=new TextInput$1({props:re}),binding_callbacks.push(()=>bind(R,"value",oe,i[5])),N=new Button$1({props:{disabled:i[7],class:"peer-btn",size:"field",icon:Add,$$slots:{default:[create_default_slot$f]},$$scope:{ctx:i}}}),N.$on("click",i[8]),{c(){t=element("section"),n=element("div"),create_component(s.$$.fragment),o=space(),r=element("div"),l=element("section"),a=element("h3"),a.textContent="WALLET BALANCE",c=space(),u=element("h3"),h=text(f),p=space(),g=element("section"),J&&J.c(),b=space(),v=element("div"),y=space(),create_component(S.$$.fragment),w=space(),T=element("div"),A=space(),create_component(x.$$.fragment),M=space(),P=element("div"),L=space(),create_component(R.$$.fragment),B=space(),z=element("div"),F=space(),q=element("center"),create_component(N.$$.fragment),attr(n,"class","back svelte-3k8rbq"),attr(a,"class","title"),attr(u,"class","value"),attr(l,"class","value-wrap"),attr(r,"class","balance-wrap svelte-3k8rbq"),attr(v,"class","spacer"),attr(T,"class","spacer"),attr(P,"class","spacer"),attr(z,"class","spacer"),attr(g,"class","channel-content"),attr(t,"class","channel-wrap svelte-3k8rbq")},m(me,fe){insert(me,t,fe),append(t,n),mount_component(s,n,null),append(t,o),append(t,r),append(r,l),append(l,a),append(l,c),append(l,u),append(u,h),append(t,p),append(t,g),J&&J.m(g,null),append(g,b),append(g,v),append(g,y),mount_component(S,g,null),append(g,w),append(g,T),append(g,A),mount_component(x,g,null),append(g,M),append(g,P),append(g,L),mount_component(R,g,null),append(g,B),append(g,z),append(g,F),append(g,q),mount_component(N,q,null),ee=!0,X||(Q=[listen(n,"click",function(){is_function(i[0])&&i[0].apply(this,arguments)}),listen(n,"keypress",keypress_handler$1)],X=!0)},p(me,[fe]){i=me,(!ee||fe&8)&&f!==(f=formatSatsNumbers(i[3])+"")&&set_data(h,f),i[4]?J?(J.p(i,fe),fe&16&&transition_in(J,1)):(J=create_if_block$o(i),J.c(),transition_in(J,1),J.m(g,b)):J&&(group_outros(),transition_out(J,1,1,()=>{J=null}),check_outros());const ae={};fe&64&&(ae.items=i[6]),!C&&fe&4&&(C=!0,ae.selectedId=i[2],add_flush_callback(()=>C=!1)),S.$set(ae);const Me={};!E&&fe&2&&(E=!0,Me.value=i[1],add_flush_callback(()=>E=!1)),x.$set(Me);const V={};!O&&fe&32&&(O=!0,V.value=i[5],add_flush_callback(()=>O=!1)),R.$set(V);const W={};fe&128&&(W.disabled=i[7]),fe&16777216&&(W.$$scope={dirty:fe,ctx:i}),N.$set(W)},i(me){ee||(transition_in(s.$$.fragment,me),transition_in(J),transition_in(S.$$.fragment,me),transition_in(x.$$.fragment,me),transition_in(R.$$.fragment,me),transition_in(N.$$.fragment,me),ee=!0)},o(me){transition_out(s.$$.fragment,me),transition_out(J),transition_out(S.$$.fragment,me),transition_out(x.$$.fragment,me),transition_out(R.$$.fragment,me),transition_out(N.$$.fragment,me),ee=!1},d(me){me&&detach(t),destroy_component(s),J&&J.d(),destroy_component(S),destroy_component(x),destroy_component(R),destroy_component(N),X=!1,run_all(Q)}}}const keypress_handler$1=()=>{};function instance$C(i,t,n){let s,o,r,l,a,c,u,f,h,p;component_subscribe(i,peers,R=>n(14,h=R)),component_subscribe(i,lndBalances,R=>n(15,p=R));let{activeKey:g=null}=t,{tag:b=""}=t,{type:v=""}=t,y=!1,S;async function C(){v==="Cln"?await create_channel(b,s,convertSatsToMilliSats(o),r)&&(n(4,y=!0),n(2,s=""),n(1,o=0),n(5,r=0),setTimeout(async()=>{const O=await list_peer_channels(b),B=await parseClnListPeerChannelsRes(O);channels.update(z=>({...z,[b]:B})),await T(),channelCreatedForOnboarding.update(()=>!0)},1500)):await create_channel$1(b,s,o,r)&&(n(4,y=!0),n(2,s=""),n(1,o=0),n(5,r=0),setTimeout(async()=>{const R=await getLndPendingAndActiveChannels(b);channels.update(O=>({...O,[b]:R})),await w(),channelCreatedForOnboarding.update(()=>!0)},1500))}async function w(){const R=await get_balance(b);lndBalances.hasOwnProperty(b)&&lndBalances[b]===(R==null?void 0:R.confirmed_balance)||lndBalances.update(O=>({...O,[b]:R==null?void 0:R.confirmed_balance}))}async function T(){const R=await list_funds(b),O=await list_peer_channels(b),B=parseClnListFunds(R,O);lndBalances.hasOwnProperty(b)&&lndBalances[b]===B||lndBalances.update(z=>({...z,[b]:B}))}async function A(){let R=[];if(v==="Cln"){const O=await list_peers(b);R=await parseClnListPeerRes(O)}else R=(await list_peers$1(b)).peers;JSON.stringify(R)!==JSON.stringify(c)&&peers.update(O=>({...O,[b]:R}))}onMount(()=>{A(),S=setInterval(A,1e4),v==="Cln"?T():w()}),onDestroy(()=>{S&&clearInterval(S)});let{back:x=()=>{}}=t;const E=R=>{R.preventDefault(),n(4,y=!1)};function M(R){s=R,n(2,s),n(9,g)}function P(R){o=R,n(1,o)}function L(R){r=R,n(5,r)}return i.$$set=R=>{"activeKey"in R&&n(9,g=R.activeKey),"tag"in R&&n(10,b=R.tag),"type"in R&&n(11,v=R.type),"back"in R&&n(0,x=R.back)},i.$$.update=()=>{i.$$.dirty&512&&n(2,s=g||""),i.$$.dirty&33792&&n(3,l=p.hasOwnProperty(b)?p[b]:0),i.$$.dirty&14&&n(7,a=!s||!o||o>l),i.$$.dirty&17408&&n(12,c=h&&h[b]),i.$$.dirty&4096&&n(13,u=c!=null&&c.length?c.map(R=>({id:R.pub_key,text:R.pub_key})):[]),i.$$.dirty&8192&&n(6,f=[{id:"",text:"Select peer"},...u])},n(1,o=0),n(5,r=0),[x,o,s,l,y,r,f,a,C,g,b,v,c,u,h,p,E,M,P,L]}class AddChannel extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$C,create_fragment$D,safe_not_equal,{activeKey:9,tag:10,type:11,back:0})}}function create_fragment$C(i){let t,n;const s=i[1].default,o=create_slot(s,i,i[0],null);return{c(){t=element("span"),o&&o.c(),attr(t,"class","receive-line-wrap")},m(r,l){insert(r,t,l),o&&o.m(t,null),n=!0},p(r,[l]){o&&o.p&&(!n||l&1)&&update_slot_base(o,s,r,r[0],n?get_slot_changes(s,r[0],l,null):get_all_dirty_from_scope(r[0]),null)},i(r){n||(transition_in(o,r),n=!0)},o(r){transition_out(o,r),n=!1},d(r){r&&detach(t),o&&o.d(r)}}}function instance$B(i,t,n){let{$$slots:s={},$$scope:o}=t;return i.$$set=r=>{"$$scope"in r&&n(0,o=r.$$scope)},[o,s]}class ReceiveLineWrap extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$B,create_fragment$C,safe_not_equal,{})}}function create_fragment$B(i){let t,n;return{c(){t=element("span"),attr(t,"class","receive-line"),attr(t,"style",n=`width: ${i[1]}; background-color: ${i[0]}`)},m(s,o){insert(s,t,o)},p(s,[o]){o&3&&n!==(n=`width: ${s[1]}; background-color: ${s[0]}`)&&attr(t,"style",n)},i:noop$2,o:noop$2,d(s){s&&detach(t)}}}function instance$A(i,t,n){let{color:s="#3ba839"}=t,{width:o="20%"}=t;return i.$$set=r=>{"color"in r&&n(0,s=r.color),"width"in r&&n(1,o=r.width)},[s,o]}class ReceiveLine extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$A,create_fragment$B,safe_not_equal,{color:0,width:1})}}async function getTransactionStatus(i){return await(await fetch(`https://mempool.space/testnet/api/tx/${i}/status`)).json()}async function getBlockTip(){return await(await fetch("https://mempool.space/testnet/api/blocks/tip/height")).json()}const ChannelRows_svelte_svelte_type_style_lang="";function get_each_context$8(i,t,n){const s=i.slice();return s[15]=t[n],s}function create_default_slot_2$3(i){let t,n;return t=new Dot({props:{color:i[15].active?"#52B550":"#ED7474"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p:noop$2,i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_else_block$h(i){let t,n,s,o,r=(i[15].confirmation||0)+"",l,a;return{c(){t=element("div"),n=text("Channel Not Active "),s=element("span"),o=text("("),l=text(r),a=text("/6)"),attr(s,"class",""),attr(t,"class","inactive svelte-1woljrg")},m(c,u){insert(c,t,u),append(t,n),append(t,s),append(s,o),append(s,l),append(s,a)},p:noop$2,i:noop$2,o:noop$2,d(c){c&&detach(t)}}}function create_if_block_2$a(i){let t,n,s,o=formatSatsNumbers(i[15].local_balance)+"",r,l,a,c,u,f=formatSatsNumbers(i[15].remote_balance)+"",h,p;return a=new ReceiveLineWrap({props:{$$slots:{default:[create_default_slot_1$6]},$$scope:{ctx:i}}}),{c(){t=element("div"),n=element("section"),s=element("section"),r=text(o),l=space(),create_component(a.$$.fragment),c=space(),u=element("div"),h=text(f),attr(n,"class","can-receive-wrap"),attr(t,"class","td svelte-1woljrg"),attr(u,"class","td svelte-1woljrg")},m(g,b){insert(g,t,b),append(t,n),append(n,s),append(s,r),append(n,l),mount_component(a,n,null),insert(g,c,b),insert(g,u,b),append(u,h),p=!0},p(g,b){const v={};b&262144&&(v.$$scope={dirty:b,ctx:g}),a.$set(v)},i(g){p||(transition_in(a.$$.fragment,g),p=!0)},o(g){transition_out(a.$$.fragment,g),p=!1},d(g){g&&detach(t),destroy_component(a),g&&detach(c),g&&detach(u)}}}function create_default_slot_1$6(i){let t,n,s,o;return t=new ReceiveLine({props:{color:i[15].color,width:`${i[15].local_percentage}%`}}),s=new ReceiveLine({props:{color:i[15].color,width:`${i[15].remote_percentage}%`}}),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment)},m(r,l){mount_component(t,r,l),insert(r,n,l),mount_component(s,r,l),o=!0},p:noop$2,i(r){o||(transition_in(t.$$.fragment,r),transition_in(s.$$.fragment,r),o=!0)},o(r){transition_out(t.$$.fragment,r),transition_out(s.$$.fragment,r),o=!1},d(r){destroy_component(t,r),r&&detach(n),destroy_component(s,r)}}}function create_if_block$n(i){let t,n,s=i[15].chan_id+"",o,r,l,a,c,u,f,h,p,g,b;function v(){return i[8](i[15])}function y(w){i[9](w)}let S={size:"sm",placeholder:"Close Channel To Address"};i[1]!==void 0&&(S.value=i[1]),a=new TextInput$1({props:S}),binding_callbacks.push(()=>bind(a,"value",y,i[1])),a.$on("click",click_handler_1),f=new Button$1({props:{disabled:!i[1],size:"small",kind:"danger-tertiary",icon:Exit,$$slots:{default:[create_default_slot$e]},$$scope:{ctx:i}}}),f.$on("click",i[5]);let C=i[2]&&create_if_block_1$d();return{c(){t=element("div"),n=element("div"),o=text(s),r=space(),l=element("div"),create_component(a.$$.fragment),u=space(),create_component(f.$$.fragment),h=space(),C&&C.c(),attr(n,"class","row-bottom-scid svelte-1woljrg"),attr(l,"class","row-bottom-text svelte-1woljrg"),attr(t,"class","row-bottom svelte-1woljrg")},m(w,T){insert(w,t,T),append(t,n),append(n,o),append(t,r),append(t,l),mount_component(a,l,null),append(t,u),mount_component(f,t,null),append(t,h),C&&C.m(t,null),p=!0,g||(b=listen(n,"click",stop_propagation(v)),g=!0)},p(w,T){i=w;const A={};!c&&T&2&&(c=!0,A.value=i[1],add_flush_callback(()=>c=!1)),a.$set(A);const x={};T&2&&(x.disabled=!i[1]),T&262144&&(x.$$scope={dirty:T,ctx:i}),f.$set(x),i[2]?C?T&4&&transition_in(C,1):(C=create_if_block_1$d(),C.c(),transition_in(C,1),C.m(t,null)):C&&(group_outros(),transition_out(C,1,1,()=>{C=null}),check_outros())},i(w){p||(transition_in(a.$$.fragment,w),transition_in(f.$$.fragment,w),transition_in(C),p=!0)},o(w){transition_out(a.$$.fragment,w),transition_out(f.$$.fragment,w),transition_out(C),p=!1},d(w){w&&detach(t),destroy_component(a),destroy_component(f),C&&C.d(),g=!1,b()}}}function create_default_slot$e(i){let t;return{c(){t=text("Close")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_1$d(i){let t,n,s;return n=new InlineLoading$1({}),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","loading-wrapper svelte-1woljrg")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_each_block$8(i){let t,n,s,o,r,l,a,c,u,f,h=i[15].remote_pubkey+"",p,g,b,v,y,S,C;o=new DotWrap({props:{$$slots:{default:[create_default_slot_2$3]},$$scope:{ctx:i}}});const w=[create_if_block_2$a,create_else_block$h],T=[];function A(M,P){return M[15].active?0:1}l=A(i),a=T[l]=w[l](i);let x=i[0]===i[15].remote_pubkey&&create_if_block$n(i);function E(){return i[10](i[15])}return{c(){t=element("section"),n=element("div"),s=element("div"),create_component(o.$$.fragment),r=space(),a.c(),c=space(),u=element("div"),f=element("span"),p=text(h),g=space(),x&&x.c(),b=space(),attr(s,"class","td svelte-1woljrg"),attr(f,"class","pubkey svelte-1woljrg"),attr(u,"class","td svelte-1woljrg"),attr(n,"class","row-top svelte-1woljrg"),attr(t,"class",v=null_to_empty(`${i[0]===i[15].remote_pubkey?"selected":""} row`)+" svelte-1woljrg")},m(M,P){insert(M,t,P),append(t,n),append(n,s),mount_component(o,s,null),append(n,r),T[l].m(n,null),append(n,c),append(n,u),append(u,f),append(f,p),append(t,g),x&&x.m(t,null),append(t,b),y=!0,S||(C=listen(t,"click",E),S=!0)},p(M,P){i=M;const L={};P&262144&&(L.$$scope={dirty:P,ctx:i}),o.$set(L),a.p(i,P),i[0]===i[15].remote_pubkey?x?(x.p(i,P),P&1&&transition_in(x,1)):(x=create_if_block$n(i),x.c(),transition_in(x,1),x.m(t,b)):x&&(group_outros(),transition_out(x,1,1,()=>{x=null}),check_outros()),(!y||P&1&&v!==(v=null_to_empty(`${i[0]===i[15].remote_pubkey?"selected":""} row`)+" svelte-1woljrg"))&&attr(t,"class",v)},i(M){y||(transition_in(o.$$.fragment,M),transition_in(a),transition_in(x),y=!0)},o(M){transition_out(o.$$.fragment,M),transition_out(a),transition_out(x),y=!1},d(M){M&&detach(t),destroy_component(o),T[l].d(),x&&x.d(),S=!1,C()}}}function create_fragment$A(i){let t,n,s,o,r,l=i[3].map(getBarCalculation),a=[];for(let u=0;utransition_out(a[u],1,1,()=>{a[u]=null});return{c(){t=element("div"),n=element("section"),n.innerHTML=`
CAN SEND
CAN RECEIVE
-
PEER / ALIAS
`,s=space(),o=element("section");for(let u=0;ui.stopPropagation();function instance$z(i,t,n){let s;component_subscribe(i,channels,C=>n(12,s=C));let{tag:o=""}=t,{onclose:r=(C,w)=>{}}=t,l=s[o],a="",c="";function u(C){C.active&&(a===C.remote_pubkey?(n(0,a=""),n(1,c="")):n(0,a=C.remote_pubkey))}let f=!1;async function h(C){C.stopPropagation(),n(2,f=!0),await r(a,c),n(2,f=!1)}async function p(C){try{const w=C.channel_point.split(":");if(w.length<2)return 0;let T=w[0];const A=await getTransactionStatus(T);return A.confirmed?await getBlockTip()-A.block_height+1:0}catch(w){return console.warn(w),0}}async function g(){let C=[];for(const w of l)if(!w.active){const T=await p(w);C.push({...w,confirmation:T})}}let b;onMount(()=>{g(),b=setInterval(g,5e4)}),onDestroy(()=>{b&&clearInterval(b)});const v=C=>copyText(C.chan_id);function y(C){c=C,n(1,c)}const S=C=>u(C);return i.$$set=C=>{"tag"in C&&n(6,o=C.tag),"onclose"in C&&n(7,r=C.onclose)},[a,c,f,l,u,h,o,r,v,y,S]}class ChannelRows extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$z,create_fragment$A,safe_not_equal,{tag:6,onclose:7})}}const Channels_svelte_svelte_type_style_lang="";function create_if_block_3$6(i){let t,n=formatPubkey(i[3].identity_pubkey)+"",s,o,r,l;return{c(){t=element("div"),s=text(n),attr(t,"class","pubkey svelte-1fiizex"),attr(t,"style",o=`transform:scale(${i[5]?1.1:1});`)},m(a,c){insert(a,t,c),append(t,s),r||(l=listen(t,"click",i[10]),r=!0)},p(a,c){c&8&&n!==(n=formatPubkey(a[3].identity_pubkey)+"")&&set_data(s,n),c&32&&o!==(o=`transform:scale(${a[5]?1.1:1});`)&&attr(t,"style",o)},d(a){a&&detach(t),r=!1,l()}}}function create_default_slot_1$5(i){let t;return{c(){t=text("Peers")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_default_slot$d(i){let t;return{c(){t=text("Channel")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_else_block$g(i){let t;return{c(){t=element("section"),t.innerHTML='

No available channels, click on the add channel button to create one.

',attr(t,"class","no-data-wrap svelte-1fiizex")},m(n,s){insert(n,t,s)},p:noop$2,i:noop$2,o:noop$2,d(n){n&&detach(t)}}}function create_if_block_2$9(i){let t,n;return t=new ChannelRows({props:{tag:i[0],onclose:i[12]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_1$c(i){let t,n,s,o;return t=new AddChannel({props:{back:i[9],activeKey:i[4]?i[4].pub_key:"",tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment),n=space(),s=element("div")},m(r,l){mount_component(t,r,l),insert(r,n,l),insert(r,s,l),o=!0},p(r,l){const a={};l&16&&(a.activeKey=r[4]?r[4].pub_key:""),l&1&&(a.tag=r[0]),l&2&&(a.type=r[1]),t.$set(a)},i(r){o||(transition_in(t.$$.fragment,r),o=!0)},o(r){transition_out(t.$$.fragment,r),o=!1},d(r){destroy_component(t,r),r&&detach(n),r&&detach(s)}}}function create_if_block$m(i){let t,n;return t=new Peers({props:{back:i[8],tag:i[0],type:i[1],newChannel:i[11]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$z(i){let t,n,s,o,r,l,a,c,u,f,h,p,g=formatSatsNumbers(i[7].outbound)+"",b,v,y,S,C,w,T,A,x=formatSatsNumbers(i[7].inbound)+"",E,M,P,L,R,O,B,z,F=i[3]&&i[3].identity_pubkey&&create_if_block_3$6(i);o=new Button$1({props:{kind:"tertiary",type:"submit",size:"field",icon:List,disabled:!1,$$slots:{default:[create_default_slot_1$5]},$$scope:{ctx:i}}}),o.$on("click",i[8]),l=new Button$1({props:{kind:"tertiary",type:"submit",size:"field",icon:Add,class:"channel",disabled:!1,$$slots:{default:[create_default_slot$d]},$$scope:{ctx:i}}}),l.$on("click",i[9]);const q=[create_if_block$m,create_if_block_1$c,create_if_block_2$9,create_else_block$g],N=[];function ee(X,Q){var J,Y;return Q&65&&(R=null),X[2]==="peers"?0:X[2]==="add_channel"?1:(R==null&&(R=!!((J=X[6])!=null&&J.hasOwnProperty(X[0])&&((Y=X[6][X[0]])!=null&&Y.length))),R?2:3)}return O=ee(i,-1),B=N[O]=q[O](i),{c(){t=element("div"),n=element("section"),F&&F.c(),s=space(),create_component(o.$$.fragment),r=space(),create_component(l.$$.fragment),a=space(),c=element("section"),u=element("aside"),f=element("h6"),f.textContent="TOTAL OUTBOUND LIQUIDITY",h=space(),p=element("h3"),b=text(g),v=space(),y=element("span"),y.textContent="SAT",S=space(),C=element("aside"),w=element("h6"),w.textContent="TOTAL INBOUND LIQUIDITY",T=space(),A=element("h3"),E=text(x),M=space(),P=element("span"),P.textContent="SAT",L=space(),B.c(),attr(n,"class","header-btns svelte-1fiizex"),attr(f,"class","title svelte-1fiizex"),attr(y,"class","svelte-1fiizex"),attr(p,"class","value svelte-1fiizex"),attr(u,"class","svelte-1fiizex"),attr(w,"class","title svelte-1fiizex"),attr(P,"class","svelte-1fiizex"),attr(A,"class","value svelte-1fiizex"),attr(C,"class","svelte-1fiizex"),attr(c,"class","liquidity-wrap svelte-1fiizex"),attr(t,"class","wrap svelte-1fiizex")},m(X,Q){insert(X,t,Q),append(t,n),F&&F.m(n,null),append(n,s),mount_component(o,n,null),append(n,r),mount_component(l,n,null),append(t,a),append(t,c),append(c,u),append(u,f),append(u,h),append(u,p),append(p,b),append(p,v),append(p,y),append(c,S),append(c,C),append(C,w),append(C,T),append(C,A),append(A,E),append(A,M),append(A,P),append(t,L),N[O].m(t,null),z=!0},p(X,[Q]){X[3]&&X[3].identity_pubkey?F?F.p(X,Q):(F=create_if_block_3$6(X),F.c(),F.m(n,s)):F&&(F.d(1),F=null);const J={};Q&67108864&&(J.$$scope={dirty:Q,ctx:X}),o.$set(J);const Y={};Q&67108864&&(Y.$$scope={dirty:Q,ctx:X}),l.$set(Y),(!z||Q&128)&&g!==(g=formatSatsNumbers(X[7].outbound)+"")&&set_data(b,g),(!z||Q&128)&&x!==(x=formatSatsNumbers(X[7].inbound)+"")&&set_data(E,x);let ce=O;O=ee(X,Q),O===ce?N[O].p(X,Q):(group_outros(),transition_out(N[ce],1,1,()=>{N[ce]=null}),check_outros(),B=N[O],B?B.p(X,Q):(B=N[O]=q[O](X),B.c()),transition_in(B,1),B.m(t,null))},i(X){z||(transition_in(o.$$.fragment,X),transition_in(l.$$.fragment,X),transition_in(B),z=!0)},o(X){transition_out(o.$$.fragment,X),transition_out(l.$$.fragment,X),transition_out(B),z=!1},d(X){X&&detach(t),F&&F.d(),destroy_component(o),destroy_component(l),N[O].d()}}}function formatPubkey(i){return`${i.substring(0,6)}...${i.substring(i.length-6)}`}function instance$y(i,t,n){let s,o,r,l,a,c;component_subscribe(i,channels,B=>n(6,o=B)),component_subscribe(i,finishedOnboarding,B=>n(13,r=B)),component_subscribe(i,isOnboarding,B=>n(17,l=B)),component_subscribe(i,peers,B=>n(14,a=B)),component_subscribe(i,channelBalances,B=>n(7,c=B));let{tag:u=""}=t,{type:f=""}=t;function h(){l&&(r.hasBalance&&!r.hasPeers?n(2,p="peers"):r.hasBalance&&r.hasPeers&&!r.hasChannels&&n(2,p="add_channel"))}let p="main",g,b=null,v;async function y(){const B=await get_info$1(u);n(3,g=B)}async function S(){const B=await get_info(u);n(3,g=await parseClnGetInfo(B))}async function C(){const B=await getLndPendingAndActiveChannels(u);channels.update(z=>({...z,[u]:B}))}async function w(){if(s&&s.length)return;const B=await list_peers$1(u);B&&peers.update(z=>({...z,[u]:B.peers}))}async function T(){let B=await list_peer_channels(u);const z=parseClnListPeerChannelsRes(B),F=await list_peers(u);if(!F)return;const q=await parseClnListPeerRes(F);peers.update(N=>({...N,[u]:q})),channels.update(N=>({...N,[u]:z}))}async function A(B,z){z==="Cln"?(await S(),await T()):(await y(),await C(),await w())}function x(){n(4,b=null),p==="peers"?n(2,p="main"):n(2,p="peers")}function E(){p==="add_channel"?(n(2,p="main"),n(4,b=null)):n(2,p="add_channel")}let M=!1;function P(){navigator.clipboard.writeText(g.identity_pubkey),n(5,M=!0),setTimeout(()=>n(5,M=!1),150)}function L(B){n(4,b=B),E()}async function R(B,z){f==="Cln"?await close_channel(u,B,z):console.log("ERROR: lnd does not support close yet")}async function O(){let B=[];if(f==="Cln"){const z=await list_peer_channels(u);B=await parseClnListPeerChannelsRes(z)}else B=await getLndPendingAndActiveChannels(u);JSON.stringify(B)!==JSON.stringify(o[u])&&channels.update(z=>({...z,[u]:B}))}return onMount(()=>{O(),v=setInterval(O,1e4)}),onDestroy(()=>{v&&clearInterval(v)}),i.$$set=B=>{"tag"in B&&n(0,u=B.tag),"type"in B&&n(1,f=B.type)},i.$$.update=()=>{i.$$.dirty&3&&A(u,f),i.$$.dirty&16385&&(s=a&&a[u]),i.$$.dirty&8192&&h()},[u,f,p,g,b,M,o,c,x,E,P,L,R,r,a]}class Channels extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$y,create_fragment$z,safe_not_equal,{tag:0,type:1})}}const AddInvoice_svelte_svelte_type_style_lang="";function create_default_slot_1$4(i){let t;return{c(){t=text("New Invoice")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block$l(i){let t,n,s,o,r,l,a,c,u,f;return o=new Lib({props:{size:256,padding:1.5,value:i[1]}}),u=new Button$1({props:{kind:"tertiary",class:"invoice-btn",$$slots:{default:[create_default_slot$c]},$$scope:{ctx:i}}}),u.$on("click",i[8]),{c(){t=element("section"),n=element("p"),n.textContent="Invoice QR code",s=space(),create_component(o.$$.fragment),r=space(),l=element("div"),a=text(i[1]),c=space(),create_component(u.$$.fragment),attr(n,"class","invoice-title svelte-1dqkomr"),attr(l,"class","invoice svelte-1dqkomr"),attr(t,"class","invoice-data svelte-1dqkomr")},m(h,p){insert(h,t,p),append(t,n),append(t,s),mount_component(o,t,null),append(t,r),append(t,l),append(l,a),append(t,c),mount_component(u,t,null),f=!0},p(h,p){const g={};p&2&&(g.value=h[1]),o.$set(g),(!f||p&2)&&set_data(a,h[1]);const b={};p&512&&(b.$$scope={dirty:p,ctx:h}),u.$set(b)},i(h){f||(transition_in(o.$$.fragment,h),transition_in(u.$$.fragment,h),f=!0)},o(h){transition_out(o.$$.fragment,h),transition_out(u.$$.fragment,h),f=!1},d(h){h&&detach(t),destroy_component(o),destroy_component(u)}}}function create_default_slot$c(i){let t;return{c(){t=text("Copy Invoice")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_fragment$y(i){let t,n,s,o,r,l,a,c,u,f,h;function p(v){i[7](v)}let g={labelText:"Amount (satoshis)",placeholder:"Enter invoice amount",type:"number"};i[0]!==void 0&&(g.value=i[0]),s=new TextInput$1({props:g}),binding_callbacks.push(()=>bind(s,"value",p,i[0])),u=new Button$1({props:{kind:"tertiary",type:"submit",size:"field",icon:Add,class:"channel",disabled:i[2],$$slots:{default:[create_default_slot_1$4]},$$scope:{ctx:i}}}),u.$on("click",i[3]);let b=i[1]&&create_if_block$l(i);return{c(){t=element("main"),n=element("section"),create_component(s.$$.fragment),r=space(),l=element("div"),a=space(),c=element("center"),create_component(u.$$.fragment),f=space(),b&&b.c(),attr(l,"class","spacer"),attr(n,"class","invoice-wrap svelte-1dqkomr"),attr(t,"class","svelte-1dqkomr")},m(v,y){insert(v,t,y),append(t,n),mount_component(s,n,null),append(n,r),append(n,l),append(n,a),append(n,c),mount_component(u,c,null),append(t,f),b&&b.m(t,null),h=!0},p(v,[y]){const S={};!o&&y&1&&(o=!0,S.value=v[0],add_flush_callback(()=>o=!1)),s.$set(S);const C={};y&4&&(C.disabled=v[2]),y&512&&(C.$$scope={dirty:y,ctx:v}),u.$set(C),v[1]?b?(b.p(v,y),y&2&&transition_in(b,1)):(b=create_if_block$l(v),b.c(),transition_in(b,1),b.m(t,null)):b&&(group_outros(),transition_out(b,1,1,()=>{b=null}),check_outros())},i(v){h||(transition_in(s.$$.fragment,v),transition_in(u.$$.fragment,v),transition_in(b),h=!0)},o(v){transition_out(s.$$.fragment,v),transition_out(u.$$.fragment,v),transition_out(b),h=!1},d(v){v&&detach(t),destroy_component(s),destroy_component(u),b&&b.d()}}}function copyToClipboard(i){navigator.clipboard.writeText(i)}function instance$x(i,t,n){let s,o,r,l;component_subscribe(i,activeInvoice,p=>n(6,l=p));let{tag:a=""}=t,{type:c=""}=t;async function u(){if(c==="Cln"){const p=await add_invoice(a,convertSatsToMilliSats(s));p&&activeInvoice.update(g=>({...g,[a]:p.bolt11}))}else{const p=await add_invoice$1(a,s);p&&activeInvoice.update(g=>({...g,[a]:p.payment_request}))}}function f(p){s=p,n(0,s)}const h=()=>copyToClipboard(r);return i.$$set=p=>{"tag"in p&&n(4,a=p.tag),"type"in p&&n(5,c=p.type)},i.$$.update=()=>{i.$$.dirty&1&&n(2,o=!s),i.$$.dirty&80&&n(1,r=l[a]||"")},n(0,s=0),[s,r,o,u,a,c,l,f,h]}class AddInvoice extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$x,create_fragment$y,safe_not_equal,{tag:4,type:5})}}const PayInvoice_svelte_svelte_type_style_lang="";function create_if_block$k(i){let t,n;return t=new InlineNotification$1({props:{lowContrast:!0,kind:i[3]?"success":"error",title:i[3]?"Success:":"Error:",subtitle:i[2],timeout:3e3}}),t.$on("close",i[8]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&8&&(r.kind=s[3]?"success":"error"),o&8&&(r.title=s[3]?"Success:":"Error:"),o&4&&(r.subtitle=s[2]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot$b(i){let t;return{c(){t=text("Pay Invoice")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_fragment$x(i){let t,n,s,o,r,l,a,c,u,f,h,p=i[1]&&create_if_block$k(i);function g(v){i[9](v)}let b={labelText:"Invoice Payment Request",placeholder:"Enter the payment request of the invoice",rows:5};return i[0]!==void 0&&(b.value=i[0]),o=new TextArea$1({props:b}),binding_callbacks.push(()=>bind(o,"value",g,i[0])),f=new Button$1({props:{kind:"tertiary",type:"submit",size:"field",icon:Money,class:"channel",disabled:i[4],$$slots:{default:[create_default_slot$b]},$$scope:{ctx:i}}}),f.$on("click",i[5]),{c(){t=element("main"),n=element("section"),p&&p.c(),s=space(),create_component(o.$$.fragment),l=space(),a=element("div"),c=space(),u=element("center"),create_component(f.$$.fragment),attr(a,"class","spacer"),attr(n,"class","invoice-wrap svelte-uw49d1"),attr(t,"class","svelte-uw49d1")},m(v,y){insert(v,t,y),append(t,n),p&&p.m(n,null),append(n,s),mount_component(o,n,null),append(n,l),append(n,a),append(n,c),append(n,u),mount_component(f,u,null),h=!0},p(v,[y]){v[1]?p?(p.p(v,y),y&2&&transition_in(p,1)):(p=create_if_block$k(v),p.c(),transition_in(p,1),p.m(n,s)):p&&(group_outros(),transition_out(p,1,1,()=>{p=null}),check_outros());const S={};!r&&y&1&&(r=!0,S.value=v[0],add_flush_callback(()=>r=!1)),o.$set(S);const C={};y&16&&(C.disabled=v[4]),y&1024&&(C.$$scope={dirty:y,ctx:v}),f.$set(C)},i(v){h||(transition_in(p),transition_in(o.$$.fragment,v),transition_in(f.$$.fragment,v),h=!0)},o(v){transition_out(p),transition_out(o.$$.fragment,v),transition_out(f.$$.fragment,v),h=!1},d(v){v&&detach(t),p&&p.d(),destroy_component(o),destroy_component(f)}}}function instance$w(i,t,n){let s,o,{tag:r=""}=t,{type:l=""}=t,a=!1,c="",u=!1;async function f(){if(l==="Cln"){const g=await pay_invoice(r,s);n(1,a=!0),g.status===0?(n(3,u=!0),n(2,c="Invoice payment has been made."),n(0,s=""),setTimeout(async()=>{const b=await list_peer_channels(r),v=parseClnListPeerChannelsRes(b);channels.update(y=>({...y,[r]:v}))},2e3)):(n(3,u=!1),n(0,s=""),g.status===1&&n(2,c="Invoice payment is pending"),g.status===2&&n(2,c="Invoice payment failed"))}else{const g=await pay_invoice$1(r,s);if(n(1,a=!0),g.payment_error)n(3,u=!1),n(2,c=g.payment_error),n(0,s="");else{n(0,s=""),n(3,u=!0),n(2,c="Invoice payment has been made.");const b=await getLndPendingAndActiveChannels(r);channels.update(v=>({...v,[r]:b}))}}}const h=g=>{g.preventDefault(),n(1,a=!1)};function p(g){s=g,n(0,s)}return i.$$set=g=>{"tag"in g&&n(6,r=g.tag),"type"in g&&n(7,l=g.type)},i.$$.update=()=>{i.$$.dirty&1&&n(4,o=!s)},n(0,s=""),[s,a,c,u,o,f,r,l,h,p]}class PayInvoice extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$w,create_fragment$x,safe_not_equal,{tag:6,type:7})}}const PayKeysend_svelte_svelte_type_style_lang="";function create_if_block$j(i){let t,n;return t=new InlineNotification$1({props:{lowContrast:!0,kind:i[3]?"error":"success",title:i[3]?"Failure:":"Success:",subtitle:i[3]||"Keysend payment has been made.",timeout:4e3}}),t.$on("close",i[8]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&8&&(r.kind=s[3]?"error":"success"),o&8&&(r.title=s[3]?"Failure:":"Success:"),o&8&&(r.subtitle=s[3]||"Keysend payment has been made."),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot$a(i){let t;return{c(){t=text("Pay Keysend")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_fragment$w(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S=i[2]&&create_if_block$j(i);function C(x){i[9](x)}let w={labelText:"Pubkey",placeholder:"Destintaion Public Key"};i[1]!==void 0&&(w.value=i[1]),o=new TextInput$1({props:w}),binding_callbacks.push(()=>bind(o,"value",C,i[1]));function T(x){i[10](x)}let A={labelText:"Amount (satoshis)",placeholder:"Enter amount",type:"number"};return i[0]!==void 0&&(A.value=i[0]),u=new TextInput$1({props:A}),binding_callbacks.push(()=>bind(u,"value",T,i[0])),v=new Button$1({props:{kind:"tertiary",type:"submit",size:"field",icon:Money,class:"channel",disabled:i[4],$$slots:{default:[create_default_slot$a]},$$scope:{ctx:i}}}),v.$on("click",i[5]),{c(){t=element("main"),n=element("section"),S&&S.c(),s=space(),create_component(o.$$.fragment),l=space(),a=element("div"),c=space(),create_component(u.$$.fragment),h=space(),p=element("div"),g=space(),b=element("center"),create_component(v.$$.fragment),attr(a,"class","spacer"),attr(p,"class","spacer"),attr(n,"class","invoice-wrap svelte-uw49d1"),attr(t,"class","svelte-uw49d1")},m(x,E){insert(x,t,E),append(t,n),S&&S.m(n,null),append(n,s),mount_component(o,n,null),append(n,l),append(n,a),append(n,c),mount_component(u,n,null),append(n,h),append(n,p),append(n,g),append(n,b),mount_component(v,b,null),y=!0},p(x,[E]){x[2]?S?(S.p(x,E),E&4&&transition_in(S,1)):(S=create_if_block$j(x),S.c(),transition_in(S,1),S.m(n,s)):S&&(group_outros(),transition_out(S,1,1,()=>{S=null}),check_outros());const M={};!r&&E&2&&(r=!0,M.value=x[1],add_flush_callback(()=>r=!1)),o.$set(M);const P={};!f&&E&1&&(f=!0,P.value=x[0],add_flush_callback(()=>f=!1)),u.$set(P);const L={};E&16&&(L.disabled=x[4]),E&2048&&(L.$$scope={dirty:E,ctx:x}),v.$set(L)},i(x){y||(transition_in(S),transition_in(o.$$.fragment,x),transition_in(u.$$.fragment,x),transition_in(v.$$.fragment,x),y=!0)},o(x){transition_out(S),transition_out(o.$$.fragment,x),transition_out(u.$$.fragment,x),transition_out(v.$$.fragment,x),y=!1},d(x){x&&detach(t),S&&S.d(),destroy_component(o),destroy_component(u),destroy_component(v)}}}function instance$v(i,t,n){let s,o,r,{tag:l=""}=t,{type:a=""}=t,c=!1,u="";async function f(){if(a==="Cln")await keysend(l,s,convertSatsToMilliSats(o),window.route_hint,window.maxfeepercent,window.exemptfee)?(n(2,c=!0),n(3,u=""),n(1,s=""),n(0,o=0),setTimeout(async()=>{const v=await list_peer_channels(l),y=await parseClnListPeerChannelsRes(v);v&&channels.update(S=>({...S,[l]:y}))},2e3)):(n(2,c=!0),n(3,u="keysend was declined"));else{const b=await keysend$1(l,s,o,window.tlvs);if(b){b.payment_error?n(3,u=b.payment_error):n(3,u=""),n(2,c=!0),n(1,s=""),n(0,o=0);const v=await getLndPendingAndActiveChannels(l);channels.update(y=>({...y,[l]:v}))}}}const h=b=>{b.preventDefault(),n(2,c=!1)};function p(b){s=b,n(1,s)}function g(b){o=b,n(0,o)}return i.$$set=b=>{"tag"in b&&n(6,l=b.tag),"type"in b&&n(7,a=b.type)},i.$$.update=()=>{i.$$.dirty&3&&n(4,r=!s||!o||s&&s.length!==66)},n(1,s=""),n(0,o=0),[o,s,c,u,r,f,l,a,h,p,g]}class PayKeysend extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$v,create_fragment$w,safe_not_equal,{tag:6,type:7})}}const transaction_svelte_svelte_type_style_lang="";function create_else_block$f(i){let t,n,s,o,r,l,a;n=new DataTable$1({props:{headers:[{key:"index",value:"Index"},{key:"invoice",value:"Invoice"},{key:"date",value:"Date"},{key:"amount",value:"Amount"}],rows:i[3],pageSize:i[1],page:i[2]}});function c(h){i[6](h)}function u(h){i[7](h)}let f={totalItems:i[3].length,pageSizeInputDisabled:!0};return i[1]!==void 0&&(f.pageSize=i[1]),i[2]!==void 0&&(f.page=i[2]),o=new Pagination$1({props:f}),binding_callbacks.push(()=>bind(o,"pageSize",c,i[1])),binding_callbacks.push(()=>bind(o,"page",u,i[2])),{c(){t=element("div"),create_component(n.$$.fragment),s=space(),create_component(o.$$.fragment)},m(h,p){insert(h,t,p),mount_component(n,t,null),append(t,s),mount_component(o,t,null),a=!0},p(h,p){const g={};p&8&&(g.rows=h[3]),p&2&&(g.pageSize=h[1]),p&4&&(g.page=h[2]),n.$set(g);const b={};p&8&&(b.totalItems=h[3].length),!r&&p&2&&(r=!0,b.pageSize=h[1],add_flush_callback(()=>r=!1)),!l&&p&4&&(l=!0,b.page=h[2],add_flush_callback(()=>l=!1)),o.$set(b)},i(h){a||(transition_in(n.$$.fragment,h),transition_in(o.$$.fragment,h),a=!0)},o(h){transition_out(n.$$.fragment,h),transition_out(o.$$.fragment,h),a=!1},d(h){h&&detach(t),destroy_component(n),destroy_component(o)}}}function create_if_block_1$b(i){let t,n,s,o,r;return{c(){t=element("div"),n=element("p"),s=text("No "),o=text(i[0]),r=text(" transactions yet!!..."),attr(n,"class","svelte-7nhysw"),attr(t,"class","message svelte-7nhysw")},m(l,a){insert(l,t,a),append(t,n),append(n,s),append(n,o),append(n,r)},p(l,a){a&1&&set_data(o,l[0])},i:noop$2,o:noop$2,d(l){l&&detach(t)}}}function create_if_block$i(i){let t,n,s,o,r;return n=new Loading$1({props:{withOverlay:!1}}),{c(){t=element("div"),create_component(n.$$.fragment),s=space(),o=element("p"),o.textContent="Loading Transactions...",attr(o,"class","svelte-7nhysw"),attr(t,"class","loader svelte-7nhysw")},m(l,a){insert(l,t,a),mount_component(n,t,null),append(t,s),append(t,o),r=!0},p:noop$2,i(l){r||(transition_in(n.$$.fragment,l),r=!0)},o(l){transition_out(n.$$.fragment,l),r=!1},d(l){l&&detach(t),destroy_component(n)}}}function create_fragment$v(i){let t,n,s,o;const r=[create_if_block$i,create_if_block_1$b,create_else_block$f],l=[];function a(c,u){return c[3]===null?0:c[3].length===0?1:2}return n=a(i),s=l[n]=r[n](i),{c(){t=element("main"),s.c(),attr(t,"class","svelte-7nhysw")},m(c,u){insert(c,t,u),l[n].m(t,null),o=!0},p(c,[u]){let f=n;n=a(c),n===f?l[n].p(c,u):(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),s=l[n],s?s.p(c,u):(s=l[n]=r[n](c),s.c()),transition_in(s,1),s.m(t,null))},i(c){o||(transition_in(s),o=!0)},o(c){transition_out(s),o=!1},d(c){c&&detach(t),l[n].d()}}}function instance$u(i,t,n){let s,{tag:o=""}=t,{type:r=""}=t,{paymentType:l=""}=t,a=5,c=1,u="";async function f(){if(r==="Cln"){const y=await list_pays(o),S=parseClnPayments(y.payments);n(3,s=[...S])}else{const y=await list_payments(o),S=parseLndPayments(y);n(3,s=[...S])}}function h(){o!==u&&(g(),u=o)}async function p(){if(r==="Cln"){const y=await list_invoices(o),S=parseClnInvoices(y.invoices);n(3,s=[...S])}else{const y=await list_invoices$1(o),S=parseLndInvoices(y);n(3,s=[...S])}}function g(){l==="sent"?f():p()}onMount(()=>{g(),u=o});function b(y){a=y,n(1,a)}function v(y){c=y,n(2,c)}return i.$$set=y=>{"tag"in y&&n(4,o=y.tag),"type"in y&&n(5,r=y.type),"paymentType"in y&&n(0,l=y.paymentType)},i.$$.update=()=>{i.$$.dirty&16&&h()},n(3,s=null),[l,a,c,s,o,r,b,v]}class Transaction extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$u,create_fragment$v,safe_not_equal,{tag:4,type:5,paymentType:0})}}const PaymentHistory_svelte_svelte_type_style_lang="";function create_default_slot_2$2(i){let t,n,s,o;return t=new Tab$1({props:{label:"Sent Payments"}}),s=new Tab$1({props:{label:"Recieved Payments"}}),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment)},m(r,l){mount_component(t,r,l),insert(r,n,l),mount_component(s,r,l),o=!0},p:noop$2,i(r){o||(transition_in(t.$$.fragment,r),transition_in(s.$$.fragment,r),o=!0)},o(r){transition_out(t.$$.fragment,r),transition_out(s.$$.fragment,r),o=!1},d(r){destroy_component(t,r),r&&detach(n),destroy_component(s,r)}}}function create_default_slot_1$3(i){let t,n;return t=new Transaction({props:{tag:i[0],type:i[1],paymentType:"sent"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot$9(i){let t,n;return t=new Transaction({props:{tag:i[0],type:i[1],paymentType:"recieved"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_content_slot$1(i){let t,n,s,o;return t=new TabContent$1({props:{$$slots:{default:[create_default_slot_1$3]},$$scope:{ctx:i}}}),s=new TabContent$1({props:{$$slots:{default:[create_default_slot$9]},$$scope:{ctx:i}}}),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment)},m(r,l){mount_component(t,r,l),insert(r,n,l),mount_component(s,r,l),o=!0},p(r,l){const a={};l&7&&(a.$$scope={dirty:l,ctx:r}),t.$set(a);const c={};l&7&&(c.$$scope={dirty:l,ctx:r}),s.$set(c)},i(r){o||(transition_in(t.$$.fragment,r),transition_in(s.$$.fragment,r),o=!0)},o(r){transition_out(t.$$.fragment,r),transition_out(s.$$.fragment,r),o=!1},d(r){destroy_component(t,r),r&&detach(n),destroy_component(s,r)}}}function create_fragment$u(i){let t,n,s;return n=new Tabs$1({props:{$$slots:{content:[create_content_slot$1],default:[create_default_slot_2$2]},$$scope:{ctx:i}}}),{c(){t=element("main"),create_component(n.$$.fragment),attr(t,"class","svelte-1x7kcz3")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},p(o,[r]){const l={};r&7&&(l.$$scope={dirty:r,ctx:o}),n.$set(l)},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function instance$t(i,t,n){let{tag:s=""}=t,{type:o=""}=t;return i.$$set=r=>{"tag"in r&&n(0,s=r.tag),"type"in r&&n(1,o=r.type)},[s,o]}class PaymentHistory extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$t,create_fragment$u,safe_not_equal,{tag:0,type:1})}}const Invoices_svelte_svelte_type_style_lang="";function get_each_context$7(i,t,n){const s=i.slice();return s[5]=t[n],s}function create_default_slot$8(i){let t=i[5].label+"",n;return{c(){n=text(t)},m(s,o){insert(s,n,o)},p:noop$2,d(s){s&&detach(n)}}}function create_each_block$7(i){let t,n;function s(){return i[4](i[5])}return t=new Button$1({props:{size:"field",kind:"tertiary",$$slots:{default:[create_default_slot$8]},$$scope:{ctx:i}}}),t.$on("click",s),{c(){create_component(t.$$.fragment)},m(o,r){mount_component(t,o,r),n=!0},p(o,r){i=o;const l={};r&256&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(o){n||(transition_in(t.$$.fragment,o),n=!0)},o(o){transition_out(t.$$.fragment,o),n=!1},d(o){destroy_component(t,o)}}}function create_else_block$e(i){let t,n;return t=new PayKeysend({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_2$8(i){let t,n;return t=new PaymentHistory({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_1$a(i){let t,n;return t=new PayInvoice({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block$h(i){let t,n;return t=new AddInvoice({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$t(i){let t,n,s,o,r,l,a=i[3],c=[];for(let g=0;gtransition_out(c[g],1,1,()=>{c[g]=null}),f=[create_if_block$h,create_if_block_1$a,create_if_block_2$8,create_else_block$e],h=[];function p(g,b){return g[2]==="add"?0:g[2]==="pay"?1:g[2]==="history"?2:3}return s=p(i),o=h[s]=f[s](i),{c(){t=element("div");for(let g=0;g{h[v]=null}),check_outros(),o=h[s],o?o.p(g,b):(o=h[s]=f[s](g),o.c()),transition_in(o,1),o.m(r.parentNode,r))},i(g){if(!l){for(let b=0;bn(2,s=c.page);return i.$$set=c=>{"tag"in c&&n(0,o=c.tag),"type"in c&&n(1,r=c.type)},[o,r,s,l,a]}class Invoices extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$s,create_fragment$t,safe_not_equal,{tag:0,type:1})}}const Onchain_svelte_svelte_type_style_lang="";function create_default_slot$7(i){let t;return{c(){t=text("Generate Address")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_fragment$s(i){let t,n,s,o,r,l=(i[2][i[0]]||0)+"",a,c,u,f,h,p,g,b,v,y,S,C,w,T,A,x,E,M,P,L,R,O=(i[3][i[0]]||0)+"",B,z,F,q;return C=new Copy({props:{class:"copy-icon",size:24}}),x=new Button$1({props:{size:"field",icon:Add,$$slots:{default:[create_default_slot$7]},$$scope:{ctx:i}}}),x.$on("click",i[4]),{c(){t=element("div"),n=element("div"),s=element("p"),s.textContent="Confirmed Balance:",o=space(),r=element("p"),a=text(l),c=space(),u=element("aside"),f=element("div"),h=element("section"),p=element("label"),p.textContent="Address (Generate or copy address)",g=space(),b=element("aside"),v=element("input"),y=space(),S=element("button"),create_component(C.$$.fragment),w=space(),T=element("aside"),A=space(),create_component(x.$$.fragment),E=space(),M=element("div"),P=element("p"),P.textContent="Unconfirmed Balance:",L=space(),R=element("p"),B=text(O),attr(s,"class","confirmed_balance svelte-1s7xjxx"),attr(r,"class","confirmed_amount svelte-1s7xjxx"),attr(n,"class","confirmed_balance_container svelte-1s7xjxx"),attr(p,"for","address"),attr(p,"class","svelte-1s7xjxx"),attr(v,"name","address"),attr(v,"placeholder","Address"),v.readOnly=!0,attr(v,"class","svelte-1s7xjxx"),attr(S,"class","copy-btn svelte-1s7xjxx"),attr(b,"class","data-wrap svelte-1s7xjxx"),attr(h,"class","input-wrap svelte-1s7xjxx"),attr(f,"class","address svelte-1s7xjxx"),attr(T,"class","spacer"),attr(u,"class","address-wrap svelte-1s7xjxx"),attr(P,"class","unconfirmed_balance svelte-1s7xjxx"),attr(R,"class","unconfirmed_amount svelte-1s7xjxx"),attr(M,"class","unconfirmed_balance_container svelte-1s7xjxx"),attr(t,"class","wrap svelte-1s7xjxx")},m(N,ee){insert(N,t,ee),append(t,n),append(n,s),append(n,o),append(n,r),append(r,a),append(t,c),append(t,u),append(u,f),append(f,h),append(h,p),append(h,g),append(h,b),append(b,v),set_input_value(v,i[1]),append(b,y),append(b,S),mount_component(C,S,null),append(u,w),append(u,T),append(u,A),mount_component(x,u,null),append(t,E),append(t,M),append(M,P),append(M,L),append(M,R),append(R,B),z=!0,F||(q=[listen(v,"input",i[8]),listen(S,"click",i[5])],F=!0)},p(N,[ee]){(!z||ee&5)&&l!==(l=(N[2][N[0]]||0)+"")&&set_data(a,l),ee&2&&v.value!==N[1]&&set_input_value(v,N[1]);const X={};ee&16384&&(X.$$scope={dirty:ee,ctx:N}),x.$set(X),(!z||ee&9)&&O!==(O=(N[3][N[0]]||0)+"")&&set_data(B,O)},i(N){z||(transition_in(C.$$.fragment,N),transition_in(x.$$.fragment,N),z=!0)},o(N){transition_out(C.$$.fragment,N),transition_out(x.$$.fragment,N),z=!1},d(N){N&&detach(t),destroy_component(C),destroy_component(x),F=!1,run_all(q)}}}function instance$r(i,t,n){let s,o,r,l,a;component_subscribe(i,lightningAddresses,S=>n(7,o=S)),component_subscribe(i,finishedOnboarding,S=>n(10,r=S)),component_subscribe(i,lndBalances,S=>n(2,l=S)),component_subscribe(i,unconfirmedBalance,S=>n(3,a=S));let{tag:c=""}=t,{type:u=""}=t,f;async function h(){let S;u==="Cln"?S=await new_address(c):(S=await new_address$1(c),S&&!r.hasChannels&&onChainAddressGeneratedForOnboarding.update(()=>!0)),S&&lightningAddresses.update(C=>({...C,[c]:S}))}onMount(()=>{p(),f=setInterval(p,2e4)}),onDestroy(()=>{f&&clearInterval(f)});async function p(){if(u==="Lnd"){const S=await get_balance(c);g(S==null?void 0:S.confirmed_balance),b(S==null?void 0:S.unconfirmed_balance)}else if(u==="Cln"){const S=await list_funds(c),C=await list_peer_channels(c),w=parseClnListFunds(S,C),T=parseUnconfirmedClnBalance(S);g(w),b(T)}}function g(S){lndBalances.hasOwnProperty(c)&&lndBalances[c]===S||lndBalances.update(C=>({...C,[c]:S}))}function b(S){unconfirmedBalance.hasOwnProperty(c)&&unconfirmedBalance[c]===S||unconfirmedBalance.update(C=>({...C,[c]:S}))}function v(){navigator.clipboard.writeText(s),copiedAddressForOnboarding.update(()=>!0)}function y(){s=this.value,n(1,s),n(7,o),n(0,c)}return i.$$set=S=>{"tag"in S&&n(0,c=S.tag),"type"in S&&n(6,u=S.type)},i.$$.update=()=>{i.$$.dirty&129&&n(1,s=o[c])},[c,s,l,a,h,v,u,o,y]}class Onchain extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$r,create_fragment$s,safe_not_equal,{tag:0,type:6})}}const FirstConnect_svelte_svelte_type_style_lang="";function create_fragment$r(i){let t,n,s,o,r,l,a,c,u,f,h,p,g=i[0].network+"",b,v,y,S,C,w,T;return S=new Lib({props:{size:256,padding:4,value:i[2](i[1],i[0].network)}}),{c(){t=element("div"),n=element("div"),n.textContent="Connect your Signer:",s=space(),o=element("div"),r=element("div"),l=element("div"),l.innerHTML=`MQTT URL: +
PEER / ALIAS
`,s=space(),o=element("section");for(let u=0;ui.stopPropagation();function instance$z(i,t,n){let s;component_subscribe(i,channels,C=>n(12,s=C));let{tag:o=""}=t,{onclose:r=(C,w)=>{}}=t,l=s[o],a="",c="";function u(C){C.active&&(a===C.remote_pubkey?(n(0,a=""),n(1,c="")):n(0,a=C.remote_pubkey))}let f=!1;async function h(C){C.stopPropagation(),n(2,f=!0),await r(a,c),n(2,f=!1)}async function p(C){try{const w=C.channel_point.split(":");if(w.length<2)return 0;let T=w[0];const A=await getTransactionStatus(T);return A.confirmed?await getBlockTip()-A.block_height+1:0}catch(w){return console.warn(w),0}}async function g(){let C=[];for(const w of l)if(!w.active){const T=await p(w);C.push({...w,confirmation:T})}}let b;onMount(()=>{g(),b=setInterval(g,5e4)}),onDestroy(()=>{b&&clearInterval(b)});const v=C=>copyText(C.chan_id);function y(C){c=C,n(1,c)}const S=C=>u(C);return i.$$set=C=>{"tag"in C&&n(6,o=C.tag),"onclose"in C&&n(7,r=C.onclose)},[a,c,f,l,u,h,o,r,v,y,S]}class ChannelRows extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$z,create_fragment$A,safe_not_equal,{tag:6,onclose:7})}}const Channels_svelte_svelte_type_style_lang="";function create_if_block_3$6(i){let t,n=formatPubkey(i[3].identity_pubkey)+"",s,o,r,l;return{c(){t=element("div"),s=text(n),attr(t,"class","pubkey svelte-1fiizex"),attr(t,"style",o=`transform:scale(${i[5]?1.1:1});`)},m(a,c){insert(a,t,c),append(t,s),r||(l=listen(t,"click",i[10]),r=!0)},p(a,c){c&8&&n!==(n=formatPubkey(a[3].identity_pubkey)+"")&&set_data(s,n),c&32&&o!==(o=`transform:scale(${a[5]?1.1:1});`)&&attr(t,"style",o)},d(a){a&&detach(t),r=!1,l()}}}function create_default_slot_1$5(i){let t;return{c(){t=text("Peers")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_default_slot$d(i){let t;return{c(){t=text("Channel")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_else_block$g(i){let t;return{c(){t=element("section"),t.innerHTML='

No available channels, click on the add channel button to create one.

',attr(t,"class","no-data-wrap svelte-1fiizex")},m(n,s){insert(n,t,s)},p:noop$2,i:noop$2,o:noop$2,d(n){n&&detach(t)}}}function create_if_block_2$9(i){let t,n;return t=new ChannelRows({props:{tag:i[0],onclose:i[12]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_1$c(i){let t,n,s,o;return t=new AddChannel({props:{back:i[9],activeKey:i[4]?i[4].pub_key:"",tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment),n=space(),s=element("div")},m(r,l){mount_component(t,r,l),insert(r,n,l),insert(r,s,l),o=!0},p(r,l){const a={};l&16&&(a.activeKey=r[4]?r[4].pub_key:""),l&1&&(a.tag=r[0]),l&2&&(a.type=r[1]),t.$set(a)},i(r){o||(transition_in(t.$$.fragment,r),o=!0)},o(r){transition_out(t.$$.fragment,r),o=!1},d(r){destroy_component(t,r),r&&detach(n),r&&detach(s)}}}function create_if_block$m(i){let t,n;return t=new Peers({props:{back:i[8],tag:i[0],type:i[1],newChannel:i[11]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$z(i){let t,n,s,o,r,l,a,c,u,f,h,p,g=formatSatsNumbers(i[7].outbound)+"",b,v,y,S,C,w,T,A,x=formatSatsNumbers(i[7].inbound)+"",E,M,P,L,R,O,B,z,F=i[3]&&i[3].identity_pubkey&&create_if_block_3$6(i);o=new Button$1({props:{kind:"tertiary",type:"submit",size:"field",icon:List,disabled:!1,$$slots:{default:[create_default_slot_1$5]},$$scope:{ctx:i}}}),o.$on("click",i[8]),l=new Button$1({props:{kind:"tertiary",type:"submit",size:"field",icon:Add,class:"channel",disabled:!1,$$slots:{default:[create_default_slot$d]},$$scope:{ctx:i}}}),l.$on("click",i[9]);const q=[create_if_block$m,create_if_block_1$c,create_if_block_2$9,create_else_block$g],N=[];function ee(X,Q){var J,Y;return Q&65&&(R=null),X[2]==="peers"?0:X[2]==="add_channel"?1:(R==null&&(R=!!((J=X[6])!=null&&J.hasOwnProperty(X[0])&&((Y=X[6][X[0]])!=null&&Y.length))),R?2:3)}return O=ee(i,-1),B=N[O]=q[O](i),{c(){t=element("div"),n=element("section"),F&&F.c(),s=space(),create_component(o.$$.fragment),r=space(),create_component(l.$$.fragment),a=space(),c=element("section"),u=element("aside"),f=element("h6"),f.textContent="TOTAL OUTBOUND LIQUIDITY",h=space(),p=element("h3"),b=text(g),v=space(),y=element("span"),y.textContent="SAT",S=space(),C=element("aside"),w=element("h6"),w.textContent="TOTAL INBOUND LIQUIDITY",T=space(),A=element("h3"),E=text(x),M=space(),P=element("span"),P.textContent="SAT",L=space(),B.c(),attr(n,"class","header-btns svelte-1fiizex"),attr(f,"class","title svelte-1fiizex"),attr(y,"class","svelte-1fiizex"),attr(p,"class","value svelte-1fiizex"),attr(u,"class","svelte-1fiizex"),attr(w,"class","title svelte-1fiizex"),attr(P,"class","svelte-1fiizex"),attr(A,"class","value svelte-1fiizex"),attr(C,"class","svelte-1fiizex"),attr(c,"class","liquidity-wrap svelte-1fiizex"),attr(t,"class","wrap svelte-1fiizex")},m(X,Q){insert(X,t,Q),append(t,n),F&&F.m(n,null),append(n,s),mount_component(o,n,null),append(n,r),mount_component(l,n,null),append(t,a),append(t,c),append(c,u),append(u,f),append(u,h),append(u,p),append(p,b),append(p,v),append(p,y),append(c,S),append(c,C),append(C,w),append(C,T),append(C,A),append(A,E),append(A,M),append(A,P),append(t,L),N[O].m(t,null),z=!0},p(X,[Q]){X[3]&&X[3].identity_pubkey?F?F.p(X,Q):(F=create_if_block_3$6(X),F.c(),F.m(n,s)):F&&(F.d(1),F=null);const J={};Q&67108864&&(J.$$scope={dirty:Q,ctx:X}),o.$set(J);const Y={};Q&67108864&&(Y.$$scope={dirty:Q,ctx:X}),l.$set(Y),(!z||Q&128)&&g!==(g=formatSatsNumbers(X[7].outbound)+"")&&set_data(b,g),(!z||Q&128)&&x!==(x=formatSatsNumbers(X[7].inbound)+"")&&set_data(E,x);let ce=O;O=ee(X,Q),O===ce?N[O].p(X,Q):(group_outros(),transition_out(N[ce],1,1,()=>{N[ce]=null}),check_outros(),B=N[O],B?B.p(X,Q):(B=N[O]=q[O](X),B.c()),transition_in(B,1),B.m(t,null))},i(X){z||(transition_in(o.$$.fragment,X),transition_in(l.$$.fragment,X),transition_in(B),z=!0)},o(X){transition_out(o.$$.fragment,X),transition_out(l.$$.fragment,X),transition_out(B),z=!1},d(X){X&&detach(t),F&&F.d(),destroy_component(o),destroy_component(l),N[O].d()}}}function formatPubkey(i){return`${i.substring(0,6)}...${i.substring(i.length-6)}`}function instance$y(i,t,n){let s,o,r,l,a,c;component_subscribe(i,channels,B=>n(6,o=B)),component_subscribe(i,finishedOnboarding,B=>n(13,r=B)),component_subscribe(i,isOnboarding,B=>n(17,l=B)),component_subscribe(i,peers,B=>n(14,a=B)),component_subscribe(i,channelBalances,B=>n(7,c=B));let{tag:u=""}=t,{type:f=""}=t;function h(){l&&(r.hasBalance&&!r.hasPeers?n(2,p="peers"):r.hasBalance&&r.hasPeers&&!r.hasChannels&&n(2,p="add_channel"))}let p="main",g,b=null,v;async function y(){const B=await get_info$1(u);n(3,g=B)}async function S(){const B=await get_info(u);n(3,g=await parseClnGetInfo(B))}async function C(){const B=await getLndPendingAndActiveChannels(u);channels.update(z=>({...z,[u]:B}))}async function w(){if(s&&s.length)return;const B=await list_peers$1(u);B&&peers.update(z=>({...z,[u]:B.peers}))}async function T(){let B=await list_peer_channels(u);const z=parseClnListPeerChannelsRes(B),F=await list_peers(u);if(!F)return;const q=await parseClnListPeerRes(F);peers.update(N=>({...N,[u]:q})),channels.update(N=>({...N,[u]:z}))}async function A(B,z){z==="Cln"?(await S(),await T()):(await y(),await C(),await w())}function x(){n(4,b=null),p==="peers"?n(2,p="main"):n(2,p="peers")}function E(){p==="add_channel"?(n(2,p="main"),n(4,b=null)):n(2,p="add_channel")}let M=!1;function P(){navigator.clipboard.writeText(g.identity_pubkey),n(5,M=!0),setTimeout(()=>n(5,M=!1),150)}function L(B){n(4,b=B),E()}async function R(B,z){f==="Cln"?await close_channel(u,B,z):console.log("ERROR: lnd does not support close yet")}async function O(){let B=[];if(f==="Cln"){const z=await list_peer_channels(u);B=await parseClnListPeerChannelsRes(z)}else B=await getLndPendingAndActiveChannels(u);JSON.stringify(B)!==JSON.stringify(o[u])&&channels.update(z=>({...z,[u]:B}))}return onMount(()=>{O(),v=setInterval(O,1e4)}),onDestroy(()=>{v&&clearInterval(v)}),i.$$set=B=>{"tag"in B&&n(0,u=B.tag),"type"in B&&n(1,f=B.type)},i.$$.update=()=>{i.$$.dirty&3&&A(u,f),i.$$.dirty&16385&&(s=a&&a[u]),i.$$.dirty&8192&&h()},[u,f,p,g,b,M,o,c,x,E,P,L,R,r,a]}class Channels extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$y,create_fragment$z,safe_not_equal,{tag:0,type:1})}}const AddInvoice_svelte_svelte_type_style_lang="";function create_default_slot_1$4(i){let t;return{c(){t=text("New Invoice")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block$l(i){let t,n,s,o,r,l,a,c,u,f;return o=new Lib({props:{size:256,padding:1.5,value:i[1]}}),u=new Button$1({props:{kind:"tertiary",class:"invoice-btn",$$slots:{default:[create_default_slot$c]},$$scope:{ctx:i}}}),u.$on("click",i[8]),{c(){t=element("section"),n=element("p"),n.textContent="Invoice QR code",s=space(),create_component(o.$$.fragment),r=space(),l=element("div"),a=text(i[1]),c=space(),create_component(u.$$.fragment),attr(n,"class","invoice-title svelte-1dqkomr"),attr(l,"class","invoice svelte-1dqkomr"),attr(t,"class","invoice-data svelte-1dqkomr")},m(h,p){insert(h,t,p),append(t,n),append(t,s),mount_component(o,t,null),append(t,r),append(t,l),append(l,a),append(t,c),mount_component(u,t,null),f=!0},p(h,p){const g={};p&2&&(g.value=h[1]),o.$set(g),(!f||p&2)&&set_data(a,h[1]);const b={};p&512&&(b.$$scope={dirty:p,ctx:h}),u.$set(b)},i(h){f||(transition_in(o.$$.fragment,h),transition_in(u.$$.fragment,h),f=!0)},o(h){transition_out(o.$$.fragment,h),transition_out(u.$$.fragment,h),f=!1},d(h){h&&detach(t),destroy_component(o),destroy_component(u)}}}function create_default_slot$c(i){let t;return{c(){t=text("Copy Invoice")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_fragment$y(i){let t,n,s,o,r,l,a,c,u,f,h;function p(v){i[7](v)}let g={labelText:"Amount (satoshis)",placeholder:"Enter invoice amount",type:"number"};i[0]!==void 0&&(g.value=i[0]),s=new TextInput$1({props:g}),binding_callbacks.push(()=>bind(s,"value",p,i[0])),u=new Button$1({props:{kind:"tertiary",type:"submit",size:"field",icon:Add,class:"channel",disabled:i[2],$$slots:{default:[create_default_slot_1$4]},$$scope:{ctx:i}}}),u.$on("click",i[3]);let b=i[1]&&create_if_block$l(i);return{c(){t=element("main"),n=element("section"),create_component(s.$$.fragment),r=space(),l=element("div"),a=space(),c=element("center"),create_component(u.$$.fragment),f=space(),b&&b.c(),attr(l,"class","spacer"),attr(n,"class","invoice-wrap svelte-1dqkomr"),attr(t,"class","svelte-1dqkomr")},m(v,y){insert(v,t,y),append(t,n),mount_component(s,n,null),append(n,r),append(n,l),append(n,a),append(n,c),mount_component(u,c,null),append(t,f),b&&b.m(t,null),h=!0},p(v,[y]){const S={};!o&&y&1&&(o=!0,S.value=v[0],add_flush_callback(()=>o=!1)),s.$set(S);const C={};y&4&&(C.disabled=v[2]),y&512&&(C.$$scope={dirty:y,ctx:v}),u.$set(C),v[1]?b?(b.p(v,y),y&2&&transition_in(b,1)):(b=create_if_block$l(v),b.c(),transition_in(b,1),b.m(t,null)):b&&(group_outros(),transition_out(b,1,1,()=>{b=null}),check_outros())},i(v){h||(transition_in(s.$$.fragment,v),transition_in(u.$$.fragment,v),transition_in(b),h=!0)},o(v){transition_out(s.$$.fragment,v),transition_out(u.$$.fragment,v),transition_out(b),h=!1},d(v){v&&detach(t),destroy_component(s),destroy_component(u),b&&b.d()}}}function copyToClipboard(i){navigator.clipboard.writeText(i)}function instance$x(i,t,n){let s,o,r,l;component_subscribe(i,activeInvoice,p=>n(6,l=p));let{tag:a=""}=t,{type:c=""}=t;async function u(){if(c==="Cln"){const p=await add_invoice(a,convertSatsToMilliSats(s));p&&activeInvoice.update(g=>({...g,[a]:p.bolt11}))}else{const p=await add_invoice$1(a,s);p&&activeInvoice.update(g=>({...g,[a]:p.payment_request}))}}function f(p){s=p,n(0,s)}const h=()=>copyToClipboard(r);return i.$$set=p=>{"tag"in p&&n(4,a=p.tag),"type"in p&&n(5,c=p.type)},i.$$.update=()=>{i.$$.dirty&1&&n(2,o=!s),i.$$.dirty&80&&n(1,r=l[a]||"")},n(0,s=0),[s,r,o,u,a,c,l,f,h]}class AddInvoice extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$x,create_fragment$y,safe_not_equal,{tag:4,type:5})}}const PayInvoice_svelte_svelte_type_style_lang="";function create_if_block$k(i){let t,n;return t=new InlineNotification$1({props:{lowContrast:!0,kind:i[3]?"success":"error",title:i[3]?"Success:":"Error:",subtitle:i[2],timeout:3e3}}),t.$on("close",i[8]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&8&&(r.kind=s[3]?"success":"error"),o&8&&(r.title=s[3]?"Success:":"Error:"),o&4&&(r.subtitle=s[2]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot$b(i){let t;return{c(){t=text("Pay Invoice")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_fragment$x(i){let t,n,s,o,r,l,a,c,u,f,h,p=i[1]&&create_if_block$k(i);function g(v){i[9](v)}let b={labelText:"Invoice Payment Request",placeholder:"Enter the payment request of the invoice",rows:5};return i[0]!==void 0&&(b.value=i[0]),o=new TextArea$1({props:b}),binding_callbacks.push(()=>bind(o,"value",g,i[0])),f=new Button$1({props:{kind:"tertiary",type:"submit",size:"field",icon:Money,class:"channel",disabled:i[4],$$slots:{default:[create_default_slot$b]},$$scope:{ctx:i}}}),f.$on("click",i[5]),{c(){t=element("main"),n=element("section"),p&&p.c(),s=space(),create_component(o.$$.fragment),l=space(),a=element("div"),c=space(),u=element("center"),create_component(f.$$.fragment),attr(a,"class","spacer"),attr(n,"class","invoice-wrap svelte-uw49d1"),attr(t,"class","svelte-uw49d1")},m(v,y){insert(v,t,y),append(t,n),p&&p.m(n,null),append(n,s),mount_component(o,n,null),append(n,l),append(n,a),append(n,c),append(n,u),mount_component(f,u,null),h=!0},p(v,[y]){v[1]?p?(p.p(v,y),y&2&&transition_in(p,1)):(p=create_if_block$k(v),p.c(),transition_in(p,1),p.m(n,s)):p&&(group_outros(),transition_out(p,1,1,()=>{p=null}),check_outros());const S={};!r&&y&1&&(r=!0,S.value=v[0],add_flush_callback(()=>r=!1)),o.$set(S);const C={};y&16&&(C.disabled=v[4]),y&1024&&(C.$$scope={dirty:y,ctx:v}),f.$set(C)},i(v){h||(transition_in(p),transition_in(o.$$.fragment,v),transition_in(f.$$.fragment,v),h=!0)},o(v){transition_out(p),transition_out(o.$$.fragment,v),transition_out(f.$$.fragment,v),h=!1},d(v){v&&detach(t),p&&p.d(),destroy_component(o),destroy_component(f)}}}function instance$w(i,t,n){let s,o,{tag:r=""}=t,{type:l=""}=t,a=!1,c="",u=!1;async function f(){if(l==="Cln"){const g=await pay_invoice(r,s);n(1,a=!0),g.status===0?(n(3,u=!0),n(2,c="Invoice payment has been made."),n(0,s=""),setTimeout(async()=>{const b=await list_peer_channels(r),v=parseClnListPeerChannelsRes(b);channels.update(y=>({...y,[r]:v}))},2e3)):(n(3,u=!1),n(0,s=""),g.status===1&&n(2,c="Invoice payment is pending"),g.status===2&&n(2,c="Invoice payment failed"))}else{const g=await pay_invoice$1(r,s);if(n(1,a=!0),g.payment_error)n(3,u=!1),n(2,c=g.payment_error),n(0,s="");else{n(0,s=""),n(3,u=!0),n(2,c="Invoice payment has been made.");const b=await getLndPendingAndActiveChannels(r);channels.update(v=>({...v,[r]:b}))}}}const h=g=>{g.preventDefault(),n(1,a=!1)};function p(g){s=g,n(0,s)}return i.$$set=g=>{"tag"in g&&n(6,r=g.tag),"type"in g&&n(7,l=g.type)},i.$$.update=()=>{i.$$.dirty&1&&n(4,o=!s)},n(0,s=""),[s,a,c,u,o,f,r,l,h,p]}class PayInvoice extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$w,create_fragment$x,safe_not_equal,{tag:6,type:7})}}const PayKeysend_svelte_svelte_type_style_lang="";function create_if_block$j(i){let t,n;return t=new InlineNotification$1({props:{lowContrast:!0,kind:i[3]?"error":"success",title:i[3]?"Failure:":"Success:",subtitle:i[3]||"Keysend payment has been made.",timeout:4e3}}),t.$on("close",i[8]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&8&&(r.kind=s[3]?"error":"success"),o&8&&(r.title=s[3]?"Failure:":"Success:"),o&8&&(r.subtitle=s[3]||"Keysend payment has been made."),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot$a(i){let t;return{c(){t=text("Pay Keysend")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_fragment$w(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S=i[2]&&create_if_block$j(i);function C(x){i[9](x)}let w={labelText:"Pubkey",placeholder:"Destintaion Public Key"};i[1]!==void 0&&(w.value=i[1]),o=new TextInput$1({props:w}),binding_callbacks.push(()=>bind(o,"value",C,i[1]));function T(x){i[10](x)}let A={labelText:"Amount (satoshis)",placeholder:"Enter amount",type:"number"};return i[0]!==void 0&&(A.value=i[0]),u=new TextInput$1({props:A}),binding_callbacks.push(()=>bind(u,"value",T,i[0])),v=new Button$1({props:{kind:"tertiary",type:"submit",size:"field",icon:Money,class:"channel",disabled:i[4],$$slots:{default:[create_default_slot$a]},$$scope:{ctx:i}}}),v.$on("click",i[5]),{c(){t=element("main"),n=element("section"),S&&S.c(),s=space(),create_component(o.$$.fragment),l=space(),a=element("div"),c=space(),create_component(u.$$.fragment),h=space(),p=element("div"),g=space(),b=element("center"),create_component(v.$$.fragment),attr(a,"class","spacer"),attr(p,"class","spacer"),attr(n,"class","invoice-wrap svelte-uw49d1"),attr(t,"class","svelte-uw49d1")},m(x,E){insert(x,t,E),append(t,n),S&&S.m(n,null),append(n,s),mount_component(o,n,null),append(n,l),append(n,a),append(n,c),mount_component(u,n,null),append(n,h),append(n,p),append(n,g),append(n,b),mount_component(v,b,null),y=!0},p(x,[E]){x[2]?S?(S.p(x,E),E&4&&transition_in(S,1)):(S=create_if_block$j(x),S.c(),transition_in(S,1),S.m(n,s)):S&&(group_outros(),transition_out(S,1,1,()=>{S=null}),check_outros());const M={};!r&&E&2&&(r=!0,M.value=x[1],add_flush_callback(()=>r=!1)),o.$set(M);const P={};!f&&E&1&&(f=!0,P.value=x[0],add_flush_callback(()=>f=!1)),u.$set(P);const L={};E&16&&(L.disabled=x[4]),E&2048&&(L.$$scope={dirty:E,ctx:x}),v.$set(L)},i(x){y||(transition_in(S),transition_in(o.$$.fragment,x),transition_in(u.$$.fragment,x),transition_in(v.$$.fragment,x),y=!0)},o(x){transition_out(S),transition_out(o.$$.fragment,x),transition_out(u.$$.fragment,x),transition_out(v.$$.fragment,x),y=!1},d(x){x&&detach(t),S&&S.d(),destroy_component(o),destroy_component(u),destroy_component(v)}}}function instance$v(i,t,n){let s,o,r,{tag:l=""}=t,{type:a=""}=t,c=!1,u="";async function f(){if(a==="Cln")await keysend(l,s,convertSatsToMilliSats(o),window.route_hint,window.maxfeepercent,window.exemptfee)?(n(2,c=!0),n(3,u=""),n(1,s=""),n(0,o=0),setTimeout(async()=>{const v=await list_peer_channels(l),y=await parseClnListPeerChannelsRes(v);v&&channels.update(S=>({...S,[l]:y}))},2e3)):(n(2,c=!0),n(3,u="keysend was declined"));else{const b=await keysend$1(l,s,o,window.tlvs);if(b){b.payment_error?n(3,u=b.payment_error):n(3,u=""),n(2,c=!0),n(1,s=""),n(0,o=0);const v=await getLndPendingAndActiveChannels(l);channels.update(y=>({...y,[l]:v}))}}}const h=b=>{b.preventDefault(),n(2,c=!1)};function p(b){s=b,n(1,s)}function g(b){o=b,n(0,o)}return i.$$set=b=>{"tag"in b&&n(6,l=b.tag),"type"in b&&n(7,a=b.type)},i.$$.update=()=>{i.$$.dirty&3&&n(4,r=!s||!o||s&&s.length!==66)},n(1,s=""),n(0,o=0),[o,s,c,u,r,f,l,a,h,p,g]}class PayKeysend extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$v,create_fragment$w,safe_not_equal,{tag:6,type:7})}}const transaction_svelte_svelte_type_style_lang="";function create_else_block$f(i){let t,n,s,o,r,l,a;n=new DataTable$1({props:{headers:[{key:"index",value:"Index"},{key:"invoice",value:"Invoice"},{key:"date",value:"Date"},{key:"amount",value:"Amount"}],rows:i[3],pageSize:i[1],page:i[2]}});function c(h){i[6](h)}function u(h){i[7](h)}let f={totalItems:i[3].length,pageSizeInputDisabled:!0};return i[1]!==void 0&&(f.pageSize=i[1]),i[2]!==void 0&&(f.page=i[2]),o=new Pagination$1({props:f}),binding_callbacks.push(()=>bind(o,"pageSize",c,i[1])),binding_callbacks.push(()=>bind(o,"page",u,i[2])),{c(){t=element("div"),create_component(n.$$.fragment),s=space(),create_component(o.$$.fragment)},m(h,p){insert(h,t,p),mount_component(n,t,null),append(t,s),mount_component(o,t,null),a=!0},p(h,p){const g={};p&8&&(g.rows=h[3]),p&2&&(g.pageSize=h[1]),p&4&&(g.page=h[2]),n.$set(g);const b={};p&8&&(b.totalItems=h[3].length),!r&&p&2&&(r=!0,b.pageSize=h[1],add_flush_callback(()=>r=!1)),!l&&p&4&&(l=!0,b.page=h[2],add_flush_callback(()=>l=!1)),o.$set(b)},i(h){a||(transition_in(n.$$.fragment,h),transition_in(o.$$.fragment,h),a=!0)},o(h){transition_out(n.$$.fragment,h),transition_out(o.$$.fragment,h),a=!1},d(h){h&&detach(t),destroy_component(n),destroy_component(o)}}}function create_if_block_1$b(i){let t,n,s,o,r;return{c(){t=element("div"),n=element("p"),s=text("No "),o=text(i[0]),r=text(" transactions yet!!..."),attr(n,"class","svelte-7nhysw"),attr(t,"class","message svelte-7nhysw")},m(l,a){insert(l,t,a),append(t,n),append(n,s),append(n,o),append(n,r)},p(l,a){a&1&&set_data(o,l[0])},i:noop$2,o:noop$2,d(l){l&&detach(t)}}}function create_if_block$i(i){let t,n,s,o,r;return n=new Loading$1({props:{withOverlay:!1}}),{c(){t=element("div"),create_component(n.$$.fragment),s=space(),o=element("p"),o.textContent="Loading Transactions...",attr(o,"class","svelte-7nhysw"),attr(t,"class","loader svelte-7nhysw")},m(l,a){insert(l,t,a),mount_component(n,t,null),append(t,s),append(t,o),r=!0},p:noop$2,i(l){r||(transition_in(n.$$.fragment,l),r=!0)},o(l){transition_out(n.$$.fragment,l),r=!1},d(l){l&&detach(t),destroy_component(n)}}}function create_fragment$v(i){let t,n,s,o;const r=[create_if_block$i,create_if_block_1$b,create_else_block$f],l=[];function a(c,u){return c[3]===null?0:c[3].length===0?1:2}return n=a(i),s=l[n]=r[n](i),{c(){t=element("main"),s.c(),attr(t,"class","svelte-7nhysw")},m(c,u){insert(c,t,u),l[n].m(t,null),o=!0},p(c,[u]){let f=n;n=a(c),n===f?l[n].p(c,u):(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),s=l[n],s?s.p(c,u):(s=l[n]=r[n](c),s.c()),transition_in(s,1),s.m(t,null))},i(c){o||(transition_in(s),o=!0)},o(c){transition_out(s),o=!1},d(c){c&&detach(t),l[n].d()}}}function instance$u(i,t,n){let s,{tag:o=""}=t,{type:r=""}=t,{paymentType:l=""}=t,a=5,c=1,u="";async function f(){if(r==="Cln"){const y=await list_pays(o),S=parseClnPayments(y.payments);S.reverse(),n(3,s=[...S])}else{const y=await list_payments(o),S=parseLndPayments(y);n(3,s=[...S])}}function h(){o!==u&&(g(),u=o)}async function p(){if(r==="Cln"){const y=await list_invoices(o),S=parseClnInvoices(y.invoices);n(3,s=[...S])}else{const y=await list_invoices$1(o),S=parseLndInvoices(y);n(3,s=[...S])}}function g(){l==="sent"?f():p()}onMount(()=>{g(),u=o});function b(y){a=y,n(1,a)}function v(y){c=y,n(2,c)}return i.$$set=y=>{"tag"in y&&n(4,o=y.tag),"type"in y&&n(5,r=y.type),"paymentType"in y&&n(0,l=y.paymentType)},i.$$.update=()=>{i.$$.dirty&16&&h()},n(3,s=null),[l,a,c,s,o,r,b,v]}class Transaction extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$u,create_fragment$v,safe_not_equal,{tag:4,type:5,paymentType:0})}}const PaymentHistory_svelte_svelte_type_style_lang="";function create_default_slot_2$2(i){let t,n,s,o;return t=new Tab$1({props:{label:"Sent Payments"}}),s=new Tab$1({props:{label:"Recieved Payments"}}),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment)},m(r,l){mount_component(t,r,l),insert(r,n,l),mount_component(s,r,l),o=!0},p:noop$2,i(r){o||(transition_in(t.$$.fragment,r),transition_in(s.$$.fragment,r),o=!0)},o(r){transition_out(t.$$.fragment,r),transition_out(s.$$.fragment,r),o=!1},d(r){destroy_component(t,r),r&&detach(n),destroy_component(s,r)}}}function create_default_slot_1$3(i){let t,n;return t=new Transaction({props:{tag:i[0],type:i[1],paymentType:"sent"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot$9(i){let t,n;return t=new Transaction({props:{tag:i[0],type:i[1],paymentType:"recieved"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_content_slot$1(i){let t,n,s,o;return t=new TabContent$1({props:{$$slots:{default:[create_default_slot_1$3]},$$scope:{ctx:i}}}),s=new TabContent$1({props:{$$slots:{default:[create_default_slot$9]},$$scope:{ctx:i}}}),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment)},m(r,l){mount_component(t,r,l),insert(r,n,l),mount_component(s,r,l),o=!0},p(r,l){const a={};l&7&&(a.$$scope={dirty:l,ctx:r}),t.$set(a);const c={};l&7&&(c.$$scope={dirty:l,ctx:r}),s.$set(c)},i(r){o||(transition_in(t.$$.fragment,r),transition_in(s.$$.fragment,r),o=!0)},o(r){transition_out(t.$$.fragment,r),transition_out(s.$$.fragment,r),o=!1},d(r){destroy_component(t,r),r&&detach(n),destroy_component(s,r)}}}function create_fragment$u(i){let t,n,s;return n=new Tabs$1({props:{$$slots:{content:[create_content_slot$1],default:[create_default_slot_2$2]},$$scope:{ctx:i}}}),{c(){t=element("main"),create_component(n.$$.fragment),attr(t,"class","svelte-1x7kcz3")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},p(o,[r]){const l={};r&7&&(l.$$scope={dirty:r,ctx:o}),n.$set(l)},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function instance$t(i,t,n){let{tag:s=""}=t,{type:o=""}=t;return i.$$set=r=>{"tag"in r&&n(0,s=r.tag),"type"in r&&n(1,o=r.type)},[s,o]}class PaymentHistory extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$t,create_fragment$u,safe_not_equal,{tag:0,type:1})}}const Invoices_svelte_svelte_type_style_lang="";function get_each_context$7(i,t,n){const s=i.slice();return s[5]=t[n],s}function create_default_slot$8(i){let t=i[5].label+"",n;return{c(){n=text(t)},m(s,o){insert(s,n,o)},p:noop$2,d(s){s&&detach(n)}}}function create_each_block$7(i){let t,n;function s(){return i[4](i[5])}return t=new Button$1({props:{size:"field",kind:"tertiary",$$slots:{default:[create_default_slot$8]},$$scope:{ctx:i}}}),t.$on("click",s),{c(){create_component(t.$$.fragment)},m(o,r){mount_component(t,o,r),n=!0},p(o,r){i=o;const l={};r&256&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(o){n||(transition_in(t.$$.fragment,o),n=!0)},o(o){transition_out(t.$$.fragment,o),n=!1},d(o){destroy_component(t,o)}}}function create_else_block$e(i){let t,n;return t=new PayKeysend({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_2$8(i){let t,n;return t=new PaymentHistory({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_1$a(i){let t,n;return t=new PayInvoice({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block$h(i){let t,n;return t=new AddInvoice({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$t(i){let t,n,s,o,r,l,a=i[3],c=[];for(let g=0;gtransition_out(c[g],1,1,()=>{c[g]=null}),f=[create_if_block$h,create_if_block_1$a,create_if_block_2$8,create_else_block$e],h=[];function p(g,b){return g[2]==="add"?0:g[2]==="pay"?1:g[2]==="history"?2:3}return s=p(i),o=h[s]=f[s](i),{c(){t=element("div");for(let g=0;g{h[v]=null}),check_outros(),o=h[s],o?o.p(g,b):(o=h[s]=f[s](g),o.c()),transition_in(o,1),o.m(r.parentNode,r))},i(g){if(!l){for(let b=0;bn(2,s=c.page);return i.$$set=c=>{"tag"in c&&n(0,o=c.tag),"type"in c&&n(1,r=c.type)},[o,r,s,l,a]}class Invoices extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$s,create_fragment$t,safe_not_equal,{tag:0,type:1})}}const Onchain_svelte_svelte_type_style_lang="";function create_default_slot$7(i){let t;return{c(){t=text("Generate Address")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_fragment$s(i){let t,n,s,o,r,l=(i[2][i[0]]||0)+"",a,c,u,f,h,p,g,b,v,y,S,C,w,T,A,x,E,M,P,L,R,O=(i[3][i[0]]||0)+"",B,z,F,q;return C=new Copy({props:{class:"copy-icon",size:24}}),x=new Button$1({props:{size:"field",icon:Add,$$slots:{default:[create_default_slot$7]},$$scope:{ctx:i}}}),x.$on("click",i[4]),{c(){t=element("div"),n=element("div"),s=element("p"),s.textContent="Confirmed Balance:",o=space(),r=element("p"),a=text(l),c=space(),u=element("aside"),f=element("div"),h=element("section"),p=element("label"),p.textContent="Address (Generate or copy address)",g=space(),b=element("aside"),v=element("input"),y=space(),S=element("button"),create_component(C.$$.fragment),w=space(),T=element("aside"),A=space(),create_component(x.$$.fragment),E=space(),M=element("div"),P=element("p"),P.textContent="Unconfirmed Balance:",L=space(),R=element("p"),B=text(O),attr(s,"class","confirmed_balance svelte-1s7xjxx"),attr(r,"class","confirmed_amount svelte-1s7xjxx"),attr(n,"class","confirmed_balance_container svelte-1s7xjxx"),attr(p,"for","address"),attr(p,"class","svelte-1s7xjxx"),attr(v,"name","address"),attr(v,"placeholder","Address"),v.readOnly=!0,attr(v,"class","svelte-1s7xjxx"),attr(S,"class","copy-btn svelte-1s7xjxx"),attr(b,"class","data-wrap svelte-1s7xjxx"),attr(h,"class","input-wrap svelte-1s7xjxx"),attr(f,"class","address svelte-1s7xjxx"),attr(T,"class","spacer"),attr(u,"class","address-wrap svelte-1s7xjxx"),attr(P,"class","unconfirmed_balance svelte-1s7xjxx"),attr(R,"class","unconfirmed_amount svelte-1s7xjxx"),attr(M,"class","unconfirmed_balance_container svelte-1s7xjxx"),attr(t,"class","wrap svelte-1s7xjxx")},m(N,ee){insert(N,t,ee),append(t,n),append(n,s),append(n,o),append(n,r),append(r,a),append(t,c),append(t,u),append(u,f),append(f,h),append(h,p),append(h,g),append(h,b),append(b,v),set_input_value(v,i[1]),append(b,y),append(b,S),mount_component(C,S,null),append(u,w),append(u,T),append(u,A),mount_component(x,u,null),append(t,E),append(t,M),append(M,P),append(M,L),append(M,R),append(R,B),z=!0,F||(q=[listen(v,"input",i[8]),listen(S,"click",i[5])],F=!0)},p(N,[ee]){(!z||ee&5)&&l!==(l=(N[2][N[0]]||0)+"")&&set_data(a,l),ee&2&&v.value!==N[1]&&set_input_value(v,N[1]);const X={};ee&16384&&(X.$$scope={dirty:ee,ctx:N}),x.$set(X),(!z||ee&9)&&O!==(O=(N[3][N[0]]||0)+"")&&set_data(B,O)},i(N){z||(transition_in(C.$$.fragment,N),transition_in(x.$$.fragment,N),z=!0)},o(N){transition_out(C.$$.fragment,N),transition_out(x.$$.fragment,N),z=!1},d(N){N&&detach(t),destroy_component(C),destroy_component(x),F=!1,run_all(q)}}}function instance$r(i,t,n){let s,o,r,l,a;component_subscribe(i,lightningAddresses,S=>n(7,o=S)),component_subscribe(i,finishedOnboarding,S=>n(10,r=S)),component_subscribe(i,lndBalances,S=>n(2,l=S)),component_subscribe(i,unconfirmedBalance,S=>n(3,a=S));let{tag:c=""}=t,{type:u=""}=t,f;async function h(){let S;u==="Cln"?S=await new_address(c):(S=await new_address$1(c),S&&!r.hasChannels&&onChainAddressGeneratedForOnboarding.update(()=>!0)),S&&lightningAddresses.update(C=>({...C,[c]:S}))}onMount(()=>{p(),f=setInterval(p,2e4)}),onDestroy(()=>{f&&clearInterval(f)});async function p(){if(u==="Lnd"){const S=await get_balance(c);g(S==null?void 0:S.confirmed_balance),b(S==null?void 0:S.unconfirmed_balance)}else if(u==="Cln"){const S=await list_funds(c),C=await list_peer_channels(c),w=parseClnListFunds(S,C),T=parseUnconfirmedClnBalance(S);g(w),b(T)}}function g(S){lndBalances.hasOwnProperty(c)&&lndBalances[c]===S||lndBalances.update(C=>({...C,[c]:S}))}function b(S){unconfirmedBalance.hasOwnProperty(c)&&unconfirmedBalance[c]===S||unconfirmedBalance.update(C=>({...C,[c]:S}))}function v(){navigator.clipboard.writeText(s),copiedAddressForOnboarding.update(()=>!0)}function y(){s=this.value,n(1,s),n(7,o),n(0,c)}return i.$$set=S=>{"tag"in S&&n(0,c=S.tag),"type"in S&&n(6,u=S.type)},i.$$.update=()=>{i.$$.dirty&129&&n(1,s=o[c])},[c,s,l,a,h,v,u,o,y]}class Onchain extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$r,create_fragment$s,safe_not_equal,{tag:0,type:6})}}const FirstConnect_svelte_svelte_type_style_lang="";function create_fragment$r(i){let t,n,s,o,r,l,a,c,u,f,h,p,g=i[0].network+"",b,v,y,S,C,w,T;return S=new Lib({props:{size:256,padding:4,value:i[2](i[1],i[0].network)}}),{c(){t=element("div"),n=element("div"),n.textContent="Connect your Signer:",s=space(),o=element("div"),r=element("div"),l=element("div"),l.innerHTML=`MQTT URL: Network:`,a=space(),c=element("div"),u=element("span"),f=text(i[1]),h=space(),p=element("span"),b=text(g),v=space(),y=element("div"),create_component(S.$$.fragment),attr(n,"class","head svelte-pjqwuy"),attr(l,"class","label-section svelte-pjqwuy"),attr(u,"class","svelte-pjqwuy"),attr(p,"class","svelte-pjqwuy"),attr(c,"class","label-section svelte-pjqwuy"),attr(r,"class","labels svelte-pjqwuy"),attr(y,"class","qr-wrap svelte-pjqwuy"),attr(o,"class","body svelte-pjqwuy"),attr(t,"class","wrap svelte-pjqwuy")},m(A,x){insert(A,t,x),append(t,n),append(t,s),append(t,o),append(o,r),append(r,l),append(r,a),append(r,c),append(c,u),append(u,f),append(c,h),append(c,p),append(p,b),append(o,v),append(o,y),mount_component(S,y,null),C=!0,w||(T=listen(y,"click",i[3]),w=!0)},p(A,[x]){(!C||x&2)&&set_data(f,A[1]),(!C||x&1)&&g!==(g=A[0].network+"")&&set_data(b,g);const E={};x&3&&(E.value=A[2](A[1],A[0].network)),S.$set(E)},i(A){C||(transition_in(S.$$.fragment,A),C=!0)},o(A){transition_out(S.$$.fragment,A),C=!1},d(A){A&&detach(t),destroy_component(S),w=!1,T()}}}function makeMqttHost(i,t){return i.ip?`${i.ip}:1883`:i.host&&t?`mqtt-${t.name}.${i.host}:8883`:"127.0.0.1:1883"}function makeRelayHost(i,t){return i.host&&t?`${t.name}.${i.host}`:"127.0.0.1:3000"}function instance$q(i,t,n){let s,o,r,l,a;component_subscribe(i,stack,f=>n(0,a=f));function c(f,h){return`sphinx.chat://?action=glyph&mqtt=${f}&network=${h}&relay=${l}`}function u(){const f=c(o,a.network);navigator.clipboard.writeText(f)}return i.$$.update=()=>{i.$$.dirty&1&&n(5,s=a&&a.nodes.find(f=>f.type==="Cln")),i.$$.dirty&33&&n(1,o=makeMqttHost(a,s)),i.$$.dirty&1&&n(4,r=a&&a.nodes.find(f=>f.type==="Relay")),i.$$.dirty&17&&(l=makeRelayHost(a,r))},[a,o,c,u,r,s]}class FirstConnect extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$q,create_fragment$r,safe_not_equal,{})}}async function hsmdCmd(i,t,n){return await send_cmd("Hsmd",{cmd:i,content:n},t)}async function get_clients(i){return await hsmdCmd("GetClients",i)}const Lnd_svelte_svelte_type_style_lang="";function create_else_block$d(i){let t,n,s,o,r,l,a,c,u,f,h,p,g;function b(y){i[9](y)}let v={$$slots:{content:[create_content_slot],default:[create_default_slot_3$1]},$$scope:{ctx:i}};return i[4]!==void 0&&(v.selected=i[4]),u=new Tabs$1({props:v}),binding_callbacks.push(()=>bind(u,"selected",b,i[4])),{c(){t=element("div"),n=element("div"),s=element("span"),s.textContent="Peering Address:",o=space(),r=element("span"),l=text(i[3]),c=space(),create_component(u.$$.fragment),attr(s,"class","svelte-5qzo08"),attr(r,"style",a=`transform:scale(${i[2]?1.1:1});`),attr(r,"class","svelte-5qzo08"),attr(n,"class","node-url svelte-5qzo08"),attr(t,"class","lnd-tabs-wrap")},m(y,S){insert(y,t,S),append(t,n),append(n,s),append(n,o),append(n,r),append(r,l),append(t,c),mount_component(u,t,null),h=!0,p||(g=listen(r,"click",i[6]),p=!0)},p(y,S){(!h||S&8)&&set_data(l,y[3]),(!h||S&4&&a!==(a=`transform:scale(${y[2]?1.1:1});`))&&attr(r,"style",a);const C={};S&4099&&(C.$$scope={dirty:S,ctx:y}),!f&&S&16&&(f=!0,C.selected=y[4],add_flush_callback(()=>f=!1)),u.$set(C)},i(y){h||(transition_in(u.$$.fragment,y),h=!0)},o(y){transition_out(u.$$.fragment,y),h=!1},d(y){y&&detach(t),destroy_component(u),p=!1,g()}}}function create_if_block$g(i){let t,n,s;return n=new FirstConnect({}),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","hsmd-wrap svelte-5qzo08")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},p:noop$2,i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_default_slot_3$1(i){let t,n,s,o,r,l;return t=new Tab$1({props:{label:"Channels"}}),s=new Tab$1({props:{label:"Invoices"}}),r=new Tab$1({props:{label:"Onchain"}}),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment),o=space(),create_component(r.$$.fragment)},m(a,c){mount_component(t,a,c),insert(a,n,c),mount_component(s,a,c),insert(a,o,c),mount_component(r,a,c),l=!0},p:noop$2,i(a){l||(transition_in(t.$$.fragment,a),transition_in(s.$$.fragment,a),transition_in(r.$$.fragment,a),l=!0)},o(a){transition_out(t.$$.fragment,a),transition_out(s.$$.fragment,a),transition_out(r.$$.fragment,a),l=!1},d(a){destroy_component(t,a),a&&detach(n),destroy_component(s,a),a&&detach(o),destroy_component(r,a)}}}function create_default_slot_2$1(i){let t,n;return t=new Channels({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot_1$2(i){let t,n;return t=new Invoices({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot$6(i){let t,n;return t=new Onchain({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_content_slot(i){let t,n,s,o,r,l;return t=new TabContent$1({props:{$$slots:{default:[create_default_slot_2$1]},$$scope:{ctx:i}}}),s=new TabContent$1({props:{$$slots:{default:[create_default_slot_1$2]},$$scope:{ctx:i}}}),r=new TabContent$1({props:{$$slots:{default:[create_default_slot$6]},$$scope:{ctx:i}}}),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment),o=space(),create_component(r.$$.fragment)},m(a,c){mount_component(t,a,c),insert(a,n,c),mount_component(s,a,c),insert(a,o,c),mount_component(r,a,c),l=!0},p(a,c){const u={};c&4099&&(u.$$scope={dirty:c,ctx:a}),t.$set(u);const f={};c&4099&&(f.$$scope={dirty:c,ctx:a}),s.$set(f);const h={};c&4099&&(h.$$scope={dirty:c,ctx:a}),r.$set(h)},i(a){l||(transition_in(t.$$.fragment,a),transition_in(s.$$.fragment,a),transition_in(r.$$.fragment,a),l=!0)},o(a){transition_out(t.$$.fragment,a),transition_out(s.$$.fragment,a),transition_out(r.$$.fragment,a),l=!1},d(a){destroy_component(t,a),a&&detach(n),destroy_component(s,a),a&&detach(o),destroy_component(r,a)}}}function create_fragment$q(i){let t,n,s,o;const r=[create_if_block$g,create_else_block$d],l=[];function a(c,u){return c[5]?0:1}return t=a(i),n=l[t]=r[t](i),{c(){n.c(),s=empty$1()},m(c,u){l[t].m(c,u),insert(c,s,u),o=!0},p(c,[u]){let f=t;t=a(c),t===f?l[t].p(c,u):(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),n=l[t],n?n.p(c,u):(n=l[t]=r[t](c),n.c()),transition_in(n,1),n.m(s.parentNode,s))},i(c){o||(transition_in(n),o=!0)},o(c){transition_out(n),o=!1},d(c){l[t].d(c),c&&detach(s)}}}function instance$p(i,t,n){let s,o,r,l,a,c;component_subscribe(i,selectedNode,v=>n(7,r=v)),component_subscribe(i,finishedOnboarding,v=>n(8,l=v)),component_subscribe(i,isOnboarding,v=>n(10,a=v)),component_subscribe(i,hsmd,v=>n(5,c=v));let{tag:u=""}=t,{type:f=""}=t;function h(){a&&(l.hasBalance?l.hasBalance&&!l.hasChannels&&n(4,s=0):n(4,s=2))}let p=!1;function g(){navigator.clipboard.writeText(o),n(2,p=!0),setTimeout(()=>n(2,p=!1),150)}onMount(async()=>{if(f==="Cln"){const v=await get_clients(u);v&&hsmdClients.set(v)}});function b(v){s=v,n(4,s)}return i.$$set=v=>{"tag"in v&&n(0,u=v.tag),"type"in v&&n(1,f=v.type)},i.$$.update=()=>{i.$$.dirty&256&&h(),i.$$.dirty&128&&n(3,o=r!=null&&r.host?`${r==null?void 0:r.host}:${r.peer_port}`:`${r.name}.sphinx:${r.peer_port}`)},n(4,s=0),[u,f,p,o,s,c,g,r,l,b]}class Lnd extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$p,create_fragment$q,safe_not_equal,{tag:0,type:1})}}const BitcoinMine_svelte_svelte_type_style_lang="";function create_default_slot$5(i){let t;return{c(){t=text("Mine blocks")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_fragment$p(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,C,w,T;return S=new Button$1({props:{size:"field",icon:VirtualMachine,$$slots:{default:[create_default_slot$5]},$$scope:{ctx:i}}}),S.$on("click",i[2]),{c(){t=element("section"),n=element("aside"),s=element("section"),o=element("label"),o.textContent="Blocks",r=space(),l=element("input"),a=space(),c=element("aside"),u=space(),f=element("section"),h=element("label"),h.textContent="Address (Optional)",p=space(),g=element("input"),b=space(),v=element("aside"),y=space(),create_component(S.$$.fragment),attr(o,"for","blocks"),attr(o,"class","svelte-ziyxk9"),attr(l,"type","number"),attr(l,"placeholder","Enter number of blocks"),attr(l,"class","svelte-ziyxk9"),attr(s,"class","input-wrap svelte-ziyxk9"),attr(c,"class","spacer"),attr(h,"for","blocks"),attr(h,"class","svelte-ziyxk9"),attr(g,"placeholder","Enter Bitcoin address (optional)"),attr(g,"class","svelte-ziyxk9"),attr(f,"class","input-wrap svelte-ziyxk9"),attr(v,"class","spacer"),attr(n,"class","mine-wrap svelte-ziyxk9"),attr(t,"class","mine-blocks-btn")},m(A,x){insert(A,t,x),append(t,n),append(n,s),append(s,o),append(s,r),append(s,l),set_input_value(l,i[1]),append(n,a),append(n,c),append(n,u),append(n,f),append(f,h),append(f,p),append(f,g),set_input_value(g,i[0]),append(n,b),append(n,v),append(n,y),mount_component(S,n,null),C=!0,w||(T=[listen(l,"input",i[4]),listen(g,"input",i[5])],w=!0)},p(A,[x]){x&2&&to_number(l.value)!==A[1]&&set_input_value(l,A[1]),x&1&&g.value!==A[0]&&set_input_value(g,A[0]);const E={};x&64&&(E.$$scope={dirty:x,ctx:A}),S.$set(E)},i(A){C||(transition_in(S.$$.fragment,A),C=!0)},o(A){transition_out(S.$$.fragment,A),C=!1},d(A){A&&detach(t),destroy_component(S),w=!1,run_all(T)}}}function instance$o(i,t,n){let s,o,{tag:r=""}=t;async function l(){await test_mine(r,s,o||null)&&(n(1,s=6),n(0,o=""),btcinfo.set(await get_info$2(r)),walletBalance.set(await get_balance$1(r)))}function a(){s=to_number(this.value),n(1,s)}function c(){o=this.value,n(0,o)}return i.$$set=u=>{"tag"in u&&n(3,r=u.tag)},n(1,s=6),n(0,o=""),[o,s,l,r,a,c]}class BitcoinMine extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$o,create_fragment$p,safe_not_equal,{tag:3})}}const Bitcoin_svelte_svelte_type_style_lang="";function create_if_block_1$9(i){let t,n,s,o,r=i[3].chain+"",l,a,c,u,f,h,p=i[3].blocks+"",g,b,v,y,S,C,w=i[3].headers+"",T,A,x,E,M=i[3].chain==="regtest"&&create_if_block_2$7(i);return{c(){t=element("section"),n=element("h3"),n.textContent="NETWORK",s=space(),o=element("h3"),l=text(r),a=space(),c=element("section"),u=element("h3"),u.textContent="BLOCK HEIGHT",f=space(),h=element("h3"),g=text(p),b=space(),v=element("section"),y=element("h3"),y.textContent="BLOCK HEADERS",S=space(),C=element("h3"),T=text(w),A=space(),M&&M.c(),x=empty$1(),attr(n,"class","title"),attr(o,"class","value"),attr(t,"class","value-wrap"),attr(u,"class","title"),attr(h,"class","value"),attr(c,"class","value-wrap"),attr(y,"class","title"),attr(C,"class","value"),attr(v,"class","value-wrap")},m(P,L){insert(P,t,L),append(t,n),append(t,s),append(t,o),append(o,l),insert(P,a,L),insert(P,c,L),append(c,u),append(c,f),append(c,h),append(h,g),insert(P,b,L),insert(P,v,L),append(v,y),append(v,S),append(v,C),append(C,T),insert(P,A,L),M&&M.m(P,L),insert(P,x,L),E=!0},p(P,L){(!E||L&8)&&r!==(r=P[3].chain+"")&&set_data(l,r),(!E||L&8)&&p!==(p=P[3].blocks+"")&&set_data(g,p),(!E||L&8)&&w!==(w=P[3].headers+"")&&set_data(T,w),P[3].chain==="regtest"?M?(M.p(P,L),L&8&&transition_in(M,1)):(M=create_if_block_2$7(P),M.c(),transition_in(M,1),M.m(x.parentNode,x)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros())},i(P){E||(transition_in(M),E=!0)},o(P){transition_out(M),E=!1},d(P){P&&detach(t),P&&detach(a),P&&detach(c),P&&detach(b),P&&detach(v),P&&detach(A),M&&M.d(P),P&&detach(x)}}}function create_if_block$f(i){let t;return{c(){t=element("div"),t.innerHTML="
Loading Bitcoin Info .....
",attr(t,"class","loading-wrap")},m(n,s){insert(n,t,s)},p:noop$2,i:noop$2,o:noop$2,d(n){n&&detach(t)}}}function create_if_block_2$7(i){let t,n,s,o,r=formatSatsNumbers(convertBtcToSats(i[2]))+"",l,a,c,u,f;return u=new BitcoinMine({props:{tag:i[0]}}),{c(){t=element("section"),n=element("h3"),n.textContent="WALLET BALANCE",s=space(),o=element("h3"),l=text(r),a=text(" Sats"),c=space(),create_component(u.$$.fragment),attr(n,"class","title"),attr(o,"class","value"),attr(t,"class","value-wrap")},m(h,p){insert(h,t,p),append(t,n),append(t,s),append(t,o),append(o,l),append(o,a),insert(h,c,p),mount_component(u,h,p),f=!0},p(h,p){(!f||p&4)&&r!==(r=formatSatsNumbers(convertBtcToSats(h[2]))+"")&&set_data(l,r);const g={};p&1&&(g.tag=h[0]),u.$set(g)},i(h){f||(transition_in(u.$$.fragment,h),f=!0)},o(h){transition_out(u.$$.fragment,h),f=!1},d(h){h&&detach(t),h&&detach(c),destroy_component(u,h)}}}function create_fragment$o(i){let t,n,s,o,r,l,a,c;const u=[create_if_block$f,create_if_block_1$9],f=[];function h(p,g){return p[1]?0:p[3]?1:-1}return~(l=h(i))&&(a=f[l]=u[l](i)),{c(){t=element("div"),n=element("h5"),n.textContent="Bitcoin Info",s=space(),o=element("div"),r=space(),a&&a.c(),attr(n,"class","info svelte-145wwyl"),attr(o,"class","spacer"),attr(t,"class","bitcoin-wrapper svelte-145wwyl")},m(p,g){insert(p,t,g),append(t,n),append(t,s),append(t,o),append(t,r),~l&&f[l].m(t,null),c=!0},p(p,[g]){let b=l;l=h(p),l===b?~l&&f[l].p(p,g):(a&&(group_outros(),transition_out(f[b],1,1,()=>{f[b]=null}),check_outros()),~l?(a=f[l],a?a.p(p,g):(a=f[l]=u[l](p),a.c()),transition_in(a,1),a.m(t,null)):a=null)},i(p){c||(transition_in(a),c=!0)},o(p){transition_out(a),c=!1},d(p){p&&detach(t),~l&&f[l].d()}}}function instance$n(i,t,n){let s,o;component_subscribe(i,walletBalance,u=>n(2,s=u)),component_subscribe(i,btcinfo,u=>n(3,o=u));let{tag:r=""}=t,l=!0;async function a(){if(n(1,l=!0),o&&o.blocks){n(1,l=!1);return}const u=await get_info$2(r);u&&btcinfo.set(u),n(1,l=!1)}async function c(){s||walletBalance.set(await get_balance$1(r))}return onMount(()=>{a(),c()}),i.$$set=u=>{"tag"in u&&n(0,r=u.tag)},[r,l,s,o]}class Bitcoin extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$n,create_fragment$o,safe_not_equal,{tag:0})}}async function proxyCmd(i,t,n){return await send_cmd("Proxy",{cmd:i,content:n},t)}async function get_proxy_balances(i){return await proxyCmd("GetBalance",i)}const Proxy_svelte_svelte_type_style_lang="";function create_if_block$e(i){let t,n,s,o,r=(i[0].user_count??0)+"",l,a,c,u,f,h,p=formatMillisatsToSats(i[0].total)+"",g;return{c(){t=element("section"),n=element("h3"),n.textContent="TOTAL USERS",s=space(),o=element("h3"),l=text(r),a=space(),c=element("section"),u=element("h3"),u.textContent="TOTAL SATS BALANCE",f=space(),h=element("h3"),g=text(p),attr(n,"class","title svelte-d6g9cn"),attr(o,"class","value svelte-d6g9cn"),attr(t,"class","value-wrap svelte-d6g9cn"),attr(u,"class","title svelte-d6g9cn"),attr(h,"class","value svelte-d6g9cn"),attr(c,"class","value-wrap svelte-d6g9cn")},m(b,v){insert(b,t,v),append(t,n),append(t,s),append(t,o),append(o,l),insert(b,a,v),insert(b,c,v),append(c,u),append(c,f),append(c,h),append(h,g)},p(b,v){v&1&&r!==(r=(b[0].user_count??0)+"")&&set_data(l,r),v&1&&p!==(p=formatMillisatsToSats(b[0].total)+"")&&set_data(g,p)},d(b){b&&detach(t),b&&detach(a),b&&detach(c)}}}function create_fragment$n(i){let t,n,s,o,r,l=i[0]&&create_if_block$e(i);return{c(){t=element("div"),n=element("h5"),n.textContent="Proxy Stats",s=space(),o=element("div"),r=space(),l&&l.c(),attr(n,"class","info svelte-d6g9cn"),attr(o,"class","spacer"),attr(t,"class","proxy-wrapper svelte-d6g9cn")},m(a,c){insert(a,t,c),append(t,n),append(t,s),append(t,o),append(t,r),l&&l.m(t,null)},p(a,[c]){a[0]?l?l.p(a,c):(l=create_if_block$e(a),l.c(),l.m(t,null)):l&&(l.d(1),l=null)},i:noop$2,o:noop$2,d(a){a&&detach(t),l&&l.d()}}}function instance$m(i,t,n){let s;component_subscribe(i,proxy,l=>n(0,s=l));let{tag:o=""}=t;async function r(){if(s.total&&s.user_count)return;const l=await get_proxy_balances(o);l&&proxy.set(l)}return onMount(()=>{r()}),i.$$set=l=>{"tag"in l&&n(1,o=l.tag)},[s,o]}let Proxy$1=class extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$m,create_fragment$n,safe_not_equal,{tag:1})}};const NavFiberAdmin_svelte_svelte_type_style_lang="",Endpoint_svelte_svelte_type_style_lang="";function create_fragment$m(i){let t,n,s,o,r,l,a,c,u;function f(p){i[5](p)}let h={size:"default",labelA:"",labelB:"",disabled:i[2]};return i[0]!==void 0&&(h.toggled=i[0]),a=new Toggle$1({props:h}),binding_callbacks.push(()=>bind(a,"toggled",f,i[0])),a.$on("toggle",i[6]),{c(){t=element("div"),n=element("div"),s=element("p"),o=text(i[1]),r=space(),l=element("div"),create_component(a.$$.fragment),attr(s,"class","endpoint-description svelte-19fzps1"),toggle_class(s,"active",i[0]),attr(l,"class","toggle-container svelte-19fzps1"),attr(n,"class","endpoint-container svelte-19fzps1"),attr(t,"class","container")},m(p,g){insert(p,t,g),append(t,n),append(n,s),append(s,o),append(n,r),append(n,l),mount_component(a,l,null),u=!0},p(p,[g]){(!u||g&2)&&set_data(o,p[1]),(!u||g&1)&&toggle_class(s,"active",p[0]);const b={};g&4&&(b.disabled=p[2]),!c&&g&1&&(c=!0,b.toggled=p[0],add_flush_callback(()=>c=!1)),a.$set(b)},i(p){u||(transition_in(a.$$.fragment,p),u=!0)},o(p){transition_out(a.$$.fragment,p),u=!1},d(p){p&&detach(t),destroy_component(a)}}}function instance$l(i,t,n){let s,o,{id:r}=t,{description:l=""}=t,{toggled:a=!1}=t;const c=createEventDispatcher();function u(g){c("customEvent",g)}async function f(g){n(2,s=!0);for(let b=0;b{f(g.detail.toggled)};return i.$$set=g=>{"id"in g&&n(4,r=g.id),"description"in g&&n(1,l=g.description),"toggled"in g&&n(0,a=g.toggled)},n(2,s=!1),o=!1,[a,l,s,f,r,h,p]}class Endpoint extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$l,create_fragment$m,safe_not_equal,{id:4,description:1,toggled:0})}}const EnpointPermission_svelte_svelte_type_style_lang="";function get_each_context$6(i,t,n){const s=i.slice();return s[4]=t[n],s[6]=n,s}function create_if_block$d(i){let t;return{c(){t=element("div"),t.innerHTML=`success

Endpoint Updated

`,attr(t,"class","success_container svelte-ccr49g")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_each_block$6(i,t){let n,s,o;return s=new Endpoint({props:{description:t[4].route_description,toggled:t[4].status,id:t[4].id}}),s.$on("customEvent",t[2]),{key:i,first:null,c(){n=empty$1(),create_component(s.$$.fragment),this.first=n},m(r,l){insert(r,n,l),mount_component(s,r,l),o=!0},p(r,l){t=r;const a={};l&2&&(a.description=t[4].route_description),l&2&&(a.toggled=t[4].status),l&2&&(a.id=t[4].id),s.$set(a)},i(r){o||(transition_in(s.$$.fragment,r),o=!0)},o(r){transition_out(s.$$.fragment,r),o=!1},d(r){r&&detach(n),destroy_component(s,r)}}}function create_fragment$l(i){let t,n,s,o,r,l=[],a=new Map,c,u=i[0]&&create_if_block$d(),f=i[1];const h=p=>p[4].route_description;for(let p=0;p{n(0,o=!1)},5e3)}return onMount(async()=>{await r()}),n(1,s=[]),n(0,o=!1),[o,s,l]}class EnpointPermission extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$k,create_fragment$l,safe_not_equal,{})}}const general_svelte_svelte_type_style_lang="";function get_each_context$5(i,t,n){const s=i.slice();return s[19]=t[n],s}function create_if_block_3$5(i){let t,n,s;return{c(){t=element("button"),t.textContent="Discard",attr(t,"class","discard-button svelte-bzi9wz")},m(o,r){insert(o,t,r),n||(s=listen(t,"click",i[7]),n=!0)},p:noop$2,d(o){o&&detach(t),n=!1,s()}}}function create_if_block_1$8(i){let t,n,s,o;function r(c,u){return c[1]===!0?create_if_block_2$6:create_else_block$c}let l=r(i),a=l(i);return{c(){t=element("button"),a.c(),t.disabled=n=!i[3],attr(t,"class","save-button svelte-bzi9wz")},m(c,u){insert(c,t,u),a.m(t,null),s||(o=listen(t,"click",i[8]),s=!0)},p(c,u){l!==(l=r(c))&&(a.d(1),a=l(c),a&&(a.c(),a.m(t,null))),u&8&&n!==(n=!c[3])&&(t.disabled=n)},d(c){c&&detach(t),a.d(),s=!1,o()}}}function create_else_block$c(i){let t;return{c(){t=text("Save Changes")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_2$6(i){let t;return{c(){t=element("div"),attr(t,"class","loading-spinner svelte-bzi9wz")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block$c(i){let t;return{c(){t=element("div"),t.innerHTML=`success

Changes Saved

`,attr(t,"class","success_container svelte-bzi9wz")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_each_block$5(i){let t,n,s,o,r,l,a=i[19].label+"",c,u,f,h=i[19].description+"",p,g,b,v;function y(...S){return i[11](i[19],...S)}return{c(){t=element("div"),n=element("input"),o=space(),r=element("div"),l=element("h4"),c=text(a),u=space(),f=element("p"),p=text(h),g=space(),attr(n,"type","checkbox"),attr(n,"class","checkbox svelte-bzi9wz"),n.checked=s=i[0][i[19].key].value,attr(l,"class","checkout-label svelte-bzi9wz"),attr(f,"class","checkout-label-description svelte-bzi9wz"),attr(r,"class","checkout-label-container svelte-bzi9wz"),attr(t,"class","checkbox-container svelte-bzi9wz")},m(S,C){insert(S,t,C),append(t,n),append(t,o),append(t,r),append(r,l),append(l,c),append(r,u),append(r,f),append(f,p),append(t,g),b||(v=listen(n,"click",y),b=!0)},p(S,C){i=S,C&1&&s!==(s=i[0][i[19].key].value)&&(n.checked=s)},d(S){S&&detach(t),b=!1,v()}}}function create_fragment$k(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,C,w,T,A,x,E,M=i[1]===!1&&i[3]===!0&&i[2]===!1&&create_if_block_3$5(i),P=i[2]===!1&&create_if_block_1$8(i),L=i[2]===!0&&create_if_block$c(),R=i[4],O=[];for(let B=0;BPublic diff --git a/app/dist/index.html b/app/dist/index.html index d8f7bcbe..2cf2780e 100644 --- a/app/dist/index.html +++ b/app/dist/index.html @@ -6,7 +6,7 @@ Sphinx Stack - +